@systemfsoftware/omp-agent-discipline 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Cause-AGt2deue.js +1 -0
- package/dist/Effect-92Od3962.js +14 -0
- package/dist/Exit-SvLE99lR.js +1 -0
- package/dist/core-CanocZlS.js +13 -0
- package/dist/dist-aXTLYR81.js +16 -0
- package/dist/esm-Dv-ifW0J.js +1 -0
- package/dist/helpers-DXMuv8Tv.js +1 -0
- package/dist/index.js +3 -29117
- package/dist/no-skill-delegation.executor-DnZwOO4-.js +2 -0
- package/dist/rolldown-runtime-DK3Fl9T5.js +1 -0
- package/dist/runtime-KkPFPF3a.js +1 -0
- package/package.json +8 -7
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{$c as e,$o as t,Ao as n,As as r,Bs as i,Cc as a,Cr as o,Dn as s,Do as c,Ds as l,Es as u,Fc as d,Fi as f,Fo as p,Fs as m,Gc as h,Gs as g,Hi as _,Hs as ee,Ic as te,Io as ne,Jc as re,Ji as ie,Jr as ae,Js as oe,Kc as se,Ko as ce,Ks as le,Lc as ue,Lr as de,Ls as v,Mi as fe,Ms as pe,Nc as me,Ni as he,Nr as ge,Ns as y,Oo as _e,Os as ve,Pc as ye,Pi as be,Pr as xe,Ps as b,Qc as Se,Qi as Ce,Qo as we,Rc as Te,Rs as Ee,So as De,Ss as Oe,Tc as ke,To as Ae,Tr as je,Ts as Me,Ui as Ne,Uo as Pe,Us as Fe,Vi as Ie,Vo as Le,Vs as Re,Wi as ze,Wo as Be,Ws as x,Xn as Ve,Xs as S,Yi as He,Zc as Ue,Zi as We,Zo as Ge,Zs as Ke,_l as C,aa as qe,as as Je,b as Ye,bc as Xe,bo as Ze,bs as Qe,ci as $e,cl as et,cr as tt,ct as nt,dl as rt,dt as it,ea as at,el as ot,fs as st,ft as ct,gl as w,go as lt,hl as T,ic as ut,il as dt,in as ft,jc as pt,ji as mt,js as ht,k as gt,kc as _t,ko as vt,kr as yt,ks as bt,li as xt,ll as St,ml as Ct,nl as wt,no as Tt,ol as Et,pt as Dt,qc as Ot,qi as kt,qo as At,qs as jt,ra as Mt,rl as Nt,rt as Pt,sl as Ft,ta as It,tl as Lt,ul as Rt,us as zt,ut as Bt,vn as Vt,vo as Ht,w as Ut,wc as Wt,wr as Gt,ws as Kt,xc as qt,xo as Jt,xs as Yt,yo as Xt,ys as Zt,zo as Qt,zs as $t}from"./core-CanocZlS.js";import{$t as en,A as tn,At as E,B as nn,C as rn,Cn as an,Ct as on,D as sn,Dn as cn,Dt as ln,E as un,En as dn,Et as fn,F as D,Ft as pn,G as mn,H as hn,I as gn,It as _n,J as vn,K as yn,L as bn,Lt as xn,M as Sn,Mt as Cn,N as wn,Nt as Tn,O as En,On as Dn,Ot as On,P as kn,Pt as An,Q as jn,R as Mn,Rt as Nn,S as Pn,Sn as Fn,St as In,T as Ln,Tn as Rn,Tt as zn,W as Bn,X as Vn,Y as Hn,Z as Un,_ as Wn,_n as Gn,_t as Kn,a as qn,an as Jn,at as Yn,b as O,bn as Xn,bt as Zn,cn as Qn,ct as $n,d as er,dn as tr,dt as nr,en as rr,et as ir,f as ar,ft as or,g as k,gn as sr,gt as cr,h as lr,hn as ur,ht as dr,i as fr,it as pr,j as mr,jt as hr,k as gr,kn as _r,kt as vr,l as yr,ln as br,m as xr,mn as Sr,mt as Cr,n as A,nn as wr,nt as j,o as Tr,on as Er,ot as Dr,p as Or,pn as kr,q as Ar,qt as jr,r as Mr,rn as Nr,rt as M,s as Pr,sn as Fr,st as Ir,tn as Lr,u as Rr,un as zr,ut as Br,v as Vr,vn as Hr,vt as N,w as Ur,wt as Wr,x as Gr,xn as Kr,xt as qr,y as Jr,yn as Yr,yt as Xr,z as Zr}from"./Effect-92Od3962.js";import{a as Qr,c as $r,d as ei,f as ti,i as ni,l as ri,n as ii,o as ai,p as oi,r as si,s as ci,u as li}from"./Cause-AGt2deue.js";import{a as ui,c as di,d as fi,f as pi,h as mi,i as hi,l as gi,m as _i,n as vi,p as yi,r as bi,s as xi,u as Si}from"./Exit-SvLE99lR.js";const Ci=xt,wi=e=>t=>{let n=t===void 0?Object.create(ut):Ci(t);return n._tag=e,n},Ti=$e,Ei=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return{BaseEffectError:class extends Ye{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}}}}.BaseEffectError}(),Di=e=>{let t={BaseEffectError:class extends Ei{_tag=e}};return t.BaseEffectError.prototype.name=e,t.BaseEffectError},Oi=Symbol.for(`effect/DateTime`),ki=Symbol.for(`effect/DateTime/TimeZone`),Ai={[Oi]:Oi,pipe(){return Xe(this,arguments)},[qt](){return this.toString()},toJSON(){return sa(this).toJSON()}},ji={...Ai,_tag:`Utc`,[Te](){return me(this,te(this.epochMillis))},[pt](e){return Li(e)&&e._tag===`Utc`&&this.epochMillis===e.epochMillis},toString(){return`DateTime.Utc(${sa(this).toJSON()})`}},Mi={...Ai,_tag:`Zoned`,[Te](){return C(te(this.epochMillis),ye(d(this.zone)),me(this))},[pt](e){return Li(e)&&e._tag===`Zoned`&&this.epochMillis===e.epochMillis&&_t(this.zone,e.zone)},toString(){return`DateTime.Zoned(${xa(this)})`}},Ni={[ki]:ki,[qt](){return this.toString()}},Pi={...Ni,_tag:`Named`,[Te](){return me(this,ue(`Named:${this.id}`))},[pt](e){return Ri(e)&&e._tag===`Named`&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:`TimeZone`,_tag:`Named`,id:this.id}}},Fi={...Ni,_tag:`Offset`,[Te](){return me(this,ue(`Offset:${this.offset}`))},[pt](e){return Ri(e)&&e._tag===`Offset`&&this.offset===e.offset},toString(){return`TimeZone.Offset(${ua(this.offset)})`},toJSON(){return{_id:`TimeZone`,_tag:`Offset`,offset:this.offset}}},Ii=(e,t,n)=>{let r=Object.create(Mi);return r.epochMillis=e,r.zone=t,Object.defineProperty(r,"partsUtc",{value:n,enumerable:!1,writable:!0}),Object.defineProperty(r,"adjustedEpochMillis",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(r,"partsAdjusted",{value:void 0,enumerable:!1,writable:!0}),r},Li=e=>h(e,Oi),Ri=e=>h(e,ki),zi=e=>Ri(e)&&e._tag===`Offset`,Bi=e=>Ri(e)&&e._tag===`Named`,Vi=e=>e._tag===`Utc`,Hi=e=>e._tag===`Zoned`,Ui=rt((e,t)=>e.epochMillis===t.epochMillis),Wi=e=>{let t=Object.create(ji);return t.epochMillis=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},Gi=e=>{let t=e.getTime();if(Number.isNaN(t))throw new ii(`Invalid date`);return Wi(t)},Ki=e=>{if(Li(e))return e;if(e instanceof Date)return Gi(e);if(typeof e==`object`){let t=new Date(0);return pa(t,e),Gi(t)}else if(typeof e==`string`&&!qi(e))return Gi(new Date(e+`Z`));return Gi(new Date(e))},qi=e=>/Z|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),Ji=(e,t)=>{if(t?.timeZone===void 0&&Li(e)&&Hi(e))return e;let n=Ki(e);if(n.epochMillis<-86399999568e5||n.epochMillis>86399999496e5)throw RangeError(`Epoch millis out of range: ${n.epochMillis}`);let r;if(t?.timeZone===void 0){let e=new Date(n.epochMillis).getTimezoneOffset()*-60*1e3;r=na(e)}else if(Ri(t?.timeZone))r=t.timeZone;else if(typeof t?.timeZone==`number`)r=na(t.timeZone);else{let e=aa(t.timeZone);if(ve(e))throw new ii(`Invalid time zone: ${t.timeZone}`);r=e.value}return t?.adjustForTimeZone===!0?ha(n.epochMillis,r,t?.disambiguation??`compatible`):Ii(n.epochMillis,r,n.partsUtc)},Yi=ht(Ji),Xi=/^(.{17,35})\[(.+)\]$/,Zi=e=>{let t=Xi.exec(e);if(t===null){let t=_a(e);return t===null?b():Yi(e,{timeZone:t})}let[,n,r]=t;return Yi(n,{timeZone:r})},Qi=St(`effect/DateTime/validZoneCache`,()=>new Map),$i={day:`numeric`,month:`numeric`,year:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,timeZoneName:`longOffset`,fractionalSecondDigits:3,hourCycle:`h23`},ea=e=>{let t=e.resolvedOptions().timeZone;if(Qi.has(t))return Qi.get(t);let n=Object.create(Pi);return n.id=t,n.format=e,Qi.set(t,n),n},ta=e=>{if(Qi.has(e))return Qi.get(e);try{return ea(new Intl.DateTimeFormat(`en-US`,{...$i,timeZone:e}))}catch{throw new ii(`Invalid time zone: ${e}`)}},na=e=>{let t=Object.create(Fi);return t.offset=e,t},ra=ht(ta),ia=/^(?:GMT|[+-])/,aa=e=>{if(ia.test(e)){let t=_a(e);return t===null?b():v(na(t))}return ra(e)},oa=e=>e._tag===`Offset`?ua(e.offset):e.id,sa=e=>new Date(e.epochMillis),ca=e=>{if(e._tag===`Utc`)return new Date(e.epochMillis);if(e.zone._tag===`Offset`)return new Date(e.epochMillis+e.zone.offset);if(e.adjustedEpochMillis!==void 0)return new Date(e.adjustedEpochMillis);let t=e.zone.format.formatToParts(e.epochMillis).filter(e=>e.type!==`literal`),n=new Date(0);return n.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),n.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),Number(t[6].value)),e.adjustedEpochMillis=n.getTime(),n},la=e=>ca(e).getTime()-fa(e),ua=e=>{let t=Math.abs(e),n=Math.floor(t/(3600*1e3)),r=Math.round(t%(3600*1e3)/(60*1e3));return r===60&&(n+=1,r=0),`${e<0?`-`:`+`}${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`},da=e=>ua(la(e)),fa=e=>e.epochMillis,pa=(e,t)=>{if(t.year!==void 0&&e.setUTCFullYear(t.year),t.month!==void 0&&e.setUTCMonth(t.month-1),t.day!==void 0&&e.setUTCDate(t.day),t.weekDay!==void 0){let n=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+n)}t.hours!==void 0&&e.setUTCHours(t.hours),t.minutes!==void 0&&e.setUTCMinutes(t.minutes),t.seconds!==void 0&&e.setUTCSeconds(t.seconds),t.millis!==void 0&&e.setUTCMilliseconds(t.millis)},ma=1440*60*1e3,ha=(e,t,n)=>{if(t._tag===`Offset`)return Ii(e-t.offset,t);let r=va(e-ma,e,t),i=va(e+ma,e,t);if(r===i)return Ii(e-r,t);let a=r<i,o=r-i;if(a){if(va(e-i,e,t)===i)return Ii(e-i,t);let a=Ii(e-r,t);if(e!==ca(a).getTime())switch(n){case`reject`:{let n=new Date(e).toISOString();throw RangeError(`Gap time: ${n} does not exist in time zone ${t.id}`)}case`earlier`:return Ii(e-i,t);case`compatible`:case`later`:return a}return a}if(va(e-r,e,t)===r){if(n===`earlier`||n===`compatible`||va(e-r+o,e+o,t)===r)return Ii(e-r,t);if(n===`reject`){let n=new Date(e).toISOString();throw RangeError(`Ambiguous time: ${n} occurs twice in time zone ${t.id}`)}}return Ii(e-i,t)},ga=/([+-])(\d{2}):(\d{2})$/,_a=e=>{let t=ga.exec(e);if(t===null)return null;let[,n,r,i]=t;return(n===`+`?1:-1)*(Number(r)*60+Number(i))*60*1e3},va=(e,t,n)=>{let r=n.format.formatToParts(e).find(e=>e.type===`timeZoneName`)?.value??``;if(r===`GMT`)return 0;let i=_a(r);return i===null?la(Ii(t,n)):i},ya=e=>sa(e).toISOString(),ba=e=>{let t=ca(e);return e._tag===`Utc`?t.toISOString():`${t.toISOString().slice(0,-1)}${da(e)}`},xa=e=>e.zone._tag===`Offset`?ba(e):`${ba(e)}[${e.zone.id}]`,Sa=e=>e.toUpperCase(),Ca=e=>e.toLowerCase(),wa=e=>e.length===0?e:Sa(e[0])+e.slice(1),Ta=e=>e.length===0?e:Ca(e[0])+e.slice(1),Ea=e=>e.length>0,Da=(e,t)=>{switch(t._tag){case`StringKeyword`:case`TemplateLiteral`:return Object.keys(e);case`SymbolKeyword`:return Object.getOwnPropertySymbols(e);case`Refinement`:return Da(e,t.from)}},Oa=e=>{let t=!1,n;return()=>t?n:(n=e(),t=!0,n)},ka=e=>Array.isArray(e),Aa=e=>!Array.isArray(e),ja=e=>`[${Wt(e)}]`,Ma=e=>ka(e)?e.map(ja).join(``):ja(e),Na=(e,n,r,i)=>{let a=e;return r&&t(r)&&(a+=`\nat path: ${Ma(r)}`),n!==void 0&&(a+=`\ndetails: ${n}`),i&&(a+=`\nschema (${i._tag}): ${i}`),a},Pa=(e,t,n)=>Na(`Unsupported schema or overlapping types`,`cannot extend ${e} with ${t}`,n),Fa=e=>Na(`Unsupported key schema`,void 0,void 0,e),Ia=e=>Na(`Unsupported literal`,`literal value: ${ke(e)}`),La=e=>Na(`Duplicate index signature`,`${e} index signature`),Ra=Na(`Unsupported index signature parameter`,"An index signature parameter type must be `string`, `symbol`, a template literal type or a refinement of the previous types"),za=Na(`Invalid element`,`A required element cannot follow an optional element. ts(1257)`),Ba=e=>Na(`Duplicate property signature transformation`,`Duplicate key ${ke(e)}`),Va=e=>Na(`Duplicate property signature`,`Duplicate key ${ke(e)}`),Ha=Symbol.for(`effect/SchemaId/DateFromSelf`),Ua=Symbol.for(`effect/SchemaId/GreaterThan`),Wa=Symbol.for(`effect/SchemaId/GreaterThanOrEqualTo`),Ga=Symbol.for(`effect/SchemaId/LessThan`),Ka=Symbol.for(`effect/SchemaId/LessThanOrEqualTo`),qa=Symbol.for(`effect/SchemaId/Int`),Ja=Symbol.for(`effect/SchemaId/NonNaN`),Ya=Symbol.for(`effect/SchemaId/Finite`),Xa=Symbol.for(`effect/SchemaId/JsonNumber`),Za=Symbol.for(`effect/SchemaId/Between`),Qa=Symbol.for(`effect/SchemaId/GreaterThanOrEqualToBigint`),$a=Symbol.for(`effect/SchemaId/BetweenBigint`),eo=Symbol.for(`effect/SchemaId/MinLength`),to=Symbol.for(`effect/SchemaId/Length`),no=Symbol.for(`effect/annotation/TypeConstructor`),ro=Symbol.for(`effect/annotation/Brand`),io=Symbol.for(`effect/annotation/SchemaId`),ao=Symbol.for(`effect/annotation/Message`),oo=Symbol.for(`effect/annotation/MissingMessage`),so=Symbol.for(`effect/annotation/Identifier`),co=Symbol.for(`effect/annotation/Title`),lo=Symbol.for(`effect/annotation/AutoTitle`),uo=Symbol.for(`effect/annotation/Description`),fo=Symbol.for(`effect/annotation/Examples`),po=Symbol.for(`effect/annotation/Default`),mo=Symbol.for(`effect/annotation/JSONSchema`),ho=Symbol.for(`effect/annotation/Arbitrary`),go=Symbol.for(`effect/annotation/Pretty`),_o=Symbol.for(`effect/annotation/Equivalence`),vo=Symbol.for(`effect/annotation/Documentation`),yo=Symbol.for(`effect/annotation/Concurrency`),bo=Symbol.for(`effect/annotation/Batching`),xo=Symbol.for(`effect/annotation/ParseIssueTitle`),So=Symbol.for(`effect/annotation/ParseOptions`),Co=Symbol.for(`effect/annotation/DecodingFallback`),wo=Symbol.for(`effect/annotation/Surrogate`),To=Symbol.for(`effect/annotation/StableFilter`),P=T(2,(e,t)=>Object.prototype.hasOwnProperty.call(e.annotations,t)?v(e.annotations[t]):b()),Eo=P(ro),Do=P(ao),Oo=P(oo),ko=P(co),Ao=P(lo),jo=P(so),Mo=P(uo),No=P(yo),Po=P(bo),Fo=P(xo),Io=P(So),Lo=P(Co),Ro=P(wo),zo=P(To),Bo=e=>Zt(zo(e),e=>e===!0),Vo=Symbol.for(`effect/annotation/JSONIdentifier`),Ho=P(Vo),Uo=e=>m(Ho(e),()=>jo(e));var Wo=class{typeParameters;decodeUnknown;encodeUnknown;annotations;_tag=`Declaration`;constructor(e,t,n,r={}){this.typeParameters=e,this.decodeUnknown=t,this.encodeUnknown=n,this.annotations=r}toString(){return Me(rc(this),()=>`<declaration schema>`)}toJSON(){return{_tag:this._tag,typeParameters:this.typeParameters.map(e=>e.toJSON()),annotations:L(this.annotations)}}};const Go=e=>t=>t._tag===e;var Ko=class{literal;annotations;_tag=`Literal`;constructor(e,t={}){this.literal=e,this.annotations=t}toString(){return Me(rc(this),()=>ke(this.literal))}toJSON(){return{_tag:this._tag,literal:se(this.literal)?String(this.literal):this.literal,annotations:L(this.annotations)}}};const qo=Go(`Literal`);var Jo=class{symbol;annotations;_tag=`UniqueSymbol`;constructor(e,t={}){this.symbol=e,this.annotations=t}toString(){return Me(rc(this),()=>ke(this.symbol))}toJSON(){return{_tag:this._tag,symbol:String(this.symbol),annotations:L(this.annotations)}}};const Yo=new class{annotations;_tag=`UndefinedKeyword`;constructor(e={}){this.annotations=e}toString(){return ec(this)}toJSON(){return{_tag:this._tag,annotations:L(this.annotations)}}}({[co]:`undefined`}),Xo=new class{annotations;_tag=`NeverKeyword`;constructor(e={}){this.annotations=e}toString(){return ec(this)}toJSON(){return{_tag:this._tag,annotations:L(this.annotations)}}}({[co]:`never`}),Zo=new class{annotations;_tag=`UnknownKeyword`;constructor(e={}){this.annotations=e}toString(){return ec(this)}toJSON(){return{_tag:this._tag,annotations:L(this.annotations)}}}({[co]:`unknown`}),Qo=new class{annotations;_tag=`AnyKeyword`;constructor(e={}){this.annotations=e}toString(){return ec(this)}toJSON(){return{_tag:this._tag,annotations:L(this.annotations)}}}({[co]:`any`}),$o=new class{annotations;_tag=`StringKeyword`;constructor(e={}){this.annotations=e}toString(){return ec(this)}toJSON(){return{_tag:this._tag,annotations:L(this.annotations)}}}({[co]:`string`,[uo]:`a string`}),es=Go(`StringKeyword`),ts=new class{annotations;_tag=`NumberKeyword`;constructor(e={}){this.annotations=e}toString(){return ec(this)}toJSON(){return{_tag:this._tag,annotations:L(this.annotations)}}}({[co]:`number`,[uo]:`a number`}),ns=Go(`NumberKeyword`),rs=new class{annotations;_tag=`BooleanKeyword`;constructor(e={}){this.annotations=e}toString(){return ec(this)}toJSON(){return{_tag:this._tag,annotations:L(this.annotations)}}}({[co]:`boolean`,[uo]:`a boolean`}),is=Go(`BooleanKeyword`),as=new class{annotations;_tag=`BigIntKeyword`;constructor(e={}){this.annotations=e}toString(){return ec(this)}toJSON(){return{_tag:this._tag,annotations:L(this.annotations)}}}({[co]:`bigint`,[uo]:`a bigint`}),os=new class{annotations;_tag=`SymbolKeyword`;constructor(e={}){this.annotations=e}toString(){return ec(this)}toJSON(){return{_tag:this._tag,annotations:L(this.annotations)}}}({[co]:`symbol`,[uo]:`a symbol`}),ss=Go(`SymbolKeyword`);var cs=class{type;annotations;constructor(e,t={}){this.type=e,this.annotations=t}toJSON(){return{type:this.type.toJSON(),annotations:L(this.annotations)}}toString(){return String(this.type)}},ls=class extends cs{isOptional;constructor(e,t,n={}){super(e,n),this.isOptional=t}toJSON(){return{type:this.type.toJSON(),isOptional:this.isOptional,annotations:L(this.annotations)}}toString(){return String(this.type)+(this.isOptional?`?`:``)}};const us=e=>e.map(e=>e.type);var ds=class{elements;rest;isReadonly;annotations;_tag=`TupleType`;constructor(e,t,n,r={}){this.elements=e,this.rest=t,this.isReadonly=n,this.annotations=r;let i=!1,a=!1;for(let t of e)if(t.isOptional)i=!0;else if(i){a=!0;break}if(a||i&&t.length>1)throw Error(za)}toString(){return Me(rc(this),()=>fs(this))}toJSON(){return{_tag:this._tag,elements:this.elements.map(e=>e.toJSON()),rest:this.rest.map(e=>e.toJSON()),isReadonly:this.isReadonly,annotations:L(this.annotations)}}};const fs=e=>{let t=e.elements.map(String).join(`, `);return Je(e.rest,{onEmpty:()=>`readonly [${t}]`,onNonEmpty:(n,r)=>{let i=String(n),a=i.includes(` | `)?`(${i})`:i;if(r.length>0){let n=r.map(String).join(`, `);return e.elements.length>0?`readonly [${t}, ...${a}[], ${n}]`:`readonly [...${a}[], ${n}]`}else if(e.elements.length>0)return`readonly [${t}, ...${a}[]]`;else return`ReadonlyArray<${i}>`}})};var F=class extends ls{name;isReadonly;constructor(e,t,n,r,i){super(t,n,i),this.name=e,this.isReadonly=r}toString(){return(this.isReadonly?`readonly `:``)+String(this.name)+(this.isOptional?`?`:``)+`: `+this.type}toJSON(){return{name:String(this.name),type:this.type.toJSON(),isOptional:this.isOptional,isReadonly:this.isReadonly,annotations:L(this.annotations)}}};const ps=e=>{switch(e._tag){case`StringKeyword`:case`SymbolKeyword`:case`TemplateLiteral`:return!0;case`Refinement`:return ps(e.from)}return!1};var ms=class{type;isReadonly;parameter;constructor(e,t,n){if(this.type=t,this.isReadonly=n,ps(e))this.parameter=e;else throw Error(Ra)}toString(){return(this.isReadonly?`readonly `:``)+`[x: ${this.parameter}]: ${this.type}`}toJSON(){return{parameter:this.parameter.toJSON(),type:this.type.toJSON(),isReadonly:this.isReadonly}}},hs=class{annotations;_tag=`TypeLiteral`;propertySignatures;indexSignatures;constructor(e,t,n={}){this.annotations=n;let r={};for(let t=0;t<e.length;t++){let n=e[t].name;if(Object.prototype.hasOwnProperty.call(r,n))throw Error(Va(n));r[n]=null}let i={string:!1,symbol:!1};for(let e=0;e<t.length;e++){let n=$s(t[e].parameter);if(es(n)){if(i.string)throw Error(La(`string`));i.string=!0}else if(ss(n)){if(i.symbol)throw Error(La(`symbol`));i.symbol=!0}}this.propertySignatures=e,this.indexSignatures=t}toString(){return Me(rc(this),()=>_s(this))}toJSON(){return{_tag:this._tag,propertySignatures:this.propertySignatures.map(e=>e.toJSON()),indexSignatures:this.indexSignatures.map(e=>e.toJSON()),annotations:L(this.annotations)}}};const gs=e=>e.map(String).join(`; `),_s=e=>{if(e.propertySignatures.length>0){let t=e.propertySignatures.map(String).join(`; `);return e.indexSignatures.length>0?`{ ${t}; ${gs(e.indexSignatures)} }`:`{ ${t} }`}else if(e.indexSignatures.length>0)return`{ ${gs(e.indexSignatures)} }`;else return`{}`},vs=Go(`TypeLiteral`),ys=zt(_r(cn,e=>{switch(e._tag){case`AnyKeyword`:return 0;case`UnknownKeyword`:return 1;case`ObjectKeyword`:return 2;case`StringKeyword`:case`NumberKeyword`:case`BooleanKeyword`:case`BigIntKeyword`:case`SymbolKeyword`:return 3}return 4})),bs={string:`StringKeyword`,number:`NumberKeyword`,boolean:`BooleanKeyword`,bigint:`BigIntKeyword`},xs=e=>Be(e,e=>Es(e)?xs(e.types):[e]),Ss=e=>{let t=ys(e),n=[],r={},i=[];for(let e of t)switch(e._tag){case`NeverKeyword`:break;case`AnyKeyword`:return[Qo];case`UnknownKeyword`:return[Zo];case`ObjectKeyword`:case`UndefinedKeyword`:case`VoidKeyword`:case`StringKeyword`:case`NumberKeyword`:case`BooleanKeyword`:case`BigIntKeyword`:case`SymbolKeyword`:r[e._tag]||(r[e._tag]=e,n.push(e));break;case`Literal`:{let t=typeof e.literal;switch(t){case`string`:case`number`:case`bigint`:case`boolean`:!r[bs[t]]&&!i.includes(e.literal)&&(i.push(e.literal),n.push(e));break;case`object`:i.includes(e.literal)||(i.push(e.literal),n.push(e));break}break}case`UniqueSymbol`:!r.SymbolKeyword&&!i.includes(e.symbol)&&(i.push(e.symbol),n.push(e));break;case`TupleType`:r.ObjectKeyword||n.push(e);break;case`TypeLiteral`:e.propertySignatures.length===0&&e.indexSignatures.length===0?r[`{}`]||(r[`{}`]=e,n.push(e)):r.ObjectKeyword||n.push(e);break;default:n.push(e)}return n};var Cs=class e{types;annotations;static make=(t,n)=>Ts(t)?new e(t,n):t.length===1?t[0]:Xo;static unify=(t,n)=>e.make(Ss(xs(t)),n);_tag=`Union`;constructor(e,t={}){this.types=e,this.annotations=t}toString(){return Me(rc(this),()=>this.types.map(String).join(` | `))}toJSON(){return{_tag:this._tag,types:this.types.map(e=>e.toJSON()),annotations:L(this.annotations)}}};const ws=(e,t)=>e.map(t),Ts=e=>e.length>1,Es=Go(`Union`),Ds=St(Symbol.for(`effect/Schema/AST/toJSONMemoMap`),()=>new WeakMap);var Os=class{f;annotations;_tag=`Suspend`;constructor(e,t={}){this.f=e,this.annotations=t,this.f=Oa(e)}toString(){return rc(this).pipe(m(()=>Yt(ht(this.f)(),e=>rc(e))),Me(()=>`<suspended schema>`))}toJSON(){let e=this.f(),t=Ds.get(e);return t||(Ds.set(e,{_tag:this._tag}),t={_tag:this._tag,ast:e.toJSON(),annotations:L(this.annotations)},Ds.set(e,t),t)}},ks=class{from;filter;annotations;_tag=`Refinement`;constructor(e,t,n={}){this.from=e,this.filter=t,this.annotations=n}toString(){return jo(this).pipe(Me(()=>y(nc(this),{onNone:()=>`{ ${this.from} | filter }`,onSome:e=>As(this.from)?String(this.from)+` & `+e:e})))}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),annotations:L(this.annotations)}}};const As=Go(`Refinement`),js={};var Ms=class{from;to;transformation;annotations;_tag=`Transformation`;constructor(e,t,n,r={}){this.from=e,this.to=t,this.transformation=n,this.annotations=r}toString(){return Me(rc(this),()=>`(${String(this.from)} <-> ${String(this.to)})`)}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),to:this.to.toJSON(),annotations:L(this.annotations)}}};const Ns=Go(`Transformation`);var Ps=class{decode;encode;_tag=`FinalTransformation`;constructor(e,t){this.decode=e,this.encode=t}};const Fs=e=>t=>t._tag===e,Is=new class{_tag=`ComposeTransformation`};var Ls=class{from;to;decode;encode;constructor(e,t,n,r){this.from=e,this.to=t,this.decode=n,this.encode=r}},Rs=class{propertySignatureTransformations;_tag=`TypeLiteralTransformation`;constructor(e){this.propertySignatureTransformations=e;let t={},n={};for(let r of e){let e=r.from;if(t[e])throw Error(Ba(e));t[e]=!0;let i=r.to;if(n[i])throw Error(Ba(i));n[i]=!0}}};const zs=Fs(`TypeLiteralTransformation`),Bs=(e,t)=>{let n=Object.getOwnPropertyDescriptors(e),i={...e.annotations};delete i[so];let a={...i,...t},o=Ro(e);return r(o)&&(a[wo]=Bs(o.value,t)),n.annotations.value=a,Object.create(Object.getPrototypeOf(e),n)},Vs=(e,t)=>{switch(e._tag){case`Literal`:return dn(String(e.literal));case`StringKeyword`:return`[\\s\\S]*?`;case`NumberKeyword`:return`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;case`TemplateLiteral`:return Us(e,t,!1);case`Union`:return e.types.map(e=>Vs(e,t)).join(`|`)}},Hs=(e,t,n,r)=>{if(Es(e)){if(n&&!r)return`(?:${t})`}else if(!n||!r)return t;return`(${t})`},Us=(e,t,n)=>{let r=``;if(e.head!==``){let i=dn(e.head);r+=t&&n?`(${i})`:i}for(let i of e.spans){let e=Vs(i.type,t);if(r+=Hs(i.type,e,t,n),i.literal!==``){let e=dn(i.literal);r+=t&&n?`(${e})`:e}}return r},Ws=e=>RegExp(`^${Us(e,!1,!0)}$`),Gs=(t,n)=>{let r=[],i=[],a=t=>{switch(t._tag){case`NeverKeyword`:break;case`StringKeyword`:case`SymbolKeyword`:case`TemplateLiteral`:case`Refinement`:i.push(new ms(t,n,!0));break;case`Literal`:if(Nt(t.literal)||e(t.literal))r.push(new F(t.literal,n,!1,!0));else throw Error(Ia(t.literal));break;case`Enums`:for(let[e,i]of t.enums)r.push(new F(i,n,!1,!0));break;case`UniqueSymbol`:r.push(new F(t.symbol,n,!1,!0));break;case`Union`:t.types.forEach(a);break;default:throw Error(Fa(t))}};return a(t),{propertySignatures:r,indexSignatures:i}},Ks=e=>t=>{let n;for(let r of e)Object.prototype.hasOwnProperty.call(t.annotations,r)&&(n===void 0&&(n={}),n[r]=t.annotations[r]);return n},qs=e=>t=>{let n={...t.annotations};for(let t of e)delete n[t];return n},Js=Ks([fo,po,mo,ho,go,_o]),I=e=>{switch(e._tag){case`Declaration`:{let t=Ys(e.typeParameters,I);return t===e.typeParameters?e:new Wo(t,e.decodeUnknown,e.encodeUnknown,e.annotations)}case`TupleType`:{let t=Ys(e.elements,e=>{let t=I(e.type);return t===e.type?e:new ls(t,e.isOptional)}),n=us(e.rest),r=Ys(n,I);return t===e.elements&&r===n?e:new ds(t,r.map(e=>new cs(e)),e.isReadonly,e.annotations)}case`TypeLiteral`:{let t=Ys(e.propertySignatures,e=>{let t=I(e.type);return t===e.type?e:new F(e.name,t,e.isOptional,e.isReadonly)}),n=Ys(e.indexSignatures,e=>{let t=I(e.type);return t===e.type?e:new ms(e.parameter,t,e.isReadonly)});return t===e.propertySignatures&&n===e.indexSignatures?e:new hs(t,n,e.annotations)}case`Union`:{let t=Ys(e.types,I);return t===e.types?e:Cs.make(t,e.annotations)}case`Suspend`:return new Os(()=>I(e.f()),e.annotations);case`Refinement`:{let t=I(e.from);return t===e.from?e:new ks(t,e.filter,e.annotations)}case`Transformation`:{let t=Js(e);return I(t===void 0?e.to:Bs(e.to,t))}}return e};function Ys(e,t){let n=!1,r=ne(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}const Xs=e=>{switch(e._tag){case`Transformation`:return e.from;case`Refinement`:return Xs(e.from);case`Suspend`:return Xs(e.f())}},Zs=(e,t)=>{switch(e._tag){case`Declaration`:{let n=Ys(e.typeParameters,e=>Zs(e,t));return n===e.typeParameters?e:new Wo(n,e.decodeUnknown,e.encodeUnknown)}case`TupleType`:{let n=Ys(e.elements,e=>{let n=Zs(e.type,t);return n===e.type?e:new ls(n,e.isOptional)}),r=us(e.rest),i=Ys(r,e=>Zs(e,t));return n===e.elements&&i===r?e:new ds(n,i.map(e=>new cs(e)),e.isReadonly)}case`TypeLiteral`:{let n=Ys(e.propertySignatures,e=>{let n=Zs(e.type,t);return n===e.type?e:new F(e.name,n,e.isOptional,e.isReadonly)}),r=Ys(e.indexSignatures,e=>{let n=Zs(e.type,t);return n===e.type?e:new ms(e.parameter,n,e.isReadonly)});return n===e.propertySignatures&&r===e.indexSignatures?e:new hs(n,r)}case`Union`:{let n=Ys(e.types,e=>Zs(e,t));return n===e.types?e:Cs.make(n)}case`Suspend`:{let n,i=Uo(e);if(r(i)){let e=t?`Bound`:``;n={[Vo]:`${i.value}Encoded${e}`}}return new Os(()=>Zs(e.f(),t),n)}case`Refinement`:{let n=Zs(e.from,t);return t?n===e.from?e:Xs(e.from)===void 0&&Bo(e)?new ks(n,e.filter,e.annotations):n:n}case`Transformation`:return Zs(e.from,t)}return e},Qs=e=>Zs(e,!1),L=e=>{let t={};for(let n of Object.getOwnPropertySymbols(e))t[String(n)]=e[n];return t},$s=e=>{switch(e._tag){case`StringKeyword`:case`SymbolKeyword`:case`TemplateLiteral`:return e;case`Refinement`:return $s(e.from)}},ec=e=>Me(rc(e),()=>e._tag);function tc(e){return y(Eo(e),{onNone:()=>``,onSome:e=>e.map(e=>` & Brand<${ke(e)}>`).join(``)})}const nc=e=>ko(e).pipe(m(()=>Mo(e)),m(()=>Ao(e)),pe(t=>t+tc(e))),rc=e=>m(jo(e),()=>nc(e)),ic=/^[+-]?\d+$/,ac=Symbol.for(`effect/BigDecimal`),oc={[ac]:ac,[Te](){let e=pc(this);return C(d(e.value),ye(te(e.scale)),me(this))},[pt](e){return sc(e)&&_c(this,e)},toString(){return`BigDecimal(${xc(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[qt](){return this.toJSON()},pipe(){return Xe(this,arguments)}},sc=e=>h(e,ac),cc=(e,t)=>{let n=Object.create(oc);return n.value=e,n.scale=t,n},lc=(e,t)=>{if(e!==uc&&e%dc===uc)throw RangeError(`Value must be normalized`);let n=cc(e,t);return n.normalized=n,n},uc=BigInt(0),dc=BigInt(10),fc=lc(uc,0),pc=e=>{if(e.normalized===void 0)if(e.value===uc)e.normalized=fc;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=lc(r,i)}return e.normalized},mc=T(2,(e,t)=>t>e.scale?cc(e.value*dc**BigInt(t-e.scale),t):t<e.scale?cc(e.value/dc**BigInt(e.scale-t),t):e),hc=e=>e.value<uc?cc(-e.value,e.scale):e,gc=rt((e,t)=>e.scale>t.scale?mc(t,e.scale).value===e.value:e.scale<t.scale?mc(e,t.scale).value===t.value:e.value===t.value),_c=T(2,(e,t)=>gc(e,t)),vc=e=>u(yc(e),()=>RangeError(`Number must be finite, got ${e}`)),yc=e=>{if(!Number.isFinite(e))return b();let t=`${e}`;if(t.includes(`e`))return bc(t);let[n,r=``]=t.split(`.`);return v(cc(BigInt(`${n}${r}`),r.length))},bc=e=>{if(e===``)return v(fc);let t,n,r=e.search(/[eE]/);if(r!==-1){let i=e.slice(r+1);if(t=e.slice(0,r),n=Number(i),t===``||!Number.isSafeInteger(n)||!ic.test(i))return b()}else t=e,n=0;let i,a,o=t.search(/\./);if(o!==-1){let e=t.slice(0,o),n=t.slice(o+1);i=`${e}${n}`,a=n.length}else i=t,a=0;if(!ic.test(i))return b();let s=a-n;return Number.isSafeInteger(s)?v(cc(BigInt(i),s)):b()},xc=e=>{let t=pc(e);if(Math.abs(t.scale)>=16)return Sc(t);let n=t.value<uc,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},Sc=e=>{if(wc(e))return`0e+0`;let t=pc(e),n=`${hc(t).value}`,r=n.slice(0,1),i=n.slice(1),a=`${Tc(t)?`-`:``}${r}`;i!==``&&(a+=`.${i}`);let o=i.length-t.scale;return`${a}e${o>=0?`+`:``}${o}`},Cc=e=>Number(xc(e)),wc=e=>e.value===uc,Tc=e=>e.value<uc,Ec=e=>e>BigInt(2**53-1)||e<BigInt(-(2**53-1))?b():v(Number(e)),Dc=e=>{try{return e.trim()===``?b():v(BigInt(e))}catch{return b()}},Oc=e=>{if(e>2**53-1||e<-(2**53-1))return b();try{return v(BigInt(e))}catch{return b()}},kc=Symbol.for(`effect/Brand/Refined`),Ac=()=>Object.assign(e=>e,{[kc]:kc,option:e=>v(e),either:e=>S(e),is:e=>!0}),jc=pn,Mc=_n,Nc=Nn,Pc=xn,Fc=Symbol.for(`effect/QueueEnqueue`),Ic=Symbol.for(`effect/QueueDequeue`),Lc=Symbol.for(`effect/QueueStrategy`),Rc=Symbol.for(`effect/BackingQueue`),zc={_A:e=>e},Bc={_A:e=>e},Vc={_In:e=>e},Hc={_Out:e=>e};var Uc=class extends an{queue;takers;shutdownHook;shutdownFlag;strategy;[Fc]=Vc;[Ic]=Hc;constructor(e,t,n,r,i){super(),this.queue=e,this.takers=t,this.shutdownHook=n,this.shutdownFlag=r,this.strategy=i}pipe(){return Xe(this,arguments)}commit(){return this.take}capacity(){return this.queue.capacity()}get size(){return Gt(()=>gt(this.unsafeSize(),()=>s))}unsafeSize(){return Ie(this.shutdownFlag)?b():v(this.queue.length()-Wr(this.takers)+this.strategy.surplusSize())}get isEmpty(){return Ve(this.size,e=>e<=0)}get isFull(){return Ve(this.size,e=>e>=this.capacity())}get shutdown(){return yt(de(e=>(C(this.shutdownFlag,Ne(!0)),C(tr(fl(this.takers),t=>nt(t,e.id()),!1,!1),ae(this.strategy.shutdown),xe(it(this.shutdownHook,void 0)),Ut))))}get isShutdown(){return je(()=>Ie(this.shutdownFlag))}get awaitShutdown(){return Pt(this.shutdownHook)}isActive(){return!Ie(this.shutdownFlag)}unsafeOffer(e){if(Ie(this.shutdownFlag))return!1;let t;if(this.queue.length()===0){let n=C(this.takers,ln(Zn));n===Zn?t=!1:(ul(n,e),t=!0)}else t=!1;if(t)return!0;let n=this.queue.offer(e);return hl(this.strategy,this.queue,this.takers),n}offer(e){return Gt(()=>{if(Ie(this.shutdownFlag))return s;let t;if(this.queue.length()===0){let n=C(this.takers,ln(Zn));n===Zn?t=!1:(ul(n,e),t=!0)}else t=!1;if(t)return o(!0);let n=this.queue.offer(e);return hl(this.strategy,this.queue,this.takers),n?o(!0):this.strategy.handleSurplus([e],this.queue,this.takers,this.shutdownFlag)})}offerAll(e){return Gt(()=>{if(Ie(this.shutdownFlag))return s;let t=ce(e),n=this.queue.length()===0?ce(pl(this.takers,t.length)):Le,[r,i]=C(t,st(n.length));for(let e=0;e<n.length;e++){let t=n[e],i=r[e];ul(t,i)}if(i.length===0)return o(!0);let a=this.queue.offerAll(i);return hl(this.strategy,this.queue,this.takers),Ae(a)?o(!0):this.strategy.handleSurplus(a,this.queue,this.takers,this.shutdownFlag)})}get take(){return de(e=>{if(Ie(this.shutdownFlag))return s;let t=this.queue.poll(Zn);if(t!==Zn)return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),o(t);{let t=Dt(e.id());return C(Gt(()=>(C(this.takers,zn(t)),hl(this.strategy,this.queue,this.takers),Ie(this.shutdownFlag)?s:Pt(t))),tt(()=>je(()=>ml(this.takers,t))))}})}get takeAll(){return Gt(()=>Ie(this.shutdownFlag)?s:je(()=>{let e=this.queue.pollUpTo(1/0);return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),De(e)}))}takeUpTo(e){return Gt(()=>Ie(this.shutdownFlag)?s:je(()=>{let t=this.queue.pollUpTo(e);return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),De(t)}))}takeBetween(e,t){return Gt(()=>Wc(this,e,t,Ze()))}};const Wc=(e,t,n,r)=>n<t?o(r):C(rl(e,n),Vt(i=>{let a=t-i.length;return a===1?C(nl(e),Ve(e=>C(r,Xt(i),Ht(e)))):a>1?C(nl(e),Vt(t=>Wc(e,a-1,n-i.length-1,C(r,Xt(i),Ht(t))))):o(C(r,Xt(i)))})),Gc=e=>C(je(()=>qr(e)),Vt(e=>Xc(Qc(e),il()))),Kc=e=>C(je(()=>qr(e)),Vt(e=>Xc(Qc(e),al()))),qc=e=>C(je(()=>qr(e)),Vt(e=>Xc(Qc(e),ol()))),Jc=()=>C(je(()=>vr()),Vt(e=>Xc(Qc(e),al()))),Yc=(e,t,n,r,i)=>new Uc(e,t,n,r,i),Xc=(e,t)=>C(Bt(),Ve(n=>Yc(e,vr(),n,_(!1),t)));var Zc=class{mutable;[Rc]=Bc;constructor(e){this.mutable=e}poll(e){return ln(this.mutable,e)}pollUpTo(e){return On(this.mutable,e)}offerAll(e){return fn(this.mutable,e)}offer(e){return zn(this.mutable,e)}capacity(){return In(this.mutable)}length(){return Wr(this.mutable)}};const Qc=e=>new Zc(e),$c=e=>e.size,el=e=>e.shutdown,tl=T(2,(e,t)=>e.offer(t)),nl=e=>e.take,rl=T(2,(e,t)=>e.takeUpTo(t)),il=()=>new sl,al=()=>new cl,ol=()=>new ll;var sl=class{[Lc]=zc;putters=vr();surplusSize(){return Wr(this.putters)}onCompleteTakersWithEmptyQueue(e){for(;!on(this.putters)&&!on(e);){let t=ln(e,void 0),n=ln(this.putters,void 0);n[2]&&ul(n[1],!0),ul(t,n[0])}}get shutdown(){return C(ft,Vt(e=>C(je(()=>fl(this.putters)),Vt(t=>tr(t,([t,n,r])=>r?C(nt(n,e),Ut):ge,!1,!1)))))}handleSurplus(e,t,n,r){return de(i=>{let a=Dt(i.id());return C(Gt(()=>(this.unsafeOffer(e,a),this.unsafeOnQueueEmptySpace(t,n),hl(this,t,n),Ie(r)?s:Pt(a))),tt(()=>je(()=>this.unsafeRemove(a))))})}unsafeOnQueueEmptySpace(e,t){let n=!0;for(;n&&(e.capacity()===1/0||e.length()<e.capacity());){let r=C(this.putters,ln(Zn));if(r===Zn)n=!1;else{let n=e.offer(r[0]);n&&r[2]?ul(r[1],!0):n||dl(this.putters,C(fl(this.putters),vt(r))),hl(this,e,t)}}}unsafeOffer(e,t){let n=ce(e);for(let e=0;e<n.length;e++){let r=n[e];e===n.length-1?C(this.putters,zn([r,t,!0])):C(this.putters,zn([r,t,!1]))}}unsafeRemove(e){dl(this.putters,C(fl(this.putters),Jt(([,t])=>t!==e)))}},cl=class{[Lc]=zc;surplusSize(){return 0}get shutdown(){return ge}onCompleteTakersWithEmptyQueue(){}handleSurplus(e,t,n,r){return o(!1)}unsafeOnQueueEmptySpace(e,t){}},ll=class{[Lc]=zc;surplusSize(){return 0}get shutdown(){return ge}onCompleteTakersWithEmptyQueue(){}handleSurplus(e,t,n,r){return je(()=>(this.unsafeOffer(t,e),hl(this,t,n),!0))}unsafeOnQueueEmptySpace(e,t){}unsafeOffer(e,t){let n=t[Symbol.iterator](),r,i=!0;for(;!(r=n.next()).done&&i;){if(e.capacity()===0)return;e.poll(Zn),i=e.offer(r.value)}}};const ul=(e,t)=>ct(e,o(t)),dl=(e,t)=>C(e,fn(t)),fl=e=>C(e,On(1/0)),pl=(e,t)=>C(e,On(t)),ml=(e,t)=>{dl(e,C(fl(e),Jt(e=>t!==e)))},hl=(e,t,n)=>{let r=!0;for(;r&&t.length()!==0;){let i=C(n,ln(Zn));if(i!==Zn){let a=t.poll(Zn);a===Zn?dl(n,C(fl(n),vt(i))):(ul(i,a),e.unsafeOnQueueEmptySpace(t,n)),r=!0}else r=!1}r&&t.length()===0&&!on(n)&&e.onCompleteTakersWithEmptyQueue(n)},gl=Gc,_l=Kc,vl=qc,yl=Jc,bl=$c,xl=el,Sl=tl,Cl=nl,wl=`Continue`,Tl=Symbol.for(`effect/ChannelChildExecutorDecision`),El={[Tl]:Tl},Dl=e=>{let t=Object.create(El);return t._tag=wl,t},Ol=Symbol.for(`effect/ChannelContinuation`),kl={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutDone:e=>e,_OutErr2:e=>e,_OutElem:e=>e,_OutDone2:e=>e};var Al=class{onSuccess;onHalt;_tag=`ContinuationK`;[Ol]=kl;constructor(e,t){this.onSuccess=e,this.onHalt=t}onExit(e){return xi(e)?this.onHalt(e.cause):this.onSuccess(e.value)}},jl=class{finalizer;_tag=`ContinuationFinalizer`;[Ol]=kl;constructor(e){this.finalizer=e}};const Ml=`PullAfterNext`,Nl=Symbol.for(`effect/ChannelUpstreamPullStrategy`),Pl={_A:e=>e},Fl={[Nl]:Pl},Il=e=>{let t=Object.create(Fl);return t._tag=Ml,t.emitSeparator=e,t},Ll=`BracketOut`,Rl=`Bridge`,zl=`ConcatAll`,Bl=`Emit`,Vl=`Ensuring`,Hl=`Fail`,Ul=`Fold`,Wl=`FromEffect`,Gl=`PipeTo`,Kl=`Read`,ql=`Succeed`,Jl=`SucceedNow`,Yl=`Suspend`,Xl=Symbol.for(`effect/Channel`),Zl={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutElem:e=>e,_OutDone:e=>e},Ql={[Xl]:Zl,pipe(){return Xe(this,arguments)}},$l=e=>h(e,Xl)||Sn(e),eu=T(2,(e,t)=>{let n=Object.create(Ql);return n._tag=Ll,n.acquire=()=>e,n.finalizer=t,n}),tu=(e,t,n)=>{let r=Object.create(Ql);return r._tag=zl,r.combineInners=t,r.combineAll=n,r.onPull=()=>Il(b()),r.onEmit=()=>Dl,r.value=()=>e,r.k=w,r},nu=T(4,(e,t,n,r)=>{let i=Object.create(Ql);return i._tag=zl,i.combineInners=n,i.combineAll=r,i.onPull=()=>Il(b()),i.onEmit=()=>Dl,i.value=()=>e,i.k=t,i}),ru=T(2,(e,t)=>{let n=Object.create(Ql);return n._tag=Rl,n.input=t,n.channel=e,n}),iu=T(2,(e,t)=>{let n=Object.create(Ql);return n._tag=Vl,n.channel=e,n.finalizer=t,n}),au=e=>ou(ni(e)),ou=e=>su(()=>e),su=e=>{let t=Object.create(Ql);return t._tag=Hl,t.error=e,t},R=T(2,(e,t)=>{let n=Object.create(Ql);return n._tag=Ul,n.channel=e,n.k=new Al(t,ou),n}),z=e=>{let t=Object.create(Ql);return t._tag=Wl,t.effect=()=>e,t},cu=T(2,(e,t)=>{let n=Object.create(Ql);return n._tag=Gl,n.left=()=>e,n.right=()=>t,n}),lu=e=>uu({onInput:e.onInput,onFailure:t=>oe(Qr(t),{onLeft:e.onFailure,onRight:ou}),onDone:e.onDone}),uu=e=>{let t=Object.create(Ql);return t._tag=Kl,t.more=e.onInput,t.done=new Al(e.onDone,e.onFailure),t},du=e=>mu(()=>e),fu=e=>{let t=Object.create(Ql);return t._tag=Jl,t.terminal=e,t},pu=e=>{let t=Object.create(Ql);return t._tag=Yl,t.channel=e,t},mu=e=>{let t=Object.create(Ql);return t._tag=ql,t.evaluate=e,t},hu=fu(void 0),B=e=>{let t=Object.create(Ql);return t._tag=Bl,t.out=e,t},gu=`Done`,_u=`Emit`,vu=`FromEffect`,yu=`Read`,bu=Symbol.for(`effect/ChannelState`),xu={_E:e=>e,_R:e=>e},Su={[bu]:xu},Cu=()=>{let e=Object.create(Su);return e._tag=gu,e},wu=()=>{let e=Object.create(Su);return e._tag=_u,e},Tu=e=>{let t=Object.create(Su);return t._tag=vu,t.effect=e,t},Eu=(e,t,n,r)=>{let i=Object.create(Su);return i._tag=yu,i.upstream=e,i.onEffect=t,i.onEmit=n,i.onDone=r,i},Du=e=>e._tag===vu,Ou=e=>Du(e)?e.effect:A,ku=e=>Du(e)?En(e.effect):void 0,Au=`PullFromChild`,ju=`PullFromUpstream`,Mu=`DrainChildExecutors`,Nu=`Emit`;var Pu=class{childExecutor;parentSubexecutor;onEmit;_tag=Au;constructor(e,t,n){this.childExecutor=e,this.parentSubexecutor=t,this.onEmit=n}close(e){let t=this.childExecutor.close(e),n=this.parentSubexecutor.close(e);if(t!==void 0&&n!==void 0)return Xr(k(t),k(n),(e,t)=>C(e,mi(t)));if(t!==void 0)return t;if(n!==void 0)return n}enqueuePullFromChild(e){return this}},Fu=class e{upstreamExecutor;createChild;lastDone;activeChildExecutors;combineChildResults;combineWithChildResult;onPull;onEmit;_tag=ju;constructor(e,t,n,r,i,a,o,s){this.upstreamExecutor=e,this.createChild=t,this.lastDone=n,this.activeChildExecutors=r,this.combineChildResults=i,this.combineWithChildResult=a,this.onPull=o,this.onEmit=s}close(e){let t=this.upstreamExecutor.close(e);return[...this.activeChildExecutors.map(t=>t===void 0?void 0:t.childExecutor.close(e)),t].reduce((e,t)=>{if(e!==void 0&&t!==void 0)return Xr(e,k(t),(e,t)=>mi(e,t));if(e!==void 0)return e;if(t!==void 0)return k(t)},void 0)}enqueuePullFromChild(t){return new e(this.upstreamExecutor,this.createChild,this.lastDone,[...this.activeChildExecutors,t],this.combineChildResults,this.combineWithChildResult,this.onPull,this.onEmit)}},Iu=class e{upstreamExecutor;lastDone;activeChildExecutors;upstreamDone;combineChildResults;combineWithChildResult;onPull;_tag=Mu;constructor(e,t,n,r,i,a,o){this.upstreamExecutor=e,this.lastDone=t,this.activeChildExecutors=n,this.upstreamDone=r,this.combineChildResults=i,this.combineWithChildResult=a,this.onPull=o}close(e){let t=this.upstreamExecutor.close(e);return[...this.activeChildExecutors.map(t=>t===void 0?void 0:t.childExecutor.close(e)),t].reduce((e,t)=>{if(e!==void 0&&t!==void 0)return Xr(e,k(t),(e,t)=>mi(e,t));if(e!==void 0)return e;if(t!==void 0)return k(t)},void 0)}enqueuePullFromChild(t){return new e(this.upstreamExecutor,this.lastDone,[...this.activeChildExecutors,t],this.upstreamDone,this.combineChildResults,this.combineWithChildResult,this.onPull)}},Lu=class{value;next;_tag=Nu;constructor(e,t){this.value=e,this.next=t}close(e){return this.next.close(e)}enqueuePullFromChild(e){return this}};const Ru=Symbol.for(`effect/ChannelUpstreamPullRequest`),zu={_A:e=>e},Bu={[Ru]:zu},Vu=e=>{let t=Object.create(Bu);return t._tag=`Pulled`,t.value=e,t},Hu=e=>{let t=Object.create(Bu);return t._tag=`NoUpstream`,t.activeDownstreamCount=e,t};var Uu=class e{_activeSubexecutor=void 0;_cancelled=void 0;_closeLastSubstream=void 0;_currentChannel;_done=void 0;_doneStack=[];_emitted=void 0;_executeCloseLastSubstream;_input=void 0;_inProgressFinalizer=void 0;_providedEnv;constructor(e,t,n){this._currentChannel=e,this._executeCloseLastSubstream=n,this._providedEnv=t}run(){let t;for(;t===void 0;)if(this._cancelled!==void 0)t=this.processCancellation();else if(this._activeSubexecutor!==void 0)t=this.runSubexecutor();else try{if(this._currentChannel===void 0)t=Cu();else switch(Sn(this._currentChannel)&&(this._currentChannel=z(this._currentChannel)),this._currentChannel._tag){case Ll:t=this.runBracketOut(this._currentChannel);break;case Rl:{let e=this._currentChannel.input;if(this._currentChannel=this._currentChannel.channel,this._input!==void 0){let n=this._input;this._input=void 0;let r=()=>O(e.awaitRead(),()=>M(()=>{let t=n.run();switch(t._tag){case gu:return fi(n.getDone(),{onFailure:t=>e.error(t),onSuccess:t=>e.done(t)});case _u:return O(e.emit(n.getEmit()),()=>r());case vu:return nn(t.effect,{onFailure:t=>e.error(t),onSuccess:()=>r()});case yu:return Ku(t,()=>r(),t=>e.error(t))}}));t=Tu(O(Ur(tn(r())),e=>pr(()=>this.addFinalizer(t=>O(Lr(e),()=>M(()=>{let e=this.restorePipe(t,n);return e===void 0?A:e}))))))}break}case zl:{let t=new e(this._currentChannel.value(),this._providedEnv,e=>pr(()=>{let t=this._closeLastSubstream===void 0?A:this._closeLastSubstream;this._closeLastSubstream=C(t,N(e))}));t._input=this._input;let n=this._currentChannel;this._activeSubexecutor=new Fu(t,e=>n.k(e),void 0,[],(e,t)=>n.combineInners(e,t),(e,t)=>n.combineAll(e,t),e=>n.onPull(e),e=>n.onEmit(e)),this._closeLastSubstream=void 0,this._currentChannel=void 0;break}case Bl:this._emitted=this._currentChannel.out,this._currentChannel=this._activeSubexecutor===void 0?hu:void 0,t=wu();break;case Vl:this.runEnsuring(this._currentChannel);break;case Hl:t=this.doneHalt(this._currentChannel.error());break;case Ul:this._doneStack.push(this._currentChannel.k),this._currentChannel=this._currentChannel.channel;break;case Wl:{let e=this._providedEnv===void 0?this._currentChannel.effect():C(this._currentChannel.effect(),Bn(this._providedEnv));t=Tu(nn(e,{onFailure:e=>{let t=this.doneHalt(e);return t!==void 0&&Du(t)?t.effect:A},onSuccess:e=>{let t=this.doneSucceed(e);return t!==void 0&&Du(t)?t.effect:A}}));break}case Gl:{let t=this._input,n=new e(this._currentChannel.left(),this._providedEnv,e=>this._executeCloseLastSubstream(e));n._input=t,this._input=n,this.addFinalizer(e=>{let n=this.restorePipe(e,t);return n===void 0?A:n}),this._currentChannel=this._currentChannel.right();break}case`Provide`:{let e=this._providedEnv;this._providedEnv=this._currentChannel.context(),this._currentChannel=this._currentChannel.inner,this.addFinalizer(()=>pr(()=>{this._providedEnv=e}));break}case Kl:{let e=this._currentChannel;t=Eu(this._input,w,t=>{try{this._currentChannel=e.more(t)}catch(t){this._currentChannel=e.done.onExit(bi(t))}},t=>{let n=t=>e.done.onExit(t);this._currentChannel=n(t)});break}case ql:t=this.doneSucceed(this._currentChannel.evaluate());break;case Jl:t=this.doneSucceed(this._currentChannel.terminal);break;case Yl:this._currentChannel=this._currentChannel.channel();break}}catch(e){this._currentChannel=ou(si(e))}return t}getDone(){return this._done}getEmit(){return this._emitted}cancelWith(e){this._cancelled=e}clearInProgressFinalizer(){this._inProgressFinalizer=void 0}storeInProgressFinalizer(e){this._inProgressFinalizer=e}popAllFinalizers(e){let t=[],n=this._doneStack.pop();for(;n;)n._tag===`ContinuationFinalizer`&&t.push(n.finalizer),n=this._doneStack.pop();let r=t.length===0?A:Gu(t,e);return this.storeInProgressFinalizer(r),r}popNextFinalizers(){let e=[];for(;this._doneStack.length!==0;){let t=this._doneStack[this._doneStack.length-1];if(t._tag===`ContinuationK`)return e;e.push(t),this._doneStack.pop()}return e}restorePipe(e,t){let n=this._input;return this._input=t,n===void 0?A:n.close(e)}close(e){let t,n=this._inProgressFinalizer;n!==void 0&&(t=C(n,lr(pr(()=>this.clearInProgressFinalizer()))));let r,i=this.popAllFinalizers(e);i!==void 0&&(r=C(i,lr(pr(()=>this.clearInProgressFinalizer()))));let a=this._activeSubexecutor===void 0?void 0:this._activeSubexecutor.close(e);if(a!==void 0||t!==void 0||r!==void 0)return C(k(Wu(a)),cr(k(Wu(t))),cr(k(Wu(r))),D(([[e,t],n])=>C(e,mi(t),mi(n))),nr,O(e=>M(()=>e)))}doneSucceed(e){if(this._doneStack.length===0)return this._done=pi(e),this._currentChannel=void 0,Cu();let t=this._doneStack[this._doneStack.length-1];if(t._tag===`ContinuationK`){this._doneStack.pop(),this._currentChannel=t.onSuccess(e);return}let n=this.popNextFinalizers();if(this._doneStack.length===0)return this._doneStack=n.reverse(),this._done=pi(e),this._currentChannel=void 0,Cu();let r=Gu(n.map(e=>e.finalizer),pi(e));this.storeInProgressFinalizer(r);let i=C(r,lr(pr(()=>this.clearInProgressFinalizer())),nr,O(()=>pr(()=>this.doneSucceed(e))));return Tu(i)}doneHalt(e){if(this._doneStack.length===0)return this._done=ui(e),this._currentChannel=void 0,Cu();let t=this._doneStack[this._doneStack.length-1];if(t._tag===`ContinuationK`){this._doneStack.pop();try{this._currentChannel=t.onHalt(e)}catch(e){this._currentChannel=ou(si(e))}return}let n=this.popNextFinalizers();if(this._doneStack.length===0)return this._doneStack=n.reverse(),this._done=ui(e),this._currentChannel=void 0,Cu();let r=Gu(n.map(e=>e.finalizer),ui(e));this.storeInProgressFinalizer(r);let i=C(r,lr(pr(()=>this.clearInProgressFinalizer())),nr,O(()=>pr(()=>this.doneHalt(e))));return Tu(i)}processCancellation(){return this._currentChannel=void 0,this._done=this._cancelled,this._cancelled=void 0,Cu()}runBracketOut(e){let t=nr(nn(this.provide(e.acquire()),{onFailure:e=>pr(()=>{this._currentChannel=ou(e)}),onSuccess:t=>pr(()=>{this.addFinalizer(n=>this.provide(e.finalizer(t,n))),this._currentChannel=B(t)})}));return Tu(t)}provide(e){return this._providedEnv===void 0?e:C(e,Bn(this._providedEnv))}runEnsuring(e){this.addFinalizer(e.finalizer),this._currentChannel=e.channel}addFinalizer(e){this._doneStack.push(new jl(e))}runSubexecutor(){let e=this._activeSubexecutor;switch(e._tag){case Au:return this.pullFromChild(e.childExecutor,e.parentSubexecutor,e.onEmit,e);case ju:return this.pullFromUpstream(e);case Mu:return this.drainChildExecutors(e);case Nu:return this._emitted=e.value,this._activeSubexecutor=e.next,wu()}}replaceSubexecutor(e){this._currentChannel=void 0,this._activeSubexecutor=e}finishWithExit(e){let t=fi(e,{onFailure:e=>this.doneHalt(e),onSuccess:e=>this.doneSucceed(e)});return this._activeSubexecutor=void 0,t===void 0?A:Ou(t)}finishSubexecutorWithCloseEffect(e,...t){this.addFinalizer(()=>C(t,rn(t=>C(pr(()=>t(e)),O(e=>e===void 0?A:e)),{discard:!0})));let n=C(e,fi({onFailure:e=>this.doneHalt(e),onSuccess:e=>this.doneSucceed(e)}));return this._activeSubexecutor=void 0,n}applyUpstreamPullStrategy(e,t,n){switch(n._tag){case Ml:{let r=!e||t.some(e=>e!==void 0);return[n.emitSeparator,r?[void 0,...t]:t]}case`PullAfterAllEnqueued`:{let r=!e||t.some(e=>e!==void 0);return[n.emitSeparator,r?[...t,void 0]:t]}}}pullFromChild(e,t,n,r){return Eu(e,w,i=>{let a=n(i);switch(a._tag){case wl:break;case`Close`:this.finishWithDoneValue(e,t,a.value);break;case`Yield`:{let e=t.enqueuePullFromChild(r);this.replaceSubexecutor(e);break}}this._activeSubexecutor=new Lu(i,this._activeSubexecutor)},fi({onFailure:n=>{let r=this.handleSubexecutorFailure(e,t,n);return r===void 0?void 0:ku(r)},onSuccess:n=>{this.finishWithDoneValue(e,t,n)}}))}finishWithDoneValue(e,t,n){let r=t;switch(r._tag){case ju:{let t=new Fu(r.upstreamExecutor,r.createChild,r.lastDone===void 0?n:r.combineChildResults(r.lastDone,n),r.activeChildExecutors,r.combineChildResults,r.combineWithChildResult,r.onPull,r.onEmit);this._closeLastSubstream=e.close(pi(n)),this.replaceSubexecutor(t);break}case Mu:{let t=new Iu(r.upstreamExecutor,r.lastDone===void 0?n:r.combineChildResults(r.lastDone,n),r.activeChildExecutors,r.upstreamDone,r.combineChildResults,r.combineWithChildResult,r.onPull);this._closeLastSubstream=e.close(pi(n)),this.replaceSubexecutor(t);break}default:break}}handleSubexecutorFailure(e,t,n){return this.finishSubexecutorWithCloseEffect(ui(n),e=>t.close(e),t=>e.close(t))}pullFromUpstream(e){if(e.activeChildExecutors.length===0)return this.performPullFromUpstream(e);let t=e.activeChildExecutors[0],n=new Fu(e.upstreamExecutor,e.createChild,e.lastDone,e.activeChildExecutors.slice(1),e.combineChildResults,e.combineWithChildResult,e.onPull,e.onEmit);if(t===void 0)return this.performPullFromUpstream(n);this.replaceSubexecutor(new Pu(t.childExecutor,n,t.onEmit))}performPullFromUpstream(t){return Eu(t.upstreamExecutor,e=>{let t=this._closeLastSubstream===void 0?A:this._closeLastSubstream;return this._closeLastSubstream=void 0,C(this._executeCloseLastSubstream(t),N(e))},n=>{if(this._closeLastSubstream!==void 0){let i=this._closeLastSubstream;return this._closeLastSubstream=void 0,C(this._executeCloseLastSubstream(i),D(()=>{let i=new e(t.createChild(n),this._providedEnv,this._executeCloseLastSubstream);i._input=this._input;let[a,o]=this.applyUpstreamPullStrategy(!1,t.activeChildExecutors,t.onPull(Vu(n)));this._activeSubexecutor=new Pu(i,new Fu(t.upstreamExecutor,t.createChild,t.lastDone,o,t.combineChildResults,t.combineWithChildResult,t.onPull,t.onEmit),t.onEmit),r(a)&&(this._activeSubexecutor=new Lu(a.value,this._activeSubexecutor))}))}let i=new e(t.createChild(n),this._providedEnv,this._executeCloseLastSubstream);i._input=this._input;let[a,o]=this.applyUpstreamPullStrategy(!1,t.activeChildExecutors,t.onPull(Vu(n)));this._activeSubexecutor=new Pu(i,new Fu(t.upstreamExecutor,t.createChild,t.lastDone,o,t.combineChildResults,t.combineWithChildResult,t.onPull,t.onEmit),t.onEmit),r(a)&&(this._activeSubexecutor=new Lu(a.value,this._activeSubexecutor))},e=>{if(t.activeChildExecutors.some(e=>e!==void 0)){let e=new Iu(t.upstreamExecutor,t.lastDone,[void 0,...t.activeChildExecutors],t.upstreamExecutor.getDone(),t.combineChildResults,t.combineWithChildResult,t.onPull);if(this._closeLastSubstream!==void 0){let t=this._closeLastSubstream;return this._closeLastSubstream=void 0,C(this._executeCloseLastSubstream(t),D(()=>this.replaceSubexecutor(e)))}this.replaceSubexecutor(e);return}let n=this._closeLastSubstream,r=this.finishSubexecutorWithCloseEffect(C(e,gi(e=>t.combineWithChildResult(t.lastDone,e))),()=>n,e=>t.upstreamExecutor.close(e));return r===void 0?void 0:ku(r)})}drainChildExecutors(e){if(e.activeChildExecutors.length===0){let t=this._closeLastSubstream;return t!==void 0&&this.addFinalizer(()=>j(t)),this.finishSubexecutorWithCloseEffect(e.upstreamDone,()=>t,t=>e.upstreamExecutor.close(t))}let t=e.activeChildExecutors[0],n=e.activeChildExecutors.slice(1);if(t===void 0){let[t,i]=this.applyUpstreamPullStrategy(!0,n,e.onPull(Hu(n.reduce((e,t)=>t===void 0?e:e+1,0))));return this.replaceSubexecutor(new Iu(e.upstreamExecutor,e.lastDone,i,e.upstreamDone,e.combineChildResults,e.combineWithChildResult,e.onPull)),r(t)?(this._emitted=t.value,wu()):void 0}let i=new Iu(e.upstreamExecutor,e.lastDone,n,e.upstreamDone,e.combineChildResults,e.combineWithChildResult,e.onPull);this.replaceSubexecutor(new Pu(t.childExecutor,i,t.onEmit))}};const Wu=e=>e===void 0?A:e,Gu=(e,t)=>C(rn(e,e=>k(e(t))),D(e=>C(vi(e),Me(()=>yi))),O(e=>M(()=>e))),Ku=(e,t,n)=>{let r=[e],i=()=>{let e=r.pop();if(e===void 0||e.upstream===void 0)return Or(`Unexpected end of input for channel execution`);let a=e.upstream.run();switch(a._tag){case _u:{let a=e.onEmit(e.upstream.getEmit());return r.length===0?a===void 0?M(t):C(a,nn({onFailure:n,onSuccess:t})):a===void 0?M(()=>i()):C(a,nn({onFailure:n,onSuccess:()=>i()}))}case gu:{let a=e.onDone(e.upstream.getDone());return r.length===0?a===void 0?M(t):C(a,nn({onFailure:n,onSuccess:t})):a===void 0?M(()=>i()):C(a,nn({onFailure:n,onSuccess:()=>i()}))}case vu:return r.push(e),C(e.onEffect(a.effect),Rr(t=>M(()=>{let n=e.onDone(ui(t));return n===void 0?A:n})),nn({onFailure:n,onSuccess:()=>i()}));case yu:return r.push(e),r.push(a),M(()=>i())}};return i()},qu=T(2,(e,t)=>{let n=(t,n,r)=>fr(pr(()=>new Uu(e,void 0,w)),e=>M(()=>Ju(e.run(),e).pipe(mr(t),N(E(t)),Kn(E(n)))),(e,t)=>{let n=e.close(t);return n===void 0?A:Ir(n,e=>Jn(r,Vr(e)))});return or(e=>qn([br(t,Fn),Tn(),Tn()]).pipe(O(([r,i,a])=>e(n(i,a,r)).pipe(Ln(t),O(n=>t.addFinalizer(e=>{let t=xi(e)?$r(e.cause):void 0;return Cn(i).pipe(O(e=>e?An(a,void 0).pipe(N(en(n)),N(rr(n))):An(a,void 0).pipe(N(t&<(t)>0?wr(n,mt(t)):Lr(n)),N(rr(n)))))}).pipe(N(e(E(i)))))))))}),Ju=(e,t)=>{let n=e;switch(n._tag){case vu:return C(n.effect,O(()=>Ju(t.run(),t)));case _u:return Ju(t.run(),t);case gu:return M(()=>t.getDone());case yu:return Ku(n,()=>Ju(t.run(),t),Vr)}},Yu={[Symbol.for(`effect/ChannelMergeDecision`)]:{_R:e=>e,_E0:e=>e,_Z0:e=>e,_E:e=>e,_Z:e=>e}},Xu=e=>{let t=Object.create(Yu);return t._tag=`Await`,t.f=e,t},Zu=`BothRunning`,Qu=`LeftDone`,$u=`RightDone`,ed=Symbol.for(`effect/ChannelMergeState`),td={[ed]:ed},nd=(e,t)=>{let n=Object.create(td);return n._tag=Zu,n.left=e,n.right=t,n},rd=e=>{let t=Object.create(td);return t._tag=Qu,t.f=e,t},id=e=>{let t=Object.create(td);return t._tag=$u,t.f=e,t},ad=`BackPressure`,od=`BufferSliding`,sd=Symbol.for(`effect/ChannelMergeStrategy`),cd={[sd]:sd},ld=e=>{let t=Object.create(cd);return t._tag=ad,t},ud=e=>{let t=Object.create(cd);return t._tag=od,t},dd=T(2,(e,{onBackPressure:t,onBufferSliding:n})=>{switch(e._tag){case ad:return t();case od:return n()}}),fd=`Empty`,pd=`Emit`,md=`Error`,hd=`Done`,gd=e=>({_tag:fd,notifyProducer:e}),_d=e=>({_tag:pd,notifyConsumers:e}),vd=e=>({_tag:md,cause:e}),yd=e=>({_tag:hd,done:e});var bd=class{ref;constructor(e){this.ref=e}awaitRead(){return Gr(Yr(this.ref,e=>e._tag===fd?[E(e.notifyProducer),e]:[A,e]))}get close(){return Jr(e=>this.error(ci(e)))}done(e){return Gr(Yr(this.ref,t=>{switch(t._tag){case fd:return[E(t.notifyProducer),t];case pd:return[rn(t.notifyConsumers,t=>An(t,x(e)),{discard:!0}),yd(e)];case md:return[gr,t];case hd:return[gr,t]}}))}emit(e){return O(Tn(),t=>Gr(Yr(this.ref,n=>{switch(n._tag){case fd:return[E(n.notifyProducer),n];case pd:{let r=n.notifyConsumers[0],i=n.notifyConsumers.slice(1);if(r!==void 0)return[An(r,S(e)),i.length===0?gd(t):_d(i)];throw Error(`Bug: Channel.SingleProducerAsyncInput.emit - Queue was empty! please report an issue at https://github.com/Effect-TS/effect/issues`)}case md:return[gr,n];case hd:return[gr,n]}})))}error(e){return Gr(Yr(this.ref,t=>{switch(t._tag){case fd:return[E(t.notifyProducer),t];case pd:return[rn(t.notifyConsumers,t=>hr(t,e),{discard:!0}),vd(e)];case md:return[gr,t];case hd:return[gr,t]}}))}get take(){return this.takeWith(e=>ui(ei(e,x)),e=>pi(e),e=>hi(S(e)))}takeWith(e,t,n){return O(Tn(),r=>Gr(Yr(this.ref,i=>{switch(i._tag){case fd:return[N(An(i.notifyProducer,void 0),Zr(E(r),{onFailure:e,onSuccess:oe({onLeft:n,onRight:t})})),_d([r])];case pd:return[Zr(E(r),{onFailure:e,onSuccess:oe({onLeft:n,onRight:t})}),_d([...i.notifyConsumers,r])];case md:return[j(e(i.cause)),i];case hd:return[j(n(i.done)),i]}})))}};const xd=()=>C(Tn(),O(e=>Hr(gd(e))),D(e=>new bd(e))),Sd=T(2,(e,t)=>nu(e,t,()=>void 0,()=>void 0)),Cd=e=>{let t=uu({onInput:()=>t,onFailure:ou,onDone:du});return cu(e,t)},wd=T(2,(e,t)=>iu(e,()=>t)),Td=e=>R(e,w),Ed=e=>zd(e.takeWith(ou,t=>R(B(t),()=>Ed(e)),du)),Dd=T(2,(e,t)=>R(e,e=>mu(()=>t(e)))),Od=T(2,(e,t)=>{let n=lu({onInput:e=>R(B(t(e)),()=>n),onFailure:au,onDone:fu});return cu(e,n)}),kd=T(2,(e,t)=>{let n=uu({onInput:e=>C(z(t(e)),R(B),R(()=>n)),onFailure:ou,onDone:fu});return cu(e,n)}),Ad=e=>t=>jd(e)(t,Ct),jd=({bufferSize:e=16,concurrency:t,mergeStrategy:n=ld()})=>(i,a)=>Vd(o=>sn(function*(){let s=t===`unbounded`?2**53-1:t,c=yield*xd(),l=Ed(c),u=yield*gl(e);yield*Jn(o,xl(u));let d=yield*yl();yield*Jn(o,xl(d));let f=yield*Hr(b()),p=yield*Tn(),m=(yield*kn(s)).withPermits,h=yield*Ld(cu(l,i),o);function g(e){return e.pipe(O(oe({onLeft:e=>j(v(e)),onRight:e=>Tr(Sl(u,j(S(e))),b())})),Ar({until:e=>r(e)}),O(e=>Kr(f,y({onNone:()=>v(e.value),onSome:t=>v(a(t,e.value))}))),Rr(e=>li(e)?Vr(e):Sl(u,Vr(e)).pipe(N(An(p,void 0)),Pr)))}yield*h.pipe(nn({onFailure:e=>Sl(u,Vr(e)).pipe(N(j(!1))),onSuccess:oe({onLeft:e=>yn(tn(E(p)),tn(m(s)(A)),{onSelfDone:(e,t)=>Tr(Lr(t),!1),onOtherDone:(t,n)=>N(Lr(n),Gn(f).pipe(O(y({onNone:()=>Sl(u,j(x(e))),onSome:t=>Sl(u,j(x(a(t,e))))})),Tr(!1)))}),onRight:e=>dd(n,{onBackPressure:()=>sn(function*(){let t=yield*Tn(),n=ir(t=>Ld(cu(l,e),t).pipe(O(e=>mn(k(g(e)),k(tn(E(p))))),O(w)));return yield*An(t,void 0).pipe(N(n),m(1),Ln(o)),yield*E(t),!(yield*Cn(p))}),onBufferSliding:()=>sn(function*(){let t=yield*Tn(),n=yield*Tn(),r=yield*bl(d);yield*Cl(d).pipe(O(e=>An(e,void 0)),Cr(()=>r>=s)),yield*Sl(d,t);let i=ir(n=>Ld(cu(l,e),n).pipe(O(e=>k(g(e)).pipe(mn(k(tn(E(p)))),mn(k(tn(E(t)))))),O(w)));return yield*An(n,void 0).pipe(N(i),m(1),Ln(o)),yield*E(n),!(yield*Cn(p))})})})}),Ar({while:e=>e}),Ln(o));let _=C(Cl(u),Gr,Zr({onFailure:ou,onSuccess:oe({onLeft:fu,onRight:e=>R(B(e),()=>_)})}),zd);return ru(_,c)})),Md=T(3,(e,t,n)=>Ad(n)(Od(e,t))),Nd=T(2,(e,t)=>{function n(n){return sn(function*(){let r=yield*xd(),i=Ed(r),a=yield*Ld(cu(i,e),n),o=yield*Ld(cu(i,t.other),n);function s(e,t,r){return(i,a,o)=>{function s(e){let n=e;return n._tag===`Done`?j(z(N(Lr(t),n.effect))):D(en(t),fi({onFailure:e=>z(n.f(ui(e))),onSuccess:oe({onLeft:e=>z(n.f(pi(e))),onRight:e=>Gd(B(e),c(o(n.f)))})}))}return fi(e,{onFailure:e=>s(i(ui(e))),onSuccess:oe({onLeft:e=>s(i(pi(e))),onRight:e=>j(R(B(e),()=>R(z(Ln(tn(r),n)),e=>c(a(e,t)))))})})}}function c(e){switch(e._tag){case Zu:{let n=tn(Nr(e.left)),r=tn(Nr(e.right));return zd(yn(n,r,{onSelfDone:(n,r)=>N(Lr(r),s(n,e.right,a)(t.onSelfDone,nd,e=>rd(e))),onOtherDone:(n,r)=>N(Lr(r),s(n,e.left,o)(t.onOtherDone,(e,t)=>nd(t,e),e=>id(e)))}))}case Qu:return zd(D(k(o),fi({onFailure:t=>z(e.f(ui(t))),onSuccess:oe({onLeft:t=>z(e.f(pi(t))),onRight:t=>R(B(t),()=>c(rd(e.f)))})})));case $u:return zd(D(k(a),fi({onFailure:t=>z(e.f(ui(t))),onSuccess:oe({onLeft:t=>z(e.f(pi(t))),onRight:t=>R(B(t),()=>c(id(e.f)))})})))}}return z(dr(e=>{let t=dr(t=>(t.transferChildren(e.scope()),A));return Xr(tn(a).pipe(lr(t),Ln(n)),tn(o).pipe(lr(t),Ln(n)),(e,t)=>nd(e,t))})).pipe(R(c),ru(r))})}return Vd(n)}),Pd=e=>jn(t=>qu(e,t)),Fd=e=>zd(or(t=>D(zr(),n=>eu(Ir(t(Qn(e,n)),e=>Fr(n,ui(e))),(e,t)=>Fr(n,t))))),Id=e=>Bd(D(Un,t=>R(z(e(t)),B))),Ld=T(2,(e,t)=>cr(pr(()=>new Uu(e,void 0,w)),Vn()).pipe(Yn(([e,n])=>Er(t,t=>{let r=e.close(t);return r===void 0?A:Bn(r,n)})),nr,D(([e])=>M(()=>Rd(e.run(),e))))),Rd=(e,t)=>{let n=e;switch(n._tag){case gu:return fi(t.getDone(),{onFailure:Vr,onSuccess:e=>j(x(e))});case _u:return j(S(t.getEmit()));case vu:return C(n.effect,O(()=>Rd(t.run(),t)));case yu:return Ku(n,()=>Rd(t.run(),t),e=>Vr(e))}},zd=e=>Td(z(e)),Bd=e=>tu(Fd(e),(e,t)=>e,(e,t)=>e),Vd=e=>tu(Id(e),(e,t)=>e,(e,t)=>e),Hd=e=>Ud(0,e.length,e),Ud=(e,t,n)=>e===t?hu:C(B(C(n,p(e))),R(()=>Ud(e+1,t,n))),Wd=T(e=>$l(e[1]),(e,t,n)=>n?.concurrent?Nd(e,{other:t,onSelfDone:e=>Xu(t=>M(()=>_i(e,t))),onOtherDone:e=>Xu(t=>M(()=>_i(t,e)))}):R(e,e=>Dd(t,t=>[e,t]))),Gd=T(e=>$l(e[1]),(e,t,n)=>n?.concurrent?Dd(Wd(e,t,{concurrent:!0}),e=>e[1]):R(e,()=>t)),Kd=Symbol.for(`effect/Sink`),qd={_A:e=>e,_In:e=>e,_L:e=>e,_E:e=>e,_R:e=>e};var Jd=class{channel;[Kd]=qd;constructor(e){this.channel=e}pipe(){return Xe(this,arguments)}};const Yd=e=>{let t=uu({onInput:n=>C(z(rn(n,t=>e(t),{discard:!0})),R(()=>t)),onFailure:ou,onDone:()=>hu});return new Jd(t)},Xd=e=>new Jd(z(e)),Zd=e=>Sn(e)?Zd(Xd(e)):e.channel,Qd=e=>new Jd(Bd(e.pipe(D(e=>Zd(e))))),$d=jr,ef=e=>Object.assign(e,{chunk(e){return this(j(e))},die(e){return this(ar(e))},dieMessage(e){return this(Or(e))},done(e){return this(M(()=>Si(e,{onFailure:v,onSuccess:_e})))},end(){return this(Wn(b()))},fail(e){return this(Wn(v(e)))},fromEffect(e){return this(gn(e,{onFailure:v,onSuccess:_e}))},fromEffectChunk(e){return this(C(e,bn(v)))},halt(e){return this(Vr(C(e,ei(v))))},single(e){return this(j(_e(e)))}}),tf=Symbol.for(`effect/Take`),nf={_A:e=>e,_E:e=>e};var rf=class{exit;[tf]=nf;constructor(e){this.exit=e}pipe(){return Xe(this,arguments)}};const af=e=>new rf(pi(e)),of=e=>M(()=>e.exit),sf=new rf(hi(b())),cf=e=>new rf(ui(C(e,ei(v)))),lf=e=>Zr(e,{onFailure:e=>y(ai(e),{onNone:()=>sf,onSome:cf}),onSuccess:af}),uf=T(2,(e,{onEnd:t,onFailure:n,onSuccess:r})=>fi(e.exit,{onFailure:e=>y(ai(e),{onNone:t,onSome:n}),onSuccess:r})),df=()=>Wn(b()),ff=Symbol.for(`effect/Stream`),pf={_R:e=>e,_E:e=>e,_A:e=>e};var mf=class{channel;[ff]=pf;constructor(e){this.channel=e}pipe(){return Xe(this,arguments)}};const hf=e=>h(e,ff)||Sn(e),gf=e=>{if(e===`unbounded`)return yl();if(typeof e==`number`||e===void 0)return gl(e??16);switch(e.strategy){case`dropping`:return _l(e.bufferSize??16);case`sliding`:return vl(e.bufferSize??16);default:return gl(e.bufferSize??16)}},_f=(e,t)=>C(Mr(gf(t),e=>xl(e)),O(t=>C(Vn(),O(n=>C(e(ef(e=>C(lf(e),O(e=>Sl(t,e)),Pr,$d(n)).then(e=>{if(xi(e)&&!li(e.cause))throw oi(e.cause)}))),N(Hr(!1)),O(e=>C(Gn(e),D(n=>n?df():C(Cl(t),O(of),hn(()=>C(Xn(e,!0),N(xl(t)))))))))))),Mf,Sf(Af)),vf=T(2,(e,t)=>{if(t.strategy===`dropping`)return yf(e,t.capacity);if(t.strategy===`sliding`)return bf(e,t.capacity);let n=Pf(e,t);return new mf(Bd(D(n,e=>{let t=C(z(Cl(e)),R(uf({onEnd:()=>hu,onFailure:ou,onSuccess:e=>C(B(e),R(()=>t))})));return t})))}),yf=T(2,(e,t)=>{let n=Mr(_l(t),e=>xl(e));return new mf(xf(n,Df(e)))}),bf=T(2,(e,t)=>{let n=Mr(vl(t),e=>xl(e));return new mf(xf(n,Df(e)))}),xf=(e,t)=>{let n=(e,t)=>{let r=n=>C(Gn(t),Yn(E),N(Tn()),O(r=>C(Sl(e,[n,r]),N(Xn(t,r)),N(E(r)))),Pr,z);return uu({onInput:r=>C(Tn(),O(n=>C(Sl(e,[af(r),n]),O(e=>C(Xn(t,n),Cr(()=>e))))),Pr,z,R(()=>n(e,t))),onFailure:e=>r(cf(e)),onDone:()=>r(sf)})},r=e=>{let t=C(z(Cl(e)),R(([e,n])=>Gd(z(An(n,void 0)),uf(e,{onEnd:()=>hu,onFailure:ou,onSuccess:e=>C(B(e),R(()=>t))}))));return t};return Bd(C(e,O(e=>C(Tn(),Yn(e=>An(e,void 0)),O(i=>C(Hr(i),O(r=>C(t,cu(n(e,r)),Pd,un)),Tr(r(e))))))))},Sf=T(e=>hf(e[0]),(e,t,r)=>{let i=r?.bufferSize??16;return r?.switch?Cf(r?.concurrency,()=>wf(e,1,i,t),n=>wf(e,n,i,t)):Cf(r?.concurrency,()=>new mf(Sd(Df(e),e=>C(e,c(e=>Df(t(e))),n(hu,(e,t)=>C(e,Gd(t)))))),n=>new mf(C(Df(e),Sd(Hd),Md(e=>Df(t(e)),r))))}),Cf=(e,t,n)=>{switch(e){case void 0:return t();case`unbounded`:return n(2**53-1);default:return e>1?n(e):t()}},wf=T(4,(e,t,n,r)=>new mf(C(Df(e),Sd(Hd),Md(e=>Df(r(e)),{concurrency:t,mergeStrategy:ud(),bufferSize:n})))),Tf=T(e=>hf(e[0]),(e,t)=>Sf(e,w,t)),Ef=e=>new mf(e),Df=e=>{if(`channel`in e)return e.channel;if(Sn(e))return Df(Of(e));throw TypeError(`Expected a Stream.`)},Of=e=>C(e,bn(v),kf),kf=e=>new mf(zd(Mn(e,{onFailure:y({onNone:()=>hu,onSome:au}),onSuccess:e=>B(_e(e))}))),Af=e=>Ff(e,e=>C(D(e,t=>v([t,e])),yr(y({onNone:()=>j(b()),onSome:Wn})))),jf=T(2,(e,t)=>{let n=uu({onInput:e=>R(B(af(e)),()=>n),onFailure:e=>B(cf(e)),onDone:()=>B(sf)});return C(cu(Df(e),n),kd(e=>Sl(t,e)),Cd,Pd,Pr)}),Mf=e=>new mf(wd(Fd(C(e,D(_e))),A)),Nf=e=>new mf(pu(()=>Df(e()))),Pf=T(e=>hf(e[0]),(e,t)=>Yn(Mr(t?.strategy===`unbounded`?yl():t?.strategy===`dropping`?_l(t.capacity??2):t?.strategy===`sliding`?vl(t.capacity??2):gl(t?.capacity??2),e=>xl(e)),t=>un(jf(e,t)))),Ff=(e,t)=>Nf(()=>{let n=e=>zd(D(t(e),y({onNone:()=>hu,onSome:([e,t])=>R(B(e),()=>n(t))})));return new mf(n(e))}),If=e=>Tf(Of(e)),Lf=e=>Tf(Mf(e)),Rf=R,zf=hu,Bf=B,Vf=Li,Hf=zi,Uf=Bi,Wf=Vi,Gf=Hi,Kf=Ui,qf=Gi,Jf=Ki,Yf=Ji,Xf=Zi,Zf=ta,Qf=na,$f=aa,ep=oa,tp=sa,np=fa;qe(`effect/DateTime/CurrentTimeZone`)();const rp=ya,ip=xa;var V=class{path;actual;issue;_tag=`Pointer`;constructor(e,t,n){this.path=e,this.actual=t,this.issue=n}},ap=class{actual;message;_tag=`Unexpected`;constructor(e,t){this.actual=e,this.message=t}},op=class{ast;message;_tag=`Missing`;actual=void 0;constructor(e,t){this.ast=e,this.message=t}},H=class{ast;actual;issues;output;_tag=`Composite`;constructor(e,t,n,r){this.ast=e,this.actual=t,this.issues=n,this.output=r}},sp=class{ast;actual;kind;issue;_tag=`Refinement`;constructor(e,t,n,r){this.ast=e,this.actual=t,this.kind=n,this.issue=r}},cp=class{ast;actual;kind;issue;_tag=`Transformation`;constructor(e,t,n,r){this.ast=e,this.actual=t,this.kind=n,this.issue=r}},U=class{ast;actual;message;_tag=`Type`;constructor(e,t,n){this.ast=e,this.actual=t,this.message=n}},lp=class{ast;actual;message;_tag=`Forbidden`;constructor(e,t,n){this.ast=e,this.actual=t,this.message=n}};const up=Symbol.for(`effect/Schema/ParseErrorTypeId`);var dp=class extends Di(`ParseError`){[up]=up;get message(){return this.toString()}toString(){return Kp.formatIssueSync(this.issue)}toJSON(){return{_id:`ParseError`,message:this.toString()}}[qt](){return this.toJSON()}};const fp=e=>new dp({issue:e}),W=S,pp=x,mp=Ke,hp=Ee,gp=Re,_p=T(2,(e,t)=>gp(e)?oe(e,{onLeft:x,onRight:t}):O(e,t)),vp=T(2,(e,t)=>gp(e)?g(e,t):D(e,t)),yp=T(2,(e,t)=>gp(e)?jt(e,t):bn(e,t)),bp=T(2,(e,t)=>gp(e)?le(e,{onLeft:t.onFailure,onRight:t.onSuccess}):gn(e,t)),xp=T(2,(e,t)=>gp(e)?oe(e,{onLeft:t,onRight:S}):yr(e,t)),Sp=(t,n)=>n===void 0||e(n)?t:t===void 0?n:{...t,...n},Cp=(e,t,n)=>{let r=G(e,t);return(e,t)=>r(e,Sp(n,t))},wp=(e,t,n)=>{let r=Cp(e,t,n);return(e,t)=>i(r(e,t),fp)},Tp=(e,t,n)=>{let r=G(e,t);return(e,t)=>r(e,{...Sp(n,t),isEffectAllowed:!0})},Ep=(e,t)=>wp(e.ast,!0,t),Dp=(e,t)=>Tp(e.ast,!0,t),Op=(e,t)=>Tp(e.ast,!1,t),kp=Ep,Ap=(e,t)=>wp(I(e.ast),!0,t),jp=(e,t)=>{let n=G(I(e.ast),!0);return(e,r)=>Fe(n(e,{exact:!0,...Sp(t,r)}))},Mp=St(Symbol.for(`effect/ParseResult/decodeMemoMap`),()=>new WeakMap),Np=St(Symbol.for(`effect/ParseResult/encodeMemoMap`),()=>new WeakMap),G=(e,t)=>{let n=t?Mp:Np,i=n.get(e);if(i)return i;let a=Ip(e,t),o=Io(e),s=r(o)?(e,t)=>a(e,Sp(t,o.value)):a,c=Lo(e),l=t&&r(c)?(t,n)=>Vp(xp(s(t,n),c.value),e,t,n):s;return n.set(e,l),l},Pp=e=>l(No(e)),Fp=e=>l(Po(e)),Ip=(n,r)=>{switch(n._tag){case`Refinement`:if(r){let e=G(n.from,!0);return(t,r)=>{r??=js;let i=r?.errors===`all`,a=_p(xp(e(t,r),e=>{let a=new sp(n,t,`From`,e);return i&&Bo(n)&&tm(e)?y(n.filter(t,r,n),{onNone:()=>x(a),onSome:e=>x(new H(n,t,[a,new sp(n,t,`Predicate`,e)]))}):x(a)}),e=>y(n.filter(e,r,n),{onNone:()=>S(e),onSome:e=>x(new sp(n,t,`Predicate`,e))}));return Vp(a,n,t,r)}}else{let e=G(I(n),!0),t=G(Bp(n.from),!1);return(r,i)=>Vp(_p(e(r,i),e=>t(e,i)),n,r,i)}case`Transformation`:{let e=Wp(n.transformation,r),t=r?G(n.from,!0):G(n.to,!1),i=r?G(n.to,!0):G(n.from,!1);return(a,o)=>Vp(_p(yp(t(a,o),e=>new cp(n,a,r?`Encoded`:`Type`,e)),t=>_p(yp(e(t,o??js,n,a),e=>new cp(n,a,`Transformation`,e)),e=>yp(i(e,o),e=>new cp(n,a,r?`Type`:`Encoded`,e)))),n,a,o)}case`Declaration`:{let e=r?n.decodeUnknown(...n.typeParameters):n.encodeUnknown(...n.typeParameters);return(t,r)=>Vp(e(t,r??js,n),n,t,r)}case`Literal`:return Lp(n,e=>e===n.literal);case`UniqueSymbol`:return Lp(n,e=>e===n.symbol);case`UndefinedKeyword`:return Lp(n,et);case`NeverKeyword`:return Lp(n,Ue);case`UnknownKeyword`:case`AnyKeyword`:case`VoidKeyword`:return S;case`StringKeyword`:return Lp(n,Nt);case`NumberKeyword`:return Lp(n,e);case`BooleanKeyword`:return Lp(n,Ot);case`BigIntKeyword`:return Lp(n,se);case`SymbolKeyword`:return Lp(n,dt);case`ObjectKeyword`:return Lp(n,ot);case`Enums`:return Lp(n,e=>n.enums.some(([t,n])=>n===e));case`TemplateLiteral`:{let e=Ws(n);return Lp(n,t=>Nt(t)&&e.test(t))}case`TupleType`:{let e=n.elements.map(e=>G(e.type,r)),i=n.rest.map(e=>G(e.type,r)),a=n.elements.filter(e=>!e.isOptional);n.rest.length>0&&(a=a.concat(n.rest.slice(1)));let o=a.length,s=n.elements.length>0?n.elements.map((e,t)=>t).join(` | `):`never`,c=Pp(n),l=Fp(n);return(r,u)=>{if(!Ge(r))return x(new U(n,r));let d=u?.errors===`all`,f=[],p=0,m=[],h=r.length;for(let e=h;e<=o-1;e++){let t=new V(e,r,new op(a[e-h]));if(d){f.push([p++,t]);continue}else return x(new H(n,r,t,m))}if(n.rest.length===0)for(let e=n.elements.length;e<=h-1;e++){let t=new V(e,r,new ap(r[e],`is unexpected, expected: ${s}`));if(d){f.push([p++,t]);continue}else return x(new H(n,r,t,m))}let g=0,_;for(;g<e.length;g++)if(h<g+1){if(n.elements[g].isOptional)continue}else{let t=e[g],i=t(r[g],u);if(gp(i)){if(ee(i)){let e=new V(g,r,i.left);if(d){f.push([p++,e]);continue}else return x(new H(n,r,e,Up(m)))}m.push([p++,i.right])}else{let e=p++,t=g;_||=[],_.push(({es:a,output:o})=>O(xr(i),i=>{if(ee(i)){let s=new V(t,r,i.left);return d?(a.push([e,s]),A):x(new H(n,r,s,Up(o)))}return o.push([e,i.right]),A}))}}if(t(i)){let[e,...t]=i;for(;g<h-t.length;g++){let t=e(r[g],u);if(gp(t))if(ee(t)){let e=new V(g,r,t.left);if(d){f.push([p++,e]);continue}else return x(new H(n,r,e,Up(m)))}else m.push([p++,t.right]);else{let e=p++,i=g;_||=[],_.push(({es:a,output:o})=>O(xr(t),t=>{if(ee(t)){let s=new V(i,r,t.left);return d?(a.push([e,s]),A):x(new H(n,r,s,Up(o)))}else return o.push([e,t.right]),A}))}}for(let e=0;e<t.length;e++){let i=g+e;if(!(h<i+1)){let a=t[e](r[i],u);if(gp(a)){if(ee(a)){let e=new V(i,r,a.left);if(d){f.push([p++,e]);continue}else return x(new H(n,r,e,Up(m)))}m.push([p++,a.right])}else{let e=p++;_||=[],_.push(({es:t,output:o})=>O(xr(a),a=>{if(ee(a)){let s=new V(i,r,a.left);return d?(t.push([e,s]),A):x(new H(n,r,s,Up(o)))}return o.push([e,a.right]),A}))}}}}let te=({es:e,output:t})=>we(e)?x(new H(n,r,Up(e),Up(t))):S(Up(t));if(_&&_.length>0){let e=_;return M(()=>{let t={es:Qt(f),output:Qt(m)};return O(rn(e,e=>e(t),{concurrency:c,batching:l,discard:!0}),()=>te(t))})}return te({output:m,es:f})}}case`TypeLiteral`:{if(n.propertySignatures.length===0&&n.indexSignatures.length===0)return Lp(n,Se);let e=[],t={},i=[];for(let a of n.propertySignatures)e.push([G(a.type,r),a]),t[a.name]=null,i.push(a.name);let a=n.indexSignatures.map(e=>[G(e.parameter,r),G(e.type,r),e.parameter]),o=Cs.make(n.indexSignatures.map(e=>e.parameter).concat(i.map(e=>dt(e)?new Jo(e):new Ko(e)))),s=G(o,r),c=Pp(n),l=Fp(n);return(r,u)=>{if(!Lt(r))return x(new U(n,r));let d=u?.errors===`all`,f=[],p=0,m=u?.onExcessProperty===`error`,h=u?.onExcessProperty===`preserve`,g={},_;if(m||h){_=Reflect.ownKeys(r);for(let e of _){let t=s(e,u);if(gp(t)&&ee(t))if(m){let t=new V(e,r,new ap(r[e],`is unexpected, expected: ${String(o)}`));if(d){f.push([p++,t]);continue}else return x(new H(n,r,t,g))}else g[e]=r[e]}}let te,ne=u?.exact===!0;for(let t=0;t<e.length;t++){let i=e[t][1],a=i.name,o=Object.prototype.hasOwnProperty.call(r,a);if(!o){if(i.isOptional)continue;if(ne){let e=new V(a,r,new op(i));if(d){f.push([p++,e]);continue}else return x(new H(n,r,e,g))}}let s=e[t][0],c=s(r[a],u);if(gp(c)){if(ee(c)){let e=new V(a,r,o?c.left:new op(i));if(d){f.push([p++,e]);continue}else return x(new H(n,r,e,g))}g[a]=c.right}else{let e=p++,t=a;te||=[],te.push(({es:a,output:s})=>O(xr(c),c=>{if(ee(c)){let l=new V(t,r,o?c.left:new op(i));return d?(a.push([e,l]),A):x(new H(n,r,l,s))}return s[t]=c.right,A}))}}for(let e=0;e<a.length;e++){let i=a[e],o=i[0],s=i[1],c=Da(r,i[2]);for(let e of c){let i=o(e,u);if(gp(i)&&Fe(i)){let i=s(r[e],u);if(gp(i))if(ee(i)){let t=new V(e,r,i.left);if(d){f.push([p++,t]);continue}else return x(new H(n,r,t,g))}else Object.prototype.hasOwnProperty.call(t,e)||(g[e]=i.right);else{let a=p++,o=e;te||=[],te.push(({es:s,output:c})=>O(xr(i),i=>{if(ee(i)){let e=new V(o,r,i.left);return d?(s.push([a,e]),A):x(new H(n,r,e,c))}else return Object.prototype.hasOwnProperty.call(t,e)||(c[e]=i.right),A}))}}}}let re=({es:e,output:t})=>{if(we(e))return x(new H(n,r,Up(e),t));if(u?.propertyOrder===`original`){let e=_||Reflect.ownKeys(r);for(let t of i)e.indexOf(t)===-1&&e.push(t);let n={};for(let r of e)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return S(n)}return S(t)};if(te&&te.length>0){let e=te;return M(()=>{let t={es:Qt(f),output:Object.assign({},g)};return O(rn(e,e=>e(t),{concurrency:c,batching:l,discard:!0}),()=>re(t))})}return re({es:f,output:g})}}case`Union`:{let e=zp(n.types,r),t=Reflect.ownKeys(e.keys),i=t.length,a=n.types.length,o=new Map;for(let e=0;e<a;e++)o.set(n.types[e],G(n.types[e],r));let s=Pp(n)??1,c=Fp(n);return(r,l)=>{let u=[],d=0,f=[];if(i>0)if(wt(r))for(let n=0;n<i;n++){let i=t[n],o=e.keys[i].buckets;if(Object.prototype.hasOwnProperty.call(r,i)){let t=String(r[i]);if(Object.prototype.hasOwnProperty.call(o,t))f=f.concat(o[t]);else{let{candidates:t,literals:n}=e.keys[i],o=Cs.make(n),s=t.length===a?new hs([new F(i,o,!1,!0)],[]):Cs.make(t);u.push([d++,new H(s,r,new V(i,r,new U(o,r[i])))])}}else{let{candidates:t,literals:n}=e.keys[i],o=new F(i,Cs.make(n),!1,!0),s=t.length===a?new hs([o],[]):Cs.make(t);u.push([d++,new H(s,r,new V(i,r,new op(o)))])}}else{let t=e.candidates.length===a?n:Cs.make(e.candidates);u.push([d++,new U(t,r)])}e.otherwise.length>0&&(f=f.concat(e.otherwise));let p;for(let e=0;e<f.length;e++){let t=f[e],n=o.get(t)(r,l);if(gp(n)&&(!p||p.length===0)){if(Fe(n))return n;u.push([d++,n.left])}else{let e=d++;p||=[],p.push(t=>M(()=>`finalResult`in t?A:O(xr(n),n=>(Fe(n)?t.finalResult=n:t.es.push([e,n.left]),A))))}}let m=e=>we(e)?e.length===1&&e[0][1]._tag===`Type`?x(e[0][1]):x(new H(n,r,Up(e))):x(new U(n,r));if(p&&p.length>0){let e=p;return M(()=>{let t={es:Qt(u)};return O(rn(e,e=>e(t),{concurrency:s,batching:c,discard:!0}),()=>`finalResult`in t?t.finalResult:m(t.es))})}return m(u)}}case`Suspend`:{let e=Oa(()=>G(n.f(),r));return(t,n)=>e()(t,n)}}},Lp=(e,t)=>n=>t(n)?S(n):x(new U(e,n)),Rp=(e,t)=>{switch(e._tag){case`Declaration`:{let n=Ro(e);if(r(n))return Rp(n.value,t);break}case`TypeLiteral`:{let n=[];for(let r=0;r<e.propertySignatures.length;r++){let i=e.propertySignatures[r],a=t?Qs(i.type):I(i.type);qo(a)&&!i.isOptional&&n.push([i.name,a])}return n}case`TupleType`:{let n=[];for(let r=0;r<e.elements.length;r++){let i=e.elements[r],a=t?Qs(i.type):I(i.type);qo(a)&&!i.isOptional&&n.push([r,a])}return n}case`Refinement`:return Rp(e.from,t);case`Suspend`:return Rp(e.f(),t);case`Transformation`:return Rp(t?e.from:e.to,t)}return[]},zp=(e,t)=>{let n={},r=[],i=[];for(let a=0;a<e.length;a++){let o=e[a],s=Rp(o,t);if(s.length>0){i.push(o);for(let e=0;e<s.length;e++){let[t,r]=s[e],i=String(r.literal);n[t]=n[t]||{buckets:{},literals:[],candidates:[]};let a=n[t].buckets;if(Object.prototype.hasOwnProperty.call(a,i)){if(e<s.length-1)continue;a[i].push(o),n[t].literals.push(r),n[t].candidates.push(o)}else{a[i]=[o],n[t].literals.push(r),n[t].candidates.push(o);break}}}else r.push(o)}return{keys:n,otherwise:r,candidates:i}},Bp=e=>As(e)?Bp(e.from):e,Vp=(e,t,n,r)=>{if(r?.isEffectAllowed===!0||gp(e))return e;let i=new sr,a=vn(e,{scheduler:i});i.flush();let o=a.unsafePoll();if(o){if(di(o))return S(o.value);let e=o.cause;return ri(e)?x(e.error):x(new lp(t,n,ti(e)))}return x(new lp(t,n,`cannot be be resolved synchronously, this is caused by using runSync on an effect that performs async work`))},Hp=([e],[t])=>e>t?1:e<t?-1:0;function Up(e){return e.sort(Hp).map(e=>e[1])}const Wp=(e,t)=>{switch(e._tag){case`FinalTransformation`:return t?e.decode:e.encode;case`ComposeTransformation`:return S;case`TypeLiteralTransformation`:return n=>{let i=S(n);for(let n of e.propertySignatureTransformations){let[e,a]=t?[n.from,n.to]:[n.to,n.from],o=t?n.decode:n.encode;i=vp(i,t=>{let n=o(Object.prototype.hasOwnProperty.call(t,e)?v(t[e]):b());return delete t[e],r(n)&&(t[a]=n.value),t})}return i}}},Gp=(e,t=[])=>({value:e,forest:t}),Kp={formatIssue:e=>vp(pm(e),qp),formatIssueSync:e=>{let t=Kp.formatIssue(e);return gp(t)?$t(t):Hn(t)},formatError:e=>Kp.formatIssue(e.issue),formatErrorSync:e=>Kp.formatIssueSync(e.issue)},qp=e=>e.value+Jp(`
|
|
2
|
+
`,e.forest),Jp=(e,t)=>{let n=``,r=t.length,i;for(let a=0;a<r;a++){i=t[a];let o=a===r-1;n+=e+(o?`└`:`├`)+`─ `+i.value,n+=Jp(e+(r>1&&!o?`│ `:` `),i.forest)}return n},Yp=e=>{switch(e){case`Encoded`:return`Encoded side transformation failure`;case`Transformation`:return`Transformation process failure`;case`Type`:return`Type side transformation failure`}},Xp=e=>{switch(e){case`From`:return`From side refinement failure`;case`Predicate`:return`Predicate refinement failure`}},Zp=e=>`ast`in e?v(e.ast):b(),Qp=S(void 0),$p=e=>Zp(e).pipe(Yt(Do),y({onNone:()=>Qp,onSome:t=>{let n=t(e);return Nt(n)?S({message:n,override:!1}):Sn(n)?D(n,e=>({message:e,override:!1})):Nt(n.message)?S({message:n.message,override:n.override}):D(n.message,e=>({message:e,override:n.override}))}})),em=e=>t=>t._tag===e,tm=em(`Composite`),nm=em(`Refinement`),rm=em(`Transformation`),im=e=>_p($p(e),t=>t===void 0?Qp:!t.override&&(tm(e)||nm(e)&&e.kind===`From`||rm(e)&&e.kind!==`Transformation`)?rm(e)||nm(e)?im(e.issue):Qp:S(t.message)),am=e=>Zp(e).pipe(Yt(Fo),Oe(t=>t(e)),l);function om(e){return Mo(e).pipe(m(()=>ko(e)),m(()=>Ao(e)),m(()=>jo(e)),Me(()=>`{ ${e.from} | filter }`))}function sm(e){return e.message===void 0?`Expected ${As(e.ast)?om(e.ast):String(e.ast)}, actual ${ke(e.actual)}`:e.message}const cm=e=>vp(im(e),t=>t??am(e)??sm(e)),lm=e=>am(e)??String(e.ast),um=e=>e.message??`is forbidden`,dm=e=>e.message??`is unexpected`,fm=e=>{let t=Oo(e.ast);if(r(t)){let e=t.value();return Nt(e)?S(e):e}return S(e.message??`is missing`)},pm=e=>{switch(e._tag){case`Type`:return vp(cm(e),Gp);case`Forbidden`:return S(Gp(lm(e),[Gp(um(e))]));case`Unexpected`:return S(Gp(dm(e)));case`Missing`:return vp(fm(e),Gp);case`Transformation`:return _p(im(e),t=>t===void 0?vp(pm(e.issue),t=>Gp(lm(e),[Gp(Yp(e.kind),[t])])):S(Gp(t)));case`Refinement`:return _p(im(e),t=>t===void 0?vp(pm(e.issue),t=>Gp(lm(e),[Gp(Xp(e.kind),[t])])):S(Gp(t)));case`Pointer`:return vp(pm(e.issue),t=>Gp(Ma(e.path),[t]));case`Composite`:return _p(im(e),t=>{if(t!==void 0)return S(Gp(t));let n=lm(e);return ka(e.issues)?vp(rn(e.issues,pm),e=>Gp(n,e)):vp(pm(e.issues),e=>Gp(n,[e]))})}},mm=T(e=>ot(e[0]),(e,...t)=>{let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}),hm=T(e=>ot(e[0]),(e,...t)=>{let n={...e};for(let e of t)delete n[e];return n}),gm=Symbol.for(`effect/Schema`);function K(e){return class{[gm]=_m;static ast=e;static annotations(e){return K(bm(this.ast,e))}static pipe(){return Xe(this,arguments)}static toString(){return String(e)}static Type;static Encoded;static Context;static[gm]=_m}}const _m={_A:e=>e,_I:e=>e,_R:e=>e},vm={typeConstructor:no,schemaId:io,message:ao,missingMessage:oo,identifier:so,title:co,description:uo,examples:fo,default:po,documentation:vo,jsonSchema:mo,arbitrary:ho,pretty:go,equivalence:_o,concurrency:yo,batching:bo,parseIssueTitle:xo,parseOptions:So,decodingFallback:Co},ym=e=>{if(!e)return{};let t={...e};for(let n in vm)if(n in e){let r=vm[n];t[r]=e[n],delete t[n]}return t},bm=(e,t)=>Bs(e,ym(t)),xm=e=>String(e.ast),Sm=e=>K(Qs(e.ast)),Cm=e=>K(I(e.ast)),wm=(e,t)=>{let n=Dp(e,t);return(e,t)=>yp(n(e,t),fp)},Tm=e=>h(e,gm)&&ot(e[gm]);function Em(e){return Ts(e)?Cs.make(ws(e,e=>new Ko(e))):new Ko(e[0])}function Dm(e,t=Em(e)){return class extends K(t){static annotations(e){return Dm(this.literals,bm(this.ast,e))}static literals=[...e]}}function Om(...e){return t(e)?Dm(e):Im}const km=(e,t,n)=>jm(e,new Wo(e.map(e=>e.ast),(...e)=>t.decode(...e.map(K)),(...e)=>t.encode(...e.map(K)),ym(n))),Am=(e,t)=>{let n=()=>(t,n,r)=>e(t)?W(t):pp(new U(r,t));return jm([],new Wo([],n,n,ym(t)))};function jm(e,t){return class extends K(t){static annotations(e){return jm(this.typeParameters,bm(this.ast,e))}static typeParameters=[...e]}}const Mm=function(){if(Array.isArray(arguments[0])){let e=arguments[0],t=arguments[1],n=arguments[2];return km(e,t,n)}let e=arguments[0],t=arguments[1];return Am(e,t)},Nm=Symbol.for(`effect/SchemaId/InstanceOf`),Pm=(e,t)=>Mm(t=>t instanceof e,{title:e.name,description:`an instance of ${e.name}`,pretty:()=>String,schemaId:Nm,[Nm]:{constructor:e},...t});var Fm=class extends K(Yo){},Im=class extends K(Xo){},Lm=class extends K(Zo){},Rm=class extends K(as){},zm=class extends K(os){},q=class extends K($o){},J=class extends K(ts){},Bm=class extends K(rs){};const Vm=e=>Cs.make(e.map(e=>e.ast));function Hm(e,t=Vm(e)){return class extends K(t){static annotations(e){return Hm(this.members,bm(this.ast,e))}static members=[...e]}}function Um(...e){return Ts(e)?Hm(e):t(e)?e[0]:Im}const Wm=e=>Um(e,Fm),Gm=e=>new Km(new ls(e.ast,!1),e);var Km=class e{ast;from;[gm];_Token;constructor(e,t){this.ast=e,this.from=t}annotations(t){return new e(new ls(this.ast.type,this.ast.isOptional,{...this.ast.annotations,...ym(t)}),this.from)}toString(){return`${this.ast.type}${this.ast.isOptional?`?`:``}`}};const qm=(e,t)=>new ds(e.map(e=>Tm(e)?new ls(e.ast,!1):e.ast),t.map(e=>Tm(e)?new cs(e.ast):e.ast),!0);function Jm(e,t,n=qm(e,t)){return class extends K(n){static annotations(e){return Jm(this.elements,this.rest,bm(this.ast,e))}static elements=[...e];static rest=[...t]}}function Ym(...e){return Array.isArray(e[0])?Jm(e[0],e.slice(1)):Jm(e,[])}function Xm(e,t){return class extends Jm([],[e],t){static annotations(e){return Xm(this.value,bm(this.ast,e))}static value=e}}const Zm=e=>Xm(e),Qm=e=>e?`"?:"`:`":"`;var $m=class extends ls{isReadonly;defaultValue;_tag=`PropertySignatureDeclaration`;constructor(e,t,n,r,i){super(e,t,r),this.isReadonly=n,this.defaultValue=i}toString(){let e=Qm(this.isOptional),t=String(this.type);return`PropertySignature<${e}, ${t}, never, ${e}, ${t}>`}};(class extends ls{isReadonly;fromKey;constructor(e,t,n,r,i){super(e,t,r),this.isReadonly=n,this.fromKey=i}});var eh=class extends ls{isReadonly;defaultValue;constructor(e,t,n,r,i){super(e,t,r),this.isReadonly=n,this.defaultValue=i}};const th=e=>e===void 0?`never`:Nt(e)?JSON.stringify(e):String(e);var nh=class{from;to;decode;encode;_tag=`PropertySignatureTransformation`;constructor(e,t,n,r){this.from=e,this.to=t,this.decode=n,this.encode=r}toString(){return`PropertySignature<${Qm(this.to.isOptional)}, ${this.to.type}, ${th(this.from.fromKey)}, ${Qm(this.from.isOptional)}, ${this.from.type}>`}};const rh=(e,t)=>{switch(e._tag){case`PropertySignatureDeclaration`:return new $m(e.type,e.isOptional,e.isReadonly,{...e.annotations,...t},e.defaultValue);case`PropertySignatureTransformation`:return new nh(e.from,new eh(e.to.type,e.to.isOptional,e.to.isReadonly,{...e.to.annotations,...t},e.to.defaultValue),e.decode,e.encode)}},ih=Symbol.for(`effect/PropertySignature`),ah=e=>h(e,ih);var oh=class e{ast;[gm];[ih]=null;_TypeToken;_Key;_EncodedToken;_HasDefault;constructor(e){this.ast=e}pipe(){return Xe(this,arguments)}annotations(t){return new e(rh(this.ast,ym(t)))}toString(){return String(this.ast)}};const sh=e=>new oh(e);var ch=class e extends oh{from;constructor(e,t){super(e),this.from=t}annotations(t){return new e(rh(this.ast,ym(t)),this.from)}};const lh=e=>new ch(new $m(e.ast,!1,!0,{},void 0),e),uh=T(2,(e,t)=>{let n=e.ast;switch(n._tag){case`PropertySignatureDeclaration`:return sh(new $m(n.type,n.isOptional,n.isReadonly,n.annotations,t));case`PropertySignatureTransformation`:return sh(new nh(n.from,new eh(n.to.type,n.to.isOptional,n.to.isReadonly,n.to.annotations,t),n.decode,n.encode))}}),dh=e=>new ch(new $m(e.ast===Yo||e.ast===Xo?Yo:Wm(e).ast,!0,!0,{},void 0),e),fh=Ks([oo]),ph=(e,n)=>{let r=Reflect.ownKeys(e),i=[];if(r.length>0){let a=[],o=[],s=[];for(let t=0;t<r.length;t++){let n=r[t],c=e[n];if(ah(c)){let e=c.ast;switch(e._tag){case`PropertySignatureDeclaration`:{let t=e.type,r=e.isOptional,s=e.annotations;a.push(new F(n,t,r,!0,fh(e))),o.push(new F(n,I(t),r,!0,s)),i.push(new F(n,t,r,!0,s));break}case`PropertySignatureTransformation`:{let t=e.from.fromKey??n;a.push(new F(t,e.from.type,e.from.isOptional,!0,e.from.annotations)),o.push(new F(n,e.to.type,e.to.isOptional,!0,e.to.annotations)),s.push(new Ls(t,n,e.decode,e.encode));break}}}else a.push(new F(n,c.ast,!1,!0)),o.push(new F(n,I(c.ast),!1,!0)),i.push(new F(n,c.ast,!1,!0))}if(t(s)){let e=[],t=[];for(let r of n){let{indexSignatures:n,propertySignatures:i}=Gs(r.key.ast,r.value.ast);i.forEach(e=>{a.push(e),o.push(new F(e.name,I(e.type),e.isOptional,e.isReadonly,e.annotations))}),n.forEach(n=>{e.push(n),t.push(new ms(n.parameter,I(n.type),n.isReadonly))})}return new Ms(new hs(a,e,{[lo]:`Struct (Encoded side)`}),new hs(o,t,{[lo]:`Struct (Type side)`}),new Rs(s))}}let a=[];for(let e of n){let{indexSignatures:t,propertySignatures:n}=Gs(e.key.ast,e.value.ast);n.forEach(e=>i.push(e)),t.forEach(e=>a.push(e))}return new hs(i,a)},mh=(e,t)=>{let n=Reflect.ownKeys(e);for(let r of n){let n=e[r];if(t[r]===void 0&&ah(n)){let e=n.ast,i=e._tag===`PropertySignatureDeclaration`?e.defaultValue:e.to.defaultValue;i!==void 0&&(t[r]=i())}}return t};function hh(e,t,n=ph(e,t)){return class extends K(n){static annotations(e){return hh(this.fields,this.records,bm(this.ast,e))}static fields={...e};static records=[...t];static make=(t,n)=>{let r=mh(e,{...t});return j_(n)?r:Ap(this)(r)};static pick(...t){return gh(mm(e,...t))}static omit(...t){return gh(hm(e,...t))}}}function gh(e,...t){return hh(e,t)}const _h=e=>Om(e).pipe(lh,uh(()=>e)),vh=(e,t)=>gh({_tag:_h(e),...t});function yh(e,t,n){return class extends hh({},[{key:e,value:t}],n){static annotations(n){return yh(e,t,bm(this.ast,n))}static key=e;static value=t}}const bh=e=>yh(e.key,e.value);function xh(e,t){return class extends K(t){static annotations(e){return xh(this.from,bm(this.ast,e))}static make=(e,t)=>j_(t)?e:Ap(this)(e);static from=e}}const Sh=(e,t)=>n=>{let r=y(Eo(n.ast),{onNone:()=>[e],onSome:t=>[...t,e]});return xh(n,Bs(n.ast,ym({[ro]:r,...t})))},Ch=(e,t,n)=>{if(vs(e)&&vs(t)){let r=[...e.propertySignatures];for(let e of t.propertySignatures){let t=e.name,i=r.findIndex(e=>e.name===t);if(i===-1)r.push(e);else{let{isOptional:a,type:o}=r[i];r[i]=new F(t,Eh(o,e.type,n.concat(t)),a,!0)}}return new hs(r,e.indexSignatures.concat(t.indexSignatures))}throw Error(Pa(e,t,n))},wh=qs([so]),Th=(e,t)=>t.map(t=>new ks(t,e.filter,wh(e))),Eh=(e,t,n)=>Cs.make(Oh([e],[t],n)),Dh=e=>Es(e)?e.types:[e],Oh=(t,n,r)=>Be(t,t=>Be(n,n=>{switch(n._tag){case`Literal`:if(Nt(n.literal)&&es(t)||e(n.literal)&&ns(t)||Ot(n.literal)&&is(t))return[n];break;case`StringKeyword`:if(n===$o){if(es(t)||qo(t)&&Nt(t.literal))return[t];if(As(t))return Th(t,Oh(Dh(t.from),[n],r))}else if(t===$o)return[n];break;case`NumberKeyword`:if(n===ts){if(ns(t)||qo(t)&&e(t.literal))return[t];if(As(t))return Th(t,Oh(Dh(t.from),[n],r))}else if(t===ts)return[n];break;case`BooleanKeyword`:if(n===rs){if(is(t)||qo(t)&&Ot(t.literal))return[t];if(As(t))return Th(t,Oh(Dh(t.from),[n],r))}else if(t===rs)return[n];break;case`Union`:return Oh(Dh(t),n.types,r);case`Suspend`:return[new Os(()=>Eh(t,n.f(),r))];case`Refinement`:return Th(n,Oh(Dh(t),Dh(n.from),r));case`TypeLiteral`:switch(t._tag){case`Union`:return Oh(t.types,[n],r);case`Suspend`:return[new Os(()=>Eh(t.f(),n,r))];case`Refinement`:return Th(t,Oh(Dh(t.from),[n],r));case`TypeLiteral`:return[Ch(t,n,r)];case`Transformation`:{let e=t.transformation,i=Ch(t.from,n,r),a=Ch(t.to,I(n),r);switch(e._tag){case`TypeLiteralTransformation`:return[new Ms(i,a,new Rs(e.propertySignatureTransformations))];case`ComposeTransformation`:return[new Ms(i,a,Is)];case`FinalTransformation`:return[new Ms(i,a,new Ps((t,n,r,i)=>vp(e.decode(t,n,r,i),e=>({...t,...e})),(t,n,r,i)=>vp(e.encode(t,n,r,i),e=>({...t,...e}))))]}}}break;case`Transformation`:if(Ns(t)){if(zs(n.transformation)&&zs(t.transformation))return[new Ms(Ch(t.from,n.from,r),Ch(t.to,n.to,r),new Rs(n.transformation.propertySignatureTransformations.concat(t.transformation.propertySignatureTransformations)))]}else return Oh([n],[t],r);break}throw Error(Pa(t,n,r))})),kh=T(2,(e,t)=>K(Eh(e.ast,t.ast,[]))),Ah=e=>K(new Os(()=>e().ast)),jh=Symbol.for(`effect/SchemaId/Refine`);function Mh(e,t,n){return class extends K(n){static annotations(e){return Mh(this.from,this.filter,bm(this.ast,e))}static[jh]=e;static from=e;static filter=t;static make=(e,t)=>j_(t)?e:Ap(this)(e)}}const Nh=(e,n,r)=>{if(Ot(e))return e?b():v(new U(n,r));if(Nt(e))return v(new U(n,r,e));if(e!==void 0){if(`_tag`in e)return v(e);let i=new U(n,r,e.message);return v(t(e.path)?new V(e.path,r,i):i)}return b()},Ph=(e,n,r)=>{if(Aa(e))return Nh(e,n,r);if(t(e)){let i=Pe(e,e=>Nh(e,n,r));if(t(i))return v(i.length===1?i[0]:new H(n,r,i))}return b()};function Y(e,t){return n=>{function r(t,n,r){return Ph(e(t,n,r),r,t)}return Mh(n,r,new ks(n.ast,r,ym(t)))}}function Fh(e,t,n){return class extends K(n){static annotations(e){return Fh(this.from,this.to,bm(this.ast,e))}static from=e;static to=t}}const X=T(e=>Tm(e[0])&&Tm(e[1]),(e,t,n)=>Fh(e,t,new Ms(e.ast,t.ast,new Ps(n.decode,n.encode)))),Z=T(e=>Tm(e[0])&&Tm(e[1]),(e,t,n)=>X(e,t,{strict:!0,decode:(e,t,r,i)=>W(n.decode(e,i)),encode:(e,t,r,i)=>W(n.encode(e,i))})),Ih=T(2,(e,t)=>e.annotations(t)),Lh=Symbol.for(`effect/SchemaId/Trimmed`),Rh=e=>t=>t.pipe(Y(e=>e===e.trim(),{schemaId:Lh,title:`trimmed`,description:`a string with no leading or trailing whitespace`,jsonSchema:{pattern:`^\\S[\\s\\S]*\\S$|^\\S$|^$`},...e})),zh=eo,Bh=(e,t)=>n=>n.pipe(Y(t=>t.length>=e,{schemaId:zh,title:`minLength(${e})`,description:`a string at least ${e} character(s) long`,jsonSchema:{minLength:e},...t})),Vh=to,Hh=(e,t)=>n=>{let r=ot(e)?Math.max(0,Math.floor(e.min)):Math.max(0,Math.floor(e)),i=ot(e)?Math.max(r,Math.floor(e.max)):r;return r===i?n.pipe(Y(e=>e.length===r,{schemaId:Vh,title:`length(${r})`,description:r===1?`a single character`:`a string ${r} character(s) long`,jsonSchema:{minLength:r,maxLength:r},...t})):n.pipe(Y(e=>e.length>=r&&e.length<=i,{schemaId:Vh,title:`length({ min: ${r}, max: ${i})`,description:`a string at least ${r} character(s) and at most ${i} character(s) long`,jsonSchema:{minLength:r,maxLength:i},...t}))},Uh=Symbol.for(`effect/SchemaId/Pattern`),Wh=(e,t)=>n=>{let r=e.source;return n.pipe(Y(t=>(e.lastIndex=0,e.test(t)),{schemaId:Uh,[Uh]:{regex:e},description:`a string matching the pattern ${r}`,jsonSchema:{pattern:r},...t}))},Gh=Symbol.for(`effect/SchemaId/Lowercased`),Kh=e=>t=>t.pipe(Y(e=>e===e.toLowerCase(),{schemaId:Gh,title:`lowercased`,description:`a lowercase string`,jsonSchema:{pattern:`^[^A-Z]*$`},...e}));var qh=class extends q.pipe(Kh({identifier:`Lowercased`})){};const Jh=Symbol.for(`effect/SchemaId/Uppercased`),Yh=e=>t=>t.pipe(Y(e=>e===e.toUpperCase(),{schemaId:Jh,title:`uppercased`,description:`an uppercase string`,jsonSchema:{pattern:`^[^a-z]*$`},...e}));var Xh=class extends q.pipe(Yh({identifier:`Uppercased`})){};const Zh=Symbol.for(`effect/SchemaId/Capitalized`),Qh=e=>t=>t.pipe(Y(e=>e[0]?.toUpperCase()===e[0],{schemaId:Zh,title:`capitalized`,description:`a capitalized string`,jsonSchema:{pattern:`^[^a-z]?.*$`},...e}));var $h=class extends q.pipe(Qh({identifier:`Capitalized`})){};const eg=Symbol.for(`effect/SchemaId/Uncapitalized`),tg=e=>t=>t.pipe(Y(e=>e[0]?.toLowerCase()===e[0],{schemaId:eg,title:`uncapitalized`,description:`a uncapitalized string`,jsonSchema:{pattern:`^[^A-Z]?.*$`},...e}));var ng=class extends q.pipe(tg({identifier:`Uncapitalized`})){};q.pipe(Hh(1,{identifier:`Char`}));const rg=e=>Bh(1,{title:`nonEmptyString`,description:`a non empty string`,...e});Z(q.annotations({description:`a string that will be converted to lowercase`}),qh,{strict:!0,decode:e=>e.toLowerCase(),encode:w}).annotations({identifier:`Lowercase`}),Z(q.annotations({description:`a string that will be converted to uppercase`}),Xh,{strict:!0,decode:e=>e.toUpperCase(),encode:w}).annotations({identifier:`Uppercase`}),Z(q.annotations({description:`a string that will be converted to a capitalized format`}),$h,{strict:!0,decode:e=>wa(e),encode:w}).annotations({identifier:`Capitalize`}),Z(q.annotations({description:`a string that will be converted to an uncapitalized format`}),ng,{strict:!0,decode:e=>Ta(e),encode:w}).annotations({identifier:`Uncapitalize`});var ig=class extends q.pipe(Rh({identifier:`Trimmed`})){},ag=class extends ig.pipe(rg({identifier:`NonEmptyTrimmedString`})){};Z(q.annotations({description:`a string that will be trimmed`}),ig,{strict:!0,decode:e=>e.trim(),encode:w}).annotations({identifier:`Trim`});const og=e=>e instanceof Error?e.message:String(e);q.pipe(rg({identifier:`NonEmptyString`}));const sg=Symbol.for(`effect/SchemaId/UUID`),cg=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i;q.pipe(Wh(cg,{schemaId:sg,identifier:`UUID`,jsonSchema:{format:`uuid`,pattern:cg.source},description:`a Universally Unique Identifier`,arbitrary:()=>e=>e.uuid()}));const lg=Symbol.for(`effect/SchemaId/ULID`);q.pipe(Wh(/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/i,{schemaId:lg,identifier:`ULID`,description:`a Universally Unique Lexicographically Sortable Identifier`,arbitrary:()=>e=>e.ulid()}));var ug=class extends Pm(URL,{typeConstructor:{_tag:`URL`},identifier:`URLFromSelf`,arbitrary:()=>e=>e.webUrl().map(e=>new URL(e)),pretty:()=>e=>e.toString()}){};X(q.annotations({description:`a string to be decoded into a URL`}),ug,{strict:!0,decode:(e,t,n)=>mp({try:()=>new URL(e),catch:t=>new U(n,e,`Unable to decode ${JSON.stringify(e)} into a URL. ${og(t)}`)}),encode:e=>W(e.toString())}).annotations({identifier:`URL`,pretty:()=>e=>e.toString()});const dg=Ya,fg=e=>t=>t.pipe(Y(Number.isFinite,{schemaId:dg,title:`finite`,description:`a finite number`,jsonSchema:{},...e})),pg=Ua,mg=(e,t)=>n=>n.pipe(Y(t=>t>e,{schemaId:pg,title:`greaterThan(${e})`,description:e===0?`a positive number`:`a number greater than ${e}`,jsonSchema:{exclusiveMinimum:e},...t})),hg=Wa,gg=(e,t)=>n=>n.pipe(Y(t=>t>=e,{schemaId:hg,title:`greaterThanOrEqualTo(${e})`,description:e===0?`a non-negative number`:`a number greater than or equal to ${e}`,jsonSchema:{minimum:e},...t})),_g=qa,vg=e=>t=>t.pipe(Y(e=>Number.isSafeInteger(e),{schemaId:_g,title:`int`,description:`an integer`,jsonSchema:{type:`integer`},...e})),yg=Ga,bg=(e,t)=>n=>n.pipe(Y(t=>t<e,{schemaId:yg,title:`lessThan(${e})`,description:e===0?`a negative number`:`a number less than ${e}`,jsonSchema:{exclusiveMaximum:e},...t})),xg=Ka,Sg=(e,t)=>n=>n.pipe(Y(t=>t<=e,{schemaId:xg,title:`lessThanOrEqualTo(${e})`,description:e===0?`a non-positive number`:`a number less than or equal to ${e}`,jsonSchema:{maximum:e},...t})),Cg=Za,wg=(e,t,n)=>r=>r.pipe(Y(n=>n>=e&&n<=t,{schemaId:Cg,title:`between(${e}, ${t})`,description:`a number between ${e} and ${t}`,jsonSchema:{minimum:e,maximum:t},...n})),Tg=Ja,Eg=e=>t=>t.pipe(Y(e=>!Number.isNaN(e),{schemaId:Tg,title:`nonNaN`,description:`a number excluding NaN`,...e})),Dg=e=>mg(0,{title:`positive`,...e}),Og=e=>bg(0,{title:`negative`,...e}),kg=e=>Sg(0,{title:`nonPositive`,...e}),Ag=e=>gg(0,{title:`nonNegative`,...e});function jg(e){return X(e,J,{strict:!1,decode:(e,t,n)=>hp(Dn(e),()=>new U(n,e,`Unable to decode ${JSON.stringify(e)} into a number`)),encode:e=>W(String(e))})}jg(q.annotations({description:`a string to be decoded into a number`})).annotations({identifier:`NumberFromString`}),J.pipe(fg({identifier:`Finite`}));var Mg=class extends J.pipe(vg({identifier:`Int`})){};J.pipe(Eg({identifier:`NonNaN`})),J.pipe(Dg({identifier:`Positive`})),J.pipe(Og({identifier:`Negative`})),J.pipe(kg({identifier:`NonPositive`}));var Ng=class extends J.pipe(Ag({identifier:`NonNegative`})){};const Pg=Xa;J.pipe(fg({schemaId:Pg,identifier:`JsonNumber`})),Z(Bm.annotations({description:`a boolean that will be negated`}),Bm,{strict:!0,decode:e=>Rn(e),encode:e=>Rn(e)});const Fg=(e,t)=>{let n=Symbol.keyFor(e);return n===void 0?pp(new U(t,e,`Unable to encode a unique symbol ${String(e)} into a string`)):W(n)},Ig=e=>W(Symbol.for(e));X(q.annotations({description:`a string to be decoded into a globally shared symbol`}),zm,{strict:!1,decode:e=>Ig(e),encode:(e,t,n)=>Fg(e,n)}).annotations({identifier:`Symbol`});const Lg=Qa,Rg=(e,t)=>n=>n.pipe(Y(t=>t>=e,{schemaId:Lg,[Lg]:{min:e},title:`greaterThanOrEqualToBigInt(${e})`,description:e===0n?`a non-negative bigint`:`a bigint greater than or equal to ${e}n`,...t})),zg=$a,Bg=(e,t,n)=>r=>r.pipe(Y(n=>n>=e&&n<=t,{schemaId:zg,[zg]:{min:e,max:t},title:`betweenBigInt(${e}, ${t})`,description:`a bigint between ${e}n and ${t}n`,...n})),Vg=e=>Rg(0n,{title:`nonNegativeBigInt`,...e});var Hg=class extends X(q.annotations({description:`a string to be decoded into a bigint`}),Rm,{strict:!0,decode:(e,t,n)=>hp(Dc(e),()=>new U(n,e,`Unable to decode ${JSON.stringify(e)} into a bigint`)),encode:e=>W(String(e))}).annotations({identifier:`BigInt`}){};const Ug=Rm.pipe(Vg({identifier:`NonNegativeBigintFromSelf`}));X(J.annotations({description:`a number to be decoded into a bigint`}),Rm.pipe(Bg(BigInt(-(2**53-1)),BigInt(2**53-1))),{strict:!0,decode:(e,t,n)=>hp(Oc(e),()=>new U(n,e,`Unable to decode ${e} into a bigint`)),encode:(e,t,n)=>hp(Ec(e),()=>new U(n,e,`Unable to encode ${e}n into a number`))}).annotations({identifier:`BigIntFromNumber`});const Wg=(e,t,n,r)=>bp(e,{onFailure:e=>new H(n,r,e),onSuccess:t});var Gg=class extends Mm(ie,{typeConstructor:{_tag:`effect/Duration`},identifier:`DurationFromSelf`,pretty:()=>String,arbitrary:()=>e=>e.oneof(e.constant(kt),e.bigInt({min:0n}).map(e=>Ce(e)),e.maxSafeNat().map(e=>We(e))),equivalence:()=>ze}){};X(Ug.annotations({description:`a bigint to be decoded into a Duration`}),Gg.pipe(Y(e=>He(e),{description:`a finite duration`})),{strict:!0,decode:e=>W(Ce(e)),encode:(e,t,n)=>y(It(e),{onNone:()=>pp(new U(n,e,`Unable to encode ${e} into a bigint`)),onSome:e=>W(e)})}).annotations({identifier:`DurationFromNanos`});const Kg=Ng.pipe(vg()).annotations({identifier:`NonNegativeInt`});Z(Ng.annotations({description:`a non-negative number to be decoded into a Duration`}),Gg,{strict:!0,decode:e=>We(e),encode:e=>at(e)}).annotations({identifier:`DurationFromMillis`});const qg=vh(`Millis`,{millis:Kg}),Jg=vh(`Nanos`,{nanos:Hg}),Yg=vh(`Infinity`,{}),Xg=Yg.make({}),Zg=Um(qg,Jg,Yg).annotations({identifier:`DurationValue`,description:`an JSON-compatible tagged union to be decoded into a Duration`}),Qg=Um(Ym(Gm(Kg).annotations({title:`seconds`}),Gm(Kg).annotations({title:`nanos`})).annotations({identifier:`FiniteHRTime`}),Ym(Om(-1),Om(0)).annotations({identifier:`InfiniteHRTime`})).annotations({identifier:`HRTime`,description:`a tuple of seconds and nanos to be decoded into a Duration`}),$g=e=>typeof e==`object`;Z(Um(Zg,Qg),Gg,{strict:!0,decode:e=>{if($g(e))switch(e._tag){case`Millis`:return We(e.millis);case`Nanos`:return Ce(e.nanos);case`Infinity`:return kt}let[t,n]=e;return t===-1?kt:Ce(BigInt(t)*BigInt(1e9)+BigInt(n))},encode:e=>{switch(e.value._tag){case`Millis`:return qg.make({millis:e.value.millis});case`Nanos`:return Jg.make({nanos:e.value.nanos});case`Infinity`:return Xg}}}).annotations({identifier:`Duration`});var e_=class extends Mm(Ft,{typeConstructor:{_tag:`Uint8Array`},identifier:`Uint8ArrayFromSelf`,pretty:()=>e=>`new Uint8Array(${JSON.stringify(Array.from(e))})`,arbitrary:()=>e=>e.uint8Array(),equivalence:()=>At(_t)}){};Z(Zm(class extends J.pipe(wg(0,255,{identifier:`Uint8`,description:`a 8-bit unsigned integer`})){}).annotations({description:`an array of 8-bit unsigned integers to be decoded into a Uint8Array`}),e_,{strict:!0,decode:e=>Uint8Array.from(e),encode:e=>Array.from(e)}).annotations({identifier:`Uint8Array`});const t_=Symbol.for(`effect/SchemaId/ValidDate`),n_=e=>t=>t.pipe(Y(e=>!Number.isNaN(e.getTime()),{schemaId:t_,[t_]:{noInvalidDate:!0},title:`validDate`,description:`a valid Date`,...e})),r_=Ha;var i_=class extends Mm(re,{typeConstructor:{_tag:`Date`},identifier:`DateFromSelf`,schemaId:r_,[r_]:{noInvalidDate:!1},description:`a potentially invalid Date instance`,pretty:()=>e=>`new Date(${JSON.stringify(e)})`,arbitrary:()=>e=>e.date({noInvalidDate:!1}),equivalence:()=>Rt}){};i_.pipe(n_({identifier:`ValidDateFromSelf`,description:`a valid Date instance`})),class extends Z(q.annotations({description:`a string to be decoded into a Date`}),i_,{strict:!0,decode:e=>new Date(e),encode:e=>a(e)}).annotations({identifier:`DateFromString`}){}.pipe(n_({identifier:`Date`})),Z(J.annotations({description:`a number to be decoded into a Date`}),i_,{strict:!0,decode:e=>new Date(e),encode:e=>e.getTime()}).annotations({identifier:`DateFromNumber`});var a_=class extends Mm(e=>Vf(e)&&Wf(e),{typeConstructor:{_tag:`effect/DateTime.Utc`},identifier:`DateTimeUtcFromSelf`,description:`a DateTime.Utc instance`,pretty:()=>e=>e.toString(),arbitrary:()=>e=>e.date({noInvalidDate:!0}).map(e=>qf(e)),equivalence:()=>Kf}){};const o_=(e,t)=>mp({try:()=>Jf(e),catch:()=>new U(t,e,`Unable to decode ${ke(e)} into a DateTime.Utc`)});X(J.annotations({description:`a number to be decoded into a DateTime.Utc`}),a_,{strict:!0,decode:(e,t,n)=>o_(e,n),encode:e=>W(np(e))}).annotations({identifier:`DateTimeUtcFromNumber`}),X(i_.annotations({description:`a Date to be decoded into a DateTime.Utc`}),a_,{strict:!0,decode:(e,t,n)=>o_(e,n),encode:e=>W(tp(e))}).annotations({identifier:`DateTimeUtcFromDate`}),X(q.annotations({description:`a string to be decoded into a DateTime.Utc`}),a_,{strict:!0,decode:(e,t,n)=>o_(e,n),encode:e=>W(rp(e))}).annotations({identifier:`DateTimeUtc`});const s_=()=>e=>e.integer({min:-720*60*1e3,max:840*60*1e3}).map(Qf);var c_=class extends Mm(Hf,{typeConstructor:{_tag:`effect/DateTime.TimeZone.Offset`},identifier:`TimeZoneOffsetFromSelf`,description:`a TimeZone.Offset instance`,pretty:()=>e=>e.toString(),arbitrary:s_}){};Z(J.annotations({description:`a number to be decoded into a TimeZone.Offset`}),c_,{strict:!0,decode:e=>Qf(e),encode:e=>e.offset}).annotations({identifier:`TimeZoneOffset`});const l_=()=>e=>e.constantFrom(...Intl.supportedValuesOf(`timeZone`)).map(Zf);var u_=class extends Mm(Uf,{typeConstructor:{_tag:`effect/DateTime.TimeZone.Named`},identifier:`TimeZoneNamedFromSelf`,description:`a TimeZone.Named instance`,pretty:()=>e=>e.toString(),arbitrary:l_}){};X(q.annotations({description:`a string to be decoded into a TimeZone.Named`}),u_,{strict:!0,decode:(e,t,n)=>mp({try:()=>Zf(e),catch:()=>new U(n,e,`Unable to decode ${JSON.stringify(e)} into a TimeZone.Named`)}),encode:e=>W(e.id)}).annotations({identifier:`TimeZoneNamed`});var d_=class extends Um(c_,u_){};X(q.annotations({description:`a string to be decoded into a TimeZone`}),d_,{strict:!0,decode:(e,t,n)=>y($f(e),{onNone:()=>pp(new U(n,e,`Unable to decode ${JSON.stringify(e)} into a TimeZone`)),onSome:W}),encode:e=>W(ep(e))}).annotations({identifier:`TimeZone`});const f_=e=>e.oneof(s_()(e),l_()(e));var p_=class extends Mm(e=>Vf(e)&&Gf(e),{typeConstructor:{_tag:`effect/DateTime.Zoned`},identifier:`DateTimeZonedFromSelf`,description:`a DateTime.Zoned instance`,pretty:()=>e=>e.toString(),arbitrary:()=>e=>e.tuple(e.integer({min:-31536e9,max:31536e9}),f_(e)).map(([e,t])=>Yf(e,{timeZone:t})),equivalence:()=>Kf}){};X(q.annotations({description:`a string to be decoded into a DateTime.Zoned`}),p_,{strict:!0,decode:(e,t,n)=>y(Xf(e),{onNone:()=>pp(new U(n,e,`Unable to decode ${JSON.stringify(e)} into a DateTime.Zoned`)),onSome:W}),encode:e=>W(ip(e))}).annotations({identifier:`DateTimeZoned`});const m_=e=>e._tag===`None`?b():v(e.value),h_=(e,t)=>n=>n.oneof(t,n.record({_tag:n.constant(`None`)}),n.record({_tag:n.constant(`Some`),value:e(n)})).map(m_),g_=e=>y({onNone:()=>`none()`,onSome:t=>`some(${e(t)})`}),__=e=>(t,n,r)=>bt(t)?ve(t)?W(b()):Wg(e(t.value,n),v,r,t):pp(new U(r,t)),v_=e=>Mm([e],{decode:e=>__(Dp(e)),encode:e=>__(Op(e))},{typeConstructor:{_tag:`effect/Option`},pretty:g_,arbitrary:h_,equivalence:Kt});Z(q,(e=>v_(e).annotations({description:`Option<${xm(e)}>`}))(ag),{strict:!0,decode:e=>Qe(v(e.trim()),Ea),encode:e=>Me(e,()=>``)});const y_=()=>e=>`BigDecimal(${xc(pc(e))})`,b_=()=>e=>e.tuple(e.bigInt(),e.integer({min:-18,max:18})).map(([e,t])=>cc(e,t));var x_=class extends Mm(sc,{typeConstructor:{_tag:`effect/BigDecimal`},identifier:`BigDecimalFromSelf`,pretty:y_,arbitrary:b_,equivalence:()=>gc}){};X(q.annotations({description:`a string to be decoded into a BigDecimal`}),x_,{strict:!0,decode:(e,t,n)=>bc(e).pipe(y({onNone:()=>pp(new U(n,e,`Unable to decode ${JSON.stringify(e)} into a BigDecimal`)),onSome:e=>W(pc(e))})),encode:e=>W(xc(pc(e)))}).annotations({identifier:`BigDecimal`}),Z(J.annotations({description:`a number to be decoded into a BigDecimal`}),x_,{strict:!0,decode:e=>vc(e),encode:e=>Cc(e)}).annotations({identifier:`BigDecimalFromNumber`});const S_=e=>Tm(e)||ah(e),C_=e=>Reflect.ownKeys(e).every(t=>S_(e[t])),w_=e=>`fields`in e?e.fields:w_(e[jh]),T_=e=>C_(e)?gh(e):Tm(e)?e:gh(w_(e)),E_=e=>C_(e)?e:w_(e),D_=e=>uh(lh(Om(e)),()=>e),O_=e=>(t,n,r)=>{let i=E_(n),a=T_(n),o={_tag:D_(t)},s=A_(o,i);return class extends P_({kind:`TaggedClass`,identifier:e??t,schema:kh(a,gh(o)),fields:s,Base:Ti,annotations:r}){static _tag=t}},k_=e=>(t,n,r)=>{class i extends Ei{}i.prototype.name=t;let a=E_(n),o=T_(n),s={_tag:D_(t)},c=A_(s,a),l=`message`in c;class u extends P_({kind:`TaggedError`,identifier:e??t,schema:kh(o,gh(s)),fields:c,Base:i,annotations:r,disableToString:!0}){static _tag=t}return l||Object.defineProperty(u.prototype,"message",{get(){return`{ ${Reflect.ownKeys(a).map(e=>`${Wt(e)}: ${ke(this[e])}`).join(`, `)} }`},enumerable:!1,configurable:!0}),u},A_=(e,t)=>{let n={...e};for(let r of Reflect.ownKeys(t)){if(r in e)throw Error(Va(r));n[r]=t[r]}return n};function j_(e){return Ot(e)?e:e?.disableValidation??!1}const M_=St(`effect/Schema/astCache`,()=>new WeakMap),N_=e=>e===void 0?[]:Array.isArray(e)?e:[e],P_=({Base:e,annotations:t,disableToString:n,fields:r,identifier:i,kind:a,schema:o})=>{let s=Symbol.for(`effect/Schema/${a}/${i}`),[c,l,u]=N_(t),d=Cm(o),f=d.annotations({identifier:i,...c}),p=d.annotations({[lo]:`${i} (Type side)`,...c}),m=o.annotations({[lo]:`${i} (Constructor)`,...c}),g=o.annotations({[lo]:`${i} (Encoded side)`,...u}),_=o.annotations({...u,...c,...l}),ee=e=>h(e,s)&&jp(p)(e),te=class extends e{constructor(e={},t=!1){e={...e},a!==`Class`&&delete e._tag,e=mh(r,e),j_(t)||(e=Ap(m)(e)),super(e,!0)}static[gm]=_m;static get ast(){let e=M_.get(this);if(e)return e;let t=Mm([o],{decode:()=>(e,t,n)=>e instanceof this||ee(e)?W(e):pp(new U(n,e)),encode:()=>(e,t)=>e instanceof this?W(e):vp(Op(p)(e,t),e=>new this(e,!0))},{identifier:i,pretty:e=>t=>`${i}(${e(t)})`,arbitrary:e=>t=>e(t).map(e=>new this(e)),equivalence:w,[wo]:f.ast,...c});return e=Z(g,t,{strict:!0,decode:e=>new this(e,!0),encode:w}).annotations({[wo]:_.ast,...l}).ast,M_.set(this,e),e}static pipe(){return Xe(this,arguments)}static annotations(e){return K(this.ast).annotations(e)}static toString(){return`(${String(g)} <-> ${i})`}static make(...e){return new this(...e)}static fields={...r};static identifier=i;static extend(e){return(t,n)=>{let i=E_(t),s=T_(t),c=A_(r,i);return P_({kind:a,identifier:e,schema:kh(o,s),fields:c,Base:this,annotations:n})}}static transformOrFail(e){return(t,n,i)=>{let s=A_(r,t);return P_({kind:a,identifier:e,schema:X(o,Cm(gh(s)),n),fields:s,Base:this,annotations:i})}}static transformOrFailFrom(e){return(t,n,i)=>{let s=A_(r,t);return P_({kind:a,identifier:e,schema:X(Sm(o),gh(s),n),fields:s,Base:this,annotations:i})}}get[s](){return s}};return n!==!0&&Object.defineProperty(te.prototype,"toString",{value(){return`${i}({ ${Reflect.ownKeys(r).map(e=>`${Wt(e)}: ${ke(this[e])}`).join(`, `)} })`},configurable:!0,writable:!0}),te},F_=Um(gh({_tag:Om(`None`)}).annotations({identifier:`FiberIdNoneEncoded`}),gh({_tag:Om(`Runtime`),id:Mg,startTimeMillis:Mg}).annotations({identifier:`FiberIdRuntimeEncoded`}),gh({_tag:Om(`Composite`),left:Ah(()=>F_),right:Ah(()=>F_)}).annotations({identifier:`FiberIdCompositeEncoded`})).annotations({identifier:`FiberIdEncoded`}),I_=e=>e.letrec(t=>({None:e.record({_tag:e.constant(`None`)}),Runtime:e.record({_tag:e.constant(`Runtime`),id:e.integer(),startTimeMillis:e.integer()}),Composite:e.record({_tag:e.constant(`Composite`),left:t(`FiberId`),right:t(`FiberId`)}),FiberId:e.oneof(t(`None`),t(`Runtime`),t(`Composite`))})).FiberId.map(z_),L_=e=>{switch(e._tag){case`None`:return`FiberId.none`;case`Runtime`:return`FiberId.runtime(${e.id}, ${e.startTimeMillis})`;case`Composite`:return`FiberId.composite(${L_(e.right)}, ${L_(e.left)})`}};var R_=class extends Mm(he,{typeConstructor:{_tag:`effect/FiberId`},identifier:`FiberIdFromSelf`,pretty:()=>L_,arbitrary:()=>I_}){};const z_=e=>{switch(e._tag){case`None`:return be;case`Runtime`:return f(e.id,e.startTimeMillis);case`Composite`:return fe(z_(e.left),z_(e.right))}},B_=e=>{switch(e._tag){case`None`:return{_tag:`None`};case`Runtime`:return{_tag:`Runtime`,id:e.id,startTimeMillis:e.startTimeMillis};case`Composite`:return{_tag:`Composite`,left:B_(e.left),right:B_(e.right)}}};Z(F_,R_,{strict:!0,decode:e=>z_(e),encode:e=>B_(e)}).annotations({identifier:`FiberId`});var V_=class extends Z(Lm,Lm,{strict:!0,decode:e=>{if(ot(e)&&`message`in e&&typeof e.message==`string`){let t=Error(e.message,{cause:e});return`name`in e&&typeof e.name==`string`&&(t.name=e.name),t.stack=`stack`in e&&typeof e.stack==`string`?e.stack:``,t}return Tt(e)},encode:e=>e instanceof Error?{name:e.name,message:e.message}:Tt(e)}).annotations({identifier:`Defect`}){};Z(Lm,Bm,{strict:!0,decode:e=>Et(e),encode:w}).annotations({identifier:`BooleanFromUnknown`}),Z(Om(`true`,`false`).annotations({description:`a string to be decoded into a boolean`}),Bm,{strict:!0,decode:e=>e===`true`,encode:e=>e?`true`:`false`}).annotations({identifier:`BooleanFromString`});const H_=vh(`symbol`,{key:q}).annotations({description:`an object to be decoded into a globally shared symbol`}),U_=X(H_,zm,{strict:!0,decode:e=>Ig(e.key),encode:(e,t,n)=>vp(Fg(e,n),e=>H_.make({key:e}))});var W_=class extends Um(q,J,U_).annotations({identifier:`PropertyKey`}){};gh({_tag:lh(Om(`Pointer`,`Unexpected`,`Missing`,`Composite`,`Refinement`,`Transformation`,`Type`,`Forbidden`)).annotations({description:`The tag identifying the type of parse issue`}),path:lh(Zm(W_)).annotations({description:`The path to the property where the issue occurred`}),message:lh(q).annotations({description:`A descriptive message explaining the issue`})}).annotations({identifier:`ArrayFormatterIssue`,description:`Represents an issue returned by the ArrayFormatter formatter`});const G_=Yd,K_=Qd,q_=_f,J_=vf,Y_=Ef,X_=If,Z_=Lf,Q_={arrays:`merge`,sets:`merge`,maps:`merge`};function $_(e,t,n){return ev(e,t,new Set,n??Q_)}function ev(e,t,n,r){let i={},a=new Set([...av(e),...av(t)]);for(let o of a){if(o===`__proto__`)continue;let a=e[o];if(!Object.hasOwn(t,o)){i[o]=a;continue}let s=t[o];if(iv(a)&&iv(s)&&!n.has(a)&&!n.has(s)){n.add(a),n.add(s),i[o]=tv(a,s,n,r);continue}i[o]=s}return i}function tv(e,t,n,r){if(nv(e)&&nv(t))return ev(e,t,n,r);if(rv(e)&&rv(t)){if(Array.isArray(e)&&Array.isArray(t))return r.arrays===`merge`?e.concat(t):t;if(e instanceof Map&&t instanceof Map){if(r.maps===`merge`){let n=new Map(e);for(let[e,r]of t)n.set(e,r);return n}return t}if(e instanceof Set&&t instanceof Set){if(r.sets===`merge`){let n=new Set(e);for(let e of t)n.add(e);return n}return t}}return t}function nv(e){return Object.getPrototypeOf(e)===Object.prototype}function rv(e){return typeof e[Symbol.iterator]==`function`}function iv(e){return typeof e==`object`&&!!e}function av(e){let t=Object.keys(e),n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;for(let r of n)Object.prototype.propertyIsEnumerable.call(e,r)&&t.push(r);return t}function ov(e){return e%4==0&&e%100!=0||e%400==0}var sv=class{#e=/[ \t]/;#t=0;#n;constructor(e){this.#n=e}get position(){return this.#t}get source(){return this.#n}char(e=0){return this.#n[this.#t+e]??``}slice(e,t){return this.#n.slice(this.#t+e,this.#t+t)}next(e=1){this.#t+=e}skipWhitespaces(){for(;this.#e.test(this.char())&&!this.eof();)this.next();if(!this.isCurrentCharEOL()&&/\s/.test(this.char())){let e=`\\u`+this.char().charCodeAt(0).toString(16),t=this.#t;throw SyntaxError(`Cannot parse the TOML: It contains invalid whitespace at position '${t}': \`${e}\``)}}nextUntilChar(e={skipComments:!0}){for(;!this.eof();){let t=this.char();if(this.#e.test(t)||this.isCurrentCharEOL())this.next();else if(e.skipComments&&this.char()===`#`)for(;!this.isCurrentCharEOL()&&!this.eof();)this.next();else break}}eof(){return this.#t>=this.#n.length}isCurrentCharEOL(){return this.char()===`
|
|
3
|
+
`||this.startsWith(`\r
|
|
4
|
+
`)}startsWith(e){return this.#n.startsWith(e,this.#t)}match(e){if(!e.sticky)throw Error(`RegExp ${e} does not have a sticky 'y' flag`);return e.lastIndex=this.#t,this.#n.match(e)}};function Q(e){return{ok:!0,body:e}}function $(){return{ok:!1}}function cv(e,t={__proto__:null}){return e.reduceRight((e,t)=>({[t]:e}),t)}function lv(e){return typeof e==`object`&&!!e}function uv(e,t){let n=t[0];if(!n)throw Error(`Cannot parse the TOML: key length is not a positive number`);return e[n]}function dv(e,t){let{keys:n,type:r,value:i}=t,a=uv(e,n);if(a===void 0)return Object.assign(e,cv(n,i));if(Array.isArray(a))return pv(a.at(-1),{type:r,keys:n.slice(1),value:i}),e;if(lv(a))return pv(a,{type:r,keys:n.slice(1),value:i}),e;throw Error(`Unexpected assign`)}function fv(e,t){let{type:n,keys:r,value:i}=t,a=uv(e,r);if(a===void 0)return Object.assign(e,cv(r,[i]));if(Array.isArray(a))return t.keys.length===1?a.push(i):pv(a.at(-1),{type:t.type,keys:t.keys.slice(1),value:t.value}),e;if(lv(a))return pv(a,{type:n,keys:r.slice(1),value:i}),e;throw Error(`Unexpected assign`)}function pv(e,t){switch(t.type){case`Block`:return $_(e,t.value);case`Table`:return dv(e,t);case`TableArray`:return fv(e,t)}}function mv(e){return t=>{for(let n of e){let e=n(t);if(e.ok)return e}return $()}}function hv(e,t){let n=xv(t);return r=>{let i=[],a=e(r);if(!a.ok)return Q(i);for(i.push(a.body);!r.eof()&&n(r).ok;){let n=e(r);if(!n.ok)throw SyntaxError(`Invalid token after "${t}"`);i.push(n.body)}return Q(i)}}function gv(e,t){let n=xv(t);return r=>{let i=e(r);if(!i.ok)return $();let a=[i.body];for(;!r.eof()&&n(r).ok;){let n=e(r);if(!n.ok)throw SyntaxError(`Invalid token after "${t}"`);a.push(n.body)}return Q(a)}}function _v(e,t,n){let r=xv(t);return i=>{let a=i.position,o=e(i);if(!o.ok)return $();if(!r(i).ok)throw SyntaxError(`key/value pair doesn't have "${t}"`);let s=n(i);if(!s.ok){let e=i.source.indexOf(`
|
|
5
|
+
`,i.position),t=e>0?e:i.source.length,n=i.source.slice(a,t);throw SyntaxError(`Cannot parse value on line '${n}'`)}return Q(cv(o.body,s.body))}}function vv(e){return t=>{let n=e(t);if(!n.ok)return $();let r={__proto__:null};for(let e of n.body)typeof e==`object`&&e&&(r=$_(r,e));return Q(r)}}function yv(e){return t=>{let n=[];for(;!t.eof();){let r=e(t);if(!r.ok)break;n.push(r.body),t.nextUntilChar()}return n.length===0?$():Q(n)}}function bv(e,t,n){let r=xv(e),i=xv(n);return a=>{if(!r(a).ok)return $();let o=t(a);if(!o.ok)throw SyntaxError(`Invalid token after "${e}"`);if(!i(a).ok)throw SyntaxError(`Not closed by "${n}" after started with "${e}"`);return Q(o.body)}}function xv(e){return t=>(t.skipWhitespaces(),t.startsWith(e)?(t.next(e.length),t.skipWhitespaces(),Q(void 0)):$())}const Sv=/[A-Za-z0-9_-]+/y;function Cv(e){e.skipWhitespaces();let t=e.match(Sv)?.[0];return t?(e.next(t.length),Q(t)):$()}function wv(e){if(e.char()!==`\\`)return $();switch(e.next(),e.char()){case`b`:return e.next(),Q(`\b`);case`t`:return e.next(),Q(` `);case`n`:return e.next(),Q(`
|
|
6
|
+
`);case`f`:return e.next(),Q(`\f`);case`r`:return e.next(),Q(`\r`);case`u`:case`U`:{let t=e.char()===`u`?4:6,n=parseInt(`0x`+e.slice(1,1+t),16),r=String.fromCodePoint(n);return e.next(t+1),Q(r)}case`"`:return e.next(),Q(`"`);case`\\`:return e.next(),Q(`\\`);default:throw SyntaxError(`Invalid escape sequence: \\${e.char()}`)}}function Tv(e){if(e.skipWhitespaces(),e.char()!==`"`)return $();e.next();let t=[];for(;e.char()!==`"`&&!e.eof();){if(e.char()===`
|
|
7
|
+
`)throw SyntaxError(`Single-line string cannot contain EOL`);let n=wv(e);n.ok?t.push(n.body):(t.push(e.char()),e.next())}if(e.eof())throw SyntaxError(`Single-line string is not closed:\n${t.join(``)}`);return e.next(),Q(t.join(``))}function Ev(e){if(e.skipWhitespaces(),e.char()!==`'`)return $();e.next();let t=[];for(;e.char()!==`'`&&!e.eof();){if(e.char()===`
|
|
8
|
+
`)throw SyntaxError(`Single-line string cannot contain EOL`);t.push(e.char()),e.next()}if(e.eof())throw SyntaxError(`Single-line string is not closed:\n${t.join(``)}`);return e.next(),Q(t.join(``))}function Dv(e){if(e.skipWhitespaces(),!e.startsWith(`"""`))return $();e.next(3),e.char()===`
|
|
9
|
+
`?e.next():e.startsWith(`\r
|
|
10
|
+
`)&&e.next(2);let t=[];for(;!e.startsWith(`"""`)&&!e.eof();){if(e.startsWith(`\\
|
|
11
|
+
`)){e.next(),e.nextUntilChar({skipComments:!1});continue}else if(e.startsWith(`\\\r
|
|
12
|
+
`)){e.next(),e.nextUntilChar({skipComments:!1});continue}let n=wv(e);n.ok?t.push(n.body):(t.push(e.char()),e.next())}if(e.eof())throw SyntaxError(`Multi-line string is not closed:\n${t.join(``)}`);return e.char(3)===`"`&&(t.push(`"`),e.next()),e.next(3),Q(t.join(``))}function Ov(e){if(e.skipWhitespaces(),!e.startsWith(`'''`))return $();e.next(3),e.char()===`
|
|
13
|
+
`?e.next():e.startsWith(`\r
|
|
14
|
+
`)&&e.next(2);let t=[];for(;!e.startsWith(`'''`)&&!e.eof();)t.push(e.char()),e.next();if(e.eof())throw SyntaxError(`Multi-line string is not closed:\n${t.join(``)}`);return e.char(3)===`'`&&(t.push(`'`),e.next()),e.next(3),Q(t.join(``))}const kv=/(?:true|false)\b/y;function Av(e){e.skipWhitespaces();let t=e.match(kv);if(!t)return $();let n=t[0];return e.next(n.length),Q(n===`true`)}const jv=new Map([[`inf`,1/0],[`+inf`,1/0],[`-inf`,-1/0]]),Mv=/[+-]?inf\b/y;function Nv(e){e.skipWhitespaces();let t=e.match(Mv);if(!t)return $();let n=t[0];return e.next(n.length),Q(jv.get(n))}const Pv=/[+-]?nan\b/y;function Fv(e){e.skipWhitespaces();let t=e.match(Pv);if(!t)return $();let n=t[0];return e.next(n.length),Q(NaN)}const Iv=gv(mv([Cv,Tv,Ev]),`.`),Lv=/0b[01]+(?:_[01]+)*\b/y;function Rv(e){e.skipWhitespaces();let t=e.match(Lv)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,2);return isNaN(r)?$():Q(r)}const zv=/0o[0-7]+(?:_[0-7]+)*\b/y;function Bv(e){e.skipWhitespaces();let t=e.match(zv)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,8);return isNaN(r)?$():Q(r)}const Vv=/0x[0-9a-f]+(?:_[0-9a-f]+)*\b/iy;function Hv(e){e.skipWhitespaces();let t=e.match(Vv)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,16);return isNaN(r)?$():Q(r)}const Uv=/[+-]?(?:0|[1-9][0-9]*(?:_[0-9]+)*)\b/y;function Wv(e){e.skipWhitespaces();let t=e.match(Uv)?.[0];if(!t)return $();e.next(t.length);let n=t.replaceAll(`_`,``);return Q(parseInt(n,10))}const Gv=/[+-]?(?:0|[1-9][0-9]*(?:_[0-9]+)*)(?:\.[0-9]+(?:_[0-9]+)*)?(?:e[+-]?[0-9]+(?:_[0-9]+)*)?\b/iy;function Kv(e){e.skipWhitespaces();let t=e.match(Gv)?.[0];if(!t)return $();e.next(t.length);let n=t.replaceAll(`_`,``),r=parseFloat(n);return isNaN(r)?$():Q(r)}const qv=/(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})(?:[ 0-9TZ.:+-]+)?\b/y;function Jv(e){e.skipWhitespaces();let t=e.match(qv);if(!t)return $();let n=t[0];e.next(n.length);let r=t.groups;if(r.month==`02`){let e=parseInt(r.day);if(e>29)throw SyntaxError(`Invalid date string "${t}"`);let n=parseInt(r.year);if(e>28&&!ov(n))throw SyntaxError(`Invalid date string "${t}"`)}let i=new Date(n.trim());if(isNaN(i.getTime()))throw SyntaxError(`Invalid date string "${t}"`);return Q(i)}const Yv=/(\d{2}):(\d{2}):(\d{2})(?:\.[0-9]+)?\b/y;function Xv(e){e.skipWhitespaces();let t=e.match(Yv)?.[0];return t?(e.next(t.length),Q(t)):$()}function Zv(e){if(e.skipWhitespaces(),e.char()!==`[`)return $();e.next();let t=[];for(;!e.eof();){e.nextUntilChar();let n=$v(e);if(!n.ok||(t.push(n.body),e.skipWhitespaces(),e.char()!==`,`))break;e.next()}if(e.nextUntilChar(),e.char()!==`]`)throw SyntaxError(`Array is not closed`);return e.next(),Q(t)}function Qv(e){if(e.nextUntilChar(),e.char(1)===`}`)return e.next(2),Q({__proto__:null});let t=bv(`{`,hv(ey,`,`),`}`)(e);if(!t.ok)return $();let n={__proto__:null};for(let e of t.body)n=$_(n,e);return Q(n)}const $v=mv([Dv,Ov,Tv,Ev,Av,Nv,Fv,Jv,Xv,Rv,Bv,Hv,Kv,Wv,Zv,Qv]),ey=_v(Iv,`=`,$v);function ty(e){e.nextUntilChar();let t=vv(yv(ey))(e);return t.ok?Q({type:`Block`,value:t.body}):$()}const ny=bv(`[`,Iv,`]`);function ry(e){e.nextUntilChar();let t=ny(e);if(!t.ok)return $();e.nextUntilChar();let n=ty(e);return Q({type:`Table`,keys:t.body,value:n.ok?n.body.value:{__proto__:null}})}const iy=bv(`[[`,Iv,`]]`);function ay(e){e.nextUntilChar();let t=iy(e);if(!t.ok)return $();e.nextUntilChar();let n=ty(e);return Q({type:`TableArray`,keys:t.body,value:n.ok?n.body.value:{__proto__:null}})}function oy(e){let t=yv(mv([ty,ay,ry]))(e);return t.ok?Q(t.body.reduce(pv,{__proto__:null})):Q({__proto__:null})}function sy(e,t){let n=e.source.slice(0,e.position).split(`
|
|
15
|
+
`);return`Parse error on line ${n.length}, column ${n.at(-1)?.length??0}: ${t}`}function cy(e){return t=>{let n=new sv(t);try{let t=e(n);if(t.ok&&n.eof())return t.body;let r=`Unexpected character: "${n.char()}"`;throw SyntaxError(sy(n,r))}catch(e){throw e instanceof Error?SyntaxError(sy(n,e.message)):SyntaxError(sy(n,`Invalid error type caught`))}}}function ly(e){return cy(oy)(e)}const uy=Symbol.for(`@effect/platform/Error`),dy=Om(`Clipboard`,`Command`,`FileSystem`,`KeyValueStore`,`Path`,`Stream`,`Terminal`);var fy=class extends k_(`@effect/platform/Error/BadArgument`)(`BadArgument`,{module:dy,method:q,description:dh(q),cause:dh(V_)}){[uy]=uy;get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:``}`}};const py=Om(`AlreadyExists`,`BadResource`,`Busy`,`InvalidData`,`NotFound`,`PermissionDenied`,`TimedOut`,`UnexpectedEof`,`Unknown`,`WouldBlock`,`WriteZero`);var my=class extends k_(`@effect/platform/Error/SystemError`)(`SystemError`,{reason:py,module:dy,method:q,description:dh(q),syscall:dh(q),pathOrDescriptor:dh(Um(q,J)),cause:dh(V_)}){[uy]=uy;get message(){return`${this.reason}: ${this.module}.${this.method}${this.pathOrDescriptor===void 0?``:` (${this.pathOrDescriptor})`}${this.description?`: ${this.description}`:``}`}};const hy=Mt(`@effect/platform/FileSystem`),gy=e=>typeof e==`bigint`?e:BigInt(e),_y=BigInt(1024);_y*_y*_y*_y*_y;const vy=e=>hy.of({...e,exists:t=>C(e.access(t),Tr(!0),er(`SystemError`,e=>e.reason===`NotFound`?j(!1):Wn(e))),readFileString:(t,n)=>$n(e.readFile(t),{try:e=>new TextDecoder(n).decode(e),catch:e=>new fy({module:`FileSystem`,method:`readFileString`,description:`invalid encoding`,cause:e})}),stream:(t,n)=>C(e.open(t,{flag:`r`}),n?.offset?Yn(e=>e.seek(n.offset,`start`)):w,D(e=>yy(e,n)),Z_),sink:(t,n)=>C(e.open(t,{flag:`w`,...n}),D(e=>G_(t=>e.writeAll(t))),K_),writeFileString:(t,n,r)=>O(Br({try:()=>new TextEncoder().encode(n),catch:e=>new fy({module:`FileSystem`,method:`writeFileString`,description:`could not encode string`,cause:e})}),n=>e.writeFile(t,n,r))}),yy=(e,{bufferSize:t=16,bytesToRead:n,chunkSize:r=gy(64*1024)}={})=>{let i=n===void 0?void 0:gy(n),a=gy(r);function o(t){if(i!==void 0&&i<=t)return zf;let n=i!==void 0&&i-t<a?i-t:a;return Rf(e.readAlloc(n),y({onNone:()=>zf,onSome:e=>Rf(Bf(_e(e)),n=>o(t+BigInt(e.length)))}))}return J_(Y_(o(BigInt(0))),{capacity:t})},by=gy,xy=hy,Sy=vy,Cy=Symbol.for(`@effect/platform/FileSystem/File`),wy=Ac(),Ty=wi(`Create`),Ey=wi(`Update`),Dy=wi(`Remove`);var Oy=class extends qe(`@effect/platform/FileSystem/WatchBackend`)(){};const ky=Symbol.for(`@effect/platform/Path`),Ay=Mt(`@effect/platform/Path`);function jy(e,t){let n=``,r=0,i=-1,a=0,o;for(let s=0;s<=e.length;++s){if(s<e.length)o=e.charCodeAt(s);else if(o===47)break;else o=47;if(o===47){if(i!==s-1&&a!==1)if(i!==s-1&&a===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){let e=n.lastIndexOf(`/`);if(e!==n.length-1){e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}}else if(n.length===2||n.length===1){n=``,r=0,i=s,a=0;continue}}t&&(n.length>0?n+=`/..`:n=`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===46&&a!==-1?++a:a=-1}return n}function My(e,t){let n=t.dir||t.root,r=t.base||(t.name||``)+(t.ext||``);return n?n===t.root?n+r:n+e+r:r}function Ny(e){if(e.protocol!==`file:`)return Wn(new fy({module:`Path`,method:`fromFileUrl`,description:`URL must be of scheme file`}));if(e.hostname!==``)return Wn(new fy({module:`Path`,method:`fromFileUrl`,description:`Invalid file URL host`}));let t=e.pathname;for(let e=0;e<t.length;e++)if(t[e]===`%`){let n=t.codePointAt(e+2)|32;if(t[e+1]===`2`&&n===102)return Wn(new fy({module:`Path`,method:`fromFileUrl`,description:`must not include encoded / characters`}))}return j(decodeURIComponent(t))}const Py=function(){let e=``,t=!1,n;for(let r=arguments.length-1;r>=-1&&!t;r--){let i;if(r>=0)i=arguments[r];else{let e=globalThis.process;n===void 0&&`process`in globalThis&&typeof e==`object`&&e&&typeof e.cwd==`function`&&(n=e.cwd()),i=n}i.length!==0&&(e=i+`/`+e,t=i.charCodeAt(0)===47)}return e=jy(e,!t),t?e.length>0?`/`+e:`/`:e.length>0?e:`.`};function Fy(e){let t=new URL(`file://`),n=Py(e);return e.charCodeAt(e.length-1)===47&&n[n.length-1]!==`/`&&(n+=`/`),t.pathname=Vy(n),j(t)}const Iy=/%/g,Ly=/\\/g,Ry=/\n/g,zy=/\r/g,By=/\t/g;function Vy(e){return e.includes(`%`)&&(e=e.replace(Iy,`%25`)),e.includes(`\\`)&&(e=e.replace(Ly,`%5C`)),e.includes(`
|
|
16
|
+
`)&&(e=e.replace(Ry,`%0A`)),e.includes(`\r`)&&(e=e.replace(zy,`%0D`)),e.includes(` `)&&(e=e.replace(By,`%09`)),e}const Hy=Ay.of({[ky]:ky,resolve:Py,normalize(e){if(e.length===0)return`.`;let t=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47;return e=jy(e,!t),e.length===0&&!t&&(e=`.`),e.length>0&&n&&(e+=`/`),t?`/`+e:e},isAbsolute(e){return e.length>0&&e.charCodeAt(0)===47},join(){if(arguments.length===0)return`.`;let e;for(let t=0;t<arguments.length;++t){let n=arguments[t];n.length>0&&(e===void 0?e=n:e+=`/`+n)}return e===void 0?`.`:Hy.normalize(e)},relative(e,t){if(e===t||(e=Hy.resolve(e),t=Hy.resolve(t),e===t))return``;let n=1;for(;n<e.length&&e.charCodeAt(n)===47;++n);let r=e.length,i=r-n,a=1;for(;a<t.length&&t.charCodeAt(a)===47;++a);let o=t.length-a,s=i<o?i:o,c=-1,l=0;for(;l<=s;++l){if(l===s){if(o>s){if(t.charCodeAt(a+l)===47)return t.slice(a+l+1);if(l===0)return t.slice(a+l)}else i>s&&(e.charCodeAt(n+l)===47?c=l:l===0&&(c=0));break}let r=e.charCodeAt(n+l);if(r!==t.charCodeAt(a+l))break;r===47&&(c=l)}let u=``;for(l=n+c+1;l<=r;++l)(l===r||e.charCodeAt(l)===47)&&(u.length===0?u+=`..`:u+=`/..`);return u.length>0?u+t.slice(a+c):(a+=c,t.charCodeAt(a)===47&&++a,t.slice(a))},dirname(e){if(e.length===0)return`.`;let t=e.charCodeAt(0),n=t===47,r=-1,i=!0;for(let n=e.length-1;n>=1;--n)if(t=e.charCodeAt(n),t===47){if(!i){r=n;break}}else i=!1;return r===-1?n?`/`:`.`:n&&r===1?`//`:e.slice(0,r)},basename(e,t){let n=0,r=-1,i=!0,a;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;let o=t.length-1,s=-1;for(a=e.length-1;a>=0;--a){let c=e.charCodeAt(a);if(c===47){if(!i){n=a+1;break}}else s===-1&&(i=!1,s=a+1),o>=0&&(c===t.charCodeAt(o)?--o===-1&&(r=a):(o=-1,r=s))}return n===r?r=s:r===-1&&(r=e.length),e.slice(n,r)}else{for(a=e.length-1;a>=0;--a)if(e.charCodeAt(a)===47){if(!i){n=a+1;break}}else r===-1&&(i=!1,r=a+1);return r===-1?``:e.slice(n,r)}},extname(e){let t=-1,n=0,r=-1,i=!0,a=0;for(let o=e.length-1;o>=0;--o){let s=e.charCodeAt(o);if(s===47){if(!i){n=o+1;break}continue}r===-1&&(i=!1,r=o+1),s===46?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||r===-1||a===0||a===1&&t===r-1&&t===n+1?``:e.slice(t,r)},format:function(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return My(`/`,e)},parse(e){let t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;let n=e.charCodeAt(0),r=n===47,i;r?(t.root=`/`,i=1):i=0;let a=-1,o=0,s=-1,c=!0,l=e.length-1,u=0;for(;l>=i;--l){if(n=e.charCodeAt(l),n===47){if(!c){o=l+1;break}continue}s===-1&&(c=!1,s=l+1),n===46?a===-1?a=l:u!==1&&(u=1):a!==-1&&(u=-1)}return a===-1||s===-1||u===0||u===1&&a===s-1&&a===o+1?s!==-1&&(o===0&&r?t.base=t.name=e.slice(1,s):t.base=t.name=e.slice(o,s)):(o===0&&r?(t.name=e.slice(1,a),t.base=e.slice(1,s)):(t.name=e.slice(o,a),t.base=e.slice(o,s)),t.ext=e.slice(a,s)),o>0?t.dir=e.slice(0,o-1):r&&(t.dir=`/`),t},sep:`/`,fromFileUrl:Ny,toFileUrl:Fy,toNamespacedPath:w}),Uy=Nc(Ay,Hy),Wy=Ay,Gy=Uy,Ky=bh({key:q,value:Zm(q)}).pipe(Sh(`TomlConfig`)),qy=X(q,Cm(Ky),{strict:!0,decode:e=>mp({try:()=>ly(e),catch:e=>new ap(e,`TOML parse error`)}).pipe(_p(e=>Dp(Ky)(e))),encode:(e,t,n)=>pp(new lp(n,e,`TomlConfigFromText is decode-only`))}),Jy=`systemfsoftware.toml`,Yy=kp(Ky)({});var Xy=class extends qe(`TomlLoader`)(){};const Zy=jc(Xy,sn(function*(){let e=yield*Hr(kr()),t=yield*xy,n=yield*Wy;return Xy.of({load:Pn(`TomlLoader.load`)(function*(i){let a=Sr(yield*Gn(e),i);if(r(a))return a.value;let o=n.join(i,Jy);if(!(yield*t.exists(o)))return yield*Kr(e,e=>(ur(e,i,Yy),e)),Yy;let s=yield*t.readFileString(o).pipe(O(wm(qy)),Dr(e=>wn(`[toml-loader] malformed ${Jy} at ${o} — failing open, which voids EVERY key in the file, not just the malformed one`,e)),yr(()=>j(Yy)));return yield*Kr(e,e=>(ur(e,i,s),e)),s})})}));export{Um as C,Mc as D,jc as E,Pc as O,O_ as S,kp as T,Zm as _,xy as a,q as b,Oy as c,Ey as d,Sy as f,X_ as g,q_ as h,wy as i,Ty as l,my as m,Zy as n,Cy as o,fy as p,Gy as r,by as s,Xy as t,Dy as u,Om as v,Ih as w,gh as x,bh as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./Effect-92Od3962.js";var n=e({Effect:()=>t});export{n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=async e=>{let[t,n,r,i]=await Promise.all([import(`./runtime-KkPFPF3a.js`).then(e=>e.default),import(`./Cause-AGt2deue.js`).then(e=>e.t),import(`./Effect-92Od3962.js`).then(e=>e.t),import(`./Exit-SvLE99lR.js`).then(e=>e.t)]),a=e.pipe(r.exit),o=await t.runPromise(a);if(i.isFailure(o))throw n.squash(o.cause);return o.value};export{e as runSafe};
|