@fungi.computer/grove 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/Effect-Bibd7o64.js +76 -0
- package/dist/assets/anthropic-messages-BC32dQ9I.js +19 -0
- package/dist/assets/azure-openai-responses-Cxq6500u.js +1 -0
- package/dist/assets/base-face-BEjKYyJe.js +1 -0
- package/dist/assets/burger-DCM1Ryjl.js +1 -0
- package/dist/assets/cat-D2ceQOG1.js +1 -0
- package/dist/assets/compat-CNGE3olg.js +2 -0
- package/dist/assets/document-CI1e8oXD.js +1 -0
- package/dist/assets/extension-hook-C8RQgls9.js +741 -0
- package/dist/assets/extensions-DYjwCmO5.js +1 -0
- package/dist/assets/google-generative-ai-C-fVQ8eG.js +1 -0
- package/dist/assets/google-shared-CRsSlHta.js +8 -0
- package/dist/assets/google-vertex-CPgYcjfH.js +1 -0
- package/dist/assets/index-26gTYfVj.js +171 -0
- package/dist/assets/index-DIRtUgKp.css +1 -0
- package/dist/assets/mistral-conversations-Dx6vubnB.js +4 -0
- package/dist/assets/mushroom-D2oxknl9.js +1 -0
- package/dist/assets/node.browser-DF9afU1k.js +1 -0
- package/dist/assets/openai-codex-responses-BJGSPctB.js +9 -0
- package/dist/assets/openai-completions-2akGjxPU.js +5 -0
- package/dist/assets/openai-responses-D6H3TRtV.js +1 -0
- package/dist/assets/openai-responses-shared-DZesysou.js +10 -0
- package/dist/assets/parakeet-conversation-DKtvvfd-.js +4 -0
- package/dist/assets/renderer-BHU7Ec4o.js +1 -0
- package/dist/assets/runtime-core-COw0PWwZ.js +1 -0
- package/dist/assets/transform-messages-CgFTI6NF.js +1 -0
- package/dist/index.html +6 -6
- package/package.json +11 -10
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-hePW80VL.js";var t,n=Object.freeze({status:`aborted`});function r(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var i=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},a=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(t=globalThis).__zod_globalConfig??(t.__zod_globalConfig={});var o=globalThis.__zod_globalConfig;function s(e){return e&&Object.assign(o,e),o}function c(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 l(e,t){return typeof t==`bigint`?t.toString():t}function u(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}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 ee(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var te=Symbol(`evaluating`);function p(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==te)return r===void 0&&(r=te,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function m(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ne(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function re(e){return JSON.stringify(e)}function ie(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var ae=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function oe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var se=u(()=>{if(o.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ce(e){if(oe(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return oe(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function le(e){return ce(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ue=new Set([`string`,`number`,`symbol`]),de=new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`undefined`]);function fe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function pe(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function h(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 me(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var he={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ge={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function _e(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`);return pe(e,ne(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return m(this,`shape`,e),e},checks:[]}))}function ve(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`);return pe(e,ne(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return m(this,`shape`,r),r},checks:[]}))}function ye(e,t){if(!ce(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return pe(e,ne(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return m(this,`shape`,n),n}}))}function be(e,t){if(!ce(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return pe(e,ne(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return m(this,`shape`,n),n}}))}function xe(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return pe(e,ne(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return m(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Se(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return pe(t,ne(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return m(this,`shape`,i),i},checks:[]}))}function Ce(e,t,n){return pe(t,ne(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return m(this,`shape`,i),i}}))}function we(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 Te(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 g(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ee(e){return typeof e==`string`?e:e?.message}function _(e,t,n){let r=e.message?e.message:Ee(e.inst?._zod.def?.error?.(e))??Ee(t?.error?.(e))??Ee(n.customError?.(e))??Ee(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function De(e){return e instanceof Set?`set`:e instanceof Map?`map`:e instanceof File?`file`:`unknown`}function Oe(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function ke(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Ae=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,l,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},je=r(`$ZodError`,Ae),Me=r(`$ZodError`,Ae,{Parent:Error});function Ne(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Pe(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];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}function Fe(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function Ie(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${Fe(e.path)}`);return t.join(`
|
|
2
|
+
`)}var Le=e=>(t,n,r,a)=>{let o=r?{...r,async:!1}:{async:!1},c=t._zod.run({value:n,issues:[]},o);if(c instanceof Promise)throw new i;if(c.issues.length){let t=new((a?.Err)??e)(c.issues.map(e=>_(e,o,s())));throw ae(t,a?.callee),t}return c.value},Re=Le(Me),ze=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>_(e,a,s())));throw ae(t,i?.callee),t}return o.value},Be=ze(Me),Ve=e=>(t,n,r)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new i;return o.issues.length?{success:!1,error:new(e??je)(o.issues.map(e=>_(e,a,s())))}:{success:!0,data:o.value}},He=Ve(Me),Ue=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?{success:!1,error:new e(a.issues.map(e=>_(e,i,s())))}:{success:!0,data:a.value}},We=Ue(Me),Ge=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Le(e)(t,n,i)},Ke=e=>(t,n,r)=>Le(e)(t,n,r),qe=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ze(e)(t,n,i)},Je=e=>async(t,n,r)=>ze(e)(t,n,r),Ye=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ve(e)(t,n,i)},Xe=e=>(t,n,r)=>Ve(e)(t,n,r),Ze=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ue(e)(t,n,i)},Qe=e=>async(t,n,r)=>Ue(e)(t,n,r),$e=e({base64:()=>Et,base64url:()=>Dt,bigint:()=>Rt,boolean:()=>Vt,browserEmail:()=>vt,cidrv4:()=>wt,cidrv6:()=>Tt,cuid:()=>et,cuid2:()=>tt,date:()=>Nt,datetime:()=>It,domain:()=>kt,duration:()=>ot,e164:()=>jt,email:()=>pt,emoji:()=>bt,extendedDuration:()=>st,guid:()=>ct,hex:()=>Kt,hostname:()=>Ot,html5Email:()=>mt,httpProtocol:()=>At,idnEmail:()=>_t,integer:()=>zt,ipv4:()=>xt,ipv6:()=>St,ksuid:()=>it,lowercase:()=>Wt,mac:()=>Ct,md5_base64:()=>Xt,md5_base64url:()=>Zt,md5_hex:()=>Yt,nanoid:()=>at,null:()=>Ht,number:()=>Bt,rfc5322Email:()=>ht,sha1_base64:()=>$t,sha1_base64url:()=>en,sha1_hex:()=>Qt,sha256_base64:()=>nn,sha256_base64url:()=>rn,sha256_hex:()=>tn,sha384_base64:()=>on,sha384_base64url:()=>sn,sha384_hex:()=>an,sha512_base64:()=>ln,sha512_base64url:()=>un,sha512_hex:()=>cn,string:()=>Lt,time:()=>Ft,ulid:()=>nt,undefined:()=>Ut,unicodeEmail:()=>gt,uppercase:()=>Gt,uuid:()=>lt,uuid4:()=>ut,uuid6:()=>dt,uuid7:()=>ft,xid:()=>rt}),et=/^[cC][0-9a-z]{6,}$/,tt=/^[0-9a-z]+$/,nt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,rt=/^[0-9a-vA-V]{20}$/,it=/^[A-Za-z0-9]{27}$/,at=/^[a-zA-Z0-9_-]{21}$/,ot=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,st=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ct=/^([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})$/,lt=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)$/,ut=lt(4),dt=lt(6),ft=lt(7),pt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,mt=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,ht=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,gt=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,_t=gt,vt=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,yt=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function bt(){return new RegExp(yt,`u`)}var xt=/^(?:(?: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])$/,St=/^(([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}|:))$/,Ct=e=>{let t=fe(e??`:`);return RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},wt=/^((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])$/,Tt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Et=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Dt=/^[A-Za-z0-9_-]*$/,Ot=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,kt=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,At=/^https?$/,jt=/^\+[1-9]\d{6,14}$/,Mt=`(?:(?:\\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])))`,Nt=RegExp(`^${Mt}$`);function Pt(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}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ft(e){return RegExp(`^${Pt(e)}$`)}function It(e){let t=Pt({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Mt}T(?:${r})$`)}var Lt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Rt=/^-?\d+n?$/,zt=/^-?\d+$/,Bt=/^-?\d+(?:\.\d+)?$/,Vt=/^(?:true|false)$/i,Ht=/^null$/i,Ut=/^undefined$/i,Wt=/^[^A-Z]*$/,Gt=/^[^a-z]*$/,Kt=/^[0-9a-fA-F]*$/;function qt(e,t){return RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Jt(e){return RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Yt=/^[0-9a-fA-F]{32}$/,Xt=qt(22,`==`),Zt=Jt(22),Qt=/^[0-9a-fA-F]{40}$/,$t=qt(27,`=`),en=Jt(27),tn=/^[0-9a-fA-F]{64}$/,nn=qt(43,`=`),rn=Jt(43),an=/^[0-9a-fA-F]{96}$/,on=qt(64,``),sn=Jt(64),cn=/^[0-9a-fA-F]{128}$/,ln=qt(86,`==`),un=Jt(86),v=r(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),dn={number:`number`,bigint:`bigint`,object:`date`},fn=r(`$ZodCheckLessThan`,(e,t)=>{v.init(e,t);let n=dn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),pn=r(`$ZodCheckGreaterThan`,(e,t)=>{v.init(e,t);let n=dn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),mn=r(`$ZodCheckMultipleOf`,(e,t)=>{v.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),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`?n.value%t.value===BigInt(0):ee(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})}}),hn=r(`$ZodCheckNumberFormat`,(e,t)=>{v.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=he[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=zt)}),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})}}),gn=r(`$ZodCheckBigIntFormat`,(e,t)=>{v.init(e,t);let[n,r]=ge[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=n,i.maximum=r}),e._zod.check=i=>{let a=i.value;a<n&&i.issues.push({origin:`bigint`,input:a,code:`too_small`,minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>r&&i.issues.push({origin:`bigint`,input:a,code:`too_big`,maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),_n=r(`$ZodCheckMaxSize`,(e,t)=>{var n;v.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!d(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;r.size<=t.maximum||n.issues.push({origin:De(r),code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),vn=r(`$ZodCheckMinSize`,(e,t)=>{var n;v.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!d(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;r.size>=t.minimum||n.issues.push({origin:De(r),code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),yn=r(`$ZodCheckSizeEquals`,(e,t)=>{var n;v.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!d(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=n=>{let r=n.value,i=r.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:De(r),...a?{code:`too_big`,maximum:t.size}:{code:`too_small`,minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),bn=r(`$ZodCheckMaxLength`,(e,t)=>{var n;v.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!d(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Oe(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),xn=r(`$ZodCheckMinLength`,(e,t)=>{var n;v.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!d(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Oe(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Sn=r(`$ZodCheckLengthEquals`,(e,t)=>{var n;v.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!d(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Oe(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Cn=r(`$ZodCheckStringFormat`,(e,t)=>{var n,r;v.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),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=()=>{})}),wn=r(`$ZodCheckRegex`,(e,t)=>{Cn.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})}}),Tn=r(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Wt,Cn.init(e,t)}),En=r(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Gt,Cn.init(e,t)}),Dn=r(`$ZodCheckIncludes`,(e,t)=>{v.init(e,t);let n=fe(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),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})}}),On=r(`$ZodCheckStartsWith`,(e,t)=>{v.init(e,t);let n=RegExp(`^${fe(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(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})}}),kn=r(`$ZodCheckEndsWith`,(e,t)=>{v.init(e,t);let n=RegExp(`.*${fe(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(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})}});function An(e,t,n){e.issues.length&&t.issues.push(...g(n,e.issues))}var jn=r(`$ZodCheckProperty`,(e,t)=>{v.init(e,t),e._zod.check=e=>{let n=t.schema._zod.run({value:e.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(n=>An(n,e,t.property));An(n,e,t.property)}}),Mn=r(`$ZodCheckMimeType`,(e,t)=>{v.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:`invalid_value`,values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),Nn=r(`$ZodCheckOverwrite`,(e,t)=>{v.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Pn=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
3
|
+
`).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?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
4
|
+
`))}},Fn={major:4,minor:4,patch:3},y=r(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Fn;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=we(e),a;for(let o of t){if(o._zod.def.when){if(Te(e)||!o._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&n?.async===!1)throw new i;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(r||=we(e,t))});else{if(e.issues.length===t)continue;r||=we(e,t)}}return a?a.then(()=>e):e},n=(n,a,o)=>{if(we(n))return n.aborted=!0,n;let s=t(a,r,o);if(s instanceof Promise){if(o.async===!1)throw new i;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(a,o)=>{if(o.skipChecks)return e._zod.parse(a,o);if(o.direction===`backward`){let t=e._zod.parse({value:a.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,a,o)):n(t,a,o)}let s=e._zod.parse(a,o);if(s instanceof Promise){if(o.async===!1)throw new i;return s.then(e=>t(e,r,o))}return t(s,r,o)}}p(e,`~standard`,()=>({validate:t=>{try{let n=He(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return We(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),In=r(`$ZodString`,(e,t)=>{y.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Lt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),b=r(`$ZodStringFormat`,(e,t)=>{Cn.init(e,t),In.init(e,t)}),Ln=r(`$ZodGUID`,(e,t)=>{t.pattern??=ct,b.init(e,t)}),Rn=r(`$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??=lt(e)}else t.pattern??=lt();b.init(e,t)}),zn=r(`$ZodEmail`,(e,t)=>{t.pattern??=pt,b.init(e,t)}),Bn=r(`$ZodURL`,(e,t)=>{b.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===At.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.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:r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Vn=r(`$ZodEmoji`,(e,t)=>{t.pattern??=bt(),b.init(e,t)}),Hn=r(`$ZodNanoID`,(e,t)=>{t.pattern??=at,b.init(e,t)}),Un=r(`$ZodCUID`,(e,t)=>{t.pattern??=et,b.init(e,t)}),Wn=r(`$ZodCUID2`,(e,t)=>{t.pattern??=tt,b.init(e,t)}),Gn=r(`$ZodULID`,(e,t)=>{t.pattern??=nt,b.init(e,t)}),Kn=r(`$ZodXID`,(e,t)=>{t.pattern??=rt,b.init(e,t)}),qn=r(`$ZodKSUID`,(e,t)=>{t.pattern??=it,b.init(e,t)}),Jn=r(`$ZodISODateTime`,(e,t)=>{t.pattern??=It(t),b.init(e,t)}),Yn=r(`$ZodISODate`,(e,t)=>{t.pattern??=Nt,b.init(e,t)}),Xn=r(`$ZodISOTime`,(e,t)=>{t.pattern??=Ft(t),b.init(e,t)}),Zn=r(`$ZodISODuration`,(e,t)=>{t.pattern??=ot,b.init(e,t)}),Qn=r(`$ZodIPv4`,(e,t)=>{t.pattern??=xt,b.init(e,t),e._zod.bag.format=`ipv4`}),$n=r(`$ZodIPv6`,(e,t)=>{t.pattern??=St,b.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),er=r(`$ZodMAC`,(e,t)=>{t.pattern??=Ct(t.delimiter),b.init(e,t),e._zod.bag.format=`mac`}),tr=r(`$ZodCIDRv4`,(e,t)=>{t.pattern??=wt,b.init(e,t)}),nr=r(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Tt,b.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function rr(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var ir=r(`$ZodBase64`,(e,t)=>{t.pattern??=Et,b.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{rr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function ar(e){if(!Dt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return rr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var or=r(`$ZodBase64URL`,(e,t)=>{t.pattern??=Dt,b.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{ar(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),sr=r(`$ZodE164`,(e,t)=>{t.pattern??=jt,b.init(e,t)});function cr(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 lr=r(`$ZodJWT`,(e,t)=>{b.init(e,t),e._zod.check=n=>{cr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),ur=r(`$ZodCustomStringFormat`,(e,t)=>{b.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:`invalid_format`,format:t.format,input:n.value,inst:e,continue:!t.abort})}}),dr=r(`$ZodNumber`,(e,t)=>{y.init(e,t),e._zod.pattern=e._zod.bag.pattern??Bt,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:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),fr=r(`$ZodNumberFormat`,(e,t)=>{hn.init(e,t),dr.init(e,t)}),pr=r(`$ZodBoolean`,(e,t)=>{y.init(e,t),e._zod.pattern=Vt,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}}),mr=r(`$ZodBigInt`,(e,t)=>{y.init(e,t),e._zod.pattern=Rt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value==`bigint`||n.issues.push({expected:`bigint`,code:`invalid_type`,input:n.value,inst:e}),n}}),hr=r(`$ZodBigIntFormat`,(e,t)=>{gn.init(e,t),mr.init(e,t)}),gr=r(`$ZodSymbol`,(e,t)=>{y.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return typeof r==`symbol`||t.issues.push({expected:`symbol`,code:`invalid_type`,input:r,inst:e}),t}}),_r=r(`$ZodUndefined`,(e,t)=>{y.init(e,t),e._zod.pattern=Ut,e._zod.values=new Set([void 0]),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),vr=r(`$ZodNull`,(e,t)=>{y.init(e,t),e._zod.pattern=Ht,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}}),yr=r(`$ZodAny`,(e,t)=>{y.init(e,t),e._zod.parse=e=>e}),br=r(`$ZodUnknown`,(e,t)=>{y.init(e,t),e._zod.parse=e=>e}),xr=r(`$ZodNever`,(e,t)=>{y.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),Sr=r(`$ZodVoid`,(e,t)=>{y.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}}),Cr=r(`$ZodDate`,(e,t)=>{y.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:`date`,code:`invalid_type`,input:i,...a?{received:`Invalid Date`}:{},inst:e}),n}});function wr(e,t,n){e.issues.length&&t.issues.push(...g(n,e.issues)),t.value[n]=e.value}var Tr=r(`$ZodArray`,(e,t)=>{y.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>wr(t,n,e))):wr(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Er(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...g(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Dr(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=me(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Or(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Er(e,n,i,t,u,d))):Er(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var kr=r(`$ZodObject`,(e,t)=>{if(y.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=u(()=>Dr(t));p(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=oe,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>Er(n,t,e,s,r,i))):Er(a,t,e,s,r,i)}return i?Or(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Ar=r(`$ZodObjectJIT`,(e,t)=>{kr.init(e,t);let n=e._zod.parse,r=u(()=>Dr(t)),i=e=>{let t=new Pn([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=re(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=re(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
5
|
+
if (${n}.issues.length) {
|
|
6
|
+
if (${o} in input) {
|
|
7
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
8
|
+
...iss,
|
|
9
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
10
|
+
})));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (${n}.value === undefined) {
|
|
15
|
+
if (${o} in input) {
|
|
16
|
+
newResult[${o}] = undefined;
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
newResult[${o}] = ${n}.value;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
`):c?t.write(`
|
|
23
|
+
if (${n}.issues.length) {
|
|
24
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
25
|
+
...iss,
|
|
26
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
27
|
+
})));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (${n}.value === undefined) {
|
|
31
|
+
if (${o} in input) {
|
|
32
|
+
newResult[${o}] = undefined;
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
newResult[${o}] = ${n}.value;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
`):t.write(`
|
|
39
|
+
const ${n}_present = ${o} in input;
|
|
40
|
+
if (${n}.issues.length) {
|
|
41
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
42
|
+
...iss,
|
|
43
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
44
|
+
})));
|
|
45
|
+
}
|
|
46
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
47
|
+
payload.issues.push({
|
|
48
|
+
code: "invalid_type",
|
|
49
|
+
expected: "nonoptional",
|
|
50
|
+
input: undefined,
|
|
51
|
+
path: [${o}]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (${n}_present) {
|
|
56
|
+
if (${n}.value === undefined) {
|
|
57
|
+
newResult[${o}] = undefined;
|
|
58
|
+
} else {
|
|
59
|
+
newResult[${o}] = ${n}.value;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,s=oe,c=!o.jitless,l=c&&se.value,d=t.catchall,f;e._zod.parse=(o,u)=>{f??=r.value;let ee=o.value;return s(ee)?c&&l&&u?.async===!1&&u.jitless!==!0?(a||=i(t.shape),o=a(o,u),d?Or([],ee,o,u,f,e):o):n(o,u):(o.issues.push({expected:`object`,code:`invalid_type`,input:ee,inst:e}),o)}});function jr(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=>!we(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=>_(e,r,s())))}),t)}var Mr=r(`$ZodUnion`,(e,t)=>{y.init(e,t),p(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),p(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),p(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),p(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.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=>jr(t,r,e,i)):jr(o,r,e,i)}});function Nr(e,t,n,r){let i=e.filter(e=>e.issues.length===0);return i.length===1?(t.value=i[0].value,t):(i.length===0?t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>_(e,r,s())))}):t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:[],inclusive:!1}),t)}var Pr=r(`$ZodXor`,(e,t)=>{Mr.init(e,t),t.inclusive=!1;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);t instanceof Promise?(o.push(t),a=!0):o.push(t)}return a?Promise.all(o).then(t=>Nr(t,r,e,i)):Nr(o,r,e,i)}}),Fr=r(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Mr.init(e,t);let n=e._zod.parse;p(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=u(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!oe(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._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()),input:o,path:[t.discriminator],inst:e}),i)}}),Ir=r(`$ZodIntersection`,(e,t)=>{y.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(ce(e)&&ce(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){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;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),we(e))return e;let o=Lr(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var zr=r(`$ZodTuple`,(e,t)=>{y.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let o=[],s=Br(n,`optin`),c=Br(n,`optout`);if(!t.rest){if(a.length<s)return r.issues.push({code:`too_small`,minimum:s,inclusive:!0,input:a,inst:e,origin:`array`}),r;a.length>n.length&&r.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:a,inst:e,origin:`array`})}let l=Array(n.length);for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:a[e],issues:[]},i);t instanceof Promise?o.push(t.then(t=>{l[e]=t})):l[e]=t}if(t.rest){let e=n.length-1,s=a.slice(n.length);for(let n of s){e++;let a=t.rest._zod.run({value:n,issues:[]},i);a instanceof Promise?o.push(a.then(t=>Vr(t,r,e))):Vr(a,r,e)}}return o.length?Promise.all(o).then(()=>Hr(l,r,n,a,c)):Hr(l,r,n,a,c)}});function Br(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!==`optional`)return n+1;return 0}function Vr(e,t,n){e.issues.length&&t.issues.push(...g(n,e.issues)),t.value[n]=e.value}function Hr(e,t,n,r,i){for(let a=0;a<n.length;a++){let n=e[a],o=a<r.length;if(n.issues.length){if(!o&&a>=i){t.value.length=a;break}t.issues.push(...g(a,n.issues))}t.value[a]=n.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}var Ur=r(`$ZodRecord`,(e,t)=>{y.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!ce(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let c=new Set;for(let l of o)if(typeof l==`string`||typeof l==`number`||typeof l==`symbol`){c.add(typeof l==`number`?l.toString():l);let o=t.keyType._zod.run({value:l,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>_(e,r,s())),input:l,path:[l],inst:e});continue}let u=o.value,d=t.valueType._zod.run({value:i[l],issues:[]},r);d instanceof Promise?a.push(d.then(e=>{e.issues.length&&n.issues.push(...g(l,e.issues)),n.value[u]=e.value})):(d.issues.length&&n.issues.push(...g(l,d.issues)),n.value[u]=d.value)}let l;for(let e in i)c.has(e)||(l??=[],l.push(e));l&&l.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:l})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let c=t.keyType._zod.run({value:o,issues:[]},r);if(c instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Bt.test(o)&&c.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(c=e)}if(c.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:c.issues.map(e=>_(e,r,s())),input:o,path:[o],inst:e});continue}let l=t.valueType._zod.run({value:i[o],issues:[]},r);l instanceof Promise?a.push(l.then(e=>{e.issues.length&&n.issues.push(...g(o,e.issues)),n.value[c.value]=e.value})):(l.issues.length&&n.issues.push(...g(o,l.issues)),n.value[c.value]=l.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Wr=r(`$ZodMap`,(e,t)=>{y.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!(i instanceof Map))return n.issues.push({expected:`map`,code:`invalid_type`,input:i,inst:e}),n;let a=[];n.value=new Map;for(let[o,s]of i){let c=t.keyType._zod.run({value:o,issues:[]},r),l=t.valueType._zod.run({value:s,issues:[]},r);c instanceof Promise||l instanceof Promise?a.push(Promise.all([c,l]).then(([t,a])=>{Gr(t,a,n,o,i,e,r)})):Gr(c,l,n,o,i,e,r)}return a.length?Promise.all(a).then(()=>n):n}});function Gr(e,t,n,r,i,a,o){e.issues.length&&(ue.has(typeof r)?n.issues.push(...g(r,e.issues)):n.issues.push({code:`invalid_key`,origin:`map`,input:i,inst:a,issues:e.issues.map(e=>_(e,o,s()))})),t.issues.length&&(ue.has(typeof r)?n.issues.push(...g(r,t.issues)):n.issues.push({origin:`map`,code:`invalid_element`,input:i,inst:a,key:r,issues:t.issues.map(e=>_(e,o,s()))})),n.value.set(e.value,t.value)}var Kr=r(`$ZodSet`,(e,t)=>{y.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:e,expected:`set`,code:`invalid_type`}),n;let a=[];n.value=new Set;for(let e of i){let i=t.valueType._zod.run({value:e,issues:[]},r);i instanceof Promise?a.push(i.then(e=>qr(e,n))):qr(i,n)}return a.length?Promise.all(a).then(()=>n):n}});function qr(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var Jr=r(`$ZodEnum`,(e,t)=>{y.init(e,t);let n=c(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ue.has(typeof e)).map(e=>typeof e==`string`?fe(e):e.toString()).join(`|`)})$`),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}}),Yr=r(`$ZodLiteral`,(e,t)=>{if(y.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?fe(e):e?fe(e.toString()):String(e)).join(`|`)})$`),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}}),Xr=r(`$ZodFile`,(e,t)=>{y.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r instanceof File||t.issues.push({expected:`file`,code:`invalid_type`,input:r,inst:e}),t}}),Zr=r(`$ZodTransform`,(e,t)=>{y.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new a(e.constructor.name);let o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(n.value=e,n.fallback=!0,n));if(o instanceof Promise)throw new i;return n.value=o,n.fallback=!0,n}});function Qr(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var $r=r(`$ZodOptional`,(e,t)=>{y.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,p(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),p(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${f(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Qr(e,r)):Qr(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),ei=r(`$ZodExactOptional`,(e,t)=>{$r.init(e,t),p(e._zod,`values`,()=>t.innerType._zod.values),p(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),ti=r(`$ZodNullable`,(e,t)=>{y.init(e,t),p(e._zod,`optin`,()=>t.innerType._zod.optin),p(e._zod,`optout`,()=>t.innerType._zod.optout),p(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${f(e.source)}|null)$`):void 0}),p(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),ni=r(`$ZodDefault`,(e,t)=>{y.init(e,t),e._zod.optin=`optional`,p(e._zod,`values`,()=>t.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=>ri(e,t)):ri(r,t)}});function ri(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ii=r(`$ZodPrefault`,(e,t)=>{y.init(e,t),e._zod.optin=`optional`,p(e._zod,`values`,()=>t.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))}),ai=r(`$ZodNonOptional`,(e,t)=>{y.init(e,t),p(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].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=>oi(t,e)):oi(i,e)}});function oi(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var si=r(`$ZodSuccess`,(e,t)=>{y.init(e,t),e._zod.parse=(e,n)=>{if(n.direction===`backward`)throw new a(`ZodSuccess`);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>(e.value=t.issues.length===0,e)):(e.value=r.issues.length===0,e)}}),ci=r(`$ZodCatch`,(e,t)=>{y.init(e,t),e._zod.optin=`optional`,p(e._zod,`optout`,()=>t.innerType._zod.optout),p(e._zod,`values`,()=>t.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(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>_(e,n,s()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>_(e,n,s()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),li=r(`$ZodNaN`,(e,t)=>{y.init(e,t),e._zod.parse=(t,n)=>((typeof t.value!=`number`||!Number.isNaN(t.value))&&t.issues.push({input:t.value,inst:e,expected:`nan`,code:`invalid_type`}),t)}),ui=r(`$ZodPipe`,(e,t)=>{y.init(e,t),p(e._zod,`values`,()=>t.in._zod.values),p(e._zod,`optin`,()=>t.in._zod.optin),p(e._zod,`optout`,()=>t.out._zod.optout),p(e._zod,`propValues`,()=>t.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=>di(e,t.in,n)):di(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>di(e,t.out,n)):di(r,t.out,n)}});function di(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var fi=r(`$ZodCodec`,(e,t)=>{y.init(e,t),p(e._zod,`values`,()=>t.in._zod.values),p(e._zod,`optin`,()=>t.in._zod.optin),p(e._zod,`optout`,()=>t.out._zod.optout),p(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if((n.direction||`forward`)===`forward`){let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>pi(e,t,n)):pi(r,t,n)}{let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>pi(e,t,n)):pi(r,t,n)}}});function pi(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||`forward`)===`forward`){let r=t.transform(e.value,e);return r instanceof Promise?r.then(r=>mi(e,r,t.out,n)):mi(e,r,t.out,n)}{let r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(r=>mi(e,r,t.in,n)):mi(e,r,t.in,n)}}function mi(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}var hi=r(`$ZodPreprocess`,(e,t)=>{ui.init(e,t)}),gi=r(`$ZodReadonly`,(e,t)=>{y.init(e,t),p(e._zod,`propValues`,()=>t.innerType._zod.propValues),p(e._zod,`values`,()=>t.innerType._zod.values),p(e._zod,`optin`,()=>t.innerType?._zod?.optin),p(e._zod,`optout`,()=>t.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(_i):_i(r)}});function _i(e){return e.value=Object.freeze(e.value),e}var vi=r(`$ZodTemplateLiteral`,(e,t)=>{y.init(e,t);let n=[];for(let e of t.parts)if(typeof e==`object`&&e){if(!e._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);let t=e._zod.pattern instanceof RegExp?e._zod.pattern.source:e._zod.pattern;if(!t)throw Error(`Invalid template literal part: ${e._zod.traits}`);let r=+!!t.startsWith(`^`),i=t.endsWith(`$`)?t.length-1:t.length;n.push(t.slice(r,i))}else if(e===null||de.has(typeof e))n.push(fe(`${e}`));else throw Error(`Invalid template literal part: ${e}`);e._zod.pattern=RegExp(`^${n.join(``)}$`),e._zod.parse=(n,r)=>typeof n.value==`string`?(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:`invalid_format`,format:t.format??`template_literal`,pattern:e._zod.pattern.source}),n):(n.issues.push({input:n.value,inst:e,expected:`string`,code:`invalid_type`}),n)}),yi=r(`$ZodFunction`,(e,t)=>(y.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if(typeof t!=`function`)throw Error(`implement() must be called with a function`);return function(...n){let r=e._def.input?Re(e._def.input,n):n,i=Reflect.apply(t,this,r);return e._def.output?Re(e._def.output,i):i}},e.implementAsync=t=>{if(typeof t!=`function`)throw Error(`implementAsync() must be called with a function`);return async function(...n){let r=e._def.input?await Be(e._def.input,n):n,i=await Reflect.apply(t,this,r);return e._def.output?await Be(e._def.output,i):i}},e._zod.parse=(t,n)=>typeof t.value==`function`?(t.value=e._def.output&&e._def.output._zod.def.type===`promise`?e.implementAsync(t.value):e.implement(t.value),t):(t.issues.push({code:`invalid_type`,expected:`function`,input:t.value,inst:e}),t),e.input=(...t)=>{let n=e.constructor;return Array.isArray(t[0])?new n({type:`function`,input:new zr({type:`tuple`,items:t[0],rest:t[1]}),output:e._def.output}):new n({type:`function`,input:t[0],output:e._def.output})},e.output=t=>{let n=e.constructor;return new n({type:`function`,input:e._def.input,output:t})},e)),bi=r(`$ZodPromise`,(e,t)=>{y.init(e,t),e._zod.parse=(e,n)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},n))}),xi=r(`$ZodLazy`,(e,t)=>{y.init(e,t),p(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),p(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),p(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),p(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),p(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Si=r(`$ZodCustom`,(e,t)=>{v.init(e,t),y.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=>Ci(t,n,r,e));Ci(i,n,r,e)}});function Ci(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(ke(e))}}var wi,Ti=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 Ei(){return new Ti}(wi=globalThis).__zod_globalRegistry??(wi.__zod_globalRegistry=Ei());var Di=globalThis.__zod_globalRegistry;function Oi(e,t){return new e({type:`string`,...h(t)})}function ki(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...h(t)})}function Ai(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...h(t)})}function ji(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...h(t)})}function Mi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...h(t)})}function Ni(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...h(t)})}function Pi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...h(t)})}function Fi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...h(t)})}function Ii(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...h(t)})}function Li(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...h(t)})}function Ri(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...h(t)})}function zi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...h(t)})}function Bi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...h(t)})}function Vi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...h(t)})}function Hi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...h(t)})}function Ui(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...h(t)})}function Wi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...h(t)})}function Gi(e,t){return new e({type:`string`,format:`mac`,check:`string_format`,abort:!1,...h(t)})}function Ki(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...h(t)})}function qi(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...h(t)})}function Ji(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...h(t)})}function Yi(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...h(t)})}function Xi(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...h(t)})}function Zi(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...h(t)})}function Qi(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...h(t)})}function $i(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...h(t)})}function ea(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...h(t)})}function ta(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...h(t)})}function na(e,t){return new e({type:`number`,checks:[],...h(t)})}function ra(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...h(t)})}function ia(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`float32`,...h(t)})}function aa(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`float64`,...h(t)})}function oa(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`int32`,...h(t)})}function sa(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`uint32`,...h(t)})}function ca(e,t){return new e({type:`boolean`,...h(t)})}function la(e,t){return new e({type:`bigint`,...h(t)})}function ua(e,t){return new e({type:`bigint`,check:`bigint_format`,abort:!1,format:`int64`,...h(t)})}function da(e,t){return new e({type:`bigint`,check:`bigint_format`,abort:!1,format:`uint64`,...h(t)})}function fa(e,t){return new e({type:`symbol`,...h(t)})}function pa(e,t){return new e({type:`undefined`,...h(t)})}function ma(e,t){return new e({type:`null`,...h(t)})}function ha(e){return new e({type:`any`})}function ga(e){return new e({type:`unknown`})}function _a(e,t){return new e({type:`never`,...h(t)})}function va(e,t){return new e({type:`void`,...h(t)})}function ya(e,t){return new e({type:`date`,...h(t)})}function ba(e,t){return new e({type:`nan`,...h(t)})}function xa(e,t){return new fn({check:`less_than`,...h(t),value:e,inclusive:!1})}function Sa(e,t){return new fn({check:`less_than`,...h(t),value:e,inclusive:!0})}function Ca(e,t){return new pn({check:`greater_than`,...h(t),value:e,inclusive:!1})}function wa(e,t){return new pn({check:`greater_than`,...h(t),value:e,inclusive:!0})}function Ta(e){return Ca(0,e)}function Ea(e){return xa(0,e)}function Da(e){return Sa(0,e)}function Oa(e){return wa(0,e)}function ka(e,t){return new mn({check:`multiple_of`,...h(t),value:e})}function Aa(e,t){return new _n({check:`max_size`,...h(t),maximum:e})}function ja(e,t){return new vn({check:`min_size`,...h(t),minimum:e})}function Ma(e,t){return new yn({check:`size_equals`,...h(t),size:e})}function Na(e,t){return new bn({check:`max_length`,...h(t),maximum:e})}function Pa(e,t){return new xn({check:`min_length`,...h(t),minimum:e})}function Fa(e,t){return new Sn({check:`length_equals`,...h(t),length:e})}function Ia(e,t){return new wn({check:`string_format`,format:`regex`,...h(t),pattern:e})}function La(e){return new Tn({check:`string_format`,format:`lowercase`,...h(e)})}function Ra(e){return new En({check:`string_format`,format:`uppercase`,...h(e)})}function za(e,t){return new Dn({check:`string_format`,format:`includes`,...h(t),includes:e})}function Ba(e,t){return new On({check:`string_format`,format:`starts_with`,...h(t),prefix:e})}function Va(e,t){return new kn({check:`string_format`,format:`ends_with`,...h(t),suffix:e})}function Ha(e,t,n){return new jn({check:`property`,property:e,schema:t,...h(n)})}function Ua(e,t){return new Mn({check:`mime_type`,mime:e,...h(t)})}function Wa(e){return new Nn({check:`overwrite`,tx:e})}function Ga(e){return Wa(t=>t.normalize(e))}function Ka(){return Wa(e=>e.trim())}function qa(){return Wa(e=>e.toLowerCase())}function Ja(){return Wa(e=>e.toUpperCase())}function Ya(){return Wa(e=>ie(e))}function Xa(e,t,n){return new e({type:`array`,element:t,...h(n)})}function Za(e,t){return new e({type:`file`,...h(t)})}function Qa(e,t,n){let r=h(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function $a(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...h(n)})}function eo(e,t){let n=to(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(ke(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(ke(r))}},e(t.value,t)),t);return n}function to(e,t){let n=new v({check:`custom`,...h(t)});return n._zod.check=e,n}function no(e){let t=new v({check:`describe`});return t._zod.onattach=[t=>{let n=Di.get(t)??{};Di.add(t,{...n,description:e})}],t._zod.check=()=>{},t}function ro(e){let t=new v({check:`meta`});return t._zod.onattach=[t=>{let n=Di.get(t)??{};Di.add(t,{...n,...e})}],t._zod.check=()=>{},t}function io(e,t){let n=h(t),r=n.truthy??[`true`,`1`,`yes`,`on`,`y`,`enabled`],i=n.falsy??[`false`,`0`,`no`,`off`,`n`,`disabled`];n.case!==`sensitive`&&(r=r.map(e=>typeof e==`string`?e.toLowerCase():e),i=i.map(e=>typeof e==`string`?e.toLowerCase():e));let a=new Set(r),o=new Set(i),s=e.Codec??fi,c=e.Boolean??pr,l=new s({type:`pipe`,in:new(e.String??In)({type:`string`,error:n.error}),out:new c({type:`boolean`,error:n.error}),transform:((e,t)=>{let r=e;return n.case!==`sensitive`&&(r=r.toLowerCase()),a.has(r)?!0:!o.has(r)&&(t.issues.push({code:`invalid_value`,expected:`stringbool`,values:[...a,...o],input:t.value,inst:l,continue:!1}),{})}),reverseTransform:((e,t)=>e===!0?r[0]||`true`:i[0]||`false`),error:n.error});return l}function ao(e,t,n,r={}){let i=h(r),a={...h(r),check:`string_format`,type:`string`,format:t,fn:typeof n==`function`?n:e=>n.test(e),...i};return n instanceof RegExp&&(a.pattern=n),new e(a)}function oo(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??Di,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function x(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);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,x(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&S(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 so(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);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}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+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>
|
|
64
|
+
|
|
65
|
+
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}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function co(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)):Object.assign(i,s),Object.assign(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??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);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)}Object.assign(i,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??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}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:uo(t,`input`,e.processors),output:uo(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function S(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 S(r.element,n);if(r.type===`set`)return S(r.valueType,n);if(r.type===`lazy`)return S(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return S(r.innerType,n);if(r.type===`intersection`)return S(r.left,n)||S(r.right,n);if(r.type===`record`||r.type===`map`)return S(r.keyType,n)||S(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:S(r.in,n)||S(r.out,n);if(r.type===`object`){for(let e in r.shape)if(S(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(S(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(S(e,n))return!0;return!!(r.rest&&S(r.rest,n))}return!1}var lo=(e,t={})=>n=>{let r=oo({...n,processors:t});return x(e,r),so(r,e),co(r,e)},uo=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=oo({...i??{},target:a,io:t,processors:n});return x(e,o),so(o,e),co(o,e)},fo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},po=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=fo[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];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}))])}},mo=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),ee=t.target===`draft-04`||t.target===`openapi-3.0`;d?ee?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?ee?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},ho=(e,t,n,r)=>{n.type=`boolean`},go=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},_o=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},vo=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},yo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},bo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},xo=(e,t,n,r)=>{n.not={}},So=(e,t,n,r)=>{},Co=(e,t,n,r)=>{},wo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},To=(e,t,n,r)=>{let i=e._zod.def,a=c(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Eo=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);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}},Do=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},Oo=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},ko=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},Ao=(e,t,n,r)=>{n.type=`boolean`},jo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Mo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},No=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Po=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},Fo=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},Io=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=x(a.element,t,{...r,path:[...r.path,`items`]})},Lo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=x(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=x(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ro=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>x(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},zo=(e,t,n,r)=>{let i=e._zod.def,a=x(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=x(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Bo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>x(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?x(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},Vo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=x(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=x(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=x(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Ho=(e,t,n,r)=>{let i=e._zod.def,a=x(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`}]},Uo=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Wo=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Go=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ko=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},qo=(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;x(o,t,r);let s=t.seen.get(e);s.ref=o},Jo=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Yo=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Xo=(e,t,n,r)=>{let i=e._zod.def;x(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Zo=(e,t,n,r)=>{let i=e._zod.innerType;x(i,t,r);let a=t.seen.get(e);a.ref=i},Qo={string:po,number:mo,boolean:ho,bigint:go,symbol:_o,null:vo,undefined:yo,void:bo,never:xo,any:So,unknown:Co,date:wo,enum:To,literal:Eo,nan:Do,template_literal:Oo,file:ko,success:Ao,custom:jo,function:Mo,transform:No,map:Po,set:Fo,array:Io,object:Lo,union:Ro,intersection:zo,tuple:Bo,record:Vo,nullable:Ho,nonoptional:Uo,default:Wo,prefault:Go,catch:Ko,pipe:qo,readonly:Jo,promise:Yo,optional:Xo,lazy:Zo};function $o(e,t){if(`_idmap`in e){let n=e,r=oo({...t,processors:Qo}),i={};for(let e of n._idmap.entries()){let[t,n]=e;x(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;so(r,n),a[t]=co(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=oo({...t,processors:Qo});return x(e,n),so(n,e),co(n,e)}var es=e({ZodISODate:()=>rs,ZodISODateTime:()=>ts,ZodISODuration:()=>ss,ZodISOTime:()=>as,date:()=>is,datetime:()=>ns,duration:()=>cs,time:()=>os}),ts=r(`ZodISODateTime`,(e,t)=>{Jn.init(e,t),T.init(e,t)});function ns(e){return Qi(ts,e)}var rs=r(`ZodISODate`,(e,t)=>{Yn.init(e,t),T.init(e,t)});function is(e){return $i(rs,e)}var as=r(`ZodISOTime`,(e,t)=>{Xn.init(e,t),T.init(e,t)});function os(e){return ea(as,e)}var ss=r(`ZodISODuration`,(e,t)=>{Zn.init(e,t),T.init(e,t)});function cs(e){return ta(ss,e)}var C=r(`ZodError`,(e,t)=>{je.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Pe(e,t)},flatten:{value:t=>Ne(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,l,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,l,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),ls=Le(C),us=ze(C),ds=Ve(C),fs=Ue(C),ps=Ge(C),ms=Ke(C),hs=qe(C),gs=Je(C),_s=Ye(C),vs=Xe(C),ys=Ze(C),bs=Qe(C),xs=e({ZodAny:()=>Uc,ZodArray:()=>$c,ZodBase64:()=>lc,ZodBase64URL:()=>dc,ZodBigInt:()=>Mc,ZodBigIntFormat:()=>Pc,ZodBoolean:()=>Ac,ZodCIDRv4:()=>ac,ZodCIDRv6:()=>sc,ZodCUID:()=>Us,ZodCUID2:()=>Gs,ZodCatch:()=>Jl,ZodCodec:()=>eu,ZodCustom:()=>mu,ZodCustomStringFormat:()=>_c,ZodDate:()=>Zc,ZodDefault:()=>Bl,ZodDiscriminatedUnion:()=>ul,ZodE164:()=>pc,ZodEmail:()=>Ds,ZodEmoji:()=>zs,ZodEnum:()=>wl,ZodExactOptional:()=>Fl,ZodFile:()=>kl,ZodFunction:()=>fu,ZodGUID:()=>ks,ZodIPv4:()=>$s,ZodIPv6:()=>rc,ZodIntersection:()=>fl,ZodJWT:()=>hc,ZodKSUID:()=>Zs,ZodLazy:()=>cu,ZodLiteral:()=>Dl,ZodMAC:()=>tc,ZodMap:()=>bl,ZodNaN:()=>Xl,ZodNanoID:()=>Vs,ZodNever:()=>qc,ZodNonOptional:()=>Wl,ZodNull:()=>Vc,ZodNullable:()=>Ll,ZodNumber:()=>Sc,ZodNumberFormat:()=>wc,ZodObject:()=>nl,ZodOptional:()=>Nl,ZodPipe:()=>Ql,ZodPrefault:()=>Hl,ZodPreprocess:()=>ru,ZodPromise:()=>uu,ZodReadonly:()=>iu,ZodRecord:()=>gl,ZodSet:()=>Sl,ZodString:()=>Ts,ZodStringFormat:()=>T,ZodSuccess:()=>Kl,ZodSymbol:()=>Lc,ZodTemplateLiteral:()=>ou,ZodTransform:()=>jl,ZodTuple:()=>ml,ZodType:()=>w,ZodULID:()=>qs,ZodURL:()=>Is,ZodUUID:()=>js,ZodUndefined:()=>zc,ZodUnion:()=>ol,ZodUnknown:()=>Gc,ZodVoid:()=>Yc,ZodXID:()=>Ys,ZodXor:()=>cl,_ZodString:()=>ws,_default:()=>Vl,_function:()=>pu,any:()=>Wc,array:()=>el,base64:()=>uc,base64url:()=>fc,bigint:()=>Nc,boolean:()=>jc,catch:()=>Yl,check:()=>hu,cidrv4:()=>oc,cidrv6:()=>cc,codec:()=>tu,cuid:()=>Ws,cuid2:()=>Ks,custom:()=>gu,date:()=>Qc,describe:()=>yu,discriminatedUnion:()=>dl,e164:()=>mc,email:()=>Os,emoji:()=>Bs,enum:()=>Tl,exactOptional:()=>Il,file:()=>Al,float32:()=>Ec,float64:()=>Dc,function:()=>pu,guid:()=>As,hash:()=>xc,hex:()=>bc,hostname:()=>yc,httpUrl:()=>Rs,instanceof:()=>xu,int:()=>Tc,int32:()=>Oc,int64:()=>Fc,intersection:()=>pl,invertCodec:()=>nu,ipv4:()=>ec,ipv6:()=>ic,json:()=>Cu,jwt:()=>gc,keyof:()=>tl,ksuid:()=>Qs,lazy:()=>lu,literal:()=>Ol,looseObject:()=>al,looseRecord:()=>yl,mac:()=>nc,map:()=>xl,meta:()=>bu,nan:()=>Zl,nanoid:()=>Hs,nativeEnum:()=>El,never:()=>Jc,nonoptional:()=>Gl,null:()=>Hc,nullable:()=>Rl,nullish:()=>zl,number:()=>Cc,object:()=>rl,optional:()=>Pl,partialRecord:()=>vl,pipe:()=>$l,prefault:()=>Ul,preprocess:()=>wu,promise:()=>du,readonly:()=>au,record:()=>_l,refine:()=>_u,set:()=>Cl,strictObject:()=>il,string:()=>Es,stringFormat:()=>vc,stringbool:()=>Su,success:()=>ql,superRefine:()=>vu,symbol:()=>Rc,templateLiteral:()=>su,transform:()=>Ml,tuple:()=>hl,uint32:()=>kc,uint64:()=>Ic,ulid:()=>Js,undefined:()=>Bc,union:()=>sl,unknown:()=>Kc,url:()=>Ls,uuid:()=>Ms,uuidv4:()=>Ns,uuidv6:()=>Ps,uuidv7:()=>Fs,void:()=>Xc,xid:()=>Xs,xor:()=>ll}),Ss=new WeakMap;function Cs(e,t,n){let r=Object.getPrototypeOf(e),i=Ss.get(r);if(i||(i=new Set,Ss.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var w=r(`ZodType`,(e,t)=>(y.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:uo(e,`input`),output:uo(e,`output`)}}),e.toJSONSchema=lo(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>ls(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ds(e,t,n),e.parseAsync=async(t,n)=>us(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>fs(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ps(e,t,n),e.decode=(t,n)=>ms(e,t,n),e.encodeAsync=async(t,n)=>hs(e,t,n),e.decodeAsync=async(t,n)=>gs(e,t,n),e.safeEncode=(t,n)=>_s(e,t,n),e.safeDecode=(t,n)=>vs(e,t,n),e.safeEncodeAsync=async(t,n)=>ys(e,t,n),e.safeDecodeAsync=async(t,n)=>bs(e,t,n),Cs(e,`ZodType`,{check(...e){let t=this.def;return this.clone(ne(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 pe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(_u(e,t))},superRefine(e,t){return this.check(vu(e,t))},overwrite(e){return this.check(Wa(e))},optional(){return Pl(this)},exactOptional(){return Il(this)},nullable(){return Rl(this)},nullish(){return Pl(Rl(this))},nonoptional(e){return Gl(this,e)},array(){return el(this)},or(e){return sl([this,e])},and(e){return pl(this,e)},transform(e){return $l(this,Ml(e))},default(e){return Vl(this,e)},prefault(e){return Ul(this,e)},catch(e){return Yl(this,e)},pipe(e){return $l(this,e)},readonly(){return au(this)},describe(e){let t=this.clone();return Di.add(t,{description:e}),t},meta(...e){if(e.length===0)return Di.get(this);let t=this.clone();return Di.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return Di.get(e)?.description},configurable:!0}),e)),ws=r(`_ZodString`,(e,t)=>{In.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Cs(e,`_ZodString`,{regex(...e){return this.check(Ia(...e))},includes(...e){return this.check(za(...e))},startsWith(...e){return this.check(Ba(...e))},endsWith(...e){return this.check(Va(...e))},min(...e){return this.check(Pa(...e))},max(...e){return this.check(Na(...e))},length(...e){return this.check(Fa(...e))},nonempty(...e){return this.check(Pa(1,...e))},lowercase(e){return this.check(La(e))},uppercase(e){return this.check(Ra(e))},trim(){return this.check(Ka())},normalize(...e){return this.check(Ga(...e))},toLowerCase(){return this.check(qa())},toUpperCase(){return this.check(Ja())},slugify(){return this.check(Ya())}})}),Ts=r(`ZodString`,(e,t)=>{In.init(e,t),ws.init(e,t),e.email=t=>e.check(ki(Ds,t)),e.url=t=>e.check(Fi(Is,t)),e.jwt=t=>e.check(Zi(hc,t)),e.emoji=t=>e.check(Ii(zs,t)),e.guid=t=>e.check(Ai(ks,t)),e.uuid=t=>e.check(ji(js,t)),e.uuidv4=t=>e.check(Mi(js,t)),e.uuidv6=t=>e.check(Ni(js,t)),e.uuidv7=t=>e.check(Pi(js,t)),e.nanoid=t=>e.check(Li(Vs,t)),e.guid=t=>e.check(Ai(ks,t)),e.cuid=t=>e.check(Ri(Us,t)),e.cuid2=t=>e.check(zi(Gs,t)),e.ulid=t=>e.check(Bi(qs,t)),e.base64=t=>e.check(Ji(lc,t)),e.base64url=t=>e.check(Yi(dc,t)),e.xid=t=>e.check(Vi(Ys,t)),e.ksuid=t=>e.check(Hi(Zs,t)),e.ipv4=t=>e.check(Ui($s,t)),e.ipv6=t=>e.check(Wi(rc,t)),e.cidrv4=t=>e.check(Ki(ac,t)),e.cidrv6=t=>e.check(qi(sc,t)),e.e164=t=>e.check(Xi(pc,t)),e.datetime=t=>e.check(ns(t)),e.date=t=>e.check(is(t)),e.time=t=>e.check(os(t)),e.duration=t=>e.check(cs(t))});function Es(e){return Oi(Ts,e)}var T=r(`ZodStringFormat`,(e,t)=>{b.init(e,t),ws.init(e,t)}),Ds=r(`ZodEmail`,(e,t)=>{zn.init(e,t),T.init(e,t)});function Os(e){return ki(Ds,e)}var ks=r(`ZodGUID`,(e,t)=>{Ln.init(e,t),T.init(e,t)});function As(e){return Ai(ks,e)}var js=r(`ZodUUID`,(e,t)=>{Rn.init(e,t),T.init(e,t)});function Ms(e){return ji(js,e)}function Ns(e){return Mi(js,e)}function Ps(e){return Ni(js,e)}function Fs(e){return Pi(js,e)}var Is=r(`ZodURL`,(e,t)=>{Bn.init(e,t),T.init(e,t)});function Ls(e){return Fi(Is,e)}function Rs(e){return Fi(Is,{protocol:At,hostname:kt,...h(e)})}var zs=r(`ZodEmoji`,(e,t)=>{Vn.init(e,t),T.init(e,t)});function Bs(e){return Ii(zs,e)}var Vs=r(`ZodNanoID`,(e,t)=>{Hn.init(e,t),T.init(e,t)});function Hs(e){return Li(Vs,e)}var Us=r(`ZodCUID`,(e,t)=>{Un.init(e,t),T.init(e,t)});function Ws(e){return Ri(Us,e)}var Gs=r(`ZodCUID2`,(e,t)=>{Wn.init(e,t),T.init(e,t)});function Ks(e){return zi(Gs,e)}var qs=r(`ZodULID`,(e,t)=>{Gn.init(e,t),T.init(e,t)});function Js(e){return Bi(qs,e)}var Ys=r(`ZodXID`,(e,t)=>{Kn.init(e,t),T.init(e,t)});function Xs(e){return Vi(Ys,e)}var Zs=r(`ZodKSUID`,(e,t)=>{qn.init(e,t),T.init(e,t)});function Qs(e){return Hi(Zs,e)}var $s=r(`ZodIPv4`,(e,t)=>{Qn.init(e,t),T.init(e,t)});function ec(e){return Ui($s,e)}var tc=r(`ZodMAC`,(e,t)=>{er.init(e,t),T.init(e,t)});function nc(e){return Gi(tc,e)}var rc=r(`ZodIPv6`,(e,t)=>{$n.init(e,t),T.init(e,t)});function ic(e){return Wi(rc,e)}var ac=r(`ZodCIDRv4`,(e,t)=>{tr.init(e,t),T.init(e,t)});function oc(e){return Ki(ac,e)}var sc=r(`ZodCIDRv6`,(e,t)=>{nr.init(e,t),T.init(e,t)});function cc(e){return qi(sc,e)}var lc=r(`ZodBase64`,(e,t)=>{ir.init(e,t),T.init(e,t)});function uc(e){return Ji(lc,e)}var dc=r(`ZodBase64URL`,(e,t)=>{or.init(e,t),T.init(e,t)});function fc(e){return Yi(dc,e)}var pc=r(`ZodE164`,(e,t)=>{sr.init(e,t),T.init(e,t)});function mc(e){return Xi(pc,e)}var hc=r(`ZodJWT`,(e,t)=>{lr.init(e,t),T.init(e,t)});function gc(e){return Zi(hc,e)}var _c=r(`ZodCustomStringFormat`,(e,t)=>{ur.init(e,t),T.init(e,t)});function vc(e,t,n={}){return ao(_c,e,t,n)}function yc(e){return ao(_c,`hostname`,Ot,e)}function bc(e){return ao(_c,`hex`,Kt,e)}function xc(e,t){let n=`${e}_${t?.enc??`hex`}`,r=$e[n];if(!r)throw Error(`Unrecognized hash format: ${n}`);return ao(_c,n,r,t)}var Sc=r(`ZodNumber`,(e,t)=>{dr.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mo(e,t,n,r),Cs(e,`ZodNumber`,{gt(e,t){return this.check(Ca(e,t))},gte(e,t){return this.check(wa(e,t))},min(e,t){return this.check(wa(e,t))},lt(e,t){return this.check(xa(e,t))},lte(e,t){return this.check(Sa(e,t))},max(e,t){return this.check(Sa(e,t))},int(e){return this.check(Tc(e))},safe(e){return this.check(Tc(e))},positive(e){return this.check(Ca(0,e))},nonnegative(e){return this.check(wa(0,e))},negative(e){return this.check(xa(0,e))},nonpositive(e){return this.check(Sa(0,e))},multipleOf(e,t){return this.check(ka(e,t))},step(e,t){return this.check(ka(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Cc(e){return na(Sc,e)}var wc=r(`ZodNumberFormat`,(e,t)=>{fr.init(e,t),Sc.init(e,t)});function Tc(e){return ra(wc,e)}function Ec(e){return ia(wc,e)}function Dc(e){return aa(wc,e)}function Oc(e){return oa(wc,e)}function kc(e){return sa(wc,e)}var Ac=r(`ZodBoolean`,(e,t)=>{pr.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r)});function jc(e){return ca(Ac,e)}var Mc=r(`ZodBigInt`,(e,t)=>{mr.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r),e.gte=(t,n)=>e.check(wa(t,n)),e.min=(t,n)=>e.check(wa(t,n)),e.gt=(t,n)=>e.check(Ca(t,n)),e.gte=(t,n)=>e.check(wa(t,n)),e.min=(t,n)=>e.check(wa(t,n)),e.lt=(t,n)=>e.check(xa(t,n)),e.lte=(t,n)=>e.check(Sa(t,n)),e.max=(t,n)=>e.check(Sa(t,n)),e.positive=t=>e.check(Ca(BigInt(0),t)),e.negative=t=>e.check(xa(BigInt(0),t)),e.nonpositive=t=>e.check(Sa(BigInt(0),t)),e.nonnegative=t=>e.check(wa(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(ka(t,n));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function Nc(e){return la(Mc,e)}var Pc=r(`ZodBigIntFormat`,(e,t)=>{hr.init(e,t),Mc.init(e,t)});function Fc(e){return ua(Pc,e)}function Ic(e){return da(Pc,e)}var Lc=r(`ZodSymbol`,(e,t)=>{gr.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_o(e,t,n,r)});function Rc(e){return fa(Lc,e)}var zc=r(`ZodUndefined`,(e,t)=>{_r.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(e,t,n,r)});function Bc(e){return pa(zc,e)}var Vc=r(`ZodNull`,(e,t)=>{vr.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vo(e,t,n,r)});function Hc(e){return ma(Vc,e)}var Uc=r(`ZodAny`,(e,t)=>{yr.init(e,t),w.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Wc(){return ha(Uc)}var Gc=r(`ZodUnknown`,(e,t)=>{br.init(e,t),w.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Kc(){return ga(Gc)}var qc=r(`ZodNever`,(e,t)=>{xr.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r)});function Jc(e){return _a(qc,e)}var Yc=r(`ZodVoid`,(e,t)=>{Sr.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r)});function Xc(e){return va(Yc,e)}var Zc=r(`ZodDate`,(e,t)=>{Cr.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r),e.min=(t,n)=>e.check(wa(t,n)),e.max=(t,n)=>e.check(Sa(t,n));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function Qc(e){return ya(Zc,e)}var $c=r(`ZodArray`,(e,t)=>{Tr.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r),e.element=t.element,Cs(e,`ZodArray`,{min(e,t){return this.check(Pa(e,t))},nonempty(e){return this.check(Pa(1,e))},max(e,t){return this.check(Na(e,t))},length(e,t){return this.check(Fa(e,t))},unwrap(){return this.element}})});function el(e,t){return Xa($c,e,t)}function tl(e){let t=e._zod.def.shape;return Tl(Object.keys(t))}var nl=r(`ZodObject`,(e,t)=>{Ar.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),p(e,`shape`,()=>t.shape),Cs(e,`ZodObject`,{keyof(){return Tl(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Kc()})},loose(){return this.clone({...this._zod.def,catchall:Kc()})},strict(){return this.clone({...this._zod.def,catchall:Jc()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return ye(this,e)},safeExtend(e){return be(this,e)},merge(e){return xe(this,e)},pick(e){return _e(this,e)},omit(e){return ve(this,e)},partial(...e){return Se(Nl,this,e[0])},required(...e){return Ce(Wl,this,e[0])}})});function rl(e,t){return new nl({type:`object`,shape:e??{},...h(t)})}function il(e,t){return new nl({type:`object`,shape:e,catchall:Jc(),...h(t)})}function al(e,t){return new nl({type:`object`,shape:e,catchall:Kc(),...h(t)})}var ol=r(`ZodUnion`,(e,t)=>{Mr.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r),e.options=t.options});function sl(e,t){return new ol({type:`union`,options:e,...h(t)})}var cl=r(`ZodXor`,(e,t)=>{ol.init(e,t),Pr.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r),e.options=t.options});function ll(e,t){return new cl({type:`union`,options:e,inclusive:!1,...h(t)})}var ul=r(`ZodDiscriminatedUnion`,(e,t)=>{ol.init(e,t),Fr.init(e,t)});function dl(e,t,n){return new ul({type:`union`,options:t,discriminator:e,...h(n)})}var fl=r(`ZodIntersection`,(e,t)=>{Ir.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r)});function pl(e,t){return new fl({type:`intersection`,left:e,right:t})}var ml=r(`ZodTuple`,(e,t)=>{zr.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function hl(e,t,n){let r=t instanceof y;return new ml({type:`tuple`,items:e,rest:r?t:null,...h(r?n:t)})}var gl=r(`ZodRecord`,(e,t)=>{Ur.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function _l(e,t,n){return!t||!t._zod?new gl({type:`record`,keyType:Es(),valueType:e,...h(t)}):new gl({type:`record`,keyType:e,valueType:t,...h(n)})}function vl(e,t,n){let r=pe(e);return r._zod.values=void 0,new gl({type:`record`,keyType:r,valueType:t,...h(n)})}function yl(e,t,n){return new gl({type:`record`,keyType:e,valueType:t,mode:`loose`,...h(n)})}var bl=r(`ZodMap`,(e,t)=>{Wr.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...t)=>e.check(ja(...t)),e.nonempty=t=>e.check(ja(1,t)),e.max=(...t)=>e.check(Aa(...t)),e.size=(...t)=>e.check(Ma(...t))});function xl(e,t,n){return new bl({type:`map`,keyType:e,valueType:t,...h(n)})}var Sl=r(`ZodSet`,(e,t)=>{Kr.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.min=(...t)=>e.check(ja(...t)),e.nonempty=t=>e.check(ja(1,t)),e.max=(...t)=>e.check(Aa(...t)),e.size=(...t)=>e.check(Ma(...t))});function Cl(e,t){return new Sl({type:`set`,valueType:e,...h(t)})}var wl=r(`ZodEnum`,(e,t)=>{Jr.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);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 wl({...t,checks:[],...h(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 wl({...t,checks:[],...h(r),entries:i})}});function Tl(e,t){return new wl({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...h(t)})}function El(e,t){return new wl({type:`enum`,entries:e,...h(t)})}var Dl=r(`ZodLiteral`,(e,t)=>{Yr.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(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 Ol(e,t){return new Dl({type:`literal`,values:Array.isArray(e)?e:[e],...h(t)})}var kl=r(`ZodFile`,(e,t)=>{Xr.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r),e.min=(t,n)=>e.check(ja(t,n)),e.max=(t,n)=>e.check(Aa(t,n)),e.mime=(t,n)=>e.check(Ua(Array.isArray(t)?t:[t],n))});function Al(e){return Za(kl,e)}var jl=r(`ZodTransform`,(e,t)=>{Zr.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new a(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(ke(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(ke(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Ml(e){return new jl({type:`transform`,transform:e})}var Nl=r(`ZodOptional`,(e,t)=>{$r.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Pl(e){return new Nl({type:`optional`,innerType:e})}var Fl=r(`ZodExactOptional`,(e,t)=>{ei.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Il(e){return new Fl({type:`optional`,innerType:e})}var Ll=r(`ZodNullable`,(e,t)=>{ti.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Rl(e){return new Ll({type:`nullable`,innerType:e})}function zl(e){return Pl(Rl(e))}var Bl=r(`ZodDefault`,(e,t)=>{ni.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Vl(e,t){return new Bl({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():le(t)}})}var Hl=r(`ZodPrefault`,(e,t)=>{ii.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Go(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ul(e,t){return new Hl({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():le(t)}})}var Wl=r(`ZodNonOptional`,(e,t)=>{ai.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Gl(e,t){return new Wl({type:`nonoptional`,innerType:e,...h(t)})}var Kl=r(`ZodSuccess`,(e,t)=>{si.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ql(e){return new Kl({type:`success`,innerType:e})}var Jl=r(`ZodCatch`,(e,t)=>{ci.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ko(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Yl(e,t){return new Jl({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Xl=r(`ZodNaN`,(e,t)=>{li.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r)});function Zl(e){return ba(Xl,e)}var Ql=r(`ZodPipe`,(e,t)=>{ui.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r),e.in=t.in,e.out=t.out});function $l(e,t){return new Ql({type:`pipe`,in:e,out:t})}var eu=r(`ZodCodec`,(e,t)=>{Ql.init(e,t),fi.init(e,t)});function tu(e,t,n){return new eu({type:`pipe`,in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function nu(e){let t=e._zod.def;return new eu({type:`pipe`,in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var ru=r(`ZodPreprocess`,(e,t)=>{Ql.init(e,t),hi.init(e,t)}),iu=r(`ZodReadonly`,(e,t)=>{gi.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function au(e){return new iu({type:`readonly`,innerType:e})}var ou=r(`ZodTemplateLiteral`,(e,t)=>{vi.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r)});function su(e,t){return new ou({type:`template_literal`,parts:e,...h(t)})}var cu=r(`ZodLazy`,(e,t)=>{xi.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zo(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function lu(e){return new cu({type:`lazy`,getter:e})}var uu=r(`ZodPromise`,(e,t)=>{bi.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function du(e){return new uu({type:`promise`,innerType:e})}var fu=r(`ZodFunction`,(e,t)=>{yi.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r)});function pu(e){return new fu({type:`function`,input:Array.isArray(e?.input)?hl(e?.input):e?.input??el(Kc()),output:e?.output??Kc()})}var mu=r(`ZodCustom`,(e,t)=>{Si.init(e,t),w.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r)});function hu(e){let t=new v({check:`custom`});return t._zod.check=e,t}function gu(e,t){return Qa(mu,e??(()=>!0),t)}function _u(e,t={}){return $a(mu,e,t)}function vu(e,t){return eo(e,t)}var yu=no,bu=ro;function xu(e,t={}){let n=new mu({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,...h(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}var Su=(...e)=>io({Codec:eu,Boolean:Ac,String:Ts},...e);function Cu(e){let t=lu(()=>sl([Es(e),Cc(),jc(),Hc(),el(t),_l(Es(),t)]));return t}function wu(e,t){return new ru({type:`pipe`,in:Ml(e),out:t})}var Tu=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let e=0,r=t.length;e<r;e++)n=t[e](n);return n}}},Eu={pipe(){return Tu(this,arguments)}},Du=function(){function e(){}return e.prototype=Eu,e}(),E=function(e,t){if(typeof e==`function`)return function(){return e(arguments)?t.apply(this,arguments):e=>t(e,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(e,n){return arguments.length>=2?t(e,n):function(n){return t(n,e)}};case 3:return function(e,n,r){return arguments.length>=3?t(e,n,r):function(r){return t(r,e,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(e){return t(e,...n)}}}},D=e=>e,Ou=e=>()=>e,ku=Ou(!0),Au=Ou(!1),ju=Ou(void 0),Mu=ju;function Nu(e,t,n,r,i,a,o,s,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return i(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return a(i(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return o(a(i(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return s(o(a(i(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return c(s(o(a(i(r(n(t(e.apply(this,arguments)))))))))}}}function Pu(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i}}function Fu(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i!==n&&t.set(i,i),i}}var Iu=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete(`stack`);let n=Object.getPrototypeOf(e),r=n;for(;r!==null&&r!==Object.prototype;){let e=Reflect.ownKeys(r);for(let n=0;n<e.length;n++)t.add(e[n]);r=Object.getPrototypeOf(r)}return t.has(`constructor`)&&typeof e.constructor==`function`&&n===e.constructor.prototype&&t.delete(`constructor`),t},Lu=new WeakSet,Ru=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),zu=0,Bu=()=>{zu++};function Vu(e){return typeof e==`string`}function Hu(e){return typeof e==`number`}function Uu(e){return typeof e==`boolean`}function Wu(e){return typeof e==`bigint`}function Gu(e){return typeof e==`symbol`}function Ku(e){return Vu(e)||Hu(e)||Gu(e)}function qu(e){return typeof e==`function`}function Ju(e){return e===void 0}function Yu(e){return e!==void 0}function Xu(e){return e!=null}function Zu(e){return!1}function Qu(e){return!0}function $u(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ed(e){return typeof e==`object`&&!!e||qu(e)}var O=E(2,(e,t)=>ed(e)&&t in e);function td(e){return O(e,Symbol.iterator)||Vu(e)}var k=`~effect/Hash`,A=e=>{switch(typeof e){case`number`:return od(e);case`bigint`:return M(e.toString(10));case`string`:return M(e);case`function`:case`object`:if(e===null)break;if(e instanceof Date)return Number.isNaN(e.getTime())?M(`Invalid Date`):M(e.toISOString());if(e instanceof RegExp)return M(e.toString());{if(Lu.has(e))return nd(e);let t=hd.get(e);if(t!==void 0)return t;if(gd.has(e))return Bu(),M(`[Circular]`);gd.add(e);let n=zu,r;try{r=`~effect/Hash`in e?e[k]():typeof e==`function`?nd(e):e instanceof DataView?ud(Ru(e)):Array.isArray(e)||ArrayBuffer.isView(e)?ud(e):e instanceof Map?dd(e):e instanceof Set?pd(e):cd(e)}finally{gd.delete(e)}return n===zu&&hd.set(e,r),r}}return id(rd(M(String(e))))},nd=e=>(md.has(e)||md.set(e,id(Math.random()*4294967296|0)),md.get(e)),rd=e=>(e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^e>>>16),j=E(2,(e,t)=>rd(Math.imul(e,2654435761)+Math.imul(t,2246822507))),id=e=>e&3221225471|e>>>1&1073741824,ad=new DataView(new ArrayBuffer(8)),od=e=>{let t=e|0;return t===e?id(t):(ad.setFloat64(0,e===e?e:NaN),id(j(ad.getInt32(0),ad.getInt32(4))))},M=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return id(t)},sd=(e,t)=>{let n=12289;for(let r of t)n^=j(A(r),A(e[r]));return id(n)},cd=e=>sd(e,Iu(e)),ld=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return id(r)},ud=e=>{let t=6151;for(let n of e)t=j(t,A(n));return id(t)},dd=ld(M(`Map`),([e,t])=>j(A(e),A(t))),fd=M(`Set`),pd=ld(fd,e=>j(fd,A(e))),md=new WeakMap,hd=new WeakMap,gd=new WeakSet,N=`~effect/Equal`;function P(){return arguments.length===1?e=>_d(e,arguments[0]):_d(arguments[0],arguments[1])}function _d(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;return n===typeof t?n===`number`&&e!==e&&t!==t?!0:n!==`object`&&n!==`function`||Lu.has(e)||Lu.has(t)?!1:vd(e,t):!1}function vd(e,t){let n=bd.length;for(let r=n;r-->0;)if(bd[r]===e&&xd[r]===t)return!0;if(n)return yd(e,t);let r=Sd.get(e);r||Sd.set(e,r=new WeakMap);let i=r.get(t);return i===void 0&&r.set(t,i=yd(e,t)),i}function yd(e,t){bd.push(e),xd.push(t);try{return Cd(e,t)}finally{bd.pop(),xd.pop()}}var bd=[],xd=[],Sd=new WeakMap;function Cd(e,t){if(A(e)!==A(t))return!1;if(e instanceof Date){if(!(t instanceof Date))return!1;let n=e.getTime(),r=t.getTime();return n===r||Number.isNaN(n)&&Number.isNaN(r)}if(e instanceof RegExp)return t instanceof RegExp&&e.toString()===t.toString();let n=Nd(e);if(n!==Nd(t)||typeof e==`function`&&!n)return!1;if(n)return e[N](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:wd(e,t);if(ArrayBuffer.isView(e)){let n=e instanceof DataView;return!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||n!==t instanceof DataView?!1:n?Td(Ru(e),Ru(t)):Td(e,t)}return e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:Dd(e,t,Od,kd):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:Dd(e,t,A,_d):Ed(e,t)}function wd(e,t){for(let n=0;n<e.length;n++)if(!_d(e[n],t[n]))return!1;return!0}function Td(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Ed(e,t){let n=Iu(e),r=Iu(t);if(n.size!==r.size)return!1;for(let i of n)if(!r.has(i)||!_d(e[i],t[i]))return!1;return!0}function Dd(e,t,n,r){let i=new Map,a=0;for(let e of t){let t=n(e),r=i.get(t);r?r.push(e):i.set(t,[e]),a++}outer:for(let t of e){let e=i.get(n(t));if(e){for(let n=0;n<e.length;n++)if(r(t,e[n])){e[n]=e[e.length-1],e.pop(),a--;continue outer}}return!1}return a===0}var Od=e=>A(e[0]),kd=(e,t)=>_d(e[0],t[0])&&_d(e[1],t[1]),Ad=()=>0;function jd(e,t){return Md((n,r)=>e(n[0],r[0])&&t(n[1],r[1]))}function Md(e){return function(t,n){return Dd(t,n,Ad,e)}}var Nd=e=>O(e,N),Pd=e=>(t,n)=>t===n||e(t,n),Fd=(e,t)=>e===t,Id=()=>Fd;function Ld(e){return Pd((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e[r](t[r],n[r]))return!1;return!0})}function Rd(e){return Pd((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0})}var zd=e=>e.length>0;function Bd(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function Vd(e,t){for(let n of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,n)&&Bd(e,n,t[n])}var Hd=Symbol.for(`~effect/Redactable`),Ud=e=>O(e,Hd);function Wd(e){return Ud(e)?Gd(e):e}function Gd(e){return e[Hd](globalThis[`~effect/Fiber/currentFiber`]?.context??Jd)}var Kd=`~effect/Fiber/currentFiber`,qd=new Map,Jd={"~effect/Context":{},base:qd,depth:0,mapUnsafe:qd,pipe(){return Tu(this,arguments)}};function F(e,t){let n=t?.space??0,r=new WeakSet,i=n?typeof n==`number`?` `.repeat(n):n:``,a=e=>i.repeat(e),o=(e,t)=>{let n=e?.constructor;return n&&n!==Object.prototype.constructor&&n.name?`${n.name}(${t})`:t},s=e=>{try{return Reflect.ownKeys(e)}catch{return[`[ownKeys threw]`]}};function c(e,t=0){try{return l(e,t)}catch{return(typeof e==`object`&&e||typeof e==`function`)&&r.delete(e),`[inspection threw]`}}function l(e,n=0){if(typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`||e==null||typeof e==`boolean`||typeof e==`symbol`)return String(e);if(typeof e==`bigint`)return String(e)+`n`;if(typeof e==`object`||typeof e==`function`){if(r.has(e))return Yd;r.add(e);let l;if(Hd in e)l=c(Gd(e),n);else if(Array.isArray(e))l=!i||e.length<=1?`[${e.map(e=>c(e,n)).join(`,`)}]`:`[\n${a(n+1)}${e.map(e=>c(e,n+1)).join(`,
|
|
66
|
+
`+a(n+1))}\n${a(n)}]`;else if(e instanceof Date)l=Qd(e);else if(!t?.ignoreToString&&O(e,`toString`)&&typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=$d(e);l=e instanceof Error&&e.cause!==void 0?`${t} (cause: ${c(e.cause,n)})`:t}else if(Symbol.iterator in e)l=`${e.constructor.name}(${c(Array.from(e),n)})`;else{let t=s(e);if(!i||t.length<=1){let r=`{${t.map(t=>`${Xd(t)}:${c(ef(e,t),n)}`).join(`,`)}}`;l=o(e,r)}else{let r=`{\n${t.map(t=>`${a(n+1)}${Xd(t)}: ${c(ef(e,t),n+1)}`).join(`,
|
|
67
|
+
`)}\n${a(n)}}`;l=o(e,r)}}return r.delete(e),l}return String(e)}return c(e,0)}var Yd=`[Circular]`;function Xd(e){return typeof e==`string`?JSON.stringify(e):String(e)}function Zd(e){return e.map(e=>`[${Xd(e)}]`).join(``)}function Qd(e){try{return e.toISOString()}catch{return`Invalid Date`}}function $d(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}function ef(e,t){try{return e[t]}catch{return`[property access threw]`}}function tf(e,t){let n=[];return JSON.stringify(e,function(e,t){let r=Object.getOwnPropertyDescriptor(this,e)?.value,i=O(r,Hd)?Wd(r):Wd(t);if(typeof i==`bigint`)return F(i);if(typeof i!=`object`||!i)return i;let a=i instanceof Error&&!O(i,`toJSON`)?{...i,name:i.name,message:i.message}:i;for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(i))return;if(n.push(i),a!==i&&n.push(a),!nf(a)||rf(a))return a;let o=new Proxy(a,{get(e,t){let n=Reflect.get(e,t,e);return Object.getOwnPropertyDescriptor(e,t)?.get===void 0?n:Wd(n)}});return n.push(o),o},t?.space)??`null`}function nf(e){for(let t of Object.getOwnPropertyNames(e))if(Object.getOwnPropertyDescriptor(e,t)?.get!==void 0)return!0;return!1}function rf(e){for(let t of[Number.prototype.valueOf,Boolean.prototype.valueOf,String.prototype.valueOf])try{return Reflect.apply(t,e,[]),!0}catch{}return!1}var af=Symbol.for(`nodejs.util.inspect.custom`),of=e=>{try{return e=Wd(e),O(e,`toJSON`)&&qu(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(of):e}catch{return`[toJSON threw]`}},sf=(e,t=2)=>{if(typeof e==`string`)return e;try{return typeof e==`object`?tf(e,{space:t}):F(e,{space:t})}catch{return String(e)}},cf={toJSON(){return of(this)},[af](){return this.toJSON()},toString(){return F(this.toJSON())}},lf=(()=>{let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,`writable`)?e.writable===!0:e.set!==void 0})(),uf=()=>Error.stackTraceLimit,df=e=>{lf&&(Error.stackTraceLimit=e)},ff=class{constructor(e){this.value=e,this.done=!1}next(e){return this.done?(this.value=e,this):(this.done=!0,{value:this.value,done:!1})}},pf=(()=>{let e=`~effect/Utils/internal`,t={[e]:e=>e()},n={[e]:e=>{try{return e()}finally{}}};return uf()!==0&&t[e](()=>Error().stack)?.includes(e)===!0?t[e]:n[e]})(),mf=`~effect/Effect`,hf=`~effect/Exit`,gf={_A:D,_E:D,_R:D},_f=`${mf}/identifier`,I=`${mf}/args`,L=`${mf}/evaluate`,R=`${mf}/successCont`,z=`${mf}/failureCont`,vf=`${mf}/ensureCont`,yf=Symbol.for(`effect/Effect/Yield`),bf={pipe(){return Tu(this,arguments)},toJSON(){return{...this}},toString(){return F(this.toJSON(),{ignoreToString:!0,space:2})},[af](){return this.toJSON()}},xf={[mf]:gf,...bf,[Symbol.iterator](){return new ff(this)},toJSON(){return{_id:`Effect`,op:this[_f],...I in this?{args:this[I]}:void 0}}},Sf=e=>O(e,mf),Cf=e=>O(e,hf),wf=`~effect/Cause`,Tf=`~effect/Cause/Reason`,Ef=e=>O(e,wf),Df=class{constructor(e){this[wf]=wf,this.reasons=e}pipe(){return Tu(this,arguments)}toJSON(){return{_id:`Cause`,failures:this.reasons.map(e=>e.toJSON())}}toString(){return`Cause(${F(this.reasons)})`}[af](){return this.toJSON()}[N](e){return Ef(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>P(t,e.reasons[n]))}[k](){return ud(this.reasons)}},Of=new WeakMap,kf=class{[Tf];annotations;_tag;constructor(e,t,n){if(this[Tf]=Tf,this._tag=e,t!==Af&&typeof n==`object`&&n&&t.size>0){let e=Of.get(n);e&&(t=new Map([...e,...t])),Of.set(n,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let n=new Map(this.annotations);e.mapUnsafe.forEach((e,r)=>{t?.overwrite!==!0&&n.has(r)||n.set(r,e)});let r=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return r.annotations=n,r}pipe(){return Tu(this,arguments)}toString(){return F(this)}[af](){return this.toString()}},Af=new Map,jf=class extends kf{constructor(e,t=Af){super(`Fail`,t,e),this.error=e}toString(){return`Fail(${F(this.error)})`}toJSON(){return{_tag:`Fail`,error:this.error}}[N](e){return Bf(e)&&P(this.error,e.error)&&P(this.annotations,e.annotations)}[k](){return j(M(this._tag))(j(A(this.error))(A(this.annotations)))}},Mf=e=>new Df(e),Nf=(e,t)=>{let n=new Map,r=[];for(let i of e.concat(t)){let e=A(i),t=n.get(e);if(t===void 0)n.set(e,[i]);else if(t.some(e=>P(e,i)))continue;else t.push(i);r.push(i)}return r},Pf=E(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new Df(Nf(e.reasons,t.reasons));return P(e,n)?e:n}),Ff=new Df([]),If=e=>new Df([new jf(e)]),Lf=class extends kf{constructor(e,t=Af){super(`Die`,t,e),this.defect=e}toString(){return`Die(${F(this.defect)})`}toJSON(){return{_tag:`Die`,defect:this.defect}}[N](e){return Vf(e)&&P(this.defect,e.defect)&&P(this.annotations,e.annotations)}[k](){return j(M(this._tag))(j(A(this.defect))(A(this.annotations)))}},Rf=e=>new Df([new Lf(e)]),zf=E(e=>Ef(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new Df(e.reasons.map(e=>e.annotate(t,n)))),Bf=e=>e._tag===`Fail`,Vf=e=>e._tag===`Die`,Hf=e=>e._tag===`Interrupt`;function Uf(e){return Xf(`Effect.evaluate: Not implemented`)}var B=e=>({...xf,[_f]:e.op,[L]:e[L]??Uf,[R]:e[R],[z]:e[z],[vf]:e[vf]}),Wf=e=>{let t=B(e),n=function(e){this[I]=e};return n.prototype=t,function(e){return new n(e)}},Gf=e=>{let t={[hf]:hf,_tag:e.op,get[e.prop](){return this[I]},...B(e),toString(){return`${e.op}(${F(this[I])})`},toJSON(){return{_id:`Exit`,_tag:e.op,[e.prop]:this[I]}},[N](e){return Cf(e)&&e._tag===this._tag&&P(this[I],e[I])},[k](){return j(M(e.op),A(this[I]))}},n=function(e){this[I]=e};return n.prototype=t,function(e){return new n(e)}},V=Gf({op:`Success`,prop:`value`,[L](e){let t=e.getCont(R);return t?t[R](this[I],e,this):e.yieldWith(this)}}),Kf={key:`effect/Cause/StackTrace`},qf={key:`effect/Cause/InterruptorStackTrace`},Jf=Gf({op:`Failure`,prop:`cause`,[L](e){let t=this[I],n=!1;e.cache.stackFrame&&(t=zf(t,{mapUnsafe:new Map([[Kf.key,e.cache.stackFrame]])}),n=!0);let r=e.getCont(z),i=e._interruptedCause;if(i&&e.interruptible){let a=!1;for(;r&&e.interruptible;)a||=_f in r,r=e.getCont(z);a&&(t=Mf(t.reasons.filter(e=>e._tag!==`Fail`))),t=Pf(t,i),n=!0}return r?r[z](t,e,n?void 0:this):e.yieldWith(n?Jf(t):this)}}),Yf=e=>Jf(If(e)),Xf=e=>Jf(Rf(e)),H=Wf({op:`WithFiber`,[L](e){return this[I](e)}}),Zf=function(){class e extends globalThis.Error{}let t=B({op:`YieldableError`,[L](){return Yf(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),Qf=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return class extends Zf{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(Vd(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}(),$f=e=>{class t extends Qf{_tag=e}return t.prototype.name=e,t};$f(`NoSuchElementError`);var ep=`~effect/Cause/Done`,tp=e=>O(e,ep),np={[ep]:ep,_tag:`Done`,value:void 0},rp=e=>e===void 0?np:{[ep]:ep,_tag:`Done`,value:e},ip=Yf(np),ap=e=>e===void 0?ip:Yf(rp(e)),op=`~effect/Option`,sp={[op]:{_A:e=>e},...bf,[Symbol.iterator](){return new ff(this)}},cp=Object.defineProperty(Object.assign(Object.create(sp),{_tag:`Some`,_op:`Some`,[N](e){return dp(e)&&pp(e)&&P(this.value,e.value)},[k](){return j(A(this._tag))(A(this.value))},toString(){return`some(${F(this.value)})`},toJSON(){return{_id:`Option`,_tag:this._tag,value:of(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),lp=A(`None`),up=Object.assign(Object.create(sp),{_tag:`None`,_op:`None`,valueOrUndefined:void 0,[N](e){return dp(e)&&fp(e)},[k](){return lp},toString(){return`none()`},toJSON(){return{_id:`Option`,_tag:this._tag}}}),dp=e=>O(e,op),fp=e=>e._tag===`None`,pp=e=>e._tag===`Some`,mp=Object.create(up),hp=function(e){this.value=e};hp.prototype=cp;var gp=e=>new hp(e),_p=`~effect/Result`,vp={[_p]:{_A:e=>e,_E:e=>e},...bf,[Symbol.iterator](){return new ff(this)}},yp=Object.assign(Object.create(vp),{_tag:`Success`,_op:`Success`,[N](e){return xp(e)&&Cp(e)&&P(this.success,e.success)},[k](){return j(A(this._tag))(A(this.success))},toString(){return`success(${F(this.success)})`},toJSON(){return{_id:`Result`,_tag:this._tag,value:of(this.success)}}}),bp=Object.assign(Object.create(vp),{_tag:`Failure`,_op:`Failure`,[N](e){return xp(e)&&Sp(e)&&P(this.failure,e.failure)},[k](){return j(A(this._tag))(A(this.failure))},toString(){return`failure(${F(this.failure)})`},toJSON(){return{_id:`Result`,_tag:this._tag,failure:of(this.failure)}}}),xp=e=>O(e,_p),Sp=e=>e._tag===`Failure`,Cp=e=>e._tag===`Success`,wp=function(e){this.failure=e};wp.prototype=bp;var Tp=e=>new wp(e),Ep=function(e){this.success=e};Ep.prototype=yp;var Dp=e=>new Ep(e),Op=e=>Sp(e)?mp:gp(e.success);function kp(e){return(t,n)=>t===n?0:e(t,n)}var Ap=kp((e,t)=>e<t?-1:1),jp=kp((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1),Mp=kp((e,t)=>e<t?-1:1),Np=E(2,(e,t)=>kp((n,r)=>e(t(n),t(r)))),Pp=Np(jp,e=>e.getTime()),Fp=e=>E(2,(t,n)=>e(t,n)===-1),Ip=e=>E(2,(t,n)=>e(t,n)===1),Lp=e=>E(2,(t,n)=>e(t,n)!==1),Rp=e=>E(2,(t,n)=>e(t,n)!==-1),zp=()=>mp,Bp=gp,Vp=dp,Hp=fp,Up=pp,Wp=E(2,(e,{onNone:t,onSome:n})=>Hp(e)?t():n(e.value)),Gp=E(2,(e,t)=>Hp(e)?t():e.value),Kp=E(2,(e,t)=>Hp(e)?t():e),qp=e=>e==null?zp():Bp(e),Jp=Gp(ju),Yp=e=>(...t)=>{try{return Bp(e(...t))}catch{return zp()}},Xp=E(2,(e,t)=>Hp(e)?zp():Bp(t(e.value))),Zp=E(2,(e,t)=>Hp(e)?zp():t(e.value))(D),Qp=e=>Hp(e)?[]:[e.value],$p=E(2,(e,t)=>Hp(e)?zp():t(e.value)?Bp(e.value):zp()),em=Dp,tm=Tp,U=Sp,nm=Cp,rm=Op,im=E(2,(e,t)=>U(e)?tm(t(e.failure)):e),am=E(2,(e,t)=>nm(e)?em(t(e.success)):e),om=E(2,(e,{onFailure:t,onSuccess:n})=>U(e)?t(e.failure):n(e.success)),sm=E(2,(e,t)=>{if(nm(e))return e.success;throw t(e.failure)})(D),cm=globalThis.Array,lm=e=>cm.isArray(e)?e:cm.from(e),um=E(2,(e,t)=>[...e,t]);cm.isArray;var dm=zd,fm=zd,pm=()=>[],mm=e=>[e],hm=E(2,(e,t)=>e.map(t)),gm=Rd,_m=e=>B({op:e.label,[L]:e.evaluate}),vm=`~effect/Context/Service`,ym=function(){function e(){}let t=e;Object.setPrototypeOf(t,bm);let n=(e,n)=>(t.key=e,n?.defaultValue&&(t[Sm]=Sm,t.defaultValue=n.defaultValue),n?.make&&(t.make=n.make),n?.fiberCached&&xm.add(e),t);return arguments.length>0?n(arguments[0],arguments[1]):n},bm={[vm]:vm,..._m({label:`Service`,evaluate(e){return V(W(e.context,this))}}),toJSON(){return{_id:`Service`,key:this.key}},of(e){return e},context(e){return zm(this,e)},use(e){return H(t=>e(W(t.context,this)))},useSync(e){return H(t=>V(e(W(t.context,this))))}},xm=new Set,Sm=`~effect/Context/Reference`,Cm=`~effect/Context`,wm=8,Tm=8,Em=(e,t,n,r)=>{let i=Object.create(Nm);return i.cacheRoot=e??i,i.base=t,i.overlay=n,i.depth=r,i._flat=void 0,i.baseHits=0,i},Dm=(e,t)=>{t&&(Dm(e,t.parent),e.set(t.key,t.value))},Om=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return Dm(t,e.overlay),e._flat=t},km=(e,t)=>{let n=new Map(e.mapUnsafe);return t(n),Mm(n)},Am=Symbol(),jm=(e,t)=>{let n=e;for(let e=n.overlay;e;e=e.parent)if(e.key===t)return e.value;let r=n.base.get(t);return r===void 0&&!n.base.has(t)?Am:(n.overlay&&++n.baseHits>=n.base.size&&n.baseHits>=Tm&&(n.base=Om(n),n.overlay=void 0,n.depth=0),r)},Mm=e=>Em(void 0,e,void 0,0),Nm={get mapUnsafe(){return Om(this)},...bf,[Cm]:{_Services:e=>e},toJSON(){return{_id:`Context`,services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[N](e){if(!Fm(e))return!1;let t=this.mapUnsafe,n=e.mapUnsafe;if(t.size!==n.size)return!1;for(let[e,r]of t)if(!n.has(e)||!P(r,n.get(e)))return!1;return!0},[k](){return od(this.mapUnsafe.size)}},Pm=(e,t)=>e.cacheRoot===t.cacheRoot,Fm=e=>O(e,Cm),Im=e=>!!e[Sm],Lm=()=>Rm,Rm=Mm(new Map),zm=(e,t)=>Mm(new Map([[e.key,t]])),Bm=E(3,(e,t,n)=>Vm(e,t.key,n)),Vm=(e,t,n)=>{let r=e,i=xm.has(t)?void 0:r.cacheRoot;if(r.depth>=wm){let e=new Map(r.mapUnsafe);return e.set(t,n),Em(i,e,void 0,0)}return Em(i,r.base,{key:t,value:n,parent:r.overlay},r.depth+1)},Hm=(e,t)=>{let n=jm(e,t);return n===Am?void 0:n},Um=E(2,(e,t)=>{let n=jm(e,t.key);if(n===Am){if(Im(t))return Gm(t);throw Km(t)}return n}),W=Um,Wm=`~effect/Context/defaultValue`,Gm=e=>Wm in e?e[Wm]:e[Wm]=e.defaultValue(),Km=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(t.stack){let e=t.stack.split(`
|
|
68
|
+
`);e.splice(1,3),t.stack=e.join(`
|
|
69
|
+
`)}return t},qm=E(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:km(e,e=>t.mapUnsafe.forEach((t,n)=>e.set(n,t)))),G=ym,Jm=`~effect/Duration`,Ym=BigInt(0),Xm=BigInt(1),Zm=BigInt(2),Qm=BigInt(10),$m=BigInt(1e3),eh=e=>BigInt(e<0?Math.ceil(e-.5):Math.floor(e+.5)),th=e=>eh(e*1e6),nh=(e,t)=>{let n=e.indexOf(`.`);if(n===-1)return BigInt(e)*t;let r=e[0]===`-`,i=e.slice(n+1),a=Qm**BigInt(i.length),o=(BigInt(e.slice(+!!r,n))*a+BigInt(i))*t,s=o/a+(o%a*Zm>=a?Xm:Ym);return r?-s:s},rh=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,ih=e=>{switch(typeof e){case`number`:return gh(e);case`bigint`:return hh(e);case`string`:{if(e===`Infinity`)return ph;if(e===`-Infinity`)return mh;let t=rh.exec(e);if(!t)break;let[n,r,i]=t;if(i===`nano`||i===`nanos`)return hh(nh(r,Xm));if(i===`micro`||i===`micros`)return hh(nh(r,$m));let a=Number(r);switch(i){case`milli`:case`millis`:return gh(a);case`second`:case`seconds`:return _h(a);case`minute`:case`minutes`:return vh(a);case`hour`:case`hours`:return yh(a);case`day`:case`days`:return bh(a);case`week`:case`weeks`:return xh(a)}break}case`object`:{if(e===null)break;if(Jm in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(Hu)?ah(e):Number.isNaN(e[0])||Number.isNaN(e[1])?fh:e[0]===-1/0||e[1]===-1/0?mh:e[0]===1/0||e[1]===1/0?ph:K(eh(e[0]*1e9+e[1]));let t=e,n=0;return t.weeks&&(n+=t.weeks*6048e5),t.days&&(n+=t.days*864e5),t.hours&&(n+=t.hours*36e5),t.minutes&&(n+=t.minutes*6e4),t.seconds&&(n+=t.seconds*1e3),t.milliseconds&&(n+=t.milliseconds),!t.microseconds&&!t.nanoseconds?K(n):K(eh(n*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0)))}}return ah(e)},ah=e=>{throw Error(`Invalid Input: ${e}`)},oh={_tag:`Millis`,millis:0},sh={_tag:`Infinity`},ch={_tag:`NegativeInfinity`},lh={[Jm]:Jm,[k](){switch(this.value._tag){case`Millis`:{let e=this.value.millis*1e6;return Number.isFinite(e)?A(eh(e)):od(this.value.millis)}case`Nanos`:return A(this.value.nanos);default:return cd(this.value)}},[N](e){return uh(e)&&Oh(this,e)},toString(){switch(this.value._tag){case`Infinity`:return`Infinity`;case`NegativeInfinity`:return`-Infinity`;case`Nanos`:return`${this.value.nanos} nanos`;case`Millis`:return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case`Millis`:return{_id:`Duration`,_tag:`Millis`,millis:this.value.millis};case`Nanos`:return{_id:`Duration`,_tag:`Nanos`,nanos:String(this.value.nanos)};case`Infinity`:return{_id:`Duration`,_tag:`Infinity`};case`NegativeInfinity`:return{_id:`Duration`,_tag:`NegativeInfinity`}}},[af](){return this.toJSON()},pipe(){return Tu(this,arguments)}},K=e=>{let t=Object.create(lh);return t.value=typeof e==`number`?isNaN(e)||e===0||Object.is(e,-0)?oh:Number.isFinite(e)?Number.isInteger(e)?{_tag:`Millis`,millis:e}:{_tag:`Nanos`,nanos:th(e)}:e>0?sh:ch:e===Ym?oh:{_tag:`Nanos`,nanos:e},t},uh=e=>O(e,Jm),dh=e=>e.value._tag!==`Infinity`&&e.value._tag!==`NegativeInfinity`,fh=K(0),ph=K(1/0),mh=K(-1/0),hh=e=>K(e),gh=e=>K(e),_h=e=>K(e*1e3),vh=e=>K(e*6e4),yh=e=>K(e*36e5),bh=e=>K(e*864e5),xh=e=>K(e*6048e5),Sh=e=>Th(ih(e),{onMillis:D,onNanos:e=>Number(e)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Ch=e=>Th(ih(e),{onMillis:e=>e/1e3,onNanos:e=>Number(e)/1e9,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),wh=e=>{let t=ih(e);switch(t.value._tag){case`Infinity`:case`NegativeInfinity`:throw Error(`Cannot convert infinite duration to nanos`);case`Nanos`:return t.value.nanos;case`Millis`:return th(t.value.millis)}},Th=E(2,(e,t)=>{switch(e.value._tag){case`Millis`:return t.onMillis(e.value.millis);case`Nanos`:return t.onNanos(e.value.nanos);case`Infinity`:return t.onInfinity();case`NegativeInfinity`:return(t.onNegativeInfinity??t.onInfinity)()}}),Eh=E(3,(e,t,n)=>e.value._tag===`Infinity`||e.value._tag===`NegativeInfinity`||t.value._tag===`Infinity`||t.value._tag===`NegativeInfinity`?n.onInfinity(e,t):e.value._tag===`Millis`?t.value._tag===`Millis`?n.onMillis(e.value.millis,t.value.millis):n.onNanos(wh(e),t.value.nanos):n.onNanos(e.value.nanos,wh(t))),Dh=(e,t)=>Eh(e,t,{onMillis:(e,t)=>e===t,onNanos:(e,t)=>e===t,onInfinity:(e,t)=>e.value._tag===t.value._tag}),Oh=E(2,(e,t)=>Dh(e,t)),kh=e=>t=>{let n=e(t);return U(n)?zp():Bp(n.success)},Ah=G(`effect/Scheduler`,{fiberCached:!0,defaultValue:()=>new Fh}),jh=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},Mh=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},Nh=e=>{try{return Mh(e)}catch{return jh(e)}},Ph=class{buckets=[];scheduleTask(e,t){let n=this.buckets,r=n.length,i,a=0;for(;a<r&&!(n[a][0]>t);a++)i=n[a];i&&i[0]===t?i[1].push(e):a===r?n.push([t,[e]]):n.splice(a,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}},Fh=class{executionMode;setImmediate;constructor(e=`async`,t){this.executionMode=e,this.setImmediate=t??(e===`sync`?jh:Nh)}shouldYield(e){return e.currentOpCount>=e.cache.maxOpsBeforeYield}makeDispatcher(){return new Ih(this.setImmediate)}},Ih=class{tasks=new Ph;running=void 0;setImmediate;constructor(e=Nh){this.setImmediate=e}scheduleTask(e,t){this.tasks.scheduleTask(e,t),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let n=e[t][1];for(let e=0;e<n.length;e++)n[e]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},Lh=G(`effect/Scheduler/MaxOpsBeforeYield`,{fiberCached:!0,defaultValue:()=>2048}),Rh=G(`effect/Scheduler/PreventSchedulerYield`,{fiberCached:!0,defaultValue:()=>!1}),zh=`effect/Tracer/ParentSpan`;ym()(zh,{fiberCached:!0});var Bh=`effect/Tracer`,Vh=`effect/Metric/FiberRuntimeMetrics`,Hh=G(`effect/References/CurrentStackFrame`,{fiberCached:!0,defaultValue:ju}),Uh=G(`effect/References/TracerEnabled`,{fiberCached:!0,defaultValue:ku}),Wh=G(`effect/References/CurrentLogAnnotations`,{defaultValue:()=>({})}),Gh=G(`effect/References/CurrentLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),Kh=G(`effect/References/MinimumLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),qh=G(`effect/References/CurrentLogSpans`,{defaultValue:()=>[]}),Jh=class extends kf{constructor(e,t=Af){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[N](e){return Hf(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[k](){return j(M(`${this._tag}:${this.fiberId}`))(nd(this.annotations))}},Yh=e=>new Df([new Jh(e)]),Xh=e=>{let t=e.reasons.find(Bf);return t?em(t):tm(e)},Zh=e=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag===`Fail`)return em(n.error)}return tm(e)},Qh=kh(Zh),$h=e=>{let t=e.reasons.find(Vf);return t?em(t.defect):tm(e)},eg=e=>e.reasons.some(Hf),tg=e=>{let t;for(let n=0;n<e.reasons.length;n++){let r=e.reasons[n];r._tag===`Interrupt`&&(t??=new Set,r.fiberId!==void 0&&t.add(r.fiberId))}return t?em(t):tm(e)},ng=e=>e.reasons.length>0&&e.reasons.every(Hf),rg=E(2,(e,t)=>{let n=!1,r=e.reasons.map(e=>Bf(e)?(n=!0,new jf(t(e.error),e.annotations)):e);return n?Mf(r):e}),ig=e=>{let t;for(let n of e.reasons){if(n._tag===`Fail`)return n.error;n._tag===`Die`&&(t??=n)}return t===void 0?e.reasons.length>0?new globalThis.Error(`All fibers interrupted without error`):new globalThis.Error(`Empty cause`):t.defect},ag=(e,t)=>{let n=[],r=[];if(e.reasons.length===0)return n;let i=uf();i!==0&&df(1);try{for(let i of e.reasons){if(i._tag===`Interrupt`){r.push(i);continue}n.push(og(i._tag===`Die`?i.defect:i.error,i.annotations,t))}if(n.length===0){let e=Error(`The fiber was interrupted by:`);e.name=`InterruptCause`,e.stack=dg(e,r);let i=new globalThis.Error(`All fibers interrupted without error`,{cause:e});i.name=`InterruptError`,i.stack=`${i.name}: ${i.message}`,n.push(og(i,r[0].annotations,t))}}finally{i!==0&&df(i)}return n},og=(e,t,n)=>{let r=typeof e,i;if(e&&r===`object`){if(i=new globalThis.Error(sg(e),{cause:e.cause?og(e.cause):void 0}),typeof e.name==`string`&&(i.name=e.name),typeof e.stack==`string`)i.stack=lg(e.stack,i,t);else{let e=`${i.name}: ${i.message}`;i.stack=t?ug(e,t):e}n?.includeCauseInStack&&(i.stack=mg(i));for(let t of Object.keys(e))t in i||(i[t]=e[t])}else{i=new globalThis.Error(e?r===`string`?e:tf(e):`Unknown error: ${e}`);let n=`${i.name}: ${i.message}`;i.stack=t?ug(n,t):n}return i},sg=e=>{if(typeof e.message==`string`)return e.message;if(typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return tf(e)},cg=/\((.*)\)/g,lg=(e,t,n)=>{let r=`${t.name}: ${t.message}`,i=(e.startsWith(r)?e.slice(r.length):e).split(`
|
|
70
|
+
`),a=[r];for(let e=1;e<i.length&&!/Generator\.next|~effect\/(?:Effect|Utils)/.test(i[e]);e++)a.push(i[e]);return n?ug(a.join(`
|
|
71
|
+
`),n):a.join(`
|
|
72
|
+
`)},ug=(e,t)=>{let n=t?.get(Kf.key);return n&&(e=`${e}\n${fg(n)}`),e},dg=(e,t)=>{let n=[`${e.name}: ${e.message}`];for(let e of t){let t=e.fiberId===void 0?`unknown`:`#${e.fiberId}`,r=e.annotations.get(qf.key);n.push(` at fiber (${t})`),r&&n.push(fg(r))}return n.join(`
|
|
73
|
+
`)},fg=e=>{let t=[],n=e,r=0;for(;n&&r<10;){let e=n.stack();if(e){let r=e.matchAll(cg),i=!1;for(let[,e]of r)i=!0,t.push(` at ${n.name} (${e})`);i||t.push(` at ${n.name} (${e.replace(/^at /,``)})`)}else t.push(` at ${n.name}`);n=n.parent,r++}return t.join(`
|
|
74
|
+
`)},pg=e=>ag(e).map(mg).join(`
|
|
75
|
+
`),mg=e=>e.cause?`${e.stack} {\n${hg(e.cause,` `)}\n}`:e.stack,hg=(e,t)=>{let n=e.stack.split(`
|
|
76
|
+
`),r=`${t}[cause]: ${n[0]}`;for(let e=1,i=n.length;e<i;e++)r+=`\n${t}${n[e]}`;return e.cause&&(r+=` {\n${hg(e.cause,`${t} `)}\n${t}}`),r},gg=`~effect/Fiber`,_g={_A:D,_E:D},vg={id:0},yg=(()=>{try{return globalThis.process?.getBuiltinModule?.(`node:async_hooks`)?.AsyncResource}catch{return}})(),bg=()=>yg===void 0?void 0:new yg(`effect/Fiber`),xg=()=>globalThis[Kd],Sg=class{constructor(e,t=!0){this.setContext(e),this.id=++vg.id,this.currentOpCount=0,this.interruptible=t,this._stack=[],this._observers=void 0,this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this._parent=void 0,this._asyncContext=void 0,this.cache.runtimeMetrics?.recordFiberStart(this.context)}get[gg](){return _g}get currentDispatcher(){return this._dispatcher??=this.cache.scheduler.makeDispatcher()}getRef(e){return W(this.context,e)}addObserver(e){return this._exit?(e(this._exit),Mu):(this._observers===void 0?this._observers=[e]:this._observers.push(e),()=>this.removeObserver(e))}removeObserver(e){if(this._exit||this._observers===void 0)return;let t=this._observers.indexOf(e);t>=0&&this._observers.splice(t,1)}interruptUnsafe(e,t){if(this._exit)return;let n=Yh(e);this.cache.stackFrame&&(n=zf(n,zm(Kf,this.cache.stackFrame))),t&&(n=zf(n,t)),this._interruptedCause=this._interruptedCause?Pf(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(J(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;if(this._asyncContext!==void 0){let t=this._asyncContext;return this._asyncContext=void 0,t.runInAsyncScope(this.evaluate,this,e)}if(this._yielded!==void 0){let e=this._yielded;this._yielded=void 0,e()}let t=this.runLoop(e);if(t===yf){this._asyncContext=bg();return}let n=Eg.interruptChildren&&Eg.interruptChildren(this);if(n!==void 0)return this.evaluate(Q(n,()=>t));if(this._exit=t,this.cache.runtimeMetrics?.recordFiberEnd(this.context,this._exit),this._parent&&=(this._parent._children?.delete(this),void 0),this._observers!==void 0){let e=this._observers;this._observers=void 0;for(let n=0;n<e.length;n++)e[n](t)}this._stack.length=0,this._children=void 0,this.context=Lm()}runLoop(e){let t=globalThis[Kd];globalThis[Kd]=this;let n=this._running;this._running=!0;let r=!1,i=e;this.currentOpCount=0;try{for(;;)try{this._deferredInterrupt&&(this._deferredInterrupt=!1,i=J(this._interruptedCause)),this.currentOpCount++;let e=this.cache;if(!r&&!e.preventYield&&e.scheduler.shouldYield(this)){r=!0;let e=i;i=Q(Lg,()=>e)}if(i=e.tracerContext?e.tracerContext(i,this):i[L](this),i===yf){let e=this._yielded;if(hf in e)return this._deferredInterrupt=!1,this._yielded=void 0,e;if(this._deferredInterrupt){this._yielded=void 0,e();continue}return yf}}catch(e){if(!O(i,L))return Xf(`Fiber.runLoop: Not a valid effect: ${String(i)}`);i=Xf(e)}}finally{this._running=n,globalThis[Kd]=t}}getCont(e){if(this._deferredInterrupt)return this._deferredInterrupt=!1,wg;for(;;){let t=this._stack.pop();if(!t)return;let n=t[vf];if(n!==void 0){let r=n.call(t,this);if(r)return r[e]=r,r}if(t[e])return t}}succeedWith(e){if(!(++this.currentOpCount&Tg-1))return V(e);let t=this.getCont(R);return t?t[R](e,this):this.yieldWith(V(e))}yieldWith(e){return this._yielded=e,yf}children(){return this._children??=new Set}pipe(){return Tu(this,arguments)}setContext(e){let t=this.context;if(this.context=e,t!==void 0&&Pm(t,e))return;let n=e.cacheRoot,r=n._fiberCache??=Cg(e);this.cache?.scheduler!==r.scheduler&&(this._dispatcher=void 0),this.cache=r}get currentSpanLocal(){let e=this.cache.span;return e?._tag===`Span`?e:void 0}},Cg=e=>{let t=Hm(e,Bh);return{scheduler:W(e,Ah),tracer:t,tracerContext:t?t.context:void 0,tracerEnabled:W(e,Uh),span:Hm(e,zh),logLevel:W(e,Gh),minimumLogLevel:W(e,Kh),stackFrame:W(e,Hh),runtimeMetrics:Hm(e,Vh),maxOpsBeforeYield:W(e,Lh),preventYield:W(e,Rh)}},wg={[R](e,t){return J(t._interruptedCause)},[z](e,t){return J(t._interruptedCause)}},Tg=32,Eg={interruptChildren:void 0},Dg=e=>{if(!e.cache.stackFrame)return;let t=new Map;return t.set(qf.key,e.cache.stackFrame),Mm(t)},Og=e=>{if(e._children!==void 0&&e._children.size!==0)return Pg(e._children)},kg=e=>{let t=e;return t._exit?q(t._exit):Jg(n=>t._exit?n(q(t._exit)):Y(e.addObserver(e=>n(q(e)))))},Ag=e=>Jg(t=>{let n=e[Symbol.iterator](),r=[],i;function a(){let e=n.next();for(;!e.done;){if(e.value._exit){r.push(e.value._exit),e=n.next();continue}i=e.value.addObserver(e=>{r.push(e),a()});return}t(q(r))}return a(),Y(()=>i?.())}),jg=e=>{let t=e;return t._exit?t._exit:Jg(n=>t._exit?n(t._exit):Y(e.addObserver(n)))},Mg=e=>H(t=>Ng(e,t.id)),Ng=E(e=>O(e[0],gg),(e,t,n)=>H(r=>{let i=Dg(r);return i=i&&n?qm(i,n):i??n,e.interruptUnsafe(t,i),g_(kg(e))})),Pg=e=>H(t=>{let n=Dg(t),r=pm();for(let i of e)i.interruptUnsafe(t.id,n),r.push(i);return g_(Ag(r))}),q=V,J=Jf,Fg=Yf,Y=Wf({op:`Sync`,[L](e){let t=this[I](),n=e.getCont(R);return n?n[R](t,e):e.yieldWith(V(t))}}),X=Wf({op:`Suspend`,[L](e){return this[I]()}}),Ig=om({onFailure:Fg,onSuccess:q}),Lg=Wf({op:`Yield`,[L](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(k_)},this[I]??0),e.yieldWith(()=>{t=!0})}})(0),Rg=q(zp()),zg=e=>X(()=>J(e())),Bg=e=>Xf(e),Vg=e=>X(()=>Fg(e())),Z=q(void 0),Hg=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new Uy(e,`An error occurred in Effect.try`):e.catch;return X(()=>{try{return q(t())}catch(e){return Fg(n(e))}})},Ug=e=>Kg(function(t,n){e(n).then(e=>t(q(e)),e=>t(Bg(e)))},e.length!==0),Wg=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new Uy(e,`An error occurred in Effect.tryPromise`):e.catch;return Kg(function(e,r){let i=e=>X(()=>{try{return Fg(pf(()=>n(e)))}catch(e){return Bg(e)}});try{t(r).then(t=>e(q(t)),t=>e(i(t)))}catch(t){e(i(t))}},t.length!==0)},Gg=e=>H(t=>e(t.id)),Kg=function(){let e=B({op:`Async`,[L](e){let t=!1,n=!1,r=this.withSignal?new AbortController:void 0,i=this.register.call(e.cache.scheduler,r=>{t||(t=!0,n?e.evaluate(r):n=r)},r?.signal);return n===!1?(n=!0,e._yielded=()=>{t=!0},r===void 0&&i===void 0||e._stack.push(qg(()=>(t=!0,r?.abort(),i??k_))),yf):n}}),t=function(e,t){this.register=e,this.withSignal=t};return t.prototype=e,function(e,n){return new t(e,n)}}(),qg=Wf({op:`AsyncFinalizer`,[vf](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Yv))},[z](e,t){return eg(e)?Q(yv(Jf(e),this[I]()),()=>J(e)):J(e)}}),Jg=e=>Kg(e,e.length>=2),Yg=Jg(Mu),Xg=(...e)=>{if(e.length===1){let t=e[0];return X(()=>t_(t()))}let[t,n]=e;return X(()=>t_(n.call(t.self)))},Zg=(e,...t)=>{let n=t.length===0?function(){return X(()=>t_(e.apply(this,arguments)))}:function(){let n=X(()=>t_(e.apply(this,arguments)));for(let e=0;e<t.length;e++)n=t[e](n,...arguments);return n};return Qg(e.length,n)},Qg=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),$g=(e,...t)=>Qg(e.length,t.length===0?function(){return e_(()=>e.apply(this,arguments))}:function(){let n=e_(()=>e.apply(this,arguments));for(let e of t)n=e(n,...arguments);return n}),e_=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return q(r.value);let i=r.value;if(i&&i._tag===`Success`){n=i.value;continue}if(i&&i._tag===`Failure`)return r.value;{let n=!0;return X(()=>n?(n=!1,Q(r.value,e=>t_(t,e))):X(()=>t_(e())))}}}catch(e){return Bg(e)}},t_=function(){let e=B({op:`Iterator`,[R](e,t){let n=this.iterator;for(;;){let r=n.next(e);if(r.done)return q(r.value);if(!$(r.value))return t._stack.push(this),r.value;if(r.value._tag===`Failure`)return r.value;e=r.value.value}},[L](e){return this[R](this.initial,e)}}),t=function(e,t){this.iterator=e,this.initial=t};return t.prototype=e,function(e,n){return new t(e,n)}}(),n_=E(2,(e,t)=>new a_(e,o_,q(t))),r_=function(e){return e._stack.push(this),this[I]},i_=B({op:`OnSuccess`,[L]:r_}),a_=function(e,t,n){this[I]=e,this[R]=t,this.payload=n};a_.prototype=i_;var o_=function(){return this.payload},s_=function(e,t){return t.succeedWith(this.payload)},c_=(()=>{let e=`~effect/Effect/stackProbe`;return{[e]:function(){return Error().stack}}[e]()?.includes(`[as `+e+`]`)===!0})(),l_=function(e,t){let n=this.payload;return t.succeedWith(c_?n(e):pf(()=>n(e)))},u_=function(e){let t=this.payload;return t(e)},d_=function(e){let t=this.payload;return new a_(t(e),s_,e)},f_=function(e){return new a_(this.payload,s_,e)},p_=e=>S_(e,Bp),m_=E(2,(e,t)=>new a_(e,Sf(t)?o_:u_,t)),h_=E(2,(e,t)=>new a_(e,Sf(t)?f_:d_,t)),g_=e=>new a_(e,o_,k_),__=(e,t)=>H(n=>{let r=new Set;return zv(n,()=>r.size===0?void 0:Pg(r)),Jg(i=>{let a=!1,o=0;for(let s of e){if(a)break;let e=o++,c=dy(n,s,!0,!0,!1);r.add(c),c.addObserver(o=>{r.delete(c);let s=!a;a=!0,i(o),s&&t?.onWinner&&t.onWinner({fiber:c,index:e,parentFiber:n})})}})}),v_=E(e=>Sf(e[1]),(e,t,n)=>__([e,t],n)),Q=E(2,(e,t)=>new a_(e,u_,t)),y_=E(2,(e,t)=>$(e)?e._tag===`Success`?t.onSuccess(e.value):t.onFailure(e.cause):tv(e,t)),$=e=>e[hf]!==void 0,b_=E(2,(e,t)=>$(e)?e._tag===`Success`?t(e.value):e:Q(e,t)),x_=e=>Q(e,D),S_=E(2,(e,t)=>new a_(e,l_,t)),C_=E(2,(e,t)=>$(e)?A_(e,t):S_(e,t)),w_=E(2,(e,t)=>$(e)?j_(e,t):Z_(e,t)),T_=e=>Jf(Yh(e)),E_=e=>e._tag===`Success`,D_=e=>e._tag===`Failure`,O_=e=>e._tag===`Failure`?em(e.cause):tm(e),k_=V(void 0),A_=E(2,(e,t)=>e._tag===`Success`?V(t(e.value)):e),j_=E(2,(e,t)=>{if(e._tag===`Success`)return e;let n=Zh(e.cause);return U(n)?e:Yf(t(n.success))}),M_=E(2,(e,t)=>E_(e)?t:e),N_=E(2,(e,t)=>E_(e)?t.onSuccess(e.value):t.onFailure(e.cause)),P_=e=>{let t=[];for(let n of e)n._tag===`Failure`&&t.push(...n.cause.reasons);return t.length===0?k_:Jf(Mf(t))},F_=E(2,(e,t)=>H(n=>{let r=n.context,i=t(r);return r===i?e:(n.setContext(i),zv(n,()=>{n.setContext(r)}),e)})),I_=E(3,(e,t,n)=>F_(e,e=>{let r=Um(e,t),i=n(r);return r===i?e:Bm(e,t,i)})),L_=()=>R_,R_=H(e=>q(e.context)),z_=e=>H(t=>e(t.context)),B_=E(2,(e,t)=>$(e)?e:F_(e,qm(t))),V_=function(){return arguments.length===1?E(2,(e,t)=>H_(e,arguments[0],t)):E(3,(e,t,n)=>H_(e,t,n)).apply(this,arguments)},H_=(e,t,n)=>F_(e,Bm(t,n)),U_=E(e=>Sf(e[0]),(e,t)=>ny({while:ku,body:Ou(t?.disableYield?e:Q(e,e=>Lg)),step:Mu})),W_=E(2,(e,t)=>new K_(e,t.length===1?t:e=>t(e))),G_=B({op:`OnFailure`,[L]:r_}),K_=function(e,t){this[I]=e,this[z]=t};K_.prototype=G_;var q_=E(3,(e,t,n)=>W_(e,e=>{let r=t(e);return U(r)?J(r.failure):n(r.success,e)})),J_=E(2,(e,t)=>q_(e,Zh,e=>t(e))),Y_=E(3,(e,t,n)=>W_(e,e=>{let r=t(e);return U(r)?J(e):m_(n(r.success,e),J(e))})),X_=E(2,(e,t)=>Y_(e,Zh,e=>t(e))),Z_=E(2,(e,t)=>J_(e,e=>Vg(()=>t(e)))),Q_=e=>J_(e,Bg),$_=E(e=>Sf(e[0]),(e,t)=>{if(!t?.log)return ov(e,{onFailure:e=>Z,onSuccess:e=>Z});let n=Qy(t.log===!0?void 0:t.log);return tv(e,{onFailure(e){let r=Xh(e);return U(r)?J(r.failure):t.message===void 0?n(e):n(t.message,e)},onSuccess:e=>Z})}),ev=e=>cv(e,{onFailure:tm,onSuccess:em}),tv=E(2,(e,t)=>new rv(e,t.onSuccess.length===1?t.onSuccess:e=>t.onSuccess(e),t.onFailure.length===1?t.onFailure:e=>t.onFailure(e))),nv=B({op:`OnSuccessAndFailure`,[L]:r_}),rv=function(e,t,n){this[I]=e,this[R]=t,this[z]=n};rv.prototype=nv;var iv=function(e,t){let n=this.payload;return t.succeedWith(c_?n.onSuccess(e):pf(()=>n.onSuccess(e)))},av=((e,t)=>{let n=B({op:e,[L]:r_,[R]:iv,[z]:t}),r=function(e,t){this[I]=e,this.payload=t};return r.prototype=n,r})(`Match`,function(e,t){let n=e.reasons.find(Bf);if(n===void 0)return J(e);let r=this.payload;return t.succeedWith(c_?r.onFailure(n.error):pf(()=>r.onFailure(n.error)))}),ov=E(2,(e,t)=>tv(e,{onFailure:e=>{let n=e.reasons.find(Bf);return n?t.onFailure(n.error):J(e)},onSuccess:t.onSuccess})),sv=E(2,(e,t)=>new av(e,t)),cv=E(2,(e,t)=>{if($(e)){if(e._tag===`Success`)return V(t.onSuccess(e.value));let n=Zh(e.cause);return U(n)?e:V(t.onFailure(n.success))}return sv(e,t)}),lv=e=>$(e)?V(e):uv(e),uv=Wf({op:`Exit`,[L](e){return e._stack.push(this),this[I]},[R](e,t,n){return t.succeedWith(n??V(e))},[z](e,t,n){return t.succeedWith(n??Jf(e))}}),dv=E(2,(e,t)=>Q(fv(e,t.duration),e=>Hp(e)?t.orElse():q(e.value))),fv=E(2,(e,t)=>v_(p_(e),n_(Iy(t),zp()))),pv=`~effect/Scope`,mv=`~effect/Scope/Closeable`,hv=ym(`effect/Scope`),gv=(e,t)=>H(n=>(Qv(n),_v(e,t)??Z)),_v=(e,t)=>{let n=e.state;if(n._tag===`Closed`||(e.state={_tag:`Closed`,exit:t},e.parent!==void 0&&Ev(e.parent,e),n._tag===`Empty`))return;if(n.finalizer!==void 0)return vv(n.finalizer,t);let r=n.finalizers;return r.size===1?vv(r.values().next().value,t):bv(e,r,t)},vv=(e,t)=>{try{return e(t)}catch(e){return Xf(e)}},yv=(e,t)=>E_(e)?t:W_(t,t=>J(Pf(e.cause,t))),bv=Zg(function*(e,t,n){let r=[],i=[],a=Array.from(t.values()),o=xg();for(let t=a.length-1;t>=0;t--){let s=a[t];e.strategy===`sequential`?r.push(yield*lv(vv(s,n))):i.push(dy(o,vv(s,n),!0,!0,`inherit`))}return i.length>0&&(r=yield*Ag(i)),yield*P_(r)}),xv=(e,t)=>Y(()=>Sv(e,t)),Sv=(e,t)=>{let n=Ov(t,e);return e.state._tag===`Closed`?(n.state=e.state,n):(Tv(e,n,e=>gv(n,e)),n)},Cv=(e,t)=>X(()=>e.state._tag===`Closed`?t(e.state.exit):(Tv(e,{},t),Z)),wv=(e,t)=>Cv(e,Ou(t)),Tv=(e,t,n)=>{if(e.state._tag===`Empty`)e.state={_tag:`Open`,finalizerKey:t,finalizer:n,finalizers:void 0};else if(e.state._tag===`Open`){let r=e.state;r.finalizer===void 0?r.finalizers.set(t,n):(r.finalizers=new Map([[r.finalizerKey,r.finalizer]]),r.finalizerKey=void 0,r.finalizer=void 0,r.finalizers.set(t,n))}},Ev=(e,t)=>{if(e.state._tag!==`Open`)return;let n=e.state;n.finalizerKey===t?e.state=kv:n.finalizers!==void 0&&(n.finalizers.delete(t),n.finalizers.size===0&&(e.state=kv))},Dv=e=>Ov(e,void 0),Ov=(e=`sequential`,t)=>({[mv]:mv,[pv]:pv,strategy:e,parent:t,state:kv}),kv={_tag:`Empty`},Av=e=>Y(()=>Dv(e)),jv=hv,Mv=V_(hv),Nv=e=>H(t=>{let n=t.context,r=Dv();return t.setContext(Bm(t.context,hv,r)),zv(t,e=>(t.setContext(n),_v(r,e))),e}),Pv=e=>X(()=>{let t=Dv();return Bv(e(t),e=>X(()=>_v(t,e)??Z))}),Fv=(e,t,n)=>z_(r=>ey(i=>Q(jv,a=>h_(n?.interruptible?i(e):e,e=>Cv(a,n=>B_(t(e,n),r)))))),Iv=e=>Q(jv,t=>z_(n=>Cv(t,t=>B_(e(t),n)))),Lv=function(){let e=B({op:`OnExit`,[L](e){return e._stack.push(this),this.effect},[vf](e){e.interruptible&&this.interruptible!==!0&&(e._stack.push(Yv),e.interruptible=!1)},[R](e,t,n){n??=V(e);let r;try{r=this.onExit(n)}catch(e){r=Xf(e)}return r?Q(r,e=>n):n},[z](e,t,n){n??=Jf(e);let r;try{r=this.onExit(n)}catch(e){r=Xf(e)}return r?Q(yv(n,r),e=>n):n}}),t=function(e,t,n){this.effect=e,this.onExit=t,this.interruptible=n};return t.prototype=e,t}(),Rv=(e,t,n)=>new Lv(e,t,n),zv=(e,t)=>{e._stack.push(new Lv(void 0,t,void 0))},Bv=E(2,Rv),Vv=E(2,(e,t)=>Bv(e,e=>t)),Hv=E(3,(e,t,n)=>Bv(e,e=>{let r=t(e);return U(r)?Z:n(r.success,e)})),Uv=E(2,(e,t)=>Hv(e,O_,t)),Wv=E(3,(e,t,n)=>Bv(e,e=>{if(e._tag!==`Failure`)return Z;let r=t(e.cause);return U(r)?Z:n(r.success,e.cause)})),Gv=E(2,(e,t)=>Wv(tg,t)(e)),Kv=(e,t,n)=>ey(r=>Q(e,e=>Rv(X(()=>r(t(e))),t=>n(e,t),!0))),qv=e=>H(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Yv),e):e),Jv=Wf({op:`SetInterruptible`,[vf](e){if(e.interruptible=this[I],e._interruptedCause&&e.interruptible)return()=>J(e._interruptedCause)}}),Yv=Jv(!0),Xv=Jv(!1),Zv=e=>{if(e.interruptible=!0,e._stack.push(Xv),e._interruptedCause)return J(e._interruptedCause)},Qv=e=>{let t=e;t.interruptible&&(t.interruptible=!1,t._stack.push(Yv))},$v=e=>H(t=>t.interruptible?e:Zv(t)??e),ey=e=>H(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Yv),e($v)):e(D)),ty=(e,t)=>td(e)?t?.mode===`result`?ry(e,ev,t):ry(e,D,t):t?.discard?t.mode===`result`?ry(Object.values(e),ev,t):ry(Object.values(e),D,t):X(()=>{let n={};return n_(ry(Object.entries(e),([e,r])=>S_(t?.mode===`result`?ev(r):r,t=>{Bd(n,e,t)}),{discard:!0,concurrency:t?.concurrency}),n)}),ny=Wf({op:`While`,[R](e,t){return this[I].step(e),this[I].while()?(t._stack.push(this),this[I].body()):k_},[L](e){return this[I].while()?(e._stack.push(this),this[I].body()):k_}}),ry=E(e=>typeof e[1]==`function`,(e,t,n)=>X(()=>{let r=ay(n?.concurrency);if(r===1)return iy(e,t,n);let i=lm(e),a=i.length;if(a===0)return n?.discard?Z:q([]);let o=n?.discard?void 0:Array(a),s=ly({f:t,out:o},i,{concurrency:r});return s?n_(s,o):q(o)})),iy=(e,t,n)=>X(()=>{let r=n?.discard?void 0:[],i=e[Symbol.iterator](),a=i.next(),o=0;return n_(ny({while:()=>!a.done,body:()=>t(a.value,o++),step:e=>{r&&r.push(e),a=i.next()}}),r)}),ay=e=>e===`unbounded`?1/0:Math.max(1,e??1),oy=()=>e=>{let t=e.onItem,n=e.step,r=(e,t,r,a,o)=>Q(lv(o),o=>n(e,t[r],o,r)??i(e,t,r+1,a)??Z),i=(e,i,a=0,o=i.length)=>{for(;a<o;a++){let s=i[a],c=t(e,s,a);if(!$(c))return r(e,i,a,o,c);let l=n(e,s,c,a);if(l)return l._tag===`Failure`?l:void 0}};return i},sy=e=>{let t=e.onItem,n=e.step;return(e,r,i)=>{let a=0,o=i.end??r.length,s=i.concurrency,c=!1,l,u,d,f,ee,te=e=>{let t=Xf(e);return f=t,c=!0,u&&u.size>0?Q(qv(Pg(Array.from(u))),()=>f??t):t},p=()=>{let i=!1;for(;!f&&a<o;a++){let o=r[a],m=ee??t(e,o,a);if($(m)){if(f=n(e,o,m,a),f)break}else if(l){ee=void 0;let t=dy(l,m,!0,!0,`inherit`);if(t._exit){if(f=n(e,o,t._exit,a),f)break;continue}u.add(t);let r=a;if(t.addObserver(a=>{u.delete(t);try{if(f){if(a._tag===`Failure`){let e=a.cause.reasons.filter(e=>e._tag!==`Interrupt`);if(e.length>0){let t=Mf(e);f=Jf(f._tag===`Failure`?Pf(f.cause,t):t)}}}else{let t=n(e,o,a,r);t&&(f=t,p())}if(i){let e=p();e&&d(e)}else c&&u.size===0&&d(f??Z)}catch(e){d(te(e))}}),u.size<s)continue;i=!0,a++;return}else return Jg(e=>{l=xg(),u=new Set,ee=m,d=e;let t;try{t=p()}catch(t){return e(te(t))}return t?e(t):X(()=>(f??=k_,Q(u?Pg(u):Z,()=>f?._tag===`Failure`?f:Z)))})}if(c=!0,f){if(u&&u.size>0){let e=Dg(l);u.forEach(t=>t.interruptUnsafe(l.id,e));return}if(d||f._tag===`Failure`)return f}else if(d){if(u)u.size===0&&d(Z);else return k_}};return p()}},cy=()=>e=>sy(e),ly=sy({onItem(e,t,n){return e.f(t,n)},step(e,t,n,r){if(n._tag===`Failure`)return n;e.out&&(e.out[r]=n.value)}}),uy=E(e=>Sf(e[0]),(e,t)=>H(n=>(rb(),q(dy(n,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),dy=(e,t,n=!1,r=!1,i=!1)=>{let a=e,o=i===`inherit`?a.interruptible:!i,s=new Sg(a.context,o);return r||(a.children().add(s),s._parent=a),n?s.evaluate(t):(s._asyncContext=bg(),a.currentDispatcher.scheduleTask(()=>s.evaluate(t),0)),s},fy=E(e=>Sf(e[0]),(e,t)=>H(n=>q(dy(n,e,t?.startImmediately,!0,t?.uninterruptible)))),py=E(e=>Sf(e[0]),(e,t,n)=>H(r=>{let i=dy(r,e,n?.startImmediately,!0,n?.uninterruptible);if(!i._exit){if(t.state._tag!==`Closed`){let e={};Tv(t,e,()=>Gg(e=>e===i.id?Z:Mg(i))),i.addObserver(()=>Ev(t,e))}else i.interruptUnsafe(r.id,Dg(r))}return q(i)})),my=E(e=>Sf(e[0]),(e,t)=>Q(jv,n=>py(e,n,t))),hy=e=>(t,n)=>{let r=new Sg(n?.scheduler?Bm(e,Ah,n.scheduler):e,n?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(n?.signal){if(n.signal.aborted)r.interruptUnsafe();else{let e=()=>r.interruptUnsafe();n.signal.addEventListener(`abort`,e,{once:!0}),r.addObserver(()=>n.signal.removeEventListener(`abort`,e))}}return n?.onFiberStart&&n.onFiberStart(r),r},gy=E(2,(e,t)=>e._exit?e:t.state._tag===`Closed`?(e.interruptUnsafe(e.id),e):(Ev(t,e),Tv(t,e,()=>Mg(e)),e.addObserver(()=>Ev(t,e)),e)),_y=hy(Lm()),vy=e=>{let t=hy(e);return(e,n)=>{let r=t(e,n);return new Promise(e=>{r.addObserver(t=>e(t))})}},yy=vy(Lm()),by=e=>{let t=vy(e);return(e,n)=>t(e,n).then(e=>{if(e._tag===`Failure`)throw ig(e.cause);return e.value})},xy=e=>{let t=hy(e);return e=>{if($(e))return e;let n=new Fh(`sync`),r=t(e,{scheduler:n});return r._dispatcher?.flush(),r._exit??Xf(new Vy(r))}},Sy=xy(Lm()),Cy=(e=>{let t=xy(e);return e=>{let n=t(e);if(n._tag===`Failure`)throw ig(n.cause);return n.value}})(Lm()),wy=q(!0),Ty=q(!1),Ey=class{waiters=[];scheduled=void 0;_isOpen;constructor(e){this._isOpen=e}scheduleUnsafe(e){if(this.waiters.length===0)return wy;if(this.scheduled===void 0)this.scheduled=this.waiters,e.currentDispatcher.scheduleTask(this.flushScheduled,0);else for(let e=0;e<this.waiters.length;e++)this.scheduled.push(this.waiters[e]);return this.waiters=[],wy}flushScheduled=()=>{if(this.scheduled===void 0)return;let e=this.scheduled;this.scheduled=void 0;for(let t=0;t<e.length;t++)e[t](k_)};flushWaiters(){let e=this.waiters;this.waiters=[],this.flushScheduled();for(let t=0;t<e.length;t++)e[t](k_)}open=H(e=>this._isOpen?Ty:(this._isOpen=!0,this.scheduleUnsafe(e)));release=H(e=>this._isOpen?Ty:this.scheduleUnsafe(e));openUnsafe(){return!this._isOpen&&(this._isOpen=!0,this.flushWaiters(),!0)}await=Jg(e=>this._isOpen?e(Z):(this.waiters.push(e),Y(()=>{let t=this.waiters.indexOf(e);t===-1?this.scheduled!==void 0&&(t=this.scheduled.indexOf(e),t!==-1&&this.scheduled.splice(t,1)):this.waiters.splice(t,1)})));closeUnsafe(){return this._isOpen?(this._isOpen=!1,!0):!1}close=Y(()=>this.closeUnsafe());whenOpen=e=>Q(this.await,()=>e);isOpen(){return this._isOpen}},Dy=e=>new Ey(e??!1),Oy=e=>Y(()=>Dy(e)),ky=G(`effect/Clock`,{defaultValue:()=>new jy}),Ay=2**31-1,jy=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=Y(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return Py()}currentTimeNanos=Y(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return Ny()}monotonicTimeNanos=Y(()=>this.monotonicTimeNanosUnsafe());sleep(e){return this.sleepMillis(Sh(e))}sleepMillis(e){return e<=0?Lg:Number.isFinite(e)?Jg(t=>{let n=e>Ay?this.sleepMillis(e-Ay):Z,r=setTimeout(()=>t(n),Math.min(e,Ay));return Y(()=>clearTimeout(r))}):Yg}},My=BigInt(1e6),Ny=function(){let e=globalThis.process?.hrtime;if(typeof e?.bigint==`function`)return()=>e.bigint();if(typeof performance<`u`&&typeof performance.now==`function`)return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(0);return()=>{let e=BigInt(Date.now())*My;return e>t&&(t=e),t}}(),Py=function(){let e=BigInt(1e9),t;return()=>{let n=Ny(),r=BigInt(Date.now())*My;if(t===void 0)t=r-n;else{let i=t+n;(r>i?r-i:i-r)>e&&(t=r-n)}return t+n}}(),Fy=e=>H(t=>e(t.getRef(ky))),Iy=e=>Fy(t=>t.sleep(ih(e))),Ly=Fy(e=>e.currentTimeMillis);$f(`TimeoutError`);var Ry=`~effect/Cause/IllegalArgumentError`,zy=class extends $f(`IllegalArgumentError`){[Ry]=Ry;constructor(e){super({message:e})}};$f(`ExceededCapacityError`);var By=`~effect/Cause/AsyncFiberError`,Vy=class extends $f(`AsyncFiberError`){[By]=By;constructor(e){super({message:`An asynchronous Effect was executed with Effect.runSync`,fiber:e})}},Hy=`~effect/Cause/UnknownError`,Uy=class extends $f(`UnknownError`){[Hy]=Hy;constructor(e,t){super({message:t,cause:e})}},Wy=G(`effect/Console`,{defaultValue:()=>globalThis.console}),Gy=Ip(Np(jp,e=>{switch(e){case`All`:return-(2**53-1);case`Fatal`:return 5e4;case`Error`:return 4e4;case`Warn`:return 3e4;case`Info`:return 2e4;case`Debug`:return 1e4;case`Trace`:return 0;case`None`:return 2**53-1}})),Ky=G(`effect/Logger/CurrentLoggers`,{defaultValue:()=>new Set([tb,nb])}),qy=G(`effect/Logger/LogToStderr`,{defaultValue:Au}),Jy={"~effect/Logger":{_Message:D,_Output:D},pipe(){return Tu(this,arguments)}},Yy=e=>{let t=Object.create(Jy);return t.log=e,t},Xy=e=>e.replace(/[\s="]/g,`_`),Zy=(e,t)=>`${Xy(e[0])}=${t-e[1]}ms`,Qy=e=>(...t)=>{let n;for(let e=0,r=t.length;e<r;e++){let r=t[e];Ef(r)&&(n?t.splice(e,1):t=t.slice(0,e).concat(t.slice(e+1)),n=n?Mf(n.reasons.concat(r.reasons)):r,e--)}return n===void 0&&(n=Ff),H(r=>{let i=e??r.cache.logLevel;if(Gy(r.cache.minimumLogLevel,i))return Z;let a=r.getRef(ky),o=r.getRef(Ky);if(o.size>0){let e=new Date(a.currentTimeMillisUnsafe());for(let a of o)a.log({cause:n,fiber:r,date:e,logLevel:i,message:t})}return Z})},$y={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};$y.gray,$y.blue,$y.green,$y.yellow,$y.red,$y.bgBrightRed,$y.black;var eb=e=>`${e.getHours().toString().padStart(2,`0`)}:${e.getMinutes().toString().padStart(2,`0`)}:${e.getSeconds().toString().padStart(2,`0`)}.${e.getMilliseconds().toString().padStart(3,`0`)}`,tb=Yy(({cause:e,date:t,fiber:n,logLevel:r,message:i})=>{let a=Array.isArray(i)?i.slice():[i];e.reasons.length>0&&a.push(pg(e));let o=t.getTime(),s=n.getRef(qh),c=``;for(let e of s)c+=` ${Zy(e,o)}`;let l=n.getRef(Wh);Object.keys(l).length>0&&a.push(l);let u=n.getRef(Wy);(n.getRef(qy)?u.error:u.log)(`[${eb(t)}] ${r.toUpperCase()} (#${n.id})${c}:`,...a)}),nb=Yy(({cause:e,fiber:t,logLevel:n,message:r})=>{let i=t.getRef(ky),a=t.getRef(Wh),o=t.cache.span;if(o===void 0||o._tag===`ExternalSpan`)return;let s={};for(let[e,t]of Object.entries(a))Bd(s,e,t);s[`effect.fiberId`]=t.id,s[`effect.logLevel`]=n.toUpperCase(),e.reasons.length>0&&(s[`effect.cause`]=pg(e)),o.event(sf(Array.isArray(r)&&r.length===1?r[0]:r),i.currentTimeNanosUnsafe(),s)});function rb(){Eg.interruptChildren??=Og}var ib=Wh,ab=Sf,ob=ty,sb=ry,cb=ny,lb=Ug,ub=Wg,db=q,fb=X,pb=Y,mb=Z,hb=Jg,gb=Yg,_b=Xg,vb=Fg,yb=J,bb=zg,xb=Bg,Sb=Hg,Cb=Lg,wb=Ig,Tb=Q,Eb=x_,Db=m_,Ob=h_,kb=ev,Ab=lv,jb=S_,Mb=n_,Nb=g_,Pb=J_,Fb=W_,Ib=Z_,Lb=Q_,Rb=X_,zb=$_,Bb=fv,Vb=dv,Hb=Iy,Ub=v_,Wb=sv,Gb=y_,Kb=tv,qb=ov,Jb=L_,Yb=B_,Xb=V_,Zb=jv,Qb=Nv,$b=Pv,ex=Fv,tx=Kv,nx=Iv,rx=Vv,ix=Uv,ax=Rv,ox=Bv,sx=Gv,cx=qv,lx=ey,ux=U_,dx=uy,fx=py,px=my,mx=fy,hx=_y,gx=hy,_x=by,vx=yy,yx=Cy,bx=Sy,xx=Zg,Sx=Qy(`Warn`),Cx=Qy(`Error`),wx=E(e=>ab(e[0]),(e,...t)=>I_(e,ib,e=>{let n=t.length===1?{...e,...t[0]}:{...e};return t.length===1||Bd(n,t[0],t[1]),n}));ym()(`effect/Effect/Transaction`);var Tx=C_,Ex=w_,Dx=b_,Ox=$g;export{Ub as $,Ja as $a,jc as $i,Vp as $n,N as $r,cy as $t,wb as A,xa as Aa,Tu as Ai,um as An,V as Ar,rg as At,Wb as B,Oa as Ba,Ql as Bi,rm as Bn,F as Br,N_ as Bt,Ox as C,$o as Ca,E as Ci,_h as Cn,n as Co,If as Cr,cb as Ct,mx as D,za as Da,Fu as Di,Bm as Dn,Xf as Dr,p_ as Dt,dx as E,wa as Ea,Pu as Ei,ym as En,L as Er,m_ as Et,Sx as F,Pa as Fa,Dl as Fi,gm as Fn,H as Fr,$ as Ft,ix as G,Ha as Ga,pu as Gi,om as Gn,Bd as Gr,jg as Gt,Gb as H,Ga as Ha,w as Hi,nm as Hn,Zd as Hr,M_ as Ht,jb as I,ja as Ia,Ll as Ii,hm as In,uf as Ir,P_ as It,sx as J,Ma as Ja,Bc as Ji,Zp as Jn,Pd as Jr,Zh as Jt,ox as K,$a as Ka,xu as Ki,em as Kn,Rd as Kr,gy as Kt,Tx as L,ka as La,Sc as Li,mm as Ln,df as Lr,T_ as Lt,zb as M,Na as Ma,Ac as Mi,lm as Mn,Cf as Mr,ig as Mt,ab as N,Aa as Na,Bl as Ni,dm as Nn,Bf as Nr,z_ as Nt,fx as O,Fa as Oa,Du as Oi,Lm as On,Yf as Or,Jg as Ot,Cx as P,Ua as Pa,wl as Pi,fm as Pn,Wf as Pr,Ly as Pt,Xb as Q,qa as Qa,Nc as Qi,Hp as Qn,Md as Qr,ng as Qt,Ib as R,Ea as Ra,nl as Ri,tm as Rn,cf as Rr,D_ as Rt,xx as S,es as Sa,Ou as Si,dh as Sn,r as So,Rf as Sr,mb as St,ux as T,Ca as Ta,D as Ti,G as Tn,ap as Tr,zy as Tt,qb as U,Wa as Ua,ol as Ui,am as Un,Xd as Ur,kg as Ut,Kb as V,Da as Va,Ts as Vi,U as Vn,Qd as Vr,k_ as Vt,gb as W,Ta as Wa,Tl as Wi,im as Wn,Vd as Wr,Mg as Wt,lb as X,Ba as Xa,el as Xi,Gp as Xn,P as Xr,Q as Xt,Lb as Y,Ya,Xc as Yi,qp as Yn,Id as Yr,Qh as Yt,Yb as Z,Oi as Za,uc as Zi,Jp as Zn,jd as Zr,xg as Zt,yb as _,hl as _a,Vu as _i,Y as _n,We as _o,rp as _r,Vb as _t,Db as a,lu as aa,k as ai,ay as an,Jr as ao,Kp as ar,yx as at,Dx as b,Ls as ba,Qu as bi,Fh as bn,p as bo,$f as br,cx as bt,Nb as c,Zl as ca,Uu as ci,gv as cn,xr as co,Mp as cr,Qb as ct,Pb as d,du as da,Xu as di,Av as dn,$r as do,Ap as dr,db as dt,gu as ea,ud as ei,oy as en,Ka as eo,Up as er,kb as et,Jb as f,_l as fa,Yu as fi,Dv as fn,In as fo,Ip as fr,fb as ft,vb as g,Rc as ga,Ku as gi,X as gn,He as go,kp as gr,Bb as gt,Ab as h,Es as ha,ed as hi,Rg as hn,Be as ho,Lp as hr,Rb as ht,ob as i,Cu as ia,M as ii,Mv as in,Fr as io,zp as ir,_x as it,_b as j,Sa as ja,$c as ji,pm as jn,tp as jr,pg as jt,px as k,La as ka,Eu as ki,W as kn,Jf as kr,q_ as kt,hb as l,Cc as la,qu as li,xv as ln,ti as lo,Pp as lr,$b as lt,rx as m,il as ma,$u as mi,q as mn,Re as mo,Fp as mr,Ob as mt,tx as n,Il as na,A as ni,Dy as nn,Di as no,Xp as nr,gx as nt,wx as o,Ol as oa,O as oi,wv as on,xi as oo,Bp as or,bx as ot,xb as p,xs as pa,Hu as pi,hv as pn,y as po,Rp as pr,pb as pt,ax as q,Ia as qa,Hc as qi,$p as qn,Ld as qr,$h as qt,nx as r,Tc as ra,od as ri,Rv as rn,Si as ro,Wp as rr,vx as rt,Mb as s,al as sa,Wu as si,Cv as sn,Yr as so,Qp as sr,Zb as st,ex as t,dl as ta,j as ti,Oy as tn,Ra as to,Yp as tr,hx as tt,Fb as u,rl as ua,Zu as ui,Sv as un,kr as uo,jp as ur,Hb as ut,bb as v,sl as va,Gu as vi,ey as vn,Ie as vo,Qf as vr,ub as vt,sb as w,Va as wa,Nu as wi,Ch as wn,Mf as wr,Cb as wt,Eb as x,Ms as xa,Mu as xi,ih as xn,h as xo,I as xr,lx as xt,Tb as y,Kc as ya,Ju as yi,Z as yn,pe as yo,bf as yr,Sb as yt,Ex as z,_a as za,Nl as zi,sm as zn,af as zr,E_ as zt};
|