@systemfsoftware/omp-claude-compat 1.7.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +86 -0
- package/README.md +23 -0
- package/dist/Cause-BPRKNAWJ.js +1 -0
- package/dist/Effect-CYgXOp91.js +1 -0
- package/dist/Exit-Dz81ekW_.js +1 -0
- package/dist/HookDispatcherHandler-B8MCwQDv.js +2 -0
- package/dist/HookRuntime-CqLT5NiL.js +1 -0
- package/dist/InjectInstructionsHandler-DAJ1PFUG.js +3 -0
- package/dist/RunUserPromptSubmitHooksExecutor-C-kpE1OB.js +9 -0
- package/dist/dist-BkUkC5Q5.js +26 -0
- package/dist/effect-CczU2E3R.js +13 -0
- package/dist/index.js +1 -1
- package/package.json +26 -26
- package/dist/Cause-DsRZwSYW.js +0 -1
- package/dist/Effect-C1HfHpDW.js +0 -14
- package/dist/Exit-DWkYikJN.js +0 -1
- package/dist/core-CG9iBVjE.js +0 -13
- package/dist/dist-CJoMkiK8.js +0 -26
- package/dist/hook-dispatcher.executor-B43vD5qz.js +0 -8
- package/dist/hook-dispatcher.handler-W-5FqY16.js +0 -1
- package/dist/hook-runtime.state-CI_DEJtD.js +0 -1
- package/dist/inject-instructions.executor-C5AgD0Hh.js +0 -3
- package/dist/inject-instructions.handler-CT6g_sFm.js +0 -1
package/dist/dist-CJoMkiK8.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import{$c as e,$i as t,$o as n,$s as r,Ac as i,Ao as a,As as o,Bc as s,Bs as c,Cl as l,Co as u,Cr as d,Cs as f,Dc as p,Dn as m,Ds as h,El as g,Eo as _,Es as ee,Fc as te,Fi as ne,Gi as re,Go as ie,Gs as ae,Hc as oe,Hi as se,Hs as v,Ii as ce,Io as le,Is as ue,Ji as de,Jo as fe,Jr as pe,Js as me,Ko as he,Ks as ge,Lc as _e,Lo as ve,Lr as ye,Ls as be,Mi as xe,Ms as Se,Ni as Ce,Nr as we,Ns as Te,Oo as Ee,Os as De,Pi as Oe,Pr as ke,Ps as Ae,Qc as je,Qi as Me,Qs as Ne,Ro as Pe,Rs as y,So as Fe,Ss as Ie,Tc as Le,Tl as b,Tr as Re,Uc as ze,Ui as Be,Uo as Ve,Us as He,Vc as Ue,Vo as We,Wc as Ge,Wi as Ke,Ws as qe,Xi as Je,Xn as Ye,Xs as Xe,Yi as Ze,Yo as Qe,Ys as x,Zc as $e,Zs as et,_l as tt,_o as nt,al as rt,b as it,bo as at,ci as ot,cl as st,cr as ct,ct as lt,dl as ut,dt,el as ft,es as pt,fl as mt,fs as ht,ft as gt,gl as _t,hl as vt,ia as yt,il as bt,in as xt,jc as St,jo as Ct,js as wt,k as Tt,kc as Et,ko as Dt,kr as Ot,ks as kt,lc as At,li as jt,ll as Mt,ml as Nt,ms as Pt,na as Ft,nc as It,oa as Lt,ol as Rt,pt as zt,qs as Bt,rl as Vt,ro as Ht,rt as Ut,sl as Wt,ss as Gt,ta as Kt,tc as S,ts as qt,ul as Jt,ut as Yt,vl as Xt,vn as Zt,w as Qt,wl as C,wr as $t,ws as en,xl as tn,xo as nn,xs as rn,yl as an,yo as on,zc as sn,zs as w}from"./core-CG9iBVjE.js";import{$ as cn,A as ln,An as un,At as dn,B as fn,Bt as pn,C as mn,Cn as hn,Ct as gn,D as _n,Dt as vn,E as yn,En as bn,Et as xn,F as Sn,Ft as Cn,G as wn,Gn as Tn,Gt as En,I as T,In as Dn,It as E,J as On,Kn as kn,Kt as An,L as jn,M as Mn,Mn as Nn,Mt as Pn,N as Fn,Nn as In,Nt as Ln,O as Rn,On as zn,Ot as Bn,Pn as Vn,Pt as Hn,Q as Un,R as Wn,Rt as Gn,S as Kn,Sn as qn,St as Jn,T as Yn,Tn as Xn,Tt as Zn,Ut as Qn,V as $n,Vt as er,W as tr,Wn as nr,Wt as rr,X as ir,Y as ar,Z as or,_ as D,_n as sr,_t as cr,b as lr,bn as ur,bt as dr,c as fr,cn as pr,ct as mr,d as hr,dn as gr,et as _r,f as vr,fn as yr,g as br,gn as xr,gt as Sr,h as Cr,hn as wr,ht as Tr,i as Er,it as Dr,j as Or,jt as kr,k as Ar,kn as jr,kt as Mr,ln as Nr,lt as Pr,m as Fr,mn as Ir,n as O,nn as Lr,nt as Rr,o as zr,ot as k,p as Br,pt as Vr,q as Hr,qn as Ur,qt as Wr,r as Gr,s as Kr,st as A,tt as qr,u as Jr,un as Yr,ut as Xr,v as Zr,vn as Qr,w as $r,wn as ei,wt as j,x as M,xt as ti,y as ni,yn as ri,z as ii,zt as ai}from"./Effect-C1HfHpDW.js";import{a as oi,c as si,d as ci,h as li,i as ui,l as di,m as fi,n as pi,o as mi,p as hi,r as gi,s as _i,u as vi}from"./Cause-DsRZwSYW.js";import{a as yi,c as bi,d as xi,f as Si,h as Ci,i as wi,l as Ti,m as Ei,n as Di,p as Oi,r as ki,s as Ai,u as ji}from"./Exit-DWkYikJN.js";import Mi from"node:os";const Ni=jt,Pi=e=>t=>{let n=t===void 0?Object.create(At):Ni(t);return n._tag=e,n},Fi=ot,Ii=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return{BaseEffectError:class extends it{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(Object.assign(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}.BaseEffectError}(),Li=e=>{let t={BaseEffectError:class extends Ii{_tag=e}};return t.BaseEffectError.prototype.name=e,t.BaseEffectError},Ri=Symbol.for(`effect/DateTime`),zi=Symbol.for(`effect/DateTime/TimeZone`),Bi={[Ri]:Ri,pipe(){return Le(this,arguments)},[p](){return this.toString()},toJSON(){return _a(this).toJSON()}},Vi={...Bi,_tag:`Utc`,[Ge](){return sn(this,oe(this.epochMillis))},[_e](e){return qi(e)&&e._tag===`Utc`&&this.epochMillis===e.epochMillis},toString(){return`DateTime.Utc(${_a(this).toJSON()})`}},Hi={...Bi,_tag:`Zoned`,[Ge](){return g(oe(this.epochMillis),s(Ue(this.zone)),sn(this))},[_e](e){return qi(e)&&e._tag===`Zoned`&&this.epochMillis===e.epochMillis&&te(this.zone,e.zone)},toString(){return`DateTime.Zoned(${ja(this)})`}},Ui={[zi]:zi,[p](){return this.toString()}},Wi={...Ui,_tag:`Named`,[Ge](){return sn(this,ze(`Named:${this.id}`))},[_e](e){return Ji(e)&&e._tag===`Named`&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:`TimeZone`,_tag:`Named`,id:this.id}}},Gi={...Ui,_tag:`Offset`,[Ge](){return sn(this,ze(`Offset:${this.offset}`))},[_e](e){return Ji(e)&&e._tag===`Offset`&&this.offset===e.offset},toString(){return`TimeZone.Offset(${ba(this.offset)})`},toJSON(){return{_id:`TimeZone`,_tag:`Offset`,offset:this.offset}}},Ki=(e,t,n)=>{let r=Object.create(Hi);return r.epochMillis=e,r.zone=t,Object.defineProperty(r,"partsUtc",{value:n,enumerable:!1,writable:!0}),Object.defineProperty(r,"adjustedEpochMillis",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(r,"partsAdjusted",{value:void 0,enumerable:!1,writable:!0}),r},qi=e=>$e(e,Ri),Ji=e=>$e(e,zi),Yi=e=>Ji(e)&&e._tag===`Offset`,Xi=e=>Ji(e)&&e._tag===`Named`,Zi=e=>e._tag===`Utc`,Qi=e=>e._tag===`Zoned`,$i=an((e,t)=>e.epochMillis===t.epochMillis),ea=e=>{let t=Object.create(Vi);return t.epochMillis=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},ta=e=>{let t=e.getTime();if(Number.isNaN(t))throw new pi(`Invalid date`);return ea(t)},na=e=>{if(qi(e))return e;if(e instanceof Date)return ta(e);if(typeof e==`object`){let t=new Date(0);return Ca(t,e),ta(t)}return typeof e==`string`&&!ra(e)?ta(new Date(e+`Z`)):ta(new Date(e))},ra=e=>/Z|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e);-864e13+432e5;const ia=(e,t)=>{if(t?.timeZone===void 0&&qi(e)&&Qi(e))return e;let n=na(e);if(n.epochMillis<-86399999568e5||n.epochMillis>86399999496e5)throw RangeError(`Epoch millis out of range: ${n.epochMillis}`);let r;if(t?.timeZone===void 0){let e=new Date(n.epochMillis).getTimezoneOffset()*-60*1e3;r=fa(e)}else if(Ji(t?.timeZone))r=t.timeZone;else if(typeof t?.timeZone==`number`)r=fa(t.timeZone);else{let e=ha(t.timeZone);if(Se(e))throw new pi(`Invalid time zone: ${t.timeZone}`);r=e.value}return t?.adjustForTimeZone===!0?Ta(n.epochMillis,r,t?.disambiguation??`compatible`):Ki(n.epochMillis,r,n.partsUtc)},aa=ue(ia),oa=/^(.{17,35})\[(.+)\]$/,sa=e=>{let t=oa.exec(e);if(t===null){let t=Da(e);return t===null?w():aa(e,{timeZone:t})}let[,n,r]=t;return aa(n,{timeZone:r})},ca=tt(`effect/DateTime/validZoneCache`,()=>new Map),la={day:`numeric`,month:`numeric`,year:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,timeZoneName:`longOffset`,fractionalSecondDigits:3,hourCycle:`h23`},ua=e=>{let t=e.resolvedOptions().timeZone;if(ca.has(t))return ca.get(t);let n=Object.create(Wi);return n.id=t,n.format=e,ca.set(t,n),n},da=e=>{if(ca.has(e))return ca.get(e);try{return ua(new Intl.DateTimeFormat(`en-US`,{...la,timeZone:e}))}catch{throw new pi(`Invalid time zone: ${e}`)}},fa=e=>{let t=Object.create(Gi);return t.offset=e,t},pa=ue(da),ma=/^(?:GMT|[+-])/,ha=e=>{if(ma.test(e)){let t=Da(e);return t===null?w():v(fa(t))}return pa(e)},ga=e=>e._tag===`Offset`?ba(e.offset):e.id,_a=e=>new Date(e.epochMillis),va=e=>{if(e._tag===`Utc`)return new Date(e.epochMillis);if(e.zone._tag===`Offset`)return new Date(e.epochMillis+e.zone.offset);if(e.adjustedEpochMillis!==void 0)return new Date(e.adjustedEpochMillis);let t=e.zone.format.formatToParts(e.epochMillis).filter(e=>e.type!==`literal`),n=new Date(0);return n.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),n.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),Number(t[6].value)),e.adjustedEpochMillis=n.getTime(),n},ya=e=>va(e).getTime()-Sa(e),ba=e=>{let t=Math.abs(e),n=Math.floor(t/36e5),r=Math.round(t%36e5/6e4);return r===60&&(n+=1,r=0),`${e<0?`-`:`+`}${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`},xa=e=>ba(ya(e)),Sa=e=>e.epochMillis,Ca=(e,t)=>{if(t.year!==void 0&&e.setUTCFullYear(t.year),t.month!==void 0&&e.setUTCMonth(t.month-1),t.day!==void 0&&e.setUTCDate(t.day),t.weekDay!==void 0){let n=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+n)}t.hours!==void 0&&e.setUTCHours(t.hours),t.minutes!==void 0&&e.setUTCMinutes(t.minutes),t.seconds!==void 0&&e.setUTCSeconds(t.seconds),t.millis!==void 0&&e.setUTCMilliseconds(t.millis)},wa=864e5,Ta=(e,t,n)=>{if(t._tag===`Offset`)return Ki(e-t.offset,t);let r=Oa(e-wa,e,t),i=Oa(e+wa,e,t);if(r===i)return Ki(e-r,t);let a=r<i,o=r-i;if(a){if(Oa(e-i,e,t)===i)return Ki(e-i,t);let a=Ki(e-r,t);if(e!==va(a).getTime())switch(n){case`reject`:{let n=new Date(e).toISOString();throw RangeError(`Gap time: ${n} does not exist in time zone ${t.id}`)}case`earlier`:return Ki(e-i,t);case`compatible`:case`later`:return a}return a}if(Oa(e-r,e,t)===r){if(n===`earlier`||n===`compatible`||Oa(e-r+o,e+o,t)===r)return Ki(e-r,t);if(n===`reject`){let n=new Date(e).toISOString();throw RangeError(`Ambiguous time: ${n} occurs twice in time zone ${t.id}`)}}return Ki(e-i,t)},Ea=/([+-])(\d{2}):(\d{2})$/,Da=e=>{let t=Ea.exec(e);if(t===null)return null;let[,n,r,i]=t;return(n===`+`?1:-1)*(Number(r)*60+Number(i))*60*1e3},Oa=(e,t,n)=>{let r=n.format.formatToParts(e).find(e=>e.type===`timeZoneName`)?.value??``;if(r===`GMT`)return 0;let i=Da(r);return i===null?ya(Ki(t,n)):i},ka=e=>_a(e).toISOString(),Aa=e=>{let t=va(e);return e._tag===`Utc`?t.toISOString():`${t.toISOString().slice(0,-1)}${xa(e)}`},ja=e=>e.zone._tag===`Offset`?Aa(e):`${Aa(e)}[${e.zone.id}]`,Ma=e=>e.toUpperCase(),Na=e=>e.toLowerCase(),Pa=e=>e.length===0?e:Ma(e[0])+e.slice(1),Fa=e=>e.length===0?e:Na(e[0])+e.slice(1),Ia=e=>e.length>0,La=(e,t)=>{switch(t._tag){case`StringKeyword`:case`TemplateLiteral`:return Object.keys(e);case`SymbolKeyword`:return Object.getOwnPropertySymbols(e);case`Refinement`:return La(e,t.from)}},Ra=e=>{let t=!1,n;return()=>t?n:(n=e(),t=!0,n)},za=e=>Array.isArray(e),Ba=e=>!Array.isArray(e),Va=e=>`[${i(e)}]`,Ha=e=>za(e)?e.map(Va).join(``):Va(e),Ua=(e,t,n,r)=>{let i=e;return n&&qt(n)&&(i+=`\nat path: ${Ha(n)}`),t!==void 0&&(i+=`\ndetails: ${t}`),r&&(i+=`\nschema (${r._tag}): ${r}`),i},Wa=e=>Ua(`Invalid Argument`,e),Ga=(e,t,n)=>Ua(`Unsupported schema or overlapping types`,`cannot extend ${e} with ${t}`,n),Ka=e=>Ua(`Unsupported key schema`,void 0,void 0,e),qa=e=>Ua(`Unsupported literal`,`literal value: ${St(e)}`),Ja=e=>Ua(`Duplicate index signature`,`${e} index signature`),Ya=Ua(`Unsupported index signature parameter`,"An index signature parameter type must be `string`, `symbol`, a template literal type or a refinement of the previous types"),Xa=Ua(`Invalid element`,`A required element cannot follow an optional element. ts(1257)`),Za=e=>Ua(`Duplicate property signature transformation`,`Duplicate key ${St(e)}`),Qa=e=>Ua(`Duplicate property signature`,`Duplicate key ${St(e)}`),$a=Symbol.for(`effect/SchemaId/DateFromSelf`),eo=Symbol.for(`effect/SchemaId/GreaterThan`),to=Symbol.for(`effect/SchemaId/GreaterThanOrEqualTo`),no=Symbol.for(`effect/SchemaId/LessThan`),ro=Symbol.for(`effect/SchemaId/LessThanOrEqualTo`),io=Symbol.for(`effect/SchemaId/Int`),ao=Symbol.for(`effect/SchemaId/NonNaN`),oo=Symbol.for(`effect/SchemaId/Finite`),so=Symbol.for(`effect/SchemaId/JsonNumber`),co=Symbol.for(`effect/SchemaId/Between`),lo=Symbol.for(`effect/SchemaId/GreaterThanOrEqualToBigint`),uo=Symbol.for(`effect/SchemaId/BetweenBigint`),fo=Symbol.for(`effect/SchemaId/MinLength`),po=Symbol.for(`effect/SchemaId/Length`),mo=Symbol.for(`effect/SchemaId/MinItems`),ho=Symbol.for(`effect/annotation/TypeConstructor`),go=Symbol.for(`effect/annotation/Brand`),_o=Symbol.for(`effect/annotation/SchemaId`),vo=Symbol.for(`effect/annotation/Message`),yo=Symbol.for(`effect/annotation/MissingMessage`),bo=Symbol.for(`effect/annotation/Identifier`),xo=Symbol.for(`effect/annotation/Title`),So=Symbol.for(`effect/annotation/AutoTitle`),Co=Symbol.for(`effect/annotation/Description`),wo=Symbol.for(`effect/annotation/Examples`),To=Symbol.for(`effect/annotation/Default`),Eo=Symbol.for(`effect/annotation/JSONSchema`),Do=Symbol.for(`effect/annotation/Arbitrary`),Oo=Symbol.for(`effect/annotation/Pretty`),ko=Symbol.for(`effect/annotation/Equivalence`),Ao=Symbol.for(`effect/annotation/Documentation`),jo=Symbol.for(`effect/annotation/Concurrency`),Mo=Symbol.for(`effect/annotation/Batching`),No=Symbol.for(`effect/annotation/ParseIssueTitle`),Po=Symbol.for(`effect/annotation/ParseOptions`),Fo=Symbol.for(`effect/annotation/DecodingFallback`),Io=Symbol.for(`effect/annotation/Surrogate`),Lo=Symbol.for(`effect/annotation/StableFilter`),Ro=C(2,(e,t)=>Object.prototype.hasOwnProperty.call(e.annotations,t)?v(e.annotations[t]):w()),zo=Ro(go),Bo=Ro(vo),Vo=Ro(yo),Ho=Ro(xo),Uo=Ro(So),Wo=Ro(bo),Go=Ro(Co),Ko=Ro(jo),qo=Ro(Mo),Jo=Ro(No),Yo=Ro(Po),Xo=Ro(Fo),Zo=Ro(Io),Qo=Ro(Lo),$o=e=>rn(Qo(e),e=>e===!0),es=Symbol.for(`effect/annotation/JSONIdentifier`),ts=Ro(es),ns=e=>c(ts(e),()=>Wo(e)),rs=Symbol.for(`effect/schema/ParseJson`);var is=class{typeParameters;decodeUnknown;encodeUnknown;annotations;_tag=`Declaration`;constructor(e,t,n,r={}){this.typeParameters=e,this.decodeUnknown=t,this.encodeUnknown=n,this.annotations=r}toString(){return h(yc(this),()=>`<declaration schema>`)}toJSON(){return{_tag:this._tag,typeParameters:this.typeParameters.map(e=>e.toJSON()),annotations:F(this.annotations)}}};const as=e=>t=>t._tag===e;var os=class{literal;annotations;_tag=`Literal`;constructor(e,t={}){this.literal=e,this.annotations=t}toString(){return h(yc(this),()=>St(this.literal))}toJSON(){return{_tag:this._tag,literal:je(this.literal)?String(this.literal):this.literal,annotations:F(this.annotations)}}};const ss=as(`Literal`),cs=new os(null);var ls=class{symbol;annotations;_tag=`UniqueSymbol`;constructor(e,t={}){this.symbol=e,this.annotations=t}toString(){return h(yc(this),()=>St(this.symbol))}toJSON(){return{_tag:this._tag,symbol:String(this.symbol),annotations:F(this.annotations)}}};const us=new class{annotations;_tag=`UndefinedKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`undefined`}),ds=new class{annotations;_tag=`NeverKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`never`}),fs=new class{annotations;_tag=`UnknownKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`unknown`}),ps=new class{annotations;_tag=`AnyKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`any`}),ms=new class{annotations;_tag=`StringKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`string`,[Co]:`a string`}),hs=as(`StringKeyword`),gs=new class{annotations;_tag=`NumberKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`number`,[Co]:`a number`}),_s=as(`NumberKeyword`),vs=new class{annotations;_tag=`BooleanKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`boolean`,[Co]:`a boolean`}),ys=as(`BooleanKeyword`),bs=new class{annotations;_tag=`BigIntKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`bigint`,[Co]:`a bigint`}),xs=new class{annotations;_tag=`SymbolKeyword`;constructor(e={}){this.annotations=e}toString(){return gc(this)}toJSON(){return{_tag:this._tag,annotations:F(this.annotations)}}}({[xo]:`symbol`,[Co]:`a symbol`}),Ss=as(`SymbolKeyword`);var Cs=class{type;annotations;constructor(e,t={}){this.type=e,this.annotations=t}toJSON(){return{type:this.type.toJSON(),annotations:F(this.annotations)}}toString(){return String(this.type)}},ws=class extends Cs{isOptional;constructor(e,t,n={}){super(e,n),this.isOptional=t}toJSON(){return{type:this.type.toJSON(),isOptional:this.isOptional,annotations:F(this.annotations)}}toString(){return String(this.type)+(this.isOptional?`?`:``)}};const Ts=e=>e.map(e=>e.type);var Es=class{elements;rest;isReadonly;annotations;_tag=`TupleType`;constructor(e,t,n,r={}){this.elements=e,this.rest=t,this.isReadonly=n,this.annotations=r;let i=!1,a=!1;for(let t of e)if(t.isOptional)i=!0;else if(i){a=!0;break}if(a||i&&t.length>1)throw Error(Xa)}toString(){return h(yc(this),()=>Ds(this))}toJSON(){return{_tag:this._tag,elements:this.elements.map(e=>e.toJSON()),rest:this.rest.map(e=>e.toJSON()),isReadonly:this.isReadonly,annotations:F(this.annotations)}}};const Ds=e=>{let t=e.elements.map(String).join(`, `);return Gt(e.rest,{onEmpty:()=>`readonly [${t}]`,onNonEmpty:(n,r)=>{let i=String(n),a=i.includes(` | `)?`(${i})`:i;if(r.length>0){let n=r.map(String).join(`, `);return e.elements.length>0?`readonly [${t}, ...${a}[], ${n}]`:`readonly [...${a}[], ${n}]`}return e.elements.length>0?`readonly [${t}, ...${a}[]]`:`ReadonlyArray<${i}>`}})};var N=class extends ws{name;isReadonly;constructor(e,t,n,r,i){super(t,n,i),this.name=e,this.isReadonly=r}toString(){return(this.isReadonly?`readonly `:``)+String(this.name)+(this.isOptional?`?`:``)+`: `+this.type}toJSON(){return{name:String(this.name),type:this.type.toJSON(),isOptional:this.isOptional,isReadonly:this.isReadonly,annotations:F(this.annotations)}}};const Os=e=>{switch(e._tag){case`StringKeyword`:case`SymbolKeyword`:case`TemplateLiteral`:return!0;case`Refinement`:return Os(e.from)}return!1};var ks=class{type;isReadonly;parameter;constructor(e,t,n){if(this.type=t,this.isReadonly=n,Os(e))this.parameter=e;else throw Error(Ya)}toString(){return(this.isReadonly?`readonly `:``)+`[x: ${this.parameter}]: ${this.type}`}toJSON(){return{parameter:this.parameter.toJSON(),type:this.type.toJSON(),isReadonly:this.isReadonly}}},As=class{annotations;_tag=`TypeLiteral`;propertySignatures;indexSignatures;constructor(e,t,n={}){this.annotations=n;let r={};for(let t=0;t<e.length;t++){let n=e[t].name;if(Object.prototype.hasOwnProperty.call(r,n))throw Error(Qa(n));r[n]=null}let i={string:!1,symbol:!1};for(let e=0;e<t.length;e++){let n=mc(t[e].parameter);if(hs(n)){if(i.string)throw Error(Ja(`string`));i.string=!0}else if(Ss(n)){if(i.symbol)throw Error(Ja(`symbol`));i.symbol=!0}}this.propertySignatures=e,this.indexSignatures=t}toString(){return h(yc(this),()=>Ms(this))}toJSON(){return{_tag:this._tag,propertySignatures:this.propertySignatures.map(e=>e.toJSON()),indexSignatures:this.indexSignatures.map(e=>e.toJSON()),annotations:F(this.annotations)}}};const js=e=>e.map(String).join(`; `),Ms=e=>{if(e.propertySignatures.length>0){let t=e.propertySignatures.map(String).join(`; `);return e.indexSignatures.length>0?`{ ${t}; ${js(e.indexSignatures)} }`:`{ ${t} }`}return e.indexSignatures.length>0?`{ ${js(e.indexSignatures)} }`:`{}`},Ns=as(`TypeLiteral`),Ps=ht(Ur(Tn,e=>{switch(e._tag){case`AnyKeyword`:return 0;case`UnknownKeyword`:return 1;case`ObjectKeyword`:return 2;case`StringKeyword`:case`NumberKeyword`:case`BooleanKeyword`:case`BigIntKeyword`:case`SymbolKeyword`:return 3}return 4})),Fs={string:`StringKeyword`,number:`NumberKeyword`,boolean:`BooleanKeyword`,bigint:`BigIntKeyword`},Is=e=>he(e,e=>Vs(e)?Is(e.types):[e]),Ls=e=>{let t=Ps(e),n=[],r={},i=[];for(let e of t)switch(e._tag){case`NeverKeyword`:break;case`AnyKeyword`:return[ps];case`UnknownKeyword`:return[fs];case`ObjectKeyword`:case`UndefinedKeyword`:case`VoidKeyword`:case`StringKeyword`:case`NumberKeyword`:case`BooleanKeyword`:case`BigIntKeyword`:case`SymbolKeyword`:r[e._tag]||(r[e._tag]=e,n.push(e));break;case`Literal`:{let t=typeof e.literal;switch(t){case`string`:case`number`:case`bigint`:case`boolean`:!r[Fs[t]]&&!i.includes(e.literal)&&(i.push(e.literal),n.push(e));break;case`object`:i.includes(e.literal)||(i.push(e.literal),n.push(e))}break}case`UniqueSymbol`:!r.SymbolKeyword&&!i.includes(e.symbol)&&(i.push(e.symbol),n.push(e));break;case`TupleType`:r.ObjectKeyword||n.push(e);break;case`TypeLiteral`:e.propertySignatures.length===0&&e.indexSignatures.length===0?r[`{}`]||(r[`{}`]=e,n.push(e)):r.ObjectKeyword||n.push(e);break;default:n.push(e)}return n};var Rs=class e{types;annotations;static make=(t,n)=>Bs(t)?new e(t,n):t.length===1?t[0]:ds;static unify=(t,n)=>e.make(Ls(Is(t)),n);_tag=`Union`;constructor(e,t={}){this.types=e,this.annotations=t}toString(){return h(yc(this),()=>this.types.map(String).join(` | `))}toJSON(){return{_tag:this._tag,types:this.types.map(e=>e.toJSON()),annotations:F(this.annotations)}}};const zs=(e,t)=>e.map(t),Bs=e=>e.length>1,Vs=as(`Union`),Hs=tt(Symbol.for(`effect/Schema/AST/toJSONMemoMap`),()=>new WeakMap);var Us=class{f;annotations;_tag=`Suspend`;constructor(e,t={}){this.f=e,this.annotations=t,this.f=Ra(e)}toString(){return yc(this).pipe(c(()=>f(ue(this.f)(),e=>yc(e))),h(()=>`<suspended schema>`))}toJSON(){let e=this.f(),t=Hs.get(e);return t||(Hs.set(e,{_tag:this._tag}),t={_tag:this._tag,ast:e.toJSON(),annotations:F(this.annotations)},Hs.set(e,t),t)}},Ws=class{from;filter;annotations;_tag=`Refinement`;constructor(e,t,n={}){this.from=e,this.filter=t,this.annotations=n}toString(){return Wo(this).pipe(h(()=>y(vc(this),{onNone:()=>`{ ${this.from} | filter }`,onSome:e=>Gs(this.from)?String(this.from)+` & `+e:e})))}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),annotations:F(this.annotations)}}};const Gs=as(`Refinement`),Ks={};var qs=class{from;to;transformation;annotations;_tag=`Transformation`;constructor(e,t,n,r={}){this.from=e,this.to=t,this.transformation=n,this.annotations=r}toString(){return h(yc(this),()=>`(${String(this.from)} <-> ${String(this.to)})`)}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),to:this.to.toJSON(),annotations:F(this.annotations)}}};const Js=as(`Transformation`);var Ys=class{decode;encode;_tag=`FinalTransformation`;constructor(e,t){this.decode=e,this.encode=t}};const Xs=e=>t=>t._tag===e,Zs=new class{_tag=`ComposeTransformation`};var Qs=class{from;to;decode;encode;constructor(e,t,n,r){this.from=e,this.to=t,this.decode=n,this.encode=r}},$s=class{propertySignatureTransformations;_tag=`TypeLiteralTransformation`;constructor(e){this.propertySignatureTransformations=e;let t={},n={};for(let r of e){let e=r.from;if(t[e])throw Error(Za(e));t[e]=!0;let i=r.to;if(n[i])throw Error(Za(i));n[i]=!0}}};const ec=Xs(`TypeLiteralTransformation`),tc=(e,t)=>{let n=Object.getOwnPropertyDescriptors(e),r={...e.annotations};delete r[bo];let i={...r,...t},a=Zo(e);return Ae(a)&&(i[Io]=tc(a.value,t)),n.annotations.value=i,Object.create(Object.getPrototypeOf(e),n)},nc=(e,t)=>{switch(e._tag){case`Literal`:return nr(String(e.literal));case`StringKeyword`:return`[\\s\\S]*?`;case`NumberKeyword`:return`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;case`TemplateLiteral`:return ic(e,t,!1);case`Union`:return e.types.map(e=>nc(e,t)).join(`|`)}},rc=(e,t,n,r)=>{if(Vs(e)){if(n&&!r)return`(?:${t})`}else if(!n||!r)return t;return`(${t})`},ic=(e,t,n)=>{let r=``;if(e.head!==``){let i=nr(e.head);r+=t&&n?`(${i})`:i}for(let i of e.spans){let e=nc(i.type,t);if(r+=rc(i.type,e,t,n),i.literal!==``){let e=nr(i.literal);r+=t&&n?`(${e})`:e}}return r},ac=e=>RegExp(`^${ic(e,!1,!0)}$`),oc=(e,t)=>{let n=[],r=[],i=e=>{switch(e._tag){case`NeverKeyword`:break;case`StringKeyword`:case`SymbolKeyword`:case`TemplateLiteral`:case`Refinement`:r.push(new ks(e,t,!0));break;case`Literal`:if(ut(e.literal)||Wt(e.literal))n.push(new N(e.literal,t,!1,!0));else throw Error(qa(e.literal));break;case`Enums`:for(let[r,i]of e.enums)n.push(new N(i,t,!1,!0));break;case`UniqueSymbol`:n.push(new N(e.symbol,t,!1,!0));break;case`Union`:e.types.forEach(i);break;default:throw Error(Ka(e))}};return i(e),{propertySignatures:n,indexSignatures:r}},sc=e=>t=>{let n;for(let r of e)Object.prototype.hasOwnProperty.call(t.annotations,r)&&(n===void 0&&(n={}),n[r]=t.annotations[r]);return n},cc=e=>t=>{let n={...t.annotations};for(let t of e)delete n[t];return n},lc=sc([wo,To,Eo,Do,Oo,ko]),P=e=>{switch(e._tag){case`Declaration`:{let t=uc(e.typeParameters,P);return t===e.typeParameters?e:new is(t,e.decodeUnknown,e.encodeUnknown,e.annotations)}case`TupleType`:{let t=uc(e.elements,e=>{let t=P(e.type);return t===e.type?e:new ws(t,e.isOptional)}),n=Ts(e.rest),r=uc(n,P);return t===e.elements&&r===n?e:new Es(t,r.map(e=>new Cs(e)),e.isReadonly,e.annotations)}case`TypeLiteral`:{let t=uc(e.propertySignatures,e=>{let t=P(e.type);return t===e.type?e:new N(e.name,t,e.isOptional,e.isReadonly)}),n=uc(e.indexSignatures,e=>{let t=P(e.type);return t===e.type?e:new ks(e.parameter,t,e.isReadonly)});return t===e.propertySignatures&&n===e.indexSignatures?e:new As(t,n,e.annotations)}case`Union`:{let t=uc(e.types,P);return t===e.types?e:Rs.make(t,e.annotations)}case`Suspend`:return new Us(()=>P(e.f()),e.annotations);case`Refinement`:{let t=P(e.from);return t===e.from?e:new Ws(t,e.filter,e.annotations)}case`Transformation`:{let t=lc(e);return P(t===void 0?e.to:tc(e.to,t))}}return e};function uc(e,t){let n=!1,r=Pe(e.length);for(let i=0;i<e.length;i++){let a=e[i],o=t(a);o!==a&&(n=!0),r[i]=o}return n?r:e}const dc=e=>{switch(e._tag){case`Transformation`:return e.from;case`Refinement`:return dc(e.from);case`Suspend`:return dc(e.f())}},fc=(e,t)=>{switch(e._tag){case`Declaration`:{let n=uc(e.typeParameters,e=>fc(e,t));return n===e.typeParameters?e:new is(n,e.decodeUnknown,e.encodeUnknown)}case`TupleType`:{let n=uc(e.elements,e=>{let n=fc(e.type,t);return n===e.type?e:new ws(n,e.isOptional)}),r=Ts(e.rest),i=uc(r,e=>fc(e,t));return n===e.elements&&i===r?e:new Es(n,i.map(e=>new Cs(e)),e.isReadonly)}case`TypeLiteral`:{let n=uc(e.propertySignatures,e=>{let n=fc(e.type,t);return n===e.type?e:new N(e.name,n,e.isOptional,e.isReadonly)}),r=uc(e.indexSignatures,e=>{let n=fc(e.type,t);return n===e.type?e:new ks(e.parameter,n,e.isReadonly)});return n===e.propertySignatures&&r===e.indexSignatures?e:new As(n,r)}case`Union`:{let n=uc(e.types,e=>fc(e,t));return n===e.types?e:Rs.make(n)}case`Suspend`:{let n,r=ns(e);if(Ae(r)){let e=t?`Bound`:``;n={[es]:`${r.value}Encoded${e}`}}return new Us(()=>fc(e.f(),t),n)}case`Refinement`:{let n=fc(e.from,t);return t?n===e.from?e:dc(e.from)===void 0&&$o(e)?new Ws(n,e.filter,e.annotations):n:n}case`Transformation`:return fc(e.from,t)}return e},pc=e=>fc(e,!1),F=e=>{let t={};for(let n of Object.getOwnPropertySymbols(e))t[String(n)]=e[n];return t},mc=e=>{switch(e._tag){case`StringKeyword`:case`SymbolKeyword`:case`TemplateLiteral`:return e;case`Refinement`:return mc(e.from)}},hc=(e,t)=>new qs(e,t,Zs),gc=e=>h(yc(e),()=>e._tag);function _c(e){return y(zo(e),{onNone:()=>``,onSome:e=>e.map(e=>` & Brand<${St(e)}>`).join(``)})}const vc=e=>Ho(e).pipe(c(()=>Go(e)),c(()=>Uo(e)),be(t=>t+_c(e))),yc=e=>c(Wo(e),()=>vc(e)),bc=/^[+-]?\d+$/,xc=Symbol.for(`effect/BigDecimal`),Sc={[xc]:xc,[Ge](){let e=kc(this);return g(Ue(e.value),s(oe(e.scale)),sn(this))},[_e](e){return Cc(e)&&Nc(this,e)},toString(){return`BigDecimal(${Lc(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[p](){return this.toJSON()},pipe(){return Le(this,arguments)}},Cc=e=>$e(e,xc),wc=(e,t)=>{let n=Object.create(Sc);return n.value=e,n.scale=t,n},Tc=(e,t)=>{if(e!==Ec&&e%Dc===Ec)throw RangeError(`Value must be normalized`);let n=wc(e,t);return n.normalized=n,n},Ec=BigInt(0),Dc=BigInt(10),Oc=Tc(Ec,0),kc=e=>{if(e.normalized===void 0){if(e.value===Ec)e.normalized=Oc;else{let t=`${e.value}`,n=0;for(let e=t.length-1;e>=0&&t[e]===`0`;e--)n++;n===0&&(e.normalized=e);let r=BigInt(t.substring(0,t.length-n)),i=e.scale-n;e.normalized=Tc(r,i)}}return e.normalized},Ac=C(2,(e,t)=>t>e.scale?wc(e.value*Dc**BigInt(t-e.scale),t):t<e.scale?wc(e.value/Dc**BigInt(e.scale-t),t):e),jc=e=>e.value<Ec?wc(-e.value,e.scale):e,Mc=an((e,t)=>e.scale>t.scale?Ac(t,e.scale).value===e.value:e.scale<t.scale?Ac(e,t.scale).value===t.value:e.value===t.value),Nc=C(2,(e,t)=>Mc(e,t)),Pc=e=>kt(Fc(e),()=>RangeError(`Number must be finite, got ${e}`)),Fc=e=>{if(!Number.isFinite(e))return w();let t=`${e}`;if(t.includes(`e`))return Ic(t);let[n,r=``]=t.split(`.`);return v(wc(BigInt(`${n}${r}`),r.length))},Ic=e=>{if(e===``)return v(Oc);let t,n,r=e.search(/[eE]/);if(r!==-1){let i=e.slice(r+1);if(t=e.slice(0,r),n=Number(i),t===``||!Number.isSafeInteger(n)||!bc.test(i))return w()}else t=e,n=0;let i,a,o=t.search(/\./);if(o!==-1){let e=t.slice(0,o),n=t.slice(o+1);i=`${e}${n}`,a=n.length}else i=t,a=0;if(!bc.test(i))return w();let s=a-n;return Number.isSafeInteger(s)?v(wc(BigInt(i),s)):w()},Lc=e=>{let t=kc(e);if(Math.abs(t.scale)>=16)return Rc(t);let n=t.value<Ec,r=n?`${t.value}`.substring(1):`${t.value}`,i,a;if(t.scale>=r.length)i=`0`,a=`0`.repeat(t.scale-r.length)+r;else{let e=r.length-t.scale;if(e>r.length){let t=e-r.length;i=`${r}${`0`.repeat(t)}`,a=``}else a=r.slice(e),i=r.slice(0,e)}let o=a===``?i:`${i}.${a}`;return n?`-${o}`:o},Rc=e=>{if(Bc(e))return`0e+0`;let t=kc(e),n=`${jc(t).value}`,r=n.slice(0,1),i=n.slice(1),a=`${Vc(t)?`-`:``}${r}`;i!==``&&(a+=`.${i}`);let o=i.length-t.scale;return`${a}e${o>=0?`+`:``}${o}`},zc=e=>Number(Lc(e)),Bc=e=>e.value===Ec,Vc=e=>e.value<Ec,Hc=e=>e>BigInt(2**53-1)||e<BigInt(-(2**53-1))?w():v(Number(e)),Uc=e=>{try{return e.trim()===``?w():v(BigInt(e))}catch{return w()}},Wc=e=>{if(e>2**53-1||e<-(2**53-1))return w();try{return v(BigInt(e))}catch{return w()}},Gc=Symbol.for(`effect/Brand/Refined`),Kc=()=>Object.assign(e=>e,{[Gc]:Gc,option:e=>v(e),either:e=>S(e),is:e=>!0}),qc=Qn,Jc=rr,Yc=An,Xc=Wr,Zc=En,Qc=Symbol.for(`effect/QueueEnqueue`),$c=Symbol.for(`effect/QueueDequeue`),el=Symbol.for(`effect/QueueStrategy`),tl=Symbol.for(`effect/BackingQueue`),nl={_A:e=>e},rl={_A:e=>e},il={_In:e=>e},al={_Out:e=>e};var ol=class extends Vn{queue;takers;shutdownHook;shutdownFlag;strategy;[Qc]=il;[$c]=al;constructor(e,t,n,r,i){super(),this.queue=e,this.takers=t,this.shutdownHook=n,this.shutdownFlag=r,this.strategy=i}pipe(){return Le(this,arguments)}commit(){return this.take}capacity(){return this.queue.capacity()}get size(){return $t(()=>Tt(this.unsafeSize(),()=>m))}unsafeSize(){return se(this.shutdownFlag)?w():v(this.queue.length()-dn(this.takers)+this.strategy.surplusSize())}get isEmpty(){return Ye(this.size,e=>e<=0)}get isFull(){return Ye(this.size,e=>e>=this.capacity())}get shutdown(){return Ot(ye(e=>(g(this.shutdownFlag,Ke(!0)),g(ur(kl(this.takers),t=>lt(t,e.id()),!1,!1),pe(this.strategy.shutdown),ke(dt(this.shutdownHook,void 0)),Qt))))}get isShutdown(){return Re(()=>se(this.shutdownFlag))}get awaitShutdown(){return Ut(this.shutdownHook)}isActive(){return!se(this.shutdownFlag)}unsafeOffer(e){if(se(this.shutdownFlag))return!1;let t;if(this.queue.length()===0){let n=g(this.takers,Ln(xn));n===xn?t=!1:(Dl(n,e),t=!0)}else t=!1;if(t)return!0;let n=this.queue.offer(e);return Ml(this.strategy,this.queue,this.takers),n}offer(e){return $t(()=>{if(se(this.shutdownFlag))return m;let t;if(this.queue.length()===0){let n=g(this.takers,Ln(xn));n===xn?t=!1:(Dl(n,e),t=!0)}else t=!1;if(t)return d(!0);let n=this.queue.offer(e);return Ml(this.strategy,this.queue,this.takers),n?d(!0):this.strategy.handleSurplus([e],this.queue,this.takers,this.shutdownFlag)})}offerAll(e){return $t(()=>{if(se(this.shutdownFlag))return m;let t=fe(e),n=this.queue.length()===0?fe(Al(this.takers,t.length)):Ve,[r,i]=g(t,Pt(n.length));for(let e=0;e<n.length;e++){let t=n[e],i=r[e];Dl(t,i)}if(i.length===0)return d(!0);let a=this.queue.offerAll(i);return Ml(this.strategy,this.queue,this.takers),_(a)?d(!0):this.strategy.handleSurplus(a,this.queue,this.takers,this.shutdownFlag)})}get take(){return ye(e=>{if(se(this.shutdownFlag))return m;let t=this.queue.poll(xn);if(t!==xn)return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),d(t);{let t=zt(e.id());return g($t(()=>(g(this.takers,kr(t)),Ml(this.strategy,this.queue,this.takers),se(this.shutdownFlag)?m:Ut(t))),ct(()=>Re(()=>jl(this.takers,t))))}})}get takeAll(){return $t(()=>se(this.shutdownFlag)?m:Re(()=>{let e=this.queue.pollUpTo(1/0);return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),u(e)}))}takeUpTo(e){return $t(()=>se(this.shutdownFlag)?m:Re(()=>{let t=this.queue.pollUpTo(e);return this.strategy.unsafeOnQueueEmptySpace(this.queue,this.takers),u(t)}))}takeBetween(e,t){return $t(()=>sl(this,e,t,nn()))}};const sl=(e,t,n,r)=>n<t?d(r):g(bl(e,n),Zt(i=>{let a=t-i.length;return a===1?g(yl(e),Ye(e=>g(r,at(i),on(e)))):a>1?g(yl(e),Zt(t=>sl(e,a-1,n-i.length-1,g(r,at(i),on(t))))):d(g(r,at(i)))})),cl=e=>g(Re(()=>vn(e)),Zt(e=>pl(hl(e),xl()))),ll=e=>g(Re(()=>vn(e)),Zt(e=>pl(hl(e),Sl()))),ul=e=>g(Re(()=>vn(e)),Zt(e=>pl(hl(e),Cl()))),dl=()=>g(Re(()=>Cn()),Zt(e=>pl(hl(e),Sl()))),fl=(e,t,n,r,i)=>new ol(e,t,n,r,i),pl=(e,t)=>g(Yt(),Ye(n=>fl(e,Cn(),n,Be(!1),t)));var ml=class{mutable;[tl]=rl;constructor(e){this.mutable=e}poll(e){return Ln(this.mutable,e)}pollUpTo(e){return Hn(this.mutable,e)}offerAll(e){return Pn(this.mutable,e)}offer(e){return kr(this.mutable,e)}capacity(){return Bn(this.mutable)}length(){return dn(this.mutable)}};const hl=e=>new ml(e),gl=e=>e.size,_l=e=>e.shutdown,vl=C(2,(e,t)=>e.offer(t)),yl=e=>e.take,bl=C(2,(e,t)=>e.takeUpTo(t)),xl=()=>new wl,Sl=()=>new Tl,Cl=()=>new El;var wl=class{[el]=nl;putters=Cn();surplusSize(){return dn(this.putters)}onCompleteTakersWithEmptyQueue(e){for(;!Mr(this.putters)&&!Mr(e);){let t=Ln(e,void 0),n=Ln(this.putters,void 0);n[2]&&Dl(n[1],!0),Dl(t,n[0])}}get shutdown(){return g(xt,Zt(e=>g(Re(()=>kl(this.putters)),Zt(t=>ur(t,([t,n,r])=>r?g(lt(n,e),Qt):we,!1,!1)))))}handleSurplus(e,t,n,r){return ye(i=>{let a=zt(i.id());return g($t(()=>(this.unsafeOffer(e,a),this.unsafeOnQueueEmptySpace(t,n),Ml(this,t,n),se(r)?m:Ut(a))),ct(()=>Re(()=>this.unsafeRemove(a))))})}unsafeOnQueueEmptySpace(e,t){let n=!0;for(;n&&(e.capacity()===1/0||e.length()<e.capacity());){let r=g(this.putters,Ln(xn));if(r===xn)n=!1;else{let n=e.offer(r[0]);n&&r[2]?Dl(r[1],!0):n||Ol(this.putters,g(kl(this.putters),a(r))),Ml(this,e,t)}}}unsafeOffer(e,t){let n=fe(e);for(let e=0;e<n.length;e++){let r=n[e];e===n.length-1?g(this.putters,kr([r,t,!0])):g(this.putters,kr([r,t,!1]))}}unsafeRemove(e){Ol(this.putters,g(kl(this.putters),Fe(([,t])=>t!==e)))}},Tl=class{[el]=nl;surplusSize(){return 0}get shutdown(){return we}onCompleteTakersWithEmptyQueue(){}handleSurplus(e,t,n,r){return d(!1)}unsafeOnQueueEmptySpace(e,t){}},El=class{[el]=nl;surplusSize(){return 0}get shutdown(){return we}onCompleteTakersWithEmptyQueue(){}handleSurplus(e,t,n,r){return Re(()=>(this.unsafeOffer(t,e),Ml(this,t,n),!0))}unsafeOnQueueEmptySpace(e,t){}unsafeOffer(e,t){let n=t[Symbol.iterator](),r,i=!0;for(;!(r=n.next()).done&&i;){if(e.capacity()===0)return;e.poll(xn),i=e.offer(r.value)}}};const Dl=(e,t)=>gt(e,d(t)),Ol=(e,t)=>g(e,Pn(t)),kl=e=>g(e,Hn(1/0)),Al=(e,t)=>g(e,Hn(t)),jl=(e,t)=>{Ol(e,g(kl(e),Fe(e=>t!==e)))},Ml=(e,t,n)=>{let r=!0;for(;r&&t.length()!==0;){let i=g(n,Ln(xn));if(i!==xn){let o=t.poll(xn);o===xn?Ol(n,g(kl(n),a(i))):(Dl(i,o),e.unsafeOnQueueEmptySpace(t,n)),r=!0}else r=!1}r&&t.length()===0&&!Mr(n)&&e.onCompleteTakersWithEmptyQueue(n)},Nl=cl,Pl=ll,Fl=ul,Il=dl,Ll=gl,Rl=_l,zl=vl,Bl=yl,Vl=`Continue`,Hl=Symbol.for(`effect/ChannelChildExecutorDecision`),Ul={[Hl]:Hl},Wl=e=>{let t=Object.create(Ul);return t._tag=Vl,t},Gl=Symbol.for(`effect/ChannelContinuation`),Kl={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutDone:e=>e,_OutErr2:e=>e,_OutElem:e=>e,_OutDone2:e=>e};var ql=class{onSuccess;onHalt;_tag=`ContinuationK`;[Gl]=Kl;constructor(e,t){this.onSuccess=e,this.onHalt=t}onExit(e){return Ai(e)?this.onHalt(e.cause):this.onSuccess(e.value)}},Jl=class{finalizer;_tag=`ContinuationFinalizer`;[Gl]=Kl;constructor(e){this.finalizer=e}};const Yl=`PullAfterNext`,Xl=Symbol.for(`effect/ChannelUpstreamPullStrategy`),Zl={_A:e=>e},Ql={[Xl]:Zl},$l=e=>{let t=Object.create(Ql);return t._tag=Yl,t.emitSeparator=e,t},eu=`BracketOut`,tu=`Bridge`,nu=`ConcatAll`,ru=`Emit`,iu=`Ensuring`,au=`Fail`,ou=`Fold`,su=`FromEffect`,cu=`PipeTo`,lu=`Read`,uu=`Succeed`,du=`SucceedNow`,fu=`Suspend`,pu=Symbol.for(`effect/Channel`),mu={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutElem:e=>e,_OutDone:e=>e},hu={[pu]:mu,pipe(){return Le(this,arguments)}},gu=e=>$e(e,pu)||Fn(e),_u=C(2,(e,t)=>{let n=Object.create(hu);return n._tag=eu,n.acquire=()=>e,n.finalizer=t,n}),vu=e=>Au(()=>{let t=[];return L(z(e,yu(t)),e=>ju(()=>[u(t),e]))}),yu=e=>Eu({onInput:t=>L(ju(()=>{e.push(t)}),()=>yu(e)),onFailure:wu,onDone:ku}),bu=(e,t,n)=>{let r=Object.create(hu);return r._tag=nu,r.combineInners=t,r.combineAll=n,r.onPull=()=>$l(w()),r.onEmit=()=>Wl,r.value=()=>e,r.k=b,r},xu=C(4,(e,t,n,r)=>{let i=Object.create(hu);return i._tag=nu,i.combineInners=n,i.combineAll=r,i.onPull=()=>$l(w()),i.onEmit=()=>Wl,i.value=()=>e,i.k=t,i}),Su=C(2,(e,t)=>{let n=Object.create(hu);return n._tag=tu,n.input=t,n.channel=e,n}),Cu=C(2,(e,t)=>{let n=Object.create(hu);return n._tag=iu,n.channel=e,n.finalizer=t,n}),wu=e=>I(ui(e)),I=e=>Tu(()=>e),Tu=e=>{let t=Object.create(hu);return t._tag=au,t.error=e,t},L=C(2,(e,t)=>{let n=Object.create(hu);return n._tag=ou,n.channel=e,n.k=new ql(t,I),n}),R=e=>{let t=Object.create(hu);return t._tag=su,t.effect=()=>e,t},z=C(2,(e,t)=>{let n=Object.create(hu);return n._tag=cu,n.left=()=>e,n.right=()=>t,n}),Eu=e=>Du({onInput:e.onInput,onFailure:t=>r(oi(t),{onLeft:e.onFailure,onRight:I}),onDone:e.onDone}),Du=e=>{let t=Object.create(hu);return t._tag=lu,t.more=e.onInput,t.done=new ql(e.onDone,e.onFailure),t},Ou=e=>ju(()=>e),ku=e=>{let t=Object.create(hu);return t._tag=du,t.terminal=e,t},Au=e=>{let t=Object.create(hu);return t._tag=fu,t.channel=e,t},ju=e=>{let t=Object.create(hu);return t._tag=uu,t.evaluate=e,t},Mu=ku(void 0),B=e=>{let t=Object.create(hu);return t._tag=ru,t.out=e,t},Nu=`Done`,Pu=`Emit`,Fu=`FromEffect`,Iu=`Read`,Lu=Symbol.for(`effect/ChannelState`),Ru={_E:e=>e,_R:e=>e},zu={[Lu]:Ru},Bu=()=>{let e=Object.create(zu);return e._tag=Nu,e},Vu=()=>{let e=Object.create(zu);return e._tag=Pu,e},Hu=e=>{let t=Object.create(zu);return t._tag=Fu,t.effect=e,t},Uu=(e,t,n,r)=>{let i=Object.create(zu);return i._tag=Iu,i.upstream=e,i.onEffect=t,i.onEmit=n,i.onDone=r,i},Wu=e=>e._tag===Fu,Gu=e=>Wu(e)?e.effect:O,Ku=e=>Wu(e)?Ar(e.effect):void 0,qu=`PullFromChild`,Ju=`PullFromUpstream`,Yu=`DrainChildExecutors`,Xu=`Emit`;var Zu=class{childExecutor;parentSubexecutor;onEmit;_tag=qu;constructor(e,t,n){this.childExecutor=e,this.parentSubexecutor=t,this.onEmit=n}close(e){let t=this.childExecutor.close(e),n=this.parentSubexecutor.close(e);if(t!==void 0&&n!==void 0)return Zn(D(t),D(n),(e,t)=>g(e,Ci(t)));if(t!==void 0)return t;if(n!==void 0)return n}enqueuePullFromChild(e){return this}},Qu=class e{upstreamExecutor;createChild;lastDone;activeChildExecutors;combineChildResults;combineWithChildResult;onPull;onEmit;_tag=Ju;constructor(e,t,n,r,i,a,o,s){this.upstreamExecutor=e,this.createChild=t,this.lastDone=n,this.activeChildExecutors=r,this.combineChildResults=i,this.combineWithChildResult=a,this.onPull=o,this.onEmit=s}close(e){let t=this.upstreamExecutor.close(e);return[...this.activeChildExecutors.map(t=>t===void 0?void 0:t.childExecutor.close(e)),t].reduce((e,t)=>{if(e!==void 0&&t!==void 0)return Zn(e,D(t),(e,t)=>Ci(e,t));if(e!==void 0)return e;if(t!==void 0)return D(t)},void 0)}enqueuePullFromChild(t){return new e(this.upstreamExecutor,this.createChild,this.lastDone,[...this.activeChildExecutors,t],this.combineChildResults,this.combineWithChildResult,this.onPull,this.onEmit)}},$u=class e{upstreamExecutor;lastDone;activeChildExecutors;upstreamDone;combineChildResults;combineWithChildResult;onPull;_tag=Yu;constructor(e,t,n,r,i,a,o){this.upstreamExecutor=e,this.lastDone=t,this.activeChildExecutors=n,this.upstreamDone=r,this.combineChildResults=i,this.combineWithChildResult=a,this.onPull=o}close(e){let t=this.upstreamExecutor.close(e);return[...this.activeChildExecutors.map(t=>t===void 0?void 0:t.childExecutor.close(e)),t].reduce((e,t)=>{if(e!==void 0&&t!==void 0)return Zn(e,D(t),(e,t)=>Ci(e,t));if(e!==void 0)return e;if(t!==void 0)return D(t)},void 0)}enqueuePullFromChild(t){return new e(this.upstreamExecutor,this.lastDone,[...this.activeChildExecutors,t],this.upstreamDone,this.combineChildResults,this.combineWithChildResult,this.onPull)}},ed=class{value;next;_tag=Xu;constructor(e,t){this.value=e,this.next=t}close(e){return this.next.close(e)}enqueuePullFromChild(e){return this}};const td=Symbol.for(`effect/ChannelUpstreamPullRequest`),nd={_A:e=>e},rd={[td]:nd},id=e=>{let t=Object.create(rd);return t._tag=`Pulled`,t.value=e,t},ad=e=>{let t=Object.create(rd);return t._tag=`NoUpstream`,t.activeDownstreamCount=e,t};var od=class e{_activeSubexecutor=void 0;_cancelled=void 0;_closeLastSubstream=void 0;_currentChannel;_done=void 0;_doneStack=[];_emitted=void 0;_executeCloseLastSubstream;_input=void 0;_inProgressFinalizer=void 0;_providedEnv;constructor(e,t,n){this._currentChannel=e,this._executeCloseLastSubstream=n,this._providedEnv=t}run(){let t;for(;t===void 0;)if(this._cancelled!==void 0)t=this.processCancellation();else if(this._activeSubexecutor!==void 0)t=this.runSubexecutor();else try{if(this._currentChannel===void 0)t=Bu();else switch(Fn(this._currentChannel)&&(this._currentChannel=R(this._currentChannel)),this._currentChannel._tag){case eu:t=this.runBracketOut(this._currentChannel);break;case tu:{let e=this._currentChannel.input;if(this._currentChannel=this._currentChannel.channel,this._input!==void 0){let n=this._input;this._input=void 0;let r=()=>M(e.awaitRead(),()=>A(()=>{let t=n.run();switch(t._tag){case Nu:return xi(n.getDone(),{onFailure:t=>e.error(t),onSuccess:t=>e.done(t)});case Pu:return M(e.emit(n.getEmit()),()=>r());case Fu:return $n(t.effect,{onFailure:t=>e.error(t),onSuccess:()=>r()});case Iu:return ld(t,()=>r(),t=>e.error(t))}}));t=Hu(M(Yn(Or(r())),e=>mr(()=>this.addFinalizer(t=>M(Yr(e),()=>A(()=>{let e=this.restorePipe(t,n);return e===void 0?O:e}))))))}break}case nu:{let t=new e(this._currentChannel.value(),this._providedEnv,e=>mr(()=>{let t=this._closeLastSubstream===void 0?O:this._closeLastSubstream;this._closeLastSubstream=g(t,j(e))}));t._input=this._input;let n=this._currentChannel;this._activeSubexecutor=new Qu(t,e=>n.k(e),void 0,[],(e,t)=>n.combineInners(e,t),(e,t)=>n.combineAll(e,t),e=>n.onPull(e),e=>n.onEmit(e)),this._closeLastSubstream=void 0,this._currentChannel=void 0;break}case ru:this._emitted=this._currentChannel.out,this._currentChannel=this._activeSubexecutor===void 0?Mu:void 0,t=Vu();break;case iu:this.runEnsuring(this._currentChannel);break;case au:t=this.doneHalt(this._currentChannel.error());break;case ou:this._doneStack.push(this._currentChannel.k),this._currentChannel=this._currentChannel.channel;break;case su:{let e=this._providedEnv===void 0?this._currentChannel.effect():g(this._currentChannel.effect(),On(this._providedEnv));t=Hu($n(e,{onFailure:e=>{let t=this.doneHalt(e);return t!==void 0&&Wu(t)?t.effect:O},onSuccess:e=>{let t=this.doneSucceed(e);return t!==void 0&&Wu(t)?t.effect:O}}));break}case cu:{let t=this._input,n=new e(this._currentChannel.left(),this._providedEnv,e=>this._executeCloseLastSubstream(e));n._input=t,this._input=n,this.addFinalizer(e=>{let n=this.restorePipe(e,t);return n===void 0?O:n}),this._currentChannel=this._currentChannel.right();break}case`Provide`:{let e=this._providedEnv;this._providedEnv=this._currentChannel.context(),this._currentChannel=this._currentChannel.inner,this.addFinalizer(()=>mr(()=>{this._providedEnv=e}));break}case lu:{let e=this._currentChannel;t=Uu(this._input,b,t=>{try{this._currentChannel=e.more(t)}catch(t){this._currentChannel=e.done.onExit(ki(t))}},t=>{let n=t=>e.done.onExit(t);this._currentChannel=n(t)});break}case uu:t=this.doneSucceed(this._currentChannel.evaluate());break;case du:t=this.doneSucceed(this._currentChannel.terminal);break;case fu:this._currentChannel=this._currentChannel.channel()}}catch(e){this._currentChannel=I(gi(e))}return t}getDone(){return this._done}getEmit(){return this._emitted}cancelWith(e){this._cancelled=e}clearInProgressFinalizer(){this._inProgressFinalizer=void 0}storeInProgressFinalizer(e){this._inProgressFinalizer=e}popAllFinalizers(e){let t=[],n=this._doneStack.pop();for(;n;)n._tag===`ContinuationFinalizer`&&t.push(n.finalizer),n=this._doneStack.pop();let r=t.length===0?O:cd(t,e);return this.storeInProgressFinalizer(r),r}popNextFinalizers(){let e=[];for(;this._doneStack.length!==0;){let t=this._doneStack[this._doneStack.length-1];if(t._tag===`ContinuationK`)return e;e.push(t),this._doneStack.pop()}return e}restorePipe(e,t){let n=this._input;return this._input=t,n===void 0?O:n.close(e)}close(e){let t,n=this._inProgressFinalizer;n!==void 0&&(t=g(n,br(mr(()=>this.clearInProgressFinalizer()))));let r,i=this.popAllFinalizers(e);i!==void 0&&(r=g(i,br(mr(()=>this.clearInProgressFinalizer()))));let a=this._activeSubexecutor===void 0?void 0:this._activeSubexecutor.close(e);if(a!==void 0||t!==void 0||r!==void 0)return g(D(sd(a)),Jn(D(sd(t))),Jn(D(sd(r))),T(([[e,t],n])=>g(e,Ci(t),Ci(n))),Sr,M(e=>A(()=>e)))}doneSucceed(e){if(this._doneStack.length===0)return this._done=Si(e),this._currentChannel=void 0,Bu();let t=this._doneStack[this._doneStack.length-1];if(t._tag===`ContinuationK`){this._doneStack.pop(),this._currentChannel=t.onSuccess(e);return}let n=this.popNextFinalizers();if(this._doneStack.length===0)return this._doneStack=n.reverse(),this._done=Si(e),this._currentChannel=void 0,Bu();let r=cd(n.map(e=>e.finalizer),Si(e));this.storeInProgressFinalizer(r);let i=g(r,br(mr(()=>this.clearInProgressFinalizer())),Sr,M(()=>mr(()=>this.doneSucceed(e))));return Hu(i)}doneHalt(e){if(this._doneStack.length===0)return this._done=yi(e),this._currentChannel=void 0,Bu();let t=this._doneStack[this._doneStack.length-1];if(t._tag===`ContinuationK`){this._doneStack.pop();try{this._currentChannel=t.onHalt(e)}catch(e){this._currentChannel=I(gi(e))}return}let n=this.popNextFinalizers();if(this._doneStack.length===0)return this._doneStack=n.reverse(),this._done=yi(e),this._currentChannel=void 0,Bu();let r=cd(n.map(e=>e.finalizer),yi(e));this.storeInProgressFinalizer(r);let i=g(r,br(mr(()=>this.clearInProgressFinalizer())),Sr,M(()=>mr(()=>this.doneHalt(e))));return Hu(i)}processCancellation(){return this._currentChannel=void 0,this._done=this._cancelled,this._cancelled=void 0,Bu()}runBracketOut(e){let t=Sr($n(this.provide(e.acquire()),{onFailure:e=>mr(()=>{this._currentChannel=I(e)}),onSuccess:t=>mr(()=>{this.addFinalizer(n=>this.provide(e.finalizer(t,n))),this._currentChannel=B(t)})}));return Hu(t)}provide(e){return this._providedEnv===void 0?e:g(e,On(this._providedEnv))}runEnsuring(e){this.addFinalizer(e.finalizer),this._currentChannel=e.channel}addFinalizer(e){this._doneStack.push(new Jl(e))}runSubexecutor(){let e=this._activeSubexecutor;switch(e._tag){case qu:return this.pullFromChild(e.childExecutor,e.parentSubexecutor,e.onEmit,e);case Ju:return this.pullFromUpstream(e);case Yu:return this.drainChildExecutors(e);case Xu:return this._emitted=e.value,this._activeSubexecutor=e.next,Vu()}}replaceSubexecutor(e){this._currentChannel=void 0,this._activeSubexecutor=e}finishWithExit(e){let t=xi(e,{onFailure:e=>this.doneHalt(e),onSuccess:e=>this.doneSucceed(e)});return this._activeSubexecutor=void 0,t===void 0?O:Gu(t)}finishSubexecutorWithCloseEffect(e,...t){this.addFinalizer(()=>g(t,$r(t=>g(mr(()=>t(e)),M(e=>e===void 0?O:e)),{discard:!0})));let n=g(e,xi({onFailure:e=>this.doneHalt(e),onSuccess:e=>this.doneSucceed(e)}));return this._activeSubexecutor=void 0,n}applyUpstreamPullStrategy(e,t,n){switch(n._tag){case Yl:{let r=!e||t.some(e=>e!==void 0);return[n.emitSeparator,r?[void 0,...t]:t]}case`PullAfterAllEnqueued`:{let r=!e||t.some(e=>e!==void 0);return[n.emitSeparator,r?[...t,void 0]:t]}}}pullFromChild(e,t,n,r){return Uu(e,b,i=>{let a=n(i);switch(a._tag){case Vl:break;case`Close`:this.finishWithDoneValue(e,t,a.value);break;case`Yield`:{let e=t.enqueuePullFromChild(r);this.replaceSubexecutor(e);break}}this._activeSubexecutor=new ed(i,this._activeSubexecutor)},xi({onFailure:n=>{let r=this.handleSubexecutorFailure(e,t,n);return r===void 0?void 0:Ku(r)},onSuccess:n=>{this.finishWithDoneValue(e,t,n)}}))}finishWithDoneValue(e,t,n){let r=t;switch(r._tag){case Ju:{let t=new Qu(r.upstreamExecutor,r.createChild,r.lastDone===void 0?n:r.combineChildResults(r.lastDone,n),r.activeChildExecutors,r.combineChildResults,r.combineWithChildResult,r.onPull,r.onEmit);this._closeLastSubstream=e.close(Si(n)),this.replaceSubexecutor(t);break}case Yu:{let t=new $u(r.upstreamExecutor,r.lastDone===void 0?n:r.combineChildResults(r.lastDone,n),r.activeChildExecutors,r.upstreamDone,r.combineChildResults,r.combineWithChildResult,r.onPull);this._closeLastSubstream=e.close(Si(n)),this.replaceSubexecutor(t);break}}}handleSubexecutorFailure(e,t,n){return this.finishSubexecutorWithCloseEffect(yi(n),e=>t.close(e),t=>e.close(t))}pullFromUpstream(e){if(e.activeChildExecutors.length===0)return this.performPullFromUpstream(e);let t=e.activeChildExecutors[0],n=new Qu(e.upstreamExecutor,e.createChild,e.lastDone,e.activeChildExecutors.slice(1),e.combineChildResults,e.combineWithChildResult,e.onPull,e.onEmit);if(t===void 0)return this.performPullFromUpstream(n);this.replaceSubexecutor(new Zu(t.childExecutor,n,t.onEmit))}performPullFromUpstream(t){return Uu(t.upstreamExecutor,e=>{let t=this._closeLastSubstream===void 0?O:this._closeLastSubstream;return this._closeLastSubstream=void 0,g(this._executeCloseLastSubstream(t),j(e))},n=>{if(this._closeLastSubstream!==void 0){let r=this._closeLastSubstream;return this._closeLastSubstream=void 0,g(this._executeCloseLastSubstream(r),T(()=>{let r=new e(t.createChild(n),this._providedEnv,this._executeCloseLastSubstream);r._input=this._input;let[i,a]=this.applyUpstreamPullStrategy(!1,t.activeChildExecutors,t.onPull(id(n)));this._activeSubexecutor=new Zu(r,new Qu(t.upstreamExecutor,t.createChild,t.lastDone,a,t.combineChildResults,t.combineWithChildResult,t.onPull,t.onEmit),t.onEmit),Ae(i)&&(this._activeSubexecutor=new ed(i.value,this._activeSubexecutor))}))}let r=new e(t.createChild(n),this._providedEnv,this._executeCloseLastSubstream);r._input=this._input;let[i,a]=this.applyUpstreamPullStrategy(!1,t.activeChildExecutors,t.onPull(id(n)));this._activeSubexecutor=new Zu(r,new Qu(t.upstreamExecutor,t.createChild,t.lastDone,a,t.combineChildResults,t.combineWithChildResult,t.onPull,t.onEmit),t.onEmit),Ae(i)&&(this._activeSubexecutor=new ed(i.value,this._activeSubexecutor))},e=>{if(t.activeChildExecutors.some(e=>e!==void 0)){let e=new $u(t.upstreamExecutor,t.lastDone,[void 0,...t.activeChildExecutors],t.upstreamExecutor.getDone(),t.combineChildResults,t.combineWithChildResult,t.onPull);if(this._closeLastSubstream!==void 0){let t=this._closeLastSubstream;return this._closeLastSubstream=void 0,g(this._executeCloseLastSubstream(t),T(()=>this.replaceSubexecutor(e)))}this.replaceSubexecutor(e);return}let n=this._closeLastSubstream,r=this.finishSubexecutorWithCloseEffect(g(e,Ti(e=>t.combineWithChildResult(t.lastDone,e))),()=>n,e=>t.upstreamExecutor.close(e));return r===void 0?void 0:Ku(r)})}drainChildExecutors(e){if(e.activeChildExecutors.length===0){let t=this._closeLastSubstream;return t!==void 0&&this.addFinalizer(()=>k(t)),this.finishSubexecutorWithCloseEffect(e.upstreamDone,()=>t,t=>e.upstreamExecutor.close(t))}let t=e.activeChildExecutors[0],n=e.activeChildExecutors.slice(1);if(t===void 0){let[t,r]=this.applyUpstreamPullStrategy(!0,n,e.onPull(ad(n.reduce((e,t)=>t===void 0?e:e+1,0))));return this.replaceSubexecutor(new $u(e.upstreamExecutor,e.lastDone,r,e.upstreamDone,e.combineChildResults,e.combineWithChildResult,e.onPull)),Ae(t)?(this._emitted=t.value,Vu()):void 0}let r=new $u(e.upstreamExecutor,e.lastDone,n,e.upstreamDone,e.combineChildResults,e.combineWithChildResult,e.onPull);this.replaceSubexecutor(new Zu(t.childExecutor,r,t.onEmit))}};const sd=e=>e===void 0?O:e,cd=(e,t)=>g($r(e,e=>D(e(t))),T(e=>g(Di(e),h(()=>Oi))),M(e=>A(()=>e))),ld=(e,t,n)=>{let r=[e],i=()=>{let e=r.pop();if(e===void 0||e.upstream===void 0)return Fr(`Unexpected end of input for channel execution`);let a=e.upstream.run();switch(a._tag){case Pu:{let a=e.onEmit(e.upstream.getEmit());return r.length===0?a===void 0?A(t):g(a,$n({onFailure:n,onSuccess:t})):a===void 0?A(()=>i()):g(a,$n({onFailure:n,onSuccess:()=>i()}))}case Nu:{let a=e.onDone(e.upstream.getDone());return r.length===0?a===void 0?A(t):g(a,$n({onFailure:n,onSuccess:t})):a===void 0?A(()=>i()):g(a,$n({onFailure:n,onSuccess:()=>i()}))}case Fu:return r.push(e),g(e.onEffect(a.effect),hr(t=>A(()=>{let n=e.onDone(yi(t));return n===void 0?O:n})),$n({onFailure:n,onSuccess:()=>i()}));case Iu:return r.push(e),r.push(a),A(()=>i())}};return i()},ud=C(2,(e,t)=>{let n=(t,n,r)=>Er(mr(()=>new od(e,void 0,b)),e=>A(()=>dd(e.run(),e).pipe(Mn(t),j(E(t)),gn(E(n)))),(e,t)=>{let n=e.close(t);return n===void 0?O:Xr(n,e=>Ir(r,ni(e)))});return cr(e=>zr([Qr(t,In),pn(),pn()]).pipe(M(([r,i,a])=>e(n(i,a,r)).pipe(yn(t),M(n=>t.addFinalizer(e=>{let t=Ai(e)?si(e.cause):void 0;return ai(i).pipe(M(e=>e?er(a,void 0).pipe(j(pr(n)),j(Nr(n))):er(a,void 0).pipe(j(t&&nt(t)>0?gr(n,xe(t)):Yr(n)),j(Nr(n)))))}).pipe(j(e(E(i)))))))))}),dd=(e,t)=>{let n=e;switch(n._tag){case Fu:return g(n.effect,M(()=>dd(t.run(),t)));case Pu:return dd(t.run(),t);case Nu:return A(()=>t.getDone());case Iu:return ld(n,()=>dd(t.run(),t),ni)}},fd={[Symbol.for(`effect/ChannelMergeDecision`)]:{_R:e=>e,_E0:e=>e,_Z0:e=>e,_E:e=>e,_Z:e=>e}},pd=e=>{let t=Object.create(fd);return t._tag=`Await`,t.f=e,t},md=`BothRunning`,hd=`LeftDone`,gd=`RightDone`,_d=Symbol.for(`effect/ChannelMergeState`),vd={[_d]:_d},yd=(e,t)=>{let n=Object.create(vd);return n._tag=md,n.left=e,n.right=t,n},bd=e=>{let t=Object.create(vd);return t._tag=hd,t.f=e,t},xd=e=>{let t=Object.create(vd);return t._tag=gd,t.f=e,t},Sd=`BackPressure`,Cd=`BufferSliding`,wd=Symbol.for(`effect/ChannelMergeStrategy`),Td={[wd]:wd},Ed=e=>{let t=Object.create(Td);return t._tag=Sd,t},Dd=e=>{let t=Object.create(Td);return t._tag=Cd,t},Od=C(2,(e,{onBackPressure:t,onBufferSliding:n})=>{switch(e._tag){case Sd:return t();case Cd:return n()}}),kd=`Empty`,Ad=`Emit`,jd=`Error`,Md=`Done`,Nd=e=>({_tag:kd,notifyProducer:e}),Pd=e=>({_tag:Ad,notifyConsumers:e}),Fd=e=>({_tag:jd,cause:e}),Id=e=>({_tag:Md,done:e});var Ld=class{ref;constructor(e){this.ref=e}awaitRead(){return Kn(jr(this.ref,e=>e._tag===kd?[E(e.notifyProducer),e]:[O,e]))}get close(){return lr(e=>this.error(_i(e)))}done(e){return Kn(jr(this.ref,t=>{switch(t._tag){case kd:return[E(t.notifyProducer),t];case Ad:return[$r(t.notifyConsumers,t=>er(t,x(e)),{discard:!0}),Id(e)];case jd:return[ln,t];case Md:return[ln,t]}}))}emit(e){return M(pn(),t=>Kn(jr(this.ref,n=>{switch(n._tag){case kd:return[E(n.notifyProducer),n];case Ad:{let r=n.notifyConsumers[0],i=n.notifyConsumers.slice(1);if(r!==void 0)return[er(r,S(e)),i.length===0?Nd(t):Pd(i)];throw Error(`Bug: Channel.SingleProducerAsyncInput.emit - Queue was empty! please report an issue at https://github.com/Effect-TS/effect/issues`)}case jd:return[ln,n];case Md:return[ln,n]}})))}error(e){return Kn(jr(this.ref,t=>{switch(t._tag){case kd:return[E(t.notifyProducer),t];case Ad:return[$r(t.notifyConsumers,t=>Gn(t,e),{discard:!0}),Fd(e)];case jd:return[ln,t];case Md:return[ln,t]}}))}get take(){return this.takeWith(e=>yi(hi(e,x)),e=>Si(e),e=>wi(S(e)))}takeWith(e,t,n){return M(pn(),i=>Kn(jr(this.ref,a=>{switch(a._tag){case kd:return[j(er(a.notifyProducer,void 0),fn(E(i),{onFailure:e,onSuccess:r({onLeft:n,onRight:t})})),Pd([i])];case Ad:return[fn(E(i),{onFailure:e,onSuccess:r({onLeft:n,onRight:t})}),Pd([...a.notifyConsumers,i])];case jd:return[k(e(a.cause)),a];case Md:return[k(n(a.done)),a]}})))}};const Rd=()=>g(pn(),M(e=>zn(Nd(e))),T(e=>new Ld(e))),zd=C(2,(e,t)=>xu(e,t,()=>void 0,()=>void 0)),Bd=e=>{let t=Du({onInput:()=>t,onFailure:I,onDone:Ou});return z(e,t)},Vd=C(2,(e,t)=>Cu(e,()=>t)),Hd=e=>L(e,b),Ud=e=>cf(e.takeWith(I,t=>L(B(t),()=>Ud(e)),Ou)),Wd=()=>Eu({onInput:e=>L(B(e),()=>Wd()),onFailure:wu,onDone:ku}),Gd=C(2,(e,t)=>L(e,e=>ju(()=>t(e)))),Kd=C(2,(e,t)=>{let n=Eu({onInput:e=>L(B(t(e)),()=>n),onFailure:wu,onDone:ku});return z(e,n)}),qd=C(2,(e,t)=>{let n=Du({onInput:e=>g(R(t(e)),L(B),L(()=>n)),onFailure:I,onDone:ku});return z(e,n)}),Jd=e=>t=>Yd(e)(t,l),Yd=({bufferSize:e=16,concurrency:t,mergeStrategy:n=Ed()})=>(i,a)=>uf(o=>Rn(function*(){let s=t===`unbounded`?2**53-1:t,c=yield*Rd(),l=Ud(c),u=yield*Nl(e);yield*Ir(o,Rl(u));let d=yield*Il();yield*Ir(o,Rl(d));let f=yield*zn(w()),p=yield*pn(),m=(yield*Sn(s)).withPermits,h=yield*of(z(l,i),o);function _(e){return e.pipe(M(r({onLeft:e=>k(v(e)),onRight:e=>Kr(zl(u,k(S(e))),w())})),or({until:e=>Ae(e)}),M(e=>Nn(f,y({onNone:()=>v(e.value),onSome:t=>v(a(t,e.value))}))),hr(e=>ci(e)?ni(e):zl(u,ni(e)).pipe(j(er(p,void 0)),fr)))}yield*h.pipe($n({onFailure:e=>zl(u,ni(e)).pipe(j(k(!1))),onSuccess:r({onLeft:e=>ir(Or(E(p)),Or(m(s)(O)),{onSelfDone:(e,t)=>Kr(Yr(t),!1),onOtherDone:(t,n)=>j(Yr(n),bn(f).pipe(M(y({onNone:()=>zl(u,k(x(e))),onSome:t=>zl(u,k(x(a(t,e))))})),Kr(!1)))}),onRight:e=>Od(n,{onBackPressure:()=>Rn(function*(){let t=yield*pn(),n=Dr(t=>of(z(l,e),t).pipe(M(e=>ar(D(_(e)),D(Or(E(p))))),M(b)));return yield*er(t,void 0).pipe(j(n),m(1),yn(o)),yield*E(t),!(yield*ai(p))}),onBufferSliding:()=>Rn(function*(){let t=yield*pn(),n=yield*pn(),r=yield*Ll(d);yield*Bl(d).pipe(M(e=>er(e,void 0)),dr(()=>r>=s)),yield*zl(d,t);let i=Dr(n=>of(z(l,e),n).pipe(M(e=>D(_(e)).pipe(ar(D(Or(E(p)))),ar(D(Or(E(t)))))),M(b)));return yield*er(n,void 0).pipe(j(i),m(1),yn(o)),yield*E(n),!(yield*ai(p))})})})}),or({while:e=>e}),yn(o));let ee=g(Bl(u),Kn,fn({onFailure:I,onSuccess:r({onLeft:ku,onRight:e=>L(B(e),()=>ee)})}),cf);return Su(ee,c)})),Xd=C(3,(e,t,n)=>Jd(n)(Kd(e,t))),Zd=C(2,(e,t)=>{function n(n){return Rn(function*(){let i=yield*Rd(),a=Ud(i),o=yield*of(z(a,e),n),s=yield*of(z(a,t.other),n);function c(e,t,i){return(a,o,s)=>{function c(e){let n=e;return n._tag===`Done`?k(R(j(Yr(t),n.effect))):T(pr(t),xi({onFailure:e=>R(n.f(yi(e))),onSuccess:r({onLeft:e=>R(n.f(Si(e))),onRight:e=>mf(B(e),l(s(n.f)))})}))}return xi(e,{onFailure:e=>c(a(yi(e))),onSuccess:r({onLeft:e=>c(a(Si(e))),onRight:e=>k(L(B(e),()=>L(R(yn(Or(i),n)),e=>l(o(e,t)))))})})}}function l(e){switch(e._tag){case md:{let n=Or(yr(e.left)),r=Or(yr(e.right));return cf(ir(n,r,{onSelfDone:(n,r)=>j(Yr(r),c(n,e.right,o)(t.onSelfDone,yd,e=>bd(e))),onOtherDone:(n,r)=>j(Yr(r),c(n,e.left,s)(t.onOtherDone,(e,t)=>yd(t,e),e=>xd(e)))}))}case hd:return cf(T(D(s),xi({onFailure:t=>R(e.f(yi(t))),onSuccess:r({onLeft:t=>R(e.f(Si(t))),onRight:t=>L(B(t),()=>l(bd(e.f)))})})));case gd:return cf(T(D(o),xi({onFailure:t=>R(e.f(yi(t))),onSuccess:r({onLeft:t=>R(e.f(Si(t))),onRight:t=>L(B(t),()=>l(xd(e.f)))})})))}}return R(ti(e=>{let t=ti(t=>(t.transferChildren(e.scope()),O)),r=Or(o).pipe(br(t),yn(n)),i=Or(s).pipe(br(t),yn(n));return Zn(r,i,(e,t)=>yd(e,t))})).pipe(L(l),Su(i))})}return uf(n)}),Qd=C(2,(e,t)=>Au(()=>{let n,r=Eu({onInput:e=>L(B(e),()=>r),onFailure:e=>(n=gf(e),I(gi(n))),onDone:ku}),i=Du({onInput:e=>g(B(e),L(()=>i)),onFailure:e=>di(e)&&_f(e.defect)&&te(e.defect,n)?wu(e.defect.error):I(e),onDone:ku});return z(z(z(e,r),t),i)})),$d=e=>Dr(t=>ud(e,t)),ef=e=>$d(Bd(e)),tf=e=>Rr(t=>ud(e,t)),nf=e=>cf(cr(t=>T(ri(),n=>_u(Xr(t(sr(e,n)),e=>xr(n,yi(e))),(e,t)=>xr(n,t))))),rf=e=>lf(T(qr,t=>L(R(e(t)),B))),af=()=>Au(()=>{let e=``,t=!1,n=n=>{let r=[];return Ee(n,n=>{if(n.length!==0){let i=0,a=n.indexOf(`\r`),o=n.indexOf(`
|
|
2
|
-
`);for(t&&=(o===0?(r.push(e),e=``,i=1,o=n.indexOf(`
|
|
3
|
-
`,i)):e+=`\r`,!1);a!==-1||o!==-1;)a===-1||o!==-1&&o<a?(e.length===0?r.push(n.substring(i,o)):(r.push(e+n.substring(i,o)),e=``),i=o+1,o=n.indexOf(`
|
|
4
|
-
`,i)):n.length===a+1?(t=!0,a=-1):o===a+1?(e.length===0?r.push(n.substring(i,a)):(e+=n.substring(i,a),r.push(e),e=``),i=a+2,a=n.indexOf(`\r`,i),o=n.indexOf(`
|
|
5
|
-
`,i)):a=n.indexOf(`\r`,a+1);e+=t?n.substring(i,n.length-1):n.substring(i,n.length)}}),le(r)},r=Du({onInput:e=>{let t=n(e);return _(t)?r:L(B(t),()=>r)},onFailure:t=>e.length===0?I(t):L(B(Dt(e)),()=>I(t)),onDone:t=>e.length===0?Ou(t):L(B(Dt(e)),()=>Ou(t))});return r}),of=C(2,(e,t)=>Jn(mr(()=>new od(e,void 0,b)),_r()).pipe(Pr(([e,n])=>wr(t,t=>{let r=e.close(t);return r===void 0?O:On(r,n)})),Sr,T(([e])=>A(()=>sf(e.run(),e))))),sf=(e,t)=>{let n=e;switch(n._tag){case Nu:return xi(t.getDone(),{onFailure:ni,onSuccess:e=>k(x(e))});case Pu:return k(S(t.getEmit()));case Fu:return g(n.effect,M(()=>sf(t.run(),t)));case Iu:return ld(n,()=>sf(t.run(),t),e=>ni(e))}},cf=e=>Hd(R(e)),lf=e=>bu(nf(e),(e,t)=>e,(e,t)=>e),uf=e=>bu(rf(e),(e,t)=>e,(e,t)=>e),df=e=>ff(0,e.length,e),ff=(e,t,n)=>e===t?Mu:g(B(g(n,ve(e))),L(()=>ff(e+1,t,n))),pf=C(e=>gu(e[1]),(e,t,n)=>n?.concurrent?Zd(e,{other:t,onSelfDone:e=>pd(t=>A(()=>Ei(e,t))),onOtherDone:e=>pd(t=>A(()=>Ei(t,e)))}):L(e,e=>Gd(t,t=>[e,t]))),mf=C(e=>gu(e[1]),(e,t,n)=>n?.concurrent?Gd(pf(e,t,{concurrent:!0}),e=>e[1]):L(e,()=>t)),hf=Symbol.for(`effect/Channel/ChannelException`),gf=e=>({_tag:`ChannelException`,[hf]:hf,error:e}),_f=e=>$e(e,hf),vf=Symbol.for(`effect/Sink`),yf={_A:e=>e,_In:e=>e,_L:e=>e,_E:e=>e,_R:e=>e};var bf=class{channel;[vf]=yf;constructor(e){this.channel=e}pipe(){return Le(this,arguments)}};const xf=e=>new bf(Au(()=>Mf(e()))),Sf=()=>new bf(Cf(nn())),Cf=e=>Du({onInput:t=>Cf(g(e,at(t))),onFailure:I,onDone:()=>Ou(e)}),wf=new bf(Bd(Wd())),Tf=(e,t,n)=>xf(()=>new bf(Ef(e,t,n))),Ef=(e,t,n)=>t(e)?Eu({onInput:r=>Ef(n(e,r),t,n),onFailure:wu,onDone:()=>ku(e)}):ku(e),Df=(e,t)=>Tf(e,tn,t),Of=e=>{let t=Du({onInput:n=>g(R($r(n,t=>e(t),{discard:!0})),L(()=>t)),onFailure:I,onDone:()=>Mu});return new bf(t)},kf=e=>new bf(e),Af=e=>new bf(R(e)),jf=C(2,(e,t)=>new bf(g(Mf(e),Gd(t)))),Mf=e=>Fn(e)?Mf(Af(e)):e.channel,Nf=e=>new bf(lf(e.pipe(T(e=>Mf(e))))),Pf=xf(()=>{let e=[];return g(Df(void 0,(t,n)=>Ee(n,t=>{e.push(String(t))})),jf(()=>e.join(``)))}),Ff=Lr,If=e=>Object.assign(e,{chunk(e){return this(k(e))},die(e){return this(Br(e))},dieMessage(e){return this(Fr(e))},done(e){return this(A(()=>ji(e,{onFailure:v,onSuccess:Dt})))},end(){return this(Zr(w()))},fail(e){return this(Zr(v(e)))},fromEffect(e){return this(jn(e,{onFailure:v,onSuccess:Dt}))},fromEffectChunk(e){return this(g(e,Wn(v)))},halt(e){return this(ni(g(e,hi(v))))},single(e){return this(k(Dt(e)))}}),Lf=Symbol.for(`effect/Take`),Rf={_A:e=>e,_E:e=>e};var zf=class{exit;[Lf]=Rf;constructor(e){this.exit=e}pipe(){return Le(this,arguments)}};const Bf=e=>new zf(Si(e)),Vf=e=>A(()=>e.exit),Hf=new zf(wi(w())),Uf=e=>new zf(yi(g(e,hi(v)))),Wf=e=>fn(e,{onFailure:e=>y(mi(e),{onNone:()=>Hf,onSome:Uf}),onSuccess:Bf}),Gf=C(2,(e,{onEnd:t,onFailure:n,onSuccess:r})=>xi(e.exit,{onFailure:e=>y(mi(e),{onNone:t,onSome:n}),onSuccess:r})),Kf=()=>Zr(w()),qf=Symbol.for(`effect/Stream`),Jf={_R:e=>e,_E:e=>e,_A:e=>e};var Yf=class{channel;[qf]=Jf;constructor(e){this.channel=e}pipe(){return Le(this,arguments)}};const Xf=e=>$e(e,qf)||Fn(e),Zf=e=>{if(e===`unbounded`)return Il();if(typeof e==`number`||e===void 0)return Nl(e??16);switch(e.strategy){case`dropping`:return Pl(e.bufferSize??16);case`sliding`:return Fl(e.bufferSize??16);default:return Nl(e.bufferSize??16)}},Qf=(e,t)=>g(Gr(Zf(t),e=>Rl(e)),M(t=>g(_r(),M(n=>g(e(If(e=>g(Wf(e),M(e=>zl(t,e)),fr,Ff(n)).then(e=>{if(Ai(e)&&!ci(e.cause))throw li(e.cause)}))),j(zn(!1)),M(e=>g(bn(e),T(n=>n?Kf():g(Bl(t),M(Vf),tr(()=>g(un(e,!0),j(Rl(t)))))))))))),bp,rp(gp)),$f=C(2,(e,t)=>{if(t.strategy===`dropping`)return ep(e,t.capacity);if(t.strategy===`sliding`)return tp(e,t.capacity);let n=Cp(e,t);return new Yf(lf(T(n,e=>{let t=g(R(Bl(e)),L(Gf({onEnd:()=>Mu,onFailure:I,onSuccess:e=>g(B(e),L(()=>t))})));return t})))}),ep=C(2,(e,t)=>{let n=Gr(Pl(t),e=>Rl(e));return new Yf(np(n,cp(e)))}),tp=C(2,(e,t)=>{let n=Gr(Fl(t),e=>Rl(e));return new Yf(np(n,cp(e)))}),np=(e,t)=>{let n=(e,t)=>{let r=n=>g(bn(t),Pr(E),j(pn()),M(r=>g(zl(e,[n,r]),j(un(t,r)),j(E(r)))),fr,R);return Du({onInput:r=>g(pn(),M(n=>g(zl(e,[Bf(r),n]),M(e=>g(un(t,n),dr(()=>e))))),fr,R,L(()=>n(e,t))),onFailure:e=>r(Uf(e)),onDone:()=>r(Hf)})},r=e=>{let t=g(R(Bl(e)),L(([e,n])=>mf(R(er(n,void 0)),Gf(e,{onEnd:()=>Mu,onFailure:I,onSuccess:e=>g(B(e),L(()=>t))}))));return t};return lf(g(e,M(e=>g(pn(),Pr(e=>er(e,void 0)),M(i=>g(zn(i),M(r=>g(t,z(n(e,r)),tf,_n)),Kr(r(e))))))))},rp=C(e=>Xf(e[0]),(e,t,n)=>{let r=n?.bufferSize??16;return n?.switch?ip(n?.concurrency,()=>ap(e,1,r,t),n=>ap(e,n,r,t)):ip(n?.concurrency,()=>new Yf(zd(cp(e),e=>g(e,Ee(e=>cp(t(e))),Ct(Mu,(e,t)=>g(e,mf(t)))))),r=>new Yf(g(cp(e),zd(df),Xd(e=>cp(t(e)),n))))}),ip=(e,t,n)=>{switch(e){case void 0:return t();case`unbounded`:return n(2**53-1);default:return e>1?n(e):t()}},ap=C(4,(e,t,n,r)=>new Yf(g(cp(e),zd(df),Xd(e=>cp(r(e)),{concurrency:t,mergeStrategy:Dd(),bufferSize:n})))),op=C(e=>Xf(e[0]),(e,t)=>rp(e,b,t)),sp=e=>new Yf(e),cp=e=>{if(`channel`in e)return e.channel;if(Fn(e))return cp(up(e));throw TypeError(`Expected a Stream.`)},lp=e=>new Yf(_(e)?Mu:B(e)),up=e=>g(e,Wn(v),dp),dp=e=>new Yf(cf(ii(e,{onFailure:y({onNone:()=>Mu,onSome:wu}),onSuccess:e=>B(Dt(e))}))),fp=C(2,(e,t)=>new Yf(g(cp(e),Kd(Ee(t))))),pp=C(2,(e,t)=>new Yf(g(cp(e),Kd(t)))),mp=e=>_p(e,Pf),hp=C(2,(e,t)=>new Yf(z(cp(e),t))),gp=e=>Tp(e,e=>g(T(e,t=>v([t,e])),Jr(y({onNone:()=>k(w()),onSome:Zr})))),_p=C(2,(e,t)=>cp(e).pipe(Qd(Mf(t)),ef)),vp=e=>_p(e,Sf()),yp=C(2,(e,t)=>{let n=Du({onInput:e=>L(B(Bf(e)),()=>n),onFailure:e=>B(Uf(e)),onDone:()=>B(Hf)});return g(z(cp(e),n),qd(e=>zl(t,e)),Bd,tf,fr)}),bp=e=>new Yf(Vd(nf(g(e,T(Dt))),O)),xp=e=>hp(e,af()),Sp=e=>new Yf(Au(()=>cp(e()))),Cp=C(e=>Xf(e[0]),(e,t)=>Pr(Gr(t?.strategy===`unbounded`?Il():t?.strategy===`dropping`?Pl(t.capacity??2):t?.strategy===`sliding`?Fl(t.capacity??2):Nl(t?.capacity??2),e=>Rl(e)),t=>_n(yp(e,t)))),wp=C(2,(e,t)=>new Yf(Au(()=>{let n={ref:nn()},r={ref:!1},i=Au(()=>{let e=n.ref;return _(e)?Eu({onInput:e=>g(B(e),L(()=>i)),onFailure:wu,onDone:ku}):(n.ref=nn(),g(df(e),L(()=>i)))}),a=e=>{let t=n.ref,r=at(t,Fe(e,e=>e.length!==0));return n.ref=r,r},o=Eu({onInput:e=>L(B(e),()=>o),onFailure:wu,onDone:e=>mf(ju(()=>{r.ref=!0}),ku(e))}),s=g(t,Mf,vu,L(([e,t])=>g(Ou([r.ref,a(e)]),L(([e,n])=>{let r=e&&_(n)?Mu:s;return g(B(Dt(t)),L(()=>r))}))));return g(cp(e),z(o),z(i),Qd(s))}))),Tp=(e,t)=>Sp(()=>{let n=e=>cf(T(t(e),y({onNone:()=>Mu,onSome:([e,t])=>L(B(e),()=>n(t))})));return new Yf(n(e))}),Ep=e=>op(up(e)),Dp=e=>op(bp(e)),Op=C(e=>Xf(e[0]),(e,t=`utf-8`)=>Sp(()=>{let n=new TextDecoder(t);return fp(e,e=>n.decode(e,{stream:!0}))})),kp=Su,Ap=Vd,jp=L,Mp=R,Np=Au,Pp=Mu,Fp=B,Ip=qi,Lp=Yi,Rp=Xi,zp=Zi,Bp=Qi,Vp=$i,Hp=ta,Up=na,Wp=ia,Gp=sa,Kp=da,qp=fa,Jp=ha,Yp=ga,Xp=_a,Zp=Sa;Lt(`effect/DateTime/CurrentTimeZone`)();const Qp=ka,$p=ja;var V=class{path;actual;issue;_tag=`Pointer`;constructor(e,t,n){this.path=e,this.actual=t,this.issue=n}},em=class{actual;message;_tag=`Unexpected`;constructor(e,t){this.actual=e,this.message=t}},tm=class{ast;message;_tag=`Missing`;actual=void 0;constructor(e,t){this.ast=e,this.message=t}},H=class{ast;actual;issues;output;_tag=`Composite`;constructor(e,t,n,r){this.ast=e,this.actual=t,this.issues=n,this.output=r}},nm=class{ast;actual;kind;issue;_tag=`Refinement`;constructor(e,t,n,r){this.ast=e,this.actual=t,this.kind=n,this.issue=r}},rm=class{ast;actual;kind;issue;_tag=`Transformation`;constructor(e,t,n,r){this.ast=e,this.actual=t,this.kind=n,this.issue=r}},U=class{ast;actual;message;_tag=`Type`;constructor(e,t,n){this.ast=e,this.actual=t,this.message=n}},im=class{ast;actual;message;_tag=`Forbidden`;constructor(e,t,n){this.ast=e,this.actual=t,this.message=n}};const am=Symbol.for(`effect/Schema/ParseErrorTypeId`);var om=class extends Li(`ParseError`){[am]=am;get message(){return this.toString()}toString(){return Km.formatIssueSync(this.issue)}toJSON(){return{_id:`ParseError`,message:this.toString()}}[p](){return this.toJSON()}};const sm=e=>new om({issue:e}),W=S,cm=x,lm=It,um=He,dm=ge,fm=C(2,(e,t)=>dm(e)?r(e,{onLeft:x,onRight:t}):M(e,t)),pm=C(2,(e,t)=>dm(e)?Xe(e,t):T(e,t)),mm=C(2,(e,t)=>dm(e)?Ne(e,t):Wn(e,t)),hm=C(2,(e,t)=>dm(e)?et(e,{onLeft:t.onFailure,onRight:t.onSuccess}):jn(e,t)),gm=C(2,(e,t)=>dm(e)?r(e,{onLeft:t,onRight:S}):Jr(e,t)),_m=(e,t)=>t===void 0||Wt(t)?e:e===void 0?t:{...e,...t},vm=(e,t,n)=>{let r=G(e,t);return(e,t)=>r(e,_m(n,t))},ym=(e,t,n)=>{let r=vm(e,t,n);return(e,t)=>ae(r(e,t),sm)},bm=(e,t,n)=>{let r=vm(e,t,n);return(e,t)=>wt(r(e,t))},xm=(e,t,n)=>{let r=G(e,t);return(e,t)=>r(e,{..._m(n,t),isEffectAllowed:!0})},Sm=(e,t)=>ym(e.ast,!0,t),Cm=(e,t)=>bm(e.ast,!0,t),wm=(e,t)=>vm(e.ast,!0,t),Tm=(e,t)=>xm(e.ast,!0,t),Em=(e,t)=>ym(e.ast,!1,t),Dm=(e,t)=>xm(e.ast,!1,t),Om=Sm,km=(e,t)=>ym(P(e.ast),!0,t),Am=(e,t)=>{let n=G(P(e.ast),!0);return(e,r)=>me(n(e,{exact:!0,..._m(t,r)}))},jm=Em,Mm=tt(Symbol.for(`effect/ParseResult/decodeMemoMap`),()=>new WeakMap),Nm=tt(Symbol.for(`effect/ParseResult/encodeMemoMap`),()=>new WeakMap),G=(e,t)=>{let n=t?Mm:Nm,r=n.get(e);if(r)return r;let i=Im(e,t),a=Yo(e),o=Ae(a)?(e,t)=>i(e,_m(t,a.value)):i,s=Xo(e),c=t&&Ae(s)?(t,n)=>Vm(gm(o(t,n),s.value),e,t,n):o;return n.set(e,c),c},Pm=e=>o(Ko(e)),Fm=e=>o(qo(e)),Im=(t,r)=>{switch(t._tag){case`Refinement`:if(r){let e=G(t.from,!0);return(n,r)=>{r??=Ks;let i=r?.errors===`all`,a=fm(gm(e(n,r),e=>{let a=new nm(t,n,`From`,e);return i&&$o(t)&&th(e)?y(t.filter(n,r,t),{onNone:()=>x(a),onSome:e=>x(new H(t,n,[a,new nm(t,n,`Predicate`,e)]))}):x(a)}),e=>y(t.filter(e,r,t),{onNone:()=>S(e),onSome:e=>x(new nm(t,n,`Predicate`,e))}));return Vm(a,t,n,r)}}{let e=G(P(t),!0),n=G(Bm(t.from),!1);return(r,i)=>Vm(fm(e(r,i),e=>n(e,i)),t,r,i)}case`Transformation`:{let e=Wm(t.transformation,r),n=r?G(t.from,!0):G(t.to,!1),i=r?G(t.to,!0):G(t.from,!1);return(a,o)=>Vm(fm(mm(n(a,o),e=>new rm(t,a,r?`Encoded`:`Type`,e)),n=>fm(mm(e(n,o??Ks,t,a),e=>new rm(t,a,`Transformation`,e)),e=>mm(i(e,o),e=>new rm(t,a,r?`Type`:`Encoded`,e)))),t,a,o)}case`Declaration`:{let e=r?t.decodeUnknown(...t.typeParameters):t.encodeUnknown(...t.typeParameters);return(n,r)=>Vm(e(n,r??Ks,t),t,n,r)}case`Literal`:return Lm(t,e=>e===t.literal);case`UniqueSymbol`:return Lm(t,e=>e===t.symbol);case`UndefinedKeyword`:return Lm(t,_t);case`NeverKeyword`:return Lm(t,Vt);case`UnknownKeyword`:case`AnyKeyword`:case`VoidKeyword`:return S;case`StringKeyword`:return Lm(t,ut);case`NumberKeyword`:return Lm(t,Wt);case`BooleanKeyword`:return Lm(t,e);case`BigIntKeyword`:return Lm(t,je);case`SymbolKeyword`:return Lm(t,mt);case`ObjectKeyword`:return Lm(t,st);case`Enums`:return Lm(t,e=>t.enums.some(([t,n])=>n===e));case`TemplateLiteral`:{if(t.spans.every(e=>hs(e.type)))return Lm(t,e=>{if(!ut(e)||!e.startsWith(t.head))return!1;let n=t.head.length;for(let r=0;r<t.spans.length-1;r++){let i=t.spans[r].literal,a=e.indexOf(i,n);if(a===-1)return!1;n=a+i.length}let r=t.spans[t.spans.length-1].literal;return e.endsWith(r)&&e.length-r.length>=n});let e=ac(t);return Lm(t,t=>ut(t)&&e.test(t))}case`TupleType`:{let e=t.elements.map(e=>G(e.type,r)),i=t.rest.map(e=>G(e.type,r)),a=t.elements.filter(e=>!e.isOptional);t.rest.length>0&&(a=a.concat(t.rest.slice(1)));let o=a.length,s=t.elements.length>0?t.elements.map((e,t)=>t).join(` | `):`never`,c=Pm(t),l=Fm(t);return(r,u)=>{if(!n(r))return x(new U(t,r));let d=u?.errors===`all`,f=[],p=0,m=[],h=r.length;for(let e=h;e<=o-1;e++){let n=new V(e,r,new tm(a[e-h]));if(d){f.push([p++,n]);continue}return x(new H(t,r,n,m))}if(t.rest.length===0)for(let e=t.elements.length;e<=h-1;e++){let n=new V(e,r,new em(r[e],`is unexpected, expected: ${s}`));if(d){f.push([p++,n]);continue}return x(new H(t,r,n,m))}let g=0,_;for(;g<e.length;g++)if(h<g+1){if(t.elements[g].isOptional)continue}else{let n=e[g],i=n(r[g],u);if(dm(i)){if(Bt(i)){let e=new V(g,r,i.left);if(d){f.push([p++,e]);continue}return x(new H(t,r,e,Um(m)))}m.push([p++,i.right])}else{let e=p++,n=g;_||=[],_.push(({es:a,output:o})=>M(Cr(i),i=>{if(Bt(i)){let s=new V(n,r,i.left);return d?(a.push([e,s]),O):x(new H(t,r,s,Um(o)))}return o.push([e,i.right]),O}))}}if(qt(i)){let[e,...n]=i;for(;g<h-n.length;g++){let n=e(r[g],u);if(dm(n)){if(Bt(n)){let e=new V(g,r,n.left);if(d){f.push([p++,e]);continue}return x(new H(t,r,e,Um(m)))}m.push([p++,n.right])}else{let e=p++,i=g;_||=[],_.push(({es:a,output:o})=>M(Cr(n),n=>{if(Bt(n)){let s=new V(i,r,n.left);return d?(a.push([e,s]),O):x(new H(t,r,s,Um(o)))}return o.push([e,n.right]),O}))}}for(let e=0;e<n.length;e++){let i=g+e;if(!(h<i+1)){let a=n[e](r[i],u);if(dm(a)){if(Bt(a)){let e=new V(i,r,a.left);if(d){f.push([p++,e]);continue}return x(new H(t,r,e,Um(m)))}m.push([p++,a.right])}else{let e=p++;_||=[],_.push(({es:n,output:o})=>M(Cr(a),a=>{if(Bt(a)){let s=new V(i,r,a.left);return d?(n.push([e,s]),O):x(new H(t,r,s,Um(o)))}return o.push([e,a.right]),O}))}}}}let ee=({es:e,output:n})=>pt(e)?x(new H(t,r,Um(e),Um(n))):S(Um(n));if(_&&_.length>0){let e=_;return A(()=>{let t={es:We(f),output:We(m)};return M($r(e,e=>e(t),{concurrency:c,batching:l,discard:!0}),()=>ee(t))})}return ee({output:m,es:f})}}case`TypeLiteral`:{if(t.propertySignatures.length===0&&t.indexSignatures.length===0)return Lm(t,rt);let e=[],n={},i=[];for(let a of t.propertySignatures)e.push([G(a.type,r),a]),n[a.name]=null,i.push(a.name);let a=t.indexSignatures.map(e=>[G(e.parameter,r),G(e.type,r),e.parameter]),o=Rs.make(t.indexSignatures.map(e=>e.parameter).concat(i.map(e=>mt(e)?new ls(e):new os(e)))),s=G(o,r),c=Pm(t),l=Fm(t);return(r,u)=>{if(!Mt(r))return x(new U(t,r));let d=u?.errors===`all`,f=[],p=0,m=u?.onExcessProperty===`error`,h=u?.onExcessProperty===`preserve`,g={},_;if(m||h){_=Reflect.ownKeys(r);for(let e of _){let n=s(e,u);if(dm(n)&&Bt(n)){if(m){let n=new V(e,r,new em(r[e],`is unexpected, expected: ${String(o)}`));if(d){f.push([p++,n]);continue}return x(new H(t,r,n,g))}g[e]=r[e]}}}let ee,te=u?.exact===!0;for(let n=0;n<e.length;n++){let i=e[n][1],a=i.name,o=Object.prototype.hasOwnProperty.call(r,a);if(!o){if(i.isOptional)continue;if(te){let e=new V(a,r,new tm(i));if(d){f.push([p++,e]);continue}return x(new H(t,r,e,g))}}let s=e[n][0],c=s(r[a],u);if(dm(c)){if(Bt(c)){let e=new V(a,r,o?c.left:new tm(i));if(d){f.push([p++,e]);continue}return x(new H(t,r,e,g))}g[a]=c.right}else{let e=p++,n=a;ee||=[],ee.push(({es:a,output:s})=>M(Cr(c),c=>{if(Bt(c)){let l=new V(n,r,o?c.left:new tm(i));return d?(a.push([e,l]),O):x(new H(t,r,l,s))}return s[n]=c.right,O}))}}for(let e=0;e<a.length;e++){let i=a[e],o=i[0],s=i[1],c=La(r,i[2]);for(let e of c){let i=o(e,u);if(dm(i)&&me(i)){let i=s(r[e],u);if(dm(i)){if(Bt(i)){let n=new V(e,r,i.left);if(d){f.push([p++,n]);continue}return x(new H(t,r,n,g))}Object.prototype.hasOwnProperty.call(n,e)||(g[e]=i.right)}else{let a=p++,o=e;ee||=[],ee.push(({es:s,output:c})=>M(Cr(i),i=>{if(Bt(i)){let e=new V(o,r,i.left);return d?(s.push([a,e]),O):x(new H(t,r,e,c))}return Object.prototype.hasOwnProperty.call(n,e)||(c[e]=i.right),O}))}}}}let ne=({es:e,output:n})=>{if(pt(e))return x(new H(t,r,Um(e),n));if(u?.propertyOrder===`original`){let e=_||Reflect.ownKeys(r);for(let t of i)e.indexOf(t)===-1&&e.push(t);let t={};for(let r of e)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return S(t)}return S(n)};if(ee&&ee.length>0){let e=ee;return A(()=>{let t={es:We(f),output:Object.assign({},g)};return M($r(e,e=>e(t),{concurrency:c,batching:l,discard:!0}),()=>ne(t))})}return ne({es:f,output:g})}}case`Union`:{let e=zm(t.types,r),n=Reflect.ownKeys(e.keys),i=n.length,a=t.types.length,o=new Map;for(let e=0;e<a;e++)o.set(t.types[e],G(t.types[e],r));let s=Pm(t)??1,c=Fm(t);return(r,l)=>{let u=[],d=0,f=[];if(i>0){if(Jt(r))for(let t=0;t<i;t++){let i=n[t],o=e.keys[i].buckets;if(Object.prototype.hasOwnProperty.call(r,i)){let t=String(r[i]);if(Object.prototype.hasOwnProperty.call(o,t))f=f.concat(o[t]);else{let{candidates:t,literals:n}=e.keys[i],o=Rs.make(n),s=t.length===a?new As([new N(i,o,!1,!0)],[]):Rs.make(t);u.push([d++,new H(s,r,new V(i,r,new U(o,r[i])))])}}else{let{candidates:t,literals:n}=e.keys[i],o=new N(i,Rs.make(n),!1,!0),s=t.length===a?new As([o],[]):Rs.make(t);u.push([d++,new H(s,r,new V(i,r,new tm(o)))])}}else{let n=e.candidates.length===a?t:Rs.make(e.candidates);u.push([d++,new U(n,r)])}}e.otherwise.length>0&&(f=f.concat(e.otherwise));let p;for(let e=0;e<f.length;e++){let t=f[e],n=o.get(t)(r,l);if(dm(n)&&(!p||p.length===0)){if(me(n))return n;u.push([d++,n.left])}else{let e=d++;p||=[],p.push(t=>A(()=>`finalResult`in t?O:M(Cr(n),n=>(me(n)?t.finalResult=n:t.es.push([e,n.left]),O))))}}let m=e=>pt(e)?e.length===1&&e[0][1]._tag===`Type`?x(e[0][1]):x(new H(t,r,Um(e))):x(new U(t,r));if(p&&p.length>0){let e=p;return A(()=>{let t={es:We(u)};return M($r(e,e=>e(t),{concurrency:s,batching:c,discard:!0}),()=>`finalResult`in t?t.finalResult:m(t.es))})}return m(u)}}case`Suspend`:{let e=Ra(()=>G(t.f(),r));return(t,n)=>e()(t,n)}}},Lm=(e,t)=>n=>t(n)?S(n):x(new U(e,n)),Rm=(e,t)=>{switch(e._tag){case`Declaration`:{let n=Zo(e);if(Ae(n))return Rm(n.value,t);break}case`TypeLiteral`:{let n=[];for(let r=0;r<e.propertySignatures.length;r++){let i=e.propertySignatures[r],a=t?pc(i.type):P(i.type);ss(a)&&!i.isOptional&&n.push([i.name,a])}return n}case`TupleType`:{let n=[];for(let r=0;r<e.elements.length;r++){let i=e.elements[r],a=t?pc(i.type):P(i.type);ss(a)&&!i.isOptional&&n.push([r,a])}return n}case`Refinement`:return Rm(e.from,t);case`Suspend`:return Rm(e.f(),t);case`Transformation`:return Rm(t?e.from:e.to,t)}return[]},zm=(e,t)=>{let n={},r=[],i=[];for(let a=0;a<e.length;a++){let o=e[a],s=Rm(o,t);if(s.length>0){i.push(o);for(let e=0;e<s.length;e++){let[t,r]=s[e],i=String(r.literal);n[t]=n[t]||{buckets:{},literals:[],candidates:[]};let a=n[t].buckets;if(Object.prototype.hasOwnProperty.call(a,i)){if(e<s.length-1)continue;a[i].push(o),n[t].literals.push(r),n[t].candidates.push(o)}else{a[i]=[o],n[t].literals.push(r),n[t].candidates.push(o);break}}}else r.push(o)}return{keys:n,otherwise:r,candidates:i}},Bm=e=>Gs(e)?Bm(e.from):e,Vm=(e,t,n,r)=>{if(r?.isEffectAllowed===!0||dm(e))return e;let i=new Xn,a=Un(e,{scheduler:i});i.flush();let o=a.unsafePoll();if(o){if(bi(o))return S(o.value);let e=o.cause;return vi(e)?x(e.error):x(new im(t,n,fi(e)))}return x(new im(t,n,`cannot be be resolved synchronously, this is caused by using runSync on an effect that performs async work`))},Hm=([e],[t])=>e>t?1:e<t?-1:0;function Um(e){return e.sort(Hm).map(e=>e[1])}const Wm=(e,t)=>{switch(e._tag){case`FinalTransformation`:return t?e.decode:e.encode;case`ComposeTransformation`:return S;case`TypeLiteralTransformation`:return n=>{let r=S(n);for(let n of e.propertySignatureTransformations){let[e,i]=t?[n.from,n.to]:[n.to,n.from],a=t?n.decode:n.encode;r=pm(r,t=>{let n=a(Object.prototype.hasOwnProperty.call(t,e)?v(t[e]):w());return delete t[e],Ae(n)&&(t[i]=n.value),t})}return r}}},Gm=(e,t=[])=>({value:e,forest:t}),Km={formatIssue:e=>pm(ph(e),qm),formatIssueSync:e=>{let t=Km.formatIssue(e);return dm(t)?qe(t):cn(t)},formatError:e=>Km.formatIssue(e.issue),formatErrorSync:e=>Km.formatIssueSync(e.issue)},qm=e=>e.value+Jm(`
|
|
6
|
-
`,e.forest),Jm=(e,t)=>{let n=``,r=t.length,i;for(let a=0;a<r;a++){i=t[a];let o=a===r-1;n+=e+(o?`└`:`├`)+`─ `+i.value,n+=Jm(e+(r>1&&!o?`│ `:` `),i.forest)}return n},Ym=e=>{switch(e){case`Encoded`:return`Encoded side transformation failure`;case`Transformation`:return`Transformation process failure`;case`Type`:return`Type side transformation failure`}},Xm=e=>{switch(e){case`From`:return`From side refinement failure`;case`Predicate`:return`Predicate refinement failure`}},Zm=e=>`ast`in e?v(e.ast):w(),Qm=S(void 0),$m=e=>Zm(e).pipe(f(Bo),y({onNone:()=>Qm,onSome:t=>{let n=t(e);return ut(n)?S({message:n,override:!1}):Fn(n)?T(n,e=>({message:e,override:!1})):ut(n.message)?S({message:n.message,override:n.override}):T(n.message,e=>({message:e,override:n.override}))}})),eh=e=>t=>t._tag===e,th=eh(`Composite`),nh=eh(`Refinement`),rh=eh(`Transformation`),ih=e=>fm($m(e),t=>t===void 0?Qm:!t.override&&(th(e)||nh(e)&&e.kind===`From`||rh(e)&&e.kind!==`Transformation`)?rh(e)||nh(e)?ih(e.issue):Qm:S(t.message)),ah=e=>Zm(e).pipe(f(Jo),en(t=>t(e)),o);function oh(e){return Go(e).pipe(c(()=>Ho(e)),c(()=>Uo(e)),c(()=>Wo(e)),h(()=>`{ ${e.from} | filter }`))}function sh(e){return e.message===void 0?`Expected ${Gs(e.ast)?oh(e.ast):String(e.ast)}, actual ${St(e.actual)}`:e.message}const ch=e=>pm(ih(e),t=>t??ah(e)??sh(e)),lh=e=>ah(e)??String(e.ast),uh=e=>e.message??`is forbidden`,dh=e=>e.message??`is unexpected`,fh=e=>{let t=Vo(e.ast);if(Ae(t)){let e=t.value();return ut(e)?S(e):e}return S(e.message??`is missing`)},ph=e=>{switch(e._tag){case`Type`:return pm(ch(e),Gm);case`Forbidden`:return S(Gm(lh(e),[Gm(uh(e))]));case`Unexpected`:return S(Gm(dh(e)));case`Missing`:return pm(fh(e),Gm);case`Transformation`:return fm(ih(e),t=>t===void 0?pm(ph(e.issue),t=>Gm(lh(e),[Gm(Ym(e.kind),[t])])):S(Gm(t)));case`Refinement`:return fm(ih(e),t=>t===void 0?pm(ph(e.issue),t=>Gm(lh(e),[Gm(Xm(e.kind),[t])])):S(Gm(t)));case`Pointer`:return pm(ph(e.issue),t=>Gm(Ha(e.path),[t]));case`Composite`:return fm(ih(e),t=>{if(t!==void 0)return S(Gm(t));let n=lh(e);return za(e.issues)?pm($r(e.issues,ph),e=>Gm(n,e)):pm(ph(e.issues),e=>Gm(n,[e]))})}},mh=C(e=>st(e[0]),(e,...t)=>{let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}),hh=C(e=>st(e[0]),(e,...t)=>{let n={...e};for(let e of t)delete n[e];return n}),gh=Symbol.for(`effect/Schema`);function K(e){return class{[gh]=_h;static ast=e;static annotations(e){return K(bh(this.ast,e))}static pipe(){return Le(this,arguments)}static toString(){return String(e)}static Type;static Encoded;static Context;static[gh]=_h}}const _h={_A:e=>e,_I:e=>e,_R:e=>e},vh={typeConstructor:ho,schemaId:_o,message:vo,missingMessage:yo,identifier:bo,title:xo,description:Co,examples:wo,default:To,documentation:Ao,jsonSchema:Eo,arbitrary:Do,pretty:Oo,equivalence:ko,concurrency:jo,batching:Mo,parseIssueTitle:No,parseOptions:Po,decodingFallback:Fo},yh=e=>{if(!e)return{};let t={...e};for(let n in vh)if(n in e){let r=vh[n];t[r]=e[n],delete t[n]}return t},bh=(e,t)=>tc(e,yh(t)),xh=e=>String(e.ast),Sh=e=>K(pc(e.ast)),Ch=e=>K(P(e.ast)),wh=(e,t)=>{let n=Tm(e,t);return(e,t)=>mm(n(e,t),sm)},Th=(e,t)=>{let n=wm(e,t);return(e,t)=>Ne(n(e,t),sm)},Eh=wh,Dh=e=>$e(e,gh)&&st(e[gh]);function Oh(e){return Bs(e)?Rs.make(zs(e,e=>new os(e))):new os(e[0])}function kh(e,t=Oh(e)){return class extends K(t){static annotations(e){return kh(this.literals,bh(this.ast,e))}static literals=[...e]}}function Ah(...e){return qt(e)?kh(e):zh}const jh=(e,t,n)=>Nh(e,new is(e.map(e=>e.ast),(...e)=>t.decode(...e.map(K)),(...e)=>t.encode(...e.map(K)),yh(n))),Mh=(e,t)=>{let n=()=>(t,n,r)=>e(t)?W(t):cm(new U(r,t));return Nh([],new is([],n,n,yh(t)))};function Nh(e,t){return class extends K(t){static annotations(e){return Nh(this.typeParameters,bh(this.ast,e))}static typeParameters=[...e]}}const Ph=function(){if(Array.isArray(arguments[0])){let e=arguments[0],t=arguments[1],n=arguments[2];return jh(e,t,n)}let e=arguments[0],t=arguments[1];return Mh(e,t)},Fh=Symbol.for(`effect/SchemaId/InstanceOf`),Ih=(e,t)=>Ph(t=>t instanceof e,{title:e.name,description:`an instance of ${e.name}`,pretty:()=>String,schemaId:Fh,[Fh]:{constructor:e},...t});var Lh=class extends K(us){},Rh=class extends K(cs){},zh=class extends K(ds){},Bh=class extends K(fs){},Vh=class extends K(ps){},Hh=class extends K(bs){},Uh=class extends K(xs){},q=class extends K(ms){},J=class extends K(gs){},Wh=class extends K(vs){};const Gh=e=>Rs.make(e.map(e=>e.ast));function Kh(e,t=Gh(e)){return class extends K(t){static annotations(e){return Kh(this.members,bh(this.ast,e))}static members=[...e]}}function qh(...e){return Bs(e)?Kh(e):qt(e)?e[0]:zh}const Jh=e=>qh(e,Rh),Yh=e=>qh(e,Lh),Xh=e=>qh(e,Rh,Lh),Zh=e=>new Qh(new ws(e.ast,!1),e);var Qh=class e{ast;from;[gh];_Token;constructor(e,t){this.ast=e,this.from=t}annotations(t){return new e(new ws(this.ast.type,this.ast.isOptional,{...this.ast.annotations,...yh(t)}),this.from)}toString(){return`${this.ast.type}${this.ast.isOptional?`?`:``}`}};const $h=(e,t)=>new Es(e.map(e=>Dh(e)?new ws(e.ast,!1):e.ast),t.map(e=>Dh(e)?new Cs(e.ast):e.ast),!0);function eg(e,t,n=$h(e,t)){return class extends K(n){static annotations(e){return eg(this.elements,this.rest,bh(this.ast,e))}static elements=[...e];static rest=[...t]}}function tg(...e){return Array.isArray(e[0])?eg(e[0],e.slice(1)):eg(e,[])}function ng(e,t){return class extends eg([],[e],t){static annotations(e){return ng(this.value,bh(this.ast,e))}static value=e}}const rg=e=>ng(e),ig=e=>e?`"?:"`:`":"`;var ag=class extends ws{isReadonly;defaultValue;_tag=`PropertySignatureDeclaration`;constructor(e,t,n,r,i){super(e,t,r),this.isReadonly=n,this.defaultValue=i}toString(){let e=ig(this.isOptional),t=String(this.type);return`PropertySignature<${e}, ${t}, never, ${e}, ${t}>`}},og=class extends ws{isReadonly;fromKey;constructor(e,t,n,r,i){super(e,t,r),this.isReadonly=n,this.fromKey=i}},sg=class extends ws{isReadonly;defaultValue;constructor(e,t,n,r,i){super(e,t,r),this.isReadonly=n,this.defaultValue=i}};const cg=e=>e===void 0?`never`:ut(e)?JSON.stringify(e):String(e);var lg=class{from;to;decode;encode;_tag=`PropertySignatureTransformation`;constructor(e,t,n,r){this.from=e,this.to=t,this.decode=n,this.encode=r}toString(){return`PropertySignature<${ig(this.to.isOptional)}, ${this.to.type}, ${cg(this.from.fromKey)}, ${ig(this.from.isOptional)}, ${this.from.type}>`}};const ug=(e,t)=>{switch(e._tag){case`PropertySignatureDeclaration`:return new ag(e.type,e.isOptional,e.isReadonly,{...e.annotations,...t},e.defaultValue);case`PropertySignatureTransformation`:return new lg(e.from,new sg(e.to.type,e.to.isOptional,e.to.isReadonly,{...e.to.annotations,...t},e.to.defaultValue),e.decode,e.encode)}},dg=Symbol.for(`effect/PropertySignature`),fg=e=>$e(e,dg);var pg=class e{ast;[gh];[dg]=null;_TypeToken;_Key;_EncodedToken;_HasDefault;constructor(e){this.ast=e}pipe(){return Le(this,arguments)}annotations(t){return new e(ug(this.ast,yh(t)))}toString(){return String(this.ast)}};const mg=e=>new pg(e);var hg=class e extends pg{from;constructor(e,t){super(e),this.from=t}annotations(t){return new e(ug(this.ast,yh(t)),this.from)}};const gg=e=>new hg(new ag(e.ast,!1,!0,{},void 0),e),_g=C(2,(e,t)=>{let n=e.ast;switch(n._tag){case`PropertySignatureDeclaration`:return mg(new ag(n.type,n.isOptional,n.isReadonly,n.annotations,t));case`PropertySignatureTransformation`:return mg(new lg(n.from,new sg(n.to.type,n.to.isOptional,n.to.isReadonly,n.to.annotations,t),n.decode,n.encode))}}),vg=(e,t,n)=>mg(new lg(new og(e.ast,!0,!0,{},void 0),new sg(t.ast,!1,!0,{},void 0),e=>v(n.decode(e)),f(n.encode))),yg=(e,t,n)=>mg(new lg(new og(e.ast,!0,!0,{},void 0),new sg(t.ast,!0,!0,{},void 0),n.decode,n.encode)),bg=(e,t)=>{let n=t?.exact,r=t?.default,i=t?.nullable,a=t?.as==`Option`,o=t?.onNoneEncoding?c(t.onNoneEncoding):b;if(n){if(r)return i?_g(vg(Jh(e),Ch(e),{decode:y({onNone:r,onSome:e=>e===null?r():e}),encode:v}),r).ast:_g(vg(e,Ch(e),{decode:y({onNone:r,onSome:b}),encode:v}),r).ast;if(a){let t=Nv(Ch(e));return i?vg(Jh(e),t,{decode:Ie(bt),encode:o}).ast:vg(e,t,{decode:b,encode:b}).ast}return i?yg(Jh(e),Ch(e),{decode:Ie(bt),encode:b}).ast:new ag(e.ast,!0,!0,{},void 0)}if(r)return i?_g(vg(Xh(e),Ch(e),{decode:y({onNone:r,onSome:e=>e??r()}),encode:v}),r).ast:_g(vg(Yh(e),Ch(e),{decode:y({onNone:r,onSome:e=>e===void 0?r():e}),encode:v}),r).ast;if(a){let t=Nv(Ch(e));return i?vg(Xh(e),t,{decode:Ie(e=>e!=null),encode:o}).ast:vg(Yh(e),t,{decode:Ie(Rt),encode:o}).ast}return i?yg(Xh(e),Yh(Ch(e)),{decode:Ie(bt),encode:b}).ast:new ag(Yh(e).ast,!0,!0,{},void 0)},xg=e=>new hg(new ag(e.ast===us||e.ast===ds?us:Yh(e).ast,!0,!0,{},void 0),e),Sg=C(e=>Dh(e[0]),(e,t)=>new hg(bg(e,t),e)),Cg=sc([yo]),wg=(e,t)=>{let n=Reflect.ownKeys(e),r=[];if(n.length>0){let i=[],a=[],o=[];for(let t=0;t<n.length;t++){let s=n[t],c=e[s];if(fg(c)){let e=c.ast;switch(e._tag){case`PropertySignatureDeclaration`:{let t=e.type,n=e.isOptional,o=e.annotations;i.push(new N(s,t,n,!0,Cg(e))),a.push(new N(s,P(t),n,!0,o)),r.push(new N(s,t,n,!0,o));break}case`PropertySignatureTransformation`:{let t=e.from.fromKey??s;i.push(new N(t,e.from.type,e.from.isOptional,!0,e.from.annotations)),a.push(new N(s,e.to.type,e.to.isOptional,!0,e.to.annotations)),o.push(new Qs(t,s,e.decode,e.encode));break}}}else i.push(new N(s,c.ast,!1,!0)),a.push(new N(s,P(c.ast),!1,!0)),r.push(new N(s,c.ast,!1,!0))}if(qt(o)){let e=[],n=[];for(let r of t){let{indexSignatures:t,propertySignatures:o}=oc(r.key.ast,r.value.ast);o.forEach(e=>{i.push(e),a.push(new N(e.name,P(e.type),e.isOptional,e.isReadonly,e.annotations))}),t.forEach(t=>{e.push(t),n.push(new ks(t.parameter,P(t.type),t.isReadonly))})}return new qs(new As(i,e,{[So]:`Struct (Encoded side)`}),new As(a,n,{[So]:`Struct (Type side)`}),new $s(o))}}let i=[];for(let e of t){let{indexSignatures:t,propertySignatures:n}=oc(e.key.ast,e.value.ast);n.forEach(e=>r.push(e)),t.forEach(e=>i.push(e))}return new As(r,i)},Tg=(e,t)=>{let n=Reflect.ownKeys(e);for(let r of n){let n=e[r];if(t[r]===void 0&&fg(n)){let e=n.ast,i=e._tag===`PropertySignatureDeclaration`?e.defaultValue:e.to.defaultValue;i!==void 0&&(t[r]=i())}}return t};function Eg(e,t,n=wg(e,t)){return class extends K(n){static annotations(e){return Eg(this.fields,this.records,bh(this.ast,e))}static fields={...e};static records=[...t];static make=(t,n)=>{let r=Tg(e,{...t});return Kv(n)?r:km(this)(r)};static pick(...t){return Dg(mh(e,...t))}static omit(...t){return Dg(hh(e,...t))}}}function Dg(e,...t){return Eg(e,t)}const Og=e=>Ah(e).pipe(gg,_g(()=>e)),kg=(e,t)=>Dg({_tag:Og(e),...t});function Ag(e,t,n){return class extends Eg({},[{key:e,value:t}],n){static annotations(n){return Ag(e,t,bh(this.ast,n))}static key=e;static value=t}}const jg=e=>Ag(e.key,e.value);function Mg(e,t){return class extends K(t){static annotations(e){return Mg(this.from,bh(this.ast,e))}static make=(e,t)=>Kv(t)?e:km(this)(e);static from=e}}const Ng=(e,t)=>n=>{let r=y(zo(n.ast),{onNone:()=>[e],onSome:t=>[...t,e]});return Mg(n,tc(n.ast,yh({[go]:r,...t})))},Pg=(e,t,n)=>{if(Ns(e)&&Ns(t)){let r=[...e.propertySignatures];for(let e of t.propertySignatures){let t=e.name,i=r.findIndex(e=>e.name===t);if(i===-1)r.push(e);else{let{isOptional:a,type:o}=r[i];r[i]=new N(t,Lg(o,e.type,n.concat(t)),a,!0)}}return new As(r,e.indexSignatures.concat(t.indexSignatures))}throw Error(Ga(e,t,n))},Fg=cc([bo]),Ig=(e,t)=>t.map(t=>new Ws(t,e.filter,Fg(e))),Lg=(e,t,n)=>Rs.make(zg([e],[t],n)),Rg=e=>Vs(e)?e.types:[e],zg=(t,n,r)=>he(t,t=>he(n,n=>{switch(n._tag){case`Literal`:if(ut(n.literal)&&hs(t)||Wt(n.literal)&&_s(t)||e(n.literal)&&ys(t))return[n];break;case`StringKeyword`:if(n===ms){if(hs(t)||ss(t)&&ut(t.literal))return[t];if(Gs(t))return Ig(t,zg(Rg(t.from),[n],r))}else if(t===ms)return[n];break;case`NumberKeyword`:if(n===gs){if(_s(t)||ss(t)&&Wt(t.literal))return[t];if(Gs(t))return Ig(t,zg(Rg(t.from),[n],r))}else if(t===gs)return[n];break;case`BooleanKeyword`:if(n===vs){if(ys(t)||ss(t)&&e(t.literal))return[t];if(Gs(t))return Ig(t,zg(Rg(t.from),[n],r))}else if(t===vs)return[n];break;case`Union`:return zg(Rg(t),n.types,r);case`Suspend`:return[new Us(()=>Lg(t,n.f(),r))];case`Refinement`:return Ig(n,zg(Rg(t),Rg(n.from),r));case`TypeLiteral`:switch(t._tag){case`Union`:return zg(t.types,[n],r);case`Suspend`:return[new Us(()=>Lg(t.f(),n,r))];case`Refinement`:return Ig(t,zg(Rg(t.from),[n],r));case`TypeLiteral`:return[Pg(t,n,r)];case`Transformation`:{let e=t.transformation,i=Pg(t.from,n,r),a=Pg(t.to,P(n),r);switch(e._tag){case`TypeLiteralTransformation`:return[new qs(i,a,new $s(e.propertySignatureTransformations))];case`ComposeTransformation`:return[new qs(i,a,Zs)];case`FinalTransformation`:return[new qs(i,a,new Ys((t,n,r,i)=>pm(e.decode(t,n,r,i),e=>({...t,...e})),(t,n,r,i)=>pm(e.encode(t,n,r,i),e=>({...t,...e}))))]}}}break;case`Transformation`:if(Js(t)){if(ec(n.transformation)&&ec(t.transformation))return[new qs(Pg(t.from,n.from,r),Pg(t.to,n.to,r),new $s(n.transformation.propertySignatureTransformations.concat(t.transformation.propertySignatureTransformations)))]}else return zg([n],[t],r)}throw Error(Ga(t,n,r))})),Bg=C(2,(e,t)=>K(Lg(e.ast,t.ast,[]))),Vg=C(e=>Dh(e[1]),(e,t)=>qg(e,t,hc(e.ast,t.ast))),Hg=e=>K(new Us(()=>e().ast)),Ug=Symbol.for(`effect/SchemaId/Refine`);function Wg(e,t,n){return class extends K(n){static annotations(e){return Wg(this.from,this.filter,bh(this.ast,e))}static[Ug]=e;static from=e;static filter=t;static make=(e,t)=>Kv(t)?e:km(this)(e)}}const Gg=(t,n,r)=>{if(e(t))return t?w():v(new U(n,r));if(ut(t))return v(new U(n,r,t));if(t!==void 0){if(`_tag`in t)return v(t);let e=new U(n,r,t.message);return v(qt(t.path)?new V(t.path,r,e):e)}return w()},Kg=(e,t,n)=>{if(Ba(e))return Gg(e,t,n);if(qt(e)){let r=ie(e,e=>Gg(e,t,n));if(qt(r))return v(r.length===1?r[0]:new H(t,n,r))}return w()};function Y(e,t){return n=>{function r(t,n,r){return Kg(e(t,n,r),r,t)}return Wg(n,r,new Ws(n.ast,r,yh(t)))}}function qg(e,t,n){return class extends K(n){static annotations(e){return qg(this.from,this.to,bh(this.ast,e))}static from=e;static to=t}}const X=C(e=>Dh(e[0])&&Dh(e[1]),(e,t,n)=>qg(e,t,new qs(e.ast,t.ast,new Ys(n.decode,n.encode)))),Z=C(e=>Dh(e[0])&&Dh(e[1]),(e,t,n)=>X(e,t,{strict:!0,decode:(e,t,r,i)=>W(n.decode(e,i)),encode:(e,t,r,i)=>W(n.encode(e,i))})),Jg=Symbol.for(`effect/SchemaId/Trimmed`),Yg=e=>t=>t.pipe(Y(e=>e===e.trim(),{schemaId:Jg,title:`trimmed`,description:`a string with no leading or trailing whitespace`,jsonSchema:{pattern:`^\\S[\\s\\S]*\\S$|^\\S$|^$`},...e})),Xg=fo,Zg=(e,t)=>n=>n.pipe(Y(t=>t.length>=e,{schemaId:Xg,title:`minLength(${e})`,description:`a string at least ${e} character(s) long`,jsonSchema:{minLength:e},...t})),Qg=po,$g=(e,t)=>n=>{let r=st(e)?Math.max(0,Math.floor(e.min)):Math.max(0,Math.floor(e)),i=st(e)?Math.max(r,Math.floor(e.max)):r;return r===i?n.pipe(Y(e=>e.length===r,{schemaId:Qg,title:`length(${r})`,description:r===1?`a single character`:`a string ${r} character(s) long`,jsonSchema:{minLength:r,maxLength:r},...t})):n.pipe(Y(e=>e.length>=r&&e.length<=i,{schemaId:Qg,title:`length({ min: ${r}, max: ${i})`,description:`a string at least ${r} character(s) and at most ${i} character(s) long`,jsonSchema:{minLength:r,maxLength:i},...t}))},e_=Symbol.for(`effect/SchemaId/Pattern`),t_=(e,t)=>n=>{let r=e.source;return n.pipe(Y(t=>(e.lastIndex=0,e.test(t)),{schemaId:e_,[e_]:{regex:e},description:`a string matching the pattern ${r}`,jsonSchema:{pattern:r},...t}))},n_=Symbol.for(`effect/SchemaId/Lowercased`),r_=e=>t=>t.pipe(Y(e=>e===e.toLowerCase(),{schemaId:n_,title:`lowercased`,description:`a lowercase string`,jsonSchema:{pattern:`^[^A-Z]*$`},...e}));var i_=class extends q.pipe(r_({identifier:`Lowercased`})){};const a_=Symbol.for(`effect/SchemaId/Uppercased`),o_=e=>t=>t.pipe(Y(e=>e===e.toUpperCase(),{schemaId:a_,title:`uppercased`,description:`an uppercase string`,jsonSchema:{pattern:`^[^a-z]*$`},...e}));var s_=class extends q.pipe(o_({identifier:`Uppercased`})){};const c_=Symbol.for(`effect/SchemaId/Capitalized`),l_=e=>t=>t.pipe(Y(e=>e[0]?.toUpperCase()===e[0],{schemaId:c_,title:`capitalized`,description:`a capitalized string`,jsonSchema:{pattern:`^[^a-z]?.*$`},...e}));var u_=class extends q.pipe(l_({identifier:`Capitalized`})){};const d_=Symbol.for(`effect/SchemaId/Uncapitalized`),f_=e=>t=>t.pipe(Y(e=>e[0]?.toLowerCase()===e[0],{schemaId:d_,title:`uncapitalized`,description:`a uncapitalized string`,jsonSchema:{pattern:`^[^A-Z]?.*$`},...e}));var p_=class extends q.pipe(f_({identifier:`Uncapitalized`})){};q.pipe($g(1,{identifier:`Char`}));const m_=e=>Zg(1,{title:`nonEmptyString`,description:`a non empty string`,...e});Z(q.annotations({description:`a string that will be converted to lowercase`}),i_,{strict:!0,decode:e=>e.toLowerCase(),encode:b}).annotations({identifier:`Lowercase`}),Z(q.annotations({description:`a string that will be converted to uppercase`}),s_,{strict:!0,decode:e=>e.toUpperCase(),encode:b}).annotations({identifier:`Uppercase`}),Z(q.annotations({description:`a string that will be converted to a capitalized format`}),u_,{strict:!0,decode:e=>Pa(e),encode:b}).annotations({identifier:`Capitalize`}),Z(q.annotations({description:`a string that will be converted to an uncapitalized format`}),p_,{strict:!0,decode:e=>Fa(e),encode:b}).annotations({identifier:`Uncapitalize`});var h_=class extends q.pipe(Yg({identifier:`Trimmed`})){},g_=class extends h_.pipe(m_({identifier:`NonEmptyTrimmedString`})){};Z(q.annotations({description:`a string that will be trimmed`}),h_,{strict:!0,decode:e=>e.trim(),encode:b}).annotations({identifier:`Trim`});const __=e=>e instanceof Error?e.message:String(e),v_=e=>X(q.annotations({description:`a string to be decoded into JSON`}),Bh,{strict:!0,decode:(t,n,r)=>lm({try:()=>JSON.parse(t,e?.reviver),catch:e=>new U(r,t,__(e))}),encode:(t,n,r)=>lm({try:()=>JSON.stringify(t,e?.replacer,e?.space),catch:e=>new U(r,t,__(e))})}).annotations({title:`parseJson`,schemaId:rs}),y_=(e,t)=>Dh(e)?Vg(y_(t),e):v_(e);q.pipe(m_({identifier:`NonEmptyString`}));const b_=Symbol.for(`effect/SchemaId/UUID`),x_=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i;q.pipe(t_(x_,{schemaId:b_,identifier:`UUID`,jsonSchema:{format:`uuid`,pattern:x_.source},description:`a Universally Unique Identifier`,arbitrary:()=>e=>e.uuid()}));const S_=Symbol.for(`effect/SchemaId/ULID`);q.pipe(t_(/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/i,{schemaId:S_,identifier:`ULID`,description:`a Universally Unique Lexicographically Sortable Identifier`,arbitrary:()=>e=>e.ulid()}));var C_=class extends Ih(URL,{typeConstructor:{_tag:`URL`},identifier:`URLFromSelf`,arbitrary:()=>e=>e.webUrl().map(e=>new URL(e)),pretty:()=>e=>e.toString()}){};X(q.annotations({description:`a string to be decoded into a URL`}),C_,{strict:!0,decode:(e,t,n)=>lm({try:()=>new URL(e),catch:t=>new U(n,e,`Unable to decode ${JSON.stringify(e)} into a URL. ${__(t)}`)}),encode:e=>W(e.toString())}).annotations({identifier:`URL`,pretty:()=>e=>e.toString()});const w_=oo,T_=e=>t=>t.pipe(Y(Number.isFinite,{schemaId:w_,title:`finite`,description:`a finite number`,jsonSchema:{},...e})),E_=eo,D_=(e,t)=>n=>n.pipe(Y(t=>t>e,{schemaId:E_,title:`greaterThan(${e})`,description:e===0?`a positive number`:`a number greater than ${e}`,jsonSchema:{exclusiveMinimum:e},...t})),O_=to,k_=(e,t)=>n=>n.pipe(Y(t=>t>=e,{schemaId:O_,title:`greaterThanOrEqualTo(${e})`,description:e===0?`a non-negative number`:`a number greater than or equal to ${e}`,jsonSchema:{minimum:e},...t})),A_=io,j_=e=>t=>t.pipe(Y(e=>Number.isSafeInteger(e),{schemaId:A_,title:`int`,description:`an integer`,jsonSchema:{type:`integer`},...e})),M_=no,N_=(e,t)=>n=>n.pipe(Y(t=>t<e,{schemaId:M_,title:`lessThan(${e})`,description:e===0?`a negative number`:`a number less than ${e}`,jsonSchema:{exclusiveMaximum:e},...t})),P_=ro,F_=(e,t)=>n=>n.pipe(Y(t=>t<=e,{schemaId:P_,title:`lessThanOrEqualTo(${e})`,description:e===0?`a non-positive number`:`a number less than or equal to ${e}`,jsonSchema:{maximum:e},...t})),I_=co,L_=(e,t,n)=>r=>r.pipe(Y(n=>n>=e&&n<=t,{schemaId:I_,title:`between(${e}, ${t})`,description:`a number between ${e} and ${t}`,jsonSchema:{minimum:e,maximum:t},...n})),R_=ao,z_=e=>t=>t.pipe(Y(e=>!Number.isNaN(e),{schemaId:R_,title:`nonNaN`,description:`a number excluding NaN`,...e})),B_=e=>D_(0,{title:`positive`,...e}),V_=e=>N_(0,{title:`negative`,...e}),H_=e=>F_(0,{title:`nonPositive`,...e}),U_=e=>k_(0,{title:`nonNegative`,...e});function W_(e){return X(e,J,{strict:!1,decode:(e,t,n)=>um(kn(e),()=>new U(n,e,`Unable to decode ${JSON.stringify(e)} into a number`)),encode:e=>W(String(e))})}W_(q.annotations({description:`a string to be decoded into a number`})).annotations({identifier:`NumberFromString`}),J.pipe(T_({identifier:`Finite`}));var G_=class extends J.pipe(j_({identifier:`Int`})){};J.pipe(z_({identifier:`NonNaN`})),J.pipe(B_({identifier:`Positive`})),J.pipe(V_({identifier:`Negative`})),J.pipe(H_({identifier:`NonPositive`}));var K_=class extends J.pipe(U_({identifier:`NonNegative`})){};const q_=so;J.pipe(T_({schemaId:q_,identifier:`JsonNumber`})),Z(Wh.annotations({description:`a boolean that will be negated`}),Wh,{strict:!0,decode:e=>Dn(e),encode:e=>Dn(e)});const J_=(e,t)=>{let n=Symbol.keyFor(e);return n===void 0?cm(new U(t,e,`Unable to encode a unique symbol ${String(e)} into a string`)):W(n)},Y_=e=>W(Symbol.for(e));X(q.annotations({description:`a string to be decoded into a globally shared symbol`}),Uh,{strict:!1,decode:e=>Y_(e),encode:(e,t,n)=>J_(e,n)}).annotations({identifier:`Symbol`});const X_=lo,Z_=(e,t)=>n=>n.pipe(Y(t=>t>=e,{schemaId:X_,[X_]:{min:e},title:`greaterThanOrEqualToBigInt(${e})`,description:e===0n?`a non-negative bigint`:`a bigint greater than or equal to ${e}n`,...t})),Q_=uo,$_=(e,t,n)=>r=>r.pipe(Y(n=>n>=e&&n<=t,{schemaId:Q_,[Q_]:{min:e,max:t},title:`betweenBigInt(${e}, ${t})`,description:`a bigint between ${e}n and ${t}n`,...n})),ev=e=>Z_(0n,{title:`nonNegativeBigInt`,...e});var tv=class extends X(q.annotations({description:`a string to be decoded into a bigint`}),Hh,{strict:!0,decode:(e,t,n)=>um(Uc(e),()=>new U(n,e,`Unable to decode ${JSON.stringify(e)} into a bigint`)),encode:e=>W(String(e))}).annotations({identifier:`BigInt`}){};const nv=Hh.pipe(ev({identifier:`NonNegativeBigintFromSelf`}));X(J.annotations({description:`a number to be decoded into a bigint`}),Hh.pipe($_(BigInt(-(2**53-1)),BigInt(2**53-1))),{strict:!0,decode:(e,t,n)=>um(Wc(e),()=>new U(n,e,`Unable to decode ${e} into a bigint`)),encode:(e,t,n)=>um(Hc(e),()=>new U(n,e,`Unable to encode ${e}n into a number`))}).annotations({identifier:`BigIntFromNumber`});const rv=(e,t,n,r)=>hm(e,{onFailure:e=>new H(n,r,e),onSuccess:t});var iv=class extends Ph(Ze,{typeConstructor:{_tag:`effect/Duration`},identifier:`DurationFromSelf`,pretty:()=>String,arbitrary:()=>e=>e.oneof(e.constant(de),e.bigInt({min:0n}).map(e=>t(e)),e.maxSafeNat().map(e=>Me(e))),equivalence:()=>re}){};X(nv.annotations({description:`a bigint to be decoded into a Duration`}),iv.pipe(Y(e=>Je(e),{description:`a finite duration`})),{strict:!0,decode:e=>W(t(e)),encode:(e,t,n)=>y(Ft(e),{onNone:()=>cm(new U(n,e,`Unable to encode ${e} into a bigint`)),onSome:e=>W(e)})}).annotations({identifier:`DurationFromNanos`});const av=K_.pipe(j_()).annotations({identifier:`NonNegativeInt`});Z(K_.annotations({description:`a non-negative number to be decoded into a Duration`}),iv,{strict:!0,decode:e=>Me(e),encode:e=>Kt(e)}).annotations({identifier:`DurationFromMillis`});const ov=kg(`Millis`,{millis:av}),sv=kg(`Nanos`,{nanos:tv}),cv=kg(`Infinity`,{}),lv=cv.make({}),uv=qh(ov,sv,cv).annotations({identifier:`DurationValue`,description:`an JSON-compatible tagged union to be decoded into a Duration`}),dv=qh(tg(Zh(av).annotations({title:`seconds`}),Zh(av).annotations({title:`nanos`})).annotations({identifier:`FiniteHRTime`}),tg(Ah(-1),Ah(0)).annotations({identifier:`InfiniteHRTime`})).annotations({identifier:`HRTime`,description:`a tuple of seconds and nanos to be decoded into a Duration`}),fv=e=>typeof e==`object`;Z(qh(uv,dv),iv,{strict:!0,decode:e=>{if(fv(e))switch(e._tag){case`Millis`:return Me(e.millis);case`Nanos`:return t(e.nanos);case`Infinity`:return de}let[n,r]=e;return n===-1?de:t(BigInt(n)*BigInt(1e9)+BigInt(r))},encode:e=>{switch(e.value._tag){case`Millis`:return ov.make({millis:e.value.millis});case`Nanos`:return sv.make({nanos:e.value.nanos});case`Infinity`:return lv}}}).annotations({identifier:`Duration`});var pv=class extends Ph(vt,{typeConstructor:{_tag:`Uint8Array`},identifier:`Uint8ArrayFromSelf`,pretty:()=>e=>`new Uint8Array(${JSON.stringify(Array.from(e))})`,arbitrary:()=>e=>e.uint8Array(),equivalence:()=>Qe(te)}){};Z(rg(class extends J.pipe(L_(0,255,{identifier:`Uint8`,description:`a 8-bit unsigned integer`})){}).annotations({description:`an array of 8-bit unsigned integers to be decoded into a Uint8Array`}),pv,{strict:!0,decode:e=>Uint8Array.from(e),encode:e=>Array.from(e)}).annotations({identifier:`Uint8Array`});const mv=mo,hv=(e,t)=>n=>{let r=Math.floor(e);if(r<1)throw Error(Wa(`Expected an integer greater than or equal to 1, actual ${e}`));return n.pipe(Y(e=>e.length>=r,{schemaId:mv,title:`minItems(${r})`,description:`an array of at least ${r} item(s)`,jsonSchema:{minItems:r},[Lo]:!0,...t}))},gv=Symbol.for(`effect/SchemaId/ValidDate`),_v=e=>t=>t.pipe(Y(e=>!Number.isNaN(e.getTime()),{schemaId:gv,[gv]:{noInvalidDate:!0},title:`validDate`,description:`a valid Date`,...e})),vv=$a;var yv=class extends Ph(ft,{typeConstructor:{_tag:`Date`},identifier:`DateFromSelf`,schemaId:vv,[vv]:{noInvalidDate:!1},description:`a potentially invalid Date instance`,pretty:()=>e=>`new Date(${JSON.stringify(e)})`,arbitrary:()=>e=>e.date({noInvalidDate:!1}),equivalence:()=>Xt}){};yv.pipe(_v({identifier:`ValidDateFromSelf`,description:`a valid Date instance`})),class extends Z(q.annotations({description:`a string to be decoded into a Date`}),yv,{strict:!0,decode:e=>new Date(e),encode:e=>Et(e)}).annotations({identifier:`DateFromString`}){}.pipe(_v({identifier:`Date`})),Z(J.annotations({description:`a number to be decoded into a Date`}),yv,{strict:!0,decode:e=>new Date(e),encode:e=>e.getTime()}).annotations({identifier:`DateFromNumber`});var bv=class extends Ph(e=>Ip(e)&&zp(e),{typeConstructor:{_tag:`effect/DateTime.Utc`},identifier:`DateTimeUtcFromSelf`,description:`a DateTime.Utc instance`,pretty:()=>e=>e.toString(),arbitrary:()=>e=>e.date({noInvalidDate:!0}).map(e=>Hp(e)),equivalence:()=>Vp}){};const xv=(e,t)=>lm({try:()=>Up(e),catch:()=>new U(t,e,`Unable to decode ${St(e)} into a DateTime.Utc`)});X(J.annotations({description:`a number to be decoded into a DateTime.Utc`}),bv,{strict:!0,decode:(e,t,n)=>xv(e,n),encode:e=>W(Zp(e))}).annotations({identifier:`DateTimeUtcFromNumber`}),X(yv.annotations({description:`a Date to be decoded into a DateTime.Utc`}),bv,{strict:!0,decode:(e,t,n)=>xv(e,n),encode:e=>W(Xp(e))}).annotations({identifier:`DateTimeUtcFromDate`}),X(q.annotations({description:`a string to be decoded into a DateTime.Utc`}),bv,{strict:!0,decode:(e,t,n)=>xv(e,n),encode:e=>W(Qp(e))}).annotations({identifier:`DateTimeUtc`});const Sv=()=>e=>e.integer({min:-432e5,max:504e5}).map(qp);var Cv=class extends Ph(Lp,{typeConstructor:{_tag:`effect/DateTime.TimeZone.Offset`},identifier:`TimeZoneOffsetFromSelf`,description:`a TimeZone.Offset instance`,pretty:()=>e=>e.toString(),arbitrary:Sv}){};Z(J.annotations({description:`a number to be decoded into a TimeZone.Offset`}),Cv,{strict:!0,decode:e=>qp(e),encode:e=>e.offset}).annotations({identifier:`TimeZoneOffset`});const wv=()=>e=>e.constantFrom(...Intl.supportedValuesOf(`timeZone`)).map(Kp);var Tv=class extends Ph(Rp,{typeConstructor:{_tag:`effect/DateTime.TimeZone.Named`},identifier:`TimeZoneNamedFromSelf`,description:`a TimeZone.Named instance`,pretty:()=>e=>e.toString(),arbitrary:wv}){};X(q.annotations({description:`a string to be decoded into a TimeZone.Named`}),Tv,{strict:!0,decode:(e,t,n)=>lm({try:()=>Kp(e),catch:()=>new U(n,e,`Unable to decode ${JSON.stringify(e)} into a TimeZone.Named`)}),encode:e=>W(e.id)}).annotations({identifier:`TimeZoneNamed`});var Ev=class extends qh(Cv,Tv){};X(q.annotations({description:`a string to be decoded into a TimeZone`}),Ev,{strict:!0,decode:(e,t,n)=>y(Jp(e),{onNone:()=>cm(new U(n,e,`Unable to decode ${JSON.stringify(e)} into a TimeZone`)),onSome:W}),encode:e=>W(Yp(e))}).annotations({identifier:`TimeZone`});const Dv=e=>e.oneof(Sv()(e),wv()(e));var Ov=class extends Ph(e=>Ip(e)&&Bp(e),{typeConstructor:{_tag:`effect/DateTime.Zoned`},identifier:`DateTimeZonedFromSelf`,description:`a DateTime.Zoned instance`,pretty:()=>e=>e.toString(),arbitrary:()=>e=>e.tuple(e.integer({min:-31536e9,max:31536e9}),Dv(e)).map(([e,t])=>Wp(e,{timeZone:t})),equivalence:()=>Vp}){};X(q.annotations({description:`a string to be decoded into a DateTime.Zoned`}),Ov,{strict:!0,decode:(e,t,n)=>y(Gp(e),{onNone:()=>cm(new U(n,e,`Unable to decode ${JSON.stringify(e)} into a DateTime.Zoned`)),onSome:W}),encode:e=>W($p(e))}).annotations({identifier:`DateTimeZoned`});const kv=e=>e._tag===`None`?w():v(e.value),Av=(e,t)=>n=>n.oneof(t,n.record({_tag:n.constant(`None`)}),n.record({_tag:n.constant(`Some`),value:e(n)})).map(kv),jv=e=>y({onNone:()=>`none()`,onSome:t=>`some(${e(t)})`}),Mv=e=>(t,n,r)=>Te(t)?Se(t)?W(w()):rv(e(t.value,n),v,r,t):cm(new U(r,t)),Nv=e=>Ph([e],{decode:e=>Mv(Tm(e)),encode:e=>Mv(Dm(e))},{typeConstructor:{_tag:`effect/Option`},pretty:jv,arbitrary:Av,equivalence:ee});Z(q,(e=>Nv(e).annotations({description:`Option<${xh(e)}>`}))(g_),{strict:!0,decode:e=>Ie(v(e.trim()),Ia),encode:e=>h(e,()=>``)});const Pv=()=>e=>`BigDecimal(${Lc(kc(e))})`,Fv=()=>e=>e.tuple(e.bigInt(),e.integer({min:-18,max:18})).map(([e,t])=>wc(e,t));var Iv=class extends Ph(Cc,{typeConstructor:{_tag:`effect/BigDecimal`},identifier:`BigDecimalFromSelf`,pretty:Pv,arbitrary:Fv,equivalence:()=>Mc}){};X(q.annotations({description:`a string to be decoded into a BigDecimal`}),Iv,{strict:!0,decode:(e,t,n)=>Ic(e).pipe(y({onNone:()=>cm(new U(n,e,`Unable to decode ${JSON.stringify(e)} into a BigDecimal`)),onSome:e=>W(kc(e))})),encode:e=>W(Lc(kc(e)))}).annotations({identifier:`BigDecimal`}),Z(J.annotations({description:`a number to be decoded into a BigDecimal`}),Iv,{strict:!0,decode:e=>Pc(e),encode:e=>zc(e)}).annotations({identifier:`BigDecimalFromNumber`});const Lv=e=>Dh(e)||fg(e),Rv=e=>Reflect.ownKeys(e).every(t=>Lv(e[t])),zv=e=>`fields`in e?e.fields:zv(e[Ug]),Bv=e=>Rv(e)?Dg(e):Dh(e)?e:Dg(zv(e)),Vv=e=>Rv(e)?e:zv(e),Hv=e=>_g(gg(Ah(e)),()=>e),Uv=e=>(t,n,r)=>{let i=Vv(n),a=Bv(n),o={_tag:Hv(t)},s=Gv(o,i);return class extends Yv({kind:`TaggedClass`,identifier:e??t,schema:Bg(a,Dg(o)),fields:s,Base:Fi,annotations:r}){static _tag=t}},Wv=e=>(t,n,r)=>{class a extends Ii{}a.prototype.name=t;let o=Vv(n),s=Bv(n),c={_tag:Hv(t)},l=Gv(c,o),u=`message`in l;class d extends Yv({kind:`TaggedError`,identifier:e??t,schema:Bg(s,Dg(c)),fields:l,Base:a,annotations:r,disableToString:!0}){static _tag=t}return u||Object.defineProperty(d.prototype,"message",{get(){return`{ ${Reflect.ownKeys(o).map(e=>`${i(e)}: ${St(this[e])}`).join(`, `)} }`},enumerable:!1,configurable:!0}),d},Gv=(e,t)=>{let n={...e};for(let r of Reflect.ownKeys(t)){if(r in e)throw Error(Qa(r));n[r]=t[r]}return n};function Kv(t){return e(t)?t:t?.disableValidation??!1}const qv=tt(`effect/Schema/astCache`,()=>new WeakMap),Jv=e=>e===void 0?[]:Array.isArray(e)?e:[e],Yv=({Base:e,annotations:t,disableToString:n,fields:r,identifier:a,kind:o,schema:s})=>{let c=Symbol.for(`effect/Schema/${o}/${a}`),[l,u,d]=Jv(t),f=Ch(s),p=f.annotations({identifier:a,...l}),m=f.annotations({[So]:`${a} (Type side)`,...l}),h=s.annotations({[So]:`${a} (Constructor)`,...l}),g=s.annotations({[So]:`${a} (Encoded side)`,...d}),_=s.annotations({...d,...l,...u}),ee=e=>$e(e,c)&&Am(m)(e),te=class extends e{constructor(e={},t=!1){e={...e},o!==`Class`&&delete e._tag,e=Tg(r,e),Kv(t)||(e=km(h)(e)),super(e,!0)}static[gh]=_h;static get ast(){let e=qv.get(this);if(e)return e;let t=Ph([s],{decode:()=>(e,t,n)=>e instanceof this||ee(e)?W(e):cm(new U(n,e)),encode:()=>(e,t)=>e instanceof this?W(e):pm(Dm(m)(e,t),e=>new this(e,!0))},{identifier:a,pretty:e=>t=>`${a}(${e(t)})`,arbitrary:e=>t=>e(t).map(e=>new this(e)),equivalence:b,[Io]:p.ast,...l});return e=Z(g,t,{strict:!0,decode:e=>new this(e,!0),encode:b}).annotations({[Io]:_.ast,...u}).ast,qv.set(this,e),e}static pipe(){return Le(this,arguments)}static annotations(e){return K(this.ast).annotations(e)}static toString(){return`(${String(g)} <-> ${a})`}static make(...e){return new this(...e)}static fields={...r};static identifier=a;static extend(e){return(t,n)=>{let i=Vv(t),a=Bv(t),c=Gv(r,i);return Yv({kind:o,identifier:e,schema:Bg(s,a),fields:c,Base:this,annotations:n})}}static transformOrFail(e){return(t,n,i)=>{let a=Gv(r,t);return Yv({kind:o,identifier:e,schema:X(s,Ch(Dg(a)),n),fields:a,Base:this,annotations:i})}}static transformOrFailFrom(e){return(t,n,i)=>{let a=Gv(r,t);return Yv({kind:o,identifier:e,schema:X(Sh(s),Dg(a),n),fields:a,Base:this,annotations:i})}}get[c](){return c}};return n!==!0&&Object.defineProperty(te.prototype,"toString",{value(){return`${a}({ ${Reflect.ownKeys(r).map(e=>`${i(e)}: ${St(this[e])}`).join(`, `)} })`},configurable:!0,writable:!0}),te},Xv=qh(Dg({_tag:Ah(`None`)}).annotations({identifier:`FiberIdNoneEncoded`}),Dg({_tag:Ah(`Runtime`),id:G_,startTimeMillis:G_}).annotations({identifier:`FiberIdRuntimeEncoded`}),Dg({_tag:Ah(`Composite`),left:Hg(()=>Xv),right:Hg(()=>Xv)}).annotations({identifier:`FiberIdCompositeEncoded`})).annotations({identifier:`FiberIdEncoded`}),Zv=e=>e.letrec(t=>({None:e.record({_tag:e.constant(`None`)}),Runtime:e.record({_tag:e.constant(`Runtime`),id:e.integer(),startTimeMillis:e.integer()}),Composite:e.record({_tag:e.constant(`Composite`),left:t(`FiberId`),right:t(`FiberId`)}),FiberId:e.oneof(t(`None`),t(`Runtime`),t(`Composite`))})).FiberId.map(ey),Qv=e=>{switch(e._tag){case`None`:return`FiberId.none`;case`Runtime`:return`FiberId.runtime(${e.id}, ${e.startTimeMillis})`;case`Composite`:return`FiberId.composite(${Qv(e.right)}, ${Qv(e.left)})`}};var $v=class extends Ph(Oe,{typeConstructor:{_tag:`effect/FiberId`},identifier:`FiberIdFromSelf`,pretty:()=>Qv,arbitrary:()=>Zv}){};const ey=e=>{switch(e._tag){case`None`:return ne;case`Runtime`:return ce(e.id,e.startTimeMillis);case`Composite`:return Ce(ey(e.left),ey(e.right))}},ty=e=>{switch(e._tag){case`None`:return{_tag:`None`};case`Runtime`:return{_tag:`Runtime`,id:e.id,startTimeMillis:e.startTimeMillis};case`Composite`:return{_tag:`Composite`,left:ty(e.left),right:ty(e.right)}}};Z(Xv,$v,{strict:!0,decode:e=>ey(e),encode:e=>ty(e)}).annotations({identifier:`FiberId`});var ny=class extends Z(Bh,Bh,{strict:!0,decode:e=>{if(st(e)&&`message`in e&&typeof e.message==`string`){let t=Error(e.message,{cause:e});return`name`in e&&typeof e.name==`string`&&(t.name=e.name),t.stack=`stack`in e&&typeof e.stack==`string`?e.stack:``,t}return Ht(e)},encode:e=>e instanceof Error?{name:e.name,message:e.message}:Ht(e)}).annotations({identifier:`Defect`}){};Z(Bh,Wh,{strict:!0,decode:e=>Nt(e),encode:b}).annotations({identifier:`BooleanFromUnknown`}),Z(Ah(`true`,`false`).annotations({description:`a string to be decoded into a boolean`}),Wh,{strict:!0,decode:e=>e===`true`,encode:e=>e?`true`:`false`}).annotations({identifier:`BooleanFromString`});const ry=kg(`symbol`,{key:q}).annotations({description:`an object to be decoded into a globally shared symbol`}),iy=X(ry,Uh,{strict:!0,decode:e=>Y_(e.key),encode:(e,t,n)=>pm(J_(e,n),e=>ry.make({key:e}))});var ay=class extends qh(q,J,iy).annotations({identifier:`PropertyKey`}){};Dg({_tag:gg(Ah(`Pointer`,`Unexpected`,`Missing`,`Composite`,`Refinement`,`Transformation`,`Type`,`Forbidden`)).annotations({description:`The tag identifying the type of parse issue`}),path:gg(rg(ay)).annotations({description:`The path to the property where the issue occurred`}),message:gg(q).annotations({description:`A descriptive message explaining the issue`})}).annotations({identifier:`ArrayFormatterIssue`,description:`Represents an issue returned by the ArrayFormatter formatter`});const oy=wf,sy=Df,cy=Of,ly=kf,uy=Nf,dy=Qf,fy=$f,py=sp,my=lp,hy=pp,gy=mp,_y=_p,vy=vp,yy=xp,by=wp,xy=Ep,Sy=Dp,Cy=Op,wy=Symbol.for(`@effect/platform/Error`),Ty=Ah(`Clipboard`,`Command`,`FileSystem`,`KeyValueStore`,`Path`,`Stream`,`Terminal`);var Ey=class extends Wv(`@effect/platform/Error/BadArgument`)(`BadArgument`,{module:Ty,method:q,description:xg(q),cause:xg(ny)}){[wy]=wy;get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:``}`}};const Dy=Ah(`AlreadyExists`,`BadResource`,`Busy`,`InvalidData`,`NotFound`,`PermissionDenied`,`TimedOut`,`UnexpectedEof`,`Unknown`,`WouldBlock`,`WriteZero`);var Oy=class extends Wv(`@effect/platform/Error/SystemError`)(`SystemError`,{reason:Dy,module:Ty,method:q,description:xg(q),syscall:xg(q),pathOrDescriptor:xg(qh(q,J)),cause:xg(ny)}){[wy]=wy;get message(){return`${this.reason}: ${this.module}.${this.method}${this.pathOrDescriptor===void 0?``:` (${this.pathOrDescriptor})`}${this.description?`: ${this.description}`:``}`}};const ky=yt(`@effect/platform/FileSystem`),Ay=e=>typeof e==`bigint`?e:BigInt(e),jy=BigInt(1024);jy*jy*jy*jy*jy;const My=e=>ky.of({...e,exists:t=>g(e.access(t),Kr(!0),vr(`SystemError`,e=>e.reason===`NotFound`?k(!1):Zr(e))),readFileString:(t,n)=>Vr(e.readFile(t),{try:e=>new TextDecoder(n).decode(e),catch:e=>new Ey({module:`FileSystem`,method:`readFileString`,description:`invalid encoding`,cause:e})}),stream:(t,n)=>g(e.open(t,{flag:`r`}),n?.offset?Pr(e=>e.seek(n.offset,`start`)):b,T(e=>Ny(e,n)),Sy),sink:(t,n)=>g(e.open(t,{flag:`w`,...n}),T(e=>cy(t=>e.writeAll(t))),uy),writeFileString:(t,n,r)=>M(Tr({try:()=>new TextEncoder().encode(n),catch:e=>new Ey({module:`FileSystem`,method:`writeFileString`,description:`could not encode string`,cause:e})}),n=>e.writeFile(t,n,r))}),Ny=(e,{bufferSize:t=16,bytesToRead:n,chunkSize:r=Ay(65536)}={})=>{let i=n===void 0?void 0:Ay(n),a=Ay(r);function o(t){if(i!==void 0&&i<=t)return Pp;let n=i!==void 0&&i-t<a?i-t:a;return jp(e.readAlloc(n),y({onNone:()=>Pp,onSome:e=>jp(Fp(Dt(e)),n=>o(t+BigInt(e.length)))}))}return fy(py(o(BigInt(0))),{capacity:t})},Py=Ay,Fy=ky,Iy=My,Ly=Symbol.for(`@effect/platform/FileSystem/File`),Ry=Kc(),zy=Pi(`Create`),By=Pi(`Update`),Vy=Pi(`Remove`);var Hy=class extends Lt(`@effect/platform/FileSystem/WatchBackend`)(){};const Uy=Symbol.for(`@effect/platform/Path`),Wy=yt(`@effect/platform/Path`);function Gy(e,t){let n=``,r=0,i=-1,a=0,o;for(let s=0;s<=e.length;++s){if(s<e.length)o=e.charCodeAt(s);else if(o===47)break;else o=47;if(o===47){if(i!==s-1&&a!==1){if(i!==s-1&&a===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){let e=n.lastIndexOf(`/`);if(e!==n.length-1){e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}}else if(n.length===2||n.length===1){n=``,r=0,i=s,a=0;continue}}t&&(n.length>0?n+=`/..`:n=`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1}i=s,a=0}else o===46&&a!==-1?++a:a=-1}return n}function Ky(e,t){let n=t.dir||t.root,r=t.base||(t.name||``)+(t.ext||``);return n?n===t.root?n+r:n+e+r:r}function qy(e){if(e.protocol!==`file:`)return Zr(new Ey({module:`Path`,method:`fromFileUrl`,description:`URL must be of scheme file`}));if(e.hostname!==``)return Zr(new Ey({module:`Path`,method:`fromFileUrl`,description:`Invalid file URL host`}));let t=e.pathname;for(let e=0;e<t.length;e++)if(t[e]===`%`){let n=t.codePointAt(e+2)|32;if(t[e+1]===`2`&&n===102)return Zr(new Ey({module:`Path`,method:`fromFileUrl`,description:`must not include encoded / characters`}))}return k(decodeURIComponent(t))}const Jy=function(){let e=``,t=!1,n;for(let r=arguments.length-1;r>=-1&&!t;r--){let i;if(r>=0)i=arguments[r];else{let e=globalThis.process;n===void 0&&`process`in globalThis&&typeof e==`object`&&e&&typeof e.cwd==`function`&&(n=e.cwd()),i=n}i.length!==0&&(e=i+`/`+e,t=i.charCodeAt(0)===47)}return e=Gy(e,!t),t?e.length>0?`/`+e:`/`:e.length>0?e:`.`};function Yy(e){let t=new URL(`file://`),n=Jy(e);return e.charCodeAt(e.length-1)===47&&n[n.length-1]!==`/`&&(n+=`/`),t.pathname=tb(n),k(t)}const Xy=/%/g,Zy=/\\/g,Qy=/\n/g,$y=/\r/g,eb=/\t/g;function tb(e){return e.includes(`%`)&&(e=e.replace(Xy,`%25`)),e.includes(`\\`)&&(e=e.replace(Zy,`%5C`)),e.includes(`
|
|
7
|
-
`)&&(e=e.replace(Qy,`%0A`)),e.includes(`\r`)&&(e=e.replace($y,`%0D`)),e.includes(` `)&&(e=e.replace(eb,`%09`)),e}const nb=Wy.of({[Uy]:Uy,resolve:Jy,normalize(e){if(e.length===0)return`.`;let t=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47;return e=Gy(e,!t),e.length===0&&!t&&(e=`.`),e.length>0&&n&&(e+=`/`),t?`/`+e:e},isAbsolute(e){return e.length>0&&e.charCodeAt(0)===47},join(){if(arguments.length===0)return`.`;let e;for(let t=0;t<arguments.length;++t){let n=arguments[t];n.length>0&&(e===void 0?e=n:e+=`/`+n)}return e===void 0?`.`:nb.normalize(e)},relative(e,t){if(e===t||(e=nb.resolve(e),t=nb.resolve(t),e===t))return``;let n=1;for(;n<e.length&&e.charCodeAt(n)===47;++n);let r=e.length,i=r-n,a=1;for(;a<t.length&&t.charCodeAt(a)===47;++a);let o=t.length-a,s=i<o?i:o,c=-1,l=0;for(;l<=s;++l){if(l===s){if(o>s){if(t.charCodeAt(a+l)===47)return t.slice(a+l+1);if(l===0)return t.slice(a+l)}else i>s&&(e.charCodeAt(n+l)===47?c=l:l===0&&(c=0));break}let r=e.charCodeAt(n+l);if(r!==t.charCodeAt(a+l))break;r===47&&(c=l)}let u=``;for(l=n+c+1;l<=r;++l)(l===r||e.charCodeAt(l)===47)&&(u.length===0?u+=`..`:u+=`/..`);return u.length>0?u+t.slice(a+c):(a+=c,t.charCodeAt(a)===47&&++a,t.slice(a))},dirname(e){if(e.length===0)return`.`;let t=e.charCodeAt(0),n=t===47,r=-1,i=!0;for(let n=e.length-1;n>=1;--n)if(t=e.charCodeAt(n),t===47){if(!i){r=n;break}}else i=!1;return r===-1?n?`/`:`.`:n&&r===1?`//`:e.slice(0,r)},basename(e,t){let n=0,r=-1,i=!0,a;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;let o=t.length-1,s=-1;for(a=e.length-1;a>=0;--a){let c=e.charCodeAt(a);if(c===47){if(!i){n=a+1;break}}else s===-1&&(i=!1,s=a+1),o>=0&&(c===t.charCodeAt(o)?--o===-1&&(r=a):(o=-1,r=s))}return n===r?r=s:r===-1&&(r=e.length),e.slice(n,r)}for(a=e.length-1;a>=0;--a)if(e.charCodeAt(a)===47){if(!i){n=a+1;break}}else r===-1&&(i=!1,r=a+1);return r===-1?``:e.slice(n,r)},extname(e){let t=-1,n=0,r=-1,i=!0,a=0;for(let o=e.length-1;o>=0;--o){let s=e.charCodeAt(o);if(s===47){if(!i){n=o+1;break}continue}r===-1&&(i=!1,r=o+1),s===46?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||r===-1||a===0||a===1&&t===r-1&&t===n+1?``:e.slice(t,r)},format:function(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return Ky(`/`,e)},parse(e){let t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;let n=e.charCodeAt(0),r=n===47,i;r?(t.root=`/`,i=1):i=0;let a=-1,o=0,s=-1,c=!0,l=e.length-1,u=0;for(;l>=i;--l){if(n=e.charCodeAt(l),n===47){if(!c){o=l+1;break}continue}s===-1&&(c=!1,s=l+1),n===46?a===-1?a=l:u!==1&&(u=1):a!==-1&&(u=-1)}return a===-1||s===-1||u===0||u===1&&a===s-1&&a===o+1?s!==-1&&(t.base=t.name=o===0&&r?e.slice(1,s):e.slice(o,s)):(o===0&&r?(t.name=e.slice(1,a),t.base=e.slice(1,s)):(t.name=e.slice(o,a),t.base=e.slice(o,s)),t.ext=e.slice(a,s)),o>0?t.dir=e.slice(0,o-1):r&&(t.dir=`/`),t},sep:`/`,fromFileUrl:qy,toFileUrl:Yy,toNamespacedPath:b}),rb=Xc(Wy,nb),ib=Wy,ab=rb,ob={arrays:`merge`,sets:`merge`,maps:`merge`};function sb(e,t,n){return cb(e,t,new Set,n??ob)}function cb(e,t,n,r){let i={},a=new Set([...pb(e),...pb(t)]);for(let o of a){if(o===`__proto__`)continue;let a=e[o];if(!Object.hasOwn(t,o)){i[o]=a;continue}let s=t[o];if(fb(a)&&fb(s)&&!n.has(a)&&!n.has(s)){n.add(a),n.add(s),i[o]=lb(a,s,n,r);continue}i[o]=s}return i}function lb(e,t,n,r){if(ub(e)&&ub(t))return cb(e,t,n,r);if(db(e)&&db(t)){if(Array.isArray(e)&&Array.isArray(t))return r.arrays===`merge`?e.concat(t):t;if(e instanceof Map&&t instanceof Map){if(r.maps===`merge`){let n=new Map(e);for(let[e,r]of t)n.set(e,r);return n}return t}if(e instanceof Set&&t instanceof Set){if(r.sets===`merge`){let n=new Set(e);for(let e of t)n.add(e);return n}return t}}return t}function ub(e){return Object.getPrototypeOf(e)===Object.prototype}function db(e){return typeof e[Symbol.iterator]==`function`}function fb(e){return typeof e==`object`&&!!e}function pb(e){let t=Object.keys(e),n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;for(let r of n)Object.prototype.propertyIsEnumerable.call(e,r)&&t.push(r);return t}function mb(e){return e%4==0&&e%100!=0||e%400==0}var hb=class{#e=/[ \t]/;#t=0;#n;constructor(e){this.#n=e}get position(){return this.#t}get source(){return this.#n}char(e=0){return this.#n[this.#t+e]??``}slice(e,t){return this.#n.slice(this.#t+e,this.#t+t)}next(e=1){this.#t+=e}skipWhitespaces(){for(;this.#e.test(this.char())&&!this.eof();)this.next();if(!this.isCurrentCharEOL()&&/\s/.test(this.char())){let e=`\\u`+this.char().charCodeAt(0).toString(16),t=this.#t;throw SyntaxError(`Cannot parse the TOML: It contains invalid whitespace at position '${t}': \`${e}\``)}}nextUntilChar(e={skipComments:!0}){for(;!this.eof();){let t=this.char();if(this.#e.test(t)||this.isCurrentCharEOL())this.next();else if(e.skipComments&&this.char()===`#`)for(;!this.isCurrentCharEOL()&&!this.eof();)this.next();else break}}eof(){return this.#t>=this.#n.length}isCurrentCharEOL(){return this.char()===`
|
|
8
|
-
`||this.startsWith(`\r
|
|
9
|
-
`)}startsWith(e){return this.#n.startsWith(e,this.#t)}match(e){if(!e.sticky)throw Error(`RegExp ${e} does not have a sticky 'y' flag`);return e.lastIndex=this.#t,this.#n.match(e)}};function Q(e){return{ok:!0,body:e}}function $(){return{ok:!1}}function gb(e,t={__proto__:null}){return e.reduceRight((e,t)=>({[t]:e}),t)}function _b(e){return typeof e==`object`&&!!e}function vb(e,t){let n=t[0];if(!n)throw Error(`Cannot parse the TOML: key length is not a positive number`);return e[n]}function yb(e,t){let{keys:n,type:r,value:i}=t,a=vb(e,n);if(a===void 0)return Object.assign(e,gb(n,i));if(Array.isArray(a))return xb(a.at(-1),{type:r,keys:n.slice(1),value:i}),e;if(_b(a))return xb(a,{type:r,keys:n.slice(1),value:i}),e;throw Error(`Unexpected assign`)}function bb(e,t){let{type:n,keys:r,value:i}=t,a=vb(e,r);if(a===void 0)return Object.assign(e,gb(r,[i]));if(Array.isArray(a))return t.keys.length===1?a.push(i):xb(a.at(-1),{type:t.type,keys:t.keys.slice(1),value:t.value}),e;if(_b(a))return xb(a,{type:n,keys:r.slice(1),value:i}),e;throw Error(`Unexpected assign`)}function xb(e,t){switch(t.type){case`Block`:return sb(e,t.value);case`Table`:return yb(e,t);case`TableArray`:return bb(e,t)}}function Sb(e){return t=>{for(let n of e){let e=n(t);if(e.ok)return e}return $()}}function Cb(e,t){let n=kb(t);return r=>{let i=[],a=e(r);if(!a.ok)return Q(i);for(i.push(a.body);!r.eof()&&n(r).ok;){let n=e(r);if(!n.ok)throw SyntaxError(`Invalid token after "${t}"`);i.push(n.body)}return Q(i)}}function wb(e,t){let n=kb(t);return r=>{let i=e(r);if(!i.ok)return $();let a=[i.body];for(;!r.eof()&&n(r).ok;){let n=e(r);if(!n.ok)throw SyntaxError(`Invalid token after "${t}"`);a.push(n.body)}return Q(a)}}function Tb(e,t,n){let r=kb(t);return i=>{let a=i.position,o=e(i);if(!o.ok)return $();if(!r(i).ok)throw SyntaxError(`key/value pair doesn't have "${t}"`);let s=n(i);if(!s.ok){let e=i.source.indexOf(`
|
|
10
|
-
`,i.position),t=e>0?e:i.source.length,n=i.source.slice(a,t);throw SyntaxError(`Cannot parse value on line '${n}'`)}return Q(gb(o.body,s.body))}}function Eb(e){return t=>{let n=e(t);if(!n.ok)return $();let r={__proto__:null};for(let e of n.body)typeof e==`object`&&e&&(r=sb(r,e));return Q(r)}}function Db(e){return t=>{let n=[];for(;!t.eof();){let r=e(t);if(!r.ok)break;n.push(r.body),t.nextUntilChar()}return n.length===0?$():Q(n)}}function Ob(e,t,n){let r=kb(e),i=kb(n);return a=>{if(!r(a).ok)return $();let o=t(a);if(!o.ok)throw SyntaxError(`Invalid token after "${e}"`);if(!i(a).ok)throw SyntaxError(`Not closed by "${n}" after started with "${e}"`);return Q(o.body)}}function kb(e){return t=>(t.skipWhitespaces(),t.startsWith(e)?(t.next(e.length),t.skipWhitespaces(),Q(void 0)):$())}const Ab=/[A-Za-z0-9_-]+/y;function jb(e){e.skipWhitespaces();let t=e.match(Ab)?.[0];return t?(e.next(t.length),Q(t)):$()}function Mb(e){if(e.char()!==`\\`)return $();switch(e.next(),e.char()){case`b`:return e.next(),Q(`\b`);case`t`:return e.next(),Q(` `);case`n`:return e.next(),Q(`
|
|
11
|
-
`);case`f`:return e.next(),Q(`\f`);case`r`:return e.next(),Q(`\r`);case`u`:case`U`:{let t=e.char()===`u`?4:6,n=parseInt(`0x`+e.slice(1,1+t),16),r=String.fromCodePoint(n);return e.next(t+1),Q(r)}case`"`:return e.next(),Q(`"`);case`\\`:return e.next(),Q(`\\`);default:throw SyntaxError(`Invalid escape sequence: \\${e.char()}`)}}function Nb(e){if(e.skipWhitespaces(),e.char()!==`"`)return $();e.next();let t=[];for(;e.char()!==`"`&&!e.eof();){if(e.char()===`
|
|
12
|
-
`)throw SyntaxError(`Single-line string cannot contain EOL`);let n=Mb(e);n.ok?t.push(n.body):(t.push(e.char()),e.next())}if(e.eof())throw SyntaxError(`Single-line string is not closed:\n${t.join(``)}`);return e.next(),Q(t.join(``))}function Pb(e){if(e.skipWhitespaces(),e.char()!==`'`)return $();e.next();let t=[];for(;e.char()!==`'`&&!e.eof();){if(e.char()===`
|
|
13
|
-
`)throw SyntaxError(`Single-line string cannot contain EOL`);t.push(e.char()),e.next()}if(e.eof())throw SyntaxError(`Single-line string is not closed:\n${t.join(``)}`);return e.next(),Q(t.join(``))}function Fb(e){if(e.skipWhitespaces(),!e.startsWith(`"""`))return $();e.next(3),e.char()===`
|
|
14
|
-
`?e.next():e.startsWith(`\r
|
|
15
|
-
`)&&e.next(2);let t=[];for(;!e.startsWith(`"""`)&&!e.eof();){if(e.startsWith(`\\
|
|
16
|
-
`)){e.next(),e.nextUntilChar({skipComments:!1});continue}if(e.startsWith(`\\\r
|
|
17
|
-
`)){e.next(),e.nextUntilChar({skipComments:!1});continue}let n=Mb(e);n.ok?t.push(n.body):(t.push(e.char()),e.next())}if(e.eof())throw SyntaxError(`Multi-line string is not closed:\n${t.join(``)}`);return e.char(3)===`"`&&(t.push(`"`),e.next()),e.next(3),Q(t.join(``))}function Ib(e){if(e.skipWhitespaces(),!e.startsWith(`'''`))return $();e.next(3),e.char()===`
|
|
18
|
-
`?e.next():e.startsWith(`\r
|
|
19
|
-
`)&&e.next(2);let t=[];for(;!e.startsWith(`'''`)&&!e.eof();)t.push(e.char()),e.next();if(e.eof())throw SyntaxError(`Multi-line string is not closed:\n${t.join(``)}`);return e.char(3)===`'`&&(t.push(`'`),e.next()),e.next(3),Q(t.join(``))}const Lb=/(?:true|false)\b/y;function Rb(e){e.skipWhitespaces();let t=e.match(Lb);if(!t)return $();let n=t[0];return e.next(n.length),Q(n===`true`)}const zb=new Map([[`inf`,1/0],[`+inf`,1/0],[`-inf`,-1/0]]),Bb=/[+-]?inf\b/y;function Vb(e){e.skipWhitespaces();let t=e.match(Bb);if(!t)return $();let n=t[0];return e.next(n.length),Q(zb.get(n))}const Hb=/[+-]?nan\b/y;function Ub(e){e.skipWhitespaces();let t=e.match(Hb);if(!t)return $();let n=t[0];return e.next(n.length),Q(NaN)}const Wb=wb(Sb([jb,Nb,Pb]),`.`),Gb=/0b[01]+(?:_[01]+)*\b/y;function Kb(e){e.skipWhitespaces();let t=e.match(Gb)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,2);return isNaN(r)?$():Q(r)}const qb=/0o[0-7]+(?:_[0-7]+)*\b/y;function Jb(e){e.skipWhitespaces();let t=e.match(qb)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,8);return isNaN(r)?$():Q(r)}const Yb=/0x[0-9a-f]+(?:_[0-9a-f]+)*\b/iy;function Xb(e){e.skipWhitespaces();let t=e.match(Yb)?.[0];if(!t)return $();e.next(t.length);let n=t.slice(2).replaceAll(`_`,``),r=parseInt(n,16);return isNaN(r)?$():Q(r)}const Zb=/[+-]?(?:0|[1-9][0-9]*(?:_[0-9]+)*)\b/y;function Qb(e){e.skipWhitespaces();let t=e.match(Zb)?.[0];if(!t)return $();e.next(t.length);let n=t.replaceAll(`_`,``);return Q(parseInt(n,10))}const $b=/[+-]?(?:0|[1-9][0-9]*(?:_[0-9]+)*)(?:\.[0-9]+(?:_[0-9]+)*)?(?:e[+-]?[0-9]+(?:_[0-9]+)*)?\b/iy;function ex(e){e.skipWhitespaces();let t=e.match($b)?.[0];if(!t)return $();e.next(t.length);let n=t.replaceAll(`_`,``),r=parseFloat(n);return isNaN(r)?$():Q(r)}const tx=/(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})(?:[ 0-9TZ.:+-]+)?\b/y;function nx(e){e.skipWhitespaces();let t=e.match(tx);if(!t)return $();let n=t[0];e.next(n.length);let r=t.groups;if(r.month==`02`){let e=parseInt(r.day);if(e>29)throw SyntaxError(`Invalid date string "${t}"`);let n=parseInt(r.year);if(e>28&&!mb(n))throw SyntaxError(`Invalid date string "${t}"`)}let i=new Date(n.trim());if(isNaN(i.getTime()))throw SyntaxError(`Invalid date string "${t}"`);return Q(i)}const rx=/(\d{2}):(\d{2}):(\d{2})(?:\.[0-9]+)?\b/y;function ix(e){e.skipWhitespaces();let t=e.match(rx)?.[0];return t?(e.next(t.length),Q(t)):$()}function ax(e){if(e.skipWhitespaces(),e.char()!==`[`)return $();e.next();let t=[];for(;!e.eof();){e.nextUntilChar();let n=sx(e);if(!n.ok||(t.push(n.body),e.skipWhitespaces(),e.char()!==`,`))break;e.next()}if(e.nextUntilChar(),e.char()!==`]`)throw SyntaxError(`Array is not closed`);return e.next(),Q(t)}function ox(e){if(e.nextUntilChar(),e.char(1)===`}`)return e.next(2),Q({__proto__:null});let t=Ob(`{`,Cb(cx,`,`),`}`)(e);if(!t.ok)return $();let n={__proto__:null};for(let e of t.body)n=sb(n,e);return Q(n)}const sx=Sb([Fb,Ib,Nb,Pb,Rb,Vb,Ub,nx,ix,Kb,Jb,Xb,ex,Qb,ax,ox]),cx=Tb(Wb,`=`,sx);function lx(e){e.nextUntilChar();let t=Eb(Db(cx))(e);return t.ok?Q({type:`Block`,value:t.body}):$()}const ux=Ob(`[`,Wb,`]`);function dx(e){e.nextUntilChar();let t=ux(e);if(!t.ok)return $();e.nextUntilChar();let n=lx(e);return Q({type:`Table`,keys:t.body,value:n.ok?n.body.value:{__proto__:null}})}const fx=Ob(`[[`,Wb,`]]`);function px(e){e.nextUntilChar();let t=fx(e);if(!t.ok)return $();e.nextUntilChar();let n=lx(e);return Q({type:`TableArray`,keys:t.body,value:n.ok?n.body.value:{__proto__:null}})}function mx(e){let t=Db(Sb([lx,px,dx]))(e);return t.ok?Q(t.body.reduce(xb,{__proto__:null})):Q({__proto__:null})}function hx(e,t){let n=e.source.slice(0,e.position).split(`
|
|
20
|
-
`);return`Parse error on line ${n.length}, column ${n.at(-1)?.length??0}: ${t}`}function gx(e){return t=>{let n=new hb(t);try{let t=e(n);if(t.ok&&n.eof())return t.body;let r=`Unexpected character: "${n.char()}"`;throw SyntaxError(hx(n,r))}catch(e){throw e instanceof Error?SyntaxError(hx(n,e.message)):SyntaxError(hx(n,`Invalid error type caught`))}}}function _x(e){return gx(mx)(e)}const vx={ctx_execute:!0,ctx_batch_execute:!0};function yx(e,t){return vx[e]?e!==`ctx_execute`||t.language===`shell`:!1}function bx(e,t){if(yx(e,t)){if(e===`ctx_execute`)return typeof t.code==`string`?t.code:void 0;if(Array.isArray(t.commands))return t.commands.map(e=>typeof e==`object`&&e&&`command`in e&&typeof e.command==`string`?e.command:``).filter(e=>typeof e==`string`).join(`
|
|
21
|
-
`)}}const xx=/#[0-9a-fA-F]{4}$/u,Sx=/^\*\*\* (?:Add|Update|Delete) File:\s*(.+)$/,Cx=/^\*\*\* Move to:\s*(.+)$/,wx={Write:!0,Edit:!0,Read:!0,MultiEdit:!0,Update:!0,Create:!0};function Tx(e){let t=e.trim(),n=xx.exec(t)?.index,r=n===void 0?t:t.slice(0,n);if(r.length<2)return r;let i=r[0],a=r[r.length-1];return(i===`"`||i===`'`)&&i===a?r.slice(1,-1):r}function Ex(e){let t=e.trimEnd();if(!t.startsWith(`[`))return;let n=t.endsWith(`]`)?t.length-1:t.length,r=Tx(t.slice(1,n));return r.length>0?r:void 0}function Dx(e){let t=[],n=e.startsWith(``)?e.slice(1):e,r=!1;for(let e of n.split(`
|
|
22
|
-
`)){let n=Ex(e);if(n!==void 0){t.push(n),r=!0;continue}let i=Sx.exec(e)?.[1];if(i!==void 0){t.push(i.trim());continue}let a=Cx.exec(e)?.[1];if(a!==void 0){t.push(a.trim());continue}let o=e.trim();if(r&&o.startsWith(`MV `)){let e=Tx(o.slice(3));e.length>0&&t.push(e)}}return t}function Ox(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:void 0}function kx(e,t){if(wx[e]!==!0)return[];let n=t.input,r=typeof n==`string`?Dx(n):[];if(r.length>0)return Array.from(new Set(r));let i=Ox(t,`file_path`)??Ox(t,`path`);return i===void 0?[]:[i]}const Ax=new Map;function jx(e,t){if(t===void 0||t.length===0)return!0;let n=t.split(`|`).map(e=>e.trim()).filter(Boolean).join(`|`);if(n.length===0)return!0;let r=Ax.get(n);if(r!==void 0)return r===!0||r.test(e);let i=Mx(n);return Ax.size>=256&&Ax.clear(),Ax.set(n,i),i===!0||i.test(e)}function Mx(e){try{return RegExp(`^(?:${e})$`)}catch{return!0}}const Nx=/^\s*([^\s()]+)\s*(?:\(([\s\S]*)\))?\s*$/,Px=/\$\(|`|\$\{?\w/,Fx=/\$\(([^()]*)\)|`([^`]*)`/g,Ix=/^(?:\w+=(?:"[^"]*"|'[^']*'|\S*)\s+)+/,Lx=/&&|\|\||[;|]/,Rx=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function zx(e,t,n,r){let i=Nx.exec(e),a=i?.[1];if(a===void 0)return!0;if(a!==t)return!1;let o=i?.[2]?.trim();return o===void 0||o.length===0?!0:a===`Bash`?Bx(o,n.command):Wx(o,n.file_path,r)}function Bx(e,t){if(typeof t!=`string`)return!0;let n=Vx(t);return n.length===0||n.some(t=>Ux(e,t))?!0:Hx(e)&&Px.test(t)}function Vx(e){let t=[...e.matchAll(Fx)].map(e=>e[1]??e[2]??``);return[e.replace(Fx,` `),...t].flatMap(e=>e.split(Lx)).map(e=>e.trim().replace(Ix,``)).filter(e=>e.length>0)}function Hx(e){return e.replace(/\*+$/,``).trim().split(/\s+/).filter(Boolean).length>1}function Ux(e,t){return RegExp(`^${e.split(`*`).map(Rx).join(`.*`)}$`).test(t)}function Wx(e,t,n){if(typeof t!=`string`)return!0;let r=t.startsWith(`${n}/`)?t.slice(n.length+1):t,i=e.replace(/\/+$/,``),a=i.includes(`/`)?r:Gx(r);return RegExp(`^${Kx(i)}$`).test(a)}const Gx=e=>e.slice(e.lastIndexOf(`/`)+1);function Kx(e){let t=qx(e);return e.endsWith(`/**`)?`(?:${qx(e.slice(0,-3))}|${t})`:t}function qx(e){let t=``,n=0;for(;n<e.length;){let r=e.charAt(n);if(r!==`*`){t+=r===`?`?`[^/]`:Rx(r),n+=1;continue}if(e.charAt(n+1)!==`*`){t+=`[^/]*`,n+=1;continue}let i=e.charAt(n+2)===`/`;t+=i?`(?:[^/]+/)*`:`.*`,n+=i?3:2}return t}function Jx(e){return{session_id:e(),agent_id:null}}const Yx=jg({key:q,value:rg(q)}).pipe(Ng(`TomlConfig`));X(q,Ch(Yx),{strict:!0,decode:e=>lm({try:()=>_x(e),catch:e=>new em(e,`TOML parse error`)}).pipe(fm(e=>Tm(Yx)(e))),encode:(e,t,n)=>cm(new im(n,e,`TomlConfigFromText is decode-only`))});const Xx=`systemfsoftware.toml`,Zx=Om(Yx)({});var Qx=class extends Lt(`@systemfsoftware/omp-utils/toml-loader.adapter/TomlLoader`)(){};const $x=e=>{let t={};for(let n of e)for(let[e,r]of Object.entries(n))t[e]=r;return t},eS=e=>lm({try:()=>_x(e),catch:e=>new em(e,`TOML parse error`)}).pipe(fm(e=>Tm(Yx)(e))),tS=(e,t,n)=>e.exists(n).pipe(M(t=>t?e.readFileString(n).pipe(M(eS),Hr(()=>Zx)):k(Zx))),nS=qc(Qx,M(mr(()=>{let e=process.env.OMP_USER_CONFIG_HOME;return typeof e==`string`&&e.length>0?e:Mi.homedir()}),e=>Rn(function*(){let t=yield*zn(qn()),n=yield*Fy,r=yield*ib,i=r.join(e,`.config/systemfsoftware`,Xx);return Qx.of({load:mn(`TomlLoader.load`)(function*(e){let a=yield*bn(t),o=hn(a,e);if(Ae(o))return o.value;let s=r.join(e,Xx),c=r.join(e,`systemfsoftware.local.toml`),l=yield*tS(n,r,i),u=yield*tS(n,r,s),d=yield*tS(n,r,c),f=yield*Eh(Yx)($x([l,u,d])).pipe(wn);return yield*Nn(t,t=>(ei(t,e,f),t)),f})})}))),rS={Write:!0,Edit:!0,Read:!0,MultiEdit:!0,Update:!0,Create:!0},iS={Edit:!0,MultiEdit:!0,Update:!0},aS=Am(rg(Dg({old_text:xg(Bh),new_text:xg(Bh)}).pipe(Y(e=>`old_text`in e||`new_text`in e))).pipe(hv(1))),oS=(e,t)=>{let n=e.split(`
|
|
23
|
-
`).filter(e=>e.startsWith(t));return n.length===0?void 0:n.map(e=>e.slice(t.length)).join(`
|
|
24
|
-
`)};function sS(e,t){let n=t;if(rS[e]===!0&&`path`in n&&!(`file_path`in n)){let{path:e,...t}=n;n={file_path:e,...t}}if(iS[e]===!0&&`edits`in n&&aS(n.edits)&&!(`new_string`in n)){let e=n.edits.map(e=>({old_string:typeof e.old_text==`string`?e.old_text:``,new_string:typeof e.new_text==`string`?e.new_text:``}));n={...n,edits:e,old_string:e.map(e=>e.old_string).join(`
|
|
25
|
-
`),new_string:e.map(e=>e.new_string).join(`
|
|
26
|
-
`)}}if(iS[e]===!0&&typeof n.input==`string`&&!(`new_string`in n)){let e=oS(n.input,`+`),t=oS(n.input,`-`);n={...n,...e===void 0?{}:{new_string:e},...t===void 0?{}:{old_string:t}}}return n}const cS=Am(rg(Dg({old_string:xg(Bh),new_string:xg(Bh)}).pipe(Y(e=>`old_string`in e||`new_string`in e)))),lS=Cm(jg({key:q,value:Bh}));function uS(e,t){let n=De(lS(t));if(n===null)return{};let r=`file_path`in e||!(`path`in e)?`file_path`:`path`,i={};for(let[t,a]of Object.entries(n)){if(t===`file_path`){i[r]=a;continue}if(!((t===`old_string`||t===`new_string`)&&!(t in e))){if(t===`edits`&&cS(a)&&aS(e.edits)){i.edits=a.map(e=>({old_text:typeof e.old_string==`string`?e.old_string:``,new_text:typeof e.new_string==`string`?e.new_string:``}));continue}i[t]=a}}return i}const dS={read:`Read`,write:`Write`,edit:`Edit`,bash:`Bash`,glob:`Glob`,grep:`Grep`,task:`Task`,todo:`TodoWrite`,web_search:`WebSearch`,ask:`AskUserQuestion`};function fS(e){if(e.length===0||e.startsWith(`mcp__`))return e;let t=dS[e];return t===void 0?e.charAt(0).toUpperCase()+e.slice(1):t}export{wh as $,_y as A,rg as B,Oy as C,my as D,py as E,Sy as F,jg as G,Ah as H,oy as I,Uv as J,q as K,sy as L,yy as M,by as N,hy as O,xy as P,Bh as Q,ly as R,Ey as S,Kc as St,Cy as T,zh as U,Wh as V,J as W,kg as X,Wv as Y,qh as Z,Hy as _,Fp as _t,bx as a,im as at,By as b,Zc as bt,sS as c,jm as ct,ib as d,kp as dt,Th as et,ab as f,Ap as ft,Py as g,Pp as gt,Ly as h,Np as ht,kx as i,X as it,vy as j,gy as k,fS as l,cm as lt,Fy as m,Mp as mt,nS as n,Sg as nt,jx as o,Cm as ot,Ry as p,jp as pt,Dg as q,uS as r,y_ as rt,zx as s,Sm as st,Qx as t,xg as tt,Jx as u,W as ut,zy as v,qc as vt,dy as w,Iy as x,Yc as xt,Vy as y,Jc as yt,Vh as z};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{$s as e,Ai as t,Ds as n,Ec as r,El as i,Fs as a,Hs as o,Js as s,Ks as c,Ls as l,Oo as u,Po as d,Ps as f,Rs as p,Tc as ee,Tl as m,Ts as te,Ys as ne,bo as re,ia as ie,jo as ae,ko as oe,oa as h,qs as se,tc as g,wl as _,ws as ce,xi as le,yi as ue,zs as v}from"./core-CG9iBVjE.js";import{$ as de,B as fe,C as y,Dn as pe,E as me,I as b,Mn as he,O as x,P as ge,R as _e,T as ve,_t as ye,a as be,dt as xe,f as Se,fn as Ce,ft as we,j as Te,jn as Ee,k as De,o as Oe,ot as ke,q as Ae,rt as je,ut as Me,x as Ne}from"./Effect-C1HfHpDW.js";import{f as Pe,m as Fe}from"./Cause-DsRZwSYW.js";import{$ as Ie,A as Le,B as S,D as Re,F as ze,G as C,H as Be,J as w,K as T,L as Ve,M as He,O as Ue,Q as E,St as We,T as Ge,U as Ke,V as D,W as qe,X as O,Y as Je,Z as k,a as Ye,at as Xe,c as Ze,ct as Qe,et as A,i as $e,it as et,j as tt,k as nt,l as rt,lt as it,m as at,nt as j,o as ot,ot as M,q as N,r as st,rt as P,s as ct,st as lt,tt as F,u as I,ut,z as L}from"./dist-CJoMkiK8.js";import{homedir as R}from"node:os";const dt={[Symbol.for(`@effect/matcher/Matcher`)]:{_input:m,_filters:m,_remaining:m,_result:m,_provided:m,_return:m},_tag:`ValueMatcher`,add(e){return this.value._tag===`Right`?this:e._tag===`When`&&e.guard(this.provided)===!0||e._tag===`Not`&&e.guard(this.provided)===!1?ft(this.provided,g(e.evaluate(this.provided))):this},pipe(){return ee(this,arguments)}};function ft(e,t){let n=Object.create(dt);return n.provided=e,n.value=t,n}const pt=(e,t)=>({_tag:`When`,guard:e,evaluate:t}),mt=e=>{if(typeof e==`function`)return e;if(Array.isArray(e)){let t=e.map(mt),n=t.length;return e=>{if(!Array.isArray(e))return!1;for(let r=0;r<n;r++)if(t[r](e[r])===!1)return!1;return!0}}if(typeof e==`object`&&e){let t=Object.entries(e).map(([e,t])=>[e,mt(t)]),n=t.length;return e=>{if(typeof e!=`object`||!e)return!1;for(let r=0;r<n;r++){let[n,i]=t[r];if(!(n in e)||i(e[n])===!1)return!1}return!0}}return t=>t===e},ht=e=>ft(e,ne(e)),gt=(e,t)=>n=>n.add(pt(mt(e),t)),_t=(e=>(...t)=>{let n=t[t.length-1],r=t.slice(0,-1),i=r.length===1?t=>t!=null&&t[e]===r[0]:t=>t!=null&&r.includes(t[e]);return e=>e.add(pt(i,n))})(`_tag`),vt=e=>t=>{let n=yt(t);return c(n)?n._tag===`Right`?n.right:e(n.left):t=>{let r=n(t);return r._tag===`Right`?r.right:e(r.left)}},yt=e=>{if(e._tag===`ValueMatcher`)return e.value;let t=e.cases.length;if(t===1){let t=e.cases[0];return e=>t._tag===`When`&&t.guard(e)===!0||t._tag===`Not`&&t.guard(e)===!1?g(t.evaluate(e)):ne(e)}return n=>{for(let r=0;r<t;r++){let t=e.cases[r];if(t._tag===`When`&&t.guard(n)===!0||t._tag===`Not`&&t.guard(n)===!1)return g(t.evaluate(n))}return ne(n)}},bt=`effect/Match/exhaustive: absurd`,xt=e=>{let t=yt(e);if(c(t)){if(t._tag===`Right`)return t.right;throw Error(bt)}return e=>{let n=t(e);if(n._tag===`Right`)return n.right;throw Error(bt)}},z=ht,B=gt,V=_t,St=vt,H=xt,Ct=`PreToolUse.PostToolUse.PostToolUseFailure.PostToolBatch.UserPromptSubmit.UserPromptExpansion.SessionStart.SessionEnd.Stop.StopFailure.PreCompact.PostCompact.PermissionRequest.PermissionDenied.SubagentStart.SubagentStop.MessageDisplay.Notification.Setup.TaskCreated.TaskCompleted.TeammateIdle.InstructionsLoaded.ConfigChange.CwdChanged.FileChanged.WorktreeCreate.WorktreeRemove.Elicitation.ElicitationResult`.split(`.`),wt=[`PreToolUse`,`PostToolUse`,`PostToolUseFailure`,`UserPromptSubmit`,`SessionStart`,`SessionEnd`,`Stop`,`PreCompact`,`PostCompact`],Tt={PermissionRequest:"OMP emits `tool_approval_requested`, but the event exists to allow or deny and OMP ignores the handler return. Express approval policy through OMP native approval configuration instead.",PermissionDenied:"OMP emits `tool_approval_resolved` with `approved: false`, which reports a manual decline by the user — the case Claude Code explicitly excludes, since this event fires only for auto-classifier denials.",SubagentStart:"OMP emits `agent_start`, but its payload carries no agent identity and it fires for the main agent turn loop too, so a bridge would fabricate subagent events that never happened.",SubagentStop:'OMP emits `agent_end` with the same identity gap, so a "subagent stopped" hook would fire on every main-agent turn end.',MessageDisplay:"The event exists to rewrite what Claude Code renders via `displayContent`; OMP `message_update` / `message_end` expose no equivalent control over rendering.",PostToolBatch:`OMP dispatches tool calls individually and exposes no end-of-batch signal.`,UserPromptExpansion:"OMP has no signal for a typed command expanding before it reaches the model; its `input` event fires after expansion would already have happened.",StopFailure:`OMP exposes no signal distinguishing a failed stop from an ordinary one.`,Notification:`Notifications are OMP-side UI; no extension event is emitted when one is raised.`,Setup:`OMP has no first-run setup lifecycle event.`,TaskCreated:`The OMP todo surface emits no per-task creation event to extensions.`,TaskCompleted:`The OMP todo surface emits no per-task completion event to extensions.`,TeammateIdle:`OMP has no teammate concept and emits no idle signal for one.`,InstructionsLoaded:`OMP loads instruction files without emitting an extension event.`,ConfigChange:`OMP does not notify extensions when its configuration changes.`,CwdChanged:`OMP exposes no working-directory change event.`,FileChanged:`OMP has no file-watch surface exposed to extensions.`,WorktreeCreate:`OMP emits no worktree lifecycle events.`,WorktreeRemove:`OMP emits no worktree lifecycle events.`,Elicitation:`MCP elicitation is not surfaced to OMP extensions.`,ElicitationResult:`MCP elicitation is not surfaced to OMP extensions.`},Et=[`PreToolUse`,`PostToolUse`,`PostToolUseFailure`,`PermissionRequest`,`PermissionDenied`],Dt={PreCompact:"OMP `session_before_compact` does not say whether the compaction was manual or automatic, so a `trigger` matcher cannot be evaluated.",PostCompact:"OMP `session_compact` reports only whether an extension requested the compaction, not whether it was manual or automatic, so a `trigger` matcher cannot be evaluated.",SessionEnd:"OMP `session_shutdown` fires on process exit and carries no reason, so a `reason` matcher cannot be evaluated."},Ot={SessionStart:{startup:{_tag:`Reachable`},compact:{_tag:`Reachable`},fork:{_tag:`Reachable`},resume:{_tag:`Partial`,reason:'covers a mid-session resume, which arrives as `session_switch` with `reason: "resume"`. A cold start under `--resume` never emits that signal — it reaches extensions through a bare `session_start` — so it presents as `startup` and a resume-scoped hook does not run there.'},clear:{_tag:`Unreachable`,reason:`OMP emits no signal when a session is cleared.`}}},kt=N({type:Be(`command`),command:T,args:F(S(T)),async:F(D),asyncRewake:F(D),shell:F(Be(`bash`,`powershell`)),timeout:F(qe),if:F(T),statusMessage:F(T),once:F(D)}),At=N({type:Be(`http`,`mcp_tool`,`prompt`,`agent`)}),jt=k(kt,At),U=N({matcher:F(T),hooks:S(jt)}),Mt=N({PreToolUse:j(S(U),{exact:!0,default:()=>[]}),PostToolUse:j(S(U),{exact:!0,default:()=>[]}),PostToolUseFailure:j(S(U),{exact:!0,default:()=>[]}),UserPromptSubmit:j(S(U),{exact:!0,default:()=>[]}),Stop:j(S(U),{exact:!0,default:()=>[]}),SessionStart:j(S(U),{exact:!0,default:()=>[]}),SessionEnd:j(S(U),{exact:!0,default:()=>[]}),PreCompact:j(S(U),{exact:!0,default:()=>[]}),PostCompact:j(S(U),{exact:!0,default:()=>[]})}),Nt=N({hooks:Mt,disableAllHooks:F(D)}),W=N({event:T,reason:T}),Pt=N({unrecognized:S(W),notCarried:S(W),matcherNotEvaluable:S(W),matcherOutOfReach:S(W),shadowed:S(W),disabled:S(W)}),Ft=N({...Mt.fields,disableAllHooks:F(D),hooks:F(Ke)}),It=et(Ft,Nt,{strict:!0,decode:({disableAllHooks:e,...t})=>ut(e===void 0?{hooks:t}:{hooks:t,disableAllHooks:e}),encode:(e,t,n)=>it(new Xe(n,e,`Decode-only`))}),Lt=k(Nt,It),Rt=A(Lt),zt=wt,Bt=M(C({key:T,value:E})),Vt=[],Ht=M(S(N({matcher:F(T),hooks:j(S(N({type:F(T)})),{exact:!0,default:()=>[]})})));function Ut(e){return l(Bt(e),e=>p(Bt(e.hooks),{onNone:()=>({namespace:e,outer:e,isWrapped:!1}),onSome:t=>({namespace:t,outer:e,isWrapped:!0})}))}const G=e=>e.replaceAll(/[\p{Cc}\p{Cf}]/gu,`�`),Wt={unrecognized:[],notCarried:[],matcherNotEvaluable:[],matcherOutOfReach:[],shadowed:[],disabled:[]},Gt=Ct,Kt=Tt,qt=Dt,Jt=Et,Yt=Ot,Xt=e=>n(Ht(e),()=>Vt).flatMap(e=>e.matcher===void 0?[]:[e.matcher]),Zt=e=>Xt(e).length>0,Qt=e=>z(e).pipe(V(`Reachable`,()=>v()),V(`Partial`,e=>o(e.reason)),V(`Unreachable`,e=>o(e.reason)),H);function $t(e){return p(Ut(e),{onNone:()=>Wt,onSome:({isWrapped:e,namespace:t,outer:n})=>{let r=[],i=[],a=[],o=[],s=[];for(let n of Object.keys(t)){if(!e&&n===`disableAllHooks`)continue;let s=Kt[n];if(s!==void 0){i.push({event:G(n),reason:s});continue}if(!Gt.includes(n)){r.push({event:G(n),reason:`not in this bridge's catalog (Claude Code hooks reference 2026-07-28)`});continue}let c=qt[n];c!==void 0&&Zt(t[n])&&a.push({event:G(n),reason:c});let l=Yt[n];l!==void 0&&o.push(...Xt(t[n]).flatMap(e=>{let t=l[e];return t===void 0?[]:p(Qt(t),{onNone:()=>[],onSome:t=>[{event:`${G(n)} (matcher "${G(e)}")`,reason:t}]})}))}if(e)for(let e of Object.keys(n))Gt.includes(e)&&s.push({event:G(e),reason:"ignored: this file wraps its hooks under `hooks`, so a group repeated at the top level is never read"});return{unrecognized:r,notCarried:i,matcherNotEvaluable:a,matcherOutOfReach:o,shadowed:s,disabled:[]}}})}function en(e){let t=e.find(e=>!e.managed&&e.settings.disableAllHooks===!0);if(t===void 0)return[];let n=`switched off by \`disableAllHooks\` in ${G(t.label)}`;return e.filter(e=>!e.managed).flatMap(e=>zt.filter(t=>e.settings.hooks[t].length>0).map(e=>({event:e,reason:n})))}function tn(e){return p(Ut(e),{onNone:()=>[],onSome:({namespace:e})=>{let t=new Set;for(let r of zt){let i=n(Ht(e[r]),()=>Vt);for(let e of i)for(let n of e.hooks)n.type!==void 0&&n.type!==`command`&&t.add(G(n.type))}return Array.from(t)}})}function nn(e){let t={PreToolUse:[],PostToolUse:[],PostToolUseFailure:[],UserPromptSubmit:[],SessionStart:[],SessionEnd:[],Stop:[],PreCompact:[],PostCompact:[]};if(e.some(e=>e.managed&&e.settings.disableAllHooks===!0))return{hooks:t};let n=e.some(e=>!e.managed&&e.settings.disableAllHooks===!0);for(let r of e)if(!(n&&!r.managed))for(let e of zt)t[e]=t[e].concat(Array.from(r.settings.hooks[e]));return{hooks:t}}k(O(`Merge`,{sources:L}),O(`Coverage`,{json:L}),O(`DisabledCoverage`,{sources:L}),O(`UnsupportedHookTypes`,{json:L}),O(`MatcherUnreadable`,{event:L}),O(`IfEvaluatingEvent`,{event:L}));function rn(e){return z(e).pipe(V(`Merge`,({sources:e})=>nn(e)),V(`Coverage`,({json:e})=>$t(e)),V(`DisabledCoverage`,({sources:e})=>en(e)),V(`UnsupportedHookTypes`,({json:e})=>tn(e)),V(`MatcherUnreadable`,({event:e})=>qt[e]!==void 0),V(`IfEvaluatingEvent`,({event:e})=>Jt.includes(e)),H)}function K(e,t){return lt(t)(rn(e))}const an=`/etc/claude-code/managed-settings.json`,q=(e,t)=>[`${e}/.claude/settings.json`,`${t}/.claude/settings.json`,`${t}/.claude/settings.local.json`,an];var on=class extends h(`CollectSettingsGapsExecutorDeps`)(){};const J=e=>e.filter((t,n)=>e.findIndex(e=>e.event===t.event)===n),sn=y(`collectSettingsGapsWithPaths`)(function*(e){let t=yield*at,n=[],r=[],i=[],a=[],o=[],s=[],c=[],l=[];for(let u of e){let e=yield*t.readFileString(u).pipe(Ae(()=>``));if(e===``)continue;let d=A(P(C({key:T,value:E})))(e);if(se(d)){l.push(u);continue}let f=K({_tag:`Coverage`,json:d.right},Pt);n.push(...f.unrecognized),r.push(...f.notCarried),i.push(...f.matcherNotEvaluable),a.push(...f.matcherOutOfReach),o.push(...f.shadowed),c.push(...K({_tag:`UnsupportedHookTypes`,json:d.right},S(T)));let p=Rt(d.right);se(p)?l.push(u):s.push({settings:p.right,managed:u===an,label:u})}return{coverage:{unrecognized:J(n),notCarried:J(r),matcherNotEvaluable:J(i),matcherOutOfReach:J(a),shadowed:J(o),disabled:J(K({_tag:`DisabledCoverage`,sources:s},S(W)))},unsupportedHookTypes:Array.from(new Set(c)),malformedFiles:Array.from(new Set(l))}});var cn=class extends h(`LoadSettingsExecutorDeps`)(){};const ln=y(`loadSettingsFile`)(function*(e){let t=yield*(yield*at).readFileString(e).pipe(Ae(()=>``));if(t===``)return null;let n=A(P(C({key:T,value:E})))(t);if(se(n))return null;let r=n.right,i=Rt(r);return se(i)?null:i.right}),Y=y(`loadSettingsWithPaths`)(function*(e,t=an){let n=[];for(let r of e){let e=yield*ln(r);e!==null&&n.push({settings:e,managed:r===t})}return n.length===0?null:K({_tag:`Merge`,sources:n},Nt)}),un=Symbol.for(`@effect/platform/CommandExecutor`),dn=Symbol.for(`@effect/platform/Process`),fn=We(),pn=We(),mn=ie(`@effect/platform/CommandExecutor`),hn=e=>{let t=t=>ze(b(e(t),e=>e.stdout)),n=(e,n)=>{let r=new TextDecoder(n);return He(Ue(t(e),u(e=>r.decode(e))))};return{[un]:un,start:e,exitCode:t=>je(Ne(e(t),e=>e.exitCode)),stream:t,string:(t,n=`utf-8`)=>{let r=new TextDecoder(n);return i(e(t),Ne(e=>Le(e.stdout,gn)),b(e=>r.decode(e)),je)},lines:(e,t=`utf-8`)=>i(n(e,t),tt,b(d)),streamLines:n}},gn=Ve(new Uint8Array,(e,t)=>ae(t,e,(e,t)=>{let n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n})),_n=Symbol.for(`@effect/platform/Command`),vn=e=>typeof e==`object`&&!!e&&_n in e,yn=_(e=>vn(e[0]),(e,n,r)=>{switch(e._tag){case`StandardCommand`:return X({...e,extendEnv:r?.extendEnv??e.extendEnv,env:t(e.env,le(Object.entries(n).filter(([,e])=>e!==void 0)))});case`PipedCommand`:return On(yn(e.left,n,r),yn(e.right,n,r))}}),bn=_(2,(e,t)=>An(e,Re(oe(new TextEncoder().encode(t))))),xn=e=>Array.from(Sn(e)),Sn=e=>{switch(e._tag){case`StandardCommand`:return oe(e);case`PipedCommand`:return re(Sn(e.left),Sn(e.right))}},Cn={[_n]:_n,pipe(){return ee(this,arguments)},...r},wn={...Cn,_tag:`StandardCommand`,toJSON(){return{_id:`@effect/platform/Command`,_tag:this._tag,command:this.command,args:this.args,env:Object.fromEntries(this.env),extendEnv:this.extendEnv,cwd:this.cwd.toJSON(),shell:this.shell,gid:this.gid.toJSON(),uid:this.uid.toJSON()}}},X=e=>Object.assign(Object.create(wn),e),Tn={...Cn,_tag:`PipedCommand`,toJSON(){return{_id:`@effect/platform/Command`,_tag:this._tag,left:this.left.toJSON(),right:this.right.toJSON()}}},En=e=>Object.assign(Object.create(Tn),e),Dn=(e,...t)=>X({command:e,args:t,env:ue(),extendEnv:!0,cwd:v(),shell:!1,stdin:`pipe`,stdout:`pipe`,stderr:`pipe`,gid:v(),uid:v()}),On=_(2,(e,t)=>En({left:e,right:t})),kn=_(2,(e,t)=>{switch(e._tag){case`StandardCommand`:return X({...e,stderr:t});case`PipedCommand`:return En({...e,right:kn(e.right,t)})}}),An=_(2,(e,t)=>{switch(e._tag){case`StandardCommand`:return X({...e,stdin:t});case`PipedCommand`:return En({...e,left:An(e.left,t)})}}),jn=_(2,(e,t)=>{switch(e._tag){case`StandardCommand`:return X({...e,stdout:t});case`PipedCommand`:return En({...e,right:jn(e.right,t)})}}),Mn=_(2,(e,t)=>{switch(e._tag){case`StandardCommand`:return X({...e,cwd:o(t)});case`PipedCommand`:return On(Mn(e.left,t),Mn(e.right,t))}}),Nn=yn,Pn=bn,Fn=xn,In=Dn,Ln=kn,Rn=An,zn=jn,Bn=Mn,Vn=mn,Hn=dn,Un=fn,Wn=pn,Gn=hn,Kn=(e,t,r)=>me(e,t).pipe(Ne(e=>Ce(e)),we(r.deadline),b(e=>n(e,r.onDeadline))),qn={UserPromptSubmit:30},Jn=(e,t)=>(e??qn[t]??600)*1e3,Yn=24e3,Xn=(e,t,n)=>{let r=Jn(e,t);return!n||r<=Yn?{timeoutMs:r,capNote:``}:{timeoutMs:Yn,capNote:` (capped from ${r}ms by the extension handler budget)`}},Zn={sh:[`sh`,`-c`],bash:[`bash`,`-c`],powershell:[`powershell`,`-Command`]},Qn=C({key:T,value:E}),$n=Qe(P(Qn));var er=class extends h(`RunHookScriptExecutorDeps`)(){};const Z=y(`runHookScript`)(function*(e,t,n,r,i=!0){let a=yield*Vn,{timeoutMs:o,capNote:s}=Xn(e.timeout,r,i),c=$n(t),[l,u]=Zn[e.shell??`sh`],d=(e.args===void 0?In(l,u,e.command):In(e.command,...e.args)).pipe(Bn(n),Nn({OMP_PROJECT_DIR:n,CLAUDE_PROJECT_DIR:n}),Pn(c),zn(`pipe`),Ln(`pipe`)),f=yield*er,p=je(ye(e=>x(function*(){let t=yield*a.start(d);yield*be(()=>Te(t.kill(`SIGKILL`)).pipe(xe(2e3),De));let[n,r,i]=yield*e(Oe([t.stdout.pipe(Ge(),nt),t.stderr.pipe(Ge(),nt),t.exitCode.pipe(b(Number),Ae(()=>-1))],{concurrency:`unbounded`}));return{code:i,stdout:n,stderr:r}}))).pipe(Me(t=>ge(`hook ${e.command} failed`,t)));return yield*Kn(p,f,{deadline:o,onDeadline:()=>({code:-1,stdout:``,stderr:`timeout after ${o}ms${s}`})})}),tr=N({code:qe,stdout:T,stderr:T});var nr=class extends w()(`Block`,{reason:T}){},rr=class extends w()(`Allow`,{updatedInput:F(C({key:T,value:E}))}){},ir=class extends w()(`Warning`,{message:T}){};k(nr,rr,ir);var ar=class extends w()(`Blocked`,{reason:T}){},or=class extends w()(`Continue`,{warning:F(T),updatedInput:F(C({key:T,value:E}))}){};k(ar,or);const sr=N({decision:F(T),reason:F(T),hookSpecificOutput:F(N({permissionDecision:F(T),permissionDecisionReason:F(T),updatedInput:F(C({key:T,value:E})),additionalContext:F(T)}))}),cr=et(T,sr,{strict:!0,decode:e=>_e(Ie(P(sr))(e),e=>e.issue),encode:(e,t,n)=>it(new Xe(n,e,`Decode-only: hook stdout is never encoded`))}),lr=A(cr),ur=Symbol.for(`@systemfsoftware/omp-claude-compat/InterpretHookCommand`);var dr=class extends w()(`InterpretHookCommand`,{result:tr,event:T}){[ur]=ur};const fr=Symbol.for(`@systemfsoftware/omp-claude-compat/HookVerdictError`);var pr=class extends Je()(`HookVerdictError`,{raw:T}){[fr]=fr};const Q=Symbol.for(`@systemfsoftware/omp-claude-compat/ExitKind`);var mr=class extends w()(`ExitBlock`,{}){[Q]=Q},hr=class extends w()(`ExitDecisionJson`,{}){[Q]=Q},gr=class extends w()(`ExitNoDecision`,{}){[Q]=Q},_r=class extends w()(`ExitOther`,{}){[Q]=Q};k(mr,hr,gr,_r);const vr=e=>a(e=>e.startsWith(`{`))(e.trim()),yr=e=>z(vr(e)).pipe(V(`Some`,()=>new hr({})),V(`None`,()=>new gr({})),H),br={0:e=>yr(e.stdout),2:()=>new mr({})},xr=e=>z(te(br[e.code])).pipe(V(`Some`,t=>t.value(e)),V(`None`,()=>new _r({})),H),Sr=e=>a(e=>e!==``)(e.trim()),Cr=(e,t)=>z(Sr(e)).pipe(V(`Some`,e=>e.value),V(`None`,()=>`Blocked by ${t} hook`),H),wr={deny:(e,t)=>e.hookSpecificOutput?.permissionDecisionReason??`Blocked by ${t} hook`,block:(e,t)=>e.reason??`Blocked by ${t} hook`},Tr=(e,t)=>z(te(e.hookSpecificOutput?.permissionDecision??e.decision).pipe(ce(e=>wr[e]))).pipe(V(`Some`,n=>new nr({reason:n.value(e,t)})),V(`None`,()=>new rr({updatedInput:e.hookSpecificOutput?.updatedInput})),H),Er=e=>z(Sr(e)).pipe(V(`Some`,e=>new ir({message:e.value})),V(`None`,()=>new rr({})),H),Dr=t=>z(xr(t.result)).pipe(V(`ExitBlock`,()=>g(new nr({reason:Cr(t.result.stderr,t.event)}))),V(`ExitNoDecision`,()=>g(new rr({}))),V(`ExitDecisionJson`,()=>e(lr(t.result.stdout),{onLeft:()=>ne(new pr({raw:t.result.stdout})),onRight:e=>g(Tr(e,t.event))})),V(`ExitOther`,()=>g(Er(t.result.stderr))),H),Or={},kr=C({key:T,value:E}),Ar=M(kr),jr=Ee([]);h(`@systemfsoftware/omp-claude-compat/AsyncHookContextState`)();function Mr(e){let t=e.trim();t.length!==0&&de(he(jr,e=>e.length>=64?[...e.slice(1),t]:[...e,t]))}function Nr(){return de(pe(jr,[]))}var Pr=class extends h(`SuperviseForkExecutorDeps`)(){};const Fr=(e,t,n)=>e.pipe(fe({onSuccess:e=>{let t=lr(e.stdout);if(s(t)){let e=t.right.hookSpecificOutput?.additionalContext;e!==void 0&&Mr(e)}},onFailure:e=>{Pe(e)||t.ui.notify(`Background hook failed: ${n}: ${Fe(e).split(`
|
|
2
|
-
`)[0]}`,`error`)}}));var Ir=class extends h(`RunHooksForEventExecutorDeps`)(){};const Lr=y(`runHooksForEventUnbounded`)(function*(t,r,i,a,s){let c=a.cwd,l=n(Ar(i.tool_input),()=>Or),u,d=i,p=K({_tag:`MatcherUnreadable`,event:s},D);for(let n of t)if(!(p&&n.matcher!==void 0)&&ot(r,n.matcher))for(let t of n.hooks){if(t.type!==`command`||t.if!==void 0&&(!K({_tag:`IfEvaluatingEvent`,event:s},D)||!ct(t.if,r,l,c)))continue;if(t.async===!0||t.asyncRewake===!0){yield*ve(Fr(Z(t,d,c,s,!1),a,t.command));continue}let n=yield*Z(t,d,c,s),i=Dr(new dr({result:n,event:s})),p=e(i,{onLeft:e=>z(e).pipe(V(`HookVerdictError`,e=>new ir({message:`Hook exited 0 but produced invalid JSON: ${e.raw.slice(0,200)}`})),H),onRight:e=>e}),ee=z(p).pipe(V(`Block`,e=>new ar({reason:e.reason})),V(`Warning`,e=>new or({warning:e.message})),V(`Allow`,e=>new or({updatedInput:e.updatedInput})),H),m=z(ee).pipe(V(`Blocked`,e=>o({block:!0,reason:e.reason})),V(`Continue`,e=>(e.warning!==void 0&&u===void 0&&(u=e.warning),e.updatedInput!==void 0&&(d={...d,...e.updatedInput}),v())),H);if(f(m))return m.value}return{...d===i?{}:{updatedInput:d},...u===void 0?{}:{warning:u}}}),$=y(`runHooksForEvent`)(function*(e,t,n,r,i){return yield*Lr(e,t,n,r,i).pipe(xe(26e3),Se(`TimeoutException`,()=>ke({})))});var Rr=class extends h(`RunLifecycleHooksExecutorDeps`)(){};const zr=y(`runLifecycleHooks`)(function*(e,t,n){if(e.length===0)return;let r=t.cwd,i={...I(()=>t.sessionManager.getSessionId())},a=K({_tag:`MatcherUnreadable`,event:n},D);for(let o of e)if(!(a&&o.matcher!==void 0))for(let e of o.hooks)e.type===`command`&&e.if===void 0&&(e.async===!0||e.asyncRewake===!0?yield*ve(Fr(Z(e,i,r,n,!1),t,e.command)):yield*Z(e,i,r,n))}),Br=e=>e.reason===void 0?{}:{warning:e.reason};var Vr=class extends h(`RunPostToolUseFailureHooksExecutorDeps`)(){};const Hr=M(S(N({text:F(T)}))),Ur=M(T),Wr=e=>p(Hr(e),{onSome:e=>e.flatMap(e=>e.text===void 0?[]:[e.text]).join(`
|
|
3
|
-
`),onNone:()=>n(Ur(e),()=>``)}),Gr=y(`runPostToolUseFailureHooks`)(function*(e,t,r){let i=rt(t.toolName),a=Ze(i,n(Ar(t.input),()=>Or)),o={...I(()=>r.sessionManager.getSessionId()),tool_name:i,tool_input:a,tool_use_id:t.toolCallId,error:Wr(t.content)},s=yield*$(e.hooks.PostToolUseFailure,i,o,r,`PostToolUseFailure`);return s.block===!0?Br(s):s});var Kr=class extends h(`RunPostToolUseHooksExecutorDeps`)(){};const qr=y(`runPostToolUseHooks`)(function*(e,t,r){let i=rt(t.toolName),a=I(()=>r.sessionManager.getSessionId()),o=Ze(i,n(Ar(t.input),()=>Or)),s=$e(i,o),c=s.length===0?[o]:s.map(e=>({...o,file_path:e})),l,u={};for(let n of c){let o={...a,tool_name:i,tool_input:n,tool_call_id:t.toolCallId,output:t.content,is_error:t.isError??!1},s=yield*$(e.hooks.PostToolUse,i,o,r,`PostToolUse`);if(s.block===!0)return Br(s);l===void 0&&(l=s.warning),u=s}return l===void 0?u:{...u,warning:l}});var Jr=class extends h(`RunPreCompactHooksExecutorDeps`)(){};const Yr=y(`runPreCompactHooks`)(function*(e,t){let n={...I(()=>t.sessionManager.getSessionId())};return yield*$(e.hooks.PreCompact,``,n,t,`PreCompact`)});var Xr=class extends h(`RunPreToolUseHooksExecutorDeps`)(){};const Zr=y(`runPreToolUseHooks`)(function*(e,t,r){let i=rt(t.toolName),a=I(()=>r.sessionManager.getSessionId()),o=n(Ar(t.input),()=>Or),s=Ze(i,o),c=Ye(t.toolName,o);if(c!==void 0&&c.length>0){let n={...a,tool_name:`Bash`,tool_input:{command:c},tool_call_id:t.toolCallId},i=yield*$(e.hooks.PreToolUse,`Bash`,n,r,`PreToolUse`);if(i.block===!0)return i.reason===void 0?{block:!0}:{block:!0,reason:i.reason}}let l=$e(i,s),u=l.length===0?[s]:l.map(e=>({...s,file_path:e})),d={};for(let n of u){let o={...a,tool_name:i,tool_input:n,tool_call_id:t.toolCallId},s=yield*$(e.hooks.PreToolUse,i,o,r,`PreToolUse`);if(s.block===!0)return s.reason===void 0?{block:!0}:{block:!0,reason:s.reason};d=s}let f=u.length===1?d.updatedInput?.tool_input:void 0;Object.assign(t.input,st(o,f))});var Qr=class extends h(`RunSessionStartHooksExecutorDeps`)(){};const $r=y(`runSessionStartHooks`)(function*(e,t,n){let r=e.hooks.SessionStart;if(r.length===0)return;let i=n.cwd,a={...I(()=>n.sessionManager.getSessionId()),reason:t};for(let e of r)if(!(e.matcher!==void 0&&!ot(t,e.matcher))){for(let t of e.hooks)if(t.type===`command`&&t.if===void 0){if(t.async===!0||t.asyncRewake===!0){yield*ve(Fr(Z(t,a,i,`SessionStart`,!1),n,t.command));continue}yield*Z(t,a,i,`SessionStart`)}}});var ei=class extends h(`RunSessionSwitchHooksExecutorDeps`)(){};const ti=y(`runSessionSwitchHooks`)(function*(e,t,n){(t===`resume`||t===`fork`)&&(yield*$r(e,t,n))});var ni=class extends h(`RunToolResultHooksExecutorDeps`)(){};const ri=y(`runToolResultHooks`)(function*(e,t,n){return t.isError===!0?yield*Gr(e,t,n):yield*qr(e,t,n)}),ii=[`/`,`!`,`->`,`=>`,`$ `,`$ `,`$
|
|
4
|
-
`,`$\r`,`$$ `,`$$ `,`$$
|
|
5
|
-
`,`$$\r`],ai=e=>ii.some(t=>`${e.trimStart()} `.startsWith(t));var oi=class extends h(`RunUserPromptSubmitHooksExecutorDeps`)(){};const si=y(`runUserPromptSubmitHooks`)(function*(t,n,r){let i=t.hooks.UserPromptSubmit,a=r.cwd,o=ai(n.text),s=z(o).pipe(B(!0,()=>[]),B(!1,()=>Nr()),H),c=[],l={...I(()=>r.sessionManager.getSessionId()),prompt:n.text,source:n.source};for(let t of i)for(let n of t.hooks){if(n.type!==`command`||n.if!==void 0)continue;let t=yield*Z(n,l,a,`UserPromptSubmit`),i=e(Dr(new dr({result:t,event:`UserPromptSubmit`})),{onLeft:()=>void 0,onRight:e=>z(e).pipe(V(`Block`,e=>e.reason),St(()=>void 0))});if(i!==void 0)return r.ui.notify(`Prompt blocked by UserPromptSubmit hook: ${i}`,`error`),{handled:!0};if(t.code!==0)continue;let o=t.stdout.trim();o.length>0&&c.push(o)}return z(o).pipe(B(!0,()=>void 0),B(!1,()=>{let e=[...s,...c].join(`
|
|
6
|
-
|
|
7
|
-
`);if(e.length===0)return;let t={text:`${e}\n\n${n.text}`};return n.images!==void 0&&(t.images=n.images),t}),H)});var ci=class extends h(`HookDispatcherExecutorDeps`)(){};const li=e=>x(function*(){return yield*z(e).pipe(V(`ToolCall`,({event:e,ctx:t})=>x(function*(){let n=yield*Y(q(R(),t.cwd));if(n)return yield*Zr(n,e,t)})),V(`ToolResult`,({event:e,ctx:t})=>x(function*(){let n=yield*Y(q(R(),t.cwd));if(!n)return;let r=yield*ri(n,e,t);if(r.warning!==void 0)return{content:[...e.content,{type:`text`,text:r.warning}],isError:e.isError}})),V(`Prompt`,({event:e,ctx:t})=>x(function*(){let n=yield*Y(q(R(),t.cwd));if(n)return yield*si(n,e,t)})),V(`SessionStart`,({reason:e,ctx:t})=>x(function*(){let n=yield*sn(q(R(),t.cwd)),r=[...n.coverage.unrecognized.map(e=>` ${e.event}: ${e.reason}`),...n.coverage.notCarried.map(e=>` ${e.event}: not carried by this bridge — ${e.reason}`),...n.coverage.matcherNotEvaluable.map(e=>` ${e.event}: hook skipped, matcher not evaluable — ${e.reason}`),...n.coverage.matcherOutOfReach.map(e=>` ${e.event}: ${e.reason}`),...n.coverage.shadowed.map(e=>` ${e.event}: ${e.reason}`),...n.coverage.disabled.map(e=>` ${e.event}: ${e.reason}`)];r.length>0&&t.ui.notify(`Hook coverage — configured hooks this bridge will not run:\n${r.join(`
|
|
8
|
-
`)}`,`warning`),n.unsupportedHookTypes.length>0&&t.ui.notify(`Skipping hook(s) this bridge cannot run yet: type ${n.unsupportedHookTypes.join(`, `)}`,`warning`),n.malformedFiles.length>0&&t.ui.notify(`Hooks are NOT running from malformed settings file(s): ${n.malformedFiles.join(`, `)}`,`error`);let i=yield*Y(q(R(),t.cwd));i&&(yield*$r(i,e,t))})),V(`SessionCompact`,({ctx:e})=>x(function*(){let t=yield*Y(q(R(),e.cwd));t&&(yield*$r(t,`compact`,e),yield*zr(t.hooks.PostCompact,e,`PostCompact`))})),V(`PreCompact`,({ctx:e})=>x(function*(){let t=yield*Y(q(R(),e.cwd));if(!t)return;let n=yield*Yr(t,e);if(n.block===!0)return e.ui.notify(`Compaction cancelled by a PreCompact hook: ${n.reason??`no reason given`}`,`warning`),{cancel:!0}})),V(`SessionSwitch`,({reason:e,ctx:t})=>x(function*(){let n=yield*Y(q(R(),t.cwd));n&&(yield*ti(n,e,t))})),V(`SessionShutdown`,({ctx:e})=>x(function*(){let t=yield*Y(q(R(),e.cwd));t&&(yield*zr(t.hooks.SessionEnd,e,`SessionEnd`))})),V(`SessionStop`,({ctx:e})=>x(function*(){let t=yield*Y(q(R(),e.cwd));t&&(yield*zr(t.hooks.Stop,e,`Stop`))})),H)});export{on as C,cn as S,Wn as _,ei as a,Fn as b,Jr as c,Rr as d,Ir as f,Un as g,Vn as h,ni as i,Kr as l,er as m,li as n,Qr as o,Pr as p,oi as r,Xr as s,ci as t,Vr as u,Hn as v,Rn as x,Gn as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{As as e,qs as t}from"./core-CG9iBVjE.js";import{O as n,ft as r,h as i}from"./Effect-C1HfHpDW.js";import{n as a}from"./hook-dispatcher.executor-B43vD5qz.js";const o=(o,s)=>{async function c(o){let c=n(function*(){let e=yield*i(a(o));if(t(e))throw e.left;return e.right}).pipe(r(28e3));return e(await s.runSafe(c))}o.on(`tool_call`,(e,t)=>c({_tag:`ToolCall`,event:e,ctx:t})),o.on(`tool_result`,(e,t)=>c({_tag:`ToolResult`,event:e,ctx:t})),o.on(`input`,(e,t)=>c({_tag:`Prompt`,event:e,ctx:t})),o.on(`session_start`,(e,t)=>c({_tag:`SessionStart`,reason:`startup`,ctx:t})),o.on(`session_compact`,(e,t)=>c({_tag:`SessionCompact`,ctx:t})),o.on(`session_before_compact`,(e,t)=>c({_tag:`PreCompact`,ctx:t})),o.on(`session_switch`,(e,t)=>c({_tag:`SessionSwitch`,reason:e.reason,ctx:t})),o.on(`session_shutdown`,(e,t)=>c({_tag:`SessionShutdown`,ctx:t})),o.on(`session_stop`,(e,t)=>c({_tag:`SessionStop`,ctx:t}))};export{o as HookDispatcherTask};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Cs as e,Ds as t,Ec as n,El as r,Er as i,Hs as a,Io as o,Kt as s,Lr as c,Ls as l,Rs as u,Sl as d,Tc as ee,Tl as te,Ts as f,Ui as ne,mr as re,mt as ie,vn as ae,wr as oe,yn as se,zs as ce}from"./core-CG9iBVjE.js";import{$t as p,Bt as m,Fn as le,G as h,H as ue,Ht as de,I as g,It as _,Jt as fe,K as v,Lt as pe,O as me,Qt as y,Rt as he,St as ge,T as _e,Tn as ve,U as ye,Xt as be,Yt as xe,Zt as Se,_n as Ce,an as we,at as Te,c as Ee,ct as b,en as De,g as Oe,gn as ke,ht as Ae,in as je,k as Me,l as x,lt as Ne,mt as Pe,n as S,nn as Fe,on as Ie,ot as C,p as Le,pn as Re,r as w,rn as ze,rt as Be,sn as Ve,st as T,tn as E,tt as D,v as O,vt as He,wt as k,x as A,xn as Ue,yt as We,zt as Ge}from"./Effect-C1HfHpDW.js";import{i as Ke,p as qe}from"./Exit-DWkYikJN.js";import{A as Je,C as j,E as Ye,F as Xe,I as Ze,N as Qe,P as $e,R as et,S as tt,_ as nt,_t as rt,b as it,bt as M,d as at,dt as ot,f as st,ft as ct,g as N,gt as lt,h as P,ht as ut,m as F,mt as dt,n as ft,p as pt,pt as I,t as mt,v as ht,vt as L,w as gt,x as _t,xt as R,y as vt,yt}from"./dist-CJoMkiK8.js";import{C as bt,S as xt,_ as St,a as Ct,b as wt,c as Tt,d as Et,f as Dt,g as Ot,h as kt,i as At,l as jt,m as Mt,o as Nt,p as Pt,r as Ft,s as It,t as Lt,u as Rt,v as z,x as B,y as zt}from"./hook-dispatcher.executor-B43vD5qz.js";import{t as Bt}from"./inject-instructions.executor-C5AgD0Hh.js";import*as Vt from"node:os";import*as V from"node:child_process";import*as Ht from"node:crypto";import*as H from"node:fs";import*as U from"node:path";function W(e,t){return ae(e.runtimeEffect,e=>c(n=>(n.setFiberRefs(e.fiberRefs),n.currentRuntimeFlags=e.runtimeFlags,re(t,e.context))))}const Ut={...le,[Re]:Re,pipe(){return ee(this,arguments)},commit(){return this.runtimeEffect}},Wt=(e,t)=>{t??=xe();let n=we(Ue()),r,a=oe(()=>{if(!r){let a=new ve;r=y(i(Ce(fe(e,t),n),e=>{o.cachedRuntime=e}),{scope:n,scheduler:a}),a.flush()}return se(r.await)}),o=Object.assign(Object.create(Ut),{memoMap:t,scope:n,runtimeEffect:a,cachedRuntime:void 0,runtime(){return o.cachedRuntime===void 0?E(o.runtimeEffect):Promise.resolve(o.cachedRuntime)},dispose(){return E(o.disposeEffect)},disposeEffect:oe(()=>(o.runtimeEffect=ie(`ManagedRuntime disposed`),o.cachedRuntime=void 0,ke(o.scope,s))),runFork(e,t){return o.cachedRuntime===void 0?y(W(o,e),t):Se(o.cachedRuntime)(e,t)},runSyncExit(e){return o.cachedRuntime===void 0?Ve(W(o,e)):Ie(o.cachedRuntime)(e)},runSync(e){return o.cachedRuntime===void 0?we(W(o,e)):je(o.cachedRuntime)(e)},runPromiseExit(e,t){return o.cachedRuntime===void 0?ze(W(o,e),t):Fe(o.cachedRuntime)(e,t)},runCallback(e,t){return o.cachedRuntime===void 0?p(be)(W(o,e),t):p(o.cachedRuntime)(e,t)},runPromise(e,t){return o.cachedRuntime===void 0?E(W(o,e),t):De(o.cachedRuntime)(e,t)}});return o},G=(e,t,n)=>(...r)=>x(i=>{try{e(...r,(e,n)=>{i(e?O(t?t(e,r):e):C(n))})}catch(e){i(n?O(n(e,r)):Le(e))}}),K=(e,t)=>(n,[r])=>{let i=`Unknown`;switch(n.code){case`ENOENT`:i=`NotFound`;break;case`EACCES`:i=`PermissionDenied`;break;case`EEXIST`:i=`AlreadyExists`;break;case`EISDIR`:i=`BadResource`;break;case`ENOTDIR`:i=`BadResource`;break;case`EBUSY`:i=`Busy`;break;case`ELOOP`:i=`BadResource`}return new j({reason:i,module:e,method:t,pathOrDescriptor:r,syscall:n.syscall,description:n.message,cause:n})},Gt=(e,t,n)=>Ye(Kt(e,t,n)),Kt=(e,t,n)=>ut(()=>Yt(e(),t,ne(void 0),n)),qt=(e,t,{encoding:n,endOnDone:r=!0}={},i=S)=>{let a=Jt(e,n),o=r?x(t=>{`closed`in e&&e.closed?t(S):(e.once(`finish`,()=>t(S)),e.end())}):S;return{awaitRead:()=>S,emit:a,error:e=>k(o,t(e)),done:e=>k(o,i)}},Jt=(e,t)=>n=>n.length===0?S:x(r=>{let i=n[Symbol.iterator](),a=i.next();function o(){let n=a;a=i.next();let s=e.write(n.value,t);a.done?r(S):s?o():e.once(`drain`,o)}o()}),Yt=(e,t,n,r)=>{if(!e.readable)return lt;let i=He(!1);function a(){i.unsafeOpen()}function s(e){n.current=Ke(t(e)),i.unsafeOpen()}function c(){n.current=qe,i.unsafeOpen()}e.on(`readable`,a),e.on(`error`,s),e.on(`end`,c);let l=r?.chunkSize?Number(r.chunkSize):void 0,u=ut(function t(){let r=e.read(l);if(r===null)return n.current?dt(n.current):(i.unsafeClose(),I(i.await,t));let a=[r];for(;;){if(r=e.read(l),r===null)return I(rt(o(a)),t);a.push(r)}});return ct(u,b(()=>{e.off(`readable`,a),e.off(`error`,s),e.off(`end`,c),r?.closeOnDone!==!1&&`closed`in e&&!e.closed&&e.destroy()}))},Xt=(e,t,n)=>et(Zt(e,t,n)),Zt=(e,t,n)=>I(ge(b(()=>e()),m()),([e,r])=>ot(Qt(e,r,t),qt(e,e=>he(r,e),n,pe(r,S)))),Qt=(e,t,n)=>T(()=>{function r(e){de(t,O(n(e)))}return e.on(`error`,r),Oe(_(t),b(()=>{e.removeListener(`error`,r)}))}),$t=e=>typeof e==`string`?e:`pipe`,en=e=>typeof e==`string`?e:`pipe`,q=e=>e instanceof globalThis.Error?e:new globalThis.Error(String(e)),J=(e,t,n)=>{let r=wt(n).reduce((e,t)=>{let n=`${t.command} ${t.args.join(` `)}`;return e.length===0?n:`${e} | ${n}`},``);return K(`Command`,e)(t,[r])},tn={[z]:z,...n,toJSON(){return{_id:`@effect/platform/CommandExecutor/Process`,pid:this.pid}}},Y=e=>n=>{switch(n._tag){case`StandardCommand`:{let i=A(m(),e=>x(r=>{let i=V.spawn(n.command,n.args,{stdio:[$t(n.stdin),en(n.stdout),en(n.stderr)],cwd:t(n.cwd,d),shell:n.shell,env:n.extendEnv?{...process.env,...Object.fromEntries(n.env)}:Object.fromEntries(n.env),detached:process.platform!==`win32`});return i.on(`error`,e=>{r(O(J(`spawn`,e,n)))}),i.on(`exit`,(...t)=>{de(e,C(t))}),i.on(`spawn`,()=>{r(C([i,e]))}),b(()=>{i.kill(`SIGTERM`)})})),a=process.platform===`win32`?(e,t)=>x(t=>{V.exec(`taskkill /pid ${e.pid} /T /F`,e=>{t(e?O(J(`kill`,q(e),n)):S)})}):(e,t)=>Ae({try:()=>process.kill(-e.pid,t),catch:e=>J(`kill`,q(e),n)}),o=(e,t)=>T(()=>e.kill(t)?S:O(J(`kill`,new globalThis.Error(`Failed to kill process`),n)));return r(u(n.cwd,{onNone:()=>S,onSome:t=>e.access(t)}),k(w(i,([e,t])=>A(Ge(t),n=>n?A(_(t),([t])=>t!==0&&t!==null?a(e,`SIGTERM`).pipe(Me):S):a(e,`SIGTERM`).pipe(v(()=>o(e,`SIGTERM`)),k(_(t)),Me)))),g(([e,t])=>{let r=Ze;e.stdin!==null&&(r=Xt(()=>e.stdin,e=>J(`toWritable`,q(e),n)));let i=A(_(t),([e,t])=>e===null?O(J(`exitCode`,new globalThis.Error(`Process interrupted due to receipt of signal: ${t}`),n)):C(Ot(e))),s=ye(Ge(t)),c=(n=`SIGTERM`)=>a(e,n).pipe(v(()=>o(e,n)),k(Ee(_(t)))),l=St(e.pid),u=Gt(()=>e.stderr,e=>J(`fromReadable(stderr)`,q(e),n)),d=Gt(()=>e.stdout,e=>J(`fromReadable(stdout)`,q(e),n));return typeof n.stdout!=`string`&&(d=Qe(d,n.stdout)),Object.assign(Object.create(tn),{pid:l,exitCode:i,isRunning:s,kill:c,stdin:r,stderr:u,stdout:d})}),typeof n.stdin==`string`?te:Ne(e=>_e(Je(n.stdin,e.stdin))))}case`PipedCommand`:{let t=wt(n);if(t.length===1)return r(t[0],Y(e));let i=t[0],a=t.slice(1),o=a.slice(0,a.length-1),s=a[a.length-1],c=o.reduce((t,n)=>r(B(n,t),Y(e),g(e=>e.stdout),Xe),r(Y(e)(i),g(e=>e.stdout),Xe));return r(B(s,c),Y(e))}}},nn=L(kt,r(F,g(e=>zt(Y(e))))),X=e=>t=>new tt({module:`FileSystem`,method:e,cause:t}),rn=(()=>{let e=G(H.access,K(`FileSystem`,`access`),X(`access`));return(t,n)=>{let r=H.constants.F_OK;return n?.readable&&(r|=H.constants.R_OK),n?.writable&&(r|=H.constants.W_OK),e(t,r)}})(),an=(()=>{let e=G(H.cp,K(`FileSystem`,`copy`),X(`copy`));return(t,n,r)=>e(t,n,{force:r?.overwrite??!1,preserveTimestamps:r?.preserveTimestamps??!1,recursive:!0})})(),on=(()=>{let e=G(H.copyFile,K(`FileSystem`,`copyFile`),X(`copyFile`));return(t,n)=>e(t,n)})(),sn=(()=>{let e=G(H.chmod,K(`FileSystem`,`chmod`),X(`chmod`));return(t,n)=>e(t,n)})(),cn=(()=>{let e=G(H.chown,K(`FileSystem`,`chown`),X(`chown`));return(t,n,r)=>e(t,n,r)})(),ln=(()=>{let e=G(H.link,K(`FileSystem`,`link`),X(`link`));return(t,n)=>e(t,n)})(),un=(()=>{let e=G(H.mkdir,K(`FileSystem`,`makeDirectory`),X(`makeDirectory`));return(t,n)=>e(t,{recursive:n?.recursive??!1,mode:n?.mode})})(),Z=e=>{let t=G(H.mkdtemp,K(`FileSystem`,e),X(e));return e=>T(()=>{let n=e?.prefix??``,r=typeof e?.directory==`string`?U.join(e.directory,`.`):Vt.tmpdir();return t(n?U.join(r,n):r+`/`)})},dn=Z(`makeTempDirectory`),Q=e=>{let t=G(H.rm,K(`FileSystem`,e),X(e));return(e,n)=>t(e,{recursive:n?.recursive??!1,force:n?.force??!1})},fn=Q(`remove`),pn=(()=>{let e=Z(`makeTempDirectoryScoped`),t=Q(`makeTempDirectoryScoped`);return n=>w(e(n),e=>h(t(e,{recursive:!0})))})(),mn=e=>{let t=G(H.open,K(`FileSystem`,e),X(e)),n=G(H.close,K(`FileSystem`,e),X(e));return(e,i)=>r(w(t(e,i?.flag??`r`,i?.mode),e=>h(n(e))),g(e=>gn(pt(e),i?.flag?.startsWith(`a`)??!1)))},hn=mn(`open`),gn=(()=>{let e=e=>G(H.read,K(`FileSystem`,e),X(e)),t=e(`read`),n=e(`readAlloc`),r=G(H.fstat,K(`FileSystem`,`stat`),X(`stat`)),i=G(H.ftruncate,K(`FileSystem`,`truncate`),X(`truncate`)),o=G(H.fsync,K(`FileSystem`,`sync`),X(`sync`)),s=e=>G(H.write,K(`FileSystem`,e),X(e)),c=s(`write`),l=s(`writeAll`);class u{fd;append;[P];semaphore=We(1);position=0n;constructor(e,t){this.fd=e,this.append=t,this[P]=P}get stat(){return g(r(this.fd),Tn)}get sync(){return o(this.fd)}seek(e,t){let n=N(e);return this.semaphore.withPermits(1)(b(()=>(t===`start`?this.position=n:t===`current`&&(this.position+=n),this.position)))}read(e){return this.semaphore.withPermits(1)(g(T(()=>t(this.fd,{buffer:e,position:this.position})),e=>{let t=N(e);return this.position+=t,t}))}readAlloc(e){let t=Number(e);return this.semaphore.withPermits(1)(A(b(()=>Buffer.allocUnsafeSlow(t)),e=>g(n(this.fd,{buffer:e,position:this.position}),n=>{if(n===0)return ce();if(this.position+=BigInt(n),n===t)return a(e);let r=Buffer.allocUnsafeSlow(n);return e.copy(r,0,0,n),a(r)})))}truncate(e){return this.semaphore.withPermits(1)(g(i(this.fd,e?Number(e):void 0),()=>{if(!this.append){let t=BigInt(e??0);this.position>t&&(this.position=t)}}))}write(e){return this.semaphore.withPermits(1)(g(T(()=>c(this.fd,e,void 0,void 0,this.append?void 0:Number(this.position))),e=>{let t=N(e);return this.append||(this.position+=t),t}))}writeAllChunk(e){return A(T(()=>l(this.fd,e,void 0,void 0,this.append?void 0:Number(this.position))),t=>t===0?O(new j({module:`FileSystem`,method:`writeAll`,reason:`WriteZero`,pathOrDescriptor:this.fd,description:`write returned 0 bytes written`})):(this.append||(this.position+=BigInt(t)),t<e.length?this.writeAllChunk(e.subarray(t)):S))}writeAll(e){return this.semaphore.withPermits(1)(this.writeAllChunk(e))}}return(e,t)=>new u(e,t)})(),_n=e=>{let t=Z(e),n=mn(e),i=e=>b(()=>Ht.randomBytes(e).toString(`hex`));return e=>r(ge(t(e),i(6)),g(([t,n])=>U.join(t,n+(e?.suffix??``))),Ne(e=>Be(n(e,{flag:`w+`}))))},vn=_n(`makeTempFile`),yn=(()=>{let e=_n(`makeTempFileScoped`),t=Q(`makeTempFileScoped`);return n=>w(e(n),e=>h(t(U.dirname(e),{recursive:!0})))})(),bn=(e,t)=>Pe({try:()=>H.promises.readdir(e,t),catch:t=>K(`FileSystem`,`readDirectory`)(t,[e])}),xn=e=>x((t,n)=>{try{H.readFile(e,{signal:n},(n,r)=>{t(n?O(K(`FileSystem`,`readFile`)(n,[e])):C(r))})}catch(e){t(O(X(`readFile`)(e)))}}),Sn=(()=>{let e=G(H.readlink,K(`FileSystem`,`readLink`),X(`readLink`));return t=>e(t)})(),Cn=(()=>{let e=G(H.realpath,K(`FileSystem`,`realPath`),X(`realPath`));return t=>e(t)})(),wn=(()=>{let e=G(H.rename,K(`FileSystem`,`rename`),X(`rename`));return(t,n)=>e(t,n)})(),Tn=e=>({type:e.isFile()?`File`:e.isDirectory()?`Directory`:e.isSymbolicLink()?`SymbolicLink`:e.isBlockDevice()?`BlockDevice`:e.isCharacterDevice()?`CharacterDevice`:e.isFIFO()?`FIFO`:e.isSocket()?`Socket`:`Unknown`,mtime:f(e.mtime),atime:f(e.atime),birthtime:f(e.birthtime),dev:e.dev,rdev:f(e.rdev),ino:f(e.ino),mode:e.mode,nlink:f(e.nlink),uid:f(e.uid),gid:f(e.gid),size:N(e.size),blksize:l(f(e.blksize),N),blocks:f(e.blocks)}),$=(()=>{let e=G(H.stat,K(`FileSystem`,`stat`),X(`stat`));return t=>g(e(t),Tn)})(),En=(()=>{let e=G(H.symlink,K(`FileSystem`,`symlink`),X(`symlink`));return(t,n)=>e(t,n)})(),Dn=(()=>{let e=G(H.truncate,K(`FileSystem`,`truncate`),X(`truncate`));return(t,n)=>e(t,n===void 0?void 0:Number(n))})(),On=(()=>{let e=G(H.utimes,K(`FileSystem`,`utime`),X(`utime`));return(t,n,r)=>e(t,n,r)})(),kn=(e,t)=>gt(n=>w(b(()=>{let r=H.watch(e,{recursive:t?.recursive},(e,t)=>{if(t)switch(e){case`rename`:n.fromEffect(ue($(t),{onSuccess:e=>C(ht({path:t})),onFailure:e=>e._tag===`SystemError`&&e.reason===`NotFound`?C(vt({path:t})):O(e)}));return;case`change`:n.single(it({path:t}));return}});return r.on(`error`,t=>{n.fail(new j({module:`FileSystem`,reason:`Unknown`,method:`watch`,pathOrDescriptor:e,cause:t}))}),r.on(`close`,()=>{n.end()}),r}),e=>b(()=>e.close()))),An=(n,r,i)=>$(r).pipe(g(a=>n.pipe(e(e=>e.register(r,a,i)),t(()=>kn(r,i)))),$e),jn=(e,t,n)=>x((r,i)=>{try{H.writeFile(e,t,{signal:i,flag:n?.flag,mode:n?.mode},t=>{r(t?O(K(`FileSystem`,`writeFile`)(t,[e])):S)})}catch(e){r(O(X(`writeFile`)(e)))}}),Mn=L(F,g(Te(nt),e=>_t({access:rn,chmod:sn,chown:cn,copy:an,copyFile:on,link:ln,makeDirectory:un,makeTempDirectory:dn,makeTempDirectoryScoped:pn,makeTempFile:vn,makeTempFileScoped:yn,open:hn,readDirectory:bn,readFile:xn,readLink:Sn,realPath:Cn,remove:fn,rename:wn,stat:$,symlink:En,truncate:Dn,utimes:On,watch(t,n){return An(e,t,n)},writeFile:jn}))),Nn=yt(R(Lt,D),R(xt,D),R(bt,D),R(Mt,D),R(Dt,D),R(It,D),R(jt,D),R(Rt,D),R(At,D),R(Tt,D),R(Ft,D),R(Nt,D),R(Ct,D),R(Et,D),R(Pt,D)),Pn=L(Bt,me(function*(){return{fileSystem:yield*F,path:yield*at,tomlLoader:yield*mt}})),Fn=nn.pipe(M(Mn),M(st)),In=Wt(Nn.pipe(M(Pn),M(ft),M(Fn))),Ln=()=>{In.dispose()};process.once(`SIGINT`,Ln),process.once(`SIGTERM`,Ln);export{In as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{Js as e,oa as t,qs as n}from"./core-CG9iBVjE.js";import{C as r,h as i,q as a}from"./Effect-C1HfHpDW.js";import"./dist-CJoMkiK8.js";var o=class extends t(`InjectInstructionsExecutorDeps`)(){};const s=[`AGENTS.md`],c=r(`extractRefs`)(function*(t,n,r){let{fileSystem:a,path:s}=yield*o,c=[];for(let o of t.split(`
|
|
2
|
-
`)){let t=o.trim().replace(/^[-*+]\s+/,``);if(!t.startsWith(`@`))continue;let l=t.slice(1).trim();if(!l||l.includes(` `)||s.isAbsolute(l))continue;let u=s.resolve(n,l);if(u.startsWith(r+`/`)||u===r){let t=yield*i(a.exists(u));if(e(t)&&t.right){c.push({sourcePath:n,resolvedPath:u});continue}}let d=s.resolve(r,l);(d.startsWith(r+`/`)||d===r)&&d!==u&&c.push({sourcePath:r,resolvedPath:d})}return c}),l=r(`loadReferencedContent`)(function*(t){let{fileSystem:r,path:l,tomlLoader:u}=yield*o,d=[l.resolve(t,`CLAUDE.md`),l.resolve(t,`.claude`,`CLAUDE.md`)],f=[];for(let n of d){let a=yield*i(r.readFileString(n,`utf-8`));if(e(a)){let e=yield*c(a.right,l.dirname(n),t);f.push(...e)}}let p=new Set,m=[];for(let e of f)p.has(e.resolvedPath)||(p.add(e.resolvedPath),m.push(e));let h=(yield*u.load(t).pipe(a(()=>void 0)))?.no_inject_refs??s,g=[];for(let e of m){let a=e.resolvedPath.slice(t.length+1);if(h.includes(a))continue;let o=yield*i(r.readFileString(e.resolvedPath,`utf-8`));n(o)||g.push(`## ${a}\n${o.right}\n`)}return g.length===0?``:[`# Injected @-references from CLAUDE.md`,`The following files were @-imported by CLAUDE.md and contain project rules.`,``,...g].join(`
|
|
3
|
-
`)});export{l as n,o as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Ws as e,sc as t,tc as n,wl as r}from"./core-CG9iBVjE.js";import{Bn as i,Hn as a,Ln as o,O as s,Rn as c,Un as l,Vn as u,h as d,zn as f}from"./Effect-C1HfHpDW.js";import{n as p}from"./inject-instructions.executor-C5AgD0Hh.js";const m=l,h=Symbol.for(`effect/Config`),g={_A:e=>e},_={...t,[h]:g,commit(){return o(this)}},v=r(2,(e,t)=>{let n=Object.create(_);return n._tag=u,n.name=t,n.config=e,n}),y=r(2,(e,t)=>{let n=Object.create(_);return n._tag=f,n.first=e,n.second=C(t.orElse),n.condition=t.if,n}),b=(e,t)=>{let n=Object.create(_);return n._tag=a,n.description=e,n.parse=t,n},x=e=>{let t=b(`a text property`,n);return e===void 0?t:v(t,e)},S=e=>{let t=Object.create(_);return t._tag=c,t.value=e,t.parse=()=>n(e),t},C=e=>{let t=Object.create(_);return t._tag=i,t.config=e,t},w=r(2,(e,t)=>y(e,{orElse:()=>S(t),if:m})),T=x,E=w,D=(t,n)=>{t.on(`before_agent_start`,async(t,r)=>{let i=await n.runSafe(s(function*(){let t=yield*T(`CLAUDE_PROJECT_DIR`).pipe(E(process.cwd())),n=yield*d(p(t));return e(n)}));if(i!==``)return{systemPrompt:[...t.systemPrompt,``,i]}})};export{D as InjectInstructionsTask};
|