@seanmozeik/tripwire 0.8.0 → 0.9.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/dist/index.js +20 -19
- package/dist/tripwire-pi.js +15 -30
- package/dist/tripwire.js +105 -122
- package/dist/types/lib/bash/types.d.ts +6 -0
- package/dist/types/lib/code/analyze.d.ts +3 -0
- package/dist/types/lib/code/calls.d.ts +8 -0
- package/dist/types/lib/code/carriers.d.ts +18 -0
- package/dist/types/lib/code/containers.d.ts +4 -0
- package/dist/types/lib/code/control.d.ts +13 -0
- package/dist/types/lib/code/data.d.ts +9 -0
- package/dist/types/lib/code/imports.d.ts +5 -0
- package/dist/types/lib/code/members.d.ts +4 -0
- package/dist/types/lib/code/syntax.d.ts +10 -0
- package/dist/types/lib/code/types.d.ts +51 -0
- package/dist/types/lib/code/uv.d.ts +13 -0
- package/dist/types/lib/code/values.d.ts +9 -0
- package/dist/types/lib/event.d.ts +7 -1
- package/dist/types/rules/embedded-code.d.ts +15 -0
- package/package.json +10 -7
package/dist/tripwire-pi.js
CHANGED
|
@@ -1,31 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
${s(
|
|
3
|
-
`+s(
|
|
4
|
-
${s(
|
|
5
|
-
${
|
|
1
|
+
import{spawn as Yl}from"node:child_process";import{once as Xl}from"node:events";import{realpathSync as Ql}from"node:fs";import{fileURLToPath as ef,pathToFileURL as tf}from"node:url";var se=(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}}},dc={pipe(){return se(this,arguments)}},Et=function(){function e(){}return e.prototype=dc,e}();var b=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 RangeError(`Invalid arity ${e}`);case 2:return function(r,n){if(arguments.length>=2)return t(r,n);return function(o){return t(o,r)}};case 3:return function(r,n,o){if(arguments.length>=3)return t(r,n,o);return 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 V=(e)=>e;var zo=(e)=>()=>e;var Qe=zo(void 0),Go=Qe;function Re(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 bt(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),t.set(o,o),o}}var wt=(e)=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;if(e instanceof Error)t.delete("stack");let r=Object.getPrototypeOf(e),n=r;while(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)}if(t.has("constructor")&&typeof e.constructor==="function"&&r===e.constructor.prototype)t.delete("constructor");return t},It=new WeakSet;function vt(e){return typeof e==="string"}function cn(e){return typeof e==="number"}function Ho(e){return typeof e==="boolean"}function Wo(e){return typeof e==="symbol"}function Vo(e){return vt(e)||cn(e)||Wo(e)}function Ot(e){return typeof e==="function"}function un(e){return e!==void 0}function Zo(e){return e!=null}function Yo(e){return!0}function ur(e){return typeof e==="object"&&e!==null||Ot(e)}var O=b(2,(e,t)=>ur(e)&&(t in e));var J="~effect/interfaces/Hash",k=(e)=>{switch(typeof e){case"number":return dr(e);case"bigint":return M(e.toString(10));case"boolean":return M(String(e));case"symbol":return M(String(e));case"string":return M(e);case"undefined":return M("undefined");case"function":case"object":if(e===null)return M("null");else if(e instanceof Date){if(Number.isNaN(e.getTime()))return M("Invalid Date");return M(e.toISOString())}else if(e instanceof RegExp)return M(e.toString());else{if(It.has(e))return lr(e);if(fn.has(e))return fn.get(e);let t=Sc(e,()=>{if(mc(e))return e[J]();else if(typeof e==="function")return lr(e);else if(e instanceof DataView)return fr(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e)||ArrayBuffer.isView(e))return fr(e);else if(e instanceof Map)return xc(e);else if(e instanceof Set)return gc(e);return hc(e)});return fn.set(e,t),t}default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},lr=(e)=>{if(!ln.has(e))ln.set(e,dr(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)));return ln.get(e)},Z=b(2,(e,t)=>e*53^t),pr=(e)=>e&3221225471|e>>>1&1073741824,mc=(e)=>O(e,J),dr=(e)=>{if(e!==e)return M("NaN");if(e===1/0)return M("Infinity");if(e===-1/0)return M("-Infinity");let t=e|0;if(t!==e)t^=e*4294967295;while(e>4294967295)t^=e/=4294967295;return pr(t)},M=(e)=>{let t=5381,r=e.length;while(r)t=t*33^e.charCodeAt(--r);return pr(t)},dn=(e,t)=>{let r=12289;for(let n of t)r^=Z(k(n),k(e[n]));return pr(r)},hc=(e)=>dn(e,wt(e)),mn=(e,t)=>(r)=>{let n=e;for(let o of r)n^=t(o);return pr(n)},fr=mn(6151,k),xc=mn(M("Map"),([e,t])=>Z(k(e),k(t))),gc=mn(M("Set"),k),ln=new WeakMap,fn=new WeakMap,pn=new WeakSet;function Sc(e,t){if(pn.has(e))return M("[Circular]");pn.add(e);let r=t();return pn.delete(e),r}var K="~effect/interfaces/Equal";function q(){if(arguments.length===1)return(e)=>$e(e,arguments[0]);return $e(arguments[0],arguments[1])}function $e(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let r=typeof e;if(r!==typeof t)return!1;if(r==="number"&&e!==e&&t!==t)return!0;if(r!=="object"&&r!=="function")return!1;if(It.has(e)||It.has(t))return!1;return Ec(e,t,Tc)}function yc(e,t,r){let n=hn.has(e),o=xn.has(t);if(n&&o)return!0;if(n||o)return!1;hn.add(e),xn.add(t);let s=r();return hn.delete(e),xn.delete(t),s}var hn=new WeakSet,xn=new WeakSet;function Tc(e,t){if(k(e)!==k(t))return!1;else if(e instanceof Date){if(!(t instanceof Date))return!1;let s=e.getTime(),a=t.getTime();return s===a||Number.isNaN(s)&&Number.isNaN(a)}else if(e instanceof RegExp){if(!(t instanceof RegExp))return!1;return e.toString()===t.toString()}let r=Qo(e),n=Qo(t);if(r!==n)return!1;let o=r&&n;if(typeof e==="function"&&!o)return!1;return yc(e,t,()=>{if(o)return e[K](t);else if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;return bc(e,t)}else if(ArrayBuffer.isView(e)){let s=e instanceof DataView;if(!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||s!==t instanceof DataView)return!1;if(s){let a=t;return Xo(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(a.buffer,a.byteOffset,a.byteLength))}return Xo(e,t)}else if(e instanceof Map){if(!(t instanceof Map)||e.size!==t.size)return!1;return vc(e,t)}else if(e instanceof Set){if(!(t instanceof Set)||e.size!==t.size)return!1;return kc(e,t)}return wc(e,t)})}function Ec(e,t,r){let n=mr.get(e);if(!n)n=new WeakMap,mr.set(e,n);else if(n.has(t))return n.get(t);let o=r(e,t);n.set(t,o);let s=mr.get(t);if(!s)s=new WeakMap,mr.set(t,s);return s.set(e,o),o}var mr=new WeakMap;function bc(e,t){for(let r=0;r<e.length;r++)if(!$e(e[r],t[r]))return!1;return!0}function Xo(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 wc(e,t){let r=wt(e),n=wt(t);if(r.size!==n.size)return!1;for(let o of r)if(!n.has(o)||!$e(e[o],t[o]))return!1;return!0}function Ic(e,t){return function(n,o){let s=Array.from(o);for(let[a,c]of n){let l=!1;for(let i=0;i<s.length;i++){let[h,x]=s[i];if(e(a,h)&&t(c,x)){s[i]=s[s.length-1],s.pop(),l=!0;break}}if(!l)return!1}return!0}}var vc=Ic($e,$e);function Oc(e){return function(r,n){let o=Array.from(n);for(let s of r){let a=!1;for(let c=0;c<o.length;c++){let l=o[c];if(e(s,l)){o[c]=o[o.length-1],o.pop(),a=!0;break}}if(!a)return!1}return!0}}var kc=Oc($e),Qo=(e)=>O(e,K);var hr=Symbol.for("~effect/Redactable"),Cc=(e)=>O(e,hr);function xr(e){if(Cc(e))return gn(e);return e}function gn(e){return e[hr](globalThis[tt]?.context??Rc)}var tt="~effect/Fiber/currentFiber",es=new Map,Rc={"~effect/Context":{},base:es,depth:0,mapUnsafe:es,pipe(){return se(this,arguments)}};function F(e,t){let r=t?.space??0,n=new WeakSet,o=!r?"":typeof r==="number"?" ".repeat(r):r,s=(i)=>o.repeat(i),a=(i,h)=>{let x=i?.constructor;return x&&x!==Object.prototype.constructor&&x.name?`${x.name}(${h})`:h},c=(i)=>{try{return Reflect.ownKeys(i)}catch{return["[ownKeys threw]"]}};function l(i,h=0){if(typeof i==="string")return JSON.stringify(i);if(typeof i==="number"||i==null||typeof i==="boolean"||typeof i==="symbol")return String(i);if(typeof i==="bigint")return String(i)+"n";if(typeof i==="object"||typeof i==="function"){if(n.has(i))return _c;n.add(i);let x;if(hr in i)x=l(gn(i),h);else if(Array.isArray(i))x=!o||i.length<=1?`[${i.map((m)=>l(m,h)).join(",")}]`:`[
|
|
2
|
+
${s(h+1)}${i.map((m)=>l(m,h+1)).join(`,
|
|
3
|
+
`+s(h+1))}
|
|
4
|
+
${s(h)}]`;else if(i instanceof Date)x=Ac(i);else if(!t?.ignoreToString&&O(i,"toString")&&typeof i.toString==="function"&&i.toString!==Object.prototype.toString&&i.toString!==Array.prototype.toString){let m=Fc(i);x=i instanceof Error&&i.cause?`${m} (cause: ${l(i.cause,h)})`:m}else if(Symbol.iterator in i)x=`${i.constructor.name}(${l(Array.from(i),h)})`;else{let m=c(i);if(!o||m.length<=1){let p=`{${m.map((d)=>`${rt(d)}:${l(i[d],h)}`).join(",")}}`;x=a(i,p)}else{let p=`{
|
|
5
|
+
${m.map((d)=>`${s(h+1)}${rt(d)}: ${l(i[d],h+1)}`).join(`,
|
|
6
6
|
`)}
|
|
7
|
-
${s(l)}}`;d=i(u,h)}}return r.delete(u),d}return String(u)}return c(e,0)}var Ow="[Circular]";function tn(e){return typeof e==="string"?JSON.stringify(e):String(e)}function pi(e){return e.map((t)=>`[${tn(t)}]`).join("")}function _c(e){try{return e.toISOString()}catch{return"Invalid Date"}}function Aw(e){try{let t=e.toString();return typeof t==="string"?t:String(t)}catch{return"[toString threw]"}}function Mr(e,t){let n=[];return JSON.stringify(e,function(r,o){let s=Object.getOwnPropertyDescriptor(this,r)?.value,i=D(s,No)?Nr(s):Nr(o);if(typeof i==="bigint")return O(i);if(typeof i!=="object"||i===null)return i;while(n.length>0&&n[n.length-1]!==this)n.pop();if(n.includes(i))return;return n.push(i),i},t?.space)??"null"}var be=Symbol.for("nodejs.util.inspect.custom"),je=(e)=>{try{if(e=Nr(e),D(e,"toJSON")&&Ke(e.toJSON)&&e.toJSON.length===0)return e.toJSON();else if(Array.isArray(e))return e.map(je);return e}catch{return"[toJSON threw]"}};var DC={toJSON(){return je(this)},[be](){return this.toJSON()},toString(){return O(this.toJSON())}};class kw{[be](){return this.toJSON()}toString(){return O(this.toJSON())}}class Tn{called=!1;self;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new Tn(this.self)}}var _w=()=>{let t={["~effect/Utils/internal"]:(o)=>o()},n={["~effect/Utils/internal"]:(o)=>{try{return o()}finally{}}};return t["~effect/Utils/internal"](()=>Error().stack)?.includes("~effect/Utils/internal")===!0?t["~effect/Utils/internal"]:n["~effect/Utils/internal"]},At=_w();function A(e,t,n){if(t==="__proto__")Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0});else e[t]=n}function mi(e,t){for(let n of Reflect.ownKeys(t))if(Object.prototype.propertyIsEnumerable.call(t,n))A(e,n,t[n])}var Vn="~effect/Effect",Zn="~effect/Exit",Cw={_A:ne,_E:ne,_R:ne},Pd=`${Vn}/identifier`,F=`${Vn}/args`,he=`${Vn}/evaluate`,qe=`${Vn}/successCont`,mt=`${Vn}/failureCont`,En=`${Vn}/ensureCont`,Yn=Symbol.for("effect/Effect/Yield"),nn={pipe(){return re(this,arguments)},toJSON(){return{...this}},toString(){return O(this.toJSON(),{ignoreToString:!0,space:2})},[be](){return this.toJSON()}},HC={[G](){return Ec(this,Object.keys(this))},[Z](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]||!N(this[t[r]],e[t[r]]))return!1;return!0}},Nw={[Vn]:Cw,...nn,[Symbol.iterator](){return new Tn(this)},toJSON(){return{_id:"Effect",op:this[Pd],...F in this?{args:this[F]}:void 0}}};var Pc=(e)=>D(e,Zn),Po="~effect/Cause",Mo="~effect/Cause/Reason",Fo=(e)=>D(e,Po),Md=(e)=>D(e,Mo);class rn{[Po];reasons;constructor(e){this[Po]=Po,this.reasons=e}pipe(){return re(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map((e)=>e.toJSON())}}toString(){return`Cause(${O(this.reasons)})`}[be](){return this.toJSON()}[Z](e){return Fo(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>N(t,e.reasons[n]))}[G](){return Cr(this.reasons)}}var Nd=new WeakMap;class Do{[Mo];annotations;_tag;constructor(e,t,n){if(this[Mo]=Mo,this._tag=e,t!==Uo&&typeof n==="object"&&n!==null&&t.size>0){let r=Nd.get(n);if(r)t=new Map([...r,...t]);Nd.set(n,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let n=new Map(this.annotations);e.mapUnsafe.forEach((o,s)=>{if(t?.overwrite!==!0&&n.has(s))return;n.set(s,o)});let r=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return r.annotations=n,r}pipe(){return re(this,arguments)}toString(){return O(this)}[be](){return this.toString()}}var Uo=new Map;class Fr extends Do{error;constructor(e,t=Uo){super("Fail",t,e);this.error=e}toString(){return`Fail(${O(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[Z](e){return Ur(e)&&N(this.error,e.error)&&N(this.annotations,e.annotations)}[G](){return me(oe(this._tag))(me(P(this.error))(P(this.annotations)))}}var Dr=(e)=>new rn(e),Mc=new rn([]),Fd=(e)=>new rn([new Fr(e)]);class hi extends Do{defect;constructor(e,t=Uo){super("Die",t,e);this.defect=e}toString(){return`Die(${O(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[Z](e){return Fc(e)&&N(this.defect,e.defect)&&N(this.annotations,e.annotations)}[G](){return me(oe(this._tag))(me(P(this.defect))(P(this.annotations)))}}var Dd=(e)=>new rn([new hi(e)]),$o=T((e)=>Fo(e[0]),(e,t,n)=>{if(t.mapUnsafe.size===0)return e;return new rn(e.reasons.map((r)=>r.annotate(t,n)))}),Ur=(e)=>e._tag==="Fail",Fc=(e)=>e._tag==="Die",gi=(e)=>e._tag==="Interrupt";function Pw(e){return vn("Effect.evaluate: Not implemented")}var on=(e)=>({...Nw,[Pd]:e.op,[he]:e[he]??Pw,[qe]:e[qe],[mt]:e[mt],[En]:e[En]}),ht=(e)=>{let t=on(e);return function(){let n=Object.create(t);return n[F]=e.single===!1?arguments:arguments[0],n}},Ud=(e)=>{let t={[Zn]:Zn,_tag:e.op,get[e.prop](){return this[F]},...on(e),toString(){return`${e.op}(${O(this[F])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[F]}},[Z](n){return Pc(n)&&n._tag===this._tag&&N(this[F],n[F])},[G](){return me(oe(e.op),P(this[F]))}};return function(n){let r=Object.create(t);return r[F]=n,r}},Ge=Ud({op:"Success",prop:"value",[he](e){let t=e.getCont(qe);return t?t[qe](this[F],e,this):e.yieldWith(this)}}),xi={key:"effect/Cause/StackTrace"},Dc={key:"effect/Cause/InterruptorStackTrace"},kt=Ud({op:"Failure",prop:"cause",[he](e){let t=this[F],n=!1;if(e.currentStackFrame)t=$o(t,{mapUnsafe:new Map([[xi.key,e.currentStackFrame]])}),n=!0;let r=e.getCont(mt);while(e.interruptible&&e._interruptedCause&&r)r=e.getCont(mt);return r?r[mt](t,e,n?void 0:this):e.yieldWith(n?kt(t):this)}}),Xn=(e)=>kt(Fd(e)),vn=(e)=>kt(Dd(e)),$r=ht({op:"WithFiber",[he](e){return this[F](e)}}),Mw=function(){class e extends globalThis.Error{}let t=on({op:"YieldableError",[he](){return Xn(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),yi=function(){let e=Symbol.for("effect/Data/Error/plainArgs");return class extends Mw{constructor(n){super(n?.message,n?.cause?{cause:n.cause}:void 0);if(n)mi(this,n),Object.defineProperty(this,e,{value:n,enumerable:!1})}toJSON(){return{...this[e],...this}}}}(),sn=(e)=>{class t extends yi{_tag=e}return t.prototype.name=e,t},Cc="~effect/Cause/NoSuchElementError";class Uc extends sn("NoSuchElementError"){[Cc]=Cc;constructor(e){super({message:e})}}var Nc="~effect/Cause/Done";var KC={[Nc]:Nc,_tag:"Done",value:void 0};var $d="~effect/data/Option",Ld={[$d]:{_A:(e)=>e},...nn,[Symbol.iterator](){return new Tn(this)}},Fw=Object.defineProperty(Object.assign(Object.create(Ld),{_tag:"Some",_op:"Some",[Z](e){return Ii(e)&&$c(e)&&N(this.value,e.value)},[G](){return me(P(this._tag))(P(this.value))},toString(){return`some(${O(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:je(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),Dw=P("None"),Uw=Object.assign(Object.create(Ld),{_tag:"None",_op:"None",valueOrUndefined:void 0,[Z](e){return Ii(e)&&On(e)},[G](){return Dw},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}}}),Ii=(e)=>D(e,$d),On=(e)=>e._tag==="None",$c=(e)=>e._tag==="Some",Qn=Object.create(Uw),an=(e)=>{let t=Object.create(Fw);return t.value=e,t};var jd="~effect/data/Result",qd={[jd]:{_A:(e)=>e,_E:(e)=>e},...nn,[Symbol.iterator](){return new Tn(this)}},$w=Object.assign(Object.create(qd),{_tag:"Success",_op:"Success",[Z](e){return bi(e)&&Ti(e)&&N(this.success,e.success)},[G](){return me(P(this._tag))(P(this.success))},toString(){return`success(${O(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:je(this.success)}}}),Lw=Object.assign(Object.create(qd),{_tag:"Failure",_op:"Failure",[Z](e){return bi(e)&&wi(e)&&N(this.failure,e.failure)},[G](){return me(P(this._tag))(P(this.failure))},toString(){return`failure(${O(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:je(this.failure)}}}),bi=(e)=>D(e,jd),wi=(e)=>e._tag==="Failure",Ti=(e)=>e._tag==="Success",jc=(e)=>{let t=Object.create(Lw);return t.failure=e,t},qc=(e)=>{let t=Object.create($w);return t.success=e,t},Bd=(e)=>Ti(e)?Qn:an(e.failure),zd=(e)=>wi(e)?Qn:an(e.success),Hd=T(2,(e,t)=>On(e)?jc(t()):qc(e.value));var z=qc,X=jc,qw=z(void 0);var Bw=X(void 0),zw=T(2,(e,t)=>e==null?X(t(e)):z(e)),Hw=Hd,Bc=(e)=>{if(Ke(e))try{return z(e())}catch(t){return X(t)}else try{return z(e.try())}catch(t){return X(e.catch(t))}};var Ei=bi,pe=wi,gt=Ti,Kw=zd,Jw=Bd,zc=(e,t)=>Re((n,r)=>pe(n)?pe(r)&&t(n.failure,r.failure):gt(r)&&e(n.success,r.success)),Ww=T(2,(e,{onFailure:t,onSuccess:n})=>pe(e)?X(t(e.failure)):z(n(e.success))),vi=T(2,(e,t)=>pe(e)?X(t(e.failure)):e),ot=T(2,(e,t)=>gt(e)?z(t(e.success)):e),Ze=T(2,(e,{onFailure:t,onSuccess:n})=>pe(e)?t(e.failure):n(e.success)),Gw=T(3,(e,t,n)=>t(e)?z(e):X(n(e))),Zw=T(3,(e,t,n)=>kn(e,(r)=>t(r)?z(r):X(n(r)))),Vw=Ze({onFailure:ne,onSuccess:ne}),An=T(2,(e,t)=>pe(e)?t(e.failure):e.success),Yw=An(si),Xw=An(Sn),Kd=T(2,(e,t)=>{if(gt(e))return e.success;throw t(e.failure)}),Qw=Kd(ne),eT=T(2,(e,t)=>pe(e)?t(e.failure):z(e.success)),kn=T(2,(e,t)=>pe(e)?X(e.failure):t(e.success)),tT=T(2,(e,t)=>kn(e,(n)=>{let r=Ke(t)?t(n):t;return Ei(r)?r:z(r)})),nT=(e)=>{if(Symbol.iterator in e){let n=[];for(let r of e){if(pe(r))return r;n.push(r.success)}return z(n)}let t={};for(let n of Object.keys(e)){let r=e[n];if(pe(r))return r;A(t,n,r.success)}return z(t)},rT=(e)=>pe(e)?z(e.failure):X(e.success),oT=(...e)=>{let n=(e.length===1?e[0]:e[1].bind(e[0]))(),r=n.next();while(!r.done){let o=r.value;if(pe(o))return o;r=n.next(o.success)}return z(r.value)},sT=z({}),iT=Td(ot,kn),aT=wd(ot),cT=bd(ot);var uT=(e)=>On(e)?Hc:ot(e.value,an),lT=T(2,(e,t)=>On(e)?Hc:ot(t(e.value),an)),Hc=z(Qn),fT=(e)=>z(an(e)),dT=T(2,(e,t)=>{if(gt(e))t(e.success);return e});var Oe={};xd(Oe,{Any:()=>dA,Array:()=>Ie,ArrayEnsure:()=>TA,BigDecimal:()=>cd,BigDecimalFromString:()=>wR,BigDecimalReviver:()=>bR,BigInt:()=>Xt,BigIntFromString:()=>NR,Boolean:()=>sI,BooleanFromBit:()=>LR,Cause:()=>rc,CauseReason:()=>nc,CauseReasonReviver:()=>Hk,CauseReviver:()=>Kk,Char:()=>Ck,Chunk:()=>Tb,ChunkReviver:()=>sR,Class:()=>$b,Date:()=>zt,DateFromMillis:()=>fR,DateFromString:()=>lR,DateReviver:()=>uR,DateTimeUtc:()=>ni,DateTimeUtcFromDate:()=>KR,DateTimeUtcFromMillis:()=>WR,DateTimeUtcFromString:()=>JR,DateTimeUtcReviver:()=>HR,DateTimeZoned:()=>md,DateTimeZonedFromString:()=>e_,DateTimeZonedReviver:()=>QR,Defect:()=>Zk,Duration:()=>ei,DurationFromMillis:()=>gR,DurationFromNanos:()=>hR,DurationFromString:()=>mR,DurationReviver:()=>dR,Enum:()=>lA,Error:()=>Lb,ErrorInstance:()=>mb,ErrorInstanceReviver:()=>Gk,Exit:()=>hb,ExitReviver:()=>Vk,File:()=>ud,FileReviver:()=>vR,Finite:()=>Bt,FiniteFromString:()=>CR,FormData:()=>ld,FormDataReviver:()=>OR,Graph:()=>Sb,GraphReviver:()=>tR,HashMap:()=>Ib,HashMapReviver:()=>nR,HashSet:()=>wb,HashSetReviver:()=>oR,Int:()=>Rr,Json:()=>oi,JsonObject:()=>L_,JsonReviver:()=>j_,Literal:()=>ue,Literals:()=>Ws,MutableJson:()=>Yb,MutableJsonReviver:()=>B_,Natural:()=>Ne,Never:()=>fA,NonEmptyArray:()=>wA,NonEmptyString:()=>_k,Null:()=>te,NullOr:()=>Vf,NullishOr:()=>uI,Number:()=>cc,NumberFromString:()=>_R,ObjectKeyword:()=>mA,Opaque:()=>UA,Option:()=>Kn,OptionFromNullOr:()=>Pk,OptionFromNullishOr:()=>Fk,OptionFromOptional:()=>Uk,OptionFromOptionalKey:()=>Dk,OptionFromOptionalNullOr:()=>$k,OptionFromUndefinedOr:()=>Mk,OptionReviver:()=>Nk,PropertyKey:()=>zf,ReadonlyMap:()=>yb,ReadonlyMapReviver:()=>Yk,ReadonlySet:()=>bb,ReadonlySetReviver:()=>rR,Record:()=>Zf,Redacted:()=>sd,RedactedFromValue:()=>zk,RedactedReviver:()=>Bk,RegExp:()=>Eb,RegExpReviver:()=>iR,Result:()=>sb,ResultReviver:()=>Lk,SchemaError:()=>vo,StandardSchemaV1FailureResult:()=>$R,String:()=>j,StringFromBase64:()=>MR,StringFromBase64Url:()=>FR,StringFromHex:()=>DR,StringFromUriComponent:()=>UR,Struct:()=>C,StructWithRest:()=>IA,Symbol:()=>iI,TaggedClass:()=>o_,TaggedError:()=>s_,TaggedStruct:()=>lc,TaggedUnion:()=>DA,TemplateLiteral:()=>cA,TemplateLiteralParser:()=>uA,TimeZone:()=>pd,TimeZoneFromString:()=>XR,TimeZoneNamed:()=>dd,TimeZoneNamedFromString:()=>VR,TimeZoneNamedReviver:()=>ZR,TimeZoneOffset:()=>Pb,TimeZoneOffsetReviver:()=>GR,TimeZoneReviver:()=>YR,Tree:()=>$_,Trim:()=>PR,Trimmed:()=>Cb,Tuple:()=>bo,TupleWithRest:()=>bA,URL:()=>id,URLFromString:()=>cR,URLReviver:()=>aR,URLSearchParams:()=>fd,URLSearchParamsReviver:()=>kR,Uint8Array:()=>ti,Uint8ArrayFromBase64:()=>qR,Uint8ArrayFromBase64Url:()=>BR,Uint8ArrayFromHex:()=>zR,Uint8ArrayReviver:()=>jR,Undefined:()=>Wf,UndefinedOr:()=>uc,Union:()=>ve,UniqueArray:()=>EA,UniqueSymbol:()=>hA,Unknown:()=>Jf,UnknownFromJsonString:()=>ER,Void:()=>pA,annotate:()=>UO,annotateEncoded:()=>$O,annotateKey:()=>LO,asserts:()=>zO,brand:()=>fI,catchDecoding:()=>RA,catchDecodingWithContext:()=>mI,catchEncoding:()=>_A,catchEncodingWithContext:()=>hI,check:()=>OA,declare:()=>vt,declareConstructor:()=>rt,decode:()=>CA,decodeEffect:()=>HO,decodeExit:()=>KO,decodeOption:()=>WO,decodePromise:()=>ZO,decodeResult:()=>GO,decodeSync:()=>VO,decodeTo:()=>q,decodeUnknownEffect:()=>sc,decodeUnknownExit:()=>ZS,decodeUnknownOption:()=>JO,decodeUnknownPromise:()=>YS,decodeUnknownResult:()=>VS,decodeUnknownSync:()=>XS,encode:()=>NA,encodeEffect:()=>QS,encodeExit:()=>YO,encodeKeys:()=>yA,encodeOption:()=>QO,encodePromise:()=>tA,encodeResult:()=>eA,encodeSync:()=>nA,encodeTo:()=>Yf,encodeUnknownEffect:()=>ic,encodeUnknownExit:()=>eI,encodeUnknownOption:()=>XO,encodeUnknownPromise:()=>nI,encodeUnknownResult:()=>tI,encodeUnknownSync:()=>rI,extendTo:()=>SA,fieldsAssign:()=>gA,flip:()=>qf,fromBrand:()=>kA,fromFormData:()=>AR,fromJsonString:()=>_b,fromURLSearchParams:()=>RR,instanceOf:()=>Hn,is:()=>HS,isBase64:()=>ed,isBase64Reviver:()=>ZA,isBase64Url:()=>OI,isBase64UrlReviver:()=>VA,isBetween:()=>fc,isBetweenBigDecimal:()=>yk,isBetweenBigInt:()=>ZI,isBetweenBigIntReviver:()=>N_,isBetweenDate:()=>HI,isBetweenDateReviver:()=>A_,isBetweenReviver:()=>uk,isCapitalized:()=>NI,isCapitalizedReviver:()=>nk,isEndsWith:()=>kI,isEndsWithReviver:()=>XA,isFinite:()=>MI,isFiniteReviver:()=>ok,isGUID:()=>EI,isGUIDReviver:()=>WA,isGreaterThan:()=>DI,isGreaterThanBigDecimal:()=>mk,isGreaterThanBigInt:()=>KI,isGreaterThanBigIntReviver:()=>k_,isGreaterThanDate:()=>jI,isGreaterThanDateReviver:()=>T_,isGreaterThanOrEqualTo:()=>td,isGreaterThanOrEqualToBigDecimal:()=>hk,isGreaterThanOrEqualToBigInt:()=>JI,isGreaterThanOrEqualToBigIntReviver:()=>R_,isGreaterThanOrEqualToDate:()=>qI,isGreaterThanOrEqualToDateReviver:()=>E_,isGreaterThanOrEqualToReviver:()=>ik,isGreaterThanReviver:()=>sk,isIncludes:()=>RI,isIncludesReviver:()=>QA,isInt:()=>Qs,isInt32:()=>dk,isIntReviver:()=>fk,isLengthBetween:()=>rd,isLengthBetweenReviver:()=>bk,isLessThan:()=>UI,isLessThanBigDecimal:()=>gk,isLessThanBigInt:()=>WI,isLessThanBigIntReviver:()=>__,isLessThanDate:()=>BI,isLessThanDateReviver:()=>v_,isLessThanOrEqualTo:()=>$I,isLessThanOrEqualToBigDecimal:()=>xk,isLessThanOrEqualToBigInt:()=>GI,isLessThanOrEqualToBigIntReviver:()=>C_,isLessThanOrEqualToDate:()=>zI,isLessThanOrEqualToDateReviver:()=>O_,isLessThanOrEqualToReviver:()=>ck,isLessThanReviver:()=>ak,isLowercased:()=>CI,isLowercasedReviver:()=>tk,isMaxLength:()=>YI,isMaxLengthReviver:()=>Ik,isMaxProperties:()=>nb,isMaxPropertiesReviver:()=>Ok,isMaxSize:()=>QI,isMaxSizeReviver:()=>Tk,isMinLength:()=>nd,isMinLengthReviver:()=>Sk,isMinProperties:()=>tb,isMinPropertiesReviver:()=>vk,isMinSize:()=>XI,isMinSizeReviver:()=>wk,isMultipleOf:()=>LI,isMultipleOfReviver:()=>lk,isNonEmpty:()=>VI,isPattern:()=>kr,isPatternReviver:()=>qA,isPropertiesLengthBetween:()=>rb,isPropertiesLengthBetweenReviver:()=>Ak,isPropertyNames:()=>ob,isPropertyNamesReviver:()=>kk,isSchema:()=>ac,isSchemaError:()=>zS,isSizeBetween:()=>eb,isSizeBetweenReviver:()=>Ek,isStartsWith:()=>AI,isStartsWithReviver:()=>YA,isStringBigInt:()=>bI,isStringBigIntReviver:()=>zA,isStringFinite:()=>II,isStringFiniteReviver:()=>BA,isStringSymbol:()=>wI,isStringSymbolReviver:()=>HA,isTrimmed:()=>Qf,isTrimmedReviver:()=>LA,isULID:()=>vI,isULIDReviver:()=>GA,isUUID:()=>TI,isUUIDReviver:()=>JA,isUint32:()=>pk,isUncapitalized:()=>PI,isUncapitalizedReviver:()=>rk,isUnique:()=>od,isUniqueReviver:()=>Rk,isUppercased:()=>_I,isUppercasedReviver:()=>ek,link:()=>ie,make:()=>k,makeFilter:()=>ae,makeFilterGroup:()=>$A,makeIsBetween:()=>Xs,makeIsGreaterThan:()=>Gs,makeIsGreaterThanOrEqualTo:()=>Zs,makeIsLessThan:()=>Vs,makeIsLessThanOrEqualTo:()=>Ys,makeIsMultipleOf:()=>FI,middlewareDecoding:()=>dI,middlewareEncoding:()=>pI,mutable:()=>vA,mutableKey:()=>sA,optional:()=>Et,optionalKey:()=>Or,overrideToCodecIso:()=>D_,overrideToEquivalence:()=>u_,overrideToFormatter:()=>a_,readonlyKey:()=>iA,refine:()=>AA,required:()=>oA,requiredKey:()=>rA,resolveAnnotations:()=>z_,resolveAnnotationsKey:()=>H_,revealBottom:()=>DO,revealCodec:()=>jO,suspend:()=>lI,tag:()=>Ar,tagDefaultOmit:()=>FA,toArbitrary:()=>i_,toCodecArrayFromSingle:()=>h_,toCodecIso:()=>Hb,toCodecJson:()=>qb,toCodecJsonAST:()=>pc,toCodecStringTree:()=>Jb,toDifferJsonPatch:()=>U_,toEncoded:()=>Oo,toEncoderXml:()=>g_,toEquivalence:()=>l_,toFormatter:()=>c_,toIso:()=>P_,toIsoFocus:()=>F_,toIsoSource:()=>M_,toJsonSchemaDocument:()=>jb,toRepresentation:()=>f_,toStandardJSONSchemaV1:()=>BO,toStandardSchemaV1:()=>qO,toTaggedUnion:()=>SI,toType:()=>He,withConstructorDefault:()=>gI,withDecodingDefault:()=>yI,withDecodingDefaultKey:()=>Xf,withDecodingDefaultType:()=>MA,withDecodingDefaultTypeKey:()=>PA});var Kc=(e)=>e.length>0;function Jd(e){return{combine:e}}function er(e){return(t,n)=>t===n?0:e(t,n)}var _t=er((e,t)=>{if(globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t))return 0;if(globalThis.Number.isNaN(e))return-1;if(globalThis.Number.isNaN(t))return 1;return e<t?-1:1});var xt=er((e,t)=>e<t?-1:1);var hT=T(2,(e,t)=>er((n,r)=>e(t(n),t(r)))),tr=hT(_t,(e)=>e.getTime());var Lr=(e)=>T(2,(t,n)=>e(t,n)===-1),jr=(e)=>T(2,(t,n)=>e(t,n)===1),Lo=(e)=>T(2,(t,n)=>e(t,n)!==1),jo=(e)=>T(2,(t,n)=>e(t,n)!==-1);var V=()=>Qn,H=an,Jc=Ii,Te=On,Ve=$c,Ct=T(2,(e,{onNone:t,onSome:n})=>Te(e)?t():n(e.value));var Ai=T(2,(e,t)=>Te(e)?t():e.value);var Wd=(e)=>e==null?V():H(e),Gd=(e)=>e===void 0?V():H(e),Zd=(e)=>e===null?V():H(e);var Wc=Ai(si),ki=Ai(Sn),nr=(e)=>(...t)=>{try{return H(e(...t))}catch{return V()}};var qo=T(2,(e,t)=>Te(e)?V():H(t(e.value)));var gT=T(2,(e,t)=>Te(e)?V():t(e.value));var qr=gT(ne);var Br=T(2,(e,t)=>Te(e)?V():t(e.value)?H(e.value):V()),Vd=(e)=>Re((t,n)=>Te(t)?Te(n):Te(n)?!1:e(t.value,n.value));var Yd=T(2,(e,t)=>{let n={...e};for(let r of xT(e))A(n,r,t(e[r],r));return n});var xT=(e)=>Object.keys(e);var Ri=globalThis.Array;var it=(e)=>Ri.isArray(e)?e:Ri.from(e),Xd=(e)=>Ri.isArray(e)?e:[e];var Gc=T(2,(e,t)=>[...e,t]),ST=T(2,(e,t)=>it(e).concat(it(t)));var fN=Ri.isArray;var Bo=Kc,Rn=Kc;var Qd=T(2,(e,t)=>{let n=0,r=[];for(let o of e){if(!t(o,n))break;r.push(o),n++}return r});var IT=(e,t)=>{let n=P(t),r=e.get(n);if(r===void 0)return e.set(n,[t]),!0;for(let o of r)if(N(o,t))return!1;return r.push(t),!0};var Zc=T(2,(e,t)=>{let n=it(e),r=it(t);if(Rn(n))return Rn(r)?Ci(ST(n,r)):n;return r});var _i=()=>[];var _n=T(2,(e,t)=>e.map(t));var Vc=(e)=>{let t=[];for(let n of e)if(Ve(n))t.push(n.value);return t};var Ci=(e)=>{let t=it(e);if(t.length<2)return[...t];let n=new Map,r=[];for(let o of t)if(IT(n,o))r.push(o);return r};var bT=Qt((e,t)=>e.concat(t),[]);function ep(){return bT}var tp=/^[+-]?\d+$/,Yc="~effect/BigDecimal",OT={[Yc]:Yc,[G](){let e=Xc(this);return me(P(e.value),Je(e.scale))},[Z](e){return Pi(e)&&NT(this,e)},toString(){return`BigDecimal(${Ht(this)})`},toJSON(){return{_id:"BigDecimal",value:String(this.value),scale:this.scale}},[be](){return this.toJSON()},pipe(){return re(this,arguments)}},Pi=(e)=>D(e,Yc),Ye=(e,t)=>{let n=Object.create(OT);return n.value=e,n.scale=t,n},rp=(e,t)=>{if(e!==at&&e%Ni===at)throw RangeError("Value must be normalized");let n=Ye(e,t);return n.normalized=n,n},at=BigInt(0),AT=BigInt(1),kT=BigInt(-1);var Ni=BigInt(10),op=rp(at,0);var Xc=(e)=>{if(e.normalized===void 0)if(e.value===at)e.normalized=op;else{let t=`${e.value}`,n=0;for(let s=t.length-1;s>=0;s--)if(t[s]==="0")n++;else break;if(n===0)e.normalized=e;let r=BigInt(t.substring(0,t.length-n)),o=e.scale-n;e.normalized=rp(r,o)}return e.normalized},Nn=T(2,(e,t)=>{if(t>e.scale)return Ye(e.value*Ni**BigInt(t-e.scale),t);if(t<e.scale)return Ye(e.value/Ni**BigInt(e.scale-t),t);return e}),sp=T(2,(e,t)=>{if(t.value===at)return e;if(e.value===at)return t;if(e.scale>t.scale)return Ye(Nn(t,e.scale).value+e.value,e.scale);if(e.scale<t.scale)return Ye(Nn(e,t.scale).value+t.value,t.scale);return Ye(e.value+t.value,e.scale)});var cn=er((e,t)=>{let n=_t(np(e),np(t));if(n!==0)return n;if(e.scale>t.scale)return xt(e.value,Nn(t,e.scale).value);if(e.scale<t.scale)return xt(Nn(e,t.scale).value,t.value);return xt(e.value,t.value)}),RT=Lr(cn);var _T=jr(cn);var np=(e)=>e.value===at?0:e.value<at?-1:1,CT=(e)=>e.value<at?Ye(-e.value,e.scale):e;var Qc=Re((e,t)=>{if(e.scale>t.scale)return Nn(t,e.scale).value===e.value;if(e.scale<t.scale)return Nn(e,t.scale).value===t.value;return e.value===t.value}),NT=T(2,(e,t)=>Qc(e,t));var ip=(e)=>{if(e==="")return H(op);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)||!tp.test(c))return V()}else t=e,n=0;let o,s,i=t.search(/\./);if(i!==-1){let c=t.slice(0,i),u=t.slice(i+1);o=`${c}${u}`,s=u.length}else o=t,s=0;if(!tp.test(o))return V();let a=s-n;if(!Number.isSafeInteger(a))return V();return H(Ye(BigInt(o),a))};var Ht=(e)=>{let t=Xc(e);if(Math.abs(t.scale)>=16)return PT(t);let n=t.value<at,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 a=r.length-t.scale;if(a>r.length){let c=a-r.length;o=`${r}${"0".repeat(c)}`,s=""}else s=r.slice(a),o=r.slice(0,a)}let i=s===""?o:`${o}.${s}`;return n?`-${i}`:i},PT=(e)=>{if(MT(e))return"0e+0";let t=Xc(e),n=`${CT(t).value}`,r=n.slice(0,1),o=n.slice(1),s=`${ap(t)?"-":""}${r}`;if(o!=="")s+=`.${o}`;let i=o.length-t.scale;return`${s}e${i>=0?"+":""}${i}`};var MT=(e)=>e.value===at,ap=(e)=>e.value<at,FT=(e)=>e.value>at,eu=(e)=>Pi(e[0]);var cp=T(eu,(e,t=0)=>{if(e.scale<=t)return e;return Ye(e.value/Ni**BigInt(e.scale-t),t)}),tu=T(eu,(e,t=0)=>{let n=cp(e,t);if(FT(e)&&RT(n,e))return sp(n,Ye(AT,t));return n});var nu=T(eu,(e,t=0)=>{let n=cp(e,t);if(ap(e)&&_T(n,e))return sp(n,Ye(kT,t));return n});var lp=(e)=>on({op:e.label,[he]:e.evaluate});var fp="~effect/Context/Service",dp=function(){function e(){}let t=e;Object.setPrototypeOf(t,UT);let n=(r,o)=>{if(t.key=r,o?.defaultValue)t[ou]=ou,t.defaultValue=o.defaultValue;if(o?.make)t.make=o.make;if(o?.fiberCached)pp.add(r);return t};return arguments.length>0?n(arguments[0],arguments[1]):n},UT={[fp]:fp,...lp({label:"Service",evaluate(e){return Ge(zo(e.context,this))}}),toJSON(){return{_id:"Service",key:this.key}},of(e){return e},context(e){return au(this,e)},use(e){return $r((t)=>e(zo(t.context,this)))},useSync(e){return $r((t)=>Ge(e(zo(t.context,this))))}},pp=new Set,ou="~effect/Context/Reference",mp="~effect/Context",$T=8,LT=8,su=(e,t,n,r)=>{let o=Object.create(jT);return o.cacheRoot=e??o,o.base=t,o.overlay=n,o.depth=r,o._flat=void 0,o.baseHits=0,o},hp=(e,t)=>{if(!t)return;hp(e,t.parent),e.set(t.key,t.value)},gp=(e)=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return hp(t,e.overlay),e._flat=t};var iu=Symbol(),xp=(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);if(r===void 0&&!n.base.has(t))return iu;if(n.overlay&&++n.baseHits>=LT)n.base=gp(n),n.overlay=void 0,n.depth=0;return r},Mi=(e)=>su(void 0,e,void 0,0),jT={get mapUnsafe(){return gp(this)},...nn,[mp]:{_Services:(e)=>e},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[Z](e){if(!qT(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)||!N(o,n.get(r)))return!1;return!0},[G](){return Je(this.mapUnsafe.size)}},yp=(e,t)=>e.cacheRoot===t.cacheRoot,qT=(e)=>D(e,mp);var BT=(e)=>!!e[ou],Ho=()=>zT,zT=Mi(new Map),au=(e,t)=>Mi(new Map([[e.key,t]])),Sp=T(3,(e,t,n)=>HT(e,t.key,n)),HT=(e,t,n)=>{let r=e,o=pp.has(t)?void 0:r.cacheRoot;if(r.depth>=$T){let s=new Map(r.mapUnsafe);return s.set(t,n),su(o,s,void 0,0)}return su(o,r.base,{key:t,value:n,parent:r.overlay},r.depth+1)};var Fi=(e,t)=>{let n=xp(e,t);return n===iu?void 0:n},Ip=T(2,(e,t)=>{let n=xp(e,t.key);if(n===iu){if(BT(t))return KT(t);throw JT(t)}return n}),zo=Ip,ru="~effect/Context/defaultValue",KT=(e)=>{if(ru in e)return e[ru];return e[ru]=e.defaultValue()},JT=(e)=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(t.stack){let n=t.stack.split(`
|
|
8
|
-
`);
|
|
9
|
-
`)}return t};var un=dp;var Di="~effect/time/Duration",Ep=BigInt(0),vp=BigInt(1),WT=BigInt(2),GT=BigInt(10);var ZT=BigInt(1000);var Ui=(e)=>BigInt(e<0?Math.ceil(e-0.5):Math.floor(e+0.5)),Op=(e)=>Ui(e*1e6),bp=(e,t)=>{let n=e.indexOf(".");if(n===-1)return BigInt(e)*t;let r=e[0]==="-",o=e.slice(n+1),s=GT**BigInt(o.length),i=(BigInt(e.slice(r?1:0,n))*s+BigInt(o))*t,a=i/s+(i%s*WT>=s?vp:Ep);return r?-a:a};var VT=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,lu=(e)=>{switch(typeof e){case"number":return rr(e);case"bigint":return Pn(e);case"string":{if(e==="Infinity")return Ko;if(e==="-Infinity")return Jo;let t=VT.exec(e);if(!t)break;let[n,r,o]=t;if(o==="nano"||o==="nanos")return Pn(bp(r,vp));if(o==="micro"||o==="micros")return Pn(bp(r,ZT));let s=Number(r);switch(o){case"milli":case"millis":return rr(s);case"second":case"seconds":return tE(s);case"minute":case"minutes":return nE(s);case"hour":case"hours":return rE(s);case"day":case"days":return oE(s);case"week":case"weeks":return sE(s)}break}case"object":{if(e===null)break;if(Di in e)return e;if(Array.isArray(e)){if(e.length!==2||!e.every(_o))return wp(e);if(Number.isNaN(e[0])||Number.isNaN(e[1]))return eE;if(e[0]===-1/0||e[1]===-1/0)return Jo;if(e[0]===1/0||e[1]===1/0)return Ko;return ct(Ui(e[0]*1e9+e[1]))}let t=e,n=0;if(t.weeks)n+=t.weeks*604800000;if(t.days)n+=t.days*86400000;if(t.hours)n+=t.hours*3600000;if(t.minutes)n+=t.minutes*60000;if(t.seconds)n+=t.seconds*1000;if(t.milliseconds)n+=t.milliseconds;if(!t.microseconds&&!t.nanoseconds)return ct(n);return ct(Ui(n*1e6+(t.microseconds??0)*1000+(t.nanoseconds??0)))}}return wp(e)},wp=(e)=>{throw Error(`Invalid Input: ${e}`)},Ap=nr(lu),Tp={_tag:"Millis",millis:0},YT={_tag:"Infinity"},XT={_tag:"NegativeInfinity"},QT={[Di]:Di,[G](){switch(this.value._tag){case"Millis":{let e=this.value.millis*1e6;return Number.isFinite(e)?P(Ui(e)):Je(this.value.millis)}case"Nanos":return P(this.value.nanos);default:return vc(this.value)}},[Z](e){return fu(e)&&cE(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"}}},[be](){return this.toJSON()},pipe(){return re(this,arguments)}},ct=(e)=>{let t=Object.create(QT);if(typeof e==="number")if(isNaN(e)||e===0||Object.is(e,-0))t.value=Tp;else if(!Number.isFinite(e))t.value=e>0?YT:XT;else if(!Number.isInteger(e))t.value={_tag:"Nanos",nanos:Op(e)};else t.value={_tag:"Millis",millis:e};else if(e===Ep)t.value=Tp;else t.value={_tag:"Nanos",nanos:e};return t},fu=(e)=>D(e,Di);var eE=ct(0),Ko=ct(1/0),Jo=ct(-1/0),Pn=(e)=>ct(e);var rr=(e)=>ct(e),tE=(e)=>ct(e*1000),nE=(e)=>ct(e*60000),rE=(e)=>ct(e*3600000),oE=(e)=>ct(e*86400000),sE=(e)=>ct(e*604800000),kp=(e)=>iE(lu(e),{onMillis:ne,onNanos:(t)=>Number(t)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0});var uu=(e)=>{let t=lu(e);switch(t.value._tag){case"Infinity":case"NegativeInfinity":throw Error("Cannot convert infinite duration to nanos");case"Nanos":return t.value.nanos;case"Millis":return Op(t.value.millis)}},Rp=nr(uu);var iE=T(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)()}}),aE=T(3,(e,t,n)=>{if(e.value._tag==="Infinity"||e.value._tag==="NegativeInfinity"||t.value._tag==="Infinity"||t.value._tag==="NegativeInfinity")return n.onInfinity(e,t);if(e.value._tag==="Millis")return t.value._tag==="Millis"?n.onMillis(e.value.millis,t.value.millis):n.onNanos(uu(e),t.value.nanos);else return n.onNanos(e.value.nanos,uu(t))});var du=(e,t)=>aE(e,t,{onMillis:(n,r)=>n===r,onNanos:(n,r)=>n===r,onInfinity:(n,r)=>n.value._tag===r.value._tag});var cE=T(2,(e,t)=>du(e,t));var pu=un("effect/Scheduler",{fiberCached:!0,defaultValue:()=>new zr}),Cp="setImmediate"in globalThis?(e)=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:(e)=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},uE=(e)=>{let t=!1;return Promise.resolve().then(()=>{if(!t)e()}),()=>{t=!0}};class Np{buckets=[];scheduleTask(e,t){let n=this.buckets,r=n.length,o,s=0;for(;s<r;s++){if(n[s][0]>t)break;o=n[s]}if(o&&o[0]===t)o[1].push(e);else if(s===r)n.push([t,[e]]);else n.splice(s,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}}class zr{executionMode;setImmediate;constructor(e="async",t){this.executionMode=e,this.setImmediate=t??(e==="sync"?uE:Cp)}shouldYield(e){return e.currentOpCount>=e.maxOpsBeforeYield}makeDispatcher(){return new Pp(this.setImmediate)}}class Pp{tasks=new Np;running=void 0;setImmediate;constructor(e=Cp){this.setImmediate=e}scheduleTask(e,t){if(this.tasks.scheduleTask(e,t),this.running===void 0)this.running=this.setImmediate(this.afterScheduled)}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let n=e[t][1];for(let r=0;r<n.length;r++)n[r]()}}flush(){while(this.tasks.buckets.length>0){if(this.running!==void 0)this.running(),this.running=void 0;this.runTasks()}}}var Mp=un("effect/Scheduler/MaxOpsBeforeYield",{fiberCached:!0,defaultValue:()=>2048}),Fp=un("effect/Scheduler/PreventSchedulerYield",{fiberCached:!0,defaultValue:()=>!1});var Up=class extends Jn{constructor(e){super();if(e)mi(this,e)}};var $i=sn;var Lp="~effect/encoding/EncodingError";class Mn extends $i("EncodingError"){[Lp]=Lp}var ji=(e)=>typeof e==="string"?mu(xu.encode(e)):mu(e),Hr=(e)=>{let t=Zp(e),n=t.length;if(n%4!==0)return X(new Mn({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 X(new Mn({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 i=0,a=0;i<n;i+=4,a+=3){let c=Li(t.charCodeAt(i))<<18|Li(t.charCodeAt(i+1))<<12|Li(t.charCodeAt(i+2))<<6|Li(t.charCodeAt(i+3));s[a]=c>>16,s[a+1]=c>>8&255,s[a+2]=c&255}return z(s)}catch(o){return X(new Mn({kind:"Decode",module:"Base64",input:t,message:o instanceof Error?o.message:"Invalid input"}))}},Hp=(e)=>ot(Hr(e),(t)=>yu.decode(t)),Kp=(e)=>typeof e==="string"?qp(xu.encode(e)):qp(e),hu=(e)=>{let t=Zp(e),n=t.length;if(n%4===1)return X(new Mn({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 X(new Mn({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,"/"),Hr(r)},Jp=(e)=>ot(hu(e),(t)=>yu.decode(t)),Wp=(e)=>typeof e==="string"?Bp(xu.encode(e)):Bp(e);var gu=(e)=>{let t=new TextEncoder().encode(e);if(t.length%2!==0)return X(new Mn({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=zp(t[o*2]),i=zp(t[o*2+1]);r[o]=s<<4|i}return z(r)}catch(n){return X(new Mn({module:"Hex",kind:"Decode",input:e,message:n instanceof Error?n.message:"Invalid input"}))}},Gp=(e)=>ot(gu(e),(t)=>yu.decode(t)),xu=new TextEncoder,yu=new TextDecoder,Zp=(e)=>e.replace(/[\n\r]/g,""),mu=(e)=>{let t=e.length,n="",r;for(r=2;r<t;r+=3)n+=ln[e[r-2]>>2],n+=ln[(e[r-2]&3)<<4|e[r-1]>>4],n+=ln[(e[r-1]&15)<<2|e[r]>>6],n+=ln[e[r]&63];if(r===t+1)n+=ln[e[r-2]>>2],n+=ln[(e[r-2]&3)<<4],n+="==";if(r===t)n+=ln[e[r-2]>>2],n+=ln[(e[r-2]&3)<<4|e[r-1]>>4],n+=ln[(e[r-1]&15)<<2],n+="=";return n};function Li(e){if(e>=jp.length)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);let t=jp[e];if(t===255)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);return t}var ln=["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","+","/"],jp=[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],qp=(e)=>mu(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),Vp=[];for(let e=0;e<256;e++)Vp.push(e.toString(16).padStart(2,"0"));var Bp=(e)=>{let t="";for(let n=0;n<e.length;n++)t+=Vp[e[n]];return t},zp=(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 TypeError("Invalid input")};var Xp="effect/Tracer/ParentSpan";var Qp="effect/Tracer";var em="effect/observability/Metric/FiberRuntimeMetricsKey";var tm=un("effect/References/CurrentStackFrame",{fiberCached:!0,defaultValue:Sn});var nm=un("effect/References/CurrentLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),rm=un("effect/References/MinimumLogLevel",{fiberCached:!0,defaultValue:()=>"Info"});var pE=()=>{let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");if(e===void 0)return Object.isExtensible(Error);return Object.hasOwn(e,"writable")?e.writable===!0:e.set!==void 0},mE=pE(),qi=()=>Error.stackTraceLimit,Kr=(e)=>{if(mE)Error.stackTraceLimit=e};class vu extends Do{fiberId;constructor(e,t=Uo){super("Interrupt",t,"Interrupted");this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[Z](e){return gi(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[G](){return me(oe(`${this._tag}:${this.fiberId}`))(ui(this.annotations))}}var um=(e)=>new vu(e),lm=(e)=>new rn([new vu(e)]);var Go=(e)=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag==="Fail")return z(n.error)}return X(e)};var fm=(e)=>e.reasons.some(gi);var Ou=T(2,(e,t)=>{if(e.reasons.length===0)return t;else if(t.reasons.length===0)return e;let n=new rn(Zc(e.reasons,t.reasons));return N(e,n)?e:n}),dm=T(2,(e,t)=>{let n=!1,r=e.reasons.map((o)=>{if(Ur(o))return n=!0,new Fr(t(o.error),o.annotations);return o});return n?Dr(r):e});var pm=(e,t)=>{let n=[],r=[];if(e.reasons.length===0)return n;let o=qi();Kr(1);for(let s of e.reasons){if(s._tag==="Interrupt"){r.push(s);continue}n.push(Su(s._tag==="Die"?s.defect:s.error,s.annotations,t))}if(n.length===0){let s=Error("The fiber was interrupted by:");s.name="InterruptCause",s.stack=IE(s,r);let i=new globalThis.Error("All fibers interrupted without error",{cause:s});i.name="InterruptError",i.stack=`${i.name}: ${i.message}`,n.push(Su(i,r[0].annotations,t))}return Kr(o),n},Su=(e,t,n)=>{let r=typeof e,o;if(e&&r==="object"){if(o=new globalThis.Error(xE(e),{cause:e.cause?Su(e.cause):void 0}),typeof e.name==="string")o.name=e.name;if(typeof e.stack==="string")o.stack=SE(e.stack,o,t);else{let s=`${o.name}: ${o.message}`;o.stack=t?mm(s,t):s}if(n?.includeCauseInStack)o.stack=xm(o);for(let s of Object.keys(e))if(!(s in o))o[s]=e[s]}else o=new globalThis.Error(!e?`Unknown error: ${e}`:r==="string"?e:Mr(e));return o},xE=(e)=>{if(typeof e.message==="string")return e.message;else if(typeof e.toString==="function"&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return Mr(e)},yE=/\((.*)\)/g,SE=(e,t,n)=>{let r=`${t.name}: ${t.message}`,o=(e.startsWith(r)?e.slice(r.length):e).split(`
|
|
10
|
-
`)
|
|
11
|
-
`),n):s.join(`
|
|
12
|
-
`)
|
|
13
|
-
|
|
14
|
-
`)
|
|
15
|
-
`)},
|
|
16
|
-
`),
|
|
17
|
-
${ym(e.cause," ")}
|
|
18
|
-
}`:e.stack,ym=(e,t)=>{let n=e.stack.split(`
|
|
19
|
-
`),r=`${t}[cause]: ${n[0]}`;for(let o=1,s=n.length;o<s;o++)r+=`
|
|
20
|
-
${t}${n[o]}`;if(e.cause)r+=` {
|
|
21
|
-
${ym(e.cause,`${t} `)}
|
|
22
|
-
${t}}`;return r},om="~effect/Fiber",bE={_A:ne,_E:ne},wE={id:0},TE=()=>globalThis[Pr];class Au{constructor(e,t=!0){this[om]=bE,this.setContext(e),this.id=++wE.id,this.currentOpCount=0,this.interruptible=t,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this.runtimeMetrics?.recordFiberStart(this.context)}[om];id;interruptible;currentOpCount;_stack;_observers;_exit;_children;_interruptedCause;_yielded;_running;_deferredInterrupt;context;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;currentPreventYield;_dispatcher=void 0;get currentDispatcher(){return this._dispatcher??=this.currentScheduler.makeDispatcher()}getRef(e){return zo(this.context,e)}addObserver(e){if(this._exit)return e(this._exit),yd;return this._observers.push(e),()=>{if(this._exit)return;let t=this._observers.indexOf(e);if(t>=0)this._observers.splice(t,1)}}interruptUnsafe(e,t){if(this._exit)return;let n=lm(e);if(this.currentStackFrame)n=$o(n,au(xi,this.currentStackFrame));if(t)n=$o(n,t);if(this._interruptedCause=this._interruptedCause?Ou(this._interruptedCause,n):n,this.interruptible)if(this._running)this._deferredInterrupt=!0;else this.evaluate(yt(this._interruptedCause))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;else if(this._yielded!==void 0){let r=this._yielded;this._yielded=void 0,r()}let t=this.runLoop(e);if(t===Yn)return;let n=sm.interruptChildren&&sm.interruptChildren(this);if(n!==void 0)return this.evaluate(lt(n,()=>t));this._exit=t,this.runtimeMetrics?.recordFiberEnd(this.context,this._exit);for(let r=0;r<this._observers.length;r++)this._observers[r](t);this._observers.length=0,this._stack.length=0,this._children=void 0,this.context=Ho()}runLoop(e){let t=globalThis[Pr];globalThis[Pr]=this;let n=this._running;this._running=!0;let r=!1,o=e;this.currentOpCount=0;try{while(!0){if(this._deferredInterrupt)this._deferredInterrupt=!1,o=yt(this._interruptedCause);if(this.currentOpCount++,!r&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){r=!0;let s=o;o=lt(wm,()=>s)}if(o=this.currentTracerContext?this.currentTracerContext(o,this):o[he](this),o===Yn){let s=this._yielded;if(Zn in s)return this._deferredInterrupt=!1,this._yielded=void 0,s;else if(this._deferredInterrupt){this._yielded=void 0,s();continue}return Yn}}}catch(s){if(!D(o,he))return vn(`Fiber.runLoop: Not a valid effect: ${String(o)}`);return this.runLoop(vn(s))}finally{this._running=n,globalThis[Pr]=t}}getCont(e){if(this._deferredInterrupt)return this._deferredInterrupt=!1,EE;while(!0){let t=this._stack.pop();if(!t)return;let n=t[En]&&t[En](this);if(n)return n[e]=n,n;if(t[e])return t}}yieldWith(e){return this._yielded=e,Yn}children(){return this._children??=new Set}pipe(){return re(this,arguments)}setContext(e){let t=this.context;if(this.context=e,t!==void 0&&yp(t,e))return;let n=this.getRef(pu);if(n!==this.currentScheduler)this.currentScheduler=n,this._dispatcher=void 0;this.currentSpan=Fi(e,Xp),this.currentLogLevel=this.getRef(nm),this.minimumLogLevel=this.getRef(rm),this.currentStackFrame=this.getRef(tm),this.maxOpsBeforeYield=this.getRef(Mp),this.currentPreventYield=this.getRef(Fp),this.runtimeMetrics=Fi(e,em);let r=Fi(e,Qp);this.currentTracerContext=r?r.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag==="Span"?this.currentSpan:void 0}}var EE={[qe](e,t){return yt(t._interruptedCause)},[mt](e,t){return yt(t._interruptedCause)}},sm={interruptChildren:void 0},Sm=(e)=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(Dc.key,e.currentStackFrame),Mi(t)};var vE=(e)=>Ru((t)=>{let n=e[Symbol.iterator](),r=[],o=void 0;function s(){let i=n.next();while(!i.done){if(i.value._exit){r.push(i.value._exit),i=n.next();continue}o=i.value.addObserver((a)=>{r.push(a),s()});return}t(ut(r))}return s(),Wo(()=>o?.())});var im=(e)=>$r((t)=>{let n=Sm(t),r=_i();for(let o of e)o.interruptUnsafe(t.id,n),r.push(o);return Rm(vE(r))});var ut=Ge,yt=kt,Wr=Xn,Wo=ht({op:"Sync",[he](e){let t=this[F](),n=e.getCont(qe);return n?n[qe](t,e):e.yieldWith(Ge(t))}}),sr=ht({op:"Suspend",[he](e){return this[F]()}});var Im=Ze({onFailure:Wr,onSuccess:ut});var bm=ht({op:"Yield",[he](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{if(t)return;e.evaluate(fn)},this[F]??0),e.yieldWith(()=>{t=!0})}}),wm=bm(0);var Tm=ut(V());var Em=(e)=>sr(()=>yt(At(e))),Bi=(e)=>vn(e),ku=(e)=>sr(()=>Wr(At(e))),Jr=ut(void 0);var vm=(e)=>{let t=typeof e==="function"?e:e.try,n=typeof e==="function"?(r)=>new Ki(r,"An error occurred in Effect.try"):e.catch;return sr(()=>{try{return ut(At(t))}catch(r){return Wr(At(()=>n(r)))}})};var Om=(e)=>{let t=typeof e==="function"?e:e.try,n=typeof e==="function"?(r)=>new Ki(r,"An error occurred in Effect.tryPromise"):e.catch;return Am(function(r,o){let s=(i)=>{try{r(Wr(At(()=>n(i))))}catch(a){r(Bi(a))}};try{At(()=>t(o)).then((i)=>r(ut(i)),s)}catch(i){s(i)}},t.length!==0)};var Am=ht({op:"Async",single:!1,[he](e){let t=At(()=>this[F][0].bind(e.currentScheduler)),n=!1,r=!1,o=this[F][1]?new AbortController:void 0,s=t((i)=>{if(n)return;if(n=!0,r)e.evaluate(i);else r=i},o?.signal);if(r!==!1)return r;if(r=!0,e._yielded=()=>{n=!0},o===void 0&&s===void 0)return Yn;return e._stack.push(OE(()=>(n=!0,o?.abort(),s??fn))),Yn}}),OE=ht({op:"AsyncFinalizer",[En](e){if(e.interruptible)e.interruptible=!1,e._stack.push(Fu)},[mt](e,t){return fm(e)?lt(this[F](),()=>yt(e)):yt(e)}}),Ru=(e)=>Am(e,e.length>=2);var AE=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0});var km=(e,...t)=>AE(e.length,t.length===0?function(){return am(()=>e.apply(this,arguments))}:function(){let n=am(()=>e.apply(this,arguments));for(let r of t)n=r(n);return n}),am=(e)=>{try{let t=e(),n=void 0;while(!0){let r=t.next(n);if(r.done)return ut(r.value);let o=r.value;if(o&&o._tag==="Success"){n=o.value;continue}else if(o&&o._tag==="Failure")return r.value;else{let s=!0;return sr(()=>{if(s)return s=!1,lt(r.value,(i)=>cm(t,i));else return sr(()=>cm(e()))})}}}catch(t){return Bi(t)}},cm=ht({op:"Iterator",single:!1,[qe](e,t){let n=this[F][0];while(!0){let r=n.next(e);if(r.done)return ut(r.value);if(!ce(r.value))return t._stack.push(this),r.value;else if(r.value._tag==="Failure")return r.value;e=r.value.value}},[he](e){return this[qe](this[F][1],e)}});var Rm=(e)=>lt(e,(t)=>fn);var lt=T(2,(e,t)=>{let n=Object.create(kE);return n[F]=e,n[qe]=t.length!==1?(r)=>t(r):t,n}),kE=on({op:"OnSuccess",[he](e){return e._stack.push(this),this[F]}});var ce=(e)=>(Zn in e),_m=T(2,(e,t)=>{if(ce(e))return e._tag==="Success"?t(e.value):e;return lt(e,t)});var _u=T(2,(e,t)=>lt(e,(n)=>ut(At(()=>t(n))))),Cm=T(2,(e,t)=>ce(e)?Dm(e,t):_u(e,t)),Nm=T(2,(e,t)=>ce(e)?Um(e,t):jm(e,t)),Pm=T(2,(e,t)=>ce(e)?$m(e,t):qm(e,t)),Mm=T(2,(e,t)=>{if(ce(e)){if(e._tag==="Success")return e;let n=Go(e.cause);if(pe(n))return e;return t(n.success)}return Nu(e,t)});var Cu=(e)=>e._tag==="Success";var Fm=(e)=>e._tag==="Failure";var fn=Ge(void 0),Dm=T(2,(e,t)=>e._tag==="Success"?Ge(t(e.value)):e),Um=T(2,(e,t)=>{if(e._tag==="Success")return e;let n=Go(e.cause);if(pe(n))return e;return Xn(t(n.success))}),$m=T(2,(e,t)=>{if(e._tag==="Success")return Ge(t.onSuccess(e.value));let n=Go(e.cause);if(pe(n))return e;return Xn(t.onFailure(n.success))});var zi=T(2,(e,t)=>{let n=Object.create(RE);return n[F]=e,n[mt]=t.length!==1?(r)=>t(r):t,n}),RE=on({op:"OnFailure",[he](e){return e._stack.push(this),this[F]}});var Lm=T(3,(e,t,n)=>zi(e,(r)=>{let o=t(r);return pe(o)?yt(o.failure):At(()=>n(o.success,r))})),Nu=T(2,(e,t)=>Lm(e,Go,(n)=>t(n)));var jm=T(2,(e,t)=>Nu(e,(n)=>ku(()=>t(n)))),qm=T(2,(e,t)=>Pu(e,{onFailure:(n)=>ku(()=>t.onFailure(n)),onSuccess:(n)=>Wo(()=>t.onSuccess(n))}));var Bm=T(2,(e,t)=>{let n=Object.create(_E);return n[F]=e,n[qe]=t.onSuccess.length!==1?(r)=>t.onSuccess(r):t.onSuccess,n[mt]=t.onFailure.length!==1?(r)=>t.onFailure(r):t.onFailure,n}),_E=on({op:"OnSuccessAndFailure",[he](e){return e._stack.push(this),this[F]}});var Pu=T(2,(e,t)=>Bm(e,{onFailure:(n)=>{let r=n.reasons.find(Ur);return r?At(()=>t.onFailure(r.error)):yt(n)},onSuccess:t.onSuccess})),zm=T(2,(e,t)=>Pu(e,{onFailure:(n)=>Wo(()=>t.onFailure(n)),onSuccess:(n)=>Wo(()=>t.onSuccess(n))}));var Mu=(e)=>ce(e)?Ge(e):CE(e),CE=ht({op:"Exit",[he](e){return e._stack.push(this),this[F]},[qe](e,t,n){return ut(n??Ge(e))},[mt](e,t,n){return ut(n??kt(e))}});var NE=(e,t)=>Cu(e)?t:zi(t,(n)=>yt(Ou(e.cause,n)));var PE=ht({op:"OnExit",single:!1,[he](e){return e._stack.push(this),this[F][0]},[En](e){if(e.interruptible&&this[F][2]!==!0)e._stack.push(Fu),e.interruptible=!1},[qe](e,t,n){n??=Ge(e);let r=this[F][1](n);return r?lt(r,(o)=>n):n},[mt](e,t,n){n??=kt(e);let r=this[F][1](n);return r?lt(NE(n,r),(o)=>n):n}});var Hm=(e)=>$r((t)=>{if(!t.interruptible)return e;return t.interruptible=!1,t._stack.push(Fu),e}),ME=ht({op:"SetInterruptible",[En](e){if(e.interruptible=this[F],e._interruptedCause&&e.interruptible)return()=>yt(e._interruptedCause)}}),Fu=ME(!0);var FE=ht({op:"While",[qe](e,t){if(this[F].step(e),this[F].while())return t._stack.push(this),this[F].body();return fn},[he](e){if(this[F].while())return e._stack.push(this),this[F].body();return fn}});var DE=(e)=>{let{onItem:t,step:n}=e,r=(o,s,i,a)=>{for(;i<a;i++){let c=s[i],u=t(o,c,i);if(!ce(u))return lt(Mu(u),(d)=>n(o,c,d,i)??r(o,s,i+1,a)??Jr);let l=n(o,c,u,i);if(l)return l._tag==="Failure"?l:void 0}};return(o,s,i)=>{let a=0,c=i?.end??s.length,u=i?.concurrency??1;if(u===1)return r(o,s,0,c);let l=i?.orderedStep===!0,d=!1,f,h,x,w=!1,p,S,E=a,g=l?Array(c):void 0,b=(I)=>{let v=vn(I);return p=v,d=!0,w=!0,h&&h.size>0?lt(Hm(im(Array.from(h))),()=>v):v},m=(I,v,U)=>{if(!l)return n(o,I,v,U);if(p)return p;g[U]=v;while(E<c){let M=g[E];if(M===void 0)return;g[E]=void 0;let R=E++,Y=n(o,s[R],M,R);if(Y)return Y}},y=()=>{let I=!1;for(;!p&&a<c;a++){let v=s[a],U=S??t(o,v,a);if(ce(U)){if(p=m(v,U,a),p)break}else if(!f)return Ru((M)=>{f=TE(),h=new Set,S=U,x=M;let R;try{R=y()}catch(Y){return M(b(Y))}if(R)return M(R);return sr(()=>(p=fn,w=!0,h?im(h):Jr))});else{S=void 0;let M=UE(f,U,!0,!0,"inherit");if(M._exit){if(p=m(v,M._exit,a),p)break;continue}h.add(M);let R=a;if(M.addObserver((Y)=>{h.delete(M);try{if(p){if(!w&&Y._tag==="Failure")for(let W of Y.cause.reasons)if(W._tag==="Interrupt")continue;else if(p._tag==="Failure")p.cause.reasons.push(W);else p=kt(Dr([W]))}else{let W=m(v,Y,R);if(W)p=W._tag==="Failure"?kt(Dr(W.cause.reasons.slice())):W,y()}if(I){let W=y();if(W)x(W)}else if(d&&h.size===0)x(p??Jr)}catch(W){x(b(W))}}),h.size<u)continue;I=!0,a++;return}}if(d=!0,p){if(h&&h.size>0){let v=Sm(f);h.forEach((U)=>U.interruptUnsafe(f.id,v));return}if(x||p._tag==="Failure")return p}else if(x){if(!h)return fn;else if(h.size===0)x(Jr)}};return y()}},Zo=()=>DE;var UE=(e,t,n=!1,r=!1,o=!1)=>{let s=e,i=o==="inherit"?s.interruptible:!o,a=new Au(s.context,i);if(n)a.evaluate(t);else s.currentDispatcher.scheduleTask(()=>a.evaluate(t),0);if(!r&&!a._exit)s.children().add(a),a.addObserver(()=>s._children.delete(a));return a};var Hi=(e)=>(t,n)=>{let r=new Au(n?.scheduler?Sp(e,pu,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))}if(n?.onFiberStart)n.onFiberStart(r);return r};var Km=Hi(Ho());var Jm=(e)=>{let t=Hi(e);return(n,r)=>{let o=t(n,r);return new Promise((s)=>{o.addObserver((i)=>s(i))})}},Wm=Jm(Ho());var Gm=(e)=>{let t=Hi(e);return(n)=>{if(ce(n))return n;let r=new zr("sync"),o=t(n,{scheduler:r});return o._dispatcher?.flush(),o._exit??vn(new Uu(o))}},Zm=Gm(Ho());var Iu="~effect/Cause/TimeoutError";class Vm extends sn("TimeoutError"){[Iu]=Iu;constructor(e){super({message:e})}}var bu="~effect/Cause/IllegalArgumentError";class Du extends sn("IllegalArgumentError"){[bu]=bu;constructor(e){super({message:e})}}var wu="~effect/Cause/ExceededCapacityError";class Ym extends sn("ExceededCapacityError"){[wu]=wu;constructor(e){super({message:e})}}var Tu="~effect/Cause/AsyncFiberError";class Uu extends sn("AsyncFiberError"){[Tu]=Tu;constructor(e){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:e})}}var Eu="~effect/Cause/UnknownError";class Ki extends sn("UnknownError"){[Eu]=Eu;constructor(e,t){super({message:t,cause:e})}}var $E="~effect/Logger",nP={[$E]:{_Message:ne,_Output:ne},pipe(){return re(this,arguments)}};var or={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},rP={None:[],All:[],Trace:[or.gray],Debug:[or.blue],Info:[or.green],Warn:[or.yellow],Error:[or.red],Fatal:[or.bgBrightRed,or.black]};var Xm=Fo,Qm=Md,Ji=Ur;var Wi=Dr,eh=Mc;var Gi=(e)=>new Fr(e),Zi=(e)=>new hi(e),Vi=um;var Fn=dm;var th=gm;var Yi=Du;var nh="~effect/collections/Chunk";function LE(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 rh=[],ju=(e)=>Re((t,n)=>t.length===n.length&&Vo(t).every((r,o)=>e(r,Yo(n,o)))),jE=ju(N),qE={[nh]:{_A:(e)=>e},toString(){return`Chunk(${O(Vo(this))})`},toJSON(){return{_id:"Chunk",values:je(Vo(this))}},[be](){return this.toJSON()},[Z](e){return Qi(e)&&jE(this,e)},[G](){return Cr(Vo(this))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return rh[Symbol.iterator]();default:return Vo(this)[Symbol.iterator]()}},pipe(){return re(this,arguments)}},qu=(e)=>{let t=Object.create(qE);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=dn,t.right=dn;break}case"ISingleton":{t.length=1,t.depth=0,t.left=dn,t.right=dn;break}case"ISlice":{t.length=e.length,t.depth=e.chunk.depth+1,t.left=dn,t.right=dn;break}}return t},Qi=(e)=>D(e,nh),dn=qu({_tag:"IEmpty"}),BE=()=>dn;var zE=(e)=>qu({_tag:"ISingleton",a:e}),ea=(e)=>Qi(e)?e:KE(it(e)),Lu=(e,t,n)=>{switch(e.backing._tag){case"IArray":{LE(e.backing.array,0,t,n,e.length);break}case"IConcat":{Lu(e.left,t,n),Lu(e.right,t,n+e.left.length);break}case"ISingleton":{t[n]=e.backing.a;break}case"ISlice":{let r=0,o=n;while(r<e.length)t[o]=Yo(e,r),r+=1,o+=1;break}}};var HE=(e)=>{switch(e.backing._tag){case"IEmpty":return rh;case"IArray":return e.backing.array;default:{let t=Array(e.length);return Lu(e,t,0),e.backing={_tag:"IArray",array:t},e.left=dn,e.right=dn,e.depth=0,t}}},Vo=HE;var KE=(e)=>e.length===0?BE():e.length===1?zE(e[0]):qu({_tag:"IArray",array:e});var Yo=T(2,(e,t)=>{let n=Math.floor(t);switch(e.backing._tag){case"IEmpty":throw Error(`Index out of bounds: ${n}`);case"ISingleton":{if(t!==0)throw Error(`Index out of bounds: ${n}`);return e.backing.a}case"IArray":{if(n>=e.length||n<0)throw Error(`Index out of bounds: ${n}`);return e.backing.array[n]}case"IConcat":return n<e.left.length?Yo(e.left,n):Yo(e.right,n-e.left.length);case"ISlice":return Yo(e.backing.chunk,n+e.backing.offset)}});var oh=(e)=>e.length;var sh=Pc,ir=Ge,pn=kt,Gr=Xn;var Zr=fn;var Xe=Cu,ih=Fm;var na="~effect/time/DateTime",ra="~effect/time/DateTime/TimeZone",ch={[na]:na,pipe(){return re(this,arguments)},[be](){return this.toString()},toJSON(){return ts(this).toJSON()}},WE={...ch,_tag:"Utc",[G](){return Je(this.epochMilliseconds)},[Z](e){return Vr(e)&&e._tag==="Utc"&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${ts(this).toJSON()})`}},GE={...ch,_tag:"Zoned",[G](){return me(Je(this.epochMilliseconds))(P(this.zone))},[Z](e){return Vr(e)&&e._tag==="Zoned"&&this.epochMilliseconds===e.epochMilliseconds&&N(this.zone,e.zone)},toString(){return`DateTime.Zoned(${el(this)})`}},uh={[ra]:ra,[be](){return this.toString()}},ZE={...uh,_tag:"Named",[G](){return oe(`Named:${this.id}`)},[Z](e){return cr(e)&&e._tag==="Named"&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:"TimeZone",_tag:"Named",id:this.id}}},VE={...uh,_tag:"Offset",[G](){return oe(`Offset:${this.offset}`)},[Z](e){return cr(e)&&e._tag==="Offset"&&this.offset===e.offset},toString(){return`TimeZone.Offset(${Yu(this.offset)})`},toJSON(){return{_id:"TimeZone",_tag:"Offset",offset:this.offset}}},Kt=(e,t,n)=>{let r=Object.create(GE);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},Vr=(e)=>D(e,na);var cr=(e)=>D(e,ra),lh=(e)=>cr(e)&&e._tag==="Offset",fh=(e)=>cr(e)&&e._tag==="Named",dh=(e)=>e._tag==="Utc",Hu=(e)=>e._tag==="Zoned",ph=Re((e,t)=>e.epochMilliseconds===t.epochMilliseconds),mh=er((e,t)=>e.epochMilliseconds<t.epochMilliseconds?-1:e.epochMilliseconds>t.epochMilliseconds?1:0);var hh=(e)=>{let t=Object.create(WE);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},ar=(e)=>{let t=e.getTime();if(Number.isNaN(t))throw new Yi("Invalid date");return hh(t)},Ku=(e)=>{if(Vr(e))return e;else if(e instanceof Date)return ar(e);else if(typeof e==="object"){if("epochMilliseconds"in e)return ar(new Date(e.epochMilliseconds));let t=new Date(0);return o0(t,e),ar(t)}else if(typeof e==="string"&&!YE(e))return ar(new Date(e+"Z"));return ar(new Date(e))},YE=(e)=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),XE=-8639999956800000,QE=8639999949600000,Ju=(e,t)=>{let n=t?.timeZone;if(n===void 0&&Vr(e)&&Hu(e))return e;let r=Ku(e);if(r.epochMilliseconds<XE||r.epochMilliseconds>QE)throw RangeError(`Epoch millis out of range: ${r.epochMilliseconds}`);if(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*1000;o=es(s)}else if(cr(n))o=n;else if(typeof n==="number")o=es(n);else{let s=Zu(n);if(Te(s))throw new Yi(`Invalid time zone: ${n}`);o=s.value}if(t?.adjustForTimeZone!==!0)return Kt(r.epochMilliseconds,o,r.partsUtc);return s0(r.epochMilliseconds,o,t?.disambiguation??"compatible")},Bu=nr(Ju),gh=nr(Ku),e0=/^(.{17,35})\[(.+)\]$/,xh=(e)=>{let t=e0.exec(e);if(t===null){let o=Qu(e);return o!==null?Bu(e,{timeZone:o}):V()}let[,n,r]=t;return Bu(n,{timeZone:r})};var yh=(e)=>hh(e.epochMilliseconds);var Qo=new Map,t0={day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"longOffset",fractionalSecondDigits:3,hourCycle:"h23"},n0=(e)=>{let t=e.resolvedOptions().timeZone;if(Qo.has(t))return Qo.get(t);let n=Object.create(ZE);return n.id=t,n.format=e,Qo.set(t,n),n},Wu=(e)=>{if(Qo.has(e))return Qo.get(e);try{return n0(new Intl.DateTimeFormat("en-US",{...t0,timeZone:e}))}catch{throw new Yi(`Invalid time zone: ${e}`)}},es=(e)=>{let t=Object.create(VE);return t.offset=e,t},Gu=nr(Wu);var r0=/^(?:GMT|[+-])/,Zu=(e)=>{if(r0.test(e)){let t=Qu(e);return t===null?V():H(es(t))}return Gu(e)},Sh=(e)=>{if(e._tag==="Offset")return Yu(e.offset);return e.id};var ts=(e)=>new Date(e.epochMilliseconds),oa=(e)=>{if(e._tag==="Utc")return new Date(e.epochMilliseconds);else if(e.zone._tag==="Offset")return new Date(e.epochMilliseconds+e.zone.offset);else 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},Vu=(e)=>oa(e).getTime()-Xu(e),Yu=(e)=>{let t=Math.abs(e),n=Math.floor(t/3600000),r=Math.round(t%3600000/60000);if(r===60)n+=1,r=0;return`${e<0?"-":"+"}${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`},Ih=(e)=>Yu(Vu(e)),Xu=(e)=>e.epochMilliseconds;var o0=(e,t)=>{if(t.year!==void 0)e.setUTCFullYear(t.year);if(t.month!==void 0)e.setUTCMonth(t.month-1);if(t.day!==void 0)e.setUTCDate(t.day);if(t.weekDay!==void 0){let n=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+n)}if(t.hour!==void 0)e.setUTCHours(t.hour);if(t.minute!==void 0)e.setUTCMinutes(t.minute);if(t.second!==void 0)e.setUTCSeconds(t.second);if(t.millisecond!==void 0)e.setUTCMilliseconds(t.millisecond)};var ah=86400000,s0=(e,t,n)=>{if(t._tag==="Offset")return Kt(e-t.offset,t);let r=Xo(e-ah,e,t),o=Xo(e+ah,e,t);if(r===o)return Kt(e-r,t);let s=r<o,i=r-o;if(s){if(Xo(e-o,e,t)===o)return Kt(e-o,t);let u=Kt(e-r,t),l=oa(u).getTime();if(e!==l)switch(n){case"reject":{let d=new Date(e).toISOString();throw RangeError(`Gap time: ${d} does not exist in time zone ${t.id}`)}case"earlier":return Kt(e-o,t);case"compatible":case"later":return u}return u}if(Xo(e-r,e,t)===r){if(n==="earlier"||n==="compatible")return Kt(e-r,t);if(Xo(e-r+i,e+i,t)===r)return Kt(e-r,t);if(n==="reject"){let u=new Date(e).toISOString();throw RangeError(`Ambiguous time: ${u} occurs twice in time zone ${t.id}`)}}return Kt(e-o,t)},i0=/([+-])(\d{2}):(\d{2})$/,Qu=(e)=>{let t=i0.exec(e);if(t===null)return null;let[,n,r,o]=t;return(n==="+"?1:-1)*(Number(r)*60+Number(o))*60*1000},Xo=(e,t,n)=>{let r=n.format.formatToParts(e).find((s)=>s.type==="timeZoneName")?.value??"";if(r==="GMT")return 0;let o=Qu(r);if(o===null)return Vu(Kt(t,n));return o};var bh=(e)=>ts(e).toISOString();var zu=(e)=>{let t=oa(e);return e._tag==="Utc"?t.toISOString():`${t.toISOString().slice(0,-1)}${Ih(e)}`},el=(e)=>e.zone._tag==="Offset"?zu(e):`${zu(e)}[${e.zone.id}]`;var yM=globalThis.Number;var Th=T(2,(e,t)=>{let n=e.toString(),r=t.toString();if(n.includes("e")||r.includes("e")){if(!globalThis.Number.isFinite(e)||!globalThis.Number.isFinite(t)||t===0)return NaN;return c0(e,t)}let o=(n.split(".")[1]||"").length,s=(r.split(".")[1]||"").length,i=o>s?o:s,a=parseInt(e.toFixed(i).replace(".","")),c=parseInt(t.toFixed(i).replace(".",""));return a%c/Math.pow(10,i)});function c0(e,t){let[n,r]=wh(e),[o,s]=wh(t),i=Math.min(r,s),a=n*BigInt(10)**BigInt(r-i),c=o*BigInt(10)**BigInt(s-i),u=a%c;if(u===BigInt(0))return e<0||Object.is(e,-0)?-0:0;let l=globalThis.Number(`${u}e${i}`);return l===0?Math.sign(e)*globalThis.Number.MIN_VALUE:l}function wh(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 Eh=Qt((e,t)=>Math.max(e,t),-1/0),vh=Qt((e,t)=>Math.min(e,t),1/0);var SM=globalThis.String;var Oh=(e)=>e.trim();var Ah=13,kh=10;class Rh{index;length;s;stripped;constructor(e,t=!1){this.s=e,this.stripped=t,this.index=0,this.length=e.length}next(){if(this.done)return{done:!0,value:void 0};let e=this.index;while(!this.done&&!l0(this.s[this.index]))this.index=this.index+1;let t=this.index;if(!this.done){let n=this.s[this.index];if(this.index=this.index+1,!this.done&&f0(n,this.s[this.index]))this.index=this.index+1;if(!this.stripped)t=this.index}return{done:!1,value:this.s.substring(e,t)}}[Symbol.iterator](){return new Rh(this.s,this.stripped)}get done(){return this.index>=this.length}}var l0=(e)=>{let t=e.charCodeAt(0);return t===Ah||t===kh},f0=(e,t)=>e.charCodeAt(0)===Ah&&t.charCodeAt(0)===kh;var _h=Om,L=ut,ns=Tm;var Ch=Jr;var _=Wr;var rs=Em,Nh=Bi,os=vm;var Ph=Im;var Jt=lt;var ss=Mu,Mh=_u;var ur=zi;var Fh=zm;var Dh=Km;var tl=Wm;var lr=Zm;var Yr=Cm,sa=Nm,_e=Pm,ft=_m,nl=Mm,rl=km;var ol=Vr,Uh=cr,$h=lh,Lh=fh,jh=dh,qh=Hu,sl=ph,il=mh;var Bh=ar;var zh=Ju;var ia=gh,Hh=xh;var aa=yh;var al=Wu,as=es,Kh=Gu;var Jh=Zu,Dn=Sh;var ca=ts;var Wh=Xu;var Gh=bh;var ua=el;var la="~effect/collections/Graph",ul=(e)=>e;var p0=(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)&&N(t.data,n.data),m0=(e,t)=>e==="directed"?P(t):wn(P(t.data)^P(t.source)+P(t.target)),h0={[la]:{_N:(e)=>e,_E:(e)=>e},[Symbol.iterator](){return this.nodes[Symbol.iterator]()},[be](){return this.toJSON()},[Z](e){if(D(e,la)){let t=ul(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)||!N(r,t.nodes.get(n)))return!1;for(let[n,r]of this.edges){let o=t.edges.get(n);if(o===void 0||!p0(this.type,r,o))return!1}return!0}return!1},[G](){let e=oe("Graph");e=e^oe(this.type),e=e^Je(this.nodes.size),e=e^Je(this.edges.size);for(let[t,n]of this.nodes)e=e^P(t)+P(n);for(let[t,n]of this.edges)e=e^P(t)+m0(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 re(this,arguments)}},Zh=(e,t)=>{let n=Object.create(h0);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=H(!0),n};var cs=(e)=>{let t=ul(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)}},us=(e)=>{let t=Zh(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)if(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=V(),t};var g0=la;var ll=(e)=>D(e,g0);class Yh{type;source;target;identity;constructor(e,t,n,r){this.type=e,this.source=t,this.target=n,this.identity=r}[Z](e){if(!(e instanceof Yh)||this.type!==e.type||!N(this.identity,e.identity))return!1;if(this.type==="directed")return N(this.source,e.source)&&N(this.target,e.target);return N(this.source,e.source)&&N(this.target,e.target)||N(this.source,e.target)&&N(this.target,e.source)}[G](){let e=P(this.identity);return this.type==="directed"?me(P(this.target))(me(P(this.source))(e)):wn(e^P(this.source)+P(this.target))}}class x0{[Symbol.iterator];visit;constructor(e){this.visit=e,this[Symbol.iterator]=()=>e((t,n)=>[t,n])[Symbol.iterator]()}}var da="~effect/collections/HashMap",Nt=5,ps=1<<Nt,S0=ps/4,Xh=ps/2,I0=ps-1,b0=(e)=>(e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24),ls=(e,t)=>e>>>t&I0,Un=(e,t)=>1<<ls(e,t),fa=(e,t)=>b0(e&t-1);function Qh(e,t,n,r,o,s){if(t>32)throw Error("HashMap: max depth exceeded");let i=Un(n,t),a=Un(o,t);if(i===a){let l=Qh(e,t+Nt,n,r,o,s);return new Wt(e,i,[l])}let c=i|a,u=i>>>0<a>>>0?[r,s]:[s,r];return new Wt(e,c,u)}class Xr{canEdit(e){return this.edit===e}}class eg extends Xr{_tag="EmptyNode";edit=0;get size(){return 0}get(e,t,n){return V()}has(e,t,n){return!1}set(e,t,n,r,o,s){return s.value=!0,new mn(e,n,r,o)}remove(e,t,n,r,o){return this}iterator(){return[][Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}canEdit(e){return!1}}class mn extends Xr{_tag="LeafNode";edit;hash;key;value;constructor(e,t,n,r){super();this.edit=e,this.hash=t,this.key=n,this.value=r}get size(){return 1}get(e,t,n){if(this.hash===t&&N(this.key,n))return H(this.value);return V()}has(e,t,n){return this.hash===t&&N(this.key,n)}set(e,t,n,r,o,s){if(this.hash===n&&N(this.key,r)){if(N(this.value,o))return this;if(this.canEdit(e))return this.value=o,this;return new mn(e,n,r,o)}if(s.value=!0,this.hash===n)return new fs(e,n,[[this.key,this.value],[r,o]]);let i=Un(n,t),a=Un(this.hash,t);if(i===a)return new Wt(e,i,[this.set(e,t+Nt,n,r,o,s)]);let c=i|a,u=i>>>0<a>>>0?[new mn(e,n,r,o),this]:[this,new mn(e,n,r,o)];return new Wt(e,c,u)}remove(e,t,n,r,o){if(this.hash===n&&N(this.key,r)){o.value=!0;return}return this}iterator(){return[[this.key,this.value]][Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}}class fs extends Xr{_tag="CollisionNode";edit;hash;entries;constructor(e,t,n){super();this.edit=e,this.hash=t,this.entries=n}get size(){return this.entries.length}get(e,t,n){if(this.hash!==t)return V();for(let[r,o]of this.entries)if(N(r,n))return H(o);return V()}has(e,t,n){if(this.hash!==t)return!1;for(let[r]of this.entries)if(N(r,n))return!0;return!1}set(e,t,n,r,o,s){if(this.hash!==n)return s.value=!0,Qh(e,t,this.hash,this,n,new mn(e,n,r,o));for(let i=0;i<this.entries.length;i++)if(N(this.entries[i][0],r)){if(N(this.entries[i][1],o))return this;if(this.canEdit(e))return this.entries[i]=[r,o],this;let a=[...this.entries];return a[i]=[r,o],new fs(e,this.hash,a)}if(s.value=!0,this.canEdit(e))return this.entries.push([r,o]),this;return new fs(e,this.hash,[...this.entries,[r,o]])}remove(e,t,n,r,o){if(this.hash!==n)return this;let s=this.entries.findIndex(([a])=>N(a,r));if(s===-1)return this;if(o.value=!0,this.entries.length===1)return;if(this.entries.length===2){let a=this.entries[s===0?1:0];return new mn(e,this.hash,a[0],a[1])}if(this.canEdit(e))return this.entries.splice(s,1),this;let i=[...this.entries];return i.splice(s,1),new fs(e,this.hash,i)}iterator(){return this.entries[Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}}class Wt extends Xr{_tag="IndexedNode";edit;_size;bitmap;children;constructor(e,t,n){super();this.edit=e,this.bitmap=t,this.children=n}get size(){if(this._size===void 0)this._size=this.children.reduce((e,t)=>e+t.size,0);return this._size}get(e,t,n){let r=Un(t,e);if((this.bitmap&r)===0)return V();let o=fa(this.bitmap,r);return this.children[o].get(e+Nt,t,n)}has(e,t,n){let r=Un(t,e);if((this.bitmap&r)===0)return!1;let o=fa(this.bitmap,r);return this.children[o].has(e+Nt,t,n)}set(e,t,n,r,o,s){let i=Un(n,t),a=fa(this.bitmap,i);if((this.bitmap&i)!==0){let c=this.children[a],u=c.set(e,t+Nt,n,r,o,s);if(c===u)return this;if(this.canEdit(e))return this.children[a]=u,this;let l=[...this.children];return l[a]=u,new Wt(e,this.bitmap,l)}else{s.value=!0;let c=new mn(e,n,r,o),u=this.bitmap|i;if(this.canEdit(e)){if(this.children.splice(a,0,c),this.bitmap=u,this._size=void 0,this.children.length>Xh)return this.expand(e,u,this.children);return this}let l=[...this.children];if(l.splice(a,0,c),l.length>Xh)return this.expand(e,u,l);return new Wt(e,u,l)}}remove(e,t,n,r,o){let s=Un(n,t);if((this.bitmap&s)===0)return this;let i=fa(this.bitmap,s),a=this.children[i],c=a.remove(e,t+Nt,n,r,o);if(!o.value)return this;if(c===void 0){let l=this.bitmap^s;if(l===0)return;if(this.children.length===2){let f=this.children[i===0?1:0];if(f._tag==="LeafNode")return f}if(this.canEdit(e))return this.children.splice(i,1),this.bitmap=l,this._size=void 0,this;let d=[...this.children];return d.splice(i,1),new Wt(e,l,d)}if(a===c)return this;if(this.canEdit(e))return this.children[i]=c,this;let u=[...this.children];return u[i]=c,new Wt(e,this.bitmap,u)}expand(e,t,n){let r=new globalThis.Array(ps),o=0;for(let s=0;s<ps;s++)if((t&1<<s)!==0)r[s]=n[o++];return new ds(e,n.length,r)}iterator(){let e=0,t;return{next:()=>{while(e<this.children.length){if(!t)t=this.children[e].iterator();let n=t.next();if(!n.done)return n;t=void 0,e++}return{done:!0,value:void 0}}}}[Symbol.iterator](){return this.iterator()}}class ds extends Xr{_tag="ArrayNode";edit;_size;count;children;constructor(e,t,n){super();this.edit=e,this.count=t,this.children=n}get size(){if(this._size===void 0)this._size=this.children.reduce((e,t)=>e+(t?.size??0),0);return this._size}get(e,t,n){let r=ls(t,e),o=this.children[r];return o?o.get(e+Nt,t,n):V()}has(e,t,n){let r=ls(t,e),o=this.children[r];return o?o.has(e+Nt,t,n):!1}set(e,t,n,r,o,s){let i=ls(n,t),a=this.children[i];if(a){let c=a.set(e,t+Nt,n,r,o,s);if(a===c)return this;if(this.canEdit(e))return this.children[i]=c,this;let u=[...this.children];return u[i]=c,new ds(e,this.count,u)}else{s.value=!0;let c=new mn(e,n,r,o);if(this.canEdit(e))return this.children[i]=c,this.count++,this._size=void 0,this;let u=[...this.children];return u[i]=c,new ds(e,this.count+1,u)}}remove(e,t,n,r,o){let s=ls(n,t),i=this.children[s];if(!i)return this;let a=i.remove(e,t+Nt,n,r,o);if(!o.value)return this;let c=this.count-(a?0:1);if(c<S0)return this.pack(e,s,a);if(i===a)return this;if(this.canEdit(e)){if(this.children[s]=a,!a)this.count=c;return this._size=void 0,this}let u=[...this.children];return u[s]=a,new ds(e,c,u)}pack(e,t,n){let r=[],o=0,s=1;for(let i=0;i<this.children.length;i++){let a=i===t?n:this.children[i];if(a)r.push(a),o|=s;s<<=1}return new Wt(e,o,r)}iterator(){let e=0,t;return{next:()=>{while(e<this.children.length){let n=this.children[e];if(!n){e++;continue}if(!t)t=n.iterator();let r=t.next();if(!r.done)return r;t=void 0,e++}return{done:!0,value:void 0}}}}[Symbol.iterator](){return this.iterator()}}class pa{[da]=da;_editable;_edit;_root;_size;constructor(e,t,n,r){this._editable=e,this._edit=t,this._root=n,this._size=r}get size(){return this._size}[Symbol.iterator](){return this._root.iterator()}[Z](e){if(fl(e)){let t=e;if(this.size!==t.size)return!1;for(let[n,r]of this){let o=yc(e,rg(n));if(Te(o)||!N(r,o.value))return!1}return!0}return!1}[G](){let e=oe("HashMap");for(let[t,n]of this)e=e^P(t)+P(n);return e}[be](){return je(this)}toString(){return`HashMap(${O(Array.from(this))})`}toJSON(){return{_id:"HashMap",values:Array.from(this).map(([e,t])=>[je(e),je(t)])}}pipe(){return re(this,arguments)}}var tg=new eg,fl=(e)=>D(e,da),dl=()=>new pa(!1,0,tg,0);var ng=(e)=>{let t=tg,n=0,r={value:!1};for(let[o,s]of e){let i=P(o);if(r.value=!1,t=t.set(NaN,0,i,o,s,r),r.value)n++}return new pa(!1,0,t,n)};var rg=T(2,(e,t)=>e._root.get(0,P(t),t));var pl=T(2,(e,t)=>e._root.has(0,P(t),t));var w0=(e,t,n,r)=>{let o=e,s={value:!1},i=o._editable?o._edit:NaN,a=o._root.set(i,0,n,t,r,s);if(o._editable){if(o._root=a,s.value)o._size++;return e}if(o._root===a)return e;return new pa(!1,o._edit,a,o._size+(s.value?1:0))},ml=T(3,(e,t,n)=>w0(e,t,P(t),n)),hl=(e)=>{let t=e[Symbol.iterator]();return{[Symbol.iterator](){return this},next(){let n=t.next();if(n.done)return{done:!0,value:void 0};return{done:!1,value:n.value[0]}}}};var og=(e)=>{let t=e[Symbol.iterator]();return{[Symbol.iterator](){return this},next(){return t.next()}}},ma=(e)=>e.size;var ig=fl;var ha=ng;var v0=og,ga=(e)=>Array.from(v0(e)),ag=ma;var ms="~effect/collections/HashSet",A0={[G](){return P(ms)},[Z](e){return gl(e)&&xa(this)===xa(e)&&lg(this,(t)=>ug(e,t))},[Symbol.iterator](){return hl(xl(this))},toString(){return`HashSet(${O(Array.from(this))})`},toJSON(){return{_id:"HashSet",values:je(Array.from(this))}},[be](){return this.toJSON()},pipe(){return re(this,arguments)}},k0=(e)=>{let t=Object.create(A0);return t[ms]=ms,t.keyMap=e,t},gl=(e)=>D(e,ms),xl=(e)=>e.keyMap;var cg=(e)=>{let t=dl();for(let n of e)t=ml(t,n,!0);return k0(t)},ug=(e,t)=>pl(xl(e),t);var xa=(e)=>ma(xl(e));var lg=(e,t)=>{for(let n of e)if(!t(n))return!1;return!0};var ya=cg,fg=gl;var dg=xa;function Gt(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function hs(e){return(t)=>Gt(t)?.[e]}var Qe="~structural",fr="~identifier",gs="~sentinels",Sa="~constructor",pg=["title","description","default","examples","readOnly","writeOnly","format","contentEncoding","contentMediaType","contentSchema"],Qr=hs("identifier"),yl=hs(fr),Sl=hs("title");var mg=hs("brands"),xs=Fe((e)=>{let t=Gt(e)?.identifier;if(typeof t==="string")return t;return e.getExpected(xs)});var hg=new Set([gs,Qe,"representation","arbitrary","brands","toJsonSchema","toCode","toArbitrary","toEquivalence","toFormatter","toCodec","toCodecJson","toCodecStringTree","toCodecIso"]);var Q=Symbol();var St=ir,Pt=St(Q),Ee=St(Q),Ia=(e)=>e===Q?V():H(e),Il=(e)=>e._tag==="None"?Pt:St(e.value);var Ss="~effect/SchemaIssue/Issue";function Tl(e){return D(e,Ss)&&e[Ss]===Ss}function C0(e){return Object.hasOwn(e,"input")}class It{[Ss]=Ss;constructor(e,t){if(t?.reportInput===!0&&e!==Q)this.input=e}}class El extends It{_tag="Filter";filter;issue;constructor(e,t,n,r){super(n,r);this.filter=e,this.issue=t}}class vl extends It{_tag="Encoding";ast;issue;constructor(e,t,n,r){super(n,r);this.ast=e,this.issue=t}}class we extends It{_tag="Pointer";path;issue;constructor(e,t){super();this.path=e,this.issue=t}}class pr extends It{_tag="MissingKey";annotations;constructor(e){super();this.annotations=e}}class wa extends It{_tag="UnexpectedKey";ast;constructor(e,t,n){super(t,n);this.ast=e}}class ge extends It{_tag="Composite";ast;issues;constructor(e,t,n,r){super(n,r);this.ast=e,this.issues=t}}class le extends It{_tag="InvalidType";ast;constructor(e,t,n){super(t,n);this.ast=e}}class K extends It{_tag="InvalidValue";annotations;constructor(e,t,n){super(t,n);this.annotations=e}}function et(e,t,n,r,o){return new ge(e,[new we([t],n)],r,o)}class no extends It{_tag="Forbidden";annotations;constructor(e,t,n){super(t,n);this.annotations=e}}class Is extends It{_tag="AnyOf";ast;issues;constructor(e,t,n,r){super(n,r);this.ast=e,this.issues=t}}class Ol extends It{_tag="OneOf";ast;successes;constructor(e,t,n,r){super(n,r);this.ast=e,this.successes=t}}function wl(e,t,n){if(Tl(e))return e;if(typeof e==="string")return new K({message:e},t,n);let r=typeof e.issue==="string"?new K({message:e.issue},t,n):e.issue;return new we(e.path,r)}function gg(e,t,n){if(e===void 0)return;if(typeof e==="boolean")return e?void 0:new K(void 0,t,n);return wl(e,t,n)}function xg(e,t,n,r){if(Array.isArray(t)){if(!Rn(t))return;return t.length===1?wl(t[0],n,r):new ge(e,_n(t,(o)=>wl(o,n,r)),n,r)}return gg(t,n,r)}var yg=(e)=>{let t=to(e);if(t!==void 0)return t;switch(e._tag){case"InvalidType":return $n(xs(e.ast),e);case"InvalidValue":{let n=Al(e);if(n!==void 0)return $n(n,e);let r=ba(e);return r===void 0?"Expected a valid value":`Invalid data ${r}`}case"MissingKey":return"Missing key";case"UnexpectedKey":{let n=ba(e);return n===void 0?"Expected no excess property":`Unexpected key with value ${n}`}case"Forbidden":return"Forbidden operation";case"OneOf":{let n=ba(e);return n===void 0?"Expected exactly one member to match":`Expected exactly one member to match the input ${n}`}}},Sg=(e)=>to(e.issue)??to(e);function Ig(e){return(t)=>({issues:eo(t,[],e?.leafHook??yg,e?.checkHook??Sg)})}function ba(e){return C0(e)?O(e.input):void 0}function Al(e){let t=e.annotations?.expected;return typeof t==="string"?t:void 0}function $n(e,t){let n=ba(t);return n===void 0?`Expected ${e}`:`Expected ${e}, got ${n}`}function eo(e,t,n,r){switch(e._tag){case"Filter":{let o=r(e);if(o!==void 0)return[{path:t,message:o}];if(e.issue._tag!=="InvalidValue")return eo(e.issue,t,n,r);let s=Al(e.issue);return[{path:t,message:s===void 0?$n(kl(e.filter),e):$n(s,e.issue)}]}case"Encoding":return eo(e.issue,t,n,r);case"Pointer":return eo(e.issue,[...t,...e.path],n,r);case"Composite":return e.issues.flatMap((o)=>eo(o,t,n,r));case"AnyOf":{if(e.issues.length===0)return[{path:t,message:to(e)??$n(xs(e.ast),e)}];return e.issues.flatMap((o)=>eo(o,t,n,r))}default:return[{path:t,message:n(e)}]}}function kl(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((n)=>kl(n)).join(" & ")}}function N0(){return(e)=>ys(e,"")}var bg=N0();function ys(e,t){let n;switch(e._tag){case"Filter":{let r=Sg(e);if(r!==void 0)n=r;else{if(e.issue._tag!=="InvalidValue")return ys(e.issue,t);let o=Al(e.issue);n=o===void 0?$n(kl(e.filter),e):$n(o,e.issue)}break}case"Encoding":return ys(e.issue,t);case"Pointer":return ys(e.issue,t+pi(e.path));case"Composite":case"AnyOf":{if(e._tag==="Composite"||e.issues.length>0)return e.issues.map((r)=>ys(r,t)).join(`
|
|
23
|
-
`);n=to(e)??$n(xs(e.ast),e);break}default:n=yg(e);break}return t?`${n}
|
|
24
|
-
at ${t}`:n}function to(e){if(e._tag==="Pointer")return;if(e._tag==="Encoding")return to(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 bs(e){let t;for(let n of e.reasons){if(!Ji(n)||!Tl(n.error))return;t??=n.error}return t}function hn(e,t){let n=bs(e);if(n===void 0)throw Error(t,{cause:e});return n}class gn extends Jn{run;constructor(e){super();this.run=e}map(e){return new gn((t,n)=>this.run(t,n).pipe(Yr(qo(e))))}compose(e){if(Tg(this))return e;if(Tg(e))return this;return new gn((t,n)=>this.run(t,n).pipe(ft((r)=>e.run(r,n))))}}function P0(e){return new gn((t,n)=>_(e(t,n)))}function Rl(e){return P0((t,n)=>{let r={message:e(t)};return Ve(t)?new no(r,t.value,n):new no(r)})}var Eg=new gn(L);function Tg(e){return e.run===Eg.run}function Mt(){return Eg}function _l(e){return new gn((t,n)=>Te(t)?ns:e(t.value,n))}function J(e){return Ta(qo(e))}function tt(e){return _l((t,n)=>e(t,n).pipe(Yr(H)))}function Ta(e){return new gn((t)=>L(e(t)))}function Cl(){return new gn(()=>ns)}function ws(e){return new gn((t)=>{let n=Br(t,en);return Ve(n)?L(n):Yr(e,H)})}function hr(){return J(globalThis.String)}function Ea(){return J(globalThis.Number)}function vg(){return J(globalThis.BigInt)}function Nl(){return J((e)=>new globalThis.Date(e))}function Og(){return J(Oh)}function Ag(e){return _l((t,n)=>os({try:()=>H(JSON.parse(t,e?.reviver)),catch:()=>new K({expected:"a valid JSON string"},t,n)}))}function kg(e){return _l((t,n)=>os({try:()=>{let r=JSON.stringify(t,e?.replacer,e?.space);if(r===void 0)throw TypeError("Value cannot be represented as JSON");return H(r)},catch:()=>new K({expected:"a JSON-serializable value"},t,n)}))}function Pl(){return J(ji)}function va(){return J(Kp)}function Oa(){return J(Wp)}function Rg(){return tt((e,t)=>sa(Ph(Hr(e)),()=>new K({expected:"a valid Base64 string"},e,t)))}function _g(){return tt((e,t)=>Ze(Hp(e),{onFailure:()=>_(new K({expected:"a valid Base64 string"},e,t)),onSuccess:L}))}function Cg(){return tt((e,t)=>Ze(hu(e),{onFailure:()=>_(new K({expected:"a valid Base64Url string"},e,t)),onSuccess:L}))}function Ng(){return tt((e,t)=>Ze(Jp(e),{onFailure:()=>_(new K({expected:"a valid Base64Url string"},e,t)),onSuccess:L}))}function Pg(){return tt((e,t)=>Ze(gu(e),{onFailure:()=>_(new K({expected:"a valid hexadecimal string"},e,t)),onSuccess:L}))}function Mg(){return tt((e,t)=>Ze(Gp(e),{onFailure:()=>_(new K({expected:"a valid hexadecimal string"},e,t)),onSuccess:L}))}function Fg(){return J(encodeURIComponent)}function Dg(){return tt((e,t)=>{try{return L(globalThis.decodeURIComponent(e))}catch{return _(new K({expected:"a valid URI component"},e,t))}})}function Ml(){return tt((e,t)=>Ct(ia(e),{onNone:()=>_(new K({message:"Invalid DateTime input"},e,t)),onSome:(n)=>L(aa(n))}))}function Ug(){return J((e)=>qg(Array.from(e.entries())))}var M0=Bg((e)=>typeof e==="string"||typeof Blob<"u"&&e instanceof Blob);function $g(){return J((e)=>{let t=new FormData;if(typeof e==="object"&&e!==null)M0(e).forEach(([r,o])=>{t.append(r,o)});return t})}function Lg(){return J((e)=>qg(Array.from(e.entries())))}var F0=Bg(bn);function jg(){return J((e)=>{if(typeof e==="object"&&e!==null)return new URLSearchParams(F0(e));return new URLSearchParams})}var D0=/^\d+$/;function U0(e){if(e==="")return[""];let t=e.replace(/\[(.*?)\]/g,".$1"),n=t.split("."),r=t.startsWith(".")?1:0;return n.slice(r).map((o)=>D0.test(o)?globalThis.Number(o):o)}function qg(e){let t={},n=new WeakSet;function r(o,s,i){let a=Object.hasOwn(o,s)?o[s]:void 0;if(n.has(a)&&Array.isArray(a)===i)return a;let c=i?[]:{};return n.add(c),A(o,s,c),c}return e.forEach(([o,s])=>{let i=U0(o),a=t;i.forEach((c,u)=>{let l=u===i.length-1;if(Array.isArray(a)&&c==="")if(l)a.push(s);else{let d=i[u+1],f=typeof d==="number"||d==="",h=a.length;a=r(a,h,f)}else if(l){let d=Object.hasOwn(a,c);if(d&&Array.isArray(a[c]))a[c].push(s);else if(d)A(a,c,[a[c],s]);else A(a,c,s)}else{let d=i[u+1];a=r(a,c,typeof d==="number"||d==="")}})}),t}function Bg(e){return(t)=>{let n=[];function r(o,s){if(e(s))n.push([o,s]);else if(Array.isArray(s))if(s.every(e))s.forEach((a)=>{n.push([o,a])});else s.forEach((a,c)=>{r(`${o}[${c}]`,a)});else if(typeof s==="object"&&s!==null)for(let[i,a]of Object.entries(s))r(`${o}[${i}]`,a)}for(let[o,s]of Object.entries(t))r(o,s);return n}}class Es{_tag="Middleware";decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new Es(this.encode,this.decode)}}var Ts="~effect/SchemaTransformation/Transformation";class ee{[Ts]=Ts;_tag="Transformation";decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new ee(this.encode,this.decode)}compose(e){return new ee(this.decode.compose(e.decode),e.encode.compose(this.encode))}}function $0(e){return D(e,Ts)&&e[Ts]===Ts}var Aa=(e)=>{if($0(e))return e;return new ee(e.decode,e.encode)};function dt(e){return new ee(tt(e.decode),tt(e.encode))}function fe(e){return new ee(J(e.decode),J(e.encode))}function ka(e){return new ee(Ta(e.decode),Ta(e.encode))}function zg(){return new ee(Og(),Mt())}var L0=new ee(Mt(),Mt());function ro(){return L0}var oo=new ee(Ea(),hr()),Ra=new ee(vg(),hr()),Dl=new ee(Nl(),J(_c)),Hg=new ee(Nl(),J((e)=>e.getTime())),Kg=dt({decode:(e,t)=>Ct(Ap(e),{onNone:()=>_(new K({expected:"a valid Duration string"},e,t)),onSome:L}),encode:(e)=>L(globalThis.String(e))}),Jg=dt({decode:(e)=>L(Pn(e)),encode:(e,t)=>Ct(Rp(e),{onNone:()=>_(new K({expected:"a Duration representable as a bigint"},e,t)),onSome:(n)=>L(n)})}),Wg=fe({decode:(e)=>rr(e),encode:(e)=>kp(e)}),j0=(e)=>De(e)&&typeof e.message==="string",Gg=(e)=>{let n=Object.hasOwn(e,"cause")?Error(e.message,{cause:Vg(e.cause)}):Error(e.message);if(typeof e.name==="string"&&e.name!=="Error")n.name=e.name;if(typeof e.stack==="string")n.stack=e.stack;return n},q0=(e)=>{try{let t=Mr(e);return t===void 0?O(e):JSON.parse(t)}catch{return O(e)}},B0=(e,t,n)=>{let r={name:e.name,message:typeof e.message==="string"?e.message:""};if(t?.includeStack&&typeof e.stack==="string")r.stack=e.stack;if(!t?.excludeCause&&e.cause!==void 0)r.cause=n(e.cause);return r},Zg=(e)=>{let t=new WeakSet,n=(r)=>{if(kd(r)){if(t.has(r))return"[Circular]";t.add(r);let o=B0(r,e,n);return t.delete(r),o}return q0(r)};return n},Vg=(e)=>j0(e)?Gg(e):e,Yg=(e)=>fe({decode:Gg,encode:(t)=>Zg(e)(t)}),Xg=(e)=>fe({decode:Vg,encode:Zg(e)});function Qg(){return fe({decode:Zd,encode:Wc})}function ex(){return fe({decode:Gd,encode:ki})}function tx(e){return fe({decode:Wd,encode:e?.onNoneEncoding===null?Wc:ki})}function nx(){return ka({decode:H,encode:qr})}function rx(){return ka({decode:(e)=>e.pipe(Br(en),H),encode:qr})}var Ul=dt({decode:(e,t)=>URL.canParse(e)?L(new URL(e)):_(new K({expected:"a valid URL string"},e,t)),encode:(e)=>L(e.href)}),$l=dt({decode:(e,t)=>{let n=ip(e);return Te(n)?_(new K({expected:"a valid BigDecimal string"},e,t)):L(n.value)},encode:(e)=>L(Ht(e))}),Ll=new ee(Rg(),Pl()),ox=new ee(_g(),Pl()),sx=new ee(Ng(),va()),ix=new ee(Mg(),Oa()),ax=new ee(Dg(),Fg());function cx(e){return new ee(Ag(e??{}),kg(e))}var ux=new ee(Ug(),$g()),lx=new ee(Lg(),jg()),fx=fe({decode:(e)=>as(e),encode:(e)=>e.offset}),jl=dt({decode:(e,t)=>Ct(Kh(e),{onNone:()=>_(new K({expected:"a valid IANA time zone"},e,t)),onSome:L}),encode:(e)=>L(e.id)}),ql=dt({decode:(e,t)=>Ct(Jh(e),{onNone:()=>_(new K({expected:"a valid time zone"},e,t)),onSome:L}),encode:(e)=>L(Dn(e))}),Bl=dt({decode:(e,t)=>Ct(ia(e),{onNone:()=>_(new K({expected:"a valid UTC DateTime string"},e,t)),onSome:(n)=>L(aa(n))}),encode:(e)=>L(Gh(e))}),zl=dt({decode:(e,t)=>Ct(Hh(e),{onNone:()=>_(new K({expected:"a valid Zoned DateTime string"},e,t)),onSome:L}),encode:(e)=>L(ua(e))});function jn(e){return(t)=>t._tag===e}var qn=jn("Declaration");var z0=jn("Never");var so=jn("Literal"),Hl=jn("UniqueSymbol");var Yl=jn("Arrays"),H0=jn("Objects"),bx=jn("Union"),K0=jn("Suspend");class de{to;transformation;constructor(e,t){this.to=e,this.transformation=t}}var xr={};class Dt{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,n=void 0,r=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=n,this.annotations=r}}var px="~effect/Schema";class ye{[px]=px;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,r=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=r}toString(){return`<${this._tag}>`}}class yr extends ye{_tag="Declaration";typeParameters;run;encodingChecks;encodingRun;constructor(e,t,n,r,o,s,i,a){super(n,r,o,s);this.typeParameters=e,this.run=t,this.encodingChecks=i,this.encodingRun=a}getParser(){let e;return(t,n)=>{if(t===Q)return Pt;return(e??=this.run(this.typeParameters))(t,this,n)}}_rebuild(e,t,n,r,o){let s=ao(this.typeParameters,e);return s===this.typeParameters&&t===this.checks&&n===this.encodingChecks&&r===this.run&&o===this.encodingRun?this:new yr(s,r,this.annotations,t,void 0,this.context,n,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;if(typeof e==="string")return e;return"<Declaration>"}}class wx extends ye{_tag="Null";getParser(){return za(this,null)}getExpected(){return"null"}}var Xl=new wx;class Tx extends ye{_tag="Undefined";getParser(){return za(this,void 0)}toCodecJson(){return se(this,[Ex])}getExpected(){return"undefined"}}var Ex=new de(Xl,new ee(J(()=>{return}),J(()=>null))),Ql=new Tx;class vx extends ye{_tag="Void";getParser(){let e=St(void 0);return(t)=>t===Q?Pt:e}toCodecJson(){return se(this,[Ex])}getExpected(){return"void"}}var Ox=new vx;class Ax extends ye{_tag="Never";getParser(){return $t(this,Ad)}getExpected(){return"never"}}var kx=new Ax;class Rx extends ye{_tag="Any";getParser(){return $t(this,Ic)}getExpected(){return"any"}}var _x=new Rx;class Cx extends ye{_tag="Unknown";getParser(){return $t(this,Ic)}getExpected(){return"unknown"}}var xn=new Cx;class Nx extends ye{_tag="ObjectKeyword";getParser(){return $t(this,Co)}getExpected(){return"object | array | function"}}var Px=new Nx;class ef extends ye{_tag="Enum";enums;constructor(e,t,n,r,o){super(t,n,r,o);this.enums=e}getParser(){let e=new Set(this.enums.map(([,t])=>t));return $t(this,(t)=>e.has(t))}toCodecStringTree(){if(this.enums.some(([e,t])=>typeof t==="number")){let e=Object.fromEntries(this.enums.map(([t,n])=>[globalThis.String(n),n]));return se(this,[new de(new Be(Object.keys(e).map((t)=>new pt(t)),"anyOf"),new ee(J((t)=>e[t]),hr()))])}return this}getExpected(){return this.enums.map(([e,t])=>JSON.stringify(t)).join(" | ")}}function Mx(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(Mx);default:return!1}}class tf extends ye{_tag="TemplateLiteral";parts;encodedParts;literals;suffixLengths;constructor(e,t,n,r,o){super(t,n,r,o);let s=[],i=[];for(let c of e){let u=nt(c);if(Mx(u))s.push(u),i.push(u._tag==="Literal"?globalThis.String(u.literal):void 0);else throw Error(`Invalid TemplateLiteral part ${u._tag}`)}let a=Array(s.length+1);a[s.length]=0;for(let c=s.length-1;c>=0;c--)a[c]=a[c+1]+(i[c]?.length??0);this.parts=e,this.encodedParts=s,this.literals=i,this.suffixLengths=a}getParser(e){let t=e(this.asTemplateLiteralParser());return(n,r)=>{if(n===Q)return Pt;let o=t(n,r);if(o._tag==="Success")return Ee;return _e(o,{onSuccess:()=>n,onFailure:(s)=>new ge(this,[s],n,r)})}}getExpected(){return"string"}matchPart(e,t){return Ix(this,e,t)===void 0?void 0:e}asTemplateLiteralParser(){let e=new Ut(!1,this.parts.map(sy),[]);return Ba(Zt,e,new ee(tt((t,n)=>{let r=Ix(this,t,n);if(r)return L(r);return _(new K({expected:"a string matching template literal parts"},t,n))}),J((t)=>t.join(""))))}}class nf extends ye{_tag="UniqueSymbol";symbol;constructor(e,t,n,r,o){super(t,n,r,o);this.symbol=e}getParser(){return za(this,this.symbol)}toCodecStringTree(){return se(this,[cy])}getExpected(){return globalThis.String(this.symbol)}}class pt extends ye{_tag="Literal";literal;constructor(e,t,n,r,o){super(t,n,r,o);if(typeof e==="number"&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${O(e)}`);this.literal=e}getParser(){return za(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==="bigint"?mx(this):this}toCodecStringTree(){return typeof this.literal==="string"?this:mx(this)}getExpected(){return typeof this.literal==="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}}function mx(e){let t=globalThis.String(e.literal);return se(e,[new de(new pt(t),new ee(J(()=>e.literal),J(()=>t)))])}class Fx extends ye{_tag="String";getParser(){return $t(this,bn)}matchPart(e,t){let n=this.checks;return n&&!t.disableChecks&&Lt(n,e,void 0,this,t)?void 0:e}getExpected(){return"string"}}var Zt=new Fx;class Dx extends ye{_tag="Number";getParser(){return $t(this,_o)}matchKey(e,t){return this._match(rv,e,t)}matchPart(e,t){return this._match(Gl,e,t)}_match(e,t,n){if(!e.test(t))return;let r=globalThis.Number(t);if(n.disableChecks||!this.checks)return r;return Lt(this.checks,r,void 0,this,n)?void 0:r}toCodecJson(){if(this.checks&&(Kl(this.checks,"effect/schema/isFinite")||Kl(this.checks,"effect/schema/isInt")))return this;return se(this,[Y0])}toCodecStringTree(){if(this.toCodecJson()===this)return se(this,[ov]);return se(this,[sv])}getExpected(){return"number"}}function Kl(e,t){return e.some((n)=>n.annotations?.representation?.id===t||n._tag==="FilterGroup"&&Kl(n.checks,t))}var rf=new Dx;class Ux extends ye{_tag="Boolean";getParser(){return $t(this,Ed)}getExpected(){return"boolean"}}var $x=new Ux;class Lx extends ye{_tag="Symbol";getParser(){return $t(this,Sc)}matchKey(e,t){if(t.disableChecks||!this.checks)return e;return Lt(this.checks,e,void 0,this,t)?void 0:e}toCodecStringTree(){return se(this,[cy])}getExpected(){return"symbol"}}var jx=new Lx;class qx extends ye{_tag="BigInt";getParser(){return $t(this,vd)}matchPart(e,t){if(!Zl.test(e))return;let n=globalThis.BigInt(e);if(t.disableChecks||!this.checks)return n;return Lt(this.checks,n,void 0,this,t)?void 0:n}toCodecStringTree(){return se(this,[av])}getExpected(){return"bigint"}}var Bx=new qx;class Ut extends ye{_tag="Arrays";isMutable;elements;rest;encodingChecks;constructor(e,t,n,r,o,s,i,a){super(r,o,s,i);this.isMutable=e,this.elements=t,this.rest=n,this.encodingChecks=a;let c=!1;for(let u=0;u<t.length;u++)if(xe(t[u]))c=!0;else if(c)throw Error("A required element cannot follow an optional element. ts(1257)");if(c&&n.length>1)throw Error("A required element cannot follow an optional element. ts(1257)");for(let u=1;u<n.length;u++)if(xe(n[u]))throw Error("An optional element cannot follow a rest element. ts(1266)")}getParser(e,t=e){let n=this,r,o,s=n.elements.length,i=Math.max(0,n.rest.length-1);function a(c,u){if(u<s)return r[u];else if(u>=c)return o[u-c+1];return o[0]}return rl(function*(c,u){if(c===Q)return Q;if(!Array.isArray(c))return yield*_(new le(n,c,u));if(!r)r=n.elements.map((x)=>({ast:x,parser:t(x)})),o=n.rest.map((x)=>({ast:x,parser:t(x)}));let l=c.length,d={ast:n,getParser:a,input:c,len:l,tailThreshold:Math.max(s,l-i),output:new globalThis.Array(l),issues:void 0,options:u},f=of(u?.concurrency),h=J0(d,c,{concurrency:f?.concurrency,end:n.rest.length===0?s:Math.max(l,s+i)});if(h)yield*h;if(n.rest.length===0&&l>s)for(let x=s;x<=l-1;x++){let w=new wa(n,c[x],u),p=new we([x],w);if(u.errors==="all")if(d.issues)d.issues.push(p);else d.issues=[p];else return yield*_(new ge(n,[p],c,u))}if(d.issues)return yield*_(new ge(n,d.issues,c,u));return d.output})}_rebuild(e,t,n){let r=ao(this.elements,e),o=ao(this.rest,e);return r===this.elements&&o===this.rest&&t===this.checks&&n===this.encodingChecks?this:new Ut(this.isMutable,r,o,this.annotations,t,void 0,this.context,n)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return"array"}}var J0=Zo()({onItem(e,t,n){let r=n<e.len?t:Q;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step(e,t,n,r){if(n._tag==="Failure")return _a(e,e.ast,r,n);let o=n===Ee?t:n[F];if(o!==Q)e.output[r]=o;else{let s=e.getParser(e.tailThreshold,r);if(xe(s.ast))return;let i=new we([r],new pr(s.ast.context?.annotations));if(e.options.errors==="all")if(e.issues)e.issues.push(i);else e.issues=[i];else return Gr(new ge(e.ast,[i],e.input,e.options))}}}),of=(e)=>(e=e==="unbounded"?1/0:e??1,e>1?{concurrency:e}:void 0),_a=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let o=bs(r.cause);if(o===void 0)return pn(Fn(r.cause,(i)=>new ge(t,[new we([n],i)],e.input,e.options)));let s=new we([n],o);if(e.options.errors==="all")if(e.issues)e.issues.push(s);else e.issues=[s];else return Gr(new ge(t,[s],e.input,e.options))},Ca="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";function gr(e,t,n=xr){let r,o;function s(i){switch(i._tag){case"String":case"TemplateLiteral":return(r??=Object.keys(e)).filter((a)=>i.matchPart(a,n)!==void 0);case"Number":return(r??=Object.keys(e)).filter((a)=>i.matchKey(a,n)!==void 0);case"Symbol":return(o??=Object.getOwnPropertySymbols(e)).filter((a)=>i.matchKey(a,n)!==void 0);case"Union":return[...new Set(i.types.flatMap(s))];default:return[]}}return s(mf(nt(t)))}class Na{name;type;constructor(e,t){this.name=e,this.type=t}}function Jl(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every(Jl);default:return!1}}function W0(e){return Jl(e)&&Jl(nt(e))}class Pa{parameter;type;constructor(e,t){if(!W0(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,xe(t)&&!ry(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}}class uo extends ye{_tag="Objects";propertySignatures;indexSignatures;encodingChecks;constructor(e,t,n,r,o,s,i){super(n,r,o,s);this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=i;let a=e.map((c)=>c.name).filter((c,u,l)=>l.indexOf(c)!==u);if(a.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(a)}. ts(2300)`)}getParser(e,t=e){let n=this,r=[];for(let p of n.propertySignatures)r.push(p.name);let o=r.length,s=n.indexSignatures.length,i=o&&s?new Set(r):void 0;if(!o&&!s)return $t(n,ci);let a,c,u=(p,S,E,g,b)=>{if(b._tag==="Failure")return _a(p,n,S,b)??Zr;let m=b===Ee?g:b[F];if(E!==Q&&m!==Q){if(o&&(i.has(S)||i.has(E)))return Zr;A(p.out,E,m)}return Zr},l=(p,S,E,g)=>{if(!g){let I=E.parserKey(S,p.options);if(!ce(I))return Jt(ss(I),(v)=>l(p,S,E,v));g=I}if(g._tag==="Failure")return _a(p,n,S,g)??Zr;let b=g===Ee?S:g[F],m=p.input[S],y=E.parserValue(m,p.options);return ce(y)?u(p,S,b,m,y):Jt(ss(y),(I)=>u(p,S,b,m,I))},d=(p,S,E)=>{let g=p.input[S],b=E.parserValue(g,p.options);return ce(b)?u(p,S,S,g,b):Jt(ss(b),(m)=>u(p,S,S,g,m))},f=s?Zo()({onItem:(p,[S,E])=>l(p,S,E),step:(p,S,E)=>E._tag==="Failure"?E:void 0}):void 0,h=()=>{if(!a)a=n.propertySignatures.map((p)=>({parser:t(p.type),name:p.name,type:p.type})),c=s?n.indexSignatures.map((p)=>({is:p,parserKey:e(mf(p.parameter)),parserValue:t(p.type)})):void 0;return a},x=rl(function*(p,S){if(p===Q)return Q;if(!(typeof p==="object"&&p!==null&&!Array.isArray(p)))return yield*_(new le(n,p,S));h();let E=p,g={},b={ast:n,input:E,out:g,issues:void 0,options:S},m=S.errors==="all",y=S.onExcessProperty==="error",I=S.onExcessProperty==="preserve",v;if(!s&&(y||I)){i??=new Set(r),v=Reflect.ownKeys(E);for(let M=0;M<v.length;M++){let R=v[M];if(!i.has(R))if(y){let Y=new wa(n,E[R],S),W=new we([R],Y);if(m){if(b.issues)b.issues.push(W);else b.issues=[W];continue}else return yield*_(new ge(n,[W],p,S))}else A(g,R,E[R])}}let U=of(S?.concurrency);if(o){let M=hx(b,a,U);if(M)yield*M}if(s&&!U)for(let M=0;M<s;M++){let R=c[M],Y=R.is.parameter===Zt?d:l,W=R.is.parameter===Zt?Object.keys(E):gr(E,R.is.parameter,S);for(let Pe=0;Pe<W.length;Pe++){let Me=Y(b,W[Pe],R);if(!ce(Me))yield*Me;else if(Me._tag==="Failure")return yield*Me}}else if(f){let M=_i();for(let Y=0;Y<s;Y++){let W=c[Y],Pe=gr(E,W.is.parameter,S);for(let Me=0;Me<Pe.length;Me++)M.push([Pe[Me],W])}let R=f(b,M,U);if(R)yield*R}if(b.issues)return yield*_(new ge(n,b.issues,p,S));if(S.propertyOrder==="original"){let M=(v??Reflect.ownKeys(E)).concat(r),R={};for(let Y of M)if(Object.hasOwn(g,Y))A(R,Y,g[Y]);return R}return g});if(s)return x;let w=(p,S,E)=>{let g=a[S];return Jt(ss(E),(b)=>{let m=Wl(p,g,b);if(m)return m;let y=()=>St(p.out),I=hx(p,a.slice(S+1));return I?ft(I,y):y()})};return(p,S)=>{if(p===Q)return Pt;if(S.errors==="all"||S.onExcessProperty!==void 0||S.propertyOrder==="original"||S.concurrency!==void 0)return x(p,S);if(!(typeof p==="object"&&p!==null&&!Array.isArray(p)))return _(new le(n,p,S));let E=h(),g=p,b={},m={ast:n,input:g,out:b,issues:void 0,options:S};try{for(let y=0;y<E.length;y++){let I=E[y],v=I.name,U=Object.hasOwn(g,v),M=U?g[v]:Q,R=I.parser(M,S);if(!ce(R))return w(m,y,R);if(R===Ee){if(U)A(b,v,M);continue}let Y=Wl(m,I,R);if(Y)return Y}}catch(y){return Nh(y)}return St(b)}}_rebuild(e,t,n,r){let o=ao(this.propertySignatures,(i)=>{let a=e(i.type);return a===i.type?i:new Na(i.name,a)}),s=ao(this.indexSignatures,(i)=>{let a=t(i.parameter),c=e(i.type);return a===i.parameter&&c===i.type?i:new Pa(a,c)});return o===this.propertySignatures&&s===this.indexSignatures&&n===this.checks&&r===this.encodingChecks?this:new uo(o,s,this.annotations,n,void 0,this.context,r)}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(){if(this.propertySignatures.length===0&&this.indexSignatures.length===0)return"object | array";return"object"}}function Wl(e,t,n){if(n._tag==="Failure")return _a(e,e.ast,t.name,n);if(n===Ee)return;let r=n[F];if(r!==Q){A(e.out,t.name,r);return}if(delete e.out[t.name],!xe(t.type)){let o=new we([t.name],new pr(t.type.context?.annotations));if(e.options.errors==="all"){if(e.issues)e.issues.push(o);else e.issues=[o];return}else return Gr(new ge(e.ast,[o],e.input,e.options))}}var hx=Zo()({onItem(e,t){if(!Object.hasOwn(e.input,t.name))return t.parser(Q,e.options);let n=e.input[t.name];return A(e.out,t.name,n),t.parser(n,e.options)},step:Wl});function sf(e,t){if(!e)return t;if(!t)return e;return[...e,...t]}function Ma(e,t,n){return new uo(Reflect.ownKeys(e).map((r)=>new Na(r,e[r].ast)),[],n,t)}function As(e){return e.ast}function af(e,t=void 0){return new Ut(!1,e.map((n)=>n.ast),[],void 0,t)}function Fa(e,t,n){return new Be(e.map(As),t,void 0,n)}function zx(e,t){if(e.encoding||t.some((s)=>s.encoding))throw Error("StructWithRest does not support encodings");let{propertySignatures:n,indexSignatures:r,checks:o}=e;for(let s of t)n=n.concat(s.propertySignatures),r=r.concat(s.indexSignatures),o=sf(o,s.checks);return new uo(n,r,void 0,o)}function Hx(e,t){if(e.encoding)throw Error("TupleWithRest does not support encodings");return new Ut(e.isMutable,e.elements,t,void 0,e.checks)}var Da=Wn((e)=>{while(!0){if(K0(e))return xn;let t=e.encoding;if(!t)return e.recur?.(Da,ne)??e;if(t.some((n)=>n.transformation._tag==="Middleware"&&n.transformation.decode!==ne))return xn;e=t[t.length-1].to}});function Kx(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(Kx)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function io(e){switch(e._tag){default:return[];case"Declaration":{let t=e.annotations?.[gs];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap((t)=>{let n=t.type;if(!xe(n)){if(so(n))return[{key:t.name,literal:n.literal}];if(Hl(n))return[{key:t.name,literal:n.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,n)=>{if(!xe(t)){if(so(t))return[{key:n,literal:t.literal}];if(Hl(t))return[{key:n,literal:t.symbol}]}return[]});case"Union":{if(e.types.length===0)return[];let t=e.types.map((n)=>io(Da(n)));return t[0].filter((n)=>t.every((r)=>r.some((o)=>o.key===n.key&&o.literal===n.literal)))}case"Suspend":return io(e.thunk())}}var gx=new WeakMap,vs=Object.freeze([]);function G0(e){let t=gx.get(e);if(t)return t;let n,r=0,o,s,i=!0;for(let a=0;a<e.length;a++){let c=e[a],u=Da(c);if(z0(u))continue;if(i)if(so(u)||Hl(u)){s??=new Map;let d=so(u)?u.literal:u.symbol,f=s.get(d);if(!f)s.set(d,f=[]);f.push(c)}else i=!1;let l=io(u);if(l.length){n??=new Map,r++;for(let{key:d,literal:f}of l){let h=n.get(d);if(!h)n.set(d,h=[new Map,new Set]);h[1].add(a);let x=h[0].get(f);if(!x)h[0].set(f,x=new Set);x.add(a)}}else{o??={};let d=Kx(u);for(let f of d)(o[f]??=[]).push(a)}}if(i&&s)s.forEach(Object.freeze),t=(a)=>s.get(a)??vs;else if(n?.size===1&&!o){let[a,[c]]=n.entries().next().value,u=c;for(let[l,d]of c)u.set(l,Object.freeze(Array.from(d,(f)=>e[f])));t=(l,d)=>{if(Co(l)){let f=Object.hasOwn(l,a)?l[a]:void 0;if(f!==void 0)return u.get(f)??vs;if(d)return e}return vs}}else if(n){let a;for(let c of n)if((!a||c[1][0].size>a[1][0].size)&&c[1][1].size===r)a=c;t=(c,u)=>{let l=c===null?"null":Array.isArray(c)?"array":typeof c,d=o?.[l]??vs;if(!Co(c))return d.map((x)=>e[x]);let f=new Set(d),h;if(a){let[x,[w]]=a,p=Object.hasOwn(c,x),S=p?c[x]:void 0;if(p&&(!u||S!==void 0)){let E=w.get(S);if(!E)return d.map((g)=>e[g]);for(let g of E)f.add(g);h=x}}if(h===void 0)for(let[x,[w,p]]of n){let S=Object.hasOwn(c,x),E=S?c[x]:void 0;if(S&&(!u||E!==void 0)){let g=w.get(E);if(g)for(let b of g)f.add(b)}else if(u)for(let g of p)f.add(g)}for(let[x,[w,p]]of n){if(x===h)continue;let S=Object.hasOwn(c,x),E=S?c[x]:void 0;if(S&&(!u||E!==void 0)){let g=w.get(E);for(let b of f)if(p.has(b)&&!g?.has(b))f.delete(b)}}return Array.from(f).sort((x,w)=>x-w).map((x)=>e[x])}}else t=(a)=>{let c=a===null?"null":Array.isArray(a)?"array":typeof a;return(o?.[c]??vs).map((u)=>e[u]).filter(Z0(a))};return gx.set(e,t),t}function Z0(e){return(t)=>{let n=Da(t);return n._tag==="Literal"?n.literal===e:n._tag==="UniqueSymbol"?n.symbol===e:!0}}function ks(e,t,n=!1){return G0(t)(e,n)}class Be extends ye{_tag="Union";types;mode;encodingChecks;constructor(e,t,n,r,o,s,i){super(n,r,o,s);this.types=e,this.mode=t,this.encodingChecks=i}getParser(e,t){let n=this;return(r,o)=>{if(r===Q)return Pt;let s=ks(r,n.types,t!==void 0);if(s.length===1){let u=e(s[0])(r,o);if(u._tag==="Success")return u;return ce(u)?xx(n,u.cause,r,o):ur(u,(l)=>xx(n,l,r,o))}let i={ast:n,compile:e,input:r,out:void 0,successes:n.mode==="oneOf"?[]:void 0,issues:void 0,options:o},a=of(o?.concurrency),c=V0(i,s,a?{...a,orderedStep:!0}:void 0);if(!c){if(i.out)return i.out;return _(new Is(n,i.issues??[],r,o))}return ft(c,(u)=>{if(i.out===Ee)return L(r);if(i.out)return i.out;return _(new Is(n,i.issues??[],r,o))})}}_rebuild(e,t,n){let r=ao(this.types,e);return r===this.types&&t===this.checks&&n===this.encodingChecks?this:new Be(r,this.mode,this.annotations,t,void 0,this.context,n)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let n of this.types){let r=n.matchPart(e,t);if(r!==void 0)return r}return}getExpected(e){let t=this.annotations?.expected;if(typeof t==="string")return t;if(this.types.length===0)return"never";let n=this.types.map((r)=>{let o=nt(r);switch(o._tag){case"Arrays":{let s=o.elements.filter(so);if(s.length>0)return`${yx(o.isMutable)}[ ${s.map((i)=>e(i)+Sx(i.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let s=o.propertySignatures.filter((i)=>so(i.type));if(s.length>0)return`{ ${s.map((i)=>`${yx(i.type.context?.isMutable)}${tn(i.name)}${Sx(i.type.context?.isOptional)}: ${e(i.type)}`).join(", ")}, ... }`;break}}return e(o)});return Array.from(new Set(n)).join(" | ")}}function xx(e,t,n,r){let o=bs(t);if(!o)return pn(t);return Gr(new Is(e,[o],n,r))}var V0=Zo()({onItem(e,t){return e.compile(t)(e.input,e.options)},step(e,t,n){if(n._tag==="Failure"){let r=bs(n.cause);if(r===void 0)return n;if(e.issues)e.issues.push(r);else e.issues=[r]}else{if(e.out&&e.successes)return e.successes.push(t),Gr(new Ol(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(t);else return Zr}}}),Jx=new Be([new pt("Infinity"),new pt("-Infinity"),new pt("NaN")],"anyOf");function yx(e){return e?"":"readonly "}function Sx(e){return e?"?":""}function Sr(e){let t=!1,n;return()=>{if(t)return n;return n=e(),t=!0,n}}class Ua extends ye{_tag="Suspend";thunk;constructor(e,t,n,r,o){if(n)throw Error("Cannot add checks to Suspend");super(t,void 0,r,o);this.thunk=Sr(e)}getParser(e){let t;return(n,r)=>(t??=e(this.thunk()))(n,r)}recur(e){return new Ua(()=>e(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(e){return e(this.thunk())}}class Os extends Jn{_tag="Filter";run;annotations;aborted;constructor(e,t=void 0,n=!1){super();this.run=e,this.annotations=t,this.aborted=n}annotate(e){return new Os(this.run,{...this.annotations,...e},this.aborted)}abort(){return new Os(this.run,this.annotations,!0)}and(e,t){return new Ln([this,e],t)}}class Ln extends Jn{_tag="FilterGroup";checks;annotations;constructor(e,t=void 0){super();this.checks=e,this.annotations=t}annotate(e){return new Ln(this.checks,{...this.annotations,...e})}and(e,t){return new Ln([this,e],t)}}function $a(e,t,n=!1){return new Os((r,o,s)=>xg(o,e(r,o,s),r,s),t,n)}function La(e,t){return new Os((n,r,o)=>e(n)?void 0:new K(void 0,n,o),t,!0)}function cf(e){return $a((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 uf=Vt(rf,[cf()]),Y0=new de(new Be([uf,Jx],"anyOf"),new ee(Ea(),J((e)=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function Rs(e,t){let n=e.source,r=new globalThis.RegExp(n,e.flags);return $a((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 _s(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}var Wx=new WeakMap;function lf(e){return Wx.get(e)??e}function se(e,t){if(e.encoding===t)return e;return _s(e,(n)=>{n.encoding.value=t})}function Cs(e,t){if(e.context===t)return e;let n=lf(e);if(n.context===t)return n;let r=_s(e,(o)=>{o.context.value=t});return Wx.set(r,n),r}function Ns(e){return e.encoding?Ns(e.encoding[e.encoding.length-1].to):e}function bt(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return ja(e,Gc(e.checks.slice(0,-1),n.annotate(t)))}return _s(e,(n)=>{n.annotations.value={...n.annotations.value,...t}})}function ja(e,t){if(e._tag==="Suspend"&&t)throw Error("Cannot add checks to Suspend");if(e.checks===t)return e;return _s(e,(n)=>{n.checks.value=t})}function Vt(e,t){return ja(e,sf(e.checks,t))}function lo(e,t){let n=t(e.to);return n===e.to?e:new de(n,e.transformation)}function Gx(e,t){let n=e,r=n[n.length-1],o=lo(r,t);return o===r?e:Gc(e.slice(0,e.length-1),o)}function ff(e){return(t)=>t.encoding?se(t,Gx(t.encoding,e)):t}function qa(e,t){return ff((n)=>Cs(n,t))(e)}function Ir(e,t){function n(r){if(r.encoding){let o=r.encoding[r.encoding.length-1];return t?.stopAt?.(o)?r:se(r,Gx(r.encoding,n))}return e(r)}return Wn(n)}function Zx(e,t){return df(e,t,Ce(e))}function Vx(e,t){return df(nt(e),t,e)}function df(e,t,n){let r=new de(e,t);return se(n,n.encoding?[...n.encoding,r]:[r])}function Yx(e,t){let n=mg(e),r=n?[...n,t]:[t];return bt(e,{brands:r})}function ao(e,t){let n=!1,r=Array(e.length);for(let o=0;o<e.length;o++){let s=e[o],i=t(s);if(i!==s)n=!0;r[o]=i}return n?r:e}function Ps(e,t){let n=e.context?new Dt(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new Dt(!1,!1,void 0,t);return Cs(e,n)}var fo=Wn((e)=>{let t=e.context?e.context.isOptional===!1?new Dt(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new Dt(!0,!1);return X0(Cs(e,t))}),X0=ff(fo),Xx=Fe((e)=>fo(new Be([e,Ql],"anyOf"))),pf=Wn((e)=>{let t=e.context?e.context.isMutable===!1?new Dt(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new Dt(!1,!0);return Q0(Cs(e,t))}),Q0=ff(pf);function Qx(e,t){let n=new ee(ws(t),Mt()),r=new de(xn,n),o=e.context?new Dt(e.context.isOptional,e.context.isMutable,r,e.context.annotations):new Dt(!1,!1,r);return Cs(e,o)}function Ba(e,t,n){return df(e,n,t)}function ev(e){let t=[],n=[];function r(o){switch(o._tag){case"Literal":if(ai(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 ey(e,t){let{literals:n,parameters:r}=ev(e);return new uo(n.map((o)=>new Na(o,t)),r.map((o)=>new Pa(o,t)))}function xe(e){return e.context?.isOptional??!1}function ty(e){return e.context?.isMutable??!1}function ny(e){return e.annotations?.[Qe]===!0||e._tag==="FilterGroup"&&e.checks.every(ny)}function tv(e){function t(r){if(ny(r))return[r];return r._tag==="FilterGroup"?r.checks.flatMap(t):[]}let n=e.flatMap(t);return Bo(n)?n:void 0}var Ce=Wn((e)=>{if(e.encoding)return Ce(se(e,void 0));let t=e,n=t.recur?.(Ce)??t,r=n.encodingChecks;if(r){let o=n===e?r:Yl(n)||H0(n)||qn(n)&&n.typeParameters.length>0?tv(r):void 0;return _s(n,(s)=>{s.encodingChecks.value=void 0,s.checks.value=sf(n.checks,o)})}return n}),nt=Wn((e)=>Ce(Ft(e)));function nv(e,t){let n=t,r=n.length,o=n[r-1],s=[new de(Ft(se(e,void 0)),n[0].transformation.flip())];for(let a=1;a<r;a++)s.unshift(new de(Ft(n[a-1].to),n[a].transformation.flip()));let i=Ft(o.to);if(i.encoding)return se(i,[...i.encoding,...s]);else return se(i,s)}var Ft=Fe((e)=>{if(e.encoding)return nv(e,e.encoding);let t=e;return t.flip?.(Ft)??t.recur?.(Ft)??t});function ry(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(ry);default:return!1}}function za(e,t){let n=St(t);return(r,o)=>{if(r===Q)return Pt;if(r===t)return n;return _(new le(e,r,o))}}function $t(e,t){return(n,r)=>{if(n===Q)return Pt;if(t(n))return Ee;return _(new le(e,n,r))}}function Ix(e,t,n){let{encodedParts:r,literals:o}=e,s=t.length;for(let u=0;u<o.length;u++){let l=o[u];if(l&&!t.includes(l))return}if(e.suffixLengths[0]>s)return;let i=Array(r.length),a;function c(u,l){if(u===r.length)return l===s;if(a?.has(u*(s+1)+l))return!1;let d=r[u];if(u===r.length-1){let f=t.slice(l);if(d.matchPart(f,n)!==void 0)return i[u]=f,!0}else if(d._tag==="Literal"){let f=o[u];if(t.startsWith(f,l)&&c(u+1,l+f.length))return i[u]=f,!0}else{let f=s-e.suffixLengths[u+1],h=o[u+1],x=h===void 0?f:t.lastIndexOf(h,f);while(x>=l){let w=t.slice(l,x);if(d.matchPart(w,n)!==void 0&&c(u+1,x))return i[u]=w,!0;if(x===0)break;x=h===void 0?x-1:t.lastIndexOf(h,x-1)}}return a??=new Set,a.add(u*(s+1)+l),!1}return c(0,0)?i:void 0}var oy=Fe((e)=>new Be(e.enums.map((t)=>new pt(t[1],{title:t[0]})),"anyOf")),mf=Ir((e)=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(mf)}}),Ha=Ir((e)=>{switch(e._tag){default:return e;case"Symbol":case"UniqueSymbol":return e.toCodecStringTree();case"Union":return e.recur(Ha)}}),sy=Ir((e)=>{switch(e._tag){default:return e;case"Number":case"Literal":case"BigInt":return e.toCodecStringTree();case"Union":return e.recur(sy)}}),iy="[\\s\\S]*?",Gl=new globalThis.RegExp(`^${Ca}$`),rv=new globalThis.RegExp(`^(?:${Ca}|Infinity|-Infinity|NaN)$`);function hf(e){return Rs(Gl,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:Gl.source}),...e})}var ay=Vt(Zt,[hf()]),ov=new de(ay,oo),sv=new de(new Be([ay,Jx],"anyOf"),oo),iv="-?\\d+",Zl=new globalThis.RegExp(`^${iv}$`);function gf(e){return Rs(Zl,{expected:"a string representing a bigint",representation:{id:"effect/schema/isStringBigInt",payload:null},toJsonSchema:()=>({pattern:Zl.source}),...e})}var xf=Vt(Zt,[gf({expected:"a string representing a bigint"})]),av=new de(xf,Ra),cv="Symbol\\((.*)\\)",Vl=new globalThis.RegExp(`^${cv}$`),uv=Vt(Zt,[yf()]),cy=new de(uv,new ee(J((e)=>globalThis.Symbol.for(Vl.exec(e)[1])),tt((e,t)=>{if(globalThis.Symbol.keyFor(e)!==void 0)return L(globalThis.String(e));return _(new no({message:"cannot serialize to string, Symbol is not registered"},e,t))})));function yf(e){return Rs(Vl,{expected:"a string representing a symbol",representation:{id:"effect/schema/isStringSymbol",payload:null},toJsonSchema:()=>({pattern:Vl.source}),...e})}function Lt(e,t,n,r,o){for(let s=0;s<e.length;s++){let i=e[s];if(i._tag==="FilterGroup"){if(n=Lt(i.checks,t,n,r,o),n&&(o.errors!=="all"||n[n.length-1].filter.aborted))return n}else{let a=i.run(t,r,o);if(a){let c=new El(i,a,t,o);if(n)n.push(c);else n=[c];if(o.errors!=="all"||i.aborted)return n}}}return n}function uy(e,t){let n=Lt(e,t,void 0,xn,{errors:"all"});if(n){let r=new ge(xn,n);return X(r)}return z(t)}function ly(e){if(!qn(e))return;let t=e.annotations?.[Sa];return Ke(t)?t(e.typeParameters):void 0}function lv(e){return e===null||typeof e==="string"||typeof e==="boolean"||typeof e==="number"&&globalThis.Number.isFinite(e)}function fv(e){return e===void 0||typeof e==="string"}function fy(e,t){let n=new WeakMap,r=[];e:while(!0){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 i=Array.isArray(o);if(!i){let a=Object.getPrototypeOf(o);if(a!==null&&a!==Object.prototype&&Object.getPrototypeOf(a)!==null)return!1}n.set(o,!1),r.push({value:o,keys:i?o.length:Object.keys(o),index:0})}}while(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 po(e){return fy(e,lv)}var co=new yr([],()=>(e,t,n)=>po(e)?Ee:_(new le(t,e,n)),{representation:{id:"effect/schema/Json",payload:null},expected:"JSON value",toCodecJson:()=>{return},toCodecStringTree:()=>If,toArbitrary:()=>(e)=>e.jsonValue()}),dy=bt(co,{representation:{id:"effect/schema/MutableJson",payload:null}}),Sf=new de(co,ro()),py=new de(new Be([new Ut(!1,[],[co]),new uo([],[new Pa(Zt,co)])],"anyOf"),ro());function dv(e){return fy(e,fv)}var pv=new yr([],()=>(e,t,n)=>dv(e)?Ee:_(new le(t,e,n)),{expected:"StringTree",toCodecStringTree:()=>{return}}),If=new de(pv,ro());function Ka(e){let t=vy(Wa,Ce(e.ast));return(n,r)=>t(n,r?.disableChecks?r?.parseOptions?{...r.parseOptions,disableChecks:!0}:{disableChecks:!0}:r?.parseOptions)}function Ja(e){let t=Ka(e);return(n,r)=>{let o=lr(t(n,r));if(Xe(o))return H(o.value);return hn(o.cause,"Option adapter can only return none for schema issues"),V()}}function hy(e){let t=Ka(e);return(n,r)=>{let o=lr(t(n,r));if(Xe(o))return o.value;let s=hn(o.cause,"Constructor adapter can only throw schema issues");throw Error("Schema validation failed",{cause:s})}}function gy(e){return Fs(e.ast)}function Fs(e){let t=br(Ds(Ce(e)));return(n)=>{let r=t(n,xr);if(Xe(r))return!0;return hn(r.cause,"Type guard adapter can only return false for schema issues"),!1}}function xy(e){let t=Ds(e);return(n,r)=>{let o=lr(t(n,r));if(Xe(o))return;return hn(o.cause,"Issue adapter can only return schema issues")}}function yy(e,t){let r=br(Ds(Ce(e.ast)))(t,xr);if(ih(r)){let o=hn(r.cause,"Assertion adapter can only throw schema issues");throw Error("Schema validation failed",{cause:o})}}function Se(e,t){let n=Ds(e.ast);return t===void 0?n:(r,o)=>n(r,Ms(t,o))}var bf=Se;function Sy(e,t){return br(Se(e,t))}function wf(e,t){return Oy(Se(e,t))}var Iy=wf;function by(e,t){return Ay(Se(e,t))}function mv(e,t){return ky(Se(e,t))}var Tf=mv;function mo(e,t){let n=Ds(Ft(e.ast));return t===void 0?n:(r,o)=>n(r,Ms(t,o))}function wy(e,t){return br(mo(e,t))}function Ef(e,t){return Oy(mo(e,t))}var Ty=Ef;function Ey(e,t){return Ay(mo(e,t))}function hv(e,t){return ky(mo(e,t))}var vf=hv,Ms=(e,t)=>t?{...e,...t}:e,my=(e)=>{if(e===Q)return _(new K);return L(e)};function Ds(e){return vy(Ry,e)}function vy(e,t){let n;return(r,o)=>{let s=(n??=e(t))(r,o??xr);if(s===Ee)return L(r);if(!ce(s))return ft(s,my);return s[F]===Q?my(Q):s}}function br(e){return(t,n)=>lr(e(t,n))}function Oy(e){let t=br(e);return(n,r)=>{let o=t(n,r);if(Xe(o))return H(o.value);return hn(o.cause,"Option adapter can only return none for schema issues"),V()}}function Ay(e){let t=br(e);return(n,r)=>{let o=t(n,r);if(Xe(o))return z(o.value);return X(hn(o.cause,"Result adapter can only return schema issues"))}}function ky(e){let t=br(e);return(n,r)=>{let o=t(n,r);if(Xe(o))return o.value;let s=hn(o.cause,"Sync adapter can only throw schema issues");throw Error("Schema validation failed",{cause:s})}}var Ry=Fe((e)=>Of(e,Ry)),Wa=Fe((e)=>Of(e,Wa,_y)),gv=Fe((e)=>Of(e,Wa,_y,e.context?.constructorDefault));function _y(e){return e.context?.constructorDefault?gv(e):Wa(e)}function Cy(e,t,n,r){let o;if(ce(e)&&e._tag==="Success"){let s=Ia(e===Ee?t:e[F]);o=n._tag==="Transformation"?n.decode.run(s,r):n.decode(St(s),r)}else if(n._tag==="Transformation")o=ft(e,(s)=>n.decode.run(Ia(s),r));else o=n.decode(Yr(e,Ia),r);return ce(o)&&o._tag==="Success"?Il(o[F]):ft(o,Il)}function xv(e,t){let n;return(r,o)=>{if(r===Q)return Pt;if(e.isConstructed(r))return Ee;let s=(n??=t(e.link.to))(r,o);return Cy(s,r,e.link.transformation,o)}}function Of(e,t,n,r){let o=n?ly(e):void 0,s=o?xv(o,t):e.getParser(t,n),i=e.checks,a=r?e.encoding?[...e.encoding,r]:[r]:e.encoding,c=e.encodingChecks,u=(i?i[i.length-1].annotations:e.annotations)?.parseOptions;if(!a&&!i&&!c){if(!u)return s;return(f,h)=>s(f,Ms(h,u))}let l,d=(f,h)=>{let x=s(f,h);if(c&&!h.disableChecks)if(ce(x)){if(x._tag==="Success"){let w=x===Ee?f:x[F];if(f!==Q&&w!==Q){let p=Lt(c,f,void 0,e,h);if(p)x=_(new ge(e,p,f,h))}}}else x=Jt(x,(w)=>{if(f!==Q&&w!==Q){let p=Lt(c,f,void 0,e,h);if(p)return _(new ge(e,p,f,h))}return L(w)});if(i&&!h.disableChecks)if(ce(x)){if(x._tag==="Success"){let w=x===Ee?f:x[F];if(w===Q)return x;let p=Lt(i,w,void 0,e,h);if(p)x=_(new ge(e,p,w,h))}}else x=Jt(x,(w)=>{if(w!==Q){let p=Lt(i,w,void 0,e,h);if(p)return _(new ge(e,p,w,h))}return L(w)});return x};if(!a)return u?(f,h)=>d(f,Ms(h,u)):d;return(f,h)=>{if(u)h=Ms(h,u);let x=l??=a.map((S)=>t(S.to)),w=f,p=x[x.length-1](f,h);for(let S=a.length-1;S>=0;S--)if(p=Cy(p,w,a[S].transformation,h),S!==0){let E=x[S-1];if(p._tag==="Success")w=p[F],p=E(w,h);else p=ft(p,(g)=>{let b=E(g,h);return b===Ee?St(g):b})}if(p._tag==="Success"){let S=p[F],E=d(S,h);return E===Ee?p:E}return p=ur(p,(S)=>rs(()=>Fn(S,(E)=>new vl(e,E,f,h)))),ft(p,(S)=>{let E=d(S,h);return E===Ee?St(S):E})}}var Ga="~effect/Schema/Schema";function ze(e,t,n){return{id:e,payloadSchema:t,revive:n}}function B(e,t,n){return{id:e,payloadSchema:t,revive:n}}var yv={[Ga]:Ga,pipe(){return re(this,arguments)},annotate(e){return this.rebuild(bt(this.ast,e))},annotateKey(e){return this.rebuild(Ps(this.ast,e))},check(...e){return this.rebuild(Vt(this.ast,e))}};function Us(e,t){function n(){}let r=Object.defineProperties(Object.setPrototypeOf(n,yv),Object.getOwnPropertyDescriptors({...t}));return r.ast=e,r.rebuild=(o)=>Us(o,t),r.makeEffect=Ka(r),r.make=hy(r),r.makeOption=Ja(r),r}var M2=globalThis.Boolean;var Ny=Qt((e,t)=>e||t,!1);var Py=T(2,(e,t)=>Rf(e,(n,r)=>t.includes(n)?[n,r]:void 0)),My=T(2,(e,t)=>Rf(e,(n,r)=>!t.includes(n)?[n,r]:void 0)),Fy=T(2,(e,t)=>({...e,...t}));var kf=T(2,(e,t)=>Rf(e,(n,r)=>[Object.hasOwn(t,n)?t[n]:n,r]));var $e=(e)=>e;function Rf(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,i]=o;A(n,s,i)}}return n}function Dy(e,t){let n=t?.omitKeyWhen??(()=>!1);return Jd((r,o)=>{let s=Reflect.ownKeys(e),i={};for(let a of s){let c=e[a].combine(r[a],o[a]);if(n(c))continue;A(i,a,c)}return i})}function $s(e){return Qt((t,n)=>{if(t===void 0)return n;if(n===void 0)return t;return e.combine(t,n)},void 0)}function Yt(e,t){if(t.length>0)e+=`
|
|
25
|
-
at ${pi(t)}`;return Error(e)}var Uy=new WeakMap,$y=new WeakMap,Ly=[];function yn(e){return Error(`Unable to derive an arbitrary for ${e}`)}var jy=([e],[t])=>N(e,t);function wv(e,t,n){return t.reduce((r,o)=>r.filter((s)=>o.run(s,e,xr)===void 0),n)}function Vy(e,t){if(e?.minLength!==void 0&&e.maxLength!==void 0&&e.minLength>e.maxLength)throw yn(`${t} constraints`)}function Yy(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 Cf(e,t,n,r){return r?e.uniqueArray(t,{...n,comparator:r}):e.array(t,n)}function qy(e,t,n,r=!1){let o=t.constraint,s=Yy(o);return Vy(s,"array"),Cf(e,n,r?{...s,maxLength:s?.minLength??0}:s,o?.unique?N:void 0)}function Za(e,t,n,r){return t.chain((o)=>o.length<n?e.constant(o):r.map((s)=>[...o,...s]))}function By(e,t){return e.chain((n)=>t.map((r)=>({...Object.fromEntries(r),...n})))}var Tv=$s(Eh),Ev=$s(vh),Va=$s(Ny),vv=$s(ep()),Ov=Dy({integer:Va,maxLength:Ev,minLength:Tv,noInfinity:Va,noNaN:Va,patterns:vv,unique:Va},{omitKeyWhen:Od});function zy(e,t,n,r,o,s){if(r===void 0||t===void 0)return r===void 0?[t,n]:[r,o];let i=e(t,r);return i===s?[r,o]:i===0?[t,n||o]:[t,n]}function Av(e,t){if(e===void 0)return t;if(e.order!==t.order)throw Error("Cannot merge ordered arbitrary constraints with different Order instances");let[n,r]=zy(e.order,e.minimum,e.exclusiveMinimum,t.minimum,t.exclusiveMinimum,-1),[o,s]=zy(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 kv(e,t){let{ordered:n,...r}=e??{},{ordered:o,...s}=t,i=o===void 0?n:Av(n,o);return{...Ov.combine(r,s),...i===void 0?{}:{ordered:i}}}function Hy(e){let t=[],n=[];function r(o){if(o.annotations?.arbitrary)n.push(o.annotations.arbitrary);if(o._tag!=="Filter")for(let s of o.checks)r(s);else t.push(o)}return e?.forEach(r),{filters:t,arbitraries:n}}function Rv(e){let t=e.map(({constraint:n})=>n).filter(en);return(n)=>{let r=t.reduce((o,s)=>kv(o,s),n.constraint);return{...n,constraint:r}}}function Ls(e){return{...e,constraint:void 0}}function Ky(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 yn("object property constraints");let r={};if(t.minLength!==void 0)r.minLength=Math.max(0,t.minLength-n);if(t.maxLength!==void 0){if(r.maxLength=t.maxLength-n,r.maxLength<0)throw yn("object property constraints")}return Vy(r,"object property"),r}function _v(e,t,n,r,o,s){let i=r.length;if(s.maxLength!==void 0&&s.maxLength<i)throw yn("object property constraints");let a=s.minLength===void 0?0:Math.max(0,s.minLength-i),c=s.maxLength===void 0?o.length:Math.min(o.length,s.maxLength-i);if(a>c)throw yn("object property constraints");let u=e.record(t,{requiredKeys:[...r,...o]}),l=e.shuffledSubarray([...o],{minLength:a,maxLength:c});return e.tuple(u,l).map(([d,f])=>{let h=new Set([...r,...f]),x={};for(let w of n)if(h.has(w))A(x,w,d[w]);return x})}function Xy(e,t,n,r){let o={};if(e?.minimum!==void 0)o.min=t(e.minimum,e.exclusiveMinimum===!0);if(e?.maximum!==void 0)o.max=n(e.maximum,e.exclusiveMaximum===!0);if(o.min!==void 0&&o.max!==void 0&&o.min>o.max)throw yn(r);return o}function Cv(e){return Xy(e,(t,n)=>n?Math.floor(t)+1:Math.ceil(t),(t,n)=>n?Math.ceil(t)-1:Math.floor(t),"integer constraints")}function Nv(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 yn("number constraints");return n}function Pv(e){return Xy(e,(t,n)=>n?t+BigInt(1):t,(t,n)=>n?t-BigInt(1):t,"the ordered bigint constraints")}function ho(e,t){let n=(r,o,s=Ly)=>e(r,o,s);return n.terminal=(r,o,s=Ly)=>t(r,o,s),n}function wt(e){return ho(e,e)}function Jy(e,t){let n=$y.get(t)??e.createDepthIdentifier();return $y.set(t,n),{maxDepth:2,depthIdentifier:n}}function Wy(e,t){return t.length===0?void 0:t.length===1?t[0]:e.oneof(...t)}var Mv={noInfinity:!0,noNaN:!0};function Fv(e){return{...e,constraint:Mv}}function Dv(e,t,n,r){let o=r===void 0?[]:[{arbitrary:r,weight:1}];for(let{candidate:s}of n){if(!s)continue;let i=s.make(e,t);if(i===void 0)continue;let a=s.weight??1;if(!globalThis.Number.isInteger(a)||a<=0)throw yn("a candidate with an invalid weight");o.push({arbitrary:i,weight:a})}return o.length===0?void 0:o.length===1?o[0].arbitrary:e.oneof(...o)}function Gy(e,t,n,r,o){let s=Dv(n,r,t.arbitraries,o);return s===void 0?void 0:wv(e,t.filters,s)}function Uv(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 $v(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 Zy(e,t,n,r){let o=Rv(t.arbitraries);return ho((s,i,a)=>{let c=o(i);return Gy(e,t,s,c,n(s,i,c,a))},(s,i,a)=>{let c=o(i);return Gy(e,t,s,c,r(s,i,c,a))})}var Qy=Fe((e)=>Tt(e,[]));function Tt(e,t){let n=Gt(e)?.toArbitrary;if(n){let r=qn(e)?e.typeParameters.map((i)=>Tt(i,t)):[],o=Hy(e.checks),s=(i)=>(a,c,u,l)=>Uv(n($v(r,a,Ls(c),l,i))(a,u),r.length>0)[i?"terminal":"arbitrary"];return Zy(e,o,s(!1),s(!0))}if(e.checks){let r=Hy(e.checks),o=Tt(ja(e,void 0),t);return Zy(e,r,(s,i,a,c)=>o(s,a,c),(s,i,a,c)=>o.terminal(s,a,c))}return Lv(e,t)}function Lv(e,t){switch(e._tag){case"Never":case"Declaration":throw Yt(`Unsupported AST ${e._tag}`,t);case"Null":return wt((n)=>n.constant(null));case"Void":case"Undefined":return wt((n)=>n.constant(void 0));case"Unknown":case"Any":return wt((n)=>n.anything());case"String":return wt((n,r)=>{let o=r.constraint,s=o?.patterns;return s?n.oneof(...s.map((i)=>n.stringMatching(new RegExp(i)))):n.string(Yy(o))});case"Number":return wt((n,r)=>{let o=r.constraint,s=o?.ordered?.order===_t?o.ordered:void 0;return o?.integer?n.integer(Cv(s)):n.float(Nv(o,s))});case"Boolean":return wt((n)=>n.boolean());case"BigInt":return wt((n,r)=>{let o=r.constraint?.ordered?.order===xt?r.constraint.ordered:void 0;return n.bigInt(Pv(o))});case"Symbol":return wt((n)=>n.string().map(Symbol.for));case"Literal":return wt((n)=>n.constant(e.literal));case"UniqueSymbol":return wt((n)=>n.constant(e.symbol));case"ObjectKeyword":return wt((n)=>n.oneof(n.object(),n.array(n.anything())));case"Enum":return Tt(oy(e),t);case"TemplateLiteral":{let n=e.parts.map((r,o)=>Tt(nt(r),[...t,o]));return wt((r,o,s)=>r.tuple(...n.map((i)=>i(r,Fv(o),s))).map((i)=>i.map((a)=>globalThis.String(a)).join("")))}case"Arrays":{let n=e.elements.map((i,a)=>({ast:i,arbitrary:Tt(i,[...t,a])})),r=e.elements.length,o=e.rest.map((i,a)=>({ast:i,arbitrary:Tt(i,[...t,r+a])})),s=(i,a,c)=>{let u=Ls(a),l=[],d=[],f=0;for(let E of n){let g=E.arbitrary.terminal(i,u,c);if(xe(E.ast)){d.push(g);continue}if(g===void 0)return;f++,l.push(g.map(H))}let h=a.constraint?.minLength??0,w=Rn(o)&&h>f+d.length?d.length:Math.max(0,h-f),p=0;for(let E of d){if(p>=w||E===void 0){l.push(i.constant(V()));continue}p++,f++,l.push(E.map(H))}if(p<w)return;let S=i.tuple(...l).map(Vc);if(Rn(o)){let[E,...g]=o,b=e.elements.length===0?a:u,m=Math.max(0,h-f-g.length),y=m===0?void 0:E.arbitrary.terminal(i,u,c);if(m>0&&y===void 0)return;let I=m===0?i.constant([]):qy(i,{...b,constraint:{...b.constraint,minLength:m}},y,!0);if(S=Za(i,S,r,I),g.length>0){let v=[];for(let M of g){let R=M.arbitrary.terminal(i,u,c);if(R===void 0)return;v.push(R)}let U=i.tuple(...v);S=Za(i,S,r,U)}}return S};return ho((i,a,c)=>{let u=Ls(a),l=n.map(({ast:f,arbitrary:h})=>{let x=h(i,u,c);return xe(f)?x.chain((w)=>i.boolean().map((p)=>p?H(w):V())):x.map(H)}),d=i.tuple(...l).map((f)=>Vc(Qd(f,Ve)));if(Rn(o)){let[f,...h]=o.map(({arbitrary:w})=>w(i,u,c)),x=qy(i,e.elements.length===0?a:u,f);if(d=Za(i,d,r,x),h.length>0){let w=i.tuple(...h);d=Za(i,d,r,w)}}if(a.recursion){let f=s(i,a,c);if(f!==void 0)return i.oneof(a.recursion,f,d)}return d},s)}case"Objects":{let n=e.propertySignatures.map((s)=>({ps:s,arbitrary:Tt(s.type,[...t,s.name])})),r=e.indexSignatures.map((s)=>({is:s,parameter:Tt(s.parameter,t),type:Tt(s.type,t)}));return ho((s,i,a)=>{let c=Ls(i),u={},l=[],d=[],f=[];for(let{ps:p,arbitrary:S}of n){let E=p.name;if(l.push(E),xe(p.type))f.push(E);else d.push(E);A(u,E,S(s,c,a))}let h=i.constraint;if(f.length>0&&r.length===0&&h!==void 0&&(h.minLength!==void 0||h.maxLength!==void 0))return _v(s,u,l,d,f,h);let x=s.record(u,{requiredKeys:d}),w=Ky(e,i.constraint,d.length);for(let{parameter:p,type:S}of r){let E=s.tuple(p(s,c,a),S(s,c,a)),g=Cf(s,E,w,jy);x=By(x,g)}return x},(s,i,a)=>{let c=Ls(i),u={},l=[],d=[];for(let{ps:p,arbitrary:S}of n){let E=p.name,g=S.terminal(s,c,a);if(xe(p.type)){if(g!==void 0)d.push([E,g]);continue}if(g===void 0)return;l.push(E),A(u,E,g)}let f=Math.max(0,(i.constraint?.minLength??0)-l.length);for(let[p,S]of d){if(f===0)break;f--,l.push(p),A(u,p,S)}if(f>0&&e.indexSignatures.length===0)return;let h=s.record(u,{requiredKeys:l}),x=Ky(e,i.constraint,l.length),w=x?.minLength??0;for(let{parameter:p,type:S}of r){let E;if(w===0)E=s.constant([]);else{let g=p.terminal(s,c,a),b=S.terminal(s,c,a);if(g===void 0||b===void 0)return;E=Cf(s,s.tuple(g,b),{...x,maxLength:w},jy)}h=By(h,E)}return h})}case"Union":{let n=e.types.map((o)=>Tt(o,t)),r=(o,s,i)=>Wy(o,n.map((a)=>a.terminal(o,s,i)).filter(en));return ho((o,s,i)=>{let a=n.map((u)=>u(o,s,i));if(s.recursion){let u=r(o,s,i);if(u!==void 0)return o.oneof(s.recursion,u,...a)}let c=Wy(o,a);if(c===void 0)throw yn("a union with no members");return c},r)}case"Suspend":{let n=Uy.get(e);if(n)return n;let r=Sr(()=>Tt(e.thunk(),t)),o=ho((s,i,a)=>{let c=Jy(s,e),u={...i,recursion:c},l=a.includes(e)?a:[...a,e],d=r().terminal(s,u,l);if(d===void 0)throw Yt("Unable to derive an arbitrary for a recursive schema without a finite generation path",t);return s.oneof(c,d,s.constant(null).chain(()=>r()(s,u,l)))},(s,i,a)=>{if(a.includes(e))return;let c=Jy(s,e);return r().terminal(s,{...i,recursion:c},[...a,e])});return Uy.set(e,o),o}}}var eS=Fe((e)=>zn(e,[]));function zn(e,t){let n=Gt(e)?.toEquivalence;if(n)return n(qn(e)?e.typeParameters.map((r)=>zn(r,t)):[]);switch(e._tag){case"Never":return Sd();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 N;case"Arrays":{let r=e.elements.map((i,a)=>zn(i,[...t,a])),o=e.elements.length,s=e.rest.map((i,a)=>zn(i,[...t,o+a]));return Re((i,a)=>{if(!Array.isArray(i)||!Array.isArray(a))return!1;let c=i.length;if(c!==a.length)return!1;let u=0;for(;u<Math.min(c,e.elements.length);u++)if(!r[u](i[u],a[u]))return!1;if(s.length>0){let[l,...d]=s;for(;u<c-d.length;u++)if(!l(i[u],a[u]))return!1;for(let f=0;f<d.length;f++)if(!d[f](i[u+f],a[u+f]))return!1}return!0})}case"Objects":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return N;let r=e.propertySignatures.map((s)=>zn(s.type,[...t,s.name])),o=e.indexSignatures.map((s)=>zn(s.type,t));return Re((s,i)=>{if(!De(s)||!De(i))return!1;for(let a=0;a<r.length;a++){let c=e.propertySignatures[a],u=c.name,l=Object.hasOwn(s,u),d=Object.hasOwn(i,u);if(xe(c.type)){if(l!==d)return!1}if(l&&d&&!r[a](s[u],i[u]))return!1}for(let a=0;a<o.length;a++){let c=e.indexSignatures[a],u=gr(s,c.parameter),l=gr(i,c.parameter);if(u.length!==l.length)return!1;for(let d=0;d<u.length;d++){let f=u[d];if(!Object.hasOwn(i,f)||!o[a](s[f],i[f]))return!1}}return!0})}case"Union":{let r=Ce(e).types,o=new Map(r.map((s,i)=>[s,[Fs(s),zn(e.types[i],t)]]));return Re((s,i)=>{let a=ks(s,r);for(let c=0;c<a.length;c++){let[u,l]=o.get(a[c]);if(u(s)&&u(i))return l(s,i)}return!1})}case"Suspend":{let r=Sr(()=>zn(e.thunk(),t));return Re((o,s)=>r()(o,s))}}}function wr(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function go(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}var Bv="http://json-schema.org/draft-07/schema#",tS="https://json-schema.org/draft/2020-12/schema";function nS(e,t){return e===t||e===(t.endsWith("#")?t.slice(0,-1):`${t}#`)}function sS(e){return{dialect:"draft-07",...Zv(e,sO)}}function zv(e,t){return n(e,!1,!0);function n(r,o,s=!1){if(!De(r))return r;let i=o||!s&&cS(r.$id),a={};for(let c of Object.keys(r)){let u=r[c],l=u;switch(c){case"$defs":case"properties":case"patternProperties":case"dependentSchemas":l=Pf(u,(d)=>n(d,i))??u;break;case"allOf":case"anyOf":case"oneOf":case"prefixItems":l=Array.isArray(u)?u.map((d)=>n(d,i)):u;break;case"not":case"additionalProperties":case"propertyNames":case"unevaluatedProperties":case"items":case"contains":case"unevaluatedItems":case"if":case"then":case"else":case"contentSchema":l=n(u,i)}A(a,c,l)}return t(a,i),a}}function iS(e,t){return zv(e,(n)=>{Hv(n,t)})}function Hv(e,t){if(typeof e.$ref==="string")A(e,"$ref",t(e.$ref,"$ref"));if(typeof e.$dynamicRef==="string")A(e,"$dynamicRef",t(e.$dynamicRef,"$dynamicRef"))}function Pf(e,t){if(!De(e))return;let n={};for(let r of Object.keys(e))A(n,r,t(e[r],r));return n}function Kv(e,t,n){let r=new Map,o=[],s=Nf;function i(f,h=[],x=[]){if(h.length===0&&t?.trackIds){let w=De(f)?l(f):void 0;s=rS(w,Nf)??Nf}return u(f,h,x,{sourceRoot:[],targetRoot:[],uri:s})}function a(){for(let[f,h,x]of o){let w=h,p=aS(h,x);if(p!==void 0){let S=Jv(p.hash);if(p.hash="",S!==void 0){let E=r.get(oS(p.href,S));if(E!==void 0)w=Wv(h,E)}}A(f,"$ref",w)}}let c=n(i);return a(),c;function u(f,h,x,w){if(typeof f==="boolean")return d(h,x,w),t?.booleanAdapter?.(f)??f;if(!De(f))return f;let p=w,S=l(f);if(h.length>0&&t?.trackIds&&cS(S)){let b=rS(S,w.uri);if(b!==void 0)p={parent:w,sourceRoot:h,targetRoot:x,uri:b}}d(h,x,p);let E=p.uri,g={isDocumentRoot:h.length===0,schema(b,m,y=m){return u(b,[...h,m],[...x,y],p)},schemaAt(b,m,y){return u(b,[...h,...m],[...x,...y],p)},schemaArray(b,m,y=m){return Array.isArray(b)?b.map((I,v)=>u(I,[...h,m,String(v)],[...x,y,String(v)],p)):b},schemaMap(b,m,y=m){if(!De(b))return b;return Pf(b,(I,v)=>u(I,[...h,m,v],[...x,y,v],p))},reference(b,m){if(typeof m==="string")o.push([b,m,E]);else A(b,"$ref",m)}};return e(f,g)}function l(f){return t?.ignoreRefSiblings===!0&&typeof f.$ref==="string"?void 0:f.$id}function d(f,h,x){if(x.parent!==void 0)d(f,h,x.parent);r.set(oS(x.uri,f.slice(x.sourceRoot.length)),h.slice(x.targetRoot.length))}}var Nf="https://effect.invalid/.json-schema/";function aS(e,t){return URL.canParse(e,t)?new URL(e,t):void 0}function rS(e,t){if(typeof e!=="string")return;let n=aS(e,t);if(n===void 0)return;return n.hash="",n.href}function Jv(e){if(e.length===0)return[];let t;try{t=decodeURIComponent(e.slice(1))}catch{return}if(!t.startsWith("/"))return;return/~(?:[^01]|$)/.test(t)?void 0:t.slice(1).split("/").map(go)}function Wv(e,t){let n=e.indexOf("#");if(n===-1&&t.length===0)return e;return`${n===-1?e:e.slice(0,n)}${Gv(t)}`}function Gv(e){return e.length===0?"#":`#/${e.map((t)=>encodeURI(wr(t)).replace(/#/g,"%23")).join("/")}`}function oS(e,t){return`${e}\x00${JSON.stringify(t)}`}function cS(e){return typeof e==="string"&&e.length>0&&e[0]!=="#"}function Zv(e,t,n){return Kv(t,{...n,trackIds:!0},(r)=>({schema:r(e.schema),definitions:Pf(e.definitions,(o,s)=>r(o,["$defs",s],["definitions",s]))}))}var Vv=new Set(["properties","patternProperties"]),Yv=new Set(["allOf","anyOf","oneOf"]),Xv=new Set(["not","additionalProperties","propertyNames","contains","if","then","else","contentSchema"]);function Qv(e,t,n,r,o,s=Vv){let i;if(s.has(t))i=r.schemaMap(n,t);else if(Yv.has(t))i=r.schemaArray(n,t);else if(o.has(t))i=r.schema(n,t);else return!1;return A(e,t,i),!0}var uS=["$anchor","$defs","$dynamicAnchor","$dynamicRef","$vocabulary","contentSchema","dependentRequired","dependentSchemas","maxContains","minContains","prefixItems","unevaluatedItems","unevaluatedProperties"],z2=[...uS,"deprecated"],H2=[...uS,"$comment","$id","$schema","const","contains","contentEncoding","contentMediaType","else","examples","if","patternProperties","propertyNames","then"],eO=/^[A-Za-z_][-A-Za-z0-9._]*$/,tO=/^[A-Za-z][-A-Za-z0-9._:]*$/;function Tr(e,t,n){throw Error(`Cannot convert JSON Schema keyword "${e}" to ${t}: ${n}`)}function nO(e,t,n,r){for(let o of t)if(Object.hasOwn(e,o))Tr(o,n,`it is not active in ${r} but would become active in the target`)}var rO=["additionalItems","definitions","dependencies"];function oO(e,t,n,r,o){if(n.isDocumentRoot)A(e,"$schema",nS(t,tS)?r:t);else if(!nS(t,tS))Tr("$schema",o,"an embedded resource cannot declare a different dialect")}function sO(e,t){nO(e,rO,"Draft-07","Draft 2020-12");let n={},r=void 0,o=void 0,s=void 0;for(let i of Object.keys(e)){let a=e[i];if(Qv(n,i,a,t,Xv))continue;switch(i){case"$ref":r=a;break;case"$schema":oO(n,a,t,Bv,"Draft-07");break;case"$id":case"$anchor":break;case"$defs":A(n,"definitions",t.schemaMap(a,i,"definitions"));break;case"prefixItems":o=a;break;case"items":s=a;break;case"dependentRequired":case"dependentSchemas":case"minContains":case"maxContains":break;case"$dynamicRef":case"$dynamicAnchor":case"$vocabulary":case"unevaluatedProperties":case"unevaluatedItems":Tr(i,"Draft-07","the target dialect has no equivalent");case"required":if(Array.isArray(a)&&a.length===0)break;A(n,i,a);break;default:A(n,i,a)}}if(iO(n,o,s,t),Object.hasOwn(e,"contains")){let{minContains:i,maxContains:a}=e;if(i!==void 0&&i!==1||a!==void 0)Tr("minContains/maxContains","Draft-07","contains cardinality cannot be represented");if(Object.hasOwn(e,"minContains"))A(n,"minContains",i)}else{if(Object.hasOwn(e,"minContains"))A(n,"minContains",e.minContains);if(Object.hasOwn(e,"maxContains"))A(n,"maxContains",e.maxContains)}return cO(e,n,t,"draft-07"),lO(e,n,"$id","Draft-07"),aO(n,r,t),n}function iO(e,t,n,r){if(t===void 0){if(n!==void 0)A(e,"items",r.schema(n,"items"));return}if(A(e,"items",r.schemaArray(t,"prefixItems","items")),n!==void 0)A(e,"additionalItems",r.schema(n,"items","additionalItems"))}function aO(e,t,n){if(t===void 0)return;if(typeof t==="string"&&Object.keys(e).length>0){let r={};n.reference(r,t),uO(e,r)}else n.reference(e,t)}function cO(e,t,n,r){let o=De(e.dependentRequired)?e.dependentRequired:void 0,s=De(e.dependentSchemas)?e.dependentSchemas:void 0;if(o===void 0&&s===void 0)return;let i={},a=new Set([...Object.keys(o??{}),...Object.keys(s??{})]);for(let c of a){let u=o?.[c],l=s?.[c],d=r==="draft-04"&&Array.isArray(u)&&u.length===0;if(l===void 0){if(!d)A(i,c,u)}else if(u===void 0||d)A(i,c,n.schemaAt(l,["dependentSchemas",c],["dependencies",c]));else A(i,c,{allOf:[n.schemaAt(l,["dependentSchemas",c],["dependencies",c,"allOf","0"]),{required:u}]})}if(Object.keys(i).length>0)A(t,"dependencies",i)}function uO(e,t){if(Array.isArray(e.allOf))e.allOf.push(t);else A(e,"allOf",[t])}function lO(e,t,n,r){let{$id:o,$anchor:s}=e;if(s===void 0){if(o!==void 0)A(t,n,o);return}if(typeof s!=="string"||!eO.test(s))Tr("$anchor",r,"the anchor is not valid");if(!tO.test(s))Tr("$anchor",r,"the anchor cannot be represented as a plain-name fragment identifier");if(o===void 0)A(t,n,`#${s}`);else Tr("$anchor",r,"it cannot be combined with the schema $id")}var K2=globalThis.RegExp;var xo=(e)=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&");var dO=new Set([...hg,fr,...pg]);function js(e,t){if(e===void 0)return;let n={},r=e.title;if(typeof r==="string")n.title=r;let{description:o,expected:s}=e;if(typeof o==="string")n.description=o;else if(t?.generateDescriptions===!0&&typeof s==="string")n.description=s;let i=e.default;if(po(i))n.default=i;let a=e.examples;if(Array.isArray(a)&&po(a))n.examples=a;let c=e.readOnly;if(typeof c==="boolean")n.readOnly=c;let u=e.writeOnly;if(typeof u==="boolean")n.writeOnly=u;let l=e.format;if(typeof l==="string")n.format=l;let d=e.contentEncoding;if(typeof d==="string")n.contentEncoding=d;let f=e.contentMediaType;if(typeof f==="string")n.contentMediaType=f;let h=e.contentSchema;if(po(h))n.contentSchema=h;if(t?.includeAnnotationKey!==void 0)for(let[x,w]of Object.entries(e)){if(dO.has(x)||!t.includeAnnotationKey(x))continue;if(po(w))A(n,x,w)}return Object.keys(n).length===0?void 0:n}function dS(e){let t=e.type==="number"||e.type==="integer"?e.type:void 0,n=e;if(t!==void 0)n={...e},delete n.type;if(Array.isArray(n.allOf)){let r=[],o=!1;for(let s of n.allOf){let i=dS(s);if(i.type!==void 0){if(o=!0,t===void 0||i.type==="integer")t=i.type}if(Object.keys(i.schema).length>0)r.push(i.schema)}if(o){let{allOf:s,...i}=n;n=r.length===0?i:{...i,allOf:r}}}return{type:t,schema:n}}function pO(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 pS="|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|";function Mf(e,t){return Object.keys(e).every((n)=>t.includes(`|${n}|`))}function fS(e,t){return typeof e.$ref!=="string"&&t.every((n)=>!Object.hasOwn(e,n))}var Ff="|title|description|default|examples|readOnly|writeOnly|",mO=pS+Ff;function qs(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=pO(e);if(o!==void 0||s){let a=dS(t);if(a.type!==void 0){let c=o==="integer"||a.type==="integer"?"integer":"number",u={...e,type:c};if(s)delete u.anyOf;let l=Object.keys(a.schema);if(l.length===0)return u;return Mf(a.schema,Ff)&&fS(u,l)?{...u,...a.schema}:qs(u,a.schema,n)}}if(n&&fS(e,r))return{...e,...t};let i=Array.isArray(t.allOf)&&r.length===1?t.allOf:[t];if(Array.isArray(e.allOf))return{...e,allOf:[...e.allOf,...i]};if(typeof e.$ref==="string")return{allOf:[e,...i]};return{...e,allOf:i}}function hO(e,t,n,r){let o=new Map,s=new WeakMap,i=new Map,a=!1,c=Object.keys(n);for(let g of c)d(g,["references",g]);let u=_n(e,(g,b)=>f(p(g,t[b]))),l={};for(let g of c){let b=o.get(g);if(typeof b!=="string")A(l,g,f(b))}return{dialect:"draft-2020-12",schemas:u,definitions:l};function d(g,b){let m=o.get(g);if(m!==void 0)return typeof m==="string"?m:g;if(!Object.hasOwn(n,g))throw Yt(`Invalid reference ${g}`,[...b,"$ref"]);o.set(g,null);let y=n[g],I=p(y,["references",g]),v=h(y);if(v!==void 0){let U=i.get(v),M=U?.find((R)=>N(o.get(R),I));if(M===void 0)if(U===void 0)i.set(v,[g]);else U.push(g);else return a=!0,o.set(g,M),M}return o.set(g,I),g}function f(g){if(!a)return g;return iS(g,(b)=>b.replace(/^#\/\$defs\/([^/]*)/,(m,y)=>{let I=o.get(go(y));return typeof I==="string"?`#/$defs/${wr(I)}`:m}))}function h(g){if(g._tag==="Reference")return;let b=g.checks.length===0?g.annotations:g.checks[g.checks.length-1].annotations;return typeof b?.identifier!=="string"&&typeof b?.[fr]==="string"?b[fr]:void 0}function x(g,b){return g?.schemas?.map((m,y)=>p(m,[...b,"schemas",y]))??[]}function w(g,b,m){let y=g.annotations,I=y?.toJsonSchema;if(I!==void 0){let R=x(g.representation,[...m,"representation"]),Y=I({type:b,schemas:R}),W=js(y,r),Pe=W===void 0?Y:{...Y,...W},Me=W===void 0?pS:mO;return g._tag==="Filter"&&Mf(Pe,Me)&&(W===void 0||Mf(W,Ff))?[Pe,!0]:[Pe]}if(g._tag==="Filter")return;let v=g.checks.map((R,Y)=>w(R,b,[...m,"checks",Y])).filter((R)=>R!==void 0);if(v.length===0)return;let U=js(y,r),M=v.map(([R])=>R);return[U===void 0?{allOf:M}:{allOf:M,...U}]}function p(g,b){if(g._tag==="Reference"){let v=d(g.$ref,b);return{$ref:`#/$defs/${wr(v)}`}}let m=s.get(g);if(m!==void 0)return m;let y=S(g,b),I=js(g.annotations,r);if(I!==void 0)y={...y,...I};for(let v=0;v<g.checks.length;v++){let U=typeof y.type==="string"&&gO(y.type)?y.type:void 0,M=w(g.checks[v],U,[...b,"checks",v]);if(M!==void 0)y=qs(y,...M)}return s.set(g,y),y}function S(g,b){switch(g._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 p(g.thunk,[...b,"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 m=g.literal;return typeof m==="bigint"?{type:"string",enum:[globalThis.String(m)]}:{type:typeof m,enum:[m]}}case"Enum":{let m=g.enums.map(([y,I])=>typeof I==="number"&&!globalThis.Number.isFinite(I)?{type:"string",enum:[globalThis.String(I)],title:y}:{type:typeof I,enum:[I],title:y});return m.length===0?{not:{}}:{anyOf:m}}case"TemplateLiteral":return{type:"string",pattern:`^${g.parts.map(Ya).join("")}$`};case"Arrays":{if(g.rest.length>1)throw Yt("Invalid schema representation document",[...b,"rest"]);let m={type:"array"},y=g.elements.length,I=g.elements.map((v,U)=>{if(v.isOptional)y--;let M=p(v.type,[...b,"elements",U,"type"]),R=js(v.annotations,r);return R===void 0?M:qs(M,R)});if(I.length>0){if(m.prefixItems=I,m.maxItems=g.elements.length,y>0)m.minItems=y}else m.items=!1;if(g.rest.length===1){delete m.maxItems;let v=p(g.rest[0],[...b,"rest",0]);if(Object.keys(v).length>0)m.items=v;else delete m.items}return m}case"Objects":{if(g.propertySignatures.length===0&&g.indexSignatures.length===0)return{anyOf:[{type:"object"},{type:"array"}]};let m={type:"object"},y={},I=[];for(let R=0;R<g.propertySignatures.length;R++){let Y=g.propertySignatures[R];if(typeof Y.name!=="string")throw Yt("Invalid schema representation document",[...b,"propertySignatures",R,"name"]);let W=Y.name,Pe=p(Y.type,[...b,"propertySignatures",R,"type"]),Me=js(Y.annotations,r);if(A(y,W,Me===void 0?Pe:qs(Pe,Me)),!Y.isOptional)I.push(W)}if(g.propertySignatures.length>0)m.properties=y;if(I.length>0)m.required=I;let v={},U=[];for(let R=0;R<g.indexSignatures.length;R++){let Y=g.indexSignatures[R],W=p(Y.type,[...b,"indexSignatures",R,"type"]);if(Object.keys(W).length===1&&"not"in W)W=!1;let Pe=E(Y.parameter,[...b,"indexSignatures",R,"parameter"],new Set);if(Pe.length===0)U.push(W);else for(let Me of Pe){let gc=v[Me];A(v,Me,gc===void 0?W:gc===!1||W===!1?!1:qs(gc,W))}}let M=Object.keys(v).length>0;if(M)m.patternProperties=v;if(g.indexSignatures.length===0)m.additionalProperties=r?.additionalProperties??!1;else if(U.length===1&&g.propertySignatures.length===0&&!M)m.additionalProperties=U[0];else if(U.length>0)m.allOf=U.map((R)=>({type:"object",additionalProperties:R}));if(typeof m.additionalProperties==="object"&&m.additionalProperties!==null&&Object.keys(m.additionalProperties).length===0)delete m.additionalProperties;return m}case"Union":{let m=g.types.map((y,I)=>p(y,[...b,"types",I]));if(m.length===0)return{not:{}};if(g.mode==="anyOf"&&m.length>1){let y=xO(m);if(y!==void 0)return y}return g.mode==="anyOf"?{anyOf:m}:{oneOf:m}}}}function E(g,b,m){switch(g._tag){case"Reference":{if(!Object.hasOwn(n,g.$ref))throw Yt(`Invalid reference ${g.$ref}`,[...b,"$ref"]);if(d(g.$ref,b),m.has(g.$ref))return[];let y=new Set(m).add(g.$ref);return E(n[g.$ref],["references",g.$ref],y)}case"String":return mS(p(g,b));case"TemplateLiteral":return[`^${g.parts.map(Ya).join("")}$`];case"Union":return g.types.flatMap((y,I)=>E(y,[...b,"types",I],m));default:throw Yt("Invalid schema representation document",b)}}}function gO(e){return e==="string"||e==="number"||e==="boolean"||e==="array"||e==="object"||e==="null"||e==="integer"}function xO(e){let t=void 0,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 mS(e){let t=[];if(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)if(typeof o==="object"&&o!==null&&!Array.isArray(o))t.push(...mS(o))}}return t}function Ya(e){switch(e._tag){case"Literal":return xo(globalThis.String(e.literal));case"String":return iy;case"Number":return Ca;case"TemplateLiteral":return e.parts.map(Ya).join("");case"Union":return e.types.map(Ya).join("|");default:throw Yt("Invalid schema representation document",[])}}function hS(e,t){let n=hO([e.representation],[["representation"]],e.references,t);return{dialect:n.dialect,schema:n.schemas[0],definitions:n.definitions}}var SO=({identifier:e})=>e;function jt(e){return e===void 0?void 0:{annotations:e}}function Df(e,t){let{references:n,representations:r}=IO([e],t);return{representation:r[0],references:n}}function IO(e,t){let n={},r=new Map,o=new Set,s=new Map,i=new Set;for(let m of e)h(m);let a=t?.referencePolicy??SO;for(let m of s.values())for(let y of m.values()){let I=a({ast:y.ast,occurrences:y.occurrences,identifier:y.identifier});if(I!==void 0){let v=I===y.identifier||!I.endsWith("_")?"_":"";y.reference=u(I,y,v)}else if(y.isRecursive)y.reference=u(`${y.ast._tag}_`,y,"")}return{representations:_n(e,(m)=>w(m)),references:n};function u(m,y,I="_"){let v=m,U=0;while(r.has(v)){if(r.get(v)===y)return v;v=`${m}${I}${++U}`}return r.set(v,y),v}function l(m,y,I){let v=y.fallback;if(v!==void 0)return yl(m)===v?m:bt(m,{[fr]:v});return I===y.identifier?m:bt(m,{identifier:I})}function d(m,y){if(!Object.hasOwn(n,m)&&!o.has(m)){o.add(m);let I=p(y);o.delete(m),A(n,m,I)}return{_tag:"Reference",$ref:m}}function f(m){let y=Ns(m),I=lf(y),v=Qr(y),U=v===void 0?(y!==m?Qr(m):void 0)??yl(y):void 0;if(U!==void 0)v=`${U}Encoded`;let M=s.get(I);if(M===void 0)M=new Map,s.set(I,M);let R=M.get(v);if(R===void 0)R={ast:I,identifier:v,fallback:U,occurrences:0,isRecursive:!1,reference:void 0},M.set(v,R);return R}function h(m){let y=f(m),I=y.ast;if(y.occurrences++,i.has(y)){y.isRecursive=!0;return}if(y.occurrences>1)return;switch(i.add(y),x(I.checks),I._tag){case"Declaration":case"Arrays":case"Objects":case"Union":I.recur((v)=>(h(v),v));break;case"TemplateLiteral":I.parts.forEach(h);break;case"Suspend":h(I.thunk());break}i.delete(y)}function x(m){m?.forEach((y)=>{if(y.annotations?.representation?.schemas?.forEach((I)=>h(Ce(I))),y._tag==="FilterGroup")x(y.checks)})}function w(m){let y=f(m),I=y.ast,v=y.reference;if(v!==void 0){let U=y.identifier===void 0?I:l(I,y,v);return d(v,U)}return p(I)}function p(m){let y=S(m.checks);switch(m._tag){case"Declaration":return{_tag:"Declaration",typeParameters:m.typeParameters.map((I)=>w(I)),checks:y,...g(m.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:m._tag,checks:y,...jt(m.annotations)};case"Literal":return{_tag:"Literal",literal:m.literal,checks:y,...jt(m.annotations)};case"UniqueSymbol":return{_tag:"UniqueSymbol",symbol:m.symbol,checks:y,...jt(m.annotations)};case"Enum":return{_tag:"Enum",enums:m.enums,checks:y,...jt(m.annotations)};case"TemplateLiteral":return{_tag:"TemplateLiteral",parts:m.parts.map((I)=>w(I)),checks:y,...jt(m.annotations)};case"Arrays":return{_tag:"Arrays",elements:m.elements.map((I)=>{let v=Ns(I),U=v.context?.annotations;return{isOptional:xe(v),type:w(I),...jt(U)}}),rest:m.rest.map((I)=>w(I)),checks:y,...jt(m.annotations)};case"Objects":return{_tag:"Objects",propertySignatures:m.propertySignatures.map((I)=>{let v=Ns(I.type),U=v.context?.annotations;return{name:I.name,type:w(I.type),isOptional:xe(v),isMutable:ty(v),...jt(U)}}),indexSignatures:m.indexSignatures.map((I)=>({parameter:w(I.parameter),type:w(I.type)})),checks:y,...jt(m.annotations)};case"Union":return{_tag:"Union",types:m.types.map((I)=>w(I)),mode:m.mode,checks:y,...jt(m.annotations)};case"Suspend":return{_tag:"Suspend",checks:[],thunk:w(m.thunk()),...jt(m.annotations)}}}function S(m){return m?.map(E)??[]}function E(m){switch(m._tag){case"Filter":return{_tag:"Filter",aborted:m.aborted,...b(m.annotations)};case"FilterGroup":return{_tag:"FilterGroup",checks:_n(m.checks,E),...b(m.annotations)}}}function g(m){if(m===void 0)return;let{representation:y,...I}=m;return{...y===void 0?void 0:{representation:y},...Object.keys(I).length===0?void 0:{annotations:I}}}function b(m){if(m===void 0)return;let{representation:y,...I}=m,v=y===void 0?void 0:y.schemas===void 0?y:{...y,schemas:y.schemas.map((U)=>w(Ce(U)))};return{...v===void 0?void 0:{representation:v},...Object.keys(I).length===0?void 0:{annotations:I}}}}function xS(e,t){let n=[];return Uf(e,t,"",n),n}function Uf(e,t,n,r){if(Object.is(e,t))return;if(Array.isArray(e)&&Array.isArray(t)){let o=e.length,s=t.length,i=Math.min(o,s);for(let a=0;a<i;a++)Uf(e[a],t[a],`${n}/${a}`,r);for(let a=o-1;a>=s;a--)r.push({op:"remove",path:`${n}/${a}`});for(let a=o;a<s;a++)r.push({op:"add",path:`${n}/${a}`,value:t[a]});return}if(Xa(e)&&Xa(t)){let o=Object.keys(e),s=Object.keys(t),i=Array.from(new Set([...o,...s])).sort();for(let a of i){let c=`${n}/${wr(a)}`,u=Object.hasOwn(e,a),l=Object.hasOwn(t,a);if(u&&l)Uf(e[a],t[a],c,r);else if(!u&&l)r.push({op:"add",path:c,value:t[a]});else r.push({op:"remove",path:c})}return}r.push({op:"replace",path:n,value:t})}function yS(e,t){let n=t;for(let r of e)n=TO(n,r);return n}function Xa(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function wO(e){if(e==="")return[];if(e.charCodeAt(0)!==47)throw Error(`Invalid JSON Pointer, it must start with "/": ${JSON.stringify(e)}`);return e.split("/").slice(1).map(go)}function SS(e){if(!/^(0|[1-9]\d*)$/.test(e))throw Error(`Invalid array index: "${e}"`);return Number(e)}function TO(e,t){if(t.path===""){if(t.op==="remove")throw Error("Unsupported operation at the root");return t.value}let n=EO(e,t.path);if(n===null)throw 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 Error(`"-" is not valid for ${t.op} at "${t.path}".`);let i=r==="-"?o.length:SS(r),a=t.op==="add"?o.length:o.length-1;if(i>a)throw Error(`Array index out of bounds at "${t.path}".`);let c=o.slice();if(t.op==="add")c.splice(i,0,t.value);else if(t.op==="remove")c.splice(i,1);else c[i]=t.value;return gS(s,c)}if(Xa(o)){if(t.op!=="add"&&!Object.hasOwn(o,r))throw Error(`Property "${r}" does not exist at "${t.path}".`);let i={...o};if(t.op==="remove")delete i[r];else A(i,r,t.value);return gS(s,i)}throw Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`)}function EO(e,t){let n=wO(t);if(n.length===0)return null;let r=n[n.length-1],o=[],s=e;for(let i=0;i<n.length-1;i++){let a=n[i];if(Array.isArray(s)){let c=SS(a);if(c>=s.length)return null;o.push({container:s,token:c}),s=s[c];continue}if(Xa(s)){if(!Object.hasOwn(s,a))return null;o.push({container:s,token:a}),s=s[a];continue}return null}return{stack:o,parent:s,lastToken:r}}function gS(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 i=o.slice();i[s]=n,n=i}else{let i={...o};A(i,s,n),n=i}}return n}function wS(e,t){return qt(yo("Iso",e,t))}function IS(e,t){return qt(yo("Lens",e,t))}function yo(e,t,n){return[{_tag:"PrimitiveNode",kind:e,get:t,set:n}]}var OO={kind:"Iso",get:ne,set:ne};class Lf{_tag="PathNode";kind="Lens";path;get;set;constructor(e){this.path=e,this.get=(t)=>{let n=t;for(let r=0;r<e.length;r++)n=n[e[r]];return n},this.set=(t,n)=>{let r=ec(n),o=r,s=0;for(;s<e.length-1;s++){let i=e[s];A(o,i,ec(o[i])),o=o[i]}return A(o,e[s],t),r}}}class Qa{_tag="CheckNode";kind="Prism";checks;get;set=ne;constructor(e){this.checks=e,this.get=(t)=>uy(e,t)}}function Er(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];if(s._tag==="PathNode"&&o._tag==="PathNode")n[n.length-1]=new Lf([...s.path,...o.path]);else if(s._tag==="CheckNode"&&o._tag==="CheckNode")n[n.length-1]=new Qa([...s.checks,...o.checks]);else n.push(o)}return n}function AO(e,t){return qt(yo("Optional",e,t))}class Bs{node;getResult;replaceResult;constructor(e,t,n){this.node=e,this.getResult=t,this.replaceResult=n}replace(e,t){return An(this.replaceResult(e,t),()=>t)}modify(e){return(t)=>An(kn(this.getResult(t),(n)=>this.replaceResult(e(n),t)),()=>t)}compose(e){return qt(Er(this.node,e.node))}key(e){return qt(Er(this.node,[new Lf([e])]))}optionalKey(e){return qt(Er(this.node,yo("Lens",(t)=>t[e],(t,n)=>{let r=ec(n);if(t===void 0)if(Array.isArray(r)&&typeof e==="number")r.splice(e,1);else delete r[e];else A(r,e,t);return r})))}check(...e){return qt(Er(this.node,[new Qa(e)]))}refine(e,t){return qt(Er(this.node,[new Qa([La(e,t)])]))}tag(e){let t=X(new K({expected:`${JSON.stringify(e)} tag`}));return qt(Er(this.node,yo("Prism",(n)=>n._tag===e?z(n):t,ne)))}at(e,...t){let n=X(new we([e],new pr(void 0)));return qt(Er(this.node,yo("Optional",(r)=>Object.hasOwn(r,e)?z(r[e]):n,(r,o)=>{if(Object.hasOwn(o,e)){let s=ec(o);return A(s,e,r),z(s)}else return n})))}pick(e){return this.compose(IS(Py(e),(t,n)=>({...n,...t})))}omit(e){return this.compose(IS(My(e),(t,n)=>({...n,...t})))}notUndefined(){return this.refine(en,{expected:"a value other than `undefined`"})}forEach(e){let t=e(tc());return AO((n)=>ot(this.getResult(n),(r)=>{let o=[];for(let s=0;s<r.length;s++){let i=t.getResult(r[s]);if(gt(i))o.push(i.success)}return o}),(n,r)=>kn(this.getResult(r),(o)=>{let s=[];for(let a=0;a<o.length;a++)if(gt(t.getResult(o[a])))s.push(a);if(n.length!==s.length)return X(new K({message:`each: replacement length mismatch: ${n.length} !== ${s.length}`}));let i=o.slice();for(let a=0;a<s.length;a++){let c=s[a],u=t.replaceResult(n[a],o[c]);if(pe(u))return X(new we([c],u.failure));i[c]=u.success}return this.replaceResult(i,r)}))}modifyAll(e){return(t)=>An(kn(this.getResult(t),(n)=>this.replaceResult(n.map(e),t)),()=>t)}}class TS extends Bs{get;set;constructor(e,t,n){super(e,(r)=>z(t(r)),(r)=>z(n(r)));this.get=t,this.set=n}replace(e,t){return this.set(e)}modify(e){return(t)=>this.set(e(this.get(t)))}}class ES extends Bs{get;constructor(e,t,n){super(e,(r)=>z(t(r)),(r,o)=>z(n(r,o)));this.get=t,this.replace=n}modify(e){return(t)=>this.replace(e(this.get(t)),t)}}class vS extends Bs{set;constructor(e,t,n){super(e,t,(r,o)=>z(n(r)));this.set=n}replace(e,t){return this.set(e)}modify(e){return(t)=>An(ot(this.getResult(t),(n)=>this.set(e(n))),()=>t)}}function qt(e){let t=e[0]??OO;if(e.length>1){let n=e.reduce((r,o)=>_O(r,o.kind),"Iso");t={kind:n,get:kO(e,n),set:RO(e,n)}}switch(t.kind){case"Iso":return new TS(e,t.get,t.set);case"Lens":return new ES(e,t.get,t.set);case"Prism":return new vS(e,t.get,t.set);case"Optional":return new Bs(e,t.get,t.set)}}function ec(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 Error("Cannot clone object with non-Object constructor or null prototype");return{...e}}return e}function kO(e,t){return(n)=>{for(let r=0;r<e.length;r++){let o=e[r],s=o.get(n);if($f(o.kind)){if(pe(s))return s;n=s.success}else n=s}return $f(t)?z(n):n}}function RO(e,t){if(bS(t))return(n)=>{for(let r=e.length-1;r>=0;r--)n=e[r].set(n);return n};return(n,r)=>{let o=e.length,s=Array(o);for(let i=0;i<o;i++){s[i]=r;let a=e[i];if($f(a.kind)){let c=a.get(r);if(pe(c))return c;r=c.success}else r=a.get(r)}for(let i=o-1;i>=0;i--){let a=e[i];if(bS(a.kind))n=a.set(n);else if(a.kind==="Lens")n=a.set(n,s[i]);else{let c=a.set(n,s[i]);if(pe(c))return c;n=c.success}}return t==="Optional"?z(n):n}}function $f(e){return e==="Prism"||e==="Optional"}function bS(e){return e==="Iso"||e==="Prism"}function _O(e,t){if(e==="Iso")return t;if(t==="Iso"||e===t)return e;return"Optional"}var CO=qt([]);function tc(){return CO}var vr=new WeakMap,OS=(e)=>{if(vr.has(e))return vr.get(e);else throw Error("Unable to get redacted value"+(e.label?` with label: "${e.label}"`:""))};var AS="~effect/data/Redacted",jf=(e)=>D(e,AS),zs=(e,t)=>{let n=Object.create(MO);if(t?.label)n.label=t.label;return vr.set(n,e),n},MO={[AS]:{_A:(e)=>e},label:void 0,...nn,toJSON(){return this.toString()},toString(){return`<redacted${bn(this.label)?":"+this.label:""}>`},[G](){return P(vr.get(this))},[Z](e){return jf(e)&&N(vr.get(this),vr.get(e))}},So=OS;var kS=(e)=>Re((t,n)=>e(So(t),So(n)));var Hs=Ga;function rt(){return(e,t,n)=>k(new yr(e.map(As),(r)=>t(r.map((o)=>k(o))),n))}function vt(e,t){return rt()([],()=>(n,r,o)=>e(n)?L(n):_(new le(r,n,o)),t)}function DO(e){return e}function UO(e){return(t)=>t.annotate(e)}function $O(e){return(t)=>qf(qf(t).annotate(e))}function LO(e){return(t)=>t.rebuild(Ps(t.ast,e))}function jO(e){return e}var Ks="~effect/SchemaError/SchemaError";class vo extends $i("SchemaError"){[Ks]=Ks;constructor(e){let t=qi();Kr(0);try{super({issue:e})}finally{Kr(t)}}get message(){return bg(this.issue)}toString(){return`SchemaError(${this.message})`}}function zS(e){return D(e,Ks)&&e[Ks]===Ks}function RS(e){return Xe(e)?e.value:{issues:[{message:th(e.cause)}]}}function qO(e,t){let n=Se(e),r={errors:"all",...t?.parseOptions},o=Ig(t),s=(i)=>{let a=new zr("sync"),c=Dh(Fh(n(i,r),{onFailure:o,onSuccess:(l)=>({value:l})}),{scheduler:a});c.currentDispatcher?.flush();let u=c.pollUnsafe();if(u)return RS(u);return new Promise((l)=>{c.addObserver((d)=>{l(RS(d))})})};if("~standard"in e){let i=e;if("validate"in i["~standard"])return i;return Object.assign(i["~standard"],{validate:s}),i}else return Object.assign(e,{"~standard":{version:1,vendor:"effect",validate:s}})}function _S(e,t){let n=jb(e);if(t==="draft-2020-12"){let r=n.schema;if(Object.keys(n.definitions).length>0)r.$defs=n.definitions;return r}else if(t==="draft-07"){let r=sS(n),o=r.schema;if(Object.keys(r.definitions).length>0)o.definitions=r.definitions;return o}throw new globalThis.Error(`Unsupported target: ${t}`)}function BO(e){let t={input(n){return _S(e,n.target)},output(n){return _S(He(e),n.target)}};if("~standard"in e){let n=e;if("jsonSchema"in n["~standard"])return n;return Object.assign(n["~standard"],{jsonSchema:t}),n}else return Object.assign(e,{"~standard":{version:1,vendor:"effect",jsonSchema:t}})}var HS=gy,zO=yy;function sc(e,t){let n=Se(e,t);return(r,o)=>KS(n(r,o))}function KS(e){if(ce(e))return Kf(e);return ur(e,(t)=>rs(()=>Fn(t,(n)=>new vo(n))))}var HO=sc;function JS(e,t){let n;for(let r of e.reasons){if(!Ji(r)||!zS(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 WS(e){return tl(e).then((t)=>{if(Xe(t))return t.value;throw JS(t.cause,"Promise adapter can only reject schema errors")})}function GS(e){let t=lr(e);if(Xe(t))return t.value;throw JS(t.cause,"Sync adapter can only throw schema errors")}function ZS(e,t){let n=Sy(e,t);return(r,o)=>Kf(n(r,o))}function Kf(e){return Xe(e)?e:pn(Fn(e.cause,(t)=>new vo(t)))}var KO=ZS,JO=wf,WO=Iy;function VS(e,t){let n=by(e,t);return(r,o)=>vi(n(r,o),(s)=>new vo(s))}var GO=VS;function YS(e,t){let n=sc(e,t);return(r,o)=>WS(n(r,o))}var ZO=YS;function XS(e,t){let n=sc(e,t);return(r,o)=>GS(n(r,o))}var VO=XS;function ic(e,t){let n=mo(e,t);return(r,o)=>KS(n(r,o))}var QS=ic;function eI(e,t){let n=wy(e,t);return(r,o)=>Kf(n(r,o))}var YO=eI,XO=Ef,QO=Ty;function tI(e,t){let n=Ey(e,t);return(r,o)=>vi(n(r,o),(s)=>new vo(s))}var eA=tI;function nI(e,t){let n=ic(e,t);return(r,o)=>WS(n(r,o))}var tA=nI;function rI(e,t){let n=ic(e,t);return(r,o)=>GS(n(r,o))}var nA=rI,k=Us;function ac(e){return D(e,Hs)&&e[Hs]===Hs}var Or=$e((e)=>k(fo(e.ast),{schema:e})),rA=$e((e)=>e.schema),Et=$e((e)=>{let t=uc(e);return k(Xx(e.ast),{schema:t})}),oA=$e((e)=>e.schema.members[0]),sA=$e((e)=>k(pf(e.ast),{schema:e})),iA=$e((e)=>e.schema),He=$e((e)=>k(Ce(e.ast),{schema:e})),Oo=$e((e)=>k(nt(e.ast),{schema:e})),Js="~effect/Schema/flip";function aA(e){return D(e,Js)&&e[Js]===Js}function qf(e){if(aA(e))return e.schema.rebuild(Ft(e.ast));return k(Ft(e.ast),{[Js]:Js,schema:e})}function ue(e){let t=k(new pt(e),{literal:e,transform(n){return t.pipe(q(ue(n),{decode:J(()=>n),encode:J(()=>e)}))}});return t}function oI(e){return new tf(e.map((t)=>ac(t)?t.ast:new pt(t)))}function cA(e){return k(oI(e),{parts:e})}function uA(e){return k(oI(e).asTemplateLiteralParser(),{parts:e})}function lA(e){return k(new ef(Object.keys(e).filter((t)=>typeof e[e[t]]!=="number").map((t)=>[t,e[t]])),{enums:e})}var fA=k(kx),dA=k(_x),Jf=k(xn),te=k(Xl),Wf=k(Ql),j=k(Zt),cc=k(rf),sI=k($x),iI=k(jx),Xt=k(Bx),pA=k(Ox),mA=k(Px);function hA(e){return k(new nf(e))}function Gf(e,t){return k(e,{fields:t,mapFields(n,r){let o=n(this.fields);return Gf(Ma(o,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function C(e){return Gf(Ma(e,void 0),e)}function gA(e){return $e((t)=>t.mapFields(Fy(e)))}var xA=(e)=>typeof e==="symbol"?e:globalThis.String(e);function yA(e){return function(t){let n={},r=Object.create(null),o=Object.create(null),s=new Set;for(let i of Reflect.ownKeys(t.fields)){let a=Oo(t.fields[i]),c=Object.hasOwn(e,i),u=c?e[i]:i,l=xA(u);if(s.has(l))throw new globalThis.Error(`Duplicate encoded keys: ${tn(u)}`);if(s.add(l),A(n,u,a),c)r[i]=u,o[u]=i}return C(n).pipe(q(t,fe({decode:kf(o),encode:kf(r)})))}}function SA(e,t){return(n)=>{let r=Yd(n.fields,He),o=C({...r,...e});return n.pipe(q(o,fe({decode:(s)=>{let i={...s};for(let a in e){let c=t[a],u=c(s);if(Ve(u))A(i,a,u.value)}return i},encode:(s)=>{let i={...s};for(let a in e)delete i[a];return i}})))}}function Zf(e,t){return k(ey(e.ast,t.ast),{key:e,value:t})}function IA(e,t){return k(zx(e.ast,t.map(As)),{schema:e,records:t})}function aI(e,t){return k(e,{elements:t,mapElements(n,r){let o=n(this.elements);return aI(af(o,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function bo(e){return aI(af(e),e)}function bA(e,t){return k(Hx(e.ast,t.map(As)),{schema:e,rest:t})}var Ie=$e((e)=>k(new Ut(!1,[],[e.ast]),{value:e}));var wA=$e((e)=>k(new Ut(!1,[e.ast],[e.ast]),{value:e}));function TA(e){return ve([e,Ie(e)]).pipe(q(Ie(He(e)),fe({decode:Xd,encode:(t)=>t.length===1?t[0]:t})))}function EA(e){return Ie(e).check(od())}var vA=$e((e)=>k(new Ut(!0,e.ast.elements,e.ast.rest),{schema:e}));function cI(e,t){return k(e,{members:t,mapMembers(n,r){let o=n(this.members);return cI(Fa(o,this.ast.mode,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function ve(e,t){return cI(Fa(e,t?.mode??"anyOf",void 0),e)}function Ws(e){let t=e.map(ue);return k(Fa(t,"anyOf",void 0),{literals:e,members:t,mapMembers(n){return ve(n(this.members))},pick(n){return Ws(n)},transform(n){return ve(t.map((r,o)=>r.transform(n[o])))}})}var Vf=$e((e)=>ve([e,te])),uc=$e((e)=>ve([e,Wf])),uI=$e((e)=>ve([e,te,Wf]));function lI(e){return k(new Ua(()=>e().ast))}function OA(...e){return(t)=>t.check(...e)}function AA(e,t){return(n)=>k(Vt(n.ast,[La(e,t)]),{schema:n})}function fI(e){return(t)=>k(Yx(t.ast,e),{schema:t,identifier:e})}function kA(e,t){return(n)=>(t.checks?n.check(...t.checks):n).pipe(fI(e))}function dI(e){return(t)=>k(Zx(t.ast,new Es(e,ne)),{schema:t})}function pI(e){return(t)=>k(Vx(t.ast,new Es(ne,e)),{schema:t})}function RA(e){return mI(e)}function mI(e){return(t)=>dI(nl(e))(t)}function _A(e){return hI(e)}function hI(e){return(t)=>pI(nl(e))(t)}function q(e,t){return(n)=>k(Ba(n.ast,e.ast,t?Aa(t):ro()),{from:n,to:e})}function CA(e){return(t)=>q(He(t),e)(t)}function Yf(e,t){return(n)=>t?q(n,t)(e):q(n)(e)}function NA(e){return(t)=>q(t,e)(Oo(t))}function gI(e){return(t)=>k(Qx(t.ast,e),{schema:t})}function xI(e){return ur(e,(t)=>rs(()=>Fn(t,(n)=>n.issue)))}function Xf(e,t){let n=t?.encodingStrategy==="omit"?Cl():Mt();return(r)=>Or(Oo(r)).pipe(q(r,{decode:ws(xI(e)),encode:n}))}function PA(e,t){return(n)=>He(n).pipe(Xf(e,t),Yf(Or(n)))}function yI(e,t){let n=t?.encodingStrategy==="omit"?Cl():Mt();return(r)=>Et(Oo(r)).pipe(q(r,{decode:ws(xI(e)),encode:n}))}function MA(e,t){return(n)=>He(n).pipe(yI(e,t),Yf(Et(n)))}function Ar(e){return ue(e).pipe(gI(L(e)))}function FA(e){return Ar(e).pipe(Xf(L(e),{encodingStrategy:"omit"}))}function lc(e,t){return C({_tag:Ar(e),...t})}function SI(e){return(t)=>{let n={},r=[],o=new Set,s={},i=(l)=>(d)=>l.includes(d[e]);return a(t),Object.assign(t,{cases:n,discriminants:r,isAnyOf:i,guards:s,match:c,matchOrElse:u});function a(l){let d=l.ast;if(bx(d)&&"members"in l&&globalThis.Array.isArray(l.members)&&l.members.every(ac))return l.members.forEach(a);let f=io(d);if(f.length>0){let h=f.find((x)=>x.key===e)?.literal;if(ai(h)){let x=typeof h==="number"?globalThis.String(h):h;if(o.has(x))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(h)}`);o.add(x),r.push(h),A(n,h,l),A(s,h,HS(He(l)));return}}throw new globalThis.Error("No literal or unique symbol found")}function c(){if(arguments.length===1){let x=arguments[0];return function(w){let p=w[e];return(Object.hasOwn(x,p)?x[p]:void 0)(w)}}let l=arguments[0],d=arguments[1],f=l[e];return(Object.hasOwn(d,f)?d[f]:void 0)(l)}function u(){if(arguments.length===2){let w=arguments[0],p=arguments[1];return function(S){let E=S[e];return(Object.hasOwn(w,E)?w[E]??p:p)(S)}}let l=arguments[0],d=arguments[1],f=arguments[2],h=l[e];return(Object.hasOwn(d,h)?d[h]??f:f)(l)}}}function DA(e){let t={},n=[];for(let c of Object.keys(e)){let u=lc(c,e[c]);A(t,c,u),n.push(u)}let r=ve(n),{guards:o,isAnyOf:s,match:i,matchOrElse:a}=SI("_tag")(r);return k(r.ast,{cases:t,isAnyOf:s,guards:o,match:i,matchOrElse:a})}function UA(){return(e)=>e}function Hn(e,t){return vt((n)=>n instanceof e,t)}function ie(){return(e,t)=>new de(e.ast,Aa(t))}var ae=$a;function $A(e,t=void 0){return new Ln(e,t)}function Le(e,t){return ze(e,te,({annotations:n})=>n===void 0?t:t.annotate(n))}var CS="^\\S[\\s\\S]*\\S$|^\\S$|^$";function Qf(e){let t=new globalThis.RegExp(CS);return ae((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:[CS]}},...e})}var LA=B("effect/schema/isTrimmed",te,({annotations:e})=>Qf(e));function kr(e,t){let{source:n,flags:r}=e,o=r===""?`new RegExp(${O(n)})`:`new RegExp(${O(n)}, ${O(r)})`;return Rs(e,{toCode:()=>({runtime:`Schema.isPattern(${o})`}),...t})}var jA=C({source:j,flags:j}).check(ae((e)=>{let t=Bc(()=>new globalThis.RegExp(e.source,e.flags));return gt(t)&&t.success.source===e.source&&t.success.flags===e.flags})),qA={id:"effect/schema/isPattern",payloadSchema:jA,revive:({annotations:e,payload:t})=>kr(new globalThis.RegExp(t.source,t.flags),e)};function II(e){return hf({toCode:()=>({runtime:"Schema.isStringFinite()"}),...e})}var BA=B("effect/schema/isStringFinite",te,({annotations:e})=>II(e));function bI(e){return gf({toCode:()=>({runtime:"Schema.isStringBigInt()"}),...e})}var zA=B("effect/schema/isStringBigInt",te,({annotations:e})=>bI(e));function wI(e){return yf({toCode:()=>({runtime:"Schema.isStringSymbol()"}),...e})}var HA=B("effect/schema/isStringSymbol",te,({annotations:e})=>wI(e)),KA=(e)=>{if(e)return 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})$`);return/^([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 TI(e,t){let n=KA(e);return kr(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 JA=B("effect/schema/isUUID",C({version:ve([Ws([1,2,3,4,5,6,7,8]),te])}),({annotations:e,payload:t})=>TI(t.version??void 0,e)),NS=/^([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 EI(e){return kr(NS,{expected:"a GUID",representation:{id:"effect/schema/isGUID",payload:null},toJsonSchema:()=>({pattern:NS.source}),toCode:()=>({runtime:"Schema.isGUID()"}),...e})}var WA=B("effect/schema/isGUID",te,({annotations:e})=>EI(e));function vI(e){let t=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;return kr(t,{representation:{id:"effect/schema/isULID",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isULID()"}),...e})}var GA=B("effect/schema/isULID",te,({annotations:e})=>vI(e));function ed(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return kr(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}var ZA=B("effect/schema/isBase64",te,({annotations:e})=>ed(e));function OI(e){let t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;return kr(t,{expected:"a base64url encoded string",representation:{id:"effect/schema/isBase64Url",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64Url()"}),...e})}var VA=B("effect/schema/isBase64Url",te,({annotations:e})=>OI(e));function AI(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(`^${xo(e)}`);return ae((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(${O(e)})`}),arbitrary:{constraint:{patterns:[r.source]}},...t})}var YA=B("effect/schema/isStartsWith",C({startsWith:j}),({annotations:e,payload:t})=>AI(t.startsWith,e));function kI(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(`${xo(e)}$`);return ae((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(${O(e)})`}),arbitrary:{constraint:{patterns:[r.source]}},...t})}var XA=B("effect/schema/isEndsWith",C({endsWith:j}),({annotations:e,payload:t})=>kI(t.endsWith,e));function RI(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(xo(e));return ae((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(${O(e)})`}),arbitrary:{constraint:{patterns:[r.source]}},...t})}var QA=B("effect/schema/isIncludes",C({includes:j}),({annotations:e,payload:t})=>RI(t.includes,e)),PS="^[^a-z]*$";function _I(e){let t=new globalThis.RegExp(PS);return ae((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:[PS]}},...e})}var ek=B("effect/schema/isUppercased",te,({annotations:e})=>_I(e)),MS="^[^A-Z]*$";function CI(e){let t=new globalThis.RegExp(MS);return ae((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:[MS]}},...e})}var tk=B("effect/schema/isLowercased",te,({annotations:e})=>CI(e)),FS="^[^a-z]?.*$";function NI(e){let t=new globalThis.RegExp(FS);return ae((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:[FS]}},...e})}var nk=B("effect/schema/isCapitalized",te,({annotations:e})=>NI(e)),DS="^[^A-Z]?.*$";function PI(e){let t=new globalThis.RegExp(DS);return ae((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:[DS]}},...e})}var rk=B("effect/schema/isUncapitalized",te,({annotations:e})=>PI(e)),Bt=k(uf),MI=cf,ok=B("effect/schema/isFinite",te,({annotations:e})=>MI(e));function Gs(e){let t=jr(e.order),n=e.formatter??O;return(r,o)=>ae((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 Zs(e){let t=jo(e.order),n=e.formatter??O;return(r,o)=>ae((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 Vs(e){let t=Lr(e.order),n=e.formatter??O;return(r,o)=>ae((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 Ys(e){let t=Lo(e.order),n=e.formatter??O;return(r,o)=>ae((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 Xs(e){let t=jo(e.order),n=jr(e.order),r=Lo(e.order),o=Lr(e.order),s=e.formatter??O;return(i,a)=>{let c=i.exclusiveMinimum?n:t,u=i.exclusiveMaximum?o:r;return ae((l)=>c(l,i.minimum)&&u(l,i.maximum),{expected:`a value between ${s(i.minimum)}${i.exclusiveMinimum?" (excluded)":""} and ${s(i.maximum)}${i.exclusiveMaximum?" (excluded)":""}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:i.minimum,maximum:i.maximum,...i.exclusiveMinimum&&{exclusiveMinimum:!0},...i.exclusiveMaximum&&{exclusiveMaximum:!0}}}},...e.annotate?.(i),...a})}}function FI(e){return(t,n)=>{let r=e.formatter??O;return ae((o)=>e.remainder(o,t)===e.zero,{expected:`a value that is a multiple of ${r(t)}`,...e.annotate?.(t),...n})}}function wo(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${O(e)}`);return e}var DI=Gs({order:_t,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThan",payload:{exclusiveMinimum:wo(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${O(e)})`})})}),sk=B("effect/schema/isGreaterThan",C({exclusiveMinimum:Bt}),({annotations:e,payload:t})=>DI(t.exclusiveMinimum,e)),td=Zs({order:_t,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:wo(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${O(e)})`})})}),ik=B("effect/schema/isGreaterThanOrEqualTo",C({minimum:Bt}),({annotations:e,payload:t})=>td(t.minimum,e)),UI=Vs({order:_t,annotate:(e)=>({representation:{id:"effect/schema/isLessThan",payload:{exclusiveMaximum:wo(e)}},toJsonSchema:()=>({exclusiveMaximum:e}),toCode:()=>({runtime:`Schema.isLessThan(${O(e)})`})})}),ak=B("effect/schema/isLessThan",C({exclusiveMaximum:Bt}),({annotations:e,payload:t})=>UI(t.exclusiveMaximum,e)),$I=Ys({order:_t,annotate:(e)=>({representation:{id:"effect/schema/isLessThanOrEqualTo",payload:{maximum:wo(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${O(e)})`})})}),ck=B("effect/schema/isLessThanOrEqualTo",C({maximum:Bt}),({annotations:e,payload:t})=>$I(t.maximum,e)),fc=Xs({order:_t,annotate:(e)=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetween",payload:{minimum:wo(e.minimum),maximum:wo(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?"exclusiveMinimum":"minimum"]:e.minimum,[n?"exclusiveMaximum":"maximum"]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${O(e.minimum)}, maximum: ${O(e.maximum)}, exclusiveMinimum: ${O(t)}, exclusiveMaximum: ${O(n)} })`})}}}),uk=B("effect/schema/isBetween",C({minimum:Bt,maximum:Bt,exclusiveMinimum:Et(ue(!0)),exclusiveMaximum:Et(ue(!0))}),({annotations:e,payload:t})=>fc(t,e)),LI=FI({remainder:Th,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(${O(e)})`})})}),lk=B("effect/schema/isMultipleOf",C({divisor:Bt}),({annotations:e,payload:t})=>LI(t.divisor,e));function Qs(e){return ae((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 fk=B("effect/schema/isInt",te,({annotations:e})=>Qs(e)),Rr=cc.check(Qs()),Ne=Rr.check(td(0));function dk(e){return new Ln([Qs(),fc({minimum:-2147483648,maximum:2147483647})],{expected:"a 32-bit integer",...e})}function pk(e){return new Ln([Qs(),fc({minimum:0,maximum:4294967295})],{expected:"a 32-bit unsigned integer",...e})}function To(e){if(globalThis.Number.isNaN(e.getTime()))throw new globalThis.RangeError(`Expected a valid Date, got ${O(e)}`);return e.toISOString()}function Eo(e){return`new Date(${O(e.getTime())})`}var jI=Gs({order:tr,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThanDate",payload:{exclusiveMinimum:To(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanDate(${Eo(e)})`})})}),qI=Zs({order:tr,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThanOrEqualToDate",payload:{minimum:To(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToDate(${Eo(e)})`})})}),BI=Vs({order:tr,annotate:(e)=>({representation:{id:"effect/schema/isLessThanDate",payload:{exclusiveMaximum:To(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanDate(${Eo(e)})`})})}),zI=Ys({order:tr,annotate:(e)=>({representation:{id:"effect/schema/isLessThanOrEqualToDate",payload:{maximum:To(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanOrEqualToDate(${Eo(e)})`})})}),HI=Xs({order:tr,annotate:(e)=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenDate",payload:{minimum:To(e.minimum),maximum:To(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isBetweenDate({ minimum: ${Eo(e.minimum)}, maximum: ${Eo(e.maximum)}, exclusiveMinimum: ${O(t)}, exclusiveMaximum: ${O(n)} })`})}}}),KI=Gs({order:xt,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThanBigInt",payload:{exclusiveMinimum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanBigInt(${O(e)})`})})}),JI=Zs({order:xt,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThanOrEqualToBigInt",payload:{minimum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToBigInt(${O(e)})`})})}),WI=Vs({order:xt,annotate:(e)=>({representation:{id:"effect/schema/isLessThanBigInt",payload:{exclusiveMaximum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanBigInt(${O(e)})`})})}),GI=Ys({order:xt,annotate:(e)=>({representation:{id:"effect/schema/isLessThanOrEqualToBigInt",payload:{maximum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanOrEqualToBigInt(${O(e)})`})})}),ZI=Xs({order:xt,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: ${O(e.minimum)}, maximum: ${O(e.maximum)}, exclusiveMinimum: ${O(t)}, exclusiveMaximum: ${O(n)} })`})}}}),mk=Gs({order:cn,formatter:(e)=>Ht(e)}),hk=Zs({order:cn,formatter:(e)=>Ht(e)}),gk=Vs({order:cn,formatter:(e)=>Ht(e)}),xk=Ys({order:cn,formatter:(e)=>Ht(e)}),yk=Xs({order:cn,formatter:(e)=>Ht(e)});function nd(e,t){return e=Math.max(0,Math.floor(e)),ae((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})`}),[Qe]:!0,arbitrary:{constraint:{minLength:e}},...t})}var Sk=B("effect/schema/isMinLength",C({minLength:Ne}),({annotations:e,payload:t})=>nd(t.minLength,e));function VI(e){return nd(1,e)}function YI(e,t){return e=Math.max(0,Math.floor(e)),ae((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})`}),[Qe]:!0,arbitrary:{constraint:{maxLength:e}},...t})}var Ik=B("effect/schema/isMaxLength",C({maxLength:Ne}),({annotations:e,payload:t})=>YI(t.maxLength,e));function rd(e,t,n){return e=Math.max(0,Math.floor(e)),t=Math.max(0,Math.floor(t)),ae((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})`}),[Qe]:!0,arbitrary:{constraint:{minLength:e,maxLength:t}},...n})}var bk=B("effect/schema/isLengthBetween",C({minimum:Ne,maximum:Ne}),({annotations:e,payload:t})=>rd(t.minimum,t.maximum,e));function XI(e,t){return e=Math.max(0,Math.floor(e)),ae((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})`}),[Qe]:!0,arbitrary:{constraint:{minLength:e}},...t})}var wk=B("effect/schema/isMinSize",C({minSize:Ne}),({annotations:e,payload:t})=>XI(t.minSize,e));function QI(e,t){return e=Math.max(0,Math.floor(e)),ae((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})`}),[Qe]:!0,arbitrary:{constraint:{maxLength:e}},...t})}var Tk=B("effect/schema/isMaxSize",C({maxSize:Ne}),({annotations:e,payload:t})=>QI(t.maxSize,e));function eb(e,t,n){return e=Math.max(0,Math.floor(e)),t=Math.max(0,Math.floor(t)),ae((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})`}),[Qe]:!0,arbitrary:{constraint:{minLength:e,maxLength:t}},...n})}var Ek=B("effect/schema/isSizeBetween",C({minimum:Ne,maximum:Ne}),({annotations:e,payload:t})=>eb(t.minimum,t.maximum,e));function tb(e,t){return e=Math.max(0,Math.floor(e)),ae((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})`}),[Qe]:!0,arbitrary:{constraint:{minLength:e}},...t})}var vk=B("effect/schema/isMinProperties",C({minProperties:Ne}),({annotations:e,payload:t})=>tb(t.minProperties,e));function nb(e,t){return e=Math.max(0,Math.floor(e)),ae((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})`}),[Qe]:!0,arbitrary:{constraint:{maxLength:e}},...t})}var Ok=B("effect/schema/isMaxProperties",C({maxProperties:Ne}),({annotations:e,payload:t})=>nb(t.maxProperties,e));function rb(e,t,n){return e=Math.max(0,Math.floor(e)),t=Math.max(0,Math.floor(t)),ae((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})`}),[Qe]:!0,arbitrary:{constraint:{minLength:e,maxLength:t}},...n})}var Ak=B("effect/schema/isPropertiesLengthBetween",C({minimum:Ne,maximum:Ne}),({annotations:e,payload:t})=>rb(t.minimum,t.maximum,e));function ob(e,t){let n=Oo(e),r=xy(n.ast);return ae((o,s,i)=>{let a=Reflect.ownKeys(o),c=[];for(let u of a){let l=r(u,i);if(l!==void 0){if(c.push(new we([u],l)),i.errors==="first")break}}if(Bo(c))return new ge(s,c,o,i);return!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})`}),[Qe]:!0,...t})}var kk=B("effect/schema/isPropertyNames",te,({annotations:e,schemas:t})=>ob(t[0],e));function od(e){return ae((t)=>Ci(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 Rk=B("effect/schema/isUnique",te,({annotations:e})=>od(e)),_k=j.check(VI()),Ck=j.check(rd(1,1));function Kn(e){let t=rt()([e],([n])=>(r,o,s)=>{if(Jc(r)){if(Te(r))return ns;return _e(Se(n)(r.value,s),{onSuccess:H,onFailure:(i)=>et(o,"value",i,r,s)})}return _(new le(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])=>ie()(ve([C({_tag:ue("Some"),value:n}),C({_tag:ue("None")})]),fe({decode:(r)=>r._tag==="None"?V():H(r.value),encode:(r)=>Ve(r)?{_tag:"Some",value:r.value}:{_tag:"None"}})),toArbitrary:([n])=>(r,o)=>{let s=r.constant(V()),i=r.oneof(s,n.arbitrary.map(H));return _r(r,o,s,i)},toEquivalence:([n])=>Vd(n),toFormatter:([n])=>Ct({onNone:()=>"none()",onSome:(r)=>`some(${n(r)})`})});return k(t.ast,{value:e})}var Nk=ze("effect/schema/Option",te,({annotations:e,typeParameters:t})=>{let n=Kn(t[0]);return e===void 0?n:n.annotate(e)});function Pk(e){return Vf(e).pipe(q(Kn(He(e)),Qg()))}function Mk(e){return uc(e).pipe(q(Kn(He(e)),ex()))}function Fk(e,t){return uI(e).pipe(q(Kn(He(e)),tx(t)))}function Dk(e){return Or(e).pipe(q(Kn(He(e)),nx()))}function Uk(e){return Et(e).pipe(q(Kn(He(e)),rx()))}function $k(e,t){let n=t===void 0?"omit":t.onNoneEncoding,r=n===null?null:void 0;return Et(Vf(e)).pipe(q(Kn(He(e)),ka({decode:(o)=>o.pipe(Br(ci),H),encode:n==="omit"?qr:(o)=>H(Ai(qr(o),()=>r))})))}function sb(e,t){let n=rt()([e,t],([r,o])=>(s,i,a)=>{if(!Ei(s))return _(new le(i,s,a));switch(s._tag){case"Success":return _e(bf(r)(s.success,a),{onSuccess:z,onFailure:(c)=>et(i,"success",c,s,a)});case"Failure":return _e(bf(o)(s.failure,a),{onSuccess:X,onFailure:(c)=>et(i,"failure",c,s,a)})}},{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])=>ie()(ve([C({_tag:ue("Success"),success:r}),C({_tag:ue("Failure"),failure:o})]),fe({decode:(s)=>s._tag==="Success"?z(s.success):X(s.failure),encode:(s)=>gt(s)?{_tag:"Success",success:s.success}:{_tag:"Failure",failure:s.failure}})),toArbitrary:([r,o])=>(s,i)=>{let a=gb(s,r.terminal?.map((u)=>z(u)),o.terminal?.map((u)=>X(u))),c=s.oneof(r.arbitrary.map((u)=>z(u)),o.arbitrary.map((u)=>X(u)));return _r(s,i,a,c)},toEquivalence:([r,o])=>zc(r,o),toFormatter:([r,o])=>Ze({onSuccess:(s)=>`success(${r(s)})`,onFailure:(s)=>`failure(${o(s)})`})});return k(n.ast,{success:e,failure:t})}var Lk=ze("effect/schema/Result",te,({annotations:e,typeParameters:t})=>{let n=sb(t[0],t[1]);return e===void 0?n:n.annotate(e)}),jk=vt((e)=>{if(!De(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}})}),qk=ve([te,jk]);function sd(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?Se(ue(n)):void 0,i=rt()([e],([a])=>(c,u,l)=>{if(jf(c)){let d=s!==void 0?sa(s(c.label,l),(f)=>new we(["label"],f)):Ch;return ft(d,()=>_e(Se(a)(So(c),l),{onSuccess:()=>c,onFailure:()=>new ge(u,[new we(["value"],new K(void 0,c,l))],c,l)}))}return _(new le(u,c,l))},{representation:{id:"effect/schema/Redacted",payload:o??null},toCode:({typeParameters:a})=>({runtime:o!==void 0?`Schema.Redacted(${a[0].runtime}, ${O(o)})`:`Schema.Redacted(${a[0].runtime})`,Type:`Redacted.Redacted<${a[0].Type}>`,importDeclarations:['import * as Redacted from "effect/Redacted"']}),expected:"Redacted",toCodecJson:([a])=>ie()(a,{decode:J((c)=>zs(c,{label:n})),encode:r?Rl((c)=>"Cannot serialize Redacted"+(Ve(c)&&typeof c.value.label==="string"?` with label: "${c.value.label}"`:"")):J(So)}),toArbitrary:([a])=>()=>({arbitrary:a.arbitrary.map((c)=>zs(c,{label:n})),terminal:a.terminal?.map((c)=>zs(c,{label:n}))}),toFormatter:()=>globalThis.String,toEquivalence:([a])=>kS(a)});return k(i.ast,{value:e})}var Bk=ze("effect/schema/Redacted",qk,({annotations:e,payload:t,typeParameters:n})=>{let r=sd(n[0],t??void 0);return e===void 0?r:r.annotate(e)});function zk(e,t){return q(sd(He(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:J((n)=>zs(n,{label:t?.label})),encode:t?.disallowEncode?Rl((n)=>"Cannot encode Redacted"+(Ve(n)&&typeof n.value.label==="string"?` with label: "${n.value.label}"`:"")):J(So)})(e)}function nc(e,t){let n=rt()([e,t],([r,o])=>(s,i,a)=>{if(!Qm(s))return _(new le(i,s,a));switch(s._tag){case"Fail":return _e(Se(r)(s.error,a),{onSuccess:Gi,onFailure:(c)=>et(i,"error",c,s,a)});case"Die":return _e(Se(o)(s.defect,a),{onSuccess:Zi,onFailure:(c)=>et(i,"defect",c,s,a)});case"Interrupt":return L(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])=>ie()(ve([C({_tag:ue("Fail"),error:r}),C({_tag:ue("Die"),defect:o}),C({_tag:ue("Interrupt"),fiberId:uc(Bt)})]),fe({decode:(s)=>{switch(s._tag){case"Fail":return Gi(s.error);case"Die":return Zi(s.defect);case"Interrupt":return Vi(s.fiberId)}},encode:ne})),toArbitrary:([r,o])=>ib(r,o),toEquivalence:([r,o])=>ab(r,o),toFormatter:([r,o])=>cb(r,o)});return k(n.ast,{error:e,defect:t})}var Hk=ze("effect/schema/CauseReason",te,({annotations:e,typeParameters:t})=>{let n=nc(t[0],t[1]);return e===void 0?n:n.annotate(e)});function ib(e,t){return(n,r)=>{let o=n.constant(Vi()),s=n.oneof(o,n.integer({min:1}).map(Vi),e.arbitrary.map((i)=>Gi(i)),t.arbitrary.map((i)=>Zi(i)));return _r(n,r,o,s)}}function ab(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 cb(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 rc(e,t){let n=rt()([e,t],([r,o])=>{let s=Ie(nc(r,o));return(i,a,c)=>{if(!Xm(i))return _(new le(a,i,c));return _e(Se(s)(i.reasons,c),{onSuccess:Wi,onFailure:(u)=>et(a,"failures",u,i,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])=>ie()(Ie(nc(r,o)),fe({decode:Wi,encode:({reasons:s})=>s})),toArbitrary:([r,o])=>ub(r,o),toEquivalence:([r,o])=>lb(r,o),toFormatter:([r,o])=>fb(r,o)});return k(n.ast,{error:e,defect:t})}var Kk=ze("effect/schema/Cause",te,({annotations:e,typeParameters:t})=>{let n=rc(t[0],t[1]);return e===void 0?n:n.annotate(e)});function ub(e,t){return(n,r)=>{let o=ib(e,t)(n,r),s=n.constant(eh),i=n.array(o.arbitrary).map(Wi);return _r(n,r,s,i)}}function lb(e,t){let n=Id(ab(e,t));return(r,o)=>n(r.reasons,o.reasons)}function fb(e,t){let n=cb(e,t);return(r)=>`Cause([${r.reasons.map(n).join(", ")}])`}var Jk=vt((e)=>{if(!De(e))return!1;let t=globalThis.Object.keys(e);return t.length>0&&t.every((n)=>(n==="includeStack"||n==="excludeCause")&&e[n]===!0)}),Wk=ve([te,Jk]),db=(e)=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),pb=(e)=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},US=[];function mb(e){let t=db(e),n=US[t];if(n!==void 0)return n;let r=pb(t),o=Hn(globalThis.Error,{representation:{id:"effect/schema/Error",payload:r??null},toCode:()=>({runtime:r!==void 0?`Schema.ErrorInstance(${O(r)})`:"Schema.ErrorInstance()",Type:"globalThis.Error"}),expected:"Error",toCodecJson:()=>ie()(q_,Yg(r)),toArbitrary:()=>(s)=>s.string().map((i)=>new globalThis.Error(i))});return US[t]=o,o}var Gk=ze("effect/schema/Error",Wk,({annotations:e,payload:t})=>{let n=mb(t??void 0);return e===void 0?n:n.annotate(e)}),$S=[];function Zk(e){let t=db(e),n=$S[t];if(n!==void 0)return n;let r=oi.pipe(q(Jf,Xg(pb(t))));return $S[t]=r,r}function hb(e,t,n){let r=rt()([e,t,n],([o,s,i])=>{let a=rc(s,i);return(c,u,l)=>{if(!sh(c))return _(new le(u,c,l));switch(c._tag){case"Success":return _e(Se(o)(c.value,l),{onSuccess:ir,onFailure:(d)=>et(u,"value",d,c,l)});case"Failure":return _e(Se(a)(c.cause,l),{onSuccess:pn,onFailure:(d)=>et(u,"cause",d,c,l)})}}},{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,i])=>ie()(ve([C({_tag:ue("Success"),value:o}),C({_tag:ue("Failure"),cause:rc(s,i)})]),fe({decode:(a)=>a._tag==="Success"?ir(a.value):pn(a.cause),encode:(a)=>Xe(a)?{_tag:"Success",value:a.value}:{_tag:"Failure",cause:a.cause}})),toArbitrary:([o,s,i])=>(a,c)=>{let u=ub(s,i)(a,c),l=gb(a,o.terminal?.map((f)=>ir(f)),u.terminal?.map((f)=>pn(f))),d=a.oneof(o.arbitrary.map((f)=>ir(f)),u.arbitrary.map((f)=>pn(f)));return _r(a,c,l,d)},toEquivalence:([o,s,i])=>{let a=lb(s,i);return(c,u)=>{if(c._tag!==u._tag)return!1;switch(c._tag){case"Success":return o(c.value,u.value);case"Failure":return a(c.cause,u.cause)}}},toFormatter:([o,s,i])=>{let a=fb(s,i);return(c)=>{switch(c._tag){case"Success":return`Exit.Success(${o(c.value)})`;case"Failure":return`Exit.Failure(${a(c.cause)})`}}}});return k(r.ast,{value:e,error:t,defect:n})}var Vk=ze("effect/schema/Exit",te,({annotations:e,typeParameters:t})=>{let n=hb(t[0],t[1],t[2]);return e===void 0?n:n.annotate(e)});function gb(e,t,n){return t===void 0?n:n===void 0?t:e.oneof(t,n)}function _r(e,t,n,r){return{arbitrary:n===void 0||t.recursion===void 0?r:e.oneof(t.recursion,n,r),terminal:n}}function LS(e,t,n,r){return r===void 0?e.array(t,n):e.uniqueArray(t,{...n,comparator:r})}function dc(e,t,n,r,o,s){let i=t.constraint,a=i===void 0||i.minLength===void 0&&i.maxLength===void 0?void 0:{...i.minLength!==void 0?{minLength:i.minLength}:{},...i.maxLength!==void 0?{maxLength:i.maxLength}:{}};if(a?.minLength!==void 0&&a.maxLength!==void 0&&a.minLength>a.maxLength)throw new globalThis.Error("Unable to derive an arbitrary for size constraints");let c=a?.minLength??0,u=c===0?e.constant([]):r===void 0?void 0:LS(e,r,{...a,maxLength:c},s),l=_r(e,t,u,LS(e,n,a,s));return{arbitrary:l.arbitrary.map(o),terminal:l.terminal?.map(o)}}function xb(e,t,n,r,o){return dc(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],[i])=>N(s,i))}function yb(e,t){let n=rt()([e,t],([r,o])=>{let s=Ie(bo([r,o]));return(i,a,c)=>{if(i instanceof globalThis.Map)return _e(Se(s)([...i],c),{onSuccess:(u)=>new globalThis.Map(u),onFailure:(u)=>et(a,"entries",u,i,c)});return _(new le(a,i,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])=>ie()(Ie(bo([r,o])),fe({decode:(s)=>new globalThis.Map(s),encode:(s)=>[...s.entries()]})),toArbitrary:([r,o])=>(s,i)=>xb(s,i,r,o,(a)=>new globalThis.Map(a)),toEquivalence:([r,o])=>fi(r,o),toFormatter:([r,o])=>(s)=>{let i=s.size;if(i===0)return"ReadonlyMap(0) {}";let a=globalThis.Array.from(s.entries()).sort().map(([c,u])=>`${r(c)} => ${o(u)}`);return`ReadonlyMap(${i}) { ${a.join(", ")} }`}});return k(n.ast,{key:e,value:t})}var Yk=ze("effect/schema/ReadonlyMap",te,({annotations:e,typeParameters:t})=>{let n=yb(t[0],t[1]);return e===void 0?n:n.annotate(e)});function jS(e,t,n){return C({type:ue(e),nodes:Ie(C({index:Ne,data:t})),edges:Ie(C({index:Ne,source:Ne,target:Ne,data:n}))})}function qS(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 _(new we(["nodes",o,"index"],new K({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 _(new we(["edges",o,"index"],new K({expected:"a strictly increasing edge index"},s.index,t)));if(n=s.index,!r.has(s.source))return _(new we(["edges",o,"source"],new K({expected:"an encoded node index"},s.source,t)));if(!r.has(s.target))return _(new we(["edges",o,"target"],new K({expected:"an encoded node index"},s.target,t)))}return L(us(e))}function Xk(e,t,n){if(!ll(e)||e.mutable||e.type!==t)return _(new K({expected:`an immutable ${t} Graph`},e,n));return L(cs(e))}function Qk(e,t){return(n,r)=>{let o=cs(n),s=cs(r);if(o.type!==s.type||o.nodes.length!==s.nodes.length||o.edges.length!==s.edges.length)return!1;for(let i=0;i<o.nodes.length;i++)if(o.nodes[i].index!==s.nodes[i].index||!e(o.nodes[i].data,s.nodes[i].data))return!1;for(let i=0;i<o.edges.length;i++){let a=o.edges[i],c=s.edges[i],u=o.type==="directed"?a.source===c.source&&a.target===c.target:a.source===c.source&&a.target===c.target||a.source===c.target&&a.target===c.source;if(a.index!==c.index||!u||!t(a.data,c.data))return!1}return!0}}function eR(e,t,n){return(r,o)=>{let s=us({type:e,nodes:[],edges:[]}),i=r.constant(s),a=r.array(t.arbitrary).chain((c)=>{let u=c.map((d,f)=>({index:f,data:d}));if(u.length===0)return i;let l=r.integer({min:0,max:u.length-1});return r.array(r.tuple(l,l,n.arbitrary)).map((d)=>us({type:e,nodes:u,edges:d.map(([f,h,x],w)=>({index:w,source:f,target:h,data:x}))}))});return _r(r,o,i,a)}}function Sb(e,t,n){let r=rt()([t,n],([o,s])=>{let i=jS(e,o,s);return(a,c,u)=>{if(!ll(a)||a.mutable||a.type!==e)return _(new le(c,a,u));return Jt(Se(i)(cs(a),u),(l)=>qS(l,u))}},{representation:{id:"effect/schema/Graph",payload:e},toCode:({typeParameters:o})=>({runtime:`Schema.Graph(${O(e)}, ${o[0].runtime}, ${o[1].runtime})`,Type:`Graph.Graph<${o[0].Type}, ${o[1].Type}, ${O(e)}>`,importDeclarations:['import * as Graph from "effect/Graph"']}),expected:`an immutable ${e} Graph`,toCodec:([o,s])=>ie()(jS(e,o,s),dt({decode:qS,encode:(i,a)=>Xk(i,e,a)})),toArbitrary:([o,s])=>eR(e,o,s),toEquivalence:([o,s])=>Qk(o,s),toFormatter:()=>globalThis.String});return k(r.ast,{type:e,node:t,edge:n})}var tR=ze("effect/schema/Graph",Ws(["directed","undirected"]),({annotations:e,payload:t,typeParameters:n})=>{let r=Sb(t,n[0],n[1]);return e===void 0?r:r.annotate(e)});function Ib(e,t){let n=rt()([e,t],([r,o])=>{let s=Ie(bo([r,o]));return(i,a,c)=>{if(ig(i))return _e(Se(s)(ga(i),c),{onSuccess:ha,onFailure:(u)=>et(a,"entries",u,i,c)});return _(new le(a,i,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])=>ie()(Ie(bo([r,o])),fe({decode:ha,encode:ga})),toArbitrary:([r,o])=>(s,i)=>xb(s,i,r,o,ha),toEquivalence:([r,o])=>fi(r,o),toFormatter:([r,o])=>(s)=>{let i=ag(s);if(i===0)return"HashMap(0) {}";let a=ga(s).sort().map(([c,u])=>`${r(c)} => ${o(u)}`);return`HashMap(${i}) { ${a.join(", ")} }`}});return k(n.ast,{key:e,value:t})}var nR=ze("effect/schema/HashMap",te,({annotations:e,typeParameters:t})=>{let n=Ib(t[0],t[1]);return e===void 0?n:n.annotate(e)});function bb(e){let t=rt()([e],([n])=>{let r=Ie(n);return(o,s,i)=>{if(o instanceof globalThis.Set)return _e(Se(r)([...o],i),{onSuccess:(a)=>new globalThis.Set(a),onFailure:(a)=>et(s,"values",a,o,i)});return _(new le(s,o,i))}},{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])=>ie()(Ie(n),fe({decode:(r)=>new globalThis.Set(r),encode:(r)=>[...r.values()]})),toArbitrary:([n])=>(r,o)=>dc(r,o,n.arbitrary,n.terminal,(s)=>new globalThis.Set(s),N),toEquivalence:([n])=>di(n),toFormatter:([n])=>(r)=>{let o=r.size;if(o===0)return"ReadonlySet(0) {}";let s=globalThis.Array.from(r.values()).sort().map((i)=>`${n(i)}`);return`ReadonlySet(${o}) { ${s.join(", ")} }`}});return k(t.ast,{value:e})}var rR=ze("effect/schema/ReadonlySet",te,({annotations:e,typeParameters:t})=>{let n=bb(t[0]);return e===void 0?n:n.annotate(e)});function wb(e){let t=rt()([e],([n])=>{let r=Ie(n);return(o,s,i)=>{if(fg(o))return _e(Se(r)(it(o),i),{onSuccess:ya,onFailure:(a)=>et(s,"values",a,o,i)});return _(new le(s,o,i))}},{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])=>ie()(Ie(n),fe({decode:ya,encode:it})),toArbitrary:([n])=>(r,o)=>dc(r,o,n.arbitrary,n.terminal,ya,N),toEquivalence:([n])=>di(n),toFormatter:([n])=>(r)=>{let o=dg(r);if(o===0)return"HashSet(0) {}";let s=globalThis.Array.from(r).sort().map((i)=>`${n(i)}`);return`HashSet(${o}) { ${s.join(", ")} }`}});return k(t.ast,{value:e})}var oR=ze("effect/schema/HashSet",te,({annotations:e,typeParameters:t})=>{let n=wb(t[0]);return e===void 0?n:n.annotate(e)});function Tb(e){let t=rt()([e],([n])=>{let r=Ie(n);return(o,s,i)=>{if(Qi(o))return _e(Se(r)(it(o),i),{onSuccess:ea,onFailure:(a)=>et(s,"values",a,o,i)});return _(new le(s,o,i))}},{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])=>ie()(Ie(n),fe({decode:ea,encode:it})),toArbitrary:([n])=>(r,o)=>dc(r,o,n.arbitrary,n.terminal,ea),toEquivalence:([n])=>ju(n),toFormatter:([n])=>(r)=>{let o=oh(r);if(o===0)return"Chunk(0) {}";let s=globalThis.Array.from(r).sort().map((i)=>`${n(i)}`);return`Chunk(${o}) { ${s.join(", ")} }`}});return k(t.ast,{value:e})}var sR=ze("effect/schema/Chunk",te,({annotations:e,typeParameters:t})=>{let n=Tb(t[0]);return e===void 0?n:n.annotate(e)}),Eb=Hn(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>ie()(C({source:j,flags:j}),dt({decode:(e,t)=>os({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new K({expected:"valid RegExp source and flags"},e,t)}),encode:(e)=>L({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}),iR=Le("effect/schema/RegExp",Eb),vb=j.annotate({expected:"a string that will be decoded as a URL"}),id=Hn(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>ie()(vb,Ul),toArbitrary:()=>(e)=>e.webUrl().map((t)=>new globalThis.URL(t)),toEquivalence:()=>(e,t)=>e.toString()===t.toString()}),aR=Le("effect/schema/URL",id),cR=vb.pipe(q(id,Ul));function ad(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;if(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;if(r.max===void 0||s.getTime()<r.max.getTime())r.max=s}return r}var Ob=j.annotate({expected:"a string that will be decoded as a Date"}),zt=vt((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:()=>ie()(Ob,Dl),toArbitrary:()=>(e,t)=>e.date(ad(t?.constraint?.ordered?.order===tr?t.constraint.ordered:void 0,{noInvalidDate:!0}))}),uR=Le("effect/schema/Date",zt),lR=Ob.pipe(q(zt,Dl)),fR=Rr.pipe(q(zt,Hg)),ei=vt(fu,{representation:{id:"effect/schema/Duration",payload:null},toCode:()=>({runtime:"Schema.Duration",Type:"Duration.Duration",importDeclarations:['import * as Duration from "effect/Duration"']}),expected:"Duration",toCodecJson:()=>ie()(ve([C({_tag:ue("Infinity")}),C({_tag:ue("NegativeInfinity")}),C({_tag:ue("Nanos"),value:Xt}),C({_tag:ue("Millis"),value:Rr})]),fe({decode:(e)=>{switch(e._tag){case"Infinity":return Ko;case"NegativeInfinity":return Jo;case"Nanos":return Pn(e.value);case"Millis":return rr(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(Ko),e.constant(Jo),e.bigInt().map(Pn),e.maxSafeInteger().map(rr)),toFormatter:()=>globalThis.String,toEquivalence:()=>du}),dR=Le("effect/schema/Duration",ei),pR=j.annotate({expected:"a string that will be decoded as a Duration"}),mR=pR.pipe(q(ei,Kg)),hR=Xt.pipe(q(ei,Jg)),gR=cc.pipe(q(ei,Wg)),Ab=j.annotate({expected:"a string that will be decoded as a BigDecimal"}),kb=20,Rb="Unable to derive an arbitrary for the ordered BigDecimal constraints";function oc(e,t){return Nn(e,t).value}function xR(e,t,n){return n?oc(nu(e,t),t)+globalThis.BigInt(1):oc(tu(e,t),t)}function yR(e,t,n){return n?oc(tu(e,t),t)-globalThis.BigInt(1):oc(nu(e,t),t)}function SR(e){return Math.max(kb,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 Bf(e,t){let n={};if(e.minimum!==void 0)n.min=xR(e.minimum,t,e.exclusiveMinimum===!0);if(e.maximum!==void 0)n.max=yR(e.maximum,t,e.exclusiveMaximum===!0);if(n.min!==void 0&&n.max!==void 0&&n.min>n.max)return;return n}function IR(e){let t=SR(e);if(Bf(e,t)===void 0)throw new globalThis.Error(Rb);let n=0,r=t;while(n<r){let o=n+Math.floor((r-n)/2);if(Bf(e,o)===void 0)n=o+1;else r=o}return{min:n,max:t}}var cd=vt(Pi,{representation:{id:"effect/schema/BigDecimal",payload:null},toCode:()=>({runtime:"Schema.BigDecimal",Type:"BigDecimal.BigDecimal",importDeclarations:['import * as BigDecimal from "effect/BigDecimal"']}),expected:"BigDecimal",toCodecJson:()=>ie()(Ab,$l),toArbitrary:()=>(e,t)=>{let n=t.constraint?.ordered?.order===cn?t.constraint.ordered:void 0;if(n===void 0)return e.tuple(e.bigInt(),e.integer({min:0,max:kb})).map(([r,o])=>Ye(r,o));return e.integer(IR(n)).chain((r)=>{let o=Bf(n,r);if(o===void 0)throw new globalThis.Error(Rb);return e.bigInt(o).map((s)=>Ye(s,r))})},toFormatter:()=>(e)=>Ht(e),toEquivalence:()=>Qc}),bR=Le("effect/schema/BigDecimal",cd),wR=Ab.pipe(q(cd,$l)),TR=j.annotate({expected:"a string that will be decoded as JSON",contentMediaType:"application/json"});function _b(e,t){return TR.pipe(q(e,cx(t)))}var ER=_b(Jf),ud=Hn(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>ie()(C({data:j.check(ed()),type:j,name:j,lastModified:Rr}),dt({decode:(e,t)=>Ze(Hr(e.data),{onFailure:()=>_(new K({expected:"a valid Base64 string"},e.data,t)),onSuccess:(n)=>{let r=new globalThis.Uint8Array(n);return L(new globalThis.File([r],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>_h({try:async()=>{let n=new globalThis.Uint8Array(await e.arrayBuffer());return{data:ji(n),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new K({expected:"a readable File"},e,t)})}))}),vR=Le("effect/schema/File",ud),ld=Hn(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>ie()(Ie(bo([j,ve([C({_tag:Ar("String"),value:j}),C({_tag:Ar("File"),value:ud})])])),dt({decode:(e)=>{let t=new globalThis.FormData;for(let[n,r]of e)t.append(n,r.value);return L(t)},encode:(e)=>L(globalThis.Array.from(e.entries()).map(([t,n])=>{if(typeof n==="string")return[t,{_tag:"String",value:n}];else return[t,{_tag:"File",value:n}]}))}))}),OR=Le("effect/schema/FormData",ld);function AR(e){return ld.pipe(q(e,ux))}var fd=Hn(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>ie()(j.annotate({expected:"a query string that will be decoded as URLSearchParams"}),fe({decode:(e)=>new globalThis.URLSearchParams(e),encode:(e)=>e.toString()}))}),kR=Le("effect/schema/URLSearchParams",fd);function RR(e){return fd.pipe(q(e,lx))}var _R=j.annotate({expected:"a string that will be decoded as a number"}).pipe(q(cc,oo)),CR=j.annotate({expected:"a string that will be decoded as a finite number"}).pipe(q(Bt,oo)),NR=k(xf).pipe(q(Xt,Ra)),Cb=j.check(Qf()),PR=j.annotate({expected:"a string that will be decoded as a trimmed string"}).pipe(q(Cb,zg())),MR=j.annotate({expected:"a base64 encoded string that will be decoded as a UTF-8 string"}).pipe(q(j,ox)),FR=j.annotate({expected:"a base64 (URL) encoded string that will be decoded as a UTF-8 string"}).pipe(q(j,sx)),DR=j.annotate({expected:"a hex encoded string that will be decoded as a UTF-8 string"}).pipe(q(j,ix)),UR=j.annotate({expected:"a URI component encoded string that will be decoded as a UTF-8 string"}).pipe(q(j,ax)),zf=ve([Bt,iI,j]),$R=C({issues:Ie(C({message:j,path:Et(Ie(ve([zf,C({key:zf})])))}))}),LR=Ws([0,1]).pipe(q(sI,fe({decode:(e)=>e===1,encode:(e)=>e?1:0}))),Nb=j.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),ti=Hn(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>ie()(Nb,Ll),toArbitrary:()=>(e)=>e.uint8Array()}),jR=Le("effect/schema/Uint8Array",ti),qR=Nb.pipe(q(ti,Ll)),BR=j.annotate({expected:"a base64 (URL) encoded string that will be decoded as a Uint8Array"}).pipe(q(ti,{decode:Cg(),encode:va()})),zR=j.annotate({expected:"a hex encoded string that will be decoded as a Uint8Array"}).pipe(q(ti,{decode:Pg(),encode:Oa()})),ni=vt((e)=>ol(e)&&jh(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:()=>ie()(j,Bl),toArbitrary:()=>(e,t)=>e.date(ad(t?.constraint?.ordered?.order===il?t.constraint.ordered:void 0,{noInvalidDate:!0},ca)).map((n)=>Bh(n)),toFormatter:()=>(e)=>e.toString(),toEquivalence:()=>sl}),HR=Le("effect/schema/DateTimeUtc",ni),KR=zt.pipe(q(ni,{decode:Ml(),encode:J(ca)})),JR=j.annotate({expected:"a string that will be decoded as a DateTime.Utc"}).pipe(q(ni,Bl)),WR=Rr.pipe(q(ni,{decode:Ml(),encode:J(Wh)})),Pb=vt($h,{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:()=>ie()(Rr,fx),toArbitrary:()=>(e)=>e.integer({min:-43200000,max:50400000}).map((t)=>as(t)),toFormatter:()=>(e)=>Dn(e),toEquivalence:()=>(e,t)=>e.offset===t.offset}),GR=Le("effect/schema/TimeZoneOffset",Pb),Mb=j.annotate({expected:"an IANA time zone identifier"}),dd=vt(Lh,{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:()=>ie()(Mb,jl),toArbitrary:()=>(e)=>e.constantFrom(...["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"].map(al)),toFormatter:()=>(e)=>Dn(e),toEquivalence:()=>(e,t)=>e.id===t.id}),ZR=Le("effect/schema/TimeZoneNamed",dd),VR=Mb.pipe(q(dd,jl)),Fb=j.annotate({expected:"a time zone string (IANA identifier or offset like +03:00)"}),pd=vt(Uh,{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:()=>ie()(Fb,ql),toArbitrary:()=>(e)=>e.oneof(e.integer({min:-43200000,max:50400000}).map((t)=>as(t)),e.constantFrom(...["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"].map(al))),toFormatter:()=>(e)=>Dn(e),toEquivalence:()=>(e,t)=>Dn(e)===Dn(t)}),YR=Le("effect/schema/TimeZone",pd),XR=Fb.pipe(q(pd,ql)),Db=j.annotate({expected:"a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])"}),md=vt((e)=>ol(e)&&qh(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:()=>ie()(Db,zl),toArbitrary:()=>(e,t)=>e.tuple(e.date(ad(t?.constraint?.ordered?.order===il?t.constraint.ordered:void 0,{max:new globalThis.Date(8639999949600000),min:new globalThis.Date(-8639999949600000),noInvalidDate:!0},ca)),e.constantFrom("UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney")).map(([n,r])=>zh(n,{timeZone:r})),toFormatter:()=>(e)=>ua(e),toEquivalence:()=>sl}),QR=Le("effect/schema/DateTimeZoned",md),e_=Db.pipe(q(md,zl)),t_=globalThis.Symbol.for("immer-draftable"),Hf={};function hd(e,t,n,r,o){let s=r_(n,t,r),i=Ub(t),a=class extends e{constructor(...[c,u]){let d=u?.["~payload"],f=d?.token===Hf?d.value:n.make(c??{},u);super(f,{...u,disableChecks:!0,"~payload":{token:Hf,value:f}})}static[Hs]=Hs;get[i](){return i}static[t_]=!0;static identifier=t;static fields=n.fields;static get ast(){return s(this).ast}static pipe(){return re(this,arguments)}static rebuild(c){return s(this).rebuild(c)}static make(c,u){return new this(c,u)}static makeOption(c,u){return Ja(s(this))(c??{},u)}static makeEffect(c,u){return s(this).makeEffect(c??{},u)}static annotate(c){return this.rebuild(bt(this.ast,c))}static annotateKey(c){return this.rebuild(Ps(this.ast,c))}static check(...c){return this.rebuild(Vt(this.ast,c))}static extend(c){return(u,l)=>{let d=ri(u)?u:C(u),f={...n.fields,...d.fields},h=Ma(f,n.ast.checks,{identifier:c});return hd(this,c,Gf(Vt(h,d.ast.checks),f),l,o)}}static mapFields(c,u){return n.mapFields(c,u)}};if(o!==void 0)Object.assign(a.prototype,o(t));return a}function n_(e){return new ee(J((t)=>new e(t,{"~payload":{token:Hf,value:t}})),Mt())}function Ub(e){return`~effect/Schema/Class/${e}`}function r_(e,t,n){let r;return(o)=>{if(r!==void 0)return r;let s=Ub(t),i=(u)=>u instanceof o||D(u,s),a=n_(o),c=k(new yr([e.ast],()=>(u,l,d)=>i(u)?L(u):_(new le(l,u,d)),{identifier:t,[Sa]:([u])=>({isConstructed:i,link:new de(u,a)}),toCodec:([u])=>new de(u.ast,a),toArbitrary:([u])=>()=>({arbitrary:u.arbitrary.map((l)=>new o(l)),terminal:u.terminal?.map((l)=>new o(l))}),toFormatter:([u])=>(l)=>`${o.identifier}(${u(l)})`,[gs]:io(e.ast),...n}));return r=q(c,a)(e)}}function ri(e){return ac(e)}var $b=(e)=>(t,n)=>{let r=ri(t)?t:C(t);return hd(Up,e,r,n,(o)=>({toString(){return`${o}(${O({...this})})`}}))},o_=(e)=>(t,n,r)=>{let o=ri(n)?n.mapFields((s)=>({_tag:Ar(t),...s}),{unsafePreserveChecks:!0}):lc(t,n);return $b(e??t)(o,r)},Lb=(e)=>(t,n)=>{let r=ri(t)?t:C(t);return hd(yi,e,r,n,(s)=>({name:s}))},s_=(e)=>(t,n,r)=>{let o=ri(n)?n.mapFields((s)=>({_tag:Ar(t),...s}),{unsafePreserveChecks:!0}):lc(t,n);return Lb(e??t)(o,r)};function i_(e){let t=Qy(e.ast);return(n)=>t(n,{})}function a_(e){return(t)=>t.annotate({toFormatter:e})}function c_(e,t){return n(e.ast);function n(o){let s=Gt(o)?.toFormatter;if(typeof s==="function")return s(qn(o)?o.typeParameters.map(n):[]);if(t?.onBefore){let i=t.onBefore(o,n);if(i!==void 0)return i}return r(o)}function r(o){switch(o._tag){default:return O;case"Never":return()=>"never";case"Void":return()=>"void";case"Arrays":{let s=o.elements.map(n),i=o.rest.map(n);return(a)=>{let c=[],u=0;for(;u<s.length;u++)if(a.length<u+1){if(xe(o.elements[u]))continue}else c.push(s[u](a[u]));if(i.length>0){let[l,...d]=i;for(;u<a.length-d.length;u++)c.push(l(a[u]));for(let f=0;f<d.length;f++)c.push(d[f](a[u+f]))}return"["+c.join(", ")+"]"}}case"Objects":{let s=o.propertySignatures.map((a)=>n(a.type)),i=o.indexSignatures.map((a)=>n(a.type));if(o.propertySignatures.length===0&&o.indexSignatures.length===0)return O;return(a)=>{let c=[],u=new Set;for(let l=0;l<s.length;l++){let d=o.propertySignatures[l],f=d.name;if(u.add(f),xe(d.type)&&!Object.hasOwn(a,f))continue;c.push(`${tn(f)}: ${s[l](a[f])}`)}for(let l=0;l<i.length;l++){let d=gr(a,o.indexSignatures[l].parameter);for(let f of d){if(u.has(f))continue;u.add(f),c.push(`${tn(f)}: ${i[l](a[f])}`)}}return c.length>0?"{ "+c.join(", ")+" }":"{}"}}case"Union":{let s=Ce(o).types,i=(c)=>ks(c,s),a=new Map(s.map((c,u)=>[c,[Fs(c),n(o.types[u])]]));return(c)=>{let u=i(c);for(let l=0;l<u.length;l++){let[d,f]=a.get(u[l]);if(d(c))return f(c)}return O(c)}}case"Suspend":{let s=Sr(()=>n(o.thunk()));return(i)=>s()(i)}}}}function u_(e){return(t)=>t.annotate({toEquivalence:e})}function l_(e){return eS(e.ast)}function f_(e,t){return Df(e.ast,t)}function jb(e,t){let n=Df(pc(e.ast),t);return hS(n,t)}function qb(e){return k(pc(e.ast),{schema:e})}var pc=Ir((e)=>{let t=p_(e,pc),n=e.context;if(t===e||n===void 0)return t;return qa(t,gd(n))});function gd(e){return e.constructorDefault===void 0?e:new Dt(e.isOptional,e.isMutable,void 0,e.annotations)}function Bb(e){if(e.propertySignatures.some((t)=>typeof t.name!=="string"))throw new globalThis.Error("Objects property names must be strings",{cause:e})}function zb(e){return(t)=>{let n=new Map;for(let s=0;s<t.length;s++)n.set(nt(t[s]),s);let r=[...t].sort((s,i)=>{s=nt(s),i=nt(i);let a=e(s),c=e(i);if(a!==c)return a-c;return n.get(s)-n.get(i)});if(!r.some((s,i)=>s!==t[i]))return t;return r}}var d_=zb((e)=>{switch(e._tag){case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function p_(e,t){switch(e._tag){case"Declaration":{let n=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!Ke(n))return se(e,[Sf]);let r=e.typeParameters.map((s)=>Us(nt(s))),o=n(r);return o===void 0?e:se(e,[lo(o,t)])}case"Unknown":return se(e,[Sf]);case"ObjectKeyword":return se(e,[py]);case"Undefined":case"Void":case"Literal":case"Number":return e.toCodecJson();case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return Bb(e),e.recur(t,Ha);case"Union":{let n=d_(e.types);if(n!==e.types)return new Be(n,e.mode,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t);return e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}function Hb(e){return k(Kb(Ce(e.ast)))}var Kb=Fe((e)=>{let t=m_(e,Kb);return t!==e&&e.context!==void 0?qa(t,gd(e.context)):t});function m_(e,t){switch(e._tag){case"Declaration":{let n=e.annotations?.toCodecIso??e.annotations?.toCodec;if(Ke(n)){let r=n(e.typeParameters.map((o)=>Us(o)));return se(e,[lo(r,t)])}return e}case"Arrays":case"Objects":case"Union":case"Suspend":return e.recur(t)}return e}function Jb(e){return k(Zb(e.ast),{schema:e})}function h_(e){return k(Vb(e.ast))}function g_(e,t){let n=Qr(e.ast)??Sl(e.ast),r=QS(Jb(e));return(o)=>r(o).pipe(Mh((s)=>x_(s,{rootName:n,...t})))}function x_(e,t){let n=t.rootName??"root",r=t.arrayItemName??"item",o=t.pretty??!0,s=t.indent??" ",i=t.sortKeys??!0,a=new Set,c=[];return l(n,e,0),c.join(o?`
|
|
26
|
-
`:"");function u(d,f){c.push(o?s.repeat(d)+f:f)}function l(d,f,h,x){let{attrs:w,safe:p}=Io.tagInfo(d,x);if(f===void 0)u(h,`<${p}${w}/>`);else if(typeof f==="string")u(h,`<${p}${w}>${Io.escapeText(f)}</${p}>`);else if(typeof f!=="object"||f===null)u(h,`<${p}${w}>${Io.escapeText(O(f))}</${p}>`);else{if(a.has(f))throw new globalThis.Error("Cycle detected while serializing to XML.",{cause:f});a.add(f);try{if(globalThis.globalThis.Array.isArray(f)){if(f.length===0){u(h,`<${p}${w}/>`);return}u(h,`<${p}${w}>`);for(let g of f)l(r,g,h+1);u(h,`</${p}>`);return}let S=f,E=Object.keys(S);if(i)E.sort();if(E.length===0){u(h,`<${p}${w}/>`);return}u(h,`<${p}${w}>`);for(let g of E)l(Io.parseTagName(g).safe,S[g],h+1,g);u(h,`</${p}>`)}finally{a.delete(f)}}}}var Io={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;if(!/^[A-Za-z_]/.test(n))n="_"+n;if(n=n.replace(/[^A-Za-z0-9._-]/g,"_"),/^xml/i.test(n))n="_"+n;return{safe:n,changed:n!==t}},tagInfo(e,t){let{changed:n,safe:r}=Io.parseTagName(e),s=n||t&&t!==e?` data-name="${Io.escapeAttribute(t??e)}"`:"";return{safe:r,attrs:s}}},y_=zb((e)=>{switch(e._tag){case"Null":case"Boolean":case"Number":case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function S_(e,t,n){switch(e._tag){case"Declaration":{let r=e.typeParameters.map((u)=>k(t(nt(u)))),o=e.annotations?.toCodecStringTree;if(Ke(o)){let u=o(r);if(u===void 0)return e;return se(e,[lo(u,t)])}let s=e.annotations?.toCodecJson,i=Ke(s)?s(r):void 0,a=i===void 0?e.annotations?.toCodec:void 0,c=i??(Ke(a)?a(r):void 0);return c===void 0?n(e):se(e,[lo(c,t)])}case"Null":return se(e,[I_]);case"Boolean":return se(e,[b_]);case"Unknown":case"ObjectKeyword":return se(e,[If]);case"Enum":case"Number":case"Literal":case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return Bb(e),e.recur(t,Ha);case"Union":{let r=y_(e.types);if(r!==e.types)return new Be(r,e.mode,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t);return e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}var I_=new de(new pt("null"),new ee(J(()=>null),J(()=>"null"))),b_=new de(new Be([new pt("true"),new pt("false")],"anyOf"),new ee(J((e)=>e==="true"),hr())),Wb=new ee(J((e)=>typeof e==="string"?[e]:e),Mt()),Gb=(e)=>e.transformation===Wb,Zb=Ir((e)=>{let t=S_(e,Zb,(n)=>{throw new globalThis.Error("Missing structural codec for StringTree",{cause:n})});if(t!==e&&e.context!==void 0)return qa(t,gd(e.context));return t},{stopAt:Gb}),BS=(e)=>xe(e)?fo(xn):xn,Vb=Ir((e)=>{let t=w_(e);if(Yl(t)){let n=Ba(new Be([new Ut(t.isMutable,t.elements.map(BS),t.rest.map(BS)),Zt],"anyOf"),t,Wb);return xe(e)?fo(n):n}return t},{stopAt:Gb});function w_(e){return e._tag==="Declaration"||e._tag==="Arrays"||e._tag==="Objects"||e._tag==="Union"||e._tag==="Suspend"?e.recur(Vb):e}var T_=B("effect/schema/isGreaterThanDate",C({exclusiveMinimum:zt}),({annotations:e,payload:t})=>jI(t.exclusiveMinimum,e)),E_=B("effect/schema/isGreaterThanOrEqualToDate",C({minimum:zt}),({annotations:e,payload:t})=>qI(t.minimum,e)),v_=B("effect/schema/isLessThanDate",C({exclusiveMaximum:zt}),({annotations:e,payload:t})=>BI(t.exclusiveMaximum,e)),O_=B("effect/schema/isLessThanOrEqualToDate",C({maximum:zt}),({annotations:e,payload:t})=>zI(t.maximum,e)),A_=B("effect/schema/isBetweenDate",C({minimum:zt,maximum:zt,exclusiveMinimum:Et(ue(!0)),exclusiveMaximum:Et(ue(!0))}),({annotations:e,payload:t})=>HI(t,e)),k_=B("effect/schema/isGreaterThanBigInt",C({exclusiveMinimum:Xt}),({annotations:e,payload:t})=>KI(t.exclusiveMinimum,e)),R_=B("effect/schema/isGreaterThanOrEqualToBigInt",C({minimum:Xt}),({annotations:e,payload:t})=>JI(t.minimum,e)),__=B("effect/schema/isLessThanBigInt",C({exclusiveMaximum:Xt}),({annotations:e,payload:t})=>WI(t.exclusiveMaximum,e)),C_=B("effect/schema/isLessThanOrEqualToBigInt",C({maximum:Xt}),({annotations:e,payload:t})=>GI(t.maximum,e)),N_=B("effect/schema/isBetweenBigInt",C({minimum:Xt,maximum:Xt,exclusiveMinimum:Et(ue(!0)),exclusiveMaximum:Et(ue(!0))}),({annotations:e,payload:t})=>ZI(t,e));function P_(e){let t=Hb(e);return wS(vf(t),Tf(t))}function M_(e){return tc()}function F_(e){return tc()}function D_(e,t){return(n)=>k(bt(n.ast,{toCodecIso:()=>new de(e.ast,Aa(t))}),{schema:n})}function U_(e){let t=qb(e),n=vf(t),r=Tf(t);return{empty:[],diff:(o,s)=>xS(n(o),n(s)),combine:(o,s)=>[...o,...s],patch:(o,s)=>{let i=n(o),a=yS(s,i);return Object.is(a,i)?o:r(a)}}}function $_(e){let t=lI(()=>n),n=ve([e,Ie(t),Zf(j,t)]);return n}var oi=k(bt(co,{toCode:()=>({runtime:"Schema.Json",Type:"Schema.Json"})})),L_=Zf(j,oi),j_=Le("effect/schema/Json",oi),q_=C({message:j,name:Or(j),stack:Or(j),cause:Or(oi)}),Yb=k(bt(dy,{toCode:()=>({runtime:"Schema.MutableJson",Type:"Schema.MutableJson"})})),B_=Le("effect/schema/MutableJson",Yb);function z_(e){return Gt(e.ast)}function H_(e){return e.ast.context?.annotations}import{accessSync as K_,constants as J_,realpathSync as tw}from"node:fs";import{createRequire as W_}from"node:module";import ew from"node:path";import{fileURLToPath as G_}from"node:url";var Xb=(e)=>{let t=e?.trim();return t===void 0||t.length===0?void 0:t},Qb=()=>({bunExecutable:Xb(process.env.TRIPWIRE_BUN),forcePortable:process.env.TRIPWIRE_FORCE_PORTABLE==="1",packageDist:Xb(process.env.TRIPWIRE_PACKAGE_DIST)});var Z_=["@seanmozeik","tripwire-darwin-arm64"].join("/"),V_=(e)=>{try{return K_(e,J_.X_OK),tw(e)}catch{return}},Y_=(e,t)=>{try{let n=t?.()??W_(e).resolve(Z_);return V_(n)}catch{return}},X_=(e)=>{let t=G_(e),n=t;try{n=tw(t)}catch{}return ew.join(ew.dirname(n),"tripwire.js")},nw=(e={})=>{let t=e.moduleUrl??import.meta.url,n=e.platform??process.platform,r=e.architecture??process.arch,o=Qb();if(!o.forcePortable&&n==="darwin"&&r==="arm64"){let s=Y_(t,e.nativeResolver);if(s!==void 0)return{arguments:[],executable:s,kind:"native"}}return{arguments:[e.portableExecutable??X_(t)],executable:e.bunExecutable??o.bunExecutable??"bun",kind:"portable"}};var oC=Oe.Struct({input:Oe.Record(Oe.String,Oe.Unknown),toolCallId:Oe.String,toolName:Oe.String}),sC=Oe.Struct({input:Oe.Record(Oe.String,Oe.Unknown),toolCallId:Oe.String,toolName:Oe.String,content:Oe.Unknown,details:Oe.Unknown,isError:Oe.Boolean}),iC=Oe.Union([sC,oC]),rw=60000,aC=(e=import.meta.url)=>{let t=nC(e),n=t;try{n=tC(t)}catch{}return nw({moduleUrl:rC(n)})},cC=aC(),mc=(e,t,n)=>{for(let r of t){let o=e[r];if(typeof o==="string")return o}throw Error(`Pi ${n} is missing`)},uC=(e,t)=>{let n=e[t];return Array.isArray(n)?n.filter((r)=>typeof r==="string"):[]},lC=(e)=>{let{edits:t}=e;if(Array.isArray(t)){let n=[],r=[];for(let o of t)if(hc(o)){let s=Ae(o,"oldText")??Ae(o,"old_string"),i=Ae(o,"newText")??Ae(o,"new_string");if(s!==void 0)n.push(s);if(i!==void 0)r.push(i)}return{old_string:n.join(`
|
|
27
|
-
`),new_string:r.join(`
|
|
28
|
-
`)}}return{old_string:Ae(e,"oldText")??Ae(e,"old_string")??"",new_string:Ae(e,"newText")??Ae(e,"new_string")??Ae(e,"input")??Ae(e,"_input")??""}},fC=(e,t,n)=>{let r;if(e.startsWith("+"))r="newLines";else if(e.startsWith("-"))r="oldLines";if(r!==void 0)for(let o of t)n.get(o)?.[r].push(e.slice(1))},dC=(e)=>{let t=/^\*{3}\s+(?:Add|Update|Delete)\s+File\s*:\s*(?<path>\S.*?)\s*$/u,n=/^\*{3}\s+Move\s+to\s*:\s*(?<path>\S.*?)\s*$/u,r=new Map,o=[],s="*** Begin Patch",i="*** End Patch",a=e.split(/\r?\n/u),c=a.findIndex((h)=>h.trim()===s);if(c===-1)return[];let u=a.slice(c+1),l=[...u,i].findIndex((h)=>h.trim()===i),d=u.slice(0,l),f=(h)=>{if(o.push(h),!r.has(h))r.set(h,{newLines:[],oldLines:[]})};for(let h of d){let w=t.exec(h)?.groups?.path?.trim();if(w!==void 0&&w.length>0)o=[],f(w);else if(o.length>0){let S=n.exec(h)?.groups?.path?.trim();if(S!==void 0&&S.length>0)f(S);else fC(h,o,r)}}return[...r].map(([h,x])=>({file_path:h,new_string:x.newLines.join(`
|
|
29
|
-
`),old_string:x.oldLines.join(`
|
|
30
|
-
`)}))},pC=(e)=>{let{input:t,toolName:n}=e;if(n==="bash"||n==="powershell")return[{command:mc(t,["command"],`${n} command`)}];if(n==="read")return[{file_path:mc(t,["path","file_path"],"read path")}];if(n==="write")return[{content:mc(t,["content"],"write content"),file_path:mc(t,["path","file_path"],"write path")}];if(n==="edit"){let r=dC(Ae(t,"input")??"");if(r.length>0)return r;let o=Ae(t,"path")??Ae(t,"file_path"),i=uC(t,"paths");if(i.length===0&&o!==void 0)i=[o];if(i.length===0)throw Error("Pi edit path is missing");let a=lC(t),c=[];for(let u of i)c.push({file_path:u,...a});return c}return[t]},mC=(e)=>{if(typeof e==="string")return e;if(!Array.isArray(e))return"";let t=[];for(let n of e)if(hc(n)&&n.type==="text"&&typeof n.text==="string")t.push(n.text);return t.join(`
|
|
31
|
-
`)},hC=(e)=>{let t=mC(e.content);if(e.toolName==="bash"||e.toolName==="powershell")return{stdout:t,stderr:e.isError?t:"",interrupted:e.isError};if(e.toolName==="read")return{content:t};return{content:t,details:e.details,isError:e.isError}},ow=(e,t,n)=>{let r=Oe.decodeUnknownResult(iC)(e);if(Rt.isFailure(r))throw Error("Pi sent an invalid tool event");let o=r.success,s={cwd:n,hook_event_name:t,tool_name:o.toolName,tool_use_id:o.toolCallId};if("content"in o)return[{...s,tool_input:o.input,tool_response:hC(o)}];let i=[];for(let a of pC(o))i.push({...s,tool_input:a});return i},sw=async(e)=>{e.setEncoding("utf8");let t="";for await(let n of e)t+=String(n);return t},gC=async(e,t)=>{let n=Q_(e.executable,[...e.arguments,"--tripwire-hook"],{stdio:["pipe","pipe","pipe"]}),r={timedOut:!1},o=setTimeout(()=>{r.timedOut=!0,n.kill("SIGKILL")},rw);n.stdin.end(JSON.stringify(t));try{let[s,i,a]=await Promise.all([eC(n,"close"),sw(n.stdout),sw(n.stderr)]);if(r.timedOut)throw Error(`Tripwire exceeded its ${rw}ms timeout`);return{exitCode:typeof s[0]==="number"?s[0]:1,stderr:a,stdout:i}}finally{clearTimeout(o)}},hc=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),Ae=(e,t)=>{let n=e[t];return typeof n==="string"?n:void 0},iw=(e)=>{if(e.exitCode!==0)return e.stderr.trim()||`Tripwire exited ${e.exitCode}`;if(e.stdout.trim().length===0)return"Tripwire returned no decision";try{let t=JSON.parse(e.stdout);if(!hc(t))return"Tripwire returned invalid JSON";let n=hc(t.hookSpecificOutput)?t.hookSpecificOutput:void 0,r=(n===void 0?void 0:Ae(n,"permissionDecision"))??Ae(t,"permissionDecision")??Ae(t,"permission"),o=(n===void 0?void 0:Ae(n,"permissionDecisionReason"))??Ae(t,"permissionDecisionReason")??Ae(t,"reason")??"Blocked by Tripwire";if(r==="deny"||r==="ask")return o;if(Ae(t,"decision")==="block"||t.continue===!1)return o;return t.continue===!0||r==="allow"?void 0:"Tripwire returned an unrecognized response"}catch{return"Tripwire returned invalid JSON"}},xC=(e,t=gC)=>{let n=typeof e==="string"?{arguments:[],executable:e,kind:"native"}:e;return(r)=>{r.on("tool_call",async(o,s)=>{try{let i=ow(o,"PreToolUse",s.cwd),a=i.length===1?i[0]:i;if(a===void 0)throw Error("Tripwire could not normalize the Pi tool call");let c=iw(await t(n,a));if(c!==void 0)return{block:!0,reason:c};return{}}catch(i){return{block:!0,reason:`Tripwire failed closed: ${i instanceof Error?i.message:String(i)}`}}}),r.on("tool_result",async(o,s)=>{try{let[i]=ow(o,"PostToolUse",s.cwd);if(i===void 0)throw Error("Tripwire could not normalize the Pi tool result");let a=iw(await t(n,i));if(a!==void 0)s.ui.notify(`Tripwire stopped the session: ${a}`,"error"),s.abort()}catch(i){s.ui.notify(`Tripwire failed closed after tool use: ${i instanceof Error?i.message:String(i)}`,"error"),s.abort()}})}},Qj=xC(cC);export{xC as createTripwirePiExtension,Qj as default,ow as hookInputs,aC as resolveShippedHookCommand,iw as tripwirePiDenialReason};
|
|
7
|
+
${s(h)}}`;x=a(i,p)}}return n.delete(i),x}return String(i)}return l(e,0)}var _c="[Circular]";function rt(e){return typeof e==="string"?JSON.stringify(e):String(e)}function ts(e){return e.map((t)=>`[${rt(t)}]`).join("")}function Ac(e){try{return e.toISOString()}catch{return"Invalid Date"}}function Fc(e){try{let t=e.toString();return typeof t==="string"?t:String(t)}catch{return"[toString threw]"}}var Ct=Symbol.for("nodejs.util.inspect.custom"),Be=(e)=>{try{if(e=xr(e),O(e,"toJSON")&&Ot(e.toJSON)&&e.toJSON.length===0)return e.toJSON();else if(Array.isArray(e))return e.map(Be);return e}catch{return"[toJSON threw]"}};var Pf={toJSON(){return Be(this)},[Ct](){return this.toJSON()},toString(){return F(this.toJSON())}};class _e{called=!1;self;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new _e(this.self)}}var Pc=()=>{let t={["~effect/Utils/internal"]:(o)=>o()},r={["~effect/Utils/internal"]:(o)=>{try{return o()}finally{}}};return t["~effect/Utils/internal"](()=>Error().stack)?.includes("~effect/Utils/internal")===!0?t["~effect/Utils/internal"]:r["~effect/Utils/internal"]},he=Pc();function Ae(e,t,r){if(t==="__proto__")Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0});else e[t]=r}function rs(e,t){for(let r of Reflect.ownKeys(t))if(Object.prototype.propertyIsEnumerable.call(t,r))Ae(e,r,t[r])}var qe="~effect/Effect",je="~effect/Exit",Dc={_A:V,_E:V,_R:V},ss=`${qe}/identifier`,S=`${qe}/args`,P=`${qe}/evaluate`,X=`${qe}/successCont`,ue=`${qe}/failureCont`,Fe=`${qe}/ensureCont`,Je=Symbol.for("effect/Effect/Yield"),Ke={pipe(){return se(this,arguments)},toJSON(){return{...this}},toString(){return F(this.toJSON(),{ignoreToString:!0,space:2})},[Ct](){return this.toJSON()}},qf={[J](){return dn(this,Object.keys(this))},[K](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]||!q(this[t[n]],e[t[n]]))return!1;return!0}},Uc={[qe]:Dc,...Ke,[Symbol.iterator](){return new _e(this)},toJSON(){return{_id:"Effect",op:this[ss],...S in this?{args:this[S]}:void 0}}};var as=(e)=>O(e,je),Rt="~effect/Cause",gr="~effect/Cause/Reason",Sr=(e)=>O(e,Rt);class Pe{[Rt];reasons;constructor(e){this[Rt]=Rt,this.reasons=e}pipe(){return se(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map((e)=>e.toJSON())}}toString(){return`Cause(${F(this.reasons)})`}[Ct](){return this.toJSON()}[K](e){return Sr(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,r)=>q(t,e.reasons[r]))}[J](){return fr(this.reasons)}}var os=new WeakMap;class _t{[gr];annotations;_tag;constructor(e,t,r){if(this[gr]=gr,this._tag=e,t!==At&&typeof r==="object"&&r!==null&&t.size>0){let n=os.get(r);if(n)t=new Map([...n,...t]);os.set(r,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let r=new Map(this.annotations);e.mapUnsafe.forEach((o,s)=>{if(t?.overwrite!==!0&&r.has(s))return;r.set(s,o)});let n=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return n.annotations=r,n}pipe(){return se(this,arguments)}toString(){return F(this)}[Ct](){return this.toString()}}var At=new Map;class Ft extends _t{error;constructor(e,t=At){super("Fail",t,e);this.error=e}toString(){return`Fail(${F(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[K](e){return Ut(e)&&q(this.error,e.error)&&q(this.annotations,e.annotations)}[J](){return Z(M(this._tag))(Z(k(this.error))(k(this.annotations)))}}var Pt=(e)=>new Pe(e);var is=(e)=>new Pe([new Ft(e)]);class yn extends _t{defect;constructor(e,t=At){super("Die",t,e);this.defect=e}toString(){return`Die(${F(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[K](e){return Tn(e)&&q(this.defect,e.defect)&&q(this.annotations,e.annotations)}[J](){return Z(M(this._tag))(Z(k(this.defect))(k(this.annotations)))}}var cs=(e)=>new Pe([new yn(e)]),Dt=b((e)=>Sr(e[0]),(e,t,r)=>{if(t.mapUnsafe.size===0)return e;return new Pe(e.reasons.map((n)=>n.annotate(t,r)))}),Ut=(e)=>e._tag==="Fail",Tn=(e)=>e._tag==="Die",yr=(e)=>e._tag==="Interrupt";function Mc(e){return De("Effect.evaluate: Not implemented")}var Te=(e)=>({...Uc,[ss]:e.op,[P]:e[P]??Mc,[X]:e[X],[ue]:e[ue],[Fe]:e[Fe]}),ae=(e)=>{let t=Te(e);return function(){let r=Object.create(t);return r[S]=e.single===!1?arguments:arguments[0],r}},us=(e)=>{let t={[je]:je,_tag:e.op,get[e.prop](){return this[S]},...Te(e),toString(){return`${e.op}(${F(this[S])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[S]}},[K](r){return as(r)&&r._tag===this._tag&&q(this[S],r[S])},[J](){return Z(M(e.op),k(this[S]))}};return function(r){let n=Object.create(t);return n[S]=r,n}},te=us({op:"Success",prop:"value",[P](e){let t=e.getCont(X);return t?t[X](this[S],e,this):e.yieldWith(this)}}),En={key:"effect/Cause/StackTrace"},ls={key:"effect/Cause/InterruptorStackTrace"},le=us({op:"Failure",prop:"cause",[P](e){let t=this[S],r=!1;if(e.currentStackFrame)t=Dt(t,{mapUnsafe:new Map([[En.key,e.currentStackFrame]])}),r=!0;let n=e.getCont(ue);while(e.interruptible&&e._interruptedCause&&n)n=e.getCont(ue);return n?n[ue](t,e,r?void 0:this):e.yieldWith(r?le(t):this)}}),nt=(e)=>le(is(e)),De=(e)=>le(cs(e)),ot=ae({op:"WithFiber",[P](e){return this[S](e)}}),Nc=function(){class e extends globalThis.Error{}let t=Te({op:"YieldableError",[P](){return nt(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),fs=function(){let e=Symbol.for("effect/Data/Error/plainArgs");return class extends Nc{constructor(r){super(r?.message,r?.cause?{cause:r.cause}:void 0);if(r)rs(this,r),Object.defineProperty(this,e,{value:r,enumerable:!1})}toJSON(){return{...this[e],...this}}}}(),Mt=(e)=>{class t extends fs{_tag=e}return t.prototype.name=e,t};var Sn="~effect/Cause/Done";var Jf={[Sn]:Sn,_tag:"Done",value:void 0};var ps="~effect/data/Option",ds={[ps]:{_A:(e)=>e},...Ke,[Symbol.iterator](){return new _e(this)}},Lc=Object.defineProperty(Object.assign(Object.create(ds),{_tag:"Some",_op:"Some",[K](e){return wn(e)&&vn(e)&&q(this.value,e.value)},[J](){return Z(k(this._tag))(k(this.value))},toString(){return`some(${F(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:Be(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),$c=k("None"),Bc=Object.assign(Object.create(ds),{_tag:"None",_op:"None",valueOrUndefined:void 0,[K](e){return wn(e)&&In(e)},[J](){return $c},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}}}),wn=(e)=>O(e,ps),In=(e)=>e._tag==="None",vn=(e)=>e._tag==="Some",ms=Object.create(Bc),hs=(e)=>{let t=Object.create(Lc);return t.value=e,t};var xs="~effect/data/Result",gs={[xs]:{_A:(e)=>e,_E:(e)=>e},...Ke,[Symbol.iterator](){return new _e(this)}},qc=Object.assign(Object.create(gs),{_tag:"Success",_op:"Success",[K](e){return On(e)&&Ss(e)&&q(this.success,e.success)},[J](){return Z(k(this._tag))(k(this.success))},toString(){return`success(${F(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:Be(this.success)}}}),Jc=Object.assign(Object.create(gs),{_tag:"Failure",_op:"Failure",[K](e){return On(e)&&kn(e)&&q(this.failure,e.failure)},[J](){return Z(k(this._tag))(k(this.failure))},toString(){return`failure(${F(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:Be(this.failure)}}}),On=(e)=>O(e,xs),kn=(e)=>e._tag==="Failure",Ss=(e)=>e._tag==="Success",ys=(e)=>{let t=Object.create(Jc);return t.failure=e,t},Ts=(e)=>{let t=Object.create(qc);return t.success=e,t};var ze=Ts,xe=ys;var st=kn;var Es=b(2,(e,t)=>st(e)?xe(t(e.failure)):e);var Tr=b(2,(e,{onFailure:t,onSuccess:r})=>st(e)?t(e.failure):r(e.success));var Cn=(e)=>e.length>0;var Ee=()=>ms,ge=hs;var Nt=In,Rn=vn;var _n=b(2,(e,t)=>Nt(e)?Ee():ge(t(e.value)));var bs=b(2,(e,t)=>Nt(e)?Ee():t(e.value)?ge(e.value):Ee());var An=globalThis.Array;var it=(e)=>An.isArray(e)?e:An.from(e);var Fn=b(2,(e,t)=>[...e,t]),Hc=b(2,(e,t)=>it(e).concat(it(t)));var ip=An.isArray;var Pn=Cn,br=Cn;var Wc=(e,t)=>{let r=k(t),n=e.get(r);if(n===void 0)return e.set(r,[t]),!0;for(let o of n)if(q(o,t))return!1;return n.push(t),!0};var ws=b(2,(e,t)=>{let r=it(e),n=it(t);if(br(r))return br(n)?Vc(Hc(r,n)):r;return n});var wr=()=>[];var Is=b(2,(e,t)=>e.map(t));var Vc=(e)=>{let t=it(e);if(t.length<2)return[...t];let r=new Map,n=[];for(let o of t)if(Wc(r,o))n.push(o);return n};var vs=(e)=>Te({op:e.label,[P]:e.evaluate});var Os="~effect/Context/Service",ks=function(){function e(){}let t=e;Object.setPrototypeOf(t,Yc);let r=(n,o)=>{if(t.key=n,o?.defaultValue)t[Mn]=Mn,t.defaultValue=o.defaultValue;if(o?.make)t.make=o.make;if(o?.fiberCached)Cs.add(n);return t};return arguments.length>0?r(arguments[0],arguments[1]):r},Yc={[Os]:Os,...vs({label:"Service",evaluate(e){return te(Lt(e.context,this))}}),toJSON(){return{_id:"Service",key:this.key}},of(e){return e},context(e){return Bn(this,e)},use(e){return ot((t)=>e(Lt(t.context,this)))},useSync(e){return ot((t)=>te(e(Lt(t.context,this))))}},Cs=new Set,Mn="~effect/Context/Reference",Rs="~effect/Context",Xc=8,Qc=8,Nn=(e,t,r,n)=>{let o=Object.create(eu);return o.cacheRoot=e??o,o.base=t,o.overlay=r,o.depth=n,o._flat=void 0,o.baseHits=0,o},_s=(e,t)=>{if(!t)return;_s(e,t.parent),e.set(t.key,t.value)},As=(e)=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return _s(t,e.overlay),e._flat=t};var Ln=Symbol(),Fs=(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);if(n===void 0&&!r.base.has(t))return Ln;if(r.overlay&&++r.baseHits>=Qc)r.base=As(r),r.overlay=void 0,r.depth=0;return n},Ir=(e)=>Nn(void 0,e,void 0,0),eu={get mapUnsafe(){return As(this)},...Ke,[Rs]:{_Services:(e)=>e},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[K](e){if(!tu(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)||!q(o,r.get(n)))return!1;return!0},[J](){return dr(this.mapUnsafe.size)}},Ps=(e,t)=>e.cacheRoot===t.cacheRoot,tu=(e)=>O(e,Rs);var ru=(e)=>!!e[Mn],$n=()=>nu,nu=Ir(new Map),Bn=(e,t)=>Ir(new Map([[e.key,t]])),Ds=b(3,(e,t,r)=>ou(e,t.key,r)),ou=(e,t,r)=>{let n=e,o=Cs.has(t)?void 0:n.cacheRoot;if(n.depth>=Xc){let s=new Map(n.mapUnsafe);return s.set(t,r),Nn(o,s,void 0,0)}return Nn(o,n.base,{key:t,value:r,parent:n.overlay},n.depth+1)};var vr=(e,t)=>{let r=Fs(e,t);return r===Ln?void 0:r},Us=b(2,(e,t)=>{let r=Fs(e,t.key);if(r===Ln){if(ru(t))return su(t);throw au(t)}return r}),Lt=Us,Un="~effect/Context/defaultValue",su=(e)=>{if(Un in e)return e[Un];return e[Un]=e.defaultValue()},au=(e)=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(t.stack){let r=t.stack.split(`
|
|
8
|
+
`);r.splice(1,3),t.stack=r.join(`
|
|
9
|
+
`)}return t};var be=ks;var qn=be("effect/Scheduler",{fiberCached:!0,defaultValue:()=>new Or}),Ms="setImmediate"in globalThis?(e)=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:(e)=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},iu=(e)=>{let t=!1;return Promise.resolve().then(()=>{if(!t)e()}),()=>{t=!0}};class Ns{buckets=[];scheduleTask(e,t){let r=this.buckets,n=r.length,o,s=0;for(;s<n;s++){if(r[s][0]>t)break;o=r[s]}if(o&&o[0]===t)o[1].push(e);else if(s===n)r.push([t,[e]]);else r.splice(s,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}}class Or{executionMode;setImmediate;constructor(e="async",t){this.executionMode=e,this.setImmediate=t??(e==="sync"?iu:Ms)}shouldYield(e){return e.currentOpCount>=e.maxOpsBeforeYield}makeDispatcher(){return new Ls(this.setImmediate)}}class Ls{tasks=new Ns;running=void 0;setImmediate;constructor(e=Ms){this.setImmediate=e}scheduleTask(e,t){if(this.tasks.scheduleTask(e,t),this.running===void 0)this.running=this.setImmediate(this.afterScheduled)}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let r=e[t][1];for(let n=0;n<r.length;n++)r[n]()}}flush(){while(this.tasks.buckets.length>0){if(this.running!==void 0)this.running(),this.running=void 0;this.runTasks()}}}var $s=be("effect/Scheduler/MaxOpsBeforeYield",{fiberCached:!0,defaultValue:()=>2048}),Bs=be("effect/Scheduler/PreventSchedulerYield",{fiberCached:!0,defaultValue:()=>!1});var kr=Mt;var qs="~effect/encoding/EncodingError";class Rr extends kr("EncodingError"){[qs]=qs}var _r=(e)=>typeof e==="string"?Js(uu.encode(e)):Js(e),Ar=(e)=>{let t=lu(e),r=t.length;if(r%4!==0)return xe(new Rr({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 xe(new Rr({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,c=0;a<r;a+=4,c+=3){let l=Cr(t.charCodeAt(a))<<18|Cr(t.charCodeAt(a+1))<<12|Cr(t.charCodeAt(a+2))<<6|Cr(t.charCodeAt(a+3));s[c]=l>>16,s[c+1]=l>>8&255,s[c+2]=l&255}return ze(s)}catch(o){return xe(new Rr({kind:"Decode",module:"Base64",input:t,message:o instanceof Error?o.message:"Invalid input"}))}};var uu=new TextEncoder;var lu=(e)=>e.replace(/[\n\r]/g,""),Js=(e)=>{let t=e.length,r="",n;for(n=2;n<t;n+=3)r+=we[e[n-2]>>2],r+=we[(e[n-2]&3)<<4|e[n-1]>>4],r+=we[(e[n-1]&15)<<2|e[n]>>6],r+=we[e[n]&63];if(n===t+1)r+=we[e[n-2]>>2],r+=we[(e[n-2]&3)<<4],r+="==";if(n===t)r+=we[e[n-2]>>2],r+=we[(e[n-2]&3)<<4|e[n-1]>>4],r+=we[(e[n-1]&15)<<2],r+="=";return r};function Cr(e){if(e>=Ks.length)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);let t=Ks[e];if(t===255)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);return t}var we=["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","+","/"],Ks=[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];var fu=[];for(let e=0;e<256;e++)fu.push(e.toString(16).padStart(2,"0"));var Gs="effect/Tracer/ParentSpan";var Hs="effect/Tracer";var Ws="effect/observability/Metric/FiberRuntimeMetricsKey";var Vs=be("effect/References/CurrentStackFrame",{fiberCached:!0,defaultValue:Qe});var Zs=be("effect/References/CurrentLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),Ys=be("effect/References/MinimumLogLevel",{fiberCached:!0,defaultValue:()=>"Info"});var hu=()=>{let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");if(e===void 0)return Object.isExtensible(Error);return Object.hasOwn(e,"writable")?e.writable===!0:e.set!==void 0},xu=hu(),Xs=()=>Error.stackTraceLimit,Jn=(e)=>{if(xu)Error.stackTraceLimit=e};class oa extends _t{fiberId;constructor(e,t=At){super("Interrupt",t,"Interrupted");this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[K](e){return yr(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[J](){return Z(M(`${this._tag}:${this.fiberId}`))(lr(this.annotations))}}var sa=(e)=>new Pe([new oa(e)]);var Gn=(e)=>{for(let t=0;t<e.reasons.length;t++){let r=e.reasons[t];if(r._tag==="Fail")return ze(r.error)}return xe(e)};var aa=(e)=>e.reasons.some(yr);var Hn=b(2,(e,t)=>{if(e.reasons.length===0)return t;else if(t.reasons.length===0)return e;let r=new Pe(ws(e.reasons,t.reasons));return q(e,r)?e:r}),ia=b(2,(e,t)=>{let r=!1,n=e.reasons.map((o)=>{if(Ut(o))return r=!0,new Ft(t(o.error),o.annotations);return o});return r?Pt(n):e});var Qs="~effect/Fiber",Eu={_A:V,_E:V},bu={id:0},wu=()=>globalThis[tt];class Wn{constructor(e,t=!0){this[Qs]=Eu,this.setContext(e),this.id=++bu.id,this.currentOpCount=0,this.interruptible=t,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this.runtimeMetrics?.recordFiberStart(this.context)}[Qs];id;interruptible;currentOpCount;_stack;_observers;_exit;_children;_interruptedCause;_yielded;_running;_deferredInterrupt;context;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;currentPreventYield;_dispatcher=void 0;get currentDispatcher(){return this._dispatcher??=this.currentScheduler.makeDispatcher()}getRef(e){return Lt(this.context,e)}addObserver(e){if(this._exit)return e(this._exit),Go;return this._observers.push(e),()=>{if(this._exit)return;let t=this._observers.indexOf(e);if(t>=0)this._observers.splice(t,1)}}interruptUnsafe(e,t){if(this._exit)return;let r=sa(e);if(this.currentStackFrame)r=Dt(r,Bn(En,this.currentStackFrame));if(t)r=Dt(r,t);if(this._interruptedCause=this._interruptedCause?Hn(this._interruptedCause,r):r,this.interruptible)if(this._running)this._deferredInterrupt=!0;else this.evaluate(fe(this._interruptedCause))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;else if(this._yielded!==void 0){let n=this._yielded;this._yielded=void 0,n()}let t=this.runLoop(e);if(t===Je)return;let r=ea.interruptChildren&&ea.interruptChildren(this);if(r!==void 0)return this.evaluate(ne(r,()=>t));this._exit=t,this.runtimeMetrics?.recordFiberEnd(this.context,this._exit);for(let n=0;n<this._observers.length;n++)this._observers[n](t);this._observers.length=0,this._stack.length=0,this._children=void 0,this.context=$n()}runLoop(e){let t=globalThis[tt];globalThis[tt]=this;let r=this._running;this._running=!0;let n=!1,o=e;this.currentOpCount=0;try{while(!0){if(this._deferredInterrupt)this._deferredInterrupt=!1,o=fe(this._interruptedCause);if(this.currentOpCount++,!n&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){n=!0;let s=o;o=ne(pa,()=>s)}if(o=this.currentTracerContext?this.currentTracerContext(o,this):o[P](this),o===Je){let s=this._yielded;if(je in s)return this._deferredInterrupt=!1,this._yielded=void 0,s;else if(this._deferredInterrupt){this._yielded=void 0,s();continue}return Je}}}catch(s){if(!O(o,P))return De(`Fiber.runLoop: Not a valid effect: ${String(o)}`);return this.runLoop(De(s))}finally{this._running=r,globalThis[tt]=t}}getCont(e){if(this._deferredInterrupt)return this._deferredInterrupt=!1,Iu;while(!0){let t=this._stack.pop();if(!t)return;let r=t[Fe]&&t[Fe](this);if(r)return r[e]=r,r;if(t[e])return t}}yieldWith(e){return this._yielded=e,Je}children(){return this._children??=new Set}pipe(){return se(this,arguments)}setContext(e){let t=this.context;if(this.context=e,t!==void 0&&Ps(t,e))return;let r=this.getRef(qn);if(r!==this.currentScheduler)this.currentScheduler=r,this._dispatcher=void 0;this.currentSpan=vr(e,Gs),this.currentLogLevel=this.getRef(Zs),this.minimumLogLevel=this.getRef(Ys),this.currentStackFrame=this.getRef(Vs),this.maxOpsBeforeYield=this.getRef($s),this.currentPreventYield=this.getRef(Bs),this.runtimeMetrics=vr(e,Ws);let n=vr(e,Hs);this.currentTracerContext=n?n.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag==="Span"?this.currentSpan:void 0}}var Iu={[X](e,t){return fe(t._interruptedCause)},[ue](e,t){return fe(t._interruptedCause)}},ea={interruptChildren:void 0},ca=(e)=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(ls.key,e.currentStackFrame),Ir(t)};var vu=(e)=>Vn((t)=>{let r=e[Symbol.iterator](),n=[],o=void 0;function s(){let a=r.next();while(!a.done){if(a.value._exit){n.push(a.value._exit),a=r.next();continue}o=a.value.addObserver((c)=>{n.push(c),s()});return}t(re(n))}return s(),ua(()=>o?.())});var ta=(e)=>ot((t)=>{let r=ca(t),n=wr();for(let o of e)o.interruptUnsafe(t.id,r),n.push(o);return Ta(vu(n))});var re=te,fe=le,ct=nt,ua=ae({op:"Sync",[P](e){let t=this[S](),r=e.getCont(X);return r?r[X](t,e):e.yieldWith(te(t))}}),He=ae({op:"Suspend",[P](e){return this[S]()}});var la=Tr({onFailure:ct,onSuccess:re});var fa=ae({op:"Yield",[P](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{if(t)return;e.evaluate(Ie)},this[S]??0),e.yieldWith(()=>{t=!0})}}),pa=fa(0);var da=re(Ee());var ma=(e)=>He(()=>fe(he(e))),Fr=(e)=>De(e),ha=(e)=>He(()=>ct(he(e))),$t=re(void 0);var xa=(e)=>{let t=typeof e==="function"?e:e.try,r=typeof e==="function"?(n)=>new Dr(n,"An error occurred in Effect.try"):e.catch;return He(()=>{try{return re(he(t))}catch(n){return ct(he(()=>r(n)))}})};var ga=(e)=>{let t=typeof e==="function"?e:e.try,r=typeof e==="function"?(n)=>new Dr(n,"An error occurred in Effect.tryPromise"):e.catch;return Sa(function(n,o){let s=(a)=>{try{n(ct(he(()=>r(a))))}catch(c){n(Fr(c))}};try{he(()=>t(o)).then((a)=>n(re(a)),s)}catch(a){s(a)}},t.length!==0)};var Sa=ae({op:"Async",single:!1,[P](e){let t=he(()=>this[S][0].bind(e.currentScheduler)),r=!1,n=!1,o=this[S][1]?new AbortController:void 0,s=t((a)=>{if(r)return;if(r=!0,n)e.evaluate(a);else n=a},o?.signal);if(n!==!1)return n;if(n=!0,e._yielded=()=>{r=!0},o===void 0&&s===void 0)return Je;return e._stack.push(Ou(()=>(r=!0,o?.abort(),s??Ie))),Je}}),Ou=ae({op:"AsyncFinalizer",[Fe](e){if(e.interruptible)e.interruptible=!1,e._stack.push(Xn)},[ue](e,t){return aa(e)?ne(this[S](),()=>fe(e)):fe(e)}}),Vn=(e)=>Sa(e,e.length>=2);var ku=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0});var ya=(e,...t)=>ku(e.length,t.length===0?function(){return ra(()=>e.apply(this,arguments))}:function(){let r=ra(()=>e.apply(this,arguments));for(let n of t)r=n(r);return r}),ra=(e)=>{try{let t=e(),r=void 0;while(!0){let n=t.next(r);if(n.done)return re(n.value);let o=n.value;if(o&&o._tag==="Success"){r=o.value;continue}else if(o&&o._tag==="Failure")return n.value;else{let s=!0;return He(()=>{if(s)return s=!1,ne(n.value,(a)=>na(t,a));else return He(()=>na(e()))})}}}catch(t){return Fr(t)}},na=ae({op:"Iterator",single:!1,[X](e,t){let r=this[S][0];while(!0){let n=r.next(e);if(n.done)return re(n.value);if(!N(n.value))return t._stack.push(this),n.value;else if(n.value._tag==="Failure")return n.value;e=n.value.value}},[P](e){return this[X](this[S][1],e)}});var Ta=(e)=>ne(e,(t)=>Ie);var ne=b(2,(e,t)=>{let r=Object.create(Cu);return r[S]=e,r[X]=t.length!==1?(n)=>t(n):t,r}),Cu=Te({op:"OnSuccess",[P](e){return e._stack.push(this),this[S]}});var N=(e)=>(je in e),Ea=b(2,(e,t)=>{if(N(e))return e._tag==="Success"?t(e.value):e;return ne(e,t)});var ba=b(2,(e,t)=>ne(e,(r)=>re(he(()=>t(r))))),wa=b(2,(e,t)=>N(e)?va(e,t):ba(e,t)),Ia=b(2,(e,t)=>N(e)?Oa(e,t):Ra(e,t));var Zn=(e)=>e._tag==="Success";var Ie=te(void 0),va=b(2,(e,t)=>e._tag==="Success"?te(t(e.value)):e),Oa=b(2,(e,t)=>{if(e._tag==="Success")return e;let r=Gn(e.cause);if(st(r))return e;return nt(t(r.success))});var Pr=b(2,(e,t)=>{let r=Object.create(Ru);return r[S]=e,r[ue]=t.length!==1?(n)=>t(n):t,r}),Ru=Te({op:"OnFailure",[P](e){return e._stack.push(this),this[S]}});var ka=b(3,(e,t,r)=>Pr(e,(n)=>{let o=t(n);return st(o)?fe(o.failure):he(()=>r(o.success,n))})),Ca=b(2,(e,t)=>ka(e,Gn,(r)=>t(r)));var Ra=b(2,(e,t)=>Ca(e,(r)=>ha(()=>t(r))));var Kp=Te({op:"OnSuccessAndFailure",[P](e){return e._stack.push(this),this[S]}});var Yn=(e)=>N(e)?te(e):_u(e),_u=ae({op:"Exit",[P](e){return e._stack.push(this),this[S]},[X](e,t,r){return re(r??te(e))},[ue](e,t,r){return re(r??le(e))}});var Au=(e,t)=>Zn(e)?t:Pr(t,(r)=>fe(Hn(e.cause,r)));var Fu=ae({op:"OnExit",single:!1,[P](e){return e._stack.push(this),this[S][0]},[Fe](e){if(e.interruptible&&this[S][2]!==!0)e._stack.push(Xn),e.interruptible=!1},[X](e,t,r){r??=te(e);let n=this[S][1](r);return n?ne(n,(o)=>r):r},[ue](e,t,r){r??=le(e);let n=this[S][1](r);return n?ne(Au(r,n),(o)=>r):r}});var _a=(e)=>ot((t)=>{if(!t.interruptible)return e;return t.interruptible=!1,t._stack.push(Xn),e}),Pu=ae({op:"SetInterruptible",[Fe](e){if(e.interruptible=this[S],e._interruptedCause&&e.interruptible)return()=>fe(e._interruptedCause)}}),Xn=Pu(!0);var Du=ae({op:"While",[X](e,t){if(this[S].step(e),this[S].while())return t._stack.push(this),this[S].body();return Ie},[P](e){if(this[S].while())return e._stack.push(this),this[S].body();return Ie}});var Uu=(e)=>{let{onItem:t,step:r}=e,n=(o,s,a,c)=>{for(;a<c;a++){let l=s[a],i=t(o,l,a);if(!N(i))return ne(Yn(i),(x)=>r(o,l,x,a)??n(o,s,a+1,c)??$t);let h=r(o,l,i,a);if(h)return h._tag==="Failure"?h:void 0}};return(o,s,a)=>{let c=0,l=a?.end??s.length,i=a?.concurrency??1;if(i===1)return n(o,s,0,l);let h=a?.orderedStep===!0,x=!1,m,p,d,E=!1,u,f,g=c,y=h?Array(l):void 0,T=(U)=>{let C=De(U);return u=C,x=!0,E=!0,p&&p.size>0?ne(_a(ta(Array.from(p))),()=>C):C},B=(U,C,H)=>{if(!h)return r(o,U,C,H);if(u)return u;y[H]=C;while(g<l){let I=y[g];if(I===void 0)return;y[g]=void 0;let v=g++,_=r(o,s[v],I,v);if(_)return _}},D=()=>{let U=!1;for(;!u&&c<l;c++){let C=s[c],H=f??t(o,C,c);if(N(H)){if(u=B(C,H,c),u)break}else if(!m)return Vn((I)=>{m=wu(),p=new Set,f=H,d=I;let v;try{v=D()}catch(_){return I(T(_))}if(v)return I(v);return He(()=>(u=Ie,E=!0,p?ta(p):$t))});else{f=void 0;let I=Mu(m,H,!0,!0,"inherit");if(I._exit){if(u=B(C,I._exit,c),u)break;continue}p.add(I);let v=c;if(I.addObserver((_)=>{p.delete(I);try{if(u){if(!E&&_._tag==="Failure")for(let A of _.cause.reasons)if(A._tag==="Interrupt")continue;else if(u._tag==="Failure")u.cause.reasons.push(A);else u=le(Pt([A]))}else{let A=B(C,_,v);if(A)u=A._tag==="Failure"?le(Pt(A.cause.reasons.slice())):A,D()}if(U){let A=D();if(A)d(A)}else if(x&&p.size===0)d(u??$t)}catch(A){d(T(A))}}),p.size<i)continue;U=!0,c++;return}}if(x=!0,u){if(p&&p.size>0){let C=ca(m);p.forEach((H)=>H.interruptUnsafe(m.id,C));return}if(d||u._tag==="Failure")return u}else if(d){if(!p)return Ie;else if(p.size===0)d($t)}};return D()}},Bt=()=>Uu;var Mu=(e,t,r=!1,n=!1,o=!1)=>{let s=e,a=o==="inherit"?s.interruptible:!o,c=new Wn(s.context,a);if(r)c.evaluate(t);else s.currentDispatcher.scheduleTask(()=>c.evaluate(t),0);if(!n&&!c._exit)s.children().add(c),c.addObserver(()=>s._children.delete(c));return c};var Aa=(e)=>(t,r)=>{let n=new Wn(r?.scheduler?Ds(e,qn,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))}if(r?.onFiberStart)r.onFiberStart(n);return n};var Fa=(e)=>{let t=Aa(e);return(r)=>{if(N(r))return r;let n=new Or("sync"),o=t(r,{scheduler:n});return o._dispatcher?.flush(),o._exit??De(new Qn(o))}},Pa=Fa($n());var Kn="~effect/Cause/AsyncFiberError";class Qn extends Mt("AsyncFiberError"){[Kn]=Kn;constructor(e){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:e})}}var zn="~effect/Cause/UnknownError";class Dr extends Mt("UnknownError"){[zn]=zn;constructor(e,t){super({message:t,cause:e})}}var Nu="~effect/Logger",zp={[Nu]:{_Message:V,_Output:V},pipe(){return se(this,arguments)}};var Ge={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},Gp={None:[],All:[],Trace:[Ge.gray],Debug:[Ge.blue],Info:[Ge.green],Warn:[Ge.yellow],Error:[Ge.red],Fatal:[Ge.bgBrightRed,Ge.black]};var Da=Ut;var Ur=ia;var Ua=te,ro=le,ut=nt;var lt=Ie;var Mr=Zn;var Ma=ga,L=re,oo=da;var R=ct;var so=ma,Na=Fr,ao=xa;var La=la;var ve=ne;var jt=Yn;var qt=Pr;var Jt=Pa;var ft=wa,io=Ia;var ie=Ea;var co=ya;function $a(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}var Ba="~structural";var ja="~sentinels",qa="~constructor";var Nr=Re((e)=>{let t=$a(e)?.identifier;if(typeof t==="string")return t;return e.getExpected(Nr)});var w=Symbol();var pe=Ua,Oe=pe(w),z=pe(w),Lr=(e)=>e===w?Ee():ge(e),uo=(e)=>e._tag==="None"?Oe:pe(e.value);var Gt="~effect/SchemaIssue/Issue";function po(e){return O(e,Gt)&&e[Gt]===Gt}function Lu(e){return Object.hasOwn(e,"input")}class de{[Gt]=Gt;constructor(e,t){if(t?.reportInput===!0&&e!==w)this.input=e}}class mo extends de{_tag="Filter";filter;issue;constructor(e,t,r,n){super(r,n);this.filter=e,this.issue=t}}class ho extends de{_tag="Encoding";ast;issue;constructor(e,t,r,n){super(r,n);this.ast=e,this.issue=t}}class Se extends de{_tag="Pointer";path;issue;constructor(e,t){super();this.path=e,this.issue=t}}class Vt extends de{_tag="MissingKey";annotations;constructor(e){super();this.annotations=e}}class Br extends de{_tag="UnexpectedKey";ast;constructor(e,t,r){super(t,r);this.ast=e}}class G extends de{_tag="Composite";ast;issues;constructor(e,t,r,n){super(r,n);this.ast=e,this.issues=t}}class ke extends de{_tag="InvalidType";ast;constructor(e,t,r){super(t,r);this.ast=e}}class Y extends de{_tag="InvalidValue";annotations;constructor(e,t,r){super(t,r);this.annotations=e}}class Zt extends de{_tag="AnyOf";ast;issues;constructor(e,t,r,n){super(r,n);this.ast=e,this.issues=t}}class xo extends de{_tag="OneOf";ast;successes;constructor(e,t,r,n){super(r,n);this.ast=e,this.successes=t}}function fo(e,t,r){if(po(e))return e;if(typeof e==="string")return new Y({message:e},t,r);let n=typeof e.issue==="string"?new Y({message:e.issue},t,r):e.issue;return new Se(e.path,n)}function Ka(e,t,r){if(e===void 0)return;if(typeof e==="boolean")return e?void 0:new Y(void 0,t,r);return fo(e,t,r)}function za(e,t,r,n){if(Array.isArray(t)){if(!br(t))return;return t.length===1?fo(t[0],r,n):new G(e,Is(t,(o)=>fo(o,r,n)),r,n)}return Ka(t,r,n)}var $u=(e)=>{let t=Wt(e);if(t!==void 0)return t;switch(e._tag){case"InvalidType":return Ht(Nr(e.ast),e);case"InvalidValue":{let r=Ga(e);if(r!==void 0)return Ht(r,e);let n=$r(e);return n===void 0?"Expected a valid value":`Invalid data ${n}`}case"MissingKey":return"Missing key";case"UnexpectedKey":{let r=$r(e);return r===void 0?"Expected no excess property":`Unexpected key with value ${r}`}case"Forbidden":return"Forbidden operation";case"OneOf":{let r=$r(e);return r===void 0?"Expected exactly one member to match":`Expected exactly one member to match the input ${r}`}}},Bu=(e)=>Wt(e.issue)??Wt(e);function $r(e){return Lu(e)?F(e.input):void 0}function Ga(e){let t=e.annotations?.expected;return typeof t==="string"?t:void 0}function Ht(e,t){let r=$r(t);return r===void 0?`Expected ${e}`:`Expected ${e}, got ${r}`}function Ha(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)=>Ha(r)).join(" & ")}}function ju(){return(e)=>zt(e,"")}var Wa=ju();function zt(e,t){let r;switch(e._tag){case"Filter":{let n=Bu(e);if(n!==void 0)r=n;else{if(e.issue._tag!=="InvalidValue")return zt(e.issue,t);let o=Ga(e.issue);r=o===void 0?Ht(Ha(e.filter),e):Ht(o,e.issue)}break}case"Encoding":return zt(e.issue,t);case"Pointer":return zt(e.issue,t+ts(e.path));case"Composite":case"AnyOf":{if(e._tag==="Composite"||e.issues.length>0)return e.issues.map((n)=>zt(n,t)).join(`
|
|
10
|
+
`);r=Wt(e)??Ht(Nr(e.ast),e);break}default:r=$u(e);break}return t?`${r}
|
|
11
|
+
at ${t}`:r}function Wt(e){if(e._tag==="Pointer")return;if(e._tag==="Encoding")return Wt(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 Yt(e){let t;for(let r of e.reasons){if(!Da(r)||!po(r.error))return;t??=r.error}return t}function jr(e,t){let r=Yt(e);if(r===void 0)throw Error(t,{cause:e});return r}class We extends Et{run;constructor(e){super();this.run=e}map(e){return new We((t,r)=>this.run(t,r).pipe(ft(_n(e))))}compose(e){if(Za(this))return e;if(Za(e))return this;return new We((t,r)=>this.run(t,r).pipe(ie((n)=>e.run(n,r))))}}var Ya=new We(L);function Za(e){return e.run===Ya.run}function dt(){return Ya}function Ju(e){return new We((t,r)=>Nt(t)?oo:e(t.value,r))}function oe(e){return Xa(_n(e))}function Xt(e){return Ju((t,r)=>e(t,r).pipe(ft(ge)))}function Xa(e){return new We((t)=>L(e(t)))}function go(e){return new We((t)=>{let r=bs(t,un);return Rn(r)?L(r):ft(e,ge)})}function qr(){return oe(globalThis.String)}function Jr(){return oe(globalThis.Number)}function Qa(){return oe(_r)}function ei(){return Xt((e,t)=>io(La(Ar(e)),()=>new Y({expected:"a valid Base64 string"},e,t)))}var Qt="~effect/SchemaTransformation/Transformation";class Q{[Qt]=Qt;_tag="Transformation";decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new Q(this.encode,this.decode)}compose(e){return new Q(this.decode.compose(e.decode),e.encode.compose(this.encode))}}function Gu(e){return O(e,Qt)&&e[Qt]===Qt}var yo=(e)=>{if(Gu(e))return e;return new Q(e.decode,e.encode)};function er(e){return new Q(Xt(e.decode),Xt(e.encode))}function ti(e){return new Q(oe(e.decode),oe(e.encode))}var Hu=new Q(dt(),dt());function To(){return Hu}var Kr=new Q(Jr(),qr());var ri=er({decode:(e,t)=>URL.canParse(e)?L(new URL(e)):R(new Y({expected:"a valid URL string"},e,t)),encode:(e)=>L(e.href)});var ni=new Q(ei(),Qa());function Ze(e){return(t)=>t._tag===e}var ko=Ze("Declaration");var Zu=Ze("Never");var mt=Ze("Literal"),Eo=Ze("UniqueSymbol");var pi=Ze("Arrays"),Yu=Ze("Objects");var Xu=Ze("Suspend");class ce{to;transformation;constructor(e,t){this.to=e,this.transformation=t}}var Co={};class ht{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}}var si="~effect/Schema";class ye{[si]=si;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,r=void 0,n=void 0){this.annotations=e,this.checks=t,this.encoding=r,this.context=n}toString(){return`<${this._tag}>`}}class Wr extends ye{_tag="Declaration";typeParameters;run;encodingChecks;encodingRun;constructor(e,t,r,n,o,s,a,c){super(r,n,o,s);this.typeParameters=e,this.run=t,this.encodingChecks=a,this.encodingRun=c}getParser(){let e;return(t,r)=>{if(t===w)return Oe;return(e??=this.run(this.typeParameters))(t,this,r)}}_rebuild(e,t,r,n,o){let s=xt(this.typeParameters,e);return s===this.typeParameters&&t===this.checks&&r===this.encodingChecks&&n===this.run&&o===this.encodingRun?this:new Wr(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;if(typeof e==="string")return e;return"<Declaration>"}}class di extends ye{_tag="Unknown";getParser(){return cr(this,Yo)}getExpected(){return"unknown"}}var rr=new di;class Ve extends ye{_tag="Literal";literal;constructor(e,t,r,n,o){super(t,r,n,o);if(typeof e==="number"&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${F(e)}`);this.literal=e}getParser(){return fl(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==="bigint"?ai(this):this}toCodecStringTree(){return typeof this.literal==="string"?this:ai(this)}getExpected(){return typeof this.literal==="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}}function ai(e){let t=globalThis.String(e.literal);return me(e,[new ce(new Ve(t),new Q(oe(()=>e.literal),oe(()=>t)))])}class mi extends ye{_tag="String";getParser(){return cr(this,vt)}matchPart(e,t){let r=this.checks;return r&&!t.disableChecks&&Ne(r,e,void 0,this,t)?void 0:e}getExpected(){return"string"}}var nr=new mi;class hi extends ye{_tag="Number";getParser(){return cr(this,cn)}matchKey(e,t){return this._match(pl,e,t)}matchPart(e,t){return this._match(Oo,e,t)}_match(e,t,r){if(!e.test(t))return;let n=globalThis.Number(t);if(r.disableChecks||!this.checks)return n;return Ne(this.checks,n,void 0,this,r)?void 0:n}toCodecJson(){if(this.checks&&(bo(this.checks,"effect/schema/isFinite")||bo(this.checks,"effect/schema/isInt")))return this;return me(this,[ol])}toCodecStringTree(){if(this.toCodecJson()===this)return me(this,[dl]);return me(this,[ml])}getExpected(){return"number"}}function bo(e,t){return e.some((r)=>r.annotations?.representation?.id===t||r._tag==="FilterGroup"&&bo(r.checks,t))}var Ro=new hi;class xi extends ye{_tag="Boolean";getParser(){return cr(this,Ho)}getExpected(){return"boolean"}}var gi=new xi;class sr extends ye{_tag="Arrays";isMutable;elements;rest;encodingChecks;constructor(e,t,r,n,o,s,a,c){super(n,o,s,a);this.isMutable=e,this.elements=t,this.rest=r,this.encodingChecks=c;let l=!1;for(let i=0;i<t.length;i++)if(Me(t[i]))l=!0;else if(l)throw Error("A required element cannot follow an optional element. ts(1257)");if(l&&r.length>1)throw Error("A required element cannot follow an optional element. ts(1257)");for(let i=1;i<r.length;i++)if(Me(r[i]))throw 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 c(l,i){if(i<s)return n[i];else if(i>=l)return o[i-l+1];return o[0]}return co(function*(l,i){if(l===w)return w;if(!Array.isArray(l))return yield*R(new ke(r,l,i));if(!n)n=r.elements.map((d)=>({ast:d,parser:t(d)})),o=r.rest.map((d)=>({ast:d,parser:t(d)}));let h=l.length,x={ast:r,getParser:c,input:l,len:h,tailThreshold:Math.max(s,h-a),output:new globalThis.Array(h),issues:void 0,options:i},m=_o(i?.concurrency),p=Qu(x,l,{concurrency:m?.concurrency,end:r.rest.length===0?s:Math.max(h,s+a)});if(p)yield*p;if(r.rest.length===0&&h>s)for(let d=s;d<=h-1;d++){let E=new Br(r,l[d],i),u=new Se([d],E);if(i.errors==="all")if(x.issues)x.issues.push(u);else x.issues=[u];else return yield*R(new G(r,[u],l,i))}if(x.issues)return yield*R(new G(r,x.issues,l,i));return x.output})}_rebuild(e,t,r){let n=xt(this.elements,e),o=xt(this.rest,e);return n===this.elements&&o===this.rest&&t===this.checks&&r===this.encodingChecks?this:new sr(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"}}var Qu=Bt()({onItem(e,t,r){let n=r<e.len?t:w;return e.getParser(e.tailThreshold,r).parser(n,e.options)},step(e,t,r,n){if(r._tag==="Failure")return zr(e,e.ast,n,r);let o=r===z?t:r[S];if(o!==w)e.output[n]=o;else{let s=e.getParser(e.tailThreshold,n);if(Me(s.ast))return;let a=new Se([n],new Vt(s.ast.context?.annotations));if(e.options.errors==="all")if(e.issues)e.issues.push(a);else e.issues=[a];else return ut(new G(e.ast,[a],e.input,e.options))}}}),_o=(e)=>(e=e==="unbounded"?1/0:e??1,e>1?{concurrency:e}:void 0),zr=(e,t,r,n)=>{if(n.cause.reasons.length===0)return n;let o=Yt(n.cause);if(o===void 0)return ro(Ur(n.cause,(a)=>new G(t,[new Se([r],a)],e.input,e.options)));let s=new Se([r],o);if(e.options.errors==="all")if(e.issues)e.issues.push(s);else e.issues=[s];else return ut(new G(t,[s],e.input,e.options))},Si="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";function wo(e,t,r=Co){let n,o;function s(a){switch(a._tag){case"String":case"TemplateLiteral":return(n??=Object.keys(e)).filter((c)=>a.matchPart(c,r)!==void 0);case"Number":return(n??=Object.keys(e)).filter((c)=>a.matchKey(c,r)!==void 0);case"Symbol":return(o??=Object.getOwnPropertySymbols(e)).filter((c)=>a.matchKey(c,r)!==void 0);case"Union":return[...new Set(a.types.flatMap(s))];default:return[]}}return s($o(Qr(t)))}class Vr{name;type;constructor(e,t){this.name=e,this.type=t}}function Io(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every(Io);default:return!1}}function el(e){return Io(e)&&Io(Qr(e))}class Ao{parameter;type;constructor(e,t){if(!el(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,Me(t)&&!Di(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}}class Zr extends ye{_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;let c=e.map((l)=>l.name).filter((l,i,h)=>h.indexOf(l)!==i);if(c.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(c)}. ts(2300)`)}getParser(e,t=e){let r=this,n=[];for(let u of r.propertySignatures)n.push(u.name);let o=n.length,s=r.indexSignatures.length,a=o&&s?new Set(n):void 0;if(!o&&!s)return cr(r,Zo);let c,l,i=(u,f,g,y,T)=>{if(T._tag==="Failure")return zr(u,r,f,T)??lt;let B=T===z?y:T[S];if(g!==w&&B!==w){if(o&&(a.has(f)||a.has(g)))return lt;Ae(u.out,g,B)}return lt},h=(u,f,g,y)=>{if(!y){let U=g.parserKey(f,u.options);if(!N(U))return ve(jt(U),(C)=>h(u,f,g,C));y=U}if(y._tag==="Failure")return zr(u,r,f,y)??lt;let T=y===z?f:y[S],B=u.input[f],D=g.parserValue(B,u.options);return N(D)?i(u,f,T,B,D):ve(jt(D),(U)=>i(u,f,T,B,U))},x=(u,f,g)=>{let y=u.input[f],T=g.parserValue(y,u.options);return N(T)?i(u,f,f,y,T):ve(jt(T),(B)=>i(u,f,f,y,B))},m=s?Bt()({onItem:(u,[f,g])=>h(u,f,g),step:(u,f,g)=>g._tag==="Failure"?g:void 0}):void 0,p=()=>{if(!c)c=r.propertySignatures.map((u)=>({parser:t(u.type),name:u.name,type:u.type})),l=s?r.indexSignatures.map((u)=>({is:u,parserKey:e($o(u.parameter)),parserValue:t(u.type)})):void 0;return c},d=co(function*(u,f){if(u===w)return w;if(!(typeof u==="object"&&u!==null&&!Array.isArray(u)))return yield*R(new ke(r,u,f));p();let g=u,y={},T={ast:r,input:g,out:y,issues:void 0,options:f},B=f.errors==="all",D=f.onExcessProperty==="error",U=f.onExcessProperty==="preserve",C;if(!s&&(D||U)){a??=new Set(n),C=Reflect.ownKeys(g);for(let I=0;I<C.length;I++){let v=C[I];if(!a.has(v))if(D){let _=new Br(r,g[v],f),A=new Se([v],_);if(B){if(T.issues)T.issues.push(A);else T.issues=[A];continue}else return yield*R(new G(r,[A],u,f))}else Ae(y,v,g[v])}}let H=_o(f?.concurrency);if(o){let I=ii(T,c,H);if(I)yield*I}if(s&&!H)for(let I=0;I<s;I++){let v=l[I],_=v.is.parameter===nr?x:h,A=v.is.parameter===nr?Object.keys(g):wo(g,v.is.parameter,f);for(let Xe=0;Xe<A.length;Xe++){let Ce=_(T,A[Xe],v);if(!N(Ce))yield*Ce;else if(Ce._tag==="Failure")return yield*Ce}}else if(m){let I=wr();for(let _=0;_<s;_++){let A=l[_],Xe=wo(g,A.is.parameter,f);for(let Ce=0;Ce<Xe.length;Ce++)I.push([Xe[Ce],A])}let v=m(T,I,H);if(v)yield*v}if(T.issues)return yield*R(new G(r,T.issues,u,f));if(f.propertyOrder==="original"){let I=(C??Reflect.ownKeys(g)).concat(n),v={};for(let _ of I)if(Object.hasOwn(y,_))Ae(v,_,y[_]);return v}return y});if(s)return d;let E=(u,f,g)=>{let y=c[f];return ve(jt(g),(T)=>{let B=vo(u,y,T);if(B)return B;let D=()=>pe(u.out),U=ii(u,c.slice(f+1));return U?ie(U,D):D()})};return(u,f)=>{if(u===w)return Oe;if(f.errors==="all"||f.onExcessProperty!==void 0||f.propertyOrder==="original"||f.concurrency!==void 0)return d(u,f);if(!(typeof u==="object"&&u!==null&&!Array.isArray(u)))return R(new ke(r,u,f));let g=p(),y=u,T={},B={ast:r,input:y,out:T,issues:void 0,options:f};try{for(let D=0;D<g.length;D++){let U=g[D],C=U.name,H=Object.hasOwn(y,C),I=H?y[C]:w,v=U.parser(I,f);if(!N(v))return E(B,D,v);if(v===z){if(H)Ae(T,C,I);continue}let _=vo(B,U,v);if(_)return _}}catch(D){return Na(D)}return pe(T)}}_rebuild(e,t,r,n){let o=xt(this.propertySignatures,(a)=>{let c=e(a.type);return c===a.type?a:new Vr(a.name,c)}),s=xt(this.indexSignatures,(a)=>{let c=t(a.parameter),l=e(a.type);return c===a.parameter&&l===a.type?a:new Ao(c,l)});return o===this.propertySignatures&&s===this.indexSignatures&&r===this.checks&&n===this.encodingChecks?this:new Zr(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(){if(this.propertySignatures.length===0&&this.indexSignatures.length===0)return"object | array";return"object"}}function vo(e,t,r){if(r._tag==="Failure")return zr(e,e.ast,t.name,r);if(r===z)return;let n=r[S];if(n!==w){Ae(e.out,t.name,n);return}if(delete e.out[t.name],!Me(t.type)){let o=new Se([t.name],new Vt(t.type.context?.annotations));if(e.options.errors==="all"){if(e.issues)e.issues.push(o);else e.issues=[o];return}else return ut(new G(e.ast,[o],e.input,e.options))}}var ii=Bt()({onItem(e,t){if(!Object.hasOwn(e.input,t.name))return t.parser(w,e.options);let r=e.input[t.name];return Ae(e.out,t.name,r),t.parser(r,e.options)},step:vo});function yi(e,t){if(!e)return t;if(!t)return e;return[...e,...t]}function Fo(e,t,r){return new Zr(Reflect.ownKeys(e).map((n)=>new Vr(n,e[n].ast)),[],r,t)}function Po(e){return e.ast}function Do(e,t=void 0){return new sr(!1,e.map((r)=>r.ast),[],void 0,t)}function Uo(e,t,r){return new Ye(e.map(Po),t,void 0,r)}var Yr=bt((e)=>{while(!0){if(Xu(e))return rr;let t=e.encoding;if(!t)return e.recur?.(Yr,V)??e;if(t.some((r)=>r.transformation._tag==="Middleware"&&r.transformation.decode!==V))return rr;e=t[t.length-1].to}});function Ti(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(Ti)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function Gr(e){switch(e._tag){default:return[];case"Declaration":{let t=e.annotations?.[ja];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap((t)=>{let r=t.type;if(!Me(r)){if(mt(r))return[{key:t.name,literal:r.literal}];if(Eo(r))return[{key:t.name,literal:r.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,r)=>{if(!Me(t)){if(mt(t))return[{key:r,literal:t.literal}];if(Eo(t))return[{key:r,literal:t.symbol}]}return[]});case"Union":{if(e.types.length===0)return[];let t=e.types.map((r)=>Gr(Yr(r)));return t[0].filter((r)=>t.every((n)=>n.some((o)=>o.key===r.key&&o.literal===r.literal)))}case"Suspend":return Gr(e.thunk())}}var ci=new WeakMap,tr=Object.freeze([]);function tl(e){let t=ci.get(e);if(t)return t;let r,n=0,o,s,a=!0;for(let c=0;c<e.length;c++){let l=e[c],i=Yr(l);if(Zu(i))continue;if(a)if(mt(i)||Eo(i)){s??=new Map;let x=mt(i)?i.literal:i.symbol,m=s.get(x);if(!m)s.set(x,m=[]);m.push(l)}else a=!1;let h=Gr(i);if(h.length){r??=new Map,n++;for(let{key:x,literal:m}of h){let p=r.get(x);if(!p)r.set(x,p=[new Map,new Set]);p[1].add(c);let d=p[0].get(m);if(!d)p[0].set(m,d=new Set);d.add(c)}}else{o??={};let x=Ti(i);for(let m of x)(o[m]??=[]).push(c)}}if(a&&s)s.forEach(Object.freeze),t=(c)=>s.get(c)??tr;else if(r?.size===1&&!o){let[c,[l]]=r.entries().next().value,i=l;for(let[h,x]of l)i.set(h,Object.freeze(Array.from(x,(m)=>e[m])));t=(h,x)=>{if(ur(h)){let m=Object.hasOwn(h,c)?h[c]:void 0;if(m!==void 0)return i.get(m)??tr;if(x)return e}return tr}}else if(r){let c;for(let l of r)if((!c||l[1][0].size>c[1][0].size)&&l[1][1].size===n)c=l;t=(l,i)=>{let h=l===null?"null":Array.isArray(l)?"array":typeof l,x=o?.[h]??tr;if(!ur(l))return x.map((d)=>e[d]);let m=new Set(x),p;if(c){let[d,[E]]=c,u=Object.hasOwn(l,d),f=u?l[d]:void 0;if(u&&(!i||f!==void 0)){let g=E.get(f);if(!g)return x.map((y)=>e[y]);for(let y of g)m.add(y);p=d}}if(p===void 0)for(let[d,[E,u]]of r){let f=Object.hasOwn(l,d),g=f?l[d]:void 0;if(f&&(!i||g!==void 0)){let y=E.get(g);if(y)for(let T of y)m.add(T)}else if(i)for(let y of u)m.add(y)}for(let[d,[E,u]]of r){if(d===p)continue;let f=Object.hasOwn(l,d),g=f?l[d]:void 0;if(f&&(!i||g!==void 0)){let y=E.get(g);for(let T of m)if(u.has(T)&&!y?.has(T))m.delete(T)}}return Array.from(m).sort((d,E)=>d-E).map((d)=>e[d])}}else t=(c)=>{let l=c===null?"null":Array.isArray(c)?"array":typeof c;return(o?.[l]??tr).map((i)=>e[i]).filter(rl(c))};return ci.set(e,t),t}function rl(e){return(t)=>{let r=Yr(t);return r._tag==="Literal"?r.literal===e:r._tag==="UniqueSymbol"?r.symbol===e:!0}}function Ei(e,t,r=!1){return tl(t)(e,r)}class Ye extends ye{_tag="Union";types;mode;encodingChecks;constructor(e,t,r,n,o,s,a){super(r,n,o,s);this.types=e,this.mode=t,this.encodingChecks=a}getParser(e,t){let r=this;return(n,o)=>{if(n===w)return Oe;let s=Ei(n,r.types,t!==void 0);if(s.length===1){let i=e(s[0])(n,o);if(i._tag==="Success")return i;return N(i)?ui(r,i.cause,n,o):qt(i,(h)=>ui(r,h,n,o))}let a={ast:r,compile:e,input:n,out:void 0,successes:r.mode==="oneOf"?[]:void 0,issues:void 0,options:o},c=_o(o?.concurrency),l=nl(a,s,c?{...c,orderedStep:!0}:void 0);if(!l){if(a.out)return a.out;return R(new Zt(r,a.issues??[],n,o))}return ie(l,(i)=>{if(a.out===z)return L(n);if(a.out)return a.out;return R(new Zt(r,a.issues??[],n,o))})}}_rebuild(e,t,r){let n=xt(this.types,e);return n===this.types&&t===this.checks&&r===this.encodingChecks?this:new Ye(n,this.mode,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}return}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=Qr(n);switch(o._tag){case"Arrays":{let s=o.elements.filter(mt);if(s.length>0)return`${li(o.isMutable)}[ ${s.map((a)=>e(a)+fi(a.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let s=o.propertySignatures.filter((a)=>mt(a.type));if(s.length>0)return`{ ${s.map((a)=>`${li(a.type.context?.isMutable)}${rt(a.name)}${fi(a.type.context?.isOptional)}: ${e(a.type)}`).join(", ")}, ... }`;break}}return e(o)});return Array.from(new Set(r)).join(" | ")}}function ui(e,t,r,n){let o=Yt(t);if(!o)return ro(t);return ut(new Zt(e,[o],r,n))}var nl=Bt()({onItem(e,t){return e.compile(t)(e.input,e.options)},step(e,t,r){if(r._tag==="Failure"){let n=Yt(r.cause);if(n===void 0)return r;if(e.issues)e.issues.push(n);else e.issues=[n]}else{if(e.out&&e.successes)return e.successes.push(t),ut(new xo(e.ast,e.successes,e.input,e.options));if(e.out=r,e.successes)e.successes.push(t);else return lt}}}),bi=new Ye([new Ve("Infinity"),new Ve("-Infinity"),new Ve("NaN")],"anyOf");function li(e){return e?"":"readonly "}function fi(e){return e?"?":""}class Hr extends Et{_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 Hr(this.run,{...this.annotations,...e},this.aborted)}abort(){return new Hr(this.run,this.annotations,!0)}and(e,t){return new or([this,e],t)}}class or extends Et{_tag="FilterGroup";checks;annotations;constructor(e,t=void 0){super();this.checks=e,this.annotations=t}annotate(e){return new or(this.checks,{...this.annotations,...e})}and(e,t){return new or([this,e],t)}}function Xr(e,t,r=!1){return new Hr((n,o,s)=>za(o,e(n,o,s),n,s),t,r)}function wi(e){return Xr((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 Ii=ir(Ro,[wi()]),ol=new ce(new Ye([Ii,bi],"anyOf"),new Q(Jr(),oe((e)=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function Mo(e,t){let r=e.source,n=new globalThis.RegExp(r,e.flags);return Xr((o)=>(n.lastIndex=0,n.test(o)),{expected:`a string matching the RegExp ${r}`,representation:{id:"effect/schema/isPattern",payload:{source:r,flags:e.flags}},toJsonSchema:()=>({pattern:r}),arbitrary:{constraint:{patterns:[e.source]}},...t})}function ar(e,t){let r=Object.getOwnPropertyDescriptors(e);return t(r),Object.create(Object.getPrototypeOf(e),r)}var vi=new WeakMap;function sl(e){return vi.get(e)??e}function me(e,t){if(e.encoding===t)return e;return ar(e,(r)=>{r.encoding.value=t})}function Oi(e,t){if(e.context===t)return e;let r=sl(e);if(r.context===t)return r;let n=ar(e,(o)=>{o.context.value=t});return vi.set(n,r),n}function No(e,t){if(e.checks){let r=e.checks[e.checks.length-1];return ki(e,Fn(e.checks.slice(0,-1),r.annotate(t)))}return ar(e,(r)=>{r.annotations.value={...r.annotations.value,...t}})}function ki(e,t){if(e._tag==="Suspend"&&t)throw Error("Cannot add checks to Suspend");if(e.checks===t)return e;return ar(e,(r)=>{r.checks.value=t})}function ir(e,t){return ki(e,yi(e.checks,t))}function Ci(e,t){let r=t(e.to);return r===e.to?e:new ce(r,e.transformation)}function al(e,t){let r=e,n=r[r.length-1],o=Ci(n,t);return o===n?e:Fn(e.slice(0,e.length-1),o)}function Ri(e,t){function r(n){if(n.encoding){let o=n.encoding[n.encoding.length-1];return t?.stopAt?.(o)?n:me(n,al(n.encoding,r))}return e(n)}return bt(r)}function il(e,t,r){let n=new ce(e,t);return me(r,r.encoding?[...r.encoding,n]:[n])}function xt(e,t){let r=!1,n=Array(e.length);for(let o=0;o<e.length;o++){let s=e[o],a=t(s);if(a!==s)r=!0;n[o]=a}return r?n:e}function Lo(e,t){let r=e.context?new ht(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new ht(!1,!1,void 0,t);return Oi(e,r)}function _i(e,t){let r=new Q(go(t),dt()),n=new ce(rr,r),o=e.context?new ht(e.context.isOptional,e.context.isMutable,n,e.context.annotations):new ht(!1,!1,n);return Oi(e,o)}function Ai(e,t,r){return il(e,r,t)}function cl(e){let t=[],r=[];function n(o){switch(o._tag){case"Literal":if(Vo(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++)n(o.types[s]);return;default:r.push(o)}}return n(e),{literals:t,parameters:r}}function Fi(e,t){let{literals:r,parameters:n}=cl(e);return new Zr(r.map((o)=>new Vr(o,t)),n.map((o)=>new Ao(o,t)))}function Me(e){return e.context?.isOptional??!1}function Pi(e){return e.annotations?.[Ba]===!0||e._tag==="FilterGroup"&&e.checks.every(Pi)}function ul(e){function t(n){if(Pi(n))return[n];return n._tag==="FilterGroup"?n.checks.flatMap(t):[]}let r=e.flatMap(t);return Pn(r)?r:void 0}var gt=bt((e)=>{if(e.encoding)return gt(me(e,void 0));let t=e,r=t.recur?.(gt)??t,n=r.encodingChecks;if(n){let o=r===e?n:pi(r)||Yu(r)||ko(r)&&r.typeParameters.length>0?ul(n):void 0;return ar(r,(s)=>{s.encodingChecks.value=void 0,s.checks.value=yi(r.checks,o)})}return r}),Qr=bt((e)=>gt(Ue(e)));function ll(e,t){let r=t,n=r.length,o=r[n-1],s=[new ce(Ue(me(e,void 0)),r[0].transformation.flip())];for(let c=1;c<n;c++)s.unshift(new ce(Ue(r[c-1].to),r[c].transformation.flip()));let a=Ue(o.to);if(a.encoding)return me(a,[...a.encoding,...s]);else return me(a,s)}var Ue=Re((e)=>{if(e.encoding)return ll(e,e.encoding);let t=e;return t.flip?.(Ue)??t.recur?.(Ue)??t});function Di(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(Di);default:return!1}}function fl(e,t){let r=pe(t);return(n,o)=>{if(n===w)return Oe;if(n===t)return r;return R(new ke(e,n,o))}}function cr(e,t){return(r,n)=>{if(r===w)return Oe;if(t(r))return z;return R(new ke(e,r,n))}}var $o=Ri((e)=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur($o)}});var Oo=new globalThis.RegExp(`^${Si}$`),pl=new globalThis.RegExp(`^(?:${Si}|Infinity|-Infinity|NaN)$`);function Ui(e){return Mo(Oo,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:Oo.source}),...e})}var Mi=ir(nr,[Ui()]),dl=new ce(Mi,Kr),ml=new ce(new Ye([Mi,bi],"anyOf"),Kr),hl="-?\\d+",Ug=new globalThis.RegExp(`^${hl}$`);var xl="Symbol\\((.*)\\)",Mg=new globalThis.RegExp(`^${xl}$`);function Ne(e,t,r,n,o){for(let s=0;s<e.length;s++){let a=e[s];if(a._tag==="FilterGroup"){if(r=Ne(a.checks,t,r,n,o),r&&(o.errors!=="all"||r[r.length-1].filter.aborted))return r}else{let c=a.run(t,n,o);if(c){let l=new mo(a,c,t,o);if(r)r.push(l);else r=[l];if(o.errors!=="all"||a.aborted)return r}}}return r}function Ni(e){if(!ko(e))return;let t=e.annotations?.[qa];return Ot(t)?t(e.typeParameters):void 0}function tn(e){let t=qi(rn,gt(e.ast));return(r,n)=>t(r,n?.disableChecks?n?.parseOptions?{...n.parseOptions,disableChecks:!0}:{disableChecks:!0}:n?.parseOptions)}function jo(e){let t=tn(e);return(r,n)=>{let o=Jt(t(r,n));if(Mr(o))return ge(o.value);return jr(o.cause,"Option adapter can only return none for schema issues"),Ee()}}function $i(e){let t=tn(e);return(r,n)=>{let o=Jt(t(r,n));if(Mr(o))return o.value;let s=jr(o.cause,"Constructor adapter can only throw schema issues");throw Error("Schema validation failed",{cause:s})}}function Bi(e,t){let r=Sl(e.ast);return t===void 0?r:(n,o)=>r(n,en(t,o))}function ji(e,t){return Tl(Bi(e,t))}var en=(e,t)=>t?{...e,...t}:e,Li=(e)=>{if(e===w)return R(new Y);return L(e)};function Sl(e){return qi(Ji,e)}function qi(e,t){let r;return(n,o)=>{let s=(r??=e(t))(n,o??Co);if(s===z)return L(n);if(!N(s))return ie(s,Li);return s[S]===w?Li(w):s}}function yl(e){return(t,r)=>Jt(e(t,r))}function Tl(e){let t=yl(e);return(r,n)=>{let o=t(r,n);if(Mr(o))return ze(o.value);return xe(jr(o.cause,"Result adapter can only return schema issues"))}}var Ji=Re((e)=>qo(e,Ji)),rn=Re((e)=>qo(e,rn,Ki)),El=Re((e)=>qo(e,rn,Ki,e.context?.constructorDefault));function Ki(e){return e.context?.constructorDefault?El(e):rn(e)}function zi(e,t,r,n){let o;if(N(e)&&e._tag==="Success"){let s=Lr(e===z?t:e[S]);o=r._tag==="Transformation"?r.decode.run(s,n):r.decode(pe(s),n)}else if(r._tag==="Transformation")o=ie(e,(s)=>r.decode.run(Lr(s),n));else o=r.decode(ft(e,Lr),n);return N(o)&&o._tag==="Success"?uo(o[S]):ie(o,uo)}function bl(e,t){let r;return(n,o)=>{if(n===w)return Oe;if(e.isConstructed(n))return z;let s=(r??=t(e.link.to))(n,o);return zi(s,n,e.link.transformation,o)}}function qo(e,t,r,n){let o=r?Ni(e):void 0,s=o?bl(o,t):e.getParser(t,r),a=e.checks,c=n?e.encoding?[...e.encoding,n]:[n]:e.encoding,l=e.encodingChecks,i=(a?a[a.length-1].annotations:e.annotations)?.parseOptions;if(!c&&!a&&!l){if(!i)return s;return(m,p)=>s(m,en(p,i))}let h,x=(m,p)=>{let d=s(m,p);if(l&&!p.disableChecks)if(N(d)){if(d._tag==="Success"){let E=d===z?m:d[S];if(m!==w&&E!==w){let u=Ne(l,m,void 0,e,p);if(u)d=R(new G(e,u,m,p))}}}else d=ve(d,(E)=>{if(m!==w&&E!==w){let u=Ne(l,m,void 0,e,p);if(u)return R(new G(e,u,m,p))}return L(E)});if(a&&!p.disableChecks)if(N(d)){if(d._tag==="Success"){let E=d===z?m:d[S];if(E===w)return d;let u=Ne(a,E,void 0,e,p);if(u)d=R(new G(e,u,E,p))}}else d=ve(d,(E)=>{if(E!==w){let u=Ne(a,E,void 0,e,p);if(u)return R(new G(e,u,E,p))}return L(E)});return d};if(!c)return i?(m,p)=>x(m,en(p,i)):x;return(m,p)=>{if(i)p=en(p,i);let d=h??=c.map((f)=>t(f.to)),E=m,u=d[d.length-1](m,p);for(let f=c.length-1;f>=0;f--)if(u=zi(u,E,c[f].transformation,p),f!==0){let g=d[f-1];if(u._tag==="Success")E=u[S],u=g(E,p);else u=ie(u,(y)=>{let T=g(y,p);return T===z?pe(y):T})}if(u._tag==="Success"){let f=u[S],g=x(f,p);return g===z?u:g}return u=qt(u,(f)=>so(()=>Ur(f,(g)=>new ho(e,g,m,p)))),ie(u,(f)=>{let g=x(f,p);return g===z?pe(f):g})}}var Jo="~effect/Schema/Schema";var wl={[Jo]:Jo,pipe(){return se(this,arguments)},annotate(e){return this.rebuild(No(this.ast,e))},annotateKey(e){return this.rebuild(Lo(this.ast,e))},check(...e){return this.rebuild(ir(this.ast,e))}};function Ko(e,t){function r(){}let n=Object.defineProperties(Object.setPrototypeOf(r,wl),Object.getOwnPropertyDescriptors({...t}));return n.ast=e,n.rebuild=(o)=>Ko(o,t),n.makeEffect=tn(n),n.make=$i(n),n.makeOption=jo(n),n}var Hi=(e)=>e;function Ol(){return(e,t,r)=>ee(new Wr(e.map(Po),(n)=>t(n.map((o)=>ee(o))),r))}function kl(e,t){return Ol()([],()=>(r,n,o)=>e(r)?L(r):R(new ke(n,r,o)),t)}var Wi="~effect/SchemaError/SchemaError";class Zi extends kr("SchemaError"){[Wi]=Wi;constructor(e){let t=Xs();Jn(0);try{super({issue:e})}finally{Jn(t)}}get message(){return Wa(this.issue)}toString(){return`SchemaError(${this.message})`}}function Cl(e,t){let r=ji(e,t);return(n,o)=>Es(r(n,o),(s)=>new Zi(s))}var ee=Ko;function Yi(e){let t=ee(new Ve(e),{literal:e,transform(r){return t.pipe(Pl(Yi(r),{decode:oe(()=>r),encode:oe(()=>e)}))}});return t}var nn=ee(rr);var W=ee(nr),Rl=ee(Ro),_l=ee(gi);function Xi(e,t){return ee(e,{fields:t,mapFields(r,n){let o=r(this.fields);return Xi(Fo(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function St(e){return Xi(Fo(e,void 0),e)}function Qi(e,t){return ee(Fi(e.ast,t.ast),{key:e,value:t})}function ec(e,t){return ee(e,{elements:t,mapElements(r,n){let o=r(this.elements);return ec(Do(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Al(e){return ec(Do(e),e)}var Fl=Hi((e)=>ee(new sr(!1,[],[e.ast]),{value:e}));function tc(e,t){return ee(e,{members:t,mapMembers(r,n){let o=r(this.members);return tc(Uo(o,this.ast.mode,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function rc(e,t){return tc(Uo(e,t?.mode??"anyOf",void 0),e)}function Pl(e,t){return(r)=>ee(Ai(r.ast,e.ast,t?yo(t):To()),{from:r,to:e})}function Dl(e){return(t)=>ee(_i(t.ast,e),{schema:t})}function Vi(e){return Yi(e).pipe(Dl(L(e)))}function yt(e,t){return kl((r)=>r instanceof e,t)}function Tt(){return(e,t)=>new ce(e.ast,yo(t))}var Ul=Xr;function Ml(e,t){let{source:r,flags:n}=e,o=n===""?`new RegExp(${F(r)})`:`new RegExp(${F(r)}, ${F(n)})`;return Mo(e,{toCode:()=>({runtime:`Schema.isPattern(${o})`}),...t})}function Nl(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return Ml(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}function Ll(e){return Ul((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 $l=Rl.check(Ll());var _y=yt(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>Tt()(St({source:W,flags:W}),er({decode:(e,t)=>ao({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new Y({expected:"valid RegExp source and flags"},e,t)}),encode:(e)=>L({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,r])=>new globalThis.RegExp(t,r)),toEquivalence:()=>(e,t)=>e.source===t.source&&e.flags===t.flags});var Bl=W.annotate({expected:"a string that will be decoded as a URL"}),Ay=yt(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>Tt()(Bl,ri),toArbitrary:()=>(e)=>e.webUrl().map((t)=>new globalThis.URL(t)),toEquivalence:()=>(e,t)=>e.toString()===t.toString()});var jl=yt(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>Tt()(St({data:W.check(Nl()),type:W,name:W,lastModified:$l}),er({decode:(e,t)=>Tr(Ar(e.data),{onFailure:()=>R(new Y({expected:"a valid Base64 string"},e.data,t)),onSuccess:(r)=>{let n=new globalThis.Uint8Array(r);return L(new globalThis.File([n],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>Ma({try:async()=>{let r=new globalThis.Uint8Array(await e.arrayBuffer());return{data:_r(r),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new Y({expected:"a readable File"},e,t)})}))});var Fy=yt(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>Tt()(Fl(Al([W,rc([St({_tag:Vi("String"),value:W}),St({_tag:Vi("File"),value:jl})])])),er({decode:(e)=>{let t=new globalThis.FormData;for(let[r,n]of e)t.append(r,n.value);return L(t)},encode:(e)=>L(globalThis.Array.from(e.entries()).map(([t,r])=>{if(typeof r==="string")return[t,{_tag:"String",value:r}];else return[t,{_tag:"File",value:r}]}))}))});var Py=yt(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>Tt()(W.annotate({expected:"a query string that will be decoded as URLSearchParams"}),ti({decode:(e)=>new globalThis.URLSearchParams(e),encode:(e)=>e.toString()}))});var ql=W.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),Dy=yt(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>Tt()(ql,ni),toArbitrary:()=>(e)=>e.uint8Array()});import{accessSync as Jl,constants as Kl,realpathSync as ic}from"node:fs";import{createRequire as zl}from"node:module";import ac from"node:path";import{fileURLToPath as Gl}from"node:url";var oc=(e)=>{let t=e?.trim();return t===void 0||t.length===0?void 0:t},sc=()=>({bunExecutable:oc(process.env.TRIPWIRE_BUN),forcePortable:process.env.TRIPWIRE_FORCE_PORTABLE==="1",packageDist:oc(process.env.TRIPWIRE_PACKAGE_DIST)});var Hl=["@seanmozeik","tripwire-darwin-arm64"].join("/"),Wl=(e)=>{try{return Jl(e,Kl.X_OK),ic(e)}catch{return}},Vl=(e,t)=>{try{let r=t?.()??zl(e).resolve(Hl);return Wl(r)}catch{return}},Zl=(e)=>{let t=Gl(e),r=t;try{r=ic(t)}catch{}return ac.join(ac.dirname(r),"tripwire.js")},cc=(e={})=>{let t=e.moduleUrl??import.meta.url,r=e.platform??process.platform,n=e.architecture??process.arch,o=sc();if(!o.forcePortable&&r==="darwin"&&n==="arm64"){let s=Vl(t,e.nativeResolver);if(s!==void 0)return{arguments:[],executable:s,kind:"native"}}return{arguments:[e.portableExecutable??Zl(t)],executable:e.bunExecutable??o.bunExecutable??"bun",kind:"portable"}};var rf=St({input:Qi(W,nn),toolCallId:W,toolName:W}),nf=St({input:Qi(W,nn),toolCallId:W,toolName:W,content:nn,details:nn,isError:_l}),of=rc([nf,rf]),uc=60000,sf=(e=import.meta.url)=>{let t=ef(e),r=t;try{r=Ql(t)}catch{}return cc({moduleUrl:tf(r)})},af=sf(),on=(e,t,r)=>{for(let n of t){let o=e[n];if(typeof o==="string")return o}throw Error(`Pi ${r} is missing`)},cf=(e,t)=>{let r=e[t];return Array.isArray(r)?r.filter((n)=>typeof n==="string"):[]},uf=(e)=>{let{edits:t}=e;if(Array.isArray(t)){let r=[],n=[];for(let o of t)if(sn(o)){let s=j(o,"oldText")??j(o,"old_string"),a=j(o,"newText")??j(o,"new_string");if(s!==void 0)r.push(s);if(a!==void 0)n.push(a)}return{old_string:r.join(`
|
|
12
|
+
`),new_string:n.join(`
|
|
13
|
+
`)}}return{old_string:j(e,"oldText")??j(e,"old_string")??"",new_string:j(e,"newText")??j(e,"new_string")??j(e,"input")??j(e,"_input")??""}},lf=(e,t,r)=>{let n;if(e.startsWith("+"))n="newLines";else if(e.startsWith("-"))n="oldLines";if(n!==void 0)for(let o of t)r.get(o)?.[n].push(e.slice(1))},ff=(e)=>{let t=/^\*{3}\s+(?:Add|Update|Delete)\s+File\s*:\s*(?<path>\S.*?)\s*$/u,r=/^\*{3}\s+Move\s+to\s*:\s*(?<path>\S.*?)\s*$/u,n=new Map,o=[],s="*** Begin Patch",a="*** End Patch",c=e.split(/\r?\n/u),l=c.findIndex((p)=>p.trim()===s);if(l===-1)return[];let i=c.slice(l+1),h=[...i,a].findIndex((p)=>p.trim()===a),x=i.slice(0,h),m=(p)=>{if(o.push(p),!n.has(p))n.set(p,{newLines:[],oldLines:[]})};for(let p of x){let E=t.exec(p)?.groups?.path?.trim();if(E!==void 0&&E.length>0)o=[],m(E);else if(o.length>0){let f=r.exec(p)?.groups?.path?.trim();if(f!==void 0&&f.length>0)m(f);else lf(p,o,n)}}return[...n].map(([p,d])=>({file_path:p,new_string:d.newLines.join(`
|
|
14
|
+
`),old_string:d.oldLines.join(`
|
|
15
|
+
`)}))},pf=(e)=>{let{input:t,toolName:r}=e;if(r==="bash"||r==="powershell")return[{command:on(t,["command"],`${r} command`)}];if(r==="read")return[{file_path:on(t,["path","file_path"],"read path")}];if(r==="write")return[{content:on(t,["content"],"write content"),file_path:on(t,["path","file_path"],"write path")}];if(r==="edit"){let n=ff(j(t,"input")??"");if(n.length>0)return n;let o=j(t,"path")??j(t,"file_path"),a=cf(t,"paths");if(a.length===0&&o!==void 0)a=[o];if(a.length===0)throw Error("Pi edit path is missing");let c=uf(t),l=[];for(let i of a)l.push({file_path:i,...c});return l}return[t]},df=(e)=>{if(typeof e==="string")return e;if(!Array.isArray(e))return"";let t=[];for(let r of e)if(sn(r)&&r.type==="text"&&typeof r.text==="string")t.push(r.text);return t.join(`
|
|
16
|
+
`)},mf=(e)=>{let t=df(e.content);if(e.toolName==="bash"||e.toolName==="powershell")return{stdout:t,stderr:e.isError?t:"",interrupted:e.isError};if(e.toolName==="read")return{content:t};return{content:t,details:e.details,isError:e.isError}},lc=(e,t,r)=>{let n=Cl(of)(e);if(st(n))throw Error("Pi sent an invalid tool event");let o=n.success,s={cwd:r,hook_event_name:t,tool_name:o.toolName,tool_use_id:o.toolCallId};if("content"in o)return[{...s,tool_input:o.input,tool_response:mf(o)}];let a=[];for(let c of pf(o))a.push({...s,tool_input:c});return a},fc=async(e)=>{e.setEncoding("utf8");let t="";for await(let r of e)t+=String(r);return t},hf=async(e,t)=>{let r=Yl(e.executable,[...e.arguments,"--tripwire-hook"],{stdio:["pipe","pipe","pipe"]}),n={timedOut:!1},o=setTimeout(()=>{n.timedOut=!0,r.kill("SIGKILL")},uc);r.stdin.end(JSON.stringify(t));try{let[s,a,c]=await Promise.all([Xl(r,"close"),fc(r.stdout),fc(r.stderr)]);if(n.timedOut)throw Error(`Tripwire exceeded its ${uc}ms timeout`);return{exitCode:typeof s[0]==="number"?s[0]:1,stderr:c,stdout:a}}finally{clearTimeout(o)}},sn=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),j=(e,t)=>{let r=e[t];return typeof r==="string"?r:void 0},pc=(e)=>{if(e.exitCode!==0)return e.stderr.trim()||`Tripwire exited ${e.exitCode}`;if(e.stdout.trim().length===0)return"Tripwire returned no decision";try{let t=JSON.parse(e.stdout);if(!sn(t))return"Tripwire returned invalid JSON";let r=sn(t.hookSpecificOutput)?t.hookSpecificOutput:void 0,n=(r===void 0?void 0:j(r,"permissionDecision"))??j(t,"permissionDecision")??j(t,"permission"),o=(r===void 0?void 0:j(r,"permissionDecisionReason"))??j(t,"permissionDecisionReason")??j(t,"reason")??"Blocked by Tripwire";if(n==="deny"||n==="ask")return o;if(j(t,"decision")==="block"||t.continue===!1)return o;return t.continue===!0||n==="allow"?void 0:"Tripwire returned an unrecognized response"}catch{return"Tripwire returned invalid JSON"}},xf=(e,t=hf)=>{let r=typeof e==="string"?{arguments:[],executable:e,kind:"native"}:e;return(n)=>{n.on("tool_call",async(o,s)=>{try{let a=lc(o,"PreToolUse",s.cwd),c=a.length===1?a[0]:a;if(c===void 0)throw Error("Tripwire could not normalize the Pi tool call");let l=pc(await t(r,c));if(l!==void 0)return{block:!0,reason:l};return{}}catch(a){return{block:!0,reason:`Tripwire failed closed: ${a instanceof Error?a.message:String(a)}`}}}),n.on("tool_result",async(o,s)=>{try{let[a]=lc(o,"PostToolUse",s.cwd);if(a===void 0)throw Error("Tripwire could not normalize the Pi tool result");let c=pc(await t(r,a));if(c!==void 0)s.ui.notify(`Tripwire stopped the session: ${c}`,"error"),s.abort()}catch(a){s.ui.notify(`Tripwire failed closed after tool use: ${a instanceof Error?a.message:String(a)}`,"error"),s.abort()}})}},Rb=xf(af);export{xf as createTripwirePiExtension,Rb as default,lc as hookInputs,sf as resolveShippedHookCommand,pc as tripwirePiDenialReason};
|