@shivaedev/create-app 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cli.js +275 -87
- package/dist/createApp.d.ts +1 -1
- package/dist/createApp.d.ts.map +1 -1
- package/dist/createApp.js +1 -1
- package/dist/createApp.js.map +1 -1
- package/dist/template.d.ts.map +1 -1
- package/dist/template.js +17 -3
- package/dist/template.js.map +1 -1
- package/package.json +6 -6
- package/src/cli.ts +2 -2
- package/src/createApp.ts +1 -1
- package/src/template.ts +21 -11
- package/template.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,101 +1,289 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
${s(
|
|
4
|
-
`+s(
|
|
5
|
-
${s(
|
|
6
|
-
${
|
|
2
|
+
var XB=Object.defineProperty;var Kn=(e,t)=>{for(var r in t)XB(e,r,{get:t[r],enumerable:!0})};import{fileURLToPath as KB}from"node:url";var ti={};Kn(ti,{defaultTeardown:()=>PP,errorExitCode:()=>Cl,errorReported:()=>Js,getErrorExitCode:()=>FP,getErrorReported:()=>RP,makeRunMain:()=>vE});var te=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let r=e;for(let n=0,o=t.length;n<o;n++)r=t[n](r);return r}}},Fx={pipe(){return te(this,arguments)}},vs=(function(){function e(){}return e.prototype=Fx,e})();var m=function(e,t){if(typeof e=="function")return function(){return e(arguments)?t.apply(this,arguments):r=>t(r,...arguments)};switch(e){case 0:case 1:throw new RangeError(`Invalid arity ${e}`);case 2:return function(r,n){return arguments.length>=2?t(r,n):function(o){return t(o,r)}};case 3:return function(r,n,o){return arguments.length>=3?t(r,n,o):function(s){return t(s,r,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let r=arguments;return function(n){return t(n,...r)}}}};var F=e=>e;var at=e=>()=>e,Ur=at(!0),nf=at(!1),Rx=at(null),nn=at(void 0),Lo=nn;function Jn(e,...t){return te(e,t)}function Sn(e){let t=new WeakMap;return r=>{let n=t.get(r);if(n!==void 0)return n;let o=e(r);return t.set(r,o),o}}function Ca(e){let t=new WeakMap;return r=>{let n=t.get(r);if(n!==void 0)return n;let o=e(r);return t.set(r,o),o!==r&&t.set(o,o),o}}var of=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete("stack");let r=Object.getPrototypeOf(e),n=r;for(;n!==null&&n!==Object.prototype;){let o=Reflect.ownKeys(n);for(let s=0;s<o.length;s++)t.add(o[s]);n=Object.getPrototypeOf(n)}return t.has("constructor")&&typeof e.constructor=="function"&&r===e.constructor.prototype&&t.delete("constructor"),t},ji=new WeakSet,sf=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);var Ta=0,Ew=()=>{Ta++};function En(e){return typeof e=="string"}function af(e){return typeof e=="number"}function ld(e){return typeof e=="boolean"}function bw(e){return typeof e=="bigint"}function $x(e){return typeof e=="symbol"}function pd(e){return En(e)||af(e)||$x(e)}function bn(e){return typeof e=="function"}function Os(e){return e===void 0}function pt(e){return e!==void 0}function cf(e){return e!==null}function Iw(e){return e==null}function dd(e){return e!=null}function Cw(e){return!1}function Nx(e){return!0}function Dr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function uf(e){return typeof e=="object"&&e!==null||bn(e)}var A=m(2,(e,t)=>uf(e)&&t in e),Lr=m(2,(e,t)=>A(e,"_tag")&&e._tag===t);function Tw(e){return e instanceof Error}function Zn(e){return A(e,Symbol.iterator)||En(e)}var Y="~effect/Hash",q=e=>{switch(typeof e){case"number":return dt(e);case"bigint":return Ae(e.toString(10));case"string":return Ae(e);case"function":case"object":{if(e===null)break;if(e instanceof Date)return Number.isNaN(e.getTime())?Ae("Invalid Date"):Ae(e.toISOString());if(e instanceof RegExp)return Ae(e.toString());{if(ji.has(e))return md(e);let t=kw.get(e);if(t!==void 0)return t;if(Dx.has(e))return Ew(),Ae("[Circular]");Dx.add(e);let r=Ta,n;try{Y in e?n=e[Y]():typeof e=="function"?n=md(e):e instanceof DataView?n=Qn(sf(e)):Array.isArray(e)||ArrayBuffer.isView(e)?n=Qn(e):e instanceof Map?n=tj(e):e instanceof Set?n=rj(e):n=lf(e)}finally{Dx.delete(e)}return r===Ta&&kw.set(e,n),n}}}return Lt(Aw(Ae(String(e))))},md=e=>(Ux.has(e)||Ux.set(e,Lt(Math.random()*4294967296|0)),Ux.get(e)),Aw=e=>(e^=e>>>16,e=Math.imul(e,2246822507),e^=e>>>13,e=Math.imul(e,3266489909),e^e>>>16),ae=m(2,(e,t)=>Aw(Math.imul(e,2654435761)+Math.imul(t,2246822507))),Lt=e=>e&3221225471|e>>>1&1073741824;var Mx=new DataView(new ArrayBuffer(8)),dt=e=>{let t=e|0;return t===e?Lt(t):(Mx.setFloat64(0,e!==e?NaN:e),Lt(ae(Mx.getInt32(0),Mx.getInt32(4))))},Ae=e=>{let t=5381,r=e.length;for(;r;)t=t*33^e.charCodeAt(--r);return Lt(t)},ff=(e,t)=>{let r=12289;for(let n of t)r^=ae(q(n),q(e[n]));return Lt(r)},lf=e=>ff(e,of(e)),vw=(e,t)=>r=>{let n=e;for(let o of r)n^=t(o);return Lt(n)},Qn=e=>{let t=6151;for(let r of e)t=ae(t,q(r));return Lt(t)},tj=vw(Ae("Map"),([e,t])=>ae(q(e),q(t))),ww=Ae("Set"),rj=vw(ww,e=>ae(ww,q(e))),Ux=new WeakMap,kw=new WeakMap,Dx=new WeakSet;var X="~effect/Equal";function W(){return arguments.length===1?e=>wa(e,arguments[0]):wa(arguments[0],arguments[1])}function wa(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let r=typeof e;return r!==typeof t?!1:r==="number"&&e!==e&&t!==t?!0:r!=="object"&&r!=="function"||ji.has(e)||ji.has(t)?!1:nj(e,t)}function nj(e,t){let r=hd.length;for(let s=r;s-- >0;)if(hd[s]===e&&Lx[s]===t)return!0;if(r)return Ow(e,t);let n=_w.get(e);n||_w.set(e,n=new WeakMap);let o=n.get(t);return o===void 0&&n.set(t,o=Ow(e,t)),o}function Ow(e,t){hd.push(e),Lx.push(t);try{return oj(e,t)}finally{hd.pop(),Lx.pop()}}var hd=[],Lx=[],_w=new WeakMap;function oj(e,t){if(q(e)!==q(t))return!1;if(e instanceof Date){if(!(t instanceof Date))return!1;let n=e.getTime(),o=t.getTime();return n===o||Number.isNaN(n)&&Number.isNaN(o)}else if(e instanceof RegExp)return t instanceof RegExp&&e.toString()===t.toString();let r=Fw(e);if(r!==Fw(t)||typeof e=="function"&&!r)return!1;if(r)return e[X](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:sj(e,t);if(ArrayBuffer.isView(e)){let n=e instanceof DataView;return!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||n!==t instanceof DataView?!1:n?Pw(sf(e),sf(t)):Pw(e,t)}else{if(e instanceof Map)return!(t instanceof Map)||e.size!==t.size?!1:Bx(e,t,ij,cj);if(e instanceof Set)return!(t instanceof Set)||e.size!==t.size?!1:Bx(e,t,q,wa)}return aj(e,t)}function sj(e,t){for(let r=0;r<e.length;r++)if(!wa(e[r],t[r]))return!1;return!0}function Pw(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function aj(e,t){let r=of(e),n=of(t);if(r.size!==n.size)return!1;for(let o of r)if(!n.has(o)||!wa(e[o],t[o]))return!1;return!0}function Bx(e,t,r,n){let o=new Map,s=0;for(let a of t){let i=r(a),c=o.get(i);c?c.push(a):o.set(i,[a]),s++}e:for(let a of e){let i=o.get(r(a));if(i){for(let c=0;c<i.length;c++)if(n(a,i[c])){i[c]=i[i.length-1],i.pop(),s--;continue e}}return!1}return s===0}var ij=e=>q(e[0]),cj=(e,t)=>wa(e[0],t[0])&&wa(e[1],t[1]),uj=()=>0;function gd(e,t){return pf((r,n)=>e(r[0],n[0])&&t(r[1],n[1]))}function pf(e){return function(r,n){return Bx(r,n,uj,e)}}var Fw=e=>A(e,X);var Rw=e=>(ji.add(e),e);var ka=Symbol.for("~effect/Redactable"),fj=e=>A(e,ka);function Bo(e){return fj(e)?jx(e):e}function jx(e){return e[ka](globalThis[zi]?.context??lj)}var zi="~effect/Fiber/currentFiber",$w=new Map,lj={"~effect/Context":{},base:$w,depth:0,mapUnsafe:$w,pipe(){return te(this,arguments)}};function N(e,t){let r=t?.space??0,n=new WeakSet,o=r?typeof r=="number"?" ".repeat(r):r:"",s=u=>o.repeat(u),a=(u,l)=>{let p=u?.constructor;return p&&p!==Object.prototype.constructor&&p.name?`${p.name}(${l})`:l},i=u=>{try{return Reflect.ownKeys(u)}catch{return["[ownKeys threw]"]}};function c(u,l=0){try{return f(u,l)}catch{return(typeof u=="object"&&u!==null||typeof u=="function")&&n.delete(u),"[inspection threw]"}}function f(u,l=0){if(typeof u=="string")return JSON.stringify(u);if(typeof u=="number"||u==null||typeof u=="boolean"||typeof u=="symbol")return String(u);if(typeof u=="bigint")return String(u)+"n";if(typeof u=="object"||typeof u=="function"){if(n.has(u))return pj;n.add(u);let p;if(ka in u)p=c(jx(u),l);else if(Array.isArray(u))p=!o||u.length<=1?`[${u.map(h=>c(h,l)).join(",")}]`:`[
|
|
3
|
+
${s(l+1)}${u.map(h=>c(h,l+1)).join(`,
|
|
4
|
+
`+s(l+1))}
|
|
5
|
+
${s(l)}]`;else if(u instanceof Date)p=zx(u);else if(!t?.ignoreToString&&A(u,"toString")&&typeof u.toString=="function"&&u.toString!==Object.prototype.toString&&u.toString!==Array.prototype.toString){let h=dj(u);p=u instanceof Error&&u.cause!==void 0?`${h} (cause: ${c(u.cause,l)})`:h}else if(Symbol.iterator in u)p=`${u.constructor.name}(${c(Array.from(u),l)})`;else{let h=i(u);if(!o||h.length<=1){let g=`{${h.map(x=>`${Yn(x)}:${c(Mw(u,x),l)}`).join(",")}}`;p=a(u,g)}else{let g=`{
|
|
6
|
+
${h.map(x=>`${s(l+1)}${Yn(x)}: ${c(Mw(u,x),l+1)}`).join(`,
|
|
7
7
|
`)}
|
|
8
|
-
${s(f)}}`;l=a(u,m)}}return r.delete(u),l}return String(u)}return c(e,0)}var AU="[Circular]";function go(e){return typeof e=="string"?JSON.stringify(e):String(e)}function pd(e){return e.map(t=>`[${go(t)}]`).join("")}function Sg(e){try{return e.toISOString()}catch{return"Invalid Date"}}function _U(e){try{let t=e.toString();return typeof t=="string"?t:String(t)}catch{return"[toString threw]"}}function oa(e,t){let n=[];return JSON.stringify(e,function(r,o){let s=Object.getOwnPropertyDescriptor(this,r)?.value,a=_(s,du)?Ei(s):Ei(o);if(typeof a=="bigint")return D(a);if(typeof a!="object"||a===null)return a;for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(!n.includes(a))return n.push(a),a},t?.space)??"null"}var dt=Symbol.for("nodejs.util.inspect.custom"),Ct=e=>{try{return e=Ei(e),_(e,"toJSON")&&_n(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(Ct):e}catch{return"[toJSON threw]"}},mv=(e,t=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?oa(e,{space:t}):D(e,{space:t})}catch{return String(e)}},hv={toJSON(){return Ct(this)},[dt](){return this.toJSON()},toString(){return D(this.toJSON())}},pv=class{[dt](){return this.toJSON()}toString(){return D(this.toJSON())}};var fs=class e{called=!1;self;constructor(t){this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new e(this.self)}},RU=()=>{let e="~effect/Utils/internal",t={[e]:o=>o()},n={[e]:o=>o()};return t[e](()=>new Error().stack)?.includes(e)===!0?t[e]:n[e]},ye=RU();function M(e,t,n){t==="__proto__"?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function md(e,t){for(let n of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,n)&&M(e,n,t[n])}var Hr="~effect/Effect",sa="~effect/Exit",MU={_A:F,_E:F,_R:F},xv=`${Hr}/identifier`,Q=`${Hr}/args`,at=`${Hr}/evaluate`,Zt=`${Hr}/successCont`,Kn=`${Hr}/failureCont`,ls=`${Hr}/ensureCont`,ia=Symbol.for("effect/Effect/Yield"),Yt={pipe(){return ne(this,arguments)},toJSON(){return{...this}},toString(){return D(this.toJSON(),{ignoreToString:!0,space:2})},[dt](){return this.toJSON()}},yv={[me](){return dg(this,Object.keys(this))},[he](e){let t=Object.keys(this),n=Object.keys(e);if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==n[r]||!K(this[t[r]],e[t[r]]))return!1;return!0}},NU={[Hr]:MU,...Yt,[Symbol.iterator](){return new fs(this)},toJSON(){return{_id:"Effect",op:this[xv],...Q in this?{args:this[Q]}:void 0}}},ee=e=>_(e,Hr),bg=e=>_(e,sa),pu="~effect/Cause",mu="~effect/Cause/Reason",vi=e=>_(e,pu),Sv=e=>_(e,mu),zr=class{[pu];reasons;constructor(t){this[pu]=pu,this.reasons=t}pipe(){return ne(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map(t=>t.toJSON())}}toString(){return`Cause(${D(this.reasons)})`}[dt](){return this.toJSON()}[he](t){return vi(t)&&this.reasons.length===t.reasons.length&&this.reasons.every((n,r)=>K(n,t.reasons[r]))}[me](){return Si(this.reasons)}},gv=new WeakMap,wi=class{[mu];annotations;_tag;constructor(t,n,r){if(this[mu]=mu,this._tag=t,n!==gu&&typeof r=="object"&&r!==null&&n.size>0){let o=gv.get(r);o&&(n=new Map([...o,...n])),gv.set(r,n)}this.annotations=n}annotate(t,n){if(t.mapUnsafe.size===0)return this;let r=new Map(this.annotations);t.mapUnsafe.forEach((s,a)=>{n?.overwrite!==!0&&r.has(a)||r.set(a,s)});let o=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return o.annotations=r,o}pipe(){return ne(this,arguments)}toString(){return D(this)}[dt](){return this.toString()}},gu=new Map,aa=class extends wi{error;constructor(t,n=gu){super("Fail",n,t),this.error=t}toString(){return`Fail(${D(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[he](t){return ca(t)&&K(this.error,t.error)&&K(this.annotations,t.annotations)}[me](){return st(Fe(this._tag))(st(Z(this.error))(Z(this.annotations)))}},xo=e=>new zr(e),gd=new zr([]),xu=e=>new zr([new aa(e)]),hu=class extends wi{defect;constructor(t,n=gu){super("Die",n,t),this.defect=t}toString(){return`Die(${D(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[he](t){return Su(t)&&K(this.defect,t.defect)&&K(this.annotations,t.annotations)}[me](){return st(Fe(this._tag))(st(Z(this.defect))(Z(this.annotations)))}},Ev=e=>new zr([new hu(e)]),yu=p(e=>vi(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new zr(e.reasons.map(r=>r.annotate(t,n)))),ca=e=>e._tag==="Fail",Su=e=>e._tag==="Die",Eu=e=>e._tag==="Interrupt";function DU(e){return Gr("Effect.evaluate: Not implemented")}var yo=e=>({...NU,[xv]:e.op,[at]:e[at]??DU,[Zt]:e[Zt],[Kn]:e[Kn],[ls]:e[ls]}),Vn=e=>{let t=yo(e);return function(){let n=Object.create(t);return n[Q]=e.single===!1?arguments:arguments[0],n}},bv=e=>{let t={[sa]:sa,_tag:e.op,get[e.prop](){return this[Q]},...yo(e),toString(){return`${e.op}(${D(this[Q])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[Q]}},[he](n){return bg(n)&&n._tag===this._tag&&K(this[Q],n[Q])},[me](){return st(Fe(e.op),Z(this[Q]))}};return function(n){let r=Object.create(t);return r[Q]=n,r}},Me=bv({op:"Success",prop:"value",[at](e){let t=e.getCont(Zt);return t?t[Zt](this[Q],e,this):e.yieldWith(this)}}),xd={key:"effect/Cause/StackTrace"},wg={key:"effect/Cause/InterruptorStackTrace"},Bt=bv({op:"Failure",prop:"cause",[at](e){let t=this[Q],n=!1;e.currentStackFrame&&(t=yu(t,{mapUnsafe:new Map([[xd.key,e.currentStackFrame]])}),n=!0);let r=e.getCont(Kn);for(;e.interruptible&&e._interruptedCause&&r;)r=e.getCont(Kn);return r?r[Kn](t,e,n?void 0:this):e.yieldWith(n?Bt(t):this)}}),Jn=e=>Bt(xu(e)),Gr=e=>Bt(Ev(e)),te=Vn({op:"WithFiber",[at](e){return this[Q](e)}}),$U=(function(){class e extends globalThis.Error{}let t=yo({op:"YieldableError",[at](){return Jn(this)}});return delete t.toString,Object.assign(e.prototype,t),e})(),bu=(function(){let e=Symbol.for("effect/Data/Error/plainArgs");return class extends $U{constructor(n){super(n?.message,n?.cause?{cause:n.cause}:void 0),n&&(md(this,n),Object.defineProperty(this,e,{value:n,enumerable:!1}))}toJSON(){return{...this[e],...this}}}})(),So=e=>{class t extends bu{_tag=e}return t.prototype.name=e,t},hd="~effect/Cause/NoSuchElementError",Ig=e=>_(e,hd),Wr=class extends So("NoSuchElementError"){[hd]=hd;constructor(t){super({message:t})}},Ii="~effect/Cause/Done",wu=e=>_(e,Ii),wv={[Ii]:Ii,_tag:"Done",value:void 0},Ci=e=>e===void 0?wv:{[Ii]:Ii,_tag:"Done",value:e},UU=Jn(wv),Iv=e=>e===void 0?UU:Jn(Ci(e));var Kr=e=>yo({op:e.label,[at]:e.evaluate});function vv(e){return{combine:e}}function Eo(e,t,n){return{combine:e,initialValue:t,combineAll:n??(r=>{let o=t;for(let s of r)o=e(o,s);return o})}}var Tt=e=>(t,n)=>t===n||e(t,n),LU=(e,t)=>e===t,Tv=()=>LU;function kv(e){return Tt((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0})}var Ov=e=>p(3,(t,n,r)=>e(t,o=>({...o,[n]:r(o)}))),Av=e=>p(2,(t,n)=>e(t,r=>({[n]:r}))),_v=(e,t)=>p(3,(n,r,o)=>t(n,s=>e(o(s),a=>({...s,[r]:a}))));var Pv="~effect/data/Option",Rv={[Pv]:{_A:e=>e},...Yt,[Symbol.iterator](){return new fs(this)}},BU=Object.defineProperty(Object.assign(Object.create(Rv),{_tag:"Some",_op:"Some",[he](e){return yd(e)&&Cg(e)&&K(this.value,e.value)},[me](){return st(Z(this._tag))(Z(this.value))},toString(){return`some(${D(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:Ct(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),qU=Z("None"),zU=Object.assign(Object.create(Rv),{_tag:"None",_op:"None",valueOrUndefined:void 0,[he](e){return yd(e)&&vg(e)},[me](){return qU},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}}}),yd=e=>_(e,Pv),vg=e=>e._tag==="None",Cg=e=>e._tag==="Some",Fv=Object.create(zU),Mv=e=>{let t=Object.create(BU);return t.value=e,t};var Nv="~effect/data/Result",Dv={[Nv]:{_A:e=>e,_E:e=>e},...Yt,[Symbol.iterator](){return new fs(this)}},HU=Object.assign(Object.create(Dv),{_tag:"Success",_op:"Success",[he](e){return Sd(e)&&kg(e)&&K(this.success,e.success)},[me](){return st(Z(this._tag))(Z(this.success))},toString(){return`success(${D(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:Ct(this.success)}}}),GU=Object.assign(Object.create(Dv),{_tag:"Failure",_op:"Failure",[he](e){return Sd(e)&&Tg(e)&&K(this.failure,e.failure)},[me](){return st(Z(this._tag))(Z(this.failure))},toString(){return`failure(${D(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:Ct(this.failure)}}}),Sd=e=>_(e,Nv),Tg=e=>e._tag==="Failure",kg=e=>e._tag==="Success",$v=e=>{let t=Object.create(GU);return t.failure=e,t},Uv=e=>{let t=Object.create(HU);return t.success=e,t};function ua(e){return(t,n)=>t===n?0:e(t,n)}var Pn=ua((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1);var Zn=ua((e,t)=>e<t?-1:1);var Og=p(2,(e,t)=>ua((n,r)=>e(t(n),t(r)))),fa=Og(Pn,e=>e.getTime());var ki=e=>p(2,(t,n)=>e(t,n)===-1),ds=e=>p(2,(t,n)=>e(t,n)===1),vu=e=>p(2,(t,n)=>e(t,n)!==1),Cu=e=>p(2,(t,n)=>e(t,n)!==-1);var O=()=>Fv,R=Mv,Ed=yd,Ne=vg,we=Cg,We=p(2,(e,{onNone:t,onSome:n})=>Ne(e)?t():n(e.value));var it=p(2,(e,t)=>Ne(e)?t():e.value);var Yn=e=>e==null?O():R(e),ps=e=>e===void 0?O():R(e),Lv=e=>e===null?O():R(e);var Ag=it(ag),Qt=it(Br),la=e=>(...t)=>{try{return R(e(...t))}catch{return O()}};var ms=p(2,(e,t)=>Ne(e)?O():R(t(e.value)));var _g=p(2,(e,t)=>Ne(e)?O():t(e.value));var Ai=_g(F);var _i=p(2,(e,t)=>Ne(e)?O():t(e.value)?R(e.value):O()),jv=e=>Tt((t,n)=>Ne(t)?Ne(n):Ne(n)?!1:e(t.value,n.value));var Bv=p(2,(e,t)=>t(e)?R(e):O());var qv=p(2,(e,t)=>Ne(e)?!1:t(e.value));var zv="~effect/Context/Service",He=function(){function e(){}let t=e;Object.setPrototypeOf(t,VU);let n=(r,o)=>(t.key=r,o?.defaultValue&&(t[Rg]=Rg,t.defaultValue=o.defaultValue),o?.make&&(t.make=o.make),o?.fiberCached&&Wv.add(r),t);return arguments.length>0?n(arguments[0],arguments[1]):n},VU={[zv]:zv,...Kr({label:"Service",evaluate(e){return Me(Xt(e.context,this))}}),toJSON(){return{_id:"Service",key:this.key}},of(e){return e},context(e){return wo(this,e)},use(e){return te(t=>e(Xt(t.context,this)))},useSync(e){return te(t=>Me(e(Xt(t.context,this))))}},Wv=new Set,Rg="~effect/Context/Reference",Hv="~effect/Context",JU=8,ZU=8,Fg=(e,t,n,r)=>{let o=Object.create(QU);return o.cacheRoot=e??o,o.base=t,o.overlay=n,o.depth=r,o._flat=void 0,o.baseHits=0,o},Gv=(e,t)=>{t&&(Gv(e,t.parent),e.set(t.key,t.value))},Kv=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return Gv(t,e.overlay),e._flat=t},YU=(e,t)=>{let n=new Map(e.mapUnsafe);return t(n),Pi(n)},bd=Symbol(),Mg=(e,t)=>{let n=e;for(let o=n.overlay;o;o=o.parent)if(o.key===t)return o.value;let r=n.base.get(t);return r===void 0&&!n.base.has(t)?bd:(n.overlay&&++n.baseHits>=ZU&&(n.base=Kv(n),n.overlay=void 0,n.depth=0),r)},Pi=e=>Fg(void 0,e,void 0,0),QU={get mapUnsafe(){return Kv(this)},...Yt,[Hv]:{_Services:e=>e},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[he](e){if(!Ng(e))return!1;let t=this.mapUnsafe,n=e.mapUnsafe;if(t.size!==n.size)return!1;for(let[r,o]of t)if(!n.has(r)||!K(o,n.get(r)))return!1;return!0},[me](){return mn(this.mapUnsafe.size)}},Vv=(e,t)=>e.cacheRoot===t.cacheRoot,Ng=e=>_(e,Hv);var Jv=e=>!!e[Rg],qt=()=>XU,XU=Pi(new Map),wo=(e,t)=>Pi(new Map([[e.key,t]])),Nt=p(3,(e,t,n)=>e2(e,t.key,n)),e2=(e,t,n)=>{let r=e,o=Wv.has(t)?void 0:r.cacheRoot;if(r.depth>=JU){let s=new Map(r.mapUnsafe);return s.set(t,n),Fg(o,s,void 0,0)}return Fg(o,r.base,{key:t,value:n,parent:r.overlay},r.depth+1)};var wd=p(2,(e,t)=>Tu(e,t.key)),Tu=(e,t)=>{let n=Mg(e,t);return n===bd?void 0:n},xr=p(2,(e,t)=>{let n=Mg(e,t.key);if(n===bd){if(Jv(t))return Zv(t);throw t2(t)}return n}),Xt=xr,Pg="~effect/Context/defaultValue",Zv=e=>Pg in e?e[Pg]:e[Pg]=e.defaultValue(),t2=e=>{let t=new Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(t.stack){let n=t.stack.split(`
|
|
9
|
-
`);
|
|
10
|
-
`)}return t},Dg=p(2,(e,t)=>{let n=Mg(e,t.key);return n!==bd?R(n):Jv(t)?R(Zv(t)):O()}),da=p(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:YU(e,n=>t.mapUnsafe.forEach((r,o)=>n.set(o,r)))),Yv=(...e)=>{let t=new Map;for(let n=0;n<e.length;n++)e[n].mapUnsafe.forEach((r,o)=>{t.set(o,r)});return Pi(t)};var pe=He;var $g=e=>e.length>0;var se=Uv,ce=$v;var Qv=e=>{if(_n(e))try{return se(e())}catch(t){return ce(t)}else try{return se(e.try())}catch(t){return ce(e.catch(t))}};var Xv=Sd,Ce=Tg,en=kg;var e0=(e,t)=>Tt((n,r)=>Ce(n)?Ce(r)&&t(n.failure,r.failure):en(r)&&e(n.success,r.success));var Id=p(2,(e,t)=>Ce(e)?ce(t(e.failure)):e),pa=p(2,(e,t)=>en(e)?se(t(e.success)):e),Qn=p(2,(e,{onFailure:t,onSuccess:n})=>Ce(e)?t(e.failure):n(e.success));var ku=p(2,(e,t)=>Ce(e)?t(e.failure):e.success);var vd=p(2,(e,t)=>Ce(e)?ce(e.failure):t(e.success));var t0=p(2,(e,t)=>{let n=0;for(let r of e){let o=t(r,n);if(ad(o)){if(o)return R(r)}else if(we(o))return o;n++}return O()});var n0=p(2,(e,t)=>({[Symbol.iterator](){let n=e[Symbol.iterator](),r=0;return{next(){let o=n.next();for(;!o.done;){if(t(o.value,r++))return{done:!1,value:o.value};o=n.next()}return{done:!0,value:void 0}}}}}));var r0=p(2,(e,t)=>{let n={...e};for(let r of r2(e))M(n,r,t(e[r],r));return n});var r2=e=>Object.keys(e);var Cd=globalThis.Array;var St=e=>Cd.isArray(e)?e:Cd.from(e),s0=e=>Cd.isArray(e)?e:[e];var Ou=p(2,(e,{onEmpty:t,onNonEmpty:n})=>gn(e)?n(e):t());var Lg=p(2,(e,t)=>[...e,t]),a0=p(2,(e,t)=>St(e).concat(St(t)));var o2=Cd.isArray;var ma=$g,gn=$g;var i0=p(2,(e,t)=>{let n=0,r=[];for(let o of e){if(!t(o,n))break;r.push(o),n++}return r});var Td=p(2,(e,t)=>{let n=0;for(let r of e){if(t(r,n))return R(n);n++}return O()});var jg=t0;var Bg=p(2,(e,t)=>{let n=St(e);for(let r=n.length-1;r>=0;r--){let o=n[r],s=t(o,r);if(typeof s=="boolean"){if(s)return R(o)}else if(we(s))return s}return O()});var s2=(e,t)=>{let n=Z(t),r=e.get(n);if(r===void 0)return e.set(n,[t]),!0;for(let o of r)if(K(o,t))return!1;return r.push(t),!0};var qg=p(2,(e,t)=>{let n=St(e),r=St(t);return gn(n)?gn(r)?kd(a0(n,r)):n:r});var ha=()=>[],ga=e=>[e],Et=p(2,(e,t)=>e.map(t));var zg=e=>{let t=[];for(let n of e)we(n)&&t.push(n.value);return t};var Wg=p(2,(e,t)=>{let n=[],r=[],o=0;for(let s of e){let a=t(s,o++);en(a)?r.push(a.success):n.push(a.failure)}return[n,r]});var Au=p(3,(e,t,n)=>St(e).reduce((r,o,s)=>n(r,o,s),t));var kd=e=>{let t=St(e);if(t.length<2)return[...t];let n=new Map,r=[];for(let o of t)s2(n,o)&&r.push(o);return r};var a2=Eo((e,t)=>e.concat(t),[]);function c0(){return a2}var Od="~effect/time/Duration",d0=BigInt(0),p0=BigInt(1),i2=BigInt(2),c2=BigInt(10);var u2=BigInt(1e3);var Ad=e=>BigInt(e<0?Math.ceil(e-.5):Math.floor(e+.5)),m0=e=>Ad(e*1e6),u0=(e,t)=>{let n=e.indexOf(".");if(n===-1)return BigInt(e)*t;let r=e[0]==="-",o=e.slice(n+1),s=c2**BigInt(o.length),a=(BigInt(e.slice(r?1:0,n))*s+BigInt(o))*t,i=a/s+(a%s*i2>=s?p0:d0);return r?-i:i};var f2=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,Rn=e=>{switch(typeof e){case"number":return hs(e);case"bigint":return Xn(e);case"string":{if(e==="Infinity")return Io;if(e==="-Infinity")return xa;let t=f2.exec(e);if(!t)break;let[n,r,o]=t;if(o==="nano"||o==="nanos")return Xn(u0(r,p0));if(o==="micro"||o==="micros")return Xn(u0(r,u2));let s=Number(r);switch(o){case"milli":case"millis":return hs(s);case"second":case"seconds":return m2(s);case"minute":case"minutes":return h2(s);case"hour":case"hours":return g2(s);case"day":case"days":return x2(s);case"week":case"weeks":return y2(s)}break}case"object":{if(e===null)break;if(Od in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(uu)?f0(e):Number.isNaN(e[0])||Number.isNaN(e[1])?Ri:e[0]===-1/0||e[1]===-1/0?xa:e[0]===1/0||e[1]===1/0?Io:nn(Ad(e[0]*1e9+e[1]));let t=e,n=0;return t.weeks&&(n+=t.weeks*6048e5),t.days&&(n+=t.days*864e5),t.hours&&(n+=t.hours*36e5),t.minutes&&(n+=t.minutes*6e4),t.seconds&&(n+=t.seconds*1e3),t.milliseconds&&(n+=t.milliseconds),!t.microseconds&&!t.nanoseconds?nn(n):nn(Ad(n*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0)))}}return f0(e)},f0=e=>{throw new Error(`Invalid Input: ${e}`)},h0=la(Rn),l0={_tag:"Millis",millis:0},l2={_tag:"Infinity"},d2={_tag:"NegativeInfinity"},p2={[Od]:Od,[me](){switch(this.value._tag){case"Millis":{let e=this.value.millis*1e6;return Number.isFinite(e)?Z(Ad(e)):mn(this.value.millis)}case"Nanos":return Z(this.value.nanos);default:return pg(this.value)}},[he](e){return Gg(e)&&E2(this,e)},toString(){switch(this.value._tag){case"Infinity":return"Infinity";case"NegativeInfinity":return"-Infinity";case"Nanos":return`${this.value.nanos} nanos`;case"Millis":return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case"Millis":return{_id:"Duration",_tag:"Millis",millis:this.value.millis};case"Nanos":return{_id:"Duration",_tag:"Nanos",nanos:String(this.value.nanos)};case"Infinity":return{_id:"Duration",_tag:"Infinity"};case"NegativeInfinity":return{_id:"Duration",_tag:"NegativeInfinity"}}},[dt](){return this.toJSON()},pipe(){return ne(this,arguments)}},nn=e=>{let t=Object.create(p2);return typeof e=="number"?isNaN(e)||e===0||Object.is(e,-0)?t.value=l0:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:"Millis",millis:e}:t.value={_tag:"Nanos",nanos:m0(e)}:t.value=e>0?l2:d2:e===d0?t.value=l0:t.value={_tag:"Nanos",nanos:e},t},Gg=e=>_(e,Od),g0=e=>e.value._tag!=="Infinity"&&e.value._tag!=="NegativeInfinity";var Ri=nn(0),Io=nn(1/0),xa=nn(-1/0),Xn=e=>nn(e);var hs=e=>nn(e),m2=e=>nn(e*1e3),h2=e=>nn(e*6e4),g2=e=>nn(e*36e5),x2=e=>nn(e*864e5),y2=e=>nn(e*6048e5),Fi=e=>S2(Rn(e),{onMillis:F,onNanos:t=>Number(t)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0});var Hg=e=>{let t=Rn(e);switch(t.value._tag){case"Infinity":case"NegativeInfinity":throw new Error("Cannot convert infinite duration to nanos");case"Nanos":return t.value.nanos;case"Millis":return m0(t.value.millis)}},x0=la(Hg);var S2=p(2,(e,t)=>{switch(e.value._tag){case"Millis":return t.onMillis(e.value.millis);case"Nanos":return t.onNanos(e.value.nanos);case"Infinity":return t.onInfinity();case"NegativeInfinity":return(t.onNegativeInfinity??t.onInfinity)()}}),y0=p(3,(e,t,n)=>e.value._tag==="Infinity"||e.value._tag==="NegativeInfinity"||t.value._tag==="Infinity"||t.value._tag==="NegativeInfinity"?n.onInfinity(e,t):e.value._tag==="Millis"?t.value._tag==="Millis"?n.onMillis(e.value.millis,t.value.millis):n.onNanos(Hg(e),t.value.nanos):n.onNanos(e.value.nanos,Hg(t)));var Kg=(e,t)=>y0(e,t,{onMillis:(n,r)=>n===r,onNanos:(n,r)=>n===r,onInfinity:(n,r)=>n.value._tag===r.value._tag});var S0=p(2,(e,t)=>y0(e,t,{onMillis:(n,r)=>nn(n-r),onNanos:(n,r)=>nn(n-r),onInfinity:(n,r)=>{let o=n.value._tag,s=r.value._tag;return o==="Infinity"?s==="Infinity"?Ri:Io:o==="NegativeInfinity"?s==="NegativeInfinity"?Ri:xa:s==="Infinity"?xa:Io}}));var E2=p(2,(e,t)=>Kg(e,t));var _u=pe("effect/Scheduler",{fiberCached:!0,defaultValue:()=>new ya}),E0="setImmediate"in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},b2=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},Vg=class{buckets=[];scheduleTask(t,n){let r=this.buckets,o=r.length,s,a=0;for(;a<o&&!(r[a][0]>n);a++)s=r[a];s&&s[0]===n?s[1].push(t):a===o?r.push([n,[t]]):r.splice(a,0,[n,[t]])}drain(){let t=this.buckets;return this.buckets=[],t}},ya=class{executionMode;setImmediate;constructor(t="async",n){this.executionMode=t,this.setImmediate=n??(t==="sync"?b2:E0)}shouldYield(t){return t.currentOpCount>=t.maxOpsBeforeYield}makeDispatcher(){return new Jg(this.setImmediate)}},Jg=class{tasks=new Vg;running=void 0;setImmediate;constructor(t=E0){this.setImmediate=t}scheduleTask(t,n){this.tasks.scheduleTask(t,n),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let t=this.tasks.drain();for(let n=0;n<t.length;n++){let r=t[n][1];for(let o=0;o<r.length;o++)r[o]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},b0=pe("effect/Scheduler/MaxOpsBeforeYield",{fiberCached:!0,defaultValue:()=>2048}),w0=pe("effect/Scheduler/PreventSchedulerYield",{fiberCached:!0,defaultValue:()=>!1});var ys={};jr(ys,{Class:()=>_d,Error:()=>Qg,TaggedClass:()=>w2,TaggedError:()=>xs,taggedEnum:()=>Yg});var _d=class extends ta{constructor(e){super(),e&&md(this,e)}},w2=e=>class extends _d{_tag=e},Yg=()=>new Proxy({},{get(e,t,n){return t==="$is"?Gn:t==="$match"?I2:r=>({...r,_tag:t})}});function I2(){if(arguments.length===1){let n=arguments[0];return function(r){return n[r._tag](r)}}let e=arguments[0];return arguments[1][e._tag](e)}var Qg=bu,xs=So;var I0="~effect/encoding/EncodingError",Co=class extends xs("EncodingError"){[I0]=I0};var Rd=e=>Xg(typeof e=="string"?rx.encode(e):e),Ni=e=>{let t=F0(e),n=t.length;if(n%4!==0)return ce(new Co({kind:"Decode",module:"Base64",input:t,message:`Length must be a multiple of 4, but is ${n}`}));let r=t.indexOf("=");if(r!==-1&&(r<n-2||r===n-2&&t[n-1]!=="="))return ce(new Co({kind:"Decode",module:"Base64",input:t,message:"Found a '=' character, but it is not at the end"}));try{let o=t.endsWith("==")?2:t.endsWith("=")?1:0,s=new Uint8Array(3*(n/4)-o);for(let a=0,i=0;a<n;a+=4,i+=3){let c=Pd(t.charCodeAt(a))<<18|Pd(t.charCodeAt(a+1))<<12|Pd(t.charCodeAt(a+2))<<6|Pd(t.charCodeAt(a+3));s[i]=c>>16,s[i+1]=c>>8&255,s[i+2]=c&255}return se(s)}catch(o){return ce(new Co({kind:"Decode",module:"Base64",input:t,message:o instanceof Error?o.message:"Invalid input"}))}},O0=e=>pa(Ni(e),t=>ox.decode(t)),A0=e=>C0(typeof e=="string"?rx.encode(e):e),ex=e=>{let t=F0(e),n=t.length;if(n%4===1)return ce(new Co({module:"Base64Url",kind:"Decode",input:t,message:`Length should be a multiple of 4, but is ${n}`}));if(!/^[-_A-Z0-9]*?={0,2}$/i.test(t))return ce(new Co({module:"Base64Url",kind:"Decode",input:t,message:"Invalid input"}));let r=n%4===2?`${t}==`:n%4===3?`${t}=`:t;return r=r.replace(/-/g,"+").replace(/_/g,"/"),Ni(r)},_0=e=>pa(ex(e),t=>ox.decode(t)),P0=e=>T0(typeof e=="string"?rx.encode(e):e),tx=e=>{let t="";for(let n=e>>>3;n>0;n--){let r=Math.random()*4294967296>>>0;t+=Mi[r>>>24]+Mi[r>>>16&255]+Mi[r>>>8&255]+Mi[r&255]}return t},nx=e=>{let t=new TextEncoder().encode(e);if(t.length%2!==0)return ce(new Co({module:"Hex",kind:"Decode",input:e,message:`Length must be a multiple of 2, but is ${t.length}`}));try{let n=t.length/2,r=new Uint8Array(n);for(let o=0;o<n;o++){let s=k0(t[o*2]),a=k0(t[o*2+1]);r[o]=s<<4|a}return se(r)}catch(n){return ce(new Co({module:"Hex",kind:"Decode",input:e,message:n instanceof Error?n.message:"Invalid input"}))}},R0=e=>pa(nx(e),t=>ox.decode(t)),rx=new TextEncoder,ox=new TextDecoder,F0=e=>e.replace(/[\n\r]/g,""),Xg=e=>{let t=e.length,n="",r;for(r=2;r<t;r+=3)n+=vo[e[r-2]>>2],n+=vo[(e[r-2]&3)<<4|e[r-1]>>4],n+=vo[(e[r-1]&15)<<2|e[r]>>6],n+=vo[e[r]&63];return r===t+1&&(n+=vo[e[r-2]>>2],n+=vo[(e[r-2]&3)<<4],n+="=="),r===t&&(n+=vo[e[r-2]>>2],n+=vo[(e[r-2]&3)<<4|e[r-1]>>4],n+=vo[(e[r-1]&15)<<2],n+="="),n};function Pd(e){if(e>=v0.length)throw new TypeError(`Invalid character ${String.fromCharCode(e)}`);let t=v0[e];if(t===255)throw new TypeError(`Invalid character ${String.fromCharCode(e)}`);return t}var vo=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],v0=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],C0=e=>Xg(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),Mi=[];for(let e=0;e<256;e++)Mi.push(e.toString(16).padStart(2,"0"));var T0=e=>{let t="";for(let n=0;n<e.length;n++)t+=Mi[e[n]];return t},k0=e=>{if(48<=e&&e<=57)return e-48;if(97<=e&&e<=102)return e-97+10;if(65<=e&&e<=70)return e-65+10;throw new TypeError("Invalid input")};var ax="effect/Tracer/ParentSpan",Pu=class extends He()(ax,{fiberCached:!0}){},v2=e=>e;var Md=pe("effect/Tracer/DisablePropagation",{defaultValue:iu}),M0=pe("effect/Tracer/CurrentTraceLevel",{defaultValue:()=>"Info"}),N0=pe("effect/Tracer/MinimumTraceLevel",{defaultValue:()=>"All"}),ix="effect/Tracer",Nd=pe(ix,{fiberCached:!0,defaultValue:()=>v2({span:e=>new sx(e)})}),sx=class{_tag="Span";spanId;traceId="native";sampled;name;parent;annotations;links;startTime;kind;status;attributes;events=[];constructor(t){this.name=t.name,this.parent=t.parent,this.annotations=t.annotations,this.links=t.links,this.startTime=t.startTime,this.kind=t.kind,this.sampled=t.sampled,this.status={_tag:"Started",startTime:t.startTime},this.attributes=new Map,this.traceId=Qt(t.parent)?.traceId??tx(32),this.spanId=tx(16)}end(t,n){this.status={_tag:"Ended",endTime:t,exit:n,startTime:this.status.startTime}}attribute(t,n){this.attributes.set(t,n)}event(t,n,r){this.events.push([t,n,r??{}])}addLinks(t){this.links.push(...t)}};var $0="effect/observability/Metric/FiberRuntimeMetricsKey";var U0=pe("effect/ErrorReporter/CurrentErrorReporters",{defaultValue:()=>new Set}),Ru=pe("effect/References/CurrentStackFrame",{fiberCached:!0,defaultValue:Br}),Dd=pe("effect/References/TracerEnabled",{defaultValue:An}),Di=pe("effect/References/TracerTimingEnabled",{defaultValue:An}),Fu=pe("effect/References/TracerSpanAnnotations",{defaultValue:()=>({})}),Mu=pe("effect/References/TracerSpanLinks",{defaultValue:()=>[]}),To=pe("effect/References/CurrentLogAnnotations",{defaultValue:()=>({})}),cx=pe("effect/References/CurrentLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),$d=pe("effect/References/MinimumLogLevel",{fiberCached:!0,defaultValue:()=>"Info"});var Ud=pe("effect/References/CurrentLogSpans",{defaultValue:()=>[]});var k2=()=>{let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,"writable")?e.writable===!0:e.set!==void 0},O2=k2(),Ss=()=>Error.stackTraceLimit,Fn=e=>{O2&&(Error.stackTraceLimit=e)};var Ld=e=>{if(e?.captureStackTrace===!1)return e;if(e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!="boolean")return e;let t=Ss();Fn(3);let n=new Error;return Fn(t),{...e,captureStackTrace:A2(()=>n.stack)}},ux=e=>t=>{let n;return()=>{if(n!==void 0)return n;let r=t();if(!r)return;let o=r.split(`
|
|
11
|
-
`);if(o[e]!==void 0)return
|
|
12
|
-
`),s=[
|
|
13
|
-
`),
|
|
14
|
-
`)},
|
|
15
|
-
${
|
|
16
|
-
`)},
|
|
17
|
-
`)},
|
|
18
|
-
`),
|
|
19
|
-
${
|
|
20
|
-
}`:e.stack,
|
|
21
|
-
`),
|
|
22
|
-
${t}${
|
|
23
|
-
${
|
|
24
|
-
${t}}`),r},Bd="~effect/Fiber",N2={_A:F,_E:F},D2={id:0},ws=()=>globalThis[bi],qd=class{constructor(t,n=!0){this[Bd]=N2,this.setContext(t),this.id=++D2.id,this.currentOpCount=0,this.interruptible=n,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this.runtimeMetrics?.recordFiberStart(this.context)}[Bd];id;interruptible;currentOpCount;_stack;_observers;_exit;_children;_interruptedCause;_yielded;_running;_deferredInterrupt;context;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;currentPreventYield;_dispatcher=void 0;get currentDispatcher(){return this._dispatcher??=this.currentScheduler.makeDispatcher()}getRef(t){return Xt(this.context,t)}addObserver(t){return this._exit?(t(this._exit),ho):(this._observers.push(t),()=>{if(this._exit)return;let n=this._observers.indexOf(t);n>=0&&this._observers.splice(n,1)})}interruptUnsafe(t,n){if(this._exit)return;let r=ji(t);this.currentStackFrame&&(r=yu(r,wo(xd,this.currentStackFrame))),n&&(r=yu(r,n)),this._interruptedCause=this._interruptedCause?Tx(this._interruptedCause,r):r,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(Pe(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(t){if(this._exit)return;if(this._yielded!==void 0){let o=this._yielded;this._yielded=void 0,o()}let n=this.runLoop(t);if(n===ia)return;let r=dx.interruptChildren&&dx.interruptChildren(this);if(r!==void 0)return this.evaluate(z(r,()=>n));this._exit=n,this.runtimeMetrics?.recordFiberEnd(this.context,this._exit);for(let o=0;o<this._observers.length;o++)this._observers[o](n);this._observers.length=0,this._stack.length=0,this._children=void 0,this.context=qt()}runLoop(t){let n=globalThis[bi];globalThis[bi]=this;let r=this._running;this._running=!0;let o=!1,s=t;this.currentOpCount=0;try{for(;;){if(this._deferredInterrupt&&(this._deferredInterrupt=!1,s=Pe(this._interruptedCause)),this.currentOpCount++,!o&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){o=!0;let a=s;s=z(qi,()=>a)}if(s=this.currentTracerContext?this.currentTracerContext(s,this):s[at](this),s===ia){let a=this._yielded;if(sa in a)return this._deferredInterrupt=!1,this._yielded=void 0,a;if(this._deferredInterrupt){this._yielded=void 0,a();continue}return ia}}}catch(a){return _(s,at)?this.runLoop(Gr(a)):Gr(`Fiber.runLoop: Not a valid effect: ${String(s)}`)}finally{this._running=r,globalThis[bi]=n}}getCont(t){if(this._deferredInterrupt)return this._deferredInterrupt=!1,$2;for(;;){let n=this._stack.pop();if(!n)return;let r=n[ls]&&n[ls](this);if(r)return r[t]=r,r;if(n[t])return n}}yieldWith(t){return this._yielded=t,ia}children(){return this._children??=new Set}pipe(){return ne(this,arguments)}setContext(t){let n=this.context;if(this.context=t,n!==void 0&&Vv(n,t))return;let r=this.getRef(_u);r!==this.currentScheduler&&(this.currentScheduler=r,this._dispatcher=void 0),this.currentSpan=Tu(t,ax),this.currentLogLevel=this.getRef(cx),this.minimumLogLevel=this.getRef($d),this.currentStackFrame=this.getRef(Ru),this.maxOpsBeforeYield=this.getRef(b0),this.currentPreventYield=this.getRef(w0),this.runtimeMetrics=Tu(t,$0);let o=Tu(t,ix);this.currentTracerContext=o?o.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag==="Span"?this.currentSpan:void 0}},$2={[Zt](e,t){return Pe(t._interruptedCause)},[Kn](e,t){return Pe(t._interruptedCause)}},dx={interruptChildren:void 0},Vd=e=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(wg.key,e.currentStackFrame),Pi(t)},U2=e=>{if(!(e._children===void 0||e._children.size===0))return bs(e._children)},rC=e=>{let t=e;return t._exit?N(t._exit):bt(n=>t._exit?n(N(t._exit)):B(e.addObserver(r=>n(N(r)))))},Jd=e=>bt(t=>{let n=e[Symbol.iterator](),r=[],o;function s(){let a=n.next();for(;!a.done;){if(a.value._exit){r.push(a.value._exit),a=n.next();continue}o=a.value.addObserver(i=>{r.push(i),s()});return}t(N(r))}return s(),B(()=>o?.())});var Zd=e=>te(t=>oC(e,t.id)),oC=p(e=>_(e[0],Bd),(e,t,n)=>te(r=>{let o=Vd(r);return o=o&&n?da(o,n):o??n,e.interruptUnsafe(t,o),Uu(rC(e))})),bs=e=>te(t=>{let n=Vd(t),r=ha();for(let o of e)o.interruptUnsafe(t.id,n),r.push(o);return Uu(Jd(r))});var N=Me,Pe=Bt,ze=Jn,B=Vn({op:"Sync",[at](e){let t=this[Q](),n=e.getCont(Zt);return n?n[Zt](t,e):e.yieldWith(Me(t))}}),X=Vn({op:"Suspend",[at](e){return this[Q]()}}),kx=p(e=>e.length>=2||Ed(e[0]),(e,t)=>Ne(e)?ze(t?t():new Wr("Effect.fromOption: Option.none")):N(e.value)),Bi=Qn({onFailure:ze,onSuccess:N}),sC=e=>e==null?ze(new Wr):N(e),Ox=Vn({op:"Yield",[at](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(rn)},this[Q]??0),e.yieldWith(()=>{t=!0})}}),qi=Ox(0),Ax=e=>N(R(e)),Ea=N(O()),aC=e=>Ne(e)?Ea:ke(e.value,R),iC=e=>X(()=>Pe(ye(e))),Is=e=>Gr(e),Yd=e=>X(()=>ze(ye(e))),ie=N(void 0);var cC=e=>{let t=typeof e=="function"?e:e.try,n=typeof e=="function"?r=>new Li(r,"An error occurred in Effect.try"):e.catch;return X(()=>{try{return N(ye(t))}catch(r){return ze(ye(()=>n(r)))}})};var _x=e=>Px(function(t,n){ye(()=>e(n)).then(r=>t(N(r)),r=>t(Is(r)))},e.length!==0),uC=e=>{let t=typeof e=="function"?e:e.try,n=typeof e=="function"?r=>new Li(r,"An error occurred in Effect.tryPromise"):e.catch;return Px(function(r,o){let s=a=>{try{r(ze(ye(()=>n(a))))}catch(i){r(Is(i))}};try{ye(()=>t(o)).then(a=>r(N(a)),s)}catch(a){s(a)}},t.length!==0)},fC=e=>te(t=>e(t.id)),lC=te(N),dC=fC(N),Px=Vn({op:"Async",single:!1,[at](e){let t=ye(()=>this[Q][0].bind(e.currentScheduler)),n=!1,r=!1,o=this[Q][1]?new AbortController:void 0,s=t(a=>{n||(n=!0,r?e.evaluate(a):r=a)},o?.signal);return r!==!1?r:(r=!0,e._yielded=()=>{n=!0},o===void 0&&s===void 0?ia:(e._stack.push(L2(()=>(n=!0,o?.abort(),s??rn))),ia))}}),L2=Vn({op:"AsyncFinalizer",[ls](e){e.interruptible&&(e.interruptible=!1,e._stack.push(cp))},[Kn](e,t){return V0(e)?z(this[Q](),()=>Pe(e)):Pe(e)}}),bt=e=>Px(e,e.length>=2),Qd=bt(ho),pC=(...e)=>X(()=>$i(e.length===1?e[0]():e[1].call(e[0].self))),Rx=(e,...t)=>{let n=t.length===0?function(){return X(()=>$i(e.apply(this,arguments)))}:function(){let r=X(()=>$i(e.apply(this,arguments)));for(let o=0;o<t.length;o++)r=t[o](r,...arguments);return r};return Fx(e.length,n)},Fx=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),L0=ux(2),mC=function(){let e=typeof arguments[0]=="string",t=e?arguments[0]:"Effect.fn",n=e?arguments[1]:void 0,r=Ss();Fn(2);let o=new globalThis.Error;return Fn(r),e?(s,...a)=>j0(t,s,o,a,e,n):j0(t,arguments[0],o,Array.prototype.slice.call(arguments,1),e,n)},j0=(e,t,n,r,o,s)=>{let a=typeof t=="function"?t:r.shift().bind(t.self);return Fx(a.length,function(...i){let c=X(()=>{let l=a.apply(this,arguments);return ee(l)?l:$i(l)});for(let l=0;l<r.length;l++)c=r[l](c,...i);if(!ee(c))return c;let u=Ss();Fn(2);let f=new globalThis.Error;return Fn(u),Oo(o?$u(e,s,l=>xx(c,l)):c,Ru,l=>({name:e,stack:L0(()=>f.stack),parent:{name:`${e} (definition)`,stack:L0(()=>n.stack),parent:l}}))})},hC=(e,...t)=>Fx(e.length,t.length===0?function(){return B0(()=>e.apply(this,arguments))}:function(){let n=B0(()=>e.apply(this,arguments));for(let r of t)n=r(n);return n}),B0=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return N(r.value);let o=r.value;if(o&&o._tag==="Success"){n=o.value;continue}else{if(o&&o._tag==="Failure")return r.value;{let s=!0;return X(()=>s?(s=!1,z(r.value,a=>$i(t,a))):X(()=>$i(e())))}}}}catch(t){return Is(t)}},$i=Vn({op:"Iterator",single:!1,[Zt](e,t){let n=this[Q][0];for(;;){let r=n.next(e);if(r.done)return N(r.value);if(De(r.value)){if(r.value._tag==="Failure")return r.value}else return t._stack.push(this),r.value;e=r.value.value}},[at](e){return this[Zt](this[Q][1],e)}}),zt=p(2,(e,t)=>{let n=N(t);return z(e,r=>n)}),zi=e=>ke(e,R),gC=e=>wa(e,{onFailure:N,onSuccess:ze}),Sr=p(2,(e,t)=>z(e,n=>ee(t)?t:ye(()=>t(n)))),ba=p(2,(e,t)=>z(e,n=>zt(ee(t)?t:ye(()=>t(n)),n))),Uu=e=>z(e,t=>rn),xC=e=>Nn(e,ze),Mx=(e,t)=>te(n=>bt(r=>{let o=St(e),s=o.length,a=0,i=!1,c=new Set,u=[],f=(l,d,m)=>{if(a++,l._tag==="Failure"){u.push(...l.cause.reasons),a>=s&&r(Pe(xo(u)));return}let g=!i;i=!0,r(c.size===0?l:z(Po(bs(c)),()=>l)),g&&t?.onWinner&&t.onWinner({fiber:d,index:m,parentFiber:n})};for(let l=0;l<s;l++){let d=va(n,o[l],!0,!0,!1);if(c.add(d),d.addObserver(m=>{c.delete(d),f(m,d,l)}),i)break}return bs(c)})),Nx=(e,t)=>te(n=>bt(r=>{let o=!1,s=new Set,a=c=>{o=!0,r(s.size===0?c:z(Po(bs(s)),()=>c))},i=0;for(let c of e){if(o)break;let u=i++,f=va(n,c,!0,!0,!1);s.add(f),f.addObserver(l=>{s.delete(f);let d=!o;a(l),d&&t?.onWinner&&t.onWinner({fiber:f,index:u,parentFiber:n})})}return bs(s)})),yC=p(e=>ee(e[1]),(e,t,n)=>Mx([e,t],n)),Xd=p(e=>ee(e[1]),(e,t,n)=>Nx([e,t],n)),z=p(2,(e,t)=>{let n=Object.create(j2);return n[Q]=e,n[Zt]=t.length!==1?r=>t(r):t,n}),j2=yo({op:"OnSuccess",[at](e){return e._stack.push(this),this[Q]}}),SC=p(2,(e,t)=>De(e)?e._tag==="Success"?t.onSuccess(e.value):t.onFailure(e.cause):yr(e,t)),De=e=>sa in e,EC=p(2,(e,t)=>De(e)?e._tag==="Success"?t(e.value):e:z(e,t)),bC=e=>z(e,F),ke=p(2,(e,t)=>z(e,n=>N(ye(()=>t(n))))),wC=p(2,(e,t)=>De(e)?OC(e,t):ke(e,t)),IC=p(2,(e,t)=>De(e)?AC(e,t):zx(e,t)),vC=p(2,(e,t)=>De(e)?_C(e,t):Wx(e,t)),CC=p(2,(e,t)=>{if(De(e)){if(e._tag==="Success")return e;let n=ko(e.cause);return Ce(n)?e:t(n.success)}return Dn(e,t)}),Dx=e=>Bt(ji(e)),Lu=e=>e._tag==="Success";var TC=e=>e._tag==="Failure";var kC=e=>e._tag==="Failure"?se(e.cause):ce(e);var rn=Me(void 0),OC=p(2,(e,t)=>e._tag==="Success"?Me(t(e.value)):e),AC=p(2,(e,t)=>{if(e._tag==="Success")return e;let n=ko(e.cause);return Ce(n)?e:Jn(t(n.success))}),_C=p(2,(e,t)=>{if(e._tag==="Success")return Me(t.onSuccess(e.value));let n=ko(e.cause);return Ce(n)?e:Jn(t.onFailure(n.success))});var PC=p(2,(e,t)=>Lu(e)?t:e);var RC=e=>{let t=[];for(let n of e)n._tag==="Failure"&&t.push(...n.cause.reasons);return t.length===0?rn:Bt(xo(t))};var FC=e=>e,MC=e=>te(t=>N(Dg(t.context,e))),B2=e=>te(t=>kx(Dg(t.context,e))),Wi=p(2,(e,t)=>te(n=>{let r=n.context,o=t(r);return r===o?e:(n.setContext(o),_o(e,()=>{n.setContext(r)}))})),Oo=p(3,(e,t,n)=>Wi(e,r=>{let o=xr(r,t),s=n(o);return o===s?r:Nt(r,t,s)})),NC=(e,t,n)=>Po(te(r=>{let o=xr(r.context,e),s=t(o);return r.setContext(Nt(r.context,e,s)),Er(xr(r.context,Cs),a=>{let i=xr(r.context,e),c;if(n?.reset===void 0){if(i!==s)return ie;c=o}else c=n.reset(o,s,i);return r.setContext(Nt(r.context,e,c)),ie})})),$x=()=>q2,q2=te(e=>N(e.context)),vs=e=>te(t=>e(t.context)),DC=p(2,(e,t)=>Wi(e,ot(t))),Ao=p(2,(e,t)=>De(e)?e:Wi(e,da(t))),on=function(){return arguments.length===1?p(2,(e,t)=>q0(e,arguments[0],t)):p(3,(e,t,n)=>q0(e,t,n)).apply(this,arguments)},q0=(e,t,n)=>Wi(e,Nt(t,n)),ep=p(3,(e,t,n)=>z(n,r=>on(e,t,r))),$C=p(e=>ee(e[1]),(e,t,n)=>Ux(e,t,(r,o)=>[r,o],n)),Ux=p(e=>ee(e[1]),(e,t,n,r)=>r?.concurrent?ke(Gu([e,t],{concurrency:2}),([o,s])=>ye(()=>n(o,s))):z(e,o=>ke(t,s=>ye(()=>n(o,s))))),UC=p(e=>ee(e[0]),(e,t,n)=>iy(e,t,n?r=>ze(n(r)):()=>ze(new Wr))),LC=p(2,(e,t)=>z(t,n=>n?zi(e):Ea)),Lx=p(2,(e,t)=>Array.from({length:t},()=>e)),jC=p(e=>ee(e[0]),(e,t,n)=>Gu(Lx(e,t),n)),tp=p(e=>ee(e[0]),(e,t)=>Vr({while:An,body:ot(t?.disableYield?e:z(e,n=>qi)),step:ho})),Nn=p(2,(e,t)=>{let n=Object.create(z2);return n[Q]=e,n[Kn]=t.length!==1?r=>t(r):t,n}),z2=yo({op:"OnFailure",[at](e){return e._stack.push(this),this[Q]}}),jx=p(3,(e,t,n)=>Nn(e,r=>t(r)?ye(()=>n(r)):Pe(r))),Hi=p(3,(e,t,n)=>Nn(e,r=>{let o=t(r);return Ce(o)?Pe(o.failure):ye(()=>n(o.success,r))})),Dn=p(2,(e,t)=>Hi(e,ko,n=>t(n))),BC=e=>wa(e,{onFailure:t=>Ig(t)?Ea:ze(t),onSuccess:Ax}),qC=p(2,(e,t)=>Hi(e,Cx,t)),zC=p(2,(e,t)=>Nn(e,n=>Sr(ye(()=>t(n)),Pe(n)))),WC=p(3,(e,t,n)=>jx(e,t,r=>Sr(ye(()=>n(r)),Pe(r)))),np=p(3,(e,t,n)=>Nn(e,r=>{let o=t(r);return Ce(o)?Pe(r):Sr(ye(()=>n(o.success,r)),Pe(r))})),Bx=p(2,(e,t)=>np(e,ko,n=>t(n))),HC=p(3,(e,t,n)=>{let r=Array.isArray(t)?o=>_(o,"_tag")&&t.includes(o._tag):Gn(t);return Bx(e,o=>r(o)?n(o):ie)}),GC=p(2,(e,t)=>np(e,Cx,n=>t(n))),ju=p(e=>ee(e[0]),(e,t,n,r)=>Nn(e,o=>{let s=ko(o);return Ce(s)?Pe(s.failure):t(s.success)?ye(()=>n(s.success)):r?ye(()=>r(s.success)):Pe(o)})),rp=p(e=>ee(e[0]),(e,t,n,r)=>Nn(e,o=>{let s=ko(o);if(Ce(s))return Pe(s.failure);let a=t(s.success);return Ce(a)?r?ye(()=>r(a.failure)):Pe(o):ye(()=>n(a.success))})),qx=p(e=>ee(e[0]),(e,t,n,r)=>{let o=Array.isArray(t)?s=>_(s,"_tag")&&t.includes(s._tag):Gn(t);return ju(e,o,n,r)}),KC=p(e=>ee(e[0]),(e,t,n)=>{let r;return rp(e,o=>(r??=Object.keys(t),_(o,"_tag")&&hr(o._tag)&&r.includes(o._tag)?se(o):ce(o)),o=>ye(()=>t[o._tag](o)),n)}),VC=p(e=>ee(e[0]),(e,t,n,r,o)=>ju(e,s=>Gn(s,t)&&_(s,"reason"),s=>{let a=s.reason;return Gn(a,n)?r(a,s):o?ye(()=>o(a,s)):ze(s)})),JC=p(e=>ee(e[0]),(e,t,n,r)=>{let o;return ju(e,s=>Gn(s,t)&&_(s,"reason")&&_(s.reason,"_tag")&&hr(s.reason._tag),s=>{let a=s.reason;return o??=Object.keys(n),o.includes(a._tag)?ye(()=>n[a._tag](a,s)):r?ye(()=>r(a,s)):ze(s)})}),ZC=p(2,(e,t)=>rp(e,n=>Gn(n,t)&&_(n,"reason")?se(n.reason):ce(n),ze)),zx=p(2,(e,t)=>Dn(e,n=>Yd(()=>t(n)))),Wx=p(2,(e,t)=>wa(e,{onFailure:n=>Yd(()=>t.onFailure(n)),onSuccess:n=>B(()=>t.onSuccess(n))})),Hx=e=>Dn(e,Is),YC=p(2,(e,t)=>Dn(e,n=>B(t))),QC=e=>X(()=>{let t=e[Symbol.iterator](),n=t.next();if(n.done)return Is(new Error("Received an empty collection of effects"));function r(o){let s=t.next();return s.done?o.value:Dn(o.value,a=>r(s))}return r(n)}),Gx=e=>Dn(e,t=>z(qi,()=>Gx(e))),XC=p(e=>ee(e[0]),(e,t)=>{if(!t?.log)return wa(e,{onFailure:r=>ie,onSuccess:r=>ie});let n=wr(t.log===!0?void 0:t.log);return yr(e,{onFailure(r){let o=G0(r);return Ce(o)?Pe(o.failure):t.message===void 0?n(r):n(t.message,r)},onSuccess:r=>ie})}),op=p(e=>ee(e[0]),(e,t)=>{if(!t?.log)return yr(e,{onFailure:r=>ie,onSuccess:r=>ie});let n=wr(t.log===!0?void 0:t.log);return yr(e,{onFailure:r=>t.message===void 0?n(r):n(t.message,r),onSuccess:r=>ie})}),eT=e=>sp(e,{onFailure:O,onSuccess:R}),Es=e=>Bu(e,{onFailure:ce,onSuccess:se}),yr=p(2,(e,t)=>{let n=Object.create(W2);return n[Q]=e,n[Zt]=t.onSuccess.length!==1?r=>t.onSuccess(r):t.onSuccess,n[Kn]=t.onFailure.length!==1?r=>t.onFailure(r):t.onFailure,n}),W2=yo({op:"OnSuccessAndFailure",[at](e){return e._stack.push(this),this[Q]}}),Kx=p(2,(e,t)=>yr(e,{onFailure:n=>B(()=>t.onFailure(n)),onSuccess:n=>B(()=>t.onSuccess(n))})),wa=p(2,(e,t)=>yr(e,{onFailure:n=>{let r=n.reasons.find(ca);return r?ye(()=>t.onFailure(r.error)):Pe(n)},onSuccess:t.onSuccess})),sp=p(2,(e,t)=>wa(e,{onFailure:n=>B(()=>t.onFailure(n)),onSuccess:n=>B(()=>t.onSuccess(n))})),Bu=p(2,(e,t)=>{if(De(e)){if(e._tag==="Success")return Me(t.onSuccess(e.value));let n=ko(e.cause);return Ce(n)?e:Me(t.onFailure(n.success))}return sp(e,t)}),tT=p(2,(e,t)=>De(e)?e._tag==="Success"?Me(t.onSuccess(e.value)):Me(t.onFailure(e.cause)):Kx(e,t)),qu=e=>De(e)?Me(e):H2(e),H2=Vn({op:"Exit",[at](e){return e._stack.push(this),this[Q]},[Zt](e,t,n){return N(n??Me(e))},[Kn](e,t,n){return N(n??Bt(e))}}),nT=Bu({onFailure:()=>!0,onSuccess:()=>!1}),rT=Bu({onFailure:()=>!1,onSuccess:()=>!0}),oT=p(2,(e,t)=>Sr(Ca(t),e)),Vx=p(2,(e,t)=>Xd(e,z(Ca(t.duration),t.orElse))),sT=p(2,(e,t)=>Vx(e,{duration:t,orElse:()=>ze(new zd)})),aT=p(2,(e,t)=>Xd(zi(e),zt(Ca(t),O()))),iT=e=>Jr(t=>{let n=t.monotonicTimeNanosUnsafe();return ke(e,r=>[Xn(t.monotonicTimeNanosUnsafe()-n),r])}),px="~effect/Scope",mx="~effect/Scope/Closeable",Cs=He("effect/Scope"),Jx=(e,t)=>X(()=>ap(e,t)??ie),ap=(e,t)=>{if(e.state._tag==="Closed")return;let n={_tag:"Closed",exit:t};if(e.state._tag==="Empty"){e.state=n;return}let r=e.state;if(e.state=n,r.finalizer!==void 0)return r.finalizer(t);let o=r.finalizers;if(!(o===void 0||o.size===0))return o.size===1?o.values().next().value(t):K2(e,o,t)},G2=(e,t)=>Lu(e)?t:Nn(t,n=>Pe(Tx(e.cause,n))),K2=Rx(function*(e,t,n){let r=[],o=[],s=Array.from(t.values()),a=ws();for(let i=s.length-1;i>=0;i--){let c=s[i];e.strategy==="sequential"?r.push(yield*qu(c(n))):o.push(va(a,c(n),!0,!0,"inherit"))}return o.length>0&&(r=yield*Jd(o)),yield*RC(r)});var cT=(e,t)=>{let n=zu(t);if(e.state._tag==="Closed")return n.state=e.state,n;let r={};return Nu(e,r,o=>Jx(n,o)),Nu(n,r,o=>B(()=>Zx(e,r))),n},Er=(e,t)=>X(()=>e.state._tag==="Closed"?t(e.state.exit):(Nu(e,{},t),ie)),uT=(e,t)=>Er(e,ot(t)),Nu=(e,t,n)=>{if(e.state._tag==="Empty")e.state={_tag:"Open",finalizerKey:t,finalizer:n,finalizers:void 0};else if(e.state._tag==="Open"){let r=e.state;r.finalizer!==void 0?(r.finalizers=new Map([[r.finalizerKey,r.finalizer]]),r.finalizerKey=void 0,r.finalizer=void 0,r.finalizers.set(t,n)):r.finalizers===void 0?(r.finalizerKey=t,r.finalizer=n):r.finalizers.set(t,n)}},Zx=(e,t)=>{if(e.state._tag==="Open"){let n=e.state;n.finalizerKey===t?(n.finalizerKey=void 0,n.finalizer=void 0):n.finalizers!==void 0&&n.finalizers.delete(t)}};var zu=(e="sequential")=>({[mx]:mx,[px]:px,strategy:e,state:V2}),V2={_tag:"Empty"};var Wu=Cs,fT=on(Cs),Yx=e=>te(t=>{let n=t.context,r=zu();return t.setContext(Nt(t.context,Cs,r)),_o(e,o=>(t.setContext(n),ap(r,o)))});var ip=e=>X(()=>{let t=zu();return Dt(e(t),n=>X(()=>ap(t,n)??ie))}),Ia=(e,t,n)=>vs(r=>br(o=>z(Wu,s=>ba(n?.interruptible?o(e):e,a=>Er(s,i=>Ao(t(a,i),r)))))),Qx=e=>z(Wu,t=>vs(n=>Er(t,r=>Ao(e(r),n)))),_o=Vn({op:"OnExit",single:!1,[at](e){return e._stack.push(this),this[Q][0]},[ls](e){e.interruptible&&this[Q][2]!==!0&&(e._stack.push(cp),e.interruptible=!1)},[Zt](e,t,n){n??=Me(e);let r=this[Q][1](n);return r?z(r,o=>n):n},[Kn](e,t,n){n??=Bt(e);let r=this[Q][1](n);return r?z(G2(n,r),o=>n):n}}),Dt=p(2,_o),lT=p(2,(e,t)=>Dt(e,n=>t)),Xx=p(3,(e,t,n)=>Dt(e,r=>t(r)?n(r):ie)),ey=p(3,(e,t,n)=>Dt(e,r=>{let o=t(r);return Ce(o)?ie:n(o.success,r)})),ty=p(2,(e,t)=>ey(e,kC,t)),dT=p(3,(e,t,n)=>Xx(e,r=>r._tag!=="Failure"?!1:t(r.cause),r=>n(r.cause))),ny=p(3,(e,t,n)=>Dt(e,r=>{if(r._tag!=="Failure")return ie;let o=t(r.cause);return Ce(o)?ie:n(o.success,r.cause)})),pT=p(2,(e,t)=>ny(J0,t)(e)),Hu=(e,t,n)=>br(r=>z(e,o=>_o(r(t(o)),s=>n(o,s),!0))),mT=e=>Ia(e,t=>_(t,Symbol.asyncDispose)?_x(()=>t[Symbol.asyncDispose]()):B(()=>t[Symbol.dispose]())),ry=p(2,(e,t)=>B(()=>{let n=Fi(Rn(t)),r=Number.isFinite(n),o=py(!1),s=0,a=!1,i,c=z(o.await,()=>i);return[te(u=>{let f=u.getRef(Fo),l=r?f.currentTimeMillisUnsafe():0;return a||l<s?i??c:(a=!0,o.closeUnsafe(),i=void 0,Dt(e,d=>B(()=>{a=!1,s=f.currentTimeMillisUnsafe()+n,i=d,o.openUnsafe()})))}),B(()=>{s=0,o.closeUnsafe(),i=void 0})]})),oy=p(2,(e,t)=>ke(ry(e,t),n=>n[0])),hT=e=>oy(e,Io),gT=te(e=>Pe(ji(e.id))),Po=e=>te(t=>(t.interruptible&&(t.interruptible=!1,t._stack.push(cp)),e)),xT=Vn({op:"SetInterruptible",[ls](e){if(e.interruptible=this[Q],e._interruptedCause&&e.interruptible)return()=>Pe(e._interruptedCause)}}),cp=xT(!0),J2=xT(!1),yT=e=>{if(e.interruptible=!0,e._stack.push(J2),e._interruptedCause)return Pe(e._interruptedCause)},sy=e=>te(t=>t.interruptible?e:yT(t)??e),br=e=>te(t=>t.interruptible?(t.interruptible=!1,t._stack.push(cp),e(sy)):e(F)),ST=e=>te(t=>{if(t.interruptible)return e(F);let n=yT(t),r=e(Po);return n??r}),ET=ke(Ia(B(()=>new AbortController),e=>B(()=>e.abort())),e=>e.signal),Gu=(e,t)=>qr(e)?t?.mode==="result"?Mn(e,Es,t):Mn(e,F,t):t?.discard?t.mode==="result"?Mn(Object.values(e),Es,t):Mn(Object.values(e),F,t):X(()=>{let n={};return zt(Mn(Object.entries(e),([r,o])=>ke(t?.mode==="result"?Es(o):o,s=>{M(n,r,s)}),{discard:!0,concurrency:t?.concurrency}),n)}),ay=p(e=>qr(e[0])&&!ee(e[0]),(e,t,n)=>ke(Mn(e,(r,o)=>Es(t(r,o)),n),r=>Wg(r,F))),bT=p(3,(e,t,n)=>{let r=St(e);return r.length===0?B(t):X(()=>{let o=0,s=t();return ke(Vr({while:()=>o<r.length,body:()=>n(s,r[o],o),step(a){s=a,o++}}),()=>s)})}),wT=p(e=>qr(e[0])&&!ee(e[0]),(e,t,n)=>z(ay(e,t,{concurrency:n?.concurrency}),([r,o])=>ma(r)?ze(r):n?.discard?ie:N(o))),IT=p(e=>qr(e[0])&&!ee(e[0]),(e,t)=>X(()=>{let n=e[Symbol.iterator](),r=n.next();return r.done?N(O()):vT(n,0,t,r.value)})),vT=(e,t,n,r)=>z(n(r,t),o=>{if(o)return N(R(r));let s=e.next();return s.done?N(O()):vT(e,t+1,n,s.value)}),CT=p(e=>qr(e[0])&&!ee(e[0]),(e,t)=>X(()=>{let n=e[Symbol.iterator](),r=n.next();return r.done?N(O()):TT(n,0,t,r.value)})),TT=(e,t,n,r)=>z(n(r,t),o=>{if(en(o))return N(R(o.success));let s=e.next();return s.done?N(O()):TT(e,t+1,n,s.value)}),Vr=Vn({op:"While",[Zt](e,t){return this[Q].step(e),this[Q].while()?(t._stack.push(this),this[Q].body()):rn},[at](e){return this[Q].while()?(e._stack.push(this),this[Q].body()):rn}}),Mn=p(e=>typeof e[1]=="function",(e,t,n)=>X(()=>{let r=n?.concurrency??1,o=r==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,r);if(o===1)return Z2(e,t,n);let s=St(e),a=s.length;if(a===0)return n?.discard?ie:N([]);let i=n?.discard?void 0:new Array(a),c=Y2({f:t,out:i},s,{concurrency:o});return c?zt(c,i):N(i)})),kT=e=>z(e,t=>{let n=t[Symbol.iterator]().next();return n.done?ze(new Wr):N(n.value)}),Z2=(e,t,n)=>X(()=>{let r=n?.discard?void 0:[],o=e[Symbol.iterator](),s=o.next(),a=0;return zt(Vr({while:()=>!s.done,body:()=>t(s.value,a++),step:i=>{r&&r.push(i),s=o.next()}}),r)}),OT=e=>{let t=e.onItem,n=e.step,r=(o,s,a,i)=>{for(;a<i;a++){let c=s[a],u=t(o,c,a);if(!De(u))return z(qu(u),l=>n(o,c,l,a)??r(o,s,a+1,i)??ie);let f=n(o,c,u,a);if(f)return f._tag==="Failure"?f:void 0}};return(o,s,a)=>{let i=0,c=a?.end??s.length,u=a?.concurrency??1;if(u===1)return r(o,s,0,c);let f=a?.orderedStep===!0,l=!1,d,m,g,S=!1,v,I,C=i,y=f?new Array(c):void 0,x=w=>{let T=Gr(w);return v=T,l=!0,S=!0,m&&m.size>0?z(Po(bs(Array.from(m))),()=>T):T},h=(w,T,A)=>{if(!f)return n(o,w,T,A);if(v)return v;for(y[A]=T;C<c;){let $=y[C];if($===void 0)return;y[C]=void 0;let P=C++,L=n(o,s[P],$,P);if(L)return L}},E=()=>{let w=!1;for(;!v&&i<c;i++){let T=s[i],A=I??t(o,T,i);if(De(A)){if(v=h(T,A,i),v)break}else if(d){I=void 0;let $=va(d,A,!0,!0,"inherit");if($._exit){if(v=h(T,$._exit,i),v)break;continue}m.add($);let P=i;if($.addObserver(L=>{m.delete($);try{if(v){if(!S&&L._tag==="Failure")for(let U of L.cause.reasons)U._tag!=="Interrupt"&&(v._tag==="Failure"?v.cause.reasons.push(U):v=Bt(xo([U])))}else{let U=h(T,L,P);U&&(v=U._tag==="Failure"?Bt(xo(U.cause.reasons.slice())):U,E())}if(w){let U=E();U&&g(U)}else l&&m.size===0&&g(v??ie)}catch(U){g(x(U))}}),m.size<u)continue;w=!0,i++;return}else return bt($=>{d=ws(),m=new Set,I=A,g=$;let P;try{P=E()}catch(L){return $(x(L))}return P?$(P):X(()=>(v=rn,S=!0,m?bs(m):ie))})}if(l=!0,v){if(m&&m.size>0){let T=Vd(d);m.forEach(A=>A.interruptUnsafe(d.id,T));return}if(g||v._tag==="Failure")return v}else if(g)if(m)m.size===0&&g(ie);else return rn};return E()}},Ku=()=>OT,Y2=OT({onItem(e,t,n){return e.f(t,n)},step(e,t,n,r){if(n._tag==="Failure")return n;e.out&&(e.out[r]=n.value)}}),iy=p(3,(e,t,n)=>z(e,r=>t(r)?N(r):n(r))),cy=p(3,(e,t,n)=>z(e,r=>{let o=t(r);return Ce(o)?n(o.failure):N(o.success)})),AT=p(e=>ee(e[0]),(e,t,n)=>cy(e,t,n?r=>ze(n(r)):()=>ze(new Wr))),_T=p(e=>qr(e[0])&&!ee(e[0]),(e,t,n)=>X(()=>{let r=[];return zt(Mn(e,(o,s)=>{let a=t(o,s);return typeof a=="boolean"?(a&&r.push(o),ie):ke(a,i=>{i&&r.push(o)})},{discard:!0,concurrency:n?.concurrency}),r)})),PT=p(e=>qr(e[0])&&!ee(e[0]),(e,t)=>X(()=>{let n=[];for(let r of e){let o=t(r);en(o)&&n.push(o.success)}return N(n)})),RT=p(e=>qr(e[0])&&!ee(e[0]),(e,t,n)=>X(()=>{let r=[];return zt(Mn(e,o=>ke(t(o),s=>{en(s)&&r.push(s.success)}),{discard:!0,concurrency:n?.concurrency}),r)})),FT=N({}),MT=Av(ke),NT=_v(ke,z),DT=Ov(ke);var $T=p(e=>ee(e[0]),(e,t)=>te(n=>(dL(),N(va(n,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),va=(e,t,n=!1,r=!1,o=!1)=>{let s=e,a=o==="inherit"?s.interruptible:!o,i=new qd(s.context,a);return n?i.evaluate(t):s.currentDispatcher.scheduleTask(()=>i.evaluate(t),0),!r&&!i._exit&&(s.children().add(i),i.addObserver(()=>s._children.delete(i))),i},UT=p(e=>ee(e[0]),(e,t)=>te(n=>N(va(n,e,t?.startImmediately,!0,t?.uninterruptible)))),LT=e=>te(t=>{let n=t._children&&new Set(t._children);return Dt(e,r=>{let o=t._children;return o===void 0||o.size===0?ie:(n&&(o=n0(o,s=>!n.has(s))),Uu(Jd(o)))})}),uy=p(e=>ee(e[0]),(e,t,n)=>te(r=>{let o=va(r,e,n?.startImmediately,!0,n?.uninterruptible);if(!o._exit)if(t.state._tag!=="Closed"){let s={};Nu(t,s,()=>fC(i=>i===o.id?ie:Zd(o))),o.addObserver(()=>Zx(t,s))}else o.interruptUnsafe(r.id,Vd(r));return N(o)})),jT=p(e=>ee(e[0]),(e,t)=>z(Wu,n=>uy(e,n,t))),Ro=e=>(t,n)=>{let r=new qd(n?.scheduler?Nt(e,_u,n.scheduler):e,n?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(n?.signal)if(n.signal.aborted)r.interruptUnsafe();else{let o=()=>r.interruptUnsafe();n.signal.addEventListener("abort",o,{once:!0}),r.addObserver(()=>n.signal.removeEventListener("abort",o))}return n?.onFiberStart&&n.onFiberStart(r),r},BT=p(2,(e,t)=>{if(e._exit)return e;if(t.state._tag==="Closed")return e.interruptUnsafe(e.id),e;let n={};return Nu(t,n,()=>Zd(e)),e.addObserver(()=>Zx(t,n)),e}),qT=Ro(qt()),fy=e=>{let t=Ro(e);return(n,r)=>{let o=t(n,r);return r?.onExit&&o.addObserver(r.onExit),s=>o.interruptUnsafe(s)}},zT=fy(qt()),up=e=>{let t=Ro(e);return(n,r)=>{let o=t(n,r);return new Promise(s=>{o.addObserver(a=>s(a))})}},WT=up(qt()),ly=e=>{let t=up(e);return(n,r)=>t(n,r).then(o=>{if(o._tag==="Failure")throw Gd(o.cause);return o.value})},HT=ly(qt()),fp=e=>{let t=Ro(e);return n=>{if(De(n))return n;let r=new ya("sync"),o=t(n,{scheduler:r});return o._dispatcher?.flush(),o._exit??Gr(new Hd(o))}},GT=fp(qt()),dy=e=>{let t=fp(e);return n=>{let r=t(n);if(r._tag==="Failure")throw Gd(r.cause);return r.value}},KT=dy(qt()),z0=N(!0),W0=N(!1),hx=class{waiters=[];scheduled=void 0;_isOpen;constructor(t){this._isOpen=t}scheduleUnsafe(t){if(this.waiters.length===0)return z0;if(this.scheduled===void 0)this.scheduled=this.waiters,t.currentDispatcher.scheduleTask(this.flushScheduled,0);else for(let n=0;n<this.waiters.length;n++)this.scheduled.push(this.waiters[n]);return this.waiters=[],z0}flushScheduled=()=>{if(this.scheduled===void 0)return;let t=this.scheduled;this.scheduled=void 0;for(let n=0;n<t.length;n++)t[n](rn)};flushWaiters(){let t=this.waiters;this.waiters=[],this.flushScheduled();for(let n=0;n<t.length;n++)t[n](rn)}open=te(t=>this._isOpen?W0:(this._isOpen=!0,this.scheduleUnsafe(t)));release=te(t=>this._isOpen?W0:this.scheduleUnsafe(t));openUnsafe(){return this._isOpen?!1:(this._isOpen=!0,this.flushWaiters(),!0)}await=bt(t=>this._isOpen?t(ie):(this.waiters.push(t),B(()=>{let n=this.waiters.indexOf(t);n!==-1?this.waiters.splice(n,1):this.scheduled!==void 0&&(n=this.scheduled.indexOf(t),n!==-1&&this.scheduled.splice(n,1))})));closeUnsafe(){return this._isOpen?(this._isOpen=!1,!0):!1}close=B(()=>this.closeUnsafe());whenOpen=t=>z(this.await,()=>t);isOpen(){return this._isOpen}},py=e=>new hx(e??!1);var VT=te(e=>N(e.getRef(Nd))),JT=p(2,(e,t)=>on(e,Nd,t)),ZT=on(Dd),YT=on(Di),gx=BigInt(0),Q2={_tag:"Span",spanId:"noop",traceId:"noop",sampled:!1,status:{_tag:"Ended",startTime:gx,endTime:gx,exit:rn},attributes:new Map,links:[],kind:"internal",attribute(){},event(){},end(){},addLinks(){}},X2=e=>Object.assign(Object.create(Q2),e),QT=e=>e?Xt(e.annotations,Md)?e._tag==="Span"?QT(Qt(e.parent)):O():R(e):O(),my=(e,t,n)=>{let r=!e.getRef(Dd)||n?.annotations&&Xt(n.annotations,Md),o=n?.parent!==void 0?R(n.parent):n?.root?O():QT(e.currentSpan),s;if(r)s=X2({name:t,parent:o,annotations:Nt(n?.annotations??qt(),Md,!0)});else{let a=e.getRef(Nd),i=e.getRef(Fo),c=e.getRef(Di),u=e.getRef(Fu),f=e.getRef(Mu),l=n?.level??e.getRef(M0),d=n?.links!==void 0?[...f,...n.links]:f.length===0?[]:f.slice();s=a.span({name:t,parent:o,annotations:n?.annotations??qt(),links:d,startTime:c?i.currentTimeNanosUnsafe():BigInt(0),kind:n?.kind??"internal",root:n?.root??Ne(o),sampled:n?.sampled??(we(o)&&o.value.sampled===!1?!1:!pk(e.getRef(N0),l))});for(let m in u)s.attribute(m,u[m]);if(n?.attributes!==void 0)for(let m in n.attributes)s.attribute(m,n.attributes[m])}return s},XT=(e,t)=>te(n=>N(my(n,e,t))),Du=(e,t)=>Po(te(n=>{let r=xr(n.context,Cs),o=my(n,e,t??{}),s=n.getRef(Fo),a=n.getRef(Di);return zt(Er(r,i=>ok(o,i,s,a)),o)})),ek=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],n=Ld(e?arguments[2]:arguments[1]);if(e){let r=arguments[0];return z(Du(t,n),o=>Ui(r,o,n))}return r=>z(Du(t,n),o=>Ui(r,o,n))},eL=(e,t)=>(t=typeof t=="function"?t:Br,Oo(Ru,n=>({name:e,stack:t,parent:n}))),tk=Fu,nk=Mu,rk=p(e=>ee(e[0]),(e,t,n={})=>{let o=(Array.isArray(t)?t:[t]).map(s=>({span:s,attributes:n}));return Oo(e,Mu,s=>[...s,...o])}),ok=(e,t,n,r)=>B(()=>{e.status._tag!=="Ended"&&e.end(r?n.currentTimeNanosUnsafe():gx,t)}),$u=(e,...t)=>{let n=t.length===1?void 0:t[0],r=t[t.length-1];return te(o=>{let s=my(o,e,n),a=o.getRef(Fo),i=o.getRef(Di);return Dt(ye(()=>r(s)),c=>ok(s,c,a,i))})},xx=on(Pu),Ui=function(){let e=ee(arguments[0]),t=e?arguments[1]:arguments[0],n=e?arguments[2]:arguments[1],r=F;return t._tag==="Span"&&(n=Ld(n),r=eL(t.name,n?.captureStackTrace)),e?xx(r(arguments[0]),t):o=>xx(r(o),t)},sk=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],n=Ld(arguments[2]);if(e){let s=arguments[0];return $u(t,arguments[2],a=>Ui(s,a,n))}let r=typeof arguments[1]=="function"?arguments[1]:void 0,o=r?void 0:arguments[1];return(s,...a)=>$u(t,r?r(...a):o,i=>Ui(s,i,n))},ak=p(e=>ee(e[0]),(e,...t)=>Oo(e,Fu,n=>{let r=t.length===1?{...n,...t[0]}:{...n};return t.length===1||M(r,t[0],t[1]),r})),ik=(...e)=>te(t=>{let n=t.currentSpanLocal;if(n)if(e.length===1)for(let[r,o]of Object.entries(e[0]))n.attribute(r,o);else n.attribute(e[0],e[1]);return ie}),ck=te(e=>{let t=e.currentSpanLocal;return t?N(t):ze(new Wr)}),uk=B2(Pu),Fo=pe("effect/Clock",{defaultValue:()=>new yx}),fx=2**31-1,yx=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=B(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return tL()}currentTimeNanos=B(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return lk()}monotonicTimeNanos=B(()=>this.monotonicTimeNanosUnsafe());sleep(t){return this.sleepMillis(Fi(t))}sleepMillis(t){return t<=0?qi:Number.isFinite(t)?bt(n=>{let r=t>fx?this.sleepMillis(t-fx):ie,o=setTimeout(()=>n(r),Math.min(t,fx));return B(()=>clearTimeout(o))}):Qd}},fk=BigInt(1e6),lk=(function(){let e=globalThis.process?.hrtime;if(typeof e?.bigint=="function")return()=>e.bigint();if(typeof performance<"u"&&typeof performance.now=="function")return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(0);return()=>{let n=BigInt(Date.now())*fk;return n>t&&(t=n),t}})(),tL=(function(){let e=BigInt(1e9),t;return()=>{let n=lk(),r=BigInt(Date.now())*fk;if(t===void 0)t=r-n;else{let o=t+n;(r>o?r-o:o-r)>e&&(t=r-n)}return t+n}})(),Jr=e=>te(t=>e(t.getRef(Fo))),Ca=e=>Jr(t=>t.sleep(Rn(e))),dk=Jr(e=>e.currentTimeMillis);var Sx="~effect/Cause/TimeoutError";var zd=class extends So("TimeoutError"){[Sx]=Sx;constructor(t){super({message:t})}},Ex="~effect/Cause/IllegalArgumentError";var Wd=class extends So("IllegalArgumentError"){[Ex]=Ex;constructor(t){super({message:t})}},bx="~effect/Cause/ExceededCapacityError";var wx=class extends So("ExceededCapacityError"){[bx]=bx;constructor(t){super({message:t})}},Ix="~effect/Cause/AsyncFiberError";var Hd=class extends So("AsyncFiberError"){[Ix]=Ix;constructor(t){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:t})}},vx="~effect/Cause/UnknownError";var Li=class extends So("UnknownError"){[vx]=vx;constructor(t,n){super({message:n,cause:t})}},hy=pe("effect/Console/CurrentConsole",{defaultValue:()=>globalThis.console}),nL=e=>{switch(e){case"All":return Number.MIN_SAFE_INTEGER;case"Fatal":return 5e4;case"Error":return 4e4;case"Warn":return 3e4;case"Info":return 2e4;case"Debug":return 1e4;case"Trace":return 0;case"None":return Number.MAX_SAFE_INTEGER}},rL=Og(Pn,nL),pk=ds(rL),gy=pe("effect/Loggers/CurrentLoggers",{defaultValue:()=>new Set([fL,lL])}),oL=pe("effect/Logger/LogToStderr",{defaultValue:iu}),mk=function(){let e=typeof arguments[0]=="string"?[[arguments[0],arguments[1]]]:Object.entries(arguments[0]);return Po(te(t=>{let n=t.getRef(To),r={...n};for(let o=0;o<e.length;o++){let[s,a]=e[o];M(r,s,a)}return t.setContext(Nt(t.context,To,r)),Er(xr(t.context,Cs),o=>{let s=t.getRef(To),a={...s};for(let i=0;i<e.length;i++){let[c,u]=e[i];s[c]===u&&(Object.hasOwn(n,c)?M(a,c,n[c]):delete a[c])}return t.setContext(Nt(t.context,To,a)),ie})}))},sL="~effect/Logger",aL={[sL]:{_Message:F,_Output:F},pipe(){return ne(this,arguments)}},hk=e=>{let t=Object.create(aL);return t.log=e,t},iL=e=>e.replace(/[\s="]/g,"_"),cL=(e,t)=>`${iL(e[0])}=${t-e[1]}ms`;var wr=e=>(...t)=>{let n;for(let r=0,o=t.length;r<o;r++){let s=t[r];vi(s)&&(n?t.splice(r,1):t=t.slice(0,r).concat(t.slice(r+1)),n=n?xo(n.reasons.concat(s.reasons)):s,r--)}return n===void 0&&(n=gd),te(r=>{let o=e??r.currentLogLevel;if(pk(r.minimumLogLevel,o))return ie;let s=r.getRef(Fo),a=r.getRef(gy);if(a.size>0){let i=new Date(s.currentTimeMillisUnsafe());for(let c of a)c.log({cause:n,fiber:r,date:i,logLevel:o,message:t})}return ie})};var Sa={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},f8={None:[],All:[],Trace:[Sa.gray],Debug:[Sa.blue],Info:[Sa.green],Warn:[Sa.yellow],Error:[Sa.red],Fatal:[Sa.bgBrightRed,Sa.black]};var uL=e=>`${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}.${e.getMilliseconds().toString().padStart(3,"0")}`;var fL=hk(({cause:e,date:t,fiber:n,logLevel:r,message:o})=>{let s=Array.isArray(o)?o.slice():[o];e.reasons.length>0&&s.push(Kd(e));let a=t.getTime(),i=n.getRef(Ud),c="";for(let d of i)c+=` ${cL(d,a)}`;let u=n.getRef(To);Object.keys(u).length>0&&s.push(u);let f=n.getRef(hy);(n.getRef(oL)?f.error:f.log)(`[${uL(t)}] ${r.toUpperCase()} (#${n.id})${c}:`,...s)}),lL=hk(({cause:e,fiber:t,logLevel:n,message:r})=>{let o=t.getRef(Fo),s=t.getRef(To),a=t.currentSpan;if(a===void 0||a._tag==="ExternalSpan")return;let i={};for(let[c,u]of Object.entries(s))M(i,c,u);i["effect.fiberId"]=t.id,i["effect.logLevel"]=n.toUpperCase(),e.reasons.length>0&&(i["effect.cause"]=Kd(e)),a.event(mv(Array.isArray(r)&&r.length===1?r[0]:r),o.currentTimeNanosUnsafe(),i)});function dL(){dx.interruptChildren??=U2}var xy=N(void 0);var gk=p(e=>ee(e[0]),(e,t)=>ty(e,n=>te(r=>(pL(r,n,t?.defectsOnly),ie)))),pL=(e,t,n)=>{let r=e.getRef(U0);if(r.size===0||n&&!K0(t))return;let o={cause:t,fiber:e,timestamp:e.getRef(Fo).currentTimeNanosUnsafe()};r.forEach(s=>s.report(o))};var xk=vi,yk=Sv,lp=ca;var Gi=xo,Sk=gd,Ek=xu;var dp=e=>new aa(e),pp=e=>new hu(e),mp=H0,hp=Z0,Ts=Y0;var Vu=Gd;var bk=Kd;var yy=wu;var gp=Ci,mt=Iv;var xp=Wd;var wk=Li;var le={};jr(le,{Do:()=>bj,Transaction:()=>Yi,TypeId:()=>pj,abortSignal:()=>OB,acquireDisposable:()=>yB,acquireRelease:()=>sr,acquireUseRelease:()=>jO,addFinalizer:()=>Up,all:()=>OO,andThen:()=>Ln,annotateCurrentSpan:()=>LB,annotateLogs:()=>gq,annotateLogsScoped:()=>xq,annotateSpans:()=>UB,as:()=>jn,asSome:()=>PO,asVoid:()=>lf,awaitAllChildren:()=>XB,bind:()=>vj,bindTo:()=>wj,cached:()=>IB,cachedInvalidateWithTTL:()=>CB,cachedWithTTL:()=>vB,callback:()=>Wt,catch:()=>rr,catchCause:()=>Bn,catchCauseFilter:()=>$j,catchCauseIf:()=>Dj,catchDefect:()=>rS,catchEager:()=>Sf,catchFilter:()=>df,catchIf:()=>Mj,catchNoSuchElement:()=>Nj,catchReason:()=>Pj,catchReasons:()=>Rj,catchTag:()=>Mo,catchTags:()=>nS,clockWith:()=>yf,context:()=>Dp,contextWith:()=>UO,currentParentSpan:()=>BB,currentSpan:()=>jB,delay:()=>NO,die:()=>an,effectify:()=>Ge,ensuring:()=>nc,eventually:()=>qj,exit:()=>As,fail:()=>k,failCause:()=>ec,failCauseSync:()=>Os,failSync:()=>Xy,fiber:()=>eq,fiberId:()=>tq,filter:()=>aS,filterMap:()=>nB,filterMapEffect:()=>$O,filterMapOrElse:()=>oB,filterMapOrFail:()=>aB,filterOrElse:()=>rB,filterOrFail:()=>sB,findFirst:()=>xj,findFirstFilter:()=>yj,firstSuccessOf:()=>Zj,flatMap:()=>J,flatMapEager:()=>$t,flatten:()=>_O,flip:()=>_j,fn:()=>cq,fnUntraced:()=>j,fnUntracedEager:()=>Bp,forEach:()=>Pa,forever:()=>Xr,forkChild:()=>lS,forkDetach:()=>QB,forkIn:()=>sc,forkScoped:()=>ac,fromNullishOr:()=>Oj,fromOption:()=>Tj,fromResult:()=>tS,gen:()=>It,head:()=>Sj,ignore:()=>pf,ignoreCause:()=>Gj,interrupt:()=>oc,interruptible:()=>TB,interruptibleMask:()=>kB,isEffect:()=>xn,isFailure:()=>dB,isSuccess:()=>pB,let:()=>Ij,linkSpans:()=>WB,log:()=>uq,logDebug:()=>pq,logError:()=>jp,logFatal:()=>fq,logInfo:()=>dq,logTrace:()=>mq,logWarning:()=>lq,logWithLevel:()=>KO,makeSpan:()=>WO,makeSpanScoped:()=>HB,map:()=>Y,mapBoth:()=>Uj,mapBothEager:()=>kt,mapEager:()=>$o,mapError:()=>pt,mapErrorEager:()=>Ma,match:()=>_s,matchCause:()=>uB,matchCauseEager:()=>fB,matchCauseEffect:()=>iS,matchCauseEffectEager:()=>lB,matchEager:()=>cB,matchEffect:()=>Np,never:()=>Pp,onError:()=>rc,onErrorFilter:()=>EB,onErrorIf:()=>SB,onExit:()=>Do,onExitFilter:()=>wB,onExitIf:()=>bB,onExitPrimitive:()=>BO,onInterrupt:()=>qO,option:()=>Aj,orDie:()=>or,orElseSucceed:()=>Jj,partition:()=>mj,promise:()=>AO,provide:()=>cS,provideContext:()=>No,provideService:()=>Qr,provideServiceEffect:()=>uS,race:()=>tB,raceAll:()=>DO,raceAllFirst:()=>eB,raceFirst:()=>Fa,reduce:()=>hj,repeat:()=>AB,repeatOrElse:()=>_B,replicate:()=>PB,replicateEffect:()=>RB,request:()=>ZB,requestUnsafe:()=>YB,result:()=>Rp,retry:()=>zj,retryOrElse:()=>Wj,runCallback:()=>rq,runCallbackWith:()=>nq,runFork:()=>eo,runForkWith:()=>xf,runPromise:()=>HO,runPromiseExit:()=>Lp,runPromiseExitWith:()=>oq,runPromiseWith:()=>GO,runSync:()=>sq,runSyncExit:()=>Rs,runSyncExitWith:()=>iq,runSyncWith:()=>aq,sandbox:()=>Hj,satisfiesErrorType:()=>_q,satisfiesServicesType:()=>Pq,satisfiesSuccessType:()=>Aq,schedule:()=>FB,scheduleFrom:()=>zO,scope:()=>mf,scoped:()=>Ps,scopedWith:()=>fS,service:()=>LO,serviceOption:()=>$p,setContext:()=>mB,sleep:()=>Mp,spanAnnotations:()=>qB,spanLinks:()=>zB,succeed:()=>b,succeedNone:()=>Ra,succeedSome:()=>Qy,suspend:()=>Te,sync:()=>ue,tap:()=>tc,tapCause:()=>Fp,tapCauseFilter:()=>Bj,tapCauseIf:()=>jj,tapDefect:()=>MO,tapError:()=>oS,tapErrorTag:()=>Lj,timed:()=>Xj,timeout:()=>Yj,timeoutOption:()=>Qj,timeoutOrElse:()=>sS,tracer:()=>MB,track:()=>Sq,trackDefects:()=>wq,trackDuration:()=>Iq,trackErrors:()=>bq,trackSuccesses:()=>Eq,transposeOption:()=>kj,try:()=>gt,tryPromise:()=>Xi,tx:()=>vq,txRetry:()=>Oq,undefined:()=>Ej,uninterruptible:()=>hf,uninterruptibleMask:()=>gf,unwrapReason:()=>Fj,updateContext:()=>hB,updateService:()=>gB,updateServiceScoped:()=>xB,useSpan:()=>GB,validate:()=>gj,void:()=>ge,when:()=>iB,whileLoop:()=>Qi,withErrorReporting:()=>Vj,withExecutionPlan:()=>Kj,withFiber:()=>ff,withLogSpan:()=>yq,withLogger:()=>hq,withParentSpan:()=>JB,withSpan:()=>KB,withSpanScoped:()=>VB,withTracer:()=>NB,withTracerEnabled:()=>DB,withTracerTiming:()=>$B,yieldNow:()=>eS,yieldNowWith:()=>Cj,zip:()=>RO,zipWith:()=>FO});var Ik=bg,Ir=Me,er=Bt,vr=Jn;var tr=rn;var ht=Lu,Ju=TC;var mL="~effect/Deferred";var hL={[mL]:{_A:F,_E:F},pipe(){return ne(this,arguments)}},yp=()=>{let e=Object.create(hL);return e.resumes=void 0,e.effect=void 0,e};var Ta=e=>bt(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),B(()=>{let n=e.resumes;if(n===void 0)return;let r=n.indexOf(t);r>=0&&n.splice(r,1)})));var gL=p(2,(e,t)=>B(()=>Ey(e,t))),vk=gL;var Sy=e=>B(()=>xL(e)),xL=e=>e.effect!==void 0;var Ey=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){let n=e.resumes;e.resumes=void 0;for(let r=0;r<n.length;r++)n[r](t)}return!0};var Ck=To;var Tk=Ud;var kk=$d;var Zu=Cs;var Ki=zu,Yu=fT,Sp=Er,Qu=uT;var ks=cT,$n=Jx;var Pk="~effect/Layer",Ak="~effect/Layer/MemoMap",yL=(e,t)=>(e.observers++,Sr(Er(t,n=>e.finalizer(n)),e.effect)),Rk=e=>_(e,Pk),SL={[Pk]:{_ROut:F,_E:F,_RIn:F},pipe(){return ne(this,arguments)}},Fk=e=>{let t=Object.create(SL);return t.build=e,t},wy=e=>Fk((t,n)=>{let r=ks(n);return Dt(e(t,r),o=>o._tag==="Failure"?$n(r,o):ie)}),EL=e=>{let t=wy((n,r)=>n.getOrElseMemoize(t,r,e));return t},bL=(e,t,n,r)=>{let o=Ki(),s=yp(),a={observers:1,effect:Ta(s),finalizer:i=>X(()=>(a.observers--,a.observers===0?(e.map.delete(t),$n(o,i)):ie))};return e.map.set(t,a),Er(n,a.finalizer).pipe(z(()=>r(e,o)),Dt(i=>(a.effect=i,vk(s,i))))},Ep=class{get[Ak](){return Ak}parent;constructor(t){this.parent=t}map=new Map;get(t,n){let r=this.map.get(t);return r?yL(r,n):this.parent?.get(t,n)}getOrElseMemoize(t,n,r){return X(()=>{let o=this.get(t,n);return o||bL(this,t,n,r)})}},Iy=()=>new Ep,wL=e=>new Ep(e);var ef=class e extends He()("effect/Layer/CurrentMemoMap"){static forkOrCreate(t){let n=wd(t,e);return n?wL(n):Iy()}},vy=p(3,(e,t,n)=>on(ke(e.build(t,n),Nt(ef,t)),ef,t));var Mk=p(2,(e,t)=>te(n=>vy(e,ef.forkOrCreate(n.context),t))),Zr=function(){return arguments.length===1?e=>bp(wo(arguments[0],e)):bp(wo(arguments[0],arguments[1]))},bp=e=>Fk(ot(N(e)));var Vi=function(){return arguments.length===1?e=>_k(arguments[0],e):_k(arguments[0],arguments[1])},_k=(e,t)=>IL(ke(t,n=>wo(e,n))),IL=e=>EL((t,n)=>Yu(e,n));var Nk=(e,t,n)=>{let r=ks(n,"parallel");return Mn(e,o=>o.build(t,ks(r,"sequential")),{concurrency:e.length}).pipe(ke(o=>Yv(...o)))},wp=(...e)=>wy((t,n)=>Nk(e,t,n));var Dk=(e,t,n)=>wy((r,o)=>z(Array.isArray(t)?Nk(t,r,o):t.build(r,o),s=>e.build(r,o).pipe(Ao(s),ke(a=>n(a,s))))),$k=p(2,(e,t)=>Dk(e,t,F)),Uk=p(2,(e,t)=>Dk(e,t,(n,r)=>da(r,n)));var Lk="~effect/ExecutionPlan";var vL={[Lk]:Lk,get captureRequirements(){let e=this;return vs(t=>N(CL(e.steps.map(n=>({...n,provide:Rk(n.provide)?$k(n.provide,bp(t)):n.provide})))))},pipe(){return ne(this,arguments)}},CL=e=>{let t=Object.create(vL);return t.steps=e,t};var jk=pe("effect/ExecutionPlan/CurrentMetadata",{defaultValue:ot({attempt:0,stepIndex:0})});var Ip="~effect/time/DateTime",vp="~effect/time/DateTime/TimeZone",zk={[Ip]:Ip,pipe(){return ne(this,arguments)},[dt](){return this.toString()},toJSON(){return of(this).toJSON()}},_L={...zk,_tag:"Utc",[me](){return mn(this.epochMilliseconds)},[he](e){return Ji(e)&&e._tag==="Utc"&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${of(this).toJSON()})`}},PL={...zk,_tag:"Zoned",[me](){return st(mn(this.epochMilliseconds))(Z(this.zone))},[he](e){return Ji(e)&&e._tag==="Zoned"&&this.epochMilliseconds===e.epochMilliseconds&&K(this.zone,e.zone)},toString(){return`DateTime.Zoned(${$y(this)})`}},Wk={[vp]:vp,[dt](){return this.toString()}},RL={...Wk,_tag:"Named",[me](){return Fe(`Named:${this.id}`)},[he](e){return Oa(e)&&e._tag==="Named"&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:"TimeZone",_tag:"Named",id:this.id}}},FL={...Wk,_tag:"Offset",[me](){return Fe(`Offset:${this.offset}`)},[he](e){return Oa(e)&&e._tag==="Offset"&&this.offset===e.offset},toString(){return`TimeZone.Offset(${My(this.offset)})`},toJSON(){return{_id:"TimeZone",_tag:"Offset",offset:this.offset}}},Yr=(e,t,n)=>{let r=Object.create(PL);return r.epochMilliseconds=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},Ji=e=>_(e,Ip);var Oa=e=>_(e,vp),Hk=e=>Oa(e)&&e._tag==="Offset",Gk=e=>Oa(e)&&e._tag==="Named",Kk=e=>e._tag==="Utc",ky=e=>e._tag==="Zoned",Vk=Tt((e,t)=>e.epochMilliseconds===t.epochMilliseconds),Jk=ua((e,t)=>e.epochMilliseconds<t.epochMilliseconds?-1:e.epochMilliseconds>t.epochMilliseconds?1:0);var Zk=e=>{let t=Object.create(_L);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},ka=e=>{let t=e.getTime();if(Number.isNaN(t))throw new xp("Invalid date");return Zk(t)},Oy=e=>{if(Ji(e))return e;if(e instanceof Date)return ka(e);if(typeof e=="object"){if("epochMilliseconds"in e)return ka(new Date(e.epochMilliseconds));let t=new Date(0);return BL(t,e),ka(t)}else if(typeof e=="string"&&!ML(e))return ka(new Date(e+"Z"));return ka(new Date(e))},ML=e=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),NL=-864e13+720*60*1e3,DL=864e13-840*60*1e3,Ay=(e,t)=>{let n=t?.timeZone;if(n===void 0&&Ji(e)&&ky(e))return e;let r=Oy(e);if(r.epochMilliseconds<NL||r.epochMilliseconds>DL)throw new RangeError(`Epoch millis out of range: ${r.epochMilliseconds}`);n===void 0&&typeof e=="object"&&"timeZoneId"in e&&(n=e.timeZoneId);let o;if(n===void 0){let s=new Date(r.epochMilliseconds).getTimezoneOffset()*-60*1e3;o=rf(s)}else if(Oa(n))o=n;else if(typeof n=="number")o=rf(n);else{let s=Ry(n);if(Ne(s))throw new xp(`Invalid time zone: ${n}`);o=s.value}return t?.adjustForTimeZone!==!0?Yr(r.epochMilliseconds,o,r.partsUtc):qL(r.epochMilliseconds,o,t?.disambiguation??"compatible")},Cy=la(Ay),Yk=la(Oy),$L=/^(.{17,35})\[(.+)\]$/,Qk=e=>{let t=$L.exec(e);if(t===null){let o=Dy(e);return o!==null?Cy(e,{timeZone:o}):O()}let[,n,r]=t;return Cy(n,{timeZone:r})};var Xk=e=>Zk(e.epochMilliseconds);var nf=new Map,UL={day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"longOffset",fractionalSecondDigits:3,hourCycle:"h23"},LL=e=>{let t=e.resolvedOptions().timeZone;if(nf.has(t))return nf.get(t);let n=Object.create(RL);return n.id=t,n.format=e,nf.set(t,n),n},_y=e=>{if(nf.has(e))return nf.get(e);try{return LL(new Intl.DateTimeFormat("en-US",{...UL,timeZone:e}))}catch{throw new xp(`Invalid time zone: ${e}`)}},rf=e=>{let t=Object.create(FL);return t.offset=e,t},Py=la(_y);var jL=/^(?:GMT|[+-])/,Ry=e=>{if(jL.test(e)){let t=Dy(e);return t===null?O():R(rf(t))}return Py(e)},eO=e=>e._tag==="Offset"?My(e.offset):e.id;var of=e=>new Date(e.epochMilliseconds),Cp=e=>{if(e._tag==="Utc")return new Date(e.epochMilliseconds);if(e.zone._tag==="Offset")return new Date(e.epochMilliseconds+e.zone.offset);if(e.adjustedEpochMilliseconds!==void 0)return new Date(e.adjustedEpochMilliseconds);let t=e.zone.format.formatToParts(e.epochMilliseconds).filter(r=>r.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.adjustedEpochMilliseconds=n.getTime(),n},Fy=e=>Cp(e).getTime()-Ny(e),My=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")}`},tO=e=>My(Fy(e)),Ny=e=>e.epochMilliseconds;var BL=(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.hour!==void 0&&e.setUTCHours(t.hour),t.minute!==void 0&&e.setUTCMinutes(t.minute),t.second!==void 0&&e.setUTCSeconds(t.second),t.millisecond!==void 0&&e.setUTCMilliseconds(t.millisecond)};var qk=1440*60*1e3,qL=(e,t,n)=>{if(t._tag==="Offset")return Yr(e-t.offset,t);let r=tf(e-qk,e,t),o=tf(e+qk,e,t);if(r===o)return Yr(e-r,t);let s=r<o,a=r-o;if(s){if(tf(e-o,e,t)===o)return Yr(e-o,t);let u=Yr(e-r,t),f=Cp(u).getTime();if(e!==f)switch(n){case"reject":{let l=new Date(e).toISOString();throw new RangeError(`Gap time: ${l} does not exist in time zone ${t.id}`)}case"earlier":return Yr(e-o,t);case"compatible":case"later":return u}return u}if(tf(e-r,e,t)===r){if(n==="earlier"||n==="compatible"||tf(e-r+a,e+a,t)===r)return Yr(e-r,t);if(n==="reject"){let u=new Date(e).toISOString();throw new RangeError(`Ambiguous time: ${u} occurs twice in time zone ${t.id}`)}}return Yr(e-o,t)},zL=/([+-])(\d{2}):(\d{2})$/,Dy=e=>{let t=zL.exec(e);if(t===null)return null;let[,n,r,o]=t;return(n==="+"?1:-1)*(Number(r)*60+Number(o))*60*1e3},tf=(e,t,n)=>{let r=n.format.formatToParts(e).find(s=>s.type==="timeZoneName")?.value??"";if(r==="GMT")return 0;let o=Dy(r);return o===null?Fy(Yr(t,n)):o};var nO=e=>of(e).toISOString();var Ty=e=>{let t=Cp(e);return e._tag==="Utc"?t.toISOString():`${t.toISOString().slice(0,-1)}${tO(e)}`},$y=e=>e.zone._tag==="Offset"?Ty(e):`${Ty(e)}[${e.zone.id}]`;var Z8=globalThis.Number;var oO=p(2,(e,t)=>{let n=e.toString(),r=t.toString();if(n.includes("e")||r.includes("e"))return!globalThis.Number.isFinite(e)||!globalThis.Number.isFinite(t)||t===0?NaN:HL(e,t);let o=(n.split(".")[1]||"").length,s=(r.split(".")[1]||"").length,a=o>s?o:s,i=parseInt(e.toFixed(a).replace(".","")),c=parseInt(t.toFixed(a).replace(".",""));return i%c/Math.pow(10,a)});function HL(e,t){let[n,r]=rO(e),[o,s]=rO(t),a=Math.min(r,s),i=n*BigInt(10)**BigInt(r-a),c=o*BigInt(10)**BigInt(s-a),u=i%c;if(u===BigInt(0))return e<0||Object.is(e,-0)?-0:0;let f=globalThis.Number(`${u}e${a}`);return f===0?Math.sign(e)*globalThis.Number.MIN_VALUE:f}function rO(e){let t=Math.abs(e).toExponential(),n=t.indexOf("e"),r=t.slice(0,n).replace(".","");return[BigInt(r)*(e<0?-BigInt(1):BigInt(1)),globalThis.Number(t.slice(n+1))-r.length+1]}var sO=p(2,(e,t)=>{let n=Math.pow(10,t);return Math.round(e*n)/n});var aO=Eo((e,t)=>Math.max(e,t),-1/0),iO=Eo((e,t)=>Math.min(e,t),1/0);var Y8=globalThis.String;var cO=e=>e.trim();var Un=p(2,(e,t)=>Hi(e,GL,n=>t(n))),sf=e=>e.reasons.some(Ly),Ly=e=>e._tag==="Fail"&&yy(e.error),Tp=e=>{let t,n=!1;for(let r of e.reasons)Ly(r)?t??=r.error:r._tag!=="Interrupt"&&(n=!0);return t===void 0?ce(e):n?ce(Gi(e.reasons.filter(r=>!Ly(r)))):se(t)};var GL=e=>{let t=Tp(e);return Ce(t)?t:se(t.success.value)},jy=e=>{let t=Tp(e);return Ce(t)?er(t.failure):Ir(t.success.value)},kp=p(2,(e,t)=>yr(e,{onSuccess:t.onSuccess,onFailure:n=>{let r=Tp(n);return Ce(r)?t.onFailure(r.failure):t.onDone(r.success.value)}}));var fO="~effect/Schedule";var _a=pe("effect/Schedule/CurrentMetadata",{defaultValue:ot({input:void 0,output:void 0,duration:Ri,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),KL={[fO]:{_Out:F,_In:F,_Env:F},pipe(){return ne(this,arguments)}},By=e=>_(e,fO),qy=e=>{let t=Object.create(KL);return t.step=e,t},zy=()=>{let e=0,t,n;return(r,o)=>{n===void 0&&(n=r);let s=r-n,a=t===void 0?0:r-t;return t=r,{input:o,attempt:++e,start:n,now:r,elapsed:s,elapsedSincePrevious:a}}},VL=e=>qy(ke(e,t=>{let n=zy();return(r,o)=>t(n(r,o))})),Wy=e=>Nn(e.step,t=>N(()=>Pe(t))),Op=e=>Jr(t=>ke(Wy(e),n=>{let r=zy();return o=>X(()=>{let s=t.currentTimeMillisUnsafe();return z(n(s,o),([a,i])=>{let c=r(s,o);return c.output=a,c.duration=i,zt(Ca(i),c)})})}));var Hy=e=>qy(ke(Wy(e),t=>(n,r)=>kp(t(n,r),{onSuccess:o=>N([r,o[1]]),onFailure:Pe,onDone:()=>mt(r)}))),lO=e=>af(Gy,({attempt:t})=>N(t<=e)),JL=e=>{let t=Rn(e);return VL(N(n=>N([n.attempt-1,t])))};var af=p(2,(e,t)=>qy(ke(Wy(e),n=>{let r=zy();return(o,s)=>z(n(o,s),a=>{let[i,c]=a,u=t({...r(o,s),output:i,duration:c});return z(ee(u)?u:N(u),f=>f?N(a):mt(i))})})));var Gy=JL(Ri);var ZL=(e,t,n)=>ip(r=>z(n?.local?vy(t,Iy(),r):Mk(t,r),o=>Ao(e,o))),Ap=p(e=>ee(e[0]),(e,t,n)=>Ng(t)?Ao(e,t):ZL(e,Array.isArray(t)?wp(...t):t,n));var Vy=p(3,(e,t,n)=>z(Op(t),r=>{let o=_a.defaultValue();return Dn(tp(ba(z(X(()=>on(e,_a,o)),r),s=>B(()=>{o=s})),{disableYield:!0}),s=>wu(s)?N(s.value):n(s,o.attempt===0?O():R(o)))})),Jy=p(3,(e,t,n)=>z(Op(t),r=>{let o=_a.defaultValue(),s,a=Dn(X(()=>on(e,_a,o)),i=>(s=i,z(r(i),c=>(o=c,a))));return Un(a,i=>ye(()=>n(s,i)))})),pO=p(2,(e,t)=>{let n=typeof t=="function"?t(F):By(t)?t:uf(t);return Vy(e,n,ze)}),cf=p(2,(e,t)=>{let n=typeof t=="function"?t(F):By(t)?t:uf(t);return Jy(e,n,ze)}),mO=p(3,(e,t,n)=>z(Op(n),r=>{let o=_a.defaultValue(),s=X(()=>on(e,_a,o));return Dn(z(r(t),a=>{o=a;let i=ot(z(s,r));return Vr({while:An,body:i,step(c){o=c}})}),a=>wu(a)?N(a.value):ze(a))})),YL=Hy(Gy),uf=e=>{let t=e.schedule?Hy(e.schedule):YL;return e.while&&(t=af(t,({input:n})=>{let r=e.while(n);return ee(r)?r:N(r)})),e.until&&(t=af(t,({input:n})=>{let r=e.until(n);return ee(r)?ke(r,o=>!o):N(!r)})),e.times!==void 0&&(t=af(t,({attempt:n})=>N(n<=e.times))),t};var QL=(e,t)=>{let n=-1,r=0,o=s=>op(e(s));return{begin:Jr(s=>X(()=>{let a=t();a.stepIndex!==n&&(n=a.stepIndex,r=0),r++;let i={attempt:a.attempt,stepAttempt:r,stepIndex:a.stepIndex,startNanos:s.monotonicTimeNanosUnsafe()};return zt(o({_tag:"AttemptStart",attempt:i.attempt,stepAttempt:i.stepAttempt,stepIndex:i.stepIndex}),i)})),end:(s,a)=>Jr(i=>{let c=Xn(i.monotonicTimeNanosUnsafe()-s.startNanos);return o(a._tag==="Success"?{_tag:"AttemptSuccess",attempt:s.attempt,stepAttempt:s.stepAttempt,stepIndex:s.stepIndex,duration:c}:{_tag:"AttemptFailure",attempt:s.attempt,stepAttempt:s.stepAttempt,stepIndex:s.stepIndex,duration:c,cause:a.cause})})}},xO=p(e=>ee(e[0]),(e,t,n)=>X(()=>{let r=0,o={attempt:0,stepIndex:0},s=ep(jk,B(()=>(o={attempt:o.attempt+1,stepIndex:r},o))),a=n?.onEvent===void 0?void 0:QL(n.onEvent,()=>o),i=a===void 0?F:u=>br(f=>z(a.begin,l=>Dt(f(u),d=>a.end(l,d)))),c;return z(Vr({while:()=>r<t.steps.length&&(c===void 0||Ce(c)),body(){let u=t.steps[r],f=s(i(Ap(e,u.provide)));if(c){let l=!1,d=f;f=X(()=>l?d:(l=!0,Bi(c))),f=cf(f,gO(u,!1))}else{let l=gO(u,!0);f=l?cf(f,l):f}return Es(f)},step(u){c=u,r++}}),()=>Bi(c))})),gO=(e,t)=>{if(t){if(e.attempts===1||!(e.schedule||e.attempts))return}else return uf({schedule:e.schedule?e.schedule:e.attempts?void 0:XL,times:e.attempts,while:e.while});return uf({schedule:e.schedule,while:e.while,times:e.attempts?e.attempts-1:void 0})},XL=lO(1);var tj="~effect/Request",nj=xg({_E:e=>e,_A:e=>e,_R:e=>e}),p9={...yv,[tj]:nj};var yO=e=>e;var EO=p(2,(e,t)=>{let n=r=>bt(o=>{let s=wO(r,e,o,ws());return oj(r,s)});return ee(t)?z(t,n):n(t)}),bO=(e,t)=>{let n=wO(t.resolver,e,t.onExit,{context:t.context,currentScheduler:Xt(t.context,_u)});return()=>IO(t.resolver,n)},_p=[],Zy=new WeakMap,wO=(e,t,n,r)=>{let o=Zy.get(e);o||(o=new Map,Zy.set(e,o));let s,a=!1,i=yO({request:t,context:r.context,uninterruptible:!1,completeUnsafe(u){a||(a=!0,n(u),s?.entrySet.delete(i))}});if(e.preCheck!==void 0&&!e.preCheck(i))return i;let c=e.batchKey(i);if(s=o.get(c),!s){if(_p.length>0)s=_p.pop(),s.key=c,s.resolver=e,s.map=o;else{let u={key:c,resolver:e,map:o,entrySet:new Set,entries:new Set,delayEffect:z(X(()=>u.resolver.delay),f=>SO(u)),run:Dt(X(()=>u.resolver.runAll(Array.from(u.entries),u.key)),f=>{for(let l of u.entrySet)l.completeUnsafe(f._tag==="Success"?Gr(new Error("Effect.request: RequestResolver did not complete request",{cause:l.request})):f);return u.entries.clear(),_p.length<128&&(u.entrySet.clear(),u.key=void 0,u.fiber=void 0,u.resolver=void 0,u.map=void 0,_p.push(u)),ie})};s=u}o.set(c,s),s.fiber=Ro(r.context)(s.delayEffect,{scheduler:r.currentScheduler})}return s.entrySet.add(i),s.entries.add(i),s.resolver.collectWhile(s.entries)||(s.fiber.interruptUnsafe(r.id),s.fiber=Ro(r.context)(SO(s),{scheduler:r.currentScheduler})),i},IO=(e,t)=>{if(t.uninterruptible)return;let n=Zy.get(e);if(!n)return;let r=e.batchKey(t),o=n.get(r);o&&(o.entries.delete(t),o.entrySet.delete(t),o.entries.size===0&&(n.delete(r),o.fiber?.interruptUnsafe()))},oj=(e,t)=>B(()=>IO(e,t));function SO(e){return e.map.has(e.key)?(e.map.delete(e.key),e.run):ie}var aj="effect/Metric/CurrentMetricAttributes",ij=pe(aj,{defaultValue:()=>({})}),cj="~effect/observability/Metric/MetricRegistryKey",uj=pe(cj,{defaultValue:()=>new Map}),vO="~effect/observability/Metric",CO=class{[vO]=vO;#t=new WeakMap;#e;id;description;attributes;constructor(t,n,r){this.id=t,this.description=n,this.attributes=r}valueUnsafe(t){return this.hook(t).get(t)}modifyUnsafe(t,n){return this.hook(n).modify(t,n)}updateUnsafe(t,n){return this.hook(n).update(t,n)}hook(t){let n=Xt(t,ij);if(Object.keys(n).length===0)return _e(this.#e)?this.#e.hooks:(this.#e=this.getOrCreate(t,this.attributes),this.#e.hooks);let r=dj(this.attributes,n),o=this.#t.get(r);return _e(o)||(o=this.getOrCreate(t,r),this.#t.set(r,o)),o.hooks}getOrCreate(t,n){let r=fj(this,n),o=Xt(t,uj);if(o.has(r))return o.get(r);let s=this.createHooks(),a={id:this.id,type:this.type,description:this.description,attributes:Yy(n),hooks:s};return o.set(r,a),a}pipe(){return ne(this,arguments)}};var Zi=p(2,(e,t)=>vs(n=>B(()=>e.updateUnsafe(t,n))));function fj(e,t){let n=`${e.type}:${e.id}`;return _e(e.description)&&(n+=`:${e.description}`),_e(t)&&(n+=`:${lj(t)}`),n}function lj(e){return JSON.stringify(Array.isArray(e)?e:Object.entries(e))}function dj(e,t){return{...Yy(e),...Yy(t)}}function Yy(e){return _e(e)&&Array.isArray(e)?e.reduce((t,[n,r])=>(M(t,n,r),t),{}):e}var pj=Hr,xn=ee,OO=Gu,mj=ay,hj=bT,gj=wT,xj=IT,yj=CT,Pa=Mn,Sj=kT,Qi=Vr,AO=_x,Xi=uC,b=N,Ra=Ea,Qy=Ax,Te=X,ue=B,ge=ie;var Ej=xy;var Wt=bt,Pp=Qd,bj=FT,wj=MT,Ij=DT;var vj=NT,It=pC,k=ze,Xy=Yd,ec=Pe,Os=iC,an=Is,gt=cC;var eS=qi,Cj=Ox,ff=te,tS=Bi,Tj=kx,kj=aC,Oj=sC,J=z,_O=bC,Ln=Sr,tc=ba,Rp=Es,Aj=eT,As=qu,Y=ke,jn=zt,PO=zi,lf=Uu,_j=gC,RO=$C,FO=Ux,rr=Dn;var Mo=qx,nS=KC,Pj=VC,Rj=JC,Fj=ZC,Bn=Nn,rS=qC,Mj=ju,df=rp,Nj=BC,Dj=jx,$j=Hi,pt=zx,Uj=Wx,or=Hx,oS=Bx,Lj=HC,Fp=zC,jj=WC,Bj=np,MO=GC,qj=Gx,zj=cf,Wj=Jy,Hj=xC,pf=XC,Gj=op,Kj=xO,Vj=gk,Jj=YC,Zj=QC,Yj=sT,Qj=aT,sS=Vx,NO=oT,Mp=Ca,Xj=iT,DO=Mx,eB=Nx,tB=yC,Fa=Xd,aS=_T,nB=PT,$O=RT,rB=iy,oB=cy,sB=UC,aB=AT,iB=LC,_s=sp,cB=Bu,uB=Kx,fB=tT,lB=SC,iS=yr,Np=wa,dB=nT,pB=rT,Dp=$x,UO=vs,cS=Ap,No=Ao,mB=DC,LO=FC,$p=MC,hB=Wi,gB=Oo,xB=NC,Qr=on,uS=ep,mf=Wu,Ps=Yx,fS=ip,sr=Ia,yB=mT,jO=Hu,Up=Qx,nc=lT,rc=ty,SB=dT,EB=ny,BO=_o,Do=Dt,bB=Xx,wB=ey,IB=hT,vB=oy,CB=ry,oc=gT,TB=sy,qO=pT,hf=Po,gf=br,kB=ST,OB=ET,Xr=tp,AB=pO,_B=Vy,PB=Lx,RB=jC,FB=p(2,(e,t)=>zO(e,void 0,t)),zO=mO,MB=VT,NB=JT,DB=ZT,$B=YT,UB=ak,LB=ik,jB=ck,BB=uk,qB=tk,zB=nk,WB=rk,WO=XT,HB=Du,GB=$u,KB=sk,VB=ek,JB=Ui,ZB=EO,YB=bO,lS=$T,sc=uy,ac=jT,QB=UT,XB=LT,eq=lC,tq=dC,eo=qT,xf=Ro,nq=fy,rq=zT,HO=HT,GO=ly,Lp=WT,oq=up,sq=KT,aq=dy,Rs=GT,iq=fp,j=Rx,cq=mC,yf=Jr,KO=wr,uq=wr(),fq=wr("Fatal"),lq=wr("Warn"),jp=wr("Error"),dq=wr("Info"),pq=wr("Debug"),mq=wr("Trace"),hq=p(2,(e,t)=>Oo(e,gy,n=>new Set([...n,t]))),gq=p(e=>xn(e[0]),(e,...t)=>Oo(e,Ck,n=>{let r=t.length===1?{...n,...t[0]}:{...n};return t.length===1||M(r,t[0],t[1]),r})),xq=mk,yq=p(2,(e,t)=>z(dk,n=>Oo(e,Tk,r=>[[t,n],...r]))),Sq=p(e=>xn(e[0]),(e,t,n)=>Do(e,r=>{let o=n===void 0?r:ye(()=>n(r));return Zi(t,o)})),Eq=p(e=>xn(e[0]),(e,t,n)=>tc(e,r=>{let o=n===void 0?r:n(r);return Zi(t,o)})),bq=p(e=>xn(e[0]),(e,t,n)=>oS(e,r=>{let o=n===void 0?r:ye(()=>n(r));return Zi(t,o)})),wq=p(e=>xn(e[0]),(e,t,n)=>MO(e,r=>{let o=n===void 0?r:ye(()=>n(r));return Zi(t,o)})),Iq=p(e=>xn(e[0]),(e,t,n)=>yf(r=>{let o=r.monotonicTimeNanosUnsafe();return Do(e,()=>{let s=r.monotonicTimeNanosUnsafe(),a=S0(Rn(s),Rn(o)),i=n===void 0?a:ye(()=>n(a));return Zi(t,i)})})),Yi=class extends He()("effect/Effect/Transaction"){},vq=e=>ff(t=>{let n=wd(t.context,Yi);if(n)return e;n={journal:new Map,retry:!1};let r;return gf(o=>J(Qi({while:()=>!r,body:ot(o(e).pipe(Qr(Yi,n),Fp(()=>n.retry?o(Tq(n)):ge),As)),step(s){if(n.retry||!Cq(n))return kO(n);ht(s)?kq(t,n):kO(n),r=s}}),()=>r))}),Cq=e=>{for(let[t,{version:n}]of e.journal)if(t.version!==n)return!1;return!0},Tq=e=>Te(()=>{let t={},n=Array.from(e.journal.keys()),r=()=>{for(let o of n)o.pending.delete(t)};return Wt(o=>{let s=()=>{r(),o(ge)};for(let a of n)a.pending.set(t,s);return ue(r)})});function kq(e,t){for(let[n,{value:r}]of t.journal){r!==n.value&&(n.version=n.version+1,n.value=r);for(let o of n.pending.values())e.currentDispatcher.scheduleTask(o,0);n.pending.clear()}}function kO(e){e.retry=!1,e.journal.clear()}var Oq=J(Yi,e=>(e.retry=!0,oc)),Ge=(e,t,n)=>(...r)=>Wt(o=>{try{e(...r,(s,a)=>{o(s?k(t?t(s,r):s):b(a))})}catch(s){o(n?k(n(s,r)):an(s))}}),Aq=()=>e=>e,_q=()=>e=>e,Pq=()=>e=>e,$o=wC,Ma=IC,kt=vC,$t=EC,Sf=CC,Bp=hC;var VO=(e,t)=>ht(e)?t(0):hp(e.cause)?t(130):t(JO(Vu(e.cause))),dS=e=>p(t=>xn(t[0]),(t,n)=>{let r=n?.disableErrorReporting===!0?eo(t):eo(Fp(t,s=>hp(s)?ge:ZO(Vu(s))?jp(s):ge));try{let s=globalThis.setInterval(ho,2147483647);r.addObserver(()=>{clearInterval(s)})}catch{}let o=n?.teardown??VO;return e({fiber:r,teardown:o})}),Ef="~effect/Runtime/errorExitCode",JO=e=>{if(typeof e=="object"&&e!==null&&Ef in e){let t=e[Ef];if(typeof t=="number")return t}return 1},Fs="~effect/Runtime/errorReported",ZO=e=>{if(typeof e=="object"&&e!==null&&Fs in e){let t=e[Fs];if(typeof t=="boolean")return t}return!0};var YO=dS(({fiber:e,teardown:t})=>{let n=!1;e.addObserver(o=>{process.removeListener("SIGINT",r),process.removeListener("SIGTERM",r),t(o,s=>{(n||s!==0)&&process.exit(s)})});function r(){n=!0,e.interruptUnsafe(e.id)}process.on("SIGINT",r),process.on("SIGTERM",r)});var QO=YO;var zo={};jr(zo,{FileSystem:()=>kr,FileTypeId:()=>pc,GiB:()=>wz,KiB:()=>Ez,MiB:()=>bz,PiB:()=>Cz,Size:()=>cn,TiB:()=>Iz,WatchBackend:()=>Mf,isFile:()=>kz,layerNoop:()=>Tz,make:()=>RS,makeNoop:()=>n_});var XO="~effect/platform/PlatformError",to=class extends xs("BadArgument"){get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:""}`}},pS=class extends Qg{get message(){return`${this._tag}: ${this.module}.${this.method}${this.pathOrDescriptor!==void 0?` (${this.pathOrDescriptor})`:""}${this.description?`: ${this.description}`:""}`}},qp=class extends xs("PlatformError"){constructor(t){"cause"in t?super({reason:t,cause:t.cause}):super({reason:t})}[XO]=XO;get message(){return this.reason.message}},qn=e=>new qp(new pS(e)),Uo=e=>new qp(new to(e));var eA="~effect/collections/Chunk";function Nq(e,t,n,r,o){for(let s=t;s<Math.min(e.length,t+o);s++)n[r+s-t]=e[s];return n}var tA=[],hS=e=>Tt((t,n)=>t.length===n.length&&wf(t).every((r,o)=>e(r,If(n,o)))),Dq=hS(K),$q={[eA]:{_A:e=>e},toString(){return`Chunk(${D(wf(this))})`},toJSON(){return{_id:"Chunk",values:Ct(wf(this))}},[dt](){return this.toJSON()},[he](e){return zp(e)&&Dq(this,e)},[me](){return Si(wf(this))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return tA[Symbol.iterator]();default:return wf(this)[Symbol.iterator]()}},pipe(){return ne(this,arguments)}},gS=e=>{let t=Object.create($q);switch(t.backing=e,e._tag){case"IEmpty":{t.length=0,t.depth=0,t.left=t,t.right=t;break}case"IConcat":{t.length=e.left.length+e.right.length,t.depth=1+Math.max(e.left.depth,e.right.depth),t.left=e.left,t.right=e.right;break}case"IArray":{t.length=e.array.length,t.depth=0,t.left=Lo,t.right=Lo;break}case"ISingleton":{t.length=1,t.depth=0,t.left=Lo,t.right=Lo;break}case"ISlice":{t.length=e.length,t.depth=e.chunk.depth+1,t.left=Lo,t.right=Lo;break}}return t},zp=e=>_(e,eA),Lo=gS({_tag:"IEmpty"}),Uq=()=>Lo;var Lq=e=>gS({_tag:"ISingleton",a:e}),Wp=e=>zp(e)?e:Bq(St(e)),mS=(e,t,n)=>{switch(e.backing._tag){case"IArray":{Nq(e.backing.array,0,t,n,e.length);break}case"IConcat":{mS(e.left,t,n),mS(e.right,t,n+e.left.length);break}case"ISingleton":{t[n]=e.backing.a;break}case"ISlice":{let r=0,o=n;for(;r<e.length;)t[o]=If(e,r),r+=1,o+=1;break}}};var jq=e=>{switch(e.backing._tag){case"IEmpty":return tA;case"IArray":return e.backing.array;default:{let t=new Array(e.length);return mS(e,t,0),e.backing={_tag:"IArray",array:t},e.left=Lo,e.right=Lo,e.depth=0,t}}},wf=jq;var Bq=e=>e.length===0?Uq():e.length===1?Lq(e[0]):gS({_tag:"IArray",array:e});var If=p(2,(e,t)=>{let n=Math.floor(t);switch(e.backing._tag){case"IEmpty":throw new Error(`Index out of bounds: ${n}`);case"ISingleton":{if(t!==0)throw new Error(`Index out of bounds: ${n}`);return e.backing.a}case"IArray":{if(n>=e.length||n<0)throw new Error(`Index out of bounds: ${n}`);return e.backing.array[n]}case"IConcat":return n<e.left.length?If(e.left,n):If(e.right,n-e.left.length);case"ISlice":return If(e.backing.chunk,n+e.backing.offset)}});var nA=e=>e.length;var oA=Zd;var sA=BT;var iA=py;var uA="~effect/MutableRef",qq={[uA]:uA,...Yt,toJSON(){return{_id:"MutableRef",current:Ct(this.current)}}},fA=e=>{let t=Object.create(qq);return t.current=e,t};var zq=Symbol.for("effect/MutableList/Empty"),pA=()=>({head:void 0,tail:void 0,length:0}),dA=()=>({array:[],mutable:!0,offset:0,next:void 0}),jo=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=dA(),e.tail=e.tail.next):e.head=e.tail=dA(),e.tail.array.push(t),e.length++};var ic=e=>{e.head=e.tail=void 0,e.length=0},mA=(e,t)=>{if(t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let s=e.head.array;return ic(e),s}let n=new Array(t),r=0,o=e.head;for(;o;){for(;o.offset<o.array.length;)if(n[r++]=o.array[o.offset],o.mutable&&(o.array[o.offset]=void 0),o.offset++,r===t)return e.head=o,e.length-=t,e.length===0&&ic(e),n;o=o.next}return ic(e),n};var cc=e=>{if(!e.head)return zq;let t=e.head.array[e.head.offset];return e.head.mutable&&(e.head.array[e.head.offset]=void 0),e.head.offset++,e.length--,e.head.offset===e.head.array.length&&(e.head.next?e.head=e.head.next:ic(e)),t};var Wq="~effect/Queue",Hq="~effect/Queue/Enqueue",Gq="~effect/Queue/Dequeue";var xS={_A:F,_E:F},Kq={[Wq]:xS,[Hq]:xS,[Gq]:xS,...Yt,toJSON(){return{_id:"effect/Queue",state:this.state._tag,size:Vq(this)}}},fc=e=>te(t=>{let n=Object.create(Kq);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??Number.POSITIVE_INFINITY,n.strategy=e?.strategy??"suspend",n.messages=pA(),n.scheduleRunning=!1,n.state={_tag:"Open",takers:new Set,offers:new Set,awaiters:new Set},N(n)}),gA=e=>fc({capacity:e});var vf=(e,t)=>X(()=>{if(e.state._tag!=="Open")return Gp;if(e.messages.length>=e.capacity)switch(e.strategy){case"dropping":return Gp;case"suspend":return e.capacity<=0&&e.state.takers.size>0?(jo(e.messages,t),SS(e),Hp):Qq(e,t);case"sliding":return cc(e.messages),jo(e.messages,t),Hp}return jo(e.messages,t),bA(e),Hp}),Cf=(e,t)=>e.state._tag!=="Open"?!1:e.messages.length>=e.capacity?e.strategy==="sliding"?(cc(e.messages),jo(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0?(jo(e.messages,t),SS(e),!0):!1:(jo(e.messages,t),bA(e),!0);var Tf=p(2,(e,t)=>B(()=>kf(e,t))),kf=(e,t)=>{if(e.state._tag!=="Open")return!1;let n=Bt(t),r=PC(n,Jq);return e.state.offers.size===0&&e.messages.length===0?(ES(e,r),!0):(e.state={...e.state,_tag:"Closing",exit:r},!0)};var Bo=e=>kf(e,xu(Ci()));var yS=e=>B(()=>{if(e.state._tag==="Done")return!0;ic(e.messages);let t=e.state.offers;if(ES(e,e.state._tag==="Open"?Zq:e.state.exit),t.size>0){for(let n of t)n._tag==="Single"?n.resume(Gp):n.resume(Me(n.remaining.slice(n.offset)));t.clear()}return!0});var xA=e=>yA(e,1,Number.POSITIVE_INFINITY);var yA=(e,t,n)=>X(()=>Yq(e,t,n)??Sr(wA(e),yA(e,1,n))),qo=e=>X(()=>EA(e)??Sr(wA(e),qo(e))),SA=e=>X(()=>{let t=EA(e);return t===void 0?N(O()):t._tag==="Success"?N(R(t.value)):N(O())});var EA=e=>{if(e.state._tag==="Done")return e.state.exit;if(e.messages.length>0){let t=cc(e.messages);return uc(e),Me(t)}else if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,uc(e),e.capacity=0;let t=cc(e.messages);return uc(e),Me(t)}};var Vq=e=>e.state._tag==="Done"?0:e.messages.length;var Gp=Me(!1),Hp=Me(!0),Jq=Jn(Ci()),Zq=Dx(),SS=e=>{if(e.scheduleRunning=!1,!(e.state._tag==="Done"||e.state.takers.size===0)){for(let t of e.state.takers)if(e.state.takers.delete(t),t(rn),e.messages.length===0)break}},bA=e=>{e.scheduleRunning||e.state._tag==="Done"||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>SS(e),0))},Yq=(e,t,n)=>{if(e.state._tag==="Done")return e.state.exit;if(n<=0||t<=0)return Me([]);if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,uc(e),e.capacity=0;let r=[cc(e.messages)];return uc(e),Me(r)}if(t=Math.min(t,e.capacity||1),t<=e.messages.length){let r=mA(e.messages,n);return uc(e),Me(r)}},Qq=(e,t)=>bt(n=>{if(e.state._tag!=="Open")return n(Gp);let r={_tag:"Single",message:t,resume:n};return e.state.offers.add(r),B(()=>{e.state._tag==="Open"&&e.state.offers.delete(r)})});var uc=e=>{if(e.state._tag==="Done")return sf(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag==="Closing"&&e.messages.length===0?(ES(e,e.state.exit),sf(e.state.exit.cause)):!1;let t=e.capacity-e.messages.length;for(let n of e.state.offers){if(t===0)break;if(n._tag==="Single")jo(e.messages,n.message),t--,n.resume(Hp),e.state.offers.delete(n);else{for(;n.offset<n.remaining.length;n.offset++){if(t===0)return!1;jo(e.messages,n.remaining[n.offset]),t--}n.resume(Me([])),e.state.offers.delete(n)}}return!1},wA=e=>bt(t=>e.state._tag==="Done"?t(e.state.exit):(e.state.takers.add(t),B(()=>{e.state._tag!=="Done"&&e.state.takers.delete(t)})));var ES=(e,t)=>{if(e.state._tag==="Done")return;let n=e.state;e.state={_tag:"Done",exit:t};for(let r of n.takers)r(t);n.takers.clear();for(let r of n.awaiters)r(t);n.awaiters.clear()};var vA=e=>new bS(e),IA=(e,t,n)=>bt(r=>{if(e.free>=t)return r(n);let o=()=>{e.free<t||(e.waiters.delete(o),r(n))};return e.waiters.add(o),B(()=>{e.waiters.delete(o)})}),bS=class{waiters=new Set;taken=0;permits;constructor(t){this.permits=t}get free(){return this.permits-this.taken}take(t){let n=X(()=>this.free<t?IA(this,t,n):(this.taken+=t,N(t)));return n}takeIfAvailable(t){return X(()=>this.free<t?N(!1):(this.taken+=t,N(!0)))}releaseUnsafe(t,n){return this.taken-=n,this.waiters.size>0&&t.currentDispatcher.scheduleTask(()=>{for(let r of this.waiters){if(this.free<=0)break;r()}},0),this.free}resize(t){return te(n=>(this.permits=t,this.free<0?ie:(this.releaseUnsafe(n,0),ie)))}release(t){return te(n=>N(this.releaseUnsafe(n,t)))}get releaseAll(){return te(t=>N(this.releaseUnsafe(t,this.taken)))}withPermits(t){return n=>br(r=>{let o=X(()=>{if(this.free<t){let s=IA(this,t,ie);return z(r(s),()=>o)}return this.taken+=t,_o(r(n),()=>{this.releaseUnsafe(ws(),t)},!0)});return o})}withPermit=this.withPermits(1);withPermitsIfAvailable(t){return n=>br(r=>this.free<t?Ea:(this.taken+=t,_o(r(zi(n)),()=>{this.releaseUnsafe(ws(),t)},!0)))}};var kA="~effect/Channel",TA=e=>_(e,kA),Xq={[kA]:{_Env:F,_InErr:F,_InElem:F,_OutErr:F,_OutElem:F},pipe(){return ne(this,arguments)}},Ht=e=>{let t=Object.create(Xq);return t.transform=(n,r)=>Bn(e(n,r),o=>b(ec(o))),t},OA=(e,t)=>Ht((n,r)=>J(Tr(e)(n,r),o=>t(o,r))),Af=e=>Ht((t,n)=>e),AA=e=>Ht(j(function*(t,n){let r=ks(n),o=a=>$n(r,jy(a)),s=yield*rc(e(t,n,r),o);return rc(s,o)})),Tr=e=>e.transform;var ez=(e,t,n)=>fc({capacity:n?.bufferSize,strategy:n?.strategy}).pipe(tc(r=>Qu(e,yS(r))),tc(r=>sc(Yu(t(r),e),e)));var _A=(e,t)=>Ht((n,r)=>Y(ez(r,e,t),xA)),PA=e=>Ht((t,n)=>Te(()=>Tr(e())(t,n)));var RA=Af(b(mt()));var FA=e=>Af(b(k(e)));var MA=p(2,(e,t)=>OA(e,n=>ue(()=>{let r=0;return Y(n,o=>t(o,r++))}))),wS=p(2,(e,t)=>tz(e,n=>b(t(n)))),tz=p(2,(e,t)=>OA(e,n=>b(Un(n,r=>J(t(r),mt)))));var NA=p(e=>TA(e[0])&&TA(e[1]),(e,t,n)=>AA(j(function*(r,o,s){let a=n?.haltStrategy??"both",i=yield*gA(0);yield*Qu(s,yS(i));let c=0;function u(l,d){if(c++,!sf(d))return Tf(i,d);switch(a){case"both":return c===2?Tf(i,d):ge;case"left":case"right":return l===a?Tf(i,d):ge;case"either":return Tf(i,d)}}let f=(l,d,m)=>Tr(d)(r,m).pipe(J(g=>g.pipe(J(S=>vf(i,S)),Xr)),rc(g=>Ln($n(m,jy(g)),u(l,g))),sc(s));return yield*f("left",e,ks(s)),yield*f("right",t,ks(s)),qo(i)})));var DA=()=>Ht((e,t)=>ue(()=>{let n="",r=!1,o=O();function s(c){let u=[];function f(l){n.length===0?u.push(l):(u.push(n+l),n="")}for(let l=0;l<c.length;l++){let d=c[l];if(d.length!==0){let m=0,g=d.indexOf("\r"),S=d.indexOf(`
|
|
25
|
-
`);for(
|
|
26
|
-
`,
|
|
27
|
-
`,
|
|
28
|
-
`,
|
|
29
|
-
`)&&(e=e.replace(
|
|
30
|
-
`);
|
|
31
|
-
at ${t}`:n}function xc(e){if(e._tag==="Pointer")return;if(e._tag==="Encoding")return xc(e.issue);let n=(e._tag==="Filter"?e.filter.annotations:"annotations"in e?e.annotations:e.ast.annotations)?.[e._tag==="MissingKey"?"messageMissingKey":e._tag==="UnexpectedKey"?"messageUnexpectedKey":"message"];if(typeof n=="string")return n}function Bf(e){let t;for(let n of e.reasons){if(!lp(n)||!jS(n.error))return;t??=n.error}return t}function Ho(e,t){let n=Bf(e);if(n===void 0)throw new Error(t,{cause:e});return n}var zS=Ji,h_=Oa,g_=Hk,x_=Gk,y_=Kk,S_=ky,WS=Vk,HS=Jk;var E_=ka;var b_=Ay;var om=Yk,w_=Qk;var sm=Xk;var GS=_y,qf=rf,I_=Py;var v_=Ry,Us=eO;var am=of;var C_=Ny;var T_=nO;var im=$y;var Ls=class e extends ta{run;constructor(t){super(),this.run=t}map(t){return new e((n,r)=>this.run(n,r).pipe($o(ms(t))))}compose(t){return k_(this)?t:k_(t)?this:new e((n,r)=>this.run(n,r).pipe($t(o=>t.run(o,r))))}};function jz(e){return new Ls((t,n)=>k(e(t,n)))}function KS(e){return jz((t,n)=>{let r={message:e(t)};return we(t)?new La(r,t.value,n):new La(r)})}var O_=new Ls(b);function k_(e){return e.run===O_.run}function Ar(){return O_}function VS(e){return new Ls((t,n)=>Ne(t)?Ra:e(t.value,n))}function de(e){return um(ms(e))}function En(e){return VS((t,n)=>e(t,n).pipe($o(R)))}function um(e){return new Ls(t=>b(e(t)))}function JS(){return new Ls(()=>Ra)}function zf(e){return new Ls(t=>{let n=_i(t,_e);return we(n)?b(n):$o(e,R)})}function ja(){return de(globalThis.String)}function fm(){return de(globalThis.Number)}function A_(){return de(globalThis.BigInt)}function ZS(){return de(e=>new globalThis.Date(e))}function __(){return de(cO)}function P_(e){return VS((t,n)=>gt({try:()=>R(JSON.parse(t,e?.reviver)),catch:()=>new fe({expected:"a valid JSON string"},t,n)}))}function R_(e){return VS((t,n)=>gt({try:()=>{let r=JSON.stringify(t,e?.replacer,e?.space);if(r===void 0)throw new TypeError("Value cannot be represented as JSON");return R(r)},catch:()=>new fe({expected:"a JSON-serializable value"},t,n)}))}function YS(){return de(Rd)}function lm(){return de(A0)}function dm(){return de(P0)}function F_(){return En((e,t)=>Ma(tS(Ni(e)),()=>new fe({expected:"a valid Base64 string"},e,t)))}function M_(){return En((e,t)=>Qn(O0(e),{onFailure:()=>k(new fe({expected:"a valid Base64 string"},e,t)),onSuccess:b}))}function N_(){return En((e,t)=>Qn(ex(e),{onFailure:()=>k(new fe({expected:"a valid Base64Url string"},e,t)),onSuccess:b}))}function D_(){return En((e,t)=>Qn(_0(e),{onFailure:()=>k(new fe({expected:"a valid Base64Url string"},e,t)),onSuccess:b}))}function $_(){return En((e,t)=>Qn(nx(e),{onFailure:()=>k(new fe({expected:"a valid hexadecimal string"},e,t)),onSuccess:b}))}function U_(){return En((e,t)=>Qn(R0(e),{onFailure:()=>k(new fe({expected:"a valid hexadecimal string"},e,t)),onSuccess:b}))}function L_(){return de(encodeURIComponent)}function j_(){return En((e,t)=>{try{return b(globalThis.decodeURIComponent(e))}catch{return k(new fe({expected:"a valid URI component"},e,t))}})}function QS(){return En((e,t)=>We(om(e),{onNone:()=>k(new fe({message:"Invalid DateTime input"},e,t)),onSome:n=>b(sm(n))}))}function B_(){return de(e=>H_(Array.from(e.entries())))}var Bz=G_(e=>typeof e=="string"||typeof Blob<"u"&&e instanceof Blob);function q_(){return de(e=>{let t=new FormData;return typeof e=="object"&&e!==null&&Bz(e).forEach(([r,o])=>{t.append(r,o)}),t})}function z_(){return de(e=>H_(Array.from(e.entries())))}var qz=G_(hr);function W_(){return de(e=>typeof e=="object"&&e!==null?new URLSearchParams(qz(e)):new URLSearchParams)}var zz=/^\d+$/;function Wz(e){if(e==="")return[""];let t=e.replace(/\[(.*?)\]/g,".$1"),n=t.split("."),r=t.startsWith(".")?1:0;return n.slice(r).map(o=>zz.test(o)?globalThis.Number(o):o)}function H_(e){let t={},n=new WeakSet;function r(o,s,a){let i=Object.hasOwn(o,s)?o[s]:void 0;if(n.has(i)&&Array.isArray(i)===a)return i;let c=a?[]:{};return n.add(c),M(o,s,c),c}return e.forEach(([o,s])=>{let a=Wz(o),i=t;a.forEach((c,u)=>{let f=u===a.length-1;if(Array.isArray(i)&&c==="")if(f)i.push(s);else{let l=a[u+1],d=typeof l=="number"||l==="",m=i.length;i=r(i,m,d)}else if(f){let l=Object.hasOwn(i,c);l&&Array.isArray(i[c])?i[c].push(s):l?M(i,c,[i[c],s]):M(i,c,s)}else{let l=a[u+1];i=r(i,c,typeof l=="number"||l==="")}})}),t}function G_(e){return t=>{let n=[];function r(o,s){if(e(s))n.push([o,s]);else if(Array.isArray(s))s.every(e)?s.forEach(i=>{n.push([o,i])}):s.forEach((i,c)=>{r(`${o}[${c}]`,i)});else if(typeof s=="object"&&s!==null)for(let[a,i]of Object.entries(s))r(`${o}[${a}]`,i)}for(let[o,s]of Object.entries(t))r(o,s);return n}}var K_=/^[+-]?\d+$/,XS="~effect/BigDecimal",Hz={[XS]:XS,[me](){let e=eE(this);return st(Z(e.value),mn(e.scale))},[he](e){return hm(e)&&Yz(this,e)},toString(){return`BigDecimal(${oo(this)})`},toJSON(){return{_id:"BigDecimal",value:String(this.value),scale:this.scale}},[dt](){return this.toJSON()},pipe(){return ne(this,arguments)}},hm=e=>_(e,XS),bn=(e,t)=>{let n=Object.create(Hz);return n.value=e,n.scale=t,n},J_=(e,t)=>{if(e!==Wn&&e%mm===Wn)throw new RangeError("Value must be normalized");let n=bn(e,t);return n.normalized=n,n},Wn=BigInt(0),Gz=BigInt(1),Kz=BigInt(-1);var mm=BigInt(10),Z_=J_(Wn,0);var eE=e=>{if(e.normalized===void 0)if(e.value===Wn)e.normalized=Z_;else{let t=`${e.value}`,n=0;for(let s=t.length-1;s>=0&&t[s]==="0";s--)n++;n===0&&(e.normalized=e);let r=BigInt(t.substring(0,t.length-n)),o=e.scale-n;e.normalized=J_(r,o)}return e.normalized},js=p(2,(e,t)=>t>e.scale?bn(e.value*mm**BigInt(t-e.scale),t):t<e.scale?bn(e.value/mm**BigInt(e.scale-t),t):e),Y_=p(2,(e,t)=>t.value===Wn?e:e.value===Wn?t:e.scale>t.scale?bn(js(t,e.scale).value+e.value,e.scale):e.scale<t.scale?bn(js(e,t.scale).value+t.value,t.scale):bn(e.value+t.value,e.scale));var Go=ua((e,t)=>{let n=Pn(V_(e),V_(t));return n!==0?n:e.scale>t.scale?Zn(e.value,js(t,e.scale).value):e.scale<t.scale?Zn(js(e,t.scale).value,t.value):Zn(e.value,t.value)}),Vz=ki(Go);var Jz=ds(Go);var V_=e=>e.value===Wn?0:e.value<Wn?-1:1,Zz=e=>e.value<Wn?bn(-e.value,e.scale):e;var tE=Tt((e,t)=>e.scale>t.scale?js(t,e.scale).value===e.value:e.scale<t.scale?js(e,t.scale).value===t.value:e.value===t.value),Yz=p(2,(e,t)=>tE(e,t));var Q_=e=>{if(e==="")return R(Z_);let t,n,r=e.search(/[eE]/);if(r!==-1){let c=e.slice(r+1);if(t=e.slice(0,r),n=Number(c),t===""||!Number.isSafeInteger(n)||!K_.test(c))return O()}else t=e,n=0;let o,s,a=t.search(/\./);if(a!==-1){let c=t.slice(0,a),u=t.slice(a+1);o=`${c}${u}`,s=u.length}else o=t,s=0;if(!K_.test(o))return O();let i=s-n;return Number.isSafeInteger(i)?R(bn(BigInt(o),i)):O()};var oo=e=>{let t=eE(e);if(Math.abs(t.scale)>=16)return Qz(t);let n=t.value<Wn,r=n?`${t.value}`.substring(1):`${t.value}`,o,s;if(t.scale>=r.length)o="0",s="0".repeat(t.scale-r.length)+r;else{let i=r.length-t.scale;if(i>r.length){let c=i-r.length;o=`${r}${"0".repeat(c)}`,s=""}else s=r.slice(i),o=r.slice(0,i)}let a=s===""?o:`${o}.${s}`;return n?`-${a}`:a},Qz=e=>{if(Xz(e))return"0e+0";let t=eE(e),n=`${Zz(t).value}`,r=n.slice(0,1),o=n.slice(1),s=`${X_(t)?"-":""}${r}`;o!==""&&(s+=`.${o}`);let a=o.length-t.scale;return`${s}e${a>=0?"+":""}${a}`};var Xz=e=>e.value===Wn,X_=e=>e.value<Wn,eW=e=>e.value>Wn,nE=e=>hm(e[0]);var eP=p(nE,(e,t=0)=>e.scale<=t?e:bn(e.value/mm**BigInt(e.scale-t),t)),rE=p(nE,(e,t=0)=>{let n=eP(e,t);return eW(e)&&Vz(n,e)?Y_(n,bn(Gz,t)):n});var oE=p(nE,(e,t=0)=>{let n=eP(e,t);return X_(e)&&Jz(n,e)?Y_(n,bn(Kz,t)):n});var Hf=class e{_tag="Middleware";decode;encode;constructor(t,n){this.decode=t,this.encode=n}flip(){return new e(this.encode,this.decode)}},Wf="~effect/SchemaTransformation/Transformation",be=class e{[Wf]=Wf;_tag="Transformation";decode;encode;constructor(t,n){this.decode=t,this.encode=n}flip(){return new e(this.encode,this.decode)}compose(t){return new e(this.decode.compose(t.decode),t.encode.compose(this.encode))}};function tW(e){return _(e,Wf)&&e[Wf]===Wf}var gm=e=>tW(e)?e:new be(e.decode,e.encode);function Hn(e){return new be(En(e.decode),En(e.encode))}function Ke(e){return new be(de(e.decode),de(e.encode))}function xm(e){return new be(um(e.decode),um(e.encode))}function tP(){return new be(__(),Ar())}var nW=new be(Ar(),Ar());function yc(){return nW}var Sc=new be(fm(),ja()),ym=new be(A_(),ja()),aE=new be(ZS(),de(Sg)),nP=new be(ZS(),de(e=>e.getTime())),rP=Hn({decode:(e,t)=>We(h0(e),{onNone:()=>k(new fe({expected:"a valid Duration string"},e,t)),onSome:b}),encode:e=>b(globalThis.String(e))}),oP=Hn({decode:e=>b(Xn(e)),encode:(e,t)=>We(x0(e),{onNone:()=>k(new fe({expected:"a Duration representable as a bigint"},e,t)),onSome:n=>b(n)})}),sP=Ke({decode:e=>hs(e),encode:e=>Fi(e)}),rW=e=>jt(e)&&typeof e.message=="string",aP=e=>{let n=Object.hasOwn(e,"cause")?new Error(e.message,{cause:cP(e.cause)}):new Error(e.message);return typeof e.name=="string"&&e.name!=="Error"&&(n.name=e.name),typeof e.stack=="string"&&(n.stack=e.stack),n},oW=e=>{try{let t=oa(e);return t===void 0?D(e):JSON.parse(t)}catch{return D(e)}},sW=(e,t,n)=>{let r={name:e.name,message:typeof e.message=="string"?e.message:""};return t?.includeStack&&typeof e.stack=="string"&&(r.stack=e.stack),!t?.excludeCause&&e.cause!==void 0&&(r.cause=n(e.cause)),r},iP=e=>{let t=new WeakSet,n=r=>{if(uv(r)){if(t.has(r))return"[Circular]";t.add(r);let o=sW(r,e,n);return t.delete(r),o}return oW(r)};return n},cP=e=>rW(e)?aP(e):e,uP=e=>Ke({decode:aP,encode:t=>iP(e)(t)}),fP=e=>Ke({decode:cP,encode:iP(e)});function lP(){return Ke({decode:Lv,encode:Ag})}function dP(){return Ke({decode:ps,encode:Qt})}function pP(e){return Ke({decode:Yn,encode:e?.onNoneEncoding===null?Ag:Qt})}function mP(){return xm({decode:R,encode:Ai})}function hP(){return xm({decode:e=>e.pipe(_i(_e),R),encode:Ai})}var iE=Hn({decode:(e,t)=>URL.canParse(e)?b(new URL(e)):k(new fe({expected:"a valid URL string"},e,t)),encode:e=>b(e.href)}),cE=Hn({decode:(e,t)=>{let n=Q_(e);return Ne(n)?k(new fe({expected:"a valid BigDecimal string"},e,t)):b(n.value)},encode:e=>b(oo(e))}),uE=new be(F_(),YS()),gP=new be(M_(),YS()),xP=new be(D_(),lm()),yP=new be(U_(),dm()),SP=new be(j_(),L_());function EP(e){return new be(P_(e??{}),R_(e))}var bP=new be(B_(),q_()),wP=new be(z_(),W_()),IP=Ke({decode:e=>qf(e),encode:e=>e.offset}),fE=Hn({decode:(e,t)=>We(I_(e),{onNone:()=>k(new fe({expected:"a valid IANA time zone"},e,t)),onSome:b}),encode:e=>b(e.id)}),lE=Hn({decode:(e,t)=>We(v_(e),{onNone:()=>k(new fe({expected:"a valid time zone"},e,t)),onSome:b}),encode:e=>b(Us(e))}),dE=Hn({decode:(e,t)=>We(om(e),{onNone:()=>k(new fe({expected:"a valid UTC DateTime string"},e,t)),onSome:n=>b(sm(n))}),encode:e=>b(T_(e))}),pE=Hn({decode:(e,t)=>We(w_(e),{onNone:()=>k(new fe({expected:"a valid Zoned DateTime string"},e,t)),onSome:b}),encode:e=>b(im(e))});function Bs(e){return t=>t._tag===e}var qs=Bs("Declaration");var aW=Bs("Never");var Ec=Bs("Literal"),mE=Bs("UniqueSymbol");var FE=Bs("Arrays"),iW=Bs("Objects"),RP=Bs("Union"),cW=Bs("Suspend"),Qe=class{to;transformation;constructor(t,n){this.to=t,this.transformation=n}},Wa={},cr=class{isOptional;isMutable;constructorDefault;annotations;constructor(t,n,r=void 0,o=void 0){this.isOptional=t,this.isMutable=n,this.constructorDefault=r,this.annotations=o}},vP="~effect/Schema",rt=class{[vP]=vP;annotations;checks;encoding;context;constructor(t=void 0,n=void 0,r=void 0,o=void 0){this.annotations=t,this.checks=n,this.encoding=r,this.context=o}toString(){return`<${this._tag}>`}},Ba=class e extends rt{_tag="Declaration";typeParameters;run;encodingChecks;encodingRun;constructor(t,n,r,o,s,a,i,c){super(r,o,s,a),this.typeParameters=t,this.run=n,this.encodingChecks=i,this.encodingRun=c}getParser(){let t;return(n,r)=>n===Se?Or:(t??=this.run(this.typeParameters))(n,this,r)}_rebuild(t,n,r,o,s){let a=Ic(this.typeParameters,t);return a===this.typeParameters&&n===this.checks&&r===this.encodingChecks&&o===this.run&&s===this.encodingRun?this:new e(a,o,this.annotations,n,void 0,this.context,r,s)}recur(t){return this._rebuild(t,this.checks,this.encodingChecks,this.run,this.encodingRun)}flip(t){return this._rebuild(t,this.encodingChecks,this.checks,this.encodingRun??this.run,this.run)}getExpected(){let t=this.annotations?.expected;return typeof t=="string"?t:"<Declaration>"}},hE=class extends rt{_tag="Null";getParser(){return Nm(this,null)}getExpected(){return"null"}},ME=new hE;var gE=class extends rt{_tag="Undefined";getParser(){return Nm(this,void 0)}toCodecJson(){return Ue(this,[FP])}getExpected(){return"undefined"}},FP=new Qe(ME,new be(de(()=>{}),de(()=>null))),NE=new gE;var xE=class extends rt{_tag="Void";getParser(){let t=ir(void 0);return n=>n===Se?Or:t}toCodecJson(){return Ue(this,[FP])}getExpected(){return"void"}},MP=new xE;var yE=class extends rt{_tag="Never";getParser(){return Rr(this,cv)}getExpected(){return"never"}},NP=new yE,SE=class extends rt{_tag="Any";getParser(){return Rr(this,cg)}getExpected(){return"any"}},DP=new SE,EE=class extends rt{_tag="Unknown";getParser(){return Rr(this,cg)}getExpected(){return"unknown"}},Ko=new EE,bE=class extends rt{_tag="ObjectKeyword";getParser(){return Rr(this,lu)}getExpected(){return"object | array | function"}},$P=new bE,Em=class extends rt{_tag="Enum";enums;constructor(t,n,r,o,s){super(n,r,o,s),this.enums=t}getParser(){let t=new Set(this.enums.map(([,n])=>n));return Rr(this,n=>t.has(n))}toCodecStringTree(){if(this.enums.some(([t,n])=>typeof n=="number")){let t=Object.fromEntries(this.enums.map(([n,r])=>[globalThis.String(r),r]));return Ue(this,[new Qe(new un(Object.keys(t).map(n=>new wn(n)),"anyOf"),new be(de(n=>t[n]),ja()))])}return this}getExpected(){return this.enums.map(([t,n])=>JSON.stringify(n)).join(" | ")}};function UP(e){switch(e._tag){case"String":case"Number":case"BigInt":return!0;case"Literal":case"TemplateLiteral":return!e.checks;case"Union":return!e.checks&&e.types.every(UP);default:return!1}}var bm=class extends rt{_tag="TemplateLiteral";parts;encodedParts;literals;suffixLengths;constructor(t,n,r,o,s){super(n,r,o,s);let a=[],i=[];for(let u of t){let f=In(u);if(UP(f))a.push(f),i.push(f._tag==="Literal"?globalThis.String(f.literal):void 0);else throw new Error(`Invalid TemplateLiteral part ${f._tag}`)}let c=new Array(a.length+1);c[a.length]=0;for(let u=a.length-1;u>=0;u--)c[u]=c[u+1]+(i[u]?.length??0);this.parts=t,this.encodedParts=a,this.literals=i,this.suffixLengths=c}getParser(t){let n=t(this.asTemplateLiteralParser());return(r,o)=>{if(r===Se)return Or;let s=n(r,o);return s._tag==="Success"?xt:kt(s,{onSuccess:()=>r,onFailure:a=>new nt(this,[a],r,o)})}}getExpected(){return"string"}matchPart(t,n){return PP(this,t,n)===void 0?void 0:t}asTemplateLiteralParser(){let t=new Pr(!1,this.parts.map(oR),[]);return Mm(so,t,new be(En((n,r)=>{let o=PP(this,n,r);return o?b(o):k(new fe({expected:"a string matching template literal parts"},n,r))}),de(n=>n.join(""))))}},wm=class extends rt{_tag="UniqueSymbol";symbol;constructor(t,n,r,o,s){super(n,r,o,s),this.symbol=t}getParser(){return Nm(this,this.symbol)}toCodecStringTree(){return Ue(this,[iR])}getExpected(){return globalThis.String(this.symbol)}},wn=class extends rt{_tag="Literal";literal;constructor(t,n,r,o,s){if(super(n,r,o,s),typeof t=="number"&&!globalThis.Number.isFinite(t))throw new Error(`A numeric literal must be finite, got ${D(t)}`);this.literal=t}getParser(){return Nm(this,this.literal)}matchPart(t,n){return t===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal=="bigint"?CP(this):this}toCodecStringTree(){return typeof this.literal=="string"?this:CP(this)}getExpected(){return typeof this.literal=="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}};function CP(e){let t=globalThis.String(e.literal);return Ue(e,[new Qe(new wn(t),new be(de(()=>e.literal),de(()=>t)))])}var wE=class extends rt{_tag="String";getParser(){return Rr(this,hr)}matchPart(t,n){let r=this.checks;return r&&!n.disableChecks&&Fr(r,t,void 0,this,n)?void 0:t}getExpected(){return"string"}},so=new wE,IE=class extends rt{_tag="Number";getParser(){return Rr(this,uu)}matchKey(t,n){return this._match(EW,t,n)}matchPart(t,n){return this._match(_E,t,n)}_match(t,n,r){if(!t.test(n))return;let o=globalThis.Number(n);return r.disableChecks||!this.checks?o:Fr(this.checks,o,void 0,this,r)?void 0:o}toCodecJson(){return this.checks&&(vE(this.checks,"effect/schema/isFinite")||vE(this.checks,"effect/schema/isInt"))?this:Ue(this,[mW])}toCodecStringTree(){return this.toCodecJson()===this?Ue(this,[bW]):Ue(this,[wW])}getExpected(){return"number"}};function vE(e,t){return e.some(n=>n.annotations?.representation?.id===t||n._tag==="FilterGroup"&&vE(n.checks,t))}var DE=new IE,CE=class extends rt{_tag="Boolean";getParser(){return Rr(this,ad)}getExpected(){return"boolean"}},LP=new CE,TE=class extends rt{_tag="Symbol";getParser(){return Rr(this,ig)}matchKey(t,n){return n.disableChecks||!this.checks?t:Fr(this.checks,t,void 0,this,n)?void 0:t}toCodecStringTree(){return Ue(this,[iR])}getExpected(){return"symbol"}},jP=new TE,kE=class extends rt{_tag="BigInt";getParser(){return Rr(this,av)}matchPart(t,n){if(!PE.test(t))return;let r=globalThis.BigInt(t);return n.disableChecks||!this.checks?r:Fr(this.checks,r,void 0,this,n)?void 0:r}toCodecStringTree(){return Ue(this,[vW])}getExpected(){return"bigint"}},BP=new kE,Pr=class e extends rt{_tag="Arrays";isMutable;elements;rest;encodingChecks;constructor(t,n,r,o,s,a,i,c){super(o,s,a,i),this.isMutable=t,this.elements=n,this.rest=r,this.encodingChecks=c;let u=!1;for(let f=0;f<n.length;f++)if(ut(n[f]))u=!0;else if(u)throw new Error("A required element cannot follow an optional element. ts(1257)");if(u&&r.length>1)throw new Error("A required element cannot follow an optional element. ts(1257)");for(let f=1;f<r.length;f++)if(ut(r[f]))throw new Error("An optional element cannot follow a rest element. ts(1266)")}getParser(t,n=t){let r=this,o,s,a=r.elements.length,i=Math.max(0,r.rest.length-1);function c(u,f){return f<a?o[f]:f>=u?s[f-u+1]:s[0]}return Bp(function*(u,f){if(u===Se)return Se;if(!Array.isArray(u))return yield*k(new Ye(r,u,f));o||(o=r.elements.map(S=>({ast:S,parser:n(S)})),s=r.rest.map(S=>({ast:S,parser:n(S)})));let l=u.length,d={ast:r,getParser:c,input:u,len:l,tailThreshold:Math.max(a,l-i),output:new globalThis.Array(l),issues:void 0,options:f},m=$E(f?.concurrency),g=uW(d,u,{concurrency:m?.concurrency,end:r.rest.length===0?a:Math.max(l,a+i)});if(g&&(yield*g),r.rest.length===0&&l>a)for(let S=a;S<=l-1;S++){let v=new jf(r,u[S],f),I=new ct([S],v);if(f.errors==="all")d.issues?d.issues.push(I):d.issues=[I];else return yield*k(new nt(r,[I],u,f))}return d.issues?yield*k(new nt(r,d.issues,u,f)):d.output})}_rebuild(t,n,r){let o=Ic(this.elements,t),s=Ic(this.rest,t);return o===this.elements&&s===this.rest&&n===this.checks&&r===this.encodingChecks?this:new e(this.isMutable,o,s,this.annotations,n,void 0,this.context,r)}recur(t){return this._rebuild(t,this.checks,this.encodingChecks)}flip(t){return this._rebuild(t,this.encodingChecks,this.checks)}getExpected(){return"array"}},uW=Ku()({onItem(e,t,n){let r=n<e.len?t:Se;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step(e,t,n,r){if(n._tag==="Failure")return Im(e,e.ast,r,n);let o=n===xt?t:n[Q];if(o!==Se)e.output[r]=o;else{let s=e.getParser(e.tailThreshold,r);if(ut(s.ast))return;let a=new ct([r],new Ds(s.ast.context?.annotations));if(e.options.errors==="all")e.issues?e.issues.push(a):e.issues=[a];else return vr(new nt(e.ast,[a],e.input,e.options))}}}),$E=e=>(e=e==="unbounded"?1/0:e??1,e>1?{concurrency:e}:void 0),Im=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let o=Bf(r.cause);if(o===void 0)return er(Ts(r.cause,a=>new nt(t,[new ct([n],a)],e.input,e.options)));let s=new ct([n],o);if(e.options.errors==="all")e.issues?e.issues.push(s):e.issues=[s];else return vr(new nt(t,[s],e.input,e.options))},Tm="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";function qa(e,t,n=Wa){let r,o;function s(a){switch(a._tag){case"String":case"TemplateLiteral":return(r??=Object.keys(e)).filter(i=>a.matchPart(i,n)!==void 0);case"Number":return(r??=Object.keys(e)).filter(i=>a.matchKey(i,n)!==void 0);case"Symbol":return(o??=Object.getOwnPropertySymbols(e)).filter(i=>a.matchKey(i,n)!==void 0);case"Union":return[...new Set(a.types.flatMap(s))];default:return[]}}return s(GE(In(t)))}var Kf=class{name;type;constructor(t,n){this.name=t,this.type=n}};function OE(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every(OE);default:return!1}}function fW(e){return OE(e)&&OE(In(e))}var Vf=class{parameter;type;constructor(t,n){if(!fW(t))throw new Error(`Invalid index signature parameter ${t._tag}`);if(this.parameter=t,this.type=n,ut(n)&&!nR(n))throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},bc=class e extends rt{_tag="Objects";propertySignatures;indexSignatures;encodingChecks;constructor(t,n,r,o,s,a,i){super(r,o,s,a),this.propertySignatures=t,this.indexSignatures=n,this.encodingChecks=i;let c=t.map(u=>u.name).filter((u,f,l)=>l.indexOf(u)!==f);if(c.length>0)throw new Error(`Duplicate identifiers: ${JSON.stringify(c)}. ts(2300)`)}getParser(t,n=t){let r=this,o=[];for(let I of r.propertySignatures)o.push(I.name);let s=o.length,a=r.indexSignatures.length,i=s&&a?new Set(o):void 0;if(!s&&!a)return Rr(r,cd);let c,u,f=(I,C,y,x,h)=>{if(h._tag==="Failure")return Im(I,r,C,h)??tr;let E=h===xt?x:h[Q];if(y!==Se&&E!==Se){if(s&&(i.has(C)||i.has(y)))return tr;M(I.out,y,E)}return tr},l=(I,C,y,x)=>{if(!x){let T=y.parserKey(C,I.options);if(!De(T))return J(As(T),A=>l(I,C,y,A));x=T}if(x._tag==="Failure")return Im(I,r,C,x)??tr;let h=x===xt?C:x[Q],E=I.input[C],w=y.parserValue(E,I.options);return De(w)?f(I,C,h,E,w):J(As(w),T=>f(I,C,h,E,T))},d=(I,C,y)=>{let x=I.input[C],h=y.parserValue(x,I.options);return De(h)?f(I,C,C,x,h):J(As(h),E=>f(I,C,C,x,E))},m=a?Ku()({onItem:(I,[C,y])=>l(I,C,y),step:(I,C,y)=>y._tag==="Failure"?y:void 0}):void 0,g=()=>(c||(c=r.propertySignatures.map(I=>({parser:n(I.type),name:I.name,type:I.type})),u=a?r.indexSignatures.map(I=>({is:I,parserKey:t(GE(I.parameter)),parserValue:n(I.type)})):void 0),c),S=Bp(function*(I,C){if(I===Se)return Se;if(!(typeof I=="object"&&I!==null&&!Array.isArray(I)))return yield*k(new Ye(r,I,C));g();let y=I,x={},h={ast:r,input:y,out:x,issues:void 0,options:C},E=C.errors==="all",w=C.onExcessProperty==="error",T=C.onExcessProperty==="preserve",A;if(!a&&(w||T)){i??=new Set(o),A=Reflect.ownKeys(y);for(let P=0;P<A.length;P++){let L=A[P];if(!i.has(L))if(w){let U=new jf(r,y[L],C),oe=new ct([L],U);if(E){h.issues?h.issues.push(oe):h.issues=[oe];continue}else return yield*k(new nt(r,[oe],I,C))}else M(x,L,y[L])}}let $=$E(C?.concurrency);if(s){let P=TP(h,c,$);P&&(yield*P)}if(a&&!$)for(let P=0;P<a;P++){let L=u[P],U=L.is.parameter===so?d:l,oe=L.is.parameter===so?Object.keys(y):qa(y,L.is.parameter,C);for(let yt=0;yt<oe.length;yt++){let Pt=U(h,oe[yt],L);if(!De(Pt))yield*Pt;else if(Pt._tag==="Failure")return yield*Pt}}else if(m){let P=ha();for(let U=0;U<a;U++){let oe=u[U],yt=qa(y,oe.is.parameter,C);for(let Pt=0;Pt<yt.length;Pt++)P.push([yt[Pt],oe])}let L=m(h,P,$);L&&(yield*L)}if(h.issues)return yield*k(new nt(r,h.issues,I,C));if(C.propertyOrder==="original"){let P=(A??Reflect.ownKeys(y)).concat(o),L={};for(let U of P)Object.hasOwn(x,U)&&M(L,U,x[U]);return L}return x});if(a)return S;let v=(I,C,y)=>{let x=c[C];return J(As(y),h=>{let E=AE(I,x,h);if(E)return E;let w=()=>ir(I.out),T=TP(I,c.slice(C+1));return T?$t(T,w):w()})};return(I,C)=>{if(I===Se)return Or;if(C.errors==="all"||C.onExcessProperty!==void 0||C.propertyOrder==="original"||C.concurrency!==void 0)return S(I,C);if(!(typeof I=="object"&&I!==null&&!Array.isArray(I)))return k(new Ye(r,I,C));let y=g(),x=I,h={},E={ast:r,input:x,out:h,issues:void 0,options:C};try{for(let w=0;w<y.length;w++){let T=y[w],A=T.name,$=Object.hasOwn(x,A),P=$?x[A]:Se,L=T.parser(P,C);if(!De(L))return v(E,w,L);if(L===xt){$&&M(h,A,P);continue}let U=AE(E,T,L);if(U)return U}}catch(w){return an(w)}return ir(h)}}_rebuild(t,n,r,o){let s=Ic(this.propertySignatures,i=>{let c=t(i.type);return c===i.type?i:new Kf(i.name,c)}),a=Ic(this.indexSignatures,i=>{let c=n(i.parameter),u=t(i.type);return c===i.parameter&&u===i.type?i:new Vf(c,u)});return s===this.propertySignatures&&a===this.indexSignatures&&r===this.checks&&o===this.encodingChecks?this:new e(s,a,this.annotations,r,void 0,this.context,o)}flip(t){return this._rebuild(t,t,this.encodingChecks,this.checks)}recur(t,n=t){return this._rebuild(t,n,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?"object | array":"object"}};function AE(e,t,n){if(n._tag==="Failure")return Im(e,e.ast,t.name,n);if(n===xt)return;let r=n[Q];if(r!==Se){M(e.out,t.name,r);return}if(delete e.out[t.name],!ut(t.type)){let o=new ct([t.name],new Ds(t.type.context?.annotations));if(e.options.errors==="all"){e.issues?e.issues.push(o):e.issues=[o];return}else return vr(new nt(e.ast,[o],e.input,e.options))}}var TP=Ku()({onItem(e,t){if(!Object.hasOwn(e.input,t.name))return t.parser(Se,e.options);let n=e.input[t.name];return M(e.out,t.name,n),t.parser(n,e.options)},step:AE});function UE(e,t){return e?t?[...e,...t]:e:t}function km(e,t,n){return new bc(Reflect.ownKeys(e).map(r=>new Kf(r,e[r].ast)),[],n,t)}function Jf(e){return e.ast}function LE(e,t=void 0){return new Pr(!1,e.map(n=>n.ast),[],void 0,t)}function Om(e,t,n){return new un(e.map(Jf),t,void 0,n)}function qP(e,t){if(e.encoding||t.some(s=>s.encoding))throw new Error("StructWithRest does not support encodings");let n=e.propertySignatures,r=e.indexSignatures,o=e.checks;for(let s of t)n=n.concat(s.propertySignatures),r=r.concat(s.indexSignatures),o=UE(o,s.checks);return new bc(n,r,void 0,o)}function zP(e,t){if(e.encoding)throw new Error("TupleWithRest does not support encodings");return new Pr(e.isMutable,e.elements,t,void 0,e.checks)}var Am=na(e=>{for(;;){if(cW(e))return Ko;let t=e.encoding;if(!t)return e.recur?.(Am,F)??e;if(t.some(n=>n.transformation._tag==="Middleware"&&n.transformation.decode!==F))return Ko;e=t[t.length-1].to}});function WP(e){switch(e._tag){case"Null":return["null"];case"Undefined":return["undefined"];case"String":case"TemplateLiteral":return["string"];case"Number":return["number"];case"Boolean":return["boolean"];case"Symbol":case"UniqueSymbol":return["symbol"];case"BigInt":return["bigint"];case"Arrays":return["array"];case"ObjectKeyword":return["object","array","function"];case"Objects":return e.propertySignatures.length||e.indexSignatures.length?["object"]:["string","number","boolean","symbol","bigint","object","array","function"];case"Enum":return Array.from(new Set(e.enums.map(([,t])=>typeof t)));case"Literal":return[typeof e.literal];case"Union":return Array.from(new Set(e.types.flatMap(WP)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function wc(e){switch(e._tag){default:return[];case"Declaration":{let t=e.annotations?.[Df];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap(t=>{let n=t.type;if(!ut(n)){if(Ec(n))return[{key:t.name,literal:n.literal}];if(mE(n))return[{key:t.name,literal:n.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,n)=>{if(!ut(t)){if(Ec(t))return[{key:n,literal:t.literal}];if(mE(t))return[{key:n,literal:t.symbol}]}return[]});case"Union":{if(e.types.length===0)return[];let t=e.types.map(n=>wc(Am(n)));return t[0].filter(n=>t.every(r=>r.some(o=>o.key===n.key&&o.literal===n.literal)))}case"Suspend":return wc(e.thunk())}}var kP=new WeakMap,Gf=Object.freeze([]);function lW(e){let t=kP.get(e);if(t)return t;let n,r=0,o,s,a=!0;for(let i=0;i<e.length;i++){let c=e[i],u=Am(c);if(aW(u))continue;if(a)if(Ec(u)||mE(u)){s??=new Map;let l=Ec(u)?u.literal:u.symbol,d=s.get(l);d||s.set(l,d=[]),d.push(c)}else a=!1;let f=wc(u);if(f.length){n??=new Map,r++;for(let{key:l,literal:d}of f){let m=n.get(l);m||n.set(l,m=[new Map,new Set]),m[1].add(i);let g=m[0].get(d);g||m[0].set(d,g=new Set),g.add(i)}}else{o??={};let l=WP(u);for(let d of l)(o[d]??=[]).push(i)}}if(a&&s)s.forEach(Object.freeze),t=i=>s.get(i)??Gf;else if(n?.size===1&&!o){let[i,[c]]=n.entries().next().value,u=c;for(let[f,l]of c)u.set(f,Object.freeze(Array.from(l,d=>e[d])));t=(f,l)=>{if(lu(f)){let d=Object.hasOwn(f,i)?f[i]:void 0;if(d!==void 0)return u.get(d)??Gf;if(l)return e}return Gf}}else if(n){let i;for(let c of n)(!i||c[1][0].size>i[1][0].size)&&c[1][1].size===r&&(i=c);t=(c,u)=>{let f=c===null?"null":Array.isArray(c)?"array":typeof c,l=o?.[f]??Gf;if(!lu(c))return l.map(g=>e[g]);let d=new Set(l),m;if(i){let[g,[S]]=i,v=Object.hasOwn(c,g),I=v?c[g]:void 0;if(v&&(!u||I!==void 0)){let C=S.get(I);if(!C)return l.map(y=>e[y]);for(let y of C)d.add(y);m=g}}if(m===void 0)for(let[g,[S,v]]of n){let I=Object.hasOwn(c,g),C=I?c[g]:void 0;if(I&&(!u||C!==void 0)){let y=S.get(C);if(y)for(let x of y)d.add(x)}else if(u)for(let y of v)d.add(y)}for(let[g,[S,v]]of n){if(g===m)continue;let I=Object.hasOwn(c,g),C=I?c[g]:void 0;if(I&&(!u||C!==void 0)){let y=S.get(C);for(let x of d)v.has(x)&&!y?.has(x)&&d.delete(x)}}return Array.from(d).sort((g,S)=>g-S).map(g=>e[g])}}else t=i=>{let c=i===null?"null":Array.isArray(i)?"array":typeof i;return(o?.[c]??Gf).map(u=>e[u]).filter(dW(i))};return kP.set(e,t),t}function dW(e){return t=>{let n=Am(t);return n._tag==="Literal"?n.literal===e:n._tag==="UniqueSymbol"?n.symbol===e:!0}}function Zf(e,t,n=!1){return lW(t)(e,n)}var un=class e extends rt{_tag="Union";types;mode;encodingChecks;constructor(t,n,r,o,s,a,i){super(r,o,s,a),this.types=t,this.mode=n,this.encodingChecks=i}getParser(t,n){let r=this;return(o,s)=>{if(o===Se)return Or;let a=Zf(o,r.types,n!==void 0);if(a.length===1){let f=t(a[0])(o,s);return f._tag==="Success"?f:De(f)?OP(r,f.cause,o,s):Bn(f,l=>OP(r,l,o,s))}let i={ast:r,compile:t,input:o,out:void 0,successes:r.mode==="oneOf"?[]:void 0,issues:void 0,options:s},c=$E(s?.concurrency),u=pW(i,a,c?{...c,orderedStep:!0}:void 0);return u?$t(u,f=>i.out===xt?b(o):i.out?i.out:k(new gc(r,i.issues??[],o,s))):i.out?i.out:k(new gc(r,i.issues??[],o,s))}}_rebuild(t,n,r){let o=Ic(this.types,t);return o===this.types&&n===this.checks&&r===this.encodingChecks?this:new e(o,this.mode,this.annotations,n,void 0,this.context,r)}recur(t){return this._rebuild(t,this.checks,this.encodingChecks)}flip(t){return this._rebuild(t,this.encodingChecks,this.checks)}matchPart(t,n){for(let r of this.types){let o=r.matchPart(t,n);if(o!==void 0)return o}}getExpected(t){let n=this.annotations?.expected;if(typeof n=="string")return n;if(this.types.length===0)return"never";let r=this.types.map(o=>{let s=In(o);switch(s._tag){case"Arrays":{let a=s.elements.filter(Ec);if(a.length>0)return`${AP(s.isMutable)}[ ${a.map(i=>t(i)+_P(i.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let a=s.propertySignatures.filter(i=>Ec(i.type));if(a.length>0)return`{ ${a.map(i=>`${AP(i.type.context?.isMutable)}${go(i.name)}${_P(i.type.context?.isOptional)}: ${t(i.type)}`).join(", ")}, ... }`;break}}return t(s)});return Array.from(new Set(r)).join(" | ")}};function OP(e,t,n,r){let o=Bf(t);return o?vr(new gc(e,[o],n,r)):er(t)}var pW=Ku()({onItem(e,t){return e.compile(t)(e.input,e.options)},step(e,t,n){if(n._tag==="Failure"){let r=Bf(n.cause);if(r===void 0)return n;e.issues?e.issues.push(r):e.issues=[r]}else{if(e.out&&e.successes)return e.successes.push(t),vr(new rm(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(t);else return tr}}}),HP=new un([new wn("Infinity"),new wn("-Infinity"),new wn("NaN")],"anyOf");function AP(e){return e?"":"readonly "}function _P(e){return e?"?":""}function Ha(e){let t=!1,n;return()=>(t||(n=e(),t=!0),n)}var vm=class e extends rt{_tag="Suspend";thunk;constructor(t,n,r,o,s){if(r)throw new Error("Cannot add checks to Suspend");super(n,void 0,o,s),this.thunk=Ha(t)}getParser(t){let n;return(r,o)=>(n??=t(this.thunk()))(r,o)}recur(t){return new e(()=>t(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(t){return t(this.thunk())}},Cm=class e extends ta{_tag="Filter";run;annotations;aborted;constructor(t,n=void 0,r=!1){super(),this.run=t,this.annotations=n,this.aborted=r}annotate(t){return new e(this.run,{...this.annotations,...t},this.aborted)}abort(){return new e(this.run,this.annotations,!0)}and(t,n){return new za([this,t],n)}},za=class e extends ta{_tag="FilterGroup";checks;annotations;constructor(t,n=void 0){super(),this.checks=t,this.annotations=n}annotate(t){return new e(this.checks,{...this.annotations,...t})}and(t,n){return new e([this,t],n)}};function _m(e,t,n=!1){return new Cm((r,o,s)=>u_(o,e(r,o,s),r,s),t,n)}function Pm(e,t){return new Cm((n,r,o)=>e(n)?void 0:new fe(void 0,n,o),t,!0)}function jE(e){return _m(t=>globalThis.Number.isFinite(t),{expected:"a finite number",representation:{id:"effect/schema/isFinite",payload:null},toJsonSchema:()=>({type:"number"}),toCode:()=>({runtime:"Schema.isFinite()"}),arbitrary:{constraint:{noInfinity:!0,noNaN:!0}},...e})}var BE=ao(DE,[jE()]),mW=new Qe(new un([BE,HP],"anyOf"),new be(fm(),de(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function Yf(e,t){let n=e.source,r=new globalThis.RegExp(n,e.flags);return _m(o=>(r.lastIndex=0,r.test(o)),{expected:`a string matching the RegExp ${n}`,representation:{id:"effect/schema/isPattern",payload:{source:n,flags:e.flags}},toJsonSchema:()=>({pattern:n}),arbitrary:{constraint:{patterns:[e.source]}},...t})}function Qf(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}var GP=new WeakMap;function qE(e){return GP.get(e)??e}function Ue(e,t){return e.encoding===t?e:Qf(e,n=>{n.encoding.value=t})}function Xf(e,t){if(e.context===t)return e;let n=qE(e);if(n.context===t)return n;let r=Qf(e,o=>{o.context.value=t});return GP.set(r,n),r}function el(e){return e.encoding?el(e.encoding[e.encoding.length-1].to):e}function ur(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return Rm(e,Lg(e.checks.slice(0,-1),n.annotate(t)))}return Qf(e,n=>{n.annotations.value={...n.annotations.value,...t}})}function Rm(e,t){if(e._tag==="Suspend"&&t)throw new Error("Cannot add checks to Suspend");return e.checks===t?e:Qf(e,n=>{n.checks.value=t})}function ao(e,t){return Rm(e,UE(e.checks,t))}function Cc(e,t){let n=t(e.to);return n===e.to?e:new Qe(n,e.transformation)}function KP(e,t){let n=e,r=n[n.length-1],o=Cc(r,t);return o===r?e:Lg(e.slice(0,e.length-1),o)}function zE(e){return t=>t.encoding?Ue(t,KP(t.encoding,e)):t}function Fm(e,t){return zE(n=>Xf(n,t))(e)}function Ga(e,t){function n(r){if(r.encoding){let o=r.encoding[r.encoding.length-1];return t?.stopAt?.(o)?r:Ue(r,KP(r.encoding,n))}return e(r)}return na(n)}function VP(e,t){return WE(e,t,Ut(e))}function JP(e,t){return WE(In(e),t,e)}function WE(e,t,n){let r=new Qe(e,t);return Ue(n,n.encoding?[...n.encoding,r]:[r])}function ZP(e,t){let n=a_(e),r=n?[...n,t]:[t];return ur(e,{brands:r})}function Ic(e,t){let n=!1,r=new Array(e.length);for(let o=0;o<e.length;o++){let s=e[o],a=t(s);a!==s&&(n=!0),r[o]=a}return n?r:e}function tl(e,t){let n=e.context?new cr(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new cr(!1,!1,void 0,t);return Xf(e,n)}var Tc=na(e=>{let t=e.context?e.context.isOptional===!1?new cr(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new cr(!0,!1);return hW(Xf(e,t))}),hW=zE(Tc),YP=Rt(e=>Tc(new un([e,NE],"anyOf"))),HE=na(e=>{let t=e.context?e.context.isMutable===!1?new cr(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new cr(!1,!0);return gW(Xf(e,t))}),gW=zE(HE);function QP(e,t){let n=new be(zf(t),Ar()),r=new Qe(Ko,n),o=e.context?new cr(e.context.isOptional,e.context.isMutable,r,e.context.annotations):new cr(!1,!1,r);return Xf(e,o)}function Mm(e,t,n){return WE(e,n,t)}function xW(e){let t=[],n=[];function r(o){switch(o._tag){case"Literal":id(o.literal)&&t.push(o.literal);return;case"UniqueSymbol":t.push(o.symbol);return;case"Never":return;case"Union":for(let s=0;s<o.types.length;s++)r(o.types[s]);return;default:n.push(o)}}return r(e),{literals:t,parameters:n}}function XP(e,t){let{literals:n,parameters:r}=xW(e);return new bc(n.map(o=>new Kf(o,t)),r.map(o=>new Vf(o,t)))}function ut(e){return e.context?.isOptional??!1}function eR(e){return e.context?.isMutable??!1}function tR(e){return e.annotations?.[yn]===!0||e._tag==="FilterGroup"&&e.checks.every(tR)}function yW(e){function t(r){return tR(r)?[r]:r._tag==="FilterGroup"?r.checks.flatMap(t):[]}let n=e.flatMap(t);return ma(n)?n:void 0}var Ut=na(e=>{if(e.encoding)return Ut(Ue(e,void 0));let t=e,n=t.recur?.(Ut)??t,r=n.encodingChecks;if(r){let o=n===e?r:FE(n)||iW(n)||qs(n)&&n.typeParameters.length>0?yW(r):void 0;return Qf(n,s=>{s.encodingChecks.value=void 0,s.checks.value=UE(n.checks,o)})}return n}),In=na(e=>Ut(_r(e)));function SW(e,t){let n=t,r=n.length,o=n[r-1],s=[new Qe(_r(Ue(e,void 0)),n[0].transformation.flip())];for(let i=1;i<r;i++)s.unshift(new Qe(_r(n[i-1].to),n[i].transformation.flip()));let a=_r(o.to);return a.encoding?Ue(a,[...a.encoding,...s]):Ue(a,s)}var _r=Rt(e=>{if(e.encoding)return SW(e,e.encoding);let t=e;return t.flip?.(_r)??t.recur?.(_r)??t});function nR(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(nR);default:return!1}}function Nm(e,t){let n=ir(t);return(r,o)=>r===Se?Or:r===t?n:k(new Ye(e,r,o))}function Rr(e,t){return(n,r)=>n===Se?Or:t(n)?xt:k(new Ye(e,n,r))}function PP(e,t,n){let r=e.encodedParts,o=e.literals,s=t.length;for(let u=0;u<o.length;u++){let f=o[u];if(f&&!t.includes(f))return}if(e.suffixLengths[0]>s)return;let a=new Array(r.length),i;function c(u,f){if(u===r.length)return f===s;if(i?.has(u*(s+1)+f))return!1;let l=r[u];if(u===r.length-1){let d=t.slice(f);if(l.matchPart(d,n)!==void 0)return a[u]=d,!0}else if(l._tag==="Literal"){let d=o[u];if(t.startsWith(d,f)&&c(u+1,f+d.length))return a[u]=d,!0}else{let d=s-e.suffixLengths[u+1],m=o[u+1],g=m===void 0?d:t.lastIndexOf(m,d);for(;g>=f;){let S=t.slice(f,g);if(l.matchPart(S,n)!==void 0&&c(u+1,g))return a[u]=S,!0;if(g===0)break;g=m===void 0?g-1:t.lastIndexOf(m,g-1)}}return i??=new Set,i.add(u*(s+1)+f),!1}return c(0,0)?a:void 0}var rR=Rt(e=>new un(e.enums.map(t=>new wn(t[1],{title:t[0]})),"anyOf")),GE=Ga(e=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(GE)}}),Dm=Ga(e=>{switch(e._tag){default:return e;case"Symbol":case"UniqueSymbol":return e.toCodecStringTree();case"Union":return e.recur(Dm)}}),oR=Ga(e=>{switch(e._tag){default:return e;case"Number":case"Literal":case"BigInt":return e.toCodecStringTree();case"Union":return e.recur(oR)}}),sR="[\\s\\S]*?",_E=new globalThis.RegExp(`^${Tm}$`),EW=new globalThis.RegExp(`^(?:${Tm}|Infinity|-Infinity|NaN)$`);function KE(e){return Yf(_E,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:_E.source}),...e})}var aR=ao(so,[KE()]),bW=new Qe(aR,Sc),wW=new Qe(new un([aR,HP],"anyOf"),Sc),IW="-?\\d+",PE=new globalThis.RegExp(`^${IW}$`);function VE(e){return Yf(PE,{expected:"a string representing a bigint",representation:{id:"effect/schema/isStringBigInt",payload:null},toJsonSchema:()=>({pattern:PE.source}),...e})}var JE=ao(so,[VE({expected:"a string representing a bigint"})]),vW=new Qe(JE,ym),CW="Symbol\\((.*)\\)",RE=new globalThis.RegExp(`^${CW}$`),TW=ao(so,[ZE()]),iR=new Qe(TW,new be(de(e=>globalThis.Symbol.for(RE.exec(e)[1])),En((e,t)=>globalThis.Symbol.keyFor(e)!==void 0?b(globalThis.String(e)):k(new La({message:"cannot serialize to string, Symbol is not registered"},e,t)))));function ZE(e){return Yf(RE,{expected:"a string representing a symbol",representation:{id:"effect/schema/isStringSymbol",payload:null},toJsonSchema:()=>({pattern:RE.source}),...e})}function Fr(e,t,n,r,o){for(let s=0;s<e.length;s++){let a=e[s];if(a._tag==="FilterGroup"){if(n=Fr(a.checks,t,n,r,o),n&&(o.errors!=="all"||n[n.length-1].filter.aborted))return n}else{let i=a.run(t,r,o);if(i){let c=new tm(a,i,t,o);if(n?n.push(c):n=[c],o.errors!=="all"||a.aborted)return n}}}return n}function cR(e,t){let n=Fr(e,t,void 0,Ko,{errors:"all"});if(n){let r=new nt(Ko,n);return ce(r)}return se(t)}function uR(e){if(!qs(e))return;let t=e.annotations?.[Qp];return _n(t)?t(e.typeParameters):void 0}function kW(e){return e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"&&globalThis.Number.isFinite(e)}function OW(e){return e===void 0||typeof e=="string"}function fR(e,t){let n=new WeakMap,r=[];e:for(;;){if(typeof e!="object"||e===null){if(!t(e))return!1}else{let o=e,s=n.get(o);if(s===!1)return!1;if(s===void 0){let a=Array.isArray(o);if(!a){let i=Object.getPrototypeOf(o);if(i!==null&&i!==Object.prototype&&Object.getPrototypeOf(i)!==null)return!1}n.set(o,!1),r.push({value:o,keys:a?o.length:Object.keys(o),index:0})}}for(;r.length>0;){let o=r[r.length-1],s=o.keys;if(typeof s=="number"){if(o.index<s){e=o.value[o.index++];continue e}}else if(o.index<s.length){e=o.value[s[o.index++]];continue e}n.set(o.value,!0),r.pop()}return!0}}function kc(e){return fR(e,kW)}var vc=new Ba([],()=>(e,t,n)=>kc(e)?xt:k(new Ye(t,e,n)),{representation:{id:"effect/schema/Json",payload:null},expected:"JSON value",toCodecJson:()=>{},toCodecStringTree:()=>QE,toArbitrary:()=>e=>e.jsonValue()}),lR=ur(vc,{representation:{id:"effect/schema/MutableJson",payload:null}}),YE=new Qe(vc,yc()),dR=new Qe(new un([new Pr(!1,[],[vc]),new bc([],[new Vf(so,vc)])],"anyOf"),yc());function AW(e){return fR(e,OW)}var _W=new Ba([],()=>(e,t,n)=>AW(e)?xt:k(new Ye(t,e,n)),{expected:"StringTree",toCodecStringTree:()=>{}}),QE=new Qe(_W,yc());function XE(){return Object.assign(e=>e,{option:e=>R(e),result:e=>se(e),is:e=>!0})}var eb=XE(),tb=XE(),mR="~effect/ChildProcessSpawner/ChildProcessHandle",PW={[mR]:mR,...hv,toJSON(){return{_id:"ChildProcessHandle",pid:this.pid}}},$m=e=>Object.setPrototypeOf({...e},PW),nb=e=>{let t=(r,o)=>e(r).pipe(Y(s=>QA(o?.includeStderr===!0?s.all:s.stdout)),Ms),n=(r,o)=>XA(t(r,o));return zs.of({spawn:e,exitCode:r=>Ps(J(e(r),o=>o.exitCode)),streamString:t,streamLines:n,lines:(r,o)=>e_(n(r,o)),string:(r,o)=>t_(t(r,o))})},zs=class extends He()("effect/process/ChildProcessSpawner"){};var rb="~effect/unstable/process/ChildProcess",SR={...Kr({label:"Command",evaluate(e){return xr(e.context,zs).spawn(this)}}),[rb]:rb},Lm=e=>_(e,rb),RW=e=>e._tag==="StandardCommand",FW=e=>e._tag==="PipedCommand",Ka=(e,t,n)=>Object.assign(Object.create(SR),{_tag:"StandardCommand",command:e,args:t,options:n}),jm=(e,t,n={})=>Object.assign(Object.create(SR),{_tag:"PipedCommand",left:e,right:t,options:n}),nl=function(...t){if(ib(t[0])){let[s,...a]=t,i=cb(s,a);return Ka(i[0]??"",i.slice(1),{})}if(typeof t[0]=="object"&&!Array.isArray(t[0])&&!ib(t[0])){let s=t[0];return function(a,...i){let c=cb(a,i);return Ka(c[0]??"",c.slice(1),s)}}if(typeof t[0]=="string"&&!Array.isArray(t[1])){let[s,a={}]=t;return Ka(s,[],a)}let[n,r=[],o={}]=t;return Ka(n,r,o)},MW=p(e=>Lm(e[0])&&Lm(e[1]),(e,t,n)=>jm(e,t,n??{})),NW=function(...t){if(Lm(t[0])&&t.length>1){let[r,...o]=t,s=hR(o);return ob(r,s)}let n=hR(t);return r=>ob(r,n)},hR=e=>{if(ib(e[0])){let[r,...o]=e,s=cb(r,o);return{command:s[0]??"",args:s.slice(1)}}let[t,n=[]]=e;return{command:t,args:n}},ob=(e,t)=>{switch(e._tag){case"StandardCommand":return Ka(t.command,[...t.args,e.command,...e.args],e.options);case"PipedCommand":return jm(ob(e.left,t),e.right,e.options)}},sb=p(2,(e,t)=>{switch(e._tag){case"StandardCommand":return Ka(e.command,e.args,{...e.options,cwd:t});case"PipedCommand":return jm(sb(e.left,t),sb(e.right,t),e.options)}}),ab=p(2,(e,t)=>{switch(e._tag){case"StandardCommand":{let n=e.options.env===void 0?t:{...e.options.env,...t};return Ka(e.command,e.args,{...e.options,env:n})}case"PipedCommand":return jm(ab(e.left,t),ab(e.right,t),e.options)}}),ib=e=>Array.isArray(e)&&"raw"in e&&Array.isArray(e.raw),rl=e=>{let t=/^fd(\d+)$/.exec(e);if(t===null)return;let n=parseInt(t[1],10);return n>=3?n:void 0},ub=e=>`fd${e}`,cb=(e,t)=>{let n=[];for(let[r,o]of e.entries())n=DW(e,t,n,o,r);return n},DW=(e,t,n,r,o)=>{let s=e.raw[o];if(s===void 0)throw new Error(`Invalid backslash sequence: ${e.raw[o]}`);let{hasLeadingWhitespace:a,hasTrailingWhitespace:i,tokens:c}=UW(r,s),u=yR(n,c,a);if(o===t.length)return u;let f=t[o],l=Array.isArray(f)?f.map(d=>gR(d)):[gR(f)];return yR(u,l,i)},gR=e=>typeof e==="string"?e:String(e),xR=new Set([" "," ","\r",`
|
|
32
|
-
`])
|
|
33
|
-
`?(a-=1,i+=1):u==="u"&&t[i+2]==="{"?i=t.indexOf("}",i+3):i+=$W[u]??1}}let s=o===e.length;return s||r.push(e.slice(o)),{tokens:r,hasLeadingWhitespace:n,hasTrailingWhitespace:s}},yR=(e,t,n)=>n||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t.at(0)}`,...t.slice(1)];import*as Bm from"node:child_process";import{PassThrough as fb}from"node:stream";var ER=(e,t,n)=>{let r=e.detached??n!=="win32";return{...t,detached:r,shell:e.shell,windowsHide:e.windowsHide??!r}};var Re=(e,t)=>(n,[r])=>{let o="Unknown";switch(n.code){case"ENOENT":o="NotFound";break;case"EACCES":o="PermissionDenied";break;case"EEXIST":o="AlreadyExists";break;case"EISDIR":o="BadResource";break;case"ENOTDIR":o="BadResource";break;case"EBUSY":o="Busy";break;case"ELOOP":o="BadResource";break}return qn({_tag:o,module:e,method:t,pathOrDescriptor:r,syscall:n.syscall,cause:n})};var Oc=e=>CS(wS(LW(e),t=>[t])),LW=e=>Ht(t=>{let n=e.evaluate();return b(jW({...e,writable:n,pull:t}))}),jW=e=>e.pull.pipe(J(t=>{let n=0;return Wt(function r(o){for(;n<t.length;)if(!e.writable.write(t[n++],e.encoding)){e.writable.once("drain",()=>r(o));return}o(ge)})}),Xr({disableYield:!0}),Fa(Wt(t=>{let n=r=>t(k(e.onError(r)));return e.writable.once("error",n),ue(()=>{e.writable.off("error",n)})})),e.endOnDone!==!1?Un(t=>"closed"in e.writable&&e.writable.closed?mt(t):Wt(n=>{e.writable.once("finish",()=>n(mt(t))),e.writable.end()})):F);var Ac=e=>ar(qW(e)),qW=e=>Ht((t,n)=>zW({scope:n,readable:e.evaluate(),onError:e.onError??WW,chunkSize:e.chunkSize,closeOnDone:e.closeOnDone}));var zW=e=>{let t=e.readable,n=e.closeOnDone??!0,r=e.exit??fA(void 0),o=iA(!1);function s(){o.openUnsafe()}function a(u){r.current=vr(e.onError(u)),o.openUnsafe()}function i(){r.current=vr(gp()),o.openUnsafe()}t.on("readable",s),t.once("error",a),t.once("end",i);let c=Te(function u(){let f=e.readable.read(e.chunkSize);if(f===null)return r.current?r.current:t.readableEnded?k(gp()):(o.closeUnsafe(),J(o.await,u));let l=ga(f);for(;f=e.readable.read(e.chunkSize),f!==null;)l.push(f);return b(l)});return jn(Qu(e.scope,ue(()=>{t.off("readable",s),t.off("error",a),t.off("end",i),n&&"closed"in e.readable&&!e.readable.closed&&e.readable.destroy()})),c)};var WW=e=>new wk(e);var Va=e=>e instanceof globalThis.Error?e:new globalThis.Error(String(e)),io=(e,t,n)=>{let{commands:r}=IR(n),o=r.reduce((s,a)=>{let i=`${a.command} ${a.args.join(" ")}`;return s.length===0?i:`${s} | ${i}`},"");return Re("ChildProcess",e)(t,[o])},bR=(e,t=()=>{})=>Bm.execFile("taskkill",["/pid",String(e.pid),"/T","/F"],{windowsHide:!0},t),GW=It(function*(){let e=yield*kr,t=yield*no,n=j(function*(x){if(!cs(x.cwd))return yield*e.access(x.cwd),t.resolve(x.cwd)}),r=x=>x.extendEnv?{...globalThis.process.env,...x.env}:x.env,o=x=>Da(x)?"pipe":x,s=x=>Pf(x)?"pipe":x,a=x=>{let h={stream:"pipe",encoding:"utf-8",endOnDone:!0};return cs(x.stdin)?h:typeof x.stdin=="string"?{...h,stream:x.stdin}:Da(x.stdin)?{...h,stream:x.stdin}:{stream:x.stdin.stream,encoding:x.stdin.encoding??h.encoding,endOnDone:x.stdin.endOnDone??h.endOnDone}},i=(x,h)=>{let E=x[h];return cs(E)?{stream:"pipe"}:typeof E=="string"?{stream:E}:Pf(E)?{stream:E}:{stream:E.stream}},c=x=>{if(cs(x.additionalFds))return[];let h=[];for(let[E,w]of Object.entries(x.additionalFds)){let T=rl(E);_e(T)&&h.push({fd:T,config:w})}return h.sort((E,w)=>E.fd-w.fd)},u=(x,h,E,w)=>{let T=[o(x.stream),s(h.stream),s(E.stream)];if(w.length===0)return T;let A=w.reduce(($,{fd:P})=>Math.max($,P),2);for(let $=3;$<=A;$++)T[$]="ignore";for(let{fd:$}of w)T[$]="pipe";return T},f=j(function*(x,h,E){if(E.length===0)return{getInputFd:()=>Rf,getOutputFd:()=>lc};let w=new Map,T=new Map;for(let{config:A,fd:$}of E){let P=h.stdio[$];switch(A.type){case"input":{let L=Rf;P&&"write"in P&&(L=Oc({evaluate:()=>P,onError:U=>io(`fromWritable(fd${$})`,Va(U),x)})),A.stream&&(yield*ac(PS(A.stream,L))),w.set($,L);break}case"output":{let L=lc;if(P&&"read"in P){let U=new fb;P.on("error",oe=>U.destroy(oe)),P.pipe(U),L=Ac({evaluate:()=>U,onError:oe=>io(`fromReadable(fd${$})`,Va(oe),x)})}A.sink&&(L=Zp(L,A.sink)),T.set($,L);break}}}return{getInputFd:A=>w.get(A)??Rf,getOutputFd:A=>T.get(A)??lc}}),l=(x,h,E)=>Te(()=>{let w=Rf;return fu(h.stdin)&&(w=Oc({evaluate:()=>h.stdin,onError:T=>io("fromWritable(stdin)",Va(T),x),endOnDone:E.endOnDone,encoding:E.encoding})),Da(E.stream)?jn(ac(PS(E.stream,w)),w):b(w)}),d=(x,h,E,w)=>{let T=h.stdout?(()=>{let P=new fb;return h.stdout.on("error",L=>P.destroy(L)),h.stdout.pipe(P),Ac({evaluate:()=>P,onError:L=>io("fromReadable(stdout)",Va(L),x)})})():lc,A=h.stderr?(()=>{let P=new fb;return h.stderr.on("error",L=>P.destroy(L)),h.stderr.pipe(P),Ac({evaluate:()=>P,onError:L=>io("fromReadable(stderr)",Va(L),x)})})():lc;Pf(E.stream)&&(T=Zp(T,E.stream)),Pf(w.stream)&&(A=Zp(A,w.stream));let $=YA(T,A);return{stdout:T,stderr:A,all:$}},m=(x,h)=>Wt(E=>{let w=yp(),T=Bm.spawn(x.command,x.args,h);return T.on("error",A=>{E(k(io("spawn",A,x)))}),T.on("exit",(...A)=>{Ey(w,Ir(A))}),T.on("spawn",()=>{E(b([T,w]))}),ue(()=>{T.kill("SIGTERM")})}),g=(x,h,E)=>globalThis.process.platform==="win32"?Wt(w=>{bR(h,T=>{w(T?k(io("kill",Va(T),x)):ge)})}):gt({try:()=>{globalThis.process.kill(-h.pid,E)},catch:w=>io("kill",Va(w),x)}),S=(x,h)=>{if(globalThis.process.platform==="win32"){bR(x);return}try{globalThis.process.kill(-x.pid,h)}catch{}},v=(x,h,E)=>Te(()=>{if(!h.kill(E)){let T=new globalThis.Error("Failed to kill child process");return k(io("kill",T,x))}return ge}),I=(x,h,E)=>w=>{let T=E?.killSignal??"SIGTERM";return cs(E?.forceKillAfter)?w(h,x,T):sS(w(h,x,T),{duration:E.forceKillAfter,orElse:()=>w(h,x,"SIGKILL")})},C=(x,h)=>{let E=h??"stdout";switch(E){case"stdout":return x.stdout;case"stderr":return x.stderr;case"all":return x.all;default:{let w=rl(E);return _e(w)?x.getOutputFd(w):x.stdout}}},y=j(function*(x){switch(x._tag){case"StandardCommand":{let h=a(x.options),E=i(x.options,"stdout"),w=i(x.options,"stderr"),T=c(x.options),A=!0,$=yield*n(x.options),P=r(x.options),L=u(h,E,w,T),[U,oe]=yield*sr(m(x,ER(x.options,{cwd:$,env:P,stdio:L},process.platform)),j(function*([pr,hi]){let gi=yield*Sy(hi),au=I(pr,x,x.options);if(gi){let[is]=yield*Ta(hi);return is!==0&&fu(is)?yield*pf(au(g)):yield*ge}return A?yield*au((is,rv,ov)=>g(is,rv,ov).pipe(rr(()=>v(is,rv,ov)),Ln(Ta(hi)))).pipe(pf):yield*ge})),yt=tb(U.pid);U.on("exit",pr=>{pr!==0&&fu(pr)&&S(U,x.options.killSignal??"SIGTERM")});let Pt=ue(()=>{A||(U.ref(),A=!0)}),su=ue(()=>(A&&(U.unref(),A=!1),Pt)),od=yield*l(x,U,h),{all:sd,stderr:og,stdout:sg}=d(x,U,E,w),{getInputFd:cU,getOutputFd:uU}=yield*f(x,U,T),fU=Y(Sy(oe),pr=>!pr),lU=J(Ta(oe),([pr,hi])=>{if(fu(pr))return b(eb(pr));let gi=new globalThis.Error(`Process interrupted due to receipt of signal: '${hi}'`);return k(io("exitCode",gi,x))});return $m({pid:yt,exitCode:lU,isRunning:fU,kill:pr=>I(U,x,pr)((gi,au,is)=>g(gi,au,is).pipe(rr(()=>v(gi,au,is)),Ln(Ta(oe)))).pipe(lf),stdin:od,stdout:sg,stderr:og,all:sd,getInputFd:cU,getOutputFd:uU,unref:su})}case"PipedCommand":{let{commands:h,pipeOptions:E}=IR(x),[w,...T]=h,A=[yield*y(w)];for(let U=0;U<T.length;U++){let oe=T[U],yt=E[U]??{},Pt=a(oe.options),su=Ms(b(C(A[A.length-1],yt.from))),od=yt.to??"stdin";if(od==="stdin")A.push(yield*y(nl(oe.command,oe.args,{...oe.options,stdin:{...Pt,stream:su}})));else{let sd=rl(od);if(_e(sd)){let og=ub(sd),sg=oe.options.additionalFds??{};A.push(yield*y(nl(oe.command,oe.args,{...oe.options,additionalFds:{...sg,[og]:{type:"input",stream:su}}})))}else A.push(yield*y(nl(oe.command,oe.args,{...oe.options,stdin:{...Pt,stream:su}})))}}let $=A[A.length-1],P=U=>Pa([...A].reverse(),oe=>pf(oe.kill(U)),{discard:!0}),L=It(function*(){let U=[];for(let oe of A)U.push(yield*oe.unref);return Pa([...U].reverse(),oe=>oe,{discard:!0})});return $m({pid:$.pid,exitCode:$.exitCode,isRunning:$.isRunning,kill:P,stdin:$.stdin,stdout:$.stdout,stderr:$.stderr,all:$.all,getInputFd:$.getInputFd,getOutputFd:$.getOutputFd,unref:L})}}});return nb(y)}),wR=Vi(zs,GW),IR=e=>{let t=[],n=[],r=i=>{switch(i._tag){case"StandardCommand":{t.push(i);break}case"PipedCommand":{r(i.left),n.push(i.options),r(i.right);break}}};if(r(e),t.length===0)throw new Error("flattenCommand produced empty commands array");let[o,...s]=t;return{commands:[o,...s],pipeOptions:n}};var KW=e=>e.toString(16).padStart(2,"0"),TR=e=>[e.subarray(0,4),e.subarray(4,6),e.subarray(6,8),e.subarray(8,10),e.subarray(10,16)].map(n=>Array.from(n,KW).join("")).join("-"),kR=()=>globalThis.crypto.getRandomValues(new Uint8Array(16));function vR(e=kR()){return e[6]=e[6]&15|64,e[8]=e[8]&63|128,e}var OR=e=>TR(e===void 0?vR():vR(e)),VW=2**48-1;function CR(e,t=kR()){let n=Math.min(Math.max(0,Math.trunc(e)),VW);return t[0]=Math.floor(n/2**40),t[1]=Math.floor(n/2**32)&255,t[2]=Math.floor(n/2**24)&255,t[3]=Math.floor(n/2**16)&255,t[4]=Math.floor(n/2**8)&255,t[5]=n&255,t[6]=t[6]&15|112,t[8]=t[8]&63|128,t}var AR=(e,t)=>TR(t===void 0?CR(e):CR(e,t));var _R="~effect/platform/Crypto",lb=He("effect/Crypto"),PR=e=>{let t=e.randomBytes,n=a=>Y(ZW("randomBytes",a),t),r=a=>(a[0]&31)*2**48+a[1]*2**40+a[2]*2**32+a[3]*2**24+a[4]*2**16+a[5]*2**8+a[6],o=()=>r(t(7))/2**53,s=()=>{for(;;){let a=t(7),i=r(a);if((a[0]&32)===0)return i+Number.MIN_SAFE_INTEGER;if(i<Number.MAX_SAFE_INTEGER)return i+1}};return lb.of({[_R]:_R,randomBytes:n,nextDoubleUnsafe:o,nextIntUnsafe:s,digest:e.digest,random:ue(()=>o()),randomBoolean:ue(()=>o()>.5),randomInt:ue(()=>s()),randomBetween:(a,i)=>ue(()=>o()*(i-a)+a),randomIntBetween(a,i,c){let u=c?.halfOpen===!0?0:1;return ue(()=>{let f=Math.ceil(a),l=Math.floor(i);return Math.floor(o()*(l-f+u))+f})},randomShuffle:a=>ue(()=>{let i=Array.from(a);for(let c=i.length-1;c>=1;c=c-1){let u=Math.min(c,Math.floor(o()*(c+1))),f=i[c];i[c]=i[u],i[u]=f}return i}),randomUUIDv4:ue(()=>OR(t(16))),randomUUIDv7:yf(a=>b(AR(a.currentTimeMillisUnsafe(),t(16))))})},ZW=(e,t)=>Number.isSafeInteger(t)&&t>=0?b(t):k(Uo({module:"Crypto",method:e,description:"size must be a non-negative safe integer"}));import*as qm from"node:crypto";var YW=e=>{switch(e){case"SHA-1":return"sha1";case"SHA-256":return"sha256";case"SHA-384":return"sha384";case"SHA-512":return"sha512"}},QW=(e,t)=>gt({try:()=>Uint8Array.from(qm.createHash(YW(e)).update(t).digest()),catch:n=>qn({module:"Crypto",method:"digest",_tag:"Unknown",description:"Could not compute digest",cause:n})}),XW=PR({randomBytes:qm.randomBytes,digest:QW}),FR=Zr(lb,XW);var MR=FR;import*as NR from"node:crypto";import*as V from"node:fs";import*as DR from"node:os";import*as _c from"node:path";var Ve=e=>t=>Uo({module:"FileSystem",method:e,description:t.message??String(t)}),nH=(()=>{let e=Ge(V.access,Re("FileSystem","access"),Ve("access"));return(t,n)=>{let r=V.constants.F_OK;return n?.readable&&(r|=V.constants.R_OK),n?.writable&&(r|=V.constants.W_OK),e(t,r)}})(),rH=(()=>{let e=Ge(V.cp,Re("FileSystem","copy"),Ve("copy"));return(t,n,r)=>e(t,n,{force:r?.overwrite??!1,preserveTimestamps:r?.preserveTimestamps??!1,recursive:!0})})(),oH=(()=>{let e=Ge(V.copyFile,Re("FileSystem","copyFile"),Ve("copyFile"));return(t,n)=>e(t,n)})(),sH=(()=>{let e=Ge(V.chmod,Re("FileSystem","chmod"),Ve("chmod"));return(t,n)=>e(t,n)})(),aH=(()=>{let e=Ge(V.chown,Re("FileSystem","chown"),Ve("chown"));return(t,n,r)=>e(t,n,r)})(),iH=(()=>{let e=Ge(V.glob,Re("FileSystem","glob"),Ve("glob"));return(t,n)=>e(t,{cwd:n?.root,exclude:n?.exclude})})(),cH=(()=>{let e=Ge(V.link,Re("FileSystem","link"),Ve("link"));return(t,n)=>e(t,n)})(),uH=(()=>{let e=Ge(V.mkdir,Re("FileSystem","makeDirectory"),Ve("makeDirectory"));return(t,n)=>e(t,{recursive:n?.recursive??!1,mode:n?.mode})})(),db=e=>{let t=Ge(V.mkdtemp,Re("FileSystem",e),Ve(e));return n=>Te(()=>{let r=n?.prefix??"",o=typeof n?.directory=="string"?_c.join(n.directory,"."):DR.tmpdir();return t(r?_c.join(o,r):o+"/")})},fH=db("makeTempDirectory"),pb=e=>{let t=Ge(V.rm,Re("FileSystem",e),Ve(e));return(n,r)=>t(n,{recursive:r?.recursive??!1,force:r?.force??!1})},lH=pb("remove"),dH=(()=>{let e=db("makeTempDirectoryScoped"),t=pb("makeTempDirectoryScoped");return n=>sr(e(n),r=>or(t(r,{recursive:!0})))})(),pH=e=>{let t=Ge(V.open,Re("FileSystem",e),Ve(e)),n=Ge(V.close,Re("FileSystem",e),Ve(e));return(r,o)=>mr(sr(t(r,o?.flag??"r",o?.mode),s=>or(n(s))),Y(s=>hH(s,o?.flag?.startsWith("a")??!1)))},mH=pH("open"),hH=(()=>{let e=f=>Ge(V.read,Re("FileSystem",f),Ve(f)),t=e("read"),n=e("readAlloc"),r=Ge(V.fstat,Re("FileSystem","stat"),Ve("stat")),o=Ge(V.ftruncate,Re("FileSystem","truncate"),Ve("truncate")),s=Ge(V.fsync,Re("FileSystem","sync"),Ve("sync")),a=f=>Ge(V.write,Re("FileSystem",f),Ve(f)),i=a("write"),c=a("writeAll");class u{[pc];fd;append;position=BigInt(0);constructor(l,d){this[pc]=pc,this.fd=l,this.append=d}get stat(){return Y(r(this.fd),UR)}get sync(){return s(this.fd)}seek(l,d){let m=cn(l);return ue(()=>(d==="start"?this.position=m:d==="current"&&(this.position=this.position+m),cn(this.position)))}read(l){return Te(()=>{let d=this.position;return Y(t(this.fd,{buffer:l,position:d}),m=>{let g=cn(m);return this.position=d+g,g})})}readAlloc(l){let d=Number(l);return Te(()=>{let m=Buffer.allocUnsafeSlow(d),g=this.position;return Y(n(this.fd,{buffer:m,position:g}),S=>{if(S===0)return O();if(this.position=g+BigInt(S),S===d)return R(m);let v=Buffer.allocUnsafeSlow(S);return m.copy(v,0,0,S),R(v)})})}truncate(l){return Y(o(this.fd,l?Number(l):void 0),()=>{if(!this.append){let d=BigInt(l??0);this.position>d&&(this.position=d)}})}write(l){return Te(()=>{let d=this.position;return Y(i(this.fd,l,void 0,void 0,this.append?void 0:Number(d)),m=>{let g=cn(m);return this.append||(this.position=d+g),g})})}writeAllChunk(l){return Te(()=>{let d=this.position;return J(c(this.fd,l,void 0,void 0,this.append?void 0:Number(d)),m=>m===0?k(qn({module:"FileSystem",method:"writeAll",_tag:"WriteZero",pathOrDescriptor:this.fd,description:"write returned 0 bytes written"})):(this.append||(this.position=d+BigInt(m)),m<l.length?this.writeAllChunk(l.subarray(m)):ge))})}writeAll(l){return this.writeAllChunk(l)}}return(f,l)=>new u(f,l)})(),$R=e=>{let t=db(e);return j(function*(n){let r=yield*t(n),o=NR.randomBytes(6).toString("hex"),s=_c.join(r,n?.suffix?`${o}${n.suffix}`:o);return yield*LR(s,new Uint8Array(0)),s})},gH=$R("makeTempFile"),xH=(()=>{let e=$R("makeTempFileScoped"),t=pb("makeTempFileScoped");return n=>sr(e(n),r=>or(t(_c.dirname(r),{recursive:!0})))})(),yH=(e,t)=>Xi({try:()=>V.promises.readdir(e,t),catch:n=>Re("FileSystem","readDirectory")(n,[e])}),SH=e=>Wt((t,n)=>{try{V.readFile(e,{signal:n},(r,o)=>{t(r?k(Re("FileSystem","readFile")(r,[e])):b(o))})}catch(r){t(k(Ve("readFile")(r)))}}),EH=(()=>{let e=Ge(V.readlink,Re("FileSystem","readLink"),Ve("readLink"));return t=>e(t)})(),bH=(()=>{let e=Ge(V.realpath,Re("FileSystem","realPath"),Ve("realPath"));return t=>e(t)})(),wH=(()=>{let e=Ge(V.rename,Re("FileSystem","rename"),Ve("rename"));return(t,n)=>e(t,n)})(),UR=e=>({type:e.isFile()?"File":e.isDirectory()?"Directory":e.isSymbolicLink()?"SymbolicLink":e.isBlockDevice()?"BlockDevice":e.isCharacterDevice()?"CharacterDevice":e.isFIFO()?"FIFO":e.isSocket()?"Socket":"Unknown",mtime:Yn(e.mtime),atime:Yn(e.atime),birthtime:Yn(e.birthtime),dev:e.dev,rdev:Yn(e.rdev),ino:Yn(e.ino),mode:e.mode,nlink:Yn(e.nlink),uid:Yn(e.uid),gid:Yn(e.gid),size:cn(e.size),blksize:e.blksize!==void 0?R(cn(e.blksize)):O(),blocks:Yn(e.blocks)}),mb=(()=>{let e=Ge(V.stat,Re("FileSystem","stat"),Ve("stat"));return t=>Y(e(t),UR)})(),IH=(()=>{let e=Ge(V.symlink,Re("FileSystem","symlink"),Ve("symlink"));return(t,n)=>e(t,n)})(),vH=(()=>{let e=Ge(V.truncate,Re("FileSystem","truncate"),Ve("truncate"));return(t,n)=>e(t,n!==void 0?Number(n):void 0)})(),CH=(()=>{let e=Ge(V.utimes,Re("FileSystem","utime"),Ve("utime"));return(t,n,r)=>e(t,n,r)})(),TH=(e,t)=>JA(n=>sr(ue(()=>{let r=V.watch(e,{recursive:t?.recursive??!1},(o,s)=>{if(s)switch(o){case"rename":{eo(Np(mb(s),{onSuccess:a=>vf(n,{_tag:"Create",path:s}),onFailure:a=>vf(n,{_tag:"Remove",path:s})}));return}case"change":{Cf(n,{_tag:"Update",path:s});return}}});return r.on("error",o=>{kf(n,Ek(qn({module:"FileSystem",_tag:"Unknown",method:"watch",pathOrDescriptor:e,cause:o})))}),r.on("close",()=>{Bo(n)}),r}),r=>ue(()=>r.close()))),kH=(e,t,n)=>mb(t).pipe(Y(r=>e.pipe(_g(o=>o.register(t,r,n)),it(()=>TH(t,n)))),Ms),LR=(e,t,n)=>Wt((r,o)=>{try{V.writeFile(e,t,{signal:o,flag:n?.flag,mode:n?.mode},s=>{r(s?k(Re("FileSystem","writeFile")(s,[e])):ge)})}catch(s){r(k(Ve("writeFile")(s)))}}),OH=Y($p(Mf),e=>RS({access:nH,chmod:sH,chown:aH,copy:rH,copyFile:oH,glob:iH,link:cH,makeDirectory:uH,makeTempDirectory:fH,makeTempDirectoryScoped:dH,makeTempFile:gH,makeTempFileScoped:xH,open:mH,readDirectory:yH,readFile:SH,readLink:EH,realPath:bH,remove:lH,rename:wH,stat:mb,symlink:IH,truncate:vH,utimes:CH,watch(t,n){return kH(e,t,n)},writeFile:LR})),jR=Vi(kr)(OH);var BR=jR;import*as sl from"node:path";import*as zm from"node:url";var hb=e=>({fromFileUrl:t=>gt({try:()=>zm.fileURLToPath(t,{windows:e}),catch:n=>new to({module:"Path",method:"fromFileUrl",cause:n})}),toFileUrl:t=>gt({try:()=>zm.pathToFileURL(t,{windows:e}),catch:n=>new to({module:"Path",method:"toFileUrl",cause:n})})}),PH=Zr(no)({[Wo]:Wo,...sl.posix,...hb(!1)}),RH=Zr(no)({[Wo]:Wo,...sl.win32,...hb(!0)}),qR=Zr(no)({[Wo]:Wo,...sl,...hb(void 0)});var zR=qR;var gb="~effect/Stdio",Wm=He(gb),WR=e=>({[gb]:gb,stdinIsTerminal:b(!1),stdoutIsTerminal:b(!1),...e});var HR=Zr(Wm,WR({args:ue(()=>process.argv.slice(2)),stdinIsTerminal:ue(()=>process.stdin.isTTY===!0),stdoutIsTerminal:ue(()=>process.stdout.isTTY===!0),stdout:e=>Oc({evaluate:()=>process.stdout,onError:t=>qn({module:"Stdio",method:"stdout",_tag:"Unknown",cause:t}),endOnDone:e?.endOnDone??!1}),stderr:e=>Oc({evaluate:()=>process.stderr,onError:t=>qn({module:"Stdio",method:"stderr",_tag:"Unknown",cause:t}),endOnDone:e?.endOnDone??!1}),stdin:Ac({evaluate:()=>process.stdin,onError:e=>qn({module:"Stdio",method:"stdin",_tag:"Unknown",cause:e}),closeOnDone:!1})}));var GR=HR;var xe={};jr(xe,{Any:()=>W3,Array:()=>Oe,ArrayEnsure:()=>tK,BigDecimal:()=>gw,BigDecimalFromString:()=>YV,BigDecimalReviver:()=>ZV,BigInt:()=>uo,BigIntFromString:()=>i4,Boolean:()=>xh,BooleanFromBit:()=>m4,Cause:()=>ph,CauseReason:()=>dh,CauseReasonReviver:()=>bV,CauseReviver:()=>wV,Char:()=>cV,Chunk:()=>w1,ChunkReviver:()=>NV,Class:()=>U1,Date:()=>Cn,DateFromMillis:()=>BV,DateFromString:()=>jV,DateReviver:()=>LV,DateTimeUtc:()=>Dl,DateTimeUtcFromDate:()=>E4,DateTimeUtcFromMillis:()=>w4,DateTimeUtcFromString:()=>b4,DateTimeUtcReviver:()=>S4,DateTimeZoned:()=>ww,DateTimeZonedFromString:()=>A4,DateTimeZonedReviver:()=>O4,Defect:()=>mw,Duration:()=>Ml,DurationFromMillis:()=>HV,DurationFromNanos:()=>WV,DurationFromString:()=>T1,DurationReviver:()=>qV,Enum:()=>q3,Error:()=>vh,ErrorInstance:()=>p1,ErrorInstanceReviver:()=>CV,Exit:()=>m1,ExitReviver:()=>TV,File:()=>xw,FileReviver:()=>e4,Finite:()=>vn,FiniteFromString:()=>a4,FormData:()=>yw,FormDataReviver:()=>t4,Graph:()=>y1,GraphReviver:()=>PV,HashMap:()=>S1,HashMapReviver:()=>RV,HashSet:()=>b1,HashSetReviver:()=>MV,Int:()=>fo,Json:()=>Ll,JsonObject:()=>pJ,JsonReviver:()=>mJ,Literal:()=>$e,Literals:()=>es,MutableJson:()=>J1,MutableJsonReviver:()=>gJ,Natural:()=>Lt,Never:()=>z3,NonEmptyArray:()=>eK,NonEmptyString:()=>r1,Null:()=>Ie,NullOr:()=>sw,NullishOr:()=>iN,Number:()=>Tl,NumberFromString:()=>s4,ObjectKeyword:()=>G3,Opaque:()=>hK,Option:()=>Js,OptionFromNullOr:()=>fV,OptionFromNullishOr:()=>dV,OptionFromOptional:()=>mV,OptionFromOptionalKey:()=>pV,OptionFromOptionalNullOr:()=>hV,OptionFromUndefinedOr:()=>lV,OptionReviver:()=>uV,PropertyKey:()=>Xb,ReadonlyMap:()=>x1,ReadonlyMapReviver:()=>kV,ReadonlySet:()=>E1,ReadonlySetReviver:()=>FV,Record:()=>yh,Redacted:()=>bh,RedactedFromValue:()=>EV,RedactedReviver:()=>SV,RegExp:()=>I1,RegExpReviver:()=>DV,Result:()=>o1,ResultReviver:()=>gV,SchemaError:()=>Ks,StandardSchemaV1FailureResult:()=>p4,String:()=>H,StringFromBase64:()=>u4,StringFromBase64Url:()=>f4,StringFromHex:()=>l4,StringFromUriComponent:()=>d4,Struct:()=>G,StructWithRest:()=>Q3,Symbol:()=>oN,TaggedClass:()=>F4,TaggedError:()=>$r,TaggedStruct:()=>Eh,TaggedUnion:()=>mK,TemplateLiteral:()=>j3,TemplateLiteralParser:()=>B3,TimeZone:()=>bw,TimeZoneFromString:()=>k4,TimeZoneNamed:()=>Ew,TimeZoneNamedFromString:()=>C4,TimeZoneNamedReviver:()=>v4,TimeZoneOffset:()=>F1,TimeZoneOffsetReviver:()=>I4,TimeZoneReviver:()=>T4,Tree:()=>dJ,Trim:()=>c4,Trimmed:()=>P1,Tuple:()=>Uc,TupleWithRest:()=>X3,URL:()=>Ih,URLFromString:()=>UV,URLReviver:()=>$V,URLSearchParams:()=>Sw,URLSearchParamsReviver:()=>r4,Uint8Array:()=>Nl,Uint8ArrayFromBase64:()=>g4,Uint8ArrayFromBase64Url:()=>x4,Uint8ArrayFromHex:()=>y4,Uint8ArrayReviver:()=>h4,Undefined:()=>rw,UndefinedOr:()=>Sh,Union:()=>Xe,UniqueArray:()=>nK,UniqueSymbol:()=>K3,Unknown:()=>nw,UnknownFromJsonString:()=>XV,Void:()=>H3,annotate:()=>h3,annotateEncoded:()=>g3,annotateKey:()=>x3,asserts:()=>b3,brand:()=>uN,catchDecoding:()=>iK,catchDecodingWithContext:()=>dN,catchEncoding:()=>cK,catchEncodingWithContext:()=>pN,check:()=>oK,declare:()=>dr,declareConstructor:()=>Tn,decode:()=>uK,decodeEffect:()=>w3,decodeExit:()=>I3,decodeOption:()=>C3,decodePromise:()=>k3,decodeResult:()=>T3,decodeSync:()=>O3,decodeTo:()=>re,decodeUnknownEffect:()=>Xo,decodeUnknownExit:()=>VM,decodeUnknownOption:()=>v3,decodeUnknownPromise:()=>ZM,decodeUnknownResult:()=>JM,decodeUnknownSync:()=>YM,encode:()=>fK,encodeEffect:()=>QM,encodeExit:()=>A3,encodeKeys:()=>Z3,encodeOption:()=>P3,encodePromise:()=>F3,encodeResult:()=>R3,encodeSync:()=>M3,encodeTo:()=>aw,encodeUnknownEffect:()=>hh,encodeUnknownExit:()=>XM,encodeUnknownOption:()=>_3,encodeUnknownPromise:()=>tN,encodeUnknownResult:()=>eN,encodeUnknownSync:()=>nN,extendTo:()=>Y3,fieldsAssign:()=>V3,flip:()=>Yb,fromBrand:()=>aK,fromFormData:()=>n4,fromJsonString:()=>_1,fromURLSearchParams:()=>o4,instanceOf:()=>Vs,is:()=>Cl,isBase64:()=>uw,isBase64Reviver:()=>kK,isBase64Url:()=>vN,isBase64UrlReviver:()=>OK,isBetween:()=>Rl,isBetweenBigDecimal:()=>ZK,isBetweenBigInt:()=>KN,isBetweenBigIntReviver:()=>aJ,isBetweenDate:()=>qN,isBetweenDateReviver:()=>tJ,isBetweenReviver:()=>BK,isCapitalized:()=>_N,isCapitalizedReviver:()=>MK,isEndsWith:()=>TN,isEndsWithReviver:()=>_K,isFinite:()=>RN,isFiniteReviver:()=>DK,isGUID:()=>wN,isGUIDReviver:()=>CK,isGreaterThan:()=>MN,isGreaterThanBigDecimal:()=>GK,isGreaterThanBigInt:()=>zN,isGreaterThanBigIntReviver:()=>nJ,isGreaterThanDate:()=>UN,isGreaterThanDateReviver:()=>Y4,isGreaterThanOrEqualTo:()=>fw,isGreaterThanOrEqualToBigDecimal:()=>KK,isGreaterThanOrEqualToBigInt:()=>WN,isGreaterThanOrEqualToBigIntReviver:()=>rJ,isGreaterThanOrEqualToDate:()=>LN,isGreaterThanOrEqualToDateReviver:()=>Q4,isGreaterThanOrEqualToReviver:()=>UK,isGreaterThanReviver:()=>$K,isIncludes:()=>kN,isIncludesReviver:()=>PK,isInt:()=>Fl,isInt32:()=>WK,isIntReviver:()=>zK,isLengthBetween:()=>dw,isLengthBetweenReviver:()=>XK,isLessThan:()=>NN,isLessThanBigDecimal:()=>VK,isLessThanBigInt:()=>HN,isLessThanBigIntReviver:()=>oJ,isLessThanDate:()=>jN,isLessThanDateReviver:()=>X4,isLessThanOrEqualTo:()=>DN,isLessThanOrEqualToBigDecimal:()=>JK,isLessThanOrEqualToBigInt:()=>GN,isLessThanOrEqualToBigIntReviver:()=>sJ,isLessThanOrEqualToDate:()=>BN,isLessThanOrEqualToDateReviver:()=>eJ,isLessThanOrEqualToReviver:()=>jK,isLessThanReviver:()=>LK,isLowercased:()=>AN,isLowercasedReviver:()=>FK,isMaxLength:()=>JN,isMaxLengthReviver:()=>QK,isMaxProperties:()=>e1,isMaxPropertiesReviver:()=>oV,isMaxSize:()=>YN,isMaxSizeReviver:()=>tV,isMinLength:()=>lw,isMinLengthReviver:()=>YK,isMinProperties:()=>XN,isMinPropertiesReviver:()=>rV,isMinSize:()=>ZN,isMinSizeReviver:()=>eV,isMultipleOf:()=>$N,isMultipleOfReviver:()=>qK,isNonEmpty:()=>VN,isPattern:()=>ri,isPatternReviver:()=>SK,isPropertiesLengthBetween:()=>t1,isPropertiesLengthBetweenReviver:()=>sV,isPropertyNames:()=>n1,isPropertyNamesReviver:()=>aV,isSchema:()=>gh,isSchemaError:()=>zM,isSizeBetween:()=>QN,isSizeBetweenReviver:()=>nV,isStartsWith:()=>CN,isStartsWithReviver:()=>AK,isStringBigInt:()=>SN,isStringBigIntReviver:()=>bK,isStringFinite:()=>yN,isStringFiniteReviver:()=>EK,isStringSymbol:()=>EN,isStringSymbolReviver:()=>wK,isTrimmed:()=>cw,isTrimmedReviver:()=>xK,isULID:()=>IN,isULIDReviver:()=>TK,isUUID:()=>bN,isUUIDReviver:()=>vK,isUint32:()=>HK,isUncapitalized:()=>PN,isUncapitalizedReviver:()=>NK,isUnique:()=>pw,isUniqueReviver:()=>iV,isUppercased:()=>ON,isUppercasedReviver:()=>RK,link:()=>Le,make:()=>W,makeFilter:()=>je,makeFilterGroup:()=>gK,makeIsBetween:()=>Pl,makeIsGreaterThan:()=>kl,makeIsGreaterThanOrEqualTo:()=>Ol,makeIsLessThan:()=>Al,makeIsLessThanOrEqualTo:()=>_l,makeIsMultipleOf:()=>FN,middlewareDecoding:()=>fN,middlewareEncoding:()=>lN,mutable:()=>rK,mutableKey:()=>$3,optional:()=>ln,optionalKey:()=>Yo,overrideToCodecIso:()=>fJ,overrideToEquivalence:()=>$4,overrideToFormatter:()=>N4,readonlyKey:()=>U3,refine:()=>sK,required:()=>D3,requiredKey:()=>N3,resolveAnnotations:()=>xJ,resolveAnnotationsKey:()=>yJ,revealBottom:()=>m3,revealCodec:()=>y3,suspend:()=>cN,tag:()=>Qo,tagDefaultOmit:()=>pK,toArbitrary:()=>M4,toCodecArrayFromSingle:()=>z4,toCodecIso:()=>z1,toCodecJson:()=>j1,toCodecJsonAST:()=>Ch,toCodecStringTree:()=>Ul,toDifferJsonPatch:()=>lJ,toEncoded:()=>qc,toEncoderXml:()=>W4,toEquivalence:()=>U4,toFormatter:()=>D4,toIso:()=>iJ,toIsoFocus:()=>uJ,toIsoSource:()=>cJ,toJsonSchemaDocument:()=>L1,toRepresentation:()=>L4,toStandardJSONSchemaV1:()=>E3,toStandardSchemaV1:()=>S3,toTaggedUnion:()=>xN,toType:()=>dn,withConstructorDefault:()=>mN,withDecodingDefault:()=>gN,withDecodingDefaultKey:()=>iw,withDecodingDefaultType:()=>dK,withDecodingDefaultTypeKey:()=>lK});var Hm="~effect/collections/Graph",yb=e=>e;var $H=(e,t,n)=>(e==="directed"?t.source===n.source&&t.target===n.target:t.source===n.source&&t.target===n.target||t.source===n.target&&t.target===n.source)&&K(t.data,n.data),UH=(e,t)=>e==="directed"?Z(t):us(Z(t.data)^Z(t.source)+Z(t.target)),LH={[Hm]:{_N:e=>e,_E:e=>e},[Symbol.iterator](){return this.nodes[Symbol.iterator]()},[dt](){return this.toJSON()},[he](e){if(_(e,Hm)){let t=yb(e);if(this.nodes.size!==t.nodes.size||this.edges.size!==t.edges.size||this.type!==t.type)return!1;for(let[n,r]of this.nodes)if(!t.nodes.has(n)||!K(r,t.nodes.get(n)))return!1;for(let[n,r]of this.edges){let o=t.edges.get(n);if(o===void 0||!$H(this.type,r,o))return!1}return!0}return!1},[me](){let e=Fe("Graph");e=e^Fe(this.type),e=e^mn(this.nodes.size),e=e^mn(this.edges.size);for(let[t,n]of this.nodes)e=e^Z(t)+Z(n);for(let[t,n]of this.edges)e=e^Z(t)+UH(this.type,n);return e},toJSON(){return{_id:"Graph",nodeCount:this.nodes.size,edgeCount:this.edges.size,type:this.type}},toString(){return`Graph(${this.type}, ${this.nodes.size}, ${this.edges.size})`},pipe(){return ne(this,arguments)}},KR=(e,t)=>{let n=Object.create(LH);return n.type=e,n.mutable=t,n.transforming=!1,n.nodes=new Map,n.edges=new Map,n.adjacency=new Map,n.reverseAdjacency=new Map,n.nextNodeIndex=0,n.nextEdgeIndex=0,n.acyclic=R(!0),n};var al=e=>{let t=yb(e);return{type:e.type,nodes:Array.from(t.nodes,([n,r])=>({index:n,data:r})).sort((n,r)=>n.index-r.index),edges:Array.from(t.edges,([n,r])=>({index:n,source:r.source,target:r.target,data:r.data})).sort((n,r)=>n.index-r.index)}},il=e=>{let t=KR(e.type,!1);for(let n of e.nodes)t.nodes.set(n.index,n.data),t.adjacency.set(n.index,[]),t.reverseAdjacency.set(n.index,[]);for(let n of e.edges)t.edges.set(n.index,{source:n.source,target:n.target,data:n.data}),t.adjacency.get(n.source).push(n.index),t.reverseAdjacency.get(n.target).push(n.index),e.type==="undirected"&&(t.adjacency.get(n.target).push(n.index),t.reverseAdjacency.get(n.source).push(n.index));return t.nextNodeIndex=e.nodes.length===0?0:e.nodes[e.nodes.length-1].index+1,t.nextEdgeIndex=e.edges.length===0?0:e.edges[e.edges.length-1].index+1,t.acyclic=O(),t};var jH=Hm;var Sb=e=>_(e,jH);var JR=class e{type;source;target;identity;constructor(t,n,r,o){this.type=t,this.source=n,this.target=r,this.identity=o}[he](t){return!(t instanceof e)||this.type!==t.type||!K(this.identity,t.identity)?!1:this.type==="directed"?K(this.source,t.source)&&K(this.target,t.target):K(this.source,t.source)&&K(this.target,t.target)||K(this.source,t.target)&&K(this.target,t.source)}[me](){let t=Z(this.identity);return this.type==="directed"?st(Z(this.target))(st(Z(this.source))(t)):us(t^Z(this.source)+Z(this.target))}};var Km="~effect/collections/HashMap",Mr=5,ul=1<<Mr,BH=ul/4,YR=ul/2,qH=ul-1,zH=e=>(e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24),cl=(e,t)=>e>>>t&qH,Ws=(e,t)=>1<<cl(e,t),Gm=(e,t)=>zH(e&t-1);function QR(e,t,n,r,o,s){if(t>32)throw new Error("HashMap: max depth exceeded");let a=Ws(n,t),i=Ws(o,t);if(a===i){let f=QR(e,t+Mr,n,r,o,s);return new Ya(e,a,[f])}let c=a|i,u=a>>>0<i>>>0?[r,s]:[s,r];return new Ya(e,c,u)}var Ja=class{canEdit(t){return this.edit===t}},Eb=class extends Ja{_tag="EmptyNode";edit=0;get size(){return 0}get(t,n,r){return O()}has(t,n,r){return!1}set(t,n,r,o,s,a){return a.value=!0,new Za(t,r,o,s)}remove(t,n,r,o,s){return this}iterator(){return[][Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}canEdit(t){return!1}},Za=class e extends Ja{_tag="LeafNode";edit;hash;key;value;constructor(t,n,r,o){super(),this.edit=t,this.hash=n,this.key=r,this.value=o}get size(){return 1}get(t,n,r){return this.hash===n&&K(this.key,r)?R(this.value):O()}has(t,n,r){return this.hash===n&&K(this.key,r)}set(t,n,r,o,s,a){if(this.hash===r&&K(this.key,o))return K(this.value,s)?this:this.canEdit(t)?(this.value=s,this):new e(t,r,o,s);if(a.value=!0,this.hash===r)return new bb(t,r,[[this.key,this.value],[o,s]]);let i=Ws(r,n),c=Ws(this.hash,n);if(i===c)return new Ya(t,i,[this.set(t,n+Mr,r,o,s,a)]);let u=i|c,f=i>>>0<c>>>0?[new e(t,r,o,s),this]:[this,new e(t,r,o,s)];return new Ya(t,u,f)}remove(t,n,r,o,s){if(this.hash===r&&K(this.key,o)){s.value=!0;return}return this}iterator(){return[[this.key,this.value]][Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}},bb=class e extends Ja{_tag="CollisionNode";edit;hash;entries;constructor(t,n,r){super(),this.edit=t,this.hash=n,this.entries=r}get size(){return this.entries.length}get(t,n,r){if(this.hash!==n)return O();for(let[o,s]of this.entries)if(K(o,r))return R(s);return O()}has(t,n,r){if(this.hash!==n)return!1;for(let[o]of this.entries)if(K(o,r))return!0;return!1}set(t,n,r,o,s,a){if(this.hash!==r)return a.value=!0,QR(t,n,this.hash,this,r,new Za(t,r,o,s));for(let i=0;i<this.entries.length;i++)if(K(this.entries[i][0],o)){if(K(this.entries[i][1],s))return this;if(this.canEdit(t))return this.entries[i]=[o,s],this;let c=[...this.entries];return c[i]=[o,s],new e(t,this.hash,c)}return a.value=!0,this.canEdit(t)?(this.entries.push([o,s]),this):new e(t,this.hash,[...this.entries,[o,s]])}remove(t,n,r,o,s){if(this.hash!==r)return this;let a=this.entries.findIndex(([c])=>K(c,o));if(a===-1)return this;if(s.value=!0,this.entries.length===1)return;if(this.entries.length===2){let c=this.entries[a===0?1:0];return new Za(t,this.hash,c[0],c[1])}if(this.canEdit(t))return this.entries.splice(a,1),this;let i=[...this.entries];return i.splice(a,1),new e(t,this.hash,i)}iterator(){return this.entries[Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}},Ya=class e extends Ja{_tag="IndexedNode";edit;_size;bitmap;children;constructor(t,n,r){super(),this.edit=t,this.bitmap=n,this.children=r}get size(){return this._size===void 0&&(this._size=this.children.reduce((t,n)=>t+n.size,0)),this._size}get(t,n,r){let o=Ws(n,t);if((this.bitmap&o)===0)return O();let s=Gm(this.bitmap,o);return this.children[s].get(t+Mr,n,r)}has(t,n,r){let o=Ws(n,t);if((this.bitmap&o)===0)return!1;let s=Gm(this.bitmap,o);return this.children[s].has(t+Mr,n,r)}set(t,n,r,o,s,a){let i=Ws(r,n),c=Gm(this.bitmap,i);if((this.bitmap&i)!==0){let u=this.children[c],f=u.set(t,n+Mr,r,o,s,a);if(u===f)return this;if(this.canEdit(t))return this.children[c]=f,this;let l=[...this.children];return l[c]=f,new e(t,this.bitmap,l)}else{a.value=!0;let u=new Za(t,r,o,s),f=this.bitmap|i;if(this.canEdit(t))return this.children.splice(c,0,u),this.bitmap=f,this._size=void 0,this.children.length>YR?this.expand(t,f,this.children):this;let l=[...this.children];return l.splice(c,0,u),l.length>YR?this.expand(t,f,l):new e(t,f,l)}}remove(t,n,r,o,s){let a=Ws(r,n);if((this.bitmap&a)===0)return this;let i=Gm(this.bitmap,a),c=this.children[i],u=c.remove(t,n+Mr,r,o,s);if(!s.value)return this;if(u===void 0){let l=this.bitmap^a;if(l===0)return;if(this.children.length===2){let m=this.children[i===0?1:0];if(m._tag==="LeafNode")return m}if(this.canEdit(t))return this.children.splice(i,1),this.bitmap=l,this._size=void 0,this;let d=[...this.children];return d.splice(i,1),new e(t,l,d)}if(c===u)return this;if(this.canEdit(t))return this.children[i]=u,this;let f=[...this.children];return f[i]=u,new e(t,this.bitmap,f)}expand(t,n,r){let o=new globalThis.Array(ul),s=0;for(let a=0;a<ul;a++)(n&1<<a)!==0&&(o[a]=r[s++]);return new wb(t,r.length,o)}iterator(){let t=0,n;return{next:()=>{for(;t<this.children.length;){n||(n=this.children[t].iterator());let r=n.next();if(!r.done)return r;n=void 0,t++}return{done:!0,value:void 0}}}}[Symbol.iterator](){return this.iterator()}},wb=class e extends Ja{_tag="ArrayNode";edit;_size;count;children;constructor(t,n,r){super(),this.edit=t,this.count=n,this.children=r}get size(){return this._size===void 0&&(this._size=this.children.reduce((t,n)=>t+(n?.size??0),0)),this._size}get(t,n,r){let o=cl(n,t),s=this.children[o];return s?s.get(t+Mr,n,r):O()}has(t,n,r){let o=cl(n,t),s=this.children[o];return s?s.has(t+Mr,n,r):!1}set(t,n,r,o,s,a){let i=cl(r,n),c=this.children[i];if(c){let u=c.set(t,n+Mr,r,o,s,a);if(c===u)return this;if(this.canEdit(t))return this.children[i]=u,this;let f=[...this.children];return f[i]=u,new e(t,this.count,f)}else{a.value=!0;let u=new Za(t,r,o,s);if(this.canEdit(t))return this.children[i]=u,this.count++,this._size=void 0,this;let f=[...this.children];return f[i]=u,new e(t,this.count+1,f)}}remove(t,n,r,o,s){let a=cl(r,n),i=this.children[a];if(!i)return this;let c=i.remove(t,n+Mr,r,o,s);if(!s.value)return this;let u=this.count-(c?0:1);if(u<BH)return this.pack(t,a,c);if(i===c)return this;if(this.canEdit(t))return this.children[a]=c,c||(this.count=u),this._size=void 0,this;let f=[...this.children];return f[a]=c,new e(t,u,f)}pack(t,n,r){let o=[],s=0,a=1;for(let i=0;i<this.children.length;i++){let c=i===n?r:this.children[i];c&&(o.push(c),s|=a),a<<=1}return new Ya(t,s,o)}iterator(){let t=0,n;return{next:()=>{for(;t<this.children.length;){let r=this.children[t];if(!r){t++;continue}n||(n=r.iterator());let o=n.next();if(!o.done)return o;n=void 0,t++}return{done:!0,value:void 0}}}}[Symbol.iterator](){return this.iterator()}},fl=class{[Km]=Km;_editable;_edit;_root;_size;constructor(t,n,r,o){this._editable=t,this._edit=n,this._root=r,this._size=o}get size(){return this._size}[Symbol.iterator](){return this._root.iterator()}[he](t){if(Ib(t)){let n=t;if(this.size!==n.size)return!1;for(let[r,o]of this){let s=mr(t,tF(r));if(Ne(s)||!K(o,s.value))return!1}return!0}return!1}[me](){let t=Fe("HashMap");for(let[n,r]of this)t=t^Z(n)+Z(r);return t}[dt](){return Ct(this)}toString(){return`HashMap(${D(Array.from(this))})`}toJSON(){return{_id:"HashMap",values:Array.from(this).map(([t,n])=>[Ct(t),Ct(n)])}}pipe(){return ne(this,arguments)}},XR=new Eb,Ib=e=>_(e,Km),vb=()=>new fl(!1,0,XR,0);var eF=e=>{let t=XR,n=0,r={value:!1};for(let[o,s]of e){let a=Z(o);r.value=!1,t=t.set(NaN,0,a,o,s,r),r.value&&n++}return new fl(!1,0,t,n)};var tF=p(2,(e,t)=>e._root.get(0,Z(t),t));var Cb=p(2,(e,t)=>e._root.has(0,Z(t),t));var WH=(e,t,n,r)=>{let o=e,s={value:!1},a=o._editable?o._edit:NaN,i=o._root.set(a,0,n,t,r,s);return o._editable?(o._root=i,s.value&&o._size++,e):o._root===i?e:new fl(!1,o._edit,i,o._size+(s.value?1:0))},Tb=p(3,(e,t,n)=>WH(e,t,Z(t),n)),kb=e=>{let t=e[Symbol.iterator]();return{[Symbol.iterator](){return this},next(){let n=t.next();return n.done?{done:!0,value:void 0}:{done:!1,value:n.value[0]}}}};var nF=e=>{let t=e[Symbol.iterator]();return{[Symbol.iterator](){return this},next(){return t.next()}}},Vm=e=>e.size;var oF=Ib;var Jm=eF;var KH=nF,Zm=e=>Array.from(KH(e)),sF=Vm;var ll="~effect/collections/HashSet",VH={[me](){return Z(ll)},[he](e){return Ob(e)&&Ym(this)===Ym(e)&&uF(this,t=>cF(e,t))},[Symbol.iterator](){return kb(Ab(this))},toString(){return`HashSet(${D(Array.from(this))})`},toJSON(){return{_id:"HashSet",values:Ct(Array.from(this))}},[dt](){return this.toJSON()},pipe(){return ne(this,arguments)}},JH=e=>{let t=Object.create(VH);return t[ll]=ll,t.keyMap=e,t},Ob=e=>_(e,ll),Ab=e=>e.keyMap;var iF=e=>{let t=vb();for(let n of e)t=Tb(t,n,!0);return JH(t)},cF=(e,t)=>Cb(Ab(e),t);var Ym=e=>Vm(Ab(e));var uF=(e,t)=>{for(let n of e)if(!t(n))return!1;return!0};var Qm=iF,fF=Ob;var lF=Ym;function Xm(e){let t=vF(th,Ut(e.ast));return(n,r)=>t(n,r?.disableChecks?r?.parseOptions?{...r.parseOptions,disableChecks:!0}:{disableChecks:!0}:r?.parseOptions)}function eh(e){let t=Xm(e);return(n,r)=>{let o=Rs(t(n,r));return ht(o)?R(o.value):(Ho(o.cause,"Option adapter can only return none for schema issues"),O())}}function mF(e){let t=Xm(e);return(n,r)=>{let o=Rs(t(n,r));if(ht(o))return o.value;let s=Ho(o.cause,"Constructor adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}function hF(e){return pl(e.ast)}function pl(e){let t=Qa(ml(Ut(e)));return n=>{let r=t(n,Wa);return ht(r)?!0:(Ho(r.cause,"Type guard adapter can only return false for schema issues"),!1)}}function gF(e){let t=ml(e);return(n,r)=>{let o=Rs(t(n,r));if(!ht(o))return Ho(o.cause,"Issue adapter can only return schema issues")}}function xF(e,t){let r=Qa(ml(Ut(e.ast)))(t,Wa);if(Ju(r)){let o=Ho(r.cause,"Assertion adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:o})}}function ft(e,t){let n=ml(e.ast);return t===void 0?n:(r,o)=>n(r,dl(t,o))}var _b=ft;function yF(e,t){return Qa(ft(e,t))}function Pb(e,t){return CF(ft(e,t))}var SF=Pb;function EF(e,t){return TF(ft(e,t))}function YH(e,t){return kF(ft(e,t))}var Rb=YH;function Pc(e,t){let n=ml(_r(e.ast));return t===void 0?n:(r,o)=>n(r,dl(t,o))}function bF(e,t){return Qa(Pc(e,t))}function Fb(e,t){return CF(Pc(e,t))}var wF=Fb;function IF(e,t){return TF(Pc(e,t))}function QH(e,t){return kF(Pc(e,t))}var Mb=QH,dl=(e,t)=>t?{...e,...t}:e,pF=e=>e===Se?k(new fe):b(e);function ml(e){return vF(OF,e)}function vF(e,t){let n;return(r,o)=>{let s=(n??=e(t))(r,o??Wa);return s===xt?b(r):De(s)?s[Q]===Se?pF(Se):s:$t(s,pF)}}function Qa(e){return(t,n)=>Rs(e(t,n))}function CF(e){let t=Qa(e);return(n,r)=>{let o=t(n,r);return ht(o)?R(o.value):(Ho(o.cause,"Option adapter can only return none for schema issues"),O())}}function TF(e){let t=Qa(e);return(n,r)=>{let o=t(n,r);return ht(o)?se(o.value):ce(Ho(o.cause,"Result adapter can only return schema issues"))}}function kF(e){let t=Qa(e);return(n,r)=>{let o=t(n,r);if(ht(o))return o.value;let s=Ho(o.cause,"Sync adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}var OF=Rt(e=>Nb(e,OF)),th=Rt(e=>Nb(e,th,AF)),XH=Rt(e=>Nb(e,th,AF,e.context?.constructorDefault));function AF(e){return e.context?.constructorDefault?XH(e):th(e)}function _F(e,t,n,r){let o;if(De(e)&&e._tag==="Success"){let s=Xp(e===xt?t:e[Q]);o=n._tag==="Transformation"?n.decode.run(s,r):n.decode(ir(s),r)}else n._tag==="Transformation"?o=$t(e,s=>n.decode.run(Xp(s),r)):o=n.decode($o(e,Xp),r);return De(o)&&o._tag==="Success"?$S(o[Q]):$t(o,$S)}function eG(e,t){let n;return(r,o)=>{if(r===Se)return Or;if(e.isConstructed(r))return xt;let s=(n??=t(e.link.to))(r,o);return _F(s,r,e.link.transformation,o)}}function Nb(e,t,n,r){let o=n?uR(e):void 0,s=o?eG(o,t):e.getParser(t,n),a=e.checks,i=r?e.encoding?[...e.encoding,r]:[r]:e.encoding,c=e.encodingChecks,u=(a?a[a.length-1].annotations:e.annotations)?.parseOptions;if(!i&&!a&&!c)return u?(d,m)=>s(d,dl(m,u)):s;let f,l=(d,m)=>{let g=s(d,m);if(c&&!m.disableChecks)if(De(g)){if(g._tag==="Success"){let S=g===xt?d:g[Q];if(d!==Se&&S!==Se){let v=Fr(c,d,void 0,e,m);v&&(g=k(new nt(e,v,d,m)))}}}else g=J(g,S=>{if(d!==Se&&S!==Se){let v=Fr(c,d,void 0,e,m);if(v)return k(new nt(e,v,d,m))}return b(S)});if(a&&!m.disableChecks)if(De(g)){if(g._tag==="Success"){let S=g===xt?d:g[Q];if(S===Se)return g;let v=Fr(a,S,void 0,e,m);v&&(g=k(new nt(e,v,S,m)))}}else g=J(g,S=>{if(S!==Se){let v=Fr(a,S,void 0,e,m);if(v)return k(new nt(e,v,S,m))}return b(S)});return g};return i?(d,m)=>{u&&(m=dl(m,u));let g=f??=i.map(I=>t(I.to)),S=d,v=g[g.length-1](d,m);for(let I=i.length-1;I>=0;I--)if(v=_F(v,S,i[I].transformation,m),I!==0){let C=g[I-1];v._tag==="Success"?(S=v[Q],v=C(S,m)):v=$t(v,y=>{let x=C(y,m);return x===xt?ir(y):x})}if(v._tag==="Success"){let I=v[Q],C=l(I,m);return C===xt?v:C}return v=Bn(v,I=>Os(()=>Ts(I,C=>new nm(e,C,d,m)))),$t(v,I=>{let C=l(I,m);return C===xt?ir(I):C})}:u?(d,m)=>l(d,dl(m,u)):l}var rh="~effect/Schema/Schema";function fn(e,t,n){return{id:e,payloadSchema:t,revive:n}}function ae(e,t,n){return{id:e,payloadSchema:t,revive:n}}var tG={[rh]:rh,pipe(){return ne(this,arguments)},annotate(e){return this.rebuild(ur(this.ast,e))},annotateKey(e){return this.rebuild(tl(this.ast,e))},check(...e){return this.rebuild(ao(this.ast,e))}};function hl(e,t){function n(){}let r=Object.defineProperties(Object.setPrototypeOf(n,tG),Object.getOwnPropertyDescriptors({...t}));return r.ast=e,r.rebuild=o=>hl(o,t),r.makeEffect=Xm(r),r.make=mF(r),r.makeOption=eh(r),r}var rre=globalThis.Boolean;var PF=Eo((e,t)=>e||t,!1);var FF=p(2,(e,t)=>$b(e,(n,r)=>t.includes(n)?[n,r]:void 0)),MF=p(2,(e,t)=>$b(e,(n,r)=>t.includes(n)?void 0:[n,r])),NF=p(2,(e,t)=>({...e,...t}));var Db=p(2,(e,t)=>$b(e,(n,r)=>[Object.hasOwn(t,n)?t[n]:n,r]));var Gt=e=>e;function $b(e,t){let n={};for(let r of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;let o=t(r,e[r]);if(o){let[s,a]=o;M(n,s,a)}}return n}function DF(e,t){let n=t?.omitKeyWhen??(()=>!1);return vv((r,o)=>{let s=Reflect.ownKeys(e),a={};for(let i of s){let c=e[i].combine(r[i],o[i]);n(c)||M(a,i,c)}return a})}function gl(e){return Eo((t,n)=>t===void 0?n:n===void 0?t:e.combine(t,n),void 0)}function co(e,t){return t.length>0&&(e+=`
|
|
34
|
-
at ${pd(t)}`),new Error(e)}var UF=new WeakMap,LF=new WeakMap,jF=[];function Jo(e){return new Error(`Unable to derive an arbitrary for ${e}`)}var BF=([e],[t])=>K(e,t);function rG(e,t,n){return t.reduce((r,o)=>r.filter(s=>o.run(s,e,Wa)===void 0),n)}function YF(e,t){if(e?.minLength!==void 0&&e.maxLength!==void 0&&e.minLength>e.maxLength)throw Jo(`${t} constraints`)}function QF(e){return e===void 0||e.minLength===void 0&&e.maxLength===void 0?void 0:{...e.minLength!==void 0?{minLength:e.minLength}:{},...e.maxLength!==void 0?{maxLength:e.maxLength}:{}}}function Ub(e,t,n,r){return r?e.uniqueArray(t,{...n,comparator:r}):e.array(t,n)}function qF(e,t,n,r=!1){let o=t.constraint,s=QF(o);return YF(s,"array"),Ub(e,n,r?{...s,maxLength:s?.minLength??0}:s,o?.unique?K:void 0)}function sh(e,t,n,r){return t.chain(o=>o.length<n?e.constant(o):r.map(s=>[...o,...s]))}function zF(e,t){return e.chain(n=>t.map(r=>({...Object.fromEntries(r),...n})))}var oG=gl(aO),sG=gl(iO),ah=gl(PF),aG=gl(c0()),iG=DF({integer:ah,maxLength:sG,minLength:oG,noInfinity:ah,noNaN:ah,patterns:aG,unique:ah},{omitKeyWhen:cs});function WF(e,t,n,r,o,s){if(r===void 0||t===void 0)return r===void 0?[t,n]:[r,o];let a=e(t,r);return a===s?[r,o]:a===0?[t,n||o]:[t,n]}function cG(e,t){if(e===void 0)return t;if(e.order!==t.order)throw new Error("Cannot merge ordered arbitrary constraints with different Order instances");let[n,r]=WF(e.order,e.minimum,e.exclusiveMinimum,t.minimum,t.exclusiveMinimum,-1),[o,s]=WF(e.order,e.maximum,e.exclusiveMaximum,t.maximum,t.exclusiveMaximum,1);return{order:e.order,...n!==void 0?{minimum:n}:{},...r!==void 0?{exclusiveMinimum:r}:{},...o!==void 0?{maximum:o}:{},...s!==void 0?{exclusiveMaximum:s}:{}}}function uG(e,t){let{ordered:n,...r}=e??{},{ordered:o,...s}=t,a=o===void 0?n:cG(n,o);return{...iG.combine(r,s),...a===void 0?{}:{ordered:a}}}function HF(e){let t=[],n=[];function r(o){if(o.annotations?.arbitrary&&n.push(o.annotations.arbitrary),o._tag!=="Filter")for(let s of o.checks)r(s);else t.push(o)}return e?.forEach(r),{filters:t,arbitraries:n}}function fG(e){let t=e.map(({constraint:n})=>n).filter(_e);return n=>{let r=t.reduce((o,s)=>uG(o,s),n.constraint);return{...n,constraint:r}}}function xl(e){return{...e,constraint:void 0}}function GF(e,t,n){if(t===void 0||t.minLength===void 0&&t.maxLength===void 0)return;if(t.minLength!==void 0&&e.indexSignatures.length===0&&t.minLength>e.propertySignatures.length)throw Jo("object property constraints");let r={};if(t.minLength!==void 0&&(r.minLength=Math.max(0,t.minLength-n)),t.maxLength!==void 0&&(r.maxLength=t.maxLength-n,r.maxLength<0))throw Jo("object property constraints");return YF(r,"object property"),r}function lG(e,t,n,r,o,s){let a=r.length;if(s.maxLength!==void 0&&s.maxLength<a)throw Jo("object property constraints");let i=s.minLength===void 0?0:Math.max(0,s.minLength-a),c=s.maxLength===void 0?o.length:Math.min(o.length,s.maxLength-a);if(i>c)throw Jo("object property constraints");let u=e.record(t,{requiredKeys:[...r,...o]}),f=e.shuffledSubarray([...o],{minLength:i,maxLength:c});return e.tuple(u,f).map(([l,d])=>{let m=new Set([...r,...d]),g={};for(let S of n)m.has(S)&&M(g,S,l[S]);return g})}function XF(e,t,n,r){let o={};if(e?.minimum!==void 0&&(o.min=t(e.minimum,e.exclusiveMinimum===!0)),e?.maximum!==void 0&&(o.max=n(e.maximum,e.exclusiveMaximum===!0)),o.min!==void 0&&o.max!==void 0&&o.min>o.max)throw Jo(r);return o}function dG(e){return XF(e,(t,n)=>n?Math.floor(t)+1:Math.ceil(t),(t,n)=>n?Math.ceil(t)-1:Math.floor(t),"integer constraints")}function pG(e,t){let n={...e?.noInfinity?{noDefaultInfinity:!0}:{},...e?.noNaN?{noNaN:!0}:{},...t?.minimum!==void 0?{min:t.minimum}:{},...t?.exclusiveMinimum!==void 0?{minExcluded:t.exclusiveMinimum}:{},...t?.maximum!==void 0?{max:t.maximum}:{},...t?.exclusiveMaximum!==void 0?{maxExcluded:t.exclusiveMaximum}:{}};if(n.min!==void 0&&n.max!==void 0&&(n.min>n.max||n.min===n.max&&(n.minExcluded||n.maxExcluded)))throw Jo("number constraints");return n}function mG(e){return XF(e,(t,n)=>n?t+BigInt(1):t,(t,n)=>n?t-BigInt(1):t,"the ordered bigint constraints")}function Rc(e,t){let n=(r,o,s=jF)=>e(r,o,s);return n.terminal=(r,o,s=jF)=>t(r,o,s),n}function fr(e){return Rc(e,e)}function KF(e,t){let n=LF.get(t)??e.createDepthIdentifier();return LF.set(t,n),{maxDepth:2,depthIdentifier:n}}function VF(e,t){return t.length===0?void 0:t.length===1?t[0]:e.oneof(...t)}var hG={noInfinity:!0,noNaN:!0};function gG(e){return{...e,constraint:hG}}function xG(e,t,n,r){let o=r===void 0?[]:[{arbitrary:r,weight:1}];for(let{candidate:s}of n){if(!s)continue;let a=s.make(e,t);if(a===void 0)continue;let i=s.weight??1;if(!globalThis.Number.isInteger(i)||i<=0)throw Jo("a candidate with an invalid weight");o.push({arbitrary:a,weight:i})}return o.length===0?void 0:o.length===1?o[0].arbitrary:e.oneof(...o)}function JF(e,t,n,r,o){let s=xG(n,r,t.arbitraries,o);return s===void 0?void 0:rG(e,t.filters,s)}function yG(e,t){if(!(typeof e=="object"&&e!==null&&"arbitrary"in e))return{arbitrary:e,terminal:t?void 0:e};let n="terminal"in e?e.terminal:t?void 0:e.arbitrary;return{arbitrary:e.arbitrary,terminal:n}}function SG(e,t,n,r,o){return e.map(s=>({arbitrary:o?t.constant(null).chain(()=>s(t,n,r)):s(t,n,r),terminal:s.terminal(t,n,r)}))}function ZF(e,t,n,r){let o=fG(t.arbitraries);return Rc((s,a,i)=>{let c=o(a);return JF(e,t,s,c,n(s,a,c,i))},(s,a,i)=>{let c=o(a);return JF(e,t,s,c,r(s,a,c,i))})}var eM=Rt(e=>lr(e,[]));function lr(e,t){let n=ro(e)?.toArbitrary;if(n){let r=qs(e)?e.typeParameters.map(a=>lr(a,t)):[],o=HF(e.checks),s=a=>(i,c,u,f)=>yG(n(SG(r,i,xl(c),f,a))(i,u),r.length>0)[a?"terminal":"arbitrary"];return ZF(e,o,s(!1),s(!0))}if(e.checks){let r=HF(e.checks),o=lr(Rm(e,void 0),t);return ZF(e,r,(s,a,i,c)=>o(s,i,c),(s,a,i,c)=>o.terminal(s,i,c))}return EG(e,t)}function EG(e,t){switch(e._tag){case"Never":case"Declaration":throw co(`Unsupported AST ${e._tag}`,t);case"Null":return fr(n=>n.constant(null));case"Void":case"Undefined":return fr(n=>n.constant(void 0));case"Unknown":case"Any":return fr(n=>n.anything());case"String":return fr((n,r)=>{let o=r.constraint,s=o?.patterns;return s?n.oneof(...s.map(a=>n.stringMatching(new RegExp(a)))):n.string(QF(o))});case"Number":return fr((n,r)=>{let o=r.constraint,s=o?.ordered?.order===Pn?o.ordered:void 0;return o?.integer?n.integer(dG(s)):n.float(pG(o,s))});case"Boolean":return fr(n=>n.boolean());case"BigInt":return fr((n,r)=>{let o=r.constraint?.ordered?.order===Zn?r.constraint.ordered:void 0;return n.bigInt(mG(o))});case"Symbol":return fr(n=>n.string().map(Symbol.for));case"Literal":return fr(n=>n.constant(e.literal));case"UniqueSymbol":return fr(n=>n.constant(e.symbol));case"ObjectKeyword":return fr(n=>n.oneof(n.object(),n.array(n.anything())));case"Enum":return lr(rR(e),t);case"TemplateLiteral":{let n=e.parts.map((r,o)=>lr(In(r),[...t,o]));return fr((r,o,s)=>r.tuple(...n.map(a=>a(r,gG(o),s))).map(a=>a.map(i=>globalThis.String(i)).join("")))}case"Arrays":{let n=e.elements.map((a,i)=>({ast:a,arbitrary:lr(a,[...t,i])})),r=e.elements.length,o=e.rest.map((a,i)=>({ast:a,arbitrary:lr(a,[...t,r+i])})),s=(a,i,c)=>{let u=xl(i),f=[],l=[],d=0;for(let C of n){let y=C.arbitrary.terminal(a,u,c);if(ut(C.ast)){l.push(y);continue}if(y===void 0)return;d++,f.push(y.map(R))}let m=i.constraint?.minLength??0,S=gn(o)&&m>d+l.length?l.length:Math.max(0,m-d),v=0;for(let C of l){if(v>=S||C===void 0){f.push(a.constant(O()));continue}v++,d++,f.push(C.map(R))}if(v<S)return;let I=a.tuple(...f).map(zg);if(gn(o)){let[C,...y]=o,x=e.elements.length===0?i:u,h=Math.max(0,m-d-y.length),E=h===0?void 0:C.arbitrary.terminal(a,u,c);if(h>0&&E===void 0)return;let w=h===0?a.constant([]):qF(a,{...x,constraint:{...x.constraint,minLength:h}},E,!0);if(I=sh(a,I,r,w),y.length>0){let T=[];for(let $ of y){let P=$.arbitrary.terminal(a,u,c);if(P===void 0)return;T.push(P)}let A=a.tuple(...T);I=sh(a,I,r,A)}}return I};return Rc((a,i,c)=>{let u=xl(i),f=n.map(({ast:d,arbitrary:m})=>{let g=m(a,u,c);return ut(d)?g.chain(S=>a.boolean().map(v=>v?R(S):O())):g.map(R)}),l=a.tuple(...f).map(d=>zg(i0(d,we)));if(gn(o)){let[d,...m]=o.map(({arbitrary:S})=>S(a,u,c)),g=qF(a,e.elements.length===0?i:u,d);if(l=sh(a,l,r,g),m.length>0){let S=a.tuple(...m);l=sh(a,l,r,S)}}if(i.recursion){let d=s(a,i,c);if(d!==void 0)return a.oneof(i.recursion,d,l)}return l},s)}case"Objects":{let n=e.propertySignatures.map(s=>({ps:s,arbitrary:lr(s.type,[...t,s.name])})),r=e.indexSignatures.map(s=>({is:s,parameter:lr(s.parameter,t),type:lr(s.type,t)}));return Rc((s,a,i)=>{let c=xl(a),u={},f=[],l=[],d=[];for(let{ps:v,arbitrary:I}of n){let C=v.name;f.push(C),ut(v.type)?d.push(C):l.push(C),M(u,C,I(s,c,i))}let m=a.constraint;if(d.length>0&&r.length===0&&m!==void 0&&(m.minLength!==void 0||m.maxLength!==void 0))return lG(s,u,f,l,d,m);let g=s.record(u,{requiredKeys:l}),S=GF(e,a.constraint,l.length);for(let{parameter:v,type:I}of r){let C=s.tuple(v(s,c,i),I(s,c,i)),y=Ub(s,C,S,BF);g=zF(g,y)}return g},(s,a,i)=>{let c=xl(a),u={},f=[],l=[];for(let{ps:v,arbitrary:I}of n){let C=v.name,y=I.terminal(s,c,i);if(ut(v.type)){y!==void 0&&l.push([C,y]);continue}if(y===void 0)return;f.push(C),M(u,C,y)}let d=Math.max(0,(a.constraint?.minLength??0)-f.length);for(let[v,I]of l){if(d===0)break;d--,f.push(v),M(u,v,I)}if(d>0&&e.indexSignatures.length===0)return;let m=s.record(u,{requiredKeys:f}),g=GF(e,a.constraint,f.length),S=g?.minLength??0;for(let{parameter:v,type:I}of r){let C;if(S===0)C=s.constant([]);else{let y=v.terminal(s,c,i),x=I.terminal(s,c,i);if(y===void 0||x===void 0)return;C=Ub(s,s.tuple(y,x),{...g,maxLength:S},BF)}m=zF(m,C)}return m})}case"Union":{let n=e.types.map(o=>lr(o,t)),r=(o,s,a)=>VF(o,n.map(i=>i.terminal(o,s,a)).filter(_e));return Rc((o,s,a)=>{let i=n.map(u=>u(o,s,a));if(s.recursion){let u=r(o,s,a);if(u!==void 0)return o.oneof(s.recursion,u,...i)}let c=VF(o,i);if(c===void 0)throw Jo("a union with no members");return c},r)}case"Suspend":{let n=UF.get(e);if(n)return n;let r=Ha(()=>lr(e.thunk(),t)),o=Rc((s,a,i)=>{let c=KF(s,e),u={...a,recursion:c},f=i.includes(e)?i:[...i,e],l=r().terminal(s,u,f);if(l===void 0)throw co("Unable to derive an arbitrary for a recursive schema without a finite generation path",t);return s.oneof(c,l,s.constant(null).chain(()=>r()(s,u,f)))},(s,a,i)=>{if(i.includes(e))return;let c=KF(s,e);return r().terminal(s,{...a,recursion:c},[...i,e])});return UF.set(e,o),o}}}var tM=Rt(e=>Hs(e,[]));function Hs(e,t){let n=ro(e)?.toEquivalence;if(n)return n(qs(e)?e.typeParameters.map(r=>Hs(r,t)):[]);switch(e._tag){case"Never":return Tv();case"Declaration":case"Null":case"Undefined":case"Void":case"Unknown":case"Any":case"String":case"Number":case"Boolean":case"BigInt":case"Symbol":case"Literal":case"UniqueSymbol":case"ObjectKeyword":case"Enum":case"TemplateLiteral":return K;case"Arrays":{let r=e.elements.map((a,i)=>Hs(a,[...t,i])),o=e.elements.length,s=e.rest.map((a,i)=>Hs(a,[...t,o+i]));return Tt((a,i)=>{if(!Array.isArray(a)||!Array.isArray(i))return!1;let c=a.length;if(c!==i.length)return!1;let u=0;for(;u<Math.min(c,e.elements.length);u++)if(!r[u](a[u],i[u]))return!1;if(s.length>0){let[f,...l]=s;for(;u<c-l.length;u++)if(!f(a[u],i[u]))return!1;for(let d=0;d<l.length;d++)if(!l[d](a[u+d],i[u+d]))return!1}return!0})}case"Objects":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return K;let r=e.propertySignatures.map(s=>Hs(s.type,[...t,s.name])),o=e.indexSignatures.map(s=>Hs(s.type,t));return Tt((s,a)=>{if(!jt(s)||!jt(a))return!1;for(let i=0;i<r.length;i++){let c=e.propertySignatures[i],u=c.name,f=Object.hasOwn(s,u),l=Object.hasOwn(a,u);if(ut(c.type)&&f!==l||f&&l&&!r[i](s[u],a[u]))return!1}for(let i=0;i<o.length;i++){let c=e.indexSignatures[i],u=qa(s,c.parameter),f=qa(a,c.parameter);if(u.length!==f.length)return!1;for(let l=0;l<u.length;l++){let d=u[l];if(!Object.hasOwn(a,d)||!o[i](s[d],a[d]))return!1}}return!0})}case"Union":{let r=Ut(e).types,o=new Map(r.map((s,a)=>[s,[pl(s),Hs(e.types[a],t)]]));return Tt((s,a)=>{let i=Zf(s,r);for(let c=0;c<i.length;c++){let[u,f]=o.get(i[c]);if(u(s)&&u(a))return f(s,a)}return!1})}case"Suspend":{let r=Ha(()=>Hs(e.thunk(),t));return Tt((o,s)=>r()(o,s))}}}function Xa(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Fc(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}var vG="http://json-schema.org/draft-07/schema#",nM="https://json-schema.org/draft/2020-12/schema";function rM(e,t){return e===t||e===(t.endsWith("#")?t.slice(0,-1):`${t}#`)}function aM(e){return{dialect:"draft-07",...PG(e,BG)}}function CG(e,t){return n(e,!1,!0);function n(r,o,s=!1){if(!jt(r))return r;let a=o||!s&&uM(r.$id),i={};for(let c of Object.keys(r)){let u=r[c],f=u;switch(c){case"$defs":case"properties":case"patternProperties":case"dependentSchemas":f=jb(u,l=>n(l,a))??u;break;case"allOf":case"anyOf":case"oneOf":case"prefixItems":f=Array.isArray(u)?u.map(l=>n(l,a)):u;break;case"not":case"additionalProperties":case"propertyNames":case"unevaluatedProperties":case"items":case"contains":case"unevaluatedItems":case"if":case"then":case"else":case"contentSchema":f=n(u,a)}M(i,c,f)}return t(i,a),i}}function iM(e,t){return CG(e,n=>{TG(n,t)})}function TG(e,t){typeof e.$ref=="string"&&M(e,"$ref",t(e.$ref,"$ref")),typeof e.$dynamicRef=="string"&&M(e,"$dynamicRef",t(e.$dynamicRef,"$dynamicRef"))}function jb(e,t){if(!jt(e))return;let n={};for(let r of Object.keys(e))M(n,r,t(e[r],r));return n}function kG(e,t,n){let r=new Map,o=[],s=Lb;function a(d,m=[],g=[]){if(m.length===0&&t?.trackIds){let S=jt(d)?f(d):void 0;s=oM(S,Lb)??Lb}return u(d,m,g,{sourceRoot:[],targetRoot:[],uri:s})}function i(){for(let[d,m,g]of o){let S=m,v=cM(m,g);if(v!==void 0){let I=OG(v.hash);if(v.hash="",I!==void 0){let C=r.get(sM(v.href,I));C!==void 0&&(S=AG(m,C))}}M(d,"$ref",S)}}let c=n(a);return i(),c;function u(d,m,g,S){if(typeof d=="boolean")return l(m,g,S),t?.booleanAdapter?.(d)??d;if(!jt(d))return d;let v=S,I=f(d);if(m.length>0&&t?.trackIds&&uM(I)){let x=oM(I,S.uri);x!==void 0&&(v={parent:S,sourceRoot:m,targetRoot:g,uri:x})}l(m,g,v);let C=v.uri,y={isDocumentRoot:m.length===0,schema(x,h,E=h){return u(x,[...m,h],[...g,E],v)},schemaAt(x,h,E){return u(x,[...m,...h],[...g,...E],v)},schemaArray(x,h,E=h){return Array.isArray(x)?x.map((w,T)=>u(w,[...m,h,String(T)],[...g,E,String(T)],v)):x},schemaMap(x,h,E=h){return jt(x)?jb(x,(w,T)=>u(w,[...m,h,T],[...g,E,T],v)):x},reference(x,h){typeof h=="string"?o.push([x,h,C]):M(x,"$ref",h)}};return e(d,y)}function f(d){return t?.ignoreRefSiblings===!0&&typeof d.$ref=="string"?void 0:d.$id}function l(d,m,g){g.parent!==void 0&&l(d,m,g.parent),r.set(sM(g.uri,d.slice(g.sourceRoot.length)),m.slice(g.targetRoot.length))}}var Lb="https://effect.invalid/.json-schema/";function cM(e,t){return URL.canParse(e,t)?new URL(e,t):void 0}function oM(e,t){if(typeof e!="string")return;let n=cM(e,t);if(n!==void 0)return n.hash="",n.href}function OG(e){if(e.length===0)return[];let t;try{t=decodeURIComponent(e.slice(1))}catch{return}if(t.startsWith("/"))return/~(?:[^01]|$)/.test(t)?void 0:t.slice(1).split("/").map(Fc)}function AG(e,t){let n=e.indexOf("#");return n===-1&&t.length===0?e:`${n===-1?e:e.slice(0,n)}${_G(t)}`}function _G(e){return e.length===0?"#":`#/${e.map(t=>encodeURI(Xa(t)).replace(/#/g,"%23")).join("/")}`}function sM(e,t){return`${e}\0${JSON.stringify(t)}`}function uM(e){return typeof e=="string"&&e.length>0&&e[0]!=="#"}function PG(e,t,n){return kG(t,{...n,trackIds:!0},r=>({schema:r(e.schema),definitions:jb(e.definitions,(o,s)=>r(o,["$defs",s],["definitions",s]))}))}var RG=new Set(["properties","patternProperties"]),FG=new Set(["allOf","anyOf","oneOf"]),MG=new Set(["not","additionalProperties","propertyNames","contains","if","then","else","contentSchema"]);function NG(e,t,n,r,o,s=RG){let a;if(s.has(t))a=r.schemaMap(n,t);else if(FG.has(t))a=r.schemaArray(n,t);else if(o.has(t))a=r.schema(n,t);else return!1;return M(e,t,a),!0}var fM=["$anchor","$defs","$dynamicAnchor","$dynamicRef","$vocabulary","contentSchema","dependentRequired","dependentSchemas","maxContains","minContains","prefixItems","unevaluatedItems","unevaluatedProperties"],lre=[...fM,"deprecated"],dre=[...fM,"$comment","$id","$schema","const","contains","contentEncoding","contentMediaType","else","examples","if","patternProperties","propertyNames","then"],DG=/^[A-Za-z_][-A-Za-z0-9._]*$/,$G=/^[A-Za-z][-A-Za-z0-9._:]*$/;function ei(e,t,n){throw new Error(`Cannot convert JSON Schema keyword "${e}" to ${t}: ${n}`)}function UG(e,t,n,r){for(let o of t)Object.hasOwn(e,o)&&ei(o,n,`it is not active in ${r} but would become active in the target`)}var LG=["additionalItems","definitions","dependencies"];function jG(e,t,n,r,o){n.isDocumentRoot?M(e,"$schema",rM(t,nM)?r:t):rM(t,nM)||ei("$schema",o,"an embedded resource cannot declare a different dialect")}function BG(e,t){UG(e,LG,"Draft-07","Draft 2020-12");let n={},r,o,s;for(let a of Object.keys(e)){let i=e[a];if(!NG(n,a,i,t,MG))switch(a){case"$ref":r=i;break;case"$schema":jG(n,i,t,vG,"Draft-07");break;case"$id":case"$anchor":break;case"$defs":M(n,"definitions",t.schemaMap(i,a,"definitions"));break;case"prefixItems":o=i;break;case"items":s=i;break;case"dependentRequired":case"dependentSchemas":case"minContains":case"maxContains":break;case"$dynamicRef":case"$dynamicAnchor":case"$vocabulary":case"unevaluatedProperties":case"unevaluatedItems":ei(a,"Draft-07","the target dialect has no equivalent");case"required":if(Array.isArray(i)&&i.length===0)break;M(n,a,i);break;default:M(n,a,i)}}if(qG(n,o,s,t),Object.hasOwn(e,"contains")){let a=e.minContains,i=e.maxContains;(a!==void 0&&a!==1||i!==void 0)&&ei("minContains/maxContains","Draft-07","contains cardinality cannot be represented"),Object.hasOwn(e,"minContains")&&M(n,"minContains",a)}else Object.hasOwn(e,"minContains")&&M(n,"minContains",e.minContains),Object.hasOwn(e,"maxContains")&&M(n,"maxContains",e.maxContains);return WG(e,n,t,"draft-07"),GG(e,n,"$id","Draft-07"),zG(n,r,t),n}function qG(e,t,n,r){if(t===void 0){n!==void 0&&M(e,"items",r.schema(n,"items"));return}M(e,"items",r.schemaArray(t,"prefixItems","items")),n!==void 0&&M(e,"additionalItems",r.schema(n,"items","additionalItems"))}function zG(e,t,n){if(t!==void 0)if(typeof t=="string"&&Object.keys(e).length>0){let r={};n.reference(r,t),HG(e,r)}else n.reference(e,t)}function WG(e,t,n,r){let o=jt(e.dependentRequired)?e.dependentRequired:void 0,s=jt(e.dependentSchemas)?e.dependentSchemas:void 0;if(o===void 0&&s===void 0)return;let a={},i=new Set([...Object.keys(o??{}),...Object.keys(s??{})]);for(let c of i){let u=o?.[c],f=s?.[c],l=r==="draft-04"&&Array.isArray(u)&&u.length===0;f===void 0?l||M(a,c,u):u===void 0||l?M(a,c,n.schemaAt(f,["dependentSchemas",c],["dependencies",c])):M(a,c,{allOf:[n.schemaAt(f,["dependentSchemas",c],["dependencies",c,"allOf","0"]),{required:u}]})}Object.keys(a).length>0&&M(t,"dependencies",a)}function HG(e,t){Array.isArray(e.allOf)?e.allOf.push(t):M(e,"allOf",[t])}function GG(e,t,n,r){let o=e.$id,s=e.$anchor;if(s===void 0){o!==void 0&&M(t,n,o);return}(typeof s!="string"||!DG.test(s))&&ei("$anchor",r,"the anchor is not valid"),$G.test(s)||ei("$anchor",r,"the anchor cannot be represented as a plain-name fragment identifier"),o===void 0?M(t,n,`#${s}`):ei("$anchor",r,"it cannot be combined with the schema $id")}var pre=globalThis.RegExp;var Mc=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&");var KG=new Set([...i_,$a,...s_]);function yl(e,t){if(e===void 0)return;let n={},r=e.title;typeof r=="string"&&(n.title=r);let o=e.description,s=e.expected;typeof o=="string"?n.description=o:t?.generateDescriptions===!0&&typeof s=="string"&&(n.description=s);let a=e.default;kc(a)&&(n.default=a);let i=e.examples;Array.isArray(i)&&kc(i)&&(n.examples=i);let c=e.readOnly;typeof c=="boolean"&&(n.readOnly=c);let u=e.writeOnly;typeof u=="boolean"&&(n.writeOnly=u);let f=e.format;typeof f=="string"&&(n.format=f);let l=e.contentEncoding;typeof l=="string"&&(n.contentEncoding=l);let d=e.contentMediaType;typeof d=="string"&&(n.contentMediaType=d);let m=e.contentSchema;if(kc(m)&&(n.contentSchema=m),t?.includeAnnotationKey!==void 0)for(let[g,S]of Object.entries(e))KG.has(g)||!t.includeAnnotationKey(g)||kc(S)&&M(n,g,S);return Object.keys(n).length===0?void 0:n}function pM(e){let t=e.type==="number"||e.type==="integer"?e.type:void 0,n=e;if(t!==void 0&&(n={...e},delete n.type),Array.isArray(n.allOf)){let r=[],o=!1;for(let s of n.allOf){let a=pM(s);a.type!==void 0&&(o=!0,(t===void 0||a.type==="integer")&&(t=a.type)),Object.keys(a.schema).length>0&&r.push(a.schema)}if(o){let{allOf:s,...a}=n;n=r.length===0?a:{...a,allOf:r}}}return{type:t,schema:n}}function VG(e){return Array.isArray(e.anyOf)&&e.anyOf.length===4&&e.anyOf[0]?.type==="number"&&e.anyOf.slice(1).every(t=>t.type==="string")}var mM="|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|";function qb(e,t){return Object.keys(e).every(n=>t.includes(`|${n}|`))}function dM(e,t){return typeof e.$ref!="string"&&t.every(n=>!Object.hasOwn(e,n))}var zb="|title|description|default|examples|readOnly|writeOnly|",JG=mM+zb;function Sl(e,t,n){if(Object.keys(e).length===0)return t;let r=Object.keys(t);if(r.length===0)return e;let o=e.type==="number"||e.type==="integer"?e.type:void 0,s=VG(e);if(o!==void 0||s){let i=pM(t);if(i.type!==void 0){let c=o==="integer"||i.type==="integer"?"integer":"number",u={...e,type:c};s&&delete u.anyOf;let f=Object.keys(i.schema);return f.length===0?u:qb(i.schema,zb)&&dM(u,f)?{...u,...i.schema}:Sl(u,i.schema,n)}}if(n&&dM(e,r))return{...e,...t};let a=Array.isArray(t.allOf)&&r.length===1?t.allOf:[t];return Array.isArray(e.allOf)?{...e,allOf:[...e.allOf,...a]}:typeof e.$ref=="string"?{allOf:[e,...a]}:{...e,allOf:a}}function ZG(e,t,n,r){let o=new Map,s=new WeakMap,a=new Map,i=!1,c=Object.keys(n);for(let y of c)l(y,["references",y]);let u=Et(e,(y,x)=>d(v(y,t[x]))),f={};for(let y of c){let x=o.get(y);typeof x!="string"&&M(f,y,d(x))}return{dialect:"draft-2020-12",schemas:u,definitions:f};function l(y,x){let h=o.get(y);if(h!==void 0)return typeof h=="string"?h:y;if(!Object.hasOwn(n,y))throw co(`Invalid reference ${y}`,[...x,"$ref"]);o.set(y,null);let E=n[y],w=v(E,["references",y]),T=m(E);if(T!==void 0){let A=a.get(T),$=A?.find(P=>K(o.get(P),w));if($===void 0)A===void 0?a.set(T,[y]):A.push(y);else return i=!0,o.set(y,$),$}return o.set(y,w),y}function d(y){return i?iM(y,x=>x.replace(/^#\/\$defs\/([^/]*)/,(h,E)=>{let w=o.get(Fc(E));return typeof w=="string"?`#/$defs/${Xa(w)}`:h})):y}function m(y){if(y._tag==="Reference")return;let x=y.checks.length===0?y.annotations:y.checks[y.checks.length-1].annotations;return typeof x?.identifier!="string"&&typeof x?.[$a]=="string"?x[$a]:void 0}function g(y,x){return y?.schemas?.map((h,E)=>v(h,[...x,"schemas",E]))??[]}function S(y,x,h){let E=y.annotations,w=E?.toJsonSchema;if(w!==void 0){let P=g(y.representation,[...h,"representation"]),L=w({type:x,schemas:P}),U=yl(E,r),oe=U===void 0?L:{...L,...U},yt=U===void 0?mM:JG;return y._tag==="Filter"&&qb(oe,yt)&&(U===void 0||qb(U,zb))?[oe,!0]:[oe]}if(y._tag==="Filter")return;let T=y.checks.map((P,L)=>S(P,x,[...h,"checks",L])).filter(P=>P!==void 0);if(T.length===0)return;let A=yl(E,r),$=T.map(([P])=>P);return[A===void 0?{allOf:$}:{allOf:$,...A}]}function v(y,x){if(y._tag==="Reference"){let T=l(y.$ref,x);return{$ref:`#/$defs/${Xa(T)}`}}let h=s.get(y);if(h!==void 0)return h;let E=I(y,x),w=yl(y.annotations,r);w!==void 0&&(E={...E,...w});for(let T=0;T<y.checks.length;T++){let A=typeof E.type=="string"&&YG(E.type)?E.type:void 0,$=S(y.checks[T],A,[...x,"checks",T]);$!==void 0&&(E=Sl(E,...$))}return s.set(y,E),E}function I(y,x){switch(y._tag){case"Any":case"Unknown":return{};case"ObjectKeyword":return{anyOf:[{type:"object"},{type:"array"}]};case"Void":case"Undefined":case"Null":return{type:"null"};case"BigInt":return{type:"string",allOf:[{pattern:"^-?\\d+$"}]};case"Symbol":case"UniqueSymbol":return{type:"string",allOf:[{pattern:"^Symbol\\((.*)\\)$"}]};case"Declaration":return{};case"Suspend":return v(y.thunk,[...x,"thunk"]);case"Never":return{not:{}};case"String":return{type:"string"};case"Number":return{anyOf:[{type:"number"},{type:"string",enum:["NaN"]},{type:"string",enum:["Infinity"]},{type:"string",enum:["-Infinity"]}]};case"Boolean":return{type:"boolean"};case"Literal":{let h=y.literal;return typeof h=="bigint"?{type:"string",enum:[globalThis.String(h)]}:{type:typeof h,enum:[h]}}case"Enum":{let h=y.enums.map(([E,w])=>typeof w=="number"&&!globalThis.Number.isFinite(w)?{type:"string",enum:[globalThis.String(w)],title:E}:{type:typeof w,enum:[w],title:E});return h.length===0?{not:{}}:{anyOf:h}}case"TemplateLiteral":return{type:"string",pattern:`^${y.parts.map(ih).join("")}$`};case"Arrays":{if(y.rest.length>1)throw co("Invalid schema representation document",[...x,"rest"]);let h={type:"array"},E=y.elements.length,w=y.elements.map((T,A)=>{T.isOptional&&E--;let $=v(T.type,[...x,"elements",A,"type"]),P=yl(T.annotations,r);return P===void 0?$:Sl($,P)});if(w.length>0?(h.prefixItems=w,h.maxItems=y.elements.length,E>0&&(h.minItems=E)):h.items=!1,y.rest.length===1){delete h.maxItems;let T=v(y.rest[0],[...x,"rest",0]);Object.keys(T).length>0?h.items=T:delete h.items}return h}case"Objects":{if(y.propertySignatures.length===0&&y.indexSignatures.length===0)return{anyOf:[{type:"object"},{type:"array"}]};let h={type:"object"},E={},w=[];for(let P=0;P<y.propertySignatures.length;P++){let L=y.propertySignatures[P];if(typeof L.name!="string")throw co("Invalid schema representation document",[...x,"propertySignatures",P,"name"]);let U=L.name,oe=v(L.type,[...x,"propertySignatures",P,"type"]),yt=yl(L.annotations,r);M(E,U,yt===void 0?oe:Sl(oe,yt)),L.isOptional||w.push(U)}y.propertySignatures.length>0&&(h.properties=E),w.length>0&&(h.required=w);let T={},A=[];for(let P=0;P<y.indexSignatures.length;P++){let L=y.indexSignatures[P],U=v(L.type,[...x,"indexSignatures",P,"type"]);Object.keys(U).length===1&&"not"in U&&(U=!1);let oe=C(L.parameter,[...x,"indexSignatures",P,"parameter"],new Set);if(oe.length===0)A.push(U);else for(let yt of oe){let Pt=T[yt];M(T,yt,Pt===void 0?U:Pt===!1||U===!1?!1:Sl(Pt,U))}}let $=Object.keys(T).length>0;return $&&(h.patternProperties=T),y.indexSignatures.length===0?h.additionalProperties=r?.additionalProperties??!1:A.length===1&&y.propertySignatures.length===0&&!$?h.additionalProperties=A[0]:A.length>0&&(h.allOf=A.map(P=>({type:"object",additionalProperties:P}))),typeof h.additionalProperties=="object"&&h.additionalProperties!==null&&Object.keys(h.additionalProperties).length===0&&delete h.additionalProperties,h}case"Union":{let h=y.types.map((E,w)=>v(E,[...x,"types",w]));if(h.length===0)return{not:{}};if(y.mode==="anyOf"&&h.length>1){let E=QG(h);if(E!==void 0)return E}return y.mode==="anyOf"?{anyOf:h}:{oneOf:h}}}}function C(y,x,h){switch(y._tag){case"Reference":{if(!Object.hasOwn(n,y.$ref))throw co(`Invalid reference ${y.$ref}`,[...x,"$ref"]);if(l(y.$ref,x),h.has(y.$ref))return[];let E=new Set(h).add(y.$ref);return C(n[y.$ref],["references",y.$ref],E)}case"String":return hM(v(y,x));case"TemplateLiteral":return[`^${y.parts.map(ih).join("")}$`];case"Union":return y.types.flatMap((E,w)=>C(E,[...x,"types",w],h));default:throw co("Invalid schema representation document",x)}}}function YG(e){return e==="string"||e==="number"||e==="boolean"||e==="array"||e==="object"||e==="null"||e==="integer"}function QG(e){let t,n=[];for(let r of e){if(Object.keys(r).length!==2||r.type===void 0||!Array.isArray(r.enum)||r.enum.length===0)return;if(t===void 0)t=r.type;else if(r.type!==t)return;n.push(...r.enum)}return{type:t,enum:n}}function hM(e){let t=[];typeof e.pattern=="string"&&t.push(e.pattern);for(let n of["allOf","anyOf","oneOf"]){let r=e[n];if(Array.isArray(r))for(let o of r)typeof o=="object"&&o!==null&&!Array.isArray(o)&&t.push(...hM(o))}return t}function ih(e){switch(e._tag){case"Literal":return Mc(globalThis.String(e.literal));case"String":return sR;case"Number":return Tm;case"TemplateLiteral":return e.parts.map(ih).join("");case"Union":return e.types.map(ih).join("|");default:throw co("Invalid schema representation document",[])}}function gM(e,t){let n=ZG([e.representation],[["representation"]],e.references,t);return{dialect:n.dialect,schema:n.schemas[0],definitions:n.definitions}}var e3=({identifier:e})=>e;function Nr(e){return e===void 0?void 0:{annotations:e}}function Wb(e,t){let{references:n,representations:r}=t3([e],t);return{representation:r[0],references:n}}function t3(e,t){let n={},r=new Map,o=new Set,s=new Map,a=new Set;for(let h of e)m(h);let i=t?.referencePolicy??e3;for(let h of s.values())for(let E of h.values()){let w=i({ast:E.ast,occurrences:E.occurrences,identifier:E.identifier});if(w!==void 0){let T=w===E.identifier||!w.endsWith("_")?"_":"";E.reference=u(w,E,T)}else E.isRecursive&&(E.reference=u(`${E.ast._tag}_`,E,""))}return{representations:Et(e,h=>S(h)),references:n};function u(h,E,w="_"){let T=h,A=0;for(;r.has(T);){if(r.get(T)===E)return T;T=`${h}${w}${++A}`}return r.set(T,E),T}function f(h,E,w){let T=E.fallback;return T!==void 0?NS(h)===T?h:ur(h,{[$a]:T}):w===E.identifier?h:ur(h,{identifier:w})}function l(h,E){if(!Object.hasOwn(n,h)&&!o.has(h)){o.add(h);let w=v(E);o.delete(h),M(n,h,w)}return{_tag:"Reference",$ref:h}}function d(h){let E=el(h),w=qE(E),T=mc(E),A=T===void 0?(E!==h?mc(h):void 0)??NS(E):void 0;A!==void 0&&(T=`${A}Encoded`);let $=s.get(w);$===void 0&&($=new Map,s.set(w,$));let P=$.get(T);return P===void 0&&(P={ast:w,identifier:T,fallback:A,occurrences:0,isRecursive:!1,reference:void 0},$.set(T,P)),P}function m(h){let E=d(h),w=E.ast;if(E.occurrences++,a.has(E)){E.isRecursive=!0;return}if(!(E.occurrences>1)){switch(a.add(E),g(w.checks),w._tag){case"Declaration":case"Arrays":case"Objects":case"Union":w.recur(T=>(m(T),T));break;case"TemplateLiteral":w.parts.forEach(m);break;case"Suspend":m(w.thunk());break}a.delete(E)}}function g(h){h?.forEach(E=>{E.annotations?.representation?.schemas?.forEach(w=>m(Ut(w))),E._tag==="FilterGroup"&&g(E.checks)})}function S(h){let E=d(h),w=E.ast,T=E.reference;if(T!==void 0){let A=E.identifier===void 0?w:f(w,E,T);return l(T,A)}return v(w)}function v(h){let E=I(h.checks);switch(h._tag){case"Declaration":return{_tag:"Declaration",typeParameters:h.typeParameters.map(w=>S(w)),checks:E,...y(h.annotations)};case"Null":case"Undefined":case"Void":case"Never":case"Unknown":case"Any":case"String":case"Boolean":case"Number":case"BigInt":case"Symbol":case"ObjectKeyword":return{_tag:h._tag,checks:E,...Nr(h.annotations)};case"Literal":return{_tag:"Literal",literal:h.literal,checks:E,...Nr(h.annotations)};case"UniqueSymbol":return{_tag:"UniqueSymbol",symbol:h.symbol,checks:E,...Nr(h.annotations)};case"Enum":return{_tag:"Enum",enums:h.enums,checks:E,...Nr(h.annotations)};case"TemplateLiteral":return{_tag:"TemplateLiteral",parts:h.parts.map(w=>S(w)),checks:E,...Nr(h.annotations)};case"Arrays":return{_tag:"Arrays",elements:h.elements.map(w=>{let T=el(w),A=T.context?.annotations;return{isOptional:ut(T),type:S(w),...Nr(A)}}),rest:h.rest.map(w=>S(w)),checks:E,...Nr(h.annotations)};case"Objects":return{_tag:"Objects",propertySignatures:h.propertySignatures.map(w=>{let T=el(w.type),A=T.context?.annotations;return{name:w.name,type:S(w.type),isOptional:ut(T),isMutable:eR(T),...Nr(A)}}),indexSignatures:h.indexSignatures.map(w=>({parameter:S(w.parameter),type:S(w.type)})),checks:E,...Nr(h.annotations)};case"Union":return{_tag:"Union",types:h.types.map(w=>S(w)),mode:h.mode,checks:E,...Nr(h.annotations)};case"Suspend":return{_tag:"Suspend",checks:[],thunk:S(h.thunk()),...Nr(h.annotations)}}}function I(h){return h?.map(C)??[]}function C(h){switch(h._tag){case"Filter":return{_tag:"Filter",aborted:h.aborted,...x(h.annotations)};case"FilterGroup":return{_tag:"FilterGroup",checks:Et(h.checks,C),...x(h.annotations)}}}function y(h){if(h===void 0)return;let{representation:E,...w}=h;return{...E===void 0?void 0:{representation:E},...Object.keys(w).length===0?void 0:{annotations:w}}}function x(h){if(h===void 0)return;let{representation:E,...w}=h,T=E===void 0?void 0:E.schemas===void 0?E:{...E,schemas:E.schemas.map(A=>S(Ut(A)))};return{...T===void 0?void 0:{representation:T},...Object.keys(w).length===0?void 0:{annotations:w}}}}function yM(e,t){let n=[];return Hb(e,t,"",n),n}function Hb(e,t,n,r){if(!Object.is(e,t)){if(Array.isArray(e)&&Array.isArray(t)){let o=e.length,s=t.length,a=Math.min(o,s);for(let i=0;i<a;i++)Hb(e[i],t[i],`${n}/${i}`,r);for(let i=o-1;i>=s;i--)r.push({op:"remove",path:`${n}/${i}`});for(let i=o;i<s;i++)r.push({op:"add",path:`${n}/${i}`,value:t[i]});return}if(ch(e)&&ch(t)){let o=Object.keys(e),s=Object.keys(t),a=Array.from(new Set([...o,...s])).sort();for(let i of a){let c=`${n}/${Xa(i)}`,u=Object.hasOwn(e,i),f=Object.hasOwn(t,i);u&&f?Hb(e[i],t[i],c,r):!u&&f?r.push({op:"add",path:c,value:t[i]}):r.push({op:"remove",path:c})}return}r.push({op:"replace",path:n,value:t})}}function SM(e,t){let n=t;for(let r of e)n=o3(n,r);return n}function ch(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function r3(e){if(e==="")return[];if(e.charCodeAt(0)!==47)throw new Error(`Invalid JSON Pointer, it must start with "/": ${JSON.stringify(e)}`);return e.split("/").slice(1).map(Fc)}function EM(e){if(!/^(0|[1-9]\d*)$/.test(e))throw new Error(`Invalid array index: "${e}"`);return Number(e)}function o3(e,t){if(t.path===""){if(t.op==="remove")throw new Error("Unsupported operation at the root");return t.value}let n=s3(e,t.path);if(n===null)throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`);let{lastToken:r,parent:o,stack:s}=n;if(Array.isArray(o)){if(r==="-"&&t.op!=="add")throw new Error(`"-" is not valid for ${t.op} at "${t.path}".`);let a=r==="-"?o.length:EM(r),i=t.op==="add"?o.length:o.length-1;if(a>i)throw new Error(`Array index out of bounds at "${t.path}".`);let c=o.slice();return t.op==="add"?c.splice(a,0,t.value):t.op==="remove"?c.splice(a,1):c[a]=t.value,xM(s,c)}if(ch(o)){if(t.op!=="add"&&!Object.hasOwn(o,r))throw new Error(`Property "${r}" does not exist at "${t.path}".`);let a={...o};return t.op==="remove"?delete a[r]:M(a,r,t.value),xM(s,a)}throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`)}function s3(e,t){let n=r3(t);if(n.length===0)return null;let r=n[n.length-1],o=[],s=e;for(let a=0;a<n.length-1;a++){let i=n[a];if(Array.isArray(s)){let c=EM(i);if(c>=s.length)return null;o.push({container:s,token:c}),s=s[c];continue}if(ch(s)){if(!Object.hasOwn(s,i))return null;o.push({container:s,token:i}),s=s[i];continue}return null}return{stack:o,parent:s,lastToken:r}}function xM(e,t){let n=t;for(let r=e.length-1;r>=0;r--){let{container:o,token:s}=e[r];if(Array.isArray(o)){let a=o.slice();a[s]=n,n=a}else{let a={...o};M(a,s,n),n=a}}return n}function vM(e,t){return Dr(Nc("Iso",e,t))}function wM(e,t){return Dr(Nc("Lens",e,t))}function Nc(e,t,n){return[{_tag:"PrimitiveNode",kind:e,get:t,set:n}]}var a3={kind:"Iso",get:F,set:F},uh=class{_tag="PathNode";kind="Lens";path;get;set;constructor(t){this.path=t,this.get=n=>{let r=n;for(let o=0;o<t.length;o++)r=r[t[o]];return r},this.set=(n,r)=>{let o=fh(r),s=o,a=0;for(;a<t.length-1;a++){let i=t[a];M(s,i,fh(s[i])),s=s[i]}return M(s,t[a],n),o}}},El=class{_tag="CheckNode";kind="Prism";checks;get;set=F;constructor(t){this.checks=t,this.get=n=>cR(t,n)}};function ti(e,t){if(e.length===0)return t;if(t.length===0)return e;let n=e.slice();for(let r=0;r<t.length;r++){let o=t[r],s=n[n.length-1];s._tag==="PathNode"&&o._tag==="PathNode"?n[n.length-1]=new uh([...s.path,...o.path]):s._tag==="CheckNode"&&o._tag==="CheckNode"?n[n.length-1]=new El([...s.checks,...o.checks]):n.push(o)}return n}function i3(e,t){return Dr(Nc("Optional",e,t))}var Dc=class{node;getResult;replaceResult;constructor(t,n,r){this.node=t,this.getResult=n,this.replaceResult=r}replace(t,n){return ku(this.replaceResult(t,n),()=>n)}modify(t){return n=>ku(vd(this.getResult(n),r=>this.replaceResult(t(r),n)),()=>n)}compose(t){return Dr(ti(this.node,t.node))}key(t){return Dr(ti(this.node,[new uh([t])]))}optionalKey(t){return Dr(ti(this.node,Nc("Lens",n=>n[t],(n,r)=>{let o=fh(r);return n===void 0?Array.isArray(o)&&typeof t=="number"?o.splice(t,1):delete o[t]:M(o,t,n),o})))}check(...t){return Dr(ti(this.node,[new El(t)]))}refine(t,n){return Dr(ti(this.node,[new El([Pm(t,n)])]))}tag(t){let n=ce(new fe({expected:`${JSON.stringify(t)} tag`}));return Dr(ti(this.node,Nc("Prism",r=>r._tag===t?se(r):n,F)))}at(t,...n){let r=ce(new ct([t],new Ds(void 0)));return Dr(ti(this.node,Nc("Optional",o=>Object.hasOwn(o,t)?se(o[t]):r,(o,s)=>{if(Object.hasOwn(s,t)){let a=fh(s);return M(a,t,o),se(a)}else return r})))}pick(t){return this.compose(wM(FF(t),(n,r)=>({...r,...n})))}omit(t){return this.compose(wM(MF(t),(n,r)=>({...r,...n})))}notUndefined(){return this.refine(_e,{expected:"a value other than `undefined`"})}forEach(t){let n=t(lh());return i3(r=>pa(this.getResult(r),o=>{let s=[];for(let a=0;a<o.length;a++){let i=n.getResult(o[a]);en(i)&&s.push(i.success)}return s}),(r,o)=>vd(this.getResult(o),s=>{let a=[];for(let c=0;c<s.length;c++)en(n.getResult(s[c]))&&a.push(c);if(r.length!==a.length)return ce(new fe({message:`each: replacement length mismatch: ${r.length} !== ${a.length}`}));let i=s.slice();for(let c=0;c<a.length;c++){let u=a[c],f=n.replaceResult(r[c],s[u]);if(Ce(f))return ce(new ct([u],f.failure));i[u]=f.success}return this.replaceResult(i,o)}))}modifyAll(t){return n=>ku(vd(this.getResult(n),r=>this.replaceResult(r.map(t),n)),()=>n)}},Gb=class extends Dc{get;set;constructor(t,n,r){super(t,o=>se(n(o)),o=>se(r(o))),this.get=n,this.set=r}replace(t,n){return this.set(t)}modify(t){return n=>this.set(t(this.get(n)))}},Kb=class extends Dc{get;constructor(t,n,r){super(t,o=>se(n(o)),(o,s)=>se(r(o,s))),this.get=n,this.replace=r}modify(t){return n=>this.replace(t(this.get(n)),n)}},Vb=class extends Dc{set;constructor(t,n,r){super(t,n,(o,s)=>se(r(o))),this.set=r}replace(t,n){return this.set(t)}modify(t){return n=>ku(pa(this.getResult(n),r=>this.set(t(r))),()=>n)}};function Dr(e){let t=e[0]??a3;if(e.length>1){let n=e.reduce((r,o)=>f3(r,o.kind),"Iso");t={kind:n,get:c3(e,n),set:u3(e,n)}}switch(t.kind){case"Iso":return new Gb(e,t.get,t.set);case"Lens":return new Kb(e,t.get,t.set);case"Prism":return new Vb(e,t.get,t.set);case"Optional":return new Dc(e,t.get,t.set)}}function fh(e){if(Array.isArray(e))return e.slice();if(typeof e=="object"&&e!==null){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)throw new Error("Cannot clone object with non-Object constructor or null prototype");return{...e}}return e}function c3(e,t){return n=>{for(let r=0;r<e.length;r++){let o=e[r],s=o.get(n);if(Jb(o.kind)){if(Ce(s))return s;n=s.success}else n=s}return Jb(t)?se(n):n}}function u3(e,t){return IM(t)?n=>{for(let r=e.length-1;r>=0;r--)n=e[r].set(n);return n}:(n,r)=>{let o=e.length,s=new Array(o);for(let a=0;a<o;a++){s[a]=r;let i=e[a];if(Jb(i.kind)){let c=i.get(r);if(Ce(c))return c;r=c.success}else r=i.get(r)}for(let a=o-1;a>=0;a--){let i=e[a];if(IM(i.kind))n=i.set(n);else if(i.kind==="Lens")n=i.set(n,s[a]);else{let c=i.set(n,s[a]);if(Ce(c))return c;n=c.success}}return t==="Optional"?se(n):n}}function Jb(e){return e==="Prism"||e==="Optional"}function IM(e){return e==="Iso"||e==="Prism"}function f3(e,t){return e==="Iso"?t:t==="Iso"||e===t?e:"Optional"}var l3=Dr([]);function lh(){return l3}var ni=new WeakMap,TM=e=>{if(ni.has(e))return ni.get(e);throw new Error("Unable to get redacted value"+(e.label?` with label: "${e.label}"`:""))};var kM="~effect/data/Redacted",Zb=e=>_(e,kM),Zo=(e,t)=>{let n=Object.create(p3);return t?.label&&(n.label=t.label),ni.set(n,e),n},p3={[kM]:{_A:e=>e},label:void 0,...Yt,toJSON(){return this.toString()},toString(){return`<redacted${hr(this.label)?":"+this.label:""}>`},[me](){return Z(ni.get(this))},[he](e){return Zb(e)&&K(ni.get(this),ni.get(e))}},Gs=TM;var OM=e=>Tt((t,n)=>e(Gs(t),Gs(n)));var wl=rh;function Tn(){return(e,t,n)=>W(new Ba(e.map(Jf),r=>t(r.map(o=>W(o))),n))}function dr(e,t){return Tn()([],()=>(n,r,o)=>e(n)?b(n):k(new Ye(r,n,o)),t)}function m3(e){return e}function h3(e){return t=>t.annotate(e)}function g3(e){return t=>Yb(Yb(t).annotate(e))}function x3(e){return t=>t.rebuild(tl(t.ast,e))}function y3(e){return e}var Il="~effect/SchemaError/SchemaError",Ks=class extends xs("SchemaError"){[Il]=Il;constructor(t){let n=Ss();Fn(0);try{super({issue:t})}finally{Fn(n)}}get message(){return p_(this.issue)}toString(){return`SchemaError(${this.message})`}};function zM(e){return _(e,Il)&&e[Il]===Il}function AM(e){return ht(e)?e.value:{issues:[{message:bk(e.cause)}]}}function S3(e,t){let n=ft(e),r={errors:"all",...t?.parseOptions},o=d_(t),s=a=>{let i=new ya("sync"),c=eo(_s(n(a,r),{onFailure:o,onSuccess:f=>({value:f})}),{scheduler:i});c.currentDispatcher?.flush();let u=c.pollUnsafe();return u?AM(u):new Promise(f=>{c.addObserver(l=>{f(AM(l))})})};if("~standard"in e){let a=e;return"validate"in a["~standard"]||Object.assign(a["~standard"],{validate:s}),a}else return Object.assign(e,{"~standard":{version:1,vendor:"effect",validate:s}})}function _M(e,t){let n=L1(e);if(t==="draft-2020-12"){let r=n.schema;return Object.keys(n.definitions).length>0&&(r.$defs=n.definitions),r}else if(t==="draft-07"){let r=aM(n),o=r.schema;return Object.keys(r.definitions).length>0&&(o.definitions=r.definitions),o}throw new globalThis.Error(`Unsupported target: ${t}`)}function E3(e){let t={input(n){return _M(e,n.target)},output(n){return _M(dn(e),n.target)}};if("~standard"in e){let n=e;return"jsonSchema"in n["~standard"]||Object.assign(n["~standard"],{jsonSchema:t}),n}else return Object.assign(e,{"~standard":{version:1,vendor:"effect",jsonSchema:t}})}var Cl=hF,b3=xF;function Xo(e,t){let n=ft(e,t);return(r,o)=>WM(n(r,o))}function WM(e){return De(e)?tw(e):Bn(e,t=>Os(()=>Ts(t,n=>new Ks(n))))}var w3=Xo;function HM(e,t){let n;for(let r of e.reasons){if(!lp(r)||!zM(r.error))throw new globalThis.Error(t,{cause:e});n??=r.error}if(n===void 0)throw new globalThis.Error(t,{cause:e});return n}function GM(e){return Lp(e).then(t=>{if(ht(t))return t.value;throw HM(t.cause,"Promise adapter can only reject schema errors")})}function KM(e){let t=Rs(e);if(ht(t))return t.value;throw HM(t.cause,"Sync adapter can only throw schema errors")}function VM(e,t){let n=yF(e,t);return(r,o)=>tw(n(r,o))}function tw(e){return ht(e)?e:er(Ts(e.cause,t=>new Ks(t)))}var I3=VM,v3=Pb,C3=SF;function JM(e,t){let n=EF(e,t);return(r,o)=>Id(n(r,o),s=>new Ks(s))}var T3=JM;function ZM(e,t){let n=Xo(e,t);return(r,o)=>GM(n(r,o))}var k3=ZM;function YM(e,t){let n=Xo(e,t);return(r,o)=>KM(n(r,o))}var O3=YM;function hh(e,t){let n=Pc(e,t);return(r,o)=>WM(n(r,o))}var QM=hh;function XM(e,t){let n=bF(e,t);return(r,o)=>tw(n(r,o))}var A3=XM,_3=Fb,P3=wF;function eN(e,t){let n=IF(e,t);return(r,o)=>Id(n(r,o),s=>new Ks(s))}var R3=eN;function tN(e,t){let n=hh(e,t);return(r,o)=>GM(n(r,o))}var F3=tN;function nN(e,t){let n=hh(e,t);return(r,o)=>KM(n(r,o))}var M3=nN,W=hl;function gh(e){return _(e,wl)&&e[wl]===wl}var Yo=Gt(e=>W(Tc(e.ast),{schema:e})),N3=Gt(e=>e.schema),ln=Gt(e=>{let t=Sh(e);return W(YP(e.ast),{schema:t})}),D3=Gt(e=>e.schema.members[0]),$3=Gt(e=>W(HE(e.ast),{schema:e})),U3=Gt(e=>e.schema),dn=Gt(e=>W(Ut(e.ast),{schema:e})),qc=Gt(e=>W(In(e.ast),{schema:e})),vl="~effect/Schema/flip";function L3(e){return _(e,vl)&&e[vl]===vl}function Yb(e){return L3(e)?e.schema.rebuild(_r(e.ast)):W(_r(e.ast),{[vl]:vl,schema:e})}function $e(e){let t=W(new wn(e),{literal:e,transform(n){return t.pipe(re($e(n),{decode:de(()=>n),encode:de(()=>e)}))}});return t}function rN(e){return new bm(e.map(t=>gh(t)?t.ast:new wn(t)))}function j3(e){return W(rN(e),{parts:e})}function B3(e){return W(rN(e).asTemplateLiteralParser(),{parts:e})}function q3(e){return W(new Em(Object.keys(e).filter(t=>typeof e[e[t]]!="number").map(t=>[t,e[t]])),{enums:e})}var z3=W(NP),W3=W(DP),nw=W(Ko),Ie=W(ME),rw=W(NE),H=W(so),Tl=W(DE),xh=W(LP),oN=W(jP),uo=W(BP),H3=W(MP),G3=W($P);function K3(e){return W(new wm(e))}function ow(e,t){return W(e,{fields:t,mapFields(n,r){let o=n(this.fields);return ow(km(o,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function G(e){return ow(km(e,void 0),e)}function V3(e){return Gt(t=>t.mapFields(NF(e)))}var J3=e=>typeof e=="symbol"?e:globalThis.String(e);function Z3(e){return function(t){let n={},r=Object.create(null),o=Object.create(null),s=new Set;for(let a of Reflect.ownKeys(t.fields)){let i=qc(t.fields[a]),c=Object.hasOwn(e,a),u=c?e[a]:a,f=J3(u);if(s.has(f))throw new globalThis.Error(`Duplicate encoded keys: ${go(u)}`);s.add(f),M(n,u,i),c&&(r[a]=u,o[u]=a)}return G(n).pipe(re(t,Ke({decode:Db(o),encode:Db(r)})))}}function Y3(e,t){return n=>{let r=r0(n.fields,dn),o=G({...r,...e});return n.pipe(re(o,Ke({decode:s=>{let a={...s};for(let i in e){let c=t[i],u=c(s);we(u)&&M(a,i,u.value)}return a},encode:s=>{let a={...s};for(let i in e)delete a[i];return a}})))}}function yh(e,t){return W(XP(e.ast,t.ast),{key:e,value:t})}function Q3(e,t){return W(qP(e.ast,t.map(Jf)),{schema:e,records:t})}function sN(e,t){return W(e,{elements:t,mapElements(n,r){let o=n(this.elements);return sN(LE(o,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Uc(e){return sN(LE(e),e)}function X3(e,t){return W(zP(e.ast,t.map(Jf)),{schema:e,rest:t})}var Oe=Gt(e=>W(new Pr(!1,[],[e.ast]),{value:e}));var eK=Gt(e=>W(new Pr(!1,[e.ast],[e.ast]),{value:e}));function tK(e){return Xe([e,Oe(e)]).pipe(re(Oe(dn(e)),Ke({decode:s0,encode:t=>t.length===1?t[0]:t})))}function nK(e){return Oe(e).check(pw())}var rK=Gt(e=>W(new Pr(!0,e.ast.elements,e.ast.rest),{schema:e}));function aN(e,t){return W(e,{members:t,mapMembers(n,r){let o=n(this.members);return aN(Om(o,this.ast.mode,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Xe(e,t){return aN(Om(e,t?.mode??"anyOf",void 0),e)}function es(e){let t=e.map($e);return W(Om(t,"anyOf",void 0),{literals:e,members:t,mapMembers(n){return Xe(n(this.members))},pick(n){return es(n)},transform(n){return Xe(t.map((r,o)=>r.transform(n[o])))}})}var sw=Gt(e=>Xe([e,Ie])),Sh=Gt(e=>Xe([e,rw])),iN=Gt(e=>Xe([e,Ie,rw]));function cN(e){return W(new vm(()=>e().ast))}function oK(...e){return t=>t.check(...e)}function sK(e,t){return n=>W(ao(n.ast,[Pm(e,t)]),{schema:n})}function uN(e){return t=>W(ZP(t.ast,e),{schema:t,identifier:e})}function aK(e,t){return n=>(t.checks?n.check(...t.checks):n).pipe(uN(e))}function fN(e){return t=>W(VP(t.ast,new Hf(e,F)),{schema:t})}function lN(e){return t=>W(JP(t.ast,new Hf(F,e)),{schema:t})}function iK(e){return dN(e)}function dN(e){return t=>fN(Sf(e))(t)}function cK(e){return pN(e)}function pN(e){return t=>lN(Sf(e))(t)}function re(e,t){return n=>W(Mm(n.ast,e.ast,t?gm(t):yc()),{from:n,to:e})}function uK(e){return t=>re(dn(t),e)(t)}function aw(e,t){return n=>t?re(n,t)(e):re(n)(e)}function fK(e){return t=>re(t,e)(qc(t))}function mN(e){return t=>W(QP(t.ast,e),{schema:t})}function hN(e){return Bn(e,t=>Os(()=>Ts(t,n=>n.issue)))}function iw(e,t){let n=t?.encodingStrategy==="omit"?JS():Ar();return r=>Yo(qc(r)).pipe(re(r,{decode:zf(hN(e)),encode:n}))}function lK(e,t){return n=>dn(n).pipe(iw(e,t),aw(Yo(n)))}function gN(e,t){let n=t?.encodingStrategy==="omit"?JS():Ar();return r=>ln(qc(r)).pipe(re(r,{decode:zf(hN(e)),encode:n}))}function dK(e,t){return n=>dn(n).pipe(gN(e,t),aw(ln(n)))}function Qo(e){return $e(e).pipe(mN(b(e)))}function pK(e){return Qo(e).pipe(iw(b(e),{encodingStrategy:"omit"}))}function Eh(e,t){return G({_tag:Qo(e),...t})}function xN(e){return t=>{let n={},r=[],o=new Set,s={},a=f=>l=>f.includes(l[e]);return i(t),Object.assign(t,{cases:n,discriminants:r,isAnyOf:a,guards:s,match:c,matchOrElse:u});function i(f){let l=f.ast;if(RP(l)&&"members"in f&&globalThis.Array.isArray(f.members)&&f.members.every(gh))return f.members.forEach(i);let d=wc(l);if(d.length>0){let m=d.find(g=>g.key===e)?.literal;if(id(m)){let g=typeof m=="number"?globalThis.String(m):m;if(o.has(g))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(m)}`);o.add(g),r.push(m),M(n,m,f),M(s,m,Cl(dn(f)));return}}throw new globalThis.Error("No literal or unique symbol found")}function c(){if(arguments.length===1){let g=arguments[0];return function(S){let v=S[e];return(Object.hasOwn(g,v)?g[v]:void 0)(S)}}let f=arguments[0],l=arguments[1],d=f[e];return(Object.hasOwn(l,d)?l[d]:void 0)(f)}function u(){if(arguments.length===2){let S=arguments[0],v=arguments[1];return function(I){let C=I[e];return(Object.hasOwn(S,C)?S[C]??v:v)(I)}}let f=arguments[0],l=arguments[1],d=arguments[2],m=f[e];return(Object.hasOwn(l,m)?l[m]??d:d)(f)}}}function mK(e){let t={},n=[];for(let c of Object.keys(e)){let u=Eh(c,e[c]);M(t,c,u),n.push(u)}let r=Xe(n),{guards:o,isAnyOf:s,match:a,matchOrElse:i}=xN("_tag")(r);return W(r.ast,{cases:t,isAnyOf:s,guards:o,match:a,matchOrElse:i})}function hK(){return e=>e}function Vs(e,t){return dr(n=>n instanceof e,t)}function Le(){return(e,t)=>new Qe(e.ast,gm(t))}var je=_m;function gK(e,t=void 0){return new za(e,t)}function Kt(e,t){return fn(e,Ie,({annotations:n})=>n===void 0?t:t.annotate(n))}var PM="^\\S[\\s\\S]*\\S$|^\\S$|^$";function cw(e){let t=new globalThis.RegExp(PM);return je(n=>n.trim()===n,{expected:"a string with no leading or trailing whitespace",representation:{id:"effect/schema/isTrimmed",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isTrimmed()"}),arbitrary:{constraint:{patterns:[PM]}},...e})}var xK=ae("effect/schema/isTrimmed",Ie,({annotations:e})=>cw(e));function ri(e,t){let n=e.source,r=e.flags,o=r===""?`new RegExp(${D(n)})`:`new RegExp(${D(n)}, ${D(r)})`;return Yf(e,{toCode:()=>({runtime:`Schema.isPattern(${o})`}),...t})}var yK=G({source:H,flags:H}).check(je(e=>{let t=Qv(()=>new globalThis.RegExp(e.source,e.flags));return en(t)&&t.success.source===e.source&&t.success.flags===e.flags})),SK={id:"effect/schema/isPattern",payloadSchema:yK,revive:({annotations:e,payload:t})=>ri(new globalThis.RegExp(t.source,t.flags),e)};function yN(e){return KE({toCode:()=>({runtime:"Schema.isStringFinite()"}),...e})}var EK=ae("effect/schema/isStringFinite",Ie,({annotations:e})=>yN(e));function SN(e){return VE({toCode:()=>({runtime:"Schema.isStringBigInt()"}),...e})}var bK=ae("effect/schema/isStringBigInt",Ie,({annotations:e})=>SN(e));function EN(e){return ZE({toCode:()=>({runtime:"Schema.isStringSymbol()"}),...e})}var wK=ae("effect/schema/isStringSymbol",Ie,({annotations:e})=>EN(e)),IK=e=>e?new globalThis.RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$/;function bN(e,t){let n=IK(e);return ri(n,{expected:e?`a UUID v${e}`:"a UUID",representation:{id:"effect/schema/isUUID",payload:{version:e??null}},toJsonSchema:()=>({pattern:n.source,format:"uuid"}),toCode:()=>({runtime:e===void 0?"Schema.isUUID()":`Schema.isUUID(${e})`}),...t})}var vK=ae("effect/schema/isUUID",G({version:Xe([es([1,2,3,4,5,6,7,8]),Ie])}),({annotations:e,payload:t})=>bN(t.version??void 0,e)),RM=/^([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})$/;function wN(e){return ri(RM,{expected:"a GUID",representation:{id:"effect/schema/isGUID",payload:null},toJsonSchema:()=>({pattern:RM.source}),toCode:()=>({runtime:"Schema.isGUID()"}),...e})}var CK=ae("effect/schema/isGUID",Ie,({annotations:e})=>wN(e));function IN(e){let t=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;return ri(t,{representation:{id:"effect/schema/isULID",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isULID()"}),...e})}var TK=ae("effect/schema/isULID",Ie,({annotations:e})=>IN(e));function uw(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return ri(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}var kK=ae("effect/schema/isBase64",Ie,({annotations:e})=>uw(e));function vN(e){let t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;return ri(t,{expected:"a base64url encoded string",representation:{id:"effect/schema/isBase64Url",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64Url()"}),...e})}var OK=ae("effect/schema/isBase64Url",Ie,({annotations:e})=>vN(e));function CN(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(`^${Mc(e)}`);return je(o=>o.startsWith(e),{expected:`a string starting with ${n}`,representation:{id:"effect/schema/isStartsWith",payload:{startsWith:e}},toJsonSchema:()=>({pattern:r.source}),toCode:()=>({runtime:`Schema.isStartsWith(${D(e)})`}),arbitrary:{constraint:{patterns:[r.source]}},...t})}var AK=ae("effect/schema/isStartsWith",G({startsWith:H}),({annotations:e,payload:t})=>CN(t.startsWith,e));function TN(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(`${Mc(e)}$`);return je(o=>o.endsWith(e),{expected:`a string ending with ${n}`,representation:{id:"effect/schema/isEndsWith",payload:{endsWith:e}},toJsonSchema:()=>({pattern:r.source}),toCode:()=>({runtime:`Schema.isEndsWith(${D(e)})`}),arbitrary:{constraint:{patterns:[r.source]}},...t})}var _K=ae("effect/schema/isEndsWith",G({endsWith:H}),({annotations:e,payload:t})=>TN(t.endsWith,e));function kN(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(Mc(e));return je(o=>o.includes(e),{expected:`a string including ${n}`,representation:{id:"effect/schema/isIncludes",payload:{includes:e}},toJsonSchema:()=>({pattern:r.source}),toCode:()=>({runtime:`Schema.isIncludes(${D(e)})`}),arbitrary:{constraint:{patterns:[r.source]}},...t})}var PK=ae("effect/schema/isIncludes",G({includes:H}),({annotations:e,payload:t})=>kN(t.includes,e)),FM="^[^a-z]*$";function ON(e){let t=new globalThis.RegExp(FM);return je(n=>n.toUpperCase()===n,{expected:"a string with all characters in uppercase",representation:{id:"effect/schema/isUppercased",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isUppercased()"}),arbitrary:{constraint:{patterns:[FM]}},...e})}var RK=ae("effect/schema/isUppercased",Ie,({annotations:e})=>ON(e)),MM="^[^A-Z]*$";function AN(e){let t=new globalThis.RegExp(MM);return je(n=>n.toLowerCase()===n,{expected:"a string with all characters in lowercase",representation:{id:"effect/schema/isLowercased",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isLowercased()"}),arbitrary:{constraint:{patterns:[MM]}},...e})}var FK=ae("effect/schema/isLowercased",Ie,({annotations:e})=>AN(e)),NM="^[^a-z]?.*$";function _N(e){let t=new globalThis.RegExp(NM);return je(n=>n.charAt(0).toUpperCase()===n.charAt(0),{expected:"a string with the first character in uppercase",representation:{id:"effect/schema/isCapitalized",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isCapitalized()"}),arbitrary:{constraint:{patterns:[NM]}},...e})}var MK=ae("effect/schema/isCapitalized",Ie,({annotations:e})=>_N(e)),DM="^[^A-Z]?.*$";function PN(e){let t=new globalThis.RegExp(DM);return je(n=>n.charAt(0).toLowerCase()===n.charAt(0),{expected:"a string with the first character in lowercase",representation:{id:"effect/schema/isUncapitalized",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isUncapitalized()"}),arbitrary:{constraint:{patterns:[DM]}},...e})}var NK=ae("effect/schema/isUncapitalized",Ie,({annotations:e})=>PN(e)),vn=W(BE),RN=jE,DK=ae("effect/schema/isFinite",Ie,({annotations:e})=>RN(e));function kl(e){let t=ds(e.order),n=e.formatter??D;return(r,o)=>je(s=>t(s,r),{expected:`a value greater than ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:r,exclusiveMinimum:!0}}},...e.annotate?.(r),...o})}function Ol(e){let t=Cu(e.order),n=e.formatter??D;return(r,o)=>je(s=>t(s,r),{expected:`a value greater than or equal to ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:r}}},...e.annotate?.(r),...o})}function Al(e){let t=ki(e.order),n=e.formatter??D;return(r,o)=>je(s=>t(s,r),{expected:`a value less than ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,maximum:r,exclusiveMaximum:!0}}},...e.annotate?.(r),...o})}function _l(e){let t=vu(e.order),n=e.formatter??D;return(r,o)=>je(s=>t(s,r),{expected:`a value less than or equal to ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,maximum:r}}},...e.annotate?.(r),...o})}function Pl(e){let t=Cu(e.order),n=ds(e.order),r=vu(e.order),o=ki(e.order),s=e.formatter??D;return(a,i)=>{let c=a.exclusiveMinimum?n:t,u=a.exclusiveMaximum?o:r;return je(f=>c(f,a.minimum)&&u(f,a.maximum),{expected:`a value between ${s(a.minimum)}${a.exclusiveMinimum?" (excluded)":""} and ${s(a.maximum)}${a.exclusiveMaximum?" (excluded)":""}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:a.minimum,maximum:a.maximum,...a.exclusiveMinimum&&{exclusiveMinimum:!0},...a.exclusiveMaximum&&{exclusiveMaximum:!0}}}},...e.annotate?.(a),...i})}}function FN(e){return(t,n)=>{let r=e.formatter??D;return je(o=>e.remainder(o,t)===e.zero,{expected:`a value that is a multiple of ${r(t)}`,...e.annotate?.(t),...n})}}function Lc(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${D(e)}`);return e}var MN=kl({order:Pn,annotate:e=>({representation:{id:"effect/schema/isGreaterThan",payload:{exclusiveMinimum:Lc(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${D(e)})`})})}),$K=ae("effect/schema/isGreaterThan",G({exclusiveMinimum:vn}),({annotations:e,payload:t})=>MN(t.exclusiveMinimum,e)),fw=Ol({order:Pn,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:Lc(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${D(e)})`})})}),UK=ae("effect/schema/isGreaterThanOrEqualTo",G({minimum:vn}),({annotations:e,payload:t})=>fw(t.minimum,e)),NN=Al({order:Pn,annotate:e=>({representation:{id:"effect/schema/isLessThan",payload:{exclusiveMaximum:Lc(e)}},toJsonSchema:()=>({exclusiveMaximum:e}),toCode:()=>({runtime:`Schema.isLessThan(${D(e)})`})})}),LK=ae("effect/schema/isLessThan",G({exclusiveMaximum:vn}),({annotations:e,payload:t})=>NN(t.exclusiveMaximum,e)),DN=_l({order:Pn,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualTo",payload:{maximum:Lc(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${D(e)})`})})}),jK=ae("effect/schema/isLessThanOrEqualTo",G({maximum:vn}),({annotations:e,payload:t})=>DN(t.maximum,e)),Rl=Pl({order:Pn,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetween",payload:{minimum:Lc(e.minimum),maximum:Lc(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?"exclusiveMinimum":"minimum"]:e.minimum,[n?"exclusiveMaximum":"maximum"]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${D(e.minimum)}, maximum: ${D(e.maximum)}, exclusiveMinimum: ${D(t)}, exclusiveMaximum: ${D(n)} })`})}}}),BK=ae("effect/schema/isBetween",G({minimum:vn,maximum:vn,exclusiveMinimum:ln($e(!0)),exclusiveMaximum:ln($e(!0))}),({annotations:e,payload:t})=>Rl(t,e)),$N=FN({remainder:oO,zero:0,annotate:e=>({expected:`a value that is a multiple of ${e}`,representation:{id:"effect/schema/isMultipleOf",payload:{divisor:e}},toJsonSchema:()=>({multipleOf:e}),toCode:()=>({runtime:`Schema.isMultipleOf(${D(e)})`})})}),qK=ae("effect/schema/isMultipleOf",G({divisor:vn}),({annotations:e,payload:t})=>$N(t.divisor,e));function Fl(e){return je(t=>globalThis.Number.isSafeInteger(t),{expected:"an integer",representation:{id:"effect/schema/isInt",payload:null},toJsonSchema:()=>({type:"integer"}),toCode:()=>({runtime:"Schema.isInt()"}),arbitrary:{constraint:{integer:!0}},...e})}var zK=ae("effect/schema/isInt",Ie,({annotations:e})=>Fl(e)),fo=Tl.check(Fl()),Lt=fo.check(fw(0));function WK(e){return new za([Fl(),Rl({minimum:-2147483648,maximum:2147483647})],{expected:"a 32-bit integer",...e})}function HK(e){return new za([Fl(),Rl({minimum:0,maximum:4294967295})],{expected:"a 32-bit unsigned integer",...e})}function jc(e){if(globalThis.Number.isNaN(e.getTime()))throw new globalThis.RangeError(`Expected a valid Date, got ${D(e)}`);return e.toISOString()}function Bc(e){return`new Date(${D(e.getTime())})`}var UN=kl({order:fa,annotate:e=>({representation:{id:"effect/schema/isGreaterThanDate",payload:{exclusiveMinimum:jc(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanDate(${Bc(e)})`})})}),LN=Ol({order:fa,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToDate",payload:{minimum:jc(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToDate(${Bc(e)})`})})}),jN=Al({order:fa,annotate:e=>({representation:{id:"effect/schema/isLessThanDate",payload:{exclusiveMaximum:jc(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanDate(${Bc(e)})`})})}),BN=_l({order:fa,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToDate",payload:{maximum:jc(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanOrEqualToDate(${Bc(e)})`})})}),qN=Pl({order:fa,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenDate",payload:{minimum:jc(e.minimum),maximum:jc(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isBetweenDate({ minimum: ${Bc(e.minimum)}, maximum: ${Bc(e.maximum)}, exclusiveMinimum: ${D(t)}, exclusiveMaximum: ${D(n)} })`})}}}),zN=kl({order:Zn,annotate:e=>({representation:{id:"effect/schema/isGreaterThanBigInt",payload:{exclusiveMinimum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanBigInt(${D(e)})`})})}),WN=Ol({order:Zn,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToBigInt",payload:{minimum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToBigInt(${D(e)})`})})}),HN=Al({order:Zn,annotate:e=>({representation:{id:"effect/schema/isLessThanBigInt",payload:{exclusiveMaximum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanBigInt(${D(e)})`})})}),GN=_l({order:Zn,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToBigInt",payload:{maximum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanOrEqualToBigInt(${D(e)})`})})}),KN=Pl({order:Zn,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenBigInt",payload:{minimum:e.minimum.toString(10),maximum:e.maximum.toString(10),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isBetweenBigInt({ minimum: ${D(e.minimum)}, maximum: ${D(e.maximum)}, exclusiveMinimum: ${D(t)}, exclusiveMaximum: ${D(n)} })`})}}}),GK=kl({order:Go,formatter:e=>oo(e)}),KK=Ol({order:Go,formatter:e=>oo(e)}),VK=Al({order:Go,formatter:e=>oo(e)}),JK=_l({order:Go,formatter:e=>oo(e)}),ZK=Pl({order:Go,formatter:e=>oo(e)});function lw(e,t){return e=Math.max(0,Math.floor(e)),je(n=>n.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:"effect/schema/isMinLength",payload:{minLength:e}},toJsonSchema:({type:n})=>n==="array"?{minItems:e}:{minLength:e},toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[yn]:!0,arbitrary:{constraint:{minLength:e}},...t})}var YK=ae("effect/schema/isMinLength",G({minLength:Lt}),({annotations:e,payload:t})=>lw(t.minLength,e));function VN(e){return lw(1,e)}function JN(e,t){return e=Math.max(0,Math.floor(e)),je(n=>n.length<=e,{expected:`a value with a length of at most ${e}`,representation:{id:"effect/schema/isMaxLength",payload:{maxLength:e}},toJsonSchema:({type:n})=>n==="array"?{maxItems:e}:{maxLength:e},toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[yn]:!0,arbitrary:{constraint:{maxLength:e}},...t})}var QK=ae("effect/schema/isMaxLength",G({maxLength:Lt}),({annotations:e,payload:t})=>JN(t.maxLength,e));function dw(e,t,n){return e=Math.max(0,Math.floor(e)),t=Math.max(0,Math.floor(t)),je(r=>r.length>=e&&r.length<=t,{expected:e===t?`a value with a length of ${e}`:`a value with a length between ${e} and ${t}`,representation:{id:"effect/schema/isLengthBetween",payload:{minimum:e,maximum:t}},toJsonSchema:({type:r})=>r==="array"?{allOf:[{minItems:e},{maxItems:t}]}:{allOf:[{minLength:e},{maxLength:t}]},toCode:()=>({runtime:`Schema.isLengthBetween(${e}, ${t})`}),[yn]:!0,arbitrary:{constraint:{minLength:e,maxLength:t}},...n})}var XK=ae("effect/schema/isLengthBetween",G({minimum:Lt,maximum:Lt}),({annotations:e,payload:t})=>dw(t.minimum,t.maximum,e));function ZN(e,t){return e=Math.max(0,Math.floor(e)),je(n=>n.size>=e,{expected:`a value with a size of at least ${e}`,representation:{id:"effect/schema/isMinSize",payload:{minSize:e}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isMinSize(${e})`}),[yn]:!0,arbitrary:{constraint:{minLength:e}},...t})}var eV=ae("effect/schema/isMinSize",G({minSize:Lt}),({annotations:e,payload:t})=>ZN(t.minSize,e));function YN(e,t){return e=Math.max(0,Math.floor(e)),je(n=>n.size<=e,{expected:`a value with a size of at most ${e}`,representation:{id:"effect/schema/isMaxSize",payload:{maxSize:e}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isMaxSize(${e})`}),[yn]:!0,arbitrary:{constraint:{maxLength:e}},...t})}var tV=ae("effect/schema/isMaxSize",G({maxSize:Lt}),({annotations:e,payload:t})=>YN(t.maxSize,e));function QN(e,t,n){return e=Math.max(0,Math.floor(e)),t=Math.max(0,Math.floor(t)),je(r=>r.size>=e&&r.size<=t,{expected:e===t?`a value with a size of ${e}`:`a value with a size between ${e} and ${t}`,representation:{id:"effect/schema/isSizeBetween",payload:{minimum:e,maximum:t}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isSizeBetween(${e}, ${t})`}),[yn]:!0,arbitrary:{constraint:{minLength:e,maxLength:t}},...n})}var nV=ae("effect/schema/isSizeBetween",G({minimum:Lt,maximum:Lt}),({annotations:e,payload:t})=>QN(t.minimum,t.maximum,e));function XN(e,t){return e=Math.max(0,Math.floor(e)),je(n=>Reflect.ownKeys(n).length>=e,{expected:`a value with at least ${e===1?"1 entry":`${e} entries`}`,representation:{id:"effect/schema/isMinProperties",payload:{minProperties:e}},toJsonSchema:()=>({minProperties:e}),toCode:()=>({runtime:`Schema.isMinProperties(${e})`}),[yn]:!0,arbitrary:{constraint:{minLength:e}},...t})}var rV=ae("effect/schema/isMinProperties",G({minProperties:Lt}),({annotations:e,payload:t})=>XN(t.minProperties,e));function e1(e,t){return e=Math.max(0,Math.floor(e)),je(n=>Reflect.ownKeys(n).length<=e,{expected:`a value with at most ${e===1?"1 entry":`${e} entries`}`,representation:{id:"effect/schema/isMaxProperties",payload:{maxProperties:e}},toJsonSchema:()=>({maxProperties:e}),toCode:()=>({runtime:`Schema.isMaxProperties(${e})`}),[yn]:!0,arbitrary:{constraint:{maxLength:e}},...t})}var oV=ae("effect/schema/isMaxProperties",G({maxProperties:Lt}),({annotations:e,payload:t})=>e1(t.maxProperties,e));function t1(e,t,n){return e=Math.max(0,Math.floor(e)),t=Math.max(0,Math.floor(t)),je(r=>Reflect.ownKeys(r).length>=e&&Reflect.ownKeys(r).length<=t,{expected:e===t?`a value with exactly ${e===1?"1 entry":`${e} entries`}`:`a value with between ${e} and ${t} entries`,representation:{id:"effect/schema/isPropertiesLengthBetween",payload:{minimum:e,maximum:t}},toJsonSchema:()=>({minProperties:e,maxProperties:t}),toCode:()=>({runtime:`Schema.isPropertiesLengthBetween(${e}, ${t})`}),[yn]:!0,arbitrary:{constraint:{minLength:e,maxLength:t}},...n})}var sV=ae("effect/schema/isPropertiesLengthBetween",G({minimum:Lt,maximum:Lt}),({annotations:e,payload:t})=>t1(t.minimum,t.maximum,e));function n1(e,t){let n=qc(e),r=gF(n.ast);return je((o,s,a)=>{let i=Reflect.ownKeys(o),c=[];for(let u of i){let f=r(u,a);if(f!==void 0&&(c.push(new ct([u],f)),a.errors==="first"))break}return ma(c)?new nt(s,c,o,a):!0},{expected:"an object with property names matching the schema",representation:{id:"effect/schema/isPropertyNames",payload:null,schemas:[n.ast]},toJsonSchema:({schemas:o})=>({propertyNames:o[0]}),toCode:({schemas:o})=>({runtime:`Schema.isPropertyNames(${o[0].runtime})`}),[yn]:!0,...t})}var aV=ae("effect/schema/isPropertyNames",Ie,({annotations:e,schemas:t})=>n1(t[0],e));function pw(e){return je(t=>kd(t).length===t.length,{expected:"an array with unique items",representation:{id:"effect/schema/isUnique",payload:null},toJsonSchema:()=>({uniqueItems:!0}),toCode:()=>({runtime:"Schema.isUnique()"}),arbitrary:{constraint:{unique:!0}},...e})}var iV=ae("effect/schema/isUnique",Ie,({annotations:e})=>pw(e)),r1=H.check(VN()),cV=H.check(dw(1,1));function Js(e){let t=Tn()([e],([n])=>(r,o,s)=>Ed(r)?Ne(r)?Ra:kt(ft(n)(r.value,s),{onSuccess:R,onFailure:a=>Sn(o,"value",a,r,s)}):k(new Ye(o,r,s)),{representation:{id:"effect/schema/Option",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Option(${n[0].runtime})`,Type:`Option.Option<${n[0].Type}>`,importDeclarations:['import * as Option from "effect/Option"']}),expected:"Option",toCodec:([n])=>Le()(Xe([G({_tag:$e("Some"),value:n}),G({_tag:$e("None")})]),Ke({decode:r=>r._tag==="None"?O():R(r.value),encode:r=>we(r)?{_tag:"Some",value:r.value}:{_tag:"None"}})),toArbitrary:([n])=>(r,o)=>{let s=r.constant(O()),a=r.oneof(s,n.arbitrary.map(R));return oi(r,o,s,a)},toEquivalence:([n])=>jv(n),toFormatter:([n])=>We({onNone:()=>"none()",onSome:r=>`some(${n(r)})`})});return W(t.ast,{value:e})}var uV=fn("effect/schema/Option",Ie,({annotations:e,typeParameters:t})=>{let n=Js(t[0]);return e===void 0?n:n.annotate(e)});function fV(e){return sw(e).pipe(re(Js(dn(e)),lP()))}function lV(e){return Sh(e).pipe(re(Js(dn(e)),dP()))}function dV(e,t){return iN(e).pipe(re(Js(dn(e)),pP(t)))}function pV(e){return Yo(e).pipe(re(Js(dn(e)),mP()))}function mV(e){return ln(e).pipe(re(Js(dn(e)),hP()))}function hV(e,t){let n=t===void 0?"omit":t.onNoneEncoding,r=n===null?null:void 0;return ln(sw(e)).pipe(re(Js(dn(e)),xm({decode:o=>o.pipe(_i(cd),R),encode:n==="omit"?Ai:o=>R(it(Ai(o),()=>r))})))}function o1(e,t){let n=Tn()([e,t],([r,o])=>(s,a,i)=>{if(!Xv(s))return k(new Ye(a,s,i));switch(s._tag){case"Success":return kt(_b(r)(s.success,i),{onSuccess:se,onFailure:c=>Sn(a,"success",c,s,i)});case"Failure":return kt(_b(o)(s.failure,i),{onSuccess:ce,onFailure:c=>Sn(a,"failure",c,s,i)})}},{representation:{id:"effect/schema/Result",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Result(${r[0].runtime}, ${r[1].runtime})`,Type:`Result.Result<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as Result from "effect/Result"']}),expected:"Result",toCodec:([r,o])=>Le()(Xe([G({_tag:$e("Success"),success:r}),G({_tag:$e("Failure"),failure:o})]),Ke({decode:s=>s._tag==="Success"?se(s.success):ce(s.failure),encode:s=>en(s)?{_tag:"Success",success:s.success}:{_tag:"Failure",failure:s.failure}})),toArbitrary:([r,o])=>(s,a)=>{let i=h1(s,r.terminal?.map(u=>se(u)),o.terminal?.map(u=>ce(u))),c=s.oneof(r.arbitrary.map(u=>se(u)),o.arbitrary.map(u=>ce(u)));return oi(s,a,i,c)},toEquivalence:([r,o])=>e0(r,o),toFormatter:([r,o])=>Qn({onSuccess:s=>`success(${r(s)})`,onFailure:s=>`failure(${o(s)})`})});return W(n.ast,{success:e,failure:t})}var gV=fn("effect/schema/Result",Ie,({annotations:e,typeParameters:t})=>{let n=o1(t[0],t[1]);return e===void 0?n:n.annotate(e)}),xV=dr(e=>{if(!jt(e))return!1;let t=globalThis.Object.keys(e);return t.length>0&&t.every(n=>{switch(n){case"label":return typeof e[n]=="string";case"disallowJsonEncode":return e[n]===!0;default:return!1}})}),yV=Xe([Ie,xV]);function bh(e,t){let n=typeof t?.label=="string"?t.label:void 0,r=t?.disallowJsonEncode===!0,o=n!==void 0?r?{label:n,disallowJsonEncode:!0}:{label:n}:r?{disallowJsonEncode:!0}:void 0,s=n!==void 0?ft($e(n)):void 0,a=Tn()([e],([i])=>(c,u,f)=>{if(Zb(c)){let l=s!==void 0?Ma(s(c.label,f),d=>new ct(["label"],d)):ge;return $t(l,()=>kt(ft(i)(Gs(c),f),{onSuccess:()=>c,onFailure:()=>new nt(u,[new ct(["value"],new fe(void 0,c,f))],c,f)}))}return k(new Ye(u,c,f))},{representation:{id:"effect/schema/Redacted",payload:o??null},toCode:({typeParameters:i})=>({runtime:o!==void 0?`Schema.Redacted(${i[0].runtime}, ${D(o)})`:`Schema.Redacted(${i[0].runtime})`,Type:`Redacted.Redacted<${i[0].Type}>`,importDeclarations:['import * as Redacted from "effect/Redacted"']}),expected:"Redacted",toCodecJson:([i])=>Le()(i,{decode:de(c=>Zo(c,{label:n})),encode:r?KS(c=>"Cannot serialize Redacted"+(we(c)&&typeof c.value.label=="string"?` with label: "${c.value.label}"`:"")):de(Gs)}),toArbitrary:([i])=>()=>({arbitrary:i.arbitrary.map(c=>Zo(c,{label:n})),terminal:i.terminal?.map(c=>Zo(c,{label:n}))}),toFormatter:()=>globalThis.String,toEquivalence:([i])=>OM(i)});return W(a.ast,{value:e})}var SV=fn("effect/schema/Redacted",yV,({annotations:e,payload:t,typeParameters:n})=>{let r=bh(n[0],t??void 0);return e===void 0?r:r.annotate(e)});function EV(e,t){return re(bh(dn(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:de(n=>Zo(n,{label:t?.label})),encode:t?.disallowEncode?KS(n=>"Cannot encode Redacted"+(we(n)&&typeof n.value.label=="string"?` with label: "${n.value.label}"`:"")):de(Gs)})(e)}function dh(e,t){let n=Tn()([e,t],([r,o])=>(s,a,i)=>{if(!yk(s))return k(new Ye(a,s,i));switch(s._tag){case"Fail":return kt(ft(r)(s.error,i),{onSuccess:dp,onFailure:c=>Sn(a,"error",c,s,i)});case"Die":return kt(ft(o)(s.defect,i),{onSuccess:pp,onFailure:c=>Sn(a,"defect",c,s,i)});case"Interrupt":return b(s)}},{representation:{id:"effect/schema/CauseReason",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.CauseReason(${r[0].runtime}, ${r[1].runtime})`,Type:`Cause.Failure<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause.Failure",toCodec:([r,o])=>Le()(Xe([G({_tag:$e("Fail"),error:r}),G({_tag:$e("Die"),defect:o}),G({_tag:$e("Interrupt"),fiberId:Sh(vn)})]),Ke({decode:s=>{switch(s._tag){case"Fail":return dp(s.error);case"Die":return pp(s.defect);case"Interrupt":return mp(s.fiberId)}},encode:F})),toArbitrary:([r,o])=>s1(r,o),toEquivalence:([r,o])=>a1(r,o),toFormatter:([r,o])=>i1(r,o)});return W(n.ast,{error:e,defect:t})}var bV=fn("effect/schema/CauseReason",Ie,({annotations:e,typeParameters:t})=>{let n=dh(t[0],t[1]);return e===void 0?n:n.annotate(e)});function s1(e,t){return(n,r)=>{let o=n.constant(mp()),s=n.oneof(o,n.integer({min:1}).map(mp),e.arbitrary.map(a=>dp(a)),t.arbitrary.map(a=>pp(a)));return oi(n,r,o,s)}}function a1(e,t){return(n,r)=>{if(n._tag!==r._tag)return!1;switch(n._tag){case"Fail":return e(n.error,r.error);case"Die":return t(n.defect,r.defect);case"Interrupt":return n.fiberId===r.fiberId}}}function i1(e,t){return n=>{switch(n._tag){case"Fail":return`Fail(${e(n.error)})`;case"Die":return`Die(${t(n.defect)})`;case"Interrupt":return"Interrupt"}}}function ph(e,t){let n=Tn()([e,t],([r,o])=>{let s=Oe(dh(r,o));return(a,i,c)=>xk(a)?kt(ft(s)(a.reasons,c),{onSuccess:Gi,onFailure:u=>Sn(i,"failures",u,a,c)}):k(new Ye(i,a,c))},{representation:{id:"effect/schema/Cause",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Cause(${r[0].runtime}, ${r[1].runtime})`,Type:`Cause.Cause<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause",toCodec:([r,o])=>Le()(Oe(dh(r,o)),Ke({decode:Gi,encode:({reasons:s})=>s})),toArbitrary:([r,o])=>c1(r,o),toEquivalence:([r,o])=>u1(r,o),toFormatter:([r,o])=>f1(r,o)});return W(n.ast,{error:e,defect:t})}var wV=fn("effect/schema/Cause",Ie,({annotations:e,typeParameters:t})=>{let n=ph(t[0],t[1]);return e===void 0?n:n.annotate(e)});function c1(e,t){return(n,r)=>{let o=s1(e,t)(n,r),s=n.constant(Sk),a=n.array(o.arbitrary).map(Gi);return oi(n,r,s,a)}}function u1(e,t){let n=kv(a1(e,t));return(r,o)=>n(r.reasons,o.reasons)}function f1(e,t){let n=i1(e,t);return r=>`Cause([${r.reasons.map(n).join(", ")}])`}var IV=dr(e=>{if(!jt(e))return!1;let t=globalThis.Object.keys(e);return t.length>0&&t.every(n=>(n==="includeStack"||n==="excludeCause")&&e[n]===!0)}),vV=Xe([Ie,IV]),l1=e=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),d1=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},$M=[];function p1(e){let t=l1(e),n=$M[t];if(n!==void 0)return n;let r=d1(t),o=Vs(globalThis.Error,{representation:{id:"effect/schema/Error",payload:r??null},toCode:()=>({runtime:r!==void 0?`Schema.ErrorInstance(${D(r)})`:"Schema.ErrorInstance()",Type:"globalThis.Error"}),expected:"Error",toCodecJson:()=>Le()(hJ,uP(r)),toArbitrary:()=>s=>s.string().map(a=>new globalThis.Error(a))});return $M[t]=o,o}var CV=fn("effect/schema/Error",vV,({annotations:e,payload:t})=>{let n=p1(t??void 0);return e===void 0?n:n.annotate(e)}),UM=[];function mw(e){let t=l1(e),n=UM[t];if(n!==void 0)return n;let r=Ll.pipe(re(nw,fP(d1(t))));return UM[t]=r,r}function m1(e,t,n){let r=Tn()([e,t,n],([o,s,a])=>{let i=ph(s,a);return(c,u,f)=>{if(!Ik(c))return k(new Ye(u,c,f));switch(c._tag){case"Success":return kt(ft(o)(c.value,f),{onSuccess:Ir,onFailure:l=>Sn(u,"value",l,c,f)});case"Failure":return kt(ft(i)(c.cause,f),{onSuccess:er,onFailure:l=>Sn(u,"cause",l,c,f)})}}},{representation:{id:"effect/schema/Exit",payload:null},toCode:({typeParameters:o})=>({runtime:`Schema.Exit(${o[0].runtime}, ${o[1].runtime}, ${o[2].runtime})`,Type:`Exit.Exit<${o[0].Type}, ${o[1].Type}, ${o[2].Type}>`,importDeclarations:['import * as Exit from "effect/Exit"']}),expected:"Exit",toCodec:([o,s,a])=>Le()(Xe([G({_tag:$e("Success"),value:o}),G({_tag:$e("Failure"),cause:ph(s,a)})]),Ke({decode:i=>i._tag==="Success"?Ir(i.value):er(i.cause),encode:i=>ht(i)?{_tag:"Success",value:i.value}:{_tag:"Failure",cause:i.cause}})),toArbitrary:([o,s,a])=>(i,c)=>{let u=c1(s,a)(i,c),f=h1(i,o.terminal?.map(d=>Ir(d)),u.terminal?.map(d=>er(d))),l=i.oneof(o.arbitrary.map(d=>Ir(d)),u.arbitrary.map(d=>er(d)));return oi(i,c,f,l)},toEquivalence:([o,s,a])=>{let i=u1(s,a);return(c,u)=>{if(c._tag!==u._tag)return!1;switch(c._tag){case"Success":return o(c.value,u.value);case"Failure":return i(c.cause,u.cause)}}},toFormatter:([o,s,a])=>{let i=f1(s,a);return c=>{switch(c._tag){case"Success":return`Exit.Success(${o(c.value)})`;case"Failure":return`Exit.Failure(${i(c.cause)})`}}}});return W(r.ast,{value:e,error:t,defect:n})}var TV=fn("effect/schema/Exit",Ie,({annotations:e,typeParameters:t})=>{let n=m1(t[0],t[1],t[2]);return e===void 0?n:n.annotate(e)});function h1(e,t,n){return t===void 0?n:n===void 0?t:e.oneof(t,n)}function oi(e,t,n,r){return{arbitrary:n===void 0||t.recursion===void 0?r:e.oneof(t.recursion,n,r),terminal:n}}function LM(e,t,n,r){return r===void 0?e.array(t,n):e.uniqueArray(t,{...n,comparator:r})}function wh(e,t,n,r,o,s){let a=t.constraint,i=a===void 0||a.minLength===void 0&&a.maxLength===void 0?void 0:{...a.minLength!==void 0?{minLength:a.minLength}:{},...a.maxLength!==void 0?{maxLength:a.maxLength}:{}};if(i?.minLength!==void 0&&i.maxLength!==void 0&&i.minLength>i.maxLength)throw new globalThis.Error("Unable to derive an arbitrary for size constraints");let c=i?.minLength??0,u=c===0?e.constant([]):r===void 0?void 0:LM(e,r,{...i,maxLength:c},s),f=oi(e,t,u,LM(e,n,i,s));return{arbitrary:f.arbitrary.map(o),terminal:f.terminal?.map(o)}}function g1(e,t,n,r,o){return wh(e,t,e.tuple(n.arbitrary,r.arbitrary),n.terminal===void 0||r.terminal===void 0?void 0:e.tuple(n.terminal,r.terminal),o,([s],[a])=>K(s,a))}function x1(e,t){let n=Tn()([e,t],([r,o])=>{let s=Oe(Uc([r,o]));return(a,i,c)=>a instanceof globalThis.Map?kt(ft(s)([...a],c),{onSuccess:u=>new globalThis.Map(u),onFailure:u=>Sn(i,"entries",u,a,c)}):k(new Ye(i,a,c))},{representation:{id:"effect/schema/ReadonlyMap",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.ReadonlyMap(${r[0].runtime}, ${r[1].runtime})`,Type:`globalThis.ReadonlyMap<${r[0].Type}, ${r[1].Type}>`}),expected:"ReadonlyMap",toCodec:([r,o])=>Le()(Oe(Uc([r,o])),Ke({decode:s=>new globalThis.Map(s),encode:s=>[...s.entries()]})),toArbitrary:([r,o])=>(s,a)=>g1(s,a,r,o,i=>new globalThis.Map(i)),toEquivalence:([r,o])=>ld(r,o),toFormatter:([r,o])=>s=>{let a=s.size;if(a===0)return"ReadonlyMap(0) {}";let i=globalThis.Array.from(s.entries()).sort().map(([c,u])=>`${r(c)} => ${o(u)}`);return`ReadonlyMap(${a}) { ${i.join(", ")} }`}});return W(n.ast,{key:e,value:t})}var kV=fn("effect/schema/ReadonlyMap",Ie,({annotations:e,typeParameters:t})=>{let n=x1(t[0],t[1]);return e===void 0?n:n.annotate(e)});function jM(e,t,n){return G({type:$e(e),nodes:Oe(G({index:Lt,data:t})),edges:Oe(G({index:Lt,source:Lt,target:Lt,data:n}))})}function BM(e,t){let n=-1,r=new Set;for(let o=0;o<e.nodes.length;o++){let s=e.nodes[o].index;if(s<=n)return k(new ct(["nodes",o,"index"],new fe({expected:"a strictly increasing node index"},s,t)));n=s,r.add(s)}n=-1;for(let o=0;o<e.edges.length;o++){let s=e.edges[o];if(s.index<=n)return k(new ct(["edges",o,"index"],new fe({expected:"a strictly increasing edge index"},s.index,t)));if(n=s.index,!r.has(s.source))return k(new ct(["edges",o,"source"],new fe({expected:"an encoded node index"},s.source,t)));if(!r.has(s.target))return k(new ct(["edges",o,"target"],new fe({expected:"an encoded node index"},s.target,t)))}return b(il(e))}function OV(e,t,n){return!Sb(e)||e.mutable||e.type!==t?k(new fe({expected:`an immutable ${t} Graph`},e,n)):b(al(e))}function AV(e,t){return(n,r)=>{let o=al(n),s=al(r);if(o.type!==s.type||o.nodes.length!==s.nodes.length||o.edges.length!==s.edges.length)return!1;for(let a=0;a<o.nodes.length;a++)if(o.nodes[a].index!==s.nodes[a].index||!e(o.nodes[a].data,s.nodes[a].data))return!1;for(let a=0;a<o.edges.length;a++){let i=o.edges[a],c=s.edges[a],u=o.type==="directed"?i.source===c.source&&i.target===c.target:i.source===c.source&&i.target===c.target||i.source===c.target&&i.target===c.source;if(i.index!==c.index||!u||!t(i.data,c.data))return!1}return!0}}function _V(e,t,n){return(r,o)=>{let s=il({type:e,nodes:[],edges:[]}),a=r.constant(s),i=r.array(t.arbitrary).chain(c=>{let u=c.map((l,d)=>({index:d,data:l}));if(u.length===0)return a;let f=r.integer({min:0,max:u.length-1});return r.array(r.tuple(f,f,n.arbitrary)).map(l=>il({type:e,nodes:u,edges:l.map(([d,m,g],S)=>({index:S,source:d,target:m,data:g}))}))});return oi(r,o,a,i)}}function y1(e,t,n){let r=Tn()([t,n],([o,s])=>{let a=jM(e,o,s);return(i,c,u)=>!Sb(i)||i.mutable||i.type!==e?k(new Ye(c,i,u)):J(ft(a)(al(i),u),f=>BM(f,u))},{representation:{id:"effect/schema/Graph",payload:e},toCode:({typeParameters:o})=>({runtime:`Schema.Graph(${D(e)}, ${o[0].runtime}, ${o[1].runtime})`,Type:`Graph.Graph<${o[0].Type}, ${o[1].Type}, ${D(e)}>`,importDeclarations:['import * as Graph from "effect/Graph"']}),expected:`an immutable ${e} Graph`,toCodec:([o,s])=>Le()(jM(e,o,s),Hn({decode:BM,encode:(a,i)=>OV(a,e,i)})),toArbitrary:([o,s])=>_V(e,o,s),toEquivalence:([o,s])=>AV(o,s),toFormatter:()=>globalThis.String});return W(r.ast,{type:e,node:t,edge:n})}var PV=fn("effect/schema/Graph",es(["directed","undirected"]),({annotations:e,payload:t,typeParameters:n})=>{let r=y1(t,n[0],n[1]);return e===void 0?r:r.annotate(e)});function S1(e,t){let n=Tn()([e,t],([r,o])=>{let s=Oe(Uc([r,o]));return(a,i,c)=>oF(a)?kt(ft(s)(Zm(a),c),{onSuccess:Jm,onFailure:u=>Sn(i,"entries",u,a,c)}):k(new Ye(i,a,c))},{representation:{id:"effect/schema/HashMap",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.HashMap(${r[0].runtime}, ${r[1].runtime})`,Type:`HashMap.HashMap<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as HashMap from "effect/HashMap"']}),expected:"HashMap",toCodec:([r,o])=>Le()(Oe(Uc([r,o])),Ke({decode:Jm,encode:Zm})),toArbitrary:([r,o])=>(s,a)=>g1(s,a,r,o,Jm),toEquivalence:([r,o])=>ld(r,o),toFormatter:([r,o])=>s=>{let a=sF(s);if(a===0)return"HashMap(0) {}";let i=Zm(s).sort().map(([c,u])=>`${r(c)} => ${o(u)}`);return`HashMap(${a}) { ${i.join(", ")} }`}});return W(n.ast,{key:e,value:t})}var RV=fn("effect/schema/HashMap",Ie,({annotations:e,typeParameters:t})=>{let n=S1(t[0],t[1]);return e===void 0?n:n.annotate(e)});function E1(e){let t=Tn()([e],([n])=>{let r=Oe(n);return(o,s,a)=>o instanceof globalThis.Set?kt(ft(r)([...o],a),{onSuccess:i=>new globalThis.Set(i),onFailure:i=>Sn(s,"values",i,o,a)}):k(new Ye(s,o,a))},{representation:{id:"effect/schema/ReadonlySet",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.ReadonlySet(${n[0].runtime})`,Type:`globalThis.ReadonlySet<${n[0].Type}>`}),expected:"ReadonlySet",toCodec:([n])=>Le()(Oe(n),Ke({decode:r=>new globalThis.Set(r),encode:r=>[...r.values()]})),toArbitrary:([n])=>(r,o)=>wh(r,o,n.arbitrary,n.terminal,s=>new globalThis.Set(s),K),toEquivalence:([n])=>dd(n),toFormatter:([n])=>r=>{let o=r.size;if(o===0)return"ReadonlySet(0) {}";let s=globalThis.Array.from(r.values()).sort().map(a=>`${n(a)}`);return`ReadonlySet(${o}) { ${s.join(", ")} }`}});return W(t.ast,{value:e})}var FV=fn("effect/schema/ReadonlySet",Ie,({annotations:e,typeParameters:t})=>{let n=E1(t[0]);return e===void 0?n:n.annotate(e)});function b1(e){let t=Tn()([e],([n])=>{let r=Oe(n);return(o,s,a)=>fF(o)?kt(ft(r)(St(o),a),{onSuccess:Qm,onFailure:i=>Sn(s,"values",i,o,a)}):k(new Ye(s,o,a))},{representation:{id:"effect/schema/HashSet",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.HashSet(${n[0].runtime})`,Type:`HashSet.HashSet<${n[0].Type}>`}),expected:"HashSet",toCodec:([n])=>Le()(Oe(n),Ke({decode:Qm,encode:St})),toArbitrary:([n])=>(r,o)=>wh(r,o,n.arbitrary,n.terminal,Qm,K),toEquivalence:([n])=>dd(n),toFormatter:([n])=>r=>{let o=lF(r);if(o===0)return"HashSet(0) {}";let s=globalThis.Array.from(r).sort().map(a=>`${n(a)}`);return`HashSet(${o}) { ${s.join(", ")} }`}});return W(t.ast,{value:e})}var MV=fn("effect/schema/HashSet",Ie,({annotations:e,typeParameters:t})=>{let n=b1(t[0]);return e===void 0?n:n.annotate(e)});function w1(e){let t=Tn()([e],([n])=>{let r=Oe(n);return(o,s,a)=>zp(o)?kt(ft(r)(St(o),a),{onSuccess:Wp,onFailure:i=>Sn(s,"values",i,o,a)}):k(new Ye(s,o,a))},{representation:{id:"effect/schema/Chunk",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Chunk(${n[0].runtime})`,Type:`Chunk.Chunk<${n[0].Type}>`}),expected:"Chunk",toCodec:([n])=>Le()(Oe(n),Ke({decode:Wp,encode:St})),toArbitrary:([n])=>(r,o)=>wh(r,o,n.arbitrary,n.terminal,Wp),toEquivalence:([n])=>hS(n),toFormatter:([n])=>r=>{let o=nA(r);if(o===0)return"Chunk(0) {}";let s=globalThis.Array.from(r).sort().map(a=>`${n(a)}`);return`Chunk(${o}) { ${s.join(", ")} }`}});return W(t.ast,{value:e})}var NV=fn("effect/schema/Chunk",Ie,({annotations:e,typeParameters:t})=>{let n=w1(t[0]);return e===void 0?n:n.annotate(e)}),I1=Vs(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>Le()(G({source:H,flags:H}),Hn({decode:(e,t)=>gt({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new fe({expected:"valid RegExp source and flags"},e,t)}),encode:e=>b({source:e.source,flags:e.flags})})),toArbitrary:()=>e=>e.tuple(e.constantFrom(".",".*","\\d+","\\w+","[a-z]+","[A-Z]+","[0-9]+","^[a-zA-Z0-9]+$","^\\d{4}-\\d{2}-\\d{2}$"),e.uniqueArray(e.constantFrom("g","i","m","s","u","y"),{minLength:0,maxLength:6}).map(t=>t.join(""))).map(([t,n])=>new globalThis.RegExp(t,n)),toEquivalence:()=>(e,t)=>e.source===t.source&&e.flags===t.flags}),DV=Kt("effect/schema/RegExp",I1),v1=H.annotate({expected:"a string that will be decoded as a URL"}),Ih=Vs(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>Le()(v1,iE),toArbitrary:()=>e=>e.webUrl().map(t=>new globalThis.URL(t)),toEquivalence:()=>(e,t)=>e.toString()===t.toString()}),$V=Kt("effect/schema/URL",Ih),UV=v1.pipe(re(Ih,iE));function hw(e,t,n){let r={...t};if(e?.minimum!==void 0){let o=n===void 0?e.minimum:n(e.minimum),s=e.exclusiveMinimum?new globalThis.Date(o.getTime()+1):o;(r.min===void 0||s.getTime()>r.min.getTime())&&(r.min=s)}if(e?.maximum!==void 0){let o=n===void 0?e.maximum:n(e.maximum),s=e.exclusiveMaximum?new globalThis.Date(o.getTime()-1):o;(r.max===void 0||s.getTime()<r.max.getTime())&&(r.max=s)}return r}var C1=H.annotate({expected:"a string that will be decoded as a Date"}),Cn=dr(e=>e instanceof globalThis.Date&&!globalThis.Number.isNaN(e.getTime()),{representation:{id:"effect/schema/Date",payload:null},toCode:()=>({runtime:"Schema.Date",Type:"globalThis.Date"}),expected:"a valid Date",toCodecJson:()=>Le()(C1,aE),toArbitrary:()=>(e,t)=>e.date(hw(t?.constraint?.ordered?.order===fa?t.constraint.ordered:void 0,{noInvalidDate:!0}))}),LV=Kt("effect/schema/Date",Cn),jV=C1.pipe(re(Cn,aE)),BV=fo.pipe(re(Cn,nP)),Ml=dr(Gg,{representation:{id:"effect/schema/Duration",payload:null},toCode:()=>({runtime:"Schema.Duration",Type:"Duration.Duration",importDeclarations:['import * as Duration from "effect/Duration"']}),expected:"Duration",toCodecJson:()=>Le()(Xe([G({_tag:$e("Infinity")}),G({_tag:$e("NegativeInfinity")}),G({_tag:$e("Nanos"),value:uo}),G({_tag:$e("Millis"),value:fo})]),Ke({decode:e=>{switch(e._tag){case"Infinity":return Io;case"NegativeInfinity":return xa;case"Nanos":return Xn(e.value);case"Millis":return hs(e.value)}},encode:e=>{switch(e.value._tag){case"Infinity":return{_tag:"Infinity"};case"NegativeInfinity":return{_tag:"NegativeInfinity"};case"Nanos":return{_tag:"Nanos",value:e.value.nanos};case"Millis":return{_tag:"Millis",value:e.value.millis}}}})),toArbitrary:()=>e=>e.oneof(e.constant(Io),e.constant(xa),e.bigInt().map(Xn),e.maxSafeInteger().map(hs)),toFormatter:()=>globalThis.String,toEquivalence:()=>Kg}),qV=Kt("effect/schema/Duration",Ml),zV=H.annotate({expected:"a string that will be decoded as a Duration"}),T1=zV.pipe(re(Ml,rP)),WV=uo.pipe(re(Ml,oP)),HV=Tl.pipe(re(Ml,sP)),k1=H.annotate({expected:"a string that will be decoded as a BigDecimal"}),O1=20,A1="Unable to derive an arbitrary for the ordered BigDecimal constraints";function mh(e,t){return js(e,t).value}function GV(e,t,n){return n?mh(oE(e,t),t)+globalThis.BigInt(1):mh(rE(e,t),t)}function KV(e,t,n){return n?mh(rE(e,t),t)-globalThis.BigInt(1):mh(oE(e,t),t)}function VV(e){return Math.max(O1,e.minimum?.scale??0,e.maximum?.scale??0,e.exclusiveMinimum&&e.minimum!==void 0?e.minimum.scale+1:0,e.exclusiveMaximum&&e.maximum!==void 0?e.maximum.scale+1:0)}function Qb(e,t){let n={};if(e.minimum!==void 0&&(n.min=GV(e.minimum,t,e.exclusiveMinimum===!0)),e.maximum!==void 0&&(n.max=KV(e.maximum,t,e.exclusiveMaximum===!0)),!(n.min!==void 0&&n.max!==void 0&&n.min>n.max))return n}function JV(e){let t=VV(e);if(Qb(e,t)===void 0)throw new globalThis.Error(A1);let n=0,r=t;for(;n<r;){let o=n+Math.floor((r-n)/2);Qb(e,o)===void 0?n=o+1:r=o}return{min:n,max:t}}var gw=dr(hm,{representation:{id:"effect/schema/BigDecimal",payload:null},toCode:()=>({runtime:"Schema.BigDecimal",Type:"BigDecimal.BigDecimal",importDeclarations:['import * as BigDecimal from "effect/BigDecimal"']}),expected:"BigDecimal",toCodecJson:()=>Le()(k1,cE),toArbitrary:()=>(e,t)=>{let n=t.constraint?.ordered?.order===Go?t.constraint.ordered:void 0;return n===void 0?e.tuple(e.bigInt(),e.integer({min:0,max:O1})).map(([r,o])=>bn(r,o)):e.integer(JV(n)).chain(r=>{let o=Qb(n,r);if(o===void 0)throw new globalThis.Error(A1);return e.bigInt(o).map(s=>bn(s,r))})},toFormatter:()=>e=>oo(e),toEquivalence:()=>tE}),ZV=Kt("effect/schema/BigDecimal",gw),YV=k1.pipe(re(gw,cE)),QV=H.annotate({expected:"a string that will be decoded as JSON",contentMediaType:"application/json"});function _1(e,t){return QV.pipe(re(e,EP(t)))}var XV=_1(nw),xw=Vs(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>Le()(G({data:H.check(uw()),type:H,name:H,lastModified:fo}),Hn({decode:(e,t)=>Qn(Ni(e.data),{onFailure:()=>k(new fe({expected:"a valid Base64 string"},e.data,t)),onSuccess:n=>{let r=new globalThis.Uint8Array(n);return b(new globalThis.File([r],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>Xi({try:async()=>{let n=new globalThis.Uint8Array(await e.arrayBuffer());return{data:Rd(n),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new fe({expected:"a readable File"},e,t)})}))}),e4=Kt("effect/schema/File",xw),yw=Vs(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>Le()(Oe(Uc([H,Xe([G({_tag:Qo("String"),value:H}),G({_tag:Qo("File"),value:xw})])])),Hn({decode:e=>{let t=new globalThis.FormData;for(let[n,r]of e)t.append(n,r.value);return b(t)},encode:e=>b(globalThis.Array.from(e.entries()).map(([t,n])=>typeof n=="string"?[t,{_tag:"String",value:n}]:[t,{_tag:"File",value:n}]))}))}),t4=Kt("effect/schema/FormData",yw);function n4(e){return yw.pipe(re(e,bP))}var Sw=Vs(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>Le()(H.annotate({expected:"a query string that will be decoded as URLSearchParams"}),Ke({decode:e=>new globalThis.URLSearchParams(e),encode:e=>e.toString()}))}),r4=Kt("effect/schema/URLSearchParams",Sw);function o4(e){return Sw.pipe(re(e,wP))}var s4=H.annotate({expected:"a string that will be decoded as a number"}).pipe(re(Tl,Sc)),a4=H.annotate({expected:"a string that will be decoded as a finite number"}).pipe(re(vn,Sc)),i4=W(JE).pipe(re(uo,ym)),P1=H.check(cw()),c4=H.annotate({expected:"a string that will be decoded as a trimmed string"}).pipe(re(P1,tP())),u4=H.annotate({expected:"a base64 encoded string that will be decoded as a UTF-8 string"}).pipe(re(H,gP)),f4=H.annotate({expected:"a base64 (URL) encoded string that will be decoded as a UTF-8 string"}).pipe(re(H,xP)),l4=H.annotate({expected:"a hex encoded string that will be decoded as a UTF-8 string"}).pipe(re(H,yP)),d4=H.annotate({expected:"a URI component encoded string that will be decoded as a UTF-8 string"}).pipe(re(H,SP)),Xb=Xe([vn,oN,H]),p4=G({issues:Oe(G({message:H,path:ln(Oe(Xe([Xb,G({key:Xb})])))}))}),m4=es([0,1]).pipe(re(xh,Ke({decode:e=>e===1,encode:e=>e?1:0}))),R1=H.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),Nl=Vs(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>Le()(R1,uE),toArbitrary:()=>e=>e.uint8Array()}),h4=Kt("effect/schema/Uint8Array",Nl),g4=R1.pipe(re(Nl,uE)),x4=H.annotate({expected:"a base64 (URL) encoded string that will be decoded as a Uint8Array"}).pipe(re(Nl,{decode:N_(),encode:lm()})),y4=H.annotate({expected:"a hex encoded string that will be decoded as a Uint8Array"}).pipe(re(Nl,{decode:$_(),encode:dm()})),Dl=dr(e=>zS(e)&&y_(e),{representation:{id:"effect/schema/DateTimeUtc",payload:null},toCode:()=>({runtime:"Schema.DateTimeUtc",Type:"DateTime.Utc",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Utc",toCodecJson:()=>Le()(H,dE),toArbitrary:()=>(e,t)=>e.date(hw(t?.constraint?.ordered?.order===HS?t.constraint.ordered:void 0,{noInvalidDate:!0},am)).map(n=>E_(n)),toFormatter:()=>e=>e.toString(),toEquivalence:()=>WS}),S4=Kt("effect/schema/DateTimeUtc",Dl),E4=Cn.pipe(re(Dl,{decode:QS(),encode:de(am)})),b4=H.annotate({expected:"a string that will be decoded as a DateTime.Utc"}).pipe(re(Dl,dE)),w4=fo.pipe(re(Dl,{decode:QS(),encode:de(C_)})),F1=dr(g_,{representation:{id:"effect/schema/TimeZoneOffset",payload:null},toCode:()=>({runtime:"Schema.TimeZoneOffset",Type:"DateTime.TimeZone.Offset",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone.Offset",toCodecJson:()=>Le()(fo,IP),toArbitrary:()=>e=>e.integer({min:-720*60*1e3,max:840*60*1e3}).map(t=>qf(t)),toFormatter:()=>e=>Us(e),toEquivalence:()=>(e,t)=>e.offset===t.offset}),I4=Kt("effect/schema/TimeZoneOffset",F1),M1=H.annotate({expected:"an IANA time zone identifier"}),Ew=dr(x_,{representation:{id:"effect/schema/TimeZoneNamed",payload:null},toCode:()=>({runtime:"Schema.TimeZoneNamed",Type:"DateTime.TimeZone.Named",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone.Named",toCodecJson:()=>Le()(M1,fE),toArbitrary:()=>e=>e.constantFrom(...["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"].map(GS)),toFormatter:()=>e=>Us(e),toEquivalence:()=>(e,t)=>e.id===t.id}),v4=Kt("effect/schema/TimeZoneNamed",Ew),C4=M1.pipe(re(Ew,fE)),N1=H.annotate({expected:"a time zone string (IANA identifier or offset like +03:00)"}),bw=dr(h_,{representation:{id:"effect/schema/TimeZone",payload:null},toCode:()=>({runtime:"Schema.TimeZone",Type:"DateTime.TimeZone",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone",toCodecJson:()=>Le()(N1,lE),toArbitrary:()=>e=>e.oneof(e.integer({min:-720*60*1e3,max:840*60*1e3}).map(t=>qf(t)),e.constantFrom(...["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"].map(GS))),toFormatter:()=>e=>Us(e),toEquivalence:()=>(e,t)=>Us(e)===Us(t)}),T4=Kt("effect/schema/TimeZone",bw),k4=N1.pipe(re(bw,lE)),D1=H.annotate({expected:"a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])"}),ww=dr(e=>zS(e)&&S_(e),{representation:{id:"effect/schema/DateTimeZoned",payload:null},toCode:()=>({runtime:"Schema.DateTimeZoned",Type:"DateTime.Zoned",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Zoned",toCodecJson:()=>Le()(D1,pE),toArbitrary:()=>(e,t)=>e.tuple(e.date(hw(t?.constraint?.ordered?.order===HS?t.constraint.ordered:void 0,{max:new globalThis.Date(864e13-840*60*1e3),min:new globalThis.Date(-864e13+840*60*1e3),noInvalidDate:!0},am)),e.constantFrom("UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney")).map(([n,r])=>b_(n,{timeZone:r})),toFormatter:()=>e=>im(e),toEquivalence:()=>WS}),O4=Kt("effect/schema/DateTimeZoned",ww),A4=D1.pipe(re(ww,pE)),_4=globalThis.Symbol.for("immer-draftable"),ew={};function Iw(e,t,n,r,o){let s=R4(n,t,r),a=$1(t),i=class extends e{constructor(...[c,u]){let l=u?.["~payload"],d=l?.token===ew?l.value:n.make(c??{},u);super(d,{...u,disableChecks:!0,"~payload":{token:ew,value:d}})}static[wl]=wl;get[a](){return a}static[_4]=!0;static identifier=t;static fields=n.fields;static get ast(){return s(this).ast}static pipe(){return ne(this,arguments)}static rebuild(c){return s(this).rebuild(c)}static make(c,u){return new this(c,u)}static makeOption(c,u){return eh(s(this))(c??{},u)}static makeEffect(c,u){return s(this).makeEffect(c??{},u)}static annotate(c){return this.rebuild(ur(this.ast,c))}static annotateKey(c){return this.rebuild(tl(this.ast,c))}static check(...c){return this.rebuild(ao(this.ast,c))}static extend(c){return(u,f)=>{let l=$l(u)?u:G(u),d={...n.fields,...l.fields},m=km(d,n.ast.checks,{identifier:c});return Iw(this,c,ow(ao(m,l.ast.checks),d),f,o)}}static mapFields(c,u){return n.mapFields(c,u)}};return o!==void 0&&Object.assign(i.prototype,o(t)),i}function P4(e){return new be(de(t=>new e(t,{"~payload":{token:ew,value:t}})),Ar())}function $1(e){return`~effect/Schema/Class/${e}`}function R4(e,t,n){let r;return o=>{if(r!==void 0)return r;let s=$1(t),a=u=>u instanceof o||_(u,s),i=P4(o),c=W(new Ba([e.ast],()=>(u,f,l)=>a(u)?b(u):k(new Ye(f,u,l)),{identifier:t,[Qp]:([u])=>({isConstructed:a,link:new Qe(u,i)}),toCodec:([u])=>new Qe(u.ast,i),toArbitrary:([u])=>()=>({arbitrary:u.arbitrary.map(f=>new o(f)),terminal:u.terminal?.map(f=>new o(f))}),toFormatter:([u])=>f=>`${o.identifier}(${u(f)})`,[Df]:wc(e.ast),...n}));return r=re(c,i)(e)}}function $l(e){return gh(e)}var U1=e=>(t,n)=>{let r=$l(t)?t:G(t);return Iw(_d,e,r,n,o=>({toString(){return`${o}(${D({...this})})`}}))},F4=e=>(t,n,r)=>{let o=$l(n)?n.mapFields(s=>({_tag:Qo(t),...s}),{unsafePreserveChecks:!0}):Eh(t,n);return U1(e??t)(o,r)},vh=e=>(t,n)=>{let r=$l(t)?t:G(t);return Iw(bu,e,r,n,s=>({name:s}))},$r=e=>(t,n,r)=>{let o=$l(n)?n.mapFields(s=>({_tag:Qo(t),...s}),{unsafePreserveChecks:!0}):Eh(t,n);return vh(e??t)(o,r)};function M4(e){let t=eM(e.ast);return n=>t(n,{})}function N4(e){return t=>t.annotate({toFormatter:e})}function D4(e,t){return n(e.ast);function n(o){let s=ro(o)?.toFormatter;if(typeof s=="function")return s(qs(o)?o.typeParameters.map(n):[]);if(t?.onBefore){let a=t.onBefore(o,n);if(a!==void 0)return a}return r(o)}function r(o){switch(o._tag){default:return D;case"Never":return()=>"never";case"Void":return()=>"void";case"Arrays":{let s=o.elements.map(n),a=o.rest.map(n);return i=>{let c=[],u=0;for(;u<s.length;u++)if(i.length<u+1){if(ut(o.elements[u]))continue}else c.push(s[u](i[u]));if(a.length>0){let[f,...l]=a;for(;u<i.length-l.length;u++)c.push(f(i[u]));for(let d=0;d<l.length;d++)c.push(l[d](i[u+d]))}return"["+c.join(", ")+"]"}}case"Objects":{let s=o.propertySignatures.map(i=>n(i.type)),a=o.indexSignatures.map(i=>n(i.type));return o.propertySignatures.length===0&&o.indexSignatures.length===0?D:i=>{let c=[],u=new Set;for(let f=0;f<s.length;f++){let l=o.propertySignatures[f],d=l.name;u.add(d),!(ut(l.type)&&!Object.hasOwn(i,d))&&c.push(`${go(d)}: ${s[f](i[d])}`)}for(let f=0;f<a.length;f++){let l=qa(i,o.indexSignatures[f].parameter);for(let d of l)u.has(d)||(u.add(d),c.push(`${go(d)}: ${a[f](i[d])}`))}return c.length>0?"{ "+c.join(", ")+" }":"{}"}}case"Union":{let s=Ut(o).types,a=c=>Zf(c,s),i=new Map(s.map((c,u)=>[c,[pl(c),n(o.types[u])]]));return c=>{let u=a(c);for(let f=0;f<u.length;f++){let[l,d]=i.get(u[f]);if(l(c))return d(c)}return D(c)}}case"Suspend":{let s=Ha(()=>n(o.thunk()));return a=>s()(a)}}}}function $4(e){return t=>t.annotate({toEquivalence:e})}function U4(e){return tM(e.ast)}function L4(e,t){return Wb(e.ast,t)}function L1(e,t){let n=Wb(Ch(e.ast),t);return gM(n,t)}function j1(e){return W(Ch(e.ast),{schema:e})}var Ch=Ga(e=>{let t=B4(e,Ch),n=e.context;return t===e||n===void 0?t:Fm(t,vw(n))});function vw(e){return e.constructorDefault===void 0?e:new cr(e.isOptional,e.isMutable,void 0,e.annotations)}function B1(e){if(e.propertySignatures.some(t=>typeof t.name!="string"))throw new globalThis.Error("Objects property names must be strings",{cause:e})}function q1(e){return t=>{let n=new Map;for(let s=0;s<t.length;s++)n.set(In(t[s]),s);let r=[...t].sort((s,a)=>{s=In(s),a=In(a);let i=e(s),c=e(a);return i!==c?i-c:n.get(s)-n.get(a)});return r.some((s,a)=>s!==t[a])?r:t}}var j4=q1(e=>{switch(e._tag){case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function B4(e,t){switch(e._tag){case"Declaration":{let n=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!_n(n))return Ue(e,[YE]);let r=e.typeParameters.map(s=>hl(In(s))),o=n(r);return o===void 0?e:Ue(e,[Cc(o,t)])}case"Unknown":return Ue(e,[YE]);case"ObjectKeyword":return Ue(e,[dR]);case"Undefined":case"Void":case"Literal":case"Number":return e.toCodecJson();case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return B1(e),e.recur(t,Dm);case"Union":{let n=j4(e.types);return n!==e.types?new un(n,e.mode,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t):e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}function z1(e){return W(W1(Ut(e.ast)))}var W1=Rt(e=>{let t=q4(e,W1);return t!==e&&e.context!==void 0?Fm(t,vw(e.context)):t});function q4(e,t){switch(e._tag){case"Declaration":{let n=e.annotations?.toCodecIso??e.annotations?.toCodec;if(_n(n)){let r=n(e.typeParameters.map(o=>hl(o)));return Ue(e,[Cc(r,t)])}return e}case"Arrays":case"Objects":case"Union":case"Suspend":return e.recur(t)}return e}function Ul(e){return W(K1(e.ast),{schema:e})}function z4(e){return W(V1(e.ast))}function W4(e,t){let n=mc(e.ast)??DS(e.ast),r=QM(Ul(e));return o=>r(o).pipe(Y(s=>H4(s,{rootName:n,...t})))}function H4(e,t){let n=t.rootName??"root",r=t.arrayItemName??"item",o=t.pretty??!0,s=t.indent??" ",a=t.sortKeys??!0,i=new Set,c=[];return f(n,e,0),c.join(o?`
|
|
35
|
-
`:"");function u(l,d){c.push(o?s.repeat(l)+d:d)}function f(l,d,m,g){let{attrs:S,safe:v}=$c.tagInfo(l,g);if(d===void 0)u(m,`<${v}${S}/>`);else if(typeof d=="string")u(m,`<${v}${S}>${$c.escapeText(d)}</${v}>`);else if(typeof d!="object"||d===null)u(m,`<${v}${S}>${$c.escapeText(D(d))}</${v}>`);else{if(i.has(d))throw new globalThis.Error("Cycle detected while serializing to XML.",{cause:d});i.add(d);try{if(globalThis.globalThis.Array.isArray(d)){if(d.length===0){u(m,`<${v}${S}/>`);return}u(m,`<${v}${S}>`);for(let y of d)f(r,y,m+1);u(m,`</${v}>`);return}let I=d,C=Object.keys(I);if(a&&C.sort(),C.length===0){u(m,`<${v}${S}/>`);return}u(m,`<${v}${S}>`);for(let y of C)f($c.parseTagName(y).safe,I[y],m+1,y);u(m,`</${v}>`)}finally{i.delete(d)}}}}var $c={escapeText(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},escapeAttribute(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},parseTagName(e){let t=e,n=e;return/^[A-Za-z_]/.test(n)||(n="_"+n),n=n.replace(/[^A-Za-z0-9._-]/g,"_"),/^xml/i.test(n)&&(n="_"+n),{safe:n,changed:n!==t}},tagInfo(e,t){let{changed:n,safe:r}=$c.parseTagName(e),s=n||t&&t!==e?` data-name="${$c.escapeAttribute(t??e)}"`:"";return{safe:r,attrs:s}}},G4=q1(e=>{switch(e._tag){case"Null":case"Boolean":case"Number":case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function K4(e,t,n){switch(e._tag){case"Declaration":{let r=e.typeParameters.map(u=>W(t(In(u)))),o=e.annotations?.toCodecStringTree;if(_n(o)){let u=o(r);return u===void 0?e:Ue(e,[Cc(u,t)])}let s=e.annotations?.toCodecJson,a=_n(s)?s(r):void 0,i=a===void 0?e.annotations?.toCodec:void 0,c=a??(_n(i)?i(r):void 0);return c===void 0?n(e):Ue(e,[Cc(c,t)])}case"Null":return Ue(e,[V4]);case"Boolean":return Ue(e,[J4]);case"Unknown":case"ObjectKeyword":return Ue(e,[QE]);case"Enum":case"Number":case"Literal":case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return B1(e),e.recur(t,Dm);case"Union":{let r=G4(e.types);return r!==e.types?new un(r,e.mode,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t):e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}var V4=new Qe(new wn("null"),new be(de(()=>null),de(()=>"null"))),J4=new Qe(new un([new wn("true"),new wn("false")],"anyOf"),new be(de(e=>e==="true"),ja())),H1=new be(de(e=>typeof e=="string"?[e]:e),Ar()),G1=e=>e.transformation===H1,K1=Ga(e=>{let t=K4(e,K1,n=>{throw new globalThis.Error("Missing structural codec for StringTree",{cause:n})});return t!==e&&e.context!==void 0?Fm(t,vw(e.context)):t},{stopAt:G1}),qM=e=>ut(e)?Tc(Ko):Ko,V1=Ga(e=>{let t=Z4(e);if(FE(t)){let n=Mm(new un([new Pr(t.isMutable,t.elements.map(qM),t.rest.map(qM)),so],"anyOf"),t,H1);return ut(e)?Tc(n):n}return t},{stopAt:G1});function Z4(e){return e._tag==="Declaration"||e._tag==="Arrays"||e._tag==="Objects"||e._tag==="Union"||e._tag==="Suspend"?e.recur(V1):e}var Y4=ae("effect/schema/isGreaterThanDate",G({exclusiveMinimum:Cn}),({annotations:e,payload:t})=>UN(t.exclusiveMinimum,e)),Q4=ae("effect/schema/isGreaterThanOrEqualToDate",G({minimum:Cn}),({annotations:e,payload:t})=>LN(t.minimum,e)),X4=ae("effect/schema/isLessThanDate",G({exclusiveMaximum:Cn}),({annotations:e,payload:t})=>jN(t.exclusiveMaximum,e)),eJ=ae("effect/schema/isLessThanOrEqualToDate",G({maximum:Cn}),({annotations:e,payload:t})=>BN(t.maximum,e)),tJ=ae("effect/schema/isBetweenDate",G({minimum:Cn,maximum:Cn,exclusiveMinimum:ln($e(!0)),exclusiveMaximum:ln($e(!0))}),({annotations:e,payload:t})=>qN(t,e)),nJ=ae("effect/schema/isGreaterThanBigInt",G({exclusiveMinimum:uo}),({annotations:e,payload:t})=>zN(t.exclusiveMinimum,e)),rJ=ae("effect/schema/isGreaterThanOrEqualToBigInt",G({minimum:uo}),({annotations:e,payload:t})=>WN(t.minimum,e)),oJ=ae("effect/schema/isLessThanBigInt",G({exclusiveMaximum:uo}),({annotations:e,payload:t})=>HN(t.exclusiveMaximum,e)),sJ=ae("effect/schema/isLessThanOrEqualToBigInt",G({maximum:uo}),({annotations:e,payload:t})=>GN(t.maximum,e)),aJ=ae("effect/schema/isBetweenBigInt",G({minimum:uo,maximum:uo,exclusiveMinimum:ln($e(!0)),exclusiveMaximum:ln($e(!0))}),({annotations:e,payload:t})=>KN(t,e));function iJ(e){let t=z1(e);return vM(Mb(t),Rb(t))}function cJ(e){return lh()}function uJ(e){return lh()}function fJ(e,t){return n=>W(ur(n.ast,{toCodecIso:()=>new Qe(e.ast,gm(t))}),{schema:n})}function lJ(e){let t=j1(e),n=Mb(t),r=Rb(t);return{empty:[],diff:(o,s)=>yM(n(o),n(s)),combine:(o,s)=>[...o,...s],patch:(o,s)=>{let a=n(o),i=SM(s,a);return Object.is(i,a)?o:r(i)}}}function dJ(e){let t=cN(()=>n),n=Xe([e,Oe(t),yh(H,t)]);return n}var Ll=W(ur(vc,{toCode:()=>({runtime:"Schema.Json",Type:"Schema.Json"})})),pJ=yh(H,Ll),mJ=Kt("effect/schema/Json",Ll),hJ=G({message:H,name:Yo(H),stack:Yo(H),cause:Yo(Ll)}),J1=W(ur(lR,{toCode:()=>({runtime:"Schema.MutableJson",Type:"Schema.MutableJson"})})),gJ=Kt("effect/schema/MutableJson",J1);function xJ(e){return ro(e.ast)}function yJ(e){return e.ast.context?.annotations}var Z1="~effect/platform/Terminal",Cw="effect/platform/Terminal/QuitError",zc=class extends vh("QuitError")({_tag:Qo("QuitError")}){[Cw]=Cw},Y1=e=>_(e,Cw),Ur=He("effect/platform/Terminal"),Q1=e=>Ur.of({...e,[Z1]:Z1});import*as kh from"node:readline";var X1=j(function*(e=tD){let t=process.stdin,n=process.stdout,r=yield*fc(),o=t.readableEnded,s=!1,a=()=>{o=!0,s||Bo(r)};t.once("end",a),yield*Up(()=>ue(()=>t.off("end",a)));let i=yield*GA({acquire:sr(ue(()=>{let m=kh.createInterface({input:t,escapeCodeTimeout:50}),g=v=>Cf(r,v),S=()=>{s=!1,Bo(r)};return s=!0,kh.emitKeypressEvents(t,m),m.on("line",g),m.once("close",S),t.isTTY&&t.setRawMode(!0),{rl:m,onClose:S,onLine:g}}),({rl:m,onClose:g,onLine:S})=>ue(()=>{s=!1,m.off("line",S),m.off("close",g),t.isTTY&&t.setRawMode(!1),m.close(),o&&Bo(r)})),idleTimeToLive:"10 millis"}),c=ue(()=>n.columns??0),u=ue(()=>n.rows??0),f=It(function*(){let m=yield*fc(),g=(I,C)=>{let y={input:ps(I),key:{name:C.name??"",ctrl:!!C.ctrl,meta:!!C.meta,shift:!!C.shift}};Cf(m,y),e(y)&&Bo(m)},S=setInterval(()=>{},2147483647),v=()=>{clearInterval(S),Bo(m)};return yield*Up(()=>ue(()=>{clearInterval(S),t.off("keypress",g),t.off("end",v)})),t.on("keypress",g),o?v():(yield*OS(i),t.once("end",v)),m}),l=Te(()=>SA(r).pipe(J(We({onNone:()=>Ps(Ln(OS(i),qo(r))),onSome:b})),pt(()=>new zc({}))));return Q1({columns:c,rows:u,readInput:f,readLine:l,display:m=>hf(Wt(g=>{n.write(m,S=>iv(S)?g(ge):g(k(Uo({module:"Terminal",method:"display",description:"Failed to write prompt to stdout",cause:S}))))}))})}),eD=Vi(Ur,X1(tD));function tD(e){return e.key.ctrl&&(e.key.name==="c"||e.key.name==="d")}var nD=eD;var rD=Uk(wR,wp(BR,MR,zR,GR,nD));function wJ(e){return{_tag:"Value",value:e}}function IJ(e,t){return{_tag:"Record",keys:e,value:t}}function vJ(e,t){return{_tag:"Array",length:e,value:t}}var oD=pe("effect/ConfigProvider",{defaultValue:()=>PJ()}),CJ={...Yt,toJSON(){return{_id:"ConfigProvider"}}},TJ=e=>e;function kJ(e,t){let n=Object.create(CJ);return n.load=e,n.mapInput=t,n}function sD(e,t){return kJ(n=>e(t(n)),n=>sD(e,sv(t,n)))}function OJ(e){return sD(e,TJ)}function AJ(e,t){return e===""&&!t?void 0:e}function _J(e,t){let n=t?.preserveEmptyStrings===!0,r=RJ(e);return OJ(o=>b(MJ(r,e,o,n)))}function PJ(e){let t=e?.env??{...globalThis.process?.env,...import.meta?.env};return _J(t,{preserveEmptyStrings:e?.preserveEmptyStrings})}function RJ(e){let t={};for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let o=n.split("_"),s=t;for(let a of o){let i=s.children??=Object.create(null);s=i[a]??={}}}return t}var FJ=/^(0|[1-9][0-9]*)$/;function MJ(e,t,n,r){let o=n.map(String).join("_"),s=AJ(Object.hasOwn(t,o)?t[o]:void 0,r),a=NJ(e,n),i=a?.children?Object.keys(a.children):[];if(i.length===0)return s===void 0?void 0:wJ(s);if(i.every(u=>FJ.test(u))){let u=Math.max(...i.map(f=>parseInt(f,10)))+1;return vJ(u,s)}return IJ(new Set(i),s)}function NJ(e,t){if(t.length===0)return e;let n=e;for(let r of t)if(n=n?.children?.[String(r)],!n)return;return n}var iD="~effect/Config";var DJ={...Kr({label:"Config",evaluate(e){return this.parse(e.getRef(oD))}}),[iD]:iD,toJSON(){return{_id:"Config"}}};function cD(e){let t=Object.create(DJ);return t.evaluator=e,t.parse=n=>e(n,[]).pipe(Ma(r=>r.error),$t(r=>r._tag==="Resolved"?b(r.value):k(r.error))),t}var uD=(e,t,n)=>e.evaluator(t,n),fD=(e,t)=>({_tag:"Resolved",value:e,hasInput:t});var $J=p(2,(e,t)=>cD((n,r)=>Y(uD(e,n,r),o=>o._tag==="Resolved"?fD(t(o.value),o.hasInput):o)));var UJ=p(2,(e,t)=>cD((n,r)=>$o(uD(e,n,r),o=>o._tag==="Absent"?fD(t,!1):o))),lD=e=>e.pipe($J(R),UJ(O()));var Tw=es(["true","yes","on","1","y"]),kw=es(["false","no","off","0","n"]),dD=es([...Tw.literals,...kw.literals]).pipe(re(xh,Ke({decode:e=>e==="true"||e==="yes"||e==="on"||e==="1"||e==="y",encode:e=>e?"true":"false"})));var ts={};jr(ts,{Console:()=>pD,assert:()=>LJ,clear:()=>jJ,consoleWith:()=>vt,count:()=>BJ,countReset:()=>qJ,debug:()=>zJ,dir:()=>WJ,dirxml:()=>HJ,error:()=>Oh,group:()=>GJ,info:()=>KJ,log:()=>Ot,table:()=>VJ,time:()=>JJ,timeLog:()=>ZJ,trace:()=>YJ,warn:()=>QJ,withGroup:()=>XJ,withTime:()=>e6});var pD=hy,vt=e=>te(t=>e(t.getRef(pD))),LJ=(e,...t)=>vt(n=>B(()=>{n.assert(e,...t)})),jJ=vt(e=>B(()=>{e.clear()})),BJ=e=>vt(t=>B(()=>{t.count(e)})),qJ=e=>vt(t=>B(()=>{t.countReset(e)})),zJ=(...e)=>vt(t=>B(()=>{t.debug(...e)})),WJ=(e,t)=>vt(n=>B(()=>{n.dir(e,t)})),HJ=(...e)=>vt(t=>B(()=>{t.dirxml(...e)})),Oh=(...e)=>vt(t=>B(()=>{t.error(...e)})),GJ=e=>vt(t=>Ia(B(()=>{e?.collapsed?t.groupCollapsed(e.label):t.group(e?.label)}),()=>B(()=>{t.groupEnd()}))),KJ=(...e)=>vt(t=>B(()=>{t.info(...e)})),Ot=(...e)=>vt(t=>B(()=>{t.log(...e)})),VJ=(e,t)=>vt(n=>B(()=>{n.table(e,t)})),JJ=e=>vt(t=>Ia(B(()=>{t.time(e)}),()=>B(()=>{t.timeEnd(e)}))),ZJ=(e,...t)=>vt(n=>B(()=>{n.timeLog(e,...t)})),YJ=(...e)=>vt(t=>B(()=>{t.trace(...e)})),QJ=(...e)=>vt(t=>B(()=>{t.warn(...e)})),XJ=p(e=>ee(e[0]),(e,t)=>vt(n=>Hu(B(()=>{t?.collapsed?n.groupCollapsed(t.label):n.group(t?.label)}),()=>e,()=>B(()=>{n.groupEnd()})))),e6=p(e=>ee(e[0]),(e,t)=>vt(n=>Hu(B(()=>{n.time(t)}),()=>e,()=>B(()=>{n.timeEnd(t)}))));var zh={};jr(zh,{atLeast:()=>rZ,atMost:()=>oZ,between:()=>sZ,choice:()=>B5,choiceWithValue:()=>iZ,date:()=>j5,directory:()=>U5,file:()=>$5,fileParse:()=>H5,fileSchema:()=>G5,fileText:()=>W5,filter:()=>uZ,filterMap:()=>fZ,float:()=>L5,integer:()=>D5,map:()=>eZ,mapEffect:()=>tZ,mapTryCatch:()=>nZ,none:()=>K5,optional:()=>V5,orElse:()=>lZ,orElseResult:()=>dZ,path:()=>q5,redacted:()=>z5,string:()=>N5,variadic:()=>X5,withDefault:()=>Z5,withDescription:()=>J5,withFallbackConfig:()=>Y5,withFallbackPrompt:()=>Q5,withMetavar:()=>cZ,withSchema:()=>aZ});var Be="~effect/cli/CliError",_w=e=>_(e,Be),Zs=class extends $r(`${Be}/UnrecognizedOption`)("UnrecognizedOption",{option:H,command:ln(Oe(H)),suggestions:Oe(H)}){[Be]=Be;get message(){let t=this.suggestions.length>0?`
|
|
8
|
+
${s(l)}}`;p=a(u,g)}}return n.delete(u),p}return String(u)}return c(e,0)}var pj="[Circular]";function Yn(e){return typeof e=="string"?JSON.stringify(e):String(e)}function xd(e){return e.map(t=>`[${Yn(t)}]`).join("")}function zx(e){try{return e.toISOString()}catch{return"Invalid Date"}}function dj(e){try{let t=e.toString();return typeof t=="string"?t:String(t)}catch{return"[toString threw]"}}function Mw(e,t){try{return e[t]}catch{return"[property access threw]"}}function Aa(e,t){let r=[];return JSON.stringify(e,function(n,o){let s=Object.getOwnPropertyDescriptor(this,n)?.value,a=A(s,ka)?Bo(s):Bo(o);if(typeof a=="bigint")return N(a);if(typeof a!="object"||a===null)return a;let i=a instanceof Error&&!A(a,"toJSON")?{...a,name:a.name,message:a.message}:a;for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(a))return;if(r.push(a),i!==a&&r.push(i),!mj(i)||hj(i))return i;let c=new Proxy(i,{get(f,u){let l=Reflect.get(f,u,f);return Object.getOwnPropertyDescriptor(f,u)?.get!==void 0?Bo(l):l}});return r.push(c),c},t?.space)??"null"}function mj(e){for(let t of Object.getOwnPropertyNames(e))if(Object.getOwnPropertyDescriptor(e,t)?.get!==void 0)return!0;return!1}function hj(e){for(let t of[Number.prototype.valueOf,Boolean.prototype.valueOf,String.prototype.valueOf])try{return Reflect.apply(t,e,[]),!0}catch{}return!1}var qe=Symbol.for("nodejs.util.inspect.custom"),vt=e=>{try{return e=Bo(e),A(e,"toJSON")&&bn(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(vt):e}catch{return"[toJSON threw]"}},Dw=(e,t=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?Aa(e,{space:t}):N(e,{space:t})}catch{return String(e)}},mt={toJSON(){return vt(this)},[qe](){return this.toJSON()},toString(){return N(this.toJSON())}},Uw=class{[qe](){return this.toJSON()}toString(){return N(this.toJSON())}};var xj=()=>{let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,"writable")?e.writable===!0:e.set!==void 0},yj=xj(),In=()=>Error.stackTraceLimit,Bt=e=>{yj&&(Error.stackTraceLimit=e)};var _s=class{constructor(t){this.value=t,this.done=!1}next(t){return this.done?(this.value=t,this):(this.done=!0,{value:this.value,done:!1})}},Sj=()=>{let e="~effect/Utils/internal",t={[e]:s=>s()},r={[e]:s=>s()},n=In();if(n===0)return r[e];Bt(2);let o=t[e](()=>new Error);return Bt(n),o.stack?.includes(e)===!0?t[e]:r[e]},Ps=Sj();function U(e,t,r){t==="__proto__"?Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}):e[t]=r}function yd(e,t){for(let r of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,r)&&U(e,r,t[r])}var ro="~effect/Effect",va="~effect/Exit",bj={_A:F,_E:F,_R:F},qx=`${ro}/identifier`,ue=`${ro}/args`,Ge=`${ro}/evaluate`,Ot=`${ro}/successCont`,Br=`${ro}/failureCont`,Oa=`${ro}/ensureCont`,Pa=Symbol.for("effect/Effect/Yield"),Xt={pipe(){return te(this,arguments)},toJSON(){return{...this}},toString(){return N(this.toJSON(),{ignoreToString:!0,space:2})},[qe](){return this.toJSON()}},Bw={[Y](){return ff(this,Object.keys(this))},[X](e){let t=Object.keys(this),r=Object.keys(e);if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==r[n]||!W(this[t[n]],e[t[n]]))return!1;return!0}},Ij={[ro]:bj,...Xt,[Symbol.iterator](){return new _s(this)},toJSON(){return{_id:"Effect",op:this[qx],...ue in this?{args:this[ue]}:void 0}}},oe=e=>A(e,ro),hf=e=>A(e,va),Sd="~effect/Cause",df="~effect/Cause/Reason",Wi=e=>A(e,Sd),jw=e=>A(e,df),eo=class{constructor(t){this[Sd]=Sd,this.reasons=t}pipe(){return te(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map(t=>t.toJSON())}}toString(){return`Cause(${N(this.reasons)})`}[qe](){return this.toJSON()}[X](t){return Wi(t)&&this.reasons.length===t.reasons.length&&this.reasons.every((r,n)=>W(r,t.reasons[n]))}[Y](){return Qn(this.reasons)}},Lw=new WeakMap,qi=class{[df];annotations;_tag;constructor(t,r,n){if(this[df]=df,this._tag=t,r!==gf&&typeof n=="object"&&n!==null&&r.size>0){let o=Lw.get(n);o&&(r=new Map([...o,...r])),Lw.set(n,r)}this.annotations=r}annotate(t,r){if(t.mapUnsafe.size===0)return this;let n=new Map(this.annotations);t.mapUnsafe.forEach((s,a)=>{r?.overwrite!==!0&&n.has(a)||n.set(a,s)});let o=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return o.annotations=n,o}pipe(){return te(this,arguments)}toString(){return N(this)}[qe](){return this.toString()}},gf=new Map,_a=class extends qi{constructor(t,r=gf){super("Fail",r,t),this.error=t}toString(){return`Fail(${N(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[X](t){return no(t)&&W(this.error,t.error)&&W(this.annotations,t.annotations)}[Y](){return ae(Ae(this._tag))(ae(q(this.error))(q(this.annotations)))}},jo=e=>new eo(e),Cj=(e,t)=>{let r=new Map,n=[];for(let o of e.concat(t)){let s=q(o),a=r.get(s);if(a===void 0)r.set(s,[o]);else{if(a.some(i=>W(i,o)))continue;a.push(o)}n.push(o)}return n},Vi=m(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let r=new eo(Cj(e.reasons,t.reasons));return W(e,r)?e:r}),Hx=new eo([]),xf=e=>new eo([new _a(e)]),mf=class extends qi{constructor(t,r=gf){super("Die",r,t),this.defect=t}toString(){return`Die(${N(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[X](t){return Sf(t)&&W(this.defect,t.defect)&&W(this.annotations,t.annotations)}[Y](){return ae(Ae(this._tag))(ae(q(this.defect))(q(this.annotations)))}},Wx=e=>new eo([new mf(e)]),yf=m(e=>Wi(e[0]),(e,t,r)=>t.mapUnsafe.size===0?e:new eo(e.reasons.map(n=>n.annotate(t,r)))),no=e=>e._tag==="Fail",Sf=e=>e._tag==="Die",Ef=e=>e._tag==="Interrupt";function Tj(e){return zr("Effect.evaluate: Not implemented")}var jr=e=>({...Ij,[qx]:e.op,[Ge]:e[Ge]??Tj,[Ot]:e[Ot],[Br]:e[Br],[Oa]:e[Oa]}),on=e=>{let t=jr(e),r=function(n){this[ue]=n};return r.prototype=t,function(n){return new r(n)}},zw=e=>{let t={[va]:va,_tag:e.op,get[e.prop](){return this[ue]},...jr(e),toString(){return`${e.op}(${N(this[ue])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[ue]}},[X](n){return hf(n)&&n._tag===this._tag&&W(this[ue],n[ue])},[Y](){return ae(Ae(e.op),q(this[ue]))}},r=function(n){this[ue]=n};return r.prototype=t,function(n){return new r(n)}},Fe=zw({op:"Success",prop:"value",[Ge](e){let t=e.getCont(Ot);return t?t[Ot](this[ue],e,this):e.yieldWith(this)}}),bd={key:"effect/Cause/StackTrace"},Vx={key:"effect/Cause/InterruptorStackTrace"},ir=zw({op:"Failure",prop:"cause",[Ge](e){let t=this[ue],r=!1;e.cache.stackFrame&&(t=yf(t,{mapUnsafe:new Map([[bd.key,e.cache.stackFrame]])}),r=!0);let n=e.getCont(Br),o=e._interruptedCause;if(o&&e.interruptible){let s=!1;for(;n&&e.interruptible;)s||=qx in n,n=e.getCont(Br);s&&(t=jo(t.reasons.filter(a=>a._tag!=="Fail"))),t=Vi(t,o),r=!0}return n?n[Br](t,e,r?void 0:this):e.yieldWith(r?ir(t):this)}}),sn=e=>ir(xf(e)),zr=e=>ir(Wx(e)),ie=on({op:"WithFiber",[Ge](e){return this[ue](e)}}),qw=on({op:"WithFiberSucceed",[Ge](e){let t=this[ue](e),r=e.getCont(Ot);return r?r[Ot](t,e):e.yieldWith(Fe(t))}}),wj=(function(){class e extends globalThis.Error{}let t=jr({op:"YieldableError",[Ge](){return sn(this)}});return delete t.toString,Object.assign(e.prototype,t),e})(),bf=(function(){let e=Symbol.for("effect/Data/Error/plainArgs");return class extends wj{constructor(r){super(r?.message,r?.cause?{cause:r.cause}:void 0),r&&(yd(this,r),Object.defineProperty(this,e,{value:r,enumerable:!1}))}toJSON(){return{...this[e],...this}}}})(),zo=e=>{class t extends bf{_tag=e}return t.prototype.name=e,t},Ed="~effect/Cause/NoSuchElementError",Gx=e=>A(e,Ed),to=class extends zo("NoSuchElementError"){[Ed]=Ed;constructor(t){super({message:t})}},Hi="~effect/Cause/Done",Hw=e=>A(e,Hi),Ww={[Hi]:Hi,_tag:"Done",value:void 0},Gi=e=>e===void 0?Ww:{[Hi]:Hi,_tag:"Done",value:e},kj=sn(Ww),Vw=e=>e===void 0?kj:sn(Gi(e));var so=e=>jr({op:e.label,[Ge]:e.evaluate});var gr=e=>(t,r)=>t===r||e(t,r),Aj=(e,t)=>e===t,Fa=()=>Aj;function Gw(e){return gr((t,r)=>{if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!e[n](t[n],r[n]))return!1;return!0})}function Id(e){return gr((t,r)=>{if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],r[n]))return!1;return!0})}var Kw=e=>m(3,(t,r,n)=>e(t,o=>({...o,[r]:n(o)}))),Jw=e=>m(2,(t,r)=>e(t,n=>({[r]:n}))),Zw=(e,t)=>m(3,(r,n,o)=>t(r,s=>e(o(s),a=>({...s,[n]:a}))));var Qw="~effect/Option",Yw={[Qw]:{_A:e=>e},...Xt,[Symbol.iterator](){return new _s(this)}},Oj=Object.defineProperty(Object.assign(Object.create(Yw),{_tag:"Some",_op:"Some",[X](e){return Cd(e)&&Jx(e)&&W(this.value,e.value)},[Y](){return ae(q(this._tag))(q(this.value))},toString(){return`some(${N(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:vt(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),_j=q("None"),Pj=Object.assign(Object.create(Yw),{_tag:"None",_op:"None",valueOrUndefined:void 0,[X](e){return Cd(e)&&Kx(e)},[Y](){return _j},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}}}),Cd=e=>A(e,Qw),Kx=e=>e._tag==="None",Jx=e=>e._tag==="Some",Xw=Object.create(Pj),ek=function(e){this.value=e};ek.prototype=Oj;var tk=e=>new ek(e);var rk="~effect/Result",nk={[rk]:{_A:e=>e,_E:e=>e},...Xt,[Symbol.iterator](){return new _s(this)}},Rj=Object.assign(Object.create(nk),{_tag:"Success",_op:"Success",[X](e){return Td(e)&&Qx(e)&&W(this.success,e.success)},[Y](){return ae(q(this._tag))(q(this.success))},toString(){return`success(${N(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:vt(this.success)}}}),$j=Object.assign(Object.create(nk),{_tag:"Failure",_op:"Failure",[X](e){return Td(e)&&Zx(e)&&W(this.failure,e.failure)},[Y](){return ae(q(this._tag))(q(this.failure))},toString(){return`failure(${N(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:vt(this.failure)}}}),Td=e=>A(e,rk),Zx=e=>e._tag==="Failure",Qx=e=>e._tag==="Success",ok=function(e){this.failure=e};ok.prototype=$j;var sk=e=>new ok(e),ak=function(e){this.success=e};ak.prototype=Rj;var ik=e=>new ak(e);function Ji(e){return(t,r)=>t===r?0:e(t,r)}var ck=Ji((e,t)=>e<t?-1:1),Ho=Ji((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1);var Zi=Ji((e,t)=>e<t?-1:1);var Yx=m(2,(e,t)=>Ji((r,n)=>e(t(r),t(n)))),Qi=Yx(Ho,e=>e.getTime());var wd=e=>m(2,(t,r)=>e(t,r)===-1),Yi=e=>m(2,(t,r)=>e(t,r)===1),kd=e=>m(2,(t,r)=>e(t,r)!==1),Ad=e=>m(2,(t,r)=>e(t,r)!==-1);var v=()=>Xw,R=tk,Od=Cd,Ke=Kx,ve=Jx,Re=m(2,(e,{onNone:t,onSome:r})=>Ke(e)?t():r(e.value));var bt=m(2,(e,t)=>Ke(e)?t():e.value);var Ra=e=>e==null?v():R(e),Fs=e=>e===void 0?v():R(e),uk=e=>e===null?v():R(e);var Xx=bt(Rx),er=bt(nn),ao=e=>(...t)=>{try{return R(e(...t))}catch{return v()}};var Xi=m(2,(e,t)=>Ke(e)?v():R(t(e.value)));var _d=m(2,(e,t)=>Ke(e)?v():t(e.value));var ec=_d(F);var tc=m(2,(e,t)=>Ke(e)?v():t(e.value)?R(e.value):v());var fk=m(2,(e,t)=>t(e)?R(e):v());var lk=m(2,(e,t)=>Ke(e)?!1:t(e.value));var pk="~effect/Context/Service",Ye=function(){function e(){}let t=e;Object.setPrototypeOf(t,Mj);let r=(n,o)=>(t.key=n,o?.defaultValue&&(t[ty]=ty,t.defaultValue=o.defaultValue),o?.make&&(t.make=o.make),o?.fiberCached&&dk.add(n),t);return arguments.length>0?r(arguments[0],arguments[1]):r},Mj={[pk]:pk,...so({label:"Service",evaluate(e){return Fe(ct(e.context,this))}}),toJSON(){return{_id:"Service",key:this.key}},of(e){return e},context(e){return Wo(this,e)},use(e){return ie(t=>e(ct(t.context,this)))},useSync(e){return ie(t=>Fe(e(ct(t.context,this))))}},dk=new Set,ty="~effect/Context/Reference",mk="~effect/Context",Uj=8,Dj=8,ry=(e,t,r,n)=>{let o=Object.create(Bj);return o.cacheRoot=e??o,o.base=t,o.overlay=r,o.depth=n,o._flat=void 0,o.baseHits=0,o},ny=(e,t)=>{t&&(ny(e,t.parent),e.set(t.key,t.value))},hk=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return ny(t,e.overlay),e._flat=t},Lj=(e,t)=>{let r=new Map(e.mapUnsafe);return t(r),rc(r)},Pd=Symbol(),oy=(e,t)=>{let r=e;for(let o=r.overlay;o;o=o.parent)if(o.key===t)return o.value;let n=r.base.get(t);return n===void 0&&!r.base.has(t)?Pd:(r.overlay&&++r.baseHits>=r.base.size&&r.baseHits>=Dj&&(r.base=hk(r),r.overlay=void 0,r.depth=0),n)},rc=e=>ry(void 0,e,void 0,0),Bj={get mapUnsafe(){return hk(this)},...Xt,[mk]:{_Services:e=>e},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[X](e){if(!sy(e))return!1;let t=this.mapUnsafe,r=e.mapUnsafe;if(t.size!==r.size)return!1;for(let[n,o]of t)if(!r.has(n)||!W(o,r.get(n)))return!1;return!0},[Y](){return dt(this.mapUnsafe.size)}},gk=(e,t)=>e.cacheRoot===t.cacheRoot,sy=e=>A(e,mk);var xk=e=>!!e[ty],cr=()=>jj,jj=rc(new Map),Wo=(e,t)=>rc(new Map([[e.key,t]])),tr=m(3,(e,t,r)=>zj(e,t.key,r)),zj=(e,t,r)=>{let n=e,o=dk.has(t)?void 0:n.cacheRoot;if(n.depth>=Uj){let s=new Map(n._flat??n.base);return n._flat||ny(s,n.overlay),s.set(t,r),ry(o,s,void 0,0)}return ry(o,n.base,{key:t,value:r,parent:n.overlay},n.depth+1)};var Fd=m(2,(e,t)=>If(e,t.key)),If=(e,t)=>{let r=oy(e,t);return r===Pd?void 0:r},io=m(2,(e,t)=>{let r=oy(e,t.key);if(r===Pd){if(xk(t))return yk(t);throw qj(t)}return r}),ct=io,ey="~effect/Context/defaultValue",yk=e=>ey in e?e[ey]:e[ey]=e.defaultValue(),qj=e=>{let t=new Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(t.stack){let r=t.stack.split(`
|
|
9
|
+
`);r.splice(1,3),t.stack=r.join(`
|
|
10
|
+
`)}return t},Rd=m(2,(e,t)=>{let r=oy(e,t.key);return r!==Pd?R(r):xk(t)?R(yk(t)):v()}),$a=m(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:Lj(e,r=>t.mapUnsafe.forEach((n,o)=>r.set(o,n)))),Sk=(...e)=>{let t=new Map;for(let r=0;r<e.length;r++)e[r].mapUnsafe.forEach((n,o)=>{t.set(o,n)});return rc(t)};var ge=Ye;var ay=e=>e.length>0;var Cf=e=>e>0?Math.floor(e):0;var H=ik,Z=sk;var bk=Td,Se=Zx,Tt=Qx;var $d=m(2,(e,t)=>Se(e)?Z(t(e.failure)):e),Nt=m(2,(e,t)=>Tt(e)?H(t(e.success)):e),xr=m(2,(e,{onFailure:t,onSuccess:r})=>Se(e)?t(e.failure):r(e.success));var Tf=m(2,(e,t)=>Se(e)?t(e.failure):e.success);var Wj=m(2,(e,t)=>{if(Tt(e))return e.success;throw t(e.failure)}),Rs=Wj(F);var _t=m(2,(e,t)=>Se(e)?Z(e.failure):t(e.success));var Ik=Gw;var Tk=m(2,(e,t)=>{let r=0;for(let n of e){let o=t(n,r);if(ld(o)){if(o)return R(n)}else if(ve(o))return o;r++}return v()});var wk=m(2,(e,t)=>({[Symbol.iterator](){let r=e[Symbol.iterator](),n=0;return{next(){let o=r.next();for(;!o.done;){if(t(o.value,n++))return{done:!1,value:o.value};o=r.next()}return{done:!0,value:void 0}}}}}));var Vj=m(2,(e,t)=>Object.hasOwn(e,t));var Nd=m(2,(e,t)=>{let r={...e};for(let n of kk(e))U(r,n,t(e[n],n));return r});var kk=e=>Object.keys(e);var Gj=e=>m(2,(t,r)=>{for(let n of kk(t))if(!Vj(r,n)||!e(t[n],r[n]))return!1;return!0});var Ak=e=>{let t=Gj(e);return(r,n)=>t(r,n)&&t(n,r)};var cy=globalThis.Array;var rr=e=>cy.isArray(e)?e:cy.from(e);var wf=m(2,(e,{onEmpty:t,onNonEmpty:r})=>$s(e)?r(e):t());var Ud=m(2,(e,t)=>[...e,t]);var Kj=cy.isArray;var Na=ay,$s=ay;function nc(e){let t=Number(e);return String(t)===e&&Number.isInteger(t)&&t>=0&&t<2**32-1}var Dd=m(2,(e,t)=>{let r=0;for(let n of e){if(t(n,r))return R(r);r++}return v()});var kf=Tk;var Ld=m(2,(e,t)=>{let r=rr(e);for(let n=r.length-1;n>=0;n--){let o=r[n],s=t(o,n);if(typeof s=="boolean"){if(s)return R(o)}else if(ve(s))return s}return v()});var Jj=(e,t)=>{let r=q(t),n=e.get(r);if(n===void 0)return e.set(r,[t]),!0;for(let o of n)if(W(o,t))return!1;return n.push(t),!0};var Ma=()=>[],Ua=e=>[e],Pt=m(2,(e,t)=>e.map(t));var uy=m(2,(e,t)=>{let r=[],n=[],o=0;for(let s of e){let a=t(s,o++);Tt(a)?r.push(a.success):n.push(a.failure)}return[r,n]});var oc=m(3,(e,t,r)=>rr(e).reduce((n,o,s)=>r(n,o,s),t));var vk=Id;var Bd=e=>{let t=rr(e);if(t.length<2)return[...t];let r=new Map,n=[];for(let o of t)Jj(r,o)&&n.push(o);return n};var zd="~effect/Duration",Ns=BigInt(0),Nk=BigInt(1),Zj=BigInt(2),Qj=BigInt(10),Ok=BigInt(24),jd=BigInt(60),fy=BigInt(1e3),_k=BigInt(1e6);var ly=e=>BigInt(Math.sign(e)*Math.round(Math.abs(e))),Mk=e=>ly(e*1e6),Pk=e=>ur(Number.isFinite(e)?ly(e):e),Fk=(e,t)=>{let r=e.indexOf(".");if(r===-1)return BigInt(e)*t;let n=e[0]==="-",o=e.slice(r+1),s=Qj**BigInt(o.length),a=(BigInt(e.slice(n?1:0,r))*s+BigInt(o))*t;return Yj(n?-a:a,s)},Yj=(e,t)=>{let r=e<Ns?-e:e,n=r/t+(r%t*Zj>=t?Nk:Ns);return e<Ns?-n:n};var Xj=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,Mt=e=>{switch(typeof e){case"number":return ic(e);case"bigint":return co(e);case"string":{if(e==="Infinity")return Da;if(e==="-Infinity")return ac;let t=Xj.exec(e);if(!t)break;let[r,n,o]=t;if(o==="nano"||o==="nanos")return co(Fk(n,Nk));if(o==="micro"||o==="micros")return co(Fk(n,fy));let s=Number(n);switch(o){case"milli":case"millis":return ic(s);case"second":case"seconds":return vf(s);case"minute":case"minutes":return az(s);case"hour":case"hours":return iz(s);case"day":case"days":return cz(s);case"week":case"weeks":return uz(s)}break}case"object":{if(e===null)break;if(zd in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(af)?Rk(e):Number.isNaN(e[0])||Number.isNaN(e[1])?sc:e[0]===-1/0||e[1]===-1/0?ac:e[0]===1/0||e[1]===1/0?Da:Pk(e[0]*1e9+e[1]);let t=e,r=0;return t.weeks&&(r+=t.weeks*6048e5),t.days&&(r+=t.days*864e5),t.hours&&(r+=t.hours*36e5),t.minutes&&(r+=t.minutes*6e4),t.seconds&&(r+=t.seconds*1e3),t.milliseconds&&(r+=t.milliseconds),!t.microseconds&&!t.nanoseconds?ur(r):Pk(r*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0))}}return Rk(e)},Rk=e=>{throw new Error(`Invalid Input: ${e}`)},Uk=ao(Mt),$k={_tag:"Millis",millis:0},ez={_tag:"Infinity"},tz={_tag:"NegativeInfinity"},rz={[zd]:zd,[Y](){switch(this.value._tag){case"Millis":{let e=this.value.millis*1e6;return Number.isFinite(e)?q(ly(e)):dt(this.value.millis)}case"Nanos":return q(this.value.nanos);default:return lf(this.value)}},[X](e){return Af(e)&&lz(this,e)},toString(){switch(this.value._tag){case"Infinity":return"Infinity";case"NegativeInfinity":return"-Infinity";case"Nanos":return`${this.value.nanos} nanos`;case"Millis":return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case"Millis":return{_id:"Duration",_tag:"Millis",millis:this.value.millis};case"Nanos":return{_id:"Duration",_tag:"Nanos",nanos:String(this.value.nanos)};case"Infinity":return{_id:"Duration",_tag:"Infinity"};case"NegativeInfinity":return{_id:"Duration",_tag:"NegativeInfinity"}}},[qe](){return this.toJSON()},pipe(){return te(this,arguments)}},ur=e=>{let t=Object.create(rz);return typeof e=="number"?isNaN(e)||e===0||Object.is(e,-0)?t.value=$k:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:"Millis",millis:e}:t.value={_tag:"Nanos",nanos:Mk(e)}:t.value=e>0?ez:tz:e===Ns?t.value=$k:t.value={_tag:"Nanos",nanos:e},t},Af=e=>A(e,zd),cc=e=>e.value._tag!=="Infinity"&&e.value._tag!=="NegativeInfinity",nz=e=>{switch(e.value._tag){case"Millis":return e.value.millis===0;case"Nanos":return e.value.nanos===Ns;case"Infinity":case"NegativeInfinity":return!1}},oz=e=>{switch(e.value._tag){case"Millis":return e.value.millis<0;case"Nanos":return e.value.nanos<Ns;case"NegativeInfinity":return!0;case"Infinity":return!1}};var sz=e=>{switch(e.value._tag){case"Infinity":case"NegativeInfinity":return Da;case"Millis":return e.value.millis<0?ur(-e.value.millis):e;case"Nanos":return e.value.nanos<Ns?ur(-e.value.nanos):e}};var sc=ur(0),Da=ur(1/0),ac=ur(-1/0),co=e=>ur(e);var ic=e=>ur(e),vf=e=>ur(e*1e3),az=e=>ur(e*6e4),iz=e=>ur(e*36e5),cz=e=>ur(e*864e5),uz=e=>ur(e*6048e5),Vo=e=>Lk(Mt(e),{onMillis:F,onNanos:t=>Number(t)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),uo=e=>Lk(Mt(e),{onMillis:t=>t/1e3,onNanos:t=>Number(t)/1e9,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0});var qd=e=>{let t=Mt(e);switch(t.value._tag){case"Infinity":case"NegativeInfinity":throw new Error("Cannot convert infinite duration to nanos");case"Nanos":return t.value.nanos;case"Millis":return Mk(t.value.millis)}},Dk=ao(qd);var Lk=m(2,(e,t)=>{switch(e.value._tag){case"Millis":return t.onMillis(e.value.millis);case"Nanos":return t.onNanos(e.value.nanos);case"Infinity":return t.onInfinity();case"NegativeInfinity":return(t.onNegativeInfinity??t.onInfinity)()}}),Bk=m(3,(e,t,r)=>e.value._tag==="Infinity"||e.value._tag==="NegativeInfinity"||t.value._tag==="Infinity"||t.value._tag==="NegativeInfinity"?r.onInfinity(e,t):e.value._tag==="Millis"?t.value._tag==="Millis"?r.onMillis(e.value.millis,t.value.millis):r.onNanos(qd(e),t.value.nanos):r.onNanos(e.value.nanos,qd(t)));var fz=(e,t)=>Bk(e,t,{onMillis:(r,n)=>r===n,onNanos:(r,n)=>r===n,onInfinity:(r,n)=>r.value._tag===n.value._tag});var jk=m(2,(e,t)=>Bk(e,t,{onMillis:(r,n)=>ur(r-n),onNanos:(r,n)=>ur(r-n),onInfinity:(r,n)=>{let o=r.value._tag,s=n.value._tag;return o==="Infinity"?s==="Infinity"?sc:Da:o==="NegativeInfinity"?s==="NegativeInfinity"?sc:ac:s==="Infinity"?ac:Da}}));var lz=m(2,(e,t)=>fz(e,t)),pz=e=>{if(e.value._tag==="Infinity")return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};if(e.value._tag==="NegativeInfinity")return{days:-1/0,hours:-1/0,minutes:-1/0,seconds:-1/0,millis:-1/0,nanos:-1/0};let t=qd(e),r=t<Ns,n=r?-t:t,o=n/_k,s=o/fy,a=s/jd,i=a/jd,c=i/Ok,f=r?-1:1;return{days:f*Number(c),hours:f*Number(i%Ok),minutes:f*Number(a%jd),seconds:f*Number(s%jd),millis:f*Number(o%fy),nanos:f*Number(n%_k)}},py=e=>{if(e.value._tag==="Infinity")return"Infinity";if(e.value._tag==="NegativeInfinity")return"-Infinity";if(nz(e))return"0";if(oz(e))return"-"+py(sz(e));let t=pz(e),r=[];return t.days!==0&&r.push(`${t.days}d`),t.hours!==0&&r.push(`${t.hours}h`),t.minutes!==0&&r.push(`${t.minutes}m`),t.seconds!==0&&r.push(`${t.seconds}s`),t.millis!==0&&r.push(`${t.millis}ms`),t.nanos!==0&&r.push(`${t.nanos}ns`),r.join(" ")};var Of=ge("effect/Scheduler",{fiberCached:!0,defaultValue:()=>new La}),zk=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}},dz="setImmediate"in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},qk=e=>{try{return dz(e)}catch{return zk(e)}},dy=class{buckets=[];scheduleTask(t,r){let n=this.buckets,o=n.length,s,a=0;for(;a<o&&!(n[a][0]>r);a++)s=n[a];s&&s[0]===r?s[1].push(t):a===o?n.push([r,[t]]):n.splice(a,0,[r,[t]])}drain(){let t=this.buckets;return this.buckets=[],t}},La=class{executionMode;setImmediate;constructor(t="async",r){this.executionMode=t,this.setImmediate=r??(t==="sync"?zk:qk)}shouldYield(t){return t.currentOpCount>=t.cache.maxOpsBeforeYield}makeDispatcher(){return new my(this.setImmediate)}},my=class{tasks=new dy;running=void 0;setImmediate;constructor(t=qk){this.setImmediate=t}scheduleTask(t,r){this.tasks.scheduleTask(t,r),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let t=this.tasks.drain();for(let r=0;r<t.length;r++){let n=t[r][1];for(let o=0;o<n.length;o++)n[o]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},Hk=ge("effect/Scheduler/MaxOpsBeforeYield",{fiberCached:!0,defaultValue:()=>2048}),Wk=ge("effect/Scheduler/PreventSchedulerYield",{fiberCached:!0,defaultValue:()=>!1});var lo={};Kn(lo,{Class:()=>Hd,Error:()=>_f,TaggedClass:()=>mz,TaggedError:()=>an,taggedEnum:()=>gy});var Hd=class extends vs{constructor(e){super(),e&&yd(this,e)}},mz=e=>class extends Hd{_tag=e},gy=()=>new Proxy({},{get(e,t,r){return t==="$is"?Lr:t==="$match"?hz:n=>({...n,_tag:t})}});function hz(){if(arguments.length===1){let r=arguments[0];return function(n){return r[n._tag](n)}}let e=arguments[0];return arguments[1][e._tag](e)}var _f=bf,an=zo;var Vk="~effect/encoding/EncodingError",cn=class extends an("EncodingError"){[Vk]=Vk};var Wd=e=>Gk(typeof e=="string"?Sz.encode(e):e),xy=e=>{switch(e){case 16:return xz();case 32:return yz();default:{let t="";for(let r=e>>>3;r>0;r--)t+=gz();return t}}},ee=Uint8Array.from("0123456789abcdef",e=>e.charCodeAt(0)),Ba=()=>Math.random()*4294967296>>>0,gz=()=>{let e=Ba();return String.fromCharCode(ee[e>>>28],ee[e>>>24&15],ee[e>>>20&15],ee[e>>>16&15],ee[e>>>12&15],ee[e>>>8&15],ee[e>>>4&15],ee[e&15])},xz=()=>{let e=Ba(),t=Ba();return String.fromCharCode(ee[e>>>28],ee[e>>>24&15],ee[e>>>20&15],ee[e>>>16&15],ee[e>>>12&15],ee[e>>>8&15],ee[e>>>4&15],ee[e&15],ee[t>>>28],ee[t>>>24&15],ee[t>>>20&15],ee[t>>>16&15],ee[t>>>12&15],ee[t>>>8&15],ee[t>>>4&15],ee[t&15])},yz=()=>{let e=Ba(),t=Ba(),r=Ba(),n=Ba();return String.fromCharCode(ee[e>>>28],ee[e>>>24&15],ee[e>>>20&15],ee[e>>>16&15],ee[e>>>12&15],ee[e>>>8&15],ee[e>>>4&15],ee[e&15],ee[t>>>28],ee[t>>>24&15],ee[t>>>20&15],ee[t>>>16&15],ee[t>>>12&15],ee[t>>>8&15],ee[t>>>4&15],ee[t&15],ee[r>>>28],ee[r>>>24&15],ee[r>>>20&15],ee[r>>>16&15],ee[r>>>12&15],ee[r>>>8&15],ee[r>>>4&15],ee[r&15],ee[n>>>28],ee[n>>>24&15],ee[n>>>20&15],ee[n>>>16&15],ee[n>>>12&15],ee[n>>>8&15],ee[n>>>4&15],ee[n&15])},yy=e=>{let t=new TextEncoder().encode(e);if(t.length%2!==0)return Z(new cn({module:"Hex",kind:"Decode",input:e,message:`Length must be a multiple of 2, but is ${t.length}`}));try{let r=t.length/2,n=new Uint8Array(r);for(let o=0;o<r;o++){let s=Kk(t[o*2]),a=Kk(t[o*2+1]);n[o]=s<<4|a}return H(n)}catch(r){return Z(new cn({module:"Hex",kind:"Decode",input:e,message:r instanceof Error?r.message:"Invalid input"}))}},Jk=e=>Nt(yy(e),t=>Ez.decode(t)),Sz=new TextEncoder,Ez=new TextDecoder,bz=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),Gk=e=>{let t="";for(let r=0;r<e.length;r++)t+=bz[e[r]];return t},Kk=e=>{if(48<=e&&e<=57)return e-48;if(97<=e&&e<=102)return e-97+10;if(65<=e&&e<=70)return e-65+10;throw new TypeError("Invalid input")};var by="effect/Tracer/ParentSpan",Pf=class extends Ye()(by,{fiberCached:!0}){},Iz=e=>e;var Vd=ge("effect/Tracer/DisablePropagation",{defaultValue:nf}),Zk=ge("effect/Tracer/CurrentTraceLevel",{defaultValue:()=>"Info"}),Qk=ge("effect/Tracer/MinimumTraceLevel",{defaultValue:()=>"All"}),Iy="effect/Tracer",Cy=ge(Iy,{fiberCached:!0,defaultValue:()=>Ty}),Ty=Iz({span:e=>new Ey(e)}),Ey=class{_tag="Span";sampled;name;parent;annotations;links;startTime;kind;status;_traceId=void 0;_spanId=void 0;_attributes=void 0;_events=void 0;constructor(t){this.name=t.name,this.parent=t.parent,this.annotations=t.annotations,this.links=t.links,this.startTime=t.startTime,this.kind=t.kind,this.sampled=t.sampled,this.status={_tag:"Started",startTime:t.startTime}}get traceId(){return this._traceId??=er(this.parent)?.traceId??xy(32)}get spanId(){return this._spanId??=xy(16)}get attributes(){return this._attributes??=new Map}get events(){return this._events??=[]}end(t,r){this.status={_tag:"Ended",endTime:t,exit:r,startTime:this.status.startTime}}attribute(t,r){this.attributes.set(t,r)}event(t,r,n){this.events.push([t,r,n??{}])}addLinks(t){this.links.push(...t)}};var Xk="effect/Metric/FiberRuntimeMetrics";var eA=ge("effect/ErrorReporter/CurrentErrorReporters",{defaultValue:()=>new Set}),Ff=ge("effect/References/CurrentStackFrame",{fiberCached:!0,defaultValue:nn}),Gd=ge("effect/References/TracerEnabled",{fiberCached:!0,defaultValue:Ur}),uc=ge("effect/References/TracerTimingEnabled",{defaultValue:Ur}),Rf=ge("effect/References/TracerSpanAnnotations",{defaultValue:()=>({})}),$f=ge("effect/References/TracerSpanLinks",{defaultValue:()=>[]}),Go=ge("effect/References/CurrentLogAnnotations",{defaultValue:()=>({})}),wy=ge("effect/References/CurrentLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),Kd=ge("effect/References/MinimumLogLevel",{fiberCached:!0,defaultValue:()=>"Info"});var Jd=ge("effect/References/CurrentLogSpans",{defaultValue:()=>[]});var Zd=e=>{if(e?.captureStackTrace===!1)return e;if(e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!="boolean")return e;let t=In();if(t===0&&e?.captureStackTrace!==!0)return{...e,captureStackTrace:!1};Bt(3);let r=new Error;return Bt(t),{...e,captureStackTrace:wz(()=>r.stack)}},ky=e=>t=>{let r;return()=>{if(r!==void 0)return r;let n=t();if(!n)return;let o=n.split(`
|
|
11
|
+
`);if(o[e]!==void 0)return r=o[e].trim(),r}},wz=ky(3);var Qd=class extends qi{constructor(t,r=gf){super("Interrupt",r,"Interrupted"),this.fiberId=t}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[X](t){return Ef(t)&&this.fiberId===t.fiberId&&this.annotations===t.annotations}[Y](){return ae(Ae(`${this._tag}:${this.fiberId}`))(md(this.annotations))}},cA=e=>new Qd(e),dc=e=>new eo([new Qd(e)]);var uA=e=>{let t=e.reasons.find(no);return t?H(t):Z(e)},Cn=e=>{for(let t=0;t<e.reasons.length;t++){let r=e.reasons[t];if(r._tag==="Fail")return H(r.error)}return Z(e)};var fA=e=>e.reasons.some(Sf);var qy=e=>{let t=e.reasons.find(Sf);return t?H(t.defect):Z(e)},Hy=e=>e.reasons.some(Ef);var lA=e=>{let t;for(let r=0;r<e.reasons.length;r++){let n=e.reasons[r];n._tag==="Interrupt"&&(t??=new Set,n.fiberId!==void 0&&t.add(n.fiberId))}return t?H(t):Z(e)};var sm=e=>e.reasons.length>0&&e.reasons.every(Ef);var pA=m(2,(e,t)=>{let r=!1,n=e.reasons.map(o=>no(o)?(r=!0,new _a(t(o.error),o.annotations)):o);return r?jo(n):e}),am=e=>{let t;for(let r of e.reasons){if(r._tag==="Fail")return r.error;r._tag==="Die"&&(t??=r)}return t!==void 0?t.defect:e.reasons.length>0?new globalThis.Error("All fibers interrupted without error"):new globalThis.Error("Empty cause")},dA=(e,t)=>{let r=[],n=[];if(e.reasons.length===0)return r;let o=In();o!==0&&Bt(1);try{for(let s of e.reasons){if(s._tag==="Interrupt"){n.push(s);continue}r.push(vy(s._tag==="Die"?s.defect:s.error,s.annotations,t))}if(r.length===0){let s=new Error("The fiber was interrupted by:");s.name="InterruptCause",s.stack=Oz(s,n);let a=new globalThis.Error("All fibers interrupted without error",{cause:s});a.name="InterruptError",a.stack=`${a.name}: ${a.message}`,r.push(vy(a,n[0].annotations,t))}}finally{o!==0&&Bt(o)}return r},vy=(e,t,r)=>{let n=typeof e,o;if(e&&n==="object"){if(o=new globalThis.Error(kz(e),{cause:e.cause?vy(e.cause):void 0}),typeof e.name=="string"&&(o.name=e.name),typeof e.stack=="string")o.stack=vz(e.stack,o,t);else{let s=`${o.name}: ${o.message}`;o.stack=t?Oy(s,t):s}r?.includeCauseInStack&&(o.stack=hA(o));for(let s of Object.keys(e))s in o||(o[s]=e[s])}else{o=new globalThis.Error(e?n==="string"?e:Aa(e):`Unknown error: ${e}`);let s=`${o.name}: ${o.message}`;o.stack=t?Oy(s,t):s}return o},kz=e=>{if(typeof e.message=="string")return e.message;if(typeof e.toString=="function"&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return Aa(e)},Az=/\((.*)\)/g,vz=(e,t,r)=>{let n=`${t.name}: ${t.message}`,o=(e.startsWith(n)?e.slice(n.length):e).split(`
|
|
12
|
+
`),s=[n];for(let a=1;a<o.length&&!/Generator\.next|~effect\/(?:Effect|Utils)/.test(o[a]);a++)s.push(o[a]);return r?Oy(s.join(`
|
|
13
|
+
`),r):s.join(`
|
|
14
|
+
`)},Oy=(e,t)=>{let r=t?.get(bd.key);return r&&(e=`${e}
|
|
15
|
+
${mA(r)}`),e},Oz=(e,t)=>{let r=[`${e.name}: ${e.message}`];for(let n of t){let o=n.fiberId!==void 0?`#${n.fiberId}`:"unknown",s=n.annotations.get(Vx.key);r.push(` at fiber (${o})`),s&&r.push(mA(s))}return r.join(`
|
|
16
|
+
`)},mA=e=>{let t=[],r=e,n=0;for(;r&&n<10;){let o=r.stack();if(o){let s=o.matchAll(Az),a=!1;for(let[,i]of s)a=!0,t.push(` at ${r.name} (${i})`);a||t.push(` at ${r.name} (${o.replace(/^at /,"")})`)}else t.push(` at ${r.name}`);r=r.parent,n++}return t.join(`
|
|
17
|
+
`)},im=e=>dA(e).map(hA).join(`
|
|
18
|
+
`),hA=e=>e.cause?`${e.stack} {
|
|
19
|
+
${gA(e.cause," ")}
|
|
20
|
+
}`:e.stack,gA=(e,t)=>{let r=e.stack.split(`
|
|
21
|
+
`),n=`${t}[cause]: ${r[0]}`;for(let o=1,s=r.length;o<s;o++)n+=`
|
|
22
|
+
${t}${r[o]}`;return e.cause&&(n+=` {
|
|
23
|
+
${gA(e.cause,`${t} `)}
|
|
24
|
+
${t}}`),n},Wy="~effect/Fiber",_z={_A:F,_E:F},Pz={id:0},tA=(()=>{try{return globalThis.process?.getBuiltinModule?.("node:async_hooks")?.AsyncResource}catch{return}})(),xA=()=>tA===void 0?void 0:new tA("effect/Fiber"),mc=()=>globalThis[zi],Nf=class{constructor(t,r=!0){this.setContext(t),this.id=++Pz.id,this.currentOpCount=0,this.interruptible=r,this._stack=[],this._observers=void 0,this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this._parent=void 0,this._asyncContext=void 0,this.cache.runtimeMetrics?.recordFiberStart(this.context)}get[Wy](){return _z}get currentDispatcher(){return this._dispatcher??=this.cache.scheduler.makeDispatcher()}getRef(t){return ct(this.context,t)}addObserver(t){return this._exit?(t(this._exit),Lo):(this._observers===void 0?this._observers=[t]:this._observers.push(t),()=>this.removeObserver(t))}removeObserver(t){if(this._exit||this._observers===void 0)return;let r=this._observers.indexOf(t);r>=0&&this._observers.splice(r,1)}interruptUnsafe(t,r){if(this._exit)return;let n=dc(t);this.cache.stackFrame&&(n=yf(n,Wo(bd,this.cache.stackFrame))),r&&(n=yf(n,r)),this._interruptedCause=this._interruptedCause?Vi(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(Ue(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(t){if(this._exit)return;if(this._asyncContext!==void 0){let o=this._asyncContext;return this._asyncContext=void 0,o.runInAsyncScope(this.evaluate,this,t)}else if(this._yielded!==void 0){let o=this._yielded;this._yielded=void 0,o()}let r=this.runLoop(t);if(r===Pa){this._asyncContext=xA();return}let n=_y.interruptChildren&&_y.interruptChildren(this);if(n!==void 0)return this.evaluate(Q(n,()=>r));if(this._exit=r,this.cache.runtimeMetrics?.recordFiberEnd(this.context,this._exit),this._parent&&(this._parent._children?.delete(this),this._parent=void 0),this._observers!==void 0){let o=this._observers;this._observers=void 0;for(let s=0;s<o.length;s++)o[s](r)}this._stack.length=0,this._children=void 0,this.context=cr()}runLoop(t){let r=globalThis[zi];globalThis[zi]=this;let n=this._running;this._running=!0;let o=!1,s=t;this.currentOpCount=0;try{for(;;)try{this._deferredInterrupt&&(this._deferredInterrupt=!1,s=Ue(this._interruptedCause)),this.currentOpCount++;let a=this.cache;if(!o&&!a.preventYield&&a.scheduler.shouldYield(this)){o=!0;let i=s;s=Q(gc,()=>i)}if(s=a.tracerContext?a.tracerContext(s,this):s[Ge](this),s===Pa){let i=this._yielded;if(va in i)return this._deferredInterrupt=!1,this._yielded=void 0,i;if(this._deferredInterrupt){this._yielded=void 0,i();continue}return Pa}}catch(a){if(!A(s,Ge))return zr(`Fiber.runLoop: Not a valid effect: ${String(s)}`);s=zr(a)}}finally{this._running=n,globalThis[zi]=r}}getCont(t){if(this._deferredInterrupt)return this._deferredInterrupt=!1,Rz;for(;;){let r=this._stack.pop();if(!r)return;let n=r[Oa];if(n!==void 0){let o=n.call(r,this);if(o)return o[t]=o,o}if(r[t])return r}}succeedWith(t){if((++this.currentOpCount&$z-1)===0)return Fe(t);let r=this.getCont(Ot);return r?r[Ot](t,this):this.yieldWith(Fe(t))}yieldWith(t){return this._yielded=t,Pa}children(){return this._children??=new Set}pipe(){return te(this,arguments)}setContext(t){let r=this.context;if(this.context=t,r!==void 0&&gk(r,t))return;let n=t.cacheRoot,o=n._fiberCache??=Fz(t);this.cache?.scheduler!==o.scheduler&&(this._dispatcher=void 0),this.cache=o}get currentSpanLocal(){let t=this.cache.span;return t?._tag==="Span"?t:void 0}},Fz=e=>{let t=If(e,Iy);return{scheduler:ct(e,Of),tracer:t,tracerContext:t?t.context:void 0,tracerEnabled:ct(e,Gd),span:If(e,by),logLevel:ct(e,wy),minimumLogLevel:ct(e,Kd),stackFrame:ct(e,Ff),runtimeMetrics:If(e,Xk),maxOpsBeforeYield:ct(e,Hk),preventYield:ct(e,Wk)}},Rz={[Ot](e,t){return Ue(t._interruptedCause)},[Br](e,t){return Ue(t._interruptedCause)}},$z=32,_y={interruptChildren:void 0},cm=e=>{if(!e.cache.stackFrame)return;let t=new Map;return t.set(Vx.key,e.cache.stackFrame),rc(t)},Nz=e=>{if(!(e._children===void 0||e._children.size===0))return fc(e._children)},yA=e=>{let t=e;return t._exit?D(t._exit):qt(r=>t._exit?r(D(t._exit)):G(e.addObserver(n=>r(D(n)))))},um=e=>qt(t=>{let r=e[Symbol.iterator](),n=[],o;function s(){let a=r.next();for(;!a.done;){if(a.value._exit){n.push(a.value._exit),a=r.next();continue}o=a.value.addObserver(i=>{n.push(i),s()});return}t(D(n))}return s(),G(()=>o?.())}),Yd=e=>{let t=e;return t._exit?t._exit:qt(r=>t._exit?r(t._exit):G(e.addObserver(r)))};var Df=e=>ie(t=>SA(e,t.id)),SA=m(e=>A(e[0],Wy),(e,t,r)=>ie(n=>{let o=cm(n);return o=o&&r?$a(o,r):o??r,e.interruptUnsafe(t,o),Bf(yA(e))})),fc=e=>ie(t=>{let r=cm(t),n=Ma();for(let o of e)o.interruptUnsafe(t.id,r),n.push(o);return Bf(um(n))});var D=Fe,Ue=ir,Xe=sn,G=on({op:"Sync",[Ge](e){let t=this[ue](),r=e.getCont(Ot);return r?r[Ot](t,e):e.yieldWith(Fe(t))}}),se=on({op:"Suspend",[Ge](e){return this[ue]()}}),Vy=m(e=>e.length>=2||Od(e[0]),(e,t)=>Ke(e)?Xe(t?t():new to("Effect.fromOption: Option.none")):D(e.value)),hc=xr({onFailure:Xe,onSuccess:D}),EA=e=>e==null?Xe(new to):D(e),Gy=on({op:"Yield",[Ge](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(fr)},this[ue]??0),e.yieldWith(()=>{t=!0})}}),gc=Gy(0),Ky=e=>D(R(e)),Lf=D(v()),bA=e=>Ke(e)?Lf:Oe(e.value,R),IA=e=>se(()=>Ue(e())),Us=e=>zr(e),fm=e=>se(()=>Xe(e())),he=D(void 0);var CA=e=>{let t=typeof e=="function"?e:e.try,r=typeof e=="function"?n=>new pc(n,"An error occurred in Effect.try"):e.catch;return se(()=>{try{return D(t())}catch(n){return Xe(r(n))}})};var Jy=e=>Zy(function(t,r){e(r).then(n=>t(D(n)),n=>t(Us(n)))},e.length!==0),TA=e=>{let t=typeof e=="function"?e:e.try,r=typeof e=="function"?n=>new pc(n,"An error occurred in Effect.tryPromise"):e.catch;return Zy(function(n,o){let s=a=>se(()=>{try{return Xe(Ps(()=>r(a)))}catch(i){return Us(i)}});try{t(o).then(a=>n(D(a)),a=>n(s(a)))}catch(a){n(s(a))}},t.length!==0)},wA=e=>ie(t=>e(t.id)),kA=ie(D),AA=wA(D),Zy=(function(){let e=jr({op:"Async",[Ge](r){let n=!1,o=!1,s=this.withSignal?new AbortController:void 0,a=this.register.call(r.cache.scheduler,i=>{n||(n=!0,o?r.evaluate(i):o=i)},s?.signal);return o!==!1?o:(o=!0,r._yielded=()=>{n=!0},s===void 0&&a===void 0?Pa:(r._stack.push(Mz(()=>(n=!0,s?.abort(),a??fr))),Pa))}}),t=function(r,n){this.register=r,this.withSignal=n};return t.prototype=e,function(r,n){return new t(r,n)}})(),Mz=on({op:"AsyncFinalizer",[Oa](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Kf))},[Br](e,t){return Hy(e)?Q(vv(ir(e),this[ue]()),()=>Ue(e)):Ue(e)}}),qt=e=>Zy(e,e.length>=2),lm=qt(Lo),vA=(...e)=>{if(e.length===1){let n=e[0];return se(()=>za(n()))}let[t,r]=e;return se(()=>za(r.call(t.self)))},Qy=(e,...t)=>{let r=t.length===0?function(){return se(()=>za(e.apply(this,arguments)))}:function(){let n=se(()=>za(e.apply(this,arguments)));for(let o=0;o<t.length;o++)n=t[o](n,...arguments);return n};return Yy(e.length,r)},Yy=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),rA=ky(2),OA=function(){let e=typeof arguments[0]=="string",t=e?arguments[0]:"Effect.fn",r=e?arguments[1]:void 0,n=In(),o;return n!==0&&(Bt(2),o=new globalThis.Error,Bt(n)),e?(s,...a)=>nA(t,s,o,a,e,r):nA(t,arguments[0],o,Array.prototype.slice.call(arguments,1),e,r)},nA=(e,t,r,n,o,s)=>{let a=typeof t=="function"?t:n.shift().bind(t.self),i=`${e} (definition)`,c=r?rA(()=>r.stack):nn;return Yy(a.length,function(...f){let u=se(()=>{let h=a.apply(this,arguments);return oe(h)?h:za(h)});for(let h=0;h<n.length;h++)u=n[h](u,...f);if(!oe(u))return u;let l=In(),p;return l!==0&&(Bt(2),p=new globalThis.Error,Bt(l)),Jo(o?Uf(e,s,h=>Ny(u,h)):u,Ff,h=>({name:e,stack:p?rA(()=>p.stack):nn,parent:{name:i,stack:c,parent:h}}))})},_A=(e,...t)=>Yy(e.length,t.length===0?function(){return oA(()=>e.apply(this,arguments))}:function(){let r=oA(()=>e.apply(this,arguments));for(let n of t)r=n(r,...arguments);return r}),oA=e=>{try{let t=e(),r;for(;;){let n=t.next(r);if(n.done)return D(n.value);let o=n.value;if(o&&o._tag==="Success"){r=o.value;continue}else{if(o&&o._tag==="Failure")return n.value;{let s=!0;return se(()=>s?(s=!1,Q(n.value,a=>za(t,a))):se(()=>za(e())))}}}}catch(t){return Us(t)}},za=(function(){let e=jr({op:"Iterator",[Ot](r,n){let o=this.iterator;for(;;){let s=o.next(r);if(s.done)return D(s.value);if($e(s.value)){if(s.value._tag==="Failure")return s.value}else return n._stack.push(this),s.value;r=s.value.value}},[Ge](r){return this[Ot](this.initial,r)}}),t=function(r,n){this.iterator=r,this.initial=n};return t.prototype=e,function(r,n){return new t(r,n)}})(),yr=m(2,(e,t)=>new Ko(e,Xy,D(t))),pm=function(e){return e._stack.push(this),this[ue]},Uz=jr({op:"OnSuccess",[Ge]:pm}),Ko=function(e,t,r){this[ue]=e,this[Ot]=t,this.payload=r};Ko.prototype=Uz;var Xy=function(){return this.payload},PA=function(e,t){return t.succeedWith(this.payload)},dm=(()=>{let e=In();if(e===0)return!1;let t="~effect/Effect/stackProbe",r={[t]:function(){return new Error}};Bt(1);let n=r[t]();return Bt(e),n.stack?.includes("[as "+t+"]")===!0})(),Dz=function(e,t){let r=this.payload;return t.succeedWith(dm?r(e):Ps(()=>r(e)))},FA=function(e){let t=this.payload;return t(e)},Lz=function(e){let t=this.payload;return new Ko(t(e),PA,e)},Bz=function(e){return new Ko(this.payload,PA,e)},mm=e=>Oe(e,R),RA=e=>yc(e,{onFailure:D,onSuccess:Xe}),ho=m(2,(e,t)=>new Ko(e,oe(t)?Xy:FA,t)),qa=m(2,(e,t)=>new Ko(e,oe(t)?Bz:Lz,t)),Bf=e=>new Ko(e,Xy,fr),$A=e=>Wr(e,Xe),eS=(e,t)=>ie(r=>{let n=new Set;return Ec(r,()=>n.size===0?void 0:fc(n)),qt(o=>{let s=rr(e),a=s.length,i=0,c=!1,f=[],u=(l,p,h)=>{if(i++,l._tag==="Failure"){f.push(...l.cause.reasons),i>=a&&o(Ue(jo(f)));return}let g=!c;c=!0,o(l),g&&t?.onWinner&&t.onWinner({fiber:p,index:h,parentFiber:r})};for(let l=0;l<a;l++){let p=Va(r,s[l],!0,!0,!1);if(n.add(p),p.addObserver(h=>{n.delete(p),u(h,p,l)}),c)break}})}),tS=(e,t)=>ie(r=>{let n=new Set;return Ec(r,()=>n.size===0?void 0:fc(n)),qt(o=>{let s=!1,a=0;for(let i of e){if(s)break;let c=a++,f=Va(r,i,!0,!0,!1);n.add(f),f.addObserver(u=>{n.delete(f);let l=!s;s=!0,o(u),l&&t?.onWinner&&t.onWinner({fiber:f,index:c,parentFiber:r})})}})}),NA=m(e=>oe(e[1]),(e,t,r)=>eS([e,t],r)),rS=m(e=>oe(e[1]),(e,t,r)=>tS([e,t],r)),Q=m(2,(e,t)=>new Ko(e,FA,t)),MA=m(2,(e,t)=>$e(e)?e._tag==="Success"?t.onSuccess(e.value):t.onFailure(e.cause):po(e,t)),$e=e=>e[va]!==void 0,UA=m(2,(e,t)=>$e(e)?e._tag==="Success"?t(e.value):e:Q(e,t)),DA=e=>Q(e,F),Oe=m(2,(e,t)=>new Ko(e,Dz,t)),LA=m(2,(e,t)=>$e(e)?VA(e,t):Oe(e,t)),BA=m(2,(e,t)=>$e(e)?GA(e,t):uS(e,t)),jA=m(2,(e,t)=>$e(e)?KA(e,t):fS(e,t)),zA=m(2,(e,t)=>{if($e(e)){if(e._tag==="Success")return e;let r=Cn(e.cause);return Se(r)?e:t(r.success)}return Qo(e,t)}),jf=e=>ir(dc(e)),zf=e=>e._tag==="Success";var qA=e=>e._tag==="Failure";var HA=e=>e._tag==="Failure"?H(e.cause):Z(e);var WA=e=>e._tag==="Failure"&&Hy(e.cause);var fr=Fe(void 0),VA=m(2,(e,t)=>e._tag==="Success"?Fe(t(e.value)):e),GA=m(2,(e,t)=>{if(e._tag==="Success")return e;let r=Cn(e.cause);return Se(r)?e:sn(t(r.success))}),KA=m(2,(e,t)=>{if(e._tag==="Success")return Fe(t.onSuccess(e.value));let r=Cn(e.cause);return Se(r)?e:sn(t.onFailure(r.success))});var JA=m(2,(e,t)=>zf(e)?t:e);var ZA=e=>{let t=[];for(let r of e)r._tag==="Failure"&&t.push(...r.cause.reasons);return t.length===0?fr:ir(jo(t))};var QA=e=>e,YA=e=>ie(t=>D(Rd(t.context,e))),jz=e=>ie(t=>Vy(Rd(t.context,e))),xc=m(2,(e,t)=>ie(r=>{let n=r.context,o=t(n);return n===o||(r.setContext(o),Ec(r,()=>{r.setContext(n)})),e})),Jo=m(3,(e,t,r)=>xc(e,n=>{let o=io(n,t),s=r(o);return o===s?n:tr(n,t,s)})),XA=(e,t,r)=>Wa(ie(n=>{let o=io(n.context,e),s=t(o);return n.setContext(tr(n.context,e,s)),Bs(io(n.context,Ls),a=>{let i=Rd(n.context,e);if(Ke(i))return he;let c=i.value,f;if(r?.reset===void 0){if(c!==s)return he;f=o}else f=r.reset(o,s,c);return n.setContext(tr(n.context,e,f)),he})})),nS=()=>zz,zz=ie(e=>D(e.context)),Ds=e=>ie(t=>e(t.context)),ev=m(2,(e,t)=>xc(e,at(t))),Hr=m(2,(e,t)=>$e(e)?e:xc(e,$a(t))),Sr=function(){return arguments.length===1?m(2,(e,t)=>sA(e,arguments[0],t)):m(3,(e,t,r)=>sA(e,t,r)).apply(this,arguments)},sA=(e,t,r)=>xc(e,tr(t,r)),hm=m(3,(e,t,r)=>Q(r,n=>Sr(e,t,n))),tv=m(e=>oe(e[1]),(e,t,r)=>oS(e,t,(n,o)=>[n,o],r)),oS=m(e=>oe(e[1]),(e,t,r,n)=>n?.concurrent?Oe(Jf([e,t],{concurrency:2}),([o,s])=>r(o,s)):Q(e,o=>Oe(t,s=>r(o,s)))),rv=m(e=>oe(e[0]),(e,t,r)=>wS(e,t,r?n=>Xe(r(n)):()=>Xe(new to))),nv=m(2,(e,t)=>Q(t,r=>r?mm(e):Lf)),sS=m(2,(e,t)=>Array.from({length:t},()=>e)),ov=m(e=>oe(e[0]),(e,t,r)=>Jf(sS(e,t),r)),gm=m(e=>oe(e[0]),(e,t)=>go({while:Ur,body:at(t?.disableYield?e:Q(e,r=>gc)),step:Lo})),Wr=m(2,(e,t)=>new sv(e,t.length!==1?r=>t(r):t)),qz=jr({op:"OnFailure",[Ge]:pm}),sv=function(e,t){this[ue]=e,this[Br]=t};sv.prototype=qz;var aS=m(3,(e,t,r)=>Wr(e,n=>t(n)?r(n):Ue(n))),Zo=m(3,(e,t,r)=>Wr(e,n=>{let o=t(n);return Se(o)?Ue(o.failure):r(o.success,n)})),Qo=m(2,(e,t)=>Zo(e,Cn,r=>t(r))),av=e=>yc(e,{onFailure:t=>Gx(t)?Lf:Xe(t),onSuccess:Ky}),iv=m(2,(e,t)=>Zo(e,qy,t)),cv=m(2,(e,t)=>Wr(e,r=>ho(t(r),Ue(r)))),uv=m(3,(e,t,r)=>aS(e,t,n=>ho(r(n),Ue(n)))),xm=m(3,(e,t,r)=>Wr(e,n=>{let o=t(n);return Se(o)?Ue(n):ho(r(o.success,n),Ue(n))})),iS=m(2,(e,t)=>xm(e,Cn,r=>t(r))),fv=m(3,(e,t,r)=>{let n=Array.isArray(t)?o=>A(o,"_tag")&&t.includes(o._tag):Lr(t);return iS(e,o=>n(o)?r(o):he)}),lv=m(2,(e,t)=>xm(e,qy,r=>t(r))),qf=m(e=>oe(e[0]),(e,t,r,n)=>Wr(e,o=>{let s=Cn(o);return Se(s)?Ue(s.failure):t(s.success)?r(s.success):n?n(s.success):Ue(o)})),ym=m(e=>oe(e[0]),(e,t,r,n)=>Wr(e,o=>{let s=Cn(o);if(Se(s))return Ue(s.failure);let a=t(s.success);return Se(a)?n?n(a.failure):Ue(o):r(a.success)})),cS=m(e=>oe(e[0]),(e,t,r,n)=>{let o=Array.isArray(t)?s=>A(s,"_tag")&&t.includes(s._tag):Lr(t);return qf(e,o,r,n)}),pv=m(e=>oe(e[0]),(e,t,r)=>{let n;return ym(e,o=>(n??=Object.keys(t),A(o,"_tag")&&En(o._tag)&&n.includes(o._tag)?H(o):Z(o)),o=>t[o._tag](o),r)}),dv=m(e=>oe(e[0]),(e,t,r,n,o)=>qf(e,s=>Lr(s,t)&&A(s,"reason")&&(o!==void 0||Lr(s.reason,r)),s=>{let a=s.reason;return Lr(a,r)?n(a,s):o?o(a,s):Xe(s)})),mv=m(e=>oe(e[0]),(e,t,r,n)=>{let o;return qf(e,s=>Lr(s,t)&&A(s,"reason")&&A(s.reason,"_tag")&&En(s.reason._tag)&&(n!==void 0||(o??=Object.keys(r)).includes(s.reason._tag)),s=>{let a=s.reason;return o??=Object.keys(r),o.includes(a._tag)?r[a._tag](a,s):n?n(a,s):Xe(s)})}),hv=m(2,(e,t)=>ym(e,r=>Lr(r,t)&&A(r,"reason")?H(r.reason):Z(r),Xe)),uS=m(2,(e,t)=>Qo(e,r=>fm(()=>t(r)))),fS=m(2,(e,t)=>yc(e,{onFailure:r=>fm(()=>t.onFailure(r)),onSuccess:r=>G(()=>t.onSuccess(r))})),lS=e=>Qo(e,Us),gv=m(2,(e,t)=>Qo(e,r=>G(()=>t(r)))),xv=e=>se(()=>{let t=e[Symbol.iterator](),r=t.next();if(r.done)return Us(new Error("Received an empty collection of effects"));function n(o){let s=t.next();return s.done?o.value:Qo(o.value,a=>n(s))}return n(r)}),pS=e=>Qo(e,t=>Q(gc,()=>pS(e))),yv=m(e=>oe(e[0]),(e,t)=>{if(!t?.log)return yc(e,{onFailure:n=>he,onSuccess:n=>he});let r=Tn(t.log===!0?void 0:t.log);return po(e,{onFailure(n){let o=uA(n);return Se(o)?Ue(o.failure):t.message===void 0?r(n):r(t.message,n)},onSuccess:n=>he})}),Sm=m(e=>oe(e[0]),(e,t)=>{if(!t?.log)return po(e,{onFailure:n=>he,onSuccess:n=>he});let r=Tn(t.log===!0?void 0:t.log);return po(e,{onFailure:n=>t.message===void 0?r(n):r(t.message,n),onSuccess:n=>he})}),Sv=e=>Em(e,{onFailure:v,onSuccess:R}),Ms=e=>Hf(e,{onFailure:Z,onSuccess:H}),po=m(2,(e,t)=>new Ev(e,t.onSuccess.length!==1?r=>t.onSuccess(r):t.onSuccess,t.onFailure.length!==1?r=>t.onFailure(r):t.onFailure)),Hz=jr({op:"OnSuccessAndFailure",[Ge]:pm}),Ev=function(e,t,r){this[ue]=e,this[Ot]=t,this[Br]=r};Ev.prototype=Hz;var Wz=function(e,t){let r=this.payload;return t.succeedWith(dm?r.onSuccess(e):Ps(()=>r.onSuccess(e)))},bv=(e,t)=>{let r=jr({op:e,[Ge]:pm,[Ot]:Wz,[Br]:t}),n=function(o,s){this[ue]=o,this.payload=s};return n.prototype=r,n},Vz=bv("Match",function(e,t){let r=e.reasons.find(no);if(r===void 0)return Ue(e);let n=this.payload;return t.succeedWith(dm?n.onFailure(r.error):Ps(()=>n.onFailure(r.error)))}),Gz=bv("MatchCause",function(e,t){let r=this.payload;return t.succeedWith(dm?r.onFailure(e):Ps(()=>r.onFailure(e)))}),dS=m(2,(e,t)=>new Gz(e,t)),yc=m(2,(e,t)=>po(e,{onFailure:r=>{let n=r.reasons.find(no);return n?t.onFailure(n.error):Ue(r)},onSuccess:t.onSuccess})),Em=m(2,(e,t)=>new Vz(e,t)),Hf=m(2,(e,t)=>{if($e(e)){if(e._tag==="Success")return Fe(t.onSuccess(e.value));let r=Cn(e.cause);return Se(r)?e:Fe(t.onFailure(r.success))}return Em(e,t)}),Iv=m(2,(e,t)=>$e(e)?e._tag==="Success"?Fe(t.onSuccess(e.value)):Fe(t.onFailure(e.cause)):dS(e,t)),Wf=e=>$e(e)?Fe(e):Kz(e),Kz=on({op:"Exit",[Ge](e){return e._stack.push(this),this[ue]},[Ot](e,t,r){return t.succeedWith(r??Fe(e))},[Br](e,t,r){return t.succeedWith(r??ir(e))}}),Cv=Hf({onFailure:()=>!0,onSuccess:()=>!1}),Tv=Hf({onFailure:()=>!1,onSuccess:()=>!0}),wv=m(2,(e,t)=>ho(bc(t),e)),mS=m(2,(e,t)=>Q(hS(e,t.duration),r=>Ke(r)?t.orElse():D(r.value))),Jz=e=>new rm(`Operation timed out after '${py(e)}'`),kv=m(2,(e,t)=>{let r=Mt(t);return mS(e,{duration:r,orElse:()=>Xe(Jz(r))})}),hS=m(2,(e,t)=>rS(mm(e),yr(bc(t),v()))),Av=e=>xo(t=>{let r=t.monotonicTimeNanosUnsafe();return Oe(e,n=>[co(t.monotonicTimeNanosUnsafe()-r),n])}),Py="~effect/Scope",Fy="~effect/Scope/Closeable",Ls=Ye("effect/Scope"),gS=(e,t)=>ie(r=>(Xz(r),bm(e,t)??he)),bm=(e,t)=>{let r=e.state;if(r._tag==="Closed"||(e.state={_tag:"Closed",exit:t},e.parent!==void 0&&em(e.parent,e),r._tag==="Empty"))return;if(r.finalizer!==void 0)return Xd(r.finalizer,t);let n=r.finalizers;return n.size===1?Xd(n.values().next().value,t):Zz(e,n,t)},Xd=(e,t)=>{try{return e(t)}catch(r){return zr(r)}},vv=(e,t)=>zf(e)?t:Wr(t,r=>Ue(Vi(e.cause,r))),Zz=Qy(function*(e,t,r){let n=[],o=[],s=Array.from(t.values()),a=mc();for(let i=s.length-1;i>=0;i--){let c=s[i];e.strategy==="sequential"?n.push(yield*Wf(Xd(c,r))):o.push(Va(a,Xd(c,r),!0,!0,"inherit"))}return o.length>0&&(n=yield*um(o)),yield*ZA(n)});var Ov=(e,t)=>{let r=Pv(t,e);return e.state._tag==="Closed"?(r.state=e.state,r):(Sc(e,r,n=>gS(r,n)),r)},Bs=(e,t)=>se(()=>e.state._tag==="Closed"?t(e.state.exit):(Sc(e,{},t),he)),_v=(e,t)=>Bs(e,at(t)),Sc=(e,t,r)=>{if(e.state._tag==="Empty")e.state={_tag:"Open",finalizerKey:t,finalizer:r,finalizers:void 0};else if(e.state._tag==="Open"){let n=e.state;n.finalizer!==void 0&&(n.finalizers=new Map([[n.finalizerKey,n.finalizer]]),n.finalizerKey=void 0,n.finalizer=void 0),n.finalizers.set(t,r)}},em=(e,t)=>{if(e.state._tag!=="Open")return;let r=e.state;r.finalizerKey===t?e.state=Ry:r.finalizers!==void 0&&(r.finalizers.delete(t),r.finalizers.size===0&&(e.state=Ry))},Im=e=>Pv(e,void 0),Pv=(e="sequential",t)=>({[Fy]:Fy,[Py]:Py,strategy:e,parent:t,state:Ry}),Ry={_tag:"Empty"};var Vf=Ls,Fv=Sr(Ls),xS=e=>ie(t=>{let r=t.context,n=Im();return t.setContext(tr(t.context,Ls,n)),Ec(t,o=>(t.setContext(r),bm(n,o))),e});var Cm=e=>se(()=>{let t=Im();return Vr(e(t),r=>se(()=>bm(t,r)??he))}),Ha=(e,t,r)=>Ds(n=>zs(o=>Q(Vf,s=>qa(r?.interruptible?o(e):e,a=>Bs(s,i=>Hr(t(a,i),n)))))),yS=e=>Q(Vf,t=>Ds(r=>Bs(t,n=>Hr(e(n),r)))),Rv=(function(){let e=jr({op:"OnExit",[Ge](r){return r._stack.push(this),this.effect},[Oa](r){r.interruptible&&this.interruptible!==!0&&(r._stack.push(Kf),r.interruptible=!1)},[Ot](r,n,o){o??=Fe(r);let s;try{s=this.onExit(o)}catch(a){s=zr(a)}return s?Q(s,a=>o):o},[Br](r,n,o){o??=ir(r);let s;try{s=this.onExit(o)}catch(a){s=zr(a)}return s?Q(vv(o,s),a=>o):o}}),t=function(r,n,o){this.effect=r,this.onExit=n,this.interruptible=o};return t.prototype=e,t})(),js=(e,t,r)=>new Rv(e,t,r),Ec=(e,t)=>{e._stack.push(new Rv(void 0,t,void 0))},Vr=m(2,js),$v=m(2,(e,t)=>Vr(e,r=>t)),SS=m(3,(e,t,r)=>Vr(e,n=>t(n)?r(n):he)),ES=m(3,(e,t,r)=>Vr(e,n=>{let o=t(n);return Se(o)?he:r(o.success,n)})),bS=m(2,(e,t)=>ES(e,HA,t)),Nv=m(3,(e,t,r)=>SS(e,n=>n._tag!=="Failure"?!1:t(n.cause),n=>r(n.cause))),IS=m(3,(e,t,r)=>Vr(e,n=>{if(n._tag!=="Failure")return he;let o=t(n.cause);return Se(o)?he:r(o.success,n.cause)})),Mv=m(2,(e,t)=>IS(lA,t)(e)),Gf=(e,t,r)=>zs(n=>Q(e,o=>js(se(()=>n(t(o))),s=>r(o,s),!0))),Uv=e=>Ha(e,t=>A(t,Symbol.asyncDispose)?Jy(()=>t[Symbol.asyncDispose]()):G(()=>t[Symbol.dispose]())),CS=m(2,(e,t)=>G(()=>Dv(e,typeof t=="function"?r=>Vo(Mt(t(r))):at(Vo(Mt(t)))))),Qz=at(1/0),Dv=(e,t)=>{let r=0,n,o,s=(a,i)=>(i.awaiters++,Ec(a,()=>{if(!(--i.awaiters>0||o!==i))return o=void 0,Df(i.fiber)}),Yd(i.fiber));return[ie(a=>{if(o!==void 0)return a===o.fiber?Yd(o.fiber):s(a,o);if(n!==void 0&&(r===1/0||a.getRef(mo).currentTimeMillisUnsafe()<r))return n;n=void 0;let i=a.getRef(mo),c={fiber:new Nf(a.context),awaiters:0};o=c;let f=s(a,c);return c.fiber.evaluate(js(e,u=>{if(o!==c||(o=void 0,WA(u)))return;let l=t(u);r=l===1/0?1/0:i.currentTimeMillisUnsafe()+l,n=u})),c.fiber._exit??f}),G(()=>{n=void 0})]},Lv=m(2,(e,t)=>Oe(CS(e,t),r=>r[0])),Bv=e=>G(()=>Dv(e,Qz)[0]),jv=ie(e=>Ue(dc(e.id))),Wa=e=>ie(t=>(t.interruptible&&(t.interruptible=!1,t._stack.push(Kf)),e)),zv=on({op:"SetInterruptible",[Oa](e){if(e.interruptible=this[ue],e._interruptedCause&&e.interruptible)return()=>Ue(e._interruptedCause)}}),Kf=zv(!0),Yz=zv(!1),qv=e=>{if(e.interruptible=!0,e._stack.push(Yz),e._interruptedCause)return Ue(e._interruptedCause)},Xz=e=>{let t=e;t.interruptible&&(t.interruptible=!1,t._stack.push(Kf))};var Tm=e=>ie(t=>t.interruptible?e:qv(t)??e),zs=e=>ie(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Kf),e(Tm)):e(F)),Hv=e=>ie(t=>{if(t.interruptible)return e(F);let r=qv(t),n=e(Wa);return r??n}),Wv=Oe(Ha(G(()=>new AbortController),e=>G(()=>e.abort())),e=>e.signal),Jf=(e,t)=>Zn(e)?t?.mode==="result"?qr(e,Ms,t):qr(e,F,t):t?.discard?t.mode==="result"?qr(Object.values(e),Ms,t):qr(Object.values(e),F,t):se(()=>{let r={};return yr(qr(Object.entries(e),([n,o])=>Oe(t?.mode==="result"?Ms(o):o,s=>{U(r,n,s)}),{discard:!0,concurrency:t?.concurrency}),r)}),TS=m(e=>Zn(e[0])&&!oe(e[0]),(e,t,r)=>Oe(qr(e,(n,o)=>Ms(t(n,o)),r),n=>uy(n,F))),Vv=m(3,(e,t,r)=>{let n=rr(e);return n.length===0?G(t):se(()=>{let o=0,s=t();return Oe(go({while:()=>o<n.length,body:()=>r(s,n[o],o),step(a){s=a,o++}}),()=>s)})}),Gv=m(e=>Zn(e[0])&&!oe(e[0]),(e,t,r)=>Q(TS(e,t,{concurrency:r?.concurrency}),([n,o])=>Na(o)?Xe(o):r?.discard?he:D(n))),Kv=m(e=>Zn(e[0])&&!oe(e[0]),(e,t)=>se(()=>{let r=e[Symbol.iterator](),n=r.next();return n.done?D(v()):Jv(r,0,t,n.value)})),Jv=(e,t,r,n)=>Q(r(n,t),o=>{if(o)return D(R(n));let s=e.next();return s.done?D(v()):Jv(e,t+1,r,s.value)}),Zv=m(e=>Zn(e[0])&&!oe(e[0]),(e,t)=>se(()=>{let r=e[Symbol.iterator](),n=r.next();return n.done?D(v()):Qv(r,0,t,n.value)})),Qv=(e,t,r,n)=>Q(r(n,t),o=>{if(Tt(o))return D(R(o.success));let s=e.next();return s.done?D(v()):Qv(e,t+1,r,s.value)}),go=on({op:"While",[Ot](e,t){return this[ue].step(e),this[ue].while()?(t._stack.push(this),this[ue].body()):fr},[Ge](e){return this[ue].while()?(e._stack.push(this),this[ue].body()):fr}}),qr=m(e=>typeof e[1]=="function",(e,t,r)=>se(()=>{let n=Zf(r?.concurrency);if(n===1)return eq(e,t,r);let o=rr(e),s=o.length;if(s===0)return r?.discard?he:D([]);let a=r?.discard?void 0:new Array(s),i=tq({f:t,out:a},o,{concurrency:n});return i?yr(i,a):D(a)})),Yv=e=>Q(e,t=>{let r=t[Symbol.iterator]().next();return r.done?Xe(new to):D(r.value)}),eq=(e,t,r)=>se(()=>{let n=r?.discard?void 0:[],o=e[Symbol.iterator](),s=o.next(),a=0;return yr(go({while:()=>!s.done,body:()=>t(s.value,a++),step:i=>{n&&n.push(i),s=o.next()}}),n)}),Zf=e=>e==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,e??1),wm=()=>e=>{let t=e.onItem,r=e.step,n=(s,a,i,c,f)=>Q(Wf(f),u=>r(s,a[i],u,i)??o(s,a,i+1,c)??he),o=(s,a,i=0,c=a.length)=>{for(;i<c;i++){let f=a[i],u=t(s,f,i);if(!$e(u))return n(s,a,i,c,u);let l=r(s,f,u,i);if(l)return l._tag==="Failure"?l:void 0}};return o},Xv=e=>{let t=e.onItem,r=e.step;return(n,o,s)=>{let a=0,i=s.end??o.length,c=s.concurrency,f=!1,u,l,p,h,g,x=T=>{let w=zr(T);return h=w,f=!0,l&&l.size>0?Q(Wa(fc(Array.from(l))),()=>h??w):w},b=()=>{let T=!1;for(;!h&&a<i;a++){let w=o[a],P=g??t(n,w,a);if($e(P)){if(h=r(n,w,P,a),h)break}else if(u){g=void 0;let O=Va(u,P,!0,!0,"inherit");if(O._exit){if(h=r(n,w,O._exit,a),h)break;continue}l.add(O);let d=a;if(O.addObserver(S=>{l.delete(O);try{if(h){if(S._tag==="Failure"){let E=S.cause.reasons.filter(I=>I._tag!=="Interrupt");if(E.length>0){let I=jo(E);h=ir(h._tag==="Failure"?Vi(h.cause,I):I)}}}else{let E=r(n,w,S,d);E&&(h=E,b())}if(T){let E=b();E&&p(E)}else f&&l.size===0&&p(h??he)}catch(E){p(x(E))}}),l.size<c)continue;T=!0,a++;return}else return qt(O=>{u=mc(),l=new Set,g=P,p=O;let d;try{d=b()}catch(S){return O(x(S))}return d?O(d):se(()=>(h??=fr,Q(l?fc(l):he,()=>h?._tag==="Failure"?h:he)))})}if(f=!0,h){if(l&&l.size>0){let w=cm(u);l.forEach(P=>P.interruptUnsafe(u.id,w));return}if(p||h._tag==="Failure")return h}else if(p)if(l)l.size===0&&p(he);else return fr};return b()}},km=()=>e=>Xv(e),tq=Xv({onItem(e,t,r){return e.f(t,r)},step(e,t,r,n){if(r._tag==="Failure")return r;e.out&&(e.out[n]=r.value)}}),wS=m(3,(e,t,r)=>Q(e,n=>t(n)?D(n):r(n))),kS=m(3,(e,t,r)=>Q(e,n=>{let o=t(n);return Se(o)?r(o.failure):D(o.success)})),eO=m(e=>oe(e[0]),(e,t,r)=>kS(e,t,r?n=>Xe(r(n)):()=>Xe(new to))),tO=m(e=>Zn(e[0])&&!oe(e[0]),(e,t,r)=>se(()=>{let n=[];return yr(qr(e,(o,s)=>{let a=t(o,s);return typeof a=="boolean"?(a&&n.push(o),he):Oe(a,i=>{i&&n.push(o)})},{discard:!0,concurrency:r?.concurrency}),n)})),rO=m(e=>Zn(e[0])&&!oe(e[0]),(e,t)=>se(()=>{let r=[];for(let n of e){let o=t(n);Tt(o)&&r.push(o.success)}return D(r)})),nO=m(e=>Zn(e[0])&&!oe(e[0]),(e,t,r)=>se(()=>{let n=[];return yr(qr(e,o=>Oe(t(o),s=>{Tt(s)&&n.push(s.success)}),{discard:!0,concurrency:r?.concurrency}),n)})),oO=D({}),sO=Jw(Oe),aO=Zw(Oe,Q),iO=Kw(Oe);var cO=m(e=>oe(e[0]),(e,t)=>ie(r=>(gq(),D(Va(r,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),Va=(e,t,r=!1,n=!1,o=!1)=>{let s=e,a=o==="inherit"?s.interruptible:!o,i=new Nf(s.context,a);return n||(s.children().add(i),i._parent=s),r?i.evaluate(t):(i._asyncContext=xA(),s.currentDispatcher.scheduleTask(()=>i.evaluate(t),0)),i},uO=m(e=>oe(e[0]),(e,t)=>ie(r=>D(Va(r,e,t?.startImmediately,!0,t?.uninterruptible)))),fO=e=>ie(t=>{let r=t._children&&new Set(t._children),n=t.interruptible;return js(e,o=>{let s=t._children;if(s===void 0||s.size===0)return he;r&&(s=wk(s,i=>!r.has(i)));let a=Bf(um(s));return n?Tm(a):a})}),AS=m(e=>oe(e[0]),(e,t,r)=>ie(n=>{let o=Va(n,e,r?.startImmediately,!0,r?.uninterruptible);if(!o._exit)if(t.state._tag!=="Closed"){let s={};Sc(t,s,()=>wA(i=>i===o.id?he:Df(o))),o.addObserver(()=>em(t,s))}else o.interruptUnsafe(n.id,cm(n));return D(o)})),lO=m(e=>oe(e[0]),(e,t)=>Q(Vf,r=>AS(e,r,t))),Yo=e=>(t,r)=>{let n=new Nf(r?.scheduler?tr(e,Of,r.scheduler):e,r?.uninterruptible!==!0);if(n.evaluate(t),n._exit)return n;if(r?.signal)if(r.signal.aborted)n.interruptUnsafe();else{let o=()=>n.interruptUnsafe();r.signal.addEventListener("abort",o,{once:!0}),n.addObserver(()=>r.signal.removeEventListener("abort",o))}return r?.onFiberStart&&r.onFiberStart(n),n},pO=m(2,(e,t)=>e._exit?e:t.state._tag==="Closed"?(e.interruptUnsafe(e.id),e):(em(t,e),Sc(t,e,()=>Df(e)),e.addObserver(()=>em(t,e)),e)),dO=Yo(cr()),vS=e=>{let t=Yo(e);return(r,n)=>{let o=t(r,n);return n?.onExit&&o.addObserver(n.onExit),s=>o.interruptUnsafe(s)}},mO=vS(cr()),Am=e=>{let t=Yo(e);return(r,n)=>{let o=t(r,n);return new Promise(s=>{o.addObserver(a=>s(a))})}},hO=Am(cr()),OS=e=>{let t=Am(e);return(r,n)=>t(r,n).then(o=>{if(o._tag==="Failure")throw am(o.cause);return o.value})},gO=OS(cr()),vm=e=>{let t=Yo(e);return r=>{if($e(r))return r;let n=new La("sync"),o=t(r,{scheduler:n});return o._dispatcher?.flush(),o._exit??zr(new om(o))}},xO=vm(cr()),_S=e=>{let t=vm(e);return r=>{let n=t(r);if(n._tag==="Failure")throw am(n.cause);return n.value}},yO=_S(cr()),aA=D(!0),iA=D(!1),$y=class{waiters=[];scheduled=void 0;_isOpen;constructor(t){this._isOpen=t}scheduleUnsafe(t){if(this.waiters.length===0)return aA;if(this.scheduled===void 0)this.scheduled=this.waiters,t.currentDispatcher.scheduleTask(this.flushScheduled,0);else for(let r=0;r<this.waiters.length;r++)this.scheduled.push(this.waiters[r]);return this.waiters=[],aA}flushScheduled=()=>{if(this.scheduled===void 0)return;let t=this.scheduled;this.scheduled=void 0;for(let r=0;r<t.length;r++)t[r](fr)};flushWaiters(){let t=this.waiters;this.waiters=[],this.flushScheduled();for(let r=0;r<t.length;r++)t[r](fr)}open=ie(t=>this._isOpen?iA:(this._isOpen=!0,this.scheduleUnsafe(t)));release=ie(t=>this._isOpen?iA:this.scheduleUnsafe(t));openUnsafe(){return this._isOpen?!1:(this._isOpen=!0,this.flushWaiters(),!0)}await=qt(t=>this._isOpen?t(he):(this.waiters.push(t),G(()=>{let r=this.waiters.indexOf(t);r!==-1?this.waiters.splice(r,1):this.scheduled!==void 0&&(r=this.scheduled.indexOf(t),r!==-1&&this.scheduled.splice(r,1))})));closeUnsafe(){return this._isOpen?(this._isOpen=!1,!0):!1}close=G(()=>this.closeUnsafe());whenOpen=t=>Q(this.await,()=>t);isOpen(){return this._isOpen}},SO=e=>new $y(e??!1);var EO=ie(e=>D(e.getRef(Cy))),bO=m(2,(e,t)=>Sr(e,Cy,t)),IO=Sr(Gd),CO=Sr(uc),tm=BigInt(0),rq={_tag:"Span",spanId:"noop",traceId:"noop",sampled:!1,status:{_tag:"Ended",startTime:tm,endTime:tm,exit:fr},attributes:new Map,links:[],kind:"internal",attribute(){},event(){},end(){},addLinks(){}},nq=e=>Object.assign(Object.create(rq),e),TO=e=>e?ct(e.annotations,Vd)?e._tag==="Span"?TO(er(e.parent)):v():R(e):v(),PS=(e,t,r)=>{let n=!e.cache.tracerEnabled||r?.annotations&&ct(r.annotations,Vd),o=r?.parent!==void 0?R(r.parent):r?.root?v():TO(e.cache.span),s;if(n)s=nq({name:t,parent:o,annotations:tr(r?.annotations??cr(),Vd,!0)});else{let a=e.cache.tracer??Ty,i=e.getRef(mo),c=e.getRef(uc),f=e.getRef(Rf),u=e.getRef($f),l=r?.level??e.getRef(Zk),p=r?.links!==void 0?[...u,...r.links]:u.length===0?[]:u.slice();s=a.span({name:t,parent:o,annotations:r?.annotations??cr(),links:p,startTime:c?i.currentTimeNanosUnsafe():tm,kind:r?.kind??"internal",root:r?.root??!1,sampled:r?.sampled??(ve(o)&&o.value.sampled===!1?!1:!LO(e.getRef(Qk),l))});for(let h in f)s.attribute(h,f[h]);if(r?.attributes!==void 0)for(let h in r.attributes)s.attribute(h,r.attributes[h])}return s},wO=(e,t)=>ie(r=>D(PS(r,e,t))),Mf=(e,t)=>Wa(ie(r=>{let n=io(r.context,Ls),o=PS(r,e,t??{}),s=r.getRef(mo),a=r.getRef(uc);return yr(Bs(n,i=>_O(o,i,s,a)),o)})),kO=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],r=Zd(e?arguments[2]:arguments[1]);if(e){let n=arguments[0];return Q(Mf(t,r),o=>lc(n,o,r))}return n=>Q(Mf(t,r),o=>lc(n,o,r))},oq=(e,t)=>(t=typeof t=="function"?t:nn,Jo(Ff,r=>({name:e,stack:t,parent:r}))),AO=Rf,vO=$f,OO=m(e=>oe(e[0]),(e,t,r={})=>{let o=(Array.isArray(t)?t:[t]).map(s=>({span:s,attributes:r}));return Jo(e,$f,s=>[...s,...o])}),_O=(e,t,r,n)=>G(()=>{e.status._tag!=="Ended"&&e.end(n?r.currentTimeNanosUnsafe():tm,t)}),Uf=(e,...t)=>{let r=t.length===1?void 0:t[0],n=t[t.length-1];return ie(o=>{let s=PS(o,e,r),a=o.getRef(mo),i=o.getRef(uc);return Ec(o,c=>_O(s,c,a,i)),n(s)})},Ny=Sr(Pf),lc=function(){let e=oe(arguments[0]),t=e?arguments[1]:arguments[0],r=e?arguments[2]:arguments[1],n=F;return t._tag==="Span"&&(r=Zd(r),n=oq(t.name,r?.captureStackTrace)),e?Ny(n(arguments[0]),t):o=>Ny(n(o),t)},PO=function(){let e=typeof arguments[0]!="string",t=e?arguments[1]:arguments[0],r=Zd(arguments[2]);if(e){let s=arguments[0];return Uf(t,arguments[2],a=>lc(s,a,r))}let n=typeof arguments[1]=="function"?arguments[1]:void 0,o=n?void 0:arguments[1];return(s,...a)=>Uf(t,n?n(...a):o,i=>lc(s,i,r))},FO=m(e=>oe(e[0]),(e,...t)=>Jo(e,Rf,r=>{let n=t.length===1?{...r,...t[0]}:{...r};return t.length===1||U(n,t[0],t[1]),n})),RO=(...e)=>ie(t=>{let r=t.currentSpanLocal;if(r)if(e.length===1)for(let[n,o]of Object.entries(e[0]))r.attribute(n,o);else r.attribute(e[0],e[1]);return he}),$O=ie(e=>{let t=e.currentSpanLocal;return t?D(t):Xe(new to)}),NO=jz(Pf),mo=ge("effect/Clock",{defaultValue:()=>new My}),Ay=2**31-1,My=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=G(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return sq()}currentTimeNanos=G(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return UO()}monotonicTimeNanos=G(()=>this.monotonicTimeNanosUnsafe());sleep(t){return this.sleepMillis(Vo(t))}sleepMillis(t){return t<=0?gc:Number.isFinite(t)?qt(r=>{let n=t>Ay?this.sleepMillis(t-Ay):he,o=setTimeout(()=>r(n),Math.min(t,Ay));return G(()=>clearTimeout(o))}):lm}},MO=BigInt(1e6),UO=(function(){let e=globalThis.process?.hrtime;if(typeof e?.bigint=="function")return()=>e.bigint();if(typeof performance<"u"&&typeof performance.now=="function")return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(0);return()=>{let r=BigInt(Date.now())*MO;return r>t&&(t=r),t}})(),sq=(function(){let e=BigInt(1e9),t;return()=>{let r=UO(),n=BigInt(Date.now())*MO;if(t===void 0)t=n-r;else{let o=t+r;(n>o?n-o:o-n)>e&&(t=n-r)}return t+r}})(),xo=e=>ie(t=>e(t.getRef(mo))),bc=e=>xo(t=>t.sleep(Mt(e))),DO=xo(e=>e.currentTimeMillis);var Uy="~effect/Cause/TimeoutError";var rm=class extends zo("TimeoutError"){[Uy]=Uy;constructor(t){super({message:t})}},Dy="~effect/Cause/IllegalArgumentError";var nm=class extends zo("IllegalArgumentError"){[Dy]=Dy;constructor(t){super({message:t})}},Ly="~effect/Cause/ExceededCapacityError";var By=class extends zo("ExceededCapacityError"){[Ly]=Ly;constructor(t){super({message:t})}},jy="~effect/Cause/AsyncFiberError";var om=class extends zo("AsyncFiberError"){[jy]=jy;constructor(t){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:t})}},zy="~effect/Cause/UnknownError";var pc=class extends zo("UnknownError"){[zy]=zy;constructor(t,r){super({message:r,cause:t})}},FS=ge("effect/Console",{defaultValue:()=>globalThis.console}),aq=e=>{switch(e){case"All":return Number.MIN_SAFE_INTEGER;case"Fatal":return 5e4;case"Error":return 4e4;case"Warn":return 3e4;case"Info":return 2e4;case"Debug":return 1e4;case"Trace":return 0;case"None":return Number.MAX_SAFE_INTEGER}},iq=Yx(Ho,aq),LO=Yi(iq),RS=ge("effect/Logger/CurrentLoggers",{defaultValue:()=>new Set([mq,hq])}),cq=ge("effect/Logger/LogToStderr",{defaultValue:nf}),BO=function(){let e=typeof arguments[0]=="string"?[[arguments[0],arguments[1]]]:Object.entries(arguments[0]);return Wa(ie(t=>{let r=t.getRef(Go),n={...r};for(let o=0;o<e.length;o++){let[s,a]=e[o];U(n,s,a)}return t.setContext(tr(t.context,Go,n)),Bs(io(t.context,Ls),o=>{let s=t.getRef(Go),a={...s};for(let i=0;i<e.length;i++){let[c,f]=e[i];s[c]!==f&&!Object.is(s[c],f)||(Object.hasOwn(r,c)?U(a,c,r[c]):delete a[c])}return t.setContext(tr(t.context,Go,a)),he})}))},uq="~effect/Logger",fq={[uq]:{_Message:F,_Output:F},pipe(){return te(this,arguments)}},jO=e=>{let t=Object.create(fq);return t.log=e,t},lq=e=>e.replace(/[\s="]/g,"_"),pq=(e,t)=>`${lq(e[0])}=${t-e[1]}ms`;var Tn=e=>(...t)=>{let r;for(let n=0,o=t.length;n<o;n++){let s=t[n];Wi(s)&&(r?t.splice(n,1):t=t.slice(0,n).concat(t.slice(n+1)),r=r?jo(r.reasons.concat(s.reasons)):s,n--)}return r===void 0&&(r=Hx),ie(n=>{let o=e??n.cache.logLevel;if(LO(n.cache.minimumLogLevel,o))return he;let s=n.getRef(mo),a=n.getRef(RS);if(a.size>0){let i=new Date(s.currentTimeMillisUnsafe());for(let c of a)c.log({cause:r,fiber:n,date:i,logLevel:o,message:t})}return he})};var ja={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},_re={None:[],All:[],Trace:[ja.gray],Debug:[ja.blue],Info:[ja.green],Warn:[ja.yellow],Error:[ja.red],Fatal:[ja.bgBrightRed,ja.black]};var dq=e=>`${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}.${e.getMilliseconds().toString().padStart(3,"0")}`;var mq=jO(({cause:e,date:t,fiber:r,logLevel:n,message:o})=>{let s=Array.isArray(o)?o.slice():[o];e.reasons.length>0&&s.push(im(e));let a=t.getTime(),i=r.getRef(Jd),c="";for(let p of i)c+=` ${pq(p,a)}`;let f=r.getRef(Go);Object.keys(f).length>0&&s.push(f);let u=r.getRef(FS);(r.getRef(cq)?u.error:u.log)(`[${dq(t)}] ${n.toUpperCase()} (#${r.id})${c}:`,...s)}),hq=jO(({cause:e,fiber:t,logLevel:r,message:n})=>{let o=t.getRef(mo),s=t.getRef(Go),a=t.cache.span;if(a===void 0||a._tag==="ExternalSpan")return;let i={};for(let[c,f]of Object.entries(s))U(i,c,f);i["effect.fiberId"]=t.id,i["effect.logLevel"]=r.toUpperCase(),e.reasons.length>0&&(i["effect.cause"]=im(e)),a.event(Dw(Array.isArray(n)&&n.length===1?n[0]:n),o.currentTimeNanosUnsafe(),i)});function gq(){_y.interruptChildren??=Nz}var $S=D(void 0);var zO=m(e=>oe(e[0]),(e,t)=>bS(e,r=>ie(n=>(xq(n,r,t?.defectsOnly),he)))),xq=(e,t,r)=>{let n=e.getRef(eA);if(n.size===0||r&&!fA(t))return;let o={cause:t,fiber:e,timestamp:e.getRef(mo).currentTimeNanosUnsafe()};n.forEach(s=>s.report(o))};var qO=Wi,HO=jw,Om=no;var Qf=jo;var WO=xf,Yf=Wx;var NS=e=>new _a(e),MS=e=>new mf(e),VO=cA,_m=sm,qs=pA;var Xf=am;var GO=im;var US=Hw;var Pm=Gi,Ft=Vw;var Fm=nm;var KO=pc;var pe={};Kn(pe,{Do:()=>bH,Transaction:()=>Oc,TypeId:()=>dH,abortSignal:()=>OW,acquireDisposable:()=>EW,acquireRelease:()=>fn,acquireUseRelease:()=>CP,addFinalizer:()=>th,all:()=>uP,andThen:()=>es,annotateCurrentSpan:()=>BW,annotateLogs:()=>xV,annotateLogsScoped:()=>yV,annotateSpans:()=>LW,as:()=>wr,asSome:()=>dP,asVoid:()=>xE,awaitAllChildren:()=>eV,bind:()=>TH,bindTo:()=>IH,cached:()=>wE,cachedInvalidateWithTTL:()=>kW,cachedWithTTL:()=>wW,callback:()=>or,catch:()=>vn,catchCause:()=>br,catchCauseFilter:()=>DH,catchCauseIf:()=>UH,catchDefect:()=>gP,catchEager:()=>Il,catchFilter:()=>xl,catchIf:()=>NH,catchNoSuchElement:()=>MH,catchReason:()=>FH,catchReasons:()=>RH,catchTag:()=>ts,catchTags:()=>yE,clockWith:()=>Bc,context:()=>Xm,contextWith:()=>bP,currentParentSpan:()=>zW,currentSpan:()=>jW,delay:()=>yP,die:()=>sr,effectify:()=>et,ensuring:()=>$c,eventually:()=>qH,exit:()=>Vs,fail:()=>C,failCause:()=>Qa,failCauseSync:()=>Ws,failSync:()=>mE,fiber:()=>tV,fiberId:()=>rV,filter:()=>EE,filterMap:()=>oW,filterMapEffect:()=>EP,filterMapOrElse:()=>aW,filterMapOrFail:()=>cW,filterOrElse:()=>sW,filterOrFail:()=>iW,findFirst:()=>xH,findFirstFilter:()=>yH,firstSuccessOf:()=>QH,flatMap:()=>L,flatMapEager:()=>Rt,flatten:()=>pP,flip:()=>PH,fn:()=>uV,fnUntraced:()=>B,fnUntracedEager:()=>AE,forEach:()=>Za,forever:()=>Co,forkChild:()=>kE,forkDetach:()=>XW,forkIn:()=>Uc,forkScoped:()=>Dc,fromNullishOr:()=>OH,fromOption:()=>AH,fromResult:()=>gl,gen:()=>Ut,head:()=>SH,ignore:()=>Rc,ignoreCause:()=>GH,interrupt:()=>Xa,interruptible:()=>AW,interruptibleMask:()=>vW,isEffect:()=>Tr,isFailure:()=>mW,isSuccess:()=>hW,let:()=>CH,linkSpans:()=>WW,log:()=>fV,logDebug:()=>mV,logError:()=>oh,logFatal:()=>lV,logInfo:()=>dV,logTrace:()=>hV,logWarning:()=>pV,logWithLevel:()=>OP,makeSpan:()=>kP,makeSpanScoped:()=>VW,map:()=>re,mapBoth:()=>LH,mapBothEager:()=>Wt,mapEager:()=>ei,mapError:()=>wt,mapErrorEager:()=>bl,match:()=>Gs,matchCause:()=>lW,matchCauseEager:()=>pW,matchCauseEffect:()=>yl,matchCauseEffectEager:()=>dW,matchEager:()=>fW,matchEffect:()=>bE,never:()=>Zm,onError:()=>Nc,onErrorFilter:()=>IW,onErrorIf:()=>bW,onExit:()=>Io,onExitFilter:()=>TW,onExitIf:()=>CW,onExitPrimitive:()=>rh,onInterrupt:()=>TP,option:()=>_H,orDie:()=>rs,orElseSucceed:()=>ZH,partition:()=>mH,promise:()=>fP,provide:()=>IE,provideContext:()=>ns,provideService:()=>bo,provideServiceEffect:()=>CE,race:()=>nW,raceAll:()=>SP,raceAllFirst:()=>rW,raceFirst:()=>Ya,reduce:()=>hH,repeat:()=>_W,repeatOrElse:()=>PW,replicate:()=>FW,replicateEffect:()=>RW,request:()=>QW,requestUnsafe:()=>YW,result:()=>gE,retry:()=>HH,retryOrElse:()=>WH,runCallback:()=>oV,runCallbackWith:()=>nV,runFork:()=>To,runForkWith:()=>Lc,runPromise:()=>AP,runPromiseExit:()=>nh,runPromiseExitWith:()=>sV,runPromiseWith:()=>vP,runSync:()=>aV,runSyncExit:()=>wo,runSyncExitWith:()=>cV,runSyncWith:()=>iV,sandbox:()=>VH,satisfiesErrorType:()=>_V,satisfiesServicesType:()=>PV,satisfiesSuccessType:()=>OV,schedule:()=>$W,scheduleFrom:()=>wP,scope:()=>Sl,scoped:()=>Ks,scopedWith:()=>TE,service:()=>IP,serviceOption:()=>eh,setContext:()=>gW,sleep:()=>Ym,spanAnnotations:()=>qW,spanLinks:()=>HW,succeed:()=>y,succeedNone:()=>ml,succeedSome:()=>lP,suspend:()=>Ie,sync:()=>fe,tap:()=>Fc,tapCause:()=>Qm,tapCauseFilter:()=>zH,tapCauseIf:()=>jH,tapDefect:()=>xP,tapError:()=>SE,tapErrorTag:()=>BH,timed:()=>tW,timeout:()=>YH,timeoutOption:()=>XH,timeoutOrElse:()=>eW,tracer:()=>NW,track:()=>EV,trackDefects:()=>CV,trackDuration:()=>TV,trackErrors:()=>IV,trackSuccesses:()=>bV,transposeOption:()=>vH,try:()=>ht,tryPromise:()=>Pc,tx:()=>wV,txRetry:()=>vV,undefined:()=>EH,uninterruptible:()=>El,uninterruptibleMask:()=>Mc,unwrapReason:()=>$H,updateContext:()=>xW,updateService:()=>yW,updateServiceScoped:()=>SW,useSpan:()=>GW,validate:()=>gH,void:()=>xe,when:()=>uW,whileLoop:()=>_c,withErrorReporting:()=>JH,withExecutionPlan:()=>KH,withFiber:()=>hl,withFiberSucceed:()=>kH,withLogSpan:()=>SV,withLogger:()=>gV,withParentSpan:()=>ZW,withSpan:()=>KW,withSpanScoped:()=>JW,withTracer:()=>MW,withTracerEnabled:()=>UW,withTracerTiming:()=>DW,yieldNow:()=>hE,yieldNowWith:()=>wH,zip:()=>mP,zipWith:()=>hP});var JO=hf,Xo=Fe,yo=ir,wn=sn;var kn=fr;var ut=zf,el=qA;var yq="~effect/Deferred";var Sq={[yq]:{_A:F,_E:F},pipe(){return te(this,arguments)}},ZO=function(){this.resumes=void 0,this.effect=void 0};ZO.prototype=Sq;var Rm=()=>new ZO;var Ic=e=>qt(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),G(()=>{let r=e.resumes;if(r===void 0)return;let n=r.indexOf(t);n>=0&&r.splice(n,1)})));var DS=e=>G(()=>LS(e)),LS=e=>e.effect!==void 0;var $m=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){let r=e.resumes;e.resumes=void 0;for(let n=0;n<r.length;n++)r[n](t)}return!0};var QO=Go;var YO=Jd;var XO=Kd;var tl=Ls;var Cc=Im,rl=Fv,Nm=Bs,nl=_v;var Hs=Ov,un=gS;var o_="~effect/Layer",t_="~effect/Layer/MemoMap",Eq=(e,t)=>{let r={observers:0,deferred:Rm(),scope:Cc(),finalizer:n=>se(()=>--r.observers>0?he:(e.map.delete(t),un(r.scope,n)))};return r},r_=(e,t)=>t.state._tag==="Closed"?!1:(e.observers++,Sc(t,{},e.finalizer),!0),s_=e=>A(e,o_),bq={[o_]:{_ROut:F,_E:F,_RIn:F},pipe(){return te(this,arguments)}},a_=e=>{let t=Object.create(bq);return t.build=e,t},jS=e=>a_((t,r)=>{let n=Hs(r);return Vr(e(t,n),o=>o._tag==="Failure"?un(n,o):he)}),Iq=e=>{let t=jS((r,n)=>r.getOrElseMemoize(t,n,e));return t},Mm=class{get[t_](){return t_}parent;constructor(t){this.parent=t}map=new Map;get(t,r){let n=this.map.get(t);return n?(r_(n,r),n.deferred.effect??Ic(n.deferred)):this.parent?.get(t,r)}getOrElseMemoize(t,r,n){return se(()=>{let o;return js(se(()=>{let s=this.get(t,r);if(s)return s;let a=Eq(this,t);return r_(a,r)?(o=a.deferred,this.map.set(t,a),n(this,a.scope)):n(this,r)}),s=>{o&&$m(o,s)})})}},zS=()=>new Mm,Cq=e=>new Mm(e);var sl=class e extends Ye()("effect/Layer/CurrentMemoMap"){static forkOrCreate(t){let r=Fd(t,e);return r?Cq(r):zS()}},qS=m(3,(e,t,r)=>Sr(Oe(se(()=>e.build(t,r)),tr(sl,t)),sl,t));var i_=m(2,(e,t)=>ie(r=>qS(e,sl.forkOrCreate(r.context),t))),So=function(){return arguments.length===1?e=>Um(Wo(arguments[0],e)):Um(Wo(arguments[0],arguments[1]))},Um=e=>a_(at(D(e)));var Tc=function(){return arguments.length===1?e=>n_(arguments[0],e):n_(arguments[0],arguments[1])},n_=(e,t)=>Tq(Oe(t,r=>Wo(e,r))),Tq=e=>Iq((t,r)=>rl(e,r));var c_=(e,t,r)=>{let n=Hs(r,"parallel");return qr(e,o=>o.build(t,Hs(n,"sequential")),{concurrency:e.length}).pipe(Oe(o=>Sk(...o)))},Dm=(...e)=>jS((t,r)=>c_(e,t,r));var u_=(e,t,r)=>jS((n,o)=>Q(Array.isArray(t)?c_(t,n,o):t.build(n,o),s=>e.build(n,o).pipe(Hr(s),Oe(a=>r(a,s))))),f_=m(2,(e,t)=>u_(e,t,F)),l_=m(2,(e,t)=>u_(e,t,(r,n)=>$a(n,r)));var Lm="~effect/DateTime",Bm="~effect/DateTime/TimeZone",d_={[Lm]:Lm,pipe(){return te(this,arguments)},[qe](){return this.toString()},toJSON(){return cl(this).toJSON()}},wq={...d_,_tag:"Utc",[Y](){return dt(this.epochMilliseconds)},[X](e){return kc(e)&&e._tag==="Utc"&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${cl(this).toJSON()})`}},kq={...d_,_tag:"Zoned",[Y](){return ae(dt(this.epochMilliseconds))(q(this.zone))},[X](e){return kc(e)&&e._tag==="Zoned"&&this.epochMilliseconds===e.epochMilliseconds&&W(this.zone,e.zone)},toString(){return`DateTime.Zoned(${tE(this)})`}},m_={[Bm]:Bm,[qe](){return this.toString()}},Aq={...m_,_tag:"Named",[Y](){return Ae(`Named:${this.id}`)},[X](e){return Ga(e)&&e._tag==="Named"&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:"TimeZone",_tag:"Named",id:this.id}}},vq={...m_,_tag:"Offset",[Y](){return Ae(`Offset:${this.offset}`)},[X](e){return Ga(e)&&e._tag==="Offset"&&this.offset===e.offset},toString(){return`TimeZone.Offset(${YS(this.offset)})`},toJSON(){return{_id:"TimeZone",_tag:"Offset",offset:this.offset}}},Eo=(e,t,r)=>{let n=Object.create(kq);return n.epochMilliseconds=e,n.zone=t,Object.defineProperty(n,"partsUtc",{value:r,enumerable:!1,writable:!0}),Object.defineProperty(n,"adjustedEpochMillis",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(n,"partsAdjusted",{value:void 0,enumerable:!1,writable:!0}),n},kc=e=>A(e,Lm);var Ga=e=>A(e,Bm),h_=e=>Ga(e)&&e._tag==="Offset",g_=e=>Ga(e)&&e._tag==="Named",x_=e=>e._tag==="Utc",VS=e=>e._tag==="Zoned",y_=gr((e,t)=>e.epochMilliseconds===t.epochMilliseconds);var S_=e=>{let t=Object.create(wq);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},wc=e=>{let t=e.getTime();if(Number.isNaN(t))throw new Fm("Invalid date");return S_(t)},zm=e=>{if(kc(e))return e;if(e instanceof Date)return wc(e);if(typeof e=="object"){if("epochMilliseconds"in e)return wc(new Date(e.epochMilliseconds));let t=new Date(0);return Mq(t,e),wc(t)}else if(typeof e=="string"&&!Oq(e))return wc(new Date(e+"Z"));return wc(new Date(e))},Oq=e=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),_q=-864e13+720*60*1e3,Pq=864e13-840*60*1e3,GS=(e,t)=>{let r=t?.timeZone;if(r===void 0&&kc(e)&&VS(e))return e;let n=zm(e);if(n.epochMilliseconds<_q||n.epochMilliseconds>Pq)throw new RangeError(`Epoch millis out of range: ${n.epochMilliseconds}`);r===void 0&&typeof e=="object"&&"timeZoneId"in e&&(r=e.timeZoneId);let o;if(r===void 0){let s=new Date(n.epochMilliseconds).getTimezoneOffset()*-60*1e3;o=il(s)}else if(Ga(r))o=r;else if(typeof r=="number")o=il(r);else{let s=ZS(r);if(Ke(s))throw new Fm(`Invalid time zone: ${r}`);o=s.value}return t?.adjustForTimeZone!==!0?Eo(n.epochMilliseconds,o,n.partsUtc):Uq(n.epochMilliseconds,o,t?.disambiguation??"compatible")},HS=ao(GS),E_=ao(zm),Fq=/^(.{17,35})\[(.+)\]$/,b_=e=>{let t=Fq.exec(e);if(t===null){let o=eE(e);return o!==null?HS(e,{timeZone:o}):v()}let[,r,n]=t;return HS(r,{timeZone:n})};var I_=e=>S_(e.epochMilliseconds);var jm=new Map,Rq={day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"longOffset",fractionalSecondDigits:3,hourCycle:"h23"},$q=e=>{let t=e.resolvedOptions().timeZone,r=jm.get(t);if(r!==void 0)return r;let n=Object.create(Aq);return n.id=t,n.format=e,jm.set(t,n),n},KS=e=>{let t=jm.get(e);if(t!==void 0)return t;try{let r=$q(new Intl.DateTimeFormat("en-US",{...Rq,timeZone:e}));return jm.set(e,r),r}catch{throw new Fm(`Invalid time zone: ${e}`)}},il=e=>{let t=Object.create(vq);return t.offset=e,t},JS=ao(KS);var Nq=/^(?:GMT|[+-])/,ZS=e=>{if(Nq.test(e)){let t=eE(e);return t===null?v():R(il(t))}return JS(e)},C_=e=>e._tag==="Offset"?YS(e.offset):e.id;var cl=e=>new Date(e.epochMilliseconds),qm=e=>{if(e._tag==="Utc")return new Date(e.epochMilliseconds);if(e.zone._tag==="Offset")return new Date(e.epochMilliseconds+e.zone.offset);if(e.adjustedEpochMilliseconds!==void 0)return new Date(e.adjustedEpochMilliseconds);let t=e.zone.format.formatToParts(e.epochMilliseconds).filter(n=>n.type!=="literal"),r=new Date(0);return r.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),r.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),t[6]?.type==="fractionalSecond"?Number(t[6].value):(e.epochMilliseconds%1e3+1e3)%1e3),e.adjustedEpochMilliseconds=r.getTime(),r},QS=e=>qm(e).getTime()-XS(e),YS=e=>{let t=Math.abs(e),r=Math.floor(t/(3600*1e3)),n=Math.round(t%(3600*1e3)/(60*1e3));return n===60&&(r+=1,n=0),`${e<0?"-":"+"}${String(r).padStart(2,"0")}:${String(n).padStart(2,"0")}`},T_=e=>YS(QS(e)),XS=e=>e.epochMilliseconds;var Mq=(e,t)=>{if((t.year!==void 0||t.month!==void 0||t.day!==void 0)&&e.setUTCFullYear(t.year??e.getUTCFullYear(),t.month!==void 0?t.month-1:e.getUTCMonth(),t.day??e.getUTCDate()),t.weekDay!==void 0){let r=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+r)}t.hour!==void 0&&e.setUTCHours(t.hour),t.minute!==void 0&&e.setUTCMinutes(t.minute),t.second!==void 0&&e.setUTCSeconds(t.second),t.millisecond!==void 0&&e.setUTCMilliseconds(t.millisecond)};var p_=1440*60*1e3,Uq=(e,t,r)=>{if(t._tag==="Offset")return Eo(e-t.offset,t);let n=al(e-p_,e,t),o=al(e+p_,e,t);if(n===o)return Eo(e-n,t);let s=n<o,a=n-o;if(s){if(al(e-o,e,t)===o)return Eo(e-o,t);let f=Eo(e-n,t),u=qm(f).getTime();if(e!==u)switch(r){case"reject":{let l=new Date(e).toISOString();throw new RangeError(`Gap time: ${l} does not exist in time zone ${t.id}`)}case"earlier":return Eo(e-o,t);case"compatible":case"later":return f}return f}if(al(e-n,e,t)===n){if(r==="earlier"||r==="compatible"||al(e-n+a,e+a,t)===n)return Eo(e-n,t);if(r==="reject"){let f=new Date(e).toISOString();throw new RangeError(`Ambiguous time: ${f} occurs twice in time zone ${t.id}`)}}return Eo(e-o,t)},Dq=/([+-])(\d{2}):(\d{2})$/,eE=e=>{let t=Dq.exec(e);if(t===null)return null;let[,r,n,o]=t;return(r==="+"?1:-1)*(Number(n)*60+Number(o))*60*1e3},al=(e,t,r)=>{let n=r.format.formatToParts(e).find(s=>s.type==="timeZoneName")?.value??"";if(n==="GMT")return 0;let o=eE(n);return o===null?QS(Eo(t,r)):o};var w_=e=>cl(e).toISOString();var WS=e=>{let t=qm(e);return e._tag==="Utc"?t.toISOString():`${t.toISOString().slice(0,-1)}${T_(e)}`},tE=e=>e.zone._tag==="Offset"?WS(e):`${WS(e)}[${e.zone.id}]`;var dne=globalThis.Number;var A_=m(2,(e,t)=>{if(!globalThis.Number.isFinite(e)||!globalThis.Number.isFinite(t)||t===0)return NaN;if(globalThis.Number.isInteger(e)&&globalThis.Number.isInteger(t))return e%t;let[r,n]=k_(e),[o,s]=k_(t),a=Math.min(n,s),i=r*BigInt(10)**BigInt(n-a),c=o*BigInt(10)**BigInt(s-a),f=i%c;if(f===BigInt(0))return e<0||Object.is(e,-0)?-0:0;let u=globalThis.Number(`${f}e${a}`);return u===0?Math.sign(e)*globalThis.Number.MIN_VALUE:u});function k_(e){if(globalThis.Number.isInteger(e))return[BigInt(e),0];let t=Math.abs(e).toExponential(),r=t.indexOf("e"),n=t.slice(0,r).replace(".","");return[BigInt(n)*(e<0?-BigInt(1):BigInt(1)),globalThis.Number(t.slice(r+1))-n.length+1]}var v_=m(2,(e,t)=>{let r=Math.pow(10,t);return Math.round(e*r)/r});var mne=globalThis.String;var __=e=>e.trim();var F_=(e,t,r)=>{let n=r*(t-e)+e;if(n!==t||e>=t||!Number.isFinite(t))return n;if(t===0)return-Number.MIN_VALUE;let o=new DataView(new ArrayBuffer(8));o.setFloat64(0,t);let s=o.getBigUint64(0);return o.setBigUint64(0,t>0?s-BigInt(1):s+BigInt(1)),o.getFloat64(0)};var Er=m(2,(e,t)=>Zo(e,jq,r=>t(r))),Ac=e=>e.reasons.some(rE),rE=e=>e._tag==="Fail"&&US(e.error),Hm=e=>{let t,r=!1;for(let n of e.reasons)rE(n)?t??=n.error:n._tag!=="Interrupt"&&(r=!0);return t===void 0?Z(e):r?Z(Qf(e.reasons.filter(n=>!rE(n)))):H(t)};var jq=e=>{let t=Hm(e);return Se(t)?t:H(t.success.value)},nE=e=>{let t=Hm(e);return Se(t)?yo(t.failure):Xo(t.success.value)},Wm=m(2,(e,t)=>po(e,{onSuccess:t.onSuccess,onFailure:r=>{let n=Hm(r);return Se(n)?t.onFailure(n.failure):t.onDone(n.success.value)}}));var R_="~effect/Schedule";var Ja=ge("effect/Schedule/CurrentMetadata",{defaultValue:at({input:void 0,output:void 0,duration:sc,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),zq={[R_]:{_Out:F,_In:F,_Env:F},pipe(){return te(this,arguments)}},oE=e=>A(e,R_),ul=e=>{let t=Object.create(zq);return t.step=e,t},sE=()=>{let e=0,t,r;return(n,o)=>{r===void 0&&(r=n);let s=n-r,a=t===void 0?0:n-t;return t=n,{input:o,attempt:++e,start:r,now:n,elapsed:s,elapsedSincePrevious:a}}},qq=e=>ul(Oe(e,t=>{let r=sE();return(n,o)=>t(r(n,o))})),fl=e=>Wr(e.step,t=>D(()=>Ue(t))),Vm=e=>xo(t=>Oe(fl(e),r=>{let n=sE();return o=>se(()=>{let s=t.currentTimeMillisUnsafe();return Q(r(s,o),([a,i])=>{let c=n(s,o);return c.output=a,c.duration=i,yr(bc(i),c)})})}));var aE=e=>ul(Oe(fl(e),t=>(r,n)=>Wm(t(r,n),{onSuccess:o=>D([n,o[1]]),onFailure:Ue,onDone:()=>Ft(n)}))),$_=e=>ll(iE,({attempt:t})=>D(t<=e)),Hq=e=>{let t=Mt(e);return qq(D(r=>D([r.attempt-1,t])))};var ll=m(2,(e,t)=>ul(Oe(fl(e),r=>{let n=sE();return(o,s)=>Q(r(o,s),a=>{let[i,c]=a,f=t({...n(o,s),output:i,duration:c});return Q(oe(f)?f:D(f),u=>u?D(a):Ft(i))})})));var iE=Hq(sc);var N_="~effect/ExecutionPlan";var Wq={[N_]:N_,get captureRequirements(){let e=this;return Ds(t=>D(Vq(e.steps.map(r=>({...r,while:r.while?n=>Hr(r.while(n),t):void 0,schedule:r.schedule?ul(Hr(Oe(fl(r.schedule),n=>(o,s)=>Hr(n(o,s),t)),t)):void 0,provide:s_(r.provide)?f_(r.provide,Um(t)):r.provide})))))},pipe(){return te(this,arguments)}},Vq=e=>{let t=Object.create(Wq);return t.steps=e,t};var M_=ge("effect/ExecutionPlan/CurrentMetadata",{defaultValue:at({attempt:0,stepIndex:0})});var Gq=(e,t,r)=>Cm(n=>Q(r?.local?qS(t,zS(),n):i_(t,n),o=>Hr(e,o))),Km=m(e=>oe(e[0]),(e,t,r)=>sy(t)?Hr(e,t):Gq(e,Array.isArray(t)?Dm(...t):t,r));var L_=e=>e.reasons.every(no)?Cn(e):Z(e),cE=m(3,(e,t,r)=>Q(Vm(t),n=>{let o=Ja.defaultValue();return Zo(Er(gm(qa(Q(se(()=>Sr(e,Ja,o)),n),s=>G(()=>{o=s})),{disableYield:!0}),s=>D(s)),L_,s=>r(s,o.attempt===0?v():R(o)))})),uE=m(3,(e,t,r)=>Q(Vm(t),n=>{let o=Ja.defaultValue(),s,a=Zo(se(()=>Sr(e,Ja,o)),L_,i=>(s=i,Q(n(i),c=>(o=c,a))));return Er(a,i=>Ps(()=>r(s,i)))})),B_=m(2,(e,t)=>{let r=typeof t=="function"?t(F):oE(t)?t:dl(t);return cE(e,r,Xe)}),pl=m(2,(e,t)=>{let r=typeof t=="function"?t(F):oE(t)?t:dl(t);return uE(e,r,Xe)}),j_=m(3,(e,t,r)=>Q(Vm(r),n=>{let o=Ja.defaultValue(),s=se(()=>Sr(e,Ja,o));return Er(Q(n(t),a=>{o=a;let i=at(Q(s,n));return go({while:Ur,body:i,step(c){o=c}})}),a=>D(a))})),Kq=aE(iE),dl=e=>{let t=e.schedule?aE(e.schedule):Kq;return e.while&&(t=ll(t,({input:r})=>{let n=e.while(r);return oe(n)?n:D(n)})),e.until&&(t=ll(t,({input:r})=>{let n=e.until(r);return oe(n)?Oe(n,o=>!o):D(!n)})),e.times!==void 0&&(t=ll(t,({attempt:r})=>D(r<=e.times))),t};var Jq=(e,t)=>{let r=-1,n=0,o=s=>Sm(e(s));return{begin:xo(s=>se(()=>{let a=t();a.stepIndex!==r&&(r=a.stepIndex,n=0),n++;let i={attempt:a.attempt,stepAttempt:n,stepIndex:a.stepIndex,startNanos:s.monotonicTimeNanosUnsafe()};return yr(o({_tag:"AttemptStart",attempt:i.attempt,stepAttempt:i.stepAttempt,stepIndex:i.stepIndex}),i)})),end:(s,a)=>xo(i=>{let c=co(i.monotonicTimeNanosUnsafe()-s.startNanos);return o(a._tag==="Success"?{_tag:"AttemptSuccess",attempt:s.attempt,stepAttempt:s.stepAttempt,stepIndex:s.stepIndex,duration:c}:{_tag:"AttemptFailure",attempt:s.attempt,stepAttempt:s.stepAttempt,stepIndex:s.stepIndex,duration:c,cause:a.cause})})}},H_=m(e=>oe(e[0]),(e,t,r)=>se(()=>{let n=0,o={attempt:0,stepIndex:0},s=hm(M_,G(()=>(o={attempt:o.attempt+1,stepIndex:n},o))),a=r?.onEvent===void 0?void 0:Jq(r.onEvent,()=>o),i=a===void 0?F:f=>zs(u=>Q(a.begin,l=>Vr(u(f),p=>a.end(l,p)))),c;return Q(go({while:()=>n<t.steps.length&&(c===void 0||Se(c)),body(){let f=t.steps[n],u=s(i(Km(e,f.provide)));if(c){let l=!1,p=u;u=se(()=>l?p:(l=!0,hc(c))),u=pl(u,q_(f,!1))}else{let l=q_(f,!0);u=l?pl(u,l):u}return Ms(u)},step(f){c=f,n++}}),()=>hc(c))})),q_=(e,t)=>{if(t){if(e.attempts===1||!(e.schedule||e.attempts))return}else return dl({schedule:e.schedule?e.schedule:e.attempts?void 0:Zq,times:e.attempts,while:e.while});return dl({schedule:e.schedule,while:e.while,times:e.attempts?e.attempts-1:void 0})},Zq=$_(1);var W_="~effect/MutableHashMap";var Yq={[W_]:W_,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${N(Array.from(this))})`},toJSON(){return{_id:"MutableHashMap",values:vt(Array.from(this))}},[qe](){return this.toJSON()},pipe(){return te(this,arguments)}},V_=()=>{let e=Object.create(Yq);return e.backing=new Map,e.buckets=new Map,e};var fE=m(2,(e,t)=>{if(e.backing.has(t))return R(e.backing.get(t));if(lE(t))return v();let r=q(t),n=e.buckets.get(r);return n===void 0?v():Xq(e,n,t)}),lE=e=>typeof e!="object"&&typeof e!="function";var Xq=(e,t,r)=>{for(let n=0,o=t.length;n<o;n++)if(W(r,t[n])){let s=t[n];return R(e.backing.get(s))}return v()},G_=m(2,(e,t)=>ve(fE(e,t))),K_=m(3,(e,t,r)=>{if(e.backing.has(t)||lE(t))return e.backing.set(t,r),e;let n=q(t),o=e.buckets.get(n);if(o===void 0)return e.buckets.set(n,[t]),e.backing.set(t,r),e;let s=eH(o,t);return s===void 0&&(o.push(t),s=t),e.backing.set(s,r),e}),eH=(e,t)=>{for(let r=0,n=e.length;r<n;r++)if(W(t,e[r]))return e[r]};var J_=m(2,(e,t)=>{if(lE(t))return e.backing.delete(t),e;let r=q(t),n=e.buckets.get(r);if(n===void 0)return e;for(let o=0,s=n.length;o<s;o++){let a=n[o];if(a===t||W(t,a)){e.backing.delete(a),n.splice(o,1);break}}return n.length===0&&e.buckets.delete(r),e});var tH="~effect/Request",rH=Rw({_E:e=>e,_A:e=>e,_R:e=>e}),Mne={...Bw,[tH]:rH};var Q_=e=>e;var X_=m(2,(e,t)=>{let r=n=>qt(o=>{let s=tP(n,e,o,mc());return aH(n,s)});return oe(t)?Q(t,r):r(t)}),eP=(e,t)=>{let r=tP(t.resolver,e,t.onExit,{context:t.context,cache:{scheduler:ct(t.context,Of)}});return()=>rP(t.resolver,r)},oH=new WeakSet,sH=e=>{if(!oH.has(e.batchKey))return new Map;let t=V_();return{get:r=>er(fE(t,r)),has:r=>G_(t,r),set:(r,n)=>K_(t,r,n),delete:r=>J_(t,r)}},Jm=[],pE=new WeakMap,tP=(e,t,r,n)=>{let o=pE.get(e);o||(o=sH(e),pE.set(e,o));let s,a=!1,i=Q_({request:t,context:n.context,uninterruptible:!1,completeUnsafe(f){a||(a=!0,!(s&&!s.entrySet.delete(i))&&r(f))}});if(e.preCheck!==void 0&&!e.preCheck(i))return i;let c=e.batchKey(i);if(s=o.get(c),!s){if(Jm.length>0)s=Jm.pop(),s.key=c,s.resolver=e,s.map=o;else{let f={key:c,resolver:e,map:o,entrySet:new Set,entries:new Set,delayEffect:Q(se(()=>f.resolver.delay),u=>Y_(f)),run:Vr(se(()=>f.resolver.runAll(Array.from(f.entries),f.key)),u=>{for(let l of f.entrySet)l.completeUnsafe(u._tag==="Success"?zr(new Error("Effect.request: RequestResolver did not complete request",{cause:l.request})):u);return f.entries.clear(),Jm.length<128&&(f.entrySet.clear(),f.key=void 0,f.fiber=void 0,f.resolver=void 0,f.map=void 0,Jm.push(f)),he})};s=f}o.set(c,s),s.fiber=Yo(n.context)(s.delayEffect,{scheduler:n.cache.scheduler})}return s.entrySet.add(i),s.entries.add(i),s.resolver.collectWhile(s.entries)||(s.fiber.interruptUnsafe(n.id),s.fiber=Yo(n.context)(Y_(s),{scheduler:n.cache.scheduler})),i},rP=(e,t)=>{if(t.uninterruptible)return;let r=pE.get(e);if(!r)return;let n=e.batchKey(t),o=r.get(n);if(!o||!o.entries.delete(t))return;o.entrySet.delete(t);let s;o.entries.size===0&&(r.delete(n),s=o.fiber),t.completeUnsafe(jf()),s?.interruptUnsafe()},aH=(e,t)=>G(()=>rP(e,t));function Y_(e){return e.map.has(e.key)?(e.map.delete(e.key),e.run):he}var cH="effect/Metric/CurrentMetricAttributes",uH=ge(cH,{defaultValue:()=>({})}),fH="effect/Metric/MetricRegistry",lH=ge(fH,{defaultValue:()=>new Map}),nP="~effect/Metric",oP=class{[nP]=nP;#t;#e="";id;description;attributes;constructor(t,r,n){this.id=t,this.description=r,this.attributes=n}valueUnsafe(t){return this.hook(t).get(t)}modifyUnsafe(t,r){return this.hook(r).modify(t,r)}updateUnsafe(t,r){return this.hook(r).update(t,r)}hook(t){let r=ct(t,uH);r!==this.#t&&(this.#t=r,this.#e=pH(this,sP(this.attributes,r)));let n=ct(t,lH),o=n.get(this.#e);return Os(o)&&(o={id:this.id,type:this.type,description:this.description,attributes:Object.keys(r).length>0?sP(this.attributes,r):this.attributes,hooks:this.createHooks()},n.set(this.#e,o)),o.hooks}pipe(){return te(this,arguments)}};var vc=m(2,(e,t)=>Ds(r=>G(()=>e.updateUnsafe(t,r))));function pH(e,t){let r=Object.entries(t).sort((n,o)=>n[0]<o[0]?-1:n[0]>o[0]?1:0);return JSON.stringify([e.type,e.id,e.description,r])}function sP(e,t){return{...aP(e),...aP(t)}}function aP(e){return pt(e)&&Array.isArray(e)?e.reduce((t,[r,n])=>(U(t,r,n),t),{}):e}var dH=ro,Tr=oe,uP=Jf,mH=TS,hH=Vv,gH=Gv,xH=Kv,yH=Zv,Za=qr,SH=Yv,_c=go,fP=Jy,Pc=TA,y=D,ml=Lf,lP=Ky,Ie=se,fe=G,xe=he;var EH=$S;var or=qt,Zm=lm,bH=oO,IH=sO,CH=iO;var TH=aO,Ut=vA,C=Xe,mE=fm,Qa=Ue,Ws=IA,sr=Us,ht=CA;var hE=gc,wH=Gy,hl=ie,kH=qw,gl=hc,AH=Vy,vH=bA,OH=EA,L=Q,pP=DA,es=ho,Fc=qa,gE=Ms,_H=Sv,Vs=Wf,re=Oe,wr=yr,dP=mm,xE=Bf,PH=RA,mP=tv,hP=oS,vn=Qo;var ts=cS,yE=pv,FH=dv,RH=mv,$H=hv,br=Wr,gP=iv,NH=qf,xl=ym,MH=av,UH=aS,DH=Zo,wt=uS,LH=fS,rs=lS,SE=iS,BH=fv,Qm=cv,jH=uv,zH=xm,xP=lv,qH=pS,HH=pl,WH=uE,VH=$A,Rc=yv,GH=Sm,KH=H_,JH=zO,ZH=gv,QH=xv,YH=kv,XH=hS,eW=mS,yP=wv,Ym=bc,tW=Av,SP=eS,rW=tS,nW=NA,Ya=rS,EE=tO,oW=rO,EP=nO,sW=wS,aW=kS,iW=rv,cW=eO,uW=nv,Gs=Em,fW=Hf,lW=dS,pW=Iv,dW=MA,yl=po,bE=yc,mW=Cv,hW=Tv,Xm=nS,bP=Ds,IE=Km,ns=Hr,gW=ev,IP=QA,eh=YA,xW=xc,yW=Jo,SW=XA,bo=Sr,CE=hm,Sl=Vf,Ks=xS,TE=Cm,fn=Ha,EW=Uv,CP=Gf,th=yS,$c=$v,Nc=bS,bW=Nv,IW=IS,rh=js,Io=Vr,CW=SS,TW=ES,wE=Bv,wW=Lv,kW=CS,Xa=jv,AW=Tm,TP=Mv,El=Wa,Mc=zs,vW=Hv,OW=Wv,Co=gm,_W=B_,PW=cE,FW=sS,RW=ov,$W=m(2,(e,t)=>wP(e,void 0,t)),wP=j_,NW=EO,MW=bO,UW=IO,DW=CO,LW=FO,BW=RO,jW=$O,zW=NO,qW=AO,HW=vO,WW=OO,kP=wO,VW=Mf,GW=Uf,KW=PO,JW=kO,ZW=lc,QW=X_,YW=eP,kE=cO,Uc=AS,Dc=lO,XW=uO,eV=fO,tV=kA,rV=AA,To=dO,Lc=Yo,nV=vS,oV=mO,AP=gO,vP=OS,nh=hO,sV=Am,aV=yO,iV=_S,wo=xO,cV=vm,B=Qy,uV=OA,Bc=xo,OP=Tn,fV=Tn(),lV=Tn("Fatal"),pV=Tn("Warn"),oh=Tn("Error"),dV=Tn("Info"),mV=Tn("Debug"),hV=Tn("Trace"),gV=m(2,(e,t)=>Jo(e,RS,r=>new Set([...r,t]))),xV=m(e=>Tr(e[0]),(e,...t)=>Jo(e,QO,r=>{let n=t.length===1?{...r,...t[0]}:{...r};return t.length===1||U(n,t[0],t[1]),n})),yV=BO,SV=m(2,(e,t)=>Q(DO,r=>Jo(e,YO,n=>[[t,r],...n]))),EV=m(e=>Tr(e[0]),(e,t,r)=>Io(e,n=>{let o=r===void 0?n:r(n);return vc(t,o)})),bV=m(e=>Tr(e[0]),(e,t,r)=>Fc(e,n=>{let o=r===void 0?n:r(n);return vc(t,o)})),IV=m(e=>Tr(e[0]),(e,t,r)=>SE(e,n=>{let o=r===void 0?n:r(n);return vc(t,o)})),CV=m(e=>Tr(e[0]),(e,t,r)=>xP(e,n=>{let o=r===void 0?n:r(n);return vc(t,o)})),TV=m(e=>Tr(e[0]),(e,t,r)=>Bc(n=>{let o=n.monotonicTimeNanosUnsafe();return Io(e,()=>{let s=n.monotonicTimeNanosUnsafe(),a=jk(Mt(s),Mt(o)),i=r===void 0?a:r(a);return vc(t,i)})})),Oc=class extends Ye()("effect/Effect/Transaction"){},wV=e=>hl(t=>{let r=Fd(t.context,Oc);if(r&&!cP.has(r))return e;r={journal:new Map,retry:!1};let n;return Mc(o=>L(_c({while:()=>!n,body:at(o(e).pipe(bo(Oc,r),Qm(s=>r.retry?sm(s)?o(kV(r)):fe(()=>dE(r)):xe),Vs)),step(s){if(r.retry||!_P(r))return dE(r);ut(s)&&AV(t,r),dE(r),cP.add(r),n=s}}),()=>n))}),cP=new WeakSet,_P=e=>{for(let[t,{version:r}]of e.journal)if(t.version!==r)return!1;return!0},kV=e=>or(t=>{if(!_P(e))return t(xe);let r={},n=Array.from(e.journal.keys()),o=()=>{for(let a of n)a.pending.delete(r)},s=()=>{o(),t(xe)};for(let a of n)a.pending.set(r,s);return fe(o)});function AV(e,t){for(let[r,{value:n,written:o}]of t.journal)if(o){Object.is(n,r.value)||(r.version=r.version+1,r.value=n);for(let s of r.pending.values())e.currentDispatcher.scheduleTask(s,0);r.pending.clear()}}function dE(e){e.retry=!1,e.journal.clear()}var vV=L(Oc,e=>(e.retry=!0,Xa)),et=(e,t,r)=>(...n)=>or(o=>{try{e(...n,(s,a)=>{o(s?t?Ie(()=>C(t(s,n))):C(s):y(a))})}catch(s){o(r?C(r(s,n)):sr(s))}}),OV=()=>e=>e,_V=()=>e=>e,PV=()=>e=>e,ei=LA,bl=BA,Wt=jA,Rt=UA,Il=zA,AE=_A;var PP=(e,t)=>ut(e)?t(0):_m(e.cause)?t(130):t(FP(Xf(e.cause))),vE=e=>m(t=>Tr(t[0]),(t,r)=>{let n=r?.disableErrorReporting===!0?To(t):To(Qm(t,s=>_m(s)?xe:RP(Xf(s))?oh(s):xe));try{let s=globalThis.setInterval(Lo,2147483647);n.addObserver(()=>{clearInterval(s)})}catch{}let o=r?.teardown??PP;return e({fiber:n,teardown:o})}),Cl="~effect/Runtime/errorExitCode",FP=e=>{if(typeof e=="object"&&e!==null&&Cl in e){let t=e[Cl];if(typeof t=="number")return t}return 1},Js="~effect/Runtime/errorReported",RP=e=>{if(typeof e=="object"&&e!==null&&Js in e){let t=e[Js];if(typeof t=="boolean")return t}return!0};var $P=vE(({fiber:e,teardown:t})=>{let r=!1;e.addObserver(o=>{process.removeListener("SIGINT",n),process.removeListener("SIGTERM",n),t(o,s=>{(r||s!==0)&&process.exit(s)})});function n(){r=!0,e.interruptUnsafe(e.id)}process.on("SIGINT",n),process.on("SIGTERM",n)});var NP=$P;var is={};Kn(is,{FileSystem:()=>_n,FileTypeId:()=>Kc,WatchBackend:()=>Ml,isFile:()=>k4,layerNoop:()=>w4,make:()=>eb,makeNoop:()=>eR});var MP=globalThis.BigInt;var sh=e=>e>MP(Number.MAX_SAFE_INTEGER)||e<MP(Number.MIN_SAFE_INTEGER)?v():R(Number(e));var _E=BigInt(0),NV=BigInt(1),ko=BigInt(1e3),Zs=BigInt(1024),UP=[{symbol:"B",factor:NV,names:["B","byte","bytes"]},{symbol:"kB",factor:ko,names:["kB","kilobyte","kilobytes"]},{symbol:"MB",factor:ko**BigInt(2),names:["MB","megabyte","megabytes"]},{symbol:"GB",factor:ko**BigInt(3),names:["GB","gigabyte","gigabytes"]},{symbol:"TB",factor:ko**BigInt(4),names:["TB","terabyte","terabytes"]},{symbol:"PB",factor:ko**BigInt(5),names:["PB","petabyte","petabytes"]},{symbol:"EB",factor:ko**BigInt(6),names:["EB","exabyte","exabytes"]},{symbol:"ZB",factor:ko**BigInt(7),names:["ZB","zettabyte","zettabytes"]},{symbol:"YB",factor:ko**BigInt(8),names:["YB","yottabyte","yottabytes"]},{symbol:"RB",factor:ko**BigInt(9),names:["RB","ronnabyte","ronnabytes"]},{symbol:"QB",factor:ko**BigInt(10),names:["QB","quettabyte","quettabytes"]}],MV=[UP[0],{symbol:"KiB",factor:Zs,names:["KiB","kibibyte","kibibytes"]},{symbol:"MiB",factor:Zs**BigInt(2),names:["MiB","mebibyte","mebibytes"]},{symbol:"GiB",factor:Zs**BigInt(3),names:["GiB","gibibyte","gibibytes"]},{symbol:"TiB",factor:Zs**BigInt(4),names:["TiB","tebibyte","tebibytes"]},{symbol:"PiB",factor:Zs**BigInt(5),names:["PiB","pebibyte","pebibytes"]},{symbol:"EiB",factor:Zs**BigInt(6),names:["EiB","exbibyte","exbibytes"]},{symbol:"ZiB",factor:Zs**BigInt(7),names:["ZiB","zebibyte","zebibytes"]},{symbol:"YiB",factor:Zs**BigInt(8),names:["YiB","yobibyte","yobibytes"]}],UV=[...UP,...MV.slice(1)],DV=new Map(UV.flatMap(e=>e.names.map(t=>[t,e])));var PE=e=>e;var jc=e=>{throw new Error(`Invalid ByteSize: ${e}`)},DP=e=>!Number.isSafeInteger(e)||e<0?jc(`expected a non-negative safe integer, received ${e}`):PE(BigInt(e));var LP=e=>{let t=/^\s*(\d+)(?:\.(\d+))?\s*([A-Za-z]+)\s*$/.exec(e);if(t===null)return jc(`unsupported syntax ${JSON.stringify(e)}`);let r=DV.get(t[3]);if(r===void 0)return jc(`unsupported unit ${JSON.stringify(t[3])}`);let n=t[2]??"",o=BigInt(10)**BigInt(n.length),s=BigInt(t[1]+n)*r.factor;return s%o!==_E?jc(`${JSON.stringify(e)} does not represent an integral number of bytes`):PE(s/o)},BP=ao(LP),Tl=e=>{switch(typeof e){case"bigint":return e<_E?jc(`expected a non-negative bigint, received ${e}`):PE(e);case"number":return DP(e);case"string":return LP(e)}return jc(`unsupported input ${e}`)},FE=ao(Tl),wl=e=>typeof e=="bigint"?Tl(e):DP(e);var jP=e=>typeof e=="bigint"&&e>=_E;var ah=e=>e,zP=sh;var qP="~effect/PlatformError",Ao=class extends an("BadArgument"){get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:""}`}},RE=class extends _f{get message(){return`${this._tag}: ${this.module}.${this.method}${this.pathOrDescriptor!==void 0?` (${this.pathOrDescriptor})`:""}${this.description?`: ${this.description}`:""}`}},ih=class extends an("PlatformError"){constructor(t){"cause"in t?super({reason:t,cause:t.cause}):super({reason:t})}[qP]=qP;get message(){return this.reason.message}};var Kr=e=>new ih(new RE(e)),ln=e=>new ih(new Ao(e));var VP="~effect/Chunk";function HP(e,t,r,n,o){for(let s=t;s<Math.min(e.length,t+o);s++)r[n+s-t]=e[s];return r}var GP=[],NE=e=>gr((t,r)=>{if(t.length!==r.length)return!1;let n=ri(t),o=ri(r);for(let s=0;s<n.length;s++)if(!e(n[s],o[s]))return!1;return!0}),LV=NE(W),BV={[VP]:{_A:e=>e},toString(){return`Chunk(${N(ri(this))})`},toJSON(){return{_id:"Chunk",values:vt(ri(this))}},[qe](){return this.toJSON()},[X](e){return ch(e)&&LV(this,e)},[Y](){return Qn(ri(this))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return GP[Symbol.iterator]();default:return ri(this)[Symbol.iterator]()}},pipe(){return te(this,arguments)}},ME=e=>{let t=Object.create(BV);switch(t.backing=e,e._tag){case"IEmpty":{t.length=0,t.depth=0,t.left=t,t.right=t;break}case"IConcat":{t.length=e.left.length+e.right.length,t.depth=1+Math.max(e.left.depth,e.right.depth),t.left=e.left,t.right=e.right;break}case"IArray":{t.length=e.array.length,t.depth=0,t.left=os,t.right=os;break}case"ISingleton":{t.length=1,t.depth=0,t.left=os,t.right=os;break}case"ISlice":{t.length=e.length,t.depth=0,t.left=os,t.right=os;break}}return t},ch=e=>A(e,VP),os=ME({_tag:"IEmpty"}),jV=()=>os;var zV=e=>ME({_tag:"ISingleton",a:e}),UE=e=>ch(e)?e:HV(rr(e)),$E=(e,t,r)=>{switch(e.backing._tag){case"IArray":{HP(e.backing.array,0,t,r,e.length);break}case"IConcat":{$E(e.left,t,r),$E(e.right,t,r+e.left.length);break}case"ISingleton":{t[r]=e.backing.a;break}case"ISlice":{HP(ri(e.backing.chunk),e.backing.offset,t,r,e.length);break}}};var qV=e=>{switch(e.backing._tag){case"IEmpty":return GP;case"IArray":return e.backing.array;default:{let t=new Array(e.length);return $E(e,t,0),e.backing={_tag:"IArray",array:t},e.left=os,e.right=os,e.depth=0,t}}},ri=qV;var HV=e=>e.length===0?jV():e.length===1?zV(e[0]):ME({_tag:"IArray",array:e});var KP=e=>e.length;var JP=Yd;var uh=Df;var ZP=mc,QP=pO;var XP=SO;var tF="~effect/MutableRef",WV={[tF]:tF,...Xt,toJSON(){return{_id:"MutableRef",current:vt(this.current)}}},rF=e=>{let t=Object.create(WV);return t.current=e,t};var VV=Symbol.for("effect/MutableList/Empty"),sF=()=>({head:void 0,tail:void 0,length:0}),aF=e=>{let t=e.head;t.offset>=1024&&t===e.tail&&t.mutable&&(t.array.length-t.offset)*8<=t.offset&&(e.head=e.tail={array:t.array.slice(t.offset),mutable:!0,offset:0,next:void 0})},oF=()=>({array:[],mutable:!0,offset:0,next:void 0}),qc=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=oF(),e.tail=e.tail.next):e.head=e.tail=oF(),e.tail.array.push(t),e.length++};var zc=e=>{e.head=e.tail=void 0,e.length=0},iF=(e,t)=>{if(t=Cf(t),t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let s=e.head.array;return zc(e),s}let r=new Array(t),n=0,o=e.head;for(;o;){for(;o.offset<o.array.length;)if(r[n++]=o.array[o.offset],o.mutable&&(o.array[o.offset]=void 0),o.offset++,n===t)return e.head=o.offset===o.array.length&&o.next?o.next:o,e.length-=t,e.length===0?zc(e):aF(e),r;o=o.next}return zc(e),r};var LE=e=>{if(!e.head)return VV;let t=e.head.array[e.head.offset];return e.head.mutable&&(e.head.array[e.head.offset]=void 0),e.head.offset++,e.length--,e.head.offset===e.head.array.length?e.head.next?e.head=e.head.next:zc(e):aF(e),t};var GV="~effect/Queue",KV="~effect/Queue/Enqueue",JV="~effect/Queue/Dequeue";var BE={_A:F,_E:F},ZV={[GV]:BE,[KV]:BE,[JV]:BE,...Xt,toJSON(){return{_id:"effect/Queue",state:this.state._tag,size:YV(this)}}},Hc=e=>ie(t=>{let r=Object.create(ZV);return r.dispatcher=t.currentDispatcher,r.capacity=e?.capacity??Number.POSITIVE_INFINITY,r.strategy=e?.strategy??"suspend",r.messages=sF(),r.scheduleRunning=!1,r.state={_tag:"Open",takers:new Set,offers:new Set,awaiters:new Set},D(r)}),uF=e=>Hc({capacity:e});var vl=m(2,(e,t)=>se(()=>ni(e,t)?fh:e.state._tag==="Open"&&e.strategy==="suspend"?r4(e,t):mF)),ni=(e,t)=>e.state._tag!=="Open"?!1:e.messages.length>=e.capacity?e.strategy==="sliding"?(LE(e.messages),qc(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0?(qc(e.messages,t),hF(e),!0):!1:(qc(e.messages,t),gF(e),!0);var Wc=m(2,(e,t)=>G(()=>Ol(e,t))),Ol=(e,t)=>{if(e.state._tag!=="Open")return!1;let r=ir(t),n=JA(r,XV);return e.state.offers.size===0&&e.messages.length===0?(lh(e,n),!0):(e.state={...e.state,_tag:"Closing",exit:n},gF(e),!0)};var ss=e=>Ol(e,xf(Gi()));var zE=e=>G(()=>QV(e)),QV=e=>{if(e.state._tag==="Done")return!1;zc(e.messages);let t=e.state.offers;lh(e,e.state._tag==="Open"?e4:e.state.exit);for(let r of t)yF(r);return!0};var fF=e=>lF(e,1,Number.POSITIVE_INFINITY);var lF=m(3,(e,t,r)=>(t=Cf(t),r=Cf(r),qE(()=>t4(e,t,r)??ho(xF(e,()=>HE(e,t)),lF(e,t,r))))),as=e=>qE(()=>dF(e)??ho(xF(e,()=>HE(e,1)),as(e))),pF=e=>qE(()=>{let t=dF(e);return t===void 0?D(v()):t._tag==="Success"?D(R(t.value)):D(v())});var dF=e=>{if(e.state._tag==="Done")return e.state.exit;if(e.messages.length>0){let t=LE(e.messages);return jE(e),Fe(t)}else if(e.capacity<=0&&e.state.offers.size>0){let t=SF(e.state.offers);return jE(e),Fe(t)}};var YV=e=>e.state._tag==="Done"?0:e.messages.length;var mF=Fe(!1),fh=Fe(!0),XV=sn(Gi()),e4=jf(),hF=e=>{if(!(e.state._tag==="Done"||e.state.takers.size===0)){for(let t of e.state.takers)if(t.ready()&&(e.state.takers.delete(t),t.resume(fr),e.messages.length===0))break}},gF=e=>{e.scheduleRunning||e.state._tag==="Done"||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>{e.scheduleRunning=!1,hF(e)},0))},t4=(e,t,r)=>{if(e.state._tag==="Done")return e.state.exit;if(r<=0||t<=0)return Fe([]);if(!HE(e,t))return;let n=e.messages.length>0?iF(e.messages,r):[SF(e.state.offers)];return jE(e),Fe(n)},qE=on({op:"QueueTake",[Ge](e){let t=this[ue]();return hf(t)?t[Ge](e):t}}),HE=(e,t)=>e.messages.length>=(e.state._tag==="Closing"?1:Math.min(t,e.capacity||1))||e.capacity<=0&&e.state._tag!=="Done"&&e.state.offers.size>0,xF=(e,t)=>qt(r=>{if(e.state._tag==="Done")return r(e.state.exit);if(t())return r(fr);let n={ready:t,resume:r};return e.state.takers.add(n),G(()=>{e.state._tag!=="Done"&&e.state.takers.delete(n)})}),r4=(e,t)=>qt(r=>ni(e,t)?r(fh):n4(e,{_tag:"Single",message:t,resume:r})),n4=(e,t)=>{if(e.state._tag!=="Open")return yF(t);let r=e.state.offers;return r.add(t),G(()=>{e.state._tag!=="Done"&&(r.delete(t),e.state._tag==="Closing"&&r.size===0&&e.messages.length===0&&lh(e,e.state.exit))})},yF=e=>e._tag==="Single"?e.resume(mF):e.resume(Fe(e.remaining.slice(e.offset))),SF=e=>{let t=e.values().next().value;if(t._tag==="Single")return e.delete(t),t.resume(fh),t.message;let r=t.remaining[t.offset++];return t.offset===t.remaining.length&&(e.delete(t),t.resume(Fe([]))),r},jE=e=>{if(e.state._tag==="Done")return Ac(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag==="Closing"&&e.messages.length===0?(lh(e,e.state.exit),Ac(e.state.exit.cause)):!1;for(let t of e.state.offers){let r=e.capacity-e.messages.length;if(r<=0)break;if(t._tag==="Single")qc(e.messages,t.message),e.state.offers.delete(t),t.resume(fh);else{for(;t.offset<t.remaining.length;t.offset++){if(r===0)return!1;qc(e.messages,t.remaining[t.offset]),r--}e.state.offers.delete(t),t.resume(Fe([]))}let n=e.state;if(n._tag==="Done")return Ac(n.exit.cause)}return!1};var lh=(e,t)=>{if(e.state._tag==="Done")return;let r=e.state;e.state={_tag:"Done",exit:t};for(let n of r.takers)n.resume(t);r.takers.clear();for(let n of r.awaiters)n(t);r.awaiters.clear()};var bF="~effect/Channel",EF=e=>A(e,bF),s4={[bF]:{_Env:F,_InErr:F,_InElem:F,_OutErr:F,_OutElem:F},pipe(){return te(this,arguments)}},lr=e=>{let t=Object.create(s4);return t.transform=(r,n)=>br(e(r,n),o=>y(Qa(o))),t},IF=(e,t)=>lr((r,n)=>L(On(e)(r,n),o=>t(o,n))),Pl=e=>lr((t,r)=>e),CF=e=>lr(B(function*(t,r){let n=Hs(r),o=a=>un(n,nE(a)),s=yield*Nc(e(t,r,n),o);return Nc(s,o)})),On=e=>e.transform;var a4=(e,t,r)=>Hc({capacity:r?.bufferSize,strategy:r?.strategy}).pipe(Fc(n=>nl(e,zE(n))),Fc(n=>rl(t(n),e).pipe(br(o=>Wc(n,o)),Uc(e))));var TF=(e,t)=>lr((r,n)=>re(a4(n,e,t),fF)),wF=e=>lr((t,r)=>Ie(()=>On(e())(t,r)));var kF=Pl(y(Ft()));var AF=e=>Pl(y(C(e)));var vF=m(2,(e,t)=>IF(e,r=>fe(()=>{let n=0;return re(r,o=>t(o,n++))}))),WE=m(2,(e,t)=>OF(e,r=>y(t(r)))),OF=m(2,(e,t)=>IF(e,r=>y(Er(r,n=>L(t(n),Ft)))));var _F=m(e=>EF(e[0])&&EF(e[1]),(e,t,r)=>CF(B(function*(n,o,s){let a=r?.haltStrategy??"both",i=yield*uF(0);yield*nl(s,zE(i));let c=0;function f(l,p){if(c++,!Ac(p))return Wc(i,p);switch(a){case"both":return c===2?Wc(i,p):xe;case"left":case"right":return l===a?Wc(i,p):xe;case"either":return Wc(i,p)}}let u=(l,p,h)=>On(p)(n,h).pipe(L(g=>g.pipe(L(x=>vl(i,x)),Co)),Nc(g=>rh(nE(g),x=>un(h,x)).pipe(yl({onFailure:x=>f(l,x),onSuccess:()=>f(l,g)}))),Uc(s));return yield*u("left",e,Hs(s)),yield*u("right",t,Hs(s)),as(i)})));var PF=()=>lr((e,t)=>fe(()=>{let r="",n=!1,o=v();function s(c){let f=[];function u(l){r.length===0?f.push(l):(f.push(r+l),r="")}for(let l=0;l<c.length;l++){let p=c[l];if(p.length!==0){let h=0,g=p.indexOf("\r"),x=p.indexOf(`
|
|
25
|
+
`);for(n&&(x===0&&(h=1,x=p.indexOf(`
|
|
26
|
+
`,h)),n=!1);g!==-1||x!==-1;)g===-1||x!==-1&&x<g?(u(p.substring(h,x)),h=x+1,x=p.indexOf(`
|
|
27
|
+
`,h)):(u(p.substring(h,g)),p.length===g+1?(n=!0,h=p.length,g=-1):(h=g+(x===g+1?2:1),g=p.indexOf("\r",h),x=p.indexOf(`
|
|
28
|
+
`,h)));r=r+p.substring(h)}}return $s(f)?f:null}let a=Ie(()=>o._tag==="Some"?Ft(o.value):Wm(e,{onSuccess:i,onFailure:Qa,onDone:c=>{if(o=R(c),r.length>0){let f=r;return r="",n=!1,y([f])}return Ft(c)}}));function i(c){let f=s(c);return f!==null?y(f):a}return a}));var FF=m(2,(e,t)=>lr((r,n)=>L(On(e)(r,n),o=>On(t)(o,n))));var ph=e=>lr((t,r)=>{let n;return y(Ie(()=>n||e.pipe(rl(r),L(o=>On(o)(t,r)),L(o=>n=o))))});var i4=(e,t,r)=>Ie(()=>{let n=Cc(),o=On(e)(Ft(),n);return Er(L(o,t),r||y).pipe(Io(s=>un(n,s)))});var VE=m(3,(e,t,r)=>Ie(()=>{let n=t();return i4(e,o=>_c({while:Ur,body:()=>o,step:s=>{n=r(n,s)}}),()=>y(n))}));var GE=(e,t)=>On(e)(Ft(),t);var c4="~effect/Stream",u4={_R:F,_E:F,_A:F},RF=function(e){this.channel=e};RF.prototype={[c4]:u4,pipe(){return te(this,arguments)}};var $F=e=>new RF(e);var NF="~effect/Sink",MF=y([void 0]),l4={_A:F,_In:F,_L:F,_E:F,_R:F},p4={[NF]:l4,pipe(){return te(this,arguments)}},Rl=e=>A(e,NF),KE=e=>dh((t,r)=>On(e)(t,r).pipe(L(Co({disableYield:!0})),Er(y)));var dh=e=>{let t=Object.create(p4);return t.transform=e,t},d4=e=>lr((t,r)=>y(L(e.transform(t,r),Ft)));var m4=e=>dh(()=>e);var UF=e=>m4(C(e));var $l=dh(e=>Er(Co(e,{disableYield:!0}),()=>MF));var DF=e=>h4(Za(t=>e(t),{discard:!0})),h4=e=>dh(t=>t.pipe(L(e),Co({disableYield:!0}),Er(()=>MF)));var LF=e=>KE(ph(re(e,d4)));var g4="~effect/RcRef",Nl={_tag:"Empty"},x4={_tag:"Closed"},y4={_A:F,_E:F},JE=class{[g4]=y4;pipe(){return te(this,arguments)}state=Nl;acquire;context;scope;idleTimeToLive;constructor(t,r,n,o){this.acquire=t,this.context=r,this.scope=n,this.idleTimeToLive=o}},jF=e=>hl(t=>{let r=t.context,n=ct(r,tl),o=new JE(e.acquire,r,n,e.idleTimeToLive!==void 0?Mt(e.idleTimeToLive):void 0);return wr(Nm(n,()=>{let s=o.state;return o.state=x4,s._tag==="Acquired"?un(s.scope,kn):s._tag==="Acquiring"?uh(s.fiber):xe}),o)}),S4=(e,t)=>{switch(e.state._tag){case"Closed":return Xa;case"Acquired":{let r=e.state;return r.refCount++,r.fiber?wr(uh(r.fiber),r):y(r)}case"Acquiring":{let r=e.state;return r.awaiters++,BF(e,r,t)}case"Empty":{let r={_tag:"Acquiring",fiber:void 0,awaiters:1,acquired:void 0};e.state=r;let n=Cc(),o=ns(e.acquire,tr(e.context,tl,n)).pipe(L(s=>{if(e.state!==r)return Xa;let a={_tag:"Acquired",value:s,scope:n,fiber:void 0,refCount:r.awaiters,invalidated:!1};return e.state=a,r.acquired=a,y(a)}),Io(s=>ut(s)?xe:(e.state===r&&(e.state=Nl),un(n,s))));return r.fiber=Lc(ZP().context)(o),BF(e,r,t)}}},BF=(e,t,r)=>Io(r(JP(t.fiber)),n=>{let o=t.acquired;return o!==void 0?el(n)?qF(e,o):xe:--t.awaiters>0||e.state!==t?xe:(e.state=Nl,uh(t.fiber))}),zF=e=>{let t=e;return Mc(r=>L(Sl,n=>L(S4(t,r),o=>wr(Nm(n,()=>qF(t,o)),o.value))))},qF=(e,t)=>{if(t.refCount--,t.refCount>0)return xe;let r=e.idleTimeToLive;return r===void 0||t.invalidated?(e.state===t&&(e.state=Nl),un(t.scope,kn)):cc(r)?(t.fiber=Mc(n=>L(n(Ym(r)),()=>e.state===t&&t.refCount===0?(e.state=Nl,un(t.scope,kn)):xe)).pipe($c(fe(()=>{t.fiber=void 0})),Lc(e.context),QP(e.scope)),xe):xe};var HF=jF,ZE=zF;var I4="~effect/Stream",oi=e=>A(e,I4);var pn=$F;var VF=e=>pn(Pl(e)),C4=(e,t)=>pn(lr((r,n)=>L(GE(e.channel,n),o=>t(o,n))));var QE=e=>e.channel,GF=(e,t)=>pn(TF(e,t)),Vc=pn(kF);var KF=e=>pn(wF(()=>e().channel)),YE=e=>pn(AF(e));var Qs=e=>pn(ph(re(e,QE)));var T4=m(2,(e,t)=>KF(()=>{let r=0;return pn(vF(e.channel,Pt(n=>t(n,r++))))}));var JF=m(e=>oi(e[0])&&oi(e[1]),(e,t,r)=>pn(_F(QE(e),QE(t),r)));var hh=m(2,(e,t)=>C4(e,(r,n)=>fe(()=>{let o,s,a=Ie(()=>{if(s!==void 0){let c=s;return s=void 0,y(c)}return r}).pipe(vn(c=>(o=wn(c),Ft()))),i=re(Ie(()=>t.transform(a,n)),([c,f])=>(s=f,Ua(c)));return Ie(()=>o||i)})));var ZF=m(e=>oi(e[0]),(e,t)=>KF(()=>{let r=new TextDecoder(t?.encoding);return T4(e,n=>r.decode(n,{stream:!0}))}));var QF=e=>e.channel.pipe(FF(PF()),pn);var XE=m(2,(e,t)=>TE(r=>GE(e.channel,r).pipe(L(n=>t.transform(n,r)),re(([n])=>n)))),YF=e=>VE(e.channel,()=>[],(t,r)=>{for(let n=0;n<r.length;n++)t.push(r[n]);return t});var XF=e=>VE(e.channel,()=>"",(t,r)=>t+r.join(""));var gh="~effect/FileSystem",_n=Ye("effect/FileSystem"),eb=e=>_n.of({...e,[gh]:gh,exists:t=>Jn(e.access(t),wr(!0),ts("PlatformError",r=>r.reason._tag==="NotFound"?y(!1):C(r))),readFileString:(t,r)=>L(e.readFile(t),n=>ht({try:()=>new TextDecoder(r).decode(n),catch:o=>ln({module:"FileSystem",method:"readFileString",description:"invalid encoding",cause:o})})),stream:B(function*(t,r){let n=yield*e.open(t,{flag:"r"}),o=r?.offset===void 0?void 0:Tl(r.offset);o&&(yield*n.seek(o,"start"));let s=r?.bytesToRead===void 0?void 0:Tl(r.bytesToRead),a=BigInt(0),i=Number(BigInt(r?.chunkSize??64*1024)),c=n.readAlloc(i);return VF(y(L(Ie(()=>s!==void 0&&s<=a?Ft():s!==void 0&&s-a<i?n.readAlloc(Number(s-a)):c),Re({onNone:()=>Ft(),onSome:f=>(a+=BigInt(f.length),y(Ua(f)))}))))},Qs),sink:(t,r)=>Jn(e.open(t,{...r,flag:r?.flag??"w"}),re(n=>DF(o=>n.writeAll(o))),LF),writeFileString:(t,r,n)=>L(ht({try:()=>new TextEncoder().encode(r),catch:o=>ln({module:"FileSystem",method:"writeFileString",description:"could not encode string",cause:o})}),o=>e.writeFile(t,o,n))}),gt=(e,t)=>Kr({module:"FileSystem",method:e,_tag:"NotFound",description:"No such file or directory",pathOrDescriptor:t}),eR=e=>_n.of({[gh]:gh,access(t){return C(gt("access",t))},chmod(t){return C(gt("chmod",t))},chown(t){return C(gt("chown",t))},copy(t){return C(gt("copy",t))},copyFile(t){return C(gt("copyFile",t))},glob(t){return C(gt("glob",t))},exists(){return y(!1)},link(t){return C(gt("link",t))},makeDirectory(){return sr("not implemented")},makeTempDirectory(){return sr("not implemented")},makeTempDirectoryScoped(){return sr("not implemented")},makeTempFile(){return sr("not implemented")},makeTempFileScoped(){return sr("not implemented")},open(t){return C(gt("open",t))},readDirectory(t){return C(gt("readDirectory",t))},readFile(t){return C(gt("readFile",t))},readFileString(t){return C(gt("readFileString",t))},readLink(t){return C(gt("readLink",t))},realPath(t){return C(gt("realPath",t))},remove(){return xe},rename(t){return C(gt("rename",t))},sink(t){return UF(gt("sink",t))},stat(t){return C(gt("stat",t))},stream(t){return YE(gt("stream",t))},symlink(t){return C(gt("symlink",t))},truncate(t){return C(gt("truncate",t))},utimes(t){return C(gt("utimes",t))},watch(t){return YE(gt("watch",t))},writeFile(t){return C(gt("writeFile",t))},writeFileString(t){return C(gt("writeFileString",t))},...e}),w4=e=>So(_n)(eR(e)),Kc="~effect/FileSystem/File",k4=e=>A(e,Kc),Ml=class extends Ye()("effect/FileSystem/WatchBackend"){};var cs="~effect/Path",vo=Ye("effect/Path");function tR(e,t){let r="",n=0,o=-1,s=0,a;for(let i=0;i<=e.length;++i){if(i<e.length)a=e.charCodeAt(i);else{if(a===47)break;a=47}if(a===47){if(!(o===i-1||s===1))if(o!==i-1&&s===2){if(r.length<2||n!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){let c=r.lastIndexOf("/");if(c!==r.length-1){c===-1?(r="",n=0):(r=r.slice(0,c),n=r.length-1-r.lastIndexOf("/")),o=i,s=0;continue}}else if(r.length===2||r.length===1){r="",n=0,o=i,s=0;continue}}t&&(r.length>0?r+="/..":r="..",n=2)}else r.length>0?r+="/"+e.slice(o+1,i):r=e.slice(o+1,i),n=i-o-1;o=i,s=0}else a===46&&s!==-1?++s:s=-1}return r}function A4(e,t){let r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+e+n:n}function v4(e){if(e.protocol!=="file:")return C(new Ao({module:"Path",method:"fromFileUrl",description:"URL must be of scheme file"}));if(e.hostname!=="")return C(new Ao({module:"Path",method:"fromFileUrl",description:"Invalid file URL host"}));let t=e.pathname;for(let r=0;r<t.length;r++)if(t[r]==="%"){let n=t.codePointAt(r+2)|32;if(t[r+1]==="2"&&n===102)return C(new Ao({module:"Path",method:"fromFileUrl",description:"must not include encoded / characters"}))}return y(decodeURIComponent(t))}var rR=function(){let t="",r=!1,n;for(let o=arguments.length-1;o>=-1&&!r;o--){let s;if(o>=0)s=arguments[o];else{let a=globalThis.process;n===void 0&&"process"in globalThis&&typeof a=="object"&&a!==null&&typeof a.cwd=="function"&&(n=a.cwd()),s=n}s.length!==0&&(t=s+"/"+t,r=s.charCodeAt(0)===47)}return t=tR(t,!r),r?t.length>0?"/"+t:"/":t.length>0?t:"."},O4=47;function _4(e){let t=new URL("file://"),r=rR(e);return e.charCodeAt(e.length-1)===O4&&r[r.length-1]!=="/"&&(r+="/"),t.pathname=M4(r),y(t)}var P4=/%/g,F4=/\\/g,R4=/\n/g,$4=/\r/g,N4=/\t/g;function M4(e){return e.includes("%")&&(e=e.replace(P4,"%25")),e.includes("\\")&&(e=e.replace(F4,"%5C")),e.includes(`
|
|
29
|
+
`)&&(e=e.replace(R4,"%0A")),e.includes("\r")&&(e=e.replace($4,"%0D")),e.includes(" ")&&(e=e.replace(N4,"%09")),e}var tb=vo.of({[cs]:cs,resolve:rR,normalize(e){if(e.length===0)return".";let t=e.charCodeAt(0)===47,r=e.charCodeAt(e.length-1)===47;return e=tR(e,!t),e.length===0&&!t&&(e="."),e.length>0&&r&&(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 r=arguments[t];r.length>0&&(e===void 0?e=r:e+="/"+r)}return e===void 0?".":tb.normalize(e)},relative(e,t){if(e===t||(e=tb.resolve(e),t=tb.resolve(t),e===t))return"";let r=1;for(;r<e.length&&e.charCodeAt(r)===47;++r);let n=e.length,o=n-r,s=1;for(;s<t.length&&t.charCodeAt(s)===47;++s);let i=t.length-s,c=o<i?o:i,f=-1,u=0;for(;u<=c;++u){if(u===c){if(i>c){if(t.charCodeAt(s+u)===47)return t.slice(s+u+1);if(u===0)return t.slice(s+u)}else o>c&&(e.charCodeAt(r+u)===47?f=u:u===0&&(f=0));break}let p=e.charCodeAt(r+u),h=t.charCodeAt(s+u);if(p!==h)break;p===47&&(f=u)}let l="";for(u=r+f+1;u<=n;++u)(u===n||e.charCodeAt(u)===47)&&(l.length===0?l+="..":l+="/..");return l.length>0?l+t.slice(s+f):(s+=f,t.charCodeAt(s)===47&&++s,t.slice(s))},dirname(e){if(e.length===0)return".";let t=e.charCodeAt(0),r=t===47,n=-1,o=!0;for(let s=e.length-1;s>=1;--s)if(t=e.charCodeAt(s),t===47){if(!o){n=s;break}}else o=!1;return n===-1?r?"/":".":r&&n===1?"//":e.slice(0,n)},basename(e,t){let r=0,n=-1,o=!0,s;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";let a=t.length-1,i=-1;for(s=e.length-1;s>=0;--s){let c=e.charCodeAt(s);if(c===47){if(!o){r=s+1;break}}else i===-1&&(o=!1,i=s+1),a>=0&&(c===t.charCodeAt(a)?--a===-1&&(n=s):(a=-1,n=i))}return r===n?n=i:n===-1&&(n=e.length),e.slice(r,n)}else{for(s=e.length-1;s>=0;--s)if(e.charCodeAt(s)===47){if(!o){r=s+1;break}}else n===-1&&(o=!1,n=s+1);return n===-1?"":e.slice(r,n)}},extname(e){let t=-1,r=0,n=-1,o=!0,s=0;for(let a=e.length-1;a>=0;--a){let i=e.charCodeAt(a);if(i===47){if(!o){r=a+1;break}continue}n===-1&&(o=!1,n=a+1),i===46?t===-1?t=a:s!==1&&(s=1):t!==-1&&(s=-1)}return t===-1||n===-1||s===0||s===1&&t===n-1&&t===r+1?"":e.slice(t,n)},format:function(t){if(t===null||typeof t!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return A4("/",t)},parse(e){let t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;let r=e.charCodeAt(0),n=r===47,o;n?(t.root="/",o=1):o=0;let s=-1,a=0,i=-1,c=!0,f=e.length-1,u=0;for(;f>=o;--f){if(r=e.charCodeAt(f),r===47){if(!c){a=f+1;break}continue}i===-1&&(c=!1,i=f+1),r===46?s===-1?s=f:u!==1&&(u=1):s!==-1&&(u=-1)}return s===-1||i===-1||u===0||u===1&&s===i-1&&s===a+1?i!==-1&&(a===0&&n?t.base=t.name=e.slice(1,i):t.base=t.name=e.slice(a,i)):(a===0&&n?(t.name=e.slice(1,s),t.base=e.slice(1,i)):(t.name=e.slice(a,s),t.base=e.slice(a,i)),t.ext=e.slice(s,i)),a>0?t.dir=e.slice(0,a-1):n&&(t.dir="/"),t},sep:"/",fromFileUrl:v4,toFileUrl:_4,toNamespacedPath:F});var sp={};Kn(sp,{fdName:()=>bI,isCommand:()=>Hh,isPipedCommand:()=>ZG,isStandardCommand:()=>JG,make:()=>np,parseFdName:()=>op,pipeTo:()=>QG,prefix:()=>YG,setCwd:()=>xI,setEnv:()=>yI});var qh={};Kn(qh,{ChildProcessSpawner:()=>na,ExitCode:()=>pI,ProcessId:()=>dI,make:()=>mI,makeHandle:()=>zh});function us(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function xh(e){return t=>us(t)?.[e]}var kr="~structural",si="~identifier",Ul="~sentinels",yh="~constructor",nR=["title","description","default","examples","readOnly","writeOnly","format","contentEncoding","contentMediaType","contentSchema"],Jc=xh("identifier"),nb=xh(si),ob=xh("title");var Dl=Sn(e=>{let t=us(e)?.identifier;return typeof t=="string"?t:e.getExpected(Dl)}),oR=new Set([Ul,kr,"representation","arbitraryConstraint","toJsonSchema","toCode","toEquivalence","toFormatter","toCodec","toCodecJson","toCodecStringTree","toCodecIso","toCodecArbitrary"]);var me=Symbol();var Vt=Xo,Ar=Vt(me),je=Vt(me),Ll=e=>e===me?v():R(e),sb=e=>e._tag==="None"?Ar:Vt(e.value);var zl="~effect/SchemaIssue/Issue";function ib(e){return A(e,zl)&&e[zl]===zl}function U4(e){return Object.hasOwn(e,"input")}var Jr=class{[zl]=zl;constructor(t,r){r?.reportInput===!0&&t!==me&&(this.input=t)}},sR=class extends Jr{_tag="Filter";filter;issue;constructor(e,t,r,n){super(r,n),this.filter=e,this.issue=t}},aR=class extends Jr{_tag="Encoding";ast;issue;constructor(e,t,r,n){super(r,n),this.ast=e,this.issue=t}},kt=class extends Jr{_tag="Pointer";path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},ea=class extends Jr{_tag="MissingKey";annotations;constructor(e){super(),this.annotations=e}},cb=class extends Jr{_tag="UnexpectedKey";ast;constructor(e,t,r){super(t,r),this.ast=e}},At=class extends Jr{_tag="Composite";ast;issues;constructor(e,t,r,n){super(r,n),this.ast=e,this.issues=t}},xt=class extends Jr{_tag="InvalidType";ast;constructor(e,t,r){super(t,r),this.ast=e}},ce=class extends Jr{_tag="InvalidValue";annotations;constructor(e,t,r){super(t,r),this.annotations=e}};function vr(e,t,r,n,o){return new At(e,[new kt([t],r)],n,o)}var ql=class extends Jr{_tag="Forbidden";annotations;constructor(e,t,r){super(t,r),this.annotations=e}},Hl=class extends Jr{_tag="AnyOf";ast;issues;constructor(e,t,r,n){super(r,n),this.ast=e,this.issues=t}},iR=class extends Jr{_tag="OneOf";ast;successes;constructor(e,t,r,n){super(r,n),this.ast=e,this.successes=t}};function ab(e,t,r){if(ib(e))return e;if(typeof e=="string")return new ce({message:e},t,r);let n=typeof e.issue=="string"?new ce({message:e.issue},t,r):e.issue;return new kt(e.path,n)}function cR(e,t,r){if(e!==void 0)return typeof e=="boolean"?e?void 0:new ce(void 0,t,r):ab(e,t,r)}function uR(e,t,r,n){return Array.isArray(t)?$s(t)?t.length===1?ab(t[0],r,n):new At(e,Pt(t,o=>ab(o,r,n)),r,n):void 0:cR(t,r,n)}var fR=e=>{let t=Qc(e);if(t!==void 0)return t;switch(e._tag){case"InvalidType":return Xs(Dl(e.ast),e);case"InvalidValue":{let r=ub(e);if(r!==void 0)return Xs(r,e);let n=Sh(e);return n===void 0?"Expected a valid value":`Invalid data ${n}`}case"MissingKey":return"Missing key";case"UnexpectedKey":{let r=Sh(e);return r===void 0?"Expected no excess property":`Unexpected key with value ${r}`}case"Forbidden":return"Forbidden operation";case"OneOf":{let r=Sh(e);return r===void 0?"Expected exactly one member to match":`Expected exactly one member to match the input ${r}`}}},lR=e=>Qc(e.issue)??Qc(e);function pR(e){return t=>({issues:Zc(t,[],e?.leafHook??fR,e?.checkHook??lR)})}function Sh(e){return U4(e)?N(e.input):void 0}function ub(e){let t=e.annotations?.expected;return typeof t=="string"?t:void 0}function Xs(e,t){let r=Sh(t);return r===void 0?`Expected ${e}`:`Expected ${e}, got ${r}`}function Zc(e,t,r,n){switch(e._tag){case"Filter":{let o=n(e);if(o!==void 0)return[{path:t,message:o}];if(e.issue._tag!=="InvalidValue")return Zc(e.issue,t,r,n);let s=ub(e.issue);return[{path:t,message:s===void 0?Xs(fb(e.filter),e):Xs(s,e.issue)}]}case"Encoding":return Zc(e.issue,t,r,n);case"Pointer":return Zc(e.issue,[...t,...e.path],r,n);case"Composite":return e.issues.flatMap(o=>Zc(o,t,r,n));case"AnyOf":return e.issues.length===0?[{path:t,message:Qc(e)??Xs(Dl(e.ast),e)}]:e.issues.flatMap(o=>Zc(o,t,r,n));default:return[{path:t,message:r(e)}]}}function fb(e){let t=e.annotations?.expected;if(typeof t=="string")return t;switch(e._tag){case"Filter":return"<filter>";case"FilterGroup":return e.checks.map(r=>fb(r)).join(" & ")}}function D4(){return e=>jl(e,"")}var dR=D4();function jl(e,t){let r;switch(e._tag){case"Filter":{let n=lR(e);if(n!==void 0)r=n;else{if(e.issue._tag!=="InvalidValue")return jl(e.issue,t);let o=ub(e.issue);r=o===void 0?Xs(fb(e.filter),e):Xs(o,e.issue)}break}case"Encoding":return jl(e.issue,t);case"Pointer":return jl(e.issue,t+xd(e.path));case"Composite":case"AnyOf":{if(e._tag==="Composite"||e.issues.length>0)return e.issues.map(n=>jl(n,t)).join(`
|
|
30
|
+
`);r=Qc(e)??Xs(Dl(e.ast),e);break}default:r=fR(e);break}return t?`${r}
|
|
31
|
+
at ${t}`:r}function Qc(e){if(e._tag==="Pointer")return;if(e._tag==="Encoding")return Qc(e.issue);let r=(e._tag==="Filter"?e.filter.annotations:"annotations"in e?e.annotations:e.ast.annotations)?.[e._tag==="MissingKey"?"messageMissingKey":e._tag==="UnexpectedKey"?"messageUnexpectedKey":"message"];if(typeof r=="string")return r}function Wl(e){let t;for(let r of e.reasons){if(!Om(r)||!ib(r.error))return;t??=r.error}return t}function Zr(e,t){let r=Wl(e);if(r===void 0)throw new Error(t,{cause:e});return r}var lb=kc,hR=Ga,gR=h_,xR=g_,yR=x_,SR=VS,ER=y_;var bR=zm;var IR=GS;var pb=E_,CR=b_;var db=I_;var mb=KS,hb=il,TR=JS;var wR=ZS,Vl=C_;var kR=cl;var AR=XS;var vR=w_;var gb=tE;var Yc=e=>L4(typeof e=="string"?B4.encode(e):e),ai=e=>{let t=z4(e),r=t.length;if(r%4!==0)return Z(new cn({kind:"Decode",module:"Base64",input:t,message:`Length must be a multiple of 4, but is ${r}`}));let n=t.indexOf("=");if(n!==-1&&(n<r-2||n===r-2&&t[r-1]!=="="))return Z(new cn({kind:"Decode",module:"Base64",input:t,message:"Found a '=' character, but it is not at the end"}));try{let o=t.endsWith("==")?2:t.endsWith("=")?1:0,s=new Uint8Array(3*(r/4)-o);for(let a=0,i=0;a<r;a+=4,i+=3){let c=Eh(t.charCodeAt(a))<<18|Eh(t.charCodeAt(a+1))<<12|Eh(t.charCodeAt(a+2))<<6|Eh(t.charCodeAt(a+3));s[i]=c>>16,s[i+1]=c>>8&255,s[i+2]=c&255}return H(s)}catch(o){return Z(new cn({kind:"Decode",module:"Base64",input:t,message:o instanceof Error?o.message:"Invalid input"}))}},_R=e=>Nt(ai(e),t=>j4.decode(t)),L4=e=>{let t=e.length,r="",n;for(n=2;n<t;n+=3)r+=Pn[e[n-2]>>2],r+=Pn[(e[n-2]&3)<<4|e[n-1]>>4],r+=Pn[(e[n-1]&15)<<2|e[n]>>6],r+=Pn[e[n]&63];return n===t+1&&(r+=Pn[e[n-2]>>2],r+=Pn[(e[n-2]&3)<<4],r+="=="),n===t&&(r+=Pn[e[n-2]>>2],r+=Pn[(e[n-2]&3)<<4|e[n-1]>>4],r+=Pn[(e[n-1]&15)<<2],r+="="),r},B4=new TextEncoder,j4=new TextDecoder,z4=e=>e.replace(/[\n\r]/g,""),Pn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Gl=new Uint8Array(123).fill(255);for(let e=0;e<Pn.length;e++)Gl[Pn.charCodeAt(e)]=e;Gl[61]=0;var Eh=e=>{if(e>=Gl.length||Gl[e]===255)throw new TypeError(`Invalid character ${String.fromCharCode(e)}`);return Gl[e]};var PR=e=>Yc(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),yb=e=>{let t=e.replace(/[\n\r]/g,""),r=t.length;if(r%4===1)return Z(new cn({module:"Base64Url",kind:"Decode",input:t,message:`Length should be a multiple of 4, but is ${r}`}));if(!/^[-_A-Z0-9]*?={0,2}$/i.test(t))return Z(new cn({module:"Base64Url",kind:"Decode",input:t,message:"Invalid input"}));let n=r%4===2?`${t}==`:r%4===3?`${t}=`:t;return n=n.replace(/-/g,"+").replace(/_/g,"/"),ai(n)},FR=e=>Nt(yb(e),t=>q4.decode(t)),q4=new TextDecoder;var Kl=e=>Object.assign(Object.create(Fx),e);function W4(e){return $R((t,r)=>C(e(t,r)))}function bh(e){return W4((t,r)=>{let n={message:e(t)};return ve(t)?new ql(n,t.value,r):new ql(n)})}var RR=bh(()=>"Encoding is not supported"),V4=Kl({_tag:"Passthrough"});function _o(){return V4}function le(e){return Kl({_tag:"Transform",transform:e})}function ar(e){return Kl({_tag:"TransformEffect",transform:e})}function Ih(e){return Kl({_tag:"TransformOptional",transform:e})}function $R(e){return Kl({_tag:"TransformOptionalEffect",transform:e})}function Sb(){return Ih(()=>v())}function Eb(e){return $R(t=>{let r=tc(t,pt);return ve(r)?y(r):ei(e,R)})}function ii(){return le(globalThis.String)}function Ch(){return le(globalThis.Number)}function NR(){return le(globalThis.BigInt)}function bb(){return le(e=>new globalThis.Date(e))}function MR(){return le(__)}function UR(e){return ar((t,r)=>ht({try:()=>JSON.parse(t,e?.reviver),catch:()=>new ce({expected:"a valid JSON string"},t,r)}))}function DR(e){return ar((t,r)=>ht({try:()=>{let n=JSON.stringify(t,e?.replacer,e?.space);if(n===void 0)throw new TypeError("Value cannot be represented as JSON");return n},catch:()=>new ce({expected:"a JSON-serializable value"},t,r)}))}function Ib(){return le(Yc)}function Th(){return le(PR)}function wh(){return le(Wd)}function LR(){return ar((e,t)=>bl(gl(ai(e)),()=>new ce({expected:"a valid Base64 string"},e,t)))}function BR(){return ar((e,t)=>xr(_R(e),{onFailure:()=>C(new ce({expected:"a valid Base64 string"},e,t)),onSuccess:y}))}function jR(){return ar((e,t)=>xr(yb(e),{onFailure:()=>C(new ce({expected:"a valid Base64Url string"},e,t)),onSuccess:y}))}function zR(){return ar((e,t)=>xr(FR(e),{onFailure:()=>C(new ce({expected:"a valid Base64Url string"},e,t)),onSuccess:y}))}function qR(){return ar((e,t)=>xr(yy(e),{onFailure:()=>C(new ce({expected:"a valid hexadecimal string"},e,t)),onSuccess:y}))}function HR(){return ar((e,t)=>xr(Jk(e),{onFailure:()=>C(new ce({expected:"a valid hexadecimal string"},e,t)),onSuccess:y}))}function WR(){return le(encodeURIComponent)}function VR(){return ar((e,t)=>{try{return y(globalThis.decodeURIComponent(e))}catch{return C(new ce({expected:"a valid URI component"},e,t))}})}function GR(){return le(e=>QR(Array.from(e.entries())))}var G4=YR(e=>typeof e=="string"||typeof Blob<"u"&&e instanceof Blob);function KR(){return le(e=>{let t=new FormData;return typeof e=="object"&&e!==null&&G4(e).forEach(([n,o])=>{t.append(n,o)}),t})}function JR(){return le(e=>QR(Array.from(e.entries())))}var K4=YR(En);function ZR(){return le(e=>typeof e=="object"&&e!==null?new URLSearchParams(K4(e)):new URLSearchParams)}function J4(e){if(e==="")return[""];let t=e.replace(/\[(.*?)\]/g,".$1"),r=t.split("."),n=t.startsWith(".")?1:0;return r.slice(n).map(o=>nc(o)?globalThis.Number(o):o)}var Z4=20;function QR(e){let t={},r=new WeakSet,n=new WeakSet,o=new Map;e.forEach(([s,a])=>{let i=J4(s),c=t;for(let f=0;f<i.length;f++){let u=o.get(c),l=i[f]===""&&u!==void 0?u.length:i[f];u!==void 0&&typeof l=="number"&&(u.length=Math.max(u.length,l+1));let p=Object.hasOwn(c,l),h=p?c[l]:void 0;if(f===i.length-1){let g=o.get(h);if(g!==void 0)U(h,g.length++,a);else if(n.has(h))h.push(a);else if(p){let x=[h,a];n.add(x),U(c,l,x)}else U(c,l,a)}else{let g=i[f+1],x=typeof g=="number"||g==="";if(r.has(h)&&o.has(h)===x)c=h;else{let b={};r.add(b),x&&o.set(b,{parent:c,key:l,length:0}),U(c,l,b),c=b}}}});for(let[s,{key:a,length:i,parent:c}]of Array.from(o).reverse())c[a]===s&&i-Object.keys(s).length<=Z4&&U(c,a,Object.assign(new Array(i),s));return t}function YR(e){return t=>{let r=[];function n(o,s){if(e(s))r.push([o,s]);else if(Array.isArray(s))s.every(e)?s.forEach(i=>{r.push([o,i])}):s.forEach((i,c)=>{n(`${o}[${c}]`,i)});else if(typeof s=="object"&&s!==null)for(let[a,i]of Object.entries(s))n(`${o}[${a}]`,i)}for(let[o,s]of Object.entries(t))n(o,s);return r}}var XR=/^[+-]?\d+$/,Tb="~effect/BigDecimal",Q4={[Tb]:Tb,[Y](){let e=kb(this);return ae(Ae(String(e.value)),dt(e.scale))},[X](e){return wb(e)&&s$(this,e)===0},toString(){return`BigDecimal(${fs(this)})`},toJSON(){return{_id:"BigDecimal",value:String(this.value),scale:this.scale}},[qe](){return this.toJSON()},pipe(){return te(this,arguments)}},wb=e=>A(e,Tb),r$=(e,t)=>{if(!Number.isSafeInteger(t))throw new RangeError(`Scale must be a safe integer, got ${t}`);let r=Object.create(Q4);return r.value=e,r.scale=t,r},n$=(e,t)=>{let r=r$(e,t);return r.normalized=r,r};var Fn=BigInt(0),Y4=BigInt(1);var X4=BigInt(10),o$=n$(Fn,0);var kb=e=>{if(e.normalized===void 0)if(e.value===Fn)e.normalized=o$;else{let t=`${e.value}`,r=t.length;for(;t[r-1]==="0";)r--;e.normalized=n$(BigInt(t.slice(0,r)),e.scale-(t.length-r))}return e.normalized};var eG=100,tG=[Y4],Cb=(e,t)=>e===t?0:e<t?-1:1,e$=(e,t)=>{let r=`${e.value<Fn?-e.value:e.value}`,n=`${t.value<Fn?-t.value:t.value}`,o=BigInt(r.length-n.length)-BigInt(e.scale)+BigInt(t.scale);if(o!==Fn)return o<Fn?-1:1;let s=Math.max(r.length,n.length);return ck(r.padEnd(s,"0"),n.padEnd(s,"0"))},s$=(e,t)=>{if(e.scale===t.scale)return Cb(e.value,t.value);let r=t$(e),n=t$(t);if(r!==n)return r<n?-1:1;if(r===0)return 0;let o=e.scale-t.scale,s=Math.abs(o);if(s>eG)return r===-1?e$(t,e):e$(e,t);let a=tG[s]??=X4**BigInt(s);return o>0?Cb(e.value,t.value*a):Cb(e.value*a,t.value)},Xc=Ji(s$);var t$=e=>e.value===Fn?0:e.value<Fn?-1:1;var a$=e=>{if(e==="")return R(o$);let t,r,n=e.search(/[eE]/);if(n!==-1){let c=e.slice(n+1);if(t=e.slice(0,n),r=Number(c),t===""||!Number.isSafeInteger(r)||!XR.test(c))return v()}else t=e,r=0;let o,s,a=t.search(/\./);if(a!==-1){let c=t.slice(0,a),f=t.slice(a+1);o=`${c}${f}`,s=f.length}else o=t,s=0;if(!XR.test(o))return v();let i=s-r;return Number.isSafeInteger(i)?R(r$(BigInt(o),i)):v()};var fs=e=>{let t=kb(e);if(Math.abs(t.scale)>=16)return rG(t);let r=t.value<Fn,n=`${r?-t.value:t.value}`,o=t.scale>0?n.padStart(t.scale+1,"0"):n.padEnd(n.length-t.scale,"0"),s=o.length-t.scale,a=t.scale>0?`${o.slice(0,s)}.${o.slice(s)}`:o;return r?`-${a}`:a},rG=e=>{if(nG(e))return"0e+0";let t=kb(e),r=`${t.value}`,n=t.value<Fn?2:1,o=r.slice(0,n),s=r.slice(n),a=s.length-t.scale;return`${o}${s===""?"":`.${s}`}e${a>=0?"+":""}${a}`};var nG=e=>e.value===Fn;var kh=class extends vs{_tag="Middleware";decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new kh(this.encode,this.decode)}},Zl="~effect/SchemaTransformation/Transformation",Ne=class extends vs{[Zl]=Zl;_tag="Transformation";decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new Ne(this.encode,this.decode)}};function oG(e){return A(e,Zl)&&e[Zl]===Zl}var Ah=e=>oG(e)?e:new Ne(e.decode,e.encode);function $t(e){return new Ne(ar(e.decode),ar(e.encode))}function we(e){return new Ne(le(e.decode),le(e.encode))}function vh(e){return new Ne(Ih(e.decode),Ih(e.encode))}function c$(){return new Ne(MR(),_o())}var sG=new Ne(_o(),_o());function eu(){return sG}var tu=new Ne(Ch(),ii()),Oh=new Ne(NR(),ii()),Ab=new Ne(bb(),le(zx)),u$=new Ne(bb(),le(e=>e.getTime()));var vb=$t({decode:(e,t)=>Re(BP(e),{onNone:()=>C(new ce({expected:"a valid ByteSize string"},e,t)),onSome:y}),encode:e=>y(`${e} ${e===BigInt(1)?"byte":"bytes"}`)}),f$=$t({decode:(e,t)=>Re(FE(e),{onNone:()=>C(new ce({expected:"a non-negative bigint byte count"},e,t)),onSome:y}),encode:e=>y(ah(e))}),l$=$t({decode:(e,t)=>Re(FE(e),{onNone:()=>C(new ce({expected:"a non-negative safe-integer byte count"},e,t)),onSome:y}),encode:(e,t)=>Re(zP(e),{onNone:()=>C(new ce({expected:"a ByteSize representable as a safe integer"},e,t)),onSome:y})}),aG=e=>Dr(e)&&typeof e.message=="string",p$=e=>{let r=Object.hasOwn(e,"cause")?new Error(e.message,{cause:m$(e.cause)}):new Error(e.message);return typeof e.name=="string"&&e.name!=="Error"&&(r.name=e.name),typeof e.stack=="string"&&(r.stack=e.stack),r},iG=e=>{try{let t=Aa(e);return t===void 0?N(e):JSON.parse(t)}catch{return N(e)}},cG=(e,t,r)=>{let n={name:e.name,message:typeof e.message=="string"?e.message:""};return t?.includeStack&&typeof e.stack=="string"&&(n.stack=e.stack),!t?.excludeCause&&e.cause!==void 0&&(n.cause=r(e.cause)),n},d$=e=>{let t=new WeakSet,r=n=>{if(Tw(n)){if(t.has(n))return"[Circular]";t.add(n);let o=cG(n,e,r);return t.delete(n),o}return iG(n)};return r},m$=e=>aG(e)?p$(e):e,h$=e=>we({decode:p$,encode:t=>d$(e)(t)}),g$=e=>we({decode:m$,encode:d$(e)});function x$(){return we({decode:uk,encode:Xx})}function y$(){return we({decode:Fs,encode:er})}function S$(e){return we({decode:Ra,encode:e?.onNoneEncoding===null?Xx:er})}function E$(){return vh({decode:R,encode:ec})}function b$(){return vh({decode:e=>e.pipe(tc(pt),R),encode:ec})}var Ob=$t({decode:(e,t)=>URL.canParse(e)?y(new URL(e)):C(new ce({expected:"a valid URL string"},e,t)),encode:e=>y(e.href)});var _b=new Ne(LR(),Ib()),I$=new Ne(BR(),Ib()),C$=new Ne(zR(),Th()),T$=new Ne(HR(),wh()),w$=new Ne(VR(),WR());function k$(e){return new Ne(UR(e??{}),DR(e))}var A$=new Ne(GR(),KR()),v$=new Ne(JR(),ZR());function ra(e){return t=>t._tag===e}var au=ra("Declaration");var uG=ra("Never");var nu=ra("Literal"),Fb=ra("UniqueSymbol");var Bb=ra("Arrays"),fG=ra("Objects"),U$=ra("Union"),D$=ra("Suspend"),ft=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},Fo={},Po=class{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,r=void 0,n=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=r,this.annotations=n}},O$="~effect/Schema",yt=class{[O$]=O$;annotations;checks;encoding;context;constructor(t=void 0,r=void 0,n=void 0,o=void 0){this.annotations=t,this.checks=r,this.encoding=n,this.context=o}toString(){return`<${this._tag}>`}},iu=class extends yt{_tag="Declaration";typeParameters;run;encodingChecks;encodingRun;constructor(e,t,r,n,o,s,a,i){super(r,n,o,s),this.typeParameters=e,this.run=t,this.encodingChecks=a,this.encodingRun=i}getParser(){let e;return(t,r)=>t===me?Ar:(e??=this.run(this.typeParameters))(t,this,r)}_rebuild(e,t,r,n,o){let s=ui(this.typeParameters,e);return s===this.typeParameters&&t===this.checks&&r===this.encodingChecks&&n===this.run&&o===this.encodingRun?this:new iu(s,n,this.annotations,t,void 0,this.context,r,o)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks,this.run,this.encodingRun)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks,this.encodingRun??this.run,this.run)}getExpected(){let e=this.annotations?.expected;return typeof e=="string"?e:"<Declaration>"}},lG=class extends yt{_tag="Null";getParser(){return Bh(this,null)}getExpected(){return"null"}},jb=new lG;var pG=class extends yt{_tag="Undefined";getParser(){return Bh(this,void 0)}toCodecJson(){return Je(this,[L$])}getExpected(){return"undefined"}},L$=new ft(jb,new Ne(le(()=>{}),le(()=>null))),zb=new pG;var dG=class extends yt{_tag="Void";getParser(){let e=Vt(void 0);return t=>t===me?Ar:e}toCodecJson(){return Je(this,[L$])}getExpected(){return"void"}},B$=new dG;var mG=class extends yt{_tag="Never";getParser(){return Nn(this,Cw)}getExpected(){return"never"}},qb=new mG,hG=class extends yt{_tag="Any";getParser(){return Nn(this,Nx)}getExpected(){return"any"}},j$=new hG,gG=class extends yt{_tag="Unknown";getParser(){return Nn(this,Nx)}getExpected(){return"unknown"}},ls=new gG,xG=class extends yt{_tag="ObjectKeyword";getParser(){return Nn(this,uf)}getExpected(){return"object | array | function"}},z$=new xG,q$=class extends yt{_tag="Enum";enums;constructor(e,t,r,n,o){super(t,r,n,o);for(let[,s]of e)if(typeof s=="number"&&!globalThis.Number.isFinite(s))throw new Error(`A numeric enum value must be finite, got ${N(s)}`);this.enums=e}getParser(){let e=new Set(this.enums.map(([,t])=>t));return Nn(this,t=>e.has(t))}toCodecStringTree(){if(this.enums.some(([e,t])=>typeof t=="number")){let e=Object.fromEntries(this.enums.map(([t,r])=>[globalThis.String(r),r]));return Je(this,[new ft(new Or(Object.keys(e).map(t=>new Yr(t))),new Ne(le(t=>e[t]),ii()))])}return this}getExpected(){return this.enums.map(([e,t])=>JSON.stringify(t)).join(" | ")}};function Pb(e){return typeof e=="number"?`parts[${e}]`:e}function Rb(e,t,r){if(r.has(e))return!0;if(e.encoding)throw new Error(`TemplateLiteral parts cannot have an encoding at ${Pb(t)}`);let n;switch(e._tag){case"String":case"Number":case"BigInt":n=!0;break;case"Literal":n=!e.checks;break;case"TemplateLiteral":{let o=Pb(t);n=!e.checks&&e.parts.every((s,a)=>Rb(s,`${o}.parts[${a}]`,r));break}case"Union":{let o=Pb(t);n=!e.checks&&e.types.every((s,a)=>Rb(s,`${o}.types[${a}]`,r));break}default:return!1}return n&&r.add(e),n}var Hb=class extends yt{_tag="TemplateLiteral";parts;encodedParts;literals;suffixLengths;constructor(e,t,r,n,o){super(t,r,n,o);let s=[],a=[],i=new Set;for(let f=0;f<e.length;f++){let u=e[f];if(!Rb(u,f,i))throw new Error(`Invalid TemplateLiteral part ${u._tag}`);s.push(u),a.push(u._tag==="Literal"?globalThis.String(u.literal):void 0)}let c=new Array(s.length+1);c[s.length]=0;for(let f=s.length-1;f>=0;f--)c[f]=c[f+1]+(a[f]?.length??0);this.parts=e,this.encodedParts=s,this.literals=a,this.suffixLengths=c}getParser(e){let t=new dn(!1,this.parts.map(oI),[]),r=e(lu(Qr,t,W$(this)));return(n,o)=>{if(n===me)return Ar;let s=r(n,o);return s._tag==="Success"?je:Wt(s,{onSuccess:()=>n,onFailure:a=>new At(this,[a],n,o)})}}getExpected(){return"string"}matchPart(e,t){return xN(this,e,t)===void 0?void 0:e}};function H$(e){let t=Sn(o=>{if(o._tag!=="Union")return o;let s=ui(o.types,t);return(o.options?.mode??"anyOf")==="anyOf"&&s===o.types?o:new Or(s,o.options===void 0?void 0:{...o.options,mode:"anyOf"},o.annotations,o.checks,void 0,o.context)}),r=new Hb(e.map(o=>t($n(o)))),n=new dn(!1,e.map(oI),[]);return lu(r,n,W$(r))}function W$(e){return new Ne(ar((t,r)=>{let n=xN(e,t,r);return n?y(n):C(new ce({expected:"a string matching template literal parts"},t,r))}),le(t=>t.join("")))}var V$=class extends yt{_tag="UniqueSymbol";symbol;constructor(e,t,r,n,o){super(t,r,n,o),this.symbol=e}getParser(){return Bh(this,this.symbol)}toCodecStringTree(){let e=globalThis.Symbol.keyFor(this.symbol);return Je(this,[new ft(e===void 0?qb:new Yr(globalThis.String(this.symbol)),EN.transformation)])}getExpected(){return globalThis.String(this.symbol)}},Yr=class extends yt{_tag="Literal";literal;constructor(e,t,r,n,o){if(super(t,r,n,o),typeof e=="number"&&!globalThis.Number.isFinite(e))throw new Error(`A numeric literal must be finite, got ${N(e)}`);this.literal=e}getParser(){return Bh(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal=="bigint"?_$(this):this}toCodecStringTree(){return typeof this.literal=="string"?this:_$(this)}getExpected(){return typeof this.literal=="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}};function _$(e){let t=globalThis.String(e.literal);return Je(e,[new ft(new Yr(t),new Ne(le(()=>e.literal),le(()=>t)))])}var yG=class extends yt{_tag="String";getParser(){return Nn(this,En)}matchPart(e,t){let r=this.checks;return r&&!t.disableChecks&&Mn(r,e,void 0,this,t)?void 0:e}getExpected(){return"string"}},Qr=new yG,SG=class extends yt{_tag="Number";getParser(){return Nn(this,af)}matchKey(e,t){return this._match(UG,e,t)}matchPart(e,t){return this._match(Ub,e,t)}_match(e,t,r){if(!e.test(t))return;let n=globalThis.Number(t);return r.disableChecks||!this.checks?n:Mn(this.checks,n,void 0,this,r)?void 0:n}toCodecJson(){return this.checks&&($b(this.checks,"effect/schema/isFinite")||$b(this.checks,"effect/schema/isInt"))?this:Je(this,[_G])}toCodecStringTree(){return this.toCodecJson()===this?Je(this,[DG]):Je(this,[LG])}getExpected(){return"number"}};function $b(e,t){return e.some(r=>r.annotations?.representation?.id===t||r._tag==="FilterGroup"&&$b(r.checks,t))}var Wb=new SG,EG=class extends yt{_tag="Boolean";getParser(){return Nn(this,ld)}getExpected(){return"boolean"}},G$=new EG,bG=class extends yt{_tag="Symbol";getParser(){return Nn(this,$x)}matchKey(e,t){return t.disableChecks||!this.checks?e:Mn(this.checks,e,void 0,this,t)?void 0:e}toCodecStringTree(){return Je(this,[EN])}getExpected(){return"symbol"}},K$=new bG,IG=class extends yt{_tag="BigInt";getParser(){return Nn(this,bw)}matchPart(e,t){if(!Db.test(e))return;let r=globalThis.BigInt(e);return t.disableChecks||!this.checks?r:Mn(this.checks,r,void 0,this,t)?void 0:r}toCodecStringTree(){return Je(this,[jG])}getExpected(){return"bigint"}},J$=new IG,dn=class extends yt{_tag="Arrays";isMutable;elements;rest;encodingChecks;constructor(e,t,r,n,o,s,a,i){super(n,o,s,a),this.isMutable=e,this.elements=t,this.rest=r,this.encodingChecks=i;let c=!1;for(let f=0;f<t.length;f++)if(Gt(t[f]))c=!0;else if(c)throw new Error("A required element cannot follow an optional element. ts(1257)");if(c&&r.length>1)throw new Error("A required element cannot follow an optional element. ts(1257)");for(let f=1;f<r.length;f++)if(Gt(r[f]))throw new Error("An optional element cannot follow a rest element. ts(1266)")}getParser(e,t=e){let r=this,n,o,s=r.elements.length,a=Math.max(0,r.rest.length-1);function i(u,l){return l<s?n[l]:l>=u?o[l-u+1]:o[0]}let c=u=>{let{input:l,len:p,options:h}=u;if(r.rest.length===0&&p>s)for(let g=s;g<p;g++){let x=new cb(r,l[g],h),b=new kt([g],x);if(h.errors==="all")u.issues?u.issues.push(b):u.issues=[b];else return C(new At(r,[b],l,h))}return u.issues?C(new At(r,u.issues,l,h)):Vt(u.output)},f=(u,l)=>{let p=u.length,h={ast:r,getParser:i,input:u,len:p,tailThreshold:Math.max(s,p-a),output:new globalThis.Array(p),issues:void 0,options:l},g=r.rest.length===0?s:Math.max(p,s+a),x=l.concurrency===void 0?1:Zf(l.concurrency),b=x===1?TG(h,u,0,g):wG(h,u,{concurrency:x,end:g});if(!b)return c(h);if($e(b))return Rt(b,()=>c(h));let T=!0;return Ie(()=>T?(T=!1,L(b,()=>c(h))):f(u,l))};return(u,l)=>{if(u===me)return Ar;try{return Array.isArray(u)?(n||(n=r.elements.map(p=>({ast:p,parser:t(p)})),o=r.rest.map(p=>({ast:p,parser:t(p)}))),f(u,l)):C(new xt(r,u,l))}catch(p){return sr(p)}}}_rebuild(e,t,r){let n=ui(this.elements,e),o=ui(this.rest,e);return n===this.elements&&o===this.rest&&t===this.checks&&r===this.encodingChecks?this:new dn(this.isMutable,n,o,this.annotations,t,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return"array"}};function CG(e,t,r,n){if(r._tag==="Failure")return Fh(e,e.ast,n,r);let o=r===je?t:r[ue];if(o!==me)e.output[n]=o;else{let s=e.getParser(e.tailThreshold,n);if(Gt(s.ast))return;let a=new kt([n],new ea(s.ast.context?.annotations));if(e.options.errors==="all")e.issues?e.issues.push(a):e.issues=[a];else return wn(new At(e.ast,[a],e.input,e.options))}}var Z$={onItem(e,t,r){let n=r<e.len?t:me;return e.getParser(e.tailThreshold,r).parser(n,e.options)},step:CG},TG=wm()(Z$),wG=km()(Z$),Fh=(e,t,r,n)=>{if(n.cause.reasons.length===0)return n;let o=Wl(n.cause);if(o===void 0)return yo(qs(n.cause,a=>new At(t,[new kt([r],a)],e.input,e.options)));let s=new kt([r],o);if(e.options.errors==="all")e.issues?e.issues.push(s):e.issues=[s];else return wn(new At(t,[s],e.input,e.options))},$h="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";function ta(e,t,r=Fo){let n,o;function s(a){switch(a._tag){case"String":case"TemplateLiteral":return(n??=Object.keys(e)).filter(i=>a.matchPart(i,r)!==void 0);case"Number":return(n??=Object.keys(e)).filter(i=>a.matchKey(i,r)!==void 0);case"Symbol":return(o??=Object.getOwnPropertySymbols(e)).filter(i=>Object.prototype.propertyIsEnumerable.call(e,i)&&a.matchKey(i,r)!==void 0);case"Union":return[...new Set(a.types.flatMap(s))];default:return[]}}return s(nI($n(t)))}var Vb=class{name;type;constructor(e,t){this.name=e,this.type=t}};function Q$(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every(Q$);default:return!1}}function Y$(e){let t=uu(e);switch(t._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return t.types.every(Y$);default:return!1}}function kG(e){return Q$(e)&&Y$(e)}var Gb=class{parameter;type;constructor(e,t){if(!kG(e))throw new Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,Gt(t)&&!gN(t))throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},Ql=class extends yt{_tag="Objects";propertySignatures;indexSignatures;encodingChecks;constructor(e,t,r,n,o,s,a){super(r,n,o,s),this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=a}getParser(e,t=e){let r=this,n=r.propertySignatures.length,o=r.indexSignatures.length;if(!n&&!o)return Nn(r,dd);let s,a,i=()=>(s||(s=r.propertySignatures.map(l=>({parser:t(l.type),name:l.name,type:l.type})),a=o?r.indexSignatures.map(l=>({is:l,parserKey:e(nI(l.parameter)),parserValue:t(l.type)})):void 0),s),c=()=>{let l=new Set(r.propertySignatures.map(b=>typeof b.name=="number"?globalThis.String(b.name):b.name)),p=(b,T,w,P,O)=>{if(O._tag==="Failure")return Fh(b,r,T,O)??kn;let d=O===je?P:O[ue];if(w!==me&&d!==me){if(n&&(l.has(T)||l.has(typeof w=="number"?globalThis.String(w):w)))return kn;U(b.out,w,d)}return kn},h=(b,T,w,P)=>{if(!P){let E=w.parserKey(T,b.options);if(!$e(E))return L(Vs(E),I=>h(b,T,w,I));P=E}if(P._tag==="Failure")return Fh(b,r,T,P)??kn;let O=P===je?T:P[ue],d=b.input[T],S=w.parserValue(d,b.options);return $e(S)?p(b,T,O,d,S):L(Vs(S),E=>p(b,T,O,d,E))},g=(b,T,w)=>{let P=b.input[T],O=w.parserValue(P,b.options);return $e(O)?p(b,T,T,P,O):L(Vs(O),d=>p(b,T,T,P,d))},x=o?km()({onItem:(b,[T,w])=>w.is.parameter===Qr?g(b,T,w):h(b,T,w),step:(b,T,w)=>w._tag==="Failure"?w:void 0}):void 0;return AE(function*(b,T){if(b===me)return me;if(!(typeof b=="object"&&b!==null&&!Array.isArray(b)))return yield*C(new xt(r,b,T));i();let w=b,P={},O={ast:r,input:w,out:P,issues:void 0,options:T},d=T.errors==="all",S=T.onExcessProperty==="error",E=T.concurrency===void 0?1:Zf(T.concurrency),I=o&&S?r.indexSignatures.map(k=>ta(w,k.parameter,T)):void 0;if(S){let k=I?new Set(l):l;if(I)for(let M of I)for(let z of M)k.add(z);let _=Reflect.ownKeys(w);for(let M=0;M<_.length;M++){let z=_[M];if(!k.has(z)&&Object.prototype.propertyIsEnumerable.call(w,z)){let de=new cb(r,w[z],T),ne=new kt([z],de);if(d){O.issues?O.issues.push(ne):O.issues=[ne];continue}else return yield*C(new At(r,[ne],b,T))}}}if(n){let k=E===1?P$(O,s):AG(O,s,{concurrency:E});k&&(yield*k)}if(o&&E===1)for(let k=0;k<o;k++){let _=a[k],M=_.is.parameter===Qr?g:h,z=I?.[k]??(_.is.parameter===Qr?Object.keys(w):ta(w,_.is.parameter,T));for(let de=0;de<z.length;de++){let ne=M(O,z[de],_);if(!$e(ne))yield*ne;else if(ne._tag==="Failure")return yield*ne}}else if(x){let k=Ma();for(let M=0;M<o;M++){let z=a[M],de=I?.[M]??(z.is.parameter===Qr?Object.keys(w):ta(w,z.is.parameter,T));for(let ne=0;ne<de.length;ne++)k.push([de[ne],z])}let _=x(O,k,{concurrency:E});_&&(yield*_)}return O.issues?yield*C(new At(r,O.issues,b,T)):P})};if(o)return c();let f,u=(l,p,h)=>{let g=s[p];return L(Vs(h),x=>{let b=Nb(l,g,x);if(b)return b;let T=()=>Vt(l.out),w=P$(l,s.slice(p+1));return w?Rt(w,T):T()})};return(l,p)=>{if(l===me)return Ar;if(p.errors==="all"||p.onExcessProperty!==void 0||p.concurrency!==void 0&&Zf(p.concurrency)!==1)return(f??=c())(l,p);if(!(typeof l=="object"&&l!==null&&!Array.isArray(l)))return C(new xt(r,l,p));let h=i(),g=l,x={},b={ast:r,input:g,out:x,issues:void 0,options:p};try{for(let T=0;T<h.length;T++){let w=h[T],P=w.name,O=ru(g,P),d=O?g[P]:me,S=w.parser(d,p);if(!$e(S))return u(b,T,S);if(S===je){O&&U(x,P,d);continue}let E=Nb(b,w,S);if(E)return E}}catch(T){return sr(T)}return Vt(x)}}_rebuild(e,t,r,n){let o=ui(this.propertySignatures,a=>{let i=e(a.type);return i===a.type?a:new Vb(a.name,i)}),s=ui(this.indexSignatures,a=>{let i=t(a.parameter),c=e(a.type);return i===a.parameter&&c===a.type?a:new Gb(i,c)});return o===this.propertySignatures&&s===this.indexSignatures&&r===this.checks&&n===this.encodingChecks?this:new Ql(o,s,this.annotations,r,void 0,this.context,n)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?"object | array":"object"}};function Nb(e,t,r){if(r._tag==="Failure")return Fh(e,e.ast,t.name,r);if(r===je)return;let n=r[ue];if(n!==me){U(e.out,t.name,n);return}if(delete e.out[t.name],!Gt(t.type)){let o=new kt([t.name],new ea(t.type.context?.annotations));if(e.options.errors==="all"){e.issues?e.issues.push(o):e.issues=[o];return}else return wn(new At(e.ast,[o],e.input,e.options))}}var X$={onItem(e,t){if(!ru(e.input,t.name))return t.parser(me,e.options);let r=e.input[t.name];return U(e.out,t.name,r),t.parser(r,e.options)},step:Nb},P$=wm()(X$),AG=km()(X$);function Kb(e,t){return e?t?[...e,...t]:e:t}function Nh(e,t,r){return new Ql(Reflect.ownKeys(e).map(n=>new Vb(n,e[n].ast)),[],r,t)}function Yl(e){return e.ast}function Jb(e,t=void 0){return new dn(!1,e.map(r=>r.ast),[],void 0,t)}function Mh(e,t,r){return new Or(e.map(Yl),t,void 0,r)}function eN(e,t){if(e.encoding||t.some(s=>s.encoding))throw new Error("StructWithRest does not support encodings");let r=e.propertySignatures,n=e.indexSignatures,o=e.checks;for(let s of t){for(let a of s.propertySignatures)if(r.some(i=>i.name===a.name))throw new Error(`Duplicate identifier: ${JSON.stringify(a.name)}. ts(2300)`);r=r.concat(s.propertySignatures),n=n.concat(s.indexSignatures),o=Kb(o,s.checks)}return new Ql(r,n,void 0,o)}function tN(e,t){if(e.encoding)throw new Error("TupleWithRest does not support encodings");return new dn(e.isMutable,e.elements,t,void 0,e.checks)}function rN(e){if(e.encoding)throw new Error("mutable does not support encodings");return new dn(!0,e.elements,e.rest,e.annotations,e.checks,void 0,e.context,e.encodingChecks)}var Zb=Ca(e=>{for(;;){if(D$(e))return ls;let t=e.encoding;if(!t)return e.recur?.(Zb,F)??e;if(t.some(r=>r.transformation._tag==="Middleware"&&r.transformation.decode!==F))return ls;e=t[t.length-1].to}});function nN(e){switch(e._tag){case"Null":return["null"];case"Undefined":return["undefined"];case"String":case"TemplateLiteral":return["string"];case"Number":return["number"];case"Boolean":return["boolean"];case"Symbol":case"UniqueSymbol":return["symbol"];case"BigInt":return["bigint"];case"Arrays":return["array"];case"ObjectKeyword":return["object","array","function"];case"Objects":return e.propertySignatures.length||e.indexSignatures.length?["object"]:["string","number","boolean","symbol","bigint","object","array","function"];case"Enum":return Array.from(new Set(e.enums.map(([,t])=>typeof t)));case"Literal":return[typeof e.literal];case"Union":return Array.from(new Set(e.types.flatMap(nN)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function ou(e){switch(e._tag){default:return[];case"Declaration":{let t=e.annotations?.[Ul];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap(t=>{let r=t.type;if(!Gt(r)){if(nu(r))return[{key:t.name,literal:r.literal}];if(Fb(r))return[{key:t.name,literal:r.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,r)=>{if(!Gt(t)){if(nu(t))return[{key:r,literal:t.literal}];if(Fb(t))return[{key:r,literal:t.symbol}]}return[]});case"Union":{if(e.types.length===0)return[];let t=e.types.map(r=>ou(Zb(r)));return t[0].filter(r=>t.every(n=>n.some(o=>o.key===r.key&&o.literal===r.literal)))}case"Suspend":return ou(e.thunk())}}var F$=new WeakMap,Ph=Object.freeze([]),R$=e=>e===null?"null":Array.isArray(e)?"array":typeof e,ru=(e,t)=>t==="__proto__"?Object.hasOwn(e,t):t in e;function Xl(e){let t=F$.get(e);if(t)return t;let r,n=0,o,s,a=!0,i=[];for(let u=0;u<e.length;u++){let l=e[u],p=Zb(l);if(uG(p))continue;if(nu(p)||Fb(p)){s??=new Map;let g=nu(p)?p.literal:p.symbol;i[u]=g;let x=s.get(g);x||s.set(g,x=[]),x.push(u)}else a=!1;let h=ou(p);if(h.length){r??=new Map,n++;for(let{key:g,literal:x}of h){let b=r.get(g);b||r.set(g,b=[new Map,new Set]),b[1].add(u);let T=b[0].get(x);T||b[0].set(x,T=new Set),T.add(u)}}else{o??={};let g=nN(p);for(let x of g)(o[x]??=[]).push(u)}}let c={},f=u=>c[u]??=Object.freeze(o?.[u]??Ph);if(a&&s)s.forEach(Object.freeze),t=u=>s.get(u)??Ph;else if(r?.size===1&&!o){let[u,[l]]=r.entries().next().value,p=new Map;for(let[g,x]of l)p.set(g,Object.freeze(Array.from(x)));let h=Object.freeze(e.map((g,x)=>x));t=(g,x)=>{if(uf(g)){let b=ru(g,u)?g[u]:void 0;if(b!==void 0)return p.get(b)??Ph;if(x)return h}return Ph}}else if(r){let u;for(let l of r)(!u||l[1][0].size>u[1][0].size)&&l[1][1].size===n&&(u=l);t=(l,p)=>{let h=R$(l);if(!uf(l))return f(h);let g=new Set(o?.[h]),x;if(u){let[b,[T]]=u,w=ru(l,b),P=w?l[b]:void 0;if(w&&(!p||P!==void 0)){let O=T.get(P);if(!O)return f(h);for(let d of O)g.add(d);x=b}}if(x===void 0)for(let[b,[T,w]]of r){let P=ru(l,b),O=P?l[b]:void 0;if(P&&(!p||O!==void 0)){let d=T.get(O);if(d)for(let S of d)g.add(S)}else if(p)for(let d of w)g.add(d)}for(let[b,[T,w]]of r){if(b===x)continue;let P=ru(l,b),O=P?l[b]:void 0;if(P&&(!p||O!==void 0)){let d=T.get(O);for(let S of g)w.has(S)&&!d?.has(S)&&g.delete(S)}}return Array.from(g).sort((b,T)=>b-T)}}else t=u=>{let l=f(R$(u));return s?l.filter(p=>i[p]===void 0||i[p]===u):l};return F$.set(e,t),t}var Or=class extends yt{_tag="Union";types;options;encodingChecks;constructor(e,t,r,n,o,s,a){super(r,n,o,s),this.types=e,this.options=t,this.encodingChecks=a}getParser(e,t){let r=this,n=t!==void 0,o=[],s=i=>o[i]??=e(r.types[i]),a;return(i,c)=>{if(i===me)return Ar;let f=(a??=Xl(r.types))(i,n);if(f.length===0)return C(new Hl(r,[],i,c));if(f.length===1){let u=s(f[0])(i,c);return u._tag==="Success"?u:$e(u)?oN(r,u.cause,i,c):vG(r,u,i,c)}return sN(r,s,f,i,c)}}_rebuild(e,t,r){let n=ui(this.types,e);return n===this.types&&t===this.checks&&r===this.encodingChecks?this:new Or(n,this.options,this.annotations,t,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let r of this.types){let n=r.matchPart(e,t);if(n!==void 0)return n}}getExpected(e){let t=this.annotations?.expected;if(typeof t=="string")return t;if(this.types.length===0)return"never";let r=this.types.map(n=>{let o=$n(n);switch(o._tag){case"Arrays":{let s=o.elements.filter(nu);if(s.length>0)return`${N$(o.isMutable)}[ ${s.map(a=>e(a)+M$(a.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let s=o.propertySignatures.filter(a=>nu(a.type));if(s.length>0)return`{ ${s.map(a=>`${N$(a.type.context?.isMutable)}${Yn(a.name)}${M$(a.type.context?.isOptional)}: ${e(a.type)}`).join(", ")}, ... }`;break}}return e(o)});return Array.from(new Set(r)).join(" | ")}};function oN(e,t,r,n){let o=Wl(t);return o?wn(new Hl(e,[o],r,n)):yo(t)}function vG(e,t,r,n){return br(t,o=>oN(e,o,r,n))}function sN(e,t,r,n,o){let s={ast:e,parser:t,input:n,out:void 0,successes:e.options?.mode==="oneOf"?[]:void 0,issues:void 0,options:o},a=OG(s,r);if(!a)return s.out?s.out:C(new Hl(e,s.issues??[],n,o));if($e(a))return $$(a,s);let i=!0;return Ie(()=>i?(i=!1,$$(a,s)):sN(e,t,r,n,o))}function $$(e,t){return Rt(e,r=>t.out===je?y(t.input):t.out?t.out:C(new Hl(t.ast,t.issues??[],t.input,t.options)))}var OG=wm()({onItem(e,t){return e.parser(t)(e.input,e.options)},step(e,t,r){if(r._tag==="Failure"){let n=Wl(r.cause);if(n===void 0)return r;e.issues?e.issues.push(n):e.issues=[n]}else{if(e.out&&e.successes)return e.successes.push(e.ast.types[t]),wn(new iR(e.ast,e.successes,e.input,e.options));if(e.out=r,e.successes)e.successes.push(e.ast.types[t]);else return kn}}}),aN=new Or([new Yr("Infinity"),new Yr("-Infinity"),new Yr("NaN")]);function N$(e){return e?"":"readonly "}function M$(e){return e?"?":""}var Qb=class extends yt{_tag="Suspend";thunk;constructor(e,t,r,n,o){if(r)throw new Error("Cannot add checks to Suspend");super(t,void 0,n,o);let s;this.thunk=()=>s??=e()}getParser(e){let t;return(r,n)=>(t??=e(this.thunk()))(r,n)}recur(e){return new Qb(()=>e(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(e){return e(this.thunk())}},Rh=class extends vs{_tag="Filter";run;annotations;aborted;constructor(e,t=void 0,r=!1){super(),this.run=e,this.annotations=t,this.aborted=r}annotate(e){return new Rh(this.run,{...this.annotations,...e},this.aborted)}abort(){return new Rh(this.run,this.annotations,!0)}and(e,t){return new ci([this,e],t)}},ci=class extends vs{_tag="FilterGroup";checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new ci(this.checks,{...this.annotations,...e})}and(e,t){return new ci([this,e],t)}};function Uh(e,t,r=!1){return new Rh((n,o,s)=>uR(o,e(n,o,s),n,s),t,r)}function Dh(e,t){return new Rh((r,n,o)=>e(r)?void 0:new ce(void 0,r,o),t,!0)}function Yb(e){return Uh(t=>globalThis.Number.isFinite(t),{expected:"a finite number",representation:{id:"effect/schema/isFinite",payload:null},toJsonSchema:()=>({type:"number"}),toCode:()=>({runtime:"Schema.isFinite()"}),arbitraryConstraint:{number:"finite"},...e})}var Xb=Ro(Wb,[Yb()]),_G=new ft(new Or([Xb,aN]),new Ne(Ch(),le(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function ep(e,t){let r=new globalThis.RegExp(e),n={source:r.source,flags:r.flags};return Uh(o=>(r.lastIndex=0,r.test(o)),{expected:`a string matching the RegExp ${n.source}`,representation:{id:"effect/schema/isPattern",payload:n},toJsonSchema:()=>[{},!0],arbitraryConstraint:{patterns:[n]},...t})}var Mb=new WeakMap;function tp(e,t){let r=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(n=>n==="context"||n==="encoding")&&Mb.set(r,cu(e)),r}function cu(e){let t=Mb.get(e);if(t!==void 0)return t;if(e.encoding===void 0)return e;let r=Object.assign(Object.create(Object.getPrototypeOf(e)),e,{encoding:void 0});return Mb.set(e,r),r}function Je(e,t){return e.encoding===t?e:tp(e,{encoding:t})}function fi(e,t){if(e.context===t)return e;let r=cu(e);return r.context===t&&r.encoding===e.encoding?r:tp(e,{context:t})}function uu(e){return e.encoding?uu(e.encoding[e.encoding.length-1].to):e}function Rn(e,t){if(e.checks){let r=e.checks[e.checks.length-1];return iN(e,Ud(e.checks.slice(0,-1),r.annotate(t)))}return tp(e,{annotations:{...e.annotations,...t}})}function iN(e,t){if(e._tag==="Suspend"&&t)throw new Error("Cannot add checks to Suspend");return e.checks===t?e:tp(e,{checks:t})}function Ro(e,t){return iN(e,Kb(e.checks,t))}function fu(e,t){let r=t(e.to);return r===e.to?e:new ft(r,e.transformation)}function cN(e,t){let r=e,n=r[r.length-1],o=fu(n,t);return o===n?e:Ud(e.slice(0,e.length-1),o)}function eI(e){return t=>t.encoding?Je(t,cN(t.encoding,e)):t}function Lh(e,t){return eI(r=>fi(r,t))(e)}function li(e,t){function r(n){if(n.encoding){let o=n.encoding[n.encoding.length-1];return t?.stopAt?.(o)?n:Je(n,cN(n.encoding,r))}return e(n)}return Ca(r)}function uN(e,t){return tI(e,t,It(e))}function fN(e,t){return tI($n(e),t,e)}function tI(e,t,r){let n=new ft(e,t);return Je(r,r.encoding?[...r.encoding,n]:[n])}function ui(e,t){let r;for(let n=0;n<e.length;n++){let o=e[n],s=t(o);if(r)r[n]=s;else if(s!==o){r=new Array(e.length);for(let a=0;a<n;a++)r[a]=e[a];r[n]=s}}return r??e}function rp(e,t){let r=e.context?new Po(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new Po(!1,!1,void 0,t);return fi(e,r)}var pi=Ca(e=>{let t=e.context?e.context.isOptional===!1?new Po(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new Po(!0,!1);return PG(fi(e,t))}),PG=eI(pi),lN=Sn(e=>pi(new Or([e,zb]))),rI=Ca(e=>{let t=e.context?e.context.isMutable===!1?new Po(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new Po(!1,!0);return FG(fi(e,t))}),FG=eI(rI);function pN(e,t){let r=e.context?new Po(e.context.isOptional,e.context.isMutable,t,e.context.annotations):new Po(!1,!1,t);return fi(e,r)}function lu(e,t,r){return tI(e,r,t)}function RG(e){let t=[],r=[];function n(o){switch(o._tag){case"Literal":pd(o.literal)&&!t.includes(o.literal)&&t.push(o.literal);return;case"UniqueSymbol":t.includes(o.symbol)||t.push(o.symbol);return;case"Never":return;case"Union":for(let s=0;s<o.types.length;s++)n(o.types[s]);return;default:r.push(o)}}return n(e),{literals:t,parameters:r}}function dN(e,t){let{literals:r,parameters:n}=RG(e);return new Ql(r.map(o=>new Vb(o,t)),n.map(o=>new Gb(o,t)))}function Gt(e){return e.context?.isOptional??!1}function mN(e){return e.context?.isMutable??!1}function hN(e){return e.annotations?.[kr]===!0||e._tag==="FilterGroup"&&e.checks.every(hN)}function $G(e){function t(n){return hN(n)?[n]:n._tag==="FilterGroup"?n.checks.flatMap(t):[]}let r=e.flatMap(t);return Na(r)?r:void 0}function NG(e){let t=!0;function r(n){return t=t&&!n.encoding&&!D$(n),t&&"recur"in n&&n.recur(r),n}return"recur"in e&&e.recur(r),t}var It=Ca(e=>{let t=cu(e);if(t!==e){let n=It(t);return n===t&&e.encoding===void 0?e:fi(n,e.context)}let r="recur"in e?e.recur(It):e;if("encodingChecks"in r&&r.encodingChecks){let n=NG(e)?r.encodingChecks:Bb(r)||fG(r)||au(r)&&r.typeParameters.length>0?$G(r.encodingChecks):void 0;return tp(r,{encodingChecks:void 0,checks:Kb(r.checks,n)})}return r}),$n=Ca(e=>It(Xr(e)));function MG(e,t){let r=t,n=r.length,o=r[n-1],s=[new ft(Xr(Je(e,void 0)),r[0].transformation.flip())];for(let i=1;i<n;i++)s.unshift(new ft(Xr(r[i-1].to),r[i].transformation.flip()));let a=Xr(o.to);return a.encoding?Je(a,[...a.encoding,...s]):Je(a,s)}var Xr=Sn(e=>{if(e.encoding)return MG(e,e.encoding);let t=cu(e);if(t!==e){let r=Xr(t);return r===t?e:fi(r,e.context)}return"flip"in e?e.flip(Xr):"recur"in e?e.recur(Xr):e});function gN(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(gN);default:return!1}}function Bh(e,t){let r=t===0?je:Vt(t);return(n,o)=>n===me?Ar:n===t?r:C(new xt(e,n,o))}function Nn(e,t){return(r,n)=>r===me?Ar:t(r)?je:C(new xt(e,r,n))}function xN(e,t,r){let n=e.encodedParts,o=e.literals,s=t.length;for(let f=0;f<o.length;f++){let u=o[f];if(u&&!t.includes(u))return}if(e.suffixLengths[0]>s)return;let a=new Array(n.length),i;function c(f,u){if(f===n.length)return u===s;if(i?.has(f*(s+1)+u))return!1;let l=n[f];if(f===n.length-1){let p=t.slice(u);if(l.matchPart(p,r)!==void 0)return a[f]=p,!0}else if(l._tag==="Literal"){let p=o[f];if(t.startsWith(p,u)&&c(f+1,u+p.length))return a[f]=p,!0}else{let p=s-e.suffixLengths[f+1],h=o[f+1],g=h===void 0?p:t.lastIndexOf(h,p);for(;g>=u;){let x=t.slice(u,g);if(l.matchPart(x,r)!==void 0&&c(f+1,g))return a[f]=x,!0;if(g===0)break;g=h===void 0?g-1:t.lastIndexOf(h,g-1)}}return i??=new Set,i.add(f*(s+1)+u),!1}return c(0,0)?a:void 0}var nI=li(e=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(nI)}}),jh=li(e=>{switch(e._tag){default:return e;case"Symbol":case"UniqueSymbol":return e.toCodecStringTree();case"Union":return e.recur(jh)}}),oI=li(e=>{switch(e._tag){default:return e;case"Number":case"Literal":case"BigInt":return e.toCodecStringTree();case"Union":return e.recur(oI)}}),yN="[\\s\\S]*?",Ub=new globalThis.RegExp(`^${$h}$`),UG=new globalThis.RegExp(`^(?:${$h}|Infinity|-Infinity|NaN)$`);function sI(e){return ep(Ub,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:Ub.source}),...e})}var SN=Ro(Qr,[sI()]),DG=new ft(SN,tu),LG=new ft(new Or([SN,aN]),tu),BG="-?\\d+",Db=new globalThis.RegExp(`^${BG}$`);function aI(e){return ep(Db,{expected:"a string representing a bigint",representation:{id:"effect/schema/isStringBigInt",payload:null},toJsonSchema:()=>({pattern:Db.source}),...e})}var iI=Ro(Qr,[aI({expected:"a string representing a bigint"})]),jG=new ft(iI,Oh),zG="Symbol\\(([\\s\\S]*)\\)",Lb=new globalThis.RegExp(`^${zG}$`),qG=Ro(Qr,[cI()]),EN=new ft(qG,new Ne(le(e=>globalThis.Symbol.for(Lb.exec(e)[1])),ar((e,t)=>globalThis.Symbol.keyFor(e)!==void 0?y(globalThis.String(e)):C(new ql({message:"cannot serialize to string, Symbol is not registered"},e,t)))));function cI(e){return ep(Lb,{expected:"a string representing a symbol",representation:{id:"effect/schema/isStringSymbol",payload:null},toJsonSchema:()=>({pattern:Lb.source}),...e})}function Mn(e,t,r,n,o){for(let s=0;s<e.length;s++){let a=e[s];if(a._tag==="FilterGroup"){if(r=Mn(a.checks,t,r,n,o),r&&(o.errors!=="all"||r[r.length-1].filter.aborted))return r}else{let i=a.run(t,n,o);if(i){let c=new sR(a,i,t,o);if(r?r.push(c):r=[c],o.errors!=="all"||a.aborted)return r}}}return r}function bN(e,t){let r=Mn(e,t,void 0,ls,{errors:"all"});if(r){let n=new At(ls,r);return Z(n)}return H(t)}function IN(e){if(!au(e))return;let t=e.annotations?.[yh];return bn(t)?t(e.typeParameters):void 0}function HG(e){return e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"&&globalThis.Number.isFinite(e)}function WG(e){return e===void 0||typeof e=="string"}function CN(e,t){let r=new WeakMap,n=[];e:for(;;){if(typeof e!="object"||e===null){if(!t(e))return!1}else{let o=e,s=r.get(o);if(s===!1)return!1;if(s===void 0){let a=Array.isArray(o);if(!a){let i=Object.getPrototypeOf(o);if(i!==null&&i!==Object.prototype&&Object.getPrototypeOf(i)!==null)return!1}r.set(o,!1),n.push({value:o,keys:a?o.length:Object.keys(o),index:0})}}for(;n.length>0;){let o=n[n.length-1],s=o.keys;if(typeof s=="number"){if(o.index<s){e=o.value[o.index++];continue e}}else if(o.index<s.length){e=o.value[s[o.index++]];continue e}r.set(o.value,!0),n.pop()}return!0}}function pu(e){return CN(e,HG)}var su=new iu([],()=>(e,t,r)=>pu(e)?je:C(new xt(t,e,r)),{representation:{id:"effect/schema/Json",payload:null},expected:"JSON value",toCodecJson:()=>{},toCodecStringTree:()=>fI}),TN=Rn(su,{representation:{id:"effect/schema/MutableJson",payload:null}}),uI=new ft(su,eu()),wN=new ft(new Or([new dn(!1,[],[su]),new Ql([],[new Gb(Qr,su)])]),eu());function VG(e){return CN(e,WG)}var GG=new iu([],()=>(e,t,r)=>VG(e)?je:C(new xt(t,e,r)),{expected:"StringTree",toCodecStringTree:()=>{}}),fI=new ft(GG,eu());function lI(){return Object.assign(e=>e,{option:e=>R(e),result:e=>H(e),is:e=>!0})}var pI=lI(),dI=lI(),AN="~effect/process/ChildProcessSpawner/ChildProcessHandle",KG={[AN]:AN,...mt,toJSON(){return{_id:"ChildProcessHandle",pid:this.pid}}},zh=e=>Object.setPrototypeOf({...e},KG),mI=e=>{let t=(n,o)=>e(n).pipe(re(s=>ZF(o?.includeStderr===!0?s.all:s.stdout)),Qs),r=(n,o)=>QF(t(n,o));return na.of({spawn:e,exitCode:n=>Ks(L(e(n),o=>o.exitCode)),streamString:t,streamLines:r,lines:(n,o)=>YF(r(n,o)),string:(n,o)=>XF(t(n,o))})},na=class extends Ye()("effect/process/ChildProcessSpawner"){};var hI="~effect/process/ChildProcess",FN={...so({label:"Command",evaluate(e){return io(e.context,na).spawn(this)}}),[hI]:hI},Hh=e=>A(e,hI),JG=e=>e._tag==="StandardCommand",ZG=e=>e._tag==="PipedCommand",di=(e,t,r)=>Object.assign(Object.create(FN),{_tag:"StandardCommand",command:e,args:t,options:r}),Wh=(e,t,r={})=>Object.assign(Object.create(FN),{_tag:"PipedCommand",left:e,right:t,options:r}),np=function(...t){if(SI(t[0])){let[s,...a]=t,i=EI(s,a);return di(i[0]??"",i.slice(1),{})}if(typeof t[0]=="object"&&!Array.isArray(t[0])&&!SI(t[0])){let s=t[0];return function(a,...i){let c=EI(a,i);return di(c[0]??"",c.slice(1),s)}}if(typeof t[0]=="string"&&!Array.isArray(t[1])){let[s,a={}]=t;return di(s,[],a)}let[r,n=[],o={}]=t;return di(r,n,o)},QG=m(e=>Hh(e[0])&&Hh(e[1]),(e,t,r)=>Wh(e,t,r??{})),YG=function(...t){if(Hh(t[0])&&t.length>1){let[n,...o]=t,s=vN(o);return gI(n,s)}let r=vN(t);return n=>gI(n,r)},vN=e=>{if(SI(e[0])){let[n,...o]=e,s=EI(n,o);return{command:s[0]??"",args:s.slice(1)}}let[t,r=[]]=e;return{command:t,args:r}},gI=(e,t)=>{switch(e._tag){case"StandardCommand":return di(t.command,[...t.args,e.command,...e.args],e.options);case"PipedCommand":return Wh(gI(e.left,t),e.right,e.options)}},xI=m(2,(e,t)=>{switch(e._tag){case"StandardCommand":return di(e.command,e.args,{...e.options,cwd:t});case"PipedCommand":return Wh(xI(e.left,t),xI(e.right,t),e.options)}}),yI=m(2,(e,t)=>{switch(e._tag){case"StandardCommand":{let r=e.options.env===void 0?t:{...e.options.env,...t};return di(e.command,e.args,{...e.options,env:r})}case"PipedCommand":return Wh(yI(e.left,t),yI(e.right,t),e.options)}}),SI=e=>Array.isArray(e)&&"raw"in e&&Array.isArray(e.raw),op=e=>{let t=/^fd(\d+)$/.exec(e);if(t===null)return;let r=parseInt(t[1],10);return r>=3?r:void 0},bI=e=>`fd${e}`,EI=(e,t)=>{let r=[];for(let[n,o]of e.entries())r=XG(e,t,r,o,n);return r},XG=(e,t,r,n,o)=>{let s=e.raw[o];if(s===void 0)throw new Error(`Invalid backslash sequence: ${e.raw[o]}`);let{hasLeadingWhitespace:a,hasTrailingWhitespace:i,tokens:c}=t3(n,s),f=PN(r,c,a);if(o===t.length)return f;let u=t[o],l=Array.isArray(u)?u.map(p=>ON(p)):[ON(u)];return PN(f,l,i)},ON=e=>typeof e==="string"?e:String(e),_N=new Set([" "," ","\r",`
|
|
32
|
+
`]),e3={x:3,u:5},t3=(e,t)=>{if(t.length===0)return{tokens:[],hasLeadingWhitespace:!1,hasTrailingWhitespace:!1};let r=_N.has(t[0]),n=[],o=0;for(let a=0,i=0;a<e.length;a+=1,i+=1){let c=t[i];if(_N.has(c))o!==a&&n.push(e.slice(o,a)),o=a+1;else if(c==="\\"){let f=t[i+1];if(f===`
|
|
33
|
+
`)a-=1,i+=1;else if(f==="u"&&t[i+2]==="{"){let u=t.indexOf("}",i+3);parseInt(t.slice(i+3,u),16)>65535&&(a+=1),i=u}else i+=e3[f]??1}}let s=o===e.length;return s||n.push(e.slice(o)),{tokens:n,hasLeadingWhitespace:r,hasTrailingWhitespace:s}},PN=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t.at(0)}`,...t.slice(1)];import*as Vh from"node:child_process";import{PassThrough as II}from"node:stream";var RN=(e,t,r)=>{let n=e.detached??r!=="win32";return{...t,detached:n,shell:e.shell,windowsHide:e.windowsHide??!n}};var Be=(e,t)=>(r,[n])=>{let o="Unknown";switch(r.code){case"ENOENT":o="NotFound";break;case"EACCES":o="PermissionDenied";break;case"EEXIST":o="AlreadyExists";break;case"EISDIR":o="BadResource";break;case"ENOTDIR":o="BadResource";break;case"EBUSY":o="Busy";break;case"ELOOP":o="BadResource";break}return Kr({_tag:o,module:e,method:t,pathOrDescriptor:n,syscall:r.syscall,cause:r})};var du=e=>KE(WE(r3(e),t=>[t])),r3=e=>lr(t=>{let r=e.evaluate();return y(n3({...e,writable:r,pull:t}))}),n3=e=>e.pull.pipe(L(t=>{let r=0;return or(n=>{let o=!1,s=()=>{for(;r<t.length;){if(o)return;if(!e.writable.write(t[r++],e.encoding)){o||e.writable.once("drain",s);return}}o||n(xe)};return s(),fe(()=>{o=!0,e.writable.off("drain",s)})})}),Co({disableYield:!0}),e.endOnDone!==!1?Er(t=>"closed"in e.writable&&e.writable.closed?Ft(t):or(r=>{let n=()=>r(Ft(t));return e.writable.once("finish",n),e.writable.end(),fe(()=>{e.writable.off("finish",n)})})):F,Ya(or(t=>{let r=n=>t(C(e.onError(n)));return e.writable.once("error",r),fe(()=>{e.writable.off("error",r)})})));var mu=e=>pn(s3(e)),s3=e=>lr((t,r)=>a3({scope:r,readable:e.evaluate(),onError:e.onError??i3,chunkSize:e.chunkSize,closeOnDone:e.closeOnDone}));var a3=e=>{let t=e.readable,r=e.closeOnDone??!0,n=e.exit??rF(void 0),o=e.latch??XP(!1);function s(){o.openUnsafe()}function a(f){n.current=wn(e.onError(f)),o.openUnsafe()}function i(){n.current=wn(Pm()),o.openUnsafe()}t.on("readable",s),t.once("error",a),t.once("end",i);let c=Ie(function f(){let u=e.readable.read(e.chunkSize);if(u===null)return n.current?n.current:t.readableEnded?C(Pm()):(o.closeUnsafe(),L(o.await,f));let l=Ua(u);for(;u=e.readable.read(e.chunkSize),u!==null;)l.push(u);return y(l)});return wr(nl(e.scope,fe(()=>{t.off("readable",s),t.off("error",a),t.off("end",i),r&&"closed"in e.readable&&!e.readable.closed&&e.readable.destroy()})),c)};var i3=e=>new KO(e);var mi=e=>e instanceof globalThis.Error?e:new globalThis.Error(String(e)),$o=(e,t,r)=>{let{commands:n}=LN(r),o=n.reduce((s,a)=>{let i=`${a.command} ${a.args.join(" ")}`;return s.length===0?i:`${s} | ${i}`},"");return Be("ChildProcess",e)(t,[o])},$N=1e3,u3=10,NN=e=>{let t=()=>{};e.on("error",t),e.once("close",()=>e.off("error",t))},MN=(e,t)=>{if(!LS(t))return!0;if(globalThis.process.platform==="win32")return!1;try{return globalThis.process.kill(-e.pid,0),!0}catch{return!1}},UN=(e,t=()=>{})=>{if(e.exitCode!==null||e.signalCode!==null){t(null);return}Vh.execFile("taskkill",["/pid",String(e.pid),"/T","/F"],{windowsHide:!0},t)},f3=Ut(function*(){let e=yield*_n,t=yield*vo,r=B(function*(d){if(!Os(d.cwd))return yield*e.access(d.cwd),t.resolve(d.cwd)}),n=d=>d.extendEnv?{...globalThis.process.env,...d.env}:d.env,o=d=>oi(d)?"pipe":d,s=d=>Rl(d)?"pipe":d,a=d=>{let S={stream:"pipe",encoding:"utf-8",endOnDone:!0};return Os(d.stdin)?S:typeof d.stdin=="string"?{...S,stream:d.stdin}:oi(d.stdin)?{...S,stream:d.stdin}:{stream:d.stdin.stream,encoding:d.stdin.encoding??S.encoding,endOnDone:d.stdin.endOnDone??S.endOnDone}},i=(d,S)=>{let E=d[S];return Os(E)?{stream:"pipe"}:typeof E=="string"?{stream:E}:Rl(E)?{stream:E}:{stream:E.stream}},c=d=>{if(Os(d.additionalFds))return[];let S=[];for(let[E,I]of Object.entries(d.additionalFds)){let k=op(E);pt(k)&&S.push({fd:k,config:I})}return S.sort((E,I)=>E.fd-I.fd)},f=(d,S,E,I)=>{let k=[o(d.stream),s(S.stream),s(E.stream)];if(I.length===0)return k;let _=I.reduce((M,{fd:z})=>Math.max(M,z),2);for(let M=3;M<=_;M++)k[M]="ignore";for(let{fd:M}of I)k[M]="pipe";return k},u=B(function*(d,S,E){if(E.length===0)return{getInputFd:()=>$l,getOutputFd:()=>Vc};let I=new Map,k=new Map;for(let{config:_,fd:M}of E){let z=S.stdio[M];switch(_.type){case"input":{let de=$l;z&&"write"in z&&(NN(z),de=du({evaluate:()=>z,onError:ne=>$o(`fromWritable(fd${M})`,mi(ne),d)})),_.stream&&(yield*Dc(XE(_.stream,de))),I.set(M,de);break}case"output":{let de=Vc;if(z&&"read"in z){let ne=new II;z.on("error",Ee=>ne.destroy(Ee)),z.pipe(ne),de=mu({evaluate:()=>ne,onError:Ee=>$o(`fromReadable(fd${M})`,mi(Ee),d)})}_.sink&&(de=hh(de,_.sink)),k.set(M,de);break}}}return{getInputFd:_=>I.get(_)??$l,getOutputFd:_=>k.get(_)??Vc}}),l=(d,S,E)=>Ie(()=>{let I=$l;return cf(S.stdin)&&(NN(S.stdin),I=du({evaluate:()=>S.stdin,onError:k=>$o("fromWritable(stdin)",mi(k),d),endOnDone:E.endOnDone,encoding:E.encoding})),oi(E.stream)?wr(Dc(XE(E.stream,I)),I):y(I)}),p=(d,S,E,I)=>{let k=S.stdout?(()=>{let z=new II;return S.stdout.on("error",de=>z.destroy(de)),S.stdout.pipe(z),mu({evaluate:()=>z,onError:de=>$o("fromReadable(stdout)",mi(de),d)})})():Vc,_=S.stderr?(()=>{let z=new II;return S.stderr.on("error",de=>z.destroy(de)),S.stderr.pipe(z),mu({evaluate:()=>z,onError:de=>$o("fromReadable(stderr)",mi(de),d)})})():Vc;Rl(E.stream)&&(k=hh(k,E.stream)),Rl(I.stream)&&(_=hh(_,I.stream));let M=JF(k,_);return{stdout:k,stderr:_,all:M}},h=(d,S)=>or(E=>{let I=Rm(),k=Vh.spawn(d.command,d.args,S);return k.on("error",_=>{E(C($o("spawn",_,d)))}),k.on("exit",(..._)=>{$m(I,Xo(_))}),k.on("spawn",()=>{E(y([k,I]))}),fe(()=>{k.kill("SIGTERM")})}),g=(d,S,E)=>globalThis.process.platform==="win32"?or(I=>{UN(S,k=>{I(k?C($o("kill",mi(k),d)):xe)})}):ht({try:()=>{globalThis.process.kill(-S.pid,E)},catch:I=>$o("kill",mi(I),d)}),x=(d,S)=>{if(globalThis.process.platform==="win32"){UN(d);return}try{globalThis.process.kill(-d.pid,S)}catch{}},b=(d,S,E)=>Ie(()=>{if(!S.kill(E)){let k=new globalThis.Error("Failed to kill child process");return C($o("kill",k,d))}return xe}),T=(d,S,E)=>or(I=>{let k=Date.now()+E,_,M=()=>{clearTimeout(_),d.removeListener("exit",z)},z=()=>{if(clearTimeout(_),Date.now()>=k||!MN(d,S)){M(),I(xe);return}_=setTimeout(z,u3)};return d.on("exit",z),z(),fe(M)}),w=B(function*(d,S,E,I){let k=_=>g(d,S,_).pipe(vn(()=>b(d,S,_)));yield*k(I?.killSignal??"SIGTERM"),Os(I?.forceKillAfter)?yield*T(S,E,$N):(yield*T(S,E,Vo(I.forceKillAfter)),MN(S,E)&&(yield*k("SIGKILL"),yield*T(S,E,$N))),yield*Ic(E)}),P=(d,S)=>{let E=S??"stdout";switch(E){case"stdout":return d.stdout;case"stderr":return d.stderr;case"all":return d.all;default:{let I=op(E);return pt(I)?d.getOutputFd(I):d.stdout}}},O=B(function*(d){switch(d._tag){case"StandardCommand":{let S=a(d.options),E=i(d.options,"stdout"),I=i(d.options,"stderr"),k=c(d.options),_=!0,M=yield*r(d.options),z=n(d.options),de=f(S,E,I,k),[ne,Ee]=yield*fn(h(d,RN(d.options,{cwd:M,env:z,stdio:de},process.platform)),B(function*([Mr,ba]){if(yield*DS(ba)){let[Sw]=yield*Ic(ba);Sw!==0&&cf(Sw)?yield*Rc(w(d,Mr,ba,d.options)):_&&process.platform!=="win32"&&d.options.detached!==!1&&(yield*Rc(w(d,Mr,ba,d.options)));return}_&&(yield*Rc(w(d,Mr,ba,d.options)))})),Le=dI(ne.pid);ne.on("exit",Mr=>{Mr!==0&&cf(Mr)&&x(ne,d.options.killSignal??"SIGTERM")});let lt=fe(()=>{_||(ne.ref(),_=!0)}),Et=fe(()=>(_&&(ne.unref(),_=!1),lt)),Cr=yield*l(d,ne,S),{all:rn,stderr:Do,stdout:rf}=p(d,ne,E,I),{getInputFd:JB,getOutputFd:ZB}=yield*u(d,ne,k),QB=re(DS(Ee),Mr=>!Mr),YB=L(Ic(Ee),([Mr,ba])=>{if(cf(Mr))return y(pI(Mr));let yw=new globalThis.Error(`Process interrupted due to receipt of signal: '${ba}'`);return C($o("exitCode",yw,d))});return zh({pid:Le,exitCode:YB,isRunning:QB,kill:Mr=>w(d,ne,Ee,Mr),stdin:Cr,stdout:rf,stderr:Do,all:rn,getInputFd:JB,getOutputFd:ZB,unref:Et})}case"PipedCommand":{let{commands:S,pipeOptions:E}=LN(d),[I,...k]=S,_=[yield*O(I)];for(let ne=0;ne<k.length;ne++){let Ee=k[ne],Le=E[ne]??{},lt=a(Ee.options),Et=Qs(y(P(_[_.length-1],Le.from))),Cr=Le.to??"stdin";if(Cr==="stdin")_.push(yield*O(np(Ee.command,Ee.args,{...Ee.options,stdin:{...lt,stream:Et}})));else{let rn=op(Cr);if(pt(rn)){let Do=bI(rn),rf=Ee.options.additionalFds??{};_.push(yield*O(np(Ee.command,Ee.args,{...Ee.options,additionalFds:{...rf,[Do]:{type:"input",stream:Et}}})))}else _.push(yield*O(np(Ee.command,Ee.args,{...Ee.options,stdin:{...lt,stream:Et}})))}}let M=_[_.length-1],z=ne=>Za([..._].reverse(),Ee=>Rc(Ee.kill(ne)),{discard:!0}),de=Ut(function*(){let ne=[];for(let Ee of _)ne.push(yield*Ee.unref);return Za([...ne].reverse(),Ee=>Ee,{discard:!0})});return zh({pid:M.pid,exitCode:M.exitCode,isRunning:M.isRunning,kill:z,stdin:_[0].stdin,stdout:M.stdout,stderr:M.stderr,all:M.all,getInputFd:M.getInputFd,getOutputFd:M.getOutputFd,unref:de})}}});return mI(O)}),DN=Tc(na,f3),LN=e=>{let t=[],r=[],n=i=>{switch(i._tag){case"StandardCommand":{t.push(i);break}case"PipedCommand":{n(i.left),r.push(i.options),n(i.right);break}}};if(n(e),t.length===0)throw new Error("flattenCommand produced empty commands array");let[o,...s]=t;return{commands:[o,...s],pipeOptions:r}};var BN="0123456789ABCDEFGHJKMNPQRSTVWXYZ",jN=(e,t)=>{if(t.length!==10)throw new Error(`ULID randomness must be exactly 10 bytes, received ${t.length}`);let r=Math.min(Math.max(0,Math.trunc(e)),0xffffffffffff),n="";for(let a=45;a>=0;a-=5)n+=BN[Math.floor(r/2**a)&31];let o=0,s=0;for(let a of t){for(o=o<<8|a,s+=8;s>=5;)s-=5,n+=BN[o>>>s&31];o&=(1<<s)-1}return n};var p3=e=>e.toString(16).padStart(2,"0"),CI=e=>[e.subarray(0,4),e.subarray(4,6),e.subarray(6,8),e.subarray(8,10),e.subarray(10,16)].map(r=>Array.from(r,p3).join("")).join("-"),zN=()=>globalThis.crypto.getRandomValues(new Uint8Array(16));function qN(e=zN()){return e[6]=e[6]&15|64,e[8]=e[8]&63|128,e}var d3=2**48-1;function HN(e,t=zN()){let r=Math.min(Math.max(0,Math.trunc(e)),d3);return t[0]=Math.floor(r/2**40),t[1]=Math.floor(r/2**32)&255,t[2]=Math.floor(r/2**24)&255,t[3]=Math.floor(r/2**16)&255,t[4]=Math.floor(r/2**8)&255,t[5]=r&255,t[6]=t[6]&15|112,t[8]=t[8]&63|128,t}var WN="~effect/Crypto",TI=Ye("effect/Crypto"),VN=e=>{let t=e.randomBytes,r=a=>re(h3("randomBytes",a),t),n=a=>(a[0]&31)*2**48+a[1]*2**40+a[2]*2**32+a[3]*2**24+a[4]*2**16+a[5]*2**8+a[6],o=()=>n(t(7))/2**53,s=()=>{for(;;){let a=t(7),i=n(a);if((a[0]&32)===0)return i+Number.MIN_SAFE_INTEGER;if(i<Number.MAX_SAFE_INTEGER)return i+1}};return TI.of({[WN]:WN,randomBytes:r,nextDoubleUnsafe:o,nextIntUnsafe:s,digest:e.digest,random:fe(()=>o()),randomBoolean:fe(()=>o()>.5),randomInt:fe(()=>s()),randomBetween:(a,i)=>fe(()=>F_(a,i,o())),randomIntBetween(a,i,c){let f=c?.halfOpen===!0?0:1;return fe(()=>{let u=Math.ceil(a),l=Math.floor(i);return Math.floor(o()*(l-u+f))+u})},randomShuffle:a=>fe(()=>{let i=Array.from(a);for(let c=i.length-1;c>=1;c=c-1){let f=Math.min(c,Math.floor(o()*(c+1))),u=i[c];i[c]=i[f],i[f]=u}return i}),randomUUIDv4:a=>fe(()=>{let i=qN(t(16));return a?.format==="bytes"?i:CI(i)}),randomUUIDv7:a=>Bc(i=>{let c=HN(i.currentTimeMillisUnsafe(),t(16));return y(a?.format==="bytes"?c:CI(c))}),randomULID:Bc(a=>y(jN(a.currentTimeMillisUnsafe(),t(10))))})},h3=(e,t)=>Number.isSafeInteger(t)&&t>=0?y(t):C(ln({module:"Crypto",method:e,description:"size must be a non-negative safe integer"}));import*as Gh from"node:crypto";var g3=e=>{switch(e){case"SHA-1":return"sha1";case"SHA-256":return"sha256";case"SHA-384":return"sha384";case"SHA-512":return"sha512"}},x3=(e,t)=>ht({try:()=>Uint8Array.from(Gh.createHash(g3(e)).update(t).digest()),catch:r=>Kr({module:"Crypto",method:"digest",_tag:"Unknown",description:"Could not compute digest",cause:r})}),y3=VN({randomBytes:Gh.randomBytes,digest:x3}),KN=So(TI,y3);var JN=KN;import*as YN from"node:crypto";import*as K from"node:fs";import*as XN from"node:os";import*as ps from"node:path";var ze=e=>t=>ln({module:"FileSystem",method:e,description:t.message??String(t)}),wI=(e,t)=>{let r=Number(e);if(!Number.isSafeInteger(r))throw new RangeError(`${t} exceeds the safe integer range: ${e}`);return r},hu=e=>_d(Ra(e),sh),ZN=(e,t)=>ht({try:()=>wI(e,"position"),catch:ze(t)}),b3=(()=>{let e=et(K.access,Be("FileSystem","access"),ze("access"));return(t,r)=>{let n=K.constants.F_OK;return r?.readable&&(n|=K.constants.R_OK),r?.writable&&(n|=K.constants.W_OK),e(t,n)}})(),I3=(()=>{let e=et(K.cp,Be("FileSystem","copy"),ze("copy"));return(t,r,n)=>e(t,r,{force:n?.overwrite??!1,preserveTimestamps:n?.preserveTimestamps??!1,recursive:!0})})(),C3=(()=>{let e=et(K.copyFile,Be("FileSystem","copyFile"),ze("copyFile"));return(t,r)=>e(t,r)})(),T3=(()=>{let e=et(K.chmod,Be("FileSystem","chmod"),ze("chmod"));return(t,r)=>e(t,r)})(),w3=(()=>{let e=et(K.chown,Be("FileSystem","chown"),ze("chown"));return(t,r,n)=>e(t,r,n)})(),k3=(()=>{let e=et(K.glob,Be("FileSystem","glob"),ze("glob"));return(t,r)=>e(t,{cwd:r?.root,exclude:r?.exclude})})(),A3=(()=>{let e=et(K.link,Be("FileSystem","link"),ze("link"));return(t,r)=>e(t,r)})(),v3=(()=>{let e=et(K.mkdir,Be("FileSystem","makeDirectory"),ze("makeDirectory"));return(t,r)=>e(t,{recursive:r?.recursive??!1,mode:r?.mode})})(),kI=e=>{let t=et(K.mkdtemp,Be("FileSystem",e),ze(e));return r=>Ie(()=>{let n=r?.prefix??"",o=typeof r?.directory=="string"?ps.join(r.directory,"."):XN.tmpdir();return t(n?ps.join(o,n):o+"/")})},O3=kI("makeTempDirectory"),AI=e=>{let t=et(K.rm,Be("FileSystem",e),ze(e));return(r,n)=>t(r,{recursive:n?.recursive??!1,force:n?.force??!1})},_3=AI("remove"),P3=(()=>{let e=kI("makeTempDirectoryScoped"),t=AI("makeTempDirectoryScoped");return r=>fn(e(r),n=>rs(t(n,{recursive:!0})))})(),F3=e=>{let{O_APPEND:t,O_CREAT:r,O_EXCL:n,O_RDONLY:o,O_RDWR:s,O_TRUNC:a,O_WRONLY:i}=K.constants;switch(e){case"r":return o;case"r+":return s;case"w":return a|r|i;case"wx":return a|r|i|n;case"w+":return a|r|s;case"wx+":return a|r|s|n;case"a":return t|r|i;case"ax":return t|r|i|n;case"a+":return t|r|s;case"ax+":return t|r|s|n}},R3=(e,t)=>Ie(()=>{let{O_NOFOLLOW:r}=K.constants;return process.platform==="win32"||typeof r!="number"||r===0?C(ln({module:"FileSystem",method:e,description:"noFollow is not supported on this platform"})):y(F3(t)|r)}),$3=e=>{let t=et(K.open,Be("FileSystem",e),ze(e)),r=et(K.close,Be("FileSystem",e),ze(e));return(n,o)=>Jn(fn(o?.noFollow===!0?L(R3(e,o.flag??"r"),s=>t(n,s,o.mode)):t(n,o?.flag??"r",o?.mode),s=>rs(r(s))),re(s=>M3(s,o?.flag?.startsWith("a")??!1)))},N3=$3("open"),QN=e=>ln({module:"FileSystem",method:e,description:"Cannot read before the start of the file"}),M3=(()=>{let e=u=>et(K.read,Be("FileSystem",u),ze(u)),t=e("read"),r=e("readAlloc"),n=et(K.fstat,Be("FileSystem","stat"),ze("stat")),o=et(K.ftruncate,Be("FileSystem","truncate"),ze("truncate")),s=et(K.fsync,Be("FileSystem","sync"),ze("sync")),a=u=>et(K.write,Be("FileSystem",u),ze(u)),i=a("write"),c=a("writeAll");class f{[Kc];fd;append;position=BigInt(0);constructor(l,p){this[Kc]=Kc,this.fd=l,this.append=p}get stat(){return L(n(this.fd,{bigint:!0}),tM)}get sync(){return s(this.fd)}seek(l,p){return Ie(()=>{let h=p==="start"?l:this.position+l;return h<BigInt(0)?C(ln({module:"FileSystem",method:"seek",description:"Cannot seek before the start of the file"})):(this.position=h,y(h))})}read(l,p){return Ie(()=>{let h=p?.position;if(h!==void 0)return h<BigInt(0)?C(QN("read")):t(this.fd,{buffer:l,position:h});let g=this.position;return re(t(this.fd,{buffer:l,position:g}),x=>(this.position=g+BigInt(x),x))})}readAlloc(l,p){return Ie(()=>{try{if(!Number.isInteger(l)||l<0)throw new RangeError("size must be a non-negative integer");let h=p?.position;if(h!==void 0&&h<BigInt(0))return C(QN("readAlloc"));let g=Buffer.allocUnsafeSlow(l),x=h??this.position;return re(r(this.fd,{buffer:g,position:x}),b=>{if(b===0)return v();if(h===void 0&&(this.position=x+BigInt(b)),b===l)return R(g);let T=Buffer.allocUnsafeSlow(b);return g.copy(T,0,0,b),R(T)})}catch(h){return C(ze("readAlloc")(h))}})}truncate(l){return re(o(this.fd,l||void 0),()=>{if(!this.append){let p=BigInt(l??0);this.position>p&&(this.position=p)}})}write(l){return Ie(()=>{let p=this.position;return L(this.append?y(void 0):ZN(p,"write"),h=>re(i(this.fd,l,void 0,void 0,h),g=>(this.append||(this.position=p+BigInt(g)),g)))})}writeAllChunk(l){return Ie(()=>{let p=this.position;return L(this.append?y(void 0):ZN(p,"writeAll"),h=>L(c(this.fd,l,void 0,void 0,h),g=>g===0?C(Kr({module:"FileSystem",method:"writeAll",_tag:"WriteZero",pathOrDescriptor:this.fd,description:"write returned 0 bytes written"})):(this.append||(this.position=p+BigInt(g)),g<l.length?this.writeAllChunk(l.subarray(g)):xe)))})}writeAll(l){return l.length===0?xe:this.writeAllChunk(l)}}return(u,l)=>new f(u,l)})(),eM=e=>{let t=kI(e);return B(function*(r){let n=yield*t(r),o=YN.randomBytes(6).toString("hex"),s=ps.join(n,r?.suffix?`${o}${r.suffix}`:o);return yield*rM(s,new Uint8Array(0)),s})},U3=eM("makeTempFile"),D3=(()=>{let e=eM("makeTempFileScoped"),t=AI("makeTempFileScoped");return r=>fn(e(r),n=>rs(t(ps.dirname(n),{recursive:!0})))})(),L3=(e,t)=>Pc({try:()=>K.promises.readdir(e,t),catch:r=>Be("FileSystem","readDirectory")(r,[e])}),B3=e=>or((t,r)=>{try{K.readFile(e,{signal:r},(n,o)=>{t(n?C(Be("FileSystem","readFile")(n,[e])):y(o))})}catch(n){t(C(ze("readFile")(n)))}}),j3=(()=>{let e=et(K.readlink,Be("FileSystem","readLink"),ze("readLink"));return t=>e(t)})(),z3=(()=>{let e=et(K.realpath,Be("FileSystem","realPath"),ze("realPath"));return t=>e(t)})(),q3=(()=>{let e=et(K.rename,Be("FileSystem","rename"),ze("rename"));return(t,r)=>e(t,r)})(),tM=e=>ht({try:()=>({type:e.isFile()?"File":e.isDirectory()?"Directory":e.isSymbolicLink()?"SymbolicLink":e.isBlockDevice()?"BlockDevice":e.isCharacterDevice()?"CharacterDevice":e.isFIFO()?"FIFO":e.isSocket()?"Socket":"Unknown",mtime:Ra(e.mtime),atime:Ra(e.atime),birthtime:Ra(e.birthtime),dev:wI(e.dev,"dev"),rdev:hu(e.rdev),ino:hu(e.ino),mode:wI(e.mode,"mode"),nlink:hu(e.nlink),uid:hu(e.uid),gid:hu(e.gid),size:wl(e.size),blksize:e.blksize!==void 0?R(wl(e.blksize)):v(),blocks:hu(e.blocks)}),catch:ze("stat")}),vI=(()=>{let e=et(K.stat,Be("FileSystem","stat"),ze("stat"));return t=>L(e(t,{bigint:!0}),tM)})(),H3=(()=>{let e=et(K.symlink,Be("FileSystem","symlink"),ze("symlink"));return(t,r)=>e(t,r)})(),W3=(()=>{let e=et(K.truncate,Be("FileSystem","truncate"),ze("truncate"));return(t,r)=>e(t,r)})(),V3=(()=>{let e=et(K.utimes,Be("FileSystem","utime"),ze("utime"));return(t,r,n)=>e(t,r,n)})(),G3=(e,t,r)=>GF(n=>fn(fe(()=>{let o=t.type==="Directory"?e:ps.dirname(e),s=K.watch(e,{recursive:r?.recursive??!1},(a,i)=>{if(i)switch(a){case"rename":{To(bE(vI(ps.resolve(o,i)),{onSuccess:c=>vl(n,{_tag:"Create",path:i}),onFailure:c=>vl(n,{_tag:"Remove",path:i})}));return}case"change":{ni(n,{_tag:"Update",path:i});return}}});return s.on("error",a=>{Ol(n,WO(Kr({module:"FileSystem",_tag:"Unknown",method:"watch",pathOrDescriptor:e,cause:a})))}),s.on("close",()=>{ss(n)}),s}),o=>fe(()=>o.close()))),K3=(e,t,r)=>vI(t).pipe(re(n=>e.pipe(_d(o=>o.register(t,n,r)),bt(()=>G3(t,n,r)))),Qs),rM=(e,t,r)=>or((n,o)=>{try{K.writeFile(e,t,{signal:o,flag:r?.flag,mode:r?.mode},s=>{n(s?C(Be("FileSystem","writeFile")(s,[e])):xe)})}catch(s){n(C(ze("writeFile")(s)))}}),J3=re(eh(Ml),e=>eb({access:b3,chmod:T3,chown:w3,copy:I3,copyFile:C3,glob:k3,link:A3,makeDirectory:v3,makeTempDirectory:O3,makeTempDirectoryScoped:P3,makeTempFile:U3,makeTempFileScoped:D3,open:N3,readDirectory:L3,readFile:B3,readLink:j3,realPath:z3,remove:_3,rename:q3,stat:vI,symlink:H3,truncate:W3,utimes:V3,watch(t,r){return K3(e,t,r)},writeFile:rM})),nM=Tc(_n)(J3);var oM=nM;import*as ap from"node:path";import*as Kh from"node:url";var OI=e=>({fromFileUrl:t=>ht({try:()=>Kh.fileURLToPath(t,{windows:e}),catch:r=>new Ao({module:"Path",method:"fromFileUrl",cause:r})}),toFileUrl:t=>ht({try:()=>Kh.pathToFileURL(t,{windows:e}),catch:r=>new Ao({module:"Path",method:"toFileUrl",cause:r})})}),Y3=So(vo)({[cs]:cs,...ap.posix,...OI(!1)}),X3=So(vo)({[cs]:cs,...ap.win32,...OI(!0)}),sM=So(vo)({[cs]:cs,...ap,...OI(void 0)});var aM=sM;var _I="~effect/Stdio",Jh=Ye(_I),iM=e=>({[_I]:_I,stdinIsTerminal:y(!1),stdoutIsTerminal:y(!1),stderrIsTerminal:y(!1),...e});var cM=So(Jh,iM({args:fe(()=>process.argv.slice(2)),stdinIsTerminal:fe(()=>process.stdin.isTTY===!0),stdoutIsTerminal:fe(()=>process.stdout.isTTY===!0),stderrIsTerminal:fe(()=>process.stderr.isTTY===!0),stdout:e=>du({evaluate:()=>process.stdout,onError:t=>Kr({module:"Stdio",method:"stdout",_tag:"Unknown",cause:t}),endOnDone:e?.endOnDone??!1}),stderr:e=>du({evaluate:()=>process.stderr,onError:t=>Kr({module:"Stdio",method:"stderr",_tag:"Unknown",cause:t}),endOnDone:e?.endOnDone??!1}),stdin:mu({evaluate:()=>process.stdin,onError:e=>Kr({module:"Stdio",method:"stdin",_tag:"Unknown",cause:e}),closeOnDone:!1})}));var uM=cM;var be={};Kn(be,{Any:()=>$Z,Array:()=>Ce,ArrayEnsure:()=>WZ,BigDecimal:()=>BD,BigDecimalFromString:()=>C8,BigInt:()=>$u,BigIntFromString:()=>c8,Boolean:()=>zg,BooleanFromBit:()=>h8,BooleanLiterals:()=>EC,ByteSize:()=>Qg,ByteSizeFromBigInt:()=>w8,ByteSizeFromNumber:()=>k8,ByteSizeFromString:()=>T8,Cause:()=>mC,CauseReason:()=>dC,Char:()=>K5,Chunk:()=>A8,Class:()=>$2,Cookie:()=>_2,Cookies:()=>P2,Date:()=>Uu,DateFromMillis:()=>t8,DateFromString:()=>e8,DateTimeUtc:()=>Yg,DateTimeUtcFromDate:()=>R8,DateTimeUtcFromMillis:()=>N8,DateTimeUtcFromString:()=>$8,DateTimeZoned:()=>n2,DateTimeZonedFromString:()=>L8,Defect:()=>vC,DnsARecord:()=>y2,DnsAaaaRecord:()=>S2,DnsCaaRecord:()=>E2,DnsCnameRecord:()=>b2,DnsMxRecord:()=>I2,DnsNaptrRecord:()=>C2,DnsNsRecord:()=>T2,DnsPtrRecord:()=>w2,DnsRecord:()=>NQ,DnsRecordType:()=>$Q,DnsSoaRecord:()=>k2,DnsSrvRecord:()=>A2,DnsTlsaRecord:()=>v2,DnsTxtRecord:()=>O2,DomainName:()=>Is,DomainNameFromString:()=>d2,Duration:()=>qp,DurationFromMillis:()=>RQ,DurationFromNanos:()=>FQ,DurationFromString:()=>PQ,Enum:()=>FZ,Error:()=>ex,ErrorInstance:()=>J5,Exit:()=>MQ,FalseLiterals:()=>Kg,File:()=>FD,Finite:()=>Mu,FiniteFromString:()=>i8,FormData:()=>RD,Graph:()=>BQ,HashMap:()=>jQ,HashSet:()=>zQ,Headers:()=>GQ,Host:()=>CQ,HostFromString:()=>TQ,HostPort:()=>h2,HostPortFromString:()=>wQ,InetAddress:()=>l2,InetAddressFromString:()=>EQ,InetAddressV4:()=>yQ,InetAddressV6:()=>SQ,Int:()=>Fr,IpAddress:()=>da,IpAddressFromString:()=>Pi,IpInterface:()=>i2,IpInterfaceFromString:()=>mQ,IpLinkLocalAddress:()=>eQ,IpLinkLocalAddressFromString:()=>tQ,IpLoopbackAddress:()=>Y8,IpLoopbackAddressFromString:()=>X8,IpMulticastAddress:()=>B8,IpMulticastAddressFromString:()=>j8,IpNetwork:()=>f2,IpNetworkFromString:()=>xQ,IpUnicastAddress:()=>H8,IpUnicastAddressFromString:()=>W8,IpUnspecifiedAddress:()=>rQ,IpUnspecifiedAddressFromString:()=>nQ,Ipv4Address:()=>zp,Ipv4AddressFromString:()=>PC,Ipv4BroadcastAddress:()=>K8,Ipv4BroadcastAddressFromString:()=>J8,Ipv4Interface:()=>s2,Ipv4InterfaceFromString:()=>pQ,Ipv4Network:()=>c2,Ipv4NetworkFromString:()=>hQ,Ipv4PrivateAddress:()=>oQ,Ipv4PrivateAddressFromString:()=>sQ,Ipv6Address:()=>Xg,Ipv6AddressFromString:()=>o2,Ipv6Interface:()=>a2,Ipv6InterfaceFromString:()=>dQ,Ipv6Network:()=>u2,Ipv6NetworkFromString:()=>gQ,Ipv6UniqueLocalAddress:()=>aQ,Ipv6UniqueLocalAddressFromString:()=>iQ,Json:()=>tx,JsonFromUrlParamsField:()=>KQ,JsonObject:()=>bY,Literal:()=>Ct,Literals:()=>bs,MacAddress:()=>_i,MacAddressFromString:()=>Du,MacBroadcastAddress:()=>Z8,MacBroadcastAddressFromString:()=>Q8,MacLocallyAdministeredAddress:()=>cQ,MacLocallyAdministeredAddressFromString:()=>uQ,MacMulticastAddress:()=>z8,MacMulticastAddressFromString:()=>q8,MacUnicastAddress:()=>V8,MacUnicastAddressFromString:()=>G8,MacUniversallyAdministeredAddress:()=>fQ,MacUniversallyAdministeredAddressFromString:()=>lQ,MutableJson:()=>CY,Natural:()=>ki,Never:()=>RZ,NonEmptyArray:()=>Hg,NonEmptyString:()=>AC,Null:()=>jg,NullOr:()=>SC,NullishOr:()=>iD,Number:()=>Np,NumberFromString:()=>a8,ObjectKeyword:()=>UZ,Opaque:()=>o5,Option:()=>Fi,OptionFromNullOr:()=>qQ,OptionFromNullishOr:()=>WQ,OptionFromOptional:()=>QQ,OptionFromOptionalKey:()=>ZQ,OptionFromOptionalNullOr:()=>YQ,OptionFromUndefinedOr:()=>HQ,Port:()=>kQ,PropertyKey:()=>pC,ReadonlyMap:()=>Z5,ReadonlySet:()=>Q5,Record:()=>vi,RecordFromCookies:()=>VQ,RecordFromUrlParams:()=>JQ,Redacted:()=>F2,RedactedFromValue:()=>XQ,RegExp:()=>Y5,Result:()=>eY,SchemaError:()=>Ai,ScopedIpv6Literal:()=>FC,ScopedIpv6LiteralFromString:()=>m2,SocketAddress:()=>IQ,StandardSchemaV1FailureResult:()=>m8,String:()=>$,StringForLiteralAutocomplete:()=>NZ,StringFromBase64:()=>f8,StringFromBase64Url:()=>l8,StringFromHex:()=>p8,StringFromUriComponent:()=>d8,Struct:()=>_e,StructWithRest:()=>qZ,Symbol:()=>oD,TaggedClass:()=>oY,TaggedError:()=>Hn,TaggedStruct:()=>Mp,TaggedUnion:()=>n5,TemplateLiteral:()=>_Z,TemplateLiteralParser:()=>PZ,TimeZone:()=>t2,TimeZoneFromString:()=>D8,TimeZoneNamed:()=>XD,TimeZoneNamedFromString:()=>U8,TimeZoneOffset:()=>M8,Tree:()=>EY,Trim:()=>u8,Trimmed:()=>ND,TrueLiterals:()=>Gg,Tuple:()=>No,TupleWithRest:()=>HZ,URL:()=>_D,URLFromString:()=>X5,URLSearchParams:()=>$D,Uint8Array:()=>Zg,Uint8ArrayFromBase64:()=>g8,Uint8ArrayFromBase64Url:()=>x8,Uint8ArrayFromHex:()=>UD,Undefined:()=>xC,UndefinedOr:()=>Wg,Union:()=>Ze,UniqueArray:()=>VZ,UniqueSymbol:()=>DZ,UnixPathAddress:()=>p2,UnixPathAddressFromString:()=>bQ,Unknown:()=>$p,UnknownFromJsonString:()=>n8,UrlParams:()=>RC,Void:()=>MZ,annotate:()=>oZ,annotateEncoded:()=>sZ,annotateKey:()=>aZ,asserts:()=>fZ,brand:()=>Vg,catchDecoding:()=>ZZ,catchDecodingWithContext:()=>pD,catchEncoding:()=>QZ,catchEncodingWithContext:()=>dD,check:()=>KZ,declare:()=>Me,declareConstructor:()=>_r,decode:()=>YZ,decodeEffect:()=>lZ,decodeExit:()=>pZ,decodeOption:()=>mZ,decodePromise:()=>gZ,decodeResult:()=>hZ,decodeSync:()=>xZ,decodeTo:()=>J,decodeUnknownEffect:()=>Ss,decodeUnknownExit:()=>JU,decodeUnknownOption:()=>dZ,decodeUnknownPromise:()=>QU,decodeUnknownResult:()=>ZU,decodeUnknownSync:()=>YU,encode:()=>XZ,encodeEffect:()=>yZ,encodeExit:()=>SZ,encodeKeys:()=>jZ,encodeOption:()=>bZ,encodePromise:()=>CZ,encodeResult:()=>IZ,encodeSync:()=>TZ,encodeTo:()=>bC,encodeUnknownEffect:()=>Lg,encodeUnknownExit:()=>XU,encodeUnknownOption:()=>EZ,encodeUnknownPromise:()=>tD,encodeUnknownResult:()=>eD,encodeUnknownSync:()=>rD,extendTo:()=>zZ,fieldsAssign:()=>LZ,flip:()=>lC,fromBrand:()=>JZ,fromFormData:()=>o8,fromJsonString:()=>OC,fromURLSearchParams:()=>s8,instanceOf:()=>la,is:()=>Dg,isBase64:()=>SD,isBase64Url:()=>d5,isBetween:()=>pa,isBetweenBigDecimal:()=>I8,isBetweenBigInt:()=>U5,isBetweenCodePoints:()=>B5,isBetweenDate:()=>R5,isBetweenLength:()=>TC,isBetweenProperties:()=>V5,isBetweenSize:()=>q5,isCapitalized:()=>S5,isEndingWith:()=>h5,isFinite:()=>b5,isGUID:()=>l5,isGreaterThan:()=>C5,isGreaterThanBigDecimal:()=>y8,isGreaterThanBigInt:()=>$5,isGreaterThanDate:()=>O5,isGreaterThanOrEqualTo:()=>ED,isGreaterThanOrEqualToBigDecimal:()=>S8,isGreaterThanOrEqualToBigInt:()=>bD,isGreaterThanOrEqualToDate:()=>_5,isIncluding:()=>g5,isInt:()=>Jg,isInt32:()=>A5,isLessThan:()=>T5,isLessThanBigDecimal:()=>E8,isLessThanBigInt:()=>N5,isLessThanDate:()=>P5,isLessThanOrEqualTo:()=>w5,isLessThanOrEqualToBigDecimal:()=>b8,isLessThanOrEqualToBigInt:()=>M5,isLessThanOrEqualToDate:()=>F5,isLowercased:()=>y5,isMaxCodePoints:()=>L5,isMaxLength:()=>wD,isMaxProperties:()=>W5,isMaxSize:()=>z5,isMinCodePoints:()=>D5,isMinLength:()=>ID,isMinProperties:()=>H5,isMinSize:()=>j5,isMultipleOf:()=>k5,isNonEmpty:()=>TD,isPattern:()=>Oi,isPropertyNames:()=>G5,isSchema:()=>Bg,isSchemaError:()=>HU,isStartingWith:()=>m5,isStringBigInt:()=>i5,isStringFinite:()=>a5,isStringSymbol:()=>c5,isTrimmed:()=>yD,isULID:()=>p5,isUUID:()=>f5,isUint32:()=>v5,isUncapitalized:()=>E5,isUnique:()=>kC,isUniqueKey:()=>kD,isUppercased:()=>x5,link:()=>Te,linkDecoding:()=>Nu,make:()=>V,makeFilter:()=>ke,makeFilterGroup:()=>s5,makeIsBetween:()=>jp,makeIsGreaterThan:()=>Up,makeIsGreaterThanOrEqualTo:()=>Dp,makeIsLessThan:()=>Lp,makeIsLessThanOrEqualTo:()=>Bp,makeIsMultipleOf:()=>I5,middlewareDecoding:()=>fD,middlewareEncoding:()=>lD,mutable:()=>GZ,mutableKey:()=>AZ,optional:()=>Es,optionalKey:()=>xs,overrideToCodecIso:()=>yY,overrideToEquivalence:()=>iY,overrideToFormatter:()=>sY,readonlyKey:()=>vZ,refine:()=>uD,required:()=>kZ,requiredKey:()=>wZ,resolveAnnotations:()=>TY,resolveAnnotationsKey:()=>wY,revealBottom:()=>nZ,revealCodec:()=>iZ,suspend:()=>cD,tag:()=>ys,tagDefaultOmit:()=>r5,toCodecArrayFromSingle:()=>dY,toCodecIso:()=>pY,toCodecJson:()=>lY,toCodecStringTree:()=>NC,toDifferJsonPatch:()=>SY,toEncoded:()=>Ru,toEncoderXml:()=>mY,toEquivalence:()=>cY,toFormatter:()=>aY,toIso:()=>hY,toIsoFocus:()=>xY,toIsoSource:()=>gY,toJsonSchemaDocument:()=>fY,toRepresentation:()=>uY,toStandardJSONSchemaV1:()=>uZ,toStandardSchemaV1:()=>cZ,toTaggedUnion:()=>xD,toType:()=>Pr,withArrayLengthConstraints:()=>qg,withConstructorDefault:()=>mD,withDecodingDefault:()=>gD,withDecodingDefaultKey:()=>IC,withDecodingDefaultType:()=>t5,withDecodingDefaultTypeKey:()=>e5});var Qh="~effect/HashMap",Un=5,cp=1<<Un,o6=cp/4,fM=cp/2,s6=cp-1,a6=e=>(e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24),ip=(e,t)=>e>>>t&s6,oa=(e,t)=>1<<ip(e,t),Zh=(e,t)=>a6(e&t-1);function lM(e,t,r,n,o,s){if(t>32)throw new Error("HashMap: max depth exceeded");let a=oa(r,t),i=oa(o,t);if(a===i){let u=lM(e,t+Un,r,n,o,s);return new xi(e,a,[u])}let c=a|i,f=a>>>0<i>>>0?[n,s]:[s,n];return new xi(e,c,f)}var i6=Ae("HashMap"),pM=(e,t)=>ae(q(e),q(t)),dM=e=>{let t=0;for(let r=0;r<e.length;r++){let n=e[r];n&&(t^=n.subtreeHash())}return t},hi=class{canEdit(t){return this.edit===t}subtreeHash(){let t=this._hash;if(t===void 0){let r=Ta;t=this.computeHash(),r===Ta&&(this._hash=t)}return t}},FI=class extends hi{_tag="EmptyNode";edit=0;get size(){return 0}get(t,r,n){return v()}has(t,r,n){return!1}set(t,r,n,o,s,a){return a.value=!0,new gi(t,n,o,s)}remove(t,r,n,o,s){return this}canEdit(t){return!1}computeHash(){return 0}},gi=class e extends hi{_tag="LeafNode";edit;hash;key;value;constructor(t,r,n,o){super(),this.edit=t,this.hash=r,this.key=n,this.value=o}get size(){return 1}get(t,r,n){return this.hash===r&&W(this.key,n)?R(this.value):v()}has(t,r,n){return this.hash===r&&W(this.key,n)}set(t,r,n,o,s,a){if(this.canEdit(t)&&(this._hash=void 0),this.hash===n&&W(this.key,o))return W(this.value,s)?this:this.canEdit(t)?(this.value=s,this):new e(t,n,o,s);if(a.value=!0,this.hash===n)return new RI(t,n,[[this.key,this.value],[o,s]]);let i=oa(n,r),c=oa(this.hash,r);if(i===c)return new xi(t,i,[this.set(t,r+Un,n,o,s,a)]);let f=i|c,u=i>>>0<c>>>0?[new e(t,n,o,s),this]:[this,new e(t,n,o,s)];return new xi(t,f,u)}remove(t,r,n,o,s){if(this.hash===n&&W(this.key,o)){s.value=!0;return}return this}computeHash(){return pM(this.key,this.value)}},RI=class e extends hi{_tag="CollisionNode";edit;hash;entries;constructor(t,r,n){super(),this.edit=t,this.hash=r,this.entries=n}get size(){return this.entries.length}get(t,r,n){if(this.hash!==r)return v();for(let[o,s]of this.entries)if(W(o,n))return R(s);return v()}has(t,r,n){if(this.hash!==r)return!1;for(let[o]of this.entries)if(W(o,n))return!0;return!1}set(t,r,n,o,s,a){if(this.canEdit(t)&&(this._hash=void 0),this.hash!==n)return a.value=!0,lM(t,r,this.hash,this,n,new gi(t,n,o,s));for(let i=0;i<this.entries.length;i++)if(W(this.entries[i][0],o)){if(W(this.entries[i][1],s))return this;if(this.canEdit(t))return this.entries[i]=[o,s],this;let c=[...this.entries];return c[i]=[o,s],new e(t,this.hash,c)}return a.value=!0,this.canEdit(t)?(this.entries.push([o,s]),this):new e(t,this.hash,[...this.entries,[o,s]])}remove(t,r,n,o,s){if(this.canEdit(t)&&(this._hash=void 0),this.hash!==n)return this;let a=this.entries.findIndex(([c])=>W(c,o));if(a===-1)return this;if(s.value=!0,this.entries.length===1)return;if(this.entries.length===2){let c=this.entries[a===0?1:0];return new gi(t,this.hash,c[0],c[1])}if(this.canEdit(t))return this.entries.splice(a,1),this;let i=[...this.entries];return i.splice(a,1),new e(t,this.hash,i)}computeHash(){let t=0,r=this.entries;for(let n=0;n<r.length;n++)t^=pM(r[n][0],r[n][1]);return t}},xi=class e extends hi{_tag="IndexedNode";edit;_size;bitmap;children;constructor(t,r,n){super(),this.edit=t,this.bitmap=r,this.children=n}get size(){return this._size===void 0&&(this._size=this.children.reduce((t,r)=>t+r.size,0)),this._size}get(t,r,n){let o=oa(r,t);if((this.bitmap&o)===0)return v();let s=Zh(this.bitmap,o);return this.children[s].get(t+Un,r,n)}has(t,r,n){let o=oa(r,t);if((this.bitmap&o)===0)return!1;let s=Zh(this.bitmap,o);return this.children[s].has(t+Un,r,n)}set(t,r,n,o,s,a){this.canEdit(t)&&(this._hash=void 0);let i=oa(n,r),c=Zh(this.bitmap,i);if((this.bitmap&i)!==0){let f=this.children[c],u=f.set(t,r+Un,n,o,s,a);if(f===u)return this;if(this.canEdit(t))return this.children[c]=u,this;let l=[...this.children];return l[c]=u,new e(t,this.bitmap,l)}else{a.value=!0;let f=new gi(t,n,o,s),u=this.bitmap|i;if(this.canEdit(t))return this.children.splice(c,0,f),this.bitmap=u,this._size=void 0,this.children.length>fM?this.expand(t,u,this.children):this;let l=[...this.children];return l.splice(c,0,f),l.length>fM?this.expand(t,u,l):new e(t,u,l)}}remove(t,r,n,o,s){this.canEdit(t)&&(this._hash=void 0);let a=oa(n,r);if((this.bitmap&a)===0)return this;let i=Zh(this.bitmap,a),c=this.children[i],f=c.remove(t,r+Un,n,o,s);if(!s.value)return this;if(f===void 0){let l=this.bitmap^a;if(l===0)return;if(this.children.length===2){let h=this.children[i===0?1:0];if(h._tag==="LeafNode")return h}if(this.canEdit(t))return this.children.splice(i,1),this.bitmap=l,this._size=void 0,this;let p=[...this.children];return p.splice(i,1),new e(t,l,p)}if(c===f)return this;if(this.canEdit(t))return this.children[i]=f,this;let u=[...this.children];return u[i]=f,new e(t,this.bitmap,u)}expand(t,r,n){let o=new globalThis.Array(cp),s=0;for(let a=0;a<cp;a++)(r&1<<a)!==0&&(o[a]=n[s++]);return new $I(t,n.length,o)}computeHash(){return dM(this.children)}},$I=class e extends hi{_tag="ArrayNode";edit;_size;count;children;constructor(t,r,n){super(),this.edit=t,this.count=r,this.children=n}get size(){return this._size===void 0&&(this._size=this.children.reduce((t,r)=>t+(r?.size??0),0)),this._size}get(t,r,n){let o=ip(r,t),s=this.children[o];return s?s.get(t+Un,r,n):v()}has(t,r,n){let o=ip(r,t),s=this.children[o];return s?s.has(t+Un,r,n):!1}set(t,r,n,o,s,a){this.canEdit(t)&&(this._hash=void 0);let i=ip(n,r),c=this.children[i];if(c){let f=c.set(t,r+Un,n,o,s,a);if(c===f)return this;if(this.canEdit(t))return this.children[i]=f,this;let u=[...this.children];return u[i]=f,new e(t,this.count,u)}else{a.value=!0;let f=new gi(t,n,o,s);if(this.canEdit(t))return this.children[i]=f,this.count++,this._size=void 0,this;let u=[...this.children];return u[i]=f,new e(t,this.count+1,u)}}remove(t,r,n,o,s){this.canEdit(t)&&(this._hash=void 0);let a=ip(n,r),i=this.children[a];if(!i)return this;let c=i.remove(t,r+Un,n,o,s);if(!s.value)return this;let f=this.count-(c?0:1);if(f<o6)return this.pack(t,a,c);if(i===c)return this;if(this.canEdit(t))return this.children[a]=c,c||(this.count=f),this._size=void 0,this;let u=[...this.children];return u[a]=c,new e(t,f,u)}pack(t,r,n){let o=[],s=0,a=1;for(let i=0;i<this.children.length;i++){let c=i===r?n:this.children[i];c&&(o.push(c),s|=a),a<<=1}return new xi(t,s,o)}computeHash(){return dM(this.children)}},Yh=class{stack;project;entries=[];index=0;constructor(t,r){this.stack=[t],this.project=r}next(){for(;;){if(this.index<this.entries.length){let r=this.entries[this.index++];return{done:!1,value:this.project(r[0],r[1])}}if(this.stack.length===0)return{done:!0,value:void 0};let t=this.stack.pop();switch(t._tag){case"LeafNode":{let r=t;return{done:!1,value:this.project(r.key,r.value)}}case"CollisionNode":{this.entries=t.entries,this.index=0;break}case"IndexedNode":case"ArrayNode":{let r=t.children;for(let n=r.length-1;n>=0;n--){let o=r[n];o&&this.stack.push(o)}}}}}[Symbol.iterator](){return this}},c6=(e,t)=>[e,t];var up=class{[Qh]=Qh;_editable;_edit;_root;_size;constructor(t,r,n,o){this._editable=t,this._edit=r,this._root=n,this._size=o}get size(){return this._size}[Symbol.iterator](){return new Yh(this._root,c6)}[X](t){if(NI(t)){let r=t;if(this.size!==r.size)return!1;for(let[n,o]of this){let s=Jn(t,gM(n));if(Ke(s)||!W(o,s.value))return!1}return!0}return!1}[Y](){return Lt(i6^this._root.subtreeHash())}[qe](){return vt(this)}toString(){return`HashMap(${N(Array.from(this))})`}toJSON(){return{_id:"HashMap",values:Array.from(this).map(([t,r])=>[vt(t),vt(r)])}}pipe(){return te(this,arguments)}},mM=new FI,NI=e=>A(e,Qh),MI=()=>new up(!1,0,mM,0);var hM=e=>{let t=mM,r=0,n={value:!1};for(let[o,s]of e){let a=q(o);n.value=!1,t=t.set(NaN,0,a,o,s,n),n.value&&r++}return new up(!1,0,t,r)};var gM=m(2,(e,t)=>e._root.get(0,q(t),t));var UI=m(2,(e,t)=>e._root.has(0,q(t),t));var u6=(e,t,r,n)=>{let o=e,s={value:!1},a=o._editable?o._edit:NaN,i=o._root.set(a,0,r,t,n,s);return o._editable?(o._root=i,s.value&&o._size++,e):o._root===i?e:new up(!1,o._edit,i,o._size+(s.value?1:0))},DI=m(3,(e,t,r)=>u6(e,t,q(t),r)),LI=e=>new Yh(e._root,F);var xM=e=>e[Symbol.iterator](),Xh=e=>e.size;var SM=NI;var BI=hM;var p6=xM,fp=e=>Array.from(p6(e)),EM=Xh;var lp="~effect/HashSet",d6=Ae(lp),m6={[Y](){return Lt(ae(d6,q(eg(this))))},[X](e){return zI(e)&&tg(this)===tg(e)&&CM(this,t=>IM(e,t))},[Symbol.iterator](){return LI(eg(this))},toString(){return`HashSet(${N(Array.from(this))})`},toJSON(){return{_id:"HashSet",values:vt(Array.from(this))}},[qe](){return this.toJSON()},pipe(){return te(this,arguments)}},h6=e=>{let t=Object.create(m6);return t[lp]=lp,t.keyMap=e,t},zI=e=>A(e,lp),eg=e=>e.keyMap;var bM=e=>{let t=MI();for(let r of e)t=DI(t,r,!0);return h6(t)},IM=(e,t)=>UI(eg(e),t);var tg=e=>Xh(eg(e));var CM=(e,t)=>{for(let r of e)if(!t(r))return!1;return!0};var qI=bM,TM=zI;var wM=tg;var WI="~effect/http/Cookies",AM=e=>A(e,WI),VI="~effect/http/Cookies/Cookie",vM=e=>A(e,VI),kM="~effect/http/Cookies/CookieError",GI=class extends _f{},yi=class e extends an("CookiesError"){static fromReason(t,r){return new e({reason:new GI({_tag:t,cause:r})})}[kM]=kM;get message(){return this.reason._tag}};var x6={[WI]:WI,...mt,toJSON(){return{_id:"effect/Cookies",cookies:Nd(this.cookies,e=>e.toJSON())}},pipe(){return te(this,arguments)}},JI=e=>{let t=Object.create(x6);return t.cookies=e,t},ZI=e=>{let t={};for(let r of e)U(t,r.name,r);return JI(t)},OM=e=>{let t=typeof e=="string"?[e]:e,r=[];for(let n of t){let o=y6(n.trim());o&&r.push(o)}return ZI(r)};function y6(e){let t=e.split(";").map(i=>i.trim()).filter(i=>i!=="");if(t.length===0)return;let r=t[0].indexOf("=");if(r===-1)return;let n=t[0].slice(0,r);if(!_M.test(n))return;let o=t[0].slice(r+1),s=T6(o);if(t.length===1)return Object.assign(Object.create(KI),{name:n,value:s,valueEncoded:o});let a={};for(let i=1;i<t.length;i++){let c=t[i],f=c.indexOf("="),u=f===-1?c:c.slice(0,f).trim(),l=f===-1?void 0:c.slice(f+1).trim();switch(u.toLowerCase()){case"domain":{if(l===void 0)break;let p=l.trim().replace(/^\./,"");p&&(a.domain=p);break}case"expires":{if(l===void 0)break;let p=new Date(l);isNaN(p.getTime())||(a.expires=p);break}case"max-age":{if(l===void 0)break;let p=parseInt(l,10);isNaN(p)||(a.maxAge=vf(p));break}case"path":{if(l===void 0)break;l[0]==="/"&&(a.path=l);break}case"priority":{if(l===void 0)break;switch(l.toLowerCase()){case"low":a.priority="low";break;case"medium":a.priority="medium";break;case"high":a.priority="high";break}break}case"httponly":{a.httpOnly=!0;break}case"secure":{a.secure=!0;break}case"partitioned":{a.partitioned=!0;break}case"samesite":{if(l===void 0)break;switch(l.toLowerCase()){case"lax":a.sameSite="lax";break;case"strict":a.sameSite="strict";break;case"none":a.sameSite="none";break}break}}}return Object.assign(Object.create(KI),{name:n,value:s,valueEncoded:o,options:Object.keys(a).length>0?a:void 0})}var S6=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,_M=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,E6=/^[\u0009\u0020-\u003a\u003c-\u007e\u0080-\u00ff]+$/,b6=/^[\u0020-\u003a\u003c-\u007e]+$/,KI={[VI]:VI,...mt,toJSON(){return{_id:"effect/Cookies/Cookie",name:this.name,value:this.value,options:this.options}}};function I6(e,t,r){let n=encodeURIComponent(t),o=PM(e,n,r);return o!==void 0?Z(o):H(Object.assign(Object.create(KI),{name:e,value:t,valueEncoded:n,options:r}))}function PM(e,t,r){if(!_M.test(e))return yi.fromReason("InvalidCookieName");if(t&&!S6.test(t))return yi.fromReason("InvalidCookieValue");if(r?.domain!==void 0&&!E6.test(r.domain))return yi.fromReason("InvalidCookieDomain");if(r?.path!==void 0&&!b6.test(r.path))return yi.fromReason("InvalidCookiePath");if(r?.maxAge!==void 0&&!cc(Mt(r.maxAge)))return yi.fromReason("CookieInfinityMaxAge")}var FM=(e,t,r)=>Rs(I6(e,t,r));function C6(e){let t=PM(e.name,e.valueEncoded,e.options);if(t!==void 0)throw t;let r=e.name+"="+e.valueEncoded;if(e.options===void 0)return r;let n=e.options;if(n.maxAge!==void 0){let o=uo(Mt(n.maxAge));r+="; Max-Age="+Math.trunc(o)}if(n.domain!==void 0&&(r+="; Domain="+n.domain),n.path!==void 0&&(r+="; Path="+n.path),n.priority!==void 0)switch(n.priority){case"low":r+="; Priority=Low";break;case"medium":r+="; Priority=Medium";break;case"high":r+="; Priority=High";break}if(n.expires!==void 0&&(r+="; Expires="+n.expires.toUTCString()),n.httpOnly&&(r+="; HttpOnly"),n.secure&&(r+="; Secure"),n.partitioned&&(r+="; Partitioned"),n.sameSite!==void 0)switch(n.sameSite){case"lax":r+="; SameSite=Lax";break;case"strict":r+="; SameSite=Strict";break;case"none":r+="; SameSite=None";break}return r}var RM=e=>{let t={},r=Object.values(e.cookies);for(let n=0;n<r.length;n++){let o=r[n];U(t,o.name,o.value)}return t},$M=e=>Object.values(e.cookies).map(C6);var T6=e=>{try{return decodeURIComponent(e)}catch{return e}};var Si=new WeakMap,NM=e=>{if(Si.has(e))return Si.get(e);throw new Error("Unable to get redacted value"+(e.label?` with label: "${e.label}"`:""))};var MM="~effect/Redacted",QI=e=>A(e,MM),Dn=(e,t)=>{let r=Object.create(A6);return t?.label&&(r.label=t.label),Si.set(r,e),r},A6={[MM]:{_A:e=>e},label:void 0,...Xt,toJSON(){return this.toString()},toString(){return`<redacted${En(this.label)?":"+this.label:""}>`},[Y](){return q(Si.get(this))},[X](e){return QI(e)&&W(Si.get(this),Si.get(e))}},sa=NM;var UM=e=>gr((t,r)=>e(sa(t),sa(r)));var YI=Symbol.for("~effect/http/Headers"),DM=e=>A(e,YI),XI=Object.defineProperties(Object.create(null),{[YI]:{value:YI},[ka]:{value(e){return O6(this,ct(e,_6))}},toJSON:{value(){return Bo(this)}},[X]:{value(e){return e0(this,e)}},[Y]:{value(){return lf(this)}},toString:{value:mt.toString},[qe]:{value:mt[qe]}});var e0=Ak(Fa()),v6=Object.create(XI),LM=e=>{if(e===void 0)return v6;if(Symbol.iterator in e){let r=Object.create(XI);for(let[n,o]of e)r[n.toLowerCase()]=o;return r}let t=Object.create(XI);for(let[r,n]of Object.entries(e))Array.isArray(n)?t[r.toLowerCase()]=n.join(", "):n!==void 0&&(t[r.toLowerCase()]=n);return t};var O6=m(2,(e,t)=>{let r={...e},n=o=>{if(typeof o=="string"){let s=o.toLowerCase();s in e&&(r[s]=Dn(e[s]))}else for(let s in e)s.search(o)!==-1&&(r[s]=Dn(e[s]))};if(Array.isArray(t))for(let o=0;o<t.length;o++)n(t[o]);else n(t);return r});var _6=ge("effect/Headers/CurrentRedactedNames",{defaultValue:()=>["authorization","cookie","set-cookie","x-api-key","AWSAccessKeyId","Signature","sig","X-Goog-Signature"]});var t0="~effect/http/UrlParams",r0=e=>A(e,t0),F6={...Xt,[t0]:t0,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:"UrlParams",params:Object.fromEntries(this.params)}},[X](e){return n0(this,e)},[Y](){return Qn(this.params.flat())}},rg=e=>{let t=Object.create(F6);return t.params=e,t},BM=e=>{if(r0(e))return e;let t=jM(e),r=[];for(let n=0;n<t.length;n++)if(Array.isArray(t[n][0])){let[o,s]=t[n];r.push([`${o[0]}[${o.slice(1).join("][")}]`,s])}else r.push(t[n]);return rg(r)},jM=e=>{let t=typeof e[Symbol.iterator]=="function"?rr(e):Object.entries(e),r=[];for(let[n,o]of t)if(Array.isArray(o))for(let s=0;s<o.length;s++)o[s]!==void 0&&r.push([n,String(o[s])]);else if(o!==null&&typeof o=="object"){let s=jM(o);for(let[a,i]of s)r.push([[n,...typeof a=="string"?[a]:a],i])}else o!==void 0&&r.push([n,String(o)]);return r},n0=gr((e,t)=>R6(e.params,t.params)),R6=vk(Ik([Fa(),Fa()]));var zM=m(2,(e,t)=>kf(e.params,([r])=>r===t).pipe(Xi(([,r])=>r)));var $6=e=>{let t={};for(let[r,n]of e.params)if(!Object.hasOwn(t,r))U(t,r,n);else{let o=t[r];typeof o=="string"?U(t,r,[o,n]):o.push(n)}return t},qM=$6;var o0="~effect/Graph",s0=e=>A(e,o0),HM=e=>e;var M6=(e,t,r)=>(e==="directed"?t.source===r.source&&t.target===r.target:t.source===r.source&&t.target===r.target||t.source===r.target&&t.target===r.source)&&W(t.data,r.data),U6=(e,t)=>e==="directed"?q(t):Lt(ae(q(t.data),D6(t.source,t.target))),D6=(e,t)=>ae(0,q(e))+ae(0,q(t)),L6=Ae("Graph"),B6={[o0]:{_N:e=>e,_E:e=>e},[Symbol.iterator](){return this.nodes[Symbol.iterator]()},[qe](){return this.toJSON()},[X](e){if(A(e,o0)){let t=HM(e);if(this.nodes.size!==t.nodes.size||this.edges.size!==t.edges.size||this.type!==t.type)return!1;for(let[r,n]of this.nodes)if(!t.nodes.has(r)||!W(n,t.nodes.get(r)))return!1;for(let[r,n]of this.edges){let o=t.edges.get(r);if(o===void 0||!M6(this.type,n,o))return!1}return!0}return!1},[Y](){let e=L6;e=e^Ae(this.type),e=e^dt(this.nodes.size),e=e^dt(this.edges.size);for(let[t,r]of this.nodes)e^=ae(q(t),q(r));for(let[t,r]of this.edges)e^=ae(q(t),U6(this.type,r));return Lt(e)},toJSON(){return{_id:"Graph",nodeCount:this.nodes.size,edgeCount:this.edges.size,type:this.type}},toString(){return`Graph(${this.type}, ${this.nodes.size}, ${this.edges.size})`},pipe(){return te(this,arguments)}},j6=(e,t)=>{let r=Object.create(B6);return r.type=e,r.mutable=t,r.transforming=!1,r.nodes=new Map,r.edges=new Map,r.adjacency=new Map,r.reverseAdjacency=new Map,r.nextNodeIndex=0,r.nextEdgeIndex=0,r.acyclic=R(!0),r};var pp=e=>{let t=HM(e);return{type:e.type,nodes:Array.from(t.nodes,([r,n])=>({index:r,data:n})).sort((r,n)=>r.index-n.index),edges:Array.from(t.edges,([r,n])=>({index:r,source:n.source,target:n.target,data:n.data})).sort((r,n)=>r.index-n.index)}},ng=e=>{let t=j6(e.type,!1);for(let r of e.nodes)t.nodes.set(r.index,r.data),t.adjacency.set(r.index,[]),t.reverseAdjacency.set(r.index,[]);for(let r of e.edges)t.edges.set(r.index,{source:r.source,target:r.target,data:r.data}),t.adjacency.get(r.source).push(r.index),t.reverseAdjacency.get(r.target).push(r.index),e.type==="undirected"&&(t.adjacency.get(r.target).push(r.index),t.reverseAdjacency.get(r.source).push(r.index));return t.nextNodeIndex=e.nodes.length===0?0:e.nodes[e.nodes.length-1].index+1,t.nextEdgeIndex=e.edges.length===0?0:e.edges[e.edges.length-1].index+1,t.acyclic=v(),t};var og=(e,t,r)=>e===je?r(t):Rt(e,r);function VM(e){if(e._tag==="Middleware")return(r,n,o)=>{let s=r===je?e.decode(Vt(Ll(n)),o):e.decode(ei(r,Ll),o);return WM(s)};let t=e.decode;switch(t._tag){case"Passthrough":return(r,n)=>r===je?Vt(n):r;case"Transform":{let r=n=>n===me?Ar:Vt(t.transform(n));return(n,o)=>og(n,o,r)}case"TransformOptional":{let r=n=>sb(t.transform(Ll(n)));return(n,o)=>og(n,o,r)}case"TransformEffect":return(r,n,o)=>og(r,n,s=>s===me?Ar:t.transform(s,o));case"TransformOptionalEffect":return(r,n,o)=>og(r,n,s=>WM(t.transform(Ll(s),o)))}}var WM=e=>Rt(e,sb),GM=(e,t,r,n)=>br(n,o=>Ws(()=>qs(o,s=>new aR(e,s,t,r))));function q6(e,t){let r=VM(e.link.transformation),n;return(o,s)=>{if(o===me)return Ar;if(e.isConstructed(o))return je;let a=(n??=t(e.link.to))(o,s);return r(a,o,s)}}function H6(e,t){let r=e.context.constructorDefault;return(n,o)=>{if(n!==me&&n!==void 0)return t(n,o);let s=r;if($e(s)&&s._tag==="Success"){let a=t(s[ue],o);return a===je?s:a}return Rt(GM(e,n,o,s),a=>{let i=t(a,o);return i===je?Vt(a):i})}}function a0(e,t){let r=t(e);return e.context?.constructorDefault===void 0?r:H6(e,r)}function dp(e,t,r,n,o){if(e._tag==="Declaration")for(let g of e.typeParameters)t(g);let s=r?IN(e):void 0,a=s?q6(s,t):n??e.getParser(t,r),i=e.checks,c=e.encoding,f=c?.map(g=>VM(g.transformation)),u=e.encodingChecks;if(!c&&!i&&!u)return a;let l,p=(g,x)=>{let b=a(g,x);if(u&&!x.disableChecks)if($e(b)){if(b._tag==="Success"){let T=b===je?g:b[ue];if(g!==me&&T!==me){let w=Mn(u,g,void 0,e,x);w&&(b=C(new At(e,w,g,x)))}}}else b=L(b,T=>{if(g!==me&&T!==me){let w=Mn(u,g,void 0,e,x);if(w)return C(new At(e,w,g,x))}return y(T)});if(i&&!x.disableChecks)if($e(b)){if(b._tag==="Success"){let T=b===je?g:b[ue];if(T===me)return b;let w=Mn(i,T,void 0,e,x);w&&(b=C(new At(e,w,T,x)))}}else b=L(b,T=>{if(T!==me){let w=Mn(i,T,void 0,e,x);if(w)return C(new At(e,w,T,x))}return y(T)});return b},h=o===void 0?p:o(p);return c?(g,x)=>{let b=l??=c.map(P=>t(P.to)),T=g,w=b[b.length-1](g,x);for(let P=c.length-1;P>=0;P--)if(w=f[P](w,T,x),P!==0){let O=b[P-1];w._tag==="Success"?(T=w[ue],w=O(T,x)):w=Rt(w,d=>{let S=O(d,x);return S===je?Vt(d):S})}if(w._tag==="Success"){let P=w[ue],O=h(P,x);return O===je?w:O}return w=GM(e,g,x,w),Rt(w,P=>{let O=h(P,x);return O===je?Vt(P):O})}:h}var ig=Symbol(),KM=new WeakMap,JM,xu=!1;var V6=e=>xu?ag(en,e,"parser"):en(e).parser,ZM=e=>xu?ag(en,e,"makeEffect"):en(e).makeEffect,G6=e=>a0(e,ZM),sg=class{ast;constructor(t){this.ast=t}get decodeEffect(){return this.cachedDecodeEffect??=dp(this.ast,V6)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=dp(this.ast,ZM,G6)}},i0=class extends sg{compiled;resolve;constructor(t,r,n){super(t),this.compiled=r,this.resolve=n}save(t,r){return Object.defineProperty(this,t,{value:r}),r}operation(t){let r=this.compiled;return typeof r=="function"?r(this.ast,this.resolve,t):r?.[t]}get is(){return this.save("is",this.operation("is"))}get decode(){return this.save("decode",this.operation("decode"))}get make(){return this.save("make",this.operation("make"))}get decodeEffect(){return this.save("decodeEffect",this.operation("decodeEffect")??dp(this.ast,t=>ag(this.resolve,t,"parser")))}get parser(){let t=this.decode;return t===void 0?this.decodeEffect:this.save("parser",K6(t,()=>this.decodeEffect))}get makeEffect(){let t=this.operation("makeEffect");if(t!==void 0)return this.save("makeEffect",t);let r=n=>ag(this.resolve,n,"makeEffect");return this.save("makeEffect",dp(this.ast,r,n=>a0(n,r)))}};function K6(e,t){let r;return(n,o)=>{if(n!==me)try{let s=e(n,o);if(s!==ig)return s===n?je:Vt(s)}catch(s){return sr(s)}return(r??=t())(n,o)}}function ag(e,t,r){let n=e(t);if(n.compiled===void 0||Object.hasOwn(n,r))return n[r];let o;return(s,a)=>(o??=n[r])(s,a)}function en(e){let t=KM.get(e);if(t!==void 0)return t;let r=JM===void 0?new sg(e):new i0(e,JM(e,en),en);return KM.set(e,r),r}function u0(e){let t=e.ast,r;return(n,o)=>(r??=g0(nK,It(t)))(n,o?.disableChecks?o?.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions)}function ug(e){let t=u0(e);return(r,n)=>{let o=wo(t(r,n));return ut(o)?R(o.value):(Zr(o.cause,"Option adapter can only return none for schema issues"),v())}}function fg(e){return tK(It(e.ast))}function f0(e){return mp(e.ast)}function Z6(e){if(!xu){let o=yu(dg(e));return s=>{let a=o(s,Fo);return ut(a)?!0:(Zr(a.cause,"Type guard adapter can only return false for schema issues"),!1)}}let t=en(e),r=t.is;if(r!==void 0)return o=>{try{return r(o,Fo)}catch(s){return Zr(Yf(s),"Type guard adapter can only return false for schema issues"),!1}};let n=t.parser;return o=>{let s=wo(h0(n(o,Fo),o));return ut(s)?!0:(Zr(s.cause,"Type guard adapter can only return false for schema issues"),!1)}}function mp(e){let t=It(e),r=n=>(r=Z6(t),r(n));return n=>r(n)}function QM(e){let t=dg(e);return(r,n)=>{let o=wo(t(r,n));if(!ut(o))return Zr(o.cause,"Issue adapter can only return schema issues")}}function YM(e,t){let r=It(e.ast),n=en(r).parser(t,Fo),o=wo(h0(n,t));if(el(o)){let s=Zr(o.cause,"Assertion adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}function St(e,t){let r=dg(e.ast);return t===void 0?r:(n,o)=>r(n,m0(t,o))}var l0=St;function XM(e,t){return yu(St(e,t))}function p0(e,t){return a1(St(e,t))}var e1=p0;function t1(e,t){return i1(St(e,t))}function Q6(e,t){return xu?c1(e.ast,t):x0(St(e,t))}var lg=Q6;function Ei(e,t){let r=dg(Xr(e.ast));return t===void 0?r:(n,o)=>r(n,m0(t,o))}var r1=Ei;function n1(e,t){return yu(Ei(e,t))}function d0(e,t){return a1(Ei(e,t))}var o1=d0;function s1(e,t){return i1(Ei(e,t))}function Y6(e,t){return xu?c1(Xr(e.ast),t):x0(Ei(e,t))}var pg=Y6,m0=(e,t)=>t?{...e,...t}:e,cg=e=>e===me?C(new ce):y(e);function dg(e){return g0(rK,e)}function h0(e,t){return e===je?y(t):$e(e)?e[ue]===me?cg(me):e:Rt(e,cg)}function g0(e,t){let r;return(n,o)=>{let s=(r??=e(t))(n,o??Fo);return s===je?y(n):$e(s)?s[ue]===me?cg(me):s:Rt(s,cg)}}function yu(e){return(t,r)=>wo(e(t,r))}function a1(e){let t=yu(e);return(r,n)=>{let o=t(r,n);return ut(o)?R(o.value):(Zr(o.cause,"Option adapter can only return none for schema issues"),v())}}function i1(e){let t=yu(e);return(r,n)=>{let o=t(r,n);return ut(o)?H(o.value):Z(Zr(o.cause,"Result adapter can only return schema issues"))}}function c1(e,t){let r;return(n,o)=>(r??=X6(en(e),t))(n,o)}function X6(e,t){let r=e.decode,n,o=r===void 0?(s,a=Fo)=>(n??=c0(e))(s,a):(s,a=Fo)=>{if(s===me)return(n??=c0(e))(s,a);let i;try{i=r(s,a)}catch(c){throw Zr(Yf(c),"Sync adapter can only throw schema issues"),c}return i!==ig?i:(n??=c0(e))(s,a)};return t===void 0?o:(s,a)=>o(s,m0(t,a))}function c0(e){return x0(g0(()=>e.decodeEffect,e.ast))}function x0(e){let t=yu(e);return(r,n)=>{let o=t(r,n);if(ut(o))return o.value;let s=Zr(o.cause,"Sync adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}function eK(e,t){let r=wo(e);if(ut(r))return r.value;let n=Zr(r.cause,t);throw new Error("Schema validation failed",{cause:n})}function tK(e){let t,r;return(n,o)=>{t??=en(e);let s=o?.disableChecks?o.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions??Fo,a=t.make;if(a!==void 0&&n!==me){let c;try{c=a(n,s)}catch(f){throw Zr(Yf(f),"Constructor adapter can only throw schema issues"),f}if(c!==ig&&c!==me)return c}let i=(r??=t.makeEffect)(n,s);return eK(h0(i,n),"Constructor adapter can only throw schema issues")}}var rK=e=>en(e).parser,nK=e=>en(e).makeEffect;var mg="~effect/Schema/Schema",u1=Symbol(),oK={[mg]:mg,get make(){let e=fg(this);return Object.defineProperty(this,"make",{value:e,enumerable:!0}),e},get makeEffect(){let e=u0(this);return Object.defineProperty(this,"makeEffect",{value:e,enumerable:!0}),e},get makeOption(){let e=ug(this);return Object.defineProperty(this,"makeOption",{value:e,enumerable:!0}),e},pipe(){return te(this,arguments)},annotate(e){return this.rebuild(Rn(this.ast,e))},annotateKey(e){return this.rebuild(rp(this.ast,e))},check(...e){return this.rebuild(Ro(this.ast,e))},rebuild(e){return Ln(e,this[u1])}};function Ln(e,t){function r(){}let n=Object.setPrototypeOf(r,oK);return t&&(Object.hasOwn(t,"name")||Object.hasOwn(t,"length")||Object.hasOwn(t,"__proto__"))?Object.defineProperties(n,Object.getOwnPropertyDescriptors({...t})):Object.assign(n,t),n[u1]=t,n.ast=e,n}function y0(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function hp(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function S0(e){return encodeURI(y0(e)).replace(/#/g,"%23")}function E0(e){if(e.length===0||e==="#")return"";if(!e.startsWith("#"))return;let t=e.slice(1);try{if(encodeURI(t).replace(/%25/g,"%").replace(/#/g,"%23")!==t)return;let r=decodeURIComponent(t);return r.startsWith("/")&&!/~(?:[^01]|$)/.test(r)?r:void 0}catch{return}}function l1(e){let t=E0(e);return t===void 0?void 0:t.length===0?[]:t.slice(1).split("/").map(hp)}function p1(e){return e.reduce((t,r)=>`${t}/${S0(r)}`,"#")}var aK="http://json-schema.org/draft-07/schema#",d1="https://json-schema.org/draft/2020-12/schema";function m1(e,t){return e===t||e===(t.endsWith("#")?t.slice(0,-1):`${t}#`)}function x1(e){return{dialect:"draft-07",...lK(e,bK)}}function iK(e,t){return r(e,!1,!0);function r(n,o,s=!1){if(!Dr(n))return n;let a=o||!s&&E1(n.$id),i={};for(let c of Object.keys(n)){let f=n[c],u=f;switch(c){case"$defs":case"properties":case"patternProperties":case"dependentSchemas":u=I0(f,l=>r(l,a))??f;break;case"allOf":case"anyOf":case"oneOf":case"prefixItems":u=Array.isArray(f)?f.map(l=>r(l,a)):f;break;case"not":case"additionalProperties":case"propertyNames":case"unevaluatedProperties":case"items":case"contains":case"unevaluatedItems":case"if":case"then":case"else":case"contentSchema":u=r(f,a)}U(i,c,u)}return t(i,a),i}}function y1(e,t){return iK(e,r=>{cK(r,t)})}function cK(e,t){typeof e.$ref=="string"&&U(e,"$ref",t(e.$ref,"$ref")),typeof e.$dynamicRef=="string"&&U(e,"$dynamicRef",t(e.$dynamicRef,"$dynamicRef"))}function I0(e,t){if(!Dr(e))return;let r={};for(let n of Object.keys(e))U(r,n,t(e[n],n));return r}function uK(e,t,r){let n=new Map,o=[],s=b0;function a(p,h=[],g=[]){if(h.length===0&&t?.trackIds){let x=Dr(p)?u(p):void 0;s=h1(x,b0)??b0}return f(p,h,g,{sourceRoot:[],targetRoot:[],uri:s})}function i(){for(let[p,h,g]of o){let x=h,b=S1(h,g);if(b!==void 0){let T=l1(b.hash);if(b.hash="",T!==void 0){let w=n.get(g1(b.href,T));w!==void 0&&(x=fK(h,w))}}U(p,"$ref",x)}}let c=r(a);return i(),c;function f(p,h,g,x){if(typeof p=="boolean")return l(h,g,x),t?.booleanAdapter?.(p)??p;if(!Dr(p))return p;let b=x,T=u(p);if(h.length>0&&t?.trackIds&&E1(T)){let O=h1(T,x.uri);O!==void 0&&(b={parent:x,sourceRoot:h,targetRoot:g,uri:O})}l(h,g,b);let w=b.uri,P={isDocumentRoot:h.length===0,schema(O,d,S=d){return f(O,[...h,d],[...g,S],b)},schemaAt(O,d,S){return f(O,[...h,...d],[...g,...S],b)},schemaArray(O,d,S=d){return Array.isArray(O)?O.map((E,I)=>f(E,[...h,d,String(I)],[...g,S,String(I)],b)):O},schemaMap(O,d,S=d){return Dr(O)?I0(O,(E,I)=>f(E,[...h,d,I],[...g,S,I],b)):O},reference(O,d){typeof d=="string"?o.push([O,d,w]):U(O,"$ref",d)}};return e(p,P)}function u(p){return t?.ignoreRefSiblings===!0&&typeof p.$ref=="string"?void 0:p.$id}function l(p,h,g){g.parent!==void 0&&l(p,h,g.parent),n.set(g1(g.uri,p.slice(g.sourceRoot.length)),h.slice(g.targetRoot.length))}}var b0="https://effect.invalid/.json-schema/";function S1(e,t){return URL.canParse(e,t)?new URL(e,t):void 0}function h1(e,t){if(typeof e!="string")return;let r=S1(e,t);if(r!==void 0)return r.hash="",r.href}function fK(e,t){let r=e.indexOf("#");return r===-1&&t.length===0?e:`${r===-1?e:e.slice(0,r)}${p1(t)}`}function g1(e,t){return`${e}\0${JSON.stringify(t)}`}function E1(e){return typeof e=="string"&&e.length>0&&e[0]!=="#"}function lK(e,t,r){return uK(t,{...r,trackIds:!0},n=>({schema:n(e.schema),definitions:I0(e.definitions,(o,s)=>n(o,["$defs",s],["definitions",s]))}))}var pK=new Set(["properties","patternProperties"]),dK=new Set(["allOf","anyOf","oneOf"]),mK=new Set(["not","additionalProperties","propertyNames","contains","if","then","else","contentSchema"]);function hK(e,t,r,n,o,s=pK){let a;if(s.has(t))a=n.schemaMap(r,t);else if(dK.has(t))a=n.schemaArray(r,t);else if(o.has(t))a=n.schema(r,t);else return!1;return U(e,t,a),!0}var b1=["$anchor","$defs","$dynamicAnchor","$dynamicRef","$vocabulary","contentSchema","dependentRequired","dependentSchemas","maxContains","minContains","prefixItems","unevaluatedItems","unevaluatedProperties"],Ufe=[...b1,"deprecated"],Dfe=[...b1,"$comment","$id","$schema","const","contains","contentEncoding","contentMediaType","else","examples","if","patternProperties","propertyNames","then"],gK=/^[A-Za-z_][-A-Za-z0-9._]*$/,xK=/^[A-Za-z][-A-Za-z0-9._:]*$/;function bi(e,t,r){throw new Error(`Cannot convert JSON Schema keyword "${e}" to ${t}: ${r}`)}function yK(e,t,r,n){for(let o of t)Object.hasOwn(e,o)&&bi(o,r,`it is not active in ${n} but would become active in the target`)}var SK=["additionalItems","definitions","dependencies"];function EK(e,t,r,n,o){r.isDocumentRoot?U(e,"$schema",m1(t,d1)?n:t):m1(t,d1)||bi("$schema",o,"an embedded resource cannot declare a different dialect")}function bK(e,t){yK(e,SK,"Draft-07","Draft 2020-12");let r={},n,o,s;for(let a of Object.keys(e)){let i=e[a];if(!hK(r,a,i,t,mK))switch(a){case"$ref":n=i;break;case"$schema":EK(r,i,t,aK,"Draft-07");break;case"$id":case"$anchor":break;case"$defs":U(r,"definitions",t.schemaMap(i,a,"definitions"));break;case"prefixItems":o=i;break;case"items":s=i;break;case"dependentRequired":case"dependentSchemas":case"minContains":case"maxContains":break;case"$dynamicRef":case"$dynamicAnchor":case"$vocabulary":case"unevaluatedProperties":case"unevaluatedItems":bi(a,"Draft-07","the target dialect has no equivalent");case"required":if(Array.isArray(i)&&i.length===0)break;U(r,a,i);break;default:U(r,a,i)}}if(IK(r,o,s,t),Object.hasOwn(e,"contains")){let a=e.minContains,i=e.maxContains;(a!==void 0&&a!==1||i!==void 0)&&bi("minContains/maxContains","Draft-07","contains cardinality cannot be represented"),Object.hasOwn(e,"minContains")&&U(r,"minContains",a)}else Object.hasOwn(e,"minContains")&&U(r,"minContains",e.minContains),Object.hasOwn(e,"maxContains")&&U(r,"maxContains",e.maxContains);return TK(e,r,t,"draft-07"),kK(e,r,"$id","Draft-07"),CK(r,n,t),r}function IK(e,t,r,n){if(t===void 0){r!==void 0&&U(e,"items",n.schema(r,"items"));return}U(e,"items",n.schemaArray(t,"prefixItems","items")),r!==void 0&&U(e,"additionalItems",n.schema(r,"items","additionalItems"))}function CK(e,t,r){if(t!==void 0)if(typeof t=="string"&&Object.keys(e).length>0){let n={};r.reference(n,t),wK(e,n)}else r.reference(e,t)}function TK(e,t,r,n){let o=Dr(e.dependentRequired)?e.dependentRequired:void 0,s=Dr(e.dependentSchemas)?e.dependentSchemas:void 0;if(o===void 0&&s===void 0)return;let a={},i=new Set([...Object.keys(o??{}),...Object.keys(s??{})]);for(let c of i){let f=o?.[c],u=s?.[c],l=n==="draft-04"&&Array.isArray(f)&&f.length===0;u===void 0?l||U(a,c,f):f===void 0||l?U(a,c,r.schemaAt(u,["dependentSchemas",c],["dependencies",c])):U(a,c,{allOf:[r.schemaAt(u,["dependentSchemas",c],["dependencies",c,"allOf","0"]),{required:f}]})}Object.keys(a).length>0&&U(t,"dependencies",a)}function wK(e,t){Array.isArray(e.allOf)?e.allOf.push(t):U(e,"allOf",[t])}function kK(e,t,r,n){let o=e.$id,s=e.$anchor;if(s===void 0){o!==void 0&&U(t,r,o);return}(typeof s!="string"||!gK.test(s))&&bi("$anchor",n,"the anchor is not valid"),xK.test(s)||bi("$anchor",n,"the anchor cannot be represented as a plain-name fragment identifier"),o===void 0?U(t,r,`#${s}`):bi("$anchor",n,"it cannot be combined with the schema $id")}function hg(e){return Ln(Su(e.ast),{schema:e})}var Su=li(e=>{let t=vK(e,Su),r=e.context;return t===e||r===void 0?t:Lh(t,C0(r))});function C0(e){return e.constructorDefault===void 0?e:new Po(e.isOptional,e.isMutable,void 0,e.annotations)}function T1(e){if(e.propertySignatures.some(t=>typeof t.name!="string"))throw new globalThis.Error("Objects property names must be strings",{cause:e})}function w1(e){return t=>{let r=[...t].sort((o,s)=>e($n(o))-e($n(s)));return r.some((o,s)=>o!==t[s])?r:t}}var AK=w1(e=>{switch(e._tag){case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function vK(e,t){switch(e._tag){case"Declaration":{let r=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!bn(r))return Je(e,[uI]);let n=e.typeParameters.map(s=>Ln($n(s))),o=r(n);return o===void 0?e:Je(e,[fu(o,t)])}case"Unknown":return Je(e,[uI]);case"ObjectKeyword":return Je(e,[wN]);case"Undefined":case"Void":case"Literal":case"Number":return e.toCodecJson();case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return T1(e),e.recur(t,jh);case"Union":{let r=AK(e.types);return r!==e.types?new Or(r,e.options,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t):e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}function gg(e){return Ln(k1(It(e.ast)))}var k1=Sn(e=>{let t=OK(e,k1);return t!==e&&e.context!==void 0?Lh(t,C0(e.context)):t});function OK(e,t){switch(e._tag){case"Declaration":{let r=e.annotations?.toCodecIso??e.annotations?.toCodec;if(bn(r)){let n=r(e.typeParameters.map(o=>Ln(o)));return Je(e,[fu(n,t)])}return e}case"Arrays":case"Objects":case"Union":case"Suspend":return e.recur(t)}return e}function xg(e){return Ln(_1(e.ast),{schema:e})}function A1(e){return Ln(P1(e.ast))}var _K=w1(e=>{switch(e._tag){case"Null":case"Boolean":case"Number":case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function PK(e,t,r){switch(e._tag){case"Declaration":{let n=e.typeParameters.map(f=>Ln(t($n(f)))),o=e.annotations?.toCodecStringTree;if(bn(o)){let f=o(n);return f===void 0?e:Je(e,[fu(f,t)])}let s=e.annotations?.toCodecJson,a=bn(s)?s(n):void 0,i=a===void 0?e.annotations?.toCodec:void 0,c=a??(bn(i)?i(n):void 0);return c===void 0?r(e):Je(e,[fu(c,t)])}case"Null":return Je(e,[FK]);case"Boolean":return Je(e,[RK]);case"Unknown":case"ObjectKeyword":return Je(e,[fI]);case"Enum":case"Number":case"Literal":case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return T1(e),e.recur(t,jh);case"Union":{let n=_K(e.types);return n!==e.types?new Or(n,e.options,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t):e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}var FK=new ft(new Yr("null"),new Ne(le(()=>null),le(()=>"null"))),RK=new ft(new Or([new Yr("true"),new Yr("false")]),new Ne(le(e=>e==="true"),ii())),v1=new Ne(le(e=>typeof e=="string"?[e]:e),_o()),O1=e=>e.transformation===v1,_1=li(e=>{let t=PK(e,_1,r=>{throw new globalThis.Error("Missing structural codec for StringTree",{cause:r})});return t!==e&&e.context!==void 0?Lh(t,C0(e.context)):t},{stopAt:O1}),C1=e=>Gt(e)?pi(ls):ls,P1=li(e=>{let t=$K(e);if(Bb(t)){let r=lu(new Or([new dn(t.isMutable,t.elements.map(C1),t.rest.map(C1)),Qr],{mode:"anyOf"}),t,v1);return Gt(e)?pi(r):r}return t},{stopAt:O1});function $K(e){return e._tag==="Declaration"||e._tag==="Arrays"||e._tag==="Objects"||e._tag==="Union"||e._tag==="Suspend"?e.recur(P1):e}var Bfe=globalThis.RegExp;var ms=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&");function aa(e,t){return t.length>0&&(e+=`
|
|
34
|
+
at ${xd(t)}`),new Error(e)}function F1(e){return`#/$defs/${S0(e)}`}var NK=new Set([...oR,si,...nR]);function xp(e,t){if(e===void 0)return;let r={},n=e.title;typeof n=="string"&&(r.title=n);let o=e.description,s=e.expected;typeof o=="string"?r.description=o:t?.generateDescriptions===!0&&typeof s=="string"&&(r.description=s);let a=e.default;pu(a)&&(r.default=a);let i=e.examples;Array.isArray(i)&&pu(i)&&(r.examples=i);let c=e.readOnly;typeof c=="boolean"&&(r.readOnly=c);let f=e.writeOnly;typeof f=="boolean"&&(r.writeOnly=f);let u=e.format;typeof u=="string"&&(r.format=u);let l=e.contentEncoding;typeof l=="string"&&(r.contentEncoding=l);let p=e.contentMediaType;typeof p=="string"&&(r.contentMediaType=p);let h=e.contentSchema;if(pu(h)&&(r.contentSchema=h),t?.includeAnnotationKey!==void 0)for(let[g,x]of Object.entries(e))NK.has(g)||!t.includeAnnotationKey(g)||pu(x)&&U(r,g,x);return Object.keys(r).length===0?void 0:r}function R1(e){let t=e.type==="number"||e.type==="integer"?e.type:void 0,r=e;if(t!==void 0&&(r={...e},delete r.type),Array.isArray(r.allOf)){let n=[],o=!1;for(let s of r.allOf){let a=R1(s);a.type!==void 0&&(o=!0,(t===void 0||a.type==="integer")&&(t=a.type)),Object.keys(a.schema).length>0&&n.push(a.schema)}if(o){let{allOf:s,...a}=r;r=n.length===0?a:{...a,allOf:n}}}return{type:t,schema:r}}function MK(e){if(!Array.isArray(e.anyOf)||e.anyOf.length!==2||e.anyOf[0]?.type!=="number")return!1;let t=e.anyOf[1];return t?.type==="string"&&Array.isArray(t.enum)&&t.enum.length===3&&t.enum.includes("NaN")&&t.enum.includes("Infinity")&&t.enum.includes("-Infinity")}var $1="|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|";function yg(e,t){return Object.keys(e).every(r=>t.includes(`|${r}|`))}function UK(e,t){return typeof e.$ref!="string"&&t.every(r=>!Object.hasOwn(e,r))}var DK="|minimum|exclusiveMinimum|minLength|minItems|minProperties|",LK="|maximum|exclusiveMaximum|maxLength|maxItems|maxProperties|";function BK(e,t,r){if(typeof e.$ref=="string")return;let n={...e,...t};for(let o of r){if(!Object.hasOwn(e,o))continue;let s=e[o],a=t[o];if(typeof s!="number"||typeof a!="number")return;if(DK.includes(`|${o}|`))n[o]=Math.max(s,a);else if(LK.includes(`|${o}|`))n[o]=Math.min(s,a);else return}return typeof n.minimum=="number"&&typeof n.exclusiveMinimum=="number"&&delete n[n.exclusiveMinimum>=n.minimum?"minimum":"exclusiveMinimum"],typeof n.maximum=="number"&&typeof n.exclusiveMaximum=="number"&&delete n[n.exclusiveMaximum<=n.maximum?"maximum":"exclusiveMaximum"],n}var k0="|title|description|default|examples|readOnly|writeOnly|",jK=$1+k0;function yp(e,t,r){if(Object.keys(e).length===0)return t;let n=Object.keys(t);if(n.length===0)return e;let o=e.type==="number"||e.type==="integer"?e.type:void 0,s=MK(e);if(o!==void 0||s){let i=R1(t);if(i.type!==void 0){let c=o==="integer"||i.type==="integer"?"integer":"number",f={...e,type:c};s&&delete f.anyOf;let u=Object.keys(i.schema);return u.length===0?f:yg(i.schema,k0)&&UK(f,u)?{...f,...i.schema}:yp(f,i.schema,r)}}if(r){let i=BK(e,t,n);if(i!==void 0)return i}let a=Array.isArray(t.allOf)&&n.length===1?t.allOf:[t];return Array.isArray(e.allOf)?{...e,allOf:[...e.allOf,...a]}:typeof e.$ref=="string"?{allOf:[e,...a]}:{...e,allOf:a}}function w0(e,t=new Set){return typeof e=="boolean"?e:t.has(e)?!0:(t.add(e),e.every(r=>w0(r,t)))}function zK(e){return Array.isArray(e)}function qK(e,t,r,n){let o=new Map,s=new Map,a=new WeakMap,i=new Map,c=new Map,f=Object.keys(r);for(let d of f)g(d,["references",d]);let u=Pt(e,(d,S)=>w(d,t[S],[]));for(let[d,S]of i.values())if(!w0(d))for(let E of S)Array.isArray(E.oneOf)&&(E.anyOf=E.oneOf,delete E.oneOf);for(let d of f){let S=r[d],E=b(S);if(E===void 0)continue;let I=o.get(d)[0],k=c.get(E),_=k?.find(M=>W(o.get(M)[0],I));_===void 0?k===void 0?c.set(E,[d]):k.push(d):s.set(d,_)}let l=Pt(u,x),p={};for(let d of f)s.has(d)||U(p,d,x(o.get(d)[0]));return{dialect:"draft-2020-12",schemas:l,definitions:p};function h(d){return Array.isArray(d.oneOf)&&i.get(d.oneOf)?.[1].push(d),d}function g(d,S){if(!Object.hasOwn(r,d))throw aa(`Invalid reference ${d}`,[...S,"$ref"]);let E=o.get(d);if(E!==void 0)return E;let I=[{},[]];return o.set(d,I),I[0]=w(r[d],["references",d],I[1]),I}function x(d){return y1(d,S=>{let E=E0(S);if(E===void 0){if(/^#(?:\/|%2f)/i.test(S))throw new Error(`Invalid JSON Pointer URI fragment ${JSON.stringify(S)}`);return S}if(!E.startsWith("/$defs/"))return S;let I=E.indexOf("/",7),k=s.get(hp(E.slice(7,I<0?void 0:I)));return k===void 0?S:S.replace(/^#(?:\/|%2f).*?(?:\/|%2f).*?(?=\/|%2f|$)/i,F1(k))})}function b(d){if(d._tag==="Reference")return;let S=d.checks.length===0?d.annotations:d.checks[d.checks.length-1].annotations;return typeof S?.identifier!="string"&&typeof S?.[si]=="string"?S[si]:void 0}function T(d,S,E,I){let k=d.annotations,_=k?.toJsonSchema;if(_!==void 0){let ne=d.representation?.schemas?.map((Do,rf)=>w(Do,[...E,"representation","schemas",rf],I))??[],Ee=_({type:S,schemas:ne}),Le=zK(Ee);Le&&I.push(!1);let lt=Le?Ee[0]:Ee,Et=xp(k,n),Cr=Et===void 0?lt:{...lt,...Et},rn=Et===void 0?$1:jK;return[Cr,d._tag==="Filter"&&yg(Cr,rn)&&(Et===void 0||yg(Et,k0))?!0:void 0]}if(d._tag==="Filter"){I.push(!1);return}let M=d.checks.flatMap((ne,Ee)=>{let Le=T(ne,S,[...E,"checks",Ee],I);return Le===void 0?[]:[Le[0]]});if(M.length===0)return;let z=xp(k,n),de={allOf:M};return[z===void 0?de:{...de,...z}]}function w(d,S,E){if(d._tag==="Reference")return E.push(g(d.$ref,S)[1]),{$ref:F1(d.$ref)};let I=a.get(d);if(I!==void 0)return E.push(I[1]),I[0];let k=[];E.push(k);let _=P(d,S,k),M=xp(d.annotations,n);M!==void 0&&(_={..._,...M});for(let z=0;z<d.checks.length;z++){let de=typeof _.type=="string"&&HK(_.type)?_.type:void 0,ne=T(d.checks[z],de,[...S,"checks",z],k);ne!==void 0&&(_=yp(_,...ne))}return a.set(d,[_,k]),h(_)}function P(d,S,E){switch(d._tag){case"Any":case"Unknown":return{};case"ObjectKeyword":return{anyOf:[{type:"object"},{type:"array"}]};case"Void":case"Undefined":case"Null":return{type:"null"};case"BigInt":return{type:"string",allOf:[{pattern:"^-?\\d+$"}]};case"Symbol":return{type:"string",allOf:[{pattern:"^Symbol\\(([\\s\\S]*)\\)$"}]};case"UniqueSymbol":return globalThis.Symbol.keyFor(d.symbol)===void 0?{not:{}}:{type:"string",enum:[globalThis.String(d.symbol)]};case"Declaration":return E.push(!1),{};case"Suspend":return w(d.thunk,[...S,"thunk"],E);case"Never":return{not:{}};case"String":return{type:"string"};case"Number":return{anyOf:[{type:"number"},{type:"string",enum:["NaN","Infinity","-Infinity"]}]};case"Boolean":return{type:"boolean"};case"Literal":{let I=d.literal;return typeof I=="bigint"?{type:"string",enum:[globalThis.String(I)]}:{type:typeof I,enum:[I]}}case"Enum":{let I=d.enums.map(([k,_],M)=>{if(typeof _=="number"&&!globalThis.Number.isFinite(_))throw aa(`Invalid numeric enum value ${globalThis.String(_)}`,[...S,"enums",M,1]);return{type:typeof _,enum:[_],title:k}});return I.length===0?{not:{}}:{anyOf:I}}case"TemplateLiteral":return{type:"string",pattern:`^${d.parts.map(Sg).join("")}$`};case"Arrays":{if(d.rest.length>1)throw aa("Invalid schema representation document",[...S,"rest"]);let I={type:"array"},k=d.elements.length,_=d.elements.map((M,z)=>{M.isOptional&&k--;let de=w(M.type,[...S,"elements",z,"type"],E),ne=xp(M.annotations,n);return ne===void 0?de:h(yp(de,ne))});if(_.length>0?(I.prefixItems=_,I.maxItems=d.elements.length,k>0&&(I.minItems=k)):I.items=!1,d.rest.length===1){delete I.maxItems;let M=w(d.rest[0],[...S,"rest",0],E);Object.keys(M).length>0?I.items=M:delete I.items}return I}case"Objects":{if(d.propertySignatures.length===0&&d.indexSignatures.length===0)return{not:{type:"null"}};let I={type:"object"},k={},_=[];for(let Le=0;Le<d.propertySignatures.length;Le++){let lt=d.propertySignatures[Le];if(typeof lt.name!="string")throw aa("Invalid schema representation document",[...S,"propertySignatures",Le,"name"]);let Et=lt.name,Cr=w(lt.type,[...S,"propertySignatures",Le,"type"],E),rn=xp(lt.annotations,n);U(k,Et,rn===void 0?Cr:h(yp(Cr,rn))),lt.isOptional||_.push(Et)}d.propertySignatures.length>0&&(I.properties=k),_.length>0&&(I.required=_);let M={},z=[],de=[],ne=!1;for(let Le=0;Le<d.indexSignatures.length;Le++){let lt=d.indexSignatures[Le],Et=w(lt.type,[...S,"indexSignatures",Le,"type"],E);W(Et,{not:{}})&&(Et=!1),de.push(Et);let Cr=O(lt.parameter,[...S,"indexSignatures",Le,"parameter"],new Set);if(Cr===void 0){ne=!0,E.push(!1);continue}if(Cr.length===0)z.push(Et);else for(let rn of Cr){let Do=M[rn];U(M,rn,Do===void 0?Et:Do===!1||Et===!1?!1:h(yp(Do,Et)))}}let Ee=Object.keys(M).length>0;if(Ee&&(I.patternProperties=M),ne&&n?.onExcessProperty==="error"){let Le=[];d.propertySignatures.length>0&&Le.push({enum:Object.keys(k)});for(let lt=0;lt<d.indexSignatures.length;lt++)Le.push(w(d.indexSignatures[lt].parameter,[...S,"indexSignatures",lt,"parameter"],E));I.propertyNames=Le.length===1?Le[0]:{anyOf:Le},I.additionalProperties=de.length===1?de[0]:{anyOf:de},z.length>0&&(I.allOf=z.map(lt=>({type:"object",additionalProperties:lt})))}else z.length===0?I.additionalProperties=ne||n?.onExcessProperty!=="error":z.length===1&&d.propertySignatures.length===0&&!Ee?I.additionalProperties=z[0]:z.length>0&&(I.allOf=z.map(Le=>({type:"object",additionalProperties:Le})));return typeof I.additionalProperties=="object"&&I.additionalProperties!==null&&Object.keys(I.additionalProperties).length===0&&delete I.additionalProperties,I}case"Union":{let I=[],k=d.types.map((M,z)=>w(M,[...S,"types",z],I));if(E.push(I),k.length===0)return{not:{}};let _=d.options?.mode??"anyOf";if(_==="anyOf"&&k.length>1){let M=WK(k);if(M!==void 0)return M}return _==="oneOf"&&i.set(k,[I,[]]),{[_]:k}}}}function O(d,S,E){switch(d._tag){case"Reference":{if(!Object.hasOwn(r,d.$ref))throw aa(`Invalid reference ${d.$ref}`,[...S,"$ref"]);if(g(d.$ref,S),E.has(d.$ref))return;let I=new Set(E).add(d.$ref);return O(r[d.$ref],["references",d.$ref],I)}case"String":{if(d.checks.length===0)return[];if(d.checks.length!==1||d.checks[0]._tag!=="Filter"||d.checks[0].annotations?.toJsonSchema===void 0)return;let I=[],k=w(d,S,I);return w0(I)&&k.type==="string"&&typeof k.pattern=="string"&&yg(k,"|type|pattern|title|description|default|examples|readOnly|writeOnly|")?[k.pattern]:void 0}case"TemplateLiteral":return d.checks.length===0?[`^${d.parts.map(Sg).join("")}$`]:void 0;case"Union":{if(d.types.length===0||d.checks.length>0||d.options?.mode==="oneOf")return;let I=[];for(let k=0;k<d.types.length;k++){let _=O(d.types[k],[...S,"types",k],E);if(_===void 0)return;if(_.length===0)return[];I.push(..._)}return I}default:throw aa("Invalid schema representation document",S)}}}function HK(e){return e==="string"||e==="number"||e==="boolean"||e==="array"||e==="object"||e==="null"||e==="integer"}function WK(e){let t,r=[];for(let n of e){if(Object.keys(n).length!==2||n.type===void 0||!Array.isArray(n.enum)||n.enum.length===0)return;if(t===void 0)t=n.type;else if(n.type!==t)return;for(let s of n.enum){if(r.includes(s))return;r.push(s)}}return{type:t,enum:r}}function Sg(e){switch(e._tag){case"Literal":return ms(globalThis.String(e.literal));case"String":return yN;case"Number":return $h;case"TemplateLiteral":return e.parts.map(Sg).join("");case"Union":return`(?:${e.types.map(Sg).join("|")})`;default:throw aa("Invalid schema representation document",[])}}function Eg(e,t){let r=qK([e.representation],[["representation"]],e.references,t);return{dialect:r.dialect,schema:r.schemas[0],definitions:r.definitions}}var VK=({identifier:e})=>e;function Bn(e){return e===void 0?void 0:{annotations:e}}function Sp(e,t){let{references:r,representations:n}=GK([e],t);return{representation:n[0],references:r}}function GK(e,t){let r={},n=new Map,o=new Set,s=new Map,a=new Set;for(let d of e)h(d);let i=t?.referencePolicy??VK;for(let d of s.values())for(let S of d.values()){let E=i({ast:S.ast,occurrences:S.occurrences,identifier:S.identifier});if(E!==void 0){let I=E===S.identifier||!E.endsWith("_")?"_":"";S.reference=f(E,S,I)}else S.isRecursive&&(S.reference=f(`${S.ast._tag}_`,S,""))}return{representations:Pt(e,d=>x(d)),references:r};function f(d,S,E="_"){let I=d,k=0;for(;n.has(I);){if(n.get(I)===S)return I;I=`${d}${E}${++k}`}return n.set(I,S),I}function u(d,S,E){let I=S.fallback;return I!==void 0?nb(d)===I?d:Rn(d,{[si]:I}):E===S.identifier?d:Rn(d,{identifier:E})}function l(d,S){if(!Object.hasOwn(r,d)&&!o.has(d)){o.add(d);let E=b(S);o.delete(d),U(r,d,E)}return{_tag:"Reference",$ref:d}}function p(d){let S=uu(d),E=cu(S),I=Jc(S),k=I===void 0?(S!==d?Jc(d):void 0)??nb(S):void 0;k!==void 0&&(I=`${k}Encoded`);let _=s.get(E);_===void 0&&(_=new Map,s.set(E,_));let M=_.get(I);return M===void 0&&(M={ast:E,identifier:I,fallback:k,occurrences:0,isRecursive:!1,reference:void 0},_.set(I,M)),M}function h(d){let S=p(d),E=S.ast;if(S.occurrences++,a.has(S)){S.isRecursive=!0;return}if(!(S.occurrences>1)){switch(a.add(S),g(E.checks),E._tag){case"Declaration":case"Arrays":case"Objects":case"Union":E.recur(I=>(h(I),I));break;case"TemplateLiteral":E.parts.forEach(h);break;case"Suspend":h(E.thunk());break}a.delete(S)}}function g(d){d?.forEach(S=>{S.annotations?.representation?.schemas?.forEach(E=>h(It(E))),S._tag==="FilterGroup"&&g(S.checks)})}function x(d){let S=p(d),E=S.ast,I=S.reference;if(I!==void 0){let k=S.identifier===void 0?E:u(E,S,I);return l(I,k)}return b(E)}function b(d){let S=T(d.checks);switch(d._tag){case"Declaration":return{_tag:"Declaration",typeParameters:d.typeParameters.map(E=>x(E)),checks:S,...P(d.annotations)};case"Null":case"Undefined":case"Void":case"Never":case"Unknown":case"Any":case"String":case"Boolean":case"Number":case"BigInt":case"Symbol":case"ObjectKeyword":return{_tag:d._tag,checks:S,...Bn(d.annotations)};case"Literal":return{_tag:"Literal",literal:d.literal,checks:S,...Bn(d.annotations)};case"UniqueSymbol":return{_tag:"UniqueSymbol",symbol:d.symbol,checks:S,...Bn(d.annotations)};case"Enum":return{_tag:"Enum",enums:d.enums,checks:S,...Bn(d.annotations)};case"TemplateLiteral":return{_tag:"TemplateLiteral",parts:d.parts.map(E=>x(E)),checks:S,...Bn(d.annotations)};case"Arrays":return{_tag:"Arrays",elements:d.elements.map(E=>{let I=uu(E),k=I.context?.annotations;return{isOptional:Gt(I),type:x(E),...Bn(k)}}),rest:d.rest.map(E=>x(E)),checks:S,...Bn(d.annotations)};case"Objects":return{_tag:"Objects",propertySignatures:d.propertySignatures.map(E=>{let I=uu(E.type),k=I.context?.annotations;return{name:E.name,type:x(E.type),isOptional:Gt(I),isMutable:mN(I),...Bn(k)}}),indexSignatures:d.indexSignatures.map(E=>({parameter:x(E.parameter),type:x(E.type)})),checks:S,...Bn(d.annotations)};case"Union":return{_tag:"Union",types:d.types.map(E=>x(E)),...d.options===void 0?{}:{options:d.options},checks:S,...Bn(d.annotations)};case"Suspend":return{_tag:"Suspend",checks:[],thunk:x(d.thunk()),...Bn(d.annotations)}}}function T(d){return d?.map(w)??[]}function w(d){switch(d._tag){case"Filter":return{_tag:"Filter",aborted:d.aborted,...O(d.annotations)};case"FilterGroup":return{_tag:"FilterGroup",checks:Pt(d.checks,w),...O(d.annotations)}}}function P(d){if(d===void 0)return;let{representation:S,...E}=d;return{...S===void 0?void 0:{representation:S},...Object.keys(E).length===0?void 0:{annotations:E}}}function O(d){if(d===void 0)return;let{representation:S,...E}=d,I=S===void 0?void 0:S.schemas===void 0?S:{...S,schemas:S.schemas.map(k=>x(It(k)))};return{...I===void 0?void 0:{representation:I},...Object.keys(E).length===0?void 0:{annotations:E}}}}function U1(e){return ut(e)?e.value:{issues:[{message:GO(e.cause)}]}}function L1(e,t){let r=St(e),n={errors:"all",...t?.parseOptions},o=pR(t),s=a=>{let i=new La("sync"),c=To(Gs(r(a,n),{onFailure:o,onSuccess:u=>({value:u})}),{scheduler:i});c.currentDispatcher?.flush();let f=c.pollUnsafe();return f?U1(f):new Promise(u=>{c.addObserver(l=>{u(U1(l))})})};if(Object.hasOwn(e,"~standard")){let a=e;return"validate"in a["~standard"]||Object.assign(a["~standard"],{validate:s}),a}return Object.assign(e,{"~standard":{version:1,vendor:"effect",validate:s}})}function KK(e){let t=Sp(Su(e));return Eg(t)}function D1(e,t){let r=KK(e);if(t==="draft-2020-12"){let n=r.schema;return Object.keys(r.definitions).length>0&&(n.$defs=r.definitions),n}else if(t==="draft-07"){let n=x1(r),o=n.schema;return Object.keys(n.definitions).length>0&&(o.definitions=n.definitions),o}throw new globalThis.Error(`Unsupported target: ${t}`)}function B1(e){let t={input(r){return D1(e.ast,r.target)},output(r){return D1(It(e.ast),r.target)}};if(Object.hasOwn(e,"~standard")){let r=e;return"jsonSchema"in r["~standard"]||Object.assign(r["~standard"],{jsonSchema:t}),r}return Object.assign(e,{"~standard":{version:1,vendor:"effect",jsonSchema:t}})}function z1(e,t){let r=[];return A0(e,t,"",r),r}function A0(e,t,r,n){if(!Object.is(e,t)){if(Array.isArray(e)&&Array.isArray(t)){let o=e.length,s=t.length,a=Math.min(o,s);for(let i=0;i<a;i++)A0(e[i],t[i],`${r}/${i}`,n);for(let i=o-1;i>=s;i--)n.push({op:"remove",path:`${r}/${i}`});for(let i=o;i<s;i++)n.push({op:"add",path:`${r}/${i}`,value:t[i]});return}if(bg(e)&&bg(t)){let o=Object.keys(e),s=Object.keys(t),a=Array.from(new Set([...o,...s])).sort();for(let i of a){let c=`${r}/${y0(i)}`,f=Object.hasOwn(e,i),u=Object.hasOwn(t,i);f&&u?A0(e[i],t[i],c,n):!f&&u?n.push({op:"add",path:c,value:t[i]}):n.push({op:"remove",path:c})}return}n.push({op:"replace",path:r,value:t})}}function q1(e,t){let r=t;for(let n of e)r=QK(r,n);return r}function bg(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ZK(e){if(e==="")return[];if(e.charCodeAt(0)!==47)throw new Error(`Invalid JSON Pointer, it must start with "/": ${JSON.stringify(e)}`);return e.split("/").slice(1).map(hp)}function H1(e){if(!/^(0|[1-9]\d*)$/.test(e))throw new Error(`Invalid array index: "${e}"`);return Number(e)}function QK(e,t){if(t.path===""){if(t.op==="remove")throw new Error("Unsupported operation at the root");return t.value}let r=YK(e,t.path);if(r===null)throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`);let{lastToken:n,parent:o,stack:s}=r;if(Array.isArray(o)){if(n==="-"&&t.op!=="add")throw new Error(`"-" is not valid for ${t.op} at "${t.path}".`);let a=n==="-"?o.length:H1(n),i=t.op==="add"?o.length:o.length-1;if(a>i)throw new Error(`Array index out of bounds at "${t.path}".`);let c=o.slice();return t.op==="add"?c.splice(a,0,t.value):t.op==="remove"?c.splice(a,1):c[a]=t.value,j1(s,c)}if(bg(o)){if(t.op!=="add"&&!Object.hasOwn(o,n))throw new Error(`Property "${n}" does not exist at "${t.path}".`);let a={...o};return t.op==="remove"?delete a[n]:U(a,n,t.value),j1(s,a)}throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`)}function YK(e,t){let r=ZK(t);if(r.length===0)return null;let n=r[r.length-1],o=[],s=e;for(let a=0;a<r.length-1;a++){let i=r[a];if(Array.isArray(s)){let c=H1(i);if(c>=s.length)return null;o.push({container:s,token:c}),s=s[c];continue}if(bg(s)){if(!Object.hasOwn(s,i))return null;o.push({container:s,token:i}),s=s[i];continue}return null}return{stack:o,parent:s,lastToken:n}}function j1(e,t){let r=t;for(let n=e.length-1;n>=0;n--){let{container:o,token:s}=e[n];if(Array.isArray(o)){let a=o.slice();a[s]=r,r=a}else{let a={...o};U(a,s,r),r=a}}return r}function V1(e){let t=hg(e),r=pg(t),n=lg(t);return{empty:[],diff:(o,s)=>z1(r(o),r(s)),combine:(o,s)=>[...o,...s],patch:(o,s)=>{let a=r(o),i=q1(s,a);return Object.is(i,a)?o:n(i)}}}function G1(e,t){let r=Jc(e.ast)??ob(e.ast),n=r1(xg(e));return o=>n(o).pipe(re(s=>eJ(s,{rootName:r,...t})))}function eJ(e,t){let r=t.rootName??"root",n=t.arrayItemName??"item",o=t.pretty??!0,s=t.indent??" ",a=t.sortKeys??!0,i=new Set,c=[];return u(r,e,0),c.join(o?`
|
|
35
|
+
`:"");function f(l,p){c.push(o?s.repeat(l)+p:p)}function u(l,p,h,g){let{attrs:x,safe:b}=Eu.tagInfo(l,g);if(p===void 0)f(h,`<${b}${x}/>`);else if(typeof p=="string")f(h,`<${b}${x}>${Eu.escapeText(p)}</${b}>`);else if(typeof p!="object"||p===null)f(h,`<${b}${x}>${Eu.escapeText(N(p))}</${b}>`);else{if(i.has(p))throw new globalThis.Error("Cycle detected while serializing to XML.",{cause:p});i.add(p);try{if(globalThis.Array.isArray(p)){if(p.length===0){f(h,`<${b}${x}/>`);return}f(h,`<${b}${x}>`);for(let P of p)u(n,P,h+1);f(h,`</${b}>`);return}let T=p,w=Object.keys(T);if(a&&w.sort(),w.length===0){f(h,`<${b}${x}/>`);return}f(h,`<${b}${x}>`);for(let P of w)u(Eu.parseTagName(P).safe,T[P],h+1,P);f(h,`</${b}>`)}finally{i.delete(p)}}}}var Eu={escapeText(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},escapeAttribute(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},parseTagName(e){let t=e,r=e;return/^[A-Za-z_]/.test(r)||(r="_"+r),r=r.replace(/[^A-Za-z0-9._-]/g,"_"),/^xml/i.test(r)&&(r="_"+r),{safe:r,changed:r!==t}},tagInfo(e,t){let{changed:r,safe:n}=Eu.parseTagName(e),s=r||t&&t!==e?` data-name="${Eu.escapeAttribute(t??e)}"`:"";return{safe:n,attrs:s}}};var v0=Sn(e=>ia(e));function ia(e){let t=us(e)?.toEquivalence;if(t)return t(au(e)?e.typeParameters.map(ia):[]);switch(e._tag){case"Never":return Fa();case"Declaration":return rJ(e);case"Null":case"Undefined":case"Void":case"Unknown":case"Any":case"String":case"Number":case"Boolean":case"BigInt":case"Symbol":case"Literal":case"UniqueSymbol":case"ObjectKeyword":case"Enum":case"TemplateLiteral":return W;case"Arrays":{let r=e.elements.map(ia),n=e.rest.map(ia),[o,...s]=n,a=s.length;return gr((i,c)=>{if(!Array.isArray(i)||!Array.isArray(c))return!1;let f=i.length;if(f!==c.length)return!1;let u=0;for(;u<Math.min(f,e.elements.length);u++)if(!r[u](i[u],c[u]))return!1;if(n.length>0){for(;u<f-a;u++)if(!o(i[u],c[u]))return!1;for(let l=0;l<a;l++)if(!s[l](i[u+l],c[u+l]))return!1}return!0})}case"Objects":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return W;let r=e.propertySignatures.map(o=>ia(o.type)),n=e.indexSignatures.map(o=>ia(o.type));return gr((o,s)=>{if(!Dr(o)||!Dr(s))return!1;for(let a=0;a<r.length;a++){let i=e.propertySignatures[a],c=i.name,f=Object.hasOwn(o,c),u=Object.hasOwn(s,c);if(Gt(i.type)&&f!==u||f&&u&&!r[a](o[c],s[c]))return!1}for(let a=0;a<n.length;a++){let i=e.indexSignatures[a],c=ta(o,i.parameter),f=ta(s,i.parameter);if(c.length!==f.length)return!1;for(let u=0;u<c.length;u++){let l=c[u];if(!Object.hasOwn(s,l)||!n[a](o[l],s[l]))return!1}}return!0})}case"Union":{let r=It(e).types,n=Xl(r),o=r.map((s,a)=>[mp(s),ia(e.types[a])]);return gr((s,a)=>{let i=n(s,!1);for(let c=0;c<i.length;c++){let[f,u]=o[i[c]];if(f(s)&&f(a))return u(s,a)}return!1})}case"Suspend":{let r;return gr((n,o)=>(r??=v0(e.thunk()))(n,o))}}}function rJ(e){let t=e.annotations?.representation;if(t===void 0)return W;switch(t.id){case"effect/schema/Option":{let[r]=Ii(e);return(n,o)=>n._tag===o._tag&&(n._tag==="None"||r(n.value,o.value))}case"effect/schema/Result":{let[r,n]=Ii(e);return(o,s)=>o._tag===s._tag&&(o._tag==="Success"?r(o.success,s.success):n(o.failure,s.failure))}case"effect/schema/CauseReason":{let[r,n]=Ii(e);return J1(r,n)}case"effect/schema/Cause":{let[r,n]=Ii(e);return K1(r,n)}case"effect/schema/Exit":{let[r,n,o]=Ii(e),s=K1(n,o);return(a,i)=>a._tag===i._tag&&(a._tag==="Success"?r(a.value,i.value):s(a.cause,i.cause))}case"effect/schema/ReadonlyMap":{let[r,n]=Ii(e);return gd(r,n)}case"effect/schema/ReadonlySet":return pf(Ii(e)[0]);case"effect/schema/RegExp":return(r,n)=>r.source===n.source&&r.flags===n.flags;case"effect/schema/URL":return(r,n)=>r.toString()===n.toString();default:return W}}function Ii(e){return e.typeParameters.map(ia)}function J1(e,t){return(r,n)=>{if(r._tag!==n._tag)return!1;switch(r._tag){case"Fail":return e(r.error,n.error);case"Die":return t(r.defect,n.defect);case"Interrupt":return r.fiberId===n.fiberId}}}function K1(e,t){let r=Id(J1(e,t));return(n,o)=>r(n.reasons,o.reasons)}function Q1(e,t){return r=>{switch(r._tag){case"Fail":return`Fail(${e(r.error)})`;case"Die":return`Die(${t(r.defect)})`;case"Interrupt":return"Interrupt"}}}function Z1(e,t){let r=Q1(e,t);return n=>`Cause([${n.reasons.map(r).join(", ")}])`}function Y1(e,t){let r=new Map;return n(e);function n(a){let i=r.get(a);return i===void 0&&(i=o(a),r.set(a,i)),i}function o(a){let i=us(a)?.toFormatter;if(typeof i=="function")return i(au(a)?a.typeParameters.map(n):[]);if(t?.onBefore){let c=t.onBefore(a,n);if(c!==void 0)return c}return s(a)}function s(a){switch(a._tag){default:return N;case"Never":return()=>"never";case"Void":return()=>"void";case"Declaration":{let i=a.annotations?.representation;if(i===void 0)return N;let c=a.typeParameters.map(n);switch(i.id){case"effect/schema/Option":{let[f]=c;return Re({onNone:()=>"none()",onSome:u=>`some(${f(u)})`})}case"effect/schema/Result":{let[f,u]=c;return xr({onSuccess:l=>`success(${f(l)})`,onFailure:l=>`failure(${u(l)})`})}case"effect/schema/CauseReason":return Q1(c[0],c[1]);case"effect/schema/Cause":return Z1(c[0],c[1]);case"effect/schema/Exit":{let[f,u,l]=c,p=Z1(u,l);return h=>{switch(h._tag){case"Success":return`Exit.Success(${f(h.value)})`;case"Failure":return`Exit.Failure(${p(h.cause)})`}}}case"effect/schema/ReadonlyMap":{let[f,u]=c;return l=>{let p=l.size;if(p===0)return"ReadonlyMap(0) {}";let h=globalThis.Array.from(l.entries()).sort().map(([g,x])=>`${f(g)} => ${u(x)}`);return`ReadonlyMap(${p}) { ${h.join(", ")} }`}}case"effect/schema/HashMap":{let[f,u]=c;return l=>{let p=EM(l);if(p===0)return"HashMap(0) {}";let h=fp(l).sort().map(([g,x])=>`${f(g)} => ${u(x)}`);return`HashMap(${p}) { ${h.join(", ")} }`}}case"effect/schema/ReadonlySet":{let[f]=c;return u=>{let l=u.size;if(l===0)return"ReadonlySet(0) {}";let p=globalThis.Array.from(u.values()).sort().map(h=>`${f(h)}`);return`ReadonlySet(${l}) { ${p.join(", ")} }`}}case"effect/schema/HashSet":{let[f]=c;return u=>{let l=wM(u);if(l===0)return"HashSet(0) {}";let p=globalThis.Array.from(u).sort().map(h=>`${f(h)}`);return`HashSet(${l}) { ${p.join(", ")} }`}}case"effect/schema/Chunk":{let[f]=c;return u=>{let l=KP(u);if(l===0)return"Chunk(0) {}";let p=globalThis.Array.from(u).sort().map(h=>`${f(h)}`);return`Chunk(${l}) { ${p.join(", ")} }`}}default:return N}}case"Arrays":{let i=a.elements.map(p=>n(p)),c=a.rest.map(n),[f,...u]=c,l=u.length;return p=>{let h=[],g=0;for(;g<i.length;g++)if(p.length<g+1){if(Gt(a.elements[g]))continue}else h.push(i[g](p[g]));if(c.length>0){for(;g<p.length-l;g++)h.push(f(p[g]));for(let x=0;x<l;x++)h.push(u[x](p[g+x]))}return"["+h.join(", ")+"]"}}case"Objects":{let i=a.propertySignatures.map(f=>n(f.type)),c=a.indexSignatures.map(f=>n(f.type));return a.propertySignatures.length===0&&a.indexSignatures.length===0?N:f=>{let u=[],l=new Set;for(let p=0;p<i.length;p++){let h=a.propertySignatures[p],g=h.name;l.add(g),!(Gt(h.type)&&!Object.hasOwn(f,g))&&u.push(`${Yn(g)}: ${i[p](f[g])}`)}for(let p=0;p<c.length;p++){let h=ta(f,a.indexSignatures[p].parameter);for(let g of h)l.has(g)||(l.add(g),u.push(`${Yn(g)}: ${c[p](f[g])}`))}return u.length>0?"{ "+u.join(", ")+" }":"{}"}}case"Union":{let i=It(a).types,c=Xl(i),f=i.map((u,l)=>[mp(u),n(a.types[l])]);return u=>{let l=c(u,!1);for(let p=0;p<l.length;p++){let[h,g]=f[l[p]];if(h(u))return g(u)}return N(u)}}case"Suspend":{let i;return c=>(i??=n(a.thunk()))(c)}}}}var O0=m(2,(e,t)=>F0(e,(r,n)=>eU(t,r)?[r,n]:void 0)),_0=m(2,(e,t)=>F0(e,(r,n)=>eU(t,r)?void 0:[r,n])),X1=m(2,(e,t)=>({...e,...t}));var P0=m(2,(e,t)=>F0(e,(r,n)=>[Object.hasOwn(t,r)?t[r]:r,n]));var pr=e=>e;function eU(e,t){return e.some(r=>r===t||typeof r=="number"&&String(r)===t)}function F0(e,t){let r={};for(let n of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;let o=t(n,e[n]);if(o){let[s,a]=o;U(r,s,a)}}return r}function nU(e,t){return jn(bu("Iso",e,t))}function tU(e,t){return jn(bu("Lens",e,t))}function bu(e,t,r){return[{_tag:"PrimitiveNode",kind:e,get:t,set:r}]}var sJ={kind:"Iso",get:F,set:F},Ig=class{_tag="PathNode";kind="Lens";path;get;set;constructor(t){this.path=t,this.get=r=>{let n=r;for(let o=0;o<t.length;o++)n=n[t[o]];return n},this.set=(r,n)=>{let o=Cg(n),s=o,a=0;for(;a<t.length-1;a++){let i=t[a];U(s,i,Cg(s[i])),s=s[i]}return U(s,t[a],r),o}}},Ep=class{_tag="CheckNode";kind="Prism";checks;get;set=F;constructor(t){this.checks=t,this.get=r=>bN(t,r)}};function Ci(e,t){if(e.length===0)return t;if(t.length===0)return e;let r=e.slice();for(let n=0;n<t.length;n++){let o=t[n],s=r[r.length-1];s._tag==="PathNode"&&o._tag==="PathNode"?r[r.length-1]=new Ig([...s.path,...o.path]):s._tag==="CheckNode"&&o._tag==="CheckNode"?r[r.length-1]=new Ep([...s.checks,...o.checks]):r.push(o)}return r}function aJ(e,t){return jn(bu("Optional",e,t))}var Iu=class{node;getResult;replaceResult;constructor(t,r,n){this.node=t,this.getResult=r,this.replaceResult=n}replace(t,r){return Tf(this.replaceResult(t,r),()=>r)}modify(t){return r=>Tf(_t(this.getResult(r),n=>this.replaceResult(t(n),r)),()=>r)}compose(t){return jn(Ci(this.node,t.node))}key(t){return jn(Ci(this.node,[new Ig([t])]))}optionalKey(t){return jn(Ci(this.node,bu("Lens",r=>r[t],(r,n)=>{let o=Cg(n);return r===void 0?Array.isArray(o)&&(typeof t=="number"||typeof t=="string"&&nc(t))?o.splice(Number(t),1):delete o[t]:U(o,t,r),o})))}check(...t){return jn(Ci(this.node,[new Ep(t)]))}refine(t,r){return jn(Ci(this.node,[new Ep([Dh(t,r)])]))}tag(t){let r=Z(new ce({expected:`${JSON.stringify(t)} tag`}));return jn(Ci(this.node,bu("Prism",n=>n._tag===t?H(n):r,F)))}at(t,...r){let n=Z(new kt([t],new ea(void 0)));return jn(Ci(this.node,bu("Optional",o=>Object.hasOwn(o,t)?H(o[t]):n,(o,s)=>{if(Object.hasOwn(s,t)){let a=Cg(s);return U(a,t,o),H(a)}else return n})))}pick(t){return this.compose(tU(O0(t),(r,n)=>({..._0(n,t),...r})))}omit(t){return this.compose(tU(_0(t),(r,n)=>({...O0(n,t),...r})))}notUndefined(){return this.refine(pt,{expected:"a value other than `undefined`"})}forEach(t){let r=t(Tg());return aJ(n=>Nt(this.getResult(n),o=>{let s=[];for(let a=0;a<o.length;a++){let i=r.getResult(o[a]);Tt(i)&&s.push(i.success)}return s}),(n,o)=>_t(this.getResult(o),s=>{let a=[];for(let c=0;c<s.length;c++)Tt(r.getResult(s[c]))&&a.push(c);if(n.length!==a.length)return Z(new ce({message:`each: replacement length mismatch: ${n.length} !== ${a.length}`}));let i=s.slice();for(let c=0;c<a.length;c++){let f=a[c],u=r.replaceResult(n[c],s[f]);if(Se(u))return Z(new kt([f],u.failure));i[f]=u.success}return this.replaceResult(i,o)}))}modifyAll(t){return r=>Tf(_t(this.getResult(r),n=>this.replaceResult(n.map(t),r)),()=>r)}},$0=class extends Iu{get;set;constructor(t,r,n){super(t,o=>H(r(o)),o=>H(n(o))),this.get=r,this.set=n}replace(t,r){return this.set(t)}modify(t){return r=>this.set(t(this.get(r)))}},N0=class extends Iu{get;constructor(t,r,n){super(t,o=>H(r(o)),(o,s)=>H(n(o,s))),this.get=r,this.replace=n}modify(t){return r=>this.replace(t(this.get(r)),r)}},M0=class extends Iu{set;constructor(t,r,n){super(t,r,(o,s)=>H(n(o))),this.set=n}replace(t,r){return this.set(t)}modify(t){return r=>Tf(Nt(this.getResult(r),n=>this.set(t(n))),()=>r)}};function jn(e){let t=e[0]??sJ;if(e.length>1){let r=e.reduce((n,o)=>uJ(n,o.kind),"Iso");t={kind:r,get:iJ(e,r),set:cJ(e,r)}}switch(t.kind){case"Iso":return new $0(e,t.get,t.set);case"Lens":return new N0(e,t.get,t.set);case"Prism":return new M0(e,t.get,t.set);case"Optional":return new Iu(e,t.get,t.set)}}function Cg(e){if(Array.isArray(e))return e.slice();if(typeof e=="object"&&e!==null){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)throw new Error("Cannot clone object with non-Object constructor or null prototype");return{...e}}return e}function iJ(e,t){return r=>{for(let n=0;n<e.length;n++){let o=e[n],s=o.get(r);if(U0(o.kind)){if(Se(s))return s;r=s.success}else r=s}return U0(t)?H(r):r}}function cJ(e,t){return rU(t)?r=>{for(let n=e.length-1;n>=0;n--)r=e[n].set(r);return r}:(r,n)=>{let o=e.length,s=new Array(o);for(let a=0;a<o;a++){s[a]=n;let i=e[a];if(U0(i.kind)){let c=i.get(n);if(Se(c))return c;n=c.success}else n=i.get(n)}for(let a=o-1;a>=0;a--){let i=e[a];if(rU(i.kind))r=i.set(r);else if(i.kind==="Lens")r=i.set(r,s[a]);else{let c=i.set(r,s[a]);if(Se(c))return c;r=c.success}}return t==="Optional"?H(r):r}}function U0(e){return e==="Prism"||e==="Optional"}function rU(e){return e==="Iso"||e==="Prism"}function uJ(e,t){return e==="Iso"?t:t==="Iso"||e===t?e:"Optional"}var fJ=jn([]);function Tg(){return fJ}function sU(e){let t=gg(e);return nU(pg(t),lg(t))}function aU(e){return Tg()}function iU(e){return Tg()}var Cu="~effect/Schema/SchemaError";function cU(e){return A(e,Cu)&&e[Cu]===Cu}var tn="~effect/net/NetAddress";var zn=e=>e.value,qn=e=>e,hs=e=>e.bytes,hn=class extends an("NetAddressError"){},Tu=e=>A(e,tn),Kt=e=>Tu(e)&&e._tag==="Ipv4Address",gn=e=>Tu(e)&&e._tag==="Ipv6Address",D0=e=>Kt(e)||gn(e),wu=e=>Kt(e)?32:128;var ku=e=>Tu(e)&&e._tag==="MacAddress",Ip=e=>Tu(e)&&e._tag==="InetAddressV4",Cp=e=>Tu(e)&&e._tag==="InetAddressV6",L0=e=>Ip(e)||Cp(e),wg=e=>Tu(e)&&e._tag==="UnixPathAddress",uU=e=>L0(e)||wg(e),pJ={...mt,_tag:"Ipv4Address",[tn]:tn,[X](e){return Kt(e)&&zn(this)===zn(e)},[Y](){return Lt(ae(gJ,zn(this)|0))},toString(){return Jt(this)},toJSON(){return this.toString()}},dJ={...mt,_tag:"Ipv6Address",[tn]:tn,[X](e){if(!gn(e))return!1;let t=qn(this),r=qn(e);return t.w0===r.w0&&t.w1===r.w1&&t.w2===r.w2&&t.w3===r.w3},[Y](){let e=qn(this),t=ae(xJ,e.w0|0);return t=ae(t,e.w1|0),t=ae(t,e.w2|0),Lt(ae(t,e.w3|0))},toString(){return Jt(this)},toJSON(){return this.toString()}},mJ={...mt,_tag:"MacAddress",[tn]:tn,[X](e){return ku(e)&&hJ(hs(this),hs(e))},[Y](){return ae(yJ,Qn(hs(this)))},toString(){return z0(this)},toJSON(){return this.toString()}},hJ=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},gJ=Ae("Ipv4Address"),xJ=Ae("Ipv6Address"),yJ=Ae("MacAddress"),SJ=e=>{let t=Object.create(pJ);return t.value=e>>>0,Object.freeze(t)},EJ=(e,t,r,n)=>{let o=Object.create(dJ);return o.w0=e>>>0,o.w1=t>>>0,o.w2=r>>>0,o.w3=n>>>0,Object.freeze(o)},bJ=(e,t,r,n)=>(e<<24|t<<16|r<<8|n)>>>0;var bp=e=>[e>>>24,e>>>16&255,e>>>8&255,e&255],IJ=e=>{let t=Object.assign(Object.create(mJ),{bytes:new Uint8Array(e)});return Object.freeze(t)};var st=(e,t)=>Z(new hn({input:e,message:t})),fU=(e,t)=>{for(let r=0;r<e.length;r++){let n=e[r];if(!Number.isInteger(n)||n<0||n>t)return!1}return!0},CJ=e=>fU(e,255)?H(SJ(bJ(e[0],e[1],e[2],e[3]))):st(e,"octets must be integers from 0 through 255"),TJ=e=>fU(e,65535)?H(EJ(e[0]*65536+e[1],e[2]*65536+e[3],e[4]*65536+e[5],e[6]*65536+e[7])):st(e,"segments must be integers from 0 through 65535");var lU=e=>/^(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/.test(e)?H(IJ(new Uint8Array(e.split(":").map(t=>Number.parseInt(t,16))))):st(e,"expected six two-digit hexadecimal octets separated by colons");var Ti=e=>{let t=e.split(".");if(t.length!==4||t.some(n=>!/^\d{1,3}$/.test(n)))return st(e,"expected exactly four decimal octets");if(t.some(n=>n.length>1&&n[0]==="0"))return st(e,"leading zeroes are not allowed");let r=t.map(Number);return r.some(n=>n>255)?st(e,"octets must be at most 255"):CJ([r[0],r[1],r[2],r[3]])},wJ=e=>{if(e.includes("[")||e.includes("]")||e.includes("%"))return st(e,"brackets and zone identifiers are not valid in a bare IPv6 address");let t=e.split("::");if(t.length>2)return st(e,"only one compression marker is allowed");let r=t[0]===""?[]:t[0].split(":"),n=t.length===2&&t[1]!==""?t[1].split(":"):[];if(r.some(u=>u==="")||n.some(u=>u===""))return st(e,"empty segments are only valid in the compression marker");let o=n.length>0?n[n.length-1]:r.length>0?r[r.length-1]:"",s;if(o.includes(".")){if(t.length===2&&n.length===0)return st(e,"embedded IPv4 syntax must be trailing");let u=Nt(Ti(o),l=>{let p=zn(l);return[p>>>16,p&65535]});if(Se(u))return u;s=u.success,n.length>0?n.pop():r.pop()}let a=r.length+n.length+(s?2:0);if(t.length===1?a!==8:a>=8)return st(e,t.length===1?"expected eight segments":"compression must replace at least one segment");let i=u=>/^[0-9a-fA-F]{1,4}$/.test(u)?Number.parseInt(u,16):void 0,c=r.map(i),f=n.map(i);return c.some(u=>u===void 0)||f.some(u=>u===void 0)?st(e,"segments must contain one through four hexadecimal digits"):H([...c,...Array(8-a).fill(0),...f,...s??[]])},wi=e=>_t(wJ(e),t=>TJ(t)),ca=e=>e.includes(":")?wi(e):Ti(e);var B0=e=>{if(typeof e!="string"||!e.includes("%"))return!1;let t=Tp(e);return Tt(t)&&t.success===e},Tp=e=>{let t=e.indexOf("%");if(t===-1)return st(e,"expected an IPv6 zone");let r=e.slice(t+1);if(r.length===0||/[%[\]/\s\p{Cc}]/u.test(r))return st(e,"invalid IPv6 scope identifier");if(/^\d+$/.test(r)){let n=Number(r);if(n>4294967295)return st(e,"scope identifier must be an unsigned 32-bit integer");r=String(n)}return Nt(wi(e.slice(0,t)),n=>`${Jt(n)}%${r}`)};var kg=e=>bp(zn(e)),kJ=e=>{let{w0:t,w1:r,w2:n,w3:o}=qn(e);return[t>>>16,t&65535,r>>>16,r&65535,n>>>16,n&65535,o>>>16,o&65535]},j0=e=>{let{w0:t,w1:r,w2:n,w3:o}=qn(e);return[...bp(t),...bp(r),...bp(n),...bp(o)]};var z0=e=>Array.from(hs(e),t=>t.toString(16).padStart(2,"0")).join(":"),Ag=e=>hs(e).every(t=>t===255),AJ=e=>(hs(e)[0]&1)!==0,vg=e=>(hs(e)[0]&1)===0,q0=e=>(hs(e)[0]&2)!==0,H0=e=>(hs(e)[0]&2)===0;var Jt=e=>{if(Kt(e))return kg(e).join(".");let t=kJ(e);if(vJ(e))return`::ffff:${t[6]>>8}.${t[6]&255}.${t[7]>>8}.${t[7]&255}`;let r=-1,n=0,o=-1;for(let i=0;i<=8;i++)i<8&&t[i]===0?o===-1&&(o=i):o!==-1&&(i-o>n&&(r=o,n=i-o),o=-1);if(n<2)return t.map(i=>i.toString(16)).join(":");let s=t.slice(0,r).map(i=>i.toString(16)).join(":"),a=t.slice(r+n).map(i=>i.toString(16)).join(":");return`${s}::${a}`},Og=e=>{if(Kt(e))return zn(e)===0;let{w0:t,w1:r,w2:n,w3:o}=qn(e);return t===0&&r===0&&n===0&&o===0},W0=e=>{if(Kt(e))return zn(e)>>>24===127;let{w0:t,w1:r,w2:n,w3:o}=qn(e);return t===0&&r===0&&n===0&&o===1},Au=e=>ku(e)?AJ(e):Kt(e)?zn(e)>>>28===14:qn(e).w0>>>24===255,_g=e=>ku(e)?Ag(e):zn(e)===4294967295,V0=e=>ku(e)?vg(e):!Au(e)&&!Og(e)&&(!Kt(e)||!_g(e)),G0=e=>Kt(e)?zn(e)>>>16===43518:(qn(e).w0>>>16&65472)===65152,K0=e=>{let t=zn(e);return t>>>24===10||(t>>>16&65520)===44048||t>>>16===49320},J0=e=>(qn(e).w0>>>24&254)===252,vJ=e=>{let{w0:t,w1:r,w2:n}=qn(e);return t===0&&r===0&&n===65535};var OJ={...mt,_tag:"InetAddressV4",[tn]:tn,[X](e){return Ip(e)&&this.port===e.port&&W(this.address,e.address)},[Y](){return ae(q(this.address),dt(this.port))},toString(){return Pg(this)},toJSON(){return this.toString()}},_J={...mt,_tag:"InetAddressV6",[tn]:tn,[X](e){return Cp(e)&&this.port===e.port&&this.scopeId===e.scopeId&&W(this.address,e.address)},[Y](){return ae(ae(q(this.address),dt(this.port)),dt(this.scopeId))},toString(){return Pg(this)},toJSON(){return this.toString()}},pU=e=>Number.isInteger(e)&&e>=0&&e<=65535,PJ=(e,t)=>{if(!pU(t))return st(e,"port must be an integer from 0 through 65535");let r=Object.create(OJ);return r.address=e,r.port=t,H(Object.freeze(r))},FJ=(e,t,r)=>{if(!pU(t))return st(e,"port must be an integer from 0 through 65535");let n=r?.scopeId??0;if(!Number.isInteger(n)||n<0||n>4294967295)return st(e,"scopeId must be an unsigned 32-bit integer");let o=Object.create(_J);return o.address=e,o.port=t,o.scopeId=n,H(Object.freeze(o))};var Z0=e=>{let t,r,n=0,o=e.startsWith("[");if(o){let s=e.indexOf("]");if(s<0||e[s+1]!==":"||e.indexOf("]",s+1)!==-1)return st(e,"expected [IPv6]:port");t=e.slice(1,s),r=e.slice(s+2);let a=t.indexOf("%");if(a!==-1){let i=t.slice(a+1);if(t.indexOf("%",a+1)!==-1||!/^\d+$/.test(i))return st(e,"scope identifier must be decimal");if(n=Number(i),!Number.isInteger(n)||n>4294967295)return st(e,"scope identifier must be an unsigned 32-bit integer");t=t.slice(0,a)}}else{let s=e.lastIndexOf(":");if(s<0)return st(e,"expected host:port or [IPv6]:port");if(e.indexOf(":")!==s)return st(e,"IPv6 addresses must be bracketed");t=e.slice(0,s),r=e.slice(s+1)}return/^(0|[1-9]\d*)$/.test(r)?_t(ca(t),s=>o!==gn(s)?st(e,"only IPv6 addresses use brackets"):gn(s)?FJ(s,Number(r),{scopeId:n}):PJ(s,Number(r))):st(e,"port must be an unpadded decimal integer")};var RJ=e=>Jt(e.address)+(Cp(e)&&e.scopeId!==0?`%${e.scopeId}`:"");var Pg=e=>{let t=RJ(e);return Ip(e)?`${t}:${e.port}`:`[${t}]:${e.port}`};var $J={...mt,_tag:"UnixPathAddress",[tn]:tn,[X](e){return wg(e)&&this.path===e.path},[Y](){return ae(Ae("UnixPathAddress"),Ae(this.path))},toString(){return this.path},toJSON(){return this.toString()}},dU=e=>{let t=Object.create($J);return t.path=e,Object.freeze(t)};var Q0="~effect/net/Host",ua=(e,t)=>Z(new hn({input:e,message:t})),NJ=/^[a-z0-9_.-]$/i,MJ=/^[a-z0-9_](?:[a-z0-9_-]{0,61}[a-z0-9_])?$/,UJ=/^(?:\d+|0x[0-9a-f]*)$/,mU=e=>{if(e===".")return;let t=e.endsWith(".")?e.slice(0,-1):e;if(t.length===0)return"domain name must not be empty";if(t.length>253)return"domain name must be at most 253 characters";let r=t.split(".");for(let n of r){if(n.length===0)return"domain name labels must not be empty";if(n.length>63)return"domain name labels must be at most 63 characters";if(!MJ.test(n))return"domain name labels must contain only letters, digits, hyphens, or underscores and must not start or end with a hyphen"}if(UJ.test(r[r.length-1]))return"the last domain name label must not be numeric"},DJ=e=>{let t=!0;for(let r of e)if(r.charCodeAt(0)<128){if(!NJ.test(r))return}else t=!1;if(t)return e.toLowerCase();try{return new URL(`http://${e}`).hostname}catch{return}},gs=e=>typeof e=="string"&&/^[a-z0-9_.-]+$/.test(e)&&mU(e)===void 0;var X0=e=>A(e,Q0),Fg=e=>{let t=DJ(e);if(t===void 0)return ua(e,"invalid domain name");let r=mU(t);return r===void 0?H(t):ua(e,r)};var LJ=e=>{if(e.includes("%"))return Tp(e);if(e.includes(":"))return ca(e);if(/^[\d.]+$/.test(e)){let t=ca(e);if(Tt(t))return t}return Fg(e)};var BJ=e=>typeof e=="string"?e:Jt(e);var jJ={...mt,_tag:"HostPort",[Q0]:Q0,[X](e){return X0(e)&&this.port===e.port&&W(this.host,e.host)},[Y](){return ae(q(this.host),dt(this.port))},toString(){return eC(this)},toJSON(){return this.toString()}},zJ=e=>Number.isInteger(e)&&e>=0&&e<=65535,qJ=(e,t)=>{let r=Object.create(jJ);return r.host=e,r.port=t,Object.freeze(r)};var hU=e=>{let t,r;if(e.startsWith("[")){let o=e.indexOf("]");if(o===-1||e[o+1]!==":")return ua(e,"expected [IPv6]:port");if(t=e.slice(1,o),r=e.slice(o+2),!t.includes(":"))return ua(e,"only IPv6 addresses use brackets")}else{let o=e.lastIndexOf(":");if(o===-1)return ua(e,"expected host:port");if(e.indexOf(":")!==o)return ua(e,"IPv6 addresses must be bracketed");t=e.slice(0,o),r=e.slice(o+1)}if(!/^(0|[1-9]\d*)$/.test(r))return ua(e,"port must be an unpadded decimal integer");let n=Number(r);return zJ(n)?Nt(LJ(t),o=>qJ(o,n)):ua(e,"port must be an integer from 0 through 65535")};var eC=e=>{let t=BJ(e.host);return t.includes(":")?`[${t}]:${e.port}`:`${t}:${e.port}`};var rC="~effect/net/Dns/DnsRecord",tC=e=>Number.isInteger(e)&&e>=0&&e<=255,vu=e=>Number.isInteger(e)&&e>=0&&e<=65535,yU=e=>Number.isInteger(e)&&e>=0&&e<=4294967295,fa=e=>typeof e=="string",Rg=e=>Af(e)&&cc(e)&&yU(uo(e)),SU={A:{address:Kt},AAAA:{address:gn},CAA:{critical:e=>typeof e=="boolean",tag:e=>fa(e)&&/^[a-z0-9]+$/i.test(e),value:fa},CNAME:{target:gs},MX:{exchange:gs,priority:vu},NAPTR:{order:vu,preference:vu,flags:fa,service:fa,regexp:fa,replacement:gs},NS:{host:gs},PTR:{host:e=>fa(e)&&e.length>0},SOA:{primary:gs,admin:e=>fa(e)&&e.length>0,serial:yU,refresh:Rg,retry:Rg,expire:Rg,minimum:Rg},SRV:{target:gs,port:vu,priority:vu,weight:vu},TLSA:{certUsage:tC,selector:tC,matchingType:tC,data:e=>e instanceof Uint8Array&&e.length>0},TXT:{chunks:e=>Array.isArray(e)&&e.length>0&&e.every(fa)}},nC=Object.keys(SU),HJ=e=>nC.includes(e),oC=e=>A(e,rC),WJ={...mt,[rC]:rC,[X](e){return oC(e)&&e._tag===this._tag&&Object.keys(this).every(t=>W(this[t],e[t]))},[Y](){return ff(this,Object.keys(this))},toString(){return GJ(this)},toJSON(){return{...this}}},EU=(e,t)=>{if(!HJ(e))return Z(new hn({input:e,message:"unknown DNS record type"}));let r=typeof t=="object"&&t!==null?t:{},n=Object.create(WJ);n._tag=e;for(let[o,s]of Object.entries(SU[e])){let a=r[o];if(!s(a))return Z(new hn({input:t,message:`invalid ${e} record ${o}`}));n[o]=Array.isArray(a)?Object.freeze([...a]):a instanceof Uint8Array?new Uint8Array(a):a}return H(Object.freeze(n))};var bU=new TextEncoder,IU=e=>`\\${e.toString().padStart(3,"0")}`,kp=e=>{let t='"';for(let r of bU.encode(e))t+=r===34||r===92?`\\${String.fromCharCode(r)}`:r<32||r>126?IU(r):String.fromCharCode(r);return t+'"'},VJ=[34,36,40,41,59,64],xU=e=>{let t=bU.encode(e),r="";for(let n=0;n<t.length;n++){let o=t[n];if(o===92){let s=t[n+1];s===46||s===92?(r+=`\\${String.fromCharCode(s)}`,n++):r+="\\\\"}else o<=32||o>126?r+=IU(o):r+=VJ.includes(o)?`\\${String.fromCharCode(o)}`:String.fromCharCode(o)}return r},GJ=e=>{switch(e._tag){case"A":case"AAAA":return`${e._tag} ${Jt(e.address)}`;case"CAA":return`CAA ${e.critical?128:0} ${e.tag} ${kp(e.value)}`;case"CNAME":return`CNAME ${e.target}`;case"MX":return`MX ${e.priority} ${e.exchange}`;case"NAPTR":return`NAPTR ${e.order} ${e.preference} ${kp(e.flags)} ${kp(e.service)} ${kp(e.regexp)} ${e.replacement}`;case"NS":return`NS ${e.host}`;case"PTR":return`PTR ${xU(e.host)}`;case"SOA":return`SOA ${e.primary} ${xU(e.admin)} ${e.serial} ${uo(e.refresh)} ${uo(e.retry)} ${uo(e.expire)} ${uo(e.minimum)}`;case"SRV":return`SRV ${e.priority} ${e.weight} ${e.port} ${e.target}`;case"TLSA":return`TLSA ${e.certUsage} ${e.selector} ${e.matchingType} ${Wd(e.data).toUpperCase()}`;case"TXT":return`TXT ${e.chunks.map(kp).join(" ")}`}};var sC="~effect/net/IpInterface",CU=e=>Ap(e)&&Kt(e.address),TU=e=>Ap(e)&&gn(e.address),Ap=e=>A(e,sC),QJ={...mt,_tag:"IpInterface",[sC]:sC,[X](e){return Ap(e)&&this.prefixLength===e.prefixLength&&W(this.address,e.address)},[Y](){return ae(q(this.address),dt(this.prefixLength))},toString(){return Op(this)},toJSON(){return this.toString()}},aC=(e,t)=>Z(new hn({input:e,message:t})),vp=(e,t)=>{let r=wu(e);if(!Number.isInteger(t)||t<0||t>r)return aC(e,`prefix length must be an integer from 0 through ${r}`);let n=Object.assign(Object.create(QJ),{address:e,prefixLength:t});return H(Object.freeze(n))},iC=(e,t)=>{let r=e.indexOf("/");if(r===-1&&t?.prefix!=="required")return H({address:e,prefixLength:void 0});if(r<=0||r!==e.lastIndexOf("/")||r===e.length-1)return aC(e,"expected an address and prefix length separated by one slash");let n=e.slice(r+1);return/^(0|[1-9][0-9]*)$/.test(n)?H({address:e.slice(0,r),prefixLength:Number(n)}):aC(e,"prefix length must be an unpadded ASCII decimal integer")},$g=(e,t)=>_t(iC(e,t),r=>_t(Ti(r.address),n=>vp(n,r.prefixLength??wu(n)))),Ng=(e,t)=>_t(iC(e,t),r=>_t(wi(r.address),n=>vp(n,r.prefixLength??wu(n)))),Mg=(e,t)=>_t(iC(e,t),r=>_t(ca(r.address),n=>vp(n,r.prefixLength??wu(n))));var Op=e=>`${Jt(e.address)}/${e.prefixLength}`;var cC="~effect/net/IpNetwork",kU=e=>_p(e)&&Kt(e.address),AU=e=>_p(e)&&gn(e.address),_p=e=>A(e,cC),YJ={...mt,_tag:"IpNetwork",[cC]:cC,[X](e){return _p(e)&&this.prefixLength===e.prefixLength&&W(this.address,e.address)},[Y](){return ae(q(this.address),dt(this.prefixLength))},toString(){return Pp(this)},toJSON(){return this.toString()}},XJ=e=>{let t=Object.assign(Object.create(YJ),{address:e.address,prefixLength:e.prefixLength});return Object.freeze(t)},eZ=e=>Kt(e)?kg(e):j0(e);var tZ=(e,t)=>{let r=Math.floor(t/8),n=t%8;return e.map((o,s)=>s<r?o:s===r&&n!==0?o&(255<<8-n&255):0)},uC=(e,t)=>_t(vp(e,t),r=>{let n=eZ(e),o=tZ(n,t);return n.some((s,a)=>s!==o[a])?Z(new hn({input:e,message:"address has non-zero host bits"})):H(XJ(r))});var vU=e=>_t($g(e,{prefix:"required"}),t=>uC(t.address,t.prefixLength)),OU=e=>_t(Ng(e,{prefix:"required"}),t=>uC(t.address,t.prefixLength)),_U=e=>_t(Mg(e,{prefix:"required"}),t=>uC(t.address,t.prefixLength));var Pp=e=>`${Jt(e.address)}/${e.prefixLength}`;var Fp=mg;function _r(){return(e,t,r)=>V(new iu(e.map(Yl),n=>t(n.map(o=>V(o))),r))}function Me(e,t){return _r()([],()=>(r,n,o)=>e(r)?y(r):C(new xt(n,r,o)),t)}function nZ(e){return e}function oZ(e){return t=>t.annotate(e)}function sZ(e){return t=>lC(lC(t).annotate(e))}function aZ(e){return t=>t.rebuild(rp(t.ast,e))}function iZ(e){return e}var Ai=class extends an("SchemaError"){[Cu]=Cu;constructor(t){let r=In();Bt(0);try{super({issue:t})}finally{Bt(r)}}get message(){return dR(this.issue)}toJSON(){return{_tag:this._tag,message:this.message}}[qe](){return this.toJSON()}toString(){return`SchemaError(${this.message})`}};function HU(e){return cU(e)}function WU(e){return $e(e)?gC(e):br(e,t=>Ws(()=>qs(t,r=>new Ai(r))))}function gC(e){return ut(e)?e:yo(qs(e.cause,t=>new Ai(t)))}function VU(e,t){let r;for(let n of e.reasons){if(!Om(n)||!HU(n.error))throw new globalThis.Error(t,{cause:e});r??=n.error}if(r===void 0)throw new globalThis.Error(t,{cause:e});return r}function GU(e){return nh(e).then(t=>{if(ut(t))return t.value;throw VU(t.cause,"Promise adapter can only reject schema errors")})}function KU(e){let t=wo(e);if(ut(t))return t.value;throw VU(t.cause,"Sync adapter can only throw schema errors")}function cZ(e,t){return L1(e,t)}function uZ(e){return B1(e)}var Dg=f0,fZ=YM;function Ss(e,t){let r=St(e,t);return(n,o)=>WU(r(n,o))}var lZ=Ss;function JU(e,t){let r=XM(e,t);return(n,o)=>gC(r(n,o))}var pZ=JU,dZ=p0,mZ=e1;function ZU(e,t){let r=t1(e,t);return(n,o)=>$d(r(n,o),s=>new Ai(s))}var hZ=ZU;function QU(e,t){let r=Ss(e,t);return(n,o)=>GU(r(n,o))}var gZ=QU;function YU(e,t){let r=Ss(e,t);return(n,o)=>KU(r(n,o))}var xZ=YU;function Lg(e,t){let r=Ei(e,t);return(n,o)=>WU(r(n,o))}var yZ=Lg;function XU(e,t){let r=n1(e,t);return(n,o)=>gC(r(n,o))}var SZ=XU,EZ=d0,bZ=o1;function eD(e,t){let r=s1(e,t);return(n,o)=>$d(r(n,o),s=>new Ai(s))}var IZ=eD;function tD(e,t){let r=Lg(e,t);return(n,o)=>GU(r(n,o))}var CZ=tD;function rD(e,t){let r=Lg(e,t);return(n,o)=>KU(r(n,o))}var TZ=rD,V=Ln;function Bg(e){return A(e,Fp)&&e[Fp]===Fp}var xs=pr(e=>V(pi(e.ast),{schema:e})),wZ=pr(e=>e.schema),Es=pr(e=>{let t=Wg(e);return V(lN(e.ast),{schema:t})}),kZ=pr(e=>e.schema.members[0]),AZ=pr(e=>V(rI(e.ast),{schema:e})),vZ=pr(e=>e.schema),Pr=pr(e=>V(It(e.ast),{schema:e})),Ru=pr(e=>V($n(e.ast),{schema:e})),Rp="~effect/Schema/flip";function OZ(e){return A(e,Rp)&&e[Rp]===Rp}function lC(e){return OZ(e)?e.schema.rebuild(Xr(e.ast)):V(Xr(e.ast),{[Rp]:Rp,schema:e})}function Ct(e){let t=V(new Yr(e),{literal:e,transform(r){return t.pipe(J(Ct(r),{decode:le(()=>r),encode:le(()=>e)}))}});return t}function nD(e){return e.map(t=>Bg(t)?t.ast:new Yr(t))}function _Z(e){return V(new Hb(nD(e)),{parts:e})}function PZ(e){return V(H$(nD(e)),{parts:e})}function FZ(e){return V(new q$(Object.keys(e).filter(t=>typeof e[e[t]]!="number").map(t=>[t,e[t]])),{enums:e})}var RZ=V(qb),$Z=V(j$),$p=V(ls),jg=V(jb),xC=V(zb),$=V(Qr),NZ=$,Np=V(Wb),zg=V(G$),oD=V(K$),$u=V(J$),MZ=V(B$),UZ=V(z$);function DZ(e){return V(new V$(e))}function yC(e,t){return V(e,{fields:t,mapFields(r,n){let o=r(this.fields);return yC(Nh(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function _e(e){return yC(Nh(e,void 0),e)}function LZ(e){return pr(t=>t.mapFields(X1(e)))}var BZ=e=>typeof e=="symbol"?e:globalThis.String(e);function jZ(e){return function(t){let r={},n=Object.create(null),o=Object.create(null),s=new Set;for(let a of Reflect.ownKeys(t.fields)){let i=Ru(t.fields[a]),c=Object.hasOwn(e,a),f=c?e[a]:a,u=BZ(f);if(s.has(u))throw new globalThis.Error(`Duplicate encoded keys: ${Yn(f)}`);s.add(u),U(r,f,i),c&&(n[a]=f,o[f]=a)}return _e(r).pipe(J(t,we({decode:P0(o),encode:P0(n)})))}}function zZ(e,t){return r=>{let n=Nd(r.fields,Pr),o=_e({...n,...e});return r.pipe(J(o,we({decode:s=>{let a={...s};for(let i in e){let c=t[i],f=c(s);ve(f)&&U(a,i,f.value)}return a},encode:s=>{let a={...s};for(let i in e)delete a[i];return a}})))}}function vi(e,t){return V(dN(e.ast,t.ast),{key:e,value:t})}function qZ(e,t){return V(eN(e.ast,t.map(Yl)),{schema:e,records:t})}function sD(e,t){return V(e,{elements:t,mapElements(r,n){let o=r(this.elements);return sD(Jb(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function No(e){return sD(Jb(e),e)}function HZ(e,t){return V(tN(e.ast,t.map(Yl)),{schema:e,rest:t})}var Ce=pr(e=>V(new dn(!1,[],[e.ast]),{value:e}));function qg(e,t,r){return t!==void 0&&r!==void 0?e.check(TC(t,r)):t!==void 0?e.check(ID(t)):r!==void 0?e.check(wD(r)):e}var Hg=pr(e=>V(new dn(!1,[e.ast],[e.ast]),{value:e}));function WZ(e){let t=Ce(e),r=Ce(Pr(e)),n=J(No([$p]),we({decode:o=>[o],encode:([o])=>o}))(e);return V(Ze([n,t]).pipe(J(r)).ast,{from:Ze([e,t]),to:r})}function VZ(e){return Ce(e).check(kC())}var GZ=pr(e=>V(rN(e.ast),{schema:e}));function aD(e,t){return V(e,{members:t,mapMembers(r,n){let o=r(this.members);return aD(Mh(o,this.ast.options,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Ze(e,t){return aD(Mh(e,t,void 0),e)}function bs(e){let t=e.map(Ct);return V(Mh(t,void 0,void 0),{literals:e,members:t,mapMembers(r){return Ze(r(this.members))},pick(r){return bs(r)},transform(r){return Ze(t.map((n,o)=>n.transform(r[o])))}})}var SC=pr(e=>Ze([e,jg])),Wg=pr(e=>Ze([e,xC])),iD=pr(e=>Ze([e,jg,xC]));function cD(e){return V(new Qb(()=>e().ast))}function KZ(...e){return t=>t.check(...e)}function uD(e,t){return r=>V(Ro(r.ast,[Dh(e,t)]),{schema:r})}function Vg(e){return t=>V(t.ast,{schema:t,identifier:e})}function JZ(e,t){return r=>(t.checks?r.check(...t.checks):r).pipe(Vg(e))}function fD(e){return t=>V(uN(t.ast,new kh(e,F)),{schema:t})}function lD(e){return t=>V(fN(t.ast,new kh(F,e)),{schema:t})}function ZZ(e){return pD(e)}function pD(e){return t=>fD(Il(e))(t)}function QZ(e){return dD(e)}function dD(e){return t=>lD(Il(e))(t)}function J(e,t){return r=>V(lu(r.ast,e.ast,t?Ah(t):eu()),{from:r,to:e})}function Nu(){return(e,t)=>Te()(e,{decode:t,encode:RR})}var Gg=bs(["true","yes","on","1","y"]),Kg=bs(["false","no","off","0","n"]),EC=bs([...Gg.literals,...Kg.literals]).pipe(J(zg,we({decode:e=>e==="true"||e==="yes"||e==="on"||e==="1"||e==="y",encode:e=>e?"true":"false"})));function YZ(e){return t=>J(Pr(t),e)(t)}function bC(e,t){return r=>t?J(r,t)(e):J(r)(e)}function XZ(e){return t=>J(t,e)(Ru(t))}function mD(e){return t=>V(pN(t.ast,e),{schema:t})}function hD(e){return br(e,t=>Ws(()=>qs(t,r=>r.issue)))}function IC(e,t){let r=t?.encodingStrategy==="omit"?Sb():_o();return n=>xs(Ru(n)).pipe(J(n,{decode:Eb(hD(e)),encode:r}))}function e5(e,t){return r=>Pr(r).pipe(IC(e,t),bC(xs(r)))}function gD(e,t){let r=t?.encodingStrategy==="omit"?Sb():_o();return n=>Es(Ru(n)).pipe(J(n,{decode:Eb(hD(e)),encode:r}))}function t5(e,t){return r=>Pr(r).pipe(gD(e,t),bC(Es(r)))}function ys(e){return Ct(e).pipe(mD(y(e)))}function r5(e){return ys(e).pipe(IC(y(e),{encodingStrategy:"omit"}))}function Mp(e,t){return _e({_tag:ys(e),...t})}function xD(e){return t=>{let r={},n=[],o=new Set,s={},a=u=>l=>u.includes(l[e]);return i(t),Object.assign(t,{tag:e,cases:r,discriminants:n,isAnyOf:a,guards:s,match:c,matchOrElse:f});function i(u){let l=u.ast;if(U$(l)&&"members"in u&&globalThis.Array.isArray(u.members)&&u.members.every(Bg))return u.members.forEach(i);let p=ou(l);if(p.length>0){let h=p.find(g=>g.key===e)?.literal;if(pd(h)){let g=typeof h=="number"?globalThis.String(h):h;if(o.has(g))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(h)}`);o.add(g),n.push(h),U(r,h,u),U(s,h,f0(Pr(u)));return}}throw new globalThis.Error("No literal or unique symbol found")}function c(){if(arguments.length===1){let g=arguments[0];return function(x){let b=x[e];return(Object.hasOwn(g,b)?g[b]:void 0)(x)}}let u=arguments[0],l=arguments[1],p=u[e];return(Object.hasOwn(l,p)?l[p]:void 0)(u)}function f(){if(arguments.length===2){let x=arguments[0],b=arguments[1];return function(T){let w=T[e];return(Object.hasOwn(x,w)?x[w]??b:b)(T)}}let u=arguments[0],l=arguments[1],p=arguments[2],h=u[e];return(Object.hasOwn(l,h)?l[h]??p:p)(u)}}}function n5(e){let t={},r=[];for(let f of Object.keys(e)){let u=Mp(f,e[f]);U(t,f,u),r.push(u)}let n=Ze(r),{tag:o,guards:s,isAnyOf:a,match:i,matchOrElse:c}=xD("_tag")(n);return V(n.ast,{tag:o,cases:t,isAnyOf:a,guards:s,match:i,matchOrElse:c})}function o5(){return e=>e}function la(e,t){return Me(r=>r instanceof e,t)}function Te(){return(e,t)=>new ft(e.ast,Ah(t))}var ke=Uh;function s5(e,t=void 0){return new ci(e,t)}var PU="^\\S[\\s\\S]*\\S$|^\\S$|^$";function yD(e){let t=new globalThis.RegExp(PU);return ke(r=>r.trim()===r,{expected:"a string with no leading or trailing whitespace",representation:{id:"effect/schema/isTrimmed",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isTrimmed()"}),arbitraryConstraint:{patterns:[{source:PU,flags:""}]},...e})}function Oi(e,t){let r=e.source,n=e.flags,o=/^[dg]*uy?$/.test(n),s=n===""?`new RegExp(${N(r)})`:`new RegExp(${N(r)}, ${N(n)})`;return ep(e,{toJsonSchema:()=>o?{pattern:n.endsWith("y")?`^(?:${r})`:r}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${s})`}),...t})}function a5(e){return sI({toCode:()=>({runtime:"Schema.isStringFinite()"}),...e})}function i5(e){return aI({toCode:()=>({runtime:"Schema.isStringBigInt()"}),...e})}function c5(e){return cI({toCode:()=>({runtime:"Schema.isStringSymbol()"}),...e})}var u5=e=>e?new globalThis.RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$/;function f5(e,t){let r=u5(e);return Oi(r,{expected:e?`a UUID v${e}`:"a UUID",representation:{id:"effect/schema/isUUID",payload:{version:e??null}},toJsonSchema:()=>({pattern:r.source,format:"uuid"}),toCode:()=>({runtime:e===void 0?"Schema.isUUID()":`Schema.isUUID(${e})`}),...t})}var FU=/^([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})$/;function l5(e){return Oi(FU,{expected:"a GUID",representation:{id:"effect/schema/isGUID",payload:null},toJsonSchema:()=>({pattern:FU.source}),toCode:()=>({runtime:"Schema.isGUID()"}),...e})}function p5(e){let t=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;return Oi(t,{representation:{id:"effect/schema/isULID",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isULID()"}),...e})}function SD(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return Oi(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}function d5(e){let t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;return Oi(t,{expected:"a base64url encoded string",representation:{id:"effect/schema/isBase64Url",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64Url()"}),...e})}function CC(e,t,r){if(e.length===0)return t.length===0?{}:[{},!0];let n={pattern:new globalThis.RegExp(r).source};return e===t?n:[n,!0]}function m5(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(`^${ms(e)}`),o=e.replace(/[\uD800-\uDBFF]$/,"");return ke(s=>s.startsWith(e),{expected:`a string starting with ${r}`,representation:{id:"effect/schema/isStartingWith",payload:{startsWith:e}},toJsonSchema:()=>CC(o,e,`^${ms(o)}`),toCode:()=>({runtime:`Schema.isStartingWith(${N(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}function h5(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(`${ms(e)}$`),o=e.replace(/^[\uDC00-\uDFFF]/,"");return ke(s=>s.endsWith(e),{expected:`a string ending with ${r}`,representation:{id:"effect/schema/isEndingWith",payload:{endsWith:e}},toJsonSchema:()=>CC(o,e,`${ms(o)}$`),toCode:()=>({runtime:`Schema.isEndingWith(${N(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}function g5(e,t){let r=JSON.stringify(e),n=new globalThis.RegExp(ms(e)),o=e.replace(/^[\uDC00-\uDFFF]|[\uD800-\uDBFF]$/g,"");return ke(s=>s.includes(e),{expected:`a string including ${r}`,representation:{id:"effect/schema/isIncluding",payload:{includes:e}},toJsonSchema:()=>CC(o,e,ms(o)),toCode:()=>({runtime:`Schema.isIncluding(${N(e)})`}),arbitraryConstraint:{patterns:[{source:n.source,flags:n.flags}]},...t})}var RU="^[^a-z]*$";function x5(e){let t=new globalThis.RegExp(RU);return ke(r=>r.toUpperCase()===r,{expected:"a string with all characters in uppercase",representation:{id:"effect/schema/isUppercased",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isUppercased()"}),arbitraryConstraint:{patterns:[{source:RU,flags:""}]},...e})}var $U="^[^A-Z]*$";function y5(e){let t=new globalThis.RegExp($U);return ke(r=>r.toLowerCase()===r,{expected:"a string with all characters in lowercase",representation:{id:"effect/schema/isLowercased",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isLowercased()"}),arbitraryConstraint:{patterns:[{source:$U,flags:""}]},...e})}var NU="^(?:[^a-z][\\s\\S]*)?$";function S5(e){let t=new globalThis.RegExp(NU);return ke(r=>r.charAt(0).toUpperCase()===r.charAt(0),{expected:"a string with the first character in uppercase",representation:{id:"effect/schema/isCapitalized",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isCapitalized()"}),arbitraryConstraint:{patterns:[{source:NU,flags:""}]},...e})}var MU="^(?:[^A-Z][\\s\\S]*)?$";function E5(e){let t=new globalThis.RegExp(MU);return ke(r=>r.charAt(0).toLowerCase()===r.charAt(0),{expected:"a string with the first character in lowercase",representation:{id:"effect/schema/isUncapitalized",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isUncapitalized()"}),arbitraryConstraint:{patterns:[{source:MU,flags:""}]},...e})}var Mu=V(Xb),b5=Yb;function Up(e){let t=Yi(e.order),r=e.formatter??N;return(n,o)=>ke(s=>t(s,n),{expected:`a value greater than ${r(n)}`,arbitraryConstraint:{order:e.order,minimum:n,exclusiveMinimum:!0},...e.annotate?.(n),...o})}function Dp(e){let t=Ad(e.order),r=e.formatter??N;return(n,o)=>ke(s=>t(s,n),{expected:`a value greater than or equal to ${r(n)}`,arbitraryConstraint:{order:e.order,minimum:n},...e.annotate?.(n),...o})}function Lp(e){let t=wd(e.order),r=e.formatter??N;return(n,o)=>ke(s=>t(s,n),{expected:`a value less than ${r(n)}`,arbitraryConstraint:{order:e.order,maximum:n,exclusiveMaximum:!0},...e.annotate?.(n),...o})}function Bp(e){let t=kd(e.order),r=e.formatter??N;return(n,o)=>ke(s=>t(s,n),{expected:`a value less than or equal to ${r(n)}`,arbitraryConstraint:{order:e.order,maximum:n},...e.annotate?.(n),...o})}function jp(e){let t=Ad(e.order),r=Yi(e.order),n=kd(e.order),o=wd(e.order),s=e.formatter??N;return(a,i)=>{let c=a.exclusiveMinimum?r:t,f=a.exclusiveMaximum?o:n;return ke(u=>c(u,a.minimum)&&f(u,a.maximum),{expected:`a value between ${s(a.minimum)}${a.exclusiveMinimum?" (excluded)":""} and ${s(a.maximum)}${a.exclusiveMaximum?" (excluded)":""}`,arbitraryConstraint:{order:e.order,minimum:a.minimum,maximum:a.maximum,...a.exclusiveMinimum&&{exclusiveMinimum:!0},...a.exclusiveMaximum&&{exclusiveMaximum:!0}},...e.annotate?.(a),...i})}}function I5(e){return(t,r)=>{let n=e.formatter??N;return ke(o=>e.remainder(o,t)===e.zero,{expected:`a value that is a multiple of ${n(t)}`,...e.annotate?.(t),...r})}}function _u(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${N(e)}`);return e}var C5=Up({order:Ho,annotate:e=>({representation:{id:"effect/schema/isGreaterThan",payload:{exclusiveMinimum:_u(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${N(e)})`})})}),ED=Dp({order:Ho,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:_u(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${N(e)})`})})}),T5=Lp({order:Ho,annotate:e=>({representation:{id:"effect/schema/isLessThan",payload:{exclusiveMaximum:_u(e)}},toJsonSchema:()=>({exclusiveMaximum:e}),toCode:()=>({runtime:`Schema.isLessThan(${N(e)})`})})}),w5=Bp({order:Ho,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualTo",payload:{maximum:_u(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${N(e)})`})})}),pa=jp({order:Ho,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetween",payload:{minimum:_u(e.minimum),maximum:_u(e.maximum),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>({[t?"exclusiveMinimum":"minimum"]:e.minimum,[r?"exclusiveMaximum":"maximum"]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${N(e.minimum)}, maximum: ${N(e.maximum)}, exclusiveMinimum: ${N(t)}, exclusiveMaximum: ${N(r)} })`})}}});function k5(e,t){if(!globalThis.Number.isFinite(e)||e===0)throw new globalThis.RangeError(`Expected a finite non-zero number, got ${globalThis.String(e)}`);return e=globalThis.Math.abs(e),ke(r=>A_(r,e)===0,{expected:`a value that is a multiple of ${e}`,representation:{id:"effect/schema/isMultipleOf",payload:{divisor:e}},toJsonSchema:()=>({multipleOf:e}),toCode:()=>({runtime:`Schema.isMultipleOf(${N(e)})`}),...t})}function Jg(e){return ke(t=>globalThis.Number.isSafeInteger(t),{expected:"an integer",representation:{id:"effect/schema/isInt",payload:null},toJsonSchema:()=>({type:"integer",minimum:globalThis.Number.MIN_SAFE_INTEGER,maximum:globalThis.Number.MAX_SAFE_INTEGER}),toCode:()=>({runtime:"Schema.isInt()"}),arbitraryConstraint:{number:"integer"},...e})}var Fr=Np.check(Jg()),ki=Fr.check(ED(0));function A5(e){return new ci([Jg(),pa({minimum:-2147483648,maximum:2147483647})],{expected:"a 32-bit integer",...e})}function v5(e){return new ci([Jg(),pa({minimum:0,maximum:4294967295})],{expected:"a 32-bit unsigned integer",...e})}function Pu(e){if(globalThis.Number.isNaN(e.getTime()))throw new globalThis.RangeError(`Expected a valid Date, got ${N(e)}`);return e.toISOString()}function Fu(e){return`new Date(${N(e.getTime())})`}var O5=Up({order:Qi,annotate:e=>({representation:{id:"effect/schema/isGreaterThanDate",payload:{exclusiveMinimum:Pu(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanDate(${Fu(e)})`})})}),_5=Dp({order:Qi,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToDate",payload:{minimum:Pu(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToDate(${Fu(e)})`})})}),P5=Lp({order:Qi,annotate:e=>({representation:{id:"effect/schema/isLessThanDate",payload:{exclusiveMaximum:Pu(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanDate(${Fu(e)})`})})}),F5=Bp({order:Qi,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToDate",payload:{maximum:Pu(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToDate(${Fu(e)})`})})}),R5=jp({order:Qi,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenDate",payload:{minimum:Pu(e.minimum),maximum:Pu(e.maximum),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenDate({ minimum: ${Fu(e.minimum)}, maximum: ${Fu(e.maximum)}, exclusiveMinimum: ${N(t)}, exclusiveMaximum: ${N(r)} })`})}}}),$5=Up({order:Zi,annotate:e=>({representation:{id:"effect/schema/isGreaterThanBigInt",payload:{exclusiveMinimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanBigInt(${N(e)})`})})}),bD=Dp({order:Zi,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToBigInt",payload:{minimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToBigInt(${N(e)})`})})}),N5=Lp({order:Zi,annotate:e=>({representation:{id:"effect/schema/isLessThanBigInt",payload:{exclusiveMaximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanBigInt(${N(e)})`})})}),M5=Bp({order:Zi,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToBigInt",payload:{maximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToBigInt(${N(e)})`})})}),U5=jp({order:Zi,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,r=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenBigInt",payload:{minimum:e.minimum.toString(10),maximum:e.maximum.toString(10),...t&&{exclusiveMinimum:t},...r&&{exclusiveMaximum:r}}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenBigInt({ minimum: ${N(e.minimum)}, maximum: ${N(e.maximum)}, exclusiveMinimum: ${N(t)}, exclusiveMaximum: ${N(r)} })`})}}});function ID(e,t){return e=dr(e),CD(e,Math.ceil(e/2),t)}function CD(e,t,r){return ke(n=>n.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:"effect/schema/isMinLength",payload:{minLength:e}},toJsonSchema:({type:n})=>n==="string"?e<=1?{minLength:t}:[{minLength:t},!0]:n==="array"?{minItems:e}:n===void 0?[{minLength:t,minItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[kr]:!0,arbitraryConstraint:{minLength:e},...r})}function TD(e){return CD(1,1,e)}function wD(e,t){return e=dr(e),ke(r=>r.length<=e,{expected:`a value with a length of at most ${e}`,representation:{id:"effect/schema/isMaxLength",payload:{maxLength:e}},toJsonSchema:({type:r})=>r==="string"?e===0?{maxLength:e}:[{maxLength:e},!0]:r==="array"?{maxItems:e}:r===void 0?[{maxLength:e,maxItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[kr]:!0,arbitraryConstraint:{maxLength:e},...t})}function TC(e,t,r){return e=dr(e),t=dr(t),ke(n=>n.length>=e&&n.length<=t,{expected:e===t?`a value with a length of ${e}`:`a value with a length between ${e} and ${t}`,representation:{id:"effect/schema/isBetweenLength",payload:{minimum:e,maximum:t}},toJsonSchema:({type:n})=>n==="string"?t===0||Math.ceil(e/2)>t?{minLength:Math.ceil(e/2),maxLength:t}:[{minLength:Math.ceil(e/2),maxLength:t},!0]:n==="array"?{minItems:e,maxItems:t}:n===void 0?[{minLength:Math.ceil(e/2),maxLength:t,minItems:e,maxItems:t},!0]:[{},!0],toCode:()=>({runtime:`Schema.isBetweenLength(${e}, ${t})`}),[kr]:!0,arbitraryConstraint:{minLength:e,maxLength:t},...r})}function D5(e,t){return e=dr(e),ke(r=>wC(r,e)>=e,{expected:`a string with at least ${e} code points`,representation:{id:"effect/schema/isMinCodePoints",payload:{minCodePoints:e}},toJsonSchema:()=>({minLength:e}),toCode:()=>({runtime:`Schema.isMinCodePoints(${e})`}),arbitraryConstraint:{minCodePoints:e},...t})}function L5(e,t){return e=dr(e),ke(r=>wC(r,e+1)<=e,{expected:`a string with at most ${e} code points`,representation:{id:"effect/schema/isMaxCodePoints",payload:{maxCodePoints:e}},toJsonSchema:()=>({maxLength:e}),toCode:()=>({runtime:`Schema.isMaxCodePoints(${e})`}),arbitraryConstraint:{maxCodePoints:e},...t})}function B5(e,t,r){return e=dr(e),t=dr(t),ke(n=>{let o=wC(n,t+1);return o>=e&&o<=t},{expected:e===t?`a string with ${e} code points`:`a string with between ${e} and ${t} code points`,representation:{id:"effect/schema/isBetweenCodePoints",payload:{minimum:e,maximum:t}},toJsonSchema:()=>({allOf:[{minLength:e},{maxLength:t}]}),toCode:()=>({runtime:`Schema.isBetweenCodePoints(${e}, ${t})`}),arbitraryConstraint:{minCodePoints:e,maxCodePoints:t},...r})}function wC(e,t){if(t===0)return 0;let r=0;for(let n of e)if(++r>=t)break;return r}function dr(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}function j5(e,t){return e=dr(e),ke(r=>r.size>=e,{expected:`a value with a size of at least ${e}`,representation:{id:"effect/schema/isMinSize",payload:{minSize:e}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isMinSize(${e})`}),[kr]:!0,arbitraryConstraint:{minSize:e},...t})}function z5(e,t){return e=dr(e),ke(r=>r.size<=e,{expected:`a value with a size of at most ${e}`,representation:{id:"effect/schema/isMaxSize",payload:{maxSize:e}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isMaxSize(${e})`}),[kr]:!0,arbitraryConstraint:{maxSize:e},...t})}function q5(e,t,r){return e=dr(e),t=dr(t),ke(n=>n.size>=e&&n.size<=t,{expected:e===t?`a value with a size of ${e}`:`a value with a size between ${e} and ${t}`,representation:{id:"effect/schema/isBetweenSize",payload:{minimum:e,maximum:t}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenSize(${e}, ${t})`}),[kr]:!0,arbitraryConstraint:{minSize:e,maxSize:t},...r})}function H5(e,t){return e=dr(e),ke(r=>Reflect.ownKeys(r).length>=e,{expected:`a value with at least ${e===1?"1 entry":`${e} entries`}`,representation:{id:"effect/schema/isMinProperties",payload:{minProperties:e}},toJsonSchema:({type:r})=>r==="object"?{minProperties:e}:[{minProperties:e},!0],toCode:()=>({runtime:`Schema.isMinProperties(${e})`}),[kr]:!0,arbitraryConstraint:{minProperties:e},...t})}function W5(e,t){return e=dr(e),ke(r=>Reflect.ownKeys(r).length<=e,{expected:`a value with at most ${e===1?"1 entry":`${e} entries`}`,representation:{id:"effect/schema/isMaxProperties",payload:{maxProperties:e}},toJsonSchema:({type:r})=>r==="object"?{maxProperties:e}:[{maxProperties:e},!0],toCode:()=>({runtime:`Schema.isMaxProperties(${e})`}),[kr]:!0,arbitraryConstraint:{maxProperties:e},...t})}function V5(e,t,r){return e=dr(e),t=dr(t),ke(n=>Reflect.ownKeys(n).length>=e&&Reflect.ownKeys(n).length<=t,{expected:e===t?`a value with exactly ${e===1?"1 entry":`${e} entries`}`:`a value with between ${e} and ${t} entries`,representation:{id:"effect/schema/isBetweenProperties",payload:{minimum:e,maximum:t}},toJsonSchema:({type:n})=>n==="object"?{minProperties:e,maxProperties:t}:[{minProperties:e,maxProperties:t},!0],toCode:()=>({runtime:`Schema.isBetweenProperties(${e}, ${t})`}),[kr]:!0,arbitraryConstraint:{minProperties:e,maxProperties:t},...r})}function G5(e,t){let r=Ru(e),n=QM(r.ast);return ke((o,s,a)=>{let i=Reflect.ownKeys(o),c=[];for(let f of i){let u=n(f,a);if(u!==void 0&&(c.push(new kt([f],u)),a.errors==="first"))break}return Na(c)?new At(s,c,o,a):!0},{expected:"an object with property names matching the schema",representation:{id:"effect/schema/isPropertyNames",payload:null,schemas:[r.ast]},toJsonSchema:({schemas:o,type:s})=>s==="object"?{propertyNames:o[0]}:[{propertyNames:o[0]},!0],toCode:({schemas:o})=>({runtime:`Schema.isPropertyNames(${o[0].runtime})`}),[kr]:!0,...t})}function kC(e){return ke(t=>Bd(t).length===t.length,{expected:"an array with unique items",representation:{id:"effect/schema/isUnique",payload:null},toJsonSchema:()=>({uniqueItems:!0}),toCode:()=>({runtime:"Schema.isUnique()"}),arbitraryConstraint:{uniqueBy:F},...e})}function kD(e){return ke(t=>Bd(t.map(([r])=>r)).length===t.length,{expected:"an array with unique keys",representation:{id:"effect/schema/isUniqueKey",payload:null},toCode:()=>({runtime:"Schema.isUniqueKey()"}),arbitraryConstraint:{uniqueBy:t=>t[0]},...e})}var AC=$.check(TD()),K5=$.check(TC(1,1)),AD=e=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),vD=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},UU=[];function J5(e){let t=AD(e),r=UU[t];if(r!==void 0)return r;let n=vD(t),o=la(globalThis.Error,{representation:{id:"effect/schema/Error",payload:n??null},toCode:()=>({runtime:n!==void 0?`Schema.ErrorInstance(${N(n)})`:"Schema.ErrorInstance()",Type:"globalThis.Error"}),expected:"Error",toCodecJson:()=>Te()(IY,h$(n))});return UU[t]=o,o}var DU=[];function vC(e){let t=AD(e),r=DU[t];if(r!==void 0)return r;let n=tx.pipe(J($p,g$(vD(t))));return DU[t]=n,n}function Z5(e,t){let r=_r()([e,t],([n,o])=>{let s=Ce(No([n,o]));return(a,i,c)=>a instanceof globalThis.Map?Wt(St(s)([...a],c),{onSuccess:f=>new globalThis.Map(f),onFailure:f=>vr(i,"entries",f,a,c)}):C(new xt(i,a,c))},{representation:{id:"effect/schema/ReadonlyMap",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.ReadonlyMap(${n[0].runtime}, ${n[1].runtime})`,Type:`globalThis.ReadonlyMap<${n[0].Type}, ${n[1].Type}>`}),expected:"ReadonlyMap",toCodec:([n,o])=>Te()(Ce(No([n,o])),we({decode:s=>new globalThis.Map(s),encode:s=>[...s.entries()]}))});return V(r.ast,{key:e,value:t})}function Q5(e){let t=_r()([e],([r])=>{let n=Ce(r);return(o,s,a)=>o instanceof globalThis.Set?Wt(St(n)([...o],a),{onSuccess:i=>new globalThis.Set(i),onFailure:i=>vr(s,"values",i,o,a)}):C(new xt(s,o,a))},{representation:{id:"effect/schema/ReadonlySet",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.ReadonlySet(${r[0].runtime})`,Type:`globalThis.ReadonlySet<${r[0].Type}>`}),expected:"ReadonlySet",toCodec:([r])=>Te()(Ce(r),we({decode:n=>new globalThis.Set(n),encode:n=>[...n.values()]}))});return V(t.ast,{value:e})}var Y5=la(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>Te()(_e({source:$,flags:$}),$t({decode:(e,t)=>ht({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new ce({expected:"valid RegExp source and flags"},e,t)}),encode:e=>y({source:e.source,flags:e.flags})}))}),OD=$.annotate({expected:"a string that will be decoded as a URL"}),_D=la(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>Te()(OD,Ob)}),X5=OD.pipe(J(_D,Ob)),PD=$.annotate({expected:"a string that will be decoded as a Date"}),Uu=Me(e=>e instanceof globalThis.Date&&!globalThis.Number.isNaN(e.getTime()),{representation:{id:"effect/schema/Date",payload:null},toCode:()=>({runtime:"Schema.Date",Type:"globalThis.Date"}),expected:"a valid Date",toCodecJson:()=>Te()(PD,Ab)}),e8=PD.pipe(J(Uu,Ab)),t8=Fr.pipe(J(Uu,u$)),r8=$.annotate({expected:"a string that will be decoded as JSON",contentMediaType:"application/json"});function OC(e,t){return r8.pipe(J(e,k$(t)))}var n8=OC($p),FD=la(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>Te()(_e({data:$.check(SD()),type:$,name:$,lastModified:Fr}),$t({decode:(e,t)=>xr(ai(e.data),{onFailure:()=>C(new ce({expected:"a valid Base64 string"},e.data,t)),onSuccess:r=>{let n=new globalThis.Uint8Array(r);return y(new globalThis.File([n],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>Pc({try:async()=>{let r=new globalThis.Uint8Array(await e.arrayBuffer());return{data:Yc(r),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new ce({expected:"a readable File"},e,t)})}))}),RD=la(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>Te()(Ce(No([$,Ze([_e({_tag:ys("String"),value:$}),_e({_tag:ys("File"),value:FD})])])),$t({decode:e=>{let t=new globalThis.FormData;for(let[r,n]of e)t.append(r,n.value);return y(t)},encode:e=>y(globalThis.Array.from(e.entries()).map(([t,r])=>typeof r=="string"?[t,{_tag:"String",value:r}]:[t,{_tag:"File",value:r}]))}))});function o8(e){return RD.pipe(J(e,A$))}var $D=la(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>Te()($.annotate({expected:"a query string that will be decoded as URLSearchParams"}),we({decode:e=>new globalThis.URLSearchParams(e),encode:e=>e.toString()}))});function s8(e){return $D.pipe(J(e,v$))}var a8=$.annotate({expected:"a string that will be decoded as a number"}).pipe(J(Np,tu)),i8=$.annotate({expected:"a string that will be decoded as a finite number"}).pipe(J(Mu,tu)),c8=V(iI).pipe(J($u,Oh)),ND=$.check(yD()),u8=$.annotate({expected:"a string that will be decoded as a trimmed string"}).pipe(J(ND,c$())),f8=$.annotate({expected:"a base64 encoded string that will be decoded as a UTF-8 string"}).pipe(J($,I$)),l8=$.annotate({expected:"a base64 (URL) encoded string that will be decoded as a UTF-8 string"}).pipe(J($,C$)),p8=$.annotate({expected:"a hex encoded string that will be decoded as a UTF-8 string"}).pipe(J($,T$)),d8=$.annotate({expected:"a URI component encoded string that will be decoded as a UTF-8 string"}).pipe(J($,w$)),pC=Ze([Mu,oD,$]),m8=_e({issues:Ce(_e({message:$,path:Es(Ce(Ze([pC,_e({key:pC})])))}))}),h8=bs([0,1]).pipe(J(zg,we({decode:e=>e===1,encode:e=>e?1:0}))),MD=$.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),Zg=la(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>Te()(MD,_b)}),g8=MD.pipe(J(Zg,_b)),x8=$.annotate({expected:"a base64 (URL) encoded string that will be decoded as a Uint8Array"}).pipe(J(Zg,{decode:jR(),encode:Th()})),UD=$.annotate({expected:"a hex encoded string that will be decoded as a Uint8Array"}).pipe(J(Zg,{decode:qR(),encode:wh()})),DD=$t({decode:(e,t)=>{let r=a$(e);return Ke(r)?C(new ce({expected:"a valid BigDecimal string"},e,t)):y(r.value)},encode:e=>y(fs(e))}),y8=Up({order:Xc,formatter:e=>fs(e)}),S8=Dp({order:Xc,formatter:e=>fs(e)}),E8=Lp({order:Xc,formatter:e=>fs(e)}),b8=Bp({order:Xc,formatter:e=>fs(e)}),I8=jp({order:Xc,formatter:e=>fs(e)}),LD=$.annotate({expected:"a string that will be decoded as a BigDecimal"}),BD=Me(wb,{representation:{id:"effect/schema/BigDecimal",payload:null},toCode:()=>({runtime:"Schema.BigDecimal",Type:"BigDecimal.BigDecimal",importDeclarations:['import * as BigDecimal from "effect/BigDecimal"']}),expected:"BigDecimal",toCodecJson:()=>Te()(LD,DD),toFormatter:()=>e=>fs(e)}),C8=LD.pipe(J(BD,DD)),Qg=Me(jP,{representation:{id:"effect/schema/ByteSize",payload:null},toCode:()=>({runtime:"Schema.ByteSize",Type:"ByteSize.ByteSize",importDeclarations:['import * as ByteSize from "effect/ByteSize"']}),expected:"ByteSize",toCodecJson:()=>Te()($u.check(bD(globalThis.BigInt(0))),we({decode:wl,encode:ah})),toCodecStringTree:()=>Te()(jD,vb)}),jD=$.annotate({expected:"a string that will be decoded as a ByteSize"}),T8=jD.pipe(J(Qg,vb)),w8=$u.pipe(J(Qg,f$)),k8=Np.pipe(J(Qg,l$));function dC(e,t){let r=_r()([e,t],([n,o])=>(s,a,i)=>{if(!HO(s))return C(new xt(a,s,i));switch(s._tag){case"Fail":return Wt(St(n)(s.error,i),{onSuccess:NS,onFailure:c=>vr(a,"error",c,s,i)});case"Die":return Wt(St(o)(s.defect,i),{onSuccess:MS,onFailure:c=>vr(a,"defect",c,s,i)});case"Interrupt":return y(s)}},{representation:{id:"effect/schema/CauseReason",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.CauseReason(${n[0].runtime}, ${n[1].runtime})`,Type:`Cause.Failure<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause.Failure",toCodec:([n,o])=>Te()(Ze([_e({_tag:Ct("Fail"),error:n}),_e({_tag:Ct("Die"),defect:o}),_e({_tag:Ct("Interrupt"),fiberId:Wg(Mu)})]),we({decode:s=>{switch(s._tag){case"Fail":return NS(s.error);case"Die":return MS(s.defect);case"Interrupt":return VO(s.fiberId)}},encode:s=>{switch(s._tag){case"Fail":return{_tag:"Fail",error:s.error};case"Die":return{_tag:"Die",defect:s.defect};case"Interrupt":return{_tag:"Interrupt",fiberId:s.fiberId}}}}))});return V(r.ast,{error:e,defect:t})}function mC(e,t){let r=_r()([e,t],([n,o])=>{let s=Ce(dC(n,o));return(a,i,c)=>qO(a)?Wt(St(s)(a.reasons,c),{onSuccess:Qf,onFailure:f=>vr(i,"failures",f,a,c)}):C(new xt(i,a,c))},{representation:{id:"effect/schema/Cause",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Cause(${n[0].runtime}, ${n[1].runtime})`,Type:`Cause.Cause<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause",toCodec:([n,o])=>Te()(Ce(dC(n,o)),we({decode:Qf,encode:({reasons:s})=>s}))});return V(r.ast,{error:e,defect:t})}function LU(e){return Te()(e,we({decode:UE,encode:rr}))}function A8(e){let t=_r()([e],([r])=>{let n=Ce(r);return(o,s,a)=>ch(o)?Wt(St(n)(rr(o),a),{onSuccess:UE,onFailure:i=>vr(s,"values",i,o,a)}):C(new xt(s,o,a))},{representation:{id:"effect/schema/Chunk",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Chunk(${r[0].runtime})`,Type:`Chunk.Chunk<${r[0].Type}>`}),expected:"Chunk",toCodec:([r])=>LU(Ce(r)),toCodecArbitrary:({constraint:r,typeParameters:[n]})=>LU(qg(Ce(n),r?.minLength,r?.maxLength)),toEquivalence:([r])=>NE(r)});return V(t.ast,{value:e})}function zD(){return ar((e,t)=>Re(pb(e),{onNone:()=>C(new ce({message:"Invalid DateTime input"},e,t)),onSome:r=>y(db(r))}))}var v8=we({decode:e=>hb(e),encode:e=>e.offset}),qD=$t({decode:(e,t)=>Re(TR(e),{onNone:()=>C(new ce({expected:"a valid IANA time zone"},e,t)),onSome:y}),encode:e=>y(e.id)}),HD=$t({decode:(e,t)=>Re(wR(e),{onNone:()=>C(new ce({expected:"a valid time zone"},e,t)),onSome:y}),encode:e=>y(Vl(e))}),WD=$t({decode:(e,t)=>Re(pb(e),{onNone:()=>C(new ce({expected:"a valid UTC DateTime string"},e,t)),onSome:r=>y(db(r))}),encode:e=>y(vR(e))}),VD=$t({decode:(e,t)=>Re(CR(e),{onNone:()=>C(new ce({expected:"a valid Zoned DateTime string"},e,t)),onSome:y}),encode:e=>y(gb(e))}),GD=-864e13,KD=864e13,O8=GD+840*60*1e3,_8=KD-840*60*1e3,P8=-720*60*1e3,F8=840*60*1e3,JD=["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"];function ZD(e,t,r){let n=Math.max(t,e?.minimum===void 0?t:e.minimum.epochMilliseconds+(e.exclusiveMinimum===!0?1:0)),o=Math.min(r,e?.maximum===void 0?r:e.maximum.epochMilliseconds-(e.exclusiveMaximum===!0?1:0));return n<=o?[n,o]:[t,r]}function _C(e,t){return Fr.check(pa({minimum:e,maximum:t}))}function QD(){return Ze([_C(P8,F8),bs(JD)])}var Yg=Me(e=>lb(e)&&yR(e),{representation:{id:"effect/schema/DateTimeUtc",payload:null},toCode:()=>({runtime:"Schema.DateTimeUtc",Type:"DateTime.Utc",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Utc",toCodecArbitrary:({constraint:e})=>{let[t,r]=ZD(e,GD,KD);return Nu()(_C(t,r),le(bR))},toCodecJson:()=>Te()($,WD),toFormatter:()=>e=>e.toString()}),R8=Uu.pipe(J(Yg,{decode:zD(),encode:le(kR)})),$8=$.annotate({expected:"a string that will be decoded as a DateTime.Utc"}).pipe(J(Yg,WD)),N8=Fr.pipe(J(Yg,{decode:zD(),encode:le(AR)})),M8=Me(gR,{representation:{id:"effect/schema/TimeZoneOffset",payload:null},toCode:()=>({runtime:"Schema.TimeZoneOffset",Type:"DateTime.TimeZone.Offset",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone.Offset",toCodecJson:()=>Te()(Fr,v8),toFormatter:()=>e=>Vl(e)}),YD=$.annotate({expected:"an IANA time zone identifier"}),XD=Me(xR,{representation:{id:"effect/schema/TimeZoneNamed",payload:null},toCode:()=>({runtime:"Schema.TimeZoneNamed",Type:"DateTime.TimeZone.Named",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone.Named",toCodecArbitrary:()=>Nu()(bs(JD),le(mb)),toCodecJson:()=>Te()(YD,qD),toFormatter:()=>e=>Vl(e)}),U8=YD.pipe(J(XD,qD)),e2=$.annotate({expected:"a time zone string (IANA identifier or offset like +03:00)"}),t2=Me(hR,{representation:{id:"effect/schema/TimeZone",payload:null},toCode:()=>({runtime:"Schema.TimeZone",Type:"DateTime.TimeZone",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone",toCodecArbitrary:()=>Nu()(QD(),le(e=>typeof e=="number"?hb(e):mb(e))),toCodecJson:()=>Te()(e2,HD),toFormatter:()=>e=>Vl(e)}),D8=e2.pipe(J(t2,HD)),r2=$.annotate({expected:"a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])"}),n2=Me(e=>lb(e)&&SR(e),{representation:{id:"effect/schema/DateTimeZoned",payload:null},toCode:()=>({runtime:"Schema.DateTimeZoned",Type:"DateTime.Zoned",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Zoned",toCodecArbitrary:({constraint:e})=>{let[t,r]=ZD(e,O8,_8);return Nu()(_e({epochMilliseconds:_C(t,r),timeZone:QD()}),le(({epochMilliseconds:n,timeZone:o})=>IR(n,{timeZone:o})))},toCodecJson:()=>Te()(r2,VD),toFormatter:()=>e=>gb(e),toEquivalence:()=>ER}),L8=r2.pipe(J(n2,VD)),Rr=(e,t,r,n)=>$.pipe(J(e,$t({decode:(o,s)=>{let a=t(o);return Tt(a)?y(a.success):C(new ce({message:a.failure.message},o,s))},encode:o=>y(r(o))}))).annotate({identifier:n}),_i=Me(ku,{identifier:"MacAddress"}),Du=Rr(_i,lU,z0,"MacAddressFromString"),zp=Me(Kt,{identifier:"Ipv4Address"}),PC=Rr(zp,Ti,Jt,"Ipv4AddressFromString"),Xg=Me(gn,{identifier:"Ipv6Address"}),o2=Rr(Xg,wi,Jt,"Ipv6AddressFromString"),da=Me(D0,{identifier:"IpAddress"}),Pi=Rr(da,ca,Jt,"IpAddressFromString"),tt=(e,t,r,n)=>uD(t,{expected:r})(e).annotate({identifier:n}),B8=tt(da,Au,"a multicast address","IpMulticastAddress"),j8=tt(Pi,Au,"a multicast address","IpMulticastAddressFromString"),z8=tt(_i,Au,"a multicast address","MacMulticastAddress"),q8=tt(Du,Au,"a multicast address","MacMulticastAddressFromString"),H8=tt(da,V0,"a unicast address","IpUnicastAddress"),W8=tt(Pi,V0,"a unicast address","IpUnicastAddressFromString"),V8=tt(_i,vg,"a unicast address","MacUnicastAddress"),G8=tt(Du,vg,"a unicast address","MacUnicastAddressFromString"),K8=tt(zp,_g,"a broadcast address","Ipv4BroadcastAddress"),J8=tt(PC,_g,"a broadcast address","Ipv4BroadcastAddressFromString"),Z8=tt(_i,Ag,"a broadcast address","MacBroadcastAddress"),Q8=tt(Du,Ag,"a broadcast address","MacBroadcastAddressFromString"),Y8=tt(da,W0,"a loopback address","IpLoopbackAddress"),X8=tt(Pi,W0,"a loopback address","IpLoopbackAddressFromString"),eQ=tt(da,G0,"a link-local address","IpLinkLocalAddress"),tQ=tt(Pi,G0,"a link-local address","IpLinkLocalAddressFromString"),rQ=tt(da,Og,"an unspecified address","IpUnspecifiedAddress"),nQ=tt(Pi,Og,"an unspecified address","IpUnspecifiedAddressFromString"),oQ=tt(zp,K0,"a private address","Ipv4PrivateAddress"),sQ=tt(PC,K0,"a private address","Ipv4PrivateAddressFromString"),aQ=tt(Xg,J0,"a unique-local address","Ipv6UniqueLocalAddress"),iQ=tt(o2,J0,"a unique-local address","Ipv6UniqueLocalAddressFromString"),cQ=tt(_i,q0,"a locally administered address","MacLocallyAdministeredAddress"),uQ=tt(Du,q0,"a locally administered address","MacLocallyAdministeredAddressFromString"),fQ=tt(_i,H0,"a universally administered address","MacUniversallyAdministeredAddress"),lQ=tt(Du,H0,"a universally administered address","MacUniversallyAdministeredAddressFromString"),s2=Me(CU,{identifier:"Ipv4Interface"}),pQ=Rr(s2,$g,Op,"Ipv4InterfaceFromString"),a2=Me(TU,{identifier:"Ipv6Interface"}),dQ=Rr(a2,Ng,Op,"Ipv6InterfaceFromString"),i2=Me(Ap,{identifier:"IpInterface"}),mQ=Rr(i2,Mg,Op,"IpInterfaceFromString"),c2=Me(kU,{identifier:"Ipv4Network"}),hQ=Rr(c2,vU,Pp,"Ipv4NetworkFromString"),u2=Me(AU,{identifier:"Ipv6Network"}),gQ=Rr(u2,OU,Pp,"Ipv6NetworkFromString"),f2=Me(_p,{identifier:"IpNetwork"}),xQ=Rr(f2,_U,Pp,"IpNetworkFromString"),yQ=Me(Ip,{identifier:"InetAddressV4"}),SQ=Me(Cp,{identifier:"InetAddressV6"}),l2=Me(L0,{identifier:"InetAddress"}),EQ=Rr(l2,Z0,Pg,"InetAddressFromString"),p2=Me(wg,{identifier:"UnixPathAddress"}),bQ=$.pipe(J(p2,we({decode:dU,encode:e=>e.path}))).annotate({identifier:"UnixPathAddressFromString"}),IQ=Me(uU,{identifier:"SocketAddress"}),Is=$.check(ke(gs,{expected:"a normalized domain name"})).pipe(Vg("~effect/net/Host/DomainName")).annotate({identifier:"DomainName"}),d2=Rr(Is,Fg,e=>e,"DomainNameFromString"),FC=$.check(ke(B0,{expected:"a canonical scoped IPv6 literal"})).pipe(Vg("~effect/net/NetAddress/ScopedIpv6Literal")).annotate({identifier:"ScopedIpv6Literal"}),m2=Rr(FC,Tp,e=>e,"ScopedIpv6LiteralFromString"),CQ=Ze([da,FC,Is]).annotate({identifier:"Host"}),TQ=Ze([Pi,m2,d2]).annotate({identifier:"HostFromString"}),h2=Me(X0,{identifier:"HostPort"}),wQ=Rr(h2,hU,eC,"HostPortFromString"),kQ=Fr.check(pa({minimum:0,maximum:65535},{expected:"a port number"})),AQ=$t({decode:(e,t)=>Re(Uk(e),{onNone:()=>C(new ce({expected:"a valid Duration string"},e,t)),onSome:y}),encode:e=>y(globalThis.String(e))}),vQ=$t({decode:e=>y(co(e)),encode:(e,t)=>Re(Dk(e),{onNone:()=>C(new ce({expected:"a Duration representable as a bigint"},e,t)),onSome:r=>y(r)})}),OQ=we({decode:e=>ic(e),encode:e=>Vo(e)}),qp=Me(Af,{representation:{id:"effect/schema/Duration",payload:null},toCode:()=>({runtime:"Schema.Duration",Type:"Duration.Duration",importDeclarations:['import * as Duration from "effect/Duration"']}),expected:"Duration",toCodecJson:()=>Te()(Ze([_e({_tag:Ct("Infinity")}),_e({_tag:Ct("NegativeInfinity")}),_e({_tag:Ct("Nanos"),value:$u}),_e({_tag:Ct("Millis"),value:Fr})]),we({decode:e=>{switch(e._tag){case"Infinity":return Da;case"NegativeInfinity":return ac;case"Nanos":return co(e.value);case"Millis":return ic(e.value)}},encode:e=>{switch(e.value._tag){case"Infinity":return{_tag:"Infinity"};case"NegativeInfinity":return{_tag:"NegativeInfinity"};case"Nanos":return{_tag:"Nanos",value:e.value.nanos};case"Millis":return{_tag:"Millis",value:e.value.millis}}}}))}),_Q=$.annotate({expected:"a string that will be decoded as a Duration"}),PQ=_Q.pipe(J(qp,AQ)),FQ=$u.pipe(J(qp,vQ)),RQ=Np.pipe(J(qp,OQ)),$Q=bs(nC),g2=(e,t)=>$.pipe(J(e,$t({decode:(r,n)=>{let o=t(r);return Se(o)?C(new ce({message:o.failure.message},r,n)):Jt(o.success)===r?y(o.success):C(new ce({message:"expected a canonical address"},r,n))},encode:r=>y(Jt(r))}))),fC=Fr.check(pa({minimum:0,maximum:255})),Ou=Fr.check(pa({minimum:0,maximum:65535})),x2=Fr.check(pa({minimum:0,maximum:4294967295})),Ug=x2.pipe(J(qp,we({decode:vf,encode:uo}))),xn=(e,t)=>Me(r=>oC(r)&&r._tag===e,{identifier:`Dns${e.charAt(0)}${e.slice(1).toLowerCase()}Record`,toCodecJson:()=>{let r=Mp(e,t);return Te()(r,$t({decode:(n,o)=>{let{_tag:s,...a}=n,i=EU(e,a);return Tt(i)?y(i.success):C(new ce({message:i.failure.message},n,o))},encode:n=>y({...n})}))}}),y2=xn("A",{address:g2(zp,Ti)}),S2=xn("AAAA",{address:g2(Xg,wi)}),E2=xn("CAA",{critical:zg,tag:$.check(Oi(/^[a-z0-9]+$/i)),value:$}),b2=xn("CNAME",{target:Is}),I2=xn("MX",{exchange:Is,priority:Ou}),C2=xn("NAPTR",{order:Ou,preference:Ou,flags:$,service:$,regexp:$,replacement:Is}),T2=xn("NS",{host:Is}),w2=xn("PTR",{host:AC}),k2=xn("SOA",{primary:Is,admin:AC,serial:x2,refresh:Ug,retry:Ug,expire:Ug,minimum:Ug}),A2=xn("SRV",{target:Is,port:Ou,priority:Ou,weight:Ou}),v2=xn("TLSA",{certUsage:fC,selector:fC,matchingType:fC,data:UD}),O2=xn("TXT",{chunks:Hg($)}),NQ=Ze([y2,S2,E2,b2,I2,C2,T2,w2,k2,A2,v2,O2]).annotate({identifier:"DnsRecord"});function MQ(e,t,r){let n=_r()([e,t,r],([o,s,a])=>{let i=mC(s,a);return(c,f,u)=>{if(!JO(c))return C(new xt(f,c,u));switch(c._tag){case"Success":return Wt(St(o)(c.value,u),{onSuccess:Xo,onFailure:l=>vr(f,"value",l,c,u)});case"Failure":return Wt(St(i)(c.cause,u),{onSuccess:yo,onFailure:l=>vr(f,"cause",l,c,u)})}}},{representation:{id:"effect/schema/Exit",payload:null},toCode:({typeParameters:o})=>({runtime:`Schema.Exit(${o[0].runtime}, ${o[1].runtime}, ${o[2].runtime})`,Type:`Exit.Exit<${o[0].Type}, ${o[1].Type}, ${o[2].Type}>`,importDeclarations:['import * as Exit from "effect/Exit"']}),expected:"Exit",toCodec:([o,s,a])=>Te()(Ze([_e({_tag:Ct("Success"),value:o}),_e({_tag:Ct("Failure"),cause:mC(s,a)})]),we({decode:i=>i._tag==="Success"?Xo(i.value):yo(i.cause),encode:i=>ut(i)?{_tag:"Success",value:i.value}:{_tag:"Failure",cause:i.cause}}))});return V(n.ast,{value:e,error:t,defect:r})}function BU(e,t,r){return _e({type:Ct(e),nodes:Ce(_e({index:ki,data:t})),edges:Ce(_e({index:ki,source:ki,target:ki,data:r}))})}function jU(e,t){let r=-1,n=new Set;for(let o=0;o<e.nodes.length;o++){let s=e.nodes[o].index;if(s<=r)return C(new kt(["nodes",o,"index"],new ce({expected:"a strictly increasing node index"},s,t)));r=s,n.add(s)}r=-1;for(let o=0;o<e.edges.length;o++){let s=e.edges[o];if(s.index<=r)return C(new kt(["edges",o,"index"],new ce({expected:"a strictly increasing edge index"},s.index,t)));if(r=s.index,!n.has(s.source))return C(new kt(["edges",o,"source"],new ce({expected:"an encoded node index"},s.source,t)));if(!n.has(s.target))return C(new kt(["edges",o,"target"],new ce({expected:"an encoded node index"},s.target,t)))}return y(ng(e))}function UQ(e,t,r){return!s0(e)||e.mutable||e.type!==t?C(new ce({expected:`an immutable ${t} Graph`},e,r)):y(pp(e))}function DQ(e,t){return(r,n)=>{let o=pp(r),s=pp(n);if(o.type!==s.type||o.nodes.length!==s.nodes.length||o.edges.length!==s.edges.length)return!1;for(let a=0;a<o.nodes.length;a++)if(o.nodes[a].index!==s.nodes[a].index||!e(o.nodes[a].data,s.nodes[a].data))return!1;for(let a=0;a<o.edges.length;a++){let i=o.edges[a],c=s.edges[a],f=o.type==="directed"?i.source===c.source&&i.target===c.target:i.source===c.source&&i.target===c.target||i.source===c.target&&i.target===c.source;if(i.index!==c.index||!f||!t(i.data,c.data))return!1}return!0}}function LQ(e,t,r){return Nu()(Ze([jg,_e({nodes:Hg(t),edges:Ce(No([ki,ki,r]))})]),le(n=>{if(n===null)return ng({type:e,nodes:[],edges:[]});let o=n.nodes.map((s,a)=>({index:a,data:s}));return ng({type:e,nodes:o,edges:n.edges.map(([s,a,i],c)=>({index:c,source:s%o.length,target:a%o.length,data:i}))})}))}function BQ(e,t,r){let n=_r()([t,r],([o,s])=>{let a=BU(e,o,s);return(i,c,f)=>!s0(i)||i.mutable||i.type!==e?C(new xt(c,i,f)):L(St(a)(pp(i),f),u=>jU(u,f))},{representation:{id:"effect/schema/Graph",payload:e},toCode:({typeParameters:o})=>({runtime:`Schema.Graph(${N(e)}, ${o[0].runtime}, ${o[1].runtime})`,Type:`Graph.Graph<${o[0].Type}, ${o[1].Type}, ${N(e)}>`,importDeclarations:['import * as Graph from "effect/Graph"']}),expected:`an immutable ${e} Graph`,toCodec:([o,s])=>Te()(BU(e,o,s),$t({decode:jU,encode:(a,i)=>UQ(a,e,i)})),toCodecArbitrary:({typeParameters:[o,s]})=>LQ(e,o,s),toEquivalence:([o,s])=>DQ(o,s)});return V(n.ast,{type:e,node:t,edge:r})}function zU(e){return Te()(e,we({decode:BI,encode:fp}))}function jQ(e,t){let r=_r()([e,t],([n,o])=>{let s=Ce(No([n,o]));return(a,i,c)=>SM(a)?Wt(St(s)(fp(a),c),{onSuccess:BI,onFailure:f=>vr(i,"entries",f,a,c)}):C(new xt(i,a,c))},{representation:{id:"effect/schema/HashMap",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.HashMap(${n[0].runtime}, ${n[1].runtime})`,Type:`HashMap.HashMap<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as HashMap from "effect/HashMap"']}),expected:"HashMap",toCodec:([n,o])=>zU(Ce(No([n,o]))),toCodecArbitrary:({constraint:n,typeParameters:[o,s]})=>zU(qg(Ce(No([o,s])).check(kD()),n?.minSize,n?.maxSize)),toEquivalence:([n,o])=>gd(n,o)});return V(r.ast,{key:e,value:t})}function qU(e){return Te()(e,we({decode:qI,encode:rr}))}function zQ(e){let t=_r()([e],([r])=>{let n=Ce(r);return(o,s,a)=>TM(o)?Wt(St(n)(rr(o),a),{onSuccess:qI,onFailure:i=>vr(s,"values",i,o,a)}):C(new xt(s,o,a))},{representation:{id:"effect/schema/HashSet",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.HashSet(${r[0].runtime})`,Type:`HashSet.HashSet<${r[0].Type}>`}),expected:"HashSet",toCodec:([r])=>qU(Ce(r)),toCodecArbitrary:({constraint:r,typeParameters:[n]})=>qU(qg(Ce(n).check(kC()),r?.minSize,r?.maxSize)),toEquivalence:([r])=>pf(r)});return V(t.ast,{value:e})}function Fi(e){let t=_r()([e],([r])=>(n,o,s)=>Od(n)?Ke(n)?ml:Wt(St(r)(n.value,s),{onSuccess:R,onFailure:a=>vr(o,"value",a,n,s)}):C(new xt(o,n,s)),{representation:{id:"effect/schema/Option",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Option(${r[0].runtime})`,Type:`Option.Option<${r[0].Type}>`,importDeclarations:['import * as Option from "effect/Option"']}),expected:"Option",toCodec:([r])=>Te()(Ze([_e({_tag:Ct("Some"),value:r}),_e({_tag:Ct("None")})]),we({decode:n=>n._tag==="None"?v():R(n.value),encode:n=>ve(n)?{_tag:"Some",value:n.value}:{_tag:"None"}}))});return V(t.ast,{value:e})}function qQ(e){return SC(e).pipe(J(Fi(Pr(e)),x$()))}function HQ(e){return Wg(e).pipe(J(Fi(Pr(e)),y$()))}function WQ(e,t){return iD(e).pipe(J(Fi(Pr(e)),S$(t)))}var _2=Me(vM,{representation:{id:"effect/http/Cookie",payload:null},toCode:()=>({runtime:"Schema.Cookie",Type:"Cookies.Cookie",importDeclarations:['import * as Cookies from "effect/http/Cookies"']}),expected:"Cookie"}),P2=Me(AM,{representation:{id:"effect/http/Cookies",payload:null},toCode:()=>({runtime:"Schema.Cookies",Type:"Cookies.Cookies",importDeclarations:['import * as Cookies from "effect/http/Cookies"']}),expected:"Cookies",toCodecJson:()=>Te()(Ce($),we({decode:OM,encode:$M})),toCodecIso:()=>Te()(vi($,_2),we({decode:JI,encode:e=>e.cookies}))}),VQ=P2.pipe(J(vi($,$),we({decode:RM,encode:e=>ZI(globalThis.Object.entries(e).map(([t,r])=>FM(t,r)))}))),GQ=Me(DM,{representation:{id:"effect/http/Headers",payload:null},toCode:()=>({runtime:"Schema.Headers",Type:"Headers.Headers",importDeclarations:['import * as Headers from "effect/http/Headers"']}),expected:"Headers",toEquivalence:()=>e0,toCodec:()=>Te()(vi($,$),we({decode:LM,encode:e=>({...e})}))}),RC=Me(r0,{representation:{id:"effect/http/UrlParams",payload:null},toCode:()=>({runtime:"Schema.UrlParams",Type:"UrlParams.UrlParams",importDeclarations:['import * as UrlParams from "effect/http/UrlParams"']}),expected:"UrlParams",toEquivalence:()=>n0,toCodec:()=>Te()(Ce(No([$,$])),we({decode:rg,encode:e=>e.params}))}),KQ=(e,t)=>RC.pipe(J(OC($p,t),$t({decode:r=>Re(zM(r,e),{onNone:()=>C(new kt([e],new ea(void 0))),onSome:y}),encode:r=>y(rg([[e,r]]))}))),JQ=RC.pipe(J(vi($,Ze([$,Hg($)])),we({decode:qM,encode:BM})));function ZQ(e){return xs(e).pipe(J(Fi(Pr(e)),E$()))}function QQ(e){return Es(e).pipe(J(Fi(Pr(e)),b$()))}function YQ(e,t){let r=t===void 0?"omit":t.onNoneEncoding,n=r===null?null:void 0;return Es(SC(e)).pipe(J(Fi(Pr(e)),vh({decode:o=>o.pipe(tc(dd),R),encode:r==="omit"?ec:o=>R(bt(ec(o),()=>n))})))}function F2(e,t){let r=typeof t?.label=="string"?t.label:void 0,n=t?.disallowJsonEncode===!0,o=r!==void 0?n?{label:r,disallowJsonEncode:!0}:{label:r}:n?{disallowJsonEncode:!0}:void 0,s=r!==void 0?St(Ct(r)):void 0,a=_r()([e],([i])=>(c,f,u)=>{if(QI(c)){let l=s!==void 0?bl(s(c.label,u),p=>new kt(["label"],p)):xe;return Rt(l,()=>Wt(St(i)(sa(c),u),{onSuccess:p=>Dn(p,{label:c.label}),onFailure:()=>new At(f,[new kt(["value"],new ce(void 0,c,u))],c,u)}))}return C(new xt(f,c,u))},{representation:{id:"effect/schema/Redacted",payload:o??null},toCode:({typeParameters:i})=>({runtime:o!==void 0?`Schema.Redacted(${i[0].runtime}, ${N(o)})`:`Schema.Redacted(${i[0].runtime})`,Type:`Redacted.Redacted<${i[0].Type}>`,importDeclarations:['import * as Redacted from "effect/Redacted"']}),expected:"Redacted",toCodecJson:([i])=>Te()(i,{decode:le(c=>Dn(c,{label:r})),encode:n?bh(c=>"Cannot serialize Redacted"+(ve(c)&&typeof c.value.label=="string"?` with label: "${c.value.label}"`:"")):le(sa)}),toEquivalence:([i])=>UM(i)});return V(a.ast,{value:e})}function XQ(e,t){return J(F2(Pr(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:le(r=>Dn(r,{label:t?.label})),encode:t?.disallowEncode?bh(r=>"Cannot encode Redacted"+(ve(r)&&typeof r.value.label=="string"?` with label: "${r.value.label}"`:"")):le(sa)})(e)}function eY(e,t){let r=_r()([e,t],([n,o])=>(s,a,i)=>{if(!bk(s))return C(new xt(a,s,i));switch(s._tag){case"Success":return Wt(l0(n)(s.success,i),{onSuccess:H,onFailure:c=>vr(a,"success",c,s,i)});case"Failure":return Wt(l0(o)(s.failure,i),{onSuccess:Z,onFailure:c=>vr(a,"failure",c,s,i)})}},{representation:{id:"effect/schema/Result",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Result(${n[0].runtime}, ${n[1].runtime})`,Type:`Result.Result<${n[0].Type}, ${n[1].Type}>`,importDeclarations:['import * as Result from "effect/Result"']}),expected:"Result",toCodec:([n,o])=>Te()(Ze([_e({_tag:Ct("Success"),success:n}),_e({_tag:Ct("Failure"),failure:o})]),we({decode:s=>s._tag==="Success"?H(s.success):Z(s.failure),encode:s=>Tt(s)?{_tag:"Success",success:s.success}:{_tag:"Failure",failure:s.failure}}))});return V(r.ast,{success:e,failure:t})}var tY=globalThis.Symbol.for("immer-draftable"),hC={};function $C(e,t,r,n,o){let s=nY(r,t,n),a=R2(t),i=class extends e{constructor(...[c,f]){let l=f?.["~payload"],p=l?.token===hC?l.value:r.make(c??{},f);super(p,{...f,disableChecks:!0,"~payload":{token:hC,value:p}})}static[Fp]=Fp;get[a](){return a}static[tY]=!0;static identifier=t;static fields=r.fields;static get ast(){return s(this).ast}static pipe(){return te(this,arguments)}static rebuild(c){return s(this).rebuild(c)}static make(c,f){return fg(s(this))(c??{},f)}static makeOption(c,f){return ug(s(this))(c??{},f)}static makeEffect(c,f){return s(this).makeEffect(c??{},f)}static annotate(c){return this.rebuild(Rn(this.ast,c))}static annotateKey(c){return this.rebuild(rp(this.ast,c))}static check(...c){return this.rebuild(Ro(this.ast,c))}static extend(c){return(f,u)=>{let l=Hp(f)?f:_e(f),p={...r.fields,...l.fields},h=Nh(p,r.ast.checks,{identifier:c});return $C(this,c,yC(Ro(h,l.ast.checks),p),u,o)}}static mapFields(c,f){return r.mapFields(c,f)}};return o!==void 0&&Object.assign(i.prototype,o(t)),i}function rY(e){return new Ne(le(t=>new e(t,{"~payload":{token:hC,value:t}})),_o())}function R2(e){return`~effect/Schema/Class/${e}`}function nY(e,t,r){let n;return o=>{if(n!==void 0)return n;let s=R2(t),a=f=>f instanceof o||A(f,s),i=rY(o),c=V(new iu([e.ast],()=>(f,u,l)=>a(f)?y(f):C(new xt(u,f,l)),{identifier:t,[yh]:([f])=>({isConstructed:a,link:new ft(f,i)}),toCodec:([f])=>new ft(f.ast,i),toEquivalence:([f])=>f,toFormatter:([f])=>u=>`${o.identifier}(${f(u)})`,[Ul]:ou(e.ast),...r}));return n=J(c,i)(e)}}function Hp(e){return Bg(e)}var $2=e=>(t,r)=>{let n=Hp(t)?t:_e(t);return $C(Hd,e,n,r,o=>({toString(){return`${o}(${N({...this})})`}}))},oY=e=>(t,r,n)=>{let o=Hp(r)?r.mapFields(s=>({_tag:ys(t),...s}),{unsafePreserveChecks:!0}):Mp(t,r);return $2(e??t)(o,n)},ex=e=>(t,r)=>{let n=Hp(t)?t:_e(t);return $C(bf,e,n,r,s=>({name:s}))},Hn=e=>(t,r,n)=>{let o=Hp(r)?r.mapFields(s=>({_tag:ys(t),...s}),{unsafePreserveChecks:!0}):Mp(t,r);return ex(e??t)(o,n)};function sY(e){return t=>t.annotate({toFormatter:e})}function aY(e,t){return Y1(e.ast,t)}function iY(e){return t=>t.annotate({toEquivalence:e})}function cY(e){return v0(e.ast)}function uY(e,t){return Sp(e.ast,t)}function fY(e,t){let r=Sp(Su(e.ast),t);return Eg(r,t)}var lY=hg,pY=gg,NC=xg,dY=A1;function mY(e,t){return G1(e,t)}function hY(e){return sU(e)}function gY(e){return aU(e)}function xY(e){return iU(e)}function yY(e,t){return r=>V(Rn(r.ast,{toCodecIso:()=>new ft(e.ast,Ah(t))}),{schema:r})}function SY(e){return V1(e)}function EY(e){let t=cD(()=>r),r=Ze([e,Ce(t),vi($,t)]);return r}var tx=V(Rn(su,{toCode:()=>({runtime:"Schema.Json",Type:"Schema.Json"})})),bY=vi($,tx),IY=_e({message:$,name:xs($),stack:xs($),cause:xs(tx)}),CY=V(Rn(TN,{toCode:()=>({runtime:"Schema.MutableJson",Type:"Schema.MutableJson"})}));function TY(e){return us(e.ast)}function wY(e){return e.ast.context?.annotations}var N2="~effect/Terminal",MC="~effect/Terminal/QuitError",Lu=class extends ex("QuitError")({_tag:ys("QuitError")}){[MC]=MC},M2=e=>A(e,MC),Wn=Ye("effect/Terminal"),U2=e=>Wn.of({...e,[N2]:N2});import*as nx from"node:readline";var D2=B(function*(e=B2){let t=process.stdin,r=process.stdout,n=yield*Hc(),o=t.readableEnded,s=!1,a=()=>{o=!0,s||ss(n)};t.once("end",a),yield*th(()=>fe(()=>t.off("end",a)));let i=yield*HF({acquire:fn(fe(()=>{let h=nx.createInterface({input:t,escapeCodeTimeout:50}),g=b=>ni(n,b),x=()=>{s=!1,ss(n)};return s=!0,nx.emitKeypressEvents(t,h),h.on("line",g),h.once("close",x),t.isTTY&&t.setRawMode(!0),{rl:h,onClose:x,onLine:g}}),({rl:h,onClose:g,onLine:x})=>fe(()=>{s=!1,h.off("line",x),h.off("close",g),t.isTTY&&t.setRawMode(!1),h.close(),o&&ss(n)})),idleTimeToLive:"10 millis"}),c=fe(()=>r.columns??0),f=fe(()=>r.rows??0),u=Ut(function*(){let h=yield*Hc(),g=(T,w)=>{let P={input:Fs(T),key:{name:w.name??"",ctrl:!!w.ctrl,meta:!!w.meta,shift:!!w.shift}};ni(h,P),e(P)&&ss(h)},x=setInterval(()=>{},2147483647),b=()=>{clearInterval(x),ss(h)};return yield*th(()=>fe(()=>{clearInterval(x),t.off("keypress",g),t.off("end",b)})),t.on("keypress",g),o?b():(yield*ZE(i),t.once("end",b)),h}),l=Ie(()=>pF(n).pipe(L(Re({onNone:()=>Ks(es(ZE(i),as(n))),onSome:y})),wt(()=>new Lu({}))));return U2({columns:c,rows:f,readInput:u,readLine:l,display:h=>El(or(g=>{r.write(h,x=>Iw(x)?g(xe):g(C(ln({module:"Terminal",method:"display",description:"Failed to write prompt to stdout",cause:x}))))}))})}),L2=Tc(Wn,D2(B2));function B2(e){let t=e.key;return t.name==="escape"||t.ctrl&&(t.name==="c"||t.name==="d")}var j2=L2;var z2=l_(DN,Dm(oM,JN,aM,uM,j2));function OY(e){return{_tag:"Value",value:e}}function _Y(e,t){return{_tag:"Record",keys:e,value:t}}function PY(e,t){return{_tag:"Array",length:e,value:t}}var q2=ge("effect/ConfigProvider",{defaultValue:()=>DY()}),FY={...Xt,toJSON(){return{_id:"ConfigProvider"}}},RY=e=>e;function $Y(e,t){let r=Object.create(FY);return r.load=e,r.mapInput=t,r}function H2(e,t){return $Y(r=>e(t(r)),r=>H2(e,n=>r(t(n))))}function NY(e){return H2(e,RY)}function MY(e,t){return e===""&&!t?void 0:e}function UY(e,t){let r=t?.preserveEmptyStrings===!0,n=LY(e);return NY(o=>y(BY(n,e,o,r)))}function DY(e){let t=e?.env??{...globalThis.process?.env,...import.meta?.env};return UY(t,{preserveEmptyStrings:e?.preserveEmptyStrings})}function LY(e){let t={};for(let[r,n]of Object.entries(e)){if(n===void 0)continue;let o=r.split("_"),s=t;for(let a of o){let i=s.children??=Object.create(null);s=i[a]??={}}}return t}function BY(e,t,r,n){let o=r.map(String).join("_"),s=MY(Object.hasOwn(t,o)?t[o]:void 0,n),a=jY(e,r),i=a?.children?Object.keys(a.children):[];if(i.length===0)return s===void 0?void 0:OY(s);if(i.every(nc)){let f=Math.max(...i.map(u=>parseInt(u,10)))+1;return PY(f,s)}return _Y(new Set(i),s)}function jY(e,t){if(t.length===0)return e;let r=e;for(let n of t)if(r=r?.children?.[String(n)],!r)return;return r}var V2="~effect/Config";var zY={...so({label:"Config",evaluate(e){return this.parse(e.getRef(q2))}}),[V2]:V2,toJSON(){return{_id:"Config"}}};function G2(e){let t=Object.create(zY);return t.evaluator=e,t.parse=r=>Rt(e(r,[]),gl),t}var K2=(e,t,r)=>e.evaluator(t,r),qY=m(2,(e,t)=>G2((r,n)=>re(K2(e,r,n),Nt(t))));var HY=m(2,(e,t)=>G2((r,n)=>ei(K2(e,r,n),o=>Se(o)?H(t):o))),J2=e=>e.pipe(qY(R),HY(v()));var Cs={};Kn(Cs,{Console:()=>Q2,assert:()=>WY,clear:()=>VY,consoleWith:()=>Dt,count:()=>GY,countReset:()=>KY,debug:()=>JY,dir:()=>ZY,dirxml:()=>QY,error:()=>ox,group:()=>YY,info:()=>XY,log:()=>Zt,table:()=>e9,time:()=>t9,timeLog:()=>r9,trace:()=>n9,warn:()=>o9,withGroup:()=>s9,withTime:()=>a9});var Q2=FS,Dt=e=>ie(t=>e(t.getRef(Q2))),WY=(e,...t)=>Dt(r=>G(()=>{r.assert(e,...t)})),VY=Dt(e=>G(()=>{e.clear()})),GY=e=>Dt(t=>G(()=>{t.count(e)})),KY=e=>Dt(t=>G(()=>{t.countReset(e)})),JY=(...e)=>Dt(t=>G(()=>{t.debug(...e)})),ZY=(e,t)=>Dt(r=>G(()=>{r.dir(e,t)})),QY=(...e)=>Dt(t=>G(()=>{t.dirxml(...e)})),ox=(...e)=>Dt(t=>G(()=>{t.error(...e)})),YY=e=>Dt(t=>Ha(G(()=>{e?.collapsed?t.groupCollapsed(e.label):t.group(e?.label)}),()=>G(()=>{t.groupEnd()}))),XY=(...e)=>Dt(t=>G(()=>{t.info(...e)})),Zt=(...e)=>Dt(t=>G(()=>{t.log(...e)})),e9=(e,t)=>Dt(r=>G(()=>{r.table(e,t)})),t9=e=>Dt(t=>Ha(G(()=>{t.time(e)}),()=>G(()=>{t.timeEnd(e)}))),r9=(e,...t)=>Dt(r=>G(()=>{r.timeLog(e,...t)})),n9=(...e)=>Dt(t=>G(()=>{t.trace(...e)})),o9=(...e)=>Dt(t=>G(()=>{t.warn(...e)})),s9=m(e=>oe(e[0]),(e,t)=>Dt(r=>Gf(G(()=>{t?.collapsed?r.groupCollapsed(t.label):r.group(t?.label)}),()=>e,()=>G(()=>{r.groupEnd()})))),a9=m(e=>oe(e[0]),(e,t)=>Dt(r=>Gf(G(()=>{r.time(t)}),()=>e,()=>G(()=>{r.timeEnd(t)}))));var yx={};Kn(yx,{ChoiceWithValue:()=>pX,Date:()=>W7,Directory:()=>q7,File:()=>z7,FileParse:()=>Z7,FileSchema:()=>Q7,FileText:()=>J7,Finite:()=>H7,Int:()=>j7,Literals:()=>V7,Never:()=>Y7,Path:()=>G7,Redacted:()=>K7,String:()=>B7,atLeast:()=>cX,atMost:()=>uX,between:()=>fX,filter:()=>mX,filterMap:()=>hX,map:()=>sX,mapEffect:()=>aX,mapTryCatch:()=>iX,optional:()=>X7,orElse:()=>gX,orElseResult:()=>xX,variadic:()=>oX,withDefault:()=>tX,withDescription:()=>eX,withFallbackConfig:()=>rX,withFallbackPrompt:()=>nX,withMetavar:()=>dX,withSchema:()=>lX});var We="~effect/cli/CliError",DC=e=>A(e,We),ma=class extends Hn(`${We}/UnrecognizedOption`)("UnrecognizedOption",{option:$,command:Es(Ce($)),suggestions:Ce($)}){[We]=We;get message(){let t=this.suggestions.length>0?`
|
|
36
36
|
|
|
37
37
|
Did you mean this?
|
|
38
38
|
${this.suggestions.join(`
|
|
39
|
-
`)}`:"";return(this.command?`Unrecognized flag: ${this.option} in command ${this.command.join(" ")}`:`Unrecognized flag: ${this.option}`)+t}},
|
|
39
|
+
`)}`:"";return(this.command?`Unrecognized flag: ${this.option} in command ${this.command.join(" ")}`:`Unrecognized flag: ${this.option}`)+t}},Wp=class extends Hn(`${We}/DuplicateOption`)("DuplicateOption",{option:$,parentCommand:$,childCommand:$}){[We]=We;get message(){return`Duplicate flag name "${this.option}" in parent command "${this.parentCommand}" and subcommand "${this.childCommand}". Parent will always claim this flag (Mode A semantics). Consider renaming one of them to avoid confusion.`}},Bu=class extends Hn(`${We}/MissingOption`)("MissingOption",{option:$}){[We]=We;get message(){return`Missing required flag: --${this.option}`}},ju=class extends Hn(`${We}/MissingArgument`)("MissingArgument",{argument:$}){[We]=We;get message(){return`Missing required argument: ${this.argument}`}},Vp=class extends Hn(`${We}/UnexpectedArgument`)("UnexpectedArgument",{arguments:Ce($)}){[We]=We;get message(){return`Unexpected positional ${this.arguments.length===1?"argument":"arguments"}: ${this.arguments.map(r=>JSON.stringify(r)).join(", ")}`}},mr=class extends Hn(`${We}/InvalidValue`)("InvalidValue",{option:$,value:$,expected:$,kind:Ze([Ct("flag"),Ct("argument")])}){[We]=We;get message(){let t=this.expected.startsWith("Expected ")||this.expected.startsWith("Expected:")?this.expected:`Expected: ${this.expected}`;return this.kind==="argument"?`Invalid value for argument <${this.option}>: "${this.value}". ${t}`:this.value.length===0?`Missing value for flag --${this.option}. ${t}`:`Invalid value for flag --${this.option}: "${this.value}". ${t}`}},Gp=class extends Hn(`${We}/UnknownSubcommand`)("UnknownSubcommand",{subcommand:$,parent:Es(Ce($)),suggestions:Ce($)}){[We]=We;get message(){let t=this.suggestions.length>0?`
|
|
40
40
|
|
|
41
41
|
Did you mean this?
|
|
42
42
|
${this.suggestions.join(`
|
|
43
|
-
`)}`:"";return this.parent?`Unknown subcommand "${this.subcommand}" for "${this.parent.join(" ")}"${t}`:`Unknown subcommand "${this.subcommand}"${t}`}},
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
`)}`:"";return this.parent?`Unknown subcommand "${this.subcommand}" for "${this.parent.join(" ")}"${t}`:`Unknown subcommand "${this.subcommand}"${t}`}},UC=class extends Hn(`${We}/UserError`)("UserError",{cause:vC(),userMessage:xs($)}){[We]=We;[Js]=!0;get message(){return this.userMessage?this.userMessage:typeof this.cause=="string"&&this.cause?this.cause:this.cause instanceof Error&&this.cause.message?this.cause.message:"An error occurred"}},i9=Ze([ma,Wp,Bu,ju,Vp,mr,Gp,UC]),Ts=class extends Hn(`${We}/ShowHelp`)("ShowHelp",{commandPath:Ce($),errors:Ce(i9)}){[We]=We;[Cl]=this.errors.length?1:0;[Js]=!1;get message(){return"Help requested"}};var Y2=Object.prototype.hasOwnProperty,c9=e=>{let t=[],r=0,n=0;for(;(n=e.indexOf(".",n))!==-1;)(n===0||e[n-1]!=="\\")&&(t.push(e.slice(r,n)),r=n+1),n++;return t.push(e.slice(r)),t},u9=e=>e.length>=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")),LC=e=>{let t=(e??"").trim();if(u9(t)){t[0]==="'"&&(t=t.slice(1,-1));try{return JSON.parse(t)}catch{return t}}let r=!1,n="";for(let o of t)if(r)n+=o===";"||o==="#"||o==="\\"?o:`\\${o}`,r=!1;else{if(o===";"||o==="#")break;o==="\\"?r=!0:n+=o}return n.trim()},X2=e=>{let t=Object.create(null),r=t,n=/^\[([^\]]*)\]\s*$/,o=/^([^=]+)(=(.*))?$/;for(let a of e.split(/[\r\n]+/g)){if(a.length===0||/^\s*(?:[;#]|$)/.test(a))continue;let i=n.exec(a);if(i!==null){let g=LC(i[1]);g==="__proto__"?r=Object.create(null):r=t[g]??=Object.create(null);continue}let c=o.exec(a);if(c===null)continue;let f=LC(c[1]),u=f.length>2&&f.endsWith("[]"),l=u?f.slice(0,-2):f;if(l==="__proto__")continue;let p=c[2]===void 0?!0:LC(c[3]),h=p==="true"||p==="false"||p==="null"?JSON.parse(p):p;u&&(Y2.call(r,l)?Array.isArray(r[l])||(r[l]=[r[l]]):r[l]=[]),Array.isArray(r[l])?r[l].push(h):r[l]=h}let s=[];for(let a of Object.keys(t)){if(typeof t[a]!="object"||t[a]===null||Array.isArray(t[a]))continue;let i=c9(a),c=i.pop(),f=c.replace(/\\\./g,".");r=t;for(let u of i)u!=="__proto__"&&((!Y2.call(r,u)||typeof r[u]!="object"||r[u]===null)&&(r[u]=Object.create(null)),r=r[u]);r===t&&f===c||(r[f]=t[a],s.push(a))}for(let a of s)delete t[a];return t};var eL=Object.prototype.hasOwnProperty,Jp=()=>Object.create(null),tL=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof Date),BC=class{root=Jp();input;current=this.root;index=0;line=1;column=1;explicitTables=new Set;constructor(t){this.input=t}parse(){for(;;){if(this.skipDocumentWhitespace(),this.done)return this.root;if(this.peek()==="[")this.parseHeader();else{let t=this.parseKeyPath("=");this.skipInlineWhitespace(),this.expect("="),this.skipInlineWhitespace(),this.assign(this.current,t,this.parseValue()),this.finishStatement()}}}parseHeader(){this.expect("[");let t=this.peek()==="[";t&&this.advance(),this.skipInlineWhitespace();let r=this.parseKeyPath("]");this.skipInlineWhitespace(),this.expect("]"),t&&this.expect("]"),this.finishStatement();let n=this.resolveTable(r,t);!t&&this.explicitTables.has(n)&&this.fail(`Cannot redefine table '${r.join(".")}'`),t||this.explicitTables.add(n),this.current=n}resolveTable(t,r){let n=this.root;for(let o=0;o<t.length;o++){let s=t[o],a=o===t.length-1,i=n[s];if(a&&r){i===void 0&&(i=[],n[s]=i),Array.isArray(i)||this.fail(`Cannot redefine existing key '${t.slice(0,o+1).join(".")}'`);let c=Jp();return i.push(c),c}i===void 0&&(i=Jp(),n[s]=i),Array.isArray(i)&&(i=i[i.length-1]),tL(i)||this.fail(`Cannot redefine existing key '${t.slice(0,o+1).join(".")}'`),n=i}return n}assign(t,r,n){let o=t;for(let a=0;a<r.length-1;a++){let i=r[a],c=o[i];if(c===void 0){let f=Jp();o[i]=f,o=f}else tL(c)?o=c:this.fail(`Cannot redefine existing key '${r.slice(0,a+1).join(".")}'`)}let s=r[r.length-1];eL.call(o,s)&&this.fail(`Cannot redefine existing key '${r.join(".")}'`),o[s]=n}parseKeyPath(t){let r=[];for(;;){this.skipInlineWhitespace();let n=this.peek(),o;if(n==='"')o=this.parseBasicString(!1);else if(n==="'")o=this.parseLiteralString(!1);else{let s=this.index;for(;/[A-Za-z0-9_-]/.test(this.peek());)this.advance();o=this.input.slice(s,this.index)}if(o.length===0&&this.fail("Expected a key"),r.push(o),this.skipInlineWhitespace(),this.peek()==="."){this.advance();continue}return this.peek()!==t&&this.fail(`Expected '${t}'`),r}}parseValue(){let t=this.peek();if(t==='"')return this.parseBasicString(this.input.startsWith('"""',this.index));if(t==="'")return this.parseLiteralString(this.input.startsWith("'''",this.index));if(t==="[")return this.parseArray();if(t==="{")return this.parseInlineTable();let r=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:[Zz]|[+-]\d{2}:\d{2})?)/.exec(this.input.slice(this.index));if(r!==null)return this.advance(r[0].length),this.parseDate(`${r[1]}T${r[2]}`);let n=this.index;for(;!this.done&&!/[\s,#\]}]/.test(this.peek());)this.advance();let o=this.input.slice(n,this.index);if(o==="true")return!0;if(o==="false")return!1;o.length===0&&this.fail("Expected a value");let s=this.parseDate(o);if(s!==void 0)return s;let a=this.parseNumber(o);if(a!==void 0)return a;this.fail(`Invalid value '${o}'`)}parseDate(t){let r="\\d{4}-\\d{2}-\\d{2}",n="\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?";if(new RegExp(`^${r}[Tt]${n}(?:[Zz]|[+-]\\d{2}:\\d{2})$`).test(t)){let o=new Date(t.replace("t","T").replace("z","Z"));return Number.isNaN(o.getTime())&&this.fail(`Invalid date-time '${t}'`),o}if(new RegExp(`^${r}[Tt]${n}$`).test(t)||new RegExp(`^${r}$`).test(t)||new RegExp(`^${n}$`).test(t))return t.replace("t","T")}parseNumber(t){let r=t.replace(/_/g,"");if(/^[+-]?(?:inf|nan)$/.test(t))return r.endsWith("nan")?Number.NaN:r[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY;if(/^0x[0-9A-Fa-f](?:_?[0-9A-Fa-f])*$/.test(t))return Number.parseInt(r.slice(2),16);if(/^0o[0-7](?:_?[0-7])*$/.test(t))return Number.parseInt(r.slice(2),8);if(/^0b[01](?:_?[01])*$/.test(t))return Number.parseInt(r.slice(2),2);if(/^[+-]?(?:0|[1-9](?:_?\d)*)$/.test(t)||/^[+-]?(?:(?:0|[1-9](?:_?\d)*)\.\d(?:_?\d)*(?:[eE][+-]?\d(?:_?\d)*)?|(?:0|[1-9](?:_?\d)*)[eE][+-]?\d(?:_?\d)*)$/.test(t))return Number(r)}parseBasicString(t){this.expect('"'),t&&(this.expect('"'),this.expect('"'),this.advance(this.input.startsWith(`\r
|
|
44
|
+
`,this.index)?2:this.peek()===`
|
|
45
|
+
`?1:0));let r="";for(;!this.done;){if(t&&this.input.startsWith('"""',this.index))return this.advance(3),r;let n=this.peek();if(!t&&n==='"')return this.advance(),r;if(!t&&(n===`
|
|
46
|
+
`||n==="\r")&&this.fail("Basic strings cannot contain newlines"),n!=="\\"){r+=n,this.advance();continue}if(this.advance(),t&&/[ \t\r\n]/.test(this.peek())){for(;/[ \t]/.test(this.peek());)this.advance();for(this.peek()!==`
|
|
46
47
|
`&&this.peek()!=="\r"&&this.fail("Invalid multiline string continuation");/[ \t\r\n]/.test(this.peek());)this.advance();continue}let o=this.peek();this.advance();let s={b:"\b",t:" ",n:`
|
|
47
|
-
`,f:"\f",r:"\r",'"':'"',"\\":"\\"};if(
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
`,f:"\f",r:"\r",'"':'"',"\\":"\\"};if(eL.call(s,o))r+=s[o];else if(o==="u"||o==="U"){let a=o==="u"?4:8,i=this.input.slice(this.index,this.index+a);new RegExp(`^[0-9A-Fa-f]{${a}}$`).test(i)||this.fail("Invalid unicode escape"),r+=String.fromCodePoint(Number.parseInt(i,16)),this.advance(a)}else this.fail(`Invalid escape '\\${o}'`)}this.fail("Unterminated basic string")}parseLiteralString(t){this.expect("'"),t&&(this.expect("'"),this.expect("'"),this.advance(this.input.startsWith(`\r
|
|
49
|
+
`,this.index)?2:this.peek()===`
|
|
50
|
+
`?1:0));let r=this.index;for(;!this.done;){if(t&&this.input.startsWith("'''",this.index)){let n=this.input.slice(r,this.index);return this.advance(3),n}if(!t&&this.peek()==="'"){let n=this.input.slice(r,this.index);return this.advance(),n}!t&&(this.peek()===`
|
|
51
|
+
`||this.peek()==="\r")&&this.fail("Literal strings cannot contain newlines"),this.advance()}this.fail("Unterminated literal string")}parseArray(){this.expect("[");let t=[];for(;;){if(this.skipArrayWhitespace(),this.peek()==="]")return this.advance(),t;if(t.push(this.parseValue()),this.skipArrayWhitespace(),this.peek()==="]")return this.advance(),t;this.expect(",")}}parseInlineTable(){this.expect("{");let t=Jp();if(this.skipInlineWhitespace(),this.peek()==="}")return this.advance(),t;for(;;){let r=this.parseKeyPath("=");if(this.skipInlineWhitespace(),this.expect("="),this.skipInlineWhitespace(),this.assign(t,r,this.parseValue()),this.skipInlineWhitespace(),this.peek()==="}")return this.advance(),t;this.expect(","),this.skipInlineWhitespace(),this.peek()==="}"&&this.fail("Inline tables cannot end with a trailing comma")}}skipDocumentWhitespace(){for(;!this.done;)if(/[ \t\r\n]/.test(this.peek()))this.advance();else if(this.peek()==="#")this.skipComment();else return}skipInlineWhitespace(){for(;this.peek()===" "||this.peek()===" ";)this.advance()}skipArrayWhitespace(){for(;!this.done;)if(/[ \t\r\n]/.test(this.peek()))this.advance();else if(this.peek()==="#")this.skipComment();else return}finishStatement(){this.skipInlineWhitespace(),this.peek()==="#"&&this.skipComment(),!this.done&&this.peek()!==`
|
|
50
52
|
`&&this.peek()!=="\r"&&this.fail("Expected the end of the line")}skipComment(){for(;!this.done&&this.peek()!==`
|
|
51
|
-
`;)this.advance()}expect(t){this.peek()!==t&&this.fail(`Expected '${t}'`),this.advance()}advance(t=1){for(let
|
|
52
|
-
`?(this.line++,this.column=1):this.column++,this.index++}peek(){return this.input[this.index]??""}get done(){return this.index>=this.input.length}fail(t){throw new SyntaxError(`${t} at line ${this.line}, column ${this.column}`)}},
|
|
53
|
-
|
|
54
|
-
`);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
`;)this.advance()}expect(t){this.peek()!==t&&this.fail(`Expected '${t}'`),this.advance()}advance(t=1){for(let r=0;r<t;r++)this.input[this.index]===`
|
|
54
|
+
`?(this.line++,this.column=1):this.column++,this.index++}peek(){return this.input[this.index]??""}get done(){return this.index>=this.input.length}fail(t){throw new SyntaxError(`${t} at line ${this.line}, column ${this.column}`)}},rL=e=>new BC(e.replace(/^\uFEFF/,"")).parse();var HC=Object.prototype.hasOwnProperty,oL=(e,t,r)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:r})},WC=(e,t,r)=>{for(let n=r;n<e.length;n++){let o=e[n];if(t==='"'&&o==="\\")n++;else if(o===t)if(t==="'"&&e[n+1]===t)n++;else return n}return-1},VC=(e,t)=>{let r=0,n=!0;for(let o=0;o<e.length;o++){let s=e[o];if(n&&(s==="'"||s==='"')){if(o=WC(e,s,o+1),o===-1)return-1;n=!1}else if(n&&s==="&")for(;o+1<e.length&&!/[\s,[\]{}]/.test(e[o+1]);)o++;else{if(s==="#"&&(o===0||/\s/.test(e[o-1])))return t==="#"?o:-1;if(n&&(s==="["||s==="{"))r++;else if(r>0&&(s==="]"||s==="}"))r--,n=!1;else if(r>0&&s===",")n=!0;else if(s===":"&&(r>0||e[o+1]===void 0||/\s/.test(e[o+1]))){if(r===0&&t===":")return o;n=!0}else{if(n&&s==="-"&&/\s/.test(e[o+1]??""))continue;/\s/.test(s)||(n=!1)}}}return-1},p9=e=>{let t=VC(e,"#");return t===-1?e:e.slice(0,t).trimEnd()},jC=e=>VC(e,":"),sx=e=>e==="-"||e.startsWith("- "),nL=e=>e===0?" ":`
|
|
55
|
+
`.repeat(e),sL=e=>/\\*$/.exec(e)[0].length%2===1,d9=(e,t)=>{let r=/[ \t]+$/.exec(e);if(r===null)return e;let n=t==='"'&&sL(e.slice(0,r.index));return e.slice(0,r.index+(n?1:0))},m9=e=>{if(!e.endsWith('"')||e.length<2)throw new SyntaxError("Unterminated double-quoted YAML string");let t="";for(let r=1;r<e.length-1;r++){let n=e[r];if(n!=="\\"){t+=n;continue}let o=e[++r],s={0:"\0",a:"\x07",b:"\b",t:" ",n:`
|
|
56
|
+
`,v:"\v",f:"\f",r:"\r",e:"\x1B"," ":" ",'"':'"',"/":"/","\\":"\\",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"};if(HC.call(s,o)){t+=s[o];continue}if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8,i=e.slice(r+1,r+1+a);if(!new RegExp(`^[0-9A-Fa-f]{${a}}$`).test(i))throw new SyntaxError("Invalid unicode escape in YAML string");t+=String.fromCodePoint(Number.parseInt(i,16)),r+=a;continue}throw new SyntaxError(`Invalid YAML escape '\\${o}'`)}return t},Zp=e=>{let t=e.trim();if(t.length===0)return null;if(t.startsWith('"')&&t.endsWith('"'))return m9(t);if(t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1).replace(/''/g,"'");if(/^(?:null|~)$/i.test(t))return null;if(/^true$/i.test(t))return!0;if(/^false$/i.test(t))return!1;if(/^[+-]?\.inf$/i.test(t))return t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY;if(/^\.nan$/i.test(t))return Number.NaN;let r=t.replace(/_/g,"");return/^[+-]?0x[0-9a-f]+$/i.test(r)?(r[0]==="-"?-1:1)*Number.parseInt(r.replace(/^[+-]?0x/i,""),16):/^[+-]?0o[0-7]+$/i.test(r)?(r[0]==="-"?-1:1)*Number.parseInt(r.replace(/^[+-]?0o/i,""),8):/^[+-]?(?:0|[1-9]\d*)$/.test(r)||/^[+-]?(?:(?:0|[1-9]\d*)?\.\d+|(?:0|[1-9]\d*)\.?\d*[eE][+-]?\d+)$/.test(r)?Number(r):t},aL=e=>{let t=Zp(e);return t==null?"":String(t)},zC=class{input;anchors;index=0;constructor(t,r){this.input=t,this.anchors=r}parse(){let t=this.parseValue();return this.skipWhitespace(),this.index!==this.input.length&&this.fail("Unexpected flow collection content"),t}parseValue(){this.skipWhitespace();let t=this.peek();if(t==="[")return this.parseSequence();if(t==="{")return this.parseMapping();if(t==='"'||t==="'")return Zp(this.readQuoted(t));if(t==="*"){this.index++;let r=this.readUntil(/[,\]}\s]/);return this.anchors.has(r)||this.fail(`Unknown alias '*${r}'`),this.anchors.get(r)}return Zp(this.readUntil(/[,\]}]/).trim())}parseSequence(){this.expect("[");let t=[];if(this.skipWhitespace(),this.peek()==="]")return this.index++,t;for(;;){if(t.push(this.parseValue()),this.skipWhitespace(),this.peek()==="]")return this.index++,t;if(this.expect(","),this.skipWhitespace(),this.peek()==="]")return this.index++,t}}parseMapping(){this.expect("{");let t={};if(this.skipWhitespace(),this.peek()==="}")return this.index++,t;for(;;){let r=this.parseKey();if(this.skipWhitespace(),this.expect(":"),HC.call(t,r)&&this.fail(`Duplicate key '${r}'`),oL(t,r,this.parseValue()),this.skipWhitespace(),this.peek()==="}")return this.index++,t;if(this.expect(","),this.skipWhitespace(),this.peek()==="}")return this.index++,t}}parseKey(){this.skipWhitespace();let t=this.peek();return t==='"'||t==="'"?aL(this.readQuoted(t)):this.readUntil(/:/).trim()}readQuoted(t){let r=this.index,n=WC(this.input,t,r+1);return n===-1&&this.fail("Unterminated quoted scalar"),this.index=n+1,this.input.slice(r,this.index)}readUntil(t){let r=this.index;for(;this.index<this.input.length&&!t.test(this.peek());)this.index++;return this.input.slice(r,this.index)}skipWhitespace(){for(;/\s/.test(this.peek());)this.index++}expect(t){this.peek()!==t&&this.fail(`Expected '${t}'`),this.index++}peek(){return this.input[this.index]??""}fail(t){throw new SyntaxError(`${t} at flow offset ${this.index}`)}},qC=class{lines;index=0;documentStarted=!1;anchors=new Map;constructor(t){this.lines=t}parse(){if(this.skipIgnored(),this.index>=this.lines.length)return null;this.documentStarted=!0;let t=this.parseNode(this.lines[this.index].indent);return this.skipIgnored(),this.index<this.lines.length&&this.fail(this.lines[this.index],"Unexpected content"),t}parseNode(t,r=t-1){this.skipIgnored();let n=this.lines[this.index];return n===void 0?null:(n.indent!==t&&this.fail(n,`Expected indentation of ${t} spaces`),sx(n.text)?this.parseSequence(t):jC(n.text)!==-1?this.parseMapping(t):(this.index++,this.parseNodeValue(n.text,r)))}parseMapping(t,r={}){for(;;){this.skipIgnored();let n=this.lines[this.index];if(n===void 0||n.indent<t)return r;n.indent>t&&this.fail(n,`Unexpected indentation of ${n.indent} spaces`);let o=jC(n.text);if(o===-1)return r;this.index++,this.parseMappingEntry(r,n.text,o,t,n)}}parseMappingEntry(t,r,n,o,s){let a=aL(r.slice(0,n).trim()),i=r.slice(n+1).trimStart(),c=this.parseNodeValue(i,o,!0);HC.call(t,a)&&this.fail(s,`Duplicate key '${a}'`),oL(t,a,c)}parseSequence(t){let r=[];for(;;){this.skipIgnored();let n=this.lines[this.index];if(n===void 0||n.indent<t||(n.indent>t&&this.fail(n,`Unexpected indentation of ${n.indent} spaces`),!sx(n.text)))return r;this.index++;let o=n.text.slice(1).trimStart();sx(o)&&this.fail(n,"Compact nested block sequences are not supported");let s=jC(o);if(s===-1)r.push(this.parseNodeValue(o,t));else{let a={};this.parseMappingEntry(a,o,s,t+2,n),r.push(this.parseMapping(t+2,a))}}}parseNodeValue(t,r,n=!1){let o=/^&([^\s,[\]{}]+)(?:\s+(.*))?$/.exec(t);if(o===null)return this.parseValue(t,r,n);let s=this.parseValue(o[2]??"",r,n);return this.anchors.set(o[1],s),s}parseValue(t,r,n){let o=t.trimEnd();if(o.length===0){this.skipIgnored();let s=this.lines[this.index];return s===void 0?null:s.indent>r?this.parseNode(s.indent,r):n&&s.indent===r&&sx(s.text)?this.parseSequence(r):null}if(/^[|>](?:[1-9]?[+-]?|[+-]?[1-9]?)$/.test(o))return this.parseBlockScalar(o,r);if(t.startsWith('"')||t.startsWith("'"))return this.parseQuotedValue(t,r);if(o.startsWith("*")){let s=o.slice(1).trim();if(!this.anchors.has(s))throw new SyntaxError(`Unknown YAML alias '*${s}'`);return this.anchors.get(s)}return o.startsWith("[")||o.startsWith("{")?new zC(o,this.anchors).parse():this.parsePlainValue(o,r)}parsePlainValue(t,r){let n=this.lines[this.index-1];/:(?:\s|$)/.test(t)&&this.fail(n,"Invalid colon in plain scalar");let o=t,s=VC(n.raw,"#")!==-1;for(;!s;){let a=this.skipBlankLines(),i=this.lines[this.index];if(i===void 0||i.indent<=r)break;let c=i.raw.slice(i.indent),f=c.search(/(?:^|[ \t])#/),u=(f===-1?c:c.slice(0,f)).trimEnd();if(u.length===0||i.indent===0&&/^(?:---|\.\.\.)(?:\s|$)/.test(u))break;/:(?:\s|$)/.test(u)&&this.fail(i,"Invalid colon in plain scalar"),o+=nL(a)+u,this.index++,s=f!==-1}return Zp(o)}parseQuotedValue(t,r){let n=t[0],o=n,s=t.slice(1);for(;;){let a=WC(s,n,0);if(a!==-1){let c=s.slice(a+1);if(c.trim().length>0&&!/^[ \t]+#/.test(c))throw new SyntaxError("Unexpected content after quoted YAML scalar");return Zp(o+s.slice(0,a+1))}n==='"'&&sL(s)?o+=s.slice(0,-1):o+=d9(s,n)+nL(this.skipBlankLines());let i=this.lines[this.index++];if(i===void 0)throw new SyntaxError("Unterminated quoted YAML scalar");i.raw.trim().length>0&&i.indent<=r&&this.fail(i,"Invalid quoted scalar indentation"),s=i.raw.trimStart()}}parseBlockScalar(t,r){let n=t[0],o=t.includes("-")?"strip":t.includes("+")?"keep":"clip",s=Number.parseInt(t.replace(/[^1-9]/g,""),10),a=this.index,i=a,c=Number.isNaN(s)?Number.POSITIVE_INFINITY:r+s;for(;i<this.lines.length;){let h=this.lines[i];if(h.raw.trim().length!==0&&h.indent<=r)break;h.raw.trim().length!==0&&(c=Math.min(c,h.indent)),i++}c===Number.POSITIVE_INFINITY&&(c=r+1);let f=[];for(let h=a;h<i;h++){let g=this.lines[h];g.raw.trim().length===0?f.push(""):g.indent<c?this.fail(g,`Expected block scalar indentation of ${c} spaces`):f.push(g.raw.slice(c))}this.index=i;let u=f.length;for(;u>0&&f[u-1].length===0;)u--;let l=Math.max(0,f.length-u-(i===this.lines.length?1:0))+(u>0&&a+u<this.lines.length?1:0);f.length=u;let p="";if(n==="|")p=f.join(`
|
|
57
|
+
`);else{let h=0,g;for(let x of f)if(x.length===0)h++;else{let b=x.startsWith(" "),T=b||g===!0;g===void 0?p+=`
|
|
58
|
+
`.repeat(h):h===0?p+=T?`
|
|
59
|
+
`:" ":p+=`
|
|
60
|
+
`.repeat(h+(T?1:0)),p+=x,h=0,g=b}}return o==="keep"?p+`
|
|
61
|
+
`.repeat(l):o==="clip"&&u>0&&l>0?`${p}
|
|
62
|
+
`:p}skipBlankLines(){let t=this.index;for(;this.index<this.lines.length&&this.lines[this.index].raw.trim().length===0;)this.index++;return this.index-t}skipIgnored(){for(;this.index<this.lines.length;){let t=this.lines[this.index],r=t.text.trimEnd();if(r.length===0||r.startsWith("%"))this.index++;else if(t.indent===0&&r==="---")this.documentStarted&&this.fail(t,"Multiple YAML documents are not supported"),this.documentStarted=!0,this.index++;else if(t.indent===0&&r==="..."){for(this.index++;this.index<this.lines.length&&this.lines[this.index].text.trimEnd().length===0;)this.index++;this.index<this.lines.length&&this.fail(this.lines[this.index],"Multiple YAML documents are not supported")}else return}}fail(t,r){throw new SyntaxError(`${r} at line ${t.number}`)}},GC=e=>{let r=e.replace(/^\uFEFF/,"").replace(/\r\n?/g,`
|
|
58
63
|
`).split(`
|
|
59
|
-
`).map((
|
|
60
|
-
${
|
|
61
|
-
`}),
|
|
62
|
-
`))}):"";return
|
|
63
|
-
`+
|
|
64
|
-
`))+"\x1B[u"}}return""},
|
|
65
|
-
`}),
|
|
66
|
-
`))}})};var
|
|
67
|
-
`));let s=
|
|
68
|
-
`+
|
|
69
|
-
`))+"\x1B[u"}}):"",
|
|
70
|
-
`}),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
`});var
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
`))
|
|
78
|
-
`}),
|
|
79
|
-
|
|
80
|
-
${
|
|
81
|
-
|
|
82
|
-
${
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
`)},
|
|
86
|
-
`)},g
|
|
87
|
-
`)};var
|
|
88
|
-
`)};var
|
|
89
|
-
|
|
90
|
-
`)};var O$=(e,t,n)=>{switch(t){case"bash":return S$(e,n);case"zsh":return k$(e,n);case"fish":return w$(e,n)}};var Gh=e=>m$(as,e);var _$=(e,t)=>Zl(as,e,t),P$=(e,t)=>Uh(as,e,t);var DI=p(2,(e,t)=>h$(e,t)),Xc=p(2,(e,t)=>Lh(e,t)),$I=p(2,(e,t)=>qh(e,t));var UI=e=>li(e),Kh=jh;var R$=p(2,(e,t)=>Jc(e,t));var Vh="~effect/cli/Command/Config/Internal",Jh=e=>{let t=[],n=[],r=[];function o(a){let i=Object.create(null);for(let c of Object.keys(a))i[c]=s(a[c]);return i}function s(a){if(Array.isArray(a))return{_tag:"Array",children:a.map(i=>s(i))};if($h(a)){let i=t.length;return t.push(a),a.kind==="argument"?r.push(a):n.push(a),{_tag:"Param",index:i}}else return{_tag:"Nested",tree:o(a)}}return{[Vh]:Vh,flags:n,arguments:r,orderedParams:t,tree:o(e)}},M$=Jh({}),N$=(e,t)=>{switch(e._tag){case"Param":return{_tag:"Param",index:e.index+t};case"Array":return{_tag:"Array",children:e.children.map(n=>N$(n,t))};case"Nested":return{_tag:"Nested",tree:D$(e.tree,t)}}},D$=(e,t)=>{let n=Object.create(null);for(let r of Object.keys(e))n[r]=N$(e[r],t);return n},LI=(e,t)=>{let n=e.orderedParams.length;return{[Vh]:Vh,flags:[...e.flags,...t.flags],arguments:[...e.arguments,...t.arguments],orderedParams:[...e.orderedParams,...t.orderedParams],tree:Object.assign(Object.create(null),e.tree,D$(t.tree,n))}},jI=(e,t)=>{let n={};for(let o of Object.keys(e))M(n,o,r(e[o]));return n;function r(o){switch(o._tag){case"Param":return t[o.index];case"Array":return o.children.map(s=>r(s));case"Nested":return jI(o.tree,t)}}};var ed="~effect/cli/Command",ve=e=>e,RZ={...Kr({label:"Command",evaluate(){return ve(this).service}})},On=e=>{let t=e.config,n=e.contextConfig??M$,r=e.service??He(`${ed}/${e.name}`),o=e.annotations??qt(),s=e.globalFlags??[],a=e.subcommands??[],i=(l,d)=>_e(e.handle)?e.handle(l,d):k(new ns({commandPath:d,errors:[]})),c=e.parse??Zh(t),u=e.parseContext??Zh(n,{allowLeftovers:!0}),f=l=>{let d=[],m=[];for(let I of t.arguments){let C=Ze(I),y=kn(I);for(let x of C)d.push({name:x.name,type:x.typeName??Gl(x.primitiveType),description:x.description,required:!y.isOptional&&(!y.isVariadic||qv(y.variadicMin,h=>h>0)),variadic:y.isVariadic})}let g=l.length>0?l.join(" "):e.name;a.some(I=>I.commands.some(C=>!C.unlisted))&&(g+=" <subcommand>"),g+=" [flags]";for(let I of d){let C=I.variadic?`<${I.name}...>`:`<${I.name}>`;g+=` ${I.required?C:`[${C}]`}`}for(let I of t.flags){let C=Ze(I),y=kn(I);for(let x of C)x.hidden||m.push(Yh(x,y))}let S=[];for(let I of a){let C=I.commands.filter(y=>!y.unlisted);C.length!==0&&S.push({group:I.group,commands:Et(C,y=>({name:y.name,alias:y.alias,shortDescription:y.shortDescription,description:y.description??""}))})}let v=e.examples??[];return{description:e.description??"",usage:g,flags:m,annotations:o,...d.length>0&&{args:d},...S.length>0&&{subcommands:S},...v.length>0&&{examples:v}}};return Object.assign(Object.create(RZ),{[ed]:ed,name:e.name,examples:e.examples??[],annotations:o,globalFlags:s,subcommands:a,unlisted:e.unlisted??!1,config:t,contextConfig:n,service:r,parse:c,parseContext:u,handle:i,buildHelpDoc:f,..._e(e.description)?{description:e.description}:{},..._e(e.shortDescription)?{shortDescription:e.shortDescription}:{},..._e(e.alias)?{alias:e.alias}:{}})},Yh=(e,t)=>{let n=e.aliases.map(r=>r.length===1?`-${r}`:`--${r}`);return{name:e.name,aliases:n,type:e.typeName??Gl(e.primitiveType),description:FZ(e.description,os(e.primitiveType)),required:e.primitiveType._tag!=="Boolean"&&!t.isOptional}},FZ=(e,t)=>{if(t===void 0||t.length===0)return e;let n=`(choices: ${t.join(", ")})`;return We(e,{onNone:()=>R(n),onSome:r=>R(`${r} ${n}`)})},Zh=(e,t)=>j(function*(n){let r={flags:n.flags,arguments:n.arguments},[o,s]=yield*MZ(r,e.orderedParams);return t?.allowLeftovers!==!0&&o.length>0?yield*new ql({arguments:o}):jI(e.tree,s)}),MZ=j(function*(e,t){let n=[],r=e.arguments;for(let o of t){let[s,a]=yield*o.parse({flags:e.flags,arguments:r});n.push(a),r=s}return[r,n]}),BI=(e,t,n)=>{let r=ve(e),o=new Set;(a=>{for(let i of a){let c=Ze(i);for(let u of c)o.add(u.name)}})((n?.contextConfig??r.contextConfig).flags);for(let a of t){let i=ve(a);for(let c of i.config.flags){let u=Ze(c);for(let f of u)if(o.has(f.name))throw new jl({option:f.name,parentCommand:e.name,childCommand:a.name})}}};var NZ=e=>{switch(e.primitiveType._tag){case"Boolean":return{_tag:"Boolean"};case"Integer":return{_tag:"Integer"};case"Float":return{_tag:"Float"};case"Date":return{_tag:"Date"};case"Choice":return{_tag:"Choice",values:os(e.primitiveType)??[]};case"Path":return{_tag:"Path",pathType:Lw(e.primitiveType)??"either"};case"FileText":case"FileParse":case"FileSchema":return{_tag:"Path",pathType:"file"};default:return{_tag:"String"}}},DZ=e=>{switch(e.primitiveType._tag){case"Integer":return{_tag:"Integer"};case"Float":return{_tag:"Float"};case"Date":return{_tag:"Date"};case"Choice":return{_tag:"Choice",values:os(e.primitiveType)??[]};case"Path":return{_tag:"Path",pathType:Lw(e.primitiveType)??"either"};case"FileText":case"FileParse":case"FileSchema":return{_tag:"Path",pathType:"file"};default:return{_tag:"String"}}},qI=e=>{let n=ve(e).config,r=[];for(let a of n.flags){let i=Ze(a);for(let c of i)c.kind==="flag"&&(c.hidden||r.push({name:c.name,aliases:c.aliases,description:Qt(c.description),type:NZ(c)}))}let o=[];for(let a of n.arguments){let i=Ze(a),c=kn(a);for(let u of i)u.kind==="argument"&&o.push({name:u.name,description:Qt(u.description),required:!c.isOptional,variadic:c.isVariadic,type:DZ(u)})}let s=[];for(let a of e.subcommands)for(let i of a.commands)i.unlisted||s.push(qI(i));return{name:e.name,description:e.shortDescription??e.description,flags:r,arguments:o,subcommands:s}};var zI=e=>{let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n},$$=(e,t)=>{let n=[e],r=e;for(let o=1;o<t.length;o++){let s=t[o],a;for(let i of r.subcommands)if(a=i.commands.find(c=>c.name===s),a)break;if(!a)break;n.push(a),r=a}return n},WI=(e,t,n)=>{let o=$$(e,t).flatMap(s=>ve(s).globalFlags);return zI([...n,...o])},UZ=e=>{let t=[],n=r=>{let o=ve(r);for(let s of o.globalFlags)t.push(s);for(let s of r.subcommands)for(let a of s.commands)n(a)};return n(e),zI(t)},LZ=(e,t)=>{if(e.length<=1)return[];let n=new Set(t.map(o=>o.name)),r=[];for(let o of e.slice(0,-1)){let s=ve(o);for(let a of s.contextConfig.flags){let i=Ze(a),c=kn(a);for(let u of i)n.has(u.name)||u.hidden||(n.add(u.name),r.push(Yh(u,c)))}}return r},U$=(e,t)=>zI([...t,...UZ(e)]),Qh=(e,t,n)=>It(function*(){let r=$$(e,t),o=r.length>0?r[r.length-1]:e,s=ve(o).buildHelpDoc(t),a=LZ(r,s.flags),i=WI(e,t,n),c=[];for(let u of i){let f=Ze(u.flag),l=kn(u.flag);for(let d of f)d.hidden||c.push({...Yh(d,l),required:!1})}return{...s,flags:[...a,...s.flags],globalFlags:c}});var Xh=e=>({_tag:"Action",flag:e.flag,run:e.run}),BZ=e=>t=>{L$+=1;let n=He(`effect/unstable/cli/GlobalFlag/${e}/${L$}`);return Object.assign(n,{_tag:"Setting",id:e,flag:t.flag})},L$=0,qZ=Xh({flag:Gh("help").pipe(DI("h"),Xc("Show help information"),Kh(!1)),run:j(function*(e,{builtIns:t,command:n,commandPath:r}){let o=yield*Qc,s=yield*Qh(n,r,t);yield*Ot(o.formatHelpDoc(s))})}),zZ=Xh({flag:Gh("version").pipe(DI("v"),Xc("Show version information"),Kh(!1)),run:j(function*(e,{command:t,version:n}){let r=yield*Qc;yield*Ot(r.formatVersion(t.name,n))})}),HI=Xh({flag:Gh("wizard").pipe(Xc("Start wizard mode for a command"),Kh(!1)),run:()=>ge}),WZ=Xh({flag:P$("completions",["bash","zsh","fish","sh"]).pipe(UI,R$(e=>ms(e,t=>t==="sh"?"bash":t)),$I("<bash|zsh|fish|sh>"),Xc("Print shell completion script")),run:j(function*(e,{command:t}){if(Ne(e))return;let n=qI(t);yield*Ot(O$(t.name,e.value,n))})}),eu=BZ("log-level")({flag:_$("log-level",[["all","All"],["trace","Trace"],["debug","Debug"],["info","Info"],["warn","Warn"],["warning","Warn"],["error","Error"],["fatal","Fatal"],["none","None"]]).pipe(UI,Xc("Sets the minimum log level"),$I("<all|trace|debug|info|warn|warning|error|fatal|none>"))}),j$=[qZ,zZ,HI,WZ,eu];var td=class extends pe("effect/unstable/cli/CliConfig",{defaultValue:()=>HZ}){},HZ={builtIns:j$};var ru={};jr(ru,{annotate:()=>kY,annotateMerge:()=>OY,isCommand:()=>ev,make:()=>xY,provide:()=>_Y,provideEffect:()=>RY,provideEffectDiscard:()=>FY,provideSync:()=>PY,run:()=>UY,runWith:()=>tv,unlisted:()=>TY,withAlias:()=>CY,withDescription:()=>IY,withExamples:()=>AY,withGlobalFlags:()=>wY,withHandler:()=>yY,withSharedFlags:()=>bY,withShortDescription:()=>vY,withSubcommands:()=>EY,wizard:()=>MY});function z$(e){let t=e.indexOf("--");return t===-1?{tokens:q$(e),trailingOperands:[]}:{tokens:q$(e.slice(0,t)),trailingOperands:e.slice(t+1)}}var q$=e=>{let t=[];for(let n of e)if(!n.startsWith("-"))t.push({_tag:"Value",value:n});else if(n.startsWith("--")){let r=n.indexOf("=");if(r!==-1){let o=n.slice(2,r),s=n.slice(r+1);t.push({_tag:"LongOption",name:o,raw:n,value:s})}else t.push({_tag:"LongOption",name:n.slice(2),raw:n})}else if(n.length>1){let r=n.slice(1),o=r.indexOf("=");if(o!==-1){let s=r.slice(0,o),a=r.slice(o+1);t.push({_tag:"ShortOption",flag:s,raw:`-${s}`,value:a})}else for(let s of r)t.push({_tag:"ShortOption",flag:s,raw:`-${s}`})}else t.push({_tag:"Value",value:n});return t};var KZ=(e,t)=>{let n=e.length,r=t.length,o=Array.from({length:n+1},()=>new Array(r+1).fill(0));for(let s=0;s<=n;s++)o[s][0]=s;for(let s=0;s<=r;s++)o[0][s]=s;for(let s=1;s<=n;s++)for(let a=1;a<=r;a++){let i=e[s-1]===t[a-1]?0:1;o[s][a]=Math.min(o[s-1][a]+1,o[s][a-1]+1,o[s-1][a-1]+i)}return o[n][r]},KI=(e,t)=>{let n=t.map(o=>[KZ(e,o),o]).filter(([o])=>o<=2).sort(([o],[s])=>o-s);if(n.length===0)return[];let r=n[0][0];return n.filter(([o])=>o===r).map(([,o])=>o)};var JI=e=>We(e.subcommand,{onNone:()=>[],onSome:t=>[t.name,...JI(t.parsedInput)]}),ZI=(e,t,n=[])=>It(function*(){let{tokens:r,trailingOperands:o}=e,s=[...n,t.name],a=ve(t),c=a.config.flags.flatMap(Ze).filter(di),u=nu(c),l=a.contextConfig.flags.flatMap(Ze).filter(di),d=nu(l),m=new Set(l.map(y=>y.name)),g={command:t,commandPath:s,flagRegistry:u,inheritedFlagRegistry:d,localFlagNames:c.filter(y=>!m.has(y.name)).map(y=>y.name)},S=aY(r,g);if(S._tag==="Leaf")return{flags:S.flags,arguments:[...S.arguments,...o],subcommand:O(),...S.errors.length>0&&{errors:S.errors}};let v={tokens:S.childTokens,trailingOperands:o},I=yield*ZI(v,S.sub,s),C=[...S.errors,...I.errors??[]];return{flags:S.flags,arguments:[],subcommand:R({name:S.sub.name,parsedInput:I}),...C.length>0&&{errors:C}}}),eg=e=>{let t=0;return{peek:()=>e[t],take:()=>e[t++],rest:()=>e.slice(t)}},nu=e=>{let t=new Map;for(let n of e){if(t.has(n.name))throw new Error(`Duplicate flag name "${n.name}" in command definition`);t.set(n.name,n);for(let r of n.aliases){if(t.has(r))throw new Error(`Duplicate flag/alias "${r}" in command definition (conflicts with "${t.get(r).name}")`);t.set(r,n)}}return{params:e,index:t}},G$=e=>{let t=new Map,n=(r,o)=>{let s=t.get(r);if(s&&s!==o)throw new Error(`Duplicate subcommand name/alias "${r}" in command definition (conflicts with "${s.name}")`);t.set(r,o)};for(let r of e)for(let o of r.commands)n(o.name,o),o.alias&&o.alias!==o.name&&n(o.alias,o);return t},YI=e=>Object.fromEntries(e.map(t=>[t.name,[]])),VZ=e=>{let t=YI(e);return{add:(n,r)=>{r!==void 0&&t[n].push(r)},merge:n=>{for(let r in n){let o=n[r];if(o?.length)for(let s=0;s<o.length;s++)t[r].push(o[s])}},snapshot:()=>t}},tg=e=>e._tag==="LongOption"||e._tag==="ShortOption",K$=e=>e._tag==="LongOption"?e.name:e.flag,tu=(e,t)=>{let n=K$(e),r=t.index.get(n);if(r&&r.name===n)return{param:r,negated:!1};if(e._tag==="LongOption"&&e.name.startsWith("no-")){let o=e.name.slice(3),s=t.index.get(o);if(s&&s.name===o&&Ph(s.primitiveType))return{param:s,negated:!0}}if(r)return{param:r,negated:!1}},W$=(e,t,n)=>new Vt({option:t.name,value:n,expected:`omit the value and use ${e.raw} by itself to set --${t.name} to false`,kind:"flag"}),JZ=e=>{let t=os(e.primitiveType);return new Vt({option:e.name,value:"",expected:t===void 0?e.typeName??Gl(e.primitiveType):t.join(" | "),kind:"flag"})},H$=e=>e?._tag==="Value"&&(bD(e.value)||wD(e.value))?e.value:void 0,V$=(e,t,n,r=!1)=>{let o=nd(e,t,n,r);switch(o._tag){case"Value":return{_tag:"Value",value:o.value};case"Error":return{_tag:"Error",error:o.error}}},nd=(e,t,n,r=!1)=>{if(r){if(t.value!==void 0)return{_tag:"Error",error:W$(t,n,t.value),tokens:[]};let s=H$(e.peek());if(s!==void 0){let a=e.take();return{_tag:"Error",error:W$(t,n,s),tokens:a===void 0?[]:[a]}}return{_tag:"Value",value:"false",tokens:[]}}if(t.value!==void 0)return{_tag:"Value",value:t.value,tokens:[]};if(Ph(n.primitiveType)){let s=H$(e.peek()),a=s!==void 0?e.take():void 0;return{_tag:"Value",value:s??"true",tokens:a===void 0?[]:[a]}}let o=e.peek();if(o?._tag==="Value"){let s=e.take();return{_tag:"Value",value:o.value,tokens:s===void 0?[]:[s]}}return{_tag:"Error",error:JZ(n),tokens:[]}},ZZ=(e,t)=>{let n=YI(t.params),r=[],o=[],s=eg(e);for(let a=s.take();a;a=s.take()){if(!tg(a)){r.push(a);continue}let i=tu(a,t);if(!i){r.push(a);continue}let c=V$(s,a,i.param,i.negated);if(c._tag==="Error"){o.push(c.error);continue}c.value!==void 0&&n[i.param.name].push(c.value)}return{flagMap:n,remainder:r,errors:o}},YZ=e=>ve(e).config.flags.flatMap(Ze).filter(di),QZ=e=>ve(e).contextConfig.flags.flatMap(Ze).filter(di),J$=(e,t)=>{for(let n of t){let r=tu(e,n);if(r!==void 0)return r}},VI=(e,t,n,r)=>{e.push(n);let o=nd(t,n,r.param,r.negated);e.push(...o.tokens)},XZ=(e,t,n,r,o)=>{let s=eg(t);nd(s,e,n.param,n.negated);for(let a=s.take();a;a=s.take()){if(tg(a)){let i=J$(a,o);i!==void 0&&nd(s,a,i.param,i.negated);continue}if(a._tag==="Value")return r.has(a.value)}return!1},Z$=(e,t,n)=>{let r=YI(n.params),o=[],s=(a,i,c)=>{let u=nu(YZ(i)),f=nu(QZ(i)),l=G$(i.subcommands),d=eg(a),m=[],g=!0;for(let S=d.take();S;S=d.take()){if(tg(S)){let v=J$(S,c);if(v!==void 0){VI(m,d,S,v);continue}let I=tu(S,f);if(I!==void 0){VI(m,d,S,I);continue}let C=tu(S,u),y=tu(S,n);if(C!==void 0&&(y===void 0||!g||!XZ(S,d.rest(),C,l,[u,f,n]))){VI(m,d,S,C);continue}if(y!==void 0){let x=nd(d,S,y.param,y.negated);if(x._tag==="Error"){o.push(x.error);continue}x.value!==void 0&&r[y.param.name].push(x.value);continue}m.push(S);continue}if(S._tag==="Value"&&g){let v=l.get(S.value);if(v!==void 0)return m.push(S),m.push(...s(d.rest(),v,[...c,f])),m;g=!1}m.push(S)}return m};return{flagMap:r,remainder:s(e,t,[]),errors:o}},eY=(e,t,n)=>{let r=e._tag==="LongOption"?`--${e.name}`:`-${e.flag}`,o=[];for(let a of t)if(!a.hidden){o.push(a.name),Ph(a.primitiveType)&&o.push(`no-${a.name}`);for(let i of a.aliases)o.push(i)}let s=KI(K$(e),o).map(a=>a.length===1?`-${a}`:`--${a}`);return new Zs({option:r,suggestions:s,command:n})},tY=e=>({flags:VZ(e.params),arguments:[],errors:[],mode:{_tag:"AwaitingFirstValue"}}),nY=e=>({_tag:"Leaf",flags:e.flags.snapshot(),arguments:e.arguments,errors:e.errors}),rY=(e,t,n,r)=>{let{command:o,commandPath:s,inheritedFlagRegistry:a,localFlagNames:i}=n,c=G$(o.subcommands),u=c.get(e);if(u){let l=[...s,u.name],d=r.flags.snapshot();for(let g of i){let S=d[g];S!==void 0&&S.length>0&&r.errors.push(new Zs({option:`--${g}`,suggestions:[],command:l}))}let m=ZZ(t.rest(),a);return r.flags.merge(m.flagMap),r.errors.push(...m.errors),{_tag:"Subcommand",result:{_tag:"Sub",flags:r.flags.snapshot(),sub:u,childTokens:m.remainder,errors:r.errors}}}if(!(ve(o).config.arguments.length>0)&&c.size>0){let l=[];for(let[m,g]of c)g.unlisted||l.push(m);let d=KI(e,l);r.errors.push(new zl({subcommand:e,parent:s,suggestions:d}))}return{_tag:"Argument"}},oY=(e,t,n,r)=>{let{commandPath:o,flagRegistry:s}=n,a=tu(e,s);if(!a){r.errors.push(eY(e,s.params,o));return}let i=V$(t,e,a.param,a.negated);if(i._tag==="Error"){r.errors.push(i.error);return}r.flags.add(a.param.name,i.value)},sY=(e,t,n,r)=>{if(r.mode._tag==="AwaitingFirstValue"){let o=rY(e,t,n,r);if(o._tag==="Subcommand")return o.result;r.mode={_tag:"CollectingArguments"}}r.arguments.push(e)},aY=(e,t)=>{let n=eg(e),r=tY(t.flagRegistry);for(let o=n.take();o;o=n.take()){if(tg(o)){oY(o,n,t,r);continue}if(o._tag==="Value"){let s=sY(o.value,n,t,r);if(s)return s}}return nY(r)};var XI=j(function*(e,t){let n=t?.commandPath??[e.name],r=cY(e,n),o=(t?.prefix??n).map(s=>mo(s));return yield*ng(o),yield*X$(r,o,r===e?"ROOT":r.name),{args:o.map(s=>s.value),displayArgs:o.map(s=>s.displayValue)}}),cY=(e,t)=>{let n=e;for(let r of t.slice(1)){let o=n.subcommands.flatMap(s=>s.commands).find(s=>s.name===r||s.alias===r);if(o===void 0)break;n=o}return n},X$=j(function*(e,t,n){let r=ve(e),o=e.subcommands.flatMap(i=>i.commands.filter(c=>!c.unlisted)),s=o.length===0?r.config:r.contextConfig;if(s.flags.length>0){yield*Ot(Q$(n,"FLAGS"));for(let i of s.flags)t.push(...yield*Y$(i));(s.arguments.length>0||o.length>0)&&(yield*ng(t))}if(s.arguments.length>0){yield*Ot(Q$(n,"ARGUMENTS"));for(let i of s.arguments)t.push(...yield*Y$(i));o.length>0&&(yield*ng(t))}if(o.length===0)return;let a=yield*Jt(eI({message:"Command",choices:o.map(i=>({title:i.name,value:i,...i.shortDescription!==void 0?{description:i.shortDescription}:i.description!==void 0?{description:i.description}:{}}))}));yield*Ot(),t.push(mo(a.name)),uY(a)&&(yield*ng(t)),yield*X$(a,t,a.name)}),uY=e=>e.subcommands.some(n=>n.commands.some(r=>!r.unlisted))||ve(e).config.orderedParams.length>0,Y$=j(function*(e){let t=mi(e),n=kn(e);if(n.isOptional&&!(yield*Jt(Qw({message:`Set ${QI(t)}?`,initial:!1}))))return yield*Ot(),[];let r=n.isVariadic?yield*Jt(Xw({message:`${QI(t)} count`,default:it(n.variadicMin,()=>0),min:it(n.variadicMin,()=>0),...we(n.variadicMax)?{max:n.variadicMax.value}:{}})):1,o=[];for(let a=0;a<r;a++)o.push(yield*fY(t));let s=t.kind===as?{flags:{[t.name]:o.map(a=>a.value)},arguments:[]}:{flags:{},arguments:o.map(a=>a.value)};return yield*e.parse(s),yield*Ot(),t.kind===_t?o:o.flatMap(a=>[mo(`--${t.name}`),a])}),fY=e=>{let t=dY(e);switch(e.primitiveType._tag){case"Boolean":return Y(Jt(Qw({message:t,label:{confirm:"true",deny:"false"},placeholder:{defaultConfirm:"(T/f)",defaultDeny:"(t/F)"}})),n=>mo(String(n)));case"Choice":{let n=os(e.primitiveType)??[];return Y(Jt(eI({message:t,choices:n.map(r=>({title:r,value:r}))})),mo)}case"Date":return Y(Jt(ZD({message:t})),n=>mo(n.toISOString()));case"Float":return Y(Jt(YD({message:t})),n=>mo(String(n)));case"Integer":return Y(Jt(Xw({message:t})),n=>mo(String(n)));case"Redacted":return Y(Jt(QD({message:t})),n=>mo(Gs(n),"<redacted>"));default:return Y(Jt(XD({message:t})),mo)}},mo=(e,t=e)=>({value:e,displayValue:t}),lY=e=>e.kind===as?`--${e.name}`:e.name,dY=e=>QI(e),QI=e=>{let t=Qt(e.description)?.trim(),n=e.kind===as&&t!==void 0&&t.length<=32?t:pY(e.name);return e.kind===as?`${n} (${lY(e)})`:n},pY=e=>{let t=e.split(/[-_]+/).filter(n=>n.length>0);return t.length===0?e:[t[0][0].toUpperCase()+t[0].slice(1),...t.slice(1)].join(" ")},ng=e=>Ot(rU("Current command",e.map(t=>t.displayValue),DD)),Q$=(e,t)=>`${Je(e.toUpperCase(),ss,Gc)} ${Je("\xB7",Vl)} ${Je(t,ss,ai)}`,eU=(e,t,n)=>[`${Je(e,ss,Gc)} ${Je(`v${t}`,ai)} ${Je("\xB7 Command wizard",ss,ai)}`,...n===void 0||n.length===0?[]:[n],Je("Build a command interactively. Press Ctrl+C to cancel.",Vl),""].join(`
|
|
91
|
-
|
|
92
|
-
$
|
|
93
|
-
|
|
94
|
-
|
|
64
|
+
`).map((n,o)=>{let s=/^( *)/.exec(n)[1].length;if(n.slice(0,s+1).includes(" "))throw new SyntaxError(`Tabs cannot be used for YAML indentation at line ${o+1}`);return{raw:n,text:p9(n.slice(s)),indent:s,number:o+1}});return new qC(r).parse()};var g9="~effect/cli/Primitive",x9={[g9]:{_A:F}},iL=Dg(Gg),cL=Dg(Kg),ax=e=>e._tag==="Boolean",ws=(e,t)=>Object.assign(Object.create(x9),{_tag:e,parse:t}),ix=(e,t)=>{let r=NC(t),n=Ss(r);return ws(e,o=>wt(n(o),s=>s.message))},uL=ix("Boolean",EC),fL=ix("Finite",Mu),lL=ix("Int",Fr),pL=ix("Date",Uu),dL=ws("String",e=>y(e)),mL=e=>{let t=new Map(e),r=e.map(([o])=>N(o)).join(" | "),n=ws("Choice",o=>t.has(o)?y(t.get(o)):C(r));return Object.assign(n,{choiceKeys:e.map(([o])=>o)})},hL=(e,t)=>{let r=ws("Path",B(function*(n){let o=yield*_n,s=yield*vo,a=s.isAbsolute(n)?n:s.resolve(n),i=yield*wt(o.exists(a),c=>`Failed to check path existence: ${c.message}`);if(t===!0&&!i)return yield*C(`Path does not exist: ${a}`);if(i&&e!=="either"){let c=yield*wt(o.stat(a),f=>`Failed to stat path: ${f.message}`);if(e==="file"&&c.type!=="File")return yield*C(`Path is not a file: ${a}`);if(e==="directory"&&c.type!=="Directory")return yield*C(`Path is not a directory: ${a}`)}return a}));return Object.assign(r,{pathType:e})},gL=ws("Redacted",e=>y(Dn(e))),KC=ws("FileText",B(function*(e){let t=yield*_n,r=yield*vo,n=r.isAbsolute(e)?e:r.resolve(e);return(yield*wt(t.exists(n),i=>`Failed to check file existence: ${i.message}`))?(yield*wt(t.stat(n),i=>`Failed to stat file: ${i.message}`)).type!=="File"?yield*C(`Path is not a file: ${n}`):yield*wt(t.readFileString(n),i=>`Failed to read file: ${i.message}`):yield*C(`File does not exist: ${n}`)})),y9={ini:e=>X2(e),json:e=>JSON.parse(e),toml:e=>rL(e),yml:e=>GC(e),yaml:e=>GC(e)},JC=e=>ws("FileParse",B(function*(t){let r=e?.format??t.split(".").pop(),n=y9[r];if(n===void 0)return yield*C(`Unsupported file format: ${r}`);let o=yield*KC.parse(t);return yield*ht({try:()=>n(o),catch:s=>`Failed to parse '.${r}' file content: ${s}`})})),xL=(e,t)=>{let r=Ss(e);return ws("FileSchema",B(function*(n){let o=yield*JC(t).parse(n);return yield*wt(r(o),s=>t?.errorFormatter?.(s.issue)??s.toString())}))};var yL=ws("Never",()=>C("This option does not accept values")),Qp=e=>{switch(e._tag){case"Boolean":return"boolean";case"String":return"string";case"Int":return"integer";case"Finite":return"number";case"Date":return"date";case"Path":return"path";case"Choice":return"choice";case"Redacted":return"string";case"FileText":return"file";case"FileParse":return"file";case"FileSchema":return"file";case"KeyValuePair":return"key=value";case"Never":return"none";default:return"value"}},ks=e=>e._tag==="Choice"?e.choiceKeys:void 0,ZC=e=>e._tag==="Path"?e.pathType:void 0;var S9="\x1B[0m",As="\x1B[1m",SL="\x1B[3m",Ri="\x1B[4m",EL="\x1B[9m",bL="\x1B[?25h",Yp="\x1B[?25l";var ha="\x1B[2K";var cx="\x1B[31m",ux="\x1B[32m",IL="\x1B[35m",$i="\x1B[37m",Xp="\x1B[90m",qu="\x1B[96m",rt=(e,t,...r)=>e?`${r.flat().join("")}${t}${S9}`:t,fx=()=>{let e=globalThis.process;return typeof e=="object"&&e!==null&&typeof e.stdout=="object"&&e.stdout!==null&&e.stdout.isTTY===!0&&!e.env?.NO_COLOR},Mo=(...e)=>e,CL=(e,t)=>t===void 0?`\x1B[${Math.max(e+1,0)}G`:`\x1B[${t+1};${Math.max(e+1,0)}H`,TL=(e=1)=>`\x1B[${e}B`,wL=(e,t=0)=>{let r="";return t<0&&(r+=`\x1B[${-t}A`),t>0&&(r+=`\x1B[${t}B`),e>0&&(r+=`\x1B[${e}C`),e<0&&(r+=`\x1B[${-e}D`),r},kL=e=>{let t="";for(let r=0;r<e;r++)t+="\x1B[2K"+(r<e-1?"\x1B[1A":"");return e>0&&(t+="\x1B[G"),t};var FL="~effect/cli/Prompt",RL=e=>A(e,FL),$L={prefix:"?",arrowUp:"\u2191",arrowDown:"\u2193",checkboxOn:"\u2612",checkboxOff:"\u2610",tick:"\u2714",ellipsis:"\u2026",pointerSmall:"\u203A",pointer:"\u276F",descriptionSeparator:"- ",passwordMask:"*",toggleSeparator:"/",primaryColor:qu,mutedColor:Xp,successColor:ux,errorColor:cx,submittedColor:$i},b9={...$L,checkboxOn:"[*]",checkboxOff:"[ ]",tick:"\u221A",ellipsis:"...",pointerSmall:"\xBB",pointer:">"},I9=e=>({...process.platform==="win32"?b9:$L,...e,colors:e?.colors??fx()}),ed=ge("effect/cli/Prompt/Theme",{defaultValue:I9}),Qt=e=>re(ed,t=>({...t,...e.theme}));var uT=(e,t)=>rt(e.colors,t,Mo(SL,e.errorColor)),De=(e,t,...r)=>t.length===0?"":rt(e.colors,t,...r),ga=(e,t)=>e.length===0?t:e+" "+t,C9=(e,t,r)=>{let n=Math.max(e.arrowUp.length,e.arrowDown.length);return t?e.arrowUp.padEnd(n):r?e.arrowDown.padEnd(n):" ".repeat(n)},fT=e=>{let t={initial:!1,...e,label:{confirm:"yes",deny:"no",...e.label},placeholder:{defaultConfirm:"(Y/n)",defaultDeny:"(y/N)",...e.placeholder}},r={value:t.initial};return Ni(r,{render:R9(t),process:n=>M9(n,t.initial),clear:_9(t)})},Ni=(e,...t)=>{let[r,n]=t.length===1?[void 0,t[0]]:[t[0],t[1]],o=Object.create(dT);return o._tag="Loop",o.initialState=e,o.render=n.render,o.process=n.process,o.clear=n.clear,o.events=r,o},NL=e=>{let t={initial:new globalThis.Date,dateMask:"YYYY-MM-DD HH:mm:ss",validate:y,...e,locales:{...G9,...e.locales}},r=Q9(t.dateMask,t.initial,t.locales),n=r.findIndex(s=>!s.isToken()),o={dateParts:r,typed:"",cursor:n,value:t.initial,error:v()};return Ni(o,{render:K9(t),process:J9(t),clear:U9(t)})};var T9=m(2,(e,t)=>{let r=Object.create(dT);return r._tag="OnSuccess",r.prompt=e,r.onSuccess=t,r}),ML=e=>{let t={default:0,min:globalThis.Number.NEGATIVE_INFINITY,max:globalThis.Number.POSITIVE_INFINITY,incrementBy:1,decrementBy:1,precision:2,validate:o=>o<t.min?C(`${o} must be greater than or equal to ${t.min}`):o>t.max?C(`${o} must be less than or equal to ${t.max}`):y(o),...e},r=e.default===void 0?"":`${t.default}`,n={cursor:r.length,value:r,error:v()};return Ni(n,{render:o7(t),process:s7(t),clear:jL(t)})};var lT=e=>{let t={default:0,min:globalThis.Number.NEGATIVE_INFINITY,max:globalThis.Number.POSITIVE_INFINITY,incrementBy:1,decrementBy:1,validate:o=>o<t.min?C(`${o} must be greater than or equal to ${t.min}`):o>t.max?C(`${o} must be less than or equal to ${t.max}`):y(o),...e},r=e.default===void 0?"":`${t.default}`,n={cursor:r.length,value:r,error:v()};return Ni(n,{render:r7(t),process:n7(t),clear:jL(t)})};var w9=m(2,(e,t)=>T9(e,r=>A9(t(r)))),UL=e=>ZL(e,"password").pipe(w9(Dn)),hr=B(function*(e){let t=yield*Wn,r=yield*wE(t.readInput);return yield*YC(e,t,r)},wt(()=>new Lu({})),Ks),k9=e=>{let t=0,r=-1;for(let n=0;n<e.length;n++)if(e[n].selected===!0){if(r!==-1)throw new Error("InvalidArgumentException: only a single choice can be selected by default for Prompt.Select");r=n}return r!==-1&&(t=r),t},pT=e=>{let t={maxPerPage:10,...e},r=k9(t.choices);return Ni(r,{render:d7(t),process:h7(t),clear:m7(t)})};var A9=e=>{let t=Object.create(dT);return t._tag="Succeed",t.value=e,t},DL=e=>ZL(e,"text"),LL=e=>{let t={initial:!1,active:"on",inactive:"off",...e};return Ni(t.initial,{render:F7(t),process:R7,clear:()=>O7(t)})},dT={...so({label:"Prompt",evaluate(){return hr(this)}}),[FL]:{_Output:e=>e}};var YC=(e,t,r)=>Ie(()=>{let n=e;switch(n._tag){case"Loop":return L(r,o=>v9(n,t,o));case"OnSuccess":return L(YC(n.prompt,t,r),o=>YC(n.onSuccess(o),t,r));case"Succeed":return y(n.value)}}),v9=B(function*(e,t,r){let n=Tr(e.initialState)?yield*e.initialState:e.initialState,o=j.NextFrame({state:n}),s="";for(;;){let a=yield*e.render(n,o);if(yield*rs(t.display(s+a)),s="",e.events){let i=as(r).pipe(re(f=>({_tag:"Input",input:f}))),c=yield*Ya(i,as(e.events).pipe(re(f=>({_tag:"Event",value:f}))));o=yield*e.process(c,n)}else{let i=yield*as(r);o=yield*e.process(i,n)}switch(o._tag){case"Beep":continue;case"NextFrame":{s=yield*e.clear(n,o),n=o.state;continue}case"Submit":{s=yield*e.clear(n,o);let i=yield*e.render(n,o);return yield*rs(t.display(s+i)),o.value}}}},(e,t,r)=>$c(e,rs(r.display(bL)))),j=gy(),Hu=(e,t)=>{if(t===0)return ha+CL(0);let r=0,n=e.split(Ui);for(let o of n)r+=1+Math.floor(Math.max(o.length-1,0)/t);return kL(r)},O9=(e,t)=>{let r=e.split(Ui);return t===0?r.length:Jn(Pt(r,n=>Math.ceil(n.length/t)),oc(0,(n,o)=>n+o))},mT=(e,t,r)=>r!==void 0&&r.length>0?TL(O9(r,t))+Hu(`
|
|
65
|
+
${r}`,t)+Hu(e,t):Hu(e,t),Mi="\x07",Ui=/\r?\n/,_9=e=>B(function*(t,r){let o=yield*(yield*Wn).columns,s=yield*Qt(e),a=t.value?e.placeholder.defaultConfirm:e.placeholder.defaultDeny,i=yn(a,e.message,s.prefix,s.pointerSmall,s,{plain:!0}),c=Hu(i,o),f=ha+"\x1B[G";return c+f}),P9=B(function*(e,t){let r=yield*Qt(t),n=De(r,r.prefix,r.primaryColor),o=De(r,r.pointerSmall,r.mutedColor),s=e.value?t.placeholder.defaultConfirm:t.placeholder.defaultDeny,a=rt(r.colors,s,r.mutedColor),i=yn(a,t.message,n,o,r);return Yp+i}),F9=B(function*(e,t){let r=yield*Qt(t),n=De(r,r.tick,r.successColor),o=De(r,r.ellipsis,r.mutedColor),s=e?t.label.confirm:t.label.deny;return yn(s,t.message,n,o,r)+`
|
|
66
|
+
`}),R9=e=>(t,r)=>j.$match(r,{Beep:()=>y(Mi),NextFrame:({state:n})=>P9(n,e),Submit:({value:n})=>F9(n,e)}),$9=/^y|t$/,N9=/^n|f$/,M9=(e,t)=>{let r=bt(e.input,()=>"");return e.key.name==="enter"||e.key.name==="return"?y(j.Submit({value:t})):$9.test(r.toLowerCase())?y(j.Submit({value:!0})):N9.test(r.toLowerCase())?y(j.Submit({value:!1})):y(j.Beep())},U9=e=>B(function*(t,r){let o=yield*(yield*Wn).columns,s=yield*Qt(e),a=ha+"\x1B[G",i=oc(t.dateParts,"",(l,p)=>l+p.toString()),c=yn(i,e.message,s.prefix,s.pointerSmall,s,{plain:!0}),f=ve(t.error)?wf(t.error.value.split(Ui),{onEmpty:()=>"",onNonEmpty:l=>ga(s.pointerSmall,l.join(`
|
|
67
|
+
`))}):"";return mT(c,o,f)+a}),D9=(e,t,r)=>{if(ve(e.error)){let n=e.error.value.split(Ui);if($s(n)){let o=De(r,t,r.errorColor),s=Pt(n,a=>uT(r,a));return`\x1B[s
|
|
68
|
+
`+ga(o,s.join(`
|
|
69
|
+
`))+"\x1B[u"}}return""},BL=(e,t,r=!1)=>oc(e.dateParts,"",(n,o,s)=>{let a=o.toString();if(s===e.cursor&&!r){let i=Mo(Ri,t.primaryColor);return n+rt(t.colors,a,i)}return n+a}),L9=B(function*(e,t){let r=yield*Qt(t),n=De(r,r.prefix,r.primaryColor),o=De(r,r.pointerSmall,r.mutedColor),s=BL(e,r),a=yn(s,t.message,n,o,r),i=D9(e,r.pointerSmall,r);return Yp+a+i}),B9=B(function*(e,t){let r=yield*Qt(t),n=De(r,r.tick,r.successColor),o=De(r,r.ellipsis,r.mutedColor),s=BL(e,r,!0);return yn(s,t.message,n,o,r)+`
|
|
70
|
+
`}),j9=e=>(e.dateParts[e.cursor].increment(),j.NextFrame({state:{...e,typed:""}})),z9=e=>(e.dateParts[e.cursor].decrement(),j.NextFrame({state:{...e,typed:""}})),q9=e=>{let t=e.dateParts[e.cursor].previousPart();return ve(t)?j.NextFrame({state:{...e,typed:"",cursor:e.dateParts.indexOf(t.value)}}):j.Beep()},H9=e=>{let t=e.dateParts[e.cursor].nextPart();return ve(t)?j.NextFrame({state:{...e,typed:"",cursor:e.dateParts.indexOf(t.value)}}):j.Beep()},W9=e=>{let t=e.dateParts[e.cursor].nextPart(),r=Re(t,{onNone:()=>e.dateParts.findIndex(n=>!n.isToken()),onSome:n=>e.dateParts.indexOf(n)});return j.NextFrame({state:{...e,typed:"",cursor:r}})},V9=(e,t)=>{if(/\d/.test(e)){let r=t.typed+e;return t.dateParts[t.cursor].setValue(r),j.NextFrame({state:{...t,typed:r}})}return j.Beep()},G9={months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},K9=e=>(t,r)=>j.$match(r,{Beep:()=>y(Mi),NextFrame:({state:n})=>L9(n,e),Submit:()=>B9(t,e)}),J9=e=>(t,r)=>{switch(t.key.name){case"left":return y(q9(r));case"right":return y(H9(r));case"k":case"up":return y(j9(r));case"j":case"down":return y(z9(r));case"tab":return y(W9(r));case"enter":case"return":return Gs(e.validate(r.value),{onFailure:n=>j.NextFrame({state:{...r,error:R(n)}}),onSuccess:n=>j.Submit({value:n})});default:return y(V9(bt(t.input,()=>""),r))}},Z9=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,AL={1:({token:e,...t})=>new lx({token:e.replace(/\\(.)/g,"$1"),...t}),2:e=>new nT(e),3:e=>new oT(e),4:e=>new sT(e),5:e=>new aT(e),6:e=>new rT(e),7:e=>new tT(e),8:e=>new eT(e),9:e=>new XC(e)},Q9=(e,t,r)=>{let n=[],o=null;for(;o=Z9.exec(e);){let a=o.shift(),i=o.findIndex(c=>c!==void 0);if(i in AL){let c=o[i]||a;n.push(AL[i]({token:c,date:t,parts:n,locales:r}))}else n.push(new lx({token:o[i]||a,date:t,parts:n,locales:r}))}let s=n.reduce((a,i)=>{let c=a[a.length-1];return i.isToken()&&c!==void 0&&c.isToken()?c.setValue(i.token):a.push(i),a},Ma());return n.splice(0,n.length,...s),n},Vn=class{token;date;parts;locales;constructor(t){this.token=t.token,this.locales=t.locales,this.date=t.date||new globalThis.Date,this.parts=t.parts||[this]}isToken(){return!1}nextPart(){let t=bt(Dd(this.parts,r=>r===this),()=>0);return kf(this.parts.slice(t+1),r=>!r.isToken())}previousPart(){let t=Dd(this.parts,r=>r===this);return ve(t)?Ld(this.parts.slice(0,t.value),r=>!r.isToken()):v()}toString(){return globalThis.String(this.date)}},lx=class extends Vn{increment(){}decrement(){}setValue(t){this.token=this.token+t}isToken(){return!0}toString(){return this.token}},XC=class extends Vn{increment(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}decrement(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setValue(t){this.date.setMilliseconds(globalThis.Number.parseInt(t.slice(-this.token.length)))}toString(){return`${this.date.getMilliseconds()}`.padStart(4,"0").substring(0,this.token.length)}},eT=class extends Vn{increment(){this.date.setSeconds(this.date.getSeconds()+1)}decrement(){this.date.setSeconds(this.date.getSeconds()-1)}setValue(t){this.date.setSeconds(globalThis.Number.parseInt(t.slice(-2)))}toString(){let t=`${this.date.getSeconds()}`;return this.token.length>1?t.padStart(2,"0"):t}},tT=class extends Vn{increment(){this.date.setMinutes(this.date.getMinutes()+1)}decrement(){this.date.setMinutes(this.date.getMinutes()-1)}setValue(t){this.date.setMinutes(globalThis.Number.parseInt(t.slice(-2)))}toString(){let t=`${this.date.getMinutes()}`;return this.token.length>1?t.padStart(2,"0"):t}},rT=class extends Vn{increment(){this.date.setHours(this.date.getHours()+1)}decrement(){this.date.setHours(this.date.getHours()-1)}setValue(t){this.date.setHours(globalThis.Number.parseInt(t.slice(-2)))}toString(){let t=/h/.test(this.token)?this.date.getHours()%12||12:this.date.getHours();return this.token.length>1?`${t}`.padStart(2,"0"):`${t}`}},nT=class extends Vn{increment(){this.date.setDate(this.date.getDate()+1)}decrement(){this.date.setDate(this.date.getDate()-1)}setValue(t){this.date.setDate(globalThis.Number.parseInt(t.slice(-2)))}toString(){let t=this.date.getDate(),r=this.date.getDay();switch(this.token){case"DD":return`${t}`.padStart(2,"0");case"Do":return`${t}${this.ordinalIndicator(t)}`;case"d":return`${r+1}`;case"ddd":return this.locales.weekdaysShort[r];case"dddd":return this.locales.weekdays[r];default:return`${t}`}}ordinalIndicator(t){if(t>=11&&t<=13)return"th";switch(t%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}},oT=class extends Vn{increment(){this.date.setMonth(this.date.getMonth()+1)}decrement(){this.date.setMonth(this.date.getMonth()-1)}setValue(t){let r=globalThis.Number.parseInt(t.slice(-2))-1;this.date.setMonth(r<0?0:r)}toString(){let t=this.date.getMonth();switch(this.token.length){case 2:return`${t+1}`.padStart(2,"0");case 3:return this.locales.monthsShort[t];case 4:return this.locales.months[t];default:return`${t+1}`}}},sT=class extends Vn{increment(){this.date.setFullYear(this.date.getFullYear()+1)}decrement(){this.date.setFullYear(this.date.getFullYear()-1)}setValue(t){this.date.setFullYear(globalThis.Number.parseInt(t.slice(-4)))}toString(){let t=`${this.date.getFullYear()}`.padStart(4,"0");return this.token.length===2?t.slice(-2):t}},aT=class extends Vn{increment(){this.date.setHours((this.date.getHours()+12)%24)}decrement(){this.increment()}setValue(t){}toString(){let t=this.date.getHours()>=12?"pm":"am";return/A/.test(this.token)?t.toUpperCase():t}};var yn=(e,t,r,n,o,s)=>{let a=r.length===0?"":r+" ",i=c=>{let f=a+c;return n.length>0&&(f+=" "+n),e.length>0?f+=" "+e:n.length>0&&(f+=" "),f};return wf(t.split(Ui),{onEmpty:()=>i(""),onNonEmpty:c=>{let f=s?.plain===!0?c:Pt(c,u=>rt(o.colors,u,As));return i(f.join(`
|
|
71
|
+
`))}})};var Y9=(e,t,r,n)=>{if(!e.disabled&&e.description&&t){let o=r.descriptionSeparator+e.description;return n?.plain===!0?o:rt(r.colors,o,r.mutedColor)}return""};var jL=e=>B(function*(t,r){let o=yield*(yield*Wn).columns,s=yield*Qt(e),a=ha+"\x1B[G",i=zL(t,s.pointerSmall,s,{plain:!0}),c=hT(t,s.prefix,s.pointerSmall,e,s,{plain:!0});return mT(c,o,i)+a}),X9=(e,t,r,n)=>{let o=e.value===""?"":`${e.value}`;if(t||n?.plain===!0)return o;let s=ve(e.error)?r.errorColor:Mo(Ri,r.primaryColor);return rt(r.colors,o,s)},zL=(e,t,r,n)=>ve(e.error)?wf(e.error.value.split(Ui),{onEmpty:()=>"",onNonEmpty:o=>{if(n?.plain===!0)return ga(t,o.join(`
|
|
72
|
+
`));let s=De(r,t,r.errorColor),a=Pt(o,i=>uT(r,i));return`\x1B[s
|
|
73
|
+
`+ga(s,a.join(`
|
|
74
|
+
`))+"\x1B[u"}}):"",hT=(e,t,r,n,o,s,a=!1)=>{let i=X9(e,a,o,s);return yn(i,n.message,t,r,o,s)},qL=B(function*(e,t){let r=yield*Qt(t),n=De(r,r.prefix,r.primaryColor),o=De(r,r.pointerSmall,r.mutedColor),s=zL(e,r.pointerSmall,r);return hT(e,n,o,t,r)+s}),HL=B(function*(e,t){let r=yield*Qt(t),n=De(r,r.tick,r.successColor),o=De(r,r.ellipsis,r.mutedColor);return hT(e,n,o,t,r,void 0,!0)+`
|
|
75
|
+
`}),WL=e=>{if(e.value.length<=0)return y(j.Beep());let t=e.value.slice(0,e.value.length-1);return y(j.NextFrame({state:{...e,value:t,error:v()}}))},VL=e=>y(j.NextFrame({state:{...e,cursor:0,value:"",error:v()}})),e7=(e,t)=>{if(t.value.length===0&&e==="-")return y(j.NextFrame({state:{...t,value:"-",error:v()}}));let r=globalThis.Number.parseInt(t.value+e);return globalThis.Number.isNaN(r)?y(j.Beep()):y(j.NextFrame({state:{...t,value:`${r}`,error:v()}}))},t7=(e,t)=>{if(e==="."&&t.value.includes("."))return y(j.Beep());if(t.value.length===0&&e==="-")return y(j.NextFrame({state:{...t,value:"-",error:v()}}));let r=globalThis.Number.parseFloat(t.value+e);return globalThis.Number.isNaN(r)?y(j.Beep()):y(j.NextFrame({state:{...t,value:e==="."?`${r}.`:t.value.includes(".")&&/^\d$/.test(e)?t.value+e:`${r}`,error:v()}}))},r7=e=>(t,r)=>j.$match(r,{Beep:()=>y(Mi),NextFrame:({state:n})=>qL(n,e),Submit:()=>HL(t,e)}),n7=e=>(t,r)=>{if(t.key.ctrl&&t.key.name==="u")return VL(r);switch(t.key.name){case"backspace":return WL(r);case"k":case"up":return y(j.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`${e.incrementBy}`:`${globalThis.Number.parseInt(r.value)+e.incrementBy}`,error:v()}}));case"j":case"down":return y(j.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`-${e.decrementBy}`:`${globalThis.Number.parseInt(r.value)-e.decrementBy}`,error:v()}}));case"enter":case"return":{let n=globalThis.Number.parseInt(r.value);return globalThis.Number.isNaN(n)?y(j.NextFrame({state:{...r,error:R("Must provide an integer value")}})):Gs(e.validate(n),{onFailure:o=>j.NextFrame({state:{...r,error:R(o)}}),onSuccess:o=>j.Submit({value:o})})}default:return e7(bt(t.input,()=>""),r)}},o7=e=>(t,r)=>j.$match(r,{Beep:()=>y(Mi),NextFrame:({state:n})=>qL(n,e),Submit:()=>HL(t,e)}),s7=e=>(t,r)=>{if(t.key.ctrl&&t.key.name==="u")return VL(r);switch(t.key.name){case"backspace":return WL(r);case"k":case"up":return y(j.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`${e.incrementBy}`:`${globalThis.Number.parseFloat(r.value)+e.incrementBy}`,error:v()}}));case"j":case"down":return y(j.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`-${e.decrementBy}`:`${globalThis.Number.parseFloat(r.value)-e.decrementBy}`,error:v()}}));case"enter":case"return":{let n=globalThis.Number.parseFloat(r.value);return globalThis.Number.isNaN(n)?y(j.NextFrame({state:{...r,error:R("Must provide a floating point value")}})):L(fe(()=>v_(n,e.precision)),o=>Gs(e.validate(o),{onFailure:s=>j.NextFrame({state:{...r,error:R(s)}}),onSuccess:s=>j.Submit({value:s})}))}default:return t7(bt(t.input,()=>""),r)}};var gT=(e,t,r,n,o)=>r.message===void 0?void 0:yn("",r.message,e,t,n,o),GL=(e,t)=>e===void 0?t:e+`
|
|
76
|
+
`+t;var a7=(e,t,r,n,o,s)=>{let a=C9(o,n===r.startIndex&&r.startIndex>0,n===r.endIndex-1&&r.endIndex<t.length);if(s?.plain===!0)return e===n?o.pointer+a:a+" ".repeat(o.pointer.length);if(t[n].disabled){let i=Mo(As,o.mutedColor);return e===n?De(o,o.pointer,i)+a:a+" ".repeat(o.pointer.length)}return e===n?De(o,o.pointer,o.primaryColor)+a:a+" ".repeat(o.pointer.length)};var i7=(e,t,r,n)=>{if(n?.plain===!0)return e.title;let o=e.title;return t?e.disabled?rt(r.colors,o,Mo(Ri,r.mutedColor)):rt(r.colors,o,Mo(Ri,r.primaryColor)):e.disabled?rt(r.colors,o,Mo(EL,r.mutedColor)):o},KL=(e,t,r,n)=>{let o=t.choices,s=$7(e,o.length,t.maxPerPage),a=[];for(let i=s.startIndex;i<s.endIndex;i++){let c=o[i],f=e===i,u=a7(e,o,s,i,r,n),l=i7(c,f,r,n),p=Y9(c,f,r,n);a.push(u+l+" "+p)}return a.join(`
|
|
77
|
+
`)};var c7=B(function*(e,t){let r=yield*Qt(t),n=KL(e,t,r),o=De(r,r.prefix,r.primaryColor),s=De(r,r.pointerSmall,r.mutedColor),a=gT(o,s,t,r);return Yp+GL(a,n)});var u7=B(function*(e,t){let r=yield*Qt(t),n=t.choices[e].title,o=De(r,r.tick,r.successColor),s=De(r,r.ellipsis,r.mutedColor);return(gT(o,s,t,r)??o)+" "+rt(r.colors,n,r.submittedColor)+`
|
|
78
|
+
`});var f7=(e,t)=>e===0?y(j.NextFrame({state:t.length-1})):y(j.NextFrame({state:e-1})),l7=(e,t)=>e===t.length-1?y(j.NextFrame({state:0})):y(j.NextFrame({state:e+1})),p7=(e,t)=>y(j.NextFrame({state:(e+1)%t.length}));var d7=e=>(t,r)=>j.$match(r,{Beep:()=>y(Mi),NextFrame:({state:n})=>c7(n,e),Submit:()=>u7(t,e)});var m7=e=>B(function*(t,r){let o=yield*(yield*Wn).columns,s=yield*Qt(e),a=ha+"\x1B[G",i=gT(s.prefix,s.pointerSmall,e,s,{plain:!0}),c=KL(t,e,s,{plain:!0});return Hu(GL(i,c),o)+a});var h7=e=>(t,r)=>{switch(t.key.name){case"k":case"up":return f7(r,e.choices);case"j":case"down":return l7(r,e.choices);case"tab":return p7(r,e.choices);case"enter":case"return":{let n=e.choices[r];return n.disabled?y(j.Beep()):y(j.Submit({value:n.value}))}default:return y(j.Beep())}};var g7=B(function*(e,t){let n=yield*(yield*Wn).columns,o=yield*Qt(t),s=ha+"\x1B[G",a=JL(e,o.pointerSmall,o,{plain:!0});return mT(xT(e,o.prefix,o.pointerSmall,t,o,{plain:!0}),n,a)+s}),x7=(e,t,r,n,o)=>{let s=e.value;if(o?.plain===!0)switch(t.type){case"hidden":return"";case"password":return r.passwordMask.repeat(s.length);case"text":return s}if(s.length===0)return"";let a=ve(e.error)?r.errorColor:n?r.submittedColor:Mo(Ri,r.primaryColor);switch(t.type){case"hidden":return"";case"password":return De(r,r.passwordMask.repeat(s.length),a);case"text":return rt(r.colors,s,a)}},JL=(e,t,r,n)=>ve(e.error)?wf(e.error.value.split(Ui),{onEmpty:()=>"",onNonEmpty:o=>{if(n?.plain===!0)return ga(t,o.join(`
|
|
79
|
+
`));let s=De(r,t,r.errorColor),a=Pt(o,i=>uT(r,i));return`\x1B[s
|
|
80
|
+
`+ga(s,a.join(`
|
|
81
|
+
`))+"\x1B[u"}}):"",xT=(e,t,r,n,o,s,a=!1)=>{let i=x7(e,n,o,a,s);return yn(i,n.message,t,r,o,s)},y7=B(function*(e,t){let r=yield*Qt(t),n=De(r,r.prefix,r.primaryColor),o=De(r,r.pointerSmall,r.mutedColor),s=xT(e,n,o,t,r),a=JL(e,r.pointerSmall,r),i=t.type==="password"?r.passwordMask.length:1,c=(e.cursor-e.value.length)*i;return s+a+wL(c)}),S7=B(function*(e,t){let r=yield*Qt(t),n=De(r,r.tick,r.successColor),o=De(r,r.ellipsis,r.mutedColor);return xT(e,n,o,t,r,void 0,!0)+`
|
|
82
|
+
`}),E7=e=>{if(e.cursor<=0)return y(j.Beep());let t=e.value.slice(0,e.cursor-1),r=e.value.slice(e.cursor),n=e.cursor-1,o=`${t}${r}`;return y(j.NextFrame({state:{...e,cursor:n,value:o,error:v()}}))},b7=e=>y(j.NextFrame({state:{...e,cursor:0,value:"",error:v()}})),I7=e=>{if(e.cursor<=0)return y(j.Beep());let t=e.cursor-1;return y(j.NextFrame({state:{...e,cursor:t,error:v()}}))},C7=e=>{if(e.cursor>=e.value.length)return y(j.Beep());let t=Math.min(e.cursor+1,e.value.length);return y(j.NextFrame({state:{...e,cursor:t,error:v()}}))},vL=e=>y(j.NextFrame({state:{...e,cursor:0,error:v()}})),OL=e=>y(j.NextFrame({state:{...e,cursor:e.value.length,error:v()}})),T7=(e,t)=>{if(e.value===t.default)return y(j.Beep());let r=e.value.length===0?t.default:e.value;return y(j.NextFrame({state:{...e,value:r,cursor:r.length,error:v()}}))},w7=(e,t)=>{let r=t.value.slice(0,t.cursor),n=t.value.slice(t.cursor),o=`${r}${e}${n}`,s=t.cursor+e.length;return y(j.NextFrame({state:{...t,cursor:s,value:o,error:v()}}))},k7=e=>(t,r)=>j.$match(r,{Beep:()=>y(Mi),NextFrame:({state:n})=>y7(n,e),Submit:()=>S7(t,e)}),A7=e=>(t,r)=>{if(t.key.ctrl)switch(t.key.name){case"u":return b7(r);case"a":return vL(r);case"e":return OL(r);default:return y(j.Beep())}switch(t.key.name){case"backspace":return E7(r);case"left":return I7(r);case"right":return C7(r);case"home":return vL(r);case"end":return OL(r);case"enter":case"return":{let n=r.value;return Gs(e.validate(n),{onFailure:o=>j.NextFrame({state:{...r,value:n,error:R(o)}}),onSuccess:o=>j.Submit({value:o})})}case"tab":return T7(r,e);default:return w7(bt(t.input,()=>""),r)}},v7=e=>(t,r)=>g7(t,e),ZL=(e,t)=>{let r={default:"",type:t,validate:y,...e},n={cursor:r.default.length,value:r.default,error:v()};return Ni(n,{render:k7(r),process:A7(r),clear:v7(r)})},O7=B(function*(e){let r=yield*(yield*Wn).columns,n=yield*Qt(e),o=ha+"\x1B[G",s=e.active+" "+ga(n.toggleSeparator,e.inactive),a=yn(s,e.message,n.prefix,n.pointerSmall,n,{plain:!0});return Hu(a,r)+o}),QL=(e,t,r,n=!1)=>{let o=De(r,r.toggleSeparator,r.mutedColor),s=Mo(Ri,n?r.submittedColor:r.primaryColor),a=e?t.inactive:rt(r.colors,t.inactive,s);return(e?rt(r.colors,t.active,s):t.active)+" "+ga(o,a)},_7=B(function*(e,t){let r=yield*Qt(t),n=De(r,r.prefix,r.primaryColor),o=De(r,r.pointerSmall,r.mutedColor),s=QL(e,t,r),a=yn(s,t.message,n,o,r);return Yp+a}),P7=B(function*(e,t){let r=yield*Qt(t),n=De(r,r.tick,r.successColor),o=De(r,r.ellipsis,r.mutedColor),s=QL(e,t,r,!0);return yn(s,t.message,n,o,r)+`
|
|
83
|
+
`}),_L=y(j.NextFrame({state:!0})),PL=y(j.NextFrame({state:!1})),F7=e=>(t,r)=>{switch(r._tag){case"Beep":return y(Mi);case"NextFrame":return _7(t,e);case"Submit":return P7(t,e)}},R7=(e,t)=>{switch(e.key.name){case"0":case"j":case"delete":case"right":case"down":return PL;case"1":case"k":case"left":case"up":return _L;case" ":case"tab":return t?PL:_L;case"enter":case"return":return y(j.Submit({value:t}));default:return y(j.Beep())}},$7=(e,t,r)=>{let n=r===void 0?t:r,o=Math.min(t-n,e-Math.floor(n/2));o<0&&(o=0);let s=Math.min(o+n,t);return{startIndex:o,endIndex:s}};var YL="~effect/cli/Param",Yt="argument",ya="flag",td={[YL]:{_A:F},pipe(){return te(this,arguments)}},dx=e=>A(e,YL);var Li=e=>e.kind==="flag",Ir=e=>{let t=r=>e.kind===Yt?M7(e.name,e.primitiveType,r):U7(e.name,e.primitiveType,r);return Object.setPrototypeOf({_tag:"Single",...e,description:e.description??v(),aliases:e.aliases??[],hidden:e.hidden??!1,parse:t},td)},yT=(e,t)=>Ir({name:t,primitiveType:dL,kind:e}),XL=(e,t)=>Ir({name:t,primitiveType:uL,kind:e}),ST=(e,t)=>Ir({name:t,primitiveType:lL,kind:e}),ET=(e,t)=>Ir({name:t,primitiveType:fL,kind:e}),bT=(e,t)=>Ir({name:t,primitiveType:pL,kind:e}),rd=(e,t,r)=>Ir({name:t,primitiveType:mL(r),kind:e}),IT=(e,t,r)=>{let n=r.map(o=>[o,o]);return rd(e,t,n)},nd=(e,t,r)=>Ir({name:t,kind:e,primitiveType:hL(r?.pathType??"either",r?.mustExist),typeName:r?.typeName}),CT=(e,t,r)=>nd(e,t,{pathType:"directory",typeName:"directory",mustExist:r?.mustExist}),TT=(e,t,r)=>nd(e,t,{pathType:"file",typeName:"file",mustExist:r?.mustExist}),wT=(e,t)=>Ir({name:t,primitiveType:gL,kind:e}),kT=(e,t)=>Ir({name:t,primitiveType:KC,kind:e}),AT=(e,t,r)=>Ir({name:t,primitiveType:JC(r),kind:e}),vT=(e,t,r,n)=>Ir({name:t,primitiveType:xL(r,n),kind:e});var OT=e=>Ir({name:"__never__",primitiveType:yL,kind:e}),N7=/^-+/,eB=m(2,(e,t)=>xa(e,r=>Ir({...r,aliases:[...r.aliases,t.replace(N7,"")]}))),mx=m(2,(e,t)=>xa(e,r=>Ir({...r,description:R(t)})));var od=m(2,(e,t)=>{let r=n=>re(e.parse(n),([o,s])=>[o,t(s)]);return Object.assign(Object.create(td),{_tag:"Map",kind:e.kind,param:e,f:t,parse:r})}),Bi=(e,t,r=[])=>{let n=r.map(o=>()=>o().parse);return Object.assign(Object.create(td),{_tag:"Transform",kind:e.kind,param:e,alternatives:r,f:t,parse:t(e.parse,n)})},Vu=m(2,(e,t)=>Bi(e,r=>n=>L(r(n),([o,s])=>t(s).pipe(re(a=>[o,a]))))),_T=m(3,(e,t,r)=>{let n=Ku(e);return Bi(e,o=>s=>L(o(s),([a,i])=>ht({try:()=>t(i),catch:c=>r(c)}).pipe(wt(c=>new mr({option:n.name,value:globalThis.String(i),expected:c,kind:n.kind})),re(c=>[a,c]))))}),Di=e=>{let t=r=>e.parse(r).pipe(re(([n,o])=>[n,R(o)]),yE({MissingOption:()=>y([r.arguments,v()]),MissingArgument:()=>y([r.arguments,v()])}));return Object.assign(Object.create(td),{_tag:"Optional",kind:e.kind,param:e,parse:t})},hx=m(2,(e,t)=>Tr(t)?Vu(Di(e),Re({onNone:()=>t,onSome:y})):od(Di(e),bt(()=>t))),PT=m(2,(e,t)=>{let r=(o,s)=>new mr({option:o._tag==="MissingOption"?o.option:o.argument,value:"config",expected:s.message,kind:o._tag==="MissingOption"?"flag":"argument"}),n=(o,s)=>J2(t).pipe(wt(a=>r(o,a)),L(Re({onNone:()=>C(o),onSome:a=>y([s.arguments,a])})));return Bi(e,o=>s=>o(s).pipe(ts(["MissingOption","MissingArgument"],a=>n(a,s))))}),FT=m(2,(e,t)=>{let r=(n,o)=>L(RL(t)?y(t):t,hr).pipe(re(s=>[o.arguments,s]),ts("QuitError",()=>C(n)));return Bi(e,n=>o=>n(o).pipe(ts(["MissingOption","MissingArgument"],s=>r(s,o))))}),Gu=(e,t)=>{let r=Ku(e),n=o=>r.kind==="argument"?D7(e,r,o,t):L7(e,r,o,t);return Object.assign(Object.create(td),{_tag:"Variadic",kind:e.kind,param:e,min:Fs(t?.min),max:Fs(t?.max),parse:n})},RT=m(3,(e,t,r)=>{if(t<0)throw new Error("between: min must be non-negative");if(r<t)throw new Error("between: max must be greater than or equal to min");return Gu(e,{min:t,max:r})}),$T=m(2,(e,t)=>{if(t<0)throw new Error("atMost: max must be non-negative");return Gu(e,{max:t})}),NT=m(2,(e,t)=>{if(t<0)throw new Error("atLeast: min must be non-negative");return Gu(e,{min:t})}),gx=m(3,(e,t,r)=>Vu(e,B(function*(n){let o=t(n);if(ve(o))return o.value;let s=Ku(e);return yield*new mr({option:s.name,value:globalThis.String(n),expected:r(n),kind:s.kind})}))),MT=m(3,(e,t,r)=>gx(e,fk(t),r)),xx=m(2,(e,t)=>xa(e,r=>Ir({...r,typeName:t}))),UT=m(2,(e,t)=>{let r=Ss(t);return Vu(e,n=>wt(r(n),o=>{let s=Ku(e);return new mr({option:s.name,value:globalThis.String(n),expected:`Schema validation failed: ${o.message}`,kind:s.kind})}))}),DT=m(2,(e,t)=>Bi(e,(r,n)=>o=>vn(r(o),()=>n[0]()(o)),[t])),LT=m(2,(e,t)=>Bi(e,(r,n)=>o=>vn(re(r(o),([s,a])=>[s,H(a)]),()=>re(n[0]()(o),([s,a])=>[s,Z(a)])),[t])),M7=B(function*(e,t,r){if(r.arguments.length===0)return yield*new ju({argument:e});let n=r.arguments[0],o=yield*wt(t.parse(n),s=>new mr({option:e,value:n,expected:s,kind:"argument"}));return[r.arguments.slice(1),o]}),U7=B(function*(e,t,r){let n=r.flags[e];if(n===void 0||n.length===0)return yield*new Bu({option:e});let o=n[0],s=yield*wt(t.parse(o),a=>new mr({option:e,value:o,expected:a,kind:"flag"}));return[r.arguments,s]}),D7=B(function*(e,t,r,n){let o=[],s=n?.min??0,a=n?.max??Number.POSITIVE_INFINITY,i=0,c=r.arguments;for(;c.length>0&&i<a;){let[f,u]=yield*e.parse({flags:r.flags,arguments:c});o.push(u),c=f,i++}return i<s?yield*i===0?new ju({argument:t.name}):new mr({option:t.name,value:`${i} values`,expected:`at least ${s} value${s===1?"":"s"}`,kind:t.kind}):[c,o]}),L7=B(function*(e,t,r,n){let o=[],a=[t.name,...t.aliases].flatMap(c=>r.flags[c]??[]),i=a.length;if(pt(n?.min)&&i<n.min)return yield*i===0?new Bu({option:t.name}):new mr({option:t.name,value:`${i} occurrences`,expected:`at least ${n.min} value${n.min===1?"":"s"}`,kind:t.kind});if(pt(n?.max)&&i>n.max)return yield*new mr({option:t.name,value:`${i} occurrences`,expected:`at most ${n.max} value${n.max===1?"":"s"}`,kind:t.kind});for(let c of a){let[,f]=yield*e.parse({flags:{[t.name]:[c]},arguments:[]});o.push(f)}return[r.arguments,o]}),BT=(e,t)=>{let r=e;switch(r._tag){case"Single":return t.Single(r);case"Map":return t.Map(r);case"Transform":return t.Transform(r);case"Optional":return t.Optional(r);case"Variadic":return t.Variadic(r)}},xa=(e,t)=>BT(e,{Single:r=>t(r),Map:r=>od(xa(r.param,t),r.f),Transform:r=>Bi(xa(r.param,t),r.f,r.alternatives.map(n=>()=>xa(n(),t))),Optional:r=>Di(xa(r.param,t)),Variadic:r=>Gu(xa(r.param,t),{min:er(r.min),max:er(r.max)})}),nt=e=>BT(e,{Single:t=>[t],Map:t=>nt(t.param),Transform:t=>[...nt(t.param),...t.alternatives.flatMap(r=>nt(r()))],Optional:t=>nt(t.param),Variadic:t=>nt(t.param)}),Ku=e=>{let t=nt(e);if(t.length===0)throw new Error("No Single param found in param structure");if(t.length>1)throw new Error(`Multiple Single params found: ${t.map(r=>r.name).join(", ")}`);return t[0]},$r=e=>BT(e,{Single:()=>({isOptional:!1,isVariadic:!1,variadicMin:v(),variadicMax:v()}),Map:t=>$r(t.param),Transform:t=>$r(t.param),Optional:t=>({...$r(t.param),isOptional:!0}),Variadic:t=>({...$r(t.param),isVariadic:!0,variadicMin:t.min,variadicMax:t.max})});var B7=e=>yT(Yt,e),j7=e=>ST(Yt,e),z7=(e,t)=>TT(Yt,e,t),q7=(e,t)=>CT(Yt,e,t),H7=e=>ET(Yt,e),W7=e=>bT(Yt,e),V7=(e,t)=>IT(Yt,e,t),G7=(e,t)=>nd(Yt,e,t),K7=e=>wT(Yt,e),J7=e=>kT(Yt,e),Z7=(e,t)=>AT(Yt,e,t),Q7=(e,t,r)=>vT(Yt,e,t,r),Y7=OT(Yt),X7=e=>Di(e),eX=m(2,(e,t)=>mx(e,t)),tX=hx,rX=m(2,(e,t)=>PT(e,t)),nX=m(2,(e,t)=>FT(e,t)),oX=m(e=>dx(e[0]),(e,t)=>Gu(e,t)),sX=m(2,(e,t)=>od(e,t)),aX=m(2,(e,t)=>Vu(e,t)),iX=m(3,(e,t,r)=>_T(e,t,r)),cX=m(2,(e,t)=>NT(e,t)),uX=m(2,(e,t)=>$T(e,t)),fX=m(3,(e,t,r)=>RT(e,t,r)),lX=m(2,(e,t)=>UT(e,t)),pX=(e,t)=>rd(Yt,e,t),dX=m(2,(e,t)=>xx(e,t)),mX=m(3,(e,t,r)=>MT(e,t,r)),hX=m(3,(e,t,r)=>gx(e,t,r)),gX=m(2,(e,t)=>DT(e,t)),xX=m(2,(e,t)=>LT(e,t));var Ju=ge("effect/cli/CliOutput",{defaultValue:()=>yX()});var Sx=e=>e.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,t=>`\\x${t.charCodeAt(0).toString(16).padStart(2,"0")}`),yX=e=>{let t=e?.colors??fx(),r=t?{bold:a=>`\x1B[1m${a}\x1B[0m`,dim:a=>`\x1B[2m${a}\x1B[0m`,cyan:a=>`\x1B[36m${a}\x1B[0m`,green:a=>`\x1B[32m${a}\x1B[0m`,blue:a=>`\x1B[34m${a}\x1B[0m`,yellow:a=>`\x1B[33m${a}\x1B[0m`,magenta:a=>`\x1B[35m${a}\x1B[0m`}:{bold:a=>a,dim:a=>a,cyan:a=>a,green:a=>a,blue:a=>a,yellow:a=>a,magenta:a=>a},n=t?"\x1B[0m":"",o=t?"\x1B[31m":"",s=t?"\x1B[1m":"";return{formatHelpDoc:a=>kX(a,r),formatCliError:a=>Sx(a.message),formatError:a=>`
|
|
84
|
+
${s}${o}ERROR${n}
|
|
85
|
+
${Sx(a.message)}${n}`,formatErrors:a=>{if(a.length===0)return"";if(a.length===1)return`
|
|
86
|
+
${s}${o}ERROR${n}
|
|
87
|
+
${Sx(a[0].message)}${n}`;let i=new Map;for(let f of a){let u=f._tag??"Error",l=i.get(u)??[];l.push(f),i.set(u,l)}let c=[];c.push(`
|
|
88
|
+
${s}${o}ERRORS${n}`);for(let[,f]of i)for(let u of f)c.push(` ${Sx(u.message)}${n}`);return c.join(`
|
|
89
|
+
`)},formatVersion:(a,i)=>`${r.bold(a)} ${r.dim("v")}${r.bold(i)}`}},SX=e=>e.replace(/\u001B\[[0-9;]*m/g,""),EX=new Intl.Segmenter(void 0,{granularity:"grapheme"}),bX=/[\p{Mark}\p{Control}\p{Default_Ignorable_Code_Point}]/gu,IX=new RegExp("\\p{Emoji_Presentation}","u"),CX=e=>e<4352?!1:e<=4447||e===9001||e===9002||e>=11904&&e<=12350||e>=12352&&e<=42191||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=110592&&e<=111359||e>=127488&&e<=127569||e>=131072&&e<=262141,TX=e=>{let t=e.replace(bX,"");return t.length===0?0:IX.test(e)||e.includes("\uFE0F")||CX(t.codePointAt(0))?2:1},jT=e=>{let t=0;for(let{segment:r}of EX.segment(SX(e)))t+=TX(r);return t},wX=(e,t)=>{let r=jT(e),n=Math.max(0,t-r);return e+" ".repeat(n)},sd=(e,t)=>{let r=Math.max(...e.map(o=>jT(o.left)))+4,n=t===void 0?r:Math.min(r,t);return e.map(({left:o,right:s})=>` ${wX(o,Math.max(n,jT(o)+1))}${s}`).join(`
|
|
90
|
+
`)},tB=(e,t)=>t?`${e}, ${t}`:e,kX=(e,t)=>{let r=[];if(e.description&&(r.push(t.bold("DESCRIPTION")),r.push(` ${e.description}`),r.push("")),r.push(t.bold("USAGE")),r.push(` ${t.cyan(e.usage)}`),r.push(""),e.args&&e.args.length>0){r.push(t.bold("ARGUMENTS"));let n=e.args.map(o=>{let s=o.name;o.variadic&&(s+="...");let a=t.green(s),i=t.dim(o.type),c=`${a} ${i}`,f=o.required?"":t.dim(" (optional)"),u=bt(o.description,()=>"")+f;return{left:c,right:u}});r.push(sd(n,25)),r.push("")}if(e.flags.length>0){r.push(t.bold("FLAGS"));let n=e.flags.map(o=>{let s=[];s.push(t.green(`--${o.name}`));for(let c of o.aliases)s.push(t.green(c));let a=s.join(", "),i=o.type!=="boolean"?` ${t.dim(o.type)}`:"";return{left:a+i,right:bt(o.description,()=>"")}});r.push(sd(n)),r.push("")}if(e.globalFlags&&e.globalFlags.length>0){r.push(t.bold("GLOBAL FLAGS"));let n=e.globalFlags.map(o=>{let s=[];s.push(t.green(`--${o.name}`));for(let c of o.aliases)s.push(t.green(c));let a=s.join(", "),i=o.type!=="boolean"?` ${t.dim(o.type)}`:"";return{left:a+i,right:bt(o.description,()=>"")}});r.push(sd(n)),r.push("")}if(e.subcommands&&e.subcommands.length>0){let n=e.subcommands.find(o=>o.group===void 0);n&&(r.push(t.bold("SUBCOMMANDS")),r.push(sd(n.commands.map(o=>({left:t.cyan(tB(o.name,o.alias)),right:o.shortDescription??o.description})),20)),e.subcommands.length>1&&r.push(""));for(let o of e.subcommands)o.group!==void 0&&(r.push(t.bold(`${o.group}:`)),r.push(sd(o.commands.map(s=>({left:t.cyan(tB(s.name,s.alias)),right:s.shortDescription??s.description})),20)),r.push(""))}if(e.examples&&e.examples.length>0){r.push(t.bold("EXAMPLES"));let n=!0,o=!1;for(let s of e.examples)s.description?(n||r.push(""),r.push(` ${t.dim(`# ${s.description}`)}`)):o&&r.push(""),r.push(` ${t.cyan(s.command)}`),n=!1,o=!!s.description;r.push("")}return r[r.length-1]===""&&r.pop(),r.join(`
|
|
91
|
+
`)};var ad=e=>e.replace(/'/g,"'\\''"),qT=e=>e.replace(/[^a-zA-Z0-9_]/g,"_"),HT=e=>{let t=[`--${e.name}`];for(let r of e.aliases)t.push(r.length===1?`-${r}`:`--${r}`);return e.type._tag==="Boolean"&&t.push(`--no-${e.name}`),t},AX=(e,t)=>{if(e.length===0)return;let r=e.map(HT);t.push(` local ${r.map((n,o)=>`_used_${o}=""`).join(" ")}`),t.push(" for ((i = 1; i < cword; i++)); do"),t.push(' case "${words[i]%%=*}" in'),r.forEach((n,o)=>{t.push(` ${n.join("|")}) _used_${o}=1 ;;`)}),t.push(" esac"),t.push(" done"),t.push(' local _filtered_flags=""'),r.forEach((n,o)=>{t.push(` [[ -n "$_used_${o}" ]] || _filtered_flags+=" ${n.join(" ")}"`)}),t.push("")},vX=(e,t)=>{t.push(`${e}()`),t.push("{"),t.push(' local _cur="$1" _word="$2"; shift 2'),t.push(""),t.push(' local _head="${_cur%"$_word"}"'),t.push(' local _open=""'),t.push(' case "$_head" in'),t.push(` *\\') _open="'" ;;`),t.push(` *\\") _open='"' ;;`),t.push(" esac"),t.push(""),t.push(' local _prefix="$_cur" _committed="$_head"'),t.push(" _prefix=${_prefix//\\\\/}; _prefix=${_prefix//\\\"/}; _prefix=${_prefix//\\'/}"),t.push(" _committed=${_committed//\\\\/}; _committed=${_committed//\\\"/}; _committed=${_committed//\\'/}"),t.push(""),t.push(" COMPREPLY=()"),t.push(" local _choice _rest _match"),t.push(' for _choice in "$@"; do'),t.push(' [[ "$_choice" == "$_prefix"* ]] || continue'),t.push(' _rest="${_choice#"$_committed"}"'),t.push(' case "$_open" in'),t.push(` "'")`),t.push(` if [[ "$_head" == "'" ]]; then`),t.push(" _match=${_rest//\\'/\\'\\\\\\'\\'}"),t.push(" else"),t.push(` [[ "$_rest" == *\\'* ]] && continue`),t.push(' _match="$_rest"'),t.push(" fi"),t.push(" ;;"),t.push(` '"')`),t.push(' _match="${_rest//\\\\/\\\\\\\\}"'),t.push(' _match="${_match//\\$/\\\\$}"'),t.push(' _match="${_match//\\`/\\\\\\`}"'),t.push(' _match="${_match//\\"/\\\\\\"}"'),t.push(" ;;"),t.push(" *)"),t.push(` printf -v _match '%q' "$_rest"`),t.push(` [[ -z "$_head" && "$_match" == '~'* ]] && _match="\\\\$_match"`),t.push(" ;;"),t.push(" esac"),t.push(' [[ -n "$_open" && "$_match" == *"$_open" ]] && _match+="$_open"'),t.push(' COMPREPLY+=("$_match")'),t.push(" done"),t.push("}"),t.push("")},rB=(e,t)=>`${e} "$cur" "$_comp_word" ${t.map(r=>`'${ad(r)}'`).join(" ")}`,OX=(e,t)=>{switch(e._tag){case"Boolean":return;case"Choice":return rB(t,e.values);case"Path":return e.pathType==="directory"?'COMPREPLY=( $(compgen -d -- "$cur") )':'COMPREPLY=( $(compgen -f -- "$cur") )';default:return}},_X=(e,t)=>{switch(e._tag){case"Choice":return rB(t,e.values);case"Path":return e.pathType==="directory"?'COMPREPLY=( $(compgen -d -- "$cur") )':'COMPREPLY=( $(compgen -f -- "$cur") )';default:return}},nB=(e,t,r,n)=>{let o=[...t,e.name],s=`_${o.map(qT).join("_")}`;r.push(`${s}()`),r.push("{"),r.push(" local cur prev words cword i"),r.push(t.length===0?" local _command_index=0":' local _command_index="$1"'),r.push(' _init_completion -n "$COMP_WORDBREAKS" || return'),t.length===0&&r.push(' local _comp_word="$2"'),r.push("");let a=e.flags.filter(c=>c.type._tag!=="Boolean");if(a.length>0){r.push(" # Flag value completions"),r.push(' case "$prev" in');for(let c of a){let f=[`--${c.name}`];for(let l of c.aliases)f.push(l.length===1?`-${l}`:`--${l}`);let u=OX(c.type,n);u&&(r.push(` ${f.join("|")})`),r.push(` ${u}`),r.push(" return"),r.push(" ;;"))}r.push(" esac"),r.push("")}if(e.subcommands.length>0){r.push(" # Subcommand dispatch"),r.push(" local cmd _skip_next=0"),r.push(" for ((i = _command_index + 1; i < cword; i++)); do"),r.push(" if (( _skip_next )); then"),r.push(" _skip_next=0"),r.push(" continue"),r.push(" fi"),r.push(' case "${words[i]}" in');for(let c of e.flags){if(c.type._tag==="Boolean")continue;let f=HT(c);r.push(` ${f.join("|")}) _skip_next=1 ;;`),r.push(` ${f.map(u=>`${u}=*`).join("|")}) ;;`)}for(let c of e.subcommands){let f=`_${[...o,c.name].map(qT).join("_")}`;r.push(` ${c.name})`),r.push(` ${f} "$i"`),r.push(" return"),r.push(" ;;")}r.push(" esac"),r.push(" done"),r.push("")}AX(e.flags,r),(e.flags.length>0||e.subcommands.length>0)&&(r.push(" # Complete flags (filtered) and subcommands"),r.push(' if [[ "$cur" == -* ]]; then'),e.flags.length>0&&r.push(' COMPREPLY=( $(compgen -W "$_filtered_flags" -- "$cur") )'),r.push(" return"),r.push(" fi"),r.push(""));let i=e.arguments.flatMap((c,f)=>{let u=_X(c.type,n);return u===void 0?[]:[{argument:c,completion:u,index:f}]});if(i.length>0){r.push(" # Positional argument completions"),r.push(" local _position=0 _skip_next=0 _end_of_options=0"),r.push(" for ((i = _command_index + 1; i < cword; i++)); do"),r.push(" if (( _skip_next )); then"),r.push(" _skip_next=0"),r.push(" continue"),r.push(" fi"),r.push(" if (( _end_of_options )); then"),r.push(" ((_position += 1))"),r.push(" continue"),r.push(" fi"),r.push(' case "${words[i]}" in'),r.push(" --) _end_of_options=1 ;;");for(let f of e.flags){let u=HT(f);f.type._tag==="Boolean"?r.push(` ${u.join("|")}) ;;`):(r.push(` ${u.join("|")}) _skip_next=1 ;;`),r.push(` ${u.map(l=>`${l}=*`).join("|")}) ;;`))}r.push(" -*) ;;"),r.push(" *) ((_position += 1)) ;;"),r.push(" esac"),r.push(" done"),r.push(' case "$_position" in');for(let{argument:f,completion:u,index:l}of i)f.variadic||(r.push(` ${l})`),r.push(` ${u}`),r.push(" return"),r.push(" ;;"));r.push(" esac");let c=i.find(({argument:f})=>f.variadic);c!==void 0&&(r.push(` if (( _position >= ${c.index} )); then`),r.push(` ${c.completion}`),r.push(" return"),r.push(" fi"))}else if(e.subcommands.length>0){let c=e.subcommands.map(f=>f.name);r.push(` COMPREPLY=( $(compgen -W '${c.join(" ")}' -- "$cur") )`)}r.push("}"),r.push("");for(let c of e.subcommands)nB(c,o,r,n)},oB=(e,t)=>{let r=[],n=qT(e),o=`_${n}--choices`;return r.push(`###-begin-${ad(e)}-completions-###`),r.push("#"),r.push("# Static completion script for Bash"),r.push("#"),r.push("# Installation:"),r.push(`# ${ad(e)} --completions bash >> ~/.bashrc`),r.push("#"),r.push(""),r.push("if ! type _init_completion &>/dev/null; then"),r.push(" _init_completion()"),r.push(" {"),r.push(" COMPREPLY=()"),r.push(' local _i _j=0 _piece _line="$COMP_LINE"'),r.push(' words=("${COMP_WORDS[0]}")'),r.push(" cword=0"),r.push(' _line="${_line#*"${COMP_WORDS[0]}"}"'),r.push(" for ((_i = 1; _i < ${#COMP_WORDS[@]}; _i++)); do"),r.push(' _piece="${COMP_WORDS[_i]}"'),r.push(' if [[ "$_line" == [[:blank:]]* ]]; then'),r.push(" ((_j++))"),r.push(' words[_j]="$_piece"'),r.push(" else"),r.push(' words[_j]="${words[_j]}$_piece"'),r.push(" fi"),r.push(" ((_i == COMP_CWORD)) && cword=$_j"),r.push(' _line="${_line#*"$_piece"}"'),r.push(" done"),r.push(' cur="${words[cword]}"'),r.push(' prev=""'),r.push(' ((cword > 0)) && prev="${words[cword-1]}"'),r.push(" return 0"),r.push(" }"),r.push("fi"),r.push(""),vX(o,r),nB(t,[],r,o),r.push(`complete -F _${n} ${ad(e)}`),r.push(`###-end-${ad(e)}-completions-###`),r.join(`
|
|
92
|
+
`)};var Sa=e=>e.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),sB=e=>Sa(e.replace(/[^A-Za-z0-9_.,/@%+-]/gu,"\\$&")),FX=(e,t)=>{if(e.length===0)return t.length>0?"__fish_use_subcommand":"";let r=e.map(n=>`__fish_seen_subcommand_from ${n}`).join("; and ");return t.length>0?`${r}; and not __fish_seen_subcommand_from ${t.join(" ")}`:r},WT=e=>{let t=[];for(let r of e.aliases)r.length===1&&t.push(`-s ${r}`);t.push(e.name);for(let r of e.aliases)r.length>1&&t.push(r);return e.type._tag==="Boolean"&&t.push(`no-${e.name}`),`not __fish_contains_opt ${t.join(" ")}`},RX=e=>{let t=[`--${e.name}`];for(let r of e.aliases)t.push(r.length===1?`-${r}`:`--${r}`);return`begin; ${WT(e)}; or contains -- (commandline -poc)[-1] ${t.join(" ")}; end`},$X=e=>{let t=[`-l ${e.name}`];for(let n of e.aliases)n.length===1?t.push(`-s ${n}`):t.push(`-l ${n}`);e.description&&t.push(`-d '${Sa(e.description)}'`);let r=NX(e.type);return r&&t.push(r),t},NX=e=>{switch(e._tag){case"Boolean":return;case"Choice":return`-r -f -a '${e.values.map(sB).join(" ")}'`;case"Path":return e.pathType==="directory","-r -F";default:return"-r -f"}},MX=e=>{switch(e._tag){case"Choice":return`-r -f -a '${e.values.map(sB).join(" ")}'`;case"Path":return"-r -F";default:return}},aB=(e,t,r,n)=>{let o=t.subcommands.map(c=>c.name),s=FX(r,o),a=s?`-n '${s}'`:"";if(!t.arguments.some(c=>c.type._tag==="Path")){let c=[`complete -c ${e}`];a&&c.push(a),c.push("-f"),n.push(c.join(" "))}for(let c of t.subcommands){let f=[`complete -c ${e}`];a&&f.push(a),f.push(`-f -a '${Sa(c.name)}'`),c.description&&f.push(`-d '${Sa(c.description)}'`),n.push(f.join(" "))}for(let c of t.flags){let f=c.type._tag==="Boolean",u=f?WT(c):RX(c),l=s?`${s}; and ${u}`:u,p=l?`-n '${l}'`:"",h=[`complete -c ${e}`];if(p&&h.push(p),h.push(...$X(c)),n.push(h.join(" ")),f){let g=[`complete -c ${e}`];p&&g.push(p),g.push(`-l no-${c.name}`),c.description&&g.push(`-d '${Sa(`Disable ${c.name}`)}'`),n.push(g.join(" "))}}if(t.flags.length>0){let c='not string match -q -- "-*" (commandline -ct)',f=s?`${s}; and ${c}`:c;for(let u of t.flags){let l=`${f}; and ${WT(u)}`,p=u.type._tag==="Boolean",h=[`complete -c ${e}`];if(h.push(`-n '${l}'`),h.push(`-f -a '--${u.name}'`),u.description&&h.push(`-d '${Sa(u.description)}'`),n.push(h.join(" ")),p){let g=[`complete -c ${e}`];g.push(`-n '${l}'`),g.push(`-f -a '--no-${u.name}'`),u.description&&g.push(`-d '${Sa(`Disable ${u.name}`)}'`),n.push(g.join(" "))}}}for(let c of t.arguments){let f=MX(c.type);if(f){let u=[`complete -c ${e}`];a&&u.push(a),u.push(f),c.description&&u.push(`-d '${Sa(c.description)}'`),n.push(u.join(" "))}}for(let c of t.subcommands)aB(e,c,[...r,c.name],n)},iB=(e,t)=>{let r=[];return r.push(`###-begin-${e}-completions-###`),r.push("#"),r.push("# Static completion script for Fish"),r.push("#"),r.push("# Installation:"),r.push(`# ${e} --completions fish > ~/.config/fish/completions/${e}.fish`),r.push("#"),r.push(""),aB(e,t,[],r),r.push(""),r.push(`###-end-${e}-completions-###`),r.join(`
|
|
93
|
+
`)};var Ea=e=>{let t=[],r="";for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);if(o>=32&&o<128){r+=e[n]==="'"?"''":e[n];continue}(r!==""||t.length===0)&&t.push(`'${r}'`),r="",t.push(`[char]0x${o.toString(16).toUpperCase().padStart(4,"0")}`)}return(r!==""||t.length===0)&&t.push(`'${r}'`),t.length===1?t[0]:`(${t.join(" + ")})`},cB=e=>`@(${e.map(Ea).join(", ")})`,GT=e=>e?Ea(e):"$null",DX=e=>e.replace(/[^a-zA-Z0-9_]/g,"_"),LX=e=>[`--${e.name}`,...e.aliases.map(t=>t.length===1?`-${t}`:`--${t}`)],uB=e=>`values = ${cB(e._tag==="Choice"?e.values:[])}; pathType = ${e._tag==="Path"?Ea(e.pathType):"$null"}`,BX=e=>`@{ name = ${Ea(e.name)}; forms = ${cB(LX(e))}; takesValue = $${e.type._tag!=="Boolean"}; ${uB(e.type)}; description = ${GT(e.description)} }`,jX=e=>`@{ name = ${Ea(e.name)}; variadic = $${e.variadic}; ${uB(e.type)}; description = ${GT(e.description)} }`,VT=(e,t,r)=>{if(r.length===0){e.push(` ${t} = @()`);return}e.push(` ${t} = @(`);for(let n of r)e.push(` ${n}`);e.push(" )")},fB=(e,t,r,n,o)=>{let s=r.join(" ");if(!o.has(s)){o.add(s),n.push(`${e}[${Ea(s)}] = @{`),VT(n,"subcommands",t.subcommands.map(a=>`@{ name = ${Ea(a.name)}; description = ${GT(a.description)} }`)),VT(n,"flags",t.flags.map(BX)),VT(n,"arguments",t.arguments.map(jX)),n.push("}");for(let a of t.subcommands)fB(e,a,[...r,a.name],n,o)}},zX=e=>String.raw` param($wordToComplete, $commandAst, $cursorPosition)
|
|
94
|
+
|
|
95
|
+
$spec = ${e}
|
|
96
|
+
$results = [System.Collections.Generic.List[System.Management.Automation.CompletionResult]]::new()
|
|
97
|
+
$booleanLiterals = @('true', 'yes', 'on', '1', 'y', 'false', 'no', 'off', '0', 'n')
|
|
98
|
+
|
|
99
|
+
$index = {
|
|
100
|
+
param($context)
|
|
101
|
+
$lookup = [hashtable]::new([System.StringComparer]::Ordinal)
|
|
102
|
+
foreach ($flag in $context.flags) {
|
|
103
|
+
foreach ($form in $flag.forms) { $lookup[$form] = $flag }
|
|
104
|
+
}
|
|
105
|
+
$lookup
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
$add = {
|
|
109
|
+
param([string]$value, [string]$type, $tooltip, [string]$typed, [string]$textPrefix)
|
|
110
|
+
if (-not $value.StartsWith($typed, [System.StringComparison]::OrdinalIgnoreCase)) { return }
|
|
111
|
+
$text = $value
|
|
112
|
+
if ($value -notmatch '^[\w./:%+=\\-]+$') { $text = "'" + ($value -replace "['\u2018-\u201b]", '$0$0') + "'" }
|
|
113
|
+
$text = $textPrefix + $text
|
|
114
|
+
$label = $value
|
|
115
|
+
if (-not $label) { $label = $text }
|
|
116
|
+
if (-not $tooltip) { $tooltip = $label }
|
|
117
|
+
$results.Add([System.Management.Automation.CompletionResult]::new($text, $label, $type, $tooltip))
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
$addValues = {
|
|
121
|
+
param($entry, [string]$typed, [string]$textPrefix)
|
|
122
|
+
foreach ($value in $entry.values) {
|
|
123
|
+
if ($textPrefix -eq '' -and (& $optionLike $value)) { continue }
|
|
124
|
+
& $add $value 'ParameterValue' $entry.description $typed $textPrefix
|
|
125
|
+
}
|
|
126
|
+
if ($entry.pathType) {
|
|
127
|
+
foreach ($file in [System.Management.Automation.CompletionCompleters]::CompleteFilename($typed)) {
|
|
128
|
+
if ($entry.pathType -eq 'directory' -and $file.ResultType -ne 'ProviderContainer') { continue }
|
|
129
|
+
$results.Add([System.Management.Automation.CompletionResult]::new($textPrefix + $file.CompletionText, $file.ListItemText, $file.ResultType, $file.ToolTip))
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
$addFlags = {
|
|
135
|
+
param([string]$typed)
|
|
136
|
+
foreach ($flag in $context.flags) {
|
|
137
|
+
if ($used.ContainsKey($flag.name)) { continue }
|
|
138
|
+
foreach ($form in $flag.forms) {
|
|
139
|
+
& $add $form 'ParameterName' $flag.description $typed ''
|
|
140
|
+
}
|
|
141
|
+
if (-not $flag.takesValue) {
|
|
142
|
+
$tooltip = $null
|
|
143
|
+
if ($flag.description) { $tooltip = 'Disable ' + $flag.name }
|
|
144
|
+
& $add ('--no-' + $flag.name) 'ParameterName' $tooltip $typed ''
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
# As in the CLI lexer, nothing after '--' is an option, and negative numbers
|
|
150
|
+
# and a lone '-' are values.
|
|
151
|
+
$optionLike = {
|
|
152
|
+
param([string]$word)
|
|
153
|
+
-not $endOfOptions -and $word -match '^-.' -and $word -notmatch '^-(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$'
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
# A typed value that has no candidates completes to itself, so the engine
|
|
157
|
+
# does not fall back to listing files.
|
|
158
|
+
$keepTyped = {
|
|
159
|
+
if ($results.Count -eq 0 -and $current) {
|
|
160
|
+
$results.Add([System.Management.Automation.CompletionResult]::new($current, $current, 'ParameterValue', $current))
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
$path = ''
|
|
165
|
+
$context = $spec[$path]
|
|
166
|
+
$lookup = & $index $context
|
|
167
|
+
$used = [hashtable]::new([System.StringComparer]::Ordinal)
|
|
168
|
+
$pending = $null
|
|
169
|
+
$endOfOptions = $false
|
|
170
|
+
$position = 0
|
|
171
|
+
|
|
172
|
+
# The engine strips the quotes from a quoted word.
|
|
173
|
+
$typed = [string]$wordToComplete
|
|
174
|
+
if ($typed -match '^([''"])(.*?)\1?$') { $typed = $Matches[2] }
|
|
175
|
+
$current = $null
|
|
176
|
+
|
|
177
|
+
$elements = $commandAst.CommandElements
|
|
178
|
+
for ($i = 1; $i -lt $elements.Count; $i++) {
|
|
179
|
+
$element = $elements[$i]
|
|
180
|
+
$word = $element.Extent.Text
|
|
181
|
+
if ($element -is [System.Management.Automation.Language.StringConstantExpressionAst]) { $word = $element.Value }
|
|
182
|
+
if ($element.Extent.EndOffset -ge $cursorPosition) {
|
|
183
|
+
if ($element -is [System.Management.Automation.Language.ConstantExpressionAst] -and $element.Extent.StartOffset -le $cursorPosition) {
|
|
184
|
+
$current = $element.Extent.Text
|
|
185
|
+
if ($element.Extent.EndOffset -eq $cursorPosition) { $typed = $word }
|
|
186
|
+
}
|
|
187
|
+
break
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
# A flag takes the next word as its value unless it is an option or '--';
|
|
191
|
+
# a boolean flag only takes a boolean literal.
|
|
192
|
+
$isOption = & $optionLike $word
|
|
193
|
+
if ($null -ne $pending) {
|
|
194
|
+
$flag = $pending
|
|
195
|
+
$pending = $null
|
|
196
|
+
if ($flag.takesValue) {
|
|
197
|
+
if (-not $isOption) { continue }
|
|
198
|
+
} elseif ($booleanLiterals -ccontains $word) { continue }
|
|
199
|
+
}
|
|
200
|
+
if ($endOfOptions) { $position++; continue }
|
|
201
|
+
if ($word -ceq '--') { $endOfOptions = $true; continue }
|
|
202
|
+
|
|
203
|
+
if ($isOption) {
|
|
204
|
+
$hasValue = $word.Contains('=')
|
|
205
|
+
if ($hasValue) {
|
|
206
|
+
$forms = @($word.Substring(0, $word.IndexOf('=')))
|
|
207
|
+
} elseif ($word.StartsWith('--')) {
|
|
208
|
+
$forms = @($word)
|
|
209
|
+
} else {
|
|
210
|
+
$forms = @(foreach ($char in $word.Substring(1).ToCharArray()) { '-' + $char })
|
|
211
|
+
}
|
|
212
|
+
foreach ($form in $forms) {
|
|
213
|
+
$pending = $null
|
|
214
|
+
$flag = $lookup[$form]
|
|
215
|
+
if ($null -eq $flag) {
|
|
216
|
+
if ($form.StartsWith('--no-')) {
|
|
217
|
+
$name = $form.Substring(5)
|
|
218
|
+
$flag = $lookup['--' + $name]
|
|
219
|
+
if ($null -ne $flag -and -not $flag.takesValue -and $flag.name -ceq $name) { $used[$name] = $true }
|
|
220
|
+
}
|
|
221
|
+
continue
|
|
222
|
+
}
|
|
223
|
+
$used[$flag.name] = $true
|
|
224
|
+
if (-not $hasValue) { $pending = $flag }
|
|
225
|
+
}
|
|
226
|
+
continue
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if ($position -eq 0 -and $context.subcommands.name -ccontains $word) {
|
|
230
|
+
if ($path) { $path = $path + ' ' + $word } else { $path = $word }
|
|
231
|
+
$context = $spec[$path]
|
|
232
|
+
$lookup = & $index $context
|
|
233
|
+
$used = [hashtable]::new([System.StringComparer]::Ordinal)
|
|
234
|
+
continue
|
|
235
|
+
}
|
|
236
|
+
$position++
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
$typedIsOption = & $optionLike $typed
|
|
240
|
+
if ($null -ne $pending -and $pending.takesValue -and -not $typedIsOption) {
|
|
241
|
+
& $addValues $pending $typed ''
|
|
242
|
+
& $keepTyped
|
|
243
|
+
return $results
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if ($typedIsOption) {
|
|
247
|
+
if ($typed -match '^(-[^=]+)=(.*)$') {
|
|
248
|
+
$form = $Matches[1]
|
|
249
|
+
$flag = $lookup[$form]
|
|
250
|
+
if ($null -ne $flag -and $flag.takesValue) {
|
|
251
|
+
& $addValues $flag $Matches[2] ($form + '=')
|
|
252
|
+
& $keepTyped
|
|
253
|
+
}
|
|
254
|
+
} else {
|
|
255
|
+
& $addFlags $typed
|
|
256
|
+
}
|
|
257
|
+
return $results
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (-not $endOfOptions -and $position -eq 0) {
|
|
261
|
+
foreach ($sub in $context.subcommands) {
|
|
262
|
+
& $add $sub.name 'Command' $sub.description $typed ''
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
$arguments = $context.arguments
|
|
267
|
+
if ($position -lt $arguments.Count) {
|
|
268
|
+
& $addValues $arguments[$position] $typed ''
|
|
269
|
+
} elseif ($arguments.Count -gt 0 -and $arguments[-1].variadic) {
|
|
270
|
+
& $addValues $arguments[-1] $typed ''
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (-not $endOfOptions) {
|
|
274
|
+
& $addFlags $typed
|
|
275
|
+
}
|
|
276
|
+
return $results`,lB=(e,t)=>{let r=`$global:_${DX(e)}_Completions`,n=[];return n.push(`###-begin-${e}-completions-###`),n.push("#"),n.push("# Static completion script for PowerShell"),n.push("#"),n.push("# Installation:"),n.push(`# ${e} --completions powershell > ${e}-completion.ps1`),n.push("# then add this line to your $PROFILE (use the full path to the file):"),n.push(`# . <PATH>\\${e}-completion.ps1`),n.push("#"),n.push(""),n.push(`${r} = [hashtable]::new([System.StringComparer]::Ordinal)`),fB(r,t,[],n,new Set),n.push(""),n.push(`Register-ArgumentCompleter -Native -CommandName ${Ea(e)} -ScriptBlock {`),n.push(zX(r)),n.push("}"),n.push(""),n.push(`###-end-${e}-completions-###`),n.join(`
|
|
277
|
+
`)};var JT=e=>e.replace(/\\/g,"\\\\").replace(/'/g,"'\\''").replace(/:/g,"\\:"),pB=e=>JT(e).replace(/]/g,"\\]"),hB=e=>e.replace(/[^A-Za-z0-9_.,/@%+-]/gu,"\\$&").replace(/'/g,"'\\''"),KT=e=>e.replace(/[^a-zA-Z0-9_]/g,"_"),HX=e=>{let t=[`--${e.name}`];for(let r of e.aliases)t.push(r.length===1?`-${r}`:`--${r}`);return e.type._tag==="Boolean"&&t.push(`--no-${e.name}`),t},WX=e=>{switch(e._tag){case"Boolean":return"";case"Choice":return`:value:(${e.values.map(hB).join(" ")})`;case"Path":return e.pathType==="directory"?":directory:_directories":":file:_files";case"Int":return":integer:";case"Finite":return":float:";case"Date":return":date:";default:return":value:"}},VX=e=>{switch(e._tag){case"Choice":return`(${e.values.map(hB).join(" ")})`;case"Path":return e.pathType==="directory"?"_directories":"_files";default:return""}},dB=e=>{let t=[],r=e.description?`[${pB(e.description)}]`:"",n=WX(e.type),o=`(${HX(e).join(" ")})`;t.push(`'${o}--${e.name}${r}${n}'`);for(let s of e.aliases){let a=s.length===1?"-":"--";t.push(`'${o}${a}${s}${r}${n}'`)}if(e.type._tag==="Boolean"){let s=e.description?`[${pB(`Disable ${e.name}`)}]`:"";t.push(`'${o}--no-${e.name}${s}'`)}return t},mB=e=>{let t=e.description?JT(e.description):e.name,r=VX(e.type);return`'${e.variadic?"*":""}:${t}:${r}'`},gB=(e,t,r)=>{let n=[...t,e.name],o=`_${n.map(KT).join("_")}`;if(r.push(`${o}() {`),e.subcommands.length>0){r.push(" local context state state_descr line"),r.push(" typeset -A opt_args"),r.push(""),r.push(" local -a commands"),r.push(" commands=(");for(let s of e.subcommands){let a=s.description?JT(s.description):"";r.push(` '${s.name}:${a}'`)}r.push(" )"),r.push(""),r.push(" local -a specs"),r.push(" specs=(");for(let s of e.flags)for(let a of dB(s))r.push(` ${a}`);if(e.arguments.length>0){r.push(" -"),r.push(" parent-arguments");for(let s of e.arguments)r.push(` ${mB(s)}`);r.push(" -"),r.push(" subcommands")}r.push(" '1:command:->command'"),r.push(" '*::arg:->args'"),r.push(" )"),r.push(""),r.push(' _arguments -C "${specs[@]}"'),r.push(""),r.push(' case "$state" in'),r.push(" command)"),r.push(" _describe -t commands 'commands' commands"),r.push(" ;;"),r.push(" args)"),r.push(' case "$words[1]" in');for(let s of e.subcommands){let a=`_${[...n,s.name].map(KT).join("_")}`;r.push(` ${s.name})`),r.push(` ${a}`),r.push(" ;;")}r.push(" esac"),r.push(" ;;"),r.push(" esac")}else{let s=[];for(let a of e.flags)s.push(...dB(a));for(let a of e.arguments)s.push(mB(a));if(s.length>0){r.push(" local -a specs"),r.push(" specs=(");for(let a of s)r.push(` ${a}`);r.push(" )"),r.push(' _arguments "${specs[@]}"')}}r.push("}"),r.push("");for(let s of e.subcommands)gB(s,n,r)},xB=(e,t)=>{let r=[],n=KT(e);return r.push(`#compdef ${e}`),r.push(`###-begin-${e}-completions-###`),r.push("#"),r.push("# Static completion script for Zsh"),r.push("#"),r.push("# Installation:"),r.push(`# ${e} --completions zsh > ~/.zsh/completions/_${e}`),r.push("# then add ~/.zsh/completions to your fpath"),r.push("#"),r.push(""),gB(t,[],r),r.push("# Handle both direct invocation and autoload"),r.push('if [[ "${zsh_eval_context[-1]}" == "loadautofunc" ]]; then'),r.push(` _${n} "$@"`),r.push("else"),r.push(` compdef _${n} ${e}`),r.push("fi"),r.push(`###-end-${e}-completions-###`),r.join(`
|
|
278
|
+
`)};var yB=(e,t,r)=>{switch(t){case"bash":return oB(e,r);case"zsh":return xB(e,r);case"fish":return iB(e,r);case"powershell":return lB(e,r)}};var Ex=e=>XL(ya,e);var ZT=(e,t)=>rd(ya,e,t);var QT=m(2,(e,t)=>eB(e,t)),Zu=m(2,(e,t)=>mx(e,t)),YT=m(2,(e,t)=>xx(e,t));var XT=e=>Di(e),bx=hx;var Ix="~effect/cli/Command/Config/Internal",Cx=e=>{let t=[],r=[],n=[];function o(a){let i=Object.create(null);for(let c of Object.keys(a))i[c]=s(a[c]);return i}function s(a){if(Array.isArray(a))return{_tag:"Array",children:a.map(i=>s(i))};if(dx(a)){let i=t.length;return t.push(a),a.kind==="argument"?n.push(a):r.push(a),{_tag:"Param",index:i}}else return{_tag:"Nested",tree:o(a)}}return{[Ix]:Ix,flags:r,arguments:n,orderedParams:t,tree:o(e)}},bB=Cx({}),IB=(e,t)=>{switch(e._tag){case"Param":return{_tag:"Param",index:e.index+t};case"Array":return{_tag:"Array",children:e.children.map(r=>IB(r,t))};case"Nested":return{_tag:"Nested",tree:CB(e.tree,t)}}},CB=(e,t)=>{let r=Object.create(null);for(let n of Object.keys(e))r[n]=IB(e[n],t);return r},ew=(e,t)=>{let r=e.orderedParams.length;return{[Ix]:Ix,flags:[...e.flags,...t.flags],arguments:[...e.arguments,...t.arguments],orderedParams:[...e.orderedParams,...t.orderedParams],tree:Object.assign(Object.create(null),e.tree,CB(t.tree,r))}},tw=(e,t)=>{let r={};for(let o of Object.keys(e))U(r,o,n(e[o]));return r;function n(o){switch(o._tag){case"Param":return t[o.index];case"Array":return o.children.map(s=>n(s));case"Nested":return tw(o.tree,t)}}};var id="~effect/cli/Command",Pe=e=>e,KX={...so({label:"Command",evaluate(){return Pe(this).service}})},Nr=e=>{let t=e.config,r=e.contextConfig??bB,n=e.service??Ye(`${id}/${e.name}`),o=e.annotations??cr(),s=e.globalFlags??[],a=e.subcommands??[],i=(l,p)=>pt(e.handle)?e.handle(l,p):C(new Ts({commandPath:p,errors:[]})),c=e.parse??Tx(t),f=e.parseContext??Tx(r,{allowLeftovers:!0}),u=l=>{let p=[],h=[];for(let T of t.arguments){let w=nt(T),P=$r(T);for(let O of w)p.push({name:O.name,type:O.typeName??Qp(O.primitiveType),description:O.description,required:!P.isOptional&&(!P.isVariadic||lk(P.variadicMin,d=>d>0)),variadic:P.isVariadic})}let g=l.length>0?l.join(" "):e.name;a.some(T=>T.commands.some(w=>!w.unlisted))&&(g+=" <subcommand>"),g+=" [flags]";for(let T of p){let w=T.variadic?`<${T.name}...>`:`<${T.name}>`;g+=` ${T.required?w:`[${w}]`}`}for(let T of t.flags){let w=nt(T),P=$r(T);for(let O of w)O.hidden||h.push(wx(O,P))}let x=[];for(let T of a){let w=T.commands.filter(P=>!P.unlisted);w.length!==0&&x.push({group:T.group,commands:Pt(w,P=>({name:P.name,alias:P.alias,shortDescription:P.shortDescription,description:P.description??""}))})}let b=e.examples??[];return{description:e.description??"",usage:g,flags:h,annotations:o,...p.length>0&&{args:p},...x.length>0&&{subcommands:x},...b.length>0&&{examples:b}}};return Object.assign(Object.create(KX),{[id]:id,name:e.name,examples:e.examples??[],annotations:o,globalFlags:s,subcommands:a,unlisted:e.unlisted??!1,config:t,contextConfig:r,service:n,parse:c,parseContext:f,handle:i,buildHelpDoc:u,...pt(e.description)?{description:e.description}:{},...pt(e.shortDescription)?{shortDescription:e.shortDescription}:{},...pt(e.alias)?{alias:e.alias}:{}})},wx=(e,t)=>{let r=e.aliases.map(n=>n.length===1?`-${n}`:`--${n}`);return{name:e.name,aliases:r,type:e.typeName??Qp(e.primitiveType),description:JX(e.description,ks(e.primitiveType)),required:e.primitiveType._tag!=="Boolean"&&!t.isOptional}},JX=(e,t)=>{if(t===void 0||t.length===0)return e;let r=`(choices: ${t.join(", ")})`;return Re(e,{onNone:()=>R(r),onSome:n=>R(`${n} ${r}`)})},Tx=(e,t)=>B(function*(r){let n={flags:r.flags,arguments:r.arguments},[o,s]=yield*ZX(n,e.orderedParams);return t?.allowLeftovers!==!0&&o.length>0?yield*new Vp({arguments:o}):tw(e.tree,s)}),ZX=B(function*(e,t){let r=[],n=e.arguments;for(let o of t){let[s,a]=yield*o.parse({flags:e.flags,arguments:n});r.push(a),n=s}return[n,r]}),rw=(e,t,r)=>{let n=Pe(e),o=new Set;(a=>{for(let i of a){let c=nt(i);for(let f of c)o.add(f.name)}})((r?.contextConfig??n.contextConfig).flags);for(let a of t){let i=Pe(a);for(let c of i.config.flags){let f=nt(c);for(let u of f)if(o.has(u.name))throw new Wp({option:u.name,parentCommand:e.name,childCommand:a.name})}}};var QX=e=>{switch(e.primitiveType._tag){case"Boolean":return{_tag:"Boolean"};case"Int":return{_tag:"Int"};case"Finite":return{_tag:"Finite"};case"Date":return{_tag:"Date"};case"Choice":return{_tag:"Choice",values:ks(e.primitiveType)??[]};case"Path":return{_tag:"Path",pathType:ZC(e.primitiveType)??"either"};case"FileText":case"FileParse":case"FileSchema":return{_tag:"Path",pathType:"file"};default:return{_tag:"String"}}},YX=e=>{switch(e.primitiveType._tag){case"Int":return{_tag:"Int"};case"Finite":return{_tag:"Finite"};case"Date":return{_tag:"Date"};case"Choice":return{_tag:"Choice",values:ks(e.primitiveType)??[]};case"Path":return{_tag:"Path",pathType:ZC(e.primitiveType)??"either"};case"FileText":case"FileParse":case"FileSchema":return{_tag:"Path",pathType:"file"};default:return{_tag:"String"}}},nw=(e,t=[])=>{let r=Pe(e),n=r.config,o=[],s=new Set;for(let[f,u]of[...n.flags,...t].entries()){let l=nt(u);for(let p of l)p.kind==="flag"&&(p.hidden||f>=n.flags.length&&s.has(p.name)||(s.add(p.name),o.push({name:p.name,aliases:p.aliases,description:er(p.description),type:QX(p)})))}let a=[];for(let f of n.arguments){let u=nt(f),l=$r(f);for(let p of u)p.kind==="argument"&&a.push({name:p.name,description:er(p.description),required:!l.isOptional,variadic:l.isVariadic,type:YX(p)})}let i=[],c=[...t,...r.contextConfig.flags];for(let f of e.subcommands)for(let u of f.commands){if(u.unlisted)continue;let l=nw(u,c);i.push(l),u.alias&&u.alias!==u.name&&i.push({...l,name:u.alias})}return{name:e.name,description:e.shortDescription??e.description,flags:o,arguments:a,subcommands:i}};var ow=e=>{let t=new Set,r=[];for(let n of e)t.has(n)||(t.add(n),r.push(n));return r},TB=(e,t)=>{let r=[e],n=e;for(let o=1;o<t.length;o++){let s=t[o],a;for(let i of n.subcommands)if(a=i.commands.find(c=>c.name===s),a)break;if(!a)break;r.push(a),n=a}return r},sw=(e,t,r)=>{let o=TB(e,t).flatMap(s=>Pe(s).globalFlags);return ow([...r,...o])},eee=e=>{let t=[],r=n=>{let o=Pe(n);for(let s of o.globalFlags)t.push(s);for(let s of n.subcommands)for(let a of s.commands)r(a)};return r(e),ow(t)},tee=(e,t)=>{if(e.length<=1)return[];let r=new Set(t.map(o=>o.name)),n=[];for(let o of e.slice(0,-1)){let s=Pe(o);for(let a of s.contextConfig.flags){let i=nt(a),c=$r(a);for(let f of i)r.has(f.name)||f.hidden||(r.add(f.name),n.push(wx(f,c)))}}return n},wB=(e,t)=>ow([...t,...eee(e)]),kx=(e,t,r)=>Ut(function*(){let n=TB(e,t),o=n.length>0?n[n.length-1]:e,s=Pe(o).buildHelpDoc(t),a=tee(n,s.flags),i=sw(e,t,r),c=[];for(let f of i){let u=nt(f.flag),l=$r(f.flag);for(let p of u)p.hidden||c.push({...wx(p,l),required:!1})}return{...s,flags:[...a,...s.flags],globalFlags:c}});var Ax=e=>({_tag:"Action",flag:e.flag,run:e.run}),nee=e=>t=>{kB+=1;let r=Ye(`effect/cli/GlobalFlag/${e}/${kB}`);return Object.assign(r,{_tag:"Setting",id:e,flag:t.flag})},kB=0,oee=Ax({flag:Ex("help").pipe(QT("h"),Zu("Show help information"),bx(!1)),run:B(function*(e,{builtIns:t,command:r,commandPath:n}){let o=yield*Ju,s=yield*kx(r,n,t);yield*Zt(o.formatHelpDoc(s))})}),see=Ax({flag:Ex("version").pipe(QT("v"),Zu("Show version information"),bx(!1)),run:B(function*(e,{command:t,version:r}){let n=yield*Ju;yield*Zt(n.formatVersion(t.name,r))})}),aw=Ax({flag:Ex("wizard").pipe(Zu("Start wizard mode for a command"),bx(!1)),run:()=>xe}),aee=Ax({flag:ZT("completions",[["bash","bash"],["zsh","zsh"],["fish","fish"],["powershell","powershell"],["sh","bash"],["pwsh","powershell"]]).pipe(XT,YT("<bash|zsh|fish|powershell|sh|pwsh>"),Zu("Print shell completion script")),run:B(function*(e,{command:t}){if(Ke(e))return;let r=nw(t);yield*Zt(yB(t.name,e.value,r))})}),Qu=nee("log-level")({flag:ZT("log-level",[["all","All"],["trace","Trace"],["debug","Debug"],["info","Info"],["warn","Warn"],["warning","Warn"],["error","Error"],["fatal","Fatal"],["none","None"]]).pipe(XT,Zu("Sets the minimum log level"),YT("<all|trace|debug|info|warn|warning|error|fatal|none>"))}),AB=[oee,see,aw,aee,Qu];var cd=class extends ge("effect/cli/CliConfig",{defaultValue:()=>iee}){},iee={builtIns:AB};var ef={};Kn(ef,{annotate:()=>Hee,annotateMerge:()=>Wee,isCommand:()=>hw,make:()=>$ee,provide:()=>Gee,provideEffect:()=>Jee,provideEffectDiscard:()=>Zee,provideSync:()=>Kee,run:()=>tte,runWith:()=>gw,unlisted:()=>qee,withAlias:()=>zee,withDescription:()=>Bee,withExamples:()=>Vee,withGlobalFlags:()=>Lee,withHandler:()=>Nee,withSharedFlags:()=>Dee,withShortDescription:()=>jee,withSubcommands:()=>Uee,wizard:()=>Qee});function _B(e){let t=e.indexOf("--");return t===-1?{tokens:OB(e),trailingOperands:[]}:{tokens:OB(e.slice(0,t)),trailingOperands:e.slice(t+1)}}var cee=/^-(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/,OB=e=>{let t=[];for(let r of e)if(!r.startsWith("-")||cee.test(r))t.push({_tag:"Value",value:r});else if(r.startsWith("--")){let n=r.indexOf("=");if(n!==-1){let o=r.slice(2,n),s=r.slice(n+1);t.push({_tag:"LongOption",name:o,raw:r,value:s})}else t.push({_tag:"LongOption",name:r.slice(2),raw:r})}else if(r.length>1){let n=r.slice(1),o=n.indexOf("=");if(o!==-1){let s=n.slice(0,o),a=n.slice(o+1);t.push({_tag:"ShortOption",flag:s,raw:`-${s}`,value:a})}else for(let s of n)t.push({_tag:"ShortOption",flag:s,raw:`-${s}`})}else t.push({_tag:"Value",value:r});return t};var fee=(e,t)=>{let r=e.length,n=t.length,o=Array.from({length:r+1},()=>new Array(n+1).fill(0));for(let s=0;s<=r;s++)o[s][0]=s;for(let s=0;s<=n;s++)o[0][s]=s;for(let s=1;s<=r;s++)for(let a=1;a<=n;a++){let i=e[s-1]===t[a-1]?0:1;o[s][a]=Math.min(o[s-1][a]+1,o[s][a-1]+1,o[s-1][a-1]+i)}return o[r][n]},cw=(e,t)=>{let r=t.map(o=>[fee(e,o),o]).filter(([o])=>o<=2).sort(([o],[s])=>o-s);if(r.length===0)return[];let n=r[0][0];return r.filter(([o])=>o===n).map(([,o])=>o)};var fw=e=>Re(e.subcommand,{onNone:()=>[],onSome:t=>[t.name,...fw(t.parsedInput)]}),lw=(e,t,r=[])=>Ut(function*(){let{tokens:n,trailingOperands:o}=e,s=[...r,t.name],a=Pe(t),c=a.config.flags.flatMap(nt).filter(Li),f=Xu(c),l=a.contextConfig.flags.flatMap(nt).filter(Li),p=Xu(l),h=new Set(l.map(P=>P.name)),g={command:t,commandPath:s,flagRegistry:f,inheritedFlagRegistry:p,localFlagNames:c.filter(P=>!h.has(P.name)).map(P=>P.name)},x=Cee(n,g);if(x._tag==="Leaf")return{flags:x.flags,arguments:[...x.arguments,...o],subcommand:v(),...x.errors.length>0&&{errors:x.errors}};let b={tokens:x.childTokens,trailingOperands:o},T=yield*lw(b,x.sub,s),w=[...x.errors,...T.errors??[]];return{flags:x.flags,arguments:[],subcommand:R({name:x.sub.name,parsedInput:T}),...w.length>0&&{errors:w}}}),vx=e=>{let t=0;return{peek:()=>e[t],take:()=>e[t++],rest:()=>e.slice(t)}},Xu=e=>{let t=new Map;for(let r of e){if(t.has(r.name))throw new Error(`Duplicate flag name "${r.name}" in command definition`);t.set(r.name,r);for(let n of r.aliases){if(t.has(n))throw new Error(`Duplicate flag/alias "${n}" in command definition (conflicts with "${t.get(n).name}")`);t.set(n,r)}}return{params:e,index:t}},RB=e=>{let t=new Map,r=(n,o)=>{let s=t.get(n);if(s&&s!==o)throw new Error(`Duplicate subcommand name/alias "${n}" in command definition (conflicts with "${s.name}")`);t.set(n,o)};for(let n of e)for(let o of n.commands)r(o.name,o),o.alias&&o.alias!==o.name&&r(o.alias,o);return t},pw=e=>Object.fromEntries(e.map(t=>[t.name,[]])),lee=e=>{let t=pw(e);return{add:(r,n)=>{n!==void 0&&t[r].push(n)},merge:r=>{for(let n in r){let o=r[n];if(o?.length)for(let s=0;s<o.length;s++)t[n].push(o[s])}},snapshot:()=>t}},Ox=e=>e._tag==="LongOption"||e._tag==="ShortOption",$B=e=>e._tag==="LongOption"?e.name:e.flag,Yu=(e,t)=>{let r=$B(e),n=t.index.get(r);if(n&&n.name===r)return{param:n,negated:!1};if(e._tag==="LongOption"&&e.name.startsWith("no-")){let o=e.name.slice(3),s=t.index.get(o);if(s&&s.name===o&&ax(s.primitiveType))return{param:s,negated:!0}}if(n)return{param:n,negated:!1}},PB=(e,t,r)=>new mr({option:t.name,value:r,expected:`omit the value and use ${e.raw} by itself to set --${t.name} to false`,kind:"flag"}),pee=e=>{let t=ks(e.primitiveType);return new mr({option:e.name,value:"",expected:t===void 0?e.typeName??Qp(e.primitiveType):t.join(" | "),kind:"flag"})},FB=e=>e?._tag==="Value"&&(iL(e.value)||cL(e.value))?e.value:void 0,NB=(e,t,r,n=!1)=>{let o=ud(e,t,r,n);switch(o._tag){case"Value":return{_tag:"Value",value:o.value};case"Error":return{_tag:"Error",error:o.error}}},ud=(e,t,r,n=!1)=>{if(n){if(t.value!==void 0)return{_tag:"Error",error:PB(t,r,t.value),tokens:[]};let s=FB(e.peek());if(s!==void 0){let a=e.take();return{_tag:"Error",error:PB(t,r,s),tokens:a===void 0?[]:[a]}}return{_tag:"Value",value:"false",tokens:[]}}if(t.value!==void 0)return{_tag:"Value",value:t.value,tokens:[]};if(ax(r.primitiveType)){let s=FB(e.peek()),a=s!==void 0?e.take():void 0;return{_tag:"Value",value:s??"true",tokens:a===void 0?[]:[a]}}let o=e.peek();if(o?._tag==="Value"){let s=e.take();return{_tag:"Value",value:o.value,tokens:s===void 0?[]:[s]}}return{_tag:"Error",error:pee(r),tokens:[]}},dee=(e,t)=>{let r=pw(t.params),n=[],o=[],s=vx(e);for(let a=s.take();a;a=s.take()){if(!Ox(a)){n.push(a);continue}let i=Yu(a,t);if(!i){n.push(a);continue}let c=NB(s,a,i.param,i.negated);if(c._tag==="Error"){o.push(c.error);continue}c.value!==void 0&&r[i.param.name].push(c.value)}return{flagMap:r,remainder:n,errors:o}},mee=e=>Pe(e).config.flags.flatMap(nt).filter(Li),hee=e=>Pe(e).contextConfig.flags.flatMap(nt).filter(Li),MB=(e,t)=>{for(let r of t){let n=Yu(e,r);if(n!==void 0)return n}},uw=(e,t,r,n)=>{e.push(r);let o=ud(t,r,n.param,n.negated);e.push(...o.tokens)},gee=(e,t,r,n,o)=>{let s=vx(t);ud(s,e,r.param,r.negated);for(let a=s.take();a;a=s.take()){if(Ox(a)){let i=MB(a,o);i!==void 0&&ud(s,a,i.param,i.negated);continue}if(a._tag==="Value")return n.has(a.value)}return!1},UB=(e,t,r)=>{let n=pw(r.params),o=[],s=(a,i,c)=>{let f=Xu(mee(i)),u=Xu(hee(i)),l=RB(i.subcommands),p=vx(a),h=[],g=!0;for(let x=p.take();x;x=p.take()){if(Ox(x)){let b=MB(x,c);if(b!==void 0){uw(h,p,x,b);continue}let T=Yu(x,u);if(T!==void 0){uw(h,p,x,T);continue}let w=Yu(x,f),P=Yu(x,r);if(w!==void 0&&(P===void 0||!g||!gee(x,p.rest(),w,l,[f,u,r]))){uw(h,p,x,w);continue}if(P!==void 0){let O=ud(p,x,P.param,P.negated);if(O._tag==="Error"){o.push(O.error);continue}O.value!==void 0&&n[P.param.name].push(O.value);continue}h.push(x);continue}if(x._tag==="Value"&&g){let b=l.get(x.value);if(b!==void 0)return h.push(x),h.push(...s(p.rest(),b,[...c,u])),h;g=!1}h.push(x)}return h};return{flagMap:n,remainder:s(e,t,[]),errors:o}},xee=(e,t,r)=>{let n=e._tag==="LongOption"?`--${e.name}`:`-${e.flag}`,o=[];for(let a of t)if(!a.hidden){o.push(a.name),ax(a.primitiveType)&&o.push(`no-${a.name}`);for(let i of a.aliases)o.push(i)}let s=cw($B(e),o).map(a=>a.length===1?`-${a}`:`--${a}`);return new ma({option:n,suggestions:s,command:r})},yee=e=>({flags:lee(e.params),arguments:[],errors:[],mode:{_tag:"AwaitingFirstValue"}}),See=e=>({_tag:"Leaf",flags:e.flags.snapshot(),arguments:e.arguments,errors:e.errors}),Eee=(e,t,r,n)=>{let{command:o,commandPath:s,inheritedFlagRegistry:a,localFlagNames:i}=r,c=RB(o.subcommands),f=c.get(e);if(f){let l=[...s,f.name],p=n.flags.snapshot();for(let g of i){let x=p[g];x!==void 0&&x.length>0&&n.errors.push(new ma({option:`--${g}`,suggestions:[],command:l}))}let h=dee(t.rest(),a);return n.flags.merge(h.flagMap),n.errors.push(...h.errors),{_tag:"Subcommand",result:{_tag:"Sub",flags:n.flags.snapshot(),sub:f,childTokens:h.remainder,errors:n.errors}}}if(!(Pe(o).config.arguments.length>0)&&c.size>0){let l=[];for(let[h,g]of c)g.unlisted||l.push(h);let p=cw(e,l);n.errors.push(new Gp({subcommand:e,parent:s,suggestions:p}))}return{_tag:"Argument"}},bee=(e,t,r,n)=>{let{commandPath:o,flagRegistry:s}=r,a=Yu(e,s);if(!a){n.errors.push(xee(e,s.params,o));return}let i=NB(t,e,a.param,a.negated);if(i._tag==="Error"){n.errors.push(i.error);return}n.flags.add(a.param.name,i.value)},Iee=(e,t,r,n)=>{if(n.mode._tag==="AwaitingFirstValue"){let o=Eee(e,t,r,n);if(o._tag==="Subcommand")return o.result;n.mode={_tag:"CollectingArguments"}}n.arguments.push(e)},Cee=(e,t)=>{let r=vx(e),n=yee(t.flagRegistry);for(let o=r.take();o;o=r.take()){if(Ox(o)){bee(o,r,t,n);continue}if(o._tag==="Value"){let s=Iee(o.value,r,t,n);if(s)return s}}return See(n)};var mw=B(function*(e,t){let r=t?.commandPath??[e.name],n=wee(e,r),o=(t?.prefix??r).map(a=>Gn(a)),{colors:s}=yield*ed;return yield*_x(o,s),yield*BB(n,o,n===e?"ROOT":n.name,s),{args:o.map(a=>a.value),displayArgs:o.map(a=>a.displayValue)}}),wee=(e,t)=>{let r=e;for(let n of t.slice(1)){let o=r.subcommands.flatMap(s=>s.commands).find(s=>s.name===n||s.alias===n);if(o===void 0)break;r=o}return r},BB=B(function*(e,t,r,n){let o=Pe(e),s=e.subcommands.flatMap(c=>c.commands.filter(f=>!f.unlisted)),a=s.length===0?o.config:o.contextConfig;if(a.flags.length>0){yield*Zt(LB(r,"FLAGS",n));for(let c of a.flags)t.push(...yield*DB(c));(a.arguments.length>0||s.length>0)&&(yield*_x(t,n))}if(a.arguments.length>0){yield*Zt(LB(r,"ARGUMENTS",n));for(let c of a.arguments)t.push(...yield*DB(c));s.length>0&&(yield*_x(t,n))}if(s.length===0)return;let i=yield*hr(pT({message:"Command",choices:s.map(c=>({title:c.name,value:c,...c.shortDescription!==void 0?{description:c.shortDescription}:c.description!==void 0?{description:c.description}:{}}))}));yield*Zt(),t.push(Gn(i.name)),kee(i)&&(yield*_x(t,n)),yield*BB(i,t,i.name,n)}),kee=e=>e.subcommands.some(r=>r.commands.some(n=>!n.unlisted))||Pe(e).config.orderedParams.length>0,DB=B(function*(e){let t=Ku(e),r=$r(e);if(r.isOptional&&!(yield*hr(fT({message:`Set ${dw(t)}?`,initial:!1}))))return yield*Zt(),[];let n=r.isVariadic?yield*hr(lT({message:`${dw(t)} count`,default:bt(r.variadicMin,()=>0),min:bt(r.variadicMin,()=>0),...ve(r.variadicMax)?{max:r.variadicMax.value}:{}})):1,o=[];for(let a=0;a<n;a++)o.push(yield*Aee(t));let s=t.kind===ya?{flags:{[t.name]:o.map(a=>a.value)},arguments:[]}:{flags:{},arguments:o.map(a=>a.value)};return yield*e.parse(s),yield*Zt(),t.kind===Yt?o:o.flatMap(a=>a.value.startsWith("-")&&a.value.length>1?[Gn(`--${t.name}=${a.value}`,`--${t.name}=${a.displayValue}`)]:[Gn(`--${t.name}`),a])}),Aee=e=>{let t=Oee(e);switch(e.primitiveType._tag){case"Boolean":return re(hr(fT({message:t,label:{confirm:"true",deny:"false"},placeholder:{defaultConfirm:"(T/f)",defaultDeny:"(t/F)"}})),r=>Gn(String(r)));case"Choice":{let r=ks(e.primitiveType)??[];return re(hr(pT({message:t,choices:r.map(n=>({title:n,value:n}))})),Gn)}case"Date":return re(hr(NL({message:t})),r=>Gn(r.toISOString()));case"Finite":return re(hr(ML({message:t})),r=>Gn(String(r)));case"Int":return re(hr(lT({message:t})),r=>Gn(String(r)));case"Redacted":return re(hr(UL({message:t})),r=>Gn(sa(r),"<redacted>"));default:return re(hr(DL({message:t})),Gn)}},Gn=(e,t=e)=>({value:e,displayValue:t}),vee=e=>e.kind===ya?`--${e.name}`:e.name,Oee=e=>dw(e),dw=e=>{let t=er(e.description)?.trim(),r=e.kind===ya&&t!==void 0&&t.length<=32?t:_ee(e.name);return e.kind===ya?`${r} (${vee(e)})`:r},_ee=e=>{let t=e.split(/[-_]+/).filter(r=>r.length>0);return t.length===0?e:[t[0][0].toUpperCase()+t[0].slice(1),...t.slice(1)].join(" ")},_x=(e,t)=>Zt(HB("Current command",e.map(r=>r.displayValue),t,IL)),LB=(e,t,r)=>`${rt(r,e.toUpperCase(),As,qu)} ${rt(r,"\xB7",Xp)} ${rt(r,t,As,$i)}`,jB=(e,t,r,n)=>[`${rt(n,e,As,qu)} ${rt(n,`v${t}`,$i)} ${rt(n,"\xB7 Command wizard",As,$i)}`,...r===void 0||r.length===0?[]:[r],rt(n,"Build a command interactively. Press Ctrl+C to cancel.",Xp),""].join(`
|
|
279
|
+
`),zB=(e,t)=>HB("Command ready",e,t,qu,ux),qB=e=>`
|
|
280
|
+
${rt(e,"Wizard cancelled.",cx)}`,HB=(e,t,r,n,o=$i)=>{let s=Pee(t);return[rt(r,e,As,o),...s.map(a=>rt(r,a,n)),""].join(`
|
|
281
|
+
`)},Pee=e=>{let r=" $ ",n=" ",o=e.map(Fee),s=[],a=r;for(let i of o){let c=a===r||a===n?"":" ";a.length+c.length+i.length>88&&a!==r?(s.push(`${a} \\`),a=`${n}${i}`):a+=`${c}${i}`}return a!==r&&s.push(a),s},Fee=e=>/^[A-Za-z0-9_./:@%+=,-]+$/.test(e)?e:`'${e.replaceAll("'",`'"'"'`)}'`;var hw=e=>A(e,id),$ee=(e,t,r)=>{let n=Cx(t??{});return Nr({name:e,config:n,...pt(r)?{handle:r}:{}})},Nee=m(2,(e,t)=>Nr({...Pe(e),handle:t})),Mee=e=>{let t=[],r=new Map,n=(a,i)=>{t.push(i);let c=r.get(a);c?c.push(i):r.set(a,[i])};for(let a of e){if(hw(a)){n(void 0,a);continue}for(let i of a.commands)n(a.group,i)}let o=[],s=r.get(void 0);s&&s.length>0&&o.push({group:void 0,commands:s});for(let[a,i]of r)a!==void 0&&o.push({group:a,commands:i});return{flat:t,groups:o}},Uee=m(2,(e,t)=>{let r=Mee(t);rw(e,r.flat);let n=Pe(e),o=new Map(r.flat.map(c=>[c.name,Pe(c)])),s=Symbol("effect/cli/SubcommandState"),a=B(function*(c){if(Ke(c.subcommand))return yield*n.parse(c);let f=o.get(c.subcommand.value.name);if(!f)return yield*n.parse(c);let u=yield*n.parseContext(c),l=yield*f.parse(c.subcommand.value.parsedInput);return{...u,[s]:{name:f.name,result:l}}}),i=B(function*(c,f){let l=c[s];if(l){let p=o.get(l.name);return p?yield*p.handle(l.result,[...f,p.name]).pipe(bo(n.service,c)):yield*new Ts({commandPath:f,errors:[]})}return yield*n.handle(c,f)});return Nr({name:n.name,config:n.config,contextConfig:n.contextConfig,description:n.description,shortDescription:n.shortDescription,alias:n.alias,unlisted:n.unlisted,annotations:n.annotations,globalFlags:n.globalFlags,examples:n.examples,service:n.service,subcommands:r.groups,parse:a,parseContext:n.parseContext,handle:i})}),Dee=m(2,(e,t)=>{let r=Pe(e),n=Cx(t),o=ew(r.config,n),s=ew(r.contextConfig,n);if(r.subcommands.length>0){let u=r.subcommands.flatMap(l=>l.commands);rw(e,u,{contextConfig:s})}let a=Tx(n,{allowLeftovers:!0}),i=B(function*(u){let l=yield*r.parse(u),p=yield*a(u);return{...l,...p}}),c=B(function*(u){let l=yield*r.parseContext(u),p=yield*a(u);return{...l,...p}}),f=(u,l)=>r.handle(u,l);return Nr({name:r.name,config:o,contextConfig:s,description:r.description,shortDescription:r.shortDescription,alias:r.alias,unlisted:r.unlisted,annotations:r.annotations,globalFlags:r.globalFlags,examples:r.examples,service:r.service,subcommands:r.subcommands,parse:i,parseContext:c,handle:f})}),Lee=m(2,(e,t)=>{let r=Pe(e),n=Array.from(new Set([...r.globalFlags,...t]));return Nr({...r,globalFlags:n})}),Bee=m(2,(e,t)=>Nr({...Pe(e),description:t})),jee=m(2,(e,t)=>Nr({...Pe(e),shortDescription:t})),zee=m(2,(e,t)=>Nr({...Pe(e),alias:t})),qee=e=>Nr({...Pe(e),unlisted:!0}),Hee=m(3,(e,t,r)=>{let n=Pe(e);return Nr({...n,annotations:tr(n.annotations,t,r)})}),Wee=m(2,(e,t)=>{let r=Pe(e);return Nr({...r,annotations:$a(r.annotations,t)})}),Vee=m(2,(e,t)=>Nr({...Pe(e),examples:t})),Px=(e,t)=>{let r=Pe(e);return Nr({...r,handle:(n,o)=>t(r.handle(n,o),n)})},Gee=m(e=>hw(e[0]),(e,t,r)=>Px(e,(n,o)=>IE(n,typeof t=="function"?t(o):t,r))),Kee=m(3,(e,t,r)=>Px(e,(n,o)=>bo(n,t,typeof r=="function"?r(o):r))),Jee=m(3,(e,t,r)=>Px(e,(n,o)=>CE(n,t,typeof r=="function"?r(o):r))),Zee=m(2,(e,t)=>Px(e,(r,n)=>es(typeof t=="function"?t(n):t,r))),Qee=(e,t)=>re(mw(e,t),r=>r.args),Yee=(e,t,r,n)=>{let o=new Set(t),s=[],a=new Set;for(let i of e){if(o.has(i))continue;let c=nt(i.flag);for(let f of c){let u=r[f.name];if(!u||u.length===0)continue;let l=`--${f.name}`;a.has(l)||(a.add(l),s.push(new ma({option:l,suggestions:[],command:n})))}}return s},Xee=(e,t,r)=>Ut(function*(){let{builtIns:n}=yield*cd,o=yield*Ju,s=yield*kx(e,t.commandPath,n);yield*Zt(o.formatHelpDoc(s)),r&&t.errors.length>0&&(yield*ox(o.formatErrors(t.errors)))}),ete=e=>Ut(function*(){let t=yield*Ju;yield*ox(t.formatError(e)),e[Js]=!1}),tte=m(2,(e,t)=>Jh.use(({args:r})=>L(r,n=>gw(e,t)(n)))),gw=(e,t)=>{let r=Pe(e);return B(function*(n){let{builtIns:o}=yield*cd,{tokens:s,trailingOperands:a}=_B(n),i=wB(e,o),c=i.flatMap(E=>nt(E.flag)),f=Xu(c.filter(Li)),{flagMap:u,remainder:l,errors:p}=UB(s,e,f),h={flags:u,arguments:[]},g=yield*lw({tokens:l,trailingOperands:a},e),x=[e.name,...fw(g)],b={builtIns:o,command:e,commandPath:x,version:t.version},T=sw(e,x,o),w=Yee(i,T,u,x);if(w.length>0||p.length>0){let E=g.errors??[];return yield*new Ts({commandPath:x,errors:[...p,...w,...E]})}for(let E of T){if(E._tag!=="Action"||!nt(E.flag).some(M=>{let z=u[M.name];return z!==void 0&&z.length>0}))continue;let[,_]=yield*E.flag.parse(h);if(E===aw){let{colors:M}=yield*ed;return yield*Ut(function*(){yield*Zt(jB(e.name,t.version,e.description,M));let z=[e.name,...n.filter(Ee=>Ee!=="--wizard"&&!Ee.startsWith("--wizard="))],de=yield*mw(e,{commandPath:x,prefix:z});yield*Zt(zB(de.displayArgs,M)),(yield*hr(LL({message:"Run this command?",initial:!0,active:"yes",inactive:"no"})))&&(yield*Zt(),yield*gw(e,{...t,renderErrors:!1})(de.args.slice(1)))}).pipe(ts("QuitError",()=>Zt(qB(M))))}yield*E.run(_,b);return}if(g.errors&&g.errors.length>0)return yield*new Ts({commandPath:x,errors:g.errors});let P=yield*gE(r.parse(g));if(P._tag==="Failure")return yield*new Ts({commandPath:x,errors:[P.failure]});let O=r.handle(P.success,[e.name]),d=T.includes(Qu)?(yield*Qu.flag.parse(h))[1]:v();O=bo(O,Qu,d);for(let E of T){if(E._tag!=="Setting"||E===Qu)continue;let[,I]=yield*E.flag.parse(h);O=bo(O,E,I)}let S=Re(d,{onNone:()=>cr(),onSome:E=>Wo(XO,E)});yield*ns(O,S)},xl(n=>DC(n)&&n._tag==="ShowHelp"?H(n):Z(n),n=>es(Xee(e,n,t.renderErrors!==!1),C(n))),xl(n=>t.renderErrors!==!1&&DC(n)&&n._tag==="UserError"?H(n):Z(n),n=>es(ete(n),C(n))),xl(n=>M2(n)?H(n):Z(n),n=>Xa))};import{Buffer as WB}from"node:buffer";import{randomBytes as nte}from"node:crypto";import{basename as ote,dirname as ste,join as VB,resolve as ate}from"node:path";var tf=class extends lo.TaggedError("CreateAppError"){[ti.errorReported]=!1};var fd=be.Record(be.String,be.String),xw=be.Array(be.Struct({content:be.String,path:be.String})),lde=be.decodeUnknownSync(be.fromJsonString(xw)),rte=be.Struct({dependencies:fd,devDependencies:fd,engines:fd,imports:fd,name:be.String,packageManager:be.String,private:be.Boolean,scripts:fd,type:be.String,version:be.String}),pde=be.decodeUnknownSync(be.fromJsonString(rte));var ite=be.decodeUnknownEffect(be.fromJsonString(be.Record(be.String,be.Unknown))),GB=pe.fn("CreateApp.createApp")(function*(e,t){let r=yield*is.FileSystem,n=ate(e),o=ote(n);if(!/^[a-z0-9][a-z0-9._-]*$/u.test(o)||o.length>214||["node_modules","favicon.ico"].includes(o))return yield*new tf({message:"The final folder name must be a lowercase npm package name."});if((yield*r.exists(n))&&((yield*r.stat(n)).type!=="Directory"||(yield*r.readDirectory(n)).length>0))return yield*new tf({message:`Refusing to write into ${e}: the destination must be an empty folder.`});let s=yield*be.decodeUnknownEffect(be.fromJsonString(xw))(yield*r.readFileString(t));yield*r.makeDirectory(n,{recursive:!0});for(let u of s){let l=VB(n,u.path),p=WB.from(u.content,"base64");if(u.path==="package.json"){let h=yield*ite(p.toString());p=WB.from(`${JSON.stringify({...h,name:o},null," ")}
|
|
282
|
+
`)}yield*r.makeDirectory(ste(l),{recursive:!0}),yield*r.writeFile(l,p)}let a=o.replaceAll(/[.-]/gu,"_").replace(/^[^a-z]/u,"app_$&").slice(0,58);yield*r.writeFileString(VB(n,".env.local"),`DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:55432/${a}_dev
|
|
95
283
|
TEST_DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:55432/${a}_test
|
|
96
|
-
BETTER_AUTH_SECRET=${
|
|
97
|
-
`,{flag:"wx",mode:384});let c=yield*(yield*
|
|
284
|
+
BETTER_AUTH_SECRET=${nte(32).toString("base64url")}
|
|
285
|
+
`,{flag:"wx",mode:384});let c=yield*(yield*qh.ChildProcessSpawner).exitCode(sp.make("pnpm",["install"],{cwd:n,stderr:"inherit",stdout:"inherit"}));if(c!==0)return yield*new tf({message:`pnpm install failed (exit ${c}). Run pnpm install in ${e} to retry.`});let f=`'${e.replaceAll("'",`'"'"'`)}'`;yield*Cs.log(`Created ${e}.
|
|
98
286
|
|
|
99
287
|
Next steps:
|
|
100
|
-
cd ${
|
|
101
|
-
pnpm dev`)});var
|
|
288
|
+
cd ${f}
|
|
289
|
+
pnpm dev`)});var cte=pe.gen(function*(){let t=yield*(yield*is.FileSystem).readFileString(KB(new URL("../package.json",import.meta.url))),{version:r}=yield*be.decodeUnknownEffect(be.fromJsonString(be.Struct({version:be.String})))(t),n=ef.make("create-app",{folder:yx.String("folder")},({folder:o})=>GB(o,KB(new URL("../template.json",import.meta.url)))).pipe(ef.withDescription("Create and install a Platform application from the maintained starter."));yield*ef.run(n,{version:r})});cte.pipe(pe.tapErrorTag("CreateAppError",e=>Cs.error(`create-app: ${e.message}`)),pe.provide(z2),NP);
|