LogoLogo

Schema Benchmarks

    • home
      Home

    • download_2
      Download

    • timer
      Initialization
    • check_circle
      Validation
    • output_circle
      Parsing
    • swap_horiz
      Codec
    • schema
      Standard Schema
    • format_quote
      String

    • error
      Stack

  • JSON Schema

    • data_object
      Schema to JSON
    • code
      JSON to Schema

    • deployed_code
      Libraries

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

Preferences

Style
Theme
NPM browser
Code ligatures