@seanmozeik/tripwire 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +20 -19
- package/dist/tripwire-pi.js +15 -30
- package/dist/tripwire.js +105 -122
- package/dist/types/lib/bash/types.d.ts +6 -0
- package/dist/types/lib/code/analyze.d.ts +3 -0
- package/dist/types/lib/code/calls.d.ts +8 -0
- package/dist/types/lib/code/carriers.d.ts +18 -0
- package/dist/types/lib/code/containers.d.ts +4 -0
- package/dist/types/lib/code/control.d.ts +13 -0
- package/dist/types/lib/code/data.d.ts +9 -0
- package/dist/types/lib/code/imports.d.ts +5 -0
- package/dist/types/lib/code/members.d.ts +4 -0
- package/dist/types/lib/code/syntax.d.ts +10 -0
- package/dist/types/lib/code/types.d.ts +51 -0
- package/dist/types/lib/code/uv.d.ts +13 -0
- package/dist/types/lib/code/values.d.ts +9 -0
- package/dist/types/lib/event.d.ts +7 -1
- package/dist/types/rules/embedded-code.d.ts +15 -0
- package/package.json +10 -7
package/dist/tripwire.js
CHANGED
|
@@ -1,146 +1,129 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
-
var zz=Object.defineProperty;var Vz=(e)=>e;function Kz(e,t){this[e]=Vz.bind(null,t)}var Qn=(e,t)=>{for(var n in t)zz(e,n,{get:t[n],enumerable:!0,configurable:!0,set:Kz.bind(t,n)})};var v=(e,t)=>()=>(e&&(t=e(e=0)),t);var Bm;var GS=v(()=>{Bm={name:"@seanmozeik/tripwire",version:"0.8.0",description:"Configurable safety hooks for Claude Code, Codex, Cursor, Pi, and Oh My Pi",keywords:["ai-agents","bun","claude-code","codex","cursor","hooks","safety"],homepage:"https://github.com/seanmozeik/tripwire#readme",bugs:{url:"https://github.com/seanmozeik/tripwire/issues"},license:"MIT",author:"Sean Mozeik",repository:{type:"git",url:"git+https://github.com/seanmozeik/tripwire.git"},bin:{tripwire:"./dist/tripwire-cli.js","tripwire-hook":"./dist/tripwire-hook.js"},workspaces:["packages/*"],files:["dist","LICENSE","package.json","README.md"],type:"module",types:"./dist/types/index.d.ts",exports:{".":{types:"./dist/types/index.d.ts",import:"./dist/index.js",default:"./dist/index.js"}},publishConfig:{access:"public"},scripts:{build:"bun scripts/build.ts",prepublishOnly:"bun run verify",check:"bun run format && bun run lint:fix && bun run typecheck",format:"oxfmt --write .","format:check":"oxfmt --check .",lint:"oxlint .","lint:fix":"oxlint --format agent --fix .",prepare:"bunx effect-tsgo patch",test:"bun test",typecheck:"tsc --noEmit",verify:"bun run format:check && bun run lint && bun run typecheck && bun test && bun run build"},dependencies:{unbash:"4.0.10"},devDependencies:{"@effect/platform-bun":"4.0.0-rc.112","@effect/tsgo":"0.38.0","@seanmozeik/de-clank":"0.1.8","bun-types":"1.4.0",effect:"4.0.0-rc.112",oxfmt:"0.65.0",oxlint:"1.80.0","oxlint-tsgolint":"7.0.2001",typescript:"7.0.2"},peerDependencies:{"@effect/platform-bun":"4.0.0-rc.112",effect:"4.0.0-rc.112"},optionalDependencies:{"@seanmozeik/tripwire-darwin-arm64":"0.8.0"},engines:{bun:">=1.4"}}});var fe=(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 r=0,o=t.length;r<o;r++)n=t[r](n);return n}}},Jz,za;var ct=v(()=>{Jz={pipe(){return fe(this,arguments)}},za=function(){function e(){}return e.prototype=Jz,e}()});function To(e,...t){return fe(e,t)}function RA(e,t,n,r,o,s,i,a,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 o(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return s(o(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return i(s(o(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return a(i(s(o(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return c(a(i(s(o(r(n(t(e.apply(this,arguments)))))))))}}return}function bn(e){let t=new WeakMap;return(n)=>{let r=t.get(n);if(r!==void 0)return r;let o=e(n);return t.set(n,o),o}}function Va(e){let t=new WeakMap;return(n)=>{let r=t.get(n);if(r!==void 0)return r;let o=e(n);return t.set(n,o),t.set(o,o),o}}var p=function(e,t){if(typeof e==="function")return function(){return e(arguments)?t.apply(this,arguments):(n)=>t(n,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(n,r){if(arguments.length>=2)return t(n,r);return function(o){return t(o,n)}};case 3:return function(n,r,o){if(arguments.length>=3)return t(n,r,o);return function(s){return t(s,n,r)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(r){return t(r,...n)}}}},L=(e)=>e,_t=(e)=>()=>e,Fr,Of,Hm,Ao,Ns;var ne=v(()=>{ct();Fr=_t(!0),Of=_t(!1),Hm=_t(null),Ao=_t(void 0),Ns=Ao});var Pf=(e)=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;if(e instanceof Error)t.delete("stack");let n=Object.getPrototypeOf(e),r=n;while(r!==null&&r!==Object.prototype){let o=Reflect.ownKeys(r);for(let s=0;s<o.length;s++)t.add(o[s]);r=Object.getPrototypeOf(r)}if(t.has("constructor")&&typeof e.constructor==="function"&&n===e.constructor.prototype)t.delete("constructor");return t},ku;var JS=v(()=>{ku=new WeakSet});function _o(e){return typeof e==="string"}function Rf(e){return typeof e==="number"}function Wm(e){return typeof e==="boolean"}function FA(e){return typeof e==="bigint"}function QS(e){return typeof e==="symbol"}function jm(e){return _o(e)||Rf(e)||QS(e)}function Mn(e){return typeof e==="function"}function Li(e){return e===void 0}function Ve(e){return e!==void 0}function Ff(e){return e!==null}function MA(e){return e===null||e===void 0}function qm(e){return e!=null}function DA(e){return!1}function ZS(e){return!0}function Dn(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Mf(e){return typeof e==="object"&&e!==null||Mn(e)}function NA(e){return e instanceof Error}function ns(e){return D(e,Symbol.iterator)||_o(e)}var D,eo;var ge=v(()=>{ne();D=p(2,(e,t)=>Mf(e)&&(t in e)),eo=p(2,(e,t)=>D(e,"_tag")&&e._tag===t)});function Xz(e,t){if(eE.has(e))return Ze("[Circular]");eE.add(e);let n=t();return eE.delete(e),n}var _e="~effect/interfaces/Hash",ie=(e)=>{switch(typeof e){case"number":return dr(e);case"bigint":return Ze(e.toString(10));case"boolean":return Ze(String(e));case"symbol":return Ze(String(e));case"string":return Ze(e);case"undefined":return Ze("undefined");case"function":case"object":if(e===null)return Ze("null");else if(e instanceof Date){if(Number.isNaN(e.getTime()))return Ze("Invalid Date");return Ze(e.toISOString())}else if(e instanceof RegExp)return Ze(e.toString());else{if(ku.has(e))return zm(e);if(XS.has(e))return XS.get(e);let t=Xz(e,()=>{if(Qz(e))return e[_e]();else if(typeof e==="function")return zm(e);else if(e instanceof DataView)return Cu(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e)||ArrayBuffer.isView(e))return Cu(e);else if(e instanceof Map)return Zz(e);else if(e instanceof Set)return Yz(e);return nE(e)});return XS.set(e,t),t}default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},zm=(e)=>{if(!YS.has(e))YS.set(e,dr(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)));return YS.get(e)},Ot,Bi=(e)=>e&3221225471|e>>>1&1073741824,Qz=(e)=>D(e,_e),dr=(e)=>{if(e!==e)return Ze("NaN");if(e===1/0)return Ze("Infinity");if(e===-1/0)return Ze("-Infinity");let t=e|0;if(t!==e)t^=e*4294967295;while(e>4294967295)t^=e/=4294967295;return Bi(t)},Ze=(e)=>{let t=5381,n=e.length;while(n)t=t*33^e.charCodeAt(--n);return Bi(t)},tE=(e,t)=>{let n=12289;for(let r of t)n^=Ot(ie(r),ie(e[r]));return Bi(n)},nE=(e)=>tE(e,Pf(e)),rE=(e,t)=>(n)=>{let r=e;for(let o of n)r^=t(o);return Bi(r)},Cu,Zz,Yz,YS,XS,eE;var wn=v(()=>{ne();JS();ge();Ot=p(2,(e,t)=>e*53^t),Cu=rE(6151,ie),Zz=rE(Ze("Map"),([e,t])=>Ot(ie(e),ie(t))),Yz=rE(Ze("Set"),ie),YS=new WeakMap,XS=new WeakMap,eE=new WeakSet});function ee(){if(arguments.length===1)return(e)=>Ka(e,arguments[0]);return Ka(arguments[0],arguments[1])}function Ka(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;if(n!==typeof t)return!1;if(n==="number"&&e!==e&&t!==t)return!0;if(n!=="object"&&n!=="function")return!1;if(ku.has(e)||ku.has(t))return!1;return nV(e,t,tV)}function eV(e,t,n){let r=oE.has(e),o=sE.has(t);if(r&&o)return!0;if(r||o)return!1;oE.add(e),sE.add(t);let s=n();return oE.delete(e),sE.delete(t),s}function tV(e,t){if(ie(e)!==ie(t))return!1;else if(e instanceof Date){if(!(t instanceof Date))return!1;let s=e.getTime(),i=t.getTime();return s===i||Number.isNaN(s)&&Number.isNaN(i)}else if(e instanceof RegExp){if(!(t instanceof RegExp))return!1;return e.toString()===t.toString()}let n=UA(e),r=UA(t);if(n!==r)return!1;let o=n&&r;if(typeof e==="function"&&!o)return!1;return eV(e,t,()=>{if(o)return e[Oe](t);else if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;return rV(e,t)}else if(ArrayBuffer.isView(e)){let s=e instanceof DataView;if(!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||s!==t instanceof DataView)return!1;if(s){let i=t;return $A(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(i.buffer,i.byteOffset,i.byteLength))}return $A(e,t)}else if(e instanceof Map){if(!(t instanceof Map)||e.size!==t.size)return!1;return sV(e,t)}else if(e instanceof Set){if(!(t instanceof Set)||e.size!==t.size)return!1;return iV(e,t)}return oV(e,t)})}function nV(e,t,n){let r=Vm.get(e);if(!r)r=new WeakMap,Vm.set(e,r);else if(r.has(t))return r.get(t);let o=n(e,t);r.set(t,o);let s=Vm.get(t);if(!s)s=new WeakMap,Vm.set(t,s);return s.set(e,o),o}function rV(e,t){for(let n=0;n<e.length;n++)if(!Ka(e[n],t[n]))return!1;return!0}function $A(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 oV(e,t){let n=Pf(e),r=Pf(t);if(n.size!==r.size)return!1;for(let o of n)if(!r.has(o)||!Ka(e[o],t[o]))return!1;return!0}function Km(e,t){return function(r,o){let s=Array.from(o);for(let[i,a]of r){let c=!1;for(let u=0;u<s.length;u++){let[l,f]=s[u];if(e(i,l)&&t(a,f)){s[u]=s[s.length-1],s.pop(),c=!0;break}}if(!c)return!1}return!0}}function Gm(e){return function(n,r){let o=Array.from(r);for(let s of n){let i=!1;for(let a=0;a<o.length;a++){let c=o[a];if(e(s,c)){o[a]=o[o.length-1],o.pop(),i=!0;break}}if(!i)return!1}return!0}}var Oe="~effect/interfaces/Equal",oE,sE,Vm,sV,iV,UA=(e)=>D(e,Oe),iE=()=>ee,aE=(e)=>(ku.add(e),e);var Pt=v(()=>{wn();JS();ge();oE=new WeakSet,sE=new WeakSet;Vm=new WeakMap;sV=Km(Ka,Ka);iV=Gm(Ka)});function vu(e){if(aV(e))return cE(e);return e}function cE(e){return e[Df](globalThis[Iu]?.context??cV)}var Df,aV=(e)=>D(e,Df),Iu="~effect/Fiber/currentFiber",LA,cV;var Jm=v(()=>{ct();ge();Df=Symbol.for("~effect/Redactable");LA=new Map,cV={"~effect/Context":{},base:LA,depth:0,mapUnsafe:LA,pipe(){return fe(this,arguments)}}});function j(e,t){let n=t?.space??0,r=new WeakSet,o=!n?"":typeof n==="number"?" ".repeat(n):n,s=(u)=>o.repeat(u),i=(u,l)=>{let f=u?.constructor;return f&&f!==Object.prototype.constructor&&f.name?`${f.name}(${l})`:l},a=(u)=>{try{return Reflect.ownKeys(u)}catch{return["[ownKeys threw]"]}};function c(u,l=0){if(typeof u==="string")return JSON.stringify(u);if(typeof u==="number"||u==null||typeof u==="boolean"||typeof u==="symbol")return String(u);if(typeof u==="bigint")return String(u)+"n";if(typeof u==="object"||typeof u==="function"){if(r.has(u))return uV;r.add(u);let f;if(Df in u)f=c(cE(u),l);else if(Array.isArray(u))f=!o||u.length<=1?`[${u.map((d)=>c(d,l)).join(",")}]`:`[
|
|
4
|
-
${s(
|
|
5
|
-
`+s(
|
|
6
|
-
${s(
|
|
7
|
-
${d.map((
|
|
3
|
+
var E=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};var Wu;var hh=E(()=>{Wu={name:"@seanmozeik/tripwire",version:"0.9.0",description:"Configurable safety hooks for Claude Code, Codex, Cursor, Pi, and Oh My Pi",keywords:["ai-agents","bun","claude-code","codex","cursor","hooks","safety"],homepage:"https://github.com/seanmozeik/tripwire#readme",bugs:{url:"https://github.com/seanmozeik/tripwire/issues"},license:"MIT",author:"Sean Mozeik",repository:{type:"git",url:"git+https://github.com/seanmozeik/tripwire.git"},bin:{tripwire:"./dist/tripwire-cli.js","tripwire-hook":"./dist/tripwire-hook.js"},workspaces:["packages/*"],files:["dist","LICENSE","package.json","README.md"],type:"module",types:"./dist/types/index.d.ts",exports:{".":{types:"./dist/types/index.d.ts",import:"./dist/index.js",default:"./dist/index.js"}},publishConfig:{access:"public"},scripts:{build:"bun scripts/build.ts",prepublishOnly:"bun run verify",check:"bun run format && bun run lint:fix && bun run typecheck",format:"oxfmt --write .","format:check":"oxfmt --check .",lint:"oxlint .","lint:fix":"oxlint --format agent --fix .",prepare:"bunx effect-tsgo patch",test:"bun test",typecheck:"tsc --noEmit",verify:"bun run format:check && bun run lint && bun run typecheck && bun test && bun run build"},dependencies:{"@lezer/common":"1.5.2","@lezer/javascript":"1.5.4","@lezer/python":"1.1.19",unbash:"4.0.11"},devDependencies:{"@effect/platform-bun":"4.0.0-rc.112","@effect/tsgo":"0.45.0","@seanmozeik/de-clank":"0.1.8","bun-types":"1.4.2",effect:"4.0.0-rc.112",oxfmt:"0.67.0",oxlint:"1.82.0","oxlint-tsgolint":"7.0.2001",typescript:"7.0.2"},peerDependencies:{"@effect/platform-bun":"4.0.0-rc.112",effect:"4.0.0-rc.112"},optionalDependencies:{"@seanmozeik/tripwire-darwin-arm64":"0.9.0"},engines:{bun:">=1.4"}}});var pe=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let r=e;for(let n=0,o=t.length;n<o;n++)r=t[n](r);return r}}},F1,Tc;var It=E(()=>{F1={pipe(){return pe(this,arguments)}},Tc=function(){function e(){}return e.prototype=F1,e}()});function Ho(e,...t){return pe(e,t)}function gS(e,t,r,n,o,s,i,a,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return r(t(e.apply(this,arguments)))};case 4:return function(){return n(r(t(e.apply(this,arguments))))};case 5:return function(){return o(n(r(t(e.apply(this,arguments)))))};case 6:return function(){return s(o(n(r(t(e.apply(this,arguments))))))};case 7:return function(){return i(s(o(n(r(t(e.apply(this,arguments)))))))};case 8:return function(){return a(i(s(o(n(r(t(e.apply(this,arguments))))))))};case 9:return function(){return c(a(i(s(o(n(r(t(e.apply(this,arguments)))))))))}}return}function so(e){let t=new WeakMap;return(r)=>{let n=t.get(r);if(n!==void 0)return n;let o=e(r);return t.set(r,o),o}}function ea(e){let t=new WeakMap;return(r)=>{let n=t.get(r);if(n!==void 0)return n;let o=e(r);return t.set(r,o),t.set(o,o),o}}var v=function(e,t){if(typeof e==="function")return function(){return e(arguments)?t.apply(this,arguments):(r)=>t(r,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(r,n){if(arguments.length>=2)return t(r,n);return function(o){return t(o,r)}};case 3:return function(r,n,o){if(arguments.length>=3)return t(r,n,o);return function(s){return t(s,r,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let r=arguments;return function(n){return t(n,...r)}}}},B=(e)=>e,$r=(e)=>()=>e,no,mh,Yo,oo;var oe=E(()=>{It();no=$r(!0),mh=$r(!1),Yo=$r(void 0),oo=Yo});var vc=(e)=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;if(e instanceof Error)t.delete("stack");let r=Object.getPrototypeOf(e),n=r;while(n!==null&&n!==Object.prototype){let o=Reflect.ownKeys(n);for(let s=0;s<o.length;s++)t.add(o[s]);n=Object.getPrototypeOf(n)}if(t.has("constructor")&&typeof e.constructor==="function"&&r===e.constructor.prototype)t.delete("constructor");return t},Cc;var Oh=E(()=>{Cc=new WeakSet});function Jo(e){return typeof e==="string"}function Qc(e){return typeof e==="number"}function zu(e){return typeof e==="boolean"}function xS(e){return typeof e==="symbol"}function gh(e){return Jo(e)||Qc(e)||xS(e)}function io(e){return typeof e==="function"}function ta(e){return e===void 0}function wt(e){return e!==void 0}function _c(e){return e!==null}function yS(e){return e===null||e===void 0}function xh(e){return e!=null}function SS(e){return!0}function yh(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Xu(e){return typeof e==="object"&&e!==null||io(e)}function ES(e){return e instanceof Error}var G,Bs;var ye=E(()=>{oe();G=v(2,(e,t)=>Xu(e)&&(t in e)),Bs=v(2,(e,t)=>G(e,"_tag")&&e._tag===t)});function N1(e,t){if(bh.has(e))return it("[Circular]");bh.add(e);let r=t();return bh.delete(e),r}var Je="~effect/interfaces/Hash",Oe=(e)=>{switch(typeof e){case"number":return ra(e);case"bigint":return it(e.toString(10));case"boolean":return it(String(e));case"symbol":return it(String(e));case"string":return it(e);case"undefined":return it("undefined");case"function":case"object":if(e===null)return it("null");else if(e instanceof Date){if(Number.isNaN(e.getTime()))return it("Invalid Date");return it(e.toISOString())}else if(e instanceof RegExp)return it(e.toString());else{if(Cc.has(e))return ju(e);if(Eh.has(e))return Eh.get(e);let t=N1(e,()=>{if(U1(e))return e[Je]();else if(typeof e==="function")return ju(e);else if(e instanceof DataView)return Vu(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e)||ArrayBuffer.isView(e))return Vu(e);else if(e instanceof Map)return D1(e);else if(e instanceof Set)return M1(e);return Ph(e)});return Eh.set(e,t),t}default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},ju=(e)=>{if(!Sh.has(e))Sh.set(e,ra(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER)));return Sh.get(e)},Yt,Bu=(e)=>e&3221225471|e>>>1&1073741824,U1=(e)=>G(e,Je),ra=(e)=>{if(e!==e)return it("NaN");if(e===1/0)return it("Infinity");if(e===-1/0)return it("-Infinity");let t=e|0;if(t!==e)t^=e*4294967295;while(e>4294967295)t^=e/=4294967295;return Bu(t)},it=(e)=>{let t=5381,r=e.length;while(r)t=t*33^e.charCodeAt(--r);return Bu(t)},kh=(e,t)=>{let r=12289;for(let n of t)r^=Yt(Oe(n),Oe(e[n]));return Bu(r)},Ph=(e)=>kh(e,vc(e)),wh=(e,t)=>(r)=>{let n=e;for(let o of r)n^=t(o);return Bu(n)},Vu,D1,M1,Sh,Eh,bh;var En=E(()=>{oe();Oh();ye();Yt=v(2,(e,t)=>e*53^t),Vu=wh(6151,Oe),D1=wh(it("Map"),([e,t])=>Yt(Oe(e),Oe(t))),M1=wh(it("Set"),Oe),Sh=new WeakMap,Eh=new WeakMap,bh=new WeakSet});function at(){if(arguments.length===1)return(e)=>Gs(e,arguments[0]);return Gs(arguments[0],arguments[1])}function Gs(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let r=typeof e;if(r!==typeof t)return!1;if(r==="number"&&e!==e&&t!==t)return!0;if(r!=="object"&&r!=="function")return!1;if(Cc.has(e)||Cc.has(t))return!1;return W1(e,t,q1)}function Z1(e,t,r){let n=Th.has(e),o=vh.has(t);if(n&&o)return!0;if(n||o)return!1;Th.add(e),vh.add(t);let s=r();return Th.delete(e),vh.delete(t),s}function q1(e,t){if(Oe(e)!==Oe(t))return!1;else if(e instanceof Date){if(!(t instanceof Date))return!1;let s=e.getTime(),i=t.getTime();return s===i||Number.isNaN(s)&&Number.isNaN(i)}else if(e instanceof RegExp){if(!(t instanceof RegExp))return!1;return e.toString()===t.toString()}let r=kS(e),n=kS(t);if(r!==n)return!1;let o=r&&n;if(typeof e==="function"&&!o)return!1;return Z1(e,t,()=>{if(o)return e[Ke](t);else if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;return L1(e,t)}else if(ArrayBuffer.isView(e)){let s=e instanceof DataView;if(!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength||s!==t instanceof DataView)return!1;if(s){let i=t;return bS(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(i.buffer,i.byteOffset,i.byteLength))}return bS(e,t)}else if(e instanceof Map){if(!(t instanceof Map)||e.size!==t.size)return!1;return j1(e,t)}else if(e instanceof Set){if(!(t instanceof Set)||e.size!==t.size)return!1;return B1(e,t)}return z1(e,t)})}function W1(e,t,r){let n=Gu.get(e);if(!n)n=new WeakMap,Gu.set(e,n);else if(n.has(t))return n.get(t);let o=r(e,t);n.set(t,o);let s=Gu.get(t);if(!s)s=new WeakMap,Gu.set(t,s);return s.set(e,o),o}function L1(e,t){for(let r=0;r<e.length;r++)if(!Gs(e[r],t[r]))return!1;return!0}function bS(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function z1(e,t){let r=vc(e),n=vc(t);if(r.size!==n.size)return!1;for(let o of r)if(!n.has(o)||!Gs(e[o],t[o]))return!1;return!0}function X1(e,t){return function(n,o){let s=Array.from(o);for(let[i,a]of n){let c=!1;for(let l=0;l<s.length;l++){let[u,f]=s[l];if(e(i,u)&&t(a,f)){s[l]=s[s.length-1],s.pop(),c=!0;break}}if(!c)return!1}return!0}}function V1(e){return function(r,n){let o=Array.from(n);for(let s of r){let i=!1;for(let a=0;a<o.length;a++){let c=o[a];if(e(s,c)){o[a]=o[o.length-1],o.pop(),i=!0;break}}if(!i)return!1}return!0}}var Ke="~effect/interfaces/Equal",Th,vh,Gu,j1,B1,kS=(e)=>G(e,Ke);var co=E(()=>{En();Oh();ye();Th=new WeakSet,vh=new WeakSet;Gu=new WeakMap;j1=X1(Gs,Gs);B1=V1(Gs)});function na(e){if(G1(e))return Ch(e);return e}function Ch(e){return e[$c](globalThis[oa]?.context??Y1)}var $c,G1=(e)=>G(e,$c),oa="~effect/Fiber/currentFiber",PS,Y1;var Yu=E(()=>{It();ye();$c=Symbol.for("~effect/Redactable");PS=new Map,Y1={"~effect/Context":{},base:PS,depth:0,mapUnsafe:PS,pipe(){return pe(this,arguments)}}});function he(e,t){let r=t?.space??0,n=new WeakSet,o=!r?"":typeof r==="number"?" ".repeat(r):r,s=(l)=>o.repeat(l),i=(l,u)=>{let f=l?.constructor;return f&&f!==Object.prototype.constructor&&f.name?`${f.name}(${u})`:u},a=(l)=>{try{return Reflect.ownKeys(l)}catch{return["[ownKeys threw]"]}};function c(l,u=0){if(typeof l==="string")return JSON.stringify(l);if(typeof l==="number"||l==null||typeof l==="boolean"||typeof l==="symbol")return String(l);if(typeof l==="bigint")return String(l)+"n";if(typeof l==="object"||typeof l==="function"){if(n.has(l))return H1;n.add(l);let f;if($c in l)f=c(Ch(l),u);else if(Array.isArray(l))f=!o||l.length<=1?`[${l.map((d)=>c(d,u)).join(",")}]`:`[
|
|
4
|
+
${s(u+1)}${l.map((d)=>c(d,u+1)).join(`,
|
|
5
|
+
`+s(u+1))}
|
|
6
|
+
${s(u)}]`;else if(l instanceof Date)f=TS(l);else if(!t?.ignoreToString&&G(l,"toString")&&typeof l.toString==="function"&&l.toString!==Object.prototype.toString&&l.toString!==Array.prototype.toString){let d=J1(l);f=l instanceof Error&&l.cause?`${d} (cause: ${c(l.cause,u)})`:d}else if(Symbol.iterator in l)f=`${l.constructor.name}(${c(Array.from(l),u)})`;else{let d=a(l);if(!o||d.length<=1){let h=`{${d.map((m)=>`${sa(m)}:${c(l[m],u)}`).join(",")}}`;f=i(l,h)}else{let h=`{
|
|
7
|
+
${d.map((m)=>`${s(u+1)}${sa(m)}: ${c(l[m],u+1)}`).join(`,
|
|
8
8
|
`)}
|
|
9
|
-
${s(l)}}`;f=i(u,m)}}return r.delete(u),f}return String(u)}return c(e,0)}function $s(e){return typeof e==="string"?JSON.stringify(e):String(e)}function Qm(e){return e.map((t)=>`[${$s(t)}]`).join("")}function uE(e){try{return e.toISOString()}catch{return"Invalid Date"}}function lV(e){try{let t=e.toString();return typeof t==="string"?t:String(t)}catch{return"[toString threw]"}}function Ga(e,t){let n=[];return JSON.stringify(e,function(r,o){let s=Object.getOwnPropertyDescriptor(this,r)?.value,i=D(s,Df)?vu(s):vu(o);if(typeof i==="bigint")return j(i);if(typeof i!=="object"||i===null)return i;while(n.length>0&&n[n.length-1]!==this)n.pop();if(n.includes(i))return;return n.push(i),i},t?.space)??"null"}var uV="[Circular]";var Zn=v(()=>{ge();Jm()});var zt,fn=(e)=>{try{if(e=vu(e),D(e,"toJSON")&&Mn(e.toJSON)&&e.toJSON.length===0)return e.toJSON();else if(Array.isArray(e))return e.map(fn);return e}catch{return"[toJSON threw]"}},BA=(e,t=2)=>{if(typeof e==="string")return e;try{return typeof e==="object"?Ga(e,{space:t}):j(e,{space:t})}catch{return String(e)}},HA,fV;var pr=v(()=>{Zn();ge();Jm();zt=Symbol.for("nodejs.util.inspect.custom"),HA={toJSON(){return fn(this)},[zt](){return this.toJSON()},toString(){return j(this.toJSON())}};fV=class fV{[zt](){return this.toJSON()}toString(){return j(this.toJSON())}}});var Hi,dV=()=>{let t={["~effect/Utils/internal"]:(o)=>o()},n={["~effect/Utils/internal"]:(o)=>{try{return o()}finally{}}};return t["~effect/Utils/internal"](()=>Error().stack)?.includes("~effect/Utils/internal")===!0?t["~effect/Utils/internal"]:n["~effect/Utils/internal"]},Fe;var Ja=v(()=>{Hi=class Hi{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 Hi(this.self)}};Fe=dV()});function H(e,t,n){if(t==="__proto__")Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0});else e[t]=n}function Zm(e,t){for(let n of Reflect.ownKeys(t))if(Object.prototype.propertyIsEnumerable.call(t,n))H(e,n,t[n])}function hV(e){return Oo("Effect.evaluate: Not implemented")}var rs="~effect/Effect",Qa="~effect/Exit",pV,qA,ce,Rt,Yn,to,Wi,Ya,Xn,zA,mV,de=(e)=>D(e,rs),lE=(e)=>D(e,Qa),Au="~effect/Cause",Tu="~effect/Cause/Reason",_u=(e)=>D(e,Au),VA=(e)=>D(e,Tu),Us,jA,$f,Uf,Ou,Ls=(e)=>new Us(e),Ym,Lf=(e)=>new Us([new Ou(e)]),Xm,fE=(e)=>new Us([new Xm(e)]),Pu,ji=(e)=>e._tag==="Fail",Xa=(e)=>e._tag==="Die",ec=(e)=>e._tag==="Interrupt",Bs=(e)=>({...mV,[qA]:e.op,[Rt]:e[Rt]??hV,[Yn]:e[Yn],[to]:e[to],[Wi]:e[Wi]}),no=(e)=>{let t=Bs(e);return function(){let n=Object.create(t);return n[ce]=e.single===!1?arguments:arguments[0],n}},KA=(e)=>{let t={[Qa]:Qa,_tag:e.op,get[e.prop](){return this[ce]},...Bs(e),toString(){return`${e.op}(${j(this[ce])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[ce]}},[Oe](n){return lE(n)&&n._tag===this._tag&&ee(this[ce],n[ce])},[_e](){return Ot(Ze(e.op),ie(this[ce]))}};return function(n){let r=Object.create(t);return r[ce]=n,r}},Ke,eh,dE,$n,ro=(e)=>$n(Lf(e)),Oo=(e)=>$n(fE(e)),le,gV,Bf,Hs=(e)=>{class t extends Bf{_tag=e}return t.prototype.name=e,t},Nf="~effect/Cause/NoSuchElementError",th=(e)=>D(e,Nf),os,Za="~effect/Cause/Done",Hf=(e)=>D(e,Za),GA,Ru=(e)=>{if(e===void 0)return GA;return{[Za]:Za,_tag:"Done",value:e}},xV,JA=(e)=>{if(e===void 0)return xV;return ro(Ru(e))};var pt=v(()=>{Pt();Zn();ne();wn();pr();ct();ge();Ja();pV={_A:L,_E:L,_R:L},qA=`${rs}/identifier`,ce=`${rs}/args`,Rt=`${rs}/evaluate`,Yn=`${rs}/successCont`,to=`${rs}/failureCont`,Wi=`${rs}/ensureCont`,Ya=Symbol.for("effect/Effect/Yield"),Xn={pipe(){return fe(this,arguments)},toJSON(){return{...this}},toString(){return j(this.toJSON(),{ignoreToString:!0,space:2})},[zt](){return this.toJSON()}},zA={[_e](){return tE(this,Object.keys(this))},[Oe](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]||!ee(this[t[r]],e[t[r]]))return!1;return!0}},mV={[rs]:pV,...Xn,[Symbol.iterator](){return new Hi(this)},toJSON(){return{_id:"Effect",op:this[qA],...ce in this?{args:this[ce]}:void 0}}};Us=class Us{[Au];reasons;constructor(e){this[Au]=Au,this.reasons=e}pipe(){return fe(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map((e)=>e.toJSON())}}toString(){return`Cause(${j(this.reasons)})`}[zt](){return this.toJSON()}[Oe](e){return _u(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>ee(t,e.reasons[n]))}[_e](){return Cu(this.reasons)}};jA=new WeakMap;$f=class $f{[Tu];annotations;_tag;constructor(e,t,n){if(this[Tu]=Tu,this._tag=e,t!==Uf&&typeof n==="object"&&n!==null&&t.size>0){let r=jA.get(n);if(r)t=new Map([...r,...t]);jA.set(n,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let n=new Map(this.annotations);e.mapUnsafe.forEach((o,s)=>{if(t?.overwrite!==!0&&n.has(s))return;n.set(s,o)});let r=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return r.annotations=n,r}pipe(){return fe(this,arguments)}toString(){return j(this)}[zt](){return this.toString()}};Uf=new Map;Ou=class Ou extends $f{error;constructor(e,t=Uf){super("Fail",t,e);this.error=e}toString(){return`Fail(${j(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[Oe](e){return ji(e)&&ee(this.error,e.error)&&ee(this.annotations,e.annotations)}[_e](){return Ot(Ze(this._tag))(Ot(ie(this.error))(ie(this.annotations)))}};Ym=new Us([]);Xm=class Xm extends $f{defect;constructor(e,t=Uf){super("Die",t,e);this.defect=e}toString(){return`Die(${j(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[Oe](e){return Xa(e)&&ee(this.defect,e.defect)&&ee(this.annotations,e.annotations)}[_e](){return Ot(Ze(this._tag))(Ot(ie(this.defect))(ie(this.annotations)))}};Pu=p((e)=>_u(e[0]),(e,t,n)=>{if(t.mapUnsafe.size===0)return e;return new Us(e.reasons.map((r)=>r.annotate(t,n)))});Ke=KA({op:"Success",prop:"value",[Rt](e){let t=e.getCont(Yn);return t?t[Yn](this[ce],e,this):e.yieldWith(this)}}),eh={key:"effect/Cause/StackTrace"},dE={key:"effect/Cause/InterruptorStackTrace"},$n=KA({op:"Failure",prop:"cause",[Rt](e){let t=this[ce],n=!1;if(e.currentStackFrame)t=Pu(t,{mapUnsafe:new Map([[eh.key,e.currentStackFrame]])}),n=!0;let r=e.getCont(to);while(e.interruptible&&e._interruptedCause&&r)r=e.getCont(to);return r?r[to](t,e,n?void 0:this):e.yieldWith(n?$n(t):this)}}),le=no({op:"WithFiber",[Rt](e){return this[ce](e)}}),gV=function(){class e extends globalThis.Error{}let t=Bs({op:"YieldableError",[Rt](){return ro(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),Bf=function(){let e=Symbol.for("effect/Data/Error/plainArgs");return class extends gV{constructor(n){super(n?.message,n?.cause?{cause:n.cause}:void 0);if(n)Zm(this,n),Object.defineProperty(this,e,{value:n,enumerable:!1})}toJSON(){return{...this[e],...this}}}}();os=class os extends Hs("NoSuchElementError"){[Nf]=Nf;constructor(e){super({message:e})}};GA={[Za]:Za,_tag:"Done",value:void 0},xV=ro(GA)});var ss=(e)=>Bs({op:e.label,[Rt]:e.evaluate});var Fu=v(()=>{pt()});function nh(e){return{combine:e}}function oo(e,t,n){return{combine:e,initialValue:t,combineAll:n??((r)=>{let o=t;for(let s of r)o=e(o,s);return o})}}function YA(e){return dn((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0})}var dn=(e)=>(t,n)=>t===n||e(t,n),yV=(e,t)=>e===t,ZA=()=>yV;var Ws=()=>{};var Mu=(e)=>p(3,(t,n,r)=>e(t,(o)=>({...o,[n]:r(o)}))),Du=(e)=>p(2,(t,n)=>e(t,(r)=>({[n]:r}))),Nu=(e,t)=>p(3,(n,r,o)=>t(n,(s)=>e(o(s),(i)=>({...s,[r]:i}))));var rh=v(()=>{ne()});var XA="~effect/data/Option",eT,SV,EV,bV,oh=(e)=>D(e,XA),zi=(e)=>e._tag==="None",mE=(e)=>e._tag==="Some",tc,js=(e)=>{let t=Object.create(SV);return t.value=e,t};var sh=v(()=>{Pt();Zn();wn();pr();ge();Ja();pt();eT={[XA]:{_A:(e)=>e},...Xn,[Symbol.iterator](){return new Hi(this)}},SV=Object.defineProperty(Object.assign(Object.create(eT),{_tag:"Some",_op:"Some",[Oe](e){return oh(e)&&mE(e)&&ee(this.value,e.value)},[_e](){return Ot(ie(this._tag))(ie(this.value))},toString(){return`some(${j(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:fn(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),EV=ie("None"),bV=Object.assign(Object.create(eT),{_tag:"None",_op:"None",valueOrUndefined:void 0,[Oe](e){return oh(e)&&zi(e)},[_e](){return EV},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}}}),tc=Object.create(bV)});var tT="~effect/data/Result",nT,wV,kV,ih=(e)=>D(e,tT),$u=(e)=>e._tag==="Failure",Uu=(e)=>e._tag==="Success",qf=(e)=>{let t=Object.create(kV);return t.failure=e,t},zf=(e)=>{let t=Object.create(wV);return t.success=e,t},ah=(e)=>Uu(e)?tc:js(e.failure),ch=(e)=>$u(e)?tc:js(e.success),rT;var gE=v(()=>{Pt();Zn();ne();wn();pr();ge();Ja();pt();sh();nT={[tT]:{_A:(e)=>e,_E:(e)=>e},...Xn,[Symbol.iterator](){return new Hi(this)}},wV=Object.assign(Object.create(nT),{_tag:"Success",_op:"Success",[Oe](e){return ih(e)&&Uu(e)&&ee(this.success,e.success)},[_e](){return Ot(ie(this._tag))(ie(this.success))},toString(){return`success(${j(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:fn(this.success)}}}),kV=Object.assign(Object.create(nT),{_tag:"Failure",_op:"Failure",[Oe](e){return ih(e)&&$u(e)&&ee(this.failure,e.failure)},[_e](){return Ot(ie(this._tag))(ie(this.failure))},toString(){return`failure(${j(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:fn(this.failure)}}}),rT=p(2,(e,t)=>zi(e)?qf(t()):zf(e.value))});function qs(e){return(t,n)=>t===n?0:e(t,n)}var Mr,so,xE,nc,Lu=(e)=>p(2,(t,n)=>e(t,n)===-1),Vi=(e)=>p(2,(t,n)=>e(t,n)===1),Vf=(e)=>p(2,(t,n)=>e(t,n)!==1),Kf=(e)=>p(2,(t,n)=>e(t,n)!==-1);var rc=v(()=>{ne();Mr=qs((e,t)=>{if(globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t))return 0;if(globalThis.Number.isNaN(e))return-1;if(globalThis.Number.isNaN(t))return 1;return e<t?-1:1}),so=qs((e,t)=>e<t?-1:1),xE=p(2,(e,t)=>qs((n,r)=>e(t(n),t(r)))),nc=xE(Mr,(e)=>e.getTime())});var ve={};Qn(ve,{Do:()=>ZV,all:()=>HV,andThen:()=>DV,as:()=>iT,asVoid:()=>FV,bind:()=>QV,bindTo:()=>GV,composeK:()=>LV,contains:()=>KV,containsWith:()=>fT,exists:()=>wE,filter:()=>sc,filterMap:()=>qV,firstSomeOf:()=>OV,flatMap:()=>Vs,flatMapNullishOr:()=>NV,flatten:()=>oc,fromIterable:()=>vV,fromNullOr:()=>yE,fromNullishOr:()=>er,fromUndefinedOr:()=>zs,gen:()=>YV,getFailure:()=>IV,getOrElse:()=>It,getOrNull:()=>uh,getOrThrow:()=>RV,getOrThrowWith:()=>SE,getOrUndefined:()=>Un,getSuccess:()=>sT,isNone:()=>he,isOption:()=>Hu,isSome:()=>Ce,let:()=>JV,lift2:()=>VV,liftNullishOr:()=>PV,liftPredicate:()=>bE,liftThrowable:()=>Ki,makeCombinerFailFast:()=>dT,makeEquivalence:()=>EE,makeOrder:()=>zV,makeReducer:()=>XV,makeReducerFailFast:()=>e3,map:()=>kn,match:()=>ut,none:()=>P,orElse:()=>AV,orElseResult:()=>_V,orElseSome:()=>TV,partitionMap:()=>jV,product:()=>cT,productMany:()=>BV,reduceCompact:()=>WV,some:()=>F,tap:()=>aT,toArray:()=>lT,toRefinement:()=>CV,void:()=>MV,zipLeft:()=>UV,zipRight:()=>$V,zipWith:()=>uT});function XV(e){return oo((t,n)=>{if(he(t))return n;if(he(n))return t;return F(e.combine(t.value,n.value))},P())}function dT(e){return nh((t,n)=>{if(he(t)||he(n))return P();return F(e.combine(t.value,n.value))})}function e3(e){let t=dT(e).combine,n=F(e.initialValue);return oo(t,n,(r)=>{let o=n;for(let s of r)if(o=t(o,s),he(o))return o;return o})}var P=()=>tc,F,Hu,he,Ce,ut,CV=(e)=>(t)=>Ce(e(t)),vV=(e)=>{for(let t of e)return F(t);return P()},sT,IV,It,AV,TV,_V,OV=(e)=>{let t=P();for(t of e)if(Ce(t))return t;return t},er=(e)=>e==null?P():F(e),zs=(e)=>e===void 0?P():F(e),yE=(e)=>e===null?P():F(e),PV=(e)=>(...t)=>er(e(...t)),uh,Un,Ki=(e)=>(...t)=>{try{return F(e(...t))}catch{return P()}},SE,RV,kn,iT,FV,MV,Vs,DV,NV,oc,$V,UV,LV,aT,cT=(e,t)=>Ce(e)&&Ce(t)?F([e.value,t.value]):P(),BV=(e,t)=>{if(he(e))return P();let n=[e.value];for(let r of t){if(he(r))return P();n.push(r.value)}return F(n)},HV=(e)=>{if(Symbol.iterator in e){let n=[];for(let r of e){if(he(r))return P();n.push(r.value)}return F(n)}let t={};for(let n of Object.keys(e)){let r=e[n];if(he(r))return P();H(t,n,r.value)}return F(t)},uT,WV,lT=(e)=>he(e)?[]:[e.value],jV,qV,sc,EE=(e)=>dn((t,n)=>he(t)?he(n):he(n)?!1:e(t.value,n.value)),zV=(e)=>qs((t,n)=>Ce(t)?Ce(n)?e(t.value,n.value):1:-1),VV=(e)=>p(2,(t,n)=>uT(t,n,e)),bE,fT=(e)=>p(2,(t,n)=>he(t)?!1:e(t.value,n)),KV,wE,GV,JV,QV,ZV,YV=(...e)=>{let n=(e.length===1?e[0]:e[1].bind(e[0]))(),r=n.next();while(!r.done){let o=r.value;if(he(o))return o;r=n.next(o.value)}return F(r.value)};var Me=v(()=>{Pt();Ws();ne();rh();sh();gE();rc();ge();F=js,Hu=oh,he=zi,Ce=mE,ut=p(2,(e,{onNone:t,onSome:n})=>he(e)?t():n(e.value)),sT=ch,IV=ah,It=p(2,(e,t)=>he(e)?t():e.value),AV=p(2,(e,t)=>he(e)?t():e),TV=p(2,(e,t)=>he(e)?F(t()):e),_V=p(2,(e,t)=>he(e)?kn(t(),zf):kn(e,qf)),uh=It(Hm),Un=It(Ao),SE=p(2,(e,t)=>{if(Ce(e))return e.value;throw t()}),RV=SE(()=>Error("getOrThrow called on a None")),kn=p(2,(e,t)=>he(e)?P():F(t(e.value))),iT=p(2,(e,t)=>kn(e,()=>t)),FV=iT(void 0),MV=F(void 0),Vs=p(2,(e,t)=>he(e)?P():t(e.value)),DV=p(2,(e,t)=>Vs(e,(n)=>{let r=Mn(t)?t(n):t;return Hu(r)?r:F(r)})),NV=p(2,(e,t)=>he(e)?P():er(t(e.value))),oc=Vs(L),$V=p(2,(e,t)=>Vs(e,()=>t)),UV=p(2,(e,t)=>aT(e,()=>t)),LV=p(2,(e,t)=>(n)=>Vs(e(n),t)),aT=p(2,(e,t)=>Vs(e,(n)=>kn(t(n),()=>n))),uT=p(3,(e,t,n)=>kn(cT(e,t),([r,o])=>n(r,o))),WV=p(3,(e,t,n)=>{let r=t;for(let o of e)if(Ce(o))r=n(r,o.value);return r}),jV=p(2,(e,t)=>{if(he(e))return[P(),P()];let n=t(e.value);return $u(n)?[F(n.failure),P()]:[P(),F(n.success)]}),qV=p(2,(e,t)=>{if(he(e))return P();let n=t(e.value);return Uu(n)?F(n.success):P()}),sc=p(2,(e,t)=>he(e)?P():t(e.value)?F(e.value):P()),bE=p(2,(e,t)=>t(e)?F(e):P()),KV=fT(iE()),wE=p(2,(e,t)=>he(e)?!1:t(e.value)),GV=Du(kn),JV=Mu(kn),QV=Nu(kn,Vs),ZV=F({})});var pT="~effect/Context/Service",Ye=function(){function e(){}let t=e;Object.setPrototypeOf(t,t3);let n=(r,o)=>{if(t.key=r,o?.defaultValue)t[CE]=CE,t.defaultValue=o.defaultValue;if(o?.make)t.make=o.make;if(o?.fiberCached)mT.add(r);return t};return arguments.length>0?n(arguments[0],arguments[1]):n},t3,mT,CE="~effect/Context/Reference",hT="~effect/Context",n3=8,r3=8,vE=(e,t,n,r)=>{let o=Object.create(s3);return o.cacheRoot=e??o,o.base=t,o.overlay=n,o.depth=r,o._flat=void 0,o.baseHits=0,o},gT=(e,t)=>{if(!t)return;gT(e,t.parent),e.set(t.key,t.value)},xT=(e)=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return gT(t,e.overlay),e._flat=t},o3=(e,t)=>{let n=new Map(e.mapUnsafe);return t(n),Gi(n)},lh,IE=(e,t)=>{let n=e;for(let o=n.overlay;o;o=o.parent)if(o.key===t)return o.value;let r=n.base.get(t);if(r===void 0&&!n.base.has(t))return lh;if(n.overlay&&++n.baseHits>=r3)n.base=xT(n),n.overlay=void 0,n.depth=0;return r},Gi=(e)=>vE(void 0,e,void 0,0),s3,yT=(e,t)=>e.cacheRoot===t.cacheRoot,AE=(e)=>D(e,hT),ST=(e)=>!!e[CE],Ln=()=>i3,i3,Ks=(e,t)=>Gi(new Map([[e.key,t]])),Cn,a3=(e,t,n)=>{let r=e,o=mT.has(t)?void 0:r.cacheRoot;if(r.depth>=n3){let s=new Map(r.mapUnsafe);return s.set(t,n),vE(o,s,void 0,0)}return vE(o,r.base,{key:t,value:n,parent:r.overlay},r.depth+1)},fh,Gf=(e,t)=>{let n=IE(e,t);return n===lh?void 0:n},Ro,tr,kE="~effect/Context/defaultValue",ET=(e)=>{if(kE in e)return e[kE];return e[kE]=e.defaultValue()},c3=(e)=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(t.stack){let n=t.stack.split(`
|
|
10
|
-
`);
|
|
11
|
-
`)}return t},TE,ic,bT=(...e)=>{let t=new Map;for(let n=0;n<e.length;n++)e[n].mapUnsafe.forEach((r,o)=>{t.set(o,r)});return Gi(t)},Te;var rt=v(()=>{Fu();Pt();ne();wn();pt();Me();ge();t3={[pT]:pT,...ss({label:"Service",evaluate(e){return Ke(tr(e.context,this))}}),toJSON(){return{_id:"Service",key:this.key}},of(e){return e},context(e){return Ks(this,e)},use(e){return le((t)=>e(tr(t.context,this)))},useSync(e){return le((t)=>Ke(e(tr(t.context,this))))}},mT=new Set,lh=Symbol(),s3={get mapUnsafe(){return xT(this)},...Xn,[hT]:{_Services:(e)=>e},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[Oe](e){if(!AE(e))return!1;let t=this.mapUnsafe,n=e.mapUnsafe;if(t.size!==n.size)return!1;for(let[r,o]of t)if(!n.has(r)||!ee(o,n.get(r)))return!1;return!0},[_e](){return dr(this.mapUnsafe.size)}},i3=Gi(new Map),Cn=p(3,(e,t,n)=>a3(e,t.key,n)),fh=p(2,(e,t)=>Gf(e,t.key)),Ro=p(2,(e,t)=>{let n=IE(e,t.key);if(n===lh){if(ST(t))return ET(t);throw c3(t)}return n}),tr=Ro,TE=p(2,(e,t)=>{let n=IE(e,t.key);if(n!==lh)return F(n);return ST(t)?F(ET(t)):P()}),ic=p(2,(e,t)=>{if(e.mapUnsafe.size===0)return t;if(t.mapUnsafe.size===0)return e;return o3(e,(n)=>t.mapUnsafe.forEach((r,o)=>n.set(o,r)))}),Te=Ye});var _E=(e)=>e.length>0;var Yt={};Qn(Yt,{Do:()=>A3,all:()=>C3,andThen:()=>k3,bind:()=>T3,bindTo:()=>_3,fail:()=>oe,failVoid:()=>f3,filterOrFail:()=>y3,flatMap:()=>Qi,flip:()=>v3,fromNullishOr:()=>d3,fromOption:()=>p3,gen:()=>I3,getFailure:()=>h3,getOrElse:()=>Ji,getOrNull:()=>E3,getOrThrow:()=>kT,getOrThrowWith:()=>wT,getOrUndefined:()=>b3,getSuccess:()=>m3,isFailure:()=>Se,isResult:()=>dh,isSuccess:()=>rn,let:()=>O3,liftPredicate:()=>x3,makeEquivalence:()=>PE,map:()=>Dr,mapBoth:()=>g3,mapError:()=>Wu,match:()=>mr,merge:()=>S3,orElse:()=>w3,succeed:()=>J,succeedNone:()=>RE,succeedSome:()=>F3,tap:()=>M3,transposeMapOption:()=>R3,transposeOption:()=>P3,try:()=>OE,void:()=>l3});var J,oe,l3,f3,d3,p3,OE=(e)=>{if(Mn(e))try{return J(e())}catch(t){return oe(t)}else try{return J(e.try())}catch(t){return oe(e.catch(t))}},dh,Se,rn,m3,h3,PE=(e,t)=>dn((n,r)=>Se(n)?Se(r)&&t(n.failure,r.failure):rn(r)&&e(n.success,r.success)),g3,Wu,Dr,mr,x3,y3,S3,Ji,E3,b3,wT,kT,w3,Qi,k3,C3=(e)=>{if(Symbol.iterator in e){let n=[];for(let r of e){if(Se(r))return r;n.push(r.success)}return J(n)}let t={};for(let n of Object.keys(e)){let r=e[n];if(Se(r))return r;H(t,n,r.success)}return J(t)},v3=(e)=>Se(e)?J(e.failure):oe(e.success),I3=(...e)=>{let n=(e.length===1?e[0]:e[1].bind(e[0]))(),r=n.next();while(!r.done){let o=r.value;if(Se(o))return o;r=n.next(o.success)}return J(r.value)},A3,T3,_3,O3,P3=(e)=>zi(e)?RE:Dr(e.value,js),R3,RE,F3=(e)=>J(js(e)),M3;var Bn=v(()=>{Ws();ne();rh();sh();gE();ge();J=zf,oe=qf,l3=J(void 0),f3=oe(void 0),d3=p(2,(e,t)=>e==null?oe(t(e)):J(e)),p3=rT,dh=ih,Se=$u,rn=Uu,m3=ch,h3=ah,g3=p(2,(e,{onFailure:t,onSuccess:n})=>Se(e)?oe(t(e.failure)):J(n(e.success))),Wu=p(2,(e,t)=>Se(e)?oe(t(e.failure)):e),Dr=p(2,(e,t)=>rn(e)?J(t(e.success)):e),mr=p(2,(e,{onFailure:t,onSuccess:n})=>Se(e)?t(e.failure):n(e.success)),x3=p(3,(e,t,n)=>t(e)?J(e):oe(n(e))),y3=p(3,(e,t,n)=>Qi(e,(r)=>t(r)?J(r):oe(n(r)))),S3=mr({onFailure:L,onSuccess:L}),Ji=p(2,(e,t)=>Se(e)?t(e.failure):e.success),E3=Ji(Hm),b3=Ji(Ao),wT=p(2,(e,t)=>{if(rn(e))return e.success;throw t(e.failure)}),kT=wT(L),w3=p(2,(e,t)=>Se(e)?t(e.failure):J(e.success)),Qi=p(2,(e,t)=>Se(e)?oe(e.failure):t(e.success)),k3=p(2,(e,t)=>Qi(e,(n)=>{let r=Mn(t)?t(n):t;return dh(r)?r:J(r)})),A3=J({}),T3=Nu(Dr,Qi),_3=Du(Dr),O3=Mu(Dr),R3=p(2,(e,t)=>zi(e)?RE:Dr(t(e.value),js)),RE=J(tc),M3=p(2,(e,t)=>{if(rn(e))t(e.success);return e})});var CT,Ele,D3,vT;var FE=v(()=>{ne();Me();ge();CT=p(2,(e,t)=>{let n=0;for(let r of e){let o=t(r,n);if(Wm(o)){if(o)return F(r)}else if(Ce(o))return o;n++}return P()}),Ele={[Symbol.iterator](){return D3}},D3={next(){return{done:!0,value:void 0}}},vT=p(2,(e,t)=>({[Symbol.iterator](){let n=e[Symbol.iterator](),r=0;return{next(){let o=n.next();while(!o.done){if(t(o.value,r++))return{done:!1,value:o.value};o=n.next()}return{done:!0,value:void 0}}}}}))});var AT,N3=(e)=>Object.keys(e);var TT=v(()=>{ne();AT=p(2,(e,t)=>{let n={...e};for(let r of N3(e))H(n,r,t(e[r],r));return n})});function RT(){return B3}var ph,on=(e)=>ph.isArray(e)?e:ph.from(e),_T=(e)=>ph.isArray(e)?e:[e],Jf,ME,OT,U3,ac,hr,PT,mh,DE,NE,L3=(e,t)=>{let n=ie(t),r=e.get(n);if(r===void 0)return e.set(n,[t]),!0;for(let o of r)if(ee(o,t))return!1;return r.push(t),!0},$E,cc=()=>[],uc=(e)=>[e],sn,UE=(e)=>{let t=[];for(let n of e)if(Ce(n))t.push(n.value);return t},LE,Qf,hh=(e)=>{let t=on(e);if(t.length<2)return[...t];let n=new Map,r=[];for(let o of t)if(L3(n,o))r.push(o);return r},B3;var nr=v(()=>{Pt();ne();wn();FE();Me();Bn();ph=globalThis.Array,Jf=p(2,(e,{onEmpty:t,onNonEmpty:n})=>hr(e)?n(e):t()),ME=p(2,(e,t)=>[...e,t]),OT=p(2,(e,t)=>on(e).concat(on(t))),U3=ph.isArray,ac=_E,hr=_E,PT=p(2,(e,t)=>{let n=0,r=[];for(let o of e){if(!t(o,n))break;r.push(o),n++}return r}),mh=p(2,(e,t)=>{let n=0;for(let r of e){if(t(r,n))return F(n);n++}return P()}),DE=CT,NE=p(2,(e,t)=>{let n=on(e);for(let r=n.length-1;r>=0;r--){let o=n[r],s=t(o,r);if(typeof s==="boolean"){if(s)return F(o)}else if(Ce(s))return s}return P()}),$E=p(2,(e,t)=>{let n=on(e),r=on(t);if(hr(n))return hr(r)?hh(OT(n,r)):n;return r}),sn=p(2,(e,t)=>e.map(t)),LE=p(2,(e,t)=>{let n=[],r=[],o=0;for(let s of e){let i=t(s,o++);if(rn(i))r.push(i.success);else n.push(i.failure)}return[n,r]}),Qf=p(3,(e,t,n)=>on(e).reduce((r,o,s)=>n(r,o,s),t)),B3=oo((e,t)=>e.concat(t),[])});var gh="~effect/time/Duration",NT,$T,H3,W3,j3,xh=(e)=>BigInt(e<0?Math.ceil(e-0.5):Math.floor(e+0.5)),UT=(e)=>xh(e*1e6),FT=(e,t)=>{let n=e.indexOf(".");if(n===-1)return BigInt(e)*t;let r=e[0]==="-",o=e.slice(n+1),s=W3**BigInt(o.length),i=(BigInt(e.slice(r?1:0,n))*s+BigInt(o))*t,a=i/s+(i%s*H3>=s?$T:NT);return r?-a:a},q3,Nr=(e)=>{switch(typeof e){case"number":return Zi(e);case"bigint":return io(e);case"string":{if(e==="Infinity")return Gs;if(e==="-Infinity")return lc;let t=q3.exec(e);if(!t)break;let[n,r,o]=t;if(o==="nano"||o==="nanos")return io(FT(r,$T));if(o==="micro"||o==="micros")return io(FT(r,j3));let s=Number(r);switch(o){case"milli":case"millis":return Zi(s);case"second":case"seconds":return G3(s);case"minute":case"minutes":return J3(s);case"hour":case"hours":return Q3(s);case"day":case"days":return Z3(s);case"week":case"weeks":return Y3(s)}break}case"object":{if(e===null)break;if(gh in e)return e;if(Array.isArray(e)){if(e.length!==2||!e.every(Rf))return MT(e);if(Number.isNaN(e[0])||Number.isNaN(e[1]))return ju;if(e[0]===-1/0||e[1]===-1/0)return lc;if(e[0]===1/0||e[1]===1/0)return Gs;return rr(xh(e[0]*1e9+e[1]))}let t=e,n=0;if(t.weeks)n+=t.weeks*604800000;if(t.days)n+=t.days*86400000;if(t.hours)n+=t.hours*3600000;if(t.minutes)n+=t.minutes*60000;if(t.seconds)n+=t.seconds*1000;if(t.milliseconds)n+=t.milliseconds;if(!t.microseconds&&!t.nanoseconds)return rr(n);return rr(xh(n*1e6+(t.microseconds??0)*1000+(t.nanoseconds??0)))}}return MT(e)},MT=(e)=>{throw Error(`Invalid Input: ${e}`)},LT,DT,z3,V3,K3,rr=(e)=>{let t=Object.create(K3);if(typeof e==="number")if(isNaN(e)||e===0||Object.is(e,-0))t.value=DT;else if(!Number.isFinite(e))t.value=e>0?z3:V3;else if(!Number.isInteger(e))t.value={_tag:"Nanos",nanos:UT(e)};else t.value={_tag:"Millis",millis:e};else if(e===NT)t.value=DT;else t.value={_tag:"Nanos",nanos:e};return t},HE=(e)=>D(e,gh),BT=(e)=>e.value._tag!=="Infinity"&&e.value._tag!=="NegativeInfinity",ju,Gs,lc,io=(e)=>rr(e),Zi=(e)=>rr(e),G3=(e)=>rr(e*1000),J3=(e)=>rr(e*60000),Q3=(e)=>rr(e*3600000),Z3=(e)=>rr(e*86400000),Y3=(e)=>rr(e*604800000),qu=(e)=>X3(Nr(e),{onMillis:L,onNanos:(t)=>Number(t)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),BE=(e)=>{let t=Nr(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 UT(t.value.millis)}},HT,X3,WT,WE=(e,t)=>WT(e,t,{onMillis:(n,r)=>n===r,onNanos:(n,r)=>n===r,onInfinity:(n,r)=>n.value._tag===r.value._tag}),jT,eK;var Yi=v(()=>{Pt();ne();wn();pr();Me();ct();ge();NT=BigInt(0),$T=BigInt(1),H3=BigInt(2),W3=BigInt(10),j3=BigInt(1000),q3=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,LT=Ki(Nr),DT={_tag:"Millis",millis:0},z3={_tag:"Infinity"},V3={_tag:"NegativeInfinity"},K3={[gh]:gh,[_e](){switch(this.value._tag){case"Millis":{let e=this.value.millis*1e6;return Number.isFinite(e)?ie(xh(e)):dr(this.value.millis)}case"Nanos":return ie(this.value.nanos);default:return nE(this.value)}},[Oe](e){return HE(e)&&eK(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"}}},[zt](){return this.toJSON()},pipe(){return fe(this,arguments)}},ju=rr(0),Gs=rr(1/0),lc=rr(-1/0),HT=Ki(BE),X3=p(2,(e,t)=>{switch(e.value._tag){case"Millis":return t.onMillis(e.value.millis);case"Nanos":return t.onNanos(e.value.nanos);case"Infinity":return t.onInfinity();case"NegativeInfinity":return(t.onNegativeInfinity??t.onInfinity)()}}),WT=p(3,(e,t,n)=>{if(e.value._tag==="Infinity"||e.value._tag==="NegativeInfinity"||t.value._tag==="Infinity"||t.value._tag==="NegativeInfinity")return n.onInfinity(e,t);if(e.value._tag==="Millis")return t.value._tag==="Millis"?n.onMillis(e.value.millis,t.value.millis):n.onNanos(BE(e),t.value.nanos);else return n.onNanos(e.value.nanos,BE(t))}),jT=p(2,(e,t)=>WT(e,t,{onMillis:(n,r)=>rr(n-r),onNanos:(n,r)=>rr(n-r),onInfinity:(n,r)=>{let o=n.value._tag,s=r.value._tag;if(o==="Infinity")return s==="Infinity"?ju:Gs;if(o==="NegativeInfinity")return s==="NegativeInfinity"?ju:lc;return s==="Infinity"?lc:Gs}})),eK=p(2,(e,t)=>WE(e,t))});var jE,qT=(e)=>(t)=>{let n=e(t);return Se(n)?P():F(n.success)};var zT=v(()=>{ne();Me();Bn();jE=p(2,(e,t)=>(n)=>{let r=e(n);if(Se(r))return oe(n);let o=t(r.success);if(Se(o))return oe(n);return o})});class KT{buckets=[];scheduleTask(e,t){let n=this.buckets,r=n.length,o,s=0;for(;s<r;s++){if(n[s][0]>t)break;o=n[s]}if(o&&o[0]===t)o[1].push(e);else if(s===r)n.push([t,[e]]);else n.splice(s,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}}class zu{executionMode;setImmediate;constructor(e="async",t){this.executionMode=e,this.setImmediate=t??(e==="sync"?nK:VT)}shouldYield(e){return e.currentOpCount>=e.maxOpsBeforeYield}makeDispatcher(){return new GT(this.setImmediate)}}class GT{tasks=new KT;running=void 0;setImmediate;constructor(e=VT){this.setImmediate=e}scheduleTask(e,t){if(this.tasks.scheduleTask(e,t),this.running===void 0)this.running=this.setImmediate(this.afterScheduled)}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let n=e[t][1];for(let r=0;r<n.length;r++)n[r]()}}flush(){while(this.tasks.buckets.length>0){if(this.running!==void 0)this.running(),this.running=void 0;this.runTasks()}}}var Zf,VT,nK=(e)=>{let t=!1;return Promise.resolve().then(()=>{if(!t)e()}),()=>{t=!0}},JT,QT;var yh=v(()=>{rt();Zf=Te("effect/Scheduler",{fiberCached:!0,defaultValue:()=>new zu}),VT="setImmediate"in globalThis?(e)=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:(e)=>{let t=setTimeout(e,0);return()=>clearTimeout(t)};JT=Te("effect/Scheduler/MaxOpsBeforeYield",{fiberCached:!0,defaultValue:()=>2048}),QT=Te("effect/Scheduler/PreventSchedulerYield",{fiberCached:!0,defaultValue:()=>!1})});var xr={};Qn(xr,{Class:()=>Sh,Error:()=>zE,TaggedClass:()=>rK,TaggedError:()=>Xi,taggedEnum:()=>qE});function oK(){if(arguments.length===1){let n=arguments[0];return function(r){return n[r._tag](r)}}let e=arguments[0];return arguments[1][e._tag](e)}var Sh,rK=(e)=>class extends Sh{_tag=e},qE=()=>new Proxy({},{get(e,t,n){if(t==="$is")return eo;else if(t==="$match")return oK;return(r)=>({...r,_tag:t})}}),zE,Xi;var Vu=v(()=>{pt();ct();ge();Sh=class extends za{constructor(e){super();if(e)Zm(this,e)}};zE=Bf,Xi=Hs});function Eh(e){if(e>=XT.length)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);let t=XT[e];if(t===255)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);return t}var YT="~effect/encoding/EncodingError",ea,bh=(e)=>typeof e==="string"?VE(QE.encode(e)):VE(e),Gu=(e)=>{let t=c_(e),n=t.length;if(n%4!==0)return oe(new ea({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 oe(new ea({kind:"Decode",module:"Base64",input:t,message:"Found a '=' character, but it is not at the end"}));try{let o=t.endsWith("==")?2:t.endsWith("=")?1:0,s=new Uint8Array(3*(n/4)-o);for(let i=0,a=0;i<n;i+=4,a+=3){let c=Eh(t.charCodeAt(i))<<18|Eh(t.charCodeAt(i+1))<<12|Eh(t.charCodeAt(i+2))<<6|Eh(t.charCodeAt(i+3));s[a]=c>>16,s[a+1]=c>>8&255,s[a+2]=c&255}return J(s)}catch(o){return oe(new ea({kind:"Decode",module:"Base64",input:t,message:o instanceof Error?o.message:"Invalid input"}))}},r_=(e)=>Dr(Gu(e),(t)=>ZE.decode(t)),o_=(e)=>typeof e==="string"?e_(QE.encode(e)):e_(e),KE=(e)=>{let t=c_(e),n=t.length;if(n%4===1)return oe(new ea({module:"Base64Url",kind:"Decode",input:t,message:`Length should be a multiple of 4, but is ${n}`}));if(!/^[-_A-Z0-9]*?={0,2}$/i.test(t))return oe(new ea({module:"Base64Url",kind:"Decode",input:t,message:"Invalid input"}));let r=n%4===2?`${t}==`:n%4===3?`${t}=`:t;return r=r.replace(/-/g,"+").replace(/_/g,"/"),Gu(r)},s_=(e)=>Dr(KE(e),(t)=>ZE.decode(t)),i_=(e)=>typeof e==="string"?t_(QE.encode(e)):t_(e),GE=(e)=>{let t="";for(let n=e>>>3;n>0;n--){let r=Math.random()*4294967296>>>0;t+=Ku[r>>>24]+Ku[r>>>16&255]+Ku[r>>>8&255]+Ku[r&255]}return t},JE=(e)=>{let t=new TextEncoder().encode(e);if(t.length%2!==0)return oe(new ea({module:"Hex",kind:"Decode",input:e,message:`Length must be a multiple of 2, but is ${t.length}`}));try{let n=t.length/2,r=new Uint8Array(n);for(let o=0;o<n;o++){let s=n_(t[o*2]),i=n_(t[o*2+1]);r[o]=s<<4|i}return J(r)}catch(n){return oe(new ea({module:"Hex",kind:"Decode",input:e,message:n instanceof Error?n.message:"Invalid input"}))}},a_=(e)=>Dr(JE(e),(t)=>ZE.decode(t)),QE,ZE,c_=(e)=>e.replace(/[\n\r]/g,""),VE=(e)=>{let t=e.length,n="",r;for(r=2;r<t;r+=3)n+=Js[e[r-2]>>2],n+=Js[(e[r-2]&3)<<4|e[r-1]>>4],n+=Js[(e[r-1]&15)<<2|e[r]>>6],n+=Js[e[r]&63];if(r===t+1)n+=Js[e[r-2]>>2],n+=Js[(e[r-2]&3)<<4],n+="==";if(r===t)n+=Js[e[r-2]>>2],n+=Js[(e[r-2]&3)<<4|e[r-1]>>4],n+=Js[(e[r-1]&15)<<2],n+="=";return n},Js,XT,e_=(e)=>VE(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),Ku,t_=(e)=>{let t="";for(let n=0;n<e.length;n++)t+=Ku[e[n]];return t},n_=(e)=>{if(48<=e&&e<=57)return e-48;if(97<=e&&e<=102)return e-97+10;if(65<=e&&e<=70)return e-65+10;throw TypeError("Invalid input")};var wh=v(()=>{Vu();Bn();ea=class ea extends Xi("EncodingError"){[YT]=YT};QE=new TextEncoder,ZE=new TextDecoder;Js=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],XT=[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],Ku=[];for(let e=0;e<256;e++)Ku.push(e.toString(16).padStart(2,"0"))});class f_{_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=Un(e.parent)?.traceId??GE(32),this.spanId=GE(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)}}var XE="effect/Tracer/ParentSpan",kh,sK=(e)=>e,Ch,u_,l_,eb="effect/Tracer",vh;var d_=v(()=>{rt();wh();ne();Me();kh=class kh extends Ye()(XE,{fiberCached:!0}){};Ch=Te("effect/Tracer/DisablePropagation",{defaultValue:Of}),u_=Te("effect/Tracer/CurrentTraceLevel",{defaultValue:()=>"Info"}),l_=Te("effect/Tracer/MinimumTraceLevel",{defaultValue:()=>"All"}),vh=Te(eb,{fiberCached:!0,defaultValue:()=>sK({span:(e)=>new f_(e)})})});var p_="effect/observability/Metric/FiberRuntimeMetricsKey";var m_,Yf,Ih,Ju,Xf,ed,Qs,tb,Ah,Th;var nb=v(()=>{rt();ne();m_=Te("effect/ErrorReporter/CurrentErrorReporters",{defaultValue:()=>new Set}),Yf=Te("effect/References/CurrentStackFrame",{fiberCached:!0,defaultValue:Ao}),Ih=Te("effect/References/TracerEnabled",{defaultValue:Fr}),Ju=Te("effect/References/TracerTimingEnabled",{defaultValue:Fr}),Xf=Te("effect/References/TracerSpanAnnotations",{defaultValue:()=>({})}),ed=Te("effect/References/TracerSpanLinks",{defaultValue:()=>[]}),Qs=Te("effect/References/CurrentLogAnnotations",{defaultValue:()=>({})}),tb=Te("effect/References/CurrentLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),Ah=Te("effect/References/MinimumLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),Th=Te("effect/References/CurrentLogSpans",{defaultValue:()=>[]})});var uK=()=>{let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");if(e===void 0)return Object.isExtensible(Error);return Object.hasOwn(e,"writable")?e.writable===!0:e.set!==void 0},lK,ta=()=>Error.stackTraceLimit,$r=(e)=>{if(lK)Error.stackTraceLimit=e};var _h=v(()=>{lK=uK()});var Oh=(e)=>{if(e?.captureStackTrace===!1)return e;else if(e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!=="boolean")return e;let t=ta();$r(3);let n=Error();return $r(t),{...e,captureStackTrace:fK(()=>n.stack)}},rb=(e)=>(t)=>{let n;return()=>{if(n!==void 0)return n;let r=t();if(!r)return;let o=r.split(`
|
|
12
|
-
`)
|
|
13
|
-
`),
|
|
14
|
-
`),
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
`)},
|
|
18
|
-
`)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
${
|
|
24
|
-
${M_(e.cause,`${t} `)}
|
|
25
|
-
${t}}`;return r},Ph="~effect/Fiber",yK,SK,oa=()=>globalThis[Iu],hb,EK,ib,Uh=(e)=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(dE.key,e.currentStackFrame),Gi(t)},bK=(e)=>{if(e._children===void 0||e._children.size===0)return;return ra(e._children)},D_=(e)=>{let t=e;if(t._exit)return W(t._exit);return an((n)=>{if(t._exit)return n(W(t._exit));return me(e.addObserver((r)=>n(W(r))))})},Lh=(e)=>an((t)=>{let n=e[Symbol.iterator](),r=[],o=void 0;function s(){let i=n.next();while(!i.done){if(i.value._exit){r.push(i.value._exit),i=n.next();continue}o=i.value.addObserver((a)=>{r.push(a),s()});return}t(W(r))}return s(),me(()=>o?.())}),Bh=(e)=>le((t)=>N_(e,t.id)),N_,ra=(e)=>le((t)=>{let n=Uh(t),r=cc();for(let o of e)o.interruptUnsafe(t.id,n),r.push(o);return ld(Lh(r))}),W,Ge,ft,me,ue,gb,Yu,$_=(e)=>e==null?ft(new os):W(e),xb,Xu,yb=(e)=>W(F(e)),mc,U_=(e)=>he(e)?mc:We(e.value,F),L_=(e)=>ue(()=>Ge(Fe(e))),sa=(e)=>Oo(e),Hh=(e)=>ue(()=>ft(Fe(e))),Ee,B_=(e)=>{let t=typeof e==="function"?e:e.try,n=typeof e==="function"?(r)=>new Ed(r,"An error occurred in Effect.try"):e.catch;return ue(()=>{try{return W(Fe(t))}catch(r){return ft(Fe(()=>n(r)))}})},Sb=(e)=>Eb(function(t,n){Fe(()=>e(n)).then((r)=>t(W(r)),(r)=>t(sa(r)))},e.length!==0),H_=(e)=>{let t=typeof e==="function"?e:e.try,n=typeof e==="function"?(r)=>new Ed(r,"An error occurred in Effect.tryPromise"):e.catch;return Eb(function(r,o){let s=(i)=>{try{r(ft(Fe(()=>n(i))))}catch(a){r(sa(a))}};try{Fe(()=>t(o)).then((i)=>r(W(i)),s)}catch(i){s(i)}},t.length!==0)},W_=(e)=>le((t)=>e(t.id)),j_,q_,Eb,wK,an=(e)=>Eb(e,e.length>=2),Wh,z_=(...e)=>ue(()=>Qu(e.length===1?e[0]():e[1].call(e[0].self))),bb=(e,...t)=>{let n=t.length===0?function(){return ue(()=>Qu(e.apply(this,arguments)))}:function(){let r=ue(()=>Qu(e.apply(this,arguments)));for(let o=0;o<t.length;o++)r=t[o](r,...arguments);return r};return wb(e.length,n)},wb=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),g_,V_=function(){let e=typeof arguments[0]==="string",t=e?arguments[0]:"Effect.fn",n=e?arguments[1]:void 0,r=ta();$r(2);let o=new globalThis.Error;if($r(r),e)return(s,...i)=>x_(t,s,o,i,e,n);return x_(t,arguments[0],o,Array.prototype.slice.call(arguments,1),e,n)},x_=(e,t,n,r,o,s)=>{let i=typeof t==="function"?t:r.shift().bind(t.self);return wb(i.length,function(...a){let c=ue(()=>{let f=i.apply(this,arguments);return de(f)?f:Qu(f)});for(let f=0;f<r.length;f++)c=r[f](c,...a);if(!de(c))return c;let u=ta();$r(2);let l=new globalThis.Error;return $r(u),Zs(o?rd(e,s,(f)=>lb(c,f)):c,Yf,(f)=>({name:e,stack:g_(()=>l.stack),parent:{name:`${e} (definition)`,stack:g_(()=>n.stack),parent:f}}))})},K_=(e,...t)=>wb(e.length,t.length===0?function(){return y_(()=>e.apply(this,arguments))}:function(){let n=y_(()=>e.apply(this,arguments));for(let r of t)n=r(n);return n}),y_=(e)=>{try{let t=e(),n=void 0;while(!0){let r=t.next(n);if(r.done)return W(r.value);let o=r.value;if(o&&o._tag==="Success"){n=o.value;continue}else if(o&&o._tag==="Failure")return r.value;else{let s=!0;return ue(()=>{if(s)return s=!1,V(r.value,(i)=>Qu(t,i));else return ue(()=>Qu(e()))})}}}catch(t){return sa(t)}},Qu,Hn,el=(e)=>We(e,F),G_=(e)=>gc(e,{onFailure:W,onSuccess:ft}),Mo,hc,ld=(e)=>V(e,(t)=>or),J_=(e)=>Lr(e,ft),kb=(e,t)=>le((n)=>an((r)=>{let o=on(e),s=o.length,i=0,a=!1,c=new Set,u=[],l=(f,d,m)=>{if(i++,f._tag==="Failure"){if(u.push(...f.cause.reasons),i>=s)r(Ge(Ls(u)));return}let y=!a;if(a=!0,r(c.size===0?f:V(ei(ra(c)),()=>f)),y&&t?.onWinner)t.onWinner({fiber:d,index:m,parentFiber:n})};for(let f=0;f<s;f++){let d=xc(n,o[f],!0,!0,!1);if(c.add(d),d.addObserver((m)=>{c.delete(d),l(m,d,f)}),a)break}return ra(c)})),Cb=(e,t)=>le((n)=>an((r)=>{let o=!1,s=new Set,i=(c)=>{o=!0,r(s.size===0?c:V(ei(ra(s)),()=>c))},a=0;for(let c of e){if(o)break;let u=a++,l=xc(n,c,!0,!0,!1);s.add(l),l.addObserver((f)=>{s.delete(l);let d=!o;if(i(f),d&&t?.onWinner)t.onWinner({fiber:l,index:u,parentFiber:n})})}return ra(s)})),Q_,jh,V,kK,Z_,Xe=(e)=>(Qa in e),Y_,X_=(e)=>V(e,L),We,eO,tO,nO,rO,qh=(e)=>$n(pc(e)),ia=(e)=>e._tag==="Success",oO=(e)=>e._tag==="Success"?J(e):oe(e),sO=(e)=>e._tag==="Success"?J(e.value):oe(e),vb=(e)=>e._tag==="Failure",iO=(e)=>e._tag==="Failure"?J(e):oe(e),fd=(e)=>e._tag==="Failure"?J(e.cause):oe(e),Ib,aO,cO=(e)=>e._tag==="Failure"&&Fh(e.cause),uO=(e)=>e._tag==="Failure"&&Rh(e.cause),lO=(e)=>e._tag==="Failure"&&db(e.cause),or,Ab,Tb,_b,CK,fO,dO,pO,Ob=(e)=>{let t=[];for(let n of e)if(n._tag==="Failure")t.push(...n.cause.reasons);return t.length===0?or:$n(Ls(t))},mO=(e)=>ia(e)?F(e.value):P(),hO=(e)=>vb(e)?F(e.cause):P(),gO=(e)=>{let t=Ib(e);return Se(t)?P():F(t.success)},xO=(e)=>e,yO=(e)=>le((t)=>W(TE(t.context,e))),vK=(e)=>le((t)=>gb(TE(t.context,e))),tl,Zs,SO=(e,t,n)=>ei(le((r)=>{let o=Ro(r.context,e),s=t(o);return r.setContext(Cn(r.context,e,s)),Do(Ro(r.context,ca),(i)=>{let a=Ro(r.context,e),c;if(n?.reset===void 0){if(a!==s)return Ee;c=o}else c=n.reset(o,s,a);return r.setContext(Cn(r.context,e,c)),Ee})})),Pb=()=>IK,IK,aa=(e)=>le((t)=>e(t.context)),EO,Ys,sr=function(){if(arguments.length===1)return p(2,(e,t)=>S_(e,arguments[0],t));return p(3,(e,t,n)=>S_(e,t,n)).apply(this,arguments)},S_=(e,t,n)=>tl(e,Cn(t,n)),zh,bO,Rb,wO,kO,Fb,CO,Vh,Lr,AK,Mb,nl,Br,vO=(e)=>gc(e,{onFailure:(t)=>th(t)?mc:ft(t),onSuccess:yb}),IO,AO,TO,Kh,Db,_O,OO,dd,Gh,Nb,PO,RO,FO,MO,$b,Ub,Lb=(e)=>Br(e,sa),DO,NO=(e)=>ue(()=>{let t=e[Symbol.iterator](),n=t.next();if(n.done)return sa(Error("Received an empty collection of effects"));function r(o){let s=t.next();if(s.done)return o.value;return Br(o.value,(i)=>r(s))}return r(n)}),Bb=(e)=>Br(e,(t)=>V(Xu,()=>Bb(e))),$O,Jh,UO=(e)=>Qh(e,{onFailure:P,onSuccess:F}),na=(e)=>pd(e,{onFailure:oe,onSuccess:J}),Fo,TK,Hb,gc,Qh,pd,LO,md=(e)=>Xe(e)?Ke(e):_K(e),_K,BO,HO,WO,Wb,jO,qO,zO=(e)=>as((t)=>{let n=t.monotonicTimeNanosUnsafe();return We(e,(r)=>[io(t.monotonicTimeNanosUnsafe()-n),r])}),ab="~effect/Scope",cb="~effect/Scope/Closeable",ca,jb=(e,t)=>ue(()=>Zh(e,t)??Ee),Zh=(e,t)=>{if(e.state._tag==="Closed")return;let n={_tag:"Closed",exit:t};if(e.state._tag==="Empty"){e.state=n;return}let r=e.state;if(e.state=n,r.finalizer!==void 0)return r.finalizer(t);let o=r.finalizers;if(o===void 0||o.size===0)return;else if(o.size===1)return o.values().next().value(t);return PK(e,o,t)},OK=(e,t)=>ia(e)?t:Lr(t,(n)=>Ge(Dh(e.cause,n))),PK,VO=(e,t)=>{let n=hd(t);if(e.state._tag==="Closed")return n.state=e.state,n;let r={};return td(e,r,(o)=>jb(n,o)),td(n,r,(o)=>me(()=>qb(e,r))),n},Do=(e,t)=>ue(()=>{if(e.state._tag==="Closed")return t(e.state.exit);return td(e,{},t),Ee}),KO=(e,t)=>Do(e,_t(t)),td=(e,t,n)=>{if(e.state._tag==="Empty")e.state={_tag:"Open",finalizerKey:t,finalizer:n,finalizers:void 0};else if(e.state._tag==="Open"){let r=e.state;if(r.finalizer!==void 0)r.finalizers=new Map([[r.finalizerKey,r.finalizer]]),r.finalizerKey=void 0,r.finalizer=void 0,r.finalizers.set(t,n);else if(r.finalizers===void 0)r.finalizerKey=t,r.finalizer=n;else r.finalizers.set(t,n)}},qb=(e,t)=>{if(e.state._tag==="Open"){let n=e.state;if(n.finalizerKey===t)n.finalizerKey=void 0,n.finalizer=void 0;else if(n.finalizers!==void 0)n.finalizers.delete(t)}},hd=(e="sequential")=>({[cb]:cb,[ab]:ab,strategy:e,state:RK}),RK,gd,GO,zb=(e)=>le((t)=>{let n=t.context,r=hd();return t.setContext(Cn(t.context,ca,r)),Xs(e,(o)=>(t.setContext(n),Zh(r,o)))}),Yh=(e)=>ue(()=>{let t=hd();return vn(e(t),(n)=>ue(()=>Zh(t,n)??Ee))}),xd=(e,t,n)=>aa((r)=>No((o)=>V(gd,(s)=>hc(n?.interruptible?o(e):e,(i)=>Do(s,(a)=>Ys(t(i,a),r)))))),Vb=(e)=>V(gd,(t)=>aa((n)=>Do(t,(r)=>Ys(e(r),n)))),Xs,vn,JO,Kb,Gb,Jb,QO,Qb,ZO,Zb=(e,t,n)=>No((r)=>V(e,(o)=>Xs(r(t(o)),(s)=>n(o,s),!0))),YO=(e)=>xd(e,(t)=>D(t,Symbol.asyncDispose)?Sb(()=>t[Symbol.asyncDispose]()):me(()=>t[Symbol.dispose]())),Yb,Xb,XO=(e)=>Xb(e,Gs),eP,ei=(e)=>le((t)=>{if(!t.interruptible)return e;return t.interruptible=!1,t._stack.push(Xh),e}),tP,Xh,FK,nP=(e)=>{if(e.interruptible=!0,e._stack.push(FK),e._interruptedCause)return Ge(e._interruptedCause)},ew=(e)=>le((t)=>{if(t.interruptible)return e;return nP(t)??e}),No=(e)=>le((t)=>{if(!t.interruptible)return e(L);return t.interruptible=!1,t._stack.push(Xh),e(ew)}),rP=(e)=>le((t)=>{if(t.interruptible)return e(L);let n=nP(t),r=e(ei);return n??r}),oP,yd=(e,t)=>{if(ns(e))return t?.mode==="result"?Ur(e,na,t):Ur(e,L,t);else if(t?.discard)return t.mode==="result"?Ur(Object.values(e),na,t):Ur(Object.values(e),L,t);return ue(()=>{let n={};return Hn(Ur(Object.entries(e),([r,o])=>We(t?.mode==="result"?na(o):o,(s)=>{H(n,r,s)}),{discard:!0,concurrency:t?.concurrency}),n)})},tw,sP,iP,aP,cP=(e,t,n,r)=>V(n(r,t),(o)=>{if(o)return W(F(r));let s=e.next();if(!s.done)return cP(e,t+1,n,s.value);return W(P())}),uP,lP=(e,t,n,r)=>V(n(r,t),(o)=>{if(rn(o))return W(F(o.success));let s=e.next();if(!s.done)return lP(e,t+1,n,s.value);return W(P())}),is,Ur,fP=(e)=>V(e,(t)=>{let n=t[Symbol.iterator]().next();return n.done?ft(new os):W(n.value)}),MK=(e,t,n)=>ue(()=>{let r=n?.discard?void 0:[],o=e[Symbol.iterator](),s=o.next(),i=0;return Hn(is({while:()=>!s.done,body:()=>t(s.value,i++),step:(a)=>{if(r)r.push(a);s=o.next()}}),r)}),dP=(e)=>{let{onItem:t,step:n}=e,r=(o,s,i,a)=>{for(;i<a;i++){let c=s[i],u=t(o,c,i);if(!Xe(u))return V(md(u),(f)=>n(o,c,f,i)??r(o,s,i+1,a)??Ee);let l=n(o,c,u,i);if(l)return l._tag==="Failure"?l:void 0}};return(o,s,i)=>{let a=0,c=i?.end??s.length,u=i?.concurrency??1;if(u===1)return r(o,s,0,c);let l=i?.orderedStep===!0,f=!1,d,m,y,b=!1,E,w,k=a,g=l?Array(c):void 0,x=(I)=>{let _=Oo(I);return E=_,f=!0,b=!0,m&&m.size>0?V(ei(ra(Array.from(m))),()=>_):_},S=(I,_,M)=>{if(!l)return n(o,I,_,M);if(E)return E;g[M]=_;while(k<c){let U=g[k];if(U===void 0)return;g[k]=void 0;let N=k++,Z=n(o,s[N],U,N);if(Z)return Z}},C=()=>{let I=!1;for(;!E&&a<c;a++){let _=s[a],M=w??t(o,_,a);if(Xe(M)){if(E=S(_,M,a),E)break}else if(!d)return an((U)=>{d=oa(),m=new Set,w=M,y=U;let N;try{N=C()}catch(Z){return U(x(Z))}if(N)return U(N);return ue(()=>(E=or,b=!0,m?ra(m):Ee))});else{w=void 0;let U=xc(d,M,!0,!0,"inherit");if(U._exit){if(E=S(_,U._exit,a),E)break;continue}m.add(U);let N=a;if(U.addObserver((Z)=>{m.delete(U);try{if(E){if(!b&&Z._tag==="Failure")for(let G of Z.cause.reasons)if(G._tag==="Interrupt")continue;else if(E._tag==="Failure")E.cause.reasons.push(G);else E=$n(Ls([G]))}else{let G=S(_,Z,N);if(G)E=G._tag==="Failure"?$n(Ls(G.cause.reasons.slice())):G,C()}if(I){let G=C();if(G)y(G)}else if(f&&m.size===0)y(E??Ee)}catch(G){y(x(G))}}),m.size<u)continue;I=!0,a++;return}}if(f=!0,E){if(m&&m.size>0){let _=Uh(d);m.forEach((M)=>M.interruptUnsafe(d.id,_));return}if(y||E._tag==="Failure")return E}else if(y){if(!m)return or;else if(m.size===0)y(Ee)}};return C()}},Sd=()=>dP,DK,nw,rw,pP,mP,hP,gP,xP,yP,SP,EP,bP,xc=(e,t,n=!1,r=!1,o=!1)=>{let s=e,i=o==="inherit"?s.interruptible:!o,a=new hb(s.context,i);if(n)a.evaluate(t);else s.currentDispatcher.scheduleTask(()=>a.evaluate(t),0);if(!r&&!a._exit)s.children().add(a),a.addObserver(()=>s._children.delete(a));return a},wP,kP=(e)=>le((t)=>{let n=t._children&&new Set(t._children);return vn(e,(r)=>{let o=t._children;if(o===void 0||o.size===0)return Ee;else if(n)o=vT(o,(s)=>!n.has(s));return ld(Lh(o))})}),ow,CP,ti=(e)=>(t,n)=>{let r=new hb(n?.scheduler?Cn(e,Zf,n.scheduler):e,n?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(n?.signal)if(n.signal.aborted)r.interruptUnsafe();else{let o=()=>r.interruptUnsafe();n.signal.addEventListener("abort",o,{once:!0}),r.addObserver(()=>n.signal.removeEventListener("abort",o))}if(n?.onFiberStart)n.onFiberStart(r);return r},vP,IP,sw=(e)=>{let t=ti(e);return(n,r)=>{let o=t(n,r);if(r?.onExit)o.addObserver(r.onExit);return(s)=>o.interruptUnsafe(s)}},AP,eg=(e)=>{let t=ti(e);return(n,r)=>{let o=t(n,r);return new Promise((s)=>{o.addObserver((i)=>s(i))})}},TP,iw=(e)=>{let t=eg(e);return(n,r)=>t(n,r).then((o)=>{if(o._tag==="Failure")throw Nh(o.cause);return o.value})},_P,tg=(e)=>{let t=ti(e);return(n)=>{if(Xe(n))return n;let r=new zu("sync"),o=t(n,{scheduler:r});return o._dispatcher?.flush(),o._exit??Oo(new rg(o))}},OP,aw=(e)=>{let t=tg(e);return(n)=>{let r=t(n);if(r._tag==="Failure")throw Nh(r.cause);return r.value}},PP,E_,b_,cw=(e)=>new RP(e??!1),FP,MP,DP,NP,ub,NK,$K=(e)=>Object.assign(Object.create(NK),e),$P=(e)=>{if(!e)return P();return tr(e.annotations,Ch)?e._tag==="Span"?$P(Un(e.parent)):P():F(e)},uw=(e,t,n)=>{let r=!e.getRef(Ih)||n?.annotations&&tr(n.annotations,Ch),o=n?.parent!==void 0?F(n.parent):n?.root?P():$P(e.currentSpan),s;if(r)s=$K({name:t,parent:o,annotations:Cn(n?.annotations??Ln(),Ch,!0)});else{let i=e.getRef(vh),a=e.getRef(ni),c=e.getRef(Ju),u=e.getRef(Xf),l=e.getRef(ed),f=n?.level??e.getRef(u_),d=n?.links!==void 0?[...l,...n.links]:l.length===0?[]:l.slice();s=i.span({name:t,parent:o,annotations:n?.annotations??Ln(),links:d,startTime:c?a.currentTimeNanosUnsafe():BigInt(0),kind:n?.kind??"internal",root:n?.root??he(o),sampled:n?.sampled??(Ce(o)&&o.value.sampled===!1?!1:!oR(e.getRef(l_),f))});for(let m in u)s.attribute(m,u[m]);if(n?.attributes!==void 0)for(let m in n.attributes)s.attribute(m,n.attributes[m])}return s},UP=(e,t)=>le((n)=>W(uw(n,e,t))),nd=(e,t)=>ei(le((n)=>{let r=Ro(n.context,ca),o=uw(n,e,t??{}),s=n.getRef(ni),i=n.getRef(Ju);return Hn(Do(r,(a)=>jP(o,a,s,i)),o)})),LP=function(){let e=typeof arguments[0]!=="string",t=e?arguments[1]:arguments[0],n=Oh(e?arguments[2]:arguments[1]);if(e){let r=arguments[0];return V(nd(t,n),(o)=>Zu(r,o,n))}return(r)=>V(nd(t,n),(o)=>Zu(r,o,n))},UK=(e,t)=>(t=typeof t==="function"?t:Ao,Zs(Yf,(n)=>({name:e,stack:t,parent:n}))),BP,HP,WP,jP=(e,t,n,r)=>me(()=>{if(e.status._tag==="Ended")return;e.end(r?n.currentTimeNanosUnsafe():ub,t)}),rd=(e,...t)=>{let n=t.length===1?void 0:t[0],r=t[t.length-1];return le((o)=>{let s=uw(o,e,n),i=o.getRef(ni),a=o.getRef(Ju);return vn(Fe(()=>r(s)),(c)=>jP(s,c,i,a))})},lb,Zu=function(){let e=de(arguments[0]),t=e?arguments[1]:arguments[0],n=e?arguments[2]:arguments[1],r=L;if(t._tag==="Span")n=Oh(n),r=UK(t.name,n?.captureStackTrace);if(e)return lb(r(arguments[0]),t);return(o)=>lb(r(o),t)},qP=function(){let e=typeof arguments[0]!=="string",t=e?arguments[1]:arguments[0],n=Oh(arguments[2]);if(e){let s=arguments[0];return rd(t,arguments[2],(i)=>Zu(s,i,n))}let r=typeof arguments[1]==="function"?arguments[1]:void 0,o=r?void 0:arguments[1];return(s,...i)=>rd(t,r?r(...i):o,(a)=>Zu(s,a,n))},zP,VP=(...e)=>le((t)=>{let n=t.currentSpanLocal;if(n)if(e.length===1)for(let[r,o]of Object.entries(e[0]))n.attribute(r,o);else n.attribute(e[0],e[1]);return Ee}),KP,GP,ni,ob=2147483647,QP,ZP,LK,as=(e)=>le((t)=>e(t.getRef(ni))),yc=(e)=>as((t)=>t.sleep(Nr(e))),YP,od="~effect/Cause/TimeoutError",XP=(e)=>D(e,od),ng,sd="~effect/Cause/IllegalArgumentError",eR=(e)=>D(e,sd),lw,id="~effect/Cause/ExceededCapacityError",tR=(e)=>D(e,id),fw,ad="~effect/Cause/AsyncFiberError",nR=(e)=>D(e,ad),rg,cd="~effect/Cause/UnknownError",rR=(e)=>D(e,cd),Ed,dw,BK=(e)=>{switch(e){case"All":return Number.MIN_SAFE_INTEGER;case"Fatal":return 50000;case"Error":return 40000;case"Warn":return 30000;case"Info":return 20000;case"Debug":return 1e4;case"Trace":return 0;case"None":return Number.MAX_SAFE_INTEGER}},HK,oR,pw,WK,sR=function(){let e=typeof arguments[0]==="string"?[[arguments[0],arguments[1]]]:Object.entries(arguments[0]);return ei(le((t)=>{let n=t.getRef(Qs),r={...n};for(let o=0;o<e.length;o++){let[s,i]=e[o];H(r,s,i)}return t.setContext(Cn(t.context,Qs,r)),Do(Ro(t.context,ca),(o)=>{let s=t.getRef(Qs),i={...s};for(let a=0;a<e.length;a++){let[c,u]=e[a];if(s[c]!==u)continue;if(Object.hasOwn(n,c))H(i,c,n[c]);else delete i[c]}return t.setContext(Cn(t.context,Qs,i)),Ee})}))},jK="~effect/Logger",qK,iR=(e)=>{let t=Object.create(qK);return t.log=e,t},zK=(e)=>e.replace(/[\s="]/g,"_"),VK=(e,t)=>`${zK(e[0])}=${t-e[1]}ms`,$o=(e)=>(...t)=>{let n=void 0;for(let r=0,o=t.length;r<o;r++){let s=t[r];if(_u(s)){if(n)t.splice(r,1);else t=t.slice(0,r).concat(t.slice(r+1));n=n?Ls(n.reasons.concat(s.reasons)):s,r--}}if(n===void 0)n=Ym;return le((r)=>{let o=e??r.currentLogLevel;if(oR(r.minimumLogLevel,o))return Ee;let s=r.getRef(ni),i=r.getRef(pw);if(i.size>0){let a=new Date(s.currentTimeMillisUnsafe());for(let c of i)c.log({cause:n,fiber:r,date:a,logLevel:o,message:t})}return Ee})},dc,Vle,KK=(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")}`,GK,JK,mw,aR,ZK=(e,t,n)=>{let r=e.getRef(m_);if(r.size===0)return;if(n&&!Rh(t))return;let o={cause:t,fiber:e,timestamp:e.getRef(ni).currentTimeNanosUnsafe()};r.forEach((s)=>s.report(o))};var At=v(()=>{nr();rt();Yi();Pt();zT();Zn();ne();wn();pr();FE();Me();rc();ct();ge();Jm();Bn();yh();d_();Ja();pt();rh();nb();_h();h_();fb=class fb extends $f{fiberId;constructor(e,t=Uf){super("Interrupt",t,"Interrupted");this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[Oe](e){return ec(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[_e](){return Ot(Ze(`${this._tag}:${this.fiberId}`))(zm(this.annotations))}};k_=qT(ao),dK=new Set,Dh=p(2,(e,t)=>{if(e.reasons.length===0)return t;else if(t.reasons.length===0)return e;let n=new Us($E(e.reasons,t.reasons));return ee(e,n)?e:n}),O_=p(2,(e,t)=>{let n=!1,r=e.reasons.map((o)=>{if(ji(o))return n=!0,new Ou(t(o.error),o.annotations);return o});return n?Ls(r):e}),hK=/\((.*)\)/g,yK={_A:L,_E:L},SK={id:0};hb=class hb{constructor(e,t=!0){this[Ph]=yK,this.setContext(e),this.id=++SK.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)}[Ph];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 tr(this.context,e)}addObserver(e){if(this._exit)return e(this._exit),Ns;return this._observers.push(e),()=>{if(this._exit)return;let t=this._observers.indexOf(e);if(t>=0)this._observers.splice(t,1)}}interruptUnsafe(e,t){if(this._exit)return;let n=pc(e);if(this.currentStackFrame)n=Pu(n,Ks(eh,this.currentStackFrame));if(t)n=Pu(n,t);if(this._interruptedCause=this._interruptedCause?Dh(this._interruptedCause,n):n,this.interruptible)if(this._running)this._deferredInterrupt=!0;else this.evaluate(Ge(this._interruptedCause))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;else if(this._yielded!==void 0){let r=this._yielded;this._yielded=void 0,r()}let t=this.runLoop(e);if(t===Ya)return;let n=ib.interruptChildren&&ib.interruptChildren(this);if(n!==void 0)return this.evaluate(V(n,()=>t));this._exit=t,this.runtimeMetrics?.recordFiberEnd(this.context,this._exit);for(let r=0;r<this._observers.length;r++)this._observers[r](t);this._observers.length=0,this._stack.length=0,this._children=void 0,this.context=Ln()}runLoop(e){let t=globalThis[Iu];globalThis[Iu]=this;let n=this._running;this._running=!0;let r=!1,o=e;this.currentOpCount=0;try{while(!0){if(this._deferredInterrupt)this._deferredInterrupt=!1,o=Ge(this._interruptedCause);if(this.currentOpCount++,!r&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){r=!0;let s=o;o=V(Xu,()=>s)}if(o=this.currentTracerContext?this.currentTracerContext(o,this):o[Rt](this),o===Ya){let s=this._yielded;if(Qa in s)return this._deferredInterrupt=!1,this._yielded=void 0,s;else if(this._deferredInterrupt){this._yielded=void 0,s();continue}return Ya}}}catch(s){if(!D(o,Rt))return Oo(`Fiber.runLoop: Not a valid effect: ${String(o)}`);return this.runLoop(Oo(s))}finally{this._running=n,globalThis[Iu]=t}}getCont(e){if(this._deferredInterrupt)return this._deferredInterrupt=!1,EK;while(!0){let t=this._stack.pop();if(!t)return;let n=t[Wi]&&t[Wi](this);if(n)return n[e]=n,n;if(t[e])return t}}yieldWith(e){return this._yielded=e,Ya}children(){return this._children??=new Set}pipe(){return fe(this,arguments)}setContext(e){let t=this.context;if(this.context=e,t!==void 0&&yT(t,e))return;let n=this.getRef(Zf);if(n!==this.currentScheduler)this.currentScheduler=n,this._dispatcher=void 0;this.currentSpan=Gf(e,XE),this.currentLogLevel=this.getRef(tb),this.minimumLogLevel=this.getRef(Ah),this.currentStackFrame=this.getRef(Yf),this.maxOpsBeforeYield=this.getRef(JT),this.currentPreventYield=this.getRef(QT),this.runtimeMetrics=Gf(e,p_);let r=Gf(e,eb);this.currentTracerContext=r?r.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag==="Span"?this.currentSpan:void 0}};EK={[Yn](e,t){return Ge(t._interruptedCause)},[to](e,t){return Ge(t._interruptedCause)}},ib={interruptChildren:void 0},N_=p((e)=>D(e[0],Ph),(e,t,n)=>le((r)=>{let o=Uh(r);return o=o&&n?ic(o,n):o??n,e.interruptUnsafe(t,o),ld(D_(e))})),W=Ke,Ge=$n,ft=ro,me=no({op:"Sync",[Rt](e){let t=this[ce](),n=e.getCont(Yn);return n?n[Yn](t,e):e.yieldWith(Ke(t))}}),ue=no({op:"Suspend",[Rt](e){return this[ce]()}}),gb=p((e)=>e.length>=2||Hu(e[0]),(e,t)=>he(e)?ft(t?t():new os("Effect.fromOption: Option.none")):W(e.value)),Yu=mr({onFailure:ft,onSuccess:W}),xb=no({op:"Yield",[Rt](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{if(t)return;e.evaluate(or)},this[ce]??0),e.yieldWith(()=>{t=!0})}}),Xu=xb(0),mc=W(P()),Ee=W(void 0),j_=le(W),q_=W_(W),Eb=no({op:"Async",single:!1,[Rt](e){let t=Fe(()=>this[ce][0].bind(e.currentScheduler)),n=!1,r=!1,o=this[ce][1]?new AbortController:void 0,s=t((i)=>{if(n)return;if(n=!0,r)e.evaluate(i);else r=i},o?.signal);if(r!==!1)return r;if(r=!0,e._yielded=()=>{n=!0},o===void 0&&s===void 0)return Ya;return e._stack.push(wK(()=>(n=!0,o?.abort(),s??or))),Ya}}),wK=no({op:"AsyncFinalizer",[Wi](e){if(e.interruptible)e.interruptible=!1,e._stack.push(Xh)},[to](e,t){return Fh(e)?V(this[ce](),()=>Ge(e)):Ge(e)}}),Wh=an(Ns),g_=rb(2),Qu=no({op:"Iterator",single:!1,[Yn](e,t){let n=this[ce][0];while(!0){let r=n.next(e);if(r.done)return W(r.value);if(!Xe(r.value))return t._stack.push(this),r.value;else if(r.value._tag==="Failure")return r.value;e=r.value.value}},[Rt](e){return this[Yn](this[ce][1],e)}}),Hn=p(2,(e,t)=>{let n=W(t);return V(e,(r)=>n)}),Mo=p(2,(e,t)=>V(e,(n)=>de(t)?t:Fe(()=>t(n)))),hc=p(2,(e,t)=>V(e,(n)=>Hn(de(t)?t:Fe(()=>t(n)),n))),Q_=p((e)=>de(e[1]),(e,t,n)=>kb([e,t],n)),jh=p((e)=>de(e[1]),(e,t,n)=>Cb([e,t],n)),V=p(2,(e,t)=>{let n=Object.create(kK);return n[ce]=e,n[Yn]=t.length!==1?(r)=>t(r):t,n}),kK=Bs({op:"OnSuccess",[Rt](e){return e._stack.push(this),this[ce]}}),Z_=p(2,(e,t)=>{if(Xe(e))return e._tag==="Success"?t.onSuccess(e.value):t.onFailure(e.cause);return Fo(e,t)}),Y_=p(2,(e,t)=>{if(Xe(e))return e._tag==="Success"?t(e.value):e;return V(e,t)}),We=p(2,(e,t)=>V(e,(n)=>W(Fe(()=>t(n))))),eO=p(2,(e,t)=>Xe(e)?Ab(e,t):We(e,t)),tO=p(2,(e,t)=>Xe(e)?Tb(e,t):$b(e,t)),nO=p(2,(e,t)=>Xe(e)?_b(e,t):Ub(e,t)),rO=p(2,(e,t)=>{if(Xe(e)){if(e._tag==="Success")return e;let n=ao(e.cause);if(Se(n))return e;return t(n.success)}return Br(e,t)}),Ib=jE(fd,ao),aO=jE(fd,ud),or=Ke(void 0),Ab=p(2,(e,t)=>e._tag==="Success"?Ke(t(e.value)):e),Tb=p(2,(e,t)=>{if(e._tag==="Success")return e;let n=ao(e.cause);if(Se(n))return e;return ro(t(n.success))}),_b=p(2,(e,t)=>{if(e._tag==="Success")return Ke(t.onSuccess(e.value));let n=ao(e.cause);if(Se(n))return e;return ro(t.onFailure(n.success))}),CK=p(2,(e,t)=>ia(e)?Ke(t):e),fO=p(2,(e,t)=>ia(e)?t:e),dO=p(2,(e,t)=>ia(e)?t.onSuccess(e.value):t.onFailure(e.cause)),pO=CK(void 0),tl=p(2,(e,t)=>le((n)=>{let r=n.context,o=t(r);if(r===o)return e;return n.setContext(o),Xs(e,()=>{n.setContext(r);return})})),Zs=p(3,(e,t,n)=>tl(e,(r)=>{let o=Ro(r,t),s=n(o);if(o===s)return r;return Cn(r,t,s)})),IK=le((e)=>W(e.context)),EO=p(2,(e,t)=>tl(e,_t(t))),Ys=p(2,(e,t)=>{if(Xe(e))return e;return tl(e,ic(t))}),zh=p(3,(e,t,n)=>V(n,(r)=>sr(e,t,r))),bO=p((e)=>de(e[1]),(e,t,n)=>Rb(e,t,(r,o)=>[r,o],n)),Rb=p((e)=>de(e[1]),(e,t,n,r)=>r?.concurrent?We(yd([e,t],{concurrency:2}),([o,s])=>Fe(()=>n(o,s))):V(e,(o)=>We(t,(s)=>Fe(()=>n(o,s))))),wO=p((e)=>de(e[0]),(e,t,n)=>nw(e,t,n?(r)=>ft(n(r)):()=>ft(new os))),kO=p(2,(e,t)=>V(t,(n)=>n?el(e):mc)),Fb=p(2,(e,t)=>Array.from({length:t},()=>e)),CO=p((e)=>de(e[0]),(e,t,n)=>yd(Fb(e,t),n)),Vh=p((e)=>de(e[0]),(e,t)=>is({while:Fr,body:_t(t?.disableYield?e:V(e,(n)=>Xu)),step:Ns})),Lr=p(2,(e,t)=>{let n=Object.create(AK);return n[ce]=e,n[to]=t.length!==1?(r)=>t(r):t,n}),AK=Bs({op:"OnFailure",[Rt](e){return e._stack.push(this),this[ce]}}),Mb=p(3,(e,t,n)=>Lr(e,(r)=>{if(!t(r))return Ge(r);return Fe(()=>n(r))})),nl=p(3,(e,t,n)=>Lr(e,(r)=>{let o=t(r);return Se(o)?Ge(o.failure):Fe(()=>n(o.success,r))})),Br=p(2,(e,t)=>nl(e,ao,(n)=>t(n))),IO=p(2,(e,t)=>nl(e,ud,t)),AO=p(2,(e,t)=>Lr(e,(n)=>Mo(Fe(()=>t(n)),Ge(n)))),TO=p(3,(e,t,n)=>Mb(e,t,(r)=>Mo(Fe(()=>n(r)),Ge(r)))),Kh=p(3,(e,t,n)=>Lr(e,(r)=>{let o=t(r);if(Se(o))return Ge(r);return Mo(Fe(()=>n(o.success,r)),Ge(r))})),Db=p(2,(e,t)=>Kh(e,ao,(n)=>t(n))),_O=p(3,(e,t,n)=>{let r=Array.isArray(t)?(o)=>D(o,"_tag")&&t.includes(o._tag):eo(t);return Db(e,(o)=>r(o)?n(o):Ee)}),OO=p(2,(e,t)=>Kh(e,ud,(n)=>t(n))),dd=p((e)=>de(e[0]),(e,t,n,r)=>Lr(e,(o)=>{let s=ao(o);if(Se(s))return Ge(s.failure);if(!t(s.success))return r?Fe(()=>r(s.success)):Ge(o);return Fe(()=>n(s.success))})),Gh=p((e)=>de(e[0]),(e,t,n,r)=>Lr(e,(o)=>{let s=ao(o);if(Se(s))return Ge(s.failure);let i=t(s.success);if(Se(i))return r?Fe(()=>r(i.failure)):Ge(o);return Fe(()=>n(i.success))})),Nb=p((e)=>de(e[0]),(e,t,n,r)=>{let o=Array.isArray(t)?(s)=>D(s,"_tag")&&t.includes(s._tag):eo(t);return dd(e,o,n,r)}),PO=p((e)=>de(e[0]),(e,t,n)=>{let r;return Gh(e,(o)=>(r??=Object.keys(t),D(o,"_tag")&&_o(o._tag)&&r.includes(o._tag)?J(o):oe(o)),(o)=>Fe(()=>t[o._tag](o)),n)}),RO=p((e)=>de(e[0]),(e,t,n,r,o)=>dd(e,(s)=>eo(s,t)&&D(s,"reason"),(s)=>{let i=s.reason;if(eo(i,n))return r(i,s);return o?Fe(()=>o(i,s)):ft(s)})),FO=p((e)=>de(e[0]),(e,t,n,r)=>{let o;return dd(e,(s)=>eo(s,t)&&D(s,"reason")&&D(s.reason,"_tag")&&_o(s.reason._tag),(s)=>{let i=s.reason;if(o??=Object.keys(n),o.includes(i._tag))return Fe(()=>n[i._tag](i,s));return r?Fe(()=>r(i,s)):ft(s)})}),MO=p(2,(e,t)=>Gh(e,(n)=>{if(eo(n,t)&&D(n,"reason"))return J(n.reason);return oe(n)},ft)),$b=p(2,(e,t)=>Br(e,(n)=>Hh(()=>t(n)))),Ub=p(2,(e,t)=>gc(e,{onFailure:(n)=>Hh(()=>t.onFailure(n)),onSuccess:(n)=>me(()=>t.onSuccess(n))})),DO=p(2,(e,t)=>Br(e,(n)=>me(t))),$O=p((e)=>de(e[0]),(e,t)=>{if(!t?.log)return gc(e,{onFailure:(r)=>Ee,onSuccess:(r)=>Ee});let n=$o(t.log===!0?void 0:t.log);return Fo(e,{onFailure(r){let o=pb(r);return Se(o)?Ge(o.failure):t.message===void 0?n(r):n(t.message,r)},onSuccess:(r)=>Ee})}),Jh=p((e)=>de(e[0]),(e,t)=>{if(!t?.log)return Fo(e,{onFailure:(r)=>Ee,onSuccess:(r)=>Ee});let n=$o(t.log===!0?void 0:t.log);return Fo(e,{onFailure:(r)=>t.message===void 0?n(r):n(t.message,r),onSuccess:(r)=>Ee})}),Fo=p(2,(e,t)=>{let n=Object.create(TK);return n[ce]=e,n[Yn]=t.onSuccess.length!==1?(r)=>t.onSuccess(r):t.onSuccess,n[to]=t.onFailure.length!==1?(r)=>t.onFailure(r):t.onFailure,n}),TK=Bs({op:"OnSuccessAndFailure",[Rt](e){return e._stack.push(this),this[ce]}}),Hb=p(2,(e,t)=>Fo(e,{onFailure:(n)=>me(()=>t.onFailure(n)),onSuccess:(n)=>me(()=>t.onSuccess(n))})),gc=p(2,(e,t)=>Fo(e,{onFailure:(n)=>{let r=n.reasons.find(ji);return r?Fe(()=>t.onFailure(r.error)):Ge(n)},onSuccess:t.onSuccess})),Qh=p(2,(e,t)=>gc(e,{onFailure:(n)=>me(()=>t.onFailure(n)),onSuccess:(n)=>me(()=>t.onSuccess(n))})),pd=p(2,(e,t)=>{if(Xe(e)){if(e._tag==="Success")return Ke(t.onSuccess(e.value));let n=ao(e.cause);if(Se(n))return e;return Ke(t.onFailure(n.success))}return Qh(e,t)}),LO=p(2,(e,t)=>{if(Xe(e)){if(e._tag==="Success")return Ke(t.onSuccess(e.value));return Ke(t.onFailure(e.cause))}return Hb(e,t)}),_K=no({op:"Exit",[Rt](e){return e._stack.push(this),this[ce]},[Yn](e,t,n){return W(n??Ke(e))},[to](e,t,n){return W(n??$n(e))}}),BO=pd({onFailure:()=>!0,onSuccess:()=>!1}),HO=pd({onFailure:()=>!1,onSuccess:()=>!0}),WO=p(2,(e,t)=>Mo(yc(t),e)),Wb=p(2,(e,t)=>jh(e,V(yc(t.duration),t.orElse))),jO=p(2,(e,t)=>Wb(e,{duration:t,orElse:()=>ft(new ng)})),qO=p(2,(e,t)=>jh(el(e),Hn(yc(t),P()))),ca=Ye("effect/Scope"),PK=bb(function*(e,t,n){let r=[],o=[],s=Array.from(t.values()),i=oa();for(let a=s.length-1;a>=0;a--){let c=s[a];if(e.strategy==="sequential")r.push(yield*md(c(n)));else o.push(xc(i,c(n),!0,!0,"inherit"))}if(o.length>0)r=yield*Lh(o);return yield*Ob(r)}),RK={_tag:"Empty"},gd=ca,GO=sr(ca),Xs=no({op:"OnExit",single:!1,[Rt](e){return e._stack.push(this),this[ce][0]},[Wi](e){if(e.interruptible&&this[ce][2]!==!0)e._stack.push(Xh),e.interruptible=!1},[Yn](e,t,n){n??=Ke(e);let r=this[ce][1](n);return r?V(r,(o)=>n):n},[to](e,t,n){n??=$n(e);let r=this[ce][1](n);return r?V(OK(n,r),(o)=>n):n}}),vn=p(2,Xs),JO=p(2,(e,t)=>vn(e,(n)=>t)),Kb=p(3,(e,t,n)=>vn(e,(r)=>{if(!t(r))return Ee;return n(r)})),Gb=p(3,(e,t,n)=>vn(e,(r)=>{let o=t(r);return Se(o)?Ee:n(o.success,r)})),Jb=p(2,(e,t)=>Gb(e,fd,t)),QO=p(3,(e,t,n)=>Kb(e,(r)=>{if(r._tag!=="Failure")return!1;return t(r.cause)},(r)=>n(r.cause))),Qb=p(3,(e,t,n)=>vn(e,(r)=>{if(r._tag!=="Failure")return Ee;let o=t(r.cause);return Se(o)?Ee:n(o.success,r.cause)})),ZO=p(2,(e,t)=>Qb(Mh,t)(e)),Yb=p(2,(e,t)=>me(()=>{let n=qu(Nr(t)),r=Number.isFinite(n),o=cw(!1),s=0,i=!1,a,c=V(o.await,()=>a);return[le((u)=>{let l=u.getRef(ni),f=r?l.currentTimeMillisUnsafe():0;if(i||f<s)return a??c;return i=!0,o.closeUnsafe(),a=void 0,vn(e,(d)=>me(()=>{i=!1,s=l.currentTimeMillisUnsafe()+n,a=d,o.openUnsafe()}))}),me(()=>{s=0,o.closeUnsafe(),a=void 0})]})),Xb=p(2,(e,t)=>We(Yb(e,t),(n)=>n[0])),eP=le((e)=>Ge(pc(e.id))),tP=no({op:"SetInterruptible",[Wi](e){if(e.interruptible=this[ce],e._interruptedCause&&e.interruptible)return()=>Ge(e._interruptedCause)}}),Xh=tP(!0),FK=tP(!1),oP=We(xd(me(()=>new AbortController),(e)=>me(()=>e.abort())),(e)=>e.signal),tw=p((e)=>ns(e[0])&&!de(e[0]),(e,t,n)=>We(Ur(e,(r,o)=>na(t(r,o)),n),(r)=>LE(r,L))),sP=p(3,(e,t,n)=>{let r=on(e);if(r.length===0)return me(t);return ue(()=>{let o=0,s=t();return We(is({while:()=>o<r.length,body:()=>n(s,r[o],o),step(i){s=i,o++}}),()=>s)})}),iP=p((e)=>ns(e[0])&&!de(e[0]),(e,t,n)=>V(tw(e,t,{concurrency:n?.concurrency}),([r,o])=>{if(ac(r))return ft(r);return n?.discard?Ee:W(o)})),aP=p((e)=>ns(e[0])&&!de(e[0]),(e,t)=>ue(()=>{let n=e[Symbol.iterator](),r=n.next();if(!r.done)return cP(n,0,t,r.value);return W(P())})),uP=p((e)=>ns(e[0])&&!de(e[0]),(e,t)=>ue(()=>{let n=e[Symbol.iterator](),r=n.next();if(!r.done)return lP(n,0,t,r.value);return W(P())})),is=no({op:"While",[Yn](e,t){if(this[ce].step(e),this[ce].while())return t._stack.push(this),this[ce].body();return or},[Rt](e){if(this[ce].while())return e._stack.push(this),this[ce].body();return or}}),Ur=p((e)=>typeof e[1]==="function",(e,t,n)=>ue(()=>{let r=n?.concurrency??1,o=r==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,r);if(o===1)return MK(e,t,n);let s=on(e),i=s.length;if(i===0)return n?.discard?Ee:W([]);let a=n?.discard?void 0:Array(i),c=DK({f:t,out:a},s,{concurrency:o});return c?Hn(c,a):W(a)})),DK=dP({onItem(e,t,n){return e.f(t,n)},step(e,t,n,r){if(n._tag==="Failure")return n;else if(e.out)e.out[r]=n.value}}),nw=p(3,(e,t,n)=>V(e,(r)=>t(r)?W(r):n(r))),rw=p(3,(e,t,n)=>V(e,(r)=>{let o=t(r);return Se(o)?n(o.failure):W(o.success)})),pP=p((e)=>de(e[0]),(e,t,n)=>rw(e,t,n?(r)=>ft(n(r)):()=>ft(new os))),mP=p((e)=>ns(e[0])&&!de(e[0]),(e,t,n)=>ue(()=>{let r=[];return Hn(Ur(e,(o,s)=>{let i=t(o,s);if(typeof i==="boolean"){if(i)r.push(o);return Ee}return We(i,(a)=>{if(a)r.push(o)})},{discard:!0,concurrency:n?.concurrency}),r)})),hP=p((e)=>ns(e[0])&&!de(e[0]),(e,t)=>ue(()=>{let n=[];for(let r of e){let o=t(r);if(rn(o))n.push(o.success)}return W(n)})),gP=p((e)=>ns(e[0])&&!de(e[0]),(e,t,n)=>ue(()=>{let r=[];return Hn(Ur(e,(o)=>We(t(o),(s)=>{if(rn(s))r.push(s.success)}),{discard:!0,concurrency:n?.concurrency}),r)})),xP=W({}),yP=Du(We),SP=Nu(We,V),EP=Mu(We),bP=p((e)=>de(e[0]),(e,t)=>le((n)=>(QK(),W(xc(n,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),wP=p((e)=>de(e[0]),(e,t)=>le((n)=>W(xc(n,e,t?.startImmediately,!0,t?.uninterruptible)))),ow=p((e)=>de(e[0]),(e,t,n)=>le((r)=>{let o=xc(r,e,n?.startImmediately,!0,n?.uninterruptible);if(!o._exit)if(t.state._tag!=="Closed"){let s={};td(t,s,()=>W_((a)=>a===o.id?Ee:Bh(o))),o.addObserver(()=>qb(t,s))}else o.interruptUnsafe(r.id,Uh(r));return W(o)})),CP=p((e)=>de(e[0]),(e,t)=>V(gd,(n)=>ow(e,n,t))),vP=p(2,(e,t)=>{if(e._exit)return e;else if(t.state._tag==="Closed")return e.interruptUnsafe(e.id),e;let n={};return td(t,n,()=>Bh(e)),e.addObserver(()=>qb(t,n)),e}),IP=ti(Ln()),AP=sw(Ln()),TP=eg(Ln()),_P=iw(Ln()),OP=tg(Ln()),PP=aw(Ln()),E_=W(!0),b_=W(!1);FP=le((e)=>W(e.getRef(vh))),MP=p(2,(e,t)=>sr(e,vh,t)),DP=sr(Ih),NP=sr(Ju),ub=BigInt(0),NK={_tag:"Span",spanId:"noop",traceId:"noop",sampled:!1,status:{_tag:"Ended",startTime:ub,endTime:ub,exit:or},attributes:new Map,links:[],kind:"internal",attribute(){},event(){},end(){},addLinks(){}},BP=Xf,HP=ed,WP=p((e)=>de(e[0]),(e,t,n={})=>{let o=(Array.isArray(t)?t:[t]).map((s)=>({span:s,attributes:n}));return Zs(e,ed,(s)=>[...s,...o])}),lb=sr(kh),zP=p((e)=>de(e[0]),(e,...t)=>Zs(e,Xf,(n)=>{let r=t.length===1?{...n,...t[0]}:{...n};if(t.length===1)return r;else H(r,t[0],t[1]);return r})),KP=le((e)=>{let t=e.currentSpanLocal;return t?W(t):ft(new os)}),GP=vK(kh),ni=Te("effect/Clock",{defaultValue:()=>new JP});QP=BigInt(1e6),ZP=function(){let e=globalThis.process?.hrtime;if(typeof e?.bigint==="function")return()=>e.bigint();if(typeof performance<"u"&&typeof performance.now==="function")return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(0);return()=>{let n=BigInt(Date.now())*QP;if(n>t)t=n;return t}}(),LK=function(){let e=BigInt(1e9),t;return()=>{let n=ZP(),r=BigInt(Date.now())*QP;if(t===void 0)t=r-n;else{let o=t+n;if((r>o?r-o:o-r)>e)t=r-n}return t+n}}(),YP=as((e)=>e.currentTimeMillis);ng=class ng extends Hs("TimeoutError"){[od]=od;constructor(e){super({message:e})}};lw=class lw extends Hs("IllegalArgumentError"){[sd]=sd;constructor(e){super({message:e})}};fw=class fw extends Hs("ExceededCapacityError"){[id]=id;constructor(e){super({message:e})}};rg=class rg extends Hs("AsyncFiberError"){[ad]=ad;constructor(e){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:e})}};Ed=class Ed extends Hs("UnknownError"){[cd]=cd;constructor(e,t){super({message:t,cause:e})}};dw=Te("effect/Console/CurrentConsole",{defaultValue:()=>globalThis.console}),HK=xE(Mr,BK),oR=Vi(HK),pw=Te("effect/Loggers/CurrentLoggers",{defaultValue:()=>new Set([GK,JK])}),WK=Te("effect/Logger/LogToStderr",{defaultValue:Of}),qK={[jK]:{_Message:L,_Output:L},pipe(){return fe(this,arguments)}},dc={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},Vle={None:[],All:[],Trace:[dc.gray],Debug:[dc.blue],Info:[dc.green],Warn:[dc.yellow],Error:[dc.red],Fatal:[dc.bgBrightRed,dc.black]},GK=iR(({cause:e,date:t,fiber:n,logLevel:r,message:o})=>{let s=Array.isArray(o)?o.slice():[o];if(e.reasons.length>0)s.push($h(e));let i=t.getTime(),a=n.getRef(Th),c="";for(let d of a)c+=` ${VK(d,i)}`;let u=n.getRef(Qs);if(Object.keys(u).length>0)s.push(u);let l=n.getRef(dw);(n.getRef(WK)?l.error:l.log)(`[${KK(t)}] ${r.toUpperCase()} (#${n.id})${c}:`,...s)}),JK=iR(({cause:e,fiber:t,logLevel:n,message:r})=>{let o=t.getRef(ni),s=t.getRef(Qs),i=t.currentSpan;if(i===void 0||i._tag==="ExternalSpan")return;let a={};for(let[c,u]of Object.entries(s))H(a,c,u);if(a["effect.fiberId"]=t.id,a["effect.logLevel"]=n.toUpperCase(),e.reasons.length>0)a["effect.cause"]=$h(e);i.event(BA(Array.isArray(r)&&r.length===1?r[0]:r),o.currentTimeNanosUnsafe(),a)});mw=W(void 0),aR=p((e)=>de(e[0]),(e,t)=>Jb(e,(n)=>le((r)=>(ZK(r,n,t?.defectsOnly),Ee))))});var Et={};Qn(Et,{AsyncFiberError:()=>TG,AsyncFiberErrorTypeId:()=>IG,Done:()=>Id,DoneTypeId:()=>xG,ExceededCapacityError:()=>vG,ExceededCapacityErrorTypeId:()=>CG,IllegalArgumentError:()=>Ad,IllegalArgumentErrorTypeId:()=>bG,InterruptorStackTrace:()=>dR,NoSuchElementError:()=>gG,NoSuchElementErrorTypeId:()=>hG,ReasonTypeId:()=>XK,StackTrace:()=>fR,TimeoutError:()=>EG,TimeoutErrorTypeId:()=>yG,TypeId:()=>YK,UnknownError:()=>Ew,UnknownErrorTypeId:()=>_G,annotate:()=>PG,annotations:()=>FG,combine:()=>rG,die:()=>cR,done:()=>Vt,empty:()=>xw,fail:()=>yw,filterInterruptors:()=>dG,findDefect:()=>cG,findDie:()=>aG,findError:()=>lR,findErrorOption:()=>sG,findFail:()=>oG,findInterrupt:()=>lG,fromReasons:()=>Sc,hasDies:()=>iG,hasFails:()=>uR,hasInterrupts:()=>uG,hasInterruptsOnly:()=>vd,interrupt:()=>nG,interruptors:()=>fG,isAsyncFiberError:()=>AG,isCause:()=>hw,isDieReason:()=>eG,isDone:()=>og,isExceededCapacityError:()=>kG,isFailReason:()=>bd,isIllegalArgumentError:()=>wG,isInterruptReason:()=>tG,isNoSuchElementError:()=>mG,isReason:()=>gw,isTimeoutError:()=>SG,isUnknownError:()=>OG,makeDieReason:()=>kd,makeFailReason:()=>wd,makeInterruptReason:()=>Cd,map:()=>ri,pretty:()=>Sw,prettyErrors:()=>pG,reasonAnnotations:()=>RG,squash:()=>rl});var YK,XK,hw,gw,bd,eG,tG,Sc,xw,yw,cR,nG,wd=(e)=>new Ou(e),kd=(e)=>new Xm(e),Cd,vd,ri,rG,rl,uR,oG,lR,sG,iG,aG,cG,uG,lG,fG,dG,pG,Sw,mG,hG,gG,og,xG,Id,Vt,yG,SG,EG,bG,wG,Ad,kG,CG,vG,IG,AG,TG,_G,OG,Ew,PG,RG,FG,fR,dR;var In=v(()=>{rt();pt();At();YK=Au,XK=Tu,hw=_u,gw=VA,bd=ji,eG=Xa,tG=ec,Sc=Ls,xw=Ym,yw=Lf,cR=fE,nG=pc,Cd=w_,vd=A_,ri=O_,rG=Dh,rl=Nh,uR=db,oG=pb,lR=ao,sG=k_,iG=Rh,aG=C_,cG=ud,uG=Fh,lG=v_,fG=I_,dG=Mh,pG=mb,Sw=$h,mG=th,hG=Nf,gG=os,og=Hf,xG=Za,Id=Ru,Vt=JA,yG=od,SG=XP,EG=ng,bG=sd,wG=eR,Ad=lw,kG=tR,CG=id,vG=fw,IG=ad,AG=nR,TG=rg,_G=cd,OG=rR,Ew=Ed,PG=Pu,RG=T_,FG=__;fR=class fR extends Ye()("effect/Cause/StackTrace"){};dR=class dR extends Ye()("effect/Cause/InterruptorStackTrace"){}});var pn={};Qn(pn,{asVoid:()=>GG,asVoidAll:()=>JG,die:()=>pR,fail:()=>uo,failCause:()=>Hr,filterCause:()=>HG,filterFailure:()=>BG,filterSuccess:()=>UG,filterValue:()=>LG,findDefect:()=>jG,findError:()=>WG,findErrorOption:()=>YG,getCause:()=>ZG,getSuccess:()=>QG,hasDies:()=>NG,hasFails:()=>DG,hasInterrupts:()=>$G,interrupt:()=>MG,isExit:()=>bw,isFailure:()=>ol,isSuccess:()=>Kt,map:()=>zG,mapBoth:()=>KG,mapError:()=>VG,match:()=>qG,succeed:()=>co,void:()=>Wr});var bw,co,Hr,uo,pR,MG,Wr,Kt,ol,DG,NG,$G,UG,LG,BG,HG,WG,jG,qG,zG,VG,KG,GG,JG,QG,ZG,YG;var jr=v(()=>{pt();At();bw=lE,co=Ke,Hr=$n,uo=ro,pR=Oo,MG=qh,Wr=or,Kt=ia,ol=vb,DG=lO,NG=uO,$G=cO,UG=oO,LG=sO,BG=iO,HG=fd,WG=Ib,jG=aO,qG=dO,zG=Ab,VG=Tb,KG=_b,GG=pO,JG=Ob,QG=mO,ZG=hO,YG=gO});var XG="~effect/Deferred",e4,sg=()=>{let e=Object.create(e4);return e.resumes=void 0,e.effect=void 0,e},Ec=(e)=>an((t)=>{if(e.effect)return t(e.effect);return e.resumes??=[],e.resumes.push(t),me(()=>{let n=e.resumes;if(n===void 0)return;let r=n.indexOf(t);if(r>=0)n.splice(r,1)})}),t4,mR,ww=(e)=>me(()=>n4(e)),n4=(e)=>e.effect!==void 0,kw=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){let n=e.resumes;e.resumes=void 0;for(let r=0;r<n.length;r++)n[r](t)}return!0};var Cw=v(()=>{ne();At();ct();e4={[XG]:{_A:L,_E:L},pipe(){return fe(this,arguments)}},t4=p(2,(e,t)=>me(()=>kw(e,t))),mR=t4});var gR,xR,yR;var vw=v(()=>{nb();gR=Qs,xR=Th,yR=Ah});var Td,sl,_d,ig,Od,ua,qr;var Pd=v(()=>{At();Td=ca,sl=hd,_d=GO,ig=Do,Od=KO,ua=VO,qr=jb});var bR="~effect/Layer",SR="~effect/Layer/MemoMap",o4=(e,t)=>(e.observers++,Mo(Do(t,(n)=>e.finalizer(n)),e.effect)),wR=(e)=>D(e,bR),s4,kR=(e)=>{let t=Object.create(s4);return t.build=e,t},Iw=(e)=>kR((t,n)=>{let r=ua(n);return vn(e(t,r),(o)=>o._tag==="Failure"?qr(r,o):Ee)}),i4=(e)=>{let t=Iw((n,r)=>n.getOrElseMemoize(t,r,e));return t},a4=(e,t,n,r)=>{let o=sl(),s=sg(),i={observers:1,effect:Ec(s),finalizer:(a)=>ue(()=>{if(i.observers--,i.observers===0)return e.map.delete(t),qr(o,a);return Ee})};return e.map.set(t,i),Do(n,i.finalizer).pipe(V(()=>r(e,o)),vn((a)=>(i.effect=a,mR(s,a))))},Aw,Tw=()=>new Aw,c4=(e)=>new Aw(e),Rd,_w,CR,la=function(){if(arguments.length===1)return(e)=>cg(Ks(arguments[0],e));return cg(Ks(arguments[0],arguments[1]))},cg=(e)=>kR(_t(W(e))),il=function(){if(arguments.length===1)return(e)=>ER(arguments[0],e);return ER(arguments[0],arguments[1])},ER=(e,t)=>u4(We(t,(n)=>Ks(e,n))),u4=(e)=>i4((t,n)=>_d(e,n)),vR=(e,t,n)=>{let r=ua(n,"parallel");return Ur(e,(o)=>o.build(t,ua(r,"sequential")),{concurrency:e.length}).pipe(We((o)=>bT(...o)))},ug=(...e)=>Iw((t,n)=>vR(e,t,n)),IR=(e,t,n)=>Iw((r,o)=>V(Array.isArray(t)?vR(t,r,o):t.build(r,o),(s)=>e.build(r,o).pipe(Ys(s),We((i)=>n(i,s))))),AR,TR;var cs=v(()=>{rt();Cw();ne();pt();At();ct();ge();Pd();s4={[bR]:{_ROut:L,_E:L,_RIn:L},pipe(){return fe(this,arguments)}};Aw=class Aw{get[SR](){return SR}parent;constructor(e){this.parent=e}map=new Map;get(e,t){let n=this.map.get(e);if(n)return o4(n,t);return this.parent?.get(e,t)}getOrElseMemoize(e,t,n){return ue(()=>{let r=this.get(e,t);if(r)return r;return a4(this,e,t,n)})}};Rd=class Rd extends Ye()("effect/Layer/CurrentMemoMap"){static forkOrCreate(e){let t=fh(e,Rd);return t?c4(t):Tw()}};_w=p(3,(e,t,n)=>sr(We(e.build(t,n),Cn(Rd,t)),Rd,t)),CR=p(2,(e,t)=>le((n)=>_w(e,Rd.forkOrCreate(n.context),t))),AR=p(2,(e,t)=>IR(e,t,L)),TR=p(2,(e,t)=>IR(e,t,(n,r)=>ic(r,n)))});var _R="~effect/ExecutionPlan",l4,f4=(e)=>{let t=Object.create(l4);return t.steps=e,t},OR;var PR=v(()=>{rt();ne();At();cs();ct();l4={[_R]:_R,get captureRequirements(){let e=this;return aa((t)=>W(f4(e.steps.map((n)=>({...n,provide:wR(n.provide)?AR(n.provide,cg(t)):n.provide})))))},pipe(){return fe(this,arguments)}},OR=Te("effect/ExecutionPlan/CurrentMetadata",{defaultValue:_t({attempt:0,stepIndex:0})})});var lg="~effect/time/DateTime",fg="~effect/time/DateTime/TimeZone",FR,x4,y4,MR,S4,E4,us=(e,t,n)=>{let r=Object.create(y4);return r.epochMilliseconds=e,r.zone=t,Object.defineProperty(r,"partsUtc",{value:n,enumerable:!1,writable:!0}),Object.defineProperty(r,"adjustedEpochMillis",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(r,"partsAdjusted",{value:void 0,enumerable:!1,writable:!0}),r},al=(e)=>D(e,lg),wc=(e)=>D(e,fg),DR=(e)=>wc(e)&&e._tag==="Offset",NR=(e)=>wc(e)&&e._tag==="Named",$R=(e)=>e._tag==="Utc",Rw=(e)=>e._tag==="Zoned",UR,LR,BR=(e)=>{let t=Object.create(x4);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},bc=(e)=>{let t=e.getTime();if(Number.isNaN(t))throw new Ad("Invalid date");return BR(t)},Fw=(e)=>{if(al(e))return e;else if(e instanceof Date)return bc(e);else if(typeof e==="object"){if("epochMilliseconds"in e)return bc(new Date(e.epochMilliseconds));let t=new Date(0);return T4(t,e),bc(t)}else if(typeof e==="string"&&!b4(e))return bc(new Date(e+"Z"));return bc(new Date(e))},b4=(e)=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),w4=-8639999956800000,k4=8639999949600000,Mw=(e,t)=>{let n=t?.timeZone;if(n===void 0&&al(e)&&Rw(e))return e;let r=Fw(e);if(r.epochMilliseconds<w4||r.epochMilliseconds>k4)throw RangeError(`Epoch millis out of range: ${r.epochMilliseconds}`);if(n===void 0&&typeof e==="object"&&"timeZoneId"in e)n=e.timeZoneId;let o;if(n===void 0){let s=new Date(r.epochMilliseconds).getTimezoneOffset()*-60*1000;o=Dd(s)}else if(wc(n))o=n;else if(typeof n==="number")o=Dd(n);else{let s=$w(n);if(he(s))throw new Ad(`Invalid time zone: ${n}`);o=s.value}if(t?.adjustForTimeZone!==!0)return us(r.epochMilliseconds,o,r.partsUtc);return _4(r.epochMilliseconds,o,t?.disambiguation??"compatible")},Ow,HR,C4,WR=(e)=>{let t=C4.exec(e);if(t===null){let o=Hw(e);return o!==null?Ow(e,{timeZone:o}):P()}let[,n,r]=t;return Ow(n,{timeZone:r})},jR=(e)=>BR(e.epochMilliseconds),Md,v4,I4=(e)=>{let t=e.resolvedOptions().timeZone;if(Md.has(t))return Md.get(t);let n=Object.create(S4);return n.id=t,n.format=e,Md.set(t,n),n},Dw=(e)=>{if(Md.has(e))return Md.get(e);try{return I4(new Intl.DateTimeFormat("en-US",{...v4,timeZone:e}))}catch{throw new Ad(`Invalid time zone: ${e}`)}},Dd=(e)=>{let t=Object.create(E4);return t.offset=e,t},Nw,A4,$w=(e)=>{if(A4.test(e)){let t=Hw(e);return t===null?P():F(Dd(t))}return Nw(e)},qR=(e)=>{if(e._tag==="Offset")return Lw(e.offset);return e.id},Nd=(e)=>new Date(e.epochMilliseconds),dg=(e)=>{if(e._tag==="Utc")return new Date(e.epochMilliseconds);else if(e.zone._tag==="Offset")return new Date(e.epochMilliseconds+e.zone.offset);else if(e.adjustedEpochMilliseconds!==void 0)return new Date(e.adjustedEpochMilliseconds);let t=e.zone.format.formatToParts(e.epochMilliseconds).filter((r)=>r.type!=="literal"),n=new Date(0);return n.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),n.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),Number(t[6].value)),e.adjustedEpochMilliseconds=n.getTime(),n},Uw=(e)=>dg(e).getTime()-Bw(e),Lw=(e)=>{let t=Math.abs(e),n=Math.floor(t/3600000),r=Math.round(t%3600000/60000);if(r===60)n+=1,r=0;return`${e<0?"-":"+"}${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`},zR=(e)=>Lw(Uw(e)),Bw=(e)=>e.epochMilliseconds,T4=(e,t)=>{if(t.year!==void 0)e.setUTCFullYear(t.year);if(t.month!==void 0)e.setUTCMonth(t.month-1);if(t.day!==void 0)e.setUTCDate(t.day);if(t.weekDay!==void 0){let n=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+n)}if(t.hour!==void 0)e.setUTCHours(t.hour);if(t.minute!==void 0)e.setUTCMinutes(t.minute);if(t.second!==void 0)e.setUTCSeconds(t.second);if(t.millisecond!==void 0)e.setUTCMilliseconds(t.millisecond)},RR=86400000,_4=(e,t,n)=>{if(t._tag==="Offset")return us(e-t.offset,t);let r=Fd(e-RR,e,t),o=Fd(e+RR,e,t);if(r===o)return us(e-r,t);let s=r<o,i=r-o;if(s){if(Fd(e-o,e,t)===o)return us(e-o,t);let u=us(e-r,t),l=dg(u).getTime();if(e!==l)switch(n){case"reject":{let f=new Date(e).toISOString();throw RangeError(`Gap time: ${f} does not exist in time zone ${t.id}`)}case"earlier":return us(e-o,t);case"compatible":case"later":return u}return u}if(Fd(e-r,e,t)===r){if(n==="earlier"||n==="compatible")return us(e-r,t);if(Fd(e-r+i,e+i,t)===r)return us(e-r,t);if(n==="reject"){let u=new Date(e).toISOString();throw RangeError(`Ambiguous time: ${u} occurs twice in time zone ${t.id}`)}}return us(e-o,t)},O4,Hw=(e)=>{let t=O4.exec(e);if(t===null)return null;let[,n,r,o]=t;return(n==="+"?1:-1)*(Number(r)*60+Number(o))*60*1000},Fd=(e,t,n)=>{let r=n.format.formatToParts(e).find((s)=>s.type==="timeZoneName")?.value??"";if(r==="GMT")return 0;let o=Hw(r);if(o===null)return Uw(us(t,n));return o},VR=(e)=>Nd(e).toISOString(),Pw=(e)=>{let t=dg(e);return e._tag==="Utc"?t.toISOString():`${t.toISOString().slice(0,-1)}${zR(e)}`},Ww=(e)=>e.zone._tag==="Offset"?Pw(e):`${Pw(e)}[${e.zone.id}]`;var KR=v(()=>{In();Pt();Ws();wn();pr();Me();rc();ct();ge();FR={[lg]:lg,pipe(){return fe(this,arguments)},[zt](){return this.toString()},toJSON(){return Nd(this).toJSON()}},x4={...FR,_tag:"Utc",[_e](){return dr(this.epochMilliseconds)},[Oe](e){return al(e)&&e._tag==="Utc"&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${Nd(this).toJSON()})`}},y4={...FR,_tag:"Zoned",[_e](){return Ot(dr(this.epochMilliseconds))(ie(this.zone))},[Oe](e){return al(e)&&e._tag==="Zoned"&&this.epochMilliseconds===e.epochMilliseconds&&ee(this.zone,e.zone)},toString(){return`DateTime.Zoned(${Ww(this)})`}},MR={[fg]:fg,[zt](){return this.toString()}},S4={...MR,_tag:"Named",[_e](){return Ze(`Named:${this.id}`)},[Oe](e){return wc(e)&&e._tag==="Named"&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:"TimeZone",_tag:"Named",id:this.id}}},E4={...MR,_tag:"Offset",[_e](){return Ze(`Offset:${this.offset}`)},[Oe](e){return wc(e)&&e._tag==="Offset"&&this.offset===e.offset},toString(){return`TimeZone.Offset(${Lw(this.offset)})`},toJSON(){return{_id:"TimeZone",_tag:"Offset",offset:this.offset}}},UR=dn((e,t)=>e.epochMilliseconds===t.epochMilliseconds),LR=qs((e,t)=>e.epochMilliseconds<t.epochMilliseconds?-1:e.epochMilliseconds>t.epochMilliseconds?1:0),Ow=Ki(Mw),HR=Ki(Fw),C4=/^(.{17,35})\[(.+)\]$/,Md=new Map,v4={day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"longOffset",fractionalSecondDigits:3,hourCycle:"h23"},Nw=Ki(Dw),A4=/^(?:GMT|[+-])/,O4=/([+-])(\d{2}):(\d{2})$/});function R4(e,t){let[n,r]=GR(e),[o,s]=GR(t),i=Math.min(r,s),a=n*BigInt(10)**BigInt(r-i),c=o*BigInt(10)**BigInt(s-i),u=a%c;if(u===BigInt(0))return e<0||Object.is(e,-0)?-0:0;let l=globalThis.Number(`${u}e${i}`);return l===0?Math.sign(e)*globalThis.Number.MIN_VALUE:l}function GR(e){let t=Math.abs(e).toExponential(),n=t.indexOf("e"),r=t.slice(0,n).replace(".","");return[BigInt(r)*(e<0?-BigInt(1):BigInt(1)),globalThis.Number(t.slice(n+1))-r.length+1]}var afe,JR,QR,ZR,YR;var pg=v(()=>{ne();afe=globalThis.Number,JR=p(2,(e,t)=>{let n=e.toString(),r=t.toString();if(n.includes("e")||r.includes("e")){if(!globalThis.Number.isFinite(e)||!globalThis.Number.isFinite(t)||t===0)return NaN;return R4(e,t)}let o=(n.split(".")[1]||"").length,s=(r.split(".")[1]||"").length,i=o>s?o:s,a=parseInt(e.toFixed(i).replace(".","")),c=parseInt(t.toFixed(i).replace(".",""));return a%c/Math.pow(10,i)});QR=p(2,(e,t)=>{let n=Math.pow(10,t);return Math.round(e*n)/n}),ZR=oo((e,t)=>Math.max(e,t),-1/0),YR=oo((e,t)=>Math.min(e,t),1/0)});var cfe,e1=(e)=>e.trim(),t1=13,n1=10,r1,F4=(e)=>{let t=e.charCodeAt(0);return t===t1||t===n1},M4=(e,t)=>e.charCodeAt(0)===t1&&t.charCodeAt(0)===n1;var o1=v(()=>{cfe=globalThis.String;r1=class r1{index;length;s;stripped;constructor(e,t=!1){this.s=e,this.stripped=t,this.index=0,this.length=e.length}next(){if(this.done)return{done:!0,value:void 0};let e=this.index;while(!this.done&&!F4(this.s[this.index]))this.index=this.index+1;let t=this.index;if(!this.done){let n=this.s[this.index];if(this.index=this.index+1,!this.done&&M4(n,this.s[this.index]))this.index=this.index+1;if(!this.stripped)t=this.index}return{done:!1,value:this.s.substring(e,t)}}[Symbol.iterator](){return new r1(this.s,this.stripped)}get done(){return this.index>=this.length}}});var zr,$d=(e)=>e.reasons.some(jw),jw=(e)=>e._tag==="Fail"&&og(e.error),mg=(e)=>{let t,n=!1;for(let r of e.reasons)if(jw(r))t??=r.error;else if(r._tag!=="Interrupt")n=!0;if(t===void 0)return oe(e);return n?oe(Sc(e.reasons.filter((r)=>!jw(r)))):J(t)},N4=(e)=>{let t=mg(e);return Se(t)?t:J(t.success.value)},qw=(e)=>{let t=mg(e);return!Se(t)?co(t.success.value):Hr(t.failure)},hg;var kc=v(()=>{In();jr();ne();At();Bn();zr=p(2,(e,t)=>nl(e,N4,(n)=>t(n))),hg=p(2,(e,t)=>Fo(e,{onSuccess:t.onSuccess,onFailure:(n)=>{let r=mg(n);return!Se(r)?t.onDone(r.success.value):t.onFailure(r.failure)}}))});var s1="~effect/Schedule",Cc,$4,zw=(e)=>D(e,s1),Vw=(e)=>{let t=Object.create($4);return t.step=e,t},Kw=()=>{let e=0,t,n;return(r,o)=>{if(n===void 0)n=r;let s=r-n,i=t===void 0?0:r-t;return t=r,{input:o,attempt:++e,start:n,now:r,elapsed:s,elapsedSincePrevious:i}}},U4=(e)=>Vw(We(e,(t)=>{let n=Kw();return(r,o)=>t(n(r,o))})),Gw=(e)=>Lr(e.step,(t)=>W(()=>Ge(t))),gg=(e)=>as((t)=>We(Gw(e),(n)=>{let r=Kw();return(o)=>ue(()=>{let s=t.currentTimeMillisUnsafe();return V(n(s,o),([i,a])=>{let c=r(s,o);return c.output=i,c.duration=a,Hn(yc(a),c)})})})),Jw=(e)=>Vw(We(Gw(e),(t)=>(n,r)=>hg(t(n,r),{onSuccess:(o)=>W([r,o[1]]),onFailure:Ge,onDone:()=>Vt(r)}))),i1=(e)=>Ud(Qw,({attempt:t})=>W(t<=e)),L4=(e)=>{let t=Nr(e);return U4(W((n)=>W([n.attempt-1,t])))},Ud,Qw;var Zw=v(()=>{In();rt();Yi();ne();pt();At();ct();ge();kc();Cc=Te("effect/Schedule/CurrentMetadata",{defaultValue:_t({input:void 0,output:void 0,duration:ju,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),$4={[s1]:{_Out:L,_In:L,_Env:L},pipe(){return fe(this,arguments)}},Ud=p(2,(e,t)=>Vw(We(Gw(e),(n)=>{let r=Kw();return(o,s)=>V(n(o,s),(i)=>{let[a,c]=i,u=t({...r(o,s),output:a,duration:c});return V(de(u)?u:W(u),(l)=>l?W(i):Vt(a))})}))),Qw=L4(ju)});var B4=(e,t,n)=>Yh((r)=>V(n?.local?_w(t,Tw(),r):CR(t,r),(o)=>Ys(e,o))),xg;var Yw=v(()=>{rt();ne();cs();pt();At();xg=p((e)=>de(e[0]),(e,t,n)=>AE(t)?Ys(e,t):B4(e,Array.isArray(t)?ug(...t):t,n))});var Xw,ek,u1,Ld,l1,H4,Bd=(e)=>{let t=e.schedule?Jw(e.schedule):H4;if(e.while)t=Ud(t,({input:n})=>{let r=e.while(n);return de(r)?r:W(r)});if(e.until)t=Ud(t,({input:n})=>{let r=e.until(n);return de(r)?We(r,(o)=>!o):W(!r)});if(e.times!==void 0)t=Ud(t,({attempt:n})=>W(n<=e.times));return t};var tk=v(()=>{ne();Me();kc();Zw();Ja();pt();At();Xw=p(3,(e,t,n)=>V(gg(t),(r)=>{let o=Cc.defaultValue();return Br(Vh(hc(V(ue(()=>sr(e,Cc,o)),r),(s)=>me(()=>{o=s})),{disableYield:!0}),(s)=>Hf(s)?W(s.value):n(s,o.attempt===0?P():F(o)))})),ek=p(3,(e,t,n)=>V(gg(t),(r)=>{let o=Cc.defaultValue(),s,i=Br(ue(()=>sr(e,Cc,o)),(a)=>(s=a,V(r(a),(c)=>(o=c,i))));return zr(i,(a)=>Fe(()=>n(s,a)))})),u1=p(2,(e,t)=>{let n=typeof t==="function"?t(L):zw(t)?t:Bd(t);return Xw(e,n,ft)}),Ld=p(2,(e,t)=>{let n=typeof t==="function"?t(L):zw(t)?t:Bd(t);return ek(e,n,ft)}),l1=p(3,(e,t,n)=>V(gg(n),(r)=>{let o=Cc.defaultValue(),s=ue(()=>sr(e,Cc,o));return Br(V(r(t),(i)=>{o=i;let a=_t(V(s,r));return is({while:Fr,body:a,step(c){o=c}})}),(i)=>Hf(i)?W(i.value):ft(i))})),H4=Jw(Qw)});var W4=(e,t)=>{let n=-1,r=0,o=(s)=>Jh(e(s));return{begin:as((s)=>ue(()=>{let i=t();if(i.stepIndex!==n)n=i.stepIndex,r=0;r++;let a={attempt:i.attempt,stepAttempt:r,stepIndex:i.stepIndex,startNanos:s.monotonicTimeNanosUnsafe()};return Hn(o({_tag:"AttemptStart",attempt:a.attempt,stepAttempt:a.stepAttempt,stepIndex:a.stepIndex}),a)})),end:(s,i)=>as((a)=>{let c=io(a.monotonicTimeNanosUnsafe()-s.startNanos);return o(i._tag==="Success"?{_tag:"AttemptSuccess",attempt:s.attempt,stepAttempt:s.stepAttempt,stepIndex:s.stepIndex,duration:c}:{_tag:"AttemptFailure",attempt:s.attempt,stepAttempt:s.stepAttempt,stepIndex:s.stepIndex,duration:c,cause:i.cause})})}},p1,d1=(e,t)=>{if(!t)return Bd({schedule:e.schedule?e.schedule:e.attempts?void 0:j4,times:e.attempts,while:e.while});else if(e.attempts===1||!(e.schedule||e.attempts))return;return Bd({schedule:e.schedule,while:e.while,times:e.attempts?e.attempts-1:void 0})},j4;var m1=v(()=>{Yi();PR();ne();Bn();Zw();pt();At();Yw();tk();p1=p((e)=>de(e[0]),(e,t,n)=>ue(()=>{let r=0,o={attempt:0,stepIndex:0},s=zh(OR,me(()=>(o={attempt:o.attempt+1,stepIndex:r},o))),i=n?.onEvent===void 0?void 0:W4(n.onEvent,()=>o),a=i===void 0?L:(u)=>No((l)=>V(i.begin,(f)=>vn(l(u),(d)=>i.end(f,d)))),c;return V(is({while:()=>r<t.steps.length&&(c===void 0||Se(c)),body(){let u=t.steps[r],l=s(a(xg(e,u.provide)));if(c){let f=!1,d=l;l=ue(()=>{if(f)return d;return f=!0,Yu(c)}),l=Ld(l,d1(u,!1))}else{let f=d1(u,!0);l=f?Ld(l,f):l}return na(l)},step(u){c=u,r++}}),()=>Yu(c))})),j4=i1(1)});var z4="~effect/Request",V4,Cfe,h1=(e)=>e;var g1=v(()=>{Pt();pt();V4=aE({_E:(e)=>e,_A:(e)=>e,_R:(e)=>e}),Cfe={...zA,[z4]:V4}});function x1(e){if(!e.map.has(e.key))return Ee;return e.map.delete(e.key),e.run}var y1,S1=(e,t)=>{let n=E1(t.resolver,e,t.onExit,{context:t.context,currentScheduler:tr(t.context,Zf)});return()=>b1(t.resolver,n)},yg,nk,E1=(e,t,n,r)=>{let o=nk.get(e);if(!o)o=new Map,nk.set(e,o);let s,i=!1,a=h1({request:t,context:r.context,uninterruptible:!1,completeUnsafe(u){if(i)return;i=!0,n(u),s?.entrySet.delete(a)}});if(e.preCheck!==void 0&&!e.preCheck(a))return a;let c=e.batchKey(a);if(s=o.get(c),!s){if(yg.length>0)s=yg.pop(),s.key=c,s.resolver=e,s.map=o;else{let u={key:c,resolver:e,map:o,entrySet:new Set,entries:new Set,delayEffect:V(ue(()=>u.resolver.delay),(l)=>x1(u)),run:vn(ue(()=>u.resolver.runAll(Array.from(u.entries),u.key)),(l)=>{for(let f of u.entrySet)f.completeUnsafe(l._tag==="Success"?Oo(Error("Effect.request: RequestResolver did not complete request",{cause:f.request})):l);if(u.entries.clear(),yg.length<128)u.entrySet.clear(),u.key=void 0,u.fiber=void 0,u.resolver=void 0,u.map=void 0,yg.push(u);return Ee})};s=u}o.set(c,s),s.fiber=ti(r.context)(s.delayEffect,{scheduler:r.currentScheduler})}if(s.entrySet.add(a),s.entries.add(a),s.resolver.collectWhile(s.entries))return a;return s.fiber.interruptUnsafe(r.id),s.fiber=ti(r.context)(x1(s),{scheduler:r.currentScheduler}),a},b1=(e,t)=>{if(t.uninterruptible)return;let n=nk.get(e);if(!n)return;let r=e.batchKey(t),o=n.get(r);if(!o)return;if(o.entries.delete(t),o.entrySet.delete(t),o.entries.size===0)n.delete(r),o.fiber?.interruptUnsafe()},K4=(e,t)=>me(()=>b1(e,t));var w1=v(()=>{rt();ne();g1();yh();pt();At();y1=p(2,(e,t)=>{let n=(r)=>an((o)=>{let s=E1(r,e,o,oa());return K4(r,s)});return de(t)?V(t,n):n(t)}),yg=[],nk=new WeakMap});function eJ(e,t){let n=`${e.type}:${e.id}`;if(Ve(e.description))n+=`:${e.description}`;if(Ve(t))n+=`:${tJ(t)}`;return n}function tJ(e){return JSON.stringify(Array.isArray(e)?e:Object.entries(e))}function nJ(e,t){return{...rk(e),...rk(t)}}function rk(e){if(Ve(e)&&Array.isArray(e))return e.reduce((t,[n,r])=>(H(t,n,r),t),{});return e}var J4="effect/Metric/CurrentMetricAttributes",Q4,Z4="~effect/observability/Metric/MetricRegistryKey",Y4,k1="~effect/observability/Metric",X4,ul;var C1=v(()=>{rt();ne();At();ct();ge();Q4=Te(J4,{defaultValue:()=>({})}),Y4=Te(Z4,{defaultValue:()=>new Map});X4=class X4{[k1]=k1;#t=new WeakMap;#e;id;description;attributes;constructor(e,t,n){this.id=e,this.description=t,this.attributes=n}valueUnsafe(e){return this.hook(e).get(e)}modifyUnsafe(e,t){return this.hook(t).modify(e,t)}updateUnsafe(e,t){return this.hook(t).update(e,t)}hook(e){let t=tr(e,Q4);if(Object.keys(t).length===0){if(Ve(this.#e))return this.#e.hooks;return this.#e=this.getOrCreate(e,this.attributes),this.#e.hooks}let n=nJ(this.attributes,t),r=this.#t.get(n);if(Ve(r))return r.hooks;return r=this.getOrCreate(e,n),this.#t.set(n,r),r.hooks}getOrCreate(e,t){let n=eJ(this,t),r=tr(e,Y4);if(r.has(n))return r.get(n);let o=this.createHooks(),s={id:this.id,type:this.type,description:this.description,attributes:rk(t),hooks:o};return r.set(n,s),s}pipe(){return fe(this,arguments)}};ul=p(2,(e,t)=>aa((n)=>me(()=>e.updateUnsafe(t,n))))});var B={};Qn(B,{Do:()=>dJ,Transaction:()=>Hd,TypeId:()=>oJ,abortSignal:()=>S6,acquireDisposable:()=>u6,acquireRelease:()=>po,acquireUseRelease:()=>U1,addFinalizer:()=>Ig,all:()=>I1,andThen:()=>Vr,annotateCurrentSpan:()=>O6,annotateLogs:()=>a5,annotateLogsScoped:()=>c5,annotateSpans:()=>_6,as:()=>Kr,asSome:()=>_1,asVoid:()=>jd,awaitAllChildren:()=>q6,bind:()=>hJ,bindTo:()=>pJ,cached:()=>m6,cachedInvalidateWithTTL:()=>g6,cachedWithTTL:()=>h6,callback:()=>Wn,catch:()=>lo,catchCause:()=>Gr,catchCauseFilter:()=>TJ,catchCauseIf:()=>AJ,catchDefect:()=>uk,catchEager:()=>Zd,catchFilter:()=>qd,catchIf:()=>vJ,catchNoSuchElement:()=>IJ,catchReason:()=>wJ,catchReasons:()=>kJ,catchTag:()=>si,catchTags:()=>ck,clockWith:()=>Qd,context:()=>Cg,contextWith:()=>N1,currentParentSpan:()=>R6,currentSpan:()=>P6,delay:()=>F1,die:()=>ls,effectify:()=>mt,ensuring:()=>ml,eventually:()=>FJ,exit:()=>da,fail:()=>R,failCause:()=>dl,failCauseSync:()=>fa,failSync:()=>sk,fiber:()=>z6,fiberId:()=>V6,filter:()=>dk,filterMap:()=>KJ,filterMapEffect:()=>D1,filterMapOrElse:()=>JJ,filterMapOrFail:()=>ZJ,filterOrElse:()=>GJ,filterOrFail:()=>QJ,findFirst:()=>cJ,findFirstFilter:()=>uJ,firstSuccessOf:()=>HJ,flatMap:()=>se,flatMapEager:()=>An,flatten:()=>T1,flip:()=>bJ,fn:()=>X6,fnUntraced:()=>q,fnUntracedEager:()=>_g,forEach:()=>vc,forever:()=>ds,forkChild:()=>xk,forkDetach:()=>j6,forkIn:()=>xl,forkScoped:()=>yl,fromNullishOr:()=>SJ,fromOption:()=>xJ,fromResult:()=>ak,gen:()=>un,head:()=>lJ,ignore:()=>zd,ignoreCause:()=>$J,interrupt:()=>gl,interruptible:()=>x6,interruptibleMask:()=>y6,isEffect:()=>yr,isFailure:()=>r6,isSuccess:()=>o6,let:()=>mJ,linkSpans:()=>D6,log:()=>e5,logDebug:()=>o5,logError:()=>Tg,logFatal:()=>t5,logInfo:()=>r5,logTrace:()=>s5,logWarning:()=>n5,logWithLevel:()=>z1,makeSpan:()=>W1,makeSpanScoped:()=>N6,map:()=>ae,mapBoth:()=>_J,mapBothEager:()=>mn,mapEager:()=>ci,mapError:()=>Gt,mapErrorEager:()=>Tc,match:()=>pa,matchCause:()=>e6,matchCauseEager:()=>t6,matchCauseEffect:()=>pk,matchCauseEffectEager:()=>n6,matchEager:()=>XJ,matchEffect:()=>kg,never:()=>Sg,onError:()=>hl,onErrorFilter:()=>f6,onErrorIf:()=>l6,onExit:()=>ai,onExitFilter:()=>p6,onExitIf:()=>d6,onExitPrimitive:()=>L1,onInterrupt:()=>B1,option:()=>EJ,orDie:()=>fo,orElseSucceed:()=>BJ,partition:()=>sJ,promise:()=>A1,provide:()=>mk,provideContext:()=>ii,provideService:()=>fs,provideServiceEffect:()=>hk,race:()=>VJ,raceAll:()=>M1,raceAllFirst:()=>zJ,raceFirst:()=>Ac,reduce:()=>iJ,repeat:()=>E6,repeatOrElse:()=>b6,replicate:()=>w6,replicateEffect:()=>k6,request:()=>H6,requestUnsafe:()=>W6,result:()=>Eg,retry:()=>MJ,retryOrElse:()=>DJ,runCallback:()=>G6,runCallbackWith:()=>K6,runFork:()=>ps,runForkWith:()=>Jd,runPromise:()=>j1,runPromiseExit:()=>Ag,runPromiseExitWith:()=>J6,runPromiseWith:()=>q1,runSync:()=>Q6,runSyncExit:()=>ha,runSyncExitWith:()=>Y6,runSyncWith:()=>Z6,sandbox:()=>NJ,satisfiesErrorType:()=>b5,satisfiesServicesType:()=>w5,satisfiesSuccessType:()=>E5,schedule:()=>C6,scheduleFrom:()=>H1,scope:()=>Vd,scoped:()=>ma,scopedWith:()=>gk,service:()=>$1,serviceOption:()=>vg,setContext:()=>s6,sleep:()=>wg,spanAnnotations:()=>F6,spanLinks:()=>M6,succeed:()=>A,succeedNone:()=>Ic,succeedSome:()=>ok,suspend:()=>He,sync:()=>we,tap:()=>pl,tapCause:()=>bg,tapCauseFilter:()=>RJ,tapCauseIf:()=>PJ,tapDefect:()=>R1,tapError:()=>lk,tapErrorTag:()=>OJ,timed:()=>qJ,timeout:()=>WJ,timeoutOption:()=>jJ,timeoutOrElse:()=>fk,tracer:()=>v6,track:()=>l5,trackDefects:()=>p5,trackDuration:()=>m5,trackErrors:()=>d5,trackSuccesses:()=>f5,transposeOption:()=>yJ,try:()=>Xt,tryPromise:()=>fl,tx:()=>h5,txRetry:()=>S5,undefined:()=>fJ,uninterruptible:()=>Kd,uninterruptibleMask:()=>Gd,unwrapReason:()=>CJ,updateContext:()=>i6,updateService:()=>a6,updateServiceScoped:()=>c6,useSpan:()=>$6,validate:()=>aJ,void:()=>Pe,when:()=>YJ,whileLoop:()=>ll,withErrorReporting:()=>LJ,withExecutionPlan:()=>UJ,withFiber:()=>Wd,withLogSpan:()=>u5,withLogger:()=>i5,withParentSpan:()=>B6,withSpan:()=>U6,withSpanScoped:()=>L6,withTracer:()=>I6,withTracerEnabled:()=>A6,withTracerTiming:()=>T6,yieldNow:()=>ik,yieldNowWith:()=>gJ,zip:()=>O1,zipWith:()=>P1});function y5(e,t){for(let[n,{value:r}]of t.journal){if(r!==n.value)n.version=n.version+1,n.value=r;for(let o of n.pending.values())e.currentDispatcher.scheduleTask(o,0);n.pending.clear()}}function v1(e){e.retry=!1,e.journal.clear()}var oJ,yr,I1,sJ,iJ,aJ,cJ,uJ,vc,lJ,ll,A1,fl,A,Ic,ok,He,we,Pe,fJ,Wn,Sg,dJ,pJ,mJ,hJ,un,R,sk,dl,fa,ls,Xt,ik,gJ,Wd,ak,xJ,yJ,SJ,se,T1,Vr,pl,Eg,EJ,da,ae,Kr,_1,jd,bJ,O1,P1,lo,si,ck,wJ,kJ,CJ,Gr,uk,vJ,qd,IJ,AJ,TJ,Gt,_J,fo,lk,OJ,bg,PJ,RJ,R1,FJ,MJ,DJ,NJ,zd,$J,UJ,LJ,BJ,HJ,WJ,jJ,fk,F1,wg,qJ,M1,zJ,VJ,Ac,dk,KJ,D1,GJ,JJ,QJ,ZJ,YJ,pa,XJ,e6,t6,n6,pk,kg,r6,o6,Cg,N1,mk,ii,s6,$1,vg,i6,a6,c6,fs,hk,Vd,ma,gk,po,u6,U1,Ig,ml,hl,l6,f6,L1,ai,d6,p6,m6,h6,g6,gl,x6,B1,Kd,Gd,y6,S6,ds,E6,b6,w6,k6,C6,H1,v6,I6,A6,T6,_6,O6,P6,R6,F6,M6,D6,W1,N6,$6,U6,L6,B6,H6,W6,xk,xl,yl,j6,q6,z6,V6,ps,Jd,K6,G6,j1,q1,Ag,J6,Q6,Z6,ha,Y6,q,X6,Qd,z1,e5,t5,n5,Tg,r5,o5,s5,i5,a5,c5,u5,l5,f5,d5,p5,m5,Hd,h5=(e)=>Wd((t)=>{let n=fh(t.context,Hd);if(n)return e;n={journal:new Map,retry:!1};let r;return Gd((o)=>se(ll({while:()=>!r,body:_t(o(e).pipe(fs(Hd,n),bg(()=>{if(!n.retry)return Pe;return o(x5(n))}),da)),step(s){if(n.retry||!g5(n))return v1(n);if(Kt(s))y5(t,n);else v1(n);r=s}}),()=>r))}),g5=(e)=>{for(let[t,{version:n}]of e.journal)if(t.version!==n)return!1;return!0},x5=(e)=>He(()=>{let t={},n=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fo,kg=gc,r6=BO,o6=HO,Cg=Pb,N1=aa,mk=xg,ii=Ys,s6=EO,$1=xO,vg=yO,i6=tl,a6=Zs,c6=SO,fs=sr,hk=zh,Vd=gd,ma=zb,gk=Yh,po=xd,u6=YO,U1=Zb,Ig=Vb,ml=JO,hl=Jb,l6=QO,f6=Qb,L1=Xs,ai=vn,d6=Kb,p6=Gb,m6=XO,h6=Xb,g6=Yb,gl=eP,x6=ew,B1=ZO,Kd=ei,Gd=No,y6=rP,S6=oP,ds=Vh,E6=u1,b6=Xw,w6=Fb,k6=CO,C6=p(2,(e,t)=>H1(e,void 0,t)),H1=l1,v6=FP,I6=MP,A6=DP,T6=NP,_6=zP,O6=VP,P6=KP,R6=GP,F6=BP,M6=HP,D6=WP,W1=UP,N6=nd,$6=rd,U6=qP,L6=LP,B6=Zu,H6=y1,W6=S1,xk=bP,xl=ow,yl=CP,j6=wP,q6=kP,z6=j_,V6=q_,ps=IP,Jd=ti,K6=sw,G6=AP,j1=_P,q1=iw,Ag=TP,J6=eg,Q6=PP,Z6=aw,ha=OP,Y6=tg,q=bb,X6=V_,Qd=as,z1=$o,e5=$o(),t5=$o("Fatal"),n5=$o("Warn"),Tg=$o("Error"),r5=$o("Info"),o5=$o("Debug"),s5=$o("Trace"),i5=p(2,(e,t)=>Zs(e,pw,(n)=>new Set([...n,t]))),a5=p((e)=>yr(e[0]),(e,...t)=>Zs(e,gR,(n)=>{let r=t.length===1?{...n,...t[0]}:{...n};if(t.length===1)return r;else H(r,t[0],t[1]);return r})),c5=sR,u5=p(2,(e,t)=>V(YP,(n)=>Zs(e,xR,(r)=>[[t,n],...r]))),l5=p((e)=>yr(e[0]),(e,t,n)=>ai(e,(r)=>{let o=n===void 0?r:Fe(()=>n(r));return ul(t,o)})),f5=p((e)=>yr(e[0]),(e,t,n)=>pl(e,(r)=>{let o=n===void 0?r:n(r);return ul(t,o)})),d5=p((e)=>yr(e[0]),(e,t,n)=>lk(e,(r)=>{let o=n===void 0?r:Fe(()=>n(r));return ul(t,o)})),p5=p((e)=>yr(e[0]),(e,t,n)=>R1(e,(r)=>{let o=n===void 0?r:Fe(()=>n(r));return ul(t,o)})),m5=p((e)=>yr(e[0]),(e,t,n)=>Qd((r)=>{let o=r.monotonicTimeNanosUnsafe();return ai(e,()=>{let s=r.monotonicTimeNanosUnsafe(),i=jT(Nr(s),Nr(o)),a=n===void 0?i:Fe(()=>n(i));return ul(t,a)})}));Hd=class Hd extends Ye()("effect/Effect/Transaction"){};S5=se(Hd,(e)=>(e.retry=!0,gl)),ci=eO,Tc=tO,mn=nO,An=Y_,Zd=rO,_g=K_});var k5=(e,t)=>{if(Kt(e))return t(0);if(vd(e.cause))return t(130);return t(C5(rl(e.cause)))},V1=(e)=>p((t)=>yr(t[0]),(t,n)=>{let r=n?.disableErrorReporting===!0?ps(t):ps(bg(t,(s)=>{if(vd(s))return Pe;return v5(rl(s))?Tg(s):Pe}));try{let s=globalThis.setInterval(Ns,2147483647);r.addObserver(()=>{clearInterval(s)})}catch{}let o=n?.teardown??k5;return e({fiber:r,teardown:o})}),Og="~effect/Runtime/errorExitCode",C5=(e)=>{if(typeof e==="object"&&e!==null&&Og in e){let t=e[Og];if(typeof t==="number")return t}return 1},_c="~effect/Runtime/errorReported",v5=(e)=>{if(typeof e==="object"&&e!==null&&_c in e){let t=e[_c];if(typeof t==="boolean")return t}return!0};var Pg=v(()=>{In();Re();jr();ne()});var K1;var G1=v(()=>{Pg();K1=V1(({fiber:e,teardown:t})=>{let n=!1;e.addObserver((o)=>{process.removeListener("SIGINT",r),process.removeListener("SIGTERM",r),t(o,(s)=>{if(n||s!==0)process.exit(s)})});function r(){n=!0,e.interruptUnsafe(e.id)}process.on("SIGINT",r),process.on("SIGTERM",r)})});var Rg={};Qn(Rg,{runMain:()=>A5});var A5;var J1=v(()=>{G1();A5=K1});var Q1="~effect/platform/PlatformError",ui,Z1,Sk,mo=(e)=>new Sk(new Z1(e)),li=(e)=>new Sk(new ui(e));var ms=v(()=>{Vu();ui=class ui extends Xi("BadArgument"){get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:""}`}};Z1=class Z1 extends zE{get message(){return`${this._tag}: ${this.module}.${this.method}${this.pathOrDescriptor!==void 0?` (${this.pathOrDescriptor})`:""}${this.description?`: ${this.description}`:""}`}};Sk=class Sk extends Xi("PlatformError"){constructor(e){if("cause"in e)super({reason:e,cause:e.cause});else super({reason:e})}[Q1]=Q1;get message(){return this.reason.message}}});function _5(e,t,n,r,o){for(let s=t;s<Math.min(e.length,t+o);s++)n[r+s-t]=e[s];return n}var Y1="~effect/collections/Chunk",X1,bk=(e)=>dn((t,n)=>t.length===n.length&&Yd(t).every((r,o)=>e(r,Xd(n,o)))),O5,P5,wk=(e)=>{let t=Object.create(P5);switch(t.backing=e,e._tag){case"IEmpty":{t.length=0,t.depth=0,t.left=t,t.right=t;break}case"IConcat":{t.length=e.left.length+e.right.length,t.depth=1+Math.max(e.left.depth,e.right.depth),t.left=e.left,t.right=e.right;break}case"IArray":{t.length=e.array.length,t.depth=0,t.left=fi,t.right=fi;break}case"ISingleton":{t.length=1,t.depth=0,t.left=fi,t.right=fi;break}case"ISlice":{t.length=e.length,t.depth=e.chunk.depth+1,t.left=fi,t.right=fi;break}}return t},Mg=(e)=>D(e,Y1),fi,R5=()=>fi,F5=(e)=>wk({_tag:"ISingleton",a:e}),Dg=(e)=>Mg(e)?e:D5(on(e)),Ek=(e,t,n)=>{switch(e.backing._tag){case"IArray":{_5(e.backing.array,0,t,n,e.length);break}case"IConcat":{Ek(e.left,t,n),Ek(e.right,t,n+e.left.length);break}case"ISingleton":{t[n]=e.backing.a;break}case"ISlice":{let r=0,o=n;while(r<e.length)t[o]=Xd(e,r),r+=1,o+=1;break}}},M5=(e)=>{switch(e.backing._tag){case"IEmpty":return X1;case"IArray":return e.backing.array;default:{let t=Array(e.length);return Ek(e,t,0),e.backing={_tag:"IArray",array:t},e.left=fi,e.right=fi,e.depth=0,t}}},Yd,D5=(e)=>e.length===0?R5():e.length===1?F5(e[0]):wk({_tag:"IArray",array:e}),Xd,eF=(e)=>e.length;var tF=v(()=>{nr();Pt();Ws();Zn();ne();wn();pr();ct();ge();X1=[],O5=bk(ee),P5={[Y1]:{_A:(e)=>e},toString(){return`Chunk(${j(Yd(this))})`},toJSON(){return{_id:"Chunk",values:fn(Yd(this))}},[zt](){return this.toJSON()},[Oe](e){return Mg(e)&&O5(this,e)},[_e](){return Cu(Yd(this))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return X1[Symbol.iterator]();default:return Yd(this)[Symbol.iterator]()}},pipe(){return fe(this,arguments)}},fi=wk({_tag:"IEmpty"}),Yd=M5,Xd=p(2,(e,t)=>{let n=Math.floor(t);switch(e.backing._tag){case"IEmpty":throw Error(`Index out of bounds: ${n}`);case"ISingleton":{if(t!==0)throw Error(`Index out of bounds: ${n}`);return e.backing.a}case"IArray":{if(n>=e.length||n<0)throw Error(`Index out of bounds: ${n}`);return e.backing.array[n]}case"IConcat":return n<e.left.length?Xd(e.left,n):Xd(e.right,n-e.left.length);case"ISlice":return Xd(e.backing.chunk,n+e.backing.offset)}})});var nF,rF;var oF=v(()=>{At();nF=Bh,rF=vP});var sF;var iF=v(()=>{At();sF=cw});var aF="~effect/MutableRef",L5,cF=(e)=>{let t=Object.create(L5);return t.current=e,t};var uF=v(()=>{pr();pt();L5={[aF]:aF,...Xn,toJSON(){return{_id:"MutableRef",current:fn(this.current)}}}});var H5,fF=()=>({head:void 0,tail:void 0,length:0}),lF=()=>({array:[],mutable:!0,offset:0,next:void 0}),di=(e,t)=>{if(!e.tail)e.head=e.tail=lF();else if(!e.tail.mutable)e.tail.next=lF(),e.tail=e.tail.next;e.tail.array.push(t),e.length++},Sl=(e)=>{e.head=e.tail=void 0,e.length=0},dF=(e,t)=>{if(t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let s=e.head.array;return Sl(e),s}let n=Array(t),r=0,o=e.head;while(o){while(o.offset<o.array.length){if(n[r++]=o.array[o.offset],o.mutable)o.array[o.offset]=void 0;if(o.offset++,r===t){if(e.head=o,e.length-=t,e.length===0)Sl(e);return n}}o=o.next}return Sl(e),n},El=(e)=>{if(!e.head)return H5;let t=e.head.array[e.head.offset];if(e.head.mutable)e.head.array[e.head.offset]=void 0;if(e.head.offset++,e.length--,e.head.offset===e.head.array.length)if(e.head.next)e.head=e.head.next;else Sl(e);return t};var pF=v(()=>{H5=Symbol.for("effect/MutableList/Empty")});var j5="~effect/Queue",q5="~effect/Queue/Enqueue",z5="~effect/Queue/Dequeue",kk,V5,wl=(e)=>le((t)=>{let n=Object.create(V5);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??Number.POSITIVE_INFINITY,n.strategy=e?.strategy??"suspend",n.messages=fF(),n.scheduleRunning=!1,n.state={_tag:"Open",takers:new Set,offers:new Set,awaiters:new Set},W(n)}),mF=(e)=>wl({capacity:e}),ep=(e,t)=>ue(()=>{if(e.state._tag!=="Open")return $g;else if(e.messages.length>=e.capacity)switch(e.strategy){case"dropping":return $g;case"suspend":if(e.capacity<=0&&e.state.takers.size>0)return di(e.messages,t),vk(e),Ng;return Z5(e,t);case"sliding":return El(e.messages),di(e.messages,t),Ng}return di(e.messages,t),SF(e),Ng}),tp=(e,t)=>{if(e.state._tag!=="Open")return!1;else if(e.messages.length>=e.capacity){if(e.strategy==="sliding")return El(e.messages),di(e.messages,t),!0;else if(e.capacity<=0&&e.state.takers.size>0)return di(e.messages,t),vk(e),!0;return!1}return di(e.messages,t),SF(e),!0},np,rp=(e,t)=>{if(e.state._tag!=="Open")return!1;let n=$n(t),r=fO(n,G5);if(e.state.offers.size===0&&e.messages.length===0)return Ik(e,r),!0;return e.state={...e.state,_tag:"Closing",exit:r},!0},pi=(e)=>rp(e,Lf(Ru())),Ck=(e)=>me(()=>{if(e.state._tag==="Done")return!0;Sl(e.messages);let t=e.state.offers;if(Ik(e,e.state._tag==="Open"?J5:e.state.exit),t.size>0){for(let n of t)if(n._tag==="Single")n.resume($g);else n.resume(Ke(n.remaining.slice(n.offset)));t.clear()}return!0}),hF=(e)=>gF(e,1,Number.POSITIVE_INFINITY),gF=(e,t,n)=>ue(()=>Q5(e,t,n)??Mo(EF(e),gF(e,1,n))),mi=(e)=>ue(()=>yF(e)??Mo(EF(e),mi(e))),xF=(e)=>ue(()=>{let t=yF(e);if(t===void 0)return W(P());if(t._tag==="Success")return W(F(t.value));return W(P())}),yF=(e)=>{if(e.state._tag==="Done")return e.state.exit;if(e.messages.length>0){let t=El(e.messages);return bl(e),Ke(t)}else if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,bl(e),e.capacity=0;let t=El(e.messages);return bl(e),Ke(t)}return},K5=(e)=>e.state._tag==="Done"?0:e.messages.length,$g,Ng,G5,J5,vk=(e)=>{if(e.scheduleRunning=!1,e.state._tag==="Done"||e.state.takers.size===0)return;for(let t of e.state.takers)if(e.state.takers.delete(t),t(or),e.messages.length===0)break},SF=(e)=>{if(e.scheduleRunning||e.state._tag==="Done"||e.state.takers.size===0)return;e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>vk(e),0)},Q5=(e,t,n)=>{if(e.state._tag==="Done")return e.state.exit;else if(n<=0||t<=0)return Ke([]);else if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,bl(e),e.capacity=0;let r=[El(e.messages)];return bl(e),Ke(r)}if(t=Math.min(t,e.capacity||1),t<=e.messages.length){let r=dF(e.messages,n);return bl(e),Ke(r)}},Z5=(e,t)=>an((n)=>{if(e.state._tag!=="Open")return n($g);let r={_tag:"Single",message:t,resume:n};return e.state.offers.add(r),me(()=>{if(e.state._tag==="Open")e.state.offers.delete(r)})}),bl=(e)=>{if(e.state._tag==="Done")return $d(e.state.exit.cause);else if(e.state.offers.size===0){if(e.state._tag==="Closing"&&e.messages.length===0)return Ik(e,e.state.exit),$d(e.state.exit.cause);return!1}let t=e.capacity-e.messages.length;for(let n of e.state.offers)if(t===0)break;else if(n._tag==="Single")di(e.messages,n.message),t--,n.resume(Ng),e.state.offers.delete(n);else{for(;n.offset<n.remaining.length;n.offset++){if(t===0)return!1;di(e.messages,n.remaining[n.offset]),t--}n.resume(Ke([])),e.state.offers.delete(n)}return!1},EF=(e)=>an((t)=>{if(e.state._tag==="Done")return t(e.state.exit);return e.state.takers.add(t),me(()=>{if(e.state._tag!=="Done")e.state.takers.delete(t)})}),Ik=(e,t)=>{if(e.state._tag==="Done")return;let n=e.state;e.state={_tag:"Done",exit:t};for(let r of n.takers)r(t);n.takers.clear();for(let r of n.awaiters)r(t);n.awaiters.clear()};var op=v(()=>{ne();pt();pt();At();pF();Me();kc();kk={_A:L,_E:L},V5={[j5]:kk,[q5]:kk,[z5]:kk,...Xn,toJSON(){return{_id:"effect/Queue",state:this.state._tag,size:K5(this)}}},np=p(2,(e,t)=>me(()=>rp(e,t))),$g=Ke(!1),Ng=Ke(!0),G5=ro(Ru()),J5=qh()});class kF{waiters=new Set;taken=0;permits;constructor(e){this.permits=e}get free(){return this.permits-this.taken}take(e){let t=ue(()=>{if(this.free<e)return bF(this,e,t);return this.taken+=e,W(e)});return t}takeIfAvailable(e){return ue(()=>{if(this.free<e)return W(!1);return this.taken+=e,W(!0)})}releaseUnsafe(e,t){if(this.taken-=t,this.waiters.size>0)e.currentDispatcher.scheduleTask(()=>{for(let n of this.waiters){if(this.free<=0)break;n()}},0);return this.free}resize(e){return le((t)=>{if(this.permits=e,this.free<0)return Ee;return this.releaseUnsafe(t,0),Ee})}release(e){return le((t)=>W(this.releaseUnsafe(t,e)))}get releaseAll(){return le((e)=>W(this.releaseUnsafe(e,this.taken)))}withPermits(e){return(t)=>No((n)=>{let r=ue(()=>{if(this.free<e){let o=bF(this,e,Ee);return V(n(o),()=>r)}return this.taken+=e,Xs(n(t),()=>{this.releaseUnsafe(oa(),e);return},!0)});return r})}withPermit=this.withPermits(1);withPermitsIfAvailable(e){return(t)=>No((n)=>{if(this.free<e)return mc;return this.taken+=e,Xs(n(el(t)),()=>{this.releaseUnsafe(oa(),e);return},!0)})}}var wF=(e)=>new kF(e),bF=(e,t,n)=>an((r)=>{if(e.free>=t)return r(n);let o=()=>{if(e.free<t)return;e.waiters.delete(o),r(n)};return e.waiters.add(o),me(()=>{e.waiters.delete(o)})});var CF=v(()=>{pt();At()});var IF="~effect/Channel",vF=(e)=>D(e,IF),X5,jn=(e)=>{let t=Object.create(X5);return t.transform=(n,r)=>Gr(e(n,r),(o)=>A(dl(o))),t},AF=(e,t)=>jn((n,r)=>se(Uo(e)(n,r),(o)=>t(o,r))),Lg=(e)=>jn((t,n)=>e),TF=(e)=>jn(q(function*(t,n){let r=ua(n),o=(i)=>qr(r,qw(i)),s=yield*hl(e(t,n,r),o);return hl(s,o)})),Uo=(e)=>e.transform,eQ=(e,t,n)=>wl({capacity:n?.bufferSize,strategy:n?.strategy}).pipe(pl((r)=>Od(e,Ck(r))),pl((r)=>xl(_d(t(r),e),e))),_F=(e,t)=>jn((n,r)=>ae(eQ(r,e,t),hF)),OF=(e)=>jn((t,n)=>He(()=>Uo(e())(t,n))),PF,RF,Ak,tQ,FF,MF=()=>jn((e,t)=>we(()=>{let n="",r=!1,o=P();function s(c){let u=[];function l(f){if(n.length===0)u.push(f);else u.push(n+f),n=""}for(let f=0;f<c.length;f++){let d=c[f];if(d.length!==0){let m=0,y=d.indexOf("\r"),b=d.indexOf(`
|
|
26
|
-
|
|
27
|
-
`,
|
|
28
|
-
`,
|
|
29
|
-
|
|
30
|
-
`)
|
|
31
|
-
`);n=Al(e)??Sa(dp(e.ast),e);break}default:n=dM(e);break}return t?`${n}
|
|
32
|
-
at ${t}`:n}function Al(e){if(e._tag==="Pointer")return;if(e._tag==="Encoding")return Al(e.issue);let n=(e._tag==="Filter"?e.filter.annotations:("annotations"in e)?e.annotations:e.ast.annotations)?.[e._tag==="MissingKey"?"messageMissingKey":e._tag==="UnexpectedKey"?"messageUnexpectedKey":"message"];if(typeof n==="string")return n}var mp="~effect/SchemaIssue/Issue",go,Vk,Kk,Jt,Fc,Zg,Ft,bt,Ie,Tl,hp,Gk,dM=(e)=>{let t=Al(e);if(t!==void 0)return t;switch(e._tag){case"InvalidType":return Sa(dp(e.ast),e);case"InvalidValue":{let n=Jk(e);if(n!==void 0)return Sa(n,e);let r=Qg(e);return r===void 0?"Expected a valid value":`Invalid data ${r}`}case"MissingKey":return"Missing key";case"UnexpectedKey":{let n=Qg(e);return n===void 0?"Expected no excess property":`Unexpected key with value ${n}`}case"Forbidden":return"Forbidden operation";case"OneOf":{let n=Qg(e);return n===void 0?"Expected exactly one member to match":`Expected exactly one member to match the input ${n}`}}},pM=(e)=>Al(e.issue)??Al(e),hM;var Ea=v(()=>{nr();Zn();ya();Jg();ge();go=class go{[mp]=mp;constructor(e,t){if(t?.reportInput===!0&&e!==De)this.input=e}};Vk=class Vk extends go{_tag="Filter";filter;issue;constructor(e,t,n,r){super(n,r);this.filter=e,this.issue=t}};Kk=class Kk extends go{_tag="Encoding";ast;issue;constructor(e,t,n,r){super(n,r);this.ast=e,this.issue=t}};Jt=class Jt extends go{_tag="Pointer";path;issue;constructor(e,t){super();this.path=e,this.issue=t}};Fc=class Fc extends go{_tag="MissingKey";annotations;constructor(e){super();this.annotations=e}};Zg=class Zg extends go{_tag="UnexpectedKey";ast;constructor(e,t,n){super(t,n);this.ast=e}};Ft=class Ft extends go{_tag="Composite";ast;issues;constructor(e,t,n,r){super(n,r);this.ast=e,this.issues=t}};bt=class bt extends go{_tag="InvalidType";ast;constructor(e,t,n){super(t,n);this.ast=e}};Ie=class Ie extends go{_tag="InvalidValue";annotations;constructor(e,t,n){super(t,n);this.annotations=e}};Tl=class Tl extends go{_tag="Forbidden";annotations;constructor(e,t,n){super(t,n);this.annotations=e}};hp=class hp extends go{_tag="AnyOf";ast;issues;constructor(e,t,n,r){super(n,r);this.ast=e,this.issues=t}};Gk=class Gk extends go{_tag="OneOf";ast;successes;constructor(e,t,n,r){super(n,r);this.ast=e,this.successes=t}};hM=PQ()});function gp(e){let t;for(let n of e.reasons){if(!bd(n)||!zk(n.error))return;t??=n.error}return t}function xi(e,t){let n=gp(e);if(n===void 0)throw Error(t,{cause:e});return n}var Zk=v(()=>{In();Ea()});var Yk,xM,yM,SM,EM,bM,Xk,eC,wM,kM,Yg,CM,Xg,tC,xp,vM,IM,ba,ex,AM,TM,tx;var nx=v(()=>{KR();Yk=al,xM=wc,yM=DR,SM=NR,EM=$R,bM=Rw,Xk=UR,eC=LR,wM=bc,kM=Mw,Yg=HR,CM=WR,Xg=jR,tC=Dw,xp=Dd,vM=Nw,IM=$w,ba=qR,ex=Nd,AM=Bw,TM=VR,tx=Ww});function RQ(e){return new yi((t,n)=>R(e(t,n)))}function rC(e){return RQ((t,n)=>{let r={message:e(t)};return Ce(t)?new Tl(r,t.value,n):new Tl(r)})}function _M(e){return e.run===OM.run}function Ho(){return OM}function oC(e){return new yi((t,n)=>he(t)?Ic:e(t.value,n))}function Ae(e){return rx(kn(e))}function br(e){return oC((t,n)=>e(t,n).pipe(ci(F)))}function rx(e){return new yi((t)=>A(e(t)))}function sC(){return new yi(()=>Ic)}function yp(e){return new yi((t)=>{let n=sc(t,Ve);return Ce(n)?A(n):ci(e,F)})}function Dc(){return Ae(globalThis.String)}function ox(){return Ae(globalThis.Number)}function PM(){return Ae(globalThis.BigInt)}function iC(){return Ae((e)=>new globalThis.Date(e))}function RM(){return Ae(e1)}function FM(e){return oC((t,n)=>Xt({try:()=>F(JSON.parse(t,e?.reviver)),catch:()=>new Ie({expected:"a valid JSON string"},t,n)}))}function MM(e){return oC((t,n)=>Xt({try:()=>{let r=JSON.stringify(t,e?.replacer,e?.space);if(r===void 0)throw TypeError("Value cannot be represented as JSON");return F(r)},catch:()=>new Ie({expected:"a JSON-serializable value"},t,n)}))}function aC(){return Ae(bh)}function sx(){return Ae(o_)}function ix(){return Ae(i_)}function DM(){return br((e,t)=>Tc(ak(Gu(e)),()=>new Ie({expected:"a valid Base64 string"},e,t)))}function NM(){return br((e,t)=>mr(r_(e),{onFailure:()=>R(new Ie({expected:"a valid Base64 string"},e,t)),onSuccess:A}))}function $M(){return br((e,t)=>mr(KE(e),{onFailure:()=>R(new Ie({expected:"a valid Base64Url string"},e,t)),onSuccess:A}))}function UM(){return br((e,t)=>mr(s_(e),{onFailure:()=>R(new Ie({expected:"a valid Base64Url string"},e,t)),onSuccess:A}))}function LM(){return br((e,t)=>mr(JE(e),{onFailure:()=>R(new Ie({expected:"a valid hexadecimal string"},e,t)),onSuccess:A}))}function BM(){return br((e,t)=>mr(a_(e),{onFailure:()=>R(new Ie({expected:"a valid hexadecimal string"},e,t)),onSuccess:A}))}function HM(){return Ae(encodeURIComponent)}function WM(){return br((e,t)=>{try{return A(globalThis.decodeURIComponent(e))}catch{return R(new Ie({expected:"a valid URI component"},e,t))}})}function cC(){return br((e,t)=>ut(Yg(e),{onNone:()=>R(new Ie({message:"Invalid DateTime input"},e,t)),onSome:(n)=>A(Xg(n))}))}function jM(){return Ae((e)=>KM(Array.from(e.entries())))}function qM(){return Ae((e)=>{let t=new FormData;if(typeof e==="object"&&e!==null)FQ(e).forEach(([r,o])=>{t.append(r,o)});return t})}function zM(){return Ae((e)=>KM(Array.from(e.entries())))}function VM(){return Ae((e)=>{if(typeof e==="object"&&e!==null)return new URLSearchParams(MQ(e));return new URLSearchParams})}function NQ(e){if(e==="")return[""];let t=e.replace(/\[(.*?)\]/g,".$1"),n=t.split("."),r=t.startsWith(".")?1:0;return n.slice(r).map((o)=>DQ.test(o)?globalThis.Number(o):o)}function KM(e){let t={},n=new WeakSet;function r(o,s,i){let a=Object.hasOwn(o,s)?o[s]:void 0;if(n.has(a)&&Array.isArray(a)===i)return a;let c=i?[]:{};return n.add(c),H(o,s,c),c}return e.forEach(([o,s])=>{let i=NQ(o),a=t;i.forEach((c,u)=>{let l=u===i.length-1;if(Array.isArray(a)&&c==="")if(l)a.push(s);else{let f=i[u+1],d=typeof f==="number"||f==="",m=a.length;a=r(a,m,d)}else if(l){let f=Object.hasOwn(a,c);if(f&&Array.isArray(a[c]))a[c].push(s);else if(f)H(a,c,[a[c],s]);else H(a,c,s)}else{let f=i[u+1];a=r(a,c,typeof f==="number"||f==="")}})}),t}function GM(e){return(t)=>{let n=[];function r(o,s){if(e(s))n.push([o,s]);else if(Array.isArray(s))if(s.every(e))s.forEach((a)=>{n.push([o,a])});else s.forEach((a,c)=>{r(`${o}[${c}]`,a)});else if(typeof s==="object"&&s!==null)for(let[i,a]of Object.entries(s))r(`${o}[${i}]`,a)}for(let[o,s]of Object.entries(t))r(o,s);return n}}var yi,OM,FQ,MQ,DQ;var ax=v(()=>{nx();Re();wh();Me();ct();ge();Bn();Ea();o1();yi=class yi extends za{run;constructor(e){super();this.run=e}map(e){return new yi((t,n)=>this.run(t,n).pipe(ci(kn(e))))}compose(e){if(_M(this))return e;if(_M(e))return this;return new yi((t,n)=>this.run(t,n).pipe(An((r)=>e.run(r,n))))}};OM=new yi(A);FQ=GM((e)=>typeof e==="string"||typeof Blob<"u"&&e instanceof Blob);MQ=GM(_o);DQ=/^\d+$/});var JM,lC="~effect/BigDecimal",$Q,ux=(e)=>D(e,lC),wr=(e,t)=>{let n=Object.create($Q);return n.value=e,n.scale=t,n},ZM=(e,t)=>{if(e!==Jr&&e%cx===Jr)throw RangeError("Value must be normalized");let n=wr(e,t);return n.normalized=n,n},Jr,UQ,LQ,cx,YM,fC=(e)=>{if(e.normalized===void 0)if(e.value===Jr)e.normalized=YM;else{let t=`${e.value}`,n=0;for(let s=t.length-1;s>=0;s--)if(t[s]==="0")n++;else break;if(n===0)e.normalized=e;let r=BigInt(t.substring(0,t.length-n)),o=e.scale-n;e.normalized=ZM(r,o)}return e.normalized},wa,XM,Si,BQ,HQ,QM=(e)=>e.value===Jr?0:e.value<Jr?-1:1,WQ=(e)=>e.value<Jr?wr(-e.value,e.scale):e,dC,jQ,eD=(e)=>{if(e==="")return F(YM);let t,n,r=e.search(/[eE]/);if(r!==-1){let c=e.slice(r+1);if(t=e.slice(0,r),n=Number(c),t===""||!Number.isSafeInteger(n)||!JM.test(c))return P()}else t=e,n=0;let o,s,i=t.search(/\./);if(i!==-1){let c=t.slice(0,i),u=t.slice(i+1);o=`${c}${u}`,s=u.length}else o=t,s=0;if(!JM.test(o))return P();let a=s-n;if(!Number.isSafeInteger(a))return P();return F(wr(BigInt(o),a))},xs=(e)=>{let t=fC(e);if(Math.abs(t.scale)>=16)return qQ(t);let n=t.value<Jr,r=n?`${t.value}`.substring(1):`${t.value}`,o,s;if(t.scale>=r.length)o="0",s="0".repeat(t.scale-r.length)+r;else{let a=r.length-t.scale;if(a>r.length){let c=a-r.length;o=`${r}${"0".repeat(c)}`,s=""}else s=r.slice(a),o=r.slice(0,a)}let i=s===""?o:`${o}.${s}`;return n?`-${i}`:i},qQ=(e)=>{if(zQ(e))return"0e+0";let t=fC(e),n=`${WQ(t).value}`,r=n.slice(0,1),o=n.slice(1),s=`${tD(t)?"-":""}${r}`;if(o!=="")s+=`.${o}`;let i=o.length-t.scale;return`${s}e${i>=0?"+":""}${i}`},zQ=(e)=>e.value===Jr,tD=(e)=>e.value<Jr,VQ=(e)=>e.value>Jr,pC=(e)=>ux(e[0]),nD,mC,hC;var gC=v(()=>{Pt();Ws();ne();wn();pr();Me();rc();ct();ge();JM=/^[+-]?\d+$/,$Q={[lC]:lC,[_e](){let e=fC(this);return Ot(ie(e.value),dr(e.scale))},[Oe](e){return ux(e)&&jQ(this,e)},toString(){return`BigDecimal(${xs(this)})`},toJSON(){return{_id:"BigDecimal",value:String(this.value),scale:this.scale}},[zt](){return this.toJSON()},pipe(){return fe(this,arguments)}},Jr=BigInt(0),UQ=BigInt(1),LQ=BigInt(-1),cx=BigInt(10),YM=ZM(Jr,0),wa=p(2,(e,t)=>{if(t>e.scale)return wr(e.value*cx**BigInt(t-e.scale),t);if(t<e.scale)return wr(e.value/cx**BigInt(e.scale-t),t);return e}),XM=p(2,(e,t)=>{if(t.value===Jr)return e;if(e.value===Jr)return t;if(e.scale>t.scale)return wr(wa(t,e.scale).value+e.value,e.scale);if(e.scale<t.scale)return wr(wa(e,t.scale).value+t.value,t.scale);return wr(e.value+t.value,e.scale)}),Si=qs((e,t)=>{let n=Mr(QM(e),QM(t));if(n!==0)return n;if(e.scale>t.scale)return so(e.value,wa(t,e.scale).value);if(e.scale<t.scale)return so(wa(e,t.scale).value,t.value);return so(e.value,t.value)}),BQ=Lu(Si),HQ=Vi(Si),dC=dn((e,t)=>{if(e.scale>t.scale)return wa(t,e.scale).value===e.value;if(e.scale<t.scale)return wa(e,t.scale).value===t.value;return e.value===t.value}),jQ=p(2,(e,t)=>dC(e,t)),nD=p(pC,(e,t=0)=>{if(e.scale<=t)return e;return wr(e.value/cx**BigInt(e.scale-t),t)}),mC=p(pC,(e,t=0)=>{let n=nD(e,t);if(VQ(e)&&BQ(n,e))return XM(n,wr(UQ,t));return n}),hC=p(pC,(e,t=0)=>{let n=nD(e,t);if(tD(e)&&HQ(n,e))return XM(n,wr(LQ,t));return n})});class Ep{_tag="Middleware";decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new Ep(this.encode,this.decode)}}function KQ(e){return D(e,Sp)&&e[Sp]===Sp}function Qr(e){return new Ne(br(e.decode),br(e.encode))}function ht(e){return new Ne(Ae(e.decode),Ae(e.encode))}function fx(e){return new Ne(rx(e.decode),rx(e.encode))}function oD(){return new Ne(RM(),Ho())}function _l(){return GQ}function mD(){return ht({decode:yE,encode:uh})}function hD(){return ht({decode:zs,encode:Un})}function gD(e){return ht({decode:er,encode:e?.onNoneEncoding===null?uh:Un})}function xD(){return fx({decode:F,encode:oc})}function yD(){return fx({decode:(e)=>e.pipe(sc(Ve),F),encode:oc})}function kD(e){return new Ne(FM(e??{}),MM(e))}var Sp="~effect/SchemaTransformation/Transformation",Ne,lx=(e)=>{if(KQ(e))return e;return new Ne(e.decode,e.encode)},GQ,Ol,dx,xC,sD,iD,aD,cD,JQ=(e)=>Dn(e)&&typeof e.message==="string",uD=(e)=>{let n=Object.hasOwn(e,"cause")?Error(e.message,{cause:fD(e.cause)}):Error(e.message);if(typeof e.name==="string"&&e.name!=="Error")n.name=e.name;if(typeof e.stack==="string")n.stack=e.stack;return n},QQ=(e)=>{try{let t=Ga(e);return t===void 0?j(e):JSON.parse(t)}catch{return j(e)}},ZQ=(e,t,n)=>{let r={name:e.name,message:typeof e.message==="string"?e.message:""};if(t?.includeStack&&typeof e.stack==="string")r.stack=e.stack;if(!t?.excludeCause&&e.cause!==void 0)r.cause=n(e.cause);return r},lD=(e)=>{let t=new WeakSet,n=(r)=>{if(NA(r)){if(t.has(r))return"[Circular]";t.add(r);let o=ZQ(r,e,n);return t.delete(r),o}return QQ(r)};return n},fD=(e)=>JQ(e)?uD(e):e,dD=(e)=>ht({decode:uD,encode:(t)=>lD(e)(t)}),pD=(e)=>ht({decode:fD,encode:lD(e)}),yC,SC,EC,SD,ED,bD,wD,CD,vD,ID,bC,wC,kC,CC;var px=v(()=>{gC();nx();Yi();Re();Zn();Me();ge();ax();Ea();Ne=class Ne{[Sp]=Sp;_tag="Transformation";decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new Ne(this.encode,this.decode)}compose(e){return new Ne(this.decode.compose(e.decode),e.encode.compose(this.encode))}};GQ=new Ne(Ho(),Ho());Ol=new Ne(ox(),Dc()),dx=new Ne(PM(),Dc()),xC=new Ne(iC(),Ae(uE)),sD=new Ne(iC(),Ae((e)=>e.getTime())),iD=Qr({decode:(e,t)=>ut(LT(e),{onNone:()=>R(new Ie({expected:"a valid Duration string"},e,t)),onSome:A}),encode:(e)=>A(globalThis.String(e))}),aD=Qr({decode:(e)=>A(io(e)),encode:(e,t)=>ut(HT(e),{onNone:()=>R(new Ie({expected:"a Duration representable as a bigint"},e,t)),onSome:(n)=>A(n)})}),cD=ht({decode:(e)=>Zi(e),encode:(e)=>qu(e)});yC=Qr({decode:(e,t)=>URL.canParse(e)?A(new URL(e)):R(new Ie({expected:"a valid URL string"},e,t)),encode:(e)=>A(e.href)}),SC=Qr({decode:(e,t)=>{let n=eD(e);return he(n)?R(new Ie({expected:"a valid BigDecimal string"},e,t)):A(n.value)},encode:(e)=>A(xs(e))}),EC=new Ne(DM(),aC()),SD=new Ne(NM(),aC()),ED=new Ne(UM(),sx()),bD=new Ne(BM(),ix()),wD=new Ne(WM(),HM());CD=new Ne(jM(),qM()),vD=new Ne(zM(),VM()),ID=ht({decode:(e)=>xp(e),encode:(e)=>e.offset}),bC=Qr({decode:(e,t)=>ut(vM(e),{onNone:()=>R(new Ie({expected:"a valid IANA time zone"},e,t)),onSome:A}),encode:(e)=>A(e.id)}),wC=Qr({decode:(e,t)=>ut(IM(e),{onNone:()=>R(new Ie({expected:"a valid time zone"},e,t)),onSome:A}),encode:(e)=>A(ba(e))}),kC=Qr({decode:(e,t)=>ut(Yg(e),{onNone:()=>R(new Ie({expected:"a valid UTC DateTime string"},e,t)),onSome:(n)=>A(Xg(n))}),encode:(e)=>A(TM(e))}),CC=Qr({decode:(e,t)=>ut(CM(e),{onNone:()=>R(new Ie({expected:"a valid Zoned DateTime string"},e,t)),onSome:A}),encode:(e)=>A(tx(e))})});function Ca(e){return(t)=>t._tag===e}class wt{to;transformation;constructor(e,t){this.to=e,this.transformation=t}}class jo{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,n=void 0,r=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=n,this.annotations=r}}function GD(e){switch(e._tag){case"String":case"Number":case"BigInt":return!0;case"Literal":case"TemplateLiteral":return!e.checks;case"Union":return!e.checks&&e.types.every(GD);default:return!1}}function TD(e){let t=globalThis.String(e.literal);return ot(e,[new wt(new Zr(t),new Ne(Ae(()=>e.literal),Ae(()=>t)))])}function AC(e,t){return e.some((n)=>n.annotations?.representation?.id===t||n._tag==="FilterGroup"&&AC(n.checks,t))}function Nc(e,t,n=$c){let r,o;function s(i){switch(i._tag){case"String":case"TemplateLiteral":return(r??=Object.keys(e)).filter((a)=>i.matchPart(a,n)!==void 0);case"Number":return(r??=Object.keys(e)).filter((a)=>i.matchKey(a,n)!==void 0);case"Symbol":return(o??=Object.getOwnPropertySymbols(e)).filter((a)=>i.matchKey(a,n)!==void 0);case"Union":return[...new Set(i.types.flatMap(s))];default:return[]}}return s(JC(kr(t)))}class gx{name;type;constructor(e,t){this.name=e,this.type=t}}function TC(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every(TC);default:return!1}}function nZ(e){return TC(e)&&TC(kr(e))}class xx{parameter;type;constructor(e,t){if(!nZ(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,Mt(t)&&!xN(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}}function _C(e,t,n){if(n._tag==="Failure")return mx(e,e.ast,t.name,n);if(n===en)return;let r=n[ce];if(r!==De){H(e.out,t.name,r);return}if(delete e.out[t.name],!Mt(t.type)){let o=new Jt([t.name],new Fc(t.type.context?.annotations));if(e.options.errors==="all"){if(e.issues)e.issues.push(o);else e.issues=[o];return}else return uo(new Ft(e.ast,[o],e.input,e.options))}}function HC(e,t){if(!e)return t;if(!t)return e;return[...e,...t]}function yx(e,t,n){return new Dl(Reflect.ownKeys(e).map((r)=>new gx(r,e[r].ast)),[],n,t)}function kp(e){return e.ast}function WC(e,t=void 0){return new qo(!1,e.map((n)=>n.ast),[],void 0,t)}function Sx(e,t,n){return new ir(e.map(kp),t,void 0,n)}function rN(e,t){if(e.encoding||t.some((s)=>s.encoding))throw Error("StructWithRest does not support encodings");let{propertySignatures:n,indexSignatures:r,checks:o}=e;for(let s of t)n=n.concat(s.propertySignatures),r=r.concat(s.indexSignatures),o=HC(o,s.checks);return new Dl(n,r,void 0,o)}function oN(e,t){if(e.encoding)throw Error("TupleWithRest does not support encodings");return new qo(e.isMutable,e.elements,t,void 0,e.checks)}function sN(e){switch(e._tag){case"Null":return["null"];case"Undefined":return["undefined"];case"String":case"TemplateLiteral":return["string"];case"Number":return["number"];case"Boolean":return["boolean"];case"Symbol":case"UniqueSymbol":return["symbol"];case"BigInt":return["bigint"];case"Arrays":return["array"];case"ObjectKeyword":return["object","array","function"];case"Objects":return e.propertySignatures.length||e.indexSignatures.length?["object"]:["string","number","boolean","symbol","bigint","object","array","function"];case"Enum":return Array.from(new Set(e.enums.map(([,t])=>typeof t)));case"Literal":return[typeof e.literal];case"Union":return Array.from(new Set(e.types.flatMap(sN)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function Rl(e){switch(e._tag){default:return[];case"Declaration":{let t=e.annotations?.[fp];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap((t)=>{let n=t.type;if(!Mt(n)){if(Pl(n))return[{key:t.name,literal:n.literal}];if(IC(n))return[{key:t.name,literal:n.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,n)=>{if(!Mt(t)){if(Pl(t))return[{key:n,literal:t.literal}];if(IC(t))return[{key:n,literal:t.symbol}]}return[]});case"Union":{if(e.types.length===0)return[];let t=e.types.map((n)=>Rl(Ex(n)));return t[0].filter((n)=>t.every((r)=>r.some((o)=>o.key===n.key&&o.literal===n.literal)))}case"Suspend":return Rl(e.thunk())}}function rZ(e){let t=OD.get(e);if(t)return t;let n,r=0,o,s,i=!0;for(let a=0;a<e.length;a++){let c=e[a],u=Ex(c);if(YQ(u))continue;if(i)if(Pl(u)||IC(u)){s??=new Map;let f=Pl(u)?u.literal:u.symbol,d=s.get(f);if(!d)s.set(f,d=[]);d.push(c)}else i=!1;let l=Rl(u);if(l.length){n??=new Map,r++;for(let{key:f,literal:d}of l){let m=n.get(f);if(!m)n.set(f,m=[new Map,new Set]);m[1].add(a);let y=m[0].get(d);if(!y)m[0].set(d,y=new Set);y.add(a)}}else{o??={};let f=sN(u);for(let d of f)(o[d]??=[]).push(a)}}if(i&&s)s.forEach(Object.freeze),t=(a)=>s.get(a)??bp;else if(n?.size===1&&!o){let[a,[c]]=n.entries().next().value,u=c;for(let[l,f]of c)u.set(l,Object.freeze(Array.from(f,(d)=>e[d])));t=(l,f)=>{if(Mf(l)){let d=Object.hasOwn(l,a)?l[a]:void 0;if(d!==void 0)return u.get(d)??bp;if(f)return e}return bp}}else if(n){let a;for(let c of n)if((!a||c[1][0].size>a[1][0].size)&&c[1][1].size===r)a=c;t=(c,u)=>{let l=c===null?"null":Array.isArray(c)?"array":typeof c,f=o?.[l]??bp;if(!Mf(c))return f.map((y)=>e[y]);let d=new Set(f),m;if(a){let[y,[b]]=a,E=Object.hasOwn(c,y),w=E?c[y]:void 0;if(E&&(!u||w!==void 0)){let k=b.get(w);if(!k)return f.map((g)=>e[g]);for(let g of k)d.add(g);m=y}}if(m===void 0)for(let[y,[b,E]]of n){let w=Object.hasOwn(c,y),k=w?c[y]:void 0;if(w&&(!u||k!==void 0)){let g=b.get(k);if(g)for(let x of g)d.add(x)}else if(u)for(let g of E)d.add(g)}for(let[y,[b,E]]of n){if(y===m)continue;let w=Object.hasOwn(c,y),k=w?c[y]:void 0;if(w&&(!u||k!==void 0)){let g=b.get(k);for(let x of d)if(E.has(x)&&!g?.has(x))d.delete(x)}}return Array.from(d).sort((y,b)=>y-b).map((y)=>e[y])}}else t=(a)=>{let c=a===null?"null":Array.isArray(a)?"array":typeof a;return(o?.[c]??bp).map((u)=>e[u]).filter(oZ(a))};return OD.set(e,t),t}function oZ(e){return(t)=>{let n=Ex(t);return n._tag==="Literal"?n.literal===e:n._tag==="UniqueSymbol"?n.symbol===e:!0}}function Cp(e,t,n=!1){return rZ(t)(e,n)}function PD(e,t,n,r){let o=gp(t);if(!o)return Hr(t);return uo(new hp(e,[o],n,r))}function RD(e){return e?"":"readonly "}function FD(e){return e?"?":""}function Lc(e){let t=!1,n;return()=>{if(t)return n;return n=e(),t=!0,n}}function wx(e,t,n=!1){return new wp((r,o,s)=>fM(o,e(r,o,s),r,s),t,n)}function kx(e,t){return new wp((n,r,o)=>e(n)?void 0:new Ie(void 0,n,o),t,!0)}function jC(e){return wx((t)=>globalThis.Number.isFinite(t),{expected:"a finite number",representation:{id:"effect/schema/isFinite",payload:null},toJsonSchema:()=>({type:"number"}),toCode:()=>({runtime:"Schema.isFinite()"}),arbitrary:{constraint:{noInfinity:!0,noNaN:!0}},...e})}function vp(e,t){let n=e.source,r=new globalThis.RegExp(n,e.flags);return wx((o)=>(r.lastIndex=0,r.test(o)),{expected:`a string matching the RegExp ${n}`,representation:{id:"effect/schema/isPattern",payload:{source:n,flags:e.flags}},toJsonSchema:()=>({pattern:n}),arbitrary:{constraint:{patterns:[e.source]}},...t})}function Ip(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}function zC(e){return aN.get(e)??e}function ot(e,t){if(e.encoding===t)return e;return Ip(e,(n)=>{n.encoding.value=t})}function Ap(e,t){if(e.context===t)return e;let n=zC(e);if(n.context===t)return n;let r=Ip(e,(o)=>{o.context.value=t});return aN.set(r,n),r}function Tp(e){return e.encoding?Tp(e.encoding[e.encoding.length-1].to):e}function xo(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return Cx(e,ME(e.checks.slice(0,-1),n.annotate(t)))}return Ip(e,(n)=>{n.annotations.value={...n.annotations.value,...t}})}function Cx(e,t){if(e._tag==="Suspend"&&t)throw Error("Cannot add checks to Suspend");if(e.checks===t)return e;return Ip(e,(n)=>{n.checks.value=t})}function Ss(e,t){return Cx(e,HC(e.checks,t))}function Nl(e,t){let n=t(e.to);return n===e.to?e:new wt(n,e.transformation)}function cN(e,t){let n=e,r=n[n.length-1],o=Nl(r,t);return o===r?e:ME(e.slice(0,e.length-1),o)}function VC(e){return(t)=>t.encoding?ot(t,cN(t.encoding,e)):t}function vx(e,t){return VC((n)=>Ap(n,t))(e)}function Bc(e,t){function n(r){if(r.encoding){let o=r.encoding[r.encoding.length-1];return t?.stopAt?.(o)?r:ot(r,cN(r.encoding,n))}return e(r)}return Va(n)}function uN(e,t){return KC(e,t,Tn(e))}function lN(e,t){return KC(kr(e),t,e)}function KC(e,t,n){let r=new wt(e,t);return ot(n,n.encoding?[...n.encoding,r]:[r])}function fN(e,t){let n=cM(e),r=n?[...n,t]:[t];return xo(e,{brands:r})}function Fl(e,t){let n=!1,r=Array(e.length);for(let o=0;o<e.length;o++){let s=e[o],i=t(s);if(i!==s)n=!0;r[o]=i}return n?r:e}function _p(e,t){let n=e.context?new jo(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new jo(!1,!1,void 0,t);return Ap(e,n)}function pN(e,t){let n=new Ne(yp(t),Ho()),r=new wt(Ei,n),o=e.context?new jo(e.context.isOptional,e.context.isMutable,r,e.context.annotations):new jo(!1,!1,r);return Ap(e,o)}function Ix(e,t,n){return KC(e,n,t)}function uZ(e){let t=[],n=[];function r(o){switch(o._tag){case"Literal":if(jm(o.literal))t.push(o.literal);return;case"UniqueSymbol":t.push(o.symbol);return;case"Never":return;case"Union":for(let s=0;s<o.types.length;s++)r(o.types[s]);return;default:n.push(o)}}return r(e),{literals:t,parameters:n}}function mN(e,t){let{literals:n,parameters:r}=uZ(e);return new Dl(n.map((o)=>new gx(o,t)),r.map((o)=>new xx(o,t)))}function Mt(e){return e.context?.isOptional??!1}function hN(e){return e.context?.isMutable??!1}function gN(e){return e.annotations?.[Sr]===!0||e._tag==="FilterGroup"&&e.checks.every(gN)}function lZ(e){function t(r){if(gN(r))return[r];return r._tag==="FilterGroup"?r.checks.flatMap(t):[]}let n=e.flatMap(t);return ac(n)?n:void 0}function fZ(e,t){let n=t,r=n.length,o=n[r-1],s=[new wt(Wo(ot(e,void 0)),n[0].transformation.flip())];for(let a=1;a<r;a++)s.unshift(new wt(Wo(n[a-1].to),n[a].transformation.flip()));let i=Wo(o.to);if(i.encoding)return ot(i,[...i.encoding,...s]);else return ot(i,s)}function xN(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(xN);default:return!1}}function Ax(e,t){let n=ho(t);return(r,o)=>{if(r===De)return Bo;if(r===t)return n;return R(new bt(e,r,o))}}function zo(e,t){return(n,r)=>{if(n===De)return Bo;if(t(n))return en;return R(new bt(e,n,r))}}function MD(e,t,n){let{encodedParts:r,literals:o}=e,s=t.length;for(let u=0;u<o.length;u++){let l=o[u];if(l&&!t.includes(l))return}if(e.suffixLengths[0]>s)return;let i=Array(r.length),a;function c(u,l){if(u===r.length)return l===s;if(a?.has(u*(s+1)+l))return!1;let f=r[u];if(u===r.length-1){let d=t.slice(l);if(f.matchPart(d,n)!==void 0)return i[u]=d,!0}else if(f._tag==="Literal"){let d=o[u];if(t.startsWith(d,l)&&c(u+1,l+d.length))return i[u]=d,!0}else{let d=s-e.suffixLengths[u+1],m=o[u+1],y=m===void 0?d:t.lastIndexOf(m,d);while(y>=l){let b=t.slice(l,y);if(f.matchPart(b,n)!==void 0&&c(u+1,y))return i[u]=b,!0;if(y===0)break;y=m===void 0?y-1:t.lastIndexOf(m,y-1)}}return a??=new Set,a.add(u*(s+1)+l),!1}return c(0,0)?i:void 0}function QC(e){return vp(OC,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:OC.source}),...e})}function ZC(e){return vp(PC,{expected:"a string representing a bigint",representation:{id:"effect/schema/isStringBigInt",payload:null},toJsonSchema:()=>({pattern:PC.source}),...e})}function XC(e){return vp(RC,{expected:"a string representing a symbol",representation:{id:"effect/schema/isStringSymbol",payload:null},toJsonSchema:()=>({pattern:RC.source}),...e})}function Vo(e,t,n,r,o){for(let s=0;s<e.length;s++){let i=e[s];if(i._tag==="FilterGroup"){if(n=Vo(i.checks,t,n,r,o),n&&(o.errors!=="all"||n[n.length-1].filter.aborted))return n}else{let a=i.run(t,r,o);if(a){let c=new Vk(i,a,t,o);if(n)n.push(c);else n=[c];if(o.errors!=="all"||i.aborted)return n}}}return n}function kN(e,t){let n=Vo(e,t,void 0,Ei,{errors:"all"});if(n){let r=new Ft(Ei,n);return oe(r)}return J(t)}function CN(e){if(!va(e))return;let t=e.annotations?.[Kg];return Mn(t)?t(e.typeParameters):void 0}function SZ(e){return e===null||typeof e==="string"||typeof e==="boolean"||typeof e==="number"&&globalThis.Number.isFinite(e)}function EZ(e){return e===void 0||typeof e==="string"}function vN(e,t){let n=new WeakMap,r=[];e:while(!0){if(typeof e!=="object"||e===null){if(!t(e))return!1}else{let o=e,s=n.get(o);if(s===!1)return!1;if(s===void 0){let i=Array.isArray(o);if(!i){let a=Object.getPrototypeOf(o);if(a!==null&&a!==Object.prototype&&Object.getPrototypeOf(a)!==null)return!1}n.set(o,!1),r.push({value:o,keys:i?o.length:Object.keys(o),index:0})}}while(r.length>0){let o=r[r.length-1],s=o.keys;if(typeof s==="number"){if(o.index<s){e=o.value[o.index++];continue e}}else if(o.index<s.length){e=o.value[s[o.index++]];continue e}n.set(o.value,!0),r.pop()}return!0}}function Ul(e){return vN(e,SZ)}function bZ(e){return vN(e,EZ)}var va,YQ,Pl,IC,FC,XQ,DD,eZ,$c,AD="~effect/Schema",Dt,Uc,ND,MC,$D,UD,DC,LD,BD,HD,WD,jD,qD,zD,Ei,VD,KD,NC,$C,UC,Zr,JD,ys,QD,LC,ZD,YD,XD,eN,tN,nN,qo,tZ,BC=(e)=>(e=e==="unbounded"?1/0:e??1,e>1?{concurrency:e}:void 0),mx=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let o=gp(r.cause);if(o===void 0)return Hr(ri(r.cause,(i)=>new Ft(t,[new Jt([n],i)],e.input,e.options)));let s=new Jt([n],o);if(e.options.errors==="all")if(e.issues)e.issues.push(s);else e.issues=[s];else return uo(new Ft(t,[s],e.input,e.options))},hx="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?",Dl,_D,Ex,OD,bp,ir,sZ,iN,bx,wp,ka,qC,iZ,aN,$l,aZ,dN,GC,cZ,Tn,kr,Wo,yN,JC,Tx,SN,EN="[\\s\\S]*?",OC,dZ,bN,pZ,mZ,hZ="-?\\d+",PC,YC,gZ,xZ="Symbol\\((.*)\\)",RC,yZ,wN,Ml,IN,ev,AN,wZ,tv;var bi=v(()=>{nr();In();Re();jr();Zn();ne();At();ya();Zk();Jg();ct();ge();Bn();ax();Ea();px();va=Ca("Declaration"),YQ=Ca("Never"),Pl=Ca("Literal"),IC=Ca("UniqueSymbol"),FC=Ca("Arrays"),XQ=Ca("Objects"),DD=Ca("Union"),eZ=Ca("Suspend");$c={};Dt=class Dt{[AD]=AD;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,r=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=r}toString(){return`<${this._tag}>`}};Uc=class Uc extends Dt{_tag="Declaration";typeParameters;run;encodingChecks;encodingRun;constructor(e,t,n,r,o,s,i,a){super(n,r,o,s);this.typeParameters=e,this.run=t,this.encodingChecks=i,this.encodingRun=a}getParser(){let e;return(t,n)=>{if(t===De)return Bo;return(e??=this.run(this.typeParameters))(t,this,n)}}_rebuild(e,t,n,r,o){let s=Fl(this.typeParameters,e);return s===this.typeParameters&&t===this.checks&&n===this.encodingChecks&&r===this.run&&o===this.encodingRun?this:new Uc(s,r,this.annotations,t,void 0,this.context,n,o)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks,this.run,this.encodingRun)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks,this.encodingRun??this.run,this.run)}getExpected(){let e=this.annotations?.expected;if(typeof e==="string")return e;return"<Declaration>"}};ND=class ND extends Dt{_tag="Null";getParser(){return Ax(this,null)}getExpected(){return"null"}};MC=new ND;$D=class $D extends Dt{_tag="Undefined";getParser(){return Ax(this,void 0)}toCodecJson(){return ot(this,[UD])}getExpected(){return"undefined"}};UD=new wt(MC,new Ne(Ae(()=>{return}),Ae(()=>null))),DC=new $D;LD=class LD extends Dt{_tag="Void";getParser(){let e=ho(void 0);return(t)=>t===De?Bo:e}toCodecJson(){return ot(this,[UD])}getExpected(){return"void"}};BD=new LD;HD=class HD extends Dt{_tag="Never";getParser(){return zo(this,DA)}getExpected(){return"never"}};WD=new HD;jD=class jD extends Dt{_tag="Any";getParser(){return zo(this,ZS)}getExpected(){return"any"}};qD=new jD;zD=class zD extends Dt{_tag="Unknown";getParser(){return zo(this,ZS)}getExpected(){return"unknown"}};Ei=new zD;VD=class VD extends Dt{_tag="ObjectKeyword";getParser(){return zo(this,Mf)}getExpected(){return"object | array | function"}};KD=new VD;NC=class NC extends Dt{_tag="Enum";enums;constructor(e,t,n,r,o){super(t,n,r,o);this.enums=e}getParser(){let e=new Set(this.enums.map(([,t])=>t));return zo(this,(t)=>e.has(t))}toCodecStringTree(){if(this.enums.some(([e,t])=>typeof t==="number")){let e=Object.fromEntries(this.enums.map(([t,n])=>[globalThis.String(n),n]));return ot(this,[new wt(new ir(Object.keys(e).map((t)=>new Zr(t)),"anyOf"),new Ne(Ae((t)=>e[t]),Dc()))])}return this}getExpected(){return this.enums.map(([e,t])=>JSON.stringify(t)).join(" | ")}};$C=class $C extends Dt{_tag="TemplateLiteral";parts;encodedParts;literals;suffixLengths;constructor(e,t,n,r,o){super(t,n,r,o);let s=[],i=[];for(let c of e){let u=kr(c);if(GD(u))s.push(u),i.push(u._tag==="Literal"?globalThis.String(u.literal):void 0);else throw Error(`Invalid TemplateLiteral part ${u._tag}`)}let a=Array(s.length+1);a[s.length]=0;for(let c=s.length-1;c>=0;c--)a[c]=a[c+1]+(i[c]?.length??0);this.parts=e,this.encodedParts=s,this.literals=i,this.suffixLengths=a}getParser(e){let t=e(this.asTemplateLiteralParser());return(n,r)=>{if(n===De)return Bo;let o=t(n,r);if(o._tag==="Success")return en;return mn(o,{onSuccess:()=>n,onFailure:(s)=>new Ft(this,[s],n,r)})}}getExpected(){return"string"}matchPart(e,t){return MD(this,e,t)===void 0?void 0:e}asTemplateLiteralParser(){let e=new qo(!1,this.parts.map(SN),[]);return Ix(ys,e,new Ne(br((t,n)=>{let r=MD(this,t,n);if(r)return A(r);return R(new Ie({expected:"a string matching template literal parts"},t,n))}),Ae((t)=>t.join(""))))}};UC=class UC extends Dt{_tag="UniqueSymbol";symbol;constructor(e,t,n,r,o){super(t,n,r,o);this.symbol=e}getParser(){return Ax(this,this.symbol)}toCodecStringTree(){return ot(this,[wN])}getExpected(){return globalThis.String(this.symbol)}};Zr=class Zr extends Dt{_tag="Literal";literal;constructor(e,t,n,r,o){super(t,n,r,o);if(typeof e==="number"&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${j(e)}`);this.literal=e}getParser(){return Ax(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==="bigint"?TD(this):this}toCodecStringTree(){return typeof this.literal==="string"?this:TD(this)}getExpected(){return typeof this.literal==="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}};JD=class JD extends Dt{_tag="String";getParser(){return zo(this,_o)}matchPart(e,t){let n=this.checks;return n&&!t.disableChecks&&Vo(n,e,void 0,this,t)?void 0:e}getExpected(){return"string"}};ys=new JD;QD=class QD extends Dt{_tag="Number";getParser(){return zo(this,Rf)}matchKey(e,t){return this._match(dZ,e,t)}matchPart(e,t){return this._match(OC,e,t)}_match(e,t,n){if(!e.test(t))return;let r=globalThis.Number(t);if(n.disableChecks||!this.checks)return r;return Vo(this.checks,r,void 0,this,n)?void 0:r}toCodecJson(){if(this.checks&&(AC(this.checks,"effect/schema/isFinite")||AC(this.checks,"effect/schema/isInt")))return this;return ot(this,[iZ])}toCodecStringTree(){if(this.toCodecJson()===this)return ot(this,[pZ]);return ot(this,[mZ])}getExpected(){return"number"}};LC=new QD;ZD=class ZD extends Dt{_tag="Boolean";getParser(){return zo(this,Wm)}getExpected(){return"boolean"}};YD=new ZD;XD=class XD extends Dt{_tag="Symbol";getParser(){return zo(this,QS)}matchKey(e,t){if(t.disableChecks||!this.checks)return e;return Vo(this.checks,e,void 0,this,t)?void 0:e}toCodecStringTree(){return ot(this,[wN])}getExpected(){return"symbol"}};eN=new XD;tN=class tN extends Dt{_tag="BigInt";getParser(){return zo(this,FA)}matchPart(e,t){if(!PC.test(e))return;let n=globalThis.BigInt(e);if(t.disableChecks||!this.checks)return n;return Vo(this.checks,n,void 0,this,t)?void 0:n}toCodecStringTree(){return ot(this,[gZ])}getExpected(){return"bigint"}};nN=new tN;qo=class qo extends Dt{_tag="Arrays";isMutable;elements;rest;encodingChecks;constructor(e,t,n,r,o,s,i,a){super(r,o,s,i);this.isMutable=e,this.elements=t,this.rest=n,this.encodingChecks=a;let c=!1;for(let u=0;u<t.length;u++)if(Mt(t[u]))c=!0;else if(c)throw Error("A required element cannot follow an optional element. ts(1257)");if(c&&n.length>1)throw Error("A required element cannot follow an optional element. ts(1257)");for(let u=1;u<n.length;u++)if(Mt(n[u]))throw Error("An optional element cannot follow a rest element. ts(1266)")}getParser(e,t=e){let n=this,r,o,s=n.elements.length,i=Math.max(0,n.rest.length-1);function a(c,u){if(u<s)return r[u];else if(u>=c)return o[u-c+1];return o[0]}return _g(function*(c,u){if(c===De)return De;if(!Array.isArray(c))return yield*R(new bt(n,c,u));if(!r)r=n.elements.map((y)=>({ast:y,parser:t(y)})),o=n.rest.map((y)=>({ast:y,parser:t(y)}));let l=c.length,f={ast:n,getParser:a,input:c,len:l,tailThreshold:Math.max(s,l-i),output:new globalThis.Array(l),issues:void 0,options:u},d=BC(u?.concurrency),m=tZ(f,c,{concurrency:d?.concurrency,end:n.rest.length===0?s:Math.max(l,s+i)});if(m)yield*m;if(n.rest.length===0&&l>s)for(let y=s;y<=l-1;y++){let b=new Zg(n,c[y],u),E=new Jt([y],b);if(u.errors==="all")if(f.issues)f.issues.push(E);else f.issues=[E];else return yield*R(new Ft(n,[E],c,u))}if(f.issues)return yield*R(new Ft(n,f.issues,c,u));return f.output})}_rebuild(e,t,n){let r=Fl(this.elements,e),o=Fl(this.rest,e);return r===this.elements&&o===this.rest&&t===this.checks&&n===this.encodingChecks?this:new qo(this.isMutable,r,o,this.annotations,t,void 0,this.context,n)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return"array"}};tZ=Sd()({onItem(e,t,n){let r=n<e.len?t:De;return e.getParser(e.tailThreshold,n).parser(r,e.options)},step(e,t,n,r){if(n._tag==="Failure")return mx(e,e.ast,r,n);let o=n===en?t:n[ce];if(o!==De)e.output[r]=o;else{let s=e.getParser(e.tailThreshold,r);if(Mt(s.ast))return;let i=new Jt([r],new Fc(s.ast.context?.annotations));if(e.options.errors==="all")if(e.issues)e.issues.push(i);else e.issues=[i];else return uo(new Ft(e.ast,[i],e.input,e.options))}}});Dl=class Dl extends Dt{_tag="Objects";propertySignatures;indexSignatures;encodingChecks;constructor(e,t,n,r,o,s,i){super(n,r,o,s);this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=i;let a=e.map((c)=>c.name).filter((c,u,l)=>l.indexOf(c)!==u);if(a.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(a)}. ts(2300)`)}getParser(e,t=e){let n=this,r=[];for(let E of n.propertySignatures)r.push(E.name);let o=r.length,s=n.indexSignatures.length,i=o&&s?new Set(r):void 0;if(!o&&!s)return zo(n,qm);let a,c,u=(E,w,k,g,x)=>{if(x._tag==="Failure")return mx(E,n,w,x)??Wr;let S=x===en?g:x[ce];if(k!==De&&S!==De){if(o&&(i.has(w)||i.has(k)))return Wr;H(E.out,k,S)}return Wr},l=(E,w,k,g)=>{if(!g){let I=k.parserKey(w,E.options);if(!Xe(I))return se(da(I),(_)=>l(E,w,k,_));g=I}if(g._tag==="Failure")return mx(E,n,w,g)??Wr;let x=g===en?w:g[ce],S=E.input[w],C=k.parserValue(S,E.options);return Xe(C)?u(E,w,x,S,C):se(da(C),(I)=>u(E,w,x,S,I))},f=(E,w,k)=>{let g=E.input[w],x=k.parserValue(g,E.options);return Xe(x)?u(E,w,w,g,x):se(da(x),(S)=>u(E,w,w,g,S))},d=s?Sd()({onItem:(E,[w,k])=>l(E,w,k),step:(E,w,k)=>k._tag==="Failure"?k:void 0}):void 0,m=()=>{if(!a)a=n.propertySignatures.map((E)=>({parser:t(E.type),name:E.name,type:E.type})),c=s?n.indexSignatures.map((E)=>({is:E,parserKey:e(JC(E.parameter)),parserValue:t(E.type)})):void 0;return a},y=_g(function*(E,w){if(E===De)return De;if(!(typeof E==="object"&&E!==null&&!Array.isArray(E)))return yield*R(new bt(n,E,w));m();let k=E,g={},x={ast:n,input:k,out:g,issues:void 0,options:w},S=w.errors==="all",C=w.onExcessProperty==="error",I=w.onExcessProperty==="preserve",_;if(!s&&(C||I)){i??=new Set(r),_=Reflect.ownKeys(k);for(let U=0;U<_.length;U++){let N=_[U];if(!i.has(N))if(C){let Z=new Zg(n,k[N],w),G=new Jt([N],Z);if(S){if(x.issues)x.issues.push(G);else x.issues=[G];continue}else return yield*R(new Ft(n,[G],E,w))}else H(g,N,k[N])}}let M=BC(w?.concurrency);if(o){let U=_D(x,a,M);if(U)yield*U}if(s&&!M)for(let U=0;U<s;U++){let N=c[U],Z=N.is.parameter===ys?f:l,G=N.is.parameter===ys?Object.keys(k):Nc(k,N.is.parameter,w);for(let ye=0;ye<G.length;ye++){let Wt=Z(x,G[ye],N);if(!Xe(Wt))yield*Wt;else if(Wt._tag==="Failure")return yield*Wt}}else if(d){let U=cc();for(let Z=0;Z<s;Z++){let G=c[Z],ye=Nc(k,G.is.parameter,w);for(let Wt=0;Wt<ye.length;Wt++)U.push([ye[Wt],G])}let N=d(x,U,M);if(N)yield*N}if(x.issues)return yield*R(new Ft(n,x.issues,E,w));if(w.propertyOrder==="original"){let U=(_??Reflect.ownKeys(k)).concat(r),N={};for(let Z of U)if(Object.hasOwn(g,Z))H(N,Z,g[Z]);return N}return g});if(s)return y;let b=(E,w,k)=>{let g=a[w];return se(da(k),(x)=>{let S=_C(E,g,x);if(S)return S;let C=()=>ho(E.out),I=_D(E,a.slice(w+1));return I?An(I,C):C()})};return(E,w)=>{if(E===De)return Bo;if(w.errors==="all"||w.onExcessProperty!==void 0||w.propertyOrder==="original"||w.concurrency!==void 0)return y(E,w);if(!(typeof E==="object"&&E!==null&&!Array.isArray(E)))return R(new bt(n,E,w));let k=m(),g=E,x={},S={ast:n,input:g,out:x,issues:void 0,options:w};try{for(let C=0;C<k.length;C++){let I=k[C],_=I.name,M=Object.hasOwn(g,_),U=M?g[_]:De,N=I.parser(U,w);if(!Xe(N))return b(S,C,N);if(N===en){if(M)H(x,_,U);continue}let Z=_C(S,I,N);if(Z)return Z}}catch(C){return ls(C)}return ho(x)}}_rebuild(e,t,n,r){let o=Fl(this.propertySignatures,(i)=>{let a=e(i.type);return a===i.type?i:new gx(i.name,a)}),s=Fl(this.indexSignatures,(i)=>{let a=t(i.parameter),c=e(i.type);return a===i.parameter&&c===i.type?i:new xx(a,c)});return o===this.propertySignatures&&s===this.indexSignatures&&n===this.checks&&r===this.encodingChecks?this:new Dl(o,s,this.annotations,n,void 0,this.context,r)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){if(this.propertySignatures.length===0&&this.indexSignatures.length===0)return"object | array";return"object"}};_D=Sd()({onItem(e,t){if(!Object.hasOwn(e.input,t.name))return t.parser(De,e.options);let n=e.input[t.name];return H(e.out,t.name,n),t.parser(n,e.options)},step:_C});Ex=Va((e)=>{while(!0){if(eZ(e))return Ei;let t=e.encoding;if(!t)return e.recur?.(Ex,L)??e;if(t.some((n)=>n.transformation._tag==="Middleware"&&n.transformation.decode!==L))return Ei;e=t[t.length-1].to}});OD=new WeakMap,bp=Object.freeze([]);ir=class ir extends Dt{_tag="Union";types;mode;encodingChecks;constructor(e,t,n,r,o,s,i){super(n,r,o,s);this.types=e,this.mode=t,this.encodingChecks=i}getParser(e,t){let n=this;return(r,o)=>{if(r===De)return Bo;let s=Cp(r,n.types,t!==void 0);if(s.length===1){let u=e(s[0])(r,o);if(u._tag==="Success")return u;return Xe(u)?PD(n,u.cause,r,o):Gr(u,(l)=>PD(n,l,r,o))}let i={ast:n,compile:e,input:r,out:void 0,successes:n.mode==="oneOf"?[]:void 0,issues:void 0,options:o},a=BC(o?.concurrency),c=sZ(i,s,a?{...a,orderedStep:!0}:void 0);if(!c){if(i.out)return i.out;return R(new hp(n,i.issues??[],r,o))}return An(c,(u)=>{if(i.out===en)return A(r);if(i.out)return i.out;return R(new hp(n,i.issues??[],r,o))})}}_rebuild(e,t,n){let r=Fl(this.types,e);return r===this.types&&t===this.checks&&n===this.encodingChecks?this:new ir(r,this.mode,this.annotations,t,void 0,this.context,n)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let n of this.types){let r=n.matchPart(e,t);if(r!==void 0)return r}return}getExpected(e){let t=this.annotations?.expected;if(typeof t==="string")return t;if(this.types.length===0)return"never";let n=this.types.map((r)=>{let o=kr(r);switch(o._tag){case"Arrays":{let s=o.elements.filter(Pl);if(s.length>0)return`${RD(o.isMutable)}[ ${s.map((i)=>e(i)+FD(i.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let s=o.propertySignatures.filter((i)=>Pl(i.type));if(s.length>0)return`{ ${s.map((i)=>`${RD(i.type.context?.isMutable)}${$s(i.name)}${FD(i.type.context?.isOptional)}: ${e(i.type)}`).join(", ")}, ... }`;break}}return e(o)});return Array.from(new Set(n)).join(" | ")}};sZ=Sd()({onItem(e,t){return e.compile(t)(e.input,e.options)},step(e,t,n){if(n._tag==="Failure"){let r=gp(n.cause);if(r===void 0)return n;if(e.issues)e.issues.push(r);else e.issues=[r]}else{if(e.out&&e.successes)return e.successes.push(t),uo(new Gk(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(t);else return Wr}}}),iN=new ir([new Zr("Infinity"),new Zr("-Infinity"),new Zr("NaN")],"anyOf");bx=class bx extends Dt{_tag="Suspend";thunk;constructor(e,t,n,r,o){if(n)throw Error("Cannot add checks to Suspend");super(t,void 0,r,o);this.thunk=Lc(e)}getParser(e){let t;return(n,r)=>(t??=e(this.thunk()))(n,r)}recur(e){return new bx(()=>e(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(e){return e(this.thunk())}};wp=class wp extends za{_tag="Filter";run;annotations;aborted;constructor(e,t=void 0,n=!1){super();this.run=e,this.annotations=t,this.aborted=n}annotate(e){return new wp(this.run,{...this.annotations,...e},this.aborted)}abort(){return new wp(this.run,this.annotations,!0)}and(e,t){return new ka([this,e],t)}};ka=class ka extends za{_tag="FilterGroup";checks;annotations;constructor(e,t=void 0){super();this.checks=e,this.annotations=t}annotate(e){return new ka(this.checks,{...this.annotations,...e})}and(e,t){return new ka([this,e],t)}};qC=Ss(LC,[jC()]),iZ=new wt(new ir([qC,iN],"anyOf"),new Ne(ox(),Ae((e)=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));aN=new WeakMap;$l=Va((e)=>{let t=e.context?e.context.isOptional===!1?new jo(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new jo(!0,!1);return aZ(Ap(e,t))}),aZ=VC($l),dN=bn((e)=>$l(new ir([e,DC],"anyOf"))),GC=Va((e)=>{let t=e.context?e.context.isMutable===!1?new jo(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new jo(!1,!0);return cZ(Ap(e,t))}),cZ=VC(GC);Tn=Va((e)=>{if(e.encoding)return Tn(ot(e,void 0));let t=e,n=t.recur?.(Tn)??t,r=n.encodingChecks;if(r){let o=n===e?r:FC(n)||XQ(n)||va(n)&&n.typeParameters.length>0?lZ(r):void 0;return Ip(n,(s)=>{s.encodingChecks.value=void 0,s.checks.value=HC(n.checks,o)})}return n}),kr=Va((e)=>Tn(Wo(e)));Wo=bn((e)=>{if(e.encoding)return fZ(e,e.encoding);let t=e;return t.flip?.(Wo)??t.recur?.(Wo)??t});yN=bn((e)=>new ir(e.enums.map((t)=>new Zr(t[1],{title:t[0]})),"anyOf")),JC=Bc((e)=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(JC)}}),Tx=Bc((e)=>{switch(e._tag){default:return e;case"Symbol":case"UniqueSymbol":return e.toCodecStringTree();case"Union":return e.recur(Tx)}}),SN=Bc((e)=>{switch(e._tag){default:return e;case"Number":case"Literal":case"BigInt":return e.toCodecStringTree();case"Union":return e.recur(SN)}}),OC=new globalThis.RegExp(`^${hx}$`),dZ=new globalThis.RegExp(`^(?:${hx}|Infinity|-Infinity|NaN)$`);bN=Ss(ys,[QC()]),pZ=new wt(bN,Ol),mZ=new wt(new ir([bN,iN],"anyOf"),Ol),PC=new globalThis.RegExp(`^${hZ}$`);YC=Ss(ys,[ZC({expected:"a string representing a bigint"})]),gZ=new wt(YC,dx),RC=new globalThis.RegExp(`^${xZ}$`),yZ=Ss(ys,[XC()]),wN=new wt(yZ,new Ne(Ae((e)=>globalThis.Symbol.for(RC.exec(e)[1])),br((e,t)=>{if(globalThis.Symbol.keyFor(e)!==void 0)return A(globalThis.String(e));return R(new Tl({message:"cannot serialize to string, Symbol is not registered"},e,t))})));Ml=new Uc([],()=>(e,t,n)=>Ul(e)?en:R(new bt(t,e,n)),{representation:{id:"effect/schema/Json",payload:null},expected:"JSON value",toCodecJson:()=>{return},toCodecStringTree:()=>tv,toArbitrary:()=>(e)=>e.jsonValue()}),IN=xo(Ml,{representation:{id:"effect/schema/MutableJson",payload:null}}),ev=new wt(Ml,_l()),AN=new wt(new ir([new qo(!1,[],[Ml]),new Dl([],[new xx(ys,Ml)])],"anyOf"),_l());wZ=new Uc([],()=>(e,t,n)=>bZ(e)?en:R(new bt(t,e,n)),{expected:"StringTree",toCodecStringTree:()=>{return}}),tv=new wt(wZ,_l())});function nv(){return Object.assign((e)=>e,{option:(e)=>F(e),result:(e)=>J(e),is:(e)=>!0})}var TN=v(()=>{Me();Bn()});var ON,PN,_N="~effect/ChildProcessSpawner/ChildProcessHandle",CZ,rv=(e)=>Object.setPrototypeOf({...e},CZ),RN=(e)=>{let t=(r,o)=>e(r).pipe(ae((s)=>YF(o?.includeStderr===!0?s.all:s.stdout)),ga),n=(r,o)=>XF(t(r,o));return Ll.of({spawn:e,exitCode:(r)=>ma(se(e(r),(o)=>o.exitCode)),streamString:t,streamLines:n,lines:(r,o)=>eM(n(r,o)),string:(r,o)=>tM(t(r,o))})},Ll;var ov=v(()=>{TN();rt();Re();pr();Cl();ON=nv(),PN=nv(),CZ={[_N]:_N,...HA,toJSON(){return{_id:"ChildProcessHandle",pid:this.pid}}};Ll=class Ll extends Ye()("effect/process/ChildProcessSpawner"){}});var FN="~effect/unstable/process/ChildProcess",vZ,_x=(e,t,n)=>Object.assign(Object.create(vZ),{_tag:"StandardCommand",command:e,args:t,options:n}),Ox=function(...t){if(MN(t[0])){let[s,...i]=t,a=DN(s,i);return _x(a[0]??"",a.slice(1),{})}if(typeof t[0]==="object"&&!Array.isArray(t[0])&&!MN(t[0])){let s=t[0];return function(i,...a){let c=DN(i,a);return _x(c[0]??"",c.slice(1),s)}}if(typeof t[0]==="string"&&!Array.isArray(t[1])){let[s,i={}]=t;return _x(s,[],i)}let[n,r=[],o={}]=t;return _x(n,r,o)},MN=(e)=>Array.isArray(e)&&("raw"in e)&&Array.isArray(e.raw),Px=(e)=>{let t=/^fd(\d+)$/.exec(e);if(t===null)return;let n=parseInt(t[1],10);return n>=3?n:void 0},LN=(e)=>`fd${e}`,DN=(e,t)=>{let n=[];for(let[r,o]of e.entries())n=IZ(e,t,n,o,r);return n},IZ=(e,t,n,r,o)=>{let s=e.raw[o];if(s===void 0)throw Error(`Invalid backslash sequence: ${e.raw[o]}`);let{hasLeadingWhitespace:i,hasTrailingWhitespace:a,tokens:c}=TZ(r,s),u=UN(n,c,i);if(o===t.length)return u;let l=t[o],f=Array.isArray(l)?l.map((d)=>NN(d)):[NN(l)];return UN(u,f,a)},NN=(e)=>{if(typeof e==="string")return e;return String(e)},$N,AZ,TZ=(e,t)=>{if(t.length===0)return{tokens:[],hasLeadingWhitespace:!1,hasTrailingWhitespace:!1};let n=$N.has(t[0]),r=[],o=0;for(let i=0,a=0;i<e.length;i+=1,a+=1){let c=t[a];if($N.has(c)){if(o!==i)r.push(e.slice(o,i));o=i+1}else if(c==="\\"){let u=t[a+1];if(u===`
|
|
33
|
-
`)i-=1,a+=1;else if(u==="u"&&t[a+2]==="{")a=t.indexOf("}",a+3);else a+=AZ[u]??1}}let s=o===e.length;if(!s)r.push(e.slice(o));return{tokens:r,hasLeadingWhitespace:n,hasTrailingWhitespace:s}},UN=(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)];var BN=v(()=>{rt();Fu();ov();vZ={...ss({label:"Command",evaluate(e){return Ro(e.context,Ll).spawn(this)}}),[FN]:FN},$N=new Set([" ","\t","\r",`
|
|
34
|
-
`]),AZ={x:3,u:5}});var HN=(e,t,n)=>{let r=e.detached??n!=="win32";return{...t,detached:r,shell:e.shell,windowsHide:e.windowsHide??!r}};var Je=(e,t)=>(n,[r])=>{let o="Unknown";switch(n.code){case"ENOENT":o="NotFound";break;case"EACCES":o="PermissionDenied";break;case"EEXIST":o="AlreadyExists";break;case"EISDIR":o="BadResource";break;case"ENOTDIR":o="BadResource";break;case"EBUSY":o="Busy";break;case"ELOOP":o="BadResource";break}return mo({_tag:o,module:e,method:t,pathOrDescriptor:r,syscall:n.syscall,cause:n})};var sv=v(()=>{ms()});var Bl=(e)=>Ok(Ak(OZ(e),(t)=>[t])),OZ=(e)=>jn((t)=>{let n=e.evaluate();return A(PZ({...e,writable:n,pull:t}))}),PZ=(e)=>e.pull.pipe(se((t)=>{let n=0;return Wn(function r(o){for(;n<t.length;)if(!e.writable.write(t[n++],e.encoding)){e.writable.once("drain",()=>r(o));return}o(Pe)})}),ds({disableYield:!0}),Ac(Wn((t)=>{let n=(r)=>t(R(e.onError(r)));return e.writable.once("error",n),we(()=>{e.writable.off("error",n)})})),e.endOnDone!==!1?zr((t)=>{if("closed"in e.writable&&e.writable.closed)return Vt(t);return Wn((n)=>{e.writable.once("finish",()=>n(Vt(t))),e.writable.end()})}):L);var iv=v(()=>{In();sp();Re();ne();kc();Wg()});var Hl=(e)=>Lo(FZ(e)),FZ=(e)=>jn((t,n)=>MZ({scope:n,readable:e.evaluate(),onError:e.onError??DZ,chunkSize:e.chunkSize,closeOnDone:e.closeOnDone})),MZ=(e)=>{let t=e.readable,n=e.closeOnDone??!0,r=e.exit??cF(void 0),o=sF(!1);function s(){o.openUnsafe()}function i(u){r.current=uo(e.onError(u)),o.openUnsafe()}function a(){r.current=uo(Id()),o.openUnsafe()}t.on("readable",s),t.once("error",i),t.once("end",a);let c=He(function u(){let l=e.readable.read(e.chunkSize);if(l===null){if(r.current)return r.current;if(t.readableEnded)return R(Id());return o.closeUnsafe(),se(o.await,u)}let f=uc(l);while(!0){if(l=e.readable.read(e.chunkSize),l===null)break;f.push(l)}return A(f)});return Kr(Od(e.scope,we(()=>{if(t.off("readable",s),t.off("error",i),t.off("end",a),n&&"closed"in e.readable&&!e.readable.closed)e.readable.destroy()})),c)},DZ=(e)=>new Ew(e);var av=v(()=>{nr();In();sp();Re();jr();iF();uF();Pd();Cl()});import*as Rx from"child_process";import{PassThrough as cv}from"stream";var Hc=(e)=>e instanceof globalThis.Error?e:new globalThis.Error(String(e)),Es=(e,t,n)=>{let{commands:r}=qN(n),o=r.reduce((s,i)=>{let a=`${i.command} ${i.args.join(" ")}`;return s.length===0?a:`${s} | ${a}`},"");return Je("ChildProcess",e)(t,[o])},WN=(e,t=()=>{})=>Rx.execFile("taskkill",["/pid",String(e.pid),"/T","/F"],{windowsHide:!0},t),$Z,jN,qN=(e)=>{let t=[],n=[],r=(a)=>{switch(a._tag){case"StandardCommand":{t.push(a);break}case"PipedCommand":{r(a.left),n.push(a.options),r(a.right);break}}};if(r(e),t.length===0)throw Error("flattenCommand produced empty commands array");let[o,...s]=t;return{commands:[o,...s],pipeOptions:n}};var zN=v(()=>{Cw();Re();jr();zg();cs();Vg();ge();Wg();Cl();BN();ov();sv();iv();av();$Z=un(function*(){let e=yield*xa,t=yield*hs,n=q(function*(x){if(Li(x.cwd))return;return yield*e.access(x.cwd),t.resolve(x.cwd)}),r=(x)=>x.extendEnv?{...globalThis.process.env,...x.env}:x.env,o=(x)=>Oc(x)?"pipe":x,s=(x)=>ip(x)?"pipe":x,i=(x)=>{let S={stream:"pipe",encoding:"utf-8",endOnDone:!0};if(Li(x.stdin))return S;if(typeof x.stdin==="string")return{...S,stream:x.stdin};if(Oc(x.stdin))return{...S,stream:x.stdin};return{stream:x.stdin.stream,encoding:x.stdin.encoding??S.encoding,endOnDone:x.stdin.endOnDone??S.endOnDone}},a=(x,S)=>{let C=x[S];if(Li(C))return{stream:"pipe"};if(typeof C==="string")return{stream:C};if(ip(C))return{stream:C};return{stream:C.stream}},c=(x)=>{if(Li(x.additionalFds))return[];let S=[];for(let[C,I]of Object.entries(x.additionalFds)){let _=Px(C);if(Ve(_))S.push({fd:_,config:I})}return S.sort((C,I)=>C.fd-I.fd)},u=(x,S,C,I)=>{let _=[o(x.stream),s(S.stream),s(C.stream)];if(I.length===0)return _;let M=I.reduce((U,{fd:N})=>Math.max(U,N),2);for(let U=3;U<=M;U++)_[U]="ignore";for(let{fd:U}of I)_[U]="pipe";return _},l=q(function*(x,S,C){if(C.length===0)return{getInputFd:()=>ap,getOutputFd:()=>kl};let I=new Map,_=new Map;for(let{config:M,fd:U}of C){let N=S.stdio[U];switch(M.type){case"input":{let Z=ap;if(N&&"write"in N)Z=Bl({evaluate:()=>N,onError:(G)=>Es(`fromWritable(fd${U})`,Hc(G),x)});if(M.stream)yield*yl(Nk(M.stream,Z));I.set(U,Z);break}case"output":{let Z=kl;if(N&&"read"in N){let G=new cv;N.on("error",(ye)=>G.destroy(ye)),N.pipe(G),Z=Hl({evaluate:()=>G,onError:(ye)=>Es(`fromReadable(fd${U})`,Hc(ye),x)})}if(M.sink)Z=jg(Z,M.sink);_.set(U,Z);break}}}return{getInputFd:(M)=>I.get(M)??ap,getOutputFd:(M)=>_.get(M)??kl}}),f=(x,S,C)=>He(()=>{let I=ap;if(Ff(S.stdin))I=Bl({evaluate:()=>S.stdin,onError:(_)=>Es("fromWritable(stdin)",Hc(_),x),endOnDone:C.endOnDone,encoding:C.encoding});if(Oc(C.stream))return Kr(yl(Nk(C.stream,I)),I);return A(I)}),d=(x,S,C,I)=>{let _=S.stdout?(()=>{let N=new cv;return S.stdout.on("error",(Z)=>N.destroy(Z)),S.stdout.pipe(N),Hl({evaluate:()=>N,onError:(Z)=>Es("fromReadable(stdout)",Hc(Z),x)})})():kl,M=S.stderr?(()=>{let N=new cv;return S.stderr.on("error",(Z)=>N.destroy(Z)),S.stderr.pipe(N),Hl({evaluate:()=>N,onError:(Z)=>Es("fromReadable(stderr)",Hc(Z),x)})})():kl;if(ip(C.stream))_=jg(_,C.stream);if(ip(I.stream))M=jg(M,I.stream);let U=ZF(_,M);return{stdout:_,stderr:M,all:U}},m=(x,S)=>Wn((C)=>{let I=sg(),_=Rx.spawn(x.command,x.args,S);return _.on("error",(M)=>{C(R(Es("spawn",M,x)))}),_.on("exit",(...M)=>{kw(I,co(M))}),_.on("spawn",()=>{C(A([_,I]))}),we(()=>{_.kill("SIGTERM")})}),y=(x,S,C)=>{if(globalThis.process.platform==="win32")return Wn((I)=>{WN(S,(_)=>{if(_)I(R(Es("kill",Hc(_),x)));else I(Pe)})});return Xt({try:()=>{globalThis.process.kill(-S.pid,C)},catch:(I)=>Es("kill",Hc(I),x)})},b=(x,S)=>{if(globalThis.process.platform==="win32"){WN(x);return}try{globalThis.process.kill(-x.pid,S)}catch{}},E=(x,S,C)=>He(()=>{if(!S.kill(C)){let _=new globalThis.Error("Failed to kill child process");return R(Es("kill",_,x))}return Pe}),w=(x,S,C)=>(I)=>{let _=C?.killSignal??"SIGTERM";return Li(C?.forceKillAfter)?I(S,x,_):fk(I(S,x,_),{duration:C.forceKillAfter,orElse:()=>I(S,x,"SIGKILL")})},k=(x,S)=>{let C=S??"stdout";switch(C){case"stdout":return x.stdout;case"stderr":return x.stderr;case"all":return x.all;default:{let I=Px(C);if(Ve(I))return x.getOutputFd(I);return x.stdout}}},g=q(function*(x){switch(x._tag){case"StandardCommand":{let S=i(x.options),C=a(x.options,"stdout"),I=a(x.options,"stderr"),_=c(x.options),M=!0,U=yield*n(x.options),N=r(x.options),Z=u(S,C,I,_),[G,ye]=yield*po(m(x,HN(x.options,{cwd:U,env:N,stdio:Z},process.platform)),q(function*([Io,bu]){let wu=yield*ww(bu),Tf=w(Io,x,x.options);if(wu){let[Ui]=yield*Ec(bu);if(Ui!==0&&Ff(Ui))return yield*zd(Tf(y));return yield*Pe}if(!M)return yield*Pe;return yield*Tf((Ui,OA,PA)=>y(Ui,OA,PA).pipe(lo(()=>E(Ui,OA,PA)),Vr(Ec(bu)))).pipe(zd)})),Wt=PN(G.pid);G.on("exit",(Io)=>{if(Io!==0&&Ff(Io))b(G,x.options.killSignal??"SIGTERM")});let $i=we(()=>{if(!M)G.ref(),M=!0}),Af=we(()=>{if(M)G.unref(),M=!1;return $i}),Um=yield*f(x,G,S),{all:Lm,stderr:VS,stdout:KS}=d(x,G,C,I),{getInputFd:Hz,getOutputFd:Wz}=yield*l(x,G,_),jz=ae(ww(ye),(Io)=>!Io),qz=se(Ec(ye),([Io,bu])=>{if(Ff(Io))return A(ON(Io));let wu=new globalThis.Error(`Process interrupted due to receipt of signal: '${bu}'`);return R(Es("exitCode",wu,x))});return rv({pid:Wt,exitCode:qz,isRunning:jz,kill:(Io)=>w(G,x,Io)((wu,Tf,Ui)=>y(wu,Tf,Ui).pipe(lo(()=>E(wu,Tf,Ui)),Vr(Ec(ye)))).pipe(jd),stdin:Um,stdout:KS,stderr:VS,all:Lm,getInputFd:Hz,getOutputFd:Wz,unref:Af})}case"PipedCommand":{let{commands:S,pipeOptions:C}=qN(x),[I,..._]=S,M=[yield*g(I)];for(let G=0;G<_.length;G++){let ye=_[G],Wt=C[G]??{},$i=i(ye.options),Af=ga(A(k(M[M.length-1],Wt.from))),Um=Wt.to??"stdin";if(Um==="stdin")M.push(yield*g(Ox(ye.command,ye.args,{...ye.options,stdin:{...$i,stream:Af}})));else{let Lm=Px(Um);if(Ve(Lm)){let VS=LN(Lm),KS=ye.options.additionalFds??{};M.push(yield*g(Ox(ye.command,ye.args,{...ye.options,additionalFds:{...KS,[VS]:{type:"input",stream:Af}}})))}else M.push(yield*g(Ox(ye.command,ye.args,{...ye.options,stdin:{...$i,stream:Af}})))}}let U=M[M.length-1],N=(G)=>vc([...M].reverse(),(ye)=>zd(ye.kill(G)),{discard:!0}),Z=un(function*(){let G=[];for(let ye of M)G.push(yield*ye.unref);return vc([...G].reverse(),(ye)=>ye,{discard:!0})});return rv({pid:U.pid,exitCode:U.exitCode,isRunning:U.isRunning,kill:N,stdin:U.stdin,stdout:U.stdout,stderr:U.stderr,all:U.all,getInputFd:U.getInputFd,getOutputFd:U.getOutputFd,unref:Z})}}});return RN(g)}),jN=il(Ll,$Z)});var VN=v(()=>{zN()});function KN(e=QN()){return e[6]=e[6]&15|64,e[8]=e[8]&63|128,e}function GN(e,t=QN()){let n=Math.min(Math.max(0,Math.trunc(e)),BZ);return t[0]=Math.floor(n/1099511627776),t[1]=Math.floor(n/4294967296)&255,t[2]=Math.floor(n/16777216)&255,t[3]=Math.floor(n/65536)&255,t[4]=Math.floor(n/256)&255,t[5]=n&255,t[6]=t[6]&15|112,t[8]=t[8]&63|128,t}var LZ=(e)=>e.toString(16).padStart(2,"0"),JN=(e)=>[e.subarray(0,4),e.subarray(4,6),e.subarray(6,8),e.subarray(8,10),e.subarray(10,16)].map((n)=>Array.from(n,LZ).join("")).join("-"),QN=()=>globalThis.crypto.getRandomValues(new Uint8Array(16)),ZN=(e)=>JN(e===void 0?KN():KN(e)),BZ=281474976710655,YN=(e,t)=>JN(t===void 0?GN(e):GN(e,t));var XN="~effect/platform/Crypto",uv,e$=(e)=>{let t=e.randomBytes,n=(i)=>ae(WZ("randomBytes",i),t),r=(i)=>(i[0]&31)*281474976710656+i[1]*1099511627776+i[2]*4294967296+i[3]*16777216+i[4]*65536+i[5]*256+i[6],o=()=>r(t(7))/9007199254740992,s=()=>{while(!0){let i=t(7),a=r(i);if((i[0]&32)===0)return a+Number.MIN_SAFE_INTEGER;if(a<Number.MAX_SAFE_INTEGER)return a+1}};return uv.of({[XN]:XN,randomBytes:n,nextDoubleUnsafe:o,nextIntUnsafe:s,digest:e.digest,random:we(()=>o()),randomBoolean:we(()=>o()>0.5),randomInt:we(()=>s()),randomBetween:(i,a)=>we(()=>o()*(a-i)+i),randomIntBetween(i,a,c){let u=c?.halfOpen===!0?0:1;return we(()=>{let l=Math.ceil(i),f=Math.floor(a);return Math.floor(o()*(f-l+u))+l})},randomShuffle:(i)=>we(()=>{let a=Array.from(i);for(let c=a.length-1;c>=1;c=c-1){let u=Math.min(c,Math.floor(o()*(c+1))),l=a[c];a[c]=a[u],a[u]=l}return a}),randomUUIDv4:we(()=>ZN(t(16))),randomUUIDv7:Qd((i)=>A(YN(i.currentTimeMillisUnsafe(),t(16))))})},WZ=(e,t)=>Number.isSafeInteger(t)&&t>=0?A(t):R(li({module:"Crypto",method:e,description:"size must be a non-negative safe integer"}));var t$=v(()=>{rt();Re();ms();uv=Ye("effect/Crypto")});import*as Fx from"crypto";var qZ=(e)=>{switch(e){case"SHA-1":return"sha1";case"SHA-256":return"sha256";case"SHA-384":return"sha384";case"SHA-512":return"sha512"}},zZ=(e,t)=>Xt({try:()=>Uint8Array.from(Fx.createHash(qZ(e)).update(t).digest()),catch:(n)=>mo({module:"Crypto",method:"digest",_tag:"Unknown",description:"Could not compute digest",cause:n})}),VZ,n$;var r$=v(()=>{t$();Re();cs();ms();VZ=e$({randomBytes:Fx.randomBytes,digest:zZ}),n$=la(uv,VZ)});var o$;var s$=v(()=>{r$();o$=n$});import*as i$ from"crypto";import*as re from"fs";import*as a$ from"os";import*as Wl from"path";var gt=(e)=>(t)=>li({module:"FileSystem",method:e,description:t.message??String(t)}),JZ,QZ,ZZ,YZ,XZ,e8,t8,n8,lv=(e)=>{let t=mt(re.mkdtemp,Je("FileSystem",e),gt(e));return(n)=>He(()=>{let r=n?.prefix??"",o=typeof n?.directory==="string"?Wl.join(n.directory,"."):a$.tmpdir();return t(r?Wl.join(o,r):o+"/")})},r8,fv=(e)=>{let t=mt(re.rm,Je("FileSystem",e),gt(e));return(n,r)=>t(n,{recursive:r?.recursive??!1,force:r?.force??!1})},o8,s8,i8=(e)=>{let t=mt(re.open,Je("FileSystem",e),gt(e)),n=mt(re.close,Je("FileSystem",e),gt(e));return(r,o)=>To(po(t(r,o?.flag??"r",o?.mode),(s)=>fo(n(s))),ae((s)=>c8(s,o?.flag?.startsWith("a")??!1)))},a8,c8,c$=(e)=>{let t=lv(e);return q(function*(n){let r=yield*t(n),o=i$.randomBytes(6).toString("hex"),s=Wl.join(r,n?.suffix?`${o}${n.suffix}`:o);return yield*l$(s,new Uint8Array(0)),s})},u8,l8,f8=(e,t)=>fl({try:()=>re.promises.readdir(e,t),catch:(n)=>Je("FileSystem","readDirectory")(n,[e])}),d8=(e)=>Wn((t,n)=>{try{re.readFile(e,{signal:n},(r,o)=>{if(r)t(R(Je("FileSystem","readFile")(r,[e])));else t(A(o))})}catch(r){t(R(gt("readFile")(r)))}}),p8,m8,h8,u$=(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:er(e.mtime),atime:er(e.atime),birthtime:er(e.birthtime),dev:e.dev,rdev:er(e.rdev),ino:er(e.ino),mode:e.mode,nlink:er(e.nlink),uid:er(e.uid),gid:er(e.gid),size:hi(e.size),blksize:e.blksize!==void 0?F(hi(e.blksize)):P(),blocks:er(e.blocks)}),dv,g8,x8,y8,S8=(e,t)=>JF((n)=>po(we(()=>{let r=re.watch(e,{recursive:t?.recursive??!1},(o,s)=>{if(!s)return;switch(o){case"rename":{ps(kg(dv(s),{onSuccess:(i)=>ep(n,{_tag:"Create",path:s}),onFailure:(i)=>ep(n,{_tag:"Remove",path:s})}));return}case"change":{tp(n,{_tag:"Update",path:s});return}}});return r.on("error",(o)=>{rp(n,yw(mo({module:"FileSystem",_tag:"Unknown",method:"watch",pathOrDescriptor:e,cause:o})))}),r.on("close",()=>{pi(n)}),r}),(r)=>we(()=>r.close()))),E8=(e,t,n)=>dv(t).pipe(ae((r)=>e.pipe(Vs((o)=>o.register(t,r,n)),It(()=>S8(t,n)))),ga),l$=(e,t,n)=>Wn((r,o)=>{try{re.writeFile(e,t,{signal:o,flag:n?.flag,mode:n?.mode},(s)=>{if(s)r(R(Je("FileSystem","writeFile")(s,[e])));else r(Pe)})}catch(s){r(R(gt("writeFile")(s)))}}),b8,f$;var d$=v(()=>{In();Re();Re();zg();ne();cs();Me();ms();op();Cl();sv();JZ=(()=>{let e=mt(re.access,Je("FileSystem","access"),gt("access"));return(t,n)=>{let r=re.constants.F_OK;if(n?.readable)r|=re.constants.R_OK;if(n?.writable)r|=re.constants.W_OK;return e(t,r)}})(),QZ=(()=>{let e=mt(re.cp,Je("FileSystem","copy"),gt("copy"));return(t,n,r)=>e(t,n,{force:r?.overwrite??!1,preserveTimestamps:r?.preserveTimestamps??!1,recursive:!0})})(),ZZ=(()=>{let e=mt(re.copyFile,Je("FileSystem","copyFile"),gt("copyFile"));return(t,n)=>e(t,n)})(),YZ=(()=>{let e=mt(re.chmod,Je("FileSystem","chmod"),gt("chmod"));return(t,n)=>e(t,n)})(),XZ=(()=>{let e=mt(re.chown,Je("FileSystem","chown"),gt("chown"));return(t,n,r)=>e(t,n,r)})(),e8=(()=>{let e=mt(re.glob,Je("FileSystem","glob"),gt("glob"));return(t,n)=>e(t,{cwd:n?.root,exclude:n?.exclude})})(),t8=(()=>{let e=mt(re.link,Je("FileSystem","link"),gt("link"));return(t,n)=>e(t,n)})(),n8=(()=>{let e=mt(re.mkdir,Je("FileSystem","makeDirectory"),gt("makeDirectory"));return(t,n)=>e(t,{recursive:n?.recursive??!1,mode:n?.mode})})(),r8=lv("makeTempDirectory"),o8=fv("remove"),s8=(()=>{let e=lv("makeTempDirectoryScoped"),t=fv("makeTempDirectoryScoped");return(n)=>po(e(n),(r)=>fo(t(r,{recursive:!0})))})(),a8=i8("open"),c8=(()=>{let e=(l)=>mt(re.read,Je("FileSystem",l),gt(l)),t=e("read"),n=e("readAlloc"),r=mt(re.fstat,Je("FileSystem","stat"),gt("stat")),o=mt(re.ftruncate,Je("FileSystem","truncate"),gt("truncate")),s=mt(re.fsync,Je("FileSystem","sync"),gt("sync")),i=(l)=>mt(re.write,Je("FileSystem",l),gt(l)),a=i("write"),c=i("writeAll");class u{[qg];fd;append;position=BigInt(0);constructor(l,f){this[qg]=qg,this.fd=l,this.append=f}get stat(){return ae(r(this.fd),u$)}get sync(){return s(this.fd)}seek(l,f){let d=hi(l);return we(()=>{if(f==="start")this.position=d;else if(f==="current")this.position=this.position+d;return hi(this.position)})}read(l){return He(()=>{let f=this.position;return ae(t(this.fd,{buffer:l,position:f}),(d)=>{let m=hi(d);return this.position=f+m,m})})}readAlloc(l){let f=Number(l);return He(()=>{let d=Buffer.allocUnsafeSlow(f),m=this.position;return ae(n(this.fd,{buffer:d,position:m}),(y)=>{if(y===0)return P();if(this.position=m+BigInt(y),y===f)return F(d);let b=Buffer.allocUnsafeSlow(y);return d.copy(b,0,0,y),F(b)})})}truncate(l){return ae(o(this.fd,l?Number(l):void 0),()=>{if(!this.append){let f=BigInt(l??0);if(this.position>f)this.position=f}})}write(l){return He(()=>{let f=this.position;return ae(a(this.fd,l,void 0,void 0,this.append?void 0:Number(f)),(d)=>{let m=hi(d);if(!this.append)this.position=f+m;return m})})}writeAllChunk(l){return He(()=>{let f=this.position;return se(c(this.fd,l,void 0,void 0,this.append?void 0:Number(f)),(d)=>{if(d===0)return R(mo({module:"FileSystem",method:"writeAll",_tag:"WriteZero",pathOrDescriptor:this.fd,description:"write returned 0 bytes written"}));if(!this.append)this.position=f+BigInt(d);return d<l.length?this.writeAllChunk(l.subarray(d)):Pe})})}writeAll(l){return this.writeAllChunk(l)}}return(l,f)=>new u(l,f)})(),u8=c$("makeTempFile"),l8=(()=>{let e=c$("makeTempFileScoped"),t=fv("makeTempFileScoped");return(n)=>po(e(n),(r)=>fo(t(Wl.dirname(r),{recursive:!0})))})(),p8=(()=>{let e=mt(re.readlink,Je("FileSystem","readLink"),gt("readLink"));return(t)=>e(t)})(),m8=(()=>{let e=mt(re.realpath,Je("FileSystem","realPath"),gt("realPath"));return(t)=>e(t)})(),h8=(()=>{let e=mt(re.rename,Je("FileSystem","rename"),gt("rename"));return(t,n)=>e(t,n)})(),dv=(()=>{let e=mt(re.stat,Je("FileSystem","stat"),gt("stat"));return(t)=>ae(e(t),u$)})(),g8=(()=>{let e=mt(re.symlink,Je("FileSystem","symlink"),gt("symlink"));return(t,n)=>e(t,n)})(),x8=(()=>{let e=mt(re.truncate,Je("FileSystem","truncate"),gt("truncate"));return(t,n)=>e(t,n!==void 0?Number(n):void 0)})(),y8=(()=>{let e=mt(re.utimes,Je("FileSystem","utime"),gt("utime"));return(t,n,r)=>e(t,n,r)})(),b8=ae(vg($k),(e)=>rM({access:JZ,chmod:YZ,chown:XZ,copy:QZ,copyFile:ZZ,glob:e8,link:t8,makeDirectory:n8,makeTempDirectory:r8,makeTempDirectoryScoped:s8,makeTempFile:u8,makeTempFileScoped:l8,open:a8,readDirectory:f8,readFile:d8,readLink:p8,realPath:m8,remove:o8,rename:h8,stat:dv,symlink:g8,truncate:x8,utimes:y8,watch(t,n){return E8(e,t,n)},writeFile:l$})),f$=il(xa)(b8)});var p$;var m$=v(()=>{d$();p$=f$});import*as Op from"path";import*as Mx from"url";var pv=(e)=>({fromFileUrl:(t)=>Xt({try:()=>Mx.fileURLToPath(t,{windows:e}),catch:(n)=>new ui({module:"Path",method:"fromFileUrl",cause:n})}),toFileUrl:(t)=>Xt({try:()=>Mx.pathToFileURL(t,{windows:e}),catch:(n)=>new ui({module:"Path",method:"toFileUrl",cause:n})})}),C8,v8,h$;var g$=v(()=>{Re();cs();Vg();ms();C8=la(hs)({[gi]:gi,...Op.posix,...pv(!1)}),v8=la(hs)({[gi]:gi,...Op.win32,...pv(!0)}),h$=la(hs)({[gi]:gi,...Op,...pv(void 0)})});var x$;var y$=v(()=>{g$();x$=h$});var mv="~effect/Stdio",Dx,S$=(e)=>({[mv]:mv,stdinIsTerminal:A(!1),stdoutIsTerminal:A(!1),...e});var hv=v(()=>{rt();Re();Dx=Ye(mv)});var b$;var w$=v(()=>{Re();cs();ms();hv();iv();av();b$=la(Dx,S$({args:we(()=>process.argv.slice(2)),stdinIsTerminal:we(()=>process.stdin.isTTY===!0),stdoutIsTerminal:we(()=>process.stdout.isTTY===!0),stdout:(e)=>Bl({evaluate:()=>process.stdout,onError:(t)=>mo({module:"Stdio",method:"stdout",_tag:"Unknown",cause:t}),endOnDone:e?.endOnDone??!1}),stderr:(e)=>Bl({evaluate:()=>process.stderr,onError:(t)=>mo({module:"Stdio",method:"stderr",_tag:"Unknown",cause:t}),endOnDone:e?.endOnDone??!1}),stdin:Hl({evaluate:()=>process.stdin,onError:(e)=>mo({module:"Stdio",method:"stdin",_tag:"Unknown",cause:e}),closeOnDone:!1})}))});var k$;var C$=v(()=>{w$();k$=b$});var Nx="~effect/collections/Graph",gv=(e)=>e,O8=(e,t,n)=>(e==="directed"?t.source===n.source&&t.target===n.target:t.source===n.source&&t.target===n.target||t.source===n.target&&t.target===n.source)&&ee(t.data,n.data),P8=(e,t)=>e==="directed"?ie(t):Bi(ie(t.data)^ie(t.source)+ie(t.target)),R8,v$=(e,t)=>{let n=Object.create(R8);return n.type=e,n.mutable=t,n.transforming=!1,n.nodes=new Map,n.edges=new Map,n.adjacency=new Map,n.reverseAdjacency=new Map,n.nextNodeIndex=0,n.nextEdgeIndex=0,n.acyclic=F(!0),n},Pp=(e)=>{let t=gv(e);return{type:e.type,nodes:Array.from(t.nodes,([n,r])=>({index:n,data:r})).sort((n,r)=>n.index-r.index),edges:Array.from(t.edges,([n,r])=>({index:n,source:r.source,target:r.target,data:r.data})).sort((n,r)=>n.index-r.index)}},Rp=(e)=>{let t=v$(e.type,!1);for(let n of e.nodes)t.nodes.set(n.index,n.data),t.adjacency.set(n.index,[]),t.reverseAdjacency.set(n.index,[]);for(let n of e.edges)if(t.edges.set(n.index,{source:n.source,target:n.target,data:n.data}),t.adjacency.get(n.source).push(n.index),t.reverseAdjacency.get(n.target).push(n.index),e.type==="undirected")t.adjacency.get(n.target).push(n.index),t.reverseAdjacency.get(n.source).push(n.index);return t.nextNodeIndex=e.nodes.length===0?0:e.nodes[e.nodes.length-1].index+1,t.nextEdgeIndex=e.edges.length===0?0:e.edges[e.edges.length-1].index+1,t.acyclic=P(),t};var xv=v(()=>{Pt();wn();pr();Me();ct();ge();R8={[Nx]:{_N:(e)=>e,_E:(e)=>e},[Symbol.iterator](){return this.nodes[Symbol.iterator]()},[zt](){return this.toJSON()},[Oe](e){if(D(e,Nx)){let t=gv(e);if(this.nodes.size!==t.nodes.size||this.edges.size!==t.edges.size||this.type!==t.type)return!1;for(let[n,r]of this.nodes)if(!t.nodes.has(n)||!ee(r,t.nodes.get(n)))return!1;for(let[n,r]of this.edges){let o=t.edges.get(n);if(o===void 0||!O8(this.type,r,o))return!1}return!0}return!1},[_e](){let e=Ze("Graph");e=e^Ze(this.type),e=e^dr(this.nodes.size),e=e^dr(this.edges.size);for(let[t,n]of this.nodes)e=e^ie(t)+ie(n);for(let[t,n]of this.edges)e=e^ie(t)+P8(this.type,n);return e},toJSON(){return{_id:"Graph",nodeCount:this.nodes.size,edgeCount:this.edges.size,type:this.type}},toString(){return`Graph(${this.type}, ${this.nodes.size}, ${this.edges.size})`},pipe(){return fe(this,arguments)}}});var F8,yv=(e)=>D(e,F8),A$,M8;var T$=v(()=>{Pt();wn();xv();ge();F8=Nx;A$=class A${type;source;target;identity;constructor(e,t,n,r){this.type=e,this.source=t,this.target=n,this.identity=r}[Oe](e){if(!(e instanceof A$)||this.type!==e.type||!ee(this.identity,e.identity))return!1;if(this.type==="directed")return ee(this.source,e.source)&&ee(this.target,e.target);return ee(this.source,e.source)&&ee(this.target,e.target)||ee(this.source,e.target)&&ee(this.target,e.source)}[_e](){let e=ie(this.identity);return this.type==="directed"?Ot(ie(this.target))(Ot(ie(this.source))(e)):Bi(e^ie(this.source)+ie(this.target))}};M8=class M8{[Symbol.iterator];visit;constructor(e){this.visit=e,this[Symbol.iterator]=()=>e((t,n)=>[t,n])[Symbol.iterator]()}}});function O$(e,t,n,r,o,s){if(t>32)throw Error("HashMap: max depth exceeded");let i=Aa(n,t),a=Aa(o,t);if(i===a){let l=O$(e,t+Ko,n,r,o,s);return new bs(e,i,[l])}let c=i|a,u=i>>>0<a>>>0?[r,s]:[s,r];return new bs(e,c,u)}class jl{canEdit(e){return this.edit===e}}var Ux="~effect/collections/HashMap",Ko=5,Np,N8,_$,$8,U8=(e)=>(e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24),Fp=(e,t)=>e>>>t&$8,Aa=(e,t)=>1<<Fp(e,t),$x=(e,t)=>U8(e&t-1),P$,wi,Mp,bs,Dp,Lx,R$,Sv=(e)=>D(e,Ux),Ev=()=>new Lx(!1,0,R$,0),F$=(e)=>{let t=R$,n=0,r={value:!1};for(let[o,s]of e){let i=ie(o);if(r.value=!1,t=t.set(NaN,0,i,o,s,r),r.value)n++}return new Lx(!1,0,t,n)},M$,bv,L8=(e,t,n,r)=>{let o=e,s={value:!1},i=o._editable?o._edit:NaN,a=o._root.set(i,0,n,t,r,s);if(o._editable){if(o._root=a,s.value)o._size++;return e}if(o._root===a)return e;return new Lx(!1,o._edit,a,o._size+(s.value?1:0))},wv,kv=(e)=>{let t=e[Symbol.iterator]();return{[Symbol.iterator](){return this},next(){let n=t.next();if(n.done)return{done:!0,value:void 0};return{done:!1,value:n.value[0]}}}},D$=(e)=>{let t=e[Symbol.iterator]();return{[Symbol.iterator](){return this},next(){return t.next()}}},Bx=(e)=>e.size;var Cv=v(()=>{Pt();Zn();ne();wn();pr();Me();ct();ge();Np=1<<Ko,N8=Np/4,_$=Np/2,$8=Np-1;P$=class P$ extends jl{_tag="EmptyNode";edit=0;get size(){return 0}get(e,t,n){return P()}has(e,t,n){return!1}set(e,t,n,r,o,s){return s.value=!0,new wi(e,n,r,o)}remove(e,t,n,r,o){return this}iterator(){return[][Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}canEdit(e){return!1}};wi=class wi extends jl{_tag="LeafNode";edit;hash;key;value;constructor(e,t,n,r){super();this.edit=e,this.hash=t,this.key=n,this.value=r}get size(){return 1}get(e,t,n){if(this.hash===t&&ee(this.key,n))return F(this.value);return P()}has(e,t,n){return this.hash===t&&ee(this.key,n)}set(e,t,n,r,o,s){if(this.hash===n&&ee(this.key,r)){if(ee(this.value,o))return this;if(this.canEdit(e))return this.value=o,this;return new wi(e,n,r,o)}if(s.value=!0,this.hash===n)return new Mp(e,n,[[this.key,this.value],[r,o]]);let i=Aa(n,t),a=Aa(this.hash,t);if(i===a)return new bs(e,i,[this.set(e,t+Ko,n,r,o,s)]);let c=i|a,u=i>>>0<a>>>0?[new wi(e,n,r,o),this]:[this,new wi(e,n,r,o)];return new bs(e,c,u)}remove(e,t,n,r,o){if(this.hash===n&&ee(this.key,r)){o.value=!0;return}return this}iterator(){return[[this.key,this.value]][Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}};Mp=class Mp extends jl{_tag="CollisionNode";edit;hash;entries;constructor(e,t,n){super();this.edit=e,this.hash=t,this.entries=n}get size(){return this.entries.length}get(e,t,n){if(this.hash!==t)return P();for(let[r,o]of this.entries)if(ee(r,n))return F(o);return P()}has(e,t,n){if(this.hash!==t)return!1;for(let[r]of this.entries)if(ee(r,n))return!0;return!1}set(e,t,n,r,o,s){if(this.hash!==n)return s.value=!0,O$(e,t,this.hash,this,n,new wi(e,n,r,o));for(let i=0;i<this.entries.length;i++)if(ee(this.entries[i][0],r)){if(ee(this.entries[i][1],o))return this;if(this.canEdit(e))return this.entries[i]=[r,o],this;let a=[...this.entries];return a[i]=[r,o],new Mp(e,this.hash,a)}if(s.value=!0,this.canEdit(e))return this.entries.push([r,o]),this;return new Mp(e,this.hash,[...this.entries,[r,o]])}remove(e,t,n,r,o){if(this.hash!==n)return this;let s=this.entries.findIndex(([a])=>ee(a,r));if(s===-1)return this;if(o.value=!0,this.entries.length===1)return;if(this.entries.length===2){let a=this.entries[s===0?1:0];return new wi(e,this.hash,a[0],a[1])}if(this.canEdit(e))return this.entries.splice(s,1),this;let i=[...this.entries];return i.splice(s,1),new Mp(e,this.hash,i)}iterator(){return this.entries[Symbol.iterator]()}[Symbol.iterator](){return this.iterator()}};bs=class bs extends jl{_tag="IndexedNode";edit;_size;bitmap;children;constructor(e,t,n){super();this.edit=e,this.bitmap=t,this.children=n}get size(){if(this._size===void 0)this._size=this.children.reduce((e,t)=>e+t.size,0);return this._size}get(e,t,n){let r=Aa(t,e);if((this.bitmap&r)===0)return P();let o=$x(this.bitmap,r);return this.children[o].get(e+Ko,t,n)}has(e,t,n){let r=Aa(t,e);if((this.bitmap&r)===0)return!1;let o=$x(this.bitmap,r);return this.children[o].has(e+Ko,t,n)}set(e,t,n,r,o,s){let i=Aa(n,t),a=$x(this.bitmap,i);if((this.bitmap&i)!==0){let c=this.children[a],u=c.set(e,t+Ko,n,r,o,s);if(c===u)return this;if(this.canEdit(e))return this.children[a]=u,this;let l=[...this.children];return l[a]=u,new bs(e,this.bitmap,l)}else{s.value=!0;let c=new wi(e,n,r,o),u=this.bitmap|i;if(this.canEdit(e)){if(this.children.splice(a,0,c),this.bitmap=u,this._size=void 0,this.children.length>_$)return this.expand(e,u,this.children);return this}let l=[...this.children];if(l.splice(a,0,c),l.length>_$)return this.expand(e,u,l);return new bs(e,u,l)}}remove(e,t,n,r,o){let s=Aa(n,t);if((this.bitmap&s)===0)return this;let i=$x(this.bitmap,s),a=this.children[i],c=a.remove(e,t+Ko,n,r,o);if(!o.value)return this;if(c===void 0){let l=this.bitmap^s;if(l===0)return;if(this.children.length===2){let d=this.children[i===0?1:0];if(d._tag==="LeafNode")return d}if(this.canEdit(e))return this.children.splice(i,1),this.bitmap=l,this._size=void 0,this;let f=[...this.children];return f.splice(i,1),new bs(e,l,f)}if(a===c)return this;if(this.canEdit(e))return this.children[i]=c,this;let u=[...this.children];return u[i]=c,new bs(e,this.bitmap,u)}expand(e,t,n){let r=new globalThis.Array(Np),o=0;for(let s=0;s<Np;s++)if((t&1<<s)!==0)r[s]=n[o++];return new Dp(e,n.length,r)}iterator(){let e=0,t;return{next:()=>{while(e<this.children.length){if(!t)t=this.children[e].iterator();let n=t.next();if(!n.done)return n;t=void 0,e++}return{done:!0,value:void 0}}}}[Symbol.iterator](){return this.iterator()}};Dp=class Dp extends jl{_tag="ArrayNode";edit;_size;count;children;constructor(e,t,n){super();this.edit=e,this.count=t,this.children=n}get size(){if(this._size===void 0)this._size=this.children.reduce((e,t)=>e+(t?.size??0),0);return this._size}get(e,t,n){let r=Fp(t,e),o=this.children[r];return o?o.get(e+Ko,t,n):P()}has(e,t,n){let r=Fp(t,e),o=this.children[r];return o?o.has(e+Ko,t,n):!1}set(e,t,n,r,o,s){let i=Fp(n,t),a=this.children[i];if(a){let c=a.set(e,t+Ko,n,r,o,s);if(a===c)return this;if(this.canEdit(e))return this.children[i]=c,this;let u=[...this.children];return u[i]=c,new Dp(e,this.count,u)}else{s.value=!0;let c=new wi(e,n,r,o);if(this.canEdit(e))return this.children[i]=c,this.count++,this._size=void 0,this;let u=[...this.children];return u[i]=c,new Dp(e,this.count+1,u)}}remove(e,t,n,r,o){let s=Fp(n,t),i=this.children[s];if(!i)return this;let a=i.remove(e,t+Ko,n,r,o);if(!o.value)return this;let c=this.count-(a?0:1);if(c<N8)return this.pack(e,s,a);if(i===a)return this;if(this.canEdit(e)){if(this.children[s]=a,!a)this.count=c;return this._size=void 0,this}let u=[...this.children];return u[s]=a,new Dp(e,c,u)}pack(e,t,n){let r=[],o=0,s=1;for(let i=0;i<this.children.length;i++){let a=i===t?n:this.children[i];if(a)r.push(a),o|=s;s<<=1}return new bs(e,o,r)}iterator(){let e=0,t;return{next:()=>{while(e<this.children.length){let n=this.children[e];if(!n){e++;continue}if(!t)t=n.iterator();let r=t.next();if(!r.done)return r;t=void 0,e++}return{done:!0,value:void 0}}}}[Symbol.iterator](){return this.iterator()}};Lx=class Lx{[Ux]=Ux;_editable;_edit;_root;_size;constructor(e,t,n,r){this._editable=e,this._edit=t,this._root=n,this._size=r}get size(){return this._size}[Symbol.iterator](){return this._root.iterator()}[Oe](e){if(Sv(e)){let t=e;if(this.size!==t.size)return!1;for(let[n,r]of this){let o=To(e,M$(n));if(he(o)||!ee(r,o.value))return!1}return!0}return!1}[_e](){let e=Ze("HashMap");for(let[t,n]of this)e=e^ie(t)+ie(n);return e}[zt](){return fn(this)}toString(){return`HashMap(${j(Array.from(this))})`}toJSON(){return{_id:"HashMap",values:Array.from(this).map(([e,t])=>[fn(e),fn(t)])}}pipe(){return fe(this,arguments)}};R$=new P$,M$=p(2,(e,t)=>e._root.get(0,ie(t),t)),bv=p(2,(e,t)=>e._root.has(0,ie(t),t)),wv=p(3,(e,t,n)=>L8(e,t,ie(t),n))});var $$,Hx,W8,Wx=(e)=>Array.from(W8(e)),U$;var L$=v(()=>{Cv();$$=Sv,Hx=F$,W8=D$,U$=Bx});var $p="~effect/collections/HashSet",q8,z8=(e)=>{let t=Object.create(q8);return t[$p]=$p,t.keyMap=e,t},vv=(e)=>D(e,$p),Iv=(e)=>e.keyMap,B$=(e)=>{let t=Ev();for(let n of e)t=wv(t,n,!0);return z8(t)},H$=(e,t)=>bv(Iv(e),t),jx=(e)=>Bx(Iv(e)),W$=(e,t)=>{for(let n of e)if(!t(n))return!1;return!0};var j$=v(()=>{Pt();Zn();wn();pr();ct();ge();Cv();q8={[_e](){return ie($p)},[Oe](e){return vv(e)&&jx(this)===jx(e)&&W$(this,(t)=>H$(e,t))},[Symbol.iterator](){return kv(Iv(this))},toString(){return`HashSet(${j(Array.from(this))})`},toJSON(){return{_id:"HashSet",values:fn(Array.from(this))}},[zt](){return this.toJSON()},pipe(){return fe(this,arguments)}}});var qx,q$,z$;var V$=v(()=>{j$();qx=B$,q$=vv,z$=jx});function zx(e){let t=oU(Kx,Tn(e.ast));return(n,r)=>t(n,r?.disableChecks?r?.parseOptions?{...r.parseOptions,disableChecks:!0}:{disableChecks:!0}:r?.parseOptions)}function Vx(e){let t=zx(e);return(n,r)=>{let o=ha(t(n,r));if(Kt(o))return F(o.value);return xi(o.cause,"Option adapter can only return none for schema issues"),P()}}function G$(e){let t=zx(e);return(n,r)=>{let o=ha(t(n,r));if(Kt(o))return o.value;let s=xi(o.cause,"Constructor adapter can only throw schema issues");throw Error("Schema validation failed",{cause:s})}}function J$(e){return Lp(e.ast)}function Lp(e){let t=Wc(Bp(Tn(e)));return(n)=>{let r=t(n,$c);if(Kt(r))return!0;return xi(r.cause,"Type guard adapter can only return false for schema issues"),!1}}function Q$(e){let t=Bp(e);return(n,r)=>{let o=ha(t(n,r));if(Kt(o))return;return xi(o.cause,"Issue adapter can only return schema issues")}}function Z$(e,t){let r=Wc(Bp(Tn(e.ast)))(t,$c);if(ol(r)){let o=xi(r.cause,"Assertion adapter can only throw schema issues");throw Error("Schema validation failed",{cause:o})}}function Nt(e,t){let n=Bp(e.ast);return t===void 0?n:(r,o)=>n(r,Up(t,o))}function Y$(e,t){return Wc(Nt(e,t))}function Tv(e,t){return sU(Nt(e,t))}function eU(e,t){return iU(Nt(e,t))}function G8(e,t){return aU(Nt(e,t))}function ql(e,t){let n=Bp(Wo(e.ast));return t===void 0?n:(r,o)=>n(r,Up(t,o))}function tU(e,t){return Wc(ql(e,t))}function Ov(e,t){return sU(ql(e,t))}function rU(e,t){return iU(ql(e,t))}function J8(e,t){return aU(ql(e,t))}function Bp(e){return oU(cU,e)}function oU(e,t){let n;return(r,o)=>{let s=(n??=e(t))(r,o??$c);if(s===en)return A(r);if(!Xe(s))return An(s,K$);return s[ce]===De?K$(De):s}}function Wc(e){return(t,n)=>ha(e(t,n))}function sU(e){let t=Wc(e);return(n,r)=>{let o=t(n,r);if(Kt(o))return F(o.value);return xi(o.cause,"Option adapter can only return none for schema issues"),P()}}function iU(e){let t=Wc(e);return(n,r)=>{let o=t(n,r);if(Kt(o))return J(o.value);return oe(xi(o.cause,"Result adapter can only return schema issues"))}}function aU(e){let t=Wc(e);return(n,r)=>{let o=t(n,r);if(Kt(o))return o.value;let s=xi(o.cause,"Sync adapter can only throw schema issues");throw Error("Schema validation failed",{cause:s})}}function uU(e){return e.context?.constructorDefault?Q8(e):Kx(e)}function lU(e,t,n,r){let o;if(Xe(e)&&e._tag==="Success"){let s=Gg(e===en?t:e[ce]);o=n._tag==="Transformation"?n.decode.run(s,r):n.decode(ho(s),r)}else if(n._tag==="Transformation")o=An(e,(s)=>n.decode.run(Gg(s),r));else o=n.decode(ci(e,Gg),r);return Xe(o)&&o._tag==="Success"?Wk(o[ce]):An(o,Wk)}function Z8(e,t){let n;return(r,o)=>{if(r===De)return Bo;if(e.isConstructed(r))return en;let s=(n??=t(e.link.to))(r,o);return lU(s,r,e.link.transformation,o)}}function Rv(e,t,n,r){let o=n?CN(e):void 0,s=o?Z8(o,t):e.getParser(t,n),i=e.checks,a=r?e.encoding?[...e.encoding,r]:[r]:e.encoding,c=e.encodingChecks,u=(i?i[i.length-1].annotations:e.annotations)?.parseOptions;if(!a&&!i&&!c){if(!u)return s;return(d,m)=>s(d,Up(m,u))}let l,f=(d,m)=>{let y=s(d,m);if(c&&!m.disableChecks)if(Xe(y)){if(y._tag==="Success"){let b=y===en?d:y[ce];if(d!==De&&b!==De){let E=Vo(c,d,void 0,e,m);if(E)y=R(new Ft(e,E,d,m))}}}else y=se(y,(b)=>{if(d!==De&&b!==De){let E=Vo(c,d,void 0,e,m);if(E)return R(new Ft(e,E,d,m))}return A(b)});if(i&&!m.disableChecks)if(Xe(y)){if(y._tag==="Success"){let b=y===en?d:y[ce];if(b===De)return y;let E=Vo(i,b,void 0,e,m);if(E)y=R(new Ft(e,E,b,m))}}else y=se(y,(b)=>{if(b!==De){let E=Vo(i,b,void 0,e,m);if(E)return R(new Ft(e,E,b,m))}return A(b)});return y};if(!a)return u?(d,m)=>f(d,Up(m,u)):f;return(d,m)=>{if(u)m=Up(m,u);let y=l??=a.map((w)=>t(w.to)),b=d,E=y[y.length-1](d,m);for(let w=a.length-1;w>=0;w--)if(E=lU(E,b,a[w].transformation,m),w!==0){let k=y[w-1];if(E._tag==="Success")b=E[ce],E=k(b,m);else E=An(E,(g)=>{let x=k(g,m);return x===en?ho(g):x})}if(E._tag==="Success"){let w=E[ce],k=f(w,m);return k===en?E:k}return E=Gr(E,(w)=>fa(()=>ri(w,(k)=>new Kk(e,k,d,m)))),An(E,(w)=>{let k=f(w,m);return k===en?ho(w):k})}}var Av,X$,_v,nU,Pv,Up=(e,t)=>t?{...e,...t}:e,K$=(e)=>{if(e===De)return R(new Ie);return A(e)},cU,Kx,Q8;var Gx=v(()=>{In();Re();jr();ne();At();Zk();Jg();Me();Bn();bi();Ea();Av=Nt;X$=Tv;_v=G8;nU=Ov;Pv=J8;cU=bn((e)=>Rv(e,cU)),Kx=bn((e)=>Rv(e,Kx,uU)),Q8=bn((e)=>Rv(e,Kx,uU,e.context?.constructorDefault))});function ar(e,t,n){return{id:e,payloadSchema:t,revive:n}}function xe(e,t,n){return{id:e,payloadSchema:t,revive:n}}function Hp(e,t){function n(){}let r=Object.defineProperties(Object.setPrototypeOf(n,Y8),Object.getOwnPropertyDescriptors({...t}));return r.ast=e,r.rebuild=(o)=>Hp(o,t),r.makeEffect=zx(r),r.make=G$(r),r.makeOption=Vx(r),r}var Jx="~effect/Schema/Schema",Y8;var fU=v(()=>{ct();bi();Gx();Y8={[Jx]:Jx,pipe(){return fe(this,arguments)},annotate(e){return this.rebuild(xo(this.ast,e))},annotateKey(e){return this.rebuild(_p(this.ast,e))},check(...e){return this.rebuild(Ss(this.ast,e))}}});var dxe,dU;var pU=v(()=>{dxe=globalThis.Boolean,dU=oo((e,t)=>e||t,!1)});function Dv(e,t){let n={};for(let r of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;let o=t(r,e[r]);if(o){let[s,i]=o;H(n,s,i)}}return n}function xU(e,t){let n=t?.omitKeyWhen??(()=>!1);return nh((r,o)=>{let s=Reflect.ownKeys(e),i={};for(let a of s){let c=e[a].combine(r[a],o[a]);if(n(c))continue;H(i,a,c)}return i})}var mU,hU,gU,Mv,qn=(e)=>e;var Qx=v(()=>{ne();mU=p(2,(e,t)=>Dv(e,(n,r)=>t.includes(n)?[n,r]:void 0)),hU=p(2,(e,t)=>Dv(e,(n,r)=>!t.includes(n)?[n,r]:void 0)),gU=p(2,(e,t)=>({...e,...t})),Mv=p(2,(e,t)=>Dv(e,(n,r)=>[Object.hasOwn(t,n)?t[n]:n,r]))});function Wp(e){return oo((t,n)=>{if(t===void 0)return n;if(n===void 0)return t;return e.combine(t,n)},void 0)}var yU=()=>{};function ws(e,t){if(t.length>0)e+=`
|
|
35
|
-
at ${Qm(t)}`;return Error(e)}var $v=v(()=>{Zn()});function ki(e){return Error(`Unable to derive an arbitrary for ${e}`)}function n9(e,t,n){return t.reduce((r,o)=>r.filter((s)=>o.run(s,e,$c)===void 0),n)}function RU(e,t){if(e?.minLength!==void 0&&e.maxLength!==void 0&&e.minLength>e.maxLength)throw ki(`${t} constraints`)}function FU(e){return e===void 0||e.minLength===void 0&&e.maxLength===void 0?void 0:{...e.minLength!==void 0?{minLength:e.minLength}:{},...e.maxLength!==void 0?{maxLength:e.maxLength}:{}}}function Uv(e,t,n,r){return r?e.uniqueArray(t,{...n,comparator:r}):e.array(t,n)}function kU(e,t,n,r=!1){let o=t.constraint,s=FU(o);return RU(s,"array"),Uv(e,n,r?{...s,maxLength:s?.minLength??0}:s,o?.unique?ee:void 0)}function Zx(e,t,n,r){return t.chain((o)=>o.length<n?e.constant(o):r.map((s)=>[...o,...s]))}function CU(e,t){return e.chain((n)=>t.map((r)=>({...Object.fromEntries(r),...n})))}function vU(e,t,n,r,o,s){if(r===void 0||t===void 0)return r===void 0?[t,n]:[r,o];let i=e(t,r);return i===s?[r,o]:i===0?[t,n||o]:[t,n]}function a9(e,t){if(e===void 0)return t;if(e.order!==t.order)throw Error("Cannot merge ordered arbitrary constraints with different Order instances");let[n,r]=vU(e.order,e.minimum,e.exclusiveMinimum,t.minimum,t.exclusiveMinimum,-1),[o,s]=vU(e.order,e.maximum,e.exclusiveMaximum,t.maximum,t.exclusiveMaximum,1);return{order:e.order,...n!==void 0?{minimum:n}:{},...r!==void 0?{exclusiveMinimum:r}:{},...o!==void 0?{maximum:o}:{},...s!==void 0?{exclusiveMaximum:s}:{}}}function c9(e,t){let{ordered:n,...r}=e??{},{ordered:o,...s}=t,i=o===void 0?n:a9(n,o);return{...i9.combine(r,s),...i===void 0?{}:{ordered:i}}}function IU(e){let t=[],n=[];function r(o){if(o.annotations?.arbitrary)n.push(o.annotations.arbitrary);if(o._tag!=="Filter")for(let s of o.checks)r(s);else t.push(o)}return e?.forEach(r),{filters:t,arbitraries:n}}function u9(e){let t=e.map(({constraint:n})=>n).filter(Ve);return(n)=>{let r=t.reduce((o,s)=>c9(o,s),n.constraint);return{...n,constraint:r}}}function jp(e){return{...e,constraint:void 0}}function AU(e,t,n){if(t===void 0||t.minLength===void 0&&t.maxLength===void 0)return;if(t.minLength!==void 0&&e.indexSignatures.length===0&&t.minLength>e.propertySignatures.length)throw ki("object property constraints");let r={};if(t.minLength!==void 0)r.minLength=Math.max(0,t.minLength-n);if(t.maxLength!==void 0){if(r.maxLength=t.maxLength-n,r.maxLength<0)throw ki("object property constraints")}return RU(r,"object property"),r}function l9(e,t,n,r,o,s){let i=r.length;if(s.maxLength!==void 0&&s.maxLength<i)throw ki("object property constraints");let a=s.minLength===void 0?0:Math.max(0,s.minLength-i),c=s.maxLength===void 0?o.length:Math.min(o.length,s.maxLength-i);if(a>c)throw ki("object property constraints");let u=e.record(t,{requiredKeys:[...r,...o]}),l=e.shuffledSubarray([...o],{minLength:a,maxLength:c});return e.tuple(u,l).map(([f,d])=>{let m=new Set([...r,...d]),y={};for(let b of n)if(m.has(b))H(y,b,f[b]);return y})}function MU(e,t,n,r){let o={};if(e?.minimum!==void 0)o.min=t(e.minimum,e.exclusiveMinimum===!0);if(e?.maximum!==void 0)o.max=n(e.maximum,e.exclusiveMaximum===!0);if(o.min!==void 0&&o.max!==void 0&&o.min>o.max)throw ki(r);return o}function f9(e){return MU(e,(t,n)=>n?Math.floor(t)+1:Math.ceil(t),(t,n)=>n?Math.ceil(t)-1:Math.floor(t),"integer constraints")}function d9(e,t){let n={...e?.noInfinity?{noDefaultInfinity:!0}:{},...e?.noNaN?{noNaN:!0}:{},...t?.minimum!==void 0?{min:t.minimum}:{},...t?.exclusiveMinimum!==void 0?{minExcluded:t.exclusiveMinimum}:{},...t?.maximum!==void 0?{max:t.maximum}:{},...t?.exclusiveMaximum!==void 0?{maxExcluded:t.exclusiveMaximum}:{}};if(n.min!==void 0&&n.max!==void 0&&(n.min>n.max||n.min===n.max&&(n.minExcluded||n.maxExcluded)))throw ki("number constraints");return n}function p9(e){return MU(e,(t,n)=>n?t+BigInt(1):t,(t,n)=>n?t-BigInt(1):t,"the ordered bigint constraints")}function zl(e,t){let n=(r,o,s=bU)=>e(r,o,s);return n.terminal=(r,o,s=bU)=>t(r,o,s),n}function yo(e){return zl(e,e)}function TU(e,t){let n=EU.get(t)??e.createDepthIdentifier();return EU.set(t,n),{maxDepth:2,depthIdentifier:n}}function _U(e,t){return t.length===0?void 0:t.length===1?t[0]:e.oneof(...t)}function h9(e){return{...e,constraint:m9}}function g9(e,t,n,r){let o=r===void 0?[]:[{arbitrary:r,weight:1}];for(let{candidate:s}of n){if(!s)continue;let i=s.make(e,t);if(i===void 0)continue;let a=s.weight??1;if(!globalThis.Number.isInteger(a)||a<=0)throw ki("a candidate with an invalid weight");o.push({arbitrary:i,weight:a})}return o.length===0?void 0:o.length===1?o[0].arbitrary:e.oneof(...o)}function OU(e,t,n,r,o){let s=g9(n,r,t.arbitraries,o);return s===void 0?void 0:n9(e,t.filters,s)}function x9(e,t){if(!(typeof e==="object"&&e!==null&&("arbitrary"in e)))return{arbitrary:e,terminal:t?void 0:e};let n="terminal"in e?e.terminal:t?void 0:e.arbitrary;return{arbitrary:e.arbitrary,terminal:n}}function y9(e,t,n,r,o){return e.map((s)=>({arbitrary:o?t.constant(null).chain(()=>s(t,n,r)):s(t,n,r),terminal:s.terminal(t,n,r)}))}function PU(e,t,n,r){let o=u9(t.arbitraries);return zl((s,i,a)=>{let c=o(i);return OU(e,t,s,c,n(s,i,c,a))},(s,i,a)=>{let c=o(i);return OU(e,t,s,c,r(s,i,c,a))})}function So(e,t){let n=gs(e)?.toArbitrary;if(n){let r=va(e)?e.typeParameters.map((i)=>So(i,t)):[],o=IU(e.checks),s=(i)=>(a,c,u,l)=>x9(n(y9(r,a,jp(c),l,i))(a,u),r.length>0)[i?"terminal":"arbitrary"];return PU(e,o,s(!1),s(!0))}if(e.checks){let r=IU(e.checks),o=So(Cx(e,void 0),t);return PU(e,r,(s,i,a,c)=>o(s,a,c),(s,i,a,c)=>o.terminal(s,a,c))}return S9(e,t)}function S9(e,t){switch(e._tag){case"Never":case"Declaration":throw ws(`Unsupported AST ${e._tag}`,t);case"Null":return yo((n)=>n.constant(null));case"Void":case"Undefined":return yo((n)=>n.constant(void 0));case"Unknown":case"Any":return yo((n)=>n.anything());case"String":return yo((n,r)=>{let o=r.constraint,s=o?.patterns;return s?n.oneof(...s.map((i)=>n.stringMatching(new RegExp(i)))):n.string(FU(o))});case"Number":return yo((n,r)=>{let o=r.constraint,s=o?.ordered?.order===Mr?o.ordered:void 0;return o?.integer?n.integer(f9(s)):n.float(d9(o,s))});case"Boolean":return yo((n)=>n.boolean());case"BigInt":return yo((n,r)=>{let o=r.constraint?.ordered?.order===so?r.constraint.ordered:void 0;return n.bigInt(p9(o))});case"Symbol":return yo((n)=>n.string().map(Symbol.for));case"Literal":return yo((n)=>n.constant(e.literal));case"UniqueSymbol":return yo((n)=>n.constant(e.symbol));case"ObjectKeyword":return yo((n)=>n.oneof(n.object(),n.array(n.anything())));case"Enum":return So(yN(e),t);case"TemplateLiteral":{let n=e.parts.map((r,o)=>So(kr(r),[...t,o]));return yo((r,o,s)=>r.tuple(...n.map((i)=>i(r,h9(o),s))).map((i)=>i.map((a)=>globalThis.String(a)).join("")))}case"Arrays":{let n=e.elements.map((i,a)=>({ast:i,arbitrary:So(i,[...t,a])})),r=e.elements.length,o=e.rest.map((i,a)=>({ast:i,arbitrary:So(i,[...t,r+a])})),s=(i,a,c)=>{let u=jp(a),l=[],f=[],d=0;for(let k of n){let g=k.arbitrary.terminal(i,u,c);if(Mt(k.ast)){f.push(g);continue}if(g===void 0)return;d++,l.push(g.map(F))}let m=a.constraint?.minLength??0,b=hr(o)&&m>d+f.length?f.length:Math.max(0,m-d),E=0;for(let k of f){if(E>=b||k===void 0){l.push(i.constant(P()));continue}E++,d++,l.push(k.map(F))}if(E<b)return;let w=i.tuple(...l).map(UE);if(hr(o)){let[k,...g]=o,x=e.elements.length===0?a:u,S=Math.max(0,m-d-g.length),C=S===0?void 0:k.arbitrary.terminal(i,u,c);if(S>0&&C===void 0)return;let I=S===0?i.constant([]):kU(i,{...x,constraint:{...x.constraint,minLength:S}},C,!0);if(w=Zx(i,w,r,I),g.length>0){let _=[];for(let U of g){let N=U.arbitrary.terminal(i,u,c);if(N===void 0)return;_.push(N)}let M=i.tuple(..._);w=Zx(i,w,r,M)}}return w};return zl((i,a,c)=>{let u=jp(a),l=n.map(({ast:d,arbitrary:m})=>{let y=m(i,u,c);return Mt(d)?y.chain((b)=>i.boolean().map((E)=>E?F(b):P())):y.map(F)}),f=i.tuple(...l).map((d)=>UE(PT(d,Ce)));if(hr(o)){let[d,...m]=o.map(({arbitrary:b})=>b(i,u,c)),y=kU(i,e.elements.length===0?a:u,d);if(f=Zx(i,f,r,y),m.length>0){let b=i.tuple(...m);f=Zx(i,f,r,b)}}if(a.recursion){let d=s(i,a,c);if(d!==void 0)return i.oneof(a.recursion,d,f)}return f},s)}case"Objects":{let n=e.propertySignatures.map((s)=>({ps:s,arbitrary:So(s.type,[...t,s.name])})),r=e.indexSignatures.map((s)=>({is:s,parameter:So(s.parameter,t),type:So(s.type,t)}));return zl((s,i,a)=>{let c=jp(i),u={},l=[],f=[],d=[];for(let{ps:E,arbitrary:w}of n){let k=E.name;if(l.push(k),Mt(E.type))d.push(k);else f.push(k);H(u,k,w(s,c,a))}let m=i.constraint;if(d.length>0&&r.length===0&&m!==void 0&&(m.minLength!==void 0||m.maxLength!==void 0))return l9(s,u,l,f,d,m);let y=s.record(u,{requiredKeys:f}),b=AU(e,i.constraint,f.length);for(let{parameter:E,type:w}of r){let k=s.tuple(E(s,c,a),w(s,c,a)),g=Uv(s,k,b,wU);y=CU(y,g)}return y},(s,i,a)=>{let c=jp(i),u={},l=[],f=[];for(let{ps:E,arbitrary:w}of n){let k=E.name,g=w.terminal(s,c,a);if(Mt(E.type)){if(g!==void 0)f.push([k,g]);continue}if(g===void 0)return;l.push(k),H(u,k,g)}let d=Math.max(0,(i.constraint?.minLength??0)-l.length);for(let[E,w]of f){if(d===0)break;d--,l.push(E),H(u,E,w)}if(d>0&&e.indexSignatures.length===0)return;let m=s.record(u,{requiredKeys:l}),y=AU(e,i.constraint,l.length),b=y?.minLength??0;for(let{parameter:E,type:w}of r){let k;if(b===0)k=s.constant([]);else{let g=E.terminal(s,c,a),x=w.terminal(s,c,a);if(g===void 0||x===void 0)return;k=Uv(s,s.tuple(g,x),{...y,maxLength:b},wU)}m=CU(m,k)}return m})}case"Union":{let n=e.types.map((o)=>So(o,t)),r=(o,s,i)=>_U(o,n.map((a)=>a.terminal(o,s,i)).filter(Ve));return zl((o,s,i)=>{let a=n.map((u)=>u(o,s,i));if(s.recursion){let u=r(o,s,i);if(u!==void 0)return o.oneof(s.recursion,u,...a)}let c=_U(o,a);if(c===void 0)throw ki("a union with no members");return c},r)}case"Suspend":{let n=SU.get(e);if(n)return n;let r=Lc(()=>So(e.thunk(),t)),o=zl((s,i,a)=>{let c=TU(s,e),u={...i,recursion:c},l=a.includes(e)?a:[...a,e],f=r().terminal(s,u,l);if(f===void 0)throw ws("Unable to derive an arbitrary for a recursive schema without a finite generation path",t);return s.oneof(c,f,s.constant(null).chain(()=>r()(s,u,l)))},(s,i,a)=>{if(a.includes(e))return;let c=TU(s,e);return r().terminal(s,{...i,recursion:c},[...a,e])});return SU.set(e,o),o}}}var SU,EU,bU,wU=([e],[t])=>ee(e,t),r9,o9,Yx,s9,i9,m9,DU;var NU=v(()=>{nr();pU();Pt();ne();pg();Me();rc();ge();bi();Qx();yU();$v();ya();SU=new WeakMap,EU=new WeakMap,bU=[];r9=Wp(ZR),o9=Wp(YR),Yx=Wp(dU),s9=Wp(RT()),i9=xU({integer:Yx,maxLength:o9,minLength:r9,noInfinity:Yx,noNaN:Yx,patterns:s9,unique:Yx},{omitKeyWhen:Li});m9={noInfinity:!0,noNaN:!0};DU=bn((e)=>So(e,[]))});function Ta(e,t){let n=gs(e)?.toEquivalence;if(n)return n(va(e)?e.typeParameters.map((r)=>Ta(r,t)):[]);switch(e._tag){case"Never":return ZA();case"Declaration":case"Null":case"Undefined":case"Void":case"Unknown":case"Any":case"String":case"Number":case"Boolean":case"BigInt":case"Symbol":case"Literal":case"UniqueSymbol":case"ObjectKeyword":case"Enum":case"TemplateLiteral":return ee;case"Arrays":{let r=e.elements.map((i,a)=>Ta(i,[...t,a])),o=e.elements.length,s=e.rest.map((i,a)=>Ta(i,[...t,o+a]));return dn((i,a)=>{if(!Array.isArray(i)||!Array.isArray(a))return!1;let c=i.length;if(c!==a.length)return!1;let u=0;for(;u<Math.min(c,e.elements.length);u++)if(!r[u](i[u],a[u]))return!1;if(s.length>0){let[l,...f]=s;for(;u<c-f.length;u++)if(!l(i[u],a[u]))return!1;for(let d=0;d<f.length;d++)if(!f[d](i[u+d],a[u+d]))return!1}return!0})}case"Objects":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return ee;let r=e.propertySignatures.map((s)=>Ta(s.type,[...t,s.name])),o=e.indexSignatures.map((s)=>Ta(s.type,t));return dn((s,i)=>{if(!Dn(s)||!Dn(i))return!1;for(let a=0;a<r.length;a++){let c=e.propertySignatures[a],u=c.name,l=Object.hasOwn(s,u),f=Object.hasOwn(i,u);if(Mt(c.type)){if(l!==f)return!1}if(l&&f&&!r[a](s[u],i[u]))return!1}for(let a=0;a<o.length;a++){let c=e.indexSignatures[a],u=Nc(s,c.parameter),l=Nc(i,c.parameter);if(u.length!==l.length)return!1;for(let f=0;f<u.length;f++){let d=u[f];if(!Object.hasOwn(i,d)||!o[a](s[d],i[d]))return!1}}return!0})}case"Union":{let r=Tn(e).types,o=new Map(r.map((s,i)=>[s,[Lp(s),Ta(e.types[i],t)]]));return dn((s,i)=>{let a=Cp(s,r);for(let c=0;c<a.length;c++){let[u,l]=o.get(a[c]);if(u(s)&&u(i))return l(s,i)}return!1})}case"Suspend":{let r=Lc(()=>Ta(e.thunk(),t));return dn((o,s)=>r()(o,s))}}}var $U;var UU=v(()=>{Pt();Ws();ne();ge();bi();Gx();ya();$U=bn((e)=>Ta(e,[]))});function jc(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Vl(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function BU(e,t){return e===t||e===(t.endsWith("#")?t.slice(0,-1):`${t}#`)}function jU(e){return{dialect:"draft-07",..._9(e,L9)}}function k9(e,t){return n(e,!1,!0);function n(r,o,s=!1){if(!Dn(r))return r;let i=o||!s&&VU(r.$id),a={};for(let c of Object.keys(r)){let u=r[c],l=u;switch(c){case"$defs":case"properties":case"patternProperties":case"dependentSchemas":l=Bv(u,(f)=>n(f,i))??u;break;case"allOf":case"anyOf":case"oneOf":case"prefixItems":l=Array.isArray(u)?u.map((f)=>n(f,i)):u;break;case"not":case"additionalProperties":case"propertyNames":case"unevaluatedProperties":case"items":case"contains":case"unevaluatedItems":case"if":case"then":case"else":case"contentSchema":l=n(u,i)}H(a,c,l)}return t(a,i),a}}function qU(e,t){return k9(e,(n)=>{C9(n,t)})}function C9(e,t){if(typeof e.$ref==="string")H(e,"$ref",t(e.$ref,"$ref"));if(typeof e.$dynamicRef==="string")H(e,"$dynamicRef",t(e.$dynamicRef,"$dynamicRef"))}function Bv(e,t){if(!Dn(e))return;let n={};for(let r of Object.keys(e))H(n,r,t(e[r],r));return n}function v9(e,t,n){let r=new Map,o=[],s=Lv;function i(d,m=[],y=[]){if(m.length===0&&t?.trackIds){let b=Dn(d)?l(d):void 0;s=HU(b,Lv)??Lv}return u(d,m,y,{sourceRoot:[],targetRoot:[],uri:s})}function a(){for(let[d,m,y]of o){let b=m,E=zU(m,y);if(E!==void 0){let w=I9(E.hash);if(E.hash="",w!==void 0){let k=r.get(WU(E.href,w));if(k!==void 0)b=A9(m,k)}}H(d,"$ref",b)}}let c=n(i);return a(),c;function u(d,m,y,b){if(typeof d==="boolean")return f(m,y,b),t?.booleanAdapter?.(d)??d;if(!Dn(d))return d;let E=b,w=l(d);if(m.length>0&&t?.trackIds&&VU(w)){let x=HU(w,b.uri);if(x!==void 0)E={parent:b,sourceRoot:m,targetRoot:y,uri:x}}f(m,y,E);let k=E.uri,g={isDocumentRoot:m.length===0,schema(x,S,C=S){return u(x,[...m,S],[...y,C],E)},schemaAt(x,S,C){return u(x,[...m,...S],[...y,...C],E)},schemaArray(x,S,C=S){return Array.isArray(x)?x.map((I,_)=>u(I,[...m,S,String(_)],[...y,C,String(_)],E)):x},schemaMap(x,S,C=S){if(!Dn(x))return x;return Bv(x,(I,_)=>u(I,[...m,S,_],[...y,C,_],E))},reference(x,S){if(typeof S==="string")o.push([x,S,k]);else H(x,"$ref",S)}};return e(d,g)}function l(d){return t?.ignoreRefSiblings===!0&&typeof d.$ref==="string"?void 0:d.$id}function f(d,m,y){if(y.parent!==void 0)f(d,m,y.parent);r.set(WU(y.uri,d.slice(y.sourceRoot.length)),m.slice(y.targetRoot.length))}}function zU(e,t){return URL.canParse(e,t)?new URL(e,t):void 0}function HU(e,t){if(typeof e!=="string")return;let n=zU(e,t);if(n===void 0)return;return n.hash="",n.href}function I9(e){if(e.length===0)return[];let t;try{t=decodeURIComponent(e.slice(1))}catch{return}if(!t.startsWith("/"))return;return/~(?:[^01]|$)/.test(t)?void 0:t.slice(1).split("/").map(Vl)}function A9(e,t){let n=e.indexOf("#");if(n===-1&&t.length===0)return e;return`${n===-1?e:e.slice(0,n)}${T9(t)}`}function T9(e){return e.length===0?"#":`#/${e.map((t)=>encodeURI(jc(t)).replace(/#/g,"%23")).join("/")}`}function WU(e,t){return`${e}\x00${JSON.stringify(t)}`}function VU(e){return typeof e==="string"&&e.length>0&&e[0]!=="#"}function _9(e,t,n){return v9(t,{...n,trackIds:!0},(r)=>({schema:r(e.schema),definitions:Bv(e.definitions,(o,s)=>r(o,["$defs",s],["definitions",s]))}))}function F9(e,t,n,r,o,s=O9){let i;if(s.has(t))i=r.schemaMap(n,t);else if(P9.has(t))i=r.schemaArray(n,t);else if(o.has(t))i=r.schema(n,t);else return!1;return H(e,t,i),!0}function qc(e,t,n){throw Error(`Cannot convert JSON Schema keyword "${e}" to ${t}: ${n}`)}function N9(e,t,n,r){for(let o of t)if(Object.hasOwn(e,o))qc(o,n,`it is not active in ${r} but would become active in the target`)}function U9(e,t,n,r,o){if(n.isDocumentRoot)H(e,"$schema",BU(t,LU)?r:t);else if(!BU(t,LU))qc("$schema",o,"an embedded resource cannot declare a different dialect")}function L9(e,t){N9(e,$9,"Draft-07","Draft 2020-12");let n={},r=void 0,o=void 0,s=void 0;for(let i of Object.keys(e)){let a=e[i];if(F9(n,i,a,t,R9))continue;switch(i){case"$ref":r=a;break;case"$schema":U9(n,a,t,w9,"Draft-07");break;case"$id":case"$anchor":break;case"$defs":H(n,"definitions",t.schemaMap(a,i,"definitions"));break;case"prefixItems":o=a;break;case"items":s=a;break;case"dependentRequired":case"dependentSchemas":case"minContains":case"maxContains":break;case"$dynamicRef":case"$dynamicAnchor":case"$vocabulary":case"unevaluatedProperties":case"unevaluatedItems":qc(i,"Draft-07","the target dialect has no equivalent");case"required":if(Array.isArray(a)&&a.length===0)break;H(n,i,a);break;default:H(n,i,a)}}if(B9(n,o,s,t),Object.hasOwn(e,"contains")){let{minContains:i,maxContains:a}=e;if(i!==void 0&&i!==1||a!==void 0)qc("minContains/maxContains","Draft-07","contains cardinality cannot be represented");if(Object.hasOwn(e,"minContains"))H(n,"minContains",i)}else{if(Object.hasOwn(e,"minContains"))H(n,"minContains",e.minContains);if(Object.hasOwn(e,"maxContains"))H(n,"maxContains",e.maxContains)}return W9(e,n,t,"draft-07"),q9(e,n,"$id","Draft-07"),H9(n,r,t),n}function B9(e,t,n,r){if(t===void 0){if(n!==void 0)H(e,"items",r.schema(n,"items"));return}if(H(e,"items",r.schemaArray(t,"prefixItems","items")),n!==void 0)H(e,"additionalItems",r.schema(n,"items","additionalItems"))}function H9(e,t,n){if(t===void 0)return;if(typeof t==="string"&&Object.keys(e).length>0){let r={};n.reference(r,t),j9(e,r)}else n.reference(e,t)}function W9(e,t,n,r){let o=Dn(e.dependentRequired)?e.dependentRequired:void 0,s=Dn(e.dependentSchemas)?e.dependentSchemas:void 0;if(o===void 0&&s===void 0)return;let i={},a=new Set([...Object.keys(o??{}),...Object.keys(s??{})]);for(let c of a){let u=o?.[c],l=s?.[c],f=r==="draft-04"&&Array.isArray(u)&&u.length===0;if(l===void 0){if(!f)H(i,c,u)}else if(u===void 0||f)H(i,c,n.schemaAt(l,["dependentSchemas",c],["dependencies",c]));else H(i,c,{allOf:[n.schemaAt(l,["dependentSchemas",c],["dependencies",c,"allOf","0"]),{required:u}]})}if(Object.keys(i).length>0)H(t,"dependencies",i)}function j9(e,t){if(Array.isArray(e.allOf))e.allOf.push(t);else H(e,"allOf",[t])}function q9(e,t,n,r){let{$id:o,$anchor:s}=e;if(s===void 0){if(o!==void 0)H(t,n,o);return}if(typeof s!=="string"||!M9.test(s))qc("$anchor",r,"the anchor is not valid");if(!D9.test(s))qc("$anchor",r,"the anchor cannot be represented as a plain-name fragment identifier");if(o===void 0)H(t,n,`#${s}`);else qc("$anchor",r,"it cannot be combined with the schema $id")}var w9="http://json-schema.org/draft-07/schema#",LU="https://json-schema.org/draft/2020-12/schema",Lv="https://effect.invalid/.json-schema/",O9,P9,R9,KU,bxe,wxe,M9,D9,$9;var Hv=v(()=>{ge();O9=new Set(["properties","patternProperties"]),P9=new Set(["allOf","anyOf","oneOf"]),R9=new Set(["not","additionalProperties","propertyNames","contains","if","then","else","contentSchema"]);KU=["$anchor","$defs","$dynamicAnchor","$dynamicRef","$vocabulary","contentSchema","dependentRequired","dependentSchemas","maxContains","minContains","prefixItems","unevaluatedItems","unevaluatedProperties"],bxe=[...KU,"deprecated"],wxe=[...KU,"$comment","$id","$schema","const","contains","contentEncoding","contentMediaType","else","examples","if","patternProperties","propertyNames","then"],M9=/^[A-Za-z_][-A-Za-z0-9._]*$/,D9=/^[A-Za-z][-A-Za-z0-9._:]*$/;$9=["additionalItems","definitions","dependencies"]});var kxe,Kl=(e)=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&");var Wv=v(()=>{kxe=globalThis.RegExp});function qp(e,t){if(e===void 0)return;let n={},r=e.title;if(typeof r==="string")n.title=r;let{description:o,expected:s}=e;if(typeof o==="string")n.description=o;else if(t?.generateDescriptions===!0&&typeof s==="string")n.description=s;let i=e.default;if(Ul(i))n.default=i;let a=e.examples;if(Array.isArray(a)&&Ul(a))n.examples=a;let c=e.readOnly;if(typeof c==="boolean")n.readOnly=c;let u=e.writeOnly;if(typeof u==="boolean")n.writeOnly=u;let l=e.format;if(typeof l==="string")n.format=l;let f=e.contentEncoding;if(typeof f==="string")n.contentEncoding=f;let d=e.contentMediaType;if(typeof d==="string")n.contentMediaType=d;let m=e.contentSchema;if(Ul(m))n.contentSchema=m;if(t?.includeAnnotationKey!==void 0)for(let[y,b]of Object.entries(e)){if(V9.has(y)||!t.includeAnnotationKey(y))continue;if(Ul(b))H(n,y,b)}return Object.keys(n).length===0?void 0:n}function QU(e){let t=e.type==="number"||e.type==="integer"?e.type:void 0,n=e;if(t!==void 0)n={...e},delete n.type;if(Array.isArray(n.allOf)){let r=[],o=!1;for(let s of n.allOf){let i=QU(s);if(i.type!==void 0){if(o=!0,t===void 0||i.type==="integer")t=i.type}if(Object.keys(i.schema).length>0)r.push(i.schema)}if(o){let{allOf:s,...i}=n;n=r.length===0?i:{...i,allOf:r}}}return{type:t,schema:n}}function K9(e){return Array.isArray(e.anyOf)&&e.anyOf.length===4&&e.anyOf[0]?.type==="number"&&e.anyOf.slice(1).every((t)=>t.type==="string")}function jv(e,t){return Object.keys(e).every((n)=>t.includes(`|${n}|`))}function JU(e,t){return typeof e.$ref!=="string"&&t.every((n)=>!Object.hasOwn(e,n))}function zp(e,t,n){if(Object.keys(e).length===0)return t;let r=Object.keys(t);if(r.length===0)return e;let o=e.type==="number"||e.type==="integer"?e.type:void 0,s=K9(e);if(o!==void 0||s){let a=QU(t);if(a.type!==void 0){let c=o==="integer"||a.type==="integer"?"integer":"number",u={...e,type:c};if(s)delete u.anyOf;let l=Object.keys(a.schema);if(l.length===0)return u;return jv(a.schema,qv)&&JU(u,l)?{...u,...a.schema}:zp(u,a.schema,n)}}if(n&&JU(e,r))return{...e,...t};let i=Array.isArray(t.allOf)&&r.length===1?t.allOf:[t];if(Array.isArray(e.allOf))return{...e,allOf:[...e.allOf,...i]};if(typeof e.$ref==="string")return{allOf:[e,...i]};return{...e,allOf:i}}function J9(e,t,n,r){let o=new Map,s=new WeakMap,i=new Map,a=!1,c=Object.keys(n);for(let g of c)f(g,["references",g]);let u=sn(e,(g,x)=>d(E(g,t[x]))),l={};for(let g of c){let x=o.get(g);if(typeof x!=="string")H(l,g,d(x))}return{dialect:"draft-2020-12",schemas:u,definitions:l};function f(g,x){let S=o.get(g);if(S!==void 0)return typeof S==="string"?S:g;if(!Object.hasOwn(n,g))throw ws(`Invalid reference ${g}`,[...x,"$ref"]);o.set(g,null);let C=n[g],I=E(C,["references",g]),_=m(C);if(_!==void 0){let M=i.get(_),U=M?.find((N)=>ee(o.get(N),I));if(U===void 0)if(M===void 0)i.set(_,[g]);else M.push(g);else return a=!0,o.set(g,U),U}return o.set(g,I),g}function d(g){if(!a)return g;return qU(g,(x)=>x.replace(/^#\/\$defs\/([^/]*)/,(S,C)=>{let I=o.get(Vl(C));return typeof I==="string"?`#/$defs/${jc(I)}`:S}))}function m(g){if(g._tag==="Reference")return;let x=g.checks.length===0?g.annotations:g.checks[g.checks.length-1].annotations;return typeof x?.identifier!=="string"&&typeof x?.[Pc]==="string"?x[Pc]:void 0}function y(g,x){return g?.schemas?.map((S,C)=>E(S,[...x,"schemas",C]))??[]}function b(g,x,S){let C=g.annotations,I=C?.toJsonSchema;if(I!==void 0){let N=y(g.representation,[...S,"representation"]),Z=I({type:x,schemas:N}),G=qp(C,r),ye=G===void 0?Z:{...Z,...G},Wt=G===void 0?ZU:G9;return g._tag==="Filter"&&jv(ye,Wt)&&(G===void 0||jv(G,qv))?[ye,!0]:[ye]}if(g._tag==="Filter")return;let _=g.checks.map((N,Z)=>b(N,x,[...S,"checks",Z])).filter((N)=>N!==void 0);if(_.length===0)return;let M=qp(C,r),U=_.map(([N])=>N);return[M===void 0?{allOf:U}:{allOf:U,...M}]}function E(g,x){if(g._tag==="Reference"){let _=f(g.$ref,x);return{$ref:`#/$defs/${jc(_)}`}}let S=s.get(g);if(S!==void 0)return S;let C=w(g,x),I=qp(g.annotations,r);if(I!==void 0)C={...C,...I};for(let _=0;_<g.checks.length;_++){let M=typeof C.type==="string"&&Q9(C.type)?C.type:void 0,U=b(g.checks[_],M,[...x,"checks",_]);if(U!==void 0)C=zp(C,...U)}return s.set(g,C),C}function w(g,x){switch(g._tag){case"Any":case"Unknown":return{};case"ObjectKeyword":return{anyOf:[{type:"object"},{type:"array"}]};case"Void":case"Undefined":case"Null":return{type:"null"};case"BigInt":return{type:"string",allOf:[{pattern:"^-?\\d+$"}]};case"Symbol":case"UniqueSymbol":return{type:"string",allOf:[{pattern:"^Symbol\\((.*)\\)$"}]};case"Declaration":return{};case"Suspend":return E(g.thunk,[...x,"thunk"]);case"Never":return{not:{}};case"String":return{type:"string"};case"Number":return{anyOf:[{type:"number"},{type:"string",enum:["NaN"]},{type:"string",enum:["Infinity"]},{type:"string",enum:["-Infinity"]}]};case"Boolean":return{type:"boolean"};case"Literal":{let S=g.literal;return typeof S==="bigint"?{type:"string",enum:[globalThis.String(S)]}:{type:typeof S,enum:[S]}}case"Enum":{let S=g.enums.map(([C,I])=>typeof I==="number"&&!globalThis.Number.isFinite(I)?{type:"string",enum:[globalThis.String(I)],title:C}:{type:typeof I,enum:[I],title:C});return S.length===0?{not:{}}:{anyOf:S}}case"TemplateLiteral":return{type:"string",pattern:`^${g.parts.map(Xx).join("")}$`};case"Arrays":{if(g.rest.length>1)throw ws("Invalid schema representation document",[...x,"rest"]);let S={type:"array"},C=g.elements.length,I=g.elements.map((_,M)=>{if(_.isOptional)C--;let U=E(_.type,[...x,"elements",M,"type"]),N=qp(_.annotations,r);return N===void 0?U:zp(U,N)});if(I.length>0){if(S.prefixItems=I,S.maxItems=g.elements.length,C>0)S.minItems=C}else S.items=!1;if(g.rest.length===1){delete S.maxItems;let _=E(g.rest[0],[...x,"rest",0]);if(Object.keys(_).length>0)S.items=_;else delete S.items}return S}case"Objects":{if(g.propertySignatures.length===0&&g.indexSignatures.length===0)return{anyOf:[{type:"object"},{type:"array"}]};let S={type:"object"},C={},I=[];for(let N=0;N<g.propertySignatures.length;N++){let Z=g.propertySignatures[N];if(typeof Z.name!=="string")throw ws("Invalid schema representation document",[...x,"propertySignatures",N,"name"]);let G=Z.name,ye=E(Z.type,[...x,"propertySignatures",N,"type"]),Wt=qp(Z.annotations,r);if(H(C,G,Wt===void 0?ye:zp(ye,Wt)),!Z.isOptional)I.push(G)}if(g.propertySignatures.length>0)S.properties=C;if(I.length>0)S.required=I;let _={},M=[];for(let N=0;N<g.indexSignatures.length;N++){let Z=g.indexSignatures[N],G=E(Z.type,[...x,"indexSignatures",N,"type"]);if(Object.keys(G).length===1&&"not"in G)G=!1;let ye=k(Z.parameter,[...x,"indexSignatures",N,"parameter"],new Set);if(ye.length===0)M.push(G);else for(let Wt of ye){let $i=_[Wt];H(_,Wt,$i===void 0?G:$i===!1||G===!1?!1:zp($i,G))}}let U=Object.keys(_).length>0;if(U)S.patternProperties=_;if(g.indexSignatures.length===0)S.additionalProperties=r?.additionalProperties??!1;else if(M.length===1&&g.propertySignatures.length===0&&!U)S.additionalProperties=M[0];else if(M.length>0)S.allOf=M.map((N)=>({type:"object",additionalProperties:N}));if(typeof S.additionalProperties==="object"&&S.additionalProperties!==null&&Object.keys(S.additionalProperties).length===0)delete S.additionalProperties;return S}case"Union":{let S=g.types.map((C,I)=>E(C,[...x,"types",I]));if(S.length===0)return{not:{}};if(g.mode==="anyOf"&&S.length>1){let C=Z9(S);if(C!==void 0)return C}return g.mode==="anyOf"?{anyOf:S}:{oneOf:S}}}}function k(g,x,S){switch(g._tag){case"Reference":{if(!Object.hasOwn(n,g.$ref))throw ws(`Invalid reference ${g.$ref}`,[...x,"$ref"]);if(f(g.$ref,x),S.has(g.$ref))return[];let C=new Set(S).add(g.$ref);return k(n[g.$ref],["references",g.$ref],C)}case"String":return YU(E(g,x));case"TemplateLiteral":return[`^${g.parts.map(Xx).join("")}$`];case"Union":return g.types.flatMap((C,I)=>k(C,[...x,"types",I],S));default:throw ws("Invalid schema representation document",x)}}}function Q9(e){return e==="string"||e==="number"||e==="boolean"||e==="array"||e==="object"||e==="null"||e==="integer"}function Z9(e){let t=void 0,n=[];for(let r of e){if(Object.keys(r).length!==2||r.type===void 0||!Array.isArray(r.enum)||r.enum.length===0)return;if(t===void 0)t=r.type;else if(r.type!==t)return;n.push(...r.enum)}return{type:t,enum:n}}function YU(e){let t=[];if(typeof e.pattern==="string")t.push(e.pattern);for(let n of["allOf","anyOf","oneOf"]){let r=e[n];if(Array.isArray(r)){for(let o of r)if(typeof o==="object"&&o!==null&&!Array.isArray(o))t.push(...YU(o))}}return t}function Xx(e){switch(e._tag){case"Literal":return Kl(globalThis.String(e.literal));case"String":return EN;case"Number":return hx;case"TemplateLiteral":return e.parts.map(Xx).join("");case"Union":return e.types.map(Xx).join("|");default:throw ws("Invalid schema representation document",[])}}function XU(e,t){let n=J9([e.representation],[["representation"]],e.references,t);return{dialect:n.dialect,schema:n.schemas[0],definitions:n.definitions}}var V9,ZU="|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|",qv="|title|description|default|examples|readOnly|writeOnly|",G9;var e2=v(()=>{nr();Pt();Hv();Wv();bi();$v();ya();V9=new Set([...uM,Pc,...aM]);G9=ZU+qv});function Go(e){return e===void 0?void 0:{annotations:e}}function zv(e,t){let{references:n,representations:r}=eY([e],t);return{representation:r[0],references:n}}function eY(e,t){let n={},r=new Map,o=new Set,s=new Map,i=new Set;for(let S of e)m(S);let a=t?.referencePolicy??X9;for(let S of s.values())for(let C of S.values()){let I=a({ast:C.ast,occurrences:C.occurrences,identifier:C.identifier});if(I!==void 0){let _=I===C.identifier||!I.endsWith("_")?"_":"";C.reference=u(I,C,_)}else if(C.isRecursive)C.reference=u(`${C.ast._tag}_`,C,"")}return{representations:sn(e,(S)=>b(S)),references:n};function u(S,C,I="_"){let _=S,M=0;while(r.has(_)){if(r.get(_)===C)return _;_=`${S}${I}${++M}`}return r.set(_,C),_}function l(S,C,I){let _=C.fallback;if(_!==void 0)return Bk(S)===_?S:xo(S,{[Pc]:_});return I===C.identifier?S:xo(S,{identifier:I})}function f(S,C){if(!Object.hasOwn(n,S)&&!o.has(S)){o.add(S);let I=E(C);o.delete(S),H(n,S,I)}return{_tag:"Reference",$ref:S}}function d(S){let C=Tp(S),I=zC(C),_=vl(C),M=_===void 0?(C!==S?vl(S):void 0)??Bk(C):void 0;if(M!==void 0)_=`${M}Encoded`;let U=s.get(I);if(U===void 0)U=new Map,s.set(I,U);let N=U.get(_);if(N===void 0)N={ast:I,identifier:_,fallback:M,occurrences:0,isRecursive:!1,reference:void 0},U.set(_,N);return N}function m(S){let C=d(S),I=C.ast;if(C.occurrences++,i.has(C)){C.isRecursive=!0;return}if(C.occurrences>1)return;switch(i.add(C),y(I.checks),I._tag){case"Declaration":case"Arrays":case"Objects":case"Union":I.recur((_)=>(m(_),_));break;case"TemplateLiteral":I.parts.forEach(m);break;case"Suspend":m(I.thunk());break}i.delete(C)}function y(S){S?.forEach((C)=>{if(C.annotations?.representation?.schemas?.forEach((I)=>m(Tn(I))),C._tag==="FilterGroup")y(C.checks)})}function b(S){let C=d(S),I=C.ast,_=C.reference;if(_!==void 0){let M=C.identifier===void 0?I:l(I,C,_);return f(_,M)}return E(I)}function E(S){let C=w(S.checks);switch(S._tag){case"Declaration":return{_tag:"Declaration",typeParameters:S.typeParameters.map((I)=>b(I)),checks:C,...g(S.annotations)};case"Null":case"Undefined":case"Void":case"Never":case"Unknown":case"Any":case"String":case"Boolean":case"Number":case"BigInt":case"Symbol":case"ObjectKeyword":return{_tag:S._tag,checks:C,...Go(S.annotations)};case"Literal":return{_tag:"Literal",literal:S.literal,checks:C,...Go(S.annotations)};case"UniqueSymbol":return{_tag:"UniqueSymbol",symbol:S.symbol,checks:C,...Go(S.annotations)};case"Enum":return{_tag:"Enum",enums:S.enums,checks:C,...Go(S.annotations)};case"TemplateLiteral":return{_tag:"TemplateLiteral",parts:S.parts.map((I)=>b(I)),checks:C,...Go(S.annotations)};case"Arrays":return{_tag:"Arrays",elements:S.elements.map((I)=>{let _=Tp(I),M=_.context?.annotations;return{isOptional:Mt(_),type:b(I),...Go(M)}}),rest:S.rest.map((I)=>b(I)),checks:C,...Go(S.annotations)};case"Objects":return{_tag:"Objects",propertySignatures:S.propertySignatures.map((I)=>{let _=Tp(I.type),M=_.context?.annotations;return{name:I.name,type:b(I.type),isOptional:Mt(_),isMutable:hN(_),...Go(M)}}),indexSignatures:S.indexSignatures.map((I)=>({parameter:b(I.parameter),type:b(I.type)})),checks:C,...Go(S.annotations)};case"Union":return{_tag:"Union",types:S.types.map((I)=>b(I)),mode:S.mode,checks:C,...Go(S.annotations)};case"Suspend":return{_tag:"Suspend",checks:[],thunk:b(S.thunk()),...Go(S.annotations)}}}function w(S){return S?.map(k)??[]}function k(S){switch(S._tag){case"Filter":return{_tag:"Filter",aborted:S.aborted,...x(S.annotations)};case"FilterGroup":return{_tag:"FilterGroup",checks:sn(S.checks,k),...x(S.annotations)}}}function g(S){if(S===void 0)return;let{representation:C,...I}=S;return{...C===void 0?void 0:{representation:C},...Object.keys(I).length===0?void 0:{annotations:I}}}function x(S){if(S===void 0)return;let{representation:C,...I}=S,_=C===void 0?void 0:C.schemas===void 0?C:{...C,schemas:C.schemas.map((M)=>b(Tn(M)))};return{..._===void 0?void 0:{representation:_},...Object.keys(I).length===0?void 0:{annotations:I}}}}var X9=({identifier:e})=>e;var t2=v(()=>{nr();bi();ya()});function r2(e,t){let n=[];return Vv(e,t,"",n),n}function Vv(e,t,n,r){if(Object.is(e,t))return;if(Array.isArray(e)&&Array.isArray(t)){let o=e.length,s=t.length,i=Math.min(o,s);for(let a=0;a<i;a++)Vv(e[a],t[a],`${n}/${a}`,r);for(let a=o-1;a>=s;a--)r.push({op:"remove",path:`${n}/${a}`});for(let a=o;a<s;a++)r.push({op:"add",path:`${n}/${a}`,value:t[a]});return}if(ey(e)&&ey(t)){let o=Object.keys(e),s=Object.keys(t),i=Array.from(new Set([...o,...s])).sort();for(let a of i){let c=`${n}/${jc(a)}`,u=Object.hasOwn(e,a),l=Object.hasOwn(t,a);if(u&&l)Vv(e[a],t[a],c,r);else if(!u&&l)r.push({op:"add",path:c,value:t[a]});else r.push({op:"remove",path:c})}return}r.push({op:"replace",path:n,value:t})}function o2(e,t){let n=t;for(let r of e)n=rY(n,r);return n}function ey(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function nY(e){if(e==="")return[];if(e.charCodeAt(0)!==47)throw Error(`Invalid JSON Pointer, it must start with "/": ${JSON.stringify(e)}`);return e.split("/").slice(1).map(Vl)}function s2(e){if(!/^(0|[1-9]\d*)$/.test(e))throw Error(`Invalid array index: "${e}"`);return Number(e)}function rY(e,t){if(t.path===""){if(t.op==="remove")throw Error("Unsupported operation at the root");return t.value}let n=oY(e,t.path);if(n===null)throw Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`);let{lastToken:r,parent:o,stack:s}=n;if(Array.isArray(o)){if(r==="-"&&t.op!=="add")throw Error(`"-" is not valid for ${t.op} at "${t.path}".`);let i=r==="-"?o.length:s2(r),a=t.op==="add"?o.length:o.length-1;if(i>a)throw Error(`Array index out of bounds at "${t.path}".`);let c=o.slice();if(t.op==="add")c.splice(i,0,t.value);else if(t.op==="remove")c.splice(i,1);else c[i]=t.value;return n2(s,c)}if(ey(o)){if(t.op!=="add"&&!Object.hasOwn(o,r))throw Error(`Property "${r}" does not exist at "${t.path}".`);let i={...o};if(t.op==="remove")delete i[r];else H(i,r,t.value);return n2(s,i)}throw Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`)}function oY(e,t){let n=nY(t);if(n.length===0)return null;let r=n[n.length-1],o=[],s=e;for(let i=0;i<n.length-1;i++){let a=n[i];if(Array.isArray(s)){let c=s2(a);if(c>=s.length)return null;o.push({container:s,token:c}),s=s[c];continue}if(ey(s)){if(!Object.hasOwn(s,a))return null;o.push({container:s,token:a}),s=s[a];continue}return null}return{stack:o,parent:s,lastToken:r}}function n2(e,t){let n=t;for(let r=e.length-1;r>=0;r--){let{container:o,token:s}=e[r];if(Array.isArray(o)){let i=o.slice();i[s]=n,n=i}else{let i={...o};H(i,s,n),n=i}}return n}var i2=()=>{};function u2(e,t){return Jo(Gl("Iso",e,t))}function a2(e,t){return Jo(Gl("Lens",e,t))}function Gl(e,t,n){return[{_tag:"PrimitiveNode",kind:e,get:t,set:n}]}class Gv{_tag="PathNode";kind="Lens";path;get;set;constructor(e){this.path=e,this.get=(t)=>{let n=t;for(let r=0;r<e.length;r++)n=n[e[r]];return n},this.set=(t,n)=>{let r=ny(n),o=r,s=0;for(;s<e.length-1;s++){let i=e[s];H(o,i,ny(o[i])),o=o[i]}return H(o,e[s],t),r}}}class ty{_tag="CheckNode";kind="Prism";checks;get;set=L;constructor(e){this.checks=e,this.get=(t)=>kN(e,t)}}function zc(e,t){if(e.length===0)return t;if(t.length===0)return e;let n=e.slice();for(let r=0;r<t.length;r++){let o=t[r],s=n[n.length-1];if(s._tag==="PathNode"&&o._tag==="PathNode")n[n.length-1]=new Gv([...s.path,...o.path]);else if(s._tag==="CheckNode"&&o._tag==="CheckNode")n[n.length-1]=new ty([...s.checks,...o.checks]);else n.push(o)}return n}function aY(e,t){return Jo(Gl("Optional",e,t))}class Vp{node;getResult;replaceResult;constructor(e,t,n){this.node=e,this.getResult=t,this.replaceResult=n}replace(e,t){return Ji(this.replaceResult(e,t),()=>t)}modify(e){return(t)=>Ji(Qi(this.getResult(t),(n)=>this.replaceResult(e(n),t)),()=>t)}compose(e){return Jo(zc(this.node,e.node))}key(e){return Jo(zc(this.node,[new Gv([e])]))}optionalKey(e){return Jo(zc(this.node,Gl("Lens",(t)=>t[e],(t,n)=>{let r=ny(n);if(t===void 0)if(Array.isArray(r)&&typeof e==="number")r.splice(e,1);else delete r[e];else H(r,e,t);return r})))}check(...e){return Jo(zc(this.node,[new ty(e)]))}refine(e,t){return Jo(zc(this.node,[new ty([kx(e,t)])]))}tag(e){let t=oe(new Ie({expected:`${JSON.stringify(e)} tag`}));return Jo(zc(this.node,Gl("Prism",(n)=>n._tag===e?J(n):t,L)))}at(e,...t){let n=oe(new Jt([e],new Fc(void 0)));return Jo(zc(this.node,Gl("Optional",(r)=>Object.hasOwn(r,e)?J(r[e]):n,(r,o)=>{if(Object.hasOwn(o,e)){let s=ny(o);return H(s,e,r),J(s)}else return n})))}pick(e){return this.compose(a2(mU(e),(t,n)=>({...n,...t})))}omit(e){return this.compose(a2(hU(e),(t,n)=>({...n,...t})))}notUndefined(){return this.refine(Ve,{expected:"a value other than `undefined`"})}forEach(e){let t=e(ry());return aY((n)=>Dr(this.getResult(n),(r)=>{let o=[];for(let s=0;s<r.length;s++){let i=t.getResult(r[s]);if(rn(i))o.push(i.success)}return o}),(n,r)=>Qi(this.getResult(r),(o)=>{let s=[];for(let a=0;a<o.length;a++)if(rn(t.getResult(o[a])))s.push(a);if(n.length!==s.length)return oe(new Ie({message:`each: replacement length mismatch: ${n.length} !== ${s.length}`}));let i=o.slice();for(let a=0;a<s.length;a++){let c=s[a],u=t.replaceResult(n[a],o[c]);if(Se(u))return oe(new Jt([c],u.failure));i[c]=u.success}return this.replaceResult(i,r)}))}modifyAll(e){return(t)=>Ji(Qi(this.getResult(t),(n)=>this.replaceResult(n.map(e),t)),()=>t)}}function Jo(e){let t=e[0]??iY;if(e.length>1){let n=e.reduce((r,o)=>lY(r,o.kind),"Iso");t={kind:n,get:cY(e,n),set:uY(e,n)}}switch(t.kind){case"Iso":return new l2(e,t.get,t.set);case"Lens":return new f2(e,t.get,t.set);case"Prism":return new d2(e,t.get,t.set);case"Optional":return new Vp(e,t.get,t.set)}}function ny(e){if(Array.isArray(e))return e.slice();if(typeof e==="object"&&e!==null){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)throw Error("Cannot clone object with non-Object constructor or null prototype");return{...e}}return e}function cY(e,t){return(n)=>{for(let r=0;r<e.length;r++){let o=e[r],s=o.get(n);if(Kv(o.kind)){if(Se(s))return s;n=s.success}else n=s}return Kv(t)?J(n):n}}function uY(e,t){if(c2(t))return(n)=>{for(let r=e.length-1;r>=0;r--)n=e[r].set(n);return n};return(n,r)=>{let o=e.length,s=Array(o);for(let i=0;i<o;i++){s[i]=r;let a=e[i];if(Kv(a.kind)){let c=a.get(r);if(Se(c))return c;r=c.success}else r=a.get(r)}for(let i=o-1;i>=0;i--){let a=e[i];if(c2(a.kind))n=a.set(n);else if(a.kind==="Lens")n=a.set(n,s[i]);else{let c=a.set(n,s[i]);if(Se(c))return c;n=c.success}}return t==="Optional"?J(n):n}}function Kv(e){return e==="Prism"||e==="Optional"}function c2(e){return e==="Iso"||e==="Prism"}function lY(e,t){if(e==="Iso")return t;if(t==="Iso"||e===t)return e;return"Optional"}function ry(){return fY}var iY,l2,f2,d2,fY;var p2=v(()=>{ne();ge();Bn();bi();Ea();Qx();iY={kind:"Iso",get:L,set:L};l2=class l2 extends Vp{get;set;constructor(e,t,n){super(e,(r)=>J(t(r)),(r)=>J(n(r)));this.get=t,this.set=n}replace(e,t){return this.set(e)}modify(e){return(t)=>this.set(e(this.get(t)))}};f2=class f2 extends Vp{get;constructor(e,t,n){super(e,(r)=>J(t(r)),(r,o)=>J(n(r,o)));this.get=t,this.replace=n}modify(e){return(t)=>this.replace(e(this.get(t)),t)}};d2=class d2 extends Vp{set;constructor(e,t,n){super(e,t,(r,o)=>J(n(r)));this.set=n}replace(e,t){return this.set(e)}modify(e){return(t)=>Ji(Dr(this.getResult(t),(n)=>this.set(e(n))),()=>t)}};fY=Jo([])});var Vc,m2=(e)=>{if(Vc.has(e))return Vc.get(e);else throw Error("Unable to get redacted value"+(e.label?` with label: "${e.label}"`:""))};var h2=v(()=>{Vc=new WeakMap});var g2="~effect/data/Redacted",Jv=(e)=>D(e,g2),Ci=(e,t)=>{let n=Object.create(mY);if(t?.label)n.label=t.label;return Vc.set(n,e),n},mY,_a,x2=(e)=>dn((t,n)=>e(_a(t),_a(n)));var Kp=v(()=>{Pt();Ws();wn();pt();h2();ge();mY={[g2]:{_A:(e)=>e},label:void 0,...Xn,toJSON(){return this.toString()},toString(){return`<redacted${_o(this.label)?":"+this.label:""}>`},[_e](){return ie(Vc.get(this))},[Oe](e){return Jv(e)&&ee(Vc.get(this),Vc.get(e))}},_a=m2});var O={};Qn(O,{Any:()=>zY,Array:()=>je,ArrayEnsure:()=>n7,BigDecimal:()=>hI,BigDecimalFromString:()=>YX,BigDecimalReviver:()=>ZX,BigInt:()=>ks,BigIntFromString:()=>cee,Boolean:()=>ly,BooleanFromBit:()=>hee,Cause:()=>iy,CauseReason:()=>sy,CauseReasonReviver:()=>wX,CauseReviver:()=>kX,Char:()=>uX,Chunk:()=>fB,ChunkReviver:()=>NX,Class:()=>AB,Date:()=>vr,DateFromMillis:()=>WX,DateFromString:()=>HX,DateReviver:()=>BX,DateTimeUtc:()=>cm,DateTimeUtcFromDate:()=>bee,DateTimeUtcFromMillis:()=>kee,DateTimeUtcFromString:()=>wee,DateTimeUtcReviver:()=>Eee,DateTimeZoned:()=>bI,DateTimeZonedFromString:()=>Oee,DateTimeZonedReviver:()=>_ee,Defect:()=>pI,Duration:()=>im,DurationFromMillis:()=>VX,DurationFromNanos:()=>zX,DurationFromString:()=>hB,DurationReviver:()=>jX,Enum:()=>jY,Error:()=>xy,ErrorInstance:()=>nB,ErrorInstanceReviver:()=>IX,Exit:()=>rB,ExitReviver:()=>AX,File:()=>gI,FileReviver:()=>tee,Finite:()=>Cr,FiniteFromString:()=>aee,FormData:()=>xI,FormDataReviver:()=>nee,Graph:()=>aB,GraphReviver:()=>RX,HashMap:()=>cB,HashMapReviver:()=>FX,HashSet:()=>lB,HashSetReviver:()=>DX,Int:()=>Cs,Json:()=>fm,JsonObject:()=>mte,JsonReviver:()=>hte,Literal:()=>et,Literals:()=>Ti,MutableJson:()=>UB,MutableJsonReviver:()=>xte,Natural:()=>_n,Never:()=>qY,NonEmptyArray:()=>t7,NonEmptyString:()=>VL,Null:()=>Le,NullOr:()=>oI,NullishOr:()=>Q2,Number:()=>Yp,NumberFromString:()=>iee,ObjectKeyword:()=>KY,Opaque:()=>g7,Option:()=>Pa,OptionFromNullOr:()=>fX,OptionFromNullishOr:()=>pX,OptionFromOptional:()=>hX,OptionFromOptionalKey:()=>mX,OptionFromOptionalNullOr:()=>gX,OptionFromUndefinedOr:()=>dX,OptionReviver:()=>lX,PropertyKey:()=>Yv,ReadonlyMap:()=>iB,ReadonlyMapReviver:()=>TX,ReadonlySet:()=>uB,ReadonlySetReviver:()=>MX,Record:()=>fy,Redacted:()=>my,RedactedFromValue:()=>bX,RedactedReviver:()=>EX,RegExp:()=>dB,RegExpReviver:()=>$X,Result:()=>KL,ResultReviver:()=>xX,SchemaError:()=>Kc,StandardSchemaV1FailureResult:()=>mee,String:()=>Q,StringFromBase64:()=>lee,StringFromBase64Url:()=>fee,StringFromHex:()=>dee,StringFromUriComponent:()=>pee,Struct:()=>te,StructWithRest:()=>XY,Symbol:()=>K2,TaggedClass:()=>Mee,TaggedError:()=>Qo,TaggedStruct:()=>py,TaggedUnion:()=>h7,TemplateLiteral:()=>HY,TemplateLiteralParser:()=>WY,TimeZone:()=>EI,TimeZoneFromString:()=>Tee,TimeZoneNamed:()=>SI,TimeZoneNamedFromString:()=>Iee,TimeZoneNamedReviver:()=>vee,TimeZoneOffset:()=>wB,TimeZoneOffsetReviver:()=>Cee,TimeZoneReviver:()=>Aee,Tree:()=>pte,Trim:()=>uee,Trimmed:()=>EB,Tuple:()=>Ql,TupleWithRest:()=>e7,URL:()=>gy,URLFromString:()=>LX,URLReviver:()=>UX,URLSearchParams:()=>yI,URLSearchParamsReviver:()=>oee,Uint8Array:()=>am,Uint8ArrayFromBase64:()=>xee,Uint8ArrayFromBase64Url:()=>yee,Uint8ArrayFromHex:()=>See,Uint8ArrayReviver:()=>gee,Undefined:()=>nI,UndefinedOr:()=>dy,Union:()=>kt,UniqueArray:()=>r7,UniqueSymbol:()=>GY,Unknown:()=>tI,UnknownFromJsonString:()=>eee,Void:()=>VY,annotate:()=>gY,annotateEncoded:()=>xY,annotateKey:()=>yY,asserts:()=>wY,brand:()=>Y2,catchDecoding:()=>c7,catchDecodingWithContext:()=>tL,catchEncoding:()=>u7,catchEncodingWithContext:()=>nL,check:()=>s7,declare:()=>Eo,declareConstructor:()=>Ir,decode:()=>l7,decodeEffect:()=>kY,decodeExit:()=>CY,decodeOption:()=>IY,decodePromise:()=>TY,decodeResult:()=>AY,decodeSync:()=>_Y,decodeTo:()=>pe,decodeUnknownEffect:()=>Ai,decodeUnknownExit:()=>$2,decodeUnknownOption:()=>vY,decodeUnknownPromise:()=>L2,decodeUnknownResult:()=>U2,decodeUnknownSync:()=>B2,encode:()=>f7,encodeEffect:()=>H2,encodeExit:()=>OY,encodeKeys:()=>ZY,encodeOption:()=>RY,encodePromise:()=>MY,encodeResult:()=>FY,encodeSync:()=>DY,encodeTo:()=>sI,encodeUnknownEffect:()=>cy,encodeUnknownExit:()=>W2,encodeUnknownOption:()=>PY,encodeUnknownPromise:()=>q2,encodeUnknownResult:()=>j2,encodeUnknownSync:()=>z2,extendTo:()=>YY,fieldsAssign:()=>JY,flip:()=>Qv,fromBrand:()=>a7,fromFormData:()=>ree,fromJsonString:()=>SB,fromURLSearchParams:()=>see,instanceOf:()=>Oa,is:()=>Zp,isBase64:()=>cI,isBase64Reviver:()=>T7,isBase64Url:()=>pL,isBase64UrlReviver:()=>_7,isBetween:()=>om,isBetweenBigDecimal:()=>Z7,isBetweenBigInt:()=>NL,isBetweenBigIntReviver:()=>ate,isBetweenDate:()=>PL,isBetweenDateReviver:()=>nte,isBetweenReviver:()=>W7,isCapitalized:()=>SL,isCapitalizedReviver:()=>D7,isEndsWith:()=>hL,isEndsWithReviver:()=>P7,isFinite:()=>bL,isFiniteReviver:()=>$7,isGUID:()=>fL,isGUIDReviver:()=>I7,isGreaterThan:()=>kL,isGreaterThanBigDecimal:()=>K7,isGreaterThanBigInt:()=>RL,isGreaterThanBigIntReviver:()=>rte,isGreaterThanDate:()=>AL,isGreaterThanDateReviver:()=>Yee,isGreaterThanOrEqualTo:()=>uI,isGreaterThanOrEqualToBigDecimal:()=>G7,isGreaterThanOrEqualToBigInt:()=>FL,isGreaterThanOrEqualToBigIntReviver:()=>ote,isGreaterThanOrEqualToDate:()=>TL,isGreaterThanOrEqualToDateReviver:()=>Xee,isGreaterThanOrEqualToReviver:()=>L7,isGreaterThanReviver:()=>U7,isIncludes:()=>gL,isIncludesReviver:()=>R7,isInt:()=>sm,isInt32:()=>z7,isIntReviver:()=>q7,isLengthBetween:()=>fI,isLengthBetweenReviver:()=>eX,isLessThan:()=>CL,isLessThanBigDecimal:()=>J7,isLessThanBigInt:()=>ML,isLessThanBigIntReviver:()=>ste,isLessThanDate:()=>_L,isLessThanDateReviver:()=>ete,isLessThanOrEqualTo:()=>vL,isLessThanOrEqualToBigDecimal:()=>Q7,isLessThanOrEqualToBigInt:()=>DL,isLessThanOrEqualToBigIntReviver:()=>ite,isLessThanOrEqualToDate:()=>OL,isLessThanOrEqualToDateReviver:()=>tte,isLessThanOrEqualToReviver:()=>H7,isLessThanReviver:()=>B7,isLowercased:()=>yL,isLowercasedReviver:()=>M7,isMaxLength:()=>UL,isMaxLengthReviver:()=>X7,isMaxProperties:()=>jL,isMaxPropertiesReviver:()=>sX,isMaxSize:()=>BL,isMaxSizeReviver:()=>nX,isMinLength:()=>lI,isMinLengthReviver:()=>Y7,isMinProperties:()=>WL,isMinPropertiesReviver:()=>oX,isMinSize:()=>LL,isMinSizeReviver:()=>tX,isMultipleOf:()=>IL,isMultipleOfReviver:()=>j7,isNonEmpty:()=>$L,isPattern:()=>Gc,isPatternReviver:()=>E7,isPropertiesLengthBetween:()=>qL,isPropertiesLengthBetweenReviver:()=>iX,isPropertyNames:()=>zL,isPropertyNamesReviver:()=>aX,isSchema:()=>uy,isSchemaError:()=>R2,isSizeBetween:()=>HL,isSizeBetweenReviver:()=>rX,isStartsWith:()=>mL,isStartsWithReviver:()=>O7,isStringBigInt:()=>cL,isStringBigIntReviver:()=>w7,isStringFinite:()=>aL,isStringFiniteReviver:()=>b7,isStringSymbol:()=>uL,isStringSymbolReviver:()=>k7,isTrimmed:()=>aI,isTrimmedReviver:()=>y7,isULID:()=>dL,isULIDReviver:()=>A7,isUUID:()=>lL,isUUIDReviver:()=>v7,isUint32:()=>V7,isUncapitalized:()=>EL,isUncapitalizedReviver:()=>N7,isUnique:()=>dI,isUniqueReviver:()=>cX,isUppercased:()=>xL,isUppercasedReviver:()=>F7,link:()=>st,make:()=>K,makeFilter:()=>it,makeFilterGroup:()=>x7,makeIsBetween:()=>rm,makeIsGreaterThan:()=>Xp,makeIsGreaterThanOrEqualTo:()=>em,makeIsLessThan:()=>tm,makeIsLessThanOrEqualTo:()=>nm,makeIsMultipleOf:()=>wL,middlewareDecoding:()=>X2,middlewareEncoding:()=>eL,mutable:()=>o7,mutableKey:()=>UY,optional:()=>cr,optionalKey:()=>vi,overrideToCodecIso:()=>fte,overrideToEquivalence:()=>Uee,overrideToFormatter:()=>Nee,readonlyKey:()=>LY,refine:()=>i7,required:()=>$Y,requiredKey:()=>NY,resolveAnnotations:()=>yte,resolveAnnotationsKey:()=>Ste,revealBottom:()=>hY,revealCodec:()=>SY,suspend:()=>Z2,tag:()=>Ii,tagDefaultOmit:()=>m7,toArbitrary:()=>Dee,toCodecArrayFromSingle:()=>qee,toCodecIso:()=>RB,toCodecJson:()=>_B,toCodecJsonAST:()=>yy,toCodecStringTree:()=>lm,toDifferJsonPatch:()=>dte,toEncoded:()=>ef,toEncoderXml:()=>zee,toEquivalence:()=>Lee,toFormatter:()=>$ee,toIso:()=>cte,toIsoFocus:()=>lte,toIsoSource:()=>ute,toJsonSchemaDocument:()=>TB,toRepresentation:()=>Bee,toStandardJSONSchemaV1:()=>bY,toStandardSchemaV1:()=>EY,toTaggedUnion:()=>iL,toType:()=>ur,withConstructorDefault:()=>rL,withDecodingDefault:()=>sL,withDecodingDefaultKey:()=>iI,withDecodingDefaultType:()=>p7,withDecodingDefaultTypeKey:()=>d7});function Ir(){return(e,t,n)=>K(new Uc(e.map(kp),(r)=>t(r.map((o)=>K(o))),n))}function Eo(e,t){return Ir()([],()=>(n,r,o)=>e(n)?A(n):R(new bt(r,n,o)),t)}function hY(e){return e}function gY(e){return(t)=>t.annotate(e)}function xY(e){return(t)=>Qv(Qv(t).annotate(e))}function yY(e){return(t)=>t.rebuild(_p(t.ast,e))}function SY(e){return e}function R2(e){return D(e,Jp)&&e[Jp]===Jp}function y2(e){return Kt(e)?e.value:{issues:[{message:Sw(e.cause)}]}}function EY(e,t){let n=Nt(e),r={errors:"all",...t?.parseOptions},o=mM(t),s=(i)=>{let a=new zu("sync"),c=ps(pa(n(i,r),{onFailure:o,onSuccess:(l)=>({value:l})}),{scheduler:a});c.currentDispatcher?.flush();let u=c.pollUnsafe();if(u)return y2(u);return new Promise((l)=>{c.addObserver((f)=>{l(y2(f))})})};if("~standard"in e){let i=e;if("validate"in i["~standard"])return i;return Object.assign(i["~standard"],{validate:s}),i}else return Object.assign(e,{"~standard":{version:1,vendor:"effect",validate:s}})}function S2(e,t){let n=TB(e);if(t==="draft-2020-12"){let r=n.schema;if(Object.keys(n.definitions).length>0)r.$defs=n.definitions;return r}else if(t==="draft-07"){let r=jU(n),o=r.schema;if(Object.keys(r.definitions).length>0)o.definitions=r.definitions;return o}throw new globalThis.Error(`Unsupported target: ${t}`)}function bY(e){let t={input(n){return S2(e,n.target)},output(n){return S2(ur(e),n.target)}};if("~standard"in e){let n=e;if("jsonSchema"in n["~standard"])return n;return Object.assign(n["~standard"],{jsonSchema:t}),n}else return Object.assign(e,{"~standard":{version:1,vendor:"effect",jsonSchema:t}})}function Ai(e,t){let n=Nt(e,t);return(r,o)=>F2(n(r,o))}function F2(e){if(Xe(e))return eI(e);return Gr(e,(t)=>fa(()=>ri(t,(n)=>new Kc(n))))}function M2(e,t){let n;for(let r of e.reasons){if(!bd(r)||!R2(r.error))throw new globalThis.Error(t,{cause:e});n??=r.error}if(n===void 0)throw new globalThis.Error(t,{cause:e});return n}function D2(e){return Ag(e).then((t)=>{if(Kt(t))return t.value;throw M2(t.cause,"Promise adapter can only reject schema errors")})}function N2(e){let t=ha(e);if(Kt(t))return t.value;throw M2(t.cause,"Sync adapter can only throw schema errors")}function $2(e,t){let n=Y$(e,t);return(r,o)=>eI(n(r,o))}function eI(e){return Kt(e)?e:Hr(ri(e.cause,(t)=>new Kc(t)))}function U2(e,t){let n=eU(e,t);return(r,o)=>Wu(n(r,o),(s)=>new Kc(s))}function L2(e,t){let n=Ai(e,t);return(r,o)=>D2(n(r,o))}function B2(e,t){let n=Ai(e,t);return(r,o)=>N2(n(r,o))}function cy(e,t){let n=ql(e,t);return(r,o)=>F2(n(r,o))}function W2(e,t){let n=tU(e,t);return(r,o)=>eI(n(r,o))}function j2(e,t){let n=rU(e,t);return(r,o)=>Wu(n(r,o),(s)=>new Kc(s))}function q2(e,t){let n=cy(e,t);return(r,o)=>D2(n(r,o))}function z2(e,t){let n=cy(e,t);return(r,o)=>N2(n(r,o))}function uy(e){return D(e,Gp)&&e[Gp]===Gp}function BY(e){return D(e,Qp)&&e[Qp]===Qp}function Qv(e){if(BY(e))return e.schema.rebuild(Wo(e.ast));return K(Wo(e.ast),{[Qp]:Qp,schema:e})}function et(e){let t=K(new Zr(e),{literal:e,transform(n){return t.pipe(pe(et(n),{decode:Ae(()=>n),encode:Ae(()=>e)}))}});return t}function V2(e){return new $C(e.map((t)=>uy(t)?t.ast:new Zr(t)))}function HY(e){return K(V2(e),{parts:e})}function WY(e){return K(V2(e).asTemplateLiteralParser(),{parts:e})}function jY(e){return K(new NC(Object.keys(e).filter((t)=>typeof e[e[t]]!=="number").map((t)=>[t,e[t]])),{enums:e})}function GY(e){return K(new UC(e))}function rI(e,t){return K(e,{fields:t,mapFields(n,r){let o=n(this.fields);return rI(yx(o,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function te(e){return rI(yx(e,void 0),e)}function JY(e){return qn((t)=>t.mapFields(gU(e)))}function ZY(e){return function(t){let n={},r=Object.create(null),o=Object.create(null),s=new Set;for(let i of Reflect.ownKeys(t.fields)){let a=ef(t.fields[i]),c=Object.hasOwn(e,i),u=c?e[i]:i,l=QY(u);if(s.has(l))throw new globalThis.Error(`Duplicate encoded keys: ${$s(u)}`);if(s.add(l),H(n,u,a),c)r[i]=u,o[u]=i}return te(n).pipe(pe(t,ht({decode:Mv(o),encode:Mv(r)})))}}function YY(e,t){return(n)=>{let r=AT(n.fields,ur),o=te({...r,...e});return n.pipe(pe(o,ht({decode:(s)=>{let i={...s};for(let a in e){let c=t[a],u=c(s);if(Ce(u))H(i,a,u.value)}return i},encode:(s)=>{let i={...s};for(let a in e)delete i[a];return i}})))}}function fy(e,t){return K(mN(e.ast,t.ast),{key:e,value:t})}function XY(e,t){return K(rN(e.ast,t.map(kp)),{schema:e,records:t})}function G2(e,t){return K(e,{elements:t,mapElements(n,r){let o=n(this.elements);return G2(WC(o,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Ql(e){return G2(WC(e),e)}function e7(e,t){return K(oN(e.ast,t.map(kp)),{schema:e,rest:t})}function n7(e){return kt([e,je(e)]).pipe(pe(je(ur(e)),ht({decode:_T,encode:(t)=>t.length===1?t[0]:t})))}function r7(e){return je(e).check(dI())}function J2(e,t){return K(e,{members:t,mapMembers(n,r){let o=n(this.members);return J2(Sx(o,this.ast.mode,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function kt(e,t){return J2(Sx(e,t?.mode??"anyOf",void 0),e)}function Ti(e){let t=e.map(et);return K(Sx(t,"anyOf",void 0),{literals:e,members:t,mapMembers(n){return kt(n(this.members))},pick(n){return Ti(n)},transform(n){return kt(t.map((r,o)=>r.transform(n[o])))}})}function Z2(e){return K(new bx(()=>e().ast))}function s7(...e){return(t)=>t.check(...e)}function i7(e,t){return(n)=>K(Ss(n.ast,[kx(e,t)]),{schema:n})}function Y2(e){return(t)=>K(fN(t.ast,e),{schema:t,identifier:e})}function a7(e,t){return(n)=>(t.checks?n.check(...t.checks):n).pipe(Y2(e))}function X2(e){return(t)=>K(uN(t.ast,new Ep(e,L)),{schema:t})}function eL(e){return(t)=>K(lN(t.ast,new Ep(L,e)),{schema:t})}function c7(e){return tL(e)}function tL(e){return(t)=>X2(Zd(e))(t)}function u7(e){return nL(e)}function nL(e){return(t)=>eL(Zd(e))(t)}function pe(e,t){return(n)=>K(Ix(n.ast,e.ast,t?lx(t):_l()),{from:n,to:e})}function l7(e){return(t)=>pe(ur(t),e)(t)}function sI(e,t){return(n)=>t?pe(n,t)(e):pe(n)(e)}function f7(e){return(t)=>pe(t,e)(ef(t))}function rL(e){return(t)=>K(pN(t.ast,e),{schema:t})}function oL(e){return Gr(e,(t)=>fa(()=>ri(t,(n)=>n.issue)))}function iI(e,t){let n=t?.encodingStrategy==="omit"?sC():Ho();return(r)=>vi(ef(r)).pipe(pe(r,{decode:yp(oL(e)),encode:n}))}function d7(e,t){return(n)=>ur(n).pipe(iI(e,t),sI(vi(n)))}function sL(e,t){let n=t?.encodingStrategy==="omit"?sC():Ho();return(r)=>cr(ef(r)).pipe(pe(r,{decode:yp(oL(e)),encode:n}))}function p7(e,t){return(n)=>ur(n).pipe(sL(e,t),sI(cr(n)))}function Ii(e){return et(e).pipe(rL(A(e)))}function m7(e){return Ii(e).pipe(iI(A(e),{encodingStrategy:"omit"}))}function py(e,t){return te({_tag:Ii(e),...t})}function iL(e){return(t)=>{let n={},r=[],o=new Set,s={},i=(l)=>(f)=>l.includes(f[e]);return a(t),Object.assign(t,{cases:n,discriminants:r,isAnyOf:i,guards:s,match:c,matchOrElse:u});function a(l){let f=l.ast;if(DD(f)&&"members"in l&&globalThis.Array.isArray(l.members)&&l.members.every(uy))return l.members.forEach(a);let d=Rl(f);if(d.length>0){let m=d.find((y)=>y.key===e)?.literal;if(jm(m)){let y=typeof m==="number"?globalThis.String(m):m;if(o.has(y))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(m)}`);o.add(y),r.push(m),H(n,m,l),H(s,m,Zp(ur(l)));return}}throw new globalThis.Error("No literal or unique symbol found")}function c(){if(arguments.length===1){let y=arguments[0];return function(b){let E=b[e];return(Object.hasOwn(y,E)?y[E]:void 0)(b)}}let l=arguments[0],f=arguments[1],d=l[e];return(Object.hasOwn(f,d)?f[d]:void 0)(l)}function u(){if(arguments.length===2){let b=arguments[0],E=arguments[1];return function(w){let k=w[e];return(Object.hasOwn(b,k)?b[k]??E:E)(w)}}let l=arguments[0],f=arguments[1],d=arguments[2],m=l[e];return(Object.hasOwn(f,m)?f[m]??d:d)(l)}}}function h7(e){let t={},n=[];for(let c of Object.keys(e)){let u=py(c,e[c]);H(t,c,u),n.push(u)}let r=kt(n),{guards:o,isAnyOf:s,match:i,matchOrElse:a}=iL("_tag")(r);return K(r.ast,{cases:t,isAnyOf:s,guards:o,match:i,matchOrElse:a})}function g7(){return(e)=>e}function Oa(e,t){return Eo((n)=>n instanceof e,t)}function st(){return(e,t)=>new wt(e.ast,lx(t))}function x7(e,t=void 0){return new ka(e,t)}function zn(e,t){return ar(e,Le,({annotations:n})=>n===void 0?t:t.annotate(n))}function aI(e){let t=new globalThis.RegExp(E2);return it((n)=>n.trim()===n,{expected:"a string with no leading or trailing whitespace",representation:{id:"effect/schema/isTrimmed",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isTrimmed()"}),arbitrary:{constraint:{patterns:[E2]}},...e})}function Gc(e,t){let{source:n,flags:r}=e,o=r===""?`new RegExp(${j(n)})`:`new RegExp(${j(n)}, ${j(r)})`;return vp(e,{toCode:()=>({runtime:`Schema.isPattern(${o})`}),...t})}function aL(e){return QC({toCode:()=>({runtime:"Schema.isStringFinite()"}),...e})}function cL(e){return ZC({toCode:()=>({runtime:"Schema.isStringBigInt()"}),...e})}function uL(e){return XC({toCode:()=>({runtime:"Schema.isStringSymbol()"}),...e})}function lL(e,t){let n=C7(e);return Gc(n,{expected:e?`a UUID v${e}`:"a UUID",representation:{id:"effect/schema/isUUID",payload:{version:e??null}},toJsonSchema:()=>({pattern:n.source,format:"uuid"}),toCode:()=>({runtime:e===void 0?"Schema.isUUID()":`Schema.isUUID(${e})`}),...t})}function fL(e){return Gc(b2,{expected:"a GUID",representation:{id:"effect/schema/isGUID",payload:null},toJsonSchema:()=>({pattern:b2.source}),toCode:()=>({runtime:"Schema.isGUID()"}),...e})}function dL(e){let t=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;return Gc(t,{representation:{id:"effect/schema/isULID",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isULID()"}),...e})}function cI(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return Gc(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}function pL(e){let t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;return Gc(t,{expected:"a base64url encoded string",representation:{id:"effect/schema/isBase64Url",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64Url()"}),...e})}function mL(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(`^${Kl(e)}`);return it((o)=>o.startsWith(e),{expected:`a string starting with ${n}`,representation:{id:"effect/schema/isStartsWith",payload:{startsWith:e}},toJsonSchema:()=>({pattern:r.source}),toCode:()=>({runtime:`Schema.isStartsWith(${j(e)})`}),arbitrary:{constraint:{patterns:[r.source]}},...t})}function hL(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(`${Kl(e)}$`);return it((o)=>o.endsWith(e),{expected:`a string ending with ${n}`,representation:{id:"effect/schema/isEndsWith",payload:{endsWith:e}},toJsonSchema:()=>({pattern:r.source}),toCode:()=>({runtime:`Schema.isEndsWith(${j(e)})`}),arbitrary:{constraint:{patterns:[r.source]}},...t})}function gL(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(Kl(e));return it((o)=>o.includes(e),{expected:`a string including ${n}`,representation:{id:"effect/schema/isIncludes",payload:{includes:e}},toJsonSchema:()=>({pattern:r.source}),toCode:()=>({runtime:`Schema.isIncludes(${j(e)})`}),arbitrary:{constraint:{patterns:[r.source]}},...t})}function xL(e){let t=new globalThis.RegExp(w2);return it((n)=>n.toUpperCase()===n,{expected:"a string with all characters in uppercase",representation:{id:"effect/schema/isUppercased",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isUppercased()"}),arbitrary:{constraint:{patterns:[w2]}},...e})}function yL(e){let t=new globalThis.RegExp(k2);return it((n)=>n.toLowerCase()===n,{expected:"a string with all characters in lowercase",representation:{id:"effect/schema/isLowercased",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isLowercased()"}),arbitrary:{constraint:{patterns:[k2]}},...e})}function SL(e){let t=new globalThis.RegExp(C2);return it((n)=>n.charAt(0).toUpperCase()===n.charAt(0),{expected:"a string with the first character in uppercase",representation:{id:"effect/schema/isCapitalized",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isCapitalized()"}),arbitrary:{constraint:{patterns:[C2]}},...e})}function EL(e){let t=new globalThis.RegExp(v2);return it((n)=>n.charAt(0).toLowerCase()===n.charAt(0),{expected:"a string with the first character in lowercase",representation:{id:"effect/schema/isUncapitalized",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isUncapitalized()"}),arbitrary:{constraint:{patterns:[v2]}},...e})}function Xp(e){let t=Vi(e.order),n=e.formatter??j;return(r,o)=>it((s)=>t(s,r),{expected:`a value greater than ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:r,exclusiveMinimum:!0}}},...e.annotate?.(r),...o})}function em(e){let t=Kf(e.order),n=e.formatter??j;return(r,o)=>it((s)=>t(s,r),{expected:`a value greater than or equal to ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:r}}},...e.annotate?.(r),...o})}function tm(e){let t=Lu(e.order),n=e.formatter??j;return(r,o)=>it((s)=>t(s,r),{expected:`a value less than ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,maximum:r,exclusiveMaximum:!0}}},...e.annotate?.(r),...o})}function nm(e){let t=Vf(e.order),n=e.formatter??j;return(r,o)=>it((s)=>t(s,r),{expected:`a value less than or equal to ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,maximum:r}}},...e.annotate?.(r),...o})}function rm(e){let t=Kf(e.order),n=Vi(e.order),r=Vf(e.order),o=Lu(e.order),s=e.formatter??j;return(i,a)=>{let c=i.exclusiveMinimum?n:t,u=i.exclusiveMaximum?o:r;return it((l)=>c(l,i.minimum)&&u(l,i.maximum),{expected:`a value between ${s(i.minimum)}${i.exclusiveMinimum?" (excluded)":""} and ${s(i.maximum)}${i.exclusiveMaximum?" (excluded)":""}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:i.minimum,maximum:i.maximum,...i.exclusiveMinimum&&{exclusiveMinimum:!0},...i.exclusiveMaximum&&{exclusiveMaximum:!0}}}},...e.annotate?.(i),...a})}}function wL(e){return(t,n)=>{let r=e.formatter??j;return it((o)=>e.remainder(o,t)===e.zero,{expected:`a value that is a multiple of ${r(t)}`,...e.annotate?.(t),...n})}}function Zl(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${j(e)}`);return e}function sm(e){return it((t)=>globalThis.Number.isSafeInteger(t),{expected:"an integer",representation:{id:"effect/schema/isInt",payload:null},toJsonSchema:()=>({type:"integer"}),toCode:()=>({runtime:"Schema.isInt()"}),arbitrary:{constraint:{integer:!0}},...e})}function z7(e){return new ka([sm(),om({minimum:-2147483648,maximum:2147483647})],{expected:"a 32-bit integer",...e})}function V7(e){return new ka([sm(),om({minimum:0,maximum:4294967295})],{expected:"a 32-bit unsigned integer",...e})}function Yl(e){if(globalThis.Number.isNaN(e.getTime()))throw new globalThis.RangeError(`Expected a valid Date, got ${j(e)}`);return e.toISOString()}function Xl(e){return`new Date(${j(e.getTime())})`}function lI(e,t){return e=Math.max(0,Math.floor(e)),it((n)=>n.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:"effect/schema/isMinLength",payload:{minLength:e}},toJsonSchema:({type:n})=>n==="array"?{minItems:e}:{minLength:e},toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[Sr]:!0,arbitrary:{constraint:{minLength:e}},...t})}function $L(e){return lI(1,e)}function UL(e,t){return e=Math.max(0,Math.floor(e)),it((n)=>n.length<=e,{expected:`a value with a length of at most ${e}`,representation:{id:"effect/schema/isMaxLength",payload:{maxLength:e}},toJsonSchema:({type:n})=>n==="array"?{maxItems:e}:{maxLength:e},toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[Sr]:!0,arbitrary:{constraint:{maxLength:e}},...t})}function fI(e,t,n){return e=Math.max(0,Math.floor(e)),t=Math.max(0,Math.floor(t)),it((r)=>r.length>=e&&r.length<=t,{expected:e===t?`a value with a length of ${e}`:`a value with a length between ${e} and ${t}`,representation:{id:"effect/schema/isLengthBetween",payload:{minimum:e,maximum:t}},toJsonSchema:({type:r})=>r==="array"?{allOf:[{minItems:e},{maxItems:t}]}:{allOf:[{minLength:e},{maxLength:t}]},toCode:()=>({runtime:`Schema.isLengthBetween(${e}, ${t})`}),[Sr]:!0,arbitrary:{constraint:{minLength:e,maxLength:t}},...n})}function LL(e,t){return e=Math.max(0,Math.floor(e)),it((n)=>n.size>=e,{expected:`a value with a size of at least ${e}`,representation:{id:"effect/schema/isMinSize",payload:{minSize:e}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isMinSize(${e})`}),[Sr]:!0,arbitrary:{constraint:{minLength:e}},...t})}function BL(e,t){return e=Math.max(0,Math.floor(e)),it((n)=>n.size<=e,{expected:`a value with a size of at most ${e}`,representation:{id:"effect/schema/isMaxSize",payload:{maxSize:e}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isMaxSize(${e})`}),[Sr]:!0,arbitrary:{constraint:{maxLength:e}},...t})}function HL(e,t,n){return e=Math.max(0,Math.floor(e)),t=Math.max(0,Math.floor(t)),it((r)=>r.size>=e&&r.size<=t,{expected:e===t?`a value with a size of ${e}`:`a value with a size between ${e} and ${t}`,representation:{id:"effect/schema/isSizeBetween",payload:{minimum:e,maximum:t}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isSizeBetween(${e}, ${t})`}),[Sr]:!0,arbitrary:{constraint:{minLength:e,maxLength:t}},...n})}function WL(e,t){return e=Math.max(0,Math.floor(e)),it((n)=>Reflect.ownKeys(n).length>=e,{expected:`a value with at least ${e===1?"1 entry":`${e} entries`}`,representation:{id:"effect/schema/isMinProperties",payload:{minProperties:e}},toJsonSchema:()=>({minProperties:e}),toCode:()=>({runtime:`Schema.isMinProperties(${e})`}),[Sr]:!0,arbitrary:{constraint:{minLength:e}},...t})}function jL(e,t){return e=Math.max(0,Math.floor(e)),it((n)=>Reflect.ownKeys(n).length<=e,{expected:`a value with at most ${e===1?"1 entry":`${e} entries`}`,representation:{id:"effect/schema/isMaxProperties",payload:{maxProperties:e}},toJsonSchema:()=>({maxProperties:e}),toCode:()=>({runtime:`Schema.isMaxProperties(${e})`}),[Sr]:!0,arbitrary:{constraint:{maxLength:e}},...t})}function qL(e,t,n){return e=Math.max(0,Math.floor(e)),t=Math.max(0,Math.floor(t)),it((r)=>Reflect.ownKeys(r).length>=e&&Reflect.ownKeys(r).length<=t,{expected:e===t?`a value with exactly ${e===1?"1 entry":`${e} entries`}`:`a value with between ${e} and ${t} entries`,representation:{id:"effect/schema/isPropertiesLengthBetween",payload:{minimum:e,maximum:t}},toJsonSchema:()=>({minProperties:e,maxProperties:t}),toCode:()=>({runtime:`Schema.isPropertiesLengthBetween(${e}, ${t})`}),[Sr]:!0,arbitrary:{constraint:{minLength:e,maxLength:t}},...n})}function zL(e,t){let n=ef(e),r=Q$(n.ast);return it((o,s,i)=>{let a=Reflect.ownKeys(o),c=[];for(let u of a){let l=r(u,i);if(l!==void 0){if(c.push(new Jt([u],l)),i.errors==="first")break}}if(ac(c))return new Ft(s,c,o,i);return!0},{expected:"an object with property names matching the schema",representation:{id:"effect/schema/isPropertyNames",payload:null,schemas:[n.ast]},toJsonSchema:({schemas:o})=>({propertyNames:o[0]}),toCode:({schemas:o})=>({runtime:`Schema.isPropertyNames(${o[0].runtime})`}),[Sr]:!0,...t})}function dI(e){return it((t)=>hh(t).length===t.length,{expected:"an array with unique items",representation:{id:"effect/schema/isUnique",payload:null},toJsonSchema:()=>({uniqueItems:!0}),toCode:()=>({runtime:"Schema.isUnique()"}),arbitrary:{constraint:{unique:!0}},...e})}function Pa(e){let t=Ir()([e],([n])=>(r,o,s)=>{if(Hu(r)){if(he(r))return Ic;return mn(Nt(n)(r.value,s),{onSuccess:F,onFailure:(i)=>Er(o,"value",i,r,s)})}return R(new bt(o,r,s))},{representation:{id:"effect/schema/Option",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Option(${n[0].runtime})`,Type:`Option.Option<${n[0].Type}>`,importDeclarations:['import * as Option from "effect/Option"']}),expected:"Option",toCodec:([n])=>st()(kt([te({_tag:et("Some"),value:n}),te({_tag:et("None")})]),ht({decode:(r)=>r._tag==="None"?P():F(r.value),encode:(r)=>Ce(r)?{_tag:"Some",value:r.value}:{_tag:"None"}})),toArbitrary:([n])=>(r,o)=>{let s=r.constant(P()),i=r.oneof(s,n.arbitrary.map(F));return Jc(r,o,s,i)},toEquivalence:([n])=>EE(n),toFormatter:([n])=>ut({onNone:()=>"none()",onSome:(r)=>`some(${n(r)})`})});return K(t.ast,{value:e})}function fX(e){return oI(e).pipe(pe(Pa(ur(e)),mD()))}function dX(e){return dy(e).pipe(pe(Pa(ur(e)),hD()))}function pX(e,t){return Q2(e).pipe(pe(Pa(ur(e)),gD(t)))}function mX(e){return vi(e).pipe(pe(Pa(ur(e)),xD()))}function hX(e){return cr(e).pipe(pe(Pa(ur(e)),yD()))}function gX(e,t){let n=t===void 0?"omit":t.onNoneEncoding,r=n===null?null:void 0;return cr(oI(e)).pipe(pe(Pa(ur(e)),fx({decode:(o)=>o.pipe(sc(qm),F),encode:n==="omit"?oc:(o)=>F(It(oc(o),()=>r))})))}function KL(e,t){let n=Ir()([e,t],([r,o])=>(s,i,a)=>{if(!dh(s))return R(new bt(i,s,a));switch(s._tag){case"Success":return mn(Av(r)(s.success,a),{onSuccess:J,onFailure:(c)=>Er(i,"success",c,s,a)});case"Failure":return mn(Av(o)(s.failure,a),{onSuccess:oe,onFailure:(c)=>Er(i,"failure",c,s,a)})}},{representation:{id:"effect/schema/Result",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Result(${r[0].runtime}, ${r[1].runtime})`,Type:`Result.Result<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as Result from "effect/Result"']}),expected:"Result",toCodec:([r,o])=>st()(kt([te({_tag:et("Success"),success:r}),te({_tag:et("Failure"),failure:o})]),ht({decode:(s)=>s._tag==="Success"?J(s.success):oe(s.failure),encode:(s)=>rn(s)?{_tag:"Success",success:s.success}:{_tag:"Failure",failure:s.failure}})),toArbitrary:([r,o])=>(s,i)=>{let a=oB(s,r.terminal?.map((u)=>J(u)),o.terminal?.map((u)=>oe(u))),c=s.oneof(r.arbitrary.map((u)=>J(u)),o.arbitrary.map((u)=>oe(u)));return Jc(s,i,a,c)},toEquivalence:([r,o])=>PE(r,o),toFormatter:([r,o])=>mr({onSuccess:(s)=>`success(${r(s)})`,onFailure:(s)=>`failure(${o(s)})`})});return K(n.ast,{success:e,failure:t})}function my(e,t){let n=typeof t?.label==="string"?t.label:void 0,r=t?.disallowJsonEncode===!0,o=n!==void 0?r?{label:n,disallowJsonEncode:!0}:{label:n}:r?{disallowJsonEncode:!0}:void 0,s=n!==void 0?Nt(et(n)):void 0,i=Ir()([e],([a])=>(c,u,l)=>{if(Jv(c)){let f=s!==void 0?Tc(s(c.label,l),(d)=>new Jt(["label"],d)):Pe;return An(f,()=>mn(Nt(a)(_a(c),l),{onSuccess:()=>c,onFailure:()=>new Ft(u,[new Jt(["value"],new Ie(void 0,c,l))],c,l)}))}return R(new bt(u,c,l))},{representation:{id:"effect/schema/Redacted",payload:o??null},toCode:({typeParameters:a})=>({runtime:o!==void 0?`Schema.Redacted(${a[0].runtime}, ${j(o)})`:`Schema.Redacted(${a[0].runtime})`,Type:`Redacted.Redacted<${a[0].Type}>`,importDeclarations:['import * as Redacted from "effect/Redacted"']}),expected:"Redacted",toCodecJson:([a])=>st()(a,{decode:Ae((c)=>Ci(c,{label:n})),encode:r?rC((c)=>"Cannot serialize Redacted"+(Ce(c)&&typeof c.value.label==="string"?` with label: "${c.value.label}"`:"")):Ae(_a)}),toArbitrary:([a])=>()=>({arbitrary:a.arbitrary.map((c)=>Ci(c,{label:n})),terminal:a.terminal?.map((c)=>Ci(c,{label:n}))}),toFormatter:()=>globalThis.String,toEquivalence:([a])=>x2(a)});return K(i.ast,{value:e})}function bX(e,t){return pe(my(ur(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:Ae((n)=>Ci(n,{label:t?.label})),encode:t?.disallowEncode?rC((n)=>"Cannot encode Redacted"+(Ce(n)&&typeof n.value.label==="string"?` with label: "${n.value.label}"`:"")):Ae(_a)})(e)}function sy(e,t){let n=Ir()([e,t],([r,o])=>(s,i,a)=>{if(!gw(s))return R(new bt(i,s,a));switch(s._tag){case"Fail":return mn(Nt(r)(s.error,a),{onSuccess:wd,onFailure:(c)=>Er(i,"error",c,s,a)});case"Die":return mn(Nt(o)(s.defect,a),{onSuccess:kd,onFailure:(c)=>Er(i,"defect",c,s,a)});case"Interrupt":return A(s)}},{representation:{id:"effect/schema/CauseReason",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.CauseReason(${r[0].runtime}, ${r[1].runtime})`,Type:`Cause.Failure<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause.Failure",toCodec:([r,o])=>st()(kt([te({_tag:et("Fail"),error:r}),te({_tag:et("Die"),defect:o}),te({_tag:et("Interrupt"),fiberId:dy(Cr)})]),ht({decode:(s)=>{switch(s._tag){case"Fail":return wd(s.error);case"Die":return kd(s.defect);case"Interrupt":return Cd(s.fiberId)}},encode:L})),toArbitrary:([r,o])=>GL(r,o),toEquivalence:([r,o])=>JL(r,o),toFormatter:([r,o])=>QL(r,o)});return K(n.ast,{error:e,defect:t})}function GL(e,t){return(n,r)=>{let o=n.constant(Cd()),s=n.oneof(o,n.integer({min:1}).map(Cd),e.arbitrary.map((i)=>wd(i)),t.arbitrary.map((i)=>kd(i)));return Jc(n,r,o,s)}}function JL(e,t){return(n,r)=>{if(n._tag!==r._tag)return!1;switch(n._tag){case"Fail":return e(n.error,r.error);case"Die":return t(n.defect,r.defect);case"Interrupt":return n.fiberId===r.fiberId}}}function QL(e,t){return(n)=>{switch(n._tag){case"Fail":return`Fail(${e(n.error)})`;case"Die":return`Die(${t(n.defect)})`;case"Interrupt":return"Interrupt"}}}function iy(e,t){let n=Ir()([e,t],([r,o])=>{let s=je(sy(r,o));return(i,a,c)=>{if(!hw(i))return R(new bt(a,i,c));return mn(Nt(s)(i.reasons,c),{onSuccess:Sc,onFailure:(u)=>Er(a,"failures",u,i,c)})}},{representation:{id:"effect/schema/Cause",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Cause(${r[0].runtime}, ${r[1].runtime})`,Type:`Cause.Cause<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause",toCodec:([r,o])=>st()(je(sy(r,o)),ht({decode:Sc,encode:({reasons:s})=>s})),toArbitrary:([r,o])=>ZL(r,o),toEquivalence:([r,o])=>YL(r,o),toFormatter:([r,o])=>XL(r,o)});return K(n.ast,{error:e,defect:t})}function ZL(e,t){return(n,r)=>{let o=GL(e,t)(n,r),s=n.constant(xw),i=n.array(o.arbitrary).map(Sc);return Jc(n,r,s,i)}}function YL(e,t){let n=YA(JL(e,t));return(r,o)=>n(r.reasons,o.reasons)}function XL(e,t){let n=QL(e,t);return(r)=>`Cause([${r.reasons.map(n).join(", ")}])`}function nB(e){let t=eB(e),n=I2[t];if(n!==void 0)return n;let r=tB(t),o=Oa(globalThis.Error,{representation:{id:"effect/schema/Error",payload:r??null},toCode:()=>({runtime:r!==void 0?`Schema.ErrorInstance(${j(r)})`:"Schema.ErrorInstance()",Type:"globalThis.Error"}),expected:"Error",toCodecJson:()=>st()(gte,dD(r)),toArbitrary:()=>(s)=>s.string().map((i)=>new globalThis.Error(i))});return I2[t]=o,o}function pI(e){let t=eB(e),n=A2[t];if(n!==void 0)return n;let r=fm.pipe(pe(tI,pD(tB(t))));return A2[t]=r,r}function rB(e,t,n){let r=Ir()([e,t,n],([o,s,i])=>{let a=iy(s,i);return(c,u,l)=>{if(!bw(c))return R(new bt(u,c,l));switch(c._tag){case"Success":return mn(Nt(o)(c.value,l),{onSuccess:co,onFailure:(f)=>Er(u,"value",f,c,l)});case"Failure":return mn(Nt(a)(c.cause,l),{onSuccess:Hr,onFailure:(f)=>Er(u,"cause",f,c,l)})}}},{representation:{id:"effect/schema/Exit",payload:null},toCode:({typeParameters:o})=>({runtime:`Schema.Exit(${o[0].runtime}, ${o[1].runtime}, ${o[2].runtime})`,Type:`Exit.Exit<${o[0].Type}, ${o[1].Type}, ${o[2].Type}>`,importDeclarations:['import * as Exit from "effect/Exit"']}),expected:"Exit",toCodec:([o,s,i])=>st()(kt([te({_tag:et("Success"),value:o}),te({_tag:et("Failure"),cause:iy(s,i)})]),ht({decode:(a)=>a._tag==="Success"?co(a.value):Hr(a.cause),encode:(a)=>Kt(a)?{_tag:"Success",value:a.value}:{_tag:"Failure",cause:a.cause}})),toArbitrary:([o,s,i])=>(a,c)=>{let u=ZL(s,i)(a,c),l=oB(a,o.terminal?.map((d)=>co(d)),u.terminal?.map((d)=>Hr(d))),f=a.oneof(o.arbitrary.map((d)=>co(d)),u.arbitrary.map((d)=>Hr(d)));return Jc(a,c,l,f)},toEquivalence:([o,s,i])=>{let a=YL(s,i);return(c,u)=>{if(c._tag!==u._tag)return!1;switch(c._tag){case"Success":return o(c.value,u.value);case"Failure":return a(c.cause,u.cause)}}},toFormatter:([o,s,i])=>{let a=XL(s,i);return(c)=>{switch(c._tag){case"Success":return`Exit.Success(${o(c.value)})`;case"Failure":return`Exit.Failure(${a(c.cause)})`}}}});return K(r.ast,{value:e,error:t,defect:n})}function oB(e,t,n){return t===void 0?n:n===void 0?t:e.oneof(t,n)}function Jc(e,t,n,r){return{arbitrary:n===void 0||t.recursion===void 0?r:e.oneof(t.recursion,n,r),terminal:n}}function T2(e,t,n,r){return r===void 0?e.array(t,n):e.uniqueArray(t,{...n,comparator:r})}function hy(e,t,n,r,o,s){let i=t.constraint,a=i===void 0||i.minLength===void 0&&i.maxLength===void 0?void 0:{...i.minLength!==void 0?{minLength:i.minLength}:{},...i.maxLength!==void 0?{maxLength:i.maxLength}:{}};if(a?.minLength!==void 0&&a.maxLength!==void 0&&a.minLength>a.maxLength)throw new globalThis.Error("Unable to derive an arbitrary for size constraints");let c=a?.minLength??0,u=c===0?e.constant([]):r===void 0?void 0:T2(e,r,{...a,maxLength:c},s),l=Jc(e,t,u,T2(e,n,a,s));return{arbitrary:l.arbitrary.map(o),terminal:l.terminal?.map(o)}}function sB(e,t,n,r,o){return hy(e,t,e.tuple(n.arbitrary,r.arbitrary),n.terminal===void 0||r.terminal===void 0?void 0:e.tuple(n.terminal,r.terminal),o,([s],[i])=>ee(s,i))}function iB(e,t){let n=Ir()([e,t],([r,o])=>{let s=je(Ql([r,o]));return(i,a,c)=>{if(i instanceof globalThis.Map)return mn(Nt(s)([...i],c),{onSuccess:(u)=>new globalThis.Map(u),onFailure:(u)=>Er(a,"entries",u,i,c)});return R(new bt(a,i,c))}},{representation:{id:"effect/schema/ReadonlyMap",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.ReadonlyMap(${r[0].runtime}, ${r[1].runtime})`,Type:`globalThis.ReadonlyMap<${r[0].Type}, ${r[1].Type}>`}),expected:"ReadonlyMap",toCodec:([r,o])=>st()(je(Ql([r,o])),ht({decode:(s)=>new globalThis.Map(s),encode:(s)=>[...s.entries()]})),toArbitrary:([r,o])=>(s,i)=>sB(s,i,r,o,(a)=>new globalThis.Map(a)),toEquivalence:([r,o])=>Km(r,o),toFormatter:([r,o])=>(s)=>{let i=s.size;if(i===0)return"ReadonlyMap(0) {}";let a=globalThis.Array.from(s.entries()).sort().map(([c,u])=>`${r(c)} => ${o(u)}`);return`ReadonlyMap(${i}) { ${a.join(", ")} }`}});return K(n.ast,{key:e,value:t})}function _2(e,t,n){return te({type:et(e),nodes:je(te({index:_n,data:t})),edges:je(te({index:_n,source:_n,target:_n,data:n}))})}function O2(e,t){let n=-1,r=new Set;for(let o=0;o<e.nodes.length;o++){let s=e.nodes[o].index;if(s<=n)return R(new Jt(["nodes",o,"index"],new Ie({expected:"a strictly increasing node index"},s,t)));n=s,r.add(s)}n=-1;for(let o=0;o<e.edges.length;o++){let s=e.edges[o];if(s.index<=n)return R(new Jt(["edges",o,"index"],new Ie({expected:"a strictly increasing edge index"},s.index,t)));if(n=s.index,!r.has(s.source))return R(new Jt(["edges",o,"source"],new Ie({expected:"an encoded node index"},s.source,t)));if(!r.has(s.target))return R(new Jt(["edges",o,"target"],new Ie({expected:"an encoded node index"},s.target,t)))}return A(Rp(e))}function _X(e,t,n){if(!yv(e)||e.mutable||e.type!==t)return R(new Ie({expected:`an immutable ${t} Graph`},e,n));return A(Pp(e))}function OX(e,t){return(n,r)=>{let o=Pp(n),s=Pp(r);if(o.type!==s.type||o.nodes.length!==s.nodes.length||o.edges.length!==s.edges.length)return!1;for(let i=0;i<o.nodes.length;i++)if(o.nodes[i].index!==s.nodes[i].index||!e(o.nodes[i].data,s.nodes[i].data))return!1;for(let i=0;i<o.edges.length;i++){let a=o.edges[i],c=s.edges[i],u=o.type==="directed"?a.source===c.source&&a.target===c.target:a.source===c.source&&a.target===c.target||a.source===c.target&&a.target===c.source;if(a.index!==c.index||!u||!t(a.data,c.data))return!1}return!0}}function PX(e,t,n){return(r,o)=>{let s=Rp({type:e,nodes:[],edges:[]}),i=r.constant(s),a=r.array(t.arbitrary).chain((c)=>{let u=c.map((f,d)=>({index:d,data:f}));if(u.length===0)return i;let l=r.integer({min:0,max:u.length-1});return r.array(r.tuple(l,l,n.arbitrary)).map((f)=>Rp({type:e,nodes:u,edges:f.map(([d,m,y],b)=>({index:b,source:d,target:m,data:y}))}))});return Jc(r,o,i,a)}}function aB(e,t,n){let r=Ir()([t,n],([o,s])=>{let i=_2(e,o,s);return(a,c,u)=>{if(!yv(a)||a.mutable||a.type!==e)return R(new bt(c,a,u));return se(Nt(i)(Pp(a),u),(l)=>O2(l,u))}},{representation:{id:"effect/schema/Graph",payload:e},toCode:({typeParameters:o})=>({runtime:`Schema.Graph(${j(e)}, ${o[0].runtime}, ${o[1].runtime})`,Type:`Graph.Graph<${o[0].Type}, ${o[1].Type}, ${j(e)}>`,importDeclarations:['import * as Graph from "effect/Graph"']}),expected:`an immutable ${e} Graph`,toCodec:([o,s])=>st()(_2(e,o,s),Qr({decode:O2,encode:(i,a)=>_X(i,e,a)})),toArbitrary:([o,s])=>PX(e,o,s),toEquivalence:([o,s])=>OX(o,s),toFormatter:()=>globalThis.String});return K(r.ast,{type:e,node:t,edge:n})}function cB(e,t){let n=Ir()([e,t],([r,o])=>{let s=je(Ql([r,o]));return(i,a,c)=>{if($$(i))return mn(Nt(s)(Wx(i),c),{onSuccess:Hx,onFailure:(u)=>Er(a,"entries",u,i,c)});return R(new bt(a,i,c))}},{representation:{id:"effect/schema/HashMap",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.HashMap(${r[0].runtime}, ${r[1].runtime})`,Type:`HashMap.HashMap<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as HashMap from "effect/HashMap"']}),expected:"HashMap",toCodec:([r,o])=>st()(je(Ql([r,o])),ht({decode:Hx,encode:Wx})),toArbitrary:([r,o])=>(s,i)=>sB(s,i,r,o,Hx),toEquivalence:([r,o])=>Km(r,o),toFormatter:([r,o])=>(s)=>{let i=U$(s);if(i===0)return"HashMap(0) {}";let a=Wx(s).sort().map(([c,u])=>`${r(c)} => ${o(u)}`);return`HashMap(${i}) { ${a.join(", ")} }`}});return K(n.ast,{key:e,value:t})}function uB(e){let t=Ir()([e],([n])=>{let r=je(n);return(o,s,i)=>{if(o instanceof globalThis.Set)return mn(Nt(r)([...o],i),{onSuccess:(a)=>new globalThis.Set(a),onFailure:(a)=>Er(s,"values",a,o,i)});return R(new bt(s,o,i))}},{representation:{id:"effect/schema/ReadonlySet",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.ReadonlySet(${n[0].runtime})`,Type:`globalThis.ReadonlySet<${n[0].Type}>`}),expected:"ReadonlySet",toCodec:([n])=>st()(je(n),ht({decode:(r)=>new globalThis.Set(r),encode:(r)=>[...r.values()]})),toArbitrary:([n])=>(r,o)=>hy(r,o,n.arbitrary,n.terminal,(s)=>new globalThis.Set(s),ee),toEquivalence:([n])=>Gm(n),toFormatter:([n])=>(r)=>{let o=r.size;if(o===0)return"ReadonlySet(0) {}";let s=globalThis.Array.from(r.values()).sort().map((i)=>`${n(i)}`);return`ReadonlySet(${o}) { ${s.join(", ")} }`}});return K(t.ast,{value:e})}function lB(e){let t=Ir()([e],([n])=>{let r=je(n);return(o,s,i)=>{if(q$(o))return mn(Nt(r)(on(o),i),{onSuccess:qx,onFailure:(a)=>Er(s,"values",a,o,i)});return R(new bt(s,o,i))}},{representation:{id:"effect/schema/HashSet",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.HashSet(${n[0].runtime})`,Type:`HashSet.HashSet<${n[0].Type}>`}),expected:"HashSet",toCodec:([n])=>st()(je(n),ht({decode:qx,encode:on})),toArbitrary:([n])=>(r,o)=>hy(r,o,n.arbitrary,n.terminal,qx,ee),toEquivalence:([n])=>Gm(n),toFormatter:([n])=>(r)=>{let o=z$(r);if(o===0)return"HashSet(0) {}";let s=globalThis.Array.from(r).sort().map((i)=>`${n(i)}`);return`HashSet(${o}) { ${s.join(", ")} }`}});return K(t.ast,{value:e})}function fB(e){let t=Ir()([e],([n])=>{let r=je(n);return(o,s,i)=>{if(Mg(o))return mn(Nt(r)(on(o),i),{onSuccess:Dg,onFailure:(a)=>Er(s,"values",a,o,i)});return R(new bt(s,o,i))}},{representation:{id:"effect/schema/Chunk",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Chunk(${n[0].runtime})`,Type:`Chunk.Chunk<${n[0].Type}>`}),expected:"Chunk",toCodec:([n])=>st()(je(n),ht({decode:Dg,encode:on})),toArbitrary:([n])=>(r,o)=>hy(r,o,n.arbitrary,n.terminal,Dg),toEquivalence:([n])=>bk(n),toFormatter:([n])=>(r)=>{let o=eF(r);if(o===0)return"Chunk(0) {}";let s=globalThis.Array.from(r).sort().map((i)=>`${n(i)}`);return`Chunk(${o}) { ${s.join(", ")} }`}});return K(t.ast,{value:e})}function mI(e,t,n){let r={...t};if(e?.minimum!==void 0){let o=n===void 0?e.minimum:n(e.minimum),s=e.exclusiveMinimum?new globalThis.Date(o.getTime()+1):o;if(r.min===void 0||s.getTime()>r.min.getTime())r.min=s}if(e?.maximum!==void 0){let o=n===void 0?e.maximum:n(e.maximum),s=e.exclusiveMaximum?new globalThis.Date(o.getTime()-1):o;if(r.max===void 0||s.getTime()<r.max.getTime())r.max=s}return r}function ay(e,t){return wa(e,t).value}function KX(e,t,n){return n?ay(hC(e,t),t)+globalThis.BigInt(1):ay(mC(e,t),t)}function GX(e,t,n){return n?ay(mC(e,t),t)-globalThis.BigInt(1):ay(hC(e,t),t)}function JX(e){return Math.max(xB,e.minimum?.scale??0,e.maximum?.scale??0,e.exclusiveMinimum&&e.minimum!==void 0?e.minimum.scale+1:0,e.exclusiveMaximum&&e.maximum!==void 0?e.maximum.scale+1:0)}function Zv(e,t){let n={};if(e.minimum!==void 0)n.min=KX(e.minimum,t,e.exclusiveMinimum===!0);if(e.maximum!==void 0)n.max=GX(e.maximum,t,e.exclusiveMaximum===!0);if(n.min!==void 0&&n.max!==void 0&&n.min>n.max)return;return n}function QX(e){let t=JX(e);if(Zv(e,t)===void 0)throw new globalThis.Error(yB);let n=0,r=t;while(n<r){let o=n+Math.floor((r-n)/2);if(Zv(e,o)===void 0)n=o+1;else r=o}return{min:n,max:t}}function SB(e,t){return XX.pipe(pe(e,kD(t)))}function ree(e){return xI.pipe(pe(e,CD))}function see(e){return yI.pipe(pe(e,vD))}function wI(e,t,n,r,o){let s=Fee(n,t,r),i=IB(t),a=class extends e{constructor(...[c,u]){let f=u?.["~payload"],d=f?.token===Xv?f.value:n.make(c??{},u);super(d,{...u,disableChecks:!0,"~payload":{token:Xv,value:d}})}static[Gp]=Gp;get[i](){return i}static[Pee]=!0;static identifier=t;static fields=n.fields;static get ast(){return s(this).ast}static pipe(){return fe(this,arguments)}static rebuild(c){return s(this).rebuild(c)}static make(c,u){return new this(c,u)}static makeOption(c,u){return Vx(s(this))(c??{},u)}static makeEffect(c,u){return s(this).makeEffect(c??{},u)}static annotate(c){return this.rebuild(xo(this.ast,c))}static annotateKey(c){return this.rebuild(_p(this.ast,c))}static check(...c){return this.rebuild(Ss(this.ast,c))}static extend(c){return(u,l)=>{let f=um(u)?u:te(u),d={...n.fields,...f.fields},m=yx(d,n.ast.checks,{identifier:c});return wI(this,c,rI(Ss(m,f.ast.checks),d),l,o)}}static mapFields(c,u){return n.mapFields(c,u)}};if(o!==void 0)Object.assign(a.prototype,o(t));return a}function Ree(e){return new Ne(Ae((t)=>new e(t,{"~payload":{token:Xv,value:t}})),Ho())}function IB(e){return`~effect/Schema/Class/${e}`}function Fee(e,t,n){let r;return(o)=>{if(r!==void 0)return r;let s=IB(t),i=(u)=>u instanceof o||D(u,s),a=Ree(o),c=K(new Uc([e.ast],()=>(u,l,f)=>i(u)?A(u):R(new bt(l,u,f)),{identifier:t,[Kg]:([u])=>({isConstructed:i,link:new wt(u,a)}),toCodec:([u])=>new wt(u.ast,a),toArbitrary:([u])=>()=>({arbitrary:u.arbitrary.map((l)=>new o(l)),terminal:u.terminal?.map((l)=>new o(l))}),toFormatter:([u])=>(l)=>`${o.identifier}(${u(l)})`,[fp]:Rl(e.ast),...n}));return r=pe(c,a)(e)}}function um(e){return uy(e)}function Dee(e){let t=DU(e.ast);return(n)=>t(n,{})}function Nee(e){return(t)=>t.annotate({toFormatter:e})}function $ee(e,t){return n(e.ast);function n(o){let s=gs(o)?.toFormatter;if(typeof s==="function")return s(va(o)?o.typeParameters.map(n):[]);if(t?.onBefore){let i=t.onBefore(o,n);if(i!==void 0)return i}return r(o)}function r(o){switch(o._tag){default:return j;case"Never":return()=>"never";case"Void":return()=>"void";case"Arrays":{let s=o.elements.map(n),i=o.rest.map(n);return(a)=>{let c=[],u=0;for(;u<s.length;u++)if(a.length<u+1){if(Mt(o.elements[u]))continue}else c.push(s[u](a[u]));if(i.length>0){let[l,...f]=i;for(;u<a.length-f.length;u++)c.push(l(a[u]));for(let d=0;d<f.length;d++)c.push(f[d](a[u+d]))}return"["+c.join(", ")+"]"}}case"Objects":{let s=o.propertySignatures.map((a)=>n(a.type)),i=o.indexSignatures.map((a)=>n(a.type));if(o.propertySignatures.length===0&&o.indexSignatures.length===0)return j;return(a)=>{let c=[],u=new Set;for(let l=0;l<s.length;l++){let f=o.propertySignatures[l],d=f.name;if(u.add(d),Mt(f.type)&&!Object.hasOwn(a,d))continue;c.push(`${$s(d)}: ${s[l](a[d])}`)}for(let l=0;l<i.length;l++){let f=Nc(a,o.indexSignatures[l].parameter);for(let d of f){if(u.has(d))continue;u.add(d),c.push(`${$s(d)}: ${i[l](a[d])}`)}}return c.length>0?"{ "+c.join(", ")+" }":"{}"}}case"Union":{let s=Tn(o).types,i=(c)=>Cp(c,s),a=new Map(s.map((c,u)=>[c,[Lp(c),n(o.types[u])]]));return(c)=>{let u=i(c);for(let l=0;l<u.length;l++){let[f,d]=a.get(u[l]);if(f(c))return d(c)}return j(c)}}case"Suspend":{let s=Lc(()=>n(o.thunk()));return(i)=>s()(i)}}}}function Uee(e){return(t)=>t.annotate({toEquivalence:e})}function Lee(e){return $U(e.ast)}function Bee(e,t){return zv(e.ast,t)}function TB(e,t){let n=zv(yy(e.ast),t);return XU(n,t)}function _B(e){return K(yy(e.ast),{schema:e})}function kI(e){return e.constructorDefault===void 0?e:new jo(e.isOptional,e.isMutable,void 0,e.annotations)}function OB(e){if(e.propertySignatures.some((t)=>typeof t.name!=="string"))throw new globalThis.Error("Objects property names must be strings",{cause:e})}function PB(e){return(t)=>{let n=new Map;for(let s=0;s<t.length;s++)n.set(kr(t[s]),s);let r=[...t].sort((s,i)=>{s=kr(s),i=kr(i);let a=e(s),c=e(i);if(a!==c)return a-c;return n.get(s)-n.get(i)});if(!r.some((s,i)=>s!==t[i]))return t;return r}}function Wee(e,t){switch(e._tag){case"Declaration":{let n=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!Mn(n))return ot(e,[ev]);let r=e.typeParameters.map((s)=>Hp(kr(s))),o=n(r);return o===void 0?e:ot(e,[Nl(o,t)])}case"Unknown":return ot(e,[ev]);case"ObjectKeyword":return ot(e,[AN]);case"Undefined":case"Void":case"Literal":case"Number":return e.toCodecJson();case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return OB(e),e.recur(t,Tx);case"Union":{let n=Hee(e.types);if(n!==e.types)return new ir(n,e.mode,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t);return e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}function RB(e){return K(FB(Tn(e.ast)))}function jee(e,t){switch(e._tag){case"Declaration":{let n=e.annotations?.toCodecIso??e.annotations?.toCodec;if(Mn(n)){let r=n(e.typeParameters.map((o)=>Hp(o)));return ot(e,[Nl(r,t)])}return e}case"Arrays":case"Objects":case"Union":case"Suspend":return e.recur(t)}return e}function lm(e){return K(NB(e.ast),{schema:e})}function qee(e){return K($B(e.ast))}function zee(e,t){let n=vl(e.ast)??Hk(e.ast),r=H2(lm(e));return(o)=>r(o).pipe(ae((s)=>Vee(s,{rootName:n,...t})))}function Vee(e,t){let n=t.rootName??"root",r=t.arrayItemName??"item",o=t.pretty??!0,s=t.indent??" ",i=t.sortKeys??!0,a=new Set,c=[];return l(n,e,0),c.join(o?`
|
|
36
|
-
`:"");function u(f,d){c.push(o?s.repeat(f)+d:d)}function l(f,d,m,y){let{attrs:b,safe:E}=Jl.tagInfo(f,y);if(d===void 0)u(m,`<${E}${b}/>`);else if(typeof d==="string")u(m,`<${E}${b}>${Jl.escapeText(d)}</${E}>`);else if(typeof d!=="object"||d===null)u(m,`<${E}${b}>${Jl.escapeText(j(d))}</${E}>`);else{if(a.has(d))throw new globalThis.Error("Cycle detected while serializing to XML.",{cause:d});a.add(d);try{if(globalThis.globalThis.Array.isArray(d)){if(d.length===0){u(m,`<${E}${b}/>`);return}u(m,`<${E}${b}>`);for(let g of d)l(r,g,m+1);u(m,`</${E}>`);return}let w=d,k=Object.keys(w);if(i)k.sort();if(k.length===0){u(m,`<${E}${b}/>`);return}u(m,`<${E}${b}>`);for(let g of k)l(Jl.parseTagName(g).safe,w[g],m+1,g);u(m,`</${E}>`)}finally{a.delete(d)}}}}function Gee(e,t,n){switch(e._tag){case"Declaration":{let r=e.typeParameters.map((u)=>K(t(kr(u)))),o=e.annotations?.toCodecStringTree;if(Mn(o)){let u=o(r);if(u===void 0)return e;return ot(e,[Nl(u,t)])}let s=e.annotations?.toCodecJson,i=Mn(s)?s(r):void 0,a=i===void 0?e.annotations?.toCodec:void 0,c=i??(Mn(a)?a(r):void 0);return c===void 0?n(e):ot(e,[Nl(c,t)])}case"Null":return ot(e,[Jee]);case"Boolean":return ot(e,[Qee]);case"Unknown":case"ObjectKeyword":return ot(e,[tv]);case"Enum":case"Number":case"Literal":case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return OB(e),e.recur(t,Tx);case"Union":{let r=Kee(e.types);if(r!==e.types)return new ir(r,e.mode,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t);return e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}function Zee(e){return e._tag==="Declaration"||e._tag==="Arrays"||e._tag==="Objects"||e._tag==="Union"||e._tag==="Suspend"?e.recur($B):e}function cte(e){let t=RB(e);return u2(Pv(t),_v(t))}function ute(e){return ry()}function lte(e){return ry()}function fte(e,t){return(n)=>K(xo(n.ast,{toCodecIso:()=>new wt(e.ast,lx(t))}),{schema:n})}function dte(e){let t=_B(e),n=Pv(t),r=_v(t);return{empty:[],diff:(o,s)=>r2(n(o),n(s)),combine:(o,s)=>[...o,...s],patch:(o,s)=>{let i=n(o),a=o2(s,i);return Object.is(a,i)?o:r(a)}}}function pte(e){let t=Z2(()=>n),n=kt([e,je(t),fy(Q,t)]);return n}function yte(e){return gs(e.ast)}function Ste(e){return e.ast.context?.annotations}var Gp,Jp="~effect/SchemaError/SchemaError",Kc,Zp,wY,kY,CY,vY,IY,AY,TY,_Y,H2,OY,PY,RY,FY,MY,DY,K,vi,NY,cr,$Y,UY,LY,ur,ef,Qp="~effect/Schema/flip",qY,zY,tI,Le,nI,Q,Yp,ly,K2,ks,VY,KY,QY=(e)=>typeof e==="symbol"?e:globalThis.String(e),je,t7,o7,oI,dy,Q2,it,E2="^\\S[\\s\\S]*\\S$|^\\S$|^$",y7,S7,E7,b7,w7,k7,C7=(e)=>{if(e)return new globalThis.RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$/},v7,b2,I7,A7,T7,_7,O7,P7,R7,w2="^[^a-z]*$",F7,k2="^[^A-Z]*$",M7,C2="^[^a-z]?.*$",D7,v2="^[^A-Z]?.*$",N7,Cr,bL,$7,kL,U7,uI,L7,CL,B7,vL,H7,om,W7,IL,j7,q7,Cs,_n,AL,TL,_L,OL,PL,RL,FL,ML,DL,NL,K7,G7,J7,Q7,Z7,Y7,X7,eX,tX,nX,rX,oX,sX,iX,aX,cX,VL,uX,lX,xX,yX,SX,EX,wX,kX,CX,vX,eB=(e)=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),tB=(e)=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},I2,IX,A2,AX,TX,RX,FX,MX,DX,NX,dB,$X,pB,gy,UX,LX,mB,vr,BX,HX,WX,im,jX,qX,hB,zX,VX,gB,xB=20,yB="Unable to derive an arbitrary for the ordered BigDecimal constraints",hI,ZX,YX,XX,eee,gI,tee,xI,nee,yI,oee,iee,aee,cee,EB,uee,lee,fee,dee,pee,Yv,mee,hee,bB,am,gee,xee,yee,See,cm,Eee,bee,wee,kee,wB,Cee,kB,SI,vee,Iee,CB,EI,Aee,Tee,vB,bI,_ee,Oee,Pee,Xv,AB=(e)=>(t,n)=>{let r=um(t)?t:te(t);return wI(Sh,e,r,n,(o)=>({toString(){return`${o}(${j({...this})})`}}))},Mee=(e)=>(t,n,r)=>{let o=um(n)?n.mapFields((s)=>({_tag:Ii(t),...s}),{unsafePreserveChecks:!0}):py(t,n);return AB(e??t)(o,r)},xy=(e)=>(t,n)=>{let r=um(t)?t:te(t);return wI(Bf,e,r,n,(s)=>({name:s}))},Qo=(e)=>(t,n,r)=>{let o=um(n)?n.mapFields((s)=>({_tag:Ii(t),...s}),{unsafePreserveChecks:!0}):py(t,n);return xy(e??t)(o,r)},yy,Hee,FB,Jl,Kee,Jee,Qee,MB,DB=(e)=>e.transformation===MB,NB,P2=(e)=>Mt(e)?$l(Ei):Ei,$B,Yee,Xee,ete,tte,nte,rte,ote,ste,ite,ate,fm,mte,hte,gte,UB,xte;var Qc=v(()=>{nr();gC();In();tF();Vu();nx();Yi();Re();wh();Pt();Ws();jr();Zn();ne();T$();L$();V$();pt();At();xv();ya();fU();NU();UU();e2();t2();_h();i2();Hv();pg();p2();Me();rc();ct();ge();TT();Kp();Wv();Bn();yh();bi();ax();Ea();Gx();px();Qx();Gp=Jx;Kc=class Kc extends Xi("SchemaError"){[Jp]=Jp;constructor(e){let t=ta();$r(0);try{super({issue:e})}finally{$r(t)}}get message(){return hM(this.issue)}toString(){return`SchemaError(${this.message})`}};Zp=J$,wY=Z$;kY=Ai;CY=$2,vY=Tv,IY=X$;AY=U2;TY=L2;_Y=B2;H2=cy;OY=W2,PY=Ov,RY=nU;FY=j2;MY=q2;DY=z2,K=Hp;vi=qn((e)=>K($l(e.ast),{schema:e})),NY=qn((e)=>e.schema),cr=qn((e)=>{let t=dy(e);return K(dN(e.ast),{schema:t})}),$Y=qn((e)=>e.schema.members[0]),UY=qn((e)=>K(GC(e.ast),{schema:e})),LY=qn((e)=>e.schema),ur=qn((e)=>K(Tn(e.ast),{schema:e})),ef=qn((e)=>K(kr(e.ast),{schema:e}));qY=K(WD),zY=K(qD),tI=K(Ei),Le=K(MC),nI=K(DC),Q=K(ys),Yp=K(LC),ly=K(YD),K2=K(eN),ks=K(nN),VY=K(BD),KY=K(KD);je=qn((e)=>K(new qo(!1,[],[e.ast]),{value:e})),t7=qn((e)=>K(new qo(!1,[e.ast],[e.ast]),{value:e}));o7=qn((e)=>K(new qo(!0,e.ast.elements,e.ast.rest),{schema:e}));oI=qn((e)=>kt([e,Le])),dy=qn((e)=>kt([e,nI])),Q2=qn((e)=>kt([e,Le,nI]));it=wx;y7=xe("effect/schema/isTrimmed",Le,({annotations:e})=>aI(e));S7=te({source:Q,flags:Q}).check(it((e)=>{let t=OE(()=>new globalThis.RegExp(e.source,e.flags));return rn(t)&&t.success.source===e.source&&t.success.flags===e.flags})),E7={id:"effect/schema/isPattern",payloadSchema:S7,revive:({annotations:e,payload:t})=>Gc(new globalThis.RegExp(t.source,t.flags),e)};b7=xe("effect/schema/isStringFinite",Le,({annotations:e})=>aL(e));w7=xe("effect/schema/isStringBigInt",Le,({annotations:e})=>cL(e));k7=xe("effect/schema/isStringSymbol",Le,({annotations:e})=>uL(e));v7=xe("effect/schema/isUUID",te({version:kt([Ti([1,2,3,4,5,6,7,8]),Le])}),({annotations:e,payload:t})=>lL(t.version??void 0,e)),b2=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;I7=xe("effect/schema/isGUID",Le,({annotations:e})=>fL(e));A7=xe("effect/schema/isULID",Le,({annotations:e})=>dL(e));T7=xe("effect/schema/isBase64",Le,({annotations:e})=>cI(e));_7=xe("effect/schema/isBase64Url",Le,({annotations:e})=>pL(e));O7=xe("effect/schema/isStartsWith",te({startsWith:Q}),({annotations:e,payload:t})=>mL(t.startsWith,e));P7=xe("effect/schema/isEndsWith",te({endsWith:Q}),({annotations:e,payload:t})=>hL(t.endsWith,e));R7=xe("effect/schema/isIncludes",te({includes:Q}),({annotations:e,payload:t})=>gL(t.includes,e));F7=xe("effect/schema/isUppercased",Le,({annotations:e})=>xL(e));M7=xe("effect/schema/isLowercased",Le,({annotations:e})=>yL(e));D7=xe("effect/schema/isCapitalized",Le,({annotations:e})=>SL(e));N7=xe("effect/schema/isUncapitalized",Le,({annotations:e})=>EL(e)),Cr=K(qC),bL=jC,$7=xe("effect/schema/isFinite",Le,({annotations:e})=>bL(e));kL=Xp({order:Mr,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThan",payload:{exclusiveMinimum:Zl(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${j(e)})`})})}),U7=xe("effect/schema/isGreaterThan",te({exclusiveMinimum:Cr}),({annotations:e,payload:t})=>kL(t.exclusiveMinimum,e)),uI=em({order:Mr,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:Zl(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${j(e)})`})})}),L7=xe("effect/schema/isGreaterThanOrEqualTo",te({minimum:Cr}),({annotations:e,payload:t})=>uI(t.minimum,e)),CL=tm({order:Mr,annotate:(e)=>({representation:{id:"effect/schema/isLessThan",payload:{exclusiveMaximum:Zl(e)}},toJsonSchema:()=>({exclusiveMaximum:e}),toCode:()=>({runtime:`Schema.isLessThan(${j(e)})`})})}),B7=xe("effect/schema/isLessThan",te({exclusiveMaximum:Cr}),({annotations:e,payload:t})=>CL(t.exclusiveMaximum,e)),vL=nm({order:Mr,annotate:(e)=>({representation:{id:"effect/schema/isLessThanOrEqualTo",payload:{maximum:Zl(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${j(e)})`})})}),H7=xe("effect/schema/isLessThanOrEqualTo",te({maximum:Cr}),({annotations:e,payload:t})=>vL(t.maximum,e)),om=rm({order:Mr,annotate:(e)=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetween",payload:{minimum:Zl(e.minimum),maximum:Zl(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?"exclusiveMinimum":"minimum"]:e.minimum,[n?"exclusiveMaximum":"maximum"]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${j(e.minimum)}, maximum: ${j(e.maximum)}, exclusiveMinimum: ${j(t)}, exclusiveMaximum: ${j(n)} })`})}}}),W7=xe("effect/schema/isBetween",te({minimum:Cr,maximum:Cr,exclusiveMinimum:cr(et(!0)),exclusiveMaximum:cr(et(!0))}),({annotations:e,payload:t})=>om(t,e)),IL=wL({remainder:JR,zero:0,annotate:(e)=>({expected:`a value that is a multiple of ${e}`,representation:{id:"effect/schema/isMultipleOf",payload:{divisor:e}},toJsonSchema:()=>({multipleOf:e}),toCode:()=>({runtime:`Schema.isMultipleOf(${j(e)})`})})}),j7=xe("effect/schema/isMultipleOf",te({divisor:Cr}),({annotations:e,payload:t})=>IL(t.divisor,e));q7=xe("effect/schema/isInt",Le,({annotations:e})=>sm(e)),Cs=Yp.check(sm()),_n=Cs.check(uI(0));AL=Xp({order:nc,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThanDate",payload:{exclusiveMinimum:Yl(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanDate(${Xl(e)})`})})}),TL=em({order:nc,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThanOrEqualToDate",payload:{minimum:Yl(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToDate(${Xl(e)})`})})}),_L=tm({order:nc,annotate:(e)=>({representation:{id:"effect/schema/isLessThanDate",payload:{exclusiveMaximum:Yl(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanDate(${Xl(e)})`})})}),OL=nm({order:nc,annotate:(e)=>({representation:{id:"effect/schema/isLessThanOrEqualToDate",payload:{maximum:Yl(e)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanOrEqualToDate(${Xl(e)})`})})}),PL=rm({order:nc,annotate:(e)=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenDate",payload:{minimum:Yl(e.minimum),maximum:Yl(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isBetweenDate({ minimum: ${Xl(e.minimum)}, maximum: ${Xl(e.maximum)}, exclusiveMinimum: ${j(t)}, exclusiveMaximum: ${j(n)} })`})}}}),RL=Xp({order:so,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThanBigInt",payload:{exclusiveMinimum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanBigInt(${j(e)})`})})}),FL=em({order:so,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThanOrEqualToBigInt",payload:{minimum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToBigInt(${j(e)})`})})}),ML=tm({order:so,annotate:(e)=>({representation:{id:"effect/schema/isLessThanBigInt",payload:{exclusiveMaximum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanBigInt(${j(e)})`})})}),DL=nm({order:so,annotate:(e)=>({representation:{id:"effect/schema/isLessThanOrEqualToBigInt",payload:{maximum:e.toString(10)}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isLessThanOrEqualToBigInt(${j(e)})`})})}),NL=rm({order:so,annotate:(e)=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenBigInt",payload:{minimum:e.minimum.toString(10),maximum:e.maximum.toString(10),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({}),toCode:()=>({runtime:`Schema.isBetweenBigInt({ minimum: ${j(e.minimum)}, maximum: ${j(e.maximum)}, exclusiveMinimum: ${j(t)}, exclusiveMaximum: ${j(n)} })`})}}}),K7=Xp({order:Si,formatter:(e)=>xs(e)}),G7=em({order:Si,formatter:(e)=>xs(e)}),J7=tm({order:Si,formatter:(e)=>xs(e)}),Q7=nm({order:Si,formatter:(e)=>xs(e)}),Z7=rm({order:Si,formatter:(e)=>xs(e)});Y7=xe("effect/schema/isMinLength",te({minLength:_n}),({annotations:e,payload:t})=>lI(t.minLength,e));X7=xe("effect/schema/isMaxLength",te({maxLength:_n}),({annotations:e,payload:t})=>UL(t.maxLength,e));eX=xe("effect/schema/isLengthBetween",te({minimum:_n,maximum:_n}),({annotations:e,payload:t})=>fI(t.minimum,t.maximum,e));tX=xe("effect/schema/isMinSize",te({minSize:_n}),({annotations:e,payload:t})=>LL(t.minSize,e));nX=xe("effect/schema/isMaxSize",te({maxSize:_n}),({annotations:e,payload:t})=>BL(t.maxSize,e));rX=xe("effect/schema/isSizeBetween",te({minimum:_n,maximum:_n}),({annotations:e,payload:t})=>HL(t.minimum,t.maximum,e));oX=xe("effect/schema/isMinProperties",te({minProperties:_n}),({annotations:e,payload:t})=>WL(t.minProperties,e));sX=xe("effect/schema/isMaxProperties",te({maxProperties:_n}),({annotations:e,payload:t})=>jL(t.maxProperties,e));iX=xe("effect/schema/isPropertiesLengthBetween",te({minimum:_n,maximum:_n}),({annotations:e,payload:t})=>qL(t.minimum,t.maximum,e));aX=xe("effect/schema/isPropertyNames",Le,({annotations:e,schemas:t})=>zL(t[0],e));cX=xe("effect/schema/isUnique",Le,({annotations:e})=>dI(e)),VL=Q.check($L()),uX=Q.check(fI(1,1));lX=ar("effect/schema/Option",Le,({annotations:e,typeParameters:t})=>{let n=Pa(t[0]);return e===void 0?n:n.annotate(e)});xX=ar("effect/schema/Result",Le,({annotations:e,typeParameters:t})=>{let n=KL(t[0],t[1]);return e===void 0?n:n.annotate(e)}),yX=Eo((e)=>{if(!Dn(e))return!1;let t=globalThis.Object.keys(e);return t.length>0&&t.every((n)=>{switch(n){case"label":return typeof e[n]==="string";case"disallowJsonEncode":return e[n]===!0;default:return!1}})}),SX=kt([Le,yX]);EX=ar("effect/schema/Redacted",SX,({annotations:e,payload:t,typeParameters:n})=>{let r=my(n[0],t??void 0);return e===void 0?r:r.annotate(e)});wX=ar("effect/schema/CauseReason",Le,({annotations:e,typeParameters:t})=>{let n=sy(t[0],t[1]);return e===void 0?n:n.annotate(e)});kX=ar("effect/schema/Cause",Le,({annotations:e,typeParameters:t})=>{let n=iy(t[0],t[1]);return e===void 0?n:n.annotate(e)});CX=Eo((e)=>{if(!Dn(e))return!1;let t=globalThis.Object.keys(e);return t.length>0&&t.every((n)=>(n==="includeStack"||n==="excludeCause")&&e[n]===!0)}),vX=kt([Le,CX]),I2=[];IX=ar("effect/schema/Error",vX,({annotations:e,payload:t})=>{let n=nB(t??void 0);return e===void 0?n:n.annotate(e)}),A2=[];AX=ar("effect/schema/Exit",Le,({annotations:e,typeParameters:t})=>{let n=rB(t[0],t[1],t[2]);return e===void 0?n:n.annotate(e)});TX=ar("effect/schema/ReadonlyMap",Le,({annotations:e,typeParameters:t})=>{let n=iB(t[0],t[1]);return e===void 0?n:n.annotate(e)});RX=ar("effect/schema/Graph",Ti(["directed","undirected"]),({annotations:e,payload:t,typeParameters:n})=>{let r=aB(t,n[0],n[1]);return e===void 0?r:r.annotate(e)});FX=ar("effect/schema/HashMap",Le,({annotations:e,typeParameters:t})=>{let n=cB(t[0],t[1]);return e===void 0?n:n.annotate(e)});MX=ar("effect/schema/ReadonlySet",Le,({annotations:e,typeParameters:t})=>{let n=uB(t[0]);return e===void 0?n:n.annotate(e)});DX=ar("effect/schema/HashSet",Le,({annotations:e,typeParameters:t})=>{let n=lB(t[0]);return e===void 0?n:n.annotate(e)});NX=ar("effect/schema/Chunk",Le,({annotations:e,typeParameters:t})=>{let n=fB(t[0]);return e===void 0?n:n.annotate(e)}),dB=Oa(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>st()(te({source:Q,flags:Q}),Qr({decode:(e,t)=>Xt({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new Ie({expected:"valid RegExp source and flags"},e,t)}),encode:(e)=>A({source:e.source,flags:e.flags})})),toArbitrary:()=>(e)=>e.tuple(e.constantFrom(".",".*","\\d+","\\w+","[a-z]+","[A-Z]+","[0-9]+","^[a-zA-Z0-9]+$","^\\d{4}-\\d{2}-\\d{2}$"),e.uniqueArray(e.constantFrom("g","i","m","s","u","y"),{minLength:0,maxLength:6}).map((t)=>t.join(""))).map(([t,n])=>new globalThis.RegExp(t,n)),toEquivalence:()=>(e,t)=>e.source===t.source&&e.flags===t.flags}),$X=zn("effect/schema/RegExp",dB),pB=Q.annotate({expected:"a string that will be decoded as a URL"}),gy=Oa(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>st()(pB,yC),toArbitrary:()=>(e)=>e.webUrl().map((t)=>new globalThis.URL(t)),toEquivalence:()=>(e,t)=>e.toString()===t.toString()}),UX=zn("effect/schema/URL",gy),LX=pB.pipe(pe(gy,yC));mB=Q.annotate({expected:"a string that will be decoded as a Date"}),vr=Eo((e)=>e instanceof globalThis.Date&&!globalThis.Number.isNaN(e.getTime()),{representation:{id:"effect/schema/Date",payload:null},toCode:()=>({runtime:"Schema.Date",Type:"globalThis.Date"}),expected:"a valid Date",toCodecJson:()=>st()(mB,xC),toArbitrary:()=>(e,t)=>e.date(mI(t?.constraint?.ordered?.order===nc?t.constraint.ordered:void 0,{noInvalidDate:!0}))}),BX=zn("effect/schema/Date",vr),HX=mB.pipe(pe(vr,xC)),WX=Cs.pipe(pe(vr,sD)),im=Eo(HE,{representation:{id:"effect/schema/Duration",payload:null},toCode:()=>({runtime:"Schema.Duration",Type:"Duration.Duration",importDeclarations:['import * as Duration from "effect/Duration"']}),expected:"Duration",toCodecJson:()=>st()(kt([te({_tag:et("Infinity")}),te({_tag:et("NegativeInfinity")}),te({_tag:et("Nanos"),value:ks}),te({_tag:et("Millis"),value:Cs})]),ht({decode:(e)=>{switch(e._tag){case"Infinity":return Gs;case"NegativeInfinity":return lc;case"Nanos":return io(e.value);case"Millis":return Zi(e.value)}},encode:(e)=>{switch(e.value._tag){case"Infinity":return{_tag:"Infinity"};case"NegativeInfinity":return{_tag:"NegativeInfinity"};case"Nanos":return{_tag:"Nanos",value:e.value.nanos};case"Millis":return{_tag:"Millis",value:e.value.millis}}}})),toArbitrary:()=>(e)=>e.oneof(e.constant(Gs),e.constant(lc),e.bigInt().map(io),e.maxSafeInteger().map(Zi)),toFormatter:()=>globalThis.String,toEquivalence:()=>WE}),jX=zn("effect/schema/Duration",im),qX=Q.annotate({expected:"a string that will be decoded as a Duration"}),hB=qX.pipe(pe(im,iD)),zX=ks.pipe(pe(im,aD)),VX=Yp.pipe(pe(im,cD)),gB=Q.annotate({expected:"a string that will be decoded as a BigDecimal"});hI=Eo(ux,{representation:{id:"effect/schema/BigDecimal",payload:null},toCode:()=>({runtime:"Schema.BigDecimal",Type:"BigDecimal.BigDecimal",importDeclarations:['import * as BigDecimal from "effect/BigDecimal"']}),expected:"BigDecimal",toCodecJson:()=>st()(gB,SC),toArbitrary:()=>(e,t)=>{let n=t.constraint?.ordered?.order===Si?t.constraint.ordered:void 0;if(n===void 0)return e.tuple(e.bigInt(),e.integer({min:0,max:xB})).map(([r,o])=>wr(r,o));return e.integer(QX(n)).chain((r)=>{let o=Zv(n,r);if(o===void 0)throw new globalThis.Error(yB);return e.bigInt(o).map((s)=>wr(s,r))})},toFormatter:()=>(e)=>xs(e),toEquivalence:()=>dC}),ZX=zn("effect/schema/BigDecimal",hI),YX=gB.pipe(pe(hI,SC)),XX=Q.annotate({expected:"a string that will be decoded as JSON",contentMediaType:"application/json"});eee=SB(tI),gI=Oa(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>st()(te({data:Q.check(cI()),type:Q,name:Q,lastModified:Cs}),Qr({decode:(e,t)=>mr(Gu(e.data),{onFailure:()=>R(new Ie({expected:"a valid Base64 string"},e.data,t)),onSuccess:(n)=>{let r=new globalThis.Uint8Array(n);return A(new globalThis.File([r],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>fl({try:async()=>{let n=new globalThis.Uint8Array(await e.arrayBuffer());return{data:bh(n),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new Ie({expected:"a readable File"},e,t)})}))}),tee=zn("effect/schema/File",gI),xI=Oa(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>st()(je(Ql([Q,kt([te({_tag:Ii("String"),value:Q}),te({_tag:Ii("File"),value:gI})])])),Qr({decode:(e)=>{let t=new globalThis.FormData;for(let[n,r]of e)t.append(n,r.value);return A(t)},encode:(e)=>A(globalThis.Array.from(e.entries()).map(([t,n])=>{if(typeof n==="string")return[t,{_tag:"String",value:n}];else return[t,{_tag:"File",value:n}]}))}))}),nee=zn("effect/schema/FormData",xI);yI=Oa(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>st()(Q.annotate({expected:"a query string that will be decoded as URLSearchParams"}),ht({decode:(e)=>new globalThis.URLSearchParams(e),encode:(e)=>e.toString()}))}),oee=zn("effect/schema/URLSearchParams",yI);iee=Q.annotate({expected:"a string that will be decoded as a number"}).pipe(pe(Yp,Ol)),aee=Q.annotate({expected:"a string that will be decoded as a finite number"}).pipe(pe(Cr,Ol)),cee=K(YC).pipe(pe(ks,dx)),EB=Q.check(aI()),uee=Q.annotate({expected:"a string that will be decoded as a trimmed string"}).pipe(pe(EB,oD())),lee=Q.annotate({expected:"a base64 encoded string that will be decoded as a UTF-8 string"}).pipe(pe(Q,SD)),fee=Q.annotate({expected:"a base64 (URL) encoded string that will be decoded as a UTF-8 string"}).pipe(pe(Q,ED)),dee=Q.annotate({expected:"a hex encoded string that will be decoded as a UTF-8 string"}).pipe(pe(Q,bD)),pee=Q.annotate({expected:"a URI component encoded string that will be decoded as a UTF-8 string"}).pipe(pe(Q,wD)),Yv=kt([Cr,K2,Q]),mee=te({issues:je(te({message:Q,path:cr(je(kt([Yv,te({key:Yv})])))}))}),hee=Ti([0,1]).pipe(pe(ly,ht({decode:(e)=>e===1,encode:(e)=>e?1:0}))),bB=Q.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),am=Oa(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>st()(bB,EC),toArbitrary:()=>(e)=>e.uint8Array()}),gee=zn("effect/schema/Uint8Array",am),xee=bB.pipe(pe(am,EC)),yee=Q.annotate({expected:"a base64 (URL) encoded string that will be decoded as a Uint8Array"}).pipe(pe(am,{decode:$M(),encode:sx()})),See=Q.annotate({expected:"a hex encoded string that will be decoded as a Uint8Array"}).pipe(pe(am,{decode:LM(),encode:ix()})),cm=Eo((e)=>Yk(e)&&EM(e),{representation:{id:"effect/schema/DateTimeUtc",payload:null},toCode:()=>({runtime:"Schema.DateTimeUtc",Type:"DateTime.Utc",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Utc",toCodecJson:()=>st()(Q,kC),toArbitrary:()=>(e,t)=>e.date(mI(t?.constraint?.ordered?.order===eC?t.constraint.ordered:void 0,{noInvalidDate:!0},ex)).map((n)=>wM(n)),toFormatter:()=>(e)=>e.toString(),toEquivalence:()=>Xk}),Eee=zn("effect/schema/DateTimeUtc",cm),bee=vr.pipe(pe(cm,{decode:cC(),encode:Ae(ex)})),wee=Q.annotate({expected:"a string that will be decoded as a DateTime.Utc"}).pipe(pe(cm,kC)),kee=Cs.pipe(pe(cm,{decode:cC(),encode:Ae(AM)})),wB=Eo(yM,{representation:{id:"effect/schema/TimeZoneOffset",payload:null},toCode:()=>({runtime:"Schema.TimeZoneOffset",Type:"DateTime.TimeZone.Offset",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone.Offset",toCodecJson:()=>st()(Cs,ID),toArbitrary:()=>(e)=>e.integer({min:-43200000,max:50400000}).map((t)=>xp(t)),toFormatter:()=>(e)=>ba(e),toEquivalence:()=>(e,t)=>e.offset===t.offset}),Cee=zn("effect/schema/TimeZoneOffset",wB),kB=Q.annotate({expected:"an IANA time zone identifier"}),SI=Eo(SM,{representation:{id:"effect/schema/TimeZoneNamed",payload:null},toCode:()=>({runtime:"Schema.TimeZoneNamed",Type:"DateTime.TimeZone.Named",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone.Named",toCodecJson:()=>st()(kB,bC),toArbitrary:()=>(e)=>e.constantFrom(...["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"].map(tC)),toFormatter:()=>(e)=>ba(e),toEquivalence:()=>(e,t)=>e.id===t.id}),vee=zn("effect/schema/TimeZoneNamed",SI),Iee=kB.pipe(pe(SI,bC)),CB=Q.annotate({expected:"a time zone string (IANA identifier or offset like +03:00)"}),EI=Eo(xM,{representation:{id:"effect/schema/TimeZone",payload:null},toCode:()=>({runtime:"Schema.TimeZone",Type:"DateTime.TimeZone",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone",toCodecJson:()=>st()(CB,wC),toArbitrary:()=>(e)=>e.oneof(e.integer({min:-43200000,max:50400000}).map((t)=>xp(t)),e.constantFrom(...["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"].map(tC))),toFormatter:()=>(e)=>ba(e),toEquivalence:()=>(e,t)=>ba(e)===ba(t)}),Aee=zn("effect/schema/TimeZone",EI),Tee=CB.pipe(pe(EI,wC)),vB=Q.annotate({expected:"a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])"}),bI=Eo((e)=>Yk(e)&&bM(e),{representation:{id:"effect/schema/DateTimeZoned",payload:null},toCode:()=>({runtime:"Schema.DateTimeZoned",Type:"DateTime.Zoned",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Zoned",toCodecJson:()=>st()(vB,CC),toArbitrary:()=>(e,t)=>e.tuple(e.date(mI(t?.constraint?.ordered?.order===eC?t.constraint.ordered:void 0,{max:new globalThis.Date(8639999949600000),min:new globalThis.Date(-8639999949600000),noInvalidDate:!0},ex)),e.constantFrom("UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney")).map(([n,r])=>kM(n,{timeZone:r})),toFormatter:()=>(e)=>tx(e),toEquivalence:()=>Xk}),_ee=zn("effect/schema/DateTimeZoned",bI),Oee=vB.pipe(pe(bI,CC)),Pee=globalThis.Symbol.for("immer-draftable"),Xv={};yy=Bc((e)=>{let t=Wee(e,yy),n=e.context;if(t===e||n===void 0)return t;return vx(t,kI(n))});Hee=PB((e)=>{switch(e._tag){case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});FB=bn((e)=>{let t=jee(e,FB);return t!==e&&e.context!==void 0?vx(t,kI(e.context)):t});Jl={escapeText(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},escapeAttribute(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},parseTagName(e){let t=e,n=e;if(!/^[A-Za-z_]/.test(n))n="_"+n;if(n=n.replace(/[^A-Za-z0-9._-]/g,"_"),/^xml/i.test(n))n="_"+n;return{safe:n,changed:n!==t}},tagInfo(e,t){let{changed:n,safe:r}=Jl.parseTagName(e),s=n||t&&t!==e?` data-name="${Jl.escapeAttribute(t??e)}"`:"";return{safe:r,attrs:s}}},Kee=PB((e)=>{switch(e._tag){case"Null":case"Boolean":case"Number":case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});Jee=new wt(new Zr("null"),new Ne(Ae(()=>null),Ae(()=>"null"))),Qee=new wt(new ir([new Zr("true"),new Zr("false")],"anyOf"),new Ne(Ae((e)=>e==="true"),Dc())),MB=new Ne(Ae((e)=>typeof e==="string"?[e]:e),Ho()),NB=Bc((e)=>{let t=Gee(e,NB,(n)=>{throw new globalThis.Error("Missing structural codec for StringTree",{cause:n})});if(t!==e&&e.context!==void 0)return vx(t,kI(e.context));return t},{stopAt:DB}),$B=Bc((e)=>{let t=Zee(e);if(FC(t)){let n=Ix(new ir([new qo(t.isMutable,t.elements.map(P2),t.rest.map(P2)),ys],"anyOf"),t,MB);return Mt(e)?$l(n):n}return t},{stopAt:DB});Yee=xe("effect/schema/isGreaterThanDate",te({exclusiveMinimum:vr}),({annotations:e,payload:t})=>AL(t.exclusiveMinimum,e)),Xee=xe("effect/schema/isGreaterThanOrEqualToDate",te({minimum:vr}),({annotations:e,payload:t})=>TL(t.minimum,e)),ete=xe("effect/schema/isLessThanDate",te({exclusiveMaximum:vr}),({annotations:e,payload:t})=>_L(t.exclusiveMaximum,e)),tte=xe("effect/schema/isLessThanOrEqualToDate",te({maximum:vr}),({annotations:e,payload:t})=>OL(t.maximum,e)),nte=xe("effect/schema/isBetweenDate",te({minimum:vr,maximum:vr,exclusiveMinimum:cr(et(!0)),exclusiveMaximum:cr(et(!0))}),({annotations:e,payload:t})=>PL(t,e)),rte=xe("effect/schema/isGreaterThanBigInt",te({exclusiveMinimum:ks}),({annotations:e,payload:t})=>RL(t.exclusiveMinimum,e)),ote=xe("effect/schema/isGreaterThanOrEqualToBigInt",te({minimum:ks}),({annotations:e,payload:t})=>FL(t.minimum,e)),ste=xe("effect/schema/isLessThanBigInt",te({exclusiveMaximum:ks}),({annotations:e,payload:t})=>ML(t.exclusiveMaximum,e)),ite=xe("effect/schema/isLessThanOrEqualToBigInt",te({maximum:ks}),({annotations:e,payload:t})=>DL(t.maximum,e)),ate=xe("effect/schema/isBetweenBigInt",te({minimum:ks,maximum:ks,exclusiveMinimum:cr(et(!0)),exclusiveMaximum:cr(et(!0))}),({annotations:e,payload:t})=>NL(t,e));fm=K(xo(Ml,{toCode:()=>({runtime:"Schema.Json",Type:"Schema.Json"})})),mte=fy(Q,fm),hte=zn("effect/schema/Json",fm),gte=te({message:Q,name:vi(Q),stack:vi(Q),cause:vi(fm)}),UB=K(xo(IN,{toCode:()=>({runtime:"Schema.MutableJson",Type:"Schema.MutableJson"})})),xte=zn("effect/schema/MutableJson",UB)});var LB="~effect/platform/Terminal",CI="effect/platform/Terminal/QuitError",dm,BB=(e)=>D(e,CI),Zo,HB=(e)=>Zo.of({...e,[LB]:LB});var Sy=v(()=>{rt();ge();Qc();dm=class dm extends xy("QuitError")({_tag:Ii("QuitError")}){[CI]=CI};Zo=Ye("effect/platform/Terminal")});import*as Ey from"readline";function qB(e){return e.key.ctrl&&(e.key.name==="c"||e.key.name==="d")}var WB,jB;var zB=v(()=>{Re();cs();Me();ms();ge();op();KF();Sy();WB=q(function*(e=qB){let{stdin:t,stdout:n}=process,r=yield*wl(),o=t.readableEnded,s=!1,i=()=>{if(o=!0,!s)pi(r)};t.once("end",i),yield*Ig(()=>we(()=>t.off("end",i)));let a=yield*VF({acquire:po(we(()=>{let m=Ey.createInterface({input:t,escapeCodeTimeout:50}),y=(E)=>tp(r,E),b=()=>{s=!1,pi(r)};if(s=!0,Ey.emitKeypressEvents(t,m),m.on("line",y),m.once("close",b),t.isTTY)t.setRawMode(!0);return{rl:m,onClose:b,onLine:y}}),({rl:m,onClose:y,onLine:b})=>we(()=>{if(s=!1,m.off("line",b),m.off("close",y),t.isTTY)t.setRawMode(!1);if(m.close(),o)pi(r)})),idleTimeToLive:"10 millis"}),c=we(()=>n.columns??0),u=we(()=>n.rows??0),l=un(function*(){let m=yield*wl(),y=(w,k)=>{let g={input:zs(w),key:{name:k.name??"",ctrl:!!k.ctrl,meta:!!k.meta,shift:!!k.shift}};if(tp(m,g),e(g))pi(m)},b=setInterval(()=>{},2147483647),E=()=>{clearInterval(b),pi(m)};if(yield*Ig(()=>we(()=>{clearInterval(b),t.off("keypress",y),t.off("end",E)})),t.on("keypress",y),o)E();else yield*Mk(a),t.once("end",E);return m}),f=He(()=>xF(r).pipe(se(ut({onNone:()=>ma(Vr(Mk(a),mi(r))),onSome:A})),Gt(()=>new dm({}))));return HB({columns:c,rows:u,readInput:l,readLine:f,display:(m)=>Kd(Wn((y)=>{n.write(m,(b)=>MA(b)?y(Pe):y(R(li({module:"Terminal",method:"display",description:"Failed to write prompt to stdout",cause:b}))))}))})}),jB=il(Zo,WB(qB))});var VB;var KB=v(()=>{zB();VB=jB});var by={};Qn(by,{layer:()=>wte});var wte;var GB=v(()=>{cs();VN();s$();m$();y$();C$();KB();wte=jN.pipe(TR(ug(p$,o$,x$,k$,VB)))});var II=v(()=>{J1();GB()});var vs=v(()=>{In();Vu();Re();jr();Me();Bn();Qc()});var Zc="__tripwire_dynamic_shell_value__",AI=(e)=>({start:e.pos,end:e.end}),kte=(e)=>{let t=e.lastIndexOf("/");return t===-1?e:e.slice(t+1)},TI=()=>({aliases:new Map,backgroundPidAvailable:!1,bindings:new Map,functions:new Map,temps:new Map}),ln=(e)=>({aliases:new Map(e.aliases),backgroundPidAvailable:e.backgroundPidAvailable,bindings:new Map(e.bindings),functions:new Map(e.functions),temps:new Map(e.temps)}),_I=(e)=>e.type==="SingleQuoted"||e.type==="DoubleQuoted"||e.type==="AnsiCQuoted"||e.type==="LocaleString",QB=(e)=>e.every((t)=>{switch(t.type){case"Literal":case"SingleQuoted":case"AnsiCQuoted":return!0;case"DoubleQuoted":case"LocaleString":return QB(t.parts);case"SimpleExpansion":case"ParameterExpansion":case"CommandExpansion":case"ArithmeticExpansion":case"ProcessSubstitution":case"ExtendedGlob":case"BraceExpansion":return!1;default:return!1}}),_i=(e)=>QB(e.parts??[]),ZB=(e)=>{if(e===void 0||(e.errors?.length??0)>0||e.commands.length!==1)return null;let[t]=e.commands;if(t===void 0||t.background===!0||t.redirects.length>0)return null;let{command:n}=t;if(n.type!=="Command"||n.name===void 0||!_i(n.name))return null;if(n.prefix.length>0||n.suffix.some((r)=>!_i(r)))return null;return{command:n,head:kte(n.name.value),args:n.suffix.map((r)=>r.value)}},YB=(e)=>{let t=e.parts??[];if(t.length!==1)return;let[n]=t;if(n?.type==="CommandExpansion")return n.script;if(n?.type!=="DoubleQuoted"||n.parts.length!==1)return;let[r]=n.parts;return r?.type==="CommandExpansion"?r.script:void 0},XB=(e,t)=>e.command.name?.value.includes("/")===!1&&(t.aliases.has(e.head)||t.functions.has(e.head)),OI=(e,t)=>{let n=ZB(YB(e));if(n===null||XB(n,t))return null;if(n.head==="cat"&&n.args.length===0&&n.command.redirects.length===1){let[r]=n.command.redirects;if(r?.operator!=="<<"&&r?.operator!=="<<-")return null;if(r.heredocQuoted===!0||r.body===void 0||_i(r.body))return(r.content??"").replace(/\n+$/u,"");return null}if(n.head==="printf"&&n.args.length===2){let[r,o]=n.args;if(r==="%s"||r===String.raw`%s\n`)return o??""}return null},JB=(e)=>["/tmp","/private/tmp","/var/tmp","/private/var/tmp","/var/folders","/private/var/folders"].some((t)=>e===t||e.startsWith(`${t}/`)),Cte=(e)=>{let t=!1,n=null,r=[];for(let o=0;o<e.length;o+=1){let s=e[o];if(s==="-t")t=!0,o+=1;else if(s==="-p"||s==="--tmpdir")n=e[o+1]??"",o+=1;else if(s?.startsWith("--tmpdir=")===!0)n=s.slice(9);else if(s!==void 0&&!s.startsWith("-"))r.push(s)}return{explicitDirectory:n,positionals:r,systemTempTemplate:t}},eH=(e,t)=>{let n=ZB(YB(e));if(n?.head!=="mktemp"||XB(n,t)||["TMPDIR","TMP","TEMP"].some((a)=>t.bindings.has(a)||t.temps.has(a))||!n.args.some((a)=>a==="-d"||a==="--directory"||/^-[^-]*d/u.test(a)))return!1;let{explicitDirectory:r,positionals:o,systemTempTemplate:s}=Cte(n.args);if(r!==null&&!JB(r))return!1;if(o.length===0||s||r!==null)return!0;let[i]=o;return o.length===1&&i!==void 0&&JB(i)},tH=(e)=>{if(e.type==="SimpleExpansion")return/^\$(?<name>[A-Za-z_][A-Za-z0-9_]*|[0-9]+|!)$/u.exec(e.text)?.groups?.name??null;if(e.type==="ParameterExpansion"&&e.indirect!==!0&&e.length!==!0&&e.operator===void 0&&e.index===void 0&&e.slice===void 0&&e.replace===void 0&&/^(?:[A-Za-z_][A-Za-z0-9_]*|[0-9]+|!)$/u.test(e.parameter))return e.parameter;return null},nH=(e)=>{let t=[],n=(i,a)=>{for(let c of i)switch(c.type){case"Literal":case"SingleQuoted":case"AnsiCQuoted":{t.push({kind:"literal",value:c.value});break}case"DoubleQuoted":case"LocaleString":{if(!n(c.parts,!0))return!1;break}case"SimpleExpansion":case"ParameterExpansion":{let u=tH(c);if(u===null)return!1;t.push({kind:"variable",quoted:a,variable:u});break}case"ArithmeticExpansion":case"BraceExpansion":case"CommandExpansion":case"ExtendedGlob":case"ProcessSubstitution":return!1;default:return!1}return!0};if(!n(e.parts??[],!1))return null;let r=t.filter((i)=>i.kind==="variable");if(r.length!==1)return null;let[o]=r;if(o===void 0)return null;let s=t.indexOf(o);return{prefix:t.slice(0,s).map((i)=>i.kind==="literal"?i.value:"").join(""),quoted:o.quoted,suffix:t.slice(s+1).map((i)=>i.kind==="literal"?i.value:"").join(""),variable:o.variable}},vte=(e)=>{let t=e.parts??[];if(t.length!==1||t[0]?.type!=="DoubleQuoted")return null;let n=t[0].parts;if(n.length<1||n.length>2)return null;let[r]=n,o=r===void 0?null:tH(r);if(o===null)return null;let[,s]=n;if(s!==void 0&&s.type!=="Literal")return null;return{variable:o,suffix:s?.value??""}},rH=(e,t)=>{let n=vte(e);if(n===null||!t.temps.has(n.variable))return null;let{suffix:r,variable:o}=n;if(r!==""&&!r.startsWith("/")||r.split("/").includes("..")||r.includes("\x00"))return null;return{source:e.text,value:`/private/tmp/tripwire-provenance/${o}${r}`,kind:"trusted-temp-path",range:AI(e),quoted:!0,variable:o}},PI=(e,t)=>{let n=nH(e);if(n===null)return null;let{prefix:r,quoted:o,suffix:s,variable:i}=n,a=t.bindings.get(i);if(a===void 0||a.kind==="dynamic"||a.kind==="trusted-temp-path"||a.kind==="background-pid"&&(r!==""||s!=="")||s.split("/").includes("..")||r.split("/").includes(".."))return null;let c=`${r}${a.value}${s}`;if(!o&&(/\s/u.test(c)||c.includes("*")||c.includes("?")||c.includes("[")))return null;return{...a,source:e.text,value:c,range:AI(e),quoted:o,variable:i}},RI=(e,t)=>{let n=nH(e);if(!t.backgroundPidAvailable||n?.variable!=="!"||n.prefix!==""||n.suffix!=="")return null;return{source:e.text,value:"__tripwire_background_pid__",kind:"background-pid",range:AI(e),quoted:n.quoted,variable:"!"}};var tf=()=>{};function oH(e){return e>=48&&e<=55}function Ite(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Ate(e,t){try{return String.fromCodePoint(e)}catch{return t}}function FI(e,t,n){let r=t,o="";while(r<n&&e.charCodeAt(r)!==39){if(e.charCodeAt(r)!==92||r+1>=n){let c=r;while(r<n){let u=e.charCodeAt(r);if(u===39||u===92&&r+1<n)break;r++}o+=e.slice(c,r);continue}let i=r++,a=e[r++];switch(a){case"a":o+="\x07";break;case"b":o+="\b";break;case"e":case"E":o+="\x1B";break;case"f":o+="\f";break;case"n":o+=`
|
|
9
|
+
${s(u)}}`;f=i(l,h)}}return n.delete(l),f}return String(l)}return c(e,0)}function sa(e){return typeof e==="string"?JSON.stringify(e):String(e)}function wS(e){return e.map((t)=>`[${sa(t)}]`).join("")}function TS(e){try{return e.toISOString()}catch{return"Invalid Date"}}function J1(e){try{let t=e.toString();return typeof t==="string"?t:String(t)}catch{return"[toString threw]"}}function Ys(e,t){let r=[];return JSON.stringify(e,function(n,o){let s=Object.getOwnPropertyDescriptor(this,n)?.value,i=G(s,$c)?na(s):na(o);if(typeof i==="bigint")return he(i);if(typeof i!=="object"||i===null)return i;while(r.length>0&&r[r.length-1]!==this)r.pop();if(r.includes(i))return;return r.push(i),i},t?.space)??"null"}var H1="[Circular]";var on=E(()=>{ye();Yu()});var Hs,bn=(e)=>{try{if(e=na(e),G(e,"toJSON")&&io(e.toJSON)&&e.toJSON.length===0)return e.toJSON();else if(Array.isArray(e))return e.map(bn);return e}catch{return"[toJSON threw]"}},vS=(e,t=2)=>{if(typeof e==="string")return e;try{return typeof e==="object"?Ys(e,{space:t}):he(e,{space:t})}catch{return String(e)}},CS;var es=E(()=>{on();ye();Yu();Hs=Symbol.for("nodejs.util.inspect.custom"),CS={toJSON(){return bn(this)},[Hs](){return this.toJSON()},toString(){return he(this.toJSON())}}});var ts,eA=()=>{let t={["~effect/Utils/internal"]:(o)=>o()},r={["~effect/Utils/internal"]:(o)=>{try{return o()}finally{}}};return t["~effect/Utils/internal"](()=>Error().stack)?.includes("~effect/Utils/internal")===!0?t["~effect/Utils/internal"]:r["~effect/Utils/internal"]},mt;var Ac=E(()=>{ts=class ts{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 ts(this.self)}};mt=eA()});function Ar(e,t,r){if(t==="__proto__")Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0});else e[t]=r}function QS(e,t){for(let r of Reflect.ownKeys(t))if(Object.prototype.propertyIsEnumerable.call(t,r))Ar(e,r,t[r])}function nA(e){return os("Effect.evaluate: Not implemented")}var lo="~effect/Effect",Js="~effect/Exit",tA,$S,Y,et,Ht,Rr,rs,Ks,Jt,hj,rA,Ft=(e)=>G(e,lo),AS=(e)=>G(e,Js),Rc="~effect/Cause",Ju="~effect/Cause/Reason",Ic=(e)=>G(e,Rc),uo,_S,Fc,Uc,Dc,ns=(e)=>new uo(e),Qh,Mc=(e)=>new uo([new Dc(e)]),_h,RS=(e)=>new uo([new _h(e)]),Nc,ei=(e)=>e._tag==="Fail",$h=(e)=>e._tag==="Die",Zc=(e)=>e._tag==="Interrupt",fo=(e)=>({...rA,[$S]:e.op,[et]:e[et]??nA,[Ht]:e[Ht],[Rr]:e[Rr],[rs]:e[rs]}),Ir=(e)=>{let t=fo(e);return function(){let r=Object.create(t);return r[Y]=e.single===!1?arguments:arguments[0],r}},IS=(e)=>{let t={[Js]:Js,_tag:e.op,get[e.prop](){return this[Y]},...fo(e),toString(){return`${e.op}(${he(this[Y])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[Y]}},[Ke](r){return AS(r)&&r._tag===this._tag&&at(this[Y],r[Y])},[Je](){return Yt(it(e.op),Oe(this[Y]))}};return function(r){let n=Object.create(t);return n[Y]=r,n}},Ne,Ku,Ah,Kt,kn=(e)=>Kt(Mc(e)),os=(e)=>Kt(RS(e)),le,oA,qc,aa=(e)=>{class t extends qc{_tag=e}return t.prototype.name=e,t},ia="~effect/Cause/Done",FS=(e)=>G(e,ia),US,ca=(e)=>{if(e===void 0)return US;return{[ia]:ia,_tag:"Done",value:e}},sA,DS=(e)=>{if(e===void 0)return sA;return kn(ca(e))};var ct=E(()=>{co();on();oe();En();es();It();ye();Ac();tA={_A:B,_E:B,_R:B},$S=`${lo}/identifier`,Y=`${lo}/args`,et=`${lo}/evaluate`,Ht=`${lo}/successCont`,Rr=`${lo}/failureCont`,rs=`${lo}/ensureCont`,Ks=Symbol.for("effect/Effect/Yield"),Jt={pipe(){return pe(this,arguments)},toJSON(){return{...this}},toString(){return he(this.toJSON(),{ignoreToString:!0,space:2})},[Hs](){return this.toJSON()}},hj={[Je](){return kh(this,Object.keys(this))},[Ke](e){let t=Object.keys(this),r=Object.keys(e);if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==r[n]||!at(this[t[n]],e[t[n]]))return!1;return!0}},rA={[lo]:tA,...Jt,[Symbol.iterator](){return new ts(this)},toJSON(){return{_id:"Effect",op:this[$S],...Y in this?{args:this[Y]}:void 0}}};uo=class uo{[Rc];reasons;constructor(e){this[Rc]=Rc,this.reasons=e}pipe(){return pe(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map((e)=>e.toJSON())}}toString(){return`Cause(${he(this.reasons)})`}[Hs](){return this.toJSON()}[Ke](e){return Ic(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,r)=>at(t,e.reasons[r]))}[Je](){return Vu(this.reasons)}};_S=new WeakMap;Fc=class Fc{[Ju];annotations;_tag;constructor(e,t,r){if(this[Ju]=Ju,this._tag=e,t!==Uc&&typeof r==="object"&&r!==null&&t.size>0){let n=_S.get(r);if(n)t=new Map([...n,...t]);_S.set(r,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let r=new Map(this.annotations);e.mapUnsafe.forEach((o,s)=>{if(t?.overwrite!==!0&&r.has(s))return;r.set(s,o)});let n=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return n.annotations=r,n}pipe(){return pe(this,arguments)}toString(){return he(this)}[Hs](){return this.toString()}};Uc=new Map;Dc=class Dc extends Fc{error;constructor(e,t=Uc){super("Fail",t,e);this.error=e}toString(){return`Fail(${he(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[Ke](e){return ei(e)&&at(this.error,e.error)&&at(this.annotations,e.annotations)}[Je](){return Yt(it(this._tag))(Yt(Oe(this.error))(Oe(this.annotations)))}};Qh=new uo([]);_h=class _h extends Fc{defect;constructor(e,t=Uc){super("Die",t,e);this.defect=e}toString(){return`Die(${he(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[Ke](e){return $h(e)&&at(this.defect,e.defect)&&at(this.annotations,e.annotations)}[Je](){return Yt(it(this._tag))(Yt(Oe(this.defect))(Oe(this.annotations)))}};Nc=v((e)=>Ic(e[0]),(e,t,r)=>{if(t.mapUnsafe.size===0)return e;return new uo(e.reasons.map((n)=>n.annotate(t,r)))});Ne=IS({op:"Success",prop:"value",[et](e){let t=e.getCont(Ht);return t?t[Ht](this[Y],e,this):e.yieldWith(this)}}),Ku={key:"effect/Cause/StackTrace"},Ah={key:"effect/Cause/InterruptorStackTrace"},Kt=IS({op:"Failure",prop:"cause",[et](e){let t=this[Y],r=!1;if(e.currentStackFrame)t=Nc(t,{mapUnsafe:new Map([[Ku.key,e.currentStackFrame]])}),r=!0;let n=e.getCont(Rr);while(e.interruptible&&e._interruptedCause&&n)n=e.getCont(Rr);return n?n[Rr](t,e,r?void 0:this):e.yieldWith(r?Kt(t):this)}}),le=Ir({op:"WithFiber",[et](e){return this[Y](e)}}),oA=function(){class e extends globalThis.Error{}let t=fo({op:"YieldableError",[et](){return kn(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),qc=function(){let e=Symbol.for("effect/Data/Error/plainArgs");return class extends oA{constructor(r){super(r?.message,r?.cause?{cause:r.cause}:void 0);if(r)QS(this,r),Object.defineProperty(this,e,{value:r,enumerable:!1})}toJSON(){return{...this[e],...this}}}}(),US={[ia]:ia,_tag:"Done",value:void 0},sA=kn(US)});var Pn=(e)=>fo({op:e.label,[et]:e.evaluate});var la=E(()=>{ct()});var MS="~effect/data/Option",NS,iA,aA,cA,Rh=(e)=>G(e,MS),Ih=(e)=>e._tag==="None",Fh=(e)=>e._tag==="Some",ZS,qS=(e)=>{let t=Object.create(iA);return t.value=e,t};var WS=E(()=>{co();on();En();es();ye();Ac();ct();NS={[MS]:{_A:(e)=>e},...Jt,[Symbol.iterator](){return new ts(this)}},iA=Object.defineProperty(Object.assign(Object.create(NS),{_tag:"Some",_op:"Some",[Ke](e){return Rh(e)&&Fh(e)&&at(this.value,e.value)},[Je](){return Yt(Oe(this._tag))(Oe(this.value))},toString(){return`some(${he(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:bn(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),aA=Oe("None"),cA=Object.assign(Object.create(NS),{_tag:"None",_op:"None",valueOrUndefined:void 0,[Ke](e){return Rh(e)&&Ih(e)},[Je](){return aA},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}}}),ZS=Object.create(cA)});var LS="~effect/data/Result",zS,uA,fA,Uh=(e)=>G(e,LS),Dh=(e)=>e._tag==="Failure",XS=(e)=>e._tag==="Success",jS=(e)=>{let t=Object.create(fA);return t.failure=e,t},VS=(e)=>{let t=Object.create(uA);return t.success=e,t};var BS=E(()=>{co();on();En();es();ye();Ac();ct();zS={[LS]:{_A:(e)=>e,_E:(e)=>e},...Jt,[Symbol.iterator](){return new ts(this)}},uA=Object.assign(Object.create(zS),{_tag:"Success",_op:"Success",[Ke](e){return Uh(e)&&XS(e)&&at(this.success,e.success)},[Je](){return Yt(Oe(this._tag))(Oe(this.success))},toString(){return`success(${he(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:bn(this.success)}}}),fA=Object.assign(Object.create(zS),{_tag:"Failure",_op:"Failure",[Ke](e){return Uh(e)&&Dh(e)&&at(this.failure,e.failure)},[Je](){return Yt(Oe(this._tag))(Oe(this.failure))},toString(){return`failure(${he(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:bn(this.failure)}}})});function GS(e){return(t,r)=>t===r?0:e(t,r)}var ef,YS,tf=(e)=>v(2,(t,r)=>e(t,r)===1);var Mh=E(()=>{oe();ef=GS((e,t)=>{if(globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t))return 0;if(globalThis.Number.isNaN(e))return-1;if(globalThis.Number.isNaN(t))return 1;return e<t?-1:1}),YS=v(2,(e,t)=>GS((r,n)=>e(t(r),t(n))))});var L=()=>ZS,ee,Lt,tt,er,bt,wn=(e)=>e==null?L():ee(e),ua=(e)=>e===void 0?L():ee(e),ur,fa,JS,KS,eE;var ze=E(()=>{oe();WS();ee=qS,Lt=Ih,tt=Fh,er=v(2,(e,{onNone:t,onSome:r})=>Lt(e)?t():r(e.value)),bt=v(2,(e,t)=>Lt(e)?t():e.value),ur=bt(Yo),fa=v(2,(e,t)=>Lt(e)?L():ee(t(e.value))),JS=v(2,(e,t)=>Lt(e)?L():t(e.value)),KS=v(2,(e,t)=>Lt(e)?L():t(e.value)?ee(e.value):L()),eE=v(2,(e,t)=>Lt(e)?!1:t(e.value))});var tE="~effect/Context/Service",rt=function(){function e(){}let t=e;Object.setPrototypeOf(t,hA);let r=(n,o)=>{if(t.key=n,o?.defaultValue)t[Zh]=Zh,t.defaultValue=o.defaultValue;if(o?.make)t.make=o.make;if(o?.fiberCached)rE.add(n);return t};return arguments.length>0?r(arguments[0],arguments[1]):r},hA,rE,Zh="~effect/Context/Reference",nE="~effect/Context",mA=8,OA=8,qh=(e,t,r,n)=>{let o=Object.create(xA);return o.cacheRoot=e??o,o.base=t,o.overlay=r,o.depth=n,o._flat=void 0,o.baseHits=0,o},oE=(e,t)=>{if(!t)return;oE(e,t.parent),e.set(t.key,t.value)},sE=(e)=>{if(e._flat)return e._flat;if(!e.overlay)return e._flat=e.base;let t=new Map(e.base);return oE(t,e.overlay),e._flat=t},gA=(e,t)=>{let r=new Map(e.mapUnsafe);return t(r),da(r)},rf,Wh=(e,t)=>{let r=e;for(let o=r.overlay;o;o=o.parent)if(o.key===t)return o.value;let n=r.base.get(t);if(n===void 0&&!r.base.has(t))return rf;if(r.overlay&&++r.baseHits>=OA)r.base=sE(r),r.overlay=void 0,r.depth=0;return n},da=(e)=>qh(void 0,e,void 0,0),xA,iE=(e,t)=>e.cacheRoot===t.cacheRoot,Lh=(e)=>G(e,nE),aE=(e)=>!!e[Zh],Tn=()=>yA,yA,ho=(e,t)=>da(new Map([[e.key,t]])),mo,SA=(e,t,r)=>{let n=e,o=rE.has(t)?void 0:n.cacheRoot;if(n.depth>=mA){let s=new Map(n.mapUnsafe);return s.set(t,r),qh(o,s,void 0,0)}return qh(o,n.base,{key:t,value:r,parent:n.overlay},n.depth+1)},cE,Lc=(e,t)=>{let r=Wh(e,t);return r===rf?void 0:r},zc,ss,Nh="~effect/Context/defaultValue",lE=(e)=>{if(Nh in e)return e[Nh];return e[Nh]=e.defaultValue()},EA=(e)=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(t.stack){let r=t.stack.split(`
|
|
10
|
+
`);r.splice(1,3),t.stack=r.join(`
|
|
11
|
+
`)}return t},uE,pa,fE=(...e)=>{let t=new Map;for(let r=0;r<e.length;r++)e[r].mapUnsafe.forEach((n,o)=>{t.set(o,n)});return da(t)},Be;var lt=E(()=>{la();co();oe();En();ct();ze();ye();hA={[tE]:tE,...Pn({label:"Service",evaluate(e){return Ne(ss(e.context,this))}}),toJSON(){return{_id:"Service",key:this.key}},of(e){return e},context(e){return ho(this,e)},use(e){return le((t)=>e(ss(t.context,this)))},useSync(e){return le((t)=>Ne(e(ss(t.context,this))))}},rE=new Set,rf=Symbol(),xA={get mapUnsafe(){return sE(this)},...Jt,[nE]:{_Services:(e)=>e},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[Ke](e){if(!Lh(e))return!1;let t=this.mapUnsafe,r=e.mapUnsafe;if(t.size!==r.size)return!1;for(let[n,o]of t)if(!r.has(n)||!at(o,r.get(n)))return!1;return!0},[Je](){return ra(this.mapUnsafe.size)}},yA=da(new Map),mo=v(3,(e,t,r)=>SA(e,t.key,r)),cE=v(2,(e,t)=>Lc(e,t.key)),zc=v(2,(e,t)=>{let r=Wh(e,t.key);if(r===rf){if(aE(t))return lE(t);throw EA(t)}return r}),ss=zc,uE=v(2,(e,t)=>{let r=Wh(e,t.key);if(r!==rf)return ee(r);return aE(t)?ee(lE(t)):L()}),pa=v(2,(e,t)=>{if(e.mapUnsafe.size===0)return t;if(t.mapUnsafe.size===0)return e;return gA(e,(r)=>t.mapUnsafe.forEach((n,o)=>r.set(o,n)))}),Be=rt});var zh=(e)=>e.length>0;var gt,ut,Ut,Xh,nf;var Oo=E(()=>{oe();BS();gt=VS,ut=jS,Ut=Dh,Xh=v(2,(e,t)=>Ut(e)?ut(t(e.failure)):e),nf=v(2,(e,{onFailure:t,onSuccess:r})=>Ut(e)?t(e.failure):r(e.success))});var dE,Dj,kA;var pE=E(()=>{oe();ze();ye();dE=v(2,(e,t)=>{let r=0;for(let n of e){let o=t(n,r);if(zu(o)){if(o)return ee(n)}else if(tt(o))return o;r++}return L()}),Dj={[Symbol.iterator](){return kA}},kA={next(){return{done:!0,value:void 0}}}});var jh,Cn=(e)=>jh.isArray(e)?e:jh.from(e),Xc,Vh,hE,wA,of,Qn,Bh,mE,OE,TA=(e,t)=>{let r=Oe(t),n=e.get(r);if(n===void 0)return e.set(r,[t]),!0;for(let o of n)if(at(o,t))return!1;return n.push(t),!0},gE,ti=()=>[],ri=(e)=>[e],Sr,sf,vA=(e)=>{let t=Cn(e);if(t.length<2)return[...t];let r=new Map,n=[];for(let o of t)if(TA(r,o))n.push(o);return n};var _n=E(()=>{co();oe();En();pE();ze();jh=globalThis.Array,Xc=v(2,(e,{onEmpty:t,onNonEmpty:r})=>Qn(e)?r(e):t()),Vh=v(2,(e,t)=>[...e,t]),hE=v(2,(e,t)=>Cn(e).concat(Cn(t))),wA=jh.isArray,of=zh,Qn=zh,Bh=v(2,(e,t)=>{let r=0;for(let n of e){if(t(n,r))return ee(r);r++}return L()}),mE=dE,OE=v(2,(e,t)=>{let r=Cn(e);for(let n=r.length-1;n>=0;n--){let o=r[n],s=t(o,n);if(typeof s==="boolean"){if(s)return ee(o)}else if(tt(s))return s}return L()}),gE=v(2,(e,t)=>{let r=Cn(e),n=Cn(t);if(Qn(r))return Qn(n)?vA(hE(r,n)):r;return n}),Sr=v(2,(e,t)=>e.map(t)),sf=v(3,(e,t,r)=>Cn(e).reduce((n,o,s)=>r(n,o,s),t))});var cf="~effect/time/Duration",PE,wE,CA,QA,_A,lf=(e)=>BigInt(e<0?Math.ceil(e-0.5):Math.floor(e+0.5)),TE=(e)=>lf(e*1e6),xE=(e,t)=>{let r=e.indexOf(".");if(r===-1)return BigInt(e)*t;let n=e[0]==="-",o=e.slice(r+1),s=QA**BigInt(o.length),i=(BigInt(e.slice(n?1:0,r))*s+BigInt(o))*t,a=i/s+(i%s*CA>=s?wE:PE);return n?-a:a},$A,ha=(e)=>{switch(typeof e){case"number":return bE(e);case"bigint":return af(e);case"string":{if(e==="Infinity")return Gh;if(e==="-Infinity")return EE;let t=$A.exec(e);if(!t)break;let[r,n,o]=t;if(o==="nano"||o==="nanos")return af(xE(n,wE));if(o==="micro"||o==="micros")return af(xE(n,_A));let s=Number(n);switch(o){case"milli":case"millis":return bE(s);case"second":case"seconds":return DA(s);case"minute":case"minutes":return MA(s);case"hour":case"hours":return NA(s);case"day":case"days":return ZA(s);case"week":case"weeks":return qA(s)}break}case"object":{if(e===null)break;if(cf in e)return e;if(Array.isArray(e)){if(e.length!==2||!e.every(Qc))return yE(e);if(Number.isNaN(e[0])||Number.isNaN(e[1]))return UA;if(e[0]===-1/0||e[1]===-1/0)return EE;if(e[0]===1/0||e[1]===1/0)return Gh;return Er(lf(e[0]*1e9+e[1]))}let t=e,r=0;if(t.weeks)r+=t.weeks*604800000;if(t.days)r+=t.days*86400000;if(t.hours)r+=t.hours*3600000;if(t.minutes)r+=t.minutes*60000;if(t.seconds)r+=t.seconds*1000;if(t.milliseconds)r+=t.milliseconds;if(!t.microseconds&&!t.nanoseconds)return Er(r);return Er(lf(r*1e6+(t.microseconds??0)*1000+(t.nanoseconds??0)))}}return yE(e)},yE=(e)=>{throw Error(`Invalid Input: ${e}`)},SE,AA,RA,IA,Er=(e)=>{let t=Object.create(IA);if(typeof e==="number")if(isNaN(e)||e===0||Object.is(e,-0))t.value=SE;else if(!Number.isFinite(e))t.value=e>0?AA:RA;else if(!Number.isInteger(e))t.value={_tag:"Nanos",nanos:TE(e)};else t.value={_tag:"Millis",millis:e};else if(e===PE)t.value=SE;else t.value={_tag:"Nanos",nanos:e};return t},FA=(e)=>G(e,cf),vE=(e)=>e.value._tag!=="Infinity"&&e.value._tag!=="NegativeInfinity",UA,Gh,EE,af=(e)=>Er(e),bE=(e)=>Er(e),DA=(e)=>Er(e*1000),MA=(e)=>Er(e*60000),NA=(e)=>Er(e*3600000),ZA=(e)=>Er(e*86400000),qA=(e)=>Er(e*604800000),CE=(e)=>WA(ha(e),{onMillis:B,onNanos:(t)=>Number(t)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),kE=(e)=>{let t=ha(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 TE(t.value.millis)}},WA,LA,zA=(e,t)=>LA(e,t,{onMillis:(r,n)=>r===n,onNanos:(r,n)=>r===n,onInfinity:(r,n)=>r.value._tag===n.value._tag}),XA;var Yh=E(()=>{co();oe();En();es();It();ye();PE=BigInt(0),wE=BigInt(1),CA=BigInt(2),QA=BigInt(10),_A=BigInt(1000),$A=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,SE={_tag:"Millis",millis:0},AA={_tag:"Infinity"},RA={_tag:"NegativeInfinity"},IA={[cf]:cf,[Je](){switch(this.value._tag){case"Millis":{let e=this.value.millis*1e6;return Number.isFinite(e)?Oe(lf(e)):ra(this.value.millis)}case"Nanos":return Oe(this.value.nanos);default:return Ph(this.value)}},[Ke](e){return FA(e)&&XA(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"}}},[Hs](){return this.toJSON()},pipe(){return pe(this,arguments)}},UA=Er(0),Gh=Er(1/0),EE=Er(-1/0),WA=v(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)()}}),LA=v(3,(e,t,r)=>{if(e.value._tag==="Infinity"||e.value._tag==="NegativeInfinity"||t.value._tag==="Infinity"||t.value._tag==="NegativeInfinity")return r.onInfinity(e,t);if(e.value._tag==="Millis")return t.value._tag==="Millis"?r.onMillis(e.value.millis,t.value.millis):r.onNanos(kE(e),t.value.nanos);else return r.onNanos(e.value.nanos,kE(t))}),XA=v(2,(e,t)=>zA(e,t))});class $E{buckets=[];scheduleTask(e,t){let r=this.buckets,n=r.length,o,s=0;for(;s<n;s++){if(r[s][0]>t)break;o=r[s]}if(o&&o[0]===t)o[1].push(e);else if(s===n)r.push([t,[e]]);else r.splice(s,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}}class uf{executionMode;setImmediate;constructor(e="async",t){this.executionMode=e,this.setImmediate=t??(e==="sync"?jA:_E)}shouldYield(e){return e.currentOpCount>=e.maxOpsBeforeYield}makeDispatcher(){return new AE(this.setImmediate)}}class AE{tasks=new $E;running=void 0;setImmediate;constructor(e=_E){this.setImmediate=e}scheduleTask(e,t){if(this.tasks.scheduleTask(e,t),this.running===void 0)this.running=this.setImmediate(this.afterScheduled)}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let r=e[t][1];for(let n=0;n<r.length;n++)r[n]()}}flush(){while(this.tasks.buckets.length>0){if(this.running!==void 0)this.running(),this.running=void 0;this.runTasks()}}}var Hh,_E,jA=(e)=>{let t=!1;return Promise.resolve().then(()=>{if(!t)e()}),()=>{t=!0}},RE,IE;var FE=E(()=>{lt();Hh=Be("effect/Scheduler",{fiberCached:!0,defaultValue:()=>new uf}),_E="setImmediate"in globalThis?(e)=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:(e)=>{let t=setTimeout(e,0);return()=>clearTimeout(t)};RE=Be("effect/Scheduler/MaxOpsBeforeYield",{fiberCached:!0,defaultValue:()=>2048}),IE=Be("effect/Scheduler/PreventSchedulerYield",{fiberCached:!0,defaultValue:()=>!1})});function BA(){if(arguments.length===1){let r=arguments[0];return function(n){return r[n._tag](n)}}let e=arguments[0];return arguments[1][e._tag](e)}var UE=()=>new Proxy({},{get(e,t,r){if(t==="$is")return Bs;else if(t==="$match")return BA;return(n)=>({...n,_tag:t})}}),DE,Fr;var ma=E(()=>{ct();ye();DE=qc,Fr=aa});function ff(e){if(e>=ZE.length)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);let t=ZE[e];if(t===255)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);return t}var ME="~effect/encoding/EncodingError",df,pf=(e)=>typeof e==="string"?NE(GA.encode(e)):NE(e),hf=(e)=>{let t=YA(e),r=t.length;if(r%4!==0)return ut(new df({kind:"Decode",module:"Base64",input:t,message:`Length must be a multiple of 4, but is ${r}`}));let n=t.indexOf("=");if(n!==-1&&(n<r-2||n===r-2&&t[r-1]!=="="))return ut(new df({kind:"Decode",module:"Base64",input:t,message:"Found a '=' character, but it is not at the end"}));try{let o=t.endsWith("==")?2:t.endsWith("=")?1:0,s=new Uint8Array(3*(r/4)-o);for(let i=0,a=0;i<r;i+=4,a+=3){let c=ff(t.charCodeAt(i))<<18|ff(t.charCodeAt(i+1))<<12|ff(t.charCodeAt(i+2))<<6|ff(t.charCodeAt(i+3));s[a]=c>>16,s[a+1]=c>>8&255,s[a+2]=c&255}return gt(s)}catch(o){return ut(new df({kind:"Decode",module:"Base64",input:t,message:o instanceof Error?o.message:"Invalid input"}))}},GA,YA=(e)=>e.replace(/[\n\r]/g,""),NE=(e)=>{let t=e.length,r="",n;for(n=2;n<t;n+=3)r+=xo[e[n-2]>>2],r+=xo[(e[n-2]&3)<<4|e[n-1]>>4],r+=xo[(e[n-1]&15)<<2|e[n]>>6],r+=xo[e[n]&63];if(n===t+1)r+=xo[e[n-2]>>2],r+=xo[(e[n-2]&3)<<4],r+="==";if(n===t)r+=xo[e[n-2]>>2],r+=xo[(e[n-2]&3)<<4|e[n-1]>>4],r+=xo[(e[n-1]&15)<<2],r+="=";return r},xo,ZE,HA;var Jh=E(()=>{ma();Oo();df=class df extends Fr("EncodingError"){[ME]=ME};GA=new TextEncoder;xo=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"],ZE=[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],HA=[];for(let e=0;e<256;e++)HA.push(e.toString(16).padStart(2,"0"))});var WE="effect/Tracer/ParentSpan",LE="effect/Tracer";var zE=()=>{};var XE="effect/observability/Metric/FiberRuntimeMetricsKey";var Kh,mf,em,Of,tm;var rm=E(()=>{lt();oe();Kh=Be("effect/References/CurrentStackFrame",{fiberCached:!0,defaultValue:Yo}),mf=Be("effect/References/CurrentLogAnnotations",{defaultValue:()=>({})}),em=Be("effect/References/CurrentLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),Of=Be("effect/References/MinimumLogLevel",{fiberCached:!0,defaultValue:()=>"Info"}),tm=Be("effect/References/CurrentLogSpans",{defaultValue:()=>[]})});var tR=()=>{let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");if(e===void 0)return Object.isExtensible(Error);return Object.hasOwn(e,"writable")?e.writable===!0:e.set!==void 0},rR,gf=()=>Error.stackTraceLimit,Oa=(e)=>{if(rR)Error.stackTraceLimit=e};var nm=E(()=>{rR=tR()});class nk{waiters=[];scheduled=void 0;_isOpen;constructor(e){this._isOpen=e}scheduleUnsafe(e){if(this.waiters.length===0)return GE;if(this.scheduled===void 0)this.scheduled=this.waiters,e.currentDispatcher.scheduleTask(this.flushScheduled,0);else for(let t=0;t<this.waiters.length;t++)this.scheduled.push(this.waiters[t]);return this.waiters=[],GE}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](fr)};flushWaiters(){let e=this.waiters;this.waiters=[],this.flushScheduled();for(let t=0;t<e.length;t++)e[t](fr)}open=le((e)=>{if(this._isOpen)return YE;return this._isOpen=!0,this.scheduleUnsafe(e)});release=le((e)=>this._isOpen?YE:this.scheduleUnsafe(e));openUnsafe(){if(this._isOpen)return!1;return this._isOpen=!0,this.flushWaiters(),!0}await=zt((e)=>{if(this._isOpen)return e($e);return this.waiters.push(e),ve(()=>{let t=this.waiters.indexOf(e);if(t!==-1)this.waiters.splice(t,1);else if(this.scheduled!==void 0){if(t=this.scheduled.indexOf(e),t!==-1)this.scheduled.splice(t,1)}})});closeUnsafe(){if(!this._isOpen)return!1;return this._isOpen=!1,!0}close=ve(()=>this.closeUnsafe());whenOpen=(e)=>ge(this.await,()=>e);isOpen(){return this._isOpen}}class sk{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=ve(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return _R()}currentTimeNanos=ve(()=>this.currentTimeNanosUnsafe());monotonicTimeNanosUnsafe(){return ak()}monotonicTimeNanos=ve(()=>this.monotonicTimeNanosUnsafe());sleep(e){return this.sleepMillis(CE(e))}sleepMillis(e){if(e<=0)return bf;else if(!Number.isFinite(e))return Om;return zt((t)=>{let r=e>om?this.sleepMillis(e-om):$e,n=setTimeout(()=>t(r),Math.min(e,om));return ve(()=>clearTimeout(n))})}}var JE,ga=(e)=>new uo([new JE(e)]),KE=(e)=>{let t=e.reasons.find(ei);return t?gt(t):ut(e)},xa=(e)=>{for(let t=0;t<e.reasons.length;t++){let r=e.reasons[t];if(r._tag==="Fail")return gt(r.error)}return ut(e)},eb=(e)=>e.reasons.some(Zc),tb=(e)=>e.reasons.length>0&&e.reasons.every(Zc),fm,rb,lR=(e)=>{let t={Fail:[],Die:[],Interrupt:[]};for(let r=0;r<e.reasons.length;r++)t[e.reasons[r]._tag].push(e.reasons[r]);return t},dm=(e)=>{let t=lR(e);if(t.Fail.length>0)return t.Fail[0].error;else if(t.Die.length>0)return t.Die[0].defect;else if(t.Interrupt.length>0)return new globalThis.Error("All fibers interrupted without error");return new globalThis.Error("Empty cause")},nb=(e,t)=>{let r=[],n=[];if(e.reasons.length===0)return r;let o=gf();Oa(1);for(let s of e.reasons){if(s._tag==="Interrupt"){n.push(s);continue}r.push(sm(s._tag==="Die"?s.defect:s.error,s.annotations,t))}if(r.length===0){let s=Error("The fiber was interrupted by:");s.name="InterruptCause",s.stack=pR(s,n);let i=new globalThis.Error("All fibers interrupted without error",{cause:s});i.name="InterruptError",i.stack=`${i.name}: ${i.message}`,r.push(sm(i,n[0].annotations,t))}return Oa(o),r},sm=(e,t,r)=>{let n=typeof e,o;if(e&&n==="object"){if(o=new globalThis.Error(uR(e),{cause:e.cause?sm(e.cause):void 0}),typeof e.name==="string")o.name=e.name;if(typeof e.stack==="string")o.stack=dR(e.stack,o,t);else{let s=`${o.name}: ${o.message}`;o.stack=t?ob(s,t):s}if(r?.includeCauseInStack)o.stack=ib(o);for(let s of Object.keys(e))if(!(s in o))o[s]=e[s]}else o=new globalThis.Error(!e?`Unknown error: ${e}`:n==="string"?e:Ys(e));return o},uR=(e)=>{if(typeof e.message==="string")return e.message;else if(typeof e.toString==="function"&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return Ys(e)},fR,dR=(e,t,r)=>{let n=`${t.name}: ${t.message}`,o=(e.startsWith(n)?e.slice(n.length):e).split(`
|
|
12
|
+
`),s=[n];for(let i=1;i<o.length;i++){if(/(?:Generator\.next|~effect\/Effect)/.test(o[i]))break;s.push(o[i])}return r?ob(s.join(`
|
|
13
|
+
`),r):s.join(`
|
|
14
|
+
`)},ob=(e,t)=>{let r=t?.get(Ku.key);if(r)e=`${e}
|
|
15
|
+
${sb(r)}`;return e},pR=(e,t)=>{let r=[`${e.name}: ${e.message}`];for(let n of t){let o=n.fiberId!==void 0?`#${n.fiberId}`:"unknown",s=n.annotations.get(Ah.key);if(r.push(` at fiber (${o})`),s)r.push(sb(s))}return r.join(`
|
|
16
|
+
`)},sb=(e)=>{let t=[],r=e,n=0;while(r&&n<10){let o=r.stack();if(o){let s=o.matchAll(fR),i=!1;for(let[,a]of s)i=!0,t.push(` at ${r.name} (${a})`);if(!i)t.push(` at ${r.name} (${o.replace(/^at /,"")})`)}else t.push(` at ${r.name}`);r=r.parent,n++}return t.join(`
|
|
17
|
+
`)},yf=(e)=>nb(e).map(ib).join(`
|
|
18
|
+
`),ib=(e)=>e.cause?`${e.stack} {
|
|
19
|
+
${ab(e.cause," ")}
|
|
20
|
+
}`:e.stack,ab=(e,t)=>{let r=e.stack.split(`
|
|
21
|
+
`),n=`${t}[cause]: ${r[0]}`;for(let o=1,s=r.length;o<s;o++)n+=`
|
|
22
|
+
${t}${r[o]}`;if(e.cause)n+=` {
|
|
23
|
+
${ab(e.cause,`${t} `)}
|
|
24
|
+
${t}}`;return n},xf="~effect/Fiber",hR,mR,ya=()=>globalThis[oa],pm,OR,jE,Sf=(e)=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(Ah.key,e.currentStackFrame),da(t)},cb=(e)=>{let t=e;if(t._exit)return se(t._exit);return zt((r)=>{if(t._exit)return r(se(t._exit));return ve(e.addObserver((n)=>r(se(n))))})},hm=(e)=>zt((t)=>{let r=e[Symbol.iterator](),n=[],o=void 0;function s(){let i=r.next();while(!i.done){if(i.value._exit){n.push(i.value._exit),i=r.next();continue}o=i.value.addObserver((a)=>{n.push(a),s()});return}t(se(n))}return s(),ve(()=>o?.())}),Ef=(e)=>le((t)=>lb(e,t.id)),lb,jc=(e)=>le((t)=>{let r=Sf(t),n=ti();for(let o of e)o.interruptUnsafe(t.id,r),n.push(o);return wf(hm(n))}),se,nt,as,ve,Se,ub,fb,bf,kf,db=(e)=>Se(()=>nt(mt(e))),oi=(e)=>os(e),pb=(e)=>Se(()=>as(mt(e))),$e,hb=(e)=>{let t=typeof e==="function"?e:e.try,r=typeof e==="function"?(n)=>new ol(n,"An error occurred in Effect.try"):e.catch;return Se(()=>{try{return se(mt(t))}catch(n){return as(mt(()=>r(n)))}})},mb=(e)=>mm(function(t,r){mt(()=>e(r)).then((n)=>t(se(n)),(n)=>t(oi(n)))},e.length!==0),Ob=(e)=>{let t=typeof e==="function"?e:e.try,r=typeof e==="function"?(n)=>new ol(n,"An error occurred in Effect.tryPromise"):e.catch;return mm(function(n,o){let s=(i)=>{try{n(as(mt(()=>r(i))))}catch(a){n(oi(a))}};try{mt(()=>t(o)).then((i)=>n(se(i)),s)}catch(i){s(i)}},t.length!==0)},gR=(e)=>le((t)=>e(t.id)),mm,xR,zt=(e)=>mm(e,e.length>=2),Om,gb=(...e)=>Se(()=>Vc(e.length===1?e[0]():e[1].call(e[0].self))),gm=(e,...t)=>{let r=t.length===0?function(){return Se(()=>Vc(e.apply(this,arguments)))}:function(){let n=Se(()=>Vc(e.apply(this,arguments)));for(let o=0;o<t.length;o++)n=t[o](n,...arguments);return n};return xb(e.length,r)},xb=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),yb=(e,...t)=>xb(e.length,t.length===0?function(){return VE(()=>e.apply(this,arguments))}:function(){let r=VE(()=>e.apply(this,arguments));for(let n of t)r=n(r);return r}),VE=(e)=>{try{let t=e(),r=void 0;while(!0){let n=t.next(r);if(n.done)return se(n.value);let o=n.value;if(o&&o._tag==="Success"){r=o.value;continue}else if(o&&o._tag==="Failure")return n.value;else{let s=!0;return Se(()=>{if(s)return s=!1,ge(n.value,(i)=>Vc(t,i));else return Se(()=>Vc(e()))})}}}catch(t){return oi(t)}},Vc,si,xm=(e)=>yo(e,ee),cs,Pf,wf=(e)=>ge(e,(t)=>fr),Sb=(e,t)=>le((r)=>zt((n)=>{let o=!1,s=new Set,i=(c)=>{o=!0,n(s.size===0?c:ge($f(jc(s)),()=>c))},a=0;for(let c of e){if(o)break;let l=a++,u=If(r,c,!0,!0,!1);s.add(u),u.addObserver((f)=>{s.delete(u);let d=!o;if(i(f),d&&t?.onWinner)t.onWinner({fiber:u,index:l,parentFiber:r})})}return jc(s)})),ym,ge,yR,qe=(e)=>(Js in e),Eb,yo,bb,kb,Sm=(e)=>Kt(ga(e)),Tf=(e)=>e._tag==="Success",Pb=(e)=>e._tag==="Failure",wb=(e)=>e._tag==="Failure"?gt(e.cause):ut(e),fr,Tb,vb,Cb,Qb=(e)=>{let t=[];for(let r of e)if(r._tag==="Failure")t.push(...r.cause.reasons);return t.length===0?fr:Kt(ns(t))},_b=(e)=>le((t)=>se(uE(t.context,e))),Em,bm=(e)=>le((t)=>e(t.context)),So,Gc=function(){if(arguments.length===1)return v(2,(e,t)=>BE(e,arguments[0],t));return v(3,(e,t,r)=>BE(e,t,r)).apply(this,arguments)},BE=(e,t,r)=>Em(e,mo(t,r)),$b,ls,SR,vf,Yc,Ab,Rb,km,Pm,Ib,wm,Tm=(e)=>Yc(e,oi),Fb,Ub=(e)=>Db(e,{onFailure:ut,onSuccess:gt}),Sa,ER,Cf,vm,Db,Hc=(e)=>qe(e)?Ne(e):bR(e),bR,Cm,Mb,im="~effect/Scope",am="~effect/Scope/Closeable",Jc,Qm=(e,t)=>Se(()=>Qf(e,t)??$e),Qf=(e,t)=>{if(e.state._tag==="Closed")return;let r={_tag:"Closed",exit:t};if(e.state._tag==="Empty"){e.state=r;return}let n=e.state;if(e.state=r,n.finalizer!==void 0)return n.finalizer(t);let o=n.finalizers;if(o===void 0||o.size===0)return;else if(o.size===1)return o.values().next().value(t);return PR(e,o,t)},kR=(e,t)=>Tf(e)?t:ls(t,(r)=>nt(fm(e.cause,r))),PR,Nb=(e,t)=>{let r=Kc(t);if(e.state._tag==="Closed")return r.state=e.state,r;let n={};return Bc(e,n,(o)=>Qm(r,o)),Bc(r,n,(o)=>ve(()=>_m(e,n))),r},us=(e,t)=>Se(()=>{if(e.state._tag==="Closed")return t(e.state.exit);return Bc(e,{},t),$e}),Zb=(e,t)=>us(e,$r(t)),Bc=(e,t,r)=>{if(e.state._tag==="Empty")e.state={_tag:"Open",finalizerKey:t,finalizer:r,finalizers:void 0};else if(e.state._tag==="Open"){let n=e.state;if(n.finalizer!==void 0)n.finalizers=new Map([[n.finalizerKey,n.finalizer]]),n.finalizerKey=void 0,n.finalizer=void 0,n.finalizers.set(t,r);else if(n.finalizers===void 0)n.finalizerKey=t,n.finalizer=r;else n.finalizers.set(t,r)}},_m=(e,t)=>{if(e.state._tag==="Open"){let r=e.state;if(r.finalizerKey===t)r.finalizerKey=void 0,r.finalizer=void 0;else if(r.finalizers!==void 0)r.finalizers.delete(t)}},Kc=(e="sequential")=>({[am]:am,[im]:im,strategy:e,state:wR}),wR,el,qb,$m=(e)=>le((t)=>{let r=t.context,n=Kc();return t.setContext(mo(t.context,Jc,n)),ii(e,(o)=>(t.setContext(r),Qf(n,o)))}),_f=(e)=>Se(()=>{let t=Kc();return fs(e(t),(r)=>Se(()=>Qf(t,r)??$e))}),Am=(e,t,r)=>bm((n)=>ds((o)=>ge(el,(s)=>Pf(r?.interruptible?o(e):e,(i)=>us(s,(a)=>So(t(i,a),n)))))),Rm=(e)=>ge(el,(t)=>bm((r)=>us(t,(n)=>So(e(n),r)))),ii,fs,Wb,Lb,zb,Xb,$f=(e)=>le((t)=>{if(!t.interruptible)return e;return t.interruptible=!1,t._stack.push(Af),e}),jb,Af,TR,vR=(e)=>{if(e.interruptible=!0,e._stack.push(TR),e._interruptedCause)return nt(e._interruptedCause)},Vb=(e)=>le((t)=>{if(t.interruptible)return e;return vR(t)??e}),ds=(e)=>le((t)=>{if(!t.interruptible)return e(B);return t.interruptible=!1,t._stack.push(Af),e(Vb)}),tl,Rf,CR=(e,t,r)=>Se(()=>{let n=r?.discard?void 0:[],o=e[Symbol.iterator](),s=o.next(),i=0;return si(tl({while:()=>!s.done,body:()=>t(s.value,i++),step:(a)=>{if(n)n.push(a);s=o.next()}}),n)}),Bb=(e)=>{let{onItem:t,step:r}=e,n=(o,s,i,a)=>{for(;i<a;i++){let c=s[i],l=t(o,c,i);if(!qe(l))return ge(Hc(l),(f)=>r(o,c,f,i)??n(o,s,i+1,a)??$e);let u=r(o,c,l,i);if(u)return u._tag==="Failure"?u:void 0}};return(o,s,i)=>{let a=0,c=i?.end??s.length,l=i?.concurrency??1;if(l===1)return n(o,s,0,c);let u=i?.orderedStep===!0,f=!1,d,h,m,b=!1,x,O,S=a,y=u?Array(c):void 0,g=(w)=>{let _=os(w);return x=_,f=!0,b=!0,h&&h.size>0?ge($f(jc(Array.from(h))),()=>_):_},C=(w,_,I)=>{if(!u)return r(o,w,_,I);if(x)return x;y[I]=_;while(S<c){let F=y[S];if(F===void 0)return;y[S]=void 0;let R=S++,A=r(o,s[R],F,R);if(A)return A}},Q=()=>{let w=!1;for(;!x&&a<c;a++){let _=s[a],I=O??t(o,_,a);if(qe(I)){if(x=C(_,I,a),x)break}else if(!d)return zt((F)=>{d=ya(),h=new Set,O=I,m=F;let R;try{R=Q()}catch(A){return F(g(A))}if(R)return F(R);return Se(()=>(x=fr,b=!0,h?jc(h):$e))});else{O=void 0;let F=If(d,I,!0,!0,"inherit");if(F._exit){if(x=C(_,F._exit,a),x)break;continue}h.add(F);let R=a;if(F.addObserver((A)=>{h.delete(F);try{if(x){if(!b&&A._tag==="Failure")for(let M of A.cause.reasons)if(M._tag==="Interrupt")continue;else if(x._tag==="Failure")x.cause.reasons.push(M);else x=Kt(ns([M]))}else{let M=C(_,A,R);if(M)x=M._tag==="Failure"?Kt(ns(M.cause.reasons.slice())):M,Q()}if(w){let M=Q();if(M)m(M)}else if(f&&h.size===0)m(x??$e)}catch(M){m(g(M))}}),h.size<l)continue;w=!0,a++;return}}if(f=!0,x){if(h&&h.size>0){let _=Sf(d);h.forEach((I)=>I.interruptUnsafe(d.id,_));return}if(m||x._tag==="Failure")return x}else if(m){if(!h)return fr;else if(h.size===0)m($e)}};return Q()}},rl=()=>Bb,QR,If=(e,t,r=!1,n=!1,o=!1)=>{let s=e,i=o==="inherit"?s.interruptible:!o,a=new pm(s.context,i);if(r)a.evaluate(t);else s.currentDispatcher.scheduleTask(()=>a.evaluate(t),0);if(!n&&!a._exit)s.children().add(a),a.addObserver(()=>s._children.delete(a));return a},Im,Gb,nl=(e)=>(t,r)=>{let n=new pm(r?.scheduler?mo(e,Hh,r.scheduler):e,r?.uninterruptible!==!0);if(n.evaluate(t),n._exit)return n;if(r?.signal)if(r.signal.aborted)n.interruptUnsafe();else{let o=()=>n.interruptUnsafe();r.signal.addEventListener("abort",o,{once:!0}),n.addObserver(()=>r.signal.removeEventListener("abort",o))}if(r?.onFiberStart)r.onFiberStart(n);return n},Yb,Hb,Jb=(e)=>{let t=nl(e);return(r,n)=>{let o=t(r,n);return new Promise((s)=>{o.addObserver((i)=>s(i))})}},Kb=(e)=>{let t=Jb(e);return(r,n)=>t(r,n).then((o)=>{if(o._tag==="Failure")throw dm(o.cause);return o.value})},ek,tk=(e)=>{let t=nl(e);return(r)=>{if(qe(r))return r;let n=new uf("sync"),o=t(r,{scheduler:n});return o._dispatcher?.flush(),o._exit??os(new Nm(o))}},rk,GE,YE,ok=(e)=>new nk(e??!1),Fm,om=2147483647,ik,ak,_R,Um=(e)=>le((t)=>e(t.getRef(Fm))),Dm=(e)=>Um((t)=>t.sleep(ha(e))),cm="~effect/Cause/TimeoutError",Mm,lm="~effect/Cause/AsyncFiberError",Nm,um="~effect/Cause/UnknownError",ol,Zm,$R=(e)=>{switch(e){case"All":return Number.MIN_SAFE_INTEGER;case"Fatal":return 50000;case"Error":return 40000;case"Warn":return 30000;case"Info":return 20000;case"Debug":return 1e4;case"Trace":return 0;case"None":return Number.MAX_SAFE_INTEGER}},AR,RR,ck,IR,FR="~effect/Logger",UR,lk=(e)=>{let t=Object.create(UR);return t.log=e,t},DR=(e)=>e.replace(/[\s="]/g,"_"),MR=(e,t)=>`${DR(e[0])}=${t-e[1]}ms`,qm=(e)=>(...t)=>{let r=void 0;for(let n=0,o=t.length;n<o;n++){let s=t[n];if(Ic(s)){if(r)t.splice(n,1);else t=t.slice(0,n).concat(t.slice(n+1));r=r?ns(r.reasons.concat(s.reasons)):s,n--}}if(r===void 0)r=Qh;return le((n)=>{let o=e??n.currentLogLevel;if(RR(n.minimumLogLevel,o))return $e;let s=n.getRef(Fm),i=n.getRef(ck);if(i.size>0){let a=new Date(s.currentTimeMillisUnsafe());for(let c of i)c.log({cause:r,fiber:n,date:a,logLevel:o,message:t})}return $e})},ni,pV,NR=(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")}`,ZR,qR;var Dt=E(()=>{_n();lt();Yh();co();on();oe();En();es();ze();Mh();It();ye();Yu();Oo();FE();zE();Ac();ct();rm();nm();JE=class JE extends Fc{fiberId;constructor(e,t=Uc){super("Interrupt",t,"Interrupted");this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[Ke](e){return Zc(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[Je](){return Yt(it(`${this._tag}:${this.fiberId}`))(ju(this.annotations))}};fm=v(2,(e,t)=>{if(e.reasons.length===0)return t;else if(t.reasons.length===0)return e;let r=new uo(gE(e.reasons,t.reasons));return at(e,r)?e:r}),rb=v(2,(e,t)=>{let r=!1,n=e.reasons.map((o)=>{if(ei(o))return r=!0,new Dc(t(o.error),o.annotations);return o});return r?ns(n):e}),fR=/\((.*)\)/g,hR={_A:B,_E:B},mR={id:0};pm=class pm{constructor(e,t=!0){this[xf]=hR,this.setContext(e),this.id=++mR.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)}[xf];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 ss(this.context,e)}addObserver(e){if(this._exit)return e(this._exit),oo;return this._observers.push(e),()=>{if(this._exit)return;let t=this._observers.indexOf(e);if(t>=0)this._observers.splice(t,1)}}interruptUnsafe(e,t){if(this._exit)return;let r=ga(e);if(this.currentStackFrame)r=Nc(r,ho(Ku,this.currentStackFrame));if(t)r=Nc(r,t);if(this._interruptedCause=this._interruptedCause?fm(this._interruptedCause,r):r,this.interruptible)if(this._running)this._deferredInterrupt=!0;else this.evaluate(nt(this._interruptedCause))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;else if(this._yielded!==void 0){let n=this._yielded;this._yielded=void 0,n()}let t=this.runLoop(e);if(t===Ks)return;let r=jE.interruptChildren&&jE.interruptChildren(this);if(r!==void 0)return this.evaluate(ge(r,()=>t));this._exit=t,this.runtimeMetrics?.recordFiberEnd(this.context,this._exit);for(let n=0;n<this._observers.length;n++)this._observers[n](t);this._observers.length=0,this._stack.length=0,this._children=void 0,this.context=Tn()}runLoop(e){let t=globalThis[oa];globalThis[oa]=this;let r=this._running;this._running=!0;let n=!1,o=e;this.currentOpCount=0;try{while(!0){if(this._deferredInterrupt)this._deferredInterrupt=!1,o=nt(this._interruptedCause);if(this.currentOpCount++,!n&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){n=!0;let s=o;o=ge(bf,()=>s)}if(o=this.currentTracerContext?this.currentTracerContext(o,this):o[et](this),o===Ks){let s=this._yielded;if(Js in s)return this._deferredInterrupt=!1,this._yielded=void 0,s;else if(this._deferredInterrupt){this._yielded=void 0,s();continue}return Ks}}}catch(s){if(!G(o,et))return os(`Fiber.runLoop: Not a valid effect: ${String(o)}`);return this.runLoop(os(s))}finally{this._running=r,globalThis[oa]=t}}getCont(e){if(this._deferredInterrupt)return this._deferredInterrupt=!1,OR;while(!0){let t=this._stack.pop();if(!t)return;let r=t[rs]&&t[rs](this);if(r)return r[e]=r,r;if(t[e])return t}}yieldWith(e){return this._yielded=e,Ks}children(){return this._children??=new Set}pipe(){return pe(this,arguments)}setContext(e){let t=this.context;if(this.context=e,t!==void 0&&iE(t,e))return;let r=this.getRef(Hh);if(r!==this.currentScheduler)this.currentScheduler=r,this._dispatcher=void 0;this.currentSpan=Lc(e,WE),this.currentLogLevel=this.getRef(em),this.minimumLogLevel=this.getRef(Of),this.currentStackFrame=this.getRef(Kh),this.maxOpsBeforeYield=this.getRef(RE),this.currentPreventYield=this.getRef(IE),this.runtimeMetrics=Lc(e,XE);let n=Lc(e,LE);this.currentTracerContext=n?n.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag==="Span"?this.currentSpan:void 0}};OR={[Ht](e,t){return nt(t._interruptedCause)},[Rr](e,t){return nt(t._interruptedCause)}},jE={interruptChildren:void 0},lb=v((e)=>G(e[0],xf),(e,t,r)=>le((n)=>{let o=Sf(n);return o=o&&r?pa(o,r):o??r,e.interruptUnsafe(t,o),wf(cb(e))})),se=Ne,nt=Kt,as=kn,ve=Ir({op:"Sync",[et](e){let t=this[Y](),r=e.getCont(Ht);return r?r[Ht](t,e):e.yieldWith(Ne(t))}}),Se=Ir({op:"Suspend",[et](e){return this[Y]()}}),ub=nf({onFailure:as,onSuccess:se}),fb=Ir({op:"Yield",[et](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{if(t)return;e.evaluate(fr)},this[Y]??0),e.yieldWith(()=>{t=!0})}}),bf=fb(0),kf=se(L()),$e=se(void 0),mm=Ir({op:"Async",single:!1,[et](e){let t=mt(()=>this[Y][0].bind(e.currentScheduler)),r=!1,n=!1,o=this[Y][1]?new AbortController:void 0,s=t((i)=>{if(r)return;if(r=!0,n)e.evaluate(i);else n=i},o?.signal);if(n!==!1)return n;if(n=!0,e._yielded=()=>{r=!0},o===void 0&&s===void 0)return Ks;return e._stack.push(xR(()=>(r=!0,o?.abort(),s??fr))),Ks}}),xR=Ir({op:"AsyncFinalizer",[rs](e){if(e.interruptible)e.interruptible=!1,e._stack.push(Af)},[Rr](e,t){return eb(e)?ge(this[Y](),()=>nt(e)):nt(e)}}),Om=zt(oo),Vc=Ir({op:"Iterator",single:!1,[Ht](e,t){let r=this[Y][0];while(!0){let n=r.next(e);if(n.done)return se(n.value);if(!qe(n.value))return t._stack.push(this),n.value;else if(n.value._tag==="Failure")return n.value;e=n.value.value}},[et](e){return this[Ht](this[Y][1],e)}}),si=v(2,(e,t)=>{let r=se(t);return ge(e,(n)=>r)}),cs=v(2,(e,t)=>ge(e,(r)=>Ft(t)?t:mt(()=>t(r)))),Pf=v(2,(e,t)=>ge(e,(r)=>si(Ft(t)?t:mt(()=>t(r)),r))),ym=v((e)=>Ft(e[1]),(e,t,r)=>Sb([e,t],r)),ge=v(2,(e,t)=>{let r=Object.create(yR);return r[Y]=e,r[Ht]=t.length!==1?(n)=>t(n):t,r}),yR=fo({op:"OnSuccess",[et](e){return e._stack.push(this),this[Y]}}),Eb=v(2,(e,t)=>{if(qe(e))return e._tag==="Success"?t(e.value):e;return ge(e,t)}),yo=v(2,(e,t)=>ge(e,(r)=>se(mt(()=>t(r))))),bb=v(2,(e,t)=>qe(e)?Tb(e,t):yo(e,t)),kb=v(2,(e,t)=>qe(e)?vb(e,t):wm(e,t)),fr=Ne(void 0),Tb=v(2,(e,t)=>e._tag==="Success"?Ne(t(e.value)):e),vb=v(2,(e,t)=>{if(e._tag==="Success")return e;let r=xa(e.cause);if(Ut(r))return e;return kn(t(r.success))}),Cb=v(2,(e,t)=>Tf(e)?t:e),Em=v(2,(e,t)=>le((r)=>{let n=r.context,o=t(n);if(n===o)return e;return r.setContext(o),ii(e,()=>{r.setContext(n);return})})),So=v(2,(e,t)=>{if(qe(e))return e;return Em(e,pa(t))}),$b=v((e)=>Ft(e[0]),(e,t)=>tl({while:no,body:$r(t?.disableYield?e:ge(e,(r)=>bf)),step:oo})),ls=v(2,(e,t)=>{let r=Object.create(SR);return r[Y]=e,r[Rr]=t.length!==1?(n)=>t(n):t,r}),SR=fo({op:"OnFailure",[et](e){return e._stack.push(this),this[Y]}}),vf=v(3,(e,t,r)=>ls(e,(n)=>{let o=t(n);return Ut(o)?nt(o.failure):mt(()=>r(o.success,n))})),Yc=v(2,(e,t)=>vf(e,xa,(r)=>t(r))),Ab=v(2,(e,t)=>ls(e,(r)=>cs(mt(()=>t(r)),nt(r)))),Rb=v((e)=>Ft(e[0]),(e,t,r,n)=>ls(e,(o)=>{let s=xa(o);if(Ut(s))return nt(s.failure);if(!t(s.success))return n?mt(()=>n(s.success)):nt(o);return mt(()=>r(s.success))})),km=v((e)=>Ft(e[0]),(e,t,r,n)=>ls(e,(o)=>{let s=xa(o);if(Ut(s))return nt(s.failure);let i=t(s.success);if(Ut(i))return n?mt(()=>n(i.failure)):nt(o);return mt(()=>r(i.success))})),Pm=v((e)=>Ft(e[0]),(e,t,r,n)=>{let o=Array.isArray(t)?(s)=>G(s,"_tag")&&t.includes(s._tag):Bs(t);return Rb(e,o,r,n)}),Ib=v((e)=>Ft(e[0]),(e,t,r)=>{let n;return km(e,(o)=>(n??=Object.keys(t),G(o,"_tag")&&Jo(o._tag)&&n.includes(o._tag)?gt(o):ut(o)),(o)=>mt(()=>t[o._tag](o)),r)}),wm=v(2,(e,t)=>Yc(e,(r)=>pb(()=>t(r)))),Fb=v((e)=>Ft(e[0]),(e,t)=>{if(!t?.log)return Cf(e,{onFailure:(n)=>$e,onSuccess:(n)=>$e});let r=qm(t.log===!0?void 0:t.log);return Sa(e,{onFailure(n){let o=KE(n);return Ut(o)?nt(o.failure):t.message===void 0?r(n):r(t.message,n)},onSuccess:(n)=>$e})}),Sa=v(2,(e,t)=>{let r=Object.create(ER);return r[Y]=e,r[Ht]=t.onSuccess.length!==1?(n)=>t.onSuccess(n):t.onSuccess,r[Rr]=t.onFailure.length!==1?(n)=>t.onFailure(n):t.onFailure,r}),ER=fo({op:"OnSuccessAndFailure",[et](e){return e._stack.push(this),this[Y]}}),Cf=v(2,(e,t)=>Sa(e,{onFailure:(r)=>{let n=r.reasons.find(ei);return n?mt(()=>t.onFailure(n.error)):nt(r)},onSuccess:t.onSuccess})),vm=v(2,(e,t)=>Cf(e,{onFailure:(r)=>ve(()=>t.onFailure(r)),onSuccess:(r)=>ve(()=>t.onSuccess(r))})),Db=v(2,(e,t)=>{if(qe(e)){if(e._tag==="Success")return Ne(t.onSuccess(e.value));let r=xa(e.cause);if(Ut(r))return e;return Ne(t.onFailure(r.success))}return vm(e,t)}),bR=Ir({op:"Exit",[et](e){return e._stack.push(this),this[Y]},[Ht](e,t,r){return se(r??Ne(e))},[Rr](e,t,r){return se(r??Kt(e))}}),Cm=v(2,(e,t)=>ym(e,ge(Dm(t.duration),t.orElse))),Mb=v(2,(e,t)=>Cm(e,{duration:t,orElse:()=>as(new Mm)})),Jc=rt("effect/Scope"),PR=gm(function*(e,t,r){let n=[],o=[],s=Array.from(t.values()),i=ya();for(let a=s.length-1;a>=0;a--){let c=s[a];if(e.strategy==="sequential")n.push(yield*Hc(c(r)));else o.push(If(i,c(r),!0,!0,"inherit"))}if(o.length>0)n=yield*hm(o);return yield*Qb(n)}),wR={_tag:"Empty"},el=Jc,qb=Gc(Jc),ii=Ir({op:"OnExit",single:!1,[et](e){return e._stack.push(this),this[Y][0]},[rs](e){if(e.interruptible&&this[Y][2]!==!0)e._stack.push(Af),e.interruptible=!1},[Ht](e,t,r){r??=Ne(e);let n=this[Y][1](r);return n?ge(n,(o)=>r):r},[Rr](e,t,r){r??=Kt(e);let n=this[Y][1](r);return n?ge(kR(r,n),(o)=>r):r}}),fs=v(2,ii),Wb=v(2,(e,t)=>fs(e,(r)=>t)),Lb=v(3,(e,t,r)=>fs(e,(n)=>{let o=t(n);return Ut(o)?$e:r(o.success,n)})),zb=v(2,(e,t)=>Lb(e,wb,t)),Xb=le((e)=>nt(ga(e.id))),jb=Ir({op:"SetInterruptible",[rs](e){if(e.interruptible=this[Y],e._interruptedCause&&e.interruptible)return()=>nt(e._interruptedCause)}}),Af=jb(!0),TR=jb(!1),tl=Ir({op:"While",[Ht](e,t){if(this[Y].step(e),this[Y].while())return t._stack.push(this),this[Y].body();return fr},[et](e){if(this[Y].while())return e._stack.push(this),this[Y].body();return fr}}),Rf=v((e)=>typeof e[1]==="function",(e,t,r)=>Se(()=>{let n=r?.concurrency??1,o=n==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,n);if(o===1)return CR(e,t,r);let s=Cn(e),i=s.length;if(i===0)return r?.discard?$e:se([]);let a=r?.discard?void 0:Array(i),c=QR({f:t,out:a},s,{concurrency:o});return c?si(c,a):se(a)})),QR=Bb({onItem(e,t,r){return e.f(t,r)},step(e,t,r,n){if(r._tag==="Failure")return r;else if(e.out)e.out[n]=r.value}}),Im=v((e)=>Ft(e[0]),(e,t,r)=>le((n)=>{let o=If(n,e,r?.startImmediately,!0,r?.uninterruptible);if(!o._exit)if(t.state._tag!=="Closed"){let s={};Bc(t,s,()=>gR((a)=>a===o.id?$e:Ef(o))),o.addObserver(()=>_m(t,s))}else o.interruptUnsafe(n.id,Sf(n));return se(o)})),Gb=v((e)=>Ft(e[0]),(e,t)=>ge(el,(r)=>Im(e,r,t))),Yb=v(2,(e,t)=>{if(e._exit)return e;else if(t.state._tag==="Closed")return e.interruptUnsafe(e.id),e;let r={};return Bc(t,r,()=>Ef(e)),e.addObserver(()=>_m(t,r)),e}),Hb=nl(Tn()),ek=Kb(Tn()),rk=tk(Tn()),GE=se(!0),YE=se(!1);Fm=Be("effect/Clock",{defaultValue:()=>new sk});ik=BigInt(1e6),ak=function(){let e=globalThis.process?.hrtime;if(typeof e?.bigint==="function")return()=>e.bigint();if(typeof performance<"u"&&typeof performance.now==="function")return()=>BigInt(Math.round(performance.now()*1e6));let t=BigInt(0);return()=>{let r=BigInt(Date.now())*ik;if(r>t)t=r;return t}}(),_R=function(){let e=BigInt(1e9),t;return()=>{let r=ak(),n=BigInt(Date.now())*ik;if(t===void 0)t=n-r;else{let o=t+r;if((n>o?n-o:o-n)>e)t=n-r}return t+r}}();Mm=class Mm extends aa("TimeoutError"){[cm]=cm;constructor(e){super({message:e})}};Nm=class Nm extends aa("AsyncFiberError"){[lm]=lm;constructor(e){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:e})}};ol=class ol extends aa("UnknownError"){[um]=um;constructor(e,t){super({message:t,cause:e})}};Zm=Be("effect/Console/CurrentConsole",{defaultValue:()=>globalThis.console}),AR=YS(ef,$R),RR=tf(AR),ck=Be("effect/Loggers/CurrentLoggers",{defaultValue:()=>new Set([ZR,qR])}),IR=Be("effect/Logger/LogToStderr",{defaultValue:mh}),UR={[FR]:{_Message:B,_Output:B},pipe(){return pe(this,arguments)}},ni={bold:"1",red:"31",green:"32",yellow:"33",blue:"34",cyan:"36",white:"37",gray:"90",black:"30",bgBrightRed:"101"},pV={None:[],All:[],Trace:[ni.gray],Debug:[ni.blue],Info:[ni.green],Warn:[ni.yellow],Error:[ni.red],Fatal:[ni.bgBrightRed,ni.black]},ZR=lk(({cause:e,date:t,fiber:r,logLevel:n,message:o})=>{let s=Array.isArray(o)?o.slice():[o];if(e.reasons.length>0)s.push(yf(e));let i=t.getTime(),a=r.getRef(tm),c="";for(let d of a)c+=` ${MR(d,i)}`;let l=r.getRef(mf);if(Object.keys(l).length>0)s.push(l);let u=r.getRef(Zm);(r.getRef(IR)?u.error:u.log)(`[${NR(t)}] ${n.toUpperCase()} (#${r.id})${c}:`,...s)}),qR=lk(({cause:e,fiber:t,logLevel:r,message:n})=>{let o=t.getRef(Fm),s=t.getRef(mf),i=t.currentSpan;if(i===void 0||i._tag==="ExternalSpan")return;let a={};for(let[c,l]of Object.entries(s))Ar(a,c,l);if(a["effect.fiberId"]=t.id,a["effect.logLevel"]=r.toUpperCase(),e.reasons.length>0)a["effect.cause"]=yf(e);i.event(vS(Array.isArray(n)&&n.length===1?n[0]:n),o.currentTimeNanosUnsafe(),a)})});var Wm,Lm,uk,Ff,ai,sl,ci,zm,Uf,Mt,fk;var tr=E(()=>{ct();Dt();Wm=ei,Lm=ns,uk=Mc,Ff=tb,ai=rb,sl=dm,ci=yf,zm=FS,Uf=ca,Mt=DS,fk=ol});var li,ps,sn,Ur,kr,ui;var Mr=E(()=>{ct();Dt();li=Ne,ps=Kt,sn=kn,Ur=fr,kr=Tf,ui=Pb});var WR="~effect/Deferred",LR,Df=()=>{let e=Object.create(LR);return e.resumes=void 0,e.effect=void 0,e},fi=(e)=>zt((t)=>{if(e.effect)return t(e.effect);return e.resumes??=[],e.resumes.push(t),ve(()=>{let r=e.resumes;if(r===void 0)return;let n=r.indexOf(t);if(n>=0)r.splice(n,1)})}),zR,dk,Xm=(e)=>ve(()=>XR(e)),XR=(e)=>e.effect!==void 0,jm=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){let r=e.resumes;e.resumes=void 0;for(let n=0;n<r.length;n++)r[n](t)}return!0};var Vm=E(()=>{oe();Dt();It();LR={[WR]:{_A:B,_E:B},pipe(){return pe(this,arguments)}},zR=v(2,(e,t)=>ve(()=>jm(e,t))),dk=zR});var hk;var mk=E(()=>{rm();hk=Of});var il,Ea,al,Mf,cl,hs,Pr;var ll=E(()=>{Dt();il=Jc,Ea=Kc,al=qb,Mf=us,cl=Zb,hs=Nb,Pr=Qm});var BR="~effect/Layer",Ok="~effect/Layer/MemoMap",GR=(e,t)=>(e.observers++,cs(us(t,(r)=>e.finalizer(r)),e.effect)),YR,yk=(e)=>{let t=Object.create(YR);return t.build=e,t},Bm=(e)=>yk((t,r)=>{let n=hs(r);return fs(e(t,n),(o)=>o._tag==="Failure"?Pr(n,o):$e)}),HR=(e)=>{let t=Bm((r,n)=>r.getOrElseMemoize(t,n,e));return t},JR=(e,t,r,n)=>{let o=Ea(),s=Df(),i={observers:1,effect:fi(s),finalizer:(a)=>Se(()=>{if(i.observers--,i.observers===0)return e.map.delete(t),Pr(o,a);return $e})};return e.map.set(t,i),us(r,i.finalizer).pipe(ge(()=>n(e,o)),fs((a)=>(i.effect=a,dk(s,a))))},Gm,Ym=()=>new Gm,KR=(e)=>new Gm(e),ul,Hm,Sk,ms=function(){if(arguments.length===1)return(e)=>gk(ho(arguments[0],e));return gk(ho(arguments[0],arguments[1]))},gk=(e)=>yk($r(se(e))),ba=function(){if(arguments.length===1)return(e)=>xk(arguments[0],e);return xk(arguments[0],arguments[1])},xk=(e,t)=>eI(yo(t,(r)=>ho(e,r))),eI=(e)=>HR((t,r)=>al(e,r)),Ek=(e,t,r)=>{let n=hs(r,"parallel");return Rf(e,(o)=>o.build(t,hs(n,"sequential")),{concurrency:e.length}).pipe(yo((o)=>fE(...o)))},Zf=(...e)=>Bm((t,r)=>Ek(e,t,r)),tI=(e,t,r)=>Bm((n,o)=>ge(Array.isArray(t)?Ek(t,n,o):t.build(n,o),(s)=>e.build(n,o).pipe(So(s),yo((i)=>r(i,s))))),bk;var Eo=E(()=>{lt();Vm();oe();ct();Dt();It();ll();YR={[BR]:{_ROut:B,_E:B,_RIn:B},pipe(){return pe(this,arguments)}};Gm=class Gm{get[Ok](){return Ok}parent;constructor(e){this.parent=e}map=new Map;get(e,t){let r=this.map.get(e);if(r)return GR(r,t);return this.parent?.get(e,t)}getOrElseMemoize(e,t,r){return Se(()=>{let n=this.get(e,t);if(n)return n;return JR(this,e,t,r)})}};ul=class ul extends rt()("effect/Layer/CurrentMemoMap"){static forkOrCreate(e){let t=cE(e,ul);return t?KR(t):Ym()}};Hm=v(3,(e,t,r)=>Gc(yo(e.build(t,r),mo(ul,t)),ul,t)),Sk=v(2,(e,t)=>le((r)=>Hm(e,ul.forkOrCreate(r.context),t))),bk=v(2,(e,t)=>tI(e,t,(r,n)=>pa(n,r)))});var sB,kk;var Pk=E(()=>{oe();sB=globalThis.Number,kk=v(2,(e,t)=>{let r=Math.pow(10,t);return Math.round(e*r)/r})});var $n,fl=(e)=>e.reasons.some(Jm),Jm=(e)=>e._tag==="Fail"&&zm(e.error),qf=(e)=>{let t,r=!1;for(let n of e.reasons)if(Jm(n))t??=n.error;else if(n._tag!=="Interrupt")r=!0;if(t===void 0)return ut(e);return r?ut(Lm(e.reasons.filter((n)=>!Jm(n)))):gt(t)},nI=(e)=>{let t=qf(e);return Ut(t)?t:gt(t.success.value)},Km=(e)=>{let t=qf(e);return!Ut(t)?li(t.success.value):ps(t.failure)},wk;var dl=E(()=>{tr();Mr();oe();Dt();Oo();$n=v(2,(e,t)=>vf(e,nI,(r)=>t(r))),wk=v(2,(e,t)=>Sa(e,{onSuccess:t.onSuccess,onFailure:(r)=>{let n=qf(r);return!Ut(n)?t.onDone(n.success.value):t.onFailure(n.failure)}}))});var oI=(e,t,r)=>_f((n)=>ge(r?.local?Hm(t,Ym(),n):Sk(t,n),(o)=>So(e,o))),Tk;var vk=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ff(s))return ue;return lI(sl(s))?iO(s):ue}));try{let s=globalThis.setInterval(oo,2147483647);n.addObserver(()=>{clearInterval(s)})}catch{}let o=r?.teardown??aI;return e({fiber:n,teardown:o})}),Kf="~effect/Runtime/errorExitCode",cI=(e)=>{if(typeof e==="object"&&e!==null&&Kf in e){let t=e[Kf];if(typeof t==="number")return t}return 1},Oi="~effect/Runtime/errorReported",lI=(e)=>{if(typeof e==="object"&&e!==null&&Oi in e){let t=e[Oi];if(typeof t==="boolean")return t}return!0};var ed=E(()=>{tr();ae();Mr();oe()});var Nk;var Zk=E(()=>{ed();Nk=Mk(({fiber:e,teardown:t})=>{let r=!1;e.addObserver((o)=>{process.removeListener("SIGINT",n),process.removeListener("SIGTERM",n),t(o,(s)=>{if(r||s!==0)process.exit(s)})});function n(){r=!0,e.interruptUnsafe(e.id)}process.on("SIGINT",n),process.on("SIGTERM",n)})});var fI;var Wk=E(()=>{Zk();fI=Nk});var Lk="~effect/platform/PlatformError",Po,zk,uO,Zr=(e)=>new uO(new zk(e)),wo=(e)=>new uO(new Po(e));var In=E(()=>{ma();Po=class Po extends Fr("BadArgument"){get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:""}`}};zk=class zk extends DE{get message(){return`${this._tag}: ${this.module}.${this.method}${this.pathOrDescriptor!==void 0?` (${this.pathOrDescriptor})`:""}${this.description?`: ${this.description}`:""}`}};uO=class uO extends Fr("PlatformError"){constructor(e){if("cause"in e)super({reason:e,cause:e.cause});else super({reason:e})}[Lk]=Lk;get message(){return this.reason.message}}});var Xk,jk;var Vk=E(()=>{Dt();Xk=Ef,jk=Yb});var Bk;var Gk=E(()=>{Dt();Bk=ok});var Yk="~effect/MutableRef",hI,Hk=(e)=>{let t=Object.create(hI);return t.current=e,t};var Jk=E(()=>{es();ct();hI={[Yk]:Yk,...Jt,toJSON(){return{_id:"MutableRef",current:bn(this.current)}}}});var OI,eP=()=>({head:void 0,tail:void 0,length:0}),Kk=()=>({array:[],mutable:!0,offset:0,next:void 0}),To=(e,t)=>{if(!e.tail)e.head=e.tail=Kk();else if(!e.tail.mutable)e.tail.next=Kk(),e.tail=e.tail.next;e.tail.array.push(t),e.length++},_a=(e)=>{e.head=e.tail=void 0,e.length=0},tP=(e,t)=>{if(t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let s=e.head.array;return _a(e),s}let r=Array(t),n=0,o=e.head;while(o){while(o.offset<o.array.length){if(r[n++]=o.array[o.offset],o.mutable)o.array[o.offset]=void 0;if(o.offset++,n===t){if(e.head=o,e.length-=t,e.length===0)_a(e);return r}}o=o.next}return _a(e),r},$a=(e)=>{if(!e.head)return OI;let t=e.head.array[e.head.offset];if(e.head.mutable)e.head.array[e.head.offset]=void 0;if(e.head.offset++,e.length--,e.head.offset===e.head.array.length)if(e.head.next)e.head=e.head.next;else _a(e);return t};var rP=E(()=>{OI=Symbol.for("effect/MutableList/Empty")});var xI="~effect/Queue",yI="~effect/Queue/Enqueue",SI="~effect/Queue/Dequeue",fO,EI,Ra=(e)=>le((t)=>{let r=Object.create(EI);return r.dispatcher=t.currentDispatcher,r.capacity=e?.capacity??Number.POSITIVE_INFINITY,r.strategy=e?.strategy??"suspend",r.messages=eP(),r.scheduleRunning=!1,r.state={_tag:"Open",takers:new Set,offers:new Set,awaiters:new Set},se(r)}),nP=(e)=>Ra({capacity:e}),yl=(e,t)=>Se(()=>{if(e.state._tag!=="Open")return nd;else if(e.messages.length>=e.capacity)switch(e.strategy){case"dropping":return nd;case"suspend":if(e.capacity<=0&&e.state.takers.size>0)return To(e.messages,t),pO(e),rd;return TI(e,t);case"sliding":return $a(e.messages),To(e.messages,t),rd}return To(e.messages,t),cP(e),rd}),Sl=(e,t)=>{if(e.state._tag!=="Open")return!1;else if(e.messages.length>=e.capacity){if(e.strategy==="sliding")return $a(e.messages),To(e.messages,t),!0;else if(e.capacity<=0&&e.state.takers.size>0)return To(e.messages,t),pO(e),!0;return!1}return To(e.messages,t),cP(e),!0},El,bl=(e,t)=>{if(e.state._tag!=="Open")return!1;let r=Kt(t),n=Cb(r,kI);if(e.state.offers.size===0&&e.messages.length===0)return hO(e,n),!0;return e.state={...e.state,_tag:"Closing",exit:n},!0},vo=(e)=>bl(e,Mc(ca())),dO=(e)=>ve(()=>{if(e.state._tag==="Done")return!0;_a(e.messages);let t=e.state.offers;if(hO(e,e.state._tag==="Open"?PI:e.state.exit),t.size>0){for(let r of t)if(r._tag==="Single")r.resume(nd);else r.resume(Ne(r.remaining.slice(r.offset)));t.clear()}return!0}),oP=(e)=>sP(e,1,Number.POSITIVE_INFINITY),sP=(e,t,r)=>Se(()=>wI(e,t,r)??cs(lP(e),sP(e,1,r))),Co=(e)=>Se(()=>aP(e)??cs(lP(e),Co(e))),iP=(e)=>Se(()=>{let t=aP(e);if(t===void 0)return se(L());if(t._tag==="Success")return se(ee(t.value));return se(L())}),aP=(e)=>{if(e.state._tag==="Done")return e.state.exit;if(e.messages.length>0){let t=$a(e.messages);return Aa(e),Ne(t)}else if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,Aa(e),e.capacity=0;let t=$a(e.messages);return Aa(e),Ne(t)}return},bI=(e)=>e.state._tag==="Done"?0:e.messages.length,nd,rd,kI,PI,pO=(e)=>{if(e.scheduleRunning=!1,e.state._tag==="Done"||e.state.takers.size===0)return;for(let t of e.state.takers)if(e.state.takers.delete(t),t(fr),e.messages.length===0)break},cP=(e)=>{if(e.scheduleRunning||e.state._tag==="Done"||e.state.takers.size===0)return;e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>pO(e),0)},wI=(e,t,r)=>{if(e.state._tag==="Done")return e.state.exit;else if(r<=0||t<=0)return Ne([]);else if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,Aa(e),e.capacity=0;let n=[$a(e.messages)];return Aa(e),Ne(n)}if(t=Math.min(t,e.capacity||1),t<=e.messages.length){let n=tP(e.messages,r);return Aa(e),Ne(n)}},TI=(e,t)=>zt((r)=>{if(e.state._tag!=="Open")return r(nd);let n={_tag:"Single",message:t,resume:r};return e.state.offers.add(n),ve(()=>{if(e.state._tag==="Open")e.state.offers.delete(n)})}),Aa=(e)=>{if(e.state._tag==="Done")return fl(e.state.exit.cause);else if(e.state.offers.size===0){if(e.state._tag==="Closing"&&e.messages.length===0)return hO(e,e.state.exit),fl(e.state.exit.cause);return!1}let t=e.capacity-e.messages.length;for(let r of e.state.offers)if(t===0)break;else if(r._tag==="Single")To(e.messages,r.message),t--,r.resume(rd),e.state.offers.delete(r);else{for(;r.offset<r.remaining.length;r.offset++){if(t===0)return!1;To(e.messages,r.remaining[r.offset]),t--}r.resume(Ne([])),e.state.offers.delete(r)}return!1},lP=(e)=>zt((t)=>{if(e.state._tag==="Done")return t(e.state.exit);return e.state.takers.add(t),ve(()=>{if(e.state._tag!=="Done")e.state.takers.delete(t)})}),hO=(e,t)=>{if(e.state._tag==="Done")return;let r=e.state;e.state={_tag:"Done",exit:t};for(let n of r.takers)n(t);r.takers.clear();for(let n of r.awaiters)n(t);r.awaiters.clear()};var kl=E(()=>{oe();ct();ct();Dt();rP();ze();dl();fO={_A:B,_E:B},EI={[xI]:fO,[yI]:fO,[SI]:fO,...Jt,toJSON(){return{_id:"effect/Queue",state:this.state._tag,size:bI(this)}}},El=v(2,(e,t)=>ve(()=>bl(e,t))),nd=Ne(!1),rd=Ne(!0),kI=kn(ca()),PI=Sm()});class dP{waiters=new Set;taken=0;permits;constructor(e){this.permits=e}get free(){return this.permits-this.taken}take(e){let t=Se(()=>{if(this.free<e)return uP(this,e,t);return this.taken+=e,se(e)});return t}takeIfAvailable(e){return Se(()=>{if(this.free<e)return se(!1);return this.taken+=e,se(!0)})}releaseUnsafe(e,t){if(this.taken-=t,this.waiters.size>0)e.currentDispatcher.scheduleTask(()=>{for(let r of this.waiters){if(this.free<=0)break;r()}},0);return this.free}resize(e){return le((t)=>{if(this.permits=e,this.free<0)return $e;return this.releaseUnsafe(t,0),$e})}release(e){return le((t)=>se(this.releaseUnsafe(t,e)))}get releaseAll(){return le((e)=>se(this.releaseUnsafe(e,this.taken)))}withPermits(e){return(t)=>ds((r)=>{let n=Se(()=>{if(this.free<e){let o=uP(this,e,$e);return ge(r(o),()=>n)}return this.taken+=e,ii(r(t),()=>{this.releaseUnsafe(ya(),e);return},!0)});return n})}withPermit=this.withPermits(1);withPermitsIfAvailable(e){return(t)=>ds((r)=>{if(this.free<e)return kf;return this.taken+=e,ii(r(xm(t)),()=>{this.releaseUnsafe(ya(),e);return},!0)})}}var fP=(e)=>new dP(e),uP=(e,t,r)=>zt((n)=>{if(e.free>=t)return n(r);let o=()=>{if(e.free<t)return;e.waiters.delete(o),n(r)};return e.waiters.add(o),ve(()=>{e.waiters.delete(o)})});var pP=E(()=>{ct();Dt()});var gP="~effect/Channel",hP=(e)=>G(e,gP),II,jt=(e)=>{let t=Object.create(II);return t.transform=(r,n)=>wr(e(r,n),(o)=>T(pl(o))),t},xP=(e,t)=>jt((r,n)=>H(un(e)(r,n),(o)=>t(o,n))),sd=(e)=>jt((t,r)=>e),yP=(e)=>jt(z(function*(t,r){let n=hs(r),o=(i)=>Pr(n,Km(i)),s=yield*ml(e(t,r,n),o);return ml(s,o)})),un=(e)=>e.transform,FI=(e,t,r)=>Ra({capacity:r?.bufferSize,strategy:r?.strategy}).pipe(Xf((n)=>cl(e,dO(n))),Xf((n)=>Ol(al(t(n),e),e))),SP=(e,t)=>jt((r,n)=>K(FI(n,e,t),oP)),EP=(e)=>jt((t,r)=>Ee(()=>un(e())(t,r))),bP,kP,mO,UI,PP,wP=()=>jt((e,t)=>ne(()=>{let r="",n=!1,o=L();function s(c){let l=[];function u(f){if(r.length===0)l.push(f);else l.push(r+f),r=""}for(let f=0;f<c.length;f++){let d=c[f];if(d.length!==0){let h=0,m=d.indexOf("\r"),b=d.indexOf(`
|
|
25
|
+
`);if(n){if(b===0)u(""),h=1,b=d.indexOf(`
|
|
26
|
+
`,h);else u("");n=!1}while(m!==-1||b!==-1)if(m===-1||b!==-1&&b<m)u(d.substring(h,b)),h=b+1,b=d.indexOf(`
|
|
27
|
+
`,h);else if(d.length===m+1)n=!0,m=-1;else u(d.substring(h,m)),h=m+(b===m+1?2:1),m=d.indexOf("\r",h),b=d.indexOf(`
|
|
28
|
+
`,h);r=r+d.substring(h,d.length-(n?1:0))}}return Qn(l)?l:null}let i=Ee(()=>{if(o._tag==="Some")return Mt(o.value);return wk(e,{onSuccess:a,onFailure:pl,onDone:(c)=>{if(o=ee(c),r.length>0||n){let l=r;return r="",n=!1,T([l])}return Mt(c)}})});function a(c){let l=s(c);return l!==null?T(l):i}return i})),TP,id=(e)=>jt((t,r)=>{let n;return T(Ee(()=>{if(n)return n;return e.pipe(al(r),H((o)=>un(o)(t,r)),H((o)=>n=o))}))}),DI=(e,t,r)=>Ee(()=>{let n=Ea(),o=un(e)(Mt(),n);return $n(H(o,t),r?r:T).pipe(Ca((s)=>Pr(n,s)))}),OO,gO=(e,t)=>un(e)(Mt(),t);var Pl=E(()=>{_n();tr();ae();oe();ze();It();ye();dl();kl();ll();II={[gP]:{_Env:B,_InErr:B,_InElem:B,_OutErr:B,_OutElem:B},pipe(){return pe(this,arguments)}},bP=sd(T(Mt())),kP=v(2,(e,t)=>xP(e,(r)=>ne(()=>{let n=0;return K(r,(o)=>t(o,n++))}))),mO=v(2,(e,t)=>UI(e,(r)=>T(t(r)))),UI=v(2,(e,t)=>xP(e,(r)=>T($n(r,(n)=>H(t(n),Mt))))),PP=v((e)=>hP(e[0])&&hP(e[1]),(e,t,r)=>yP(z(function*(n,o,s){let i=r?.haltStrategy??"both",a=yield*nP(0);yield*cl(s,dO(a));let c=0;function l(f,d){if(c++,!fl(d))return El(a,d);switch(i){case"both":return c===2?El(a,d):ue;case"left":case"right":return f===i?El(a,d):ue;case"either":return El(a,d)}}let u=(f,d,h)=>un(d)(n,h).pipe(H((m)=>m.pipe(H((b)=>yl(a,b)),ko)),ml((m)=>an(Pr(h,Km(m)),l(f,m))),Ol(s));return yield*u("left",e,hs(s)),yield*u("right",t,hs(s)),Co(a)}))),TP=v(2,(e,t)=>jt((r,n)=>H(un(e)(r,n),(o)=>un(t)(o,n)))),OO=v(3,(e,t,r)=>Ee(()=>{let n=t();return DI(e,(o)=>Lf({while:no,body:()=>o,step:(s)=>{n=r(n,s)}}),()=>T(n))}))});var MI="~effect/Stream",NI,ZI,vP=(e)=>{let t=Object.create(ZI);return t.channel=e,t};var CP=E(()=>{oe();It();NI={_R:B,_E:B,_A:B},ZI={[MI]:NI,pipe(){return pe(this,arguments)}}});var QP="~effect/Sink",_P,WI,LI,wl=(e)=>G(e,QP),xO=(e)=>yO((t,r)=>un(e)(t,r).pipe(H(ko({disableYield:!0})),$n(T))),yO=(e)=>{let t=Object.create(LI);return t.transform=e,t},zI=(e)=>jt((t,r)=>T(H(e.transform(t,r),Mt))),Tl,$P=(e)=>XI(ka((t)=>e(t),{discard:!0})),XI=(e)=>yO((t)=>t.pipe(H(e),ko({disableYield:!0}),$n(()=>_P))),AP=(e)=>xO(id(K(e,zI)));var cd=E(()=>{tr();Pl();ae();oe();It();ye();dl();_P=T([void 0]),WI={_A:B,_In:B,_L:B,_E:B,_R:B},LI={[QP]:WI,pipe(){return pe(this,arguments)}},Tl=yO((e)=>$n(ko(e,{disableYield:!0}),()=>_P))});var jI="~effect/RcRef",EO,VI,BI,RP,IP=(e)=>eO((t)=>{let r=t.context,n=ss(r,il),o=new RP(e.acquire,r,n,e.idleTimeToLive?ha(e.idleTimeToLive):void 0);return Nr(Mf(n,()=>{let s=o.state._tag==="Acquired"?Pr(o.state.scope,Ur):ue;return o.state=VI,s}),o)}),GI=(e)=>oO(function t(r){switch(e.state._tag){case"Closed":return Yf;case"Acquired":return e.state.refCount++,e.state.fiber?Nr(Xk(e.state.fiber),e.state):T(e.state);case"Empty":{let n=Ea();return e.semaphore.withPermit(Ee(()=>{if(e.state._tag!=="Empty")return t(r);return r(ys(e.acquire,mo(e.context,il,n))).pipe(K((o)=>{let s={_tag:"Acquired",value:o,scope:n,fiber:void 0,refCount:1,invalidated:!1};return e.state=s,s}),Ca((o)=>ui(o)?Pr(n,o):ue))}))}}}),FP;var UP=E(()=>{lt();Yh();ae();Mr();Vk();oe();It();ll();pP();EO={_tag:"Empty"},VI={_tag:"Closed"},BI={_A:B,_E:B};RP=class RP{[jI]=BI;pipe(){return pe(this,arguments)}state=EO;semaphore=fP(1);acquire;context;scope;idleTimeToLive;constructor(e,t,r,n){this.acquire=e,this.context=t,this.scope=r,this.idleTimeToLive=n}};FP=z(function*(e){let t=e,r=yield*GI(t),n=yield*Gf,o=t.idleTimeToLive!==void 0&&vE(t.idleTimeToLive);return yield*Mf(n,()=>{if(r.refCount--,r.refCount>0)return ue;if(t.idleTimeToLive===void 0)return t.state=EO,Pr(r.scope,Ur);else if(r.invalidated)return Pr(r.scope,Ur);else if(!o)return ue;return r.fiber=tO(t.idleTimeToLive).pipe(H(()=>{if(t.state._tag==="Acquired"&&t.state.refCount===0)return t.state=EO,Pr(r.scope,Ur);return ue}),hl(ne(()=>{r.fiber=void 0})),Jf(t.context),jk(t.scope)),ue}),r.value})});var DP,bO;var MP=E(()=>{UP();DP=IP,bO=FP});var JI="~effect/Stream",gi=(e)=>G(e,JI),fn,NP=(e)=>fn(sd(e)),KI=(e,t)=>fn(jt((r,n)=>H(gO(e.channel,n),(o)=>t(o,n)))),kO=(e)=>e.channel,ZP=(e,t)=>fn(SP(e,t)),Ia,qP=(e)=>fn(EP(()=>e().channel)),Es=(e)=>fn(id(K(e,kO))),eF,WP,ld,LP,zP=(e)=>e.channel.pipe(TP(wP()),fn),PO,XP=(e)=>OO(e.channel,()=>[],(t,r)=>{for(let n=0;n<r.length;n++)t.push(r[n]);return t}),jP=(e)=>OO(e.channel,()=>"",(t,r)=>t+r.join(""));var Fa=E(()=>{_n();tr();Pl();ae();Mr();oe();CP();ye();fn=vP,Ia=fn(bP),eF=v(2,(e,t)=>qP(()=>{let r=0;return fn(kP(e.channel,Sr((n)=>t(n,r++))))})),WP=v((e)=>gi(e[0])&&gi(e[1]),(e,t,r)=>fn(PP(kO(e),kO(t),r))),ld=v(2,(e,t)=>KI(e,(r,n)=>ne(()=>{let o,s,i=Ee(()=>{if(s!==void 0){let c=s;return s=void 0,T(c)}return r}).pipe(bo((c)=>(o=sn(c),Mt()))),a=K(Ee(()=>t.transform(i,n)),([c,l])=>(s=l,ri(c)));return Ee(()=>o?o:a)}))),LP=v((e)=>gi(e[0]),(e,t)=>qP(()=>{let r=new TextDecoder(t?.encoding);return eF(e,(n)=>r.decode(n,{stream:!0}))})),PO=v(2,(e,t)=>Uk((r)=>gO(e.channel,r).pipe(H((n)=>t.transform(n,r)),K(([n])=>n))))});var VP="~effect/platform/FileSystem",Qo=(e)=>typeof e==="bigint"?e:BigInt(e),Cl,Z3,Ql,BP=(e)=>Ql.of({...e,[VP]:VP,exists:(t)=>Ho(e.access(t),Nr(!0),wa("PlatformError",(r)=>r.reason._tag==="NotFound"?T(!1):N(r))),readFileString:(t,r)=>H(e.readFile(t),(n)=>xt({try:()=>new TextDecoder(r).decode(n),catch:(o)=>wo({module:"FileSystem",method:"readFileString",description:"invalid encoding",cause:o})})),stream:z(function*(t,r){let n=yield*e.open(t,{flag:"r"});if(r?.offset)yield*n.seek(r.offset,"start");let o=r?.bytesToRead!==void 0?Qo(r.bytesToRead):void 0,s=BigInt(0),i=Qo(r?.chunkSize??65536),a=n.readAlloc(i);return NP(T(H(Ee(()=>{if(o!==void 0&&o<=s)return Mt();return o!==void 0&&o-s<i?n.readAlloc(o-s):a}),er({onNone:()=>Mt(),onSome:(c)=>(s+=BigInt(c.length),T(ri(c)))}))))},Es),sink:(t,r)=>Ho(e.open(t,{flag:"w",...r}),K((n)=>$P((o)=>n.writeAll(o))),AP),writeFileString:(t,r,n)=>H(xt({try:()=>new TextEncoder().encode(r),catch:(o)=>wo({module:"FileSystem",method:"writeFileString",description:"could not encode string",cause:o})}),(o)=>e.writeFile(t,o,n))}),ud="~effect/platform/FileSystem/File",wO;var TO=E(()=>{_n();tr();lt();ae();oe();ze();In();cd();Fa();Cl=BigInt(1024),Z3=Cl*Cl*Cl*Cl*Cl,Ql=rt("effect/platform/FileSystem");wO=class wO extends rt()("effect/platform/FileSystem/WatchBackend"){}});function YP(e,t){let r="",n=0,o=-1,s=0,i;for(let a=0;a<=e.length;++a){if(a<e.length)i=e.charCodeAt(a);else if(i===47)break;else i=47;if(i===47){if(o===a-1||s===1);else if(o!==a-1&&s===2){if(r.length<2||n!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){let c=r.lastIndexOf("/");if(c!==r.length-1){if(c===-1)r="",n=0;else r=r.slice(0,c),n=r.length-1-r.lastIndexOf("/");o=a,s=0;continue}}else if(r.length===2||r.length===1){r="",n=0,o=a,s=0;continue}}if(t){if(r.length>0)r+="/..";else r="..";n=2}}else{if(r.length>0)r+="/"+e.slice(o+1,a);else r=e.slice(o+1,a);n=a-o-1}o=a,s=0}else if(i===46&&s!==-1)++s;else s=-1}return r}function tF(e,t){let r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");if(!r)return n;if(r===t.root)return r+n;return r+e+n}function rF(e){if(e.protocol!=="file:")return N(new Po({module:"Path",method:"fromFileUrl",description:"URL must be of scheme file"}));else if(e.hostname!=="")return N(new Po({module:"Path",method:"fromFileUrl",description:"Invalid file URL host"}));let t=e.pathname;for(let r=0;r<t.length;r++)if(t[r]==="%"){let n=t.codePointAt(r+2)|32;if(t[r+1]==="2"&&n===102)return N(new Po({module:"Path",method:"fromFileUrl",description:"must not include encoded / characters"}))}return T(decodeURIComponent(t))}function oF(e){let t=new URL("file://"),r=HP(e);if(e.charCodeAt(e.length-1)===nF&&r[r.length-1]!=="/")r+="/";return t.pathname=uF(r),T(t)}function uF(e){if(e.includes("%"))e=e.replace(sF,"%25");if(e.includes("\\"))e=e.replace(iF,"%5C");if(e.includes(`
|
|
29
|
+
`))e=e.replace(aF,"%0A");if(e.includes("\r"))e=e.replace(cF,"%0D");if(e.includes("\t"))e=e.replace(lF,"%09");return e}var _o="~effect/platform/Path",xi,HP=function(){let t="",r=!1,n=void 0;for(let o=arguments.length-1;o>=-1&&!r;o--){let s;if(o>=0)s=arguments[o];else{let i=globalThis.process;if(n===void 0&&"process"in globalThis&&typeof i==="object"&&i!==null&&typeof i.cwd==="function")n=i.cwd();s=n}if(s.length===0)continue;t=s+"/"+t,r=s.charCodeAt(0)===47}if(t=YP(t,!r),r)if(t.length>0)return"/"+t;else return"/";else if(t.length>0)return t;else return"."},nF=47,sF,iF,aF,cF,lF,vO;var CO=E(()=>{lt();ae();oe();In();xi=rt("effect/Path");sF=/%/g,iF=/\\/g,aF=/\n/g,cF=/\r/g,lF=/\t/g;vO=xi.of({[_o]:_o,resolve:HP,normalize(e){if(e.length===0)return".";let t=e.charCodeAt(0)===47,r=e.charCodeAt(e.length-1)===47;if(e=YP(e,!t),e.length===0&&!t)e=".";if(e.length>0&&r)e+="/";if(t)return"/"+e;return e},isAbsolute(e){return e.length>0&&e.charCodeAt(0)===47},join(){if(arguments.length===0)return".";let e;for(let t=0;t<arguments.length;++t){let r=arguments[t];if(r.length>0)if(e===void 0)e=r;else e+="/"+r}if(e===void 0)return".";return vO.normalize(e)},relative(e,t){if(e===t)return"";if(e=vO.resolve(e),t=vO.resolve(t),e===t)return"";let r=1;for(;r<e.length;++r)if(e.charCodeAt(r)!==47)break;let n=e.length,o=n-r,s=1;for(;s<t.length;++s)if(t.charCodeAt(s)!==47)break;let a=t.length-s,c=o<a?o:a,l=-1,u=0;for(;u<=c;++u){if(u===c){if(a>c){if(t.charCodeAt(s+u)===47)return t.slice(s+u+1);else if(u===0)return t.slice(s+u)}else if(o>c){if(e.charCodeAt(r+u)===47)l=u;else if(u===0)l=0}break}let d=e.charCodeAt(r+u),h=t.charCodeAt(s+u);if(d!==h)break;else if(d===47)l=u}let f="";for(u=r+l+1;u<=n;++u)if(u===n||e.charCodeAt(u)===47)if(f.length===0)f+="..";else f+="/..";if(f.length>0)return f+t.slice(s+l);else{if(s+=l,t.charCodeAt(s)===47)++s;return t.slice(s)}},dirname(e){if(e.length===0)return".";let t=e.charCodeAt(0),r=t===47,n=-1,o=!0;for(let s=e.length-1;s>=1;--s)if(t=e.charCodeAt(s),t===47){if(!o){n=s;break}}else o=!1;if(n===-1)return r?"/":".";if(r&&n===1)return"//";return e.slice(0,n)},basename(e,t){let r=0,n=-1,o=!0,s;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";let i=t.length-1,a=-1;for(s=e.length-1;s>=0;--s){let c=e.charCodeAt(s);if(c===47){if(!o){r=s+1;break}}else{if(a===-1)o=!1,a=s+1;if(i>=0)if(c===t.charCodeAt(i)){if(--i===-1)n=s}else i=-1,n=a}}if(r===n)n=a;else if(n===-1)n=e.length;return e.slice(r,n)}else{for(s=e.length-1;s>=0;--s)if(e.charCodeAt(s)===47){if(!o){r=s+1;break}}else if(n===-1)o=!1,n=s+1;if(n===-1)return"";return e.slice(r,n)}},extname(e){let t=-1,r=0,n=-1,o=!0,s=0;for(let i=e.length-1;i>=0;--i){let a=e.charCodeAt(i);if(a===47){if(!o){r=i+1;break}continue}if(n===-1)o=!1,n=i+1;if(a===46){if(t===-1)t=i;else if(s!==1)s=1}else if(t!==-1)s=-1}if(t===-1||n===-1||s===0||s===1&&t===n-1&&t===r+1)return"";return e.slice(t,n)},format:function(t){if(t===null||typeof t!=="object")throw TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return tF("/",t)},parse(e){let t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;let r=e.charCodeAt(0),n=r===47,o;if(n)t.root="/",o=1;else o=0;let s=-1,i=0,a=-1,c=!0,l=e.length-1,u=0;for(;l>=o;--l){if(r=e.charCodeAt(l),r===47){if(!c){i=l+1;break}continue}if(a===-1)c=!1,a=l+1;if(r===46){if(s===-1)s=l;else if(u!==1)u=1}else if(s!==-1)u=-1}if(s===-1||a===-1||u===0||u===1&&s===a-1&&s===i+1){if(a!==-1)if(i===0&&n)t.base=t.name=e.slice(1,a);else t.base=t.name=e.slice(i,a)}else{if(i===0&&n)t.name=e.slice(1,s),t.base=e.slice(1,a);else t.name=e.slice(i,s),t.base=e.slice(i,a);t.ext=e.slice(s,a)}if(i>0)t.dir=e.slice(0,i-1);else if(n)t.dir="/";return t},sep:"/",fromFileUrl:rF,toFileUrl:oF,toNamespacedPath:B})});function QO(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}var _l="~structural",fd="~sentinels",dd="~constructor",pd;var hd=E(()=>{oe();pd=so((e)=>{let t=QO(e)?.identifier;if(typeof t==="string")return t;return e.getExpected(pd)})});var fe,dn,$o,kt,md=(e)=>e===fe?L():ee(e),$O=(e)=>e._tag==="None"?$o:dn(e.value);var Od=E(()=>{Mr();ze();ct();fe=Symbol(),dn=li,$o=dn(fe),kt=dn(fe)});function IO(e){return G(e,Al)&&e[Al]===Al}function dF(e){return Object.hasOwn(e,"input")}function RO(e,t,r){if(IO(e))return e;if(typeof e==="string")return new rr({message:e},t,r);let n=typeof e.issue==="string"?new rr({message:e.issue},t,r):e.issue;return new Fn(e.path,n)}function JP(e,t,r){if(e===void 0)return;if(typeof e==="boolean")return e?void 0:new rr(void 0,t,r);return RO(e,t,r)}function KP(e,t,r,n){if(Array.isArray(t)){if(!Qn(t))return;return t.length===1?RO(t[0],r,n):new Nt(e,Sr(t,(o)=>RO(o,r,n)),r,n)}return JP(t,r,n)}function gd(e){return dF(e)?he(e.input):void 0}function ew(e){let t=e.annotations?.expected;return typeof t==="string"?t:void 0}function Rl(e,t){let r=gd(t);return r===void 0?`Expected ${e}`:`Expected ${e}, got ${r}`}function tw(e){let t=e.annotations?.expected;if(typeof t==="string")return t;switch(e._tag){case"Filter":return"<filter>";case"FilterGroup":return e.checks.map((r)=>tw(r)).join(" & ")}}function mF(){return(e)=>$l(e,"")}function $l(e,t){let r;switch(e._tag){case"Filter":{let n=hF(e);if(n!==void 0)r=n;else{if(e.issue._tag!=="InvalidValue")return $l(e.issue,t);let o=ew(e.issue);r=o===void 0?Rl(tw(e.filter),e):Rl(o,e.issue)}break}case"Encoding":return $l(e.issue,t);case"Pointer":return $l(e.issue,t+wS(e.path));case"Composite":case"AnyOf":{if(e._tag==="Composite"||e.issues.length>0)return e.issues.map((n)=>$l(n,t)).join(`
|
|
30
|
+
`);r=Il(e)??Rl(pd(e.ast),e);break}default:r=pF(e);break}return t?`${r}
|
|
31
|
+
at ${t}`:r}function Il(e){if(e._tag==="Pointer")return;if(e._tag==="Encoding")return Il(e.issue);let r=(e._tag==="Filter"?e.filter.annotations:("annotations"in e)?e.annotations:e.ast.annotations)?.[e._tag==="MissingKey"?"messageMissingKey":e._tag==="UnexpectedKey"?"messageUnexpectedKey":"message"];if(typeof r==="string")return r}var Al="~effect/SchemaIssue/Issue",pn,FO,UO,Fn,Fl,xd,Nt,qr,rr,Ul,DO,pF=(e)=>{let t=Il(e);if(t!==void 0)return t;switch(e._tag){case"InvalidType":return Rl(pd(e.ast),e);case"InvalidValue":{let r=ew(e);if(r!==void 0)return Rl(r,e);let n=gd(e);return n===void 0?"Expected a valid value":`Invalid data ${n}`}case"MissingKey":return"Missing key";case"UnexpectedKey":{let r=gd(e);return r===void 0?"Expected no excess property":`Unexpected key with value ${r}`}case"Forbidden":return"Forbidden operation";case"OneOf":{let r=gd(e);return r===void 0?"Expected exactly one member to match":`Expected exactly one member to match the input ${r}`}}},hF=(e)=>Il(e.issue)??Il(e),rw;var yi=E(()=>{_n();on();hd();Od();ye();pn=class pn{[Al]=Al;constructor(e,t){if(t?.reportInput===!0&&e!==fe)this.input=e}};FO=class FO extends pn{_tag="Filter";filter;issue;constructor(e,t,r,n){super(r,n);this.filter=e,this.issue=t}};UO=class UO extends pn{_tag="Encoding";ast;issue;constructor(e,t,r,n){super(r,n);this.ast=e,this.issue=t}};Fn=class Fn extends pn{_tag="Pointer";path;issue;constructor(e,t){super();this.path=e,this.issue=t}};Fl=class Fl extends pn{_tag="MissingKey";annotations;constructor(e){super();this.annotations=e}};xd=class xd extends pn{_tag="UnexpectedKey";ast;constructor(e,t,r){super(t,r);this.ast=e}};Nt=class Nt extends pn{_tag="Composite";ast;issues;constructor(e,t,r,n){super(r,n);this.ast=e,this.issues=t}};qr=class qr extends pn{_tag="InvalidType";ast;constructor(e,t,r){super(t,r);this.ast=e}};rr=class rr extends pn{_tag="InvalidValue";annotations;constructor(e,t,r){super(t,r);this.annotations=e}};Ul=class Ul extends pn{_tag="AnyOf";ast;issues;constructor(e,t,r,n){super(r,n);this.ast=e,this.issues=t}};DO=class DO extends pn{_tag="OneOf";ast;successes;constructor(e,t,r,n){super(r,n);this.ast=e,this.successes=t}};rw=mF()});function Dl(e){let t;for(let r of e.reasons){if(!Wm(r)||!IO(r.error))return;t??=r.error}return t}function Da(e,t){let r=Dl(e);if(r===void 0)throw Error(t,{cause:e});return r}var MO=E(()=>{tr();yi()});function ow(e){return e.run===sw.run}function bs(){return sw}function gF(e){return new Si((t,r)=>Lt(t)?zf:e(t.value,r))}function yt(e){return iw(fa(e))}function Ml(e){return gF((t,r)=>e(t,r).pipe(Qa(ee)))}function iw(e){return new Si((t)=>T(e(t)))}function NO(e){return new Si((t)=>{let r=KS(t,wt);return tt(r)?T(r):Qa(e,ee)})}function Nl(){return yt(globalThis.String)}function yd(){return yt(globalThis.Number)}function aw(){return yt(pf)}function cw(){return Ml((e,t)=>aO(Ck(hf(e)),()=>new rr({expected:"a valid Base64 string"},e,t)))}var Si,sw;var Sd=E(()=>{ae();Jh();ze();It();ye();yi();Si=class Si extends Tc{run;constructor(e){super();this.run=e}map(e){return new Si((t,r)=>this.run(t,r).pipe(Qa(fa(e))))}compose(e){if(ow(this))return e;if(ow(e))return this;return new Si((t,r)=>this.run(t,r).pipe(Tr((n)=>e.run(n,r))))}};sw=new Si(T)});function SF(e){return G(e,Zl)&&e[Zl]===Zl}function ql(e){return new St(Ml(e.decode),Ml(e.encode))}function Wl(e){return new St(yt(e.decode),yt(e.encode))}function Ed(){return EF}var Zl="~effect/SchemaTransformation/Transformation",St,qO=(e)=>{if(SF(e))return e;return new St(e.decode,e.encode)},EF,bd,bF=(e)=>yh(e)&&typeof e.message==="string",kF=(e)=>{let r=Object.hasOwn(e,"cause")?Error(e.message,{cause:lw(e.cause)}):Error(e.message);if(typeof e.name==="string"&&e.name!=="Error")r.name=e.name;if(typeof e.stack==="string")r.stack=e.stack;return r},PF=(e)=>{try{let t=Ys(e);return t===void 0?he(e):JSON.parse(t)}catch{return he(e)}},wF=(e,t,r)=>{let n={name:e.name,message:typeof e.message==="string"?e.message:""};if(t?.includeStack&&typeof e.stack==="string")n.stack=e.stack;if(!t?.excludeCause&&e.cause!==void 0)n.cause=r(e.cause);return n},TF=(e)=>{let t=new WeakSet,r=(n)=>{if(ES(n)){if(t.has(n))return"[Circular]";t.add(n);let o=wF(n,e,r);return t.delete(n),o}return PF(n)};return r},lw=(e)=>bF(e)?kF(e):e,uw=(e)=>Wl({decode:lw,encode:TF(e)}),fw,dw;var kd=E(()=>{ae();on();ye();Sd();yi();St=class St{[Zl]=Zl;_tag="Transformation";decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new St(this.encode,this.decode)}compose(e){return new St(this.decode.compose(e.decode),e.encode.compose(this.encode))}};EF=new St(bs(),bs());bd=new St(yd(),Nl()),fw=ql({decode:(e,t)=>URL.canParse(e)?T(new URL(e)):N(new rr({expected:"a valid URL string"},e,t)),encode:(e)=>T(e.href)}),dw=new St(cw(),aw())});function bi(e){return(t)=>t._tag===e}class vt{to;transformation;constructor(e,t){this.to=e,this.transformation=t}}class Ao{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,r=void 0,n=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=r,this.annotations=n}}function hw(e){let t=globalThis.String(e.literal);return Tt(e,[new vt(new Un(t),new St(yt(()=>e.literal),yt(()=>t)))])}function zO(e,t){return e.some((r)=>r.annotations?.representation?.id===t||r._tag==="FilterGroup"&&zO(r.checks,t))}function XO(e,t,r=Td){let n,o;function s(i){switch(i._tag){case"String":case"TemplateLiteral":return(n??=Object.keys(e)).filter((a)=>i.matchPart(a,r)!==void 0);case"Number":return(n??=Object.keys(e)).filter((a)=>i.matchKey(a,r)!==void 0);case"Symbol":return(o??=Object.getOwnPropertySymbols(e)).filter((a)=>i.matchKey(a,r)!==void 0);case"Union":return[...new Set(i.types.flatMap(s))];default:return[]}}return s(sg(ws(t)))}class vd{name;type;constructor(e,t){this.name=e,this.type=t}}function jO(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every(jO);default:return!1}}function UF(e){return jO(e)&&jO(ws(e))}class KO{parameter;type;constructor(e,t){if(!UF(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,Ps(t)&&!Xw(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}}function VO(e,t,r){if(r._tag==="Failure")return Pd(e,e.ast,t.name,r);if(r===kt)return;let n=r[Y];if(n!==fe){Ar(e.out,t.name,n);return}if(delete e.out[t.name],!Ps(t.type)){let o=new Fn([t.name],new Fl(t.type.context?.annotations));if(e.options.errors==="all"){if(e.issues)e.issues.push(o);else e.issues=[o];return}else return sn(new Nt(e.ast,[o],e.input,e.options))}}function _w(e,t){if(!e)return t;if(!t)return e;return[...e,...t]}function Qd(e,t,r){return new Cd(Reflect.ownKeys(e).map((n)=>new vd(n,e[n].ast)),[],r,t)}function eg(e){return e.ast}function tg(e,t=void 0){return new Bl(!1,e.map((r)=>r.ast),[],void 0,t)}function _d(e,t,r){return new Dn(e.map(eg),t,void 0,r)}function $w(e){switch(e._tag){case"Null":return["null"];case"Undefined":return["undefined"];case"String":case"TemplateLiteral":return["string"];case"Number":return["number"];case"Boolean":return["boolean"];case"Symbol":case"UniqueSymbol":return["symbol"];case"BigInt":return["bigint"];case"Arrays":return["array"];case"ObjectKeyword":return["object","array","function"];case"Objects":return e.propertySignatures.length||e.indexSignatures.length?["object"]:["string","number","boolean","symbol","bigint","object","array","function"];case"Enum":return Array.from(new Set(e.enums.map(([,t])=>typeof t)));case"Literal":return[typeof e.literal];case"Union":return Array.from(new Set(e.types.flatMap($w)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function jl(e){switch(e._tag){default:return[];case"Declaration":{let t=e.annotations?.[fd];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap((t)=>{let r=t.type;if(!Ps(r)){if(Ma(r))return[{key:t.name,literal:r.literal}];if(LO(r))return[{key:t.name,literal:r.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,r)=>{if(!Ps(t)){if(Ma(t))return[{key:r,literal:t.literal}];if(LO(t))return[{key:r,literal:t.symbol}]}return[]});case"Union":{if(e.types.length===0)return[];let t=e.types.map((r)=>jl($d(r)));return t[0].filter((r)=>t.every((n)=>n.some((o)=>o.key===r.key&&o.literal===r.literal)))}case"Suspend":return jl(e.thunk())}}function DF(e){let t=Ow.get(e);if(t)return t;let r,n=0,o,s,i=!0;for(let a=0;a<e.length;a++){let c=e[a],l=$d(c);if($F(l))continue;if(i)if(Ma(l)||LO(l)){s??=new Map;let f=Ma(l)?l.literal:l.symbol,d=s.get(f);if(!d)s.set(f,d=[]);d.push(c)}else i=!1;let u=jl(l);if(u.length){r??=new Map,n++;for(let{key:f,literal:d}of u){let h=r.get(f);if(!h)r.set(f,h=[new Map,new Set]);h[1].add(a);let m=h[0].get(d);if(!m)h[0].set(d,m=new Set);m.add(a)}}else{o??={};let f=$w(l);for(let d of f)(o[d]??=[]).push(a)}}if(i&&s)s.forEach(Object.freeze),t=(a)=>s.get(a)??Ll;else if(r?.size===1&&!o){let[a,[c]]=r.entries().next().value,l=c;for(let[u,f]of c)l.set(u,Object.freeze(Array.from(f,(d)=>e[d])));t=(u,f)=>{if(Xu(u)){let d=Object.hasOwn(u,a)?u[a]:void 0;if(d!==void 0)return l.get(d)??Ll;if(f)return e}return Ll}}else if(r){let a;for(let c of r)if((!a||c[1][0].size>a[1][0].size)&&c[1][1].size===n)a=c;t=(c,l)=>{let u=c===null?"null":Array.isArray(c)?"array":typeof c,f=o?.[u]??Ll;if(!Xu(c))return f.map((m)=>e[m]);let d=new Set(f),h;if(a){let[m,[b]]=a,x=Object.hasOwn(c,m),O=x?c[m]:void 0;if(x&&(!l||O!==void 0)){let S=b.get(O);if(!S)return f.map((y)=>e[y]);for(let y of S)d.add(y);h=m}}if(h===void 0)for(let[m,[b,x]]of r){let O=Object.hasOwn(c,m),S=O?c[m]:void 0;if(O&&(!l||S!==void 0)){let y=b.get(S);if(y)for(let g of y)d.add(g)}else if(l)for(let y of x)d.add(y)}for(let[m,[b,x]]of r){if(m===h)continue;let O=Object.hasOwn(c,m),S=O?c[m]:void 0;if(O&&(!l||S!==void 0)){let y=b.get(S);for(let g of d)if(x.has(g)&&!y?.has(g))d.delete(g)}}return Array.from(d).sort((m,b)=>m-b).map((m)=>e[m])}}else t=(a)=>{let c=a===null?"null":Array.isArray(a)?"array":typeof a;return(o?.[c]??Ll).map((l)=>e[l]).filter(MF(a))};return Ow.set(e,t),t}function MF(e){return(t)=>{let r=$d(t);return r._tag==="Literal"?r.literal===e:r._tag==="UniqueSymbol"?r.symbol===e:!0}}function Aw(e,t,r=!1){return DF(t)(e,r)}function gw(e,t,r,n){let o=Dl(t);if(!o)return ps(t);return sn(new Ul(e,[o],r,n))}function xw(e){return e?"":"readonly "}function yw(e){return e?"?":""}function Ad(e,t,r=!1){return new wd((n,o,s)=>KP(o,e(n,o,s),n,s),t,r)}function Iw(e){return Ad((t)=>globalThis.Number.isFinite(t),{expected:"a finite number",representation:{id:"effect/schema/isFinite",payload:null},toJsonSchema:()=>({type:"number"}),toCode:()=>({runtime:"Schema.isFinite()"}),arbitrary:{constraint:{noInfinity:!0,noNaN:!0}},...e})}function ng(e,t){let r=e.source,n=new globalThis.RegExp(r,e.flags);return Ad((o)=>(n.lastIndex=0,n.test(o)),{expected:`a string matching the RegExp ${r}`,representation:{id:"effect/schema/isPattern",payload:{source:r,flags:e.flags}},toJsonSchema:()=>({pattern:r}),arbitrary:{constraint:{patterns:[e.source]}},...t})}function Gl(e,t){let r=Object.getOwnPropertyDescriptors(e);return t(r),Object.create(Object.getPrototypeOf(e),r)}function qF(e){return Fw.get(e)??e}function Tt(e,t){if(e.encoding===t)return e;return Gl(e,(r)=>{r.encoding.value=t})}function Rd(e,t){if(e.context===t)return e;let r=qF(e);if(r.context===t)return r;let n=Gl(e,(o)=>{o.context.value=t});return Fw.set(n,r),n}function Yl(e,t){if(e.checks){let r=e.checks[e.checks.length-1];return Uw(e,Vh(e.checks.slice(0,-1),r.annotate(t)))}return Gl(e,(r)=>{r.annotations.value={...r.annotations.value,...t}})}function Uw(e,t){if(e._tag==="Suspend"&&t)throw Error("Cannot add checks to Suspend");if(e.checks===t)return e;return Gl(e,(r)=>{r.checks.value=t})}function Pi(e,t){return Uw(e,_w(e.checks,t))}function Id(e,t){let r=t(e.to);return r===e.to?e:new vt(r,e.transformation)}function Dw(e,t){let r=e,n=r[r.length-1],o=Id(n,t);return o===n?e:Vh(e.slice(0,e.length-1),o)}function Mw(e){return(t)=>t.encoding?Tt(t,Dw(t.encoding,e)):t}function Nw(e,t){return Mw((r)=>Rd(r,t))(e)}function Fd(e,t){function r(n){if(n.encoding){let o=n.encoding[n.encoding.length-1];return t?.stopAt?.(o)?n:Tt(n,Dw(n.encoding,r))}return e(n)}return ea(r)}function WF(e,t,r){let n=new vt(e,t);return Tt(r,r.encoding?[...r.encoding,n]:[n])}function Na(e,t){let r=!1,n=Array(e.length);for(let o=0;o<e.length;o++){let s=e[o],i=t(s);if(i!==s)r=!0;n[o]=i}return r?n:e}function Ud(e,t){let r=e.context?new Ao(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new Ao(!1,!1,void 0,t);return Rd(e,r)}function qw(e,t){let r=new St(NO(t),bs()),n=new vt(zl,r),o=e.context?new Ao(e.context.isOptional,e.context.isMutable,n,e.context.annotations):new Ao(!1,!1,n);return Rd(e,o)}function Ww(e,t,r){return WF(e,r,t)}function zF(e){let t=[],r=[];function n(o){switch(o._tag){case"Literal":if(gh(o.literal))t.push(o.literal);return;case"UniqueSymbol":t.push(o.symbol);return;case"Never":return;case"Union":for(let s=0;s<o.types.length;s++)n(o.types[s]);return;default:r.push(o)}}return n(e),{literals:t,parameters:r}}function Lw(e,t){let{literals:r,parameters:n}=zF(e);return new Cd(r.map((o)=>new vd(o,t)),n.map((o)=>new KO(o,t)))}function Ps(e){return e.context?.isOptional??!1}function zw(e){return e.annotations?.[_l]===!0||e._tag==="FilterGroup"&&e.checks.every(zw)}function XF(e){function t(n){if(zw(n))return[n];return n._tag==="FilterGroup"?n.checks.flatMap(t):[]}let r=e.flatMap(t);return of(r)?r:void 0}function jF(e,t){let r=t,n=r.length,o=r[n-1],s=[new vt(ks(Tt(e,void 0)),r[0].transformation.flip())];for(let a=1;a<n;a++)s.unshift(new vt(ks(r[a-1].to),r[a].transformation.flip()));let i=ks(o.to);if(i.encoding)return Tt(i,[...i.encoding,...s]);else return Tt(i,s)}function Xw(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(Xw);default:return!1}}function og(e,t){let r=dn(t);return(n,o)=>{if(n===fe)return $o;if(n===t)return r;return N(new qr(e,n,o))}}function Hl(e,t){return(r,n)=>{if(r===fe)return $o;if(t(r))return kt;return N(new qr(e,r,n))}}function jw(e){return ng(BO,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:BO.source}),...e})}function Ts(e,t,r,n,o){for(let s=0;s<e.length;s++){let i=e[s];if(i._tag==="FilterGroup"){if(r=Ts(i.checks,t,r,n,o),r&&(o.errors!=="all"||r[r.length-1].filter.aborted))return r}else{let a=i.run(t,n,o);if(a){let c=new FO(i,a,t,o);if(r)r.push(c);else r=[c];if(o.errors!=="all"||i.aborted)return r}}}return r}function Bw(e){if(!GO(e))return;let t=e.annotations?.[dd];return io(t)?t(e.typeParameters):void 0}function JF(e){return e===null||typeof e==="string"||typeof e==="boolean"||typeof e==="number"&&globalThis.Number.isFinite(e)}function KF(e){return e===void 0||typeof e==="string"}function Gw(e,t){let r=new WeakMap,n=[];e:while(!0){if(typeof e!=="object"||e===null){if(!t(e))return!1}else{let o=e,s=r.get(o);if(s===!1)return!1;if(s===void 0){let i=Array.isArray(o);if(!i){let a=Object.getPrototypeOf(o);if(a!==null&&a!==Object.prototype&&Object.getPrototypeOf(a)!==null)return!1}r.set(o,!1),n.push({value:o,keys:i?o.length:Object.keys(o),index:0})}}while(n.length>0){let o=n[n.length-1],s=o.keys;if(typeof s==="number"){if(o.index<s){e=o.value[o.index++];continue e}}else if(o.index<s.length){e=o.value[s[o.index++]];continue e}r.set(o.value,!0),n.pop()}return!0}}function e2(e){return Gw(e,JF)}function t2(e){return Gw(e,KF)}var GO,$F,Ma,LO,Sw,AF,RF,Td,pw="~effect/Schema",Wr,ki,Ew,bw,kw,IF,YO,Pw,zl,Un,ww,Xl,Tw,HO,vw,Cw,Bl,FF,JO=(e)=>(e=e==="unbounded"?1/0:e??1,e>1?{concurrency:e}:void 0),Pd=(e,t,r,n)=>{if(n.cause.reasons.length===0)return n;let o=Dl(n.cause);if(o===void 0)return ps(ai(n.cause,(i)=>new Nt(t,[new Fn([r],i)],e.input,e.options)));let s=new Fn([r],o);if(e.options.errors==="all")if(e.issues)e.issues.push(s);else e.issues=[s];else return sn(new Nt(t,[s],e.input,e.options))},Qw="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?",Cd,mw,$d,Ow,Ll,Dn,NF,Rw,wd,Vl,rg,ZF,Fw,Dd,LF,Zw,Ei,ws,ks,sg,ig,BO,VF,Vw,BF,GF,YF="-?\\d+",$H,HF="Symbol\\((.*)\\)",AH,Yw,r2,ag;var Md=E(()=>{_n();tr();ae();Mr();on();oe();Dt();hd();MO();Od();It();ye();Sd();yi();kd();GO=bi("Declaration"),$F=bi("Never"),Ma=bi("Literal"),LO=bi("UniqueSymbol"),Sw=bi("Arrays"),AF=bi("Objects"),RF=bi("Suspend");Td={};Wr=class Wr{[pw]=pw;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,r=void 0,n=void 0){this.annotations=e,this.checks=t,this.encoding=r,this.context=n}toString(){return`<${this._tag}>`}};ki=class ki extends Wr{_tag="Declaration";typeParameters;run;encodingChecks;encodingRun;constructor(e,t,r,n,o,s,i,a){super(r,n,o,s);this.typeParameters=e,this.run=t,this.encodingChecks=i,this.encodingRun=a}getParser(){let e;return(t,r)=>{if(t===fe)return $o;return(e??=this.run(this.typeParameters))(t,this,r)}}_rebuild(e,t,r,n,o){let s=Na(this.typeParameters,e);return s===this.typeParameters&&t===this.checks&&r===this.encodingChecks&&n===this.run&&o===this.encodingRun?this:new ki(s,n,this.annotations,t,void 0,this.context,r,o)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks,this.run,this.encodingRun)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks,this.encodingRun??this.run,this.run)}getExpected(){let e=this.annotations?.expected;if(typeof e==="string")return e;return"<Declaration>"}};Ew=class Ew extends Wr{_tag="Null";getParser(){return og(this,null)}getExpected(){return"null"}};bw=new Ew;kw=class kw extends Wr{_tag="Undefined";getParser(){return og(this,void 0)}toCodecJson(){return Tt(this,[IF])}getExpected(){return"undefined"}};IF=new vt(bw,new St(yt(()=>{return}),yt(()=>null))),YO=new kw;Pw=class Pw extends Wr{_tag="Unknown";getParser(){return Hl(this,SS)}getExpected(){return"unknown"}};zl=new Pw;Un=class Un extends Wr{_tag="Literal";literal;constructor(e,t,r,n,o){super(t,r,n,o);if(typeof e==="number"&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${he(e)}`);this.literal=e}getParser(){return og(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==="bigint"?hw(this):this}toCodecStringTree(){return typeof this.literal==="string"?this:hw(this)}getExpected(){return typeof this.literal==="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}};ww=class ww extends Wr{_tag="String";getParser(){return Hl(this,Jo)}matchPart(e,t){let r=this.checks;return r&&!t.disableChecks&&Ts(r,e,void 0,this,t)?void 0:e}getExpected(){return"string"}};Xl=new ww;Tw=class Tw extends Wr{_tag="Number";getParser(){return Hl(this,Qc)}matchKey(e,t){return this._match(VF,e,t)}matchPart(e,t){return this._match(BO,e,t)}_match(e,t,r){if(!e.test(t))return;let n=globalThis.Number(t);if(r.disableChecks||!this.checks)return n;return Ts(this.checks,n,void 0,this,r)?void 0:n}toCodecJson(){if(this.checks&&(zO(this.checks,"effect/schema/isFinite")||zO(this.checks,"effect/schema/isInt")))return this;return Tt(this,[ZF])}toCodecStringTree(){if(this.toCodecJson()===this)return Tt(this,[BF]);return Tt(this,[GF])}getExpected(){return"number"}};HO=new Tw;vw=class vw extends Wr{_tag="Boolean";getParser(){return Hl(this,zu)}getExpected(){return"boolean"}};Cw=new vw;Bl=class Bl extends Wr{_tag="Arrays";isMutable;elements;rest;encodingChecks;constructor(e,t,r,n,o,s,i,a){super(n,o,s,i);this.isMutable=e,this.elements=t,this.rest=r,this.encodingChecks=a;let c=!1;for(let l=0;l<t.length;l++)if(Ps(t[l]))c=!0;else if(c)throw Error("A required element cannot follow an optional element. ts(1257)");if(c&&r.length>1)throw Error("A required element cannot follow an optional element. ts(1257)");for(let l=1;l<r.length;l++)if(Ps(r[l]))throw Error("An optional element cannot follow a rest element. ts(1266)")}getParser(e,t=e){let r=this,n,o,s=r.elements.length,i=Math.max(0,r.rest.length-1);function a(c,l){if(l<s)return n[l];else if(l>=c)return o[l-c+1];return o[0]}return cO(function*(c,l){if(c===fe)return fe;if(!Array.isArray(c))return yield*N(new qr(r,c,l));if(!n)n=r.elements.map((m)=>({ast:m,parser:t(m)})),o=r.rest.map((m)=>({ast:m,parser:t(m)}));let u=c.length,f={ast:r,getParser:a,input:c,len:u,tailThreshold:Math.max(s,u-i),output:new globalThis.Array(u),issues:void 0,options:l},d=JO(l?.concurrency),h=FF(f,c,{concurrency:d?.concurrency,end:r.rest.length===0?s:Math.max(u,s+i)});if(h)yield*h;if(r.rest.length===0&&u>s)for(let m=s;m<=u-1;m++){let b=new xd(r,c[m],l),x=new Fn([m],b);if(l.errors==="all")if(f.issues)f.issues.push(x);else f.issues=[x];else return yield*N(new Nt(r,[x],c,l))}if(f.issues)return yield*N(new Nt(r,f.issues,c,l));return f.output})}_rebuild(e,t,r){let n=Na(this.elements,e),o=Na(this.rest,e);return n===this.elements&&o===this.rest&&t===this.checks&&r===this.encodingChecks?this:new Bl(this.isMutable,n,o,this.annotations,t,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return"array"}};FF=rl()({onItem(e,t,r){let n=r<e.len?t:fe;return e.getParser(e.tailThreshold,r).parser(n,e.options)},step(e,t,r,n){if(r._tag==="Failure")return Pd(e,e.ast,n,r);let o=r===kt?t:r[Y];if(o!==fe)e.output[n]=o;else{let s=e.getParser(e.tailThreshold,n);if(Ps(s.ast))return;let i=new Fn([n],new Fl(s.ast.context?.annotations));if(e.options.errors==="all")if(e.issues)e.issues.push(i);else e.issues=[i];else return sn(new Nt(e.ast,[i],e.input,e.options))}}});Cd=class Cd extends Wr{_tag="Objects";propertySignatures;indexSignatures;encodingChecks;constructor(e,t,r,n,o,s,i){super(r,n,o,s);this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=i;let a=e.map((c)=>c.name).filter((c,l,u)=>u.indexOf(c)!==l);if(a.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(a)}. ts(2300)`)}getParser(e,t=e){let r=this,n=[];for(let x of r.propertySignatures)n.push(x.name);let o=n.length,s=r.indexSignatures.length,i=o&&s?new Set(n):void 0;if(!o&&!s)return Hl(r,xh);let a,c,l=(x,O,S,y,g)=>{if(g._tag==="Failure")return Pd(x,r,O,g)??Ur;let C=g===kt?y:g[Y];if(S!==fe&&C!==fe){if(o&&(i.has(O)||i.has(S)))return Ur;Ar(x.out,S,C)}return Ur},u=(x,O,S,y)=>{if(!y){let w=S.parserKey(O,x.options);if(!qe(w))return H(An(w),(_)=>u(x,O,S,_));y=w}if(y._tag==="Failure")return Pd(x,r,O,y)??Ur;let g=y===kt?O:y[Y],C=x.input[O],Q=S.parserValue(C,x.options);return qe(Q)?l(x,O,g,C,Q):H(An(Q),(w)=>l(x,O,g,C,w))},f=(x,O,S)=>{let y=x.input[O],g=S.parserValue(y,x.options);return qe(g)?l(x,O,O,y,g):H(An(g),(C)=>l(x,O,O,y,C))},d=s?rl()({onItem:(x,[O,S])=>u(x,O,S),step:(x,O,S)=>S._tag==="Failure"?S:void 0}):void 0,h=()=>{if(!a)a=r.propertySignatures.map((x)=>({parser:t(x.type),name:x.name,type:x.type})),c=s?r.indexSignatures.map((x)=>({is:x,parserKey:e(sg(x.parameter)),parserValue:t(x.type)})):void 0;return a},m=cO(function*(x,O){if(x===fe)return fe;if(!(typeof x==="object"&&x!==null&&!Array.isArray(x)))return yield*N(new qr(r,x,O));h();let S=x,y={},g={ast:r,input:S,out:y,issues:void 0,options:O},C=O.errors==="all",Q=O.onExcessProperty==="error",w=O.onExcessProperty==="preserve",_;if(!s&&(Q||w)){i??=new Set(n),_=Reflect.ownKeys(S);for(let F=0;F<_.length;F++){let R=_[F];if(!i.has(R))if(Q){let A=new xd(r,S[R],O),M=new Fn([R],A);if(C){if(g.issues)g.issues.push(M);else g.issues=[M];continue}else return yield*N(new Nt(r,[M],x,O))}else Ar(y,R,S[R])}}let I=JO(O?.concurrency);if(o){let F=mw(g,a,I);if(F)yield*F}if(s&&!I)for(let F=0;F<s;F++){let R=c[F],A=R.is.parameter===Xl?f:u,M=R.is.parameter===Xl?Object.keys(S):XO(S,R.is.parameter,O);for(let j=0;j<M.length;j++){let me=A(g,M[j],R);if(!qe(me))yield*me;else if(me._tag==="Failure")return yield*me}}else if(d){let F=ti();for(let A=0;A<s;A++){let M=c[A],j=XO(S,M.is.parameter,O);for(let me=0;me<j.length;me++)F.push([j[me],M])}let R=d(g,F,I);if(R)yield*R}if(g.issues)return yield*N(new Nt(r,g.issues,x,O));if(O.propertyOrder==="original"){let F=(_??Reflect.ownKeys(S)).concat(n),R={};for(let A of F)if(Object.hasOwn(y,A))Ar(R,A,y[A]);return R}return y});if(s)return m;let b=(x,O,S)=>{let y=a[O];return H(An(S),(g)=>{let C=VO(x,y,g);if(C)return C;let Q=()=>dn(x.out),w=mw(x,a.slice(O+1));return w?Tr(w,Q):Q()})};return(x,O)=>{if(x===fe)return $o;if(O.errors==="all"||O.onExcessProperty!==void 0||O.propertyOrder==="original"||O.concurrency!==void 0)return m(x,O);if(!(typeof x==="object"&&x!==null&&!Array.isArray(x)))return N(new qr(r,x,O));let S=h(),y=x,g={},C={ast:r,input:y,out:g,issues:void 0,options:O};try{for(let Q=0;Q<S.length;Q++){let w=S[Q],_=w.name,I=Object.hasOwn(y,_),F=I?y[_]:fe,R=w.parser(F,O);if(!qe(R))return b(C,Q,R);if(R===kt){if(I)Ar(g,_,F);continue}let A=VO(C,w,R);if(A)return A}}catch(Q){return xs(Q)}return dn(g)}}_rebuild(e,t,r,n){let o=Na(this.propertySignatures,(i)=>{let a=e(i.type);return a===i.type?i:new vd(i.name,a)}),s=Na(this.indexSignatures,(i)=>{let a=t(i.parameter),c=e(i.type);return a===i.parameter&&c===i.type?i:new KO(a,c)});return o===this.propertySignatures&&s===this.indexSignatures&&r===this.checks&&n===this.encodingChecks?this:new Cd(o,s,this.annotations,r,void 0,this.context,n)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){if(this.propertySignatures.length===0&&this.indexSignatures.length===0)return"object | array";return"object"}};mw=rl()({onItem(e,t){if(!Object.hasOwn(e.input,t.name))return t.parser(fe,e.options);let r=e.input[t.name];return Ar(e.out,t.name,r),t.parser(r,e.options)},step:VO});$d=ea((e)=>{while(!0){if(RF(e))return zl;let t=e.encoding;if(!t)return e.recur?.($d,B)??e;if(t.some((r)=>r.transformation._tag==="Middleware"&&r.transformation.decode!==B))return zl;e=t[t.length-1].to}});Ow=new WeakMap,Ll=Object.freeze([]);Dn=class Dn extends Wr{_tag="Union";types;mode;encodingChecks;constructor(e,t,r,n,o,s,i){super(r,n,o,s);this.types=e,this.mode=t,this.encodingChecks=i}getParser(e,t){let r=this;return(n,o)=>{if(n===fe)return $o;let s=Aw(n,r.types,t!==void 0);if(s.length===1){let l=e(s[0])(n,o);if(l._tag==="Success")return l;return qe(l)?gw(r,l.cause,n,o):wr(l,(u)=>gw(r,u,n,o))}let i={ast:r,compile:e,input:n,out:void 0,successes:r.mode==="oneOf"?[]:void 0,issues:void 0,options:o},a=JO(o?.concurrency),c=NF(i,s,a?{...a,orderedStep:!0}:void 0);if(!c){if(i.out)return i.out;return N(new Ul(r,i.issues??[],n,o))}return Tr(c,(l)=>{if(i.out===kt)return T(n);if(i.out)return i.out;return N(new Ul(r,i.issues??[],n,o))})}}_rebuild(e,t,r){let n=Na(this.types,e);return n===this.types&&t===this.checks&&r===this.encodingChecks?this:new Dn(n,this.mode,this.annotations,t,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let r of this.types){let n=r.matchPart(e,t);if(n!==void 0)return n}return}getExpected(e){let t=this.annotations?.expected;if(typeof t==="string")return t;if(this.types.length===0)return"never";let r=this.types.map((n)=>{let o=ws(n);switch(o._tag){case"Arrays":{let s=o.elements.filter(Ma);if(s.length>0)return`${xw(o.isMutable)}[ ${s.map((i)=>e(i)+yw(i.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let s=o.propertySignatures.filter((i)=>Ma(i.type));if(s.length>0)return`{ ${s.map((i)=>`${xw(i.type.context?.isMutable)}${sa(i.name)}${yw(i.type.context?.isOptional)}: ${e(i.type)}`).join(", ")}, ... }`;break}}return e(o)});return Array.from(new Set(r)).join(" | ")}};NF=rl()({onItem(e,t){return e.compile(t)(e.input,e.options)},step(e,t,r){if(r._tag==="Failure"){let n=Dl(r.cause);if(n===void 0)return r;if(e.issues)e.issues.push(n);else e.issues=[n]}else{if(e.out&&e.successes)return e.successes.push(t),sn(new DO(e.ast,e.successes,e.input,e.options));if(e.out=r,e.successes)e.successes.push(t);else return Ur}}}),Rw=new Dn([new Un("Infinity"),new Un("-Infinity"),new Un("NaN")],"anyOf");wd=class wd extends Tc{_tag="Filter";run;annotations;aborted;constructor(e,t=void 0,r=!1){super();this.run=e,this.annotations=t,this.aborted=r}annotate(e){return new wd(this.run,{...this.annotations,...e},this.aborted)}abort(){return new wd(this.run,this.annotations,!0)}and(e,t){return new Vl([this,e],t)}};Vl=class Vl extends Tc{_tag="FilterGroup";checks;annotations;constructor(e,t=void 0){super();this.checks=e,this.annotations=t}annotate(e){return new Vl(this.checks,{...this.annotations,...e})}and(e,t){return new Vl([this,e],t)}};rg=Pi(HO,[Iw()]),ZF=new vt(new Dn([rg,Rw],"anyOf"),new St(yd(),yt((e)=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));Fw=new WeakMap;Dd=ea((e)=>{let t=e.context?e.context.isOptional===!1?new Ao(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new Ao(!0,!1);return LF(Rd(e,t))}),LF=Mw(Dd),Zw=so((e)=>Dd(new Dn([e,YO],"anyOf")));Ei=ea((e)=>{if(e.encoding)return Ei(Tt(e,void 0));let t=e,r=t.recur?.(Ei)??t,n=r.encodingChecks;if(n){let o=r===e?n:Sw(r)||AF(r)||GO(r)&&r.typeParameters.length>0?XF(n):void 0;return Gl(r,(s)=>{s.encodingChecks.value=void 0,s.checks.value=_w(r.checks,o)})}return r}),ws=ea((e)=>Ei(ks(e)));ks=so((e)=>{if(e.encoding)return jF(e,e.encoding);let t=e;return t.flip?.(ks)??t.recur?.(ks)??t});sg=Fd((e)=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(sg)}}),ig=Fd((e)=>{switch(e._tag){default:return e;case"Symbol":case"UniqueSymbol":return e.toCodecStringTree();case"Union":return e.recur(ig)}}),BO=new globalThis.RegExp(`^${Qw}$`),VF=new globalThis.RegExp(`^(?:${Qw}|Infinity|-Infinity|NaN)$`);Vw=Pi(Xl,[jw()]),BF=new vt(Vw,bd),GF=new vt(new Dn([Vw,Rw],"anyOf"),bd),$H=new globalThis.RegExp(`^${YF}$`),AH=new globalThis.RegExp(`^${HF}$`);Yw=new ki([],()=>(e,t,r)=>e2(e)?kt:N(new qr(t,e,r)),{representation:{id:"effect/schema/Json",payload:null},expected:"JSON value",toCodecJson:()=>{return},toCodecStringTree:()=>ag,toArbitrary:()=>(e)=>e.jsonValue()});r2=new ki([],()=>(e,t,r)=>t2(e)?kt:N(new qr(t,e,r)),{expected:"StringTree",toCodecStringTree:()=>{return}}),ag=new vt(r2,Ed())});function lg(){return Object.assign((e)=>e,{option:(e)=>ee(e),result:(e)=>gt(e),is:(e)=>!0})}var Hw=E(()=>{ze();Oo()});var Kw,eT,Jw="~effect/ChildProcessSpawner/ChildProcessHandle",o2,ug=(e)=>Object.setPrototypeOf({...e},o2),tT=(e)=>{let t=(n,o)=>e(n).pipe(K((s)=>LP(o?.includeStderr===!0?s.all:s.stdout)),Es),r=(n,o)=>zP(t(n,o));return Za.of({spawn:e,exitCode:(n)=>mi(H(e(n),(o)=>o.exitCode)),streamString:t,streamLines:r,lines:(n,o)=>XP(r(n,o)),string:(n,o)=>jP(t(n,o))})},Za;var fg=E(()=>{Hw();lt();ae();es();Fa();Kw=lg(),eT=lg(),o2={[Jw]:Jw,...CS,toJSON(){return{_id:"ChildProcessHandle",pid:this.pid}}};Za=class Za extends rt()("effect/process/ChildProcessSpawner"){}});var rT="~effect/unstable/process/ChildProcess",s2,Nd=(e,t,r)=>Object.assign(Object.create(s2),{_tag:"StandardCommand",command:e,args:t,options:r}),Zd=function(...t){if(nT(t[0])){let[s,...i]=t,a=oT(s,i);return Nd(a[0]??"",a.slice(1),{})}if(typeof t[0]==="object"&&!Array.isArray(t[0])&&!nT(t[0])){let s=t[0];return function(i,...a){let c=oT(i,a);return Nd(c[0]??"",c.slice(1),s)}}if(typeof t[0]==="string"&&!Array.isArray(t[1])){let[s,i={}]=t;return Nd(s,[],i)}let[r,n=[],o={}]=t;return Nd(r,n,o)},nT=(e)=>Array.isArray(e)&&("raw"in e)&&Array.isArray(e.raw),qd=(e)=>{let t=/^fd(\d+)$/.exec(e);if(t===null)return;let r=parseInt(t[1],10);return r>=3?r:void 0},cT=(e)=>`fd${e}`,oT=(e,t)=>{let r=[];for(let[n,o]of e.entries())r=i2(e,t,r,o,n);return r},i2=(e,t,r,n,o)=>{let s=e.raw[o];if(s===void 0)throw Error(`Invalid backslash sequence: ${e.raw[o]}`);let{hasLeadingWhitespace:i,hasTrailingWhitespace:a,tokens:c}=c2(n,s),l=aT(r,c,i);if(o===t.length)return l;let u=t[o],f=Array.isArray(u)?u.map((d)=>sT(d)):[sT(u)];return aT(l,f,a)},sT=(e)=>{if(typeof e==="string")return e;return String(e)},iT,a2,c2=(e,t)=>{if(t.length===0)return{tokens:[],hasLeadingWhitespace:!1,hasTrailingWhitespace:!1};let r=iT.has(t[0]),n=[],o=0;for(let i=0,a=0;i<e.length;i+=1,a+=1){let c=t[a];if(iT.has(c)){if(o!==i)n.push(e.slice(o,i));o=i+1}else if(c==="\\"){let l=t[a+1];if(l===`
|
|
32
|
+
`)i-=1,a+=1;else if(l==="u"&&t[a+2]==="{")a=t.indexOf("}",a+3);else a+=a2[l]??1}}let s=o===e.length;if(!s)n.push(e.slice(o));return{tokens:n,hasLeadingWhitespace:r,hasTrailingWhitespace:s}},aT=(e,t,r)=>r||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t.at(0)}`,...t.slice(1)];var lT=E(()=>{lt();la();fg();s2={...Pn({label:"Command",evaluate(e){return zc(e.context,Za).spawn(this)}}),[rT]:rT},iT=new Set([" ","\t","\r",`
|
|
33
|
+
`]),a2={x:3,u:5}});var uT=(e,t,r)=>{let n=e.detached??r!=="win32";return{...t,detached:n,shell:e.shell,windowsHide:e.windowsHide??!n}};var be=(e,t)=>(r,[n])=>{let o="Unknown";switch(r.code){case"ENOENT":o="NotFound";break;case"EACCES":o="PermissionDenied";break;case"EEXIST":o="AlreadyExists";break;case"EISDIR":o="BadResource";break;case"ENOTDIR":o="BadResource";break;case"EBUSY":o="Busy";break;case"ELOOP":o="BadResource";break}return Zr({_tag:o,module:e,method:t,pathOrDescriptor:n,syscall:r.syscall,cause:r})};var dg=E(()=>{In()});var qa=(e)=>xO(mO(u2(e),(t)=>[t])),u2=(e)=>jt((t)=>{let r=e.evaluate();return T(f2({...e,writable:r,pull:t}))}),f2=(e)=>e.pull.pipe(H((t)=>{let r=0;return dr(function n(o){for(;r<t.length;)if(!e.writable.write(t[r++],e.encoding)){e.writable.once("drain",()=>n(o));return}o(ue)})}),ko({disableYield:!0}),Ta(dr((t)=>{let r=(n)=>t(N(e.onError(n)));return e.writable.once("error",r),ne(()=>{e.writable.off("error",r)})})),e.endOnDone!==!1?$n((t)=>{if("closed"in e.writable&&e.writable.closed)return Mt(t);return dr((r)=>{e.writable.once("finish",()=>r(Mt(t))),e.writable.end()})}):B);var pg=E(()=>{tr();Pl();ae();oe();dl();cd()});var Wa=(e)=>fn(p2(e)),p2=(e)=>jt((t,r)=>h2({scope:r,readable:e.evaluate(),onError:e.onError??m2,chunkSize:e.chunkSize,closeOnDone:e.closeOnDone})),h2=(e)=>{let t=e.readable,r=e.closeOnDone??!0,n=e.exit??Hk(void 0),o=Bk(!1);function s(){o.openUnsafe()}function i(l){n.current=sn(e.onError(l)),o.openUnsafe()}function a(){n.current=sn(Uf()),o.openUnsafe()}t.on("readable",s),t.once("error",i),t.once("end",a);let c=Ee(function l(){let u=e.readable.read(e.chunkSize);if(u===null){if(n.current)return n.current;if(t.readableEnded)return N(Uf());return o.closeUnsafe(),H(o.await,l)}let f=ri(u);while(!0){if(u=e.readable.read(e.chunkSize),u===null)break;f.push(u)}return T(f)});return Nr(cl(e.scope,ne(()=>{if(t.off("readable",s),t.off("error",i),t.off("end",a),r&&"closed"in e.readable&&!e.readable.closed)e.readable.destroy()})),c)},m2=(e)=>new fk(e);var hg=E(()=>{_n();tr();Pl();ae();Mr();Gk();Jk();ll();Fa()});import*as Wd from"child_process";import{PassThrough as mg}from"stream";var wi=(e)=>e instanceof globalThis.Error?e:new globalThis.Error(String(e)),Mn=(e,t,r)=>{let{commands:n}=pT(r),o=n.reduce((s,i)=>{let a=`${i.command} ${i.args.join(" ")}`;return s.length===0?a:`${s} | ${a}`},"");return be("ChildProcess",e)(t,[o])},fT=(e,t=()=>{})=>Wd.execFile("taskkill",["/pid",String(e.pid),"/T","/F"],{windowsHide:!0},t),g2,dT,pT=(e)=>{let t=[],r=[],n=(a)=>{switch(a._tag){case"StandardCommand":{t.push(a);break}case"PipedCommand":{n(a.left),r.push(a.options),n(a.right);break}}};if(n(e),t.length===0)throw Error("flattenCommand produced empty commands array");let[o,...s]=t;return{commands:[o,...s],pipeOptions:r}};var hT=E(()=>{Vm();ae();Mr();TO();Eo();CO();ye();cd();Fa();lT();fg();dg();pg();hg();g2=We(function*(){let e=yield*Ql,t=yield*xi,r=z(function*(g){if(ta(g.cwd))return;return yield*e.access(g.cwd),t.resolve(g.cwd)}),n=(g)=>g.extendEnv?{...globalThis.process.env,...g.env}:g.env,o=(g)=>gi(g)?"pipe":g,s=(g)=>wl(g)?"pipe":g,i=(g)=>{let C={stream:"pipe",encoding:"utf-8",endOnDone:!0};if(ta(g.stdin))return C;if(typeof g.stdin==="string")return{...C,stream:g.stdin};if(gi(g.stdin))return{...C,stream:g.stdin};return{stream:g.stdin.stream,encoding:g.stdin.encoding??C.encoding,endOnDone:g.stdin.endOnDone??C.endOnDone}},a=(g,C)=>{let Q=g[C];if(ta(Q))return{stream:"pipe"};if(typeof Q==="string")return{stream:Q};if(wl(Q))return{stream:Q};return{stream:Q.stream}},c=(g)=>{if(ta(g.additionalFds))return[];let C=[];for(let[Q,w]of Object.entries(g.additionalFds)){let _=qd(Q);if(wt(_))C.push({fd:_,config:w})}return C.sort((Q,w)=>Q.fd-w.fd)},l=(g,C,Q,w)=>{let _=[o(g.stream),s(C.stream),s(Q.stream)];if(w.length===0)return _;let I=w.reduce((F,{fd:R})=>Math.max(F,R),2);for(let F=3;F<=I;F++)_[F]="ignore";for(let{fd:F}of w)_[F]="pipe";return _},u=z(function*(g,C,Q){if(Q.length===0)return{getInputFd:()=>Tl,getOutputFd:()=>Ia};let w=new Map,_=new Map;for(let{config:I,fd:F}of Q){let R=C.stdio[F];switch(I.type){case"input":{let A=Tl;if(R&&"write"in R)A=qa({evaluate:()=>R,onError:(M)=>Mn(`fromWritable(fd${F})`,wi(M),g)});if(I.stream)yield*gl(PO(I.stream,A));w.set(F,A);break}case"output":{let A=Ia;if(R&&"read"in R){let M=new mg;R.on("error",(j)=>M.destroy(j)),R.pipe(M),A=Wa({evaluate:()=>M,onError:(j)=>Mn(`fromReadable(fd${F})`,wi(j),g)})}if(I.sink)A=ld(A,I.sink);_.set(F,A);break}}}return{getInputFd:(I)=>w.get(I)??Tl,getOutputFd:(I)=>_.get(I)??Ia}}),f=(g,C,Q)=>Ee(()=>{let w=Tl;if(_c(C.stdin))w=qa({evaluate:()=>C.stdin,onError:(_)=>Mn("fromWritable(stdin)",wi(_),g),endOnDone:Q.endOnDone,encoding:Q.encoding});if(gi(Q.stream))return Nr(gl(PO(Q.stream,w)),w);return T(w)}),d=(g,C,Q,w)=>{let _=C.stdout?(()=>{let R=new mg;return C.stdout.on("error",(A)=>R.destroy(A)),C.stdout.pipe(R),Wa({evaluate:()=>R,onError:(A)=>Mn("fromReadable(stdout)",wi(A),g)})})():Ia,I=C.stderr?(()=>{let R=new mg;return C.stderr.on("error",(A)=>R.destroy(A)),C.stderr.pipe(R),Wa({evaluate:()=>R,onError:(A)=>Mn("fromReadable(stderr)",wi(A),g)})})():Ia;if(wl(Q.stream))_=ld(_,Q.stream);if(wl(w.stream))I=ld(I,w.stream);let F=WP(_,I);return{stdout:_,stderr:I,all:F}},h=(g,C)=>dr((Q)=>{let w=Df(),_=Wd.spawn(g.command,g.args,C);return _.on("error",(I)=>{Q(N(Mn("spawn",I,g)))}),_.on("exit",(...I)=>{jm(w,li(I))}),_.on("spawn",()=>{Q(T([_,w]))}),ne(()=>{_.kill("SIGTERM")})}),m=(g,C,Q)=>{if(globalThis.process.platform==="win32")return dr((w)=>{fT(C,(_)=>{if(_)w(N(Mn("kill",wi(_),g)));else w(ue)})});return xt({try:()=>{globalThis.process.kill(-C.pid,Q)},catch:(w)=>Mn("kill",wi(w),g)})},b=(g,C)=>{if(globalThis.process.platform==="win32"){fT(g);return}try{globalThis.process.kill(-g.pid,C)}catch{}},x=(g,C,Q)=>Ee(()=>{if(!C.kill(Q)){let _=new globalThis.Error("Failed to kill child process");return N(Mn("kill",_,g))}return ue}),O=(g,C,Q)=>(w)=>{let _=Q?.killSignal??"SIGTERM";return ta(Q?.forceKillAfter)?w(C,g,_):Rk(w(C,g,_),{duration:Q.forceKillAfter,orElse:()=>w(C,g,"SIGKILL")})},S=(g,C)=>{let Q=C??"stdout";switch(Q){case"stdout":return g.stdout;case"stderr":return g.stderr;case"all":return g.all;default:{let w=qd(Q);if(wt(w))return g.getOutputFd(w);return g.stdout}}},y=z(function*(g){switch(g._tag){case"StandardCommand":{let C=i(g.options),Q=a(g.options,"stdout"),w=a(g.options,"stderr"),_=c(g.options),I=!0,F=yield*r(g.options),R=n(g.options),A=l(C,Q,w,_),[M,j]=yield*ln(h(g,uT(g.options,{cwd:F,env:R,stdio:A},process.platform)),z(function*([cr,Ji]){let Ki=yield*Xm(Ji),wc=O(cr,g,g.options);if(Ki){let[Go]=yield*fi(Ji);if(Go!==0&&_c(Go))return yield*Bf(wc(m));return yield*ue}if(!I)return yield*ue;return yield*wc((Go,mS,OS)=>m(Go,mS,OS).pipe(bo(()=>x(Go,mS,OS)),an(fi(Ji)))).pipe(Bf)})),me=eT(M.pid);M.on("exit",(cr)=>{if(cr!==0&&_c(cr))b(M,g.options.killSignal??"SIGTERM")});let xr=ne(()=>{if(!I)M.ref(),I=!0}),nn=ne(()=>{if(I)M.unref(),I=!1;return xr}),to=yield*f(g,M,C),{all:Qr,stderr:Hi,stdout:yr}=d(g,M,Q,w),{getInputFd:ar,getOutputFd:_r}=yield*u(g,M,_),ro=K(Xm(j),(cr)=>!cr),Bo=H(fi(j),([cr,Ji])=>{if(_c(cr))return T(Kw(cr));let Ki=new globalThis.Error(`Process interrupted due to receipt of signal: '${Ji}'`);return N(Mn("exitCode",Ki,g))});return ug({pid:me,exitCode:Bo,isRunning:ro,kill:(cr)=>O(M,g,cr)((Ki,wc,Go)=>m(Ki,wc,Go).pipe(bo(()=>x(Ki,wc,Go)),an(fi(j)))).pipe(jf),stdin:to,stdout:yr,stderr:Hi,all:Qr,getInputFd:ar,getOutputFd:_r,unref:nn})}case"PipedCommand":{let{commands:C,pipeOptions:Q}=pT(g),[w,..._]=C,I=[yield*y(w)];for(let M=0;M<_.length;M++){let j=_[M],me=Q[M]??{},xr=i(j.options),nn=Es(T(S(I[I.length-1],me.from))),to=me.to??"stdin";if(to==="stdin")I.push(yield*y(Zd(j.command,j.args,{...j.options,stdin:{...xr,stream:nn}})));else{let Qr=qd(to);if(wt(Qr)){let Hi=cT(Qr),yr=j.options.additionalFds??{};I.push(yield*y(Zd(j.command,j.args,{...j.options,additionalFds:{...yr,[Hi]:{type:"input",stream:nn}}})))}else I.push(yield*y(Zd(j.command,j.args,{...j.options,stdin:{...xr,stream:nn}})))}}let F=I[I.length-1],R=(M)=>ka([...I].reverse(),(j)=>Bf(j.kill(M)),{discard:!0}),A=We(function*(){let M=[];for(let j of I)M.push(yield*j.unref);return ka([...M].reverse(),(j)=>j,{discard:!0})});return ug({pid:F.pid,exitCode:F.exitCode,isRunning:F.isRunning,kill:R,stdin:F.stdin,stdout:F.stdout,stderr:F.stderr,all:F.all,getInputFd:F.getInputFd,getOutputFd:F.getOutputFd,unref:A})}}});return tT(y)}),dT=ba(Za,g2)});var mT=E(()=>{hT()});function OT(e=yT()){return e[6]=e[6]&15|64,e[8]=e[8]&63|128,e}function gT(e,t=yT()){let r=Math.min(Math.max(0,Math.trunc(e)),S2);return t[0]=Math.floor(r/1099511627776),t[1]=Math.floor(r/4294967296)&255,t[2]=Math.floor(r/16777216)&255,t[3]=Math.floor(r/65536)&255,t[4]=Math.floor(r/256)&255,t[5]=r&255,t[6]=t[6]&15|112,t[8]=t[8]&63|128,t}var y2=(e)=>e.toString(16).padStart(2,"0"),xT=(e)=>[e.subarray(0,4),e.subarray(4,6),e.subarray(6,8),e.subarray(8,10),e.subarray(10,16)].map((r)=>Array.from(r,y2).join("")).join("-"),yT=()=>globalThis.crypto.getRandomValues(new Uint8Array(16)),ST=(e)=>xT(e===void 0?OT():OT(e)),S2=281474976710655,ET=(e,t)=>xT(t===void 0?gT(e):gT(e,t));var bT="~effect/platform/Crypto",Og,kT=(e)=>{let t=e.randomBytes,r=(i)=>K(b2("randomBytes",i),t),n=(i)=>(i[0]&31)*281474976710656+i[1]*1099511627776+i[2]*4294967296+i[3]*16777216+i[4]*65536+i[5]*256+i[6],o=()=>n(t(7))/9007199254740992,s=()=>{while(!0){let i=t(7),a=n(i);if((i[0]&32)===0)return a+Number.MIN_SAFE_INTEGER;if(a<Number.MAX_SAFE_INTEGER)return a+1}};return Og.of({[bT]:bT,randomBytes:r,nextDoubleUnsafe:o,nextIntUnsafe:s,digest:e.digest,random:ne(()=>o()),randomBoolean:ne(()=>o()>0.5),randomInt:ne(()=>s()),randomBetween:(i,a)=>ne(()=>o()*(a-i)+i),randomIntBetween(i,a,c){let l=c?.halfOpen===!0?0:1;return ne(()=>{let u=Math.ceil(i),f=Math.floor(a);return Math.floor(o()*(f-u+l))+u})},randomShuffle:(i)=>ne(()=>{let a=Array.from(i);for(let c=a.length-1;c>=1;c=c-1){let l=Math.min(c,Math.floor(o()*(c+1))),u=a[c];a[c]=a[l],a[l]=u}return a}),randomUUIDv4:ne(()=>ST(t(16))),randomUUIDv7:sO((i)=>T(ET(i.currentTimeMillisUnsafe(),t(16))))})},b2=(e,t)=>Number.isSafeInteger(t)&&t>=0?T(t):N(wo({module:"Crypto",method:e,description:"size must be a non-negative safe integer"}));var PT=E(()=>{lt();ae();In();Og=rt("effect/Crypto")});import*as Ld from"crypto";var P2=(e)=>{switch(e){case"SHA-1":return"sha1";case"SHA-256":return"sha256";case"SHA-384":return"sha384";case"SHA-512":return"sha512"}},w2=(e,t)=>xt({try:()=>Uint8Array.from(Ld.createHash(P2(e)).update(t).digest()),catch:(r)=>Zr({module:"Crypto",method:"digest",_tag:"Unknown",description:"Could not compute digest",cause:r})}),T2,wT;var TT=E(()=>{PT();ae();Eo();In();T2=kT({randomBytes:Ld.randomBytes,digest:w2}),wT=ms(Og,T2)});var vT;var CT=E(()=>{TT();vT=wT});import*as QT from"crypto";import*as X from"fs";import*as _T from"os";import*as La from"path";var Ie=(e)=>(t)=>wo({module:"FileSystem",method:e,description:t.message??String(t)}),Q2,_2,$2,A2,R2,I2,F2,U2,gg=(e)=>{let t=Le(X.mkdtemp,be("FileSystem",e),Ie(e));return(r)=>Ee(()=>{let n=r?.prefix??"",o=typeof r?.directory==="string"?La.join(r.directory,"."):_T.tmpdir();return t(n?La.join(o,n):o+"/")})},D2,xg=(e)=>{let t=Le(X.rm,be("FileSystem",e),Ie(e));return(r,n)=>t(r,{recursive:n?.recursive??!1,force:n?.force??!1})},M2,N2,Z2=(e)=>{let t=Le(X.open,be("FileSystem",e),Ie(e)),r=Le(X.close,be("FileSystem",e),Ie(e));return(n,o)=>Ho(ln(t(n,o?.flag??"r",o?.mode),(s)=>Rn(r(s))),K((s)=>W2(s,o?.flag?.startsWith("a")??!1)))},q2,W2,$T=(e)=>{let t=gg(e);return z(function*(r){let n=yield*t(r),o=QT.randomBytes(6).toString("hex"),s=La.join(n,r?.suffix?`${o}${r.suffix}`:o);return yield*RT(s,new Uint8Array(0)),s})},L2,z2,X2=(e,t)=>pi({try:()=>X.promises.readdir(e,t),catch:(r)=>be("FileSystem","readDirectory")(r,[e])}),j2=(e)=>dr((t,r)=>{try{X.readFile(e,{signal:r},(n,o)=>{if(n)t(N(be("FileSystem","readFile")(n,[e])));else t(T(o))})}catch(n){t(N(Ie("readFile")(n)))}}),V2,B2,G2,AT=(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:wn(e.mtime),atime:wn(e.atime),birthtime:wn(e.birthtime),dev:e.dev,rdev:wn(e.rdev),ino:wn(e.ino),mode:e.mode,nlink:wn(e.nlink),uid:wn(e.uid),gid:wn(e.gid),size:Qo(e.size),blksize:e.blksize!==void 0?ee(Qo(e.blksize)):L(),blocks:wn(e.blocks)}),yg,Y2,H2,J2,K2=(e,t)=>ZP((r)=>ln(ne(()=>{let n=X.watch(e,{recursive:t?.recursive??!1},(o,s)=>{if(!s)return;switch(o){case"rename":{Ss(Ik(yg(s),{onSuccess:(i)=>yl(r,{_tag:"Create",path:s}),onFailure:(i)=>yl(r,{_tag:"Remove",path:s})}));return}case"change":{Sl(r,{_tag:"Update",path:s});return}}});return n.on("error",(o)=>{bl(r,uk(Zr({module:"FileSystem",_tag:"Unknown",method:"watch",pathOrDescriptor:e,cause:o})))}),n.on("close",()=>{vo(r)}),n}),(n)=>ne(()=>n.close()))),eU=(e,t,r)=>yg(t).pipe(K((n)=>e.pipe(JS((o)=>o.register(t,n,r)),bt(()=>K2(t,r)))),Es),RT=(e,t,r)=>dr((n,o)=>{try{X.writeFile(e,t,{signal:o,flag:r?.flag,mode:r?.mode},(s)=>{if(s)n(N(be("FileSystem","writeFile")(s,[e])));else n(ue)})}catch(s){n(N(Ie("writeFile")(s)))}}),tU,IT;var FT=E(()=>{tr();ae();ae();TO();oe();Eo();ze();In();kl();Fa();dg();Q2=(()=>{let e=Le(X.access,be("FileSystem","access"),Ie("access"));return(t,r)=>{let n=X.constants.F_OK;if(r?.readable)n|=X.constants.R_OK;if(r?.writable)n|=X.constants.W_OK;return e(t,n)}})(),_2=(()=>{let e=Le(X.cp,be("FileSystem","copy"),Ie("copy"));return(t,r,n)=>e(t,r,{force:n?.overwrite??!1,preserveTimestamps:n?.preserveTimestamps??!1,recursive:!0})})(),$2=(()=>{let e=Le(X.copyFile,be("FileSystem","copyFile"),Ie("copyFile"));return(t,r)=>e(t,r)})(),A2=(()=>{let e=Le(X.chmod,be("FileSystem","chmod"),Ie("chmod"));return(t,r)=>e(t,r)})(),R2=(()=>{let e=Le(X.chown,be("FileSystem","chown"),Ie("chown"));return(t,r,n)=>e(t,r,n)})(),I2=(()=>{let e=Le(X.glob,be("FileSystem","glob"),Ie("glob"));return(t,r)=>e(t,{cwd:r?.root,exclude:r?.exclude})})(),F2=(()=>{let e=Le(X.link,be("FileSystem","link"),Ie("link"));return(t,r)=>e(t,r)})(),U2=(()=>{let e=Le(X.mkdir,be("FileSystem","makeDirectory"),Ie("makeDirectory"));return(t,r)=>e(t,{recursive:r?.recursive??!1,mode:r?.mode})})(),D2=gg("makeTempDirectory"),M2=xg("remove"),N2=(()=>{let e=gg("makeTempDirectoryScoped"),t=xg("makeTempDirectoryScoped");return(r)=>ln(e(r),(n)=>Rn(t(n,{recursive:!0})))})(),q2=Z2("open"),W2=(()=>{let e=(u)=>Le(X.read,be("FileSystem",u),Ie(u)),t=e("read"),r=e("readAlloc"),n=Le(X.fstat,be("FileSystem","stat"),Ie("stat")),o=Le(X.ftruncate,be("FileSystem","truncate"),Ie("truncate")),s=Le(X.fsync,be("FileSystem","sync"),Ie("sync")),i=(u)=>Le(X.write,be("FileSystem",u),Ie(u)),a=i("write"),c=i("writeAll");class l{[ud];fd;append;position=BigInt(0);constructor(u,f){this[ud]=ud,this.fd=u,this.append=f}get stat(){return K(n(this.fd),AT)}get sync(){return s(this.fd)}seek(u,f){let d=Qo(u);return ne(()=>{if(f==="start")this.position=d;else if(f==="current")this.position=this.position+d;return Qo(this.position)})}read(u){return Ee(()=>{let f=this.position;return K(t(this.fd,{buffer:u,position:f}),(d)=>{let h=Qo(d);return this.position=f+h,h})})}readAlloc(u){let f=Number(u);return Ee(()=>{let d=Buffer.allocUnsafeSlow(f),h=this.position;return K(r(this.fd,{buffer:d,position:h}),(m)=>{if(m===0)return L();if(this.position=h+BigInt(m),m===f)return ee(d);let b=Buffer.allocUnsafeSlow(m);return d.copy(b,0,0,m),ee(b)})})}truncate(u){return K(o(this.fd,u?Number(u):void 0),()=>{if(!this.append){let f=BigInt(u??0);if(this.position>f)this.position=f}})}write(u){return Ee(()=>{let f=this.position;return K(a(this.fd,u,void 0,void 0,this.append?void 0:Number(f)),(d)=>{let h=Qo(d);if(!this.append)this.position=f+h;return h})})}writeAllChunk(u){return Ee(()=>{let f=this.position;return H(c(this.fd,u,void 0,void 0,this.append?void 0:Number(f)),(d)=>{if(d===0)return N(Zr({module:"FileSystem",method:"writeAll",_tag:"WriteZero",pathOrDescriptor:this.fd,description:"write returned 0 bytes written"}));if(!this.append)this.position=f+BigInt(d);return d<u.length?this.writeAllChunk(u.subarray(d)):ue})})}writeAll(u){return this.writeAllChunk(u)}}return(u,f)=>new l(u,f)})(),L2=$T("makeTempFile"),z2=(()=>{let e=$T("makeTempFileScoped"),t=xg("makeTempFileScoped");return(r)=>ln(e(r),(n)=>Rn(t(La.dirname(n),{recursive:!0})))})(),V2=(()=>{let e=Le(X.readlink,be("FileSystem","readLink"),Ie("readLink"));return(t)=>e(t)})(),B2=(()=>{let e=Le(X.realpath,be("FileSystem","realPath"),Ie("realPath"));return(t)=>e(t)})(),G2=(()=>{let e=Le(X.rename,be("FileSystem","rename"),Ie("rename"));return(t,r)=>e(t,r)})(),yg=(()=>{let e=Le(X.stat,be("FileSystem","stat"),Ie("stat"));return(t)=>K(e(t),AT)})(),Y2=(()=>{let e=Le(X.symlink,be("FileSystem","symlink"),Ie("symlink"));return(t,r)=>e(t,r)})(),H2=(()=>{let e=Le(X.truncate,be("FileSystem","truncate"),Ie("truncate"));return(t,r)=>e(t,r!==void 0?Number(r):void 0)})(),J2=(()=>{let e=Le(X.utimes,be("FileSystem","utime"),Ie("utime"));return(t,r,n)=>e(t,r,n)})(),tU=K(rO(wO),(e)=>BP({access:Q2,chmod:A2,chown:R2,copy:_2,copyFile:$2,glob:I2,link:F2,makeDirectory:U2,makeTempDirectory:D2,makeTempDirectoryScoped:N2,makeTempFile:L2,makeTempFileScoped:z2,open:q2,readDirectory:X2,readFile:j2,readLink:V2,realPath:B2,remove:M2,rename:G2,stat:yg,symlink:Y2,truncate:H2,utimes:J2,watch(t,r){return eU(e,t,r)},writeFile:RT})),IT=ba(Ql)(tU)});var UT;var DT=E(()=>{FT();UT=IT});import*as Jl from"path";import*as zd from"url";var Sg=(e)=>({fromFileUrl:(t)=>xt({try:()=>zd.fileURLToPath(t,{windows:e}),catch:(r)=>new Po({module:"Path",method:"fromFileUrl",cause:r})}),toFileUrl:(t)=>xt({try:()=>zd.pathToFileURL(t,{windows:e}),catch:(r)=>new Po({module:"Path",method:"toFileUrl",cause:r})})}),oU,sU,MT;var NT=E(()=>{ae();Eo();CO();In();oU=ms(xi)({[_o]:_o,...Jl.posix,...Sg(!1)}),sU=ms(xi)({[_o]:_o,...Jl.win32,...Sg(!0)}),MT=ms(xi)({[_o]:_o,...Jl,...Sg(void 0)})});var ZT;var qT=E(()=>{NT();ZT=MT});var Eg="~effect/Stdio",Xd,WT=(e)=>({[Eg]:Eg,stdinIsTerminal:T(!1),stdoutIsTerminal:T(!1),...e});var bg=E(()=>{lt();ae();Xd=rt(Eg)});var zT;var XT=E(()=>{ae();Eo();In();bg();pg();hg();zT=ms(Xd,WT({args:ne(()=>process.argv.slice(2)),stdinIsTerminal:ne(()=>process.stdin.isTTY===!0),stdoutIsTerminal:ne(()=>process.stdout.isTTY===!0),stdout:(e)=>qa({evaluate:()=>process.stdout,onError:(t)=>Zr({module:"Stdio",method:"stdout",_tag:"Unknown",cause:t}),endOnDone:e?.endOnDone??!1}),stderr:(e)=>qa({evaluate:()=>process.stderr,onError:(t)=>Zr({module:"Stdio",method:"stderr",_tag:"Unknown",cause:t}),endOnDone:e?.endOnDone??!1}),stdin:Wa({evaluate:()=>process.stdin,onError:(e)=>Zr({module:"Stdio",method:"stdin",_tag:"Unknown",cause:e}),closeOnDone:!1})}))});var jT;var VT=E(()=>{XT();jT=zT});function Vd(e){let t=tv(Yd,Ei(e.ast));return(r,n)=>t(r,n?.disableChecks?n?.parseOptions?{...n.parseOptions,disableChecks:!0}:{disableChecks:!0}:n?.parseOptions)}function Bd(e){let t=Vd(e);return(r,n)=>{let o=xl(t(r,n));if(kr(o))return ee(o.value);return Da(o.cause,"Option adapter can only return none for schema issues"),L()}}function GT(e){let t=Vd(e);return(r,n)=>{let o=xl(t(r,n));if(kr(o))return o.value;let s=Da(o.cause,"Constructor adapter can only throw schema issues");throw Error("Schema validation failed",{cause:s})}}function YT(e){return HT(e.ast)}function HT(e){let t=kg(ev(Ei(e)));return(r)=>{let n=t(r,Td);if(kr(n))return!0;return Da(n.cause,"Type guard adapter can only return false for schema issues"),!1}}function Gd(e,t){let r=ev(e.ast);return t===void 0?r:(n,o)=>r(n,jd(t,o))}function JT(e,t){return fU(Gd(e,t))}function KT(e,t){return dU(Gd(e,t))}function ev(e){return tv(rv,e)}function tv(e,t){let r;return(n,o)=>{let s=(r??=e(t))(n,o??Td);if(s===kt)return T(n);if(!qe(s))return Tr(s,BT);return s[Y]===fe?BT(fe):s}}function kg(e){return(t,r)=>xl(e(t,r))}function fU(e){let t=kg(e);return(r,n)=>{let o=t(r,n);if(kr(o))return ee(o.value);return Da(o.cause,"Option adapter can only return none for schema issues"),L()}}function dU(e){let t=kg(e);return(r,n)=>{let o=t(r,n);if(kr(o))return gt(o.value);return ut(Da(o.cause,"Result adapter can only return schema issues"))}}function nv(e){return e.context?.constructorDefault?pU(e):Yd(e)}function ov(e,t,r,n){let o;if(qe(e)&&e._tag==="Success"){let s=md(e===kt?t:e[Y]);o=r._tag==="Transformation"?r.decode.run(s,n):r.decode(dn(s),n)}else if(r._tag==="Transformation")o=Tr(e,(s)=>r.decode.run(md(s),n));else o=r.decode(Qa(e,md),n);return qe(o)&&o._tag==="Success"?$O(o[Y]):Tr(o,$O)}function hU(e,t){let r;return(n,o)=>{if(n===fe)return $o;if(e.isConstructed(n))return kt;let s=(r??=t(e.link.to))(n,o);return ov(s,n,e.link.transformation,o)}}function Pg(e,t,r,n){let o=r?Bw(e):void 0,s=o?hU(o,t):e.getParser(t,r),i=e.checks,a=n?e.encoding?[...e.encoding,n]:[n]:e.encoding,c=e.encodingChecks,l=(i?i[i.length-1].annotations:e.annotations)?.parseOptions;if(!a&&!i&&!c){if(!l)return s;return(d,h)=>s(d,jd(h,l))}let u,f=(d,h)=>{let m=s(d,h);if(c&&!h.disableChecks)if(qe(m)){if(m._tag==="Success"){let b=m===kt?d:m[Y];if(d!==fe&&b!==fe){let x=Ts(c,d,void 0,e,h);if(x)m=N(new Nt(e,x,d,h))}}}else m=H(m,(b)=>{if(d!==fe&&b!==fe){let x=Ts(c,d,void 0,e,h);if(x)return N(new Nt(e,x,d,h))}return T(b)});if(i&&!h.disableChecks)if(qe(m)){if(m._tag==="Success"){let b=m===kt?d:m[Y];if(b===fe)return m;let x=Ts(i,b,void 0,e,h);if(x)m=N(new Nt(e,x,b,h))}}else m=H(m,(b)=>{if(b!==fe){let x=Ts(i,b,void 0,e,h);if(x)return N(new Nt(e,x,b,h))}return T(b)});return m};if(!a)return l?(d,h)=>f(d,jd(h,l)):f;return(d,h)=>{if(l)h=jd(h,l);let m=u??=a.map((O)=>t(O.to)),b=d,x=m[m.length-1](d,h);for(let O=a.length-1;O>=0;O--)if(x=ov(x,b,a[O].transformation,h),O!==0){let S=m[O-1];if(x._tag==="Success")b=x[Y],x=S(b,h);else x=Tr(x,(y)=>{let g=S(y,h);return g===kt?dn(y):g})}if(x._tag==="Success"){let O=x[Y],S=f(O,h);return S===kt?x:S}return x=wr(x,(O)=>Pa(()=>ai(O,(S)=>new UO(e,S,d,h)))),Tr(x,(O)=>{let S=f(O,h);return S===kt?dn(O):S})}}var jd=(e,t)=>t?{...e,...t}:e,BT=(e)=>{if(e===fe)return N(new rr);return T(e)},rv,Yd,pU;var wg=E(()=>{tr();ae();Mr();oe();Dt();MO();Od();ze();Oo();Md();yi();rv=so((e)=>Pg(e,rv)),Yd=so((e)=>Pg(e,Yd,nv)),pU=so((e)=>Pg(e,Yd,nv,e.context?.constructorDefault))});function Tg(e,t){function r(){}let n=Object.defineProperties(Object.setPrototypeOf(r,mU),Object.getOwnPropertyDescriptors({...t}));return n.ast=e,n.rebuild=(o)=>Tg(o,t),n.makeEffect=Vd(n),n.make=GT(n),n.makeOption=Bd(n),n}var Hd="~effect/Schema/Schema",mU;var iv=E(()=>{It();Md();wg();mU={[Hd]:Hd,pipe(){return pe(this,arguments)},annotate(e){return this.rebuild(Yl(this.ast,e))},annotateKey(e){return this.rebuild(Ud(this.ast,e))},check(...e){return this.rebuild(Pi(this.ast,e))}}});var Kl=(e)=>e;var av=()=>{};var Ti,cv=(e)=>{if(Ti.has(e))return Ti.get(e);else throw Error("Unable to get redacted value"+(e.label?` with label: "${e.label}"`:""))};var lv=E(()=>{Ti=new WeakMap});var uv="~effect/data/Redacted",yU=(e)=>G(e,uv),fv=(e,t)=>{let r=Object.create(SU);if(t?.label)r.label=t.label;return Ti.set(r,e),r},SU,dv;var vg=E(()=>{co();En();ct();lv();ye();SU={[uv]:{_A:(e)=>e},label:void 0,...Jt,toJSON(){return this.toString()},toString(){return`<redacted${Jo(this.label)?":"+this.label:""}>`},[Je](){return Oe(Ti.get(this))},[Ke](e){return yU(e)&&at(Ti.get(this),Ti.get(e))}},dv=cv});function EU(){return(e,t,r)=>Xe(new ki(e.map(eg),(n)=>t(n.map((o)=>Xe(o))),r))}function bU(e,t){return EU()([],()=>(r,n,o)=>e(r)?T(r):N(new qr(n,r,o)),t)}function ru(e,t){let r=Gd(e,t);return(n,o)=>kU(r(n,o))}function kU(e){if(qe(e))return wU(e);return wr(e,(t)=>Pa(()=>ai(t,(r)=>new tu(r))))}function wU(e){return kr(e)?e:ps(ai(e.cause,(t)=>new tu(t)))}function gv(e,t){let r=KT(e,t);return(n,o)=>Xh(r(n,o),(s)=>new tu(s))}function vU(e){return G(e,eu)&&e[eu]===eu}function Lr(e){let t=Xe(new Un(e),{literal:e,transform(r){return t.pipe(nu(Lr(r),{decode:yt(()=>r),encode:yt(()=>e)}))}});return t}function $g(e,t){return Xe(e,{fields:t,mapFields(r,n){let o=r(this.fields);return $g(Qd(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function ot(e){return $g(Qd(e,void 0),e)}function Sv(e,t){return Xe(Lw(e.ast,t.ast),{key:e,value:t})}function Ev(e,t){return Xe(e,{elements:t,mapElements(r,n){let o=r(this.elements);return Ev(tg(o,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function QU(e){return Ev(tg(e),e)}function bv(e,t){return Xe(e,{members:t,mapMembers(r,n){let o=r(this.members);return bv(_d(o,this.ast.mode,n?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function hn(e,t){return bv(_d(e,t?.mode??"anyOf",void 0),e)}function Xa(e){let t=e.map(Lr);return Xe(_d(t,"anyOf",void 0),{literals:e,members:t,mapMembers(r){return hn(r(this.members))},pick(r){return Xa(r)},transform(r){return hn(t.map((n,o)=>n.transform(r[o])))}})}function nu(e,t){return(r)=>Xe(Ww(r.ast,e.ast,t?qO(t):Ed()),{from:r,to:e})}function $U(e){return(t)=>Xe(qw(t.ast,e),{schema:t})}function za(e){return Lr(e).pipe($U(T(e)))}function AU(e,t){return ot({_tag:za(e),...t})}function ja(e,t){return bU((r)=>r instanceof e,t)}function Va(){return(e,t)=>new vt(e.ast,qO(t))}function RU(e,t){let{source:r,flags:n}=e,o=n===""?`new RegExp(${he(r)})`:`new RegExp(${he(r)}, ${he(n)})`;return ng(e,{toCode:()=>({runtime:`Schema.isPattern(${o})`}),...t})}function IU(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return RU(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}function FU(e){let t=tf(e.order),r=e.formatter??he;return(n,o)=>Kd((s)=>t(s,n),{expected:`a value greater than ${r(n)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:n,exclusiveMinimum:!0}}},...e.annotate?.(n),...o})}function UU(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${he(e)}`);return e}function MU(e){return Kd((t)=>globalThis.Number.isSafeInteger(t),{expected:"an integer",representation:{id:"effect/schema/isInt",payload:null},toJsonSchema:()=>({type:"integer"}),toCode:()=>({runtime:"Schema.isInt()"}),arbitrary:{constraint:{integer:!0}},...e})}function Rg(e,t){return e=Math.max(0,Math.floor(e)),Kd((r)=>r.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:"effect/schema/isMinLength",payload:{minLength:e}},toJsonSchema:({type:r})=>r==="array"?{minItems:e}:{minLength:e},toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[_l]:!0,arbitrary:{constraint:{minLength:e}},...t})}function NU(e){return Rg(1,e)}function kv(e,t){return e=Math.max(0,Math.floor(e)),Kd((r)=>r.length<=e,{expected:`a value with a length of at most ${e}`,representation:{id:"effect/schema/isMaxLength",payload:{maxLength:e}},toJsonSchema:({type:r})=>r==="array"?{maxItems:e}:{maxLength:e},toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[_l]:!0,arbitrary:{constraint:{maxLength:e}},...t})}function wv(e){let t=ZU(e),r=mv[t];if(r!==void 0)return r;let n=oD.pipe(nu(Jd,uw(qU(t))));return mv[t]=n,n}function Tv(e,t,r,n,o){let s=BU(r,t,n),i=vv(t),a=class extends e{constructor(...[c,l]){let f=l?.["~payload"],d=f?.token===Cg?f.value:r.make(c??{},l);super(d,{...l,disableChecks:!0,"~payload":{token:Cg,value:d}})}static[eu]=eu;get[i](){return i}static[jU]=!0;static identifier=t;static fields=r.fields;static get ast(){return s(this).ast}static pipe(){return pe(this,arguments)}static rebuild(c){return s(this).rebuild(c)}static make(c,l){return new this(c,l)}static makeOption(c,l){return Bd(s(this))(c??{},l)}static makeEffect(c,l){return s(this).makeEffect(c??{},l)}static annotate(c){return this.rebuild(Yl(this.ast,c))}static annotateKey(c){return this.rebuild(Ud(this.ast,c))}static check(...c){return this.rebuild(Pi(this.ast,c))}static extend(c){return(l,u)=>{let f=Ig(l)?l:ot(l),d={...r.fields,...f.fields},h=Qd(d,r.ast.checks,{identifier:c});return Tv(this,c,$g(Pi(h,f.ast.checks),d),u,o)}}static mapFields(c,l){return r.mapFields(c,l)}};if(o!==void 0)Object.assign(a.prototype,o(t));return a}function VU(e){return new St(yt((t)=>new e(t,{"~payload":{token:Cg,value:t}})),bs())}function vv(e){return`~effect/Schema/Class/${e}`}function BU(e,t,r){let n;return(o)=>{if(n!==void 0)return n;let s=vv(t),i=(l)=>l instanceof o||G(l,s),a=VU(o),c=Xe(new ki([e.ast],()=>(l,u,f)=>i(l)?T(l):N(new qr(u,l,f)),{identifier:t,[dd]:([l])=>({isConstructed:i,link:new vt(l,a)}),toCodec:([l])=>new vt(l.ast,a),toArbitrary:([l])=>()=>({arbitrary:l.arbitrary.map((u)=>new o(u)),terminal:l.terminal?.map((u)=>new o(u))}),toFormatter:([l])=>(u)=>`${o.identifier}(${l(u)})`,[fd]:jl(e.ast),...r}));return n=nu(c,a)(e)}}function Ig(e){return vU(e)}function GU(e){return e.constructorDefault===void 0?e:new Ao(e.isOptional,e.isMutable,void 0,e.annotations)}function YU(e){if(e.propertySignatures.some((t)=>typeof t.name!=="string"))throw new globalThis.Error("Objects property names must be strings",{cause:e})}function HU(e){return(t)=>{let r=new Map;for(let s=0;s<t.length;s++)r.set(ws(t[s]),s);let n=[...t].sort((s,i)=>{s=ws(s),i=ws(i);let a=e(s),c=e(i);if(a!==c)return a-c;return r.get(s)-r.get(i)});if(!n.some((s,i)=>s!==t[i]))return t;return n}}function Ug(e){return Xe(Cv(e.ast),{schema:e})}function KU(e,t,r){switch(e._tag){case"Declaration":{let n=e.typeParameters.map((l)=>Xe(t(ws(l)))),o=e.annotations?.toCodecStringTree;if(io(o)){let l=o(n);if(l===void 0)return e;return Tt(e,[Id(l,t)])}let s=e.annotations?.toCodecJson,i=io(s)?s(n):void 0,a=i===void 0?e.annotations?.toCodec:void 0,c=i??(io(a)?a(n):void 0);return c===void 0?r(e):Tt(e,[Id(c,t)])}case"Null":return Tt(e,[eD]);case"Boolean":return Tt(e,[tD]);case"Unknown":case"ObjectKeyword":return Tt(e,[ag]);case"Enum":case"Number":case"Literal":case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return YU(e),e.recur(t,ig);case"Union":{let n=JU(e.types);if(n!==e.types)return new Dn(n,e.mode,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t);return e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}var eu,hv="~effect/SchemaError/SchemaError",tu,Qg,PU,Ov,TU,Xe,xv,te,Jd,CU,V,yv,_g,Ae,_U,Kd,ou,DU,Ag,Pv,ZU=(e)=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),qU=(e)=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},mv,V6,WU,LU,zU,B6,G6,XU,Y6,jU,Cg,Fg=(e)=>(t,r)=>{let n=Ig(t)?t:ot(t);return Tv(qc,e,n,r,(s)=>({name:s}))},Nn=(e)=>(t,r,n)=>{let o=Ig(r)?r.mapFields((s)=>({_tag:za(t),...s}),{unsafePreserveChecks:!0}):AU(t,r);return Fg(e??t)(o,n)},JU,eD,tD,rD,nD=(e)=>e.transformation===rD,Cv,oD;var Ba=E(()=>{tr();ma();ae();Jh();Mr();on();ct();Dt();hd();iv();nm();Mh();It();ye();Oo();Md();Sd();yi();wg();kd();av();eu=Hd;tu=class tu extends Fr("SchemaError"){[hv]=hv;constructor(e){let t=gf();Oa(0);try{super({issue:e})}finally{Oa(t)}}get message(){return rw(this.issue)}toString(){return`SchemaError(${this.message})`}};Qg=YT;PU=ru;Ov=JT;TU=gv,Xe=Tg;xv=Kl((e)=>Xe(Dd(e.ast),{schema:e})),te=Kl((e)=>{let t=_U(e);return Xe(Zw(e.ast),{schema:t})});Jd=Xe(zl),CU=Xe(YO),V=Xe(Xl),yv=Xe(HO),_g=Xe(Cw);Ae=Kl((e)=>Xe(new Bl(!1,[],[e.ast]),{value:e}));_U=Kl((e)=>hn([e,CU]));Kd=Ad;ou=Xe(rg);DU=FU({order:ef,annotate:(e)=>({representation:{id:"effect/schema/isGreaterThan",payload:{exclusiveMinimum:UU(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${he(e)})`})})});Ag=yv.check(MU());Pv=V.check(NU()),mv=[];V6=ja(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>Va()(ot({source:V,flags:V}),ql({decode:(e,t)=>xt({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new rr({expected:"valid RegExp source and flags"},e,t)}),encode:(e)=>T({source:e.source,flags:e.flags})})),toArbitrary:()=>(e)=>e.tuple(e.constantFrom(".",".*","\\d+","\\w+","[a-z]+","[A-Z]+","[0-9]+","^[a-zA-Z0-9]+$","^\\d{4}-\\d{2}-\\d{2}$"),e.uniqueArray(e.constantFrom("g","i","m","s","u","y"),{minLength:0,maxLength:6}).map((t)=>t.join(""))).map(([t,r])=>new globalThis.RegExp(t,r)),toEquivalence:()=>(e,t)=>e.source===t.source&&e.flags===t.flags}),WU=V.annotate({expected:"a string that will be decoded as a URL"}),LU=ja(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>Va()(WU,fw),toArbitrary:()=>(e)=>e.webUrl().map((t)=>new globalThis.URL(t)),toEquivalence:()=>(e,t)=>e.toString()===t.toString()}),zU=ja(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>Va()(ot({data:V.check(IU()),type:V,name:V,lastModified:Ag}),ql({decode:(e,t)=>nf(hf(e.data),{onFailure:()=>N(new rr({expected:"a valid Base64 string"},e.data,t)),onSuccess:(r)=>{let n=new globalThis.Uint8Array(r);return T(new globalThis.File([n],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>pi({try:async()=>{let r=new globalThis.Uint8Array(await e.arrayBuffer());return{data:pf(r),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new rr({expected:"a readable File"},e,t)})}))}),B6=ja(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>Va()(Ae(QU([V,hn([ot({_tag:za("String"),value:V}),ot({_tag:za("File"),value:zU})])])),ql({decode:(e)=>{let t=new globalThis.FormData;for(let[r,n]of e)t.append(r,n.value);return T(t)},encode:(e)=>T(globalThis.Array.from(e.entries()).map(([t,r])=>{if(typeof r==="string")return[t,{_tag:"String",value:r}];else return[t,{_tag:"File",value:r}]}))}))}),G6=ja(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>Va()(V.annotate({expected:"a query string that will be decoded as URLSearchParams"}),Wl({decode:(e)=>new globalThis.URLSearchParams(e),encode:(e)=>e.toString()}))}),XU=V.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),Y6=ja(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>Va()(XU,dw),toArbitrary:()=>(e)=>e.uint8Array()}),jU=globalThis.Symbol.for("immer-draftable"),Cg={};JU=HU((e)=>{switch(e._tag){case"Null":case"Boolean":case"Number":case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});eD=new vt(new Un("null"),new St(yt(()=>null),yt(()=>"null"))),tD=new vt(new Dn([new Un("true"),new Un("false")],"anyOf"),new St(yt((e)=>e==="true"),Nl())),rD=new St(yt((e)=>typeof e==="string"?[e]:e),bs()),Cv=Fd((e)=>{let t=KU(e,Cv,(r)=>{throw new globalThis.Error("Missing structural codec for StringTree",{cause:r})});if(t!==e&&e.context!==void 0)return Nw(t,GU(e.context));return t},{stopAt:nD}),oD=Xe(Yl(Yw,{toCode:()=>({runtime:"Schema.Json",Type:"Schema.Json"})}))});var Qv="~effect/platform/Terminal",Dg="effect/platform/Terminal/QuitError",su,_v=(e)=>G(e,Dg),mn,$v=(e)=>mn.of({...e,[Qv]:Qv});var ep=E(()=>{lt();ye();Ba();su=class su extends Fg("QuitError")({_tag:za("QuitError")}){[Dg]=Dg};mn=rt("effect/platform/Terminal")});import*as tp from"readline";function Iv(e){return e.key.ctrl&&(e.key.name==="c"||e.key.name==="d")}var Av,Rv;var Fv=E(()=>{ae();Eo();ze();In();ye();kl();MP();ep();Av=z(function*(e=Iv){let t=process.stdin,r=process.stdout,n=yield*Ra(),o=t.readableEnded,s=!1,i=()=>{if(o=!0,!s)vo(n)};t.once("end",i),yield*nO(()=>ne(()=>t.off("end",i)));let a=yield*DP({acquire:ln(ne(()=>{let h=tp.createInterface({input:t,escapeCodeTimeout:50}),m=(x)=>Sl(n,x),b=()=>{s=!1,vo(n)};if(s=!0,tp.emitKeypressEvents(t,h),h.on("line",m),h.once("close",b),t.isTTY)t.setRawMode(!0);return{rl:h,onClose:b,onLine:m}}),({rl:h,onClose:m,onLine:b})=>ne(()=>{if(s=!1,h.off("line",b),h.off("close",m),t.isTTY)t.setRawMode(!1);if(h.close(),o)vo(n)})),idleTimeToLive:"10 millis"}),c=ne(()=>r.columns??0),l=ne(()=>r.rows??0),u=We(function*(){let h=yield*Ra(),m=(O,S)=>{let y={input:ua(O),key:{name:S.name??"",ctrl:!!S.ctrl,meta:!!S.meta,shift:!!S.shift}};if(Sl(h,y),e(y))vo(h)},b=setInterval(()=>{},2147483647),x=()=>{clearInterval(b),vo(h)};if(yield*nO(()=>ne(()=>{clearInterval(b),t.off("keypress",m),t.off("end",x)})),t.on("keypress",m),o)x();else yield*bO(a),t.once("end",x);return h}),f=Ee(()=>iP(n).pipe(H(er({onNone:()=>mi(an(bO(a),Co(n))),onSome:T})),cn(()=>new su({}))));return $v({columns:c,rows:l,readInput:u,readLine:f,display:(h)=>Hf(dr((m)=>{r.write(h,(b)=>yS(b)?m(ue):m(N(wo({module:"Terminal",method:"display",description:"Failed to write prompt to stdout",cause:b}))))}))})}),Rv=ba(mn,Av(Iv))});var Uv;var Dv=E(()=>{Fv();Uv=Rv});var aD;var Nv=E(()=>{Eo();mT();CT();DT();qT();VT();Dv();aD=dT.pipe(bk(Zf(UT,vT,ZT,jT,Uv)))});var Ng=E(()=>{Wk();Nv()});var Zn=E(()=>{tr();ma();ae();Mr();ze();Oo();Ba()});var vi="__tripwire_dynamic_shell_value__",Zg=(e)=>({start:e.pos,end:e.end}),cD=(e)=>{let t=e.lastIndexOf("/");return t===-1?e:e.slice(t+1)},qg=()=>({aliases:new Map,backgroundPidAvailable:!1,bindings:new Map,functions:new Map,temps:new Map}),Pt=(e)=>({aliases:new Map(e.aliases),backgroundPidAvailable:e.backgroundPidAvailable,bindings:new Map(e.bindings),functions:new Map(e.functions),temps:new Map(e.temps)}),Wg=(e)=>e.type==="SingleQuoted"||e.type==="DoubleQuoted"||e.type==="AnsiCQuoted"||e.type==="LocaleString",qv=(e)=>e.every((t)=>{switch(t.type){case"Literal":case"SingleQuoted":case"AnsiCQuoted":return!0;case"DoubleQuoted":case"LocaleString":return qv(t.parts);case"SimpleExpansion":case"ParameterExpansion":case"CommandExpansion":case"ArithmeticExpansion":case"ProcessSubstitution":case"ExtendedGlob":case"BraceExpansion":return!1;default:return!1}}),Ro=(e)=>qv(e.parts??[]),Wv=(e)=>{if(e===void 0||(e.errors?.length??0)>0||e.commands.length!==1)return null;let[t]=e.commands;if(t===void 0||t.background===!0||t.redirects.length>0)return null;let{command:r}=t;if(r.type!=="Command"||r.name===void 0||!Ro(r.name))return null;if(r.prefix.length>0||r.suffix.some((n)=>!Ro(n)))return null;return{command:r,head:cD(r.name.value),args:r.suffix.map((n)=>n.value)}},Lv=(e)=>{let t=e.parts??[];if(t.length!==1)return;let[r]=t;if(r?.type==="CommandExpansion")return r.script;if(r?.type!=="DoubleQuoted"||r.parts.length!==1)return;let[n]=r.parts;return n?.type==="CommandExpansion"?n.script:void 0},zv=(e,t)=>e.command.name?.value.includes("/")===!1&&(t.aliases.has(e.head)||t.functions.has(e.head)),Lg=(e,t)=>{let r=Wv(Lv(e));if(r===null||zv(r,t))return null;if(r.head==="cat"&&r.args.length===0&&r.command.redirects.length===1){let[n]=r.command.redirects;if(n?.operator!=="<<"&&n?.operator!=="<<-")return null;if(n.heredocQuoted===!0||n.body===void 0||Ro(n.body))return(n.content??"").replace(/\n+$/u,"");return null}if(r.head==="printf"&&r.args.length===2){let[n,o]=r.args;if(n==="%s"||n===String.raw`%s\n`)return o??""}return null},Zv=(e)=>["/tmp","/private/tmp","/var/tmp","/private/var/tmp","/var/folders","/private/var/folders"].some((t)=>e===t||e.startsWith(`${t}/`)),lD=(e)=>{let t=!1,r=null,n=[];for(let o=0;o<e.length;o+=1){let s=e[o];if(s==="-t")t=!0,o+=1;else if(s==="-p"||s==="--tmpdir")r=e[o+1]??"",o+=1;else if(s?.startsWith("--tmpdir=")===!0)r=s.slice(9);else if(s!==void 0&&!s.startsWith("-"))n.push(s)}return{explicitDirectory:r,positionals:n,systemTempTemplate:t}},Xv=(e,t)=>{let r=Wv(Lv(e));if(r?.head!=="mktemp"||zv(r,t)||["TMPDIR","TMP","TEMP"].some((a)=>t.bindings.has(a)||t.temps.has(a))||!r.args.some((a)=>a==="-d"||a==="--directory"||/^-[^-]*d/u.test(a)))return!1;let{explicitDirectory:n,positionals:o,systemTempTemplate:s}=lD(r.args);if(n!==null&&!Zv(n))return!1;if(o.length===0||s||n!==null)return!0;let[i]=o;return o.length===1&&i!==void 0&&Zv(i)},jv=(e)=>{if(e.type==="SimpleExpansion")return/^\$(?<name>[A-Za-z_][A-Za-z0-9_]*|[0-9]+|!)$/u.exec(e.text)?.groups?.name??null;if(e.type==="ParameterExpansion"&&e.indirect!==!0&&e.length!==!0&&e.operator===void 0&&e.index===void 0&&e.slice===void 0&&e.replace===void 0&&/^(?:[A-Za-z_][A-Za-z0-9_]*|[0-9]+|!)$/u.test(e.parameter))return e.parameter;return null},Vv=(e)=>{let t=[],r=(i,a)=>{for(let c of i)switch(c.type){case"Literal":case"SingleQuoted":case"AnsiCQuoted":{t.push({kind:"literal",value:c.value});break}case"DoubleQuoted":case"LocaleString":{if(!r(c.parts,!0))return!1;break}case"SimpleExpansion":case"ParameterExpansion":{let l=jv(c);if(l===null)return!1;t.push({kind:"variable",quoted:a,variable:l});break}case"ArithmeticExpansion":case"BraceExpansion":case"CommandExpansion":case"ExtendedGlob":case"ProcessSubstitution":return!1;default:return!1}return!0};if(!r(e.parts??[],!1))return null;let n=t.filter((i)=>i.kind==="variable");if(n.length!==1)return null;let[o]=n;if(o===void 0)return null;let s=t.indexOf(o);return{prefix:t.slice(0,s).map((i)=>i.kind==="literal"?i.value:"").join(""),quoted:o.quoted,suffix:t.slice(s+1).map((i)=>i.kind==="literal"?i.value:"").join(""),variable:o.variable}},uD=(e)=>{let t=e.parts??[];if(t.length!==1||t[0]?.type!=="DoubleQuoted")return null;let r=t[0].parts;if(r.length<1||r.length>2)return null;let[n]=r,o=n===void 0?null:jv(n);if(o===null)return null;let[,s]=r;if(s!==void 0&&s.type!=="Literal")return null;return{variable:o,suffix:s?.value??""}},Bv=(e,t)=>{let r=uD(e);if(r===null||!t.temps.has(r.variable))return null;let{suffix:n,variable:o}=r;if(n!==""&&!n.startsWith("/")||n.split("/").includes("..")||n.includes("\x00"))return null;return{source:e.text,value:`/private/tmp/tripwire-provenance/${o}${n}`,kind:"trusted-temp-path",range:Zg(e),quoted:!0,variable:o}},zg=(e,t)=>{let r=Vv(e);if(r===null)return null;let{prefix:n,quoted:o,suffix:s,variable:i}=r,a=t.bindings.get(i);if(a===void 0||a.kind==="dynamic"||a.kind==="trusted-temp-path"||a.kind==="background-pid"&&(n!==""||s!=="")||s.split("/").includes("..")||n.split("/").includes(".."))return null;let c=`${n}${a.value}${s}`;if(!o&&(/\s/u.test(c)||c.includes("*")||c.includes("?")||c.includes("[")))return null;return{...a,source:e.text,value:c,range:Zg(e),quoted:o,variable:i}},Xg=(e,t)=>{let r=Vv(e);if(!t.backgroundPidAvailable||r?.variable!=="!"||r.prefix!==""||r.suffix!=="")return null;return{source:e.text,value:"__tripwire_background_pid__",kind:"background-pid",range:Zg(e),quoted:r.quoted,variable:"!"}};var Ga=()=>{};function Gv(e){return e>=48&&e<=55}function fD(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function dD(e,t){try{return String.fromCodePoint(e)}catch{return t}}function jg(e,t,r){let n=t,o="";while(n<r&&e.charCodeAt(n)!==39){if(e.charCodeAt(n)!==92||n+1>=r){let c=n;while(n<r){let l=e.charCodeAt(n);if(l===39||l===92&&n+1<r)break;n++}o+=e.slice(c,n);continue}let i=n++,a=e[n++];switch(a){case"a":o+="\x07";break;case"b":o+="\b";break;case"e":case"E":o+="\x1B";break;case"f":o+="\f";break;case"n":o+=`
|
|
37
34
|
`;break;case"r":o+="\r";break;case"t":o+="\t";break;case"v":o+="\v";break;case"\\":o+="\\";break;case"'":o+="'";break;case'"':o+='"';break;case"?":o+="?";break;case`
|
|
38
|
-
`:break;case"c":{let c=r<n?e.charCodeAt(r):39;if(c===39){o+=e.slice(i,r);break}if(r++,c===92){let u=r<n&&e.charCodeAt(r)===92;if(u)r++;if(o+="\x1C",!u&&r<n)o+=e[r],r++;break}o+=String.fromCharCode(c===63?127:c&31);break}case"x":case"u":case"U":{let c=r,u=a==="x"?2:a==="u"?4:8;while(r<n&&r-c<u&&Ite(e.charCodeAt(r)))r++;if(r===c){o+=`\\${a}`;break}let l=e.slice(i,r);o+=Ate(Number.parseInt(e.slice(c,r),16),l);break}default:{let c=a.charCodeAt(0);if(!oH(c)){o+=`\\${a}`;break}while(r<n&&r-i-1<3&&oH(e.charCodeAt(r)))r++;o+=String.fromCharCode(Number.parseInt(e.slice(i+1,r),8)&255);break}}}let s=r<n;if(s)r++;return{value:o,end:r,closed:s}}var Yo=9,Ct=10,bo=32,Ar=33,tt=34,hn=35,$e=36,Yc=37,Tr=38,xt=39,be=40,Qt=41,Is=42,On=43,nf=44,gn=45,Xc=47,_r=48,Or=57,rf=58,of=59,dt=60,nt=61,$t=62,Xo=63,eu=64,Ra=65,Fa=90,Vn=91,ke=92,As=93,sf=94,Ma=95,qe=96,Oi=97,Pi=122,Ut=123,wo=124,lr=125,sH=126;function Tte(e){switch(e){case",":return 1;case"=":case"+=":case"-=":case"*=":case"/=":case"%=":case"<<=":case">>=":case"&=":case"|=":case"^=":return 2;case"||":return 4;case"&&":return 5;case"|":return 6;case"^":return 7;case"&":return 8;case"==":case"!=":return 9;case"<":case"<=":case">":case">=":return 10;case"<<":case">>":return 11;case"+":case"-":return 12;case"*":case"/":case"%":return 13;case"**":return 14;default:return-1}}function _te(e){switch(e){case"=":case"+=":case"-=":case"*=":case"/=":case"%=":case"<<=":case">>=":case"&=":case"|=":case"^=":case"**":return!0;default:return!1}}function af(e,t=0,n){let r=0,o=e.length,s=n?.commandExpansions.length??0,i=n?.embeddedWords.length??0;function a(w,k,g=!1){let x={type:"ArithmeticWord",pos:w+t,end:k+t,value:e.slice(w,k),parts:void 0};if(g)n?.embeddedWords.push(x);return x}function c(){while(r<o){let w=e.charCodeAt(r);if(w===bo||w===Yo||w===Ct)r++;else break}}function u(){if(r>=o)return null;let w=e.charCodeAt(r),k=r+1<o?e.charCodeAt(r+1):0,g=r+2<o?e.charCodeAt(r+2):0;switch(w){case nf:return r++,",";case nt:if(k===nt)return r+=2,"==";return r++,"=";case Ar:if(k===nt)return r+=2,"!=";return null;case dt:if(k===dt){if(g===nt)return r+=3,"<<=";return r+=2,"<<"}if(k===nt)return r+=2,"<=";return r++,"<";case $t:if(k===$t){if(g===nt)return r+=3,">>=";return r+=2,">>"}if(k===nt)return r+=2,">=";return r++,">";case On:if(k===nt)return r+=2,"+=";if(k===On)return null;return r++,"+";case gn:if(k===nt)return r+=2,"-=";if(k===gn)return null;return r++,"-";case Is:if(k===Is)return r+=2,"**";if(k===nt)return r+=2,"*=";return r++,"*";case Xc:if(k===nt)return r+=2,"/=";return r++,"/";case Yc:if(k===nt)return r+=2,"%=";return r++,"%";case wo:if(k===wo)return r+=2,"||";if(k===nt)return r+=2,"|=";return r++,"|";case Tr:if(k===Tr)return r+=2,"&&";if(k===nt)return r+=2,"&=";return r++,"&";case sf:if(k===nt)return r+=2,"^=";return r++,"^";case Xo:return r++,"?";default:return null}}function l(w){let k=f();while(!0){if(c(),r>=o)break;let g=r,x=u();if(!x)break;if(x==="?"){if(3<w){r=g;break}let _=l(1);if(c(),r<o&&e.charCodeAt(r)===rf)r++;let M=l(3);k={type:"ArithmeticTernary",pos:k.pos,end:M.end,test:k,consequent:_,alternate:M};continue}let S=Tte(x);if(S<w){r=g;break}let C=_te(x)?S:S+1,I=l(C);k={type:"ArithmeticBinary",pos:k.pos,end:I.end,operator:x,left:k,right:I}}return k}function f(){if(c(),r>=o)return a(r,r);let w=r,k=e.charCodeAt(r),g=r+1<o?e.charCodeAt(r+1):0;if(k===On&&g===On){r+=2;let x=f();return{type:"ArithmeticUnary",pos:w+t,end:x.end,operator:"++",operand:x,prefix:!0}}if(k===gn&&g===gn){r+=2;let x=f();return{type:"ArithmeticUnary",pos:w+t,end:x.end,operator:"--",operand:x,prefix:!0}}if(k===Ar){r++;let x=f();return{type:"ArithmeticUnary",pos:w+t,end:x.end,operator:"!",operand:x,prefix:!0}}if(k===sH){r++;let x=f();return{type:"ArithmeticUnary",pos:w+t,end:x.end,operator:"~",operand:x,prefix:!0}}if(k===On&&g!==On&&g!==nt){r++;let x=f();return{type:"ArithmeticUnary",pos:w+t,end:x.end,operator:"+",operand:x,prefix:!0}}if(k===gn&&g!==gn&&g!==nt){r++;let x=f();return{type:"ArithmeticUnary",pos:w+t,end:x.end,operator:"-",operand:x,prefix:!0}}return d()}function d(){let w=m();if(c(),r+1<o){let k=e.charCodeAt(r),g=e.charCodeAt(r+1);if(k===On&&g===On)return r+=2,{type:"ArithmeticUnary",pos:w.pos,end:r+t,operator:"++",operand:w,prefix:!1};if(k===gn&&g===gn)return r+=2,{type:"ArithmeticUnary",pos:w.pos,end:r+t,operator:"--",operand:w,prefix:!1}}return w}function m(){if(c(),r>=o)return a(r,r);let w=e.charCodeAt(r);if(w===be){let C=r;r++;let I=l(0);if(c(),r<o&&e.charCodeAt(r)===Qt)r++;return{type:"ArithmeticGroup",pos:C+t,end:r+t,expression:I}}if(w===$e){let C=r,I=n?.commandExpansions.length??0,_=n?.embeddedWords.length??0,M=y(),U=n?.findArithmeticWordEnd?.(C+t,t+o)??r+t;if(U>r+t){if(n)n.commandExpansions.length=I,n.embeddedWords.length=_;return r=U-t,a(C,r,!0)}return M}if(w===96||w===34||w===39){let C=r;return r=(n?.findArithmeticWordEnd?.(C+t,t+o)??C+t+1)-t,a(C,r,!0)}let k=r,g=n?.embeddedWords.length??0,x=b(),S=n?.findArithmeticWordEnd?.(k+t,t+o)??r+t;if(S>r+t){if(n)n.embeddedWords.length=g;return r=S-t,a(k,r,!0)}return x}function y(){let w=r;if(r++,r>=o)return a(w,r);let k=e.charCodeAt(r);if(k===be)if(r+1<o&&e.charCodeAt(r+1)===be){let g=n?.findArithmeticExpansionEnd(w+t,t+o)??-1;if(g!==-1)r=g-t;else{r+=2;let x=1;while(r<o&&x>0)if(e.charCodeAt(r)===be&&e.charCodeAt(r+1)===be)x++,r+=2;else if(e.charCodeAt(r)===Qt&&e.charCodeAt(r+1)===Qt)x--,r+=2;else r++}}else{r++;let g=n?.findClosingParenthesis(r+t,t+o)??-1;if(g!==-1)r=g-t+1;else{let I=1;while(r<o&&I>0){let _=e.charCodeAt(r++);if(_===be)I++;else if(_===Qt)I--}}let x=e.slice(w,r),S=x.slice(2,-1),C={type:"ArithmeticCommandExpansion",pos:w+t,end:r+t,text:x,inner:S,script:void 0};return n?.commandExpansions.push(C),C}else if(k===Ut){let g=n?.findClosingBrace(r+t+1,t+o)??-1;if(g!==-1)r=g-t+1;else{r++;let x=1;while(r<o&&x>0){let S=e.charCodeAt(r++);if(S===Ut)x++;else if(S===lr)x--}}}else while(r<o){let g=e.charCodeAt(r);if(g>=Oi&&g<=Pi||g>=Ra&&g<=Fa||g>=_r&&g<=Or||g===Ma)r++;else break}return a(w,r,k===be||k===Ut)}function b(){let w=r;while(r<o){let k=e.charCodeAt(r);if(k>=_r&&k<=Or||k>=Ra&&k<=Fa||k>=Oi&&k<=Pi||k===Ma||k===35)r++;else break}if(r>w&&r<o&&e.charCodeAt(r)===Vn){let k=n?.findClosingBracket?.(r+t+1,t+o)??-1;if(k!==-1)r=k-t+1;else{r++;let g=1;while(r<o&&g>0){let x=e.charCodeAt(r);if(x===Vn)g++;else if(x===As)g--;r++}}return a(w,r,!0)}if(r===w)return r++,a(w,r);return a(w,r)}if(c(),r>=o)return null;let E=l(0);if(c(),r<o&&n)return n.commandExpansions.length=s,n.embeddedWords.length=i,a(0,o,!0);return E}var MI=()=>{};function Ote(e){let t="";for(let n of e)t+=n.type==="Literal"?n.value:n.text;return t}function Pte(e){let t=e.indexOf("\\");if(t===-1)return e;let n="",r=0;for(let o=t;o<e.length;o++){if(e.charCodeAt(o)!==92)continue;if(n+=e.slice(r,o),o++,o>=e.length){n+="\\",r=o;break}if(e.charCodeAt(o)!==10)n+=e[o];r=o+1}return n+e.slice(r)}class tn{static _resolveWord;static _resolveHeredocBody;text;pos;end;#t;#e;#n;#o;#i=null;constructor(e,t,n,r,o,s=0){this.text=e,this.pos=t,this.end=n,this.#t=r,this.#e=o??tn._resolveWord,this.#n=s,this.#o=r!==void 0?null:void 0}get value(){if(this.#i===null){let e=this.parts;if(!e)this.#i=Pte(this.text);else{let t="";for(let n of e)switch(n.type){case"Literal":case"SingleQuoted":case"AnsiCQuoted":t+=n.value;break;case"DoubleQuoted":case"LocaleString":t+=Ote(n.parts);break;default:t+=n.text;break}this.#i=t}}return this.#i}get parts(){if(this.#o===null)this.#o=this.#e(this.#t??"",this,this.#n)??void 0;return this.#o}set parts(e){this.#o=e??void 0}sourceText(){return this.#t?.slice(this.pos,this.end)}toJSON(){return{text:this.text,pos:this.pos,end:this.end,parts:this.parts,value:this.value}}}class ky{token=h.EOF;_value="";_owner;pos=0;end=0;fileDescriptor=void 0;variableName=void 0;content=void 0;targetPos=0;targetEnd=0;assignmentOperatorPos=-1;raw=!1;keywordEligible=!1;constructor(e=null){this._owner=e}get value(){return this._value??(this._value=this._owner===null?"":this._owner._tokenValue(this.pos,this.end,this.raw))}set value(e){this._value=e}reset(){this.token=h.EOF,this._value="",this.pos=0,this.end=0,this.fileDescriptor=void 0,this.variableName=void 0,this.content=void 0,this.targetPos=0,this.targetEnd=0,this.assignmentOperatorPos=-1,this.raw=!1,this.keywordEligible=!1}copyFrom(e){this.token=e.token,this._value=e._value,this.pos=e.pos,this.end=e.end,this.fileDescriptor=e.fileDescriptor,this.variableName=e.variableName,this.content=e.content,this.targetPos=e.targetPos,this.targetEnd=e.targetEnd,this.assignmentOperatorPos=e.assignmentOperatorPos,this.raw=e.raw,this.keywordEligible=e.keywordEligible}}function iH(e,t,n){if(t===n)return!0;let r=e.charCodeAt(t-1);return r<128&&(Qe[r]&1)!==0}function Da(e,t,n){for(let r=t;r<n;r++){let o=e.charCodeAt(r);if(o===ke||o===xt||o===tt||o===$e||o===qe||(o===dt||o===$t)&&r+1<n&&e.charCodeAt(r+1)===be)return!0}return!1}function aH(e,t){let n=0;for(let r=0;r<e.length;r++){let o=e.charCodeAt(r);if(o===ke){r++;continue}if(o===Ut){n++;continue}if(o===lr){if(n>0)n--;continue}if(o===xt){r++;while(r<e.length&&e.charCodeAt(r)!==xt)r++;continue}if(o===tt){r++;while(r<e.length&&e.charCodeAt(r)!==tt){if(e.charCodeAt(r)===ke)r++;r++}continue}if(o===t&&n===0)return r}return-1}function cH(e){let t=e.type;return t==="Literal"||t==="SimpleExpansion"||t==="ParameterExpansion"||t==="CommandExpansion"||t==="ArithmeticExpansion"}function Mte(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<_r||n>Or)return!1}return e.length>0}function Dte(e,t,n){for(let r=t;r<n;r++){let o=e.charCodeAt(r);if(o<_r||o>Or)return!1}return n>t}function dH(e){return e<Co}function pH(e){return-e-2}function pm(e,t,n,r){let o=r;for(let s=t;s<n&&o>=0;s++){let i=e.charCodeAt(s);if(o>=ko){if(i===Vn)o++;else if(i===As&&--o===ko)o=lH}else if(o===wy)o=i<128&&Na[i]&1?uH:Co;else if(o===uH){if(i<128&&Na[i]&2)continue;if(i===Vn)o=ko+1;else if(i===On)o=fH;else o=i===nt?-s-2:Co}else if(o===lH)if(i===On)o=fH;else o=i===nt?-s-2:Co;else o=i===nt?-s-2:Co}return o}function Tt(e,t,n,r=0,o=0){e.token=t,e._value=n,e.pos=r,e.end=o,e.fileDescriptor=void 0,e.variableName=void 0,e.content=void 0,e.assignmentOperatorPos=-1,e.raw=!1,e.keywordEligible=!1}function mm(e,t,n,r,o){e.token=t,e._value=null,e.pos=n,e.end=r,e.fileDescriptor=void 0,e.variableName=void 0,e.content=void 0,e.assignmentOperatorPos=-1,e.raw=o,e.keywordEligible=!1}function $te(e,t,n){switch(e.charCodeAt(t)){case Ar:return n===1?h.Bang:void 0;case Ut:return n===1?h.LBrace:void 0;case lr:return n===1?h.RBrace:void 0;case 105:{if(n!==2)return;let r=e.charCodeAt(t+1);return r===102?h.If:r===110?h.In:void 0}case 102:if(n===2)return e.charCodeAt(t+1)===105?h.Fi:void 0;if(n===3)return e.startsWith("for",t)?h.For:void 0;if(n===8)return e.startsWith("function",t)?h.Function:void 0;return;case 116:return n===4&&e.startsWith("then",t)?h.Then:void 0;case 101:if(n!==4)return;if(e.startsWith("else",t))return h.Else;if(e.startsWith("elif",t))return h.Elif;if(e.startsWith("esac",t))return h.Esac;return;case 100:if(n===2)return e.charCodeAt(t+1)===111?h.Do:void 0;if(n===4)return e.startsWith("done",t)?h.Done:void 0;return;case 99:if(n===4)return e.startsWith("case",t)?h.Case:void 0;if(n===6)return e.startsWith("coproc",t)?h.Coproc:void 0;return;case 119:return n===5&&e.startsWith("while",t)?h.While:void 0;case 117:return n===5&&e.startsWith("until",t)?h.Until:void 0;case 115:return n===6&&e.startsWith("select",t)?h.Select:void 0;default:return}}function Ute(e,t,n){let r=t+1<n?e.charCodeAt(t+1):0;if(r<=bo||r===lr)return-1;let o=1,s=!1,i=t+1;while(i<n&&o>0){let a=e.charCodeAt(i);if(a===Ut)o++;else if(a===lr){if(--o===0)break}else if(a<=bo||a===of||a===wo||a===Tr)return-1;else if(o===1&&(a===44||a===46&&i+1<n&&e.charCodeAt(i+1)===46))s=!0;if(a===ke)i++;i++}if(o===0&&s)return i+1;return-1}class es{src;srcEnd;pos;current;nextState;hasPeek;pendingHereDocs;collectedExpansions;_errors=null;_buildParts=!1;_buildValue=!1;_nestingDepth=0;constructor(e,t=0,n=e.length){if(this.src=e,this.srcEnd=n,this.pos=t,this.current=new ky(this),this.nextState=new ky(this),this.hasPeek=!1,this.pendingHereDocs=null,this.collectedExpansions=null,t===0&&e.charCodeAt(0)===hn&&e.charCodeAt(1)===Ar){let r=e.indexOf(`
|
|
39
|
-
`);this.pos=r===-1?this.srcEnd:r+1}}getSource(){return this.src}get errors(){return this._errors??(this._errors=[])}getCollectedExpansions(){return this.collectedExpansions??Nte}collect(e){(this.collectedExpansions??=[]).push([e,this._nestingDepth])}getPos(){return this.pos}_tokenValue(e,t,n){return n?this.src.slice(e,t):this.wordValueOf(e,t)}wordValueOf(e,t){let n=this.pos,r=this.srcEnd,o=this._buildValue,s=this._unbalanced,i=this._errors===null?0:this._errors.length;this.pos=e,this.srcEnd=t,this._buildValue=!0,this.readWordText();let a=this._wordText;if(this.pos=n,this.srcEnd=r,this._buildValue=o,this._unbalanced=s,this._errors!==null)this._errors.length=i;return a}findClosingBracket(e,t=this.srcEnd){return this.findClosingShellDelimiter(e,t,As)}findClosingArithmeticBracket(e,t=this.srcEnd){return this.findClosingShellDelimiter(e,t,As,!1,!1)}findClosingBrace(e,t=this.srcEnd){return this.findClosingShellDelimiter(e,t,lr)}findClosingParenthesis(e,t=this.srcEnd){let n=this.pos,r=this.srcEnd,o=this._unbalanced;this.pos=e,this.srcEnd=Math.min(t,this.srcEnd),this.extractBalanced();let s=this._unbalanced?-1:this.pos-1;return this.pos=n,this.srcEnd=r,this._unbalanced=o,s}findArithmeticExpansionEnd(e,t=this.srcEnd){let n=new es(this.src,e,t);return n.pos=e+1,n.scanArithmeticBody(),n.pos}findArithmeticWordEnd(e,t=this.srcEnd){let n=new es(this.src,e,t);return n.pos=e,n.scanArithmeticWordEnd()}scanArithmeticWordEnd(){while(this.pos<this.srcEnd){let e=this.src.charCodeAt(this.pos);if(e===$e){this.readDollar();continue}if(e===qe){this.readBacktickExpansion();continue}if(e===xt){this.pos++,this.skipSQ();continue}if(e===tt){this.pos++,this.skipDQ();continue}if(e===ke){this.pos+=2;continue}if(e===Vn){let t=this.findClosingBracket(this.pos+1);if(t!==-1){this.pos=t+1;continue}}if((e===dt||e===$t)&&this.src.charCodeAt(this.pos+1)===be){this.pos+=2,this.extractBalanced();continue}if(e<128&&mH[e])break;this.pos++}return this.pos}findClosingShellDelimiter(e,t,n,r=!1,o=!0){let s=this.pos,i=this.srcEnd,a=this._unbalanced;this.srcEnd=Math.min(t,this.srcEnd);let c=[n],u=e;while(u<this.srcEnd){let l=this.src.charCodeAt(u);if(l===ke){u+=2;continue}if(l===hn&&r&&iH(this.src,u,e)){while(u<this.srcEnd&&this.src.charCodeAt(u)!==Ct)u++;continue}if(l===xt){this.pos=u+1,this.skipSQ(),u=this.pos;continue}if(l===tt){this.pos=u+1,this.skipDQ(),u=this.pos;continue}if(l===qe){u++;while(u<this.srcEnd&&this.src.charCodeAt(u)!==qe){if(this.src.charCodeAt(u)===ke)u++;u++}if(u<this.srcEnd)u++;continue}if(l===$e&&u+1<this.srcEnd&&this.src.charCodeAt(u+1)===be||(l===dt||l===$t)&&u+1<this.srcEnd&&this.src.charCodeAt(u+1)===be){this.pos=u+2,this.extractBalanced(),u=this.pos;continue}let f=c[c.length-1];if(l===$e&&u+1<this.srcEnd){let d=this.src.charCodeAt(u+1);if(d===$e){u+=2;continue}if(d===Ut&&o){c.push(lr),u+=2;continue}}if(f===As&&l===Vn)c.push(As);else if(f===Qt&&l===be)c.push(Qt);else if(l===f){if(c.pop(),c.length===0)return this.pos=s,this.srcEnd=i,this._unbalanced=a,u}u++}return this.pos=s,this.srcEnd=i,this._unbalanced=a,-1}skipSubshellBody(){return this.extractBalanced(),this._unbalanced?-1:this.pos}skipCompoundBody(e){let t=[{close:e,phase:e===h.Esac?"case-pattern":"commands"}],n=!0;for(;;){let r=this.next(n?T.CommandStart:T.Normal),o=r.token;if(o===h.EOF)return-1;let s=t.length-1,i=t[s];if(i.phase==="function-name"){if(o===h.Newline)continue;i.phase="function-body",n=!0;continue}else if(i.phase==="function-body"){if(o===h.Newline)continue;if(i.phase="commands",n=!0,o===h.LParen&&this.peek(T.Normal).token===h.RParen){this.next(T.Normal),i.phase="function-body";continue}}else if(i.phase==="coproc-command"){if(o===h.Newline)continue;if(o===h.Word){i.phase="coproc-body",n=!0;continue}i.phase="commands",n=!0}else if(i.phase==="coproc-body"){if(o===h.Newline)continue;if(i.phase=o===h.Word&&r.keywordEligible&&r.value==="time"?"time-command":"commands",n=!0,i.phase==="time-command")continue}else if(i.phase==="time-command"){if(o===h.Word&&r.keywordEligible&&r.value==="-p"){i.phase="time-command-after-p";continue}if(o===h.Word&&r.keywordEligible&&r.value==="--"){i.phase="commands";continue}i.phase="commands",n=!0}else if(i.phase==="time-command-after-p"){if(o===h.Word&&r.keywordEligible&&r.value==="--"){i.phase="commands";continue}i.phase="commands",n=!0}else if(i.phase==="for-header"){if(o===h.ArithCmd||o===h.Semi||o===h.Newline){n=!0;continue}if(o===h.Do||o===h.LBrace){i.close=o===h.Do?h.Done:h.RBrace,i.phase="commands",n=!0;continue}}else if(i.phase==="case-word"){if(o===h.Newline)continue;i.phase="case-in",n=!1;continue}else if(i.phase==="case-in"){if(o===h.Newline){n=!0;continue}i.phase="case-pattern",n=!0;continue}else if(i.phase==="case-pattern"){if(o===h.Esac&&n){if(t.pop(),t.length===0)return r.end;n=!1;continue}if(o===h.RParen)i.phase="commands",n=!0;else n=o===h.Newline;continue}if(o===i.close){if(t.pop(),t.length===0)return r.end;n=!1;continue}if(n)switch(o){case h.LParen:t.push({close:h.RParen,phase:"commands"});break;case h.LBrace:t.push({close:h.RBrace,phase:"commands"});break;case h.If:t.push({close:h.Fi,phase:"commands"});break;case h.For:t.push({close:h.Done,phase:"for-header"});break;case h.While:case h.Until:case h.Select:t.push({close:h.Done,phase:"commands"});break;case h.Case:t.push({close:h.Esac,phase:"case-word"});break;case h.DblLBracket:if(!this.skipTestCommandBody())return-1;n=!1;continue;case h.Assignment:case h.Redirect:case h.Bang:case h.Then:case h.Else:case h.Elif:case h.Do:case h.In:break;case h.Semi:case h.Newline:case h.Pipe:case h.And:case h.Or:case h.Amp:case h.DoubleSemi:case h.SemiAmp:case h.DoubleSemiAmp:break;case h.Function:i.phase="function-name";break;case h.Coproc:i.phase="coproc-command";break;default:if(o===h.Word&&r.keywordEligible&&r.value==="time")i.phase="time-command",n=!0;else n=!1;continue}switch(o){case h.Semi:case h.Newline:case h.Pipe:case h.And:case h.Or:case h.Amp:n=!0;break;case h.DoubleSemi:case h.SemiAmp:case h.DoubleSemiAmp:if(i.close===h.Esac)i.phase="case-pattern";n=!0;break;case h.RParen:n=!0;break}}}skipTestGroup(){let e=1;for(;;){let t=this.next(T.TestMode);if(t.token===h.EOF)return-1;if(t.token===h.DblRBracket)return this.unshift(t),-1;if(t.token===h.LParen)e++;else if(t.token===h.RParen&&--e===0)return t.end}}skipTestCommandBody(){for(;;){let e=this.next(T.TestMode).token;if(e===h.DblRBracket)return!0;if(e===h.EOF)return!1}}buildWordParts(e){this._buildParts=!0,this.pos=e;let t=this.src.charCodeAt(e);if((t===60||t===62)&&e+1<this.srcEnd&&this.src.charCodeAt(e+1)===40){this.pos=e+2;let n=this.extractBalanced();if(this._unbalanced)this.errors.push({message:"unterminated process substitution",pos:e});let o={type:"ProcessSubstitution",text:this.src.slice(e,this.pos),operator:t===60?"<":">",script:void 0,inner:n??void 0,innerStart:e+2};if(this.collect(o),this.pos<this.srcEnd)if(this.readWordText(),this._wordParts)this._wordParts.unshift(o);else this._wordParts=[o];else this._wordParts=[o]}else this.readWordText();return this._wordParts}buildEmbeddedWordParts(e){return this._buildParts=!0,this.pos=e,this.readInnerWordText(),this._wordParts}buildHereDocParts(e,t){this._buildParts=!0;let n=this.src,r=[],o="",s=e,i=e,a=()=>{if(o)r.push({type:"Literal",value:o,text:n.slice(s,i)}),o=""};while(i<t){let c=n.charCodeAt(i);if(c===92){if(i+1<t){let u=n.charCodeAt(i+1);if(u===36||u===96||u===92){o+=String.fromCharCode(u),i+=2;continue}}o+="\\",i++;continue}if(c===36){if(a(),s=i,this.pos=i,this.readDollar(),this._resultPart)r.push(this._resultPart),s=this.pos;else o+=n.slice(i,this.pos);i=this.pos;continue}if(c===96){if(a(),s=i,this.pos=i,this.readBacktickExpansion(),this._resultPart)r.push(this._resultPart),s=this.pos;else o+=n.slice(i,this.pos);i=this.pos;continue}o+=n[i],i++}return a(),r.length>1||r.length===1&&r[0].type!=="Literal"?r:null}registerHereDocTarget(e){if(this.pendingHereDocs===null)return;for(let t of this.pendingHereDocs)if(!t.target){t.target=e;return}}readTestRegexWord(){this.hasPeek=!1,this.skipSpacesAndTabs();let e=this.src,t=this.srcEnd,n=this.pos,r=0;while(this.pos<t){let o=e.charCodeAt(this.pos);if(o===be){r++,this.pos++;continue}if(o===ke){this.pos+=this.pos+1<t?2:1;continue}if(o===xt){let s=this.pos++,i=s>n&&e.charCodeAt(s-1)===$e;while(this.pos<t&&e.charCodeAt(this.pos)!==xt){if(i&&e.charCodeAt(this.pos)===ke&&this.pos+1<t)this.pos++;this.pos++}if(this.pos<t)this.pos++;else this.errors.push({message:i?"unterminated ANSI-C quote":"unterminated single quote",pos:s});continue}if(o===tt){this.pos++,this.readDoubleQuoted();continue}if(o===qe){this.readBacktickExpansion();continue}if(r>0){if(o===Qt)r--;this.pos++;continue}if(o===$e){this.readDollar();continue}if((o===dt||o===$t)&&this.pos+1<t&&e.charCodeAt(this.pos+1)===be){let s=this.pos;if(this.pos+=2,this.extractBalanced(),this._unbalanced)this.errors.push({message:"unterminated process substitution",pos:s});continue}if(o<128&&Qe[o]&1&&o!==wo)break;this.pos++}return Tt(this.current,h.Word,e.slice(n,this.pos),n,this.pos),this.current}readCStyleForExprs(){this.hasPeek=!1;let e=this.src,t=this.srcEnd;while(this.pos<t&&(e.charCodeAt(this.pos)===bo||e.charCodeAt(this.pos)===Yo))this.pos++;if(this.pos<t&&e.charCodeAt(this.pos)===be)this.pos++;let n=[this.pos,0,0],r=["","","",0,0,0],o=0,s=1,i=this.pos;while(this.pos<t&&s>0){let a=e.charCodeAt(this.pos);if(a===be)s++,this.pos++;else if(a===Qt){if(s--,s===0){let c=e.slice(i,this.pos);r[o]=c.trim(),r[3+o]=n[o]+c.length-c.trimStart().length,this.pos++;while(this.pos<t&&(e.charCodeAt(this.pos)===bo||e.charCodeAt(this.pos)===Yo))this.pos++;if(this.pos<t&&e.charCodeAt(this.pos)===Qt)this.pos++;break}this.pos++}else if(a===of&&s===1){let c=e.slice(i,this.pos);if(r[o]=c.trim(),r[3+o]=n[o]+c.length-c.trimStart().length,o<2)o++;this.pos++,i=this.pos,n[o]=i}else if(a===xt)this.pos++,this.skipSQ();else if(a===tt)this.pos++,this.skipDQ();else this.pos++}return r}peek(e=T.Normal){if(!this.hasPeek)this.readNext(this.nextState,e),this.hasPeek=!0;return this.nextState}peekFollow(e){if(!this.hasPeek){let t=e[this.current.token]?T.CommandStart:T.Normal;this.readNext(this.nextState,t),this.hasPeek=!0}return this.nextState}next(e=T.Normal){if(this.hasPeek){this.hasPeek=!1;let t=this.current;return this.current=this.nextState,this.nextState=t,this.current}return this.readNext(this.current,e),this.current}unshift(e){this.nextState.copyFrom(e),this.hasPeek=!0}readNext(e,t){let n=this.src,r=this.srcEnd,o=this.pos;while(o<r){let a=n.charCodeAt(o);if(a===bo||a===Yo){o++;continue}if(a===ke&&o+1<r&&n.charCodeAt(o+1)===Ct){o+=2;continue}if(a===Ct&&t===T.TestMode){o++;continue}break}if(this.pos=o,o>=r){this.consumePendingHereDocs(),Tt(e,h.EOF,"",o,o);return}let s=o,i=n.charCodeAt(o);if(i===hn){while(this.pos<r&&n.charCodeAt(this.pos)!==Ct)this.pos++;this.readNext(e,t);return}if(i===Ct){this.pos++,this.consumePendingHereDocs(),Tt(e,h.Newline,`
|
|
40
|
-
`,s,this.pos);return}if(t===T.TestMode&&(i===dt||i===$t)&&!(this.pos+1<this.srcEnd&&n.charCodeAt(this.pos+1)===be)){this.pos++,Tt(e,h.Word,i===dt?"<":">",s,this.pos),e.keywordEligible=!0;return}if(i<128&&Qe[i]&1&&this.tryReadOperator(e,i,t,s))return;this.readWord(e,t,s)}tryReadOperator(e,t,n,r){let o=this.src,s=this.pos,i=s+1<this.srcEnd?o.charCodeAt(s+1):0;switch(t){case of:if(i===of){if(s+2<this.srcEnd&&o.charCodeAt(s+2)===Tr)return this.pos+=3,Tt(e,h.DoubleSemiAmp,";;&",r,this.pos),!0;return this.pos+=2,Tt(e,h.DoubleSemi,";;",r,this.pos),!0}if(i===Tr)return this.pos+=2,Tt(e,h.SemiAmp,";&",r,this.pos),!0;return this.pos++,Tt(e,h.Semi,";",r,this.pos),!0;case wo:if(i===wo)return this.pos+=2,Tt(e,h.Or,"||",r,this.pos),!0;if(i===Tr)return this.pos+=2,Tt(e,h.Pipe,"|&",r,this.pos),!0;return this.pos++,Tt(e,h.Pipe,"|",r,this.pos),!0;case Tr:if(i===Tr)return this.pos+=2,Tt(e,h.And,"&&",r,this.pos),!0;if(i===$t){this.pos+=2;let a=this.pos<this.srcEnd&&o.charCodeAt(this.pos)===$t;if(a)this.pos++;this.skipSpacesAndTabs();let c=this.pos;if(this.pos<this.srcEnd&&o.charCodeAt(this.pos)!==Ct&&o.charCodeAt(this.pos)!==hn)this.readRedirectTargetText();return this.redirectToken(e,a?"&>>":"&>",r,c),!0}return this.pos++,Tt(e,h.Amp,"&",r,this.pos),!0;case be:if(n===T.CommandStart&&i===be){let a=this.errors.length;if(this.readArithmeticCommand(e,r),!this._notArithmetic)return!0;this.errors.length=a,this.pos=r}return this.pos++,Tt(e,h.LParen,"(",r,this.pos),!0;case Qt:return this.pos++,Tt(e,h.RParen,")",r,this.pos),!0;case dt:case $t:return this.readRedirection(e,r);default:return!1}}readRedirection(e,t){let n=this.src,r=n.charCodeAt(this.pos),o="";if(r===dt){this.pos++;let s=this.pos<this.srcEnd?n.charCodeAt(this.pos):0;if(s===dt){this.pos++;let i=this.pos<this.srcEnd?n.charCodeAt(this.pos):0;if(i===dt){this.pos++,this.skipSpacesAndTabs();let l=this.pos;if(this.pos<this.srcEnd&&n.charCodeAt(this.pos)!==Ct&&n.charCodeAt(this.pos)!==hn)this.readRedirectTargetText();return this.redirectToken(e,"<<<",t,l),!0}let a=i===gn;if(a)this.pos++;this.skipSpacesAndTabs();let c=this.pos;if(this.pos>=this.srcEnd||n.charCodeAt(this.pos)!==hn)this.readHereDocDelimiter();let u=this.pos>c;if(u)(this.pendingHereDocs??=[]).push({delimiter:this._hereDelim,strip:a,quoted:this._hereQuoted});return Tt(e,h.Redirect,a?"<<-":"<<",t,this.pos),e.content=u?this._hereDelim:void 0,e.targetPos=c,e.targetEnd=u?this.pos:c,!0}if(s===be)return this.readProcessSubstitution(e,"<",t),!0;if(s===$t)o="<>",this.pos++;else if(s===Tr)o="<&",this.pos++;else o="<"}else if(r===$t){this.pos++;let s=this.pos<this.srcEnd?n.charCodeAt(this.pos):0;if(s===be)return this.readProcessSubstitution(e,">",t),!0;if(s===$t)o=">>",this.pos++;else if(s===Tr)o=">&",this.pos++;else if(s===wo)o=">|",this.pos++;else o=">"}if(this.skipSpacesAndTabs(),this.pos<this.srcEnd){let s=n.charCodeAt(this.pos);if((s===dt||s===$t)&&this.pos+1<this.srcEnd&&n.charCodeAt(this.pos+1)===be){let a=this.pos;if(this.pos+=2,this.extractBalanced(),this._unbalanced)this.errors.push({message:"unterminated process substitution",pos:a});let c=n.slice(a,this.pos);return Tt(e,h.Redirect,o,t,this.pos),e.content=c,e.targetPos=a,e.targetEnd=this.pos,!0}let i=this.pos;if(s!==Ct&&s!==hn)this.readRedirectTargetText();return this.redirectToken(e,o,t,i),!0}return this.redirectToken(e,o,t,this.pos),!0}readRedirectTargetText(){let e=this._buildValue;this._buildValue=!0,this.readWordText(),this._buildValue=e}redirectToken(e,t,n,r){let o=this.pos>r&&(this._wordText.length>0||this._wordQuoted);Tt(e,h.Redirect,t,n,this.pos),e.content=o?this._wordText:void 0,e.targetPos=r,e.targetEnd=o?this.pos:r}readProcessSubstitution(e,t,n){if(this.pos++,this.extractBalanced(),this._unbalanced)this.errors.push({message:"unterminated process substitution",pos:n});let r=this.src.slice(n,this.pos);Tt(e,h.Word,r,n,this.pos)}readHereDocDelimiter(){let e=this.src,t=this.srcEnd,n=this._buildValue;this._buildValue=!0;let r="",o=!1;while(this.pos<t){let s=e.charCodeAt(this.pos);if(s===xt){o=!0,this.pos++;while(this.pos<t&&e.charCodeAt(this.pos)!==xt)r+=e[this.pos],this.pos++;if(this.pos<t)this.pos++}else if(s===tt){o=!0,this.pos++;while(this.pos<t&&e.charCodeAt(this.pos)!==tt){if(e.charCodeAt(this.pos)===ke&&this.pos+1<t){let i=e.charCodeAt(this.pos+1);if(i===Ct){this.pos+=2;continue}if(i===$e||i===qe||i===tt||i===ke)this.pos++}r+=e[this.pos],this.pos++}if(this.pos<t)this.pos++}else if(s===ke){if(this.pos+1<t&&e.charCodeAt(this.pos+1)===Ct){this.pos+=2;continue}if(o=!0,this.pos++,this.pos<t)r+=e[this.pos],this.pos++;else r+="\\"}else if(s===qe){let i=this.pos;this.pos++;while(this.pos<t&&e.charCodeAt(this.pos)!==qe){if(e.charCodeAt(this.pos)===ke)this.pos++;this.pos++}if(this.pos<t)this.pos++;r+=e.slice(i,this.pos)}else if(s===$e){let i=this.pos+1<t?e.charCodeAt(this.pos+1):0;if(i===xt||i===tt)o=!0;this.readDollar(),r+=this._resultText}else if(s<128&&Qe[s]&1)break;else r+=e[this.pos],this.pos++}this._buildValue=n,this._hereDelim=r,this._hereQuoted=o}consumePendingHereDocs(){let e=this.pendingHereDocs;if(e===null||e.length===0)return;for(let t of e){let n=this.pos,r=this.readHereDocBody(t.delimiter,t.strip);if(t.target){if(t.target.content=r,t.quoted)t.target.heredocQuoted=!0;else if(r){let o=this.parseHereDocBody(r,n);if(o)t.target.body=o}}}e.length=0}readHereDocBody(e,t){let n=this.pos,r=this.skipHereDocBody(e,t);return this.src.slice(n,r)}matchHereDocDelimiter(e,t,n,r){let o=this.src,s=t;for(let i=0;i<e.length;){if(r&&o.charCodeAt(s)===ke&&s+1<n&&o.charCodeAt(s+1)===Ct){s+=2;continue}if(s>=n||o.charCodeAt(s)!==e.charCodeAt(i))return-1;s++,i++}return s}logicalLineEnd(e,t,n){let r=this.src,o=e;while(o<t){let s=r.charCodeAt(o);if(s===Ct)return o;o+=n&&s===ke?2:1}return t}skipHereDocBody(e,t,n=!1,r=!1){let o=this.src,s=this.srcEnd,i=e.length;while(this.pos<s){let a=this.pos,c=o.indexOf(`
|
|
41
|
-
`,this.pos);if(c===-1||c>s)c=s;if(t)while(a<c&&o.charCodeAt(a)===Yo)a++;if(c-a===i&&o.startsWith(e,a)){let u=this.pos;return this.pos=c<s?c+1:c,u}if(n){let u=this.matchHereDocDelimiter(e,a,s,!r);if(u!==-1){let l=o.indexOf(")",u);if(l!==-1&&l<this.logicalLineEnd(a,s,!r)){let f=this.pos;return this.pos=u,f}}}this.pos=c<s?c+1:c}return this.pos}parseHereDocBody(e,t){let n=!1;for(let r=0;r<e.length;r++){let o=e.charCodeAt(r);if(o===qe){n=!0;break}if(o===$e){let s=r+1<e.length?e.charCodeAt(r+1):0;if(s===Ut||s===be||s===$e||s>=Oi&&s<=Pi||s>=Ra&&s<=Fa||s===Ma||s===Ar||s===hn||s===eu||s===Is||s===Xo||s===gn||s>=_r&&s<=Or){n=!0;break}}if(o===ke)r++}if(!n)return null;return new tn(e,t,t+e.length,this.src,tn._resolveHeredocBody,this._nestingDepth)}_wordText="";_wordRaw=!1;_wordQuoted=!1;_wordHasExpansions=!1;_wordKeywordEligible=!1;_wordIsAssignment;_wordAssignmentOperatorPos;_wordParts=null;_resultText="";_resultIsRaw=!0;_resultHasExpansion=!1;_resultPart;_unbalanced=!1;_notArithmetic=!1;_dqText="";_dqHasExpansions=!1;_dqParts=null;_dqEnd=0;_hereDelim="";_hereQuoted=!1;readWord(e,t,n=0){this.readWordText(),this.classifyWord(e,t,n)}classifyWord(e,t,n){let r=this.src,o=this._wordRaw,s=this._wordHasExpansions,i=this._wordQuoted,a=this._wordKeywordEligible,c=this._wordIsAssignment,u=this._wordAssignmentOperatorPos,l=this.pos,f=l-n,d=null;if(!o&&!s){let m=l<this.srcEnd?r.charCodeAt(l):0;if(!i&&f<=16||m===dt||m===$t)d=this.wordValueOf(n,l)}if(t===T.CommandStart&&a){if(o){if(f<=8){let m=$te(r,n,f);if(m!==void 0){mm(e,m,n,l,!0);return}}if(f===2&&r.charCodeAt(n)===Vn&&r.charCodeAt(n+1)===Vn){mm(e,h.DblLBracket,n,l,!0);return}}else if(d!==null&&d.length>0){let m=d.charCodeAt(0);if(m>=Oi&&m<=Pi&&d.length<=8||m===Ar||m===Ut||m===lr){let y=Rte.get(d);if(y!==void 0){Tt(e,y,d,n,l);return}}if(m===Vn&&d==="[["){Tt(e,h.DblLBracket,d,n,l);return}}}if(t===T.CommandStart||t===T.CommandPrefix){if(c===void 0){let m=-1,y=!1;for(let b=n+1;b<l;b++){let E=r.charCodeAt(b);if(E===nt){m=b;break}if(E===Vn)y=!0}if(m!==-1){let b=pm(r,n,l,wy);if(dH(b))u=pH(b)}else if(y&&l<this.srcEnd&&pm(r,n,l,wy)>=ko){this.pos=n,this.readWordText(!0),this.classifyWord(e,t,n);return}}if(u!==void 0){if(mm(e,h.Assignment,n,l,o),d!==null)e._value=d;e.assignmentOperatorPos=u;return}}if((t===T.CommandStart||t===T.TestMode)&&a){if(o){if(f===2&&r.charCodeAt(n)===As&&r.charCodeAt(n+1)===As){mm(e,h.DblRBracket,n,l,!0);return}}else if(d==="]]"){Tt(e,h.DblRBracket,d,n,l);return}}if(!s&&this.pos<this.srcEnd){let m=r.charCodeAt(this.pos);if(m===dt||m===$t){if(o){let y=r.charCodeAt(n);if(y>=_r&&y<=Or&&Dte(r,n,l)){let b=Number.parseInt(r.slice(n,l),10);if(this.readRedirection(e,n)){e.fileDescriptor=b;return}}if(y===Ut&&f>2&&r.charCodeAt(l-1)===lr){let b=r.slice(n+1,l-1);if(this.readRedirection(e,n)){e.variableName=b;return}}}else if(d!==null&&d.length>0){if(d.charCodeAt(0)>=_r&&d.charCodeAt(0)<=Or&&Mte(d)){let y=Number.parseInt(d,10);if(this.readRedirection(e,n)){e.fileDescriptor=y;return}}if(d.charCodeAt(0)===Ut&&d.charCodeAt(d.length-1)===lr&&d.length>2){let y=d.slice(1,-1);if(this.readRedirection(e,n)){e.variableName=y;return}}}}}if(mm(e,h.Word,n,l,o),d!==null)e._value=d;e.keywordEligible=a}readWordText(e=!1){let t=this.src,n=this.srcEnd,r=this.pos,o=r,s=0;while(r<n){let k=t.charCodeAt(r);if(k<128&&Qe[k]){s=k;break}r++}if(r>=n||Qe[s]&1&&!(s===be&&r>o&&$a[t.charCodeAt(r-1)])&&!e){if(this.pos=r,this._wordText=(this._buildParts||this._buildValue)&&r>o?t.slice(o,r):"",this._wordRaw=!0,this._wordQuoted=!1,this._wordHasExpansions=!1,this._wordKeywordEligible=!0,this._wordIsAssignment=void 0,this._wordAssignmentOperatorPos=void 0,this._buildParts)this._wordParts=null;return}let i=this._buildParts,a=i||this._buildValue,c=a&&r>o?t.slice(o,r):"",u=!1,l=!1,f=!0,d=!0,m=r>o?t.charCodeAt(r-1):0,y=pm(t,o,r,wy),b,E="",w=0;if(i)b=[],E=c,w=o;while(r<n){let k=t.charCodeAt(r);if(k>=128||!Qe[k]){let g=r;r++;while(r<n){let x=t.charCodeAt(r);if(x<128&&Qe[x])break;r++}if(m=t.charCodeAt(r-1),y=pm(t,g,r,y),a){let x=t.slice(g,r);if(c+=x,i)E+=x}continue}if(Qe[k]&1){if(k===be&&m<128&&$a[m]){f=!1;let g=m;r++;let x=r,S=this.findClosingShellDelimiter(x,n,Qt,g===nt),C=S===-1?n:S;if(r=S===-1?n:S+1,S===-1)this.errors.push({message:"unterminated extended glob",pos:x-2});if(m=t.charCodeAt(r-1),a){let I="("+t.slice(x,r);if(c+=I,i&&g!==nt){if(E.length>0){let M=E.slice(0,-1);if(M)b.push({type:"Literal",value:M,text:t.slice(w,x-2)});E=""}let _=Fte[g];b.push({type:"ExtendedGlob",text:_+I,operator:_,pattern:t.slice(x,C),parts:Da(t,x,C)?this.parseSubFieldWord(x,C).parts:void 0}),w=r}else if(i)E+=I}continue}if(e&&y>=ko){let g=this.findClosingBracket(r);if(g!==-1){let x=g+1;if(y=pm(t,r,x,y),m=t.charCodeAt(g),a){let S=t.slice(r,x);if(c+=S,i)E+=S}r=x;continue}}break}if(k===ke){if(r++,r<n)if(t.charCodeAt(r)===Ct)r++,d=!1;else{if(y>=0&&y<ko)y=Co;if(u=!0,f=!1,d=!1,m=t.charCodeAt(r),a){if(c+=t[r],i)E+=t[r]}r++}else{if(y>=0&&y<ko)y=Co;if(u=!0,f=!1,m=ke,a){if(c+="\\",i)E+="\\"}}continue}if(k===xt){let g=r;if(y>=0&&y<ko)y=Co;u=!0,f=!1,d=!1,r++;let x=r;while(r<n&&t.charCodeAt(r)!==xt)r++;if(r>x)m=t.charCodeAt(r-1);let S=a?t.slice(x,r):"";if(a)c+=S;if(r<n)r++;else this.errors.push({message:"unterminated single quote",pos:x-1});if(i){if(E)b.push({type:"Literal",value:E,text:t.slice(w,g)}),E="";b.push({type:"SingleQuoted",value:S,text:t.slice(g,r)}),w=r}continue}if(k===tt){let g=r;if(y>=0&&y<ko)y=Co;if(u=!0,f=!1,d=!1,r++,this.pos=r,this.readDoubleQuoted(),r=this.pos,this._dqEnd>g+1)m=t.charCodeAt(this._dqEnd-1);if(this._dqHasExpansions)l=!0;if(a)c+=this._dqText;if(i){if(E)b.push({type:"Literal",value:E,text:t.slice(w,g)}),E="";let x=t.slice(g,r);b.push({type:"DoubleQuoted",text:x,parts:this._dqParts??[{type:"Literal",value:this._dqText,text:t.slice(g+1,this._dqEnd)}]}),w=r}continue}if(k===$e){f=!1;let g=r;if(y>=0&&y<ko)y=Co;if(this.pos=r,this.readDollar(),r=this.pos,!this._resultIsRaw)d=!1;if(r>g)m=t.charCodeAt(r-1);if(this._resultHasExpansion)l=!0;if(a)c+=this._resultText;if(i)if(this._resultPart){if(E)b.push({type:"Literal",value:E,text:t.slice(w,g)}),E="";b.push(this._resultPart),w=r}else E+=this._resultText;continue}if(k===qe){f=!1;let g=r;if(y>=0&&y<ko)y=Co;if(this.pos=r,this.readBacktickExpansion(),r=this.pos,d=!1,m=t.charCodeAt(r-1),l=!0,a)c+=this._resultText;if(i){if(E)b.push({type:"Literal",value:E,text:t.slice(w,g)}),E="";b.push(this._resultPart),w=r}continue}if(k===Ut){if(y>=0&&y<ko)y=Co;let g=Ute(t,r,n);if(g>0){if(f=!1,m=t.charCodeAt(g-1),a){let x=t.slice(r,g);if(c+=x,i){if(E)b.push({type:"Literal",value:E,text:t.slice(w,r)}),E="";b.push({type:"BraceExpansion",text:x,parts:Da(t,r+1,g-1)?this.parseSubFieldWord(r+1,g-1).parts:void 0}),w=g}}r=g;continue}if(m=Ut,a){if(c+="{",i)E+="{"}r++;continue}r++}if(i&&E)b.push({type:"Literal",value:E,text:t.slice(w,r)});if(this.pos=r,this._wordText=c,this._wordRaw=d,this._wordQuoted=u,this._wordHasExpansions=l,this._wordKeywordEligible=f,this._wordIsAssignment=dH(y),this._wordAssignmentOperatorPos=this._wordIsAssignment?pH(y):void 0,i)this._wordParts=b.length>1||b.length===1&&b[0].type!=="Literal"?b:null}readInnerWordText(){let e=this.src,t=this.srcEnd,n=this.pos,r="",o=this._buildParts,s,i="",a=0;if(o)s=[],a=n;while(n<t){let c=e.charCodeAt(n);if(c===ke){if(n++,n<t)if(e.charCodeAt(n)===Ct)n++;else{let u=e[n++];if(r+=u,o)i+=u}continue}if(c===xt){let u=n;n++;let l=n;while(n<t&&e.charCodeAt(n)!==xt)n++;let f=e.slice(l,n);if(r+=f,n<t)n++;if(o){if(i)s.push({type:"Literal",value:i,text:e.slice(a,u)}),i="";s.push({type:"SingleQuoted",value:f,text:e.slice(u,n)}),a=n}continue}if(c===tt){let u=n;if(n++,this.pos=n,this.readDoubleQuoted(),n=this.pos,r+=this._dqText,o){if(i)s.push({type:"Literal",value:i,text:e.slice(a,u)}),i="";let l=e.slice(u,n);s.push({type:"DoubleQuoted",text:l,parts:this._dqParts??[{type:"Literal",value:this._dqText,text:e.slice(u+1,this._dqEnd)}]}),a=n}continue}if(c===$e){let u=n;if(this.pos=n,this.readDollar(),n=this.pos,r+=this._resultText,o)if(this._resultPart){if(i)s.push({type:"Literal",value:i,text:e.slice(a,u)}),i="";s.push(this._resultPart),a=n}else i+=this._resultText;continue}if(c===qe){let u=n;if(this.pos=n,this.readBacktickExpansion(),n=this.pos,r+=this._resultText,o){if(i)s.push({type:"Literal",value:i,text:e.slice(a,u)}),i="";s.push(this._resultPart),a=n}continue}if((c===dt||c===$t)&&n+1<t&&e.charCodeAt(n+1)===be){let u=n;this.pos=n+2;let l=this.extractBalanced();n=this.pos;let f=e.slice(u,n);if(r+=f,o){if(i)s.push({type:"Literal",value:i,text:e.slice(a,u)}),i="";let d={type:"ProcessSubstitution",text:f,operator:c===dt?"<":">",script:void 0,inner:l,innerStart:u+2};s.push(d),this.collect(d),a=n}continue}if(r+=e[n],o)i+=e[n];n++}if(o&&i)s.push({type:"Literal",value:i,text:e.slice(a,n)});if(this.pos=n,this._wordText=r,this._wordRaw=!1,this._wordQuoted=!1,this._wordHasExpansions=!1,this._wordKeywordEligible=!1,o)this._wordParts=s.length>1||s.length===1&&s[0].type!=="Literal"?s:null}parseSubFieldWord(e,t){if(e>=t)return new tn("",e,e);if(this._nestingDepth>=xn)return new tn(this.src.slice(e,t),e,t);this._nestingDepth++;let n=this.srcEnd,r=this.pos,o=this._wordText,s=this._wordParts,i=this._wordQuoted,a=this._wordKeywordEligible;this.srcEnd=t,this.pos=e,this.readInnerWordText();let c=new tn(this.src.slice(e,t),e,t);if(this._buildParts&&this._wordParts)c.parts=this._wordParts;return this.srcEnd=n,this.pos=r,this._wordText=o,this._wordParts=s,this._wordQuoted=i,this._wordKeywordEligible=a,this._nestingDepth--,c}skipSQ(){while(this.pos<this.srcEnd&&this.src.charCodeAt(this.pos)!==xt)this.pos++;if(this.pos<this.srcEnd)this.pos++}skipAnsiCQuoted(){let e=this.pos-1,t=FI(this.src,this.pos,this.srcEnd);if(this.pos=t.end,!t.closed)this.errors.push({message:"unterminated ANSI-C quote",pos:e})}skipDQ(){let e=this.src,t=this.srcEnd;while(this.pos<t){let n=e.charCodeAt(this.pos);if(n===tt){this.pos++;return}if(n===ke){this.pos+=2;continue}if(n===$e&&this.pos+1<t){let r=e.charCodeAt(this.pos+1);if(r===be){let o=this.pos;if(this.pos+=2,this.extractBalanced(),this._unbalanced)this.errors.push({message:"unterminated command substitution",pos:o});continue}if(r===Ut){this.pos+=2;let o=1;while(this.pos<t&&o>0){let s=e.charCodeAt(this.pos);if(s===lr){if(--o===0){this.pos++;break}}else if(s===Ut&&this.pos>0&&e.charCodeAt(this.pos-1)===$e)o++;else if(s===ke)this.pos++;else if(s===xt){this.pos++,this.skipSQ();continue}else if(s===tt){this.pos++,this.skipDQ();continue}this.pos++}continue}}if(n===qe){this.pos++;while(this.pos<t&&e.charCodeAt(this.pos)!==qe){if(e.charCodeAt(this.pos)===ke)this.pos++;this.pos++}if(this.pos<t)this.pos++;continue}this.pos++}}skipSpacesAndTabs(){let e=this.src,t=this.srcEnd;while(this.pos<t){let n=e.charCodeAt(this.pos);if(n===bo||n===Yo)this.pos++;else if(n===ke&&this.pos+1<t&&e.charCodeAt(this.pos+1)===Ct)this.pos+=2;else break}}readDoubleQuoted(){let e=this.src,t=this.srcEnd,n=this.pos,r=!1,o=this._buildParts,s=o||this._buildValue;if(!o){let l=this.pos;while(l<t){let f=e.charCodeAt(l);if(f===tt){this._dqText=s?e.slice(n,l):"",this._dqEnd=l,this.pos=l+1,this._dqHasExpansions=!1,this._dqParts=null;return}if(f===$e||f===qe||f===ke)break;l++}}let i="",a=null,c="",u=o?this.pos:0;while(this.pos<t&&e.charCodeAt(this.pos)!==tt){let l=this.pos;while(this.pos<t){let d=e.charCodeAt(this.pos);if(d===tt||d===ke||d===$e||d===qe)break;this.pos++}if(s&&this.pos>l){let d=e.slice(l,this.pos);if(i+=d,o)c+=d}if(this.pos>=t||e.charCodeAt(this.pos)===tt)break;let f=e.charCodeAt(this.pos);if(f===ke){if(this.pos++,this.pos<t){let d=e.charCodeAt(this.pos);if(d===Ct){this.pos++;continue}if(s)if(d===$e||d===qe||d===tt||d===ke){let m=e[this.pos];if(i+=m,o)c+=m}else{let m="\\"+e[this.pos];if(i+=m,o)c+=m}this.pos++}continue}if(f===$e){let d=this.pos+1<t?e.charCodeAt(this.pos+1):0;if(d===tt||d===xt){if(s){if(i+="$",o)c+="$"}this.pos++;continue}let m=this.pos;if(this.readDollar(),s)i+=this._resultText;if(this._resultHasExpansion)r=!0;if(o){let y=this._resultPart;if(y&&cH(y)){if(!a)a=[];if(c)a.push({type:"Literal",value:c,text:e.slice(u,m)}),c="";a.push(y),u=this.pos}else c+=this._resultText}continue}if(f===qe){let d=this.pos;if(this.readBacktickExpansion(),s)i+=this._resultText;if(r=!0,o&&this._resultPart&&cH(this._resultPart)){if(!a)a=[];if(c)a.push({type:"Literal",value:c,text:e.slice(u,d)}),c="";a.push(this._resultPart),u=this.pos}continue}}if(o&&a&&c)a.push({type:"Literal",value:c,text:e.slice(u,this.pos)});if(this._dqEnd=this.pos,this.pos<t)this.pos++;else this.errors.push({message:"unterminated double quote",pos:n-1});this._dqText=i,this._dqHasExpansions=r,this._dqParts=a}readDollar(){let e=this.pos;this.pos++;let t=this.src,n=this.srcEnd,r=this._buildParts||this._buildValue;if(this.pos>=n){this._resultText="$",this._resultIsRaw=!0,this._resultHasExpansion=!1,this._resultPart=void 0;return}let o=t.charCodeAt(this.pos);if(o===be){if(this.pos+1<n&&t.charCodeAt(this.pos+1)===be){let s=this.pos,i=this.errors.length;if(this.readArithmeticExpansion(),!this._notArithmetic)return;this.errors.length=i,this.pos=s}this.readCommandSubstitution();return}if(o===Ut){let s=this.pos+1<n?t.charCodeAt(this.pos+1):0;if(s===bo||s===Yo||s===Ct){this.readBraceCommandSubstitution();return}if(s===wo){this.readValueSubstitution();return}this.readParameterExpansion();return}if(o===xt){if(this.pos++,r){let s=this.readAnsiCQuoted();this._resultText=s,this._resultPart=this._buildParts?{type:"AnsiCQuoted",text:t.slice(e,this.pos),value:s}:void 0}else this.skipAnsiCQuoted(),this._resultText="",this._resultPart=void 0;this._resultIsRaw=!1,this._resultHasExpansion=!1;return}if(o===tt){if(this.pos++,this.readDoubleQuoted(),this._resultText=this._dqText,this._resultIsRaw=!1,this._resultHasExpansion=this._dqHasExpansions,this._buildParts){let s=t.slice(e,this.pos);this._resultPart={type:"LocaleString",text:s,parts:this._dqParts??[{type:"Literal",value:this._dqText,text:t.slice(e+2,this._dqEnd)}]}}else this._resultPart=void 0;return}if(o===eu||o===Is||o===hn||o===Xo||o===gn||o===$e||o===Ar||o>=_r&&o<=Or){this.pos++;let s=r?t.slice(this.pos-2,this.pos):"";this._resultText=s,this._resultIsRaw=!0,this._resultHasExpansion=!1,this._resultPart=this._buildParts?{type:"SimpleExpansion",text:s}:void 0;return}if(o<128&&Na[o]&1){let s=this.pos-1;while(this.pos<n){let a=t.charCodeAt(this.pos);if(a<128&&Na[a]&2)this.pos++;else break}let i=r?t.slice(s,this.pos):"";this._resultText=i,this._resultIsRaw=!0,this._resultHasExpansion=!1,this._resultPart=this._buildParts?{type:"SimpleExpansion",text:i}:void 0;return}if(o===Vn){let s=this.findClosingArithmeticBracket(this.pos+1);if(s!==-1){let i=this.pos+1,a=t.slice(i,s);this.pos=s+1;let c=r?t.slice(e,this.pos):"";this._resultText=c,this._resultIsRaw=!0,this._resultHasExpansion=!1,this._resultPart=this._buildParts?{type:"ArithmeticExpansion",text:c,expression:this.buildArithmeticExpression(a,i)}:void 0;return}}this._resultText="$",this._resultIsRaw=!0,this._resultHasExpansion=!1,this._resultPart=void 0}scanArithmeticBody(){this._notArithmetic=!1,this.pos+=2;let e=1,t=0,n=0,r,o=0,s=!1,i=this.src,a=this.srcEnd,c=this.pos;while(this.pos<a&&e>0){let u=i.charCodeAt(this.pos);if(u===ke)this.pos+=2;else if(u===xt)this.pos++,this.skipSQ();else if(u===tt)this.pos++,this.skipDQ();else if(u===qe){this.pos++;while(this.pos<a&&i.charCodeAt(this.pos)!==qe){if(i.charCodeAt(this.pos)===ke)this.pos++;this.pos++}if(this.pos<a)this.pos++}else if(u===$e&&this.pos+2<a&&i.charCodeAt(this.pos+1)===be&&i.charCodeAt(this.pos+2)!==be){let l=this.pos;if(this.pos+=2,this.extractBalanced(),this._unbalanced)this.errors.push({message:"unterminated command substitution",pos:l})}else if(u===$e&&this.pos+1<a&&i.charCodeAt(this.pos+1)===Ut){let l=this.findClosingBrace(this.pos+2,a);this.pos=l===-1?a:l+1}else if((u===dt||u===$t)&&this.pos+1<a&&i.charCodeAt(this.pos+1)===be)this.pos+=2,this.extractBalanced();else if(u===be)if(i.charCodeAt(this.pos-1)===$e&&i.charCodeAt(this.pos+1)===be){if(e===1)n=t;else(r??=[]).push(t);if(e++,t=0,++o+this._nestingDepth>=xn){if(!s)this.errors.push({message:"maximum arithmetic expansion nesting depth exceeded",pos:this.pos-1}),s=!0}this.pos+=2}else t++,this.pos++;else if(u===Qt&&t>0)t--,this.pos++;else if(u===Qt&&this.pos+1<a&&i.charCodeAt(this.pos+1)===Qt){if(--e===0){this.pos+=2;break}t=e===1?n:r.pop(),this.pos+=2}else if(u===Qt&&e===1)return this._notArithmetic=!0,"";else this.pos++}return this._buildParts||this._buildValue?i.slice(c,this.pos-2):""}readArithmeticExpansion(){let e=this.pos+2,t=this.scanArithmeticBody();if(this._notArithmetic)return;let n=this._buildParts||this._buildValue?"$(("+t+"))":"";this._resultText=n,this._resultIsRaw=!0,this._resultHasExpansion=!1,this._resultPart=this._buildParts?{type:"ArithmeticExpansion",text:n,expression:this.buildArithmeticExpression(t,e)}:void 0}buildArithmeticExpression(e,t){if(!Da(this.src,t,t+e.length))return af(e,t)??void 0;let n=[],r=[],o=af(e,t,{commandExpansions:n,embeddedWords:r,findClosingBracket:(s,i)=>this.findClosingBracket(s,i),findClosingBrace:(s,i)=>this.findClosingBrace(s,i),findClosingParenthesis:(s,i)=>this.findClosingParenthesis(s,i),findArithmeticExpansionEnd:(s,i)=>this.findArithmeticExpansionEnd(s,i),findArithmeticWordEnd:(s,i)=>this.findArithmeticWordEnd(s,i)})??void 0;for(let s of n)s.innerStart=s.pos+2,this.collect(s);for(let s of r)s.parts=this.parseSubFieldWord(s.pos,s.end).parts;return o}readArithmeticCommand(e,t){let n=this._buildValue;this._buildValue=!0;let r=this.scanArithmeticBody();this._buildValue=n,Tt(e,h.ArithCmd,r,t,this.pos)}readCommandSubstitution(){let e=this.pos-1;this.pos++;let t=this.extractBalanced();if(this._unbalanced)this.errors.push({message:"unterminated command substitution",pos:e});let r=this._buildParts||this._buildValue?this.src.slice(e,this.pos):"";if(this._resultText=r,this._resultIsRaw=!0,this._resultHasExpansion=!0,this._buildParts)this._resultPart={type:"CommandExpansion",text:r,script:void 0,inner:t,innerStart:e+2},this.collect(this._resultPart);else this._resultPart=void 0}readBraceCommandSubstitution(){this.readBraceSubstitution(1)}readValueSubstitution(){this.readBraceSubstitution(2)}readBraceSubstitution(e){let t=this.pos-1;this.pos+=e;let n=this.src,r=this.srcEnd,o=1,s=this.pos;while(this.pos<r){let i=n.charCodeAt(this.pos);if(i===Ut)o++;else if(i===lr){if(--o===0){this.pos++;break}}else if(i===xt){this.pos++,this.skipSQ();continue}else if(i===tt){this.pos++,this.skipDQ();continue}else if(i===ke)this.pos++;this.pos++}if(this._resultIsRaw=!0,this._resultHasExpansion=!0,this._buildParts||this._buildValue){let i=n.slice(s,this.pos-1),a=i.trim(),c=n.slice(t,this.pos);if(this._resultText=c,this._buildParts){let u=s+(i.length-i.trimStart().length);this._resultPart={type:"CommandExpansion",text:c,script:void 0,inner:a,innerStart:u},this.collect(this._resultPart)}else this._resultPart=void 0}else this._resultText="",this._resultPart=void 0}readBacktickExpansion(){this.pos++;let e=this.src,t=this.srcEnd,n=this.pos;if(!this._buildParts&&!this._buildValue){while(this.pos<t&&e.charCodeAt(this.pos)!==qe){if(e.charCodeAt(this.pos)===ke&&this.pos+1<t)this.pos++;this.pos++}if(this.pos<t)this.pos++;else this.errors.push({message:"unterminated backtick",pos:n-1});this._resultText="",this._resultIsRaw=!1,this._resultHasExpansion=!0,this._resultPart=void 0;return}let r="",o=!1;while(this.pos<t&&e.charCodeAt(this.pos)!==qe){if(e.charCodeAt(this.pos)===ke){o=!0;break}this.pos++}if(!o)r=e.slice(n,this.pos);else{r=e.slice(n,this.pos);while(this.pos<t&&e.charCodeAt(this.pos)!==qe)if(e.charCodeAt(this.pos)===ke){if(this.pos++,this.pos<t){let i=e.charCodeAt(this.pos);if(i===$e||i===qe||i===ke)r+=e[this.pos];else r+="\\"+e[this.pos];this.pos++}}else{let i=this.pos;while(this.pos<t){let a=e.charCodeAt(this.pos);if(a===qe||a===ke)break;this.pos++}r+=e.slice(i,this.pos)}}if(this.pos<t)this.pos++;else this.errors.push({message:"unterminated backtick",pos:n-1});let s=e.slice(n-1,this.pos);if(this._resultText=r,this._resultHasExpansion=!0,this._buildParts)this._resultPart={type:"CommandExpansion",text:s,script:void 0,inner:r,innerStart:o?void 0:n},this.collect(this._resultPart);else this._resultPart=void 0}readParameterExpansion(){let e=this.src,t=this.srcEnd,n=this.pos;this.pos++;let r=1,o=!1;while(this.pos<t&&r>0){let a=e.charCodeAt(this.pos);if(a===$e){let c=this.pos+1<t?e.charCodeAt(this.pos+1):0;if(c===Ut){if(r++,this._nestingDepth+r>xn&&!o)this.errors.push({message:"maximum parameter expansion nesting depth exceeded",pos:this.pos}),o=!0;this.pos+=2;continue}if(c===$e){this.pos+=2;continue}if(c===be){let u=this.pos;if(this.pos+=2,this.extractBalanced(),this._unbalanced)this.errors.push({message:"unterminated command substitution",pos:u});continue}}else if(a===qe){this.pos++;while(this.pos<t&&e.charCodeAt(this.pos)!==qe){if(e.charCodeAt(this.pos)===ke)this.pos++;this.pos++}if(this.pos<t)this.pos++;continue}else if(a===lr){if(--r===0){this.pos++;break}}else if(a===ke)this.pos++;else if(a===xt){if(this.pos++,this.pos>n+1&&e.charCodeAt(this.pos-2)===$e)this.skipAnsiCQuoted();else this.skipSQ();continue}else if(a===tt){this.pos++,this.skipDQ();continue}this.pos++}let s=r===0;if(!s)this.errors.push({message:"unterminated parameter expansion",pos:n-1});let i=this._buildParts||this._buildValue?e.slice(n-1,this.pos):"";if(this._resultText=i,this._resultIsRaw=!0,this._resultHasExpansion=!1,this._buildParts){let a=e.slice(n+1,s?this.pos-1:this.pos);this._resultPart=this.parseParamInner(i,a,n+1)}else this._resultPart=void 0}parseParamInner(e,t,n){let r={type:"ParameterExpansion",text:e,parameter:"",index:void 0,indexParts:void 0,indirect:void 0,length:void 0,operator:void 0,operand:void 0,slice:void 0,replace:void 0},o=t.length;if(o===0)return r;let s=(u,l)=>this.parseSubFieldWord(n+u,n+l),i=(u)=>{let l=this.findClosingBracket(n+u,n+o);return l===-1?-1:l-n},a=0;if(t.charCodeAt(0)===Ar)r.indirect=!0,a=1;if(!r.indirect&&t.charCodeAt(0)===hn){if(o===1)return r.parameter="#",r;if(t.charCodeAt(1)===hn)r.parameter="#",a=1;else{let u=this.scanParamName(t,1);if(u>1){let l=u;if(l<o&&t.charCodeAt(l)===Vn){let f=i(l+1);if(f!==-1)l=f+1}if(l>=o){if(r.length=!0,r.parameter=t.slice(1,u),u<o&&t.charCodeAt(u)===Vn){let f=i(u+1);if(f!==-1)r.index=t.slice(u+1,f),r.indexParts=s(u+1,f).parts}return r}}r.parameter="#",a=1}}if(!r.parameter){let u=a;a=this.scanParamName(t,a),r.parameter=t.slice(u,a)}if(a<o&&t.charCodeAt(a)===Vn){let u=i(a+1);if(u!==-1)r.index=t.slice(a+1,u),r.indexParts=s(a+1,u).parts,a=u+1}if(a>=o)return r;let c=t.charCodeAt(a);if(c===rf){if(a+1<o){let f=t.charCodeAt(a+1);if(f===gn||f===nt||f===On||f===Xo)return r.operator=t.slice(a,a+2),r.operand=s(a+2,o),r}a++;let u=t.slice(a),l=aH(u,rf);if(l===-1)r.slice={offset:s(a,o),length:void 0};else r.slice={offset:s(a,a+l),length:s(a+l+1,o)};return r}if(c===gn||c===nt||c===On||c===Xo)return r.operator=t[a],r.operand=s(a+1,o),r;if(c===hn){if(a+1<o&&t.charCodeAt(a+1)===hn)r.operator="##",r.operand=s(a+2,o);else r.operator="#",r.operand=s(a+1,o);return r}if(c===Yc){if(a+1<o&&t.charCodeAt(a+1)===Yc)r.operator="%%",r.operand=s(a+2,o);else r.operator="%",r.operand=s(a+1,o);return r}if(c===Xc){a++;let u="/";if(a<o){let d=t.charCodeAt(a);if(d===Xc)u="//",a++;else if(d===hn)u="/#",a++;else if(d===Yc)u="/%",a++}r.operator=u;let l=t.slice(a),f=aH(l,Xc);if(f===-1)r.replace={pattern:s(a,o),replacement:new tn("",n+o,n+o)};else r.replace={pattern:s(a,a+f),replacement:s(a+f+1,o)};return r}if(c===sf){if(a+1<o&&t.charCodeAt(a+1)===sf){if(r.operator="^^",a+2<o)r.operand=s(a+2,o)}else if(r.operator="^",a+1<o)r.operand=s(a+1,o);return r}if(c===nf){if(a+1<o&&t.charCodeAt(a+1)===nf){if(r.operator=",,",a+2<o)r.operand=s(a+2,o)}else if(r.operator=",",a+1<o)r.operand=s(a+1,o);return r}if(c===eu)return r.operator="@",r.operand=s(a+1,o),r;return r.operator=t.slice(a),r}scanParamName(e,t){let n=t;if(n>=e.length)return n;let r=e.charCodeAt(n);if(r===eu||r===Is||r===hn||r===Xo||r===gn||r===$e||r===Ar)return n+1;if(r>=_r&&r<=Or){while(n<e.length&&e.charCodeAt(n)>=_r&&e.charCodeAt(n)<=Or)n++;return n}if(r>=Oi&&r<=Pi||r>=Ra&&r<=Fa||r===Ma){n++;while(n<e.length){let o=e.charCodeAt(n);if(o>=Oi&&o<=Pi||o>=Ra&&o<=Fa||o>=_r&&o<=Or||o===Ma)n++;else break}}return n}readAnsiCQuoted(){let e=this.pos-1,t=FI(this.src,this.pos,this.srcEnd);if(this.pos=t.end,!t.closed)this.errors.push({message:"unterminated ANSI-C quote",pos:e});return t.value}extractBalanced(){let e=this.src,t=this.srcEnd,n=this._buildParts||this._buildValue,r=1,o=this.pos;this._unbalanced=!1;while(this.pos<t){let d=e.charCodeAt(this.pos);if(d===Qt){let m=n?e.slice(o,this.pos):"";return this.pos++,m}else if(d===be||d===ke||d===xt||d===tt||d===qe)break;else if(d===dt&&this.pos+1<t&&e.charCodeAt(this.pos+1)===dt)break;else if(d===hn&&(this.pos===o||e.charCodeAt(this.pos-1)<128&&Qe[e.charCodeAt(this.pos-1)]&1))break;else if(d===99&&(this.pos===o||e.charCodeAt(this.pos-1)<128&&Qe[e.charCodeAt(this.pos-1)]&1)&&this.pos+3<t&&e.charCodeAt(this.pos+1)===97&&e.charCodeAt(this.pos+2)===115&&e.charCodeAt(this.pos+3)===101&&(this.pos+4>=t||e.charCodeAt(this.pos+4)<128&&Qe[e.charCodeAt(this.pos+4)]&1))break;else this.pos++}let s=0,i=0,a=null,c=-1,u=o>=2&&e.charCodeAt(o)===be&&e.charCodeAt(o-1)===be&&e.charCodeAt(o-2)===$e,l=0,f=!1;while(this.pos<t&&r>0){let d=e.charCodeAt(this.pos);if(d===be){if(c<0&&this.pos+1<t&&e.charCodeAt(this.pos+1)===be)c=r;if(e.charCodeAt(this.pos-1)===$e&&++l+this._nestingDepth>=xn){if(!f)this.errors.push({message:"maximum command substitution nesting depth exceeded",pos:this.pos-1}),f=!0}if(r++,s>0)i++;this.pos++}else if(d===Qt)if(s>0&&i===0)this.pos++;else{if(s>0)i--;if(r--,r===0){let m=n?e.slice(o,this.pos):"";return this.pos++,m}if(r<=c)c=-1;this.pos++}else if(d===ke){if(this.pos++,this.pos<t)this.pos++}else if(d===xt)this.pos++,this.skipSQ();else if(d===tt)this.pos++,this.skipDQ();else if(d===qe){this.pos++;while(this.pos<t&&e.charCodeAt(this.pos)!==qe){if(e.charCodeAt(this.pos)===ke)this.pos++;if(this.pos<t)this.pos++}if(this.pos<t)this.pos++}else if(d===dt&&c<0&&this.pos+1<t&&e.charCodeAt(this.pos+1)===dt)if(this.pos+2<t&&e.charCodeAt(this.pos+2)===dt)this.pos+=3;else{this.pos+=2;let m=this.pos<t&&e.charCodeAt(this.pos)===gn;if(m)this.pos++;if(this.skipSpacesAndTabs(),this.readHereDocDelimiter(),this._hereDelim||this._hereQuoted)(a??=[]).push({delimiter:this._hereDelim,strip:m,quoted:this._hereQuoted})}else if(d===Ct&&a){this.pos++;for(let m of a)this.skipHereDocBody(m.delimiter,m.strip,!0,m.quoted);a=null}else if(d===hn&&c<0&&!u&&iH(e,this.pos,o))while(this.pos<t&&e.charCodeAt(this.pos)!==Ct)this.pos++;else{let m=this.pos;while(this.pos<t){let y=e.charCodeAt(this.pos);if(y<128&&Qe[y])break;this.pos++}if(this.pos>m){let y=this.pos-m,b=m>o?e.charCodeAt(m-1):0;if(y===4&&(m===o||b<128&&Qe[b]&1)){let E=e.charCodeAt(m);if(E===99&&e.charCodeAt(m+1)===97&&e.charCodeAt(m+2)===115&&e.charCodeAt(m+3)===101)s++;else if(E===101&&e.charCodeAt(m+1)===115&&e.charCodeAt(m+2)===97&&e.charCodeAt(m+3)===99&&s>0){if(s--,s===0)i=0}}}else this.pos++}}return this._unbalanced=!0,n?e.slice(o,this.pos):""}}var xn=256,h,Rte,Qe,mH,Na,$a,Fte,Co=-1,wy=0,uH=1,lH=2,fH=3,ko=4,Nte,T;var DI=v(()=>{MI();h={Word:0,Assignment:1,Semi:2,Newline:3,Pipe:4,And:5,Or:6,Amp:7,LParen:8,RParen:9,LBrace:10,RBrace:11,Bang:12,If:13,Then:14,Else:15,Elif:16,Fi:17,Do:18,Done:19,For:20,While:21,Until:22,In:23,Case:24,Esac:25,Function:26,DoubleSemi:27,SemiAmp:28,DoubleSemiAmp:29,Select:30,DblLBracket:31,DblRBracket:32,EOF:33,ArithCmd:34,Coproc:35,Redirect:36};Rte=new Map([["if",h.If],["then",h.Then],["else",h.Else],["elif",h.Elif],["fi",h.Fi],["do",h.Do],["done",h.Done],["for",h.For],["while",h.While],["until",h.Until],["in",h.In],["case",h.Case],["esac",h.Esac],["function",h.Function],["select",h.Select],["coproc",h.Coproc],["!",h.Bang],["{",h.LBrace],["}",h.RBrace]]),Qe=new Uint8Array(128);Qe[wo]=1;Qe[Tr]=1;Qe[of]=1;Qe[be]=1;Qe[Qt]=1;Qe[dt]=1;Qe[$t]=1;Qe[bo]=1;Qe[Yo]=1;Qe[Ct]=1;Qe[ke]=2;Qe[xt]=2;Qe[tt]=2;Qe[$e]=2;Qe[qe]=2;Qe[Ut]=2;mH=new Uint8Array(128);for(let e of[Yo,Ct,bo,Ar,Yc,Tr,be,Qt,Is,On,nf,gn,Xc,rf,dt,nt,$t,Xo,sf,wo])mH[e]=1;Na=new Uint8Array(128);for(let e=Oi;e<=Pi;e++)Na[e]=3;for(let e=Ra;e<=Fa;e++)Na[e]=3;for(let e=_r;e<=Or;e++)Na[e]=2;Na[Ma]=3;$a=new Uint8Array(128);$a[Xo]=1;$a[eu]=1;$a[Is]=1;$a[On]=1;$a[Ar]=1;$a[nt]=1;Fte={[Xo]:"?",[eu]:"@",[Is]:"*",[On]:"+",[Ar]:"!"};Nte=[];T={Normal:0,CommandStart:1,TestMode:2,CommandPrefix:3}});function hH(e,t,n=0){let r=new es(e,t.pos,t.end);r._nestingDepth=n;let o=r.buildWordParts(t.pos);if(!o)return;return NI(r),o}function Cy(e,t,n=0){if(!Da(e,t.pos,t.end))return;let r=new es(e,t.pos,t.end);r._nestingDepth=n;let o=r.buildEmbeddedWordParts(t.pos);if(!o)return;return NI(r),o}function gH(e,t,n=0){let r=new es(e,t.pos,t.end);r._nestingDepth=n;let o=r.buildHereDocParts(t.pos,t.end);if(!o)return;return NI(r),o}function NI(e){let t=e.getSource();for(let[n,r]of e.getCollectedExpansions())if(n.inner!==void 0){let o=r+1;if(o>xn+1);else if(n.innerStart!==void 0)n.script=$I(t,n.innerStart,n.innerStart+n.inner.length,o);else n.script=cf(n.inner),Object.defineProperty(n.script,"source",{value:n.inner,enumerable:!1});n.inner=void 0,n.innerStart=void 0}}var xH=v(()=>{DI();UI()});class yH{type="ArithmeticCommand";pos;end;body;#t;#e;#n=null;constructor(e,t,n,r,o){this.pos=e,this.end=t,this.body=n,this.#t=r,this.#e=o}get expression(){if(this.#n===null)this.#n=Iy(this.body,this.pos+2,this.#t,this.#e);return this.#n}set expression(e){this.#n=e??void 0}toJSON(){return{type:this.type,pos:this.pos,end:this.end,expression:this.expression,body:this.body}}}class vy{type="ArithmeticFor";pos;end;body;#t;#e;#n;#o;#i;#m;#f;#p;#d=null;#a=null;#u=null;constructor(e,t,n,r,o,s,i,a,c,u,l){this.pos=e,this.end=t,this.body=n,this.#t=r,this.#e=o,this.#n=s,this.#o=i,this.#i=a,this.#m=c,this.#f=u,this.#p=l}get initialize(){if(this.#d===null)if(this.#t)this.#d=Iy(this.#t,this.#o,this.#f,this.#p);else this.#d=void 0;return this.#d}set initialize(e){this.#d=e??void 0}get test(){if(this.#a===null)if(this.#e)this.#a=Iy(this.#e,this.#i,this.#f,this.#p);else this.#a=void 0;return this.#a}set test(e){this.#a=e??void 0}get update(){if(this.#u===null)if(this.#n)this.#u=Iy(this.#n,this.#m,this.#f,this.#p);else this.#u=void 0;return this.#u}set update(e){this.#u=e??void 0}toJSON(){return{type:this.type,pos:this.pos,end:this.end,initialize:this.initialize,test:this.test,update:this.update,body:this.body}}}function Iy(e,t,n,r=0){if(!Da(n,t,t+e.length))return af(e,t)??void 0;let o=[],s=[],i=new es(n),a=af(e,t,{commandExpansions:o,embeddedWords:s,findClosingBracket:(c,u)=>i.findClosingBracket(c,u),findClosingBrace:(c,u)=>i.findClosingBrace(c,u),findClosingParenthesis:(c,u)=>i.findClosingParenthesis(c,u),findArithmeticExpansionEnd:(c,u)=>i.findArithmeticExpansionEnd(c,u),findArithmeticWordEnd:(c,u)=>i.findArithmeticWordEnd(c,u)})??void 0;for(let c of o)if(c.inner!==void 0){if(r<=xn){let u=c.pos+2;c.script=$I(n,u,u+c.inner.length,r+1)}c.inner=void 0}for(let c of s)c.parts=Cy(n,c,r);return a}function LI(e){return e.token===h.Word&&e.keywordEligible&&e.value==="!"}function jte(e){return(t,n)=>{let r=t.slice(n.pos,n.end);return r===e?void 0:[{type:"Literal",value:e,text:r}]}}function hm(e){return e.length===0?[]:e}function cf(e){return new BI(e,0,e.length).run()}function $I(e,t,n,r=0){return new BI(e,t,n,r).run()}class BI{tok;source;start;end;depth;errors=null;_redirects=vo;syntaxDepth=0;constructor(e,t,n,r=0){this.tok=new es(e,t,n),this.tok._nestingDepth=r,this.source=e,this.start=t,this.end=n,this.depth=r}run(){let e=this.start;if(this.depth>xn)this.error("maximum substitution nesting depth exceeded",e);let t;if(e===0&&this.source.charCodeAt(0)===35&&this.source.charCodeAt(1)===33){let s=this.source.indexOf(`
|
|
42
|
-
`);t=s===-1?this.source:this.source.slice(0,s)}let n=this.list();for(;;){let s=this.tok.peek(T.CommandStart);if(s.token===h.EOF)break;if(this.error(`unexpected token '${s.value}'`,s.pos),!Kn[s.token]&&s.token!==h.In)break;this.tok.next(T.CommandStart);let i=this.tok.peek(T.CommandStart).token;if(i!==h.Semi&&i!==h.Newline&&i!==h.Amp)break;while(i===h.Semi||i===h.Newline||i===h.Amp)this.tok.next(T.CommandStart),i=this.tok.peek(T.CommandStart).token;let a=this.list();for(let c=0;c<a.length;c++)n.push(a[c])}let r=this.tok._errors;if(r!==null&&r.length>0){let s=this.errors??=[];for(let i=0;i<r.length;i++)s.push(r[i])}if(this.errors!==null&&this.errors.length>1)this.errors.sort((s,i)=>s.pos-i.pos);return{type:"Script",pos:e,end:this.end,shebang:t,commands:n,errors:this.errors??void 0}}error(e,t){(this.errors??=[]).push({message:e,pos:t})}skipSemi(){if(this.tok.peek(T.Normal).token===h.Semi)this.tok.next(T.Normal)}accept(e,t=T.Normal){if(this.tok.peek(t).token===e)return this.tok.next(t);return null}acceptEnd(e,t=T.Normal){if(this.tok.peek(t).token===e)return this.tok.next(t).end;return-1}skipNewlines(e=T.Normal){while(this.tok.peek(e).token===h.Newline)this.tok.next(e)}makeStatement(e,t){let n=t.length>0?t[t.length-1].end:e.end;return{type:"Statement",pos:e.pos,end:n,command:e,background:void 0,redirects:hm(t)}}list(){let e=[];this.skipNewlines(T.CommandStart);let t=this.tok.peek(T.CommandStart).token;if(Kn[t]||!yn[t])return e;let n=this.andOr();if(n){let r=this._redirects;this._redirects=vo,e.push(this.makeStatement(n,r))}for(;;){if(t=this.tok.peekFollow(Ri).token,t!==h.Semi&&t!==h.Newline&&t!==h.Amp)break;let r=t===h.Amp,o=this.tok.next(T.Normal).end;if(r){let i=e[e.length-1];i.background=!0,i.end=o}if(this.skipNewlines(T.CommandStart),t=this.tok.peek(T.CommandStart).token,Kn[t]||!yn[t])break;let s=this.andOr();if(s){let i=this._redirects;this._redirects=vo,e.push(this.makeStatement(s,i))}}return e}andOr(){let e=this.pipeline();if(!e)return null;let t=this.tok.peek(T.Normal).token;if(t!==h.And&&t!==h.Or)return e;let n=e;if(this._redirects.length>0)n=this.makeStatement(e,this._redirects),this._redirects=vo;let r=[n],o=[];do{let s=this.tok.next(T.Normal),i=s.token===h.And?"&&":"||";this.skipNewlines(T.CommandStart);let a=this.pipeline();if(!a){this.error(`expected command after '${i}'`,s.end);break}o.push(i),r.push(a),t=this.tok.peek(T.Normal).token}while(t===h.And||t===h.Or);return{type:"AndOr",pos:e.pos,end:r[r.length-1].end,commands:r,operators:o}}wrapCompoundRedirects(e){let t=this._redirects;if(this._redirects=vo,t.length===0)return e;return this.makeStatement(e,t)}pipeline(){let e=!1,t=0,n=0,r=this.tok.peek(T.CommandStart);if(r.token===h.Word&&r.keywordEligible&&r.value==="time"){e=!0;let f=this.tok.next(T.CommandStart);t=f.pos,n=f.end;let d=this.tok.peek(T.CommandStart);if(d.token===h.Word&&d.keywordEligible&&d.value==="-p")n=this.tok.next(T.CommandStart).end}let o=!1,s=this.tok.peek(T.CommandStart);if(s.token===h.Bang){if(!e)t=s.pos;n=this.tok.next(T.CommandStart).end,o=!0;let f=this.tok.peek(T.CommandStart);if(f.token===h.Bang){this.error("unexpected token '!'",f.pos);do n=this.tok.next(T.CommandStart).end;while(this.tok.peek(T.CommandStart).token===h.Bang)}}let i=this.command();if(!i){if(e||o)return{type:"Pipeline",pos:t,end:n,commands:[],negated:o?!0:void 0,operators:[],time:e?!0:void 0};return null}if(!e&&!o)t=i.pos;let a=[i],c=[],u=this._redirects;this._redirects=vo;while(this.tok.peek(T.Normal).token===h.Pipe){if(a.length===1&&u.length>0)a[0]=this.makeStatement(i,u),u=[];let f=this.tok.next(T.Normal),d=f.value==="|&"?"|&":"|";this.skipNewlines(T.CommandStart);let m=this.command();if(!m){this.error(`expected command after '${d}'`,f.end);break}c.push(d),a.push(this.wrapCompoundRedirects(m))}if(a.length===1&&!o&&!e)return this._redirects=u,a[0];if(u.length>0)a[0]=this.makeStatement(i,u);return{type:"Pipeline",pos:t,end:a[a.length-1].end,commands:a,negated:o?!0:void 0,operators:c,time:e?!0:void 0}}command(){switch(this.tok.peek(T.CommandStart).token){case h.LParen:return this.subshell();case h.LBrace:return this.braceGroup();case h.If:return this.ifClause();case h.For:return this.forClause();case h.While:return this.whileClause();case h.Until:return this.untilClause();case h.Case:return this.caseClause();case h.Function:return this.functionDef();case h.Select:return this.selectClause();case h.DblLBracket:return this.testCommand();case h.ArithCmd:return this.arithCommand();case h.Coproc:return this.coprocCommand();case h.Word:case h.Assignment:case h.Redirect:return this.simpleCommandOrFunction();default:return null}}collectTrailingRedirects(){let e=vo;while(this.tok.peekFollow(Ri).token===h.Redirect)e=this.collectRedirect(e,T.Normal);return e}arithCommand(){let e=this.tok.next(T.CommandStart);return this._redirects=this.collectTrailingRedirects(),new yH(e.pos,e.end,e.value,this.source,this.depth)}coprocCommand(){let e=this.tok.next(T.CommandStart),t=e.pos,n=e.end,r=this.tok.peek(T.CommandStart);if(r.token!==h.Word&&r.token!==h.Assignment&&r.token!==h.Redirect){let l=this.pipeline()??{type:"Command",pos:t,end:n,name:void 0,prefix:[],suffix:[],redirects:[]},f=this._redirects;this._redirects=vo;let d=this.collectTrailingRedirects(),m=[...f,...d],y=m.length>0?m[m.length-1].end:l.end;return{type:"Coproc",pos:t,end:y,name:void 0,body:l,redirects:m}}let o=this.toWord(this.tok.next(T.CommandStart)),s=this.pipeline();if(s===null){let l={type:"Command",pos:o.pos,end:o.end,name:o,prefix:[],suffix:[],redirects:[]},f=this.collectTrailingRedirects(),d=f.length>0?f[f.length-1].end:l.end;return{type:"Coproc",pos:t,end:d,name:void 0,body:l,redirects:hm(f)}}if(s.type==="Command"){let l=s;if(l.name)l.suffix=[l.name,...l.suffix];l.name=o,l.pos=o.pos;let f=this.collectTrailingRedirects(),d=f.length>0?f[f.length-1].end:l.end;return{type:"Coproc",pos:t,end:d,name:void 0,body:l,redirects:hm(f)}}let i=this._redirects;this._redirects=vo;let a=this.collectTrailingRedirects(),c=[...i,...a],u=c.length>0?c[c.length-1].end:s.end;return{type:"Coproc",pos:t,end:u,name:o,body:s,redirects:c}}subshell(){return this.subshellBody(this.tok.next(T.CommandStart).pos)}subshellBody(e){if(this.syntaxDepth===xn){this.error("maximum subshell nesting depth exceeded",e);let o=this.tok.skipSubshellBody();if(o<0)this.error("expected ')' to close subshell",this.tok.getPos());let s=o>=0?o:e;return this._redirects=this.collectTrailingRedirects(),{type:"Subshell",pos:e,end:s,body:this.makeCompoundList([])}}this.syntaxDepth++;let t=this.list();this.syntaxDepth--;let n=this.acceptEnd(h.RParen,T.Normal);if(n<0)this.error("expected ')' to close subshell",this.tok.getPos());let r=n>=0?n:e;return this._redirects=this.collectTrailingRedirects(),{type:"Subshell",pos:e,end:r,body:this.makeCompoundList(t)}}braceGroup(){let e=this.tok.next(T.CommandStart).pos;if(this.syntaxDepth===xn){this.error("maximum brace group nesting depth exceeded",e);let o=this.tok.skipCompoundBody(h.RBrace);if(o<0)this.error("expected '}' to close brace group",this.tok.getPos());let s=o>=0?o:e;return this._redirects=this.collectTrailingRedirects(),{type:"BraceGroup",pos:e,end:s,body:this.makeCompoundList([])}}this.syntaxDepth++;let t=this.list();this.syntaxDepth--;let n=this.acceptEnd(h.RBrace,T.Normal);if(n<0)this.error("expected '}' to close brace group",this.tok.getPos());let r=n>=0?n:e;return this._redirects=this.collectTrailingRedirects(),{type:"BraceGroup",pos:e,end:r,body:this.makeCompoundList(t)}}ifClause(){let e=this.tok.next(T.CommandStart).pos;if(this.syntaxDepth===xn){this.error("maximum if nesting depth exceeded",e);let l=this.tok.skipCompoundBody(h.Fi);if(l<0)this.error("expected 'fi' to close 'if'",this.tok.getPos());let f=l>=0?l:e;return this._redirects=this.collectTrailingRedirects(),{type:"If",pos:e,end:f,clause:this.makeCompoundList([]),then:this.makeCompoundList([]),else:void 0}}this.syntaxDepth++;let t,n,r=e,o,s;for(;;){if(o=this.makeCompoundList(this.list()),this.skipSemi(),!this.accept(h.Then,T.CommandStart))this.error("expected 'then'",this.tok.getPos());s=this.makeCompoundList(this.list()),this.skipSemi();let l=this.accept(h.Elif,T.CommandStart);if(!l)break;let f={type:"If",pos:r,end:r,clause:o,then:s,else:void 0};if(n)n.else=f;else t=f;n=f,r=l.pos}let i,a;if(this.accept(h.Else,T.CommandStart)){i=this.makeCompoundList(this.list()),this.skipSemi();let l=this.acceptEnd(h.Fi,T.CommandStart);if(l<0)this.error("expected 'fi' to close 'if'",this.tok.getPos());a=l>=0?l:r}else{let l=this.acceptEnd(h.Fi,T.CommandStart);if(l<0)this.error("expected 'fi' to close 'if'",this.tok.getPos());a=l>=0?l:r}this.syntaxDepth--,this._redirects=this.collectTrailingRedirects();let c={type:"If",pos:r,end:a,clause:o,then:s,else:i};if(!t)return c;n.else=c;let u=t;while(u!==c)u.end=a,u=u.else;return t}forClause(){let e=this.tok.next(T.CommandStart).pos;if(this.tok.peek(T.Normal).token===h.LParen)return this.cStyleFor(e);let t=this.readWord(T.Normal),n=[];if(this.skipNewlines(T.CommandStart),this.tok.peek(T.CommandStart).token===h.In){this.tok.next(T.CommandStart);while(this.tok.peek(T.Normal).token===h.Word)n.push(this.readWord(T.Normal))}if(this.skipSemi(),this.skipNewlines(T.CommandStart),this.tok.peek(T.CommandStart).token===h.LBrace){let i=this.braceGroup();return{type:"For",pos:e,end:i.end,name:t,wordlist:n,body:i.body}}if(!this.accept(h.Do,T.CommandStart))this.error("expected 'do'",this.tok.getPos());if(this.syntaxDepth===xn){this.error("maximum for nesting depth exceeded",e);let i=this.tok.skipCompoundBody(h.Done);if(i<0)this.error("expected 'done' to close 'for'",this.tok.getPos());let a=i>=0?i:e;return this._redirects=this.collectTrailingRedirects(),{type:"For",pos:e,end:a,name:t,wordlist:n,body:this.makeCompoundList([])}}this.syntaxDepth++;let r=this.list();this.syntaxDepth--,this.skipSemi();let o=this.acceptEnd(h.Done,T.CommandStart);if(o<0)this.error("expected 'done' to close 'for'",this.tok.getPos());let s=o>=0?o:e;return this._redirects=this.collectTrailingRedirects(),{type:"For",pos:e,end:s,name:t,wordlist:n,body:this.makeCompoundList(r)}}cStyleFor(e){let[t,n,r,o,s,i]=this.tok.readCStyleForExprs();if(this.tok.peek(T.CommandStart).token===h.Semi)this.tok.next(T.CommandStart);if(this.skipNewlines(T.CommandStart),this.tok.peek(T.CommandStart).token===h.LBrace){let l=this.braceGroup();return new vy(e,l.end,l.body,t,n,r,o,s,i,this.source,this.depth)}if(!this.accept(h.Do,T.CommandStart))this.error("expected 'do'",this.tok.getPos());if(this.syntaxDepth===xn){this.error("maximum for nesting depth exceeded",e);let l=this.tok.skipCompoundBody(h.Done);if(l<0)this.error("expected 'done' to close 'for'",this.tok.getPos());let f=l>=0?l:e;return this._redirects=this.collectTrailingRedirects(),new vy(e,f,this.makeCompoundList([]),t,n,r,o,s,i,this.source,this.depth)}this.syntaxDepth++;let a=this.list();this.syntaxDepth--;let c=this.acceptEnd(h.Done,T.CommandStart);if(c<0)this.error("expected 'done' to close 'for'",this.tok.getPos());let u=c>=0?c:e;return this._redirects=this.collectTrailingRedirects(),new vy(e,u,this.makeCompoundList(a),t,n,r,o,s,i,this.source,this.depth)}whileClause(){return this.whileOrUntil("while")}untilClause(){return this.whileOrUntil("until")}whileOrUntil(e){let t=this.tok.next(T.CommandStart).pos;if(this.syntaxDepth===xn){this.error(`maximum ${e} nesting depth exceeded`,t);let i=this.tok.skipCompoundBody(h.Done);if(i<0)this.error(`expected 'done' to close '${e}'`,this.tok.getPos());let a=i>=0?i:t;return this._redirects=this.collectTrailingRedirects(),{type:"While",pos:t,end:a,kind:e,clause:this.makeCompoundList([]),body:this.makeCompoundList([])}}this.syntaxDepth++;let n=this.makeCompoundList(this.list());if(this.skipSemi(),!this.accept(h.Do,T.CommandStart))this.error("expected 'do'",this.tok.getPos());let r=this.list();this.skipSemi();let o=this.acceptEnd(h.Done,T.CommandStart);if(o<0)this.error(`expected 'done' to close '${e}'`,this.tok.getPos());let s=o>=0?o:t;return this.syntaxDepth--,this._redirects=this.collectTrailingRedirects(),{type:"While",pos:t,end:s,kind:e,clause:n,body:this.makeCompoundList(r)}}caseClause(){let e=this.tok.next(T.CommandStart).pos,t=this.readWord(T.Normal);if(this.skipNewlines(T.CommandStart),!this.accept(h.In,T.CommandStart))this.error("expected 'in' after 'case' word",this.tok.getPos());if(this.skipNewlines(T.CommandStart),this.syntaxDepth===xn){this.error("maximum case nesting depth exceeded",e);let i=this.tok.skipCompoundBody(h.Esac);if(i<0)this.error("expected 'esac' to close 'case'",this.tok.getPos());let a=i>=0?i:e;return this._redirects=this.collectTrailingRedirects(),{type:"Case",pos:e,end:a,word:t,items:[]}}this.syntaxDepth++;let n=[],r=this.tok.peek(T.CommandStart).token;while(r!==h.Esac&&r!==h.EOF){let i=this.tok.peek(T.Normal).pos;this.accept(h.LParen,T.Normal);let a=[];r=this.tok.peek(T.Normal).token;while(r!==h.RParen&&r!==h.EOF){if(r!==h.Pipe)a.push(this.toWord(this.tok.next(T.Normal)));else this.tok.next(T.Normal);r=this.tok.peek(T.Normal).token}let c=this.acceptEnd(h.RParen,T.Normal),u=this.list(),l=c>=0?c:i;if(u.length>0)l=u[u.length-1].end;let f={type:"CaseItem",pos:i,end:l,pattern:a,body:this.makeCompoundList(u),terminator:void 0};if(r=this.tok.peek(T.CommandStart).token,r===h.DoubleSemi||r===h.SemiAmp||r===h.DoubleSemiAmp){let d=this.tok.next(T.CommandStart);f.terminator=Lte[d.token],f.end=d.end}n.push(f),this.skipNewlines(T.CommandStart),r=this.tok.peek(T.CommandStart).token}let o=this.acceptEnd(h.Esac,T.CommandStart);if(o<0)this.error("expected 'esac' to close 'case'",this.tok.getPos());let s=o>=0?o:e;return this.syntaxDepth--,this._redirects=this.collectTrailingRedirects(),{type:"Case",pos:e,end:s,word:t,items:n}}selectClause(){let e=this.tok.next(T.CommandStart).pos,t=this.readWord(T.Normal),n=[];if(this.skipNewlines(T.CommandStart),this.tok.peek(T.CommandStart).token===h.In){this.tok.next(T.CommandStart);while(this.tok.peek(T.Normal).token===h.Word)n.push(this.readWord(T.Normal))}if(this.skipSemi(),this.skipNewlines(T.CommandStart),this.tok.peek(T.CommandStart).token===h.LBrace){let i=this.braceGroup();return{type:"Select",pos:e,end:i.end,name:t,wordlist:n,body:i.body}}if(!this.accept(h.Do,T.CommandStart))this.error("expected 'do'",this.tok.getPos());if(this.syntaxDepth===xn){this.error("maximum select nesting depth exceeded",e);let i=this.tok.skipCompoundBody(h.Done);if(i<0)this.error("expected 'done' to close 'select'",this.tok.getPos());let a=i>=0?i:e;return this._redirects=this.collectTrailingRedirects(),{type:"Select",pos:e,end:a,name:t,wordlist:n,body:this.makeCompoundList([])}}this.syntaxDepth++;let r=this.list();this.syntaxDepth--,this.skipSemi();let o=this.acceptEnd(h.Done,T.CommandStart);if(o<0)this.error("expected 'done' to close 'select'",this.tok.getPos());let s=o>=0?o:e;return this._redirects=this.collectTrailingRedirects(),{type:"Select",pos:e,end:s,name:t,wordlist:n,body:this.makeCompoundList(r)}}testCommand(){let e=this.tok.next(T.CommandStart).pos,t=this.parseTestOr(),n=this.acceptEnd(h.DblRBracket,T.TestMode);if(n<0)this.error("expected ']]' to close '[['",this.tok.getPos());let r=n>=0?n:e;return this._redirects=this.collectTrailingRedirects(),{type:"TestCommand",pos:e,end:r,expression:t}}parseTestOr(){let e=this.parseTestAnd();while(this.tok.peek(T.TestMode).token===h.Or){this.tok.next(T.TestMode);let t=this.parseTestAnd();e={type:"TestLogical",pos:e.pos,end:t.end,operator:"||",left:e,right:t}}return e}parseTestAnd(){let e=this.parseTestNot();while(this.tok.peek(T.TestMode).token===h.And){this.tok.next(T.TestMode);let t=this.parseTestNot();e={type:"TestLogical",pos:e.pos,end:t.end,operator:"&&",left:e,right:t}}return e}parseTestNot(){let e=this.tok.peek(T.TestMode);if(!LI(e))return this.parseTestPrimary();let t=this.tok.next(T.TestMode).pos;if(e=this.tok.peek(T.TestMode),!LI(e)){let o=this.parseTestPrimary();return{type:"TestNot",pos:t,end:o.end,operand:o}}let n=[t];while(LI(e))n.push(this.tok.next(T.TestMode).pos),e=this.tok.peek(T.TestMode);let r=this.parseTestPrimary();for(let o=n.length-1;o>=0;o--)r={type:"TestNot",pos:n[o],end:r.end,operand:r};return r}parseTestPrimary(){if(this.tok.peek(T.TestMode).token===h.LParen){let i=this.tok.next(T.TestMode).pos;if(this.syntaxDepth===xn){this.error("maximum test group nesting depth exceeded",i);let l=this.tok.skipTestGroup();if(l<0)this.error("expected ')' to close test group",this.tok.getPos());let f=l>=0?l:i,d=new tn("",i,i,this.source,void 0,this.depth);return{type:"TestGroup",pos:i,end:f,expression:{type:"TestUnary",pos:i,end:i,operator:"-n",operand:d}}}this.syntaxDepth++;let a=this.parseTestOr();this.syntaxDepth--;let c=this.acceptEnd(h.RParen,T.TestMode);if(c<0)this.error("expected ')' to close test group",this.tok.getPos());let u=c>=0?c:i;return{type:"TestGroup",pos:i,end:u,expression:a}}let e=this.tok.next(T.TestMode),t=e.value,n=e.pos,r=e.end;if(e.keywordEligible&&Hte[t]===1){if(this.tok.peek(T.TestMode).token===h.Word){let a=this.readWord(T.TestMode);return{type:"TestUnary",pos:n,end:a.end,operator:t,operand:a}}}let o=this.tok.peek(T.TestMode);if(o.token===h.Word&&o.keywordEligible&&Wte[o.value]===1){let i=this.tok.next(T.TestMode).value,a;if(i==="=~"){let u=this.tok.readTestRegexWord();a=new tn(this.source.slice(u.pos,u.end),u.pos,u.end,this.source,Cy,this.depth)}else a=this.readWord(T.TestMode);let c=this.toWordFromPosEnd(e,n,r);return{type:"TestBinary",pos:n,end:a.end,operator:i,left:c,right:a}}let s=this.toWordFromPosEnd(e,n,r);return{type:"TestUnary",pos:n,end:s.end,operator:"-n",operand:s}}functionDef(){let e=this.tok.next(T.CommandStart).pos,t=this.readWord(T.Normal),n;if(this.tok.peek(T.CommandStart).token===h.LParen){let s=this.tok.next(T.CommandStart).pos;if(this.tok.peek(T.CommandStart).token===h.RParen)this.tok.next(T.CommandStart),this.skipNewlines(T.CommandStart),n=this.commandAsBody();else n=this.subshellBody(s)}else this.skipNewlines(T.CommandStart),n=this.commandAsBody();let r=this._redirects;this._redirects=vo;let o=r.length>0?r[r.length-1].end:n.end;return{type:"Function",pos:e,end:o,name:t,body:n,redirects:hm(r)}}simpleCommandOrFunction(){let e=[],t=[],n=this.tok.peek(T.CommandStart).pos,r=n,o=T.CommandStart;for(;;){let a=this.tok.peek(o).token;if(a===h.Assignment){let c=this.tok.next(o);r=c.end,e.push(this.parseAssignment(c))}else if(a===h.Redirect)t=this.collectRedirect(t,o),r=t[t.length-1].end;else break;o=T.CommandPrefix}if(this.tok.peek(T.Normal).token!==h.Word)return{type:"Command",pos:n,end:r,name:void 0,prefix:e,suffix:[],redirects:t};let s=this.readWord(T.Normal);if(r=s.end,this.tok.peek(T.Normal).token===h.LParen){if(this.tok.next(T.Normal),this.tok.peek(T.Normal).token===h.RParen){this.tok.next(T.Normal),this.skipNewlines(T.CommandStart);let a=this.commandAsBody(),c=this._redirects;this._redirects=vo;let u=c.length>0?c[c.length-1].end:a.end;return{type:"Function",pos:s.pos,end:u,name:s,body:a,redirects:hm(c)}}}let i=[];for(;;){let a=this.tok.peek(T.Normal).token;if(a===h.Word||a===h.Assignment){let c=this.readWord(T.Normal);i.push(c),r=c.end}else if(a===h.Redirect)t=this.collectRedirect(t,T.Normal),r=t[t.length-1].end;else break}return{type:"Command",pos:n,end:r,name:s,prefix:e,suffix:i,redirects:t}}collectRedirect(e,t){if(e===vo)e=[];let n=this.tok.next(t),r=n.pos,o=n.end,s={pos:r,end:o,operator:Bte[n.value]??">",target:void 0,fileDescriptor:n.fileDescriptor,variableName:n.variableName,content:n.content,heredocQuoted:void 0,body:void 0};if(n.targetEnd>n.targetPos){let a=n.value==="<<"||n.value==="<<-"?jte(n.content??""):void 0,c=this.source.slice(n.targetPos,n.targetEnd);s.target=new tn(c,n.targetPos,n.targetEnd,this.source,a,this.depth)}else this.error("expected redirect target",n.targetPos);if(s.target&&(n.value==="<<"||n.value==="<<-"))this.tok.registerHereDocTarget(s);return e.push(s),e}commandAsBody(){let e=this.tok.peek(T.CommandStart).token;if(e===h.LBrace)return this.braceGroup();if(e===h.LParen)return this.subshell();let t=this.command(),n=this.tok.getPos();return t??{type:"CompoundList",pos:n,end:n,commands:[]}}readWord(e){return this.toWord(this.tok.next(e))}toWord(e){let t=e.raw?e.value:this.source.slice(e.pos,e.end);return new tn(t,e.pos,e.end,this.source,void 0,this.depth)}toWordFromPosEnd(e,t,n){let r=e.raw&&e.pos===t&&e.end===n?e.value:this.source.slice(t,n);return new tn(r,t,n,this.source,void 0,this.depth)}parseAssignment(e){let t=e.raw?e.value:this.source.slice(e.pos,e.end),n=e.pos,r=e.end,o={type:"Assignment",pos:n,end:r,text:t,name:void 0,value:void 0,append:void 0,index:void 0,indexParts:void 0,array:void 0},s=e.assignmentOperatorPos-n;if(s<=0)return o;let i=s,a=!1,c,u=s;while(u>=2&&t.charCodeAt(u-2)===92&&t.charCodeAt(u-1)===10)u-=2;if(t.charCodeAt(u-1)===43)a=!0,i=u-1;let l=t.indexOf("[");if(l>0&&l<i){let b=t.lastIndexOf("]",s);if(b>l)c=t.slice(l+1,b),i=l}let f=t.slice(0,i),d=f.includes("\\\n")?f.split("\\\n").join(""):f;if(o.name=d,a)o.append=!0;if(c!==void 0){o.index=c;let b=n+l+1,E=b+c.length;if(Da(this.source,b,E)){let w=new tn(c,b,E,this.source,Cy,this.depth);Object.defineProperty(o,"indexParts",{configurable:!0,enumerable:!0,get:()=>w.parts,set:(k)=>{w.parts=k}})}}let m=s+1,y=n+m;if(m<t.length&&t.charCodeAt(m)===40&&t.charCodeAt(t.length-1)===41){let b=this.parseArrayElements(y+1,r-1);o.array=b}else o.value=new tn(t.slice(m),y,r,this.source,void 0,this.depth);return o}parseArrayElements(e,t){let n=new es(this.source,e,t),r=[];while(n.peek(T.Normal).token!==h.EOF){if(n.peek(T.Normal).token===h.Newline){n.next(T.Normal);continue}let o=n.next(T.Normal);if(o.token===h.Word||o.token===h.Assignment){let s=o.raw?o.value:this.source.slice(o.pos,o.end);r.push(new tn(s,o.pos,o.end,this.source,void 0,this.depth))}}return r}makeCompoundList(e){let t=this.tok.getPos(),n=e.length>0?e[0].pos:t,r=e.length>0?e[e.length-1].end:t;return{type:"CompoundList",pos:n,end:r,commands:e}}}var Lte,Bte,Kn,Ri,yn,Hte,Wte,vo;var UI=v(()=>{DI();MI();xH();tn._resolveWord=hH;tn._resolveHeredocBody=gH;Lte={[h.DoubleSemi]:";;",[h.SemiAmp]:";&",[h.DoubleSemiAmp]:";;&"},Bte={">":">",">>":">>","<":"<","<<":"<<","<<-":"<<-","<<<":"<<<","<>":"<>","<&":"<&",">&":">&",">|":">|","&>":"&>","&>>":"&>>"};Kn=new Uint8Array(37);Kn[h.EOF]=1;Kn[h.RParen]=1;Kn[h.RBrace]=1;Kn[h.Then]=1;Kn[h.Else]=1;Kn[h.Elif]=1;Kn[h.Fi]=1;Kn[h.Do]=1;Kn[h.Done]=1;Kn[h.Esac]=1;Kn[h.DoubleSemi]=1;Kn[h.SemiAmp]=1;Kn[h.DoubleSemiAmp]=1;Ri=new Uint8Array(37);Ri[h.RParen]=1;Ri[h.RBrace]=1;Ri[h.DblRBracket]=1;Ri[h.Fi]=1;Ri[h.Done]=1;Ri[h.Esac]=1;Ri[h.ArithCmd]=1;yn=new Uint8Array(37);yn[h.Word]=1;yn[h.Assignment]=1;yn[h.Bang]=1;yn[h.LParen]=1;yn[h.LBrace]=1;yn[h.DblLBracket]=1;yn[h.If]=1;yn[h.For]=1;yn[h.While]=1;yn[h.Until]=1;yn[h.Case]=1;yn[h.Function]=1;yn[h.Select]=1;yn[h.ArithCmd]=1;yn[h.Coproc]=1;yn[h.Redirect]=1;Hte={"-a":1,"-b":1,"-c":1,"-d":1,"-e":1,"-f":1,"-g":1,"-h":1,"-k":1,"-p":1,"-r":1,"-s":1,"-t":1,"-u":1,"-v":1,"-w":1,"-x":1,"-z":1,"-n":1,"-o":1,"-N":1,"-S":1,"-L":1,"-G":1,"-O":1,"-R":1},Wte={"==":1,"!=":1,"=~":1,"=":1,"-eq":1,"-ne":1,"-lt":1,"-le":1,"-gt":1,"-ge":1,"-nt":1,"-ot":1,"-ef":1,"<":1,">":1};vo=[]});var tu=(e)=>({start:e.pos,end:e.end}),Ua=(e)=>{let t=e.lastIndexOf("/");return t===-1?e:e.slice(t+1)},uf=(e)=>{if(e.name===void 0||e.prefix.length>0||e.redirects.length>0||!_i(e.name)||e.suffix.some((t)=>!_i(t)))return null;return[e.name,...e.suffix].map((t)=>({source:t.text,value:t.value,kind:"literal",range:tu(t),quoted:(t.parts??[]).some((n)=>n.type==="SingleQuoted"||n.type==="DoubleQuoted"||n.type==="AnsiCQuoted"||n.type==="LocaleString")}))};var Ay=v(()=>{tf()});var La,bH,SH,HI=(e,t,n)=>{let r=t;while(r<e.length){let o=e[r]?.value;if(o===void 0)break;if(n.has(o))r+=2;else if(o.includes("=")&&n.has(o.slice(0,o.indexOf("="))))r+=1;else if(o==="--")return r+1;else if(o.startsWith("-")&&o!=="-")r+=1;else break}return r},Ty=(e)=>{let t=Object.hasOwn(SH,e.head)?SH[e.head]??new Set:new Set,n=HI(e.words,1,t);if(e.head==="env")while(/^[A-Za-z_][A-Za-z0-9_]*=/u.test(e.words[n]?.value??""))n+=1;return n},lf=(e,t)=>{for(let n=1;n<e.length-1;n+=1){let r=e[n]?.value;if(r!==void 0&&(r===`-${t}`||r.startsWith("-")&&!r.startsWith("--")&&r.slice(1).includes(t)))return n+1}return null},_y=(e,t,n=1)=>{for(let r=n;r<e.length;r+=1){let o=e[r]?.value;if(o!==void 0){if(t.has(o))return r+1<e.length?r+1:null;for(let s of t)if(o.startsWith(`${s}=`))return r}}return null},qte,zte=(e)=>e==="/"||e==="~"||e==="."||e===".."||e.startsWith("/")||e.startsWith("~/")||e.startsWith("./")||e.startsWith("../")||/^\$\{?HOME\}?(?:\/|$)/u.test(e),EH=(e)=>{if(e==="/")return 100;if(e==="~"||/^\$\{?HOME\}?(?:\/|$)/u.test(e))return 90;if(/^\/(?:etc|usr|bin|sbin|System|Library|var|boot|root|home)(?:\/|$)/u.test(e))return 80;if(e.startsWith("/Users/"))return 70;if(e.startsWith("/"))return 60;if(e.startsWith("../"))return 40;return 10},wH=(e,t,n)=>{let r=[];for(let o=1;o<t;o+=1){let s=e[o];if(s!==void 0&&n==="fd"&&qte.has(s.value))o+=1;else if(s?.value.startsWith("-")===!0){if(n==="find")break}else if(s!==void 0&&zte(s.value))r.push(s)}return r.sort((o,s)=>EH(s.value)-EH(o.value)),r[0]??{source:".",value:".",kind:"literal",range:e[0]?.range??{start:0,end:0},quoted:!1}},WI,kH,CH,vH,IH,jI;var Oy=v(()=>{La=new Set(["sh","bash","zsh","dash","ksh","ash"]),bH=new Set(["command","exec","env","time","nohup","setsid","nice","ionice","chronic","stdbuf","unbuffer","taskset","sudo","doas","xargs","watch"]),SH={env:new Set(["-u","--unset","-C","--chdir","-S","--split-string","--block-signal"]),time:new Set(["-f","--format","-o","--output"]),nice:new Set(["-n","--adjustment"]),ionice:new Set(["-c","--class","-n","--classdata","-p","--pid"]),stdbuf:new Set(["-i","--input","-o","--output","-e","--error"]),sudo:new Set(["-u","--user","-g","--group","-C","--close-from","-D","--chdir","-h","--host","-p","--prompt","-r","--role","-t","--type","-U","--other-user","-R","--chroot","-T","--command-timeout"]),doas:new Set(["-a","-C","-u"]),xargs:new Set(["-I","-i","-J","-n","--max-args","-P","--max-procs","-s","--max-chars","-L","--max-lines","-E","--eof","-d","--delimiter","-a","--arg-file","--replace"]),watch:new Set(["-n","--interval"])},qte=new Set(["-e","--extension","-t","--type","-E","--exclude","-d","--max-depth","--min-depth","--exact-depth","-c","--color","--changed-within","--changed-before","-S","--size","-o","--owner","-j","--threads","-g","--glob","--format","--max-results","--ignore-file","--search-path","--base-directory","--path-separator","--and"]),WI=new Set(["-x","-X","--exec","--exec-batch"]),kH=new Set(["{}","{/}","{//}","{.}","{/.}"]),CH=new Set(["-exec","-execdir","-ok","-okdir"]),vH=new Set(["{}"]),IH=new Set(["run","proxy","err","test","summary"]),jI={timeout:{valueFlags:new Set(["-s","--signal","-k","--kill-after"]),skipPositionals:1,shellFlag:!1},gtimeout:{valueFlags:new Set(["-s","--signal","-k","--kill-after"]),skipPositionals:1,shellFlag:!1},chroot:{valueFlags:new Set(["--userspec","--groups"]),skipPositionals:1,shellFlag:!1},flock:{valueFlags:new Set(["-w","--wait","--timeout","-E","--conflict-exit-code"]),skipPositionals:1,shellFlag:!0},su:{valueFlags:new Set,skipPositionals:0,shellFlag:!0}}});class qI{#t;#e;constructor(e,t){this.#e=e,this.#t=[...t].toSorted((n,r)=>r.command.length-n.command.length)}isCarrierCommand(e){let t=uf(e);return t!==null&&this.#n(t)!==null}inspect(e,t,n){let r=this.#n(e.words);if(r===null)return!1;this.#o(r.words,t,n);let o=Gte(r.words);if(o===null){if(r.words.some((u)=>u.value==="-Q"||u.value==="-V"))return!0;return this.#e.addDiagnostic("dynamic-shell-source","Tripwire cannot identify the SSH destination and remote command safely.",e.range),!0}let s=r.words.slice(o);if(s.length===0){let u=r.words.some((l)=>l.value==="-N"||l.value==="-G"||l.value==="-Q"||l.value==="-V"||l.value==="-W"||l.value.startsWith("-W"));if(!n.inspectedPipelineInput&&!u)this.#e.addDiagnostic("dynamic-shell-source","An interactive remote shell has no command source that Tripwire can inspect.",e.range);return!0}let i=s.find((u)=>u.kind!=="literal");if(i!==void 0)return this.#e.addDiagnostic("dynamic-shell-source","The remote shell command is computed at runtime.",i.range),!0;if(n.inspectedPipelineInput&&La.has(Ua(s[0]?.value??""))&&lf(s,"c")===null)return this.#e.emitSynthetic(s,e,t,{...n,inspectedPipelineInput:!0}),!0;let[a]=s,c=s.at(-1);if(a!==void 0&&c!==void 0){let u=s.map((l)=>l.value).join(" ");this.#e.inspectShellSource({source:u,value:u,kind:"literal",range:{start:a.range.start,end:c.range.end},quoted:!0},t,{...n,inspectedPipelineInput:!1})}return!0}#n(e){let[t]=e;if(t!==void 0&&Ua(t.value)==="ssh")return{kind:"ssh",words:e};for(let n of this.#t)if(n.command.every((r,o)=>e[o]?.value===r)&&n.command.length<=e.length){let[r]=e;if(r===void 0)return null;return{kind:n.equivalentTo,words:[{...r,source:n.equivalentTo,value:n.equivalentTo},...e.slice(n.command.length)]}}return null}#o(e,t,n){for(let r=1;r<e.length;r+=1){let o=Kte(e,r);if(r=o.nextIndex,o.opaqueConfig!==void 0)this.#e.addDiagnostic("dynamic-shell-source","An explicit SSH configuration file may contain executable commands that Tripwire has not inspected.",o.opaqueConfig.range);else if(o.source!==void 0)this.#e.inspectShellSource(o.source,t,{...n,inspectedPipelineInput:!1})}}}var Vte,Kte=(e,t)=>{let n=e[t];if(n===void 0)return{nextIndex:t,opaqueConfig:void 0,source:void 0};if(n.value==="-F"||n.value.startsWith("-F"))return{nextIndex:n.value==="-F"?t+1:t,opaqueConfig:n,source:void 0};let r=t,o;if(n.value==="-o")r+=1,o=e[r];else if(n.value.startsWith("-o"))o={...n,source:n.source.slice(2),value:n.value.slice(2)};let s=o===void 0?null:/^(?<key>[A-Za-z]+)(?:=|\s+)(?<source>[\s\S]+)$/u.exec(o.value),i=s?.groups?.key?.toLowerCase(),a=s?.groups?.source,c=o!==void 0&&a!==void 0&&a!=="none"&&i!==void 0&&["localcommand","proxycommand","remotecommand"].includes(i)?{...o,source:a,value:a}:void 0;return{nextIndex:r,opaqueConfig:void 0,source:c}},Gte=(e)=>{let t=1;while(t<e.length){let r=e[t];if(r?.kind!=="literal")return null;if(r.value==="--"){t+=1;break}if(Vte.has(r.value)){if(e[t+1]?.kind!=="literal")return null;t+=2}else if(r.value.startsWith("-")&&r.value!=="-")t+=1;else break}return e[t]?.kind==="literal"?t+1:null};var AH=v(()=>{Ay();Oy();Vte=new Set(["-B","-b","-c","-D","-E","-e","-F","-I","-i","-J","-L","-l","-m","-O","-o","-p","-Q","-R","-S","-W","-w"])});class zI{#t;#e;constructor(e,t){this.#e=e,this.#t=t}inspect(e,t,n){let r=new Set;return this.#n(e,t,n,r),this.#o(e,t,n,r),r}#n(e,t,n,r){for(let o=0;o<e.length-1;o+=1){let s=e[o],i=e[o+1];if(s?.type==="Command"&&i?.type==="Command"&&i.name!==void 0&&La.has(Ua(i.name.value))){for(let a of s.redirects)if((a.operator==="<<"||a.operator==="<<-")&&a.content!==void 0)this.#e.inspectShellSource({source:a.content,value:a.content,kind:"literal",range:tu(a),quoted:a.heredocQuoted===!0},t,n),r.add(o+1)}}}#o(e,t,n,r){for(let o=0;o<e.length-2;o+=1){let s=e[o],i=e[o+1],a=e[o+2];if(s?.type==="Command"&&i?.type==="Command"&&a?.type==="Command"&&this.#i(a)){let c=Jte(s,i),u=c===null?null:Qte(c);if(u!==null)this.#e.inspectShellSource({source:u,value:u,kind:"literal",range:tu(s),quoted:!0},t,n),r.add(o+2)}}}#i(e){let t=uf(e);if(t===null)return!1;if(La.has(Ua(t[0]?.value??"")))return lf(t,"c")===null;return this.#t.isCarrierCommand(e)}}var Jte=(e,t)=>{let n=uf(e),r=uf(t);if(n===null||r===null||Ua(r[0]?.value??"")!=="base64"||r.length!==2||!["-d","-D","--decode"].includes(r[1]?.value??""))return null;let o=Ua(n[0]?.value??""),s=n.slice(1).map((i)=>i.value);if(o==="printf"&&s.length===2){let[i,a]=s;return i==="%s"||i===String.raw`%s\n`?a??null:null}if(o==="echo"){let i=s.filter((a)=>a!=="-n");return i.length===1?i[0]??null:null}return null},Qte=(e)=>{if(e.length===0||e.length>1048576||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u.test(e))return null;let t=Buffer.from(e,"base64");if(t.toString("base64")!==e||t.includes(0))return null;try{return new TextDecoder("utf-8",{fatal:!0}).decode(t)}catch{return null}};var TH=v(()=>{Ay();Oy()});class VI{#t;#e;#n;constructor(e,t){this.#e=e,this.#t=new qI(e,t),this.#n=new zI(e,this.#t)}inspectShellInput(e,t,n,r){if(!La.has(e.head))return!1;let o=r.inspectedPipelineInput;for(let[s,i]of t.entries())if((i.operator==="<<"||i.operator==="<<-")&&i.content!==void 0){let a={source:i.content,value:i.content,kind:"literal",range:tu(i),quoted:i.heredocQuoted===!0};this.#e.inspectShellSource(a,n,r),o=!0}else if(i.operator==="<<<")this.#e.inspectShellSource(e.redirects[s]?.target,n,r),o=!0;else if(i.operator==="<")this.#e.addDiagnostic("dynamic-shell-source","A shell wrapper reads program source from a file that Tripwire has not inspected.",tu(i));return o}inspectWrapper(e,t,n,r=!1){if(e.head==="eval"||this.#t.inspect(e,t,n)||this.#o(e,t,n,r)||this.#i(e,t,n))return;this.#f(e,t,n)}inspectPipelineInputs(e,t,n){return this.#n.inspect(e,t,n)}#o(e,t,n,r){if(!La.has(e.head))return!1;let o=lf(e.words,"c");if(o!==null)return this.#e.inspectShellSource(e.words[o],t,n),!0;if(!(r||e.tokens.includes("-n")||e.tokens.includes("--noexec")||e.tokens.includes("--help")||e.tokens.includes("--version")))this.#e.addDiagnostic("dynamic-shell-source","A shell wrapper has no inline program source that Tripwire can inspect.",e.range);return!0}#i(e,t,n){switch(e.head){case"trap":return this.#p(e,t,n),!0;case"script":{let r=_y(e.words,new Set(["-c","--command"]));if(r!==null)this.#e.inspectShellSource(e.words[r],t,n);return!0}case"watch":return this.#m(e,t,n),!0;case"xargs":return this.#d(e,t,n),!0;default:return!1}}#m(e,t,n){let r=Ty(e),o=e.words.slice(r);if(e.tokens.includes("-x")||e.tokens.includes("--exec")){this.#e.emitSynthetic(o,e,t,n);return}let[s]=o,i=o.at(-1),a=o.find((c)=>c.kind==="dynamic");if(a!==void 0){this.#e.addDiagnostic("dynamic-shell-source","watch receives command text that is computed at runtime.",a.range);return}if(s!==void 0&&i!==void 0){let c=o.map((u)=>u.value).join(" ");this.#e.inspectShellSource({source:c,value:c,kind:"literal",range:{start:s.range.start,end:i.range.end},quoted:!0},t,n)}}#f(e,t,n){if(bH.has(e.head)){let r=Ty(e);this.#e.emitSynthetic(e.words.slice(r),e,t,n)}else if(e.head==="fd"||e.head==="fdfind")this.#a(e,WI,kH,t,n);else if(e.head==="find"||e.head==="gfind")this.#a(e,CH,vH,t,n);else if(e.head==="rtk")this.#u(e,t,n);else{let r=Object.hasOwn(jI,e.head)?jI[e.head]:void 0;if(r!==void 0)this.#y(e,r,t,n)}}#p(e,t,n){let[,r,o]=e.words,s=r?.value==="--"?o:r;if(s===void 0||s.value===""||s.value==="-"||s.value==="-p"||s.value==="-l")return;this.#e.inspectShellSource(s,t,n)}#d(e,t,n){let r=Ty(e),o=e.words.slice(r),s=o[0]??{kind:"literal",quoted:!1,range:e.range,source:"echo",value:"echo"},i={kind:"dynamic",quoted:!1,range:e.range,source:"<xargs-input>",value:Zc};this.#e.emitSynthetic([s,...o.slice(1),i],e,t,n)}#a(e,t,n,r,o){for(let s=1;s<e.words.length;s+=1){let i=e.words[s];if(i!==void 0&&t.has(i.value)){let a=[],c=wH(e.words,s,t===WI?"fd":"find");for(let u=s+1;u<e.words.length;u+=1){let l=e.words[u];if(l===void 0||l.value===";"||l.value==="+")break;a.push(n.has(l.value)?c:l)}this.#e.emitSynthetic(a,e,r,o)}}}#u(e,t,n){let r=1;while(e.words[r]?.value.startsWith("-")===!0)r+=1;let o=e.words[r]?.value;if(o===void 0)return;if(IH.has(o)){let s=_y(e.words,new Set(["-c","--command"]),r+1);if(s!==null){this.#e.inspectShellSource(e.words[s],t,n);return}this.#e.emitSynthetic(e.words.slice(r+1),e,t,n);return}this.#e.emitSynthetic(e.words.slice(r),e,t,n)}#y(e,t,n,r){if(t.shellFlag){let s=_y(e.words,new Set(["-c","--command"]));if(s!==null){this.#e.inspectShellSource(e.words[s],n,r);return}}let o=HI(e.words,1,t.valueFlags);o+=t.skipPositionals,this.#e.emitSynthetic(e.words.slice(o),e,n,r)}}var _H=v(()=>{AH();TH();Ay();tf();Oy()});class PH{#t;#e=[];#n=[];#o=[];#i=[];#m=new WeakSet;#f=new Set;#p=new Set;#d=[];#a;#u;#y=1;#E=1;constructor(e,t){this.#t=e,this.#u=t,this.#a=new VI({addDiagnostic:(n,r,o)=>{this.#c(n,r,o)},emitSynthetic:(n,r,o,s)=>{this.#v(n,r,o,s)},inspectShellSource:(n,r,o)=>{this.#N(n,r,o)}},t.executionCarrierAliases??[])}analyze(e){let t=TI(),n=(r,o)=>{t.bindings.set(r,{source:o,value:o,kind:"literal",range:{start:0,end:0},quoted:!0,variable:r})};if(this.#u.cwd!==void 0)n("PWD",this.#u.cwd);for(let[r,o]of(this.#u.positionalArguments??[]).entries())n((r+1).toString(),o);return this.#g(e,t,{inspectedPipelineInput:!1,source:this.#t,pipeline:void 0}),{source:this.#t,invocations:this.#e,redirects:this.#n,diagnostics:this.#o,hasBypass:this.#U()}}#c(e,t,n){this.#o.push({kind:e,message:t,range:n})}#g(e,t,n){if(this.#m.has(e))return;this.#m.add(e);let r=e.source??n.source;for(let o of e.errors??[])this.#c("parse-error",o.message,{start:o.pos,end:o.pos});this.#b(e.commands,t,{...n,source:r})}#b(e,t,n){for(let r of e)this.#w(r,t,n)}#w(e,t,n){if(this.#S(e.redirects,t,n),this.#s(e.command,t,n),e.background===!0)t.backgroundPidAvailable=!0}#s(e,t,n){if(this.#I(e,t,n)||this.#A(e,t,n)||this.#T(e,t,n))return;this.#c("parse-error",`Unknown Bash AST node: ${e.type}`,ts(e))}#I(e,t,n){if(e.type==="Statement")return this.#w(e,t,n),!0;if(e.type==="Command")return this.#_(e,t,n),!0;if(e.type==="CompoundList")return this.#b(e.commands,t,n),!0;if(e.type==="Pipeline"){let r=this.#E;this.#E+=1;let o=this.#a.inspectPipelineInputs(e.commands,t,n);for(let[s,i]of e.commands.entries())this.#s(i,ln(t),{...n,inspectedPipelineInput:o.has(s),pipeline:{id:r,index:s}});return!0}if(e.type==="AndOr"){let r=ln(t);for(let o of e.commands)this.#s(o,r,n);return GI(t,KI([t,r])),!0}return!1}#A(e,t,n){if(e.type==="If"){let r=ln(t);this.#s(e.clause,r,n);let o=ln(r);this.#s(e.then,o,n);let s=ln(r);if(e.else!==void 0)this.#s(e.else,s,n);return GI(t,KI([o,s])),!0}if(e.type==="For"||e.type==="Select"){let r=this.#r(e.name,t,n),o=e.wordlist.map((s)=>this.#r(s,t,n));if(r.kind==="literal"&&/^[A-Za-z_][A-Za-z0-9_]*$/u.test(r.value)&&o.length>0&&o.length<=32&&o.every((s)=>s.kind==="literal"))for(let s of o){let i=ln(t);i.temps.delete(r.value),i.bindings.set(r.value,s),this.#s(e.body,i,n)}else{let s=ln(t);s.temps.delete(r.value),s.bindings.delete(r.value),this.#s(e.body,s,n)}return!0}if(e.type==="ArithmeticFor")return this.#l(e.initialize,t,n),this.#l(e.test,t,n),this.#l(e.update,t,n),this.#s(e.body,ln(t),n),!0;if(e.type==="While"){let r=ln(t);return this.#s(e.clause,r,n),this.#s(e.body,r,n),!0}if(e.type==="Function"){let r=this.#r(e.name,t,n);if(r.kind!=="literal"||!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(r.value))this.#c("function","The function name is not static.",ts(e));else t.functions.set(r.value,e);return!0}return!1}#T(e,t,n){if(e.type==="Subshell")return this.#s(e.body,ln(t),n),!0;if(e.type==="BraceGroup")return this.#s(e.body,t,n),!0;if(e.type==="Case"){this.#r(e.word,t,n);let r=[ln(t)];for(let o of e.items){for(let i of o.pattern)this.#r(i,t,n);let s=ln(t);this.#s(o.body,s,n),r.push(s)}return GI(t,KI(r)),!0}if(e.type==="Coproc"){if(e.name!==void 0)this.#r(e.name,t,n);return this.#S(e.redirects,t,n),this.#s(e.body,ln(t),n),!0}if(e.type==="TestCommand")return this.#x(e.expression,t,n),!0;if(e.type==="ArithmeticCommand")return this.#l(e.expression,t,n),!0;return!1}#_(e,t,n){let r=e.prefix.flatMap((u)=>{let l=this.#O(u,t,n);return l===null?[]:[l]});if(e.name===void 0)for(let u of r)OH(u,t);let o=this.#S(e.redirects,t,n);if(e.name===void 0)return;let s=this.#r(e.name,t,n),i=e.suffix.flatMap((u)=>this.#k(u,t,n));if(s.kind==="literal"&&t.functions.has(s.value)){this.#R(s.value,i,r,t,n);return}if(s.kind==="literal"&&t.aliases.has(s.value)){this.#F(s.value,i,t,n,ts(e));return}let a=this.#C([s,...i],o,ts(e),n,!1);if(a===null)return;if(a.head==="alias"){this.#M(a,t);return}if(a.head==="unalias"){this.#D(a,t);return}let c=this.#a.inspectShellInput(a,e.redirects,t,n);this.#a.inspectWrapper(a,t,n,c),this.#$(a,t)}#O(e,t,n){for(let i of e.indexParts??[])this.#h(i,t,n);for(let i of e.array??[])this.#r(i,t,n);let r=e.value===void 0?void 0:this.#r(e.value,t,n);if(e.name===void 0)return null;let o=e.append!==!0&&e.index===void 0&&e.array===void 0&&e.value!==void 0&&eH(e.value,t);return{binding:Xte(e,r,t)?r:void 0,name:e.name,trustedTemp:o}}#k(e,t,n){let r=this.#r(e,t,n);if(r.kind!=="literal"||r.quoted||!/[*?[]/u.test(r.value))return[r];try{let o=[...new Bun.Glob(r.value).scanSync({onlyFiles:!1,dot:!0})];if(o.length===0)return[r];let s=[];for(let i of o)s.push({source:r.source,value:i,kind:r.kind,range:r.range,quoted:r.quoted});return s}catch{return[r]}}#r(e,t,n){for(let a of e.parts??[])this.#h(a,t,n);let r=rH(e,t);if(r!==null)return r;let o=RI(e,t);if(o!==null)return o;let s=PI(e,t);if(s!==null)return s;if(_i(e))return{source:e.text,value:e.value,kind:"literal",range:ts(e),quoted:(e.parts??[]).some((a)=>_I(a))};let i=OI(e,t);if(i!==null)return{source:e.text,value:i,kind:"literal",range:ts(e),quoted:!0};return{source:e.text,value:e.value,kind:"dynamic",range:ts(e),quoted:(e.parts??[]).some((a)=>_I(a))}}#h(e,t,n){switch(e.type){case"Literal":case"SingleQuoted":case"AnsiCQuoted":case"SimpleExpansion":return;case"DoubleQuoted":case"LocaleString":{for(let r of e.parts)this.#h(r,t,n);return}case"ParameterExpansion":{this.#P(e,t,n);return}case"CommandExpansion":case"ProcessSubstitution":{if(e.script!==void 0)this.#g(e.script,ln(t),n);return}case"ArithmeticExpansion":{this.#l(e.expression,t,n);return}case"ExtendedGlob":case"BraceExpansion":{for(let r of e.parts??[])this.#h(r,t,n);break}default:break}}#P(e,t,n){for(let r of e.indexParts??[])this.#h(r,t,n);if(e.operand!==void 0)this.#r(e.operand,t,n);if(e.slice!==void 0){if(this.#r(e.slice.offset,t,n),e.slice.length!==void 0)this.#r(e.slice.length,t,n)}if(e.replace!==void 0)this.#r(e.replace.pattern,t,n),this.#r(e.replace.replacement,t,n)}#l(e,t,n){if(e===void 0)return;switch(e.type){case"ArithmeticBinary":{this.#l(e.left,t,n),this.#l(e.right,t,n);return}case"ArithmeticUnary":{this.#l(e.operand,t,n);return}case"ArithmeticTernary":{this.#l(e.test,t,n),this.#l(e.consequent,t,n),this.#l(e.alternate,t,n);return}case"ArithmeticGroup":{this.#l(e.expression,t,n);return}case"ArithmeticWord":{for(let r of e.parts??[])this.#h(r,t,n);return}case"ArithmeticCommandExpansion":{if(e.script!==void 0)this.#g(e.script,ln(t),n);break}default:break}}#x(e,t,n){switch(e.type){case"TestUnary":{this.#r(e.operand,t,n);return}case"TestBinary":{this.#r(e.left,t,n),this.#r(e.right,t,n);return}case"TestLogical":{this.#x(e.left,t,n),this.#x(e.right,t,n);return}case"TestNot":{this.#x(e.operand,t,n);return}case"TestGroup":{this.#x(e.expression,t,n);break}default:break}}#S(e,t,n){let r=[];for(let o of e){if(o.body!==void 0)this.#i.push(ts(o.body)),this.#r(o.body,t,n);else if(o.content!==void 0){let c=n.source.indexOf(o.content,o.end);if(c!==-1)this.#i.push({start:c,end:c+o.content.length})}let s=o.target===void 0?{source:"",value:Zc,kind:"dynamic",range:ts(o),quoted:!1}:this.#r(o.target,t,n),i;if(o.operator==="<<-")i="<<";else if(o.operator===">|")i=">";else i=o.operator;let a={op:i,target:s,range:ts(o)};r.push(a),this.#n.push(a)}return r}#C(e,t,n,r,o){let[s]=e;if(s===void 0)return null;if(s.kind!=="literal")return this.#c("dynamic-executable","The executable name is computed at runtime.",s.range),null;let i=e.map((l)=>l.value),a=i.slice(1).filter((l)=>l.startsWith("-")&&l!=="-"),c=i.slice(1).filter((l)=>!l.startsWith("-")||l==="-"),u={id:this.#y,head:Zte(s.value),words:e,tokens:i,args:c,flags:a,redirects:t,raw:o?e.map((l)=>l.source).join(" "):r.source.slice(n.start,n.end),range:n,pipeline:r.pipeline,synthetic:o};if(this.#y+=1,this.#e.push(u),u.head==="eval")this.#c("eval","`eval` can turn computed data into shell syntax.",n);return u}#R(e,t,n,r,o){let s=r.functions.get(e);if(s===void 0)return;if(this.#p.has(e)){this.#c("function",`Recursive function call: ${e}`,ts(s));return}this.#p.add(e);let i=ln(r),a=new Set(n.map((u)=>u.name));for(let u of n)OH(u,i);for(let u of i.bindings.keys())if(/^[0-9]+$/u.test(u))i.bindings.delete(u);for(let[u,l]of t.entries())i.bindings.set(String(u+1),l);let c={localNames:new Set};this.#d.push(c);try{this.#S(s.redirects,i,o),this.#s(s.body,i,o);let u=new Set([...a,...c.localNames]);for(let l of i.bindings.keys())if(/^[0-9]+$/u.test(l))u.add(l);Yte(r,i,u)}finally{this.#d.pop(),this.#p.delete(e)}}#F(e,t,n,r,o){let s=n.aliases.get(e);if(s===void 0)return;if(this.#f.has(e)){this.#c("alias",`Recursive alias expansion: ${e}`,o);return}this.#f.add(e);try{let i=cf(s),[a]=i.commands,c=a?.command;if((i.errors?.length??0)>0||i.commands.length!==1||a?.background===!0||a?.redirects.length!==0||c?.type!=="Command"||c.name===void 0||c.prefix.length>0||c.redirects.length>0){this.#g(i,ln(n),{...r,source:s,pipeline:void 0}),this.#c("alias",`Alias ${e} has compound expansion whose call arguments cannot be bound safely.`,o);return}let u={...r,source:s},l=[this.#r(c.name,n,u),...c.suffix.flatMap((d)=>this.#k(d,n,u)),...t],f={id:0,head:e,words:[],tokens:[],args:[],flags:[],redirects:[],raw:e,range:o,pipeline:r.pipeline,synthetic:!0};this.#v(l,f,n,r)}finally{this.#f.delete(e)}}#M(e,t){for(let n of e.words.slice(1))if(n.kind==="literal"){let r=n.value.indexOf("=");if(r!==-1){let o=n.value.slice(0,r);if(/^[A-Za-z_][A-Za-z0-9_]*$/u.test(o))t.aliases.set(o,n.value.slice(r+1));else this.#c("alias",`Invalid alias name: ${o}`,n.range)}}else this.#c("alias","An alias definition is computed at runtime.",n.range)}#D(e,t){if(e.tokens.includes("-a")){t.aliases.clear();return}for(let n of e.words.slice(1))if(n.kind==="literal")t.aliases.delete(n.value),this.#f.delete(n.value)}#v(e,t,n,r){let o=this.#C(e,[],t.range,{...r,pipeline:t.pipeline},!0);if(o!==null)this.#a.inspectWrapper(o,n,r,r.inspectedPipelineInput)}#N(e,t,n){if(e?.kind!=="literal"){this.#c("dynamic-shell-source","A shell wrapper receives source that is computed at runtime.",e?.range??{start:0,end:0});return}try{this.#g(cf(e.value),ln(t),{...n,inspectedPipelineInput:!1,source:e.value,pipeline:void 0})}catch(r){this.#c("parse-error",r instanceof Error?r.message:"The nested shell source could not be parsed.",e.range)}}#$(e,t){if(e.head==="export"&&e.flags.some((r)=>r==="-f"||/^-[^-]*f/u.test(r)))this.#c("function","Exported functions can execute in a nested shell outside the local call binding.",e.range);if(e.head==="unset"){for(let r of e.words.slice(1))if(/^[A-Za-z_][A-Za-z0-9_]*$/u.test(r.value))t.temps.delete(r.value),t.bindings.delete(r.value);return}if(!["export","readonly","declare","typeset","local"].includes(e.head))return;let n=this.#d.at(-1);for(let r of e.words.slice(1)){let o=/^(?<name>[A-Za-z_][A-Za-z0-9_]*)/u.exec(r.source)?.groups?.name;if(o!==void 0){if(e.head==="local")n?.localNames.add(o);t.temps.delete(o),t.bindings.delete(o)}}}#U(){let e=this.#t.split("");for(let t of this.#i)for(let n=t.start;n<t.end&&n<e.length;n+=1)if(e[n]!==`
|
|
43
|
-
`&&e[n]!=="\r")e[n]=" ";return/(?<prefix>^|\s)#\s*tripwire-allow:[ \t]*\S[^\r\n]*/u.test(e.join(""))}}var ts=(e)=>({start:e.pos,end:e.end}),Zte=(e)=>{let t=e.lastIndexOf("/");return t===-1?e:e.slice(t+1)},Py=(e)=>{let[t,...n]=e,r=new Map;if(t===void 0)return r;for(let[o,s]of t)if(n.every((i)=>i.get(o)===s))r.set(o,s);return r},KI=(e)=>{let[t,...n]=e;if(t===void 0)return TI();return{aliases:Py([t.aliases,...n.map((r)=>r.aliases)]),backgroundPidAvailable:[t,...n].every((r)=>r.backgroundPidAvailable),bindings:Py([t.bindings,...n.map((r)=>r.bindings)]),functions:Py([t.functions,...n.map((r)=>r.functions)]),temps:Py([t.temps,...n.map((r)=>r.temps)])}},GI=(e,t)=>{e.backgroundPidAvailable=t.backgroundPidAvailable,e.aliases.clear();for(let[n,r]of t.aliases)e.aliases.set(n,r);e.bindings.clear();for(let[n,r]of t.bindings)e.bindings.set(n,r);e.functions.clear();for(let[n,r]of t.functions)e.functions.set(n,r);e.temps.clear();for(let[n,r]of t.temps)e.temps.set(n,r)},Ry=(e,t,n)=>{for(let r of e.keys())if(!n.has(r)&&!t.has(r))e.delete(r);for(let[r,o]of t)if(!n.has(r))e.set(r,o)},Yte=(e,t,n)=>{Ry(e.aliases,t.aliases,new Set),Ry(e.functions,t.functions,new Set),Ry(e.bindings,t.bindings,n),Ry(e.temps,t.temps,n),e.backgroundPidAvailable=t.backgroundPidAvailable},OH=(e,t)=>{if(t.temps.delete(e.name),t.bindings.delete(e.name),e.trustedTemp)t.temps.set(e.name,{variable:e.name});else if(e.binding!==void 0)t.bindings.set(e.name,e.binding)},Xte=(e,t,n)=>{if(e.append===!0||e.index!==void 0||e.array!==void 0||e.value===void 0)return!1;if(t?.kind==="literal")return _i(e.value)||OI(e.value,n)!==null||PI(e.value,n)!==null;return t?.kind==="background-pid"&&RI(e.value,n)!==null},gm=(e,t={})=>{try{return new PH(e,t).analyze(cf(e))}catch(n){return{source:e,invocations:[],redirects:[],diagnostics:[{kind:"parse-error",message:n instanceof Error?n.message:"The Bash parser failed.",range:{start:0,end:e.length}}],hasBypass:!1}}};var RH=v(()=>{UI();_H();tf()});var ene,FH,tne=(e)=>e.startsWith("./")?e.slice(2):e,JI=(e,t=[],n=[])=>{if(e===""||e===Zc)return!1;let r=tne(e);if(r===".."||r.startsWith("../")||r.includes("/../"))return!1;for(let o of[...FH,...n])if(r===o||r.startsWith(`${o}/`))return!0;for(let o of[...ene,...t])if(r===o||r.startsWith(`${o}/`))return!0;return!1},MH=(e=[],t=[])=>{let n={"build outputs":["dist","build","_build","out","target"],"js framework outputs":[".next",".nuxt",".svelte-kit",".output",".astro",".angular",".vite",".parcel-cache",".turbo",".vercel",".netlify",".fly",".wrangler",".serverless"],"tests / coverage":["coverage",".nyc_output"],caches:[".cache",".ruff_cache",".mypy_cache",".pytest_cache",".ty_cache",".tox"],"language / package":["__pycache__",".venv","venv","node_modules",".gradle","DerivedData",".bundle",".cargo-target"],"tmp / state":["tmp",".tmp",".state",...FH],iac:[".terraform"],"bundler dev":[".yarn/cache",".yarn/install-state.gz",".pnpm-store",".bun"]};if(e.length>0)n["custom relative"]=e;if(t.length>0)n["custom absolute"]=t;return Object.entries(n).map(([r,o])=>` ${r}: ${o.join(", ")}`).join(`
|
|
44
|
-
`)};var Fy=v(()=>{tf();RH();tf();ene=["dist","build","_build","out","target",".next",".nuxt",".svelte-kit",".output",".astro",".angular",".vite",".parcel-cache",".turbo",".vercel",".netlify",".fly",".wrangler",".serverless","coverage",".nyc_output",".cache",".ruff_cache",".mypy_cache",".pytest_cache",".ty_cache",".tox","__pycache__",".venv","venv","node_modules",".gradle","DerivedData",".bundle",".cargo-target","tmp",".tmp",".state",".terraform",".yarn/cache",".yarn/install-state.gz",".pnpm-store",".bun"],FH=["/tmp","/var/tmp","/var/folders","/private/tmp","/private/var/tmp","/private/var/folders"]});var nne,rne,DH;var NH=v(()=>{vs();nne=O.Literal("ssh"),rne=O.Struct({command:O.Array(O.NonEmptyString).check(O.isMinLength(1),O.isMaxLength(16)),equivalentTo:nne}),DH=O.Struct({executionCarrierAliases:O.optional(O.Array(rne).check(O.isMaxLength(64)))})});var $H,Y=(e)=>({kind:"allow",rule:e,message:""}),Ts=(e,t)=>({kind:"warn",rule:e,message:t}),Lt=(e,t)=>({kind:"ask",rule:e,message:t}),X=(e,t)=>({kind:"deny",rule:e,message:t}),ff=(e)=>{let t=Y("none");for(let n of e)if($H[n.kind]>$H[t.kind])t=n;return t};var Gn=v(()=>{$H={allow:0,warn:1,ask:2,deny:3}});var Pn,QI,one=(e)=>Object.hasOwn(QI.fields,e),UH=(e,t)=>{let n=one(e.rule)?t[e.rule]:void 0;if(n===void 0||n===e.kind)return e;if(n==="allow")return Y(e.rule);if(n==="warn")return Ts(e.rule,e.message);if(n==="ask")return Lt(e.rule,e.message);return X(e.rule,e.message)};var ZI=v(()=>{vs();Gn();Pn=O.Literals(["allow","warn","ask","deny"]),QI=O.Struct({"brew-mutation":O.optional(Pn),"chmod-777-recursive":O.optional(Pn),"defaults-write":O.optional(Pn),"dscl-mutate":O.optional(Pn),"launchctl-mutation":O.optional(Pn),"mas-mutation":O.optional(Pn),"no-gpg-sign":O.optional(Pn),"no-verify":O.optional(Pn),osascript:O.optional(Pn),"pmset-write":O.optional(Pn),"rsync-delete":O.optional(Pn),"scutil-set":O.optional(Pn),"security-keychain-add-write":O.optional(Pn),"softwareupdate-install":O.optional(Pn),sudo:O.optional(Pn),systemsetup:O.optional(Pn),topgrade:O.optional(Pn)})});import{readFileSync as sne}from"fs";import{homedir as ine}from"os";var LH,ane,cne,une,lne,fne,dne,YI,BH,HH,pne=(e)=>e instanceof Error&&("code"in e)&&e.code==="ENOENT",mne=(e)=>B.try({try:()=>sne(e,"utf8"),catch:(t)=>new BH({cause:t})}).pipe(B.catchTag("ConfigReadError",(t)=>pne(t.cause)?B.succeed(null):B.fail(t))),hne=(e)=>B.try({try:()=>JSON.parse(e),catch:(t)=>new HH({cause:t})}),gne=(e)=>O.decodeUnknownEffect(dne)(e,{onExcessProperty:"error"}),My=()=>({git:{protectedBranches:[],enforceConventionalCommits:!1},safePaths:{},toolPolicies:[],blockedCommands:[],allowedCommands:[],ruleActions:{},secretScanner:{executable:"betterleaks",timeoutMs:5000},shell:{executionCarrierAliases:[]}}),Dy=(e)=>{let t=My();return{git:{protectedBranches:e.git?.protectedBranches??t.git.protectedBranches,enforceConventionalCommits:e.git?.enforceConventionalCommits??t.git.enforceConventionalCommits},safePaths:{...t.safePaths,...e.safePaths},toolPolicies:e.toolPolicies??t.toolPolicies,blockedCommands:e.blockedCommands??t.blockedCommands,allowedCommands:e.allowedCommands??t.allowedCommands,ruleActions:{...t.ruleActions,...e.ruleActions},secretScanner:e.secretScanner??t.secretScanner,shell:{executionCarrierAliases:e.shell?.executionCarrierAliases??t.shell.executionCarrierAliases}}},Ny=(e=YI)=>B.gen(function*(){let n=yield*mne(e);if(n===null)return{ok:!0,config:My()};let r=yield*hne(n),o=yield*gne(r);return{ok:!0,config:Dy(o)}}).pipe(B.timeout(1000),B.catchCause((t)=>{let n={ok:!1,error:Et.pretty(t)};return B.succeed(n)}));var XI=v(()=>{vs();NH();ZI();LH=O.Struct({pattern:O.String,message:O.String,action:O.optional(O.Union([O.Literal("deny"),O.Literal("ask")])),requiresFlags:O.optional(O.Array(O.String)),forbidsFlagValues:O.optional(O.Array(O.Struct({flag:O.String,values:O.Array(O.String)})))}),ane=O.Struct({protectedBranches:O.optional(O.Array(O.String)),enforceConventionalCommits:O.optional(O.Boolean)}),cne=O.Struct({relative:O.optional(O.Array(O.String)),absolute:O.optional(O.Array(O.String))}),une=O.Struct({argumentsIncludeAll:O.optional(O.Array(O.String)),argumentsStartWith:O.optional(O.Array(O.String)),shortFlagsIncludeAll:O.optional(O.Array(O.String))}),lne=O.Struct({rule:O.String,executables:O.Array(O.String),action:O.Union([O.Literal("deny"),O.Literal("warn")]),message:O.String,match:O.optional(une)}),fne=O.Struct({executable:O.String,timeoutMs:O.Finite.check(O.isGreaterThan(0))}),dne=O.Struct({git:O.optional(ane),safePaths:O.optional(cne),toolPolicies:O.optional(O.Array(lne)),blockedCommands:O.optional(O.Array(LH)),allowedCommands:O.optional(O.Array(LH)),ruleActions:O.optional(QI),secretScanner:O.optional(fne),shell:O.optional(DH)}),YI=`${ine()}/.config/tripwire/config.json`;BH=class BH extends xr.TaggedError("ConfigReadError"){};HH=class HH extends xr.TaggedError("ConfigParseError"){}});var xne,zH,n0,r0=(e)=>({kind:"cursor",eventName:e,post:n0.has(e)}),yne=(e)=>zH.has(e)||n0.has(e),nu=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),Zt=(e,...t)=>{for(let n of t){let r=e[n];if(typeof r==="string")return r}return},o0=(e,...t)=>{for(let n of t)if(n in e)return e[n];return},t0=(e,t,...n)=>{let r=Zt(e,...n);if(r!==void 0)return r;if(typeof t==="string"&&n.includes("command"))return t;return nu(t)?Zt(t,...n):void 0},WH=(e,t)=>{if(e===void 0)throw Error(`Cursor hook payload missing ${t}`);return e},Sne=(e)=>{let t=e.toLowerCase();if(t==="bash"||t==="exec"||t==="shell"||t==="run_command")return"Bash";if(t==="read"||t==="read_file")return"Read";if(t==="write"||t==="write_file")return"Write";if(t==="edit"||t==="edit_file"||t==="multiedit"||t==="apply_patch")return"Edit";return e},Ene=(e)=>e==="Read"||e==="Write"||e==="Edit",bne=(e,t)=>{let n;if(typeof e==="string")n=e;else if(nu(e))n=Zt(e,"command","cmd");if(t&&n===void 0)throw Error("Cursor hook payload missing command");if(typeof e==="string")return{command:e};if(!nu(e)||n===void 0)return e;return{...e,command:n}},wne=(e,t,n)=>{let r=Zt(t,"file_path","filePath","path");if(n&&r===void 0)throw Error(`Cursor ${e} hook payload missing file path`);if(e==="Read")return{...t,file_path:r??""};if(e==="Write"){let o=Zt(t,"content","fileText","text");if(n&&o===void 0)throw Error("Cursor Write hook payload missing content");return{...t,file_path:r??"",content:o??""}}if(e==="Edit"){let o=Zt(t,"old_string","oldString"),s=Zt(t,"new_string","newString");if(n&&(o===void 0||s===void 0))throw Error("Cursor Edit hook payload missing oldString or newString");return{...t,file_path:r??"",old_string:o??"",new_string:s??""}}return t},e0=(e,t,n=!0)=>{if(e==="Bash")return bne(t,n);if(!Ene(e))return t;if(!nu(t)){if(n)throw Error(`Cursor ${e} hook payload is missing tool input`);return t}return wne(e,t,n)},jH=(e,t)=>{if(typeof t!=="string")return t;if(e==="Bash")return{stdout:t,stderr:""};if(e==="Read")return{content:t};return{content:t}},kne=(e,t)=>{if(e==="beforeShellExecution"||e==="afterShellExecution")return"Bash";if(e==="beforeReadFile"||e==="beforeTabFileRead"||e==="afterFileEdit"||e==="afterTabFileEdit")return e.startsWith("before")?"Read":"Edit";let n=Zt(t,"tool_name","toolName");if(n!==void 0)return Sne(n);let r=o0(t,"tool_input","toolInput");if(Zt(t,"command","cmd")!==void 0||typeof r==="string"||nu(r)&&Zt(r,"command","cmd")!==void 0)return"Bash";if(Zt(t,"file_path","filePath","path")!==void 0||nu(r)&&Zt(r,"file_path","filePath","path")!==void 0)return"Read";return""},Cne=(e,t)=>{if(e==="Bash")return{command:t0(t,void 0,"command","cmd")};let n={file_path:Zt(t,"file_path","filePath","path")};if(e==="Write")return{...n,content:Zt(t,"content","fileText","text")};if(e==="Edit")return{...n,old_string:Zt(t,"old_string","oldString"),new_string:Zt(t,"new_string","newString")};return n},vne=(e,t,n,r)=>{let o=O.decodeUnknownResult(xne)(n);if(Yt.isFailure(o))throw Error("Cursor sent an invalid tool event");let s=o.success,i=o0(s,"tool_input","toolInput"),a=!r;if(e==="beforeShellExecution"||e==="afterShellExecution"){let c=t0(s,i,"command","cmd");return{command:a?WH(c,"command"):c??""}}if(e==="beforeReadFile"||e==="beforeTabFileRead"||e==="afterFileEdit"||e==="afterTabFileEdit"){let c=t0(s,i,"file_path","filePath","path");return e0(t,{file_path:a?WH(c,"file path"):c??"",...Array.isArray(s.edits)&&{edits:s.edits}},a)}if(i===void 0&&["Bash","Read","Write","Edit"].includes(t))return e0(t,Cne(t,s),a);return e0(t,i,a)},Ine=(e,t,n)=>{if(e==="afterShellExecution")return jH(t,Zt(n,"output")??"");let r=o0(n,"tool_response","toolResponse","tool_output","toolOutput","result","result_json");return jH(t,r)},qH=(e,t,n)=>{let r=kne(t,e),o=vne(t,r,e,n),s=n?Ine(t,r,e):void 0,i=Zt(e,"cwd"),a=Zt(e,"conversation_id","session_id"),c=Zt(e,"tool_use_id");return{event:{hook_event_name:n?"PostToolUse":"PreToolUse",...r.length>0&&{tool_name:r},...o!==void 0&&{tool_input:o},...s!==void 0&&{tool_response:s},...i!==void 0&&{cwd:i},...a!==void 0&&{session_id:a},...c!==void 0&&{tool_use_id:c}},host:r0(t)}},VH=(e,t)=>{if(t!==void 0&&!yne(t))throw Error(`Unknown Cursor hook event "${t}"`);if(!nu(e)){if(t!==void 0)throw Error(`Cursor ${t} hook payload must be a JSON object`);return{event:e,host:{kind:"native"}}}let n=t??Zt(e,"hook_event_name");if(n!==void 0&&zH.has(n))return qH(e,n,!1);if(n!==void 0&&n0.has(n))return qH(e,n,!0);return{event:e,host:{kind:"native"}}};var KH=v(()=>{vs();xne=O.Record(O.String,O.Unknown),zH=new Set(["preToolUse","beforeShellExecution","beforeMCPExecution","beforeReadFile","beforeTabFileRead"]),n0=new Set(["postToolUse","postToolUseFailure","afterShellExecution","afterMCPExecution","afterFileEdit","afterTabFileEdit"])});var s0,df=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),GH=(e)=>df(e)&&typeof e.command==="string",JH=(e)=>df(e)&&typeof e.file_path==="string"&&typeof e.old_string==="string"&&typeof e.new_string==="string",QH=(e)=>df(e)&&typeof e.file_path==="string"&&typeof e.content==="string",ZH=(e)=>df(e)&&typeof e.file_path==="string",YH=(e,t)=>{if(!df(t))return"";if(e==="Bash"){let n=typeof t.stdout==="string"?t.stdout:"",r=typeof t.stderr==="string"?t.stderr:"";return[n,r].filter((o)=>o.length>0).join(`
|
|
45
|
-
`)}
|
|
46
|
-
`)}catch{}};var eW=v(()=>{XH=`${_ne()}/.claude/tripwire.log`;try{Tne(One.dirname(XH),{recursive:!0})}catch{}});var Pne,pf=(e,t)=>{if(!e.hasBypass||t.kind==="allow"||Pne.has(t.rule))return t;return Y(t.rule)};var a0=v(()=>{Gn();Pne=new Set(["unsupported-shell-structure","source-script","rm-rf-root","rm-rf-home","fork-bomb","dd-raw-device","mkfs","kill-all","diskutil-destructive","tmutil-destructive","shutdown","csrutil","nvram","kextload","spctl-disable","xattr-quarantine-bypass","topgrade","softwareupdate-install","systemsetup","scutil-set","security-keychain-destructive","no-verify","no-gpg-sign","curl-pipe-shell","gh-api-mutation","gh-destructive","flyctl-destroy","gcloud-delete","git-dynamic-subcommand","git-dynamic-mutation","git-restore-discard","git-checkout-force","git-checkout-discard","git-checkout-discard-all","git-switch-force","git-reset-hard","git-force-push","git-filter","git-update-ref","git-reflog-expire","git-symbolic-ref-write"])});var Rne=(e)=>e.tokens.slice(1).join(" "),tW=(e,...t)=>{let n=new Set(e.flags);return t.some((r)=>n.has(r))},Fne,Mne,Dne=(e)=>{if(e.head==="dd")return e.words.slice(1).some((n)=>n.kind==="dynamic"&&!n.source.startsWith("if="));if(e.head==="rsync"){let n=e.words.findIndex((o)=>o.value==="--"),r=n===-1?e.words.length:n;return e.words.slice(1,r).some((o)=>o.kind==="dynamic")}if(e.head==="gh"&&e.tokens[1]==="api"){for(let n=2;n<e.words.length;n+=1){let r=e.words[n-1]?.value,o=e.words[n];if(o?.kind==="dynamic"&&(r==="--method"||r==="-X"||o.source.startsWith("-X")||o.source.startsWith("--method=")))return!0}return!1}let t=Fne.get(e.head);if(t!==void 0)return e.words.slice(1,t+1).some((n)=>n.kind==="dynamic");return Mne.has(e.head)&&e.words.slice(1).some((n)=>n.kind==="dynamic")},Nne=(e)=>{if(e.head!=="gh"||e.tokens[1]!=="api")return null;for(let t=2;t<e.tokens.length;t+=1){let n=e.tokens[t];if(n==="--method"||n==="-X")return e.tokens[t+1]?.toUpperCase()??"";if(n?.startsWith("--method=")===!0)return n.slice(9).toUpperCase();if(n?.startsWith("-X")===!0&&n.length>2)return n.slice(2).toUpperCase()}return null},$ne=(e)=>{if(e.head!=="gh"||e.tokens[1]!=="api")return!1;let t=Nne(e);if(t!==null&&["POST","PUT","PATCH","DELETE"].includes(t))return!0;return e.flags.some((n)=>n==="--input"||n.startsWith("--input=")||n==="-f"||n==="-F"||n==="--field"||n.startsWith("--field=")||n==="--raw-field"||n.startsWith("--raw-field="))},Une,nW=(e,t={})=>{let n=[];if(e.diagnostics.length>0){let r=[...new Set(e.diagnostics.map((s)=>s.message))],o=X("unsupported-shell-structure",`Tripwire cannot inspect this shell program safely: ${r.join(" ")}`);n.push(pf(e,o))}for(let r of e.invocations)if(Dne(r)){let o=X("unsupported-shell-structure",`Tripwire cannot classify computed policy arguments to \`${r.head}\` safely.`);n.push(pf(e,o))}else{let o=Une.find((s)=>s.match(r,e.source));if(o!==void 0){let s=o.action==="deny"?X(o.rule,o.message):Lt(o.rule,o.message);n.push(pf(e,UH(s,t)))}}return n.length===0?Y("bash-deny"):ff(n)};var rW=v(()=>{Gn();ZI();a0();Fne=new Map([["launchctl",1],["defaults",1],["diskutil",1],["tmutil",1],["security",1],["brew",1],["mas",1],["kmutil",1],["gh",2]]),Mne=new Set(["dd","kill","chmod","softwareupdate","pmset","dscl","xattr","spctl","systemsetup","scutil","flyctl","gcloud"]),Une=[{rule:"rm-rf-root",action:"deny",message:"rm -rf / is catastrophic. If the goal is cleaning a subdirectory, scope the path inside the project (e.g. ./dist).",match:(e)=>e.head==="rm"&&tW(e,"-rf","-fr","-Rf","-fR")&&e.tokens.includes("/")},{rule:"rm-rf-home",action:"deny",message:"rm -rf on $HOME / ~ would erase the home directory. Refuse.",match:(e)=>e.head==="rm"&&tW(e,"-rf","-fr","-Rf","-fR")&&e.tokens.some((t)=>/^(?<home>~|\$HOME|\$\{HOME\})$/u.test(t))},{rule:"fork-bomb",action:"deny",message:"Fork bomb pattern detected. Refuse.",match:(e,t)=>/:\(\)\s*\{\s*:\s*\|\s*:\s*&\s*\}\s*;/u.test(t)},{rule:"source-script",action:"deny",message:"`source` / `.` executes a file in the current shell. Refuse arbitrary sourced scripts.",match:(e)=>(e.head==="source"||e.head===".")&&e.tokens.length>1},{rule:"dd-raw-device",action:"deny",message:"dd writing to a raw block device wipes the disk. Refuse.",match:(e)=>e.head==="dd"&&/\bof=\/dev\/(?<type>disk|sd|nvme|rdisk)/iu.test(Rne(e))},{rule:"mkfs",action:"deny",message:"mkfs formats a filesystem. Refuse.",match:(e)=>/^mkfs(?<ext>\.[a-z0-9]+)?$/iu.test(e.head)},{rule:"kill-all",action:"deny",message:"kill -9 -1 kills every process you own. Refuse.",match:(e)=>e.head==="kill"&&e.tokens.includes("-9")&&e.tokens.includes("-1")},{rule:"chmod-777-recursive",action:"deny",message:"Recursive chmod 777 makes everything world-writable. Use 755 for directories, 644 for files, scoped narrowly.",match:(e)=>e.head==="chmod"&&e.flags.some((t)=>t.includes("R"))&&e.tokens.includes("777")},{rule:"no-verify",action:"deny",message:"--no-verify skips git hooks. Per policy: never skip hooks. Fix the underlying issue.",match:(e)=>e.tokens.includes("--no-verify")},{rule:"no-gpg-sign",action:"deny",message:"Bypassing GPG signing is off-limits unless explicitly requested.",match:(e,t)=>/--no-gpg-sign\b|-c\s+commit\.gpgsign=false/u.test(t)},{rule:"sudo",action:"ask",message:"sudo escalates privileges and is almost never needed in a coding session. If genuinely required, explain why; otherwise find a non-sudo path.",match:(e)=>e.head==="sudo"},{rule:"shutdown",action:"deny",message:"shutdown / reboot / halt control the machine. Refuse \u2014 system control should be done manually.",match:(e)=>["shutdown","reboot","halt","poweroff"].includes(e.head)},{rule:"launchctl-mutation",action:"deny",message:"launchctl load/unload/bootstrap/bootout/kickstart mutates system services. Refuse \u2014 surface the intent instead.",match:(e)=>e.head==="launchctl"&&typeof e.tokens[1]==="string"&&["load","unload","bootstrap","bootout","kickstart","enable","disable"].includes(e.tokens[1])},{rule:"defaults-write",action:"deny",message:"`defaults write` mutates macOS preferences. Refuse \u2014 surface the intent.",match:(e)=>e.head==="defaults"&&e.tokens[1]==="write"},{rule:"csrutil",action:"deny",message:"csrutil controls System Integrity Protection. Refuse.",match:(e)=>e.head==="csrutil"},{rule:"nvram",action:"deny",message:"nvram modifies firmware variables. Refuse.",match:(e)=>e.head==="nvram"},{rule:"diskutil-destructive",action:"deny",message:"diskutil eraseDisk / reformat / partitionDisk wipes disks. Refuse.",match:(e)=>e.head==="diskutil"&&typeof e.tokens[1]==="string"&&["eraseDisk","reformat","partitionDisk","eraseVolume","secureErase"].includes(e.tokens[1])},{rule:"tmutil-destructive",action:"deny",message:"tmutil delete / disablelocal touches Time Machine. Refuse.",match:(e)=>e.head==="tmutil"&&typeof e.tokens[1]==="string"&&["delete","disablelocal"].includes(e.tokens[1])},{rule:"osascript",action:"ask",message:"osascript runs arbitrary AppleScript and can do almost anything (move files, send emails, drive apps). Confirm with the user what you want done before running it.",match:(e)=>e.head==="osascript"},{rule:"topgrade",action:"deny",message:"topgrade upgrades everything (brew, mas, npm globals, rust, mise). System upgrades should be done manually.",match:(e)=>e.head==="topgrade"},{rule:"rsync-delete",action:"deny",message:"rsync --delete removes files at the destination. High blast radius \u2014 surface the intent instead.",match:(e)=>e.head==="rsync"&&e.flags.includes("--delete")},{rule:"softwareupdate-install",action:"deny",message:"`softwareupdate --install / -i / -d` triggers macOS system updates. Refuse \u2014 system updates should be done manually.",match:(e)=>e.head==="softwareupdate"&&e.flags.some((t)=>t==="--install"||t==="-i"||t==="-d"||t.startsWith("--download"))},{rule:"pmset-write",action:"deny",message:"`pmset` (with arguments) writes power-management settings. Read-only `pmset -g` is fine; mutations need the user.",match:(e)=>e.head==="pmset"&&e.tokens.length>1&&!e.tokens.includes("-g")&&!e.tokens.includes("-G")},{rule:"dscl-mutate",action:"deny",message:"`dscl . -create / -delete / -append / -change / -merge` modifies the local directory service (your user account, groups, etc.). Refuse.",match:(e)=>e.head==="dscl"&&e.tokens.some((t)=>["-create","-delete","-append","-change","-merge","-passwd"].includes(t))},{rule:"xattr-quarantine-bypass",action:"deny",message:"`xattr -d com.apple.quarantine` removes Gatekeeper's quarantine bit \u2014 the macOS protection against running untrusted binaries. Refuse.",match:(e)=>e.head==="xattr"&&e.tokens.includes("-d")&&e.tokens.some((t)=>t.includes("com.apple.quarantine"))},{rule:"spctl-disable",action:"deny",message:"`spctl --master-disable` / `--global-disable` disables Gatekeeper system-wide. Refuse.",match:(e)=>e.head==="spctl"&&e.flags.some((t)=>t==="--master-disable"||t==="--global-disable"||t==="--disable")},{rule:"kextload",action:"deny",message:"Loading a kernel extension (`kextload`, `kmutil load`) is a system-level mutation. Refuse \u2014 the user handles this manually.",match:(e)=>e.head==="kextload"||e.head==="kextunload"||e.head==="kmutil"&&(e.tokens[1]==="load"||e.tokens[1]==="unload")},{rule:"security-keychain-destructive",action:"deny",message:"`security delete-keychain / delete-generic-password / delete-internet-password / set-keychain-settings` mutates your Keychain (where CLIs store their secrets). Refuse \u2014 Keychain should be managed manually.",match:(e)=>e.head==="security"&&typeof e.tokens[1]==="string"&&["delete-keychain","delete-generic-password","delete-internet-password","delete-certificate","delete-identity","set-keychain-settings","unlock-keychain","lock-keychain","create-keychain"].includes(e.tokens[1])},{rule:"security-keychain-add-write",action:"ask",message:"`security add-generic-password / add-internet-password / add-certificate` writes to your Keychain. Other tools manage their own entries \u2014 confirm this is the right path before adding anything else manually.",match:(e)=>e.head==="security"&&typeof e.tokens[1]==="string"&&["add-generic-password","add-internet-password","add-certificate"].includes(e.tokens[1])},{rule:"systemsetup",action:"deny",message:"`systemsetup -set...` writes machine-wide settings (timezone, sleep, network time, restart-on-power-failure). Refuse.",match:(e)=>e.head==="systemsetup"&&e.tokens.some((t)=>t.startsWith("-set"))},{rule:"scutil-set",action:"deny",message:"`scutil --set` writes system configuration (computer name, hostname, LocalHostName). Refuse \u2014 read-only `scutil --get` is fine.",match:(e)=>e.head==="scutil"&&e.tokens.includes("--set")},{rule:"brew-mutation",action:"ask",message:"`brew install/uninstall/upgrade/untap` modifies the machine globally. Confirm before running.",match:(e)=>e.head==="brew"&&typeof e.tokens[1]==="string"&&["install","uninstall","upgrade","reinstall","untap","tap"].includes(e.tokens[1])},{rule:"mas-mutation",action:"ask",message:"`mas install/uninstall` changes installed Mac App Store apps. Confirm.",match:(e)=>e.head==="mas"&&typeof e.tokens[1]==="string"&&["install","uninstall","purchase"].includes(e.tokens[1])},{rule:"gh-destructive",action:"deny",message:"gh repo/release/issue delete is destructive on shared state. Refuse.",match:(e)=>e.head==="gh"&&typeof e.tokens[1]==="string"&&typeof e.tokens[2]==="string"&&["repo","release","issue","pr"].includes(e.tokens[1])&&["delete","destroy","remove"].includes(e.tokens[2])},{rule:"gh-api-mutation",action:"deny",message:"`gh api` with a mutating HTTP method can change shared GitHub state and bypass Git workflow protections. Refuse the inline mutation.",match:$ne},{rule:"flyctl-destroy",action:"deny",message:"flyctl apps destroy / volumes destroy nukes deployed infra. Refuse.",match:(e)=>e.head==="flyctl"&&e.tokens.some((t)=>t==="destroy"||t==="delete")},{rule:"gcloud-delete",action:"deny",message:"`gcloud ... delete` affects cloud resources. Refuse.",match:(e)=>e.head==="gcloud"&&e.tokens.includes("delete")}]});var c0=(e)=>e.protectedBranches??[],Lne,Bne,Hne,sW,Wne=(e)=>{if(e.head!=="git")return null;let t=e.tokens.slice(1),n=0;while(n<t.length){let r=t[n];if(r===void 0)break;if(Bne.has(r))n+=2;else if(Hne.has(r))n+=1;else if(r.startsWith("--git-dir=")||r.startsWith("--work-tree=")||r.startsWith("--namespace=")||r.startsWith("--super-prefix=")||r.startsWith("--exec-path="))n+=1;else if(r.startsWith("-"))n+=1;else return{subcommand:r,subcommandIndex:n+1,subArgs:t.slice(n+1)}}return null},jne=(e)=>{for(let t=0;t<e.length;t+=1){let n=e[t];if(n===void 0)break;if(n==="-m"||n==="--message")return e[t+1]??null;if(n.startsWith("--message="))return n.slice(10);if(/^-[a-zA-Z]*m[a-zA-Z]*$/u.test(n))return e[t+1]??null}return null},qne=(e,t)=>{let n=c0(t);for(let r of e)for(let o of n)if(r===o||r.endsWith(`:${o}`)||r.endsWith(`/${o}`))return o;return null},zne=(e)=>e.filter((t)=>!t.startsWith("-")),Vne=(e)=>e.filter((t)=>t.startsWith("-")),vt=(e,...t)=>{let n=new Set(e);return t.some((r)=>n.has(r))},Kne=({subArgs:e,positional:t})=>{if(vt(e,"--global","--system"))return X("git-config-global","Modifying global / system git config is off-limits \u2014 that is your personal identity. Read-only `git config --get` is fine.");if(!vt(e,"--get","-l","--list","--get-all","--get-regexp")&&t.length>=2)return X("git-config-write","Local git config writes should be done explicitly. To read a value, use `git config --get <key>`.");return Y("bash-git")},Gne=({subArgs:e})=>{if(vt(e,"--cached"))return Y("bash-git");return Lt("git-rm","`git rm <path>` removes from the index AND the working tree. To untrack-only, use `git rm --cached <path>`. To delete the file separately, use `trash` / `rip`. Confirm intent.")},Jne=({subArgs:e,positional:t})=>{if(vt(e,"--staged","-S")&&!vt(e,"--worktree","-W"))return Y("bash-git");if(t.length>0)return X("git-restore-discard","`git restore <path>` discards uncommitted changes in the working tree. Refuse \u2014 `git diff <path>` to inspect first, or `git stash push <path>` to preserve.");return Y("bash-git")},Qne=({subArgs:e,positional:t})=>{if(vt(e,"-b","-B"))return Y("bash-git");if(vt(e,"-f","--force"))return X("git-checkout-force","`git checkout -f` overwrites the working tree without preserving uncommitted changes. Refuse.");if(e.includes("--"))return X("git-checkout-discard","`git checkout -- <path>` discards uncommitted working-tree changes. Refuse \u2014 use `git stash push <path>` to preserve, or `git diff <path>` to inspect first.");let[n]=t;if(n!==void 0&&t.length===1&&(n==="."||n.startsWith("./")))return X("git-checkout-discard-all","`git checkout .` discards ALL uncommitted working-tree changes. Refuse \u2014 `git stash` to preserve, or `git diff` to inspect first.");return Y("bash-git")},Zne=({subArgs:e})=>{if(vt(e,"-f","--force","--discard-changes"))return X("git-switch-force","`git switch -f / --discard-changes` throws away uncommitted working-tree changes. Refuse.");return Y("bash-git")},Yne=({subArgs:e,flags:t,positional:n})=>{if(vt(e,"--hard"))return X("git-reset-hard","`git reset --hard` discards all uncommitted changes AND moves HEAD. Refuse \u2014 describe the intent in chat. If undoing a published commit, `git revert <sha>` is safer.");if(vt(e,"--keep"))return Lt("git-reset-keep","`git reset --keep` resets HEAD but preserves uncommitted local changes. Confirm intent.");if(n.length===0&&t.length===0)return Y("bash-git");return Lt("git-reset-mixed","`git reset` moves HEAD. Confirm intent \u2014 if undoing a commit, `git revert` is usually safer.")},Xne=({subArgs:e,flags:t})=>{if(vt(e,"-n","--dry-run")||t.some((n)=>/^-[a-zA-Z]*n/u.test(n)))return Y("bash-git");if(t.some((n)=>/^-[a-zA-Z]*[df]/u.test(n)||n==="--force"))return X("git-clean-fd","`git clean -fd` deletes untracked files (often your in-progress work). Refuse \u2014 inspect with `git clean -dn` (dry run) first. If genuinely needed, append ` # tripwire-allow: <reason>`.");return Y("bash-git")},ere=({subArgs:e,positional:t,config:n})=>{if(vt(e,"--abort","--quit","--continue","--skip","--edit-todo"))return Y("bash-git");if(vt(e,"-i","--interactive"))return X("git-rebase-interactive","`git rebase -i` rewrites history interactively. Refuse \u2014 too easy to lose commits in the agent loop. If this is genuinely required, do it manually outside the agent.");let[r]=t,o=c0(n);if(r!==void 0&&o.includes(r))return Lt("git-rebase-onto-protected",`Rebasing onto \`${r}\` rewrites history of the current branch. \`git merge ${r}\` is usually safer. Confirm intent.`);return Lt("git-rebase","`git rebase` rewrites commit history. `git merge` is usually safer. Confirm intent.")},tre=({subArgs:e})=>{if(vt(e,"--abort","--quit","--continue","--skip"))return Y("bash-git");return Lt("git-cherry-pick","`git cherry-pick` applies commits onto the current branch and can create conflicts. Confirm intent.")},nre=({subArgs:e})=>{if(vt(e,"--abort","--continue","--quit"))return Y("bash-git");return Lt("git-merge","`git merge <branch>` may create merge conflicts. Confirm intent.")},rre=({subArgs:e,config:t})=>{if(vt(e,"--amend"))return X("git-commit-amend","`git commit --amend` rewrites the last commit. If it has been pushed, this causes upstream divergence. Refuse \u2014 surface the intent.");let n=jne(e),r=vt(e,"-F","--file","-c","-C","--reuse-message","--reedit-message"),o=vt(e,"--no-edit");if(n===null&&!r&&!o)return X("git-commit-no-message",'`git commit` without `-m "..."` opens an editor and hangs the agent. Use `git commit -m "<conventional message>"`.');if(n!==null&&t.enforceConventionalCommits===!0&&!Lne.test(n))return X("git-commit-non-conventional",["Commit message must follow Conventional Commits format:"," `<type>(<scope>)?(!)?: <description>`","Allowed types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert.","Examples:"," `fix(auth): handle expired token refresh`"," `feat: add bash-git rule`"," `chore: bump deps`",`Got: ${JSON.stringify(n)}`].join(`
|
|
47
|
-
`));if(vt(e,"-a","--all")||e.some((s)=>/^-[a-zA-Z]*a[a-zA-Z]*$/u.test(s)))return Lt("git-commit-auto-stage","`git commit -a / --all` auto-stages every tracked change. Explicit `git add <files>` first is usually clearer about what is being committed. Confirm.");return Y("bash-git")},ore=({subArgs:e,flags:t,positional:n,config:r})=>{if(t.some((s)=>s==="--force"||s==="-f"||s.startsWith("--force-with-lease")))return X("git-force-push","Force push is forbidden. If a branch needs to be reset upstream, surface the intent \u2014 there is almost always a non-force path.");if(vt(e,"--delete","--mirror")||e.some((s)=>s.startsWith(":")))return X("git-push-delete","Refusing to delete a remote branch via push. If genuinely needed, surface the intent.");let o=qne(n,r);if(o!==null)return X("git-push-protected",`Refusing to push directly to protected branch \`${o}\`. Open a PR instead: \`gh pr create\`.`);return Y("bash-git")},sre=({subArgs:e,flags:t,positional:n,config:r})=>{let o=t.find((s)=>s==="-D"||s==="-d"||s==="--delete"||/^-[a-zA-Z]*D/u.test(s)||/^-[a-zA-Z]*d/u.test(s));if(o!==void 0){let s=n,i=new Set(c0(r)),a=s.find((c)=>i.has(c));if(a!==void 0)return X("git-branch-delete-protected",`Refusing to delete protected branch \`${a}\`.`);if(o==="-D"||o.includes("D"))return X("git-branch-force-delete",`\`git branch -D ${s.join(" ")}\` force-deletes branches even if unmerged (potential data loss). To delete a merged branch, use \`-d\`. To force, append \` # tripwire-allow: <reason>\`.`);return Lt("git-branch-delete",`\`git branch -d ${s.join(" ")}\` deletes a branch (merged-only check). Confirm intent.`)}if(vt(e,"-m","-M","--move"))return Lt("git-branch-move","Renaming a branch can confuse pushed remotes. Confirm intent.");return Y("bash-git")},ire=({subArgs:e})=>{if(vt(e,"-d","--delete"))return X("git-tag-delete","`git tag -d` deletes a tag. Refuse \u2014 surface intent.");return Y("bash-git")},are=({subArgs:e})=>{let t=e[0]??"push";if(t==="drop"||t==="clear")return X("git-stash-drop",`\`git stash ${t}\` discards stashed work. Refuse \u2014 \`git stash list\` and \`git stash show\` to inspect first.`);return Y("bash-git")},cre=({flags:e})=>{if(e.some((t)=>t.startsWith("--prune=")||t==="--aggressive"))return X("git-gc-prune","`git gc --prune=now` / `--aggressive` destroys reflog recovery options. Refuse.");return Y("bash-git")},ure=({subArgs:e})=>{let[t]=e;if(t!==void 0&&["add","prune","remove","rename","rm","set-branches","set-head","set-url","update"].includes(t))return Lt("git-remote-mutate",`\`git remote ${t}\` changes which remote you're pushing to. Confirm \u2014 accidentally pointing at the wrong remote is high blast-radius.`);return Y("bash-git")},lre=({subArgs:e})=>{if(vt(e,"-f","--force"))return X("git-checkout-index-force","`git checkout-index --force` can overwrite working-tree files. Refuse.");return Lt("git-checkout-index","`git checkout-index` writes files from the index into the working tree. Confirm the target and intent.")},oW=({subcommand:e,subArgs:t})=>{let n=t[0]??"";if(["add","remove","rm","deinit","sync","set-url"].includes(n))return Lt("git-submodule-worktree-mutate",`\`git ${e} ${n}\` modifies repo structure. Confirm intent.`);return Y("bash-git")},fre,dre=(e,t)=>{let{subcommand:n,subArgs:r}=e,o=Vne(r),s=zne(r);if(sW.has(n)){if(n==="reflog"&&(r[0]==="expire"||vt(r,"--expire")))return X("git-reflog-expire","`git reflog expire` destroys git's recovery history. Refuse \u2014 surface the intent.");if(n==="symbolic-ref"&&s.length>=2)return X("git-symbolic-ref-write","`git symbolic-ref <name> <ref>` rewrites a symbolic ref. Refuse.");return Y("bash-git")}let i=fre.get(n);if(i!==void 0)return i({subcommand:n,subArgs:r,flags:o,positional:s,config:t});return Ts("git-unknown-subcommand",`\`git ${n}\` is not classified by tripwire. Allowing \u2014 flag if this looks like history-rewriting or data-loss territory.`)},pre=(e)=>{if(sW.has(e.subcommand))return!0;if(e.subcommand!=="remote")return!1;let t=e.subArgs.find((n)=>!n.startsWith("-"));return t===void 0||t==="get-url"||t==="show"},iW=(e,t)=>{for(let n of e.invocations){let r=Wne(n);if(r!==null){if(n.words[r.subcommandIndex]?.kind==="dynamic")return X("git-dynamic-subcommand","Tripwire cannot classify a Git subcommand that is computed at runtime.");if((!pre(r)||r.subcommand==="reflog"||r.subcommand==="symbolic-ref")&&n.words.slice(1).some((i)=>i.kind==="dynamic"))return X("git-dynamic-mutation",`Tripwire cannot prove that computed arguments to \`git ${r.subcommand}\` preserve Git safety policy.`);let s=dre(r,t);if(s!==null&&s.kind!=="allow")return s}}return Y("bash-git")};var aW=v(()=>{Gn();Lne=/^(?<type>feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(?<scope>\([\w./\- ]+\))?!?:\s+\S/u,Bne=new Set(["-C","-c","--git-dir","--work-tree","--namespace","--super-prefix"]),Hne=new Set(["--bare","--paginate","-p","--no-pager","--no-replace-objects","--literal-pathspecs","--glob-pathspecs","--noglob-pathspecs","--icase-pathspecs","--no-optional-locks","--exec-path","--html-path","--man-path","--info-path"]),sW=new Set(["status","diff","diff-tree","log","show","blame","rev-parse","rev-list","ls-files","ls-tree","cat-file","reflog","describe","shortlog","whatchanged","archive","bundle","fsck","fetch","ls-remote","help","version","grep","name-rev","merge-base","symbolic-ref","check-ignore","count-objects","verify-commit","verify-tag"]),fre=new Map([["config",Kne],["add",()=>Y("bash-git")],["mv",()=>Y("bash-git")],["rm",Gne],["restore",Jne],["checkout",Qne],["switch",Zne],["reset",Yne],["clean",Xne],["rebase",ere],["cherry-pick",tre],["merge",nre],["commit",rre],["push",ore],["branch",sre],["tag",ire],["stash",are],["filter-branch",({subcommand:e})=>X("git-filter",`\`git ${e}\` rewrites entire repo history. Refuse.`)],["filter-repo",({subcommand:e})=>X("git-filter",`\`git ${e}\` rewrites entire repo history. Refuse.`)],["gc",cre],["update-ref",()=>X("git-update-ref","`git update-ref` directly mutates refs and bypasses normal git operations. Refuse.")],["remote",ure],["submodule",oW],["worktree",oW],["checkout-index",lre],["write-tree",()=>Y("bash-git")],["init",({subcommand:e})=>Ts(`git-${e}`,`\`git ${e}\` is allowed but unusual mid-session. Make sure this is what the user asked for.`)],["clone",({subcommand:e})=>Ts(`git-${e}`,`\`git ${e}\` is allowed but unusual mid-session. Make sure this is what the user asked for.`)]])});var mre,hre,gre=(e)=>{for(let t of e.invocations){let{pipeline:n}=t;if(mre.has(t.head)&&n!==void 0){if(e.invocations.find((o)=>o.pipeline?.id===n.id&&o.pipeline.index===n.index+1&&hre.has(o.head))!==void 0)return!0}}return!1},xre,cW=(e)=>{if(gre(e))return X("curl-pipe-shell","Piping `curl` / `wget` directly into a shell runs whatever the remote URL serves. Refuse \u2014 download to a file, inspect, then run if appropriate. If you genuinely need this, append ` # tripwire-allow: <reason>` (and explain to the user what you're running).");for(let t of e.invocations)for(let n of xre)if(t.head===n.head&&t.tokens[1]===n.subcommand)return Lt(n.rule,n.message);return Y("bash-network-install")};var uW=v(()=>{Gn();mre=new Set(["curl","wget","wget2","aria2c","xh"]),hre=new Set(["bash","sh","zsh","fish"]),xre=[{head:"cargo",subcommand:"install",rule:"cargo-install",message:"Confirm before `cargo install <crate>`: this builds and installs arbitrary code from crates.io into ~/.cargo/bin globally."},{head:"go",subcommand:"install",rule:"go-install",message:"Confirm before `go install`: this fetches and installs arbitrary Go code globally."},{head:"gem",subcommand:"install",rule:"gem-install",message:"Confirm before `gem install`: pulls arbitrary code from rubygems.org."}]});import{lstatSync as yre,readlinkSync as Sre,realpathSync as Ere}from"fs";import mf from"path";var bre,lW=(e)=>{try{return Ere(e)}catch{return null}},u0=(e,t=new Set)=>{if(t.has(e))return e;t.add(e);let n=lW(e);if(n!==null)return n;try{if(yre(e).isSymbolicLink()){let o=Sre(e);return u0(mf.resolve(mf.dirname(e),o),t)}}catch{}let r=mf.dirname(e);if(r===e)return e;return mf.join(u0(r,t),mf.basename(e))},xm=(e,t,n)=>{let r=mf.resolve(e),o=t==="write"?u0(r):lW(r),s=[e,r];if(o!==null&&!s.includes(o))s.push(o);for(let i of s)for(let a of n)if(a.pattern.test(i))return a;return null},l0=(e)=>{let t=xm(e.file_path,"write",bre);if(t!==null)return X(t.rule,t.message);return Y("path-protect")};var $y=v(()=>{Gn();bre=[{pattern:/(?<prefix>^|\/)\.env(?<ext>\.[^/]+)?$/u,rule:"env-file",message:".env files hold secrets that should never be sent to the model. Refuse to write or edit. If an example is needed, create .env.example with redacted placeholders."},{pattern:/(?<prefix>^|\/)\.dev\.vars(?<ext>\.[^/]+)?$/u,rule:"dev-vars",message:".dev.vars holds Cloudflare/Wrangler secrets. Do not modify."},{pattern:/(?<prefix>^|\/)\.ssh\//u,rule:"ssh-dir",message:"Never write into ~/.ssh/. Refuse."},{pattern:/(?<prefix>^|\/)(?<key>id_rsa|id_ed25519|id_ecdsa|id_dsa)(?<pub>\.pub)?$/u,rule:"ssh-key",message:"SSH key file. Refuse."},{pattern:/\.(?<ext>pem|key|p12|pfx)$/iu,rule:"private-key",message:"Private key file. Refuse to overwrite. If generating a new key, use a different filename and let the user review."},{pattern:/(?<prefix>^|\/)secrets?\.(?<ext>json|ya?ml|toml|env)$/iu,rule:"secrets-file",message:"Secrets file. Refuse."},{pattern:/(?<prefix>^|\/)\.aws\/credentials$/u,rule:"aws-credentials",message:"AWS credentials file. Refuse."},{pattern:/(?<prefix>^|\/)\.netrc$/u,rule:"netrc",message:".netrc holds host credentials. Refuse."}]});var wre,kre=(e)=>{let t=xm(e,"write",wre);if(t!==null)return X(t.rule,t.message);return null},f0=(e)=>e.kind==="dynamic"||e.kind==="background-pid"?X("redirect-dynamic-target","Tripwire cannot prove that this computed write target avoids protected files."):kre(e.value),fW=(e)=>{for(let t of e.redirects)if(t.op===">"||t.op===">>"||t.op==="&>"||t.op==="&>>"){let n=f0(t.target);if(n!==null)return n}for(let t of e.invocations){let n=t.words.slice(1).filter((r)=>!r.value.startsWith("-"));if(t.head==="tee")for(let r of n){let o=f0(r);if(o!==null)return o}if(t.head==="cp"||t.head==="mv"){let r=n.at(-1);if(r!==void 0){let o=f0(r);if(o!==null)return o}}}return Y("bash-redirect")};var dW=v(()=>{Gn();$y();wre=[{rule:"redirect-env",pattern:/(?<prefix>^|\/)\.env(?<ext>\.[^/]+)?$/u,message:"Refusing to write into a .env file via shell redirect / tee / cp / mv. .env files hold secrets \u2014 never overwrite from a tool call."},{rule:"redirect-dev-vars",pattern:/(?<prefix>^|\/)\.dev\.vars(?<ext>\.[^/]+)?$/u,message:"Refusing to write into .dev.vars (Cloudflare/Wrangler secrets)."},{rule:"redirect-ssh",pattern:/(?<prefix>^|\/)\.ssh\//u,message:"Refusing to write into ~/.ssh/ via shell."},{rule:"redirect-key",pattern:/\.(?<ext>pem|key|p12|pfx)$/iu,message:"Refusing to overwrite a private-key-shaped file via shell."},{rule:"redirect-aws-credentials",pattern:/(?<prefix>^|\/)\.aws\/credentials$/u,message:"Refusing to write into ~/.aws/credentials via shell."},{rule:"redirect-netrc",pattern:/(?<prefix>^|\/)\.netrc$/u,message:"Refusing to write into ~/.netrc via shell."},{rule:"redirect-block-device",pattern:/^\/dev\/(?<type>sd|disk|nvme|rdisk)/iu,message:"Redirecting into a raw block device wipes the disk. Refuse."}]});var Cre=(e,t)=>{let n=!1,r=[];for(let i of e.tokens.slice(1))if(!n&&i==="--")n=!0;else if(n||!i.startsWith("-")||i==="-")r.push(i);let o=t.relative??[],s=t.absolute??[];return r.filter((i)=>!JI(i,o,s))},vre=(e,t)=>{if(!e.tokens.includes("-delete"))return null;let n=[];for(let i of e.tokens.slice(1)){if(i.startsWith("-"))break;n.push(i)}let r=n.length===0?["."]:n,o=t.relative??[],s=t.absolute??[];return r.filter((i)=>!JI(i,o,s))},pW=(e,t)=>{let n=[];for(let i of e.invocations)if(i.head==="rm"){let a=Cre(i,t);if(a.length>0)n.push({kind:"rm",targets:a})}else if(i.head==="find"){let a=vre(i,t);if(a!==null&&a.length>0)n.push({kind:"find -delete",targets:a})}if(n.length===0)return Y("bash-scoped-rm");let r=t.relative??[],o=t.absolute??[],s=n.map((i)=>` \u2022 ${i.kind} on: ${i.targets.map((a)=>JSON.stringify(a)).join(", ")}`).join(`
|
|
48
|
-
`);return X("destructive-outside-safe-paths",`Destructive deletion outside known-safe scopes is blocked. Use a recoverable deletion tool or limit the target to an ephemeral build, cache, state, or temporary directory:
|
|
49
|
-
|
|
35
|
+
`:break;case"c":{let c=n<r?e.charCodeAt(n):39;if(c===39){o+=e.slice(i,n);break}if(n++,c===92){let l=n<r&&e.charCodeAt(n)===92;if(l)n++;if(o+="\x1C",!l&&n<r)o+=e[n],n++;break}o+=String.fromCharCode(c===63?127:c&31);break}case"x":case"u":case"U":{let c=n,l=a==="x"?2:a==="u"?4:8;while(n<r&&n-c<l&&fD(e.charCodeAt(n)))n++;if(n===c){o+=`\\${a}`;break}let u=e.slice(i,n);o+=dD(Number.parseInt(e.slice(c,n),16),u);break}default:{let c=a.charCodeAt(0);if(!Gv(c)){o+=`\\${a}`;break}while(n<r&&n-i-1<3&&Gv(e.charCodeAt(n)))n++;o+=String.fromCharCode(Number.parseInt(e.slice(i+1,n),8)&255);break}}}let s=n<r;if(s)n++;return{value:o,end:n,closed:s}}var On=9,Re=10,Xr=32,nr=33,ke=34,Ct=35,ce=36,Ci=37,pr=38,Fe=39,J=40,ft=41,gn=42,Qt=43,Ya=44,_t=45,Qi=47,hr=48,mr=57,_i=58,Ha=59,we=60,Pe=61,je=62,vr=63,vs=64,Cs=65,Qs=90,Vt=91,re=92,qn=93,Ja=94,_s=95,de=96,Io=97,Fo=122,Ge=123,jr=124,or=125,Yv=126;function pD(e){switch(e){case",":return 1;case"=":case"+=":case"-=":case"*=":case"/=":case"%=":case"<<=":case">>=":case"&=":case"|=":case"^=":return 2;case"||":return 4;case"&&":return 5;case"|":return 6;case"^":return 7;case"&":return 8;case"==":case"!=":return 9;case"<":case"<=":case">":case">=":return 10;case"<<":case">>":return 11;case"+":case"-":return 12;case"*":case"/":case"%":return 13;case"**":return 14;default:return-1}}function hD(e){switch(e){case"=":case"+=":case"-=":case"*=":case"/=":case"%=":case"<<=":case">>=":case"&=":case"|=":case"^=":case"**":return!0;default:return!1}}function Ka(e,t=0,r){let n=0,o=e.length,s=r?.commandExpansions.length??0,i=r?.embeddedWords.length??0;function a(O,S,y=!1){let g={type:"ArithmeticWord",pos:O+t,end:S+t,value:e.slice(O,S),parts:void 0};if(y)r?.embeddedWords.push(g);return g}function c(){while(n<o){let O=e.charCodeAt(n);if(O===Xr||O===On||O===Re)n++;else break}}function l(){if(n>=o)return null;let O=e.charCodeAt(n),S=n+1<o?e.charCodeAt(n+1):0,y=n+2<o?e.charCodeAt(n+2):0;switch(O){case Ya:return n++,",";case Pe:if(S===Pe)return n+=2,"==";return n++,"=";case nr:if(S===Pe)return n+=2,"!=";return null;case we:if(S===we){if(y===Pe)return n+=3,"<<=";return n+=2,"<<"}if(S===Pe)return n+=2,"<=";return n++,"<";case je:if(S===je){if(y===Pe)return n+=3,">>=";return n+=2,">>"}if(S===Pe)return n+=2,">=";return n++,">";case Qt:if(S===Pe)return n+=2,"+=";if(S===Qt)return null;return n++,"+";case _t:if(S===Pe)return n+=2,"-=";if(S===_t)return null;return n++,"-";case gn:if(S===gn)return n+=2,"**";if(S===Pe)return n+=2,"*=";return n++,"*";case Qi:if(S===Pe)return n+=2,"/=";return n++,"/";case Ci:if(S===Pe)return n+=2,"%=";return n++,"%";case jr:if(S===jr)return n+=2,"||";if(S===Pe)return n+=2,"|=";return n++,"|";case pr:if(S===pr)return n+=2,"&&";if(S===Pe)return n+=2,"&=";return n++,"&";case Ja:if(S===Pe)return n+=2,"^=";return n++,"^";case vr:return n++,"?";default:return null}}function u(O){let S=f();while(!0){if(c(),n>=o)break;let y=n,g=l();if(!g)break;if(g==="?"){if(3<O){n=y;break}let _=u(1);if(c(),n<o&&e.charCodeAt(n)===_i)n++;let I=u(3);S={type:"ArithmeticTernary",pos:S.pos,end:I.end,test:S,consequent:_,alternate:I};continue}let C=pD(g);if(C<O){n=y;break}let Q=hD(g)?C:C+1,w=u(Q);S={type:"ArithmeticBinary",pos:S.pos,end:w.end,operator:g,left:S,right:w}}return S}function f(){if(c(),n>=o)return a(n,n);let O=n,S=e.charCodeAt(n),y=n+1<o?e.charCodeAt(n+1):0;if(S===Qt&&y===Qt){n+=2;let g=f();return{type:"ArithmeticUnary",pos:O+t,end:g.end,operator:"++",operand:g,prefix:!0}}if(S===_t&&y===_t){n+=2;let g=f();return{type:"ArithmeticUnary",pos:O+t,end:g.end,operator:"--",operand:g,prefix:!0}}if(S===nr){n++;let g=f();return{type:"ArithmeticUnary",pos:O+t,end:g.end,operator:"!",operand:g,prefix:!0}}if(S===Yv){n++;let g=f();return{type:"ArithmeticUnary",pos:O+t,end:g.end,operator:"~",operand:g,prefix:!0}}if(S===Qt&&y!==Qt&&y!==Pe){n++;let g=f();return{type:"ArithmeticUnary",pos:O+t,end:g.end,operator:"+",operand:g,prefix:!0}}if(S===_t&&y!==_t&&y!==Pe){n++;let g=f();return{type:"ArithmeticUnary",pos:O+t,end:g.end,operator:"-",operand:g,prefix:!0}}return d()}function d(){let O=h();if(c(),n+1<o){let S=e.charCodeAt(n),y=e.charCodeAt(n+1);if(S===Qt&&y===Qt)return n+=2,{type:"ArithmeticUnary",pos:O.pos,end:n+t,operator:"++",operand:O,prefix:!1};if(S===_t&&y===_t)return n+=2,{type:"ArithmeticUnary",pos:O.pos,end:n+t,operator:"--",operand:O,prefix:!1}}return O}function h(){if(c(),n>=o)return a(n,n);let O=e.charCodeAt(n);if(O===J){let Q=n;n++;let w=u(0);if(c(),n<o&&e.charCodeAt(n)===ft)n++;return{type:"ArithmeticGroup",pos:Q+t,end:n+t,expression:w}}if(O===ce){let Q=n,w=r?.commandExpansions.length??0,_=r?.embeddedWords.length??0,I=m(),F=r?.findArithmeticWordEnd?.(Q+t,t+o)??n+t;if(F>n+t){if(r)r.commandExpansions.length=w,r.embeddedWords.length=_;return n=F-t,a(Q,n,!0)}return I}if(O===96||O===34||O===39){let Q=n;return n=(r?.findArithmeticWordEnd?.(Q+t,t+o)??Q+t+1)-t,a(Q,n,!0)}let S=n,y=r?.embeddedWords.length??0,g=b(),C=r?.findArithmeticWordEnd?.(S+t,t+o)??n+t;if(C>n+t){if(r)r.embeddedWords.length=y;return n=C-t,a(S,n,!0)}return g}function m(){let O=n;if(n++,n>=o)return a(O,n);let S=e.charCodeAt(n);if(S===J)if(n+1<o&&e.charCodeAt(n+1)===J){let y=r?.findArithmeticExpansionEnd(O+t,t+o)??-1;if(y!==-1)n=y-t;else{n+=2;let g=1;while(n<o&&g>0)if(e.charCodeAt(n)===J&&e.charCodeAt(n+1)===J)g++,n+=2;else if(e.charCodeAt(n)===ft&&e.charCodeAt(n+1)===ft)g--,n+=2;else n++}}else{n++;let y=r?.findClosingParenthesis(n+t,t+o)??-1;if(y!==-1)n=y-t+1;else{let w=1;while(n<o&&w>0){let _=e.charCodeAt(n++);if(_===J)w++;else if(_===ft)w--}}let g=e.slice(O,n),C=g.slice(2,-1),Q={type:"ArithmeticCommandExpansion",pos:O+t,end:n+t,text:g,inner:C,script:void 0};return r?.commandExpansions.push(Q),Q}else if(S===Ge){let y=r?.findClosingBrace(n+t+1,t+o)??-1;if(y!==-1)n=y-t+1;else{n++;let g=1;while(n<o&&g>0){let C=e.charCodeAt(n++);if(C===Ge)g++;else if(C===or)g--}}}else while(n<o){let y=e.charCodeAt(n);if(y>=Io&&y<=Fo||y>=Cs&&y<=Qs||y>=hr&&y<=mr||y===_s)n++;else break}return a(O,n,S===J||S===Ge)}function b(){let O=n;while(n<o){let S=e.charCodeAt(n);if(S>=hr&&S<=mr||S>=Cs&&S<=Qs||S>=Io&&S<=Fo||S===_s||S===35)n++;else break}if(n>O&&n<o&&e.charCodeAt(n)===Vt){let S=r?.findClosingBracket?.(n+t+1,t+o)??-1;if(S!==-1)n=S-t+1;else{n++;let y=1;while(n<o&&y>0){let g=e.charCodeAt(n);if(g===Vt)y++;else if(g===qn)y--;n++}}return a(O,n,!0)}if(n===O)return n++,a(O,n);return a(O,n)}if(c(),n>=o)return null;let x=u(0);if(c(),n<o&&r)return r.commandExpansions.length=s,r.embeddedWords.length=i,a(0,o,!0);return x}var Vg=()=>{};function mD(e){let t="";for(let r of e)t+=r.type==="Literal"?r.value:r.text;return t}function OD(e){let t=e.indexOf("\\");if(t===-1)return e;let r="",n=0;for(let o=t;o<e.length;o++){if(e.charCodeAt(o)!==92)continue;if(r+=e.slice(n,o),o++,o>=e.length){r+="\\",n=o;break}if(e.charCodeAt(o)!==10)r+=e[o];n=o+1}return r+e.slice(n)}function gD(e){if(e[0]!=="$")return e;let t=1;while(e[t]==="\\"&&e[t+1]===`
|
|
36
|
+
`)t+=2;return t===1||e[t]!=="("?e:"$"+e.slice(t)}class Et{static _resolveWord;static _resolveHeredocBody;text;pos;end;#t;#e;#r;#s;#a=null;constructor(e,t,r,n,o,s=0){this.text=e,this.pos=t,this.end=r,this.#t=n,this.#e=o??Et._resolveWord,this.#r=s,this.#s=n!==void 0?null:void 0}get value(){if(this.#a===null){let e=this.parts;if(!e)this.#a=OD(this.text);else{let t="";for(let r of e)switch(r.type){case"Literal":case"SingleQuoted":case"AnsiCQuoted":t+=r.value;break;case"DoubleQuoted":case"LocaleString":t+=mD(r.parts);break;case"CommandExpansion":t+=gD(r.text);break;default:t+=r.text;break}this.#a=t}}return this.#a}get parts(){if(this.#s===null)this.#s=this.#e(this.#t??"",this,this.#r)??void 0;return this.#s}set parts(e){this.#s=e??void 0}sourceText(){return this.#t?.slice(this.pos,this.end)}toJSON(){return{text:this.text,pos:this.pos,end:this.end,parts:this.parts,value:this.value}}}class np{token=p.EOF;_value="";_owner;pos=0;end=0;fileDescriptor=void 0;variableName=void 0;content=void 0;targetPos=0;targetEnd=0;assignmentOperatorPos=-1;raw=!1;keywordEligible=!1;constructor(e=null){this._owner=e}get value(){return this._value??(this._value=this._owner===null?"":this._owner._tokenValue(this.pos,this.end,this.raw))}set value(e){this._value=e}reset(){this.token=p.EOF,this._value="",this.pos=0,this.end=0,this.fileDescriptor=void 0,this.variableName=void 0,this.content=void 0,this.targetPos=0,this.targetEnd=0,this.assignmentOperatorPos=-1,this.raw=!1,this.keywordEligible=!1}copyFrom(e){this.token=e.token,this._value=e._value,this.pos=e.pos,this.end=e.end,this.fileDescriptor=e.fileDescriptor,this.variableName=e.variableName,this.content=e.content,this.targetPos=e.targetPos,this.targetEnd=e.targetEnd,this.assignmentOperatorPos=e.assignmentOperatorPos,this.raw=e.raw,this.keywordEligible=e.keywordEligible}}function Bg(e,t,r){while(t+1<r&&e.charCodeAt(t)===re&&e.charCodeAt(t+1)===Re)t+=2;return t}function $s(e,t,r){for(let n=t;n<r;n++){let o=e.charCodeAt(n);if(o===re||o===Fe||o===ke||o===ce||o===de||(o===we||o===je)&&n+1<r&&e.charCodeAt(n+1)===J)return!0}return!1}function Hv(e,t,r=!1,n){let o=0,s=0;for(let i=0;i<e.length;i++){let a=e.charCodeAt(i);if(a===re){i++;continue}if(a===Ge){o++;continue}if(a===or){if(o>0)o--;continue}if(a===Fe){i++;while(i<e.length&&e.charCodeAt(i)!==Fe)i++;continue}if(a===ke){i++;while(i<e.length){let l=e.charCodeAt(i);if(l===ke)break;if(l===re){i+=2;continue}let u=n?.(i,!0)??i;if(u>i){i=u;continue}i++}continue}let c=n?.(i,!1)??i;if(c>i){i=c-1;continue}if(r&&o===0){if(a===vr){s++;continue}if(a===_i&&s>0){s--;continue}}if(a===t&&o===0)return i}return-1}function Jv(e){let t=e.type;return t==="Literal"||t==="SimpleExpansion"||t==="ParameterExpansion"||t==="CommandExpansion"||t==="ArithmeticExpansion"}function SD(e){for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r<hr||r>mr)return!1}return e.length>0}function ED(e,t,r){for(let n=t;n<r;n++){let o=e.charCodeAt(n);if(o<hr||o>mr)return!1}return r>t}function r0(e){return e<Br}function n0(e){return-e-2}function iu(e,t,r,n){let o=n;for(let s=t;s<r&&o>=0;s++){let i=e.charCodeAt(s);if(o>=Vr){if(i===Vt)o++;else if(i===qn&&--o===Vr)o=e0}else if(o===rp)o=i<128&&As[i]&1?Kv:Br;else if(o===Kv){if(i<128&&As[i]&2)continue;if(i===Vt)o=Vr+1;else if(i===Qt)o=t0;else o=i===Pe?-s-2:Br}else if(o===e0)if(i===Qt)o=t0;else o=i===Pe?-s-2:Br;else o=i===Pe?-s-2:Br}return o}function Ye(e,t,r,n=0,o=0){e.token=t,e._value=r,e.pos=n,e.end=o,e.fileDescriptor=void 0,e.variableName=void 0,e.content=void 0,e.assignmentOperatorPos=-1,e.raw=!1,e.keywordEligible=!1}function au(e,t,r,n,o){e.token=t,e._value=null,e.pos=r,e.end=n,e.fileDescriptor=void 0,e.variableName=void 0,e.content=void 0,e.assignmentOperatorPos=-1,e.raw=o,e.keywordEligible=!1}function kD(e,t,r){switch(e.charCodeAt(t)){case nr:return r===1?p.Bang:void 0;case Ge:return r===1?p.LBrace:void 0;case or:return r===1?p.RBrace:void 0;case 105:{if(r!==2)return;let n=e.charCodeAt(t+1);return n===102?p.If:n===110?p.In:void 0}case 102:if(r===2)return e.charCodeAt(t+1)===105?p.Fi:void 0;if(r===3)return e.startsWith("for",t)?p.For:void 0;if(r===8)return e.startsWith("function",t)?p.Function:void 0;return;case 116:return r===4&&e.startsWith("then",t)?p.Then:void 0;case 101:if(r!==4)return;if(e.startsWith("else",t))return p.Else;if(e.startsWith("elif",t))return p.Elif;if(e.startsWith("esac",t))return p.Esac;return;case 100:if(r===2)return e.charCodeAt(t+1)===111?p.Do:void 0;if(r===4)return e.startsWith("done",t)?p.Done:void 0;return;case 99:if(r===4)return e.startsWith("case",t)?p.Case:void 0;if(r===6)return e.startsWith("coproc",t)?p.Coproc:void 0;return;case 119:return r===5&&e.startsWith("while",t)?p.While:void 0;case 117:return r===5&&e.startsWith("until",t)?p.Until:void 0;case 115:return r===6&&e.startsWith("select",t)?p.Select:void 0;default:return}}function PD(e,t,r){let n=t+1<r?e.charCodeAt(t+1):0;if(n<=Xr||n===or)return-1;let o=1,s=!1,i=t+1;while(i<r&&o>0){let a=e.charCodeAt(i);if(a===Ge)o++;else if(a===or){if(--o===0)break}else if(a<=Xr||a===Ha||a===jr||a===pr)return-1;else if(o===1&&(a===44||a===46&&i+1<r&&e.charCodeAt(i+1)===46))s=!0;if(a===re)i++;i++}if(o===0&&s)return i+1;return-1}class xn{src;srcEnd;pos;current;nextState;hasPeek;pendingHereDocs;collectedExpansions;_errors=null;_buildParts=!1;_buildValue=!1;_nestingDepth=0;constructor(e,t=0,r=e.length){if(this.src=e,this.srcEnd=r,this.pos=t,this.current=new np(this),this.nextState=new np(this),this.hasPeek=!1,this.pendingHereDocs=null,this.collectedExpansions=null,t===0&&e.charCodeAt(0)===Ct&&e.charCodeAt(1)===nr){let n=e.indexOf(`
|
|
37
|
+
`);this.pos=n===-1?this.srcEnd:n+1}}getSource(){return this.src}get errors(){return this._errors??(this._errors=[])}getCollectedExpansions(){return this.collectedExpansions??bD}collect(e){(this.collectedExpansions??=[]).push([e,this._nestingDepth])}getPos(){return this.pos}_tokenValue(e,t,r){return r?this.src.slice(e,t):this.wordValueOf(e,t)}wordValueOf(e,t){let r=this.pos,n=this.srcEnd,o=this._buildValue,s=this._unbalanced,i=this._errors===null?0:this._errors.length;this.pos=e,this.srcEnd=t,this._buildValue=!0,this.readWordText();let a=this._wordText;if(this.pos=r,this.srcEnd=n,this._buildValue=o,this._unbalanced=s,this._errors!==null)this._errors.length=i;return a}findClosingBracket(e,t=this.srcEnd){return this.findClosingShellDelimiter(e,t,qn)}findClosingArithmeticBracket(e,t=this.srcEnd){return this.findClosingShellDelimiter(e,t,qn,!1,!1)}findClosingBrace(e,t=this.srcEnd){return this.findClosingShellDelimiter(e,t,or)}findClosingParenthesis(e,t=this.srcEnd){let r=this.pos,n=this.srcEnd,o=this._unbalanced;this.pos=e,this.srcEnd=Math.min(t,this.srcEnd),this.extractBalanced();let s=this._unbalanced?-1:this.pos-1;return this.pos=r,this.srcEnd=n,this._unbalanced=o,s}findArithmeticExpansionEnd(e,t=this.srcEnd){let r=new xn(this.src,e,t);return r.pos=e+1,r.scanArithmeticBody(),r.pos}findArithmeticWordEnd(e,t=this.srcEnd){let r=new xn(this.src,e,t);return r.pos=e,r.scanArithmeticWordEnd()}scanArithmeticWordEnd(){while(this.pos<this.srcEnd){let e=this.src.charCodeAt(this.pos);if(e===ce){this.readDollar();continue}if(e===de){this.readBacktickExpansion();continue}if(e===Fe){this.pos++,this.skipSQ();continue}if(e===ke){this.pos++,this.skipDQ();continue}if(e===re){this.pos+=2;continue}if(e===Vt){let t=this.findClosingBracket(this.pos+1);if(t!==-1){this.pos=t+1;continue}}if((e===we||e===je)&&this.src.charCodeAt(this.pos+1)===J){this.pos+=2,this.extractBalanced();continue}if(e<128&&o0[e])break;this.pos++}return this.pos}findClosingShellDelimiter(e,t,r,n=!1,o=!0){let s=this.pos,i=this.srcEnd,a=this._unbalanced;this.srcEnd=Math.min(t,this.srcEnd);let c=[r],l=e,u=!0;while(l<this.srcEnd){let f=this.src.charCodeAt(l);if(f===re){if(l+1<this.srcEnd&&this.src.charCodeAt(l+1)!==Re)u=!1;l+=2;continue}if(f===Ct&&n&&c.length===1&&u){while(l<this.srcEnd&&this.src.charCodeAt(l)!==Re)l++;continue}if(f===Fe){this.pos=l+1,this.skipSQ(),l=this.pos,u=!1;continue}if(f===ke){this.pos=l+1,this.skipDQ(),l=this.pos,u=!1;continue}if(f===de){l++;while(l<this.srcEnd&&this.src.charCodeAt(l)!==de){if(this.src.charCodeAt(l)===re)l++;l++}if(l<this.srcEnd)l++;u=!1;continue}if(f===ce&&l+1<this.srcEnd&&this.src.charCodeAt(l+1)===J||(f===we||f===je)&&l+1<this.srcEnd&&this.src.charCodeAt(l+1)===J){this.pos=l+2,this.extractBalanced(),l=this.pos,u=!1;continue}let d=c[c.length-1];if(f===ce&&l+1<this.srcEnd){let h=this.src.charCodeAt(l+1);if(h===ce){l+=2,u=!1;continue}if(h===Ge&&o){c.push(or),l+=2,u=!1;continue}}if(d===qn&&f===Vt)c.push(qn);else if(d===ft&&f===J)c.push(ft);else if(f===d){if(c.pop(),c.length===0)return this.pos=s,this.srcEnd=i,this._unbalanced=a,l;u=!1,l++;continue}u=f<128&&(Te[f]&1)!==0,l++}return this.pos=s,this.srcEnd=i,this._unbalanced=a,-1}skipSubshellBody(){return this.extractBalanced(),this._unbalanced?-1:this.pos}skipCompoundBody(e){let t=[{close:e,phase:e===p.Esac?"case-pattern":"commands"}],r=!0;for(;;){let n=this.next(r?k.CommandStart:k.Normal),o=n.token;if(o===p.EOF)return-1;let s=t.length-1,i=t[s];if(i.phase==="function-name"){if(o===p.Newline)continue;i.phase="function-body",r=!0;continue}else if(i.phase==="function-body"){if(o===p.Newline)continue;if(i.phase="commands",r=!0,o===p.LParen&&this.peek(k.Normal).token===p.RParen){this.next(k.Normal),i.phase="function-body";continue}}else if(i.phase==="coproc-command"){if(o===p.Newline)continue;if(o===p.Word){i.phase="coproc-body",r=!0;continue}i.phase="commands",r=!0}else if(i.phase==="coproc-body"){if(o===p.Newline)continue;if(i.phase=o===p.Word&&n.keywordEligible&&n.value==="time"?"time-command":"commands",r=!0,i.phase==="time-command")continue}else if(i.phase==="time-command"){if(o===p.Word&&n.keywordEligible&&n.value==="-p"){i.phase="time-command-after-p";continue}if(o===p.Word&&n.keywordEligible&&n.value==="--"){i.phase="commands";continue}i.phase="commands",r=!0}else if(i.phase==="time-command-after-p"){if(o===p.Word&&n.keywordEligible&&n.value==="--"){i.phase="commands";continue}i.phase="commands",r=!0}else if(i.phase==="for-header"){if(o===p.ArithCmd||o===p.Semi||o===p.Newline){r=!0;continue}if(o===p.Do||o===p.LBrace){i.close=o===p.Do?p.Done:p.RBrace,i.phase="commands",r=!0;continue}}else if(i.phase==="case-word"){if(o===p.Newline)continue;i.phase="case-in",r=!1;continue}else if(i.phase==="case-in"){if(o===p.Newline){r=!0;continue}i.phase="case-pattern",r=!0;continue}else if(i.phase==="case-pattern"){if(o===p.Esac&&r){if(t.pop(),t.length===0)return n.end;r=!1;continue}if(o===p.RParen)i.phase="commands",r=!0;else r=o===p.Newline;continue}if(o===i.close){if(t.pop(),t.length===0)return n.end;r=!1;continue}if(r)switch(o){case p.LParen:t.push({close:p.RParen,phase:"commands"});break;case p.LBrace:t.push({close:p.RBrace,phase:"commands"});break;case p.If:t.push({close:p.Fi,phase:"commands"});break;case p.For:t.push({close:p.Done,phase:"for-header"});break;case p.While:case p.Until:case p.Select:t.push({close:p.Done,phase:"commands"});break;case p.Case:t.push({close:p.Esac,phase:"case-word"});break;case p.DblLBracket:if(!this.skipTestCommandBody())return-1;r=!1;continue;case p.Assignment:case p.Redirect:case p.Bang:case p.Then:case p.Else:case p.Elif:case p.Do:case p.In:break;case p.Semi:case p.Newline:case p.Pipe:case p.And:case p.Or:case p.Amp:case p.DoubleSemi:case p.SemiAmp:case p.DoubleSemiAmp:break;case p.Function:i.phase="function-name";break;case p.Coproc:i.phase="coproc-command";break;default:if(o===p.Word&&n.keywordEligible&&n.value==="time")i.phase="time-command",r=!0;else r=!1;continue}switch(o){case p.Semi:case p.Newline:case p.Pipe:case p.And:case p.Or:case p.Amp:r=!0;break;case p.DoubleSemi:case p.SemiAmp:case p.DoubleSemiAmp:if(i.close===p.Esac)i.phase="case-pattern";r=!0;break;case p.RParen:r=!0;break}}}skipTestGroup(){let e=1;for(;;){let t=this.next(k.TestMode);if(t.token===p.EOF)return-1;if(t.token===p.DblRBracket)return this.unshift(t),-1;if(t.token===p.LParen)e++;else if(t.token===p.RParen&&--e===0)return t.end}}skipTestCommandBody(){for(;;){let e=this.next(k.TestMode).token;if(e===p.DblRBracket)return!0;if(e===p.EOF)return!1}}buildWordParts(e){this._buildParts=!0,this.pos=e;let t=this.src.charCodeAt(e);if((t===60||t===62)&&e+1<this.srcEnd&&this.src.charCodeAt(e+1)===40){this.pos=e+2;let r=this.extractBalanced();if(this._unbalanced)this.errors.push({message:"unterminated process substitution",pos:e});let o={type:"ProcessSubstitution",text:this.src.slice(e,this.pos),operator:t===60?"<":">",script:void 0,inner:r??void 0,innerStart:e+2};if(this.collect(o),this.pos<this.srcEnd)if(this.readWordText(),this._wordParts)this._wordParts.unshift(o);else this._wordParts=[o];else this._wordParts=[o]}else this.readWordText();return this._wordParts}buildEmbeddedWordParts(e){return this._buildParts=!0,this.pos=e,this.readInnerWordText(),this._wordParts}buildHereDocParts(e,t){this._buildParts=!0;let r=this.src,n=[],o="",s=e,i=e,a=()=>{if(o)n.push({type:"Literal",value:o,text:r.slice(s,i)}),o=""};while(i<t){let c=r.charCodeAt(i);if(c===92){if(i+1<t){let l=r.charCodeAt(i+1);if(l===36||l===96||l===92){o+=String.fromCharCode(l),i+=2;continue}}o+="\\",i++;continue}if(c===36){if(a(),s=i,this.pos=i,this.readDollar(),this._resultPart)n.push(this._resultPart),s=this.pos;else o+=r.slice(i,this.pos);i=this.pos;continue}if(c===96){if(a(),s=i,this.pos=i,this.readBacktickExpansion(),this._resultPart)n.push(this._resultPart),s=this.pos;else o+=r.slice(i,this.pos);i=this.pos;continue}o+=r[i],i++}return a(),n.length>1||n.length===1&&n[0].type!=="Literal"?n:null}registerHereDocTarget(e){if(this.pendingHereDocs===null)return;for(let t of this.pendingHereDocs)if(!t.target){t.target=e;return}}readTestRegexWord(){this.hasPeek=!1,this.skipSpacesAndTabs();let e=this.src,t=this.srcEnd,r=this.pos,n=0;while(this.pos<t){let o=e.charCodeAt(this.pos);if(o===J){n++,this.pos++;continue}if(o===re){this.pos+=this.pos+1<t?2:1;continue}if(o===Fe){let s=this.pos++,i=s>r&&e.charCodeAt(s-1)===ce;while(this.pos<t&&e.charCodeAt(this.pos)!==Fe){if(i&&e.charCodeAt(this.pos)===re&&this.pos+1<t)this.pos++;this.pos++}if(this.pos<t)this.pos++;else this.errors.push({message:i?"unterminated ANSI-C quote":"unterminated single quote",pos:s});continue}if(o===ke){this.pos++,this.readDoubleQuoted();continue}if(o===de){this.readBacktickExpansion();continue}if(n>0){if(o===ft)n--;this.pos++;continue}if(o===ce){this.readDollar();continue}if((o===we||o===je)&&this.pos+1<t&&e.charCodeAt(this.pos+1)===J){let s=this.pos;if(this.pos+=2,this.extractBalanced(),this._unbalanced)this.errors.push({message:"unterminated process substitution",pos:s});continue}if(o<128&&Te[o]&1&&o!==jr)break;this.pos++}return Ye(this.current,p.Word,e.slice(r,this.pos),r,this.pos),this.current}readCStyleForExprs(){this.hasPeek=!1;let e=this.src,t=this.srcEnd;while(this.pos<t&&(e.charCodeAt(this.pos)===Xr||e.charCodeAt(this.pos)===On))this.pos++;if(this.pos<t&&e.charCodeAt(this.pos)===J)this.pos++;let r=[this.pos,0,0],n=["","","",0,0,0],o=0,s=1,i=this.pos;while(this.pos<t&&s>0){let a=e.charCodeAt(this.pos);if(a===J)s++,this.pos++;else if(a===ft){if(s--,s===0){let c=e.slice(i,this.pos);n[o]=c.trim(),n[3+o]=r[o]+c.length-c.trimStart().length,this.pos++;while(this.pos<t&&(e.charCodeAt(this.pos)===Xr||e.charCodeAt(this.pos)===On))this.pos++;if(this.pos<t&&e.charCodeAt(this.pos)===ft)this.pos++;break}this.pos++}else if(a===Ha&&s===1){let c=e.slice(i,this.pos);if(n[o]=c.trim(),n[3+o]=r[o]+c.length-c.trimStart().length,o<2)o++;this.pos++,i=this.pos,r[o]=i}else if(a===Fe)this.pos++,this.skipSQ();else if(a===ke)this.pos++,this.skipDQ();else this.pos++}return n}peek(e=k.Normal){if(!this.hasPeek)this.readNext(this.nextState,e),this.hasPeek=!0;return this.nextState}peekFollow(e){if(!this.hasPeek){let t=e[this.current.token]?k.CommandStart:k.Normal;this.readNext(this.nextState,t),this.hasPeek=!0}return this.nextState}next(e=k.Normal){if(this.hasPeek){this.hasPeek=!1;let t=this.current;return this.current=this.nextState,this.nextState=t,this.current}return this.readNext(this.current,e),this.current}unshift(e){this.nextState.copyFrom(e),this.hasPeek=!0}readNext(e,t){let r=this.src,n=this.srcEnd,o=this.pos;while(o<n){let a=r.charCodeAt(o);if(a===Xr||a===On){o++;continue}if(a===re&&o+1<n&&r.charCodeAt(o+1)===Re){o+=2;continue}if(a===Re&&t===k.TestMode){o++;continue}break}if(this.pos=o,o>=n){this.consumePendingHereDocs(),Ye(e,p.EOF,"",o,o);return}let s=o,i=r.charCodeAt(o);if(i===Ct){while(this.pos<n&&r.charCodeAt(this.pos)!==Re)this.pos++;this.readNext(e,t);return}if(i===Re){this.pos++,this.consumePendingHereDocs(),Ye(e,p.Newline,`
|
|
38
|
+
`,s,this.pos);return}if(t===k.TestMode&&(i===we||i===je)&&!(this.pos+1<this.srcEnd&&r.charCodeAt(this.pos+1)===J)){this.pos++,Ye(e,p.Word,i===we?"<":">",s,this.pos),e.keywordEligible=!0;return}if(i<128&&Te[i]&1&&this.tryReadOperator(e,i,t,s))return;this.readWord(e,t,s)}tryReadOperator(e,t,r,n){let o=this.src,s=this.pos,i=s+1<this.srcEnd?o.charCodeAt(s+1):0;switch(t){case Ha:if(i===Ha){if(s+2<this.srcEnd&&o.charCodeAt(s+2)===pr)return this.pos+=3,Ye(e,p.DoubleSemiAmp,";;&",n,this.pos),!0;return this.pos+=2,Ye(e,p.DoubleSemi,";;",n,this.pos),!0}if(i===pr)return this.pos+=2,Ye(e,p.SemiAmp,";&",n,this.pos),!0;return this.pos++,Ye(e,p.Semi,";",n,this.pos),!0;case jr:if(i===jr)return this.pos+=2,Ye(e,p.Or,"||",n,this.pos),!0;if(i===pr)return this.pos+=2,Ye(e,p.Pipe,"|&",n,this.pos),!0;return this.pos++,Ye(e,p.Pipe,"|",n,this.pos),!0;case pr:if(i===pr)return this.pos+=2,Ye(e,p.And,"&&",n,this.pos),!0;if(i===je){this.pos+=2;let a=this.pos<this.srcEnd&&o.charCodeAt(this.pos)===je;if(a)this.pos++;this.skipSpacesAndTabs();let c=this.pos;if(this.pos<this.srcEnd&&o.charCodeAt(this.pos)!==Re&&o.charCodeAt(this.pos)!==Ct)this.readRedirectTargetText();return this.redirectToken(e,a?"&>>":"&>",n,c),!0}return this.pos++,Ye(e,p.Amp,"&",n,this.pos),!0;case J:if(r===k.CommandStart&&i===J){let a=this.errors.length;if(this.readArithmeticCommand(e,n),!this._notArithmetic)return!0;this.errors.length=a,this.pos=n}return this.pos++,Ye(e,p.LParen,"(",n,this.pos),!0;case ft:return this.pos++,Ye(e,p.RParen,")",n,this.pos),!0;case we:case je:return this.readRedirection(e,n);default:return!1}}readRedirection(e,t){let r=this.src,n=r.charCodeAt(this.pos),o="";if(n===we){this.pos++;let s=this.pos<this.srcEnd?r.charCodeAt(this.pos):0;if(s===we){this.pos++;let i=this.pos<this.srcEnd?r.charCodeAt(this.pos):0;if(i===we){this.pos++,this.skipSpacesAndTabs();let u=this.pos;if(this.pos<this.srcEnd&&r.charCodeAt(this.pos)!==Re&&r.charCodeAt(this.pos)!==Ct)this.readRedirectTargetText();return this.redirectToken(e,"<<<",t,u),!0}let a=i===_t;if(a)this.pos++;this.skipSpacesAndTabs();let c=this.pos;if(this.pos>=this.srcEnd||r.charCodeAt(this.pos)!==Ct)this.readHereDocDelimiter();let l=this.pos>c;if(l)(this.pendingHereDocs??=[]).push({delimiter:this._hereDelim,strip:a,quoted:this._hereQuoted});return Ye(e,p.Redirect,a?"<<-":"<<",t,this.pos),e.content=l?this._hereDelim:void 0,e.targetPos=c,e.targetEnd=l?this.pos:c,!0}if(s===J)return this.readProcessSubstitution(e,"<",t),!0;if(s===je)o="<>",this.pos++;else if(s===pr)o="<&",this.pos++;else o="<"}else if(n===je){this.pos++;let s=this.pos<this.srcEnd?r.charCodeAt(this.pos):0;if(s===J)return this.readProcessSubstitution(e,">",t),!0;if(s===je)o=">>",this.pos++;else if(s===pr)o=">&",this.pos++;else if(s===jr)o=">|",this.pos++;else o=">"}if(this.skipSpacesAndTabs(),this.pos<this.srcEnd){let s=r.charCodeAt(this.pos);if((s===we||s===je)&&this.pos+1<this.srcEnd&&r.charCodeAt(this.pos+1)===J){let a=this.pos;if(this.pos+=2,this.extractBalanced(),this._unbalanced)this.errors.push({message:"unterminated process substitution",pos:a});let c=r.slice(a,this.pos);return Ye(e,p.Redirect,o,t,this.pos),e.content=c,e.targetPos=a,e.targetEnd=this.pos,!0}let i=this.pos;if(s!==Re&&s!==Ct)this.readRedirectTargetText();return this.redirectToken(e,o,t,i),!0}return this.redirectToken(e,o,t,this.pos),!0}readRedirectTargetText(){let e=this._buildValue;this._buildValue=!0,this.readWordText(),this._buildValue=e}redirectToken(e,t,r,n){let o=this.pos>n&&(this._wordText.length>0||this._wordQuoted);Ye(e,p.Redirect,t,r,this.pos),e.content=o?this._wordText:void 0,e.targetPos=n,e.targetEnd=o?this.pos:n}readProcessSubstitution(e,t,r){if(this.pos++,this.extractBalanced(),this._unbalanced)this.errors.push({message:"unterminated process substitution",pos:r});let n=this.src.slice(r,this.pos);Ye(e,p.Word,n,r,this.pos)}readHereDocDelimiter(){let e=this.src,t=this.srcEnd,r=this._buildValue;this._buildValue=!0;let n="",o=!1;while(this.pos<t){let s=e.charCodeAt(this.pos);if(s===Fe){o=!0,this.pos++;while(this.pos<t&&e.charCodeAt(this.pos)!==Fe)n+=e[this.pos],this.pos++;if(this.pos<t)this.pos++}else if(s===ke){o=!0,this.pos++;while(this.pos<t&&e.charCodeAt(this.pos)!==ke){if(e.charCodeAt(this.pos)===re&&this.pos+1<t){let i=e.charCodeAt(this.pos+1);if(i===Re){this.pos+=2;continue}if(i===ce||i===de||i===ke||i===re)this.pos++}n+=e[this.pos],this.pos++}if(this.pos<t)this.pos++}else if(s===re){if(this.pos+1<t&&e.charCodeAt(this.pos+1)===Re){this.pos+=2;continue}if(o=!0,this.pos++,this.pos<t)n+=e[this.pos],this.pos++;else n+="\\"}else if(s===de){let i=this.pos;this.pos++;while(this.pos<t&&e.charCodeAt(this.pos)!==de){if(e.charCodeAt(this.pos)===re)this.pos++;this.pos++}if(this.pos<t)this.pos++;n+=e.slice(i,this.pos)}else if(s===ce){let i=this.pos+1<t?e.charCodeAt(this.pos+1):0;if(i===Fe||i===ke)o=!0;this.readDollar(),n+=this._resultText}else if(s<128&&Te[s]&1)break;else n+=e[this.pos],this.pos++}this._buildValue=r,this._hereDelim=n,this._hereQuoted=o}consumePendingHereDocs(){let e=this.pendingHereDocs;if(e===null||e.length===0)return;for(let t of e){let r=this.pos,n=this.readHereDocBody(t.delimiter,t.strip);if(t.target){if(t.target.content=n,t.quoted)t.target.heredocQuoted=!0;else if(n){let o=this.parseHereDocBody(n,r);if(o)t.target.body=o}}}e.length=0}readHereDocBody(e,t){let r=this.pos,n=this.skipHereDocBody(e,t);return this.src.slice(r,n)}matchHereDocDelimiter(e,t,r,n){let o=this.src,s=t;for(let i=0;i<e.length;){if(n&&o.charCodeAt(s)===re&&s+1<r&&o.charCodeAt(s+1)===Re){s+=2;continue}if(s>=r||o.charCodeAt(s)!==e.charCodeAt(i))return-1;s++,i++}return s}logicalLineEnd(e,t,r){let n=this.src,o=e;while(o<t){let s=n.charCodeAt(o);if(s===Re)return o;o+=r&&s===re?2:1}return t}skipHereDocBody(e,t,r=!1,n=!1){let o=this.src,s=this.srcEnd,i=e.length;while(this.pos<s){let a=this.pos,c=o.indexOf(`
|
|
39
|
+
`,this.pos);if(c===-1||c>s)c=s;if(t)while(a<c&&o.charCodeAt(a)===On)a++;if(c-a===i&&o.startsWith(e,a)){let l=this.pos;return this.pos=c<s?c+1:c,l}if(r){let l=this.matchHereDocDelimiter(e,a,s,!n);if(l!==-1){let u=o.indexOf(")",l);if(u!==-1&&u<this.logicalLineEnd(a,s,!n)){let f=this.pos;return this.pos=l,f}}}this.pos=c<s?c+1:c}return this.pos}parseHereDocBody(e,t){let r=!1;for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);if(o===de){r=!0;break}if(o===ce){let s=n+1<e.length?e.charCodeAt(n+1):0;if(s===Ge||s===J||s===ce||s>=Io&&s<=Fo||s>=Cs&&s<=Qs||s===_s||s===nr||s===Ct||s===vs||s===gn||s===vr||s===_t||s>=hr&&s<=mr){r=!0;break}}if(o===re)n++}if(!r)return null;return new Et(e,t,t+e.length,this.src,Et._resolveHeredocBody,this._nestingDepth)}_wordText="";_wordRaw=!1;_wordQuoted=!1;_wordHasExpansions=!1;_wordKeywordEligible=!1;_wordIsAssignment;_wordAssignmentOperatorPos;_wordParts=null;_resultText="";_resultIsRaw=!0;_resultHasExpansion=!1;_resultPart;_unbalanced=!1;_notArithmetic=!1;_dqText="";_dqHasExpansions=!1;_dqParts=null;_dqEnd=0;_hereDelim="";_hereQuoted=!1;readWord(e,t,r=0){this.readWordText(),this.classifyWord(e,t,r)}classifyWord(e,t,r){let n=this.src,o=this._wordRaw,s=this._wordHasExpansions,i=this._wordQuoted,a=this._wordKeywordEligible,c=this._wordIsAssignment,l=this._wordAssignmentOperatorPos,u=this.pos,f=u-r,d=null;if(!o&&!s){let h=u<this.srcEnd?n.charCodeAt(u):0;if(!i&&f<=16||h===we||h===je)d=this.wordValueOf(r,u)}if(t===k.CommandStart&&a){if(o){if(f<=8){let h=kD(n,r,f);if(h!==void 0){au(e,h,r,u,!0);return}}if(f===2&&n.charCodeAt(r)===Vt&&n.charCodeAt(r+1)===Vt){au(e,p.DblLBracket,r,u,!0);return}}else if(d!==null&&d.length>0){let h=d.charCodeAt(0);if(h>=Io&&h<=Fo&&d.length<=8||h===nr||h===Ge||h===or){let m=xD.get(d);if(m!==void 0){Ye(e,m,d,r,u);return}}if(h===Vt&&d==="[["){Ye(e,p.DblLBracket,d,r,u);return}}}if(t===k.CommandStart||t===k.CommandPrefix){if(c===void 0){let h=-1,m=!1;for(let b=r+1;b<u;b++){let x=n.charCodeAt(b);if(x===Pe){h=b;break}if(x===Vt)m=!0}if(h!==-1){let b=iu(n,r,u,rp);if(r0(b))l=n0(b)}else if(m&&u<this.srcEnd&&iu(n,r,u,rp)>=Vr){this.pos=r,this.readWordText(!0),this.classifyWord(e,t,r);return}}if(l!==void 0){if(au(e,p.Assignment,r,u,o),d!==null)e._value=d;e.assignmentOperatorPos=l;return}}if((t===k.CommandStart||t===k.TestMode)&&a){if(o){if(f===2&&n.charCodeAt(r)===qn&&n.charCodeAt(r+1)===qn){au(e,p.DblRBracket,r,u,!0);return}}else if(d==="]]"){Ye(e,p.DblRBracket,d,r,u);return}}if(!s&&this.pos<this.srcEnd){let h=n.charCodeAt(this.pos);if(h===we||h===je){if(o){let m=n.charCodeAt(r);if(m>=hr&&m<=mr&&ED(n,r,u)){let b=Number.parseInt(n.slice(r,u),10);if(this.readRedirection(e,r)){e.fileDescriptor=b;return}}if(m===Ge&&f>2&&n.charCodeAt(u-1)===or){let b=n.slice(r+1,u-1);if(this.readRedirection(e,r)){e.variableName=b;return}}}else if(d!==null&&d.length>0){if(d.charCodeAt(0)>=hr&&d.charCodeAt(0)<=mr&&SD(d)){let m=Number.parseInt(d,10);if(this.readRedirection(e,r)){e.fileDescriptor=m;return}}if(d.charCodeAt(0)===Ge&&d.charCodeAt(d.length-1)===or&&d.length>2){let m=d.slice(1,-1);if(this.readRedirection(e,r)){e.variableName=m;return}}}}}if(au(e,p.Word,r,u,o),d!==null)e._value=d;e.keywordEligible=a}readWordText(e=!1){let t=this.src,r=this.srcEnd,n=this.pos,o=n,s=0;while(n<r){let S=t.charCodeAt(n);if(S<128&&Te[S]){s=S;break}n++}if(n>=r||Te[s]&1&&!(s===J&&n>o&&Rs[t.charCodeAt(n-1)])&&!e){if(this.pos=n,this._wordText=(this._buildParts||this._buildValue)&&n>o?t.slice(o,n):"",this._wordRaw=!0,this._wordQuoted=!1,this._wordHasExpansions=!1,this._wordKeywordEligible=!0,this._wordIsAssignment=void 0,this._wordAssignmentOperatorPos=void 0,this._buildParts)this._wordParts=null;return}let i=this._buildParts,a=i||this._buildValue,c=a&&n>o?t.slice(o,n):"",l=!1,u=!1,f=!0,d=!0,h=n>o?t.charCodeAt(n-1):0,m=iu(t,o,n,rp),b,x="",O=0;if(i)b=[],x=c,O=o;while(n<r){let S=t.charCodeAt(n);if(S>=128||!Te[S]){let y=n;n++;while(n<r){let g=t.charCodeAt(n);if(g<128&&Te[g])break;n++}if(h=t.charCodeAt(n-1),m=iu(t,y,n,m),a){let g=t.slice(y,n);if(c+=g,i)x+=g}continue}if(Te[S]&1){if(S===J&&h<128&&Rs[h]){f=!1;let y=h;n++;let g=n,C=this.findClosingShellDelimiter(g,r,ft,y===Pe),Q=C===-1?r:C;if(n=C===-1?r:C+1,C===-1)this.errors.push({message:"unterminated extended glob",pos:g-2});if(h=t.charCodeAt(n-1),a){let w="("+t.slice(g,n);if(c+=w,i&&y!==Pe){if(x.length>0){let I=x.slice(0,-1);if(I)b.push({type:"Literal",value:I,text:t.slice(O,g-2)});x=""}let _=yD[y];b.push({type:"ExtendedGlob",text:_+w,operator:_,pattern:t.slice(g,Q),parts:$s(t,g,Q)?this.parseSubFieldWord(g,Q).parts:void 0}),O=n}else if(i)x+=w}continue}if(e&&m>=Vr){let y=this.findClosingBracket(n);if(y!==-1){let g=y+1;if(m=iu(t,n,g,m),h=t.charCodeAt(y),a){let C=t.slice(n,g);if(c+=C,i)x+=C}n=g;continue}}break}if(S===re){if(n++,n<r)if(t.charCodeAt(n)===Re)n++,d=!1;else{if(m>=0&&m<Vr)m=Br;if(l=!0,f=!1,d=!1,h=t.charCodeAt(n),a){if(c+=t[n],i)x+=t[n]}n++}else{if(m>=0&&m<Vr)m=Br;if(l=!0,f=!1,h=re,a){if(c+="\\",i)x+="\\"}}continue}if(S===Fe){let y=n;if(m>=0&&m<Vr)m=Br;l=!0,f=!1,d=!1,n++;let g=n;while(n<r&&t.charCodeAt(n)!==Fe)n++;if(n>g)h=t.charCodeAt(n-1);let C=a?t.slice(g,n):"";if(a)c+=C;if(n<r)n++;else this.errors.push({message:"unterminated single quote",pos:g-1});if(i){if(x)b.push({type:"Literal",value:x,text:t.slice(O,y)}),x="";b.push({type:"SingleQuoted",value:C,text:t.slice(y,n)}),O=n}continue}if(S===ke){let y=n;if(m>=0&&m<Vr)m=Br;if(l=!0,f=!1,d=!1,n++,this.pos=n,this.readDoubleQuoted(),n=this.pos,this._dqEnd>y+1)h=t.charCodeAt(this._dqEnd-1);if(this._dqHasExpansions)u=!0;if(a)c+=this._dqText;if(i){if(x)b.push({type:"Literal",value:x,text:t.slice(O,y)}),x="";let g=t.slice(y,n);b.push({type:"DoubleQuoted",text:g,parts:this._dqParts??[{type:"Literal",value:this._dqText,text:t.slice(y+1,this._dqEnd)}]}),O=n}continue}if(S===ce){f=!1;let y=n;if(m>=0&&m<Vr)m=Br;if(this.pos=n,this.readDollar(),n=this.pos,!this._resultIsRaw)d=!1;if(n>y)h=t.charCodeAt(n-1);if(this._resultHasExpansion)u=!0;if(a)c+=this._resultText;if(i)if(this._resultPart){if(x)b.push({type:"Literal",value:x,text:t.slice(O,y)}),x="";b.push(this._resultPart),O=n}else x+=this._resultText;continue}if(S===de){f=!1;let y=n;if(m>=0&&m<Vr)m=Br;if(this.pos=n,this.readBacktickExpansion(),n=this.pos,d=!1,h=t.charCodeAt(n-1),u=!0,a)c+=this._resultText;if(i){if(x)b.push({type:"Literal",value:x,text:t.slice(O,y)}),x="";b.push(this._resultPart),O=n}continue}if(S===Ge){if(m>=0&&m<Vr)m=Br;let y=PD(t,n,r);if(y>0){if(f=!1,h=t.charCodeAt(y-1),a){let g=t.slice(n,y);if(c+=g,i){if(x)b.push({type:"Literal",value:x,text:t.slice(O,n)}),x="";b.push({type:"BraceExpansion",text:g,parts:$s(t,n+1,y-1)?this.parseSubFieldWord(n+1,y-1).parts:void 0}),O=y}}n=y;continue}if(h=Ge,a){if(c+="{",i)x+="{"}n++;continue}n++}if(i&&x)b.push({type:"Literal",value:x,text:t.slice(O,n)});if(this.pos=n,this._wordText=c,this._wordRaw=d,this._wordQuoted=l,this._wordHasExpansions=u,this._wordKeywordEligible=f,this._wordIsAssignment=r0(m),this._wordAssignmentOperatorPos=this._wordIsAssignment?n0(m):void 0,i)this._wordParts=b.length>1||b.length===1&&b[0].type!=="Literal"?b:null}readInnerWordText(){let e=this.src,t=this.srcEnd,r=this.pos,n="",o=this._buildParts,s,i="",a=0;if(o)s=[],a=r;while(r<t){let c=e.charCodeAt(r);if(c===re){if(r++,r<t)if(e.charCodeAt(r)===Re)r++;else{let l=e[r++];if(n+=l,o)i+=l}continue}if(c===Fe){let l=r;r++;let u=r;while(r<t&&e.charCodeAt(r)!==Fe)r++;let f=e.slice(u,r);if(n+=f,r<t)r++;if(o){if(i)s.push({type:"Literal",value:i,text:e.slice(a,l)}),i="";s.push({type:"SingleQuoted",value:f,text:e.slice(l,r)}),a=r}continue}if(c===ke){let l=r;if(r++,this.pos=r,this.readDoubleQuoted(),r=this.pos,n+=this._dqText,o){if(i)s.push({type:"Literal",value:i,text:e.slice(a,l)}),i="";let u=e.slice(l,r);s.push({type:"DoubleQuoted",text:u,parts:this._dqParts??[{type:"Literal",value:this._dqText,text:e.slice(l+1,this._dqEnd)}]}),a=r}continue}if(c===ce){let l=r;if(this.pos=r,this.readDollar(),r=this.pos,n+=this._resultText,o)if(this._resultPart){if(i)s.push({type:"Literal",value:i,text:e.slice(a,l)}),i="";s.push(this._resultPart),a=r}else i+=this._resultText;continue}if(c===de){let l=r;if(this.pos=r,this.readBacktickExpansion(),r=this.pos,n+=this._resultText,o){if(i)s.push({type:"Literal",value:i,text:e.slice(a,l)}),i="";s.push(this._resultPart),a=r}continue}if((c===we||c===je)&&r+1<t&&e.charCodeAt(r+1)===J){let l=r;this.pos=r+2;let u=this.extractBalanced();r=this.pos;let f=e.slice(l,r);if(n+=f,o){if(i)s.push({type:"Literal",value:i,text:e.slice(a,l)}),i="";let d={type:"ProcessSubstitution",text:f,operator:c===we?"<":">",script:void 0,inner:u,innerStart:l+2};s.push(d),this.collect(d),a=r}continue}if(n+=e[r],o)i+=e[r];r++}if(o&&i)s.push({type:"Literal",value:i,text:e.slice(a,r)});if(this.pos=r,this._wordText=n,this._wordRaw=!1,this._wordQuoted=!1,this._wordHasExpansions=!1,this._wordKeywordEligible=!1,o)this._wordParts=s.length>1||s.length===1&&s[0].type!=="Literal"?s:null}parseSubFieldWord(e,t){if(e>=t)return new Et("",e,e);if(this._nestingDepth>=$t)return new Et(this.src.slice(e,t),e,t);this._nestingDepth++;let r=this.srcEnd,n=this.pos,o=this._wordText,s=this._wordParts,i=this._wordQuoted,a=this._wordKeywordEligible;this.srcEnd=t,this.pos=e,this.readInnerWordText();let c=new Et(this.src.slice(e,t),e,t);if(this._buildParts&&this._wordParts)c.parts=this._wordParts;return this.srcEnd=r,this.pos=n,this._wordText=o,this._wordParts=s,this._wordQuoted=i,this._wordKeywordEligible=a,this._nestingDepth--,c}skipSQ(){while(this.pos<this.srcEnd&&this.src.charCodeAt(this.pos)!==Fe)this.pos++;if(this.pos<this.srcEnd)this.pos++}skipAnsiCQuoted(){let e=this.pos-1,t=jg(this.src,this.pos,this.srcEnd);if(this.pos=t.end,!t.closed)this.errors.push({message:"unterminated ANSI-C quote",pos:e})}skipDQ(){let e=this.src,t=this.srcEnd;while(this.pos<t){let r=e.charCodeAt(this.pos);if(r===ke){this.pos++;return}if(r===re){this.pos+=2;continue}if(r===ce&&this.pos+1<t){let n=e.charCodeAt(this.pos+1);if(n===J){let o=this.pos;if(this.pos+=2,this.extractBalanced(),this._unbalanced)this.errors.push({message:"unterminated command substitution",pos:o});continue}if(n===Ge){this.pos+=2;let o=1;while(this.pos<t&&o>0){let s=e.charCodeAt(this.pos);if(s===or){if(--o===0){this.pos++;break}}else if(s===Ge&&this.pos>0&&e.charCodeAt(this.pos-1)===ce)o++;else if(s===re)this.pos++;else if(s===Fe){this.pos++,this.skipSQ();continue}else if(s===ke){this.pos++,this.skipDQ();continue}this.pos++}continue}}if(r===de){this.pos++;while(this.pos<t&&e.charCodeAt(this.pos)!==de){if(e.charCodeAt(this.pos)===re)this.pos++;this.pos++}if(this.pos<t)this.pos++;continue}this.pos++}}skipSpacesAndTabs(){let e=this.src,t=this.srcEnd;while(this.pos<t){let r=e.charCodeAt(this.pos);if(r===Xr||r===On)this.pos++;else if(r===re&&this.pos+1<t&&e.charCodeAt(this.pos+1)===Re)this.pos+=2;else break}}readDoubleQuoted(){let e=this.src,t=this.srcEnd,r=this.pos,n=!1,o=this._buildParts,s=o||this._buildValue;if(!o){let u=this.pos;while(u<t){let f=e.charCodeAt(u);if(f===ke){this._dqText=s?e.slice(r,u):"",this._dqEnd=u,this.pos=u+1,this._dqHasExpansions=!1,this._dqParts=null;return}if(f===ce||f===de||f===re)break;u++}}let i="",a=null,c="",l=o?this.pos:0;while(this.pos<t&&e.charCodeAt(this.pos)!==ke){let u=this.pos;while(this.pos<t){let d=e.charCodeAt(this.pos);if(d===ke||d===re||d===ce||d===de)break;this.pos++}if(s&&this.pos>u){let d=e.slice(u,this.pos);if(i+=d,o)c+=d}if(this.pos>=t||e.charCodeAt(this.pos)===ke)break;let f=e.charCodeAt(this.pos);if(f===re){if(this.pos++,this.pos<t){let d=e.charCodeAt(this.pos);if(d===Re){this.pos++;continue}if(s)if(d===ce||d===de||d===ke||d===re){let h=e[this.pos];if(i+=h,o)c+=h}else{let h="\\"+e[this.pos];if(i+=h,o)c+=h}this.pos++}continue}if(f===ce){let d=this.pos+1<t?e.charCodeAt(this.pos+1):0;if(d===ke||d===Fe){if(s){if(i+="$",o)c+="$"}this.pos++;continue}let h=this.pos;if(this.readDollar(),s)i+=this._resultText;if(this._resultHasExpansion)n=!0;if(o){let m=this._resultPart;if(m&&Jv(m)){if(!a)a=[];if(c)a.push({type:"Literal",value:c,text:e.slice(l,h)}),c="";a.push(m),l=this.pos}else c+=this._resultText}continue}if(f===de){let d=this.pos;if(this.readBacktickExpansion(!0),s)i+=this._resultText;if(n=!0,o&&this._resultPart&&Jv(this._resultPart)){if(!a)a=[];if(c)a.push({type:"Literal",value:c,text:e.slice(l,d)}),c="";a.push(this._resultPart),l=this.pos}continue}}if(o&&a&&c)a.push({type:"Literal",value:c,text:e.slice(l,this.pos)});if(this._dqEnd=this.pos,this.pos<t)this.pos++;else this.errors.push({message:"unterminated double quote",pos:r-1});this._dqText=i,this._dqHasExpansions=n,this._dqParts=a}readDollar(){let e=this.pos;this.pos++;let t=this.src,r=this.srcEnd,n=this._buildParts||this._buildValue;if(this.pos>=r){this._resultText="$",this._resultIsRaw=!0,this._resultHasExpansion=!1,this._resultPart=void 0;return}let o=Bg(t,this.pos,r);if(o>this.pos&&t.charCodeAt(o)===J&&t.charCodeAt(o+1)!==J)this.pos=o;let s=t.charCodeAt(this.pos);if(s===J){if(this.pos+1<r&&t.charCodeAt(this.pos+1)===J){let i=this.pos,a=this.errors.length;if(this.readArithmeticExpansion(),!this._notArithmetic)return;this.errors.length=a,this.pos=i}this.readCommandSubstitution(e);return}if(s===Ge){let i=this.pos+1<r?t.charCodeAt(this.pos+1):0;if(i===Xr||i===On||i===Re){this.readBraceCommandSubstitution();return}if(i===jr){this.readValueSubstitution();return}this.readParameterExpansion();return}if(s===Fe){if(this.pos++,n){let i=this.readAnsiCQuoted();this._resultText=i,this._resultPart=this._buildParts?{type:"AnsiCQuoted",text:t.slice(e,this.pos),value:i}:void 0}else this.skipAnsiCQuoted(),this._resultText="",this._resultPart=void 0;this._resultIsRaw=!1,this._resultHasExpansion=!1;return}if(s===ke){if(this.pos++,this.readDoubleQuoted(),this._resultText=this._dqText,this._resultIsRaw=!1,this._resultHasExpansion=this._dqHasExpansions,this._buildParts){let i=t.slice(e,this.pos);this._resultPart={type:"LocaleString",text:i,parts:this._dqParts??[{type:"Literal",value:this._dqText,text:t.slice(e+2,this._dqEnd)}]}}else this._resultPart=void 0;return}if(s===vs||s===gn||s===Ct||s===vr||s===_t||s===ce||s===nr||s>=hr&&s<=mr){this.pos++;let i=n?t.slice(this.pos-2,this.pos):"";this._resultText=i,this._resultIsRaw=!0,this._resultHasExpansion=!1,this._resultPart=this._buildParts?{type:"SimpleExpansion",text:i}:void 0;return}if(s<128&&As[s]&1){let i=this.pos-1;while(this.pos<r){let c=t.charCodeAt(this.pos);if(c<128&&As[c]&2)this.pos++;else break}let a=n?t.slice(i,this.pos):"";this._resultText=a,this._resultIsRaw=!0,this._resultHasExpansion=!1,this._resultPart=this._buildParts?{type:"SimpleExpansion",text:a}:void 0;return}if(s===Vt){let i=this.findClosingArithmeticBracket(this.pos+1);if(i!==-1){let a=this.pos+1,c=t.slice(a,i);this.pos=i+1;let l=n?t.slice(e,this.pos):"";this._resultText=l,this._resultIsRaw=!0,this._resultHasExpansion=!1,this._resultPart=this._buildParts?{type:"ArithmeticExpansion",text:l,expression:this.buildArithmeticExpression(c,a)}:void 0;return}}this._resultText="$",this._resultIsRaw=!0,this._resultHasExpansion=!1,this._resultPart=void 0}scanArithmeticBody(){this._notArithmetic=!1,this.pos+=2;let e=1,t=0,r=0,n,o=0,s=!1,i=this.src,a=this.srcEnd,c=this.pos;while(this.pos<a&&e>0){let l=i.charCodeAt(this.pos);if(l===re)this.pos+=2;else if(l===Fe)this.pos++,this.skipSQ();else if(l===ke)this.pos++,this.skipDQ();else if(l===de){this.pos++;while(this.pos<a&&i.charCodeAt(this.pos)!==de){if(i.charCodeAt(this.pos)===re)this.pos++;this.pos++}if(this.pos<a)this.pos++}else if(l===ce&&this.pos+2<a&&i.charCodeAt(this.pos+1)===J&&i.charCodeAt(this.pos+2)!==J){let u=this.pos;if(this.pos+=2,this.extractBalanced(),this._unbalanced)this.errors.push({message:"unterminated command substitution",pos:u})}else if(l===ce&&this.pos+1<a&&i.charCodeAt(this.pos+1)===Ge){let u=this.findClosingBrace(this.pos+2,a);this.pos=u===-1?a:u+1}else if((l===we||l===je)&&this.pos+1<a&&i.charCodeAt(this.pos+1)===J)this.pos+=2,this.extractBalanced();else if(l===J)if(i.charCodeAt(this.pos-1)===ce&&i.charCodeAt(this.pos+1)===J){if(e===1)r=t;else(n??=[]).push(t);if(e++,t=0,++o+this._nestingDepth>=$t){if(!s)this.errors.push({message:"maximum arithmetic expansion nesting depth exceeded",pos:this.pos-1}),s=!0}this.pos+=2}else t++,this.pos++;else if(l===ft&&t>0)t--,this.pos++;else if(l===ft&&this.pos+1<a&&i.charCodeAt(this.pos+1)===ft){if(--e===0){this.pos+=2;break}t=e===1?r:n.pop(),this.pos+=2}else if(l===ft&&e===1)return this._notArithmetic=!0,"";else this.pos++}return this._buildParts||this._buildValue?i.slice(c,this.pos-2):""}readArithmeticExpansion(){let e=this.pos+2,t=this.scanArithmeticBody();if(this._notArithmetic)return;let r=this._buildParts||this._buildValue?"$(("+t+"))":"";this._resultText=r,this._resultIsRaw=!0,this._resultHasExpansion=!1,this._resultPart=this._buildParts?{type:"ArithmeticExpansion",text:r,expression:this.buildArithmeticExpression(t,e)}:void 0}buildArithmeticExpression(e,t){if(!$s(this.src,t,t+e.length))return Ka(e,t)??void 0;let r=[],n=[],o=Ka(e,t,{commandExpansions:r,embeddedWords:n,findClosingBracket:(s,i)=>this.findClosingBracket(s,i),findClosingBrace:(s,i)=>this.findClosingBrace(s,i),findClosingParenthesis:(s,i)=>this.findClosingParenthesis(s,i),findArithmeticExpansionEnd:(s,i)=>this.findArithmeticExpansionEnd(s,i),findArithmeticWordEnd:(s,i)=>this.findArithmeticWordEnd(s,i)})??void 0;for(let s of r)s.innerStart=s.pos+2,this.collect(s);for(let s of n)s.parts=this.parseSubFieldWord(s.pos,s.end).parts;return o}readArithmeticCommand(e,t){let r=this._buildValue;this._buildValue=!0;let n=this.scanArithmeticBody();this._buildValue=r,Ye(e,p.ArithCmd,n,t,this.pos)}readCommandSubstitution(e){let t=this.pos;this.pos++;let r=this.extractBalanced();if(this._unbalanced)this.errors.push({message:"unterminated command substitution",pos:e});let n=this._buildParts||this._buildValue,o=n?this.src.slice(e,this.pos):"",s=!n||t===e+1?o:"$"+this.src.slice(t,this.pos);if(this._resultText=s,this._resultIsRaw=t===e+1,this._resultHasExpansion=!0,this._buildParts)this._resultPart={type:"CommandExpansion",text:o,script:void 0,inner:r,innerStart:t+1},this.collect(this._resultPart);else this._resultPart=void 0}readBraceCommandSubstitution(){this.readBraceSubstitution(1)}readValueSubstitution(){this.readBraceSubstitution(2)}readBraceSubstitution(e){let t=this.pos-1;this.pos+=e;let r=this.src,n=this.srcEnd,o=1,s=this.pos;while(this.pos<n){let i=r.charCodeAt(this.pos);if(i===Ge)o++;else if(i===or){if(--o===0){this.pos++;break}}else if(i===Fe){this.pos++,this.skipSQ();continue}else if(i===ke){this.pos++,this.skipDQ();continue}else if(i===re)this.pos++;this.pos++}if(this._resultIsRaw=!0,this._resultHasExpansion=!0,this._buildParts||this._buildValue){let i=r.slice(s,this.pos-1),a=i.trim(),c=r.slice(t,this.pos);if(this._resultText=c,this._buildParts){let l=s+(i.length-i.trimStart().length);this._resultPart={type:"CommandExpansion",text:c,script:void 0,inner:a,innerStart:l},this.collect(this._resultPart)}else this._resultPart=void 0}else this._resultText="",this._resultPart=void 0}readBacktickExpansion(e=!1){this.pos++;let t=this.src,r=this.srcEnd,n=this.pos;if(!this._buildParts&&!this._buildValue){while(this.pos<r&&t.charCodeAt(this.pos)!==de){if(t.charCodeAt(this.pos)===re&&this.pos+1<r)this.pos++;this.pos++}if(this.pos<r)this.pos++;else this.errors.push({message:"unterminated backtick",pos:n-1});this._resultText="",this._resultIsRaw=!1,this._resultHasExpansion=!0,this._resultPart=void 0;return}let o="",s=!1;while(this.pos<r&&t.charCodeAt(this.pos)!==de){if(t.charCodeAt(this.pos)===re){s=!0;break}this.pos++}if(!s)o=t.slice(n,this.pos);else{o=t.slice(n,this.pos);while(this.pos<r&&t.charCodeAt(this.pos)!==de)if(t.charCodeAt(this.pos)===re){if(this.pos++,this.pos<r){let a=t.charCodeAt(this.pos);if(a===ce||a===de||a===re||e&&a===ke)o+=t[this.pos];else o+="\\"+t[this.pos];this.pos++}}else{let a=this.pos;while(this.pos<r){let c=t.charCodeAt(this.pos);if(c===de||c===re)break;this.pos++}o+=t.slice(a,this.pos)}}if(this.pos<r)this.pos++;else this.errors.push({message:"unterminated backtick",pos:n-1});let i=t.slice(n-1,this.pos);if(this._resultText=o,this._resultHasExpansion=!0,this._buildParts)this._resultPart={type:"CommandExpansion",text:i,script:void 0,inner:o,innerStart:s?void 0:n},this.collect(this._resultPart);else this._resultPart=void 0}readParameterExpansion(){let e=this.src,t=this.srcEnd,r=this.pos;this.pos++;let n=1,o=!1;while(this.pos<t&&n>0){let a=e.charCodeAt(this.pos);if(a===ce){let c=this.pos+1<t?e.charCodeAt(this.pos+1):0;if(c===Ge){if(n++,this._nestingDepth+n>$t&&!o)this.errors.push({message:"maximum parameter expansion nesting depth exceeded",pos:this.pos}),o=!0;this.pos+=2;continue}if(c===ce){this.pos+=2;continue}if(c===J){let l=this.pos;if(this.pos+=2,this.extractBalanced(),this._unbalanced)this.errors.push({message:"unterminated command substitution",pos:l});continue}}else if(a===de){this.pos++;while(this.pos<t&&e.charCodeAt(this.pos)!==de){if(e.charCodeAt(this.pos)===re)this.pos++;this.pos++}if(this.pos<t)this.pos++;continue}else if(a===or){if(--n===0){this.pos++;break}}else if(a===re)this.pos++;else if(a===Fe){if(this.pos++,this.pos>r+1&&e.charCodeAt(this.pos-2)===ce)this.skipAnsiCQuoted();else this.skipSQ();continue}else if(a===ke){this.pos++,this.skipDQ();continue}this.pos++}let s=n===0;if(!s)this.errors.push({message:"unterminated parameter expansion",pos:r-1});let i=this._buildParts||this._buildValue?e.slice(r-1,this.pos):"";if(this._resultText=i,this._resultIsRaw=!0,this._resultHasExpansion=!1,this._buildParts){let a=e.slice(r+1,s?this.pos-1:this.pos);this._resultPart=this.parseParamInner(i,a,r+1)}else this._resultPart=void 0}parseParamInner(e,t,r){let n={type:"ParameterExpansion",text:e,parameter:"",index:void 0,indexParts:void 0,indirect:void 0,length:void 0,operator:void 0,operand:void 0,slice:void 0,replace:void 0},o=t.length;if(o===0)return n;let s=(l,u)=>this.parseSubFieldWord(r+l,r+u),i=(l)=>{let u=this.findClosingBracket(r+l,r+o);return u===-1?-1:u-r},a=0;if(t.charCodeAt(0)===nr)n.indirect=!0,a=1;if(!n.indirect&&t.charCodeAt(0)===Ct){if(o===1)return n.parameter="#",n;if(t.charCodeAt(1)===Ct)n.parameter="#",a=1;else{let l=this.scanParamName(t,1);if(l>1){let u=l;if(u<o&&t.charCodeAt(u)===Vt){let f=i(u+1);if(f!==-1)u=f+1}if(u>=o){if(n.length=!0,n.parameter=t.slice(1,l),l<o&&t.charCodeAt(l)===Vt){let f=i(l+1);if(f!==-1)n.index=t.slice(l+1,f),n.indexParts=s(l+1,f).parts}return n}}n.parameter="#",a=1}}if(!n.parameter){let l=a;a=this.scanParamName(t,a),n.parameter=t.slice(l,a)}if(a<o&&t.charCodeAt(a)===Vt){let l=i(a+1);if(l!==-1)n.index=t.slice(a+1,l),n.indexParts=s(a+1,l).parts,a=l+1}if(a>=o)return n;let c=t.charCodeAt(a);if(c===_i){if(a+1<o){let h=t.charCodeAt(a+1);if(h===_t||h===Pe||h===Qt||h===vr)return n.operator=t.slice(a,a+2),n.operand=s(a+2,o),n}a++;let l=t.slice(a),u=r+a,f=r+o,d=Hv(l,_i,!0,(h,m)=>this.findNestedShellEnd(u+h,f,m)-u);if(d===-1)n.slice={offset:s(a,o),length:void 0};else n.slice={offset:s(a,a+d),length:s(a+d+1,o)};return n}if(c===_t||c===Pe||c===Qt||c===vr)return n.operator=t[a],n.operand=s(a+1,o),n;if(c===Ct){if(a+1<o&&t.charCodeAt(a+1)===Ct)n.operator="##",n.operand=s(a+2,o);else n.operator="#",n.operand=s(a+1,o);return n}if(c===Ci){if(a+1<o&&t.charCodeAt(a+1)===Ci)n.operator="%%",n.operand=s(a+2,o);else n.operator="%",n.operand=s(a+1,o);return n}if(c===Qi){a++;let l="/";if(a<o){let d=t.charCodeAt(a);if(d===Qi)l="//",a++;else if(d===Ct)l="/#",a++;else if(d===Ci)l="/%",a++}n.operator=l;let u=t.slice(a),f=Hv(u,Qi);if(f===-1)n.replace={pattern:s(a,o),replacement:new Et("",r+o,r+o)};else n.replace={pattern:s(a,a+f),replacement:s(a+f+1,o)};return n}if(c===Ja){if(a+1<o&&t.charCodeAt(a+1)===Ja){if(n.operator="^^",a+2<o)n.operand=s(a+2,o)}else if(n.operator="^",a+1<o)n.operand=s(a+1,o);return n}if(c===Ya){if(a+1<o&&t.charCodeAt(a+1)===Ya){if(n.operator=",,",a+2<o)n.operand=s(a+2,o)}else if(n.operator=",",a+1<o)n.operand=s(a+1,o);return n}if(c===vs)return n.operator="@",n.operand=s(a+1,o),n;return n.operator=t.slice(a),n}findNestedShellEnd(e,t,r){let n=this.src.charCodeAt(e);if(n===de){let s=e+1;while(s<t){let i=this.src.charCodeAt(s);if(i===re){s+=2;continue}if(s++,i===de)return s}return t}let o;if(n===ce){let s=e+1;if(s<t&&this.src.charCodeAt(s)===Ge)o=this.findClosingBrace(s+1,t);else{let i=Bg(this.src,s,t);if(i>=t||this.src.charCodeAt(i)!==J)return e;o=this.findClosingParenthesis(i+1,t)}}else{let s=e+1;if(r||n!==we&&n!==je||s>=t||this.src.charCodeAt(s)!==J)return e;o=this.findClosingParenthesis(s+1,t)}return o===-1?t:o+1}scanParamName(e,t){let r=t;if(r>=e.length)return r;let n=e.charCodeAt(r);if(n===vs||n===gn||n===Ct||n===vr||n===_t||n===ce||n===nr)return r+1;if(n>=hr&&n<=mr){while(r<e.length&&e.charCodeAt(r)>=hr&&e.charCodeAt(r)<=mr)r++;return r}if(n>=Io&&n<=Fo||n>=Cs&&n<=Qs||n===_s){r++;while(r<e.length){let o=e.charCodeAt(r);if(o>=Io&&o<=Fo||o>=Cs&&o<=Qs||o>=hr&&o<=mr||o===_s)r++;else break}}return r}readAnsiCQuoted(){let e=this.pos-1,t=jg(this.src,this.pos,this.srcEnd);if(this.pos=t.end,!t.closed)this.errors.push({message:"unterminated ANSI-C quote",pos:e});return t.value}extractBalanced(){let e=this.src,t=this.srcEnd,r=this._buildParts||this._buildValue,n=1,o=this.pos;this._unbalanced=!1;let s=!0;while(this.pos<t){let x=e.charCodeAt(this.pos);if(x===ft){let O=r?e.slice(o,this.pos):"";return this.pos++,O}else if(x===J||x===re||x===Fe||x===ke||x===de)break;else if(x===we&&this.pos+1<t&&e.charCodeAt(this.pos+1)===we)break;else if(x===Ct&&s)break;else if(x===99&&s&&this.pos+3<t&&e.charCodeAt(this.pos+1)===97&&e.charCodeAt(this.pos+2)===115&&e.charCodeAt(this.pos+3)===101&&(this.pos+4>=t||e.charCodeAt(this.pos+4)<128&&Te[e.charCodeAt(this.pos+4)]&1))break;else s=x<128&&(Te[x]&1)!==0,this.pos++}let i=0,a=0,c=[],l=null,u=-1,f=o>=2&&e.charCodeAt(o)===J&&e.charCodeAt(o-1)===J&&e.charCodeAt(o-2)===ce,d=0,h=!1,m=-1,b=-1;while(this.pos<t&&n>0){let x=e.charCodeAt(this.pos);if(x===J){let O=this.pos>o?e.charCodeAt(this.pos-1):0,S=O===ce?this.pos-1:this.pos===b?m:-1,y=S!==-1||O===we||O===je||O===Pe||O===vs||O===vr||O===gn||O===Qt||O===nr||O===J&&c[c.length-1]===!1||f&&this.pos===o;if(c.push(!y),s=!0,u<0&&this.pos+1<t&&e.charCodeAt(this.pos+1)===J)u=n;if(S!==-1&&++d+this._nestingDepth>=$t){if(!h)this.errors.push({message:"maximum command substitution nesting depth exceeded",pos:S}),h=!0}if(m=-1,b=-1,n++,i>0)a++;this.pos++}else if(x===ft)if(i>0&&a===0)this.pos++,s=!0;else{if(i>0)a--;if(n--,n===0){let O=r?e.slice(o,this.pos):"";return this.pos++,O}if(n<=u)u=-1;s=c.pop()??!0,this.pos++}else if(x===re){if(this.pos>o&&e.charCodeAt(this.pos-1)===ce){let O=Bg(e,this.pos,t);if(O>this.pos&&e.charCodeAt(O)===J&&e.charCodeAt(O+1)!==J)m=this.pos-1,b=O}if(this.pos++,this.pos<t){if(e.charCodeAt(this.pos)!==Re)s=!1;this.pos++}}else if(x===Fe)this.pos++,this.skipSQ(),s=!1;else if(x===ke)this.pos++,this.skipDQ(),s=!1;else if(x===de){this.pos++;while(this.pos<t&&e.charCodeAt(this.pos)!==de){if(e.charCodeAt(this.pos)===re)this.pos++;if(this.pos<t)this.pos++}if(this.pos<t)this.pos++;s=!1}else if(x===we&&u<0&&this.pos+1<t&&e.charCodeAt(this.pos+1)===we){if(this.pos+2<t&&e.charCodeAt(this.pos+2)===we)this.pos+=3;else{this.pos+=2;let O=this.pos<t&&e.charCodeAt(this.pos)===_t;if(O)this.pos++;if(this.skipSpacesAndTabs(),this.readHereDocDelimiter(),this._hereDelim||this._hereQuoted)(l??=[]).push({delimiter:this._hereDelim,strip:O,quoted:this._hereQuoted})}s=!1}else if(x===Re&&l){this.pos++;for(let O of l)this.skipHereDocBody(O.delimiter,O.strip,!0,O.quoted);l=null,s=!0}else if(x===Ct&&u<0&&!f&&s)while(this.pos<t&&e.charCodeAt(this.pos)!==Re)this.pos++;else{let O=this.pos;while(this.pos<t){let S=e.charCodeAt(this.pos);if(S<128&&Te[S])break;this.pos++}if(this.pos>O){if(this.pos-O===4&&s){let y=e.charCodeAt(O);if(y===99&&e.charCodeAt(O+1)===97&&e.charCodeAt(O+2)===115&&e.charCodeAt(O+3)===101)i++;else if(y===101&&e.charCodeAt(O+1)===115&&e.charCodeAt(O+2)===97&&e.charCodeAt(O+3)===99&&i>0){if(i--,i===0)a=0}}s=!1}else{let S=e.charCodeAt(this.pos);s=S<128&&(Te[S]&1)!==0,this.pos++}}}return this._unbalanced=!0,r?e.slice(o,this.pos):""}}var $t=256,p,xD,Te,o0,As,Rs,yD,Br=-1,rp=0,Kv=1,e0=2,t0=3,Vr=4,bD,k;var Gg=E(()=>{Vg();p={Word:0,Assignment:1,Semi:2,Newline:3,Pipe:4,And:5,Or:6,Amp:7,LParen:8,RParen:9,LBrace:10,RBrace:11,Bang:12,If:13,Then:14,Else:15,Elif:16,Fi:17,Do:18,Done:19,For:20,While:21,Until:22,In:23,Case:24,Esac:25,Function:26,DoubleSemi:27,SemiAmp:28,DoubleSemiAmp:29,Select:30,DblLBracket:31,DblRBracket:32,EOF:33,ArithCmd:34,Coproc:35,Redirect:36};xD=new Map([["if",p.If],["then",p.Then],["else",p.Else],["elif",p.Elif],["fi",p.Fi],["do",p.Do],["done",p.Done],["for",p.For],["while",p.While],["until",p.Until],["in",p.In],["case",p.Case],["esac",p.Esac],["function",p.Function],["select",p.Select],["coproc",p.Coproc],["!",p.Bang],["{",p.LBrace],["}",p.RBrace]]),Te=new Uint8Array(128);Te[jr]=1;Te[pr]=1;Te[Ha]=1;Te[J]=1;Te[ft]=1;Te[we]=1;Te[je]=1;Te[Xr]=1;Te[On]=1;Te[Re]=1;Te[re]=2;Te[Fe]=2;Te[ke]=2;Te[ce]=2;Te[de]=2;Te[Ge]=2;o0=new Uint8Array(128);for(let e of[On,Re,Xr,nr,Ci,pr,J,ft,gn,Qt,Ya,_t,Qi,_i,we,Pe,je,vr,Ja,jr])o0[e]=1;As=new Uint8Array(128);for(let e=Io;e<=Fo;e++)As[e]=3;for(let e=Cs;e<=Qs;e++)As[e]=3;for(let e=hr;e<=mr;e++)As[e]=2;As[_s]=3;Rs=new Uint8Array(128);Rs[vr]=1;Rs[vs]=1;Rs[gn]=1;Rs[Qt]=1;Rs[nr]=1;Rs[Pe]=1;yD={[vr]:"?",[vs]:"@",[gn]:"*",[Qt]:"+",[nr]:"!"};bD=[];k={Normal:0,CommandStart:1,TestMode:2,CommandPrefix:3}});function s0(e,t,r=0){let n=new xn(e,t.pos,t.end);n._nestingDepth=r;let o=n.buildWordParts(t.pos);if(!o)return;return Yg(n),o}function op(e,t,r=0){if(!$s(e,t.pos,t.end))return;let n=new xn(e,t.pos,t.end);n._nestingDepth=r;let o=n.buildEmbeddedWordParts(t.pos);if(!o)return;return Yg(n),o}function i0(e,t,r=0){let n=new xn(e,t.pos,t.end);n._nestingDepth=r;let o=n.buildHereDocParts(t.pos,t.end);if(!o)return;return Yg(n),o}function Yg(e){let t=e.getSource();for(let[r,n]of e.getCollectedExpansions())if(r.inner!==void 0){let o=n+1;if(o>$t+1);else if(r.innerStart!==void 0)r.script=Hg(t,r.innerStart,r.innerStart+r.inner.length,o);else r.script=ec(r.inner),Object.defineProperty(r.script,"source",{value:r.inner,enumerable:!1});r.inner=void 0,r.innerStart=void 0}}var a0=E(()=>{Gg();Jg()});class c0{type="ArithmeticCommand";pos;end;body;#t;#e;#r=null;constructor(e,t,r,n,o){this.pos=e,this.end=t,this.body=r,this.#t=n,this.#e=o}get expression(){if(this.#r===null)this.#r=ip(this.body,this.pos+2,this.#t,this.#e);return this.#r}set expression(e){this.#r=e??void 0}toJSON(){return{type:this.type,pos:this.pos,end:this.end,expression:this.expression,body:this.body}}}class sp{type="ArithmeticFor";pos;end;body;#t;#e;#r;#s;#a;#o;#u;#d;#p=null;#f=null;#n=null;constructor(e,t,r,n,o,s,i,a,c,l,u){this.pos=e,this.end=t,this.body=r,this.#t=n,this.#e=o,this.#r=s,this.#s=i,this.#a=a,this.#o=c,this.#u=l,this.#d=u}get initialize(){if(this.#p===null)if(this.#t)this.#p=ip(this.#t,this.#s,this.#u,this.#d);else this.#p=void 0;return this.#p}set initialize(e){this.#p=e??void 0}get test(){if(this.#f===null)if(this.#e)this.#f=ip(this.#e,this.#a,this.#u,this.#d);else this.#f=void 0;return this.#f}set test(e){this.#f=e??void 0}get update(){if(this.#n===null)if(this.#r)this.#n=ip(this.#r,this.#o,this.#u,this.#d);else this.#n=void 0;return this.#n}set update(e){this.#n=e??void 0}toJSON(){return{type:this.type,pos:this.pos,end:this.end,initialize:this.initialize,test:this.test,update:this.update,body:this.body}}}function ip(e,t,r,n=0){if(!$s(r,t,t+e.length))return Ka(e,t)??void 0;let o=[],s=[],i=new xn(r),a=Ka(e,t,{commandExpansions:o,embeddedWords:s,findClosingBracket:(c,l)=>i.findClosingBracket(c,l),findClosingBrace:(c,l)=>i.findClosingBrace(c,l),findClosingParenthesis:(c,l)=>i.findClosingParenthesis(c,l),findArithmeticExpansionEnd:(c,l)=>i.findArithmeticExpansionEnd(c,l),findArithmeticWordEnd:(c,l)=>i.findArithmeticWordEnd(c,l)})??void 0;for(let c of o)if(c.inner!==void 0){if(n<=$t){let l=c.pos+2;c.script=Hg(r,l,l+c.inner.length,n+1)}c.inner=void 0}for(let c of s)c.parts=op(r,c,n);return a}function Kg(e){return e.token===p.Word&&e.keywordEligible&&e.value==="!"}function QD(e){return(t,r)=>{let n=t.slice(r.pos,r.end);return n===e?void 0:[{type:"Literal",value:e,text:n}]}}function cu(e){return e.length===0?[]:e}function ec(e){return new ex(e,0,e.length).run()}function Hg(e,t,r,n=0){return new ex(e,t,r,n).run()}class ex{tok;source;start;end;depth;errors=null;_redirects=Gr;syntaxDepth=0;constructor(e,t,r,n=0){this.tok=new xn(e,t,r),this.tok._nestingDepth=n,this.source=e,this.start=t,this.end=r,this.depth=n}run(){let e=this.start;if(this.depth>$t)this.error("maximum substitution nesting depth exceeded",e);let t;if(e===0&&this.source.charCodeAt(0)===35&&this.source.charCodeAt(1)===33){let s=this.source.indexOf(`
|
|
40
|
+
`);t=s===-1?this.source:this.source.slice(0,s)}let r=this.list();for(;;){let s=this.tok.peek(k.CommandStart);if(s.token===p.EOF)break;if(this.error(`unexpected token '${s.value}'`,s.pos),!Bt[s.token]&&s.token!==p.In)break;this.tok.next(k.CommandStart);let i=this.tok.peek(k.CommandStart).token;if(i!==p.Semi&&i!==p.Newline&&i!==p.Amp)break;while(i===p.Semi||i===p.Newline||i===p.Amp)this.tok.next(k.CommandStart),i=this.tok.peek(k.CommandStart).token;let a=this.list();for(let c=0;c<a.length;c++)r.push(a[c])}let n=this.tok._errors;if(n!==null&&n.length>0){let s=this.errors??=[];for(let i=0;i<n.length;i++)s.push(n[i])}if(this.errors!==null&&this.errors.length>1)this.errors.sort((s,i)=>s.pos-i.pos);return{type:"Script",pos:e,end:this.end,shebang:t,commands:r,errors:this.errors??void 0}}error(e,t){(this.errors??=[]).push({message:e,pos:t})}skipSemi(){if(this.tok.peek(k.Normal).token===p.Semi)this.tok.next(k.Normal)}accept(e,t=k.Normal){if(this.tok.peek(t).token===e)return this.tok.next(t);return null}acceptEnd(e,t=k.Normal){if(this.tok.peek(t).token===e)return this.tok.next(t).end;return-1}skipNewlines(e=k.Normal){while(this.tok.peek(e).token===p.Newline)this.tok.next(e)}makeStatement(e,t){let r=t.length>0?t[t.length-1].end:e.end;return{type:"Statement",pos:e.pos,end:r,command:e,background:void 0,redirects:cu(t)}}list(){let e=[];this.skipNewlines(k.CommandStart);let t=this.tok.peek(k.CommandStart).token;if(Bt[t]||!At[t])return e;let r=this.andOr();if(r){let n=this._redirects;this._redirects=Gr,e.push(this.makeStatement(r,n))}for(;;){if(t=this.tok.peekFollow(Uo).token,t!==p.Semi&&t!==p.Newline&&t!==p.Amp)break;let n=t===p.Amp,o=this.tok.next(k.Normal).end;if(n){let i=e[e.length-1];i.background=!0,i.end=o}if(this.skipNewlines(k.CommandStart),t=this.tok.peek(k.CommandStart).token,Bt[t]||!At[t])break;let s=this.andOr();if(s){let i=this._redirects;this._redirects=Gr,e.push(this.makeStatement(s,i))}}return e}andOr(){let e=this.pipeline();if(!e)return null;let t=this.tok.peek(k.Normal).token;if(t!==p.And&&t!==p.Or)return e;let r=e;if(this._redirects.length>0)r=this.makeStatement(e,this._redirects),this._redirects=Gr;let n=[r],o=[];do{let s=this.tok.next(k.Normal),i=s.token===p.And?"&&":"||";this.skipNewlines(k.CommandStart);let a=this.pipeline();if(!a){this.error(`expected command after '${i}'`,s.end);break}o.push(i),n.push(a),t=this.tok.peek(k.Normal).token}while(t===p.And||t===p.Or);return{type:"AndOr",pos:e.pos,end:n[n.length-1].end,commands:n,operators:o}}wrapCompoundRedirects(e){let t=this._redirects;if(this._redirects=Gr,t.length===0)return e;return this.makeStatement(e,t)}pipeline(){let e=!1,t=0,r=0,n=this.tok.peek(k.CommandStart);if(n.token===p.Word&&n.keywordEligible&&n.value==="time"){e=!0;let f=this.tok.next(k.CommandStart);t=f.pos,r=f.end;let d=this.tok.peek(k.CommandStart);if(d.token===p.Word&&d.keywordEligible&&d.value==="-p")r=this.tok.next(k.CommandStart).end}let o=!1,s=this.tok.peek(k.CommandStart);if(s.token===p.Bang){if(!e)t=s.pos;r=this.tok.next(k.CommandStart).end,o=!0;let f=this.tok.peek(k.CommandStart);if(f.token===p.Bang){this.error("unexpected token '!'",f.pos);do r=this.tok.next(k.CommandStart).end;while(this.tok.peek(k.CommandStart).token===p.Bang)}}let i=this.command();if(!i){if(e||o)return{type:"Pipeline",pos:t,end:r,commands:[],negated:o?!0:void 0,operators:[],time:e?!0:void 0};return null}if(!e&&!o)t=i.pos;let a=[i],c=[],l=this._redirects;this._redirects=Gr;while(this.tok.peek(k.Normal).token===p.Pipe){if(a.length===1&&l.length>0)a[0]=this.makeStatement(i,l),l=[];let f=this.tok.next(k.Normal),d=f.value==="|&"?"|&":"|";this.skipNewlines(k.CommandStart);let h=this.command();if(!h){this.error(`expected command after '${d}'`,f.end);break}c.push(d),a.push(this.wrapCompoundRedirects(h))}if(a.length===1&&!o&&!e)return this._redirects=l,a[0];if(l.length>0)a[0]=this.makeStatement(i,l);return{type:"Pipeline",pos:t,end:a[a.length-1].end,commands:a,negated:o?!0:void 0,operators:c,time:e?!0:void 0}}command(){switch(this.tok.peek(k.CommandStart).token){case p.LParen:return this.subshell();case p.LBrace:return this.braceGroup();case p.If:return this.ifClause();case p.For:return this.forClause();case p.While:return this.whileClause();case p.Until:return this.untilClause();case p.Case:return this.caseClause();case p.Function:return this.functionDef();case p.Select:return this.selectClause();case p.DblLBracket:return this.testCommand();case p.ArithCmd:return this.arithCommand();case p.Coproc:return this.coprocCommand();case p.Word:case p.Assignment:case p.Redirect:return this.simpleCommandOrFunction();default:return null}}collectTrailingRedirects(){let e=Gr;while(this.tok.peekFollow(Uo).token===p.Redirect)e=this.collectRedirect(e,k.Normal);return e}arithCommand(){let e=this.tok.next(k.CommandStart);return this._redirects=this.collectTrailingRedirects(),new c0(e.pos,e.end,e.value,this.source,this.depth)}coprocCommand(){let e=this.tok.next(k.CommandStart),{pos:t,end:r}=e,n=this.tok.peek(k.CommandStart);if(n.token!==p.Word&&n.token!==p.Assignment&&n.token!==p.Redirect){let u=this.pipeline()??{type:"Command",pos:t,end:r,name:void 0,prefix:[],suffix:[],redirects:[]},f=this._redirects;this._redirects=Gr;let d=this.collectTrailingRedirects(),h=[...f,...d],m=h.length>0?h[h.length-1].end:u.end;return{type:"Coproc",pos:t,end:m,name:void 0,body:u,redirects:h}}let o=this.toWord(this.tok.next(k.CommandStart)),s=this.pipeline();if(s===null){let u={type:"Command",pos:o.pos,end:o.end,name:o,prefix:[],suffix:[],redirects:[]},f=this.collectTrailingRedirects(),d=f.length>0?f[f.length-1].end:u.end;return{type:"Coproc",pos:t,end:d,name:void 0,body:u,redirects:cu(f)}}if(s.type==="Command"){let u=s;if(u.name)u.suffix=[u.name,...u.suffix];u.name=o,u.pos=o.pos;let f=this.collectTrailingRedirects(),d=f.length>0?f[f.length-1].end:u.end;return{type:"Coproc",pos:t,end:d,name:void 0,body:u,redirects:cu(f)}}let i=this._redirects;this._redirects=Gr;let a=this.collectTrailingRedirects(),c=[...i,...a],l=c.length>0?c[c.length-1].end:s.end;return{type:"Coproc",pos:t,end:l,name:o,body:s,redirects:c}}subshell(){return this.subshellBody(this.tok.next(k.CommandStart).pos)}subshellBody(e){if(this.syntaxDepth===$t){this.error("maximum subshell nesting depth exceeded",e);let o=this.tok.skipSubshellBody();if(o<0)this.error("expected ')' to close subshell",this.tok.getPos());let s=o>=0?o:e;return this._redirects=this.collectTrailingRedirects(),{type:"Subshell",pos:e,end:s,body:this.makeCompoundList([])}}this.syntaxDepth++;let t=this.list();this.syntaxDepth--;let r=this.acceptEnd(p.RParen,k.Normal);if(r<0)this.error("expected ')' to close subshell",this.tok.getPos());let n=r>=0?r:e;return this._redirects=this.collectTrailingRedirects(),{type:"Subshell",pos:e,end:n,body:this.makeCompoundList(t)}}braceGroup(){let e=this.tok.next(k.CommandStart).pos;if(this.syntaxDepth===$t){this.error("maximum brace group nesting depth exceeded",e);let o=this.tok.skipCompoundBody(p.RBrace);if(o<0)this.error("expected '}' to close brace group",this.tok.getPos());let s=o>=0?o:e;return this._redirects=this.collectTrailingRedirects(),{type:"BraceGroup",pos:e,end:s,body:this.makeCompoundList([])}}this.syntaxDepth++;let t=this.list();this.syntaxDepth--;let r=this.acceptEnd(p.RBrace,k.Normal);if(r<0)this.error("expected '}' to close brace group",this.tok.getPos());let n=r>=0?r:e;return this._redirects=this.collectTrailingRedirects(),{type:"BraceGroup",pos:e,end:n,body:this.makeCompoundList(t)}}ifClause(){let e=this.tok.next(k.CommandStart).pos;if(this.syntaxDepth===$t){this.error("maximum if nesting depth exceeded",e);let u=this.tok.skipCompoundBody(p.Fi);if(u<0)this.error("expected 'fi' to close 'if'",this.tok.getPos());let f=u>=0?u:e;return this._redirects=this.collectTrailingRedirects(),{type:"If",pos:e,end:f,clause:this.makeCompoundList([]),then:this.makeCompoundList([]),else:void 0}}this.syntaxDepth++;let t,r,n=e,o,s;for(;;){o=this.makeCompoundList(this.list()),this.skipSemi();let u=this.accept(p.Then,k.CommandStart);if(!u)this.error("expected 'then'",this.tok.getPos());let f=this.list();if(u&&f.length===0)this.error("expected command after 'then'",this.tok.peek(k.CommandStart).pos);s=this.makeCompoundList(f),this.skipSemi();let d=this.accept(p.Elif,k.CommandStart);if(!d)break;let h={type:"If",pos:n,end:n,clause:o,then:s,else:void 0};if(r)r.else=h;else t=h;r=h,n=d.pos}let i,a;if(this.accept(p.Else,k.CommandStart)){i=this.makeCompoundList(this.list()),this.skipSemi();let u=this.acceptEnd(p.Fi,k.CommandStart);if(u<0)this.error("expected 'fi' to close 'if'",this.tok.getPos());a=u>=0?u:n}else{let u=this.acceptEnd(p.Fi,k.CommandStart);if(u<0)this.error("expected 'fi' to close 'if'",this.tok.getPos());a=u>=0?u:n}this.syntaxDepth--,this._redirects=this.collectTrailingRedirects();let c={type:"If",pos:n,end:a,clause:o,then:s,else:i};if(!t)return c;r.else=c;let l=t;while(l!==c)l.end=a,l=l.else;return t}forClause(){let e=this.tok.next(k.CommandStart).pos;if(this.tok.peek(k.Normal).token===p.LParen)return this.cStyleFor(e);let t=this.readWord(k.Normal),r=[];if(this.skipNewlines(k.CommandStart),this.tok.peek(k.CommandStart).token===p.In){this.tok.next(k.CommandStart);while(this.tok.peek(k.Normal).token===p.Word)r.push(this.readWord(k.Normal))}if(this.skipSemi(),this.skipNewlines(k.CommandStart),this.tok.peek(k.CommandStart).token===p.LBrace){let i=this.braceGroup();return{type:"For",pos:e,end:i.end,name:t,wordlist:r,body:i.body}}if(!this.accept(p.Do,k.CommandStart))this.error("expected 'do'",this.tok.getPos());if(this.syntaxDepth===$t){this.error("maximum for nesting depth exceeded",e);let i=this.tok.skipCompoundBody(p.Done);if(i<0)this.error("expected 'done' to close 'for'",this.tok.getPos());let a=i>=0?i:e;return this._redirects=this.collectTrailingRedirects(),{type:"For",pos:e,end:a,name:t,wordlist:r,body:this.makeCompoundList([])}}this.syntaxDepth++;let n=this.list();this.syntaxDepth--,this.skipSemi();let o=this.acceptEnd(p.Done,k.CommandStart);if(o<0)this.error("expected 'done' to close 'for'",this.tok.getPos());let s=o>=0?o:e;return this._redirects=this.collectTrailingRedirects(),{type:"For",pos:e,end:s,name:t,wordlist:r,body:this.makeCompoundList(n)}}cStyleFor(e){let[t,r,n,o,s,i]=this.tok.readCStyleForExprs();if(this.tok.peek(k.CommandStart).token===p.Semi)this.tok.next(k.CommandStart);if(this.skipNewlines(k.CommandStart),this.tok.peek(k.CommandStart).token===p.LBrace){let u=this.braceGroup();return new sp(e,u.end,u.body,t,r,n,o,s,i,this.source,this.depth)}if(!this.accept(p.Do,k.CommandStart))this.error("expected 'do'",this.tok.getPos());if(this.syntaxDepth===$t){this.error("maximum for nesting depth exceeded",e);let u=this.tok.skipCompoundBody(p.Done);if(u<0)this.error("expected 'done' to close 'for'",this.tok.getPos());let f=u>=0?u:e;return this._redirects=this.collectTrailingRedirects(),new sp(e,f,this.makeCompoundList([]),t,r,n,o,s,i,this.source,this.depth)}this.syntaxDepth++;let a=this.list();this.syntaxDepth--;let c=this.acceptEnd(p.Done,k.CommandStart);if(c<0)this.error("expected 'done' to close 'for'",this.tok.getPos());let l=c>=0?c:e;return this._redirects=this.collectTrailingRedirects(),new sp(e,l,this.makeCompoundList(a),t,r,n,o,s,i,this.source,this.depth)}whileClause(){return this.whileOrUntil("while")}untilClause(){return this.whileOrUntil("until")}whileOrUntil(e){let t=this.tok.next(k.CommandStart).pos;if(this.syntaxDepth===$t){this.error(`maximum ${e} nesting depth exceeded`,t);let i=this.tok.skipCompoundBody(p.Done);if(i<0)this.error(`expected 'done' to close '${e}'`,this.tok.getPos());let a=i>=0?i:t;return this._redirects=this.collectTrailingRedirects(),{type:"While",pos:t,end:a,kind:e,clause:this.makeCompoundList([]),body:this.makeCompoundList([])}}this.syntaxDepth++;let r=this.makeCompoundList(this.list());if(this.skipSemi(),!this.accept(p.Do,k.CommandStart))this.error("expected 'do'",this.tok.getPos());let n=this.list();this.skipSemi();let o=this.acceptEnd(p.Done,k.CommandStart);if(o<0)this.error(`expected 'done' to close '${e}'`,this.tok.getPos());let s=o>=0?o:t;return this.syntaxDepth--,this._redirects=this.collectTrailingRedirects(),{type:"While",pos:t,end:s,kind:e,clause:r,body:this.makeCompoundList(n)}}caseClause(){let e=this.tok.next(k.CommandStart).pos,t=this.readWord(k.Normal);if(this.skipNewlines(k.CommandStart),!this.accept(p.In,k.CommandStart))this.error("expected 'in' after 'case' word",this.tok.getPos());if(this.skipNewlines(k.CommandStart),this.syntaxDepth===$t){this.error("maximum case nesting depth exceeded",e);let i=this.tok.skipCompoundBody(p.Esac);if(i<0)this.error("expected 'esac' to close 'case'",this.tok.getPos());let a=i>=0?i:e;return this._redirects=this.collectTrailingRedirects(),{type:"Case",pos:e,end:a,word:t,items:[]}}this.syntaxDepth++;let r=[],n=this.tok.peek(k.CommandStart).token;while(n!==p.Esac&&n!==p.EOF){let i=this.tok.peek(k.Normal).pos;this.accept(p.LParen,k.Normal);let a=[];n=this.tok.peek(k.Normal).token;while(n!==p.RParen&&n!==p.EOF){if(n!==p.Pipe)a.push(this.toWord(this.tok.next(k.Normal)));else this.tok.next(k.Normal);n=this.tok.peek(k.Normal).token}let c=this.acceptEnd(p.RParen,k.Normal),l=this.list(),u=c>=0?c:i;if(l.length>0)u=l[l.length-1].end;let f={type:"CaseItem",pos:i,end:u,pattern:a,body:this.makeCompoundList(l),terminator:void 0};if(n=this.tok.peek(k.CommandStart).token,n===p.DoubleSemi||n===p.SemiAmp||n===p.DoubleSemiAmp){let d=this.tok.next(k.CommandStart);f.terminator=wD[d.token],f.end=d.end}r.push(f),this.skipNewlines(k.CommandStart),n=this.tok.peek(k.CommandStart).token}let o=this.acceptEnd(p.Esac,k.CommandStart);if(o<0)this.error("expected 'esac' to close 'case'",this.tok.getPos());let s=o>=0?o:e;return this.syntaxDepth--,this._redirects=this.collectTrailingRedirects(),{type:"Case",pos:e,end:s,word:t,items:r}}selectClause(){let e=this.tok.next(k.CommandStart).pos,t=this.readWord(k.Normal),r=[];if(this.skipNewlines(k.CommandStart),this.tok.peek(k.CommandStart).token===p.In){this.tok.next(k.CommandStart);while(this.tok.peek(k.Normal).token===p.Word)r.push(this.readWord(k.Normal))}if(this.skipSemi(),this.skipNewlines(k.CommandStart),this.tok.peek(k.CommandStart).token===p.LBrace){let i=this.braceGroup();return{type:"Select",pos:e,end:i.end,name:t,wordlist:r,body:i.body}}if(!this.accept(p.Do,k.CommandStart))this.error("expected 'do'",this.tok.getPos());if(this.syntaxDepth===$t){this.error("maximum select nesting depth exceeded",e);let i=this.tok.skipCompoundBody(p.Done);if(i<0)this.error("expected 'done' to close 'select'",this.tok.getPos());let a=i>=0?i:e;return this._redirects=this.collectTrailingRedirects(),{type:"Select",pos:e,end:a,name:t,wordlist:r,body:this.makeCompoundList([])}}this.syntaxDepth++;let n=this.list();this.syntaxDepth--,this.skipSemi();let o=this.acceptEnd(p.Done,k.CommandStart);if(o<0)this.error("expected 'done' to close 'select'",this.tok.getPos());let s=o>=0?o:e;return this._redirects=this.collectTrailingRedirects(),{type:"Select",pos:e,end:s,name:t,wordlist:r,body:this.makeCompoundList(n)}}testCommand(){let e=this.tok.next(k.CommandStart).pos,t=this.parseTestOr(),r=this.acceptEnd(p.DblRBracket,k.TestMode);if(r<0)this.error("expected ']]' to close '[['",this.tok.getPos());let n=r>=0?r:e;return this._redirects=this.collectTrailingRedirects(),{type:"TestCommand",pos:e,end:n,expression:t}}parseTestOr(){let e=this.parseTestAnd();while(this.tok.peek(k.TestMode).token===p.Or){this.tok.next(k.TestMode);let t=this.parseTestAnd();e={type:"TestLogical",pos:e.pos,end:t.end,operator:"||",left:e,right:t}}return e}parseTestAnd(){let e=this.parseTestNot();while(this.tok.peek(k.TestMode).token===p.And){this.tok.next(k.TestMode);let t=this.parseTestNot();e={type:"TestLogical",pos:e.pos,end:t.end,operator:"&&",left:e,right:t}}return e}parseTestNot(){let e=this.tok.peek(k.TestMode);if(!Kg(e))return this.parseTestPrimary();let t=this.tok.next(k.TestMode).pos;if(e=this.tok.peek(k.TestMode),!Kg(e)){let o=this.parseTestPrimary();return{type:"TestNot",pos:t,end:o.end,operand:o}}let r=[t];while(Kg(e))r.push(this.tok.next(k.TestMode).pos),e=this.tok.peek(k.TestMode);let n=this.parseTestPrimary();for(let o=r.length-1;o>=0;o--)n={type:"TestNot",pos:r[o],end:n.end,operand:n};return n}parseTestPrimary(){if(this.tok.peek(k.TestMode).token===p.LParen){let i=this.tok.next(k.TestMode).pos;if(this.syntaxDepth===$t){this.error("maximum test group nesting depth exceeded",i);let u=this.tok.skipTestGroup();if(u<0)this.error("expected ')' to close test group",this.tok.getPos());let f=u>=0?u:i,d=new Et("",i,i,this.source,void 0,this.depth);return{type:"TestGroup",pos:i,end:f,expression:{type:"TestUnary",pos:i,end:i,operator:"-n",operand:d}}}this.syntaxDepth++;let a=this.parseTestOr();this.syntaxDepth--;let c=this.acceptEnd(p.RParen,k.TestMode);if(c<0)this.error("expected ')' to close test group",this.tok.getPos());let l=c>=0?c:i;return{type:"TestGroup",pos:i,end:l,expression:a}}let e=this.tok.next(k.TestMode),{value:t,pos:r,end:n}=e;if(e.keywordEligible&&vD[t]===1){if(this.tok.peek(k.TestMode).token===p.Word){let a=this.readWord(k.TestMode);return{type:"TestUnary",pos:r,end:a.end,operator:t,operand:a}}}let o=this.tok.peek(k.TestMode);if(o.token===p.Word&&o.keywordEligible&&CD[o.value]===1){let i=this.tok.next(k.TestMode).value,a;if(i==="=~"){let l=this.tok.readTestRegexWord();a=new Et(this.source.slice(l.pos,l.end),l.pos,l.end,this.source,op,this.depth)}else a=this.readWord(k.TestMode);let c=this.toWordFromPosEnd(e,r,n);return{type:"TestBinary",pos:r,end:a.end,operator:i,left:c,right:a}}let s=this.toWordFromPosEnd(e,r,n);return{type:"TestUnary",pos:r,end:s.end,operator:"-n",operand:s}}functionDef(){let e=this.tok.next(k.CommandStart).pos,t=this.readWord(k.Normal),r;if(this.tok.peek(k.CommandStart).token===p.LParen){let s=this.tok.next(k.CommandStart).pos;if(this.tok.peek(k.CommandStart).token===p.RParen)this.tok.next(k.CommandStart),this.skipNewlines(k.CommandStart),r=this.commandAsBody();else r=this.subshellBody(s)}else this.skipNewlines(k.CommandStart),r=this.commandAsBody();let n=this._redirects;this._redirects=Gr;let o=n.length>0?n[n.length-1].end:r.end;return{type:"Function",pos:e,end:o,name:t,body:r,redirects:cu(n)}}simpleCommandOrFunction(){let e=[],t=[],r=this.tok.peek(k.CommandStart).pos,n=r,o=k.CommandStart;for(;;){let a=this.tok.peek(o).token;if(a===p.Assignment){let c=this.tok.next(o);n=c.end,e.push(this.parseAssignment(c))}else if(a===p.Redirect)t=this.collectRedirect(t,o),n=t[t.length-1].end;else break;o=k.CommandPrefix}if(this.tok.peek(k.Normal).token!==p.Word)return{type:"Command",pos:r,end:n,name:void 0,prefix:e,suffix:[],redirects:t};let s=this.readWord(k.Normal);if(n=s.end,this.tok.peek(k.Normal).token===p.LParen){if(this.tok.next(k.Normal),this.tok.peek(k.Normal).token===p.RParen){this.tok.next(k.Normal),this.skipNewlines(k.CommandStart);let a=this.commandAsBody(),c=this._redirects;this._redirects=Gr;let l=c.length>0?c[c.length-1].end:a.end;return{type:"Function",pos:s.pos,end:l,name:s,body:a,redirects:cu(c)}}}let i=[];for(;;){let a=this.tok.peek(k.Normal).token;if(a===p.Word||a===p.Assignment){let c=this.readWord(k.Normal);i.push(c),n=c.end}else if(a===p.Redirect)t=this.collectRedirect(t,k.Normal),n=t[t.length-1].end;else break}return{type:"Command",pos:r,end:n,name:s,prefix:e,suffix:i,redirects:t}}collectRedirect(e,t){if(e===Gr)e=[];let r=this.tok.next(t),{pos:n,end:o}=r,s={pos:n,end:o,operator:TD[r.value]??">",target:void 0,fileDescriptor:r.fileDescriptor,variableName:r.variableName,content:r.content,heredocQuoted:void 0,body:void 0};if(r.targetEnd>r.targetPos){let a=r.value==="<<"||r.value==="<<-"?QD(r.content??""):void 0,c=this.source.slice(r.targetPos,r.targetEnd);s.target=new Et(c,r.targetPos,r.targetEnd,this.source,a,this.depth)}else this.error("expected redirect target",r.targetPos);if(s.target&&(r.value==="<<"||r.value==="<<-"))this.tok.registerHereDocTarget(s);return e.push(s),e}commandAsBody(){let e=this.tok.peek(k.CommandStart).token;if(e===p.LBrace)return this.braceGroup();if(e===p.LParen)return this.subshell();let t=this.command(),r=this.tok.getPos();return t??{type:"CompoundList",pos:r,end:r,commands:[]}}readWord(e){return this.toWord(this.tok.next(e))}toWord(e){let t=e.raw?e.value:this.source.slice(e.pos,e.end);return new Et(t,e.pos,e.end,this.source,void 0,this.depth)}toWordFromPosEnd(e,t,r){let n=e.raw&&e.pos===t&&e.end===r?e.value:this.source.slice(t,r);return new Et(n,t,r,this.source,void 0,this.depth)}parseAssignment(e){let t=e.raw?e.value:this.source.slice(e.pos,e.end),{pos:r,end:n}=e,o={type:"Assignment",pos:r,end:n,text:t,name:void 0,value:void 0,append:void 0,index:void 0,indexParts:void 0,array:void 0},s=e.assignmentOperatorPos-r;if(s<=0)return o;let i=s,a=!1,c,l=s;while(l>=2&&t.charCodeAt(l-2)===92&&t.charCodeAt(l-1)===10)l-=2;if(t.charCodeAt(l-1)===43)a=!0,i=l-1;let u=t.indexOf("[");if(u>0&&u<i){let b=t.lastIndexOf("]",s);if(b>u)c=t.slice(u+1,b),i=u}let f=t.slice(0,i),d=f.includes("\\\n")?f.split("\\\n").join(""):f;if(o.name=d,a)o.append=!0;if(c!==void 0){o.index=c;let b=r+u+1,x=b+c.length;if($s(this.source,b,x)){let O=new Et(c,b,x,this.source,op,this.depth);Object.defineProperty(o,"indexParts",{configurable:!0,enumerable:!0,get:()=>O.parts,set:(S)=>{O.parts=S}})}}let h=s+1,m=r+h;if(h<t.length&&t.charCodeAt(h)===40&&t.charCodeAt(t.length-1)===41){let b=this.parseArrayElements(m+1,n-1);o.array=b}else o.value=new Et(t.slice(h),m,n,this.source,void 0,this.depth);return o}parseArrayElements(e,t){let r=new xn(this.source,e,t),n=[];while(r.peek(k.Normal).token!==p.EOF){if(r.peek(k.Normal).token===p.Newline){r.next(k.Normal);continue}let o=r.next(k.Normal);if(o.token===p.Word||o.token===p.Assignment){let s=o.raw?o.value:this.source.slice(o.pos,o.end);n.push(new Et(s,o.pos,o.end,this.source,void 0,this.depth))}}return n}makeCompoundList(e){let t=this.tok.getPos(),r=e.length>0?e[0].pos:t,n=e.length>0?e[e.length-1].end:t;return{type:"CompoundList",pos:r,end:n,commands:e}}}var wD,TD,Bt,Uo,At,vD,CD,Gr;var Jg=E(()=>{Gg();Vg();a0();Et._resolveWord=s0;Et._resolveHeredocBody=i0;wD={[p.DoubleSemi]:";;",[p.SemiAmp]:";&",[p.DoubleSemiAmp]:";;&"},TD={">":">",">>":">>","<":"<","<<":"<<","<<-":"<<-","<<<":"<<<","<>":"<>","<&":"<&",">&":">&",">|":">|","&>":"&>","&>>":"&>>"};Bt=new Uint8Array(37);Bt[p.EOF]=1;Bt[p.RParen]=1;Bt[p.RBrace]=1;Bt[p.Then]=1;Bt[p.Else]=1;Bt[p.Elif]=1;Bt[p.Fi]=1;Bt[p.Do]=1;Bt[p.Done]=1;Bt[p.Esac]=1;Bt[p.DoubleSemi]=1;Bt[p.SemiAmp]=1;Bt[p.DoubleSemiAmp]=1;Uo=new Uint8Array(37);Uo[p.RParen]=1;Uo[p.RBrace]=1;Uo[p.DblRBracket]=1;Uo[p.Fi]=1;Uo[p.Done]=1;Uo[p.Esac]=1;Uo[p.ArithCmd]=1;At=new Uint8Array(37);At[p.Word]=1;At[p.Assignment]=1;At[p.Bang]=1;At[p.LParen]=1;At[p.LBrace]=1;At[p.DblLBracket]=1;At[p.If]=1;At[p.For]=1;At[p.While]=1;At[p.Until]=1;At[p.Case]=1;At[p.Function]=1;At[p.Select]=1;At[p.ArithCmd]=1;At[p.Coproc]=1;At[p.Redirect]=1;vD={"-a":1,"-b":1,"-c":1,"-d":1,"-e":1,"-f":1,"-g":1,"-h":1,"-k":1,"-p":1,"-r":1,"-s":1,"-t":1,"-u":1,"-v":1,"-w":1,"-x":1,"-z":1,"-n":1,"-o":1,"-N":1,"-S":1,"-L":1,"-G":1,"-O":1,"-R":1},CD={"==":1,"!=":1,"=~":1,"=":1,"-eq":1,"-ne":1,"-lt":1,"-le":1,"-gt":1,"-ge":1,"-nt":1,"-ot":1,"-ef":1,"<":1,">":1};Gr=[]});var $i=(e)=>({start:e.pos,end:e.end}),Is=(e)=>{let t=e.lastIndexOf("/");return t===-1?e:e.slice(t+1)},tc=(e)=>{if(e.name===void 0||e.prefix.length>0||e.redirects.length>0||!Ro(e.name)||e.suffix.some((t)=>!Ro(t)))return null;return[e.name,...e.suffix].map((t)=>({source:t.text,value:t.value,kind:"literal",range:$i(t),quoted:(t.parts??[]).some((r)=>r.type==="SingleQuoted"||r.type==="DoubleQuoted"||r.type==="AnsiCQuoted"||r.type==="LocaleString")}))};var ap=E(()=>{Ga()});var Fs,f0,l0,tx=(e,t,r)=>{let n=t;while(n<e.length){let o=e[n]?.value;if(o===void 0)break;if(r.has(o))n+=2;else if(o.includes("=")&&r.has(o.slice(0,o.indexOf("="))))n+=1;else if(o==="--")return n+1;else if(o.startsWith("-")&&o!=="-")n+=1;else break}return n},cp=(e)=>{let t=Object.hasOwn(l0,e.head)?l0[e.head]??new Set:new Set,r=tx(e.words,1,t);if(e.head==="env")while(/^[A-Za-z_][A-Za-z0-9_]*=/u.test(e.words[r]?.value??""))r+=1;return r},rc=(e,t)=>{for(let r=1;r<e.length-1;r+=1){let n=e[r]?.value;if(n!==void 0&&(n===`-${t}`||n.startsWith("-")&&!n.startsWith("--")&&n.slice(1).includes(t)))return r+1}return null},lp=(e,t,r=1)=>{for(let n=r;n<e.length;n+=1){let o=e[n]?.value;if(o!==void 0){if(t.has(o))return n+1<e.length?n+1:null;for(let s of t)if(o.startsWith(`${s}=`))return n}}return null},_D,$D=(e)=>e==="/"||e==="~"||e==="."||e===".."||e.startsWith("/")||e.startsWith("~/")||e.startsWith("./")||e.startsWith("../")||/^\$\{?HOME\}?(?:\/|$)/u.test(e),u0=(e)=>{if(e==="/")return 100;if(e==="~"||/^\$\{?HOME\}?(?:\/|$)/u.test(e))return 90;if(/^\/(?:etc|usr|bin|sbin|System|Library|var|boot|root|home)(?:\/|$)/u.test(e))return 80;if(e.startsWith("/Users/"))return 70;if(e.startsWith("/"))return 60;if(e.startsWith("../"))return 40;return 10},d0=(e,t,r)=>{let n=[];for(let o=1;o<t;o+=1){let s=e[o];if(s!==void 0&&r==="fd"&&_D.has(s.value))o+=1;else if(s?.value.startsWith("-")===!0){if(r==="find")break}else if(s!==void 0&&$D(s.value))n.push(s)}return n.sort((o,s)=>u0(s.value)-u0(o.value)),n[0]??{source:".",value:".",kind:"literal",range:e[0]?.range??{start:0,end:0},quoted:!1}},rx,p0,h0,m0,O0,nx;var up=E(()=>{Fs=new Set(["sh","bash","zsh","dash","ksh","ash"]),f0=new Set(["command","exec","env","time","nohup","setsid","nice","ionice","chronic","stdbuf","unbuffer","taskset","sudo","doas","xargs","watch"]),l0={env:new Set(["-u","--unset","-C","--chdir","-S","--split-string","--block-signal"]),time:new Set(["-f","--format","-o","--output"]),nice:new Set(["-n","--adjustment"]),ionice:new Set(["-c","--class","-n","--classdata","-p","--pid"]),stdbuf:new Set(["-i","--input","-o","--output","-e","--error"]),sudo:new Set(["-u","--user","-g","--group","-C","--close-from","-D","--chdir","-h","--host","-p","--prompt","-r","--role","-t","--type","-U","--other-user","-R","--chroot","-T","--command-timeout"]),doas:new Set(["-a","-C","-u"]),xargs:new Set(["-I","-i","-J","-n","--max-args","-P","--max-procs","-s","--max-chars","-L","--max-lines","-E","--eof","-d","--delimiter","-a","--arg-file","--replace"]),watch:new Set(["-n","--interval"])},_D=new Set(["-e","--extension","-t","--type","-E","--exclude","-d","--max-depth","--min-depth","--exact-depth","-c","--color","--changed-within","--changed-before","-S","--size","-o","--owner","-j","--threads","-g","--glob","--format","--max-results","--ignore-file","--search-path","--base-directory","--path-separator","--and"]),rx=new Set(["-x","-X","--exec","--exec-batch"]),p0=new Set(["{}","{/}","{//}","{.}","{/.}"]),h0=new Set(["-exec","-execdir","-ok","-okdir"]),m0=new Set(["{}"]),O0=new Set(["run","proxy","err","test","summary"]),nx={timeout:{valueFlags:new Set(["-s","--signal","-k","--kill-after"]),skipPositionals:1,shellFlag:!1},gtimeout:{valueFlags:new Set(["-s","--signal","-k","--kill-after"]),skipPositionals:1,shellFlag:!1},chroot:{valueFlags:new Set(["--userspec","--groups"]),skipPositionals:1,shellFlag:!1},flock:{valueFlags:new Set(["-w","--wait","--timeout","-E","--conflict-exit-code"]),skipPositionals:1,shellFlag:!0},su:{valueFlags:new Set,skipPositionals:0,shellFlag:!0}}});class ox{#t;#e;constructor(e,t){this.#e=e,this.#t=[...t].toSorted((r,n)=>n.command.length-r.command.length)}isCarrierCommand(e){let t=tc(e);return t!==null&&this.#r(t)!==null}inspect(e,t,r){let n=this.#r(e.words);if(n===null)return!1;this.#s(n.words,t,r);let o=ID(n.words);if(o===null){if(n.words.some((l)=>l.value==="-Q"||l.value==="-V"))return!0;return this.#e.addDiagnostic("dynamic-shell-source","Tripwire cannot identify the SSH destination and remote command safely.",e.range),!0}let s=n.words.slice(o);if(s.length===0){let l=n.words.some((u)=>u.value==="-N"||u.value==="-G"||u.value==="-Q"||u.value==="-V"||u.value==="-W"||u.value.startsWith("-W"));if(!r.inspectedPipelineInput&&!l)this.#e.addDiagnostic("dynamic-shell-source","An interactive remote shell has no command source that Tripwire can inspect.",e.range);return!0}let i=s.find((l)=>l.kind!=="literal");if(i!==void 0)return this.#e.addDiagnostic("dynamic-shell-source","The remote shell command is computed at runtime.",i.range),!0;if(r.inspectedPipelineInput&&Fs.has(Is(s[0]?.value??""))&&rc(s,"c")===null)return this.#e.emitSynthetic(s,e,t,{...r,inspectedPipelineInput:!0}),!0;let[a]=s,c=s.at(-1);if(a!==void 0&&c!==void 0){let l=s.map((u)=>u.value).join(" ");this.#e.inspectShellSource({source:l,value:l,kind:"literal",range:{start:a.range.start,end:c.range.end},quoted:!0},t,{...r,inspectedPipelineInput:!1})}return!0}#r(e){let[t]=e;if(t!==void 0&&Is(t.value)==="ssh")return{kind:"ssh",words:e};for(let r of this.#t)if(r.command.every((n,o)=>e[o]?.value===n)&&r.command.length<=e.length){let[n]=e;if(n===void 0)return null;return{kind:r.equivalentTo,words:[{...n,source:r.equivalentTo,value:r.equivalentTo},...e.slice(r.command.length)]}}return null}#s(e,t,r){for(let n=1;n<e.length;n+=1){let o=RD(e,n);if(n=o.nextIndex,o.opaqueConfig!==void 0)this.#e.addDiagnostic("dynamic-shell-source","An explicit SSH configuration file may contain executable commands that Tripwire has not inspected.",o.opaqueConfig.range);else if(o.source!==void 0)this.#e.inspectShellSource(o.source,t,{...r,inspectedPipelineInput:!1})}}}var AD,RD=(e,t)=>{let r=e[t];if(r===void 0)return{nextIndex:t,opaqueConfig:void 0,source:void 0};if(r.value==="-F"||r.value.startsWith("-F"))return{nextIndex:r.value==="-F"?t+1:t,opaqueConfig:r,source:void 0};let n=t,o;if(r.value==="-o")n+=1,o=e[n];else if(r.value.startsWith("-o"))o={...r,source:r.source.slice(2),value:r.value.slice(2)};let s=o===void 0?null:/^(?<key>[A-Za-z]+)(?:=|\s+)(?<source>[\s\S]+)$/u.exec(o.value),i=s?.groups?.key?.toLowerCase(),a=s?.groups?.source,c=o!==void 0&&a!==void 0&&a!=="none"&&i!==void 0&&["localcommand","proxycommand","remotecommand"].includes(i)?{...o,source:a,value:a}:void 0;return{nextIndex:n,opaqueConfig:void 0,source:c}},ID=(e)=>{let t=1;while(t<e.length){let n=e[t];if(n?.kind!=="literal")return null;if(n.value==="--"){t+=1;break}if(AD.has(n.value)){if(e[t+1]?.kind!=="literal")return null;t+=2}else if(n.value.startsWith("-")&&n.value!=="-")t+=1;else break}return e[t]?.kind==="literal"?t+1:null};var g0=E(()=>{ap();up();AD=new Set(["-B","-b","-c","-D","-E","-e","-F","-I","-i","-J","-L","-l","-m","-O","-o","-p","-Q","-R","-S","-W","-w"])});class sx{#t;#e;constructor(e,t){this.#e=e,this.#t=t}inspect(e,t,r){let n=new Set;return this.#r(e,t,r,n),this.#s(e,t,r,n),n}#r(e,t,r,n){for(let o=0;o<e.length-1;o+=1){let s=e[o],i=e[o+1];if(s?.type==="Command"&&i?.type==="Command"&&i.name!==void 0&&Fs.has(Is(i.name.value))){for(let a of s.redirects)if((a.operator==="<<"||a.operator==="<<-")&&a.content!==void 0)this.#e.inspectShellSource({source:a.content,value:a.content,kind:"literal",range:$i(a),quoted:a.heredocQuoted===!0},t,r),n.add(o+1)}}}#s(e,t,r,n){for(let o=0;o<e.length-2;o+=1){let s=e[o],i=e[o+1],a=e[o+2];if(s?.type==="Command"&&i?.type==="Command"&&a?.type==="Command"&&this.#a(a)){let c=FD(s,i),l=c===null?null:UD(c);if(l!==null)this.#e.inspectShellSource({source:l,value:l,kind:"literal",range:$i(s),quoted:!0},t,r),n.add(o+2)}}}#a(e){let t=tc(e);if(t===null)return!1;if(Fs.has(Is(t[0]?.value??"")))return rc(t,"c")===null;return this.#t.isCarrierCommand(e)}}var FD=(e,t)=>{let r=tc(e),n=tc(t);if(r===null||n===null||Is(n[0]?.value??"")!=="base64"||n.length!==2||!["-d","-D","--decode"].includes(n[1]?.value??""))return null;let o=Is(r[0]?.value??""),s=r.slice(1).map((i)=>i.value);if(o==="printf"&&s.length===2){let[i,a]=s;return i==="%s"||i===String.raw`%s\n`?a??null:null}if(o==="echo"){let i=s.filter((a)=>a!=="-n");return i.length===1?i[0]??null:null}return null},UD=(e)=>{if(e.length===0||e.length>1048576||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u.test(e))return null;let t=Buffer.from(e,"base64");if(t.toString("base64")!==e||t.includes(0))return null;try{return new TextDecoder("utf-8",{fatal:!0}).decode(t)}catch{return null}};var x0=E(()=>{ap();up()});class ix{#t;#e;#r;constructor(e,t){this.#e=e,this.#t=new ox(e,t),this.#r=new sx(e,this.#t)}inspectShellInput(e,t,r,n){if(!Fs.has(e.head))return!1;let o=n.inspectedPipelineInput;for(let[s,i]of t.entries())if((i.operator==="<<"||i.operator==="<<-")&&i.content!==void 0){let a={source:i.content,value:i.content,kind:"literal",range:$i(i),quoted:i.heredocQuoted===!0};this.#e.inspectShellSource(a,r,n),o=!0}else if(i.operator==="<<<")this.#e.inspectShellSource(e.redirects[s]?.target,r,n),o=!0;else if(i.operator==="<")this.#e.addDiagnostic("dynamic-shell-source","A shell wrapper reads program source from a file that Tripwire has not inspected.",$i(i));return o}inspectWrapper(e,t,r,n=!1){if(e.head==="eval"||this.#t.inspect(e,t,r)||this.#s(e,t,r,n)||this.#a(e,t,r))return;this.#u(e,t,r)}inspectPipelineInputs(e,t,r){return this.#r.inspect(e,t,r)}#s(e,t,r,n){if(!Fs.has(e.head))return!1;let o=rc(e.words,"c");if(o!==null)return this.#e.inspectShellSource(e.words[o],t,r),!0;if(!(n||e.tokens.includes("-n")||e.tokens.includes("--noexec")||e.tokens.includes("--help")||e.tokens.includes("--version")))this.#e.addDiagnostic("dynamic-shell-source","A shell wrapper has no inline program source that Tripwire can inspect.",e.range);return!0}#a(e,t,r){switch(e.head){case"trap":return this.#d(e,t,r),!0;case"script":{let n=lp(e.words,new Set(["-c","--command"]));if(n!==null)this.#e.inspectShellSource(e.words[n],t,r);return!0}case"watch":return this.#o(e,t,r),!0;case"xargs":return this.#p(e,t,r),!0;default:return!1}}#o(e,t,r){let n=cp(e),o=e.words.slice(n);if(e.tokens.includes("-x")||e.tokens.includes("--exec")){this.#e.emitSynthetic(o,e,t,r);return}let[s]=o,i=o.at(-1),a=o.find((c)=>c.kind==="dynamic");if(a!==void 0){this.#e.addDiagnostic("dynamic-shell-source","watch receives command text that is computed at runtime.",a.range);return}if(s!==void 0&&i!==void 0){let c=o.map((l)=>l.value).join(" ");this.#e.inspectShellSource({source:c,value:c,kind:"literal",range:{start:s.range.start,end:i.range.end},quoted:!0},t,r)}}#u(e,t,r){if(f0.has(e.head)){let n=cp(e);this.#e.emitSynthetic(e.words.slice(n),e,t,r)}else if(e.head==="fd"||e.head==="fdfind")this.#f(e,rx,p0,t,r);else if(e.head==="find"||e.head==="gfind")this.#f(e,h0,m0,t,r);else if(e.head==="rtk")this.#n(e,t,r);else{let n=Object.hasOwn(nx,e.head)?nx[e.head]:void 0;if(n!==void 0)this.#m(e,n,t,r)}}#d(e,t,r){let[,n,o]=e.words,s=n?.value==="--"?o:n;if(s===void 0||s.value===""||s.value==="-"||s.value==="-p"||s.value==="-l")return;this.#e.inspectShellSource(s,t,r)}#p(e,t,r){let n=cp(e),o=e.words.slice(n),s=o[0]??{kind:"literal",quoted:!1,range:e.range,source:"echo",value:"echo"},i={kind:"dynamic",quoted:!1,range:e.range,source:"<xargs-input>",value:vi};this.#e.emitSynthetic([s,...o.slice(1),i],e,t,r)}#f(e,t,r,n,o){for(let s=1;s<e.words.length;s+=1){let i=e.words[s];if(i!==void 0&&t.has(i.value)){let a=[],c=d0(e.words,s,t===rx?"fd":"find");for(let l=s+1;l<e.words.length;l+=1){let u=e.words[l];if(u===void 0||u.value===";"||u.value==="+")break;a.push(r.has(u.value)?c:u)}this.#e.emitSynthetic(a,e,n,o)}}}#n(e,t,r){let n=1;while(e.words[n]?.value.startsWith("-")===!0)n+=1;let o=e.words[n]?.value;if(o===void 0)return;if(O0.has(o)){let s=lp(e.words,new Set(["-c","--command"]),n+1);if(s!==null){this.#e.inspectShellSource(e.words[s],t,r);return}this.#e.emitSynthetic(e.words.slice(n+1),e,t,r);return}this.#e.emitSynthetic(e.words.slice(n),e,t,r)}#m(e,t,r,n){if(t.shellFlag){let s=lp(e.words,new Set(["-c","--command"]));if(s!==null){this.#e.inspectShellSource(e.words[s],r,n);return}}let o=tx(e.words,1,t.valueFlags);o+=t.skipPositionals,this.#e.emitSynthetic(e.words.slice(o),e,r,n)}}var y0=E(()=>{g0();x0();ap();Ga();up()});class E0{#t;#e=[];#r=[];#s=[];#a=new Set;#o=[];#u=new WeakSet;#d=new Set;#p=new Set;#f=[];#n;#m;#O=1;#S=1;constructor(e,t){this.#t=e,this.#m=t,this.#n=new ix({addDiagnostic:(r,n,o)=>{this.#c(r,n,o)},emitSynthetic:(r,n,o,s)=>{this.#T(r,n,o,s)},inspectShellSource:(r,n,o)=>{this.#D(r,n,o)}},t.executionCarrierAliases??[])}analyze(e){let t=qg(),r=(n,o)=>{t.bindings.set(n,{source:o,value:o,kind:"literal",range:{start:0,end:0},quoted:!0,variable:n})};if(this.#m.cwd!==void 0)r("PWD",this.#m.cwd);for(let[n,o]of(this.#m.positionalArguments??[]).entries())r((n+1).toString(),o);return this.#g(e,t,{inspectedPipelineInput:!1,source:this.#t,pipeline:void 0}),{source:this.#t,invocations:this.#e,redirects:this.#r,diagnostics:this.#s,environmentAssignments:[...this.#a],hasBypass:this.#N()}}#c(e,t,r){this.#s.push({kind:e,message:t,range:r})}#g(e,t,r){if(this.#u.has(e))return;this.#u.add(e);let n=e.source??r.source;for(let o of e.errors??[])this.#c("parse-error",o.message,{start:o.pos,end:o.pos});this.#E(e.commands,t,{...r,source:n})}#E(e,t,r){for(let n of e)this.#k(n,t,r)}#k(e,t,r){if(this.#b(e.redirects,t,r),this.#l(e.command,t,r),e.background===!0)t.backgroundPidAvailable=!0}#l(e,t,r){if(this.#v(e,t,r)||this.#C(e,t,r)||this.#Q(e,t,r))return;this.#c("parse-error",`Unknown Bash AST node: ${e.type}`,yn(e))}#v(e,t,r){if(e.type==="Statement")return this.#k(e,t,r),!0;if(e.type==="Command")return this.#_(e,t,r),!0;if(e.type==="CompoundList")return this.#E(e.commands,t,r),!0;if(e.type==="Pipeline"){let n=this.#S;this.#S+=1;let o=this.#n.inspectPipelineInputs(e.commands,t,r);for(let[s,i]of e.commands.entries())this.#l(i,Pt(t),{...r,inspectedPipelineInput:o.has(s),pipeline:{id:n,index:s}});return!0}if(e.type==="AndOr"){let n=Pt(t);for(let o of e.commands)this.#l(o,n,r);return cx(t,ax([t,n])),!0}return!1}#C(e,t,r){if(e.type==="If"){let n=Pt(t);this.#l(e.clause,n,r);let o=Pt(n);this.#l(e.then,o,r);let s=Pt(n);if(e.else!==void 0)this.#l(e.else,s,r);return cx(t,ax([o,s])),!0}if(e.type==="For"||e.type==="Select"){let n=this.#i(e.name,t,r),o=e.wordlist.map((s)=>this.#i(s,t,r));if(n.kind==="literal"&&/^[A-Za-z_][A-Za-z0-9_]*$/u.test(n.value)&&o.length>0&&o.length<=32&&o.every((s)=>s.kind==="literal"))for(let s of o){let i=Pt(t);i.temps.delete(n.value),i.bindings.set(n.value,s),this.#l(e.body,i,r)}else{let s=Pt(t);s.temps.delete(n.value),s.bindings.delete(n.value),this.#l(e.body,s,r)}return!0}if(e.type==="ArithmeticFor")return this.#h(e.initialize,t,r),this.#h(e.test,t,r),this.#h(e.update,t,r),this.#l(e.body,Pt(t),r),!0;if(e.type==="While"){let n=Pt(t);return this.#l(e.clause,n,r),this.#l(e.body,n,r),!0}if(e.type==="Function"){let n=this.#i(e.name,t,r);if(n.kind!=="literal"||!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(n.value))this.#c("function","The function name is not static.",yn(e));else t.functions.set(n.value,e);return!0}return!1}#Q(e,t,r){if(e.type==="Subshell")return this.#l(e.body,Pt(t),r),!0;if(e.type==="BraceGroup")return this.#l(e.body,t,r),!0;if(e.type==="Case"){this.#i(e.word,t,r);let n=[Pt(t)];for(let o of e.items){for(let i of o.pattern)this.#i(i,t,r);let s=Pt(t);this.#l(o.body,s,r),n.push(s)}return cx(t,ax(n)),!0}if(e.type==="Coproc"){if(e.name!==void 0)this.#i(e.name,t,r);return this.#b(e.redirects,t,r),this.#l(e.body,Pt(t),r),!0}if(e.type==="TestCommand")return this.#y(e.expression,t,r),!0;if(e.type==="ArithmeticCommand")return this.#h(e.expression,t,r),!0;return!1}#_(e,t,r){let n=e.prefix.flatMap((l)=>{let u=this.#$(l,t,r);return u===null?[]:[u]});if(e.name===void 0)for(let l of n)S0(l,t);let o=this.#b(e.redirects,t,r);if(e.name===void 0)return;let s=this.#i(e.name,t,r),i=e.suffix.flatMap((l)=>this.#P(l,t,r));if(s.kind==="literal"&&t.functions.has(s.value)){this.#R(s.value,i,n,t,r);return}if(s.kind==="literal"&&t.aliases.has(s.value)){this.#I(s.value,i,t,r,yn(e));return}let a=this.#w([s,...i],o,yn(e),r,!1);if(a===null)return;if(a.head==="alias"){this.#F(a,t);return}if(a.head==="unalias"){this.#U(a,t);return}let c=this.#n.inspectShellInput(a,e.redirects,t,r);this.#n.inspectWrapper(a,t,r,c),this.#M(a,t)}#$(e,t,r){for(let i of e.indexParts??[])this.#x(i,t,r);for(let i of e.array??[])this.#i(i,t,r);let n=e.value===void 0?void 0:this.#i(e.value,t,r);if(e.name===void 0)return null;this.#a.add(e.name);let o=e.append!==!0&&e.index===void 0&&e.array===void 0&&e.value!==void 0&&Xv(e.value,t);return{binding:ND(e,n,t)?n:void 0,name:e.name,trustedTemp:o}}#P(e,t,r){let n=this.#i(e,t,r);if(n.kind!=="literal"||n.quoted||!/[*?[]/u.test(n.value))return[n];try{let o=[...new Bun.Glob(n.value).scanSync({onlyFiles:!1,dot:!0})];if(o.length===0)return[n];let s=[];for(let i of o)s.push({source:n.source,value:i,kind:n.kind,range:n.range,quoted:n.quoted});return s}catch{return[n]}}#i(e,t,r){for(let a of e.parts??[])this.#x(a,t,r);let n=Bv(e,t);if(n!==null)return n;let o=Xg(e,t);if(o!==null)return o;let s=zg(e,t);if(s!==null)return s;if(Ro(e))return{source:e.text,value:e.value,kind:"literal",range:yn(e),quoted:(e.parts??[]).some((a)=>Wg(a))};let i=Lg(e,t);if(i!==null)return{source:e.text,value:i,kind:"literal",range:yn(e),quoted:!0};return{source:e.text,value:e.value,kind:"dynamic",range:yn(e),quoted:(e.parts??[]).some((a)=>Wg(a))}}#x(e,t,r){switch(e.type){case"Literal":case"SingleQuoted":case"AnsiCQuoted":case"SimpleExpansion":return;case"DoubleQuoted":case"LocaleString":{for(let n of e.parts)this.#x(n,t,r);return}case"ParameterExpansion":{this.#A(e,t,r);return}case"CommandExpansion":case"ProcessSubstitution":{if(e.script!==void 0)this.#g(e.script,Pt(t),r);return}case"ArithmeticExpansion":{this.#h(e.expression,t,r);return}case"ExtendedGlob":case"BraceExpansion":{for(let n of e.parts??[])this.#x(n,t,r);break}default:break}}#A(e,t,r){for(let n of e.indexParts??[])this.#x(n,t,r);if(e.operand!==void 0)this.#i(e.operand,t,r);if(e.slice!==void 0){if(this.#i(e.slice.offset,t,r),e.slice.length!==void 0)this.#i(e.slice.length,t,r)}if(e.replace!==void 0)this.#i(e.replace.pattern,t,r),this.#i(e.replace.replacement,t,r)}#h(e,t,r){if(e===void 0)return;switch(e.type){case"ArithmeticBinary":{this.#h(e.left,t,r),this.#h(e.right,t,r);return}case"ArithmeticUnary":{this.#h(e.operand,t,r);return}case"ArithmeticTernary":{this.#h(e.test,t,r),this.#h(e.consequent,t,r),this.#h(e.alternate,t,r);return}case"ArithmeticGroup":{this.#h(e.expression,t,r);return}case"ArithmeticWord":{for(let n of e.parts??[])this.#x(n,t,r);return}case"ArithmeticCommandExpansion":{if(e.script!==void 0)this.#g(e.script,Pt(t),r);break}default:break}}#y(e,t,r){switch(e.type){case"TestUnary":{this.#i(e.operand,t,r);return}case"TestBinary":{this.#i(e.left,t,r),this.#i(e.right,t,r);return}case"TestLogical":{this.#y(e.left,t,r),this.#y(e.right,t,r);return}case"TestNot":{this.#y(e.operand,t,r);return}case"TestGroup":{this.#y(e.expression,t,r);break}default:break}}#b(e,t,r){let n=[];for(let o of e){if(o.body!==void 0)this.#o.push(yn(o.body)),this.#i(o.body,t,r);else if(o.content!==void 0){let c=r.source.indexOf(o.content,o.end);if(c!==-1)this.#o.push({start:c,end:c+o.content.length})}let s=o.target===void 0?{source:"",value:vi,kind:"dynamic",range:yn(o),quoted:!1}:this.#i(o.target,t,r),i;if(o.operator==="<<-")i="<<";else if(o.operator===">|")i=">";else i=o.operator;let a={op:i,target:s,range:yn(o),...o.content!==void 0&&{heredoc:{content:o.content,quoted:o.heredocQuoted===!0}}};n.push(a),this.#r.push(a)}return n}#w(e,t,r,n,o){let[s]=e;if(s===void 0)return null;if(s.kind!=="literal")return this.#c("dynamic-executable","The executable name is computed at runtime.",s.range),null;let i=e.map((u)=>u.value),a=i.slice(1).filter((u)=>u.startsWith("-")&&u!=="-"),c=i.slice(1).filter((u)=>!u.startsWith("-")||u==="-"),l={id:this.#O,head:DD(s.value),words:e,tokens:i,args:c,flags:a,redirects:t,raw:o?e.map((u)=>u.source).join(" "):n.source.slice(r.start,r.end),range:r,pipeline:n.pipeline,synthetic:o};if(this.#O+=1,this.#e.push(l),l.head==="eval")this.#c("eval","`eval` can turn computed data into shell syntax.",r);return l}#R(e,t,r,n,o){let s=n.functions.get(e);if(s===void 0)return;if(this.#p.has(e)){this.#c("function",`Recursive function call: ${e}`,yn(s));return}this.#p.add(e);let i=Pt(n),a=new Set(r.map((l)=>l.name));for(let l of r)S0(l,i);for(let l of i.bindings.keys())if(/^[0-9]+$/u.test(l))i.bindings.delete(l);for(let[l,u]of t.entries())i.bindings.set(String(l+1),u);let c={localNames:new Set};this.#f.push(c);try{this.#b(s.redirects,i,o),this.#l(s.body,i,o);let l=new Set([...a,...c.localNames]);for(let u of i.bindings.keys())if(/^[0-9]+$/u.test(u))l.add(u);MD(n,i,l)}finally{this.#f.pop(),this.#p.delete(e)}}#I(e,t,r,n,o){let s=r.aliases.get(e);if(s===void 0)return;if(this.#d.has(e)){this.#c("alias",`Recursive alias expansion: ${e}`,o);return}this.#d.add(e);try{let i=ec(s),[a]=i.commands,c=a?.command;if((i.errors?.length??0)>0||i.commands.length!==1||a?.background===!0||a?.redirects.length!==0||c?.type!=="Command"||c.name===void 0||c.prefix.length>0||c.redirects.length>0){this.#g(i,Pt(r),{...n,source:s,pipeline:void 0}),this.#c("alias",`Alias ${e} has compound expansion whose call arguments cannot be bound safely.`,o);return}let l={...n,source:s},u=[this.#i(c.name,r,l),...c.suffix.flatMap((d)=>this.#P(d,r,l)),...t],f={id:0,head:e,words:[],tokens:[],args:[],flags:[],redirects:[],raw:e,range:o,pipeline:n.pipeline,synthetic:!0};this.#T(u,f,r,n)}finally{this.#d.delete(e)}}#F(e,t){for(let r of e.words.slice(1))if(r.kind==="literal"){let n=r.value.indexOf("=");if(n!==-1){let o=r.value.slice(0,n);if(/^[A-Za-z_][A-Za-z0-9_]*$/u.test(o))t.aliases.set(o,r.value.slice(n+1));else this.#c("alias",`Invalid alias name: ${o}`,r.range)}}else this.#c("alias","An alias definition is computed at runtime.",r.range)}#U(e,t){if(e.tokens.includes("-a")){t.aliases.clear();return}for(let r of e.words.slice(1))if(r.kind==="literal")t.aliases.delete(r.value),this.#d.delete(r.value)}#T(e,t,r,n){let o=this.#w(e,[],t.range,{...n,pipeline:t.pipeline},!0);if(o!==null)this.#n.inspectWrapper(o,r,n,n.inspectedPipelineInput)}#D(e,t,r){if(e?.kind!=="literal"){this.#c("dynamic-shell-source","A shell wrapper receives source that is computed at runtime.",e?.range??{start:0,end:0});return}try{this.#g(ec(e.value),Pt(t),{...r,inspectedPipelineInput:!1,source:e.value,pipeline:void 0})}catch(n){this.#c("parse-error",n instanceof Error?n.message:"The nested shell source could not be parsed.",e.range)}}#M(e,t){if(e.head==="export"&&e.flags.some((n)=>n==="-f"||/^-[^-]*f/u.test(n)))this.#c("function","Exported functions can execute in a nested shell outside the local call binding.",e.range);if(e.head==="unset"){for(let n of e.words.slice(1))if(/^[A-Za-z_][A-Za-z0-9_]*$/u.test(n.value))t.temps.delete(n.value),t.bindings.delete(n.value);return}if(!["export","readonly","declare","typeset","local"].includes(e.head))return;let r=this.#f.at(-1);for(let n of e.words.slice(1)){let o=/^(?<name>[A-Za-z_][A-Za-z0-9_]*)/u.exec(n.source)?.groups?.name;if(o!==void 0){if(this.#a.add(o),e.head==="local")r?.localNames.add(o);t.temps.delete(o),t.bindings.delete(o)}}}#N(){let e=this.#t.split("");for(let t of this.#o)for(let r=t.start;r<t.end&&r<e.length;r+=1)if(e[r]!==`
|
|
41
|
+
`&&e[r]!=="\r")e[r]=" ";return/(?<prefix>^|\s)#\s*tripwire-allow:[ \t]*\S[^\r\n]*/u.test(e.join(""))}}var yn=(e)=>({start:e.pos,end:e.end}),DD=(e)=>{let t=e.lastIndexOf("/");return t===-1?e:e.slice(t+1)},fp=(e)=>{let[t,...r]=e,n=new Map;if(t===void 0)return n;for(let[o,s]of t)if(r.every((i)=>i.get(o)===s))n.set(o,s);return n},ax=(e)=>{let[t,...r]=e;if(t===void 0)return qg();return{aliases:fp([t.aliases,...r.map((n)=>n.aliases)]),backgroundPidAvailable:[t,...r].every((n)=>n.backgroundPidAvailable),bindings:fp([t.bindings,...r.map((n)=>n.bindings)]),functions:fp([t.functions,...r.map((n)=>n.functions)]),temps:fp([t.temps,...r.map((n)=>n.temps)])}},cx=(e,t)=>{e.backgroundPidAvailable=t.backgroundPidAvailable,e.aliases.clear();for(let[r,n]of t.aliases)e.aliases.set(r,n);e.bindings.clear();for(let[r,n]of t.bindings)e.bindings.set(r,n);e.functions.clear();for(let[r,n]of t.functions)e.functions.set(r,n);e.temps.clear();for(let[r,n]of t.temps)e.temps.set(r,n)},dp=(e,t,r)=>{for(let n of e.keys())if(!r.has(n)&&!t.has(n))e.delete(n);for(let[n,o]of t)if(!r.has(n))e.set(n,o)},MD=(e,t,r)=>{dp(e.aliases,t.aliases,new Set),dp(e.functions,t.functions,new Set),dp(e.bindings,t.bindings,r),dp(e.temps,t.temps,r),e.backgroundPidAvailable=t.backgroundPidAvailable},S0=(e,t)=>{if(t.temps.delete(e.name),t.bindings.delete(e.name),e.trustedTemp)t.temps.set(e.name,{variable:e.name});else if(e.binding!==void 0)t.bindings.set(e.name,e.binding)},ND=(e,t,r)=>{if(e.append===!0||e.index!==void 0||e.array!==void 0||e.value===void 0)return!1;if(t?.kind==="literal")return Ro(e.value)||Lg(e.value,r)!==null||zg(e.value,r)!==null;return t?.kind==="background-pid"&&Xg(e.value,r)!==null},lu=(e,t={})=>{try{return new E0(e,t).analyze(ec(e))}catch(r){return{source:e,invocations:[],redirects:[],diagnostics:[{kind:"parse-error",message:r instanceof Error?r.message:"The Bash parser failed.",range:{start:0,end:e.length}}],hasBypass:!1}}};var b0=E(()=>{Jg();y0();Ga()});var ZD,k0,qD=(e)=>e.startsWith("./")?e.slice(2):e,nc=(e,t=[],r=[])=>{if(e===""||e===vi)return!1;let n=qD(e);if(n===".."||n.startsWith("../")||n.includes("/../"))return!1;for(let o of[...k0,...r])if(n===o||n.startsWith(`${o}/`))return!0;for(let o of[...ZD,...t])if(n===o||n.startsWith(`${o}/`))return!0;return!1},P0=(e=[],t=[])=>{let r={"build outputs":["dist","build","_build","out","target"],"js framework outputs":[".next",".nuxt",".svelte-kit",".output",".astro",".angular",".vite",".parcel-cache",".turbo",".vercel",".netlify",".fly",".wrangler",".serverless"],"tests / coverage":["coverage",".nyc_output"],caches:[".cache",".ruff_cache",".mypy_cache",".pytest_cache",".ty_cache",".tox"],"language / package":["__pycache__",".venv","venv","node_modules",".gradle","DerivedData",".bundle",".cargo-target"],"tmp / state":["tmp",".tmp",".state",...k0],iac:[".terraform"],"bundler dev":[".yarn/cache",".yarn/install-state.gz",".pnpm-store",".bun"]};if(e.length>0)r["custom relative"]=e;if(t.length>0)r["custom absolute"]=t;return Object.entries(r).map(([n,o])=>` ${n}: ${o.join(", ")}`).join(`
|
|
42
|
+
`)};var uu=E(()=>{Ga();b0();Ga();ZD=["dist","build","_build","out","target",".next",".nuxt",".svelte-kit",".output",".astro",".angular",".vite",".parcel-cache",".turbo",".vercel",".netlify",".fly",".wrangler",".serverless","coverage",".nyc_output",".cache",".ruff_cache",".mypy_cache",".pytest_cache",".ty_cache",".tox","__pycache__",".venv","venv","node_modules",".gradle","DerivedData",".bundle",".cargo-target","tmp",".tmp",".state",".terraform",".yarn/cache",".yarn/install-state.gz",".pnpm-store",".bun"],k0=["/tmp","/var/tmp","/var/folders","/private/tmp","/private/var/tmp","/private/var/folders"]});var WD,LD,w0;var T0=E(()=>{Zn();WD=Lr("ssh"),LD=ot({command:Ae(Pv).check(Rg(1),kv(16)),equivalentTo:WD}),w0=ot({executionCarrierAliases:te(Ae(LD).check(kv(64)))})});var v0,q=(e)=>({kind:"allow",rule:e,message:""}),Wn=(e,t)=>({kind:"warn",rule:e,message:t}),st=(e,t)=>({kind:"ask",rule:e,message:t}),W=(e,t)=>({kind:"deny",rule:e,message:t}),Do=(e)=>{let t=q("none");for(let r of e)if(v0[r.kind]>v0[t.kind])t=r;return t};var Zt=E(()=>{v0={allow:0,warn:1,ask:2,deny:3}});var qt,lx,zD=(e)=>Object.hasOwn(lx.fields,e),C0=(e,t)=>{let r=zD(e.rule)?t[e.rule]:void 0;if(r===void 0||r===e.kind)return e;if(r==="allow")return q(e.rule);if(r==="warn")return Wn(e.rule,e.message);if(r==="ask")return st(e.rule,e.message);return W(e.rule,e.message)};var ux=E(()=>{Zn();Zt();qt=Xa(["allow","warn","ask","deny"]),lx=ot({"brew-mutation":te(qt),"chmod-777-recursive":te(qt),"defaults-write":te(qt),"dscl-mutate":te(qt),"launchctl-mutation":te(qt),"mas-mutation":te(qt),"no-gpg-sign":te(qt),"no-verify":te(qt),osascript:te(qt),"pmset-write":te(qt),"rsync-delete":te(qt),"scutil-set":te(qt),"security-keychain-add-write":te(qt),"softwareupdate-install":te(qt),sudo:te(qt),systemsetup:te(qt),topgrade:te(qt)})});import{readFileSync as XD}from"fs";import{homedir as jD}from"os";var Q0,VD,BD,GD,YD,HD,JD,fx,_0,$0,KD=(e)=>e instanceof Error&&("code"in e)&&e.code==="ENOENT",eM=(e)=>xt({try:()=>XD(e,"utf8"),catch:(t)=>new _0({cause:t})}).pipe(wa("ConfigReadError",(t)=>KD(t.cause)?T(null):N(t))),tM=(e)=>xt({try:()=>JSON.parse(e),catch:(t)=>new $0({cause:t})}),rM=(e)=>ru(JD)(e,{onExcessProperty:"error"}),pp=()=>({git:{protectedBranches:[],enforceConventionalCommits:!1},safePaths:{},toolPolicies:[],blockedCommands:[],allowedCommands:[],ruleActions:{},secretScanner:{executable:"betterleaks",timeoutMs:5000},shell:{executionCarrierAliases:[]}}),dx=(e)=>{let t=pp();return{git:{protectedBranches:e.git?.protectedBranches??t.git.protectedBranches,enforceConventionalCommits:e.git?.enforceConventionalCommits??t.git.enforceConventionalCommits},safePaths:{...t.safePaths,...e.safePaths},toolPolicies:e.toolPolicies??t.toolPolicies,blockedCommands:e.blockedCommands??t.blockedCommands,allowedCommands:e.allowedCommands??t.allowedCommands,ruleActions:{...t.ruleActions,...e.ruleActions},secretScanner:e.secretScanner??t.secretScanner,shell:{executionCarrierAliases:e.shell?.executionCarrierAliases??t.shell.executionCarrierAliases}}},hp=(e=fx)=>We(function*(){let r=yield*eM(e);if(r===null)return{ok:!0,config:pp()};let n=yield*tM(r),o=yield*rM(n);return{ok:!0,config:dx(o)}}).pipe(Ak(1000),wr((t)=>{let r={ok:!1,error:ci(t)};return T(r)}));var px=E(()=>{Zn();T0();ux();Q0=ot({pattern:V,message:V,action:te(hn([Lr("deny"),Lr("ask")])),requiresFlags:te(Ae(V)),forbidsFlagValues:te(Ae(ot({flag:V,values:Ae(V)})))}),VD=ot({protectedBranches:te(Ae(V)),enforceConventionalCommits:te(_g)}),BD=ot({relative:te(Ae(V)),absolute:te(Ae(V))}),GD=ot({argumentsIncludeAll:te(Ae(V)),argumentsStartWith:te(Ae(V)),shortFlagsIncludeAll:te(Ae(V))}),YD=ot({rule:V,executables:Ae(V),action:hn([Lr("deny"),Lr("warn")]),message:V,match:te(GD)}),HD=ot({executable:V,timeoutMs:ou.check(DU(0))}),JD=ot({git:te(VD),safePaths:te(BD),toolPolicies:te(Ae(YD)),blockedCommands:te(Ae(Q0)),allowedCommands:te(Ae(Q0)),ruleActions:te(lx),secretScanner:te(HD),shell:te(w0)}),fx=`${jD()}/.config/tripwire/config.json`;_0=class _0 extends Fr("ConfigReadError"){};$0=class $0 extends Fr("ConfigParseError"){}});var nM,F0,Ox,gx=(e)=>({kind:"cursor",eventName:e,post:Ox.has(e)}),oM=(e)=>F0.has(e)||Ox.has(e),Ai=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),dt=(e,...t)=>{for(let r of t){let n=e[r];if(typeof n==="string")return n}return},xx=(e,...t)=>{for(let r of t)if(r in e)return e[r];return},mx=(e,t,...r)=>{let n=dt(e,...r);if(n!==void 0)return n;if(typeof t==="string"&&r.includes("command"))return t;return Ai(t)?dt(t,...r):void 0},A0=(e,t)=>{if(e===void 0)throw Error(`Cursor hook payload missing ${t}`);return e},sM=(e)=>{let t=e.toLowerCase();if(t==="bash"||t==="exec"||t==="shell"||t==="run_command")return"Bash";if(t==="read"||t==="read_file")return"Read";if(t==="write"||t==="write_file")return"Write";if(t==="edit"||t==="edit_file"||t==="multiedit"||t==="apply_patch")return"Edit";return e},iM=(e)=>e==="Read"||e==="Write"||e==="Edit",aM=(e,t)=>{let r;if(typeof e==="string")r=e;else if(Ai(e))r=dt(e,"command","cmd");if(t&&r===void 0)throw Error("Cursor hook payload missing command");if(typeof e==="string")return{command:e};if(!Ai(e)||r===void 0)return e;return{...e,command:r}},cM=(e,t,r)=>{let n=dt(t,"file_path","filePath","path");if(r&&n===void 0)throw Error(`Cursor ${e} hook payload missing file path`);if(e==="Read")return{...t,file_path:n??""};if(e==="Write"){let o=dt(t,"content","fileText","text");if(r&&o===void 0)throw Error("Cursor Write hook payload missing content");return{...t,file_path:n??"",content:o??""}}if(e==="Edit"){let o=dt(t,"old_string","oldString"),s=dt(t,"new_string","newString");if(r&&(o===void 0||s===void 0))throw Error("Cursor Edit hook payload missing oldString or newString");return{...t,file_path:n??"",old_string:o??"",new_string:s??""}}return t},hx=(e,t,r=!0)=>{if(e==="Bash")return aM(t,r);if(!iM(e))return t;if(!Ai(t)){if(r)throw Error(`Cursor ${e} hook payload is missing tool input`);return t}return cM(e,t,r)},R0=(e,t)=>{if(typeof t!=="string")return t;if(e==="Bash")return{stdout:t,stderr:""};if(e==="Read")return{content:t};return{content:t}},lM=(e,t)=>{if(e==="beforeShellExecution"||e==="afterShellExecution")return"Bash";if(e==="beforeReadFile"||e==="beforeTabFileRead"||e==="afterFileEdit"||e==="afterTabFileEdit")return e.startsWith("before")?"Read":"Edit";let r=dt(t,"tool_name","toolName");if(r!==void 0)return sM(r);let n=xx(t,"tool_input","toolInput");if(dt(t,"command","cmd")!==void 0||typeof n==="string"||Ai(n)&&dt(n,"command","cmd")!==void 0)return"Bash";if(dt(t,"file_path","filePath","path")!==void 0||Ai(n)&&dt(n,"file_path","filePath","path")!==void 0)return"Read";return""},uM=(e,t)=>{if(e==="Bash")return{command:mx(t,void 0,"command","cmd")};let r={file_path:dt(t,"file_path","filePath","path")};if(e==="Write")return{...r,content:dt(t,"content","fileText","text")};if(e==="Edit")return{...r,old_string:dt(t,"old_string","oldString"),new_string:dt(t,"new_string","newString")};return r},fM=(e,t,r,n)=>{let o=TU(nM)(r);if(Ut(o))throw Error("Cursor sent an invalid tool event");let s=o.success,i=xx(s,"tool_input","toolInput"),a=!n;if(e==="beforeShellExecution"||e==="afterShellExecution"){let c=mx(s,i,"command","cmd");return{command:a?A0(c,"command"):c??""}}if(e==="beforeReadFile"||e==="beforeTabFileRead"||e==="afterFileEdit"||e==="afterTabFileEdit"){let c=mx(s,i,"file_path","filePath","path");return hx(t,{file_path:a?A0(c,"file path"):c??"",...Array.isArray(s.edits)&&{edits:s.edits}},a)}if(i===void 0&&["Bash","Read","Write","Edit"].includes(t))return hx(t,uM(t,s),a);return hx(t,i,a)},dM=(e,t,r)=>{if(e==="afterShellExecution")return R0(t,dt(r,"output")??"");let n=xx(r,"tool_response","toolResponse","tool_output","toolOutput","result","result_json");return R0(t,n)},I0=(e,t,r)=>{let n=lM(t,e),o=fM(t,n,e,r),s=r?dM(t,n,e):void 0,i=dt(e,"cwd"),a=dt(e,"conversation_id","session_id"),c=dt(e,"tool_use_id");return{event:{hook_event_name:r?"PostToolUse":"PreToolUse",...n.length>0&&{tool_name:n},...o!==void 0&&{tool_input:o},...s!==void 0&&{tool_response:s},...i!==void 0&&{cwd:i},...a!==void 0&&{session_id:a},...c!==void 0&&{tool_use_id:c}},host:gx(t)}},U0=(e,t)=>{if(t!==void 0&&!oM(t))throw Error(`Unknown Cursor hook event "${t}"`);if(!Ai(e)){if(t!==void 0)throw Error(`Cursor ${t} hook payload must be a JSON object`);return{event:e,host:{kind:"native"}}}let r=t??dt(e,"hook_event_name");if(r!==void 0&&F0.has(r))return I0(e,r,!1);if(r!==void 0&&Ox.has(r))return I0(e,r,!0);return{event:e,host:{kind:"native"}}};var D0=E(()=>{Zn();nM=Sv(V,Jd),F0=new Set(["preToolUse","beforeShellExecution","beforeMCPExecution","beforeReadFile","beforeTabFileRead"]),Ox=new Set(["postToolUse","postToolUseFailure","afterShellExecution","afterMCPExecution","afterFileEdit","afterTabFileEdit"])});var yx,oc=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),Sx=(e)=>oc(e)&&typeof e.command==="string",pM,hM,M0,N0,Z0=(e)=>oc(e)&&typeof e.file_path==="string"&&typeof e.old_string==="string"&&typeof e.new_string==="string",q0=(e)=>oc(e)&&typeof e.file_path==="string"&&typeof e.content==="string",W0=(e)=>oc(e)&&typeof e.file_path==="string",L0=(e,t)=>{if(!oc(t))return"";if(e==="Bash"){let r=typeof t.stdout==="string"?t.stdout:"",n=typeof t.stderr==="string"?t.stderr:"";return[r,n].filter((o)=>o.length>0).join(`
|
|
43
|
+
`)}if(e==="Read"){if(typeof t.content==="string")return t.content;let{file:r}=t;return oc(r)&&typeof r.content==="string"?r.content:""}return typeof t.content==="string"?t.content:""};var Ex=E(()=>{Zn();yx=ot({hook_event_name:V,tool_name:te(V),tool_input:te(Jd),tool_response:te(Jd),cwd:te(V),session_id:te(V),turn_id:te(V),tool_use_id:te(V)}),pM=hn([V,ot({code:V})]),hM=ot({cmd:V}),M0=Ov(pM),N0=Ov(hM)});import{appendFileSync as mM,mkdirSync as OM}from"fs";import{homedir as gM}from"os";import xM from"path";var z0,Ln=(e,t)=>{let r=new Date().toISOString(),n=t instanceof Error?t.stack??t.message:String(t);try{mM(z0,`[${r}] [${e}] ${n}
|
|
44
|
+
`)}catch{}};var X0=E(()=>{z0=`${gM()}/.claude/tripwire.log`;try{OM(xM.dirname(z0),{recursive:!0})}catch{}});var yM,sc=(e,t)=>{if(!e.hasBypass||t.kind==="allow"||yM.has(t.rule))return t;return q(t.rule)};var bx=E(()=>{Zt();yM=new Set(["unsupported-shell-structure","source-script","rm-rf-root","rm-rf-home","fork-bomb","dd-raw-device","mkfs","kill-all","diskutil-destructive","tmutil-destructive","shutdown","csrutil","nvram","kextload","spctl-disable","xattr-quarantine-bypass","topgrade","softwareupdate-install","systemsetup","scutil-set","security-keychain-destructive","no-verify","no-gpg-sign","curl-pipe-shell","gh-api-mutation","gh-destructive","flyctl-destroy","gcloud-delete","git-dynamic-subcommand","git-dynamic-mutation","git-restore-discard","git-checkout-force","git-checkout-discard","git-checkout-discard-all","git-switch-force","git-reset-hard","git-force-push","git-filter","git-update-ref","git-reflog-expire","git-symbolic-ref-write"])});var SM=(e)=>e.tokens.slice(1).join(" "),j0=(e,...t)=>{let r=new Set(e.flags);return t.some((n)=>r.has(n))},EM,bM,kM=(e)=>{if(e.head==="dd")return e.words.slice(1).some((r)=>r.kind==="dynamic"&&!r.source.startsWith("if="));if(e.head==="rsync"){let r=e.words.findIndex((o)=>o.value==="--"),n=r===-1?e.words.length:r;return e.words.slice(1,n).some((o)=>o.kind==="dynamic")}if(e.head==="gh"&&e.tokens[1]==="api"){for(let r=2;r<e.words.length;r+=1){let n=e.words[r-1]?.value,o=e.words[r];if(o?.kind==="dynamic"&&(n==="--method"||n==="-X"||o.source.startsWith("-X")||o.source.startsWith("--method=")))return!0}return!1}let t=EM.get(e.head);if(t!==void 0)return e.words.slice(1,t+1).some((r)=>r.kind==="dynamic");return bM.has(e.head)&&e.words.slice(1).some((r)=>r.kind==="dynamic")},PM=(e)=>{if(e.head!=="gh"||e.tokens[1]!=="api")return null;for(let t=2;t<e.tokens.length;t+=1){let r=e.tokens[t];if(r==="--method"||r==="-X")return e.tokens[t+1]?.toUpperCase()??"";if(r?.startsWith("--method=")===!0)return r.slice(9).toUpperCase();if(r?.startsWith("-X")===!0&&r.length>2)return r.slice(2).toUpperCase()}return null},wM=(e)=>{if(e.head!=="gh"||e.tokens[1]!=="api")return!1;let t=PM(e);if(t!==null&&["POST","PUT","PATCH","DELETE"].includes(t))return!0;return e.flags.some((r)=>r==="--input"||r.startsWith("--input=")||r==="-f"||r==="-F"||r==="--field"||r.startsWith("--field=")||r==="--raw-field"||r.startsWith("--raw-field="))},TM,V0=(e,t={})=>{let r=[];if(e.diagnostics.length>0){let n=[...new Set(e.diagnostics.map((s)=>s.message))],o=W("unsupported-shell-structure",`Tripwire cannot inspect this shell program safely: ${n.join(" ")}`);r.push(sc(e,o))}for(let n of e.invocations)if(kM(n)){let o=W("unsupported-shell-structure",`Tripwire cannot classify computed policy arguments to \`${n.head}\` safely.`);r.push(sc(e,o))}else{let o=TM.find((s)=>s.match(n,e.source));if(o!==void 0){let s=o.action==="deny"?W(o.rule,o.message):st(o.rule,o.message);r.push(sc(e,C0(s,t)))}}return r.length===0?q("bash-deny"):Do(r)};var B0=E(()=>{Zt();ux();bx();EM=new Map([["launchctl",1],["defaults",1],["diskutil",1],["tmutil",1],["security",1],["brew",1],["mas",1],["kmutil",1],["gh",2]]),bM=new Set(["dd","kill","chmod","softwareupdate","pmset","dscl","xattr","spctl","systemsetup","scutil","flyctl","gcloud"]),TM=[{rule:"rm-rf-root",action:"deny",message:"rm -rf / is catastrophic. If the goal is cleaning a subdirectory, scope the path inside the project (e.g. ./dist).",match:(e)=>e.head==="rm"&&j0(e,"-rf","-fr","-Rf","-fR")&&e.tokens.includes("/")},{rule:"rm-rf-home",action:"deny",message:"rm -rf on $HOME / ~ would erase the home directory. Refuse.",match:(e)=>e.head==="rm"&&j0(e,"-rf","-fr","-Rf","-fR")&&e.tokens.some((t)=>/^(?<home>~|\$HOME|\$\{HOME\})$/u.test(t))},{rule:"fork-bomb",action:"deny",message:"Fork bomb pattern detected. Refuse.",match:(e,t)=>/:\(\)\s*\{\s*:\s*\|\s*:\s*&\s*\}\s*;/u.test(t)},{rule:"source-script",action:"deny",message:"`source` / `.` executes a file in the current shell. Refuse arbitrary sourced scripts.",match:(e)=>(e.head==="source"||e.head===".")&&e.tokens.length>1},{rule:"dd-raw-device",action:"deny",message:"dd writing to a raw block device wipes the disk. Refuse.",match:(e)=>e.head==="dd"&&/\bof=\/dev\/(?<type>disk|sd|nvme|rdisk)/iu.test(SM(e))},{rule:"mkfs",action:"deny",message:"mkfs formats a filesystem. Refuse.",match:(e)=>/^mkfs(?<ext>\.[a-z0-9]+)?$/iu.test(e.head)},{rule:"kill-all",action:"deny",message:"kill -9 -1 kills every process you own. Refuse.",match:(e)=>e.head==="kill"&&e.tokens.includes("-9")&&e.tokens.includes("-1")},{rule:"chmod-777-recursive",action:"deny",message:"Recursive chmod 777 makes everything world-writable. Use 755 for directories, 644 for files, scoped narrowly.",match:(e)=>e.head==="chmod"&&e.flags.some((t)=>t.includes("R"))&&e.tokens.includes("777")},{rule:"no-verify",action:"deny",message:"--no-verify skips git hooks. Per policy: never skip hooks. Fix the underlying issue.",match:(e)=>e.tokens.includes("--no-verify")},{rule:"no-gpg-sign",action:"deny",message:"Bypassing GPG signing is off-limits unless explicitly requested.",match:(e,t)=>/--no-gpg-sign\b|-c\s+commit\.gpgsign=false/u.test(t)},{rule:"sudo",action:"ask",message:"sudo escalates privileges and is almost never needed in a coding session. If genuinely required, explain why; otherwise find a non-sudo path.",match:(e)=>e.head==="sudo"},{rule:"shutdown",action:"deny",message:"shutdown / reboot / halt control the machine. Refuse \u2014 system control should be done manually.",match:(e)=>["shutdown","reboot","halt","poweroff"].includes(e.head)},{rule:"launchctl-mutation",action:"deny",message:"launchctl load/unload/bootstrap/bootout/kickstart mutates system services. Refuse \u2014 surface the intent instead.",match:(e)=>e.head==="launchctl"&&typeof e.tokens[1]==="string"&&["load","unload","bootstrap","bootout","kickstart","enable","disable"].includes(e.tokens[1])},{rule:"defaults-write",action:"deny",message:"`defaults write` mutates macOS preferences. Refuse \u2014 surface the intent.",match:(e)=>e.head==="defaults"&&e.tokens[1]==="write"},{rule:"csrutil",action:"deny",message:"csrutil controls System Integrity Protection. Refuse.",match:(e)=>e.head==="csrutil"},{rule:"nvram",action:"deny",message:"nvram modifies firmware variables. Refuse.",match:(e)=>e.head==="nvram"},{rule:"diskutil-destructive",action:"deny",message:"diskutil eraseDisk / reformat / partitionDisk wipes disks. Refuse.",match:(e)=>e.head==="diskutil"&&typeof e.tokens[1]==="string"&&["eraseDisk","reformat","partitionDisk","eraseVolume","secureErase"].includes(e.tokens[1])},{rule:"tmutil-destructive",action:"deny",message:"tmutil delete / disablelocal touches Time Machine. Refuse.",match:(e)=>e.head==="tmutil"&&typeof e.tokens[1]==="string"&&["delete","disablelocal"].includes(e.tokens[1])},{rule:"osascript",action:"ask",message:"osascript runs arbitrary AppleScript and can do almost anything (move files, send emails, drive apps). Confirm with the user what you want done before running it.",match:(e)=>e.head==="osascript"},{rule:"topgrade",action:"deny",message:"topgrade upgrades everything (brew, mas, npm globals, rust, mise). System upgrades should be done manually.",match:(e)=>e.head==="topgrade"},{rule:"rsync-delete",action:"deny",message:"rsync --delete removes files at the destination. High blast radius \u2014 surface the intent instead.",match:(e)=>e.head==="rsync"&&e.flags.includes("--delete")},{rule:"softwareupdate-install",action:"deny",message:"`softwareupdate --install / -i / -d` triggers macOS system updates. Refuse \u2014 system updates should be done manually.",match:(e)=>e.head==="softwareupdate"&&e.flags.some((t)=>t==="--install"||t==="-i"||t==="-d"||t.startsWith("--download"))},{rule:"pmset-write",action:"deny",message:"`pmset` (with arguments) writes power-management settings. Read-only `pmset -g` is fine; mutations need the user.",match:(e)=>e.head==="pmset"&&e.tokens.length>1&&!e.tokens.includes("-g")&&!e.tokens.includes("-G")},{rule:"dscl-mutate",action:"deny",message:"`dscl . -create / -delete / -append / -change / -merge` modifies the local directory service (your user account, groups, etc.). Refuse.",match:(e)=>e.head==="dscl"&&e.tokens.some((t)=>["-create","-delete","-append","-change","-merge","-passwd"].includes(t))},{rule:"xattr-quarantine-bypass",action:"deny",message:"`xattr -d com.apple.quarantine` removes Gatekeeper's quarantine bit \u2014 the macOS protection against running untrusted binaries. Refuse.",match:(e)=>e.head==="xattr"&&e.tokens.includes("-d")&&e.tokens.some((t)=>t.includes("com.apple.quarantine"))},{rule:"spctl-disable",action:"deny",message:"`spctl --master-disable` / `--global-disable` disables Gatekeeper system-wide. Refuse.",match:(e)=>e.head==="spctl"&&e.flags.some((t)=>t==="--master-disable"||t==="--global-disable"||t==="--disable")},{rule:"kextload",action:"deny",message:"Loading a kernel extension (`kextload`, `kmutil load`) is a system-level mutation. Refuse \u2014 the user handles this manually.",match:(e)=>e.head==="kextload"||e.head==="kextunload"||e.head==="kmutil"&&(e.tokens[1]==="load"||e.tokens[1]==="unload")},{rule:"security-keychain-destructive",action:"deny",message:"`security delete-keychain / delete-generic-password / delete-internet-password / set-keychain-settings` mutates your Keychain (where CLIs store their secrets). Refuse \u2014 Keychain should be managed manually.",match:(e)=>e.head==="security"&&typeof e.tokens[1]==="string"&&["delete-keychain","delete-generic-password","delete-internet-password","delete-certificate","delete-identity","set-keychain-settings","unlock-keychain","lock-keychain","create-keychain"].includes(e.tokens[1])},{rule:"security-keychain-add-write",action:"ask",message:"`security add-generic-password / add-internet-password / add-certificate` writes to your Keychain. Other tools manage their own entries \u2014 confirm this is the right path before adding anything else manually.",match:(e)=>e.head==="security"&&typeof e.tokens[1]==="string"&&["add-generic-password","add-internet-password","add-certificate"].includes(e.tokens[1])},{rule:"systemsetup",action:"deny",message:"`systemsetup -set...` writes machine-wide settings (timezone, sleep, network time, restart-on-power-failure). Refuse.",match:(e)=>e.head==="systemsetup"&&e.tokens.some((t)=>t.startsWith("-set"))},{rule:"scutil-set",action:"deny",message:"`scutil --set` writes system configuration (computer name, hostname, LocalHostName). Refuse \u2014 read-only `scutil --get` is fine.",match:(e)=>e.head==="scutil"&&e.tokens.includes("--set")},{rule:"brew-mutation",action:"ask",message:"`brew install/uninstall/upgrade/untap` modifies the machine globally. Confirm before running.",match:(e)=>e.head==="brew"&&typeof e.tokens[1]==="string"&&["install","uninstall","upgrade","reinstall","untap","tap"].includes(e.tokens[1])},{rule:"mas-mutation",action:"ask",message:"`mas install/uninstall` changes installed Mac App Store apps. Confirm.",match:(e)=>e.head==="mas"&&typeof e.tokens[1]==="string"&&["install","uninstall","purchase"].includes(e.tokens[1])},{rule:"gh-destructive",action:"deny",message:"gh repo/release/issue delete is destructive on shared state. Refuse.",match:(e)=>e.head==="gh"&&typeof e.tokens[1]==="string"&&typeof e.tokens[2]==="string"&&["repo","release","issue","pr"].includes(e.tokens[1])&&["delete","destroy","remove"].includes(e.tokens[2])},{rule:"gh-api-mutation",action:"deny",message:"`gh api` with a mutating HTTP method can change shared GitHub state and bypass Git workflow protections. Refuse the inline mutation.",match:wM},{rule:"flyctl-destroy",action:"deny",message:"flyctl apps destroy / volumes destroy nukes deployed infra. Refuse.",match:(e)=>e.head==="flyctl"&&e.tokens.some((t)=>t==="destroy"||t==="delete")},{rule:"gcloud-delete",action:"deny",message:"`gcloud ... delete` affects cloud resources. Refuse.",match:(e)=>e.head==="gcloud"&&e.tokens.includes("delete")}]});var kx=(e)=>e.protectedBranches??[],vM,CM,QM,Y0,_M=(e)=>{if(e.head!=="git")return null;let t=e.tokens.slice(1),r=0;while(r<t.length){let n=t[r];if(n===void 0)break;if(CM.has(n))r+=2;else if(QM.has(n))r+=1;else if(n.startsWith("--git-dir=")||n.startsWith("--work-tree=")||n.startsWith("--namespace=")||n.startsWith("--super-prefix=")||n.startsWith("--exec-path="))r+=1;else if(n.startsWith("-"))r+=1;else return{subcommand:n,subcommandIndex:r+1,subArgs:t.slice(r+1)}}return null},$M=(e)=>{for(let t=0;t<e.length;t+=1){let r=e[t];if(r===void 0)break;if(r==="-m"||r==="--message")return e[t+1]??null;if(r.startsWith("--message="))return r.slice(10);if(/^-[a-zA-Z]*m[a-zA-Z]*$/u.test(r))return e[t+1]??null}return null},AM=(e,t)=>{let r=kx(t);for(let n of e)for(let o of r)if(n===o||n.endsWith(`:${o}`)||n.endsWith(`/${o}`))return o;return null},RM=(e)=>e.filter((t)=>!t.startsWith("-")),IM=(e)=>e.filter((t)=>t.startsWith("-")),Ve=(e,...t)=>{let r=new Set(e);return t.some((n)=>r.has(n))},FM=({subArgs:e,positional:t})=>{if(Ve(e,"--global","--system"))return W("git-config-global","Modifying global / system git config is off-limits \u2014 that is your personal identity. Read-only `git config --get` is fine.");if(!Ve(e,"--get","-l","--list","--get-all","--get-regexp")&&t.length>=2)return W("git-config-write","Local git config writes should be done explicitly. To read a value, use `git config --get <key>`.");return q("bash-git")},UM=({subArgs:e})=>{if(Ve(e,"--cached"))return q("bash-git");return st("git-rm","`git rm <path>` removes from the index AND the working tree. To untrack-only, use `git rm --cached <path>`. To delete the file separately, use `trash` / `rip`. Confirm intent.")},DM=({subArgs:e,positional:t})=>{if(Ve(e,"--staged","-S")&&!Ve(e,"--worktree","-W"))return q("bash-git");if(t.length>0)return W("git-restore-discard","`git restore <path>` discards uncommitted changes in the working tree. Refuse \u2014 `git diff <path>` to inspect first, or `git stash push <path>` to preserve.");return q("bash-git")},MM=({subArgs:e,positional:t})=>{if(Ve(e,"-b","-B"))return q("bash-git");if(Ve(e,"-f","--force"))return W("git-checkout-force","`git checkout -f` overwrites the working tree without preserving uncommitted changes. Refuse.");if(e.includes("--"))return W("git-checkout-discard","`git checkout -- <path>` discards uncommitted working-tree changes. Refuse \u2014 use `git stash push <path>` to preserve, or `git diff <path>` to inspect first.");let[r]=t;if(r!==void 0&&t.length===1&&(r==="."||r.startsWith("./")))return W("git-checkout-discard-all","`git checkout .` discards ALL uncommitted working-tree changes. Refuse \u2014 `git stash` to preserve, or `git diff` to inspect first.");return q("bash-git")},NM=({subArgs:e})=>{if(Ve(e,"-f","--force","--discard-changes"))return W("git-switch-force","`git switch -f / --discard-changes` throws away uncommitted working-tree changes. Refuse.");return q("bash-git")},ZM=({subArgs:e,flags:t,positional:r})=>{if(Ve(e,"--hard"))return W("git-reset-hard","`git reset --hard` discards all uncommitted changes AND moves HEAD. Refuse \u2014 describe the intent in chat. If undoing a published commit, `git revert <sha>` is safer.");if(Ve(e,"--keep"))return st("git-reset-keep","`git reset --keep` resets HEAD but preserves uncommitted local changes. Confirm intent.");if(r.length===0&&t.length===0)return q("bash-git");return st("git-reset-mixed","`git reset` moves HEAD. Confirm intent \u2014 if undoing a commit, `git revert` is usually safer.")},qM=({subArgs:e,flags:t})=>{if(Ve(e,"-n","--dry-run")||t.some((r)=>/^-[a-zA-Z]*n/u.test(r)))return q("bash-git");if(t.some((r)=>/^-[a-zA-Z]*[df]/u.test(r)||r==="--force"))return W("git-clean-fd","`git clean -fd` deletes untracked files (often your in-progress work). Refuse \u2014 inspect with `git clean -dn` (dry run) first. If genuinely needed, append ` # tripwire-allow: <reason>`.");return q("bash-git")},WM=({subArgs:e,positional:t,config:r})=>{if(Ve(e,"--abort","--quit","--continue","--skip","--edit-todo"))return q("bash-git");if(Ve(e,"-i","--interactive"))return W("git-rebase-interactive","`git rebase -i` rewrites history interactively. Refuse \u2014 too easy to lose commits in the agent loop. If this is genuinely required, do it manually outside the agent.");let[n]=t,o=kx(r);if(n!==void 0&&o.includes(n))return st("git-rebase-onto-protected",`Rebasing onto \`${n}\` rewrites history of the current branch. \`git merge ${n}\` is usually safer. Confirm intent.`);return st("git-rebase","`git rebase` rewrites commit history. `git merge` is usually safer. Confirm intent.")},LM=({subArgs:e})=>{if(Ve(e,"--abort","--quit","--continue","--skip"))return q("bash-git");return st("git-cherry-pick","`git cherry-pick` applies commits onto the current branch and can create conflicts. Confirm intent.")},zM=({subArgs:e})=>{if(Ve(e,"--abort","--continue","--quit"))return q("bash-git");return st("git-merge","`git merge <branch>` may create merge conflicts. Confirm intent.")},XM=({subArgs:e,config:t})=>{if(Ve(e,"--amend"))return W("git-commit-amend","`git commit --amend` rewrites the last commit. If it has been pushed, this causes upstream divergence. Refuse \u2014 surface the intent.");let r=$M(e),n=Ve(e,"-F","--file","-c","-C","--reuse-message","--reedit-message"),o=Ve(e,"--no-edit");if(r===null&&!n&&!o)return W("git-commit-no-message",'`git commit` without `-m "..."` opens an editor and hangs the agent. Use `git commit -m "<conventional message>"`.');if(r!==null&&t.enforceConventionalCommits===!0&&!vM.test(r))return W("git-commit-non-conventional",["Commit message must follow Conventional Commits format:"," `<type>(<scope>)?(!)?: <description>`","Allowed types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert.","Examples:"," `fix(auth): handle expired token refresh`"," `feat: add bash-git rule`"," `chore: bump deps`",`Got: ${JSON.stringify(r)}`].join(`
|
|
45
|
+
`));if(Ve(e,"-a","--all")||e.some((s)=>/^-[a-zA-Z]*a[a-zA-Z]*$/u.test(s)))return st("git-commit-auto-stage","`git commit -a / --all` auto-stages every tracked change. Explicit `git add <files>` first is usually clearer about what is being committed. Confirm.");return q("bash-git")},jM=({subArgs:e,flags:t,positional:r,config:n})=>{if(t.some((s)=>s==="--force"||s==="-f"||s.startsWith("--force-with-lease")))return W("git-force-push","Force push is forbidden. If a branch needs to be reset upstream, surface the intent \u2014 there is almost always a non-force path.");if(Ve(e,"--delete","--mirror")||e.some((s)=>s.startsWith(":")))return W("git-push-delete","Refusing to delete a remote branch via push. If genuinely needed, surface the intent.");let o=AM(r,n);if(o!==null)return W("git-push-protected",`Refusing to push directly to protected branch \`${o}\`. Open a PR instead: \`gh pr create\`.`);return q("bash-git")},VM=({subArgs:e,flags:t,positional:r,config:n})=>{let o=t.find((s)=>s==="-D"||s==="-d"||s==="--delete"||/^-[a-zA-Z]*D/u.test(s)||/^-[a-zA-Z]*d/u.test(s));if(o!==void 0){let s=r,i=new Set(kx(n)),a=s.find((c)=>i.has(c));if(a!==void 0)return W("git-branch-delete-protected",`Refusing to delete protected branch \`${a}\`.`);if(o==="-D"||o.includes("D"))return W("git-branch-force-delete",`\`git branch -D ${s.join(" ")}\` force-deletes branches even if unmerged (potential data loss). To delete a merged branch, use \`-d\`. To force, append \` # tripwire-allow: <reason>\`.`);return st("git-branch-delete",`\`git branch -d ${s.join(" ")}\` deletes a branch (merged-only check). Confirm intent.`)}if(Ve(e,"-m","-M","--move"))return st("git-branch-move","Renaming a branch can confuse pushed remotes. Confirm intent.");return q("bash-git")},BM=({subArgs:e})=>{if(Ve(e,"-d","--delete"))return W("git-tag-delete","`git tag -d` deletes a tag. Refuse \u2014 surface intent.");return q("bash-git")},GM=({subArgs:e})=>{let t=e[0]??"push";if(t==="drop"||t==="clear")return W("git-stash-drop",`\`git stash ${t}\` discards stashed work. Refuse \u2014 \`git stash list\` and \`git stash show\` to inspect first.`);return q("bash-git")},YM=({flags:e})=>{if(e.some((t)=>t.startsWith("--prune=")||t==="--aggressive"))return W("git-gc-prune","`git gc --prune=now` / `--aggressive` destroys reflog recovery options. Refuse.");return q("bash-git")},HM=({subArgs:e})=>{let[t]=e;if(t!==void 0&&["add","prune","remove","rename","rm","set-branches","set-head","set-url","update"].includes(t))return st("git-remote-mutate",`\`git remote ${t}\` changes which remote you're pushing to. Confirm \u2014 accidentally pointing at the wrong remote is high blast-radius.`);return q("bash-git")},JM=({subArgs:e})=>{if(Ve(e,"-f","--force"))return W("git-checkout-index-force","`git checkout-index --force` can overwrite working-tree files. Refuse.");return st("git-checkout-index","`git checkout-index` writes files from the index into the working tree. Confirm the target and intent.")},G0=({subcommand:e,subArgs:t})=>{let r=t[0]??"";if(["add","remove","rm","deinit","sync","set-url"].includes(r))return st("git-submodule-worktree-mutate",`\`git ${e} ${r}\` modifies repo structure. Confirm intent.`);return q("bash-git")},KM,eN=(e,t)=>{let{subcommand:r,subArgs:n}=e,o=IM(n),s=RM(n);if(Y0.has(r)){if(r==="reflog"&&(n[0]==="expire"||Ve(n,"--expire")))return W("git-reflog-expire","`git reflog expire` destroys git's recovery history. Refuse \u2014 surface the intent.");if(r==="symbolic-ref"&&s.length>=2)return W("git-symbolic-ref-write","`git symbolic-ref <name> <ref>` rewrites a symbolic ref. Refuse.");return q("bash-git")}let i=KM.get(r);if(i!==void 0)return i({subcommand:r,subArgs:n,flags:o,positional:s,config:t});return Wn("git-unknown-subcommand",`\`git ${r}\` is not classified by tripwire. Allowing \u2014 flag if this looks like history-rewriting or data-loss territory.`)},tN=(e)=>{if(Y0.has(e.subcommand))return!0;if(e.subcommand!=="remote")return!1;let t=e.subArgs.find((r)=>!r.startsWith("-"));return t===void 0||t==="get-url"||t==="show"},H0=(e,t)=>{for(let r of e.invocations){let n=_M(r);if(n!==null){if(r.words[n.subcommandIndex]?.kind==="dynamic")return W("git-dynamic-subcommand","Tripwire cannot classify a Git subcommand that is computed at runtime.");if((!tN(n)||n.subcommand==="reflog"||n.subcommand==="symbolic-ref")&&r.words.slice(1).some((i)=>i.kind==="dynamic"))return W("git-dynamic-mutation",`Tripwire cannot prove that computed arguments to \`git ${n.subcommand}\` preserve Git safety policy.`);let s=eN(n,t);if(s!==null&&s.kind!=="allow")return s}}return q("bash-git")};var J0=E(()=>{Zt();vM=/^(?<type>feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(?<scope>\([\w./\- ]+\))?!?:\s+\S/u,CM=new Set(["-C","-c","--git-dir","--work-tree","--namespace","--super-prefix"]),QM=new Set(["--bare","--paginate","-p","--no-pager","--no-replace-objects","--literal-pathspecs","--glob-pathspecs","--noglob-pathspecs","--icase-pathspecs","--no-optional-locks","--exec-path","--html-path","--man-path","--info-path"]),Y0=new Set(["status","diff","diff-tree","log","show","blame","rev-parse","rev-list","ls-files","ls-tree","cat-file","reflog","describe","shortlog","whatchanged","archive","bundle","fsck","fetch","ls-remote","help","version","grep","name-rev","merge-base","symbolic-ref","check-ignore","count-objects","verify-commit","verify-tag"]),KM=new Map([["config",FM],["add",()=>q("bash-git")],["mv",()=>q("bash-git")],["rm",UM],["restore",DM],["checkout",MM],["switch",NM],["reset",ZM],["clean",qM],["rebase",WM],["cherry-pick",LM],["merge",zM],["commit",XM],["push",jM],["branch",VM],["tag",BM],["stash",GM],["filter-branch",({subcommand:e})=>W("git-filter",`\`git ${e}\` rewrites entire repo history. Refuse.`)],["filter-repo",({subcommand:e})=>W("git-filter",`\`git ${e}\` rewrites entire repo history. Refuse.`)],["gc",YM],["update-ref",()=>W("git-update-ref","`git update-ref` directly mutates refs and bypasses normal git operations. Refuse.")],["remote",HM],["submodule",G0],["worktree",G0],["checkout-index",JM],["write-tree",()=>q("bash-git")],["init",({subcommand:e})=>Wn(`git-${e}`,`\`git ${e}\` is allowed but unusual mid-session. Make sure this is what the user asked for.`)],["clone",({subcommand:e})=>Wn(`git-${e}`,`\`git ${e}\` is allowed but unusual mid-session. Make sure this is what the user asked for.`)]])});var rN,nN,oN=(e)=>{for(let t of e.invocations){let{pipeline:r}=t;if(rN.has(t.head)&&r!==void 0){if(e.invocations.find((o)=>o.pipeline?.id===r.id&&o.pipeline.index===r.index+1&&nN.has(o.head))!==void 0)return!0}}return!1},sN,K0=(e)=>{if(oN(e))return W("curl-pipe-shell","Piping `curl` / `wget` directly into a shell runs whatever the remote URL serves. Refuse \u2014 download to a file, inspect, then run if appropriate. If you genuinely need this, append ` # tripwire-allow: <reason>` (and explain to the user what you're running).");for(let t of e.invocations)for(let r of sN)if(t.head===r.head&&t.tokens[1]===r.subcommand)return st(r.rule,r.message);return q("bash-network-install")};var eC=E(()=>{Zt();rN=new Set(["curl","wget","wget2","aria2c","xh"]),nN=new Set(["bash","sh","zsh","fish"]),sN=[{head:"cargo",subcommand:"install",rule:"cargo-install",message:"Confirm before `cargo install <crate>`: this builds and installs arbitrary code from crates.io into ~/.cargo/bin globally."},{head:"go",subcommand:"install",rule:"go-install",message:"Confirm before `go install`: this fetches and installs arbitrary Go code globally."},{head:"gem",subcommand:"install",rule:"gem-install",message:"Confirm before `gem install`: pulls arbitrary code from rubygems.org."}]});import{lstatSync as iN,readlinkSync as aN,realpathSync as cN}from"fs";import ic from"path";var lN,tC=(e)=>{try{return cN(e)}catch{return null}},Px=(e,t=new Set)=>{if(t.has(e))return e;t.add(e);let r=tC(e);if(r!==null)return r;try{if(iN(e).isSymbolicLink()){let o=aN(e);return Px(ic.resolve(ic.dirname(e),o),t)}}catch{}let n=ic.dirname(e);if(n===e)return e;return ic.join(Px(n,t),ic.basename(e))},fu=(e,t,r)=>{let n=ic.resolve(e),o=t==="write"?Px(n):tC(n),s=[e,n];if(o!==null&&!s.includes(o))s.push(o);for(let i of s)for(let a of r)if(a.pattern.test(i))return a;return null},du=(e)=>{let t=fu(e.file_path,"write",lN);if(t!==null)return W(t.rule,t.message);return q("path-protect")};var pu=E(()=>{Zt();lN=[{pattern:/(?<prefix>^|\/)\.env(?<ext>\.[^/]+)?$/u,rule:"env-file",message:".env files hold secrets that should never be sent to the model. Refuse to write or edit. If an example is needed, create .env.example with redacted placeholders."},{pattern:/(?<prefix>^|\/)\.dev\.vars(?<ext>\.[^/]+)?$/u,rule:"dev-vars",message:".dev.vars holds Cloudflare/Wrangler secrets. Do not modify."},{pattern:/(?<prefix>^|\/)\.ssh\//u,rule:"ssh-dir",message:"Never write into ~/.ssh/. Refuse."},{pattern:/(?<prefix>^|\/)(?<key>id_rsa|id_ed25519|id_ecdsa|id_dsa)(?<pub>\.pub)?$/u,rule:"ssh-key",message:"SSH key file. Refuse."},{pattern:/\.(?<ext>pem|key|p12|pfx)$/iu,rule:"private-key",message:"Private key file. Refuse to overwrite. If generating a new key, use a different filename and let the user review."},{pattern:/(?<prefix>^|\/)secrets?\.(?<ext>json|ya?ml|toml|env)$/iu,rule:"secrets-file",message:"Secrets file. Refuse."},{pattern:/(?<prefix>^|\/)\.aws\/credentials$/u,rule:"aws-credentials",message:"AWS credentials file. Refuse."},{pattern:/(?<prefix>^|\/)\.netrc$/u,rule:"netrc",message:".netrc holds host credentials. Refuse."}]});var uN,fN=(e)=>{let t=fu(e,"write",uN);if(t!==null)return W(t.rule,t.message);return null},wx=(e)=>e.kind==="dynamic"||e.kind==="background-pid"?W("redirect-dynamic-target","Tripwire cannot prove that this computed write target avoids protected files."):fN(e.value),rC=(e)=>{for(let t of e.redirects)if(t.op===">"||t.op===">>"||t.op==="&>"||t.op==="&>>"){let r=wx(t.target);if(r!==null)return r}for(let t of e.invocations){let r=t.words.slice(1).filter((n)=>!n.value.startsWith("-"));if(t.head==="tee")for(let n of r){let o=wx(n);if(o!==null)return o}if(t.head==="cp"||t.head==="mv"){let n=r.at(-1);if(n!==void 0){let o=wx(n);if(o!==null)return o}}}return q("bash-redirect")};var nC=E(()=>{Zt();pu();uN=[{rule:"redirect-env",pattern:/(?<prefix>^|\/)\.env(?<ext>\.[^/]+)?$/u,message:"Refusing to write into a .env file via shell redirect / tee / cp / mv. .env files hold secrets \u2014 never overwrite from a tool call."},{rule:"redirect-dev-vars",pattern:/(?<prefix>^|\/)\.dev\.vars(?<ext>\.[^/]+)?$/u,message:"Refusing to write into .dev.vars (Cloudflare/Wrangler secrets)."},{rule:"redirect-ssh",pattern:/(?<prefix>^|\/)\.ssh\//u,message:"Refusing to write into ~/.ssh/ via shell."},{rule:"redirect-key",pattern:/\.(?<ext>pem|key|p12|pfx)$/iu,message:"Refusing to overwrite a private-key-shaped file via shell."},{rule:"redirect-aws-credentials",pattern:/(?<prefix>^|\/)\.aws\/credentials$/u,message:"Refusing to write into ~/.aws/credentials via shell."},{rule:"redirect-netrc",pattern:/(?<prefix>^|\/)\.netrc$/u,message:"Refusing to write into ~/.netrc via shell."},{rule:"redirect-block-device",pattern:/^\/dev\/(?<type>sd|disk|nvme|rdisk)/iu,message:"Redirecting into a raw block device wipes the disk. Refuse."}]});var dN=(e,t)=>{let r=!1,n=[];for(let i of e.tokens.slice(1))if(!r&&i==="--")r=!0;else if(r||!i.startsWith("-")||i==="-")n.push(i);let o=t.relative??[],s=t.absolute??[];return n.filter((i)=>!nc(i,o,s))},pN=(e,t)=>{if(!e.tokens.includes("-delete"))return null;let r=[];for(let i of e.tokens.slice(1)){if(i.startsWith("-"))break;r.push(i)}let n=r.length===0?["."]:r,o=t.relative??[],s=t.absolute??[];return n.filter((i)=>!nc(i,o,s))},oC=(e,t)=>{let r=[];for(let i of e.invocations)if(i.head==="rm"){let a=dN(i,t);if(a.length>0)r.push({kind:"rm",targets:a})}else if(i.head==="find"){let a=pN(i,t);if(a!==null&&a.length>0)r.push({kind:"find -delete",targets:a})}if(r.length===0)return q("bash-scoped-rm");let n=t.relative??[],o=t.absolute??[],s=r.map((i)=>` \u2022 ${i.kind} on: ${i.targets.map((a)=>JSON.stringify(a)).join(", ")}`).join(`
|
|
46
|
+
`);return W("destructive-outside-safe-paths",`Destructive deletion outside known-safe scopes is blocked. Use a recoverable deletion tool or limit the target to an ephemeral build, cache, state, or temporary directory:
|
|
47
|
+
${P0(n,o)}
|
|
50
48
|
|
|
51
49
|
Flagged targets:
|
|
52
50
|
${s}
|
|
53
51
|
|
|
54
|
-
If raw deletion is genuinely needed, append \` # tripwire-allow: <reason>\` to the command.`)};var mW=v(()=>{Fy();Gn()});var Ire=(e)=>e==="--extract"||e.startsWith("-")&&!e.startsWith("--")&&e.slice(1).includes("x"),Are=(e)=>{for(let t=0;t<e.tokens.length;t+=1){let n=e.tokens[t];if(n!==void 0){if(n==="-C"||n==="--directory")return e.tokens[t+1]??null;if(n.startsWith("--directory="))return n.slice(12)}}return null},hW=(e)=>e==="/"||/^(?<home>~|\$HOME|\$\{HOME\})$/u.test(e),Tre=(e)=>{let t=e.tokens.indexOf("-d");return t===-1?void 0:e.tokens[t+1]},gW=(e)=>{for(let t of e.invocations)if(t.head==="tar"){let[,n]=t.tokens,o=t.flags.some(Ire)||t.tokens.includes("--extract")||n!==void 0&&/^[a-zA-Z]+$/u.test(n)&&n.includes("x")?Are(t):null;if(o!==null&&hW(o))return X("tar-extract-to-root",`tar -x with -C ${o} can overwrite arbitrary system files. Refuse \u2014 extract to a contained directory (e.g. ./tmp/extract) and inspect before moving anything elsewhere.`)}for(let t of e.invocations)if(t.head==="unzip"){let n=Tre(t);if(n!==void 0&&hW(n))return X("unzip-to-root",`unzip -d ${n} can overwrite arbitrary system files. Refuse \u2014 extract to a contained directory.`)}return Y("bash-tar-explosion")};var xW=v(()=>{Gn()});var _re="If this is intentional, append ` # tripwire-allow: <reason>` to the command.",Ore,yW=(e)=>Ore.get(e)??e,SW=(e)=>{let t=e.lastIndexOf("/");return t===-1?e:e.slice(t+1)},Pre=(e,t)=>e.some((n)=>n===t||n.startsWith(`${t}=`)),Rre=(e,t)=>{for(let n=0;n<e.length;n+=1){let r=e[n];if(r!==void 0){if(r===t)return e[n+1]??"";if(r.startsWith(`${t}=`))return r.slice(t.length+1)}}return null},Fre=(e)=>{let t=[],n=e.tokens.slice(1);for(let r=0;r<n.length;r+=1){let o=n[r];if(o?.startsWith("-")===!0){let s=n[r+1];if(!o.includes("=")&&s!==void 0&&!s.startsWith("-"))r+=1}else if(o!==void 0)t.push(o)}return t},EW=(e,t)=>{let{pattern:n}=t,r=gm(n);if(r.diagnostics.length>0||r.invocations.length===0)return!1;let[o]=r.invocations;if(o===void 0)return!1;let[s,...i]=o.tokens;if(s===void 0)return!1;return e.invocations.some((a)=>{if(SW(a.head)!==SW(s))return!1;let c=Fre(a),u=i.every((d,m)=>c[m]!==void 0&&yW(c[m])===yW(d)),l=(t.requiresFlags??[]).every((d)=>Pre(a.tokens,d)),f=(t.forbidsFlagValues??[]).every((d)=>{let m=Rre(a.tokens,d.flag);return m!==null&&d.values.includes(m)});return u&&l&&f})},bW=(e,t,n)=>{for(let r of n)if(EW(e,r))return Y("config-custom");for(let r of t)if(EW(e,r)){let o=r.message.includes("tripwire-allow")?r.message:`${r.message} ${_re}`;return r.action==="ask"?Lt("config-custom",o):X("config-custom",o)}return Y("config-custom")};var wW=v(()=>{Fy();Gn();Ore=new Map([["add","create"],["new","create"],["edit","update"],["set","update"],["rm","delete"],["del","delete"],["remove","delete"]])});import{readFileSync as Mre}from"fs";var kW=(e,t)=>{let n=new Set(e.split(`
|
|
55
|
-
`).map((r)=>r.trim()).filter((r)=>r.length>0));return t.split(`
|
|
56
|
-
`).
|
|
52
|
+
If raw deletion is genuinely needed, append \` # tripwire-allow: <reason>\` to the command.`)};var sC=E(()=>{uu();Zt()});var hN=(e)=>e==="--extract"||e.startsWith("-")&&!e.startsWith("--")&&e.slice(1).includes("x"),mN=(e)=>{for(let t=0;t<e.tokens.length;t+=1){let r=e.tokens[t];if(r!==void 0){if(r==="-C"||r==="--directory")return e.tokens[t+1]??null;if(r.startsWith("--directory="))return r.slice(12)}}return null},iC=(e)=>e==="/"||/^(?<home>~|\$HOME|\$\{HOME\})$/u.test(e),ON=(e)=>{let t=e.tokens.indexOf("-d");return t===-1?void 0:e.tokens[t+1]},aC=(e)=>{for(let t of e.invocations)if(t.head==="tar"){let[,r]=t.tokens,o=t.flags.some(hN)||t.tokens.includes("--extract")||r!==void 0&&/^[a-zA-Z]+$/u.test(r)&&r.includes("x")?mN(t):null;if(o!==null&&iC(o))return W("tar-extract-to-root",`tar -x with -C ${o} can overwrite arbitrary system files. Refuse \u2014 extract to a contained directory (e.g. ./tmp/extract) and inspect before moving anything elsewhere.`)}for(let t of e.invocations)if(t.head==="unzip"){let r=ON(t);if(r!==void 0&&iC(r))return W("unzip-to-root",`unzip -d ${r} can overwrite arbitrary system files. Refuse \u2014 extract to a contained directory.`)}return q("bash-tar-explosion")};var cC=E(()=>{Zt()});var gN="If this is intentional, append ` # tripwire-allow: <reason>` to the command.",xN,lC=(e)=>xN.get(e)??e,uC=(e)=>{let t=e.lastIndexOf("/");return t===-1?e:e.slice(t+1)},yN=(e,t)=>e.some((r)=>r===t||r.startsWith(`${t}=`)),SN=(e,t)=>{for(let r=0;r<e.length;r+=1){let n=e[r];if(n!==void 0){if(n===t)return e[r+1]??"";if(n.startsWith(`${t}=`))return n.slice(t.length+1)}}return null},EN=(e)=>{let t=[],r=e.tokens.slice(1);for(let n=0;n<r.length;n+=1){let o=r[n];if(o?.startsWith("-")===!0){let s=r[n+1];if(!o.includes("=")&&s!==void 0&&!s.startsWith("-"))n+=1}else if(o!==void 0)t.push(o)}return t},fC=(e,t)=>{let{pattern:r}=t,n=lu(r);if(n.diagnostics.length>0||n.invocations.length===0)return!1;let[o]=n.invocations;if(o===void 0)return!1;let[s,...i]=o.tokens;if(s===void 0)return!1;return e.invocations.some((a)=>{if(uC(a.head)!==uC(s))return!1;let c=EN(a),l=i.every((d,h)=>c[h]!==void 0&&lC(c[h])===lC(d)),u=(t.requiresFlags??[]).every((d)=>yN(a.tokens,d)),f=(t.forbidsFlagValues??[]).every((d)=>{let h=SN(a.tokens,d.flag);return h!==null&&d.values.includes(h)});return l&&u&&f})},dC=(e,t,r)=>{for(let n of r)if(fC(e,n))return q("config-custom");for(let n of t)if(fC(e,n)){let o=n.message.includes("tripwire-allow")?n.message:`${n.message} ${gN}`;return n.action==="ask"?st("config-custom",o):W("config-custom",o)}return q("config-custom")};var pC=E(()=>{uu();Zt();xN=new Map([["add","create"],["new","create"],["edit","update"],["set","update"],["rm","delete"],["del","delete"],["remove","delete"]])});class Op{constructor(e,t){this.from=e,this.to=t}}class Ce{constructor(e={}){this.id=bN++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw RangeError("Can't add per-node props to node types");if(typeof e!="function")e=Hr.match(e);return(t)=>{let r=e(t);return r===void 0?null:[this,r]}}}class ac{constructor(e,t,r,n=!1){this.tree=e,this.overlay=t,this.parser=r,this.bracketed=n}static get(e){return e&&e.props&&e.props[Ce.mounted.id]}}class Hr{constructor(e,t,r,n=0){this.name=e,this.props=t,this.id=r,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):kN,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),n=new Hr(e.name||"",t,e.id,r);if(e.props)for(let o of e.props){if(!Array.isArray(o))o=o(n);if(o){if(o[0].perNode)throw RangeError("Can't store a per-node prop on a node type");t[o[0].id]=o[1]}}return n}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(Ce.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let n of r.split(" "))t[n]=e[r];return(r)=>{for(let n=r.prop(Ce.group),o=-1;o<(n?n.length:0);o++){let s=t[o<0?r.name:n[o]];if(s)return s}}}}class yp{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let r of this.types){let n=null;for(let o of e){let s=o(r);if(s){if(!n)n=Object.assign({},r.props);let i=s[1],a=s[0];if(a.combine&&a.id in n)i=a.combine(n[a.id],i);n[a.id]=i}}t.push(n?new Hr(r.name,n,r.id,r.flags):r)}return new yp(t)}}class Gt{constructor(e,t,r,n,o){if(this.type=e,this.children=t,this.positions=r,this.length=n,this.props=null,o&&o.length){this.props=Object.create(null);for(let[s,i]of o)this.props[typeof s=="number"?s:s.id]=i}}toString(){let e=ac.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let r of this.children){let n=r.toString();if(n){if(t)t+=",";t+=n}}return!this.type.name?t:(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":"")}cursor(e=0){return new xp(this.topNode,e)}cursorAt(e,t=0,r=0){let n=mp.get(this)||this.topNode,o=new xp(n);return o.moveTo(e,t),mp.set(this,o._tree),o}get topNode(){return new Yr(this,0,0,null)}resolve(e,t=0){let r=hu(mp.get(this)||this.topNode,e,t,!1);return mp.set(this,r),r}resolveInner(e,t=0){let r=hu(hC.get(this)||this.topNode,e,t,!0);return hC.set(this,r),r}resolveStack(e,t=0){return PN(this,e,t)}iterate(e){let{enter:t,leave:r,from:n=0,to:o=this.length}=e,s=e.mode||0,i=(s&pt.IncludeAnonymous)>0;for(let a=this.cursor(s|pt.IncludeAnonymous);;){let c=!1;if(a.from<=o&&a.to>=n&&(!i&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;c=!0}for(;;){if(c&&r&&(i||!a.type.isAnonymous))r(a);if(a.nextSibling())break;if(!a.parent())return;c=!0}}}prop(e){return!e.perNode?this.type.prop(e):this.props?this.props[e.id]:void 0}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:_x(Hr.none,this.children,this.positions,0,this.children.length,0,this.length,(t,r,n)=>new Gt(this.type,t,r,n,this.propValues),e.makeTree||((t,r,n)=>new Gt(Hr.none,t,r,n)))}static build(e){return wN(e)}}class vx{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new vx(this.buffer,this.index)}}class Ds{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return Hr.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],r=this.buffer[e+3],n=this.set.types[t],o=n.name;if(/\W/.test(o)&&!n.isError)o=JSON.stringify(o);if(e+=4,r==e)return o;let s=[];while(e<r)s.push(this.childString(e)),e=this.buffer[e+3];return o+"("+s.join(",")+")"}findChild(e,t,r,n,o){let{buffer:s}=this,i=-1;for(let a=e;a!=t;a=s[a+3])if(xC(o,n,s[a+1],s[a+2])){if(i=a,r>0)break}return i}slice(e,t,r){let n=this.buffer,o=new Uint16Array(t-e),s=0;for(let i=e,a=0;i<t;){o[a++]=n[i++],o[a++]=n[i++]-r;let c=o[a++]=n[i++]-r;o[a++]=n[i++]-e,s=Math.max(s,c)}return new Ds(o,s,this.set)}}function xC(e,t,r,n){switch(e){case-2:return r<t;case-1:return n>=t&&r<t;case 0:return r<t&&n>t;case 1:return r<=t&&n>t;case 2:return n>t;case 4:return!0}}function hu(e,t,r,n){var o;while(e.from==e.to||(r<1?e.from>=t:e.from>t)||(r>-1?e.to<=t:e.to<t)){let i=!n&&e instanceof Yr&&e.index<0?null:e.parent;if(!i)return e;e=i}let s=n?0:pt.IgnoreOverlays;if(n){for(let i=e,a=i.parent;a;i=a,a=i.parent)if(i instanceof Yr&&i.index<0&&((o=a.enter(t,r,s))===null||o===void 0?void 0:o.from)!=i.from)e=a}for(;;){let i=e.enter(t,r,s);if(!i)return e;e=i}}class Cx{cursor(e=0){return new xp(this,e)}getChild(e,t=null,r=null){let n=mC(this,e,t,r);return n.length?n[0]:null}getChildren(e,t=null,r=null){return mC(this,e,t,r)}resolve(e,t=0){return hu(this,e,t,!1)}resolveInner(e,t=0){return hu(this,e,t,!0)}matchContext(e){return Tx(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;while(t){let n=t.lastChild;if(!n||n.to!=t.to)break;if(n.type.isError&&n.from==n.to)r=t,t=n.prevSibling;else t=n}return r}get node(){return this}get next(){return this.parent}}function mC(e,t,r,n){let o=e.cursor(),s=[];if(!o.firstChild())return s;if(r!=null){for(let i=!1;!i;)if(i=o.type.is(r),!o.nextSibling())return s}for(;;){if(n!=null&&o.type.is(n))return s;if(o.type.is(t))s.push(o.node);if(!o.nextSibling())return n==null?s:[]}}function Tx(e,t,r=t.length-1){for(let n=e;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[r]&&t[r]!=n.name)return!1;r--}}return!0}class yC{constructor(e,t,r,n){this.parent=e,this.buffer=t,this.index=r,this.start=n}}function SC(e){if(!e.length)return null;let t=0,r=e[0];for(let s=1;s<e.length;s++){let i=e[s];if(i.from>r.from||i.to<r.to)r=i,t=s}let n=r instanceof Yr&&r.index<0?null:r.parent,o=e.slice();if(n)o[t]=n;else o.splice(t,1);return new EC(o,r)}class EC{constructor(e,t){this.heads=e,this.node=t}get next(){return SC(this.heads)}}function PN(e,t,r){let n=e.resolveInner(t,r),o=null;for(let s=n instanceof Yr?n:n.context.parent;s;s=s.parent)if(s.index<0){let i=s.parent;(o||(o=[n])).push(i.resolve(t,r)),s=i}else{let i=ac.get(s.tree);if(i&&i.overlay&&i.overlay[0].from<=t&&i.overlay[i.overlay.length-1].to>=t){let a=new Yr(i.tree,i.overlay[0].from+s.from,-1,s);(o||(o=[n])).push(hu(a,t,r,!1))}}return o?SC(o):n}class xp{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~pt.EnterBracketed,e instanceof Yr)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){if(!e)return!1;return this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0}yieldBuf(e,t){this.index=e;let{start:r,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=r+n.buffer[e+1],this.to=r+n.buffer[e+2],!0}yield(e){if(!e)return!1;if(e instanceof Yr)return this.buffer=null,this.yieldNode(e);return this.buffer=e.context,this.yieldBuf(e.index,e.type)}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:n}=this.buffer,o=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,r);if(o<0)return!1;return this.stack.push(this.index),this.yieldBuf(o)}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,r=this.mode){if(!this.buffer)return this.yield(this._tree.enter(e,t,r));return r&pt.ExcludeBuffers?!1:this.enterChild(1,e,t)}parent(){if(!this.buffer)return this.yieldNode(this.mode&pt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&pt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return!this._tree._parent?!1:this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,r=this.stack.length-1;if(e<0){let n=r<0?0:this.stack[r]+4;if(this.index!=n)return this.yieldBuf(t.findChild(n,this.index,-1,0,4))}else{let n=t.buffer[this.index+3];if(n<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(n)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,r,{buffer:n}=this;if(n){if(e>0){if(this.index<n.buffer.buffer.length)return!1}else for(let o=0;o<this.index;o++)if(n.buffer.buffer[o+3]<this.index)return!1;({index:t,parent:r}=n)}else({index:t,_parent:r}=this._tree);for(;r;{index:t,_parent:r}=r)if(t>-1)for(let o=t+e,s=e<0?-1:r._tree.children.length;o!=s;o+=e){let i=r._tree.children[o];if(this.mode&pt.IncludeAnonymous||i instanceof Ds||!i.type.isAnonymous||Qx(i))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){while(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))if(!this.parent())break;while(this.enterChild(1,e,t));return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,r=0;if(e&&e.context==this.buffer)e:for(let n=this.index,o=this.stack.length;o>=0;){for(let s=e;s;s=s._parent)if(s.index==n){if(n==this.index)return s;t=s,r=o+1;break e}n=this.stack[--o]}for(let n=r;n<this.stack.length;n++)t=new Us(this.buffer,t,this.stack[n]);return this.bufferNode=new Us(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let n=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}if(!this.type.isAnonymous)n=!0}for(;;){if(n&&t)t(this);if(n=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,n=!0}}}matchContext(e){if(!this.buffer)return Tx(this.node.parent,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let n=e.length-1,o=this.stack.length-1;n>=0;o--){if(o<0)return Tx(this._tree,e,n);let s=r[t.buffer[this.stack[o]]];if(!s.isAnonymous){if(e[n]&&e[n]!=s.name)return!1;n--}}return!0}}function Qx(e){return e.children.some((t)=>t instanceof Ds||!t.type.isAnonymous||Qx(t))}function wN(e){var t;let{buffer:r,nodeSet:n,maxBufferLength:o=1024,reused:s=[],minRepeatType:i=n.types.length}=e,a=Array.isArray(r)?new vx(r,r.length):r,c=n.types,l=0,u=0;function f(C,Q,w,_,I,F){let{id:R,start:A,end:M,size:j}=a,me=u,xr=l;if(j<0)if(a.next(),j==-1){let yr=s[R];w.push(yr),_.push(A-C);return}else if(j==-3){l=R;return}else if(j==-4){u=R;return}else throw RangeError(`Unrecognized record size: ${j}`);let nn=c[R],to,Qr,Hi=A-C;if(M-A<=o&&(Qr=x(a.pos-Q,I))){let yr=new Uint16Array(Qr.size-Qr.skip),ar=a.pos-Qr.size,_r=yr.length;while(a.pos>ar)_r=O(Qr.start,yr,_r);to=new Ds(yr,M-Qr.start,n),Hi=Qr.start-C}else{let yr=a.pos-j;a.next();let ar=[],_r=[],ro=R>=i?R:-1,Bo=0,Pc=M;while(a.pos>yr)if(ro>=0&&a.id==ro&&a.size>=0){if(a.end<=Pc-o)m(ar,_r,A,Bo,a.end,Pc,ro,me,xr),Bo=ar.length,Pc=a.end;a.next()}else if(F>2500)d(A,yr,ar,_r);else f(A,yr,ar,_r,ro,F+1);if(ro>=0&&Bo>0&&Bo<ar.length)m(ar,_r,A,Bo,A,Pc,ro,me,xr);if(ar.reverse(),_r.reverse(),ro>-1&&Bo>0){let cr=h(nn,xr);to=_x(nn,ar,_r,0,ar.length,0,M-A,cr,cr)}else to=b(nn,ar,_r,M-A,me-M,xr)}w.push(to),_.push(Hi)}function d(C,Q,w,_){let I=[],F=0,R=-1;while(a.pos>Q){let{id:A,start:M,end:j,size:me}=a;if(me>4)a.next();else if(R>-1&&M<R)break;else{if(R<0)R=j-o;I.push(A,M,j),F++,a.next()}}if(F){let A=new Uint16Array(F*4),M=I[I.length-2];for(let j=I.length-3,me=0;j>=0;j-=3)A[me++]=I[j],A[me++]=I[j+1]-M,A[me++]=I[j+2]-M,A[me++]=me;w.push(new Ds(A,I[2]-M,n)),_.push(M-C)}}function h(C,Q){return(w,_,I)=>{let F=0,R=w.length-1,A,M;if(R>=0&&(A=w[R])instanceof Gt){if(!R&&A.type==C&&A.length==I)return A;if(M=A.prop(Ce.lookAhead))F=_[R]+A.length+M}return b(C,w,_,I,F,Q)}}function m(C,Q,w,_,I,F,R,A,M){let j=[],me=[];while(C.length>_)j.push(C.pop()),me.push(Q.pop()+w-I);C.push(b(n.types[R],j,me,F-I,A-F,M)),Q.push(I-w)}function b(C,Q,w,_,I,F,R){if(F){let A=[Ce.contextHash,F];R=R?[A].concat(R):[A]}if(I>25){let A=[Ce.lookAhead,I];R=R?[A].concat(R):[A]}return new Gt(C,Q,w,_,R)}function x(C,Q){let w=a.fork(),_=0,I=0,F=0,R=w.end-o,A={size:0,start:0,skip:0};e:for(let M=w.pos-C;w.pos>M;){let j=w.size;if(w.id==Q&&j>=0){A.size=_,A.start=I,A.skip=F,F+=4,_+=4,w.next();continue}let me=w.pos-j;if(j<0||me<M||w.start<R)break;let xr=w.id>=i?4:0,nn=w.start;w.next();while(w.pos>me){if(w.size<0)if(w.size==-3||w.size==-4)xr+=4;else break e;else if(w.id>=i)xr+=4;w.next()}I=nn,_+=j,F+=xr}if(Q<0||_==C)A.size=_,A.start=I,A.skip=F;return A.size>4?A:void 0}function O(C,Q,w){let{id:_,start:I,end:F,size:R}=a;if(a.next(),R>=0&&_<i){let A=w;if(R>4){let M=a.pos-(R-4);while(a.pos>M)w=O(C,Q,w)}Q[--w]=A,Q[--w]=F-C,Q[--w]=I-C,Q[--w]=_}else if(R==-3)l=_;else if(R==-4)u=_;return w}let S=[],y=[];while(a.pos>0)f(e.start||0,e.bufferStart||0,S,y,-1,0);let g=(t=e.length)!==null&&t!==void 0?t:S.length?y[0]+S[0].length:0;return new Gt(c[e.topID],S.reverse(),y.reverse(),g)}function gp(e,t){if(!e.isAnonymous||t instanceof Ds||t.type!=e)return 1;let r=OC.get(t);if(r==null){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof Gt)){r=1;break}r+=gp(e,n)}OC.set(t,r)}return r}function _x(e,t,r,n,o,s,i,a,c){let l=0;for(let m=n;m<o;m++)l+=gp(e,t[m]);let u=Math.ceil(l*1.5/8),f=[],d=[];function h(m,b,x,O,S){for(let y=x;y<O;){let g=y,C=b[y],Q=gp(e,m[y]);y++;for(;y<O;y++){let w=gp(e,m[y]);if(Q+w>=u)break;Q+=w}if(y==g+1){if(Q>u){let w=m[g];h(w.children,w.positions,0,w.children.length,b[g]+S);continue}f.push(m[g])}else{let w=b[y-1]+m[y-1].length-C;f.push(_x(e,m,b,g,y,C,w,null,c))}d.push(C+S-s)}}return h(t,r,n,o,0),(a||c)(f,d,i)}class $x{startParse(e,t,r){if(typeof e=="string")e=new bC(e);return r=!r?[new Op(0,e.length)]:r.length?r.map((n)=>new Op(n.from,n.to)):[new Op(0,0)],this.createParse(e,t||[],r)}parse(e,t,r){let n=this.startParse(e,t,r);for(;;){let o=n.advance();if(o)return o}}}class bC{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}var gC=1024,bN=0,kN,mp,hC,pt,Yr,Us,OC,Qee;var Ax=E(()=>{Ce.closedBy=new Ce({deserialize:(e)=>e.split(" ")});Ce.openedBy=new Ce({deserialize:(e)=>e.split(" ")});Ce.group=new Ce({deserialize:(e)=>e.split(" ")});Ce.isolate=new Ce({deserialize:(e)=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw RangeError("Invalid value for isolate: "+e);return e||"auto"}});Ce.contextHash=new Ce({perNode:!0});Ce.lookAhead=new Ce({perNode:!0});Ce.mounted=new Ce({perNode:!0});kN=Object.create(null);Hr.none=new Hr("",Object.create(null),0,8);mp=new WeakMap,hC=new WeakMap;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays",e[e.EnterBracketed=16]="EnterBracketed"})(pt||(pt={}));Gt.empty=new Gt(Hr.none,[],[],0);Yr=class Yr extends Cx{constructor(e,t,r,n){super();this._tree=e,this.from=t,this.index=r,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,n,o=0){for(let s=this;;){for(let{children:i,positions:a}=s._tree,c=t>0?i.length:-1;e!=c;e+=t){let l=i[e],u=a[e]+s.from,f;if(!(o&pt.EnterBracketed&&l instanceof Gt&&(f=ac.get(l))&&!f.overlay&&f.bracketed&&r>=u&&r<=u+l.length)&&!xC(n,r,u,u+l.length))continue;if(l instanceof Ds){if(o&pt.ExcludeBuffers)continue;let d=l.findChild(0,l.buffer.length,t,r-u,n);if(d>-1)return new Us(new yC(s,l,e,u),null,d)}else if(o&pt.IncludeAnonymous||(!l.type.isAnonymous||Qx(l))){let d;if(!(o&pt.IgnoreMounts)&&(d=ac.get(l))&&!d.overlay)return new Yr(d.tree,u,e,s);let h=new Yr(l,u,e,s);return o&pt.IncludeAnonymous||!h.type.isAnonymous?h:h.nextChild(t<0?l.children.length-1:0,t,r,n,o)}}if(o&pt.IncludeAnonymous||!s.type.isAnonymous)return null;if(s.index>=0)e=s.index+t;else e=t<0?-1:s._parent._tree.children.length;if(s=s._parent,!s)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,r=0){let n;if(!(r&pt.IgnoreOverlays)&&(n=ac.get(this._tree))&&n.overlay){let o=e-this.from,s=r&pt.EnterBracketed&&n.bracketed;for(let{from:i,to:a}of n.overlay)if((t>0||s?i<=o:i<o)&&(t<0||s?a>=o:a>o))return new Yr(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,r)}nextSignificantParent(){let e=this;while(e.type.isAnonymous&&e._parent)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};Us=class Us extends Cx{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,r){super();this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:n}=this.context,o=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,r);return o<0?null:new Us(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,r=0){if(r&pt.ExcludeBuffers)return null;let{buffer:n}=this.context,o=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return o<0?null:new Us(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];if(t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length))return new Us(this.context,this._parent,t);return this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;if(this.index==t)return this.externalSibling(-1);return new Us(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,n=this.index+4,o=r.buffer[this.index+3];if(o>n){let s=r.buffer[this.index+1];e.push(r.slice(n,o,s)),t.push(0)}return new Gt(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};OC=new WeakMap;Qee=new Ce({perNode:!0})});class Sp{constructor(e,t,r,n,o,s,i,a,c,l=0,u){this.p=e,this.stack=t,this.state=r,this.reducePos=n,this.pos=o,this.score=s,this.buffer=i,this.bufferBase=a,this.curContext=c,this.lookAhead=l,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,r=0){let n=e.parser.context;return new Sp(e,[],t,r,r,0,[],0,n?new Fx(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let r=e>>19,n=e&65535,{parser:o}=this.p,s=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),i=o.dynamicPrecedence(n);if(i)this.score+=i;if(r==0){if(n<o.minRepeatTerm&&this.reducePos<this.pos)this.reducePos=this.pos;if(this.pushState(o.getGoto(this.state,n,!0),this.reducePos),n<o.minRepeatTerm)this.storeNode(n,this.reducePos,this.reducePos,s?8:4,!0);this.reduceContext(n,this.reducePos);return}let a=this.stack.length-(r-1)*3-(e&262144?6:0),c=a?this.stack[a-2]:this.p.ranges[0].from;if(n<o.minRepeatTerm&&c==this.reducePos&&this.reducePos<this.pos)this.reducePos=this.pos;let l=this.reducePos-c;if(l>=2000&&!((t=this.p.parser.nodeSet.types[n])===null||t===void 0?void 0:t.isAnonymous)){if(c==this.p.lastBigReductionStart)this.p.bigReductionCount++,this.p.lastBigReductionSize=l;else if(this.p.lastBigReductionSize<l)this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=l}let u=a?this.stack[a-1]:0,f=this.bufferBase+this.buffer.length-u;if(n<o.minRepeatTerm||e&131072){let d=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,c,d,f+4,!0)}if(e&262144)this.state=this.stack[a];else{let d=this.stack[a-3];this.state=o.getGoto(d,n,!0)}while(this.stack.length>a)this.stack.pop();this.reduceContext(n,c)}storeNode(e,t,r,n=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let s=this.buffer.length;if(s>0&&this.buffer[s-4]==0&&this.buffer[s-1]>-1){if(t==r)return;if(this.buffer[s-2]>=t){this.buffer[s-2]=r;return}}}if(!o||this.pos==r)this.buffer.push(e,t,r,n);else{let s=this.buffer.length;if(s>0&&(this.buffer[s-4]!=0||this.buffer[s-1]<0)){let i=!1;for(let a=s;a>0&&this.buffer[a-2]>r;a-=4)if(this.buffer[a-1]>=0){i=!0;break}if(i){while(s>0&&this.buffer[s-2]>r)if(this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,n>4)n-=4}}this.buffer[s]=e,this.buffer[s+1]=t,this.buffer[s+2]=r,this.buffer[s+3]=n}}shift(e,t,r,n){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let o=e,{parser:s}=this.p;this.pos=n;let i=s.stateFlag(o,1);if(!i&&(n>r||t<=s.maxNode))this.reducePos=n;if(this.pushState(o,i?r:Math.min(r,this.reducePos)),this.shiftContext(t,r),t<=s.maxNode)this.buffer.push(t,r,n,4)}else if(this.pos=n,this.shiftContext(t,r),t<=this.p.parser.maxNode)this.buffer.push(t,r,n,4)}apply(e,t,r,n){if(e&65536)this.reduce(e);else this.shift(e,t,r,n)}useNode(e,t){let r=this.p.reused.length-1;if(r<0||this.p.reused[r]!=e)this.p.reused.push(e),r++;let n=this.pos;if(this.reducePos=this.pos=n+e.length,this.pushState(t,n),this.buffer.push(r,n,this.reducePos,-1),this.curContext)this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;if(t&&e.buffer[t-4]==0)t-=4;while(t>0&&e.buffer[t-2]>e.reducePos)t-=4;let r=e.buffer.slice(t),n=e.bufferBase+t;while(e&&n==e.bufferBase)e=e.parent;return new Sp(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,n,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let r=e<=this.p.parser.maxNode;if(r)this.storeNode(e,this.pos,t,4);this.storeNode(0,this.pos,t,r?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new CC(this);;){let r=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(r==0)return!1;if((r&65536)==0)return!0;t.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let o=0,s;o<t.length;o+=2)if((s=t[o+1])!=this.state&&this.p.parser.hasAction(s,e))n.push(t[o],s);if(this.stack.length<120)for(let o=0;n.length<8&&o<t.length;o+=2){let s=t[o+1];if(!n.some((i,a)=>a&1&&i==s))n.push(t[o],s)}t=n}let r=[];for(let n=0;n<t.length&&r.length<4;n+=2){let o=t[n+1];if(o==this.state)continue;let s=this.split();s.pushState(o,this.pos),s.storeNode(0,s.pos,s.pos,4,!0),s.shiftContext(t[n],this.pos),s.reducePos=this.pos,s.score-=200,r.push(s)}return r}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((t&65536)==0)return!1;if(!e.validAction(this.state,t)){let r=t>>19,n=t&65535,o=this.stack.length-r*3;if(o<0||e.getGoto(this.stack[o],n,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;t=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],r=(n,o)=>{if(t.includes(n))return;return t.push(n),e.allActions(n,(s)=>{if(s&393216);else if(s&65536){let i=(s>>19)-o;if(i>1){let a=s&65535,c=this.stack.length-i*3;if(c>=0&&e.getGoto(this.stack[c],a,!1)>=0)return i<<19|65536|a}}else{let i=r(s,o+1);if(i!=null)return i}})};return r(this.state,0)}forceAll(){while(!this.p.parser.stateFlag(this.state,2))if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){if(this.curContext)this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){if(this.curContext)this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;if(e<0||this.buffer[e]!=-3)this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;if(e<0||this.buffer[e]!=-4)this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new Fx(this.curContext.tracker,e);if(t.hash!=this.curContext.hash)this.emitContext();this.curContext=t}}setLookAhead(e){if(e<=this.lookAhead)return!1;return this.emitLookAhead(),this.lookAhead=e,!0}close(){if(this.curContext&&this.curContext.tracker.strict)this.emitContext();if(this.lookAhead>0)this.emitLookAhead()}}class Fx{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class CC{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,r=e>>19;if(r==0){if(this.stack==this.start.stack)this.stack=this.stack.slice();this.stack.push(this.state,0,0),this.base+=3}else this.base-=(r-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=n}}class Ep{constructor(e,t,r){if(this.stack=e,this.pos=t,this.index=r,this.buffer=e.buffer,this.index==0)this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Ep(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;if(e!=null)this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){if(this.index-=4,this.pos-=4,this.index==0)this.maybeNext()}fork(){return new Ep(this.stack,this.pos,this.index)}}function mu(e,t=Uint16Array){if(typeof e!="string")return e;let r=null;for(let n=0,o=0;n<e.length;){let s=0;for(;;){let i=e.charCodeAt(n++),a=!1;if(i==126){s=65535;break}if(i>=92)i--;if(i>=34)i--;let c=i-32;if(c>=46)c-=46,a=!0;if(s+=c,a)break;s*=46}if(r)r[o++]=s;else r=new t(s)}return r}class Ou{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}class QC{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=kC,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let r=this.range,n=this.rangeIndex,o=this.pos+e;while(o<r.from){if(!n)return null;let s=this.ranges[--n];o-=r.from-s.to,r=s}while(t<0?o>r.to:o>=r.to){if(n==this.ranges.length-1)return null;let s=this.ranges[++n];o+=s.from-r.to,r=s}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,r,n;if(t>=0&&t<this.chunk.length)r=this.pos+e,n=this.chunk.charCodeAt(t);else{let o=this.resolveOffset(e,1);if(o==null)return-1;if(r=o,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let s=this.rangeIndex,i=this.range;while(i.to<=r)i=this.ranges[++s];if(this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>i.to)this.chunk2=this.chunk2.slice(0,i.to-r);n=this.chunk2.charCodeAt(0)}}if(r>=this.token.lookAhead)this.token.lookAhead=r+1;return n}acceptToken(e,t=0){let r=t?this.resolveOffset(t,-1):this.pos;if(r==null||r<this.token.start)throw RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){if(this.chunkOff>=this.chunk.length){if(this.getChunk(),this.chunkOff==this.chunk.length)return this.next=-1}return this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){this.chunkOff+=e;while(this.pos+e>=this.range.to){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}if(this.pos+=e,this.pos>=this.token.lookAhead)this.token.lookAhead=this.pos+1;return this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t)this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1;else this.token=kC;if(this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;while(e<this.range.from)this.range=this.ranges[--this.rangeIndex];while(e>=this.range.to)this.range=this.ranges[++this.rangeIndex];if(e>=this.chunkPos&&e<this.chunkPos+this.chunk.length)this.chunkOff=e-this.chunkPos;else this.chunk="",this.chunkOff=0;this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let r="";for(let n of this.ranges){if(n.from>=t)break;if(n.to>e)r+=this.input.read(Math.max(n.from,e),Math.min(n.to,t))}return r}}class Ri{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:r}=t.p;_C(this.data,e,t,this.id,r.data,r.tokenPrecTable)}}class gu{constructor(e,t,r){this.precTable=t,this.elseToken=r,this.data=typeof e=="string"?mu(e):e}token(e,t){let r=e.pos,n=0;for(;;){let o=e.next<0,s=e.resolveOffset(1,1);if(_C(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(!o)n++;if(s==null)break;e.reset(s,e.token)}if(n)e.reset(r,e.token),e.acceptToken(this.elseToken,n)}}class Jr{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function _C(e,t,r,n,o,s){let i=0,a=1<<n,{dialect:c}=r.p.parser;e:for(;;){if((a&e[i])==0)break;let l=e[i+1];for(let h=i+3;h<l;h+=2)if((e[h+1]&a)>0){let m=e[h];if(c.allows(m)&&(t.token.value==-1||t.token.value==m||TN(m,t.token.value,o,s))){t.acceptToken(m);break}}let u=t.next,f=0,d=e[i+2];if(t.next<0&&d>f&&e[l+d*3-3]==65535){i=e[l+d*3-1];continue e}for(;f<d;){let h=f+d>>1,m=l+h+(h<<1),b=e[m],x=e[m+1]||65536;if(u<b)d=h;else if(u>=x)f=h+1;else{i=e[m+2],t.advance();continue e}}break}}function PC(e,t,r){for(let n=t,o;(o=e[n])!=65535;n++)if(o==r)return n-t;return-1}function TN(e,t,r,n){let o=PC(r,n,t);return o<0||PC(r,n,e)<o}function wC(e,t,r){let n=e.cursor(pt.IncludeAnonymous);n.moveTo(t);for(;;)if(!(r<0?n.childBefore(t):n.childAfter(t)))for(;;){if((r<0?n.to<t:n.from>t)&&!n.type.isError)return r<0?Math.max(0,Math.min(n.to-1,t-25)):Math.min(e.length,Math.max(n.from+1,t+25));if(r<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return r<0?0:e.length}}class $C{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){this.safeFrom=e.openStart?wC(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?wC(e.tree,e.to+e.offset,-1)-e.offset:e.to;while(this.trees.length)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;while(this.fragment&&this.safeTo<=e)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let r=this.trees[t],n=this.index[t];if(n==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=r.children[n],s=this.start[t]+r.positions[n];if(s>e)return this.nextStart=s,null;if(o instanceof Gt){if(s==e){if(s<this.safeFrom)return null;let i=s+o.length;if(i<=this.safeTo){let a=o.prop(Ce.lookAhead);if(!a||i+a<this.fragment.to)return o}}if(this.index[t]++,s+o.length>=Math.max(this.safeFrom,e))this.trees.push(o),this.start.push(s),this.index.push(0)}else this.index[t]++,this.nextStart=s+o.length}}}class AC{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map((r)=>new Ou)}getActions(e){let t=0,r=null,{parser:n}=e.p,{tokenizers:o}=n,s=n.stateSlot(e.state,3),i=e.curContext?e.curContext.hash:0,a=0;for(let c=0;c<o.length;c++){if((1<<c&s)==0)continue;let l=o[c],u=this.tokens[c];if(r&&!l.fallback)continue;if(l.contextual||u.start!=e.pos||u.mask!=s||u.context!=i)this.updateCachedToken(u,l,e),u.mask=s,u.context=i;if(u.lookAhead>u.end+25)a=Math.max(u.lookAhead,a);if(u.value!=0){let f=t;if(u.extended>-1)t=this.addActions(e,u.extended,u.end,t);if(t=this.addActions(e,u.value,u.end,t),!l.extend){if(r=u,t>f)break}}}while(this.actions.length>t)this.actions.pop();if(a)e.setLookAhead(a);if(!r&&e.pos==this.stream.end)r=new Ou,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,t=this.addActions(e,r.value,r.end,t);return this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Ou,{pos:r,p:n}=e;return t.start=r,t.end=Math.min(r+1,n.stream.end),t.value=r==n.stream.end?n.parser.eofTerm:0,t}updateCachedToken(e,t,r){let n=this.stream.clipPos(r.pos);if(t.token(this.stream.reset(n,e),r),e.value>-1){let{parser:o}=r.p;for(let s=0;s<o.specialized.length;s++)if(o.specialized[s]==e.value){let i=o.specializers[s](this.stream.read(e.start,e.end),r);if(i>=0&&r.p.parser.dialect.allows(i>>1)){if((i&1)==0)e.value=i>>1;else e.extended=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(n+1)}putAction(e,t,r,n){for(let o=0;o<n;o+=3)if(this.actions[o]==e)return n;return this.actions[n++]=e,this.actions[n++]=t,this.actions[n++]=r,n}addActions(e,t,r,n){let{state:o}=e,{parser:s}=e.p,{data:i}=s;for(let a=0;a<2;a++)for(let c=s.stateSlot(o,a?2:1);;c+=3){if(i[c]==65535)if(i[c+1]==1)c=Mo(i,c+2);else{if(n==0&&i[c+1]==2)n=this.putAction(Mo(i,c+2),t,r,n);break}if(i[c]==t)n=this.putAction(Mo(i,c+1),t,r,n)}return n}}class RC{constructor(e,t,r,n){this.parser=e,this.input=t,this.ranges=n,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new QC(t,n),this.tokens=new AC(e,this.stream),this.topTerm=e.top[1];let{from:o}=n[0];this.stacks=[Sp.start(this,e.top[0],o)],this.fragments=r.length&&this.stream.end-o>e.bufferLength*4?new $C(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,r=this.stacks=[],n,o;if(this.bigReductionCount>300&&e.length==1){let[s]=e;while(s.forceReduce()&&s.stack.length&&s.stack[s.stack.length-2]>=this.lastBigReductionStart);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;s<e.length;s++){let i=e[s];for(;;){if(this.tokens.mainToken=null,i.pos>t)r.push(i);else if(this.advanceStack(i,r,e))continue;else{if(!n)n=[],o=[];n.push(i);let a=this.tokens.getMainToken(i);o.push(a.value,a.end)}break}}if(!r.length){let s=n&&vN(n);if(s){if(Cr)console.log("Finish with "+this.stackID(s));return this.stackToTree(s)}if(this.parser.strict){if(Cr&&n)console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none"));throw SyntaxError("No parse at "+t)}if(!this.recovering)this.recovering=5}if(this.recovering&&n){let s=this.stoppedAt!=null&&n[0].pos>this.stoppedAt?n[0]:this.runRecovery(n,o,r);if(s){if(Cr)console.log("Force-finish "+this.stackID(s));return this.stackToTree(s.forceAll())}}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(r.length>s){r.sort((i,a)=>a.score-i.score);while(r.length>s)r.pop()}if(r.some((i)=>i.reducePos>t))this.recovering--}else if(r.length>1){e:for(let s=0;s<r.length-1;s++){let i=r[s];for(let a=s+1;a<r.length;a++){let c=r[a];if(i.sameState(c)||i.buffer.length>500&&c.buffer.length>500)if((i.score-c.score||i.buffer.length-c.buffer.length)>0)r.splice(a--,1);else{r.splice(s--,1);continue e}}}if(r.length>12)r.sort((s,i)=>i.score-s.score),r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let s=1;s<r.length;s++)if(r[s].pos<this.minStackPos)this.minStackPos=r[s].pos;return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,r){let n=e.pos,{parser:o}=this,s=Cr?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&n>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,l=c?e.curContext.hash:0;for(let u=this.fragments.nodeAt(n);u;){let f=this.parser.nodeSet.types[u.type.id]==u.type?o.getGoto(e.state,u.type.id):-1;if(f>-1&&u.length&&(!c||(u.prop(Ce.contextHash)||0)==l)){if(e.useNode(u,f),Cr)console.log(s+this.stackID(e)+` (via reuse of ${o.getName(u.type.id)})`);return!0}if(!(u instanceof Gt)||u.children.length==0||u.positions[0]>0)break;let d=u.children[0];if(d instanceof Gt&&u.positions[0]==0)u=d;else break}}let i=o.stateSlot(e.state,4);if(i>0){if(e.reduce(i),Cr)console.log(s+this.stackID(e)+` (via always-reduce ${o.getName(i&65535)})`);return!0}if(e.stack.length>=8400)while(e.stack.length>6000&&e.forceReduce());let a=this.tokens.getActions(e);for(let c=0;c<a.length;){let l=a[c++],u=a[c++],f=a[c++],d=c==a.length||!r,h=d?e:e.split(),m=this.tokens.mainToken;if(h.apply(l,u,m?m.start:h.pos,f),Cr)console.log(s+this.stackID(h)+` (via ${(l&65536)==0?"shift":`reduce of ${o.getName(l&65535)}`} for ${o.getName(u)} @ ${n}${h==e?"":", split"})`);if(d)return!0;else if(h.pos>n)t.push(h);else r.push(h)}return!1}advanceFully(e,t){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return TC(e,t),!0}}runRecovery(e,t,r){let n=null,o=!1;for(let s=0;s<e.length;s++){let i=e[s],a=t[s<<1],c=t[(s<<1)+1],l=Cr?this.stackID(i)+" -> ":"";if(i.deadEnd){if(o)continue;if(o=!0,i.restart(),Cr)console.log(l+this.stackID(i)+" (restarted)");if(this.advanceFully(i,r))continue}let u=i.split(),f=l;for(let d=0;d<10&&u.forceReduce();d++){if(Cr)console.log(f+this.stackID(u)+" (via force-reduce)");if(this.advanceFully(u,r))break;if(Cr)f=this.stackID(u)+" -> "}for(let d of i.recoverByInsert(a)){if(Cr)console.log(l+this.stackID(d)+" (via recover-insert)");this.advanceFully(d,r)}if(this.stream.end>i.pos){if(c==i.pos)c++,a=0;if(i.recoverByDelete(a,c),Cr)console.log(l+this.stackID(i)+` (via recover-delete ${this.parser.getName(a)})`);TC(i,r)}else if(!n||n.score<u.score)n=u}return n}stackToTree(e){return e.close(),Gt.build({buffer:Ep.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(Rx||(Rx=new WeakMap)).get(e);if(!t)Rx.set(e,t=String.fromCodePoint(this.nextStackID++));return t+e}}function TC(e,t){for(let r=0;r<t.length;r++){let n=t[r];if(n.pos==e.pos&&n.sameState(e)){if(t[r].score<e.score)t[r]=e;return}}t.push(e)}class IC{constructor(e,t,r){this.source=e,this.flags=t,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}class xu{constructor(e){this.start=e.start,this.shift=e.shift||Ix,this.reduce=e.reduce||Ix,this.reuse=e.reuse||Ix,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}function Mo(e,t){return e[t]|e[t+1]<<16}function vN(e){let t=null;for(let r of e){let n=r.p.stoppedAt;if((r.pos==r.p.stream.end||n!=null&&r.pos>n)&&r.p.parser.stateFlag(r.state,2)&&(!t||t.score<r.score))t=r}return t}function vC(e){if(e.external){let t=e.extend?1:0;return(r,n)=>e.external(r,n)<<1|t}return e.get}var kC,Cr,Rx=null,Ix=(e)=>e,Ii;var Ux=E(()=>{Ax();kC=new Ou;Ri.prototype.contextual=Ri.prototype.fallback=Ri.prototype.extend=!1;gu.prototype.contextual=Ri.prototype.fallback=Ri.prototype.extend=!1;Cr=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);Ii=class Ii extends $x{constructor(e){super();if(this.wrappers=[],e.version!=14)throw RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let i=0;i<e.repeatNodeCount;i++)t.push("");let r=Object.keys(e.topRules).map((i)=>e.topRules[i][1]),n=[];for(let i=0;i<t.length;i++)n.push([]);function o(i,a,c){n[i].push([a,a.deserialize(String(c))])}if(e.nodeProps)for(let i of e.nodeProps){let a=i[0];if(typeof a=="string")a=Ce[a];for(let c=1;c<i.length;){let l=i[c++];if(l>=0)o(l,a,i[c++]);else{let u=i[c+-l];for(let f=-l;f>0;f--)o(i[c++],a,u);c++}}}if(this.nodeSet=new yp(t.map((i,a)=>Hr.define({name:a>=this.minRepeatTerm?void 0:i,id:a,props:n[a],top:r.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources)this.nodeSet=this.nodeSet.extend(...e.propSources);this.strict=!1,this.bufferLength=gC;let s=mu(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let i=0;i<this.specializerSpecs.length;i++)this.specialized[i]=this.specializerSpecs[i].term;this.specializers=this.specializerSpecs.map(vC),this.states=mu(e.states,Uint32Array),this.data=mu(e.stateData),this.goto=mu(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map((i)=>typeof i=="number"?new Ri(s,i):i),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,r){let n=new RC(this,e,t,r);for(let o of this.wrappers)n=o(n,e,t,r);return n}getGoto(e,t,r=!1){let n=this.goto;if(t>=n[0])return-1;for(let o=n[t+1];;){let s=n[o++],i=s&1,a=n[o++];if(i&&r)return a;for(let c=o+(s>>1);o<c;o++)if(n[o]==e)return a;if(i)return-1}}hasAction(e,t){let r=this.data;for(let n=0;n<2;n++)for(let o=this.stateSlot(e,n?2:1),s;;o+=3){if((s=r[o])==65535)if(r[o+1]==1)s=r[o=Mo(r,o+2)];else if(r[o+1]==2)return Mo(r,o+2);else break;if(s==t||s==0)return Mo(r,o+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,(r)=>r==t?!0:null)}allActions(e,t){let r=this.stateSlot(e,4),n=r?t(r):void 0;for(let o=this.stateSlot(e,1);n==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=Mo(this.data,o+2);else break;n=t(Mo(this.data,o+1))}return n}nextStates(e){let t=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Mo(this.data,r+2);else break;if((this.data[r+2]&1)==0){let n=this.data[r+1];if(!t.some((o,s)=>s&1&&o==n))t.push(this.data[r],n)}}return t}configure(e){let t=Object.assign(Object.create(Ii.prototype),this);if(e.props)t.nodeSet=this.nodeSet.extend(...e.props);if(e.top){let r=this.topRules[e.top];if(!r)throw RangeError(`Invalid top rule name ${e.top}`);t.top=r}if(e.tokenizers)t.tokenizers=this.tokenizers.map((r)=>{let n=e.tokenizers.find((o)=>o.from==r);return n?n.to:r});if(e.specializers)t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((r,n)=>{let o=e.specializers.find((i)=>i.from==r.external);if(!o)return r;let s=Object.assign(Object.assign({},r),{external:o.to});return t.specializers[n]=vC(s),s});if(e.contextTracker)t.context=e.contextTracker;if(e.dialect)t.dialect=this.parseDialect(e.dialect);if(e.strict!=null)t.strict=e.strict;if(e.wrap)t.wrappers=t.wrappers.concat(e.wrap);if(e.bufferLength!=null)t.bufferLength=e.bufferLength;return t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),r=t.map(()=>!1);if(e)for(let o of e.split(" ")){let s=t.indexOf(o);if(s>=0)r[s]=!0}let n=null;for(let o=0;o<t.length;o++)if(!r[o])for(let s=this.dialects[t[o]],i;(i=this.data[s++])!=65535;)(n||(n=new Uint8Array(this.maxTerm+1)))[i]=1;return new IC(e,r,n)}static deserialize(e){return new Ii(e)}}});class Kr{constructor(e,t,r,n){this.name=e,this.set=t,this.base=r,this.modified=n,this.id=CN++}toString(){let{name:e}=this;for(let t of this.modified)if(t.name)e=`${t.name}(${e})`;return e}static define(e,t){let r=typeof e=="string"?e:"?";if(e instanceof Kr)t=e;if(t===null||t===void 0?void 0:t.base)throw Error("Can not derive from a modified tag");let n=new Kr(r,[],null,[]);if(n.set.push(n),t)for(let o of t.set)n.set.push(o);return n}static defineModifier(e){let t=new wp(e);return(r)=>{if(r.modified.indexOf(t)>-1)return r;return wp.get(r.base||r,r.modified.concat(t).sort((n,o)=>n.id-o.id))}}}class wp{constructor(e){this.name=e,this.instances=[],this.id=QN++}static get(e,t){if(!t.length)return e;let r=t[0].instances.find((i)=>i.base==e&&_N(t,i.modified));if(r)return r;let n=[],o=new Kr(e.name,n,e,t);for(let i of t)i.instances.push(o);let s=$N(t);for(let i of e.set)if(!i.modified.length)for(let a of s)n.push(wp.get(i,a));return o}}function _N(e,t){return e.length==t.length&&e.every((r,n)=>r==t[n])}function $N(e){let t=[[]];for(let r=0;r<e.length;r++)for(let n=0,o=t.length;n<o;n++)t.push(t[n].concat(e[r]));return t.sort((r,n)=>n.length-r.length)}function Tp(e){let t=Object.create(null);for(let r in e){let n=e[r];if(!Array.isArray(n))n=[n];for(let o of r.split(" "))if(o){let s=[],i=2,a=o;for(let f=0;;){if(a=="..."&&f>0&&f+3==o.length){i=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw RangeError("Invalid path: "+o);if(s.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==o.length)break;let h=o[f++];if(f==o.length&&h=="!"){i=0;break}if(h!="/")throw RangeError("Invalid path: "+o);a=o.slice(f)}let c=s.length-1,l=s[c];if(!l)throw RangeError("Invalid path: "+o);let u=new Su(n,i,c>0?s.slice(0,c):null);t[l]=u.sort(t[l])}}return AN.add(t)}class Su{constructor(e,t,r,n){this.tags=e,this.mode=t,this.context=r,this.next=n}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){if(!e||e.depth<this.depth)return this.next=e,this;return e.next=this.sort(e.next),e}get depth(){return this.context?this.context.length:0}}function RN(e,t){let r=Object.create(null);for(let s of e)if(!Array.isArray(s.tag))r[s.tag.id]=s.class;else for(let i of s.tag)r[i.id]=s.class;let{scope:n,all:o=null}=t||{};return{style:(s)=>{let i=o;for(let a of s)for(let c of a.set){let l=r[c.id];if(l){i=i?i+" "+l:l;break}}return i},scope:n}}var CN=0,QN=0,AN,D,bp,Ms,FC,UC,Ns,kp,Dx,jn,Fi,zn,Xn,Mx,yu,Pp,P,Iee;var Nx=E(()=>{Ax();AN=new Ce({combine(e,t){let r,n,o;while(e||t){if(!e||t&&e.depth>=t.depth)o=t,t=t.next;else o=e,e=e.next;if(r&&r.mode==o.mode&&!o.context&&!r.context)continue;let s=new Su(o.tags,o.mode,o.context);if(r)r.next=s;else n=s;r=s}return n}});Su.empty=new Su([],2,null);D=Kr.define,bp=D(),Ms=D(),FC=D(Ms),UC=D(Ms),Ns=D(),kp=D(Ns),Dx=D(Ns),jn=D(),Fi=D(jn),zn=D(),Xn=D(),Mx=D(),yu=D(Mx),Pp=D(),P={comment:bp,lineComment:D(bp),blockComment:D(bp),docComment:D(bp),name:Ms,variableName:D(Ms),typeName:FC,tagName:D(FC),propertyName:UC,attributeName:D(UC),className:D(Ms),labelName:D(Ms),namespace:D(Ms),macroName:D(Ms),literal:Ns,string:kp,docString:D(kp),character:D(kp),attributeValue:D(kp),number:Dx,integer:D(Dx),float:D(Dx),bool:D(Ns),regexp:D(Ns),escape:D(Ns),color:D(Ns),url:D(Ns),keyword:zn,self:D(zn),null:D(zn),atom:D(zn),unit:D(zn),modifier:D(zn),operatorKeyword:D(zn),controlKeyword:D(zn),definitionKeyword:D(zn),moduleKeyword:D(zn),operator:Xn,derefOperator:D(Xn),arithmeticOperator:D(Xn),logicOperator:D(Xn),bitwiseOperator:D(Xn),compareOperator:D(Xn),updateOperator:D(Xn),definitionOperator:D(Xn),typeOperator:D(Xn),controlOperator:D(Xn),punctuation:Mx,separator:D(Mx),bracket:yu,angleBracket:D(yu),squareBracket:D(yu),paren:D(yu),brace:D(yu),content:jn,heading:Fi,heading1:D(Fi),heading2:D(Fi),heading3:D(Fi),heading4:D(Fi),heading5:D(Fi),heading6:D(Fi),contentSeparator:D(jn),list:D(jn),quote:D(jn),emphasis:D(jn),strong:D(jn),link:D(jn),monospace:D(jn),strikethrough:D(jn),inserted:D(),deleted:D(),changed:D(),invalid:D(),meta:Pp,documentMeta:D(Pp),annotation:D(Pp),processingInstruction:D(Pp),definition:Kr.defineModifier("definition"),constant:Kr.defineModifier("constant"),function:Kr.defineModifier("function"),standard:Kr.defineModifier("standard"),local:Kr.defineModifier("local"),special:Kr.defineModifier("special")};for(let e in P){let t=P[e];if(t instanceof Kr)t.name=e}Iee=RN([{tag:P.link,class:"tok-link"},{tag:P.heading,class:"tok-heading"},{tag:P.emphasis,class:"tok-emphasis"},{tag:P.strong,class:"tok-strong"},{tag:P.keyword,class:"tok-keyword"},{tag:P.atom,class:"tok-atom"},{tag:P.bool,class:"tok-bool"},{tag:P.url,class:"tok-url"},{tag:P.labelName,class:"tok-labelName"},{tag:P.inserted,class:"tok-inserted"},{tag:P.deleted,class:"tok-deleted"},{tag:P.literal,class:"tok-literal"},{tag:P.string,class:"tok-string"},{tag:P.number,class:"tok-number"},{tag:[P.regexp,P.escape,P.special(P.string)],class:"tok-string2"},{tag:P.variableName,class:"tok-variableName"},{tag:P.local(P.variableName),class:"tok-variableName tok-local"},{tag:P.definition(P.variableName),class:"tok-variableName tok-definition"},{tag:P.special(P.variableName),class:"tok-variableName2"},{tag:P.definition(P.propertyName),class:"tok-propertyName tok-definition"},{tag:P.typeName,class:"tok-typeName"},{tag:P.namespace,class:"tok-namespace"},{tag:P.className,class:"tok-className"},{tag:P.macroName,class:"tok-macroName"},{tag:P.propertyName,class:"tok-propertyName"},{tag:P.operator,class:"tok-operator"},{tag:P.comment,class:"tok-comment"},{tag:P.meta,class:"tok-meta"},{tag:P.invalid,class:"tok-invalid"},{tag:P.punctuation,class:"tok-punctuation"}])});function Zx(e,t){return e>=65&&e<=90||e>=97&&e<=122||e==95||e>=192||!t&&e>=48&&e<=57}var IN=316,FN=317,DC=1,UN=2,DN=3,MN=4,NN=318,ZN=320,qN=321,WN=5,LN=6,zN=0,qx,MC=125,XN=59,Wx=47,jN=42,VN=43,BN=45,GN=60,YN=44,HN=63,JN=46,KN=91,eZ,tZ,rZ,nZ,oZ,sZ,iZ,aZ,cZ,lZ,Lx;var NC=E(()=>{Ux();Nx();qx=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],eZ=new xu({start:!1,shift(e,t){return t==WN||t==LN||t==ZN?e:t==qN},strict:!1}),tZ=new Jr((e,t)=>{let{next:r}=e;if(r==MC||r==-1||t.context)e.acceptToken(NN)},{contextual:!0,fallback:!0}),rZ=new Jr((e,t)=>{let{next:r}=e,n;if(qx.indexOf(r)>-1)return;if(r==Wx&&((n=e.peek(1))==Wx||n==jN))return;if(r!=MC&&r!=XN&&r!=-1&&!t.context)e.acceptToken(IN)},{contextual:!0}),nZ=new Jr((e,t)=>{if(e.next==KN&&!t.context)e.acceptToken(FN)},{contextual:!0}),oZ=new Jr((e,t)=>{let{next:r}=e;if(r==VN||r==BN){if(e.advance(),r==e.next){e.advance();let n=!t.context&&t.canShift(DC);e.acceptToken(n?DC:UN)}}else if(r==HN&&e.peek(1)==JN){if(e.advance(),e.advance(),e.next<48||e.next>57)e.acceptToken(DN)}},{contextual:!0});sZ=new Jr((e,t)=>{if(e.next!=GN||!t.dialectEnabled(zN))return;if(e.advance(),e.next==Wx)return;let r=0;while(qx.indexOf(e.next)>-1)e.advance(),r++;if(Zx(e.next,!0)){e.advance(),r++;while(Zx(e.next,!1))e.advance(),r++;while(qx.indexOf(e.next)>-1)e.advance(),r++;if(e.next==YN)return;for(let n=0;;n++){if(n==7){if(!Zx(e.next,!0))return;break}if(e.next!="extends".charCodeAt(n))break;e.advance(),r++}}e.acceptToken(MN,-r)}),iZ=Tp({"get set async static":P.modifier,"for while do if else switch try catch finally return throw break continue default case defer":P.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":P.operatorKeyword,"let var const using function class extends":P.definitionKeyword,"import export from":P.moduleKeyword,"with debugger new":P.keyword,TemplateString:P.special(P.string),super:P.atom,BooleanLiteral:P.bool,this:P.self,null:P.null,Star:P.modifier,VariableName:P.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":P.function(P.variableName),VariableDefinition:P.definition(P.variableName),Label:P.labelName,PropertyName:P.propertyName,PrivatePropertyName:P.special(P.propertyName),"CallExpression/MemberExpression/PropertyName":P.function(P.propertyName),"FunctionDeclaration/VariableDefinition":P.function(P.definition(P.variableName)),"ClassDeclaration/VariableDefinition":P.definition(P.className),"NewExpression/VariableName":P.className,PropertyDefinition:P.definition(P.propertyName),PrivatePropertyDefinition:P.definition(P.special(P.propertyName)),UpdateOp:P.updateOperator,"LineComment Hashbang":P.lineComment,BlockComment:P.blockComment,Number:P.number,String:P.string,Escape:P.escape,ArithOp:P.arithmeticOperator,LogicOp:P.logicOperator,BitOp:P.bitwiseOperator,CompareOp:P.compareOperator,RegExp:P.regexp,Equals:P.definitionOperator,Arrow:P.function(P.punctuation),": Spread":P.punctuation,"( )":P.paren,"[ ]":P.squareBracket,"{ }":P.brace,"InterpolationStart InterpolationEnd":P.special(P.brace),".":P.derefOperator,", ;":P.separator,"@":P.meta,TypeName:P.typeName,TypeDefinition:P.definition(P.typeName),"type enum interface implements namespace module declare":P.definitionKeyword,"abstract global Privacy readonly override":P.modifier,"is keyof unique infer asserts":P.operatorKeyword,JSXAttributeValue:P.attributeValue,JSXText:P.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":P.angleBracket,"JSXIdentifier JSXNameSpacedName":P.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":P.attributeName,"JSXBuiltin/JSXIdentifier":P.standard(P.tagName)}),aZ={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},cZ={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},lZ={__proto__:null,"<":193},Lx=Ii.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6zQ,UO'#FtOOQ!0Lf'#Ff'#FfO7VO7dO'#FfO9XQMhO'#F|O9`Q`O'#F{OOQ!0Lf'#Js'#JsOOQ!0Lb'#Jr'#JrO9eQ`O'#GwOOQ['#K_'#K_O9pQ`O'#IYO9uQ!0LrO'#IZOOQ['#J`'#J`OOQ['#I_'#I_Q`QlOOQ`QlOOO9}Q!L^O'#DvO:UQlO'#EOO:]QlO'#EQO9kQ`O'#GsO:dQMhO'#CoO:rQ`O'#EnO:}Q`O'#EyO;hQMhO'#FeO;xQ`O'#GsOOQO'#K`'#K`O;}Q`O'#K`O<]Q`O'#G{O<]Q`O'#G|O<]Q`O'#HOO9kQ`O'#HRO=SQ`O'#HUO>kQ`O'#CeO>{Q`O'#HcO?TQ`O'#HiO?TQ`O'#HkO`QlO'#HmO?TQ`O'#HoO?TQ`O'#HrO?Y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T.TV'^!e%i*ZQ$lfR)x$qT)m$l)nR4V/UT*_$x*bT*h${*YQ0w+fQ1g,VQ3_.fQ5t1iQ6P1qQ7X3cQ8r6SQ9c7WQ:^8qQ:p9bQ;Z:`Q;c:rQ;n;[R;q;dnqOXst!Z#d%m&r&t&u&w,s,x2[2_Q&l!VR,h&itmOXst!U!V!Z#d%m&i&r&t&u&w,s,x2[2_R,o&oT%lm,oR1k,XR,g&gQ&U|S+}&V&WR1^,OR+s&PT&p!W&sT&q!W&sT2^,x2_",nodeNames:"\u26A0 ArithOp ArithOp ?. JSXStartTag LineComment BlockComment Script Hashbang ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:eZ,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[iZ],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSv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:{"80":1,"82":1,"94":1,"169":1,"199":1},specialized:[{term:327,get:(e)=>aZ[e]||-1},{term:343,get:(e)=>cZ[e]||-1},{term:95,get:(e)=>lZ[e]||-1}],tokenPrec:15201})});function zx(e){return e==Ui||e==Eu}function Xx(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Cp(e,t,r){this.parent=e,this.indent=t,this.flags=r,this.hash=(e?e.hash+e.hash<<8:0)+t+(t<<4)+r+(r<<6)}function dq(e){let t=0;for(let r=0;r<e.length;r++)t+=e.charCodeAt(r)==Qp?8-t%8:1;return t}function Oq(e,t){if(t==nq)for(let r=0;r<2&&e.next>=48&&e.next<=55;r++)e.advance();else if(t==oq)for(let r=0;r<2&&Xx(e.next);r++)e.advance();else if(t==iq)for(let r=0;r<4&&Xx(e.next);r++)e.advance();else if(t==aq)for(let r=0;r<8&&Xx(e.next);r++)e.advance();else if(t==sq){if(e.next==jx){e.advance();while(e.next>=0&&e.next!=WC&&e.next!=GC&&e.next!=YC&&e.next!=Ui)e.advance();if(e.next==WC)e.advance()}}}var uZ=1,XC=194,jC=195,fZ=196,ZC=197,dZ=198,pZ=199,hZ=200,mZ=2,VC=3,qC=201,OZ=24,gZ=25,xZ=49,yZ=50,SZ=55,EZ=56,bZ=57,kZ=59,PZ=60,wZ=61,TZ=62,vZ=63,CZ=65,QZ=238,_Z=71,$Z=241,AZ=242,RZ=243,IZ=244,FZ=245,UZ=246,DZ=247,MZ=248,BC=72,NZ=249,ZZ=250,qZ=251,WZ=252,LZ=253,zZ=254,XZ=255,jZ=256,VZ=73,BZ=77,GZ=263,YZ=112,HZ=130,JZ=151,KZ=152,eq=155,Ui=10,Eu=13,Vx=32,Qp=9,Bx=35,tq=40,rq=46,jx=123,WC=125,GC=39,YC=34,LC=92,nq=111,oq=120,sq=78,iq=117,aq=85,cq,lq,uq,vp=1,HC=2,No=4,Zo=8,qo=16,Wo=32,fq,zC,pq,hq,mq,gq,xq,JC;var KC=E(()=>{Ux();Nx();cq=new Set([gZ,xZ,yZ,GZ,CZ,HZ,EZ,bZ,QZ,TZ,vZ,BC,VZ,BZ,PZ,wZ,JZ,KZ,eq,YZ]);lq=new Jr((e,t)=>{let r;if(e.next<0)e.acceptToken(pZ);else if(t.context.flags&vp){if(zx(e.next))e.acceptToken(dZ,1)}else if(((r=e.peek(-1))<0||zx(r))&&t.canShift(ZC)){let n=0;while(e.next==Vx||e.next==Qp)e.advance(),n++;if(e.next==Ui||e.next==Eu||e.next==Bx)e.acceptToken(ZC,-n)}else if(zx(e.next))e.acceptToken(fZ,1)},{contextual:!0}),uq=new Jr((e,t)=>{let r=t.context;if(r.flags)return;let n=e.peek(-1);if(n==Ui||n==Eu){let o=0,s=0;for(;;){if(e.next==Vx)o++;else if(e.next==Qp)o+=8-o%8;else break;e.advance(),s++}if(o!=r.indent&&e.next!=Ui&&e.next!=Eu&&e.next!=Bx)if(o<r.indent)e.acceptToken(jC,-s);else e.acceptToken(XC)}});fq=new Cp(null,0,0);zC=new Map([[$Z,0],[AZ,No],[RZ,Zo],[IZ,Zo|No],[FZ,qo],[UZ,qo|No],[DZ,qo|Zo],[MZ,qo|Zo|No],[NZ,Wo],[ZZ,Wo|No],[qZ,Wo|Zo],[WZ,Wo|Zo|No],[LZ,Wo|qo],[zZ,Wo|qo|No],[XZ,Wo|qo|Zo],[jZ,Wo|qo|Zo|No]].map(([e,t])=>[e,t|HC])),pq=new xu({start:fq,reduce(e,t,r,n){if(e.flags&vp&&cq.has(t)||(t==_Z||t==BC)&&e.flags&HC)return e.parent;return e},shift(e,t,r,n){if(t==XC)return new Cp(e,dq(n.read(n.pos,r.pos)),0);if(t==jC)return e.parent;if(t==OZ||t==SZ||t==kZ||t==VC)return new Cp(e,0,vp);if(zC.has(t))return new Cp(e,0,zC.get(t)|e.flags&vp);return e},hash(e){return e.hash}}),hq=new Jr((e)=>{for(let t=0;t<5;t++){if(e.next!="print".charCodeAt(t))return;e.advance()}if(/\w/.test(String.fromCharCode(e.next)))return;for(let t=0;;t++){let r=e.peek(t);if(r==Vx||r==Qp)continue;if(r!=tq&&r!=rq&&r!=Ui&&r!=Eu&&r!=Bx)e.acceptToken(uZ);return}}),mq=new Jr((e,t)=>{let{flags:r}=t.context,n=r&No?YC:GC,o=(r&Zo)>0,s=!(r&qo),i=(r&Wo)>0,a=e.pos;for(;;)if(e.next<0)break;else if(i&&e.next==jx)if(e.peek(1)==jx)e.advance(2);else{if(e.pos==a){e.acceptToken(VC,1);return}break}else if(s&&e.next==LC){if(e.pos==a){e.advance();let c=e.next;if(c>=0)e.advance(),Oq(e,c);e.acceptToken(mZ);return}break}else if(e.next==LC&&!s&&e.peek(1)>-1)e.advance(2);else if(e.next==n&&(!o||e.peek(1)==n&&e.peek(2)==n)){if(e.pos==a){e.acceptToken(qC,o?3:1);return}break}else if(e.next==Ui){if(o)e.advance();else if(e.pos==a){e.acceptToken(qC);return}break}else e.advance();if(e.pos>a)e.acceptToken(hZ)});gq=Tp({'async "*" "**" FormatConversion FormatSpec':P.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":P.controlKeyword,"in not and or is del":P.operatorKeyword,"from def class global nonlocal lambda":P.definitionKeyword,import:P.moduleKeyword,"with as print":P.keyword,Boolean:P.bool,None:P.null,VariableName:P.variableName,"CallExpression/VariableName":P.function(P.variableName),"FunctionDefinition/VariableName":P.function(P.definition(P.variableName)),"ClassDefinition/VariableName":P.definition(P.className),PropertyName:P.propertyName,"CallExpression/MemberExpression/PropertyName":P.function(P.propertyName),Comment:P.lineComment,Number:P.number,String:P.string,FormatString:P.special(P.string),Escape:P.escape,UpdateOp:P.updateOperator,"ArithOp!":P.arithmeticOperator,BitOp:P.bitwiseOperator,CompareOp:P.compareOperator,AssignOp:P.definitionOperator,Ellipsis:P.punctuation,At:P.meta,"( )":P.paren,"[ ]":P.squareBracket,"{ }":P.brace,".":P.derefOperator,", ;":P.separator}),xq={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},JC=Ii.deserialize({version:14,states:"##jQ`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}Q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t,PQ$f!RR'Q$gQ$m!UR'R$hR*X'_Q*V'_V-g,`-h.TQ.d-lQ/P.^R/Q._U.]-l.^._Q/U.aQ/b.tQ/g.zU/i.|/j/yQ/n/RQ/|/oQ0O/tU0Q/u0S0[Q0]0UQ0a0ZR0b0^R/T.`R/d.t",nodeNames:"\u26A0 print Escape { Comment Script AssignStatement * BinaryExpression BitOp BitOp BitOp BitOp ArithOp ArithOp @ ArithOp ** UnaryExpression ArithOp BitOp AwaitExpression await ) ( ParenthesizedExpression BinaryExpression or and CompareOp in not is UnaryExpression ConditionalExpression if else LambdaExpression lambda ParamList VariableName AssignOp , : NamedExpression AssignOp YieldExpression yield from TupleExpression ComprehensionExpression async for LambdaExpression ] [ ArrayExpression ArrayComprehensionExpression } { DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression CallExpression ArgList AssignOp MemberExpression . PropertyName Number String FormatString FormatReplacement FormatSelfDoc FormatConversion FormatSpec FormatReplacement FormatSelfDoc ContinuedString Ellipsis None Boolean TypeDef AssignOp UpdateStatement UpdateOp ExpressionStatement DeleteStatement del PassStatement pass BreakStatement break ContinueStatement continue ReturnStatement return YieldStatement PrintStatement RaiseStatement raise ImportStatement import as ScopeStatement global nonlocal AssertStatement assert TypeDefinition type TypeParamList TypeParam StatementGroup ; IfStatement Body elif WhileStatement while ForStatement TryStatement try except finally WithStatement with FunctionDefinition def ParamList AssignOp TypeDef ClassDefinition class DecoratedStatement Decorator At MatchStatement match MatchBody MatchClause case CapturePattern LiteralPattern ArithOp ArithOp AsPattern OrPattern LogicOp AttributePattern SequencePattern MappingPattern StarPattern ClassPattern PatternArgList KeywordPattern KeywordPattern Guard",maxTerm:277,context:pq,nodeProps:[["isolate",-5,4,71,72,73,77,""],["group",-15,6,85,87,88,90,92,94,96,98,99,100,102,105,108,110,"Statement Statement",-22,8,18,21,25,40,49,50,56,57,60,61,62,63,64,67,70,71,72,79,80,81,82,"Expression",-10,114,116,119,121,122,126,128,133,135,138,"Statement",-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S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[hq,uq,lq,mq,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:(e)=>xq[e]||-1}],tokenPrec:7668})});var yq,Sq=65536,Eq=12000,bq=80,Lo,U=(e)=>{throw new Lo(e)},Ue=(e)=>{let t=[];for(let r=e.firstChild;r!==null;r=r.nextSibling)t.push(r);return t},eQ=(e,t)=>{if(t.length>Sq)throw new Lo("Code exceeds the source size limit.");let n=yq[e].startParse(t),o=performance.now()+40,s=n.advance();while(s===null){if(performance.now()>o)throw new Lo("Code exceeds the parsing time budget.");s=n.advance()}let i=0,a=[{node:s.topNode,depth:0}];while(a.length>0){let c=a.pop();if(c===void 0)break;if(i+=1,i>Eq||c.depth>bq||performance.now()>o)throw new Lo("Code exceeds the tree inspection budget.");if(c.node.type.isError)throw new Lo("Code contains invalid or incomplete syntax.");for(let l of Ue(c.node))a.push({node:l,depth:c.depth+1})}return s.topNode},_p=(e,t="javascript")=>{let r=t==="python"&&/^[rR]["']/u.test(e),n=r?e.slice(1):e,[o]=n;if(o!=='"'&&o!=="'")throw new Lo("Unsupported string literal.");let s=t==="python"&&n.startsWith(o.repeat(3))?o.repeat(3):o;if(!n.endsWith(s))return U("Incomplete string literal.");let i=n.slice(s.length,-s.length);return r?i:kq(i)},kq=(e)=>{let t={n:`
|
|
53
|
+
`,r:"\r",t:"\t",b:"\b",f:"\f",v:"\v","\\":"\\","'":"'",'"':'"'},r="";for(let n=0;n<e.length;n+=1){let o=e[n];if(o==="\\"){n+=1;let s=e[n];if(s===void 0)return U("Incomplete escape.");if(t[s]!==void 0)r+=t[s];else if(s==="x"||s==="u"){let i=s==="x"?2:4,a=e.slice(n+1,n+1+i);if(a.length!==i||!/^[0-9a-f]+$/iu.test(a))return U("Unsupported Unicode escape.");r+=String.fromCodePoint(Number.parseInt(a,16)),n+=i}else return U("Unsupported string escape.")}else r+=o}return r};var zo=E(()=>{NC();KC();yq={python:JC.configure({strict:!0}),javascript:Lx.configure({strict:!0}),typescript:Lx.configure({dialect:"ts",strict:!0})};Lo=class Lo extends Error{name="CodeInspectionError"}});import Pq from"path";var Vn,en=(e)=>({kind:"symbol",name:e}),cc=(e)=>{if(e.length>65536)return U("A resolved string exceeds its size limit.");return{kind:"string",value:e}},sr=(e)=>{if(e?.kind==="string")return e.value;if(e?.kind==="path")return e.path;return U("An operation has an unresolved path or argument.")},wq,Tq,vq,Cq,tQ=(e)=>new Map((e==="python"?vq:Cq).map((t)=>[t,en(t)])),lc=(e,t)=>{let r=t!=="python"&&e.startsWith("node:")?e.slice(5):e;if(!(t==="python"?wq:Tq).has(r))return U(`Module ${JSON.stringify(e)} can execute code that was not inspected.`);return r==="fs/promises"?"fs":r},bu=(e)=>{let t="";for(let r of e)t=r.startsWith("/")?r:Pq.posix.join(t,r);return t};var Di=E(()=>{zo();Vn={kind:"unknown"},wq=new Set(["os","os.path","shutil","pathlib","subprocess","json","math","sys","re"]),Tq=new Set(["fs","fs/promises","path","child_process"]),vq=["print","len","str","int","float","abs","round","open","sum","sorted","list","bool","min","max","any","all"],Cq=["console","require","JSON","Deno"]});var ht,Gx=(e)=>({kind:"text",path:e,preservesNonempty:!0}),Zs=(e)=>{let t=[e],r=new Set;while(t.length>0){let n=t.pop();if(n!==void 0&&!r.has(n)){if(r.add(n),r.size>12000)return U("Data exceeds the value inspection budget.");switch(n.kind){case"string":case"number":case"text":case"data":break;case"list":{t.push(...n.items);break}case"object":{t.push(...n.entries.values());break}case"file":case"path":case"method":case"symbol":case"unknown":return!1;default:return!1}}}return!0},ir=(e)=>{if(!e.every((t)=>Zs(t)))U("Only inert data can be passed to a data operation.")},Yx=(e,t)=>{if(t?.kind==="string"&&t.value.length>0)return"write";if(t?.kind==="text"&&t.path===e&&t.preservesNonempty)return"write";return"truncate"},Qq=(e,t,r)=>{let[n,o]=t;if(t.length!==2||n?.kind!=="string"||o?.kind!=="string")return U("Text replacement needs two literal strings.");let s=o.value.length>0&&(r==="python"||!o.value.includes("$"));return e.kind==="text"?{...e,preservesNonempty:e.preservesNonempty&&s}:{kind:"text",path:null,preservesNonempty:!1}},rQ=(e,t,r,n)=>{if(ir(r),e.kind==="string"||e.kind==="text"){if(t==="replace"||t==="replaceAll")return Qq(e,r,n);if(["strip","trim","lower","upper","toLowerCase","toUpperCase","slice","substring"].includes(t))return{kind:"text",path:null,preservesNonempty:!1};if(["split","splitlines","startswith","endswith","startsWith","endsWith","includes","find","index","indexOf"].includes(t))return ht}if(n==="python"&&["get","keys","values","items","count","index"].includes(t)&&Zs(e))return ht;return U(`Unsupported data method: ${t}.`)},_q=(e)=>{let[t]=e,r=t?.kind==="file"||t?.kind==="symbol"&&t.name==="sys.stdin";if(e.length!==1||!r)return U("JSON load requires a known file or stdin without callbacks.");return ht},$q=(e)=>{let[t,r,n]=e;if(e.length!==3||t?.kind!=="string"||r?.kind!=="string"||n===void 0)return U("Regex substitution needs literal pattern/replacement and one input.");ir([n]);let o=r.value.length>0&&!r.value.includes("\\");return n.kind==="text"?{...n,preservesNonempty:n.preservesNonempty&&o}:{kind:"text",path:null,preservesNonempty:!1}},nQ=(e,t)=>{if(e==="re.sub")return $q(t);if(e==="json.load")return _q(t);if(["json.loads","JSON.parse","json.dumps","JSON.stringify","str"].includes(e)){if(ir(t),t.length!==1)return U("JSON callbacks and serialization options require review.");return["json.loads","JSON.parse"].includes(e)?ht:{kind:"text",path:null,preservesNonempty:!1}}if(["len","int","float","abs","round","sum","sorted","list","bool","min","max","any","all"].includes(e))return ir(t),ht;if(["print","console.log","console.info","console.warn","console.error"].includes(e))return ir(t),Vn;if(e==="sys.stdin.read")return ir(t),{kind:"text",path:null,preservesNonempty:!1};return null};var uc=E(()=>{zo();Di();ht={kind:"data"}});import Aq from"path";var Rq,Iq,Fq=(e,t)=>{if(!e.startsWith("fs."))return;if(t.length>2)return U("Read callbacks are not inspected.");let[,r]=t;if(r===void 0||r.kind==="string")return;if(r.kind!=="object")return U("Read options are unresolved.");for(let[n,o]of r.entries){if(n==="flag"&&sr(o)!=="r")return U("A file read flag can truncate or write the file.");if(n!=="flag"&&n!=="encoding")return U("Unsupported read option.");sr(o)}},Uq=(e,t)=>{if(!e.startsWith("fs."))return;let r=t.at(2);if(r===void 0&&t.length<=2)return;if(t.length===3&&r?.kind==="string"&&r.value.replace("-","")==="utf8")return;return U("Write encodings, flags, and callbacks require explicit review.")},Dq=(e,t)=>{let[r,n]=t;if(e.startsWith("subprocess.")){if(t.length!==1||r?.kind!=="list")return U("Subprocess options or shell execution require review.");if(r.items.length===0)return U("Empty subprocess argument list.");return r.items.map((o)=>sr(o))}if(t.length>2||n!==void 0&&n.kind!=="list")return U("Subprocess options require review.");return[sr(r),...n?.kind==="list"?n.items.map((o)=>sr(o)):[]]},Mq=(e,t,r,n)=>{let s=(e.kind==="path"?{unlink:"delete",rmdir:"delete",read_text:"read",read_bytes:"read",write_text:"write",write_bytes:"write"}:{read:"read",write:"write"})[t];if(s===void 0)return U(`Unsupported ${e.kind} method: ${t}.`);if(s==="read"&&r.length>0)return U("File read encoding and offset options require review.");if(s==="write"&&r.length!==1)return U("File write encoding and callback options require review.");let i=s==="write"?Yx(e.path,r[0]):s;return n.operations.push({kind:i,path:e.path,range:n.range}),s==="read"?Gx(e.path):Vn},Nq=(e,t)=>{if(e.length>2)return U("File opener options are not inspected.");let r=e[1]===void 0?"r":sr(e[1]),o={r:"read",rb:"read",rt:"read",w:"truncate",wb:"truncate",wt:"truncate",a:"write",ab:"write",at:"write"}[r];if(o===void 0)return U("Unsupported file open mode.");let s=sr(e[0]);return t.operations.push({kind:o,path:s,range:t.range}),{kind:"file",path:s}},oQ=(e,t,r)=>{if(e.kind==="method")return e.receiver.kind==="path"||e.receiver.kind==="file"?Mq(e.receiver,e.name,t,r):rQ(e.receiver,e.name,t,r.language);if(e.kind!=="symbol")return U("Dynamic call target.");let{name:n}=e,o=nQ(n,t);if(o!==null)return o;if(n==="require")return en(lc(sr(t[0]),r.language));if(n==="pathlib.Path"||n==="pathlib.PosixPath")return{kind:"path",path:bu(t.map((i)=>sr(i)))};if(n==="os.path.join")return cc(bu(t.map((i)=>sr(i))));if(n==="path.join")return cc(Aq.posix.join(...t.map((i)=>sr(i))));if(n==="open")return Nq(t,r);let s=Rq.get(n);if(s!==void 0)return Zq(n,s,t,r);else if(Iq.has(n))r.operations.push({kind:"process",argv:Dq(n,t),range:r.range});else return U(`Call ${JSON.stringify(n)} has uninspected effects.`);return Vn},Zq=(e,t,r,n)=>{if(t==="read")Fq(e,r);if(t==="write")Uq(e,r);let o=sr(r[0]),s=t==="write"?Yx(o,r[1]):t;if(n.operations.push({kind:s,path:o,range:n.range}),t==="read"){let[,i]=r;return e.startsWith("Deno.")||i?.kind==="string"&&i.value.toLowerCase().replace("-","")==="utf8"?Gx(o):ht}return Vn};var sQ=E(()=>{uc();zo();Di();Rq=new Map([...["os.remove","os.unlink","os.rmdir","shutil.rmtree","fs.rm","fs.rmSync","fs.unlink","fs.unlinkSync","fs.rmdir","fs.rmdirSync","Deno.remove","Deno.removeSync"].map((e)=>[e,"delete"]),...["fs.readFile","fs.readFileSync","Deno.readTextFile","Deno.readTextFileSync"].map((e)=>[e,"read"]),...["fs.writeFile","fs.writeFileSync","fs.appendFile","fs.appendFileSync","Deno.writeTextFile","Deno.writeTextFileSync"].map((e)=>[e,"write"]),...["os.truncate","fs.truncate","fs.truncateSync"].map((e)=>[e,"truncate"])]),Iq=new Set(["subprocess.run","subprocess.call","subprocess.check_call","subprocess.check_output","subprocess.Popen","child_process.execFile","child_process.execFileSync","child_process.spawn","child_process.spawnSync"])});var qq=(e,t,r)=>{let n=new Map;for(let o of Ue(e).filter((s)=>!["{","}",","].includes(s.name))){let s=Ue(o),[i,a,c]=s;if(o.name!=="Property"||i?.name!=="PropertyDefinition"||a?.name!==":"||c===void 0||s.length!==3)return U("Computed properties, accessors, and object spread are not inspected.");n.set(r(i),t(c))}return{kind:"object",entries:n}},Wq=(e,t)=>{let r=Ue(e).filter((o)=>!["{","}",","].includes(o.name)),n=new Map;for(let o=0;o<r.length;o+=3){let[s,i,a]=r.slice(o,o+3);if(s===void 0||i?.name!==":"||a===void 0)return U("Unsupported dictionary entry.");let c=t(s);if(c.kind!=="string")return U("Dictionary keys must be literal strings.");n.set(c.value,t(a))}return{kind:"object",entries:n}},Lq=(e,t)=>{for(let r of Ue(e)){if(r.name!=="FormatReplacement")return U("Unsupported formatted string component.");let n=Ue(r).filter((o)=>!["{","}"].includes(o.name));if(n.length!==1||n[0]===void 0)return U("Format conversions and specifications require review.");ir([t(n[0])])}return{kind:"text",path:null,preservesNonempty:!1}},iQ=(e,t,r)=>{switch(e.name){case"ObjectExpression":return qq(e,t,r);case"DictionaryExpression":return Wq(e,t);case"FormatString":return Lq(e,t);default:return null}};var aQ=E(()=>{uc();zo()});var cQ=(e,t)=>{e.clear();for(let[r,n]of t)e.set(r,n)},lQ=(e,t)=>{let r=new Set(t.flatMap((n)=>[...n.keys()]));e.clear();for(let n of r){let o=t[0]?.get(n);e.set(n,o!==void 0&&t.every((s)=>s.get(n)===o)?o:Vn)}},uQ=(e,t)=>{let r=new Map(t.bindings),n=[r];for(let o of Ue(e).filter((s)=>!["if","elif","else","(",")"].includes(s.name)))if(cQ(t.bindings,r),o.name==="Body"||o.name==="Block")t.statement(o),n.push(new Map(t.bindings));else ir([t.evaluate(o)]);lQ(t.bindings,n)},fQ=(e,t)=>{let r=Ue(e);if(["AssignStatement","ImportStatement","ForStatement","VariableDeclaration","WithStatement"].includes(e.name)){let n=r.findIndex((o)=>["AssignOp","Equals","in"].includes(o.name));for(let o of n===-1?r:r.slice(0,n))if(o.name==="VariableName"||o.name==="VariableDefinition")t.bindings.set(t.text(o),Vn)}for(let n of r)fQ(n,t)},Hx=(e,t,r,n,o)=>{if(e===void 0||!["VariableName","VariableDefinition"].includes(e.name)||t===void 0)return U("Only simple iteration bindings are inspected.");let s=r.evaluate(t),i;if(s.kind==="list")i=s.items;else if(s.kind==="data")i=[ht];else return U("Iteration needs bounded literals or inert JSON data.");if(i.length>128)return U("Iteration needs bounded literals or inert JSON data.");let c=[new Map(r.bindings)];if(s.kind==="data"&&o!==void 0)fQ(o,r);for(let l of i.length===0?[Vn]:i)r.bindings.set(r.text(e),l),n(),c.push(new Map(r.bindings));lQ(r.bindings,c)},dQ=(e,t)=>{let r=Ue(e),n=r.find((i)=>i.name==="ForOfSpec");if(n!==void 0){let i=Ue(n),[,a,c,l,u]=i,f=r.at(2);if(i.length!==6||!["const","let"].includes(a?.name??"")||l?.name!=="of"||f?.name!=="Block")return U("Unsupported JavaScript iteration form.");Hx(c,u,t,()=>{t.statement(f)},f);return}let o=r.findIndex((i)=>i.name==="in"),s=r[o+2];if(o!==2||s?.name!=="Body"||r.length!==5)return U("Unsupported loop shape.");Hx(r[o-1],r[o+1],t,()=>{t.statement(s)},s)},Jx=(e,t)=>{let r=e.findIndex((s)=>s.name==="for"),n=e[r-1];if(r!==1||n===void 0||e[r+2]?.name!=="in"||![5,7].includes(e.length))return U("Only single-generator comprehensions are inspected.");let o=new Map(t.bindings);return Hx(e[r+1],e[r+3],t,()=>{if(e.length===7){let[,s]=e.slice(5),i=s??U("Missing comprehension filter.");if(e[5]?.name!=="if")U("Unsupported comprehension filter.");ir([t.evaluate(i)])}ir([t.evaluate(n)])}),cQ(t.bindings,o),ht};var pQ=E(()=>{uc();zo();Di()});var zq=(e,t)=>{let r=t===null?lc(e,"python"):`${t}.${e}`;return{qualified:r,bound:t===null?r.split(".")[0]??r:r}},hQ=(e,t)=>{let[r,n]=e;if(n===void 0)return U("Missing Python import.");let o=r?.name==="from"?lc(t(n),"python"):null,s=new Map,i=o===null?1:e.findIndex((a)=>a.name==="import")+1;while(i<e.length){let a=e[i];if(a?.name!=="VariableName"&&a?.name!=="MemberExpression")return U("Unsupported Python import list.");let c=zq(t(a),o);i+=1;let l=t(a).split(".")[0]??"",{bound:u}=c;if(e[i]?.name==="as"){let f=e[i+1];if(f?.name!=="VariableName")return U("Invalid import alias.");l=t(f),u=c.qualified,i+=2}if(s.set(l,en(u)),i<e.length&&e[i]?.name!==",")return U("Unsupported import separator.");i+=1}return s},mQ=(e,t,r)=>{let n=e.find((c)=>c.name==="String");if(n===void 0)return U("Import source is unresolved.");let o=lc(_p(t(n)),r),s=e.find((c)=>c.name==="ImportGroup");if(s===void 0){let c=e.find((l)=>l.name==="VariableDefinition");if(c===void 0)return U("Unsupported JavaScript import.");return new Map([[t(c),en(o)]])}if(e.some((c)=>c.name==="VariableDefinition"))return U("Combined default and named import requires review.");let i=Ue(s).filter((c)=>!["{","}",","].includes(c.name)),a=new Map;for(let c=0;c<i.length;c+=1){let l=i[c];if(l===void 0)break;let u=i[c+1]?.name==="as"?i[c+2]:l;if(u===void 0)return U("Import alias is unresolved.");if(a.set(t(u),en(`${o}.${t(l)}`)),u!==l)c+=2}return a};var OQ=E(()=>{zo();Di()});var gQ=(e,t)=>{if(!Zs(t))return U("Index has uninspected effects.");if(e.kind==="data"||e.kind==="text"||e.kind==="string")return ht;if(e.kind==="list"&&t.kind==="number")return e.items[t.value]??ht;if(e.kind==="object"&&t.kind==="string")return e.entries.get(t.value)??ht;return U("Computed property access is not inspected.")},xQ=(e,t,r)=>{if(t.startsWith("_")||t==="constructor"||t==="prototype")return U("Runtime reflection is not inspected.");if(e.kind==="symbol")return en(`${e.name}.${t}`);if(e.kind==="path"||e.kind==="file")return{kind:"method",receiver:e,name:t};if(e.kind==="object"&&r!=="python")return e.entries.get(t)??ht;if(Zs(e)){if(e.kind==="data"&&r!=="python")return ht;return{kind:"method",receiver:e,name:t}}return U("Unknown receiver may execute a property getter.")};var yQ=E(()=>{uc();zo();Di()});class EQ{operations=[];#t;#e;#r;#s=0;#a=0;constructor(e,t){this.#e=e,this.#r=t,this.#t=tQ(t)}#o(e){return this.#e.slice(e.from,e.to)}inspect(e){for(let t of Ue(e))this.#u(t)}#u(e){if(this.#m(),SQ.has(e.name))return;let t=Ue(e).filter((r)=>!SQ.has(r.name));switch(e.name){case"Body":case"Block":case"StatementGroup":{for(let r of t)if(![":","{","}"].includes(r.name))this.#u(r);return}case"ExpressionStatement":{for(let r of t)this.#n(r);return}case"AssignStatement":case"VariableDeclaration":{this.#d(t);return}case"ImportStatement":case"ImportDeclaration":{let r=(o)=>this.#o(o),n=e.name==="ImportStatement"?hQ(t,r):mQ(t,r,this.#r);for(let[o,s]of n)this.#t.set(o,s);return}case"ForStatement":{dQ(e,this.#O());return}case"IfStatement":{uQ(e,this.#O());return}case"AssertStatement":{ir(t.filter((r)=>!["assert",","].includes(r.name)).map((r)=>this.#n(r)));return}case"WithStatement":{this.#p(t);return}default:U(`Unsupported executable syntax: ${e.name}.`)}}#d(e){let t=e.findIndex((i)=>i.name==="AssignOp"||i.name==="Equals"),r=e.find((i)=>["VariableName","VariableDefinition","ObjectPattern"].includes(i.name)),n=e[t],o=e[t+1];if(n===void 0||r===void 0||o===void 0||e.length!==t+2)return U("Unsupported binding or assignment.");if(this.#o(n)!=="=")return U("Compound assignment is not inspected.");if(e.slice(0,t).some((i)=>["MemberExpression","ArrayPattern"].includes(i.name)))return U("Destructuring or object mutation is not inspected.");let s=this.#n(o);if(r.name==="ObjectPattern")this.#f(r,s);else this.#t.set(this.#o(r),s)}#p(e){let[,t,r,n,o]=e;if(e.length!==5||t===void 0||r?.name!=="as"||n?.name!=="VariableName"||o?.name!=="Body")return U("Only a single known file context is inspected.");let s=this.#n(t);if(s.kind!=="file")return U("Context manager callbacks require review.");this.#t.set(this.#o(n),s),this.#u(o)}#f(e,t){if(t.kind!=="symbol")return U("Only named module members can be destructured.");for(let r of Ue(e).filter((n)=>!["{","}",","].includes(n.name))){let n=Ue(r),[o,s,i]=n;if(r.name!=="PatternProperty"||o?.name!=="PropertyName")return U("Computed or rest destructuring is not inspected.");if(n.length===1)this.#t.set(this.#o(o),en(`${t.name}.${this.#o(o)}`));else if(n.length===3&&s?.name===":"&&i?.name==="VariableDefinition")this.#t.set(this.#o(i),en(`${t.name}.${this.#o(o)}`));else return U("Destructuring defaults are not inspected.")}}#n(e){this.#m();let t=this.#S(e);if(t.kind==="string")this.#s+=t.value.length;if(t.kind==="path"||t.kind==="file")this.#s+=t.path.length;if(this.#s>1048576)return U("Code exceeds the resolved value budget.");return t}#m(){if(this.#a+=1,this.#a>12000)U("Code exceeds the evaluation step budget.")}#O(){return{bindings:this.#t,text:(e)=>this.#o(e),evaluate:(e)=>this.#n(e),statement:(e)=>{this.#u(e)}}}#S(e){let t=iQ(e,(r)=>this.#n(r),(r)=>this.#o(r));if(t!==null)return t;switch(e.name){case"String":return cc(_p(this.#o(e),this.#r));case"Number":return{kind:"number",value:Number(this.#o(e))};case"Boolean":case"BooleanLiteral":case"None":case"Null":return ht;case"VariableName":return this.#t.get(this.#o(e))??U("Unresolved variable or persistent runtime state.");case"ParenthesizedExpression":case"AwaitExpression":{let r=Ue(e).find((n)=>!["(",")","await"].includes(n.name));return r===void 0?U("Missing expression."):this.#n(r)}case"ArrayExpression":case"Array":case"TupleExpression":return{kind:"list",items:Ue(e).filter((r)=>!["[","]","(",")",","].includes(r.name)).map((r)=>this.#n(r))};case"ArrayComprehensionExpression":return Jx(Ue(e).filter((r)=>!["[","]"].includes(r.name)),this.#O());case"BinaryExpression":return this.#c(e);case"MemberExpression":return this.#g(e);case"CallExpression":return this.#E(e);default:return U(`Unsupported expression: ${e.name}.`)}}#c(e){let[t,r,n]=Ue(e);if(t===void 0||r===void 0||n===void 0)return U("Incomplete binary expression.");let o=this.#n(t),s=this.#n(n),i=this.#o(r);if(o.kind==="string"&&s.kind==="string"&&i==="+")return cc(o.value+s.value);if(o.kind==="path"&&i==="/")return{kind:"path",path:bu([o.path,sr(s)])};if(o.kind==="number"&&s.kind==="number"&&["+","-","*","/","%","**","==","===","<",">"].includes(i))return ht;if(Zs(o)&&Zs(s))return ht;return U("Dynamic operators are not inspected.")}#g(e){let t=Ue(e),[r,n,o]=t;if(r===void 0||o===void 0||n===void 0)return U("Computed property access is not inspected.");let s=this.#n(r);if(this.#r==="python"&&this.#o(n)==="["&&t.some((i)=>i.name===":")){let i=t.slice(2,-1).filter((a)=>a.name!==":");return ir([s,...i.map((a)=>this.#n(a))]),ht}if(this.#o(n)==="["&&t.length===4)return gQ(s,this.#n(o));if(this.#o(n)!=="."||o.name!=="PropertyName"||t.length!==3)return U("Unsupported property access.");return xQ(s,this.#o(o),this.#r)}#E(e){let[t,r]=Ue(e);if(t===void 0||r?.name!=="ArgList")return U("Unsupported call syntax.");let n=this.#n(t),o=Ue(r).filter((i)=>!["(",")",","].includes(i.name)),s=o.some((i)=>i.name==="for")?[Jx(o,this.#O())]:o.map((i)=>this.#n(i));if(s.length>128)return U("Call exceeds the argument count limit.");return oQ(n,s,{language:this.#r,range:{start:e.from,end:e.to},operations:this.operations})}}var SQ,bQ=(e,t)=>{let r=new EQ(t,e);try{return r.inspect(eQ(e,t)),{operations:r.operations,gap:null}}catch(n){return{operations:r.operations,gap:n instanceof Lo?n.message:"The code inspector failed."}}};var kQ=E(()=>{sQ();aQ();pQ();uc();OQ();yQ();zo();Di();SQ=new Set(["Comment","LineComment","BlockComment",";"])});var Xq,PQ=(e)=>{let t=e.words.slice(1);if(t.some((i)=>i.kind!=="literal"))return{kind:"blocked",reason:"The uv command contains unresolved arguments."};let r=0,n=!1,o=()=>{while(r<t.length){let i=t[r]?.value??"";if(Xq.has(i))n||=i==="--no-sync",r+=1;else if(i==="--python"||i==="-p"||i.startsWith("--python=")){let a=i.startsWith("--python="),c=a?i.slice(9):t[r+1]?.value??"";if(!/^[23](?:\.\d+){0,2}t?$/u.test(c))return!1;r+=a?1:2}else break}return!0};if(!o())return{kind:"blocked",reason:"The uv Python selector must be a literal version."};if(t[r]?.value!=="run")return e.tokens.includes("run")?{kind:"blocked",reason:"The uv run options require review."}:{kind:"irrelevant"};if(r+=1,!o())return{kind:"blocked",reason:"The uv Python selector must be a literal version."};if(t[r]?.value==="--")r+=1;let s=t[r]?.value;if(s===void 0||s.startsWith("-")&&s!=="-")return{kind:"blocked",reason:"The uv run command or options require review."};return{kind:"command",argv:t.slice(r).map((i)=>i.value),noSync:n}};var wQ=E(()=>{Xq=new Set(["--no-sync","--locked","--frozen","--offline","--no-project","--no-config","--no-python-downloads","--quiet","-q","--verbose","-v"])});import ku from"path";var $p,Bn=(e)=>({kind:"blocked",reason:e}),ey=(e)=>{let t=ku.posix.basename(e);if(/^(?:python|pypy)(?:[23](?:\.\d+)*t?)?$/u.test(t))return"python";if(["node","nodejs"].includes(t))return"javascript";if(["bun","deno","tsx","ts-node"].includes(t))return"typescript";return null},jq,Vq,Bq=(e)=>{let t=ku.posix.basename(e.head);if(!jq.has(t))return!1;return e.words.slice(1).some((r)=>ey(r.value)!==null||Vq.has(r.value.split("=")[0]??"")||/\.(?:py|pyw|mjs|cjs|js|jsx|ts|tsx)$/u.test(r.value))},Gq=(e)=>{let t=PQ(e);if(t.kind!=="command")return t;let r=t.argv[0]??"",n=r==="-"?"python":ey(r);if(n!==null){if(!t.noSync)return Bn("Inline code through uv requires --no-sync and an existing trusted environment.");if(r==="-")return t.argv.length===1?Kx(e,n):Bn("Trailing uv stdin arguments require review.");return TQ(t.argv.slice(1),n,ku.posix.basename(r))??Kx(e,n)}if(/\.(?:py|pyw|mjs|cjs|js|jsx|ts|tsx)$/u.test(r))return Bn("Script files require explicit review.");return{kind:"command",argv:t.argv}},Kx=(e,t)=>{let r=e.redirects.filter((o)=>["<<","<<<","<","<&"].includes(o.op));if(r.length!==1)return Bn("Interpreter input is absent, piped, or redirected more than once.");let[n]=r;if(n?.op==="<<"&&n.heredoc!==void 0){if(!n.heredoc.quoted&&/[$`\\]/u.test(n.heredoc.content))return Bn("Unquoted interpreter heredoc can change during shell expansion.");return{kind:"source",language:t,source:n.heredoc.content}}if(n?.op==="<<<"&&n.target.kind==="literal")return{kind:"source",language:t,source:n.target.value};return Bn("Interpreter input bytes are not available for inspection.")},TQ=(e,t,r)=>{let n=new Set(t==="python"?["-I","-S","-E","-s","-B","-u","-q"]:["--input-type=module","--input-type=commonjs","--no-warnings"]),o=0;while(o<e.length&&n.has(e[o]??""))o+=1;let s=e[o];if(s===void 0||s==="-"&&o===e.length-1)return null;let i=t==="python"?["-c"]:["-e","--eval","-p","--print"];if(r==="deno")i.push("eval");if(i.includes(s)){let l=e[o+1];if(l===void 0||e.length!==o+2)return Bn("Interpreter source or trailing arguments are not fully inspected.");return{kind:"source",language:t,source:l}}let c=(t==="python"?["-c"]:["-e","-p","--eval=","--print="]).find((l)=>s.startsWith(l));if(c!==void 0&&e.length===o+1)return{kind:"source",language:t,source:s.slice(c.length)};return Bn("Interpreter flags, script files, modules, and interactive sessions require explicit review.")},vQ=(e)=>{if(Bq(e))return Bn("A package launcher can change the interpreter or load project startup code. Use a directly inspected interpreter.");if(ku.posix.basename(e.head)==="uv")return Gq(e);let t=ey(e.head);if(t===null)return $p;let r=e.words.slice(1),n=ku.posix.basename(e.head);if(n==="bun"&&r[0]?.kind==="literal"&&["add","install","remove","update","outdated","pm","build","test"].includes(r[0].value))return $p;if(r.some((o)=>o.kind!=="literal"))return Bn("Interpreter arguments contain runtime substitutions.");if(n==="bun"&&r[0]?.value==="run"&&/^(?:check|test|typecheck|lint|format|build|verify)(?::[\w-]+)*$/u.test(r[1]?.value??""))return $p;if(r.length===1&&["--version","-V","--help","-h"].includes(r[0]?.value??""))return $p;return TQ(r.map((o)=>o.value),t,n)??Kx(e,t)};var CQ=E(()=>{wQ();$p={kind:"irrelevant"},jq=new Set(["poetry","pipenv","pipx","npx","bunx","npm","pnpm","yarn"]),Vq=new Set(["--script","--module","-m","-c","-e","--eval","--call"])});var Yq,Ap=(e)=>{let t=fu(e.file_path,"read",Yq);if(t!==null)return W(t.rule,t.message);return q("read-protect")};var ty=E(()=>{Zt();pu();Yq=[{rule:"read-env",pattern:/(?<prefix>^|\/)\.env(?<ext>\.[^/]+)?$/u,message:".env files hold secrets that should never enter the model context. Refuse to read. If the goal is documenting required env vars, look at .env.example or describe the schema from memory."},{rule:"read-dev-vars",pattern:/(?<prefix>^|\/)\.dev\.vars(?<ext>\.[^/]+)?$/u,message:"Refuse to read .dev.vars (Cloudflare/Wrangler secrets)."},{rule:"read-ssh",pattern:/(?<prefix>^|\/)\.ssh\//u,message:"Refuse to read files inside ~/.ssh/."},{rule:"read-ssh-key",pattern:/(?<prefix>^|\/)(?<key>id_rsa|id_ed25519|id_ecdsa|id_dsa)$/u,message:"Refuse to read SSH private key files."},{rule:"read-private-key",pattern:/\.(?<ext>pem|key|p12|pfx)$/iu,message:"Refuse to read private-key-shaped files."},{rule:"read-aws-credentials",pattern:/(?<prefix>^|\/)\.aws\/credentials$/u,message:"Refuse to read ~/.aws/credentials."},{rule:"read-netrc",pattern:/(?<prefix>^|\/)\.netrc$/u,message:"Refuse to read ~/.netrc (host credentials)."},{rule:"read-secrets-file",pattern:/(?<prefix>^|\/)secrets?\.(?<ext>json|ya?ml|toml|env)$/iu,message:"Refuse to read a file named secrets.{json,yaml,toml,env}."}]});import{lstatSync as Hq,realpathSync as Jq}from"fs";import qs from"path";var QQ,_Q=(e,t)=>{if(e.environmentAssignments?.some((r)=>QQ.has(r))===!0)return!0;return e.invocations.some((r)=>{if(["cd","pushd","popd"].includes(r.head)||t.remoteHeads.has(r.head))return!0;return r.head==="env"&&r.tokens.some((n)=>QQ.has(n.split("=")[0]??""))})},tn=(e)=>W("embedded-code",`${e} Use a dedicated file tool, a recoverable deletion tool, or a command Tripwire can fully inspect.`),$Q=(e)=>{let t=e,r=[];for(let n=0;n<256;n+=1){try{return qs.join(Jq(t),...r.toReversed())}catch(s){if(!(s instanceof Error)||!("code"in s)||s.code!=="ENOENT")return null}try{if(Hq(t).isSymbolicLink())return null}catch(s){if(!(s instanceof Error)||!("code"in s)||s.code!=="ENOENT")return null}let o=qs.dirname(t);if(o===t)return null;r.push(qs.basename(t)),t=o}return null},Kq=(e,t)=>{if(e===""||e.includes("\x00"))return!1;if(!nc(e,t.safePaths.relative,t.safePaths.absolute))return!1;let r=$Q(qs.resolve(t.cwd,e)),n=$Q(t.cwd);if(r===null||n===null||r===qs.parse(r).root||r===n)return!1;let o=qs.isAbsolute(e)?r:qs.relative(n,r);return nc(o,t.safePaths.relative,t.safePaths.absolute)},AQ=(e)=>`'${e.replaceAll("'",String.raw`'\''`)}'`,eW=(e,t)=>{if(e.kind==="process")return t.inspectCommand(e.argv.map(AQ).join(" "));let r=qs.resolve(t.cwd,e.path);if((e.kind==="delete"||e.kind==="truncate")&&!Kq(e.path,t))return tn(`${e.kind} outside a verified safe scope: ${JSON.stringify(e.path)}.`);return e.kind==="read"?Ap({file_path:r}):du({file_path:r,content:""})},ry=(e,t,r)=>{let n=bQ(e,t);if(n.gap!==null)return tn(n.gap);return Do(n.operations.map((o)=>eW(o,r)))},RQ=(e,t)=>{let r=[];for(let n of e.invocations){let o=vQ(n);if(o.kind==="blocked")return tn(o.reason);if(o.kind==="command"){if(_Q(e,t))return tn("The forwarded command has an unverified execution context.");r.push(t.inspectCommand(o.argv.map(AQ).join(" ")))}if(o.kind==="source"){if(_Q(e,t))return tn("Interpreter startup, working directory, or remote filesystem state is not verified.");r.push(ry(o.language,o.source,t))}}return r.length===0?q("embedded-code"):Do(r)};var IQ=E(()=>{uu();kQ();CQ();Zt();pu();ty();QQ=new Set(["NODE_OPTIONS","NODE_PATH","PYTHONPATH","PYTHONHOME","PYTHONSTARTUP","LD_PRELOAD","DYLD_INSERT_LIBRARIES","BUN_OPTIONS"])});import{readFileSync as tW}from"fs";var FQ=(e,t)=>{let r=new Set(e.split(`
|
|
54
|
+
`).map((n)=>n.trim()).filter((n)=>n.length>0));return t.split(`
|
|
55
|
+
`).filter((n)=>n.trim().length>0).filter((n)=>!r.has(n.trim()))},UQ=(e)=>{try{return tW(e,"utf8")}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return"";throw t}};var DQ=()=>{};var rW,nW,oW,sW,iW=(e)=>{if(sW.test(e))return!1;for(let t of rW)if(t.test(e))return!0;return!1},ny=(e)=>{let t=e.file_path;if(!nW.test(t)||oW.test(t))return q("lazy-code");let r="content"in e?e.content:e.new_string,n="content"in e?UQ(t):e.old_string,o=[];for(let a of FQ(n,r))if(iW(a))o.push(a.slice(0,200));if(o.length===0)return q("lazy-code");let s=o.slice(0,3).map((a)=>` \u2022 ${a}`).join(`
|
|
57
56
|
`),i=o.length>3?`
|
|
58
|
-
\u2026and ${o.length-3} more`:"";return
|
|
59
|
-
`))};var
|
|
57
|
+
\u2026and ${o.length-3} more`:"";return Wn("lazy-code-marker",["Heads up: line(s) you just added contain words that often signal incomplete or deferred work. The write went through \u2014 this is a flag, not a block.","",'Why this exists: AI coding agents have a strong pull toward stubbing things, deferring "for now," and shipping half-built fallbacks instead of finishing the work in the same turn. The point of this warning is to push back on that pull on every iteration. If you stubbed something out for time, finish it this turn rather than leaving deferred work for later.',"",'If the marker is genuinely permanent \u2014 a real product term ("auth fallback flow", "retry fallback chain", an HTML input placeholder, a public API field literally named "placeholder"), a logging tag, or a comment intentionally left for a human reader \u2014 no action needed. To silence the flag on subsequent edits of that line, append `tripwire-allow: <one-line reason>` (any comment syntax: `//`, `#`, `--`, etc.).',"","Flagged additions:",s+i].join(`
|
|
58
|
+
`))};var MQ=E(()=>{Zt();DQ();rW=[/\bTODO\s*:/iu,/\bFIXME\s*:/iu,/\bXXX\s*:/iu,/\bHACK\s*:/iu,/\bfor now\b/iu,/\bnot implemented\b/iu,/\bNotImplementedError\b/u,/\btemp fix\b/iu,/\bfallback\b/iu,/\bplaceholder\b/iu,/\bbackwards?[ -]?compat(?<ibility>ibility)?\b/iu,/\bfor later\b/iu,/\blater on\b/iu,/\bget back to\b/iu,/\bI'?ll fix\b/iu,/\bto be implemented\b/iu,/\bnot yet (?<state>implemented|done)\b/iu,/\bstubbed\b/iu],nW=/\.(?<ext>ts|tsx|js|jsx|mjs|cjs|py|rs|go|rb|java|kt|swift|c|cc|cpp|h|hpp|cs|php|sh|zsh|bash|lua|ex|exs|clj|scala|dart)$/iu,oW=/(?<prefix>^|\/)(?<dir>__tests__|tests?|spec|fixtures?|mocks?|__mocks__|stories)(?<suffix>\/|$)|\.(?<ext>test|spec|fixture|mock|stories)\.[^/]+$/iu,sW=/tripwire-allow:[ \t]*\S/u});import{spawnSync as aW}from"child_process";var cW,lW,uW,fW=({executable:e,args:t,input:r,timeoutMs:n})=>{let o=aW(e,t,{encoding:"utf8",input:r,maxBuffer:67108864,stdio:["pipe","pipe","ignore"],timeout:n}),s={status:o.status,stdout:typeof o.stdout==="string"?o.stdout:""};return o.error===void 0?s:{...s,error:o.error}},dW=(e)=>{if(typeof e!=="object"||e===null||!("code"in e))return;return typeof e.code==="string"?e.code:void 0},pW=(e)=>{let t=dW(e);if(t==="ENOENT")return"missing-executable";if(t==="ETIMEDOUT")return"timeout";return"non-zero-exit"},hW=(e)=>{let t=new Map;for(let r of e)t.set(r.RuleID,(t.get(r.RuleID)??0)+1);return[...t.entries()].map(([r,n])=>({rule:r,count:n}))},mW=(e,t)=>{let r=e,n=[...t].toSorted((o,s)=>s.Secret.length-o.Secret.length);for(let o of n)if(o.Secret!=="")r=r.replaceAll(o.Secret,`[REDACTED:${o.RuleID}]`);return r},NQ=(e,t,r=fW)=>{if(e.length===0)return{ok:!0,hits:[],redacted:e};let n;try{n=r({executable:t.executable,args:uW,input:e,timeoutMs:t.timeoutMs})}catch{return{ok:!1,category:"non-zero-exit"}}if(n.error!==void 0)return{ok:!1,category:pW(n.error)};if(n.status!==0)return{ok:!1,category:"non-zero-exit"};let o;try{o=JSON.parse(n.stdout)}catch{return{ok:!1,category:"malformed-json"}}let s=gv(lW)(o);if(Ut(s))return{ok:!1,category:"malformed-json"};let i=s.success;return{ok:!0,hits:hW(i),redacted:mW(e,i)}};var ZQ=E(()=>{Zn();cW=ot({RuleID:V,Description:V,StartLine:ou,EndLine:ou,Secret:V,Match:V}),lW=Ae(cW),uW=["stdin","--report-format","json","--report-path","-","--exit-code","0","--no-banner","--no-color","--log-level","error"]});var OW=(e)=>`Tripwire could not verify this tool output because the configured secret scanner failed (${e}). The original output was withheld. Install Betterleaks 1.5.0 or later, check secretScanner.executable and secretScanner.timeoutMs, then run the original tool again.`,qQ=(e)=>{let t=L0(e.toolName,e.response);if(t.length===0)return q("post-secret-scrub");let r=NQ(t,e.secretScanner,e.scannerRunner);if(!r.ok)return W("secret-scanner-failed",OW(r.category));if(r.hits.length===0)return q("post-secret-scrub");let n=r.hits.map((o)=>`${o.rule}\xD7${o.count}`).join(", ");return W("secrets-in-output",[`tripwire intercepted ${r.hits.length} secret pattern(s) in this tool's output (${n}). The original output was withheld so the secret never enters the model context. A redacted form is below \u2014 work from this, do not re-run the same command in a way that re-fetches the underlying secret.`,"","Redacted output:",r.redacted.slice(0,16000)+(r.redacted.length>16000?`
|
|
60
59
|
\u2026[truncated]`:"")].join(`
|
|
61
|
-
`))};var
|
|
60
|
+
`))};var WQ=E(()=>{Zt();Ex();ZQ()});var gW=(e,t)=>e.some((r)=>r.startsWith("-")&&!r.startsWith("--")&&r.slice(1).includes(t)),xW=(e,t)=>{if(!t.executables.includes(e.head))return!1;let r=e.tokens.slice(1),n=new Set(r);if(!(t.match?.argumentsIncludeAll??[]).every((o)=>n.has(o)))return!1;if(!(t.match?.argumentsStartWith??[]).every((o,s)=>r[s]===o))return!1;return(t.match?.shortFlagsIncludeAll??[]).every((o)=>gW(e.flags,o))},LQ=(e,t)=>{for(let r of e.invocations)for(let n of t)if(xW(r,n))return n.action==="deny"?W(n.rule,n.message):Wn(n.rule,n.message);return q("tool-policy")};var zQ=E(()=>{Zt()});var yW=async()=>{let e=[];for await(let t of process.stdin){let r=t;if(r instanceof Uint8Array)e.push(Buffer.from(r));else throw TypeError("Tripwire received a non-byte stdin chunk")}return Buffer.concat(e).toString("utf8")},ay,XQ=250,SW="--tripwire-hook",EW,fc=(e=ay)=>{if(e.kind==="cursor"&&!e.post){process.stdout.write(`{"continue":true,"permission":"allow"}
|
|
62
61
|
`);return}process.stdout.write(`{"continue": true}
|
|
63
|
-
`)},
|
|
64
|
-
`)},
|
|
65
|
-
`);return}let
|
|
66
|
-
`);return}let s={hookEventName:
|
|
67
|
-
`)},
|
|
68
|
-
`)},
|
|
69
|
-
`)},
|
|
62
|
+
`)},oy=(e)=>`[tripwire:${e.rule}] ${e.message}`,YQ=(e)=>{let t=e.kind==="ask"?`${oy(e)} This unattended Cursor run cannot ask a human, so the action is denied.`:oy(e);process.stdout.write(`${JSON.stringify({continue:!0,permission:"deny",user_message:t,agent_message:t})}
|
|
63
|
+
`)},HQ=(e)=>e.turn_id!==void 0,jQ=(e,t,r)=>{if(r.kind==="cursor"){process.stdout.write(`${JSON.stringify({continue:!0,permission:"allow",agent_message:oy(t)})}
|
|
64
|
+
`);return}let n=e.hook_event_name,o=`[tripwire:${t.rule}] ${t.message}`;if(HQ(e)){process.stdout.write(`${JSON.stringify({continue:!0,systemMessage:o})}
|
|
65
|
+
`);return}let s={hookEventName:n,additionalContext:o};process.stdout.write(`${JSON.stringify({continue:!0,hookSpecificOutput:s})}
|
|
66
|
+
`)},sy=(e,t,r=ay)=>{if(r.kind==="cursor"){YQ(t);return}let n={hookSpecificOutput:{hookEventName:e,permissionDecision:t.kind==="deny"?"deny":"ask",permissionDecisionReason:`[tripwire:${t.rule}] ${t.message}`}};process.stdout.write(`${JSON.stringify(n)}
|
|
67
|
+
`)},bW=(e,t)=>{if(t.kind==="cursor"){fc(t);return}let r={continue:!0,decision:"block",reason:`[tripwire:${e.rule}] ${e.message}`};process.stdout.write(`${JSON.stringify(r)}
|
|
68
|
+
`)},kW,iy=(e)=>kW[e.toLowerCase()]??e,JQ,KQ,PW=(e,t,r)=>We(function*(){let o=yield*An(xt({try:t,catch:(s)=>new JQ({cause:s})}).pipe(Ak(r)));if(kr(o))return o.value;return Ln(e,ci(o.cause)),e==="embedded-code"?tn("The code inspection rule failed or timed out."):q(e)}),Rp=(e,t,r={},n=0)=>{if(n>8)return[{name:"embedded-code",fn:()=>tn("Nested process inspection exceeds its depth limit.")}];let o=[],s=lu(e,{...r,executionCarrierAliases:t.shell.executionCarrierAliases}),i=(a,c)=>({name:a,fn:()=>sc(s,c())});return o.push({name:"embedded-code",fn:()=>RQ(s,e_(t,r.cwd,n))},i("bash-deny",()=>V0(s,t.ruleActions)),i("bash-git",()=>H0(s,t.git)),i("bash-scoped-rm",()=>oC(s,t.safePaths)),i("bash-redirect",()=>rC(s)),i("bash-network-install",()=>K0(s)),i("bash-tar-explosion",()=>aC(s)),i("tool-policy",()=>LQ(s,t.toolPolicies)),i("config-custom",()=>dC(s,t.blockedCommands,t.allowedCommands))),o},e_=(e,t,r=0)=>({safePaths:e.safePaths,remoteHeads:new Set(["ssh",...e.shell.executionCarrierAliases.map((n)=>n.command[0]??"")]),cwd:t??process.cwd(),inspectCommand:(n)=>t_(Rp(n,e,t===void 0?{}:{cwd:t},r+1))}),wW=(e,t,r,n)=>{if(e==="StatefulCode")return[{name:"embedded-code",fn:()=>tn("Persistent REPL bindings cannot be verified by a stateless hook. Use a fresh interpreter process.")}];if(e==="ExecCommand"){let o=N0(t);return tt(o)?Rp(o.value.cmd,r,n===void 0?{}:{cwd:n}):[{name:"embedded-code",fn:()=>tn("Executable tool input is missing its command.")}]}if(e==="Python"||e==="CodeRepl"||e==="Bash"&&!Sx(t)){let o=M0(t);if(Lt(o))return[{name:"embedded-code",fn:()=>tn("Executable tool input is missing its source text.")}];let s=typeof o.value==="string"?o.value:o.value.code;return[{name:"embedded-code",fn:()=>ry(e==="Python"?"python":"typescript",s,e_(r,n))}]}return},TW=(e,t,r,n)=>{let o=wW(e,t,r,n);if(o!==void 0)return o;let s=[];if(e==="PowerShell")return s.push({name:"powershell-unsupported",fn:()=>W("powershell-unsupported","PowerShell commands are blocked because Tripwire cannot parse PowerShell grammar. Use the Bash tool, or add a PowerShell parser before you enable this tool.")}),s;if(e==="Bash"&&Sx(t))return Rp(t.command,r,n===void 0?{}:{cwd:n});if(e==="Read"&&W0(t)){let c=t;return s.push({name:"read-protect",fn:()=>Ap(c)}),s}let i=(e==="Edit"||e==="MultiEdit")&&Z0(t),a=e==="Write"&&q0(t);if(i){let c=t;s.push({name:"path-protect",fn:()=>du(c)},{name:"lazy-code",fn:()=>ny(c)})}else if(a){let c=t;s.push({name:"path-protect",fn:()=>du(c)},{name:"lazy-code",fn:()=>ny(c)})}return s},vW=(e,t,r)=>{if(e==="Bash"||e==="PowerShell"||e==="Read"||e==="WebFetch"){let n=e==="PowerShell"?"Bash":e;return[{name:"post-secret-scrub",fn:()=>qQ({toolName:n,response:t,secretScanner:r})}]}return[]},VQ=(e,t)=>We(function*(){if(e.length===0)return q("no-rules");let n=[];for(let o of e)n.push(yield*PW(o.name,o.fn,t));return Do(n)}),t_=(e)=>{if(e.length===0)return q("no-rules");let t=[];for(let r of e)try{t.push(r.fn())}catch(n){Ln(r.name,n),t.push(r.name==="embedded-code"?tn("The code inspection rule failed."):q(r.name))}return Do(t)},r_=(e,t={},r={})=>t_(Rp(e,dx(t),r)),CW=(e,t,r)=>{let n=e.hook_event_name,o=iy(e.tool_name??"");if(n==="PreToolUse"&&o==="Bash"){if(t.kind==="warn"){jQ(e,t,r);return}fc(r);return}if(t.kind==="warn"){jQ(e,t,r);return}fc(r)},QW=(e)=>`tripwire config at ${fx} failed to load, so ALL custom safety policy is inactive. Failing closed until it is fixed. Fix the JSON, then this clears on the next hook call. Restart any long-running consumer that caches the loaded config. Error: ${e}`,n_=()=>{let e=process.argv.indexOf("--cursor-event");if(e!==-1)return process.argv[e+1]??"";return process.argv.find((r)=>r.startsWith("--cursor-event="))?.slice(15)},_W=()=>process.argv.includes(SW),o_=()=>{let e=n_();return e===void 0?ay:gx(e)},Ws=(e,t=!1)=>{let r=o_();if(t){sy("PreToolUse",W("tripwire-batch-error",`Tripwire batch input could not be processed (${e}). Failing closed.`),r);return}if(r.kind==="cursor"&&!r.post){YQ(W("cursor-hook-error",`Cursor hook input could not be processed (${e}). Failing closed.`));return}fc(r)},BQ=(e,t)=>{if(t.kind==="cursor")return`cursor:${t.eventName}`;return HQ(e)?"codex":"native"},GQ=(e)=>e.length===1?e[0]??q("no-rules"):Do(e),$W=(e)=>We(function*(){let r=Array.isArray(e);if(r&&!_W())return Ln("decode","Batch hook input is only available through --tripwire-hook"),Ws("unsupported batch input"),{ok:!1};let n,o;if(r){let c=yield*An(PU(EW)(e));if(ui(c))return Ln("decode",ci(c.cause)),Ws("unsupported batch event shape",!0),{ok:!1};n=c.value,o=o_()}else{let c=U0(e,n_()),l=yield*An(ru(yx)(c.event));if(ui(l))return Ln("decode",ci(l.cause)),Ws("unsupported event shape"),{ok:!1};n=[l.value],{host:o}=c}let[s]=n;if(s===void 0)return Ws("empty batch",!0),{ok:!1};let i=s.hook_event_name,a=BQ(s,o);if(n.some((c)=>c.hook_event_name!==i))return Ln("decode","Batch hook input mixes event phases"),Ws("mixed event phases",!0),{ok:!1};if(n.some((c)=>BQ(c,o)!==a))return Ln("decode","Batch hook input mixes hosts"),Ws("mixed hosts",!0),{ok:!1};return{ok:!0,events:n,firstEvent:s,host:o,phase:i}}),AW,RW,s_=()=>{fI(RW)};var cy=E(()=>{Ng();Zn();uu();px();D0();Zt();Ex();X0();bx();B0();J0();eC();nC();sC();cC();pC();IQ();MQ();pu();WQ();ty();zQ();ay={kind:"native"},EW=Ae(yx).check(Rg(1)),kW={bash:"Bash",exec:"Bash",shell:"Bash",run_command:"Bash",read:"Read",read_file:"Read",write:"Write",write_file:"Write",edit:"Edit",edit_file:"Edit",multiedit:"Edit",apply_patch:"Edit",webfetch:"WebFetch",web_fetch:"WebFetch",fetch:"WebFetch",powershell:"PowerShell",exec_command:"ExecCommand","functions.exec_command":"ExecCommand","functions.exec":"Bash",python:"Python",javascript:"CodeRepl",typescript:"CodeRepl",js_repl:"StatefulCode",python_repl:"StatefulCode","functions.js_repl":"StatefulCode"};JQ=class JQ extends Fr("RuleExecutionError"){};KQ=class KQ extends Fr("HookInputParseError"){};AW=We(function*(){let t=yield*hp(),r=yield*gs(yW),n=yield*An(xt({try:()=>JSON.parse(r),catch:(l)=>new KQ({cause:l})}));if(ui(n)){Ln("parse",ci(n.cause)),Ws("invalid JSON");return}let o=yield*$W(n.value);if(!o.ok)return;let{events:s,firstEvent:i,host:a,phase:c}=o;if(c==="PreToolUse"){if(!t.ok){sy(c,W("config-error",QW(t.error)),a);return}let l=[];for(let f of s){let d=iy(f.tool_name??"");l.push(yield*VQ(TW(d,f.tool_input,t.config,f.cwd),XQ))}let u=GQ(l);if(u.kind==="deny"||u.kind==="ask"){sy(c,u,a);return}CW(i,u,a);return}if(c==="PostToolUse"){let l=t.ok?t.config.secretScanner:pp().secretScanner,u=[];for(let d of s){let h=iy(d.tool_name??"");u.push(yield*VQ(vW(h,d.tool_response,l),XQ))}let f=GQ(u);if(f.kind==="deny"){bW(f,a);return}fc(a);return}fc(a)}),RW=AW.pipe(wr((e)=>ne(()=>{Ln("dispatch-fatal",ci(e)),Ws("dispatcher failure")})))});function IW(e){return{_tag:"Value",value:e}}function FW(e,t){return{_tag:"Record",keys:e,value:t}}function UW(e,t){return{_tag:"Array",length:e,value:t}}function NW(e,t){let r=Object.create(DW);return r.load=e,r.mapInput=t,r}function a_(e,t){return NW((r)=>e(t(r)),(r)=>a_(e,gS(t,r)))}function ZW(e){return a_(e,MW)}function qW(e,t){return e===""&&!t?void 0:e}function WW(e,t){let r=t?.preserveEmptyStrings===!0,n=zW(e);return ZW((o)=>T(jW(n,e,o,r)))}function LW(e){let t=e?.env??{...globalThis.process?.env,...import.meta?.env};return WW(t,{preserveEmptyStrings:e?.preserveEmptyStrings})}function zW(e){let t={};for(let[r,n]of Object.entries(e)){if(n===void 0)continue;let o=r.split("_"),s=t;for(let i of o){let a=s.children??=Object.create(null);s=a[i]??={}}}return t}function jW(e,t,r,n){let o=r.map(String).join("_"),s=qW(Object.hasOwn(t,o)?t[o]:void 0,n),i=VW(e,r),a=i?.children?Object.keys(i.children):[];if(a.length===0)return s===void 0?void 0:IW(s);if(a.every((l)=>XW.test(l))){let l=Math.max(...a.map((u)=>parseInt(u,10)))+1;return UW(l,s)}return FW(new Set(a),s)}function VW(e,t){if(t.length===0)return e;let r=e;for(let n of t)if(r=r?.children?.[String(n)],!r)return;return r}var i_,DW,MW=(e)=>e,XW;var c_=E(()=>{lt();ae();oe();ct();i_=Be("effect/ConfigProvider",{defaultValue:()=>LW()}),DW={...Jt,toJSON(){return{_id:"ConfigProvider"}}};XW=/^(0|[1-9][0-9]*)$/});var l_="~effect/Config",_re,ly,uy,u_;var f_=E(()=>{c_();la();Ba();kd();_re={...Pn({label:"Config",evaluate(e){return this.parse(e.getRef(i_))}}),[l_]:l_,toJSON(){return{_id:"Config"}}},ly=Xa(["true","yes","on","1","y"]),uy=Xa(["false","no","off","0","n"]),u_=Xa([...ly.literals,...uy.literals]).pipe(nu(_g,Wl({decode:(e)=>e==="true"||e==="yes"||e==="on"||e==="1"||e==="y",encode:(e)=>e?"true":"false"})))});var Qe="~effect/cli/CliError",fy=(e)=>G(e,Qe),Mi,Ip,Pu,Fp,Up,Sn,Dp,d_,HW,Ls;var wu=E(()=>{ye();ed();Ba();Mi=class Mi extends Nn(`${Qe}/UnrecognizedOption`)("UnrecognizedOption",{option:V,command:te(Ae(V)),suggestions:Ae(V)}){[Qe]=Qe;get message(){let e=this.suggestions.length>0?`
|
|
70
69
|
|
|
71
70
|
Did you mean this?
|
|
72
71
|
${this.suggestions.join(`
|
|
73
|
-
`)}`:"";return(this.command?`Unrecognized flag: ${this.option} in command ${this.command.join(" ")}`:`Unrecognized flag: ${this.option}`)+e}};
|
|
72
|
+
`)}`:"";return(this.command?`Unrecognized flag: ${this.option} in command ${this.command.join(" ")}`:`Unrecognized flag: ${this.option}`)+e}};Ip=class Ip extends Nn(`${Qe}/DuplicateOption`)("DuplicateOption",{option:V,parentCommand:V,childCommand:V}){[Qe]=Qe;get message(){return`Duplicate flag name "${this.option}" in parent command "${this.parentCommand}" and subcommand "${this.childCommand}". Parent will always claim this flag (Mode A semantics). Consider renaming one of them to avoid confusion.`}};Pu=class Pu extends Nn(`${Qe}/MissingOption`)("MissingOption",{option:V}){[Qe]=Qe;get message(){return`Missing required flag: --${this.option}`}};Fp=class Fp extends Nn(`${Qe}/MissingArgument`)("MissingArgument",{argument:V}){[Qe]=Qe;get message(){return`Missing required argument: ${this.argument}`}};Up=class Up extends Nn(`${Qe}/UnexpectedArgument`)("UnexpectedArgument",{arguments:Ae(V)}){[Qe]=Qe;get message(){return`Unexpected positional ${this.arguments.length===1?"argument":"arguments"}: ${this.arguments.map((t)=>JSON.stringify(t)).join(", ")}`}};Sn=class Sn extends Nn(`${Qe}/InvalidValue`)("InvalidValue",{option:V,value:V,expected:V,kind:hn([Lr("flag"),Lr("argument")])}){[Qe]=Qe;get message(){let e=this.expected.startsWith("Expected ")||this.expected.startsWith("Expected:")?this.expected:`Expected: ${this.expected}`;if(this.kind==="argument")return`Invalid value for argument <${this.option}>: "${this.value}". ${e}`;if(this.value.length===0)return`Missing value for flag --${this.option}. ${e}`;return`Invalid value for flag --${this.option}: "${this.value}". ${e}`}};Dp=class Dp extends Nn(`${Qe}/UnknownSubcommand`)("UnknownSubcommand",{subcommand:V,parent:te(Ae(V)),suggestions:Ae(V)}){[Qe]=Qe;get message(){let e=this.suggestions.length>0?`
|
|
74
73
|
|
|
75
74
|
Did you mean this?
|
|
76
75
|
${this.suggestions.join(`
|
|
77
|
-
`)}`:"";return this.parent?`Unknown subcommand "${this.subcommand}" for "${this.parent.join(" ")}"${e}`:`Unknown subcommand "${this.subcommand}"${e}`}};
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
`)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
`)
|
|
86
|
-
`)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
`}
|
|
91
|
-
|
|
92
|
-
`).
|
|
93
|
-
`
|
|
94
|
-
|
|
95
|
-
`))})
|
|
96
|
-
|
|
97
|
-
`))
|
|
98
|
-
`))}})},Ese=(e,t,n,r)=>{if(!e.disabled&&e.description&&t){let o=n.descriptionSeparator+e.description;return r?.plain===!0?o:yt(o,n.mutedColor)}return""},cq=(e)=>q(function*(t,n){let o=yield*(yield*Zo).columns,s=yield*Sn(e),i=Wa+su,a=uq(t,s.pointerSmall,s,{plain:!0}),c=H0(t,s.prefix,s.pointerSmall,e,s,{plain:!0});return $0(c,o,a)+i}),bse=(e,t,n,r)=>{let o=e.value===""?"":`${e.value}`;if(t||r?.plain===!0)return o;let s=Ce(e.error)?n.errorColor:Ps(ou,n.primaryColor);return yt(o,s)},uq=(e,t,n,r)=>{if(Ce(e.error))return Jf(e.error.value.split(uu),{onEmpty:()=>"",onNonEmpty:(o)=>{if(r?.plain===!0)return ja(t,o.join(`
|
|
99
|
-
`));let s=ze(t,n.errorColor),i=sn(o,(a)=>R0(a,n.errorColor));return Gy+`
|
|
100
|
-
`+ja(s,i.join(`
|
|
101
|
-
`))+Jy}});return""},H0=(e,t,n,r,o,s,i=!1)=>{let a=bse(e,i,o,s);return lu(a,r.message,t,n,s)},lq,fq,dq=(e)=>{if(e.value.length<=0)return A(z.Beep());let t=e.value.slice(0,e.value.length-1);return A(z.NextFrame({state:{...e,value:t,error:P()}}))},pq=(e)=>A(z.NextFrame({state:{...e,cursor:0,value:"",error:P()}})),wse=(e,t)=>{if(t.value.length===0&&e==="-")return A(z.NextFrame({state:{...t,value:"-",error:P()}}));let n=Number.parseInt(t.value+e);if(Number.isNaN(n))return A(z.Beep());else return A(z.NextFrame({state:{...t,value:`${n}`,error:P()}}))},kse=(e,t)=>{if(e==="."&&t.value.includes("."))return A(z.Beep());if(t.value.length===0&&e==="-")return A(z.NextFrame({state:{...t,value:"-",error:P()}}));let n=Number.parseFloat(t.value+e);if(Number.isNaN(n))return A(z.Beep());else return A(z.NextFrame({state:{...t,value:e==="."?`${n}.`:t.value.includes(".")&&/^\d$/.test(e)?t.value+e:`${n}`,error:P()}}))},Cse=(e)=>(t,n)=>z.$match(n,{Beep:()=>A(cu),NextFrame:({state:r})=>lq(r,e),Submit:()=>fq(t,e)}),vse=(e)=>(t,n)=>{if(t.key.ctrl&&t.key.name==="u")return pq(n);switch(t.key.name){case"backspace":return dq(n);case"k":case"up":return A(z.NextFrame({state:{...n,value:n.value===""||n.value==="-"?`${e.incrementBy}`:`${Number.parseInt(n.value)+e.incrementBy}`,error:P()}}));case"j":case"down":return A(z.NextFrame({state:{...n,value:n.value===""||n.value==="-"?`-${e.decrementBy}`:`${Number.parseInt(n.value)-e.decrementBy}`,error:P()}}));case"enter":case"return":{let r=Number.parseInt(n.value);if(Number.isNaN(r))return A(z.NextFrame({state:{...n,error:F("Must provide an integer value")}}));else return pa(e.validate(r),{onFailure:(o)=>z.NextFrame({state:{...n,error:F(o)}}),onSuccess:(o)=>z.Submit({value:o})})}default:return wse(It(t.input,()=>""),n)}},Ise=(e)=>(t,n)=>z.$match(n,{Beep:()=>A(cu),NextFrame:({state:r})=>lq(r,e),Submit:()=>fq(t,e)}),Ase=(e)=>(t,n)=>{if(t.key.ctrl&&t.key.name==="u")return pq(n);switch(t.key.name){case"backspace":return dq(n);case"k":case"up":return A(z.NextFrame({state:{...n,value:n.value===""||n.value==="-"?`${e.incrementBy}`:`${Number.parseFloat(n.value)+e.incrementBy}`,error:P()}}));case"j":case"down":return A(z.NextFrame({state:{...n,value:n.value===""||n.value==="-"?`-${e.decrementBy}`:`${Number.parseFloat(n.value)-e.decrementBy}`,error:P()}}));case"enter":case"return":{let r=Number.parseFloat(n.value);if(Number.isNaN(r))return A(z.NextFrame({state:{...n,error:F("Must provide a floating point value")}}));else return se(we(()=>QR(r,e.precision)),(o)=>pa(e.validate(o),{onFailure:(s)=>z.NextFrame({state:{...n,error:F(s)}}),onSuccess:(s)=>z.Submit({value:s})}))}default:return kse(It(t.input,()=>""),n)}},W0=(e,t,n,r)=>lu("",n.message,e,t,r),Tse=(e,t,n,r,o,s)=>{let i=zoe(o,r===n.startIndex&&n.startIndex>0,r===n.endIndex-1&&n.endIndex<t.length);if(s?.plain===!0)return e===r?o.pointer+i:i+" ".repeat(o.pointer.length);if(t[r].disabled){let a=Ps(Mi,o.mutedColor);return e===r?ze(o.pointer,a)+i:i+" ".repeat(o.pointer.length)}return e===r?ze(o.pointer,o.primaryColor)+i:i+" ".repeat(o.pointer.length)},_se=(e,t,n,r)=>{if(r?.plain===!0)return e.title;let o=e.title;if(t)return e.disabled?yt(o,Ps(ou,n.mutedColor)):yt(o,Ps(ou,n.primaryColor));return e.disabled?yt(o,Ps(Pj,n.mutedColor)):o},mq=(e,t,n,r)=>{let o=t.choices,s=nie(e,o.length,t.maxPerPage),i=[];for(let a=s.startIndex;a<s.endIndex;a++){let c=o[a],u=e===a,l=Tse(e,o,s,a,n,r),f=_se(c,u,n,r),d=Ese(c,u,n,r);i.push(l+f+" "+d)}return i.join(`
|
|
102
|
-
`)},Ose,Pse,Rse=(e,t)=>{if(e===0)return A(z.NextFrame({state:t.length-1}));return A(z.NextFrame({state:e-1}))},Fse=(e,t)=>{if(e===t.length-1)return A(z.NextFrame({state:0}));return A(z.NextFrame({state:e+1}))},Mse=(e,t)=>A(z.NextFrame({state:(e+1)%t.length})),Dse=(e)=>(t,n)=>z.$match(n,{Beep:()=>A(cu),NextFrame:({state:r})=>Ose(r,e),Submit:()=>Pse(t,e)}),Nse=(e)=>q(function*(t,n){let o=yield*(yield*Zo).columns,s=yield*Sn(e),i=Wa+su,a=W0(s.prefix,s.pointerSmall,e,{plain:!0}),c=mq(t,e,s,{plain:!0});return yf(`${a}
|
|
103
|
-
${c}`,o)+i}),$se=(e)=>(t,n)=>{switch(t.key.name){case"k":case"up":return Rse(n,e.choices);case"j":case"down":return Fse(n,e.choices);case"tab":return Mse(n,e.choices);case"enter":case"return":{let r=e.choices[n];if(r.disabled)return A(z.Beep());return A(z.Submit({value:r.value}))}default:return A(z.Beep())}},Use,Lse=(e,t,n,r,o)=>{let s=e.value;if(o?.plain===!0)switch(t.type){case"hidden":return"";case"password":return n.passwordMask.repeat(s.length);case"text":return s}if(s.length===0)return"";let i=Ce(e.error)?n.errorColor:r?n.submittedColor:Ps(ou,n.primaryColor);switch(t.type){case"hidden":return"";case"password":return ze(n.passwordMask.repeat(s.length),i);case"text":return yt(s,i)}},hq=(e,t,n,r)=>{if(Ce(e.error))return Jf(e.error.value.split(uu),{onEmpty:()=>"",onNonEmpty:(o)=>{if(r?.plain===!0)return ja(t,o.join(`
|
|
104
|
-
`));let s=ze(t,n.errorColor),i=sn(o,(a)=>R0(a,n.errorColor));return Gy+`
|
|
105
|
-
`+ja(s,i.join(`
|
|
106
|
-
`))+Jy}});return""},j0=(e,t,n,r,o,s,i=!1)=>{let a=Lse(e,r,o,i,s);return lu(a,r.message,t,n,s)},Bse,Hse,Wse=(e)=>{if(e.cursor<=0)return A(z.Beep());let t=e.value.slice(0,e.cursor-1),n=e.value.slice(e.cursor),r=e.cursor-1,o=`${t}${n}`;return A(z.NextFrame({state:{...e,cursor:r,value:o,error:P()}}))},jse=(e)=>A(z.NextFrame({state:{...e,cursor:0,value:"",error:P()}})),qse=(e)=>{if(e.cursor<=0)return A(z.Beep());let t=e.cursor-1;return A(z.NextFrame({state:{...e,cursor:t,error:P()}}))},zse=(e)=>{if(e.cursor>=e.value.length)return A(z.Beep());let t=Math.min(e.cursor+1,e.value.length);return A(z.NextFrame({state:{...e,cursor:t,error:P()}}))},Hj=(e)=>A(z.NextFrame({state:{...e,cursor:0,error:P()}})),Wj=(e)=>A(z.NextFrame({state:{...e,cursor:e.value.length,error:P()}})),Vse=(e,t)=>{if(e.value===t.default)return A(z.Beep());let n=e.value.length===0?t.default:e.value;return A(z.NextFrame({state:{...e,value:n,cursor:n.length,error:P()}}))},Kse=(e,t)=>{let n=t.value.slice(0,t.cursor),r=t.value.slice(t.cursor),o=`${n}${e}${r}`,s=t.cursor+e.length;return A(z.NextFrame({state:{...t,cursor:s,value:o,error:P()}}))},Gse=(e)=>(t,n)=>z.$match(n,{Beep:()=>A(cu),NextFrame:({state:r})=>Bse(r,e),Submit:()=>Hse(t,e)}),Jse=(e)=>(t,n)=>{if(t.key.ctrl)switch(t.key.name){case"u":return jse(n);case"a":return Hj(n);case"e":return Wj(n);default:return A(z.Beep())}switch(t.key.name){case"backspace":return Wse(n);case"left":return qse(n);case"right":return zse(n);case"home":return Hj(n);case"end":return Wj(n);case"enter":case"return":{let r=n.value;return pa(e.validate(r),{onFailure:(o)=>z.NextFrame({state:{...n,value:r,error:F(o)}}),onSuccess:(o)=>z.Submit({value:o})})}case"tab":return Vse(n,e);default:return Kse(It(t.input,()=>""),n)}},Qse=(e)=>(t,n)=>Use(t,e),gq=(e,t)=>{let n={default:"",type:t,validate:A,...e},r={cursor:n.default.length,value:n.default,error:P()};return au(r,{render:Gse(n),process:Jse(n),clear:Qse(n)})},Zse,xq=(e,t,n,r=!1)=>{let o=ze(n.toggleSeparator,n.mutedColor),s=Ps(ou,r?n.submittedColor:n.primaryColor),i=e?t.inactive:yt(t.inactive,s);return(e?yt(t.active,s):t.active)+" "+ja(o,i)},yq=(e,t,n,r)=>lu(e,r.message,t,n),Yse,Xse,jj,qj,eie=(e)=>(t,n)=>{switch(n._tag){case"Beep":return A(cu);case"NextFrame":return Yse(t,e);case"Submit":return Xse(t,e)}},tie=(e,t)=>{switch(e.key.name){case"0":case"j":case"delete":case"right":case"down":return qj;case"1":case"k":case"left":case"up":return jj;case" ":case"tab":return t?qj:jj;case"enter":case"return":return A(z.Submit({value:t}));default:return A(z.Beep())}},nie=(e,t,n)=>{let r=n===void 0?t:n,o=Math.min(t-r,e-Math.floor(r/2));if(o<0)o=0;let s=Math.min(o+r,t);return{startIndex:o,endIndex:s}};var Yy=v(()=>{nr();rt();Vu();Re();Fu();ne();pg();Me();ge();op();Kp();Sy();Kj={prefix:"?",arrowUp:"\u2191",arrowDown:"\u2193",checkboxOn:"\u2612",checkboxOff:"\u2610",tick:"\u2714",ellipsis:"\u2026",pointerSmall:"\u203A",pointer:"\u276F",descriptionSeparator:"- ",passwordMask:"*",toggleSeparator:"/",primaryColor:xf,mutedColor:vm,successColor:Zy,errorColor:Qy,submittedColor:iu},Hoe={...Kj,checkboxOn:"[*]",checkboxOff:"[ ]",tick:"\u221A",ellipsis:"...",pointerSmall:"\xBB",pointer:">"},joe=Te("effect/unstable/cli/Prompt/Theme",{defaultValue:Woe}),Voe=p(2,(e,t)=>{let n=Object.create(N0);return n._tag="OnSuccess",n.prompt=e,n.onSuccess=t,n}),Koe=p(2,(e,t)=>Voe(e,(n)=>Joe(t(n)))),Jn=q(function*(e){let t=yield*Zo,n=yield*t.readInput;return yield*P0(e,t,n)},Gt(()=>new dm({})),ma),N0={...ss({label:"Prompt",evaluate(){return Jn(this)}}),[zj]:{_Output:(e)=>e}},Qoe=q(function*(e,t,n){let r=yr(e.initialState)?yield*e.initialState:e.initialState,o=z.NextFrame({state:r});while(!0){let s=yield*e.render(r,o);if(yield*fo(t.display(s)),e.events){let i=mi(n).pipe(ae((c)=>({_tag:"Input",input:c}))),a=yield*Ac(i,mi(e.events).pipe(ae((c)=>({_tag:"Event",value:c}))));o=yield*e.process(a,r)}else{let i=yield*mi(n);o=yield*e.process(i,r)}switch(o._tag){case"Beep":continue;case"NextFrame":{yield*fo(t.display(yield*e.clear(r,o))),r=o.state;continue}case"Submit":{yield*fo(t.display(yield*e.clear(r,o)));let i=yield*e.render(r,o);return yield*fo(t.display(i)),o.value}}}},(e,t,n)=>ml(e,fo(n.display(Rj)))),z=qE(),cu=Fj,uu=/\r?\n/,Xoe=q(function*(e,t){let n=yield*Sn(t),r=ze(n.prefix,n.primaryColor),o=ze(n.pointerSmall,n.mutedColor),s=e.value?t.placeholder.defaultConfirm:t.placeholder.defaultDeny,i=yt(s,n.mutedColor),a=U0(i,r,o,t);return Cm+a}),ese=q(function*(e,t){let n=yield*Sn(t),r=ze(n.tick,n.successColor),o=ze(n.ellipsis,n.mutedColor),s=e?t.label.confirm:t.label.deny;return U0(s,r,o,t)+`
|
|
107
|
-
`}),nse=/^y|t$/,rse=/^n|f$/,ase=q(function*(e,t){let n=yield*Sn(t),r=ze(n.prefix,n.primaryColor),o=ze(n.pointerSmall,n.mutedColor),s=Xj(e,n),i=L0(r,o,s,t),a=ise(e,n.pointerSmall,n);return Cm+i+a}),cse=q(function*(e,t){let n=yield*Sn(t),r=ze(n.tick,n.successColor),o=ze(n.ellipsis,n.mutedColor),s=Xj(e,n,!0);return L0(r,o,s,t)+`
|
|
108
|
-
`}),hse={months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},yse=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,Bj={1:({token:e,...t})=>new B0({token:e.replace(/\\(.)/g,"$1"),...t}),2:(e)=>new oq(e),3:(e)=>new sq(e),4:(e)=>new iq(e),5:(e)=>new aq(e),6:(e)=>new rq(e),7:(e)=>new nq(e),8:(e)=>new tq(e),9:(e)=>new eq(e)};B0=class B0 extends Rs{increment(){}decrement(){}setValue(e){this.token=this.token+e}isToken(){return!0}toString(){return this.token}};eq=class eq extends Rs{increment(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}decrement(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setValue(e){this.date.setMilliseconds(Number.parseInt(e.slice(-this.token.length)))}toString(){return`${this.date.getMilliseconds()}`.padStart(4,"0").substring(0,this.token.length)}};tq=class tq extends Rs{increment(){this.date.setSeconds(this.date.getSeconds()+1)}decrement(){this.date.setSeconds(this.date.getSeconds()-1)}setValue(e){this.date.setSeconds(Number.parseInt(e.slice(-2)))}toString(){let e=`${this.date.getSeconds()}`;return this.token.length>1?e.padStart(2,"0"):e}};nq=class nq extends Rs{increment(){this.date.setMinutes(this.date.getMinutes()+1)}decrement(){this.date.setMinutes(this.date.getMinutes()-1)}setValue(e){this.date.setMinutes(Number.parseInt(e.slice(-2)))}toString(){let e=`${this.date.getMinutes()}`;return this.token.length>1?e.padStart(2,"0"):e}};rq=class rq extends Rs{increment(){this.date.setHours(this.date.getHours()+1)}decrement(){this.date.setHours(this.date.getHours()-1)}setValue(e){this.date.setHours(Number.parseInt(e.slice(-2)))}toString(){let e=/h/.test(this.token)?this.date.getHours()%12||12:this.date.getHours();return this.token.length>1?`${e}`.padStart(2,"0"):`${e}`}};oq=class oq extends Rs{increment(){this.date.setDate(this.date.getDate()+1)}decrement(){this.date.setDate(this.date.getDate()-1)}setValue(e){this.date.setDate(Number.parseInt(e.slice(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();switch(this.token){case"DD":return`${e}`.padStart(2,"0");case"Do":return`${e}${this.ordinalIndicator(e)}`;case"d":return`${t+1}`;case"ddd":return this.locales.weekdaysShort[t];case"dddd":return this.locales.weekdays[t];default:return`${e}`}}ordinalIndicator(e){if(e>=11&&e<=13)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}};sq=class sq extends Rs{increment(){this.date.setMonth(this.date.getMonth()+1)}decrement(){this.date.setMonth(this.date.getMonth()-1)}setValue(e){let t=Number.parseInt(e.slice(-2))-1;this.date.setMonth(t<0?0:t)}toString(){let e=this.date.getMonth();switch(this.token.length){case 2:return`${e+1}`.padStart(2,"0");case 3:return this.locales.monthsShort[e];case 4:return this.locales.months[e];default:return`${e+1}`}}};iq=class iq extends Rs{increment(){this.date.setFullYear(this.date.getFullYear()+1)}decrement(){this.date.setFullYear(this.date.getFullYear()-1)}setValue(e){this.date.setFullYear(Number.parseInt(e.slice(-4)))}toString(){let e=`${this.date.getFullYear()}`.padStart(4,"0");return this.token.length===2?e.slice(-2):e}};aq=class aq extends Rs{increment(){this.date.setHours((this.date.getHours()+12)%24)}decrement(){this.increment()}setValue(e){}toString(){let e=this.date.getHours()>=12?"pm":"am";return/A/.test(this.token)?e.toUpperCase():e}};lq=q(function*(e,t){let n=yield*Sn(t),r=ze(n.prefix,n.primaryColor),o=ze(n.pointerSmall,n.mutedColor),s=uq(e,n.pointerSmall,n);return H0(e,r,o,t,n)+s}),fq=q(function*(e,t){let n=yield*Sn(t),r=ze(n.tick,n.successColor),o=ze(n.ellipsis,n.mutedColor);return H0(e,r,o,t,n,void 0,!0)+`
|
|
109
|
-
`}),Ose=q(function*(e,t){let n=yield*Sn(t),r=mq(e,t,n),o=ze(n.prefix,n.primaryColor),s=ze(n.pointerSmall,n.mutedColor),i=W0(o,s,t);return Cm+i+`
|
|
110
|
-
`+r}),Pse=q(function*(e,t){let n=yield*Sn(t),r=t.choices[e].title,o=ze(n.tick,n.successColor),s=ze(n.ellipsis,n.mutedColor);return W0(o,s,t)+" "+yt(r,n.submittedColor)+`
|
|
111
|
-
`}),Use=q(function*(e,t){let r=yield*(yield*Zo).columns,o=yield*Sn(t),s=Wa+su,i=hq(e,o.pointerSmall,o,{plain:!0});return $0(j0(e,o.prefix,o.pointerSmall,t,o,{plain:!0}),r,i)+s}),Bse=q(function*(e,t){let n=yield*Sn(t),r=ze(n.prefix,n.primaryColor),o=ze(n.pointerSmall,n.mutedColor),s=j0(e,r,o,t,n),i=hq(e,n.pointerSmall,n),a=t.type==="password"?n.passwordMask.length:1,c=(e.cursor-e.value.length)*a;return s+i+$j(c)}),Hse=q(function*(e,t){let n=yield*Sn(t),r=ze(n.tick,n.successColor),o=ze(n.ellipsis,n.mutedColor);return j0(e,r,o,t,n,void 0,!0)+`
|
|
112
|
-
`}),Zse=q(function*(e){let n=yield*(yield*Zo).columns,r=yield*Sn(e),o=Wa+su,s=e.active+" "+ja(r.toggleSeparator,e.inactive),i=lu(s,e.message,r.prefix,r.pointerSmall,{plain:!0});return yf(i,n)+o}),Yse=q(function*(e,t){let n=yield*Sn(t),r=ze(n.prefix,n.primaryColor),o=ze(n.pointerSmall,n.mutedColor),s=xq(e,t,n),i=yq(s,r,o,t);return Cm+i}),Xse=q(function*(e,t){let n=yield*Sn(t),r=ze(n.tick,n.successColor),o=ze(n.ellipsis,n.mutedColor),s=xq(e,t,n,!0);return yq(s,r,o,t)+`
|
|
113
|
-
`}),jj=A(z.NextFrame({state:!0})),qj=A(z.NextFrame({state:!1}))});var Sq="~effect/cli/Param",En="argument",Bt="flag",Im,Xy=(e)=>D(e,Sq),du=(e)=>e.kind==="flag",Rn=(e)=>{let t=(n)=>e.kind===En?oie(e.name,e.primitiveType,n):sie(e.name,e.primitiveType,n);return Object.setPrototypeOf({_tag:"Single",...e,description:e.description??P(),aliases:e.aliases??[],hidden:e.hidden??!1,parse:t},Im)},eS=(e,t)=>Rn({name:t,primitiveType:kj,kind:e}),Eq=(e,t)=>Rn({name:t,primitiveType:Sj,kind:e}),tS=(e,t)=>Rn({name:t,primitiveType:bj,kind:e}),nS=(e,t)=>Rn({name:t,primitiveType:Ej,kind:e}),rS=(e,t)=>Rn({name:t,primitiveType:wj,kind:e}),Am=(e,t,n)=>Rn({name:t,primitiveType:Cj(n),kind:e}),oS=(e,t,n)=>{let r=n.map((o)=>[o,o]);return Am(e,t,r)},Sf=(e,t,n)=>Rn({name:t,kind:e,primitiveType:vj(n?.pathType??"either",n?.mustExist),typeName:n?.typeName}),sS=(e,t,n)=>Sf(e,t,{pathType:"directory",typeName:"directory",mustExist:n?.mustExist}),iS=(e,t,n)=>Sf(e,t,{pathType:"file",typeName:"file",mustExist:n?.mustExist}),aS=(e,t)=>Rn({name:t,primitiveType:Ij,kind:e}),cS=(e,t)=>Rn({name:t,primitiveType:T0,kind:e}),uS=(e,t,n)=>Rn({name:t,primitiveType:_0(n),kind:e}),lS=(e,t,n,r)=>Rn({name:t,primitiveType:Aj(n,r),kind:e}),bq=(e,t)=>pu(gu(Rn({name:t,primitiveType:Tj,kind:e}),{min:1}),(n)=>Object.fromEntries(n.flatMap(Object.entries))),fS=(e)=>Rn({name:"__none__",primitiveType:_j,kind:e}),rie,wq,dS,kq=(e)=>Di(e,(t)=>Rn({...t,hidden:!0})),pu,mu=(e,t,n=[])=>{let r=n.map((o)=>()=>o().parse);return Object.assign(Object.create(Im),{_tag:"Transform",kind:e.kind,param:e,alternatives:n,f:t,parse:t(e.parse,r)})},hu,pS,fu=(e)=>{let t=q(function*(n){return xu(e),yield*e.parse(n).pipe(ae(([r,o])=>[r,F(o)]),ck({MissingOption:()=>A([n.arguments,P()]),MissingArgument:()=>A([n.arguments,P()])}))});return Object.assign(Object.create(Im),{_tag:"Optional",kind:e.kind,param:e,parse:t})},mS,hS,gS,gu=(e,t)=>{let n=xu(e),r=(o)=>{if(n.kind==="argument")return iie(e,n,o,t);else return aie(e,n,o,t)};return Object.assign(Object.create(Im),{_tag:"Variadic",kind:e.kind,param:e,min:zs(t?.min),max:zs(t?.max),parse:r})},xS,yS,SS,Tm,ES,bS,wS,kS,CS,oie,sie,iie,aie,z0=(e,t)=>{let n=e;switch(n._tag){case"Single":return t.Single(n);case"Map":return t.Map(n);case"Transform":return t.Transform(n);case"Optional":return t.Optional(n);case"Variadic":return t.Variadic(n)}},Di=(e,t)=>z0(e,{Single:(n)=>t(n),Map:(n)=>pu(Di(n.param,t),n.f),Transform:(n)=>mu(Di(n.param,t),n.f,n.alternatives.map((r)=>()=>Di(r(),t))),Optional:(n)=>fu(Di(n.param,t)),Variadic:(n)=>gu(Di(n.param,t),{min:Un(n.min),max:Un(n.max)})}),St=(e)=>z0(e,{Single:(t)=>[t],Map:(t)=>St(t.param),Transform:(t)=>[...St(t.param),...t.alternatives.flatMap((n)=>St(n()))],Optional:(t)=>St(t.param),Variadic:(t)=>St(t.param)}),xu=(e)=>{let t=St(e);if(t.length===0)throw Error("No Single param found in param structure");if(t.length>1)throw Error(`Multiple Single params found: ${t.map((n)=>n.name).join(", ")}`);return t[0]},Pr=(e)=>z0(e,{Single:()=>({isOptional:!1,isVariadic:!1,variadicMin:P(),variadicMax:P()}),Map:(t)=>Pr(t.param),Transform:(t)=>Pr(t.param),Optional:(t)=>({...Pr(t.param),isOptional:!0}),Variadic:(t)=>({...Pr(t.param),isVariadic:!0,variadicMin:t.min,variadicMax:t.max})});var Fs=v(()=>{k0();Re();ne();Me();ct();ge();Bn();Qc();Em();gf();Yy();Im={[Sq]:{_A:L},pipe(){return fe(this,arguments)}},rie=/^-+/,wq=p(2,(e,t)=>Di(e,(n)=>Rn({...n,aliases:[...n.aliases,t.replace(rie,"")]}))),dS=p(2,(e,t)=>Di(e,(n)=>Rn({...n,description:F(t)}))),pu=p(2,(e,t)=>{let n=(r)=>ae(e.parse(r),([o,s])=>[o,t(s)]);return Object.assign(Object.create(Im),{_tag:"Map",kind:e.kind,param:e,f:t,parse:n})}),hu=p(2,(e,t)=>mu(e,(n)=>(r)=>se(n(r),([o,s])=>t(s).pipe(ae((i)=>[o,i]))))),pS=p(3,(e,t,n)=>{let r=xu(e);return mu(e,(o)=>(s)=>se(o(s),([i,a])=>Xt({try:()=>t(a),catch:(c)=>n(c)}).pipe(Gt((c)=>new fr({option:r.name,value:String(a),expected:c,kind:r.kind})),ae((c)=>[i,c]))))}),mS=p(2,(e,t)=>{if(!yr(t))return pu(fu(e),It(()=>t));return hu(fu(e),ut({onNone:()=>t,onSome:A}))}),hS=p(2,(e,t)=>{let n=(o,s)=>new fr({option:o._tag==="MissingOption"?o.option:o.argument,value:"config",expected:s.message,kind:o._tag==="MissingOption"?"flag":"argument"}),r=(o,s)=>ej(t).pipe(Gt((i)=>n(o,i)),se(ut({onNone:()=>R(o),onSome:(i)=>A([s.arguments,i])})));return mu(e,(o)=>(s)=>o(s).pipe(si(["MissingOption","MissingArgument"],(i)=>r(i,s))))}),gS=p(2,(e,t)=>{let n=(r,o)=>se(Vj(t)?A(t):t,Jn).pipe(ae((s)=>[o.arguments,s]),si("QuitError",()=>R(r)));return mu(e,(r)=>(o)=>r(o).pipe(si(["MissingOption","MissingArgument"],(s)=>n(s,o))))}),xS=p(3,(e,t,n)=>{if(t<0)throw Error("between: min must be non-negative");if(n<t)throw Error("between: max must be greater than or equal to min");return gu(e,{min:t,max:n})}),yS=p(2,(e,t)=>{if(t<0)throw Error("atMost: max must be non-negative");return gu(e,{max:t})}),SS=p(2,(e,t)=>{if(t<0)throw Error("atLeast: min must be non-negative");return gu(e,{min:t})}),Tm=p(3,(e,t,n)=>hu(e,q(function*(r){let o=t(r);if(Ce(o))return o.value;let s=xu(e);return yield*new fr({option:s.name,value:String(r),expected:n(r),kind:s.kind})}))),ES=p(3,(e,t,n)=>Tm(e,bE(t),n)),bS=p(2,(e,t)=>Di(e,(n)=>Rn({...n,typeName:t}))),wS=p(2,(e,t)=>{let n=Ai(t);return hu(e,(r)=>Gt(n(r),(o)=>{let s=xu(e);return new fr({option:s.name,value:String(r),expected:`Schema validation failed: ${o.message}`,kind:s.kind})}))}),kS=p(2,(e,t)=>mu(e,(n,r)=>(o)=>lo(n(o),()=>r[0]()(o)),[t])),CS=p(2,(e,t)=>mu(e,(n,r)=>(o)=>lo(ae(n(o),([s,i])=>[s,J(i)]),()=>ae(r[0]()(o),([s,i])=>[s,oe(i)])),[t])),oie=q(function*(e,t,n){if(n.arguments.length===0)return yield*new By({argument:e});let r=n.arguments[0],o=yield*Gt(t.parse(r),(s)=>new fr({option:e,value:r,expected:s,kind:"argument"}));return[n.arguments.slice(1),o]}),sie=q(function*(e,t,n){let r=n.flags[e];if(r===void 0||r.length===0)return yield*new Sm({option:e});let o=r[0],s=yield*Gt(t.parse(o),(i)=>new fr({option:e,value:o,expected:i,kind:"flag"}));return[n.arguments,s]}),iie=q(function*(e,t,n,r){let o=[],s=r?.min??0,i=r?.max??Number.POSITIVE_INFINITY,a=0,c=n.arguments;while(c.length>0&&a<i){let[u,l]=yield*e.parse({flags:n.flags,arguments:c});o.push(l),c=u,a++}if(a<s)return yield*new fr({option:t.name,value:`${a} values`,expected:`at least ${s} value${s===1?"":"s"}`,kind:t.kind});return[c,o]}),aie=q(function*(e,t,n,r){let o=[],i=[t.name,...t.aliases].flatMap((c)=>n.flags[c]??[]),a=i.length;if(Ve(r?.min)&&a<r.min)return yield*a===0?new Sm({option:t.name}):new fr({option:t.name,value:`${a} occurrences`,expected:`at least ${r.min} value${r.min===1?"":"s"}`,kind:t.kind});if(Ve(r?.max)&&a>r.max)return yield*new fr({option:t.name,value:`${a} occurrences`,expected:`at most ${r.max} value${r.max===1?"":"s"}`,kind:t.kind});for(let c of i){let[,u]=yield*e.parse({flags:{[t.name]:[c]},arguments:[]});o.push(u)}return[n.arguments,o]})});var Yr={};Qn(Yr,{atLeast:()=>Oie,atMost:()=>Pie,between:()=>Rie,choice:()=>mie,choiceWithValue:()=>Mie,date:()=>pie,directory:()=>fie,file:()=>lie,fileParse:()=>yie,fileSchema:()=>Sie,fileText:()=>xie,filter:()=>Nie,filterMap:()=>$ie,float:()=>die,integer:()=>uie,map:()=>Aie,mapEffect:()=>Tie,mapTryCatch:()=>_ie,none:()=>Eie,optional:()=>bie,orElse:()=>Uie,orElseResult:()=>Lie,path:()=>hie,redacted:()=>gie,string:()=>cie,variadic:()=>Iie,withDefault:()=>kie,withDescription:()=>wie,withFallbackConfig:()=>Cie,withFallbackPrompt:()=>vie,withMetavar:()=>Die,withSchema:()=>Fie});var cie=(e)=>eS(En,e),uie=(e)=>tS(En,e),lie=(e,t)=>iS(En,e,t),fie=(e,t)=>sS(En,e,t),die=(e)=>nS(En,e),pie=(e)=>rS(En,e),mie=(e,t)=>oS(En,e,t),hie=(e,t)=>Sf(En,e,t),gie=(e)=>aS(En,e),xie=(e)=>cS(En,e),yie=(e,t)=>uS(En,e,t),Sie=(e,t,n)=>lS(En,e,t,n),Eie,bie=(e)=>fu(e),wie,kie,Cie,vie,Iie,Aie,Tie,_ie,Oie,Pie,Rie,Fie,Mie=(e,t)=>Am(En,e,t),Die,Nie,$ie,Uie,Lie;var Cq=v(()=>{ne();Fs();Eie=fS(En),wie=p(2,(e,t)=>dS(e,t)),kie=mS,Cie=p(2,(e,t)=>hS(e,t)),vie=p(2,(e,t)=>gS(e,t)),Iie=p((e)=>Xy(e[0]),(e,t)=>gu(e,t)),Aie=p(2,(e,t)=>pu(e,t)),Tie=p(2,(e,t)=>hu(e,t)),_ie=p(3,(e,t,n)=>pS(e,t,n)),Oie=p(2,(e,t)=>SS(e,t)),Pie=p(2,(e,t)=>yS(e,t)),Rie=p(3,(e,t,n)=>xS(e,t,n)),Fie=p(2,(e,t)=>wS(e,t)),Die=p(2,(e,t)=>bS(e,t)),Nie=p(3,(e,t,n)=>ES(e,t,n)),$ie=p(3,(e,t,n)=>Tm(e,t,n)),Uie=p(2,(e,t)=>kS(e,t)),Lie=p(2,(e,t)=>CS(e,t))});var Bie,vq=(e)=>le((t)=>e(t.getRef(Bie))),V0=(...e)=>vq((t)=>me(()=>{t.error(...e)})),Fn=(...e)=>vq((t)=>me(()=>{t.log(...e)}));var vS=v(()=>{pt();At();Bie=dw});var Ef,IS=(e)=>e.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,(t)=>`\\x${t.charCodeAt(0).toString(16).padStart(2,"0")}`),Hie=(e)=>{let t=globalThis.process,n=typeof t==="object"&&t!==null,r=e?.colors!==void 0?e.colors:n&&typeof t.stdout==="object"&&t.stdout!==null&&t.stdout.isTTY===!0&&t.env?.NO_COLOR!=="1",o=r?{bold:(c)=>`\x1B[1m${c}\x1B[0m`,dim:(c)=>`\x1B[2m${c}\x1B[0m`,cyan:(c)=>`\x1B[36m${c}\x1B[0m`,green:(c)=>`\x1B[32m${c}\x1B[0m`,blue:(c)=>`\x1B[34m${c}\x1B[0m`,yellow:(c)=>`\x1B[33m${c}\x1B[0m`,magenta:(c)=>`\x1B[35m${c}\x1B[0m`}:{bold:(c)=>c,dim:(c)=>c,cyan:(c)=>c,green:(c)=>c,blue:(c)=>c,yellow:(c)=>c,magenta:(c)=>c},s=r?"\x1B[0m":"",i=r?"\x1B[31m":"",a=r?"\x1B[1m":"";return{formatHelpDoc:(c)=>qie(c,o),formatCliError:(c)=>IS(c.message),formatError:(c)=>`
|
|
76
|
+
`)}`:"";return this.parent?`Unknown subcommand "${this.subcommand}" for "${this.parent.join(" ")}"${e}`:`Unknown subcommand "${this.subcommand}"${e}`}};d_=class d_ extends Nn(`${Qe}/UserError`)("UserError",{cause:wv(),userMessage:xv(V)}){[Qe]=Qe;[Oi]=!0;get message(){if(this.userMessage)return this.userMessage;if(typeof this.cause==="string"&&this.cause)return this.cause;if(this.cause instanceof Error&&this.cause.message)return this.cause.message;return"An error occurred"}};HW=hn([Mi,Ip,Pu,Fp,Up,Sn,Dp,d_]);Ls=class Ls extends Nn(`${Qe}/ShowHelp`)("ShowHelp",{commandPath:Ae(V),errors:Ae(HW)}){[Qe]=Qe;[Kf]=this.errors.length?1:0;[Oi]=!1;get message(){return"Help requested"}}});var JW="~effect/cli/Primitive",KW,p_,h_,Np=(e)=>e._tag==="Boolean",dy=(e,t)=>Object.assign(Object.create(KW),{_tag:e,parse:t}),eL=(e,t)=>{let r=Ug(t),n=ru(r);return dy(e,(o)=>cn(n(o),(s)=>s.message))},m_,O_,g_=(e)=>{let t=new Map(e),r=e.map(([o])=>he(o)).join(" | "),n=dy("Choice",(o)=>{if(t.has(o))return T(t.get(o));return N(r)});return Object.assign(n,{choiceKeys:e.map(([o])=>o)})},Tu=(e)=>{switch(e._tag){case"Boolean":return"boolean";case"String":return"string";case"Integer":return"integer";case"Float":return"number";case"Date":return"date";case"Path":return"path";case"Choice":return"choice";case"Redacted":return"string";case"FileText":return"file";case"FileParse":return"file";case"FileSchema":return"file";case"KeyValuePair":return"key=value";case"None":return"none";default:return"value"}},Xo=(e)=>e._tag==="Choice"?e.choiceKeys:void 0,py=(e)=>e._tag==="Path"?e.pathType:void 0;var dc=E(()=>{f_();ae();on();oe();Ba();KW={[JW]:{_A:B}},p_=Qg(ly),h_=Qg(uy),m_=eL("Boolean",u_),O_=dy("String",(e)=>T(e))});var jo="\x1B[1m",x_="\x1B[3m",Ni="\x1B[4m",y_="\x1B[9m",S_="\x1B[?25h",Cu="\x1B[?25l",Zi="\x1B[G",Zp="\x1B[s",qp="\x1B[u",zs="\x1B[2K",E_="\x07",Wp="\x1B[31m",Lp="\x1B[32m",b_="\x1B[35m",qi="\x1B[37m",Qu="\x1B[90m",pc="\x1B[96m",De=(e,...t)=>`${t.flat().join("")}${e}\x1B[0m`,Gn=(...e)=>e,k_=(e,t)=>{if(t===void 0)return`\x1B[${Math.max(e+1,0)}G`;return`\x1B[${t+1};${Math.max(e+1,0)}H`},P_=(e=1)=>`\x1B[${e}B`,w_=(e,t=0)=>{let r="";if(t<0)r+=`\x1B[${-t}A`;if(t>0)r+=`\x1B[${t}B`;if(e>0)r+=`\x1B[${e}C`;if(e<0)r+=`\x1B[${-e}D`;return r},T_=(e)=>{let t="";for(let r=0;r<e;r++)t+="\x1B[2K"+(r<e-1?"\x1B[1A":"");if(e>0)t+="\x1B[G";return t};class Yn{token;date;parts;locales;constructor(e){this.token=e.token,this.locales=e.locales,this.date=e.date||new Date,this.parts=e.parts||[this]}isToken(){return!1}nextPart(){let e=bt(Bh(this.parts,(t)=>t===this),()=>0);return mE(this.parts.slice(e+1),(t)=>!t.isToken())}previousPart(){let e=Bh(this.parts,(t)=>t===this);if(tt(e))return OE(this.parts.slice(0,e.value),(t)=>!t.isToken());return L()}toString(){return String(this.date)}}var tL="~effect/cli/Prompt",R_,rL,nL=(e)=>({...process.platform==="win32"?rL:R_,...e}),oL,Rt=(e)=>K(oL,(t)=>({...t,...e.theme})),sL=(e)=>De(e,jo),my=(e,t)=>De(e,Gn(x_,t)),xe=(e,...t)=>e.length===0?"":De(e,...t),Xs=(e,t)=>e.length===0?t:e+" "+t,iL=(e,t,r)=>{let n=Math.max(e.arrowUp.length,e.arrowDown.length);if(t)return e.arrowUp.padEnd(n);if(r)return e.arrowDown.padEnd(n);return" ".repeat(n)},Oy=(e)=>{let t={initial:!1,...e,label:{confirm:"yes",deny:"no",...e.label},placeholder:{defaultConfirm:"(Y/n)",defaultDeny:"(y/N)",...e.placeholder}},r={value:t.initial};return Wi(r,{render:OL(t),process:(n)=>yL(n,t.initial),clear:pL(t)})},Wi=(e,...t)=>{let[r,n]=t.length===1?[void 0,t[0]]:[t[0],t[1]],o=Object.create(yy);return o._tag="Loop",o.initialState=e,o.render=n.render,o.process=n.process,o.clear=n.clear,o.events=r,o},I_=(e)=>{let t={initial:new Date,dateMask:"YYYY-MM-DD HH:mm:ss",validate:T,...e,locales:{..._L,...e.locales}},r=IL(t.dateMask,t.initial,t.locales),n=r.findIndex((s)=>!s.isToken()),o={dateParts:r,typed:"",cursor:n,value:t.initial,error:L()};return Wi(o,{render:$L(t),process:AL(t),clear:SL(t)})},aL,F_=(e)=>{let t={default:0,min:Number.NEGATIVE_INFINITY,max:Number.POSITIVE_INFINITY,incrementBy:1,decrementBy:1,precision:2,validate:(o)=>{if(o<t.min)return N(`${o} must be greater than or equal to ${t.min}`);if(o>t.max)return N(`${o} must be less than or equal to ${t.max}`);return T(o)},...e},r=e.default===void 0?"":`${t.default}`,n={cursor:r.length,value:r,error:L()};return Wi(n,{render:qL(t),process:WL(t),clear:B_(t)})},gy=(e)=>{let t={default:0,min:Number.NEGATIVE_INFINITY,max:Number.POSITIVE_INFINITY,incrementBy:1,decrementBy:1,validate:(o)=>{if(o<t.min)return N(`${o} must be greater than or equal to ${t.min}`);if(o>t.max)return N(`${o} must be less than or equal to ${t.max}`);return T(o)},...e},r=e.default===void 0?"":`${t.default}`,n={cursor:r.length,value:r,error:L()};return Wi(n,{render:NL(t),process:ZL(t),clear:B_(t)})},cL,U_=(e)=>r$(e,"password").pipe(cL(fv)),Or,lL=(e)=>{let t=0,r=-1;for(let n=0;n<e.length;n++)if(e[n].selected===!0){if(r!==-1)throw Error("InvalidArgumentException: only a single choice can be selected by default for Prompt.select");r=n}if(r!==-1)t=r;return t},xy=(e)=>{let t={maxPerPage:10,...e},r=lL(t.choices);return Wi(r,{render:YL(t),process:JL(t),clear:HL(t)})},uL=(e)=>{let t=Object.create(yy);return t._tag="Succeed",t.value=e,t},D_=(e)=>r$(e,"text"),M_=(e)=>{let t={initial:!1,active:"on",inactive:"off",...e};return Wi(t.initial,{render:mz(t),process:Oz,clear:()=>dz(t)})},yy,hy=(e,t,r)=>Ee(()=>{let n=e;switch(n._tag){case"Loop":return fL(n,t,r);case"OnSuccess":return H(hy(n.prompt,t,r),(o)=>hy(n.onSuccess(o),t,r));case"Succeed":return T(n.value)}}),fL,Z,hc=(e,t)=>{if(t===0)return zs+k_(0);let r=0,n=e.split(zi);for(let o of n)r+=1+Math.floor(Math.max(o.length-1,0)/t);return T_(r)},dL=(e,t)=>{let r=e.split(zi);return t===0?r.length:Ho(Sr(r,(n)=>Math.ceil(n.length/t)),sf(0,(n,o)=>n+o))},Sy=(e,t,r)=>{if(r!==void 0&&r.length>0)return P_(dL(r,t))+hc(`
|
|
77
|
+
${r}`,t)+hc(e,t);return hc(e,t)},Li,zi,pL=(e)=>z(function*(t,r){let o=yield*(yield*mn).columns,s=yield*Rt(e),i=t.value?e.placeholder.defaultConfirm:e.placeholder.defaultDeny,a=Ey(i,s.prefix,s.pointerSmall,e,{plain:!0}),c=hc(a,o),l=zs+Zi;return c+l}),Ey=(e,t,r,n,o)=>Xi(e,n.message,t,r,o),hL,mL,OL=(e)=>(t,r)=>Z.$match(r,{Beep:()=>T(Li),NextFrame:({state:n})=>hL(n,e),Submit:({value:n})=>mL(n,e)}),gL,xL,yL=(e,t)=>{let r=bt(e.input,()=>"");if(e.key.name==="enter"||e.key.name==="return")return T(Z.Submit({value:t}));if(gL.test(r.toLowerCase()))return T(Z.Submit({value:!0}));if(xL.test(r.toLowerCase()))return T(Z.Submit({value:!1}));return T(Z.Beep())},SL=(e)=>z(function*(t,r){let o=yield*(yield*mn).columns,s=yield*Rt(e),i=zs+Zi,a=sf(t.dateParts,"",(f,d)=>f+d.toString()),c=by(s.prefix,s.pointerSmall,a,e,{plain:!0}),l=tt(t.error)?Xc(t.error.value.split(zi),{onEmpty:()=>"",onNonEmpty:(f)=>Xs(s.pointerSmall,f.join(`
|
|
78
|
+
`))}):"";return Sy(c,o,l)+i}),EL=(e,t,r)=>{if(tt(e.error)){let n=e.error.value.split(zi);if(Qn(n)){let o=xe(t,r.errorColor),s=Sr(n,(i)=>my(i,r.errorColor));return Zp+`
|
|
79
|
+
`+Xs(o,s.join(`
|
|
80
|
+
`))+qp}}return""},N_=(e,t,r=!1)=>sf(e.dateParts,"",(n,o,s)=>{let i=o.toString();if(s===e.cursor&&!r){let a=Gn(Ni,t.primaryColor);return n+De(i,a)}return n+i}),by=(e,t,r,n,o)=>Xi(r,n.message,e,t,o),bL,kL,PL=(e)=>(e.dateParts[e.cursor].increment(),Z.NextFrame({state:{...e,typed:""}})),wL=(e)=>(e.dateParts[e.cursor].decrement(),Z.NextFrame({state:{...e,typed:""}})),TL=(e)=>{let t=e.dateParts[e.cursor].previousPart();if(tt(t))return Z.NextFrame({state:{...e,typed:"",cursor:e.dateParts.indexOf(t.value)}});return Z.Beep()},vL=(e)=>{let t=e.dateParts[e.cursor].nextPart();if(tt(t))return Z.NextFrame({state:{...e,typed:"",cursor:e.dateParts.indexOf(t.value)}});return Z.Beep()},CL=(e)=>{let t=e.dateParts[e.cursor].nextPart(),r=er(t,{onNone:()=>e.dateParts.findIndex((n)=>!n.isToken()),onSome:(n)=>e.dateParts.indexOf(n)});return Z.NextFrame({state:{...e,cursor:r}})},QL=(e,t)=>{if(/\d/.test(e)){let r=t.typed+e;return t.dateParts[t.cursor].setValue(r),Z.NextFrame({state:{...t,typed:r}})}return Z.Beep()},_L,$L=(e)=>(t,r)=>Z.$match(r,{Beep:()=>T(Li),NextFrame:({state:n})=>bL(n,e),Submit:()=>kL(t,e)}),AL=(e)=>(t,r)=>{switch(t.key.name){case"left":return T(TL(r));case"right":return T(vL(r));case"k":case"up":return T(PL(r));case"j":case"down":return T(wL(r));case"tab":return T(CL(r));case"enter":case"return":return va(e.validate(r.value),{onFailure:(n)=>Z.NextFrame({state:{...r,error:ee(n)}}),onSuccess:(n)=>Z.Submit({value:n})});default:return T(QL(bt(t.input,()=>""),r))}},RL,C_,IL=(e,t,r)=>{let n=[],o=null;while(o=RL.exec(e)){let i=o.shift(),a=o.findIndex((c)=>c!==void 0);if(a in C_){let c=o[a]||i;n.push(C_[a]({token:c,date:t,parts:n,locales:r}))}else n.push(new ky({token:o[a]||i,date:t,parts:n,locales:r}))}let s=n.reduce((i,a)=>{let c=i[i.length-1];if(a.isToken()&&c!==void 0&&c.isToken())c.setValue(a.token);else i.push(a);return i},ti());return n.splice(0,n.length,...s),n},ky,Z_,q_,W_,L_,z_,X_,j_,V_,Xi=(e,t,r,n,o)=>{let s=r.length===0?"":r+" ",i=(c)=>{let l=s+c;if(n.length>0)l+=" "+n;if(e.length>0)l+=" "+e;else if(n.length>0)l+=" ";return l},a=o?.plain===!0?(c)=>c:sL;return Xc(t.split(zi),{onEmpty:()=>i(""),onNonEmpty:(c)=>{let l=Sr(c,(u)=>a(u));return i(l.join(`
|
|
81
|
+
`))}})},FL=(e,t,r,n)=>{if(!e.disabled&&e.description&&t){let o=r.descriptionSeparator+e.description;return n?.plain===!0?o:De(o,r.mutedColor)}return""},B_=(e)=>z(function*(t,r){let o=yield*(yield*mn).columns,s=yield*Rt(e),i=zs+Zi,a=G_(t,s.pointerSmall,s,{plain:!0}),c=Py(t,s.prefix,s.pointerSmall,e,s,{plain:!0});return Sy(c,o,a)+i}),UL=(e,t,r,n)=>{let o=e.value===""?"":`${e.value}`;if(t||n?.plain===!0)return o;let s=tt(e.error)?r.errorColor:Gn(Ni,r.primaryColor);return De(o,s)},G_=(e,t,r,n)=>{if(tt(e.error))return Xc(e.error.value.split(zi),{onEmpty:()=>"",onNonEmpty:(o)=>{if(n?.plain===!0)return Xs(t,o.join(`
|
|
82
|
+
`));let s=xe(t,r.errorColor),i=Sr(o,(a)=>my(a,r.errorColor));return Zp+`
|
|
83
|
+
`+Xs(s,i.join(`
|
|
84
|
+
`))+qp}});return""},Py=(e,t,r,n,o,s,i=!1)=>{let a=UL(e,i,o,s);return Xi(a,n.message,t,r,s)},Y_,H_,J_=(e)=>{if(e.value.length<=0)return T(Z.Beep());let t=e.value.slice(0,e.value.length-1);return T(Z.NextFrame({state:{...e,value:t,error:L()}}))},K_=(e)=>T(Z.NextFrame({state:{...e,cursor:0,value:"",error:L()}})),DL=(e,t)=>{if(t.value.length===0&&e==="-")return T(Z.NextFrame({state:{...t,value:"-",error:L()}}));let r=Number.parseInt(t.value+e);if(Number.isNaN(r))return T(Z.Beep());else return T(Z.NextFrame({state:{...t,value:`${r}`,error:L()}}))},ML=(e,t)=>{if(e==="."&&t.value.includes("."))return T(Z.Beep());if(t.value.length===0&&e==="-")return T(Z.NextFrame({state:{...t,value:"-",error:L()}}));let r=Number.parseFloat(t.value+e);if(Number.isNaN(r))return T(Z.Beep());else return T(Z.NextFrame({state:{...t,value:e==="."?`${r}.`:t.value.includes(".")&&/^\d$/.test(e)?t.value+e:`${r}`,error:L()}}))},NL=(e)=>(t,r)=>Z.$match(r,{Beep:()=>T(Li),NextFrame:({state:n})=>Y_(n,e),Submit:()=>H_(t,e)}),ZL=(e)=>(t,r)=>{if(t.key.ctrl&&t.key.name==="u")return K_(r);switch(t.key.name){case"backspace":return J_(r);case"k":case"up":return T(Z.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`${e.incrementBy}`:`${Number.parseInt(r.value)+e.incrementBy}`,error:L()}}));case"j":case"down":return T(Z.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`-${e.decrementBy}`:`${Number.parseInt(r.value)-e.decrementBy}`,error:L()}}));case"enter":case"return":{let n=Number.parseInt(r.value);if(Number.isNaN(n))return T(Z.NextFrame({state:{...r,error:ee("Must provide an integer value")}}));else return va(e.validate(n),{onFailure:(o)=>Z.NextFrame({state:{...r,error:ee(o)}}),onSuccess:(o)=>Z.Submit({value:o})})}default:return DL(bt(t.input,()=>""),r)}},qL=(e)=>(t,r)=>Z.$match(r,{Beep:()=>T(Li),NextFrame:({state:n})=>Y_(n,e),Submit:()=>H_(t,e)}),WL=(e)=>(t,r)=>{if(t.key.ctrl&&t.key.name==="u")return K_(r);switch(t.key.name){case"backspace":return J_(r);case"k":case"up":return T(Z.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`${e.incrementBy}`:`${Number.parseFloat(r.value)+e.incrementBy}`,error:L()}}));case"j":case"down":return T(Z.NextFrame({state:{...r,value:r.value===""||r.value==="-"?`-${e.decrementBy}`:`${Number.parseFloat(r.value)-e.decrementBy}`,error:L()}}));case"enter":case"return":{let n=Number.parseFloat(r.value);if(Number.isNaN(n))return T(Z.NextFrame({state:{...r,error:ee("Must provide a floating point value")}}));else return H(ne(()=>kk(n,e.precision)),(o)=>va(e.validate(o),{onFailure:(s)=>Z.NextFrame({state:{...r,error:ee(s)}}),onSuccess:(s)=>Z.Submit({value:s})}))}default:return ML(bt(t.input,()=>""),r)}},wy=(e,t,r,n)=>Xi("",r.message,e,t,n),LL=(e,t,r,n,o,s)=>{let i=iL(o,n===r.startIndex&&r.startIndex>0,n===r.endIndex-1&&r.endIndex<t.length);if(s?.plain===!0)return e===n?o.pointer+i:i+" ".repeat(o.pointer.length);if(t[n].disabled){let a=Gn(jo,o.mutedColor);return e===n?xe(o.pointer,a)+i:i+" ".repeat(o.pointer.length)}return e===n?xe(o.pointer,o.primaryColor)+i:i+" ".repeat(o.pointer.length)},zL=(e,t,r,n)=>{if(n?.plain===!0)return e.title;let o=e.title;if(t)return e.disabled?De(o,Gn(Ni,r.mutedColor)):De(o,Gn(Ni,r.primaryColor));return e.disabled?De(o,Gn(y_,r.mutedColor)):o},e$=(e,t,r,n)=>{let o=t.choices,s=gz(e,o.length,t.maxPerPage),i=[];for(let a=s.startIndex;a<s.endIndex;a++){let c=o[a],l=e===a,u=LL(e,o,s,a,r,n),f=zL(c,l,r,n),d=FL(c,l,r,n);i.push(u+f+" "+d)}return i.join(`
|
|
85
|
+
`)},XL,jL,VL=(e,t)=>{if(e===0)return T(Z.NextFrame({state:t.length-1}));return T(Z.NextFrame({state:e-1}))},BL=(e,t)=>{if(e===t.length-1)return T(Z.NextFrame({state:0}));return T(Z.NextFrame({state:e+1}))},GL=(e,t)=>T(Z.NextFrame({state:(e+1)%t.length})),YL=(e)=>(t,r)=>Z.$match(r,{Beep:()=>T(Li),NextFrame:({state:n})=>XL(n,e),Submit:()=>jL(t,e)}),HL=(e)=>z(function*(t,r){let o=yield*(yield*mn).columns,s=yield*Rt(e),i=zs+Zi,a=wy(s.prefix,s.pointerSmall,e,{plain:!0}),c=e$(t,e,s,{plain:!0});return hc(`${a}
|
|
86
|
+
${c}`,o)+i}),JL=(e)=>(t,r)=>{switch(t.key.name){case"k":case"up":return VL(r,e.choices);case"j":case"down":return BL(r,e.choices);case"tab":return GL(r,e.choices);case"enter":case"return":{let n=e.choices[r];if(n.disabled)return T(Z.Beep());return T(Z.Submit({value:n.value}))}default:return T(Z.Beep())}},KL,ez=(e,t,r,n,o)=>{let s=e.value;if(o?.plain===!0)switch(t.type){case"hidden":return"";case"password":return r.passwordMask.repeat(s.length);case"text":return s}if(s.length===0)return"";let i=tt(e.error)?r.errorColor:n?r.submittedColor:Gn(Ni,r.primaryColor);switch(t.type){case"hidden":return"";case"password":return xe(r.passwordMask.repeat(s.length),i);case"text":return De(s,i)}},t$=(e,t,r,n)=>{if(tt(e.error))return Xc(e.error.value.split(zi),{onEmpty:()=>"",onNonEmpty:(o)=>{if(n?.plain===!0)return Xs(t,o.join(`
|
|
87
|
+
`));let s=xe(t,r.errorColor),i=Sr(o,(a)=>my(a,r.errorColor));return Zp+`
|
|
88
|
+
`+Xs(s,i.join(`
|
|
89
|
+
`))+qp}});return""},Ty=(e,t,r,n,o,s,i=!1)=>{let a=ez(e,n,o,i,s);return Xi(a,n.message,t,r,s)},tz,rz,nz=(e)=>{if(e.cursor<=0)return T(Z.Beep());let t=e.value.slice(0,e.cursor-1),r=e.value.slice(e.cursor),n=e.cursor-1,o=`${t}${r}`;return T(Z.NextFrame({state:{...e,cursor:n,value:o,error:L()}}))},oz=(e)=>T(Z.NextFrame({state:{...e,cursor:0,value:"",error:L()}})),sz=(e)=>{if(e.cursor<=0)return T(Z.Beep());let t=e.cursor-1;return T(Z.NextFrame({state:{...e,cursor:t,error:L()}}))},iz=(e)=>{if(e.cursor>=e.value.length)return T(Z.Beep());let t=Math.min(e.cursor+1,e.value.length);return T(Z.NextFrame({state:{...e,cursor:t,error:L()}}))},Q_=(e)=>T(Z.NextFrame({state:{...e,cursor:0,error:L()}})),__=(e)=>T(Z.NextFrame({state:{...e,cursor:e.value.length,error:L()}})),az=(e,t)=>{if(e.value===t.default)return T(Z.Beep());let r=e.value.length===0?t.default:e.value;return T(Z.NextFrame({state:{...e,value:r,cursor:r.length,error:L()}}))},cz=(e,t)=>{let r=t.value.slice(0,t.cursor),n=t.value.slice(t.cursor),o=`${r}${e}${n}`,s=t.cursor+e.length;return T(Z.NextFrame({state:{...t,cursor:s,value:o,error:L()}}))},lz=(e)=>(t,r)=>Z.$match(r,{Beep:()=>T(Li),NextFrame:({state:n})=>tz(n,e),Submit:()=>rz(t,e)}),uz=(e)=>(t,r)=>{if(t.key.ctrl)switch(t.key.name){case"u":return oz(r);case"a":return Q_(r);case"e":return __(r);default:return T(Z.Beep())}switch(t.key.name){case"backspace":return nz(r);case"left":return sz(r);case"right":return iz(r);case"home":return Q_(r);case"end":return __(r);case"enter":case"return":{let n=r.value;return va(e.validate(n),{onFailure:(o)=>Z.NextFrame({state:{...r,value:n,error:ee(o)}}),onSuccess:(o)=>Z.Submit({value:o})})}case"tab":return az(r,e);default:return cz(bt(t.input,()=>""),r)}},fz=(e)=>(t,r)=>KL(t,e),r$=(e,t)=>{let r={default:"",type:t,validate:T,...e},n={cursor:r.default.length,value:r.default,error:L()};return Wi(n,{render:lz(r),process:uz(r),clear:fz(r)})},dz,n$=(e,t,r,n=!1)=>{let o=xe(r.toggleSeparator,r.mutedColor),s=Gn(Ni,n?r.submittedColor:r.primaryColor),i=e?t.inactive:De(t.inactive,s);return(e?De(t.active,s):t.active)+" "+Xs(o,i)},o$=(e,t,r,n)=>Xi(e,n.message,t,r),pz,hz,$_,A_,mz=(e)=>(t,r)=>{switch(r._tag){case"Beep":return T(Li);case"NextFrame":return pz(t,e);case"Submit":return hz(t,e)}},Oz=(e,t)=>{switch(e.key.name){case"0":case"j":case"delete":case"right":case"down":return A_;case"1":case"k":case"left":case"up":return $_;case" ":case"tab":return t?A_:$_;case"enter":case"return":return T(Z.Submit({value:t}));default:return T(Z.Beep())}},gz=(e,t,r)=>{let n=r===void 0?t:r,o=Math.min(t-n,e-Math.floor(n/2));if(o<0)o=0;let s=Math.min(o+n,t);return{startIndex:o,endIndex:s}};var vy=E(()=>{_n();lt();ma();ae();la();oe();Pk();ze();kl();vg();ep();R_={prefix:"?",arrowUp:"\u2191",arrowDown:"\u2193",checkboxOn:"\u2612",checkboxOff:"\u2610",tick:"\u2714",ellipsis:"\u2026",pointerSmall:"\u203A",pointer:"\u276F",descriptionSeparator:"- ",passwordMask:"*",toggleSeparator:"/",primaryColor:pc,mutedColor:Qu,successColor:Lp,errorColor:Wp,submittedColor:qi},rL={...R_,checkboxOn:"[*]",checkboxOff:"[ ]",tick:"\u221A",ellipsis:"...",pointerSmall:"\xBB",pointer:">"},oL=Be("effect/unstable/cli/Prompt/Theme",{defaultValue:nL}),aL=v(2,(e,t)=>{let r=Object.create(yy);return r._tag="OnSuccess",r.prompt=e,r.onSuccess=t,r}),cL=v(2,(e,t)=>aL(e,(r)=>uL(t(r)))),Or=z(function*(e){let t=yield*mn,r=yield*t.readInput;return yield*hy(e,t,r)},cn(()=>new su({})),mi),yy={...Pn({label:"Prompt",evaluate(){return Or(this)}}),[tL]:{_Output:(e)=>e}},fL=z(function*(e,t,r){let n=di(e.initialState)?yield*e.initialState:e.initialState,o=Z.NextFrame({state:n});while(!0){let s=yield*e.render(n,o);if(yield*Rn(t.display(s)),e.events){let i=Co(r).pipe(K((c)=>({_tag:"Input",input:c}))),a=yield*Ta(i,Co(e.events).pipe(K((c)=>({_tag:"Event",value:c}))));o=yield*e.process(a,n)}else{let i=yield*Co(r);o=yield*e.process(i,n)}switch(o._tag){case"Beep":continue;case"NextFrame":{yield*Rn(t.display(yield*e.clear(n,o))),n=o.state;continue}case"Submit":{yield*Rn(t.display(yield*e.clear(n,o)));let i=yield*e.render(n,o);return yield*Rn(t.display(i)),o.value}}}},(e,t,r)=>hl(e,Rn(r.display(S_)))),Z=UE(),Li=E_,zi=/\r?\n/,hL=z(function*(e,t){let r=yield*Rt(t),n=xe(r.prefix,r.primaryColor),o=xe(r.pointerSmall,r.mutedColor),s=e.value?t.placeholder.defaultConfirm:t.placeholder.defaultDeny,i=De(s,r.mutedColor),a=Ey(i,n,o,t);return Cu+a}),mL=z(function*(e,t){let r=yield*Rt(t),n=xe(r.tick,r.successColor),o=xe(r.ellipsis,r.mutedColor),s=e?t.label.confirm:t.label.deny;return Ey(s,n,o,t)+`
|
|
90
|
+
`}),gL=/^y|t$/,xL=/^n|f$/,bL=z(function*(e,t){let r=yield*Rt(t),n=xe(r.prefix,r.primaryColor),o=xe(r.pointerSmall,r.mutedColor),s=N_(e,r),i=by(n,o,s,t),a=EL(e,r.pointerSmall,r);return Cu+i+a}),kL=z(function*(e,t){let r=yield*Rt(t),n=xe(r.tick,r.successColor),o=xe(r.ellipsis,r.mutedColor),s=N_(e,r,!0);return by(n,o,s,t)+`
|
|
91
|
+
`}),_L={months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},RL=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,C_={1:({token:e,...t})=>new ky({token:e.replace(/\\(.)/g,"$1"),...t}),2:(e)=>new z_(e),3:(e)=>new X_(e),4:(e)=>new j_(e),5:(e)=>new V_(e),6:(e)=>new L_(e),7:(e)=>new W_(e),8:(e)=>new q_(e),9:(e)=>new Z_(e)};ky=class ky extends Yn{increment(){}decrement(){}setValue(e){this.token=this.token+e}isToken(){return!0}toString(){return this.token}};Z_=class Z_ extends Yn{increment(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}decrement(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setValue(e){this.date.setMilliseconds(Number.parseInt(e.slice(-this.token.length)))}toString(){return`${this.date.getMilliseconds()}`.padStart(4,"0").substring(0,this.token.length)}};q_=class q_ extends Yn{increment(){this.date.setSeconds(this.date.getSeconds()+1)}decrement(){this.date.setSeconds(this.date.getSeconds()-1)}setValue(e){this.date.setSeconds(Number.parseInt(e.slice(-2)))}toString(){let e=`${this.date.getSeconds()}`;return this.token.length>1?e.padStart(2,"0"):e}};W_=class W_ extends Yn{increment(){this.date.setMinutes(this.date.getMinutes()+1)}decrement(){this.date.setMinutes(this.date.getMinutes()-1)}setValue(e){this.date.setMinutes(Number.parseInt(e.slice(-2)))}toString(){let e=`${this.date.getMinutes()}`;return this.token.length>1?e.padStart(2,"0"):e}};L_=class L_ extends Yn{increment(){this.date.setHours(this.date.getHours()+1)}decrement(){this.date.setHours(this.date.getHours()-1)}setValue(e){this.date.setHours(Number.parseInt(e.slice(-2)))}toString(){let e=/h/.test(this.token)?this.date.getHours()%12||12:this.date.getHours();return this.token.length>1?`${e}`.padStart(2,"0"):`${e}`}};z_=class z_ extends Yn{increment(){this.date.setDate(this.date.getDate()+1)}decrement(){this.date.setDate(this.date.getDate()-1)}setValue(e){this.date.setDate(Number.parseInt(e.slice(-2)))}toString(){let e=this.date.getDate(),t=this.date.getDay();switch(this.token){case"DD":return`${e}`.padStart(2,"0");case"Do":return`${e}${this.ordinalIndicator(e)}`;case"d":return`${t+1}`;case"ddd":return this.locales.weekdaysShort[t];case"dddd":return this.locales.weekdays[t];default:return`${e}`}}ordinalIndicator(e){if(e>=11&&e<=13)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}};X_=class X_ extends Yn{increment(){this.date.setMonth(this.date.getMonth()+1)}decrement(){this.date.setMonth(this.date.getMonth()-1)}setValue(e){let t=Number.parseInt(e.slice(-2))-1;this.date.setMonth(t<0?0:t)}toString(){let e=this.date.getMonth();switch(this.token.length){case 2:return`${e+1}`.padStart(2,"0");case 3:return this.locales.monthsShort[e];case 4:return this.locales.months[e];default:return`${e+1}`}}};j_=class j_ extends Yn{increment(){this.date.setFullYear(this.date.getFullYear()+1)}decrement(){this.date.setFullYear(this.date.getFullYear()-1)}setValue(e){this.date.setFullYear(Number.parseInt(e.slice(-4)))}toString(){let e=`${this.date.getFullYear()}`.padStart(4,"0");return this.token.length===2?e.slice(-2):e}};V_=class V_ extends Yn{increment(){this.date.setHours((this.date.getHours()+12)%24)}decrement(){this.increment()}setValue(e){}toString(){let e=this.date.getHours()>=12?"pm":"am";return/A/.test(this.token)?e.toUpperCase():e}};Y_=z(function*(e,t){let r=yield*Rt(t),n=xe(r.prefix,r.primaryColor),o=xe(r.pointerSmall,r.mutedColor),s=G_(e,r.pointerSmall,r);return Py(e,n,o,t,r)+s}),H_=z(function*(e,t){let r=yield*Rt(t),n=xe(r.tick,r.successColor),o=xe(r.ellipsis,r.mutedColor);return Py(e,n,o,t,r,void 0,!0)+`
|
|
92
|
+
`}),XL=z(function*(e,t){let r=yield*Rt(t),n=e$(e,t,r),o=xe(r.prefix,r.primaryColor),s=xe(r.pointerSmall,r.mutedColor),i=wy(o,s,t);return Cu+i+`
|
|
93
|
+
`+n}),jL=z(function*(e,t){let r=yield*Rt(t),n=t.choices[e].title,o=xe(r.tick,r.successColor),s=xe(r.ellipsis,r.mutedColor);return wy(o,s,t)+" "+De(n,r.submittedColor)+`
|
|
94
|
+
`}),KL=z(function*(e,t){let n=yield*(yield*mn).columns,o=yield*Rt(t),s=zs+Zi,i=t$(e,o.pointerSmall,o,{plain:!0});return Sy(Ty(e,o.prefix,o.pointerSmall,t,o,{plain:!0}),n,i)+s}),tz=z(function*(e,t){let r=yield*Rt(t),n=xe(r.prefix,r.primaryColor),o=xe(r.pointerSmall,r.mutedColor),s=Ty(e,n,o,t,r),i=t$(e,r.pointerSmall,r),a=t.type==="password"?r.passwordMask.length:1,c=(e.cursor-e.value.length)*a;return s+i+w_(c)}),rz=z(function*(e,t){let r=yield*Rt(t),n=xe(r.tick,r.successColor),o=xe(r.ellipsis,r.mutedColor);return Ty(e,n,o,t,r,void 0,!0)+`
|
|
95
|
+
`}),dz=z(function*(e){let r=yield*(yield*mn).columns,n=yield*Rt(e),o=zs+Zi,s=e.active+" "+Xs(n.toggleSeparator,e.inactive),i=Xi(s,e.message,n.prefix,n.pointerSmall,{plain:!0});return hc(i,r)+o}),pz=z(function*(e,t){let r=yield*Rt(t),n=xe(r.prefix,r.primaryColor),o=xe(r.pointerSmall,r.mutedColor),s=n$(e,t,r),i=o$(s,n,o,t);return Cu+i}),hz=z(function*(e,t){let r=yield*Rt(t),n=xe(r.tick,r.successColor),o=xe(r.ellipsis,r.mutedColor),s=n$(e,t,r,!0);return o$(s,n,o,t)+`
|
|
96
|
+
`}),$_=T(Z.NextFrame({state:!0})),A_=T(Z.NextFrame({state:!1}))});var i$="~effect/cli/Param",_u="argument",Hn="flag",$u,zp=(e)=>G(e,i$),Vi=(e)=>e.kind==="flag",mc=(e)=>{let t=(r)=>e.kind===_u?yz(e.name,e.primitiveType,r):Sz(e.name,e.primitiveType,r);return Object.setPrototypeOf({_tag:"Single",...e,description:e.description??L(),aliases:e.aliases??[],hidden:e.hidden??!1,parse:t},$u)},Xp=(e,t)=>mc({name:t,primitiveType:O_,kind:e}),a$=(e,t)=>mc({name:t,primitiveType:m_,kind:e}),jp=(e,t,r)=>mc({name:t,primitiveType:g_(r),kind:e}),Cy=(e,t,r)=>{let n=r.map((o)=>[o,o]);return jp(e,t,n)},xz,c$,Vp,Au,l$=(e,t,r=[])=>{let n=r.map((o)=>()=>o().parse);return Object.assign(Object.create($u),{_tag:"Transform",kind:e.kind,param:e,alternatives:r,f:t,parse:t(e.parse,n)})},Qy,ji=(e)=>{let t=z(function*(r){return Bp(e),yield*e.parse(r).pipe(K(([n,o])=>[n,ee(o)]),_k({MissingOption:()=>T([r.arguments,L()]),MissingArgument:()=>T([r.arguments,L()])}))});return Object.assign(Object.create($u),{_tag:"Optional",kind:e.kind,param:e,parse:t})},_y,$y=(e,t)=>{let r=Bp(e),n=(o)=>{if(r.kind==="argument")return Ez(e,r,o,t);else return bz(e,r,o,t)};return Object.assign(Object.create($u),{_tag:"Variadic",kind:e.kind,param:e,min:ua(t?.min),max:ua(t?.max),parse:n})},Ay,yz,Sz,Ez,bz,Ry=(e,t)=>{let r=e;switch(r._tag){case"Single":return t.Single(r);case"Map":return t.Map(r);case"Transform":return t.Transform(r);case"Optional":return t.Optional(r);case"Variadic":return t.Variadic(r)}},js=(e,t)=>Ry(e,{Single:(r)=>t(r),Map:(r)=>Au(js(r.param,t),r.f),Transform:(r)=>l$(js(r.param,t),r.f,r.alternatives.map((n)=>()=>js(n(),t))),Optional:(r)=>ji(js(r.param,t)),Variadic:(r)=>$y(js(r.param,t),{min:ur(r.min),max:ur(r.max)})}),Me=(e)=>Ry(e,{Single:(t)=>[t],Map:(t)=>Me(t.param),Transform:(t)=>[...Me(t.param),...t.alternatives.flatMap((r)=>Me(r()))],Optional:(t)=>Me(t.param),Variadic:(t)=>Me(t.param)}),Bp=(e)=>{let t=Me(e);if(t.length===0)throw Error("No Single param found in param structure");if(t.length>1)throw Error(`Multiple Single params found: ${t.map((r)=>r.name).join(", ")}`);return t[0]},gr=(e)=>Ry(e,{Single:()=>({isOptional:!1,isVariadic:!1,variadicMin:L(),variadicMax:L()}),Map:(t)=>gr(t.param),Transform:(t)=>gr(t.param),Optional:(t)=>({...gr(t.param),isOptional:!0}),Variadic:(t)=>({...gr(t.param),isVariadic:!0,variadicMin:t.min,variadicMax:t.max})});var Jn=E(()=>{ae();oe();ze();It();ye();wu();dc();$u={[i$]:{_A:B},pipe(){return pe(this,arguments)}},xz=/^-+/,c$=v(2,(e,t)=>js(e,(r)=>mc({...r,aliases:[...r.aliases,t.replace(xz,"")]}))),Vp=v(2,(e,t)=>js(e,(r)=>mc({...r,description:ee(t)}))),Au=v(2,(e,t)=>{let r=(n)=>K(e.parse(n),([o,s])=>[o,t(s)]);return Object.assign(Object.create($u),{_tag:"Map",kind:e.kind,param:e,f:t,parse:r})}),Qy=v(2,(e,t)=>l$(e,(r)=>(n)=>H(r(n),([o,s])=>t(s).pipe(K((i)=>[o,i]))))),_y=v(2,(e,t)=>{if(!di(t))return Au(ji(e),bt(()=>t));return Qy(ji(e),er({onNone:()=>t,onSome:T}))}),Ay=v(2,(e,t)=>js(e,(r)=>mc({...r,typeName:t}))),yz=z(function*(e,t,r){if(r.arguments.length===0)return yield*new Fp({argument:e});let n=r.arguments[0],o=yield*cn(t.parse(n),(s)=>new Sn({option:e,value:n,expected:s,kind:"argument"}));return[r.arguments.slice(1),o]}),Sz=z(function*(e,t,r){let n=r.flags[e];if(n===void 0||n.length===0)return yield*new Pu({option:e});let o=n[0],s=yield*cn(t.parse(o),(i)=>new Sn({option:e,value:o,expected:i,kind:"flag"}));return[r.arguments,s]}),Ez=z(function*(e,t,r,n){let o=[],s=n?.min??0,i=n?.max??Number.POSITIVE_INFINITY,a=0,c=r.arguments;while(c.length>0&&a<i){let[l,u]=yield*e.parse({flags:r.flags,arguments:c});o.push(u),c=l,a++}if(a<s)return yield*new Sn({option:t.name,value:`${a} values`,expected:`at least ${s} value${s===1?"":"s"}`,kind:t.kind});return[c,o]}),bz=z(function*(e,t,r,n){let o=[],i=[t.name,...t.aliases].flatMap((c)=>r.flags[c]??[]),a=i.length;if(wt(n?.min)&&a<n.min)return yield*a===0?new Pu({option:t.name}):new Sn({option:t.name,value:`${a} occurrences`,expected:`at least ${n.min} value${n.min===1?"":"s"}`,kind:t.kind});if(wt(n?.max)&&a>n.max)return yield*new Sn({option:t.name,value:`${a} occurrences`,expected:`at most ${n.max} value${n.max===1?"":"s"}`,kind:t.kind});for(let c of i){let[,l]=yield*e.parse({flags:{[t.name]:[c]},arguments:[]});o.push(l)}return[r.arguments,o]})});var Gp=(e)=>Xp(_u,e),Xz=(e)=>ji(e),Yp,jz;var f$=E(()=>{oe();Jn();Yp=v(2,(e,t)=>Vp(e,t)),jz=v((e)=>zp(e[0]),(e,t)=>$y(e,t))});var Vz,d$=(e)=>le((t)=>e(t.getRef(Vz))),Iy=(...e)=>d$((t)=>ve(()=>{t.error(...e)})),Wt=(...e)=>d$((t)=>ve(()=>{t.log(...e)}));var Hp=E(()=>{ct();Dt();Vz=Zm});var Oc,Jp=(e)=>e.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,(t)=>`\\x${t.charCodeAt(0).toString(16).padStart(2,"0")}`),Bz=(e)=>{let t=globalThis.process,r=typeof t==="object"&&t!==null,n=e?.colors!==void 0?e.colors:r&&typeof t.stdout==="object"&&t.stdout!==null&&t.stdout.isTTY===!0&&t.env?.NO_COLOR!=="1",o=n?{bold:(c)=>`\x1B[1m${c}\x1B[0m`,dim:(c)=>`\x1B[2m${c}\x1B[0m`,cyan:(c)=>`\x1B[36m${c}\x1B[0m`,green:(c)=>`\x1B[32m${c}\x1B[0m`,blue:(c)=>`\x1B[34m${c}\x1B[0m`,yellow:(c)=>`\x1B[33m${c}\x1B[0m`,magenta:(c)=>`\x1B[35m${c}\x1B[0m`}:{bold:(c)=>c,dim:(c)=>c,cyan:(c)=>c,green:(c)=>c,blue:(c)=>c,yellow:(c)=>c,magenta:(c)=>c},s=n?"\x1B[0m":"",i=n?"\x1B[31m":"",a=n?"\x1B[1m":"";return{formatHelpDoc:(c)=>Hz(c,o),formatCliError:(c)=>Jp(c.message),formatError:(c)=>`
|
|
114
97
|
${a}${i}ERROR${s}
|
|
115
|
-
${
|
|
98
|
+
${Jp(c.message)}${s}`,formatErrors:(c)=>{if(c.length===0)return"";if(c.length===1)return`
|
|
116
99
|
${a}${i}ERROR${s}
|
|
117
|
-
${
|
|
118
|
-
${a}${i}ERRORS${s}`);for(let[,f]of
|
|
119
|
-
`)},formatVersion:(c,
|
|
120
|
-
`)},
|
|
121
|
-
`)};var
|
|
122
|
-
`)};var
|
|
123
|
-
`)};var
|
|
124
|
-
`)};var Lq=(e,t,n)=>{switch(t){case"bash":return Oq(e,n);case"zsh":return Uq(e,n);case"fish":return Fq(e,n)}};var Bq=()=>{};var Ht={};Qn(Ht,{atLeast:()=>vae,atMost:()=>Iae,between:()=>Aae,boolean:()=>Pm,choice:()=>tA,choiceWithValue:()=>eA,date:()=>lae,directory:()=>pae,file:()=>dae,fileParse:()=>gae,fileSchema:()=>xae,fileText:()=>hae,filter:()=>_ae,filterMap:()=>Tae,float:()=>uae,integer:()=>cae,keyValuePair:()=>yae,map:()=>nA,mapEffect:()=>kae,mapTryCatch:()=>Cae,none:()=>Sae,optional:()=>OS,orElse:()=>Oae,orElseResult:()=>Pae,path:()=>fae,redacted:()=>mae,string:()=>aae,withAlias:()=>TS,withDefault:()=>Rm,withDescription:()=>yu,withFallbackConfig:()=>bae,withFallbackPrompt:()=>wae,withHidden:()=>Eae,withMetavar:()=>_S,withSchema:()=>Rae});var aae=(e)=>eS(Bt,e),Pm=(e)=>Eq(Bt,e),cae=(e)=>tS(Bt,e),uae=(e)=>nS(Bt,e),lae=(e)=>rS(Bt,e),eA=(e,t)=>Am(Bt,e,t),tA=(e,t)=>oS(Bt,e,t),fae=(e,t)=>Sf(Bt,e,t),dae=(e,t)=>iS(Bt,e,t),pae=(e,t)=>sS(Bt,e,t),mae=(e)=>aS(Bt,e),hae=(e)=>cS(Bt,e),gae=(e,t)=>uS(Bt,e,t),xae=(e,t,n)=>lS(Bt,e,t,n),yae=(e)=>bq(Bt,e),Sae,TS,yu,_S,Eae=(e)=>kq(e),OS=(e)=>fu(e),Rm,bae,wae,nA,kae,Cae,vae,Iae,Aae,Tae,_ae,Oae,Pae,Rae;var rA=v(()=>{ne();Fs();Sae=fS(Bt),TS=p(2,(e,t)=>wq(e,t)),yu=p(2,(e,t)=>dS(e,t)),_S=p(2,(e,t)=>bS(e,t)),Rm=mS,bae=p(2,(e,t)=>hS(e,t)),wae=p(2,(e,t)=>gS(e,t)),nA=p(2,(e,t)=>pu(e,t)),kae=p(2,(e,t)=>hu(e,t)),Cae=p(3,(e,t,n)=>pS(e,t,n)),vae=p(2,(e,t)=>SS(e,t)),Iae=p(2,(e,t)=>yS(e,t)),Aae=p(3,(e,t,n)=>xS(e,t,n)),Tae=p(3,(e,t,n)=>Tm(e,t,n)),_ae=p(3,(e,t,n)=>ES(e,t,n)),Oae=p(2,(e,t)=>kS(e,t)),Pae=p(2,(e,t)=>CS(e,t)),Rae=p(2,(e,t)=>wS(e,t))});var PS="~effect/cli/Command/Config/Internal",RS=(e)=>{let t=[],n=[],r=[];function o(i){let a=Object.create(null);for(let c of Object.keys(i))a[c]=s(i[c]);return a}function s(i){if(Array.isArray(i))return{_tag:"Array",children:i.map((a)=>s(a))};else if(Xy(i)){let a=t.length;if(t.push(i),i.kind==="argument")r.push(i);else n.push(i);return{_tag:"Param",index:a}}else return{_tag:"Nested",tree:o(i)}}return{[PS]:PS,flags:n,arguments:r,orderedParams:t,tree:o(e)}},Hq,Wq=(e,t)=>{switch(e._tag){case"Param":return{_tag:"Param",index:e.index+t};case"Array":return{_tag:"Array",children:e.children.map((n)=>Wq(n,t))};case"Nested":return{_tag:"Nested",tree:jq(e.tree,t)}}},jq=(e,t)=>{let n=Object.create(null);for(let r of Object.keys(e))n[r]=Wq(e[r],t);return n},oA=(e,t)=>{let n=e.orderedParams.length;return{[PS]:PS,flags:[...e.flags,...t.flags],arguments:[...e.arguments,...t.arguments],orderedParams:[...e.orderedParams,...t.orderedParams],tree:Object.assign(Object.create(null),e.tree,jq(t.tree,n))}},sA=(e,t)=>{let n={};for(let o of Object.keys(e))H(n,o,r(e[o]));return n;function r(o){switch(o._tag){case"Param":return t[o.index];case"Array":return o.children.map((s)=>r(s));case"Nested":return sA(o.tree,t)}}};var iA=v(()=>{Fs();Hq=RS({})});var Fm="~effect/cli/Command",Be=(e)=>e,Fae,Rr=(e)=>{let t=e.config,n=e.contextConfig??Hq,r=e.service??Ye(`${Fm}/${e.name}`),o=e.annotations??Ln(),s=e.globalFlags??[],i=e.subcommands??[],a=(f,d)=>Ve(e.handle)?e.handle(f,d):R(new Ha({commandPath:d,errors:[]})),c=e.parse??FS(t),u=e.parseContext??FS(n,{allowLeftovers:!0}),l=(f)=>{let d=[],m=[];for(let w of t.arguments){let k=St(w),g=Pr(w);for(let x of k)d.push({name:x.name,type:x.typeName??wm(x.primitiveType),description:x.description,required:!g.isOptional&&(!g.isVariadic||wE(g.variadicMin,(S)=>S>0)),variadic:g.isVariadic})}let y=f.length>0?f.join(" "):e.name;if(i.some((w)=>w.commands.some((k)=>!k.unlisted)))y+=" <subcommand>";y+=" [flags]";for(let w of d){let k=w.variadic?`<${w.name}...>`:`<${w.name}>`;y+=` ${w.required?k:`[${k}]`}`}for(let w of t.flags){let k=St(w),g=Pr(w);for(let x of k){if(x.hidden)continue;m.push(MS(x,g))}}let b=[];for(let w of i){let k=w.commands.filter((g)=>!g.unlisted);if(k.length===0)continue;b.push({group:w.group,commands:sn(k,(g)=>({name:g.name,alias:g.alias,shortDescription:g.shortDescription,description:g.description??""}))})}let E=e.examples??[];return{description:e.description??"",usage:y,flags:m,annotations:o,...d.length>0&&{args:d},...b.length>0&&{subcommands:b},...E.length>0&&{examples:E}}};return Object.assign(Object.create(Fae),{[Fm]:Fm,name:e.name,examples:e.examples??[],annotations:o,globalFlags:s,subcommands:i,unlisted:e.unlisted??!1,config:t,contextConfig:n,service:r,parse:c,parseContext:u,handle:a,buildHelpDoc:l,...Ve(e.description)?{description:e.description}:{},...Ve(e.shortDescription)?{shortDescription:e.shortDescription}:{},...Ve(e.alias)?{alias:e.alias}:{}})},MS=(e,t)=>{let n=e.aliases.map((r)=>r.length===1?`-${r}`:`--${r}`);return{name:e.name,aliases:n,type:e.typeName??wm(e.primitiveType),description:Mae(e.description,Fi(e.primitiveType)),required:e.primitiveType._tag!=="Boolean"&&!t.isOptional}},Mae=(e,t)=>{if(t===void 0||t.length===0)return e;let n=`(choices: ${t.join(", ")})`;return ut(e,{onNone:()=>F(n),onSome:(r)=>F(`${r} ${n}`)})},FS=(e,t)=>q(function*(n){let r={flags:n.flags,arguments:n.arguments},[o,s]=yield*Dae(r,e.orderedParams);if(t?.allowLeftovers!==!0&&o.length>0)return yield*new Hy({arguments:o});return sA(e.tree,s)}),Dae,aA=(e,t,n)=>{let r=Be(e),o=new Set;((i)=>{for(let a of i){let c=St(a);for(let u of c)o.add(u.name)}})((n?.contextConfig??r.contextConfig).flags);for(let i of t){let a=Be(i);for(let c of a.config.flags){let u=St(c);for(let l of u)if(o.has(l.name))throw new Ly({option:l.name,parentCommand:e.name,childCommand:i.name})}}};var bf=v(()=>{nr();rt();Re();Fu();Me();ge();Em();Fs();gf();iA();Fae={...ss({label:"Command",evaluate(){return Be(this).service}})},Dae=q(function*(e,t){let n=[],r=e.arguments;for(let o of t){let[s,i]=yield*o.parse({flags:e.flags,arguments:r});n.push(i),r=s}return[r,n]})});var Nae=(e)=>{switch(e.primitiveType._tag){case"Boolean":return{_tag:"Boolean"};case"Integer":return{_tag:"Integer"};case"Float":return{_tag:"Float"};case"Date":return{_tag:"Date"};case"Choice":return{_tag:"Choice",values:Fi(e.primitiveType)??[]};case"Path":return{_tag:"Path",pathType:O0(e.primitiveType)??"either"};case"FileText":case"FileParse":case"FileSchema":return{_tag:"Path",pathType:"file"};default:return{_tag:"String"}}},$ae=(e)=>{switch(e.primitiveType._tag){case"Integer":return{_tag:"Integer"};case"Float":return{_tag:"Float"};case"Date":return{_tag:"Date"};case"Choice":return{_tag:"Choice",values:Fi(e.primitiveType)??[]};case"Path":return{_tag:"Path",pathType:O0(e.primitiveType)??"either"};case"FileText":case"FileParse":case"FileSchema":return{_tag:"Path",pathType:"file"};default:return{_tag:"String"}}},cA=(e)=>{let n=Be(e).config,r=[];for(let i of n.flags){let a=St(i);for(let c of a){if(c.kind!=="flag")continue;if(c.hidden)continue;r.push({name:c.name,aliases:c.aliases,description:Un(c.description),type:Nae(c)})}}let o=[];for(let i of n.arguments){let a=St(i),c=Pr(i);for(let u of a){if(u.kind!=="argument")continue;o.push({name:u.name,description:Un(u.description),required:!c.isOptional,variadic:c.isVariadic,type:$ae(u)})}}let s=[];for(let i of e.subcommands)for(let a of i.commands){if(a.unlisted)continue;s.push(cA(a))}return{name:e.name,description:e.shortDescription??e.description,flags:r,arguments:o,subcommands:s}};var qq=v(()=>{Me();Fs();gf();bf()});var uA=(e)=>{let t=new Set,n=[];for(let r of e){if(t.has(r))continue;t.add(r),n.push(r)}return n},zq=(e,t)=>{let n=[e],r=e;for(let o=1;o<t.length;o++){let s=t[o],i=void 0;for(let a of r.subcommands)if(i=a.commands.find((c)=>c.name===s),i)break;if(!i)break;n.push(i),r=i}return n},lA=(e,t,n)=>{let o=zq(e,t).flatMap((s)=>Be(s).globalFlags);return uA([...n,...o])},Lae=(e)=>{let t=[],n=(r)=>{let o=Be(r);for(let s of o.globalFlags)t.push(s);for(let s of r.subcommands)for(let i of s.commands)n(i)};return n(e),uA(t)},Bae=(e,t)=>{if(e.length<=1)return[];let n=new Set(t.map((o)=>o.name)),r=[];for(let o of e.slice(0,-1)){let s=Be(o);for(let i of s.contextConfig.flags){let a=St(i),c=Pr(i);for(let u of a){if(n.has(u.name))continue;if(u.hidden)continue;n.add(u.name),r.push(MS(u,c))}}}return r},Vq=(e,t)=>uA([...t,...Lae(e)]),DS=(e,t,n)=>un(function*(){let r=zq(e,t),o=r.length>0?r[r.length-1]:e,s=Be(o).buildHelpDoc(t),i=Bae(r,s.flags),a=lA(e,t,n),c=[];for(let u of a){let l=St(u.flag),f=Pr(u.flag);for(let d of l){if(d.hidden)continue;c.push({...MS(d,f),required:!1})}}return{...s,flags:[...i,...s.flags],globalFlags:c}});var fA=v(()=>{Re();Fs();bf()});var NS=(e)=>({_tag:"Action",flag:e.flag,run:e.run}),Wae=(e)=>(t)=>{Kq+=1;let n=Ye(`effect/unstable/cli/GlobalFlag/${e}/${Kq}`);return Object.assign(n,{_tag:"Setting",id:e,flag:t.flag})},Kq=0,jae,qae,dA,zae,wf,Gq;var pA=v(()=>{vS();rt();Re();Me();J0();Bq();rA();qq();fA();jae=NS({flag:Pm("help").pipe(TS("h"),yu("Show help information"),Rm(!1)),run:q(function*(e,{builtIns:t,command:n,commandPath:r}){let o=yield*Ef,s=yield*DS(n,r,t);yield*Fn(o.formatHelpDoc(s))})}),qae=NS({flag:Pm("version").pipe(TS("v"),yu("Show version information"),Rm(!1)),run:q(function*(e,{command:t,version:n}){let r=yield*Ef;yield*Fn(r.formatVersion(t.name,n))})}),dA=NS({flag:Pm("wizard").pipe(yu("Start wizard mode for a command"),Rm(!1)),run:()=>Pe}),zae=NS({flag:tA("completions",["bash","zsh","fish","sh"]).pipe(OS,nA((e)=>kn(e,(t)=>t==="sh"?"bash":t)),_S("<bash|zsh|fish|sh>"),yu("Print shell completion script")),run:q(function*(e,{command:t}){if(he(e))return;let n=cA(t);yield*Fn(Lq(t.name,e.value,n))})}),wf=Wae("log-level")({flag:eA("log-level",[["all","All"],["trace","Trace"],["debug","Debug"],["info","Info"],["warn","Warn"],["warning","Warn"],["error","Error"],["fatal","Fatal"],["none","None"]]).pipe(OS,yu("Sets the minimum log level"),_S("<all|trace|debug|info|warn|warning|error|fatal|none>"))}),Gq=[jae,qae,dA,zae,wf]});var $S,Vae;var Qq=v(()=>{rt();pA();$S=class $S extends Te("effect/unstable/cli/CliConfig",{defaultValue:()=>Vae}){};Vae={builtIns:Gq}});function Yq(e){let t=e.indexOf("--");if(t===-1)return{tokens:Zq(e),trailingOperands:[]};return{tokens:Zq(e.slice(0,t)),trailingOperands:e.slice(t+1)}}var Zq=(e)=>{let t=[];for(let n of e)if(!n.startsWith("-"))t.push({_tag:"Value",value:n});else if(n.startsWith("--")){let r=n.indexOf("=");if(r!==-1){let o=n.slice(2,r),s=n.slice(r+1);t.push({_tag:"LongOption",name:o,raw:n,value:s})}else t.push({_tag:"LongOption",name:n.slice(2),raw:n})}else if(n.length>1){let r=n.slice(1),o=r.indexOf("=");if(o!==-1){let s=r.slice(0,o),i=r.slice(o+1);t.push({_tag:"ShortOption",flag:s,raw:`-${s}`,value:i})}else for(let s of r)t.push({_tag:"ShortOption",flag:s,raw:`-${s}`})}else t.push({_tag:"Value",value:n});return t};var Jae=(e,t)=>{let n=e.length,r=t.length,o=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let s=0;s<=n;s++)o[s][0]=s;for(let s=0;s<=r;s++)o[0][s]=s;for(let s=1;s<=n;s++)for(let i=1;i<=r;i++){let a=e[s-1]===t[i-1]?0:1;o[s][i]=Math.min(o[s-1][i]+1,o[s][i-1]+1,o[s-1][i-1]+a)}return o[n][r]},mA=(e,t)=>{let n=t.map((o)=>[Jae(e,o),o]).filter(([o])=>o<=2).sort(([o],[s])=>o-s);if(n.length===0)return[];let r=n[0][0];return n.filter(([o])=>o===r).map(([,o])=>o)};var gA=(e)=>ut(e.subcommand,{onNone:()=>[],onSome:(t)=>[t.name,...gA(t.parsedInput)]}),xA=(e,t,n=[])=>un(function*(){let{tokens:r,trailingOperands:o}=e,s=[...n,t.name],i=Be(t),c=i.config.flags.flatMap(St).filter(du),u=Cf(c),f=i.contextConfig.flags.flatMap(St).filter(du),d=Cf(f),m=new Set(f.map((g)=>g.name)),y={command:t,commandPath:s,flagRegistry:u,inheritedFlagRegistry:d,localFlagNames:c.filter((g)=>!m.has(g.name)).map((g)=>g.name)},b=cce(r,y);if(b._tag==="Leaf")return{flags:b.flags,arguments:[...b.arguments,...o],subcommand:P(),...b.errors.length>0&&{errors:b.errors}};let E={tokens:b.childTokens,trailingOperands:o},w=yield*xA(E,b.sub,s),k=[...b.errors,...w.errors??[]];return{flags:b.flags,arguments:[],subcommand:F({name:b.sub.name,parsedInput:w}),...k.length>0&&{errors:k}}}),US=(e)=>{let t=0;return{peek:()=>e[t],take:()=>e[t++],rest:()=>e.slice(t)}},Cf=(e)=>{let t=new Map;for(let n of e){if(t.has(n.name))throw Error(`Duplicate flag name "${n.name}" in command definition`);t.set(n.name,n);for(let r of n.aliases){if(t.has(r))throw Error(`Duplicate flag/alias "${r}" in command definition (conflicts with "${t.get(r).name}")`);t.set(r,n)}}return{params:e,index:t}},tz=(e)=>{let t=new Map,n=(r,o)=>{let s=t.get(r);if(s&&s!==o)throw Error(`Duplicate subcommand name/alias "${r}" in command definition (conflicts with "${s.name}")`);t.set(r,o)};for(let r of e)for(let o of r.commands)if(n(o.name,o),o.alias&&o.alias!==o.name)n(o.alias,o);return t},yA=(e)=>Object.fromEntries(e.map((t)=>[t.name,[]])),Qae=(e)=>{let t=yA(e);return{add:(n,r)=>{if(r!==void 0)t[n].push(r)},merge:(n)=>{for(let r in n){let o=n[r];if(o?.length)for(let s=0;s<o.length;s++)t[r].push(o[s])}},snapshot:()=>t}},LS=(e)=>e._tag==="LongOption"||e._tag==="ShortOption",nz=(e)=>e._tag==="LongOption"?e.name:e.flag,kf=(e,t)=>{let n=nz(e),r=t.index.get(n);if(r&&r.name===n)return{param:r,negated:!1};if(e._tag==="LongOption"&&e.name.startsWith("no-")){let o=e.name.slice(3),s=t.index.get(o);if(s&&s.name===o&&Vy(s.primitiveType))return{param:s,negated:!0}}if(r)return{param:r,negated:!1};return},Xq=(e,t,n)=>new fr({option:t.name,value:n,expected:`omit the value and use ${e.raw} by itself to set --${t.name} to false`,kind:"flag"}),Zae=(e)=>{let t=Fi(e.primitiveType);return new fr({option:e.name,value:"",expected:t===void 0?e.typeName??wm(e.primitiveType):t.join(" | "),kind:"flag"})},ez=(e)=>e?._tag==="Value"&&(xj(e.value)||yj(e.value))?e.value:void 0,rz=(e,t,n,r=!1)=>{let o=Mm(e,t,n,r);switch(o._tag){case"Value":return{_tag:"Value",value:o.value};case"Error":return{_tag:"Error",error:o.error}}},Mm=(e,t,n,r=!1)=>{if(r){if(t.value!==void 0)return{_tag:"Error",error:Xq(t,n,t.value),tokens:[]};let s=ez(e.peek());if(s!==void 0){let i=e.take();return{_tag:"Error",error:Xq(t,n,s),tokens:i===void 0?[]:[i]}}return{_tag:"Value",value:"false",tokens:[]}}if(t.value!==void 0)return{_tag:"Value",value:t.value,tokens:[]};if(Vy(n.primitiveType)){let s=ez(e.peek()),i=s!==void 0?e.take():void 0;return{_tag:"Value",value:s??"true",tokens:i===void 0?[]:[i]}}let o=e.peek();if(o?._tag==="Value"){let s=e.take();return{_tag:"Value",value:o.value,tokens:s===void 0?[]:[s]}}return{_tag:"Error",error:Zae(n),tokens:[]}},Yae=(e,t)=>{let n=yA(t.params),r=[],o=[],s=US(e);for(let i=s.take();i;i=s.take()){if(!LS(i)){r.push(i);continue}let a=kf(i,t);if(!a){r.push(i);continue}let c=rz(s,i,a.param,a.negated);if(c._tag==="Error"){o.push(c.error);continue}if(c.value!==void 0)n[a.param.name].push(c.value)}return{flagMap:n,remainder:r,errors:o}},Xae=(e)=>Be(e).config.flags.flatMap(St).filter(du),ece=(e)=>Be(e).contextConfig.flags.flatMap(St).filter(du),oz=(e,t)=>{for(let n of t){let r=kf(e,n);if(r!==void 0)return r}return},hA=(e,t,n,r)=>{e.push(n);let o=Mm(t,n,r.param,r.negated);e.push(...o.tokens)},tce=(e,t,n,r,o)=>{let s=US(t);Mm(s,e,n.param,n.negated);for(let i=s.take();i;i=s.take()){if(LS(i)){let a=oz(i,o);if(a!==void 0)Mm(s,i,a.param,a.negated);continue}if(i._tag==="Value")return r.has(i.value)}return!1},sz=(e,t,n)=>{let r=yA(n.params),o=[],s=(i,a,c)=>{let u=Cf(Xae(a)),l=Cf(ece(a)),f=tz(a.subcommands),d=US(i),m=[],y=!0;for(let b=d.take();b;b=d.take()){if(LS(b)){let E=oz(b,c);if(E!==void 0){hA(m,d,b,E);continue}let w=kf(b,l);if(w!==void 0){hA(m,d,b,w);continue}let k=kf(b,u),g=kf(b,n);if(k!==void 0){if(g===void 0||!y||!tce(b,d.rest(),k,f,[u,l,n])){hA(m,d,b,k);continue}}if(g!==void 0){let x=Mm(d,b,g.param,g.negated);if(x._tag==="Error"){o.push(x.error);continue}if(x.value!==void 0)r[g.param.name].push(x.value);continue}m.push(b);continue}if(b._tag==="Value"&&y){let E=f.get(b.value);if(E!==void 0)return m.push(b),m.push(...s(d.rest(),E,[...c,l])),m;y=!1}m.push(b)}return m};return{flagMap:r,remainder:s(e,t,[]),errors:o}},nce=(e,t,n)=>{let r=e._tag==="LongOption"?`--${e.name}`:`-${e.flag}`,o=[];for(let i of t){if(i.hidden)continue;if(o.push(i.name),Vy(i.primitiveType))o.push(`no-${i.name}`);for(let a of i.aliases)o.push(a)}let s=mA(nz(e),o).map((i)=>i.length===1?`-${i}`:`--${i}`);return new ru({option:r,suggestions:s,command:n})},rce=(e)=>({flags:Qae(e.params),arguments:[],errors:[],mode:{_tag:"AwaitingFirstValue"}}),oce=(e)=>({_tag:"Leaf",flags:e.flags.snapshot(),arguments:e.arguments,errors:e.errors}),sce=(e,t,n,r)=>{let{command:o,commandPath:s,inheritedFlagRegistry:i,localFlagNames:a}=n,c=tz(o.subcommands),u=c.get(e);if(u){let f=[...s,u.name],d=r.flags.snapshot();for(let y of a){let b=d[y];if(b!==void 0&&b.length>0)r.errors.push(new ru({option:`--${y}`,suggestions:[],command:f}))}let m=Yae(t.rest(),i);return r.flags.merge(m.flagMap),r.errors.push(...m.errors),{_tag:"Subcommand",result:{_tag:"Sub",flags:r.flags.snapshot(),sub:u,childTokens:m.remainder,errors:r.errors}}}if(!(Be(o).config.arguments.length>0)&&c.size>0){let f=[];for(let[m,y]of c)if(!y.unlisted)f.push(m);let d=mA(e,f);r.errors.push(new Wy({subcommand:e,parent:s,suggestions:d}))}return{_tag:"Argument"}},ice=(e,t,n,r)=>{let{commandPath:o,flagRegistry:s}=n,i=kf(e,s);if(!i){r.errors.push(nce(e,s.params,o));return}let a=rz(t,e,i.param,i.negated);if(a._tag==="Error"){r.errors.push(a.error);return}r.flags.add(i.param.name,a.value)},ace=(e,t,n,r)=>{if(r.mode._tag==="AwaitingFirstValue"){let o=sce(e,t,n,r);if(o._tag==="Subcommand")return o.result;r.mode={_tag:"CollectingArguments"}}r.arguments.push(e);return},cce=(e,t)=>{let n=US(e),r=rce(t.flagRegistry);for(let o=n.take();o;o=n.take()){if(LS(o)){ice(o,n,t,r);continue}if(o._tag==="Value"){let s=ace(o.value,n,t,r);if(s)return s}}return oce(r)};var iz=v(()=>{Re();Me();Em();Fs();gf();bf()});var EA,lce=(e,t)=>{let n=e;for(let r of t.slice(1)){let o=n.subcommands.flatMap((s)=>s.commands).find((s)=>s.name===r||s.alias===r);if(o===void 0)break;n=o}return n},uz,fce=(e)=>e.subcommands.some((n)=>n.commands.some((r)=>!r.unlisted))||Be(e).config.orderedParams.length>0,az,dce=(e)=>{let t=mce(e);switch(e.primitiveType._tag){case"Boolean":return ae(Jn(F0({message:t,label:{confirm:"true",deny:"false"},placeholder:{defaultConfirm:"(T/f)",defaultDeny:"(t/F)"}})),(n)=>Ms(String(n)));case"Choice":{let n=Fi(e.primitiveType)??[];return ae(Jn(D0({message:t,choices:n.map((r)=>({title:r,value:r}))})),Ms)}case"Date":return ae(Jn(Gj({message:t})),(n)=>Ms(n.toISOString()));case"Float":return ae(Jn(Jj({message:t})),(n)=>Ms(String(n)));case"Integer":return ae(Jn(M0({message:t})),(n)=>Ms(String(n)));case"Redacted":return ae(Jn(Qj({message:t})),(n)=>Ms(_a(n),"<redacted>"));default:return ae(Jn(Zj({message:t})),Ms)}},Ms=(e,t=e)=>({value:e,displayValue:t}),pce=(e)=>e.kind===Bt?`--${e.name}`:e.name,mce=(e)=>SA(e),SA=(e)=>{let t=Un(e.description)?.trim(),n=e.kind===Bt&&t!==void 0&&t.length<=32?t:hce(e.name);return e.kind===Bt?`${n} (${pce(e)})`:n},hce=(e)=>{let t=e.split(/[-_]+/).filter((n)=>n.length>0);if(t.length===0)return e;return[t[0][0].toUpperCase()+t[0].slice(1),...t.slice(1)].join(" ")},BS=(e)=>Fn(pz("Current command",e.map((t)=>t.displayValue),Mj)),cz=(e,t)=>`${yt(e.toUpperCase(),Mi,xf)} ${yt("\xB7",vm)} ${yt(t,Mi,iu)}`,lz=(e,t,n)=>[`${yt(e,Mi,xf)} ${yt(`v${t}`,iu)} ${yt("\xB7 Command wizard",Mi,iu)}`,...n===void 0||n.length===0?[]:[n],yt("Build a command interactively. Press Ctrl+C to cancel.",vm),""].join(`
|
|
125
|
-
`),
|
|
126
|
-
${
|
|
127
|
-
`)},gce=(e)=>{let o=e.map(xce),s=[],i=" $ ";for(let a of o){let c=i===" $ "||i===" "?"":" ";if(i.length+c.length+a.length>88&&i!==" $ ")s.push(`${i} \\`),i=` ${a}`;else i+=`${c}${a}`}if(i!==" $ ")s.push(i);return s},xce=(e)=>/^[A-Za-z0-9_./:@%+=,-]+$/.test(e)?e:`'${e.replaceAll("'",`'"'"'`)}'`;var mz=v(()=>{vS();Re();Me();Kp();Fs();gf();Yy();bf();EA=q(function*(e,t){let n=t?.commandPath??[e.name],r=lce(e,n),o=(t?.prefix??n).map((s)=>Ms(s));return yield*BS(o),yield*uz(r,o,r===e?"ROOT":r.name),{args:o.map((s)=>s.value),displayArgs:o.map((s)=>s.displayValue)}}),uz=q(function*(e,t,n){let r=Be(e),o=e.subcommands.flatMap((a)=>a.commands.filter((c)=>!c.unlisted)),s=o.length===0?r.config:r.contextConfig;if(s.flags.length>0){yield*Fn(cz(n,"FLAGS"));for(let a of s.flags)t.push(...yield*az(a));if(s.arguments.length>0||o.length>0)yield*BS(t)}if(s.arguments.length>0){yield*Fn(cz(n,"ARGUMENTS"));for(let a of s.arguments)t.push(...yield*az(a));if(o.length>0)yield*BS(t)}if(o.length===0)return;let i=yield*Jn(D0({message:"Command",choices:o.map((a)=>({title:a.name,value:a,...a.shortDescription!==void 0?{description:a.shortDescription}:a.description!==void 0?{description:a.description}:{}}))}));if(yield*Fn(),t.push(Ms(i.name)),fce(i))yield*BS(t);yield*uz(i,t,i.name)}),az=q(function*(e){let t=xu(e),n=Pr(e);if(n.isOptional){if(!(yield*Jn(F0({message:`Set ${SA(t)}?`,initial:!1}))))return yield*Fn(),[]}let r=!n.isVariadic?1:yield*Jn(M0({message:`${SA(t)} count`,default:It(n.variadicMin,()=>0),min:It(n.variadicMin,()=>0),...Ce(n.variadicMax)?{max:n.variadicMax.value}:{}})),o=[];for(let i=0;i<r;i++)o.push(yield*dce(t));let s=t.kind===Bt?{flags:{[t.name]:o.map((i)=>i.value)},arguments:[]}:{flags:{},arguments:o.map((i)=>i.value)};if(yield*e.parse(s),yield*Fn(),t.kind===En)return o;return o.flatMap((i)=>[Ms(`--${t.name}`),i])})});var Xr={};Qn(Xr,{annotate:()=>_ce,annotateMerge:()=>Oce,isCommand:()=>bA,make:()=>Sce,provide:()=>Rce,provideEffect:()=>Mce,provideEffectDiscard:()=>Dce,provideSync:()=>Fce,run:()=>Bce,runWith:()=>wA,unlisted:()=>Tce,withAlias:()=>Ace,withDescription:()=>vce,withExamples:()=>Pce,withGlobalFlags:()=>Cce,withHandler:()=>Ece,withSharedFlags:()=>kce,withShortDescription:()=>Ice,withSubcommands:()=>wce,wizard:()=>Nce});var bA=(e)=>D(e,Fm),Sce=(e,t,n)=>{let r=RS(t??{});return Rr({name:e,config:r,...Ve(n)?{handle:n}:{}})},Ece,bce=(e)=>{let t=[],n=new Map,r=(i,a)=>{t.push(a);let c=n.get(i);if(c)c.push(a);else n.set(i,[a])};for(let i of e){if(bA(i)){r(void 0,i);continue}for(let a of i.commands)r(i.group,a)}let o=[],s=n.get(void 0);if(s&&s.length>0)o.push({group:void 0,commands:s});for(let[i,a]of n){if(i===void 0)continue;o.push({group:i,commands:a})}return{flat:t,groups:o}},wce,kce,Cce,vce,Ice,Ace,Tce=(e)=>Rr({...Be(e),unlisted:!0}),_ce,Oce,Pce,HS=(e,t)=>{let n=Be(e);return Rr({...n,handle:(r,o)=>t(n.handle(r,o),r)})},Rce,Fce,Mce,Dce,Nce=(e,t)=>ae(EA(e,t),(n)=>n.args),$ce=(e,t,n,r)=>{let o=new Set(t),s=[],i=new Set;for(let a of e){if(o.has(a))continue;let c=St(a.flag);for(let u of c){let l=n[u.name];if(!l||l.length===0)continue;let f=`--${u.name}`;if(i.has(f))continue;i.add(f),s.push(new ru({option:f,suggestions:[],command:r}))}}return s},Uce=(e,t,n)=>un(function*(){let{builtIns:r}=yield*$S,o=yield*Ef,s=yield*DS(e,t.commandPath,r);if(yield*Fn(o.formatHelpDoc(s)),n&&t.errors.length>0)yield*V0(o.formatErrors(t.errors))}),Lce=(e)=>un(function*(){let t=yield*Ef;yield*V0(t.formatError(e)),e[_c]=!1}),Bce,wA=(e,t)=>{let n=Be(e);return q(function*(r){let{builtIns:o}=yield*$S,{tokens:s,trailingOperands:i}=Yq(r),a=Vq(e,o),c=a.flatMap((I)=>St(I.flag)),u=Cf(c.filter(du)),{flagMap:l,remainder:f,errors:d}=sz(s,e,u),m={flags:l,arguments:[]},y=yield*xA({tokens:f,trailingOperands:i},e),b=[e.name,...gA(y)],E={builtIns:o,command:e,commandPath:b,version:t.version},w=lA(e,b,o),k=$ce(a,w,l,b);if(k.length>0||d.length>0){let I=y.errors??[];return yield*new Ha({commandPath:b,errors:[...d,...k,...I]})}for(let I of w){if(I._tag!=="Action")continue;if(!St(I.flag).some((N)=>{let Z=l[N.name];return Z!==void 0&&Z.length>0}))continue;let[,U]=yield*I.flag.parse(m);if(I===dA)return yield*un(function*(){yield*Fn(lz(e.name,t.version,e.description));let N=[e.name,...r.filter((ye)=>ye!=="--wizard"&&!ye.startsWith("--wizard="))],Z=yield*EA(e,{commandPath:b,prefix:N});if(yield*Fn(fz(Z.displayArgs)),yield*Jn(Yj({message:"Run this command?",initial:!0,active:"yes",inactive:"no"})))yield*Fn(),yield*wA(e,{...t,renderErrors:!1})(Z.args.slice(1))}).pipe(si("QuitError",()=>Fn(dz())));yield*I.run(U,E);return}if(y.errors&&y.errors.length>0)return yield*new Ha({commandPath:b,errors:y.errors});let g=yield*Eg(n.parse(y));if(g._tag==="Failure")return yield*new Ha({commandPath:b,errors:[g.failure]});let x=n.handle(g.success,[e.name]),S=w.includes(wf)?(yield*wf.flag.parse(m))[1]:P();x=fs(x,wf,S);for(let I of w){if(I._tag!=="Setting"||I===wf)continue;let[,_]=yield*I.flag.parse(m);x=fs(x,I,_)}let C=ut(S,{onNone:()=>Ln(),onSome:(I)=>Ks(yR,I)});yield*ii(x,C)},qd((r)=>C0(r)&&r._tag==="ShowHelp"?J(r):oe(r),(r)=>Vr(Uce(e,r,t.renderErrors!==!1),R(r))),qd((r)=>t.renderErrors!==!1&&C0(r)&&r._tag==="UserError"?J(r):oe(r),(r)=>Vr(Lce(r),R(r))),qd((r)=>BB(r)?J(r):oe(r),(r)=>gl))};var hz=v(()=>{vS();rt();Re();ne();Me();ge();vw();Bn();Pg();hv();Sy();Qq();Em();J0();pA();bf();iA();fA();iz();mz();Fs();Yy();Ece=p(2,(e,t)=>Rr({...Be(e),handle:t})),wce=p(2,(e,t)=>{let n=bce(t);aA(e,n.flat);let r=Be(e),o=new Map(n.flat.map((c)=>[c.name,Be(c)])),s=Symbol("effect/cli/SubcommandState"),i=q(function*(c){if(he(c.subcommand))return yield*r.parse(c);let u=o.get(c.subcommand.value.name);if(!u)return yield*r.parse(c);let l=yield*r.parseContext(c),f=yield*u.parse(c.subcommand.value.parsedInput);return{...l,[s]:{name:u.name,result:f}}}),a=q(function*(c,u){let f=c[s];if(f){let d=o.get(f.name);if(!d)return yield*new Ha({commandPath:u,errors:[]});return yield*d.handle(f.result,[...u,d.name]).pipe(fs(r.service,c))}return yield*r.handle(c,u)});return Rr({name:r.name,config:r.config,contextConfig:r.contextConfig,description:r.description,shortDescription:r.shortDescription,alias:r.alias,unlisted:r.unlisted,annotations:r.annotations,globalFlags:r.globalFlags,examples:r.examples,service:r.service,subcommands:n.groups,parse:i,parseContext:r.parseContext,handle:a})}),kce=p(2,(e,t)=>{let n=Be(e),r=RS(t),o=oA(n.config,r),s=oA(n.contextConfig,r);if(n.subcommands.length>0){let l=n.subcommands.flatMap((f)=>f.commands);aA(e,l,{contextConfig:s})}let i=FS(r,{allowLeftovers:!0}),a=q(function*(l){let f=yield*n.parse(l),d=yield*i(l);return{...f,...d}}),c=q(function*(l){let f=yield*n.parseContext(l),d=yield*i(l);return{...f,...d}}),u=(l,f)=>n.handle(l,f);return Rr({name:n.name,config:o,contextConfig:s,description:n.description,shortDescription:n.shortDescription,alias:n.alias,unlisted:n.unlisted,annotations:n.annotations,globalFlags:n.globalFlags,examples:n.examples,service:n.service,subcommands:n.subcommands,parse:a,parseContext:c,handle:u})}),Cce=p(2,(e,t)=>{let n=Be(e),r=Array.from(new Set([...n.globalFlags,...t]));return Rr({...n,globalFlags:r})}),vce=p(2,(e,t)=>Rr({...Be(e),description:t})),Ice=p(2,(e,t)=>Rr({...Be(e),shortDescription:t})),Ace=p(2,(e,t)=>Rr({...Be(e),alias:t})),_ce=p(3,(e,t,n)=>{let r=Be(e);return Rr({...r,annotations:Cn(r.annotations,t,n)})}),Oce=p(2,(e,t)=>{let n=Be(e);return Rr({...n,annotations:ic(n.annotations,t)})}),Pce=p(2,(e,t)=>Rr({...Be(e),examples:t})),Rce=p((e)=>bA(e[0]),(e,t,n)=>HS(e,(r,o)=>mk(r,typeof t==="function"?t(o):t,n))),Fce=p(3,(e,t,n)=>HS(e,(r,o)=>fs(r,t,typeof n==="function"?n(o):n))),Mce=p(3,(e,t,n)=>HS(e,(r,o)=>hk(r,t,typeof n==="function"?n(o):n))),Dce=p(2,(e,t)=>HS(e,(n,r)=>Vr(typeof t==="function"?t(r):t,n))),Bce=p(2,(e,t)=>Dx.use(({args:n})=>se(n,(r)=>wA(e,t)(r))))});var gz=v(()=>{Cq();hz();rA()});var xz=(e)=>{let t=e?.trim();return t===void 0||t.length===0?void 0:t},yz=()=>({bunExecutable:xz(process.env.TRIPWIRE_BUN),forcePortable:process.env.TRIPWIRE_FORCE_PORTABLE==="1",packageDist:xz(process.env.TRIPWIRE_PACKAGE_DIST)}),Sz=()=>({...process.env});var kA=()=>{};import{lstat as vz,mkdir as Hce,open as Wce,readFile as Dm,readlink as jce,realpath as qce,rename as Iz,rm as WS,stat as zce,symlink as Ez}from"fs/promises";import{homedir as $m}from"os";import Su from"path";import{fileURLToPath as bz}from"url";var wz,Az,Ds=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),vf=(e,t)=>e instanceof Error&&("code"in e)&&e.code===t,Nm=async(e,t,n={})=>{let r=e,o=!1;try{o=(await vz(e)).isSymbolicLink()}catch(c){if(!vf(c,"ENOENT"))throw c}if(o)r=await qce(e);let s=`${r}.${process.pid}.next`,i,a=384;try{a=(await zce(r)).mode&4095}catch(c){if(!vf(c,"ENOENT"))throw c}await WS(s,{force:!0});try{i=await Wce(s,"wx",a),await i.writeFile(t,"utf8"),await i.chmod(a),await i.sync(),await i.close(),i=void 0,await n.beforeRename?.(s,r),await Iz(s,r)}finally{try{if(i!==void 0)await i.close()}finally{await WS(s,{force:!0})}}},Vce=(e)=>Ds(e)&&typeof e.type==="string"&&typeof e.command==="string"&&(e.timeout===void 0||typeof e.timeout==="number"),kz=(e)=>Array.isArray(e)&&e.every((t)=>Ds(t)&&Array.isArray(t.hooks)&&t.hooks.every(Vce)),Kce=(e)=>{if(!Ds(e))return!1;let{hooks:t}=e;if(t===void 0)return!0;return Ds(t)&&(t.PreToolUse===void 0||kz(t.PreToolUse))&&(t.PostToolUse===void 0||kz(t.PostToolUse))},CA=(e,t)=>{let n=JSON.parse(e);if(!Kce(n))throw Error(`${t} hook config has an unsupported shape`);return n},Gce=(e)=>{let t=JSON.parse(e);if(!Ds(t))throw Error("Cursor hooks.json must contain a JSON object");let{hooks:n}=t;if(n===void 0)return t;if(!Ds(n))throw Error("Cursor hooks.json `hooks` must be an object");for(let[r,o]of Object.entries(n))if(!Array.isArray(o)||o.some((s)=>!Ds(s)||typeof s.command!=="string"))throw Error(`Cursor hooks.json event ${r} must contain command hooks`);return t},Eu="tripwire-hook",Tz=async(e,t)=>{await Hce(Su.dirname(t),{recursive:!0});try{if(!(await vz(t)).isSymbolicLink())return{action:"already",success:!1};let r=await jce(t);if(r===e)return{action:"already",success:!0};let o=Su.resolve(Su.dirname(t),r);if(Su.basename(o)!=="tripwire-pi.js")return{action:"already",success:!1};let s=`${t}.${process.pid}.next`;await WS(s,{force:!0});try{await Ez(e,s),await Iz(s,t)}finally{await WS(s,{force:!0})}return{action:"updated",success:!0}}catch(n){if(!(n instanceof Error&&("code"in n)&&n.code==="ENOENT"))throw n;return await Ez(e,t),{action:"installed",success:!0}}},Jce,Qce,jS=(e)=>e===Eu||e.startsWith(`${Eu} `)||e.includes("/tripwire-darwin-arm64/")||e.includes("/tripwire-hook")||e.includes("/tripwire.js")||e.includes("/dist/tripwire"),Zce=(e,t,n=Eu)=>{let r=Qce.has(t),o={command:`${n} --cursor-event ${t}`,...r&&{failClosed:!0}};if(e===void 0)return[[o],!0];let s=!1,i=e.some((u)=>jS(u.command)),a=`${n} --cursor-event ${t}`,c=e.map((u)=>{if(!jS(u.command))return u;if(u.command===a&&(!r||u.failClosed===!0))return u;return s=!0,{...u,command:a,...r&&{failClosed:!0}}});if(i)return[c,s];return[[...c,o],!0]},qS=(e,t=Eu)=>{if(!e)return[[{hooks:[{type:"command",command:t}]}],!1];let n=!1,r=e.map((i)=>({...i,hooks:i.hooks.map((a)=>{if(jS(a.command)){if(a.command!==t)return n=!0,{...a,command:t};return a}return a})}));if(r.some((i)=>i.hooks.some((a)=>a.command===t)))return[r,!n];return[[...r,{hooks:[{type:"command",command:t}]}],!1]},vA=async(e={})=>{let t=e.homeDirectory??$m(),n=e.hookCommand??Eu,r=`${t}/.claude/settings.json`;try{let o=await Dm(r,"utf8"),s=CA(o,"Claude");s.hooks??={};let[i,a]=qS(s.hooks.PreToolUse,n),[c,u]=qS(s.hooks.PostToolUse,n);if(s.hooks.PreToolUse=i,s.hooks.PostToolUse=c,a&&u)return{success:!0,message:`Already configured: ${r}`};return await Nm(r,`${JSON.stringify(s,null,2)}
|
|
128
|
-
`),{success:!0,message:`Updated ${
|
|
129
|
-
`,c=a!==s,
|
|
100
|
+
${Jp(c[0].message)}${s}`;let l=new Map;for(let f of c){let d=f._tag??"Error",h=l.get(d)??[];h.push(f),l.set(d,h)}let u=[];u.push(`
|
|
101
|
+
${a}${i}ERRORS${s}`);for(let[,f]of l)for(let d of f)u.push(` ${Jp(d.message)}${s}`);return u.join(`
|
|
102
|
+
`)},formatVersion:(c,l)=>`${o.bold(c)} ${o.dim("v")}${o.bold(l)}`}},Gz=(e)=>e.replace(/\u001B\[[0-9;]*m/g,""),Uy=(e)=>Gz(e).length,Yz=(e,t)=>{let r=Uy(e),n=Math.max(0,t-r);return e+" ".repeat(n)},Ru=(e,t)=>{let r=Math.max(...e.map((o)=>Uy(o.left)))+4,n=t===void 0?r:Math.min(r,t);return e.map(({left:o,right:s})=>` ${Yz(o,Math.max(n,Uy(o)+1))}${s}`).join(`
|
|
103
|
+
`)},p$=(e,t)=>t?`${e}, ${t}`:e,Hz=(e,t)=>{let r=[];if(e.description)r.push(t.bold("DESCRIPTION")),r.push(` ${e.description}`),r.push("");if(r.push(t.bold("USAGE")),r.push(` ${t.cyan(e.usage)}`),r.push(""),e.args&&e.args.length>0){r.push(t.bold("ARGUMENTS"));let n=e.args.map((o)=>{let s=o.name;if(o.variadic)s+="...";let i=t.green(s),a=t.dim(o.type),c=`${i} ${a}`,l=o.required?"":t.dim(" (optional)"),u=bt(o.description,()=>"")+l;return{left:c,right:u}});r.push(Ru(n,25)),r.push("")}if(e.flags.length>0){r.push(t.bold("FLAGS"));let n=e.flags.map((o)=>{let s=[];s.push(t.green(`--${o.name}`));for(let c of o.aliases)s.push(t.green(c));let i=s.join(", "),a=o.type!=="boolean"?` ${t.dim(o.type)}`:"";return{left:i+a,right:bt(o.description,()=>"")}});r.push(Ru(n)),r.push("")}if(e.globalFlags&&e.globalFlags.length>0){r.push(t.bold("GLOBAL FLAGS"));let n=e.globalFlags.map((o)=>{let s=[];s.push(t.green(`--${o.name}`));for(let c of o.aliases)s.push(t.green(c));let i=s.join(", "),a=o.type!=="boolean"?` ${t.dim(o.type)}`:"";return{left:i+a,right:bt(o.description,()=>"")}});r.push(Ru(n)),r.push("")}if(e.subcommands&&e.subcommands.length>0){let n=e.subcommands.find((o)=>o.group===void 0);if(n){if(r.push(t.bold("SUBCOMMANDS")),r.push(Ru(n.commands.map((o)=>({left:t.cyan(p$(o.name,o.alias)),right:o.shortDescription??o.description})),20)),e.subcommands.length>1)r.push("")}for(let o of e.subcommands){if(o.group===void 0)continue;r.push(t.bold(`${o.group}:`)),r.push(Ru(o.commands.map((s)=>({left:t.cyan(p$(s.name,s.alias)),right:s.shortDescription??s.description})),20)),r.push("")}}if(e.examples&&e.examples.length>0){r.push(t.bold("EXAMPLES"));let n=!0,o=!1;for(let s of e.examples){if(s.description){if(!n)r.push("");r.push(` ${t.dim(`# ${s.description}`)}`)}else if(o)r.push("");r.push(` ${t.cyan(s.command)}`),n=!1,o=!!s.description}r.push("")}if(r[r.length-1]==="")r.pop();return r.join(`
|
|
104
|
+
`)};var Dy=E(()=>{lt();ze();Oc=Be("effect/cli/CliOutput",{defaultValue:()=>Bz()})});var Iu=(e)=>e.replace(/'/g,"'\\''"),My=(e)=>e.replace(/[^a-zA-Z0-9_]/g,"_"),Ny=(e)=>{let t=[`--${e.name}`];for(let r of e.aliases)t.push(r.length===1?`-${r}`:`--${r}`);if(e.type._tag==="Boolean")t.push(`--no-${e.name}`);return t},Jz=(e,t)=>{if(e.length===0)return;let r=e.map(Ny);t.push(` local ${r.map((n,o)=>`_used_${o}=""`).join(" ")}`),t.push(" for ((i = 1; i < cword; i++)); do"),t.push(' case "${words[i]%%=*}" in'),r.forEach((n,o)=>{t.push(` ${n.join("|")}) _used_${o}=1 ;;`)}),t.push(" esac"),t.push(" done"),t.push(' local _filtered_flags=""'),r.forEach((n,o)=>{t.push(` [[ -n "$_used_${o}" ]] || _filtered_flags+=" ${n.join(" ")}"`)}),t.push("")},Kz=(e,t)=>{t.push(`${e}()`),t.push("{"),t.push(' local _cur="$1" _word="$2"; shift 2'),t.push(""),t.push(' local _head="${_cur%"$_word"}"'),t.push(' local _open=""'),t.push(' case "$_head" in'),t.push(` *\\') _open="'" ;;`),t.push(` *\\") _open='"' ;;`),t.push(" esac"),t.push(""),t.push(' local _prefix="$_cur" _committed="$_head"'),t.push(" _prefix=${_prefix//\\\\/}; _prefix=${_prefix//\\\"/}; _prefix=${_prefix//\\'/}"),t.push(" _committed=${_committed//\\\\/}; _committed=${_committed//\\\"/}; _committed=${_committed//\\'/}"),t.push(""),t.push(" COMPREPLY=()"),t.push(" local _choice _rest _match"),t.push(' for _choice in "$@"; do'),t.push(' [[ "$_choice" == "$_prefix"* ]] || continue'),t.push(' _rest="${_choice#"$_committed"}"'),t.push(' case "$_open" in'),t.push(` "'")`),t.push(` if [[ "$_head" == "'" ]]; then`),t.push(" _match=${_rest//\\'/\\'\\\\\\'\\'}"),t.push(" else"),t.push(' [[ "$_rest" == *\\\'* ]] && continue'),t.push(' _match="$_rest"'),t.push(" fi"),t.push(" ;;"),t.push(` '"')`),t.push(' _match="${_rest//\\\\/\\\\\\\\}"'),t.push(' _match="${_match//\\$/\\\\$}"'),t.push(' _match="${_match//\\`/\\\\\\`}"'),t.push(' _match="${_match//\\"/\\\\\\"}"'),t.push(" ;;"),t.push(" *)"),t.push(` printf -v _match '%q' "$_rest"`),t.push(` [[ -z "$_head" && "$_match" == '~'* ]] && _match="\\\\$_match"`),t.push(" ;;"),t.push(" esac"),t.push(' [[ -n "$_open" && "$_match" == *"$_open" ]] && _match+="$_open"'),t.push(' COMPREPLY+=("$_match")'),t.push(" done"),t.push("}"),t.push("")},m$=(e,t)=>`${e} "$cur" "$_comp_word" ${t.map((r)=>`'${Iu(r)}'`).join(" ")}`,eX=(e,t)=>{switch(e._tag){case"Boolean":return;case"Choice":return m$(t,e.values);case"Path":if(e.pathType==="directory")return'COMPREPLY=( $(compgen -d -- "$cur") )';return'COMPREPLY=( $(compgen -f -- "$cur") )';default:return}},tX=(e,t)=>{switch(e._tag){case"Choice":return m$(t,e.values);case"Path":if(e.pathType==="directory")return'COMPREPLY=( $(compgen -d -- "$cur") )';return'COMPREPLY=( $(compgen -f -- "$cur") )';default:return}},O$=(e,t,r,n)=>{let o=[...t,e.name],s=`_${o.map(My).join("_")}`;if(r.push(`${s}()`),r.push("{"),r.push(" local cur prev words cword i"),r.push(t.length===0?" local _command_index=0":' local _command_index="$1"'),r.push(' _init_completion -n "$COMP_WORDBREAKS" || return'),t.length===0)r.push(' local _comp_word="$2"');r.push("");let i=e.flags.filter((c)=>c.type._tag!=="Boolean");if(i.length>0){r.push(" # Flag value completions"),r.push(' case "$prev" in');for(let c of i){let l=[`--${c.name}`];for(let f of c.aliases)l.push(f.length===1?`-${f}`:`--${f}`);let u=eX(c.type,n);if(u)r.push(` ${l.join("|")})`),r.push(` ${u}`),r.push(" return"),r.push(" ;;")}r.push(" esac"),r.push("")}if(e.subcommands.length>0){r.push(" # Subcommand dispatch"),r.push(" local cmd _skip_next=0"),r.push(" for ((i = _command_index + 1; i < cword; i++)); do"),r.push(" if (( _skip_next )); then"),r.push(" _skip_next=0"),r.push(" continue"),r.push(" fi"),r.push(' case "${words[i]}" in');for(let c of e.flags){if(c.type._tag==="Boolean")continue;let l=Ny(c);r.push(` ${l.join("|")}) _skip_next=1 ;;`),r.push(` ${l.map((u)=>`${u}=*`).join("|")}) ;;`)}for(let c of e.subcommands){let l=`_${[...o,c.name].map(My).join("_")}`;r.push(` ${c.name})`),r.push(` ${l} "$i"`),r.push(" return"),r.push(" ;;")}r.push(" esac"),r.push(" done"),r.push("")}if(Jz(e.flags,r),e.flags.length>0||e.subcommands.length>0){if(r.push(" # Complete flags (filtered) and subcommands"),r.push(' if [[ "$cur" == -* ]]; then'),e.flags.length>0)r.push(' COMPREPLY=( $(compgen -W "$_filtered_flags" -- "$cur") )');r.push(" return"),r.push(" fi"),r.push("")}let a=e.arguments.flatMap((c,l)=>{let u=tX(c.type,n);return u===void 0?[]:[{argument:c,completion:u,index:l}]});if(a.length>0){r.push(" # Positional argument completions"),r.push(" local _position=0 _skip_next=0 _end_of_options=0"),r.push(" for ((i = _command_index + 1; i < cword; i++)); do"),r.push(" if (( _skip_next )); then"),r.push(" _skip_next=0"),r.push(" continue"),r.push(" fi"),r.push(" if (( _end_of_options )); then"),r.push(" ((_position += 1))"),r.push(" continue"),r.push(" fi"),r.push(' case "${words[i]}" in'),r.push(" --) _end_of_options=1 ;;");for(let l of e.flags){let u=Ny(l);if(l.type._tag==="Boolean")r.push(` ${u.join("|")}) ;;`);else r.push(` ${u.join("|")}) _skip_next=1 ;;`),r.push(` ${u.map((f)=>`${f}=*`).join("|")}) ;;`)}r.push(" -*) ;;"),r.push(" *) ((_position += 1)) ;;"),r.push(" esac"),r.push(" done"),r.push(' case "$_position" in');for(let{argument:l,completion:u,index:f}of a){if(l.variadic)continue;r.push(` ${f})`),r.push(` ${u}`),r.push(" return"),r.push(" ;;")}r.push(" esac");let c=a.find(({argument:l})=>l.variadic);if(c!==void 0)r.push(` if (( _position >= ${c.index} )); then`),r.push(` ${c.completion}`),r.push(" return"),r.push(" fi")}else if(e.subcommands.length>0){let c=e.subcommands.map((l)=>l.name);r.push(` COMPREPLY=( $(compgen -W '${c.join(" ")}' -- "$cur") )`)}r.push("}"),r.push("");for(let c of e.subcommands)O$(c,o,r,n)},g$=(e,t)=>{let r=[],n=My(e),o=`_${n}--choices`;return r.push(`###-begin-${Iu(e)}-completions-###`),r.push("#"),r.push("# Static completion script for Bash"),r.push("#"),r.push("# Installation:"),r.push(`# ${Iu(e)} --completions bash >> ~/.bashrc`),r.push("#"),r.push(""),r.push("if ! type _init_completion &>/dev/null; then"),r.push(" _init_completion()"),r.push(" {"),r.push(" COMPREPLY=()"),r.push(' local _i _j=0 _piece _line="$COMP_LINE"'),r.push(' words=("${COMP_WORDS[0]}")'),r.push(" cword=0"),r.push(' _line="${_line#*"${COMP_WORDS[0]}"}"'),r.push(" for ((_i = 1; _i < ${#COMP_WORDS[@]}; _i++)); do"),r.push(' _piece="${COMP_WORDS[_i]}"'),r.push(' if [[ "$_line" == [[:blank:]]* ]]; then'),r.push(" ((_j++))"),r.push(' words[_j]="$_piece"'),r.push(" else"),r.push(' words[_j]="${words[_j]}$_piece"'),r.push(" fi"),r.push(" ((_i == COMP_CWORD)) && cword=$_j"),r.push(' _line="${_line#*"$_piece"}"'),r.push(" done"),r.push(' cur="${words[cword]}"'),r.push(' prev=""'),r.push(' ((cword > 0)) && prev="${words[cword-1]}"'),r.push(" return 0"),r.push(" }"),r.push("fi"),r.push(""),Kz(o,r),O$(t,[],r,o),r.push(`complete -F _${n} ${Iu(e)}`),r.push(`###-end-${Iu(e)}-completions-###`),r.join(`
|
|
105
|
+
`)};var Vs=(e)=>e.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),x$=(e)=>Vs(e.replace(/[^A-Za-z0-9_.,/@%+-]/gu,"\\$&")),nX=(e,t)=>{if(e.length===0){if(t.length>0)return"__fish_use_subcommand";return""}let r=e.map((n)=>`__fish_seen_subcommand_from ${n}`).join("; and ");if(t.length>0)return`${r}; and not __fish_seen_subcommand_from ${t.join(" ")}`;return r},Zy=(e)=>{let t=[];for(let r of e.aliases)if(r.length===1)t.push(`-s ${r}`);t.push(e.name);for(let r of e.aliases)if(r.length>1)t.push(r);if(e.type._tag==="Boolean")t.push(`no-${e.name}`);return`not __fish_contains_opt ${t.join(" ")}`},oX=(e)=>{let t=[`--${e.name}`];for(let r of e.aliases)t.push(r.length===1?`-${r}`:`--${r}`);return`begin; ${Zy(e)}; or contains -- (commandline -poc)[-1] ${t.join(" ")}; end`},sX=(e)=>{let t=[`-l ${e.name}`];for(let n of e.aliases)if(n.length===1)t.push(`-s ${n}`);else t.push(`-l ${n}`);if(e.description)t.push(`-d '${Vs(e.description)}'`);let r=iX(e.type);if(r)t.push(r);return t},iX=(e)=>{switch(e._tag){case"Boolean":return;case"Choice":return`-r -f -a '${e.values.map(x$).join(" ")}'`;case"Path":if(e.pathType==="directory")return"-r -F";return"-r -F";default:return"-r -f"}},aX=(e)=>{switch(e._tag){case"Choice":return`-r -f -a '${e.values.map(x$).join(" ")}'`;case"Path":return"-r -F";default:return}},y$=(e,t,r,n)=>{let o=t.subcommands.map((c)=>c.name),s=nX(r,o),i=s?`-n '${s}'`:"";if(!t.arguments.some((c)=>c.type._tag==="Path")){let c=[`complete -c ${e}`];if(i)c.push(i);c.push("-f"),n.push(c.join(" "))}for(let c of t.subcommands){let l=[`complete -c ${e}`];if(i)l.push(i);if(l.push(`-f -a '${Vs(c.name)}'`),c.description)l.push(`-d '${Vs(c.description)}'`);n.push(l.join(" "))}for(let c of t.flags){let l=c.type._tag==="Boolean",u=l?Zy(c):oX(c),f=s?`${s}; and ${u}`:u,d=f?`-n '${f}'`:"",h=[`complete -c ${e}`];if(d)h.push(d);if(h.push(...sX(c)),n.push(h.join(" ")),l){let m=[`complete -c ${e}`];if(d)m.push(d);if(m.push(`-l no-${c.name}`),c.description)m.push(`-d '${Vs(`Disable ${c.name}`)}'`);n.push(m.join(" "))}}if(t.flags.length>0){let l=s?`${s}; and not string match -q -- "-*" (commandline -ct)`:'not string match -q -- "-*" (commandline -ct)';for(let u of t.flags){let f=`${l}; and ${Zy(u)}`,d=u.type._tag==="Boolean",h=[`complete -c ${e}`];if(h.push(`-n '${f}'`),h.push(`-f -a '--${u.name}'`),u.description)h.push(`-d '${Vs(u.description)}'`);if(n.push(h.join(" ")),d){let m=[`complete -c ${e}`];if(m.push(`-n '${f}'`),m.push(`-f -a '--no-${u.name}'`),u.description)m.push(`-d '${Vs(`Disable ${u.name}`)}'`);n.push(m.join(" "))}}}for(let c of t.arguments){let l=aX(c.type);if(l){let u=[`complete -c ${e}`];if(i)u.push(i);if(u.push(l),c.description)u.push(`-d '${Vs(c.description)}'`);n.push(u.join(" "))}}for(let c of t.subcommands)y$(e,c,[...r,c.name],n)},S$=(e,t)=>{let r=[];return r.push(`###-begin-${e}-completions-###`),r.push("#"),r.push("# Static completion script for Fish"),r.push("#"),r.push("# Installation:"),r.push(`# ${e} --completions fish > ~/.config/fish/completions/${e}.fish`),r.push("#"),r.push(""),y$(e,t,[],r),r.push(""),r.push(`###-end-${e}-completions-###`),r.join(`
|
|
106
|
+
`)};var Kp=(e)=>e.replace(/\\/g,"\\\\").replace(/'/g,"'\\''").replace(/:/g,"\\:"),k$=(e)=>e.replace(/[^A-Za-z0-9_.,/@%+-]/gu,"\\$&").replace(/'/g,"'\\''"),qy=(e)=>e.replace(/[^a-zA-Z0-9_]/g,"_"),lX=(e)=>{let t=[`--${e.name}`];for(let r of e.aliases)t.push(r.length===1?`-${r}`:`--${r}`);if(e.type._tag==="Boolean")t.push(`--no-${e.name}`);return t},uX=(e)=>{switch(e._tag){case"Boolean":return"";case"Choice":return`:value:(${e.values.map(k$).join(" ")})`;case"Path":return e.pathType==="directory"?":directory:_directories":":file:_files";case"Integer":return":integer:";case"Float":return":float:";case"Date":return":date:";default:return":value:"}},fX=(e)=>{switch(e._tag){case"Choice":return`(${e.values.map(k$).join(" ")})`;case"Path":return e.pathType==="directory"?"_directories":"_files";default:return""}},E$=(e)=>{let t=[],r=e.description?`[${Kp(e.description)}]`:"",n=uX(e.type),o=`(${lX(e).join(" ")})`;t.push(`'${o}--${e.name}${r}${n}'`);for(let s of e.aliases){let i=s.length===1?"-":"--";t.push(`'${o}${i}${s}${r}${n}'`)}if(e.type._tag==="Boolean"){let s=e.description?`[${Kp(`Disable ${e.name}`)}]`:"";t.push(`'${o}--no-${e.name}${s}'`)}return t},b$=(e)=>{let t=e.description?Kp(e.description):e.name,r=fX(e.type);return`'${e.variadic?"*":""}:${t}:${r}'`},P$=(e,t,r)=>{let n=[...t,e.name],o=`_${n.map(qy).join("_")}`;if(r.push(`${o}() {`),e.subcommands.length>0){r.push(" local context state state_descr line"),r.push(" typeset -A opt_args"),r.push(""),r.push(" local -a commands"),r.push(" commands=(");for(let s of e.subcommands){let i=s.description?Kp(s.description):"";r.push(` '${s.name}:${i}'`)}r.push(" )"),r.push(""),r.push(" local -a specs"),r.push(" specs=(");for(let s of e.flags)for(let i of E$(s))r.push(` ${i}`);if(e.arguments.length>0){r.push(" -"),r.push(" parent-arguments");for(let s of e.arguments)r.push(` ${b$(s)}`);r.push(" -"),r.push(" subcommands")}r.push(" '1:command:->command'"),r.push(" '*::arg:->args'"),r.push(" )"),r.push(""),r.push(' _arguments -C "${specs[@]}"'),r.push(""),r.push(' case "$state" in'),r.push(" command)"),r.push(" _describe -t commands 'commands' commands"),r.push(" ;;"),r.push(" args)"),r.push(' case "$words[1]" in');for(let s of e.subcommands){let i=`_${[...n,s.name].map(qy).join("_")}`;r.push(` ${s.name})`),r.push(` ${i}`),r.push(" ;;")}r.push(" esac"),r.push(" ;;"),r.push(" esac")}else{let s=[];for(let i of e.flags)s.push(...E$(i));for(let i of e.arguments)s.push(b$(i));if(s.length>0){r.push(" local -a specs"),r.push(" specs=(");for(let i of s)r.push(` ${i}`);r.push(" )"),r.push(' _arguments "${specs[@]}"')}}r.push("}"),r.push("");for(let s of e.subcommands)P$(s,n,r)},w$=(e,t)=>{let r=[],n=qy(e);return r.push(`#compdef ${e}`),r.push(`###-begin-${e}-completions-###`),r.push("#"),r.push("# Static completion script for Zsh"),r.push("#"),r.push("# Installation:"),r.push(`# ${e} --completions zsh > ~/.zsh/completions/_${e}`),r.push("# then add ~/.zsh/completions to your fpath"),r.push("#"),r.push(""),P$(t,[],r),r.push("# Handle both direct invocation and autoload"),r.push('if [[ "${zsh_eval_context[-1]}" == "loadautofunc" ]]; then'),r.push(` _${n} "$@"`),r.push("else"),r.push(` compdef _${n} ${e}`),r.push("fi"),r.push(`###-end-${e}-completions-###`),r.join(`
|
|
107
|
+
`)};var T$=(e,t,r)=>{switch(t){case"bash":return g$(e,r);case"zsh":return w$(e,r);case"fish":return S$(e,r)}};var v$=()=>{};var Fu=(e)=>Xp(Hn,e),Uu=(e)=>a$(Hn,e),C$=(e,t)=>jp(Hn,e,t),Q$=(e,t)=>Cy(Hn,e,t),Wy,rn,Ly,Bi=(e)=>ji(e),gc,_$;var Xy=E(()=>{oe();Jn();Wy=v(2,(e,t)=>c$(e,t)),rn=v(2,(e,t)=>Vp(e,t)),Ly=v(2,(e,t)=>Ay(e,t)),gc=_y,_$=v(2,(e,t)=>Au(e,t))});var $$="~effect/cli/Command/Config/Internal",jy=(e)=>{let t=[],r=[],n=[];function o(i){let a=Object.create(null);for(let c of Object.keys(i))a[c]=s(i[c]);return a}function s(i){if(Array.isArray(i))return{_tag:"Array",children:i.map((a)=>s(a))};else if(zp(i)){let a=t.length;if(t.push(i),i.kind==="argument")n.push(i);else r.push(i);return{_tag:"Param",index:a}}else return{_tag:"Nested",tree:o(i)}}return{[$$]:$$,flags:r,arguments:n,orderedParams:t,tree:o(e)}},A$,Vy=(e,t)=>{let r={};for(let o of Object.keys(e))Ar(r,o,n(e[o]));return r;function n(o){switch(o._tag){case"Param":return t[o.index];case"Array":return o.children.map((s)=>n(s));case"Nested":return Vy(o.tree,t)}}};var By=E(()=>{Jn();A$=jy({})});var Du="~effect/cli/Command",He=(e)=>e,hX,eh=(e)=>{let t=e.config,r=e.contextConfig??A$,n=e.service??rt(`${Du}/${e.name}`),o=e.annotations??Tn(),s=e.globalFlags??[],i=e.subcommands??[],a=(f,d)=>wt(e.handle)?e.handle(f,d):N(new Ls({commandPath:d,errors:[]})),c=e.parse??Gy(t),l=e.parseContext??Gy(r,{allowLeftovers:!0}),u=(f)=>{let d=[],h=[];for(let O of t.arguments){let S=Me(O),y=gr(O);for(let g of S)d.push({name:g.name,type:g.typeName??Tu(g.primitiveType),description:g.description,required:!y.isOptional&&(!y.isVariadic||eE(y.variadicMin,(C)=>C>0)),variadic:y.isVariadic})}let m=f.length>0?f.join(" "):e.name;if(i.some((O)=>O.commands.some((S)=>!S.unlisted)))m+=" <subcommand>";m+=" [flags]";for(let O of d){let S=O.variadic?`<${O.name}...>`:`<${O.name}>`;m+=` ${O.required?S:`[${S}]`}`}for(let O of t.flags){let S=Me(O),y=gr(O);for(let g of S){if(g.hidden)continue;h.push(th(g,y))}}let b=[];for(let O of i){let S=O.commands.filter((y)=>!y.unlisted);if(S.length===0)continue;b.push({group:O.group,commands:Sr(S,(y)=>({name:y.name,alias:y.alias,shortDescription:y.shortDescription,description:y.description??""}))})}let x=e.examples??[];return{description:e.description??"",usage:m,flags:h,annotations:o,...d.length>0&&{args:d},...b.length>0&&{subcommands:b},...x.length>0&&{examples:x}}};return Object.assign(Object.create(hX),{[Du]:Du,name:e.name,examples:e.examples??[],annotations:o,globalFlags:s,subcommands:i,unlisted:e.unlisted??!1,config:t,contextConfig:r,service:n,parse:c,parseContext:l,handle:a,buildHelpDoc:u,...wt(e.description)?{description:e.description}:{},...wt(e.shortDescription)?{shortDescription:e.shortDescription}:{},...wt(e.alias)?{alias:e.alias}:{}})},th=(e,t)=>{let r=e.aliases.map((n)=>n.length===1?`-${n}`:`--${n}`);return{name:e.name,aliases:r,type:e.typeName??Tu(e.primitiveType),description:mX(e.description,Xo(e.primitiveType)),required:e.primitiveType._tag!=="Boolean"&&!t.isOptional}},mX=(e,t)=>{if(t===void 0||t.length===0)return e;let r=`(choices: ${t.join(", ")})`;return er(e,{onNone:()=>ee(r),onSome:(n)=>ee(`${n} ${r}`)})},Gy=(e,t)=>z(function*(r){let n={flags:r.flags,arguments:r.arguments},[o,s]=yield*OX(n,e.orderedParams);if(t?.allowLeftovers!==!0&&o.length>0)return yield*new Up({arguments:o});return Vy(e.tree,s)}),OX,R$=(e,t,r)=>{let n=He(e),o=new Set;((i)=>{for(let a of i){let c=Me(a);for(let l of c)o.add(l.name)}})((r?.contextConfig??n.contextConfig).flags);for(let i of t){let a=He(i);for(let c of a.config.flags){let l=Me(c);for(let u of l)if(o.has(u.name))throw new Ip({option:u.name,parentCommand:e.name,childCommand:i.name})}}};var xc=E(()=>{_n();lt();ae();la();ze();ye();wu();Jn();dc();By();hX={...Pn({label:"Command",evaluate(){return He(this).service}})},OX=z(function*(e,t){let r=[],n=e.arguments;for(let o of t){let[s,i]=yield*o.parse({flags:e.flags,arguments:n});r.push(i),n=s}return[n,r]})});var gX=(e)=>{switch(e.primitiveType._tag){case"Boolean":return{_tag:"Boolean"};case"Integer":return{_tag:"Integer"};case"Float":return{_tag:"Float"};case"Date":return{_tag:"Date"};case"Choice":return{_tag:"Choice",values:Xo(e.primitiveType)??[]};case"Path":return{_tag:"Path",pathType:py(e.primitiveType)??"either"};case"FileText":case"FileParse":case"FileSchema":return{_tag:"Path",pathType:"file"};default:return{_tag:"String"}}},xX=(e)=>{switch(e.primitiveType._tag){case"Integer":return{_tag:"Integer"};case"Float":return{_tag:"Float"};case"Date":return{_tag:"Date"};case"Choice":return{_tag:"Choice",values:Xo(e.primitiveType)??[]};case"Path":return{_tag:"Path",pathType:py(e.primitiveType)??"either"};case"FileText":case"FileParse":case"FileSchema":return{_tag:"Path",pathType:"file"};default:return{_tag:"String"}}},Yy=(e)=>{let r=He(e).config,n=[];for(let i of r.flags){let a=Me(i);for(let c of a){if(c.kind!=="flag")continue;if(c.hidden)continue;n.push({name:c.name,aliases:c.aliases,description:ur(c.description),type:gX(c)})}}let o=[];for(let i of r.arguments){let a=Me(i),c=gr(i);for(let l of a){if(l.kind!=="argument")continue;o.push({name:l.name,description:ur(l.description),required:!c.isOptional,variadic:c.isVariadic,type:xX(l)})}}let s=[];for(let i of e.subcommands)for(let a of i.commands){if(a.unlisted)continue;s.push(Yy(a))}return{name:e.name,description:e.shortDescription??e.description,flags:n,arguments:o,subcommands:s}};var I$=E(()=>{ze();Jn();dc();xc()});var Hy=(e)=>{let t=new Set,r=[];for(let n of e){if(t.has(n))continue;t.add(n),r.push(n)}return r},F$=(e,t)=>{let r=[e],n=e;for(let o=1;o<t.length;o++){let s=t[o],i=void 0;for(let a of n.subcommands)if(i=a.commands.find((c)=>c.name===s),i)break;if(!i)break;r.push(i),n=i}return r},Jy=(e,t,r)=>{let o=F$(e,t).flatMap((s)=>He(s).globalFlags);return Hy([...r,...o])},SX=(e)=>{let t=[],r=(n)=>{let o=He(n);for(let s of o.globalFlags)t.push(s);for(let s of n.subcommands)for(let i of s.commands)r(i)};return r(e),Hy(t)},EX=(e,t)=>{if(e.length<=1)return[];let r=new Set(t.map((o)=>o.name)),n=[];for(let o of e.slice(0,-1)){let s=He(o);for(let i of s.contextConfig.flags){let a=Me(i),c=gr(i);for(let l of a){if(r.has(l.name))continue;if(l.hidden)continue;r.add(l.name),n.push(th(l,c))}}}return n},U$=(e,t)=>Hy([...t,...SX(e)]),rh=(e,t,r)=>We(function*(){let n=F$(e,t),o=n.length>0?n[n.length-1]:e,s=He(o).buildHelpDoc(t),i=EX(n,s.flags),a=Jy(e,t,r),c=[];for(let l of a){let u=Me(l.flag),f=gr(l.flag);for(let d of u){if(d.hidden)continue;c.push({...th(d,f),required:!1})}}return{...s,flags:[...i,...s.flags],globalFlags:c}});var Ky=E(()=>{ae();Jn();xc()});var nh=(e)=>({_tag:"Action",flag:e.flag,run:e.run}),kX=(e)=>(t)=>{D$+=1;let r=rt(`effect/unstable/cli/GlobalFlag/${e}/${D$}`);return Object.assign(r,{_tag:"Setting",id:e,flag:t.flag})},D$=0,PX,wX,eS,TX,yc,M$;var tS=E(()=>{Hp();lt();ae();ze();Dy();v$();Xy();I$();Ky();PX=nh({flag:Uu("help").pipe(Wy("h"),rn("Show help information"),gc(!1)),run:z(function*(e,{builtIns:t,command:r,commandPath:n}){let o=yield*Oc,s=yield*rh(r,n,t);yield*Wt(o.formatHelpDoc(s))})}),wX=nh({flag:Uu("version").pipe(Wy("v"),rn("Show version information"),gc(!1)),run:z(function*(e,{command:t,version:r}){let n=yield*Oc;yield*Wt(n.formatVersion(t.name,r))})}),eS=nh({flag:Uu("wizard").pipe(rn("Start wizard mode for a command"),gc(!1)),run:()=>ue}),TX=nh({flag:Q$("completions",["bash","zsh","fish","sh"]).pipe(Bi,_$((e)=>fa(e,(t)=>t==="sh"?"bash":t)),Ly("<bash|zsh|fish|sh>"),rn("Print shell completion script")),run:z(function*(e,{command:t}){if(Lt(e))return;let r=Yy(t);yield*Wt(T$(t.name,e.value,r))})}),yc=kX("log-level")({flag:C$("log-level",[["all","All"],["trace","Trace"],["debug","Debug"],["info","Info"],["warn","Warn"],["warning","Warn"],["error","Error"],["fatal","Fatal"],["none","None"]]).pipe(Bi,rn("Sets the minimum log level"),Ly("<all|trace|debug|info|warn|warning|error|fatal|none>"))}),M$=[PX,wX,eS,TX,yc]});var oh,vX;var Z$=E(()=>{lt();tS();oh=class oh extends Be("effect/unstable/cli/CliConfig",{defaultValue:()=>vX}){};vX={builtIns:M$}});function W$(e){let t=e.indexOf("--");if(t===-1)return{tokens:q$(e),trailingOperands:[]};return{tokens:q$(e.slice(0,t)),trailingOperands:e.slice(t+1)}}var q$=(e)=>{let t=[];for(let r of e)if(!r.startsWith("-"))t.push({_tag:"Value",value:r});else if(r.startsWith("--")){let n=r.indexOf("=");if(n!==-1){let o=r.slice(2,n),s=r.slice(n+1);t.push({_tag:"LongOption",name:o,raw:r,value:s})}else t.push({_tag:"LongOption",name:r.slice(2),raw:r})}else if(r.length>1){let n=r.slice(1),o=n.indexOf("=");if(o!==-1){let s=n.slice(0,o),i=n.slice(o+1);t.push({_tag:"ShortOption",flag:s,raw:`-${s}`,value:i})}else for(let s of n)t.push({_tag:"ShortOption",flag:s,raw:`-${s}`})}else t.push({_tag:"Value",value:r});return t};var _X=(e,t)=>{let r=e.length,n=t.length,o=Array.from({length:r+1},()=>Array(n+1).fill(0));for(let s=0;s<=r;s++)o[s][0]=s;for(let s=0;s<=n;s++)o[0][s]=s;for(let s=1;s<=r;s++)for(let i=1;i<=n;i++){let a=e[s-1]===t[i-1]?0:1;o[s][i]=Math.min(o[s-1][i]+1,o[s][i-1]+1,o[s-1][i-1]+a)}return o[r][n]},rS=(e,t)=>{let r=t.map((o)=>[_X(e,o),o]).filter(([o])=>o<=2).sort(([o],[s])=>o-s);if(r.length===0)return[];let n=r[0][0];return r.filter(([o])=>o===n).map(([,o])=>o)};var oS=(e)=>er(e.subcommand,{onNone:()=>[],onSome:(t)=>[t.name,...oS(t.parsedInput)]}),sS=(e,t,r=[])=>We(function*(){let{tokens:n,trailingOperands:o}=e,s=[...r,t.name],i=He(t),c=i.config.flags.flatMap(Me).filter(Vi),l=Ec(c),f=i.contextConfig.flags.flatMap(Me).filter(Vi),d=Ec(f),h=new Set(f.map((y)=>y.name)),m={command:t,commandPath:s,flagRegistry:l,inheritedFlagRegistry:d,localFlagNames:c.filter((y)=>!h.has(y.name)).map((y)=>y.name)},b=LX(n,m);if(b._tag==="Leaf")return{flags:b.flags,arguments:[...b.arguments,...o],subcommand:L(),...b.errors.length>0&&{errors:b.errors}};let x={tokens:b.childTokens,trailingOperands:o},O=yield*sS(x,b.sub,s),S=[...b.errors,...O.errors??[]];return{flags:b.flags,arguments:[],subcommand:ee({name:b.sub.name,parsedInput:O}),...S.length>0&&{errors:S}}}),sh=(e)=>{let t=0;return{peek:()=>e[t],take:()=>e[t++],rest:()=>e.slice(t)}},Ec=(e)=>{let t=new Map;for(let r of e){if(t.has(r.name))throw Error(`Duplicate flag name "${r.name}" in command definition`);t.set(r.name,r);for(let n of r.aliases){if(t.has(n))throw Error(`Duplicate flag/alias "${n}" in command definition (conflicts with "${t.get(n).name}")`);t.set(n,r)}}return{params:e,index:t}},X$=(e)=>{let t=new Map,r=(n,o)=>{let s=t.get(n);if(s&&s!==o)throw Error(`Duplicate subcommand name/alias "${n}" in command definition (conflicts with "${s.name}")`);t.set(n,o)};for(let n of e)for(let o of n.commands)if(r(o.name,o),o.alias&&o.alias!==o.name)r(o.alias,o);return t},iS=(e)=>Object.fromEntries(e.map((t)=>[t.name,[]])),$X=(e)=>{let t=iS(e);return{add:(r,n)=>{if(n!==void 0)t[r].push(n)},merge:(r)=>{for(let n in r){let o=r[n];if(o?.length)for(let s=0;s<o.length;s++)t[n].push(o[s])}},snapshot:()=>t}},ih=(e)=>e._tag==="LongOption"||e._tag==="ShortOption",j$=(e)=>e._tag==="LongOption"?e.name:e.flag,Sc=(e,t)=>{let r=j$(e),n=t.index.get(r);if(n&&n.name===r)return{param:n,negated:!1};if(e._tag==="LongOption"&&e.name.startsWith("no-")){let o=e.name.slice(3),s=t.index.get(o);if(s&&s.name===o&&Np(s.primitiveType))return{param:s,negated:!0}}if(n)return{param:n,negated:!1};return},L$=(e,t,r)=>new Sn({option:t.name,value:r,expected:`omit the value and use ${e.raw} by itself to set --${t.name} to false`,kind:"flag"}),AX=(e)=>{let t=Xo(e.primitiveType);return new Sn({option:e.name,value:"",expected:t===void 0?e.typeName??Tu(e.primitiveType):t.join(" | "),kind:"flag"})},z$=(e)=>e?._tag==="Value"&&(p_(e.value)||h_(e.value))?e.value:void 0,V$=(e,t,r,n=!1)=>{let o=Mu(e,t,r,n);switch(o._tag){case"Value":return{_tag:"Value",value:o.value};case"Error":return{_tag:"Error",error:o.error}}},Mu=(e,t,r,n=!1)=>{if(n){if(t.value!==void 0)return{_tag:"Error",error:L$(t,r,t.value),tokens:[]};let s=z$(e.peek());if(s!==void 0){let i=e.take();return{_tag:"Error",error:L$(t,r,s),tokens:i===void 0?[]:[i]}}return{_tag:"Value",value:"false",tokens:[]}}if(t.value!==void 0)return{_tag:"Value",value:t.value,tokens:[]};if(Np(r.primitiveType)){let s=z$(e.peek()),i=s!==void 0?e.take():void 0;return{_tag:"Value",value:s??"true",tokens:i===void 0?[]:[i]}}let o=e.peek();if(o?._tag==="Value"){let s=e.take();return{_tag:"Value",value:o.value,tokens:s===void 0?[]:[s]}}return{_tag:"Error",error:AX(r),tokens:[]}},RX=(e,t)=>{let r=iS(t.params),n=[],o=[],s=sh(e);for(let i=s.take();i;i=s.take()){if(!ih(i)){n.push(i);continue}let a=Sc(i,t);if(!a){n.push(i);continue}let c=V$(s,i,a.param,a.negated);if(c._tag==="Error"){o.push(c.error);continue}if(c.value!==void 0)r[a.param.name].push(c.value)}return{flagMap:r,remainder:n,errors:o}},IX=(e)=>He(e).config.flags.flatMap(Me).filter(Vi),FX=(e)=>He(e).contextConfig.flags.flatMap(Me).filter(Vi),B$=(e,t)=>{for(let r of t){let n=Sc(e,r);if(n!==void 0)return n}return},nS=(e,t,r,n)=>{e.push(r);let o=Mu(t,r,n.param,n.negated);e.push(...o.tokens)},UX=(e,t,r,n,o)=>{let s=sh(t);Mu(s,e,r.param,r.negated);for(let i=s.take();i;i=s.take()){if(ih(i)){let a=B$(i,o);if(a!==void 0)Mu(s,i,a.param,a.negated);continue}if(i._tag==="Value")return n.has(i.value)}return!1},G$=(e,t,r)=>{let n=iS(r.params),o=[],s=(i,a,c)=>{let l=Ec(IX(a)),u=Ec(FX(a)),f=X$(a.subcommands),d=sh(i),h=[],m=!0;for(let b=d.take();b;b=d.take()){if(ih(b)){let x=B$(b,c);if(x!==void 0){nS(h,d,b,x);continue}let O=Sc(b,u);if(O!==void 0){nS(h,d,b,O);continue}let S=Sc(b,l),y=Sc(b,r);if(S!==void 0){if(y===void 0||!m||!UX(b,d.rest(),S,f,[l,u,r])){nS(h,d,b,S);continue}}if(y!==void 0){let g=Mu(d,b,y.param,y.negated);if(g._tag==="Error"){o.push(g.error);continue}if(g.value!==void 0)n[y.param.name].push(g.value);continue}h.push(b);continue}if(b._tag==="Value"&&m){let x=f.get(b.value);if(x!==void 0)return h.push(b),h.push(...s(d.rest(),x,[...c,u])),h;m=!1}h.push(b)}return h};return{flagMap:n,remainder:s(e,t,[]),errors:o}},DX=(e,t,r)=>{let n=e._tag==="LongOption"?`--${e.name}`:`-${e.flag}`,o=[];for(let i of t){if(i.hidden)continue;if(o.push(i.name),Np(i.primitiveType))o.push(`no-${i.name}`);for(let a of i.aliases)o.push(a)}let s=rS(j$(e),o).map((i)=>i.length===1?`-${i}`:`--${i}`);return new Mi({option:n,suggestions:s,command:r})},MX=(e)=>({flags:$X(e.params),arguments:[],errors:[],mode:{_tag:"AwaitingFirstValue"}}),NX=(e)=>({_tag:"Leaf",flags:e.flags.snapshot(),arguments:e.arguments,errors:e.errors}),ZX=(e,t,r,n)=>{let{command:o,commandPath:s,inheritedFlagRegistry:i,localFlagNames:a}=r,c=X$(o.subcommands),l=c.get(e);if(l){let f=[...s,l.name],d=n.flags.snapshot();for(let m of a){let b=d[m];if(b!==void 0&&b.length>0)n.errors.push(new Mi({option:`--${m}`,suggestions:[],command:f}))}let h=RX(t.rest(),i);return n.flags.merge(h.flagMap),n.errors.push(...h.errors),{_tag:"Subcommand",result:{_tag:"Sub",flags:n.flags.snapshot(),sub:l,childTokens:h.remainder,errors:n.errors}}}if(!(He(o).config.arguments.length>0)&&c.size>0){let f=[];for(let[h,m]of c)if(!m.unlisted)f.push(h);let d=rS(e,f);n.errors.push(new Dp({subcommand:e,parent:s,suggestions:d}))}return{_tag:"Argument"}},qX=(e,t,r,n)=>{let{commandPath:o,flagRegistry:s}=r,i=Sc(e,s);if(!i){n.errors.push(DX(e,s.params,o));return}let a=V$(t,e,i.param,i.negated);if(a._tag==="Error"){n.errors.push(a.error);return}n.flags.add(i.param.name,a.value)},WX=(e,t,r,n)=>{if(n.mode._tag==="AwaitingFirstValue"){let o=ZX(e,t,r,n);if(o._tag==="Subcommand")return o.result;n.mode={_tag:"CollectingArguments"}}n.arguments.push(e);return},LX=(e,t)=>{let r=sh(e),n=MX(t.flagRegistry);for(let o=r.take();o;o=r.take()){if(ih(o)){qX(o,r,t,n);continue}if(o._tag==="Value"){let s=WX(o.value,r,t,n);if(s)return s}}return NX(n)};var Y$=E(()=>{ae();ze();wu();Jn();dc();xc()});var K$,XX=(e,t)=>{let r=e;for(let n of t.slice(1)){let o=r.subcommands.flatMap((s)=>s.commands).find((s)=>s.name===n||s.alias===n);if(o===void 0)break;r=o}return r},e1,jX=(e)=>e.subcommands.some((r)=>r.commands.some((n)=>!n.unlisted))||He(e).config.orderedParams.length>0,H$,VX=(e)=>{let t=GX(e);switch(e.primitiveType._tag){case"Boolean":return K(Or(Oy({message:t,label:{confirm:"true",deny:"false"},placeholder:{defaultConfirm:"(T/f)",defaultDeny:"(t/F)"}})),(r)=>Kn(String(r)));case"Choice":{let r=Xo(e.primitiveType)??[];return K(Or(xy({message:t,choices:r.map((n)=>({title:n,value:n}))})),Kn)}case"Date":return K(Or(I_({message:t})),(r)=>Kn(r.toISOString()));case"Float":return K(Or(F_({message:t})),(r)=>Kn(String(r)));case"Integer":return K(Or(gy({message:t})),(r)=>Kn(String(r)));case"Redacted":return K(Or(U_({message:t})),(r)=>Kn(dv(r),"<redacted>"));default:return K(Or(D_({message:t})),Kn)}},Kn=(e,t=e)=>({value:e,displayValue:t}),BX=(e)=>e.kind===Hn?`--${e.name}`:e.name,GX=(e)=>aS(e),aS=(e)=>{let t=ur(e.description)?.trim(),r=e.kind===Hn&&t!==void 0&&t.length<=32?t:YX(e.name);return e.kind===Hn?`${r} (${BX(e)})`:r},YX=(e)=>{let t=e.split(/[-_]+/).filter((r)=>r.length>0);if(t.length===0)return e;return[t[0][0].toUpperCase()+t[0].slice(1),...t.slice(1)].join(" ")},ah=(e)=>Wt(o1("Current command",e.map((t)=>t.displayValue),b_)),J$=(e,t)=>`${De(e.toUpperCase(),jo,pc)} ${De("\xB7",Qu)} ${De(t,jo,qi)}`,t1=(e,t,r)=>[`${De(e,jo,pc)} ${De(`v${t}`,qi)} ${De("\xB7 Command wizard",jo,qi)}`,...r===void 0||r.length===0?[]:[r],De("Build a command interactively. Press Ctrl+C to cancel.",Qu),""].join(`
|
|
108
|
+
`),r1=(e)=>o1("Command ready",e,pc,Lp),n1=()=>`
|
|
109
|
+
${De("Wizard cancelled.",Wp)}`,o1=(e,t,r,n=qi)=>{let o=HX(t);return[De(e,jo,n),...o.map((s)=>De(s,r)),""].join(`
|
|
110
|
+
`)},HX=(e)=>{let o=e.map(JX),s=[],i=" $ ";for(let a of o){let c=i===" $ "||i===" "?"":" ";if(i.length+c.length+a.length>88&&i!==" $ ")s.push(`${i} \\`),i=` ${a}`;else i+=`${c}${a}`}if(i!==" $ ")s.push(i);return s},JX=(e)=>/^[A-Za-z0-9_./:@%+=,-]+$/.test(e)?e:`'${e.replaceAll("'",`'"'"'`)}'`;var s1=E(()=>{Hp();ae();ze();vg();Jn();dc();vy();xc();K$=z(function*(e,t){let r=t?.commandPath??[e.name],n=XX(e,r),o=(t?.prefix??r).map((s)=>Kn(s));return yield*ah(o),yield*e1(n,o,n===e?"ROOT":n.name),{args:o.map((s)=>s.value),displayArgs:o.map((s)=>s.displayValue)}}),e1=z(function*(e,t,r){let n=He(e),o=e.subcommands.flatMap((a)=>a.commands.filter((c)=>!c.unlisted)),s=o.length===0?n.config:n.contextConfig;if(s.flags.length>0){yield*Wt(J$(r,"FLAGS"));for(let a of s.flags)t.push(...yield*H$(a));if(s.arguments.length>0||o.length>0)yield*ah(t)}if(s.arguments.length>0){yield*Wt(J$(r,"ARGUMENTS"));for(let a of s.arguments)t.push(...yield*H$(a));if(o.length>0)yield*ah(t)}if(o.length===0)return;let i=yield*Or(xy({message:"Command",choices:o.map((a)=>({title:a.name,value:a,...a.shortDescription!==void 0?{description:a.shortDescription}:a.description!==void 0?{description:a.description}:{}}))}));if(yield*Wt(),t.push(Kn(i.name)),jX(i))yield*ah(t);yield*e1(i,t,i.name)}),H$=z(function*(e){let t=Bp(e),r=gr(e);if(r.isOptional){if(!(yield*Or(Oy({message:`Set ${aS(t)}?`,initial:!1}))))return yield*Wt(),[]}let n=!r.isVariadic?1:yield*Or(gy({message:`${aS(t)} count`,default:bt(r.variadicMin,()=>0),min:bt(r.variadicMin,()=>0),...tt(r.variadicMax)?{max:r.variadicMax.value}:{}})),o=[];for(let i=0;i<n;i++)o.push(yield*VX(t));let s=t.kind===Hn?{flags:{[t.name]:o.map((i)=>i.value)},arguments:[]}:{flags:{},arguments:o.map((i)=>i.value)};if(yield*e.parse(s),yield*Wt(),t.kind===_u)return o;return o.flatMap((i)=>[Kn(`--${t.name}`),i])})});var e5=(e)=>G(e,Du),ch=(e,t,r)=>{let n=jy(t??{});return eh({name:e,config:n,...wt(r)?{handle:r}:{}})},t5=(e)=>{let t=[],r=new Map,n=(i,a)=>{t.push(a);let c=r.get(i);if(c)c.push(a);else r.set(i,[a])};for(let i of e){if(e5(i)){n(void 0,i);continue}for(let a of i.commands)n(i.group,a)}let o=[],s=r.get(void 0);if(s&&s.length>0)o.push({group:void 0,commands:s});for(let[i,a]of r){if(i===void 0)continue;o.push({group:i,commands:a})}return{flat:t,groups:o}},r5,lh,n5=(e,t,r,n)=>{let o=new Set(t),s=[],i=new Set;for(let a of e){if(o.has(a))continue;let c=Me(a.flag);for(let l of c){let u=r[l.name];if(!u||u.length===0)continue;let f=`--${l.name}`;if(i.has(f))continue;i.add(f),s.push(new Mi({option:f,suggestions:[],command:n}))}}return s},o5=(e,t,r)=>We(function*(){let{builtIns:n}=yield*oh,o=yield*Oc,s=yield*rh(e,t.commandPath,n);if(yield*Wt(o.formatHelpDoc(s)),r&&t.errors.length>0)yield*Iy(o.formatErrors(t.errors))}),s5=(e)=>We(function*(){let t=yield*Oc;yield*Iy(t.formatError(e)),e[Oi]=!1}),i5,i1=(e,t)=>{let r=He(e);return z(function*(n){let{builtIns:o}=yield*oh,{tokens:s,trailingOperands:i}=W$(n),a=U$(e,o),c=a.flatMap((w)=>Me(w.flag)),l=Ec(c.filter(Vi)),{flagMap:u,remainder:f,errors:d}=G$(s,e,l),h={flags:u,arguments:[]},m=yield*sS({tokens:f,trailingOperands:i},e),b=[e.name,...oS(m)],x={builtIns:o,command:e,commandPath:b,version:t.version},O=Jy(e,b,o),S=n5(a,O,u,b);if(S.length>0||d.length>0){let w=m.errors??[];return yield*new Ls({commandPath:b,errors:[...d,...S,...w]})}for(let w of O){if(w._tag!=="Action")continue;if(!Me(w.flag).some((R)=>{let A=u[R.name];return A!==void 0&&A.length>0}))continue;let[,F]=yield*w.flag.parse(h);if(w===eS)return yield*We(function*(){yield*Wt(t1(e.name,t.version,e.description));let R=[e.name,...n.filter((j)=>j!=="--wizard"&&!j.startsWith("--wizard="))],A=yield*K$(e,{commandPath:b,prefix:R});if(yield*Wt(r1(A.displayArgs)),yield*Or(M_({message:"Run this command?",initial:!0,active:"yes",inactive:"no"})))yield*Wt(),yield*i1(e,{...t,renderErrors:!1})(A.args.slice(1))}).pipe(wa("QuitError",()=>Wt(n1())));yield*w.run(F,x);return}if(m.errors&&m.errors.length>0)return yield*new Ls({commandPath:b,errors:m.errors});let y=yield*Qk(r.parse(m));if(y._tag==="Failure")return yield*new Ls({commandPath:b,errors:[y.failure]});let g=r.handle(y.success,[e.name]),C=O.includes(yc)?(yield*yc.flag.parse(h))[1]:L();g=hi(g,yc,C);for(let w of O){if(w._tag!=="Setting"||w===yc)continue;let[,_]=yield*w.flag.parse(h);g=hi(g,w,_)}let Q=er(C,{onNone:()=>Tn(),onSome:(w)=>ho(hk,w)});yield*ys(g,Q)},Vf((n)=>fy(n)&&n._tag==="ShowHelp"?gt(n):ut(n),(n)=>an(o5(e,n,t.renderErrors!==!1),N(n))),Vf((n)=>t.renderErrors!==!1&&fy(n)&&n._tag==="UserError"?gt(n):ut(n),(n)=>an(s5(n),N(n))),Vf((n)=>_v(n)?gt(n):ut(n),(n)=>Yf))};var c1=E(()=>{Hp();lt();ae();oe();ze();ye();mk();Oo();ed();bg();ep();Z$();wu();Dy();tS();xc();By();Ky();Y$();s1();Jn();vy();r5=v(2,(e,t)=>{let r=t5(t);R$(e,r.flat);let n=He(e),o=new Map(r.flat.map((c)=>[c.name,He(c)])),s=Symbol("effect/cli/SubcommandState"),i=z(function*(c){if(Lt(c.subcommand))return yield*n.parse(c);let l=o.get(c.subcommand.value.name);if(!l)return yield*n.parse(c);let u=yield*n.parseContext(c),f=yield*l.parse(c.subcommand.value.parsedInput);return{...u,[s]:{name:l.name,result:f}}}),a=z(function*(c,l){let f=c[s];if(f){let d=o.get(f.name);if(!d)return yield*new Ls({commandPath:l,errors:[]});return yield*d.handle(f.result,[...l,d.name]).pipe(hi(n.service,c))}return yield*n.handle(c,l)});return eh({name:n.name,config:n.config,contextConfig:n.contextConfig,description:n.description,shortDescription:n.shortDescription,alias:n.alias,unlisted:n.unlisted,annotations:n.annotations,globalFlags:n.globalFlags,examples:n.examples,service:n.service,subcommands:r.groups,parse:i,parseContext:n.parseContext,handle:a})}),lh=v(2,(e,t)=>eh({...He(e),description:t})),i5=v(2,(e,t)=>Xd.use(({args:r})=>H(r,(n)=>i1(e,t)(n))))});var l1=E(()=>{f$();c1();Xy()});var u1=(e)=>{let t=e?.trim();return t===void 0||t.length===0?void 0:t},f1=()=>({bunExecutable:u1(process.env.TRIPWIRE_BUN),forcePortable:process.env.TRIPWIRE_FORCE_PORTABLE==="1",packageDist:u1(process.env.TRIPWIRE_PACKAGE_DIST)}),d1=()=>({...process.env});var cS=()=>{};import{lstat as x1,mkdir as a5,open as c5,readFile as Nu,readlink as l5,realpath as u5,rename as y1,rm as uh,stat as f5,symlink as p1}from"fs/promises";import{homedir as qu}from"os";import Gi from"path";import{fileURLToPath as h1}from"url";var m1,S1,eo=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e),bc=(e,t)=>e instanceof Error&&("code"in e)&&e.code===t,Zu=async(e,t,r={})=>{let n=e,o=!1;try{o=(await x1(e)).isSymbolicLink()}catch(c){if(!bc(c,"ENOENT"))throw c}if(o)n=await u5(e);let s=`${n}.${process.pid}.next`,i,a=384;try{a=(await f5(n)).mode&4095}catch(c){if(!bc(c,"ENOENT"))throw c}await uh(s,{force:!0});try{i=await c5(s,"wx",a),await i.writeFile(t,"utf8"),await i.chmod(a),await i.sync(),await i.close(),i=void 0,await r.beforeRename?.(s,n),await y1(s,n)}finally{try{if(i!==void 0)await i.close()}finally{await uh(s,{force:!0})}}},d5=(e)=>eo(e)&&typeof e.type==="string"&&typeof e.command==="string"&&(e.timeout===void 0||typeof e.timeout==="number"),O1=(e)=>Array.isArray(e)&&e.every((t)=>eo(t)&&Array.isArray(t.hooks)&&t.hooks.every(d5)),p5=(e)=>{if(!eo(e))return!1;let{hooks:t}=e;if(t===void 0)return!0;return eo(t)&&(t.PreToolUse===void 0||O1(t.PreToolUse))&&(t.PostToolUse===void 0||O1(t.PostToolUse))},lS=(e,t)=>{let r=JSON.parse(e);if(!p5(r))throw Error(`${t} hook config has an unsupported shape`);return r},h5=(e)=>{let t=JSON.parse(e);if(!eo(t))throw Error("Cursor hooks.json must contain a JSON object");let{hooks:r}=t;if(r===void 0)return t;if(!eo(r))throw Error("Cursor hooks.json `hooks` must be an object");for(let[n,o]of Object.entries(r))if(!Array.isArray(o)||o.some((s)=>!eo(s)||typeof s.command!=="string"))throw Error(`Cursor hooks.json event ${n} must contain command hooks`);return t},Yi="tripwire-hook",E1=async(e,t)=>{await a5(Gi.dirname(t),{recursive:!0});try{if(!(await x1(t)).isSymbolicLink())return{action:"already",success:!1};let n=await l5(t);if(n===e)return{action:"already",success:!0};let o=Gi.resolve(Gi.dirname(t),n);if(Gi.basename(o)!=="tripwire-pi.js")return{action:"already",success:!1};let s=`${t}.${process.pid}.next`;await uh(s,{force:!0});try{await p1(e,s),await y1(s,t)}finally{await uh(s,{force:!0})}return{action:"updated",success:!0}}catch(r){if(!(r instanceof Error&&("code"in r)&&r.code==="ENOENT"))throw r;return await p1(e,t),{action:"installed",success:!0}}},m5,O5,fh=(e)=>e===Yi||e.startsWith(`${Yi} `)||e.includes("/tripwire-darwin-arm64/")||e.includes("/tripwire-hook")||e.includes("/tripwire.js")||e.includes("/dist/tripwire"),g5=(e,t,r=Yi)=>{let n=O5.has(t),o={command:`${r} --cursor-event ${t}`,...n&&{failClosed:!0}};if(e===void 0)return[[o],!0];let s=!1,i=e.some((l)=>fh(l.command)),a=`${r} --cursor-event ${t}`,c=e.map((l)=>{if(!fh(l.command))return l;if(l.command===a&&(!n||l.failClosed===!0))return l;return s=!0,{...l,command:a,...n&&{failClosed:!0}}});if(i)return[c,s];return[[...c,o],!0]},dh=(e,t=Yi)=>{if(!e)return[[{hooks:[{type:"command",command:t}]}],!1];let r=!1,n=e.map((i)=>({...i,hooks:i.hooks.map((a)=>{if(fh(a.command)){if(a.command!==t)return r=!0,{...a,command:t};return a}return a})}));if(n.some((i)=>i.hooks.some((a)=>a.command===t)))return[n,!r];return[[...n,{hooks:[{type:"command",command:t}]}],!1]},uS=async(e={})=>{let t=e.homeDirectory??qu(),r=e.hookCommand??Yi,n=`${t}/.claude/settings.json`;try{let o=await Nu(n,"utf8"),s=lS(o,"Claude");s.hooks??={};let[i,a]=dh(s.hooks.PreToolUse,r),[c,l]=dh(s.hooks.PostToolUse,r);if(s.hooks.PreToolUse=i,s.hooks.PostToolUse=c,a&&l)return{success:!0,message:`Already configured: ${n}`};return await Zu(n,`${JSON.stringify(s,null,2)}
|
|
111
|
+
`),{success:!0,message:`Updated ${n}`}}catch(o){if(bc(o,"ENOENT"))return{success:!1,message:`Config file not found: ${n}`};return{success:!1,message:`Failed to update Claude config: ${o instanceof Error?o.message:String(o)}`}}},fS=async(e={})=>{let t=e.homeDirectory??qu(),r=`${t}/.pi/agent/settings.json`,n=`${t}/.pi/agent/extensions/tripwire.js`;try{let o=e.extensionSource??S1.find((f)=>Bun.file(f).size>0);if(o===void 0)return{success:!1,message:"Built Pi extension not found; run `bun run build` first"};let s=await Nu(r,"utf8"),i=lS(s,"Pi");if(i.hooks!==void 0){let{PreToolUse:f,PostToolUse:d,...h}=i.hooks,m=(S)=>S?.map((y)=>({...y,hooks:y.hooks.filter((g)=>!fh(g.command))})).filter((y)=>y.hooks.length>0)??[],b=m(f),x=m(d),O={...h,...b.length>0&&{PreToolUse:b},...x.length>0&&{PostToolUse:x}};if(Object.keys(O).length===0){let{hooks:S,...y}=i;i=y}else i.hooks=O}let a=`${JSON.stringify(i,null,2)}
|
|
112
|
+
`,c=a!==s,l=await E1(o,n);if(!l.success)return{success:!1,message:`Refusing to replace existing Pi extension: ${n}`};if(c)await Zu(r,a);if(l.action==="already"&&!c)return{success:!0,message:`Already configured: ${n}`};return{success:!0,message:`${l.action==="updated"?"Updated":"Installed"} ${n}`}}catch(o){if(bc(o,"ENOENT"))return{success:!1,message:`Config file not found: ${r}`};return{success:!1,message:`Failed to update pi config: ${o instanceof Error?o.message:String(o)}`}}},dS=async(e={})=>{let r=`${e.homeDirectory??qu()}/.omp/agent/extensions/tripwire.js`;try{let n=e.extensionSource??S1.find((i)=>Bun.file(i).size>0);if(n===void 0)return{success:!1,message:"Built Pi extension not found; run `bun run build` first"};let o=await E1(n,r);if(!o.success)return{success:!1,message:`Refusing to replace existing oh-my-pi extension: ${r}`};if(o.action==="already")return{success:!0,message:`Already configured: ${r}`};return{success:!0,message:`${o.action==="updated"?"Updated":"Installed"} ${r}`}}catch(n){return{success:!1,message:`Failed to install oh-my-pi extension: ${n instanceof Error?n.message:String(n)}`}}},g1=(e)=>{let t=Bun.TOML.parse(e),r=eo(t)?t.features:void 0;if(r!==void 0&&!eo(r))throw Error("Codex config.toml `features` must be a table");return r},x5=(e)=>{if(g1(e)?.hooks===!0)return e;let t=e.includes(`\r
|
|
130
113
|
`)?`\r
|
|
131
114
|
`:`
|
|
132
|
-
`,
|
|
115
|
+
`,r=/^[\t ]*\[features\][\t ]*(?:#.*)?(?:\r?\n|$)/mu.exec(e),n;if(r===null){let o=e.length===0||e.endsWith(`
|
|
133
116
|
`)?"":t,s=e.length===0||e.endsWith(`
|
|
134
|
-
`)?t:"";
|
|
135
|
-
`)?`hooks = true${t}`:`${t}hooks = true`;
|
|
136
|
-
`,d=
|
|
137
|
-
`),{success:!0,message:`Updated ${
|
|
138
|
-
`);process.exitCode=yield*
|
|
139
|
-
`),process.exit(1)}let
|
|
140
|
-
`)}),
|
|
117
|
+
`)?t:"";n=`${e}${o}[features]${t}hooks = true${s}`}else{let o=r.index+r[0].length,s=/^[\t ]*\[/gmu;s.lastIndex=o;let a=s.exec(e)?.index??e.length,c=e.slice(o,a),l=/^(?<prefix>[\t ]*hooks[\t ]*=[\t ]*)(?<value>[^#\r\n]*?)(?<suffix>[\t ]*(?:#.*)?)$/mu.exec(c);if(l===null){let f=r[0].endsWith(`
|
|
118
|
+
`)?`hooks = true${t}`:`${t}hooks = true`;n=`${e.slice(0,o)}${f}${e.slice(o)}`}else{let u=l.groups?.prefix,f=l.groups?.value;if(u===void 0||f===void 0)throw Error("Could not locate Codex hooks value in config.toml");let d=o+l.index+u.length,h=d+f.length;n=`${e.slice(0,d)}true${e.slice(h)}`}}if(g1(n)?.hooks!==!0)throw Error("Could not enable Codex hooks in config.toml");return n},pS=async(e={})=>{let t=e.homeDirectory??qu(),r=e.hookCommand??Yi,n=`${t}/.codex/config.toml`,o=`${t}/.codex/hooks.json`;try{let[s,i]=await Promise.all([Nu(o,"utf8"),Nu(n,"utf8")]),a=lS(s,"Codex");a.hooks??={};let[c]=dh(a.hooks.PreToolUse,r),[l]=dh(a.hooks.PostToolUse,r),u=(b)=>b.map((x)=>({...x,hooks:x.hooks.map((O)=>O.command===r&&O.timeout===void 0?{...O,timeout:10}:O)}));a.hooks.PreToolUse=u(c),a.hooks.PostToolUse=u(l);let f=`${JSON.stringify(a,null,2)}
|
|
119
|
+
`,d=x5(i),h=f!==s,m=d!==i;if(h)await Zu(o,f);if(m)await Zu(n,d);if(!h&&!m)return{success:!0,message:`Already configured: ${n} and ${o}`};return{success:!0,message:`Updated ${n} and ${o}`}}catch(s){if(bc(s,"ENOENT"))return{success:!1,message:`Config file not found: ${eo(s)&&typeof s.path==="string"?s.path:`${n} or ${o}`}`};return{success:!1,message:`Failed to update Codex config: ${s instanceof Error?s.message:String(s)}`}}},hS=async(e={})=>{let t=e.homeDirectory??qu(),r=e.hookCommand??Yi,n=`${t}/.cursor/hooks.json`;try{let o=await Nu(n,"utf8"),s=h5(o);s.version??=1,s.hooks??={};let i=!1;for(let a of m5){let[c,l]=g5(s.hooks[a],a,r);s.hooks[a]=c,i||=l}if(!i)return{success:!0,message:`Already configured: ${n}`};return await Zu(n,`${JSON.stringify(s,null,2)}
|
|
120
|
+
`),{success:!0,message:`Updated ${n}`}}catch(o){if(bc(o,"ENOENT"))return{success:!1,message:`Config file not found: ${n}`};return{success:!1,message:`Failed to update Cursor hooks.json: ${o instanceof Error?o.message:String(o)}`}}},b1=async(e={})=>[{target:"claude",...await uS(e)},{target:"codex",...await pS(e)},{target:"cursor",...await hS(e)},{target:"pi",...await fS(e)},{target:"oh-my-pi",...await dS(e)}];var k1=E(()=>{cS();({packageDist:m1}=f1()),S1=[...m1===void 0?[]:[Gi.join(m1,"tripwire-pi.js")],Gi.join(Gi.dirname(process.execPath),"tripwire-pi.js"),h1(new URL("../../dist/tripwire-pi.js",import.meta.url)),h1(new URL("tripwire-pi.js",import.meta.url))],m5=["preToolUse","postToolUse","beforeShellExecution","afterShellExecution","beforeReadFile","afterFileEdit"],O5=new Set(["preToolUse","beforeShellExecution","beforeReadFile"])});import{readFile as y5}from"fs/promises";var kc,S5=(e)=>xt({try:()=>new TextDecoder("utf-8",{fatal:!0}).decode(e),catch:()=>new kc({message:"The checked script is not valid UTF-8, so Tripwire cannot parse it."})}),E5=(e)=>pi({try:()=>y5(e),catch:(t)=>new kc({message:`Tripwire could not read the checked script: ${String(t)}`})}),b5=()=>hp().pipe(H((e)=>e.ok?T(e.config):N(new kc({message:`Tripwire configuration failed to load: ${e.error}`})))),k5=(e,t)=>pi({try:async()=>{let r=Bun.spawn(["/bin/bash","-s","--",...t],{cwd:process.cwd(),env:d1(),stderr:"inherit",stdin:"pipe",stdout:"inherit"});return await r.stdin.write(e),await r.stdin.end(),r.exited},catch:(r)=>new kc({message:`Tripwire could not start the checked script: ${String(r)}`})}),P1=(e,t)=>We(function*(){let n=yield*E5(e),o=yield*S5(n),s=yield*b5(),i=r_(o,s,{cwd:process.cwd(),positionalArguments:t});if(i.kind==="deny"||i.kind==="ask")return yield*new kc({message:`[tripwire:${i.rule}] ${i.message}`});if(i.kind==="warn")process.stderr.write(`[tripwire:${i.rule}] ${i.message}
|
|
121
|
+
`);return process.exitCode=yield*k5(n,t),yield*ue});var w1=E(()=>{Zn();cy();px();cS();kc=class kc extends Fr("CheckedScriptError"){}});import T1 from"path";var v1=()=>{if(/(?:^|[/\\])bun(?:\.exe)?$/iu.test(process.execPath)){let t=import.meta.filename;if(T1.basename(t)==="tripwire.js")return[process.execPath,t,"--tripwire-hook"];let r=T1.join(import.meta.dirname,"..","main.ts");return[process.execPath,r,"--tripwire-hook"]}return[process.execPath,"--tripwire-hook"]},P5=(e)=>/^[A-Za-z0-9_/:=.,+@%-]+$/u.test(e)?e:`'${e.replaceAll("'",String.raw`'\''`)}'`,w5=()=>v1().map((e)=>P5(e)).join(" "),T5=(e,t,r,n)=>{if(e==="Bash")return{command:t??""};if(e==="Read")return{file_path:r??""};if(e==="Write")return{file_path:r??"",content:n??""};if(e==="Edit"||e==="MultiEdit")return{file_path:r??"",old_string:"",new_string:n??""};return null},v5=(e)=>{let{tool:t,post:r,command:n,path:o,stdout:s,stderr:i,content:a}=e,c=r?"PostToolUse":"PreToolUse",l=T5(t,n,o,a),u={hook_event_name:c,tool_name:t,cwd:process.cwd(),session_id:"tripwire-cli-test",...l!==null&&{tool_input:l}};if(r)u.tool_response=t==="Bash"?{stdout:s??"",stderr:i??""}:{content:a??""};return u},C5=(e)=>{try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}},Q5=(e)=>ne(()=>{let{command:t,content:r,path:n,post:o,stderr:s,stdout:i,tool:a}=e,c=v5({tool:a,post:o,command:t,path:n,stdout:i,stderr:s,content:r}),l=Bun.spawnSync(v1(),{stdin:new TextEncoder().encode(JSON.stringify(c)),timeout:1e4,stdout:"pipe",stderr:"pipe"});if(l.exitCode!==0){let f=new TextDecoder().decode(l.stderr);process.stderr.write(`error: ${f}
|
|
122
|
+
`),process.exit(1)}let u=new TextDecoder().decode(l.stdout);process.stdout.write(`${C5(u)}
|
|
123
|
+
`)}),_5,$5=(e)=>We(function*(){if(!["claude","codex","cursor","pi","oh-my-pi","omp","all"].includes(e))process.stderr.write(`error: unknown target "${e}"
|
|
141
124
|
`),process.stderr.write(`Valid targets: claude, codex, cursor, pi, oh-my-pi, all
|
|
142
|
-
`),process.exit(1);let n
|
|
125
|
+
`),process.exit(1);let r,n={hookCommand:w5()};switch(e){case"claude":{r=[{target:"claude",result:yield*gs(()=>uS(n))}];break}case"codex":{r=[{target:"codex",result:yield*gs(()=>pS(n))}];break}case"pi":{r=[{target:"pi",result:yield*gs(()=>fS(n))}];break}case"oh-my-pi":case"omp":{r=[{target:"oh-my-pi",result:yield*gs(()=>dS(n))}];break}case"cursor":{r=[{target:"cursor",result:yield*gs(()=>hS(n))}];break}case"all":{r=(yield*gs(()=>b1(n))).map((i)=>({target:i.target,result:i}));break}default:{r=[];break}}let o=!1;for(let{target:s,result:i}of r)if(i.success){let a=i.message.startsWith("Already configured")?"\u2299":"\u2713";process.stdout.write(`${a} [${s}] ${i.message}
|
|
143
126
|
`)}else process.stderr.write(`\u2717 [${s}] ${i.message}
|
|
144
|
-
`),o=!0;if(o)process.exit(1)}),
|
|
145
|
-
`),process.exitCode=1}};var
|
|
146
|
-
`);else{
|
|
127
|
+
`),o=!0;if(o)process.exit(1)}),A5,R5,I5,F5,U5,D5,C1=async()=>{try{await Dk(D5.pipe(Fk(aD)))}catch(e){let t=e instanceof Error?e.message:String(e);process.stderr.write(`${t}
|
|
128
|
+
`),process.exitCode=1}};var Q1=E(async()=>{Ng();Zn();l1();hh();k1();w1();_5=ch("test",{command:Gp("command").pipe(Xz,Yp("Command to test (for Bash tool)")),content:Fu("content").pipe(Bi,rn("Content for Write/Edit tools")),path:Fu("path").pipe(Bi,rn("File path for Read/Write/Edit tools")),post:Uu("post").pipe(gc(!1),rn("Test PostToolUse instead of PreToolUse")),stderr:Fu("stderr").pipe(Bi,rn("Stderr for PostToolUse Bash")),stdout:Fu("stdout").pipe(Bi,rn("Stdout for PostToolUse Bash")),tool:Fu("tool").pipe(gc("Bash"),rn("Tool name (Bash, Read, Write, Edit, MultiEdit)"))},({command:e,content:t,path:r,post:n,stderr:o,stdout:s,tool:i})=>Q5({command:ur(e),content:ur(t),path:ur(r),post:n,stderr:ur(o),stdout:ur(s),tool:i})).pipe(lh("Test a synthetic hook event")),A5=ch("install",{target:Gp("target").pipe(Yp("Target agent (claude, codex, cursor, pi, oh-my-pi, or all)"))},({target:e})=>$5(e)).pipe(lh("Install tripwire hooks for AI agents")),R5=Gp("script").pipe(Yp("Bash script file to inspect and execute from the checked bytes")),I5=Gp("argument").pipe(jz(),Yp("Arguments passed to the script after --")),F5=ch("run-script",{script:R5,trailingArguments:I5},({script:e,trailingArguments:t})=>P1(e,t)).pipe(lh("Inspect one script snapshot, then execute those exact bytes with Bash")),U5=ch("tripwire").pipe(lh("Opinionated hooks dispatcher for AI coding agents"),r5([_5,A5,F5])),D5=i5(U5,{version:Wu.version})});var _1=async()=>{await Q1();await C1()};var $1=async()=>{};hh();import M5 from"path";var N5="--tripwire-hook",Z5="--tripwire-force-cli",A1=process.argv.indexOf(Z5,2),R1=A1!==-1;if(R1)process.argv.splice(A1,1);var ph=process.argv.slice(2),q5=M5.basename(process.argv0),W5=!R1&&(q5==="tripwire-hook"||ph.includes(N5)||ph.some((e)=>e.startsWith("--cursor-event")));if(W5){await Promise.resolve().then(() => cy());s_()}else if(ph.length===1&&ph[0]==="--version")process.stdout.write(`${Wu.version}
|
|
129
|
+
`);else{await $1();await _1()}
|