og-tester 0.0.0 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.mjs +21 -15
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import{Command as e}from"commander";import{setTimeout as t}from"node:timers/promises";import{intro as n,log as r,note as i,outro as a,spinner as o}from"@clack/prompts";import s from"picocolors";const c=(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}}},l={pipe(){return c(this,arguments)}},u=function(){function e(){}return e.prototype=l,e}(),d=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)}}}},f=e=>e,p=(e=>()=>e)(void 0),ee=p;function te(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 m(e){let t=new WeakMap;return n=>{if(t.has(n))return t.get(n);let r=e(n);return t.set(n,r),r}}const ne=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},re=new WeakSet;function ie(e){return typeof e==`string`}function ae(e){return typeof e==`number`}function oe(e){return typeof e==`boolean`}function se(e){return typeof e==`function`}function ce(e){return e!=null}function le(e){return typeof e==`object`&&!!e||se(e)}const h=d(2,(e,t)=>le(e)&&t in e);function ue(e){return h(e,Symbol.iterator)||ie(e)}const g=`~effect/interfaces/Hash`,_=e=>{switch(typeof e){case`number`:return me(e);case`bigint`:return y(e.toString(10));case`boolean`:return y(String(e));case`symbol`:return y(String(e));case`string`:return y(e);case`undefined`:return y(`undefined`);case`function`:case`object`:if(e===null)return y(`null`);if(e instanceof Date)return y(e.toISOString());if(e instanceof RegExp)return y(e.toString());{if(re.has(e))return de(e);if(Se.has(e))return Se.get(e);let t=we(e,()=>pe(e)?e[g]():typeof e==`function`?de(e):Array.isArray(e)||ArrayBuffer.isView(e)?ve(e):e instanceof Map?ye(e):e instanceof Set?be(e):ge(e));return Se.set(e,t),t}default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},de=e=>(xe.has(e)||xe.set(e,me(Math.floor(Math.random()*(2**53-1)))),xe.get(e)),v=d(2,(e,t)=>e*53^t),fe=e=>e&3221225471|e>>>1&1073741824,pe=e=>h(e,g),me=e=>{if(e!==e)return y(`NaN`);if(e===1/0)return y(`Infinity`);if(e===-1/0)return y(`-Infinity`);let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return fe(t)},y=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return fe(t)},he=(e,t)=>{let n=12289;for(let r of t)n^=v(_(r),_(e[r]));return fe(n)},ge=e=>he(e,ne(e)),_e=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return fe(r)},ve=_e(6151,_),ye=_e(y(`Map`),([e,t])=>v(_(e),_(t))),be=_e(y(`Set`),_),xe=new WeakMap,Se=new WeakMap,Ce=new WeakSet;function we(e,t){if(Ce.has(e))return y(`[Circular]`);Ce.add(e);let n=t();return Ce.delete(e),n}const b=`~effect/interfaces/Equal`;function x(){return arguments.length===1?e=>Te(e,arguments[0]):Te(arguments[0],arguments[1])}function Te(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`||re.has(e)||re.has(t)?!1:Ae(e,t,ke):!1}function Ee(e,t,n){let r=De.has(e),i=Oe.has(t);if(r&&i)return!0;if(r||i)return!1;De.add(e),Oe.add(t);let a=n();return De.delete(e),Oe.delete(t),a}const De=new WeakSet,Oe=new WeakSet;function ke(e,t){if(_(e)!==_(t))return!1;if(e instanceof Date)return t instanceof Date?e.toISOString()===t.toISOString():!1;if(e instanceof RegExp)return t instanceof RegExp?e.toString()===t.toString():!1;let n=ze(e),r=ze(t);if(n!==r)return!1;let i=n&&r;return typeof e==`function`&&!i?!1:Ee(e,t,()=>i?e[b](t):Array.isArray(e)?!Array.isArray(t)||e.length!==t.length?!1:Me(e,t):ArrayBuffer.isView(e)?!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength?!1:Ne(e,t):e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:Ie(e,t):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:Re(e,t):Pe(e,t))}function Ae(e,t,n){let r=je.get(e);if(!r)r=new WeakMap,je.set(e,r);else if(r.has(t))return r.get(t);let i=n(e,t);r.set(t,i);let a=je.get(t);return a||(a=new WeakMap,je.set(t,a)),a.set(e,i),i}const je=new WeakMap;function Me(e,t){for(let n=0;n<e.length;n++)if(!Te(e[n],t[n]))return!1;return!0}function Ne(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 Pe(e,t){let n=ne(e),r=ne(t);if(n.size!==r.size)return!1;for(let i of n)if(!r.has(i)||!Te(e[i],t[i]))return!1;return!0}function Fe(e,t){return function(n,r){for(let[i,a]of n){let n=!1;for(let[o,s]of r)if(e(i,o)&&t(a,s)){n=!0;break}if(!n)return!1}return!0}}const Ie=Fe(Te,Te);function Le(e){return function(t,n){for(let r of t){let t=!1;for(let i of n)if(e(r,i)){t=!0;break}if(!t)return!1}return!0}}const Re=Le(Te),ze=e=>h(e,b),Be=()=>x,Ve=Symbol.for(`~effect/Redactable`),He=e=>h(e,Ve);function Ue(e){return He(e)?We(e):e}function We(e){return e[Ve](globalThis[`~effect/Fiber/currentFiber`]?.context??Ke)}const Ge=`~effect/Fiber/currentFiber`,Ke={"~effect/Context":{},mapUnsafe:new Map,pipe(){return c(this,arguments)}};function S(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,n=0){if(Array.isArray(e)){if(r.has(e))return qe;if(r.add(e),!i||e.length<=1)return`[${e.map(e=>c(e,n)).join(`,`)}]`;let t=e.map(e=>c(e,n+1)).join(`,
3
- `+a(n+1));return`[\n${a(n+1)}${t}\n${a(n)}]`}if(e instanceof Date)return Xe(e);if(!t?.ignoreToString&&h(e,`toString`)&&typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=Ze(e);return e instanceof Error&&e.cause?`${t} (cause: ${c(e.cause,n)})`:t}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 qe;if(r.add(e),Ve in e)return S(We(e));if(Symbol.iterator in e)return`${e.constructor.name}(${c(Array.from(e),n)})`;let t=s(e);return!i||t.length<=1?o(e,`{${t.map(t=>`${Je(t)}:${c(e[t],n)}`).join(`,`)}}`):o(e,`{\n${t.map(t=>`${a(n+1)}${Je(t)}: ${c(e[t],n+1)}`).join(`,
4
- `)}\n${a(n)}}`)}return String(e)}return c(e,0)}const qe=`[Circular]`;function Je(e){return typeof e==`string`?JSON.stringify(e):String(e)}function Ye(e){return e.map(e=>`[${Je(e)}]`).join(``)}function Xe(e){try{return e.toISOString()}catch{return`Invalid Date`}}function Ze(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}const Qe=Symbol.for(`nodejs.util.inspect.custom`),$e=e=>{try{if(h(e,`toJSON`)&&se(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map($e)}catch{return`[toJSON threw]`}return Ue(e)};var et=class e{called=!1;self;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new e(this.self)}};const tt=`~effect/Utils/internal`,nt={[tt]:e=>e()},rt={[tt]:e=>{try{return e()}finally{}}},C=nt[tt](()=>Error().stack)?.includes(tt)===!0?nt[tt]:rt[tt],it=`~effect/Effect`,at=`~effect/Exit`,ot={_A:f,_E:f,_R:f},st=`${it}/identifier`,w=`${it}/args`,T=`${it}/evaluate`,E=`${it}/successCont`,ct=`${it}/failureCont`,lt=`${it}/ensureCont`,ut=Symbol.for(`effect/Effect/Yield`),dt={pipe(){return c(this,arguments)},toJSON(){return{...this}},toString(){return S(this.toJSON(),{ignoreToString:!0,space:2})},[Qe](){return this.toJSON()}},ft={[it]:ot,...dt,[Symbol.iterator](){return new et(this)},toJSON(){return{_id:`Effect`,op:this[st],...w in this?{args:this[w]}:void 0}}},pt=e=>h(e,at),mt=`~effect/Cause`,ht=`~effect/Cause/Reason`,gt=e=>h(e,mt);var _t=class{[mt];reasons;constructor(e){this[mt]=mt,this.reasons=e}pipe(){return c(this,arguments)}toJSON(){return{_id:`Cause`,failures:this.reasons.map(e=>e.toJSON())}}toString(){return`Cause(${S(this.reasons)})`}[Qe](){return this.toJSON()}[b](e){return gt(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>x(t,e.reasons[n]))}[g](){return ve(this.reasons)}};const vt=new WeakMap;var yt=class{[ht];annotations;_tag;constructor(e,t,n){if(this[ht]=ht,this._tag=e,t!==bt&&typeof n==`object`&&n&&t.size>0){let e=vt.get(n);e&&(t=new Map([...e,...t])),vt.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 c(this,arguments)}toString(){return S(this)}[Qe](){return this.toString()}};const bt=new Map;var xt=class extends yt{error;constructor(e,t=bt){super(`Fail`,t,e),this.error=e}toString(){return`Fail(${S(this.error)})`}toJSON(){return{_tag:`Fail`,error:this.error}}[b](e){return Dt(e)&&x(this.error,e.error)&&x(this.annotations,e.annotations)}[g](){return v(y(this._tag))(v(_(this.error))(_(this.annotations)))}};const St=e=>new _t(e),Ct=e=>new _t([new xt(e)]);var wt=class extends yt{defect;constructor(e,t=bt){super(`Die`,t,e),this.defect=e}toString(){return`Die(${S(this.defect)})`}toJSON(){return{_tag:`Die`,defect:this.defect}}[b](e){return Ot(e)&&x(this.defect,e.defect)&&x(this.annotations,e.annotations)}[g](){return v(y(this._tag))(v(_(this.defect))(_(this.annotations)))}};const Tt=e=>new _t([new wt(e)]),Et=d(e=>gt(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new _t(e.reasons.map(e=>e.annotate(t,n)))),Dt=e=>e._tag===`Fail`,Ot=e=>e._tag===`Die`,kt=e=>e._tag===`Interrupt`;function At(e){return It(`Effect.evaluate: Not implemented`)}const jt=e=>({...ft,[st]:e.op,[T]:e[T]??At,[E]:e[E],[ct]:e[ct],[lt]:e[lt]}),D=e=>{let t=jt(e);return function(){let n=Object.create(t);return n[w]=e.single===!1?arguments:arguments[0],n}},Mt=e=>{let t={...jt(e),[at]:at,_tag:e.op,get[e.prop](){return this[w]},toString(){return`${e.op}(${S(this[w])})`},toJSON(){return{_id:`Exit`,_tag:e.op,[e.prop]:this[w]}},[b](e){return pt(e)&&e._tag===this._tag&&x(this[w],e[w])},[g](){return v(y(e.op),_(this[w]))}};return function(e){let n=Object.create(t);return n[w]=e,n}},O=Mt({op:`Success`,prop:`value`,[T](e){let t=e.getCont(E);return t?t[E](this[w],e,this):e.yieldWith(this)}}),Nt={key:`effect/Cause/StackTrace`},Pt=Mt({op:`Failure`,prop:`cause`,[T](e){let t=this[w],n=!1;e.currentStackFrame&&(t=Et(t,{mapUnsafe:new Map([[Nt.key,e.currentStackFrame]])}),n=!0);let r=e.getCont(ct);for(;e.interruptible&&e._interruptedCause&&r;)r=e.getCont(ct);return r?r[ct](t,e,n?void 0:this):e.yieldWith(n?this:Pt(t))}}),Ft=e=>Pt(Ct(e)),It=e=>Pt(Tt(e)),Lt=D({op:`WithFiber`,[T](e){return this[w](e)}}),Rt=function(){class e extends globalThis.Error{}let t=jt({op:`YieldableError`,[T](){return Ft(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),zt=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return class extends Rt{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(Object.assign(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}(),Bt=e=>{class t extends zt{_tag=e}return t.prototype.name=e,t};Bt(`NoSuchElementError`);const Vt=e=>jt({op:e.label,[T]:e.evaluate}),Ht=e=>(t,n)=>t===n||e(t,n),Ut=`~effect/data/Option`,Wt={[Ut]:{_A:e=>e},...dt,[Symbol.iterator](){return new et(this)}},Gt=Object.assign(Object.create(Wt),{_tag:`Some`,_op:`Some`,[b](e){return Jt(e)&&Xt(e)&&x(this.value,e.value)},[g](){return v(_(this._tag))(_(this.value))},toString(){return`some(${S(this.value)})`},toJSON(){return{_id:`Option`,_tag:this._tag,value:$e(this.value)}}});Object.defineProperty(Gt,"valueOrUndefined",{get(){return this.value}});const Kt=_(`None`),qt=Object.assign(Object.create(Wt),{_tag:`None`,_op:`None`,valueOrUndefined:void 0,[b](e){return Jt(e)&&Yt(e)},[g](){return Kt},toString(){return`none()`},toJSON(){return{_id:`Option`,_tag:this._tag}}}),Jt=e=>h(e,Ut),Yt=e=>e._tag===`None`,Xt=e=>e._tag===`Some`,Zt=Object.create(qt),Qt=e=>{let t=Object.create(Gt);return t.value=e,t},$t=`~effect/data/Result`,en={[$t]:{_A:e=>e,_E:e=>e},...dt,[Symbol.iterator](){return new et(this)}},tn=Object.assign(Object.create(en),{_tag:`Success`,_op:`Success`,[b](e){return rn(e)&&on(e)&&x(this.success,e.success)},[g](){return v(_(this._tag))(_(this.success))},toString(){return`success(${S(this.success)})`},toJSON(){return{_id:`Result`,_tag:this._tag,value:$e(this.success)}}}),nn=Object.assign(Object.create(en),{_tag:`Failure`,_op:`Failure`,[b](e){return rn(e)&&an(e)&&x(this.failure,e.failure)},[g](){return v(_(this._tag))(_(this.failure))},toString(){return`failure(${S(this.failure)})`},toJSON(){return{_id:`Result`,_tag:this._tag,failure:$e(this.failure)}}}),rn=e=>h(e,$t),an=e=>e._tag===`Failure`,on=e=>e._tag===`Success`,sn=e=>{let t=Object.create(nn);return t.failure=e,t},cn=e=>{let t=Object.create(tn);return t.success=e,t},ln=()=>Zt,k=Qt,un=Yt,dn=Xt,fn=d(2,(e,t)=>un(e)?ln():k(t(e.value))),pn=`~effect/Context/Service`,mn=function(){let e=Error.stackTraceLimit;Error.stackTraceLimit=2;let t=Error();Error.stackTraceLimit=e;function n(){}let r=n;return Object.setPrototypeOf(r,hn),Object.defineProperty(r,"stack",{get(){return t.stack}}),arguments.length>0?(r.key=arguments[0],arguments[1]?.defaultValue&&(r[gn]=gn,r.defaultValue=arguments[1].defaultValue),r):function(e,t){return r.key=e,t?.make&&(r.make=t.make),r}},hn={[pn]:pn,...Vt({label:`Service`,evaluate(e){return O(Tn(e.context,this))}}),toJSON(){return{_id:`Service`,key:this.key,stack:this.stack}},of(e){return e},context(e){return Cn(this,e)},use(e){return Lt(t=>e(Tn(t.context,this)))},useSync(e){return Lt(t=>O(e(Tn(t.context,this))))}},gn=`~effect/Context/Reference`,_n=`~effect/Context`,vn=e=>{let t=Object.create(yn);return t.mapUnsafe=e,t.mutable=!1,t},yn={...dt,[_n]:{_Services:e=>e},toJSON(){return{_id:`Context`,services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[b](e){if(!bn(e)||this.mapUnsafe.size!==e.mapUnsafe.size)return!1;for(let t of this.mapUnsafe.keys())if(!e.mapUnsafe.has(t)||!x(this.mapUnsafe.get(t),e.mapUnsafe.get(t)))return!1;return!0},[g](){return me(this.mapUnsafe.size)}},bn=e=>h(e,_n),xn=()=>Sn,Sn=vn(new Map),Cn=(e,t)=>vn(new Map([[e.key,t]])),wn=d(3,(e,t,n)=>An(e,e=>{e.set(t.key,n)})),Tn=d(2,(e,t)=>{if(!e.mapUnsafe.has(t.key)){if(gn in t)return On(t);throw kn(t)}return e.mapUnsafe.get(t.key)}),En=(e,t)=>e.mapUnsafe.has(t.key)?e.mapUnsafe.get(t.key):On(t),Dn=`~effect/Context/defaultValue`,On=e=>Dn in e?e[Dn]:e[Dn]=e.defaultValue(),kn=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(e.stack){let n=e.stack.split(`
2
+ import{Command as e}from"commander";import{setTimeout as t}from"node:timers/promises";import{intro as n,log as r,note as i,outro as a,spinner as o}from"@clack/prompts";import s from"picocolors";import{readFile as c,readdir as l,writeFile as u}from"node:fs/promises";import{existsSync as d,lstatSync as f,readFileSync as p}from"node:fs";import{join as m,relative as ee,resolve as te}from"node:path";const ne=(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}}},re={pipe(){return ne(this,arguments)}},ie=function(){function e(){}return e.prototype=re,e}(),h=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)}}}},ae=e=>e,oe=(e=>()=>e)(void 0),se=oe;function ce(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 le(e){let t=new WeakMap;return n=>{if(t.has(n))return t.get(n);let r=e(n);return t.set(n,r),r}}const ue=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},de=new WeakSet;function fe(e){return typeof e==`string`}function pe(e){return typeof e==`number`}function me(e){return typeof e==`boolean`}function he(e){return typeof e==`function`}function ge(e){return e!=null}function _e(e){return typeof e==`object`&&!!e||he(e)}const g=h(2,(e,t)=>_e(e)&&t in e);function ve(e){return g(e,Symbol.iterator)||fe(e)}const _=`~effect/interfaces/Hash`,v=e=>{switch(typeof e){case`number`:return Se(e);case`bigint`:return b(e.toString(10));case`boolean`:return b(String(e));case`symbol`:return b(String(e));case`string`:return b(e);case`undefined`:return b(`undefined`);case`function`:case`object`:if(e===null)return b(`null`);if(e instanceof Date)return b(e.toISOString());if(e instanceof RegExp)return b(e.toString());{if(de.has(e))return ye(e);if(Ae.has(e))return Ae.get(e);let t=Me(e,()=>xe(e)?e[_]():typeof e==`function`?ye(e):Array.isArray(e)||ArrayBuffer.isView(e)?Ee(e):e instanceof Map?De(e):e instanceof Set?Oe(e):we(e));return Ae.set(e,t),t}default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},ye=e=>(ke.has(e)||ke.set(e,Se(Math.floor(Math.random()*(2**53-1)))),ke.get(e)),y=h(2,(e,t)=>e*53^t),be=e=>e&3221225471|e>>>1&1073741824,xe=e=>g(e,_),Se=e=>{if(e!==e)return b(`NaN`);if(e===1/0)return b(`Infinity`);if(e===-1/0)return b(`-Infinity`);let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return be(t)},b=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return be(t)},Ce=(e,t)=>{let n=12289;for(let r of t)n^=y(v(r),v(e[r]));return be(n)},we=e=>Ce(e,ue(e)),Te=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return be(r)},Ee=Te(6151,v),De=Te(b(`Map`),([e,t])=>y(v(e),v(t))),Oe=Te(b(`Set`),v),ke=new WeakMap,Ae=new WeakMap,je=new WeakSet;function Me(e,t){if(je.has(e))return b(`[Circular]`);je.add(e);let n=t();return je.delete(e),n}const x=`~effect/interfaces/Equal`;function S(){return arguments.length===1?e=>Ne(e,arguments[0]):Ne(arguments[0],arguments[1])}function Ne(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`||de.has(e)||de.has(t)?!1:Re(e,t,Le):!1}function Pe(e,t,n){let r=Fe.has(e),i=Ie.has(t);if(r&&i)return!0;if(r||i)return!1;Fe.add(e),Ie.add(t);let a=n();return Fe.delete(e),Ie.delete(t),a}const Fe=new WeakSet,Ie=new WeakSet;function Le(e,t){if(v(e)!==v(t))return!1;if(e instanceof Date)return t instanceof Date?e.toISOString()===t.toISOString():!1;if(e instanceof RegExp)return t instanceof RegExp?e.toString()===t.toString():!1;let n=qe(e),r=qe(t);if(n!==r)return!1;let i=n&&r;return typeof e==`function`&&!i?!1:Pe(e,t,()=>i?e[x](t):Array.isArray(e)?!Array.isArray(t)||e.length!==t.length?!1:Be(e,t):ArrayBuffer.isView(e)?!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength?!1:Ve(e,t):e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:We(e,t):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:Ke(e,t):He(e,t))}function Re(e,t,n){let r=ze.get(e);if(!r)r=new WeakMap,ze.set(e,r);else if(r.has(t))return r.get(t);let i=n(e,t);r.set(t,i);let a=ze.get(t);return a||(a=new WeakMap,ze.set(t,a)),a.set(e,i),i}const ze=new WeakMap;function Be(e,t){for(let n=0;n<e.length;n++)if(!Ne(e[n],t[n]))return!1;return!0}function Ve(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 He(e,t){let n=ue(e),r=ue(t);if(n.size!==r.size)return!1;for(let i of n)if(!r.has(i)||!Ne(e[i],t[i]))return!1;return!0}function Ue(e,t){return function(n,r){for(let[i,a]of n){let n=!1;for(let[o,s]of r)if(e(i,o)&&t(a,s)){n=!0;break}if(!n)return!1}return!0}}const We=Ue(Ne,Ne);function Ge(e){return function(t,n){for(let r of t){let t=!1;for(let i of n)if(e(r,i)){t=!0;break}if(!t)return!1}return!0}}const Ke=Ge(Ne),qe=e=>g(e,x),Je=()=>S,Ye=Symbol.for(`~effect/Redactable`),Xe=e=>g(e,Ye);function Ze(e){return Xe(e)?Qe(e):e}function Qe(e){return e[Ye](globalThis[`~effect/Fiber/currentFiber`]?.context??et)}const $e=`~effect/Fiber/currentFiber`,et={"~effect/Context":{},mapUnsafe:new Map,pipe(){return ne(this,arguments)}};function C(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,n=0){if(Array.isArray(e)){if(r.has(e))return tt;if(r.add(e),!i||e.length<=1)return`[${e.map(e=>c(e,n)).join(`,`)}]`;let t=e.map(e=>c(e,n+1)).join(`,
3
+ `+a(n+1));return`[\n${a(n+1)}${t}\n${a(n)}]`}if(e instanceof Date)return it(e);if(!t?.ignoreToString&&g(e,`toString`)&&typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=at(e);return e instanceof Error&&e.cause?`${t} (cause: ${c(e.cause,n)})`:t}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 tt;if(r.add(e),Ye in e)return C(Qe(e));if(Symbol.iterator in e)return`${e.constructor.name}(${c(Array.from(e),n)})`;let t=s(e);return!i||t.length<=1?o(e,`{${t.map(t=>`${nt(t)}:${c(e[t],n)}`).join(`,`)}}`):o(e,`{\n${t.map(t=>`${a(n+1)}${nt(t)}: ${c(e[t],n+1)}`).join(`,
4
+ `)}\n${a(n)}}`)}return String(e)}return c(e,0)}const tt=`[Circular]`;function nt(e){return typeof e==`string`?JSON.stringify(e):String(e)}function rt(e){return e.map(e=>`[${nt(e)}]`).join(``)}function it(e){try{return e.toISOString()}catch{return`Invalid Date`}}function at(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}const ot=Symbol.for(`nodejs.util.inspect.custom`),st=e=>{try{if(g(e,`toJSON`)&&he(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(st)}catch{return`[toJSON threw]`}return Ze(e)};var ct=class e{called=!1;self;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new e(this.self)}};const lt=`~effect/Utils/internal`,ut={[lt]:e=>e()},dt={[lt]:e=>{try{return e()}finally{}}},ft=ut[lt](()=>Error().stack)?.includes(lt)===!0?ut[lt]:dt[lt],pt=`~effect/Effect`,mt=`~effect/Exit`,ht={_A:ae,_E:ae,_R:ae},gt=`${pt}/identifier`,w=`${pt}/args`,T=`${pt}/evaluate`,E=`${pt}/successCont`,_t=`${pt}/failureCont`,vt=`${pt}/ensureCont`,yt=Symbol.for(`effect/Effect/Yield`),bt={pipe(){return ne(this,arguments)},toJSON(){return{...this}},toString(){return C(this.toJSON(),{ignoreToString:!0,space:2})},[ot](){return this.toJSON()}},xt={[pt]:ht,...bt,[Symbol.iterator](){return new ct(this)},toJSON(){return{_id:`Effect`,op:this[gt],...w in this?{args:this[w]}:void 0}}},St=e=>g(e,mt),Ct=`~effect/Cause`,wt=`~effect/Cause/Reason`,Tt=e=>g(e,Ct);var Et=class{[Ct];reasons;constructor(e){this[Ct]=Ct,this.reasons=e}pipe(){return ne(this,arguments)}toJSON(){return{_id:`Cause`,failures:this.reasons.map(e=>e.toJSON())}}toString(){return`Cause(${C(this.reasons)})`}[ot](){return this.toJSON()}[x](e){return Tt(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>S(t,e.reasons[n]))}[_](){return Ee(this.reasons)}};const Dt=new WeakMap;var Ot=class{[wt];annotations;_tag;constructor(e,t,n){if(this[wt]=wt,this._tag=e,t!==kt&&typeof n==`object`&&n&&t.size>0){let e=Dt.get(n);e&&(t=new Map([...e,...t])),Dt.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 ne(this,arguments)}toString(){return C(this)}[ot](){return this.toString()}};const kt=new Map;var At=class extends Ot{error;constructor(e,t=kt){super(`Fail`,t,e),this.error=e}toString(){return`Fail(${C(this.error)})`}toJSON(){return{_tag:`Fail`,error:this.error}}[x](e){return It(e)&&S(this.error,e.error)&&S(this.annotations,e.annotations)}[_](){return y(b(this._tag))(y(v(this.error))(v(this.annotations)))}};const jt=e=>new Et(e),Mt=e=>new Et([new At(e)]);var Nt=class extends Ot{defect;constructor(e,t=kt){super(`Die`,t,e),this.defect=e}toString(){return`Die(${C(this.defect)})`}toJSON(){return{_tag:`Die`,defect:this.defect}}[x](e){return Lt(e)&&S(this.defect,e.defect)&&S(this.annotations,e.annotations)}[_](){return y(b(this._tag))(y(v(this.defect))(v(this.annotations)))}};const Pt=e=>new Et([new Nt(e)]),Ft=h(e=>Tt(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new Et(e.reasons.map(e=>e.annotate(t,n)))),It=e=>e._tag===`Fail`,Lt=e=>e._tag===`Die`,Rt=e=>e._tag===`Interrupt`;function zt(e){return Gt(`Effect.evaluate: Not implemented`)}const Bt=e=>({...xt,[gt]:e.op,[T]:e[T]??zt,[E]:e[E],[_t]:e[_t],[vt]:e[vt]}),D=e=>{let t=Bt(e);return function(){let n=Object.create(t);return n[w]=e.single===!1?arguments:arguments[0],n}},Vt=e=>{let t={...Bt(e),[mt]:mt,_tag:e.op,get[e.prop](){return this[w]},toString(){return`${e.op}(${C(this[w])})`},toJSON(){return{_id:`Exit`,_tag:e.op,[e.prop]:this[w]}},[x](e){return St(e)&&e._tag===this._tag&&S(this[w],e[w])},[_](){return y(b(e.op),v(this[w]))}};return function(e){let n=Object.create(t);return n[w]=e,n}},O=Vt({op:`Success`,prop:`value`,[T](e){let t=e.getCont(E);return t?t[E](this[w],e,this):e.yieldWith(this)}}),Ht={key:`effect/Cause/StackTrace`},Ut=Vt({op:`Failure`,prop:`cause`,[T](e){let t=this[w],n=!1;e.currentStackFrame&&(t=Ft(t,{mapUnsafe:new Map([[Ht.key,e.currentStackFrame]])}),n=!0);let r=e.getCont(_t);for(;e.interruptible&&e._interruptedCause&&r;)r=e.getCont(_t);return r?r[_t](t,e,n?void 0:this):e.yieldWith(n?this:Ut(t))}}),Wt=e=>Ut(Mt(e)),Gt=e=>Ut(Pt(e)),Kt=D({op:`WithFiber`,[T](e){return this[w](e)}}),qt=function(){class e extends globalThis.Error{}let t=Bt({op:`YieldableError`,[T](){return Wt(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),Jt=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return class extends qt{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(Object.assign(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}(),Yt=e=>{class t extends Jt{_tag=e}return t.prototype.name=e,t};Yt(`NoSuchElementError`);const Xt=e=>Bt({op:e.label,[T]:e.evaluate}),Zt=e=>(t,n)=>t===n||e(t,n),Qt=`~effect/data/Option`,$t={[Qt]:{_A:e=>e},...bt,[Symbol.iterator](){return new ct(this)}},en=Object.assign(Object.create($t),{_tag:`Some`,_op:`Some`,[x](e){return rn(e)&&on(e)&&S(this.value,e.value)},[_](){return y(v(this._tag))(v(this.value))},toString(){return`some(${C(this.value)})`},toJSON(){return{_id:`Option`,_tag:this._tag,value:st(this.value)}}});Object.defineProperty(en,"valueOrUndefined",{get(){return this.value}});const tn=v(`None`),nn=Object.assign(Object.create($t),{_tag:`None`,_op:`None`,valueOrUndefined:void 0,[x](e){return rn(e)&&an(e)},[_](){return tn},toString(){return`none()`},toJSON(){return{_id:`Option`,_tag:this._tag}}}),rn=e=>g(e,Qt),an=e=>e._tag===`None`,on=e=>e._tag===`Some`,sn=Object.create(nn),cn=e=>{let t=Object.create(en);return t.value=e,t},ln=`~effect/data/Result`,un={[ln]:{_A:e=>e,_E:e=>e},...bt,[Symbol.iterator](){return new ct(this)}},dn=Object.assign(Object.create(un),{_tag:`Success`,_op:`Success`,[x](e){return pn(e)&&hn(e)&&S(this.success,e.success)},[_](){return y(v(this._tag))(v(this.success))},toString(){return`success(${C(this.success)})`},toJSON(){return{_id:`Result`,_tag:this._tag,value:st(this.success)}}}),fn=Object.assign(Object.create(un),{_tag:`Failure`,_op:`Failure`,[x](e){return pn(e)&&mn(e)&&S(this.failure,e.failure)},[_](){return y(v(this._tag))(v(this.failure))},toString(){return`failure(${C(this.failure)})`},toJSON(){return{_id:`Result`,_tag:this._tag,failure:st(this.failure)}}}),pn=e=>g(e,ln),mn=e=>e._tag===`Failure`,hn=e=>e._tag===`Success`,gn=e=>{let t=Object.create(fn);return t.failure=e,t},_n=e=>{let t=Object.create(dn);return t.success=e,t},vn=()=>sn,k=cn,yn=an,bn=on,xn=h(2,(e,t)=>yn(e)?vn():k(t(e.value))),Sn=`~effect/Context/Service`,Cn=function(){let e=Error.stackTraceLimit;Error.stackTraceLimit=2;let t=Error();Error.stackTraceLimit=e;function n(){}let r=n;return Object.setPrototypeOf(r,wn),Object.defineProperty(r,"stack",{get(){return t.stack}}),arguments.length>0?(r.key=arguments[0],arguments[1]?.defaultValue&&(r[Tn]=Tn,r.defaultValue=arguments[1].defaultValue),r):function(e,t){return r.key=e,t?.make&&(r.make=t.make),r}},wn={[Sn]:Sn,...Xt({label:`Service`,evaluate(e){return O(Pn(e.context,this))}}),toJSON(){return{_id:`Service`,key:this.key,stack:this.stack}},of(e){return e},context(e){return Mn(this,e)},use(e){return Kt(t=>e(Pn(t.context,this)))},useSync(e){return Kt(t=>O(e(Pn(t.context,this))))}},Tn=`~effect/Context/Reference`,En=`~effect/Context`,Dn=e=>{let t=Object.create(On);return t.mapUnsafe=e,t.mutable=!1,t},On={...bt,[En]:{_Services:e=>e},toJSON(){return{_id:`Context`,services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[x](e){if(!kn(e)||this.mapUnsafe.size!==e.mapUnsafe.size)return!1;for(let t of this.mapUnsafe.keys())if(!e.mapUnsafe.has(t)||!S(this.mapUnsafe.get(t),e.mapUnsafe.get(t)))return!1;return!0},[_](){return Se(this.mapUnsafe.size)}},kn=e=>g(e,En),An=()=>jn,jn=Dn(new Map),Mn=(e,t)=>Dn(new Map([[e.key,t]])),Nn=h(3,(e,t,n)=>zn(e,e=>{e.set(t.key,n)})),Pn=h(2,(e,t)=>{if(!e.mapUnsafe.has(t.key)){if(Tn in t)return Ln(t);throw Rn(t)}return e.mapUnsafe.get(t.key)}),Fn=(e,t)=>e.mapUnsafe.has(t.key)?e.mapUnsafe.get(t.key):Ln(t),In=`~effect/Context/defaultValue`,Ln=e=>In in e?e[In]:e[In]=e.defaultValue(),Rn=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(e.stack){let n=e.stack.split(`
5
5
  `);if(n.length>2){let e=n[2].match(/at (.*)/);e&&(t.message+=` (defined at ${e[1]})`)}}if(t.stack){let e=t.stack.split(`
6
6
  `);e.splice(1,3),t.stack=e.join(`
7
- `)}return t},An=(e,t)=>{if(e.mutable)return t(e.mapUnsafe),e;let n=new Map(e.mapUnsafe);return t(n),vn(n)},jn=mn,Mn=e=>e.length>0,Nn=cn,Pn=sn,Fn=an,In=globalThis.Array,Ln=e=>In.isArray(e)?e:In.from(e),Rn=d(2,(e,t)=>[...e,t]),zn=d(2,(e,t)=>Ln(e).concat(Ln(t)));In.isArray;const Bn=Mn,Vn=Mn;function Hn(e,t){return e<0||e>=t.length}const Un=d(2,(e,t)=>{let n=Math.floor(t);if(Hn(n,e))throw Error(`Index out of bounds: ${n}`);return e[n]})(0),Wn=e=>e.slice(1),Gn=d(3,(e,t,n)=>{let r=Ln(e),i=Ln(t);return Vn(r)?Vn(i)?Yn(n)(zn(r,i)):r:i}),Kn=d(2,(e,t)=>Gn(e,t,Be())),qn=()=>[],Jn=d(2,(e,t)=>e.map(t)),Yn=d(2,(e,t)=>{let n=Ln(e);if(Vn(n)){let e=[Un(n)],r=Wn(n);for(let n of r)e.every(e=>!t(n,e))&&e.push(n);return e}return[]}),Xn=jn(`effect/Scheduler`,{defaultValue:()=>new $n}),Zn=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)};var Qn=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}},$n=class{executionMode;setImmediate;constructor(e=`async`,t=Zn){this.executionMode=e,this.setImmediate=t}shouldYield(e){return e.currentOpCount>=e.maxOpsBeforeYield}makeDispatcher(){return new er(this.setImmediate)}},er=class{tasks=new Qn;running=void 0;setImmediate;constructor(e=Zn){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()}};const tr=jn(`effect/Scheduler/MaxOpsBeforeYield`,{defaultValue:()=>2048}),nr=jn(`effect/Scheduler/PreventSchedulerYield`,{defaultValue:()=>!1}),rr=`effect/Tracer/ParentSpan`;mn()(rr);const ir=jn(`effect/References/CurrentConcurrency`,{defaultValue:()=>`unbounded`}),ar=jn(`effect/References/CurrentStackFrame`,{defaultValue:p}),or=jn(`effect/References/CurrentLogLevel`,{defaultValue:()=>`Info`}),sr=jn(`effect/References/MinimumLogLevel`,{defaultValue:()=>`Info`});var cr=class extends yt{fiberId;constructor(e,t=bt){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[b](e){return kt(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[g](){return v(y(`${this._tag}:${this.fiberId}`))(de(this.annotations))}};const lr=e=>new _t([new cr(e)]),ur=e=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag===`Fail`)return Nn(n.error)}return Pn(e)},dr=e=>e.reasons.some(kt),fr=d(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new _t(Kn(e.reasons,t.reasons));return x(e,n)?e:n}),pr=e=>{let t={Fail:[],Die:[],Interrupt:[]};for(let n=0;n<e.reasons.length;n++)t[e.reasons[n]._tag].push(e.reasons[n]);return t},mr=e=>{let t=pr(e);return t.Fail.length>0?t.Fail[0].error:t.Die.length>0?t.Die[0].defect:t.Interrupt.length>0?new globalThis.Error(`All fibers interrupted without error`):new globalThis.Error(`Empty cause`)},hr=`~effect/Fiber/dev`,gr={_A:f,_E:f},_r={id:0},vr=()=>globalThis[Ge];var yr=class{constructor(e,t=!0){this[hr]=gr,this.setContext(e),this.id=++_r.id,this.currentOpCount=0,this.currentLoopCount=0,this.interruptible=t,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this.runtimeMetrics?.recordFiberStart(this.context)}[hr];id;interruptible;currentOpCount;currentLoopCount;_stack;_observers;_exit;_currentExit;_children;_interruptedCause;_yielded;context;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;currentPreventYield;_dispatcher=void 0;get currentDispatcher(){return this._dispatcher??=this.currentScheduler.makeDispatcher()}getRef(e){return En(this.context,e)}addObserver(e){return this._exit?(e(this._exit),ee):(this._observers.push(e),()=>{let t=this._observers.indexOf(e);t>=0&&this._observers.splice(t,1)})}interruptUnsafe(e,t){if(this._exit)return;let n=lr(e);this.currentStackFrame&&(n=Et(n,Cn(Nt,this.currentStackFrame))),t&&(n=Et(n,t)),this._interruptedCause=this._interruptedCause?fr(this._interruptedCause,n):n,this.interruptible&&this.evaluate(wr(this._interruptedCause))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;if(this._yielded!==void 0){let e=this._yielded;this._yielded=void 0,e()}let t=this.runLoop(e);if(t===ut)return;let n=br.interruptChildren&&br.interruptChildren(this);if(n!==void 0)return this.evaluate(j(n,()=>t));this._exit=t,this.runtimeMetrics?.recordFiberEnd(this.context,this._exit);for(let e=0;e<this._observers.length;e++)this._observers[e](t);this._observers.length=0}runLoop(e){let t=globalThis[Ge];globalThis[Ge]=this;let n=!1,r=e;this.currentOpCount=0;let i=++this.currentLoopCount;try{for(;;){if(this.currentOpCount++,!n&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){n=!0;let e=r;r=j(Or,()=>e)}if(r=this.currentTracerContext?this.currentTracerContext(r,this):r[T](this),i!==this.currentLoopCount)return ut;if(r===ut){let e=this._yielded;return at in e?(this._yielded=void 0,e):ut}}}catch(e){return h(r,T)?this.runLoop(It(e)):It(`Fiber.runLoop: Not a valid effect: ${String(r)}`)}finally{globalThis[Ge]=t}}getCont(e){for(;;){let t=this._stack.pop();if(!t)return;let n=t[lt]&&t[lt](this);if(n)return n[e]=n,n;if(t[e])return t}}yieldWith(e){return this._yielded=e,ut}children(){return this._children??=new Set}pipe(){return c(this,arguments)}setContext(e){this.context=e;let t=this.getRef(Xn);t!==this.currentScheduler&&(this.currentScheduler=t,this._dispatcher=void 0),this.currentSpan=e.mapUnsafe.get(rr),this.currentLogLevel=this.getRef(or),this.minimumLogLevel=this.getRef(sr),this.currentStackFrame=e.mapUnsafe.get(ar.key),this.maxOpsBeforeYield=this.getRef(tr),this.currentPreventYield=this.getRef(nr),this.runtimeMetrics=e.mapUnsafe.get(`effect/observability/Metric/FiberRuntimeMetricsKey`);let n=e.mapUnsafe.get(`effect/Tracer`);this.currentTracerContext=n?n.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag===`Span`?this.currentSpan:void 0}};const br={interruptChildren:void 0},xr=e=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(Nt.key,e.currentStackFrame),vn(t)},Sr=e=>Rr(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(A(r))}return a(),Er(()=>i?.())}),Cr=e=>Lt(t=>{let n=xr(t);for(let r of e)r.interruptUnsafe(t.id,n);return Gr(Sr(e))}),A=O,wr=Pt,Tr=Ft,Er=D({op:`Sync`,[T](e){let t=this[w](),n=e.getCont(E);return n?n[E](t,e):e.yieldWith(O(t))}}),Dr=D({op:`Suspend`,[T](e){return this[w]()}}),Or=D({op:`Yield`,[T](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate($r)},this[w]??0),e.yieldWith(()=>{t=!0})}})(0),kr=e=>A(k(e)),Ar=A(ln()),jr=e=>It(e),Mr=e=>Dr(()=>Tr(C(e))),Nr=A(void 0),Pr=e=>Dr(()=>{try{return A(C(e.try))}catch(t){return Tr(C(()=>e.catch(t)))}}),Fr=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new Pi(e,`An error occurred in Effect.tryPromise`):e.catch;return Ir(function(e,r){try{C(()=>t(r)).then(t=>e(A(t)),t=>e(Tr(C(()=>n(t)))))}catch(t){e(Tr(C(()=>n(t))))}},eval.length!==0)},Ir=D({op:`Async`,single:!1,[T](e){let t=C(()=>this[w][0].bind(e.currentScheduler)),n=!1,r=!1,i=this[w][1]?new AbortController:void 0,a=t(t=>{n||(n=!0,r?e.evaluate(t):r=t)},i?.signal);return r===!1?(r=!0,e._yielded=()=>{n=!0},i===void 0&&a===void 0||e._stack.push(Lr(()=>(n=!0,i?.abort(),a??$r))),ut):r}}),Lr=D({op:`AsyncFinalizer`,[lt](e){e.interruptible&&(e.interruptible=!1,e._stack.push(gi))},[ct](e,t){return dr(e)?j(this[w](),()=>wr(e)):wr(e)}}),Rr=e=>Ir(e,e.length>=2),zr=(...e)=>Dr(()=>Ur(e.length===1?e[0]():e[1].call(e[0].self))),Br=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),Vr=(e,...t)=>Br(e.length,t.length===0?function(){return Hr(()=>e.apply(this,arguments))}:function(){let n=Hr(()=>e.apply(this,arguments));for(let e of t)n=e(n);return n}),Hr=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return A(r.value);let i=r.value;if(i&&i._tag===`Success`){n=i.value;continue}else if(i&&i._tag===`Failure`)return r.value;else{let n=!0;return Dr(()=>n?(n=!1,j(r.value,e=>Ur(t,e))):Dr(()=>Ur(e())))}}}catch(e){return jr(e)}},Ur=D({op:`Iterator`,single:!1,[E](e,t){let n=this[w][0];for(;;){let r=n.next(e);if(r.done)return A(r.value);if(!M(r.value))return t._stack.push(this),r.value;if(r.value._tag===`Failure`)return r.value;e=r.value.value}},[T](e){return this[E](this[w][1],e)}}),Wr=d(2,(e,t)=>{let n=A(t);return j(e,e=>n)}),Gr=e=>j(e,e=>$r),j=d(2,(e,t)=>{let n=Object.create(Kr);return n[w]=e,n[E]=t.length===1?t:e=>t(e),n}),Kr=jt({op:`OnSuccess`,[T](e){return e._stack.push(this),this[w]}}),M=e=>at in e,qr=d(2,(e,t)=>M(e)?e._tag===`Success`?t(e.value):e:j(e,t)),Jr=d(2,(e,t)=>j(e,e=>A(C(()=>t(e))))),Yr=d(2,(e,t)=>M(e)?ei(e,t):Jr(e,t)),Xr=d(2,(e,t)=>M(e)?ti(e,t):si(e,t)),Zr=d(2,(e,t)=>{if(M(e)){if(e._tag===`Success`)return e;let n=ur(e.cause);return Fn(n)?e:t(n.success)}return oi(e,t)}),Qr=e=>e._tag===`Success`,$r=O(void 0),ei=d(2,(e,t)=>e._tag===`Success`?O(t(e.value)):e),ti=d(2,(e,t)=>{if(e._tag===`Success`)return e;let n=ur(e.cause);return Fn(n)?e:Ft(t(n.success))}),ni=e=>Qr(e)?k(e.value):ln(),ri=d(2,(e,t)=>{let n=Object.create(ii);return n[w]=e,n[ct]=t.length===1?t:e=>t(e),n}),ii=jt({op:`OnFailure`,[T](e){return e._stack.push(this),this[w]}}),ai=d(3,(e,t,n)=>ri(e,e=>{let r=t(e);return Fn(r)?wr(r.failure):C(()=>n(r.success,e))})),oi=d(2,(e,t)=>ai(e,ur,e=>t(e))),si=d(2,(e,t)=>oi(e,e=>Mr(()=>t(e)))),ci=e=>pi(e,{onFailure:Pn,onSuccess:Nn}),li=d(2,(e,t)=>{let n=Object.create(ui);return n[w]=e,n[E]=t.onSuccess.length===1?t.onSuccess:e=>t.onSuccess(e),n[ct]=t.onFailure.length===1?t.onFailure:e=>t.onFailure(e),n}),ui=jt({op:`OnSuccessAndFailure`,[T](e){return e._stack.push(this),this[w]}}),di=d(2,(e,t)=>li(e,{onFailure:e=>{let n=e.reasons.find(Dt);return n?C(()=>t.onFailure(n.error)):wr(e)},onSuccess:t.onSuccess})),fi=d(2,(e,t)=>di(e,{onFailure:e=>Er(()=>t.onFailure(e)),onSuccess:e=>Er(()=>t.onSuccess(e))})),pi=d(2,(e,t)=>{if(M(e)){if(e._tag===`Success`)return O(t.onSuccess(e.value));let n=ur(e.cause);return Fn(n)?e:O(t.onFailure(n.success))}return fi(e,t)}),mi=e=>M(e)?O(e):hi(e),hi=D({op:`Exit`,[T](e){return e._stack.push(this),this[w]},[E](e,t,n){return A(n??O(e))},[ct](e,t,n){return A(n??Pt(e))}}),gi=D({op:`SetInterruptible`,[lt](e){if(e.interruptible=this[w],e._interruptedCause&&e.interruptible)return()=>wr(e._interruptedCause)}})(!0),_i=(e,t)=>ue(e)?t?.mode===`result`?yi(e,ci,t):yi(e,f,t):t?.discard?t.mode===`result`?yi(Object.values(e),ci,t):yi(Object.values(e),f,t):Dr(()=>{let n={};return Wr(yi(Object.entries(e),([e,r])=>Jr(t?.mode===`result`?ci(r):r,t=>{n[e]=t}),{discard:!0,concurrency:t?.concurrency}),n)}),vi=D({op:`While`,[E](e,t){return this[w].step(e),this[w].while()?(t._stack.push(this),this[w].body()):$r},[T](e){return this[w].while()?(e._stack.push(this),this[w].body()):$r}}),yi=d(e=>typeof e[1]==`function`,(e,t,n)=>Lt(r=>{let i=n?.concurrency===`inherit`?r.getRef(ir):n?.concurrency??1,a=i===`unbounded`?1/0:Math.max(1,i);if(a===1)return bi(e,t,n);let o=Ln(e),s=o.length;if(s===0)return n?.discard?Nr:A([]);let c=n?.discard?void 0:Array(s),l=Ci({f:t,out:c},o,{concurrency:a});return l?Wr(l,c):A(c)})),bi=(e,t,n)=>Dr(()=>{let r=n?.discard?void 0:[],i=e[Symbol.iterator](),a=i.next(),o=0;return Wr(vi({while:()=>!a.done,body:()=>t(a.value,o++),step:e=>{r&&r.push(e),a=i.next()}}),r)}),xi=e=>{let t=e.onItem,n=e.step;return(e,r,i)=>{let a=i?.start??0,o=i?.end??r.length,s=i?.concurrency??1,c=!1,l,u,d,f=!1,p,ee,te=()=>{let i=!1;for(;!p&&a<o;a++){let o=r[a],m=ee??t(e,o,a);if(M(m)){if(p=n(e,o,m,a),p)break}else if(s===1)return j(mi(m),t=>(p=n(e,o,t,a),a++,p??te()??Nr));else if(l){ee=void 0;let t=wi(l,m,!0,!0,`inherit`);if(t._exit){if(p=n(e,o,t._exit,a),p)break;continue}u?u.add(t):u=new Set([t]);let r=a;if(t.addObserver(a=>{if(u.delete(t),p){if(!f&&a._tag===`Failure`)for(let e of a.cause.reasons)if(e._tag===`Interrupt`)continue;else p._tag===`Failure`?p.cause.reasons.push(e):p=Pt(St([e]))}else{let t=n(e,o,a,r);t&&(p=t._tag===`Failure`?Pt(St(t.cause.reasons.slice())):t,te())}if(i){let e=te();e&&d(e)}else c&&u.size===0&&d(p??Nr)}),u.size<s)continue;i=!0,a++;return}else return Rr(e=>{l=vr(),ee=m,d=e;let t=te();return t?e(t):Dr(()=>(p=$r,f=!0,u?Cr(u):Nr))})}if(c=!0,p){if(u&&u.size>0){let e=xr(l);u.forEach(t=>t.interruptUnsafe(l.id,e));return}if(d||p._tag===`Failure`)return p}else if(d)if(u)u.size===0&&d(Nr);else return $r};return te()}},Si=()=>xi,Ci=xi({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)}}),wi=(e,t,n=!1,r=!1,i=!1)=>{let a=i===`inherit`?e.interruptible:!i,o=new yr(e.context,a);return n?o.evaluate(t):e.currentDispatcher.scheduleTask(()=>o.evaluate(t),0),!r&&!o._exit&&(e.children().add(o),o.addObserver(()=>e._children.delete(o))),o},Ti=e=>(t,n)=>{let r=new yr(n?.scheduler?wn(e,Xn,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},Ei=e=>{let t=Ti(e);return(e,n)=>{let r=t(e,n);return new Promise(e=>{r.addObserver(t=>e(t))})}},Di=(e=>{let t=Ei(e);return(e,n)=>t(e,n).then(e=>{if(e._tag===`Failure`)throw mr(e.cause);return e.value})})(xn()),Oi=e=>{let t=Ti(e);return e=>{if(M(e))return e;let n=t(e,{scheduler:new $n(`sync`)});return n.currentDispatcher?.flush(),n._exit??It(new Mi(n))}},ki=Oi(xn()),Ai=(e=>{let t=Oi(e);return e=>{let n=t(e);if(n._tag===`Failure`)throw mr(n.cause);return n.value}})(xn());Bt(`TimeoutError`),Bt(`IllegalArgumentError`),Bt(`ExceededCapacityError`);const ji=`~effect/Cause/AsyncFiberError`;var Mi=class extends Bt(`AsyncFiberError`){[ji]=ji;constructor(e){super({message:`An asynchronous Effect was executed with Effect.runSync`,fiber:e})}};const Ni=`~effect/Cause/UnknownError`;var Pi=class extends Bt(`UnknownError`){[Ni]=Ni;constructor(e,t){super({message:t,cause:e})}};const Fi={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};Fi.gray,Fi.blue,Fi.green,Fi.yellow,Fi.red,Fi.bgBrightRed,Fi.black;const Ii=typeof process==`object`&&process!==null&&typeof process.stdout==`object`&&process.stdout!==null;Ii&&process.stdout.isTTY,Ii||`Deno`in globalThis;const Li=Ft,Ri=$r,zi=ni,Bi=ur;mn()(`effect/Cause/StackTrace`),mn()(`effect/Cause/InterruptorStackTrace`);const Vi=class extends u{constructor(e){super(),e&&Object.assign(this,e)}},Hi=Bt,Ui=`~effect/time/DateTime`,Wi=`~effect/time/DateTime/TimeZone`,Gi={[Ui]:Ui,pipe(){return c(this,arguments)},[Qe](){return this.toString()},toJSON(){return qi(this).toJSON()}};({...Gi}),{...Gi};const Ki={[Wi]:Wi,[Qe](){return this.toString()}};({...Ki}),{...Ki};const qi=e=>new Date(e.epochMilliseconds),Ji=_i,Yi=Fr,N=A,Xi=Ar,Zi=kr,Qi=zr,P=Tr,$i=Pr,ea=j,ta=mi,na=Di,ra=Ai,ia=ki;mn()(`effect/Effect/Transaction`);const aa=Yr,oa=Xr,sa=qr,ca=Zr,la=Vr,ua=/<title[^>]*>([^<]+)<\/title>/iu,da=/<meta[^>]*name=["']description["'][^>]*content=["']([^"']+)["'][^>]*>/iu,fa=/<meta[^>]*content=["']([^"']+)["'][^>]*name=["']description["'][^>]*>/iu,pa=/<meta[^>]*property=["'](og:[^"']+)["'][^>]*content=["']([^"']+)["'][^>]*>/giu,ma=/<meta[^>]*content=["']([^"']+)["'][^>]*property=["'](og:[^"']+)["'][^>]*>/giu,ha=/<meta[^>]*(?:name|property)=["'](twitter:[^"']+)["'][^>]*content=["']([^"']+)["'][^>]*>/giu,ga=/<meta[^>]*content=["']([^"']+)["'][^>]*(?:name|property)=["'](twitter:[^"']+)["'][^>]*>/giu,_a=/<meta[^>]*name=["']theme-color["'][^>]*content=["']([^"']+)["'][^>]*(?:media=["']([^"']+)["'])?[^>]*>/giu,va=/<meta[^>]*content=["']([^"']+)["'][^>]*name=["']theme-color["'][^>]*(?:media=["']([^"']+)["'])?[^>]*>/giu,ya=/\b(dark|light)\b/u,ba=/<link[^>]*rel=["']canonical["'][^>]*href=["']([^"']+)["'][^>]*>/iu,xa=/<head[^>]*>([\s\S]*?)<\/head>/iu,Sa=/<link[^>]*rel=["']([^"']*icon[^"']*)["'][^>]*href=["']([^"']+)["'][^>]*>/giu,Ca=/<link[^>]*href=["']([^"']+)["'][^>]*rel=["']([^"']*icon[^"']*)["'][^>]*>/giu,wa=/<link[^>]*rel=["']shortcut icon["'][^>]*href=["']([^"']+)["'][^>]*>/iu,Ta=/<link[^>]*rel=["'](apple-touch-icon[^"']*)["'][^>]*href=["']([^"']+)["'][^>]*>/giu,Ea=/type=["']([^"']+)["']/iu,Da=/sizes=["']([^"']+)["']/iu,F=e=>e.replaceAll(`&amp;`,`&`).replaceAll(`&lt;`,`<`).replaceAll(`&gt;`,`>`).replaceAll(`&quot;`,`"`).replaceAll(`&#39;`,`'`).replaceAll(`&#x27;`,`'`).replaceAll(`&#x2F;`,`/`).replaceAll(`&nbsp;`,` `),Oa=(e,t,n)=>{let r=t.replaceAll(/[.*+?^${}()|[\]\\]/gu,`\\$&`),i=RegExp(`<meta[^>]*${n}=["']${r}["'][^>]*content=["']([^"']+)["'][^>]*>`,`iu`),a=RegExp(`<meta[^>]*content=["']([^"']+)["'][^>]*${n}=["']${r}["'][^>]*>`,`iu`),o=e.match(i);if(o)return o[1];let s=e.match(a);return s?s[1]:null},I=(e,t)=>e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)?e:e.startsWith(`//`)?`https:${e}`:t?e.startsWith(`/`)?`${t}${e}`:`${t}/${e}`:e,ka=(e,t)=>{let n=e.match(ua);n&&(t.title=F(n[1].trim()))},Aa=(e,t)=>{let n=e.match(da)||e.match(fa);n&&(t.description=F(n[1]))},ja=(e,t)=>{for(let[n,r]of Object.entries({"application-name":`applicationName`,author:`author`,"color-scheme":`colorScheme`,"format-detection":`formatDetection`,generator:`generator`,keywords:`keywords`,license:`license`,robots:`robots`,viewport:`viewport`})){let i=Oa(e,n,`name`);i&&(t[r]=F(i))}},Ma=(e,t,n)=>{for(let r of e.matchAll(pa)){let[,e,i]=r;e&&i&&(t[e]=e===`og:image`?I(F(i),n):F(i))}for(let r of e.matchAll(ma)){let[,e,i]=r;i&&e&&(t[i]=i===`og:image`?I(F(e),n):F(e))}},Na=(e,t,n)=>{for(let r of e.matchAll(ha)){let[,e,i]=r;e&&i&&(t[e]=e===`twitter:image`?I(F(i),n):F(i))}for(let r of e.matchAll(ga)){let[,e,i]=r;i&&e&&(t[i]=i===`twitter:image`?I(F(e),n):F(e))}},Pa=(e,t)=>{let n;for(_a.lastIndex=0,va.lastIndex=0,n=_a.exec(e);n!==null;){let[,r,i]=n,a=typeof i==`string`?i.match(ya)?.[1]:void 0;a===`dark`?t.themeColorDark=r:a===`light`?t.themeColorLight=r:t.themeColor=r,n=_a.exec(e)}for(n=va.exec(e);n!==null;){let[,r,i]=n,a=typeof i==`string`?i.match(ya)?.[1]:void 0;a===`dark`?t.themeColorDark=r:a===`light`?t.themeColorLight=r:t.themeColor=r,n=va.exec(e)}},Fa=(e,t,n)=>{let r=e.match(ba);r&&(t.canonical=I(r[1],n))},Ia=(e,t)=>{let n=e.match(xa);n&&(t.rawHead=n[1].trim())},La=(e,t,n)=>{let r=[],i;for(Sa.lastIndex=0,Ca.lastIndex=0,Ta.lastIndex=0,i=Sa.exec(e);i!==null;){let[t,a,o]=i,s=I(o,n),c=t.match(Ea),l=t.match(Da);r.push({href:s,rel:a,sizes:l?.[1],type:c?.[1]}),i=Sa.exec(e)}for(i=Ca.exec(e);i!==null;){let[t,a,o]=i,s=I(a,n),c=t.match(Ea),l=t.match(Da);r.push({href:s,rel:o,sizes:l?.[1],type:c?.[1]}),i=Ca.exec(e)}let a=e.match(wa);for(a&&r.unshift({href:I(a[1],n),rel:`shortcut icon`}),i=Ta.exec(e);i!==null;){let t=i[0].match(Da);r.push({href:I(i[2],n),rel:i[1],sizes:t?.[1]}),i=Ta.exec(e)}r.length>0&&(t.favicons=r)},Ra=(e,t)=>{let n={},r;if(t)try{r=new URL(t).origin}catch{r=void 0}return ka(e,n),Aa(e,n),ja(e,n),Ma(e,n,r),Na(e,n,r),Pa(e,n),Fa(e,n,r),Ia(e,n),La(e,n,r),n},za=e=>Qi(function*(){let t=yield*Yi({catch:t=>Error(`Failed to fetch ${e}: ${t instanceof Error?t.message:String(t)}`),try:()=>fetch(e,{headers:{"User-Agent":`OGTester/1.0 (+https://github.com/PunGrumpy/og-tester)`}})});return t.ok?Ra(yield*Yi({catch:e=>Error(`Failed to read response body: ${e instanceof Error?e.message:String(e)}`),try:()=>t.text()}),e):yield*P(Error(`Failed to fetch ${e}: ${t.status} ${t.statusText}`))}),Ba=e=>na(za(e)),Va=e=>Qi(function*(){let t=`${(yield*$i({catch:e=>Error(`Invalid URL: ${e instanceof Error?e.message:String(e)}`),try:()=>new URL(e)})).origin}/robots.txt`,n=yield*Yi({catch:e=>Error(`Failed to fetch robots.txt: ${e instanceof Error?e.message:String(e)}`),try:()=>fetch(t)});return n.ok?{content:yield*Yi({catch:e=>Error(`Failed to read robots.txt body: ${e instanceof Error?e.message:String(e)}`),try:()=>n.text()})}:yield*P(Error(`Failed to fetch robots.txt: ${n.status}`))}),Ha=async e=>{try{return await na(Va(e))}catch(e){return{error:e instanceof Error?e.message:String(e)}}},Ua=/<url>([\s\S]*?)<\/url>/giu,Wa=/<loc>([^<]+)<\/loc>/iu,Ga=/<lastmod>([^<]+)<\/lastmod>/iu,Ka=/<changefreq>([^<]+)<\/changefreq>/iu,qa=/<priority>([^<]+)<\/priority>/iu,Ja=e=>{let t=[];for(let n of e.matchAll(Ua)){let[,e]=n;if(e===void 0)continue;let r=e.match(Wa);if(!r)continue;let i={loc:r[1].trim()},a=e.match(Ga);a&&(i.lastmod=a[1].trim());let o=e.match(Ka);o&&(i.changefreq=o[1].trim());let s=e.match(qa);s&&(i.priority=s[1].trim()),t.push(i)}return t},Ya=e=>Qi(function*(){let t=`${(yield*$i({catch:e=>Error(`Invalid URL: ${e instanceof Error?e.message:String(e)}`),try:()=>new URL(e)})).origin}/sitemap.xml`,n=yield*Yi({catch:e=>Error(`Failed to fetch sitemap.xml: ${e instanceof Error?e.message:String(e)}`),try:()=>fetch(t)});if(!n.ok)return yield*P(Error(`Failed to fetch sitemap.xml: ${n.status}`));let r=yield*Yi({catch:e=>Error(`Failed to read sitemap.xml body: ${e instanceof Error?e.message:String(e)}`),try:()=>n.text()});return{content:r,urls:Ja(r)}}),Xa=async e=>{try{return await na(Ya(e))}catch(e){return{error:e instanceof Error?e.message:String(e)}}};var Za;function L(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 Qa=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`}};(Za=globalThis).__zod_globalConfig??(Za.__zod_globalConfig={});const eo=globalThis.__zod_globalConfig;function to(e){return e&&Object.assign(eo,e),eo}function no(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 ro(e,t){return typeof t==`bigint`?t.toString():t}function io(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function ao(e){return e==null}function oo(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function so(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}const co=Symbol(`evaluating`);function R(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==co)return r===void 0&&(r=co,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function lo(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function uo(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function fo(e){return JSON.stringify(e)}function po(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const mo=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ho(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const go=io(()=>{if(eo.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function _o(e){if(ho(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(ho(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function vo(e){return _o(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const yo=new Set([`string`,`number`,`symbol`]);function bo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function xo(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function z(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 So(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}const Co={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function wo(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 xo(e,uo(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 lo(this,`shape`,e),e},checks:[]}))}function To(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 xo(e,uo(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 lo(this,`shape`,r),r},checks:[]}))}function Eo(e,t){if(!_o(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 xo(e,uo(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return lo(this,`shape`,n),n}}))}function Do(e,t){if(!_o(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return xo(e,uo(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return lo(this,`shape`,n),n}}))}function Oo(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return xo(e,uo(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return lo(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function ko(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 xo(t,uo(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 lo(this,`shape`,i),i},checks:[]}))}function Ao(e,t,n){return xo(t,uo(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 lo(this,`shape`,i),i}}))}function jo(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 Mo(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 No(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Po(e){return typeof e==`string`?e:e?.message}function Fo(e,t,n){let r=e.message?e.message:Po(e.inst?._zod.def?.error?.(e))??Po(t?.error?.(e))??Po(n.customError?.(e))??Po(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 Io(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Lo(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}const Ro=(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,ro,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},zo=L(`$ZodError`,Ro),Bo=L(`$ZodError`,Ro,{Parent:Error});function Vo(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 Ho(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}const Uo=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Qa;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Fo(e,a,to())));throw mo(t,i?.callee),t}return o.value},Wo=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=>Fo(e,a,to())));throw mo(t,i?.callee),t}return o.value},Go=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Qa;return a.issues.length?{success:!1,error:new(e??zo)(a.issues.map(e=>Fo(e,i,to())))}:{success:!0,data:a.value}},Ko=Go(Bo),qo=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=>Fo(e,i,to())))}:{success:!0,data:a.value}},Jo=qo(Bo),Yo=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Uo(e)(t,n,i)},Xo=e=>(t,n,r)=>Uo(e)(t,n,r),Zo=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Wo(e)(t,n,i)},Qo=e=>async(t,n,r)=>Wo(e)(t,n,r),$o=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Go(e)(t,n,i)},es=e=>(t,n,r)=>Go(e)(t,n,r),ts=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return qo(e)(t,n,i)},ns=e=>async(t,n,r)=>qo(e)(t,n,r),rs=/^[cC][0-9a-z]{6,}$/,is=/^[0-9a-z]+$/,as=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,os=/^[0-9a-vA-V]{20}$/,ss=/^[A-Za-z0-9]{27}$/,cs=/^[a-zA-Z0-9_-]{21}$/,ls=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,us=/^([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})$/,ds=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)$/,fs=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function ps(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}const ms=/^(?:(?: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])$/,hs=/^(([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}|:))$/,gs=/^((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])$/,_s=/^(([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])$/,vs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ys=/^[A-Za-z0-9_-]*$/,bs=/^https?$/,xs=/^\+[1-9]\d{6,14}$/,Ss=`(?:(?:\\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])))`,Cs=RegExp(`^${Ss}$`);function ws(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 Ts(e){return RegExp(`^${ws(e)}$`)}function Es(e){let t=ws({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(`^${Ss}T(?:${r})$`)}const Ds=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Os=/^-?\d+$/,ks=/^-?\d+(?:\.\d+)?$/,As=/^[^A-Z]*$/,js=/^[^a-z]*$/,B=L(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ms={number:`number`,bigint:`bigint`,object:`date`},Ns=L(`$ZodCheckLessThan`,(e,t)=>{B.init(e,t);let n=Ms[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})}}),Ps=L(`$ZodCheckGreaterThan`,(e,t)=>{B.init(e,t);let n=Ms[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})}}),Fs=L(`$ZodCheckMultipleOf`,(e,t)=>{B.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):so(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})}}),Is=L(`$ZodCheckNumberFormat`,(e,t)=>{B.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Co[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=Os)}),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})}}),Ls=L(`$ZodCheckMaxLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ao(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=Io(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Rs=L(`$ZodCheckMinLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ao(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=Io(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),zs=L(`$ZodCheckLengthEquals`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ao(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=Io(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})}}),Bs=L(`$ZodCheckStringFormat`,(e,t)=>{var n,r;B.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=()=>{})}),Vs=L(`$ZodCheckRegex`,(e,t)=>{Bs.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})}}),Hs=L(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=As,Bs.init(e,t)}),Us=L(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=js,Bs.init(e,t)}),Ws=L(`$ZodCheckIncludes`,(e,t)=>{B.init(e,t);let n=bo(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})}}),Gs=L(`$ZodCheckStartsWith`,(e,t)=>{B.init(e,t);let n=RegExp(`^${bo(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})}}),Ks=L(`$ZodCheckEndsWith`,(e,t)=>{B.init(e,t);let n=RegExp(`.*${bo(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})}}),qs=L(`$ZodCheckOverwrite`,(e,t)=>{B.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Js=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(`
7
+ `)}return t},zn=(e,t)=>{if(e.mutable)return t(e.mapUnsafe),e;let n=new Map(e.mapUnsafe);return t(n),Dn(n)},Bn=Cn,Vn=e=>e.length>0,Hn=_n,Un=gn,Wn=mn,Gn=globalThis.Array,Kn=e=>Gn.isArray(e)?e:Gn.from(e),qn=h(2,(e,t)=>[...e,t]),Jn=h(2,(e,t)=>Kn(e).concat(Kn(t)));Gn.isArray;const Yn=Vn,Xn=Vn;function Zn(e,t){return e<0||e>=t.length}const Qn=h(2,(e,t)=>{let n=Math.floor(t);if(Zn(n,e))throw Error(`Index out of bounds: ${n}`);return e[n]})(0),$n=e=>e.slice(1),er=h(3,(e,t,n)=>{let r=Kn(e),i=Kn(t);return Xn(r)?Xn(i)?ir(n)(Jn(r,i)):r:i}),tr=h(2,(e,t)=>er(e,t,Je())),nr=()=>[],rr=h(2,(e,t)=>e.map(t)),ir=h(2,(e,t)=>{let n=Kn(e);if(Xn(n)){let e=[Qn(n)],r=$n(n);for(let n of r)e.every(e=>!t(n,e))&&e.push(n);return e}return[]}),ar=Bn(`effect/Scheduler`,{defaultValue:()=>new cr}),or=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)};var sr=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}},cr=class{executionMode;setImmediate;constructor(e=`async`,t=or){this.executionMode=e,this.setImmediate=t}shouldYield(e){return e.currentOpCount>=e.maxOpsBeforeYield}makeDispatcher(){return new lr(this.setImmediate)}},lr=class{tasks=new sr;running=void 0;setImmediate;constructor(e=or){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()}};const ur=Bn(`effect/Scheduler/MaxOpsBeforeYield`,{defaultValue:()=>2048}),dr=Bn(`effect/Scheduler/PreventSchedulerYield`,{defaultValue:()=>!1}),fr=`effect/Tracer/ParentSpan`;Cn()(fr);const pr=Bn(`effect/References/CurrentConcurrency`,{defaultValue:()=>`unbounded`}),mr=Bn(`effect/References/CurrentStackFrame`,{defaultValue:oe}),hr=Bn(`effect/References/CurrentLogLevel`,{defaultValue:()=>`Info`}),gr=Bn(`effect/References/MinimumLogLevel`,{defaultValue:()=>`Info`});var _r=class extends Ot{fiberId;constructor(e,t=kt){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[x](e){return Rt(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[_](){return y(b(`${this._tag}:${this.fiberId}`))(ye(this.annotations))}};const vr=e=>new Et([new _r(e)]),yr=e=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag===`Fail`)return Hn(n.error)}return Un(e)},br=e=>e.reasons.some(Rt),xr=h(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new Et(tr(e.reasons,t.reasons));return S(e,n)?e:n}),Sr=e=>{let t={Fail:[],Die:[],Interrupt:[]};for(let n=0;n<e.reasons.length;n++)t[e.reasons[n]._tag].push(e.reasons[n]);return t},Cr=e=>{let t=Sr(e);return t.Fail.length>0?t.Fail[0].error:t.Die.length>0?t.Die[0].defect:t.Interrupt.length>0?new globalThis.Error(`All fibers interrupted without error`):new globalThis.Error(`Empty cause`)},wr=`~effect/Fiber/dev`,Tr={_A:ae,_E:ae},Er={id:0},Dr=()=>globalThis[$e];var Or=class{constructor(e,t=!0){this[wr]=Tr,this.setContext(e),this.id=++Er.id,this.currentOpCount=0,this.currentLoopCount=0,this.interruptible=t,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this.runtimeMetrics?.recordFiberStart(this.context)}[wr];id;interruptible;currentOpCount;currentLoopCount;_stack;_observers;_exit;_currentExit;_children;_interruptedCause;_yielded;context;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;currentPreventYield;_dispatcher=void 0;get currentDispatcher(){return this._dispatcher??=this.currentScheduler.makeDispatcher()}getRef(e){return Fn(this.context,e)}addObserver(e){return this._exit?(e(this._exit),se):(this._observers.push(e),()=>{let t=this._observers.indexOf(e);t>=0&&this._observers.splice(t,1)})}interruptUnsafe(e,t){if(this._exit)return;let n=vr(e);this.currentStackFrame&&(n=Ft(n,Mn(Ht,this.currentStackFrame))),t&&(n=Ft(n,t)),this._interruptedCause=this._interruptedCause?xr(this._interruptedCause,n):n,this.interruptible&&this.evaluate(Nr(this._interruptedCause))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;if(this._yielded!==void 0){let e=this._yielded;this._yielded=void 0,e()}let t=this.runLoop(e);if(t===yt)return;let n=kr.interruptChildren&&kr.interruptChildren(this);if(n!==void 0)return this.evaluate(ti(n,()=>t));this._exit=t,this.runtimeMetrics?.recordFiberEnd(this.context,this._exit);for(let e=0;e<this._observers.length;e++)this._observers[e](t);this._observers.length=0}runLoop(e){let t=globalThis[$e];globalThis[$e]=this;let n=!1,r=e;this.currentOpCount=0;let i=++this.currentLoopCount;try{for(;;){if(this.currentOpCount++,!n&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){n=!0;let e=r;r=ti(Lr,()=>e)}if(r=this.currentTracerContext?this.currentTracerContext(r,this):r[T](this),i!==this.currentLoopCount)return yt;if(r===yt){let e=this._yielded;return mt in e?(this._yielded=void 0,e):yt}}}catch(e){return g(r,T)?this.runLoop(Gt(e)):Gt(`Fiber.runLoop: Not a valid effect: ${String(r)}`)}finally{globalThis[$e]=t}}getCont(e){for(;;){let t=this._stack.pop();if(!t)return;let n=t[vt]&&t[vt](this);if(n)return n[e]=n,n;if(t[e])return t}}yieldWith(e){return this._yielded=e,yt}children(){return this._children??=new Set}pipe(){return ne(this,arguments)}setContext(e){this.context=e;let t=this.getRef(ar);t!==this.currentScheduler&&(this.currentScheduler=t,this._dispatcher=void 0),this.currentSpan=e.mapUnsafe.get(fr),this.currentLogLevel=this.getRef(hr),this.minimumLogLevel=this.getRef(gr),this.currentStackFrame=e.mapUnsafe.get(mr.key),this.maxOpsBeforeYield=this.getRef(ur),this.currentPreventYield=this.getRef(dr),this.runtimeMetrics=e.mapUnsafe.get(`effect/observability/Metric/FiberRuntimeMetricsKey`);let n=e.mapUnsafe.get(`effect/Tracer`);this.currentTracerContext=n?n.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag===`Span`?this.currentSpan:void 0}};const kr={interruptChildren:void 0},Ar=e=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(Ht.key,e.currentStackFrame),Dn(t)},jr=e=>qr(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(A(r))}return a(),Fr(()=>i?.())}),Mr=e=>Kt(t=>{let n=Ar(t);for(let r of e)r.interruptUnsafe(t.id,n);return ei(jr(e))}),A=O,Nr=Ut,Pr=Wt,Fr=D({op:`Sync`,[T](e){let t=this[w](),n=e.getCont(E);return n?n[E](t,e):e.yieldWith(O(t))}}),Ir=D({op:`Suspend`,[T](e){return this[w]()}}),Lr=D({op:`Yield`,[T](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(li)},this[w]??0),e.yieldWith(()=>{t=!0})}})(0),Rr=e=>A(k(e)),zr=A(vn()),Br=e=>Gt(e),Vr=e=>Ir(()=>Pr(ft(e))),Hr=A(void 0),Ur=e=>Ir(()=>{try{return A(ft(e.try))}catch(t){return Pr(ft(()=>e.catch(t)))}}),Wr=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new Wi(e,`An error occurred in Effect.tryPromise`):e.catch;return Gr(function(e,r){try{ft(()=>t(r)).then(t=>e(A(t)),t=>e(Pr(ft(()=>n(t)))))}catch(t){e(Pr(ft(()=>n(t))))}},eval.length!==0)},Gr=D({op:`Async`,single:!1,[T](e){let t=ft(()=>this[w][0].bind(e.currentScheduler)),n=!1,r=!1,i=this[w][1]?new AbortController:void 0,a=t(t=>{n||(n=!0,r?e.evaluate(t):r=t)},i?.signal);return r===!1?(r=!0,e._yielded=()=>{n=!0},i===void 0&&a===void 0||e._stack.push(Kr(()=>(n=!0,i?.abort(),a??li))),yt):r}}),Kr=D({op:`AsyncFinalizer`,[vt](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Ei))},[_t](e,t){return br(e)?ti(this[w](),()=>Nr(e)):Nr(e)}}),qr=e=>Gr(e,e.length>=2),Jr=(...e)=>Ir(()=>Qr(e.length===1?e[0]():e[1].call(e[0].self))),Yr=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),Xr=(e,...t)=>Yr(e.length,t.length===0?function(){return Zr(()=>e.apply(this,arguments))}:function(){let n=Zr(()=>e.apply(this,arguments));for(let e of t)n=e(n);return n}),Zr=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return A(r.value);let i=r.value;if(i&&i._tag===`Success`){n=i.value;continue}else if(i&&i._tag===`Failure`)return r.value;else{let n=!0;return Ir(()=>n?(n=!1,ti(r.value,e=>Qr(t,e))):Ir(()=>Qr(e())))}}}catch(e){return Br(e)}},Qr=D({op:`Iterator`,single:!1,[E](e,t){let n=this[w][0];for(;;){let r=n.next(e);if(r.done)return A(r.value);if(!j(r.value))return t._stack.push(this),r.value;if(r.value._tag===`Failure`)return r.value;e=r.value.value}},[T](e){return this[E](this[w][1],e)}}),$r=h(2,(e,t)=>{let n=A(t);return ti(e,e=>n)}),ei=e=>ti(e,e=>li),ti=h(2,(e,t)=>{let n=Object.create(ni);return n[w]=e,n[E]=t.length===1?t:e=>t(e),n}),ni=Bt({op:`OnSuccess`,[T](e){return e._stack.push(this),this[w]}}),j=e=>mt in e,ri=h(2,(e,t)=>j(e)?e._tag===`Success`?t(e.value):e:ti(e,t)),ii=h(2,(e,t)=>ti(e,e=>A(ft(()=>t(e))))),ai=h(2,(e,t)=>j(e)?ui(e,t):ii(e,t)),oi=h(2,(e,t)=>j(e)?di(e,t):_i(e,t)),si=h(2,(e,t)=>{if(j(e)){if(e._tag===`Success`)return e;let n=yr(e.cause);return Wn(n)?e:t(n.success)}return gi(e,t)}),ci=e=>e._tag===`Success`,li=O(void 0),ui=h(2,(e,t)=>e._tag===`Success`?O(t(e.value)):e),di=h(2,(e,t)=>{if(e._tag===`Success`)return e;let n=yr(e.cause);return Wn(n)?e:Wt(t(n.success))}),fi=e=>ci(e)?k(e.value):vn(),pi=h(2,(e,t)=>{let n=Object.create(mi);return n[w]=e,n[_t]=t.length===1?t:e=>t(e),n}),mi=Bt({op:`OnFailure`,[T](e){return e._stack.push(this),this[w]}}),hi=h(3,(e,t,n)=>pi(e,e=>{let r=t(e);return Wn(r)?Nr(r.failure):ft(()=>n(r.success,e))})),gi=h(2,(e,t)=>hi(e,yr,e=>t(e))),_i=h(2,(e,t)=>gi(e,e=>Vr(()=>t(e)))),vi=e=>Ci(e,{onFailure:Un,onSuccess:Hn}),yi=h(2,(e,t)=>{let n=Object.create(bi);return n[w]=e,n[E]=t.onSuccess.length===1?t.onSuccess:e=>t.onSuccess(e),n[_t]=t.onFailure.length===1?t.onFailure:e=>t.onFailure(e),n}),bi=Bt({op:`OnSuccessAndFailure`,[T](e){return e._stack.push(this),this[w]}}),xi=h(2,(e,t)=>yi(e,{onFailure:e=>{let n=e.reasons.find(It);return n?ft(()=>t.onFailure(n.error)):Nr(e)},onSuccess:t.onSuccess})),Si=h(2,(e,t)=>xi(e,{onFailure:e=>Fr(()=>t.onFailure(e)),onSuccess:e=>Fr(()=>t.onSuccess(e))})),Ci=h(2,(e,t)=>{if(j(e)){if(e._tag===`Success`)return O(t.onSuccess(e.value));let n=yr(e.cause);return Wn(n)?e:O(t.onFailure(n.success))}return Si(e,t)}),wi=e=>j(e)?O(e):Ti(e),Ti=D({op:`Exit`,[T](e){return e._stack.push(this),this[w]},[E](e,t,n){return A(n??O(e))},[_t](e,t,n){return A(n??Ut(e))}}),Ei=D({op:`SetInterruptible`,[vt](e){if(e.interruptible=this[w],e._interruptedCause&&e.interruptible)return()=>Nr(e._interruptedCause)}})(!0),Di=(e,t)=>ve(e)?t?.mode===`result`?ki(e,vi,t):ki(e,ae,t):t?.discard?t.mode===`result`?ki(Object.values(e),vi,t):ki(Object.values(e),ae,t):Ir(()=>{let n={};return $r(ki(Object.entries(e),([e,r])=>ii(t?.mode===`result`?vi(r):r,t=>{n[e]=t}),{discard:!0,concurrency:t?.concurrency}),n)}),Oi=D({op:`While`,[E](e,t){return this[w].step(e),this[w].while()?(t._stack.push(this),this[w].body()):li},[T](e){return this[w].while()?(e._stack.push(this),this[w].body()):li}}),ki=h(e=>typeof e[1]==`function`,(e,t,n)=>Kt(r=>{let i=n?.concurrency===`inherit`?r.getRef(pr):n?.concurrency??1,a=i===`unbounded`?1/0:Math.max(1,i);if(a===1)return Ai(e,t,n);let o=Kn(e),s=o.length;if(s===0)return n?.discard?Hr:A([]);let c=n?.discard?void 0:Array(s),l=Ni({f:t,out:c},o,{concurrency:a});return l?$r(l,c):A(c)})),Ai=(e,t,n)=>Ir(()=>{let r=n?.discard?void 0:[],i=e[Symbol.iterator](),a=i.next(),o=0;return $r(Oi({while:()=>!a.done,body:()=>t(a.value,o++),step:e=>{r&&r.push(e),a=i.next()}}),r)}),ji=e=>{let t=e.onItem,n=e.step;return(e,r,i)=>{let a=i?.start??0,o=i?.end??r.length,s=i?.concurrency??1,c=!1,l,u,d,f=!1,p,m,ee=()=>{let i=!1;for(;!p&&a<o;a++){let o=r[a],te=m??t(e,o,a);if(j(te)){if(p=n(e,o,te,a),p)break}else if(s===1)return ti(wi(te),t=>(p=n(e,o,t,a),a++,p??ee()??Hr));else if(l){m=void 0;let t=Pi(l,te,!0,!0,`inherit`);if(t._exit){if(p=n(e,o,t._exit,a),p)break;continue}u?u.add(t):u=new Set([t]);let r=a;if(t.addObserver(a=>{if(u.delete(t),p){if(!f&&a._tag===`Failure`)for(let e of a.cause.reasons)if(e._tag===`Interrupt`)continue;else p._tag===`Failure`?p.cause.reasons.push(e):p=Ut(jt([e]))}else{let t=n(e,o,a,r);t&&(p=t._tag===`Failure`?Ut(jt(t.cause.reasons.slice())):t,ee())}if(i){let e=ee();e&&d(e)}else c&&u.size===0&&d(p??Hr)}),u.size<s)continue;i=!0,a++;return}else return qr(e=>{l=Dr(),m=te,d=e;let t=ee();return t?e(t):Ir(()=>(p=li,f=!0,u?Mr(u):Hr))})}if(c=!0,p){if(u&&u.size>0){let e=Ar(l);u.forEach(t=>t.interruptUnsafe(l.id,e));return}if(d||p._tag===`Failure`)return p}else if(d)if(u)u.size===0&&d(Hr);else return li};return ee()}},Mi=()=>ji,Ni=ji({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)}}),Pi=(e,t,n=!1,r=!1,i=!1)=>{let a=i===`inherit`?e.interruptible:!i,o=new Or(e.context,a);return n?o.evaluate(t):e.currentDispatcher.scheduleTask(()=>o.evaluate(t),0),!r&&!o._exit&&(e.children().add(o),o.addObserver(()=>e._children.delete(o))),o},Fi=e=>(t,n)=>{let r=new Or(n?.scheduler?Nn(e,ar,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},Ii=e=>{let t=Fi(e);return(e,n)=>{let r=t(e,n);return new Promise(e=>{r.addObserver(t=>e(t))})}},Li=(e=>{let t=Ii(e);return(e,n)=>t(e,n).then(e=>{if(e._tag===`Failure`)throw Cr(e.cause);return e.value})})(An()),Ri=e=>{let t=Fi(e);return e=>{if(j(e))return e;let n=t(e,{scheduler:new cr(`sync`)});return n.currentDispatcher?.flush(),n._exit??Gt(new Hi(n))}},zi=Ri(An()),Bi=(e=>{let t=Ri(e);return e=>{let n=t(e);if(n._tag===`Failure`)throw Cr(n.cause);return n.value}})(An());Yt(`TimeoutError`),Yt(`IllegalArgumentError`),Yt(`ExceededCapacityError`);const Vi=`~effect/Cause/AsyncFiberError`;var Hi=class extends Yt(`AsyncFiberError`){[Vi]=Vi;constructor(e){super({message:`An asynchronous Effect was executed with Effect.runSync`,fiber:e})}};const Ui=`~effect/Cause/UnknownError`;var Wi=class extends Yt(`UnknownError`){[Ui]=Ui;constructor(e,t){super({message:t,cause:e})}};const Gi={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};Gi.gray,Gi.blue,Gi.green,Gi.yellow,Gi.red,Gi.bgBrightRed,Gi.black;const Ki=typeof process==`object`&&process!==null&&typeof process.stdout==`object`&&process.stdout!==null;Ki&&process.stdout.isTTY,Ki||`Deno`in globalThis;const qi=Wt,Ji=li,Yi=fi,Xi=yr;Cn()(`effect/Cause/StackTrace`),Cn()(`effect/Cause/InterruptorStackTrace`);const Zi=class extends ie{constructor(e){super(),e&&Object.assign(this,e)}},Qi=Yt,$i=`~effect/time/DateTime`,ea=`~effect/time/DateTime/TimeZone`,ta={[$i]:$i,pipe(){return ne(this,arguments)},[ot](){return this.toString()},toJSON(){return ra(this).toJSON()}};({...ta}),{...ta};const na={[ea]:ea,[ot](){return this.toString()}};({...na}),{...na};const ra=e=>new Date(e.epochMilliseconds),ia=Di,M=Wr,N=A,aa=zr,oa=Rr,P=Jr,F=Pr,sa=Ur,ca=ti,la=vi,ua=wi,da=ii,fa=gi,pa=_i,ma=Li,ha=Bi,ga=zi;Cn()(`effect/Effect/Transaction`);const _a=ai,va=oi,ya=ri,ba=si,xa=Xr,Sa=/<title[^>]*>([^<]+)<\/title>/iu,Ca=/<html[^>]*lang=["']?([^"'\s>]+)["']?/iu,wa=/<meta[^>]*charset=["']?([^"'\s>]+)["']?/iu,Ta=/<meta[^>]*http-equiv=["']?content-type["']?[^>]*content=["']?[^"'>]*charset=["']?([^"'\s>;]+)/iu,Ea=/<meta[^>]*name=["']description["'][^>]*content=["']([^"']+)["'][^>]*>/iu,Da=/<meta[^>]*content=["']([^"']+)["'][^>]*name=["']description["'][^>]*>/iu,Oa=/<meta[^>]*property=["'](og:[^"']+)["'][^>]*content=["']([^"']+)["'][^>]*>/giu,ka=/<meta[^>]*content=["']([^"']+)["'][^>]*property=["'](og:[^"']+)["'][^>]*>/giu,Aa=/<meta[^>]*(?:name|property)=["'](twitter:[^"']+)["'][^>]*content=["']([^"']+)["'][^>]*>/giu,ja=/<meta[^>]*content=["']([^"']+)["'][^>]*(?:name|property)=["'](twitter:[^"']+)["'][^>]*>/giu,Ma=/<meta[^>]*name=["']theme-color["'][^>]*content=["']([^"']+)["'][^>]*(?:media=["']([^"']+)["'])?[^>]*>/giu,Na=/<meta[^>]*content=["']([^"']+)["'][^>]*name=["']theme-color["'][^>]*(?:media=["']([^"']+)["'])?[^>]*>/giu,Pa=/\b(dark|light)\b/u,Fa=/<link[^>]*rel=["']canonical["'][^>]*href=["']([^"']+)["'][^>]*>/iu,Ia=/<head[^>]*>([\s\S]*?)<\/head>/iu,La=/<link[^>]*rel=["']([^"']*icon[^"']*)["'][^>]*href=["']([^"']+)["'][^>]*>/giu,Ra=/<link[^>]*href=["']([^"']+)["'][^>]*rel=["']([^"']*icon[^"']*)["'][^>]*>/giu,za=/<link[^>]*rel=["']shortcut icon["'][^>]*href=["']([^"']+)["'][^>]*>/iu,Ba=/<link[^>]*rel=["'](apple-touch-icon[^"']*)["'][^>]*href=["']([^"']+)["'][^>]*>/giu,Va=/type=["']([^"']+)["']/iu,Ha=/sizes=["']([^"']+)["']/iu,I=e=>e.replaceAll(`&amp;`,`&`).replaceAll(`&lt;`,`<`).replaceAll(`&gt;`,`>`).replaceAll(`&quot;`,`"`).replaceAll(`&#39;`,`'`).replaceAll(`&#x27;`,`'`).replaceAll(`&#x2F;`,`/`).replaceAll(`&nbsp;`,` `),Ua=(e,t,n)=>{let r=t.replaceAll(/[.*+?^${}()|[\]\\]/gu,`\\$&`),i=RegExp(`<meta[^>]*${n}=["']${r}["'][^>]*content=["']([^"']+)["'][^>]*>`,`iu`),a=RegExp(`<meta[^>]*content=["']([^"']+)["'][^>]*${n}=["']${r}["'][^>]*>`,`iu`),o=e.match(i);if(o)return o[1];let s=e.match(a);return s?s[1]:null},Wa=(e,t)=>e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)?e:e.startsWith(`//`)?`https:${e}`:t?e.startsWith(`/`)?`${t}${e}`:`${t}/${e}`:e,Ga=(e,t)=>{let n=e.match(Sa);n&&(t.title=I(n[1].trim()))},Ka=(e,t)=>{let n=e.match(Ea)||e.match(Da);n&&(t.description=I(n[1]))},qa=(e,t)=>{for(let[n,r]of Object.entries({"application-name":`applicationName`,author:`author`,"color-scheme":`colorScheme`,"format-detection":`formatDetection`,generator:`generator`,keywords:`keywords`,license:`license`,robots:`robots`,viewport:`viewport`})){let i=Ua(e,n,`name`);i&&(t[r]=I(i))}},Ja=(e,t,n)=>{for(let r of e.matchAll(Oa)){let[,e,i]=r;e&&i&&(t[e]=e===`og:image`?Wa(I(i),n):I(i))}for(let r of e.matchAll(ka)){let[,e,i]=r;i&&e&&(t[i]=i===`og:image`?Wa(I(e),n):I(e))}},Ya=(e,t,n)=>{for(let r of e.matchAll(Aa)){let[,e,i]=r;e&&i&&(t[e]=e===`twitter:image`?Wa(I(i),n):I(i))}for(let r of e.matchAll(ja)){let[,e,i]=r;i&&e&&(t[i]=i===`twitter:image`?Wa(I(e),n):I(e))}},Xa=(e,t)=>{let n;for(Ma.lastIndex=0,Na.lastIndex=0,n=Ma.exec(e);n!==null;){let[,r,i]=n,a=typeof i==`string`?i.match(Pa)?.[1]:void 0;a===`dark`?t.themeColorDark=r:a===`light`?t.themeColorLight=r:t.themeColor=r,n=Ma.exec(e)}for(n=Na.exec(e);n!==null;){let[,r,i]=n,a=typeof i==`string`?i.match(Pa)?.[1]:void 0;a===`dark`?t.themeColorDark=r:a===`light`?t.themeColorLight=r:t.themeColor=r,n=Na.exec(e)}},Za=(e,t,n)=>{let r=e.match(Fa);r&&(t.canonical=Wa(r[1],n))},Qa=(e,t)=>{let n=e.match(Ca);n&&(t.lang=I(n[1]))},$a=(e,t)=>{let n=e.match(wa)||e.match(Ta);n&&(t.charset=I(n[1]))},eo=(e,t)=>{let n=e.match(Ia);n&&(t.rawHead=n[1].trim())},to=(e,t,n)=>{let r=[],i;for(La.lastIndex=0,Ra.lastIndex=0,Ba.lastIndex=0,i=La.exec(e);i!==null;){let[t,a,o]=i,s=Wa(o,n),c=t.match(Va),l=t.match(Ha);r.push({href:s,rel:a,sizes:l?.[1],type:c?.[1]}),i=La.exec(e)}for(i=Ra.exec(e);i!==null;){let[t,a,o]=i,s=Wa(a,n),c=t.match(Va),l=t.match(Ha);r.push({href:s,rel:o,sizes:l?.[1],type:c?.[1]}),i=Ra.exec(e)}let a=e.match(za);for(a&&r.unshift({href:Wa(a[1],n),rel:`shortcut icon`}),i=Ba.exec(e);i!==null;){let t=i[0].match(Ha);r.push({href:Wa(i[2],n),rel:i[1],sizes:t?.[1]}),i=Ba.exec(e)}r.length>0&&(t.favicons=r)},no=(e,t)=>{let n={},r;if(t)try{r=new URL(t).origin}catch{r=void 0}return Ga(e,n),Ka(e,n),qa(e,n),Ja(e,n,r),Ya(e,n,r),Xa(e,n),Za(e,n,r),Qa(e,n),$a(e,n),eo(e,n),to(e,n,r),n},ro=e=>P(function*(){let t=yield*M({catch:t=>Error(`Failed to fetch ${e}: ${t instanceof Error?t.message:String(t)}`),try:()=>fetch(e,{headers:{"User-Agent":`OGTester/1.0 (+https://github.com/PunGrumpy/og-tester)`}})});return t.ok?no(yield*M({catch:e=>Error(`Failed to read response body: ${e instanceof Error?e.message:String(e)}`),try:()=>t.text()}),e):yield*F(Error(`Failed to fetch ${e}: ${t.status} ${t.statusText}`))}),io=e=>ma(ro(e)),ao=e=>P(function*(){let t=`${(yield*sa({catch:e=>Error(`Invalid URL: ${e instanceof Error?e.message:String(e)}`),try:()=>new URL(e)})).origin}/robots.txt`,n=yield*M({catch:e=>Error(`Failed to fetch robots.txt: ${e instanceof Error?e.message:String(e)}`),try:()=>fetch(t)});return n.ok?{content:yield*M({catch:e=>Error(`Failed to read robots.txt body: ${e instanceof Error?e.message:String(e)}`),try:()=>n.text()})}:yield*F(Error(`Failed to fetch robots.txt: ${n.status}`))}),oo=async e=>{try{return await ma(ao(e))}catch(e){return{error:e instanceof Error?e.message:String(e)}}},so=/<url>([\s\S]*?)<\/url>/giu,co=/<loc>([^<]+)<\/loc>/iu,lo=/<lastmod>([^<]+)<\/lastmod>/iu,uo=/<changefreq>([^<]+)<\/changefreq>/iu,fo=/<priority>([^<]+)<\/priority>/iu,po=e=>{let t=[];for(let n of e.matchAll(so)){let[,e]=n;if(e===void 0)continue;let r=e.match(co);if(!r)continue;let i={loc:r[1].trim()},a=e.match(lo);a&&(i.lastmod=a[1].trim());let o=e.match(uo);o&&(i.changefreq=o[1].trim());let s=e.match(fo);s&&(i.priority=s[1].trim()),t.push(i)}return t},mo=/<sitemap>([\s\S]*?)<\/sitemap>/giu,ho=e=>/<sitemapindex/iu.test(e),go=e=>{let t=[];for(let n of e.matchAll(mo)){let[,e]=n;if(e===void 0)continue;let r=e.match(co);r&&t.push(r[1].trim())}return t},_o=e=>P(function*(){let t=yield*M({catch:t=>Error(`Failed to fetch sitemap at ${e}: ${t instanceof Error?t.message:String(t)}`),try:()=>fetch(e)});if(!t.ok)return yield*F(Error(`Failed to fetch sitemap at ${e}: ${t.status}`));let n=yield*M({catch:t=>Error(`Failed to read sitemap body at ${e}: ${t instanceof Error?t.message:String(t)}`),try:()=>t.text()});return ho(n)?(yield*ia(go(n).map(e=>_o(e)),{concurrency:5})).flat():po(n)}),vo=e=>P(function*(){let t=yield*sa({catch:e=>Error(`Invalid URL: ${e instanceof Error?e.message:String(e)}`),try:()=>new URL(e)}),n=t.pathname.endsWith(`.xml`)?t.href:`${t.origin}/sitemap.xml`,r=yield*M({catch:e=>Error(`Failed to fetch sitemap.xml: ${e instanceof Error?e.message:String(e)}`),try:()=>fetch(n)});if(!r.ok)return yield*F(Error(`Failed to fetch sitemap.xml: ${r.status}`));let i=yield*M({catch:e=>Error(`Failed to read sitemap.xml body: ${e instanceof Error?e.message:String(e)}`),try:()=>r.text()});return ho(i)?{content:i,urls:(yield*ia(go(i).map(e=>_o(e)),{concurrency:5})).flat()}:{content:i,urls:po(i)}}),yo=async e=>{try{return await ma(vo(e))}catch(e){return{error:e instanceof Error?e.message:String(e)}}};var bo;function L(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 xo=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},So=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(bo=globalThis).__zod_globalConfig??(bo.__zod_globalConfig={});const Co=globalThis.__zod_globalConfig;function wo(e){return e&&Object.assign(Co,e),Co}function To(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 Eo(e,t){return typeof t==`bigint`?t.toString():t}function Do(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function Oo(e){return e==null}function ko(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ao(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}const jo=Symbol(`evaluating`);function R(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==jo)return r===void 0&&(r=jo,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Mo(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function No(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Po(e){return JSON.stringify(e)}function Fo(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const Io=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Lo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Ro=Do(()=>{if(Co.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function zo(e){if(Lo(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Lo(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Bo(e){return zo(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Vo=new Set([`string`,`number`,`symbol`]);function Ho(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Uo(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function z(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 Wo(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}const Go={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ko(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 Uo(e,No(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 Mo(this,`shape`,e),e},checks:[]}))}function qo(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 Uo(e,No(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 Mo(this,`shape`,r),r},checks:[]}))}function Jo(e,t){if(!zo(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 Uo(e,No(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Mo(this,`shape`,n),n}}))}function Yo(e,t){if(!zo(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Uo(e,No(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Mo(this,`shape`,n),n}}))}function Xo(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Uo(e,No(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Mo(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Zo(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 Uo(t,No(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 Mo(this,`shape`,i),i},checks:[]}))}function Qo(e,t,n){return Uo(t,No(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 Mo(this,`shape`,i),i}}))}function $o(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 es(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 ts(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ns(e){return typeof e==`string`?e:e?.message}function rs(e,t,n){let r=e.message?e.message:ns(e.inst?._zod.def?.error?.(e))??ns(t?.error?.(e))??ns(n.customError?.(e))??ns(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 is(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function as(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}const os=(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,Eo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ss=L(`$ZodError`,os),cs=L(`$ZodError`,os,{Parent:Error});function ls(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 us(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}const ds=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new xo;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>rs(e,a,wo())));throw Io(t,i?.callee),t}return o.value},fs=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=>rs(e,a,wo())));throw Io(t,i?.callee),t}return o.value},ps=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new xo;return a.issues.length?{success:!1,error:new(e??ss)(a.issues.map(e=>rs(e,i,wo())))}:{success:!0,data:a.value}},ms=ps(cs),hs=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=>rs(e,i,wo())))}:{success:!0,data:a.value}},gs=hs(cs),_s=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ds(e)(t,n,i)},vs=e=>(t,n,r)=>ds(e)(t,n,r),ys=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return fs(e)(t,n,i)},bs=e=>async(t,n,r)=>fs(e)(t,n,r),xs=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ps(e)(t,n,i)},Ss=e=>(t,n,r)=>ps(e)(t,n,r),Cs=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return hs(e)(t,n,i)},ws=e=>async(t,n,r)=>hs(e)(t,n,r),Ts=/^[cC][0-9a-z]{6,}$/,Es=/^[0-9a-z]+$/,Ds=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Os=/^[0-9a-vA-V]{20}$/,ks=/^[A-Za-z0-9]{27}$/,As=/^[a-zA-Z0-9_-]{21}$/,js=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ms=/^([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})$/,Ns=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)$/,Ps=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Fs(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}const Is=/^(?:(?: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])$/,Ls=/^(([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}|:))$/,Rs=/^((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])$/,zs=/^(([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])$/,Bs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Vs=/^[A-Za-z0-9_-]*$/,Hs=/^https?$/,Us=/^\+[1-9]\d{6,14}$/,Ws=`(?:(?:\\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])))`,Gs=RegExp(`^${Ws}$`);function Ks(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 qs(e){return RegExp(`^${Ks(e)}$`)}function Js(e){let t=Ks({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(`^${Ws}T(?:${r})$`)}const Ys=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Xs=/^-?\d+$/,Zs=/^-?\d+(?:\.\d+)?$/,Qs=/^[^A-Z]*$/,$s=/^[^a-z]*$/,B=L(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ec={number:`number`,bigint:`bigint`,object:`date`},tc=L(`$ZodCheckLessThan`,(e,t)=>{B.init(e,t);let n=ec[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})}}),nc=L(`$ZodCheckGreaterThan`,(e,t)=>{B.init(e,t);let n=ec[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})}}),rc=L(`$ZodCheckMultipleOf`,(e,t)=>{B.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):Ao(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})}}),ic=L(`$ZodCheckNumberFormat`,(e,t)=>{B.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Go[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=Xs)}),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})}}),ac=L(`$ZodCheckMaxLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Oo(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=is(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),oc=L(`$ZodCheckMinLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Oo(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=is(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),sc=L(`$ZodCheckLengthEquals`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Oo(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=is(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})}}),cc=L(`$ZodCheckStringFormat`,(e,t)=>{var n,r;B.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=()=>{})}),lc=L(`$ZodCheckRegex`,(e,t)=>{cc.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})}}),uc=L(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Qs,cc.init(e,t)}),dc=L(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=$s,cc.init(e,t)}),fc=L(`$ZodCheckIncludes`,(e,t)=>{B.init(e,t);let n=Ho(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})}}),pc=L(`$ZodCheckStartsWith`,(e,t)=>{B.init(e,t);let n=RegExp(`^${Ho(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})}}),mc=L(`$ZodCheckEndsWith`,(e,t)=>{B.init(e,t);let n=RegExp(`.*${Ho(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})}}),hc=L(`$ZodCheckOverwrite`,(e,t)=>{B.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var gc=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(`
8
8
  `).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(`
9
- `))}};const Ys={major:4,minor:4,patch:3},V=L(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ys;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=jo(e),i;for(let a of t){if(a._zod.def.when){if(Mo(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Qa;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=jo(e,t))});else{if(e.issues.length===t)continue;r||=jo(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(jo(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Qa;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Qa;return o.then(e=>t(e,r,a))}return t(o,r,a)}}R(e,`~standard`,()=>({validate:t=>{try{let n=Ko(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Jo(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Xs=L(`$ZodString`,(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ds(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}}),H=L(`$ZodStringFormat`,(e,t)=>{Bs.init(e,t),Xs.init(e,t)}),Zs=L(`$ZodGUID`,(e,t)=>{t.pattern??=us,H.init(e,t)}),Qs=L(`$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??=ds(e)}else t.pattern??=ds();H.init(e,t)}),$s=L(`$ZodEmail`,(e,t)=>{t.pattern??=fs,H.init(e,t)}),ec=L(`$ZodURL`,(e,t)=>{H.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===bs.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})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),tc=L(`$ZodEmoji`,(e,t)=>{t.pattern??=ps(),H.init(e,t)}),nc=L(`$ZodNanoID`,(e,t)=>{t.pattern??=cs,H.init(e,t)}),rc=L(`$ZodCUID`,(e,t)=>{t.pattern??=rs,H.init(e,t)}),ic=L(`$ZodCUID2`,(e,t)=>{t.pattern??=is,H.init(e,t)}),ac=L(`$ZodULID`,(e,t)=>{t.pattern??=as,H.init(e,t)}),oc=L(`$ZodXID`,(e,t)=>{t.pattern??=os,H.init(e,t)}),sc=L(`$ZodKSUID`,(e,t)=>{t.pattern??=ss,H.init(e,t)}),cc=L(`$ZodISODateTime`,(e,t)=>{t.pattern??=Es(t),H.init(e,t)}),lc=L(`$ZodISODate`,(e,t)=>{t.pattern??=Cs,H.init(e,t)}),uc=L(`$ZodISOTime`,(e,t)=>{t.pattern??=Ts(t),H.init(e,t)}),dc=L(`$ZodISODuration`,(e,t)=>{t.pattern??=ls,H.init(e,t)}),fc=L(`$ZodIPv4`,(e,t)=>{t.pattern??=ms,H.init(e,t),e._zod.bag.format=`ipv4`}),pc=L(`$ZodIPv6`,(e,t)=>{t.pattern??=hs,H.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})}}}),mc=L(`$ZodCIDRv4`,(e,t)=>{t.pattern??=gs,H.init(e,t)}),hc=L(`$ZodCIDRv6`,(e,t)=>{t.pattern??=_s,H.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 gc(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const _c=L(`$ZodBase64`,(e,t)=>{t.pattern??=vs,H.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{gc(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function vc(e){if(!ys.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return gc(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const yc=L(`$ZodBase64URL`,(e,t)=>{t.pattern??=ys,H.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{vc(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),bc=L(`$ZodE164`,(e,t)=>{t.pattern??=xs,H.init(e,t)});function xc(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}}const Sc=L(`$ZodJWT`,(e,t)=>{H.init(e,t),e._zod.check=n=>{xc(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Cc=L(`$ZodNumber`,(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??ks,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}}),wc=L(`$ZodNumberFormat`,(e,t)=>{Is.init(e,t),Cc.init(e,t)}),Tc=L(`$ZodUnknown`,(e,t)=>{V.init(e,t),e._zod.parse=e=>e}),Ec=L(`$ZodNever`,(e,t)=>{V.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Dc(e,t,n){e.issues.length&&t.issues.push(...No(n,e.issues)),t.value[n]=e.value}const Oc=L(`$ZodArray`,(e,t)=>{V.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=>Dc(t,n,e))):Dc(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function kc(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...No(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 Ac(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=So(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function jc(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=>kc(e,n,i,t,u,d))):kc(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}const Mc=L(`$ZodObject`,(e,t)=>{if(V.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=io(()=>Ac(t));R(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=ho,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=>kc(n,t,e,s,r,i))):kc(a,t,e,s,r,i)}return i?jc(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Nc=L(`$ZodObjectJIT`,(e,t)=>{Mc.init(e,t);let n=e._zod.parse,r=io(()=>Ac(t)),i=e=>{let t=new Js([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=fo(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=fo(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
9
+ `))}};const _c={major:4,minor:4,patch:3},V=L(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=_c;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=$o(e),i;for(let a of t){if(a._zod.def.when){if(es(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new xo;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=$o(e,t))});else{if(e.issues.length===t)continue;r||=$o(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if($o(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new xo;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new xo;return o.then(e=>t(e,r,a))}return t(o,r,a)}}R(e,`~standard`,()=>({validate:t=>{try{let n=ms(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return gs(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),vc=L(`$ZodString`,(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ys(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}}),H=L(`$ZodStringFormat`,(e,t)=>{cc.init(e,t),vc.init(e,t)}),yc=L(`$ZodGUID`,(e,t)=>{t.pattern??=Ms,H.init(e,t)}),bc=L(`$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??=Ns(e)}else t.pattern??=Ns();H.init(e,t)}),xc=L(`$ZodEmail`,(e,t)=>{t.pattern??=Ps,H.init(e,t)}),Sc=L(`$ZodURL`,(e,t)=>{H.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Hs.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})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Cc=L(`$ZodEmoji`,(e,t)=>{t.pattern??=Fs(),H.init(e,t)}),wc=L(`$ZodNanoID`,(e,t)=>{t.pattern??=As,H.init(e,t)}),Tc=L(`$ZodCUID`,(e,t)=>{t.pattern??=Ts,H.init(e,t)}),Ec=L(`$ZodCUID2`,(e,t)=>{t.pattern??=Es,H.init(e,t)}),Dc=L(`$ZodULID`,(e,t)=>{t.pattern??=Ds,H.init(e,t)}),Oc=L(`$ZodXID`,(e,t)=>{t.pattern??=Os,H.init(e,t)}),kc=L(`$ZodKSUID`,(e,t)=>{t.pattern??=ks,H.init(e,t)}),Ac=L(`$ZodISODateTime`,(e,t)=>{t.pattern??=Js(t),H.init(e,t)}),jc=L(`$ZodISODate`,(e,t)=>{t.pattern??=Gs,H.init(e,t)}),Mc=L(`$ZodISOTime`,(e,t)=>{t.pattern??=qs(t),H.init(e,t)}),Nc=L(`$ZodISODuration`,(e,t)=>{t.pattern??=js,H.init(e,t)}),Pc=L(`$ZodIPv4`,(e,t)=>{t.pattern??=Is,H.init(e,t),e._zod.bag.format=`ipv4`}),Fc=L(`$ZodIPv6`,(e,t)=>{t.pattern??=Ls,H.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})}}}),Ic=L(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Rs,H.init(e,t)}),Lc=L(`$ZodCIDRv6`,(e,t)=>{t.pattern??=zs,H.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 Rc(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const zc=L(`$ZodBase64`,(e,t)=>{t.pattern??=Bs,H.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Rc(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Bc(e){if(!Vs.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Rc(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const Vc=L(`$ZodBase64URL`,(e,t)=>{t.pattern??=Vs,H.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Bc(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Hc=L(`$ZodE164`,(e,t)=>{t.pattern??=Us,H.init(e,t)});function Uc(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}}const Wc=L(`$ZodJWT`,(e,t)=>{H.init(e,t),e._zod.check=n=>{Uc(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Gc=L(`$ZodNumber`,(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??Zs,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}}),Kc=L(`$ZodNumberFormat`,(e,t)=>{ic.init(e,t),Gc.init(e,t)}),qc=L(`$ZodUnknown`,(e,t)=>{V.init(e,t),e._zod.parse=e=>e}),Jc=L(`$ZodNever`,(e,t)=>{V.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Yc(e,t,n){e.issues.length&&t.issues.push(...ts(n,e.issues)),t.value[n]=e.value}const Xc=L(`$ZodArray`,(e,t)=>{V.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=>Yc(t,n,e))):Yc(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Zc(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...ts(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 Qc(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=Wo(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function $c(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=>Zc(e,n,i,t,u,d))):Zc(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}const el=L(`$ZodObject`,(e,t)=>{if(V.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=Do(()=>Qc(t));R(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=Lo,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=>Zc(n,t,e,s,r,i))):Zc(a,t,e,s,r,i)}return i?$c(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),tl=L(`$ZodObjectJIT`,(e,t)=>{el.init(e,t);let n=e._zod.parse,r=Do(()=>Qc(t)),i=e=>{let t=new gc([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Po(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=Po(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
10
10
  if (${n}.issues.length) {
11
11
  if (${o} in input) {
12
12
  payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
@@ -65,19 +65,25 @@ import{Command as e}from"commander";import{setTimeout as t}from"node:timers/prom
65
65
  }
66
66
  }
67
67
 
68
- `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=ho,s=!eo.jitless,c=s&&go.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?jc([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Pc(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=>!jo(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=>Fo(e,r,to())))}),t)}const Fc=L(`$ZodUnion`,(e,t)=>{V.init(e,t),R(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),R(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),R(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),R(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=>oo(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=>Pc(t,r,e,i)):Pc(o,r,e,i)}}),Ic=L(`$ZodIntersection`,(e,t)=>{V.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])=>Rc(e,t,n)):Rc(e,i,a)}});function Lc(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(_o(e)&&_o(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=Lc(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=Lc(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 Rc(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}),jo(e))return e;let o=Lc(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const zc=L(`$ZodEnum`,(e,t)=>{V.init(e,t);let n=no(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>yo.has(typeof e)).map(e=>typeof e==`string`?bo(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}}),Bc=L(`$ZodTransform`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new $a(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new Qa;return n.value=i,n.fallback=!0,n}});function Vc(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Hc=L(`$ZodOptional`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,R(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),R(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${oo(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=>Vc(e,r)):Vc(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Uc=L(`$ZodExactOptional`,(e,t)=>{Hc.init(e,t),R(e._zod,`values`,()=>t.innerType._zod.values),R(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Wc=L(`$ZodNullable`,(e,t)=>{V.init(e,t),R(e._zod,`optin`,()=>t.innerType._zod.optin),R(e._zod,`optout`,()=>t.innerType._zod.optout),R(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${oo(e.source)}|null)$`):void 0}),R(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)}),Gc=L(`$ZodDefault`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,R(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=>Kc(e,t)):Kc(r,t)}});function Kc(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const qc=L(`$ZodPrefault`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,R(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))}),Jc=L(`$ZodNonOptional`,(e,t)=>{V.init(e,t),R(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=>Yc(t,e)):Yc(i,e)}});function Yc(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const Xc=L(`$ZodCatch`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,R(e._zod,`optout`,()=>t.innerType._zod.optout),R(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=>Fo(e,n,to()))},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=>Fo(e,n,to()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Zc=L(`$ZodPipe`,(e,t)=>{V.init(e,t),R(e._zod,`values`,()=>t.in._zod.values),R(e._zod,`optin`,()=>t.in._zod.optin),R(e._zod,`optout`,()=>t.out._zod.optout),R(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=>Qc(e,t.in,n)):Qc(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Qc(e,t.out,n)):Qc(r,t.out,n)}});function Qc(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const $c=L(`$ZodReadonly`,(e,t)=>{V.init(e,t),R(e._zod,`propValues`,()=>t.innerType._zod.propValues),R(e._zod,`values`,()=>t.innerType._zod.values),R(e._zod,`optin`,()=>t.innerType?._zod?.optin),R(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(el):el(r)}});function el(e){return e.value=Object.freeze(e.value),e}const tl=L(`$ZodCustom`,(e,t)=>{B.init(e,t),V.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=>nl(t,n,r,e));nl(i,n,r,e)}});function nl(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(Lo(e))}}var rl,il=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 al(){return new il}(rl=globalThis).__zod_globalRegistry??(rl.__zod_globalRegistry=al());const ol=globalThis.__zod_globalRegistry;function sl(e,t){return new e({type:`string`,...z(t)})}function cl(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...z(t)})}function ll(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...z(t)})}function ul(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...z(t)})}function dl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...z(t)})}function fl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...z(t)})}function pl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...z(t)})}function ml(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...z(t)})}function hl(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...z(t)})}function gl(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...z(t)})}function _l(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...z(t)})}function vl(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...z(t)})}function yl(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...z(t)})}function bl(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...z(t)})}function xl(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...z(t)})}function Sl(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...z(t)})}function Cl(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...z(t)})}function wl(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...z(t)})}function Tl(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...z(t)})}function El(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...z(t)})}function Dl(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...z(t)})}function Ol(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...z(t)})}function kl(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...z(t)})}function Al(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...z(t)})}function jl(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...z(t)})}function Ml(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...z(t)})}function Nl(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...z(t)})}function Pl(e,t){return new e({type:`number`,checks:[],...z(t)})}function Fl(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...z(t)})}function Il(e){return new e({type:`unknown`})}function Ll(e,t){return new e({type:`never`,...z(t)})}function Rl(e,t){return new Ns({check:`less_than`,...z(t),value:e,inclusive:!1})}function zl(e,t){return new Ns({check:`less_than`,...z(t),value:e,inclusive:!0})}function Bl(e,t){return new Ps({check:`greater_than`,...z(t),value:e,inclusive:!1})}function Vl(e,t){return new Ps({check:`greater_than`,...z(t),value:e,inclusive:!0})}function Hl(e,t){return new Fs({check:`multiple_of`,...z(t),value:e})}function Ul(e,t){return new Ls({check:`max_length`,...z(t),maximum:e})}function Wl(e,t){return new Rs({check:`min_length`,...z(t),minimum:e})}function Gl(e,t){return new zs({check:`length_equals`,...z(t),length:e})}function Kl(e,t){return new Vs({check:`string_format`,format:`regex`,...z(t),pattern:e})}function ql(e){return new Hs({check:`string_format`,format:`lowercase`,...z(e)})}function Jl(e){return new Us({check:`string_format`,format:`uppercase`,...z(e)})}function Yl(e,t){return new Ws({check:`string_format`,format:`includes`,...z(t),includes:e})}function Xl(e,t){return new Gs({check:`string_format`,format:`starts_with`,...z(t),prefix:e})}function Zl(e,t){return new Ks({check:`string_format`,format:`ends_with`,...z(t),suffix:e})}function Ql(e){return new qs({check:`overwrite`,tx:e})}function $l(e){return Ql(t=>t.normalize(e))}function eu(){return Ql(e=>e.trim())}function tu(){return Ql(e=>e.toLowerCase())}function nu(){return Ql(e=>e.toUpperCase())}function ru(){return Ql(e=>po(e))}function iu(e,t,n){return new e({type:`array`,element:t,...z(n)})}function au(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...z(n)})}function ou(e,t){let n=su(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Lo(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(Lo(r))}},e(t.value,t)),t);return n}function su(e,t){let n=new B({check:`custom`,...z(t)});return n._zod.check=e,n}function cu(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??ol,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 U(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,U(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`&&W(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 lu(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>
68
+ `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Lo,s=!Co.jitless,c=s&&Ro.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?$c([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function nl(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=>!$o(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=>rs(e,r,wo())))}),t)}const rl=L(`$ZodUnion`,(e,t)=>{V.init(e,t),R(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),R(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),R(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),R(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=>ko(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=>nl(t,r,e,i)):nl(o,r,e,i)}}),il=L(`$ZodIntersection`,(e,t)=>{V.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])=>ol(e,t,n)):ol(e,i,a)}});function al(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(zo(e)&&zo(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=al(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=al(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 ol(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}),$o(e))return e;let o=al(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const sl=L(`$ZodEnum`,(e,t)=>{V.init(e,t);let n=To(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Vo.has(typeof e)).map(e=>typeof e==`string`?Ho(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}}),cl=L(`$ZodTransform`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new So(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new xo;return n.value=i,n.fallback=!0,n}});function ll(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const ul=L(`$ZodOptional`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,R(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),R(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ko(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=>ll(e,r)):ll(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),dl=L(`$ZodExactOptional`,(e,t)=>{ul.init(e,t),R(e._zod,`values`,()=>t.innerType._zod.values),R(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),fl=L(`$ZodNullable`,(e,t)=>{V.init(e,t),R(e._zod,`optin`,()=>t.innerType._zod.optin),R(e._zod,`optout`,()=>t.innerType._zod.optout),R(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ko(e.source)}|null)$`):void 0}),R(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)}),pl=L(`$ZodDefault`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,R(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=>ml(e,t)):ml(r,t)}});function ml(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const hl=L(`$ZodPrefault`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,R(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))}),gl=L(`$ZodNonOptional`,(e,t)=>{V.init(e,t),R(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=>_l(t,e)):_l(i,e)}});function _l(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const vl=L(`$ZodCatch`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,R(e._zod,`optout`,()=>t.innerType._zod.optout),R(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=>rs(e,n,wo()))},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=>rs(e,n,wo()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),yl=L(`$ZodPipe`,(e,t)=>{V.init(e,t),R(e._zod,`values`,()=>t.in._zod.values),R(e._zod,`optin`,()=>t.in._zod.optin),R(e._zod,`optout`,()=>t.out._zod.optout),R(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=>bl(e,t.in,n)):bl(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>bl(e,t.out,n)):bl(r,t.out,n)}});function bl(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const xl=L(`$ZodReadonly`,(e,t)=>{V.init(e,t),R(e._zod,`propValues`,()=>t.innerType._zod.propValues),R(e._zod,`values`,()=>t.innerType._zod.values),R(e._zod,`optin`,()=>t.innerType?._zod?.optin),R(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(Sl):Sl(r)}});function Sl(e){return e.value=Object.freeze(e.value),e}const Cl=L(`$ZodCustom`,(e,t)=>{B.init(e,t),V.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=>wl(t,n,r,e));wl(i,n,r,e)}});function wl(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(as(e))}}var Tl,El=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 Dl(){return new El}(Tl=globalThis).__zod_globalRegistry??(Tl.__zod_globalRegistry=Dl());const Ol=globalThis.__zod_globalRegistry;function kl(e,t){return new e({type:`string`,...z(t)})}function Al(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...z(t)})}function jl(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...z(t)})}function Ml(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...z(t)})}function Nl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...z(t)})}function Pl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...z(t)})}function Fl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...z(t)})}function Il(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...z(t)})}function Ll(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...z(t)})}function Rl(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...z(t)})}function zl(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...z(t)})}function Bl(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...z(t)})}function Vl(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...z(t)})}function Hl(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...z(t)})}function Ul(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...z(t)})}function Wl(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...z(t)})}function Gl(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...z(t)})}function Kl(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...z(t)})}function ql(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...z(t)})}function Jl(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...z(t)})}function Yl(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...z(t)})}function Xl(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...z(t)})}function Zl(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...z(t)})}function Ql(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...z(t)})}function $l(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...z(t)})}function eu(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...z(t)})}function tu(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...z(t)})}function nu(e,t){return new e({type:`number`,checks:[],...z(t)})}function ru(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...z(t)})}function iu(e){return new e({type:`unknown`})}function au(e,t){return new e({type:`never`,...z(t)})}function ou(e,t){return new tc({check:`less_than`,...z(t),value:e,inclusive:!1})}function su(e,t){return new tc({check:`less_than`,...z(t),value:e,inclusive:!0})}function cu(e,t){return new nc({check:`greater_than`,...z(t),value:e,inclusive:!1})}function lu(e,t){return new nc({check:`greater_than`,...z(t),value:e,inclusive:!0})}function uu(e,t){return new rc({check:`multiple_of`,...z(t),value:e})}function du(e,t){return new ac({check:`max_length`,...z(t),maximum:e})}function fu(e,t){return new oc({check:`min_length`,...z(t),minimum:e})}function pu(e,t){return new sc({check:`length_equals`,...z(t),length:e})}function mu(e,t){return new lc({check:`string_format`,format:`regex`,...z(t),pattern:e})}function hu(e){return new uc({check:`string_format`,format:`lowercase`,...z(e)})}function gu(e){return new dc({check:`string_format`,format:`uppercase`,...z(e)})}function _u(e,t){return new fc({check:`string_format`,format:`includes`,...z(t),includes:e})}function vu(e,t){return new pc({check:`string_format`,format:`starts_with`,...z(t),prefix:e})}function yu(e,t){return new mc({check:`string_format`,format:`ends_with`,...z(t),suffix:e})}function bu(e){return new hc({check:`overwrite`,tx:e})}function xu(e){return bu(t=>t.normalize(e))}function Su(){return bu(e=>e.trim())}function Cu(){return bu(e=>e.toLowerCase())}function wu(){return bu(e=>e.toUpperCase())}function Tu(){return bu(e=>Fo(e))}function Eu(e,t,n){return new e({type:`array`,element:t,...z(n)})}function Du(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...z(n)})}function Ou(e,t){let n=ku(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(as(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(as(r))}},e(t.value,t)),t);return n}function ku(e,t){let n=new B({check:`custom`,...z(t)});return n._zod.check=e,n}function Au(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??Ol,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 U(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,U(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`&&W(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 ju(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>
69
69
 
70
- 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 uu(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:fu(t,`input`,e.processors),output:fu(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function W(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 W(r.element,n);if(r.type===`set`)return W(r.valueType,n);if(r.type===`lazy`)return W(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 W(r.innerType,n);if(r.type===`intersection`)return W(r.left,n)||W(r.right,n);if(r.type===`record`||r.type===`map`)return W(r.keyType,n)||W(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:W(r.in,n)||W(r.out,n);if(r.type===`object`){for(let e in r.shape)if(W(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(W(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(W(e,n))return!0;return!!(r.rest&&W(r.rest,n))}return!1}const du=(e,t={})=>n=>{let r=cu({...n,processors:t});return U(e,r),lu(r,e),uu(r,e)},fu=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=cu({...i??{},target:a,io:t,processors:n});return U(e,o),lu(o,e),uu(o,e)},pu={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},mu=(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=pu[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}))])}},hu=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},gu=(e,t,n,r)=>{n.not={}},_u=(e,t,n,r)=>{let i=e._zod.def,a=no(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},vu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},yu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},bu=(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=U(a.element,t,{...r,path:[...r.path,`items`]})},xu=(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]=U(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=U(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Su=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>U(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Cu=(e,t,n,r)=>{let i=e._zod.def,a=U(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=U(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]]},wu=(e,t,n,r)=>{let i=e._zod.def,a=U(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`}]},Tu=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Eu=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Du=(e,t,n,r)=>{let i=e._zod.def;U(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)))},Ou=(e,t,n,r)=>{let i=e._zod.def;U(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},ku=(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;U(o,t,r);let s=t.seen.get(e);s.ref=o},Au=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ju=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Mu=L(`ZodISODateTime`,(e,t)=>{cc.init(e,t),J.init(e,t)});function Nu(e){return Al(Mu,e)}const Pu=L(`ZodISODate`,(e,t)=>{lc.init(e,t),J.init(e,t)});function Fu(e){return jl(Pu,e)}const Iu=L(`ZodISOTime`,(e,t)=>{uc.init(e,t),J.init(e,t)});function Lu(e){return Ml(Iu,e)}const Ru=L(`ZodISODuration`,(e,t)=>{dc.init(e,t),J.init(e,t)});function zu(e){return Nl(Ru,e)}const G=L(`ZodError`,(e,t)=>{zo.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ho(e,t)},flatten:{value:t=>Vo(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ro,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ro,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Bu=Uo(G),Vu=Wo(G),Hu=Go(G),Uu=qo(G),Wu=Yo(G),Gu=Xo(G),Ku=Zo(G),qu=Qo(G),Ju=$o(G),Yu=es(G),Xu=ts(G),Zu=ns(G),Qu=new WeakMap;function $u(e,t,n){let r=Object.getPrototypeOf(e),i=Qu.get(r);if(i||(i=new Set,Qu.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})}})}}}const K=L(`ZodType`,(e,t)=>(V.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:fu(e,`input`),output:fu(e,`output`)}}),e.toJSONSchema=du(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Bu(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Hu(e,t,n),e.parseAsync=async(t,n)=>Vu(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Uu(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Wu(e,t,n),e.decode=(t,n)=>Gu(e,t,n),e.encodeAsync=async(t,n)=>Ku(e,t,n),e.decodeAsync=async(t,n)=>qu(e,t,n),e.safeEncode=(t,n)=>Ju(e,t,n),e.safeDecode=(t,n)=>Yu(e,t,n),e.safeEncodeAsync=async(t,n)=>Xu(e,t,n),e.safeDecodeAsync=async(t,n)=>Zu(e,t,n),$u(e,`ZodType`,{check(...e){let t=this.def;return this.clone(uo(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 xo(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(sf(e,t))},superRefine(e,t){return this.check(cf(e,t))},overwrite(e){return this.check(Ql(e))},optional(){return Hd(this)},exactOptional(){return Wd(this)},nullable(){return Kd(this)},nullish(){return Hd(Kd(this))},nonoptional(e){return Qd(this,e)},array(){return Ad(this)},or(e){return Pd([this,e])},and(e){return Id(this,e)},transform(e){return nf(this,Bd(e))},default(e){return Jd(this,e)},prefault(e){return Xd(this,e)},catch(e){return ef(this,e)},pipe(e){return nf(this,e)},readonly(){return af(this)},describe(e){let t=this.clone();return ol.add(t,{description:e}),t},meta(...e){if(e.length===0)return ol.get(this);let t=this.clone();return ol.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 ol.get(e)?.description},configurable:!0}),e)),ed=L(`_ZodString`,(e,t)=>{Xs.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mu(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,$u(e,`_ZodString`,{regex(...e){return this.check(Kl(...e))},includes(...e){return this.check(Yl(...e))},startsWith(...e){return this.check(Xl(...e))},endsWith(...e){return this.check(Zl(...e))},min(...e){return this.check(Wl(...e))},max(...e){return this.check(Ul(...e))},length(...e){return this.check(Gl(...e))},nonempty(...e){return this.check(Wl(1,...e))},lowercase(e){return this.check(ql(e))},uppercase(e){return this.check(Jl(e))},trim(){return this.check(eu())},normalize(...e){return this.check($l(...e))},toLowerCase(){return this.check(tu())},toUpperCase(){return this.check(nu())},slugify(){return this.check(ru())}})}),td=L(`ZodString`,(e,t)=>{Xs.init(e,t),ed.init(e,t),e.email=t=>e.check(cl(nd,t)),e.url=t=>e.check(ml(ad,t)),e.jwt=t=>e.check(kl(bd,t)),e.emoji=t=>e.check(hl(od,t)),e.guid=t=>e.check(ll(rd,t)),e.uuid=t=>e.check(ul(id,t)),e.uuidv4=t=>e.check(dl(id,t)),e.uuidv6=t=>e.check(fl(id,t)),e.uuidv7=t=>e.check(pl(id,t)),e.nanoid=t=>e.check(gl(sd,t)),e.guid=t=>e.check(ll(rd,t)),e.cuid=t=>e.check(_l(cd,t)),e.cuid2=t=>e.check(vl(ld,t)),e.ulid=t=>e.check(yl(ud,t)),e.base64=t=>e.check(El(_d,t)),e.base64url=t=>e.check(Dl(vd,t)),e.xid=t=>e.check(bl(dd,t)),e.ksuid=t=>e.check(xl(fd,t)),e.ipv4=t=>e.check(Sl(pd,t)),e.ipv6=t=>e.check(Cl(md,t)),e.cidrv4=t=>e.check(wl(hd,t)),e.cidrv6=t=>e.check(Tl(gd,t)),e.e164=t=>e.check(Ol(yd,t)),e.datetime=t=>e.check(Nu(t)),e.date=t=>e.check(Fu(t)),e.time=t=>e.check(Lu(t)),e.duration=t=>e.check(zu(t))});function q(e){return sl(td,e)}const J=L(`ZodStringFormat`,(e,t)=>{H.init(e,t),ed.init(e,t)}),nd=L(`ZodEmail`,(e,t)=>{$s.init(e,t),J.init(e,t)}),rd=L(`ZodGUID`,(e,t)=>{Zs.init(e,t),J.init(e,t)}),id=L(`ZodUUID`,(e,t)=>{Qs.init(e,t),J.init(e,t)}),ad=L(`ZodURL`,(e,t)=>{ec.init(e,t),J.init(e,t)}),od=L(`ZodEmoji`,(e,t)=>{tc.init(e,t),J.init(e,t)}),sd=L(`ZodNanoID`,(e,t)=>{nc.init(e,t),J.init(e,t)}),cd=L(`ZodCUID`,(e,t)=>{rc.init(e,t),J.init(e,t)}),ld=L(`ZodCUID2`,(e,t)=>{ic.init(e,t),J.init(e,t)}),ud=L(`ZodULID`,(e,t)=>{ac.init(e,t),J.init(e,t)}),dd=L(`ZodXID`,(e,t)=>{oc.init(e,t),J.init(e,t)}),fd=L(`ZodKSUID`,(e,t)=>{sc.init(e,t),J.init(e,t)}),pd=L(`ZodIPv4`,(e,t)=>{fc.init(e,t),J.init(e,t)}),md=L(`ZodIPv6`,(e,t)=>{pc.init(e,t),J.init(e,t)}),hd=L(`ZodCIDRv4`,(e,t)=>{mc.init(e,t),J.init(e,t)}),gd=L(`ZodCIDRv6`,(e,t)=>{hc.init(e,t),J.init(e,t)}),_d=L(`ZodBase64`,(e,t)=>{_c.init(e,t),J.init(e,t)}),vd=L(`ZodBase64URL`,(e,t)=>{yc.init(e,t),J.init(e,t)}),yd=L(`ZodE164`,(e,t)=>{bc.init(e,t),J.init(e,t)}),bd=L(`ZodJWT`,(e,t)=>{Sc.init(e,t),J.init(e,t)}),xd=L(`ZodNumber`,(e,t)=>{Cc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hu(e,t,n,r),$u(e,`ZodNumber`,{gt(e,t){return this.check(Bl(e,t))},gte(e,t){return this.check(Vl(e,t))},min(e,t){return this.check(Vl(e,t))},lt(e,t){return this.check(Rl(e,t))},lte(e,t){return this.check(zl(e,t))},max(e,t){return this.check(zl(e,t))},int(e){return this.check(wd(e))},safe(e){return this.check(wd(e))},positive(e){return this.check(Bl(0,e))},nonnegative(e){return this.check(Vl(0,e))},negative(e){return this.check(Rl(0,e))},nonpositive(e){return this.check(zl(0,e))},multipleOf(e,t){return this.check(Hl(e,t))},step(e,t){return this.check(Hl(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 Sd(e){return Pl(xd,e)}const Cd=L(`ZodNumberFormat`,(e,t)=>{wc.init(e,t),xd.init(e,t)});function wd(e){return Fl(Cd,e)}const Td=L(`ZodUnknown`,(e,t)=>{Tc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ed(){return Il(Td)}const Dd=L(`ZodNever`,(e,t)=>{Ec.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gu(e,t,n,r)});function Od(e){return Ll(Dd,e)}const kd=L(`ZodArray`,(e,t)=>{Oc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bu(e,t,n,r),e.element=t.element,$u(e,`ZodArray`,{min(e,t){return this.check(Wl(e,t))},nonempty(e){return this.check(Wl(1,e))},max(e,t){return this.check(Ul(e,t))},length(e,t){return this.check(Gl(e,t))},unwrap(){return this.element}})});function Ad(e,t){return iu(kd,e,t)}const jd=L(`ZodObject`,(e,t)=>{Nc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xu(e,t,n,r),R(e,`shape`,()=>t.shape),$u(e,`ZodObject`,{keyof(){return Rd(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Ed()})},loose(){return this.clone({...this._zod.def,catchall:Ed()})},strict(){return this.clone({...this._zod.def,catchall:Od()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Eo(this,e)},safeExtend(e){return Do(this,e)},merge(e){return Oo(this,e)},pick(e){return wo(this,e)},omit(e){return To(this,e)},partial(...e){return ko(Vd,this,e[0])},required(...e){return Ao(Zd,this,e[0])}})});function Md(e,t){return new jd({type:`object`,shape:e??{},...z(t)})}const Nd=L(`ZodUnion`,(e,t)=>{Fc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Su(e,t,n,r),e.options=t.options});function Pd(e,t){return new Nd({type:`union`,options:e,...z(t)})}const Fd=L(`ZodIntersection`,(e,t)=>{Ic.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cu(e,t,n,r)});function Id(e,t){return new Fd({type:`intersection`,left:e,right:t})}const Ld=L(`ZodEnum`,(e,t)=>{zc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_u(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 Ld({...t,checks:[],...z(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 Ld({...t,checks:[],...z(r),entries:i})}});function Rd(e,t){return new Ld({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...z(t)})}const zd=L(`ZodTransform`,(e,t)=>{Bc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yu(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(Lo(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(Lo(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 Bd(e){return new zd({type:`transform`,transform:e})}const Vd=L(`ZodOptional`,(e,t)=>{Hc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ju(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Hd(e){return new Vd({type:`optional`,innerType:e})}const Ud=L(`ZodExactOptional`,(e,t)=>{Uc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ju(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Wd(e){return new Ud({type:`optional`,innerType:e})}const Gd=L(`ZodNullable`,(e,t)=>{Wc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Kd(e){return new Gd({type:`nullable`,innerType:e})}const qd=L(`ZodDefault`,(e,t)=>{Gc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Jd(e,t){return new qd({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():vo(t)}})}const Yd=L(`ZodPrefault`,(e,t)=>{qc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Du(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Xd(e,t){return new Yd({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():vo(t)}})}const Zd=L(`ZodNonOptional`,(e,t)=>{Jc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Qd(e,t){return new Zd({type:`nonoptional`,innerType:e,...z(t)})}const $d=L(`ZodCatch`,(e,t)=>{Xc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ou(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ef(e,t){return new $d({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const tf=L(`ZodPipe`,(e,t)=>{Zc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ku(e,t,n,r),e.in=t.in,e.out=t.out});function nf(e,t){return new tf({type:`pipe`,in:e,out:t})}const rf=L(`ZodReadonly`,(e,t)=>{$c.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Au(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function af(e){return new rf({type:`readonly`,innerType:e})}const of=L(`ZodCustom`,(e,t)=>{tl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vu(e,t,n,r)});function sf(e,t={}){return au(of,e,t)}function cf(e,t){return ou(e,t)}const lf=Md({href:q(),rel:q(),sizes:q().optional(),type:q().optional()});Md({applicationName:q().optional(),author:q().optional(),canonical:q().optional(),colorScheme:q().optional(),description:q().optional(),favicons:Ad(lf).optional(),formatDetection:q().optional(),generator:q().optional(),keywords:q().optional(),license:q().optional(),"og:description":q().optional(),"og:image":q().optional(),"og:image:height":q().optional(),"og:image:type":q().optional(),"og:image:width":q().optional(),"og:locale":q().optional(),"og:site_name":q().optional(),"og:title":q().optional(),"og:type":q().optional(),"og:url":q().optional(),rawHead:q().optional(),robots:q().optional(),themeColor:q().optional(),themeColorDark:q().optional(),themeColorLight:q().optional(),title:q().optional(),"twitter:card":q().optional(),"twitter:creator":q().optional(),"twitter:description":q().optional(),"twitter:image":q().optional(),"twitter:site":q().optional(),"twitter:title":q().optional(),viewport:q().optional()}).loose(),Md({height:Sd().optional(),size:Sd().optional(),type:q().optional(),url:q(),width:Sd().optional()}),Md({content:q().optional(),error:q().optional()});const uf=Md({changefreq:q().optional(),lastmod:q().optional(),loc:q(),priority:q().optional()});Md({content:q().optional(),error:q().optional(),urls:Ad(uf).optional()});const df=`~effect/BigDecimal`,ff={[df]:df,[g](){let e=yf(this);return v(_(e.value),me(e.scale))},[b](e){return pf(e)&&Cf(this,e)},toString(){return`BigDecimal(${wf(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[Qe](){return this.toJSON()},pipe(){return c(this,arguments)}},pf=e=>h(e,df),mf=(e,t)=>{let n=Object.create(ff);return n.value=e,n.scale=t,n},hf=(e,t)=>{if(e!==gf&&e%_f===gf)throw RangeError(`Value must be normalized`);let n=mf(e,t);return n.normalized=n,n},gf=BigInt(0),_f=BigInt(10),vf=hf(gf,0),yf=e=>{if(e.normalized===void 0)if(e.value===gf)e.normalized=vf;else{let t=`${e.value}`,n=0;for(let e=t.length-1;e>=0&&t[e]===`0`;e--)n++;n===0&&(e.normalized=e),e.normalized=hf(BigInt(t.substring(0,t.length-n)),e.scale-n)}return e.normalized},bf=d(2,(e,t)=>t>e.scale?mf(e.value*_f**BigInt(t-e.scale),t):t<e.scale?mf(e.value/_f**BigInt(e.scale-t),t):e),xf=e=>e.value<gf?mf(-e.value,e.scale):e,Sf=Ht((e,t)=>e.scale>t.scale?bf(t,e.scale).value===e.value:e.scale<t.scale?bf(e,t.scale).value===t.value:e.value===t.value),Cf=d(2,(e,t)=>Sf(e,t)),wf=e=>{let t=yf(e);if(Math.abs(t.scale)>=16)return Tf(t);let n=t.value<gf,r=n?`${t.value}`.substring(1):`${t.value}`,i,a;if(t.scale>=r.length)i=`0`,a=`0`.repeat(t.scale-r.length)+r;else{let e=r.length-t.scale;if(e>r.length){let t=e-r.length;i=`${r}${`0`.repeat(t)}`,a=``}else a=r.slice(e),i=r.slice(0,e)}let o=a===``?i:`${i}.${a}`;return n?`-${o}`:o},Tf=e=>{if(Ef(e))return`0e+0`;let t=yf(e),n=`${xf(t).value}`,r=n.slice(0,1),i=n.slice(1),a=`${Df(t)?`-`:``}${r}`;i!==``&&(a+=`.${i}`);let o=i.length-t.scale;return`${a}e${o>=0?`+`:``}${o}`},Ef=e=>e.value===gf,Df=e=>e.value<gf;mn()(`effect/DateTime/CurrentTimeZone`),Hi(`EncodingError`);function Of(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function kf(e){return t=>Of(t)?.[e]}const Af=kf(`identifier`),jf=m(e=>{let t=Af(e);return typeof t==`string`?t:e.getExpected(jf)});function Mf(e,t,n){return t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n,e}globalThis.RegExp;const Nf=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,`\\$&`),Pf=`~effect/SchemaIssue/Issue`;function Ff(e){return h(e,Pf)}var Y=class{[Pf]=Pf;toString(){return ep(this)}},If=class extends Y{_tag=`Filter`;actual;filter;issue;constructor(e,t,n){super(),this.actual=e,this.filter=t,this.issue=n}},Lf=class extends Y{_tag=`Encoding`;ast;actual;issue;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issue=n}},Rf=class extends Y{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},zf=class extends Y{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},Bf=class extends Y{_tag=`UnexpectedKey`;ast;actual;constructor(e,t){super(),this.ast=e,this.actual=t}},X=class extends Y{_tag=`Composite`;ast;actual;issues;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issues=n}},Vf=class extends Y{_tag=`InvalidType`;ast;actual;constructor(e,t){super(),this.ast=e,this.actual=t}},Hf=class extends Y{_tag=`InvalidValue`;actual;annotations;constructor(e,t){super(),this.actual=e,this.annotations=t}},Uf=class extends Y{_tag=`AnyOf`;ast;actual;issues;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issues=n}},Wf=class extends Y{_tag=`OneOf`;ast;actual;successes;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.successes=n}};function Gf(e,t){if(Ff(t))return t;if(typeof t==`string`)return new Hf(k(e),{message:t});let n=typeof t.issue==`string`?new Hf(k(e),{message:t.issue}):t.issue;return new Rf(t.path,n)}function Kf(e,t){if(t!==void 0)return typeof t==`boolean`?t?void 0:new Hf(k(e)):Gf(e,t)}function qf(e,t,n){return Array.isArray(n)?Vn(n)?n.length===1?Gf(e,n[0]):new X(t,k(e),Jn(n,t=>Gf(e,t))):void 0:Kf(e,n)}const Jf=e=>{let t=np(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return Xf(jf(e.ast),ip(e.actual));case`InvalidValue`:return`Invalid data ${ip(e.actual)}`;case`MissingKey`:return`Missing key`;case`UnexpectedKey`:return`Unexpected key with value ${S(e.actual)}`;case`Forbidden`:return`Forbidden operation`;case`OneOf`:return`Expected exactly one member to match the input ${S(e.actual)}`}},Yf=e=>np(e.issue)??np(e);function Xf(e,t){return`Expected ${e}, got ${t}`}function Zf(e,t,n,r){switch(e._tag){case`Filter`:{let i=r(e);if(i!==void 0)return[{path:t,message:i}];switch(e.issue._tag){case`InvalidValue`:return[{path:t,message:Xf(Qf(e.filter),S(e.actual))}];default:return Zf(e.issue,t,n,r)}}case`Encoding`:return Zf(e.issue,t,n,r);case`Pointer`:return Zf(e.issue,[...t,...e.path],n,r);case`Composite`:return e.issues.flatMap(e=>Zf(e,t,n,r));case`AnyOf`:{let i=np(e);return e.issues.length===0?i===void 0?[{path:t,message:Xf(jf(e.ast),S(e.actual))}]:[{path:t,message:i}]:e.issues.flatMap(e=>Zf(e,t,n,r))}default:return[{path:t,message:n(e)}]}}function Qf(e){let t=e.annotations?.expected;if(typeof t==`string`)return t;switch(e._tag){case`Filter`:return`<filter>`;case`FilterGroup`:return e.checks.map(e=>Qf(e)).join(` & `)}}function $f(){return e=>Zf(e,[],Jf,Yf).map(tp).join(`
71
- `)}const ep=$f();function tp(e){let t=e.message;if(e.path&&e.path.length>0){let n=Ye(e.path);t+=`\n at ${n}`}return t}function np(e){switch(e._tag){case`InvalidType`:case`OneOf`:case`Composite`:case`AnyOf`:return rp(e.ast.annotations);case`InvalidValue`:case`Forbidden`:return rp(e.annotations);case`MissingKey`:return rp(e.annotations,`messageMissingKey`);case`UnexpectedKey`:return rp(e.ast.annotations,`messageUnexpectedKey`);case`Filter`:return rp(e.filter.annotations);case`Encoding`:return np(e.issue)}}function rp(e,t=`message`){let n=e?.[t];if(typeof n==`string`)return n}function ip(e){return un(e)?`no value provided`:S(e.value)}var ap=class e extends u{run;constructor(e){super(),this.run=e}map(t){return new e((e,n)=>this.run(e,n).pipe(aa(fn(t))))}compose(t){return sp(this)?t:sp(t)?this:new e((e,n)=>this.run(e,n).pipe(sa(e=>t.run(e,n))))}};const op=new ap(N);function sp(e){return e.run===op.run}function cp(){return op}function lp(e){return up(fn(e))}function up(e){return new ap(t=>N(e(t)))}function dp(){return lp(globalThis.String)}function fp(){return lp(globalThis.Number)}const pp=`~effect/SchemaTransformation/Transformation`;var mp=class e{[pp]=pp;_tag=`Transformation`;decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new e(this.encode,this.decode)}compose(t){return new e(this.decode.compose(t.decode),t.encode.compose(this.encode))}};function hp(e){return h(e,pp)}const gp=e=>hp(e)?e:new mp(e.decode,e.encode),_p=new mp(cp(),cp());function vp(){return _p}const yp=new mp(fp(),dp());function bp(e){return t=>t._tag===e}const xp=bp(`Declaration`),Sp=bp(`Never`),Cp=bp(`Literal`),wp=bp(`UniqueSymbol`),Tp=bp(`Arrays`),Ep=bp(`Objects`),Dp=bp(`Union`);var Z=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}};const Op={};var kp=class{isOptional;isMutable;defaultValue;annotations;constructor(e,t,n=void 0,r=void 0){this.isOptional=e,this.isMutable=t,this.defaultValue=n,this.annotations=r}};const Ap=`~effect/Schema`;var jp=class{[Ap]=Ap;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,r=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=r}toString(){return`<${this._tag}>`}},Mp=class e extends jp{_tag=`Declaration`;typeParameters;run;constructor(e,t,n,r,i,a){super(n,r,i,a),this.typeParameters=e,this.run=t}getParser(){let e=this.run(this.typeParameters);return(t,n)=>un(t)?Xi:aa(e(t.value,this,n),k)}recur(t){let n=Em(this.typeParameters,t);return n===this.typeParameters?this:new e(n,this.run,this.annotations,this.checks,void 0,this.context)}getExpected(){let e=this.annotations?.expected;return typeof e==`string`?e:`<Declaration>`}},Np=class extends jp{_tag=`Literal`;literal;constructor(e,t,n,r,i){if(super(t,n,r,i),typeof e==`number`&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${S(e)}`);this.literal=e}getParser(){return Vm(this,this.literal)}toCodecJson(){return typeof this.literal==`bigint`?Pp(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:Pp(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function Pp(e){let t=globalThis.String(e.literal);return Q(e,[new Z(new Np(t),new mp(lp(()=>e.literal),lp(()=>t)))])}const Fp=new class extends jp{_tag=`String`;getParser(){return Hm(this,ie)}getExpected(){return`string`}};var Ip=class extends jp{_tag=`Number`;getParser(){return Hm(this,ae)}toCodecJson(){return this.checks&&(Lp(this.checks,`isFinite`)||Lp(this.checks,`isInt`))?this:Q(this,[dm])}toCodecStringTree(){return this.checks&&(Lp(this.checks,`isFinite`)||Lp(this.checks,`isInt`))?Q(this,[Ym]):Q(this,[Xm])}getExpected(){return`number`}};function Lp(e,t){return e.some(e=>{switch(e._tag){case`Filter`:return e.annotations?.meta?._tag===t;case`FilterGroup`:return Lp(e.checks,t)}})}const Rp=new Ip,zp=new class extends jp{_tag=`Boolean`;getParser(){return Hm(this,oe)}getExpected(){return`boolean`}};var Bp=class e extends jp{_tag=`Arrays`;isMutable;elements;rest;constructor(e,t,n,r,i,a,o){super(r,i,a,o),this.isMutable=e,this.elements=t,this.rest=n;let s=t.findIndex(jm);if(s!==-1&&(t.slice(s+1).some(e=>!jm(e))||n.length>1))throw Error(`A required element cannot follow an optional element. ts(1257)`);if(n.length>1&&n.slice(1).some(jm))throw Error(`An optional element cannot follow a rest element. ts(1266)`)}getParser(e){let t=this,n=t.elements.map(t=>({ast:t,parser:e(t)})),r=t.rest.map(t=>({ast:t,parser:e(t)})),i=n.length,[a,...o]=r,s=o.length;function c(e,t){return t<i?n[t]:t>=e?o[t-e]:a}return la(function*(e,n){if(e._tag===`None`)return e;let r=e.value;if(!Array.isArray(r))return yield*P(new Vf(t,e));let a=r.length,o={ast:t,getParser:c,oinput:e,len:a,tailThreshold:Hp(a,i,s),output:new globalThis.Array(a),issues:void 0,options:n},l=Vp(o,r,{concurrency:Up(n?.concurrency)?.concurrency,end:t.rest.length===0?i:Math.max(a,i+s)});if(l&&(yield*l),t.rest.length===0&&a>i)for(let s=i;s<=a-1;s++){let i=new Rf([s],new Bf(t,r[s]));if(n.errors===`all`)o.issues?o.issues.push(i):o.issues=[i];else return yield*P(new X(t,e,[i]))}return o.issues?yield*P(new X(t,e,o.issues)):k(o.output)})}recur(t){let n=Em(this.elements,t),r=Em(this.rest,t);return n===this.elements&&r===this.rest?this:new e(this.isMutable,n,r,this.annotations,this.checks,void 0,this.context)}getExpected(){return`array`}};const Vp=Si()({onItem(e,t,n){let r=n<e.len?k(t):ln();return e.getParser(e.tailThreshold,n).parser(r,e.options)},step(e,t,n,r){if(n._tag===`Failure`)return Wp(e,e.ast,r,n);if(n.value._tag===`Some`)e.output[r]=n.value.value;else{let t=e.getParser(e.tailThreshold,r);if(jm(t.ast))return;let n=new Rf([r],new zf(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return Li(new X(e.ast,e.oinput,[n]))}}});function Hp(e,t,n){return Math.max(t,e-n)}const Up=e=>(e=e===`unbounded`?1/0:e??1,e>1?{concurrency:e}:void 0),Wp=(e,t,n,r)=>{let i=Bi(r.cause);if(Fn(i))return r;let a=new Rf([n],i.success);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return Li(new X(t,e.oinput,[a]))},Gp=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`,Kp=new globalThis.RegExp(`(?:${Gp}|Infinity|-Infinity|NaN)`);function qp(e,t){let n=Nm(t);switch(n._tag){case`String`:return Object.keys(e);case`TemplateLiteral`:{let t=Rm(n);return Object.keys(e).filter(e=>t.test(e))}case`Symbol`:return Object.getOwnPropertySymbols(e);case`Number`:return Object.keys(e).filter(e=>Kp.test(e));case`Union`:return[...new Set(n.types.flatMap(t=>qp(e,t)))];default:return[]}}var Jp=class{name;type;constructor(e,t){this.name=e,this.type=t}},Yp=class{parameter;type;merge;constructor(e,t,n){if(this.parameter=e,this.type=t,this.merge=n,jm(t)&&!Im(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},Xp=class e extends jp{_tag=`Objects`;propertySignatures;indexSignatures;constructor(e,t,n,r,i,a){super(n,r,i,a),this.propertySignatures=e,this.indexSignatures=t;let o=e.map(e=>e.name).filter((e,t,n)=>n.indexOf(e)!==t);if(o.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(o)}. ts(2300)`)}getParser(e){let t=this,n=[],r=new Set,i=[];for(let a of t.propertySignatures)n.push(a.name),r.add(a.name),i.push({ps:a,parser:e(a.type),name:a.name,type:a.type});let a=t.indexSignatures.length;if(t.propertySignatures.length===0&&t.indexSignatures.length===0)return Hm(t,ce);let o=a>0?Si()({onItem:la(function*(n,[r,i]){let a=e(Wm(i.parameter))(k(r),n.options),o=M(a)?a:yield*ta(a);if(o._tag===`Failure`){let e=Wp(n,t,r,o);e&&(yield*e);return}let s=k(n.input[r]),c=e(i.type)(s,n.options),l=M(c)?c:yield*ta(c);if(l._tag===`Failure`){let e=Wp(n,t,r,l);e&&(yield*e);return}else if(o.value._tag===`Some`&&l.value._tag===`Some`){let e=o.value.value,t=l.value.value;if(i.merge&&i.merge.decode&&Object.hasOwn(n.out,e)){let[r,a]=i.merge.decode.combine([e,n.out[e]],[e,t]);Mf(n.out,r,a)}else Mf(n.out,e,t)}}),step:(e,t,n)=>n._tag===`Failure`?n:void 0}):void 0;return la(function*(e,s){if(e._tag===`None`)return e;let c=e.value;if(!(typeof c==`object`&&c&&!Array.isArray(c)))return yield*P(new Vf(t,e));let l={},u={ast:t,oinput:e,input:c,out:l,issues:void 0,options:s},d=s.errors===`all`,f=s.onExcessProperty===`error`,p=s.onExcessProperty===`preserve`,ee;if(t.indexSignatures.length===0&&(f||p)){ee=Reflect.ownKeys(c);for(let n=0;n<ee.length;n++){let i=ee[n];if(!r.has(i))if(f){let n=new Rf([i],new Bf(t,c[i]));if(d){u.issues?u.issues.push(n):u.issues=[n];continue}else return yield*P(new X(t,e,[n]))}else Mf(l,i,c[i])}}let te=Up(s?.concurrency),m=Zp(u,i,te);if(m&&(yield*m),o){let e=qn();for(let n=0;n<a;n++){let r=t.indexSignatures[n],i=qp(c,r.parameter);for(let t=0;t<i.length;t++){let n=i[t];e.push([n,r])}}let n=o(u,e,te);n&&(yield*n)}if(u.issues)return yield*P(new X(t,e,u.issues));if(s.propertyOrder===`original`){let e=(ee??Reflect.ownKeys(c)).concat(n),t={};for(let n of e)Object.hasOwn(l,n)&&Mf(t,n,l[n]);return k(t)}return k(l)})}rebuild(t,n){let r=Em(this.propertySignatures,e=>{let n=t(e.type);return n===e.type?e:new Jp(e.name,n)}),i=Em(this.indexSignatures,e=>{let r=t(e.parameter),i=t(e.type),a=n?e.merge?.flip():e.merge;return r===e.parameter&&i===e.type&&a===e.merge?e:new Yp(r,i,a)});return r===this.propertySignatures&&i===this.indexSignatures?this:new e(r,i,this.annotations,this.checks,void 0,this.context)}flip(e){return this.rebuild(e,!0)}recur(e){return this.rebuild(e,!1)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?`object | array`:`object`}};const Zp=Si()({onItem(e,t){let n=Object.hasOwn(e.input,t.name)?k(e.input[t.name]):ln();return t.parser(n,e.options)},step(e,t,n){if(n._tag===`Failure`)return Wp(e,e.ast,t.name,n);if(n.value._tag===`Some`)Mf(e.out,t.name,n.value.value);else if(!jm(t.type)){let n=new Rf([t.name],new zf(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}else return Li(new X(e.ast,e.oinput,[n]))}}});function Qp(e,t,n){return new Xp(Reflect.ownKeys(e).map(t=>new Jp(t,e[t].ast)),[],n,t)}function $p(e){return e.ast}function em(e,t=void 0){return new Bp(!1,e.map(e=>e.ast),[],void 0,t)}function tm(e,t,n){return new cm(e.map($p),t,void 0,n)}function nm(e){switch(e._tag){case`Null`:return[`null`];case`Undefined`:case`Void`:return[`undefined`];case`String`:case`TemplateLiteral`:return[`string`];case`Number`:return[`number`];case`Boolean`:return[`boolean`];case`Symbol`:case`UniqueSymbol`:return[`symbol`];case`BigInt`:return[`bigint`];case`Arrays`:return[`array`];case`ObjectKeyword`:return[`object`,`array`,`function`];case`Objects`:return e.propertySignatures.length||e.indexSignatures.length?[`object`]:[`object`,`array`];case`Enum`:return Array.from(new Set(e.enums.map(([,e])=>typeof e)));case`Literal`:return[typeof e.literal];case`Union`:return Array.from(new Set(e.types.flatMap(nm)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function rm(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[`~sentinels`];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!jm(t)){if(Cp(t))return[{key:e.name,literal:t.literal}];if(wp(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>Cp(e)&&!jm(e)?[{key:t,literal:e.literal}]:[]);case`Suspend`:return rm(e.thunk())}}const im=new WeakMap;function am(e){let t=im.get(e);if(t)return t;t={};for(let n of e){let e=Nm(n);if(Sp(e))continue;let r=nm(e),i=rm(e);t.byType??={};for(let e of r)(t.byType[e]??=[]).push(n);if(i.length>0){t.bySentinel??=new Map;for(let{key:e,literal:r}of i){let i=t.bySentinel.get(e);i||t.bySentinel.set(e,i=new Map);let a=i.get(r);a||i.set(r,a=[]),a.push(n)}}else{t.otherwise??={};for(let e of r)(t.otherwise[e]??=[]).push(n)}}return im.set(e,t),t}function om(e){return t=>{let n=Nm(t);return n._tag===`Literal`?n.literal===e:n._tag===`UniqueSymbol`?n.symbol===e:!0}}function sm(e,t){let n=am(t),r=e===null?`null`:Array.isArray(e)?`array`:typeof e;if(n.bySentinel){let t=n.otherwise?.[r]??[];if(r===`object`||r===`array`){for(let[r,i]of n.bySentinel)if(Object.hasOwn(e,r)){let n=i.get(e[r]);if(n)return[...n,...t].filter(om(e))}}return t}return(n.byType?.[r]??[]).filter(om(e))}var cm=class e extends jp{_tag=`Union`;types;mode;constructor(e,t,n,r,i,a){super(n,r,i,a),this.types=e,this.mode=t}getParser(e){let t=this;return(n,r)=>{if(n._tag===`None`)return N(n);let i=n.value,a=sm(i,t.types),o={ast:t,recur:e,oinput:n,input:i,out:void 0,successes:[],issues:void 0,options:r},s=lm(o,a,Up(r?.concurrency));return s?ea(s,e=>o.out?N(o.out):P(new Uf(t,i,o.issues??[]))):o.out?N(o.out):P(new Uf(t,i,o.issues??[]))}}recur(t){let n=Em(this.types,t);return n===this.types?this:new e(n,this.mode,this.annotations,this.checks,void 0,this.context)}getExpected(e){let t=this.annotations?.expected;if(typeof t==`string`)return t;if(this.types.length===0)return`never`;let n=this.types.map(t=>{let n=Nm(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(Cp);if(t.length>0)return`${fm(n.isMutable)}[ ${t.map(t=>e(t)+pm(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>Cp(e.type));if(t.length>0)return`{ ${t.map(t=>`${fm(t.type.context?.isMutable)}${Je(t.name)}${pm(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};const lm=Si()({onItem(e,t){return e.recur(t)(e.oinput,e.options)},step(e,t,n){if(n._tag===`Failure`){let t=Bi(n.cause);if(Fn(t))return n;e.issues?e.issues.push(t.success):e.issues=[t.success]}else{if(e.out&&e.ast.mode===`oneOf`)return e.successes.push(t),Li(new Wf(e.ast,e.input,e.successes));if(e.out=n.value,e.successes.push(t),e.ast.mode===`anyOf`)return Ri}}}),um=new cm([new Np(`Infinity`),new Np(`-Infinity`),new Np(`NaN`)],`anyOf`),dm=new Z(new cm([Rp,um],`anyOf`),new mp(fp(),lp(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function fm(e){return e?``:`readonly `}function pm(e){return e?`?`:``}var mm=class e extends u{_tag=`Filter`;run;annotations;aborted;constructor(e,t=void 0,n=!1){super(),this.run=e,this.annotations=t,this.aborted=n}annotate(t){return new e(this.run,{...this.annotations,...t},this.aborted)}abort(){return new e(this.run,this.annotations,!0)}and(e,t){return new hm([this,e],t)}},hm=class e extends u{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(t){return new e(this.checks,{...this.annotations,...t})}and(t,n){return new e([this,t],n)}};function gm(e,t,n=!1){return new mm((t,n,r)=>qf(t,n,e(t,n,r)),t,n)}function _m(e,t){let n=e.source;return gm(t=>e.test(t),{expected:`a string matching the RegExp ${n}`,meta:{_tag:`isPattern`,regExp:e},toArbitraryConstraint:{string:{patterns:[e.source]}},...t})}function vm(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}function Q(e,t){return e.encoding===t?e:vm(e,e=>{e.encoding.value=t})}function ym(e,t){return e.context===t?e:vm(e,e=>{e.context.value=t})}function bm(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return xm(e,Rn(e.checks.slice(0,-1),n.annotate(t)))}return vm(e,e=>{e.annotations.value={...e.annotations.value,...t}})}function xm(e,t){return e.checks===t?e:vm(e,e=>{e.checks.value=t})}function Sm(e,t){return xm(e,e.checks?[...e.checks,...t]:t)}function Cm(e,t){let n=e,r=n[n.length-1],i=t(r.to);return i===r.to?e:Rn(e.slice(0,e.length-1),new Z(i,r.transformation))}function wm(e){return t=>t.encoding?Q(t,Cm(t.encoding,e)):t}function Tm(e,t,n){let r=new Z(e,t);return Q(n,n.encoding?[...n.encoding,r]:[r])}function Em(e,t){let n=!1,r=Array(e.length);for(let i=0;i<e.length;i++){let a=e[i],o=t(a);o!==a&&(n=!0),r[i]=o}return n?r:e}function Dm(e,t){return ym(e,e.context?new kp(e.context.isOptional,e.context.isMutable,e.context.defaultValue,{...e.context.annotations,...t}):new kp(!1,!1,void 0,t))}const Om=wm(km);function km(e){return Om(ym(e,e.context?e.context.isOptional===!1?new kp(!0,e.context.isMutable,e.context.defaultValue,e.context.annotations):e.context:new kp(!0,!1)))}function Am(e,t,n){return Tm(e,n,t)}function jm(e){return e.context?.isOptional??!1}const Mm=m(e=>{if(e.encoding)return Mm(Q(e,void 0));let t=e;return t.recur?.(Mm)??t}),Nm=m(e=>Mm(Fm(e)));function Pm(e,t){let n=t,r=n.length,i=n[r-1],a=[new Z(Fm(Q(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new Z(Fm(n[e-1].to),n[e].transformation.flip()));let o=Fm(i.to);return o.encoding?Q(o,[...o.encoding,...a]):Q(o,a)}const Fm=m(e=>{if(e.encoding)return Pm(e,e.encoding);let t=e;return t.flip?.(Fm)??t.recur?.(Fm)??t});function Im(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(Im);default:return!1}}function Lm(e,t){return e.encodedParts.map(e=>Bm(e,zm(e),t)).join(``)}const Rm=m(e=>new globalThis.RegExp(`^${Lm(e,!0)}$`));function zm(e){switch(e._tag){case`Literal`:return Nf(globalThis.String(e.literal));case`String`:return Gm;case`Number`:return Gp;case`BigInt`:return Zm;case`TemplateLiteral`:return Lm(e,!1);case`Union`:return e.types.map(zm).join(`|`)}}function Bm(e,t,n){if(Dp(e)){if(!n)return`(?:${t})`}else if(!n)return t;return`(${t})`}function Vm(e,t){let n=Zi(t);return r=>r._tag===`None`?Xi:r.value===t?n:P(new Vf(e,r))}function Hm(e,t){return n=>n._tag===`None`?Xi:t(n.value)?N(n):P(new Vf(e,n))}function Um(e){function t(n){return n.encoding?Q(n,Cm(n.encoding,t)):e(n)}return m(t)}const Wm=Um(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(Wm)}}),Gm=`[\\s\\S]*?`,Km=new globalThis.RegExp(`^${Gp}$`);function qm(e){return _m(Km,{expected:`a string representing a finite number`,meta:{_tag:`isStringFinite`,regExp:Km},...e})}const Jm=Sm(Fp,[qm()]),Ym=new Z(Jm,yp),Xm=new Z(new cm([Jm,um],`anyOf`),yp),Zm=`-?\\d+`;function Qm(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`)Qm(o.checks,t,n,r,i);else{let e=o.run(t,r,i);if(e&&(n.push(new If(t,o,e)),o.aborted||i?.errors!==`all`))return}}}const $m=`~effect/Schema/Class`,eh=e=>e,th=m(e=>{switch(e._tag){case`Declaration`:{let t=e.annotations?.[$m];if(se(t)){let n=t(e.typeParameters),r=th(n.to);return Q(e,r===n.to?[n]:[new Z(r,n.transformation)])}return e}case`Objects`:case`Arrays`:return e.recur(e=>{let t=e.context?.defaultValue;return t?Q(th(e),t):th(e)});case`Suspend`:return e.recur(th);default:return e}});function nh(e){let t=ah(th(Mm(e.ast)));return(e,n)=>t(e,n?.disableChecks?n?.parseOptions?{...n.parseOptions,disableChecks:!0}:{disableChecks:!0}:n?.parseOptions)}function rh(e){let t=nh(e);return(e,n)=>zi(ia(t(e,n)))}function ih(e){let t=nh(e);return(e,n)=>ra(oa(t(e,n),e=>Error(e.toString(),{cause:e})))}function ah(e){let t=oh(e);return(e,n)=>sa(t(k(e),n??Op),e=>e._tag===`None`?P(new Hf(e)):N(e.value))}const oh=m(e=>{let t,n=Of(e)?.parseOptions;if(!e.context&&!e.encoding&&!e.checks)return(r,i)=>(t??=e.getParser(oh),n&&(i={...i,...n}),t(r,i));let r=Tp(e)||Ep(e)||xp(e)&&e.typeParameters.length>0;return(i,a)=>{n&&(a={...a,...n});let o=e.encoding,s;if(o){let t=o,n=t.length;for(let e=n-1;e>=0;e--){let n=t[e],r=n.to,o=oh(r);if(s=s?sa(s,e=>o(e,a)):o(i,a),n.transformation._tag===`Transformation`){let e=n.transformation.decode;s=sa(s,t=>e.run(t,a))}else s=n.transformation.decode(s,a)}s=oa(s,t=>new Lf(e,i,t))}t??=e.getParser(oh);let c=s?sa(s,e=>t(e,a)):t(i,a);if(e.checks&&!a?.disableChecks){let t=e.checks;a?.errors===`all`&&r&&dn(i)&&(c=ca(c,n=>{let r=[];return Qm(t.filter(e=>e.annotations?.[`~structural`]),i.value,r,e,a),P(Bn(r)?n._tag===`Composite`&&n.ast===e?new X(e,n.actual,[...n.issues,...r]):new X(e,i,[n,...r]):n)})),c=sa(c,n=>{if(dn(n)){let r=n.value,i=[];if(Qm(t,r,i,e,a),Bn(i))return P(new X(e,n,i))}return N(n)})}return c}}),sh=`~effect/Schema/Schema`,ch={[sh]:sh,pipe(){return c(this,arguments)},annotate(e){return this.rebuild(bm(this.ast,e))},annotateKey(e){return this.rebuild(Dm(this.ast,e))},check(...e){return this.rebuild(Sm(this.ast,e))}};function lh(e,t){let n=Object.create(ch);return t&&Object.assign(n,t),n.ast=e,n.rebuild=e=>lh(e,t),n.makeEffect=te(nh(n),oa(e=>new dh(e))),n.make=ih(n),n.makeOption=rh(n),n}const uh=`~effect/Schema/SchemaError`;var dh=class{[uh]=uh;_tag=`SchemaError`;name=`SchemaError`;issue;constructor(e){this.issue=e}get message(){return this.issue.toString()}toString(){return`SchemaError(${this.message})`}};const fh=sh,$=lh;function ph(e){return h(e,fh)&&e[fh]===fh}function mh(e){let t=$(new Np(e),{literal:e,transform(n){return t.pipe(Th(mh(n),{decode:lp(()=>n),encode:lp(()=>e)}))}});return t}const hh=$(Fp),gh=$(Rp),_h=$(zp);function vh(e,t){return $(e,{fields:t,mapFields(e,t){let n=e(this.fields);return vh(Qp(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function yh(e){return vh(Qp(e,void 0),e)}function bh(e,t){return $(e,{elements:t,mapElements(e,t){let n=e(this.elements);return bh(em(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}const xh=eh(e=>$(new Bp(!1,[],[e.ast]),{schema:e}));function Sh(e,t){return $(e,{members:t,mapMembers(e,t){let n=e(this.members);return Sh(tm(n,this.ast.mode,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Ch(e,t){return Sh(tm(e,t?.mode??`anyOf`,void 0),e)}function wh(e){let t=e.map(mh);return $(tm(t,`anyOf`,void 0),{literals:e,members:t,mapMembers(e){return Ch(e(this.members))},pick(e){return wh(e)},transform(e){return Ch(t.map((t,n)=>t.transform(e[n])))}})}function Th(e,t){return n=>$(Am(n.ast,e.ast,t?gp(t):vp()),{from:n,to:e})}globalThis.Error,globalThis.Error,globalThis.RegExp,globalThis.URL,globalThis.File,globalThis.FormData,globalThis.URLSearchParams,globalThis.Uint8Array;const Eh=globalThis.Symbol.for(`immer-draftable`);function Dh(e,t,n,r,i){let a=Ah(n,t,r),o=kh(t),s=class extends e{constructor(...[e,t]){e??={};let r=n.make(e,t);super({...e,...r},{...t,disableChecks:!0})}static[fh]=fh;get[o](){return o}static[Eh]=!0;static identifier=t;static fields=n.fields;static get ast(){return a(this).ast}static pipe(){return c(this,arguments)}static rebuild(e){return a(this).rebuild(e)}static make(e,t){return new this(e,t)}static makeOption(e,t){return rh(a(this))(e??{},t)}static makeEffect(e,t){return a(this).makeEffect(e??{},t)}static annotate(e){return this.rebuild(bm(this.ast,e))}static annotateKey(e){return this.rebuild(Dm(this.ast,e))}static check(...e){return this.rebuild(Sm(this.ast,e))}static extend(e){return(t,r)=>{let a={...n.fields,...t};return Dh(this,e,vh(Qp(a,n.ast.checks,{identifier:e}),a),r,i)}}static mapFields(e,t){return n.mapFields(e,t)}};return i!==void 0&&Object.assign(s.prototype,i(t)),s}function Oh(e){return new mp(lp(t=>new e(t)),cp())}function kh(e){return`~effect/Schema/Class/${e}`}function Ah(e,t,n){let r;return i=>{if(r===void 0){let a=Oh(i),o=$(new Mp([e.ast],()=>(e,n)=>e instanceof i||h(e,kh(t))?N(e):P(new Vf(n,k(e))),{identifier:t,[$m]:([e])=>new Z(e,a),toCodec:([e])=>new Z(e.ast,a),toArbitrary:([e])=>()=>e.map(e=>new i(e)),toFormatter:([e])=>t=>`${i.identifier}(${e(t)})`,"~sentinels":rm(e.ast),...n}));r=e.pipe(Th(o,a))}return r}}function jh(e){return ph(e)}const Mh=e=>(t,n)=>Dh(Vi,e,jh(t)?t:yh(t),n,e=>({toString(){return`${e}(${S({...this})})`}})),Nh=wh([`error`,`warning`,`info`]);var Ph=class extends Mh(`OgDiagnostic`)({message:hh,points:gh,severity:Nh,suggestion:hh,tag:hh}){},Fh=class extends Mh(`ScoreResult`)({diagnostics:xh(Ph),maxScore:gh,passed:_h,score:gh}){};const Ih=(e,t,n,r,i)=>({check:a=>N(a[e]?null:new Ph({message:r,points:t,severity:n,suggestion:i,tag:e})),tag:e,weight:t}),Lh=[Ih(`og:title`,25,`error`,`Missing og:title tag`,`<meta property="og:title" content="Your Page Title" />`),Ih(`og:description`,25,`error`,`Missing og:description tag`,`<meta property="og:description" content="Your Page Description" />`),Ih(`og:image`,25,`error`,`Missing og:image tag`,`<meta property="og:image" content="https://example.com/og-image.png" />`),Ih(`og:url`,15,`warning`,`Missing og:url tag`,`<meta property="og:url" content="https://example.com/page-url" />`),Ih(`og:type`,10,`info`,`Missing og:type tag`,`<meta property="og:type" content="website" />`)],Rh=e=>Qi(function*(){let t=(yield*Ji(Lh.map(t=>t.check(e)))).filter(e=>e!==null),n=t.reduce((e,t)=>e+t.points,0);return new Fh({diagnostics:t,maxScore:100,passed:n===0,score:Math.max(0,100-n)})}),zh=e=>na(Rh(e)),Bh=(e,t,n)=>{let r=e,i=t.map(e=>{let t=r[e];return t?` ${s.dim(e)}: ${t}`:null}).filter(e=>e!==null);return i.length>0?`${i.join(`
72
- `)}\n`:` ${n}\n`},Vh=e=>[`${s.bold(s.cyan(`General Tags:`))}\n${Bh(e,[`title`,`description`,`author`,`canonical`,`robots`,`keywords`,`themeColor`],`No general tags detected.`)}`,`${s.bold(s.magenta(`Open Graph Tags (og:*):`))}\n${Bh(e,[`og:title`,`og:description`,`og:image`,`og:url`,`og:type`,`og:site_name`,`og:locale`],`No Open Graph tags detected.`)}`,`${s.bold(s.blue(`Twitter Card Tags (twitter:*):`))}\n${Bh(e,[`twitter:card`,`twitter:title`,`twitter:description`,`twitter:image`,`twitter:site`,`twitter:creator`],`No Twitter Card tags detected.`)}`,`${s.bold(s.yellow(`Favicons & Icons:`))}\n${e.favicons&&e.favicons.length>0?`${e.favicons.map(e=>` ${s.dim(e.rel)}: ${e.href}${e.sizes?` (${e.sizes})`:``}`).join(`
70
+ 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 Mu(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:Pu(t,`input`,e.processors),output:Pu(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function W(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 W(r.element,n);if(r.type===`set`)return W(r.valueType,n);if(r.type===`lazy`)return W(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 W(r.innerType,n);if(r.type===`intersection`)return W(r.left,n)||W(r.right,n);if(r.type===`record`||r.type===`map`)return W(r.keyType,n)||W(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:W(r.in,n)||W(r.out,n);if(r.type===`object`){for(let e in r.shape)if(W(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(W(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(W(e,n))return!0;return!!(r.rest&&W(r.rest,n))}return!1}const Nu=(e,t={})=>n=>{let r=Au({...n,processors:t});return U(e,r),ju(r,e),Mu(r,e)},Pu=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Au({...i??{},target:a,io:t,processors:n});return U(e,o),ju(o,e),Mu(o,e)},Fu={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Iu=(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=Fu[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}))])}},Lu=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Ru=(e,t,n,r)=>{n.not={}},zu=(e,t,n,r)=>{let i=e._zod.def,a=To(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Bu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Vu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Hu=(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=U(a.element,t,{...r,path:[...r.path,`items`]})},Uu=(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]=U(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=U(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Wu=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>U(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Gu=(e,t,n,r)=>{let i=e._zod.def,a=U(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=U(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]]},Ku=(e,t,n,r)=>{let i=e._zod.def,a=U(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`}]},qu=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ju=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Yu=(e,t,n,r)=>{let i=e._zod.def;U(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)))},Xu=(e,t,n,r)=>{let i=e._zod.def;U(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},Zu=(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;U(o,t,r);let s=t.seen.get(e);s.ref=o},Qu=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},$u=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ed=L(`ZodISODateTime`,(e,t)=>{Ac.init(e,t),J.init(e,t)});function td(e){return Ql(ed,e)}const nd=L(`ZodISODate`,(e,t)=>{jc.init(e,t),J.init(e,t)});function rd(e){return $l(nd,e)}const id=L(`ZodISOTime`,(e,t)=>{Mc.init(e,t),J.init(e,t)});function ad(e){return eu(id,e)}const od=L(`ZodISODuration`,(e,t)=>{Nc.init(e,t),J.init(e,t)});function sd(e){return tu(od,e)}const G=L(`ZodError`,(e,t)=>{ss.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>us(e,t)},flatten:{value:t=>ls(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Eo,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Eo,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),cd=ds(G),ld=fs(G),ud=ps(G),dd=hs(G),fd=_s(G),pd=vs(G),md=ys(G),hd=bs(G),gd=xs(G),_d=Ss(G),vd=Cs(G),yd=ws(G),bd=new WeakMap;function xd(e,t,n){let r=Object.getPrototypeOf(e),i=bd.get(r);if(i||(i=new Set,bd.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})}})}}}const K=L(`ZodType`,(e,t)=>(V.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Pu(e,`input`),output:Pu(e,`output`)}}),e.toJSONSchema=Nu(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>cd(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>ud(e,t,n),e.parseAsync=async(t,n)=>ld(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>dd(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>fd(e,t,n),e.decode=(t,n)=>pd(e,t,n),e.encodeAsync=async(t,n)=>md(e,t,n),e.decodeAsync=async(t,n)=>hd(e,t,n),e.safeEncode=(t,n)=>gd(e,t,n),e.safeDecode=(t,n)=>_d(e,t,n),e.safeEncodeAsync=async(t,n)=>vd(e,t,n),e.safeDecodeAsync=async(t,n)=>yd(e,t,n),xd(e,`ZodType`,{check(...e){let t=this.def;return this.clone(No(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 Uo(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(kf(e,t))},superRefine(e,t){return this.check(Af(e,t))},overwrite(e){return this.check(bu(e))},optional(){return df(this)},exactOptional(){return pf(this)},nullable(){return hf(this)},nullish(){return df(hf(this))},nonoptional(e){return xf(this,e)},array(){return Qd(this)},or(e){return nf([this,e])},and(e){return af(this,e)},transform(e){return Tf(this,lf(e))},default(e){return _f(this,e)},prefault(e){return yf(this,e)},catch(e){return Cf(this,e)},pipe(e){return Tf(this,e)},readonly(){return Df(this)},describe(e){let t=this.clone();return Ol.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ol.get(this);let t=this.clone();return Ol.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 Ol.get(e)?.description},configurable:!0}),e)),Sd=L(`_ZodString`,(e,t)=>{vc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Iu(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,xd(e,`_ZodString`,{regex(...e){return this.check(mu(...e))},includes(...e){return this.check(_u(...e))},startsWith(...e){return this.check(vu(...e))},endsWith(...e){return this.check(yu(...e))},min(...e){return this.check(fu(...e))},max(...e){return this.check(du(...e))},length(...e){return this.check(pu(...e))},nonempty(...e){return this.check(fu(1,...e))},lowercase(e){return this.check(hu(e))},uppercase(e){return this.check(gu(e))},trim(){return this.check(Su())},normalize(...e){return this.check(xu(...e))},toLowerCase(){return this.check(Cu())},toUpperCase(){return this.check(wu())},slugify(){return this.check(Tu())}})}),Cd=L(`ZodString`,(e,t)=>{vc.init(e,t),Sd.init(e,t),e.email=t=>e.check(Al(wd,t)),e.url=t=>e.check(Il(Dd,t)),e.jwt=t=>e.check(Zl(Hd,t)),e.emoji=t=>e.check(Ll(Od,t)),e.guid=t=>e.check(jl(Td,t)),e.uuid=t=>e.check(Ml(Ed,t)),e.uuidv4=t=>e.check(Nl(Ed,t)),e.uuidv6=t=>e.check(Pl(Ed,t)),e.uuidv7=t=>e.check(Fl(Ed,t)),e.nanoid=t=>e.check(Rl(kd,t)),e.guid=t=>e.check(jl(Td,t)),e.cuid=t=>e.check(zl(Ad,t)),e.cuid2=t=>e.check(Bl(jd,t)),e.ulid=t=>e.check(Vl(Md,t)),e.base64=t=>e.check(Jl(zd,t)),e.base64url=t=>e.check(Yl(Bd,t)),e.xid=t=>e.check(Hl(Nd,t)),e.ksuid=t=>e.check(Ul(Pd,t)),e.ipv4=t=>e.check(Wl(Fd,t)),e.ipv6=t=>e.check(Gl(Id,t)),e.cidrv4=t=>e.check(Kl(Ld,t)),e.cidrv6=t=>e.check(ql(Rd,t)),e.e164=t=>e.check(Xl(Vd,t)),e.datetime=t=>e.check(td(t)),e.date=t=>e.check(rd(t)),e.time=t=>e.check(ad(t)),e.duration=t=>e.check(sd(t))});function q(e){return kl(Cd,e)}const J=L(`ZodStringFormat`,(e,t)=>{H.init(e,t),Sd.init(e,t)}),wd=L(`ZodEmail`,(e,t)=>{xc.init(e,t),J.init(e,t)}),Td=L(`ZodGUID`,(e,t)=>{yc.init(e,t),J.init(e,t)}),Ed=L(`ZodUUID`,(e,t)=>{bc.init(e,t),J.init(e,t)}),Dd=L(`ZodURL`,(e,t)=>{Sc.init(e,t),J.init(e,t)}),Od=L(`ZodEmoji`,(e,t)=>{Cc.init(e,t),J.init(e,t)}),kd=L(`ZodNanoID`,(e,t)=>{wc.init(e,t),J.init(e,t)}),Ad=L(`ZodCUID`,(e,t)=>{Tc.init(e,t),J.init(e,t)}),jd=L(`ZodCUID2`,(e,t)=>{Ec.init(e,t),J.init(e,t)}),Md=L(`ZodULID`,(e,t)=>{Dc.init(e,t),J.init(e,t)}),Nd=L(`ZodXID`,(e,t)=>{Oc.init(e,t),J.init(e,t)}),Pd=L(`ZodKSUID`,(e,t)=>{kc.init(e,t),J.init(e,t)}),Fd=L(`ZodIPv4`,(e,t)=>{Pc.init(e,t),J.init(e,t)}),Id=L(`ZodIPv6`,(e,t)=>{Fc.init(e,t),J.init(e,t)}),Ld=L(`ZodCIDRv4`,(e,t)=>{Ic.init(e,t),J.init(e,t)}),Rd=L(`ZodCIDRv6`,(e,t)=>{Lc.init(e,t),J.init(e,t)}),zd=L(`ZodBase64`,(e,t)=>{zc.init(e,t),J.init(e,t)}),Bd=L(`ZodBase64URL`,(e,t)=>{Vc.init(e,t),J.init(e,t)}),Vd=L(`ZodE164`,(e,t)=>{Hc.init(e,t),J.init(e,t)}),Hd=L(`ZodJWT`,(e,t)=>{Wc.init(e,t),J.init(e,t)}),Ud=L(`ZodNumber`,(e,t)=>{Gc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lu(e,t,n,r),xd(e,`ZodNumber`,{gt(e,t){return this.check(cu(e,t))},gte(e,t){return this.check(lu(e,t))},min(e,t){return this.check(lu(e,t))},lt(e,t){return this.check(ou(e,t))},lte(e,t){return this.check(su(e,t))},max(e,t){return this.check(su(e,t))},int(e){return this.check(Kd(e))},safe(e){return this.check(Kd(e))},positive(e){return this.check(cu(0,e))},nonnegative(e){return this.check(lu(0,e))},negative(e){return this.check(ou(0,e))},nonpositive(e){return this.check(su(0,e))},multipleOf(e,t){return this.check(uu(e,t))},step(e,t){return this.check(uu(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 Wd(e){return nu(Ud,e)}const Gd=L(`ZodNumberFormat`,(e,t)=>{Kc.init(e,t),Ud.init(e,t)});function Kd(e){return ru(Gd,e)}const qd=L(`ZodUnknown`,(e,t)=>{qc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Jd(){return iu(qd)}const Yd=L(`ZodNever`,(e,t)=>{Jc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ru(e,t,n,r)});function Xd(e){return au(Yd,e)}const Zd=L(`ZodArray`,(e,t)=>{Xc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hu(e,t,n,r),e.element=t.element,xd(e,`ZodArray`,{min(e,t){return this.check(fu(e,t))},nonempty(e){return this.check(fu(1,e))},max(e,t){return this.check(du(e,t))},length(e,t){return this.check(pu(e,t))},unwrap(){return this.element}})});function Qd(e,t){return Eu(Zd,e,t)}const $d=L(`ZodObject`,(e,t)=>{tl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uu(e,t,n,r),R(e,`shape`,()=>t.shape),xd(e,`ZodObject`,{keyof(){return sf(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Jd()})},loose(){return this.clone({...this._zod.def,catchall:Jd()})},strict(){return this.clone({...this._zod.def,catchall:Xd()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Jo(this,e)},safeExtend(e){return Yo(this,e)},merge(e){return Xo(this,e)},pick(e){return Ko(this,e)},omit(e){return qo(this,e)},partial(...e){return Zo(uf,this,e[0])},required(...e){return Qo(bf,this,e[0])}})});function ef(e,t){return new $d({type:`object`,shape:e??{},...z(t)})}const tf=L(`ZodUnion`,(e,t)=>{rl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wu(e,t,n,r),e.options=t.options});function nf(e,t){return new tf({type:`union`,options:e,...z(t)})}const rf=L(`ZodIntersection`,(e,t)=>{il.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gu(e,t,n,r)});function af(e,t){return new rf({type:`intersection`,left:e,right:t})}const of=L(`ZodEnum`,(e,t)=>{sl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zu(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 of({...t,checks:[],...z(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 of({...t,checks:[],...z(r),entries:i})}});function sf(e,t){return new of({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...z(t)})}const cf=L(`ZodTransform`,(e,t)=>{cl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vu(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new So(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(as(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(as(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 lf(e){return new cf({type:`transform`,transform:e})}const uf=L(`ZodOptional`,(e,t)=>{ul.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$u(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function df(e){return new uf({type:`optional`,innerType:e})}const ff=L(`ZodExactOptional`,(e,t)=>{dl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$u(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pf(e){return new ff({type:`optional`,innerType:e})}const mf=L(`ZodNullable`,(e,t)=>{fl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ku(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hf(e){return new mf({type:`nullable`,innerType:e})}const gf=L(`ZodDefault`,(e,t)=>{pl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ju(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function _f(e,t){return new gf({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Bo(t)}})}const vf=L(`ZodPrefault`,(e,t)=>{hl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yf(e,t){return new vf({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Bo(t)}})}const bf=L(`ZodNonOptional`,(e,t)=>{gl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xf(e,t){return new bf({type:`nonoptional`,innerType:e,...z(t)})}const Sf=L(`ZodCatch`,(e,t)=>{vl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Cf(e,t){return new Sf({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const wf=L(`ZodPipe`,(e,t)=>{yl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zu(e,t,n,r),e.in=t.in,e.out=t.out});function Tf(e,t){return new wf({type:`pipe`,in:e,out:t})}const Ef=L(`ZodReadonly`,(e,t)=>{xl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Df(e){return new Ef({type:`readonly`,innerType:e})}const Of=L(`ZodCustom`,(e,t)=>{Cl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bu(e,t,n,r)});function kf(e,t={}){return Du(Of,e,t)}function Af(e,t){return Ou(e,t)}const jf=ef({href:q(),rel:q(),sizes:q().optional(),type:q().optional()});ef({applicationName:q().optional(),author:q().optional(),canonical:q().optional(),charset:q().optional(),colorScheme:q().optional(),description:q().optional(),favicons:Qd(jf).optional(),formatDetection:q().optional(),generator:q().optional(),keywords:q().optional(),lang:q().optional(),license:q().optional(),"og:description":q().optional(),"og:image":q().optional(),"og:image:height":q().optional(),"og:image:type":q().optional(),"og:image:width":q().optional(),"og:locale":q().optional(),"og:site_name":q().optional(),"og:title":q().optional(),"og:type":q().optional(),"og:url":q().optional(),rawHead:q().optional(),robots:q().optional(),themeColor:q().optional(),themeColorDark:q().optional(),themeColorLight:q().optional(),title:q().optional(),"twitter:card":q().optional(),"twitter:creator":q().optional(),"twitter:description":q().optional(),"twitter:image":q().optional(),"twitter:site":q().optional(),"twitter:title":q().optional(),viewport:q().optional()}).loose(),ef({height:Wd().optional(),size:Wd().optional(),type:q().optional(),url:q(),width:Wd().optional()}),ef({content:q().optional(),error:q().optional()});const Mf=ef({changefreq:q().optional(),lastmod:q().optional(),loc:q(),priority:q().optional()});ef({content:q().optional(),error:q().optional(),urls:Qd(Mf).optional()});const Nf=[`og`,`twitter`,`seo`,`image`],Pf={image:{maxScore:15,name:`og:image Validation`},og:{maxScore:40,name:`Open Graph`},seo:{maxScore:25,name:`Core SEO`},twitter:{maxScore:20,name:`Twitter Card`}},Ff=`~effect/BigDecimal`,If={[Ff]:Ff,[_](){let e=Uf(this);return y(v(e.value),Se(e.scale))},[x](e){return Lf(e)&&qf(this,e)},toString(){return`BigDecimal(${Jf(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[ot](){return this.toJSON()},pipe(){return ne(this,arguments)}},Lf=e=>g(e,Ff),Rf=(e,t)=>{let n=Object.create(If);return n.value=e,n.scale=t,n},zf=(e,t)=>{if(e!==Bf&&e%Vf===Bf)throw RangeError(`Value must be normalized`);let n=Rf(e,t);return n.normalized=n,n},Bf=BigInt(0),Vf=BigInt(10),Hf=zf(Bf,0),Uf=e=>{if(e.normalized===void 0)if(e.value===Bf)e.normalized=Hf;else{let t=`${e.value}`,n=0;for(let e=t.length-1;e>=0&&t[e]===`0`;e--)n++;n===0&&(e.normalized=e),e.normalized=zf(BigInt(t.substring(0,t.length-n)),e.scale-n)}return e.normalized},Wf=h(2,(e,t)=>t>e.scale?Rf(e.value*Vf**BigInt(t-e.scale),t):t<e.scale?Rf(e.value/Vf**BigInt(e.scale-t),t):e),Gf=e=>e.value<Bf?Rf(-e.value,e.scale):e,Kf=Zt((e,t)=>e.scale>t.scale?Wf(t,e.scale).value===e.value:e.scale<t.scale?Wf(e,t.scale).value===t.value:e.value===t.value),qf=h(2,(e,t)=>Kf(e,t)),Jf=e=>{let t=Uf(e);if(Math.abs(t.scale)>=16)return Yf(t);let n=t.value<Bf,r=n?`${t.value}`.substring(1):`${t.value}`,i,a;if(t.scale>=r.length)i=`0`,a=`0`.repeat(t.scale-r.length)+r;else{let e=r.length-t.scale;if(e>r.length){let t=e-r.length;i=`${r}${`0`.repeat(t)}`,a=``}else a=r.slice(e),i=r.slice(0,e)}let o=a===``?i:`${i}.${a}`;return n?`-${o}`:o},Yf=e=>{if(Xf(e))return`0e+0`;let t=Uf(e),n=`${Gf(t).value}`,r=n.slice(0,1),i=n.slice(1),a=`${Zf(t)?`-`:``}${r}`;i!==``&&(a+=`.${i}`);let o=i.length-t.scale;return`${a}e${o>=0?`+`:``}${o}`},Xf=e=>e.value===Bf,Zf=e=>e.value<Bf;Cn()(`effect/DateTime/CurrentTimeZone`),Qi(`EncodingError`);function Qf(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function $f(e){return t=>Qf(t)?.[e]}const ep=$f(`identifier`),tp=le(e=>{let t=ep(e);return typeof t==`string`?t:e.getExpected(tp)});function np(e,t,n){return t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n,e}globalThis.RegExp;const rp=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,`\\$&`),ip=`~effect/SchemaIssue/Issue`;function ap(e){return g(e,ip)}var op=class{[ip]=ip;toString(){return Tp(this)}},sp=class extends op{_tag=`Filter`;actual;filter;issue;constructor(e,t,n){super(),this.actual=e,this.filter=t,this.issue=n}},cp=class extends op{_tag=`Encoding`;ast;actual;issue;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issue=n}},lp=class extends op{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},up=class extends op{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},dp=class extends op{_tag=`UnexpectedKey`;ast;actual;constructor(e,t){super(),this.ast=e,this.actual=t}},Y=class extends op{_tag=`Composite`;ast;actual;issues;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issues=n}},fp=class extends op{_tag=`InvalidType`;ast;actual;constructor(e,t){super(),this.ast=e,this.actual=t}},pp=class extends op{_tag=`InvalidValue`;actual;annotations;constructor(e,t){super(),this.actual=e,this.annotations=t}},mp=class extends op{_tag=`AnyOf`;ast;actual;issues;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issues=n}},hp=class extends op{_tag=`OneOf`;ast;actual;successes;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.successes=n}};function gp(e,t){if(ap(t))return t;if(typeof t==`string`)return new pp(k(e),{message:t});let n=typeof t.issue==`string`?new pp(k(e),{message:t.issue}):t.issue;return new lp(t.path,n)}function _p(e,t){if(t!==void 0)return typeof t==`boolean`?t?void 0:new pp(k(e)):gp(e,t)}function vp(e,t,n){return Array.isArray(n)?Xn(n)?n.length===1?gp(e,n[0]):new Y(t,k(e),rr(n,t=>gp(e,t))):void 0:_p(e,n)}const yp=e=>{let t=Dp(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return xp(tp(e.ast),kp(e.actual));case`InvalidValue`:return`Invalid data ${kp(e.actual)}`;case`MissingKey`:return`Missing key`;case`UnexpectedKey`:return`Unexpected key with value ${C(e.actual)}`;case`Forbidden`:return`Forbidden operation`;case`OneOf`:return`Expected exactly one member to match the input ${C(e.actual)}`}},bp=e=>Dp(e.issue)??Dp(e);function xp(e,t){return`Expected ${e}, got ${t}`}function Sp(e,t,n,r){switch(e._tag){case`Filter`:{let i=r(e);if(i!==void 0)return[{path:t,message:i}];switch(e.issue._tag){case`InvalidValue`:return[{path:t,message:xp(Cp(e.filter),C(e.actual))}];default:return Sp(e.issue,t,n,r)}}case`Encoding`:return Sp(e.issue,t,n,r);case`Pointer`:return Sp(e.issue,[...t,...e.path],n,r);case`Composite`:return e.issues.flatMap(e=>Sp(e,t,n,r));case`AnyOf`:{let i=Dp(e);return e.issues.length===0?i===void 0?[{path:t,message:xp(tp(e.ast),C(e.actual))}]:[{path:t,message:i}]:e.issues.flatMap(e=>Sp(e,t,n,r))}default:return[{path:t,message:n(e)}]}}function Cp(e){let t=e.annotations?.expected;if(typeof t==`string`)return t;switch(e._tag){case`Filter`:return`<filter>`;case`FilterGroup`:return e.checks.map(e=>Cp(e)).join(` & `)}}function wp(){return e=>Sp(e,[],yp,bp).map(Ep).join(`
71
+ `)}const Tp=wp();function Ep(e){let t=e.message;if(e.path&&e.path.length>0){let n=rt(e.path);t+=`\n at ${n}`}return t}function Dp(e){switch(e._tag){case`InvalidType`:case`OneOf`:case`Composite`:case`AnyOf`:return Op(e.ast.annotations);case`InvalidValue`:case`Forbidden`:return Op(e.annotations);case`MissingKey`:return Op(e.annotations,`messageMissingKey`);case`UnexpectedKey`:return Op(e.ast.annotations,`messageUnexpectedKey`);case`Filter`:return Op(e.filter.annotations);case`Encoding`:return Dp(e.issue)}}function Op(e,t=`message`){let n=e?.[t];if(typeof n==`string`)return n}function kp(e){return yn(e)?`no value provided`:C(e.value)}var Ap=class e extends ie{run;constructor(e){super(),this.run=e}map(t){return new e((e,n)=>this.run(e,n).pipe(_a(xn(t))))}compose(t){return Mp(this)?t:Mp(t)?this:new e((e,n)=>this.run(e,n).pipe(ya(e=>t.run(e,n))))}};const jp=new Ap(N);function Mp(e){return e.run===jp.run}function Np(){return jp}function Pp(e){return Fp(xn(e))}function Fp(e){return new Ap(t=>N(e(t)))}function Ip(){return Pp(globalThis.String)}function Lp(){return Pp(globalThis.Number)}const Rp=`~effect/SchemaTransformation/Transformation`;var zp=class e{[Rp]=Rp;_tag=`Transformation`;decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new e(this.encode,this.decode)}compose(t){return new e(this.decode.compose(t.decode),t.encode.compose(this.encode))}};function Bp(e){return g(e,Rp)}const Vp=e=>Bp(e)?e:new zp(e.decode,e.encode),Hp=new zp(Np(),Np());function Up(){return Hp}const Wp=new zp(Lp(),Ip());function Gp(e){return t=>t._tag===e}const Kp=Gp(`Declaration`),qp=Gp(`Never`),Jp=Gp(`Literal`),Yp=Gp(`UniqueSymbol`),Xp=Gp(`Arrays`),Zp=Gp(`Objects`),Qp=Gp(`Union`);var X=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}};const $p={};var em=class{isOptional;isMutable;defaultValue;annotations;constructor(e,t,n=void 0,r=void 0){this.isOptional=e,this.isMutable=t,this.defaultValue=n,this.annotations=r}};const tm=`~effect/Schema`;var nm=class{[tm]=tm;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,r=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=r}toString(){return`<${this._tag}>`}},rm=class e extends nm{_tag=`Declaration`;typeParameters;run;constructor(e,t,n,r,i,a){super(n,r,i,a),this.typeParameters=e,this.run=t}getParser(){let e=this.run(this.typeParameters);return(t,n)=>yn(t)?aa:_a(e(t.value,this,n),k)}recur(t){let n=Zm(this.typeParameters,t);return n===this.typeParameters?this:new e(n,this.run,this.annotations,this.checks,void 0,this.context)}getExpected(){let e=this.annotations?.expected;return typeof e==`string`?e:`<Declaration>`}},im=class extends nm{_tag=`Literal`;literal;constructor(e,t,n,r,i){if(super(t,n,r,i),typeof e==`number`&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${C(e)}`);this.literal=e}getParser(){return fh(this,this.literal)}toCodecJson(){return typeof this.literal==`bigint`?am(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:am(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function am(e){let t=globalThis.String(e.literal);return Z(e,[new X(new im(t),new zp(Pp(()=>e.literal),Pp(()=>t)))])}const om=new class extends nm{_tag=`String`;getParser(){return ph(this,fe)}getExpected(){return`string`}};var sm=class extends nm{_tag=`Number`;getParser(){return ph(this,pe)}toCodecJson(){return this.checks&&(cm(this.checks,`isFinite`)||cm(this.checks,`isInt`))?this:Z(this,[Im])}toCodecStringTree(){return this.checks&&(cm(this.checks,`isFinite`)||cm(this.checks,`isInt`))?Z(this,[bh]):Z(this,[xh])}getExpected(){return`number`}};function cm(e,t){return e.some(e=>{switch(e._tag){case`Filter`:return e.annotations?.meta?._tag===t;case`FilterGroup`:return cm(e.checks,t)}})}const lm=new sm,um=new class extends nm{_tag=`Boolean`;getParser(){return ph(this,me)}getExpected(){return`boolean`}};var dm=class e extends nm{_tag=`Arrays`;isMutable;elements;rest;constructor(e,t,n,r,i,a,o){super(r,i,a,o),this.isMutable=e,this.elements=t,this.rest=n;let s=t.findIndex(nh);if(s!==-1&&(t.slice(s+1).some(e=>!nh(e))||n.length>1))throw Error(`A required element cannot follow an optional element. ts(1257)`);if(n.length>1&&n.slice(1).some(nh))throw Error(`An optional element cannot follow a rest element. ts(1266)`)}getParser(e){let t=this,n=t.elements.map(t=>({ast:t,parser:e(t)})),r=t.rest.map(t=>({ast:t,parser:e(t)})),i=n.length,[a,...o]=r,s=o.length;function c(e,t){return t<i?n[t]:t>=e?o[t-e]:a}return xa(function*(e,n){if(e._tag===`None`)return e;let r=e.value;if(!Array.isArray(r))return yield*F(new fp(t,e));let a=r.length,o={ast:t,getParser:c,oinput:e,len:a,tailThreshold:pm(a,i,s),output:new globalThis.Array(a),issues:void 0,options:n},l=fm(o,r,{concurrency:mm(n?.concurrency)?.concurrency,end:t.rest.length===0?i:Math.max(a,i+s)});if(l&&(yield*l),t.rest.length===0&&a>i)for(let s=i;s<=a-1;s++){let i=new lp([s],new dp(t,r[s]));if(n.errors===`all`)o.issues?o.issues.push(i):o.issues=[i];else return yield*F(new Y(t,e,[i]))}return o.issues?yield*F(new Y(t,e,o.issues)):k(o.output)})}recur(t){let n=Zm(this.elements,t),r=Zm(this.rest,t);return n===this.elements&&r===this.rest?this:new e(this.isMutable,n,r,this.annotations,this.checks,void 0,this.context)}getExpected(){return`array`}};const fm=Mi()({onItem(e,t,n){let r=n<e.len?k(t):vn();return e.getParser(e.tailThreshold,n).parser(r,e.options)},step(e,t,n,r){if(n._tag===`Failure`)return hm(e,e.ast,r,n);if(n.value._tag===`Some`)e.output[r]=n.value.value;else{let t=e.getParser(e.tailThreshold,r);if(nh(t.ast))return;let n=new lp([r],new up(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return qi(new Y(e.ast,e.oinput,[n]))}}});function pm(e,t,n){return Math.max(t,e-n)}const mm=e=>(e=e===`unbounded`?1/0:e??1,e>1?{concurrency:e}:void 0),hm=(e,t,n,r)=>{let i=Xi(r.cause);if(Wn(i))return r;let a=new lp([n],i.success);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return qi(new Y(t,e.oinput,[a]))},gm=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`,_m=new globalThis.RegExp(`(?:${gm}|Infinity|-Infinity|NaN)`);function vm(e,t){let n=ih(t);switch(n._tag){case`String`:return Object.keys(e);case`TemplateLiteral`:{let t=lh(n);return Object.keys(e).filter(e=>t.test(e))}case`Symbol`:return Object.getOwnPropertySymbols(e);case`Number`:return Object.keys(e).filter(e=>_m.test(e));case`Union`:return[...new Set(n.types.flatMap(t=>vm(e,t)))];default:return[]}}var ym=class{name;type;constructor(e,t){this.name=e,this.type=t}},bm=class{parameter;type;merge;constructor(e,t,n){if(this.parameter=e,this.type=t,this.merge=n,nh(t)&&!sh(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},xm=class e extends nm{_tag=`Objects`;propertySignatures;indexSignatures;constructor(e,t,n,r,i,a){super(n,r,i,a),this.propertySignatures=e,this.indexSignatures=t;let o=e.map(e=>e.name).filter((e,t,n)=>n.indexOf(e)!==t);if(o.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(o)}. ts(2300)`)}getParser(e){let t=this,n=[],r=new Set,i=[];for(let a of t.propertySignatures)n.push(a.name),r.add(a.name),i.push({ps:a,parser:e(a.type),name:a.name,type:a.type});let a=t.indexSignatures.length;if(t.propertySignatures.length===0&&t.indexSignatures.length===0)return ph(t,ge);let o=a>0?Mi()({onItem:xa(function*(n,[r,i]){let a=e(hh(i.parameter))(k(r),n.options),o=j(a)?a:yield*ua(a);if(o._tag===`Failure`){let e=hm(n,t,r,o);e&&(yield*e);return}let s=k(n.input[r]),c=e(i.type)(s,n.options),l=j(c)?c:yield*ua(c);if(l._tag===`Failure`){let e=hm(n,t,r,l);e&&(yield*e);return}else if(o.value._tag===`Some`&&l.value._tag===`Some`){let e=o.value.value,t=l.value.value;if(i.merge&&i.merge.decode&&Object.hasOwn(n.out,e)){let[r,a]=i.merge.decode.combine([e,n.out[e]],[e,t]);np(n.out,r,a)}else np(n.out,e,t)}}),step:(e,t,n)=>n._tag===`Failure`?n:void 0}):void 0;return xa(function*(e,s){if(e._tag===`None`)return e;let c=e.value;if(!(typeof c==`object`&&c&&!Array.isArray(c)))return yield*F(new fp(t,e));let l={},u={ast:t,oinput:e,input:c,out:l,issues:void 0,options:s},d=s.errors===`all`,f=s.onExcessProperty===`error`,p=s.onExcessProperty===`preserve`,m;if(t.indexSignatures.length===0&&(f||p)){m=Reflect.ownKeys(c);for(let n=0;n<m.length;n++){let i=m[n];if(!r.has(i))if(f){let n=new lp([i],new dp(t,c[i]));if(d){u.issues?u.issues.push(n):u.issues=[n];continue}else return yield*F(new Y(t,e,[n]))}else np(l,i,c[i])}}let ee=mm(s?.concurrency),te=Sm(u,i,ee);if(te&&(yield*te),o){let e=nr();for(let n=0;n<a;n++){let r=t.indexSignatures[n],i=vm(c,r.parameter);for(let t=0;t<i.length;t++){let n=i[t];e.push([n,r])}}let n=o(u,e,ee);n&&(yield*n)}if(u.issues)return yield*F(new Y(t,e,u.issues));if(s.propertyOrder===`original`){let e=(m??Reflect.ownKeys(c)).concat(n),t={};for(let n of e)Object.hasOwn(l,n)&&np(t,n,l[n]);return k(t)}return k(l)})}rebuild(t,n){let r=Zm(this.propertySignatures,e=>{let n=t(e.type);return n===e.type?e:new ym(e.name,n)}),i=Zm(this.indexSignatures,e=>{let r=t(e.parameter),i=t(e.type),a=n?e.merge?.flip():e.merge;return r===e.parameter&&i===e.type&&a===e.merge?e:new bm(r,i,a)});return r===this.propertySignatures&&i===this.indexSignatures?this:new e(r,i,this.annotations,this.checks,void 0,this.context)}flip(e){return this.rebuild(e,!0)}recur(e){return this.rebuild(e,!1)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?`object | array`:`object`}};const Sm=Mi()({onItem(e,t){let n=Object.hasOwn(e.input,t.name)?k(e.input[t.name]):vn();return t.parser(n,e.options)},step(e,t,n){if(n._tag===`Failure`)return hm(e,e.ast,t.name,n);if(n.value._tag===`Some`)np(e.out,t.name,n.value.value);else if(!nh(t.type)){let n=new lp([t.name],new up(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}else return qi(new Y(e.ast,e.oinput,[n]))}}});function Cm(e,t,n){return new xm(Reflect.ownKeys(e).map(t=>new ym(t,e[t].ast)),[],n,t)}function wm(e){return e.ast}function Tm(e,t=void 0){return new dm(!1,e.map(e=>e.ast),[],void 0,t)}function Em(e,t,n){return new Nm(e.map(wm),t,void 0,n)}function Dm(e){switch(e._tag){case`Null`:return[`null`];case`Undefined`:case`Void`:return[`undefined`];case`String`:case`TemplateLiteral`:return[`string`];case`Number`:return[`number`];case`Boolean`:return[`boolean`];case`Symbol`:case`UniqueSymbol`:return[`symbol`];case`BigInt`:return[`bigint`];case`Arrays`:return[`array`];case`ObjectKeyword`:return[`object`,`array`,`function`];case`Objects`:return e.propertySignatures.length||e.indexSignatures.length?[`object`]:[`object`,`array`];case`Enum`:return Array.from(new Set(e.enums.map(([,e])=>typeof e)));case`Literal`:return[typeof e.literal];case`Union`:return Array.from(new Set(e.types.flatMap(Dm)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function Om(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[`~sentinels`];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!nh(t)){if(Jp(t))return[{key:e.name,literal:t.literal}];if(Yp(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>Jp(e)&&!nh(e)?[{key:t,literal:e.literal}]:[]);case`Suspend`:return Om(e.thunk())}}const km=new WeakMap;function Am(e){let t=km.get(e);if(t)return t;t={};for(let n of e){let e=ih(n);if(qp(e))continue;let r=Dm(e),i=Om(e);t.byType??={};for(let e of r)(t.byType[e]??=[]).push(n);if(i.length>0){t.bySentinel??=new Map;for(let{key:e,literal:r}of i){let i=t.bySentinel.get(e);i||t.bySentinel.set(e,i=new Map);let a=i.get(r);a||i.set(r,a=[]),a.push(n)}}else{t.otherwise??={};for(let e of r)(t.otherwise[e]??=[]).push(n)}}return km.set(e,t),t}function jm(e){return t=>{let n=ih(t);return n._tag===`Literal`?n.literal===e:n._tag===`UniqueSymbol`?n.symbol===e:!0}}function Mm(e,t){let n=Am(t),r=e===null?`null`:Array.isArray(e)?`array`:typeof e;if(n.bySentinel){let t=n.otherwise?.[r]??[];if(r===`object`||r===`array`){for(let[r,i]of n.bySentinel)if(Object.hasOwn(e,r)){let n=i.get(e[r]);if(n)return[...n,...t].filter(jm(e))}}return t}return(n.byType?.[r]??[]).filter(jm(e))}var Nm=class e extends nm{_tag=`Union`;types;mode;constructor(e,t,n,r,i,a){super(n,r,i,a),this.types=e,this.mode=t}getParser(e){let t=this;return(n,r)=>{if(n._tag===`None`)return N(n);let i=n.value,a=Mm(i,t.types),o={ast:t,recur:e,oinput:n,input:i,out:void 0,successes:[],issues:void 0,options:r},s=Pm(o,a,mm(r?.concurrency));return s?ca(s,e=>o.out?N(o.out):F(new mp(t,i,o.issues??[]))):o.out?N(o.out):F(new mp(t,i,o.issues??[]))}}recur(t){let n=Zm(this.types,t);return n===this.types?this:new e(n,this.mode,this.annotations,this.checks,void 0,this.context)}getExpected(e){let t=this.annotations?.expected;if(typeof t==`string`)return t;if(this.types.length===0)return`never`;let n=this.types.map(t=>{let n=ih(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(Jp);if(t.length>0)return`${Lm(n.isMutable)}[ ${t.map(t=>e(t)+Rm(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>Jp(e.type));if(t.length>0)return`{ ${t.map(t=>`${Lm(t.type.context?.isMutable)}${nt(t.name)}${Rm(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};const Pm=Mi()({onItem(e,t){return e.recur(t)(e.oinput,e.options)},step(e,t,n){if(n._tag===`Failure`){let t=Xi(n.cause);if(Wn(t))return n;e.issues?e.issues.push(t.success):e.issues=[t.success]}else{if(e.out&&e.ast.mode===`oneOf`)return e.successes.push(t),qi(new hp(e.ast,e.input,e.successes));if(e.out=n.value,e.successes.push(t),e.ast.mode===`anyOf`)return Ji}}}),Fm=new Nm([new im(`Infinity`),new im(`-Infinity`),new im(`NaN`)],`anyOf`),Im=new X(new Nm([lm,Fm],`anyOf`),new zp(Lp(),Pp(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function Lm(e){return e?``:`readonly `}function Rm(e){return e?`?`:``}var zm=class e extends ie{_tag=`Filter`;run;annotations;aborted;constructor(e,t=void 0,n=!1){super(),this.run=e,this.annotations=t,this.aborted=n}annotate(t){return new e(this.run,{...this.annotations,...t},this.aborted)}abort(){return new e(this.run,this.annotations,!0)}and(e,t){return new Bm([this,e],t)}},Bm=class e extends ie{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(t){return new e(this.checks,{...this.annotations,...t})}and(t,n){return new e([this,t],n)}};function Vm(e,t,n=!1){return new zm((t,n,r)=>vp(t,n,e(t,n,r)),t,n)}function Hm(e,t){let n=e.source;return Vm(t=>e.test(t),{expected:`a string matching the RegExp ${n}`,meta:{_tag:`isPattern`,regExp:e},toArbitraryConstraint:{string:{patterns:[e.source]}},...t})}function Um(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}function Z(e,t){return e.encoding===t?e:Um(e,e=>{e.encoding.value=t})}function Wm(e,t){return e.context===t?e:Um(e,e=>{e.context.value=t})}function Gm(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return Km(e,qn(e.checks.slice(0,-1),n.annotate(t)))}return Um(e,e=>{e.annotations.value={...e.annotations.value,...t}})}function Km(e,t){return e.checks===t?e:Um(e,e=>{e.checks.value=t})}function qm(e,t){return Km(e,e.checks?[...e.checks,...t]:t)}function Jm(e,t){let n=e,r=n[n.length-1],i=t(r.to);return i===r.to?e:qn(e.slice(0,e.length-1),new X(i,r.transformation))}function Ym(e){return t=>t.encoding?Z(t,Jm(t.encoding,e)):t}function Xm(e,t,n){let r=new X(e,t);return Z(n,n.encoding?[...n.encoding,r]:[r])}function Zm(e,t){let n=!1,r=Array(e.length);for(let i=0;i<e.length;i++){let a=e[i],o=t(a);o!==a&&(n=!0),r[i]=o}return n?r:e}function Qm(e,t){return Wm(e,e.context?new em(e.context.isOptional,e.context.isMutable,e.context.defaultValue,{...e.context.annotations,...t}):new em(!1,!1,void 0,t))}const $m=Ym(eh);function eh(e){return $m(Wm(e,e.context?e.context.isOptional===!1?new em(!0,e.context.isMutable,e.context.defaultValue,e.context.annotations):e.context:new em(!0,!1)))}function th(e,t,n){return Xm(e,n,t)}function nh(e){return e.context?.isOptional??!1}const rh=le(e=>{if(e.encoding)return rh(Z(e,void 0));let t=e;return t.recur?.(rh)??t}),ih=le(e=>rh(oh(e)));function ah(e,t){let n=t,r=n.length,i=n[r-1],a=[new X(oh(Z(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new X(oh(n[e-1].to),n[e].transformation.flip()));let o=oh(i.to);return o.encoding?Z(o,[...o.encoding,...a]):Z(o,a)}const oh=le(e=>{if(e.encoding)return ah(e,e.encoding);let t=e;return t.flip?.(oh)??t.recur?.(oh)??t});function sh(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(sh);default:return!1}}function ch(e,t){return e.encodedParts.map(e=>dh(e,uh(e),t)).join(``)}const lh=le(e=>new globalThis.RegExp(`^${ch(e,!0)}$`));function uh(e){switch(e._tag){case`Literal`:return rp(globalThis.String(e.literal));case`String`:return gh;case`Number`:return gm;case`BigInt`:return Sh;case`TemplateLiteral`:return ch(e,!1);case`Union`:return e.types.map(uh).join(`|`)}}function dh(e,t,n){if(Qp(e)){if(!n)return`(?:${t})`}else if(!n)return t;return`(${t})`}function fh(e,t){let n=oa(t);return r=>r._tag===`None`?aa:r.value===t?n:F(new fp(e,r))}function ph(e,t){return n=>n._tag===`None`?aa:t(n.value)?N(n):F(new fp(e,n))}function mh(e){function t(n){return n.encoding?Z(n,Jm(n.encoding,t)):e(n)}return le(t)}const hh=mh(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(hh)}}),gh=`[\\s\\S]*?`,_h=new globalThis.RegExp(`^${gm}$`);function vh(e){return Hm(_h,{expected:`a string representing a finite number`,meta:{_tag:`isStringFinite`,regExp:_h},...e})}const yh=qm(om,[vh()]),bh=new X(yh,Wp),xh=new X(new Nm([yh,Fm],`anyOf`),Wp),Sh=`-?\\d+`;function Ch(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`)Ch(o.checks,t,n,r,i);else{let e=o.run(t,r,i);if(e&&(n.push(new sp(t,o,e)),o.aborted||i?.errors!==`all`))return}}}const wh=`~effect/Schema/Class`,Th=e=>e,Eh=le(e=>{switch(e._tag){case`Declaration`:{let t=e.annotations?.[wh];if(he(t)){let n=t(e.typeParameters),r=Eh(n.to);return Z(e,r===n.to?[n]:[new X(r,n.transformation)])}return e}case`Objects`:case`Arrays`:return e.recur(e=>{let t=e.context?.defaultValue;return t?Z(Eh(e),t):Eh(e)});case`Suspend`:return e.recur(Eh);default:return e}});function Dh(e){let t=Ah(Eh(rh(e.ast)));return(e,n)=>t(e,n?.disableChecks?n?.parseOptions?{...n.parseOptions,disableChecks:!0}:{disableChecks:!0}:n?.parseOptions)}function Oh(e){let t=Dh(e);return(e,n)=>Yi(ga(t(e,n)))}function kh(e){let t=Dh(e);return(e,n)=>ha(va(t(e,n),e=>Error(e.toString(),{cause:e})))}function Ah(e){let t=jh(e);return(e,n)=>ya(t(k(e),n??$p),e=>e._tag===`None`?F(new pp(e)):N(e.value))}const jh=le(e=>{let t,n=Qf(e)?.parseOptions;if(!e.context&&!e.encoding&&!e.checks)return(r,i)=>(t??=e.getParser(jh),n&&(i={...i,...n}),t(r,i));let r=Xp(e)||Zp(e)||Kp(e)&&e.typeParameters.length>0;return(i,a)=>{n&&(a={...a,...n});let o=e.encoding,s;if(o){let t=o,n=t.length;for(let e=n-1;e>=0;e--){let n=t[e],r=n.to,o=jh(r);if(s=s?ya(s,e=>o(e,a)):o(i,a),n.transformation._tag===`Transformation`){let e=n.transformation.decode;s=ya(s,t=>e.run(t,a))}else s=n.transformation.decode(s,a)}s=va(s,t=>new cp(e,i,t))}t??=e.getParser(jh);let c=s?ya(s,e=>t(e,a)):t(i,a);if(e.checks&&!a?.disableChecks){let t=e.checks;a?.errors===`all`&&r&&bn(i)&&(c=ba(c,n=>{let r=[];return Ch(t.filter(e=>e.annotations?.[`~structural`]),i.value,r,e,a),F(Yn(r)?n._tag===`Composite`&&n.ast===e?new Y(e,n.actual,[...n.issues,...r]):new Y(e,i,[n,...r]):n)})),c=ya(c,n=>{if(bn(n)){let r=n.value,i=[];if(Ch(t,r,i,e,a),Yn(i))return F(new Y(e,n,i))}return N(n)})}return c}}),Mh=`~effect/Schema/Schema`,Nh={[Mh]:Mh,pipe(){return ne(this,arguments)},annotate(e){return this.rebuild(Gm(this.ast,e))},annotateKey(e){return this.rebuild(Qm(this.ast,e))},check(...e){return this.rebuild(qm(this.ast,e))}};function Ph(e,t){let n=Object.create(Nh);return t&&Object.assign(n,t),n.ast=e,n.rebuild=e=>Ph(e,t),n.makeEffect=ce(Dh(n),va(e=>new Ih(e))),n.make=kh(n),n.makeOption=Oh(n),n}const Fh=`~effect/Schema/SchemaError`;var Ih=class{[Fh]=Fh;_tag=`SchemaError`;name=`SchemaError`;issue;constructor(e){this.issue=e}get message(){return this.issue.toString()}toString(){return`SchemaError(${this.message})`}};const Lh=Mh,Q=Ph;function Rh(e){return g(e,Lh)&&e[Lh]===Lh}function zh(e){let t=Q(new im(e),{literal:e,transform(n){return t.pipe(Xh(zh(n),{decode:Pp(()=>n),encode:Pp(()=>e)}))}});return t}const Bh=Q(om),Vh=Q(lm),Hh=Q(um);function Uh(e,t){return Q(e,{fields:t,mapFields(e,t){let n=e(this.fields);return Uh(Cm(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Wh(e){return Uh(Cm(e,void 0),e)}function Gh(e,t){return Q(e,{elements:t,mapElements(e,t){let n=e(this.elements);return Gh(Tm(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}const Kh=Th(e=>Q(new dm(!1,[],[e.ast]),{schema:e}));function qh(e,t){return Q(e,{members:t,mapMembers(e,t){let n=e(this.members);return qh(Em(n,this.ast.mode,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Jh(e,t){return qh(Em(e,t?.mode??`anyOf`,void 0),e)}function Yh(e){let t=e.map(zh);return Q(Em(t,`anyOf`,void 0),{literals:e,members:t,mapMembers(e){return Jh(e(this.members))},pick(e){return Yh(e)},transform(e){return Jh(t.map((t,n)=>t.transform(e[n])))}})}function Xh(e,t){return n=>Q(th(n.ast,e.ast,t?Vp(t):Up()),{from:n,to:e})}globalThis.Error,globalThis.Error,globalThis.RegExp,globalThis.URL,globalThis.File,globalThis.FormData,globalThis.URLSearchParams,globalThis.Uint8Array;const Zh=globalThis.Symbol.for(`immer-draftable`);function Qh(e,t,n,r,i){let a=tg(n,t,r),o=eg(t),s=class extends e{constructor(...[e,t]){e??={};let r=n.make(e,t);super({...e,...r},{...t,disableChecks:!0})}static[Lh]=Lh;get[o](){return o}static[Zh]=!0;static identifier=t;static fields=n.fields;static get ast(){return a(this).ast}static pipe(){return ne(this,arguments)}static rebuild(e){return a(this).rebuild(e)}static make(e,t){return new this(e,t)}static makeOption(e,t){return Oh(a(this))(e??{},t)}static makeEffect(e,t){return a(this).makeEffect(e??{},t)}static annotate(e){return this.rebuild(Gm(this.ast,e))}static annotateKey(e){return this.rebuild(Qm(this.ast,e))}static check(...e){return this.rebuild(qm(this.ast,e))}static extend(e){return(t,r)=>{let a={...n.fields,...t};return Qh(this,e,Uh(Cm(a,n.ast.checks,{identifier:e}),a),r,i)}}static mapFields(e,t){return n.mapFields(e,t)}};return i!==void 0&&Object.assign(s.prototype,i(t)),s}function $h(e){return new zp(Pp(t=>new e(t)),Np())}function eg(e){return`~effect/Schema/Class/${e}`}function tg(e,t,n){let r;return i=>{if(r===void 0){let a=$h(i),o=Q(new rm([e.ast],()=>(e,n)=>e instanceof i||g(e,eg(t))?N(e):F(new fp(n,k(e))),{identifier:t,[wh]:([e])=>new X(e,a),toCodec:([e])=>new X(e.ast,a),toArbitrary:([e])=>()=>e.map(e=>new i(e)),toFormatter:([e])=>t=>`${i.identifier}(${e(t)})`,"~sentinels":Om(e.ast),...n}));r=e.pipe(Xh(o,a))}return r}}function ng(e){return Rh(e)}const rg=e=>(t,n)=>Qh(Zi,e,ng(t)?t:Wh(t),n,e=>({toString(){return`${e}(${C({...this})})`}})),ig=Yh([`error`,`warning`,`info`]);var $=class extends rg(`OgDiagnostic`)({message:Bh,points:Vh,severity:ig,suggestion:Bh,tag:Bh}){};const ag=(e,t,n,r,i,a)=>({category:n,check:n=>N(n[e]?null:new $({message:i,points:t,severity:r,suggestion:a,tag:String(e)})),tag:String(e),weight:t}),og=[{category:`og`,check:e=>{let t=e[`og:title`];if(!t)return N(new $({message:`Missing og:title tag`,points:10,severity:`error`,suggestion:`<meta property="og:title" content="Your Page Title" />`,tag:`og:title`}));let n=t.length;return N(n<30||n>60?new $({message:`og:title length (${n}) is not optimal (30-60 characters)`,points:4,severity:`warning`,suggestion:`Make your og:title between 30 and 60 characters. Current is: "${t}"`,tag:`og:title`}):null)},tag:`og:title`,weight:10},{category:`og`,check:e=>{let t=e[`og:description`];if(!t)return N(new $({message:`Missing og:description tag`,points:10,severity:`error`,suggestion:`<meta property="og:description" content="Your page description here." />`,tag:`og:description`}));let n=t.length;return N(n<55||n>200?new $({message:`og:description length (${n}) is not optimal (55-200 characters)`,points:4,severity:`warning`,suggestion:`Make your og:description between 55 and 200 characters. Current length: ${n}`,tag:`og:description`}):null)},tag:`og:description`,weight:10},ag(`og:image`,10,`og`,`error`,`Missing og:image tag`,`<meta property="og:image" content="https://example.com/og-image.png" />`),{category:`og`,check:e=>{let t=e[`og:url`];if(!t)return N(new $({message:`Missing og:url tag`,points:4,severity:`warning`,suggestion:`<meta property="og:url" content="https://example.com/page-path" />`,tag:`og:url`}));try{return new URL(t),N(null)}catch{return N(new $({message:`og:url is not a valid absolute URL`,points:2,severity:`warning`,suggestion:`Ensure og:url is an absolute URL (e.g., https://example.com/path). Current: "${t}"`,tag:`og:url`}))}},tag:`og:url`,weight:4},ag(`og:type`,2,`og`,`info`,`Missing og:type tag`,`<meta property="og:type" content="website" />`),ag(`og:locale`,2,`og`,`info`,`Missing og:locale tag`,`<meta property="og:locale" content="en_US" />`),ag(`og:site_name`,2,`og`,`info`,`Missing og:site_name tag`,`<meta property="og:site_name" content="Your Site Name" />`),{category:`twitter`,check:e=>{let t=e[`twitter:card`];return t?[`summary`,`summary_large_image`,`app`,`player`].includes(t)?N(null):N(new $({message:`Invalid twitter:card value: "${t}"`,points:3,severity:`warning`,suggestion:`Use one of: "summary", "summary_large_image", "app", "player"`,tag:`twitter:card`})):N(new $({message:`Missing twitter:card tag`,points:5,severity:`warning`,suggestion:`<meta name="twitter:card" content="summary_large_image" />`,tag:`twitter:card`}))},tag:`twitter:card`,weight:5},{category:`twitter`,check:e=>{let t=e[`twitter:title`];if(!t)return N(new $({message:`Missing twitter:title tag`,points:5,severity:`warning`,suggestion:`<meta name="twitter:title" content="Your Page Title" />`,tag:`twitter:title`}));let n=t.length;return N(n<30||n>60?new $({message:`twitter:title length (${n}) is not optimal (30-60 characters)`,points:2,severity:`info`,suggestion:`Keep twitter:title between 30 and 60 characters for optimal display. Current: "${t}"`,tag:`twitter:title`}):null)},tag:`twitter:title`,weight:5},{category:`twitter`,check:e=>{let t=e[`twitter:description`];if(!t)return N(new $({message:`Missing twitter:description tag`,points:5,severity:`warning`,suggestion:`<meta name="twitter:description" content="Your page description." />`,tag:`twitter:description`}));let n=t.length;return N(n<55||n>200?new $({message:`twitter:description length (${n}) is not optimal (55-200 characters)`,points:2,severity:`info`,suggestion:`Keep twitter:description between 55 and 200 characters. Current length: ${n}`,tag:`twitter:description`}):null)},tag:`twitter:description`,weight:5},ag(`twitter:image`,3,`twitter`,`warning`,`Missing twitter:image tag`,`<meta name="twitter:image" content="https://example.com/og-image.png" />`),ag(`twitter:site`,2,`twitter`,`info`,`Missing twitter:site tag`,`<meta name="twitter:site" content="@yourusername" />`),{category:`seo`,check:e=>{let t=e.title;if(!t)return N(new $({message:`Missing <title> tag`,points:6,severity:`error`,suggestion:`<title>Your page title for search results</title>`,tag:`title`}));let n=t.length;return N(n<30||n>60?new $({message:`<title> tag length (${n}) is not optimal (30-60 characters)`,points:2,severity:`warning`,suggestion:`Adjust your title tag length to be between 30 and 60 characters. Current: "${t}"`,tag:`title`}):null)},tag:`title`,weight:6},{category:`seo`,check:e=>{let t=e.description;if(!t)return N(new $({message:`Missing meta description`,points:6,severity:`error`,suggestion:`<meta name="description" content="A brief summary of the page content." />`,tag:`description`}));let n=t.length;return N(n<50||n>160?new $({message:`Meta description length (${n}) is not optimal (50-160 characters)`,points:2,severity:`warning`,suggestion:`Keep meta description between 50 and 160 characters for search snippets. Current length: ${n}`,tag:`description`}):null)},tag:`description`,weight:6},{category:`seo`,check:(e,t)=>{let n=e.canonical;if(!n)return N(new $({message:`Missing link[rel=canonical] tag`,points:5,severity:`warning`,suggestion:`<link rel="canonical" href="https://example.com/page-canonical" />`,tag:`canonical`}));try{new URL(n)}catch{return N(new $({message:`Canonical URL is not a valid absolute URL`,points:3,severity:`warning`,suggestion:`Ensure the canonical URL is absolute. Current: "${n}"`,tag:`canonical`}))}if(t?.pageUrl&&n!==t.pageUrl)try{let e=new URL(n),r=new URL(t.pageUrl);if(e.origin!==r.origin||e.pathname.replace(/\/$/u,``)!==r.pathname.replace(/\/$/u,``))return N(new $({message:`Canonical URL (${n}) does not match current page URL (${t.pageUrl})`,points:2,severity:`warning`,suggestion:`The canonical tag should point to the primary URL of this page.`,tag:`canonical`}))}catch{}return N(null)},tag:`canonical`,weight:5},{category:`seo`,check:e=>{let t=e.robots;return t&&t.toLowerCase().includes(`noindex`)?N(new $({message:`Page has noindex directives in robots meta tag`,points:3,severity:`warning`,suggestion:`If you want this page indexed by search engines, remove "noindex" from: "${t}"`,tag:`robots`})):N(null)},tag:`robots`,weight:3},ag(`viewport`,2,`seo`,`warning`,`Missing viewport meta tag`,`<meta name="viewport" content="width=device-width, initial-scale=1.0" />`),ag(`charset`,1,`seo`,`warning`,`Missing charset declaration`,`<meta charset="utf-8" />`),ag(`lang`,2,`seo`,`warning`,`Missing lang attribute on <html> tag`,`<html lang="en">`),{category:`image`,check:(e,t)=>{if(!e[`og:image`])return N(new $({message:`Image cannot be validated because og:image tag is missing`,points:5,severity:`error`,suggestion:`Add a valid og:image tag to pass image validations.`,tag:`og:image:reachable`}));let n=t?.imageMeta;return!n||n.size===void 0&&!n.width?N(new $({message:`og:image URL is unreachable or failed to fetch: "${e[`og:image`]}"`,points:5,severity:`error`,suggestion:`Verify the og:image URL is correct and publically accessible.`,tag:`og:image:reachable`})):N(null)},tag:`og:image:reachable`,weight:5},{category:`image`,check:(e,t)=>{if(!e[`og:image`])return N(null);let n=t?.imageMeta;return!n||!n.width||!n.height?N(null):n.width<1200||n.height<630?N(new $({message:`og:image dimensions (${n.width}x${n.height}) are below the recommended 1200x630 pixels`,points:5,severity:`warning`,suggestion:`Use an image that is at least 1200x630 pixels for rich social sharing previews.`,tag:`og:image:dimensions`})):N(null)},tag:`og:image:dimensions`,weight:5},{category:`image`,check:(e,t)=>{if(!e[`og:image`])return N(null);let n=t?.imageMeta;if(!n)return N(null);let r=n.type?.toLowerCase()||``;return[`png`,`jpeg`,`jpg`,`webp`,`image/png`,`image/jpeg`,`image/jpg`,`image/webp`].some(e=>r.includes(e))?N(null):N(new $({message:`og:image format (${r||`unknown`}) is not optimal. Use PNG, JPEG, or WebP`,points:3,severity:`warning`,suggestion:`Convert your image to PNG, JPEG, or WebP. SVG and GIF are not fully supported by all social platforms.`,tag:`og:image:format`}))},tag:`og:image:format`,weight:3},{category:`image`,check:(e,t)=>{if(!e[`og:image`])return N(null);let n=t?.imageMeta;if(!n||!n.size)return N(null);let r=n.size/(1024*1024);return N(r>8?new $({message:`og:image size (${r.toFixed(2)}MB) exceeds 8MB`,points:2,severity:`warning`,suggestion:`Compress your og:image. Some platforms (like Discord/Twitter) will not render previews for images larger than 8MB.`,tag:`og:image:size`}):null)},tag:`og:image:size`,weight:2}],sg=(e,t)=>P(function*(){let n=(yield*ia(og.map(n=>n.check(e,t).pipe(da(e=>e?{category:n.category,diag:e}:null))))).filter(e=>e!==null),r=Nf.map(e=>{let t=Pf[e],r=n.filter(t=>t.category===e).map(e=>e.diag),i=r.reduce((e,t)=>e+t.points,0),a=Math.max(0,t.maxScore-i);return{diagnostics:r,id:e,maxScore:t.maxScore,name:t.name,score:a}}),i=r.reduce((e,t)=>e+t.score,0),a=n.map(e=>e.diag);return{categories:r,diagnostics:a,maxScore:100,passed:a.length===0,score:i,url:t?.pageUrl}}),cg=(e,t)=>ma(sg(e,t)),lg=e=>{if(e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71&&e.length>=24){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=t.getUint32(16,!1);return{height:t.getUint32(20,!1),type:`png`,width:n}}if(e[0]===255&&e[1]===216){let t=2,n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(;t<e.length-8;){let r=n.getUint16(t,!1);if(t+=2,r===65497||r===65498)break;let i=n.getUint16(t,!1);if(r>=65472&&r<=65475&&t+7<e.length)return{height:n.getUint16(t+3,!1),type:`jpeg`,width:n.getUint16(t+5,!1)};t+=i}}if(e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=String.fromCodePoint(e[12],e[13],e[14],e[15]);if(n===`VP8 `&&e.length>=30){let e=t.getUint16(26,!0)&16383;return{height:t.getUint16(28,!0)&16383,type:`webp`,width:e}}if(n===`VP8L`&&e.length>=25){let[t,n,r,i]=e.subarray(21,25),a=1+(t|(n&63)<<8);return{height:1+((n&192)>>6|r<<2|(i&15)<<10),type:`webp`,width:a}}if(n===`VP8X`&&e.length>=30){let t=1+(e[24]|e[25]<<8|e[26]<<16);return{height:1+(e[27]|e[28]<<8|e[29]<<16),type:`webp`,width:t}}}return{}},ug=e=>P(function*(){let t=e.headers.get(`Content-Length`),n=e.headers.get(`Content-Range`),r;if(n){let e=n.match(/\/(\d+)$/u);e&&(r=Number.parseInt(e[1],10))}!r&&t&&(r=Number.parseInt(t,10));let i=e.headers.get(`Content-Type`)||void 0,a=yield*M({catch:e=>Error(`Failed to read image body: ${e instanceof Error?e.message:String(e)}`),try:()=>e.arrayBuffer()}),o=lg(new Uint8Array(a));return{...o,size:r,type:o.type||i}}),dg=e=>P(function*(){let t=yield*M({catch:e=>Error(`Failed to fetch image: ${e instanceof Error?e.message:String(e)}`),try:()=>fetch(e,{headers:{Range:`bytes=0-131072`}})});if(!t.ok&&t.status!==206){let t=yield*M({catch:e=>Error(`Failed fallback fetch image: ${e instanceof Error?e.message:String(e)}`),try:()=>fetch(e)});return t.ok?yield*ug(t):yield*F(Error(`Failed to fetch image: Status ${t.status}`))}return yield*ug(t)});rg(`ScoreResult`)({diagnostics:Kh($),maxScore:Vh,passed:Hh,score:Vh});const fg=e=>{let t=[],n=e.split(/\r?\n/u),r=!1;for(let e of n){if(e=e.trim(),e.startsWith(`#`)||e===``)continue;let n=e.split(`:`);if(n.length<2)continue;let i=n[0].trim().toLowerCase(),a=n.slice(1).join(`:`).trim();if(i===`user-agent`)r=a===`*`;else if(r&&i===`disallow`&&a!==``){let e=a.replaceAll(/[.+^${}()|[\]\\]/gu,`\\$&`).replaceAll(`*`,`.*`).replaceAll(`?`,`.`),n=e.startsWith(`/`)?`^`:``,r=new RegExp(n+e,`iu`);t.push(r)}}return{disallowedPatterns:t}},pg=(e,t)=>t.disallowedPatterns.some(t=>t.test(e)),mg=e=>{let{pathname:t}=e;if(t.includes(`/_next/`)||t.startsWith(`/_next`)||t.includes(`/node_modules/`))return!1;let n=`.png,.jpg,.jpeg,.gif,.svg,.ico,.webp,.avif,.css,.js,.mjs,.ts,.map,.pdf,.epub,.zip,.tar,.gz,.mp4,.webm,.ogg,.mp3,.wav,.woff,.woff2,.ttf,.eot,.xml,.json,.txt`.split(`,`),r=t.split(`/`).pop()||``;if(r.includes(`.`)){let e=r.slice(r.lastIndexOf(`.`)).toLowerCase();if(n.includes(e))return!1}return!0},hg=(e,t)=>e.hostname.replace(/^www\./iu,``)===t.hostname.replace(/^www\./iu,``)&&e.protocol===t.protocol,gg=(e,t)=>P(function*(){let n=yield*sa({catch:e=>Error(`Invalid start URL: ${e instanceof Error?e.message:String(e)}`),try:()=>new URL(e)}),{origin:r}=n,i=yield*ao(e).pipe(la),a={disallowedPatterns:[]};i._tag===`Success`&&(a=fg(i.success.content));let o=new Set,s=new Set,c=[n.href];s.add(n.href);let{maxUrls:l}=t,u=t.concurrency||5,d=(e,t)=>{let i=[],a=/href=["']([^"']+)["']/giu,o;for(;(o=a.exec(e))!==null;){let[,e]=o;try{let a=new URL(e,t);if(hg(a,n)&&mg(a)){a.hash=``;let{href:e}=a;e.endsWith(`/`)&&e!==`${r}/`&&(e=e.slice(0,-1)),i.push(e)}}catch{}}return i};for(;c.length>0&&o.size<l;){let e=Math.min(u,c.length,l-o.size),t=yield*ia(c.splice(0,e).map(e=>{o.add(e);let t=new URL(e);return pg(t.pathname+t.search,a)?N({html:``,skipped:!0,url:e}):M({catch:()=>Error(`Failed fetch`),try:()=>fetch(e)}).pipe(ca(t=>t.ok?M({catch:()=>Error(`Failed read text`),try:()=>t.text()}).pipe(da(t=>({html:t,skipped:!1,url:e}))):N({html:``,skipped:!0,url:e})),fa(()=>N({html:``,skipped:!0,url:e})))}),{concurrency:u});for(let e of t){if(e.skipped||!e.html)continue;let t=d(e.html,e.url);for(let e of t)!s.has(e)&&s.size<l*2&&(s.add(e),c.push(e))}}return[...o].slice(0,l)}).pipe(pa(e=>e instanceof Error?e:Error(String(e)))),_g=(e,t)=>P(function*(){let n=yield*vo(e).pipe(la),r=[];if(n._tag===`Success`&&(r=(n.success.urls||[]).map(e=>e.loc)),r.length>0){let n=yield*sa({catch:e=>Error(`Invalid site URL: ${e instanceof Error?e.message:String(e)}`),try:()=>new URL(e)}),i=r.filter(e=>{try{let t=new URL(e);return hg(t,n)&&mg(t)}catch{return!1}});if(i.length>0)return i.slice(0,t.maxUrls)}return yield*gg(e,{concurrency:t.concurrency,maxUrls:t.maxUrls})}).pipe(pa(e=>e instanceof Error?e:Error(String(e)))),vg=e=>P(function*(){e.onProgress&&e.onProgress({completedUrls:0,totalUrls:0,type:`discovery`});let t=yield*_g(e.siteUrl,{concurrency:e.concurrency,maxUrls:e.maxUrls});if(t.length===0)return{averageScore:0,categoryAverages:{image:0,og:0,seo:0,twitter:0},pages:[],scannedAt:new Date().toISOString(),siteUrl:e.siteUrl,summary:{excellent:0,fair:0,good:0,poor:0},totalPages:0};let n=0,r=t.length;e.onProgress&&e.onProgress({completedUrls:0,totalUrls:r,type:`checking`});let i=t=>P(function*(){if(e.signal?.aborted)return yield*F(Error(`Scan aborted`));let i=yield*ro(t).pipe(la),a={};i._tag===`Success`&&(a=i.success);let o=null;if(a[`og:image`]){let e=yield*dg(a[`og:image`]).pipe(la);e._tag===`Success`&&(o=e.success)}let s=yield*sg(a,{imageMeta:o,pageUrl:t});return n+=1,e.onProgress&&e.onProgress({completedUrls:n,result:s,totalUrls:r,type:`checking`,url:t}),s}),a=yield*ia(t.map(e=>i(e)),{concurrency:e.concurrency}),o=a.length,s=a.reduce((e,t)=>e+t.score,0),c=Math.round(s/o),l={image:0,og:0,seo:0,twitter:0};for(let e of a)for(let t of e.categories){let e=t.maxScore>0?t.score/t.maxScore*100:0;l[t.id]+=e}let u={image:Math.round(l.image/o),og:Math.round(l.og/o),seo:Math.round(l.seo/o),twitter:Math.round(l.twitter/o)},d={excellent:0,fair:0,good:0,poor:0};for(let e of a)e.score>=90?d.excellent+=1:e.score>=75?d.good+=1:e.score>=50?d.fair+=1:d.poor+=1;let f={averageScore:c,categoryAverages:u,pages:a,scannedAt:new Date().toISOString(),siteUrl:e.siteUrl,summary:d,totalPages:o};return e.onProgress&&e.onProgress({completedUrls:n,totalUrls:r,type:`complete`}),f}).pipe(pa(e=>e instanceof Error?e:Error(String(e)))),yg=e=>ma(vg(e)),bg=(e,t,n)=>{let r=e,i=t.map(e=>{let t=r[e];return t?` ${s.dim(e)}: ${t}`:null}).filter(e=>e!==null);return i.length>0?`${i.join(`
72
+ `)}\n`:` ${n}\n`},xg=e=>[`${s.bold(s.cyan(`General Tags:`))}\n${bg(e,[`title`,`description`,`author`,`canonical`,`robots`,`keywords`,`themeColor`],`No general tags detected.`)}`,`${s.bold(s.magenta(`Open Graph Tags (og:*):`))}\n${bg(e,[`og:title`,`og:description`,`og:image`,`og:url`,`og:type`,`og:site_name`,`og:locale`],`No Open Graph tags detected.`)}`,`${s.bold(s.blue(`Twitter Card Tags (twitter:*):`))}\n${bg(e,[`twitter:card`,`twitter:title`,`twitter:description`,`twitter:image`,`twitter:site`,`twitter:creator`],`No Twitter Card tags detected.`)}`,`${s.bold(s.yellow(`Favicons & Icons:`))}\n${e.favicons&&e.favicons.length>0?`${e.favicons.map(e=>` ${s.dim(e.rel)}: ${e.href}${e.sizes?` (${e.sizes})`:``}`).join(`
73
73
  `)}\n`:` No icons detected.
74
74
  `}`].join(`
75
- `),Hh=e=>e===100?`Great`:e>=75?`Good`:e>=50?`Fair`:`Poor`,Uh=(e,t)=>t>=75?s.green(e):t>=50?s.yellow(e):s.red(e),Wh=e=>{let t=Hh(e),n=[];n=e===100?[`╭/\\─────/\\╮`,`│ ( ^.^ ) │`,`│ ⚞ ⩊ ⚟ │`,`╰─────────╯`]:e>=75?[`╭/\\─────/\\╮`,`│ ( ◕.◕ ) │`,`│ ⚞ ◡ ⚟ │`,`╰─────────╯`]:e>=50?[`╭/\\─────/\\╮`,`│ ( •.• ) │`,`│ ⚞ ─ ⚟ │`,`╰─────────╯`]:[`╭/\\─────/\\╮`,`│ ( ✕.✕ ) │`,`│ ⚞ ︵ ⚟ │`,`╰─────────╯`];let r=n.map(t=>Uh(t,e)),i=Math.round(e/100*20),a=20-i,o=Uh(`█`.repeat(i),e)+s.dim(`░`.repeat(a)),c=[`${Uh(`${e}`,e)} ${s.dim(`/ 100`)} ${Uh(t,e)}`,o,s.dim(`OG Tester — Check Tags`),``];return r.map((e,t)=>{let n=c[t];return`${e}${n?` `:``}${n}`}).join(`
76
- `)},Gh=e=>{let t=Wh(e).split(`
75
+ `),Sg=e=>e===100?`Great`:e>=75?`Good`:e>=50?`Fair`:`Poor`,Cg=(e,t)=>t>=75?s.green(e):t>=50?s.yellow(e):s.red(e),wg=(e,t=`OG Tester — Check Tags`)=>{let n=Sg(e),r=[];r=e===100?[`╭/\\─────/\\╮`,`│ ( ^.^ ) │`,`│ ⚞ ⩊ ⚟ │`,`╰─────────╯`]:e>=75?[`╭/\\─────/\\╮`,`│ ( ◕.◕ ) │`,`│ ⚞ ◡ ⚟ │`,`╰─────────╯`]:e>=50?[`╭/\\─────/\\╮`,`│ ( •.• ) │`,`│ ⚞ ─ ⚟ │`,`╰─────────╯`]:[`╭/\\─────/\\╮`,`│ ( ✕.✕ ) │`,`│ ⚞ ︵ ⚟ │`,`╰─────────╯`];let i=r.map(t=>Cg(t,e)),a=Math.round(e/100*20),o=20-a,c=Cg(`█`.repeat(a),e)+s.dim(`░`.repeat(o)),l=[`${Cg(`${e}`,e)} ${s.dim(`/ 100`)} ${Cg(n,e)}`,c,s.dim(t),``];return i.map((e,t)=>{let n=l[t];return`${e}${n?` `:``}${n}`}).join(`
76
+ `)},Tg=(e,t=`OG Tester — Check Tags`,n=`Score`)=>{let r=wg(e,t).split(`
77
77
  `).map(e=>`${s.dim(`│`)} ${e}`).join(`
78
- `);return[`${s.cyan(`◇`)} ${s.bold(`Score`)}`,s.dim(`│`),t,s.dim(`│`),``].join(`
79
- `)},Kh=new e(`check`).description(`Fetch and analyze Open Graph and meta tags for a URL`).argument(`<url>`,`The URL to check`).option(`--json`,`Output raw JSON instead of pretty formatting`).option(`--min-score <number>`,`Minimum score threshold (exit 1 if below)`,e=>Number.parseInt(e,10)).action(async(e,c)=>{let l=e;/^https?:\/\//iu.test(e)||(l=`https://${e}`),c.json||n(s.bgCyan(s.black(` OG Tester — Check Tags `)));let u=o();c.json||u.start(`Fetching and parsing ${s.underline(l)}...`);try{let e=await Ba(l),n=await zh(e);if(c.json){let t={...e,diagnostics:n.diagnostics,maxScore:n.maxScore,passed:n.passed,score:n.score};console.log(JSON.stringify(t,null,2)),c.minScore!==void 0&&n.score<c.minScore&&process.exit(1);return}if(u.stop(`Successfully fetched and parsed tags!`),i(Vh(e),`Report`),process.stdout.isTTY&&!c.json){process.stdout.write(`\x1B[?25l`);try{for(let e=0;e<=15;e+=1){let r=Math.round(n.score*e/15);e>0&&process.stdout.write(`\x1B[7A\x1B[J`),process.stdout.write(Gh(r)),await t(30)}}finally{process.stdout.write(`\x1B[?25h`)}}else process.stdout.write(Gh(n.score));n.diagnostics.length>0&&i(n.diagnostics.map(e=>{let t=s.blue(`ℹ`);return e.severity===`error`?t=s.red(`✖`):e.severity===`warning`&&(t=s.yellow(`⚠`)),`${t} ${s.bold(e.tag)} — ${e.message} (-${e.points} points)\n ${s.dim(`→ Add:`)} ${s.green(e.suggestion)}`}).join(`
78
+ `);return[`${s.cyan(`◇`)} ${s.bold(n)}`,s.dim(`│`),r,s.dim(`│`),``].join(`
79
+ `)},Eg=new e(`check`).description(`Fetch and analyze Open Graph and meta tags for a URL`).argument(`<url>`,`The URL to check`).option(`--json`,`Output raw JSON instead of pretty formatting`).option(`--min-score <number>`,`Minimum score threshold (exit 1 if below)`,e=>Number.parseInt(e,10)).action(async(e,c)=>{let l=e;/^https?:\/\//iu.test(e)||(l=`https://${e}`),c.json||n(s.bgCyan(s.black(` OG Tester — Check Tags `)));let u=o();c.json||u.start(`Fetching and parsing ${s.underline(l)}...`);try{let e=await io(l),n=await cg(e);if(c.json){let t={...e,diagnostics:n.diagnostics,maxScore:n.maxScore,passed:n.passed,score:n.score};console.log(JSON.stringify(t,null,2)),c.minScore!==void 0&&n.score<c.minScore&&process.exit(1);return}if(u.stop(`Successfully fetched and parsed tags!`),i(xg(e),`Report`),process.stdout.isTTY&&!c.json){process.stdout.write(`\x1B[?25l`);try{for(let e=0;e<=15;e+=1){let r=Math.round(n.score*e/15);e>0&&process.stdout.write(`\x1B[7A\x1B[J`),process.stdout.write(Tg(r)),await t(30)}}finally{process.stdout.write(`\x1B[?25h`)}}else process.stdout.write(Tg(n.score));n.diagnostics.length>0&&i(n.diagnostics.map(e=>{let t=s.blue(`ℹ`);return e.severity===`error`?t=s.red(`✖`):e.severity===`warning`&&(t=s.yellow(`⚠`)),`${t} ${s.bold(e.tag)} — ${e.message} (-${e.points} points)\n ${s.dim(`→ Add:`)} ${s.green(e.suggestion)}`}).join(`
80
80
 
81
- `),`Recommendations`),c.minScore!==void 0&&n.score<c.minScore&&(a(s.red(`Score ${n.score} is below minimum ${c.minScore}`)),process.exit(1)),a(s.green(`Done!`))}catch(e){let t=e instanceof Error?e.message:String(e);c.json&&(console.error(JSON.stringify({error:t},null,2)),process.exit(1)),u.stop(s.red(`Failed to fetch or parse tags`)),r.error(s.red(t)),a(s.red(`Exited with errors.`)),process.exit(1)}}),qh=new e(`robots`).description(`Fetch a site's robots.txt`).argument(`<url>`,`The URL of the site`).option(`--json`,`Output raw JSON instead of pretty formatting`).action(async(e,t)=>{let c=e;/^https?:\/\//iu.test(e)||(c=`https://${e}`),t.json||n(s.bgCyan(s.black(` OG Tester — Robots.txt `)));let l=o();t.json||l.start(`Fetching robots.txt for ${s.underline(c)}...`);try{let e=await Ha(c);if(t.json){console.log(JSON.stringify(e,null,2));return}l.stop(`Successfully fetched robots.txt!`),e.error&&(r.error(s.red(e.error)),a(s.red(`Exited with errors.`)),process.exit(1)),i(e.content??`Empty robots.txt`,`robots.txt content`),a(s.green(`Done!`))}catch(e){let n=e instanceof Error?e.message:String(e);t.json&&(console.error(JSON.stringify({error:n},null,2)),process.exit(1)),l.stop(s.red(`Failed to fetch robots.txt`)),r.error(s.red(n)),a(s.red(`Exited with errors.`)),process.exit(1)}}),Jh=new e(`sitemap`).description(`Fetch and parse a site's sitemap.xml`).argument(`<url>`,`The URL of the site`).option(`--json`,`Output raw JSON instead of pretty formatting`).action(async(e,t)=>{let c=e;/^https?:\/\//iu.test(e)||(c=`https://${e}`),t.json||n(s.bgCyan(s.black(` OG Tester — Sitemap.xml `)));let l=o();t.json||l.start(`Fetching and parsing sitemap.xml for ${s.underline(c)}...`);try{let e=await Xa(c);if(t.json){console.log(JSON.stringify(e,null,2));return}l.stop(`Successfully fetched and parsed sitemap.xml!`),e.error&&(r.error(s.red(e.error)),a(s.red(`Exited with errors.`)),process.exit(1));let n=`Total URLs: ${s.bold(e.urls?.length??0)}\n\n`;if(e.urls&&e.urls.length>0){let t=e.urls.slice(0,15);n+=`${s.bold(`URLs Preview:`)}\n`;for(let e of t)n+=` - ${s.cyan(e.loc)}`,e.priority&&(n+=` ${s.dim(`[priority: ${e.priority}]`)}`),e.lastmod&&(n+=` ${s.dim(`(lastmod: ${e.lastmod})`)}`),n+=`
81
+ `),`Recommendations`),c.minScore!==void 0&&n.score<c.minScore&&(a(s.red(`Score ${n.score} is below minimum ${c.minScore}`)),process.exit(1)),a(s.green(`Done!`))}catch(e){let t=e instanceof Error?e.message:String(e);c.json&&(console.error(JSON.stringify({error:t},null,2)),process.exit(1)),u.stop(s.red(`Failed to fetch or parse tags`)),r.error(s.red(t)),a(s.red(`Exited with errors.`)),process.exit(1)}}),Dg=new e(`robots`).description(`Fetch a site's robots.txt`).argument(`<url>`,`The URL of the site`).option(`--json`,`Output raw JSON instead of pretty formatting`).action(async(e,t)=>{let c=e;/^https?:\/\//iu.test(e)||(c=`https://${e}`),t.json||n(s.bgCyan(s.black(` OG Tester — Robots.txt `)));let l=o();t.json||l.start(`Fetching robots.txt for ${s.underline(c)}...`);try{let e=await oo(c);if(t.json){console.log(JSON.stringify(e,null,2));return}l.stop(`Successfully fetched robots.txt!`),e.error&&(r.error(s.red(e.error)),a(s.red(`Exited with errors.`)),process.exit(1)),i(e.content??`Empty robots.txt`,`robots.txt content`),a(s.green(`Done!`))}catch(e){let n=e instanceof Error?e.message:String(e);t.json&&(console.error(JSON.stringify({error:n},null,2)),process.exit(1)),l.stop(s.red(`Failed to fetch robots.txt`)),r.error(s.red(n)),a(s.red(`Exited with errors.`)),process.exit(1)}}),Og=e=>e>=90?s.green:e>=75?s.cyan:e>=50?s.yellow:s.red,kg=async(e,t,n)=>{try{await u(e,JSON.stringify(t,null,2),`utf-8`),n||r.info(`Report saved to ${s.cyan(e)}`)}catch(t){n||r.error(`Failed to save report to ${e}: ${t instanceof Error?t.message:String(t)}`)}},Ag=e=>{process.stdout.write(Tg(e.averageScore,`OG Tester — Site Scan`,`Site-wide Average Score`)),i([`${s.bold(`Category Breakdown:`)}`,` ${s.dim(`•`)} Open Graph (OG) Tags: ${Og(e.categoryAverages.og)(e.categoryAverages.og)}%`,` ${s.dim(`•`)} Twitter Card Tags: ${Og(e.categoryAverages.twitter)(e.categoryAverages.twitter)}%`,` ${s.dim(`•`)} Core Search SEO: ${Og(e.categoryAverages.seo)(e.categoryAverages.seo)}%`,` ${s.dim(`•`)} og:image Validation: ${Og(e.categoryAverages.image)(e.categoryAverages.image)}%`,``,`${s.bold(`Page Score Distribution:`)}`,` ${s.green(`Excellent (90-100)`)}: ${e.summary.excellent} pages`,` ${s.cyan(`Good (75-89)`)}: ${e.summary.good} pages`,` ${s.yellow(`Fair (50-74)`)}: ${e.summary.fair} pages`,` ${s.red(`Poor (0-49)`)}: ${e.summary.poor} pages`].join(`
82
+ `),`Dashboard`);let t=[...e.pages].toSorted((e,t)=>e.score-t.score),n=Math.min(10,t.length);n>0&&i(t.slice(0,n).map(e=>{let t=e.url?new URL(e.url).pathname:`/`;return` [${Og(e.score)(e.score.toString().padStart(3))}/100] ${s.dim(t||`/`)} — ${e.diagnostics.length} issues`}).join(`
83
+ `)+(t.length>10?`\n ... and ${t.length-10} more pages`:``),`Top Issues - Worst ${n} Pages`);let r={};for(let t of e.pages)for(let e of t.diagnostics){let t=`${e.tag}:${e.message}`;r[t]||(r[t]={count:0,message:e.message,severity:e.severity,tag:e.tag}),r[t].count+=1}let a=Object.values(r).toSorted((e,t)=>t.count-e.count),o=Math.min(5,a.length);o>0&&i(a.slice(0,o).map(t=>{let n=s.blue;return t.severity===`error`?n=s.red:t.severity===`warning`&&(n=s.yellow),` ${n(t.tag)} — ${t.message}\n Failing on ${s.bold(t.count)} pages (${Math.round(t.count/e.totalPages*100)}% of site)`}).join(`
84
+
85
+ `),`Top ${o} Site-wide Common Issues`)},jg=new e(`scan`).description(`Scan an entire site (sitemap & crawler fallback) and perform OG/SEO scoring`).argument(`<site-url>`,`The website base URL to scan`).option(`--concurrency <number>`,`Number of concurrent URL requests`,e=>Number.parseInt(e,10),5).option(`--max-urls <number>`,`Maximum number of URLs to discover and scan`,e=>Number.parseInt(e,10),200).option(`--json`,`Output raw JSON report to stdout instead of TUI`).option(`--output <path>`,`File path to write the JSON report`,`./og-report.json`).option(`--min-score <number>`,`Minimum average score threshold (exit 1 if below)`,e=>Number.parseInt(e,10)).action(async(e,t)=>{let i=e;/^https?:\/\//iu.test(e)||(i=`https://${e}`),t.json||n(s.bgCyan(s.black(` OG Tester — Site Scanner `)));let c=o(),l=`discovery`;t.json||c.start(`Discovering URLs from sitemap / homepage for ${s.underline(i)}...`);try{let e=await yg({concurrency:t.concurrency,maxUrls:t.maxUrls,onProgress:e=>{if(!t.json)if(e.type===`discovery`)l=`discovery`,c.message(`Discovering site URLs...`);else if(e.type===`checking`){l!==`checking`&&(l=`checking`);let t=`Scanning: [${e.completedUrls}/${e.totalUrls}] ${e.url} (${Og(e.result?.score||0)(e.result?.score||0)}/100)`;c.message(t)}else e.type===`complete`&&(l=`complete`)},siteUrl:i});if(t.json||c.stop(`Successfully scanned ${e.totalPages} pages!`),t.output&&await kg(t.output,e,!!t.json),t.json){console.log(JSON.stringify(e,null,2)),t.minScore!==void 0&&e.averageScore<t.minScore&&process.exit(1);return}Ag(e),t.minScore!==void 0&&e.averageScore<t.minScore&&(a(s.red(`Scan failed: Average score ${e.averageScore} is below the threshold of ${t.minScore}`)),process.exit(1)),a(s.green(`Scan complete! Average score: ${e.averageScore}/100`))}catch(e){t.json?(console.error(JSON.stringify({error:e instanceof Error?e.message:String(e)})),process.exit(1)):(c.stop(`Failed to scan!`),r.error(`Scan error: ${e instanceof Error?e.message:String(e)}`),process.exit(1))}}),Mg=new e(`sitemap`).description(`Fetch and parse a site's sitemap.xml`).argument(`<url>`,`The URL of the site`).option(`--json`,`Output raw JSON instead of pretty formatting`).action(async(e,t)=>{let c=e;/^https?:\/\//iu.test(e)||(c=`https://${e}`),t.json||n(s.bgCyan(s.black(` OG Tester — Sitemap.xml `)));let l=o();t.json||l.start(`Fetching and parsing sitemap.xml for ${s.underline(c)}...`);try{let e=await yo(c);if(t.json){console.log(JSON.stringify(e,null,2));return}l.stop(`Successfully fetched and parsed sitemap.xml!`),e.error&&(r.error(s.red(e.error)),a(s.red(`Exited with errors.`)),process.exit(1));let n=`Total URLs: ${s.bold(e.urls?.length??0)}\n\n`;if(e.urls&&e.urls.length>0){let t=e.urls.slice(0,15);n+=`${s.bold(`URLs Preview:`)}\n`;for(let e of t)n+=` - ${s.cyan(e.loc)}`,e.priority&&(n+=` ${s.dim(`[priority: ${e.priority}]`)}`),e.lastmod&&(n+=` ${s.dim(`(lastmod: ${e.lastmod})`)}`),n+=`
82
86
  `;e.urls.length>15&&(n+=`\n ${s.dim(`... and ${e.urls.length-15} more URLs. Use --json to see all.`)}\n`)}else n+=`No URLs parsed from sitemap.
83
- `;i(n,`Sitemap Summary`),a(s.green(`Done!`))}catch(e){let n=e instanceof Error?e.message:String(e);t.json&&(console.error(JSON.stringify({error:n},null,2)),process.exit(1)),l.stop(s.red(`Failed to fetch or parse sitemap`)),r.error(s.red(n)),a(s.red(`Exited with errors.`)),process.exit(1)}}),Yh=new e;Yh.name(`og-tester`).version(`0.1.0`).description(`Test and analyze Open Graph, Twitter Card, and meta tags from the command line`),Yh.addCommand(Kh),Yh.addCommand(qh),Yh.addCommand(Jh),Yh.parse();export{};
87
+ `;i(n,`Sitemap Summary`),a(s.green(`Done!`))}catch(e){let n=e instanceof Error?e.message:String(e);t.json&&(console.error(JSON.stringify({error:n},null,2)),process.exit(1)),l.stop(s.red(`Failed to fetch or parse sitemap`)),r.error(s.red(n)),a(s.red(`Exited with errors.`)),process.exit(1)}}),Ng=async(e,t)=>{let n=[],r=await l(e,{withFileTypes:!0});for(let i of r){let r=m(e,i.name);if(i.isDirectory()){if(i.name===`node_modules`||i.name===`.git`||i.name===`.next`||i.name===`.turbo`||i.name===`build`||i.name===`dist`&&e!==t)continue;n.push(...await Ng(r,t))}else i.isFile()&&i.name.endsWith(`.html`)&&n.push(r)}return n},Pg=e=>{let t=m(e,`og-tester.config.json`);if(d(t))try{let e=p(t,`utf-8`);return JSON.parse(e)}catch{r.warn(`Warning: Failed to parse ${t}`)}let n=m(e,`package.json`);if(d(n))try{let e=p(n,`utf-8`),t=JSON.parse(e);if(t.ogTester)return t.ogTester}catch{}return null},Fg=async(e,t,n)=>{try{await u(e,JSON.stringify(t,null,2),`utf-8`),n||r.info(`Report saved to ${s.cyan(e)}`)}catch(t){n||r.error(`Failed to save report to ${e}: ${t instanceof Error?t.message:String(t)}`)}},Ig=async(e,c)=>{let l=e;/^https?:\/\//iu.test(e)||(l=`https://${e}`),c.json||n(s.bgCyan(s.black(` OG Tester — Check Tags `)));let u=o();c.json||u.start(`Fetching and parsing ${s.underline(l)}...`);try{let e=await io(l),n=await cg(e);if(c.json){let t={...e,diagnostics:n.diagnostics,maxScore:n.maxScore,passed:n.passed,score:n.score};console.log(JSON.stringify(t,null,2)),c.minScore!==void 0&&n.score<c.minScore&&process.exit(1);return}if(u.stop(`Successfully fetched and parsed tags!`),i(xg(e),`Report`),process.stdout.isTTY&&!c.json){process.stdout.write(`\x1B[?25l`);try{for(let e=0;e<=15;e+=1){let r=Math.round(n.score*e/15);e>0&&process.stdout.write(`\x1B[7A\x1B[J`),process.stdout.write(Tg(r)),await t(30)}}finally{process.stdout.write(`\x1B[?25h`)}}else process.stdout.write(Tg(n.score));n.diagnostics.length>0&&i(n.diagnostics.map(e=>{let t=s.blue(`ℹ`);return e.severity===`error`?t=s.red(`✖`):e.severity===`warning`&&(t=s.yellow(`⚠`)),`${t} ${s.bold(e.tag)} — ${e.message} (-${e.points} points)\n ${s.dim(`→ Add:`)} ${s.green(e.suggestion)}`}).join(`
88
+
89
+ `),`Recommendations`),c.minScore!==void 0&&n.score<c.minScore&&(a(s.red(`Score ${n.score} is below minimum ${c.minScore}`)),process.exit(1)),a(s.green(`Done!`))}catch(e){let t=e instanceof Error?e.message:String(e);c.json&&(console.error(JSON.stringify({error:t},null,2)),process.exit(1)),u.stop(s.red(`Failed to fetch or parse tags`)),r.error(s.red(t)),a(s.red(`Exited with errors.`)),process.exit(1)}},Lg=async(e,t)=>{let i=e;/^https?:\/\//iu.test(e)||(i=`https://${e}`),t.json||n(s.bgCyan(s.black(` OG Tester — Site Scanner `)));let c=o(),l=`discovery`;t.json||c.start(`Discovering URLs from sitemap / homepage for ${s.underline(i)}...`);try{let e=await yg({concurrency:t.concurrency,maxUrls:t.maxUrls,onProgress:e=>{if(!t.json)if(e.type===`discovery`)l=`discovery`,c.message(`Discovering site URLs...`);else if(e.type===`checking`){l!==`checking`&&(l=`checking`);let t=`Scanning: [${e.completedUrls}/${e.totalUrls}] ${e.url} (${Og(e.result?.score||0)(e.result?.score||0)}/100)`;c.message(t)}else e.type===`complete`&&(l=`complete`)},siteUrl:i});if(t.json||c.stop(`Successfully scanned ${e.totalPages} pages!`),t.output&&await Fg(t.output,e,t.json),t.json){console.log(JSON.stringify(e,null,2)),t.minScore!==void 0&&e.averageScore<t.minScore&&process.exit(1);return}Ag(e),t.minScore!==void 0&&e.averageScore<t.minScore&&(a(s.red(`Scan failed: Average score ${e.averageScore} is below the threshold of ${t.minScore}`)),process.exit(1)),a(s.green(`Scan complete! Average score: ${e.averageScore}/100`))}catch(e){t.json?(console.error(JSON.stringify({error:e instanceof Error?e.message:String(e)})),process.exit(1)):(c.stop(`Failed to scan!`),r.error(`Scan error: ${e instanceof Error?e.message:String(e)}`),process.exit(1))}},Rg=async(e,t,n)=>{let r=e.length,i=e.reduce((e,t)=>e+t.score,0),o=Math.round(i/r),c={image:0,og:0,seo:0,twitter:0};for(let t of e)for(let e of t.categories){let t=e.maxScore>0?e.score/e.maxScore*100:0;e.id in c&&(c[e.id]+=t)}let l={image:Math.round(c.image/r),og:Math.round(c.og/r),seo:Math.round(c.seo/r),twitter:Math.round(c.twitter/r)},u={excellent:0,fair:0,good:0,poor:0};for(let t of e)t.score>=90?u.excellent+=1:t.score>=75?u.good+=1:t.score>=50?u.fair+=1:u.poor+=1;let d={averageScore:o,categoryAverages:l,pages:e,scannedAt:new Date().toISOString(),siteUrl:t,summary:u,totalPages:r};if(n.output&&await Fg(n.output,d,n.json),n.json){console.log(JSON.stringify(d,null,2)),n.minScore!==void 0&&d.averageScore<n.minScore&&process.exit(1);return}Ag(d),n.minScore!==void 0&&d.averageScore<n.minScore&&(a(s.red(`Scan failed: Average score ${d.averageScore} is below the threshold of ${n.minScore}`)),process.exit(1)),a(s.green(`Scan complete! Average score: ${d.averageScore}/100`))},zg=async(e,t)=>{let i=te(e);t.json||n(s.bgCyan(s.black(` OG Tester — Local HTML Scanner `)));let l=o();t.json||l.start(`Searching for HTML files in ${s.underline(i)}...`);try{let e=await Ng(i,i);e.length===0&&(l.stop(`No HTML files found!`),t.json?console.error(JSON.stringify({error:`No HTML files found`})):(r.warn(`No .html files were found recursively in ${i}.`),a(`Ensure the directory contains HTML files (e.g. from static export/build).`)),process.exit(1)),t.json||l.message(`Found ${e.length} HTML files. Parsing and scoring...`);let n=[],o=0;for(let r of e){let a=ee(i,r),s=await c(r,`utf-8`),u=`file:///${a.replaceAll(`\\`,`/`)}`,d=await cg(no(s,u),{pageUrl:u});d.url=`/${a.replaceAll(`\\`,`/`)}`,n.push(d),o+=1,t.json||l.message(`Scanned: [${o}/${e.length}] ${d.url} (${Og(d.score)(d.score)}/100)`)}l.stop(`Successfully scanned ${n.length} pages!`),await Rg(n,i,t)}catch(e){t.json?console.error(JSON.stringify({error:e instanceof Error?e.message:String(e)})):(l.stop(`Failed to scan!`),r.error(`Scan error: ${e instanceof Error?e.message:String(e)}`)),process.exit(1)}},Bg=(e,t)=>({concurrency:e.concurrency??t?.concurrency??5,json:e.json??!1,maxUrls:e.maxUrls??t?.maxUrls??200,minScore:e.minScore??t?.minScore,output:e.output??t?.output,scan:e.site||e.scan||t?.scan||!1}),Vg=(e,t)=>e&&(e.startsWith(`http://`)||e.startsWith(`https://`))?{isUrl:!0,url:e}:e&&/^[a-z0-9]+([-.]?[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/iu.test(e)?{isUrl:!0,url:`https://${e}`}:t?.url?{isUrl:!0,url:t.url}:{isUrl:!1,url:``},Hg=async(e,t)=>{let n=te(e||`.`),i=null,a=!1;try{let e=d(n)?f(n):null;a=e?e.isDirectory():!1,a&&(i=Pg(n))}catch{}let o=Bg(t,i),s=Vg(e,i);s.isUrl?await(o.scan?Lg(s.url,o):Ig(s.url,o)):a?await zg(n,o):(r.error(`Error: Path or URL "${e}" is not accessible.`),process.exit(1))},Ug=new e;Ug.name(`og-tester`).version(`0.1.0`).description(`Test and analyze Open Graph, Twitter Card, and meta tags from the command line`).argument(`[url-or-dir]`,`URL to check or directory of a local web app to scan`,`.`).option(`-s, --site`,`Scan the entire site (sitemap & crawler) instead of a single page`).option(`--concurrency <number>`,`Number of concurrent URL requests during scanning`,e=>Number.parseInt(e,10)).option(`--max-urls <number>`,`Maximum number of URLs to discover and scan`,e=>Number.parseInt(e,10)).option(`--json`,`Output raw JSON report to stdout instead of TUI`).option(`--output <path>`,`File path to write the JSON report`).option(`--min-score <number>`,`Minimum average score threshold (exit 1 if below)`,e=>Number.parseInt(e,10)).action(Hg),Ug.addCommand(Eg),Ug.addCommand(Dg),Ug.addCommand(Mg),Ug.addCommand(jg),Ug.parse();export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "og-tester",
3
- "version": "0.0.0",
3
+ "version": "0.1.0",
4
4
  "description": "Test and analyze Open Graph, Twitter Card, and meta tags from the command line",
5
5
  "keywords": [
6
6
  "cli",