@systemfsoftware/omp-claude-compat 2.0.1 → 2.1.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 +15 -0
- package/README.md +29 -10
- package/dist/Cause-C0nAfay4.js +1 -0
- package/dist/Effect-B9bZOysK.js +1 -0
- package/dist/Exit-BNubcB4u.js +1 -0
- package/dist/HookDispatcherExecutor-BNRem4ll.js +2 -0
- package/dist/HookDispatcherHandler-DpPB8nCL.js +1 -0
- package/dist/HookRuntime-CyLjP9es.js +1 -0
- package/dist/InjectInstructionsExecutor-Hwi0pEWf.js +3 -0
- package/dist/InjectInstructionsHandler-afmdXS_K.js +1 -0
- package/dist/RunUserPromptSubmitHooksExecutor-Blzp-S0j.js +9 -0
- package/dist/api.js +1 -0
- package/dist/dist-tiPF5e4h.js +26 -0
- package/dist/effect-CKgkjFOq.js +13 -0
- package/dist/index.js +1 -1
- package/dist/inject.js +1 -0
- package/package.json +19 -17
- package/dist/Cause-BPRKNAWJ.js +0 -1
- package/dist/Effect-CYgXOp91.js +0 -1
- package/dist/Exit-Dz81ekW_.js +0 -1
- package/dist/HookDispatcherHandler-B8MCwQDv.js +0 -2
- package/dist/HookRuntime-CqLT5NiL.js +0 -1
- package/dist/InjectInstructionsHandler-DAJ1PFUG.js +0 -3
- package/dist/RunUserPromptSubmitHooksExecutor-C-kpE1OB.js +0 -9
- package/dist/dist-BkUkC5Q5.js +0 -26
- package/dist/effect-CczU2E3R.js +0 -13
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const e=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let e=0,r=t.length;e<r;e++)n=t[e](n);return n}}},t={pipe(){return e(this,arguments)}},n=function(){function e(){}return e.prototype=t,e}(),r=function(e,t){if(typeof e==`function`)return function(){return e(arguments)?t.apply(this,arguments):e=>t(e,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(e,n){return arguments.length>=2?t(e,n):function(n){return t(n,e)}};case 3:return function(e,n,r){return arguments.length>=3?t(e,n,r):function(r){return t(r,e,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(e){return t(e,...n)}}}},i=e=>e,a=e=>()=>e,o=a(!0),s=a(!1),c=a(null),l=a(void 0),u=l;function ee(t,...n){return e(t,n)}function d(e,t,n,r,i,a,o,s,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return i(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return a(i(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return o(a(i(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return s(o(a(i(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return c(s(o(a(i(r(n(t(e.apply(this,arguments)))))))))}}}function te(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),i}}function ne(e){let t=new WeakMap;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=e(n);return t.set(n,i),t.set(i,i),i}}const f=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete(`stack`);let n=Object.getPrototypeOf(e),r=n;for(;r!==null&&r!==Object.prototype;){let e=Reflect.ownKeys(r);for(let n=0;n<e.length;n++)t.add(e[n]);r=Object.getPrototypeOf(r)}return t.has(`constructor`)&&typeof e.constructor==`function`&&n===e.constructor.prototype&&t.delete(`constructor`),t},re=new WeakSet;function ie(e){return typeof e==`string`}function ae(e){return typeof e==`number`}function oe(e){return typeof e==`boolean`}function se(e){return typeof e==`symbol`}function ce(e){return ie(e)||ae(e)||se(e)}function le(e){return typeof e==`function`}function ue(e){return e===void 0}function de(e){return e!==void 0}function fe(e){return e!==null}function pe(e){return e!=null}function me(e){return!1}function he(e){return!0}function ge(e){return typeof e==`object`&&!!e||le(e)}const p=r(2,(e,t)=>ge(e)&&t in e),_e=r(2,(e,t)=>p(e,`_tag`)&&e._tag===t);function ve(e){return p(e,Symbol.iterator)||ie(e)}const m=`~effect/interfaces/Hash`,h=e=>{switch(typeof e){case`number`:return Se(e);case`bigint`:return _(e.toString(10));case`boolean`:return _(String(e));case`symbol`:return _(String(e));case`string`:return _(e);case`undefined`:return _(`undefined`);case`function`:case`object`:if(e===null)return _(`null`);if(e instanceof Date)return Number.isNaN(e.getTime())?_(`Invalid Date`):_(e.toISOString());if(e instanceof RegExp)return _(e.toString());{if(re.has(e))return ye(e);if(Ae.has(e))return Ae.get(e);let t=Me(e,()=>xe(e)?e[m]():typeof e==`function`?ye(e):e instanceof DataView?Ee(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):Array.isArray(e)||ArrayBuffer.isView(e)?Ee(e):e instanceof Map?De(e):e instanceof Set?Oe(e):we(e));return Ae.set(e,t),t}default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},ye=e=>(ke.has(e)||ke.set(e,Se(Math.floor(Math.random()*(2**53-1)))),ke.get(e)),g=r(2,(e,t)=>e*53^t),be=e=>e&3221225471|e>>>1&1073741824,xe=e=>p(e,m),Se=e=>{if(e!==e)return _(`NaN`);if(e===1/0)return _(`Infinity`);if(e===-1/0)return _(`-Infinity`);let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return be(t)},_=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return be(t)},Ce=(e,t)=>{let n=12289;for(let r of t)n^=g(h(r),h(e[r]));return be(n)},we=e=>Ce(e,f(e)),Te=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return be(r)},Ee=Te(6151,h),De=Te(_(`Map`),([e,t])=>g(h(e),h(t))),Oe=Te(_(`Set`),h),ke=new WeakMap,Ae=new WeakMap,je=new WeakSet;function Me(e,t){if(je.has(e))return _(`[Circular]`);je.add(e);let n=t();return je.delete(e),n}const v=`~effect/interfaces/Equal`;function y(){return arguments.length===1?e=>Ne(e,arguments[0]):Ne(arguments[0],arguments[1])}function Ne(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;return n===typeof t?n===`number`&&e!==e&&t!==t?!0:n!==`object`&&n!==`function`||re.has(e)||re.has(t)?!1:Re(e,t,Le):!1}function Pe(e,t,n){let r=Fe.has(e),i=Ie.has(t);if(r&&i)return!0;if(r||i)return!1;Fe.add(e),Ie.add(t);let a=n();return Fe.delete(e),Ie.delete(t),a}const Fe=new WeakSet,Ie=new WeakSet;function Le(e,t){if(h(e)!==h(t))return!1;if(e instanceof Date){if(!(t instanceof Date))return!1;let n=e.getTime(),r=t.getTime();return n===r||Number.isNaN(n)&&Number.isNaN(r)}if(e instanceof RegExp)return t instanceof RegExp&&e.toString()===t.toString();let n=qe(e),r=qe(t);if(n!==r)return!1;let i=n&&r;return typeof e==`function`&&!i?!1:Pe(e,t,()=>{if(i)return e[v](t);if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:Be(e,t);if(ArrayBuffer.isView(e)){let n=e instanceof DataView;if(!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||n!==t instanceof DataView)return!1;if(n){let n=t;return Ve(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(n.buffer,n.byteOffset,n.byteLength))}return Ve(e,t)}return e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:We(e,t):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:Ke(e,t):He(e,t)})}function Re(e,t,n){let r=ze.get(e);if(!r)r=new WeakMap,ze.set(e,r);else if(r.has(t))return r.get(t);let i=n(e,t);r.set(t,i);let a=ze.get(t);return a||(a=new WeakMap,ze.set(t,a)),a.set(e,i),i}const ze=new WeakMap;function Be(e,t){for(let n=0;n<e.length;n++)if(!Ne(e[n],t[n]))return!1;return!0}function Ve(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function He(e,t){let n=f(e),r=f(t);if(n.size!==r.size)return!1;for(let i of n)if(!r.has(i)||!Ne(e[i],t[i]))return!1;return!0}function Ue(e,t){return function(n,r){let i=Array.from(r);for(let[r,a]of n){let n=!1;for(let o=0;o<i.length;o++){let[s,c]=i[o];if(e(r,s)&&t(a,c)){i[o]=i[i.length-1],i.pop(),n=!0;break}}if(!n)return!1}return!0}}const We=Ue(Ne,Ne);function Ge(e){return function(t,n){let r=Array.from(n);for(let n of t){let t=!1;for(let i=0;i<r.length;i++){let a=r[i];if(e(n,a)){r[i]=r[r.length-1],r.pop(),t=!0;break}}if(!t)return!1}return!0}}const Ke=Ge(Ne),qe=e=>p(e,v),Je=e=>(re.add(e),e),Ye=e=>(t,n)=>t===n||e(t,n),Xe=e=>e.length>0,Ze=e=>r(3,(t,n,r)=>e(t,e=>({...e,[n]:r(e)}))),Qe=e=>r(2,(t,n)=>e(t,e=>({[n]:e}))),$e=(e,t)=>r(3,(n,r,i)=>t(n,t=>e(i(t),e=>({...t,[r]:e}))));function et(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function tt(e,t){for(let n of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,n)&&et(e,n,t[n])}const nt=Symbol.for(`~effect/Redactable`),rt=e=>p(e,nt);function it(e){return rt(e)?at(e):e}function at(e){return e[nt](globalThis[`~effect/Fiber/currentFiber`]?.context??ct)}const ot=`~effect/Fiber/currentFiber`,st=new Map,ct={"~effect/Context":{},base:st,depth:0,mapUnsafe:st,pipe(){return e(this,arguments)}};function b(e,t){let n=t?.space??0,r=new WeakSet,i=n?typeof n==`number`?` `.repeat(n):n:``,a=e=>i.repeat(e),o=(e,t)=>{let n=e?.constructor;return n&&n!==Object.prototype.constructor&&n.name?`${n.name}(${t})`:t},s=e=>{try{return Reflect.ownKeys(e)}catch{return[`[ownKeys threw]`]}};function c(e,n=0){if(typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`||e==null||typeof e==`boolean`||typeof e==`symbol`)return String(e);if(typeof e==`bigint`)return String(e)+`n`;if(typeof e==`object`||typeof e==`function`){if(r.has(e))return lt;r.add(e);let l;if(nt in e)l=c(at(e),n);else if(Array.isArray(e))l=!i||e.length<=1?`[${e.map(e=>c(e,n)).join(`,`)}]`:`[\n${a(n+1)}${e.map(e=>c(e,n+1)).join(`,
|
|
2
|
+
`+a(n+1))}\n${a(n)}]`;else if(e instanceof Date)l=ft(e);else if(!t?.ignoreToString&&p(e,`toString`)&&typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=pt(e);l=e instanceof Error&&e.cause?`${t} (cause: ${c(e.cause,n)})`:t}else if(Symbol.iterator in e)l=`${e.constructor.name}(${c(Array.from(e),n)})`;else{let t=s(e);if(!i||t.length<=1){let r=`{${t.map(t=>`${ut(t)}:${c(e[t],n)}`).join(`,`)}}`;l=o(e,r)}else{let r=`{\n${t.map(t=>`${a(n+1)}${ut(t)}: ${c(e[t],n+1)}`).join(`,
|
|
3
|
+
`)}\n${a(n)}}`;l=o(e,r)}}return r.delete(e),l}return String(e)}return c(e,0)}const lt=`[Circular]`;function ut(e){return typeof e==`string`?JSON.stringify(e):String(e)}function dt(e){return e.map(e=>`[${ut(e)}]`).join(``)}function ft(e){try{return e.toISOString()}catch{return`Invalid Date`}}function pt(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}function mt(e,t){let n=[];return JSON.stringify(e,function(e,t){let r=Object.getOwnPropertyDescriptor(this,e)?.value,i=p(r,nt)?it(r):it(t);if(typeof i==`bigint`)return b(i);if(typeof i!=`object`||!i)return i;for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(!n.includes(i))return n.push(i),i},t?.space)??`null`}const ht=Symbol.for(`nodejs.util.inspect.custom`),gt=e=>{try{return e=it(e),p(e,`toJSON`)&&le(e.toJSON)&&e.toJSON.length===0?e.toJSON():Array.isArray(e)?e.map(gt):e}catch{return`[toJSON threw]`}},_t=(e,t=2)=>{if(typeof e==`string`)return e;try{return typeof e==`object`?mt(e,{space:t}):b(e,{space:t})}catch{return String(e)}},vt={toJSON(){return gt(this)},[ht](){return this.toJSON()},toString(){return b(this.toJSON())}};var yt=class e{called=!1;self;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new e(this.self)}};const x=(()=>{let e=`~effect/Utils/internal`,t={[e]:e=>e()},n={[e]:e=>{try{return e()}finally{}}};return t[e](()=>Error().stack)?.includes(e)===!0?t[e]:n[e]})(),S=`~effect/Effect`,bt=`~effect/Exit`,xt={_A:i,_E:i,_R:i},St=`${S}/identifier`,C=`${S}/args`,w=`${S}/evaluate`,T=`${S}/successCont`,E=`${S}/failureCont`,Ct=`${S}/ensureCont`,wt=Symbol.for(`effect/Effect/Yield`),Tt={pipe(){return e(this,arguments)},toJSON(){return{...this}},toString(){return b(this.toJSON(),{ignoreToString:!0,space:2})},[ht](){return this.toJSON()}},Et={[m](){return Ce(this,Object.keys(this))},[v](e){let t=Object.keys(this),n=Object.keys(e);if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==n[r]||!y(this[t[r]],e[t[r]]))return!1;return!0}},Dt={[S]:xt,...Tt,[Symbol.iterator](){return new yt(this)},toJSON(){return{_id:`Effect`,op:this[St],...C in this?{args:this[C]}:void 0}}},D=e=>p(e,S),Ot=e=>p(e,bt),kt=`~effect/Cause`,At=`~effect/Cause/Reason`,jt=e=>p(e,kt),Mt=e=>p(e,At);var Nt=class{[kt];reasons;constructor(e){this[kt]=kt,this.reasons=e}pipe(){return e(this,arguments)}toJSON(){return{_id:`Cause`,failures:this.reasons.map(e=>e.toJSON())}}toString(){return`Cause(${b(this.reasons)})`}[ht](){return this.toJSON()}[v](e){return jt(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>y(t,e.reasons[n]))}[m](){return Ee(this.reasons)}};const Pt=new WeakMap;var Ft=class{[At];annotations;_tag;constructor(e,t,n){if(this[At]=At,this._tag=e,t!==It&&typeof n==`object`&&n&&t.size>0){let e=Pt.get(n);e&&(t=new Map([...e,...t])),Pt.set(n,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let n=new Map(this.annotations);e.mapUnsafe.forEach((e,r)=>{t?.overwrite!==!0&&n.has(r)||n.set(r,e)});let r=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return r.annotations=n,r}pipe(){return e(this,arguments)}toString(){return b(this)}[ht](){return this.toString()}};const It=new Map;var Lt=class extends Ft{error;constructor(e,t=It){super(`Fail`,t,e),this.error=e}toString(){return`Fail(${b(this.error)})`}toJSON(){return{_tag:`Fail`,error:this.error}}[v](e){return Wt(e)&&y(this.error,e.error)&&y(this.annotations,e.annotations)}[m](){return g(_(this._tag))(g(h(this.error))(h(this.annotations)))}};const Rt=e=>new Nt(e),zt=new Nt([]),Bt=e=>new Nt([new Lt(e)]);var Vt=class extends Ft{defect;constructor(e,t=It){super(`Die`,t,e),this.defect=e}toString(){return`Die(${b(this.defect)})`}toJSON(){return{_tag:`Die`,defect:this.defect}}[v](e){return Gt(e)&&y(this.defect,e.defect)&&y(this.annotations,e.annotations)}[m](){return g(_(this._tag))(g(h(this.defect))(h(this.annotations)))}};const Ht=e=>new Nt([new Vt(e)]),Ut=r(e=>jt(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new Nt(e.reasons.map(e=>e.annotate(t,n)))),Wt=e=>e._tag===`Fail`,Gt=e=>e._tag===`Die`,Kt=e=>e._tag===`Interrupt`;function qt(e){return $t(`Effect.evaluate: Not implemented`)}const Jt=e=>({...Dt,[St]:e.op,[w]:e[w]??qt,[T]:e[T],[E]:e[E],[Ct]:e[Ct]}),O=e=>{let t=Jt(e);return function(){let n=Object.create(t);return n[C]=e.single===!1?arguments:arguments[0],n}},Yt=e=>{let t={[bt]:bt,_tag:e.op,get[e.prop](){return this[C]},...Jt(e),toString(){return`${e.op}(${b(this[C])})`},toJSON(){return{_id:`Exit`,_tag:e.op,[e.prop]:this[C]}},[v](e){return Ot(e)&&e._tag===this._tag&&y(this[C],e[C])},[m](){return g(_(e.op),h(this[C]))}};return function(e){let n=Object.create(t);return n[C]=e,n}},k=Yt({op:`Success`,prop:`value`,[w](e){let t=e.getCont(T);return t?t[T](this[C],e,this):e.yieldWith(this)}}),Xt={key:`effect/Cause/StackTrace`},Zt={key:`effect/Cause/InterruptorStackTrace`},A=Yt({op:`Failure`,prop:`cause`,[w](e){let t=this[C],n=!1;e.currentStackFrame&&(t=Ut(t,{mapUnsafe:new Map([[Xt.key,e.currentStackFrame]])}),n=!0);let r=e.getCont(E);for(;e.interruptible&&e._interruptedCause&&r;)r=e.getCont(E);return r?r[E](t,e,n?void 0:this):e.yieldWith(n?A(t):this)}}),Qt=e=>A(Bt(e)),$t=e=>A(Ht(e)),j=O({op:`WithFiber`,[w](e){return this[C](e)}}),en=function(){class e extends globalThis.Error{}let t=Jt({op:`YieldableError`,[w](){return Qt(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),tn=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return class extends en{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(tt(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}(),nn=e=>{class t extends tn{_tag=e}return t.prototype.name=e,t},rn=`~effect/Cause/NoSuchElementError`,an=e=>p(e,rn);var on=class extends nn(`NoSuchElementError`){[rn]=rn;constructor(e){super({message:e})}};const sn=`~effect/Cause/Done`,cn=e=>p(e,sn),ln={[sn]:sn,_tag:`Done`,value:void 0},un=e=>e===void 0?ln:{[sn]:sn,_tag:`Done`,value:e},dn=Qt(ln),fn=e=>e===void 0?dn:Qt(un(e)),pn=`~effect/data/Option`,mn={[pn]:{_A:e=>e},...Tt,[Symbol.iterator](){return new yt(this)}},hn=Object.defineProperty(Object.assign(Object.create(mn),{_tag:`Some`,_op:`Some`,[v](e){return vn(e)&&bn(e)&&y(this.value,e.value)},[m](){return g(h(this._tag))(h(this.value))},toString(){return`some(${b(this.value)})`},toJSON(){return{_id:`Option`,_tag:this._tag,value:gt(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),gn=h(`None`),_n=Object.assign(Object.create(mn),{_tag:`None`,_op:`None`,valueOrUndefined:void 0,[v](e){return vn(e)&&yn(e)},[m](){return gn},toString(){return`none()`},toJSON(){return{_id:`Option`,_tag:this._tag}}}),vn=e=>p(e,pn),yn=e=>e._tag===`None`,bn=e=>e._tag===`Some`,xn=Object.create(_n),Sn=e=>{let t=Object.create(hn);return t.value=e,t},Cn=`~effect/data/Result`,wn={[Cn]:{_A:e=>e,_E:e=>e},...Tt,[Symbol.iterator](){return new yt(this)}},Tn=Object.assign(Object.create(wn),{_tag:`Success`,_op:`Success`,[v](e){return Dn(e)&&kn(e)&&y(this.success,e.success)},[m](){return g(h(this._tag))(h(this.success))},toString(){return`success(${b(this.success)})`},toJSON(){return{_id:`Result`,_tag:this._tag,value:gt(this.success)}}}),En=Object.assign(Object.create(wn),{_tag:`Failure`,_op:`Failure`,[v](e){return Dn(e)&&On(e)&&y(this.failure,e.failure)},[m](){return g(h(this._tag))(h(this.failure))},toString(){return`failure(${b(this.failure)})`},toJSON(){return{_id:`Result`,_tag:this._tag,failure:gt(this.failure)}}}),Dn=e=>p(e,Cn),On=e=>e._tag===`Failure`,kn=e=>e._tag===`Success`,An=e=>{let t=Object.create(En);return t.failure=e,t},jn=e=>{let t=Object.create(Tn);return t.success=e,t};function Mn(e){return(t,n)=>t===n?0:e(t,n)}const Nn=Mn((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1),Pn=Mn((e,t)=>e<t?-1:1),Fn=r(2,(e,t)=>Mn((n,r)=>e(t(n),t(r)))),In=Fn(Nn,e=>e.getTime()),Ln=e=>r(2,(t,n)=>e(t,n)===-1),Rn=e=>r(2,(t,n)=>e(t,n)===1),zn=e=>r(2,(t,n)=>e(t,n)!==1),Bn=e=>r(2,(t,n)=>e(t,n)!==-1),M=()=>xn,N=Sn,Vn=vn,P=yn,Hn=bn,Un=r(2,(e,{onNone:t,onSome:n})=>P(e)?t():n(e.value)),Wn=r(2,(e,t)=>P(e)?t():e.value),Gn=e=>e==null?M():N(e),Kn=Wn(c),qn=Wn(l),Jn=e=>(...t)=>{try{return N(e(...t))}catch{return M()}},Yn=r(2,(e,t)=>P(e)?M():N(t(e.value))),Xn=r(2,(e,t)=>P(e)?M():t(e.value)),Zn=r(2,(e,t)=>P(e)?M():t(e.value)?N(e.value):M()),Qn=e=>Ye((t,n)=>P(t)?P(n):!P(n)&&e(t.value,n.value)),F=jn,I=An,$n=Dn,L=On,er=kn,tr=r(2,(e,{onFailure:t,onSuccess:n})=>L(e)?I(t(e.failure)):F(n(e.success))),nr=r(2,(e,{onFailure:t,onSuccess:n})=>L(e)?t(e.failure):n(e.success)),rr=r(2,(e,t)=>{if(er(e))return e.success;throw t(e.failure)})(i),ir=r(2,(e,t)=>({[Symbol.iterator](){let n=e[Symbol.iterator](),r=0;return{next(){let e=n.next();for(;!e.done;){if(t(e.value,r++))return{done:!1,value:e.value};e=n.next()}return{done:!0,value:void 0}}}}})),ar=globalThis.Array,or=e=>ar.isArray(e)?e:ar.from(e),sr=r(2,(e,t)=>[...e,t]),cr=r(2,(e,t)=>or(e).concat(or(t)));ar.isArray;const lr=e=>e.length===0,ur=Xe,dr=Xe,fr=e=>dr(e)?N(pr(e)):M(),pr=e=>e[e.length-1],mr=(e,t)=>{let n=h(t),r=e.get(n);if(r===void 0)return e.set(n,[t]),!0;for(let e of r)if(y(e,t))return!1;return r.push(t),!0},hr=r(2,(e,t)=>{let n=or(e),r=or(t);return dr(n)?dr(r)?Sr(cr(n,r)):n:r}),gr=()=>[],_r=e=>[e],vr=r(2,(e,t)=>e.map(t)),yr=r(2,(e,t)=>{if(lr(e))return[];let n=[];for(let r=0;r<e.length;r++){let i=t(e[r],r);for(let e=0;e<i.length;e++)n.push(i[e])}return n}),br=r(2,(e,t)=>{let n=or(e),r=[];for(let e=0;e<n.length;e++)t(n[e],e)&&r.push(n[e]);return r}),xr=r(2,(e,t)=>{let n=[],r=[],i=0;for(let a of e){let e=t(a,i++);er(e)?r.push(e.success):n.push(e.failure)}return[n,r]}),Sr=e=>{let t=or(e);if(t.length<2)return[...t];let n=new Map,r=[];for(let e of t)mr(n,e)&&r.push(e);return r},Cr=e=>Jt({op:e.label,[w]:e.evaluate}),wr=`~effect/Context/Service`,Tr=function(){function e(){}let t=e;Object.setPrototypeOf(t,Er);let n=(e,n)=>(t.key=e,n?.defaultValue&&(t[Or]=Or,t.defaultValue=n.defaultValue),n?.make&&(t.make=n.make),n?.fiberCached&&Dr.add(e),t);return arguments.length>0?n(arguments[0],arguments[1]):n},Er={[wr]:wr,...Cr({label:`Service`,evaluate(e){return k(qr(e.context,this))}}),toJSON(){return{_id:`Service`,key:this.key}},of(e){return e},context(e){return Hr(this,e)},use(e){return j(t=>e(qr(t.context,this)))},useSync(e){return j(t=>k(e(qr(t.context,this))))}},Dr=new Set,Or=`~effect/Context/Reference`,kr=`~effect/Context`,Ar=(e,t,n,r)=>{let i=Object.create(Lr);return i.cacheRoot=e??i,i.base=t,i.overlay=n,i.depth=r,i._flat=void 0,i.baseHits=0,i},jr=(e,t)=>{t&&(jr(e,t.parent),e.set(t.key,t.value))},Mr=e=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return jr(t,e.overlay),e._flat=t},Nr=(e,t)=>{let n=new Map(e.mapUnsafe);return t(n),Ir(n)},Pr=Symbol(),Fr=(e,t)=>{let n=e;for(let e=n.overlay;e;e=e.parent)if(e.key===t)return e.value;let r=n.base.get(t);return r===void 0&&!n.base.has(t)?Pr:(n.overlay&&++n.baseHits>=8&&(n.base=Mr(n),n.overlay=void 0,n.depth=0),r)},Ir=e=>Ar(void 0,e,void 0,0),Lr={get mapUnsafe(){return Mr(this)},...Tt,[kr]:{_Services:e=>e},toJSON(){return{_id:`Context`,services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[v](e){if(!zr(e))return!1;let t=this.mapUnsafe,n=e.mapUnsafe;if(t.size!==n.size)return!1;for(let[e,r]of t)if(!n.has(e)||!y(r,n.get(e)))return!1;return!0},[m](){return Se(this.mapUnsafe.size)}},Rr=(e,t)=>e.cacheRoot===t.cacheRoot,zr=e=>p(e,kr),Br=e=>!!e[Or],R=()=>Vr,Vr=Ir(new Map),Hr=(e,t)=>Ir(new Map([[e.key,t]])),z=r(3,(e,t,n)=>Ur(e,t.key,n)),Ur=(e,t,n)=>{let r=e,i=Dr.has(t)?void 0:r.cacheRoot;if(r.depth>=8){let e=new Map(r.mapUnsafe);return e.set(t,n),Ar(i,e,void 0,0)}return Ar(i,r.base,{key:t,value:n,parent:r.overlay},r.depth+1)},Wr=r(2,(e,t)=>Gr(e,t.key)),Gr=(e,t)=>{let n=Fr(e,t);return n===Pr?void 0:n},Kr=r(2,(e,t)=>{let n=Fr(e,t.key);if(n===Pr){if(Br(t))return Yr(t);throw Xr(t)}return n}),qr=Kr,Jr=`~effect/Context/defaultValue`,Yr=e=>Jr in e?e[Jr]:e[Jr]=e.defaultValue(),Xr=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(t.stack){let e=t.stack.split(`
|
|
4
|
+
`);e.splice(1,3),t.stack=e.join(`
|
|
5
|
+
`)}return t},Zr=r(2,(e,t)=>{let n=Fr(e,t.key);return n===Pr?Br(t)?N(Yr(t)):M():N(n)}),Qr=r(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:Nr(e,e=>t.mapUnsafe.forEach((t,n)=>e.set(n,t)))),$r=(...e)=>{let t=new Map;for(let n=0;n<e.length;n++)e[n].mapUnsafe.forEach((e,n)=>{t.set(n,e)});return Ir(t)},B=Tr,ei=`~effect/time/Duration`,ti=BigInt(0),ni=BigInt(1),ri=BigInt(2),ii=BigInt(10),ai=BigInt(1e3),oi=e=>BigInt(e<0?Math.ceil(e-.5):Math.floor(e+.5)),si=e=>oi(e*1e6),ci=(e,t)=>{let n=e.indexOf(`.`);if(n===-1)return BigInt(e)*t;let r=e[0]===`-`,i=e.slice(n+1),a=ii**BigInt(i.length),o=(BigInt(e.slice(+!!r,n))*a+BigInt(i))*t,s=o/a+(o%a*ri>=a?ni:ti);return r?-s:s},li=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,ui=e=>{switch(typeof e){case`number`:return xi(e);case`bigint`:return bi(e);case`string`:{if(e===`Infinity`)return vi;if(e===`-Infinity`)return yi;let t=li.exec(e);if(!t)break;let[n,r,i]=t;if(i===`nano`||i===`nanos`)return bi(ci(r,ni));if(i===`micro`||i===`micros`)return bi(ci(r,ai));let a=Number(r);switch(i){case`milli`:case`millis`:return xi(a);case`second`:case`seconds`:return Si(a);case`minute`:case`minutes`:return Ci(a);case`hour`:case`hours`:return wi(a);case`day`:case`days`:return Ti(a);case`week`:case`weeks`:return Ei(a)}break}case`object`:{if(e===null)break;if(ei in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(ae)?di(e):Number.isNaN(e[0])||Number.isNaN(e[1])?_i:e[0]===-1/0||e[1]===-1/0?yi:e[0]===1/0||e[1]===1/0?vi:V(oi(e[0]*1e9+e[1]));let t=e,n=0;return t.weeks&&(n+=t.weeks*6048e5),t.days&&(n+=t.days*864e5),t.hours&&(n+=t.hours*36e5),t.minutes&&(n+=t.minutes*6e4),t.seconds&&(n+=t.seconds*1e3),t.milliseconds&&(n+=t.milliseconds),!t.microseconds&&!t.nanoseconds?V(n):V(oi(n*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0)))}}return di(e)},di=e=>{throw Error(`Invalid Input: ${e}`)},fi={_tag:`Millis`,millis:0},pi={_tag:`Infinity`},mi={_tag:`NegativeInfinity`},hi={[ei]:ei,[m](){switch(this.value._tag){case`Millis`:{let e=this.value.millis*1e6;return Number.isFinite(e)?h(oi(e)):Se(this.value.millis)}case`Nanos`:return h(this.value.nanos);default:return we(this.value)}},[v](e){return gi(e)&&Ni(this,e)},toString(){switch(this.value._tag){case`Infinity`:return`Infinity`;case`NegativeInfinity`:return`-Infinity`;case`Nanos`:return`${this.value.nanos} nanos`;case`Millis`:return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case`Millis`:return{_id:`Duration`,_tag:`Millis`,millis:this.value.millis};case`Nanos`:return{_id:`Duration`,_tag:`Nanos`,nanos:String(this.value.nanos)};case`Infinity`:return{_id:`Duration`,_tag:`Infinity`};case`NegativeInfinity`:return{_id:`Duration`,_tag:`NegativeInfinity`}}},[ht](){return this.toJSON()},pipe(){return e(this,arguments)}},V=e=>{let t=Object.create(hi);return t.value=typeof e==`number`?isNaN(e)||e===0||Object.is(e,-0)?fi:Number.isFinite(e)?Number.isInteger(e)?{_tag:`Millis`,millis:e}:{_tag:`Nanos`,nanos:si(e)}:e>0?pi:mi:e===ti?fi:{_tag:`Nanos`,nanos:e},t},gi=e=>p(e,ei),_i=V(0),vi=V(1/0),yi=V(-1/0),bi=e=>V(e),xi=e=>V(e),Si=e=>V(e*1e3),Ci=e=>V(e*6e4),wi=e=>V(e*36e5),Ti=e=>V(e*864e5),Ei=e=>V(e*6048e5),Di=e=>ki(ui(e),{onMillis:i,onNanos:e=>Number(e)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Oi=e=>{let t=ui(e);switch(t.value._tag){case`Infinity`:case`NegativeInfinity`:throw Error(`Cannot convert infinite duration to nanos`);case`Nanos`:return t.value.nanos;case`Millis`:return si(t.value.millis)}},ki=r(2,(e,t)=>{switch(e.value._tag){case`Millis`:return t.onMillis(e.value.millis);case`Nanos`:return t.onNanos(e.value.nanos);case`Infinity`:return t.onInfinity();case`NegativeInfinity`:return(t.onNegativeInfinity??t.onInfinity)()}}),Ai=r(3,(e,t,n)=>e.value._tag===`Infinity`||e.value._tag===`NegativeInfinity`||t.value._tag===`Infinity`||t.value._tag===`NegativeInfinity`?n.onInfinity(e,t):e.value._tag===`Millis`?t.value._tag===`Millis`?n.onMillis(e.value.millis,t.value.millis):n.onNanos(Oi(e),t.value.nanos):n.onNanos(e.value.nanos,Oi(t))),ji=(e,t)=>Ai(e,t,{onMillis:(e,t)=>e===t,onNanos:(e,t)=>e===t,onInfinity:(e,t)=>e.value._tag===t.value._tag}),Mi=r(2,(e,t)=>Ai(e,t,{onMillis:(e,t)=>V(e-t),onNanos:(e,t)=>V(e-t),onInfinity:(e,t)=>{let n=e.value._tag,r=t.value._tag;return n===`Infinity`?r===`Infinity`?_i:vi:n===`NegativeInfinity`?r===`NegativeInfinity`?_i:yi:r===`Infinity`?yi:vi}})),Ni=r(2,(e,t)=>ji(e,t)),Pi=r(2,(e,t)=>n=>{let r=e(n);if(L(r))return I(n);let i=t(r.success);return L(i)?I(n):i}),Fi=e=>t=>{let n=e(t);return L(n)?M():N(n.success)},Ii=B(`effect/Scheduler`,{fiberCached:!0,defaultValue:()=>new Bi}),Li=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},Ri=e=>{let t=!1;return Promise.resolve().then(()=>{t||e()}),()=>{t=!0}};var zi=class{buckets=[];scheduleTask(e,t){let n=this.buckets,r=n.length,i,a=0;for(;a<r&&!(n[a][0]>t);a++)i=n[a];i&&i[0]===t?i[1].push(e):a===r?n.push([t,[e]]):n.splice(a,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}},Bi=class{executionMode;setImmediate;constructor(e=`async`,t){this.executionMode=e,this.setImmediate=t??(e===`sync`?Ri:Li)}shouldYield(e){return e.currentOpCount>=e.maxOpsBeforeYield}makeDispatcher(){return new Vi(this.setImmediate)}},Vi=class{tasks=new zi;running=void 0;setImmediate;constructor(e=Li){this.setImmediate=e}scheduleTask(e,t){this.tasks.scheduleTask(e,t),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let n=e[t][1];for(let e=0;e<n.length;e++)n[e]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}};const Hi=B(`effect/Scheduler/MaxOpsBeforeYield`,{fiberCached:!0,defaultValue:()=>2048}),Ui=B(`effect/Scheduler/PreventSchedulerYield`,{fiberCached:!0,defaultValue:()=>!1}),Wi=class extends n{constructor(e){super(),e&&tt(this,e)}},Gi=tn,Ki=nn,qi=`~effect/encoding/EncodingError`;var Ji=class extends Ki(`EncodingError`){[qi]=qi};const Yi=e=>ea(typeof e==`string`?Qi.encode(e):e),Xi=e=>{let t=$i(e),n=t.length;if(n%4!=0)return I(new Ji({kind:`Decode`,module:`Base64`,input:t,message:`Length must be a multiple of 4, but is ${n}`}));let r=t.indexOf(`=`);if(r!==-1&&(r<n-2||r===n-2&&t[n-1]!==`=`))return I(new Ji({kind:`Decode`,module:`Base64`,input:t,message:`Found a '=' character, but it is not at the end`}));try{let e=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=new Uint8Array(n/4*3-e);for(let e=0,i=0;e<n;e+=4,i+=3){let n=ta(t.charCodeAt(e))<<18|ta(t.charCodeAt(e+1))<<12|ta(t.charCodeAt(e+2))<<6|ta(t.charCodeAt(e+3));r[i]=n>>16,r[i+1]=n>>8&255,r[i+2]=n&255}return F(r)}catch(e){return I(new Ji({kind:`Decode`,module:`Base64`,input:t,message:e instanceof Error?e.message:`Invalid input`}))}},Zi=e=>{let t=``;for(let n=e>>>3;n>0;n--){let e=Math.random()*4294967296>>>0;t+=ia[e>>>24]+ia[e>>>16&255]+ia[e>>>8&255]+ia[e&255]}return t},Qi=new TextEncoder,$i=e=>e.replace(/[\n\r]/g,``),ea=e=>{let t=e.length,n=``,r;for(r=2;r<t;r+=3)n+=na[e[r-2]>>2],n+=na[(e[r-2]&3)<<4|e[r-1]>>4],n+=na[(e[r-1]&15)<<2|e[r]>>6],n+=na[e[r]&63];return r===t+1&&(n+=na[e[r-2]>>2],n+=na[(e[r-2]&3)<<4],n+=`==`),r===t&&(n+=na[e[r-2]>>2],n+=na[(e[r-2]&3)<<4|e[r-1]>>4],n+=na[(e[r-1]&15)<<2],n+=`=`),n};function ta(e){if(e>=ra.length)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);let t=ra[e];if(t===255)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);return t}const na=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.split(``),ra=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],ia=[];for(let e=0;e<256;e++)ia.push(e.toString(16).padStart(2,`0`));const aa=`effect/Tracer/ParentSpan`;var oa=class extends Tr()(aa,{fiberCached:!0}){};const sa=e=>e,ca=B(`effect/Tracer/DisablePropagation`,{defaultValue:s}),la=B(`effect/Tracer/CurrentTraceLevel`,{defaultValue:()=>`Info`}),ua=B(`effect/Tracer/MinimumTraceLevel`,{defaultValue:()=>`All`}),da=`effect/Tracer`,fa=B(da,{fiberCached:!0,defaultValue:()=>sa({span:e=>new pa(e)})});var pa=class{_tag=`Span`;spanId;traceId=`native`;sampled;name;parent;annotations;links;startTime;kind;status;attributes;events=[];constructor(e){this.name=e.name,this.parent=e.parent,this.annotations=e.annotations,this.links=e.links,this.startTime=e.startTime,this.kind=e.kind,this.sampled=e.sampled,this.status={_tag:`Started`,startTime:e.startTime},this.attributes=new Map,this.traceId=qn(e.parent)?.traceId??Zi(32),this.spanId=Zi(16)}end(e,t){this.status={_tag:`Ended`,endTime:e,exit:t,startTime:this.status.startTime}}attribute(e,t){this.attributes.set(e,t)}event(e,t,n){this.events.push([e,t,n??{}])}addLinks(e){this.links.push(...e)}};const ma=B(`effect/ErrorReporter/CurrentErrorReporters`,{defaultValue:()=>new Set}),ha=B(`effect/References/CurrentStackFrame`,{fiberCached:!0,defaultValue:l}),ga=B(`effect/References/TracerEnabled`,{defaultValue:o}),_a=B(`effect/References/TracerTimingEnabled`,{defaultValue:o}),va=B(`effect/References/TracerSpanAnnotations`,{defaultValue:()=>({})}),ya=B(`effect/References/TracerSpanLinks`,{defaultValue:()=>[]}),ba=B(`effect/References/CurrentLogAnnotations`,{defaultValue:()=>({})}),xa=B(`effect/References/CurrentLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),Sa=B(`effect/References/MinimumLogLevel`,{fiberCached:!0,defaultValue:()=>`Info`}),Ca=B(`effect/References/CurrentLogSpans`,{defaultValue:()=>[]}),wa=(()=>{let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,`writable`)?e.writable===!0:e.set!==void 0})(),Ta=()=>Error.stackTraceLimit,Ea=e=>{wa&&(Error.stackTraceLimit=e)},Da=e=>{if(e?.captureStackTrace===!1||e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!=`boolean`)return e;let t=Ta();Ea(3);let n=Error();return Ea(t),{...e,captureStackTrace:ka(()=>n.stack)}},Oa=e=>t=>{let n;return()=>{if(n!==void 0)return n;let r=t();if(!r)return;let i=r.split(`
|
|
6
|
+
`);if(i[e]!==void 0)return n=i[e].trim(),n}},ka=Oa(3);var Aa=class extends Ft{fiberId;constructor(e,t=It){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[v](e){return Kt(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[m](){return g(_(`${this._tag}:${this.fiberId}`))(ye(this.annotations))}};const ja=e=>new Aa(e),Ma=e=>new Nt([new Aa(e)]),Na=e=>e.reasons.some(Wt),Pa=e=>{let t=e.reasons.find(Wt);return t?F(t):I(e)},H=e=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag===`Fail`)return F(n.error)}return I(e)},Fa=Fi(H),Ia=e=>e.reasons.some(Gt),La=e=>{let t=e.reasons.find(Gt);return t?F(t):I(e)},Ra=e=>{let t=e.reasons.find(Gt);return t?F(t.defect):I(e)},za=e=>e.reasons.some(Kt),Ba=e=>{let t=e.reasons.find(Kt);return t?F(t):I(e)},Va=e=>{let t;for(let n=0;n<e.reasons.length;n++){let r=e.reasons[n];r._tag===`Interrupt`&&(t??=new Set,r.fiberId!==void 0&&t.add(r.fiberId))}return t?F(t):I(e)},Ha=e=>{let t=Va(e);return L(t)?Ua:t.success},Ua=new Set,Wa=e=>e.reasons.length>0&&e.reasons.every(Kt),Ga=e=>Ir(e.annotations),Ka=e=>{let t=new Map;for(let n of e.reasons)if(n.annotations.size>0)for(let[e,r]of n.annotations)t.set(e,r);return Ir(t)},qa=r(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new Nt(hr(e.reasons,t.reasons));return y(e,n)?e:n}),Ja=r(2,(e,t)=>{let n=!1,r=e.reasons.map(e=>Wt(e)?(n=!0,new Lt(t(e.error),e.annotations)):e);return n?Rt(r):e}),Ya=e=>{let t={Fail:[],Die:[],Interrupt:[]};for(let n=0;n<e.reasons.length;n++)t[e.reasons[n]._tag].push(e.reasons[n]);return t},Xa=e=>{let t=Ya(e);return t.Fail.length>0?t.Fail[0].error:t.Die.length>0?t.Die[0].defect:t.Interrupt.length>0?new globalThis.Error(`All fibers interrupted without error`):new globalThis.Error(`Empty cause`)},Za=(e,t)=>{let n=[],r=[];if(e.reasons.length===0)return n;let i=Ta();Ea(1);for(let i of e.reasons){if(i._tag===`Interrupt`){r.push(i);continue}n.push(Qa(i._tag===`Die`?i.defect:i.error,i.annotations,t))}if(n.length===0){let e=Error(`The fiber was interrupted by:`);e.name=`InterruptCause`,e.stack=ro(e,r);let i=new globalThis.Error(`All fibers interrupted without error`,{cause:e});i.name=`InterruptError`,i.stack=`${i.name}: ${i.message}`,n.push(Qa(i,r[0].annotations,t))}return Ea(i),n},Qa=(e,t,n)=>{let r=typeof e,i;if(e&&r===`object`){if(i=new globalThis.Error($a(e),{cause:e.cause?Qa(e.cause):void 0}),typeof e.name==`string`&&(i.name=e.name),typeof e.stack==`string`)i.stack=to(e.stack,i,t);else{let e=`${i.name}: ${i.message}`;i.stack=t?no(e,t):e}n?.includeCauseInStack&&(i.stack=oo(i));for(let t of Object.keys(e))t in i||(i[t]=e[t])}else i=new globalThis.Error(e?r===`string`?e:mt(e):`Unknown error: ${e}`);return i},$a=e=>{if(typeof e.message==`string`)return e.message;if(typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return mt(e)},eo=/\((.*)\)/g,to=(e,t,n)=>{let r=`${t.name}: ${t.message}`,i=(e.startsWith(r)?e.slice(r.length):e).split(`
|
|
7
|
+
`),a=[r];for(let e=1;e<i.length&&!/(?:Generator\.next|~effect\/Effect)/.test(i[e]);e++)a.push(i[e]);return n?no(a.join(`
|
|
8
|
+
`),n):a.join(`
|
|
9
|
+
`)},no=(e,t)=>{let n=t?.get(Xt.key);return n&&(e=`${e}\n${io(n)}`),e},ro=(e,t)=>{let n=[`${e.name}: ${e.message}`];for(let e of t){let t=e.fiberId===void 0?`unknown`:`#${e.fiberId}`,r=e.annotations.get(Zt.key);n.push(` at fiber (${t})`),r&&n.push(io(r))}return n.join(`
|
|
10
|
+
`)},io=e=>{let t=[],n=e,r=0;for(;n&&r<10;){let e=n.stack();if(e){let r=e.matchAll(eo),i=!1;for(let[,e]of r)i=!0,t.push(` at ${n.name} (${e})`);i||t.push(` at ${n.name} (${e.replace(/^at /,``)})`)}else t.push(` at ${n.name}`);n=n.parent,r++}return t.join(`
|
|
11
|
+
`)},ao=e=>Za(e).map(oo).join(`
|
|
12
|
+
`),oo=e=>e.cause?`${e.stack} {\n${so(e.cause,` `)}\n}`:e.stack,so=(e,t)=>{let n=e.stack.split(`
|
|
13
|
+
`),r=`${t}[cause]: ${n[0]}`;for(let e=1,i=n.length;e<i;e++)r+=`\n${t}${n[e]}`;return e.cause&&(r+=` {\n${so(e.cause,`${t} `)}\n${t}}`),r},co=`~effect/Fiber`,lo={_A:i,_E:i},uo={id:0},fo=()=>globalThis[ot];var po=class{constructor(e,t=!0){this[co]=lo,this.setContext(e),this.id=++uo.id,this.currentOpCount=0,this.interruptible=t,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this.runtimeMetrics?.recordFiberStart(this.context)}[co];id;interruptible;currentOpCount;_stack;_observers;_exit;_children;_interruptedCause;_yielded;_running;_deferredInterrupt;context;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;currentPreventYield;_dispatcher=void 0;get currentDispatcher(){return this._dispatcher??=this.currentScheduler.makeDispatcher()}getRef(e){return qr(this.context,e)}addObserver(e){return this._exit?(e(this._exit),u):(this._observers.push(e),()=>{if(this._exit)return;let t=this._observers.indexOf(e);t>=0&&this._observers.splice(t,1)})}interruptUnsafe(e,t){if(this._exit)return;let n=Ma(e);this.currentStackFrame&&(n=Ut(n,Hr(Xt,this.currentStackFrame))),t&&(n=Ut(n,t)),this._interruptedCause=this._interruptedCause?qa(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(W(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;if(this._yielded!==void 0){let e=this._yielded;this._yielded=void 0,e()}let t=this.runLoop(e);if(t===wt)return;let n=ho.interruptChildren&&ho.interruptChildren(this);if(n!==void 0)return this.evaluate(X(n,()=>t));this._exit=t,this.runtimeMetrics?.recordFiberEnd(this.context,this._exit);for(let e=0;e<this._observers.length;e++)this._observers[e](t);this._observers.length=0,this._stack.length=0,this._children=void 0,this.context=R()}runLoop(e){let t=globalThis[ot];globalThis[ot]=this;let n=this._running;this._running=!0;let r=!1,i=e;this.currentOpCount=0;try{for(;;){if(this._deferredInterrupt&&(this._deferredInterrupt=!1,i=W(this._interruptedCause)),this.currentOpCount++,!r&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){r=!0;let e=i;i=X(Oo,()=>e)}if(i=this.currentTracerContext?this.currentTracerContext(i,this):i[w](this),i===wt){let e=this._yielded;if(bt in e)return this._deferredInterrupt=!1,this._yielded=void 0,e;if(this._deferredInterrupt){this._yielded=void 0,e();continue}return wt}}}catch(e){return p(i,w)?this.runLoop($t(e)):$t(`Fiber.runLoop: Not a valid effect: ${String(i)}`)}finally{this._running=n,globalThis[ot]=t}}getCont(e){if(this._deferredInterrupt)return this._deferredInterrupt=!1,mo;for(;;){let t=this._stack.pop();if(!t)return;let n=t[Ct]&&t[Ct](this);if(n)return n[e]=n,n;if(t[e])return t}}yieldWith(e){return this._yielded=e,wt}children(){return this._children??=new Set}pipe(){return e(this,arguments)}setContext(e){let t=this.context;if(this.context=e,t!==void 0&&Rr(t,e))return;let n=this.getRef(Ii);n!==this.currentScheduler&&(this.currentScheduler=n,this._dispatcher=void 0),this.currentSpan=Gr(e,aa),this.currentLogLevel=this.getRef(xa),this.minimumLogLevel=this.getRef(Sa),this.currentStackFrame=this.getRef(ha),this.maxOpsBeforeYield=this.getRef(Hi),this.currentPreventYield=this.getRef(Ui),this.runtimeMetrics=Gr(e,`effect/observability/Metric/FiberRuntimeMetricsKey`);let r=Gr(e,da);this.currentTracerContext=r?r.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag===`Span`?this.currentSpan:void 0}};const mo={[T](e,t){return W(t._interruptedCause)},[E](e,t){return W(t._interruptedCause)}},ho={interruptChildren:void 0},go=e=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(Zt.key,e.currentStackFrame),Ir(t)},_o=e=>{if(e._children!==void 0&&e._children.size!==0)return Co(e._children)},vo=e=>{let t=e;return t._exit?U(t._exit):Y(n=>t._exit?n(U(t._exit)):K(e.addObserver(e=>n(U(e)))))},yo=e=>Y(t=>{let n=e[Symbol.iterator](),r=[],i;function a(){let e=n.next();for(;!e.done;){if(e.value._exit){r.push(e.value._exit),e=n.next();continue}i=e.value.addObserver(e=>{r.push(e),a()});return}t(U(r))}return a(),K(()=>i?.())}),bo=e=>{let t=e;return t._exit?t._exit:Y(n=>t._exit?n(t._exit):K(e.addObserver(n)))},xo=e=>j(t=>So(e,t.id)),So=r(e=>p(e[0],co),(e,t,n)=>j(r=>{let i=go(r);return i=i&&n?Qr(i,n):i??n,e.interruptUnsafe(t,i),is(vo(e))})),Co=e=>j(t=>{let n=go(t),r=gr();for(let i of e)i.interruptUnsafe(t.id,n),r.push(i);return is(yo(r))}),U=k,W=A,G=Qt,K=O({op:`Sync`,[w](e){let t=this[C](),n=e.getCont(T);return n?n[T](t,e):e.yieldWith(k(t))}}),q=O({op:`Suspend`,[w](e){return this[C]()}}),wo=r(e=>e.length>=2||Vn(e[0]),(e,t)=>P(e)?G(t?t():new on(`Effect.fromOption: Option.none`)):U(e.value)),To=nr({onFailure:G,onSuccess:U}),Eo=e=>e==null?G(new on):U(e),Do=O({op:`Yield`,[w](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate($)},this[C]??0),e.yieldWith(()=>{t=!0})}}),Oo=Do(0),ko=e=>U(N(e)),Ao=U(M()),jo=e=>P(e)?Ao:Q(e.value,N),Mo=e=>q(()=>W(x(e))),No=e=>$t(e),Po=e=>q(()=>G(x(e))),J=U(void 0),Fo=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new Md(e,`An error occurred in Effect.try`):e.catch;return q(()=>{try{return U(x(t))}catch(e){return G(x(()=>n(e)))}})},Io=e=>Vo(function(t,n){x(()=>e(n)).then(e=>t(U(e)),e=>t(No(e)))},e.length!==0),Lo=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new Md(e,`An error occurred in Effect.tryPromise`):e.catch;return Vo(function(e,r){let i=t=>{try{e(G(x(()=>n(t))))}catch(t){e(No(t))}};try{x(()=>t(r)).then(t=>e(U(t)),i)}catch(e){i(e)}},t.length!==0)},Ro=e=>j(t=>e(t.id)),zo=j(U),Bo=Ro(U),Vo=O({op:`Async`,single:!1,[w](e){let t=x(()=>this[C][0].bind(e.currentScheduler)),n=!1,r=!1,i=this[C][1]?new AbortController:void 0,a=t(t=>{n||(n=!0,r?e.evaluate(t):r=t)},i?.signal);return r===!1?(r=!0,e._yielded=()=>{n=!0},i===void 0&&a===void 0||e._stack.push(Ho(()=>(n=!0,i?.abort(),a??$))),wt):r}}),Ho=O({op:`AsyncFinalizer`,[Ct](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Ll))},[E](e,t){return za(e)?X(this[C](),()=>W(e)):W(e)}}),Y=e=>Vo(e,e.length>=2),Uo=Y(u),Wo=(...e)=>q(()=>Qo(e.length===1?e[0]():e[1].call(e[0].self))),Go=(e,...t)=>{let n=t.length===0?function(){return q(()=>Qo(e.apply(this,arguments)))}:function(){let n=q(()=>Qo(e.apply(this,arguments)));for(let e=0;e<t.length;e++)n=t[e](n,...arguments);return n};return Ko(e.length,n)},Ko=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),qo=Oa(2),Jo=function(){let e=typeof arguments[0]==`string`,t=e?arguments[0]:`Effect.fn`,n=e?arguments[1]:void 0,r=Ta();Ea(2);let i=new globalThis.Error;return Ea(r),e?(r,...a)=>Yo(t,r,i,a,e,n):Yo(t,arguments[0],i,Array.prototype.slice.call(arguments,1),e,n)},Yo=(e,t,n,r,i,a)=>{let o=typeof t==`function`?t:r.shift().bind(t.self);return Ko(o.length,function(...t){let s=q(()=>{let e=o.apply(this,arguments);return D(e)?e:Qo(e)});for(let e=0;e<r.length;e++)s=r[e](s,...t);if(!D(s))return s;let c=Ta();Ea(2);let l=new globalThis.Error;return Ea(c),Gs(i?td(e,a,e=>nd(s,e)):s,ha,t=>({name:e,stack:qo(()=>l.stack),parent:{name:`${e} (definition)`,stack:qo(()=>n.stack),parent:t}}))})},Xo=(e,...t)=>Ko(e.length,t.length===0?function(){return Zo(()=>e.apply(this,arguments))}:function(){let n=Zo(()=>e.apply(this,arguments));for(let e of t)n=e(n);return n}),Zo=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return U(r.value);let i=r.value;if(i&&i._tag===`Success`){n=i.value;continue}if(i&&i._tag===`Failure`)return r.value;{let n=!0;return q(()=>n?(n=!1,X(r.value,e=>Qo(t,e))):q(()=>Qo(e())))}}}catch(e){return No(e)}},Qo=O({op:`Iterator`,single:!1,[T](e,t){let n=this[C][0];for(;;){let r=n.next(e);if(r.done)return U(r.value);if(!Z(r.value))return t._stack.push(this),r.value;if(r.value._tag===`Failure`)return r.value;e=r.value.value}},[w](e){return this[T](this[C][1],e)}}),$o=r(2,(e,t)=>{let n=U(t);return X(e,e=>n)}),es=e=>Q(e,N),ts=e=>Vc(e,{onFailure:U,onSuccess:G}),ns=r(2,(e,t)=>X(e,e=>D(t)?t:x(()=>t(e)))),rs=r(2,(e,t)=>X(e,e=>$o(D(t)?t:x(()=>t(e)),e))),is=e=>X(e,e=>$),as=e=>cc(e,G),os=(e,t)=>j(n=>Y(r=>{let i=or(e),a=i.length,o=0,s=!1,c=new Set,l=[],u=(e,i,u)=>{if(o++,e._tag===`Failure`){l.push(...e.cause.reasons),o>=a&&r(W(Rt(l)));return}let ee=!s;s=!0,r(c.size===0?e:X(Fl(Co(c)),()=>e)),ee&&t?.onWinner&&t.onWinner({fiber:i,index:u,parentFiber:n})};for(let e=0;e<a;e++){let t=gu(n,i[e],!0,!0,!1);if(c.add(t),t.addObserver(n=>{c.delete(t),u(n,t,e)}),s)break}return Co(c)})),ss=(e,t)=>j(n=>Y(r=>{let i=!1,a=new Set,o=e=>{i=!0,r(a.size===0?e:X(Fl(Co(a)),()=>e))},s=0;for(let r of e){if(i)break;let e=s++,c=gu(n,r,!0,!0,!1);a.add(c),c.addObserver(r=>{a.delete(c);let s=!i;o(r),s&&t?.onWinner&&t.onWinner({fiber:c,index:e,parentFiber:n})})}return Co(a)})),cs=r(e=>D(e[1]),(e,t,n)=>os([e,t],n)),ls=r(e=>D(e[1]),(e,t,n)=>ss([e,t],n)),X=r(2,(e,t)=>{let n=Object.create(us);return n[C]=e,n[T]=t.length===1?t:e=>t(e),n}),us=Jt({op:`OnSuccess`,[w](e){return e._stack.push(this),this[C]}}),ds=r(2,(e,t)=>Z(e)?e._tag===`Success`?t.onSuccess(e.value):t.onFailure(e.cause):Rc(e,t)),Z=e=>bt in e,fs=r(2,(e,t)=>Z(e)?e._tag===`Success`?t(e.value):e:X(e,t)),ps=e=>X(e,i),Q=r(2,(e,t)=>X(e,e=>U(x(()=>t(e))))),ms=r(2,(e,t)=>Z(e)?As(e,t):Q(e,t)),hs=r(2,(e,t)=>Z(e)?js(e,t):Oc(e,t)),gs=r(2,(e,t)=>Z(e)?Ms(e,t):kc(e,t)),_s=r(2,(e,t)=>{if(Z(e)){if(e._tag===`Success`)return e;let n=H(e.cause);return L(n)?e:t(n.success)}return fc(e,t)}),vs=e=>A(Ma(e)),ys=e=>e._tag===`Success`,bs=e=>e._tag===`Success`?F(e):I(e),xs=e=>e._tag===`Success`?F(e.value):I(e),Ss=e=>e._tag===`Failure`,Cs=e=>e._tag===`Failure`?F(e):I(e),ws=e=>e._tag===`Failure`?F(e.cause):I(e),Ts=Pi(ws,H),Es=Pi(ws,Ra),Ds=e=>e._tag===`Failure`&&za(e.cause),Os=e=>e._tag===`Failure`&&Ia(e.cause),ks=e=>e._tag===`Failure`&&Na(e.cause),$=k(void 0),As=r(2,(e,t)=>e._tag===`Success`?k(t(e.value)):e),js=r(2,(e,t)=>{if(e._tag===`Success`)return e;let n=H(e.cause);return L(n)?e:Qt(t(n.success))}),Ms=r(2,(e,t)=>{if(e._tag===`Success`)return k(t.onSuccess(e.value));let n=H(e.cause);return L(n)?e:Qt(t.onFailure(n.success))}),Ns=r(2,(e,t)=>ys(e)?k(t):e),Ps=r(2,(e,t)=>ys(e)?t:e),Fs=r(2,(e,t)=>ys(e)?t.onSuccess(e.value):t.onFailure(e.cause)),Is=Ns(void 0),Ls=e=>{let t=[];for(let n of e)n._tag===`Failure`&&t.push(...n.cause.reasons);return t.length===0?$:A(Rt(t))},Rs=e=>ys(e)?N(e.value):M(),zs=e=>Ss(e)?N(e.cause):M(),Bs=e=>{let t=Ts(e);return L(t)?M():N(t.success)},Vs=e=>e,Hs=e=>j(t=>U(Zr(t.context,e))),Us=e=>j(t=>wo(Zr(t.context,e))),Ws=r(2,(e,t)=>j(n=>{let r=n.context,i=t(r);return r===i?e:(n.setContext(i),bl(e,()=>{n.setContext(r)}))})),Gs=r(3,(e,t,n)=>Ws(e,e=>{let r=Kr(e,t),i=n(r);return r===i?e:z(e,t,i)})),Ks=(e,t,n)=>Fl(j(r=>{let i=Kr(r.context,e),a=t(i);return r.setContext(z(r.context,e,a)),cl(Kr(r.context,nl),t=>{let o=Kr(r.context,e),s;if(n?.reset===void 0){if(o!==a)return J;s=i}else s=n.reset(i,a,o);return r.setContext(z(r.context,e,s)),J})})),qs=()=>Js,Js=j(e=>U(e.context)),Ys=e=>j(t=>e(t.context)),Xs=r(2,(e,t)=>Ws(e,a(t))),Zs=r(2,(e,t)=>Z(e)?e:Ws(e,Qr(t))),Qs=function(){return arguments.length===1?r(2,(e,t)=>$s(e,arguments[0],t)):r(3,(e,t,n)=>$s(e,t,n)).apply(this,arguments)},$s=(e,t,n)=>Ws(e,z(t,n)),ec=r(3,(e,t,n)=>X(n,n=>Qs(e,t,n))),tc=r(e=>D(e[1]),(e,t,n)=>nc(e,t,(e,t)=>[e,t],n)),nc=r(e=>D(e[1]),(e,t,n,r)=>r?.concurrent?Q(Wl([e,t],{concurrency:2}),([e,t])=>x(()=>n(e,t))):X(e,e=>Q(t,t=>x(()=>n(e,t))))),rc=r(e=>D(e[0]),(e,t,n)=>au(e,t,n?e=>G(n(e)):()=>G(new on))),ic=r(2,(e,t)=>X(t,t=>t?es(e):Ao)),ac=r(2,(e,t)=>Array.from({length:t},()=>e)),oc=r(e=>D(e[0]),(e,t,n)=>Wl(ac(e,t),n)),sc=r(e=>D(e[0]),(e,t)=>Ql({while:o,body:a(t?.disableYield?e:X(e,e=>Oo)),step:u})),cc=r(2,(e,t)=>{let n=Object.create(lc);return n[C]=e,n[E]=t.length===1?t:e=>t(e),n}),lc=Jt({op:`OnFailure`,[w](e){return e._stack.push(this),this[C]}}),uc=r(3,(e,t,n)=>cc(e,e=>t(e)?x(()=>n(e)):W(e))),dc=r(3,(e,t,n)=>cc(e,e=>{let r=t(e);return L(r)?W(r.failure):x(()=>n(r.success,e))})),fc=r(2,(e,t)=>dc(e,H,e=>t(e))),pc=e=>Vc(e,{onFailure:e=>an(e)?Ao:G(e),onSuccess:ko}),mc=r(2,(e,t)=>dc(e,Ra,t)),hc=r(2,(e,t)=>cc(e,e=>ns(x(()=>t(e)),W(e)))),gc=r(3,(e,t,n)=>uc(e,t,e=>ns(x(()=>n(e)),W(e)))),_c=r(3,(e,t,n)=>cc(e,e=>{let r=t(e);return L(r)?W(e):ns(x(()=>n(r.success,e)),W(e))})),vc=r(2,(e,t)=>_c(e,H,e=>t(e))),yc=r(3,(e,t,n)=>{let r=Array.isArray(t)?e=>p(e,`_tag`)&&t.includes(e._tag):_e(t);return vc(e,e=>r(e)?n(e):J)}),bc=r(2,(e,t)=>_c(e,Ra,e=>t(e))),xc=r(e=>D(e[0]),(e,t,n,r)=>cc(e,e=>{let i=H(e);return L(i)?W(i.failure):t(i.success)?x(()=>n(i.success)):r?x(()=>r(i.success)):W(e)})),Sc=r(e=>D(e[0]),(e,t,n,r)=>cc(e,e=>{let i=H(e);if(L(i))return W(i.failure);let a=t(i.success);return L(a)?r?x(()=>r(a.failure)):W(e):x(()=>n(a.success))})),Cc=r(e=>D(e[0]),(e,t,n,r)=>{let i=Array.isArray(t)?e=>p(e,`_tag`)&&t.includes(e._tag):_e(t);return xc(e,i,n,r)}),wc=r(e=>D(e[0]),(e,t,n)=>{let r;return Sc(e,e=>(r??=Object.keys(t),p(e,`_tag`)&&ie(e._tag)&&r.includes(e._tag)?F(e):I(e)),e=>x(()=>t[e._tag](e)),n)}),Tc=r(e=>D(e[0]),(e,t,n,r,i)=>xc(e,e=>_e(e,t)&&p(e,`reason`),e=>{let t=e.reason;return _e(t,n)?r(t,e):i?x(()=>i(t,e)):G(e)})),Ec=r(e=>D(e[0]),(e,t,n,r)=>{let i;return xc(e,e=>_e(e,t)&&p(e,`reason`)&&p(e.reason,`_tag`)&&ie(e.reason._tag),e=>{let t=e.reason;return i??=Object.keys(n),i.includes(t._tag)?x(()=>n[t._tag](t,e)):r?x(()=>r(t,e)):G(e)})}),Dc=r(2,(e,t)=>Sc(e,e=>_e(e,t)&&p(e,`reason`)?F(e.reason):I(e),G)),Oc=r(2,(e,t)=>fc(e,e=>Po(()=>t(e)))),kc=r(2,(e,t)=>Vc(e,{onFailure:e=>Po(()=>t.onFailure(e)),onSuccess:e=>K(()=>t.onSuccess(e))})),Ac=e=>fc(e,No),jc=r(2,(e,t)=>fc(e,e=>K(t))),Mc=e=>q(()=>{let t=e[Symbol.iterator](),n=t.next();if(n.done)return No(Error(`Received an empty collection of effects`));function r(e){let n=t.next();return n.done?e.value:fc(e.value,e=>r(n))}return r(n)}),Nc=e=>fc(e,t=>X(Oo,()=>Nc(e))),Pc=r(e=>D(e[0]),(e,t)=>{if(!t?.log)return Vc(e,{onFailure:e=>J,onSuccess:e=>J});let n=Hd(t.log===!0?void 0:t.log);return Rc(e,{onFailure(e){let r=Pa(e);return L(r)?W(r.failure):t.message===void 0?n(e):n(t.message,e)},onSuccess:e=>J})}),Fc=r(e=>D(e[0]),(e,t)=>{if(!t?.log)return Rc(e,{onFailure:e=>J,onSuccess:e=>J});let n=Hd(t.log===!0?void 0:t.log);return Rc(e,{onFailure:e=>t.message===void 0?n(e):n(t.message,e),onSuccess:e=>J})}),Ic=e=>Hc(e,{onFailure:M,onSuccess:N}),Lc=e=>Uc(e,{onFailure:I,onSuccess:F}),Rc=r(2,(e,t)=>{let n=Object.create(zc);return n[C]=e,n[T]=t.onSuccess.length===1?t.onSuccess:e=>t.onSuccess(e),n[E]=t.onFailure.length===1?t.onFailure:e=>t.onFailure(e),n}),zc=Jt({op:`OnSuccessAndFailure`,[w](e){return e._stack.push(this),this[C]}}),Bc=r(2,(e,t)=>Rc(e,{onFailure:e=>K(()=>t.onFailure(e)),onSuccess:e=>K(()=>t.onSuccess(e))})),Vc=r(2,(e,t)=>Rc(e,{onFailure:e=>{let n=e.reasons.find(Wt);return n?x(()=>t.onFailure(n.error)):W(e)},onSuccess:t.onSuccess})),Hc=r(2,(e,t)=>Vc(e,{onFailure:e=>K(()=>t.onFailure(e)),onSuccess:e=>K(()=>t.onSuccess(e))})),Uc=r(2,(e,t)=>{if(Z(e)){if(e._tag===`Success`)return k(t.onSuccess(e.value));let n=H(e.cause);return L(n)?e:k(t.onFailure(n.success))}return Hc(e,t)}),Wc=r(2,(e,t)=>Z(e)?e._tag===`Success`?k(t.onSuccess(e.value)):k(t.onFailure(e.cause)):Bc(e,t)),Gc=e=>Z(e)?k(e):Kc(e),Kc=O({op:`Exit`,[w](e){return e._stack.push(this),this[C]},[T](e,t,n){return U(n??k(e))},[E](e,t,n){return U(n??A(e))}}),qc=Uc({onFailure:()=>!0,onSuccess:()=>!1}),Jc=Uc({onFailure:()=>!1,onSuccess:()=>!0}),Yc=r(2,(e,t)=>ns(gd(t),e)),Xc=r(2,(e,t)=>ls(e,X(gd(t.duration),t.orElse))),Zc=r(2,(e,t)=>Xc(e,{duration:t,orElse:()=>G(new bd)})),Qc=r(2,(e,t)=>ls(es(e),$o(gd(t),M()))),$c=e=>hd(t=>{let n=t.monotonicTimeNanosUnsafe();return Q(e,e=>[bi(t.monotonicTimeNanosUnsafe()-n),e])}),el=`~effect/Scope`,tl=`~effect/Scope/Closeable`,nl=Tr(`effect/Scope`),rl=(e,t)=>q(()=>il(e,t)??J),il=(e,t)=>{if(e.state._tag===`Closed`)return;let n={_tag:`Closed`,exit:t};if(e.state._tag===`Empty`){e.state=n;return}let{finalizers:r}=e.state;if(e.state=n,r.size!==0)return r.size===1?r.values().next().value(t):ol(e,r,t)},al=(e,t)=>ys(e)?t:cc(t,t=>W(qa(e.cause,t))),ol=Go(function*(e,t,n){let r=[],i=[],a=Array.from(t.values()),o=fo();for(let t=a.length-1;t>=0;t--){let s=a[t];e.strategy===`sequential`?r.push(yield*Gc(s(n))):i.push(gu(o,s(n),!0,!0,`inherit`))}return i.length>0&&(r=yield*yo(i)),yield*Ls(r)}),sl=(e,t)=>{let n=fl(t);if(e.state._tag===`Closed`)return n.state=e.state,n;let r={};return ul(e,r,e=>rl(n,e)),ul(n,r,t=>K(()=>dl(e,r))),n},cl=(e,t)=>q(()=>e.state._tag===`Closed`?t(e.state.exit):(ul(e,{},t),J)),ll=(e,t)=>cl(e,a(t)),ul=(e,t,n)=>{e.state._tag===`Empty`?e.state={_tag:`Open`,finalizers:new Map([[t,n]])}:e.state._tag===`Open`&&e.state.finalizers.set(t,n)},dl=(e,t)=>{e.state._tag===`Open`&&e.state.finalizers.delete(t)},fl=(e=`sequential`)=>({[tl]:tl,[el]:el,strategy:e,state:pl}),pl={_tag:`Empty`},ml=nl,hl=Qs(nl),gl=e=>j(t=>{let n=t.context,r=fl();return t.setContext(z(t.context,nl,r)),bl(e,e=>(t.setContext(n),il(r,e)))}),_l=e=>q(()=>{let t=fl();return xl(e(t),e=>q(()=>il(t,e)??J))}),vl=(e,t,n)=>Ys(r=>Vl(i=>X(ml,a=>rs(n?.interruptible?i(e):e,e=>cl(a,n=>Zs(t(e,n),r)))))),yl=e=>X(ml,t=>Ys(n=>cl(t,t=>Zs(e(t),n)))),bl=O({op:`OnExit`,single:!1,[w](e){return e._stack.push(this),this[C][0]},[Ct](e){e.interruptible&&this[C][2]!==!0&&(e._stack.push(Ll),e.interruptible=!1)},[T](e,t,n){n??=k(e);let r=this[C][1](n);return r?X(r,e=>n):n},[E](e,t,n){n??=A(e);let r=this[C][1](n);return r?X(al(n,r),e=>n):n}}),xl=r(2,bl),Sl=r(2,(e,t)=>xl(e,e=>t)),Cl=r(3,(e,t,n)=>xl(e,e=>t(e)?n(e):J)),wl=r(3,(e,t,n)=>xl(e,e=>{let r=t(e);return L(r)?J:n(r.success,e)})),Tl=r(2,(e,t)=>wl(e,ws,t)),El=r(3,(e,t,n)=>Cl(e,e=>e._tag===`Failure`&&t(e.cause),e=>n(e.cause))),Dl=r(3,(e,t,n)=>xl(e,e=>{if(e._tag!==`Failure`)return J;let r=t(e.cause);return L(r)?J:n(r.success,e.cause)})),Ol=r(2,(e,t)=>Dl(Va,t)(e)),kl=(e,t,n)=>Vl(r=>X(e,e=>bl(r(t(e)),t=>n(e,t),!0))),Al=e=>vl(e,e=>p(e,Symbol.asyncDispose)?Io(()=>e[Symbol.asyncDispose]()):K(()=>e[Symbol.dispose]())),jl=r(2,(e,t)=>K(()=>{let n=Di(ui(t)),r=Number.isFinite(n),i=Lu(!1),a=0,o=!1,s,c=X(i.await,()=>s);return[j(t=>{let l=t.getRef(ld),u=r?l.currentTimeMillisUnsafe():0;return o||u<a?s??c:(o=!0,i.closeUnsafe(),s=void 0,xl(e,e=>K(()=>{o=!1,a=l.currentTimeMillisUnsafe()+n,s=e,i.openUnsafe()})))}),K(()=>{a=0,i.closeUnsafe(),s=void 0})]})),Ml=r(2,(e,t)=>Q(jl(e,t),e=>e[0])),Nl=e=>Ml(e,vi),Pl=j(e=>W(Ma(e.id))),Fl=e=>j(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Ll),e):e),Il=O({op:`SetInterruptible`,[Ct](e){if(e.interruptible=this[C],e._interruptedCause&&e.interruptible)return()=>W(e._interruptedCause)}}),Ll=Il(!0),Rl=Il(!1),zl=e=>{if(e.interruptible=!0,e._stack.push(Rl),e._interruptedCause)return W(e._interruptedCause)},Bl=e=>j(t=>t.interruptible?e:zl(t)??e),Vl=e=>j(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Ll),e(Bl)):e(i)),Hl=e=>j(t=>{if(t.interruptible)return e(i);let n=zl(t),r=e(Fl);return n??r}),Ul=Q(vl(K(()=>new AbortController),e=>K(()=>e.abort())),e=>e.signal),Wl=(e,t)=>ve(e)?t?.mode===`result`?$l(e,Lc,t):$l(e,i,t):t?.discard?t.mode===`result`?$l(Object.values(e),Lc,t):$l(Object.values(e),i,t):q(()=>{let n={};return $o($l(Object.entries(e),([e,r])=>Q(t?.mode===`result`?Lc(r):r,t=>{et(n,e,t)}),{discard:!0,concurrency:t?.concurrency}),n)}),Gl=r(e=>ve(e[0])&&!D(e[0]),(e,t,n)=>Q($l(e,(e,n)=>Lc(t(e,n)),n),e=>xr(e,i))),Kl=r(3,(e,t,n)=>{let r=or(e);return r.length===0?K(t):q(()=>{let e=0,i=t();return Q(Ql({while:()=>e<r.length,body:()=>n(i,r[e],e),step(t){i=t,e++}}),()=>i)})}),ql=r(e=>ve(e[0])&&!D(e[0]),(e,t,n)=>X(Gl(e,t,{concurrency:n?.concurrency}),([e,t])=>ur(e)?G(e):n?.discard?J:U(t))),Jl=r(e=>ve(e[0])&&!D(e[0]),(e,t)=>q(()=>{let n=e[Symbol.iterator](),r=n.next();return r.done?U(M()):Yl(n,0,t,r.value)})),Yl=(e,t,n,r)=>X(n(r,t),i=>{if(i)return U(N(r));let a=e.next();return a.done?U(M()):Yl(e,t+1,n,a.value)}),Xl=r(e=>ve(e[0])&&!D(e[0]),(e,t)=>q(()=>{let n=e[Symbol.iterator](),r=n.next();return r.done?U(M()):Zl(n,0,t,r.value)})),Zl=(e,t,n,r)=>X(n(r,t),r=>{if(er(r))return U(N(r.success));let i=e.next();return i.done?U(M()):Zl(e,t+1,n,i.value)}),Ql=O({op:`While`,[T](e,t){return this[C].step(e),this[C].while()?(t._stack.push(this),this[C].body()):$},[w](e){return this[C].while()?(e._stack.push(this),this[C].body()):$}}),$l=r(e=>typeof e[1]==`function`,(e,t,n)=>q(()=>{let r=n?.concurrency??1,i=r===`unbounded`?1/0:Math.max(1,r);if(i===1)return tu(e,t,n);let a=or(e),o=a.length;if(o===0)return n?.discard?J:U([]);let s=n?.discard?void 0:Array(o),c=iu({f:t,out:s},a,{concurrency:i});return c?$o(c,s):U(s)})),eu=e=>X(e,e=>{let t=e[Symbol.iterator]().next();return t.done?G(new on):U(t.value)}),tu=(e,t,n)=>q(()=>{let r=n?.discard?void 0:[],i=e[Symbol.iterator](),a=i.next(),o=0;return $o(Ql({while:()=>!a.done,body:()=>t(a.value,o++),step:e=>{r&&r.push(e),a=i.next()}}),r)}),nu=e=>{let t=e.onItem,n=e.step,r=(e,i,a,o)=>{for(;a<o;a++){let s=i[a],c=t(e,s,a);if(!Z(c))return X(Gc(c),t=>n(e,s,t,a)??r(e,i,a+1,o)??J);let l=n(e,s,c,a);if(l)return l._tag===`Failure`?l:void 0}};return(e,i,a)=>{let o=0,s=a?.end??i.length,c=a?.concurrency??1;if(c===1)return r(e,i,0,s);let l=a?.orderedStep===!0&&c>1,u=!1,ee,d,te,ne=!1,f,re,ie=o,ae=l?Array(s):void 0,oe=e=>{let t=$t(e);return f=t,u=!0,ne=!0,d&&d.size>0?X(Fl(Co(Array.from(d))),()=>t):t},se=(t,r,a)=>{if(!l)return n(e,t,r,a);if(f)return f;for(ae[a]=r;ie<s;){let t=ae[ie];if(t===void 0)return;ae[ie]=void 0;let r=ie++,a=n(e,i[r],t,r);if(a)return a}},ce=()=>{let n=!1;for(;!f&&o<s;o++){let r=i[o],a=re??t(e,r,o);if(Z(a)){if(f=se(r,a,o),f)break}else if(ee){re=void 0;let e=gu(ee,a,!0,!0,`inherit`);if(e._exit){if(f=se(r,e._exit,o),f)break;continue}d.add(e);let t=o;if(e.addObserver(i=>{d.delete(e);try{if(f){if(!ne&&i._tag===`Failure`)for(let e of i.cause.reasons)if(e._tag===`Interrupt`)continue;else f._tag===`Failure`?f.cause.reasons.push(e):f=A(Rt([e]))}else{let e=se(r,i,t);e&&(f=e._tag===`Failure`?A(Rt(e.cause.reasons.slice())):e,ce())}if(n){let e=ce();e&&te(e)}else u&&d.size===0&&te(f??J)}catch(e){te(oe(e))}}),d.size<c)continue;n=!0,o++;return}else return Y(e=>{ee=fo(),d=new Set,re=a,te=e;let t;try{t=ce()}catch(t){return e(oe(t))}return t?e(t):q(()=>(f=$,ne=!0,d?Co(d):J))})}if(u=!0,f){if(d&&d.size>0){let e=go(ee);d.forEach(t=>t.interruptUnsafe(ee.id,e));return}if(te||f._tag===`Failure`)return f}else if(te){if(d)d.size===0&&te(J);else return $}};return ce()}},ru=()=>nu,iu=nu({onItem(e,t,n){return e.f(t,n)},step(e,t,n,r){if(n._tag===`Failure`)return n;e.out&&(e.out[r]=n.value)}}),au=r(3,(e,t,n)=>X(e,e=>t(e)?U(e):n(e))),ou=r(3,(e,t,n)=>X(e,e=>{let r=t(e);return L(r)?n(r.failure):U(r.success)})),su=r(e=>D(e[0]),(e,t,n)=>ou(e,t,n?e=>G(n(e)):()=>G(new on))),cu=r(e=>ve(e[0])&&!D(e[0]),(e,t,n)=>q(()=>{let r=[];return $o($l(e,(e,n)=>{let i=t(e,n);return typeof i==`boolean`?(i&&r.push(e),J):Q(i,t=>{t&&r.push(e)})},{discard:!0,concurrency:n?.concurrency}),r)})),lu=r(e=>ve(e[0])&&!D(e[0]),(e,t)=>q(()=>{let n=[];for(let r of e){let e=t(r);er(e)&&n.push(e.success)}return U(n)})),uu=r(e=>ve(e[0])&&!D(e[0]),(e,t,n)=>q(()=>{let r=[];return $o($l(e,e=>Q(t(e),e=>{er(e)&&r.push(e.success)}),{discard:!0,concurrency:n?.concurrency}),r)})),du=U({}),fu=Qe(Q),pu=$e(Q,X),mu=Ze(Q),hu=r(e=>D(e[0]),(e,t)=>j(n=>(qd(),U(gu(n,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),gu=(e,t,n=!1,r=!1,i=!1)=>{let a=e,o=i===`inherit`?a.interruptible:!i,s=new po(a.context,o);return n?s.evaluate(t):a.currentDispatcher.scheduleTask(()=>s.evaluate(t),0),!r&&!s._exit&&(a.children().add(s),s.addObserver(()=>a._children.delete(s))),s},_u=r(e=>D(e[0]),(e,t)=>j(n=>U(gu(n,e,t?.startImmediately,!0,t?.uninterruptible)))),vu=e=>j(t=>{let n=t._children&&new Set(t._children);return xl(e,e=>{let r=t._children;return r===void 0||r.size===0?J:(n&&(r=ir(r,e=>!n.has(e))),is(yo(r)))})}),yu=r(e=>D(e[0]),(e,t,n)=>j(r=>{let i=gu(r,e,n?.startImmediately,!0,n?.uninterruptible);if(!i._exit){if(t.state._tag!==`Closed`){let e={};ul(t,e,()=>Ro(e=>e===i.id?J:xo(i))),i.addObserver(()=>dl(t,e))}else i.interruptUnsafe(r.id,go(r))}return U(i)})),bu=r(e=>D(e[0]),(e,t)=>X(ml,n=>yu(e,n,t))),xu=e=>(t,n)=>{let r=new po(n?.scheduler?z(e,Ii,n.scheduler):e,n?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(n?.signal){if(n.signal.aborted)r.interruptUnsafe();else{let e=()=>r.interruptUnsafe();n.signal.addEventListener(`abort`,e,{once:!0}),r.addObserver(()=>n.signal.removeEventListener(`abort`,e))}}return n?.onFiberStart&&n.onFiberStart(r),r},Su=r(2,(e,t)=>{if(e._exit)return e;if(t.state._tag===`Closed`)return e.interruptUnsafe(e.id),e;let n={};return ul(t,n,()=>xo(e)),e.addObserver(()=>dl(t,n)),e}),Cu=xu(R()),wu=e=>{let t=xu(e);return(e,n)=>{let r=t(e,n);return n?.onExit&&r.addObserver(n.onExit),e=>r.interruptUnsafe(e)}},Tu=wu(R()),Eu=e=>{let t=xu(e);return(e,n)=>{let r=t(e,n);return new Promise(e=>{r.addObserver(t=>e(t))})}},Du=Eu(R()),Ou=e=>{let t=Eu(e);return(e,n)=>t(e,n).then(e=>{if(e._tag===`Failure`)throw Xa(e.cause);return e.value})},ku=Ou(R()),Au=e=>{let t=xu(e);return e=>{if(Z(e))return e;let n=new Bi(`sync`),r=t(e,{scheduler:n});return r._dispatcher?.flush(),r._exit??$t(new kd(r))}},ju=Au(R()),Mu=e=>{let t=Au(e);return e=>{let n=t(e);if(n._tag===`Failure`)throw Xa(n.cause);return n.value}},Nu=Mu(R()),Pu=U(!0),Fu=U(!1);var Iu=class{waiters=[];scheduled=void 0;_isOpen;constructor(e){this._isOpen=e}scheduleUnsafe(e){if(this.waiters.length===0)return Pu;if(this.scheduled===void 0)this.scheduled=this.waiters,e.currentDispatcher.scheduleTask(this.flushScheduled,0);else for(let e=0;e<this.waiters.length;e++)this.scheduled.push(this.waiters[e]);return this.waiters=[],Pu}flushScheduled=()=>{if(this.scheduled===void 0)return;let e=this.scheduled;this.scheduled=void 0;for(let t=0;t<e.length;t++)e[t]($)};flushWaiters(){let e=this.waiters;this.waiters=[],this.flushScheduled();for(let t=0;t<e.length;t++)e[t]($)}open=j(e=>this._isOpen?Fu:(this._isOpen=!0,this.scheduleUnsafe(e)));release=j(e=>this._isOpen?Fu:this.scheduleUnsafe(e));openUnsafe(){return!this._isOpen&&(this._isOpen=!0,this.flushWaiters(),!0)}await=Y(e=>this._isOpen?e(J):(this.waiters.push(e),K(()=>{let t=this.waiters.indexOf(e);t===-1?this.scheduled!==void 0&&(t=this.scheduled.indexOf(e),t!==-1&&this.scheduled.splice(t,1)):this.waiters.splice(t,1)})));closeUnsafe(){return this._isOpen?(this._isOpen=!1,!0):!1}close=K(()=>this.closeUnsafe());whenOpen=e=>X(this.await,()=>e);isOpen(){return this._isOpen}};const Lu=e=>new Iu(e??!1),Ru=j(e=>U(e.getRef(fa))),zu=r(2,(e,t)=>Qs(e,fa,t)),Bu=Qs(ga),Vu=Qs(_a),Hu=BigInt(0),Uu={_tag:`Span`,spanId:`noop`,traceId:`noop`,sampled:!1,status:{_tag:`Ended`,startTime:Hu,endTime:Hu,exit:$},attributes:new Map,links:[],kind:`internal`,attribute(){},event(){},end(){},addLinks(){}},Wu=e=>Object.assign(Object.create(Uu),e),Gu=e=>e?qr(e.annotations,ca)?e._tag===`Span`?Gu(qn(e.parent)):M():N(e):M(),Ku=(e,t,n)=>{let r=!e.getRef(ga)||n?.annotations&&qr(n.annotations,ca),i=n?.parent===void 0?n?.root?M():Gu(e.currentSpan):N(n.parent),a;if(r)a=Wu({name:t,parent:i,annotations:z(n?.annotations??R(),ca,!0)});else{let r=e.getRef(fa),o=e.getRef(ld),s=e.getRef(_a),c=e.getRef(va),l=e.getRef(ya),u=n?.level??e.getRef(la),ee=n?.links===void 0?l.length===0?[]:l.slice():[...l,...n.links];a=r.span({name:t,parent:i,annotations:n?.annotations??R(),links:ee,startTime:s?o.currentTimeNanosUnsafe():BigInt(0),kind:n?.kind??`internal`,root:n?.root??P(i),sampled:n?.sampled??(Hn(i)&&i.value.sampled===!1?!1:!Pd(e.getRef(ua),u))});for(let e in c)a.attribute(e,c[e]);if(n?.attributes!==void 0)for(let e in n.attributes)a.attribute(e,n.attributes[e])}return a},qu=(e,t)=>j(n=>U(Ku(n,e,t))),Ju=(e,t)=>Fl(j(n=>{let r=Kr(n.context,nl),i=Ku(n,e,t??{}),a=n.getRef(ld),o=n.getRef(_a);return $o(cl(r,e=>ed(i,e,a,o)),i)})),Yu=function(){let e=typeof arguments[0]!=`string`,t=e?arguments[1]:arguments[0],n=Da(e?arguments[2]:arguments[1]);if(e){let e=arguments[0];return X(Ju(t,n),t=>rd(e,t,n))}return e=>X(Ju(t,n),t=>rd(e,t,n))},Xu=(e,t)=>(t=typeof t==`function`?t:l,Gs(ha,n=>({name:e,stack:t,parent:n}))),Zu=va,Qu=ya,$u=r(e=>D(e[0]),(e,t,n={})=>{let r=(Array.isArray(t)?t:[t]).map(e=>({span:e,attributes:n}));return Gs(e,ya,e=>[...e,...r])}),ed=(e,t,n,r)=>K(()=>{e.status._tag!==`Ended`&&e.end(r?n.currentTimeNanosUnsafe():Hu,t)}),td=(e,...t)=>{let n=t.length===1?void 0:t[0],r=t[t.length-1];return j(t=>{let i=Ku(t,e,n),a=t.getRef(ld),o=t.getRef(_a);return xl(x(()=>r(i)),e=>ed(i,e,a,o))})},nd=Qs(oa),rd=function(){let e=D(arguments[0]),t=e?arguments[1]:arguments[0],n=e?arguments[2]:arguments[1],r=i;return t._tag===`Span`&&(n=Da(n),r=Xu(t.name,n?.captureStackTrace)),e?nd(r(arguments[0]),t):e=>nd(r(e),t)},id=function(){let e=typeof arguments[0]!=`string`,t=e?arguments[1]:arguments[0],n=Da(arguments[2]);if(e){let e=arguments[0];return td(t,arguments[2],t=>rd(e,t,n))}let r=typeof arguments[1]==`function`?arguments[1]:void 0,i=r?void 0:arguments[1];return(e,...a)=>td(t,r?r(...a):i,t=>rd(e,t,n))},ad=r(e=>D(e[0]),(e,...t)=>Gs(e,va,e=>{let n=t.length===1?{...e,...t[0]}:{...e};return t.length===1||et(n,t[0],t[1]),n})),od=(...e)=>j(t=>{let n=t.currentSpanLocal;if(n){if(e.length===1)for(let[t,r]of Object.entries(e[0]))n.attribute(t,r);else n.attribute(e[0],e[1])}return J}),sd=j(e=>{let t=e.currentSpanLocal;return t?U(t):G(new on)}),cd=Us(oa),ld=B(`effect/Clock`,{defaultValue:()=>new dd}),ud=2**31-1;var dd=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=K(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return md()}currentTimeNanos=K(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return pd()}monotonicTimeNanos=K(()=>this.monotonicTimeNanosUnsafe());sleep(e){return this.sleepMillis(Di(e))}sleepMillis(e){return e<=0?Oo:Number.isFinite(e)?Y(t=>{let n=e>ud?this.sleepMillis(e-ud):J,r=setTimeout(()=>t(n),Math.min(e,ud));return K(()=>clearTimeout(r))}):Uo}};const fd=BigInt(1e6),pd=function(){let e=globalThis.process?.hrtime;if(typeof e?.bigint==`function`)return()=>e.bigint();if(typeof performance<`u`&&typeof performance.now==`function`)return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(0);return()=>{let e=BigInt(Date.now())*fd;return e>t&&(t=e),t}}(),md=function(){let e=BigInt(1e9),t;return()=>{let n=pd(),r=BigInt(Date.now())*fd;if(t===void 0)t=r-n;else{let i=t+n;(r>i?r-i:i-r)>e&&(t=r-n)}return t+n}}(),hd=e=>j(t=>e(t.getRef(ld))),gd=e=>hd(t=>t.sleep(ui(e))),_d=hd(e=>e.currentTimeMillis),vd=`~effect/Cause/TimeoutError`,yd=e=>p(e,vd);var bd=class extends nn(`TimeoutError`){[vd]=vd;constructor(e){super({message:e})}};const xd=`~effect/Cause/IllegalArgumentError`,Sd=e=>p(e,xd);var Cd=class extends nn(`IllegalArgumentError`){[xd]=xd;constructor(e){super({message:e})}};const wd=`~effect/Cause/ExceededCapacityError`,Td=e=>p(e,wd);var Ed=class extends nn(`ExceededCapacityError`){[wd]=wd;constructor(e){super({message:e})}};const Dd=`~effect/Cause/AsyncFiberError`,Od=e=>p(e,Dd);var kd=class extends nn(`AsyncFiberError`){[Dd]=Dd;constructor(e){super({message:`An asynchronous Effect was executed with Effect.runSync`,fiber:e})}};const Ad=`~effect/Cause/UnknownError`,jd=e=>p(e,Ad);var Md=class extends nn(`UnknownError`){[Ad]=Ad;constructor(e,t){super({message:t,cause:e})}};const Nd=B(`effect/Console/CurrentConsole`,{defaultValue:()=>globalThis.console}),Pd=Rn(Fn(Nn,e=>{switch(e){case`All`:return-(2**53-1);case`Fatal`:return 5e4;case`Error`:return 4e4;case`Warn`:return 3e4;case`Info`:return 2e4;case`Debug`:return 1e4;case`Trace`:return 0;case`None`:return 2**53-1}})),Fd=B(`effect/Loggers/CurrentLoggers`,{defaultValue:()=>new Set([Gd,Kd])}),Id=B(`effect/Logger/LogToStderr`,{defaultValue:s}),Ld=function(){let e=typeof arguments[0]==`string`?[[arguments[0],arguments[1]]]:Object.entries(arguments[0]);return Fl(j(t=>{let n=t.getRef(ba),r={...n};for(let t=0;t<e.length;t++){let[n,i]=e[t];et(r,n,i)}return t.setContext(z(t.context,ba,r)),cl(Kr(t.context,nl),r=>{let i=t.getRef(ba),a={...i};for(let t=0;t<e.length;t++){let[r,o]=e[t];i[r]===o&&(Object.hasOwn(n,r)?et(a,r,n[r]):delete a[r])}return t.setContext(z(t.context,ba,a)),J})}))},Rd={"~effect/Logger":{_Message:i,_Output:i},pipe(){return e(this,arguments)}},zd=e=>{let t=Object.create(Rd);return t.log=e,t},Bd=e=>e.replace(/[\s="]/g,`_`),Vd=(e,t)=>`${Bd(e[0])}=${t-e[1]}ms`,Hd=e=>(...t)=>{let n;for(let e=0,r=t.length;e<r;e++){let r=t[e];jt(r)&&(n?t.splice(e,1):t=t.slice(0,e).concat(t.slice(e+1)),n=n?Rt(n.reasons.concat(r.reasons)):r,e--)}return n===void 0&&(n=zt),j(r=>{let i=e??r.currentLogLevel;if(Pd(r.minimumLogLevel,i))return J;let a=r.getRef(ld),o=r.getRef(Fd);if(o.size>0){let e=new Date(a.currentTimeMillisUnsafe());for(let a of o)a.log({cause:n,fiber:r,date:e,logLevel:i,message:t})}return J})},Ud={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};Ud.gray,Ud.blue,Ud.green,Ud.yellow,Ud.red,Ud.bgBrightRed,Ud.black;const Wd=e=>`${e.getHours().toString().padStart(2,`0`)}:${e.getMinutes().toString().padStart(2,`0`)}:${e.getSeconds().toString().padStart(2,`0`)}.${e.getMilliseconds().toString().padStart(3,`0`)}`,Gd=zd(({cause:e,date:t,fiber:n,logLevel:r,message:i})=>{let a=Array.isArray(i)?i.slice():[i];e.reasons.length>0&&a.push(ao(e));let o=t.getTime(),s=n.getRef(Ca),c=``;for(let e of s)c+=` ${Vd(e,o)}`;let l=n.getRef(ba);Object.keys(l).length>0&&a.push(l);let u=n.getRef(Nd);(n.getRef(Id)?u.error:u.log)(`[${Wd(t)}] ${r.toUpperCase()} (#${n.id})${c}:`,...a)}),Kd=zd(({cause:e,fiber:t,logLevel:n,message:r})=>{let i=t.getRef(ld),a=t.getRef(ba),o=t.currentSpan;if(o===void 0||o._tag===`ExternalSpan`)return;let s={};for(let[e,t]of Object.entries(a))et(s,e,t);s[`effect.fiberId`]=t.id,s[`effect.logLevel`]=n.toUpperCase(),e.reasons.length>0&&(s[`effect.cause`]=ao(e)),o.event(_t(Array.isArray(r)&&r.length===1?r[0]:r),i.currentTimeNanosUnsafe(),s)});function qd(){ho.interruptChildren??=_o}const Jd=U(void 0),Yd=r(e=>D(e[0]),(e,t)=>Tl(e,e=>j(n=>(Xd(n,e,t?.defectsOnly),J)))),Xd=(e,t,n)=>{let r=e.getRef(ma);if(r.size===0||n&&!Ia(t))return;let i={cause:t,fiber:e,timestamp:e.getRef(ld).currentTimeNanosUnsafe()};r.forEach(e=>e.report(i))};export{Za as $,N as $a,ba as $i,ms as $n,v as $o,sl as $r,La as $t,jl as A,_r as Aa,Jd as Ai,Pc as An,k as Ao,ls as Ar,As as At,pc as B,Xn as Ba,ic as Bi,yd as Bn,j as Bo,ku as Br,zo as Bt,$o as C,gr as Ca,Zc as Ci,Wo as Cn,zt as Co,Zs as Cr,i as Cs,Rs as Ct,pu as D,dr as Da,jo as Di,za as Dn,$t as Do,cs as Dr,n as Ds,vs as Dt,vu as E,ur as Ea,Ru as Ei,Na as En,fn as Eo,ec as Er,ee as Es,Ds as Et,uc as F,er as Fa,Gs as Fi,Od as Fn,D as Fo,Lc as Fr,Ps as Ft,fc as G,P as Ga,Yu as Gi,Hd as Gn,b as Go,ju as Gr,cu as Gt,Ec as H,Wn as Ha,Yd as Hi,ru as Hn,vt as Ho,Eu as Hr,Bo as Ht,mc as I,tr as Ia,Ks as Ii,Td as In,Ot as Io,Tu as Ir,G as It,Va as J,Jn as Ja,Vu as Ji,qu as Jn,ut as Jo,as as Jr,ou as Jt,Ka as K,Vn as Ka,zu as Ki,ja as Kn,ft as Ko,Au as Kr,lu as Kt,_s as L,nr as La,td as Li,qc as Ln,Wt as Lo,wu as Lr,W as Lt,Y as M,rr as Ma,Vl as Mi,Pl as Mn,Mt as Mo,Kl as Mr,js as Mt,cc as N,L as Na,Dc as Ni,Bl as Nn,Gt as No,ac as Nr,Fs as Nt,fu as O,fr as Oa,Lo as Oi,Wa as On,Qt as Oo,os as Or,e as Os,Ss as Ot,dc as P,$n as Pa,Ws as Pi,Hl as Pn,cn as Po,oc as Pr,$ as Pt,ao as Q,M as Qa,nc as Qi,gs as Qn,y as Qo,rl as Qr,Ra as Qt,Sc as R,F as Ra,ql as Ri,Sd as Rn,Kt as Ro,Cu as Rr,Mo as Rt,ad as S,sr as Sa,$c as Si,To as Sn,Ht as So,Io as Sr,d as Ss,zs as St,is as T,yr as Ta,Xc as Ti,Ia as Tn,Rt as To,Qs as Tr,ne as Ts,ks as Tt,Cc as U,Kn as Ua,rd as Ui,mu as Un,ht as Uo,Ou as Ur,bo as Ut,Tc as V,Gn as Va,Ql as Vi,jd as Vn,x as Vo,Du as Vr,vo as Vt,wc as W,qn as Wa,id as Wi,$u as Wn,gt as Wo,Nu as Wr,Su as Wt,Ha as X,Yn as Xa,Do as Xi,Q as Xn,Ye as Xo,ll as Xr,au as Xt,Ma as Y,Qn as Ya,Oo as Yi,Ju as Yn,et as Yo,ml as Yr,su as Yt,Ja as Z,Un as Za,tc as Zi,kc as Zn,Je as Zo,cl as Zr,rc as Zt,yl as _,zr as _a,_c as _i,_u as _n,rn as _o,Ol as _r,ue as _s,bs as _t,Ed as a,Ki as aa,Hs as ai,Ba as an,Ln as ao,Rc as ar,p as as,sd as at,od as b,$r as ba,vc as bi,Eo as bn,C as bo,jc as br,a as bs,Ts as bt,xd as c,bi as ca,Zu as ci,fs as cn,At as co,Vc as cr,me as cs,No as ct,Md as d,B as da,Ao as di,Jo as dn,un as do,Dl as dr,de as ds,Nc as dt,Ca as ea,fl as ei,H as en,Pn as eo,Oc as er,g as es,Xa as et,Ad as f,Tr as fa,ko as fi,Go as fn,sn as fo,El as fr,ae as fs,Gc as ft,kl as g,Kr as ga,hc as gi,hu as gn,on as go,bl as gr,_e as gs,Cs as gt,vl as h,Wr as ha,rs as hi,sc as hn,Lt as ho,Cl as hr,ie as hs,ws as ht,du as i,Gi as ia,Vs as ii,Xl as in,Bn as io,Wc as ir,m as is,cd as it,Ml as j,I as ja,Fl as ji,Fc as jn,jt as jo,Ga as jr,Ms as jt,Nl as k,vr as ka,Fo as ki,eu as kn,A as ko,ss as kr,ys as kt,bd as l,Mi as la,Qu as li,ps as ln,kt as lo,Uo as lr,fe as ls,Z as lt,Al as m,qr as ma,K as mi,$l as mn,tn as mo,wl as mr,ce as ms,Ls as mt,Dd as n,Yi as na,gl as ni,Pa as nn,Nn as no,Hc as nr,Se as ns,qs as nt,wd as o,Ii as oa,Xs as oi,Mc as on,zn as oo,ds as or,oe as os,_d as ot,Ul as p,z as pa,q as pi,Xo as pn,S as po,xl as pr,ge as ps,Is as pt,qa as q,Hn as qa,Bu as qi,Lu as qn,dt as qo,Mu as qr,uu as qt,Fd as r,Wi as ra,_l as ri,Jl as rn,Rn as ro,Bc as rr,_ as rs,Ys as rt,Cd as s,ui as sa,gd as si,X as sn,Mn as so,Uc as sr,le as ss,Yc as st,kd as t,Xi as ta,nl as ti,Fa as tn,In as to,hs as tr,h as ts,hd as tt,vd as u,_i as ua,U as ui,ts as un,Vt as uo,Tl as ur,pe as us,Sl as ut,Wl as v,Hr as va,gc as vi,yu as vn,Tt as vo,Ic as vr,he as vs,xs as vt,es as w,br as wa,Qc as wi,fo as wn,Bt as wo,hl as wr,te as ws,Os as wt,Ld as x,Cr as xa,yc as xi,wo as xn,Ut as xo,Gl as xr,r as xs,Bs as xt,ns as y,Qr as ya,bc as yi,bu as yn,Et as yo,Ac as yr,o as ys,Es as yt,xc as z,Zn as za,J as zi,Jc as zn,an as zo,xu as zr,Po as zt};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{warmRuntimeAfterStart as e}from"@systemfsoftware/omp-utils/runtime-lifecycle";const t=()=>import(`./HookRuntime-
|
|
1
|
+
import{warmRuntimeAfterStart as e}from"@systemfsoftware/omp-utils/runtime-lifecycle";const t=()=>import(`./HookRuntime-CyLjP9es.js`).then(e=>e.t).then(e=>e.default),n={runSafe:async e=>{let[n,r,i,a]=await Promise.all([t(),import(`./Cause-C0nAfay4.js`).then(e=>e.t),import(`./Effect-B9bZOysK.js`).then(e=>e.t),import(`./Exit-BNubcB4u.js`).then(e=>e.t)]),o=await n.runPromise(e.pipe(i.exit));if(a.isFailure(o))throw r.squash(o.cause);return o.value}};async function r(r){let[{HookDispatcherTask:i},{InjectInstructionsTask:a}]=await Promise.all([import(`./HookDispatcherHandler-DpPB8nCL.js`),import(`./InjectInstructionsHandler-afmdXS_K.js`)]);i(r,n),a(r,n),e(e=>r.on(`session_start`,(t,n)=>e(n)),t)}export{r as default};
|
package/dist/inject.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./InjectInstructionsExecutor-Hwi0pEWf.js";export{e as loadReferencedContent};
|
package/package.json
CHANGED
|
@@ -1,50 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/omp-claude-compat",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "2.0
|
|
4
|
+
"version": "2.1.0",
|
|
5
5
|
"author": "Ryan Lee <drdgvhbh@gmail.com>",
|
|
6
6
|
"description": "OMP Claude Code compatibility: dispatch .claude/settings.json hooks + inject CLAUDE.md @-references",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./dist/index.js",
|
|
10
|
+
"./api": "./dist/api.js",
|
|
11
|
+
"./inject": "./dist/inject.js",
|
|
10
12
|
"./package.json": "./package.json"
|
|
11
13
|
},
|
|
12
14
|
"files": [
|
|
13
15
|
"dist"
|
|
14
16
|
],
|
|
15
17
|
"peerDependencies": {
|
|
16
|
-
"@effect/platform-node": "^4.0.0-rc.
|
|
18
|
+
"@effect/platform-node": "^4.0.0-rc.111",
|
|
17
19
|
"@oh-my-pi/pi-coding-agent": "^17.0.5",
|
|
18
|
-
"effect": "4.0.0-rc.
|
|
20
|
+
"effect": "^4.0.0-rc.111"
|
|
19
21
|
},
|
|
20
22
|
"optionalDependencies": {
|
|
21
23
|
"@std/toml": "npm:@jsr/std__toml@^1.0.11",
|
|
22
|
-
"@systemfsoftware/effect-cell-types": "^
|
|
24
|
+
"@systemfsoftware/effect-cell-types": "^4.0.0",
|
|
23
25
|
"@systemfsoftware/omp-utils": "^0.0.0"
|
|
24
26
|
},
|
|
25
27
|
"devDependencies": {
|
|
26
|
-
"@effect/platform-node": "^4.0.0-rc.
|
|
27
|
-
"@effect/platform-node-shared": "^4.0.0-rc.
|
|
28
|
-
"@effect/vitest": "4.0.0-rc.
|
|
28
|
+
"@effect/platform-node": "^4.0.0-rc.111",
|
|
29
|
+
"@effect/platform-node-shared": "^4.0.0-rc.111",
|
|
30
|
+
"@effect/vitest": "4.0.0-rc.111",
|
|
29
31
|
"@oh-my-pi/pi-coding-agent": "^17.0.5",
|
|
30
32
|
"@systemfsoftware/arethetypeswrong-cli": "^1.1.1",
|
|
31
33
|
"@types/node": "^24",
|
|
32
34
|
"@vitest/coverage-v8": "^4",
|
|
33
|
-
"effect": "4.0.0-rc.
|
|
35
|
+
"effect": "4.0.0-rc.111",
|
|
34
36
|
"fast-check": "^4",
|
|
35
37
|
"oxlint": "^1.77.0",
|
|
36
38
|
"rimraf": "^6.1.3",
|
|
37
39
|
"tsdown": "^0.22.14",
|
|
38
40
|
"typescript": "^7",
|
|
39
41
|
"vitest": "^4.1.10",
|
|
40
|
-
"@systemfsoftware/effect-gherkin-spec": "^2.0.
|
|
41
|
-
"@systemfsoftware/effect-
|
|
42
|
-
"@systemfsoftware/effect-schema-vite": "^1.5.
|
|
43
|
-
"@systemfsoftware/effect-schema-law": "^0.8.0",
|
|
44
|
-
"@systemfsoftware/oxlint-config": "^0.1.0",
|
|
42
|
+
"@systemfsoftware/effect-gherkin-spec": "^2.0.1",
|
|
43
|
+
"@systemfsoftware/effect-schema-law": "^0.9.0",
|
|
44
|
+
"@systemfsoftware/effect-schema-vite": "^1.5.4",
|
|
45
45
|
"@systemfsoftware/omp-utils": "^0.0.0",
|
|
46
|
-
"@systemfsoftware/
|
|
47
|
-
"@systemfsoftware/stryker-plugins": "^0.13.
|
|
46
|
+
"@systemfsoftware/effect-memfs": "^1.3.1",
|
|
47
|
+
"@systemfsoftware/stryker-plugins": "^0.13.1",
|
|
48
|
+
"@systemfsoftware/oxlint-config": "^0.1.0",
|
|
49
|
+
"@systemfsoftware/oxlint-plugin-cell-vocabulary": "^1.2.1",
|
|
48
50
|
"@systemfsoftware/tsdown-config": "^0.1.0",
|
|
49
51
|
"@systemfsoftware/tsconfig": "^1.3.3"
|
|
50
52
|
},
|
|
@@ -57,10 +59,10 @@
|
|
|
57
59
|
"provenance": true
|
|
58
60
|
},
|
|
59
61
|
"inlinedDependencies": {
|
|
60
|
-
"@effect/platform-node-shared": "4.0.0-rc.
|
|
62
|
+
"@effect/platform-node-shared": "4.0.0-rc.111",
|
|
61
63
|
"@jsr/std__collections": "1.3.0",
|
|
62
64
|
"@jsr/std__toml": "1.0.11",
|
|
63
|
-
"effect": "4.0.0-rc.
|
|
65
|
+
"effect": "4.0.0-rc.111"
|
|
64
66
|
},
|
|
65
67
|
"repository": {
|
|
66
68
|
"type": "git",
|
package/dist/Cause-BPRKNAWJ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{$ as ee,$t as te,Ao as ne,Ar as re,Bn as ie,Co as ae,Dn as oe,En as se,Fn as ce,Fo as le,Gn as ue,Io as de,J as fe,K as pe,Ln as t,On as n,Oo as r,Pn as i,Po as a,Q as o,Qt as s,So as c,Tn as l,X as u,Y as d,Z as f,a as p,an as m,ao as h,bo as g,c as _,co as v,d as y,do as b,en as x,et as S,f as C,fo as w,io as T,jo as E,ko as D,l as O,n as k,nn as A,o as j,oo as M,po as N,q as P,s as F,so as I,t as L,tn as R,u as z,vo as B,wa as V,xo as me,yo as he,zn as ge}from"./effect-CczU2E3R.js";var _e=e({AsyncFiberError:()=>rt,AsyncFiberErrorTypeId:()=>tt,Done:()=>X,DoneTypeId:()=>Ke,ExceededCapacityError:()=>et,ExceededCapacityErrorTypeId:()=>$e,IllegalArgumentError:()=>Q,IllegalArgumentErrorTypeId:()=>Xe,InterruptorStackTrace:()=>ut,NoSuchElementError:()=>Ge,NoSuchElementErrorTypeId:()=>We,ReasonTypeId:()=>ve,StackTrace:()=>lt,TimeoutError:()=>Ye,TimeoutErrorTypeId:()=>qe,TypeId:()=>H,UnknownError:()=>$,UnknownErrorTypeId:()=>it,annotate:()=>ot,annotations:()=>ct,combine:()=>Ae,die:()=>Te,done:()=>Z,empty:()=>we,fail:()=>W,filterInterruptors:()=>Ve,findDefect:()=>Le,findDie:()=>Ie,findError:()=>q,findErrorOption:()=>Pe,findFail:()=>Ne,findInterrupt:()=>ze,fromReasons:()=>Ce,hasDies:()=>Fe,hasFails:()=>Me,hasInterrupts:()=>Re,hasInterruptsOnly:()=>G,interrupt:()=>Ee,interruptors:()=>Be,isAsyncFiberError:()=>nt,isCause:()=>ye,isDieReason:()=>xe,isDone:()=>Y,isExceededCapacityError:()=>Qe,isFailReason:()=>U,isIllegalArgumentError:()=>Ze,isInterruptReason:()=>Se,isNoSuchElementError:()=>Ue,isReason:()=>be,isTimeoutError:()=>Je,isUnknownError:()=>at,makeDieReason:()=>Oe,makeFailReason:()=>De,makeInterruptReason:()=>ke,map:()=>K,pretty:()=>J,prettyErrors:()=>He,reasonAnnotations:()=>st,squash:()=>je});const H=h,ve=T,ye=r,be=D,U=a,xe=ne,Se=le,Ce=c,we=g,W=me,Te=he,Ee=d,De=e=>new b(e),Oe=e=>new M(e),ke=ue,G=n,K=f,Ae=P,je=S,Me=se,Ne=A,q=x,Pe=R,Fe=l,Ie=te,Le=s,Re=oe,ze=m,Be=u,Ve=fe,He=ee,J=o,Ue=de,We=N,Ge=w,Y=E,Ke=v,X=I,Z=ae,qe=z,Je=ge,Ye=O,Xe=_,Ze=t,Q=F,Qe=ce,$e=j,et=p,tt=k,nt=i,rt=L,it=C,at=ie,$=y,ot=B,st=re,ct=pe;var lt=class extends V()(`effect/Cause/StackTrace`){},ut=class extends V()(`effect/Cause/InterruptorStackTrace`){};export{Z as a,G as c,K as d,J as f,$ as i,Y as l,X as n,W as o,Q as r,q as s,_e as t,U as u};
|
package/dist/Effect-CYgXOp91.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{$i as t,$n as n,$r as r,A as i,Aa as a,Ai as o,An as s,B as c,Bi as l,Bo as u,Br as ee,Bt as te,C as d,Ca as ne,Ci as re,Cn as ie,Cr as ae,D as oe,Da as se,Di as ce,Dr as le,E as ue,Ea as de,Ei as fe,Er as pe,F as me,Fi as he,Fr as ge,G as f,Gi as _e,Gr as ve,Gt as ye,H as be,Hi as xe,Hn as Se,Hr as Ce,Ht as we,I as Te,Ii as Ee,In as De,Ir as Oe,It as p,Ji as ke,Jn as Ae,Jr as je,Jt as Me,Ka as Ne,Ki as Pe,Kr as Fe,Kt as Ie,L as Le,Li as Re,Lo as ze,Lr as Be,Lt as Ve,M as m,Ma as He,Mi as Ue,Mn as We,Mo as h,Mr as Ge,N as Ke,Ni as qe,Nn as Je,Nr as Ye,O as Xe,Oi as Ze,Or as Qe,P as $e,Pi as g,Pr as et,Qi as tt,Qn as nt,Qr as rt,R as it,Ri as _,Rn as at,Rr as ot,Rt as st,S as ct,Sa as lt,Si as ut,Sn as dt,Sr as v,T as ft,Ta as pt,Ti as mt,Tr as ht,Ts as y,U as gt,Ui as _t,Un as vt,Ur as yt,V as bt,Vi as xt,Vr as St,W as Ct,Wi as wt,Wn as b,Wr as Tt,Xi as Et,Xn as Dt,Xr as Ot,Xt as kt,Yi as At,Yn as x,Yr as jt,Yt as Mt,Zi as Nt,Zn as Pt,Zr as Ft,Zt as It,_ as Lt,_a as Rt,_i as zt,_n as Bt,_r as Vt,_s as S,aa as Ht,ai as Ut,ar as Wt,at as Gt,b as Kt,bi as qt,bn as Jt,br as Yt,bs as C,ci as Xt,cn as Zt,cr as Qt,ct as $t,di as en,dn as tn,dr as nn,dt as rn,ea as an,ei as on,er as sn,fi as w,fn as cn,fr as T,ft as ln,g as un,gi as dn,gn as fn,gr as pn,gs as mn,h as hn,ha as gn,hi as _n,hn as vn,ho as yn,hr as bn,i as xn,ia as Sn,ii as Cn,in as wn,ir as Tn,it as En,j as Dn,ja as On,ji as kn,jn as An,jo as jn,jr as Mn,k as Nn,ka as Pn,ki as Fn,kn as In,kr as Ln,li as E,ln as Rn,lo as zn,lr as Bn,m as Vn,mi as Hn,mn as Un,mr as Wn,na as D,ni as Gn,nr as Kn,ns as qn,nt as Jn,oi as Yn,on as Xn,or as Zn,ot as Qn,p as $n,pi as O,pn as er,pr as tr,qa as nr,qi as rr,qn as ir,qr as ar,qt as or,r as sr,ra as cr,ri as lr,rn as ur,rr as dr,rt as fr,si as pr,sn as k,sr as mr,st as hr,ta as gr,ti as _r,tr as vr,tt as A,ui as yr,un as br,ur as xr,ut as Sr,v as Cr,vi as wr,vn as Tr,vr as Er,vs as j,w as Dr,wa as Or,wi as kr,wn as Ar,wo as jr,wr as M,x as Mr,xi as Nr,xn as Pr,xr as Fr,y as Ir,yi as Lr,yn as Rr,yr as zr,z as Br,zi as Vr,zo as Hr,zr as Ur,zt as Wr}from"./effect-CczU2E3R.js";import{a as Gr,l as Kr,s as qr}from"./Cause-BPRKNAWJ.js";import{a as Jr,r as Yr,s as Xr}from"./Exit-Dz81ekW_.js";const Zr={"~effect/Deferred":{_A:C,_E:C},pipe(){return y(this,arguments)}},Qr=()=>{let e=Object.create(Zr);return e.resumes=void 0,e.effect=void 0,e},$r=e=>m(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),O(()=>{let n=e.resumes;if(n===void 0)return;let r=n.indexOf(t);r>=0&&n.splice(r,1)}))),ei=j(2,(e,t)=>O(()=>ri(e,t))),ti=e=>O(()=>ni(e)),ni=e=>e.effect!==void 0,ri=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){for(let n=0;n<e.resumes.length;n++)e.resumes[n](t);e.resumes=void 0}return!0},ii=tt,ai=t,oi=on,si=r,ci=ae,li=jt,N=rt,ui=Ft,di=`~effect/Layer/MemoMap`,fi=(e,t)=>(e.observers++,Ir(Ot(t,t=>e.finalizer(t)),e.effect)),pi={"~effect/Layer":{_ROut:C,_E:C,_RIn:C},pipe(){return y(this,arguments)}},mi=e=>{let t=Object.create(pi);return t.build=e,t},hi=e=>mi((t,n)=>{let r=N(n);return T(e(t,r),e=>e._tag===`Failure`?ui(r,e):_)}),gi=e=>{let t=hi((n,r)=>n.getOrElseMemoize(t,r,e));return t},_i=(e,t,n,r)=>{let i=si(),a=Qr(),o={observers:1,effect:$r(a),finalizer:n=>w(()=>(o.observers--,o.observers===0?(e.map.delete(t),ui(i,n)):_))};return e.map.set(t,o),Ot(n,o.finalizer).pipe(k(()=>r(e,i)),T(e=>(o.effect=e,ei(a,e))))};var vi=class{get[di](){return di}parent;constructor(e){this.parent=e}map=new Map;get(e,t){let n=this.map.get(e);return n?fi(n,t):this.parent?.get(e,t)}getOrElseMemoize(e,t,n){return w(()=>this.get(e,t)||_i(this,e,t,n))}};const yi=()=>new vi,bi=e=>new vi(e);var xi=class e extends Or()(`effect/Layer/CurrentMemoMap`){static forkOrCreate(t){let n=se(t,e);return n?bi(n):yi()}};const P=j(3,(e,t,n)=>M(x(e.build(t,n),pt(xi,t)),xi,t)),Si=j(2,(e,t)=>ze(n=>P(e,xi.forkOrCreate(n.context),t))),Ci=function(){return arguments.length===1?e=>wi(a(arguments[0],e)):wi(a(arguments[0],arguments[1]))},wi=e=>mi(S(E(e))),Ti=function(){return arguments.length===1?e=>Ei(arguments[0],e):Ei(arguments[0],arguments[1])},Ei=(e,t)=>Di(x(t,t=>a(e,t))),Di=e=>gi((t,n)=>ci(e,n)),Oi=(e,t,n)=>{let r=N(n,`parallel`);return Un(e,e=>e.build(t,N(r,`sequential`)),{concurrency:e.length}).pipe(x(e=>He(...e)))},ki=(...e)=>hi((t,n)=>Oi(e,t,n)),Ai=(e,t,n)=>hi((r,i)=>k(Array.isArray(t)?Oi(t,r,i):t.build(r,i),t=>e.build(r,i).pipe(v(t),x(e=>n(e,t))))),ji=j(2,(e,t)=>Ai(e,t,(e,t)=>On(t,e))),Mi=ne(`effect/ExecutionPlan/CurrentMetadata`,{defaultValue:S({attempt:0,stepIndex:0})}),Ni=j(2,(e,t)=>$e(e,Li,e=>t(e))),Pi=e=>e.reasons.some(Fi),Fi=e=>e._tag===`Fail`&&Kr(e.error),Ii=gr(qr,e=>Kr(e)?lt(e):gn(e)),Li=gr(qr,e=>Kr(e)?lt(e.value):gn(e)),Ri=e=>{let t=Ii(e);return Rt(t)?Yr(t.failure):Xr(t.success.value)},zi=j(2,(e,t)=>Tn(e,{onSuccess:t.onSuccess,onFailure:e=>{let n=Ii(e);return Rt(n)?t.onFailure(n.failure):t.onDone(n.success.value)}})),Bi=`~effect/Schedule`,F=ne(`effect/Schedule/CurrentMetadata`,{defaultValue:S({input:void 0,output:void 0,duration:Ht,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),Vi={[Bi]:{_Out:C,_In:C,_Env:C},pipe(){return y(this,arguments)}},Hi=e=>qn(e,Bi),I=e=>{let t=Object.create(Vi);return t.step=e,t},L=()=>{let e=0,t,n;return(r,i)=>{n===void 0&&(n=r);let a=r-n,o=t===void 0?0:r-t;return t=r,{input:i,attempt:++e,start:n,now:r,elapsed:a,elapsedSincePrevious:o}}},Ui=e=>I(x(e,e=>{let t=L();return(n,r)=>e(t(n,r))})),R=e=>Ke(e.step,e=>E(()=>Ve(e))),z=e=>A(t=>x(R(e),e=>{let n=L();return r=>w(()=>{let i=t.currentTimeMillisUnsafe();return k(e(i,r),([e,t])=>{let a=n(i,r);return a.output=e,a.duration=t,d(Yn(t),a)})})})),Wi=e=>I(x(R(e),e=>(t,n)=>zi(e(t,n),{onSuccess:e=>E([n,e[1]]),onFailure:Ve,onDone:()=>Gr(n)}))),Gi=e=>B(qi,({attempt:t})=>E(t<=e)),Ki=e=>{let t=D(e);return Ui(E(e=>E([e.attempt-1,t])))},B=j(2,(e,t)=>I(x(R(e),e=>{let n=L();return(r,i)=>k(e(r,i),e=>{let[a,o]=e,s=t({...n(r,i),output:a,duration:o});return k(h(s)?s:E(s),t=>t?E(e):Gr(a))})}))),qi=Ki(Ht),Ji=(e,t,n)=>Gn(r=>k(n?.local?P(t,yi(),r):Si(t,r),t=>v(e,t))),Yi=j(e=>h(e[0]),(e,t,n)=>Pn(t)?v(e,t):Ji(e,Array.isArray(t)?ki(...t):t,n)),Xi=j(3,(e,t,n)=>k(z(t),t=>{let r=F.defaultValue();return f(vn(Hn(k(w(()=>M(e,F,r)),t),e=>O(()=>{r=e})),{disableYield:!0}),e=>jn(e)?E(e.value):n(e,r.attempt===0?Ne():nr(r)))})),Zi=j(3,(e,t,n)=>k(z(t),t=>{let r=F.defaultValue(),i,a=f(w(()=>M(e,F,r)),e=>(i=e,k(t(e),e=>(r=e,a))));return Ni(a,e=>u(()=>n(i,e)))})),Qi=j(2,(e,t)=>{let n=typeof t==`function`?t(C):Hi(t)?t:H(t);return Xi(e,n,p)}),V=j(2,(e,t)=>{let n=typeof t==`function`?t(C):Hi(t)?t:H(t);return Zi(e,n,p)}),$i=j(3,(e,t,n)=>k(z(n),n=>{let r=F.defaultValue(),i=w(()=>M(e,F,r));return f(k(n(t),e=>{r=e;let t=S(k(i,n));return l({while:mn,body:t,step(e){r=e}})}),e=>jn(e)?E(e.value):p(e))})),ea=Wi(qi),H=e=>{let t=e.schedule?Wi(e.schedule):ea;return e.while&&(t=B(t,({input:t})=>{let n=e.while(t);return h(n)?n:E(n)})),e.until&&(t=B(t,({input:t})=>{let n=e.until(t);return h(n)?x(n,e=>!e):E(!n)})),e.times!==void 0&&(t=B(t,({attempt:t})=>E(t<=e.times))),t},ta=(e,t)=>{let n=-1,r=0,i=t=>s(e(t));return{begin:A(e=>w(()=>{let a=t();a.stepIndex!==n&&(n=a.stepIndex,r=0),r++;let o={attempt:a.attempt,stepAttempt:r,stepIndex:a.stepIndex,startNanos:e.monotonicTimeNanosUnsafe()};return d(i({_tag:`AttemptStart`,attempt:o.attempt,stepAttempt:o.stepAttempt,stepIndex:o.stepIndex}),o)})),end:(e,t)=>A(n=>{let r=cr(n.monotonicTimeNanosUnsafe()-e.startNanos);return i(t._tag===`Success`?{_tag:`AttemptSuccess`,attempt:e.attempt,stepAttempt:e.stepAttempt,stepIndex:e.stepIndex,duration:r}:{_tag:`AttemptFailure`,attempt:e.attempt,stepAttempt:e.stepAttempt,stepIndex:e.stepIndex,duration:r,cause:t.cause})})}},na=j(e=>h(e[0]),(e,t,n)=>w(()=>{let r=0,i={attempt:0,stepIndex:0},a=ht(Mi,O(()=>(i={attempt:i.attempt+1,stepIndex:r},i))),o=n?.onEvent===void 0?void 0:ta(n.onEvent,()=>i),s=o===void 0?C:e=>kn(t=>k(o.begin,n=>T(t(e),e=>o.end(n,e)))),c;return k(l({while:()=>r<t.steps.length&&(c===void 0||Rt(c)),body(){let n=t.steps[r],i=a(s(Yi(e,n.provide)));if(c){let e=!1,t=i;i=w(()=>e?t:(e=!0,dt(c))),i=V(i,ra(n,!1))}else{let e=ra(n,!0);i=e?V(i,e):i}return et(i)},step(e){c=e,r++}}),()=>dt(c))})),ra=(e,t)=>t?e.attempts===1||!(e.schedule||e.attempts)?void 0:H({schedule:e.schedule,while:e.while,times:e.attempts?e.attempts-1:void 0}):H({schedule:e.schedule?e.schedule:e.attempts?void 0:ia,times:e.attempts,while:e.while}),ia=Gi(1);({...yn});const aa=e=>e,oa=j(2,(e,t)=>{let n=t=>m(n=>{let r=ca(t,e,n,Ar());return ua(t,r)});return h(t)?k(t,n):n(t)}),sa=(e,t)=>{let n=ca(t.resolver,e,t.onExit,{context:t.context,currentScheduler:de(t.context,an)});return()=>la(t.resolver,n)},U=[],W=new WeakMap,ca=(e,t,n,r)=>{let i=W.get(e);i||(i=new Map,W.set(e,i));let a,o=!1,s=aa({request:t,context:r.context,uninterruptible:!1,completeUnsafe(e){o||(o=!0,n(e),a?.entrySet.delete(s))}});if(e.preCheck!==void 0&&!e.preCheck(s))return s;let c=e.batchKey(s);if(a=i.get(c),!a){if(U.length>0)a=U.pop(),a.key=c,a.resolver=e,a.map=i;else{let t={key:c,resolver:e,map:i,entrySet:new Set,entries:new Set,delayEffect:k(w(()=>t.resolver.delay),e=>da(t)),run:T(w(()=>t.resolver.runAll(Array.from(t.entries),t.key)),e=>{for(let n of t.entrySet)n.completeUnsafe(e._tag===`Success`?jr(Error(`Effect.request: RequestResolver did not complete request`,{cause:n.request})):e);return t.entries.clear(),U.length<128&&(t.entrySet.clear(),t.key=void 0,t.fiber=void 0,t.resolver=void 0,t.map=void 0,U.push(t)),_})};a=t}i.set(c,a),a.fiber=ot(r.context)(a.delayEffect,{scheduler:r.currentScheduler})}return a.entrySet.add(s),a.entries.add(s),a.resolver.collectWhile(a.entries)?s:(a.fiber.interruptUnsafe(r.id),a.fiber=ot(r.context)(da(a),{scheduler:r.currentScheduler}),s)},la=(e,t)=>{if(t.uninterruptible)return;let n=W.get(e);if(!n)return;let r=e.batchKey(t),i=n.get(r);i&&(i.entries.delete(t),i.entrySet.delete(t),i.entries.size===0&&(n.delete(r),i.fiber?.interruptUnsafe()))},ua=(e,t)=>O(()=>la(e,t));function da(e){return e.map.has(e.key)?(e.map.delete(e.key),e.run):_}const G=j(2,(e,t)=>fr(n=>O(()=>e.updateUnsafe(t,n))));var fa=e({Do:()=>ja,Transaction:()=>$,TypeId:()=>pa,abortSignal:()=>qs,acquireDisposable:()=>Os,acquireRelease:()=>Ds,acquireUseRelease:()=>ks,addFinalizer:()=>As,all:()=>ma,andThen:()=>Ya,annotateCurrentSpan:()=>oc,annotateLogs:()=>Zc,annotateLogsScoped:()=>Qc,annotateSpans:()=>ac,as:()=>eo,asSome:()=>to,asVoid:()=>no,awaitAllChildren:()=>wc,bind:()=>Pa,bindTo:()=>Ma,cached:()=>Rs,cachedInvalidateWithTTL:()=>Bs,cachedWithTTL:()=>zs,callback:()=>J,catch:()=>oo,catchCause:()=>po,catchCauseFilter:()=>yo,catchCauseIf:()=>vo,catchDefect:()=>mo,catchEager:()=>yl,catchFilter:()=>go,catchIf:()=>ho,catchNoSuchElement:()=>_o,catchReason:()=>lo,catchReasons:()=>uo,catchTag:()=>so,catchTags:()=>co,clockWith:()=>Vc,context:()=>fs,contextWith:()=>ps,currentParentSpan:()=>cc,currentSpan:()=>sc,delay:()=>Ho,die:()=>za,effectify:()=>dl,ensuring:()=>js,eventually:()=>ko,exit:()=>Z,fail:()=>Y,failCause:()=>La,failCauseSync:()=>Ra,failSync:()=>Ia,fiber:()=>Tc,fiberId:()=>Ec,filter:()=>Yo,filterMap:()=>Xo,filterMapEffect:()=>Zo,filterMapOrElse:()=>$o,filterMapOrFail:()=>ts,filterOrElse:()=>Qo,filterOrFail:()=>es,findFirst:()=>va,findFirstFilter:()=>ya,firstSuccessOf:()=>Ro,flatMap:()=>X,flatMapEager:()=>vl,flatten:()=>Ja,flip:()=>ro,fn:()=>Bc,fnUntraced:()=>zc,fnUntracedEager:()=>bl,forEach:()=>ba,forever:()=>Js,forkChild:()=>bc,forkDetach:()=>Cc,forkIn:()=>xc,forkScoped:()=>Sc,fromNullishOr:()=>qa,fromOption:()=>Ga,fromResult:()=>Wa,gen:()=>Fa,ignore:()=>No,ignoreCause:()=>Po,interrupt:()=>Vs,interruptible:()=>Hs,interruptibleMask:()=>Ks,isEffect:()=>K,isFailure:()=>us,isSuccess:()=>ds,let:()=>Na,linkSpans:()=>dc,log:()=>Uc,logDebug:()=>Jc,logError:()=>Kc,logFatal:()=>Wc,logInfo:()=>qc,logTrace:()=>Yc,logWarning:()=>Gc,logWithLevel:()=>Hc,makeSpan:()=>fc,makeSpanScoped:()=>pc,map:()=>$a,mapBoth:()=>xo,mapBothEager:()=>_l,mapEager:()=>hl,mapError:()=>bo,mapErrorEager:()=>gl,match:()=>rs,matchCause:()=>as,matchCauseEager:()=>os,matchCauseEffect:()=>cs,matchCauseEffectEager:()=>ss,matchEager:()=>is,matchEffect:()=>ls,never:()=>Aa,onError:()=>Ms,onErrorFilter:()=>Ps,onErrorIf:()=>Ns,onExit:()=>Q,onExitFilter:()=>Ls,onExitIf:()=>Is,onExitPrimitive:()=>Fs,onInterrupt:()=>Us,option:()=>Qa,orDie:()=>So,orElseSucceed:()=>Lo,partition:()=>ha,promise:()=>Sa,provide:()=>ms,provideContext:()=>hs,provideService:()=>Ss,provideServiceEffect:()=>Cs,race:()=>qo,raceAll:()=>Go,raceAllFirst:()=>Ko,raceFirst:()=>Jo,reduce:()=>ga,repeat:()=>Ys,repeatOrElse:()=>Xs,replicate:()=>Zs,replicateEffect:()=>Qs,request:()=>vc,requestUnsafe:()=>yc,result:()=>Za,retry:()=>Ao,retryOrElse:()=>jo,runCallback:()=>Ac,runCallbackWith:()=>kc,runFork:()=>Dc,runForkWith:()=>Oc,runPromise:()=>jc,runPromiseExit:()=>Nc,runPromiseExitWith:()=>Pc,runPromiseWith:()=>Mc,runSync:()=>Fc,runSyncExit:()=>Lc,runSyncExitWith:()=>Rc,runSyncWith:()=>Ic,sandbox:()=>Mo,satisfiesErrorType:()=>pl,satisfiesServicesType:()=>ml,satisfiesSuccessType:()=>fl,schedule:()=>$s,scheduleFrom:()=>ec,scope:()=>ws,scoped:()=>Ts,scopedWith:()=>Es,service:()=>_s,serviceOption:()=>vs,setContext:()=>gs,sleep:()=>Uo,spanAnnotations:()=>lc,spanLinks:()=>uc,succeed:()=>wa,succeedNone:()=>Ta,succeedSome:()=>Ea,suspend:()=>Da,sync:()=>Oa,tap:()=>Xa,tapCause:()=>To,tapCauseFilter:()=>Do,tapCauseIf:()=>Eo,tapDefect:()=>Oo,tapError:()=>Co,tapErrorTag:()=>wo,timed:()=>Wo,timeout:()=>zo,timeoutOption:()=>Bo,timeoutOrElse:()=>Vo,tracer:()=>tc,track:()=>el,trackDefects:()=>rl,trackDuration:()=>il,trackErrors:()=>nl,trackSuccesses:()=>tl,transposeOption:()=>Ka,try:()=>Ba,tryPromise:()=>Ca,tx:()=>al,txRetry:()=>ul,undefined:()=>ka,uninterruptible:()=>Ws,uninterruptibleMask:()=>Gs,unwrapReason:()=>fo,updateContext:()=>ys,updateService:()=>bs,updateServiceScoped:()=>xs,useSpan:()=>mc,validate:()=>_a,void:()=>q,when:()=>ns,whileLoop:()=>xa,withErrorReporting:()=>Io,withExecutionPlan:()=>Fo,withFiber:()=>Ua,withLogSpan:()=>$c,withLogger:()=>Xc,withParentSpan:()=>_c,withSpan:()=>hc,withSpanScoped:()=>gc,withTracer:()=>nc,withTracerEnabled:()=>rc,withTracerTiming:()=>ic,yieldNow:()=>Va,yieldNowWith:()=>Ha,zip:()=>io,zipWith:()=>ao});const pa=zn,K=h,ma=Cr,ha=Yt,ga=Mn,_a=Re,va=ur,ya=wn,ba=Un,xa=l,Sa=Fr,Ca=ce,wa=E,Ta=yr,Ea=en,Da=w,Oa=O,q=_,ka=Fn,J=m,Aa=Qt,ja=xn,Ma=Xe,Na=Se,Pa=oe,Fa=ie,Y=p,Ia=Wr,La=Ve,Ra=st,za=$t,Ba=Ze,Va=ke,Ha=At,Ua=ze,Wa=dt,Ga=Pr,Ka=fe,qa=Jt,X=k,Ja=Rn,Ya=Ir,Xa=Hn,Za=et,Qa=Vt,Z=ln,$a=x,eo=d,to=Dr,no=ft,ro=br,io=Et,ao=Nt,oo=f,so=gt,co=Ct,lo=bt,uo=be,fo=Ue,po=Ke,mo=Te,ho=Br,go=it,_o=c,vo=me,yo=$e,bo=n,xo=Dt,So=Er,Co=Lr,wo=qt,To=_n,Eo=zt,Do=dn,Oo=wr,ko=rn,Ao=V,jo=Zi,Mo=ar,No=In,Po=s,Fo=na,Io=xt,Lo=zr,Ro=Xn,zo=ut,Bo=re,Vo=kr,Ho=hr,Uo=Yn,Wo=Nr,Go=le,Ko=Qe,qo=pe,Jo=Ln,Yo=ye,Xo=Ie,Zo=or,Qo=kt,$o=Me,es=It,ts=Mt,ns=Vr,rs=vr,is=Zn,as=Kn,os=dr,ss=Wt,cs=Tn,ls=mr,us=De,ds=at,fs=Jn,ps=fr,ms=Yi,hs=v,gs=Ut,_s=lr,vs=Cn,ys=qe,bs=g,xs=he,Ss=M,Cs=ht,ws=je,Ts=_r,Es=Gn,Ds=hn,Os=Vn,ks=un,As=Lt,js=Sr,Ms=Bn,Ns=nn,Ps=xr,Fs=bn,Q=T,Is=Wn,Ls=tr,Rs=Nn,zs=Dn,Bs=i,Vs=An,Hs=We,Us=pn,Ws=o,Gs=kn,Ks=Je,qs=$n,Js=vn,Ys=Qi,Xs=Xi,Zs=Ge,Qs=Ye,$s=j(2,(e,t)=>ec(e,void 0,t)),ec=$i,tc=mt,nc=_e,rc=Pe,ic=rr,ac=ct,oc=Kt,sc=Gt,cc=En,lc=pr,uc=Xt,dc=vt,fc=ir,pc=Ae,mc=Ee,hc=_t,gc=wt,_c=xe,vc=oa,yc=sa,bc=fn,xc=Tr,Sc=Rr,Cc=Bt,wc=ue,Tc=te,Ec=we,Dc=Be,Oc=ot,kc=Oe,Ac=ge,jc=Ur,Mc=Ce,Nc=ee,Pc=St,Fc=yt,Ic=Fe,Lc=Tt,Rc=ve,zc=cn,Bc=tn,Vc=A,Hc=b,Uc=b(),Wc=b(`Fatal`),Gc=b(`Warn`),Kc=b(`Error`),qc=b(`Info`),Jc=b(`Debug`),Yc=b(`Trace`),Xc=j(2,(e,t)=>g(e,sr,e=>new Set([...e,t]))),Zc=j(e=>K(e[0]),(e,...t)=>g(e,ii,e=>{let n=t.length===1?{...e,...t[0]}:{...e};return t.length===1||Hr(n,t[0],t[1]),n})),Qc=Mr,$c=j(2,(e,t)=>k(Qn,n=>g(e,ai,e=>[[t,n],...e]))),el=j(e=>K(e[0]),(e,t,n)=>Q(e,e=>{let r=n===void 0?e:u(()=>n(e));return G(t,r)})),tl=j(e=>K(e[0]),(e,t,n)=>Xa(e,e=>{let r=n===void 0?e:n(e);return G(t,r)})),nl=j(e=>K(e[0]),(e,t,n)=>Co(e,e=>{let r=n===void 0?e:u(()=>n(e));return G(t,r)})),rl=j(e=>K(e[0]),(e,t,n)=>Oo(e,e=>{let r=n===void 0?e:u(()=>n(e));return G(t,r)})),il=j(e=>K(e[0]),(e,t,n)=>Vc(r=>{let i=r.monotonicTimeNanosUnsafe();return Q(e,()=>{let e=r.monotonicTimeNanosUnsafe(),a=Sn(D(e),D(i)),o=n===void 0?a:u(()=>n(a));return G(t,o)})}));var $=class extends Or()(`effect/Effect/Transaction`){};const al=e=>Ua(t=>{if(t.context.mapUnsafe.has($.key))return e;let n={journal:new Map,retry:!1},r;return Gs(i=>X(xa({while:()=>!r,body:S(i(e).pipe(Ss($,n),To(()=>n.retry?i(sl(n)):q),Z)),step(e){if(n.retry||!ol(n))return ll(n);Jr(e)?cl(t,n):ll(n),r=e}}),()=>r))}),ol=e=>{for(let[t,{version:n}]of e.journal)if(t.version!==n)return!1;return!0},sl=e=>Da(()=>{let t={},n=Array.from(e.journal.keys()),r=()=>{for(let e of n)e.pending.delete(t)};return J(e=>{let i=()=>{r(),e(q)};for(let e of n)e.pending.set(t,i);return Oa(r)})});function cl(e,t){for(let[n,{value:r}]of t.journal){r!==n.value&&(n.version+=1,n.value=r);for(let t of n.pending.values())e.currentDispatcher.scheduleTask(t,0);n.pending.clear()}}function ll(e){e.retry=!1,e.journal.clear()}const ul=X($,e=>(e.retry=!0,Vs)),dl=(e,t,n)=>(...r)=>J(i=>{try{e(...r,(e,n)=>{i(e?Y(t?t(e,r):e):wa(n))})}catch(e){i(n?Y(n(e,r)):za(e))}}),fl=()=>e=>e,pl=()=>e=>e,ml=()=>e=>e,hl=nt,gl=sn,_l=Pt,vl=Zt,yl=Le,bl=er;export{Oc as $,Sc as A,zi as At,gl as B,N as Bt,Bc as C,Gs as Ct,Js as D,Ni as Dt,ba as E,Ua as Et,Gc as F,ji as Ft,So as G,ti as Gt,ls as H,ci as Ht,$a as I,Ci as It,Jo as J,Lo as K,Qr as Kt,_l as L,oi as Lt,Fa as M,Ti as Mt,No as N,yi as Nt,Cc as O,Ri as Ot,Hs as P,ki as Pt,Dc as Q,hl as R,li as Rt,Ja as S,Ba as St,bl as T,xa as Tt,Ms as U,$r as Ut,as as V,si as Vt,Q as W,ri as Wt,Ac as X,Za as Y,kc as Z,Y as _,To as _t,Ya as a,Lc as at,X as b,Vo as bt,J as c,ws as ct,yl as d,vs as dt,jc as et,so as f,wa as ft,Z as g,Xa as gt,dl as h,Oa as ht,ma as i,Fc as it,Wa as j,P as jt,xc as k,Pi as kt,po as l,Ts as lt,za as m,Da as mt,Ds as n,Pc as nt,eo as o,Rc as ot,oo as p,Ta as pt,hs as q,As as r,Mc as rt,no as s,Ic as st,fa as t,Nc as tt,mo as u,Es as ut,La as v,zo as vt,zc as w,q as wt,vl as x,Ca as xt,Ra as y,Bo as yt,bo as z,ui as zt};
|
package/dist/Exit-Dz81ekW_.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{At as t,Ct as n,Do as r,Dt as ee,Eo as i,Et as a,Mt as o,No as s,Nt as c,Ot as l,Pt as u,St as d,To as f,Tt as p,_t as m,bt as h,gt as g,ht as _,jt as v,kt as y,mt as b,pt as x,vt as S,wo as C,wt as w,xt as T,yt as E}from"./effect-CczU2E3R.js";var D=e({asVoid:()=>X,asVoidAll:()=>Z,die:()=>M,fail:()=>j,failCause:()=>A,filterCause:()=>U,filterFailure:()=>H,filterSuccess:()=>B,filterValue:()=>V,findDefect:()=>G,findError:()=>W,findErrorOption:()=>te,getCause:()=>$,getSuccess:()=>Q,hasDies:()=>R,hasFails:()=>L,hasInterrupts:()=>z,interrupt:()=>N,isExit:()=>O,isFailure:()=>I,isSuccess:()=>F,map:()=>q,mapBoth:()=>Y,mapError:()=>J,match:()=>K,succeed:()=>k,void:()=>P});const O=s,k=r,A=i,j=f,M=C,N=ee,P=u,F=y,I=l,L=p,R=w,z=a,B=m,V=S,H=g,U=_,W=h,G=E,K=c,q=t,J=o,Y=v,X=x,Z=b,Q=n,$=d,te=T;export{F as a,P as c,I as i,j as n,K as o,A as r,k as s,D as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Ra as e,_a as t}from"./effect-CczU2E3R.js";import{M as n,Y as r,yt as i}from"./Effect-CYgXOp91.js";import{F as a,M as o,N as s,P as c,c as l,f as u,g as d,i as f,j as p,k as m,n as h,o as g,u as _}from"./RunUserPromptSubmitHooksExecutor-C-kpE1OB.js";import{homedir as v}from"node:os";const y=e=>n(function*(){return yield*a(e).pipe(c(`ToolCall`,({event:e,ctx:t})=>n(function*(){let n=yield*m(o(v(),t.cwd));if(n)return yield*_(n,e,t)})),c(`ToolResult`,({event:e,ctx:t})=>n(function*(){let n=yield*m(o(v(),t.cwd));if(!n)return;let r=yield*f(n,e,t);if(r.warning!==void 0)return{content:[...e.content,{type:`text`,text:r.warning}],isError:e.isError}})),c(`Prompt`,({event:e,ctx:t})=>n(function*(){let n=yield*m(o(v(),t.cwd));if(n)return yield*h(n,e,t)})),c(`SessionStart`,({reason:e,ctx:t})=>n(function*(){let n=yield*p(o(v(),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(`
|
|
2
|
-
`)}`,`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*m(o(v(),t.cwd));i&&(yield*l(i,e,t))})),c(`SessionCompact`,({ctx:e})=>n(function*(){let t=yield*m(o(v(),e.cwd));t&&(yield*l(t,`compact`,e),yield*d(t.hooks.PostCompact,e,`PostCompact`))})),c(`PreCompact`,({ctx:e})=>n(function*(){let t=yield*m(o(v(),e.cwd));if(!t)return;let n=yield*u(t,e);if(n.block===!0)return e.ui.notify(`Compaction cancelled by a PreCompact hook: ${n.reason??`no reason given`}`,`warning`),{cancel:!0}})),c(`SessionSwitch`,({reason:e,ctx:t})=>n(function*(){let n=yield*m(o(v(),t.cwd));n&&(yield*g(n,e,t))})),c(`SessionShutdown`,({ctx:e})=>n(function*(){let t=yield*m(o(v(),e.cwd));t&&(yield*d(t.hooks.SessionEnd,e,`SessionEnd`))})),c(`SessionStop`,({ctx:e})=>n(function*(){let t=yield*m(o(v(),e.cwd));t&&(yield*d(t.hooks.Stop,e,`Stop`))})),s)}),b=(a,o)=>{async function s(a){let s=n(function*(){let e=yield*r(y(a));if(t(e))throw e.failure;return e.success}).pipe(i(28e3));return e(await o.runSafe(s))}a.on(`tool_call`,(e,t)=>s({_tag:`ToolCall`,event:e,ctx:t})),a.on(`tool_result`,(e,t)=>s({_tag:`ToolResult`,event:e,ctx:t})),a.on(`input`,(e,t)=>s({_tag:`Prompt`,event:e,ctx:t})),a.on(`session_start`,(e,t)=>s({_tag:`SessionStart`,reason:`startup`,ctx:t})),a.on(`session_compact`,(e,t)=>s({_tag:`SessionCompact`,ctx:t})),a.on(`session_before_compact`,(e,t)=>s({_tag:`PreCompact`,ctx:t})),a.on(`session_switch`,(e,t)=>s({_tag:`SessionSwitch`,reason:e.reason,ctx:t})),a.on(`session_shutdown`,(e,t)=>s({_tag:`SessionShutdown`,ctx:t})),a.on(`session_stop`,(e,t)=>s({_tag:`SessionStop`,ctx:t}))};export{b as HookDispatcherTask};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Cs as e,Fa as t,Ia as n,Ka as r,Kn as i,Pa as a,bs as o,cs as s,ma as c,ms as l,os as u,qa as d}from"./effect-CczU2E3R.js";import{a as ee,i as te,n as f,o as ne}from"./Cause-BPRKNAWJ.js";import{c as re,n as p,s as ie}from"./Exit-Dz81ekW_.js";import{$ as ae,A as oe,Bt as se,D as m,Dt as h,E as g,Et as _,Ft as v,G as y,Gt as ce,H as le,I as b,It as ue,J as de,Kt as fe,Lt as pe,M as x,Mt as S,N as C,Nt as me,Pt as he,Q as w,Rt as ge,S as _e,St as T,Ut as E,Vt as ve,Wt as ye,X as be,Z as xe,_ as D,a as Se,at as Ce,b as O,bt as we,c as k,ct as A,dt as Te,et as j,ft as M,gt as Ee,h as N,ht as P,it as De,jt as Oe,m as ke,mt as F,n as I,nt as Ae,o as je,ot as Me,p as Ne,q as Pe,rt as Fe,s as Ie,st as Le,tt as Re,w as L,wt as R,xt as ze,zt as Be}from"./Effect-CYgXOp91.js";import{C as z,Ct as Ve,D as He,Dt as Ue,E as B,Et as We,F as Ge,I as V,L as Ke,M as H,N as qe,P as U,R as Je,St as Ye,Tt as Xe,_ as W,b as Ze,g as Qe,h as $e,k as et,m as tt,n as nt,v as G,w as rt,wt as it,x as at,xt as ot,y as st,z as ct}from"./dist-BkUkC5Q5.js";import{A as lt,C as ut,D as dt,E as ft,I as pt,L as mt,O as ht,S as gt,T as _t,_ as vt,a as yt,b as bt,d as xt,h as St,l as Ct,m as wt,p as Tt,r as Et,s as Dt,t as Ot,v as kt,w as At,x as jt,y as Mt}from"./RunUserPromptSubmitHooksExecutor-C-kpE1OB.js";import*as Nt from"node:os";import*as Pt from"node:child_process";import{PassThrough as Ft}from"node:stream";import*as It from"node:crypto";import*as K from"node:fs";import*as q from"node:path";import*as Lt from"node:url";const Rt=i,zt=`~effect/ManagedRuntime`,Bt=(e,t)=>{let n=t?.memoMap??me(),r=ve(`parallel`),i=se(r,`sequential`),a={onFiberStart:mt(r)},o=e=>e?{...e,onFiberStart:e.onFiberStart?t=>{a.onFiberStart(t),e.onFiberStart(t)}:a.onFiberStart}:a,s,c=_(t=>(s||=w(Ee(Oe(e,n,i),e=>P(()=>{l.cachedContext=e})),{...a,scheduler:t.currentScheduler}),_e(pt(s)))),l={[zt]:zt,memoMap:n,scope:r,contextEffect:c,cachedContext:void 0,context(){return l.cachedContext===void 0?j(l.contextEffect):Promise.resolve(l.cachedContext)},dispose(){return j(l.disposeEffect)},[Symbol.asyncDispose](){return l.dispose()},disposeEffect:F(()=>(l.contextEffect=ke(`ManagedRuntime disposed`),l.cachedContext=void 0,Be(l.scope,re))),runFork(e,t){return l.cachedContext===void 0?w(J(l,e),o(t)):ae(l.cachedContext)(e,o(t))},runCallback(e,t){return l.cachedContext===void 0?be(J(l,e),o(t)):xe(l.cachedContext)(e,o(t))},runSyncExit(e){return l.cachedContext===void 0?Ce(J(l,e)):Me(l.cachedContext)(e)},runSync(e){return l.cachedContext===void 0?De(J(l,e)):Le(l.cachedContext)(e)},runPromiseExit(e,t){return l.cachedContext===void 0?Re(J(l,e),o(t)):Ae(l.cachedContext)(e,o(t))},runPromise(e,t){return l.cachedContext===void 0?j(J(l,e),o(t)):Fe(l.cachedContext)(e,o(t))}};return l};function J(e,t){return O(e.contextEffect,e=>Pe(t,e))}const Vt=(e,t,n)=>{let r=e.detached??n!==`win32`;return{...t,detached:r,shell:e.shell,windowsHide:e.windowsHide??!r}},Y=(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 ct({_tag:i,module:e,method:t,pathOrDescriptor:r,syscall:n.syscall,cause:n})},Ht=e=>Ge(Ye(Ut(e),e=>[e])),Ut=e=>ot(t=>{let n=e.evaluate();return M(Wt({...e,writable:n,pull:t}))}),Wt=e=>e.pull.pipe(O(t=>{let n=0;return k(function r(i){for(;n<t.length;)if(!e.writable.write(t[n++],e.encoding)){e.writable.once(`drain`,()=>r(i));return}i(R)})}),m({disableYield:!0}),de(k(t=>{let n=n=>t(D(e.onError(n)));return e.writable.once(`error`,n),P(()=>{e.writable.off(`error`,n)})})),e.endOnDone===!1?o:h(t=>`closed`in e.writable&&e.writable.closed?ee(t):k(n=>{e.writable.once(`finish`,()=>n(ee(t))),e.writable.end()}))),Gt=e=>rt(Kt(e)),Kt=e=>ot((t,n)=>qt({scope:n,readable:e.evaluate(),onError:e.onError??Jt,chunkSize:e.chunkSize,closeOnDone:e.closeOnDone})),qt=e=>{let t=e.readable,n=e.closeOnDone??!0,r=e.exit??Ue(void 0),i=Rt(!1);function a(){i.openUnsafe()}function o(t){r.current=p(e.onError(t)),i.openUnsafe()}function s(){r.current=p(f()),i.openUnsafe()}t.on(`readable`,a),t.once(`error`,o),t.once(`end`,s);let l=F(function n(){let a=e.readable.read(e.chunkSize);if(a===null)return r.current?r.current:t.readableEnded?D(f()):(i.closeUnsafe(),O(i.await,n));let o=c(a);for(;a=e.readable.read(e.chunkSize),a!==null;)o.push(a);return M(o)});return je(ge(e.scope,P(()=>{t.off(`readable`,a),t.off(`error`,o),t.off(`end`,s),n&&`closed`in e.readable&&!e.readable.closed&&e.readable.destroy()})),l)},Jt=e=>new te(e),X=e=>e instanceof globalThis.Error?e:new globalThis.Error(String(e)),Z=(e,t,n)=>{let{commands:r}=Zt(n),i=r.reduce((e,t)=>{let n=`${t.command} ${t.args.join(` `)}`;return e.length===0?n:`${e} | ${n}`},``);return Y(`ChildProcess`,e)(t,[i])},Yt=(e,t=()=>{})=>Pt.execFile(`taskkill`,[`/pid`,String(e.pid),`/T`,`/F`],{windowsHide:!0},t),Xt=S(ut,x(function*(){let e=yield*Qe,t=yield*tt,n=L(function*(n){if(!l(n.cwd))return yield*e.access(n.cwd),t.resolve(n.cwd)}),r=e=>e.extendEnv?{...globalThis.process.env,...e.env}:e.env,i=e=>B(e)?`pipe`:e,a=e=>V(e)?`pipe`:e,o=e=>{let t={stream:`pipe`,encoding:`utf-8`,endOnDone:!0};return l(e.stdin)?t:typeof e.stdin==`string`||B(e.stdin)?{...t,stream:e.stdin}:{stream:e.stdin.stream,encoding:e.stdin.encoding??t.encoding,endOnDone:e.stdin.endOnDone??t.endOnDone}},c=(e,t)=>{let n=e[t];return l(n)?{stream:`pipe`}:typeof n==`string`||V(n)?{stream:n}:{stream:n.stream}},d=e=>{if(l(e.additionalFds))return[];let t=[];for(let[n,r]of Object.entries(e.additionalFds)){let e=gt(n);s(e)&&t.push({fd:e,config:r})}return t.sort((e,t)=>e.fd-t.fd)},ee=(e,t,n,r)=>{let o=[i(e.stream),a(t.stream),a(n.stream)];if(r.length===0)return o;let s=r.reduce((e,{fd:t})=>Math.max(e,t),2);for(let e=3;e<=s;e++)o[e]=`ignore`;for(let{fd:e}of r)o[e]=`pipe`;return o},te=L(function*(e,t,n){if(n.length===0)return{getInputFd:()=>U,getOutputFd:()=>z};let r=new Map,i=new Map;for(let{config:a,fd:o}of n){let n=t.stdio[o];switch(a.type){case`input`:{let t=U;n&&`write`in n&&(t=Ht({evaluate:()=>n,onError:t=>Z(`fromWritable(fd${o})`,X(t),e)})),a.stream&&(yield*oe(et(a.stream,t))),r.set(o,t);break}case`output`:{let t=z;if(n&&`read`in n){let r=new Ft;n.on(`error`,e=>r.destroy(e)),n.pipe(r),t=Gt({evaluate:()=>r,onError:t=>Z(`fromReadable(fd${o})`,X(t),e)})}a.sink&&(t=H(t,a.sink)),i.set(o,t);break}}}return{getInputFd:e=>r.get(e)??U,getOutputFd:e=>i.get(e)??z}}),f=(e,t,n)=>F(()=>{let r=U;return u(t.stdin)&&(r=Ht({evaluate:()=>t.stdin,onError:t=>Z(`fromWritable(stdin)`,X(t),e),endOnDone:n.endOnDone,encoding:n.encoding})),B(n.stream)?je(oe(et(n.stream,r)),r):M(r)}),ne=(e,t,n,r)=>{let i=t.stdout?(()=>{let n=new Ft;return t.stdout.on(`error`,e=>n.destroy(e)),t.stdout.pipe(n),Gt({evaluate:()=>n,onError:t=>Z(`fromReadable(stdout)`,X(t),e)})})():z,a=t.stderr?(()=>{let n=new Ft;return t.stderr.on(`error`,e=>n.destroy(e)),t.stderr.pipe(n),Gt({evaluate:()=>n,onError:t=>Z(`fromReadable(stderr)`,X(t),e)})})():z;V(n.stream)&&(i=H(i,n.stream)),V(r.stream)&&(a=H(a,r.stream));let o=He(i,a);return{stdout:i,stderr:a,all:o}},re=(e,t)=>k(n=>{let r=fe(),i=Pt.spawn(e.command,e.args,t);return i.on(`error`,t=>{n(D(Z(`spawn`,t,e)))}),i.on(`exit`,(...e)=>{ye(r,ie(e))}),i.on(`spawn`,()=>{n(M([i,r]))}),P(()=>{i.kill(`SIGTERM`)})}),p=(e,t,n)=>globalThis.process.platform===`win32`?k(n=>{Yt(t,t=>{n(t?D(Z(`kill`,X(t),e)):R)})}):T({try:()=>{globalThis.process.kill(-t.pid,n)},catch:t=>Z(`kill`,X(t),e)}),ae=(e,t)=>{if(globalThis.process.platform===`win32`){Yt(e);return}try{globalThis.process.kill(-e.pid,t)}catch{}},se=(e,t,n)=>F(()=>{if(!t.kill(n)){let t=new globalThis.Error(`Failed to kill child process`);return D(Z(`kill`,t,e))}return R}),m=(e,t,n)=>r=>{let i=n?.killSignal??`SIGTERM`;return l(n?.forceKillAfter)?r(t,e,i):we(r(t,e,i),{duration:n.forceKillAfter,orElse:()=>r(t,e,`SIGKILL`)})},h=(e,t)=>{let n=t??`stdout`;switch(n){case`stdout`:return e.stdout;case`stderr`:return e.stderr;case`all`:return e.all;default:{let t=gt(n);return s(t)?e.getOutputFd(t):e.stdout}}},_=L(function*(e){switch(e._tag){case`StandardCommand`:{let t=o(e.options),i=c(e.options,`stdout`),a=c(e.options,`stderr`),s=d(e.options),l=!0,ie=yield*n(e.options),oe=r(e.options),h=ee(t,i,a,s),[g,_]=yield*I(re(e,Vt(e.options,{cwd:ie,env:oe,stdio:h},process.platform)),L(function*([t,n]){let r=yield*ce(n),i=m(t,e,e.options);if(r){let[e]=yield*E(n);return e!==0&&u(e)?yield*C(i(p)):yield*R}return l?yield*i((e,t,r)=>p(e,t,r).pipe(Ne(()=>se(e,t,r)),Se(E(n)))).pipe(C):yield*R})),v=_t(g.pid);g.on(`exit`,t=>{t!==0&&u(t)&&ae(g,e.options.killSignal??`SIGTERM`)});let y=P(()=>{l||=(g.ref(),!0)}),le=P(()=>(l&&=(g.unref(),!1),y)),ue=yield*f(e,g,t),{all:de,stderr:fe,stdout:pe}=ne(e,g,i,a),{getInputFd:x,getOutputFd:S}=yield*te(e,g,s),me=b(ce(_),e=>!e),he=O(E(_),([t,n])=>{if(u(t))return M(At(t));let r=new globalThis.Error(`Process interrupted due to receipt of signal: '${n}'`);return D(Z(`exitCode`,r,e))});return dt({pid:v,exitCode:he,isRunning:me,kill:t=>m(g,e,t)((e,t,n)=>p(e,t,n).pipe(Ne(()=>se(e,t,n)),Se(E(_)))).pipe(Ie),stdin:ue,stdout:pe,stderr:fe,all:de,getInputFd:x,getOutputFd:S,unref:le})}case`PipedCommand`:{let{commands:t,pipeOptions:n}=Zt(e),[r,...i]=t,a=[yield*_(r)];for(let e=0;e<i.length;e++){let t=i[e],r=n[e]??{},c=o(t.options),l=qe(M(h(a[a.length-1],r.from))),u=r.to??`stdin`;if(u===`stdin`)a.push(yield*_(jt(t.command,t.args,{...t.options,stdin:{...c,stream:l}})));else{let e=gt(u);if(s(e)){let n=bt(e),r=t.options.additionalFds??{};a.push(yield*_(jt(t.command,t.args,{...t.options,additionalFds:{...r,[n]:{type:`input`,stream:l}}})))}else a.push(yield*_(jt(t.command,t.args,{...t.options,stdin:{...c,stream:l}})))}}let c=a[a.length-1],l=e=>g([...a].reverse(),t=>C(t.kill(e)),{discard:!0}),u=x(function*(){let e=[];for(let t of a)e.push(yield*t.unref);return g([...e].reverse(),e=>e,{discard:!0})});return dt({pid:c.pid,exitCode:c.exitCode,isRunning:c.isRunning,kill:l,stdin:c.stdin,stdout:c.stdout,stderr:c.stderr,all:c.all,getInputFd:c.getInputFd,getOutputFd:c.getOutputFd,unref:u})}}});return ft(_)})),Zt=e=>{let t=[],n=[],r=e=>{switch(e._tag){case`StandardCommand`:t.push(e);break;case`PipedCommand`:r(e.left),n.push(e.options),r(e.right)}};if(r(e),t.length===0)throw Error(`flattenCommand produced empty commands array`);let[i,...a]=t;return{commands:[i,...a],pipeOptions:n}},Q=e=>t=>Je({module:`FileSystem`,method:e,description:t.message??String(t)}),Qt=(()=>{let e=N(K.access,Y(`FileSystem`,`access`),Q(`access`));return(t,n)=>{let r=K.constants.F_OK;return n?.readable&&(r|=K.constants.R_OK),n?.writable&&(r|=K.constants.W_OK),e(t,r)}})(),$t=(()=>{let e=N(K.cp,Y(`FileSystem`,`copy`),Q(`copy`));return(t,n,r)=>e(t,n,{force:r?.overwrite??!1,preserveTimestamps:r?.preserveTimestamps??!1,recursive:!0})})(),en=(()=>{let e=N(K.copyFile,Y(`FileSystem`,`copyFile`),Q(`copyFile`));return(t,n)=>e(t,n)})(),tn=(()=>{let e=N(K.chmod,Y(`FileSystem`,`chmod`),Q(`chmod`));return(t,n)=>e(t,n)})(),nn=(()=>{let e=N(K.chown,Y(`FileSystem`,`chown`),Q(`chown`));return(t,n,r)=>e(t,n,r)})(),rn=(()=>{let e=N(K.glob,Y(`FileSystem`,`glob`),Q(`glob`));return(t,n)=>e(t,{cwd:n?.root,exclude:n?.exclude})})(),an=(()=>{let e=N(K.link,Y(`FileSystem`,`link`),Q(`link`));return(t,n)=>e(t,n)})(),on=(()=>{let e=N(K.mkdir,Y(`FileSystem`,`makeDirectory`),Q(`makeDirectory`));return(t,n)=>e(t,{recursive:n?.recursive??!1,mode:n?.mode})})(),sn=e=>{let t=N(K.mkdtemp,Y(`FileSystem`,e),Q(e));return e=>F(()=>{let n=e?.prefix??``,r=typeof e?.directory==`string`?q.join(e.directory,`.`):Nt.tmpdir();return t(n?q.join(r,n):r+`/`)})},cn=sn(`makeTempDirectory`),ln=e=>{let t=N(K.rm,Y(`FileSystem`,e),Q(e));return(e,n)=>t(e,{recursive:n?.recursive??!1,force:n?.force??!1})},un=ln(`remove`),dn=(()=>{let e=sn(`makeTempDirectoryScoped`),t=ln(`makeTempDirectoryScoped`);return n=>I(e(n),e=>y(t(e,{recursive:!0})))})(),fn=(t=>{let n=N(K.open,Y(`FileSystem`,t),Q(t)),r=N(K.close,Y(`FileSystem`,t),Q(t));return(t,i)=>e(I(n(t,i?.flag??`r`,i?.mode),e=>y(r(e))),b(e=>pn(e,i?.flag?.startsWith(`a`)??!1)))})(`open`),pn=(()=>{let e=e=>N(K.read,Y(`FileSystem`,e),Q(e)),t=e(`read`),n=e(`readAlloc`),i=N(K.fstat,Y(`FileSystem`,`stat`),Q(`stat`)),a=N(K.ftruncate,Y(`FileSystem`,`truncate`),Q(`truncate`)),o=N(K.fsync,Y(`FileSystem`,`sync`),Q(`sync`)),s=e=>N(K.write,Y(`FileSystem`,e),Q(e)),c=s(`write`),l=s(`writeAll`);class u{[W];fd;append;position=BigInt(0);constructor(e,t){this[W]=W,this.fd=e,this.append=t}get stat(){return b(i(this.fd),Sn)}get sync(){return o(this.fd)}seek(e,t){let n=G(e);return P(()=>(t===`start`?this.position=n:t===`current`&&(this.position+=n),G(this.position)))}read(e){return F(()=>{let n=this.position;return b(t(this.fd,{buffer:e,position:n}),e=>{let t=G(e);return this.position=n+t,t})})}readAlloc(e){let t=Number(e);return F(()=>{let e=Buffer.allocUnsafeSlow(t),i=this.position;return b(n(this.fd,{buffer:e,position:i}),n=>{if(n===0)return r();if(this.position=i+BigInt(n),n===t)return d(e);let a=Buffer.allocUnsafeSlow(n);return e.copy(a,0,0,n),d(a)})})}truncate(e){return b(a(this.fd,e?Number(e):void 0),()=>{if(!this.append){let t=BigInt(e??0);this.position>t&&(this.position=t)}})}write(e){return F(()=>{let t=this.position;return b(c(this.fd,e,void 0,void 0,this.append?void 0:Number(t)),e=>{let n=G(e);return this.append||(this.position=t+n),n})})}writeAllChunk(e){return F(()=>{let t=this.position;return O(l(this.fd,e,void 0,void 0,this.append?void 0:Number(t)),n=>n===0?D(ct({module:`FileSystem`,method:`writeAll`,_tag:`WriteZero`,pathOrDescriptor:this.fd,description:`write returned 0 bytes written`})):(this.append||(this.position=t+BigInt(n)),n<e.length?this.writeAllChunk(e.subarray(n)):R))})}writeAll(e){return this.writeAllChunk(e)}}return(e,t)=>new u(e,t)})(),mn=e=>{let t=sn(e);return L(function*(e){let n=yield*t(e),r=It.randomBytes(6).toString(`hex`),i=q.join(n,e?.suffix?`${r}${e.suffix}`:r);return yield*kn(i,new Uint8Array),i})},hn=mn(`makeTempFile`),gn=(()=>{let e=mn(`makeTempFileScoped`),t=ln(`makeTempFileScoped`);return n=>I(e(n),e=>y(t(q.dirname(e),{recursive:!0})))})(),_n=(e,t)=>ze({try:()=>K.promises.readdir(e,t),catch:t=>Y(`FileSystem`,`readDirectory`)(t,[e])}),vn=e=>k((t,n)=>{try{K.readFile(e,{signal:n},(n,r)=>{t(n?D(Y(`FileSystem`,`readFile`)(n,[e])):M(r))})}catch(e){t(D(Q(`readFile`)(e)))}}),yn=(()=>{let e=N(K.readlink,Y(`FileSystem`,`readLink`),Q(`readLink`));return t=>e(t)})(),bn=(()=>{let e=N(K.realpath,Y(`FileSystem`,`realPath`),Q(`realPath`));return t=>e(t)})(),xn=(()=>{let e=N(K.rename,Y(`FileSystem`,`rename`),Q(`rename`));return(t,n)=>e(t,n)})(),Sn=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:t(e.mtime),atime:t(e.atime),birthtime:t(e.birthtime),dev:e.dev,rdev:t(e.rdev),ino:t(e.ino),mode:e.mode,nlink:t(e.nlink),uid:t(e.uid),gid:t(e.gid),size:G(e.size),blksize:e.blksize===void 0?r():d(G(e.blksize)),blocks:t(e.blocks)}),Cn=(()=>{let e=N(K.stat,Y(`FileSystem`,`stat`),Q(`stat`));return t=>b(e(t),Sn)})(),wn=(()=>{let e=N(K.symlink,Y(`FileSystem`,`symlink`),Q(`symlink`));return(t,n)=>e(t,n)})(),Tn=(()=>{let e=N(K.truncate,Y(`FileSystem`,`truncate`),Q(`truncate`));return(t,n)=>e(t,n===void 0?void 0:Number(n))})(),En=(()=>{let e=N(K.utimes,Y(`FileSystem`,`utime`),Q(`utime`));return(t,n,r)=>e(t,n,r)})(),Dn=(e,t)=>at(n=>I(P(()=>{let r=K.watch(e,{recursive:t?.recursive??!1},(e,t)=>{if(t)switch(e){case`rename`:w(le(Cn(t),{onSuccess:e=>Xe(n,{_tag:`Create`,path:t}),onFailure:e=>Xe(n,{_tag:`Remove`,path:t})}));return;case`change`:We(n,{_tag:`Update`,path:t});return}});return r.on(`error`,t=>{it(n,ne(ct({module:`FileSystem`,_tag:`Unknown`,method:`watch`,pathOrDescriptor:e,cause:t})))}),r.on(`close`,()=>{Ve(n)}),r}),e=>P(()=>e.close()))),On=(e,t,r)=>Cn(t).pipe(b(i=>e.pipe(a(e=>e.register(t,i,r)),n(()=>Dn(t,r)))),qe),kn=(e,t,n)=>k((r,i)=>{try{K.writeFile(e,t,{signal:i,flag:n?.flag,mode:n?.mode},t=>{r(t?D(Y(`FileSystem`,`writeFile`)(t,[e])):R)})}catch(e){r(D(Q(`writeFile`)(e)))}}),An=b(Te(st),e=>Ze({access:Qt,chmod:tn,chown:nn,copy:$t,copyFile:en,glob:rn,link:an,makeDirectory:on,makeTempDirectory:cn,makeTempDirectoryScoped:dn,makeTempFile:hn,makeTempFileScoped:gn,open:fn,readDirectory:_n,readFile:vn,readLink:yn,realPath:bn,remove:un,rename:xn,stat:Cn,symlink:wn,truncate:Tn,utimes:En,watch(t,n){return On(e,t,n)},writeFile:kn})),jn=S(Qe)(An),$=e=>({fromFileUrl:t=>T({try:()=>Lt.fileURLToPath(t,{windows:e}),catch:e=>new Ke({module:`Path`,method:`fromFileUrl`,cause:e})}),toFileUrl:t=>T({try:()=>Lt.pathToFileURL(t,{windows:e}),catch:e=>new Ke({module:`Path`,method:`toFileUrl`,cause:e})})});({...q.posix,...$(!1)}),{...q.win32,...$(!0)};const Mn=ue(tt)({[$e]:$e,...q,...$(void 0)}),Nn=he(S(pe,A),S(ht,A),S(lt,A),S(Mt,A),S(vt,A),S(Ct,A),S(Tt,A),S(wt,A),S(Et,A),S(xt,A),S(Ot,A),S(Dt,A),S(yt,A),S(St,A),S(kt,A)),Pn=Xt.pipe(v(jn),v(Mn)),Fn=Bt(Nn.pipe(v(nt),v(Pn))),In=()=>{Fn.dispose()};process.once(`SIGINT`,In),process.once(`SIGTERM`,In);export{Fn as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{Ca as e,_a as t,ga as n,mo as r,ps as i,ro as a,vs as o,xs as s,ya as c,ys as l,zo as u}from"./effect-CczU2E3R.js";import{B as d,C as f,G as p,K as ee,M as te,R as m,Y as h,_ as g,d as ne,ft as _,m as v,u as re,w as y,x as b}from"./Effect-CYgXOp91.js";import{At as ie,It as ae,Lt as oe,Mt as se,Ot as ce,Pt as le,Q as ue,Rt as de,Z as fe,bt as pe,g as x,gt as S,jt as C,kt as w,m as T,mt as E,t as D,yt as O}from"./dist-BkUkC5Q5.js";function k(e){return{_tag:`Value`,value:e}}function A(e,t){return{_tag:`Record`,keys:e,value:t}}function j(e,t){return{_tag:`Array`,length:e,value:t}}de(`SourceError`);const M=e(`effect/ConfigProvider`,{defaultValue:()=>B()}),N={...r,toJSON(){return{_id:`ConfigProvider`}}},P=e=>e;function F(e,t){let n=Object.create(N);return n.load=e,n.mapInput=t,n}function I(e,t){return F(n=>e(t(n)),n=>I(e,l(t,n)))}function L(e){return I(e,P)}function R(e,t){return e===``&&!t?void 0:e}function z(e,t){let n=t?.preserveEmptyStrings===!0,r=me(e);return L(t=>_(ge(r,e,t,n)))}function B(e){return z(e?.env??{...globalThis.process?.env,...import.meta.env},{preserveEmptyStrings:e?.preserveEmptyStrings})}function me(e){let t={};for(let[n,r]of Object.entries(e)){if(r===void 0)continue;let e=n.split(`_`),i=t;for(let t of e){let e=i.children??=Object.create(null);i=e[t]??={}}}return t}const he=/^(0|[1-9][0-9]*)$/;function ge(e,t,n,r){let i=n.map(String).join(`_`),a=R(Object.hasOwn(t,i)?t[i]:void 0,r),o=_e(e,n),s=o?.children?Object.keys(o.children):[];return s.length===0?a===void 0?void 0:k(a):s.every(e=>he.test(e))?j(Math.max(...s.map(e=>parseInt(e,10)))+1,a):A(new Set(s),a)}function _e(e,t){if(t.length===0)return e;let n=e;for(let e of t)if(n=n?.children?.[String(e)],!n)return;return n}const V=`~effect/Config`;var H=class{_tag=`ConfigError`;name=`ConfigError`;cause;constructor(e){this.cause=e}get message(){return this.cause.toString()}toString(){return`ConfigError(${this.message})`}};const ve={...a({label:`Config`,evaluate(e){return this.parse(e.getRef(M))}}),[V]:V,toJSON(){return{_id:`Config`}}};function U(e){let t=Object.create(ve);return t.evaluator=e,t.parse=t=>e(t,[]).pipe(d(e=>e.error),b(e=>e._tag===`Resolved`?_(e.value):g(e.error))),t}const ye=(e,t,n)=>e.evaluator(t,n),W=(e,t)=>({_tag:`Resolved`,value:e,hasInput:t}),be=e=>({_tag:`Absent`,error:e}),G=(e,t)=>({error:e,hasInput:t}),xe=e=>i(e,`SourceError`),K=(e,t)=>e.pipe(re(e=>xe(e)?g(G(new H(e),t)):v(e))),Se=o(2,(e,t)=>U((n,r)=>m(ye(e,n,r),e=>e._tag===`Absent`?W(t,!1):e))),Ce=()=>`<configuration>`,q=(e,t)=>e.load(t).pipe(p,m(n=>({provider:e,path:t,node:n,toString:Ce}))),J=(e,t)=>q(e.provider,[...e.path,t]),Y=e=>e?.value,X=(e,t)=>w(C,e,new se(ae(e=>t(e)),le())),Z=e=>{switch(e._tag){case`Union`:return e.types.every(Z);case`Objects`:case`Arrays`:case`Suspend`:return!1;default:return!0}},Q=(e,t)=>{switch(e._tag){case`Objects`:return t?._tag===`Record`;case`Arrays`:return t?._tag===`Array`;case`Union`:return e.types.some(e=>Q(e,t));case`Suspend`:return Q(e.thunk(),t);default:return Y(t)!==void 0}},$=s(e=>{let t=new WeakSet,n=ce(e=>{switch(t.add(e),e._tag){case`Objects`:{let t=e.indexSignatures.map(e=>O(e.parameter)),r=y(function*(n){if(n.node?._tag!==`Record`)return;let r=n.node,i=new Set;for(let t of e.propertySignatures)typeof t.name==`string`&&i.add(t.name);if(t.length>0)for(let e of r.keys)t.some(t=>t(e))&&i.add(e);let a={};for(let e of i){let t=yield*J(n,e);t.node!==void 0&&u(a,e,t)}return a});return X(e.recur(n,e=>e),r)}case`Arrays`:{let t=y(function*(e){if(e.node?._tag!==`Array`)return;let t=[];for(let n=0;n<e.node.length;n++)t.push(yield*J(e,n));return t});return X(e.recur(n),t)}case`Union`:for(let t of e.types)n(t);return Z(e)?X(e,e=>_(Y(e.node))):e.recur(n);case`Suspend`:{let r=e.thunk();return t.has(r)||n(r),e.recur(n)}case`Declaration`:case`Any`:throw new globalThis.Error(`Config.schema does not support opaque StringTree encodings`,{cause:e});default:return X(e,e=>_(Y(e.node)))}});return n(e)});function we(e,t){let n=S(e),r=ie(n.ast),i=pe(E($(n.ast))),a=typeof t==`string`?[t]:t??[];return U((e,t)=>{let n=[...t,...a];return K(q(e,n),!1).pipe(b(e=>{let t=Q(r,e.node);return K(i(e).pipe(m(e=>W(e,t)),ne(e=>{let r=new H(new fe(n.length>0?new oe(n,e):e));return t?g(G(r,!0)):_(be(r))})),t)}))})}function Te(e){return we(ue,e)}const Ee=[`AGENTS.md`],De=f(`extractRefs`)(function*(e,t,n){let r=yield*x,i=yield*T,a=[];for(let o of e.split(`
|
|
2
|
-
`)){let e=o.trim().replace(/^[-*+]\s+/,``);if(!e.startsWith(`@`))continue;let s=e.slice(1).trim();if(!s||s.includes(` `)||i.isAbsolute(s))continue;let l=i.resolve(t,s);if(l.startsWith(n+`/`)||l===n){let e=yield*h(r.exists(l));if(c(e)&&e.success){a.push({sourcePath:t,resolvedPath:l});continue}}let u=i.resolve(n,s);(u.startsWith(n+`/`)||u===n)&&u!==l&&a.push({sourcePath:n,resolvedPath:u})}return a}),Oe=f(`loadReferencedContent`)(function*(e){let n=yield*x,r=yield*T,i=yield*D,a=[r.resolve(e,`CLAUDE.md`),r.resolve(e,`.claude`,`CLAUDE.md`)],o=[];for(let t of a){let i=yield*h(n.readFileString(t,`utf-8`));if(c(i)){let n=yield*De(i.success,r.dirname(t),e);o.push(...n)}}let s=new Set,l=[];for(let e of o)s.has(e.resolvedPath)||(s.add(e.resolvedPath),l.push(e));let u=(yield*i.load(e).pipe(ee(()=>void 0)))?.no_inject_refs??Ee,d=[];for(let r of l){let i=r.resolvedPath.slice(e.length+1);if(u.includes(i))continue;let a=yield*h(n.readFileString(r.resolvedPath,`utf-8`));t(a)||d.push(`## ${i}\n${a.success}\n`)}return d.length===0?``:[`# Injected @-references from CLAUDE.md`,`The following files were @-imported by CLAUDE.md and contain project rules.`,``,...d].join(`
|
|
3
|
-
`)}),ke=(e,t)=>{e.on(`before_agent_start`,async(e,r)=>{let i=await t.runSafe(te(function*(){let e=yield*Te(`CLAUDE_PROJECT_DIR`).pipe(Se(process.cwd())),t=yield*h(Oe(e));return n(t)}));if(i!==``)return{systemPrompt:[...e.systemPrompt,``,i]}})};export{ke as InjectInstructionsTask};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{Cs as e,Ga as t,Ia as n,Ka as r,Oa as i,Sa as a,Ts as o,Ut as s,Va as c,Vo as l,Vt as u,Wa as d,Wt as f,ba as p,bs as m,ca as ee,fa as te,ha as h,la as ne,qa as g,ro as re,va as ie,vs as ae,wa as _,xa as oe,ya as v}from"./effect-CczU2E3R.js";import{c as se,f as ce}from"./Cause-BPRKNAWJ.js";import{a as le,i as y,o as ue}from"./Exit-Dz81ekW_.js";import{C as b,Ct as de,E as fe,F as pe,I as me,K as he,M as ge,N as _e,O as ve,P as ye,V as be,_ as xe,_t as Se,b as Ce,f as we,ft as x,ht as Te,i as Ee,it as De,k as Oe,lt as ke,m as S,r as Ae,s as je,vt as Me,wt as Ne,yt as Pe,z as Fe}from"./Effect-CYgXOp91.js";import{$ as C,A as Ie,B as w,Ft as Le,G as Re,H as T,It as ze,J as Be,K as Ve,N as He,Nt as Ue,O as We,Q as E,S as Ge,T as Ke,U as qe,V as D,X as O,Y as Je,_t as Ye,a as Xe,at as Ze,c as Qe,ct as k,d as $e,dt as et,et as A,f as tt,ft as j,g as nt,ht as M,i as rt,it as N,j as it,l as at,lt as P,nt as F,o as ot,ot as st,p as ct,pt as lt,q as ut,r as dt,rt as I,s as ft,st as pt,tt as mt,u as L,ut as ht,vt as R}from"./dist-BkUkC5Q5.js";function gt(){return Object.assign(e=>e,{option:e=>g(e),result:e=>a(e),is:e=>!0})}const _t=u,vt=s,yt=f,bt={"~effect/match/Match/Matcher":{_input:m,_filters:m,_result:m,_return:m},_tag:`ValueMatcher`,add(e){return v(this.value)?this:e._tag===`When`&&e.guard(this.provided)===!0||e._tag===`Not`&&e.guard(this.provided)===!1?xt(this.provided,a(e.evaluate(this.provided))):this},pipe(){return o(this,arguments)}};function xt(e,t){let n=Object.create(bt);return n.provided=e,n.value=t,n}const St=(e,t)=>({_tag:`When`,guard:e,evaluate:t}),Ct=e=>{if(typeof e==`function`)return e;if(Array.isArray(e)){let t=e.map(Ct),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=Reflect.ownKeys(e).map(t=>[t,Ct(e[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},wt=e=>xt(e,h(e)),Tt=(e,t)=>n=>n.add(St(Ct(e),t)),Et=(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(St(i,n))})(`_tag`),Dt=e=>t=>{let n=Ot(t);return ie(n)?n._tag===`Success`?n.success:e(n.failure):t=>{let r=n(t);return v(r)?r.success:e(r.failure)}},Ot=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?a(t.evaluate(e)):h(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 a(t.evaluate(n))}return h(n)}},kt=`effect/match/Match/exhaustive: absurd`,At=e=>{let t=Ot(e);if(ie(t)){if(v(t))return t.success;throw Error(kt)}return e=>{let n=t(e);if(v(n))return n.success;throw Error(kt)}},z=wt,B=Tt,V=Et,jt=Dt,H=At,Mt=`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(`.`),Nt=[`PreToolUse`,`PostToolUse`,`PostToolUseFailure`,`UserPromptSubmit`,`SessionStart`,`SessionEnd`,`Stop`,`PreCompact`,`PostCompact`],Pt={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.`},Ft=[`PreToolUse`,`PostToolUse`,`PostToolUseFailure`,`PermissionRequest`,`PermissionDenied`],It={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."},Lt={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.`}}},Rt=C({type:Re(`command`),command:E,args:M(D(E)),async:M(T),asyncRewake:M(T),shell:M(Ve([`bash`,`powershell`])),timeout:M(Be),if:M(E),statusMessage:M(E),once:M(T)}),zt=C({type:Ve([`http`,`mcp_tool`,`prompt`,`agent`])}),Bt=I([Rt,zt]),U=C({matcher:M(E),hooks:D(Bt)}),Vt=C({PreToolUse:D(U).pipe(R(x([]))),PostToolUse:D(U).pipe(R(x([]))),PostToolUseFailure:D(U).pipe(R(x([]))),UserPromptSubmit:D(U).pipe(R(x([]))),Stop:D(U).pipe(R(x([]))),SessionStart:D(U).pipe(R(x([]))),SessionEnd:D(U).pipe(R(x([]))),PreCompact:D(U).pipe(R(x([]))),PostCompact:D(U).pipe(R(x([])))}),Ht=C({hooks:Vt,disableAllHooks:M(T)}),W=C({event:E,reason:E}),Ut=C({unrecognized:D(W),notCarried:D(W),matcherNotEvaluable:D(W),matcherOutOfReach:D(W),shadowed:D(W),disabled:D(W)}),Wt=C({...Vt.fields,disableAllHooks:M(T),hooks:M(ut)}).pipe(st(Ye(Ht),{decode:ze(({disableAllHooks:e,...t})=>x(e===void 0?{hooks:t}:{hooks:t,disableAllHooks:e})),encode:Ue(()=>`Decode-only: settings are never encoded`)})),Gt=I([Ht,Wt]);I([F(`Merge`,{sources:w}),F(`Coverage`,{json:w}),F(`DisabledCoverage`,{sources:w}),F(`UnsupportedHookTypes`,{json:w}),F(`MatcherUnreadable`,{event:w}),F(`IfEvaluatingEvent`,{event:w})]);const Kt=k(Gt),qt=Nt,Jt=P(O(E,N)),Yt=[],Xt=P(D(C({matcher:M(E),hooks:D(C({type:M(E)})).pipe(R(x([])))})));function Zt(e){return d(Jt(e),e=>t(Jt(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,`�`),Qt={unrecognized:[],notCarried:[],matcherNotEvaluable:[],matcherOutOfReach:[],shadowed:[],disabled:[]},$t=Mt,en=Pt,tn=It,nn=Ft,rn=Lt,an=e=>n(Xt(e),()=>Yt).flatMap(e=>e.matcher===void 0?[]:[e.matcher]),on=e=>an(e).length>0,sn=e=>z(e).pipe(V(`Reachable`,()=>r()),V(`Partial`,e=>g(e.reason)),V(`Unreachable`,e=>g(e.reason)),H);function cn(e){return t(Zt(e),{onNone:()=>Qt,onSome:({isWrapped:e,namespace:n,outer:r})=>{let i=[],a=[],o=[],s=[],c=[];for(let r of Object.keys(n)){if(!e&&r===`disableAllHooks`)continue;let c=en[r];if(c!==void 0){a.push({event:G(r),reason:c});continue}if(!$t.includes(r)){i.push({event:G(r),reason:`not in this bridge's catalog (Claude Code hooks reference 2026-07-28)`});continue}let l=tn[r];l!==void 0&&on(n[r])&&o.push({event:G(r),reason:l});let u=rn[r];u!==void 0&&s.push(...an(n[r]).flatMap(e=>{let n=u[e];return n===void 0?[]:t(sn(n),{onNone:()=>[],onSome:t=>[{event:`${G(r)} (matcher "${G(e)}")`,reason:t}]})}))}if(e)for(let e of Object.keys(r))$t.includes(e)&&c.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:i,notCarried:a,matcherNotEvaluable:o,matcherOutOfReach:s,shadowed:c,disabled:[]}}})}function ln(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=>qt.filter(t=>e.settings.hooks[t].length>0).map(e=>({event:e,reason:n})))}function un(e){return t(Zt(e),{onNone:()=>[],onSome:({namespace:e})=>{let t=new Set;for(let r of qt){let i=n(Xt(e[r]),()=>Yt);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 dn(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 qt)t[e]=t[e].concat(Array.from(r.settings.hooks[e]));return{hooks:t}}function fn(e){return z(e).pipe(V(`Merge`,({sources:e})=>dn(e)),V(`Coverage`,({json:e})=>cn(e)),V(`DisabledCoverage`,({sources:e})=>ln(e)),V(`UnsupportedHookTypes`,({json:e})=>un(e)),V(`MatcherUnreadable`,({event:e})=>tn[e]!==void 0),V(`IfEvaluatingEvent`,({event:e})=>nn.includes(e)),H)}function K(e,t){return ht(t)(fn(e))}const pn=`/etc/claude-code/managed-settings.json`,mn=(e,t)=>[`${e}/.claude/settings.json`,`${t}/.claude/settings.json`,`${t}/.claude/settings.local.json`,pn];var hn=class extends _()(`CollectSettingsGapsExecutorDeps`){};const q=e=>e.filter((t,n)=>e.findIndex(e=>e.event===t.event)===n),gn=b(`collectSettingsGapsWithPaths`)(function*(e){let t=yield*nt,n=[],r=[],i=[],a=[],o=[],s=[],c=[],l=[];for(let u of e){let e=yield*t.readFileString(u).pipe(he(()=>``));if(e===``)continue;let d=k(j(O(E,N)))(e);if(y(d)){l.push(u);continue}let f=K({_tag:`Coverage`,json:d.value},Ut);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.value},D(E)));let p=Kt(d.value);y(p)?l.push(u):s.push({settings:p.value,managed:u===pn,label:u})}return{coverage:{unrecognized:q(n),notCarried:q(r),matcherNotEvaluable:q(i),matcherOutOfReach:q(a),shadowed:q(o),disabled:q(K({_tag:`DisabledCoverage`,sources:s},D(W)))},unsupportedHookTypes:Array.from(new Set(c)),malformedFiles:Array.from(new Set(l))}});var _n=class extends _()(`LoadSettingsExecutorDeps`){};const vn=b(`loadSettingsFile`)(function*(e){let t=yield*(yield*nt).readFileString(e).pipe(he(()=>``));if(t===``)return null;let n=k(j(O(E,N)))(t);if(y(n))return null;let r=n.value,i=Kt(r);return y(i)?null:i.value}),yn=b(`loadSettingsWithPaths`)(function*(e,t=pn){let n=[];for(let r of e){let e=yield*vn(r);e!==null&&n.push({settings:e,managed:r===t})}return n.length===0?null:K({_tag:`Merge`,sources:n},Ht)}),bn=gt(),xn=gt(),Sn=`~effect/ChildProcessSpawner/ChildProcessHandle`,Cn={[Sn]:Sn,...l,toJSON(){return{_id:`ChildProcessHandle`,pid:this.pid}}},wn=e=>Object.setPrototypeOf({...e},Cn),Tn=e=>{let t=(t,n)=>e(t).pipe(me(e=>Ge(n?.includeStderr===!0?e.all:e.stdout)),He),n=(e,n)=>it(t(e,n));return J.of({spawn:e,exitCode:t=>ke(Ce(e(t),e=>e.exitCode)),streamString:t,streamLines:n,lines:(e,t)=>Ie(n(e,t)),string:(e,n)=>We(t(e,n))})};var J=class extends _()(`effect/process/ChildProcessSpawner`){};const En=`~effect/unstable/process/ChildProcess`,Dn={...re({label:`Command`,evaluate(e){return i(e.context,J).spawn(this)}}),[En]:En},Y=(e,t,n)=>Object.assign(Object.create(Dn),{_tag:`StandardCommand`,command:e,args:t,options:n}),On=function(...e){if(kn(e[0])){let[t,...n]=e,r=Mn(t,n);return Y(r[0]??``,r.slice(1),{})}if(typeof e[0]==`object`&&!Array.isArray(e[0])&&!kn(e[0])){let t=e[0];return function(e,...n){let r=Mn(e,n);return Y(r[0]??``,r.slice(1),t)}}if(typeof e[0]==`string`&&!Array.isArray(e[1])){let[t,n={}]=e;return Y(t,[],n)}let[t,n=[],r={}]=e;return Y(t,n,r)},kn=e=>Array.isArray(e)&&`raw`in e&&Array.isArray(e.raw),An=e=>{let t=/^fd(\d+)$/.exec(e);if(t===null)return;let n=parseInt(t[1],10);return n>=3?n:void 0},jn=e=>`fd${e}`,Mn=(e,t)=>{let n=[];for(let[r,i]of e.entries())n=Nn(e,t,n,i,r);return n},Nn=(e,t,n,r,i)=>{let a=e.raw[i];if(a===void 0)throw Error(`Invalid backslash sequence: ${e.raw[i]}`);let{hasLeadingWhitespace:o,hasTrailingWhitespace:s,tokens:c}=Ln(r,a),l=Rn(n,c,o);if(i===t.length)return l;let u=t[i],d=Array.isArray(u)?u.map(e=>Pn(e)):[Pn(u)];return Rn(l,d,s)},Pn=e=>typeof e==`string`?e:String(e),Fn=new Set([` `,` `,`\r`,`
|
|
2
|
-
`]),In={x:3,u:5},Ln=(e,t)=>{if(t.length===0)return{tokens:[],hasLeadingWhitespace:!1,hasTrailingWhitespace:!1};let n=Fn.has(t[0]),r=[],i=0;for(let n=0,a=0;n<e.length;n+=1,a+=1){let o=t[a];if(Fn.has(o))i!==n&&r.push(e.slice(i,n)),i=n+1;else if(o===`\\`){let e=t[a+1];e===`
|
|
3
|
-
`?(--n,a+=1):e===`u`&&t[a+2]===`{`?a=t.indexOf(`}`,a+3):a+=In[e]??1}}let a=i===e.length;return a||r.push(e.slice(i)),{tokens:r,hasLeadingWhitespace:n,hasTrailingWhitespace:a}},Rn=(e,t,n)=>n||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t.at(0)}`,...t.slice(1)],zn=(e,t,r)=>Oe(e,t).pipe(Ce(e=>vt(e)),Pe(r.deadline),me(e=>n(e,r.onDeadline))),Bn=O(E,N),Vn={UserPromptSubmit:30},Hn=(e,t)=>(e??Vn[t]??600)*1e3,Un=24e3,Wn=(e,t,n)=>{let r=Hn(e,t);return!n||r<=Un?{timeoutMs:r,capNote:``}:{timeoutMs:Un,capNote:` (capped from ${r}ms by the extension handler budget)`}},Gn={sh:[`sh`,`-c`],bash:[`bash`,`-c`],powershell:[`powershell`,`-Command`]},Kn=et(j(Bn));var qn=class extends _()(`RunHookScriptExecutorDeps`){};const X=b(`runHookScript`)(function*(e,t,n,r,i=!0){let a=yield*J,{timeoutMs:o,capNote:s}=Wn(e.timeout,r,i),c=Kn(t),[l,u]=Gn[e.shell??`sh`],d={cwd:n,env:{OMP_PROJECT_DIR:n,CLAUDE_PROJECT_DIR:n},stdin:Ke([new TextEncoder().encode(c)]),stdout:`pipe`,stderr:`pipe`},f=e.args===void 0?On(l,[u,e.command],d):On(e.command,e.args,d),p=yield*qn,m=ke(de(e=>ge(function*(){let t=yield*a.spawn(f);yield*Ae(()=>ye(t.kill({killSignal:`SIGKILL`})).pipe(Me(2e3),_e));let[n,r,i]=yield*e(Ee([We(Ge(t.stdout)),We(Ge(t.stderr)),t.exitCode.pipe(me(Number),he(()=>-1))],{concurrency:`unbounded`}));return{code:i,stdout:n,stderr:r}}))).pipe(Se(t=>pe(`hook ${e.command} failed`,t)));return yield*zn(m,p,{deadline:o,onDeadline:()=>({code:-1,stdout:``,stderr:`timeout after ${o}ms${s}`})})});var Jn=Object.defineProperty,Yn=(e,t)=>{let n={};for(var r in e)Jn(n,r,{get:e[r],enumerable:!0});return t||Jn(n,Symbol.toStringTag,{value:`Module`}),n},Xn=Yn({make:()=>Zn});const Zn=e=>e,Qn=Zn(e=>a(void 0));var Z=Yn({DESCRIPTION_MODULE:()=>$n,IO_CELLS:()=>er,apply:()=>cr,canonical:()=>lr,decide:()=>rr,decode:()=>nr,encode:()=>ir,read:()=>tr,vocabulary:()=>dr,write:()=>ar});const $n=`@systemfsoftware/effect-cell-types`,er={cells:[`store`,`adapter`],sources:[`effect/Clock`,`effect/System`]},Q=(e,t)=>{let n=e.layers,r=n[n.length-1];return{module:e.module,ioCells:e.ioCells,layers:[...n.slice(0,-1),{...r,phases:[...r?.phases??[],t]}]}},tr=(e,t)=>({"call read(command) before decode(raw)":!0,module:$n,ioCells:er,layers:[...t?.layers??[],{phases:[{name:`read`,kind:`impure`,convention:`effect`,run:e}]}]}),nr=ae(2,(e,t)=>({"call decode(raw) before decide(decoded)":!0,...Q(e,{name:`decode`,kind:`pure`,convention:`either-fail`,run:t})})),rr=ae(2,(e,t)=>({"call decide(decoded) before encode(decision)":!0,...Q(e,{name:`decide`,kind:`pure`,convention:`either-pass`,run:t})})),ir=ae(2,(e,t)=>({"call encode(decision) before write(output)":!0,...Q(e,{name:`encode`,kind:`pure`,convention:`total`,run:t})})),ar=ae(2,(e,t)=>({"call write(output) before applying the description":!0,...Q(e,{name:`write`,kind:`impure`,convention:`effect`,run:t})})),or=e=>ie(e),sr=(e,t)=>ge(function*(){let n=e.phases,r=n[n.length-1];if(!r||r.name!==`write`)return yield*S(Error(`effect-cell-types: a layer reached the interpreter without a write phase closing it`));let i=t;for(let e of n.slice(0,-1))switch(e.convention){case`effect`:i=yield*e.run(i);break;case`either-fail`:i=yield*oe(e.run(i),{onFailure:xe,onSuccess:x});break;case`either-pass`:i=e.run(i);break;case`total`:if(!or(i))return yield*S(Error(`effect-cell-types: an encode phase received a value that is not the decide outcome`));i=e.run(i);break;default:return yield*S(Error(`effect-cell-types: unknown phase convention ${String(e)}`))}return yield*r.run(i)}),cr=(e,n)=>ge(function*(){let r=yield*fe(e.layers,e=>sr(e,n));return yield*t(te(r),{onNone:()=>S(Error(`effect-cell-types: a description reached the interpreter with no layers`)),onSome:x})}),lr=ar(ir(rr(nr(tr(()=>Ne),()=>a(void 0)),Qn),()=>void 0),()=>Ne),ur=ne(lr.layers,e=>e.phases.map(({convention:e,kind:t,name:n})=>({convention:e,kind:t,name:n}))),dr={module:lr.module,ioCells:lr.ioCells,phases:ur,byKind:{pure:ur.filter(e=>e.kind===`pure`).map(e=>e.name),impure:ur.filter(e=>e.kind===`impure`).map(e=>e.name)},applier:`apply`},fr=C({code:Be,stdout:E,stderr:E});var pr=class extends A()(`Blocked`,{reason:E}){},mr=class extends A()(`Continue`,{warning:M(E),updatedInput:M(O(E,N))}){};I([pr,mr]);const hr=C({decision:M(E),reason:M(E),hookSpecificOutput:M(C({permissionDecision:M(E),permissionDecisionReason:M(E),updatedInput:M(O(E,N)),additionalContext:M(E)}))}).pipe(Ze({toArbitrary:()=>e=>e.record({decision:e.string(),reason:e.string(),hookSpecificOutput:e.record({permissionDecision:e.string(),permissionDecisionReason:e.string(),updatedInput:e.dictionary(e.string(),e.jsonValue()),additionalContext:e.string()})})})),gr=E.pipe(st(Ye(hr),{decode:ze(e=>pt(j(Ye(hr)))(e).pipe(Fe(e=>lt(e)?e.issue:e))),encode:Le(e=>JSON.stringify(e))})),_r=k(gr),vr=(e,t)=>e===2?`ExitBlock`:e===0?t.trim().startsWith(`{`)?`ExitDecisionJson`:`ExitNoDecision`:`ExitOther`,yr=(e,t)=>{let n=e.trim();return n===``?`Blocked by ${t} hook`:n},br=e=>e.trim()===``?`allow`:`warning`,xr=e=>e.trim(),Sr=(e,t)=>{let n=e??t;return n===`deny`||n===`block`?`block`:`allow`},Cr=(e,t,n,r)=>{let i=e===`deny`?t:n;return i===void 0||i.trim()===``?`Blocked by ${r} hook`:i};var wr=class extends A()(`Block`,{reason:E}){},Tr=class extends A()(`Allow`,{updatedInput:M(O(E,N))}){},Er=class extends A()(`Warning`,{message:E}){};I([wr,Tr,Er]);const Dr=Symbol.for(`@systemfsoftware/omp-claude-compat/InterpretHookCommand`);var Or=class extends A()(`InterpretHookCommand`,{result:fr,event:E,parsed:Je(hr)}){[Dr]=Dr};const kr=Symbol.for(`@systemfsoftware/omp-claude-compat/HookVerdictError`);var Ar=class extends mt()(`HookVerdictError`,{raw:E}){[kr]=kr};const jr=e=>z(vr(e.result.code,e.result.stdout)).pipe(B(`ExitBlock`,()=>a(new wr({reason:yr(e.result.stderr,e.event)}))),B(`ExitNoDecision`,()=>a(new Tr({}))),B(`ExitDecisionJson`,()=>t(e.parsed,{onNone:()=>h(new Ar({raw:e.result.stdout})),onSome:t=>z(Sr(t.hookSpecificOutput?.permissionDecision,t.decision)).pipe(B(`block`,()=>a(new wr({reason:Cr(t.hookSpecificOutput?.permissionDecision,t.hookSpecificOutput?.permissionDecisionReason,t.reason,e.event)}))),B(`allow`,()=>a(new Tr({updatedInput:t.hookSpecificOutput?.updatedInput}))),H)})),B(`ExitOther`,()=>z(br(e.result.stderr)).pipe(B(`warning`,()=>a(new Er({message:xr(e.result.stderr)}))),B(`allow`,()=>a(new Tr({}))),H)),H),Mr=F(`SubmitHookVerdictError`,{error:Ar,code:qe,stdout:E}),Nr=Xn.make(({cmd:e,code:t,stdout:n})=>p(jr(e),{onFailure:e=>Mr.make({error:e,code:t,stdout:n}),onSuccess:e=>({verdict:e,code:t,stdout:n})})),Pr={},Fr=P(Bn),Ir=tt([]);_()(`@systemfsoftware/omp-claude-compat/AsyncHookContextState`);function Lr(e){let t=e.trim();t.length!==0&&De(ct(Ir,e=>e.length>=64?[...e.slice(1),t]:[...e,t]))}function Rr(){return De($e(Ir,[]))}var zr=class extends _()(`SuperviseForkExecutorDeps`){};const Br=(e,t,n)=>e.pipe(be({onSuccess:e=>{let t=_r(e.stdout);if(le(t)){let e=t.value.hookSpecificOutput?.additionalContext;e!==void 0&&Lr(e)}},onFailure:e=>{se(e)||t.ui.notify(`Background hook failed: ${n}: ${ce(e).split(`
|
|
4
|
-
`)[0]}`,`error`)}}));var Vr=class extends _()(`RunHooksForEventExecutorDeps`){};const Hr=b(`runHooksForEventUnbounded`)(function*(t,i,o,s,l){let u=s.cwd,d=n(Fr(o.tool_input),()=>Pr),f,p=o,m=K({_tag:`MatcherUnreadable`,event:l},T),ee=e(Z.read(({hook:e,input:t})=>X(e,t,u,l)),Z.decode(e=>a({cmd:new Or({result:e,event:l,parsed:ue(_r(e.stdout),{onFailure:()=>r(),onSuccess:g})}),code:e.code,stdout:e.stdout})),Z.decide(Nr),Z.encode(e=>z(oe(e,{onFailure:({error:e})=>new Er({message:`Hook exited 0 but produced invalid JSON: ${e.raw.slice(0,200)}`}),onSuccess:({verdict:e})=>e})).pipe(V(`Block`,e=>new pr({reason:e.reason})),V(`Warning`,e=>new mr({warning:e.message})),V(`Allow`,e=>new mr({updatedInput:e.updatedInput})),H)),Z.write(e=>Te(()=>z(e).pipe(V(`Blocked`,e=>g({block:!0,reason:e.reason})),V(`Continue`,e=>(e.warning!==void 0&&f===void 0&&(f=e.warning),e.updatedInput!==void 0&&(p={...p,...e.updatedInput}),r())),H))));for(let e of t)if(!(m&&e.matcher!==void 0)&&ot(i,e.matcher))for(let t of e.hooks){if(t.type!==`command`||t.if!==void 0&&(!K({_tag:`IfEvaluatingEvent`,event:l},T)||!ft(t.if,i,d,u)))continue;if(t.async===!0||t.asyncRewake===!0){yield*ve(Br(X(t,p,u,l,!1),s,t.command));continue}let e=yield*Z.apply(ee,{hook:t,input:p});if(c(e))return e.value}return{...p===o?{}:{updatedInput:p},...f===void 0?{}:{warning:f}}}),$=b(`runHooksForEvent`)(function*(e,t,n,r,i){return yield*Hr(e,t,n,r,i).pipe(Me(26e3),we(`TimeoutError`,()=>x({})))});var Ur=class extends _()(`RunLifecycleHooksExecutorDeps`){};const Wr=b(`runLifecycleHooks`)(function*(e,t,n){let r=t.cwd,i={...L(()=>t.sessionManager.getSessionId())},a=K({_tag:`MatcherUnreadable`,event:n},T);yield*fe(ee(e,e=>!(a&&e.matcher!==void 0)),e=>fe(ee(e.hooks,e=>e.type===`command`&&e.if===void 0),e=>e.async===!0||e.asyncRewake===!0?ve(Br(X(e,i,r,n,!1),t,e.command)).pipe(je):X(e,i,r,n).pipe(je),{discard:!0}),{discard:!0})}),Gr=e=>e.reason===void 0?{}:{warning:e.reason};var Kr=class extends _()(`RunPostToolUseFailureHooksExecutorDeps`){};const qr=P(D(C({text:M(E)}))),Jr=P(E),Yr=e=>t(qr(e),{onSome:e=>e.flatMap(e=>e.text===void 0?[]:[e.text]).join(`
|
|
5
|
-
`),onNone:()=>n(Jr(e),()=>``)}),Xr=b(`runPostToolUseFailureHooks`)(function*(e,t,r){let i=at(t.toolName),a=Qe(i,n(Fr(t.input),()=>Pr)),o={...L(()=>r.sessionManager.getSessionId()),tool_name:i,tool_input:a,tool_use_id:t.toolCallId,error:Yr(t.content)},s=yield*$(e.hooks.PostToolUseFailure,i,o,r,`PostToolUseFailure`);return s.block===!0?Gr(s):s});var Zr=class extends _()(`RunPostToolUseHooksExecutorDeps`){};const Qr=b(`runPostToolUseHooks`)(function*(e,t,r){let i=at(t.toolName),a=L(()=>r.sessionManager.getSessionId()),o=Qe(i,n(Fr(t.input),()=>Pr)),s=rt(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 Gr(s);l===void 0&&(l=s.warning),u=s}return l===void 0?u:{...u,warning:l}});var $r=class extends _()(`RunPreCompactHooksExecutorDeps`){};const ei=b(`runPreCompactHooks`)(function*(e,t){let n={...L(()=>t.sessionManager.getSessionId())};return yield*$(e.hooks.PreCompact,``,n,t,`PreCompact`)});var ti=class extends _()(`RunPreToolUseHooksExecutorDeps`){};const ni=b(`runPreToolUseHooks`)(function*(e,t,r){let i=at(t.toolName),a=L(()=>r.sessionManager.getSessionId()),o=n(Fr(t.input),()=>Pr),s=Qe(i,o),c=Xe(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=rt(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,dt(o,f))});var ri=class extends _()(`RunSessionStartHooksExecutorDeps`){};const ii=b(`runSessionStartHooks`)(function*(e,t,n){let r=e.hooks.SessionStart;if(r.length===0)return;let i=n.cwd,a={...L(()=>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(Br(X(t,a,i,`SessionStart`,!1),n,t.command));continue}yield*X(t,a,i,`SessionStart`)}}});var ai=class extends _()(`RunSessionSwitchHooksExecutorDeps`){};const oi=b(`runSessionSwitchHooks`)(function*(e,t,n){(t===`resume`||t===`fork`)&&(yield*ii(e,t,n))});var si=class extends _()(`RunToolResultHooksExecutorDeps`){};const ci=b(`runToolResultHooks`)(function*(e,t,n){return t.isError===!0?yield*Xr(e,t,n):yield*Qr(e,t,n)}),li=[`/`,`!`,`->`,`=>`,`$ `,`$ `,`$
|
|
6
|
-
`,`$\r`,`$$ `,`$$ `,`$$
|
|
7
|
-
`,`$$\r`],ui=e=>li.some(t=>`${e.trimStart()} `.startsWith(t));var di=class extends _()(`RunUserPromptSubmitHooksExecutorDeps`){};const fi=b(`runUserPromptSubmitHooks`)(function*(t,n,i){let o=t.hooks.UserPromptSubmit,s=i.cwd,l=ui(n.text),u=z(l).pipe(B(!0,()=>[]),B(!1,()=>Rr()),H),d=[],f={...L(()=>i.sessionManager.getSessionId()),prompt:n.text,source:n.source},p=e(Z.read(({hook:e,input:t})=>X(e,t,s,`UserPromptSubmit`)),Z.decode(e=>a({cmd:new Or({result:e,event:`UserPromptSubmit`,parsed:ue(_r(e.stdout),{onFailure:()=>r(),onSuccess:g})}),code:e.code,stdout:e.stdout})),Z.decide(Nr),Z.encode(e=>oe(e,{onFailure:({code:e,stdout:t})=>({blockReason:void 0,code:e,stdout:t}),onSuccess:({verdict:e,code:t,stdout:n})=>({blockReason:z(e).pipe(V(`Block`,e=>e.reason),jt(()=>void 0)),code:t,stdout:n})})),Z.write(({blockReason:e,code:t,stdout:n})=>Te(()=>{if(e!==void 0)return i.ui.notify(`Prompt blocked by UserPromptSubmit hook: ${e}`,`error`),g({handled:!0});if(t!==0)return r();let a=n.trim();return a.length>0&&d.push(a),r()})));for(let e of o)for(let t of e.hooks){if(t.type!==`command`||t.if!==void 0)continue;let e=yield*Z.apply(p,{hook:t,input:f});if(c(e))return e.value}return z(l).pipe(B(!0,()=>void 0),B(!1,()=>{let e=[...u,...d].join(`
|
|
8
|
-
|
|
9
|
-
`);if(e.length===0)return;let t={text:`${e}\n\n${n.text}`};return n.images!==void 0&&(t.images=n.images),t}),H)});export{hn as A,J as C,wn as D,Tn as E,z as F,_t as I,yt as L,mn as M,H as N,_n as O,V as P,An as S,xn as T,Vr as _,ai as a,jn as b,ii as c,$r as d,ei as f,Wr as g,Ur as h,ci as i,gn as j,yn as k,ti as l,Kr as m,fi as n,oi as o,Zr as p,si as r,ri as s,di as t,ni as u,zr as v,bn as w,On as x,qn as y};
|