schemas/libraries/effect/@beta/download_compiled/minified.jsCopy to clipboardconst e=(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}}},t={pipe(){return e(this,arguments)}},n=function(){function e(){}return e.prototype=t,e}(),r=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)}}}},i=e=>e,a=(e=>()=>e)(void 0),o=a;function s(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 c=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},l=new WeakSet;function u(e){return typeof e==`string`}function d(e){return typeof e==`number`}function f(e){return typeof e==`function`}function p(e){return e!=null}function m(e){return typeof e==`object`&&!!e||f(e)}const h=r(2,(e,t)=>m(e)&&t in e),g=`~effect/interfaces/Hash`,_=e=>{switch(typeof e){case`number`:return re(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(l.has(e))return ee(e);if(de.has(e))return de.get(e);let t=pe(e,()=>ne(e)?e[g]():typeof e==`function`?ee(e):Array.isArray(e)||ArrayBuffer.isView(e)?se(e):e instanceof Map?ce(e):e instanceof Set?le(e):ae(e));return de.set(e,t),t}default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},ee=e=>(ue.has(e)||ue.set(e,re(Math.floor(Math.random()*(2**53-1)))),ue.get(e)),v=r(2,(e,t)=>e*53^t),te=e=>e&3221225471|e>>>1&1073741824,ne=e=>h(e,g),re=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 te(t)},y=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return te(t)},ie=(e,t)=>{let n=12289;for(let r of t)n^=v(_(r),_(e[r]));return te(n)},ae=e=>ie(e,c(e)),oe=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return te(r)},se=oe(6151,_),ce=oe(y(`Map`),([e,t])=>v(_(e),_(t))),le=oe(y(`Set`),_),ue=new WeakMap,de=new WeakMap,fe=new WeakSet;function pe(e,t){if(fe.has(e))return y(`[Circular]`);fe.add(e);let n=t();return fe.delete(e),n}const b=`~effect/interfaces/Equal`;function x(){return arguments.length===1?e=>S(e,arguments[0]):S(arguments[0],arguments[1])}function S(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`||l.has(e)||l.has(t)?!1:ve(e,t,_e):!1}function me(e,t,n){let r=he.has(e),i=ge.has(t);if(r&&i)return!0;if(r||i)return!1;he.add(e),ge.add(t);let a=n();return he.delete(e),ge.delete(t),a}const he=new WeakSet,ge=new WeakSet;function _e(e,t){if(_(e)!==_(t))return!1;if(e instanceof Date)return t instanceof Date&&e.toISOString()===t.toISOString();if(e instanceof RegExp)return t instanceof RegExp&&e.toString()===t.toString();let n=De(e),r=De(t);if(n!==r)return!1;let i=n&&r;return typeof e==`function`&&!i?!1:me(e,t,()=>i?e[b](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:xe(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:Ee(e,t):Se(e,t))}function ve(e,t,n){let r=ye.get(e);if(!r)r=new WeakMap,ye.set(e,r);else if(r.has(t))return r.get(t);let i=n(e,t);r.set(t,i);let a=ye.get(t);return a||(a=new WeakMap,ye.set(t,a)),a.set(e,i),i}const ye=new WeakMap;function be(e,t){for(let n=0;n<e.length;n++)if(!S(e[n],t[n]))return!1;return!0}function xe(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 Se(e,t){let n=c(e),r=c(t);if(n.size!==r.size)return!1;for(let i of n)if(!r.has(i)||!S(e[i],t[i]))return!1;return!0}function Ce(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=Ce(S,S);function Te(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 Ee=Te(S),De=e=>h(e,b),Oe=()=>x,ke=e=>(t,n)=>t===n||e(t,n),Ae=e=>e.length>0,je=Symbol.for(`~effect/Redactable`),Me=e=>h(e,je);function Ne(e){return Me(e)?Pe(e):e}function Pe(e){return e[je](globalThis[`~effect/Fiber/currentFiber`]?.context??Ie)}const Fe=`~effect/Fiber/currentFiber`,Ie={"~effect/Context":{},mapUnsafe:new Map,pipe(){return e(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 Le;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(`, `+a(n+1));return`[\n${a(n+1)}${t}\n${a(n)}]`}if(e instanceof Date)return Be(e);if(!t?.ignoreToString&&h(e,`toString`)&&typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=Ve(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 Le;if(r.add(e),je in e)return C(Pe(e));if(Symbol.iterator in e)return`${e.constructor.name}(${c(Array.from(e),n)})`;let t=s(e);if(!i||t.length<=1){let r=`{${t.map(t=>`${Re(t)}:${c(e[t],n)}`).join(`,`)}}`;return o(e,r)}let l=`{\n${t.map(t=>`${a(n+1)}${Re(t)}: ${c(e[t],n+1)}`).join(`, `)}\n${a(n)}}`;return o(e,l)}return String(e)}return c(e,0)}const Le=`[Circular]`;function Re(e){return typeof e==`string`?JSON.stringify(e):String(e)}function ze(e){return e.map(e=>`[${Re(e)}]`).join(``)}function Be(e){try{return e.toISOString()}catch{return`Invalid Date`}}function Ve(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}const He=Symbol.for(`nodejs.util.inspect.custom`),Ue=e=>{try{if(h(e,`toJSON`)&&f(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(Ue)}catch{return`[toJSON threw]`}return Ne(e)};var We=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 Ge=(()=>{let e=`~effect/Utils/internal`,t={[e]:e=>e()},n={[e]:e=>{try{return e()}finally{}}};return t[e](()=>Error().stack)?.includes(e)===!0?t[e]:n[e]})(),w=`~effect/Effect`,Ke=`~effect/Exit`,qe={_A:i,_E:i,_R:i},Je=`${w}/identifier`,T=`${w}/args`,E=`${w}/evaluate`,D=`${w}/successCont`,O=`${w}/failureCont`,Ye=`${w}/ensureCont`,Xe=Symbol.for(`effect/Effect/Yield`),Ze={pipe(){return e(this,arguments)},toJSON(){return{...this}},toString(){return C(this.toJSON(),{ignoreToString:!0,space:2})},[He](){return this.toJSON()}},Qe={[w]:qe,...Ze,[Symbol.iterator](){return new We(this)},toJSON(){return{_id:`Effect`,op:this[Je],...T in this?{args:this[T]}:void 0}}},$e=e=>h(e,Ke),et=`~effect/Cause`,tt=`~effect/Cause/Reason`,nt=e=>h(e,et);var rt=class{[et];reasons;constructor(e){this[et]=et,this.reasons=e}pipe(){return e(this,arguments)}toJSON(){return{_id:`Cause`,failures:this.reasons.map(e=>e.toJSON())}}toString(){return`Cause(${C(this.reasons)})`}[He](){return this.toJSON()}[b](e){return nt(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>x(t,e.reasons[n]))}[g](){return se(this.reasons)}};const it=new WeakMap;var at=class{[tt];annotations;_tag;constructor(e,t,n){if(this[tt]=tt,this._tag=e,t!==ot&&typeof n==`object`&&n&&t.size>0){let e=it.get(n);e&&(t=new Map([...e,...t])),it.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 e(this,arguments)}toString(){return C(this)}[He](){return this.toString()}};const ot=new Map;var st=class extends at{error;constructor(e,t=ot){super(`Fail`,t,e),this.error=e}toString(){return`Fail(${C(this.error)})`}toJSON(){return{_tag:`Fail`,error:this.error}}[b](e){return pt(e)&&x(this.error,e.error)&&x(this.annotations,e.annotations)}[g](){return v(y(this._tag))(v(_(this.error))(_(this.annotations)))}};const ct=e=>new rt(e),lt=e=>new rt([new st(e)]);var ut=class extends at{defect;constructor(e,t=ot){super(`Die`,t,e),this.defect=e}toString(){return`Die(${C(this.defect)})`}toJSON(){return{_tag:`Die`,defect:this.defect}}[b](e){return mt(e)&&x(this.defect,e.defect)&&x(this.annotations,e.annotations)}[g](){return v(y(this._tag))(v(_(this.defect))(_(this.annotations)))}};const dt=e=>new rt([new ut(e)]),ft=r(e=>nt(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new rt(e.reasons.map(e=>e.annotate(t,n)))),pt=e=>e._tag===`Fail`,mt=e=>e._tag===`Die`,ht=e=>e._tag===`Interrupt`;function gt(e){return xt(`Effect.evaluate: Not implemented`)}const _t=e=>({...Qe,[Je]:e.op,[E]:e[E]??gt,[D]:e[D],[O]:e[O],[Ye]:e[Ye]}),k=e=>{let t=_t(e);return function(){let n=Object.create(t);return n[T]=e.single===!1?arguments:arguments[0],n}},vt=e=>{let t={..._t(e),[Ke]:Ke,_tag:e.op,get[e.prop](){return this[T]},toString(){return`${e.op}(${C(this[T])})`},toJSON(){return{_id:`Exit`,_tag:e.op,[e.prop]:this[T]}},[b](e){return $e(e)&&e._tag===this._tag&&x(this[T],e[T])},[g](){return v(y(e.op),_(this[T]))}};return function(e){let n=Object.create(t);return n[T]=e,n}},A=vt({op:`Success`,prop:`value`,[E](e){let t=e.getCont(D);return t?t[D](this[T],e,this):e.yieldWith(this)}}),yt={key:`effect/Cause/StackTrace`},j=vt({op:`Failure`,prop:`cause`,[E](e){let t=this[T],n=!1;e.currentStackFrame&&(t=ft(t,{mapUnsafe:new Map([[yt.key,e.currentStackFrame]])}),n=!0);let r=e.getCont(O);for(;e.interruptible&&e._interruptedCause&&r;)r=e.getCont(O);return r?r[O](t,e,n?void 0:this):e.yieldWith(n?this:j(t))}}),bt=e=>j(lt(e)),xt=e=>j(dt(e)),St=k({op:`WithFiber`,[E](e){return this[T](e)}}),Ct=function(){class e extends globalThis.Error{}let t=_t({op:`YieldableError`,[E](){return bt(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),wt=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return class extends Ct{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}}}}(),M=e=>{class t extends wt{_tag=e}return t.prototype.name=e,t};M(`NoSuchElementError`);const Tt=`~effect/data/Option`,Et={[Tt]:{_A:e=>e},...Ze,[Symbol.iterator](){return new We(this)}},Dt=Object.defineProperty(Object.assign(Object.create(Et),{_tag:`Some`,_op:`Some`,[b](e){return At(e)&&Mt(e)&&x(this.value,e.value)},[g](){return v(_(this._tag))(_(this.value))},toString(){return`some(${C(this.value)})`},toJSON(){return{_id:`Option`,_tag:this._tag,value:Ue(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),Ot=_(`None`),kt=Object.assign(Object.create(Et),{_tag:`None`,_op:`None`,valueOrUndefined:void 0,[b](e){return At(e)&&jt(e)},[g](){return Ot},toString(){return`none()`},toJSON(){return{_id:`Option`,_tag:this._tag}}}),At=e=>h(e,Tt),jt=e=>e._tag===`None`,Mt=e=>e._tag===`Some`,Nt=Object.create(kt),Pt=e=>{let t=Object.create(Dt);return t.value=e,t},Ft=`~effect/data/Result`;({...Ze});function It(e){return(t,n)=>t===n?0:e(t,n)}const Lt=It((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1),Rt=e=>r(2,(t,n)=>e(t,n)!==1),zt=e=>r(2,(t,n)=>e(t,n)!==-1),Bt=()=>Nt,N=Pt,Vt=jt,Ht=Mt,Ut=r(2,(e,t)=>Vt(e)?Bt():N(t(e.value))),Wt=globalThis.Array,Gt=e=>Wt.isArray(e)?e:Wt.from(e),Kt=r(2,(e,t)=>[...e,t]),qt=r(2,(e,t)=>Gt(e).concat(Gt(t)));Wt.isArray;const Jt=Ae,Yt=Ae;function Xt(e,t){return e<0||e>=t.length}const Zt=r(2,(e,t)=>{let n=Math.floor(t);if(Xt(n,e))throw Error(`Index out of bounds: ${n}`);return e[n]})(0),Qt=e=>e.slice(1),$t=r(3,(e,t,n)=>{let r=Gt(e),i=Gt(t);return Yt(r)?Yt(i)?rn(n)(qt(r,i)):r:i}),en=r(2,(e,t)=>$t(e,t,Oe())),tn=()=>[],nn=r(2,(e,t)=>e.map(t)),rn=r(2,(e,t)=>{let n=Gt(e);if(Yt(n)){let e=[Zt(n)],r=Qt(n);for(let n of r)e.every(e=>!t(n,e))&&e.push(n);return e}return[]}),an=`~effect/BigDecimal`,on={[an]:an,[g](){let e=fn(this);return v(_(e.value),re(e.scale))},[b](e){return sn(e)&&gn(this,e)},toString(){return`BigDecimal(${_n(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[He](){return this.toJSON()},pipe(){return e(this,arguments)}},sn=e=>h(e,an),cn=(e,t)=>{let n=Object.create(on);return n.value=e,n.scale=t,n},ln=(e,t)=>{if(e!==P&&e%un===P)throw RangeError(`Value must be normalized`);let n=cn(e,t);return n.normalized=n,n},P=BigInt(0),un=BigInt(10),dn=ln(P,0),fn=e=>{if(e.normalized===void 0)if(e.value===P)e.normalized=dn;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);let r=BigInt(t.substring(0,t.length-n)),i=e.scale-n;e.normalized=ln(r,i)}return e.normalized},pn=r(2,(e,t)=>t>e.scale?cn(e.value*un**BigInt(t-e.scale),t):t<e.scale?cn(e.value/un**BigInt(e.scale-t),t):e),mn=e=>e.value<P?cn(-e.value,e.scale):e,hn=ke((e,t)=>e.scale>t.scale?pn(t,e.scale).value===e.value:e.scale<t.scale?pn(e,t.scale).value===t.value:e.value===t.value),gn=r(2,(e,t)=>hn(e,t)),_n=e=>{let t=fn(e);if(Math.abs(t.scale)>=16)return vn(t);let n=t.value<P,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},vn=e=>{if(yn(e))return`0e+0`;let t=fn(e),n=`${mn(t).value}`,r=n.slice(0,1),i=n.slice(1),a=`${bn(t)?`-`:``}${r}`;i!==``&&(a+=`.${i}`);let o=i.length-t.scale;return`${a}e${o>=0?`+`:``}${o}`},yn=e=>e.value===P,bn=e=>e.value<P,xn=e=>_t({op:e.label,[E]:e.evaluate}),Sn=Object.getOwnPropertyDescriptor,Cn=Object.prototype.hasOwnProperty,wn=Object.isExtensible,Tn=(()=>{let e=Sn(Error,`stackTraceLimit`);return e===void 0?wn(Error):Cn.call(e,`writable`)?e.writable===!0:e.set!==void 0})(),En=()=>Error.stackTraceLimit,Dn=e=>{Tn&&(Error.stackTraceLimit=e)},On=`~effect/Context/Service`,kn=function(){let e=En();Dn(2);let t=Error();Dn(e);function n(){}let r=n;return Object.setPrototypeOf(r,An),Object.defineProperty(r,"stack",{get(){return t.stack}}),arguments.length>0?(r.key=arguments[0],arguments[1]?.defaultValue&&(r[jn]=jn,r.defaultValue=arguments[1].defaultValue),r):function(e,t){return r.key=e,t?.make&&(r.make=t.make),r}},An={[On]:On,...xn({label:`Service`,evaluate(e){return A(Bn(e.context,this))}}),toJSON(){return{_id:`Service`,key:this.key,stack:this.stack}},of(e){return e},context(e){return Rn(this,e)},use(e){return St(t=>e(Bn(t.context,this)))},useSync(e){return St(t=>A(e(Bn(t.context,this))))}},jn=`~effect/Context/Reference`,Mn=`~effect/Context`,Nn=e=>{let t=Object.create(Pn);return t.mapUnsafe=e,t.mutable=!1,t},Pn={...Ze,[Mn]:{_Services:e=>e},toJSON(){return{_id:`Context`,services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[b](e){if(!Fn(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 re(this.mapUnsafe.size)}},Fn=e=>h(e,Mn),In=()=>Ln,Ln=Nn(new Map),Rn=(e,t)=>Nn(new Map([[e.key,t]])),zn=r(3,(e,t,n)=>Gn(e,e=>{e.set(t.key,n)})),Bn=r(2,(e,t)=>{if(!e.mapUnsafe.has(t.key)){if(jn in t)return Un(t);throw Wn(t)}return e.mapUnsafe.get(t.key)}),Vn=(e,t)=>e.mapUnsafe.has(t.key)?e.mapUnsafe.get(t.key):Un(t),Hn=`~effect/Context/defaultValue`,Un=e=>Hn in e?e[Hn]:e[Hn]=e.defaultValue(),Wn=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(e.stack){let n=e.stack.split(` `);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(` `);e.splice(1,3),t.stack=e.join(` `)}return t},Gn=(e,t)=>{if(e.mutable)return t(e.mapUnsafe),e;let n=new Map(e.mapUnsafe);return t(n),Nn(n)},Kn=kn,qn=Kn(`effect/Scheduler`,{defaultValue:()=>new Xn}),Jn=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)};var Yn=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}},Xn=class{executionMode;setImmediate;constructor(e=`async`,t=Jn){this.executionMode=e,this.setImmediate=t}shouldYield(e){return e.currentOpCount>=e.maxOpsBeforeYield}makeDispatcher(){return new Zn(this.setImmediate)}},Zn=class{tasks=new Yn;running=void 0;setImmediate;constructor(e=Jn){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 Qn=Kn(`effect/Scheduler/MaxOpsBeforeYield`,{defaultValue:()=>2048}),$n=Kn(`effect/Scheduler/PreventSchedulerYield`,{defaultValue:()=>!1}),er=`effect/Tracer/ParentSpan`;kn()(er);const tr=Kn(`effect/References/CurrentStackFrame`,{defaultValue:a}),nr=Kn(`effect/References/CurrentLogLevel`,{defaultValue:()=>`Info`}),rr=Kn(`effect/References/MinimumLogLevel`,{defaultValue:()=>`Info`});var ir=class extends at{fiberId;constructor(e,t=ot){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[b](e){return ht(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[g](){return v(y(`${this._tag}:${this.fiberId}`))(ee(this.annotations))}};const ar=e=>new rt([new ir(e)]),or=e=>e.reasons.some(ht),sr=r(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new rt(en(e.reasons,t.reasons));return x(e,n)?e:n}),cr=r(2,(e,t)=>{let n=!1,r=e.reasons.map(e=>pt(e)?(n=!0,new st(t(e.error))):e);return n?ct(r):e}),lr=`~effect/Fiber/dev`,ur={_A:i,_E:i},dr={id:0},fr=()=>globalThis[Fe];var pr=class{constructor(e,t=!0){this[lr]=ur,this.setContext(e),this.id=++dr.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)}[lr];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 Vn(this.context,e)}addObserver(e){return this._exit?(e(this._exit),o):(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=ar(e);this.currentStackFrame&&(n=ft(n,Rn(yt,this.currentStackFrame))),t&&(n=ft(n,t)),this._interruptedCause=this._interruptedCause?sr(this._interruptedCause,n):n,this.interruptible&&this.evaluate(vr(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===Xe)return;let n=mr.interruptChildren&&mr.interruptChildren(this);if(n!==void 0)return this.evaluate(I(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[Fe];globalThis[Fe]=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=I(Sr,()=>e)}if(r=this.currentTracerContext?this.currentTracerContext(r,this):r[E](this),i!==this.currentLoopCount)return Xe;if(r===Xe){let e=this._yielded;return Ke in e?(this._yielded=void 0,e):Xe}}}catch(e){return h(r,E)?this.runLoop(xt(e)):xt(`Fiber.runLoop: Not a valid effect: ${String(r)}`)}finally{globalThis[Fe]=t}}getCont(e){for(;;){let t=this._stack.pop();if(!t)return;let n=t[Ye]&&t[Ye](this);if(n)return n[e]=n,n;if(t[e])return t}}yieldWith(e){return this._yielded=e,Xe}children(){return this._children??=new Set}pipe(){return e(this,arguments)}setContext(e){this.context=e;let t=this.getRef(qn);t!==this.currentScheduler&&(this.currentScheduler=t,this._dispatcher=void 0),this.currentSpan=e.mapUnsafe.get(er),this.currentLogLevel=this.getRef(nr),this.minimumLogLevel=this.getRef(rr),this.currentStackFrame=e.mapUnsafe.get(tr.key),this.maxOpsBeforeYield=this.getRef(Qn),this.currentPreventYield=this.getRef($n),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 mr={interruptChildren:void 0},hr=e=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(yt.key,e.currentStackFrame),Nn(t)},gr=e=>Ar(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(F(r))}return a(),br(()=>i?.())}),_r=e=>St(t=>{let n=hr(t);for(let r of e)r.interruptUnsafe(t.id,n);return Fr(gr(e))}),F=A,vr=j,yr=bt,br=k({op:`Sync`,[E](e){let t=this[T](),n=e.getCont(D);return n?n[D](t,e):e.yieldWith(A(t))}}),xr=k({op:`Suspend`,[E](e){return this[T]()}}),Sr=k({op:`Yield`,[E](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(Vr)},this[T]??0),e.yieldWith(()=>{t=!0})}})(0),Cr=e=>F(N(e)),wr=F(Bt()),Tr=e=>xr(()=>vr(Ge(e))),Er=e=>xt(e),Dr=F(void 0),Or=k({op:`Async`,single:!1,[E](e){let t=Ge(()=>this[T][0].bind(e.currentScheduler)),n=!1,r=!1,i=this[T][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??Vr))),Xe):r}}),kr=k({op:`AsyncFinalizer`,[Ye](e){e.interruptible&&(e.interruptible=!1,e._stack.push(qr))},[O](e,t){return or(e)?I(this[T](),()=>vr(e)):vr(e)}}),Ar=e=>Or(e,e.length>=2),jr=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),Mr=(e,...t)=>jr(e.length,t.length===0?function(){return Nr(()=>e.apply(this,arguments))}:function(){let n=Nr(()=>e.apply(this,arguments));for(let e of t)n=e(n);return n}),Nr=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return F(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 xr(()=>n?(n=!1,I(r.value,e=>Pr(t,e))):xr(()=>Pr(e())))}}}catch(e){return Er(e)}},Pr=k({op:`Iterator`,single:!1,[D](e,t){let n=this[T][0];for(;;){let r=n.next(e);if(r.done)return F(r.value);if(!L(r.value))return t._stack.push(this),r.value;if(r.value._tag===`Failure`)return r.value;e=r.value.value}},[E](e){return this[D](this[T][1],e)}}),Fr=e=>I(e,e=>Vr),I=r(2,(e,t)=>{let n=Object.create(Ir);return n[T]=e,n[D]=t.length===1?t:e=>t(e),n}),Ir=_t({op:`OnSuccess`,[E](e){return e._stack.push(this),this[T]}}),L=e=>Ke in e,Lr=r(2,(e,t)=>L(e)?e._tag===`Success`?t(e.value):e:I(e,t)),Rr=r(2,(e,t)=>I(e,e=>F(Ge(()=>t(e))))),zr=r(2,(e,t)=>L(e)?Hr(e,t):Rr(e,t)),Br=e=>e._tag===`Success`,Vr=A(void 0),Hr=r(2,(e,t)=>e._tag===`Success`?A(t(e.value)):e),Ur=r(2,(e,t)=>{let n=Object.create(Wr);return n[T]=e,n[O]=t.length===1?t:e=>t(e),n}),Wr=_t({op:`OnFailure`,[E](e){return e._stack.push(this),this[T]}}),Gr=e=>L(e)?A(e):Kr(e),Kr=k({op:`Exit`,[E](e){return e._stack.push(this),this[T]},[D](e,t,n){return F(n??A(e))},[O](e,t,n){return F(n??j(e))}}),qr=k({op:`SetInterruptible`,[Ye](e){if(e.interruptible=this[T],e._interruptedCause&&e.interruptible)return()=>vr(e._interruptedCause)}})(!0),Jr=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,h=()=>{let i=!1;for(;!p&&a<o;a++){let o=r[a],g=m??t(e,o,a);if(L(g)){if(p=n(e,o,g,a),p)break}else if(s===1)return I(Gr(g),t=>(p=n(e,o,t,a),a++,p??h()??Dr));else if(l){m=void 0;let t=Xr(l,g,!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=j(ct([e]))}else{let t=n(e,o,a,r);t&&(p=t._tag===`Failure`?j(ct(t.cause.reasons.slice())):t,h())}if(i){let e=h();e&&d(e)}else c&&u.size===0&&d(p??Dr)}),u.size<s)continue;i=!0,a++;return}else return Ar(e=>{l=fr(),m=g,d=e;let t=h();return t?e(t):xr(()=>(p=Vr,f=!0,u?_r(u):Dr))})}if(c=!0,p){if(u&&u.size>0){let e=hr(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(Dr);else return Vr};return h()}},Yr=()=>Jr,Xr=(e,t,n=!1,r=!1,i=!1)=>{let a=i===`inherit`?e.interruptible:!i,o=new pr(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},Zr=e=>(t,n)=>{let r=new pr(n?.scheduler?zn(e,qn,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},Qr=(e=>{let t=Zr(e);return e=>{if(L(e))return e;let n=new Xn(`sync`),r=t(e,{scheduler:n});return r.currentDispatcher?.flush(),r._exit??xt(new ei(r))}})(In());M(`TimeoutError`),M(`IllegalArgumentError`),M(`ExceededCapacityError`);const $r=`~effect/Cause/AsyncFiberError`;var ei=class extends M(`AsyncFiberError`){[$r]=$r;constructor(e){super({message:`An asynchronous Effect was executed with Effect.runSync`,fiber:e})}};M(`UnknownError`);const R={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};R.gray,R.blue,R.green,R.yellow,R.red,R.bgBrightRed,R.black;const ti=pt,ni=cr;kn()(`effect/Cause/StackTrace`),kn()(`effect/Cause/InterruptorStackTrace`);const ri=M,ii=j,ai=bt,oi=Vr,si=Br,ci=`~effect/time/DateTime`,li=`~effect/time/DateTime/TimeZone`,ui={[ci]:ci,pipe(){return e(this,arguments)},[He](){return this.toString()},toJSON(){return fi(this).toJSON()}};({...ui}),{...ui};const di={[li]:li,[He](){return this.toString()}};({...di}),{...di};const fi=e=>new Date(e.epochMilliseconds),z=F,pi=wr,mi=Cr,B=yr,hi=Tr,gi=I,_i=Gr,vi=Ur,yi=Qr;kn()(`effect/Effect/Transaction`);const bi=zr,V=Lr,xi=Mr;kn()(`effect/DateTime/CurrentTimeZone`),ri(`EncodingError`);function Si(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function Ci(e){return t=>Si(t)?.[e]}const wi=Ci(`identifier`),Ti=s(e=>{let t=wi(e);return typeof t==`string`?t:e.getExpected(Ti)});function Ei(e,t,n){return t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n,e}const Di=`~effect/SchemaIssue/Issue`;function Oi(e){return h(e,Di)}var H=class{[Di]=Di;toString(){return Ki(this)}},ki=class extends H{_tag=`Filter`;actual;filter;issue;constructor(e,t,n){super(),this.actual=e,this.filter=t,this.issue=n}},Ai=class extends H{_tag=`Encoding`;ast;actual;issue;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issue=n}},U=class extends H{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},ji=class extends H{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},Mi=class extends H{_tag=`UnexpectedKey`;ast;actual;constructor(e,t){super(),this.ast=e,this.actual=t}},W=class extends H{_tag=`Composite`;ast;actual;issues;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issues=n}},Ni=class extends H{_tag=`InvalidType`;ast;actual;constructor(e,t){super(),this.ast=e,this.actual=t}},Pi=class extends H{_tag=`InvalidValue`;actual;annotations;constructor(e,t){super(),this.actual=e,this.annotations=t}},Fi=class extends H{_tag=`AnyOf`;ast;actual;issues;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issues=n}},Ii=class extends H{_tag=`OneOf`;ast;actual;successes;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.successes=n}};function Li(e,t){if(Oi(t))return t;if(typeof t==`string`)return new Pi(N(e),{message:t});let n=typeof t.issue==`string`?new Pi(N(e),{message:t.issue}):t.issue;return new U(t.path,n)}function Ri(e,t){if(t!==void 0)return typeof t==`boolean`?t?void 0:new Pi(N(e)):Li(e,t)}function zi(e,t,n){return Array.isArray(n)?Yt(n)?n.length===1?Li(e,n[0]):new W(t,N(e),nn(n,t=>Li(e,t))):void 0:Ri(e,n)}const Bi=e=>{let t=Ji(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return Hi(Ti(e.ast),Xi(e.actual));case`InvalidValue`:return`Invalid data ${Xi(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)}`}},Vi=e=>Ji(e.issue)??Ji(e);function Hi(e,t){return`Expected ${e}, got ${t}`}function Ui(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:Hi(Wi(e.filter),C(e.actual))}];default:return Ui(e.issue,t,n,r)}}case`Encoding`:return Ui(e.issue,t,n,r);case`Pointer`:return Ui(e.issue,[...t,...e.path],n,r);case`Composite`:return e.issues.flatMap(e=>Ui(e,t,n,r));case`AnyOf`:{let i=Ji(e);return e.issues.length===0?i===void 0?[{path:t,message:Hi(Ti(e.ast),C(e.actual))}]:[{path:t,message:i}]:e.issues.flatMap(e=>Ui(e,t,n,r))}default:return[{path:t,message:n(e)}]}}function Wi(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=>Wi(e)).join(` & `)}}function Gi(){return e=>Ui(e,[],Bi,Vi).map(qi).join(` `)}const Ki=Gi();function qi(e){let t=e.message;if(e.path&&e.path.length>0){let n=ze(e.path);t+=`\n at ${n}`}return t}function Ji(e){switch(e._tag){case`InvalidType`:case`OneOf`:case`Composite`:case`AnyOf`:return Yi(e.ast.annotations);case`InvalidValue`:case`Forbidden`:return Yi(e.annotations);case`MissingKey`:return Yi(e.annotations,`messageMissingKey`);case`UnexpectedKey`:return Yi(e.ast.annotations,`messageUnexpectedKey`);case`Filter`:return Yi(e.filter.annotations);case`Encoding`:return Ji(e.issue)}}function Yi(e,t=`message`){let n=e?.[t];if(typeof n==`string`)return n}function Xi(e){return Vt(e)?`no value provided`:C(e.value)}function Zi(e){let t;for(let n of e.reasons){if(!ti(n)||!Oi(n.error))return;t??=n.error}return t}function Qi(e,t){let n=Zi(e);if(n===void 0)throw Error(t,{cause:e});return n}var $i=class e extends n{run;constructor(e){super(),this.run=e}map(t){return new e((e,n)=>this.run(e,n).pipe(bi(Ut(t))))}compose(t){return ta(this)?t:ta(t)?this:new e((e,n)=>this.run(e,n).pipe(V(e=>t.run(e,n))))}};const ea=new $i(z);function ta(e){return e.run===ea.run}function na(){return ea}function G(e){return ra(Ut(e))}function ra(e){return new $i(t=>z(e(t)))}function ia(){return G(globalThis.String)}function aa(){return G(globalThis.Number)}const oa=`~effect/SchemaTransformation/Transformation`;var sa=class e{[oa]=oa;_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 ca(e){return h(e,oa)}const la=e=>ca(e)?e:new sa(e.decode,e.encode),ua=new sa(na(),na());function da(){return ua}const fa=new sa(aa(),ia());function pa(e){return t=>t._tag===e}const ma=pa(`Declaration`),ha=pa(`Never`),ga=pa(`Literal`),_a=pa(`UniqueSymbol`),va=pa(`Arrays`),ya=pa(`Objects`);var K=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}};const ba={};var xa=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 Sa=`~effect/Schema`;var q=class{[Sa]=Sa;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}>`}},Ca=class e extends q{_tag=`Declaration`;typeParameters;run;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.typeParameters=e,this.run=t,this.encodingChecks=o}getParser(){let e=this.run(this.typeParameters);return(t,n)=>Vt(t)?pi:bi(e(t.value,this,n),N)}_rebuild(t,n,r){let i=bo(this.typeParameters,t);return i===this.typeParameters&&n===this.checks&&r===this.encodingChecks?this:new e(i,this.run,this.annotations,n,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){let e=this.annotations?.expected;return typeof e==`string`?e:`<Declaration>`}};const wa=new class extends q{_tag=`Null`;getParser(){return Oo(this,null)}getExpected(){return`null`}};var Ta=class extends q{_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 Oo(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==`bigint`?Ea(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:Ea(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function Ea(e){let t=globalThis.String(e.literal);return J(e,[new K(new Ta(t),new sa(G(()=>e.literal),G(()=>t)))])}const Da=new class extends q{_tag=`String`;getParser(){return ko(this,u)}matchPart(e,t){return Ao(this,e,t)}getExpected(){return`string`}};var Oa=class extends q{_tag=`Number`;getParser(){return ko(this,d)}matchKey(e,t){return this._match(No,e,t)}matchPart(e,t){return this._match(Mo,e,t)}_match(e,t,n){return e.test(t)?Ao(this,globalThis.Number(t),n):void 0}toCodecJson(){return this.checks&&(ka(this.checks,`isFinite`)||ka(this.checks,`isInt`))?this:J(this,[io])}toCodecStringTree(){return this.checks&&(ka(this.checks,`isFinite`)||ka(this.checks,`isInt`))?J(this,[Io]):J(this,[Lo])}getExpected(){return`number`}};function ka(e,t){return e.some(e=>{switch(e._tag){case`Filter`:return e.annotations?.meta?._tag===t;case`FilterGroup`:return ka(e.checks,t)}})}const Aa=new Oa;var ja=class e extends q{_tag=`Arrays`;isMutable;elements;rest;encodingChecks;constructor(e,t,n,r,i,a,o,s){super(r,i,a,o),this.isMutable=e,this.elements=t,this.rest=n,this.encodingChecks=s;let c=t.findIndex(Y);if(c!==-1&&(t.slice(c+1).some(e=>!Y(e))||n.length>1))throw Error(`A required element cannot follow an optional element. ts(1257)`);if(n.length>1&&n.slice(1).some(Y))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 xi(function*(e,n){if(e._tag===`None`)return e;let r=e.value;if(!Array.isArray(r))return yield*B(new Ni(t,e));let a=r.length,o={ast:t,getParser:c,oinput:e,len:a,tailThreshold:Na(a,i,s),output:new globalThis.Array(a),issues:void 0,options:n},l=Pa(n?.concurrency),u=Ma(o,r,{concurrency:l?.concurrency,end:t.rest.length===0?i:Math.max(a,i+s)});if(u&&(yield*u),t.rest.length===0&&a>i)for(let s=i;s<=a-1;s++){let i=new U([s],new Mi(t,r[s]));if(n.errors===`all`)o.issues?o.issues.push(i):o.issues=[i];else return yield*B(new W(t,e,[i]))}return o.issues?yield*B(new W(t,e,o.issues)):N(o.output)})}_rebuild(t,n,r){let i=bo(this.elements,t),a=bo(this.rest,t);return i===this.elements&&a===this.rest&&n===this.checks&&r===this.encodingChecks?this:new e(this.isMutable,i,a,this.annotations,n,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return`array`}};const Ma=Yr()({onItem(e,t,n){let r=n<e.len?N(t):Bt();return e.getParser(e.tailThreshold,n).parser(r,e.options)},step(e,t,n,r){if(n._tag===`Failure`)return Fa(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(Y(t.ast))return;let n=new U([r],new ji(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return ai(new W(e.ast,e.oinput,[n]))}}});function Na(e,t,n){return Math.max(t,e-n)}const Pa=e=>(e=e===`unbounded`?1/0:e??1,e>1?{concurrency:e}:void 0),Fa=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let i=Zi(r.cause);if(i===void 0)return ii(ni(r.cause,r=>new W(t,e.oinput,[new U([n],r)])));let a=new U([n],i);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return ai(new W(t,e.oinput,[a]))},Ia=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;function La(e,t,n=ba){let r,i;function a(t){switch(t._tag){case`String`:case`TemplateLiteral`:return(r??=Object.keys(e)).filter(e=>t.matchPart(e,n)!==void 0);case`Number`:return(r??=Object.keys(e)).filter(e=>t.matchKey(e,n)!==void 0);case`Symbol`:return(i??=Object.getOwnPropertySymbols(e)).filter(e=>t.matchKey(e,n)!==void 0);case`Union`:return[...new Set(t.types.flatMap(a))];default:return[]}}return a(jo(wo(t)))}var Ra=class{name;type;constructor(e,t){this.name=e,this.type=t}};function za(e){switch(e._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return e.types.every(za);default:return!1}}function Ba(e){return za(e)&&za(wo(e))}var Va=class{parameter;type;merge;constructor(e,t,n){if(!Ba(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,this.merge=n,Y(t)&&!Do(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},Ha=class e extends q{_tag=`Objects`;propertySignatures;indexSignatures;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=o;let s=e.map(e=>e.name).filter((e,t,n)=>n.indexOf(e)!==t);if(s.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(s)}. 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 ko(t,p);let o=a>0?Yr()({onItem:xi(function*(n,[i,a]){let o=e(jo(a.parameter))(N(i),n.options),s=L(o)?o:yield*_i(o);if(s._tag===`Failure`){let e=Fa(n,t,i,s);e&&(yield*e);return}let c=N(n.input[i]),l=e(a.type)(c,n.options),u=L(l)?l:yield*_i(l);if(u._tag===`Failure`){let e=Fa(n,t,i,u);e&&(yield*e);return}else if(s.value._tag===`Some`&&u.value._tag===`Some`){let e=s.value.value;if(r.has(i)||r.has(e))return;let t=u.value.value;if(a.merge&&a.merge.decode&&Object.hasOwn(n.out,e)){let[r,i]=a.merge.decode.combine([e,n.out[e]],[e,t]);Ei(n.out,r,i)}else Ei(n.out,e,t)}}),step:(e,t,n)=>n._tag===`Failure`?n:void 0}):void 0;return xi(function*(e,s){if(e._tag===`None`)return e;let c=e.value;if(!(typeof c==`object`&&c&&!Array.isArray(c)))return yield*B(new Ni(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 U([i],new Mi(t,c[i]));if(d){u.issues?u.issues.push(n):u.issues=[n];continue}else return yield*B(new W(t,e,[n]))}else Ei(l,i,c[i])}}let h=Pa(s?.concurrency),g=Ua(u,i,h);if(g&&(yield*g),o){let e=tn();for(let n=0;n<a;n++){let r=t.indexSignatures[n],i=La(c,r.parameter,s);for(let t=0;t<i.length;t++){let n=i[t];e.push([n,r])}}let n=o(u,e,h);n&&(yield*n)}if(u.issues)return yield*B(new W(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)&&Ei(t,n,l[n]);return N(t)}return N(l)})}_rebuild(t,n,r,i,a){let o=bo(this.propertySignatures,e=>{let n=t(e.type);return n===e.type?e:new Ra(e.name,n)}),s=bo(this.indexSignatures,e=>{let i=n(e.parameter),a=t(e.type),o=r?e.merge?.flip():e.merge;return i===e.parameter&&a===e.type&&o===e.merge?e:new Va(i,a,o)});return o===this.propertySignatures&&s===this.indexSignatures&&i===this.checks&&a===this.encodingChecks?this:new e(o,s,this.annotations,i,void 0,this.context,a)}flip(e){return this._rebuild(e,e,!0,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,!1,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?`object | array`:`object`}};const Ua=Yr()({onItem(e,t){let n=Object.hasOwn(e.input,t.name)?N(e.input[t.name]):Bt();return t.parser(n,e.options)},step(e,t,n){if(n._tag===`Failure`)return Fa(e,e.ast,t.name,n);if(n.value._tag===`Some`)Ei(e.out,t.name,n.value.value);else if(!Y(t.type)){let n=new U([t.name],new ji(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}else return ai(new W(e.ast,e.oinput,[n]))}}});function Wa(e,t){return e?t?[...e,...t]:e:t}function Ga(e,t,n){return new Ha(Reflect.ownKeys(e).map(t=>new Ra(t,e[t].ast)),[],n,t)}function Ka(e){return e.ast}function qa(e,t=void 0){return new ja(!1,e.map(e=>e.ast),[],void 0,t)}function Ja(e,t,n){return new to(e.map(Ka),t,void 0,n)}function Ya(e){switch(e._tag){case`Null`:return[`null`];case`Undefined`: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(Ya)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function Xa(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(!Y(t)){if(ga(t))return[{key:e.name,literal:t.literal}];if(_a(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>ga(e)&&!Y(e)?[{key:t,literal:e.literal}]:[]);case`Suspend`:return Xa(e.thunk())}}const Za=new WeakMap;function Qa(e){let t=Za.get(e);if(t)return t;t={};for(let n of e){let e=wo(n);if(ha(e))continue;let r=Ya(e),i=Xa(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 Za.set(e,t),t}function $a(e){return t=>{let n=wo(t);return n._tag===`Literal`?n.literal===e:n._tag!==`UniqueSymbol`||n.symbol===e}}function eo(e,t){let n=Qa(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($a(e))}}return t}return(n.byType?.[r]??[]).filter($a(e))}var to=class e extends q{_tag=`Union`;types;mode;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.types=e,this.mode=t,this.encodingChecks=o}getParser(e){let t=this;return(n,r)=>{if(n._tag===`None`)return z(n);let i=n.value,a=eo(i,t.types),o={ast:t,recur:e,oinput:n,input:i,out:void 0,successes:[],issues:void 0,options:r},s=Pa(r?.concurrency),c=no(o,a,s);return c?gi(c,e=>o.out?z(o.out):B(new Fi(t,i,o.issues??[]))):o.out?z(o.out):B(new Fi(t,i,o.issues??[]))}}_rebuild(t,n,r){let i=bo(this.types,t);return i===this.types&&n===this.checks&&r===this.encodingChecks?this:new e(i,this.mode,this.annotations,n,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let n of this.types){let r=n.matchPart(e,t);if(r!==void 0)return r}}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=wo(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(ga);if(t.length>0)return`${ao(n.isMutable)}[ ${t.map(t=>e(t)+oo(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>ga(e.type));if(t.length>0)return`{ ${t.map(t=>`${ao(t.type.context?.isMutable)}${Re(t.name)}${oo(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};const no=Yr()({onItem(e,t){return e.recur(t)(e.oinput,e.options)},step(e,t,n){if(n._tag===`Failure`){let t=Zi(n.cause);if(t===void 0)return n;e.issues?e.issues.push(t):e.issues=[t]}else{if(e.out&&e.ast.mode===`oneOf`)return e.successes.push(t),ai(new Ii(e.ast,e.input,e.successes));if(e.out=n.value,e.successes.push(t),e.ast.mode===`anyOf`)return oi}}}),ro=new to([new Ta(`Infinity`),new Ta(`-Infinity`),new Ta(`NaN`)],`anyOf`),io=new K(new to([Aa,ro],`anyOf`),new sa(aa(),G(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function ao(e){return e?``:`readonly `}function oo(e){return e?`?`:``}var so=class e extends n{_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 co([this,e],t)}},co=class e extends n{_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 lo(e,t,n=!1){return new so((t,n,r)=>zi(t,n,e(t,n,r)),t,n)}function uo(e,t){let n=e.source;return lo(t=>e.test(t),{expected:`a string matching the RegExp ${n}`,meta:{_tag:`isPattern`,regExp:e},arbitrary:{constraint:{patterns:[e.source]}},...t})}function fo(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}function J(e,t){return e.encoding===t?e:fo(e,e=>{e.encoding.value=t})}function po(e,t){return e.context===t?e:fo(e,e=>{e.context.value=t})}function mo(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return ho(e,Kt(e.checks.slice(0,-1),n.annotate(t)))}return fo(e,e=>{e.annotations.value={...e.annotations.value,...t}})}function ho(e,t){if(e._tag===`Suspend`&&t!==void 0)throw Error(`Cannot add checks to Suspend`);return e.checks===t?e:fo(e,e=>{e.checks.value=t})}function go(e,t){return ho(e,Wa(e.checks,t))}function _o(e,t){let n=e,r=n[n.length-1],i=t(r.to);return i===r.to?e:Kt(e.slice(0,e.length-1),new K(i,r.transformation))}function vo(e){function t(n){return n.encoding?J(n,_o(n.encoding,t)):e(n)}return s(t)}function yo(e,t,n){let r=new K(e,t);return J(n,n.encoding?[...n.encoding,r]:[r])}function bo(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 xo(e,t){return po(e,e.context?new xa(e.context.isOptional,e.context.isMutable,e.context.defaultValue,{...e.context.annotations,...t}):new xa(!1,!1,void 0,t))}function So(e,t,n){return yo(e,n,t)}function Y(e){return e.context?.isOptional??!1}const Co=s(e=>{if(e.encoding)return Co(J(e,void 0));let t=e,n=t.recur?.(Co)??t,r=n.encodingChecks;return r?fo(n,t=>{t.encodingChecks.value=void 0,n===e&&(t.checks.value=Wa(n.checks,r))}):n}),wo=s(e=>Co(Eo(e)));function To(e,t){let n=t,r=n.length,i=n[r-1],a=[new K(Eo(J(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new K(Eo(n[e-1].to),n[e].transformation.flip()));let o=Eo(i.to);return o.encoding?J(o,[...o.encoding,...a]):J(o,a)}const Eo=s(e=>{if(e.encoding)return To(e,e.encoding);let t=e;return t.flip?.(Eo)??t.recur?.(Eo)??t});function Do(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(Do);default:return!1}}function Oo(e,t){let n=mi(t);return r=>r._tag===`None`?pi:r.value===t?n:B(new Ni(e,r))}function ko(e,t){return n=>n._tag===`None`?pi:t(n.value)?z(n):B(new Ni(e,n))}function Ao(e,t,n){if(n?.disableChecks||e.checks===void 0)return t;let r=[];return Ro(e.checks,t,r,e,n),r.length===0?t:void 0}const jo=vo(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(jo)}}),Mo=new globalThis.RegExp(`^${Ia}$`),No=new globalThis.RegExp(`(?:${Ia}|Infinity|-Infinity|NaN)`);function Po(e){return uo(Mo,{expected:`a string representing a finite number`,meta:{_tag:`isStringFinite`,regExp:Mo},...e})}const Fo=go(Da,[Po()]),Io=new K(Fo,fa),Lo=new K(new to([Fo,ro],`anyOf`),fa);function Ro(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`)Ro(o.checks,t,n,r,i);else{let e=o.run(t,r,i);if(e&&(n.push(new ki(t,o,e)),o.aborted||i?.errors!==`all`))return}}}const zo=`~structural`,Bo=e=>e,Vo=s(e=>{switch(e._tag){case`Declaration`:{let t=e.annotations?.[`~effect/Schema/Class`];if(f(t)){let n=t(e.typeParameters),r=Vo(n.to);return J(e,r===n.to?[n]:[new K(r,n.transformation)])}return e}case`Objects`:case`Arrays`:return e.recur(e=>{let t=e.context?.defaultValue;return t?J(Vo(e),t):Vo(e)});case`Suspend`:return e.recur(Vo);default:return e}});function Ho(e){let t=qo(Vo(Co(e.ast)));return(e,n)=>t(e,n?.disableChecks?n?.parseOptions?{...n.parseOptions,disableChecks:!0}:{disableChecks:!0}:n?.parseOptions)}function Uo(e){let t=Ho(e);return(e,n)=>{let r=yi(t(e,n));return si(r)?N(r.value):(Qi(r.cause,`Option adapter can only return none for schema issues`),Bt())}}function Wo(e){let t=Ho(e);return(e,n)=>{let r=yi(t(e,n));if(si(r))return r.value;let i=Qi(r.cause,`Constructor adapter can only throw schema issues`);throw Error(i.toString(),{cause:i})}}function Go(e,t){let n=qo(e.ast);return t===void 0?n:(e,r)=>n(e,Ko(t,r))}const Ko=(e,t)=>t===void 0?e:{...e,...t};function qo(e){let t=Yo(e);return(e,n)=>V(t(N(e),n??ba),e=>e._tag===`None`?B(new Pi(e)):z(e.value))}function Jo(e,t){return vi(e,e=>hi(()=>ni(e,t)))}const Yo=s(e=>{let t,n=e.checks,r=e.encoding,i=r,a=i?.length??0,o=e.encodingChecks,s=(n?n[n.length-1].annotations:e.annotations)?.parseOptions;if(!e.context&&!r&&!n&&!o)return(n,r)=>(t??=e.getParser(Yo),s&&(r={...r,...s}),t(n,r));let c=va(e)||ya(e)||ma(e)&&e.typeParameters.length>0,l=n&&c?n.filter(e=>e.annotations?.[zo]):void 0;return(r,c)=>{s&&(c={...c,...s});let u;if(i){for(let e=a-1;e>=0;e--){let t=i[e],n=t.to,a=Yo(n);if(u=u?V(u,e=>a(e,c)):a(r,c),t.transformation._tag===`Transformation`){let e=t.transformation.decode;u=V(u,t=>e.run(t,c))}else u=t.transformation.decode(u,c)}u=Jo(u,t=>new Ai(e,r,t))}t??=e.getParser(Yo);let d=r=>{let i=t(r,c);return o&&!c?.disableChecks&&(i=V(i,t=>{if(Ht(r)&&Ht(t)){let t=[];if(Ro(o,r.value,t,e,c),Jt(t))return B(new W(e,r,t))}return z(t)})),n&&!c?.disableChecks&&(c?.errors===`all`&&l&&l.length>0&&Ht(r)&&(i=Jo(i,t=>{let n=[];return Ro(l,r.value,n,e,c),Jt(n)?t._tag===`Composite`&&t.ast===e?new W(e,t.actual,[...t.issues,...n]):new W(e,r,[t,...n]):t})),i=V(i,t=>{if(Ht(t)){let r=t.value,i=[];if(Ro(n,r,i,e,c),Jt(i))return B(new W(e,t,i))}return z(t)})),i};return u?V(u,d):d(r)}}),Xo=`~effect/Schema/Schema`,Zo={[Xo]:Xo,pipe(){return e(this,arguments)},annotate(e){return this.rebuild(mo(this.ast,e))},annotateKey(e){return this.rebuild(xo(this.ast,e))},check(...e){return this.rebuild(go(this.ast,e))}};function Qo(e,t){let n=Object.create(Zo);return t&&Object.assign(n,t),n.ast=e,n.rebuild=e=>Qo(e,t),n.makeEffect=(e,t)=>ts(Ho(n)(e,t)),n.make=Wo(n),n.makeOption=Uo(n),n}const $o=`~effect/Schema/SchemaError`;var es=class extends ri(`SchemaError`){[$o]=$o;constructor(e){super({issue:e})}get message(){return this.issue.toString()}toString(){return`SchemaError(${this.message})`}};function ts(e){return vi(e,e=>hi(()=>ni(e,e=>new es(e))))}function ns(){return(e,t,n)=>X(new Ca(e.map(Ka),e=>t(e.map(e=>X(e))),n))}function rs(e,t){return ns()([],()=>(t,n)=>e(t)?z(t):B(new Ni(n,N(t))),t)}function is(e){return h(e,$o)}function as(e,t){let n=Go(e,t);return(e,t)=>ts(n(e,t))}function os(e,t){let n;for(let r of e.reasons){if(!ti(r)||!is(r.error))throw new globalThis.Error(t,{cause:e});n??=r.error}if(n===void 0)throw new globalThis.Error(t,{cause:e});return n}function ss(e){let t=yi(e);if(si(t))return t.value;throw os(t.cause,`Sync adapter can only throw schema errors`)}function cs(e,t){let n=as(e,t);return(e,t)=>ss(n(e,t))}const X=Qo;function ls(e){let t=X(new Ta(e),{literal:e,transform(n){return t.pipe(bs(ls(n),{decode:G(()=>n),encode:G(()=>e)}))}});return t}const us=X(wa),Z=X(Da),Q=X(Aa);function ds(e,t){return X(e,{fields:t,mapFields(e,t){let n=e(this.fields);return ds(Ga(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function fs(e){return ds(Ga(e,void 0),e)}function ps(e,t){return X(e,{elements:t,mapElements(e,t){let n=e(this.elements);return ps(qa(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}const ms=Bo(e=>X(new ja(!1,[],[e.ast]),{value:e})),hs=Bo(e=>X(new ja(!0,e.ast.elements,e.ast.rest),{schema:e}));function gs(e,t){return X(e,{members:t,mapMembers(e,t){let n=e(this.members);return gs(Ja(n,this.ast.mode,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function _s(e,t){return gs(Ja(e,t?.mode??`anyOf`,void 0),e)}function vs(e){let t=e.map(ls);return X(Ja(t,`anyOf`,void 0),{literals:e,members:t,mapMembers(e){return _s(e(this.members))},pick(e){return vs(e)},transform(e){return _s(t.map((t,n)=>t.transform(e[n])))}})}const ys=Bo(e=>_s([e,us]));function bs(e,t){return n=>X(So(n.ast,e.ast,t?la(t):da()),{from:n,to:e})}function xs(e,t){return rs(t=>t instanceof e,t)}const Ss=lo;function Cs(e){let t=zt(e.order),n=e.formatter??C;return(r,i)=>Ss(e=>t(e,r),{expected:`a value greater than or equal to ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:r}}},...e.annotate?.(r),...i})}function ws(e){let t=Rt(e.order),n=e.formatter??C;return(r,i)=>Ss(e=>t(e,r),{expected:`a value less than or equal to ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,maximum:r}}},...e.annotate?.(r),...i})}const Ts=Cs({order:Lt,annotate:e=>({meta:{_tag:`isGreaterThanOrEqualTo`,minimum:e}})}),Es=ws({order:Lt,annotate:e=>({meta:{_tag:`isLessThanOrEqualTo`,maximum:e}})});function Ds(e,t){return e=Math.max(0,Math.floor(e)),Ss(t=>t.length>=e,{expected:`a value with a length of at least ${e}`,meta:{_tag:`isMinLength`,minLength:e},[zo]:!0,arbitrary:{constraint:{minLength:e}},...t})}function $(e,t){return e=Math.max(0,Math.floor(e)),Ss(t=>t.length<=e,{expected:`a value with a length of at most ${e}`,meta:{_tag:`isMaxLength`,maxLength:e},[zo]:!0,arbitrary:{constraint:{maxLength:e}},...t})}globalThis.RegExp,globalThis.URL,globalThis.File,globalThis.FormData,globalThis.URLSearchParams,globalThis.Uint8Array;const Os=fs({id:Q,created:xs(Date),title:Z.check(Ds(1),$(100)),type:vs([`jpg`,`png`]),size:Q,url:Z.check(Ss(e=>URL.canParse(e)))}),ks=fs({id:Q,stars:Q.check(Ts(0),Es(5)),title:Z.check(Ds(1),$(100)),text:Z.check(Ds(1),$(1e3)),images:hs(ms(Os))});cs(fs({id:Q,created:xs(Date),title:Z.check(Ds(1),$(100)),brand:Z.check(Ds(1),$(30)),description:Z.check(Ds(1),$(500)),price:Q.check(Ts(1),Es(1e4)),discount:ys(Q.check(Ts(1),Es(100))),quantity:Q.check(Ts(1),Es(10)),tags:hs(ms(Z.check(Ds(1),$(30)))),images:hs(ms(Os)),ratings:hs(ms(ks))}))({});