@fungi.computer/spore 0.25.2 → 0.25.4
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/THIRD_PARTY_NOTICES +5 -5
- package/dist/cli.js +120 -120
- package/dist/private-local-service-worker.mjs +1 -1
- package/dist/whats-new.json +1 -1
- package/package.json +5 -5
|
@@ -88,7 +88,7 @@ ${t}}`),i},cpe="~effect/Fiber",eQe={_A:an,_E:an},tQe={id:0},upe=(()=>{try{return
|
|
|
88
88
|
`);n=CA(e)??kw(y8(e.ast),e);break}default:n=Lge(e);break}return t?`${n}
|
|
89
89
|
at ${t}`:n}function CA(e){if(e._tag==="Pointer")return;if(e._tag==="Encoding")return CA(e.issue);const 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 RA,Zh,Zst,eat,yc,b8,Dge,vc,ga,ir,Dz,x8,tat,Lge,Nge,nat,Df=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/SchemaIssue.js"(){du(),ma(),Sw(),_8(),Yn(),RA="~effect/SchemaIssue/Issue",Zh=class{[RA]=RA;constructor(e,t){t?.reportInput===!0&&e!==nr&&(this.input=e)}},Zst=class extends Zh{_tag="Filter";filter;issue;constructor(e,t,n,i){super(n,i),this.filter=e,this.issue=t}},eat=class extends Zh{_tag="Encoding";ast;issue;constructor(e,t,n,i){super(n,i),this.ast=e,this.issue=t}},yc=class extends Zh{_tag="Pointer";path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},b8=class extends Zh{_tag="MissingKey";annotations;constructor(e){super(),this.annotations=e}},Dge=class extends Zh{_tag="UnexpectedKey";ast;constructor(e,t,n){super(t,n),this.ast=e}},vc=class extends Zh{_tag="Composite";ast;issues;constructor(e,t,n,i){super(n,i),this.ast=e,this.issues=t}},ga=class extends Zh{_tag="InvalidType";ast;constructor(e,t,n){super(t,n),this.ast=e}},ir=class extends Zh{_tag="InvalidValue";annotations;constructor(e,t,n){super(t,n),this.annotations=e}},Dz=class extends Zh{_tag="Forbidden";annotations;constructor(e,t,n){super(t,n),this.annotations=e}},x8=class extends Zh{_tag="AnyOf";ast;issues;constructor(e,t,n,i){super(n,i),this.ast=e,this.issues=t}},tat=class extends Zh{_tag="OneOf";ast;successes;constructor(e,t,n,i){super(n,i),this.ast=e,this.successes=t}},Lge=e=>{const t=CA(e);if(t!==void 0)return t;switch(e._tag){case"InvalidType":return kw(y8(e.ast),e);case"InvalidValue":{const n=Pge(e);if(n!==void 0)return kw(n,e);const i=Mz(e);return i===void 0?"Expected a valid value":`Invalid data ${i}`}case"MissingKey":return"Missing key";case"UnexpectedKey":{const n=Mz(e);return n===void 0?"Expected no excess property":`Unexpected key with value ${n}`}case"Forbidden":return"Forbidden operation";case"OneOf":{const n=Mz(e);return n===void 0?"Expected exactly one member to match":`Expected exactly one member to match the input ${n}`}}},Nge=e=>CA(e.issue)??CA(e),nat=Mbn()}});function Lz(e){let t;for(const n of e.reasons){if(!nme(n)||!Xst(n.error))return;t??=n.error}return t}function em(e,t){const n=Lz(e);if(n===void 0)throw new Error(t,{cause:e});return n}var iat=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/cause.js"(){ro(),Df()}}),Nz,$z,rat,oat,sat=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/encoding/Base64Url.js"(){ki(),yz(),qde(),Nz=e=>u8(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),$z=e=>{const t=e.replace(/[\n\r]/g,""),n=t.length;if(n%4===1)return hi(new iw({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 hi(new iw({module:"Base64Url",kind:"Decode",input:t,message:"Invalid input"}));let i=n%4===2?`${t}==`:n%4===3?`${t}=`:t;return i=i.replace(/-/g,"+").replace(/_/g,"/"),l8(i)},rat=e=>Bh($z(e),t=>oat.decode(t)),oat=new TextDecoder}});function Dbn(e){return aat((t,n)=>be(e(t,n)))}function $ge(e){return Dbn((t,n)=>{const i={message:e(t)};return si(t)?new Dz(i,t.value,n):new Dz(i)})}function r4(){return Uge}function Lbn(){return Uge}function Pi(e){return OA({_tag:"Transform",transform:e})}function vd(e){return OA({_tag:"TransformEffect",transform:e})}function Uz(e){return OA({_tag:"TransformOptional",transform:e})}function aat(e){return OA({_tag:"TransformOptionalEffect",transform:e})}function cat(){return Uz(()=>$t())}function uat(e){return aat(t=>{const n=l7(t,g2);return si(n)?we(n):ZW(e,Mt)})}function Fz(){return Pi(globalThis.String)}function lat(){return Pi(globalThis.Number)}function Nbn(){return Pi(globalThis.BigInt)}function dat(){return Pi(e=>new globalThis.Date(e))}function $bn(){return Pi(Let)}function Ubn(e){return vd((t,n)=>kt({try:()=>JSON.parse(t,e?.reviver),catch:()=>new ir({expected:"a valid JSON string"},t,n)}))}function Fbn(e){return vd((t,n)=>kt({try:()=>{const i=JSON.stringify(t,e?.replacer,e?.space);if(i===void 0)throw new TypeError("Value cannot be represented as JSON");return i},catch:()=>new ir({expected:"a JSON-serializable value"},t,n)}))}function pat(){return Pi(u8)}function hat(){return Pi(Nz)}function mat(){return Pi(SJe)}function Bbn(){return vd((e,t)=>ez(tfe(l8(e)),()=>new ir({expected:"a valid Base64 string"},e,t)))}function jbn(){return vd((e,t)=>kv(Uot(e),{onFailure:()=>be(new ir({expected:"a valid Base64 string"},e,t)),onSuccess:we}))}function Wbn(){return vd((e,t)=>kv($z(e),{onFailure:()=>be(new ir({expected:"a valid Base64Url string"},e,t)),onSuccess:we}))}function zbn(){return vd((e,t)=>kv(rat(e),{onFailure:()=>be(new ir({expected:"a valid Base64Url string"},e,t)),onSuccess:we}))}function qbn(){return vd((e,t)=>kv(Gde(e),{onFailure:()=>be(new ir({expected:"a valid hexadecimal string"},e,t)),onSuccess:we}))}function Hbn(){return vd((e,t)=>kv(TJe(e),{onFailure:()=>be(new ir({expected:"a valid hexadecimal string"},e,t)),onSuccess:we}))}function Gbn(){return Pi(encodeURIComponent)}function Vbn(){return vd((e,t)=>{try{return we(globalThis.decodeURIComponent(e))}catch{return be(new ir({expected:"a valid URI component"},e,t))}})}function Kbn(){return Pi(e=>fat(Array.from(e.entries())))}function Jbn(){return Pi(e=>{const t=new FormData;return typeof e=="object"&&e!==null&&vat(e).forEach(([i,r])=>{t.append(i,r)}),t})}function Qbn(){return Pi(e=>fat(Array.from(e.entries())))}function Xbn(){return Pi(e=>typeof e=="object"&&e!==null?new URLSearchParams(_at(e)):new URLSearchParams)}function Ybn(e){if(e==="")return[""];const t=e.replace(/\[(.*?)\]/g,".$1"),n=t.split("."),i=t.startsWith(".")?1:0;return n.slice(i).map(r=>Nde(r)?globalThis.Number(r):r)}function fat(e){const t={},n=new WeakSet,i=new WeakSet;function r(o,s,a){const c=Object.hasOwn(o,s)?o[s]:void 0;if(n.has(c)&&Array.isArray(c)===a)return c;const u=a?[]:{};return n.add(u),dn(o,s,u),u}return e.forEach(([o,s])=>{const a=Ybn(o);let c=t;a.forEach((u,l)=>{const d=l===a.length-1;if(Array.isArray(c)&&u==="")if(d)c.push(s);else{const p=a[l+1],h=typeof p=="number"||p==="",m=c.length;c=r(c,m,h)}else if(d){const p=Object.hasOwn(c,u);if(p&&Array.isArray(c[u])&&(n.has(c[u])||i.has(c[u])))c[u].push(s);else if(p){const h=[c[u],s];i.add(h),dn(c,u,h)}else dn(c,u,s)}else{const p=a[l+1];c=r(c,u,typeof p=="number"||p==="")}})}),t}function gat(e){return t=>{const n=[];function i(r,o){if(e(o))n.push([r,o]);else if(Array.isArray(o))o.every(e)?o.forEach(a=>{n.push([r,a])}):o.forEach((a,c)=>{i(`${r}[${c}]`,a)});else if(typeof o=="object"&&o!==null)for(const[s,a]of Object.entries(o))i(`${r}[${s}]`,a)}for(const[r,o]of Object.entries(t))i(r,o);return n}}var OA,yat,Uge,vat,_at,PA=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/SchemaGetter.js"(){du(),gt(),yz(),sat(),OJe(),qa(),ri(),Zi(),Yn(),ki(),Df(),Tme(),OA=e=>Object.assign(Object.create(vle),e),yat=$ge(()=>"Encoding is not supported"),Uge=OA({_tag:"Passthrough"}),vat=gat(e=>typeof e=="string"||typeof Blob<"u"&&e instanceof Blob),_at=gat(f2)}});function Zbn(e){return Sn(e,MA)&&e[MA]===MA}function mu(e){return new wo(vd(e.decode),vd(e.encode))}function oo(e){return new wo(Pi(e.decode),Pi(e.encode))}function Fge(e){return new wo(Uz(e.decode),Uz(e.encode))}function exn(){return new wo($bn(),r4())}function Bz(){return wat}function txn(){return oo({decode:ede,encode:vf})}function nxn(){return oo({decode:I2,encode:aa})}function ixn(e){return oo({decode:Uh,encode:e?.onNoneEncoding===null?vf:aa})}function rxn(){return Fge({decode:Mt,encode:C2})}function oxn(){return Fge({decode:e=>e.pipe(l7(g2),Mt),encode:C2})}function sxn(e){return new wo(Ubn(e??{}),Fbn(e))}var jz,MA,wo,Wz,wat,S8,Bge,jge,bat,Wge,xat,Sat,kat,zge,Eat,Aat,qge,Hge,Tat,Iat,Gge,Vge,Cat,Rat,Oat,Pat,Mat,Dat,zz=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/SchemaTransformation.js"(){a8(),gt(),ma(),ri(),Zi(),Yn(),PA(),Df(),jz=class extends I5{_tag="Middleware";decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new jz(this.encode,this.decode)}},MA="~effect/SchemaTransformation/Transformation",wo=class extends I5{[MA]=MA;_tag="Transformation";decode;encode;constructor(e,t){super(),this.decode=e,this.encode=t}flip(){return new wo(this.encode,this.decode)}},Wz=e=>Zbn(e)?e:new wo(e.decode,e.encode),wat=new wo(r4(),r4()),S8=new wo(lat(),Fz()),Bge=new wo(Nbn(),Fz()),jge=new wo(dat(),Pi(YGe)),bat=new wo(dat(),Pi(e=>e.getTime())),Wge=mu({decode:(e,t)=>Oa(yrt(e),{onNone:()=>be(new ir({expected:"a valid ByteSize string"},e,t)),onSome:we}),encode:e=>we(`${e} ${e===BigInt(1)?"byte":"bytes"}`)}),xat=mu({decode:(e,t)=>Oa(Mfe(e),{onNone:()=>be(new ir({expected:"a non-negative bigint byte count"},e,t)),onSome:we}),encode:e=>we(Dfe(e))}),Sat=mu({decode:(e,t)=>Oa(Mfe(e),{onNone:()=>be(new ir({expected:"a non-negative safe-integer byte count"},e,t)),onSome:we}),encode:(e,t)=>Oa(_rt(e),{onNone:()=>be(new ir({expected:"a ByteSize representable as a safe integer"},e,t)),onSome:we})}),kat=e=>hd(e)&&typeof e.message=="string",zge=e=>{const n=Object.hasOwn(e,"cause")?new Error(e.message,{cause:Hge(e.cause)}):new Error(e.message);return typeof e.name=="string"&&e.name!=="Error"&&(n.name=e.name),typeof e.stack=="string"&&(n.stack=e.stack),n},Eat=e=>{try{const t=BB(e);return t===void 0?Qt(e):JSON.parse(t)}catch{return Qt(e)}},Aat=(e,t,n)=>{const i={name:e.name,message:typeof e.message=="string"?e.message:""};return t?.includeStack&&typeof e.stack=="string"&&(i.stack=e.stack),!t?.excludeCause&&e.cause!==void 0&&(i.cause=n(e.cause)),i},qge=e=>{const t=new WeakSet,n=i=>{if(Hwn(i)){if(t.has(i))return"[Circular]";t.add(i);const r=Aat(i,e,n);return t.delete(i),r}return Eat(i)};return n},Hge=e=>kat(e)?zge(e):e,Tat=e=>oo({decode:zge,encode:t=>qge(e)(t)}),Iat=e=>oo({decode:Hge,encode:qge(e)}),Gge=mu({decode:(e,t)=>URL.canParse(e)?we(new URL(e)):be(new ir({expected:"a valid URL string"},e,t)),encode:e=>we(e.href)}),Vge=new wo(Bbn(),pat()),Cat=new wo(jbn(),pat()),Rat=new wo(zbn(),hat()),Oat=new wo(Hbn(),mat()),Pat=new wo(Vbn(),Gbn()),Mat=new wo(Kbn(),Jbn()),Dat=new wo(Qbn(),Xbn())}});function Ew(e){return t=>t._tag===e}function Kge(e){return typeof e=="number"?`parts[${e}]`:e}function Jge(e,t,n){if(n.has(e))return!0;if(e.encoding)throw new Error(`TemplateLiteral parts cannot have an encoding at ${Kge(t)}`);let i;switch(e._tag){case"String":case"Number":case"BigInt":i=!0;break;case"Literal":i=!e.checks;break;case"TemplateLiteral":{const r=Kge(t);i=!e.checks&&e.parts.every((o,s)=>Jge(o,`${r}.parts[${s}]`,n));break}case"Union":{const r=Kge(t);i=!e.checks&&e.types.every((o,s)=>Jge(o,`${r}.types[${s}]`,n));break}default:return!1}return i&&n.add(e),i}function axn(e){const t=C5(r=>{if(r._tag!=="Union")return r;const o=s4(r.types,t);return(r.options?.mode??"anyOf")==="anyOf"&&o===r.types?r:new wd(o,r.options===void 0?void 0:{...r.options,mode:"anyOf"},r.annotations,r.checks,void 0,r.context)}),n=new m0e(e.map(r=>t(R0(r)))),i=new Nf(!1,e.map(nq),[]);return Gz(n,i,Lat(n))}function Lat(e){return new wo(vd((t,n)=>{const i=Yat(e,t,n);return i?we(i):be(new ir({expected:"a string matching template literal parts"},t,n))}),Pi(t=>t.join("")))}function Nat(e){const t=globalThis.String(e.literal);return gs(e,[new ca(new tm(t),new wo(Pi(()=>e.literal),Pi(()=>t)))])}function Qge(e,t){return e.some(n=>n.annotations?.representation?.id===t||n._tag==="FilterGroup"&&Qge(n.checks,t))}function cxn(e,t,n,i){if(n._tag==="Failure")return R8(e,e.ast,i,n);const r=n===fs?t:n[Wi];if(r!==nr)e.output[i]=r;else{const o=e.getParser(e.tailThreshold,i);if(_d(o.ast))return;const s=new yc([i],new b8(o.ast.context?.annotations));if(e.options.errors==="all")e.issues?e.issues.push(s):e.issues=[s];else return b0(new vc(e.ast,[s],e.input,e.options))}}function DA(e,t,n=I0){let i,r;function o(s){switch(s._tag){case"String":case"TemplateLiteral":return(i??=Object.keys(e)).filter(a=>s.matchPart(a,n)!==void 0);case"Number":return(i??=Object.keys(e)).filter(a=>s.matchKey(a,n)!==void 0);case"Symbol":return(r??=Object.getOwnPropertySymbols(e)).filter(a=>Object.prototype.propertyIsEnumerable.call(e,a)&&s.matchKey(a,n)!==void 0);case"Union":return[...new Set(s.types.flatMap(o))];default:return[]}}return o(eq(R0(t)))}function $at(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every($at);default:return!1}}function Uat(e){const t=T8(e);switch(t._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return t.types.every(Uat);default:return!1}}function uxn(e){return $at(e)&&Uat(e)}function Xge(e,t,n){if(n._tag==="Failure")return R8(e,e.ast,t.name,n);if(n===fs)return;const i=n[Wi];if(i!==nr){dn(e.out,t.name,i);return}if(delete e.out[t.name],!_d(t.type)){const r=new yc([t.name],new b8(t.type.context?.annotations));if(e.options.errors==="all"){e.issues?e.issues.push(r):e.issues=[r];return}else return b0(new vc(e.ast,[r],e.input,e.options))}}function Yge(e,t){return e?t?[...e,...t]:e:t}function Zge(e,t,n){return new UA(Reflect.ownKeys(e).map(i=>new Qz(i,e[i].ast)),[],n,t)}function qz(e){return e.ast}function Fat(e,t=void 0){return new Nf(!1,e.map(n=>n.ast),[],void 0,t)}function e0e(e,t,n){return new wd(e.map(qz),t,void 0,n)}function lxn(e,t){if(e.encoding||t.some(o=>o.encoding))throw new Error("StructWithRest does not support encodings");let n=e.propertySignatures,i=e.indexSignatures,r=e.checks;for(const o of t){for(const s of o.propertySignatures)if(n.some(a=>a.name===s.name))throw new Error(`Duplicate identifier: ${JSON.stringify(s.name)}. ts(2300)`);n=n.concat(o.propertySignatures),i=i.concat(o.indexSignatures),r=Yge(r,o.checks)}return new UA(n,i,void 0,r)}function dxn(e,t){if(e.encoding)throw new Error("TupleWithRest does not support encodings");return new Nf(e.isMutable,e.elements,t,void 0,e.checks)}function pxn(e){if(e.encoding)throw new Error("mutable does not support encodings");return new Nf(!0,e.elements,e.rest,e.annotations,e.checks,void 0,e.context,e.encodingChecks)}function Bat(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(Bat)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function k8(e){switch(e._tag){default:return[];case"Declaration":{const t=e.annotations?.[Oz];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap(t=>{const n=t.type;if(!_d(n)){if(a4(n))return[{key:t.name,literal:n.literal}];if(Kz(n))return[{key:t.name,literal:n.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,n)=>{if(!_d(t)){if(a4(t))return[{key:n,literal:t.literal}];if(Kz(t))return[{key:n,literal:t.symbol}]}return[]});case"Union":{if(e.types.length===0)return[];const t=e.types.map(n=>k8(Yz(n)));return t[0].filter(n=>t.every(i=>i.some(r=>r.key===n.key&&r.literal===n.literal)))}case"Suspend":return k8(e.thunk())}}function t0e(e){let t=_0e.get(e);if(t)return t;let n,i=0,r,o,s=!0;const a=[];for(let l=0;l<e.length;l++){const d=e[l],p=Yz(d);if(ict(p))continue;if(a4(p)||Kz(p)){o??=new Map;const m=a4(p)?p.literal:p.symbol;a[l]=m;let f=o.get(m);f||o.set(m,f=[]),f.push(l)}else s=!1;const h=k8(p);if(h.length){n??=new Map,i++;for(const{key:m,literal:f}of h){let g=n.get(m);g||n.set(m,g=[new Map,new Set]),g[1].add(l);let y=g[0].get(f);y||g[0].set(f,y=new Set),y.add(l)}}else{r??={};const m=Bat(p);for(const f of m)(r[f]??=[]).push(l)}}const c={},u=l=>c[l]??=Object.freeze(r?.[l]??O8);if(s&&o)o.forEach(Object.freeze),t=l=>o.get(l)??O8;else if(n?.size===1&&!r){const[l,[d]]=n.entries().next().value,p=new Map;for(const[m,f]of d)p.set(m,Object.freeze(Array.from(f)));const h=Object.freeze(e.map((m,f)=>f));t=(m,f)=>{if(MB(m)){const g=c4(m,l)?m[l]:void 0;if(g!==void 0)return p.get(g)??O8;if(f)return h}return O8}}else if(n){let l;for(const d of n)(!l||d[1][0].size>l[1][0].size)&&d[1][1].size===i&&(l=d);t=(d,p)=>{const h=w0e(d);if(!MB(d))return u(h);const m=new Set(r?.[h]);let f;if(l){const[g,[y]]=l,v=c4(d,g),_=v?d[g]:void 0;if(v&&(!p||_!==void 0)){const b=y.get(_);if(!b)return u(h);for(const w of b)m.add(w);f=g}}if(f===void 0)for(const[g,[y,v]]of n){const _=c4(d,g),b=_?d[g]:void 0;if(_&&(!p||b!==void 0)){const w=y.get(b);if(w)for(const x of w)m.add(x)}else if(p)for(const w of v)m.add(w)}for(const[g,[y,v]]of n){if(g===f)continue;const _=c4(d,g),b=_?d[g]:void 0;if(_&&(!p||b!==void 0)){const w=y.get(b);for(const x of m)v.has(x)&&!w?.has(x)&&m.delete(x)}}return Array.from(m).sort((g,y)=>g-y)}}else t=l=>{const d=u(w0e(l));return o?d.filter(p=>a[p]===void 0||a[p]===l):d};return _0e.set(e,t),t}function jat(e,t,n,i){const r=Lz(t);return r?b0(new x8(e,[r],n,i)):w0(t)}function hxn(e,t,n,i){return $u(t,r=>jat(e,r,n,i))}function Wat(e,t,n,i,r){const o={ast:e,parser:t,input:i,out:void 0,successes:e.options?.mode==="oneOf"?[]:void 0,issues:void 0,options:r},s=Cct(o,n);if(!s)return o.out?o.out:be(new x8(e,o.issues??[],i,r));if(Co(s))return zat(s,o);let a=!0;return Ut(()=>a?(a=!1,zat(s,o)):Wat(e,t,n,i,r))}function zat(e,t){return yd(e,n=>t.out===fs?we(t.input):t.out?t.out:be(new x8(t.ast,t.issues??[],t.input,t.options)))}function qat(e){return e?"":"readonly "}function Hat(e){return e?"?":""}function n0e(e,t,n=!1){return new P8((i,r,o)=>Pbn(r,e(i,r,o),i,o),t,n)}function Gat(e,t){return new P8((n,i,r)=>e(n)?void 0:new ir(void 0,n,r),t,!0)}function Vat(e){return n0e(t=>globalThis.Number.isFinite(t),{expected:"a finite number",representation:{id:"effect/schema/isFinite",payload:null},toJsonSchema:()=>({type:"number"}),toCode:()=>({runtime:"Schema.isFinite()"}),arbitraryConstraint:{number:"finite"},...e})}function Hz(e,t){const n=new globalThis.RegExp(e),i={source:n.source,flags:n.flags};return n0e(r=>(n.lastIndex=0,n.test(r)),{expected:`a string matching the RegExp ${i.source}`,representation:{id:"effect/schema/isPattern",payload:i},toJsonSchema:()=>[{},!0],arbitraryConstraint:{patterns:[i]},...t})}function E8(e,t){const n=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(i=>i==="context"||i==="encoding")&&Zz.set(n,A8(e)),n}function A8(e){const t=Zz.get(e);if(t!==void 0)return t;if(e.encoding===void 0)return e;const n=Object.assign(Object.create(Object.getPrototypeOf(e)),e,{encoding:void 0});return Zz.set(e,n),n}function gs(e,t){return e.encoding===t?e:E8(e,{encoding:t})}function o4(e,t){if(e.context===t)return e;const n=A8(e);return n.context===t&&n.encoding===e.encoding?n:E8(e,{context:t})}function T8(e){return e.encoding?T8(e.encoding[e.encoding.length-1].to):e}function Aw(e,t){if(e.checks){const n=e.checks[e.checks.length-1];return Kat(e,$de(e.checks.slice(0,-1),n.annotate(t)))}return E8(e,{annotations:{...e.annotations,...t}})}function Kat(e,t){if(e._tag==="Suspend"&&t)throw new Error("Cannot add checks to Suspend");return e.checks===t?e:E8(e,{checks:t})}function Tw(e,t){return Kat(e,Yge(e.checks,t))}function I8(e,t){const n=t(e.to);return n===e.to?e:new ca(n,e.transformation)}function Jat(e,t){const n=e,i=n[n.length-1],r=I8(i,t);return r===i?e:$de(e.slice(0,e.length-1),r)}function i0e(e){return t=>t.encoding?gs(t,Jat(t.encoding,e)):t}function r0e(e,t){return i0e(n=>o4(n,t))(e)}function LA(e,t){function n(i){if(i.encoding){const r=i.encoding[i.encoding.length-1];return t?.stopAt?.(r)?i:gs(i,Jat(i.encoding,n))}return e(i)}return R5(n)}function mxn(e,t){return o0e(e,t,Bu(e))}function fxn(e,t){return o0e(R0(e),t,e)}function o0e(e,t,n){const i=new ca(e,t);return gs(n,n.encoding?[...n.encoding,i]:[i])}function s4(e,t){let n;for(let i=0;i<e.length;i++){const r=e[i],o=t(r);if(n)n[i]=o;else if(o!==r){n=new Array(e.length);for(let s=0;s<i;s++)n[s]=e[s];n[i]=o}}return n??e}function s0e(e,t){const n=e.context?new C0(e.context.isOptional,e.context.isMutable,e.context.constructorDefault,{...e.context.annotations,...t}):new C0(!1,!1,void 0,t);return o4(e,n)}function gxn(e,t){const n=e.context?new C0(e.context.isOptional,e.context.isMutable,t,e.context.annotations):new C0(!1,!1,t);return o4(e,n)}function Gz(e,t,n){return o0e(e,n,t)}function yxn(e){const t=[],n=[];function i(r){switch(r._tag){case"Literal":PGe(r.literal)&&!t.includes(r.literal)&&t.push(r.literal);return;case"UniqueSymbol":t.includes(r.symbol)||t.push(r.symbol);return;case"Never":return;case"Union":for(let o=0;o<r.types.length;o++)i(r.types[o]);return;default:n.push(r)}}return i(e),{literals:t,parameters:n}}function vxn(e,t){const{literals:n,parameters:i}=yxn(e);return new UA(n.map(r=>new Qz(r,t)),i.map(r=>new Xz(r,t)))}function _d(e){return e.context?.isOptional??!1}function _xn(e){return e.context?.isMutable??!1}function Qat(e){return e.annotations?.[Dp]===!0||e._tag==="FilterGroup"&&e.checks.every(Qat)}function wxn(e){function t(i){return Qat(i)?[i]:i._tag==="FilterGroup"?i.checks.flatMap(t):[]}const n=e.flatMap(t);return wj(n)?n:void 0}function bxn(e){let t=!0;function n(i){return t=t&&!i.encoding&&!c0e(i),t&&"recur"in i&&i.recur(n),i}return"recur"in e&&e.recur(n),t}function xxn(e,t){const n=t,i=n.length,r=n[i-1],o=[new ca(im(gs(e,void 0)),n[0].transformation.flip())];for(let a=1;a<i;a++)o.unshift(new ca(im(n[a-1].to),n[a].transformation.flip()));const s=im(r.to);return s.encoding?gs(s,[...s.encoding,...o]):gs(s,o)}function Xat(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(Xat);default:return!1}}function Vz(e,t){const n=t===0?fs:Fu(t);return(i,r)=>i===nr?Lp:i===t?n:be(new ga(e,i,r))}function Lf(e,t){return(n,i)=>n===nr?Lp:t(n)?fs:be(new ga(e,n,i))}function Yat(e,t,n){const i=e.encodedParts,r=e.literals,o=t.length;for(let u=0;u<r.length;u++){const l=r[u];if(l&&!t.includes(l))return}if(e.suffixLengths[0]>o)return;const s=new Array(i.length);let a;function c(u,l){if(u===i.length)return l===o;if(a?.has(u*(o+1)+l))return!1;const d=i[u];if(u===i.length-1){const p=t.slice(l);if(d.matchPart(p,n)!==void 0)return s[u]=p,!0}else if(d._tag==="Literal"){const p=r[u];if(t.startsWith(p,l)&&c(u+1,l+p.length))return s[u]=p,!0}else{const p=o-e.suffixLengths[u+1],h=r[u+1];let m=h===void 0?p:t.lastIndexOf(h,p);for(;m>=l;){const f=t.slice(l,m);if(d.matchPart(f,n)!==void 0&&c(u+1,m))return s[u]=f,!0;if(m===0)break;m=h===void 0?m-1:t.lastIndexOf(h,m-1)}}return a??=new Set,a.add(u*(o+1)+l),!1}return c(0,0)?s:void 0}function Zat(e){return Hz(iq,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:iq.source}),...e})}function ect(e){return Hz(rq,{expected:"a string representing a bigint",representation:{id:"effect/schema/isStringBigInt",payload:null},toJsonSchema:()=>({pattern:rq.source}),...e})}function tct(e){return Hz(oq,{expected:"a string representing a symbol",representation:{id:"effect/schema/isStringSymbol",payload:null},toJsonSchema:()=>({pattern:oq.source}),...e})}function T0(e,t,n,i,r){for(let o=0;o<e.length;o++){const s=e[o];if(s._tag==="FilterGroup"){if(n=T0(s.checks,t,n,i,r),n&&(r.errors!=="all"||n[n.length-1].filter.aborted))return n}else{const a=s.run(t,i,r);if(a){const c=new Zst(s,a,t,r);if(n?n.push(c):n=[c],r.errors!=="all"||s.aborted)return n}}}return n}function Sxn(e,t){const n=T0(e,t,void 0,Iw,{errors:"all"});if(n){const i=new vc(Iw,n);return hi(i)}return oi(t)}function kxn(e){if(!C8(e))return;const t=e.annotations?.[Ige];return Mu(t)?t(e.typeParameters):void 0}function Exn(e){return e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"&&globalThis.Number.isFinite(e)}function Axn(e){return e===void 0||typeof e=="string"}function nct(e,t){const n=new WeakMap,i=[];e:for(;;){if(typeof e!="object"||e===null){if(!t(e))return!1}else{const r=e,o=n.get(r);if(o===!1)return!1;if(o===void 0){const s=Array.isArray(r);if(!s){const a=Object.getPrototypeOf(r);if(a!==null&&a!==Object.prototype&&Object.getPrototypeOf(a)!==null)return!1}n.set(r,!1),i.push({value:r,keys:s?r.length:Object.keys(r),index:0})}}for(;i.length>0;){const r=i[i.length-1],o=r.keys;if(typeof o=="number"){if(r.index<o){e=r.value[r.index++];continue e}}else if(r.index<o.length){e=r.value[o[r.index++]];continue e}n.set(r.value,!0),i.pop()}return!0}}function NA(e){return nct(e,Exn)}function Txn(e){return nct(e,Axn)}var C8,ict,a4,Kz,a0e,rct,oct,c0e,ca,I0,C0,u0e,ya,$A,sct,l0e,act,d0e,p0e,cct,uct,lct,h0e,dct,pct,hct,Iw,mct,fct,gct,m0e,yct,tm,vct,nm,_ct,f0e,wct,bct,xct,Sct,kct,Ect,Nf,g0e,Act,Tct,R8,Jz,Qz,Xz,UA,y0e,v0e,Ict,Yz,_0e,O8,w0e,c4,wd,Cct,b0e,x0e,P8,u4,S0e,Rct,Zz,FA,Oct,Pct,k0e,Mct,Bu,R0,im,eq,tq,nq,Dct,iq,Lct,E0e,Nct,$ct,Uct,rq,A0e,Fct,Bct,oq,jct,T0e,BA,Wct,I0e,zct,qct,C0e,$p=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/SchemaAST.js"(){du(),ro(),gt(),Xr(),ma(),Nn(),Cs(),qa(),Sw(),iat(),_8(),Zi(),Yn(),ki(),PA(),Df(),zz(),C8=Ew("Declaration"),ict=Ew("Never"),a4=Ew("Literal"),Kz=Ew("UniqueSymbol"),a0e=Ew("Arrays"),rct=Ew("Objects"),oct=Ew("Union"),c0e=Ew("Suspend"),ca=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},I0={},C0=class{isOptional;isMutable;constructorDefault;annotations;constructor(e,t,n=void 0,i=void 0){this.isOptional=e,this.isMutable=t,this.constructorDefault=n,this.annotations=i}},u0e="~effect/Schema",ya=class{[u0e]=u0e;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,i=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=i}toString(){return`<${this._tag}>`}},$A=class extends ya{_tag="Declaration";typeParameters;run;encodingChecks;encodingRun;constructor(e,t,n,i,r,o,s,a){super(n,i,r,o),this.typeParameters=e,this.run=t,this.encodingChecks=s,this.encodingRun=a}getParser(){let e;return(t,n)=>t===nr?Lp:(e??=this.run(this.typeParameters))(t,this,n)}_rebuild(e,t,n,i,r){const o=s4(this.typeParameters,e);return o===this.typeParameters&&t===this.checks&&n===this.encodingChecks&&i===this.run&&r===this.encodingRun?this:new $A(o,i,this.annotations,t,void 0,this.context,n,r)}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(){const e=this.annotations?.expected;return typeof e=="string"?e:"<Declaration>"}},sct=class extends ya{_tag="Null";getParser(){return Vz(this,null)}getExpected(){return"null"}},l0e=new sct,act=class extends ya{_tag="Undefined";getParser(){return Vz(this,void 0)}toCodecJson(){return gs(this,[d0e])}getExpected(){return"undefined"}},d0e=new ca(l0e,new wo(Pi(()=>{}),Pi(()=>null))),p0e=new act,cct=class extends ya{_tag="Void";getParser(){const e=Fu(void 0);return t=>t===nr?Lp:e}toCodecJson(){return gs(this,[d0e])}getExpected(){return"void"}},uct=new cct,lct=class extends ya{_tag="Never";getParser(){return Lf(this,qwn)}getExpected(){return"never"}},h0e=new lct,dct=class extends ya{_tag="Any";getParser(){return Lf(this,DGe)}getExpected(){return"any"}},pct=new dct,hct=class extends ya{_tag="Unknown";getParser(){return Lf(this,DGe)}getExpected(){return"unknown"}},Iw=new hct,mct=class extends ya{_tag="ObjectKeyword";getParser(){return Lf(this,MB)}getExpected(){return"object | array | function"}},fct=new mct,gct=class extends ya{_tag="Enum";enums;constructor(e,t,n,i,r){super(t,n,i,r);for(const[,o]of e)if(typeof o=="number"&&!globalThis.Number.isFinite(o))throw new Error(`A numeric enum value must be finite, got ${Qt(o)}`);this.enums=e}getParser(){const e=new Set(this.enums.map(([,t])=>t));return Lf(this,t=>e.has(t))}toCodecStringTree(){if(this.enums.some(([e,t])=>typeof t=="number")){const e=Object.fromEntries(this.enums.map(([t,n])=>[globalThis.String(n),n]));return gs(this,[new ca(new wd(Object.keys(e).map(t=>new tm(t))),new wo(Pi(t=>e[t]),Fz()))])}return this}getExpected(){return this.enums.map(([e,t])=>JSON.stringify(t)).join(" | ")}},m0e=class extends ya{_tag="TemplateLiteral";parts;encodedParts;literals;suffixLengths;constructor(e,t,n,i,r){super(t,n,i,r);const o=[],s=[],a=new Set;for(let u=0;u<e.length;u++){const l=e[u];if(!Jge(l,u,a))throw new Error(`Invalid TemplateLiteral part ${l._tag}`);o.push(l),s.push(l._tag==="Literal"?globalThis.String(l.literal):void 0)}const c=new Array(o.length+1);c[o.length]=0;for(let u=o.length-1;u>=0;u--)c[u]=c[u+1]+(s[u]?.length??0);this.parts=e,this.encodedParts=o,this.literals=s,this.suffixLengths=c}getParser(e){const t=new Nf(!1,this.parts.map(nq),[]),n=e(Gz(nm,t,Lat(this)));return(i,r)=>{if(i===nr)return Lp;const o=n(i,r);return o._tag==="Success"?fs:hu(o,{onSuccess:()=>i,onFailure:s=>new vc(this,[s],i,r)})}}getExpected(){return"string"}matchPart(e,t){return Yat(this,e,t)===void 0?void 0:e}},yct=class extends ya{_tag="UniqueSymbol";symbol;constructor(e,t,n,i,r){super(t,n,i,r),this.symbol=e}getParser(){return Vz(this,this.symbol)}toCodecStringTree(){const e=globalThis.Symbol.keyFor(this.symbol);return gs(this,[new ca(e===void 0?h0e:new tm(globalThis.String(this.symbol)),T0e.transformation)])}getExpected(){return globalThis.String(this.symbol)}},tm=class extends ya{_tag="Literal";literal;constructor(e,t,n,i,r){if(super(t,n,i,r),typeof e=="number"&&!globalThis.Number.isFinite(e))throw new Error(`A numeric literal must be finite, got ${Qt(e)}`);this.literal=e}getParser(){return Vz(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal=="bigint"?Nat(this):this}toCodecStringTree(){return typeof this.literal=="string"?this:Nat(this)}getExpected(){return typeof this.literal=="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}},vct=class extends ya{_tag="String";getParser(){return Lf(this,f2)}matchPart(e,t){const n=this.checks;return n&&!t.disableChecks&&T0(n,e,void 0,this,t)?void 0:e}getExpected(){return"string"}},nm=new vct,_ct=class extends ya{_tag="Number";getParser(){return Lf(this,_le)}matchKey(e,t){return this._match(Lct,e,t)}matchPart(e,t){return this._match(iq,e,t)}_match(e,t,n){if(!e.test(t))return;const i=globalThis.Number(t);return n.disableChecks||!this.checks?i:T0(this.checks,i,void 0,this,n)?void 0:i}toCodecJson(){return this.checks&&(Qge(this.checks,"effect/schema/isFinite")||Qge(this.checks,"effect/schema/isInt"))?this:gs(this,[Rct])}toCodecStringTree(){return this.toCodecJson()===this?gs(this,[Nct]):gs(this,[$ct])}getExpected(){return"number"}},f0e=new _ct,wct=class extends ya{_tag="Boolean";getParser(){return Lf(this,RGe)}getExpected(){return"boolean"}},bct=new wct,xct=class extends ya{_tag="Symbol";getParser(){return Lf(this,OGe)}matchKey(e,t){return t.disableChecks||!this.checks?e:T0(this.checks,e,void 0,this,t)?void 0:e}toCodecStringTree(){return gs(this,[T0e])}getExpected(){return"symbol"}},Sct=new xct,kct=class extends ya{_tag="BigInt";getParser(){return Lf(this,Wwn)}matchPart(e,t){if(!rq.test(e))return;const n=globalThis.BigInt(e);return t.disableChecks||!this.checks?n:T0(this.checks,n,void 0,this,t)?void 0:n}toCodecStringTree(){return gs(this,[Fct])}getExpected(){return"bigint"}},Ect=new kct,Nf=class extends ya{_tag="Arrays";isMutable;elements;rest;encodingChecks;constructor(e,t,n,i,r,o,s,a){super(i,r,o,s),this.isMutable=e,this.elements=t,this.rest=n,this.encodingChecks=a;let c=!1;for(let u=0;u<t.length;u++)if(_d(t[u]))c=!0;else if(c)throw new Error("A required element cannot follow an optional element. ts(1257)");if(c&&n.length>1)throw new Error("A required element cannot follow an optional element. ts(1257)");for(let u=1;u<n.length;u++)if(_d(n[u]))throw new Error("An optional element cannot follow a rest element. ts(1266)")}getParser(e,t=e){const n=this;let i,r;const o=n.elements.length,s=Math.max(0,n.rest.length-1);function a(l,d){return d<o?i[d]:d>=l?r[d-l+1]:r[0]}const c=l=>{const{input:d,len:p,options:h}=l;if(n.rest.length===0&&p>o)for(let m=o;m<p;m++){const f=new Dge(n,d[m],h),g=new yc([m],f);if(h.errors==="all")l.issues?l.issues.push(g):l.issues=[g];else return be(new vc(n,[g],d,h))}return l.issues?be(new vc(n,l.issues,d,h)):Fu(l.output)},u=(l,d)=>{const p=l.length,h={ast:n,getParser:a,input:l,len:p,tailThreshold:Math.max(o,p-s),output:new globalThis.Array(p),issues:void 0,options:d},m=n.rest.length===0?o:Math.max(p,o+s),f=d.concurrency===void 0?1:M7(d.concurrency),g=f===1?Act(h,l,0,m):Tct(h,l,{concurrency:f,end:m});if(!g)return c(h);if(Co(g))return yd(g,()=>c(h));let y=!0;return Ut(()=>y?(y=!1,De(g,()=>c(h))):u(l,d))};return(l,d)=>{if(l===nr)return Lp;try{return Array.isArray(l)?(i||(i=n.elements.map(p=>({ast:p,parser:t(p)})),r=n.rest.map(p=>({ast:p,parser:t(p)}))),u(l,d)):be(new ga(n,l,d))}catch(p){return Tf(p)}}}_rebuild(e,t,n){const i=s4(this.elements,e),r=s4(this.rest,e);return i===this.elements&&r===this.rest&&t===this.checks&&n===this.encodingChecks?this:new Nf(this.isMutable,i,r,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"}},g0e={onItem(e,t,n){const i=n<e.len?t:nr;return e.getParser(e.tailThreshold,n).parser(i,e.options)},step:cxn},Act=Zj()(g0e),Tct=eW()(g0e),R8=(e,t,n,i)=>{if(i.cause.reasons.length===0)return i;const r=Lz(i.cause);if(r===void 0)return w0(uA(i.cause,s=>new vc(t,[new yc([n],s)],e.input,e.options)));const o=new yc([n],r);if(e.options.errors==="all")e.issues?e.issues.push(o):e.issues=[o];else return b0(new vc(t,[o],e.input,e.options))},Jz="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?",Qz=class{name;type;constructor(e,t){this.name=e,this.type=t}},Xz=class{parameter;type;constructor(e,t){if(!uxn(e))throw new Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,_d(t)&&!Xat(t))throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},UA=class extends ya{_tag="Objects";propertySignatures;indexSignatures;encodingChecks;constructor(e,t,n,i,r,o,s){super(n,i,r,o),this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=s}getParser(e,t=e){const n=this,i=n.propertySignatures.length,r=n.indexSignatures.length;if(!i&&!r)return Lf(n,MGe);let o,s;const a=()=>(o||(o=n.propertySignatures.map(d=>({parser:t(d.type),name:d.name,type:d.type})),s=r?n.indexSignatures.map(d=>({is:d,parserKey:e(eq(d.parameter)),parserValue:t(d.type)})):void 0),o),c=()=>{const d=new Set(n.propertySignatures.map(g=>typeof g.name=="number"?globalThis.String(g.name):g.name)),p=(g,y,v,_,b)=>{if(b._tag==="Failure")return R8(g,n,y,b)??Hs;const w=b===fs?_:b[Wi];if(v!==nr&&w!==nr){if(i&&(d.has(y)||d.has(typeof v=="number"?globalThis.String(v):v)))return Hs;dn(g.out,v,w)}return Hs},h=(g,y,v,_)=>{if(!_){const S=v.parserKey(y,g.options);if(!Co(S))return De(Gs(S),T=>h(g,y,v,T));_=S}if(_._tag==="Failure")return R8(g,n,y,_)??Hs;const b=_===fs?y:_[Wi],w=g.input[y],x=v.parserValue(w,g.options);return Co(x)?p(g,y,b,w,x):De(Gs(x),S=>p(g,y,b,w,S))},m=(g,y,v)=>{const _=g.input[y],b=v.parserValue(_,g.options);return Co(b)?p(g,y,y,_,b):De(Gs(b),w=>p(g,y,y,_,w))},f=r?eW()({onItem:(g,[y,v])=>v.is.parameter===nm?m(g,y,v):h(g,y,v),step:(g,y,v)=>v._tag==="Failure"?v:void 0}):void 0;return vfe(function*(g,y){if(g===nr)return nr;if(!(typeof g=="object"&&g!==null&&!Array.isArray(g)))return yield*be(new ga(n,g,y));a();const v=g,_={},b={ast:n,input:v,out:_,issues:void 0,options:y},w=y.errors==="all",x=y.onExcessProperty==="error",S=y.concurrency===void 0?1:M7(y.concurrency),T=r&&x?n.indexSignatures.map(C=>DA(v,C.parameter,y)):void 0;if(x){const C=T?new Set(d):d;if(T)for(const P of T)for(const N of P)C.add(N);const O=Reflect.ownKeys(v);for(let P=0;P<O.length;P++){const N=O[P];if(!C.has(N)&&Object.prototype.propertyIsEnumerable.call(v,N)){const U=new Dge(n,v[N],y),j=new yc([N],U);if(w){b.issues?b.issues.push(j):b.issues=[j];continue}else return yield*be(new vc(n,[j],g,y))}}}if(i){const C=S===1?v0e(b,o):Ict(b,o,{concurrency:S});C&&(yield*C)}if(r&&S===1)for(let C=0;C<r;C++){const O=s[C],P=O.is.parameter===nm?m:h,N=T?.[C]??(O.is.parameter===nm?Object.keys(v):DA(v,O.is.parameter,y));for(let U=0;U<N.length;U++){const j=P(b,N[U],O);if(!Co(j))yield*j;else if(j._tag==="Failure")return yield*j}}else if(f){const C=Ude();for(let P=0;P<r;P++){const N=s[P],U=T?.[P]??(N.is.parameter===nm?Object.keys(v):DA(v,N.is.parameter,y));for(let j=0;j<U.length;j++)C.push([U[j],N])}const O=f(b,C,{concurrency:S});O&&(yield*O)}return b.issues?yield*be(new vc(n,b.issues,g,y)):_})};if(r)return c();let u;const l=(d,p,h)=>{const m=o[p];return De(Gs(h),f=>{const g=Xge(d,m,f);if(g)return g;const y=()=>Fu(d.out),v=v0e(d,o.slice(p+1));return v?yd(v,y):y()})};return(d,p)=>{if(d===nr)return Lp;if(p.errors==="all"||p.onExcessProperty!==void 0||p.concurrency!==void 0&&M7(p.concurrency)!==1)return(u??=c())(d,p);if(!(typeof d=="object"&&d!==null&&!Array.isArray(d)))return be(new ga(n,d,p));const h=a(),m=d,f={},g={ast:n,input:m,out:f,issues:void 0,options:p};try{for(let y=0;y<h.length;y++){const v=h[y],_=v.name,b=c4(m,_),w=b?m[_]:nr,x=v.parser(w,p);if(!Co(x))return l(g,y,x);if(x===fs){b&&dn(f,_,w);continue}const S=Xge(g,v,x);if(S)return S}}catch(y){return Tf(y)}return Fu(f)}}_rebuild(e,t,n,i){const r=s4(this.propertySignatures,s=>{const a=e(s.type);return a===s.type?s:new Qz(s.name,a)}),o=s4(this.indexSignatures,s=>{const a=t(s.parameter),c=e(s.type);return a===s.parameter&&c===s.type?s:new Xz(a,c)});return r===this.propertySignatures&&o===this.indexSignatures&&n===this.checks&&i===this.encodingChecks?this:new UA(r,o,this.annotations,n,void 0,this.context,i)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?"object | array":"object"}},y0e={onItem(e,t){if(!c4(e.input,t.name))return t.parser(nr,e.options);const n=e.input[t.name];return dn(e.out,t.name,n),t.parser(n,e.options)},step:Xge},v0e=Zj()(y0e),Ict=eW()(y0e),Yz=R5(e=>{for(;;){if(c0e(e))return Iw;const t=e.encoding;if(!t)return e.recur?.(Yz,an)??e;if(t.some(n=>n.transformation._tag==="Middleware"&&n.transformation.decode!==an))return Iw;e=t[t.length-1].to}}),_0e=new WeakMap,O8=Object.freeze([]),w0e=e=>e===null?"null":Array.isArray(e)?"array":typeof e,c4=(e,t)=>t==="__proto__"?Object.hasOwn(e,t):t in e,wd=class extends ya{_tag="Union";types;options;encodingChecks;constructor(e,t,n,i,r,o,s){super(n,i,r,o),this.types=e,this.options=t,this.encodingChecks=s}getParser(e,t){const n=this,i=t!==void 0,r=[],o=a=>r[a]??=e(n.types[a]);let s;return(a,c)=>{if(a===nr)return Lp;const u=(s??=t0e(n.types))(a,i);if(u.length===0)return be(new x8(n,[],a,c));if(u.length===1){const l=o(u[0])(a,c);return l._tag==="Success"?l:Co(l)?jat(n,l.cause,a,c):hxn(n,l,a,c)}return Wat(n,o,u,a,c)}}_rebuild(e,t,n){const i=s4(this.types,e);return i===this.types&&t===this.checks&&n===this.encodingChecks?this:new wd(i,this.options,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(const n of this.types){const i=n.matchPart(e,t);if(i!==void 0)return i}}getExpected(e){const t=this.annotations?.expected;if(typeof t=="string")return t;if(this.types.length===0)return"never";const n=this.types.map(i=>{const r=R0(i);switch(r._tag){case"Arrays":{const o=r.elements.filter(a4);if(o.length>0)return`${qat(r.isMutable)}[ ${o.map(s=>e(s)+Hat(s.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{const o=r.propertySignatures.filter(s=>a4(s.type));if(o.length>0)return`{ ${o.map(s=>`${qat(s.type.context?.isMutable)}${v2(s.name)}${Hat(s.type.context?.isOptional)}: ${e(s.type)}`).join(", ")}, ... }`;break}}return e(r)});return Array.from(new Set(n)).join(" | ")}},Cct=Zj()({onItem(e,t){return e.parser(t)(e.input,e.options)},step(e,t,n){if(n._tag==="Failure"){const i=Lz(n.cause);if(i===void 0)return n;e.issues?e.issues.push(i):e.issues=[i]}else{if(e.out&&e.successes)return e.successes.push(e.ast.types[t]),b0(new tat(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(e.ast.types[t]);else return Hs}}}),b0e=new wd([new tm("Infinity"),new tm("-Infinity"),new tm("NaN")]),x0e=class extends ya{_tag="Suspend";thunk;constructor(e,t,n,i,r){if(n)throw new Error("Cannot add checks to Suspend");super(t,void 0,i,r);let o;this.thunk=()=>o??=e()}getParser(e){let t;return(n,i)=>(t??=e(this.thunk()))(n,i)}recur(e){return new x0e(()=>e(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(e){return e(this.thunk())}},P8=class extends I5{_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 P8(this.run,{...this.annotations,...e},this.aborted)}abort(){return new P8(this.run,this.annotations,!0)}and(e,t){return new u4([this,e],t)}},u4=class extends I5{_tag="FilterGroup";checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new u4(this.checks,{...this.annotations,...e})}and(e,t){return new u4([this,e],t)}},S0e=Tw(f0e,[Vat()]),Rct=new ca(new wd([S0e,b0e]),new wo(lat(),Pi(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e)))),Zz=new WeakMap,FA=R5(e=>{const t=e.context?e.context.isOptional===!1?new C0(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new C0(!0,!1);return Oct(o4(e,t))}),Oct=i0e(FA),Pct=C5(e=>FA(new wd([e,p0e]))),k0e=R5(e=>{const t=e.context?e.context.isMutable===!1?new C0(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new C0(!1,!0);return Mct(o4(e,t))}),Mct=i0e(k0e),Bu=R5(e=>{const t=A8(e);if(t!==e){const i=Bu(t);return i===t&&e.encoding===void 0?e:o4(i,e.context)}const n="recur"in e?e.recur(Bu):e;if("encodingChecks"in n&&n.encodingChecks){const i=bxn(e)?n.encodingChecks:a0e(n)||rct(n)||C8(n)&&n.typeParameters.length>0?wxn(n.encodingChecks):void 0;return E8(n,{encodingChecks:void 0,checks:Yge(n.checks,i)})}return n}),R0=R5(e=>Bu(im(e))),im=C5(e=>{if(e.encoding)return xxn(e,e.encoding);const t=A8(e);if(t!==e){const n=im(t);return n===t?e:o4(n,e.context)}return"flip"in e?e.flip(im):"recur"in e?e.recur(im):e}),eq=LA(e=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(eq)}}),tq=LA(e=>{switch(e._tag){default:return e;case"Symbol":case"UniqueSymbol":return e.toCodecStringTree();case"Union":return e.recur(tq)}}),nq=LA(e=>{switch(e._tag){default:return e;case"Number":case"Literal":case"BigInt":return e.toCodecStringTree();case"Union":return e.recur(nq)}}),Dct="[\\s\\S]*?",iq=new globalThis.RegExp(`^${Jz}$`),Lct=new globalThis.RegExp(`^(?:${Jz}|Infinity|-Infinity|NaN)$`),E0e=Tw(nm,[Zat()]),Nct=new ca(E0e,S8),$ct=new ca(new wd([E0e,b0e]),S8),Uct="-?\\d+",rq=new globalThis.RegExp(`^${Uct}$`),A0e=Tw(nm,[ect({expected:"a string representing a bigint"})]),Fct=new ca(A0e,Bge),Bct="Symbol\\(([\\s\\S]*)\\)",oq=new globalThis.RegExp(`^${Bct}$`),jct=Tw(nm,[tct()]),T0e=new ca(jct,new wo(Pi(e=>globalThis.Symbol.for(oq.exec(e)[1])),vd((e,t)=>globalThis.Symbol.keyFor(e)!==void 0?we(globalThis.String(e)):be(new Dz({message:"cannot serialize to string, Symbol is not registered"},e,t))))),BA=new $A([],()=>(e,t,n)=>NA(e)?fs:be(new ga(t,e,n)),{representation:{id:"effect/schema/Json",payload:null},expected:"JSON value",toCodecJson:()=>{},toCodecStringTree:()=>C0e}),Wct=Aw(BA,{representation:{id:"effect/schema/MutableJson",payload:null}}),I0e=new ca(BA,Bz()),zct=new ca(new wd([new Nf(!1,[],[BA]),new UA([],[new Xz(nm,BA)])]),Bz()),qct=new $A([],()=>(e,t,n)=>Txn(e)?fs:be(new ga(t,e,n)),{expected:"StringTree",toCodecStringTree:()=>{}}),C0e=new ca(qct,Bz())}});function Hct(e){if(e._tag==="Middleware")return(n,i,r)=>{const o=n===fs?e.decode(Fu(v8(i)),r):e.decode(ZW(n,v8),r);return R0e(o)};const t=e.decode;switch(t._tag){case"Passthrough":return(n,i)=>n===fs?Fu(i):n;case"Transform":{const n=i=>i===nr?Lp:Fu(t.transform(i));return(i,r)=>M8(i,r,n)}case"TransformOptional":{const n=i=>Rge(t.transform(v8(i)));return(i,r)=>M8(i,r,n)}case"TransformEffect":return(n,i,r)=>M8(n,i,o=>o===nr?Lp:t.transform(o,r));case"TransformOptionalEffect":return(n,i,r)=>M8(n,i,o=>R0e(t.transform(v8(o),r)))}}function Ixn(e,t){const n=Hct(e.link.transformation);let i;return(r,o)=>{if(r===nr)return Lp;if(e.isConstructed(r))return fs;const s=(i??=t(e.link.to))(r,o);return n(s,r,o)}}function Cxn(e,t){const n=e.context.constructorDefault;return(i,r)=>{if(i!==nr&&i!==void 0)return t(i,r);const o=n;if(Co(o)&&o._tag==="Success"){const s=t(o[Wi],r);return s===fs?o:s}return yd(O0e(e,i,r,o),s=>{const a=t(s,r);return a===fs?Fu(s):a})}}function Gct(e,t){const n=t(e);return e.context?.constructorDefault===void 0?n:Cxn(e,n)}function sq(e,t,n,i,r){if(e._tag==="Declaration")for(const m of e.typeParameters)t(m);const o=n?kxn(e):void 0,s=o?Ixn(o,t):i??e.getParser(t,n),a=e.checks,c=e.encoding,u=c?.map(m=>Hct(m.transformation)),l=e.encodingChecks;if(!c&&!a&&!l)return s;let d;const p=(m,f)=>{let g=s(m,f);if(l&&!f.disableChecks)if(Co(g)){if(g._tag==="Success"){const y=g===fs?m:g[Wi];if(m!==nr&&y!==nr){const v=T0(l,m,void 0,e,f);v&&(g=be(new vc(e,v,m,f)))}}}else g=De(g,y=>{if(m!==nr&&y!==nr){const v=T0(l,m,void 0,e,f);if(v)return be(new vc(e,v,m,f))}return we(y)});if(a&&!f.disableChecks)if(Co(g)){if(g._tag==="Success"){const y=g===fs?m:g[Wi];if(y===nr)return g;const v=T0(a,y,void 0,e,f);v&&(g=be(new vc(e,v,y,f)))}}else g=De(g,y=>{if(y!==nr){const v=T0(a,y,void 0,e,f);if(v)return be(new vc(e,v,y,f))}return we(y)});return g},h=r===void 0?p:r(p);return c?(m,f)=>{const g=d??=c.map(_=>t(_.to));let y=m,v=g[g.length-1](m,f);for(let _=c.length-1;_>=0;_--)if(v=u[_](v,y,f),_!==0){const b=g[_-1];v._tag==="Success"?(y=v[Wi],v=b(y,f)):v=yd(v,w=>{const x=b(w,f);return x===fs?Fu(w):x})}if(v._tag==="Success"){const _=v[Wi],b=h(_,f);return b===fs?v:b}return v=O0e(e,m,f,v),yd(v,_=>{const b=h(_,f);return b===fs?Fu(_):b})}:h}var M8,R0e,O0e,Rxn=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/interpreter.js"(){ro(),gt(),$p(),Df(),Cs(),_8(),M8=(e,t,n)=>e===fs?n(t):yd(e,n),R0e=e=>yd(e,Rge),O0e=(e,t,n,i)=>$u(i,r=>t8(()=>uA(r,o=>new eat(e,o,t,n))))}});function Oxn(e,t){let n;return(i,r)=>{if(i!==nr)try{const o=e(i,r);if(o!==cq)return o===i?fs:Fu(o)}catch(o){return Tf(o)}return(n??=t())(i,r)}}function aq(e,t,n){const i=e(t);if(i.compiled===void 0||Object.hasOwn(i,n))return i[n];let r;return(o,s)=>(r??=i[n])(o,s)}function rm(e){const t=P0e.get(e);if(t!==void 0)return t;const n=Vct===void 0?new D0e(e):new Qct(e,Vct(e,rm),rm);return P0e.set(e,n),n}var cq,P0e,Vct,jA,Kct,M0e,Jct,D0e,Qct,Pxn=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/compilerRegistry.js"(){gt(),Rxn(),_8(),cq=Symbol(),P0e=new WeakMap,jA=!1,Kct=e=>jA?aq(rm,e,"parser"):rm(e).parser,M0e=e=>jA?aq(rm,e,"makeEffect"):rm(e).makeEffect,Jct=e=>Gct(e,M0e),D0e=class{ast;constructor(e){this.ast=e}get decodeEffect(){return this.cachedDecodeEffect??=sq(this.ast,Kct)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=sq(this.ast,M0e,Jct)}},Qct=class extends D0e{compiled;resolve;constructor(e,t,n){super(e),this.compiled=t,this.resolve=n}save(e,t){return Object.defineProperty(this,e,{value:t}),t}operation(e){const t=this.compiled;return typeof t=="function"?t(this.ast,this.resolve,e):t?.[e]}get is(){return this.save("is",this.operation("is"))}get decode(){return this.save("decode",this.operation("decode"))}get make(){return this.save("make",this.operation("make"))}get decodeEffect(){return this.save("decodeEffect",this.operation("decodeEffect")??sq(this.ast,e=>aq(this.resolve,e,"parser")))}get parser(){const e=this.decode;return e===void 0?this.decodeEffect:this.save("parser",Oxn(e,()=>this.decodeEffect))}get makeEffect(){const e=this.operation("makeEffect");if(e!==void 0)return this.save("makeEffect",e);const t=n=>aq(this.resolve,n,"makeEffect");return this.save("makeEffect",sq(this.ast,t,n=>Gct(n,t)))}}}});function Xct(e){const t=e.ast;let n;return(i,r)=>(n??=$0e(lut,Bu(t)))(i,r?.disableChecks?r?.parseOptions?{...r.parseOptions,disableChecks:!0}:{disableChecks:!0}:r?.parseOptions)}function Yct(e){const t=Xct(e);return(n,i)=>{const r=Of(t(n,i));return yr(r)?Mt(r.value):(em(r.cause,"Option adapter can only return none for schema issues"),$t())}}function Zct(e){return qxn(Bu(e.ast))}function eut(e){return L0e(e.ast)}function Mxn(e){if(!jA){const r=zA(uq(e));return o=>{const s=r(o,I0);return yr(s)?!0:(em(s.cause,"Type guard adapter can only return false for schema issues"),!1)}}const t=rm(e),n=t.is;if(n!==void 0)return r=>{try{return n(r,I0)}catch(o){return em(B7(o),"Type guard adapter can only return false for schema issues"),!1}};const i=t.parser;return r=>{const o=Of(N0e(i(r,I0),r));return yr(o)?!0:(em(o.cause,"Type guard adapter can only return false for schema issues"),!1)}}function L0e(e){const t=Bu(e);let n=i=>(n=Mxn(t),n(i));return i=>n(i)}function Dxn(e){const t=uq(e);return(n,i)=>{const r=Of(t(n,i));if(!yr(r))return em(r.cause,"Issue adapter can only return schema issues")}}function Lxn(e,t){const n=Bu(e.ast),i=rm(n).parser(t,I0),r=Of(N0e(i,t));if(Va(r)){const o=em(r.cause,"Assertion adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:o})}}function Ma(e,t){const n=uq(e.ast);return t===void 0?n:(i,r)=>n(i,lq(t,r))}function Nxn(e,t){return zA(Ma(e,t))}function tut(e,t){return iut(Ma(e,t))}function $xn(e,t){return rut(Ma(e,t))}function Uxn(e,t){return jA?out(e.ast,t):F0e(Ma(e,t))}function WA(e,t){const n=uq(im(e.ast));return t===void 0?n:(i,r)=>n(i,lq(t,r))}function Fxn(e,t){return zA(WA(e,t))}function nut(e,t){return iut(WA(e,t))}function Bxn(e,t){return rut(WA(e,t))}function jxn(e,t){return jA?out(im(e.ast),t):F0e(WA(e,t))}function uq(e){return $0e(uut,e)}function N0e(e,t){return e===fs?we(t):Co(e)?e[Wi]===nr?D8(nr):e:yd(e,D8)}function $0e(e,t){let n;return(i,r)=>{const o=(n??=e(t))(i,r??I0);return o===fs?we(i):Co(o)?o[Wi]===nr?D8(nr):o:yd(o,D8)}}function zA(e){return(t,n)=>Of(e(t,n))}function iut(e){const t=zA(e);return(n,i)=>{const r=t(n,i);return yr(r)?Mt(r.value):(em(r.cause,"Option adapter can only return none for schema issues"),$t())}}function rut(e){const t=zA(e);return(n,i)=>{const r=t(n,i);return yr(r)?oi(r.value):hi(em(r.cause,"Result adapter can only return schema issues"))}}function out(e,t){let n;return(i,r)=>(n??=Wxn(rm(e),t))(i,r)}function Wxn(e,t){const n=e.decode;let i;const r=n===void 0?(o,s=I0)=>(i??=U0e(e))(o,s):(o,s=I0)=>{if(o===nr)return(i??=U0e(e))(o,s);let a;try{a=n(o,s)}catch(c){throw em(B7(c),"Sync adapter can only throw schema issues"),c}return a!==cq?a:(i??=U0e(e))(o,s)};return t===void 0?r:(o,s)=>r(o,lq(t,s))}function U0e(e){return F0e($0e(()=>e.decodeEffect,e.ast))}function F0e(e){const t=zA(e);return(n,i)=>{const r=t(n,i);if(yr(r))return r.value;const o=em(r.cause,"Sync adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:o})}}function zxn(e,t){const n=Of(e);if(yr(n))return n.value;const i=em(n.cause,t);throw new Error("Schema validation failed",{cause:i})}function qxn(e){let t,n;return(i,r)=>{t??=rm(e);const o=r?.disableChecks?r.parseOptions?{...r.parseOptions,disableChecks:!0}:{disableChecks:!0}:r?.parseOptions??I0,s=t.make;if(s!==void 0&&i!==nr){let c;try{c=s(i,o)}catch(u){throw em(B7(u),"Constructor adapter can only throw schema issues"),u}if(c!==cq&&c!==nr)return c}const a=(n??=t.makeEffect)(i,o);return zxn(N0e(a,i),"Constructor adapter can only throw schema issues")}}var B0e,sut,j0e,aut,cut,W0e,lq,D8,uut,lut,jv=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/SchemaParser.js"(){ro(),gt(),Xr(),Cs(),iat(),Pxn(),_8(),ri(),ki(),$p(),Df(),B0e=Ma,sut=tut,j0e=Uxn,aut=WA,cut=nut,W0e=jxn,lq=(e,t)=>t?{...e,...t}:e,D8=e=>e===nr?be(new ir):we(e),uut=e=>rm(e).parser,lut=e=>rm(e).makeEffect}});function Wv(e,t){function n(){}const i=Object.setPrototypeOf(n,dut);return t&&(Object.hasOwn(t,"name")||Object.hasOwn(t,"length")||Object.hasOwn(t,"__proto__"))?Object.defineProperties(i,Object.getOwnPropertyDescriptors({...t})):Object.assign(i,t),i[z0e]=t,i.ast=e,i}var dq,z0e,dut,put=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/make.js"(){Zi(),$p(),jv(),dq="~effect/Schema/Schema",z0e=Symbol(),dut={[dq]:dq,get make(){const e=Zct(this);return Object.defineProperty(this,"make",{value:e,enumerable:!0}),e},get makeEffect(){const e=Xct(this);return Object.defineProperty(this,"makeEffect",{value:e,enumerable:!0}),e},get makeOption(){const e=Yct(this);return Object.defineProperty(this,"makeOption",{value:e,enumerable:!0}),e},pipe(){return ji(this,arguments)},annotate(e){return this.rebuild(Aw(this.ast,e))},annotateKey(e){return this.rebuild(s0e(this.ast,e))},check(...e){return this.rebuild(Tw(this.ast,e))},rebuild(e){return Wv(e,this[z0e])}}}});function hut(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function q0e(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function mut(e){return encodeURI(hut(e)).replace(/#/g,"%23")}function fut(e){if(e.length===0||e==="#")return"";if(!e.startsWith("#"))return;const t=e.slice(1);try{if(encodeURI(t).replace(/%25/g,"%").replace(/#/g,"%23")!==t)return;const n=decodeURIComponent(t);return n.startsWith("/")&&!/~(?:[^01]|$)/.test(n)?n:void 0}catch{return}}function Hxn(e){const t=fut(e);return t===void 0?void 0:t.length===0?[]:t.slice(1).split("/").map(q0e)}function Gxn(e){return e.reduce((t,n)=>`${t}/${mut(n)}`,"#")}var pq=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/JsonPointer.js"(){}});function gut(e,t){return e===t||e===(t.endsWith("#")?t.slice(0,-1):`${t}#`)}function yut(e){return{dialect:"draft-07",...Yxn(e,n2n)}}function Vxn(e,t){return n(e,!1,!0);function n(i,r,o=!1){if(!hd(i))return i;const s=r||!o&&but(i.$id),a={};for(const c of Object.keys(i)){const u=i[c];let l=u;switch(c){case"$defs":case"properties":case"patternProperties":case"dependentSchemas":l=H0e(u,d=>n(d,s))??u;break;case"allOf":case"anyOf":case"oneOf":case"prefixItems":l=Array.isArray(u)?u.map(d=>n(d,s)):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,s)}dn(a,c,l)}return t(a,s),a}}function Kxn(e,t){return Vxn(e,n=>{Jxn(n,t)})}function Jxn(e,t){typeof e.$ref=="string"&&dn(e,"$ref",t(e.$ref,"$ref")),typeof e.$dynamicRef=="string"&&dn(e,"$dynamicRef",t(e.$dynamicRef,"$dynamicRef"))}function H0e(e,t){if(!hd(e))return;const n={};for(const i of Object.keys(e))dn(n,i,t(e[i],i));return n}function Qxn(e,t,n){const i=new Map,r=[];let o=hq;function s(p,h=[],m=[]){if(h.length===0&&t?.trackIds){const f=hd(p)?l(p):void 0;o=_ut(f,hq)??hq}return u(p,h,m,{sourceRoot:[],targetRoot:[],uri:o})}function a(){for(const[p,h,m]of r){let f=h;const g=vut(h,m);if(g!==void 0){const y=Hxn(g.hash);if(g.hash="",y!==void 0){const v=i.get(wut(g.href,y));v!==void 0&&(f=Xxn(h,v))}}dn(p,"$ref",f)}}const c=n(s);return a(),c;function u(p,h,m,f){if(typeof p=="boolean")return d(h,m,f),t?.booleanAdapter?.(p)??p;if(!hd(p))return p;let g=f;const y=l(p);if(h.length>0&&t?.trackIds&&but(y)){const b=_ut(y,f.uri);b!==void 0&&(g={parent:f,sourceRoot:h,targetRoot:m,uri:b})}d(h,m,g);const v=g.uri,_={isDocumentRoot:h.length===0,schema(b,w,x=w){return u(b,[...h,w],[...m,x],g)},schemaAt(b,w,x){return u(b,[...h,...w],[...m,...x],g)},schemaArray(b,w,x=w){return Array.isArray(b)?b.map((S,T)=>u(S,[...h,w,String(T)],[...m,x,String(T)],g)):b},schemaMap(b,w,x=w){return hd(b)?H0e(b,(S,T)=>u(S,[...h,w,T],[...m,x,T],g)):b},reference(b,w){typeof w=="string"?r.push([b,w,v]):dn(b,"$ref",w)}};return e(p,_)}function l(p){return t?.ignoreRefSiblings===!0&&typeof p.$ref=="string"?void 0:p.$id}function d(p,h,m){m.parent!==void 0&&d(p,h,m.parent),i.set(wut(m.uri,p.slice(m.sourceRoot.length)),h.slice(m.targetRoot.length))}}function vut(e,t){return URL.canParse(e,t)?new URL(e,t):void 0}function _ut(e,t){if(typeof e!="string")return;const n=vut(e,t);if(n!==void 0)return n.hash="",n.href}function Xxn(e,t){const n=e.indexOf("#");return n===-1&&t.length===0?e:`${n===-1?e:e.slice(0,n)}${Gxn(t)}`}function wut(e,t){return`${e}\0${JSON.stringify(t)}`}function but(e){return typeof e=="string"&&e.length>0&&e[0]!=="#"}function Yxn(e,t,n){return Qxn(t,{...n,trackIds:!0},i=>({schema:i(e.schema),definitions:H0e(e.definitions,(r,o)=>i(r,["$defs",o],["definitions",o]))}))}function Zxn(e,t,n,i,r,o=Sut){let s;if(o.has(t))s=i.schemaMap(n,t);else if(kut.has(t))s=i.schemaArray(n,t);else if(r.has(t))s=i.schema(n,t);else return!1;return dn(e,t,s),!0}function l4(e,t,n){throw new Error(`Cannot convert JSON Schema keyword "${e}" to ${t}: ${n}`)}function e2n(e,t,n,i){for(const r of t)Object.hasOwn(e,r)&&l4(r,n,`it is not active in ${i} but would become active in the target`)}function t2n(e,t,n,i,r){n.isDocumentRoot?dn(e,"$schema",gut(t,G0e)?i:t):gut(t,G0e)||l4("$schema",r,"an embedded resource cannot declare a different dialect")}function n2n(e,t){e2n(e,Iut,"Draft-07","Draft 2020-12");const n={};let i,r,o;for(const s of Object.keys(e)){const a=e[s];if(!Zxn(n,s,a,t,Eut))switch(s){case"$ref":i=a;break;case"$schema":t2n(n,a,t,xut,"Draft-07");break;case"$id":case"$anchor":break;case"$defs":dn(n,"definitions",t.schemaMap(a,s,"definitions"));break;case"prefixItems":r=a;break;case"items":o=a;break;case"dependentRequired":case"dependentSchemas":case"minContains":case"maxContains":break;case"$dynamicRef":case"$dynamicAnchor":case"$vocabulary":case"unevaluatedProperties":case"unevaluatedItems":l4(s,"Draft-07","the target dialect has no equivalent");case"required":if(Array.isArray(a)&&a.length===0)break;dn(n,s,a);break;default:dn(n,s,a)}}if(i2n(n,r,o,t),Object.hasOwn(e,"contains")){const s=e.minContains,a=e.maxContains;(s!==void 0&&s!==1||a!==void 0)&&l4("minContains/maxContains","Draft-07","contains cardinality cannot be represented"),Object.hasOwn(e,"minContains")&&dn(n,"minContains",s)}else Object.hasOwn(e,"minContains")&&dn(n,"minContains",e.minContains),Object.hasOwn(e,"maxContains")&&dn(n,"maxContains",e.maxContains);return o2n(e,n,t,"draft-07"),a2n(e,n,"$id","Draft-07"),r2n(n,i,t),n}function i2n(e,t,n,i){if(t===void 0){n!==void 0&&dn(e,"items",i.schema(n,"items"));return}dn(e,"items",i.schemaArray(t,"prefixItems","items")),n!==void 0&&dn(e,"additionalItems",i.schema(n,"items","additionalItems"))}function r2n(e,t,n){if(t!==void 0)if(typeof t=="string"&&Object.keys(e).length>0){const i={};n.reference(i,t),s2n(e,i)}else n.reference(e,t)}function o2n(e,t,n,i){const r=hd(e.dependentRequired)?e.dependentRequired:void 0,o=hd(e.dependentSchemas)?e.dependentSchemas:void 0;if(r===void 0&&o===void 0)return;const s={},a=new Set([...Object.keys(r??{}),...Object.keys(o??{})]);for(const c of a){const u=r?.[c],l=o?.[c],d=i==="draft-04"&&Array.isArray(u)&&u.length===0;l===void 0?d||dn(s,c,u):u===void 0||d?dn(s,c,n.schemaAt(l,["dependentSchemas",c],["dependencies",c])):dn(s,c,{allOf:[n.schemaAt(l,["dependentSchemas",c],["dependencies",c,"allOf","0"]),{required:u}]})}Object.keys(s).length>0&&dn(t,"dependencies",s)}function s2n(e,t){Array.isArray(e.allOf)?e.allOf.push(t):dn(e,"allOf",[t])}function a2n(e,t,n,i){const r=e.$id,o=e.$anchor;if(o===void 0){r!==void 0&&dn(t,n,r);return}(typeof o!="string"||!Aut.test(o))&&l4("$anchor",i,"the anchor is not valid"),Tut.test(o)||l4("$anchor",i,"the anchor cannot be represented as a plain-name fragment identifier"),r===void 0?dn(t,n,`#${o}`):l4("$anchor",i,"it cannot be combined with the schema $id")}var xut,G0e,hq,Sut,kut,Eut,V0e,c2n,u2n,Aut,Tut,Iut,mq=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/JsonSchema.js"(){qa(),pq(),Yn(),xut="http://json-schema.org/draft-07/schema#",G0e="https://json-schema.org/draft/2020-12/schema",hq="https://effect.invalid/.json-schema/",Sut=new Set(["properties","patternProperties"]),kut=new Set(["allOf","anyOf","oneOf"]),Eut=new Set(["not","additionalProperties","propertyNames","contains","if","then","else","contentSchema"]),V0e=["$anchor","$defs","$dynamicAnchor","$dynamicRef","$vocabulary","contentSchema","dependentRequired","dependentSchemas","maxContains","minContains","prefixItems","unevaluatedItems","unevaluatedProperties"],c2n=[...V0e,"deprecated"],u2n=[...V0e,"$comment","$id","$schema","const","contains","contentEncoding","contentMediaType","else","examples","if","patternProperties","propertyNames","then"],Aut=/^[A-Za-z_][-A-Za-z0-9._]*$/,Tut=/^[A-Za-z][-A-Za-z0-9._:]*$/,Iut=["additionalItems","definitions","dependencies"]}});function Cut(e){return Wv(L8(e.ast),{schema:e})}function K0e(e){return e.constructorDefault===void 0?e:new C0(e.isOptional,e.isMutable,void 0,e.annotations)}function Rut(e){if(e.propertySignatures.some(t=>typeof t.name!="string"))throw new globalThis.Error("Objects property names must be strings",{cause:e})}function Out(e){return t=>{const n=[...t].sort((r,o)=>e(R0(r))-e(R0(o)));return n.some((r,o)=>r!==t[o])?n:t}}function l2n(e,t){switch(e._tag){case"Declaration":{const n=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!Mu(n))return gs(e,[I0e]);const i=e.typeParameters.map(o=>Wv(R0(o))),r=n(i);return r===void 0?e:gs(e,[I8(r,t)])}case"Unknown":return gs(e,[I0e]);case"ObjectKeyword":return gs(e,[zct]);case"Undefined":case"Void":case"Literal":case"Number":return e.toCodecJson();case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return Rut(e),e.recur(t,tq);case"Union":{const n=Dut(e.types);return n!==e.types?new wd(n,e.options,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t):e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}function Put(e){return Wv(J0e(Bu(e.ast)))}function d2n(e,t){switch(e._tag){case"Declaration":{const n=e.annotations?.toCodecIso??e.annotations?.toCodec;if(Mu(n)){const i=n(e.typeParameters.map(r=>Wv(r)));return gs(e,[I8(i,t)])}return e}case"Arrays":case"Objects":case"Union":case"Suspend":return e.recur(t)}return e}function Mut(e){return Wv(Y0e(e.ast),{schema:e})}function p2n(e){return Wv(eye(e.ast))}function h2n(e,t,n){switch(e._tag){case"Declaration":{const i=e.typeParameters.map(u=>Wv(t(R0(u)))),r=e.annotations?.toCodecStringTree;if(Mu(r)){const u=r(i);return u===void 0?e:gs(e,[I8(u,t)])}const o=e.annotations?.toCodecJson,s=Mu(o)?o(i):void 0,a=s===void 0?e.annotations?.toCodec:void 0,c=s??(Mu(a)?a(i):void 0);return c===void 0?n(e):gs(e,[I8(c,t)])}case"Null":return gs(e,[Nut]);case"Boolean":return gs(e,[$ut]);case"Unknown":case"ObjectKeyword":return gs(e,[C0e]);case"Enum":case"Number":case"Literal":case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return Rut(e),e.recur(t,tq);case"Union":{const i=Lut(e.types);return i!==e.types?new wd(i,e.options,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t):e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}function m2n(e){return e._tag==="Declaration"||e._tag==="Arrays"||e._tag==="Objects"||e._tag==="Union"||e._tag==="Suspend"?e.recur(eye):e}var L8,Dut,J0e,Lut,Nut,$ut,Q0e,X0e,Y0e,Z0e,eye,N8=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/toCodec.js"(){Nn(),Yn(),$p(),PA(),zz(),put(),L8=LA(e=>{const t=l2n(e,L8),n=e.context;return t===e||n===void 0?t:r0e(t,K0e(n))}),Dut=Out(e=>{switch(e._tag){case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}}),J0e=C5(e=>{const t=d2n(e,J0e);return t!==e&&e.context!==void 0?r0e(t,K0e(e.context)):t}),Lut=Out(e=>{switch(e._tag){case"Null":case"Boolean":case"Number":case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}}),Nut=new ca(new tm("null"),new wo(Pi(()=>null),Pi(()=>"null"))),$ut=new ca(new wd([new tm("true"),new tm("false")]),new wo(Pi(e=>e==="true"),Fz())),Q0e=new wo(Pi(e=>typeof e=="string"?[e]:e),r4()),X0e=e=>e.transformation===Q0e,Y0e=LA(e=>{const t=h2n(e,Y0e,n=>{throw new globalThis.Error("Missing structural codec for StringTree",{cause:n})});return t!==e&&e.context!==void 0?r0e(t,K0e(e.context)):t},{stopAt:X0e}),Z0e=e=>_d(e)?FA(Iw):Iw,eye=LA(e=>{const t=m2n(e);if(a0e(t)){const n=Gz(new wd([new Nf(t.isMutable,t.elements.map(Z0e),t.rest.map(Z0e)),nm],{mode:"anyOf"}),t,Q0e);return _d(e)?FA(n):n}return t},{stopAt:X0e})}}),f2n,Cw,tye=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/RegExp.js"(){f2n=globalThis.RegExp,Cw=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&")}});function d4(e,t){return t.length>0&&(e+=`
|
|
90
90
|
at ${XGe(t)}`),new Error(e)}var g2n=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/errors.js"(){ma()}});function Uut(e){return`#/$defs/${mut(e)}`}function $8(e,t){if(e===void 0)return;const n={},i=e.title;typeof i=="string"&&(n.title=i);const r=e.description,o=e.expected;typeof r=="string"?n.description=r:t?.generateDescriptions===!0&&typeof o=="string"&&(n.description=o);const s=e.default;NA(s)&&(n.default=s);const a=e.examples;Array.isArray(a)&&NA(a)&&(n.examples=a);const c=e.readOnly;typeof c=="boolean"&&(n.readOnly=c);const u=e.writeOnly;typeof u=="boolean"&&(n.writeOnly=u);const l=e.format;typeof l=="string"&&(n.format=l);const d=e.contentEncoding;typeof d=="string"&&(n.contentEncoding=d);const p=e.contentMediaType;typeof p=="string"&&(n.contentMediaType=p);const h=e.contentSchema;if(NA(h)&&(n.contentSchema=h),t?.includeAnnotationKey!==void 0)for(const[m,f]of Object.entries(e))Wut.has(m)||!t.includeAnnotationKey(m)||NA(f)&&dn(n,m,f);return Object.keys(n).length===0?void 0:n}function Fut(e){let t=e.type==="number"||e.type==="integer"?e.type:void 0,n=e;if(t!==void 0&&(n={...e},delete n.type),Array.isArray(n.allOf)){const i=[];let r=!1;for(const o of n.allOf){const s=Fut(o);s.type!==void 0&&(r=!0,(t===void 0||s.type==="integer")&&(t=s.type)),Object.keys(s.schema).length>0&&i.push(s.schema)}if(r){const{allOf:o,...s}=n;n=i.length===0?s:{...s,allOf:i}}}return{type:t,schema:n}}function y2n(e){if(!Array.isArray(e.anyOf)||e.anyOf.length!==2||e.anyOf[0]?.type!=="number")return!1;const t=e.anyOf[1];return t?.type==="string"&&Array.isArray(t.enum)&&t.enum.length===3&&t.enum.includes("NaN")&&t.enum.includes("Infinity")&&t.enum.includes("-Infinity")}function fq(e,t){return Object.keys(e).every(n=>t.includes(`|${n}|`))}function But(e,t){return typeof e.$ref!="string"&&t.every(n=>!Object.hasOwn(e,n))}function U8(e,t,n){if(Object.keys(e).length===0)return t;const i=Object.keys(t);if(i.length===0)return e;const r=e.type==="number"||e.type==="integer"?e.type:void 0,o=y2n(e);if(r!==void 0||o){const a=Fut(t);if(a.type!==void 0){const c=r==="integer"||a.type==="integer"?"integer":"number",u={...e,type:c};o&&delete u.anyOf;const l=Object.keys(a.schema);return l.length===0?u:fq(a.schema,yq)&&But(u,l)?{...u,...a.schema}:U8(u,a.schema,n)}}if(n&&But(e,i))return{...e,...t};const s=Array.isArray(t.allOf)&&i.length===1?t.allOf:[t];return Array.isArray(e.allOf)?{...e,allOf:[...e.allOf,...s]}:typeof e.$ref=="string"?{allOf:[e,...s]}:{...e,allOf:s}}function nye(e,t=new Set){return typeof e=="boolean"?e:t.has(e)?!0:(t.add(e),e.every(n=>nye(n,t)))}function v2n(e){return Array.isArray(e)}function _2n(e,t,n,i){const r=new Map,o=new Map,s=new WeakMap,a=new Map,c=new Map,u=Object.keys(n);for(const w of u)m(w,["references",w]);const l=D2(e,(w,x)=>v(w,t[x],[]));for(const[w,x]of a.values())if(!nye(w))for(const S of x)Array.isArray(S.oneOf)&&(S.anyOf=S.oneOf,delete S.oneOf);for(const w of u){const x=n[w],S=g(x);if(S===void 0)continue;const T=r.get(w)[0],C=c.get(S),O=C?.find(P=>ii(r.get(P)[0],T));O===void 0?C===void 0?c.set(S,[w]):C.push(w):o.set(w,O)}const d=D2(l,f),p={};for(const w of u)o.has(w)||dn(p,w,f(r.get(w)[0]));return{dialect:"draft-2020-12",schemas:d,definitions:p};function h(w){return Array.isArray(w.oneOf)&&a.get(w.oneOf)?.[1].push(w),w}function m(w,x){if(!Object.hasOwn(n,w))throw d4(`Invalid reference ${w}`,[...x,"$ref"]);const S=r.get(w);if(S!==void 0)return S;const T=[{},[]];return r.set(w,T),T[0]=v(n[w],["references",w],T[1]),T}function f(w){return Kxn(w,x=>{const S=fut(x);if(S===void 0){if(/^#(?:\/|%2f)/i.test(x))throw new Error(`Invalid JSON Pointer URI fragment ${JSON.stringify(x)}`);return x}if(!S.startsWith("/$defs/"))return x;const T=S.indexOf("/",7),C=o.get(q0e(S.slice(7,T<0?void 0:T)));return C===void 0?x:x.replace(/^#(?:\/|%2f).*?(?:\/|%2f).*?(?=\/|%2f|$)/i,Uut(C))})}function g(w){if(w._tag==="Reference")return;const x=w.checks.length===0?w.annotations:w.checks[w.checks.length-1].annotations;return typeof x?.identifier!="string"&&typeof x?.[TA]=="string"?x[TA]:void 0}function y(w,x,S,T){const C=w.annotations,O=C?.toJsonSchema;if(O!==void 0){const j=w.representation?.schemas?.map((L,G)=>v(L,[...S,"representation","schemas",G],T))??[],J=O({type:x,schemas:j}),ne=v2n(J);ne&&T.push(!1);const se=ne?J[0]:J,W=$8(C,i),K=W===void 0?se:{...se,...W},M=W===void 0?iye:zut;return[K,w._tag==="Filter"&&fq(K,M)&&(W===void 0||fq(W,yq))?!0:void 0]}if(w._tag==="Filter"){T.push(!1);return}const P=w.checks.flatMap((j,J)=>{const ne=y(j,x,[...S,"checks",J],T);return ne===void 0?[]:[ne[0]]});if(P.length===0)return;const N=$8(C,i),U={allOf:P};return[N===void 0?U:{...U,...N}]}function v(w,x,S){if(w._tag==="Reference")return S.push(m(w.$ref,x)[1]),{$ref:Uut(w.$ref)};const T=s.get(w);if(T!==void 0)return S.push(T[1]),T[0];const C=[];S.push(C);let O=_(w,x,C);const P=$8(w.annotations,i);P!==void 0&&(O={...O,...P});for(let N=0;N<w.checks.length;N++){const U=typeof O.type=="string"&&w2n(O.type)?O.type:void 0,j=y(w.checks[N],U,[...x,"checks",N],C);j!==void 0&&(O=U8(O,...j))}return s.set(w,[O,C]),h(O)}function _(w,x,S){switch(w._tag){case"Any":case"Unknown":return{};case"ObjectKeyword":return{anyOf:[{type:"object"},{type:"array"}]};case"Void":case"Undefined":case"Null":return{type:"null"};case"BigInt":return{type:"string",allOf:[{pattern:"^-?\\d+$"}]};case"Symbol":return{type:"string",allOf:[{pattern:"^Symbol\\(([\\s\\S]*)\\)$"}]};case"UniqueSymbol":return globalThis.Symbol.keyFor(w.symbol)===void 0?{not:{}}:{type:"string",enum:[globalThis.String(w.symbol)]};case"Declaration":return S.push(!1),{};case"Suspend":return v(w.thunk,[...x,"thunk"],S);case"Never":return{not:{}};case"String":return{type:"string"};case"Number":return{anyOf:[{type:"number"},{type:"string",enum:["NaN","Infinity","-Infinity"]}]};case"Boolean":return{type:"boolean"};case"Literal":{const T=w.literal;return typeof T=="bigint"?{type:"string",enum:[globalThis.String(T)]}:{type:typeof T,enum:[T]}}case"Enum":{const T=w.enums.map(([C,O],P)=>{if(typeof O=="number"&&!globalThis.Number.isFinite(O))throw d4(`Invalid numeric enum value ${globalThis.String(O)}`,[...x,"enums",P,1]);return{type:typeof O,enum:[O],title:C}});return T.length===0?{not:{}}:{anyOf:T}}case"TemplateLiteral":return{type:"string",pattern:`^${w.parts.map(gq).join("")}$`};case"Arrays":{if(w.rest.length>1)throw d4("Invalid schema representation document",[...x,"rest"]);const T={type:"array"};let C=w.elements.length;const O=w.elements.map((P,N)=>{P.isOptional&&C--;const U=v(P.type,[...x,"elements",N,"type"],S),j=$8(P.annotations,i);return j===void 0?U:h(U8(U,j))});if(O.length>0?(T.prefixItems=O,T.maxItems=w.elements.length,C>0&&(T.minItems=C)):T.items=!1,w.rest.length===1){delete T.maxItems;const P=v(w.rest[0],[...x,"rest",0],S);Object.keys(P).length>0?T.items=P:delete T.items}return T}case"Objects":{if(w.propertySignatures.length===0&&w.indexSignatures.length===0)return{not:{type:"null"}};const T={type:"object"},C={},O=[];for(let ne=0;ne<w.propertySignatures.length;ne++){const se=w.propertySignatures[ne];if(typeof se.name!="string")throw d4("Invalid schema representation document",[...x,"propertySignatures",ne,"name"]);const W=se.name,K=v(se.type,[...x,"propertySignatures",ne,"type"],S),M=$8(se.annotations,i);dn(C,W,M===void 0?K:h(U8(K,M))),se.isOptional||O.push(W)}w.propertySignatures.length>0&&(T.properties=C),O.length>0&&(T.required=O);const P={},N=[],U=[];let j=!1;for(let ne=0;ne<w.indexSignatures.length;ne++){const se=w.indexSignatures[ne];let W=v(se.type,[...x,"indexSignatures",ne,"type"],S);ii(W,{not:{}})&&(W=!1),U.push(W);const K=b(se.parameter,[...x,"indexSignatures",ne,"parameter"],new Set);if(K===void 0){j=!0,S.push(!1);continue}if(K.length===0)N.push(W);else for(const M of K){const L=P[M];dn(P,M,L===void 0?W:L===!1||W===!1?!1:h(U8(L,W)))}}const J=Object.keys(P).length>0;if(J&&(T.patternProperties=P),j&&i?.onExcessProperty==="error"){const ne=[];w.propertySignatures.length>0&&ne.push({enum:Object.keys(C)});for(let se=0;se<w.indexSignatures.length;se++)ne.push(v(w.indexSignatures[se].parameter,[...x,"indexSignatures",se,"parameter"],S));T.propertyNames=ne.length===1?ne[0]:{anyOf:ne},T.additionalProperties=U.length===1?U[0]:{anyOf:U},N.length>0&&(T.allOf=N.map(se=>({type:"object",additionalProperties:se})))}else N.length===0?T.additionalProperties=j||i?.onExcessProperty!=="error":N.length===1&&w.propertySignatures.length===0&&!J?T.additionalProperties=N[0]:N.length>0&&(T.allOf=N.map(ne=>({type:"object",additionalProperties:ne})));return typeof T.additionalProperties=="object"&&T.additionalProperties!==null&&Object.keys(T.additionalProperties).length===0&&delete T.additionalProperties,T}case"Union":{const T=[],C=w.types.map((P,N)=>v(P,[...x,"types",N],T));if(S.push(T),C.length===0)return{not:{}};const O=w.options?.mode??"anyOf";if(O==="anyOf"&&C.length>1){const P=b2n(C);if(P!==void 0)return P}return O==="oneOf"&&a.set(C,[T,[]]),{[O]:C}}}}function b(w,x,S){switch(w._tag){case"Reference":{if(!Object.hasOwn(n,w.$ref))throw d4(`Invalid reference ${w.$ref}`,[...x,"$ref"]);if(m(w.$ref,x),S.has(w.$ref))return;const T=new Set(S).add(w.$ref);return b(n[w.$ref],["references",w.$ref],T)}case"String":{if(w.checks.length===0)return[];if(w.checks.length!==1||w.checks[0]._tag!=="Filter"||w.checks[0].annotations?.toJsonSchema===void 0)return;const T=[],C=v(w,x,T);return nye(T)&&C.type==="string"&&typeof C.pattern=="string"&&fq(C,"|type|pattern|title|description|default|examples|readOnly|writeOnly|")?[C.pattern]:void 0}case"TemplateLiteral":return w.checks.length===0?[`^${w.parts.map(gq).join("")}$`]:void 0;case"Union":{if(w.types.length===0||w.checks.length>0||w.options?.mode==="oneOf")return;const T=[];for(let C=0;C<w.types.length;C++){const O=b(w.types[C],[...x,"types",C],S);if(O===void 0)return;if(O.length===0)return[];T.push(...O)}return T}default:throw d4("Invalid schema representation document",x)}}}function w2n(e){return e==="string"||e==="number"||e==="boolean"||e==="array"||e==="object"||e==="null"||e==="integer"}function b2n(e){let t;const n=[];for(const i of e){if(Object.keys(i).length!==2||i.type===void 0||!Array.isArray(i.enum)||i.enum.length===0)return;if(t===void 0)t=i.type;else if(i.type!==t)return;for(const o of i.enum){if(n.includes(o))return;n.push(o)}}return{type:t,enum:n}}function gq(e){switch(e._tag){case"Literal":return Cw(globalThis.String(e.literal));case"String":return Dct;case"Number":return Jz;case"TemplateLiteral":return e.parts.map(gq).join("");case"Union":return`(?:${e.types.map(gq).join("|")})`;default:throw d4("Invalid schema representation document",[])}}function jut(e,t){const n=_2n([e.representation],[["representation"]],e.references,t);return{dialect:n.dialect,schema:n.schemas[0],definitions:n.definitions}}var Wut,iye,yq,zut,qut=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/toJsonSchemaDocument.js"(){du(),Zo(),pq(),mq(),tye(),$p(),g2n(),qa(),Sw(),Wut=new Set([...Qst,TA,...Kst]),iye="|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|",yq="|title|description|default|examples|readOnly|writeOnly|",zut=iye+yq}});function $f(e){return e===void 0?void 0:{annotations:e}}function rye(e,t){const{references:n,representations:i}=x2n([e],t);return{representation:i[0],references:n}}function x2n(e,t){const n={},i=new Map,r=new Set,o=new Map,s=new Set;for(const w of e)h(w);const a=t?.referencePolicy??Hut;for(const w of o.values())for(const x of w.values()){const S=a({ast:x.ast,occurrences:x.occurrences,identifier:x.identifier});if(S!==void 0){const T=S===x.identifier||!S.endsWith("_")?"_":"";x.reference=u(S,x,T)}else x.isRecursive&&(x.reference=u(`${x.ast._tag}_`,x,""))}return{representations:D2(e,w=>f(w)),references:n};function u(w,x,S="_"){let T=w,C=0;for(;i.has(T);){if(i.get(T)===x)return T;T=`${w}${S}${++C}`}return i.set(T,x),T}function l(w,x,S){const T=x.fallback;return T!==void 0?Cge(w)===T?w:Aw(w,{[TA]:T}):S===x.identifier?w:Aw(w,{identifier:S})}function d(w,x){if(!Object.hasOwn(n,w)&&!r.has(w)){r.add(w);const S=g(x);r.delete(w),dn(n,w,S)}return{_tag:"Reference",$ref:w}}function p(w){const x=T8(w),S=A8(x);let T=Pz(x);const C=T===void 0?(x!==w?Pz(w):void 0)??Cge(x):void 0;C!==void 0&&(T=`${C}Encoded`);let O=o.get(S);O===void 0&&(O=new Map,o.set(S,O));let P=O.get(T);return P===void 0&&(P={ast:S,identifier:T,fallback:C,occurrences:0,isRecursive:!1,reference:void 0},O.set(T,P)),P}function h(w){const x=p(w),S=x.ast;if(x.occurrences++,s.has(x)){x.isRecursive=!0;return}if(!(x.occurrences>1)){switch(s.add(x),m(S.checks),S._tag){case"Declaration":case"Arrays":case"Objects":case"Union":S.recur(T=>(h(T),T));break;case"TemplateLiteral":S.parts.forEach(h);break;case"Suspend":h(S.thunk());break}s.delete(x)}}function m(w){w?.forEach(x=>{x.annotations?.representation?.schemas?.forEach(S=>h(Bu(S))),x._tag==="FilterGroup"&&m(x.checks)})}function f(w){const x=p(w),S=x.ast,T=x.reference;if(T!==void 0){const C=x.identifier===void 0?S:l(S,x,T);return d(T,C)}return g(S)}function g(w){const x=y(w.checks);switch(w._tag){case"Declaration":return{_tag:"Declaration",typeParameters:w.typeParameters.map(S=>f(S)),checks:x,..._(w.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:w._tag,checks:x,...$f(w.annotations)};case"Literal":return{_tag:"Literal",literal:w.literal,checks:x,...$f(w.annotations)};case"UniqueSymbol":return{_tag:"UniqueSymbol",symbol:w.symbol,checks:x,...$f(w.annotations)};case"Enum":return{_tag:"Enum",enums:w.enums,checks:x,...$f(w.annotations)};case"TemplateLiteral":return{_tag:"TemplateLiteral",parts:w.parts.map(S=>f(S)),checks:x,...$f(w.annotations)};case"Arrays":return{_tag:"Arrays",elements:w.elements.map(S=>{const T=T8(S),C=T.context?.annotations;return{isOptional:_d(T),type:f(S),...$f(C)}}),rest:w.rest.map(S=>f(S)),checks:x,...$f(w.annotations)};case"Objects":return{_tag:"Objects",propertySignatures:w.propertySignatures.map(S=>{const T=T8(S.type),C=T.context?.annotations;return{name:S.name,type:f(S.type),isOptional:_d(T),isMutable:_xn(T),...$f(C)}}),indexSignatures:w.indexSignatures.map(S=>({parameter:f(S.parameter),type:f(S.type)})),checks:x,...$f(w.annotations)};case"Union":return{_tag:"Union",types:w.types.map(S=>f(S)),...w.options===void 0?{}:{options:w.options},checks:x,...$f(w.annotations)};case"Suspend":return{_tag:"Suspend",checks:[],thunk:f(w.thunk()),...$f(w.annotations)}}}function y(w){return w?.map(v)??[]}function v(w){switch(w._tag){case"Filter":return{_tag:"Filter",aborted:w.aborted,...b(w.annotations)};case"FilterGroup":return{_tag:"FilterGroup",checks:D2(w.checks,v),...b(w.annotations)}}}function _(w){if(w===void 0)return;const{representation:x,...S}=w;return{...x===void 0?void 0:{representation:x},...Object.keys(S).length===0?void 0:{annotations:S}}}function b(w){if(w===void 0)return;const{representation:x,...S}=w,T=x===void 0?void 0:x.schemas===void 0?x:{...x,schemas:x.schemas.map(C=>f(Bu(C)))};return{...T===void 0?void 0:{representation:T},...Object.keys(S).length===0?void 0:{annotations:S}}}}var Hut,Gut=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/toRepresentation.js"(){du(),$p(),qa(),Sw(),Hut=({identifier:e})=>e}});function Vut(e){return yr(e)?e.value:{issues:[{message:ame(e.cause)}]}}function S2n(e,t){const n=Ma(e),i={errors:"all",...t?.parseOptions},r=Yst(t),o=s=>{const a=new xj("sync"),c=Mp(GW(n(s,i),{onFailure:r,onSuccess:l=>({value:l})}),{scheduler:a});c.currentDispatcher?.flush();const u=c.pollUnsafe();return u?Vut(u):new Promise(l=>{c.addObserver(d=>{l(Vut(d))})})};if(Object.hasOwn(e,"~standard")){const s=e;return"validate"in s["~standard"]||Object.assign(s["~standard"],{validate:o}),s}return Object.assign(e,{"~standard":{version:1,vendor:"effect",validate:o}})}function k2n(e){const t=rye(L8(e));return jut(t)}function Kut(e,t){const n=k2n(e);if(t==="draft-2020-12"){const i=n.schema;return Object.keys(n.definitions).length>0&&(i.$defs=n.definitions),i}else if(t==="draft-07"){const i=yut(n),r=i.schema;return Object.keys(i.definitions).length>0&&(r.definitions=i.definitions),r}throw new globalThis.Error(`Unsupported target: ${t}`)}function E2n(e){const t={input(n){return Kut(e.ast,n.target)},output(n){return Kut(Bu(e.ast),n.target)}};if(Object.hasOwn(e,"~standard")){const n=e;return"jsonSchema"in n["~standard"]||Object.assign(n["~standard"],{jsonSchema:t}),n}return Object.assign(e,{"~standard":{version:1,vendor:"effect",jsonSchema:t}})}var A2n=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/standardSchema.js"(){ro(),gt(),Xr(),mq(),Sj(),$p(),Df(),jv(),N8(),qut(),Gut()}});function T2n(e,t){const n=[];return oye(e,t,"",n),n}function oye(e,t,n,i){if(!Object.is(e,t)){if(Array.isArray(e)&&Array.isArray(t)){const r=e.length,o=t.length,s=Math.min(r,o);for(let a=0;a<s;a++)oye(e[a],t[a],`${n}/${a}`,i);for(let a=r-1;a>=o;a--)i.push({op:"remove",path:`${n}/${a}`});for(let a=r;a<o;a++)i.push({op:"add",path:`${n}/${a}`,value:t[a]});return}if(vq(e)&&vq(t)){const r=Object.keys(e),o=Object.keys(t),s=Array.from(new Set([...r,...o])).sort();for(const a of s){const c=`${n}/${hut(a)}`,u=Object.hasOwn(e,a),l=Object.hasOwn(t,a);u&&l?oye(e[a],t[a],c,i):!u&&l?i.push({op:"add",path:c,value:t[a]}):i.push({op:"remove",path:c})}return}i.push({op:"replace",path:n,value:t})}}function I2n(e,t){let n=t;for(const i of e)n=R2n(n,i);return n}function vq(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function C2n(e){if(e==="")return[];if(e.charCodeAt(0)!==47)throw new Error(`Invalid JSON Pointer, it must start with "/": ${JSON.stringify(e)}`);return e.split("/").slice(1).map(q0e)}function Jut(e){if(!/^(0|[1-9]\d*)$/.test(e))throw new Error(`Invalid array index: "${e}"`);return Number(e)}function R2n(e,t){if(t.path===""){if(t.op==="remove")throw new Error("Unsupported operation at the root");return t.value}const n=O2n(e,t.path);if(n===null)throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`);const{lastToken:i,parent:r,stack:o}=n;if(Array.isArray(r)){if(i==="-"&&t.op!=="add")throw new Error(`"-" is not valid for ${t.op} at "${t.path}".`);const s=i==="-"?r.length:Jut(i),a=t.op==="add"?r.length:r.length-1;if(s>a)throw new Error(`Array index out of bounds at "${t.path}".`);const c=r.slice();return t.op==="add"?c.splice(s,0,t.value):t.op==="remove"?c.splice(s,1):c[s]=t.value,Qut(o,c)}if(vq(r)){if(t.op!=="add"&&!Object.hasOwn(r,i))throw new Error(`Property "${i}" does not exist at "${t.path}".`);const s={...r};return t.op==="remove"?delete s[i]:dn(s,i,t.value),Qut(o,s)}throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`)}function O2n(e,t){const n=C2n(t);if(n.length===0)return null;const i=n[n.length-1],r=[];let o=e;for(let s=0;s<n.length-1;s++){const a=n[s];if(Array.isArray(o)){const c=Jut(a);if(c>=o.length)return null;r.push({container:o,token:c}),o=o[c];continue}if(vq(o)){if(!Object.hasOwn(o,a))return null;r.push({container:o,token:a}),o=o[a];continue}return null}return{stack:r,parent:o,lastToken:i}}function Qut(e,t){let n=t;for(let i=e.length-1;i>=0;i--){const{container:r,token:o}=e[i];if(Array.isArray(r)){const s=r.slice();s[o]=n,n=s}else{const s={...r};dn(s,o,n),n=s}}return n}var Xut=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/JsonPatch.js"(){qa(),pq()}});function P2n(e){const t=Cut(e),n=W0e(t),i=j0e(t);return{empty:[],diff:(r,o)=>T2n(n(r),n(o)),combine:(r,o)=>[...r,...o],patch:(r,o)=>{const s=n(r),a=I2n(o,s);return Object.is(a,s)?r:i(a)}}}var M2n=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/toDifferJsonPatch.js"(){Xut(),jv(),N8()}});function D2n(e,t){const n=Pz(e.ast)??Jst(e.ast),i=aut(Mut(e));return r=>i(r).pipe(mt(o=>L2n(o,{rootName:n,...t})))}function L2n(e,t){const n=t.rootName??"root",i=t.arrayItemName??"item",r=t.pretty??!0,o=t.indent??" ",s=t.sortKeys??!0,a=new Set,c=[];return l(n,e,0),c.join(r?`
|
|
91
|
-
`:"");function u(d,p){c.push(r?o.repeat(d)+p:p)}function l(d,p,h,m){const{attrs:f,safe:g}=p4.tagInfo(d,m);if(p===void 0)u(h,`<${g}${f}/>`);else if(typeof p=="string")u(h,`<${g}${f}>${p4.escapeText(p)}</${g}>`);else if(typeof p!="object"||p===null)u(h,`<${g}${f}>${p4.escapeText(Qt(p))}</${g}>`);else{if(a.has(p))throw new globalThis.Error("Cycle detected while serializing to XML.",{cause:p});a.add(p);try{if(globalThis.Array.isArray(p)){if(p.length===0){u(h,`<${g}${f}/>`);return}u(h,`<${g}${f}>`);for(const _ of p)l(i,_,h+1);u(h,`</${g}>`);return}const y=p,v=Object.keys(y);if(s&&v.sort(),v.length===0){u(h,`<${g}${f}/>`);return}u(h,`<${g}${f}>`);for(const _ of v)l(p4.parseTagName(_).safe,y[_],h+1,_);u(h,`</${g}>`)}finally{a.delete(p)}}}}var p4,N2n=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/toEncoderXml.js"(){gt(),ma(),jv(),Sw(),N8(),p4={escapeText(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},escapeAttribute(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},parseTagName(e){const t=e;let n=e;return/^[A-Za-z_]/.test(n)||(n="_"+n),n=n.replace(/[^A-Za-z0-9._-]/g,"_"),/^xml/i.test(n)&&(n="_"+n),{safe:n,changed:n!==t}},tagInfo(e,t){const{changed:n,safe:i}=p4.parseTagName(e),o=n||t&&t!==e?` data-name="${p4.escapeAttribute(t??e)}"`:"";return{safe:i,attrs:o}}}}});function Rw(e){const t=g8(e)?.toEquivalence;if(t)return t(C8(e)?e.typeParameters.map(Rw):[]);switch(e._tag){case"Never":return D5();case"Declaration":return $2n(e);case"Null":case"Undefined":case"Void":case"Unknown":case"Any":case"String":case"Number":case"Boolean":case"BigInt":case"Symbol":case"Literal":case"UniqueSymbol":case"ObjectKeyword":case"Enum":case"TemplateLiteral":return ii;case"Arrays":{const n=e.elements.map(Rw),i=e.rest.map(Rw),[r,...o]=i,s=o.length;return yp((a,c)=>{if(!Array.isArray(a)||!Array.isArray(c))return!1;const u=a.length;if(u!==c.length)return!1;let l=0;for(;l<Math.min(u,e.elements.length);l++)if(!n[l](a[l],c[l]))return!1;if(i.length>0){for(;l<u-s;l++)if(!r(a[l],c[l]))return!1;for(let d=0;d<s;d++)if(!o[d](a[l+d],c[l+d]))return!1}return!0})}case"Objects":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return ii;const n=e.propertySignatures.map(r=>Rw(r.type)),i=e.indexSignatures.map(r=>Rw(r.type));return yp((r,o)=>{if(!hd(r)||!hd(o))return!1;for(let s=0;s<n.length;s++){const a=e.propertySignatures[s],c=a.name,u=Object.hasOwn(r,c),l=Object.hasOwn(o,c);if(_d(a.type)&&u!==l||u&&l&&!n[s](r[c],o[c]))return!1}for(let s=0;s<i.length;s++){const a=e.indexSignatures[s],c=DA(r,a.parameter),u=DA(o,a.parameter);if(c.length!==u.length)return!1;for(let l=0;l<c.length;l++){const d=c[l];if(!Object.hasOwn(o,d)||!i[s](r[d],o[d]))return!1}}return!0})}case"Union":{const n=Bu(e).types,i=t0e(n),r=n.map((o,s)=>[L0e(o),Rw(e.types[s])]);return yp((o,s)=>{const a=i(o,!1);for(let c=0;c<a.length;c++){const[u,l]=r[a[c]];if(u(o)&&u(s))return l(o,s)}return!1})}case"Suspend":{let n;return yp((i,r)=>(n??=sye(e.thunk()))(i,r))}}}function $2n(e){const t=e.annotations?.representation;if(t===void 0)return ii;switch(t.id){case"effect/schema/Option":{const[n]=h4(e);return(i,r)=>i._tag===r._tag&&(i._tag==="None"||n(i.value,r.value))}case"effect/schema/Result":{const[n,i]=h4(e);return(r,o)=>r._tag===o._tag&&(r._tag==="Success"?n(r.success,o.success):i(r.failure,o.failure))}case"effect/schema/CauseReason":{const[n,i]=h4(e);return Yut(n,i)}case"effect/schema/Cause":{const[n,i]=h4(e);return Zut(n,i)}case"effect/schema/Exit":{const[n,i,r]=h4(e),o=Zut(i,r);return(s,a)=>s._tag===a._tag&&(s._tag==="Success"?n(s.value,a.value):o(s.cause,a.cause))}case"effect/schema/ReadonlyMap":{const[n,i]=h4(e);return FGe(n,i)}case"effect/schema/ReadonlySet":return Ale(h4(e)[0]);case"effect/schema/RegExp":return(n,i)=>n.source===i.source&&n.flags===i.flags;case"effect/schema/URL":return(n,i)=>n.toString()===i.toString();default:return ii}}function h4(e){return e.typeParameters.map(Rw)}function Yut(e,t){return(n,i)=>{if(n._tag!==i._tag)return!1;switch(n._tag){case"Fail":return e(n.error,i.error);case"Die":return t(n.defect,i.defect);case"Interrupt":return n.fiberId===i.fiberId}}}function Zut(e,t){const n=Cle(Yut(e,t));return(i,r)=>n(i.reasons,r.reasons)}var sye,U2n=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/toEquivalence.js"(){Zo(),ff(),Nn(),Yn(),$p(),jv(),Sw(),sye=C5(e=>Rw(e))}});function elt(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 tlt(e,t){const n=elt(e,t);return i=>`Cause([${i.reasons.map(n).join(", ")}])`}function F2n(e,t){const n=new Map;return i(e);function i(s){let a=n.get(s);return a===void 0&&(a=r(s),n.set(s,a)),a}function r(s){const a=g8(s)?.toFormatter;if(typeof a=="function")return a(C8(s)?s.typeParameters.map(i):[]);if(t?.onBefore){const c=t.onBefore(s,i);if(c!==void 0)return c}return o(s)}function o(s){switch(s._tag){default:return Qt;case"Never":return()=>"never";case"Void":return()=>"void";case"Declaration":{const a=s.annotations?.representation;if(a===void 0)return Qt;const c=s.typeParameters.map(i);switch(a.id){case"effect/schema/Option":{const[u]=c;return Oa({onNone:()=>"none()",onSome:l=>`some(${u(l)})`})}case"effect/schema/Result":{const[u,l]=c;return kv({onSuccess:d=>`success(${u(d)})`,onFailure:d=>`failure(${l(d)})`})}case"effect/schema/CauseReason":return elt(c[0],c[1]);case"effect/schema/Cause":return tlt(c[0],c[1]);case"effect/schema/Exit":{const[u,l,d]=c,p=tlt(l,d);return h=>{switch(h._tag){case"Success":return`Exit.Success(${u(h.value)})`;case"Failure":return`Exit.Failure(${p(h.cause)})`}}}case"effect/schema/ReadonlyMap":{const[u,l]=c;return d=>{const p=d.size;if(p===0)return"ReadonlyMap(0) {}";const h=globalThis.Array.from(d.entries()).sort().map(([m,f])=>`${u(m)} => ${l(f)}`);return`ReadonlyMap(${p}) { ${h.join(", ")} }`}}case"effect/schema/HashMap":{const[u,l]=c;return d=>{const p=ust(d);if(p===0)return"HashMap(0) {}";const h=wz(d).sort().map(([m,f])=>`${u(m)} => ${l(f)}`);return`HashMap(${p}) { ${h.join(", ")} }`}}case"effect/schema/ReadonlySet":{const[u]=c;return l=>{const d=l.size;if(d===0)return"ReadonlySet(0) {}";const p=globalThis.Array.from(l.values()).sort().map(h=>`${u(h)}`);return`ReadonlySet(${d}) { ${p.join(", ")} }`}}case"effect/schema/HashSet":{const[u]=c;return l=>{const d=yst(l);if(d===0)return"HashSet(0) {}";const p=globalThis.Array.from(l).sort().map(h=>`${u(h)}`);return`HashSet(${d}) { ${p.join(", ")} }`}}case"effect/schema/Chunk":{const[u]=c;return l=>{const d=Trt(l);if(d===0)return"Chunk(0) {}";const p=globalThis.Array.from(l).sort().map(h=>`${u(h)}`);return`Chunk(${d}) { ${p.join(", ")} }`}}default:return Qt}}case"Arrays":{const a=s.elements.map(p=>i(p)),c=s.rest.map(i),[u,...l]=c,d=l.length;return p=>{const h=[];let m=0;for(;m<a.length;m++)if(p.length<m+1){if(_d(s.elements[m]))continue}else h.push(a[m](p[m]));if(c.length>0){for(;m<p.length-d;m++)h.push(u(p[m]));for(let f=0;f<d;f++)h.push(l[f](p[m+f]))}return"["+h.join(", ")+"]"}}case"Objects":{const a=s.propertySignatures.map(u=>i(u.type)),c=s.indexSignatures.map(u=>i(u.type));return s.propertySignatures.length===0&&s.indexSignatures.length===0?Qt:u=>{const l=[],d=new Set;for(let p=0;p<a.length;p++){const h=s.propertySignatures[p],m=h.name;d.add(m),!(_d(h.type)&&!Object.hasOwn(u,m))&&l.push(`${v2(m)}: ${a[p](u[m])}`)}for(let p=0;p<c.length;p++){const h=DA(u,s.indexSignatures[p].parameter);for(const m of h)d.has(m)||(d.add(m),l.push(`${v2(m)}: ${c[p](u[m])}`))}return l.length>0?"{ "+l.join(", ")+" }":"{}"}}case"Union":{const a=Bu(s).types,c=t0e(a),u=a.map((l,d)=>[L0e(l),i(s.types[d])]);return l=>{const d=c(l,!1);for(let p=0;p<d.length;p++){const[h,m]=u[d[p]];if(h(l))return m(l)}return Qt(l)}}case"Suspend":{let a;return c=>(a??=i(s.thunk()))(c)}}}}var B2n=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/toFormatter.js"(){Ffe(),ma(),pge(),fge(),ri(),ki(),$p(),jv(),Sw()}});function nlt(e,t){return e.some(n=>n===t||typeof n=="number"&&String(n)===t)}function _q(e,t){const n={};for(const i of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,i))continue;const r=t(i,e[i]);if(r){const[o,s]=r;dn(n,o,s)}}return n}var aye,cye,uye,lye,va,m4,F8=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Struct.js"(){Nn(),qa(),aye=me(2,(e,t)=>_q(e,(n,i)=>nlt(t,n)?[n,i]:void 0)),cye=me(2,(e,t)=>_q(e,(n,i)=>nlt(t,n)?void 0:[n,i])),uye=me(2,(e,t)=>({...e,...t})),lye=me(2,(e,t)=>_q(e,(n,i)=>[Object.hasOwn(t,n)?t[n]:n,i])),va=e=>e,m4=me(2,(e,t)=>_q(e,(n,i)=>[n,t(i)]))}});function j2n(e,t){return Uf(qA("Iso",e,t))}function ilt(e,t){return Uf(qA("Lens",e,t))}function qA(e,t,n){return[{_tag:"PrimitiveNode",kind:e,get:t,set:n}]}function f4(e,t){if(e.length===0)return t;if(t.length===0)return e;const n=e.slice();for(let i=0;i<t.length;i++){const r=t[i],o=n[n.length-1];o._tag==="PathNode"&&r._tag==="PathNode"?n[n.length-1]=new hye([...o.path,...r.path]):o._tag==="CheckNode"&&r._tag==="CheckNode"?n[n.length-1]=new bq([...o.checks,...r.checks]):n.push(r)}return n}function W2n(e,t){return Uf(qA("Optional",e,t))}function Uf(e){let t=e[0]??olt;if(e.length>1){const n=e.reduce((i,r)=>H2n(i,r.kind),"Iso");t={kind:n,get:z2n(e,n),set:q2n(e,n)}}switch(t.kind){case"Iso":return new slt(e,t.get,t.set);case"Lens":return new alt(e,t.get,t.set);case"Prism":return new clt(e,t.get,t.set);case"Optional":return new B8(e,t.get,t.set)}}function wq(e){if(Array.isArray(e))return e.slice();if(typeof e=="object"&&e!==null){const t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)throw new Error("Cannot clone object with non-Object constructor or null prototype");return{...e}}return e}function z2n(e,t){return n=>{for(let i=0;i<e.length;i++){const r=e[i],o=r.get(n);if(dye(r.kind)){if(kn(o))return o;n=o.success}else n=o}return dye(t)?oi(n):n}}function q2n(e,t){return rlt(t)?n=>{for(let i=e.length-1;i>=0;i--)n=e[i].set(n);return n}:(n,i)=>{const r=e.length,o=new Array(r);for(let s=0;s<r;s++){o[s]=i;const a=e[s];if(dye(a.kind)){const c=a.get(i);if(kn(c))return c;i=c.success}else i=a.get(i)}for(let s=r-1;s>=0;s--){const a=e[s];if(rlt(a.kind))n=a.set(n);else if(a.kind==="Lens")n=a.set(n,o[s]);else{const c=a.set(n,o[s]);if(kn(c))return c;n=c.success}}return t==="Optional"?oi(n):n}}function dye(e){return e==="Prism"||e==="Optional"}function rlt(e){return e==="Iso"||e==="Prism"}function H2n(e,t){return e==="Iso"?t:t==="Iso"||e===t?e:"Optional"}function pye(){return ult}var olt,hye,bq,B8,slt,alt,clt,ult,llt=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Optic.js"(){du(),Nn(),qa(),Yn(),ki(),$p(),Df(),F8(),olt={kind:"Iso",get:an,set:an},hye=class{_tag="PathNode";kind="Lens";path;get;set;constructor(e){this.path=e,this.get=t=>{let n=t;for(let i=0;i<e.length;i++)n=n[e[i]];return n},this.set=(t,n)=>{const i=wq(n);let r=i,o=0;for(;o<e.length-1;o++){const s=e[o];dn(r,s,wq(r[s])),r=r[s]}return dn(r,e[o],t),i}}},bq=class{_tag="CheckNode";kind="Prism";checks;get;set=an;constructor(e){this.checks=e,this.get=t=>Sxn(e,t)}},B8=class{node;getResult;replaceResult;constructor(e,t,n){this.node=e,this.getResult=t,this.replaceResult=n}replace(e,t){return J5(this.replaceResult(e,t),()=>t)}modify(e){return t=>J5(jc(this.getResult(t),n=>this.replaceResult(e(n),t)),()=>t)}compose(e){return Uf(f4(this.node,e.node))}key(e){return Uf(f4(this.node,[new hye([e])]))}optionalKey(e){return Uf(f4(this.node,qA("Lens",t=>t[e],(t,n)=>{const i=wq(n);return t===void 0?Array.isArray(i)&&(typeof e=="number"||typeof e=="string"&&Nde(e))?i.splice(Number(e),1):delete i[e]:dn(i,e,t),i})))}check(...e){return Uf(f4(this.node,[new bq(e)]))}refine(e,t){return Uf(f4(this.node,[new bq([Gat(e,t)])]))}tag(e){const t=hi(new ir({expected:`${JSON.stringify(e)} tag`}));return Uf(f4(this.node,qA("Prism",n=>n._tag===e?oi(n):t,an)))}at(e,...t){const n=hi(new yc([e],new b8(void 0)));return Uf(f4(this.node,qA("Optional",i=>Object.hasOwn(i,e)?oi(i[e]):n,(i,r)=>{if(Object.hasOwn(r,e)){const o=wq(r);return dn(o,e,i),oi(o)}else return n})))}pick(e){return this.compose(ilt(aye(e),(t,n)=>({...cye(n,e),...t})))}omit(e){return this.compose(ilt(cye(e),(t,n)=>({...aye(n,e),...t})))}notUndefined(){return this.refine(g2,{expected:"a value other than `undefined`"})}forEach(e){const t=e(pye());return W2n(n=>Bh(this.getResult(n),i=>{const r=[];for(let o=0;o<i.length;o++){const s=t.getResult(i[o]);yl(s)&&r.push(s.success)}return r}),(n,i)=>jc(this.getResult(i),r=>{const o=[];for(let a=0;a<r.length;a++)yl(t.getResult(r[a]))&&o.push(a);if(n.length!==o.length)return hi(new ir({message:`each: replacement length mismatch: ${n.length} !== ${o.length}`}));const s=r.slice();for(let a=0;a<o.length;a++){const c=o[a],u=t.replaceResult(n[a],r[c]);if(kn(u))return hi(new yc([c],u.failure));s[c]=u.success}return this.replaceResult(s,i)}))}modifyAll(e){return t=>J5(jc(this.getResult(t),n=>this.replaceResult(n.map(e),t)),()=>t)}},slt=class extends B8{get;set;constructor(e,t,n){super(e,i=>oi(t(i)),i=>oi(n(i))),this.get=t,this.set=n}replace(e,t){return this.set(e)}modify(e){return t=>this.set(e(this.get(t)))}},alt=class extends B8{get;constructor(e,t,n){super(e,i=>oi(t(i)),(i,r)=>oi(n(i,r))),this.get=t,this.replace=n}modify(e){return t=>this.replace(e(this.get(t)),t)}},clt=class extends B8{set;constructor(e,t,n){super(e,t,(i,r)=>oi(n(i))),this.set=n}replace(e,t){return this.set(e)}modify(e){return t=>J5(Bh(this.getResult(t),n=>this.set(e(n))),()=>t)}},ult=Uf([])}});function G2n(e){const t=Put(e);return j2n(W0e(t),j0e(t))}function V2n(e){return pye()}function K2n(e){return pye()}var J2n=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/toIso.js"(){llt(),jv(),N8()}});function Q2n(e){return Sn(e,HA)&&e[HA]===HA}var HA,X2n=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schemaError.js"(){Yn(),HA="~effect/Schema/SchemaError"}}),bd,om,sm,O0,xq,g4,xd,Ow,dlt,j8,GA,W8,z8,mye,Sq,plt,hlt,mlt,flt,glt,ylt,vlt,_lt,wlt,blt,xlt,VA,Slt,ua,klt,Elt,Alt,q8,Tlt,kq,Eq,fye,Ilt,Clt,gye,Aq,Rlt,Tq,yye,vye,zv,Iq,_ye,KA,Cq,wye,bye,xye,Sye,Olt,Plt,Mlt,kye,Dlt,Llt,Nlt,$lt,Rq,Ult,Flt,Eye=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/net/NetAddress.js"(){jh(),Zo(),sa(),no(),Yn(),ki(),bd="~effect/net/NetAddress",om=e=>e.value,sm=e=>e,O0=e=>e.bytes,xq=class extends Wo("NetAddressError"){},g4=e=>Sn(e,bd),xd=e=>g4(e)&&e._tag==="Ipv4Address",Ow=e=>g4(e)&&e._tag==="Ipv6Address",dlt=e=>xd(e)||Ow(e),j8=e=>xd(e)?32:128,GA=e=>g4(e)&&e._tag==="MacAddress",W8=e=>g4(e)&&e._tag==="InetAddressV4",z8=e=>g4(e)&&e._tag==="InetAddressV6",mye=e=>W8(e)||z8(e),Sq=e=>g4(e)&&e._tag==="UnixPathAddress",plt=e=>mye(e)||Sq(e),hlt={_tag:"Ipv4Address",[bd]:bd,[Er](e){return xd(e)&&om(this)===om(e)},[kr](){return uu(xi(ylt,om(this)|0))},toString(){return zv(this)},toJSON(){return this.toString()},[Ar](){return this.toJSON()}},mlt={_tag:"Ipv6Address",[bd]:bd,[Er](e){if(!Ow(e))return!1;const t=sm(this),n=sm(e);return t.w0===n.w0&&t.w1===n.w1&&t.w2===n.w2&&t.w3===n.w3},[kr](){const e=sm(this);let t=xi(vlt,e.w0|0);return t=xi(t,e.w1|0),t=xi(t,e.w2|0),uu(xi(t,e.w3|0))},toString(){return zv(this)},toJSON(){return this.toString()},[Ar](){return this.toJSON()}},flt={_tag:"MacAddress",[bd]:bd,[Er](e){return GA(e)&&glt(O0(this),O0(e))},[kr](){return xi(_lt,gp(O0(this)))},toString(){return gye(this)},toJSON(){return this.toString()},[Ar](){return this.toJSON()}},glt=(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},ylt=ps("Ipv4Address"),vlt=ps("Ipv6Address"),_lt=ps("MacAddress"),wlt=e=>{const t=Object.create(hlt);return t.value=e>>>0,Object.freeze(t)},blt=(e,t,n,i)=>{const r=Object.create(mlt);return r.w0=e>>>0,r.w1=t>>>0,r.w2=n>>>0,r.w3=i>>>0,Object.freeze(r)},xlt=(e,t,n,i)=>(e<<24|t<<16|n<<8|i)>>>0,VA=e=>[e>>>24,e>>>16&255,e>>>8&255,e&255],Slt=e=>{const t=Object.assign(Object.create(flt),{bytes:new Uint8Array(e)});return Object.freeze(t)},ua=(e,t)=>hi(new xq({input:e,message:t})),klt=e=>e.every(t=>Number.isInteger(t)&&t>=0&&t<=255)?oi(wlt(xlt(e[0],e[1],e[2],e[3]))):ua(e,"octets must be integers from 0 through 255"),Elt=e=>e.every(t=>Number.isInteger(t)&&t>=0&&t<=65535)?oi(blt(e[0]*65536+e[1],e[2]*65536+e[3],e[4]*65536+e[5],e[6]*65536+e[7])):ua(e,"segments must be integers from 0 through 65535"),Alt=e=>/^(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/.test(e)?oi(Slt(new Uint8Array(e.split(":").map(t=>Number.parseInt(t,16))))):ua(e,"expected six two-digit hexadecimal octets separated by colons"),q8=e=>{const t=e.split(".");if(t.length!==4||t.some(i=>!/^\d{1,3}$/.test(i)))return ua(e,"expected exactly four decimal octets");if(t.some(i=>i.length>1&&i[0]==="0"))return ua(e,"leading zeroes are not allowed");const n=t.map(Number);return n.some(i=>i>255)?ua(e,"octets must be at most 255"):klt([n[0],n[1],n[2],n[3]])},Tlt=e=>{if(e.includes("[")||e.includes("]")||e.includes("%"))return ua(e,"brackets and zone identifiers are not valid in a bare IPv6 address");const t=e.split("::");if(t.length>2)return ua(e,"only one compression marker is allowed");const n=t[0]===""?[]:t[0].split(":"),i=t.length===2&&t[1]!==""?t[1].split(":"):[];if(n.some(l=>l==="")||i.some(l=>l===""))return ua(e,"empty segments are only valid in the compression marker");const r=i.length>0?i[i.length-1]:n.length>0?n[n.length-1]:"";let o;if(r.includes(".")){if(t.length===2&&i.length===0)return ua(e,"embedded IPv4 syntax must be trailing");const l=Bh(q8(r),d=>{const p=om(d);return[p>>>16,p&65535]});if(kn(l))return l;o=l.success,i.length>0?i.pop():n.pop()}const s=n.length+i.length+(o?2:0);if(t.length===1?s!==8:s>=8)return ua(e,t.length===1?"expected eight segments":"compression must replace at least one segment");const a=l=>/^[0-9a-fA-F]{1,4}$/.test(l)?Number.parseInt(l,16):void 0,c=n.map(a),u=i.map(a);return c.some(l=>l===void 0)||u.some(l=>l===void 0)?ua(e,"segments must contain one through four hexadecimal digits"):oi([...c,...Array(8-s).fill(0),...u,...o??[]])},kq=e=>jc(Tlt(e),t=>Elt(t)),Eq=e=>e.includes(":")?kq(e):q8(e),fye=e=>VA(om(e)),Ilt=e=>{const{w0:t,w1:n,w2:i,w3:r}=sm(e);return[t>>>16,t&65535,n>>>16,n&65535,i>>>16,i&65535,r>>>16,r&65535]},Clt=e=>{const{w0:t,w1:n,w2:i,w3:r}=sm(e);return[...VA(t),...VA(n),...VA(i),...VA(r)]},gye=e=>Array.from(O0(e),t=>t.toString(16).padStart(2,"0")).join(":"),Aq=e=>O0(e).every(t=>t===255),Rlt=e=>(O0(e)[0]&1)!==0,Tq=e=>(O0(e)[0]&1)===0,yye=e=>(O0(e)[0]&2)!==0,vye=e=>(O0(e)[0]&2)===0,zv=e=>{if(xd(e))return fye(e).join(".");const t=Ilt(e);if(Olt(e))return`::ffff:${t[6]>>8}.${t[6]&255}.${t[7]>>8}.${t[7]&255}`;let n=-1,i=0,r=-1;for(let a=0;a<=8;a++)a<8&&t[a]===0?r===-1&&(r=a):r!==-1&&(a-r>i&&(n=r,i=a-r),r=-1);if(i<2)return t.map(a=>a.toString(16)).join(":");const o=t.slice(0,n).map(a=>a.toString(16)).join(":"),s=t.slice(n+i).map(a=>a.toString(16)).join(":");return`${o}::${s}`},Iq=e=>{if(xd(e))return om(e)===0;const{w0:t,w1:n,w2:i,w3:r}=sm(e);return t===0&&n===0&&i===0&&r===0},_ye=e=>{if(xd(e))return om(e)>>>24===127;const{w0:t,w1:n,w2:i,w3:r}=sm(e);return t===0&&n===0&&i===0&&r===1},KA=e=>GA(e)?Rlt(e):xd(e)?om(e)>>>28===14:sm(e).w0>>>24===255,Cq=e=>GA(e)?Aq(e):om(e)===4294967295,wye=e=>GA(e)?Tq(e):!KA(e)&&!Iq(e)&&(!xd(e)||!Cq(e)),bye=e=>xd(e)?om(e)>>>16===43518:(sm(e).w0>>>16&65472)===65152,xye=e=>{const t=om(e);return t>>>24===10||(t>>>16&65520)===44048||t>>>16===49320},Sye=e=>(sm(e).w0>>>24&254)===252,Olt=e=>{const{w0:t,w1:n,w2:i}=sm(e);return t===0&&n===0&&i===65535},Plt={_tag:"InetAddressV4",[bd]:bd,[Er](e){return W8(e)&&this.port===e.port&&ii(this.address,e.address)},[kr](){return xi(Vn(this.address),md(this.port))},toString(){return Rq(this)},toJSON(){return this.toString()},[Ar](){return this.toJSON()}},Mlt={_tag:"InetAddressV6",[bd]:bd,[Er](e){return z8(e)&&this.port===e.port&&this.scopeId===e.scopeId&&ii(this.address,e.address)},[kr](){return xi(xi(Vn(this.address),md(this.port)),md(this.scopeId))},toString(){return Rq(this)},toJSON(){return this.toString()},[Ar](){return this.toJSON()}},kye=e=>Number.isInteger(e)&&e>=0&&e<=65535,Dlt=(e,t)=>{if(!kye(t))return ua(e,"port must be an integer from 0 through 65535");const n=Object.create(Plt);return n.address=e,n.port=t,oi(Object.freeze(n))},Llt=(e,t,n)=>{if(!kye(t))return ua(e,"port must be an integer from 0 through 65535");const i=n?.scopeId??0;if(!Number.isInteger(i)||i<0||i>4294967295)return ua(e,"scopeId must be an unsigned 32-bit integer");const r=Object.create(Mlt);return r.address=e,r.port=t,r.scopeId=i,oi(Object.freeze(r))},Nlt=e=>{let t,n,i=0;const r=e.startsWith("[");if(r){const o=e.indexOf("]");if(o<0||e[o+1]!==":"||e.indexOf("]",o+1)!==-1)return ua(e,"expected [IPv6]:port");t=e.slice(1,o),n=e.slice(o+2);const s=t.indexOf("%");if(s!==-1){const a=t.slice(s+1);if(t.indexOf("%",s+1)!==-1||!/^\d+$/.test(a))return ua(e,"scope identifier must be decimal");if(i=Number(a),!Number.isInteger(i)||i>4294967295)return ua(e,"scope identifier must be an unsigned 32-bit integer");t=t.slice(0,s)}}else{const o=e.lastIndexOf(":");if(o<0)return ua(e,"expected host:port or [IPv6]:port");if(e.indexOf(":")!==o)return ua(e,"IPv6 addresses must be bracketed");t=e.slice(0,o),n=e.slice(o+1)}return/^(0|[1-9]\d*)$/.test(n)?jc(Eq(t),o=>r!==Ow(o)?ua(e,"only IPv6 addresses use brackets"):Ow(o)?Llt(o,Number(n),{scopeId:i}):Dlt(o,Number(n))):ua(e,"port must be an unpadded decimal integer")},$lt=e=>zv(e.address)+(z8(e)&&e.scopeId!==0?`%${e.scopeId}`:""),Rq=e=>{const t=$lt(e);return W8(e)?`${t}:${e.port}`:`[${t}]:${e.port}`},Ult={_tag:"UnixPathAddress",[bd]:bd,[Er](e){return Sq(e)&&this.path===e.path},[kr](){return xi(ps("UnixPathAddress"),ps(this.path))},toString(){return this.path},toJSON(){return this.toString()},[Ar](){return this.toJSON()}},Flt=e=>{const t=Object.create(Ult);return t.path=e,Object.freeze(t)}}}),Oq,Blt,jlt,H8,Wlt,Pq,G8,Mq,Aye,Tye,Iye,V8,zlt=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/net/IpInterface.js"(){Zo(),sa(),no(),Yn(),ki(),Eye(),Oq="~effect/net/IpInterface",Blt=e=>H8(e)&&xd(e.address),jlt=e=>H8(e)&&Ow(e.address),H8=e=>Sn(e,Oq),Wlt={_tag:"IpInterface",[Oq]:Oq,[Er](e){return H8(e)&&this.prefixLength===e.prefixLength&&ii(this.address,e.address)},[kr](){return xi(Vn(this.address),md(this.prefixLength))},toString(){return V8(this)},toJSON(){return this.toString()},[Ar](){return this.toJSON()}},Pq=(e,t)=>hi(new xq({input:e,message:t})),G8=(e,t)=>{const n=j8(e);if(!Number.isInteger(t)||t<0||t>n)return Pq(e,`prefix length must be an integer from 0 through ${n}`);const i=Object.assign(Object.create(Wlt),{address:e,prefixLength:t});return oi(Object.freeze(i))},Mq=(e,t)=>{const n=e.indexOf("/");if(n===-1&&t?.prefix!=="required")return oi({address:e,prefixLength:void 0});if(n<=0||n!==e.lastIndexOf("/")||n===e.length-1)return Pq(e,"expected an address and prefix length separated by one slash");const i=e.slice(n+1);return/^(0|[1-9][0-9]*)$/.test(i)?oi({address:e.slice(0,n),prefixLength:Number(i)}):Pq(e,"prefix length must be an unpadded ASCII decimal integer")},Aye=(e,t)=>jc(Mq(e,t),n=>jc(q8(n.address),i=>G8(i,n.prefixLength??j8(i)))),Tye=(e,t)=>jc(Mq(e,t),n=>jc(kq(n.address),i=>G8(i,n.prefixLength??j8(i)))),Iye=(e,t)=>jc(Mq(e,t),n=>jc(Eq(n.address),i=>G8(i,n.prefixLength??j8(i)))),V8=e=>`${zv(e.address)}/${e.prefixLength}`}}),Dq,qlt,Hlt,K8,Glt,Vlt,Klt,Jlt,Lq,Qlt,Xlt,Ylt,J8,Y2n=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/net/IpNetwork.js"(){Zo(),sa(),no(),Yn(),ki(),zlt(),Eye(),Dq="~effect/net/IpNetwork",qlt=e=>K8(e)&&xd(e.address),Hlt=e=>K8(e)&&Ow(e.address),K8=e=>Sn(e,Dq),Glt={_tag:"IpNetwork",[Dq]:Dq,[Er](e){return K8(e)&&this.prefixLength===e.prefixLength&&ii(this.address,e.address)},[kr](){return xi(Vn(this.address),md(this.prefixLength))},toString(){return J8(this)},toJSON(){return this.toString()},[Ar](){return this.toJSON()}},Vlt=e=>{const t=Object.assign(Object.create(Glt),{address:e.address,prefixLength:e.prefixLength});return Object.freeze(t)},Klt=e=>xd(e)?fye(e):Clt(e),Jlt=(e,t)=>{const n=Math.floor(t/8),i=t%8;return e.map((r,o)=>o<n?r:o===n&&i!==0?r&(255<<8-i&255):0)},Lq=(e,t)=>jc(G8(e,t),n=>{const i=Klt(e),r=Jlt(i,t);return i.some((o,s)=>o!==r[s])?hi(new xq({input:e,message:"address has non-zero host bits"})):oi(Vlt(n))}),Qlt=e=>jc(Aye(e,{prefix:"required"}),t=>Lq(t.address,t.prefixLength)),Xlt=e=>jc(Tye(e,{prefix:"required"}),t=>Lq(t.address,t.prefixLength)),Ylt=e=>jc(Iye(e,{prefix:"required"}),t=>Lq(t.address,t.prefixLength)),J8=e=>`${zv(e.address)}/${e.prefixLength}`}}),$i={};bi($i,{Any:()=>Kdt,Array:()=>ut,ArrayEnsure:()=>f4n,BigDecimal:()=>yve,BigDecimalFromString:()=>Npt,BigInt:()=>qv,BigIntFromString:()=>wpt,Boolean:()=>ai,BooleanFromBit:()=>Tpt,BooleanLiterals:()=>Zdt,ByteSize:()=>l9,ByteSizeFromBigInt:()=>Upt,ByteSizeFromNumber:()=>Fpt,ByteSizeFromString:()=>$pt,Cause:()=>Fye,CauseReason:()=>Uye,Char:()=>ppt,Chunk:()=>aSn,Class:()=>zve,Cookie:()=>jve,Cookies:()=>Wve,Date:()=>c9,DateFromMillis:()=>gpt,DateFromString:()=>fpt,DateTimeUtc:()=>d9,DateTimeUtcFromDate:()=>Hpt,DateTimeUtcFromMillis:()=>Vpt,DateTimeUtcFromString:()=>Gpt,DateTimeZoned:()=>Ove,DateTimeZonedFromString:()=>Xpt,Defect:()=>nSn,Duration:()=>h9,DurationFromMillis:()=>jht,DurationFromNanos:()=>Bht,DurationFromString:()=>Fht,Enum:()=>c4n,Error:()=>Gq,ErrorInstance:()=>tSn,Exit:()=>cSn,FalseLiterals:()=>Jye,File:()=>lve,Finite:()=>_4,FiniteFromString:()=>_pt,FormData:()=>dve,Graph:()=>pSn,HashMap:()=>hSn,HashSet:()=>mSn,Headers:()=>zht,InetAddress:()=>Fve,InetAddressFromString:()=>Pht,InetAddressV4:()=>Rht,InetAddressV6:()=>Oht,Int:()=>rt,IpAddress:()=>Lw,IpAddressFromString:()=>b4,IpInterface:()=>Lve,IpInterfaceFromString:()=>Aht,IpLinkLocalAddress:()=>pht,IpLinkLocalAddressFromString:()=>hht,IpLoopbackAddress:()=>lht,IpLoopbackAddressFromString:()=>dht,IpMulticastAddress:()=>Ypt,IpMulticastAddressFromString:()=>Zpt,IpNetwork:()=>Uve,IpNetworkFromString:()=>Cht,IpUnicastAddress:()=>nht,IpUnicastAddressFromString:()=>iht,IpUnspecifiedAddress:()=>mht,IpUnspecifiedAddressFromString:()=>fht,Ipv4Address:()=>p9,Ipv4AddressFromString:()=>Wq,Ipv4BroadcastAddress:()=>sht,Ipv4BroadcastAddressFromString:()=>aht,Ipv4Interface:()=>Mve,Ipv4InterfaceFromString:()=>kht,Ipv4Network:()=>Nve,Ipv4NetworkFromString:()=>Tht,Ipv4PrivateAddress:()=>ght,Ipv4PrivateAddressFromString:()=>yht,Ipv6Address:()=>zq,Ipv6AddressFromString:()=>Pve,Ipv6Interface:()=>Dve,Ipv6InterfaceFromString:()=>Eht,Ipv6Network:()=>$ve,Ipv6NetworkFromString:()=>Iht,Ipv6UniqueLocalAddress:()=>vht,Ipv6UniqueLocalAddressFromString:()=>_ht,Json:()=>Id,JsonFromUrlParamsField:()=>qht,JsonObject:()=>qve,Literal:()=>Ce,Literals:()=>ct,MacAddress:()=>Dw,MacAddressFromString:()=>w4,MacBroadcastAddress:()=>cht,MacBroadcastAddressFromString:()=>uht,MacLocallyAdministeredAddress:()=>wht,MacLocallyAdministeredAddressFromString:()=>bht,MacMulticastAddress:()=>eht,MacMulticastAddressFromString:()=>tht,MacUnicastAddress:()=>rht,MacUnicastAddressFromString:()=>oht,MacUniversallyAdministeredAddress:()=>xht,MacUniversallyAdministeredAddressFromString:()=>Sht,MutableJson:()=>Zht,Natural:()=>Mw,Never:()=>Vdt,NonEmptyArray:()=>a9,NonEmptyString:()=>Td,Null:()=>Ed,NullOr:()=>dt,NullishOr:()=>Vye,Number:()=>on,NumberFromString:()=>u9,ObjectKeyword:()=>Xdt,Opaque:()=>E4n,Option:()=>y4,OptionFromNullOr:()=>fSn,OptionFromNullishOr:()=>ySn,OptionFromOptional:()=>_Sn,OptionFromOptionalKey:()=>vSn,OptionFromOptionalNullOr:()=>wSn,OptionFromUndefinedOr:()=>gSn,PropertyKey:()=>jq,ReadonlyMap:()=>iSn,ReadonlySet:()=>rSn,Record:()=>Vs,RecordFromCookies:()=>Wht,RecordFromUrlParams:()=>Hht,Redacted:()=>Pdt,RedactedFromValue:()=>bSn,RegExp:()=>hpt,Result:()=>xSn,SchemaError:()=>r6,SocketAddress:()=>Dht,StandardSchemaV1FailureResult:()=>Apt,String:()=>te,StringForLiteralAutocomplete:()=>Jdt,StringFromBase64:()=>xpt,StringFromBase64Url:()=>Spt,StringFromHex:()=>kpt,StringFromUriComponent:()=>Ept,Struct:()=>V,StructWithRest:()=>h4n,Symbol:()=>s9,TaggedClass:()=>Vht,TaggedError:()=>Kht,TaggedStruct:()=>Fq,TaggedUnion:()=>k4n,TemplateLiteral:()=>s4n,TemplateLiteralParser:()=>a4n,TimeZone:()=>Cve,TimeZoneFromString:()=>Qpt,TimeZoneNamed:()=>Tve,TimeZoneNamedFromString:()=>Jpt,TimeZoneOffset:()=>Kpt,Tree:()=>DSn,Trim:()=>bpt,Trimmed:()=>hve,TrueLiterals:()=>Kye,Tuple:()=>Ka,TupleWithRest:()=>m4n,URL:()=>cve,URLFromString:()=>mpt,URLSearchParams:()=>pve,Uint8Array:()=>c6,Uint8ArrayFromBase64:()=>Ipt,Uint8ArrayFromBase64Url:()=>Cpt,Uint8ArrayFromHex:()=>Rpt,Undefined:()=>s6,UndefinedOr:()=>a6,Union:()=>At,UniqueArray:()=>g4n,UniqueSymbol:()=>u4n,UnixPathAddress:()=>Bve,UnixPathAddressFromString:()=>Mht,Unknown:()=>Sl,UnknownFromJsonString:()=>vpt,UrlParams:()=>qq,Void:()=>Qdt,annotate:()=>e4n,annotateEncoded:()=>t4n,annotateKey:()=>n4n,asserts:()=>Ldt,brand:()=>Q8,catchDecoding:()=>v4n,catchDecodingWithContext:()=>hdt,catchEncoding:()=>_4n,catchEncodingWithContext:()=>mdt,check:()=>Ze,declare:()=>Rr,declareConstructor:()=>Sd,decode:()=>w4n,decodeEffect:()=>Ndt,decodeExit:()=>$dt,decodeOption:()=>Udt,decodePromise:()=>Fdt,decodeResult:()=>Bq,decodeSync:()=>qye,decodeTo:()=>An,decodeUnknownEffect:()=>kd,decodeUnknownExit:()=>Nq,decodeUnknownOption:()=>zye,decodeUnknownPromise:()=>odt,decodeUnknownResult:()=>It,decodeUnknownSync:()=>it,encode:()=>b4n,encodeEffect:()=>Hye,encodeExit:()=>Bdt,encodeKeys:()=>d4n,encodeOption:()=>Wdt,encodePromise:()=>zdt,encodeResult:()=>o9,encodeSync:()=>fu,encodeTo:()=>X8,encodeUnknownEffect:()=>JA,encodeUnknownExit:()=>Rye,encodeUnknownOption:()=>jdt,encodeUnknownPromise:()=>sdt,encodeUnknownResult:()=>$q,encodeUnknownSync:()=>QA,extendTo:()=>p4n,fieldsAssign:()=>l4n,flip:()=>Oye,fromBrand:()=>y4n,fromFormData:()=>oSn,fromJsonString:()=>ti,fromURLSearchParams:()=>sSn,instanceOf:()=>am,is:()=>Bf,isBase64:()=>Mye,isBase64Url:()=>M4n,isBetween:()=>Ad,isBetweenBigDecimal:()=>Lpt,isBetweenBigInt:()=>dpt,isBetweenCodePoints:()=>V4n,isBetweenDate:()=>apt,isBetweenLength:()=>Lye,isBetweenProperties:()=>Z4n,isBetweenSize:()=>Q4n,isCapitalized:()=>F4n,isEndingWith:()=>L4n,isFinite:()=>tpt,isGUID:()=>O4n,isGreaterThan:()=>Js,isGreaterThanBigDecimal:()=>Opt,isGreaterThanBigInt:()=>cpt,isGreaterThanDate:()=>ipt,isGreaterThanOrEqualTo:()=>Wt,isGreaterThanOrEqualToBigDecimal:()=>Ppt,isGreaterThanOrEqualToBigInt:()=>nve,isGreaterThanOrEqualToDate:()=>rpt,isIncluding:()=>N4n,isInt:()=>Ff,isInt32:()=>z4n,isLessThan:()=>npt,isLessThanBigDecimal:()=>Mpt,isLessThanBigInt:()=>upt,isLessThanDate:()=>opt,isLessThanOrEqualTo:()=>Da,isLessThanOrEqualToBigDecimal:()=>Dpt,isLessThanOrEqualToBigInt:()=>lpt,isLessThanOrEqualToDate:()=>spt,isLowercased:()=>U4n,isMaxCodePoints:()=>G4n,isMaxLength:()=>ft,isMaxProperties:()=>Y4n,isMaxSize:()=>J4n,isMinCodePoints:()=>H4n,isMinLength:()=>rn,isMinProperties:()=>X4n,isMinSize:()=>K4n,isMultipleOf:()=>W4n,isNonEmpty:()=>xdt,isPattern:()=>Ks,isPropertyNames:()=>eSn,isSchema:()=>XA,isSchemaError:()=>Zlt,isStartingWith:()=>D4n,isStringBigInt:()=>I4n,isStringFinite:()=>T4n,isStringSymbol:()=>C4n,isTrimmed:()=>wdt,isULID:()=>P4n,isUUID:()=>R4n,isUint32:()=>q4n,isUncapitalized:()=>B4n,isUnique:()=>$ye,isUniqueKey:()=>Sdt,isUppercased:()=>$4n,link:()=>Nr,linkDecoding:()=>YA,make:()=>pn,makeFilter:()=>vn,makeFilterGroup:()=>A4n,makeIsBetween:()=>i9,makeIsGreaterThan:()=>Z8,makeIsGreaterThanOrEqualTo:()=>e9,makeIsLessThan:()=>t9,makeIsLessThanOrEqualTo:()=>n9,makeIsMultipleOf:()=>j4n,middlewareDecoding:()=>ddt,middlewareEncoding:()=>pdt,mutable:()=>jf,mutableKey:()=>Gye,optional:()=>jt,optionalKey:()=>Ue,overrideToCodecIso:()=>PSn,overrideToEquivalence:()=>TSn,overrideToFormatter:()=>ESn,readonlyKey:()=>Gdt,refine:()=>ldt,required:()=>Hdt,requiredKey:()=>qdt,resolveAnnotations:()=>LSn,resolveAnnotationsKey:()=>NSn,revealBottom:()=>Z2n,revealCodec:()=>i4n,suspend:()=>Pw,tag:()=>_a,tagDefaultOmit:()=>S4n,toCodecArrayFromSingle:()=>Xht,toCodecIso:()=>Jht,toCodecJson:()=>Vq,toCodecStringTree:()=>Qht,toDifferJsonPatch:()=>MSn,toEncoded:()=>v4,toEncoderXml:()=>ISn,toEquivalence:()=>Wye,toFormatter:()=>ASn,toIso:()=>CSn,toIsoFocus:()=>OSn,toIsoSource:()=>RSn,toJsonSchemaDocument:()=>Ddt,toRepresentation:()=>n6,toStandardJSONSchemaV1:()=>rdt,toStandardSchemaV1:()=>r4n,toTaggedUnion:()=>_dt,toType:()=>xl,withArrayLengthConstraints:()=>Uq,withConstructorDefault:()=>fdt,withDecodingDefault:()=>ydt,withDecodingDefaultKey:()=>Y8,withDecodingDefaultType:()=>vdt,withDecodingDefaultTypeKey:()=>x4n});function Sd(){return(e,t,n)=>pn(new $A(e.map(qz),i=>t(i.map(r=>pn(r))),n))}function Rr(e,t){return Sd()([],()=>(n,i,r)=>e(n)?we(n):be(new ga(i,n,r)),t)}function Z2n(e){return e}function e4n(e){return t=>t.annotate(e)}function t4n(e){return t=>Oye(Oye(t).annotate(e))}function n4n(e){return t=>t.rebuild(s0e(t.ast,e))}function i4n(e){return e}function Zlt(e){return Q2n(e)}function edt(e){return Co(e)?Cye(e):$u(e,t=>t8(()=>uA(t,n=>new r6(n))))}function Cye(e){return yr(e)?e:w0(uA(e.cause,t=>new r6(t)))}function tdt(e,t){let n;for(const i of e.reasons){if(!nme(i)||!Zlt(i.error))throw new globalThis.Error(t,{cause:e});n??=i.error}if(n===void 0)throw new globalThis.Error(t,{cause:e});return n}function ndt(e){return Rf(e).then(t=>{if(yr(t))return t.value;throw tdt(t.cause,"Promise adapter can only reject schema errors")})}function idt(e){const t=Of(e);if(yr(t))return t.value;throw tdt(t.cause,"Sync adapter can only throw schema errors")}function r4n(e,t){return S2n(e,t)}function rdt(e){return E2n(e)}function kd(e,t){const n=Ma(e,t);return(i,r)=>edt(n(i,r))}function Nq(e,t){const n=Nxn(e,t);return(i,r)=>Cye(n(i,r))}function It(e,t){const n=$xn(e,t);return(i,r)=>Pde(n(i,r),o=>new r6(o))}function odt(e,t){const n=kd(e,t);return(i,r)=>ndt(n(i,r))}function it(e,t){const n=kd(e,t);return(i,r)=>idt(n(i,r))}function JA(e,t){const n=WA(e,t);return(i,r)=>edt(n(i,r))}function Rye(e,t){const n=Fxn(e,t);return(i,r)=>Cye(n(i,r))}function $q(e,t){const n=Bxn(e,t);return(i,r)=>Pde(n(i,r),o=>new r6(o))}function sdt(e,t){const n=JA(e,t);return(i,r)=>ndt(n(i,r))}function QA(e,t){const n=JA(e,t);return(i,r)=>idt(n(i,r))}function XA(e){return Sn(e,i6)&&e[i6]===i6}function o4n(e){return Sn(e,o6)&&e[o6]===o6}function Oye(e){return o4n(e)?e.schema.rebuild(im(e.ast)):pn(im(e.ast),{[o6]:o6,schema:e})}function Ce(e){const t=pn(new tm(e),{literal:e,transform(n){return t.pipe(An(Ce(n),{decode:Pi(()=>n),encode:Pi(()=>e)}))}});return t}function adt(e){return e.map(t=>XA(t)?t.ast:new tm(t))}function s4n(e){return pn(new m0e(adt(e)),{parts:e})}function a4n(e){return pn(axn(adt(e)),{parts:e})}function c4n(e){return pn(new gct(Object.keys(e).filter(t=>typeof e[e[t]]!="number").map(t=>[t,e[t]])),{enums:e})}function u4n(e){return pn(new yct(e))}function Pye(e,t){return pn(e,{fields:t,mapFields(n,i){const r=n(this.fields);return Pye(Zge(r,i?.unsafePreserveChecks?this.ast.checks:void 0),r)}})}function V(e){return Pye(Zge(e,void 0),e)}function l4n(e){return va(t=>t.mapFields(uye(e)))}function d4n(e){return function(t){const n={},i=Object.create(null),r=Object.create(null),o=new Set;for(const s of Reflect.ownKeys(t.fields)){const a=v4(t.fields[s]),c=Object.hasOwn(e,s),u=c?e[s]:s,l=Ydt(u);if(o.has(l))throw new globalThis.Error(`Duplicate encoded keys: ${v2(u)}`);o.add(l),dn(n,u,a),c&&(i[s]=u,r[u]=s)}return V(n).pipe(An(t,oo({decode:lye(r),encode:lye(i)})))}}function p4n(e,t){return n=>{const i=Dde(n.fields,xl),r=V({...i,...e});return n.pipe(An(r,oo({decode:o=>{const s={...o};for(const a in e){const c=t[a],u=c(o);si(u)&&dn(s,a,u.value)}return s},encode:o=>{const s={...o};for(const a in e)delete s[a];return s}})))}}function Vs(e,t){return pn(vxn(e.ast,t.ast),{key:e,value:t})}function h4n(e,t){return pn(lxn(e.ast,t.map(qz)),{schema:e,records:t})}function cdt(e,t){return pn(e,{elements:t,mapElements(n,i){const r=n(this.elements);return cdt(Fat(r,i?.unsafePreserveChecks?this.ast.checks:void 0),r)}})}function Ka(e){return cdt(Fat(e),e)}function m4n(e,t){return pn(dxn(e.ast,t.map(qz)),{schema:e,rest:t})}function Uq(e,t,n){return t!==void 0&&n!==void 0?e.check(Lye(t,n)):t!==void 0?e.check(rn(t)):n!==void 0?e.check(ft(n)):e}function f4n(e){const t=ut(e),n=ut(xl(e)),i=An(Ka([Sl]),oo({decode:r=>[r],encode:([r])=>r}))(e);return pn(At([i,t]).pipe(An(n)).ast,{from:At([e,t]),to:n})}function g4n(e){return ut(e).check($ye())}function udt(e,t){return pn(e,{members:t,mapMembers(n,i){const r=n(this.members);return udt(e0e(r,this.ast.options,i?.unsafePreserveChecks?this.ast.checks:void 0),r)}})}function At(e,t){return udt(e0e(e,t,void 0),e)}function ct(e){const t=e.map(Ce);return pn(e0e(t,void 0,void 0),{literals:e,members:t,mapMembers(n){return At(n(this.members))},pick(n){return ct(n)},transform(n){return At(t.map((i,r)=>i.transform(n[r])))}})}function Pw(e){return pn(new x0e(()=>e().ast))}function Ze(...e){return t=>t.check(...e)}function ldt(e,t){return n=>pn(Tw(n.ast,[Gat(e,t)]),{schema:n})}function Q8(e){return t=>pn(t.ast,{schema:t,identifier:e})}function y4n(e,t){return n=>(t.checks?n.check(...t.checks):n).pipe(Q8(e))}function ddt(e){return t=>pn(mxn(t.ast,new jz(e,an)),{schema:t})}function pdt(e){return t=>pn(fxn(t.ast,new jz(an,e)),{schema:t})}function v4n(e){return hdt(e)}function hdt(e){return t=>ddt(tz(e))(t)}function _4n(e){return mdt(e)}function mdt(e){return t=>pdt(tz(e))(t)}function An(e,t){return n=>pn(Gz(n.ast,e.ast,t?Wz(t):Bz()),{from:n,to:e})}function YA(){return(e,t)=>Nr()(e,{decode:t,encode:yat})}function w4n(e){return t=>An(xl(t),e)(t)}function X8(e,t){return n=>t?An(n,t)(e):An(n)(e)}function b4n(e){return t=>An(t,e)(v4(t))}function fdt(e){return t=>pn(gxn(t.ast,e),{schema:t})}function gdt(e){return $u(e,t=>t8(()=>uA(t,n=>n.issue)))}function Y8(e,t){const n=t?.encodingStrategy==="omit"?cat():r4();return i=>Ue(v4(i)).pipe(An(i,{decode:uat(gdt(e)),encode:n}))}function x4n(e,t){return n=>xl(n).pipe(Y8(e,t),X8(Ue(n)))}function ydt(e,t){const n=t?.encodingStrategy==="omit"?cat():r4();return i=>jt(v4(i)).pipe(An(i,{decode:uat(gdt(e)),encode:n}))}function vdt(e,t){return n=>xl(n).pipe(ydt(e,t),X8(jt(n)))}function _a(e){return Ce(e).pipe(fdt(we(e)))}function S4n(e){return _a(e).pipe(Y8(we(e),{encodingStrategy:"omit"}))}function Fq(e,t){return V({_tag:_a(e),...t})}function _dt(e){return t=>{const n={},i=[],r=new Set,o={},s=l=>d=>l.includes(d[e]);return a(t),Object.assign(t,{tag:e,cases:n,discriminants:i,isAnyOf:s,guards:o,match:c,matchOrElse:u});function a(l){const d=l.ast;if(oct(d)&&"members"in l&&globalThis.Array.isArray(l.members)&&l.members.every(XA))return l.members.forEach(a);const p=k8(d);if(p.length>0){const h=p.find(m=>m.key===e)?.literal;if(PGe(h)){const m=typeof h=="number"?globalThis.String(h):h;if(r.has(m))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(h)}`);r.add(m),i.push(h),dn(n,h,l),dn(o,h,eut(xl(l)));return}}throw new globalThis.Error("No literal or unique symbol found")}function c(){if(arguments.length===1){const m=arguments[0];return function(f){const g=f[e];return(Object.hasOwn(m,g)?m[g]:void 0)(f)}}const l=arguments[0],d=arguments[1],p=l[e];return(Object.hasOwn(d,p)?d[p]:void 0)(l)}function u(){if(arguments.length===2){const f=arguments[0],g=arguments[1];return function(y){const v=y[e];return(Object.hasOwn(f,v)?f[v]??g:g)(y)}}const l=arguments[0],d=arguments[1],p=arguments[2],h=l[e];return(Object.hasOwn(d,h)?d[h]??p:p)(l)}}}function k4n(e){const t={},n=[];for(const u of Object.keys(e)){const l=Fq(u,e[u]);dn(t,u,l),n.push(l)}const i=At(n),{tag:r,guards:o,isAnyOf:s,match:a,matchOrElse:c}=_dt("_tag")(i);return pn(i.ast,{tag:r,cases:t,isAnyOf:s,guards:o,match:a,matchOrElse:c})}function E4n(){return e=>e}function am(e,t){return Rr(n=>n instanceof e,t)}function Nr(){return(e,t)=>new ca(e.ast,Wz(t))}function A4n(e,t=void 0){return new u4(e,t)}function wdt(e){const t=new globalThis.RegExp(Qye);return vn(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()"}),arbitraryConstraint:{patterns:[{source:Qye,flags:""}]},...e})}function Ks(e,t){const n=e.source,i=e.flags,r=/^[dg]*uy?$/.test(i),o=i===""?`new RegExp(${Qt(n)})`:`new RegExp(${Qt(n)}, ${Qt(i)})`;return Hz(e,{toJsonSchema:()=>r?{pattern:i.endsWith("y")?`^(?:${n})`:n}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${o})`}),...t})}function T4n(e){return Zat({toCode:()=>({runtime:"Schema.isStringFinite()"}),...e})}function I4n(e){return ect({toCode:()=>({runtime:"Schema.isStringBigInt()"}),...e})}function C4n(e){return tct({toCode:()=>({runtime:"Schema.isStringSymbol()"}),...e})}function R4n(e,t){const n=ept(e);return Ks(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 O4n(e){return Ks(Xye,{expected:"a GUID",representation:{id:"effect/schema/isGUID",payload:null},toJsonSchema:()=>({pattern:Xye.source}),toCode:()=>({runtime:"Schema.isGUID()"}),...e})}function P4n(e){const t=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;return Ks(t,{representation:{id:"effect/schema/isULID",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isULID()"}),...e})}function Mye(e){const t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return Ks(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}function M4n(e){const t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;return Ks(t,{expected:"a base64url encoded string",representation:{id:"effect/schema/isBase64Url",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64Url()"}),...e})}function Dye(e,t,n){if(e.length===0)return t.length===0?{}:[{},!0];const i={pattern:new globalThis.RegExp(n).source};return e===t?i:[i,!0]}function D4n(e,t){const n=JSON.stringify(e),i=new globalThis.RegExp(`^${Cw(e)}`),r=e.replace(/[\uD800-\uDBFF]$/,"");return vn(o=>o.startsWith(e),{expected:`a string starting with ${n}`,representation:{id:"effect/schema/isStartingWith",payload:{startsWith:e}},toJsonSchema:()=>Dye(r,e,`^${Cw(r)}`),toCode:()=>({runtime:`Schema.isStartingWith(${Qt(e)})`}),arbitraryConstraint:{patterns:[{source:i.source,flags:i.flags}]},...t})}function L4n(e,t){const n=JSON.stringify(e),i=new globalThis.RegExp(`${Cw(e)}$`),r=e.replace(/^[\uDC00-\uDFFF]/,"");return vn(o=>o.endsWith(e),{expected:`a string ending with ${n}`,representation:{id:"effect/schema/isEndingWith",payload:{endsWith:e}},toJsonSchema:()=>Dye(r,e,`${Cw(r)}$`),toCode:()=>({runtime:`Schema.isEndingWith(${Qt(e)})`}),arbitraryConstraint:{patterns:[{source:i.source,flags:i.flags}]},...t})}function N4n(e,t){const n=JSON.stringify(e),i=new globalThis.RegExp(Cw(e)),r=e.replace(/^[\uDC00-\uDFFF]|[\uD800-\uDBFF]$/g,"");return vn(o=>o.includes(e),{expected:`a string including ${n}`,representation:{id:"effect/schema/isIncluding",payload:{includes:e}},toJsonSchema:()=>Dye(r,e,Cw(r)),toCode:()=>({runtime:`Schema.isIncluding(${Qt(e)})`}),arbitraryConstraint:{patterns:[{source:i.source,flags:i.flags}]},...t})}function $4n(e){const t=new globalThis.RegExp(Yye);return vn(n=>n.toUpperCase()===n,{expected:"a string with all characters in uppercase",representation:{id:"effect/schema/isUppercased",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isUppercased()"}),arbitraryConstraint:{patterns:[{source:Yye,flags:""}]},...e})}function U4n(e){const t=new globalThis.RegExp(Zye);return vn(n=>n.toLowerCase()===n,{expected:"a string with all characters in lowercase",representation:{id:"effect/schema/isLowercased",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isLowercased()"}),arbitraryConstraint:{patterns:[{source:Zye,flags:""}]},...e})}function F4n(e){const t=new globalThis.RegExp(eve);return vn(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},!0],toCode:()=>({runtime:"Schema.isCapitalized()"}),arbitraryConstraint:{patterns:[{source:eve,flags:""}]},...e})}function B4n(e){const t=new globalThis.RegExp(tve);return vn(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},!0],toCode:()=>({runtime:"Schema.isUncapitalized()"}),arbitraryConstraint:{patterns:[{source:tve,flags:""}]},...e})}function Z8(e){const t=q5(e.order),n=e.formatter??Qt;return(i,r)=>vn(o=>t(o,i),{expected:`a value greater than ${n(i)}`,arbitraryConstraint:{order:e.order,minimum:i,exclusiveMinimum:!0},...e.annotate?.(i),...r})}function e9(e){const t=dj(e.order),n=e.formatter??Qt;return(i,r)=>vn(o=>t(o,i),{expected:`a value greater than or equal to ${n(i)}`,arbitraryConstraint:{order:e.order,minimum:i},...e.annotate?.(i),...r})}function t9(e){const t=u7(e.order),n=e.formatter??Qt;return(i,r)=>vn(o=>t(o,i),{expected:`a value less than ${n(i)}`,arbitraryConstraint:{order:e.order,maximum:i,exclusiveMaximum:!0},...e.annotate?.(i),...r})}function n9(e){const t=lj(e.order),n=e.formatter??Qt;return(i,r)=>vn(o=>t(o,i),{expected:`a value less than or equal to ${n(i)}`,arbitraryConstraint:{order:e.order,maximum:i},...e.annotate?.(i),...r})}function i9(e){const t=dj(e.order),n=q5(e.order),i=lj(e.order),r=u7(e.order),o=e.formatter??Qt;return(s,a)=>{const c=s.exclusiveMinimum?n:t,u=s.exclusiveMaximum?r:i;return vn(l=>c(l,s.minimum)&&u(l,s.maximum),{expected:`a value between ${o(s.minimum)}${s.exclusiveMinimum?" (excluded)":""} and ${o(s.maximum)}${s.exclusiveMaximum?" (excluded)":""}`,arbitraryConstraint:{order:e.order,minimum:s.minimum,maximum:s.maximum,...s.exclusiveMinimum&&{exclusiveMinimum:!0},...s.exclusiveMaximum&&{exclusiveMaximum:!0}},...e.annotate?.(s),...a})}}function j4n(e){return(t,n)=>{const i=e.formatter??Qt;return vn(r=>e.remainder(r,t)===e.zero,{expected:`a value that is a multiple of ${i(t)}`,...e.annotate?.(t),...n})}}function ZA(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${Qt(e)}`);return e}function W4n(e,t){if(!globalThis.Number.isFinite(e)||e===0)throw new globalThis.RangeError(`Expected a finite non-zero number, got ${globalThis.String(e)}`);return e=globalThis.Math.abs(e),vn(n=>Met(n,e)===0,{expected:`a value that is a multiple of ${e}`,representation:{id:"effect/schema/isMultipleOf",payload:{divisor:e}},toJsonSchema:()=>({multipleOf:e}),toCode:()=>({runtime:`Schema.isMultipleOf(${Qt(e)})`}),...t})}function Ff(e){return vn(t=>globalThis.Number.isSafeInteger(t),{expected:"an integer",representation:{id:"effect/schema/isInt",payload:null},toJsonSchema:()=>[{type:"integer"},!0],toCode:()=>({runtime:"Schema.isInt()"}),arbitraryConstraint:{number:"integer"},...e})}function z4n(e){return new u4([Ff(),Ad({minimum:-2147483648,maximum:2147483647})],{expected:"a 32-bit integer",...e})}function q4n(e){return new u4([Ff(),Ad({minimum:0,maximum:4294967295})],{expected:"a 32-bit unsigned integer",...e})}function e6(e){if(globalThis.Number.isNaN(e.getTime()))throw new globalThis.RangeError(`Expected a valid Date, got ${Qt(e)}`);return e.toISOString()}function t6(e){return`new Date(${Qt(e.getTime())})`}function rn(e,t){return e=ju(e),bdt(e,Math.ceil(e/2),t)}function bdt(e,t,n){return vn(i=>i.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:"effect/schema/isMinLength",payload:{minLength:e}},toJsonSchema:({type:i})=>i==="string"?e<=1?{minLength:t}:[{minLength:t},!0]:i==="array"?{minItems:e}:i===void 0?[{minLength:t,minItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[Dp]:!0,arbitraryConstraint:{minLength:e},...n})}function xdt(e){return bdt(1,1,e)}function ft(e,t){return e=ju(e),vn(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==="string"?e===0?{maxLength:e}:[{maxLength:e},!0]:n==="array"?{maxItems:e}:n===void 0?[{maxLength:e,maxItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[Dp]:!0,arbitraryConstraint:{maxLength:e},...t})}function Lye(e,t,n){return e=ju(e),t=ju(t),vn(i=>i.length>=e&&i.length<=t,{expected:e===t?`a value with a length of ${e}`:`a value with a length between ${e} and ${t}`,representation:{id:"effect/schema/isBetweenLength",payload:{minimum:e,maximum:t}},toJsonSchema:({type:i})=>i==="string"?t===0||Math.ceil(e/2)>t?{minLength:Math.ceil(e/2),maxLength:t}:[{minLength:Math.ceil(e/2),maxLength:t},!0]:i==="array"?{minItems:e,maxItems:t}:i===void 0?[{minLength:Math.ceil(e/2),maxLength:t,minItems:e,maxItems:t},!0]:[{},!0],toCode:()=>({runtime:`Schema.isBetweenLength(${e}, ${t})`}),[Dp]:!0,arbitraryConstraint:{minLength:e,maxLength:t},...n})}function H4n(e,t){return e=ju(e),vn(n=>Nye(n,e)>=e,{expected:`a string with at least ${e} code points`,representation:{id:"effect/schema/isMinCodePoints",payload:{minCodePoints:e}},toJsonSchema:()=>({minLength:e}),toCode:()=>({runtime:`Schema.isMinCodePoints(${e})`}),arbitraryConstraint:{minCodePoints:e},...t})}function G4n(e,t){return e=ju(e),vn(n=>Nye(n,e+1)<=e,{expected:`a string with at most ${e} code points`,representation:{id:"effect/schema/isMaxCodePoints",payload:{maxCodePoints:e}},toJsonSchema:()=>({maxLength:e}),toCode:()=>({runtime:`Schema.isMaxCodePoints(${e})`}),arbitraryConstraint:{maxCodePoints:e},...t})}function V4n(e,t,n){return e=ju(e),t=ju(t),vn(i=>{const r=Nye(i,t+1);return r>=e&&r<=t},{expected:e===t?`a string with ${e} code points`:`a string with between ${e} and ${t} code points`,representation:{id:"effect/schema/isBetweenCodePoints",payload:{minimum:e,maximum:t}},toJsonSchema:()=>({allOf:[{minLength:e},{maxLength:t}]}),toCode:()=>({runtime:`Schema.isBetweenCodePoints(${e}, ${t})`}),arbitraryConstraint:{minCodePoints:e,maxCodePoints:t},...n})}function Nye(e,t){if(t===0)return 0;let n=0;for(const i of e)if(++n>=t)break;return n}function ju(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}function K4n(e,t){return e=ju(e),vn(n=>n.size>=e,{expected:`a value with a size of at least ${e}`,representation:{id:"effect/schema/isMinSize",payload:{minSize:e}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isMinSize(${e})`}),[Dp]:!0,arbitraryConstraint:{minSize:e},...t})}function J4n(e,t){return e=ju(e),vn(n=>n.size<=e,{expected:`a value with a size of at most ${e}`,representation:{id:"effect/schema/isMaxSize",payload:{maxSize:e}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isMaxSize(${e})`}),[Dp]:!0,arbitraryConstraint:{maxSize:e},...t})}function Q4n(e,t,n){return e=ju(e),t=ju(t),vn(i=>i.size>=e&&i.size<=t,{expected:e===t?`a value with a size of ${e}`:`a value with a size between ${e} and ${t}`,representation:{id:"effect/schema/isBetweenSize",payload:{minimum:e,maximum:t}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenSize(${e}, ${t})`}),[Dp]:!0,arbitraryConstraint:{minSize:e,maxSize:t},...n})}function X4n(e,t){return e=ju(e),vn(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:({type:n})=>n==="object"?{minProperties:e}:[{minProperties:e},!0],toCode:()=>({runtime:`Schema.isMinProperties(${e})`}),[Dp]:!0,arbitraryConstraint:{minProperties:e},...t})}function Y4n(e,t){return e=ju(e),vn(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:({type:n})=>n==="object"?{maxProperties:e}:[{maxProperties:e},!0],toCode:()=>({runtime:`Schema.isMaxProperties(${e})`}),[Dp]:!0,arbitraryConstraint:{maxProperties:e},...t})}function Z4n(e,t,n){return e=ju(e),t=ju(t),vn(i=>Reflect.ownKeys(i).length>=e&&Reflect.ownKeys(i).length<=t,{expected:e===t?`a value with exactly ${e===1?"1 entry":`${e} entries`}`:`a value with between ${e} and ${t} entries`,representation:{id:"effect/schema/isBetweenProperties",payload:{minimum:e,maximum:t}},toJsonSchema:({type:i})=>i==="object"?{minProperties:e,maxProperties:t}:[{minProperties:e,maxProperties:t},!0],toCode:()=>({runtime:`Schema.isBetweenProperties(${e}, ${t})`}),[Dp]:!0,arbitraryConstraint:{minProperties:e,maxProperties:t},...n})}function eSn(e,t){const n=v4(e),i=Dxn(n.ast);return vn((r,o,s)=>{const a=Reflect.ownKeys(r),c=[];for(const u of a){const l=i(u,s);if(l!==void 0&&(c.push(new yc([u],l)),s.errors==="first"))break}return wj(c)?new vc(o,c,r,s):!0},{expected:"an object with property names matching the schema",representation:{id:"effect/schema/isPropertyNames",payload:null,schemas:[n.ast]},toJsonSchema:({schemas:r,type:o})=>o==="object"?{propertyNames:r[0]}:[{propertyNames:r[0]},!0],toCode:({schemas:r})=>({runtime:`Schema.isPropertyNames(${r[0].runtime})`}),[Dp]:!0,...t})}function $ye(e){return vn(t=>Fde(t).length===t.length,{expected:"an array with unique items",representation:{id:"effect/schema/isUnique",payload:null},toJsonSchema:()=>({uniqueItems:!0}),toCode:()=>({runtime:"Schema.isUnique()"}),arbitraryConstraint:{uniqueBy:an},...e})}function Sdt(e){return vn(t=>Fde(t.map(([n])=>n)).length===t.length,{expected:"an array with unique keys",representation:{id:"effect/schema/isUniqueKey",payload:null},toCode:()=>({runtime:"Schema.isUniqueKey()"}),arbitraryConstraint:{uniqueBy:t=>t[0]},...e})}function tSn(e){const t=ive(e),n=ove[t];if(n!==void 0)return n;const i=rve(t),r=am(globalThis.Error,{representation:{id:"effect/schema/Error",payload:i??null},toCode:()=>({runtime:i!==void 0?`Schema.ErrorInstance(${Qt(i)})`:"Schema.ErrorInstance()",Type:"globalThis.Error"}),expected:"Error",toCodecJson:()=>Nr()(Yht,Tat(i))});return ove[t]=r,r}function nSn(e){const t=ive(e),n=sve[t];if(n!==void 0)return n;const i=Id.pipe(An(Sl,Iat(rve(t))));return sve[t]=i,i}function iSn(e,t){const n=Sd()([e,t],([i,r])=>{const o=ut(Ka([i,r]));return(s,a,c)=>s instanceof globalThis.Map?hu(Ma(o)([...s],c),{onSuccess:u=>new globalThis.Map(u),onFailure:u=>Np(a,"entries",u,s,c)}):be(new ga(a,s,c))},{representation:{id:"effect/schema/ReadonlyMap",payload:null},toCode:({typeParameters:i})=>({runtime:`Schema.ReadonlyMap(${i[0].runtime}, ${i[1].runtime})`,Type:`globalThis.ReadonlyMap<${i[0].Type}, ${i[1].Type}>`}),expected:"ReadonlyMap",toCodec:([i,r])=>Nr()(ut(Ka([i,r])),oo({decode:o=>new globalThis.Map(o),encode:o=>[...o.entries()]}))});return pn(n.ast,{key:e,value:t})}function rSn(e){const t=Sd()([e],([n])=>{const i=ut(n);return(r,o,s)=>r instanceof globalThis.Set?hu(Ma(i)([...r],s),{onSuccess:a=>new globalThis.Set(a),onFailure:a=>Np(o,"values",a,r,s)}):be(new ga(o,r,s))},{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])=>Nr()(ut(n),oo({decode:i=>new globalThis.Set(i),encode:i=>[...i.values()]}))});return pn(t.ast,{value:e})}function ti(e,t){return ypt.pipe(An(e,sxn(t)))}function oSn(e){return dve.pipe(An(e,Mat))}function sSn(e){return pve.pipe(An(e,Dat))}function Uye(e,t){const n=Sd()([e,t],([i,r])=>(o,s,a)=>{if(!bZe(o))return be(new ga(s,o,a));switch(o._tag){case"Fail":return hu(Ma(i)(o.error,a),{onSuccess:rme,onFailure:c=>Np(s,"error",c,o,a)});case"Die":return hu(Ma(r)(o.defect,a),{onSuccess:ome,onFailure:c=>Np(s,"defect",c,o,a)});case"Interrupt":return we(o)}},{representation:{id:"effect/schema/CauseReason",payload:null},toCode:({typeParameters:i})=>({runtime:`Schema.CauseReason(${i[0].runtime}, ${i[1].runtime})`,Type:`Cause.Failure<${i[0].Type}, ${i[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause.Failure",toCodec:([i,r])=>Nr()(At([V({_tag:Ce("Fail"),error:i}),V({_tag:Ce("Die"),defect:r}),V({_tag:Ce("Interrupt"),fiberId:a6(_4)})]),oo({decode:o=>{switch(o._tag){case"Fail":return rme(o.error);case"Die":return ome(o.defect);case"Interrupt":return xZe(o.fiberId)}},encode:o=>{switch(o._tag){case"Fail":return{_tag:"Fail",error:o.error};case"Die":return{_tag:"Die",defect:o.defect};case"Interrupt":return{_tag:"Interrupt",fiberId:o.fiberId}}}}))});return pn(n.ast,{error:e,defect:t})}function Fye(e,t){const n=Sd()([e,t],([i,r])=>{const o=ut(Uye(i,r));return(s,a,c)=>wZe(s)?hu(Ma(o)(s.reasons,c),{onSuccess:fW,onFailure:u=>Np(a,"failures",u,s,c)}):be(new ga(a,s,c))},{representation:{id:"effect/schema/Cause",payload:null},toCode:({typeParameters:i})=>({runtime:`Schema.Cause(${i[0].runtime}, ${i[1].runtime})`,Type:`Cause.Cause<${i[0].Type}, ${i[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause",toCodec:([i,r])=>Nr()(ut(Uye(i,r)),oo({decode:fW,encode:({reasons:o})=>o}))});return pn(n.ast,{error:e,defect:t})}function kdt(e){return Nr()(e,oo({decode:Ufe,encode:Is}))}function aSn(e){const t=Sd()([e],([n])=>{const i=ut(n);return(r,o,s)=>uz(r)?hu(Ma(i)(Is(r),s),{onSuccess:Ufe,onFailure:a=>Np(o,"values",a,r,s)}):be(new ga(o,r,s))},{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])=>kdt(ut(n)),toCodecArbitrary:({constraint:n,typeParameters:[i]})=>kdt(Uq(ut(i),n?.minLength,n?.maxLength)),toEquivalence:([n])=>$fe(n)});return pn(t.ast,{value:e})}function Edt(){return vd((e,t)=>Oa(pz(e),{onNone:()=>be(new ir({message:"Invalid DateTime input"},e,t)),onSome:n=>we(hz(n))}))}function Adt(e,t,n){const i=Math.max(t,e?.minimum===void 0?t:e.minimum.epochMilliseconds+(e.exclusiveMinimum===!0?1:0)),r=Math.min(n,e?.maximum===void 0?n:e.maximum.epochMilliseconds-(e.exclusiveMaximum===!0?1:0));return i<=r?[i,r]:[t,n]}function Bye(e,t){return rt.check(Ad({minimum:e,maximum:t}))}function Tdt(){return At([Bye(zpt,qpt),ct(Eve)])}function cSn(e,t,n){const i=Sd()([e,t,n],([r,o,s])=>{const a=Fye(o,s);return(c,u,l)=>{if(!tZe(c))return be(new ga(u,c,l));switch(c._tag){case"Success":return hu(Ma(r)(c.value,l),{onSuccess:fw,onFailure:d=>Np(u,"value",d,c,l)});case"Failure":return hu(Ma(a)(c.cause,l),{onSuccess:w0,onFailure:d=>Np(u,"cause",d,c,l)})}}},{representation:{id:"effect/schema/Exit",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Exit(${r[0].runtime}, ${r[1].runtime}, ${r[2].runtime})`,Type:`Exit.Exit<${r[0].Type}, ${r[1].Type}, ${r[2].Type}>`,importDeclarations:['import * as Exit from "effect/Exit"']}),expected:"Exit",toCodec:([r,o,s])=>Nr()(At([V({_tag:Ce("Success"),value:r}),V({_tag:Ce("Failure"),cause:Fye(o,s)})]),oo({decode:a=>a._tag==="Success"?fw(a.value):w0(a.cause),encode:a=>yr(a)?{_tag:"Success",value:a.value}:{_tag:"Failure",cause:a.cause}}))});return pn(i.ast,{value:e,error:t,defect:n})}function Idt(e,t,n){return V({type:Ce(e),nodes:ut(V({index:Mw,data:t})),edges:ut(V({index:Mw,source:Mw,target:Mw,data:n}))})}function Cdt(e,t){let n=-1;const i=new Set;for(let r=0;r<e.nodes.length;r++){const o=e.nodes[r].index;if(o<=n)return be(new yc(["nodes",r,"index"],new ir({expected:"a strictly increasing node index"},o,t)));n=o,i.add(o)}n=-1;for(let r=0;r<e.edges.length;r++){const o=e.edges[r];if(o.index<=n)return be(new yc(["edges",r,"index"],new ir({expected:"a strictly increasing edge index"},o.index,t)));if(n=o.index,!i.has(o.source))return be(new yc(["edges",r,"source"],new ir({expected:"an encoded node index"},o.source,t)));if(!i.has(o.target))return be(new yc(["edges",r,"target"],new ir({expected:"an encoded node index"},o.target,t)))}return we(Rz(e))}function uSn(e,t,n){return!kge(e)||e.mutable||e.type!==t?be(new ir({expected:`an immutable ${t} Graph`},e,n)):we(f8(e))}function lSn(e,t){return(n,i)=>{const r=f8(n),o=f8(i);if(r.type!==o.type||r.nodes.length!==o.nodes.length||r.edges.length!==o.edges.length)return!1;for(let s=0;s<r.nodes.length;s++)if(r.nodes[s].index!==o.nodes[s].index||!e(r.nodes[s].data,o.nodes[s].data))return!1;for(let s=0;s<r.edges.length;s++){const a=r.edges[s],c=o.edges[s],u=r.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 dSn(e,t,n){return YA()(At([Ed,V({nodes:a9(t),edges:ut(Ka([Mw,Mw,n]))})]),Pi(i=>{if(i===null)return Rz({type:e,nodes:[],edges:[]});const r=i.nodes.map((o,s)=>({index:s,data:o}));return Rz({type:e,nodes:r,edges:i.edges.map(([o,s,a],c)=>({index:c,source:o%r.length,target:s%r.length,data:a}))})}))}function pSn(e,t,n){const i=Sd()([t,n],([r,o])=>{const s=Idt(e,r,o);return(a,c,u)=>!kge(a)||a.mutable||a.type!==e?be(new ga(c,a,u)):De(Ma(s)(f8(a),u),l=>Cdt(l,u))},{representation:{id:"effect/schema/Graph",payload:e},toCode:({typeParameters:r})=>({runtime:`Schema.Graph(${Qt(e)}, ${r[0].runtime}, ${r[1].runtime})`,Type:`Graph.Graph<${r[0].Type}, ${r[1].Type}, ${Qt(e)}>`,importDeclarations:['import * as Graph from "effect/Graph"']}),expected:`an immutable ${e} Graph`,toCodec:([r,o])=>Nr()(Idt(e,r,o),mu({decode:Cdt,encode:(s,a)=>uSn(s,e,a)})),toCodecArbitrary:({typeParameters:[r,o]})=>dSn(e,r,o),toEquivalence:([r,o])=>lSn(r,o)});return pn(i.ast,{type:e,node:t,edge:n})}function Rdt(e){return Nr()(e,oo({decode:dge,encode:wz}))}function hSn(e,t){const n=Sd()([e,t],([i,r])=>{const o=ut(Ka([i,r]));return(s,a,c)=>ast(s)?hu(Ma(o)(wz(s),c),{onSuccess:dge,onFailure:u=>Np(a,"entries",u,s,c)}):be(new ga(a,s,c))},{representation:{id:"effect/schema/HashMap",payload:null},toCode:({typeParameters:i})=>({runtime:`Schema.HashMap(${i[0].runtime}, ${i[1].runtime})`,Type:`HashMap.HashMap<${i[0].Type}, ${i[1].Type}>`,importDeclarations:['import * as HashMap from "effect/HashMap"']}),expected:"HashMap",toCodec:([i,r])=>Rdt(ut(Ka([i,r]))),toCodecArbitrary:({constraint:i,typeParameters:[r,o]})=>Rdt(Uq(ut(Ka([r,o])).check(Sdt()),i?.minSize,i?.maxSize)),toEquivalence:([i,r])=>FGe(i,r)});return pn(n.ast,{key:e,value:t})}function Odt(e){return Nr()(e,oo({decode:mge,encode:Is}))}function mSn(e){const t=Sd()([e],([n])=>{const i=ut(n);return(r,o,s)=>gst(r)?hu(Ma(i)(Is(r),s),{onSuccess:mge,onFailure:a=>Np(o,"values",a,r,s)}):be(new ga(o,r,s))},{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])=>Odt(ut(n)),toCodecArbitrary:({constraint:n,typeParameters:[i]})=>Odt(Uq(ut(i).check($ye()),n?.minSize,n?.maxSize)),toEquivalence:([n])=>Ale(n)});return pn(t.ast,{value:e})}function y4(e){const t=Sd()([e],([n])=>(i,r,o)=>h0(i)?Bn(i)?Zme:hu(Ma(n)(i.value,o),{onSuccess:Mt,onFailure:s=>Np(r,"value",s,i,o)}):be(new ga(r,i,o)),{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])=>Nr()(At([V({_tag:Ce("Some"),value:n}),V({_tag:Ce("None")})]),oo({decode:i=>i._tag==="None"?$t():Mt(i.value),encode:i=>si(i)?{_tag:"Some",value:i.value}:{_tag:"None"}}))});return pn(t.ast,{value:e})}function fSn(e){return dt(e).pipe(An(y4(xl(e)),txn()))}function gSn(e){return a6(e).pipe(An(y4(xl(e)),nxn()))}function ySn(e,t){return Vye(e).pipe(An(y4(xl(e)),ixn(t)))}function vSn(e){return Ue(e).pipe(An(y4(xl(e)),rxn()))}function _Sn(e){return jt(e).pipe(An(y4(xl(e)),oxn()))}function wSn(e,t){const n=t===void 0?"omit":t.onNoneEncoding,i=n===null?null:void 0;return jt(dt(e)).pipe(An(y4(xl(e)),Fge({decode:r=>r.pipe(l7(MGe),Mt),encode:n==="omit"?C2:r=>Mt(T2(C2(r),()=>i))})))}function Pdt(e,t){const n=typeof t?.label=="string"?t.label:void 0,i=t?.disallowJsonEncode===!0,r=n!==void 0?i?{label:n,disallowJsonEncode:!0}:{label:n}:i?{disallowJsonEncode:!0}:void 0,o=n!==void 0?Ma(Ce(n)):void 0,s=Sd()([e],([a])=>(c,u,l)=>{if(Ule(c)){const d=o!==void 0?ez(o(c.label,l),p=>new yc(["label"],p)):pt;return yd(d,()=>hu(Ma(a)(j5(c),l),{onSuccess:p=>wp(p,{label:c.label}),onFailure:()=>new vc(u,[new yc(["value"],new ir(void 0,c,l))],c,l)}))}return be(new ga(u,c,l))},{representation:{id:"effect/schema/Redacted",payload:r??null},toCode:({typeParameters:a})=>({runtime:r!==void 0?`Schema.Redacted(${a[0].runtime}, ${Qt(r)})`:`Schema.Redacted(${a[0].runtime})`,Type:`Redacted.Redacted<${a[0].Type}>`,importDeclarations:['import * as Redacted from "effect/Redacted"']}),expected:"Redacted",toCodecJson:([a])=>Nr()(a,{decode:Pi(c=>wp(c,{label:n})),encode:i?$ge(c=>"Cannot serialize Redacted"+(si(c)&&typeof c.value.label=="string"?` with label: "${c.value.label}"`:"")):Pi(j5)}),toEquivalence:([a])=>wVe(a)});return pn(s.ast,{value:e})}function bSn(e,t){return An(Pdt(xl(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:Pi(n=>wp(n,{label:t?.label})),encode:t?.disallowEncode?$ge(n=>"Cannot encode Redacted"+(si(n)&&typeof n.value.label=="string"?` with label: "${n.value.label}"`:"")):Pi(j5)})(e)}function xSn(e,t){const n=Sd()([e,t],([i,r])=>(o,s,a)=>{if(!KKe(o))return be(new ga(s,o,a));switch(o._tag){case"Success":return hu(B0e(i)(o.success,a),{onSuccess:oi,onFailure:c=>Np(s,"success",c,o,a)});case"Failure":return hu(B0e(r)(o.failure,a),{onSuccess:hi,onFailure:c=>Np(s,"failure",c,o,a)})}},{representation:{id:"effect/schema/Result",payload:null},toCode:({typeParameters:i})=>({runtime:`Schema.Result(${i[0].runtime}, ${i[1].runtime})`,Type:`Result.Result<${i[0].Type}, ${i[1].Type}>`,importDeclarations:['import * as Result from "effect/Result"']}),expected:"Result",toCodec:([i,r])=>Nr()(At([V({_tag:Ce("Success"),success:i}),V({_tag:Ce("Failure"),failure:r})]),oo({decode:o=>o._tag==="Success"?oi(o.success):hi(o.failure),encode:o=>yl(o)?{_tag:"Success",success:o.success}:{_tag:"Failure",failure:o.failure}}))});return pn(n.ast,{success:e,failure:t})}function jye(e,t,n,i,r){const o=kSn(n,t,i),s=Mdt(t),a=class extends e{constructor(...[c,u]){const d=u?.["~payload"],p=d?.token===Hq?d.value:n.make(c??{},u);super(p,{...u,disableChecks:!0,"~payload":{token:Hq,value:p}})}static[i6]=i6;get[s](){return s}static[Ght]=!0;static identifier=t;static fields=n.fields;static get ast(){return o(this).ast}static pipe(){return ji(this,arguments)}static rebuild(c){return o(this).rebuild(c)}static make(c,u){return Zct(o(this))(c??{},u)}static makeOption(c,u){return Yct(o(this))(c??{},u)}static makeEffect(c,u){return o(this).makeEffect(c??{},u)}static annotate(c){return this.rebuild(Aw(this.ast,c))}static annotateKey(c){return this.rebuild(s0e(this.ast,c))}static check(...c){return this.rebuild(Tw(this.ast,c))}static extend(c){return(u,l)=>{const d=r9(u)?u:V(u),p={...n.fields,...d.fields},h=Zge(p,n.ast.checks,{identifier:c});return jye(this,c,Pye(Tw(h,d.ast.checks),p),l,r)}}static mapFields(c,u){return n.mapFields(c,u)}};return r!==void 0&&Object.assign(a.prototype,r(t)),a}function SSn(e){return new wo(Pi(t=>new e(t,{"~payload":{token:Hq,value:t}})),r4())}function Mdt(e){return`~effect/Schema/Class/${e}`}function kSn(e,t,n){let i;return r=>{if(i!==void 0)return i;const o=Mdt(t),s=u=>u instanceof r||Sn(u,o),a=SSn(r),c=pn(new $A([e.ast],()=>(u,l,d)=>s(u)?we(u):be(new ga(l,u,d)),{identifier:t,[Ige]:([u])=>({isConstructed:s,link:new ca(u,a)}),toCodec:([u])=>new ca(u.ast,a),toEquivalence:([u])=>u,toFormatter:([u])=>l=>`${r.identifier}(${u(l)})`,[Oz]:k8(e.ast),...n}));return i=An(c,a)(e)}}function r9(e){return XA(e)}function ESn(e){return t=>t.annotate({toFormatter:e})}function ASn(e,t){return F2n(e.ast,t)}function TSn(e){return t=>t.annotate({toEquivalence:e})}function Wye(e){return sye(e.ast)}function n6(e,t){return rye(e.ast,t)}function Ddt(e,t){const n=rye(L8(e.ast),t);return jut(n,t)}function ISn(e,t){return D2n(e,t)}function CSn(e){return G2n(e)}function RSn(e){return V2n(e)}function OSn(e){return K2n(e)}function PSn(e,t){return n=>pn(Aw(n.ast,{toCodecIso:()=>new ca(e.ast,Wz(t))}),{schema:n})}function MSn(e){return P2n(e)}function DSn(e){const t=Pw(()=>n),n=At([e,ut(t),Vs(te,t)]);return n}function LSn(e){return g8(e.ast)}function NSn(e){return e.ast.context?.annotations}var i6,r6,Bf,Ldt,Ndt,$dt,zye,Udt,Bq,Fdt,qye,Hye,Bdt,jdt,Wdt,o9,zdt,fu,pn,Ue,qdt,jt,Hdt,Gye,Gdt,xl,v4,o6,Vdt,Kdt,Sl,Ed,s6,te,Jdt,on,ai,s9,qv,Qdt,Xdt,Ydt,ut,a9,jf,dt,a6,Vye,Kye,Jye,Zdt,vn,Qye,ept,Xye,Yye,Zye,eve,tve,_4,tpt,Js,Wt,npt,Da,Ad,rt,Mw,ipt,rpt,opt,spt,apt,cpt,nve,upt,lpt,dpt,Td,ppt,ive,rve,ove,sve,hpt,ave,cve,mpt,uve,c9,fpt,gpt,ypt,vpt,lve,dve,pve,u9,_pt,wpt,hve,bpt,xpt,Spt,kpt,Ept,jq,Apt,Tpt,mve,c6,Ipt,Cpt,Rpt,fve,Opt,Ppt,Mpt,Dpt,Lpt,gve,yve,Npt,l9,vve,$pt,Upt,Fpt,Bpt,_ve,wve,bve,xve,Sve,kve,jpt,Wpt,zpt,qpt,Eve,d9,Hpt,Gpt,Vpt,Kpt,Ave,Tve,Jpt,Ive,Cve,Qpt,Rve,Ove,Xpt,cm,Dw,w4,p9,Wq,zq,Pve,Lw,b4,es,Ypt,Zpt,eht,tht,nht,iht,rht,oht,sht,aht,cht,uht,lht,dht,pht,hht,mht,fht,ght,yht,vht,_ht,wht,bht,xht,Sht,Mve,kht,Dve,Eht,Lve,Aht,Nve,Tht,$ve,Iht,Uve,Cht,Rht,Oht,Fve,Pht,Bve,Mht,Dht,Lht,Nht,$ht,h9,Uht,Fht,Bht,jht,jve,Wve,Wht,zht,qq,qht,Hht,Ght,Hq,zve,Vht,Gq,Kht,Vq,Jht,Qht,Xht,Id,qve,Yht,Zht,wt=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Schema.js"(){du(),prt(),a8(),ro(),Ffe(),jh(),$ot(),f0(),gt(),yz(),Zo(),Xr(),ma(),Nn(),pge(),fge(),Tbn(),Ibn(),Cbn(),Tr(),Cs(),Vst(),qa(),Sw(),put(),A2n(),N8(),M2n(),N2n(),U2n(),B2n(),J2n(),qut(),Gut(),X2n(),jB(),zlt(),Y2n(),Eye(),Ame(),ri(),A2(),Zi(),Yn(),_j(),bv(),tye(),ki(),$p(),PA(),Df(),jv(),zz(),F8(),i6=dq,r6=class extends Wo("SchemaError"){[HA]=HA;constructor(e){const t=_2();gf(0);try{super({issue:e})}finally{gf(t)}}get message(){return nat(this.issue)}toString(){return`SchemaError(${this.message})`}},Bf=eut,Ldt=Lxn,Ndt=kd,$dt=Nq,zye=tut,Udt=sut,Bq=It,Fdt=odt,qye=it,Hye=JA,Bdt=Rye,jdt=nut,Wdt=cut,o9=$q,zdt=sdt,fu=QA,pn=Wv,Ue=va(e=>pn(FA(e.ast),{schema:e})),qdt=va(e=>e.schema),jt=va(e=>{const t=a6(e);return pn(Pct(e.ast),{schema:t})}),Hdt=va(e=>e.schema.members[0]),Gye=va(e=>pn(k0e(e.ast),{schema:e})),Gdt=va(e=>e.schema),xl=va(e=>pn(Bu(e.ast),{schema:e})),v4=va(e=>pn(R0(e.ast),{schema:e})),o6="~effect/Schema/flip",Vdt=pn(h0e),Kdt=pn(pct),Sl=pn(Iw),Ed=pn(l0e),s6=pn(p0e),te=pn(nm),Jdt=te,on=pn(f0e),ai=pn(bct),s9=pn(Sct),qv=pn(Ect),Qdt=pn(uct),Xdt=pn(fct),Ydt=e=>typeof e=="symbol"?e:globalThis.String(e),ut=va(e=>pn(new Nf(!1,[],[e.ast]),{value:e})),a9=va(e=>pn(new Nf(!1,[e.ast],[e.ast]),{value:e})),jf=va(e=>pn(pxn(e.ast),{schema:e})),dt=va(e=>At([e,Ed])),a6=va(e=>At([e,s6])),Vye=va(e=>At([e,Ed,s6])),Kye=ct(["true","yes","on","1","y"]),Jye=ct(["false","no","off","0","n"]),Zdt=ct([...Kye.literals,...Jye.literals]).pipe(An(ai,oo({decode:e=>e==="true"||e==="yes"||e==="on"||e==="1"||e==="y",encode:e=>e?"true":"false"}))),vn=n0e,Qye="^\\S[\\s\\S]*\\S$|^\\S$|^$",ept=e=>e?new globalThis.RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$/,Xye=/^([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})$/,Yye="^[^a-z]*$",Zye="^[^A-Z]*$",eve="^(?:[^a-z][\\s\\S]*)?$",tve="^(?:[^A-Z][\\s\\S]*)?$",_4=pn(S0e),tpt=Vat,Js=Z8({order:xv,annotate:e=>({representation:{id:"effect/schema/isGreaterThan",payload:{exclusiveMinimum:ZA(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${Qt(e)})`})})}),Wt=e9({order:xv,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:ZA(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${Qt(e)})`})})}),npt=t9({order:xv,annotate:e=>({representation:{id:"effect/schema/isLessThan",payload:{exclusiveMaximum:ZA(e)}},toJsonSchema:()=>({exclusiveMaximum:e}),toCode:()=>({runtime:`Schema.isLessThan(${Qt(e)})`})})}),Da=n9({order:xv,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualTo",payload:{maximum:ZA(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${Qt(e)})`})})}),Ad=i9({order:xv,annotate:e=>{const t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetween",payload:{minimum:ZA(e.minimum),maximum:ZA(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?"exclusiveMinimum":"minimum"]:e.minimum,[n?"exclusiveMaximum":"maximum"]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${Qt(e.minimum)}, maximum: ${Qt(e.maximum)}, exclusiveMinimum: ${Qt(t)}, exclusiveMaximum: ${Qt(n)} })`})}}}),rt=on.check(Ff()),Mw=rt.check(Wt(0)),ipt=Z8({order:z5,annotate:e=>({representation:{id:"effect/schema/isGreaterThanDate",payload:{exclusiveMinimum:e6(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanDate(${t6(e)})`})})}),rpt=e9({order:z5,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToDate",payload:{minimum:e6(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToDate(${t6(e)})`})})}),opt=t9({order:z5,annotate:e=>({representation:{id:"effect/schema/isLessThanDate",payload:{exclusiveMaximum:e6(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanDate(${t6(e)})`})})}),spt=n9({order:z5,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToDate",payload:{maximum:e6(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToDate(${t6(e)})`})})}),apt=i9({order:z5,annotate:e=>{const t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenDate",payload:{minimum:e6(e.minimum),maximum:e6(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenDate({ minimum: ${t6(e.minimum)}, maximum: ${t6(e.maximum)}, exclusiveMinimum: ${Qt(t)}, exclusiveMaximum: ${Qt(n)} })`})}}}),cpt=Z8({order:W5,annotate:e=>({representation:{id:"effect/schema/isGreaterThanBigInt",payload:{exclusiveMinimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanBigInt(${Qt(e)})`})})}),nve=e9({order:W5,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToBigInt",payload:{minimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToBigInt(${Qt(e)})`})})}),upt=t9({order:W5,annotate:e=>({representation:{id:"effect/schema/isLessThanBigInt",payload:{exclusiveMaximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanBigInt(${Qt(e)})`})})}),lpt=n9({order:W5,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToBigInt",payload:{maximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToBigInt(${Qt(e)})`})})}),dpt=i9({order:W5,annotate:e=>{const 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:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenBigInt({ minimum: ${Qt(e.minimum)}, maximum: ${Qt(e.maximum)}, exclusiveMinimum: ${Qt(t)}, exclusiveMaximum: ${Qt(n)} })`})}}}),Td=te.check(xdt()),ppt=te.check(Lye(1,1)),ive=e=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),rve=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},ove=[],sve=[],hpt=am(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>Nr()(V({source:te,flags:te}),mu({decode:(e,t)=>kt({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new ir({expected:"valid RegExp source and flags"},e,t)}),encode:e=>we({source:e.source,flags:e.flags})}))}),ave=te.annotate({expected:"a string that will be decoded as a URL"}),cve=am(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>Nr()(ave,Gge)}),mpt=ave.pipe(An(cve,Gge)),uve=te.annotate({expected:"a string that will be decoded as a Date"}),c9=Rr(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:()=>Nr()(uve,jge)}),fpt=uve.pipe(An(c9,jge)),gpt=rt.pipe(An(c9,bat)),ypt=te.annotate({expected:"a string that will be decoded as JSON",contentMediaType:"application/json"}),vpt=ti(Sl),lve=am(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>Nr()(V({data:te.check(Mye()),type:te,name:te,lastModified:rt}),mu({decode:(e,t)=>kv(l8(e.data),{onFailure:()=>be(new ir({expected:"a valid Base64 string"},e.data,t)),onSuccess:n=>{const i=new globalThis.Uint8Array(n);return we(new globalThis.File([i],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>Ir({try:async()=>{const n=new globalThis.Uint8Array(await e.arrayBuffer());return{data:u8(n),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new ir({expected:"a readable File"},e,t)})}))}),dve=am(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>Nr()(ut(Ka([te,At([V({_tag:_a("String"),value:te}),V({_tag:_a("File"),value:lve})])])),mu({decode:e=>{const t=new globalThis.FormData;for(const[n,i]of e)t.append(n,i.value);return we(t)},encode:e=>we(globalThis.Array.from(e.entries()).map(([t,n])=>typeof n=="string"?[t,{_tag:"String",value:n}]:[t,{_tag:"File",value:n}]))}))}),pve=am(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>Nr()(te.annotate({expected:"a query string that will be decoded as URLSearchParams"}),oo({decode:e=>new globalThis.URLSearchParams(e),encode:e=>e.toString()}))}),u9=te.annotate({expected:"a string that will be decoded as a number"}).pipe(An(on,S8)),_pt=te.annotate({expected:"a string that will be decoded as a finite number"}).pipe(An(_4,S8)),wpt=pn(A0e).pipe(An(qv,Bge)),hve=te.check(wdt()),bpt=te.annotate({expected:"a string that will be decoded as a trimmed string"}).pipe(An(hve,exn())),xpt=te.annotate({expected:"a base64 encoded string that will be decoded as a UTF-8 string"}).pipe(An(te,Cat)),Spt=te.annotate({expected:"a base64 (URL) encoded string that will be decoded as a UTF-8 string"}).pipe(An(te,Rat)),kpt=te.annotate({expected:"a hex encoded string that will be decoded as a UTF-8 string"}).pipe(An(te,Oat)),Ept=te.annotate({expected:"a URI component encoded string that will be decoded as a UTF-8 string"}).pipe(An(te,Pat)),jq=At([_4,s9,te]),Apt=V({issues:ut(V({message:te,path:jt(ut(At([jq,V({key:jq})])))}))}),Tpt=ct([0,1]).pipe(An(ai,oo({decode:e=>e===1,encode:e=>e?1:0}))),mve=te.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),c6=am(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>Nr()(mve,Vge)}),Ipt=mve.pipe(An(c6,Vge)),Cpt=te.annotate({expected:"a base64 (URL) encoded string that will be decoded as a Uint8Array"}).pipe(An(c6,{decode:Wbn(),encode:hat()})),Rpt=te.annotate({expected:"a hex encoded string that will be decoded as a Uint8Array"}).pipe(An(c6,{decode:qbn(),encode:mat()})),fve=mu({decode:(e,t)=>{const n=urt(e);return Bn(n)?be(new ir({expected:"a valid BigDecimal string"},e,t)):we(n.value)},encode:e=>we(Uv(e))}),Opt=Z8({order:vA,formatter:e=>Uv(e)}),Ppt=e9({order:vA,formatter:e=>Uv(e)}),Mpt=t9({order:vA,formatter:e=>Uv(e)}),Dpt=n9({order:vA,formatter:e=>Uv(e)}),Lpt=i9({order:vA,formatter:e=>Uv(e)}),gve=te.annotate({expected:"a string that will be decoded as a BigDecimal"}),yve=Rr(wfe,{representation:{id:"effect/schema/BigDecimal",payload:null},toCode:()=>({runtime:"Schema.BigDecimal",Type:"BigDecimal.BigDecimal",importDeclarations:['import * as BigDecimal from "effect/BigDecimal"']}),expected:"BigDecimal",toCodecJson:()=>Nr()(gve,fve),toFormatter:()=>e=>Uv(e)}),Npt=gve.pipe(An(yve,fve)),l9=Rr(vrt,{representation:{id:"effect/schema/ByteSize",payload:null},toCode:()=>({runtime:"Schema.ByteSize",Type:"ByteSize.ByteSize",importDeclarations:['import * as ByteSize from "effect/ByteSize"']}),expected:"ByteSize",toCodecJson:()=>Nr()(qv.check(nve(globalThis.BigInt(0))),oo({decode:az,encode:Dfe})),toCodecStringTree:()=>Nr()(vve,Wge)}),vve=te.annotate({expected:"a string that will be decoded as a ByteSize"}),$pt=vve.pipe(An(l9,Wge)),Upt=qv.pipe(An(l9,xat)),Fpt=on.pipe(An(l9,Sat)),Bpt=oo({decode:e=>c8(e),encode:e=>e.offset}),_ve=mu({decode:(e,t)=>Oa(Xfe(e),{onNone:()=>be(new ir({expected:"a valid IANA time zone"},e,t)),onSome:we}),encode:e=>we(e.id)}),wve=mu({decode:(e,t)=>Oa(Zfe(e),{onNone:()=>be(new ir({expected:"a valid time zone"},e,t)),onSome:we}),encode:e=>we(_A(e))}),bve=mu({decode:(e,t)=>Oa(pz(e),{onNone:()=>be(new ir({expected:"a valid UTC DateTime string"},e,t)),onSome:n=>we(hz(n))}),encode:e=>we(ige(e))}),xve=mu({decode:(e,t)=>Oa(Kfe(e),{onNone:()=>be(new ir({expected:"a valid Zoned DateTime string"},e,t)),onSome:we}),encode:e=>we(gz(e))}),Sve=-864e13,kve=864e13,jpt=Sve+840*60*1e3,Wpt=kve-840*60*1e3,zpt=-720*60*1e3,qpt=840*60*1e3,Eve=["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"],d9=Rr(e=>dz(e)&&zfe(e),{representation:{id:"effect/schema/DateTimeUtc",payload:null},toCode:()=>({runtime:"Schema.DateTimeUtc",Type:"DateTime.Utc",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Utc",toCodecArbitrary:({constraint:e})=>{const[t,n]=Adt(e,Sve,kve);return YA()(Bye(t,n),Pi(Gfe))},toCodecJson:()=>Nr()(te,bve),toFormatter:()=>e=>e.toString()}),Hpt=c9.pipe(An(d9,{decode:Edt(),encode:Pi(ege)})),Gpt=te.annotate({expected:"a string that will be decoded as a DateTime.Utc"}).pipe(An(d9,bve)),Vpt=rt.pipe(An(d9,{decode:Edt(),encode:Pi(tge)})),Kpt=Rr(jfe,{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:()=>Nr()(rt,Bpt),toFormatter:()=>e=>_A(e)}),Ave=te.annotate({expected:"an IANA time zone identifier"}),Tve=Rr(Wfe,{representation:{id:"effect/schema/TimeZoneNamed",payload:null},toCode:()=>({runtime:"Schema.TimeZoneNamed",Type:"DateTime.TimeZone.Named",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone.Named",toCodecArbitrary:()=>YA()(ct(Eve),Pi(mz)),toCodecJson:()=>Nr()(Ave,_ve),toFormatter:()=>e=>_A(e)}),Jpt=Ave.pipe(An(Tve,_ve)),Ive=te.annotate({expected:"a time zone string (IANA identifier or offset like +03:00)"}),Cve=Rr(Bfe,{representation:{id:"effect/schema/TimeZone",payload:null},toCode:()=>({runtime:"Schema.TimeZone",Type:"DateTime.TimeZone",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone",toCodecArbitrary:()=>YA()(Tdt(),Pi(e=>typeof e=="number"?c8(e):mz(e))),toCodecJson:()=>Nr()(Ive,wve),toFormatter:()=>e=>_A(e)}),Qpt=Ive.pipe(An(Cve,wve)),Rve=te.annotate({expected:"a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])"}),Ove=Rr(e=>dz(e)&&qfe(e),{representation:{id:"effect/schema/DateTimeZoned",payload:null},toCode:()=>({runtime:"Schema.DateTimeZoned",Type:"DateTime.Zoned",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Zoned",toCodecArbitrary:({constraint:e})=>{const[t,n]=Adt(e,jpt,Wpt);return YA()(V({epochMilliseconds:Bye(t,n),timeZone:Tdt()}),Pi(({epochMilliseconds:i,timeZone:r})=>Vfe(i,{timeZone:r})))},toCodecJson:()=>Nr()(Rve,xve),toFormatter:()=>e=>gz(e),toEquivalence:()=>Hfe}),Xpt=Rve.pipe(An(Ove,xve)),cm=(e,t,n,i)=>te.pipe(An(e,mu({decode:(r,o)=>{const s=t(r);return yl(s)?we(s.success):be(new ir({message:s.failure.message},r,o))},encode:r=>we(n(r))}))).annotate({identifier:i}),Dw=Rr(GA,{identifier:"MacAddress"}),w4=cm(Dw,Alt,gye,"MacAddressFromString"),p9=Rr(xd,{identifier:"Ipv4Address"}),Wq=cm(p9,q8,zv,"Ipv4AddressFromString"),zq=Rr(Ow,{identifier:"Ipv6Address"}),Pve=cm(zq,kq,zv,"Ipv6AddressFromString"),Lw=Rr(dlt,{identifier:"IpAddress"}),b4=cm(Lw,Eq,zv,"IpAddressFromString"),es=(e,t,n,i)=>ldt(t,{expected:n})(e).annotate({identifier:i}),Ypt=es(Lw,KA,"a multicast address","IpMulticastAddress"),Zpt=es(b4,KA,"a multicast address","IpMulticastAddressFromString"),eht=es(Dw,KA,"a multicast address","MacMulticastAddress"),tht=es(w4,KA,"a multicast address","MacMulticastAddressFromString"),nht=es(Lw,wye,"a unicast address","IpUnicastAddress"),iht=es(b4,wye,"a unicast address","IpUnicastAddressFromString"),rht=es(Dw,Tq,"a unicast address","MacUnicastAddress"),oht=es(w4,Tq,"a unicast address","MacUnicastAddressFromString"),sht=es(p9,Cq,"a broadcast address","Ipv4BroadcastAddress"),aht=es(Wq,Cq,"a broadcast address","Ipv4BroadcastAddressFromString"),cht=es(Dw,Aq,"a broadcast address","MacBroadcastAddress"),uht=es(w4,Aq,"a broadcast address","MacBroadcastAddressFromString"),lht=es(Lw,_ye,"a loopback address","IpLoopbackAddress"),dht=es(b4,_ye,"a loopback address","IpLoopbackAddressFromString"),pht=es(Lw,bye,"a link-local address","IpLinkLocalAddress"),hht=es(b4,bye,"a link-local address","IpLinkLocalAddressFromString"),mht=es(Lw,Iq,"an unspecified address","IpUnspecifiedAddress"),fht=es(b4,Iq,"an unspecified address","IpUnspecifiedAddressFromString"),ght=es(p9,xye,"a private address","Ipv4PrivateAddress"),yht=es(Wq,xye,"a private address","Ipv4PrivateAddressFromString"),vht=es(zq,Sye,"a unique-local address","Ipv6UniqueLocalAddress"),_ht=es(Pve,Sye,"a unique-local address","Ipv6UniqueLocalAddressFromString"),wht=es(Dw,yye,"a locally administered address","MacLocallyAdministeredAddress"),bht=es(w4,yye,"a locally administered address","MacLocallyAdministeredAddressFromString"),xht=es(Dw,vye,"a universally administered address","MacUniversallyAdministeredAddress"),Sht=es(w4,vye,"a universally administered address","MacUniversallyAdministeredAddressFromString"),Mve=Rr(Blt,{identifier:"Ipv4Interface"}),kht=cm(Mve,Aye,V8,"Ipv4InterfaceFromString"),Dve=Rr(jlt,{identifier:"Ipv6Interface"}),Eht=cm(Dve,Tye,V8,"Ipv6InterfaceFromString"),Lve=Rr(H8,{identifier:"IpInterface"}),Aht=cm(Lve,Iye,V8,"IpInterfaceFromString"),Nve=Rr(qlt,{identifier:"Ipv4Network"}),Tht=cm(Nve,Qlt,J8,"Ipv4NetworkFromString"),$ve=Rr(Hlt,{identifier:"Ipv6Network"}),Iht=cm($ve,Xlt,J8,"Ipv6NetworkFromString"),Uve=Rr(K8,{identifier:"IpNetwork"}),Cht=cm(Uve,Ylt,J8,"IpNetworkFromString"),Rht=Rr(W8,{identifier:"InetAddressV4"}),Oht=Rr(z8,{identifier:"InetAddressV6"}),Fve=Rr(mye,{identifier:"InetAddress"}),Pht=cm(Fve,Nlt,Rq,"InetAddressFromString"),Bve=Rr(Sq,{identifier:"UnixPathAddress"}),Mht=te.pipe(An(Bve,oo({decode:Flt,encode:e=>e.path}))).annotate({identifier:"UnixPathAddressFromString"}),Dht=Rr(plt,{identifier:"SocketAddress"}),Lht=mu({decode:(e,t)=>Oa(IKe(e),{onNone:()=>be(new ir({expected:"a valid Duration string"},e,t)),onSome:we}),encode:e=>we(globalThis.String(e))}),Nht=mu({decode:e=>we(ew(e)),encode:(e,t)=>Oa(BKe(e),{onNone:()=>be(new ir({expected:"a Duration representable as a bigint"},e,t)),onSome:n=>we(n)})}),$ht=oo({decode:e=>K5(e),encode:e=>tw(e)}),h9=Rr(kde,{representation:{id:"effect/schema/Duration",payload:null},toCode:()=>({runtime:"Schema.Duration",Type:"Duration.Duration",importDeclarations:['import * as Duration from "effect/Duration"']}),expected:"Duration",toCodecJson:()=>Nr()(At([V({_tag:Ce("Infinity")}),V({_tag:Ce("NegativeInfinity")}),V({_tag:Ce("Nanos"),value:qv}),V({_tag:Ce("Millis"),value:rt})]),oo({decode:e=>{switch(e._tag){case"Infinity":return O2;case"NegativeInfinity":return V5;case"Nanos":return ew(e.value);case"Millis":return K5(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}}}}))}),Uht=te.annotate({expected:"a string that will be decoded as a Duration"}),Fht=Uht.pipe(An(h9,Lht)),Bht=qv.pipe(An(h9,Nht)),jht=on.pipe(An(h9,$ht)),jve=Rr(wst,{representation:{id:"effect/http/Cookie",payload:null},toCode:()=>({runtime:"Schema.Cookie",Type:"Cookies.Cookie",importDeclarations:['import * as Cookies from "effect/http/Cookies"']}),expected:"Cookie"}),Wve=Rr(_st,{representation:{id:"effect/http/Cookies",payload:null},toCode:()=>({runtime:"Schema.Cookies",Type:"Cookies.Cookies",importDeclarations:['import * as Cookies from "effect/http/Cookies"']}),expected:"Cookies",toCodecJson:()=>Nr()(ut(te),oo({decode:Sst,encode:Cst})),toCodecIso:()=>Nr()(Vs(te,jve),oo({decode:yge,encode:e=>e.cookies}))}),Wht=Wve.pipe(An(Vs(te,te),oo({decode:Ist,encode:e=>vge(globalThis.Object.entries(e).map(([t,n])=>Tst(t,n)))}))),zht=Rr(Ost,{representation:{id:"effect/http/Headers",payload:null},toCode:()=>({runtime:"Schema.Headers",Type:"Headers.Headers",importDeclarations:['import * as Headers from "effect/http/Headers"']}),expected:"Headers",toEquivalence:()=>wge,toCodec:()=>Nr()(Vs(te,te),oo({decode:Mst,encode:e=>({...e})}))}),qq=Rr(bge,{representation:{id:"effect/http/UrlParams",payload:null},toCode:()=>({runtime:"Schema.UrlParams",Type:"UrlParams.UrlParams",importDeclarations:['import * as UrlParams from "effect/http/UrlParams"']}),expected:"UrlParams",toEquivalence:()=>Sge,toCodec:()=>Nr()(ut(Ka([te,te])),oo({decode:Iz,encode:e=>e.params}))}),qht=(e,t)=>qq.pipe(An(ti(Sl,t),mu({decode:n=>Oa(Fst(n,e),{onNone:()=>be(new yc([e],new b8(void 0))),onSome:we}),encode:n=>we(Iz([[e,n]]))}))),Hht=qq.pipe(An(Vs(te,At([te,a9(te)])),oo({decode:jst,encode:$st}))),Ght=globalThis.Symbol.for("immer-draftable"),Hq={},zve=e=>(t,n)=>{const i=r9(t)?t:V(t);return jye(xJe,e,i,n,r=>({toString(){return`${r}(${Qt({...this})})`}}))},Vht=e=>(t,n,i)=>{const r=r9(n)?n.mapFields(o=>({_tag:_a(t),...o}),{unsafePreserveChecks:!0}):Fq(t,n);return zve(e??t)(r,i)},Gq=e=>(t,n)=>{const i=r9(t)?t:V(t);return jye(ZB,e,i,n,o=>({name:o}))},Kht=e=>(t,n,i)=>{const r=r9(n)?n.mapFields(o=>({_tag:_a(t),...o}),{unsafePreserveChecks:!0}):Fq(t,n);return Gq(e??t)(r,i)},Vq=Cut,Jht=Put,Qht=Mut,Xht=p2n,Id=pn(Aw(BA,{toCode:()=>({runtime:"Schema.Json",Type:"Schema.Json"})})),qve=Vs(te,Id),Yht=V({message:te,name:Ue(te),stack:Ue(te),cause:Ue(Id)}),Zht=pn(Aw(Wct,{toCode:()=>({runtime:"Schema.MutableJson",Type:"Schema.MutableJson"})}))}});function Cd(e){const t=e instanceof Ne?e:new Ne("runtime","unavailable","Shiitake operation failed"),n={_tag:t._tag,boundary:t.boundary,cause:t.cause,message:t.message};return t.requestId!==void 0&&Object.assign(n,{requestId:t.requestId}),Object.freeze(n)}var emt,tmt,nmt,imt,Ne,Ei=A({"../../packages/shiitake/dist/errors.js"(){"use strict";wt(),emt=ct(["contract","extensions","instructions","model","runtime","store","tools"]),tmt=ct(["closed","conflict","incompatible","invalid","rejected","unavailable","state_reset_required","storage_pressure","archived","secret_in_prompt"]),nmt=te.pipe(Ze(rn(1)),Ze(ft(256))),imt=V({_tag:Ce("ShiitakeError"),boundary:emt,cause:tmt,message:te,requestId:Ue(nmt)}),Ne=class extends Error{boundary;requestId;_tag="ShiitakeError";cause;underlying;constructor(e,t,n,i,r){super(n),this.boundary=e,this.requestId=i,this.name="ShiitakeError",this.cause=t,this.underlying=r}}}});function m9(e){return te.check(rn(1),ft(e),vn(t=>Kq.encode(t).byteLength<=e))}function Hr(e){const t=Amt(e);if(t._tag==="Failure")throw new Ne("contract","invalid","Session id is invalid");return t.success}function $Sn(e){const t=pmt(e);if(t._tag==="Failure")throw new Ne("contract","invalid","Session cursor is invalid");return t.success}function Hve(e){const t=Jq(e);if(t._tag==="Failure")throw new Ne("contract","invalid","Session creation request is invalid");return t.success.requestId}function rmt(e){const t=Rmt(e);if(t._tag==="Failure")throw new Ne("contract","invalid","Read options are invalid");const n=t.success??{};let i={limit:n.limit??200};return n.before!==void 0&&(i={...i,before:n.before}),n.includeSandboxFailures!==void 0&&(i={...i,includeSandboxFailures:n.includeSandboxFailures}),Object.freeze(i)}function USn(e){const t=Pmt(e);if(t._tag==="Failure")throw new Ne("contract","invalid","Subscribe options are invalid");let n={};return t.success.after!==void 0&&(n={...n,after:t.success.after}),t.success.includeSandboxFailures!==void 0&&(n={...n,includeSandboxFailures:t.success.includeSandboxFailures}),Object.freeze(n)}function f9(e,t){if(kn(e))throw new Ne("contract","invalid",t);return e.success}var Kq,omt,um,smt,Gve,amt,cmt,umt,lmt,dmt,pmt,hmt,Vve,mmt,fmt,gmt,ymt,vmt,Kve,Jve,_mt,Qve,Xve,wmt,Yve,bmt,xmt,Smt,kmt,Emt,P0,Amt,Jq,Tmt,u6,Imt,Cmt,Rmt,Omt,Pmt,Mmt,M0=A({"../../packages/shiitake/dist/internal/client-boundary.js"(){"use strict";ki(),wt(),Ei(),Kq=new TextEncoder,omt=/\p{Cs}/u,um=m9(256).check(vn(e=>!omt.test(e))),smt=m9(256*1024),Gve=V({type:Ce("image"),data:te.check(rn(1),ft(1024*1024),Mye()),mimeType:te.check(vn(e=>["image/png","image/jpeg","image/gif","image/webp"].includes(e)))}),amt=ut(Gve).check(rn(1),ft(8)),cmt=ct(["steer","followUp"]),umt=um,lmt=It(V({commandId:um,timeoutMs:rt.check(Wt(0),Da(3e4))}),{onExcessProperty:"error"}),dmt=It(V({commandId:um,timeoutMs:u9.check(Ff(),Ad({minimum:0,maximum:3e4}))}),{onExcessProperty:"error"}),pmt=It(m9(512)),hmt=V({requestId:um}),Vve=V({delivery:cmt,requestId:um,type:Ce("prompt"),text:te.check(ft(256*1024),vn(e=>Kq.encode(e).byteLength<=256*1024)),images:Ue(amt)}).check(vn(e=>(e.text.length>0||(e.images?.length??0)>0)&&Kq.encode(e.text).byteLength+(e.images??[]).reduce((t,n)=>t+n.data.length,0)<=1024*1024)),mmt=V({type:Ce("abort")}),fmt=V({commandId:um,onlyIfPending:jt(ai),type:Ce("cancel")}),gmt=V({type:Ce("operator"),requestId:um,author:ct(["operator","party"]),text:smt}),ymt=V({type:Ce("branch"),entryId:um}),vmt=V({type:Ce("fork"),entryId:um}),Kve=te.check(rn(1),ft(4096)),Jve=V({type:Ce("compact"),requestId:um,instructions:Ue(Kve)}),_mt=At([Vve,Jve]),Qve=120,Xve=te.check(vn(e=>e.length>0&&e.trim()===e&&!/\p{Cc}/u.test(e)&&Array.from(e).length<=Qve)),wmt=V({type:Ce("title"),title:dt(Xve)}),Yve=At([Vve,mmt,fmt,ymt,vmt,gmt,Jve,wmt]),bmt=V({command:Yve}),xmt=V({includeSandboxFailures:jt(ai),limit:jt(rt.check(Ad({minimum:1,maximum:200}))),before:jt(m9(512))}),Smt=V({includeSandboxFailures:jt(Ce("true")),limit:jt(u9.check(Ff(),Ad({minimum:1,maximum:200}))),before:jt(m9(512))}),kmt=V({includeSandboxFailures:jt(ai),after:jt(te)}),Emt=V({includeSandboxFailures:jt(Ce("true")),mode:jt(Ce("subscribe")),after:jt(te),limit:jt(u9.check(Ff(),Ad({minimum:1,maximum:200})))}),P0={onExcessProperty:"error"},Amt=It(umt,P0),Jq=It(hmt,P0),Tmt=It(_mt,P0),u6=It(um),Imt=It(Yve,P0),Cmt=It(bmt,P0),Rmt=It(At([xmt,s6]),P0),Omt=It(Smt,P0),Pmt=It(kmt,P0),Mmt=It(Emt,P0)}});function Zve(e){const t={kind:"reason_unavailable",...e,provider:e.provider===""?null:e.provider,model:e.model===""?null:e.model};return`${t.kind}: run=${t.runId}; provider=${t.provider??"unknown"}; model=${t.model??"unknown"}`.slice(0,200)}function Dmt(e){return Zve({runId:e.run.value,provider:e.message.provider,model:e.message.model})}var e1e=A({"../../packages/shiitake/dist/internal/run-failure-reason.js"(){"use strict"}}),Lmt,Nmt,t1e,n1e,l6,d6,i1e,$mt,r1e,Umt=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/MutableList.js"(){Ode(),Lmt=Symbol.for("effect/MutableList/Empty"),Nmt=()=>({head:void 0,tail:void 0,length:0}),t1e=e=>{const t=e.head;t.offset>=1024&&t===e.tail&&t.mutable&&(t.array.length-t.offset)*8<=t.offset&&(e.head=e.tail={array:t.array.slice(t.offset),mutable:!0,offset:0,next:void 0})},n1e=()=>({array:[],mutable:!0,offset:0,next:void 0}),l6=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=n1e(),e.tail=e.tail.next):e.head=e.tail=n1e(),e.tail.array.push(t),e.length++},d6=e=>{e.head=e.tail=void 0,e.length=0},i1e=(e,t)=>{if(t=y7(t),t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){const o=e.head.array;return d6(e),o}const n=new Array(t);let i=0,r=e.head;for(;r;){for(;r.offset<r.array.length;)if(n[i++]=r.array[r.offset],r.mutable&&(r.array[r.offset]=void 0),r.offset++,i===t)return e.head=r.offset===r.array.length&&r.next?r.next:r,e.length-=t,e.length===0?d6(e):t1e(e),n;r=r.next}return d6(e),n},$mt=e=>i1e(e,e.length),r1e=e=>{if(!e.head)return Lmt;const t=e.head.array[e.head.offset];return e.head.mutable&&(e.head.array[e.head.offset]=void 0),e.head.offset++,e.length--,e.head.offset===e.head.array.length?e.head.next?e.head=e.head.next:d6(e):t1e(e),t}}}),Fmt,Bmt,jmt,Qq,Wmt,Nw,g9,zmt,qmt,D0,Wf,Up,y9,Hv,x4,Hmt,Gmt,o1e,s1e,Gv,Vmt,a1e,Kmt,c1e,v9,Jmt,Qmt,u1e,l1e,Xmt,_9,Xq,d1e,Ymt,Zmt,p1e,Yq,S4,eft,w9,k4=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Queue.js"(){Nn(),Tr(),Tr(),Ode(),Cs(),Umt(),ri(),Pv(),Fmt="~effect/Queue",Bmt="~effect/Queue/Enqueue",jmt="~effect/Queue/Dequeue",Qq={_A:an,_E:an},Wmt={[Fmt]:Qq,[Bmt]:Qq,[jmt]:Qq,...Ra,toJSON(){return{_id:"effect/Queue",state:this.state._tag,size:Kmt(this)}}},Nw=e=>Si(t=>{const n=Object.create(Wmt);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??Number.POSITIVE_INFINITY,n.strategy=e?.strategy??"suspend",n.messages=Nmt(),n.scheduleRunning=!1,n.state={_tag:"Open",takers:new Set,offers:new Set,awaiters:new Set},Xt(n)}),g9=e=>Nw({capacity:e}),zmt=e=>Nw({capacity:e,strategy:"sliding"}),qmt=e=>Nw({capacity:e,strategy:"dropping"}),D0=me(2,(e,t)=>Oi(()=>Wf(e,t)?v9:e.state._tag==="Open"&&e.strategy==="suspend"?Ymt(e,t):c1e)),Wf=(e,t)=>e.state._tag!=="Open"?!1:e.messages.length>=e.capacity?e.strategy==="sliding"?(r1e(e.messages),l6(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0?(l6(e.messages,t),u1e(e),!0):!1:(l6(e.messages,t),l1e(e),!0),Up=me(2,(e,t)=>dr(()=>y9(e,t))),y9=(e,t)=>{if(e.state._tag!=="Open")return!1;const n=_p(t),i=NQe(n,Jmt);return e.state.offers.size===0&&e.messages.length===0?(w9(e,i),!0):(e.state={...e.state,_tag:"Closing",exit:i},l1e(e),!0)},Hv=e=>y9(e,KB(s7())),x4=e=>dr(()=>Hmt(e)),Hmt=e=>{if(e.state._tag==="Done")return!1;d6(e.messages);const t=e.state.offers;w9(e,e.state._tag==="Open"?Qmt:e.state.exit);for(const n of t)p1e(n);return!0},Gmt=e=>_9(()=>{if(e.state._tag==="Done")return Cp(e.state.exit,()=>Xt([]));const t=eft(e);return S4(e),Xt(t)}),o1e=e=>s1e(e,1,Number.POSITIVE_INFINITY),s1e=me(3,(e,t,n)=>(t=y7(t),n=y7(n),_9(()=>Xmt(e,t,n)??aw(d1e(e,()=>Xq(e,t)),s1e(e,t,n))))),Gv=e=>_9(()=>a1e(e)??aw(d1e(e,()=>Xq(e,1)),Gv(e))),Vmt=e=>_9(()=>{const t=a1e(e);return t===void 0?Xt($t()):t._tag==="Success"?Xt(Mt(t.value)):Xt($t())}),a1e=e=>{if(e.state._tag==="Done")return e.state.exit;if(e.messages.length>0){const t=r1e(e.messages);return S4(e),To(t)}else if(e.capacity<=0&&e.state.offers.size>0){const t=Yq(e.state.offers);return S4(e),To(t)}},Kmt=e=>e.state._tag==="Done"?0:e.messages.length,c1e=To(!1),v9=To(!0),Jmt=p0(s7()),Qmt=Rpe(),u1e=e=>{if(!(e.state._tag==="Done"||e.state.takers.size===0)){for(const t of e.state.takers)if(t.ready()&&(e.state.takers.delete(t),t.resume(vl),e.messages.length===0))break}},l1e=e=>{e.scheduleRunning||e.state._tag==="Done"||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>{e.scheduleRunning=!1,u1e(e)},0))},Xmt=(e,t,n)=>{if(e.state._tag==="Done")return e.state.exit;if(n<=0||t<=0)return To([]);if(!Xq(e,t))return;const i=e.messages.length>0?i1e(e.messages,n):[Yq(e.state.offers)];return S4(e),To(i)},_9=yf({op:"QueueTake",[As](e){const t=this[Wi]();return qB(t)?t[As](e):t}}),Xq=(e,t)=>e.messages.length>=(e.state._tag==="Closing"?1:Math.min(t,e.capacity||1))||e.capacity<=0&&e.state._tag!=="Done"&&e.state.offers.size>0,d1e=(e,t)=>Lu(n=>{if(e.state._tag==="Done")return n(e.state.exit);if(t())return n(vl);const i={ready:t,resume:n};return e.state.takers.add(i),dr(()=>{e.state._tag!=="Done"&&e.state.takers.delete(i)})}),Ymt=(e,t)=>Lu(n=>Wf(e,t)?n(v9):Zmt(e,{_tag:"Single",message:t,resume:n})),Zmt=(e,t)=>{if(e.state._tag!=="Open")return p1e(t);const n=e.state.offers;return n.add(t),dr(()=>{e.state._tag!=="Done"&&(n.delete(t),e.state._tag==="Closing"&&n.size===0&&e.messages.length===0&&w9(e,e.state.exit))})},p1e=e=>e._tag==="Single"?e.resume(c1e):e.resume(To(e.remaining.slice(e.offset))),Yq=e=>{const t=e.values().next().value;if(t._tag==="Single")return e.delete(t),t.resume(v9),t.message;const n=t.remaining[t.offset++];return t.offset===t.remaining.length&&(e.delete(t),t.resume(To([]))),n},S4=e=>{if(e.state._tag==="Done")return Y2(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag==="Closing"&&e.messages.length===0?(w9(e,e.state.exit),Y2(e.state.exit.cause)):!1;for(const t of e.state.offers){let n=e.capacity-e.messages.length;if(n<=0)break;if(t._tag==="Single")l6(e.messages,t.message),e.state.offers.delete(t),t.resume(v9);else{for(;t.offset<t.remaining.length;t.offset++){if(n===0)return!1;l6(e.messages,t.remaining[t.offset]),n--}e.state.offers.delete(t),t.resume(To([]))}const i=e.state;if(i._tag==="Done")return Y2(i.exit.cause)}return!1},eft=e=>{if(e.messages.length>0){const t=$mt(e.messages);return S4(e),t}else if(e.state._tag!=="Done"&&e.state.offers.size>0){const t=[Yq(e.state.offers)];return S4(e),t}return[]},w9=(e,t)=>{if(e.state._tag==="Done")return;const n=e.state;e.state={_tag:"Done",exit:t};for(const i of n.takers)i.resume(t);n.takers.clear();for(const i of n.awaiters)i(t);n.awaiters.clear()}}});function Rd(e,t,n){Mp(zc("shiitake_operation_failed",wp(t)).pipe(Jh({operation:e,errorKind:t instanceof Error?"error":"non-error",...n})))}var p6=A({"../../packages/shiitake/dist/internal/failure.js"(){"use strict";gt(),bv()}});function h1e(e){const t=f1e.get(e);if(t!==void 0)return t;const n=JSON.stringify(e),i=Object.freeze({data:n,bytes:oft.encode(n).byteLength});return f1e.set(e,i),i}function FSn(e){if(e.kind==="update"&&e.sandboxFailures!==void 0){const t={...e};return delete t.sandboxFailures,t}if(e.kind==="reset"&&e.baseline.sandboxFailures!==void 0){const t={...e.baseline};return delete t.sandboxFailures,{...e,baseline:t}}return e}function BSn(e){const t=new Set;let n=!1,i;const r=o=>{bw(Gmt(o.frames)),o.bytes=0};return{register(o=!1){const s={frames:bw(qmt(256)),bytes:0,lagged:!1,closed:!1,observed:-1,includeSandboxFailures:o};t.add(s);const a=Ut(()=>s.closed?we("closed"):i!==void 0?be(i):s.lagged?we("reset"):n?we("closed"):Gv(s.frames).pipe(Cp(()=>we("closed")),De(c=>i!==void 0?be(i):(c!=="reset"&&c!=="closed"&&(s.bytes-=h1e(c).bytes),we(c)))));return Object.freeze({take:a,checkpoint:(c=-1)=>{r(s),s.lagged=!1,s.observed=c},close:()=>{s.closed||(s.closed=!0,r(s),t.delete(s),Hv(s.frames),t.size===0&&e())}})},publish(o,s=1/0){if(n)return;const a=FSn(o);for(const c of t){if(c.closed||c.lagged||s<=c.observed)continue;const u=c.includeSandboxFailures?o:a,{bytes:l}=h1e(u);c.bytes+l>1048576||!Wf(c.frames,u)?(r(c),c.lagged=!0,Wf(c.frames,"reset")):c.bytes+=l}},end(o){if(!n){n=!0,i=o;for(const s of t)r(s),s.lagged=!1,Hv(s.frames)}}}}function jSn(e,t){for(const n of E4.get(e)??[])if(n.observes(t))return!0;return!1}function WSn(e,t){return e==="closed"||t==="closed"?"closed":e==="reset"||t==="reset"?"reset":e==="durable"||t==="durable"?"durable":e==="activity"||t==="activity"?"activity":"progress"}function zSn(e,t){if(e.pendingCount>=rft){e.pendingCount=0,e.pendingReason=void 0,e.reset=!0;return}e.pendingCount+=1,e.pendingReason=e.pendingReason==="durable"||t==="durable"?"durable":e.pendingReason==="activity"||t==="activity"?"activity":"progress"}function tft(e,t){if(e.closed||(e.revision+=1,e.reset))return;const n=e.wake;if(n===void 0){zSn(e,t);return}e.wake=void 0;try{n(t)}catch(i){Rd("observation-delivery",i),e.pendingCount=0,e.pendingReason=void 0,e.reset=!0}}function nft(e,t){for(const n of e)n.queued&&!n.settlementOnly&&n.sessionId!==t&&tft(n,"activity")}function bo(e,t,n="durable"){const i=E4.get(e);if(i!==void 0)for(const r of i)try{r.publish({kind:"session",sessionId:t,reason:n})}catch(o){Rd("owner-observation-publish",o);continue}}function m1e(e){const t=E4.get(e);if(t!==void 0)for(const n of t)try{n.publish({kind:"agent-execution"})}catch(i){Rd("owner-execution-change-publish",i)}}function qSn(e){const t=new Map,n=new Set,i=E4.get(e)??new Set;let r=!1;const o=u=>{if(u.closed)return"closed";if(u.reset)return u.reset=!1,"reset";if(u.pendingCount===0)return;u.pendingCount=0;const l=u.pendingReason;return u.pendingReason=void 0,l??"progress"},s=u=>{if(u.closed)return;u.closed=!0,u.pendingCount=0,u.pendingReason=void 0,u.reset=!1;const l=u.wake;u.wake=void 0,n.delete(u);const d=t.get(u.sessionId);if(d?.delete(u),d?.size===0&&t.delete(u.sessionId),l!==void 0)try{l("closed")}catch(p){Rd("observation-listener-close",p)}},c={publish:u=>{if(u.kind==="agent-execution"){nft(n,null);return}u.sessionId!==null&&u.reason!=="settlement"&&nft(n,u.sessionId);const l=u.sessionId===null?n:t.get(u.sessionId);if(l!==void 0)for(const d of l)d.settlementOnly&&u.reason!=="settlement"||tft(d,u.reason==="settlement"?"durable":u.reason)},observes:u=>[...t.get(u)??[]].some(l=>!l.closed&&!l.settlementOnly)};return i.add(c),E4.set(e,i),Object.freeze({register:(u,l)=>Ut(()=>{if(r)return be(new Ne("runtime","closed","Shiitake is closed"));if(n.size>=ift)return be(new Ne("runtime","rejected","Observation capacity is exhausted"));const d={revision:0,sessionId:u,settlementOnly:l==="settlement",closed:!1,pendingCount:0,pendingReason:void 0,queued:!0,reset:!1,wake:void 0},p=t.get(u)??new Set;p.add(d),t.set(u,p),n.add(d);const h=nt(()=>o(d)),m=fc(f=>{const g=o(d);if(g!==void 0){f(we(g));return}const y=v=>{f(we(v))};return d.wake=y,nt(()=>{d.wake===y&&(d.wake=void 0)})});return we(Object.freeze({get revision(){return d.revision},pollSignal:h,awaitSignal:m,close:()=>{s(d)},setQueued:f=>{d.closed||(d.queued=f)}}))}),close:nt(()=>{if(!r){r=!0,i.delete(c),i.size===0&&E4.delete(e);for(const u of n)s(u)}})})}var ift,rft,f1e,oft,E4,zf=A({"../../packages/shiitake/dist/internal/observation-kernel.js"(){"use strict";gt(),Pv(),k4(),Ei(),p6(),ift=64,rft=256,f1e=new WeakMap,oft=new TextEncoder,E4=new WeakMap}}),sft,g1e,aft,y1e,v1e,cft,HSn,_1e,GSn,VSn,uft,KSn,JSn=A({"../../packages/shiitake/dist/internal/woodstock/cold-sessions.js"(){"use strict";wt(),Ei(),sft=200,g1e={onExcessProperty:"error"},aft=new TextEncoder,y1e=rt.pipe(Ze(Wt(0))),v1e=te.pipe(Ze(rn(1)),Ze(vn(e=>aft.encode(e).byteLength<=256))),cft=V({limit:Ue(rt.pipe(Ze(Ad({minimum:1,maximum:sft})))),after:Ue(te)}),HSn=It(cft,g1e),_1e=ti(Ka([y1e,v1e])),GSn=It(_1e),VSn=fu(_1e),uft=V({session_id:v1e,last_activity_at:y1e,state:ct(["needs_you","running","errored","done"]),bytes:rt.pipe(Ze(Wt(0)))}),KSn=It(uft,g1e)}});function w1e(e){const t=b9.safeParse(e);return t.success?t.data.author:void 0}function b1e(e){const{id:t,name:n,kind:i}=e;return i===void 0?{author:{id:t,name:n}}:{author:{id:t,name:n,kind:i}}}var lft,A4,dft,b9,QSn=A({"../../packages/agar/dist/agent-message-meta.js"(){"use strict";yt(),lft=Ln(()=>Dr({id:F().min(1).max(256),name:F().min(1).max(128),kind:Ie("agent").optional()})),A4=Ln(()=>F().min(1).max(256)),dft=Ln(()=>Dr({agentId:A4,sessionId:A4,commandId:A4,outcome:wn(["completed","failed","interrupted","cancelled","outcome_unknown"]),diagnostic:F().min(1).max(200).optional(),waitingOnYou:Me(Dr({itemId:A4,kind:F().min(1).max(64),summary:F().min(1).max(200)})).min(1).max(8).optional()})),b9=Dr({author:lft.optional(),sourceRequestId:A4.optional(),delegation:Dr({ancestors:Me(A4).max(8),maxDepth:et().int().min(1).max(8),steer:Ie(!0).optional(),goal:Et([F().min(1).max(4e3),Ie(!1)]).optional(),reply:dft.optional()}).optional()})}}),x1e,pft,XSn,YSn=A({"../../packages/agar/dist/backend-refusal.js"(){"use strict";yt(),x1e=["exec_isolation_required","execution_not_admitted","artifact_unavailable","disabled","timed_out","permission_changed","binding_reply_invalid","backend_error","cancelled","request_too_large","not_offered","internal"],pft=Dr({binding:F().min(1).max(64),method:F().min(1).max(128),path:F().max(256)}),XSn=Dr({error:Ie("App execution unavailable"),reason:wn(x1e),ref:F().min(1).max(64).optional(),where:pft.optional()})}});function ZSn(e){return`This needs ${e??"setup"} first.`}var hft,ekn,tkn,nkn,x9,ikn,rkn=A({"../../packages/agar/dist/errors.js"(){"use strict";wt(),YSn(),hft=["CANCELLED","CAPABILITY_DENIED","CAPABILITY_REVOKED","COMMAND_NOT_DECLARED","CONFLICT","DAILY_LIMIT_REACHED","DELIVERY_PENDING","DISCONNECTED","FILE_TOO_LARGE","HOST_FAILURE","IDENTITY","INSUFFICIENT_CREDIT","INVALID_ARGUMENT","MEDIA_PROVIDER_FAILURE","MEDIA_PROVIDER_FAILURE_UNCHARGED","PROTOCOL","SAFETY_FILTER_REFUSED","SELECTION_CHANGED","SETUP_REQUIRED","TIMEOUT"],ekn=V({name:Ce("AppError"),code:ct(hft),retryable:ai,need:jt(te),reason:jt(te),ref:jt(te),where:jt(Sl)}),tkn=ct(x1e),nkn=V({binding:te,method:te,path:te}),x9=class extends Error{code;retryable;need;reason;ref;where;constructor(e,t){super(e,{cause:t.cause}),this.name="AppError",this.code=t.code,this.retryable=t.retryable,this.need=t.need,this.reason=t.reason,this.ref=t.ref,this.where=t.where}},ikn={CANCELLED:{title:"Request cancelled",message:"It stopped before it finished. Start it again if you still want it."},CAPABILITY_DENIED:{title:"Access needed",message:"This App needs permission to do that.",action:"grant"},CAPABILITY_REVOKED:{title:"Access changed",message:"This App no longer has permission to do that.",action:"grant"},COMMAND_NOT_DECLARED:{title:"Action unavailable",message:"This App doesn't include that action. It may need an update."},CONFLICT:{title:"File changed",message:"This file changed elsewhere. Review it before saving again."},DAILY_LIMIT_REACHED:{title:"Daily limit reached",message:"Today's spending limit for this Oyster is used up. It resets at 00:00 UTC."},DELIVERY_PENDING:{title:"App delivery pending",message:"The App hasn't finished getting ready. Try opening it again."},DISCONNECTED:{title:"Connection lost",message:"Reopen the App to connect again.",action:"reconnect"},HOST_FAILURE:{title:"Couldn't complete the request",message:"The host stopped answering. Reopen the App or reload the workspace."},FILE_TOO_LARGE:{title:"File too large",message:"Choose a file within the supported size limit."},IDENTITY:{title:"Couldn't connect",message:"Reopen the App to connect again.",action:"reconnect"},INSUFFICIENT_CREDIT:{title:"Something went wrong",message:"The App couldn't complete this request.",action:"billing"},INVALID_ARGUMENT:{title:"Request not accepted",message:"Some of the details weren't usable. Check them and try again."},MEDIA_PROVIDER_FAILURE:{title:"Generation failed",message:"The model couldn't complete this generation. Change the prompt or model and send again."},MEDIA_PROVIDER_FAILURE_UNCHARGED:{title:"Generation failed",message:"The model couldn't complete this generation. You weren't charged. Change the prompt or model and send again."},PROTOCOL:{title:"Couldn't read the response",message:"The host sent something this App doesn't understand. Reload the workspace; if it keeps happening, the App may need an update."},SAFETY_FILTER_REFUSED:{title:"Generation refused",message:"The model refused this generation. Change the prompt or reference image and send again."},SELECTION_CHANGED:{title:"Selection changed",message:"The selection changed during this request. Reopen the App to continue.",action:"reconnect"},SETUP_REQUIRED:{title:"Setup needed",message:ZSn(void 0),action:"setup"},TIMEOUT:{title:"Still waiting",message:"The request didn't respond in time. Its outcome isn't known yet."},UNKNOWN:{title:"Something went wrong",message:"The App couldn't complete this request."}}}});function L0(e,t,n){return new mft(e,t,n)}var mft,okn=A({"../../packages/agar/dist/capabilities.js"(){"use strict";mft=class{id;version;#e;constructor(e,t,n){this.id=e,this.version=t,this.#e=n,Object.freeze(this)}get schema(){return this.#e}}}});function h6(e){switch(typeof e){case"boolean":case"number":case"string":return"primitive";case"undefined":return"undefined";case"object":case"function":break;case"bigint":return"bigint";default:return"unsupported"}if(e===null)return"primitive";let t=Object.getPrototypeOf(e);switch(t){case Object.prototype:return"object";case Function.prototype:case bft.prototype:return"function";case Array.prototype:return"array";case Date.prototype:return"date";case Uint8Array.prototype:case xft:case ArrayBuffer.prototype:case DataView.prototype:case Int8Array.prototype:case Uint8ClampedArray.prototype:case Int16Array.prototype:case Uint16Array.prototype:case Int32Array.prototype:case Uint32Array.prototype:case BigInt64Array.prototype:case BigUint64Array.prototype:case Float32Array.prototype:case Float64Array.prototype:return"bytes";case WritableStream.prototype:return"writable";case ReadableStream.prototype:return"readable";case URL.prototype:return"url";case Headers.prototype:return"headers";case Request.prototype:return"request";case Response.prototype:return"response";case Blob.prototype:return"blob";case $0.prototype:return"stub";case wa.prototype:return"rpc-promise";default:if($w){if(t==$w.RpcStub.prototype||e instanceof $w.ServiceStub)return"rpc-target";if(t==$w.RpcPromise.prototype||t==$w.RpcProperty.prototype)return"rpc-thenable"}return e instanceof E9?"rpc-target":e instanceof Error?"error":"unsupported"}}function fft(){throw new Error("RPC map() implementation was not loaded.")}function S1e(){throw new Error("Stream implementation was not loaded.")}function skn(e,t){let n=T9;T9=e;try{return t()}finally{T9=n}}function akn(e){let{hook:t,pathIfPromise:n}=e[lm];return n&&n.length>0?t.get(n):t}function ckn(e){let{hook:t,pathIfPromise:n}=e[lm];return n?t.get(n):t.dup()}function k1e(e){let{hook:t,pathIfPromise:n}=e[lm];if(!(n&&n.length>0))return t}function gft(e){return e[lm].hook}function S9(e){return e[lm]}async function E1e(e){let{hook:t,pathIfPromise:n}=e[lm];return n.length>0&&(t=t.get(n)),(await t.pull()).deliverResolve()}function A1e(e,t,n,i){for(let r=0;r<n.length;r++){t=e;let o=n[r];if(o in Object.prototype){e=void 0;continue}switch(h6(e)){case"object":case"function":Object.hasOwn(e,o)?e=e[o]:e=void 0;break;case"array":Number.isInteger(o)&&o>=0?e=e[o]:e=void 0;break;case"rpc-target":case"rpc-thenable":if(Object.hasOwn(e,o))throw new TypeError(`Attempted to access property '${o}', which is an instance property of the RpcTarget. To avoid leaking private internals, instance properties cannot be accessed over RPC. If you want to make this property available over RPC, define it as a method or getter on the class, instead of an instance property.`);e=e[o],i=null;break;case"stub":case"rpc-promise":{let{hook:s,pathIfPromise:a}=S9(e);return{hook:s,remainingPath:a?a.concat(n.slice(r)):n.slice(r)}}case"writable":e=void 0;break;case"readable":e=void 0;break;case"primitive":case"bigint":case"bytes":case"blob":case"date":case"error":case"url":case"headers":case"request":case"response":e=void 0;break;case"undefined":e=e[o];break;case"unsupported":if(r===0)throw new TypeError("RPC stub points at a non-serializable type.");{let s=n.slice(0,r).join("."),a=n.slice(0,r).join(".");throw new TypeError(`'${s}' is not a serializable type, so property ${a} cannot be accessed.`)}default:throw new TypeError("unreachable")}}if(e instanceof wa){let{hook:r,pathIfPromise:o}=S9(e);return{hook:r,remainingPath:o||[]}}return{value:e,parent:t,owner:i}}function yft(e){if(Symbol.dispose in e)try{e[Symbol.dispose]()}catch(t){Promise.reject(t)}}function ukn(e){return kft.includes(e)}function vft(e,t){if(t!==2&&t!==4&&t!==8)throw new RangeError(`Unsupported element size: ${t}`);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let i=0;i<e.byteLength;i+=t)switch(t){case 2:n.setUint16(i,n.getUint16(i,!1),!0);break;case 4:n.setUint32(i,n.getUint32(i,!1),!0);break;case 8:n.setBigUint64(i,n.getBigUint64(i,!1),!0)}}async function lkn(e,t){let n=await new Response(e).blob();return n.type===t?n:n.slice(0,n.size,t)}function dkn(e,t){let n=new Response(t).arrayBuffer().then(i=>{let r=new Uint8Array(i),o=new Request(e,{body:r});return new kl(Hc.fromAppReturn(o))});return new wa(new f6(n),[])}function pkn(e,t){let n=lkn(e,t).then(i=>new kl(Hc.fromAppReturn(i)));return new wa(new f6(n),[])}function m6(e){return 2+e.length*3}function Zq(e,t,n=0){if(n>=Cft)return g6;switch(typeof e){case"string":return m6(e);case"number":return 16;case"bigint":return 16;case"boolean":return 8;case"undefined":return 16;case"object":{if(e===null)return 8;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)return nH+e.byteLength;if(typeof Blob<"u"&&e instanceof Blob)return nH+e.size;if(e instanceof Date)return 16;if(t??=new WeakSet,t.has(e))return g6;if(t.add(e),e instanceof Array){let r=tH;for(let o of e)r+=g6+Zq(o,t,n+1);return r}if(e instanceof Error){let r=tH+m6(e.name)+m6(e.message)+m6(e.stack??"");for(let o of Object.keys(e))r+=g6+m6(o)+Zq(e[o],t,n+1);return r}let i=tH;for(let r of Object.keys(e))i+=g6+m6(r)+Zq(e[r],t,n+1);return i}default:return 16}}function hkn(e,t,n){typeof e=="string"&&(e=new WebSocket(e));let i=new Pft(e);return new M1e(i,t,n).getRemoteMain()}function k9(){throw new Error("Attempted to use an abstract placeholder from a mapper function. Please make sure your map function has no side effects.")}function _ft(e,t,n,i,r){let o=new kl(Hc.deepCopyFrom(e,t,n)),s=new Dft(i,o);try{return s.apply(r)}finally{s.dispose()}}function mkn(e){let t,n=!1,i=new Wft(()=>performance.now()),r,o;const s=()=>{n||(n=!0,e.dispose())};return new WritableStream({start(a){e.onBroken(c=>{t===void 0&&(t=c,a.error(c),s()),o&&(o(c),r=void 0,o=void 0)})},write(a,c){if(t!==void 0)throw t;const u=Hc.fromAppParams([a]),{promise:l,size:d}=e.stream(["write"],u);if(d===void 0)return l.catch(p=>{throw t===void 0&&(t=p),p});{let{token:p,shouldBlock:h}=i.onSend(d);if(l.then(()=>{i.onAck(p)&&r&&(r(),r=void 0,o=void 0)},m=>{i.onError(p),t===void 0&&(t=m,c.error(m),s()),o&&(o(m),r=void 0,o=void 0)}),h)return new Promise((m,f)=>{r=m,o=f})}},async close(){if(t!==void 0)throw s(),t;const{promise:a}=e.stream(["close"],Hc.fromAppParams([]));try{await a}catch(c){throw t??c}finally{s()}},abort(a){if(t!==void 0)return;t=a??new Error("WritableStream was aborted"),o&&(o(t),r=void 0,o=void 0);const{promise:c}=e.stream(["abort"],Hc.fromAppParams([a]));c.then(()=>s(),()=>s())}})}function fkn(e,t){return{open(n){let i=new Gft(n);n.data={__capnwebTransport:i,__capnwebStub:new M1e(i,e(),t).getRemoteMain()}},message(n,i){n.data.__capnwebTransport.dispatchMessage(i)},close(n,i,r){n.data.__capnwebTransport.dispatchClose(i,r)},error(n,i){n.data.__capnwebTransport.dispatchError(i)}}}var wft,$w,E9,bft,xft,A9,qc,N0,Wu,T1e,T9,lm,Sft,$0,wa,Hc,I1e,kl,T4,f6,eH,C1e,kft,R1e,O1e,P1e,Eft,Aft,Tft,U0,Ift,gkn,Vv,tH,g6,nH,Cft,Uw,Fw,Rft,Oft,M1e,Pft,I4,Mft,y6,Dft,Lft,Nft,$ft,Uft,Fft,D1e,Bft,jft,Wft,zft,qft,Hft,Gft,L1e=A({"../../forks/capnweb/dist/index-bun.js"(){"use strict";wft=Symbol("workers-module"),Symbol.dispose||(Symbol.dispose=Symbol.for("dispose")),Symbol.asyncDispose||(Symbol.asyncDispose=Symbol.for("asyncDispose")),Promise.withResolvers||(Promise.withResolvers=function(){let e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}),$w=globalThis[wft],E9=$w?$w.RpcTarget:class{},bft=async function(){}.constructor,xft=typeof Buffer<"u"?Buffer.prototype:void 0,A9={applyMap:fft,sendMap:fft},qc={createWritableStreamHook:S1e,createWritableStreamFromHook:S1e,createReadableStreamHook:S1e},N0=class{stream(e,t){let n=this.call(e,t),i;try{i=n.pull()}catch(o){throw n.dispose(),o}let r;return i instanceof Promise?r=i.then(o=>{o.dispose()}):(i.dispose(),r=Promise.resolve()),{promise:r}}},Wu=class extends N0{error;constructor(e){super(),this.error=e}call(e,t){return t.dispose(),this}map(e,t,n){for(let i of t)i.dispose();return this}get(e){return this}dup(){return this}pull(){return Promise.reject(this.error)}ignoreUnhandledRejections(){}dispose(){}onBroken(e){try{e(this.error)}catch(t){Promise.resolve(t)}}},T1e=new Wu(new Error("Attempted to use RPC stub after it has been disposed.")),T9=(e,t,n)=>e.call(t,n),lm=Symbol("realStub"),Sft={apply(e,t,n){let i=e.raw;return new wa(T9(i.hook,i.pathIfPromise||[],Hc.fromAppParams(n)),[])},get(e,t,n){let i=e.raw;return t===lm?i:t in wa.prototype?i[t]:typeof t=="string"?new wa(i.hook,i.pathIfPromise?[...i.pathIfPromise,t]:[t]):t===Symbol.dispose&&(!i.pathIfPromise||i.pathIfPromise.length==0)?()=>{i.hook.dispose(),i.hook=T1e}:void 0},has(e,t){let n=e.raw;return t===lm?!0:t in wa.prototype?t in n:typeof t=="string"?!0:t===Symbol.dispose&&(!n.pathIfPromise||n.pathIfPromise.length==0)},construct(e,t){throw new Error("An RPC stub cannot be used as a constructor.")},defineProperty(e,t,n){throw new Error("Can't define properties on RPC stubs.")},deleteProperty(e,t){throw new Error("Can't delete properties on RPC stubs.")},getOwnPropertyDescriptor(e,t){},getPrototypeOf(e){return Object.getPrototypeOf(e.raw)},isExtensible(e){return!1},ownKeys(e){return[]},preventExtensions(e){return!0},set(e,t,n,i){throw new Error("Can't assign properties on RPC stubs.")},setPrototypeOf(e,t){throw new Error("Can't override prototype of RPC stubs.")}},$0=class XBe extends E9{constructor(t,n){if(super(),!(t instanceof N0)){let r=t;if(r instanceof E9||r instanceof Function?t=T4.create(r,void 0):t=new kl(Hc.fromAppReturn(r)),n)throw new TypeError("RpcStub constructor expected one argument, received two.")}this.hook=t,this.pathIfPromise=n;let i=()=>{};return i.raw=this,new Proxy(i,Sft)}hook;pathIfPromise;dup(){let t=this[lm];return t.pathIfPromise?new XBe(t.hook.get(t.pathIfPromise)):new XBe(t.hook.dup())}onRpcBroken(t){this[lm].hook.onBroken(t)}map(t){let{hook:n,pathIfPromise:i}=this[lm];return A9.sendMap(n,i||[],t)}toString(){return"[object RpcStub]"}},wa=class extends $0{constructor(e,t){if(e instanceof N0)super(e,t??[]);else{if(t!==void 0)throw new TypeError("RpcPromise constructor expected one argument, received two.");let n=h6(e);if(n==="rpc-promise"){let i=S9(e);if(i.pathIfPromise.length>0)super(i.hook,i.pathIfPromise);else{let r=i.hook;i.hook=T1e,super(r,[])}}else if(n==="rpc-thenable")super(T4.create(e,void 0),[]);else{let i=new f6(Promise.resolve(e).then(r=>new kl(Hc.fromAppReturn(r))));i.ignoreUnhandledRejections(),super(i,[])}}}then(e,t){return E1e(this).then(...arguments)}catch(e){return E1e(this).catch(...arguments)}finally(e){return E1e(this).finally(...arguments)}toString(){return"[object RpcPromise]"}},Hc=class Ch{value;source;hooks;promises;static fromAppParams(t){return new Ch(t,"params")}static fromAppReturn(t){return new Ch(t,"return")}static fromArray(t){let n=[],i=[],r=[];for(let o of t){o.ensureDeepCopied();for(let s of o.hooks)n.push(s);for(let s of o.promises)s.parent===o&&(s={parent:r,property:r.length,promise:s.promise}),i.push(s);r.push(o.value)}return new Ch(r,"owned",n,i)}static forEvaluate(t,n){return new Ch(null,"owned",t,n)}static deepCopyFrom(t,n,i){let r=new Ch(null,"owned",[],[]);return r.value=r.deepCopy(t,n,"value",r,!0,i),r}constructor(t,n,i,r){this.value=t,this.source=n,this.hooks=i,this.promises=r}rpcTargets;getHookForRpcTarget(t,n,i=!0){if(this.source==="params"){if(i){let r=t;typeof r.dup=="function"&&(t=r.dup())}return T4.create(t,n)}else if(this.source==="return"){let r=this.rpcTargets?.get(t);return r?i?r.dup():(this.rpcTargets?.delete(t),r):(r=T4.create(t,n),i?(this.rpcTargets||(this.rpcTargets=new Map),this.rpcTargets.set(t,r),r.dup()):r)}else throw new Error("owned payload shouldn't contain raw RpcTargets")}getHookForWritableStream(t,n,i=!0){if(this.source==="params")return qc.createWritableStreamHook(t);if(this.source==="return"){let r=this.rpcTargets?.get(t);return r?i?r.dup():(this.rpcTargets?.delete(t),r):(r=qc.createWritableStreamHook(t),i?(this.rpcTargets||(this.rpcTargets=new Map),this.rpcTargets.set(t,r),r.dup()):r)}else throw new Error("owned payload shouldn't contain raw WritableStreams")}getHookForReadableStream(t,n,i=!0){if(this.source==="params")return qc.createReadableStreamHook(t);if(this.source==="return"){let r=this.rpcTargets?.get(t);return r?i?r.dup():(this.rpcTargets?.delete(t),r):(r=qc.createReadableStreamHook(t),i?(this.rpcTargets||(this.rpcTargets=new Map),this.rpcTargets.set(t,r),r.dup()):r)}else throw new Error("owned payload shouldn't contain raw ReadableStreams")}deepCopy(t,n,i,r,o,s){switch(h6(t)){case"unsupported":return t;case"primitive":case"bigint":case"date":case"bytes":case"blob":case"url":case"error":case"undefined":return t;case"array":{let a=t,c=a.length,u=new Array(c);for(let l=0;l<c;l++)u[l]=this.deepCopy(a[l],a,l,u,o,s);return u}case"object":{let a={},c=t;for(let u in c)a[u]=this.deepCopy(c[u],c,u,a,o,s);return a}case"stub":case"rpc-promise":{let a=t,c;if(o?c=ckn(a):c=akn(a),a instanceof wa){let u=new wa(c,[]);return this.promises.push({parent:r,property:i,promise:u}),u}else return this.hooks.push(c),new $0(c)}case"function":case"rpc-target":{let a=t,c;return s?c=s.getHookForRpcTarget(a,n,o):c=T4.create(a,n),this.hooks.push(c),new $0(c)}case"rpc-thenable":{let a=t,c;return s?c=new wa(s.getHookForRpcTarget(a,n,o),[]):c=new wa(T4.create(a,n),[]),this.promises.push({parent:r,property:i,promise:c}),c}case"writable":{let a=t,c;return s?c=s.getHookForWritableStream(a,n,o):c=qc.createWritableStreamHook(a),this.hooks.push(c),a}case"readable":{let a=t,c;return s?c=s.getHookForReadableStream(a,n,o):c=qc.createReadableStreamHook(a),this.hooks.push(c),a}case"headers":return new Headers(t);case"request":{let a=t;return a.body&&this.deepCopy(a.body,a,"body",a,o,s),new Request(a)}case"response":{let a=t;return a.body&&this.deepCopy(a.body,a,"body",a,o,s),new Response(a.body,a)}default:throw new Error("unreachable")}}ensureDeepCopied(){if(this.source!=="owned"){let t=this.source==="params";this.hooks=[],this.promises=[];try{this.value=this.deepCopy(this.value,void 0,"value",this,t,this)}catch(n){throw this.hooks=void 0,this.promises=void 0,n}if(this.source="owned",this.rpcTargets&&this.rpcTargets.size>0)throw new Error("Not all rpcTargets were accounted for in deep-copy?");this.rpcTargets=void 0}}deliverTo(t,n,i){if(this.ensureDeepCopied(),this.value instanceof wa)Ch.deliverRpcPromiseTo(this.value,t,n,i);else{t[n]=this.value;for(let r of this.promises)Ch.deliverRpcPromiseTo(r.promise,r.parent,r.property,i)}}static deliverRpcPromiseTo(t,n,i,r){let o=k1e(t);if(!o)throw new Error("property promises should have been resolved earlier");let s=o.pull();s instanceof Ch?s.deliverTo(n,i,r):r.push(s.then(a=>{let c=[];if(a.deliverTo(n,i,c),c.length>0)return Promise.all(c)}))}async deliverCall(t,n){try{let i=[];this.deliverTo(this,"value",i),i.length>0&&await Promise.all(i);let r=Function.prototype.apply.call(t,n,this.value);return r instanceof wa?Ch.fromAppReturn(r):Ch.fromAppReturn(await r)}finally{this.dispose()}}async deliverStreamWrite(t){try{let n=[];this.deliverTo(this,"value",n),n.length>0&&await Promise.all(n);let i=this.value[0];return(this.hooks.length>0||this.promises.length>0)&&i instanceof Object?(Symbol.dispose in i||Object.defineProperty(i,Symbol.dispose,{value:()=>this.dispose(),writable:!0,enumerable:!1,configurable:!0}),await t.write(i),Ch.fromAppReturn(void 0)):(await t.write(i),this.dispose(),Ch.fromAppReturn(void 0))}catch(n){throw this.dispose(),n}}async deliverResolve(){try{let t=[];this.deliverTo(this,"value",t),t.length>0&&await Promise.all(t);let n=this.value;return n instanceof Object&&(Symbol.dispose in n||Object.defineProperty(n,Symbol.dispose,{value:()=>this.dispose(),writable:!0,enumerable:!1,configurable:!0})),n}catch(t){throw this.dispose(),t}}dispose(){if(this.source==="owned")this.hooks.forEach(t=>t.dispose()),this.promises.forEach(t=>t.promise[Symbol.dispose]());else if(this.source==="return"&&(this.disposeImpl(this.value,void 0),this.rpcTargets&&this.rpcTargets.size>0))throw new Error("Not all rpcTargets were accounted for in disposeImpl()?");this.source="owned",this.hooks=[],this.promises=[]}disposeImpl(t,n){switch(h6(t)){case"unsupported":case"primitive":case"bigint":case"bytes":case"blob":case"date":case"url":case"error":case"undefined":return;case"array":{let i=t,r=i.length;for(let o=0;o<r;o++)this.disposeImpl(i[o],i);return}case"object":{let i=t;for(let r in i)this.disposeImpl(i[r],i);return}case"stub":case"rpc-promise":{let i=k1e(t);i&&i.dispose();return}case"function":case"rpc-target":{let i=t,r=this.rpcTargets?.get(i);r?(r.dispose(),this.rpcTargets.delete(i)):yft(i);return}case"rpc-thenable":return;case"headers":return;case"request":{let i=t;i.body&&this.disposeImpl(i.body,i);return}case"response":{let i=t;i.body&&this.disposeImpl(i.body,i);return}case"writable":{let i=t,r=this.rpcTargets?.get(i);r?this.rpcTargets.delete(i):r=qc.createWritableStreamHook(i),r.dispose();return}case"readable":{let i=t,r=this.rpcTargets?.get(i);r?this.rpcTargets.delete(i):r=qc.createReadableStreamHook(i),r.dispose();return}default:return}}ignoreUnhandledRejections(){this.hooks?(this.hooks.forEach(t=>{t.ignoreUnhandledRejections()}),this.promises.forEach(t=>gft(t.promise).ignoreUnhandledRejections())):this.ignoreUnhandledRejectionsImpl(this.value)}ignoreUnhandledRejectionsImpl(t){switch(h6(t)){case"unsupported":case"primitive":case"bigint":case"bytes":case"blob":case"date":case"error":case"undefined":case"function":case"rpc-target":case"writable":case"readable":case"url":case"headers":case"request":case"response":return;case"array":{let n=t,i=n.length;for(let r=0;r<i;r++)this.ignoreUnhandledRejectionsImpl(n[r]);return}case"object":{let n=t;for(let i in n)this.ignoreUnhandledRejectionsImpl(n[i]);return}case"stub":case"rpc-promise":gft(t).ignoreUnhandledRejections();return;case"rpc-thenable":t.then(n=>{},n=>{});return;default:return}}},I1e=class extends N0{call(e,t){let n;try{let{value:r,owner:o}=this.getValue();n=A1e(r,void 0,e,o)}catch(r){return t.dispose(),new Wu(r)}if(n.hook)return n.hook.call(n.remainingPath,t);if(typeof n.value!="function")return t.dispose(),new Wu(new TypeError(`'${e.join(".")}' is not a function.`));let i=t.deliverCall(n.value,n.parent);return new f6(i.then(r=>new kl(r)))}map(e,t,n){try{let i;try{let{value:r,owner:o}=this.getValue();i=A1e(r,void 0,e,o)}catch(r){for(let o of t)o.dispose();throw r}return i.hook?i.hook.map(i.remainingPath,t,n):A9.applyMap(i.value,i.parent,i.owner,t,n)}catch(i){return new Wu(i)}}get(e){try{let{value:t,owner:n}=this.getValue();if(e.length===0&&n===null){if(t instanceof Object&&"then"in t)return this.dup();throw new Error("Can't dup an RpcTarget stub as a promise.")}let i=A1e(t,void 0,e,n);return i.hook?i.hook.get(i.remainingPath):new kl(Hc.deepCopyFrom(i.value,i.parent,i.owner))}catch(t){return new Wu(t)}}},kl=class R0n extends I1e{constructor(t){super(),this.payload=t}payload;getPayload(){if(this.payload)return this.payload;throw new Error("Attempted to use an RPC StubHook after it was disposed.")}getValue(){let t=this.getPayload();return{value:t.value,owner:t}}dup(){let t=this.getPayload();return new R0n(Hc.deepCopyFrom(t.value,void 0,t))}pull(){return this.getPayload()}ignoreUnhandledRejections(){this.payload&&this.payload.ignoreUnhandledRejections()}dispose(){this.payload&&(this.payload.dispose(),this.payload=void 0)}onBroken(t){this.payload&&this.payload.value instanceof $0&&this.payload.value.onRpcBroken(t)}},T4=class YBe extends I1e{static create(t,n){return typeof t!="function"&&(n=void 0),new YBe(t,n)}constructor(t,n,i){super(),this.target=t,this.parent=n,i?i.refcount&&(this.refcount=i.refcount,++this.refcount.count):Symbol.dispose in t&&(this.refcount={count:1})}target;parent;refcount;getTarget(){if(this.target)return this.target;throw new Error("Attempted to use an RPC StubHook after it was disposed.")}getValue(){return{value:this.getTarget(),owner:null}}dup(){return new YBe(this.getTarget(),this.parent,this)}pull(){let t=this.getTarget();return"then"in t?Promise.resolve(t).then(n=>Hc.fromAppReturn(n)):Promise.reject(new Error("Tried to resolve a non-promise stub."))}ignoreUnhandledRejections(){}dispose(){this.target&&(this.refcount&&--this.refcount.count==0&&yft(this.target),this.target=void 0)}onBroken(t){let n=this.target;n&&"then"in n&&Promise.resolve(n).then(()=>{},t)}},f6=class mU extends N0{promise;resolution;constructor(t){super(),this.promise=t.then(n=>(this.resolution=n,n))}call(t,n){return n.ensureDeepCopied(),new mU(this.promise.then(i=>i.call(t,n),i=>{throw n.dispose(),i}))}stream(t,n){return n.ensureDeepCopied(),{promise:this.promise.then(i=>i.stream(t,n).promise,i=>{throw n.dispose(),i})}}map(t,n,i){return new mU(this.promise.then(r=>r.map(t,n,i),r=>{for(let o of n)o.dispose();throw r}))}get(t){return new mU(this.promise.then(n=>n.get(t)))}dup(){return this.resolution?this.resolution.dup():new mU(this.promise.then(t=>t.dup()))}pull(){return this.resolution?this.resolution.pull():this.promise.then(t=>t.pull())}ignoreUnhandledRejections(){this.resolution?this.resolution.ignoreUnhandledRejections():this.promise.then(t=>{t.ignoreUnhandledRejections()},t=>{})}dispose(){this.promise.then(t=>t.dispose(),()=>{})}onBroken(t){this.resolution?this.resolution.onBroken(t):this.promise.then(n=>{n.onBroken(t)},t)}},eH={maxBigIntDigits:16384,maxDepth:256,maxMessageSize:33554432},C1e=new Uint8Array(new Uint16Array([1]).buffer)[0]===1,kft=["ArrayBuffer","DataView","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","BigInt64Array","BigUint64Array","Float32Array","Float64Array"],R1e={ArrayBuffer:void 0,DataView:void 0,Int8Array:void 0,Uint8Array:void 0,Uint8ClampedArray:void 0,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,BigInt64Array:8,BigUint64Array:8,Float32Array:4,Float64Array:8},O1e={ArrayBuffer:ArrayBuffer.prototype,DataView:DataView.prototype,Int8Array:Int8Array.prototype,Uint8ClampedArray:Uint8ClampedArray.prototype,Int16Array:Int16Array.prototype,Uint16Array:Uint16Array.prototype,Int32Array:Int32Array.prototype,Uint32Array:Uint32Array.prototype,BigInt64Array:BigInt64Array.prototype,BigUint64Array:BigUint64Array.prototype,Float32Array:Float32Array.prototype,Float64Array:Float64Array.prototype},P1e=new Map;for(let e of Object.keys(O1e))P1e.set(O1e[e],e);Eft=class{exportStub(e){throw new Error("Cannot serialize RPC stubs without an RPC session.")}exportPromise(e){throw new Error("Cannot serialize RPC stubs without an RPC session.")}getImport(e){}unexport(e){}createPipe(e){throw new Error("Cannot create pipes without an RPC session.")}onSendError(e){}},Aft=new Eft,Tft={__proto__:null,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError},U0=class O0n{exporter;source;encodingLevel;constructor(t,n,i){this.exporter=t,this.source=n,this.encodingLevel=i}static devaluate(t,n,i=Aft,r,o="string"){let s=new O0n(i,r,o);try{return s.devaluateImpl(t,n,0)}catch(a){if(s.exports)try{i.unexport(s.exports)}catch{}throw a}}exports;devaluateImpl(t,n,i){if(i>=256)throw new Error("Serialization exceeded maximum allowed depth. (Does the message contain cycles?)");switch(h6(t)){case"unsupported":{let r;try{r=`Cannot serialize value: ${t}`}catch{r="Cannot serialize value: (couldn't stringify value)"}throw new TypeError(r)}case"primitive":return typeof t=="number"&&!isFinite(t)?this.encodingLevel==="structuredClonable"?t:t===1/0?["inf"]:t===-1/0?["-inf"]:["nan"]:t;case"object":{let r=t,o={};for(let s in r)o[s]=this.devaluateImpl(r[s],r,i+1);return o}case"array":{let r=t,o=r.length,s=new Array(o);for(let a=0;a<o;a++)s[a]=this.devaluateImpl(r[a],r,i+1);return[s]}case"bigint":return this.encodingLevel==="structuredClonable"?t:["bigint",t.toString()];case"date":{if(this.encodingLevel==="structuredClonable")return t;const r=t.getTime();return["date",Number.isNaN(r)?null:r]}case"bytes":{let r=P1e.get(Object.getPrototypeOf(t)),o;if(r==="ArrayBuffer")o=new Uint8Array(t);else if(r===void 0)o=t;else{let a=t;o=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);let c=R1e[r];!C1e&&c&&(o=o.slice(),vft(o,c))}if(this.encodingLevel==="structuredClonable"||this.encodingLevel==="jsonCompatibleWithBytes")return r===void 0?["bytes",o]:["bytes",o,r];let s;if(o.toBase64)s=o.toBase64({omitPadding:!0});else if(typeof Buffer<"u")s=(o instanceof Buffer?o:Buffer.from(o.buffer,o.byteOffset,o.byteLength)).toString("base64");else{let a="";for(let c=0;c<o.length;c++)a+=String.fromCharCode(o[c]);s=btoa(a)}return s=s.replace(/=+$/,""),r===void 0?["bytes",s]:["bytes",s,r]}case"url":return["url",t.href];case"headers":return["headers",[...t]];case"request":{let r=t,o={};r.method!=="GET"&&(o.method=r.method);let s=[...r.headers];if(s.length>0&&(o.headers=s),r.body)o.body=this.devaluateImpl(r.body,r,i+1),o.duplex=r.duplex||"half";else if(r.body===void 0&&!["GET","HEAD","OPTIONS","TRACE","DELETE"].includes(r.method)){let c=r.arrayBuffer(),u=new ReadableStream({async start(d){try{d.enqueue(new Uint8Array(await c)),d.close()}catch(p){d.error(p)}}}),l=qc.createReadableStreamHook(u);o.body=["readable",this.exporter.createPipe(u,l)],o.duplex=r.duplex||"half"}r.cache&&r.cache!=="default"&&(o.cache=r.cache),r.redirect!=="follow"&&(o.redirect=r.redirect),r.integrity&&(o.integrity=r.integrity),r.mode&&r.mode!=="cors"&&(o.mode=r.mode),r.credentials&&r.credentials!=="same-origin"&&(o.credentials=r.credentials),r.referrer&&r.referrer!=="about:client"&&(o.referrer=r.referrer),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.keepalive&&(o.keepalive=r.keepalive);let a=r;return a.cf&&(o.cf=a.cf),a.encodeResponseBody&&a.encodeResponseBody!=="automatic"&&(o.encodeResponseBody=a.encodeResponseBody),["request",r.url,o]}case"response":{let r=t,o=this.devaluateImpl(r.body,r,i+1),s={};r.status!==200&&(s.status=r.status),r.statusText&&(s.statusText=r.statusText);let a=[...r.headers];a.length>0&&(s.headers=a);let c=r;if(c.cf&&(s.cf=c.cf),c.encodeBody&&c.encodeBody!=="automatic"&&(s.encodeBody=c.encodeBody),c.webSocket)throw new TypeError("Can't serialize a Response containing a webSocket.");return["response",o,s]}case"blob":{let r=t,o=r.stream(),s=qc.createReadableStreamHook(o),a=this.exporter.createPipe(o,s);return["blob",r.type,["readable",a]]}case"error":{let r=t,o=this.exporter.onSendError(r);o&&(r=o);let s=r,a,c=(l,d)=>{let p=this.exports?.length??0;try{let h=this.devaluateImpl(d,r,i+1);a||(a={}),a[l]=h}catch{if(this.exports&&this.exports.length>p){let m=this.exports.splice(p);try{this.exporter.unexport(m)}catch{}}}};for(let l of Object.keys(r))l==="name"||l==="message"||l==="stack"||c(l,s[l]);"cause"in r&&c("cause",s.cause),r instanceof AggregateError&&c("errors",r.errors);let u=["error",r.name,r.message];return a?(u.push(o&&o.stack?o.stack:null),u.push(a)):o&&o.stack&&u.push(o.stack),u}case"undefined":return this.encodingLevel==="structuredClonable"?void 0:["undefined"];case"stub":case"rpc-promise":{if(!this.source)throw new Error("Can't serialize RPC stubs in this context.");let{hook:r,pathIfPromise:o}=S9(t),s=this.exporter.getImport(r);return s!==void 0?o?o.length>0?["pipeline",s,o]:["pipeline",s]:["import",s]:(o?r=r.get(o):r=r.dup(),this.devaluateHook(o?"promise":"export",r))}case"function":case"rpc-target":{if(!this.source)throw new Error("Can't serialize RPC stubs in this context.");let r=this.source.getHookForRpcTarget(t,n);return this.devaluateHook("export",r)}case"rpc-thenable":{if(!this.source)throw new Error("Can't serialize RPC stubs in this context.");let r=this.source.getHookForRpcTarget(t,n);return this.devaluateHook("promise",r)}case"writable":{if(!this.source)throw new Error("Can't serialize WritableStream in this context.");let r=this.source.getHookForWritableStream(t,n);return this.devaluateHook("writable",r)}case"readable":{if(!this.source)throw new Error("Can't serialize ReadableStream in this context.");let r=t,o=this.source.getHookForReadableStream(r,n);return["readable",this.exporter.createPipe(r,o)]}default:throw new Error("unreachable")}}devaluateHook(t,n){this.exports||(this.exports=[]);let i=t==="promise"?this.exporter.exportPromise(n):this.exporter.exportStub(n);return this.exports.push(i),[t,i]}},Ift=class{importStub(e){throw new Error("Cannot deserialize RPC stubs without an RPC session.")}importPromise(e){throw new Error("Cannot deserialize RPC stubs without an RPC session.")}getExport(e){}getPipeReadable(e){throw new Error("Cannot retrieve pipe readable without an RPC session.")}getLimits(){return eH}},gkn=new Ift,Vv=class P0n{importer;encodingLevel;limits;constructor(t,n="string"){this.importer=t,this.encodingLevel=n,this.limits=t.getLimits()}hooks=[];promises=[];evaluate(t){return this.evaluateWithDepth(t,0)}evaluateWithDepth(t,n){let i=Hc.forEvaluate(this.hooks,this.promises);try{return i.value=this.evaluateImpl(t,i,"value",n),i}catch(r){throw i.dispose(),r}}evaluateCopy(t){return this.evaluate(structuredClone(t))}evaluateImpl(t,n,i,r){let o=this.limits.maxDepth;if(r>=o)throw new TypeError(`Deserialization exceeded maximum allowed message depth of ${o}.`);if(this.encodingLevel==="structuredClonable"&&(t instanceof Date||typeof t=="bigint"))return t;if(t instanceof Array){if(t.length==1&&t[0]instanceof Array){let s=t[0];for(let a=0;a<s.length;a++)s[a]=this.evaluateImpl(s[a],s,a,r+1);return s}else switch(t[0]){case"bigint":if(typeof t[1]=="string"){let s=t[1],a=this.limits.maxBigIntDigits;if(s.length>a)throw new TypeError(`Deserialized bigint exceeds maximum length of ${a} digits.`);return BigInt(s)}break;case"date":if(t[1]===null)return new Date(NaN);if(typeof t[1]=="number")return new Date(t[1]);break;case"bytes":{let s;if(t[1]instanceof Uint8Array)s=t[1];else if(typeof t[1]=="string")if(typeof Buffer<"u")s=Buffer.from(t[1],"base64");else if(Uint8Array.fromBase64)s=Uint8Array.fromBase64(t[1]);else{let l=atob(t[1]),d=l.length;s=new Uint8Array(d);for(let p=0;p<d;p++)s[p]=l.charCodeAt(p)}else break;if(t.length===2)return s;if(typeof t[2]!="string")throw new TypeError(`Unknown bytes type marker type: ${typeof t[2]}`);if(!ukn(t[2])){let l=t[2].slice(0,64);throw new TypeError(`Unknown bytes type marker: ${l}`)}let a=t[2],c=R1e[a];if(c!==void 0&&s.byteLength%c!==0)throw new TypeError(`Invalid byte length ${s.byteLength} for ${a}; expected a multiple of ${c}`);let u=s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength);switch(!C1e&&c!==void 0&&vft(new Uint8Array(u),c),a){case"ArrayBuffer":return u;case"DataView":return new DataView(u);case"Int8Array":return new Int8Array(u);case"Uint8Array":return new Uint8Array(u);case"Uint8ClampedArray":return new Uint8ClampedArray(u);case"Int16Array":return new Int16Array(u);case"Uint16Array":return new Uint16Array(u);case"Int32Array":return new Int32Array(u);case"Uint32Array":return new Uint32Array(u);case"BigInt64Array":return new BigInt64Array(u);case"BigUint64Array":return new BigUint64Array(u);case"Float32Array":return new Float32Array(u);case"Float64Array":return new Float64Array(u)}}case"error":if(t.length>=3&&typeof t[1]=="string"&&typeof t[2]=="string"){let s=Tft[t[1]]||Error,a=s===AggregateError?new s([],t[2]):new s(t[2]);if(typeof t[3]=="string"&&(a.stack=t[3]),t.length>=5){let c=t[4];if(!c||typeof c!="object"||Array.isArray(c))break;let u=a,l=c;for(let d of Object.keys(l))if(!(d==="name"||d==="message"||d==="stack")){if(d in Object.prototype||d==="toJSON"){this.evaluateImpl(l[d],a,d,r+1);continue}u[d]=this.evaluateImpl(l[d],a,d,r+1)}}return a}break;case"undefined":if(t.length===1)return;break;case"inf":return 1/0;case"-inf":return-1/0;case"nan":return NaN;case"url":if(t.length===2&&typeof t[1]=="string")return new URL(t[1]);break;case"headers":if(t.length===2&&t[1]instanceof Array)return new Headers(t[1]);break;case"request":{if(t.length!==3||typeof t[1]!="string")break;let s=t[1],a=t[2];if(typeof a!="object"||a===null)break;if(a.body&&(a.body=this.evaluateImpl(a.body,a,"body",r+1),!(a.body===null||typeof a.body=="string"||a.body instanceof Uint8Array||a.body instanceof ReadableStream)))throw new TypeError("Request body must be of type ReadableStream.");if(a.signal&&(a.signal=this.evaluateImpl(a.signal,a,"signal",r+1),!(a.signal instanceof AbortSignal)))throw new TypeError("Request siganl must be of type AbortSignal.");if(a.headers&&!(a.headers instanceof Array))throw new TypeError("Request headers must be serialized as an array of pairs.");let c=new Request(s,a);if(a.body instanceof ReadableStream&&c.body===void 0){let u=dkn(c,a.body);return this.promises.push({promise:u,parent:n,property:i}),u}else return c}case"response":{if(t.length!==3)break;let s=this.evaluateImpl(t[1],n,i,r+1);if(!(s===null||typeof s=="string"||s instanceof Uint8Array||s instanceof ReadableStream))throw new TypeError("Response body must be of type ReadableStream.");let a=t[2];if(typeof a!="object"||a===null)break;if(a.webSocket)throw new TypeError("Can't deserialize a Response containing a webSocket.");if(a.headers&&!(a.headers instanceof Array))throw new TypeError("Request headers must be serialized as an array of pairs.");return new Response(s,a)}case"blob":{if(t.length!==3||typeof t[1]!="string")break;let s=t[1],a=this.evaluateImpl(t[2],n,i,r+1);if(!(a instanceof ReadableStream))throw new TypeError("Blob content must be serialized as a ReadableStream.");let c=pkn(a,s);return this.promises.push({promise:c,parent:n,property:i}),c}case"import":case"pipeline":{if(t.length<2||t.length>4||typeof t[1]!="number")break;let s=this.importer.getExport(t[1]);if(!s)throw new Error(`no such entry on exports table: ${t[1]}`);let a=t[0]=="pipeline",c=d=>{if(a){let p=new wa(d,[]);return this.promises.push({promise:p,parent:n,property:i}),p}else return this.hooks.push(d),new wa(d,[])};if(t.length==2)return c(a?s.get([]):s.dup());let u=t[2];if(!(u instanceof Array)||!u.every(d=>typeof d=="string"||typeof d=="number"))break;if(t.length==3)return c(s.get(u));let l=t[3];if(!(l instanceof Array))break;return l=new P0n(this.importer).evaluateWithDepth([l],r),c(s.call(u,l))}case"remap":{if(t.length!==5||typeof t[1]!="number"||!(t[2]instanceof Array)||!(t[3]instanceof Array)||!(t[4]instanceof Array))break;let s=this.importer.getExport(t[1]);if(!s)throw new Error(`no such entry on exports table: ${t[1]}`);let a=t[2];if(!a.every(p=>typeof p=="string"||typeof p=="number"))break;let c=t[3].map(p=>{if(!(p instanceof Array)||p.length!==2||p[0]!=="import"&&p[0]!=="export"||typeof p[1]!="number")throw new TypeError(`unknown map capture: ${JSON.stringify(p)}`);if(p[0]==="export")return this.importer.importStub(p[1]);{let h=this.importer.getExport(p[1]);if(!h)throw new Error(`no such entry on exports table: ${p[1]}`);return h.dup()}}),u=t[4],l=s.map(a,c,u),d=new wa(l,[]);return this.promises.push({promise:d,parent:n,property:i}),d}case"export":case"promise":if(typeof t[1]=="number")if(t[0]=="promise"){let s=this.importer.importPromise(t[1]),a=new wa(s,[]);return this.promises.push({parent:n,property:i,promise:a}),a}else{let s=this.importer.importStub(t[1]);return this.hooks.push(s),new $0(s)}break;case"writable":if(typeof t[1]=="number"){let s=this.importer.importStub(t[1]),a=qc.createWritableStreamFromHook(s);return this.hooks.push(s),a}break;case"readable":if(typeof t[1]=="number"){let s=this.importer.getPipeReadable(t[1]),a=qc.createReadableStreamHook(s);return this.hooks.push(a),s}}throw new TypeError(`unknown special value: ${JSON.stringify(t)}`)}else if(t instanceof Object){let s=t;for(let a in s)a in Object.prototype||a==="toJSON"?(this.evaluateImpl(s[a],s,a,r+1),delete s[a]):s[a]=this.evaluateImpl(s[a],s,a,r+1);return s}else return t}},tH=16,g6=8,nH=16,Cft=64,Uw=class{session;importId;constructor(e,t,n){this.session=e,this.importId=t,n&&(this.activePull=Promise.withResolvers())}localRefcount=0;remoteRefcount=1;activePull;resolution;onBrokenRegistrations;resolve(e){if(this.localRefcount==0){e.dispose();return}if(this.resolution=e,this.sendRelease(),this.onBrokenRegistrations){for(let t of this.onBrokenRegistrations){let n=this.session.onBrokenCallbacks[t],i=this.session.onBrokenCallbacks.length;e.onBroken(n),this.session.onBrokenCallbacks[i]===n?delete this.session.onBrokenCallbacks[i]:delete this.session.onBrokenCallbacks[t]}this.onBrokenRegistrations=void 0}this.activePull&&(this.activePull.resolve(),this.activePull=void 0)}async awaitResolution(){return this.activePull||(this.session.sendPull(this.importId),this.activePull=Promise.withResolvers()),await this.activePull.promise,this.resolution.pull()}dispose(){this.resolution?this.resolution.dispose():(this.abort(new Error("RPC was canceled because the RpcPromise was disposed.")),this.sendRelease())}abort(e){if(!this.resolution){if(this.resolution=new Wu(e),this.activePull&&(this.activePull.reject(e),this.activePull=void 0),this.onBrokenRegistrations)for(let t of this.onBrokenRegistrations)delete this.session.onBrokenCallbacks[t];this.onBrokenRegistrations=void 0}}onBroken(e){if(this.resolution)this.resolution.onBroken(e);else{let t=this.session.onBrokenCallbacks.length;this.session.onBrokenCallbacks.push(e),this.onBrokenRegistrations||(this.onBrokenRegistrations=[]),this.onBrokenRegistrations.push(t)}}sendRelease(){this.remoteRefcount>0&&(this.session.sendRelease(this.importId,this.remoteRefcount),this.remoteRefcount=0)}},Fw=class M0n extends N0{isPromise;entry;constructor(t,n){super(),this.isPromise=t,++n.localRefcount,this.entry=n}collectPath(t){return this}getEntry(){if(this.entry)return this.entry;throw new Error("This RpcImportHook was already disposed.")}getEntryTakingOwnership(t){try{return this.getEntry()}catch(n){throw t(),n}}call(t,n){let i=this.getEntryTakingOwnership(()=>n.dispose());return i.resolution?i.resolution.call(t,n):i.session.sendCall(i.importId,t,n)}stream(t,n){let i=this.getEntryTakingOwnership(()=>n.dispose());return i.resolution?i.resolution.stream(t,n):i.session.sendStream(i.importId,t,n)}map(t,n,i){let r=this.getEntryTakingOwnership(()=>{for(let o of n)o.dispose()});return r.resolution?r.resolution.map(t,n,i):r.session.sendMap(r.importId,t,n,i)}get(t){let n=this.getEntry();return n.resolution?n.resolution.get(t):n.session.sendCall(n.importId,t)}dup(){return new M0n(!1,this.getEntry())}pull(){let t=this.getEntry();if(!this.isPromise)throw new Error("Can't pull this hook because it's not a promise hook.");return t.resolution?t.resolution.pull():t.awaitResolution()}ignoreUnhandledRejections(){}dispose(){let t=this.entry;this.entry=void 0,t&&--t.localRefcount===0&&t.dispose()}onBroken(t){this.entry&&this.entry.onBroken(t)}},Rft=class extends Fw{session;constructor(e){super(!1,e),this.session=e.session}dispose(){if(this.session){let e=this.session;this.session=void 0,e.shutdown()}}},Oft=class{transport;options;exports=[];reverseExports=new Map;imports=[];abortReason;cancelReadLoop;nextExportId=-1;onBatchDone;pullCount=0;onBrokenCallbacks=[];encodingLevel;limits;constructor(e,t,n){this.transport=e,this.options=n;let i="string";if("encodingLevel"in e){let r=e.encodingLevel;if(r!==void 0){if(r!=="string"&&r!=="jsonCompatible"&&r!=="jsonCompatibleWithBytes"&&r!=="structuredClonable")throw new TypeError(`Unknown transport encodingLevel: ${String(r)}`);i=r}}this.encodingLevel=i,this.limits={...eH,...n.limits},this.exports.push({hook:t,refcount:1}),this.imports.push(new Uw(this,0,!1)),this.readLoop().catch(r=>this.abort(r))}getMainImport(){return new Rft(this.imports[0])}shutdown(){this.abort(new Error("RPC session was shut down by disposing the main stub"),!1)}exportStub(e){if(this.abortReason)throw this.abortReason;let t=this.reverseExports.get(e);if(t!==void 0)return++this.exports[t].refcount,t;{let n=this.nextExportId--;return this.exports[n]={hook:e,refcount:1},this.reverseExports.set(e,n),this.watchExport(n,e),n}}exportPromise(e){if(this.abortReason)throw this.abortReason;let t=this.nextExportId--;return this.exports[t]={hook:e,refcount:1},this.reverseExports.set(e,t),this.ensureResolvingExport(t),t}unexport(e){for(let t of e)this.releaseExport(t,1)}watchExport(e,t){t.onBroken(n=>{queueMicrotask(()=>{if(!(this.abortReason!==void 0||this.exports[e]?.hook!==t))try{this.send(["reject",e,U0.devaluate(n,void 0,this,void 0,this.encodingLevel)])}catch(i){this.abort(i)}})})}releaseExport(e,t){let n=this.exports[e];if(!n)throw new Error(`no such export ID: ${e}`);if(n.refcount<t)throw new Error(`refcount would go negative: ${n.refcount} < ${t}`);n.refcount-=t,n.refcount===0&&(delete this.exports[e],this.reverseExports.delete(n.hook),n.hook.dispose())}onSendError(e){if(this.options.onSendError)return this.options.onSendError(e)}ensureResolvingExport(e){let t=this.exports[e];if(!t)throw new Error(`no such export ID: ${e}`);if(!t.pull){let n=async()=>{let r=t.hook;for(;;){let o=await r.pull();if(o.value instanceof $0){let{hook:s,pathIfPromise:a}=S9(o.value);if(a&&a.length==0&&this.getImport(r)===void 0){r=s;continue}}return o}},i=t.autoRelease;++this.pullCount,t.pull=n().then(r=>{let o=U0.devaluate(r.value,void 0,this,r,this.encodingLevel);this.send(["resolve",e,o]),i&&this.releaseExport(e,1)},r=>{this.send(["reject",e,U0.devaluate(r,void 0,this,void 0,this.encodingLevel)]),i&&this.releaseExport(e,1)}).catch(r=>{try{this.send(["reject",e,U0.devaluate(r,void 0,this,void 0,this.encodingLevel)]),i&&this.releaseExport(e,1)}catch(o){this.abort(o)}}).finally(()=>{--this.pullCount===0&&this.onBatchDone&&this.onBatchDone.resolve()})}}getImport(e){if(e instanceof Fw&&e.entry&&e.entry.session===this)return e.entry.importId}importStub(e){if(this.abortReason)throw this.abortReason;let t=this.imports[e];return t||(t=new Uw(this,e,!1),this.imports[e]=t),new Fw(!1,t)}importPromise(e){if(this.abortReason)throw this.abortReason;if(this.imports[e])return new Wu(new Error("Bug in RPC system: The peer sent a promise reusing an existing export ID."));let t=new Uw(this,e,!0);return this.imports[e]=t,new Fw(!0,t)}getExport(e){return this.exports[e]?.hook}getPipeReadable(e){let t=this.exports[e];if(!t||!t.pipeReadable)throw new Error(`Export ${e} is not a pipe or its readable end was already consumed.`);let n=t.pipeReadable;return t.pipeReadable=void 0,n}getLimits(){return this.limits}createPipe(e,t){if(this.abortReason)throw this.abortReason;this.send(["pipe"]);let n=this.imports.length,i=new Uw(this,n,!1);this.imports.push(i);let r=new Fw(!1,i),o=qc.createWritableStreamFromHook(r);return e.pipeTo(o).catch(()=>{}).finally(()=>t.dispose()),n}send(e){if(this.abortReason!==void 0)return 0;if(this.encodingLevel==="string"){let t;try{t=JSON.stringify(e)}catch(n){try{this.abort(n)}catch{}throw n}try{let n=this.transport.send(t);n!==void 0&&typeof n.catch=="function"&&n.catch(i=>this.abort(i,!1))}catch(n){queueMicrotask(()=>this.abort(n,!1))}return t.length}else try{let t=this.transport.send(e);if(typeof t=="number")return t;let n=t;n&&typeof n.then=="function"&&Promise.resolve(n).catch(i=>this.abort(i,!1));return}catch(t){queueMicrotask(()=>this.abort(t,!1));return}}sendCall(e,t,n){if(this.abortReason)throw n?.dispose(),this.abortReason;let i=["pipeline",e,t];if(n){let o;try{o=U0.devaluate(n.value,void 0,this,n,this.encodingLevel)}catch(s){throw n.dispose(),s}i.push(o[0])}this.send(["push",i]);let r=new Uw(this,this.imports.length,!1);return this.imports.push(r),new Fw(!0,r)}sendStream(e,t,n){if(this.abortReason)throw n.dispose(),this.abortReason;let i=["pipeline",e,t],r;try{r=U0.devaluate(n.value,void 0,this,n,this.encodingLevel)}catch(u){throw n.dispose(),u}i.push(r[0]);let o=["stream",i],s=this.send(o);s===void 0&&(s=Zq(o));let a=this.imports.length,c=new Uw(this,a,!0);return c.remoteRefcount=0,c.localRefcount=1,this.imports.push(c),{promise:c.awaitResolution().then(u=>{u.dispose(),delete this.imports[a]},u=>{throw delete this.imports[a],u}),size:s}}sendMap(e,t,n,i){if(this.abortReason){for(let s of n)s.dispose();throw this.abortReason}let r=["remap",e,t,n.map(s=>{let a=this.getImport(s);return a!==void 0?["import",a]:["export",this.exportStub(s)]}),i];this.send(["push",r]);let o=new Uw(this,this.imports.length,!1);return this.imports.push(o),new Fw(!0,o)}sendPull(e){if(this.abortReason)throw this.abortReason;this.send(["pull",e])}sendRelease(e,t){this.abortReason||(this.send(["release",e,t]),delete this.imports[e])}abort(e,t=!0){if(this.abortReason===void 0){if(this.cancelReadLoop?.(e),this.cancelReadLoop=void 0,t)try{let n=["abort",U0.devaluate(e,void 0,this,void 0,this.encodingLevel)];if(this.encodingLevel==="string"){let i=this.transport.send(JSON.stringify(n));i!==void 0&&typeof i.catch=="function"&&i.catch(r=>{})}else{let i=this.transport.send(n);i&&typeof i.then=="function"&&Promise.resolve(i).catch(r=>{})}}catch{}if(e===void 0&&(e="undefined"),this.abortReason=e,this.onBatchDone&&this.onBatchDone.reject(e),this.transport.abort)try{this.transport.abort(e)}catch(n){Promise.resolve(n)}for(let n of Object.values(this.onBrokenCallbacks))try{n(e)}catch(i){Promise.resolve(i)}for(let n in this.imports)this.imports[n].abort(e);for(let n in this.exports)this.exports[n].hook.dispose()}}async readLoop(){for(;!this.abortReason;){let e=Promise.withResolvers();this.cancelReadLoop=e.reject;let t;try{t=await Promise.race([this.transport.receive(),e.promise])}finally{this.cancelReadLoop===e.reject&&(this.cancelReadLoop=void 0)}if(this.encodingLevel==="string"&&t.length>this.limits.maxMessageSize)throw new TypeError(`Incoming message exceeds maximum size of ${this.limits.maxMessageSize} UTF-16 code units.`);if(this.abortReason)break;let n=this.encodingLevel==="string"?JSON.parse(t):t;if(n instanceof Array)switch(n[0]){case"push":if(n.length>1){let i=new Vv(this,this.encodingLevel).evaluate(n[1]),r=new kl(i);r.ignoreUnhandledRejections(),this.exports.push({hook:r,refcount:1});continue}break;case"stream":if(n.length>1){let i=new Vv(this,this.encodingLevel).evaluate(n[1]),r=new kl(i);r.ignoreUnhandledRejections();let o=this.exports.length;this.exports.push({hook:r,refcount:1,autoRelease:!0}),this.ensureResolvingExport(o);continue}break;case"pipe":{let{readable:i,writable:r}=new TransformStream,o=qc.createWritableStreamHook(r),s=this.exports.length;this.exports.push({hook:o,refcount:1,pipeReadable:i}),this.watchExport(s,o);continue}case"pull":{let i=n[1];if(typeof i=="number"){this.ensureResolvingExport(i);continue}break}case"resolve":case"reject":{let i=n[1];if(typeof i=="number"&&n.length>2){let r=this.imports[i];if(r)if(n[0]=="resolve")r.resolve(new kl(new Vv(this,this.encodingLevel).evaluate(n[2])));else{let o=new Vv(this,this.encodingLevel).evaluate(n[2]);o.dispose(),r.resolve(new Wu(o.value))}else n[0]=="resolve"&&new Vv(this,this.encodingLevel).evaluate(n[2]).dispose();continue}break}case"release":{let i=n[1],r=n[2];if(typeof i=="number"&&typeof r=="number"){this.releaseExport(i,r);continue}break}case"abort":{let i=new Vv(this,this.encodingLevel).evaluate(n[1]);i.dispose(),this.abort(i.value,!1);break}}throw new Error(`bad RPC message: ${JSON.stringify(n)}`)}}async drain(){if(this.abortReason)throw this.abortReason;if(this.pullCount>0){let{promise:e,resolve:t,reject:n}=Promise.withResolvers();this.onBatchDone={resolve:t,reject:n},await e}}getStats(){let e={imports:0,exports:0};for(let t in this.imports)++e.imports;for(let t in this.exports)++e.exports;return e}},M1e=class{#e;#t;constructor(e,t,n={}){let i;t?i=new kl(Hc.fromAppReturn(t)):i=new Wu(new Error("This connection has no main object.")),this.#e=new Oft(e,i,n),this.#t=new $0(this.#e.getMainImport())}getRemoteMain(){return this.#t}getStats(){return this.#e.getStats()}drain(){return this.#e.drain()}},Pft=class{constructor(e){this.#e=e,e.binaryType="arraybuffer",e.readyState===WebSocket.CONNECTING&&(this.#t=[],e.addEventListener("open",t=>{try{for(let n of this.#t)e.send(n)}catch(n){this.#a(n)}this.#t=void 0})),e.addEventListener("message",t=>{this.#o||(typeof t.data=="string"||t.data instanceof ArrayBuffer?this.#n?(this.#n(t.data),this.#n=void 0,this.#i=void 0):this.#r.push(t.data):this.#a(new TypeError("Received unexpected message type from WebSocket.")))}),e.addEventListener("close",t=>{this.#a(new Error(`Peer closed WebSocket: ${t.code} ${t.reason}`))}),e.addEventListener("error",t=>{this.#a(new Error("WebSocket connection failed."))})}#e;#t;#n;#i;#r=[];#o;send(e){this.#t===void 0?this.#e.send(e):this.#t.push(e)}receive(){return this.#r.length>0?Promise.resolve(this.#r.shift()):this.#o?Promise.reject(this.#o):new Promise((e,t)=>{this.#n=e,this.#i=t})}abort(e){let t;e instanceof Error?t=e.message:t=`${e}`;let n=new TextEncoder().encode(t);n.length>123&&(t=new TextDecoder().decode(n.subarray(0,123),{stream:!0})),this.#e.close(3e3,t),this.#a(e)}#a(e){this.#o||(this.#o=e,this.#i&&(this.#i(e),this.#n=void 0,this.#i=void 0))}},Mft=class{context;captureMap=new Map;instructions=[];constructor(e,t){I4?this.context={parent:I4,captures:[],subject:I4.capture(e),path:t}:this.context={parent:void 0,captures:[],subject:e,path:t},I4=this}unregister(){I4=this.context.parent}makeInput(){return new y6(this,0)}makeOutput(e){let t;try{t=U0.devaluate(e.value,void 0,this,e)}finally{e.dispose()}return this.instructions.push(t),this.context.parent?(this.context.parent.instructions.push(["remap",this.context.subject,this.context.path,this.context.captures.map(n=>["import",n]),this.instructions]),new y6(this.context.parent,this.context.parent.instructions.length)):this.context.subject.map(this.context.path,this.context.captures,this.instructions)}pushCall(e,t,n){let i=U0.devaluate(n.value,void 0,this,n);i=i[0];let r=this.capture(e.dup());return this.instructions.push(["pipeline",r,t,i]),new y6(this,this.instructions.length)}pushGet(e,t){let n=this.capture(e.dup());return this.instructions.push(["pipeline",n,t]),new y6(this,this.instructions.length)}capture(e){if(e instanceof y6&&e.mapper===this)return e.idx;let t=this.captureMap.get(e);if(t===void 0){if(this.context.parent){let n=this.context.parent.capture(e);this.context.captures.push(n)}else this.context.captures.push(e);t=-this.context.captures.length,this.captureMap.set(e,t)}return t}exportStub(e){throw new Error("Can't construct an RpcTarget or RPC callback inside a mapper function. Try creating a new RpcStub outside the callback first, then using it inside the callback.")}exportPromise(e){return this.exportStub(e)}getImport(e){return this.capture(e)}unexport(e){}createPipe(e){throw new Error("Cannot send ReadableStream inside a mapper function.")}onSendError(e){}},A9.sendMap=(e,t,n)=>{let i=new Mft(e,t),r;try{r=Hc.fromAppReturn(skn(i.pushCall.bind(i),()=>n(new wa(i.makeInput(),[]))))}finally{i.unregister()}if(r instanceof Promise)throw r.catch(o=>{}),new Error("RPC map() callbacks cannot be async.");return new wa(i.makeOutput(r),[])},y6=class extends N0{mapper;idx;constructor(e,t){super(),this.mapper=e,this.idx=t}dup(){return this}dispose(){}get(e){if(e.length==0)return this;if(I4)return I4.pushGet(this,e);k9()}call(e,t){t.dispose(),k9()}map(e,t,n){for(let i of t)i.dispose();k9()}pull(){k9()}ignoreUnhandledRejections(){}onBroken(e){k9()}},Dft=class{captures;variables;constructor(e,t){this.captures=e,this.variables=[t]}dispose(){for(let e of this.variables)e.dispose()}apply(e){try{if(e.length<1)throw new Error("Invalid empty mapper function.");for(let t of e.slice(0,-1)){let n=new Vv(this).evaluateCopy(t);if(n.value instanceof $0){let i=k1e(n.value);if(i){this.variables.push(i);continue}}this.variables.push(new kl(n))}return new Vv(this).evaluateCopy(e[e.length-1])}finally{for(let t of this.variables)t.dispose()}}importStub(e){throw new Error("A mapper function cannot refer to exports.")}importPromise(e){return this.importStub(e)}getExport(e){return e<0?this.captures[-e-1]:this.variables[e]}getPipeReadable(e){throw new Error("A mapper function cannot use pipe readables.")}getLimits(){return eH}},A9.applyMap=(e,t,n,i,r)=>{try{let o;if(e instanceof wa)throw new Error("applyMap() can't be called on RpcPromise");if(e instanceof Array){let s=[];try{for(let a of e)s.push(_ft(a,e,n,i,r))}catch(a){for(let c of s)c.dispose();throw a}o=Hc.fromArray(s)}else e==null?o=Hc.fromAppReturn(e):o=_ft(e,t,n,i,r);return new kl(o)}finally{for(let o of i)o.dispose()}},Lft=class ZBe extends N0{state;static create(t){let n=t.getWriter();return new ZBe({refcount:1,writer:n,closed:!1})}constructor(t,n){super(),this.state=t,n&&++t.refcount}getState(){if(this.state)return this.state;throw new Error("Attempted to use a WritableStreamStubHook after it was disposed.")}call(t,n){try{let i=this.getState();if(t.length!==1||typeof t[0]!="string")throw new Error("WritableStream stub only supports direct method calls");const r=t[0];if(r!=="write"&&r!=="close"&&r!=="abort")throw new Error(`Unknown WritableStream method: ${r}`);(r==="close"||r==="abort")&&(i.closed=!0);let o=r==="write"?n.deliverStreamWrite(i.writer):n.deliverCall(i.writer[r],i.writer);return new f6(o.then(s=>new kl(s)))}catch(i){return n.dispose(),new Wu(i)}}map(t,n,i){for(let r of n)r.dispose();return new Wu(new Error("Cannot use map() on a WritableStream"))}get(t){return new Wu(new Error("Cannot access properties on a WritableStream stub"))}dup(){let t=this.getState();return new ZBe(t,this)}pull(){return Promise.reject(new Error("Cannot pull a WritableStream stub"))}ignoreUnhandledRejections(){}dispose(){let t=this.state;this.state=void 0,t&&--t.refcount===0&&(t.closed||t.writer.abort(new Error("WritableStream RPC stub was disposed without calling close()")).catch(()=>{}),t.writer.releaseLock())}onBroken(t){this.getState().writer.closed.then(void 0,t)}},Nft=262144,$ft=1073741824,Uft=65536,Fft=2,D1e=1.25,Bft=.9,jft=3,Wft=class{now;window=Nft;bytesInFlight=0;inStartupPhase=!0;delivered=0;deliveredTime=0;firstAckTime=0;firstAckDelivered=0;minRtt=1/0;roundsWithoutIncrease=0;lastRoundWindow=0;roundStartTime=0;constructor(e){this.now=e}onSend(e){this.bytesInFlight+=e;let t={sentTime:this.now(),size:e,deliveredAtSend:this.delivered,deliveredTimeAtSend:this.deliveredTime,windowAtSend:this.window,windowFullAtSend:this.bytesInFlight>=this.window};return{token:t,shouldBlock:t.windowFullAtSend}}onError(e){this.bytesInFlight-=e.size}onAck(e){let t=this.now();this.delivered+=e.size,this.deliveredTime=t,this.bytesInFlight-=e.size;let n=t-e.sentTime;if(this.minRtt=Math.min(this.minRtt,n),this.firstAckTime===0)this.firstAckTime=t,this.firstAckDelivered=this.delivered;else{let i,r;e.deliveredTimeAtSend===0?(i=this.firstAckTime,r=this.firstAckDelivered):(i=e.deliveredTimeAtSend,r=e.deliveredAtSend);let o=t-i,s=(this.delivered-r)/o,a=this.inStartupPhase?Fft:D1e,c=s*this.minRtt*a;c=Math.min(c,e.windowAtSend*a),e.windowFullAtSend?c=Math.max(c,e.windowAtSend*Bft):c=Math.max(c,this.window),this.window=Math.max(Math.min(c,$ft),Uft),this.inStartupPhase&&e.sentTime>=this.roundStartTime&&(this.window>this.lastRoundWindow*D1e?this.roundsWithoutIncrease=0:++this.roundsWithoutIncrease>=jft&&(this.inStartupPhase=!1),this.roundStartTime=t,this.lastRoundWindow=this.window)}return this.bytesInFlight<this.window}},zft=class eje extends N0{state;static create(t){return new eje({refcount:1,stream:t,canceled:!1})}constructor(t,n){super(),this.state=t,n&&++t.refcount}call(t,n){return n.dispose(),new Wu(new Error("Cannot call methods on a ReadableStream stub"))}map(t,n,i){for(let r of n)r.dispose();return new Wu(new Error("Cannot use map() on a ReadableStream"))}get(t){return new Wu(new Error("Cannot access properties on a ReadableStream stub"))}dup(){let t=this.state;if(!t)throw new Error("Attempted to dup a ReadableStreamStubHook after it was disposed.");return new eje(t,this)}pull(){return Promise.reject(new Error("Cannot pull a ReadableStream stub"))}ignoreUnhandledRejections(){}dispose(){let t=this.state;this.state=void 0,t&&--t.refcount===0&&(t.canceled||(t.canceled=!0,t.stream.locked||t.stream.cancel(new Error("ReadableStream RPC stub was disposed without being consumed")).catch(()=>{})))}onBroken(t){}},qc.createWritableStreamHook=Lft.create,qc.createWritableStreamFromHook=mkn,qc.createReadableStreamHook=zft.create,qft=E9,Hft=hkn,Gft=class{constructor(e){this.#e=e}#e;#t;#n;#i=[];#r;async send(e){this.#e.send(e)}async receive(){if(this.#i.length>0)return this.#i.shift();if(this.#r)throw this.#r;return new Promise((e,t)=>{this.#t=e,this.#n=t})}abort(e){let t;e instanceof Error?t=e.message:t=`${e}`,this.#e.close(3e3,t),this.#r||(this.#r=e)}dispatchMessage(e){if(this.#r)return;let t=typeof e=="string"?e:new TextDecoder("utf-8",{ignoreBOM:!0}).decode(e);this.#t?(this.#t(t),this.#t=void 0,this.#n=void 0):this.#i.push(t)}dispatchClose(e,t){this.#o(new Error(`Peer closed WebSocket: ${e} ${t}`))}dispatchError(e){this.#o(new Error("WebSocket connection failed."))}#o(e){this.#r||(this.#r=e,this.#n&&(this.#n(e),this.#t=void 0,this.#n=void 0))}}}}),Vft,N1e,I9,v6,ykn,C9,Ja,Kft,Jft,Qft,R9,Xft,iH,Yft,Zft,egt,tgt,ngt,vkn,$1e,zo,igt,O9,U1e,F1e,P9,rgt,B1e,_kn=A({"../../packages/whistle/dist/wire.js"(){"use strict";yt(),Vft=l0(),N1e=Ln(()=>Ou("status",[de({status:Ie("available")}).strict(),de({status:Ie("unavailable"),reason:F()}).strict()])),I9=Vft,v6=Ln(()=>Ot(F(),I9)),ykn=Ln(()=>de({code:F().min(1).max(160),message:F().min(1).max(512),details:I9.optional()}).strict()),C9=v6,Ja=Ln(()=>F().refine(e=>e.trim().length>0)),Kft=N1e,Jft=Ln(()=>Et([de({type:Ie("action")}).strict(),de({type:Ie("custom"),data:v6}).strict(),de({type:Ie("choice"),options:Me(de({value:I9,label:Ja,description:Ja.optional()}))}).strict(),de({type:Ie("form"),submitLabel:Ja.optional()}).strict(),de({type:Ie("confirmation"),message:Ja,confirmLabel:Ja.optional(),cancelLabel:Ja.optional()}).strict()])),Qft=Ln(()=>de({inputSchema:C9.optional(),outputSchema:C9.optional(),presentation:Jft.optional()}).strict()),R9=Ln(()=>et().int().refine(e=>Number.isSafeInteger(e))),Xft=Ln(()=>de({hint:Ja.pipe(F().max(120)),words:Me(de({word:F().regex(/^\S{1,64}$/u),description:Ja.pipe(F().max(512)).optional(),arguments:v6}).strict()).max(32).optional(),text:de({field:Ja.pipe(F().max(120)),arguments:v6,requestIdField:Ja.pipe(F().max(120)).optional()}).strict().optional()}).strict().refine(e=>e.words!==void 0||e.text!==void 0,"slash arguments need words or text")),iH=Ln(()=>de({order:R9.optional()}).strict()),Yft=Ln(()=>de({bindings:de({order:R9.optional(),values:Me(Ja).max(16)}).strict().optional(),agent:de({keybind:Ja.optional(),order:R9.optional()}).strict().optional(),help:iH.optional(),menu:iH.optional(),palette:iH.optional(),slash:de({aliases:Me(Ja).max(16),consumesDraft:Rt().optional(),order:R9.optional(),arguments:Xft.optional()}).strict().optional()}).strict()),Zft=Ln(()=>de({id:Ja.refine(e=>!e.includes(":")),title:Ja,category:Ja,description:Ja.optional(),projections:Yft.optional(),action:Qft.optional(),availability:Kft.optional()}).strict()),egt=Ln(()=>de({inputSchema:C9.optional(),outputSchema:C9.optional()}).strict()),tgt=F().min(1).brand(),ngt=Ln(()=>de({commandId:tgt,command:de({namespace:F(),id:F()}).strict(),sourceId:F(),scope:F().optional(),title:F(),category:F(),description:F().optional(),order:et(),availability:N1e,action:egt.optional(),keybind:F().optional()}).strict()),vkn=Me(ngt),$1e=8192,zo=Ja.pipe(F().max($1e)),igt=60,O9=Ja.pipe(F().max(igt)),U1e=IR({protocol:/^https?$/u}),F1e=de({label:zo,value:zo}).strict(),P9={summary:zo.optional(),facts:Me(F1e).max(4).optional(),body:zo.optional(),bodyLabel:zo.optional(),details:Me(F1e).max(24).optional()},rgt=Ou("type",[de({type:Ie("choice"),message:O9,...P9,current:zo.optional(),collapsedGroup:zo.optional(),options:Me(de({value:zo,label:zo,description:zo.optional(),group:zo.optional(),destructive:Ie(!0).optional()}).strict()).min(1).max(256)}).strict(),de({type:Ie("text"),message:O9,...P9,placeholder:zo.optional(),secret:Rt().optional()}).strict(),de({type:Ie("confirmation"),message:O9,...P9,confirmLabel:zo.optional(),cancelLabel:zo.optional(),destructive:Ie(!0).optional()}).strict(),de({type:Ie("decision"),message:O9,...P9,options:Me(de({value:zo,label:zo,description:zo.optional(),destructive:Ie(!0).optional()}).strict()).min(1).max(8).refine(e=>new Set(e.map(t=>t.value)).size===e.length,"Decision option values must be unique"),multiple:Rt().optional(),other:de({label:zo,placeholder:zo.optional(),maxLength:et().int().min(1).max($1e),blank:zo.optional()}).strict().optional(),escape:zo.optional()}).strict().refine(e=>[e.escape,e.other?.blank].every(t=>t===void 0||e.options.some(n=>n.value===t)),"A decision's escape and blank answers must be offered options")]),B1e=Ln(()=>Ou("type",[de({type:Ie("info"),message:zo,links:Me(de({url:U1e,label:zo.optional()}).strict()).max(16).optional()}).strict(),de({type:Ie("progress"),message:zo}).strict(),de({type:Ie("handoff"),url:U1e,code:zo.optional(),message:zo.optional()}).strict(),de({type:Ie("success"),message:zo}).strict()]))}});function j1e(e){try{const t=ogt.parse(e);if(t===void 0||W1e.has(t.owner))return;W1e.add(t.owner),t.dispose?.call(t.owner)}catch(t){console.warn("RPC value disposal failed",t)}}var ogt,W1e,wkn=A({"../../packages/agar/dist/internal/capabilities.js"(){"use strict";yt(),wt(),ogt=qt().transform(e=>{const t=g5(Object).safeParse(e);if(!t.success)return;const n=Object.create(t.data),i=it(V({[Symbol.dispose]:jt(am(Function))}))(n);return{owner:t.data,dispose:i[Symbol.dispose]}}),W1e=new WeakSet}});function qf(e){const t=de(e),n=g5(Object),i=de(Object.fromEntries(Object.keys(e).map(r=>[r,qt().optional()])));return qt().transform(r=>{const o=n.parse(r),s=Object.create(o),a=i.parse(s),c=Object.fromEntries(Object.entries(a).flatMap(([u,l])=>l===void 0?[]:[[u,wv().parse(l).bind(o)]]));return{...t.parse(c),[Symbol.dispose](){j1e(r)}}})}function Od(e){return qt().transform(t=>{try{return e.parse(t)}catch(n){throw n instanceof x9?n:new x9("The capability returned malformed data",{cause:n,code:"PROTOCOL",retryable:!1})}finally{j1e(t)}})}function Qa(e){return wv({output:ale(qt().transform(t=>{try{return e.parse(t)}catch(n){throw j1e(t),n instanceof x9?n:new x9("The capability returned a malformed result",{cause:n,code:"PROTOCOL",retryable:!1})}}))})}var sgt,_6,bkn=A({"../../packages/agar/dist/internal/rpc-contract.js"(){"use strict";yt(),rkn(),wkn(),sgt=Qa(Od(Zue())),_6=qf({fetch:Qa(g5(Response)),close:sgt})}});import{webcrypto as agt}from"node:crypto";function xkn(e){if(e<0)throw new RangeError("Wrong ID size");try{!Bw||Bw.length<e?(Bw=Buffer.allocUnsafe(e*cgt),agt.getRandomValues(Bw),w6=0):w6+e>Bw.length&&(agt.getRandomValues(Bw),w6=0)}catch(t){throw Bw=void 0,t}w6+=e}function Skn(e){return xkn(e|=0),Bw.subarray(w6-e,w6)}function kkn(e,t,n){let i=256-256%e.length;if(i===256){let o=e.length-1;return(s=t)=>{if(!s)return"";let a="";for(;;){let c=n(s),u=s;for(;u--;)if(a+=e[c[u]&o],a.length>=s)return a}}}let r=Math.ceil(1.6*256*t/i);return(o=t)=>{if(!o)return"";let s="";for(;;){let a=n(r),c=r;for(;c--;)if(a[c]<i&&(s+=e[a[c]%e.length],s.length>=o))return s}}}function Ekn(e,t=21){return kkn(e,t,Skn)}var cgt,Bw,w6,Akn=A({"../../node_modules/.pnpm/nanoid@5.1.16/node_modules/nanoid/index.js"(){cgt=128}});function Pd(e=M9){if(e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY)throw new RangeError("nanoid length must be finite");return Ekn(ugt,e)()}var ugt,M9,lgt=A({"../../packages/cairn/dist/nanoid.js"(){"use strict";Akn(),ugt="abcdefghijklmnopqrstuvwxyz0123456789",M9=21}}),z1e,dgt,pgt,hgt,mgt,fgt,ggt,q1e,ygt=A({"../../packages/cairn/dist/input-schema.js"(){"use strict";yt(),z1e=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,dgt=/^[a-z][a-z0-9]*(?:_[a-z][a-z0-9]*)*$/,pgt=F().min(1).max(64).regex(z1e),hgt=F().min(1).max(64).regex(z1e),mgt=F().min(1).max(32).regex(dgt),fgt=de({prefix:mgt}),ggt=de({family:pgt,version:Ie(1),kinds:Ot(hgt,fgt)}).superRefine((e,t)=>{const n=Object.entries(e.kinds);if(n.length<1||n.length>64){t.addIssue({code:"custom",message:"Identifier families must declare between one and 64 kinds"});return}const i=new Set;for(const[,r]of n){if(i.has(r.prefix)){t.addIssue({code:"custom",message:"Identifier kind prefixes must be distinct"});return}i.add(r.prefix)}}),q1e=F()}});function vgt(e){return e===32||e>=9&&e<=13}function Tkn(e){let t=0,n=e.length;for(;t<n&&vgt(e.charCodeAt(t));)t+=1;for(;n>t&&vgt(e.charCodeAt(n-1));)n-=1;return e.slice(t,n).replace(/[A-Z]/g,i=>String.fromCharCode(i.charCodeAt(0)+32))}function Ikn(e){const t=`${e.prefix}_`;function n(a){if(!a.startsWith(t))return!1;const c=a.slice(t.length);return c.length===M9&&_gt.test(c)}const i=Ln(()=>c2(a=>{const c=q1e.safeParse(a);return c.success&&n(c.data)}));function r(a){let c;const u=a,l=wgt.encode(u).byteLength,d=i.safeParse(u),p=u.startsWith(t)?u.slice(t.length):void 0;if(l<3||l>96)c="bounds";else if(p!==void 0&&Array.from(p).length!==M9)c="bounds";else{if(d.success)return{ok:!0,value:d.data};n(Tkn(u))?c="non_canonical":c="grammar"}return{ok:!1,error:{code:"invalid_id",family:e.family,kind:e.kind,version:1,reason:c}}}const o=Ln(()=>q1e.transform((a,c)=>{const u=r(a);return u.ok?u.value:(c.addIssue({code:"custom",message:u.error.reason}),fR)}));function s(){let a;try{a=Pd(M9)}catch{throw e.entropyUnavailable()}return i.parse(`${t}${a}`)}return{family:e.family,kind:e.kind,version:1,generate:s,schema:o,parse:r,is:a=>r(a).ok}}var _gt,wgt,Ckn=A({"../../packages/cairn/dist/internal/identifier-codec.js"(){"use strict";lgt(),yt(),ygt(),_gt=/^[a-z0-9]+$/,wgt=new TextEncoder}});function F0(e){let t;try{t=ggt.safeParse(e)}catch{throw new rH}if(!t.success)throw new rH;const n=t.data,i={};for(const[s,a]of Object.entries(n.kinds)){const c=a.prefix;i[s]=Ikn({family:e.family,kind:s,prefix:c,entropyUnavailable:()=>new xgt({family:n.family,kind:s})})}const o=c2(s=>{const a=bgt.safeParse(s);if(!a.success)return!1;const c=Object.entries(a.data);return c.length===Object.keys(n.kinds).length&&c.every(([u,l])=>Object.hasOwn(n.kinds,u)&&l.kind===u&&l.family===n.family)}).safeParse(i);if(!o.success)throw new rH;return o.data}var bgt,rH,xgt,H1e=A({"../../packages/cairn/dist/identifier.js"(){"use strict";Ckn(),yt(),ygt(),bgt=Ot(F(),de({family:F(),kind:F(),version:Ie(1),generate:wv(),schema:g5(Ni),parse:wv(),is:wv()})),rH=class extends Error{name="CairnDefinitionError";code="invalid_definition";constructor(){super("Cairn identifier family definition is invalid")}},xgt=class extends Error{name="CairnGenerationError";code="entropy_unavailable";family;kind;version=1;constructor(e){super("Cairn entropy source is unavailable"),this.family=e.family,this.kind=e.kind}}}});function Sgt(e){const n=Math.floor(4294967296/e.length)*e.length;let i;do{const o=crypto.getRandomValues(new Uint32Array(1))[0];if(o===void 0)throw new Error("CSPRNG returned no candidate value");i=o}while(i>=n);const r=e[i%e.length];if(r===void 0)throw new Error("Candidate vocabulary is empty");return r}function Rkn(e){if(e?.count===Number.POSITIVE_INFINITY)throw new RangeError("words count must be finite");const t=Math.max(1,Math.floor(e?.count??2)),n=e?.separator??"-",i=[Sgt(kgt)];for(let r=1;r<t;r++)i.push(Sgt(Egt));return i.join(n)}var kgt,Egt,Okn=A({"../../packages/cairn/dist/words.js"(){"use strict";kgt=["gilled","velvety","spored","saprotrophic","mycorrhizal","luminescent","honeycomb","truffley","wispy","earthy","mossy","woody","waxy","gelatinous","coral","inkcapped","feathery","stiped","ringed","annulate","scaly","shaggy","fuzzy","spiky","conical","umbral","parasol","leathery","damp","dewy","bristly","powdery","yeasty","musty","ancient","patient","steady","faithful","hardy","rootbound","forested","shaded","sunlit","sporeladen","golden","honeyed","amber","ivory","crimson","violet","indigo","silver","mossgreen","midnight","creamy","buttery","porcelain","glossy","matte","ribbed","fluted","wavy","lobed","branched","curled","folded","hooded","crowned","blushing","weeping","laughing","dancing","singing","whistling","glowing","ghostly","fairy","elfin","rustic","homey","barnraised","pasture","orchard","mill","woven","gardened","herded","trailed","ridged","meadow","fielded","vined","rooted","tendered","seasoned","ripe","wild","tame","broody","stubborn","gentle","drowsy","watchful","wandering","migratory","burrowed","nested","perched","loamy","mulched","composted","fermented","brewed","cured","smoked","pickled","preserved","aged","vintage","heirloom","grandmothers","forgotten","remembered","beloved","cherished","worn","weathered","windblown","rainsoaked","frosted","snowed","bloomed","flowered","seeded","sprouted","grafted","pruned","harvested","threshed","milled","baked","proofed","risen","folded","twisted","braided","stitched","patched","mended","polished","burnished","glazed","gilded","verdigris","patinaed","microdosed","tripping","wavy","prismatic","shimmering","rippling","echoing","oracular","mystic","kaleidoscopic","auroral","nebular","azure","psychedelic","transcendent","visionary","wandering","dreaming","phantom","spectral","iridescent","liminal","tidal","celestial","cosmic","astral","ethereal","incandescent"],Egt=["shiitake","morel","chanterelle","bolete","puffball","oyster","enoki","maitake","lionsmane","truffle","porcini","agaric","amanita","bracket","conk","stipe","cap","gill","spore","hypha","mycelium","sporocarp","earthstar","stinkhorn","jelly","milkcap","blewit","cep","hedgehog","woodear","waxcap","inkcap","birdnest","cup","saddle","fieldcap","rust","smut","ergot","lichen","yeast","mold","toadstool","fruitingbody","basidiocarp","ascocarp","perithecium","apothecium","cystidium","basidium","clamp","septa","rhizomorph","sclerotium","gemma","annulus","volva","pileus","lamella","trama","gleba","peridium","sporangium","zygospora","conidia","teleomorph","anamorph","saprobe","endophyte","epiphyte","decomposer","recycler","alchemist","mycorrhiza","hyphae","web","net","lattice","thread","strand","root","tendril","runner","vine","ivy","moss","fern","liverwort","mule","cairn","almanac","parrot","birddog","watchdog","pigeon","ranch","barn","coop","pasture","meadow","field","orchard","gate","fence","silo","well","windmill","homestead","trail","ridge","creek","hill","grove","vineyard","apiary","garden","plot","furrow","shed","stable","trough","hayloft","rootcellar","smokehouse","springhouse","millstone","weathervane","lantern","tinderbox","candlemold","honeycomb","beeswax","propolis","nectar","pollen","comb","burrow","den","nest","perch","warren","colony","swarm","flock","herd","pod","grist","flour","starter","mother","scoby","kombucha","miso","tempeh","cheese","rennet","whey","curd","cream","butter","braid","loaf","crust","crumb","fiddlehead","sorrel","ramp","morelberry","huckleberry","thimbleberry","salmonberry","serviceberry","chokecherry","microdose","trip","shroom","liberty","teacher","treasure","wanderer","seeker","dreamer","shaman","visionary","tripper","oracle","seer","augur","prism","fractal","kaleidoscope","spectrum","nebula","aurora","comet","meteor","eclipse","zenith","horizon","mirage","echo","ripple","shimmer","glimmer","phantom","twilight","starlight","moonbeam"]}});function Pkn(e,t=0){return(Gc[e[t+0]]+Gc[e[t+1]]+Gc[e[t+2]]+Gc[e[t+3]]+"-"+Gc[e[t+4]]+Gc[e[t+5]]+"-"+Gc[e[t+6]]+Gc[e[t+7]]+"-"+Gc[e[t+8]]+Gc[e[t+9]]+"-"+Gc[e[t+10]]+Gc[e[t+11]]+Gc[e[t+12]]+Gc[e[t+13]]+Gc[e[t+14]]+Gc[e[t+15]]).toLowerCase()}var Gc,Mkn=A({"../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/stringify.js"(){Gc=[];for(let e=0;e<256;++e)Gc.push((e+256).toString(16).slice(1))}});import{randomFillSync as Dkn}from"crypto";function Lkn(){return L9>D9.length-16&&(Dkn(D9),L9=0),D9.slice(L9,L9+=16)}var D9,L9,Nkn=A({"../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/rng.js"(){D9=new Uint8Array(256),L9=D9.length}});import{randomUUID as $kn}from"crypto";var G1e,Ukn=A({"../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/native.js"(){G1e={randomUUID:$kn}}});function Fkn(e,t,n){if(G1e.randomUUID&&!t&&!e)return G1e.randomUUID();e=e||{};const i=e.random??e.rng?.()??Lkn();if(i.length<16)throw new Error("Random bytes length must be >= 16");if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){if(n=n||0,n<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let r=0;r<16;++r)t[n+r]=i[r];return t}return Pkn(i)}var Agt,Bkn=A({"../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/v4.js"(){Ukn(),Nkn(),Mkn(),Agt=Fkn}}),jkn=A({"../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/index.js"(){Bkn()}});async function Wkn(e,t){const n=new TextEncoder,i=["cairn:replay:v1\0",`${String(t.length)}:`];for(const s of[e,...t]){const a=JSON.stringify(s);i.push(`${String(n.encode(a).byteLength)}:`,a)}const r=await globalThis.crypto.subtle.digest("SHA-256",n.encode(i.join(""))),o=Array.from(new Uint8Array(r),s=>s.toString(16).padStart(2,"0")).join("");return Cgt.parse(`replay_${o}`)}function b6(){return Ogt.parse(Agt())}var Tgt,Igt,Cgt,Rgt,zkn,Ogt,qkn=A({"../../packages/cairn/dist/ephemeral-key.js"(){"use strict";jkn(),yt(),Tgt=GF({version:"v7"}),Igt=F().regex(/^replay_[a-f0-9]{64}$/),Cgt=c2(e=>Igt.safeParse(e).success),Rgt=GF({version:"v4"}),zkn=c2(e=>Tgt.safeParse(e).success),Ogt=c2(e=>Rgt.safeParse(e).success)}}),ba=A({"../../packages/cairn/dist/index.js"(){"use strict";H1e(),lgt(),qkn()}}),Pgt,Mgt,zu,tn,oH,C4,Vc,sH,Dgt,V1e,aH,B0,Md,K1e,x6,Lgt,Ngt,Hkn,Gkn,Vkn,Kkn,Jkn,Qkn,Xkn,Ykn=A({"../../packages/sprite/dist/render-style.js"(){"use strict";yt(),Pgt=["plain","pencil","manga","riso","halftone","blueprint","crt","watercolor"],Mgt=wn(Pgt),zu={ink:"var(--sprite-ink, var(--color-base-content, #1c1c1a))",paper:"var(--sprite-paper, var(--color-base-100, #fbfaf6))",accent:"var(--sprite-accent, var(--color-accent, #d20f39))",risoFirst:"var(--sprite-riso-first, var(--color-info, #1e66f5))",risoSecond:"var(--sprite-riso-second, var(--color-accent, #ea76cb))",blueprint:"var(--sprite-blueprint, color-mix(in oklab, var(--color-info, #1e66f5) 55%, #0b2350))",blueprintLine:"var(--sprite-blueprint-line, color-mix(in oklab, var(--color-info-content, #ffffff) 25%, #ffffff))",screen:"var(--sprite-screen, color-mix(in oklab, var(--color-base-content, #111111) 12%, #050805))",phosphor:"var(--sprite-phosphor, var(--color-success, #40a02b))"},tn=(e,t={},...n)=>({tag:e,attributes:t,children:n}),oH=(e,t,n=1)=>tn("feFlood",{style:`flood-color: ${e}`,"flood-opacity":n,result:t}),C4=(e,t,n)=>[tn("feImage",{href:`data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' width='${String(t)}' height='${String(t)}'>${e}</svg>`)}`,width:t,height:t,result:`${n}Cell`}),tn("feTile",{in:`${n}Cell`,result:n})],Vc=(e,t,n)=>tn("feColorMatrix",{in:t,type:"matrix",values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ${e}`,result:n}),sH=(e,t)=>Vc("-0.333 -0.333 -0.333 1 0",e,t),Dgt=(e,t,n,i=1.1)=>[tn("feConvolveMatrix",{in:e,order:3,kernelMatrix:"0 1 0 1 -4 1 0 1 0",result:`${t}In`}),tn("feConvolveMatrix",{in:e,order:3,kernelMatrix:"0 -1 0 -1 4 -1 0 -1 0",result:`${t}Out`}),tn("feComposite",{in:`${t}In`,in2:`${t}Out`,operator:"arithmetic",k2:1,k3:1,result:`${t}Edges`}),Vc(`${String(n)} ${String(n)} ${String(n)} ${String(i)} 0`,`${t}Edges`,t)],V1e=(e,t,n,i)=>[tn("feConvolveMatrix",{in:e,order:3,kernelMatrix:"0 1 0 1 -4 1 0 1 0",preserveAlpha:"true",result:`${t}In`}),tn("feConvolveMatrix",{in:e,order:3,kernelMatrix:"0 -1 0 -1 4 -1 0 -1 0",preserveAlpha:"true",result:`${t}Out`}),tn("feComposite",{in:`${t}In`,in2:`${t}Out`,operator:"arithmetic",k2:1,k3:1,result:`${t}Edges`}),Vc(`${String(n)} ${String(n)} ${String(n)} 0 -0.15`,`${t}Edges`,`${t}Inner`),tn("feMorphology",{in:e,operator:"dilate",radius:i,result:`${t}Grown`}),tn("feComposite",{in:`${t}Grown`,in2:e,operator:"out",result:`${t}Ring`}),Vc("0 0 0 1 0",`${t}Ring`,`${t}Outline`),B0(t,`${t}Inner`,`${t}Outline`)],aH=(e,t,n)=>tn("feComponentTransfer",{in:e,result:n},tn("feFuncA",{type:"discrete",tableValues:t})),B0=(e,...t)=>tn("feMerge",{result:e},...t.map(n=>tn("feMergeNode",{in:n}))),Md=(e,t,n,i=1)=>[oH(e,`${n}Flood`,i),tn("feComposite",{in:`${n}Flood`,in2:t,operator:"in",result:n})],K1e={x:"0%",y:"0%",width:"100%",height:"100%"},x6={x:"-8%",y:"-8%",width:"116%",height:"116%"},Lgt={value:1.6,line:6,outline:2.4,midHatch:[3.2,-.05],darkHatch:[3.4,-.4],tooth:"0 0 0 -0.7 1.45",opacity:1},Ngt=e=>({region:x6,primitives:[tn("feComponentTransfer",{in:"SourceGraphic",result:"valued"},...["feFuncR","feFuncG","feFuncB"].map(t=>tn(t,{type:"gamma",amplitude:1,exponent:e.value,offset:0}))),tn("feTurbulence",{type:"fractalNoise",baseFrequency:.05,numOctaves:2,seed:1,result:"wobble","data-sprite-boil":"wobble"}),tn("feDisplacementMap",{in:"valued",in2:"wobble",scale:2.6,xChannelSelector:"R",yChannelSelector:"G",result:"drawn"}),...Dgt("drawn","line",e.line,e.outline),sH("drawn","dark"),...C4("<path d='M-1 1l2-2M0 6l6-6M5 7l2-2' stroke='black' stroke-width='1.1'/>",6,"hatch45"),tn("feOffset",{in:"hatch45",dx:0,dy:0,result:"hatchOffset","data-sprite-boil":"hatch"}),tn("feTurbulence",{type:"fractalNoise",baseFrequency:.07,numOctaves:2,seed:5,result:"strokeBend"}),tn("feDisplacementMap",{in:"hatchOffset",in2:"strokeBend",scale:4,xChannelSelector:"R",yChannelSelector:"B",result:"hatchA"}),...C4("<path d='M-1 4l2 2M0 0l5 5M4 -1l2 2' stroke='black' stroke-width='0.9'/>",5,"hatch135"),tn("feDisplacementMap",{in:"hatch135",in2:"strokeBend",scale:3,xChannelSelector:"G",yChannelSelector:"R",result:"hatchB"}),tn("feComposite",{in:"dark",in2:"hatchA",operator:"arithmetic",k1:e.midHatch[0],k4:e.midHatch[1],result:"shadeA"}),tn("feComposite",{in:"dark",in2:"hatchB",operator:"arithmetic",k1:e.darkHatch[0],k4:e.darkHatch[1],result:"shadeB"}),tn("feTurbulence",{type:"fractalNoise",baseFrequency:.9,numOctaves:1,seed:3,result:"tooth"}),Vc(e.tooth,"tooth","toothMask"),Vc("0 0 0 6 -4.6","dark","solid"),B0("graphiteRaw","solid","shadeA","shadeB","line"),tn("feComposite",{in:"graphiteRaw",in2:"toothMask",operator:"in",result:"graphite"}),...Md(zu.ink,"graphite","pencil",e.opacity)],boil:{intervalMs:160,tracks:[{name:"wobble",attribute:"seed",frames:[1,2,3]},{name:"hatch",attribute:"dx",frames:[0,1,2]}]}}),Hkn={region:x6,primitives:[tn("feTurbulence",{type:"fractalNoise",baseFrequency:.04,numOctaves:2,seed:2,result:"brush","data-sprite-boil":"brush"}),tn("feDisplacementMap",{in:"SourceGraphic",in2:"brush",scale:2,xChannelSelector:"R",yChannelSelector:"G",result:"drawn"}),...Md(zu.paper,"SourceAlpha","paperFill"),sH("drawn","dark"),...C4("<circle cx='2.5' cy='2.5' r='1.15' fill='black'/>",5,"dots"),aH("dark","0 1 1 0","midTone"),tn("feComposite",{in:"dots",in2:"midTone",operator:"in",result:"tone"}),aH("dark","0 0 0 1","solid"),Vc("3 -3 0 0 -0.35","drawn","satRG"),Vc("-3 3 0 0 -0.35","drawn","satGR"),Vc("0 3 -3 0 -0.35","drawn","satGB"),Vc("0 -3 3 0 -0.35","drawn","satBG"),B0("saturation","satRG","satGR","satGB","satBG"),aH("saturation","0 1","accentMask"),...Md(zu.accent,"accentMask","accentFill"),...V1e("drawn","edge",2,2.2),tn("feMorphology",{in:"edge",operator:"dilate",radius:.25,result:"stroke"}),B0("inkRaw","tone","solid","stroke"),...Md(zu.ink,"inkRaw","ink"),B0("manga","paperFill","accentFill","ink")],boil:{intervalMs:180,tracks:[{name:"brush",attribute:"seed",frames:[2,4,6]}]}},Gkn={region:x6,primitives:[Vc("-0.55 -0.55 -0.55 1.65 0","SourceGraphic","dark"),tn("feTurbulence",{type:"fractalNoise",baseFrequency:.85,numOctaves:1,seed:7,result:"grain"}),Vc("0 0 0 -0.9 1.35","grain","grainMask"),tn("feComposite",{in:"dark",in2:"grainMask",operator:"in",result:"firstMask"}),...Md(zu.risoFirst,"firstMask","firstInk",.92),Vc("0 -1.9 0 1.9 0","SourceGraphic","secondMask"),...Md(zu.risoSecond,"secondMask","secondInk",.9),tn("feOffset",{in:"firstInk",dx:-1.5,dy:1,result:"firstPlate","data-sprite-boil":"register"}),tn("feOffset",{in:"secondInk",dx:1.5,dy:-.5,result:"secondPlate"}),tn("feBlend",{in:"firstPlate",in2:"secondPlate",mode:"multiply"})],boil:{intervalMs:240,tracks:[{name:"register",attribute:"dx",frames:[-1.5,-1,-2]}]}},Vkn={region:x6,primitives:[Vc("-0.5 -0.5 -0.5 1.65 0","SourceGraphic","value"),Vc("0 0 0 0.16 0","SourceGraphic","floor"),B0("dark","floor","value"),...C4("<defs><radialGradient id='d'><stop offset='0' stop-opacity='1'/><stop offset='1' stop-opacity='0'/></radialGradient></defs><rect width='6' height='6' fill='url(#d)'/>",6,"screen"),tn("feComposite",{in:"dark",in2:"screen",operator:"arithmetic",k2:1,k3:1,k4:-.92,result:"dotField"}),tn("feComponentTransfer",{in:"dotField",result:"dotsRaw"},tn("feFuncA",{type:"linear",slope:12,intercept:0})),tn("feComposite",{in:"dotsRaw",in2:"SourceAlpha",operator:"in",result:"dots"}),...Md(zu.ink,"dots","halftone")]},Kkn={region:K1e,primitives:[oH(zu.blueprint,"ground"),tn("feTurbulence",{type:"fractalNoise",baseFrequency:.05,numOctaves:1,seed:4,result:"hand","data-sprite-boil":"hand"}),tn("feDisplacementMap",{in:"SourceGraphic",in2:"hand",scale:1.6,xChannelSelector:"R",yChannelSelector:"G",result:"drawn"}),...C4("<path d='M0 0.5h16M0.5 0v16' stroke='black' stroke-width='1' stroke-opacity='0.22'/>",16,"grid"),...Md(zu.blueprintLine,"grid","gridLines"),...Md(zu.blueprintLine,"SourceAlpha","wash",.12),...V1e("drawn","edge",3,1.2),tn("feMorphology",{in:"edge",operator:"dilate",radius:.3,result:"stroke"}),...Md(zu.blueprintLine,"stroke","lines"),B0("blueprint","ground","gridLines","wash","lines")],boil:{intervalMs:200,tracks:[{name:"hand",attribute:"seed",frames:[4,5,6]}]}},Jkn={region:K1e,primitives:[oH(zu.screen,"ground"),tn("feColorMatrix",{in:"SourceGraphic",type:"luminanceToAlpha",result:"lumRaw"}),tn("feComposite",{in:"lumRaw",in2:"SourceAlpha",operator:"in",result:"lum"}),tn("feComponentTransfer",{in:"lum",result:"beam"},tn("feFuncA",{type:"linear",slope:1.5,intercept:-.35})),tn("feComposite",{in:"beam",in2:"SourceAlpha",operator:"in",result:"trace"}),...Md(zu.phosphor,"trace","glow"),tn("feGaussianBlur",{in:"glow",stdDeviation:2.5,result:"bloom"}),...C4("<rect y='2' width='3' height='1' fill='black'/>",3,"scan"),tn("feOffset",{in:"scan",dx:0,dy:0,result:"scanRoll","data-sprite-boil":"roll"}),...Md(zu.screen,"scanRoll","scanlines",.6),B0("crt","ground","bloom","glow","scanlines")],boil:{intervalMs:120,tracks:[{name:"roll",attribute:"dy",frames:[0,1,2]}]}},Qkn={region:x6,primitives:[tn("feTurbulence",{type:"fractalNoise",baseFrequency:.03,numOctaves:3,seed:9,result:"flow"}),tn("feDisplacementMap",{in:"SourceGraphic",in2:"flow",scale:7,xChannelSelector:"R",yChannelSelector:"G",result:"bled"}),tn("feGaussianBlur",{in:"bled",stdDeviation:1.4,result:"wash"}),tn("feComponentTransfer",{in:"wash",result:"thin"},tn("feFuncR",{type:"linear",slope:.78,intercept:.2}),tn("feFuncG",{type:"linear",slope:.78,intercept:.2}),tn("feFuncB",{type:"linear",slope:.78,intercept:.2}),tn("feFuncA",{type:"linear",slope:.9,intercept:0})),tn("feGaussianBlur",{in:"wash",stdDeviation:3,result:"spread"}),tn("feComposite",{in:"wash",in2:"spread",operator:"arithmetic",k2:1.6,k3:-1.4,result:"rimMask"}),tn("feComponentTransfer",{in:"wash",result:"deep"},tn("feFuncR",{type:"linear",slope:.6,intercept:0}),tn("feFuncG",{type:"linear",slope:.6,intercept:0}),tn("feFuncB",{type:"linear",slope:.6,intercept:0})),tn("feComposite",{in:"deep",in2:"rimMask",operator:"in",result:"rim"}),tn("feTurbulence",{type:"fractalNoise",baseFrequency:.7,numOctaves:2,seed:11,result:"tooth"}),Vc("0 0 0 -0.8 1.5","tooth","toothMask"),sH("SourceGraphic","dark"),Vc("0 0 0 5 -3.8","dark","keyMask"),...Md(zu.ink,"keyMask","key",.9),B0("paint","thin","rim","key"),tn("feComposite",{in:"paint",in2:"toothMask",operator:"in"})]},Xkn=Ngt(Lgt)}}),$gt,Zkn,Ugt,Fgt,J1e,Bgt,eEn=A({"../../packages/sprite/dist/avatar.js"(){"use strict";yt(),Ykn(),$gt=["mushroom","cat","burger"],Zkn=wn(["shift","keep"]),Ugt=F().regex(/^#[0-9a-f]{6}$/i),Fgt=Et([Ugt,et(),Rt()]),J1e=16,Bgt=Dr({v:Ie(1),character:wn($gt),appearance:Ot(F().min(1),Fgt).refine(e=>Object.keys(e).length<=J1e,{message:`Avatar appearance cannot exceed ${String(J1e)} keys`}),expression:F().min(1),renderStyle:Mgt})}}),Q1e,jgt,qu,cH,N9,tEn,Wgt,zgt,qgt,Hgt,nEn,Ggt,Vgt,iEn,rEn,oEn,sEn,aEn,cEn,uEn,lEn,dEn,pEn,hEn,mEn,X1e,fEn,Y1e,Kgt,gEn,Z1e,e_e,Jgt,t_e,yEn,vEn,_En,Qgt,wEn,$9=A({"../../packages/agar/dist/agents.js"(){"use strict";QSn(),yt(),okn(),bkn(),wt(),eEn(),Q1e=F().trim().min(1).max(256).refine(e=>!/[\p{Cc}\p{Cf}]/u.test(e),{message:"An Agent name cannot contain control or invisible characters"}),jgt=Dr({rootAgentId:F(),agents:Me(Ou("outcome",[Dr({agentId:F(),name:F(),outcome:wn(["stopped","idle"])}),Dr({agentId:F(),name:F(),outcome:Ie("failed"),reason:F()})])),discoveryFailures:Me(Dr({agentId:F(),reason:F()})),notPermitted:et().int().nonnegative()}),qu=te.pipe(Ze(rn(1)),Ze(ft(256))),cH=Rr(e=>Bgt.safeParse(e).success,{expected:"an Avatar v1 descriptor"}),N9=V({agentId:qu,name:qu,avatar:cH,sessionOperations:ut(ct(["agent.read","agent.send","agent.manage"]))}),tEn=Ln(()=>Dr({agents:Me(Dr({agentId:F(),name:F()}))})),Wgt=At([ct(["new","none"]),V({computerId:qu})]),zgt=V({computerId:qu,name:qu,createdAt:on.pipe(Ze(Ff()))}),qgt=dt(ut(zgt)),Hgt=it(qgt,{onExcessProperty:"error"}),nEn=V({name:qu,requestId:qu,computer:Ue(Wgt),avatar:Ue(cH)}),Ggt=ut(N9),Vgt=it(Ggt,{onExcessProperty:"error"}),iEn=it(qu),rEn=it(am(Response)),oEn=L0("agent.list",1,Ln(()=>qf({list:Qa(Od(qt().transform(e=>Vgt(e))))}))),sEn=L0("agent.manage",1,Ln(()=>qf({open:Qa(_6),computers:Qa(Od(qt().transform(e=>Hgt(e)))),create:Qa(Od(qt().transform(e=>it(N9)(e))))}))),aEn=V({agentId:qu,name:qu}),cEn=L0("agent.rename",1,Ln(()=>qf({rename:Qa(Od(qt().transform(e=>it(N9)(e))))}))),uEn=V({agentId:qu}),lEn=L0("agent.stop",1,Ln(()=>qf({stopAll:Qa(Od(jgt))}))),dEn=V({agentId:qu,avatar:cH}),pEn=L0("agent.avatar",1,Ln(()=>qf({setAvatar:Qa(Od(qt().transform(e=>it(N9)(e))))}))),hEn=V({agentId:qu}),mEn=V({agentId:qu,expectedContent:dt(te),content:te}),X1e=V({agentId:qu,home:dt(V({name:te})),content:dt(te),bytes:rt.pipe(Ze(Wt(0))),limit:rt.pipe(Ze(Js(0)))}),fEn=L0("agent.instructions",2,Ln(()=>qf({read:Qa(Od(qt().transform(e=>it(X1e)(e)))),set:Qa(Od(qt().transform(e=>it(X1e)(e))))}))),Y1e=Ln(()=>Et([de({status:Ie("pending"),revision:F()}),de({status:Ie("approved"),revision:F()})])),Kgt=Ln(()=>Et([Y1e,de({error:F()})])),gEn=L0("agent.toolPolicy",1,Ln(()=>qf({status:Qa(Od(Et([Y1e,u0()]))),approve:Qa(Od(Kgt))}))),Z1e=Ln(()=>de({installationId:F(),name:F()})),e_e=Ln(()=>de({agentId:F(),attached:Me(Z1e),available:Me(Z1e)})),Jgt=Ln(()=>de({error:wn(["not_found","not_granted","not_extension"])})),t_e=Ln(()=>Et([e_e,Jgt])),yEn=L0("agent.extensions",1,Ln(()=>qf({list:Qa(Od(Et([e_e,u0()]))),attach:Qa(Od(t_e)),detach:Qa(Od(t_e))}))),vEn=L0("agent.read",1,Ln(()=>qf({open:Qa(_6),openInbox:Qa(_6)}))),_En=L0("agent.send",1,Ln(()=>qf({open:Qa(_6),openInbox:Qa(_6)}))),Qgt="https://agent-session.fungi.invalid",wEn=`${Qgt}/member`}}),S6,n_e,jw,uH,U9,i_e,lH,r_e,o_e,k6=A({"../../packages/shiitake/dist/session-attention.js"(){"use strict";wt(),S6=Td.check(ft(256)),n_e=rt.check(Wt(0)),jw=V({agentId:S6,sessionId:S6,name:S6}),uH=V({by:jw,reason:ct(["escalated","sender_archived","sender_absent"]),note:Ue(te.check(ft(1e3)))}),U9=V({id:S6,kind:Td.check(ft(64)),summary:Td.check(ft(200)),since:n_e,expiresAt:jt(n_e),inbox:jt(Ce(!1)),waitingOn:jt(jw),escalated:jt(uH)}),i_e=U9.mapFields(e=>({...e,extensionId:S6})),lH=64,r_e=4096,o_e=ut(i_e).check(ft(lH))}});function bEn(e){e.sql.exec(`CREATE TABLE IF NOT EXISTS session_attention_grants (
|
|
91
|
+
`:"");function u(d,p){c.push(r?o.repeat(d)+p:p)}function l(d,p,h,m){const{attrs:f,safe:g}=p4.tagInfo(d,m);if(p===void 0)u(h,`<${g}${f}/>`);else if(typeof p=="string")u(h,`<${g}${f}>${p4.escapeText(p)}</${g}>`);else if(typeof p!="object"||p===null)u(h,`<${g}${f}>${p4.escapeText(Qt(p))}</${g}>`);else{if(a.has(p))throw new globalThis.Error("Cycle detected while serializing to XML.",{cause:p});a.add(p);try{if(globalThis.Array.isArray(p)){if(p.length===0){u(h,`<${g}${f}/>`);return}u(h,`<${g}${f}>`);for(const _ of p)l(i,_,h+1);u(h,`</${g}>`);return}const y=p,v=Object.keys(y);if(s&&v.sort(),v.length===0){u(h,`<${g}${f}/>`);return}u(h,`<${g}${f}>`);for(const _ of v)l(p4.parseTagName(_).safe,y[_],h+1,_);u(h,`</${g}>`)}finally{a.delete(p)}}}}var p4,N2n=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/toEncoderXml.js"(){gt(),ma(),jv(),Sw(),N8(),p4={escapeText(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},escapeAttribute(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},parseTagName(e){const t=e;let n=e;return/^[A-Za-z_]/.test(n)||(n="_"+n),n=n.replace(/[^A-Za-z0-9._-]/g,"_"),/^xml/i.test(n)&&(n="_"+n),{safe:n,changed:n!==t}},tagInfo(e,t){const{changed:n,safe:i}=p4.parseTagName(e),o=n||t&&t!==e?` data-name="${p4.escapeAttribute(t??e)}"`:"";return{safe:i,attrs:o}}}}});function Rw(e){const t=g8(e)?.toEquivalence;if(t)return t(C8(e)?e.typeParameters.map(Rw):[]);switch(e._tag){case"Never":return D5();case"Declaration":return $2n(e);case"Null":case"Undefined":case"Void":case"Unknown":case"Any":case"String":case"Number":case"Boolean":case"BigInt":case"Symbol":case"Literal":case"UniqueSymbol":case"ObjectKeyword":case"Enum":case"TemplateLiteral":return ii;case"Arrays":{const n=e.elements.map(Rw),i=e.rest.map(Rw),[r,...o]=i,s=o.length;return yp((a,c)=>{if(!Array.isArray(a)||!Array.isArray(c))return!1;const u=a.length;if(u!==c.length)return!1;let l=0;for(;l<Math.min(u,e.elements.length);l++)if(!n[l](a[l],c[l]))return!1;if(i.length>0){for(;l<u-s;l++)if(!r(a[l],c[l]))return!1;for(let d=0;d<s;d++)if(!o[d](a[l+d],c[l+d]))return!1}return!0})}case"Objects":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return ii;const n=e.propertySignatures.map(r=>Rw(r.type)),i=e.indexSignatures.map(r=>Rw(r.type));return yp((r,o)=>{if(!hd(r)||!hd(o))return!1;for(let s=0;s<n.length;s++){const a=e.propertySignatures[s],c=a.name,u=Object.hasOwn(r,c),l=Object.hasOwn(o,c);if(_d(a.type)&&u!==l||u&&l&&!n[s](r[c],o[c]))return!1}for(let s=0;s<i.length;s++){const a=e.indexSignatures[s],c=DA(r,a.parameter),u=DA(o,a.parameter);if(c.length!==u.length)return!1;for(let l=0;l<c.length;l++){const d=c[l];if(!Object.hasOwn(o,d)||!i[s](r[d],o[d]))return!1}}return!0})}case"Union":{const n=Bu(e).types,i=t0e(n),r=n.map((o,s)=>[L0e(o),Rw(e.types[s])]);return yp((o,s)=>{const a=i(o,!1);for(let c=0;c<a.length;c++){const[u,l]=r[a[c]];if(u(o)&&u(s))return l(o,s)}return!1})}case"Suspend":{let n;return yp((i,r)=>(n??=sye(e.thunk()))(i,r))}}}function $2n(e){const t=e.annotations?.representation;if(t===void 0)return ii;switch(t.id){case"effect/schema/Option":{const[n]=h4(e);return(i,r)=>i._tag===r._tag&&(i._tag==="None"||n(i.value,r.value))}case"effect/schema/Result":{const[n,i]=h4(e);return(r,o)=>r._tag===o._tag&&(r._tag==="Success"?n(r.success,o.success):i(r.failure,o.failure))}case"effect/schema/CauseReason":{const[n,i]=h4(e);return Yut(n,i)}case"effect/schema/Cause":{const[n,i]=h4(e);return Zut(n,i)}case"effect/schema/Exit":{const[n,i,r]=h4(e),o=Zut(i,r);return(s,a)=>s._tag===a._tag&&(s._tag==="Success"?n(s.value,a.value):o(s.cause,a.cause))}case"effect/schema/ReadonlyMap":{const[n,i]=h4(e);return FGe(n,i)}case"effect/schema/ReadonlySet":return Ale(h4(e)[0]);case"effect/schema/RegExp":return(n,i)=>n.source===i.source&&n.flags===i.flags;case"effect/schema/URL":return(n,i)=>n.toString()===i.toString();default:return ii}}function h4(e){return e.typeParameters.map(Rw)}function Yut(e,t){return(n,i)=>{if(n._tag!==i._tag)return!1;switch(n._tag){case"Fail":return e(n.error,i.error);case"Die":return t(n.defect,i.defect);case"Interrupt":return n.fiberId===i.fiberId}}}function Zut(e,t){const n=Cle(Yut(e,t));return(i,r)=>n(i.reasons,r.reasons)}var sye,U2n=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/toEquivalence.js"(){Zo(),ff(),Nn(),Yn(),$p(),jv(),Sw(),sye=C5(e=>Rw(e))}});function elt(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 tlt(e,t){const n=elt(e,t);return i=>`Cause([${i.reasons.map(n).join(", ")}])`}function F2n(e,t){const n=new Map;return i(e);function i(s){let a=n.get(s);return a===void 0&&(a=r(s),n.set(s,a)),a}function r(s){const a=g8(s)?.toFormatter;if(typeof a=="function")return a(C8(s)?s.typeParameters.map(i):[]);if(t?.onBefore){const c=t.onBefore(s,i);if(c!==void 0)return c}return o(s)}function o(s){switch(s._tag){default:return Qt;case"Never":return()=>"never";case"Void":return()=>"void";case"Declaration":{const a=s.annotations?.representation;if(a===void 0)return Qt;const c=s.typeParameters.map(i);switch(a.id){case"effect/schema/Option":{const[u]=c;return Oa({onNone:()=>"none()",onSome:l=>`some(${u(l)})`})}case"effect/schema/Result":{const[u,l]=c;return kv({onSuccess:d=>`success(${u(d)})`,onFailure:d=>`failure(${l(d)})`})}case"effect/schema/CauseReason":return elt(c[0],c[1]);case"effect/schema/Cause":return tlt(c[0],c[1]);case"effect/schema/Exit":{const[u,l,d]=c,p=tlt(l,d);return h=>{switch(h._tag){case"Success":return`Exit.Success(${u(h.value)})`;case"Failure":return`Exit.Failure(${p(h.cause)})`}}}case"effect/schema/ReadonlyMap":{const[u,l]=c;return d=>{const p=d.size;if(p===0)return"ReadonlyMap(0) {}";const h=globalThis.Array.from(d.entries()).sort().map(([m,f])=>`${u(m)} => ${l(f)}`);return`ReadonlyMap(${p}) { ${h.join(", ")} }`}}case"effect/schema/HashMap":{const[u,l]=c;return d=>{const p=ust(d);if(p===0)return"HashMap(0) {}";const h=wz(d).sort().map(([m,f])=>`${u(m)} => ${l(f)}`);return`HashMap(${p}) { ${h.join(", ")} }`}}case"effect/schema/ReadonlySet":{const[u]=c;return l=>{const d=l.size;if(d===0)return"ReadonlySet(0) {}";const p=globalThis.Array.from(l.values()).sort().map(h=>`${u(h)}`);return`ReadonlySet(${d}) { ${p.join(", ")} }`}}case"effect/schema/HashSet":{const[u]=c;return l=>{const d=yst(l);if(d===0)return"HashSet(0) {}";const p=globalThis.Array.from(l).sort().map(h=>`${u(h)}`);return`HashSet(${d}) { ${p.join(", ")} }`}}case"effect/schema/Chunk":{const[u]=c;return l=>{const d=Trt(l);if(d===0)return"Chunk(0) {}";const p=globalThis.Array.from(l).sort().map(h=>`${u(h)}`);return`Chunk(${d}) { ${p.join(", ")} }`}}default:return Qt}}case"Arrays":{const a=s.elements.map(p=>i(p)),c=s.rest.map(i),[u,...l]=c,d=l.length;return p=>{const h=[];let m=0;for(;m<a.length;m++)if(p.length<m+1){if(_d(s.elements[m]))continue}else h.push(a[m](p[m]));if(c.length>0){for(;m<p.length-d;m++)h.push(u(p[m]));for(let f=0;f<d;f++)h.push(l[f](p[m+f]))}return"["+h.join(", ")+"]"}}case"Objects":{const a=s.propertySignatures.map(u=>i(u.type)),c=s.indexSignatures.map(u=>i(u.type));return s.propertySignatures.length===0&&s.indexSignatures.length===0?Qt:u=>{const l=[],d=new Set;for(let p=0;p<a.length;p++){const h=s.propertySignatures[p],m=h.name;d.add(m),!(_d(h.type)&&!Object.hasOwn(u,m))&&l.push(`${v2(m)}: ${a[p](u[m])}`)}for(let p=0;p<c.length;p++){const h=DA(u,s.indexSignatures[p].parameter);for(const m of h)d.has(m)||(d.add(m),l.push(`${v2(m)}: ${c[p](u[m])}`))}return l.length>0?"{ "+l.join(", ")+" }":"{}"}}case"Union":{const a=Bu(s).types,c=t0e(a),u=a.map((l,d)=>[L0e(l),i(s.types[d])]);return l=>{const d=c(l,!1);for(let p=0;p<d.length;p++){const[h,m]=u[d[p]];if(h(l))return m(l)}return Qt(l)}}case"Suspend":{let a;return c=>(a??=i(s.thunk()))(c)}}}}var B2n=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/toFormatter.js"(){Ffe(),ma(),pge(),fge(),ri(),ki(),$p(),jv(),Sw()}});function nlt(e,t){return e.some(n=>n===t||typeof n=="number"&&String(n)===t)}function _q(e,t){const n={};for(const i of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,i))continue;const r=t(i,e[i]);if(r){const[o,s]=r;dn(n,o,s)}}return n}var aye,cye,uye,lye,va,m4,F8=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Struct.js"(){Nn(),qa(),aye=me(2,(e,t)=>_q(e,(n,i)=>nlt(t,n)?[n,i]:void 0)),cye=me(2,(e,t)=>_q(e,(n,i)=>nlt(t,n)?void 0:[n,i])),uye=me(2,(e,t)=>({...e,...t})),lye=me(2,(e,t)=>_q(e,(n,i)=>[Object.hasOwn(t,n)?t[n]:n,i])),va=e=>e,m4=me(2,(e,t)=>_q(e,(n,i)=>[n,t(i)]))}});function j2n(e,t){return Uf(qA("Iso",e,t))}function ilt(e,t){return Uf(qA("Lens",e,t))}function qA(e,t,n){return[{_tag:"PrimitiveNode",kind:e,get:t,set:n}]}function f4(e,t){if(e.length===0)return t;if(t.length===0)return e;const n=e.slice();for(let i=0;i<t.length;i++){const r=t[i],o=n[n.length-1];o._tag==="PathNode"&&r._tag==="PathNode"?n[n.length-1]=new hye([...o.path,...r.path]):o._tag==="CheckNode"&&r._tag==="CheckNode"?n[n.length-1]=new bq([...o.checks,...r.checks]):n.push(r)}return n}function W2n(e,t){return Uf(qA("Optional",e,t))}function Uf(e){let t=e[0]??olt;if(e.length>1){const n=e.reduce((i,r)=>H2n(i,r.kind),"Iso");t={kind:n,get:z2n(e,n),set:q2n(e,n)}}switch(t.kind){case"Iso":return new slt(e,t.get,t.set);case"Lens":return new alt(e,t.get,t.set);case"Prism":return new clt(e,t.get,t.set);case"Optional":return new B8(e,t.get,t.set)}}function wq(e){if(Array.isArray(e))return e.slice();if(typeof e=="object"&&e!==null){const t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)throw new Error("Cannot clone object with non-Object constructor or null prototype");return{...e}}return e}function z2n(e,t){return n=>{for(let i=0;i<e.length;i++){const r=e[i],o=r.get(n);if(dye(r.kind)){if(kn(o))return o;n=o.success}else n=o}return dye(t)?oi(n):n}}function q2n(e,t){return rlt(t)?n=>{for(let i=e.length-1;i>=0;i--)n=e[i].set(n);return n}:(n,i)=>{const r=e.length,o=new Array(r);for(let s=0;s<r;s++){o[s]=i;const a=e[s];if(dye(a.kind)){const c=a.get(i);if(kn(c))return c;i=c.success}else i=a.get(i)}for(let s=r-1;s>=0;s--){const a=e[s];if(rlt(a.kind))n=a.set(n);else if(a.kind==="Lens")n=a.set(n,o[s]);else{const c=a.set(n,o[s]);if(kn(c))return c;n=c.success}}return t==="Optional"?oi(n):n}}function dye(e){return e==="Prism"||e==="Optional"}function rlt(e){return e==="Iso"||e==="Prism"}function H2n(e,t){return e==="Iso"?t:t==="Iso"||e===t?e:"Optional"}function pye(){return ult}var olt,hye,bq,B8,slt,alt,clt,ult,llt=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Optic.js"(){du(),Nn(),qa(),Yn(),ki(),$p(),Df(),F8(),olt={kind:"Iso",get:an,set:an},hye=class{_tag="PathNode";kind="Lens";path;get;set;constructor(e){this.path=e,this.get=t=>{let n=t;for(let i=0;i<e.length;i++)n=n[e[i]];return n},this.set=(t,n)=>{const i=wq(n);let r=i,o=0;for(;o<e.length-1;o++){const s=e[o];dn(r,s,wq(r[s])),r=r[s]}return dn(r,e[o],t),i}}},bq=class{_tag="CheckNode";kind="Prism";checks;get;set=an;constructor(e){this.checks=e,this.get=t=>Sxn(e,t)}},B8=class{node;getResult;replaceResult;constructor(e,t,n){this.node=e,this.getResult=t,this.replaceResult=n}replace(e,t){return J5(this.replaceResult(e,t),()=>t)}modify(e){return t=>J5(jc(this.getResult(t),n=>this.replaceResult(e(n),t)),()=>t)}compose(e){return Uf(f4(this.node,e.node))}key(e){return Uf(f4(this.node,[new hye([e])]))}optionalKey(e){return Uf(f4(this.node,qA("Lens",t=>t[e],(t,n)=>{const i=wq(n);return t===void 0?Array.isArray(i)&&(typeof e=="number"||typeof e=="string"&&Nde(e))?i.splice(Number(e),1):delete i[e]:dn(i,e,t),i})))}check(...e){return Uf(f4(this.node,[new bq(e)]))}refine(e,t){return Uf(f4(this.node,[new bq([Gat(e,t)])]))}tag(e){const t=hi(new ir({expected:`${JSON.stringify(e)} tag`}));return Uf(f4(this.node,qA("Prism",n=>n._tag===e?oi(n):t,an)))}at(e,...t){const n=hi(new yc([e],new b8(void 0)));return Uf(f4(this.node,qA("Optional",i=>Object.hasOwn(i,e)?oi(i[e]):n,(i,r)=>{if(Object.hasOwn(r,e)){const o=wq(r);return dn(o,e,i),oi(o)}else return n})))}pick(e){return this.compose(ilt(aye(e),(t,n)=>({...cye(n,e),...t})))}omit(e){return this.compose(ilt(cye(e),(t,n)=>({...aye(n,e),...t})))}notUndefined(){return this.refine(g2,{expected:"a value other than `undefined`"})}forEach(e){const t=e(pye());return W2n(n=>Bh(this.getResult(n),i=>{const r=[];for(let o=0;o<i.length;o++){const s=t.getResult(i[o]);yl(s)&&r.push(s.success)}return r}),(n,i)=>jc(this.getResult(i),r=>{const o=[];for(let a=0;a<r.length;a++)yl(t.getResult(r[a]))&&o.push(a);if(n.length!==o.length)return hi(new ir({message:`each: replacement length mismatch: ${n.length} !== ${o.length}`}));const s=r.slice();for(let a=0;a<o.length;a++){const c=o[a],u=t.replaceResult(n[a],r[c]);if(kn(u))return hi(new yc([c],u.failure));s[c]=u.success}return this.replaceResult(s,i)}))}modifyAll(e){return t=>J5(jc(this.getResult(t),n=>this.replaceResult(n.map(e),t)),()=>t)}},slt=class extends B8{get;set;constructor(e,t,n){super(e,i=>oi(t(i)),i=>oi(n(i))),this.get=t,this.set=n}replace(e,t){return this.set(e)}modify(e){return t=>this.set(e(this.get(t)))}},alt=class extends B8{get;constructor(e,t,n){super(e,i=>oi(t(i)),(i,r)=>oi(n(i,r))),this.get=t,this.replace=n}modify(e){return t=>this.replace(e(this.get(t)),t)}},clt=class extends B8{set;constructor(e,t,n){super(e,t,(i,r)=>oi(n(i))),this.set=n}replace(e,t){return this.set(e)}modify(e){return t=>J5(Bh(this.getResult(t),n=>this.set(e(n))),()=>t)}},ult=Uf([])}});function G2n(e){const t=Put(e);return j2n(W0e(t),j0e(t))}function V2n(e){return pye()}function K2n(e){return pye()}var J2n=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schema/toIso.js"(){llt(),jv(),N8()}});function Q2n(e){return Sn(e,HA)&&e[HA]===HA}var HA,X2n=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/internal/schemaError.js"(){Yn(),HA="~effect/Schema/SchemaError"}}),bd,om,sm,O0,xq,g4,xd,Ow,dlt,j8,GA,W8,z8,mye,Sq,plt,hlt,mlt,flt,glt,ylt,vlt,_lt,wlt,blt,xlt,VA,Slt,ua,klt,Elt,Alt,q8,Tlt,kq,Eq,fye,Ilt,Clt,gye,Aq,Rlt,Tq,yye,vye,zv,Iq,_ye,KA,Cq,wye,bye,xye,Sye,Olt,Plt,Mlt,kye,Dlt,Llt,Nlt,$lt,Rq,Ult,Flt,Eye=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/net/NetAddress.js"(){jh(),Zo(),sa(),no(),Yn(),ki(),bd="~effect/net/NetAddress",om=e=>e.value,sm=e=>e,O0=e=>e.bytes,xq=class extends Wo("NetAddressError"){},g4=e=>Sn(e,bd),xd=e=>g4(e)&&e._tag==="Ipv4Address",Ow=e=>g4(e)&&e._tag==="Ipv6Address",dlt=e=>xd(e)||Ow(e),j8=e=>xd(e)?32:128,GA=e=>g4(e)&&e._tag==="MacAddress",W8=e=>g4(e)&&e._tag==="InetAddressV4",z8=e=>g4(e)&&e._tag==="InetAddressV6",mye=e=>W8(e)||z8(e),Sq=e=>g4(e)&&e._tag==="UnixPathAddress",plt=e=>mye(e)||Sq(e),hlt={_tag:"Ipv4Address",[bd]:bd,[Er](e){return xd(e)&&om(this)===om(e)},[kr](){return uu(xi(ylt,om(this)|0))},toString(){return zv(this)},toJSON(){return this.toString()},[Ar](){return this.toJSON()}},mlt={_tag:"Ipv6Address",[bd]:bd,[Er](e){if(!Ow(e))return!1;const t=sm(this),n=sm(e);return t.w0===n.w0&&t.w1===n.w1&&t.w2===n.w2&&t.w3===n.w3},[kr](){const e=sm(this);let t=xi(vlt,e.w0|0);return t=xi(t,e.w1|0),t=xi(t,e.w2|0),uu(xi(t,e.w3|0))},toString(){return zv(this)},toJSON(){return this.toString()},[Ar](){return this.toJSON()}},flt={_tag:"MacAddress",[bd]:bd,[Er](e){return GA(e)&&glt(O0(this),O0(e))},[kr](){return xi(_lt,gp(O0(this)))},toString(){return gye(this)},toJSON(){return this.toString()},[Ar](){return this.toJSON()}},glt=(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},ylt=ps("Ipv4Address"),vlt=ps("Ipv6Address"),_lt=ps("MacAddress"),wlt=e=>{const t=Object.create(hlt);return t.value=e>>>0,Object.freeze(t)},blt=(e,t,n,i)=>{const r=Object.create(mlt);return r.w0=e>>>0,r.w1=t>>>0,r.w2=n>>>0,r.w3=i>>>0,Object.freeze(r)},xlt=(e,t,n,i)=>(e<<24|t<<16|n<<8|i)>>>0,VA=e=>[e>>>24,e>>>16&255,e>>>8&255,e&255],Slt=e=>{const t=Object.assign(Object.create(flt),{bytes:new Uint8Array(e)});return Object.freeze(t)},ua=(e,t)=>hi(new xq({input:e,message:t})),klt=e=>e.every(t=>Number.isInteger(t)&&t>=0&&t<=255)?oi(wlt(xlt(e[0],e[1],e[2],e[3]))):ua(e,"octets must be integers from 0 through 255"),Elt=e=>e.every(t=>Number.isInteger(t)&&t>=0&&t<=65535)?oi(blt(e[0]*65536+e[1],e[2]*65536+e[3],e[4]*65536+e[5],e[6]*65536+e[7])):ua(e,"segments must be integers from 0 through 65535"),Alt=e=>/^(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/.test(e)?oi(Slt(new Uint8Array(e.split(":").map(t=>Number.parseInt(t,16))))):ua(e,"expected six two-digit hexadecimal octets separated by colons"),q8=e=>{const t=e.split(".");if(t.length!==4||t.some(i=>!/^\d{1,3}$/.test(i)))return ua(e,"expected exactly four decimal octets");if(t.some(i=>i.length>1&&i[0]==="0"))return ua(e,"leading zeroes are not allowed");const n=t.map(Number);return n.some(i=>i>255)?ua(e,"octets must be at most 255"):klt([n[0],n[1],n[2],n[3]])},Tlt=e=>{if(e.includes("[")||e.includes("]")||e.includes("%"))return ua(e,"brackets and zone identifiers are not valid in a bare IPv6 address");const t=e.split("::");if(t.length>2)return ua(e,"only one compression marker is allowed");const n=t[0]===""?[]:t[0].split(":"),i=t.length===2&&t[1]!==""?t[1].split(":"):[];if(n.some(l=>l==="")||i.some(l=>l===""))return ua(e,"empty segments are only valid in the compression marker");const r=i.length>0?i[i.length-1]:n.length>0?n[n.length-1]:"";let o;if(r.includes(".")){if(t.length===2&&i.length===0)return ua(e,"embedded IPv4 syntax must be trailing");const l=Bh(q8(r),d=>{const p=om(d);return[p>>>16,p&65535]});if(kn(l))return l;o=l.success,i.length>0?i.pop():n.pop()}const s=n.length+i.length+(o?2:0);if(t.length===1?s!==8:s>=8)return ua(e,t.length===1?"expected eight segments":"compression must replace at least one segment");const a=l=>/^[0-9a-fA-F]{1,4}$/.test(l)?Number.parseInt(l,16):void 0,c=n.map(a),u=i.map(a);return c.some(l=>l===void 0)||u.some(l=>l===void 0)?ua(e,"segments must contain one through four hexadecimal digits"):oi([...c,...Array(8-s).fill(0),...u,...o??[]])},kq=e=>jc(Tlt(e),t=>Elt(t)),Eq=e=>e.includes(":")?kq(e):q8(e),fye=e=>VA(om(e)),Ilt=e=>{const{w0:t,w1:n,w2:i,w3:r}=sm(e);return[t>>>16,t&65535,n>>>16,n&65535,i>>>16,i&65535,r>>>16,r&65535]},Clt=e=>{const{w0:t,w1:n,w2:i,w3:r}=sm(e);return[...VA(t),...VA(n),...VA(i),...VA(r)]},gye=e=>Array.from(O0(e),t=>t.toString(16).padStart(2,"0")).join(":"),Aq=e=>O0(e).every(t=>t===255),Rlt=e=>(O0(e)[0]&1)!==0,Tq=e=>(O0(e)[0]&1)===0,yye=e=>(O0(e)[0]&2)!==0,vye=e=>(O0(e)[0]&2)===0,zv=e=>{if(xd(e))return fye(e).join(".");const t=Ilt(e);if(Olt(e))return`::ffff:${t[6]>>8}.${t[6]&255}.${t[7]>>8}.${t[7]&255}`;let n=-1,i=0,r=-1;for(let a=0;a<=8;a++)a<8&&t[a]===0?r===-1&&(r=a):r!==-1&&(a-r>i&&(n=r,i=a-r),r=-1);if(i<2)return t.map(a=>a.toString(16)).join(":");const o=t.slice(0,n).map(a=>a.toString(16)).join(":"),s=t.slice(n+i).map(a=>a.toString(16)).join(":");return`${o}::${s}`},Iq=e=>{if(xd(e))return om(e)===0;const{w0:t,w1:n,w2:i,w3:r}=sm(e);return t===0&&n===0&&i===0&&r===0},_ye=e=>{if(xd(e))return om(e)>>>24===127;const{w0:t,w1:n,w2:i,w3:r}=sm(e);return t===0&&n===0&&i===0&&r===1},KA=e=>GA(e)?Rlt(e):xd(e)?om(e)>>>28===14:sm(e).w0>>>24===255,Cq=e=>GA(e)?Aq(e):om(e)===4294967295,wye=e=>GA(e)?Tq(e):!KA(e)&&!Iq(e)&&(!xd(e)||!Cq(e)),bye=e=>xd(e)?om(e)>>>16===43518:(sm(e).w0>>>16&65472)===65152,xye=e=>{const t=om(e);return t>>>24===10||(t>>>16&65520)===44048||t>>>16===49320},Sye=e=>(sm(e).w0>>>24&254)===252,Olt=e=>{const{w0:t,w1:n,w2:i}=sm(e);return t===0&&n===0&&i===65535},Plt={_tag:"InetAddressV4",[bd]:bd,[Er](e){return W8(e)&&this.port===e.port&&ii(this.address,e.address)},[kr](){return xi(Vn(this.address),md(this.port))},toString(){return Rq(this)},toJSON(){return this.toString()},[Ar](){return this.toJSON()}},Mlt={_tag:"InetAddressV6",[bd]:bd,[Er](e){return z8(e)&&this.port===e.port&&this.scopeId===e.scopeId&&ii(this.address,e.address)},[kr](){return xi(xi(Vn(this.address),md(this.port)),md(this.scopeId))},toString(){return Rq(this)},toJSON(){return this.toString()},[Ar](){return this.toJSON()}},kye=e=>Number.isInteger(e)&&e>=0&&e<=65535,Dlt=(e,t)=>{if(!kye(t))return ua(e,"port must be an integer from 0 through 65535");const n=Object.create(Plt);return n.address=e,n.port=t,oi(Object.freeze(n))},Llt=(e,t,n)=>{if(!kye(t))return ua(e,"port must be an integer from 0 through 65535");const i=n?.scopeId??0;if(!Number.isInteger(i)||i<0||i>4294967295)return ua(e,"scopeId must be an unsigned 32-bit integer");const r=Object.create(Mlt);return r.address=e,r.port=t,r.scopeId=i,oi(Object.freeze(r))},Nlt=e=>{let t,n,i=0;const r=e.startsWith("[");if(r){const o=e.indexOf("]");if(o<0||e[o+1]!==":"||e.indexOf("]",o+1)!==-1)return ua(e,"expected [IPv6]:port");t=e.slice(1,o),n=e.slice(o+2);const s=t.indexOf("%");if(s!==-1){const a=t.slice(s+1);if(t.indexOf("%",s+1)!==-1||!/^\d+$/.test(a))return ua(e,"scope identifier must be decimal");if(i=Number(a),!Number.isInteger(i)||i>4294967295)return ua(e,"scope identifier must be an unsigned 32-bit integer");t=t.slice(0,s)}}else{const o=e.lastIndexOf(":");if(o<0)return ua(e,"expected host:port or [IPv6]:port");if(e.indexOf(":")!==o)return ua(e,"IPv6 addresses must be bracketed");t=e.slice(0,o),n=e.slice(o+1)}return/^(0|[1-9]\d*)$/.test(n)?jc(Eq(t),o=>r!==Ow(o)?ua(e,"only IPv6 addresses use brackets"):Ow(o)?Llt(o,Number(n),{scopeId:i}):Dlt(o,Number(n))):ua(e,"port must be an unpadded decimal integer")},$lt=e=>zv(e.address)+(z8(e)&&e.scopeId!==0?`%${e.scopeId}`:""),Rq=e=>{const t=$lt(e);return W8(e)?`${t}:${e.port}`:`[${t}]:${e.port}`},Ult={_tag:"UnixPathAddress",[bd]:bd,[Er](e){return Sq(e)&&this.path===e.path},[kr](){return xi(ps("UnixPathAddress"),ps(this.path))},toString(){return this.path},toJSON(){return this.toString()},[Ar](){return this.toJSON()}},Flt=e=>{const t=Object.create(Ult);return t.path=e,Object.freeze(t)}}}),Oq,Blt,jlt,H8,Wlt,Pq,G8,Mq,Aye,Tye,Iye,V8,zlt=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/net/IpInterface.js"(){Zo(),sa(),no(),Yn(),ki(),Eye(),Oq="~effect/net/IpInterface",Blt=e=>H8(e)&&xd(e.address),jlt=e=>H8(e)&&Ow(e.address),H8=e=>Sn(e,Oq),Wlt={_tag:"IpInterface",[Oq]:Oq,[Er](e){return H8(e)&&this.prefixLength===e.prefixLength&&ii(this.address,e.address)},[kr](){return xi(Vn(this.address),md(this.prefixLength))},toString(){return V8(this)},toJSON(){return this.toString()},[Ar](){return this.toJSON()}},Pq=(e,t)=>hi(new xq({input:e,message:t})),G8=(e,t)=>{const n=j8(e);if(!Number.isInteger(t)||t<0||t>n)return Pq(e,`prefix length must be an integer from 0 through ${n}`);const i=Object.assign(Object.create(Wlt),{address:e,prefixLength:t});return oi(Object.freeze(i))},Mq=(e,t)=>{const n=e.indexOf("/");if(n===-1&&t?.prefix!=="required")return oi({address:e,prefixLength:void 0});if(n<=0||n!==e.lastIndexOf("/")||n===e.length-1)return Pq(e,"expected an address and prefix length separated by one slash");const i=e.slice(n+1);return/^(0|[1-9][0-9]*)$/.test(i)?oi({address:e.slice(0,n),prefixLength:Number(i)}):Pq(e,"prefix length must be an unpadded ASCII decimal integer")},Aye=(e,t)=>jc(Mq(e,t),n=>jc(q8(n.address),i=>G8(i,n.prefixLength??j8(i)))),Tye=(e,t)=>jc(Mq(e,t),n=>jc(kq(n.address),i=>G8(i,n.prefixLength??j8(i)))),Iye=(e,t)=>jc(Mq(e,t),n=>jc(Eq(n.address),i=>G8(i,n.prefixLength??j8(i)))),V8=e=>`${zv(e.address)}/${e.prefixLength}`}}),Dq,qlt,Hlt,K8,Glt,Vlt,Klt,Jlt,Lq,Qlt,Xlt,Ylt,J8,Y2n=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/net/IpNetwork.js"(){Zo(),sa(),no(),Yn(),ki(),zlt(),Eye(),Dq="~effect/net/IpNetwork",qlt=e=>K8(e)&&xd(e.address),Hlt=e=>K8(e)&&Ow(e.address),K8=e=>Sn(e,Dq),Glt={_tag:"IpNetwork",[Dq]:Dq,[Er](e){return K8(e)&&this.prefixLength===e.prefixLength&&ii(this.address,e.address)},[kr](){return xi(Vn(this.address),md(this.prefixLength))},toString(){return J8(this)},toJSON(){return this.toString()},[Ar](){return this.toJSON()}},Vlt=e=>{const t=Object.assign(Object.create(Glt),{address:e.address,prefixLength:e.prefixLength});return Object.freeze(t)},Klt=e=>xd(e)?fye(e):Clt(e),Jlt=(e,t)=>{const n=Math.floor(t/8),i=t%8;return e.map((r,o)=>o<n?r:o===n&&i!==0?r&(255<<8-i&255):0)},Lq=(e,t)=>jc(G8(e,t),n=>{const i=Klt(e),r=Jlt(i,t);return i.some((o,s)=>o!==r[s])?hi(new xq({input:e,message:"address has non-zero host bits"})):oi(Vlt(n))}),Qlt=e=>jc(Aye(e,{prefix:"required"}),t=>Lq(t.address,t.prefixLength)),Xlt=e=>jc(Tye(e,{prefix:"required"}),t=>Lq(t.address,t.prefixLength)),Ylt=e=>jc(Iye(e,{prefix:"required"}),t=>Lq(t.address,t.prefixLength)),J8=e=>`${zv(e.address)}/${e.prefixLength}`}}),$i={};bi($i,{Any:()=>Kdt,Array:()=>ut,ArrayEnsure:()=>f4n,BigDecimal:()=>yve,BigDecimalFromString:()=>Npt,BigInt:()=>qv,BigIntFromString:()=>wpt,Boolean:()=>ai,BooleanFromBit:()=>Tpt,BooleanLiterals:()=>Zdt,ByteSize:()=>l9,ByteSizeFromBigInt:()=>Upt,ByteSizeFromNumber:()=>Fpt,ByteSizeFromString:()=>$pt,Cause:()=>Fye,CauseReason:()=>Uye,Char:()=>ppt,Chunk:()=>aSn,Class:()=>zve,Cookie:()=>jve,Cookies:()=>Wve,Date:()=>c9,DateFromMillis:()=>gpt,DateFromString:()=>fpt,DateTimeUtc:()=>d9,DateTimeUtcFromDate:()=>Hpt,DateTimeUtcFromMillis:()=>Vpt,DateTimeUtcFromString:()=>Gpt,DateTimeZoned:()=>Ove,DateTimeZonedFromString:()=>Xpt,Defect:()=>nSn,Duration:()=>h9,DurationFromMillis:()=>jht,DurationFromNanos:()=>Bht,DurationFromString:()=>Fht,Enum:()=>c4n,Error:()=>Gq,ErrorInstance:()=>tSn,Exit:()=>cSn,FalseLiterals:()=>Jye,File:()=>lve,Finite:()=>_4,FiniteFromString:()=>_pt,FormData:()=>dve,Graph:()=>pSn,HashMap:()=>hSn,HashSet:()=>mSn,Headers:()=>zht,InetAddress:()=>Fve,InetAddressFromString:()=>Pht,InetAddressV4:()=>Rht,InetAddressV6:()=>Oht,Int:()=>rt,IpAddress:()=>Lw,IpAddressFromString:()=>b4,IpInterface:()=>Lve,IpInterfaceFromString:()=>Aht,IpLinkLocalAddress:()=>pht,IpLinkLocalAddressFromString:()=>hht,IpLoopbackAddress:()=>lht,IpLoopbackAddressFromString:()=>dht,IpMulticastAddress:()=>Ypt,IpMulticastAddressFromString:()=>Zpt,IpNetwork:()=>Uve,IpNetworkFromString:()=>Cht,IpUnicastAddress:()=>nht,IpUnicastAddressFromString:()=>iht,IpUnspecifiedAddress:()=>mht,IpUnspecifiedAddressFromString:()=>fht,Ipv4Address:()=>p9,Ipv4AddressFromString:()=>Wq,Ipv4BroadcastAddress:()=>sht,Ipv4BroadcastAddressFromString:()=>aht,Ipv4Interface:()=>Mve,Ipv4InterfaceFromString:()=>kht,Ipv4Network:()=>Nve,Ipv4NetworkFromString:()=>Tht,Ipv4PrivateAddress:()=>ght,Ipv4PrivateAddressFromString:()=>yht,Ipv6Address:()=>zq,Ipv6AddressFromString:()=>Pve,Ipv6Interface:()=>Dve,Ipv6InterfaceFromString:()=>Eht,Ipv6Network:()=>$ve,Ipv6NetworkFromString:()=>Iht,Ipv6UniqueLocalAddress:()=>vht,Ipv6UniqueLocalAddressFromString:()=>_ht,Json:()=>Id,JsonFromUrlParamsField:()=>qht,JsonObject:()=>qve,Literal:()=>Ce,Literals:()=>ct,MacAddress:()=>Dw,MacAddressFromString:()=>w4,MacBroadcastAddress:()=>cht,MacBroadcastAddressFromString:()=>uht,MacLocallyAdministeredAddress:()=>wht,MacLocallyAdministeredAddressFromString:()=>bht,MacMulticastAddress:()=>eht,MacMulticastAddressFromString:()=>tht,MacUnicastAddress:()=>rht,MacUnicastAddressFromString:()=>oht,MacUniversallyAdministeredAddress:()=>xht,MacUniversallyAdministeredAddressFromString:()=>Sht,MutableJson:()=>Zht,Natural:()=>Mw,Never:()=>Vdt,NonEmptyArray:()=>a9,NonEmptyString:()=>Td,Null:()=>Ed,NullOr:()=>dt,NullishOr:()=>Vye,Number:()=>on,NumberFromString:()=>u9,ObjectKeyword:()=>Xdt,Opaque:()=>E4n,Option:()=>y4,OptionFromNullOr:()=>fSn,OptionFromNullishOr:()=>ySn,OptionFromOptional:()=>_Sn,OptionFromOptionalKey:()=>vSn,OptionFromOptionalNullOr:()=>wSn,OptionFromUndefinedOr:()=>gSn,PropertyKey:()=>jq,ReadonlyMap:()=>iSn,ReadonlySet:()=>rSn,Record:()=>Vs,RecordFromCookies:()=>Wht,RecordFromUrlParams:()=>Hht,Redacted:()=>Pdt,RedactedFromValue:()=>bSn,RegExp:()=>hpt,Result:()=>xSn,SchemaError:()=>r6,SocketAddress:()=>Dht,StandardSchemaV1FailureResult:()=>Apt,String:()=>te,StringForLiteralAutocomplete:()=>Jdt,StringFromBase64:()=>xpt,StringFromBase64Url:()=>Spt,StringFromHex:()=>kpt,StringFromUriComponent:()=>Ept,Struct:()=>V,StructWithRest:()=>h4n,Symbol:()=>s9,TaggedClass:()=>Vht,TaggedError:()=>Kht,TaggedStruct:()=>Fq,TaggedUnion:()=>k4n,TemplateLiteral:()=>s4n,TemplateLiteralParser:()=>a4n,TimeZone:()=>Cve,TimeZoneFromString:()=>Qpt,TimeZoneNamed:()=>Tve,TimeZoneNamedFromString:()=>Jpt,TimeZoneOffset:()=>Kpt,Tree:()=>DSn,Trim:()=>bpt,Trimmed:()=>hve,TrueLiterals:()=>Kye,Tuple:()=>Ka,TupleWithRest:()=>m4n,URL:()=>cve,URLFromString:()=>mpt,URLSearchParams:()=>pve,Uint8Array:()=>c6,Uint8ArrayFromBase64:()=>Ipt,Uint8ArrayFromBase64Url:()=>Cpt,Uint8ArrayFromHex:()=>Rpt,Undefined:()=>s6,UndefinedOr:()=>a6,Union:()=>At,UniqueArray:()=>g4n,UniqueSymbol:()=>u4n,UnixPathAddress:()=>Bve,UnixPathAddressFromString:()=>Mht,Unknown:()=>Sl,UnknownFromJsonString:()=>vpt,UrlParams:()=>qq,Void:()=>Qdt,annotate:()=>e4n,annotateEncoded:()=>t4n,annotateKey:()=>n4n,asserts:()=>Ldt,brand:()=>Q8,catchDecoding:()=>v4n,catchDecodingWithContext:()=>hdt,catchEncoding:()=>_4n,catchEncodingWithContext:()=>mdt,check:()=>Ze,declare:()=>Rr,declareConstructor:()=>Sd,decode:()=>w4n,decodeEffect:()=>Ndt,decodeExit:()=>$dt,decodeOption:()=>Udt,decodePromise:()=>Fdt,decodeResult:()=>Bq,decodeSync:()=>qye,decodeTo:()=>An,decodeUnknownEffect:()=>kd,decodeUnknownExit:()=>Nq,decodeUnknownOption:()=>zye,decodeUnknownPromise:()=>odt,decodeUnknownResult:()=>It,decodeUnknownSync:()=>it,encode:()=>b4n,encodeEffect:()=>Hye,encodeExit:()=>Bdt,encodeKeys:()=>d4n,encodeOption:()=>Wdt,encodePromise:()=>zdt,encodeResult:()=>o9,encodeSync:()=>fu,encodeTo:()=>X8,encodeUnknownEffect:()=>JA,encodeUnknownExit:()=>Rye,encodeUnknownOption:()=>jdt,encodeUnknownPromise:()=>sdt,encodeUnknownResult:()=>$q,encodeUnknownSync:()=>QA,extendTo:()=>p4n,fieldsAssign:()=>l4n,flip:()=>Oye,fromBrand:()=>y4n,fromFormData:()=>oSn,fromJsonString:()=>ti,fromURLSearchParams:()=>sSn,instanceOf:()=>am,is:()=>Bf,isBase64:()=>Mye,isBase64Url:()=>M4n,isBetween:()=>Ad,isBetweenBigDecimal:()=>Lpt,isBetweenBigInt:()=>dpt,isBetweenCodePoints:()=>V4n,isBetweenDate:()=>apt,isBetweenLength:()=>Lye,isBetweenProperties:()=>Z4n,isBetweenSize:()=>Q4n,isCapitalized:()=>F4n,isEndingWith:()=>L4n,isFinite:()=>tpt,isGUID:()=>O4n,isGreaterThan:()=>Js,isGreaterThanBigDecimal:()=>Opt,isGreaterThanBigInt:()=>cpt,isGreaterThanDate:()=>ipt,isGreaterThanOrEqualTo:()=>Wt,isGreaterThanOrEqualToBigDecimal:()=>Ppt,isGreaterThanOrEqualToBigInt:()=>nve,isGreaterThanOrEqualToDate:()=>rpt,isIncluding:()=>N4n,isInt:()=>Ff,isInt32:()=>z4n,isLessThan:()=>npt,isLessThanBigDecimal:()=>Mpt,isLessThanBigInt:()=>upt,isLessThanDate:()=>opt,isLessThanOrEqualTo:()=>Da,isLessThanOrEqualToBigDecimal:()=>Dpt,isLessThanOrEqualToBigInt:()=>lpt,isLessThanOrEqualToDate:()=>spt,isLowercased:()=>U4n,isMaxCodePoints:()=>G4n,isMaxLength:()=>ft,isMaxProperties:()=>Y4n,isMaxSize:()=>J4n,isMinCodePoints:()=>H4n,isMinLength:()=>rn,isMinProperties:()=>X4n,isMinSize:()=>K4n,isMultipleOf:()=>W4n,isNonEmpty:()=>xdt,isPattern:()=>Ks,isPropertyNames:()=>eSn,isSchema:()=>XA,isSchemaError:()=>Zlt,isStartingWith:()=>D4n,isStringBigInt:()=>I4n,isStringFinite:()=>T4n,isStringSymbol:()=>C4n,isTrimmed:()=>wdt,isULID:()=>P4n,isUUID:()=>R4n,isUint32:()=>q4n,isUncapitalized:()=>B4n,isUnique:()=>$ye,isUniqueKey:()=>Sdt,isUppercased:()=>$4n,link:()=>Nr,linkDecoding:()=>YA,make:()=>pn,makeFilter:()=>vn,makeFilterGroup:()=>A4n,makeIsBetween:()=>i9,makeIsGreaterThan:()=>Z8,makeIsGreaterThanOrEqualTo:()=>e9,makeIsLessThan:()=>t9,makeIsLessThanOrEqualTo:()=>n9,makeIsMultipleOf:()=>j4n,middlewareDecoding:()=>ddt,middlewareEncoding:()=>pdt,mutable:()=>jf,mutableKey:()=>Gye,optional:()=>jt,optionalKey:()=>Ue,overrideToCodecIso:()=>PSn,overrideToEquivalence:()=>TSn,overrideToFormatter:()=>ESn,readonlyKey:()=>Gdt,refine:()=>ldt,required:()=>Hdt,requiredKey:()=>qdt,resolveAnnotations:()=>LSn,resolveAnnotationsKey:()=>NSn,revealBottom:()=>Z2n,revealCodec:()=>i4n,suspend:()=>Pw,tag:()=>_a,tagDefaultOmit:()=>S4n,toCodecArrayFromSingle:()=>Xht,toCodecIso:()=>Jht,toCodecJson:()=>Vq,toCodecStringTree:()=>Qht,toDifferJsonPatch:()=>MSn,toEncoded:()=>v4,toEncoderXml:()=>ISn,toEquivalence:()=>Wye,toFormatter:()=>ASn,toIso:()=>CSn,toIsoFocus:()=>OSn,toIsoSource:()=>RSn,toJsonSchemaDocument:()=>Ddt,toRepresentation:()=>n6,toStandardJSONSchemaV1:()=>rdt,toStandardSchemaV1:()=>r4n,toTaggedUnion:()=>_dt,toType:()=>xl,withArrayLengthConstraints:()=>Uq,withConstructorDefault:()=>fdt,withDecodingDefault:()=>ydt,withDecodingDefaultKey:()=>Y8,withDecodingDefaultType:()=>vdt,withDecodingDefaultTypeKey:()=>x4n});function Sd(){return(e,t,n)=>pn(new $A(e.map(qz),i=>t(i.map(r=>pn(r))),n))}function Rr(e,t){return Sd()([],()=>(n,i,r)=>e(n)?we(n):be(new ga(i,n,r)),t)}function Z2n(e){return e}function e4n(e){return t=>t.annotate(e)}function t4n(e){return t=>Oye(Oye(t).annotate(e))}function n4n(e){return t=>t.rebuild(s0e(t.ast,e))}function i4n(e){return e}function Zlt(e){return Q2n(e)}function edt(e){return Co(e)?Cye(e):$u(e,t=>t8(()=>uA(t,n=>new r6(n))))}function Cye(e){return yr(e)?e:w0(uA(e.cause,t=>new r6(t)))}function tdt(e,t){let n;for(const i of e.reasons){if(!nme(i)||!Zlt(i.error))throw new globalThis.Error(t,{cause:e});n??=i.error}if(n===void 0)throw new globalThis.Error(t,{cause:e});return n}function ndt(e){return Rf(e).then(t=>{if(yr(t))return t.value;throw tdt(t.cause,"Promise adapter can only reject schema errors")})}function idt(e){const t=Of(e);if(yr(t))return t.value;throw tdt(t.cause,"Sync adapter can only throw schema errors")}function r4n(e,t){return S2n(e,t)}function rdt(e){return E2n(e)}function kd(e,t){const n=Ma(e,t);return(i,r)=>edt(n(i,r))}function Nq(e,t){const n=Nxn(e,t);return(i,r)=>Cye(n(i,r))}function It(e,t){const n=$xn(e,t);return(i,r)=>Pde(n(i,r),o=>new r6(o))}function odt(e,t){const n=kd(e,t);return(i,r)=>ndt(n(i,r))}function it(e,t){const n=kd(e,t);return(i,r)=>idt(n(i,r))}function JA(e,t){const n=WA(e,t);return(i,r)=>edt(n(i,r))}function Rye(e,t){const n=Fxn(e,t);return(i,r)=>Cye(n(i,r))}function $q(e,t){const n=Bxn(e,t);return(i,r)=>Pde(n(i,r),o=>new r6(o))}function sdt(e,t){const n=JA(e,t);return(i,r)=>ndt(n(i,r))}function QA(e,t){const n=JA(e,t);return(i,r)=>idt(n(i,r))}function XA(e){return Sn(e,i6)&&e[i6]===i6}function o4n(e){return Sn(e,o6)&&e[o6]===o6}function Oye(e){return o4n(e)?e.schema.rebuild(im(e.ast)):pn(im(e.ast),{[o6]:o6,schema:e})}function Ce(e){const t=pn(new tm(e),{literal:e,transform(n){return t.pipe(An(Ce(n),{decode:Pi(()=>n),encode:Pi(()=>e)}))}});return t}function adt(e){return e.map(t=>XA(t)?t.ast:new tm(t))}function s4n(e){return pn(new m0e(adt(e)),{parts:e})}function a4n(e){return pn(axn(adt(e)),{parts:e})}function c4n(e){return pn(new gct(Object.keys(e).filter(t=>typeof e[e[t]]!="number").map(t=>[t,e[t]])),{enums:e})}function u4n(e){return pn(new yct(e))}function Pye(e,t){return pn(e,{fields:t,mapFields(n,i){const r=n(this.fields);return Pye(Zge(r,i?.unsafePreserveChecks?this.ast.checks:void 0),r)}})}function V(e){return Pye(Zge(e,void 0),e)}function l4n(e){return va(t=>t.mapFields(uye(e)))}function d4n(e){return function(t){const n={},i=Object.create(null),r=Object.create(null),o=new Set;for(const s of Reflect.ownKeys(t.fields)){const a=v4(t.fields[s]),c=Object.hasOwn(e,s),u=c?e[s]:s,l=Ydt(u);if(o.has(l))throw new globalThis.Error(`Duplicate encoded keys: ${v2(u)}`);o.add(l),dn(n,u,a),c&&(i[s]=u,r[u]=s)}return V(n).pipe(An(t,oo({decode:lye(r),encode:lye(i)})))}}function p4n(e,t){return n=>{const i=Dde(n.fields,xl),r=V({...i,...e});return n.pipe(An(r,oo({decode:o=>{const s={...o};for(const a in e){const c=t[a],u=c(o);si(u)&&dn(s,a,u.value)}return s},encode:o=>{const s={...o};for(const a in e)delete s[a];return s}})))}}function Vs(e,t){return pn(vxn(e.ast,t.ast),{key:e,value:t})}function h4n(e,t){return pn(lxn(e.ast,t.map(qz)),{schema:e,records:t})}function cdt(e,t){return pn(e,{elements:t,mapElements(n,i){const r=n(this.elements);return cdt(Fat(r,i?.unsafePreserveChecks?this.ast.checks:void 0),r)}})}function Ka(e){return cdt(Fat(e),e)}function m4n(e,t){return pn(dxn(e.ast,t.map(qz)),{schema:e,rest:t})}function Uq(e,t,n){return t!==void 0&&n!==void 0?e.check(Lye(t,n)):t!==void 0?e.check(rn(t)):n!==void 0?e.check(ft(n)):e}function f4n(e){const t=ut(e),n=ut(xl(e)),i=An(Ka([Sl]),oo({decode:r=>[r],encode:([r])=>r}))(e);return pn(At([i,t]).pipe(An(n)).ast,{from:At([e,t]),to:n})}function g4n(e){return ut(e).check($ye())}function udt(e,t){return pn(e,{members:t,mapMembers(n,i){const r=n(this.members);return udt(e0e(r,this.ast.options,i?.unsafePreserveChecks?this.ast.checks:void 0),r)}})}function At(e,t){return udt(e0e(e,t,void 0),e)}function ct(e){const t=e.map(Ce);return pn(e0e(t,void 0,void 0),{literals:e,members:t,mapMembers(n){return At(n(this.members))},pick(n){return ct(n)},transform(n){return At(t.map((i,r)=>i.transform(n[r])))}})}function Pw(e){return pn(new x0e(()=>e().ast))}function Ze(...e){return t=>t.check(...e)}function ldt(e,t){return n=>pn(Tw(n.ast,[Gat(e,t)]),{schema:n})}function Q8(e){return t=>pn(t.ast,{schema:t,identifier:e})}function y4n(e,t){return n=>(t.checks?n.check(...t.checks):n).pipe(Q8(e))}function ddt(e){return t=>pn(mxn(t.ast,new jz(e,an)),{schema:t})}function pdt(e){return t=>pn(fxn(t.ast,new jz(an,e)),{schema:t})}function v4n(e){return hdt(e)}function hdt(e){return t=>ddt(tz(e))(t)}function _4n(e){return mdt(e)}function mdt(e){return t=>pdt(tz(e))(t)}function An(e,t){return n=>pn(Gz(n.ast,e.ast,t?Wz(t):Bz()),{from:n,to:e})}function YA(){return(e,t)=>Nr()(e,{decode:t,encode:yat})}function w4n(e){return t=>An(xl(t),e)(t)}function X8(e,t){return n=>t?An(n,t)(e):An(n)(e)}function b4n(e){return t=>An(t,e)(v4(t))}function fdt(e){return t=>pn(gxn(t.ast,e),{schema:t})}function gdt(e){return $u(e,t=>t8(()=>uA(t,n=>n.issue)))}function Y8(e,t){const n=t?.encodingStrategy==="omit"?cat():r4();return i=>Ue(v4(i)).pipe(An(i,{decode:uat(gdt(e)),encode:n}))}function x4n(e,t){return n=>xl(n).pipe(Y8(e,t),X8(Ue(n)))}function ydt(e,t){const n=t?.encodingStrategy==="omit"?cat():r4();return i=>jt(v4(i)).pipe(An(i,{decode:uat(gdt(e)),encode:n}))}function vdt(e,t){return n=>xl(n).pipe(ydt(e,t),X8(jt(n)))}function _a(e){return Ce(e).pipe(fdt(we(e)))}function S4n(e){return _a(e).pipe(Y8(we(e),{encodingStrategy:"omit"}))}function Fq(e,t){return V({_tag:_a(e),...t})}function _dt(e){return t=>{const n={},i=[],r=new Set,o={},s=l=>d=>l.includes(d[e]);return a(t),Object.assign(t,{tag:e,cases:n,discriminants:i,isAnyOf:s,guards:o,match:c,matchOrElse:u});function a(l){const d=l.ast;if(oct(d)&&"members"in l&&globalThis.Array.isArray(l.members)&&l.members.every(XA))return l.members.forEach(a);const p=k8(d);if(p.length>0){const h=p.find(m=>m.key===e)?.literal;if(PGe(h)){const m=typeof h=="number"?globalThis.String(h):h;if(r.has(m))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(h)}`);r.add(m),i.push(h),dn(n,h,l),dn(o,h,eut(xl(l)));return}}throw new globalThis.Error("No literal or unique symbol found")}function c(){if(arguments.length===1){const m=arguments[0];return function(f){const g=f[e];return(Object.hasOwn(m,g)?m[g]:void 0)(f)}}const l=arguments[0],d=arguments[1],p=l[e];return(Object.hasOwn(d,p)?d[p]:void 0)(l)}function u(){if(arguments.length===2){const f=arguments[0],g=arguments[1];return function(y){const v=y[e];return(Object.hasOwn(f,v)?f[v]??g:g)(y)}}const l=arguments[0],d=arguments[1],p=arguments[2],h=l[e];return(Object.hasOwn(d,h)?d[h]??p:p)(l)}}}function k4n(e){const t={},n=[];for(const u of Object.keys(e)){const l=Fq(u,e[u]);dn(t,u,l),n.push(l)}const i=At(n),{tag:r,guards:o,isAnyOf:s,match:a,matchOrElse:c}=_dt("_tag")(i);return pn(i.ast,{tag:r,cases:t,isAnyOf:s,guards:o,match:a,matchOrElse:c})}function E4n(){return e=>e}function am(e,t){return Rr(n=>n instanceof e,t)}function Nr(){return(e,t)=>new ca(e.ast,Wz(t))}function A4n(e,t=void 0){return new u4(e,t)}function wdt(e){const t=new globalThis.RegExp(Qye);return vn(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()"}),arbitraryConstraint:{patterns:[{source:Qye,flags:""}]},...e})}function Ks(e,t){const n=e.source,i=e.flags,r=/^[dg]*uy?$/.test(i),o=i===""?`new RegExp(${Qt(n)})`:`new RegExp(${Qt(n)}, ${Qt(i)})`;return Hz(e,{toJsonSchema:()=>r?{pattern:i.endsWith("y")?`^(?:${n})`:n}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${o})`}),...t})}function T4n(e){return Zat({toCode:()=>({runtime:"Schema.isStringFinite()"}),...e})}function I4n(e){return ect({toCode:()=>({runtime:"Schema.isStringBigInt()"}),...e})}function C4n(e){return tct({toCode:()=>({runtime:"Schema.isStringSymbol()"}),...e})}function R4n(e,t){const n=ept(e);return Ks(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 O4n(e){return Ks(Xye,{expected:"a GUID",representation:{id:"effect/schema/isGUID",payload:null},toJsonSchema:()=>({pattern:Xye.source}),toCode:()=>({runtime:"Schema.isGUID()"}),...e})}function P4n(e){const t=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;return Ks(t,{representation:{id:"effect/schema/isULID",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isULID()"}),...e})}function Mye(e){const t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return Ks(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}function M4n(e){const t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;return Ks(t,{expected:"a base64url encoded string",representation:{id:"effect/schema/isBase64Url",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64Url()"}),...e})}function Dye(e,t,n){if(e.length===0)return t.length===0?{}:[{},!0];const i={pattern:new globalThis.RegExp(n).source};return e===t?i:[i,!0]}function D4n(e,t){const n=JSON.stringify(e),i=new globalThis.RegExp(`^${Cw(e)}`),r=e.replace(/[\uD800-\uDBFF]$/,"");return vn(o=>o.startsWith(e),{expected:`a string starting with ${n}`,representation:{id:"effect/schema/isStartingWith",payload:{startsWith:e}},toJsonSchema:()=>Dye(r,e,`^${Cw(r)}`),toCode:()=>({runtime:`Schema.isStartingWith(${Qt(e)})`}),arbitraryConstraint:{patterns:[{source:i.source,flags:i.flags}]},...t})}function L4n(e,t){const n=JSON.stringify(e),i=new globalThis.RegExp(`${Cw(e)}$`),r=e.replace(/^[\uDC00-\uDFFF]/,"");return vn(o=>o.endsWith(e),{expected:`a string ending with ${n}`,representation:{id:"effect/schema/isEndingWith",payload:{endsWith:e}},toJsonSchema:()=>Dye(r,e,`${Cw(r)}$`),toCode:()=>({runtime:`Schema.isEndingWith(${Qt(e)})`}),arbitraryConstraint:{patterns:[{source:i.source,flags:i.flags}]},...t})}function N4n(e,t){const n=JSON.stringify(e),i=new globalThis.RegExp(Cw(e)),r=e.replace(/^[\uDC00-\uDFFF]|[\uD800-\uDBFF]$/g,"");return vn(o=>o.includes(e),{expected:`a string including ${n}`,representation:{id:"effect/schema/isIncluding",payload:{includes:e}},toJsonSchema:()=>Dye(r,e,Cw(r)),toCode:()=>({runtime:`Schema.isIncluding(${Qt(e)})`}),arbitraryConstraint:{patterns:[{source:i.source,flags:i.flags}]},...t})}function $4n(e){const t=new globalThis.RegExp(Yye);return vn(n=>n.toUpperCase()===n,{expected:"a string with all characters in uppercase",representation:{id:"effect/schema/isUppercased",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isUppercased()"}),arbitraryConstraint:{patterns:[{source:Yye,flags:""}]},...e})}function U4n(e){const t=new globalThis.RegExp(Zye);return vn(n=>n.toLowerCase()===n,{expected:"a string with all characters in lowercase",representation:{id:"effect/schema/isLowercased",payload:null},toJsonSchema:()=>[{pattern:t.source},!0],toCode:()=>({runtime:"Schema.isLowercased()"}),arbitraryConstraint:{patterns:[{source:Zye,flags:""}]},...e})}function F4n(e){const t=new globalThis.RegExp(eve);return vn(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},!0],toCode:()=>({runtime:"Schema.isCapitalized()"}),arbitraryConstraint:{patterns:[{source:eve,flags:""}]},...e})}function B4n(e){const t=new globalThis.RegExp(tve);return vn(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},!0],toCode:()=>({runtime:"Schema.isUncapitalized()"}),arbitraryConstraint:{patterns:[{source:tve,flags:""}]},...e})}function Z8(e){const t=q5(e.order),n=e.formatter??Qt;return(i,r)=>vn(o=>t(o,i),{expected:`a value greater than ${n(i)}`,arbitraryConstraint:{order:e.order,minimum:i,exclusiveMinimum:!0},...e.annotate?.(i),...r})}function e9(e){const t=dj(e.order),n=e.formatter??Qt;return(i,r)=>vn(o=>t(o,i),{expected:`a value greater than or equal to ${n(i)}`,arbitraryConstraint:{order:e.order,minimum:i},...e.annotate?.(i),...r})}function t9(e){const t=u7(e.order),n=e.formatter??Qt;return(i,r)=>vn(o=>t(o,i),{expected:`a value less than ${n(i)}`,arbitraryConstraint:{order:e.order,maximum:i,exclusiveMaximum:!0},...e.annotate?.(i),...r})}function n9(e){const t=lj(e.order),n=e.formatter??Qt;return(i,r)=>vn(o=>t(o,i),{expected:`a value less than or equal to ${n(i)}`,arbitraryConstraint:{order:e.order,maximum:i},...e.annotate?.(i),...r})}function i9(e){const t=dj(e.order),n=q5(e.order),i=lj(e.order),r=u7(e.order),o=e.formatter??Qt;return(s,a)=>{const c=s.exclusiveMinimum?n:t,u=s.exclusiveMaximum?r:i;return vn(l=>c(l,s.minimum)&&u(l,s.maximum),{expected:`a value between ${o(s.minimum)}${s.exclusiveMinimum?" (excluded)":""} and ${o(s.maximum)}${s.exclusiveMaximum?" (excluded)":""}`,arbitraryConstraint:{order:e.order,minimum:s.minimum,maximum:s.maximum,...s.exclusiveMinimum&&{exclusiveMinimum:!0},...s.exclusiveMaximum&&{exclusiveMaximum:!0}},...e.annotate?.(s),...a})}}function j4n(e){return(t,n)=>{const i=e.formatter??Qt;return vn(r=>e.remainder(r,t)===e.zero,{expected:`a value that is a multiple of ${i(t)}`,...e.annotate?.(t),...n})}}function ZA(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${Qt(e)}`);return e}function W4n(e,t){if(!globalThis.Number.isFinite(e)||e===0)throw new globalThis.RangeError(`Expected a finite non-zero number, got ${globalThis.String(e)}`);return e=globalThis.Math.abs(e),vn(n=>Met(n,e)===0,{expected:`a value that is a multiple of ${e}`,representation:{id:"effect/schema/isMultipleOf",payload:{divisor:e}},toJsonSchema:()=>({multipleOf:e}),toCode:()=>({runtime:`Schema.isMultipleOf(${Qt(e)})`}),...t})}function Ff(e){return vn(t=>globalThis.Number.isSafeInteger(t),{expected:"an integer",representation:{id:"effect/schema/isInt",payload:null},toJsonSchema:()=>[{type:"integer"},!0],toCode:()=>({runtime:"Schema.isInt()"}),arbitraryConstraint:{number:"integer"},...e})}function z4n(e){return new u4([Ff(),Ad({minimum:-2147483648,maximum:2147483647})],{expected:"a 32-bit integer",...e})}function q4n(e){return new u4([Ff(),Ad({minimum:0,maximum:4294967295})],{expected:"a 32-bit unsigned integer",...e})}function e6(e){if(globalThis.Number.isNaN(e.getTime()))throw new globalThis.RangeError(`Expected a valid Date, got ${Qt(e)}`);return e.toISOString()}function t6(e){return`new Date(${Qt(e.getTime())})`}function rn(e,t){return e=ju(e),bdt(e,Math.ceil(e/2),t)}function bdt(e,t,n){return vn(i=>i.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:"effect/schema/isMinLength",payload:{minLength:e}},toJsonSchema:({type:i})=>i==="string"?e<=1?{minLength:t}:[{minLength:t},!0]:i==="array"?{minItems:e}:i===void 0?[{minLength:t,minItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[Dp]:!0,arbitraryConstraint:{minLength:e},...n})}function xdt(e){return bdt(1,1,e)}function ft(e,t){return e=ju(e),vn(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==="string"?e===0?{maxLength:e}:[{maxLength:e},!0]:n==="array"?{maxItems:e}:n===void 0?[{maxLength:e,maxItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[Dp]:!0,arbitraryConstraint:{maxLength:e},...t})}function Lye(e,t,n){return e=ju(e),t=ju(t),vn(i=>i.length>=e&&i.length<=t,{expected:e===t?`a value with a length of ${e}`:`a value with a length between ${e} and ${t}`,representation:{id:"effect/schema/isBetweenLength",payload:{minimum:e,maximum:t}},toJsonSchema:({type:i})=>i==="string"?t===0||Math.ceil(e/2)>t?{minLength:Math.ceil(e/2),maxLength:t}:[{minLength:Math.ceil(e/2),maxLength:t},!0]:i==="array"?{minItems:e,maxItems:t}:i===void 0?[{minLength:Math.ceil(e/2),maxLength:t,minItems:e,maxItems:t},!0]:[{},!0],toCode:()=>({runtime:`Schema.isBetweenLength(${e}, ${t})`}),[Dp]:!0,arbitraryConstraint:{minLength:e,maxLength:t},...n})}function H4n(e,t){return e=ju(e),vn(n=>Nye(n,e)>=e,{expected:`a string with at least ${e} code points`,representation:{id:"effect/schema/isMinCodePoints",payload:{minCodePoints:e}},toJsonSchema:()=>({minLength:e}),toCode:()=>({runtime:`Schema.isMinCodePoints(${e})`}),arbitraryConstraint:{minCodePoints:e},...t})}function G4n(e,t){return e=ju(e),vn(n=>Nye(n,e+1)<=e,{expected:`a string with at most ${e} code points`,representation:{id:"effect/schema/isMaxCodePoints",payload:{maxCodePoints:e}},toJsonSchema:()=>({maxLength:e}),toCode:()=>({runtime:`Schema.isMaxCodePoints(${e})`}),arbitraryConstraint:{maxCodePoints:e},...t})}function V4n(e,t,n){return e=ju(e),t=ju(t),vn(i=>{const r=Nye(i,t+1);return r>=e&&r<=t},{expected:e===t?`a string with ${e} code points`:`a string with between ${e} and ${t} code points`,representation:{id:"effect/schema/isBetweenCodePoints",payload:{minimum:e,maximum:t}},toJsonSchema:()=>({allOf:[{minLength:e},{maxLength:t}]}),toCode:()=>({runtime:`Schema.isBetweenCodePoints(${e}, ${t})`}),arbitraryConstraint:{minCodePoints:e,maxCodePoints:t},...n})}function Nye(e,t){if(t===0)return 0;let n=0;for(const i of e)if(++n>=t)break;return n}function ju(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}function K4n(e,t){return e=ju(e),vn(n=>n.size>=e,{expected:`a value with a size of at least ${e}`,representation:{id:"effect/schema/isMinSize",payload:{minSize:e}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isMinSize(${e})`}),[Dp]:!0,arbitraryConstraint:{minSize:e},...t})}function J4n(e,t){return e=ju(e),vn(n=>n.size<=e,{expected:`a value with a size of at most ${e}`,representation:{id:"effect/schema/isMaxSize",payload:{maxSize:e}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isMaxSize(${e})`}),[Dp]:!0,arbitraryConstraint:{maxSize:e},...t})}function Q4n(e,t,n){return e=ju(e),t=ju(t),vn(i=>i.size>=e&&i.size<=t,{expected:e===t?`a value with a size of ${e}`:`a value with a size between ${e} and ${t}`,representation:{id:"effect/schema/isBetweenSize",payload:{minimum:e,maximum:t}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenSize(${e}, ${t})`}),[Dp]:!0,arbitraryConstraint:{minSize:e,maxSize:t},...n})}function X4n(e,t){return e=ju(e),vn(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:({type:n})=>n==="object"?{minProperties:e}:[{minProperties:e},!0],toCode:()=>({runtime:`Schema.isMinProperties(${e})`}),[Dp]:!0,arbitraryConstraint:{minProperties:e},...t})}function Y4n(e,t){return e=ju(e),vn(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:({type:n})=>n==="object"?{maxProperties:e}:[{maxProperties:e},!0],toCode:()=>({runtime:`Schema.isMaxProperties(${e})`}),[Dp]:!0,arbitraryConstraint:{maxProperties:e},...t})}function Z4n(e,t,n){return e=ju(e),t=ju(t),vn(i=>Reflect.ownKeys(i).length>=e&&Reflect.ownKeys(i).length<=t,{expected:e===t?`a value with exactly ${e===1?"1 entry":`${e} entries`}`:`a value with between ${e} and ${t} entries`,representation:{id:"effect/schema/isBetweenProperties",payload:{minimum:e,maximum:t}},toJsonSchema:({type:i})=>i==="object"?{minProperties:e,maxProperties:t}:[{minProperties:e,maxProperties:t},!0],toCode:()=>({runtime:`Schema.isBetweenProperties(${e}, ${t})`}),[Dp]:!0,arbitraryConstraint:{minProperties:e,maxProperties:t},...n})}function eSn(e,t){const n=v4(e),i=Dxn(n.ast);return vn((r,o,s)=>{const a=Reflect.ownKeys(r),c=[];for(const u of a){const l=i(u,s);if(l!==void 0&&(c.push(new yc([u],l)),s.errors==="first"))break}return wj(c)?new vc(o,c,r,s):!0},{expected:"an object with property names matching the schema",representation:{id:"effect/schema/isPropertyNames",payload:null,schemas:[n.ast]},toJsonSchema:({schemas:r,type:o})=>o==="object"?{propertyNames:r[0]}:[{propertyNames:r[0]},!0],toCode:({schemas:r})=>({runtime:`Schema.isPropertyNames(${r[0].runtime})`}),[Dp]:!0,...t})}function $ye(e){return vn(t=>Fde(t).length===t.length,{expected:"an array with unique items",representation:{id:"effect/schema/isUnique",payload:null},toJsonSchema:()=>({uniqueItems:!0}),toCode:()=>({runtime:"Schema.isUnique()"}),arbitraryConstraint:{uniqueBy:an},...e})}function Sdt(e){return vn(t=>Fde(t.map(([n])=>n)).length===t.length,{expected:"an array with unique keys",representation:{id:"effect/schema/isUniqueKey",payload:null},toCode:()=>({runtime:"Schema.isUniqueKey()"}),arbitraryConstraint:{uniqueBy:t=>t[0]},...e})}function tSn(e){const t=ive(e),n=ove[t];if(n!==void 0)return n;const i=rve(t),r=am(globalThis.Error,{representation:{id:"effect/schema/Error",payload:i??null},toCode:()=>({runtime:i!==void 0?`Schema.ErrorInstance(${Qt(i)})`:"Schema.ErrorInstance()",Type:"globalThis.Error"}),expected:"Error",toCodecJson:()=>Nr()(Yht,Tat(i))});return ove[t]=r,r}function nSn(e){const t=ive(e),n=sve[t];if(n!==void 0)return n;const i=Id.pipe(An(Sl,Iat(rve(t))));return sve[t]=i,i}function iSn(e,t){const n=Sd()([e,t],([i,r])=>{const o=ut(Ka([i,r]));return(s,a,c)=>s instanceof globalThis.Map?hu(Ma(o)([...s],c),{onSuccess:u=>new globalThis.Map(u),onFailure:u=>Np(a,"entries",u,s,c)}):be(new ga(a,s,c))},{representation:{id:"effect/schema/ReadonlyMap",payload:null},toCode:({typeParameters:i})=>({runtime:`Schema.ReadonlyMap(${i[0].runtime}, ${i[1].runtime})`,Type:`globalThis.ReadonlyMap<${i[0].Type}, ${i[1].Type}>`}),expected:"ReadonlyMap",toCodec:([i,r])=>Nr()(ut(Ka([i,r])),oo({decode:o=>new globalThis.Map(o),encode:o=>[...o.entries()]}))});return pn(n.ast,{key:e,value:t})}function rSn(e){const t=Sd()([e],([n])=>{const i=ut(n);return(r,o,s)=>r instanceof globalThis.Set?hu(Ma(i)([...r],s),{onSuccess:a=>new globalThis.Set(a),onFailure:a=>Np(o,"values",a,r,s)}):be(new ga(o,r,s))},{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])=>Nr()(ut(n),oo({decode:i=>new globalThis.Set(i),encode:i=>[...i.values()]}))});return pn(t.ast,{value:e})}function ti(e,t){return ypt.pipe(An(e,sxn(t)))}function oSn(e){return dve.pipe(An(e,Mat))}function sSn(e){return pve.pipe(An(e,Dat))}function Uye(e,t){const n=Sd()([e,t],([i,r])=>(o,s,a)=>{if(!bZe(o))return be(new ga(s,o,a));switch(o._tag){case"Fail":return hu(Ma(i)(o.error,a),{onSuccess:rme,onFailure:c=>Np(s,"error",c,o,a)});case"Die":return hu(Ma(r)(o.defect,a),{onSuccess:ome,onFailure:c=>Np(s,"defect",c,o,a)});case"Interrupt":return we(o)}},{representation:{id:"effect/schema/CauseReason",payload:null},toCode:({typeParameters:i})=>({runtime:`Schema.CauseReason(${i[0].runtime}, ${i[1].runtime})`,Type:`Cause.Failure<${i[0].Type}, ${i[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause.Failure",toCodec:([i,r])=>Nr()(At([V({_tag:Ce("Fail"),error:i}),V({_tag:Ce("Die"),defect:r}),V({_tag:Ce("Interrupt"),fiberId:a6(_4)})]),oo({decode:o=>{switch(o._tag){case"Fail":return rme(o.error);case"Die":return ome(o.defect);case"Interrupt":return xZe(o.fiberId)}},encode:o=>{switch(o._tag){case"Fail":return{_tag:"Fail",error:o.error};case"Die":return{_tag:"Die",defect:o.defect};case"Interrupt":return{_tag:"Interrupt",fiberId:o.fiberId}}}}))});return pn(n.ast,{error:e,defect:t})}function Fye(e,t){const n=Sd()([e,t],([i,r])=>{const o=ut(Uye(i,r));return(s,a,c)=>wZe(s)?hu(Ma(o)(s.reasons,c),{onSuccess:fW,onFailure:u=>Np(a,"failures",u,s,c)}):be(new ga(a,s,c))},{representation:{id:"effect/schema/Cause",payload:null},toCode:({typeParameters:i})=>({runtime:`Schema.Cause(${i[0].runtime}, ${i[1].runtime})`,Type:`Cause.Cause<${i[0].Type}, ${i[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause",toCodec:([i,r])=>Nr()(ut(Uye(i,r)),oo({decode:fW,encode:({reasons:o})=>o}))});return pn(n.ast,{error:e,defect:t})}function kdt(e){return Nr()(e,oo({decode:Ufe,encode:Is}))}function aSn(e){const t=Sd()([e],([n])=>{const i=ut(n);return(r,o,s)=>uz(r)?hu(Ma(i)(Is(r),s),{onSuccess:Ufe,onFailure:a=>Np(o,"values",a,r,s)}):be(new ga(o,r,s))},{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])=>kdt(ut(n)),toCodecArbitrary:({constraint:n,typeParameters:[i]})=>kdt(Uq(ut(i),n?.minLength,n?.maxLength)),toEquivalence:([n])=>$fe(n)});return pn(t.ast,{value:e})}function Edt(){return vd((e,t)=>Oa(pz(e),{onNone:()=>be(new ir({message:"Invalid DateTime input"},e,t)),onSome:n=>we(hz(n))}))}function Adt(e,t,n){const i=Math.max(t,e?.minimum===void 0?t:e.minimum.epochMilliseconds+(e.exclusiveMinimum===!0?1:0)),r=Math.min(n,e?.maximum===void 0?n:e.maximum.epochMilliseconds-(e.exclusiveMaximum===!0?1:0));return i<=r?[i,r]:[t,n]}function Bye(e,t){return rt.check(Ad({minimum:e,maximum:t}))}function Tdt(){return At([Bye(zpt,qpt),ct(Eve)])}function cSn(e,t,n){const i=Sd()([e,t,n],([r,o,s])=>{const a=Fye(o,s);return(c,u,l)=>{if(!tZe(c))return be(new ga(u,c,l));switch(c._tag){case"Success":return hu(Ma(r)(c.value,l),{onSuccess:fw,onFailure:d=>Np(u,"value",d,c,l)});case"Failure":return hu(Ma(a)(c.cause,l),{onSuccess:w0,onFailure:d=>Np(u,"cause",d,c,l)})}}},{representation:{id:"effect/schema/Exit",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Exit(${r[0].runtime}, ${r[1].runtime}, ${r[2].runtime})`,Type:`Exit.Exit<${r[0].Type}, ${r[1].Type}, ${r[2].Type}>`,importDeclarations:['import * as Exit from "effect/Exit"']}),expected:"Exit",toCodec:([r,o,s])=>Nr()(At([V({_tag:Ce("Success"),value:r}),V({_tag:Ce("Failure"),cause:Fye(o,s)})]),oo({decode:a=>a._tag==="Success"?fw(a.value):w0(a.cause),encode:a=>yr(a)?{_tag:"Success",value:a.value}:{_tag:"Failure",cause:a.cause}}))});return pn(i.ast,{value:e,error:t,defect:n})}function Idt(e,t,n){return V({type:Ce(e),nodes:ut(V({index:Mw,data:t})),edges:ut(V({index:Mw,source:Mw,target:Mw,data:n}))})}function Cdt(e,t){let n=-1;const i=new Set;for(let r=0;r<e.nodes.length;r++){const o=e.nodes[r].index;if(o<=n)return be(new yc(["nodes",r,"index"],new ir({expected:"a strictly increasing node index"},o,t)));n=o,i.add(o)}n=-1;for(let r=0;r<e.edges.length;r++){const o=e.edges[r];if(o.index<=n)return be(new yc(["edges",r,"index"],new ir({expected:"a strictly increasing edge index"},o.index,t)));if(n=o.index,!i.has(o.source))return be(new yc(["edges",r,"source"],new ir({expected:"an encoded node index"},o.source,t)));if(!i.has(o.target))return be(new yc(["edges",r,"target"],new ir({expected:"an encoded node index"},o.target,t)))}return we(Rz(e))}function uSn(e,t,n){return!kge(e)||e.mutable||e.type!==t?be(new ir({expected:`an immutable ${t} Graph`},e,n)):we(f8(e))}function lSn(e,t){return(n,i)=>{const r=f8(n),o=f8(i);if(r.type!==o.type||r.nodes.length!==o.nodes.length||r.edges.length!==o.edges.length)return!1;for(let s=0;s<r.nodes.length;s++)if(r.nodes[s].index!==o.nodes[s].index||!e(r.nodes[s].data,o.nodes[s].data))return!1;for(let s=0;s<r.edges.length;s++){const a=r.edges[s],c=o.edges[s],u=r.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 dSn(e,t,n){return YA()(At([Ed,V({nodes:a9(t),edges:ut(Ka([Mw,Mw,n]))})]),Pi(i=>{if(i===null)return Rz({type:e,nodes:[],edges:[]});const r=i.nodes.map((o,s)=>({index:s,data:o}));return Rz({type:e,nodes:r,edges:i.edges.map(([o,s,a],c)=>({index:c,source:o%r.length,target:s%r.length,data:a}))})}))}function pSn(e,t,n){const i=Sd()([t,n],([r,o])=>{const s=Idt(e,r,o);return(a,c,u)=>!kge(a)||a.mutable||a.type!==e?be(new ga(c,a,u)):De(Ma(s)(f8(a),u),l=>Cdt(l,u))},{representation:{id:"effect/schema/Graph",payload:e},toCode:({typeParameters:r})=>({runtime:`Schema.Graph(${Qt(e)}, ${r[0].runtime}, ${r[1].runtime})`,Type:`Graph.Graph<${r[0].Type}, ${r[1].Type}, ${Qt(e)}>`,importDeclarations:['import * as Graph from "effect/Graph"']}),expected:`an immutable ${e} Graph`,toCodec:([r,o])=>Nr()(Idt(e,r,o),mu({decode:Cdt,encode:(s,a)=>uSn(s,e,a)})),toCodecArbitrary:({typeParameters:[r,o]})=>dSn(e,r,o),toEquivalence:([r,o])=>lSn(r,o)});return pn(i.ast,{type:e,node:t,edge:n})}function Rdt(e){return Nr()(e,oo({decode:dge,encode:wz}))}function hSn(e,t){const n=Sd()([e,t],([i,r])=>{const o=ut(Ka([i,r]));return(s,a,c)=>ast(s)?hu(Ma(o)(wz(s),c),{onSuccess:dge,onFailure:u=>Np(a,"entries",u,s,c)}):be(new ga(a,s,c))},{representation:{id:"effect/schema/HashMap",payload:null},toCode:({typeParameters:i})=>({runtime:`Schema.HashMap(${i[0].runtime}, ${i[1].runtime})`,Type:`HashMap.HashMap<${i[0].Type}, ${i[1].Type}>`,importDeclarations:['import * as HashMap from "effect/HashMap"']}),expected:"HashMap",toCodec:([i,r])=>Rdt(ut(Ka([i,r]))),toCodecArbitrary:({constraint:i,typeParameters:[r,o]})=>Rdt(Uq(ut(Ka([r,o])).check(Sdt()),i?.minSize,i?.maxSize)),toEquivalence:([i,r])=>FGe(i,r)});return pn(n.ast,{key:e,value:t})}function Odt(e){return Nr()(e,oo({decode:mge,encode:Is}))}function mSn(e){const t=Sd()([e],([n])=>{const i=ut(n);return(r,o,s)=>gst(r)?hu(Ma(i)(Is(r),s),{onSuccess:mge,onFailure:a=>Np(o,"values",a,r,s)}):be(new ga(o,r,s))},{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])=>Odt(ut(n)),toCodecArbitrary:({constraint:n,typeParameters:[i]})=>Odt(Uq(ut(i).check($ye()),n?.minSize,n?.maxSize)),toEquivalence:([n])=>Ale(n)});return pn(t.ast,{value:e})}function y4(e){const t=Sd()([e],([n])=>(i,r,o)=>h0(i)?Bn(i)?Zme:hu(Ma(n)(i.value,o),{onSuccess:Mt,onFailure:s=>Np(r,"value",s,i,o)}):be(new ga(r,i,o)),{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])=>Nr()(At([V({_tag:Ce("Some"),value:n}),V({_tag:Ce("None")})]),oo({decode:i=>i._tag==="None"?$t():Mt(i.value),encode:i=>si(i)?{_tag:"Some",value:i.value}:{_tag:"None"}}))});return pn(t.ast,{value:e})}function fSn(e){return dt(e).pipe(An(y4(xl(e)),txn()))}function gSn(e){return a6(e).pipe(An(y4(xl(e)),nxn()))}function ySn(e,t){return Vye(e).pipe(An(y4(xl(e)),ixn(t)))}function vSn(e){return Ue(e).pipe(An(y4(xl(e)),rxn()))}function _Sn(e){return jt(e).pipe(An(y4(xl(e)),oxn()))}function wSn(e,t){const n=t===void 0?"omit":t.onNoneEncoding,i=n===null?null:void 0;return jt(dt(e)).pipe(An(y4(xl(e)),Fge({decode:r=>r.pipe(l7(MGe),Mt),encode:n==="omit"?C2:r=>Mt(T2(C2(r),()=>i))})))}function Pdt(e,t){const n=typeof t?.label=="string"?t.label:void 0,i=t?.disallowJsonEncode===!0,r=n!==void 0?i?{label:n,disallowJsonEncode:!0}:{label:n}:i?{disallowJsonEncode:!0}:void 0,o=n!==void 0?Ma(Ce(n)):void 0,s=Sd()([e],([a])=>(c,u,l)=>{if(Ule(c)){const d=o!==void 0?ez(o(c.label,l),p=>new yc(["label"],p)):pt;return yd(d,()=>hu(Ma(a)(j5(c),l),{onSuccess:p=>wp(p,{label:c.label}),onFailure:()=>new vc(u,[new yc(["value"],new ir(void 0,c,l))],c,l)}))}return be(new ga(u,c,l))},{representation:{id:"effect/schema/Redacted",payload:r??null},toCode:({typeParameters:a})=>({runtime:r!==void 0?`Schema.Redacted(${a[0].runtime}, ${Qt(r)})`:`Schema.Redacted(${a[0].runtime})`,Type:`Redacted.Redacted<${a[0].Type}>`,importDeclarations:['import * as Redacted from "effect/Redacted"']}),expected:"Redacted",toCodecJson:([a])=>Nr()(a,{decode:Pi(c=>wp(c,{label:n})),encode:i?$ge(c=>"Cannot serialize Redacted"+(si(c)&&typeof c.value.label=="string"?` with label: "${c.value.label}"`:"")):Pi(j5)}),toEquivalence:([a])=>wVe(a)});return pn(s.ast,{value:e})}function bSn(e,t){return An(Pdt(xl(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:Pi(n=>wp(n,{label:t?.label})),encode:t?.disallowEncode?$ge(n=>"Cannot encode Redacted"+(si(n)&&typeof n.value.label=="string"?` with label: "${n.value.label}"`:"")):Pi(j5)})(e)}function xSn(e,t){const n=Sd()([e,t],([i,r])=>(o,s,a)=>{if(!KKe(o))return be(new ga(s,o,a));switch(o._tag){case"Success":return hu(B0e(i)(o.success,a),{onSuccess:oi,onFailure:c=>Np(s,"success",c,o,a)});case"Failure":return hu(B0e(r)(o.failure,a),{onSuccess:hi,onFailure:c=>Np(s,"failure",c,o,a)})}},{representation:{id:"effect/schema/Result",payload:null},toCode:({typeParameters:i})=>({runtime:`Schema.Result(${i[0].runtime}, ${i[1].runtime})`,Type:`Result.Result<${i[0].Type}, ${i[1].Type}>`,importDeclarations:['import * as Result from "effect/Result"']}),expected:"Result",toCodec:([i,r])=>Nr()(At([V({_tag:Ce("Success"),success:i}),V({_tag:Ce("Failure"),failure:r})]),oo({decode:o=>o._tag==="Success"?oi(o.success):hi(o.failure),encode:o=>yl(o)?{_tag:"Success",success:o.success}:{_tag:"Failure",failure:o.failure}}))});return pn(n.ast,{success:e,failure:t})}function jye(e,t,n,i,r){const o=kSn(n,t,i),s=Mdt(t),a=class extends e{constructor(...[c,u]){const d=u?.["~payload"],p=d?.token===Hq?d.value:n.make(c??{},u);super(p,{...u,disableChecks:!0,"~payload":{token:Hq,value:p}})}static[i6]=i6;get[s](){return s}static[Ght]=!0;static identifier=t;static fields=n.fields;static get ast(){return o(this).ast}static pipe(){return ji(this,arguments)}static rebuild(c){return o(this).rebuild(c)}static make(c,u){return Zct(o(this))(c??{},u)}static makeOption(c,u){return Yct(o(this))(c??{},u)}static makeEffect(c,u){return o(this).makeEffect(c??{},u)}static annotate(c){return this.rebuild(Aw(this.ast,c))}static annotateKey(c){return this.rebuild(s0e(this.ast,c))}static check(...c){return this.rebuild(Tw(this.ast,c))}static extend(c){return(u,l)=>{const d=r9(u)?u:V(u),p={...n.fields,...d.fields},h=Zge(p,n.ast.checks,{identifier:c});return jye(this,c,Pye(Tw(h,d.ast.checks),p),l,r)}}static mapFields(c,u){return n.mapFields(c,u)}};return r!==void 0&&Object.assign(a.prototype,r(t)),a}function SSn(e){return new wo(Pi(t=>new e(t,{"~payload":{token:Hq,value:t}})),r4())}function Mdt(e){return`~effect/Schema/Class/${e}`}function kSn(e,t,n){let i;return r=>{if(i!==void 0)return i;const o=Mdt(t),s=u=>u instanceof r||Sn(u,o),a=SSn(r),c=pn(new $A([e.ast],()=>(u,l,d)=>s(u)?we(u):be(new ga(l,u,d)),{identifier:t,[Ige]:([u])=>({isConstructed:s,link:new ca(u,a)}),toCodec:([u])=>new ca(u.ast,a),toEquivalence:([u])=>u,toFormatter:([u])=>l=>`${r.identifier}(${u(l)})`,[Oz]:k8(e.ast),...n}));return i=An(c,a)(e)}}function r9(e){return XA(e)}function ESn(e){return t=>t.annotate({toFormatter:e})}function ASn(e,t){return F2n(e.ast,t)}function TSn(e){return t=>t.annotate({toEquivalence:e})}function Wye(e){return sye(e.ast)}function n6(e,t){return rye(e.ast,t)}function Ddt(e,t){const n=rye(L8(e.ast),t);return jut(n,t)}function ISn(e,t){return D2n(e,t)}function CSn(e){return G2n(e)}function RSn(e){return V2n(e)}function OSn(e){return K2n(e)}function PSn(e,t){return n=>pn(Aw(n.ast,{toCodecIso:()=>new ca(e.ast,Wz(t))}),{schema:n})}function MSn(e){return P2n(e)}function DSn(e){const t=Pw(()=>n),n=At([e,ut(t),Vs(te,t)]);return n}function LSn(e){return g8(e.ast)}function NSn(e){return e.ast.context?.annotations}var i6,r6,Bf,Ldt,Ndt,$dt,zye,Udt,Bq,Fdt,qye,Hye,Bdt,jdt,Wdt,o9,zdt,fu,pn,Ue,qdt,jt,Hdt,Gye,Gdt,xl,v4,o6,Vdt,Kdt,Sl,Ed,s6,te,Jdt,on,ai,s9,qv,Qdt,Xdt,Ydt,ut,a9,jf,dt,a6,Vye,Kye,Jye,Zdt,vn,Qye,ept,Xye,Yye,Zye,eve,tve,_4,tpt,Js,Wt,npt,Da,Ad,rt,Mw,ipt,rpt,opt,spt,apt,cpt,nve,upt,lpt,dpt,Td,ppt,ive,rve,ove,sve,hpt,ave,cve,mpt,uve,c9,fpt,gpt,ypt,vpt,lve,dve,pve,u9,_pt,wpt,hve,bpt,xpt,Spt,kpt,Ept,jq,Apt,Tpt,mve,c6,Ipt,Cpt,Rpt,fve,Opt,Ppt,Mpt,Dpt,Lpt,gve,yve,Npt,l9,vve,$pt,Upt,Fpt,Bpt,_ve,wve,bve,xve,Sve,kve,jpt,Wpt,zpt,qpt,Eve,d9,Hpt,Gpt,Vpt,Kpt,Ave,Tve,Jpt,Ive,Cve,Qpt,Rve,Ove,Xpt,cm,Dw,w4,p9,Wq,zq,Pve,Lw,b4,es,Ypt,Zpt,eht,tht,nht,iht,rht,oht,sht,aht,cht,uht,lht,dht,pht,hht,mht,fht,ght,yht,vht,_ht,wht,bht,xht,Sht,Mve,kht,Dve,Eht,Lve,Aht,Nve,Tht,$ve,Iht,Uve,Cht,Rht,Oht,Fve,Pht,Bve,Mht,Dht,Lht,Nht,$ht,h9,Uht,Fht,Bht,jht,jve,Wve,Wht,zht,qq,qht,Hht,Ght,Hq,zve,Vht,Gq,Kht,Vq,Jht,Qht,Xht,Id,qve,Yht,Zht,wt=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Schema.js"(){du(),prt(),a8(),ro(),Ffe(),jh(),$ot(),f0(),gt(),yz(),Zo(),Xr(),ma(),Nn(),pge(),fge(),Tbn(),Ibn(),Cbn(),Tr(),Cs(),Vst(),qa(),Sw(),put(),A2n(),N8(),M2n(),N2n(),U2n(),B2n(),J2n(),qut(),Gut(),X2n(),jB(),zlt(),Y2n(),Eye(),Ame(),ri(),A2(),Zi(),Yn(),_j(),bv(),tye(),ki(),$p(),PA(),Df(),jv(),zz(),F8(),i6=dq,r6=class extends Wo("SchemaError"){[HA]=HA;constructor(e){const t=_2();gf(0);try{super({issue:e})}finally{gf(t)}}get message(){return nat(this.issue)}toString(){return`SchemaError(${this.message})`}},Bf=eut,Ldt=Lxn,Ndt=kd,$dt=Nq,zye=tut,Udt=sut,Bq=It,Fdt=odt,qye=it,Hye=JA,Bdt=Rye,jdt=nut,Wdt=cut,o9=$q,zdt=sdt,fu=QA,pn=Wv,Ue=va(e=>pn(FA(e.ast),{schema:e})),qdt=va(e=>e.schema),jt=va(e=>{const t=a6(e);return pn(Pct(e.ast),{schema:t})}),Hdt=va(e=>e.schema.members[0]),Gye=va(e=>pn(k0e(e.ast),{schema:e})),Gdt=va(e=>e.schema),xl=va(e=>pn(Bu(e.ast),{schema:e})),v4=va(e=>pn(R0(e.ast),{schema:e})),o6="~effect/Schema/flip",Vdt=pn(h0e),Kdt=pn(pct),Sl=pn(Iw),Ed=pn(l0e),s6=pn(p0e),te=pn(nm),Jdt=te,on=pn(f0e),ai=pn(bct),s9=pn(Sct),qv=pn(Ect),Qdt=pn(uct),Xdt=pn(fct),Ydt=e=>typeof e=="symbol"?e:globalThis.String(e),ut=va(e=>pn(new Nf(!1,[],[e.ast]),{value:e})),a9=va(e=>pn(new Nf(!1,[e.ast],[e.ast]),{value:e})),jf=va(e=>pn(pxn(e.ast),{schema:e})),dt=va(e=>At([e,Ed])),a6=va(e=>At([e,s6])),Vye=va(e=>At([e,Ed,s6])),Kye=ct(["true","yes","on","1","y"]),Jye=ct(["false","no","off","0","n"]),Zdt=ct([...Kye.literals,...Jye.literals]).pipe(An(ai,oo({decode:e=>e==="true"||e==="yes"||e==="on"||e==="1"||e==="y",encode:e=>e?"true":"false"}))),vn=n0e,Qye="^\\S[\\s\\S]*\\S$|^\\S$|^$",ept=e=>e?new globalThis.RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$/,Xye=/^([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})$/,Yye="^[^a-z]*$",Zye="^[^A-Z]*$",eve="^(?:[^a-z][\\s\\S]*)?$",tve="^(?:[^A-Z][\\s\\S]*)?$",_4=pn(S0e),tpt=Vat,Js=Z8({order:xv,annotate:e=>({representation:{id:"effect/schema/isGreaterThan",payload:{exclusiveMinimum:ZA(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${Qt(e)})`})})}),Wt=e9({order:xv,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:ZA(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${Qt(e)})`})})}),npt=t9({order:xv,annotate:e=>({representation:{id:"effect/schema/isLessThan",payload:{exclusiveMaximum:ZA(e)}},toJsonSchema:()=>({exclusiveMaximum:e}),toCode:()=>({runtime:`Schema.isLessThan(${Qt(e)})`})})}),Da=n9({order:xv,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualTo",payload:{maximum:ZA(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${Qt(e)})`})})}),Ad=i9({order:xv,annotate:e=>{const t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetween",payload:{minimum:ZA(e.minimum),maximum:ZA(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?"exclusiveMinimum":"minimum"]:e.minimum,[n?"exclusiveMaximum":"maximum"]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${Qt(e.minimum)}, maximum: ${Qt(e.maximum)}, exclusiveMinimum: ${Qt(t)}, exclusiveMaximum: ${Qt(n)} })`})}}}),rt=on.check(Ff()),Mw=rt.check(Wt(0)),ipt=Z8({order:z5,annotate:e=>({representation:{id:"effect/schema/isGreaterThanDate",payload:{exclusiveMinimum:e6(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanDate(${t6(e)})`})})}),rpt=e9({order:z5,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToDate",payload:{minimum:e6(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToDate(${t6(e)})`})})}),opt=t9({order:z5,annotate:e=>({representation:{id:"effect/schema/isLessThanDate",payload:{exclusiveMaximum:e6(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanDate(${t6(e)})`})})}),spt=n9({order:z5,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToDate",payload:{maximum:e6(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToDate(${t6(e)})`})})}),apt=i9({order:z5,annotate:e=>{const t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenDate",payload:{minimum:e6(e.minimum),maximum:e6(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenDate({ minimum: ${t6(e.minimum)}, maximum: ${t6(e.maximum)}, exclusiveMinimum: ${Qt(t)}, exclusiveMaximum: ${Qt(n)} })`})}}}),cpt=Z8({order:W5,annotate:e=>({representation:{id:"effect/schema/isGreaterThanBigInt",payload:{exclusiveMinimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanBigInt(${Qt(e)})`})})}),nve=e9({order:W5,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToBigInt",payload:{minimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToBigInt(${Qt(e)})`})})}),upt=t9({order:W5,annotate:e=>({representation:{id:"effect/schema/isLessThanBigInt",payload:{exclusiveMaximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanBigInt(${Qt(e)})`})})}),lpt=n9({order:W5,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToBigInt",payload:{maximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToBigInt(${Qt(e)})`})})}),dpt=i9({order:W5,annotate:e=>{const 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:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenBigInt({ minimum: ${Qt(e.minimum)}, maximum: ${Qt(e.maximum)}, exclusiveMinimum: ${Qt(t)}, exclusiveMaximum: ${Qt(n)} })`})}}}),Td=te.check(xdt()),ppt=te.check(Lye(1,1)),ive=e=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),rve=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},ove=[],sve=[],hpt=am(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>Nr()(V({source:te,flags:te}),mu({decode:(e,t)=>kt({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new ir({expected:"valid RegExp source and flags"},e,t)}),encode:e=>we({source:e.source,flags:e.flags})}))}),ave=te.annotate({expected:"a string that will be decoded as a URL"}),cve=am(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>Nr()(ave,Gge)}),mpt=ave.pipe(An(cve,Gge)),uve=te.annotate({expected:"a string that will be decoded as a Date"}),c9=Rr(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:()=>Nr()(uve,jge)}),fpt=uve.pipe(An(c9,jge)),gpt=rt.pipe(An(c9,bat)),ypt=te.annotate({expected:"a string that will be decoded as JSON",contentMediaType:"application/json"}),vpt=ti(Sl),lve=am(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>Nr()(V({data:te.check(Mye()),type:te,name:te,lastModified:rt}),mu({decode:(e,t)=>kv(l8(e.data),{onFailure:()=>be(new ir({expected:"a valid Base64 string"},e.data,t)),onSuccess:n=>{const i=new globalThis.Uint8Array(n);return we(new globalThis.File([i],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>Ir({try:async()=>{const n=new globalThis.Uint8Array(await e.arrayBuffer());return{data:u8(n),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new ir({expected:"a readable File"},e,t)})}))}),dve=am(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>Nr()(ut(Ka([te,At([V({_tag:_a("String"),value:te}),V({_tag:_a("File"),value:lve})])])),mu({decode:e=>{const t=new globalThis.FormData;for(const[n,i]of e)t.append(n,i.value);return we(t)},encode:e=>we(globalThis.Array.from(e.entries()).map(([t,n])=>typeof n=="string"?[t,{_tag:"String",value:n}]:[t,{_tag:"File",value:n}]))}))}),pve=am(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>Nr()(te.annotate({expected:"a query string that will be decoded as URLSearchParams"}),oo({decode:e=>new globalThis.URLSearchParams(e),encode:e=>e.toString()}))}),u9=te.annotate({expected:"a string that will be decoded as a number"}).pipe(An(on,S8)),_pt=te.annotate({expected:"a string that will be decoded as a finite number"}).pipe(An(_4,S8)),wpt=pn(A0e).pipe(An(qv,Bge)),hve=te.check(wdt()),bpt=te.annotate({expected:"a string that will be decoded as a trimmed string"}).pipe(An(hve,exn())),xpt=te.annotate({expected:"a base64 encoded string that will be decoded as a UTF-8 string"}).pipe(An(te,Cat)),Spt=te.annotate({expected:"a base64 (URL) encoded string that will be decoded as a UTF-8 string"}).pipe(An(te,Rat)),kpt=te.annotate({expected:"a hex encoded string that will be decoded as a UTF-8 string"}).pipe(An(te,Oat)),Ept=te.annotate({expected:"a URI component encoded string that will be decoded as a UTF-8 string"}).pipe(An(te,Pat)),jq=At([_4,s9,te]),Apt=V({issues:ut(V({message:te,path:jt(ut(At([jq,V({key:jq})])))}))}),Tpt=ct([0,1]).pipe(An(ai,oo({decode:e=>e===1,encode:e=>e?1:0}))),mve=te.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),c6=am(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>Nr()(mve,Vge)}),Ipt=mve.pipe(An(c6,Vge)),Cpt=te.annotate({expected:"a base64 (URL) encoded string that will be decoded as a Uint8Array"}).pipe(An(c6,{decode:Wbn(),encode:hat()})),Rpt=te.annotate({expected:"a hex encoded string that will be decoded as a Uint8Array"}).pipe(An(c6,{decode:qbn(),encode:mat()})),fve=mu({decode:(e,t)=>{const n=urt(e);return Bn(n)?be(new ir({expected:"a valid BigDecimal string"},e,t)):we(n.value)},encode:e=>we(Uv(e))}),Opt=Z8({order:vA,formatter:e=>Uv(e)}),Ppt=e9({order:vA,formatter:e=>Uv(e)}),Mpt=t9({order:vA,formatter:e=>Uv(e)}),Dpt=n9({order:vA,formatter:e=>Uv(e)}),Lpt=i9({order:vA,formatter:e=>Uv(e)}),gve=te.annotate({expected:"a string that will be decoded as a BigDecimal"}),yve=Rr(wfe,{representation:{id:"effect/schema/BigDecimal",payload:null},toCode:()=>({runtime:"Schema.BigDecimal",Type:"BigDecimal.BigDecimal",importDeclarations:['import * as BigDecimal from "effect/BigDecimal"']}),expected:"BigDecimal",toCodecJson:()=>Nr()(gve,fve),toFormatter:()=>e=>Uv(e)}),Npt=gve.pipe(An(yve,fve)),l9=Rr(vrt,{representation:{id:"effect/schema/ByteSize",payload:null},toCode:()=>({runtime:"Schema.ByteSize",Type:"ByteSize.ByteSize",importDeclarations:['import * as ByteSize from "effect/ByteSize"']}),expected:"ByteSize",toCodecJson:()=>Nr()(qv.check(nve(globalThis.BigInt(0))),oo({decode:az,encode:Dfe})),toCodecStringTree:()=>Nr()(vve,Wge)}),vve=te.annotate({expected:"a string that will be decoded as a ByteSize"}),$pt=vve.pipe(An(l9,Wge)),Upt=qv.pipe(An(l9,xat)),Fpt=on.pipe(An(l9,Sat)),Bpt=oo({decode:e=>c8(e),encode:e=>e.offset}),_ve=mu({decode:(e,t)=>Oa(Xfe(e),{onNone:()=>be(new ir({expected:"a valid IANA time zone"},e,t)),onSome:we}),encode:e=>we(e.id)}),wve=mu({decode:(e,t)=>Oa(Zfe(e),{onNone:()=>be(new ir({expected:"a valid time zone"},e,t)),onSome:we}),encode:e=>we(_A(e))}),bve=mu({decode:(e,t)=>Oa(pz(e),{onNone:()=>be(new ir({expected:"a valid UTC DateTime string"},e,t)),onSome:n=>we(hz(n))}),encode:e=>we(ige(e))}),xve=mu({decode:(e,t)=>Oa(Kfe(e),{onNone:()=>be(new ir({expected:"a valid Zoned DateTime string"},e,t)),onSome:we}),encode:e=>we(gz(e))}),Sve=-864e13,kve=864e13,jpt=Sve+840*60*1e3,Wpt=kve-840*60*1e3,zpt=-720*60*1e3,qpt=840*60*1e3,Eve=["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"],d9=Rr(e=>dz(e)&&zfe(e),{representation:{id:"effect/schema/DateTimeUtc",payload:null},toCode:()=>({runtime:"Schema.DateTimeUtc",Type:"DateTime.Utc",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Utc",toCodecArbitrary:({constraint:e})=>{const[t,n]=Adt(e,Sve,kve);return YA()(Bye(t,n),Pi(Gfe))},toCodecJson:()=>Nr()(te,bve),toFormatter:()=>e=>e.toString()}),Hpt=c9.pipe(An(d9,{decode:Edt(),encode:Pi(ege)})),Gpt=te.annotate({expected:"a string that will be decoded as a DateTime.Utc"}).pipe(An(d9,bve)),Vpt=rt.pipe(An(d9,{decode:Edt(),encode:Pi(tge)})),Kpt=Rr(jfe,{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:()=>Nr()(rt,Bpt),toFormatter:()=>e=>_A(e)}),Ave=te.annotate({expected:"an IANA time zone identifier"}),Tve=Rr(Wfe,{representation:{id:"effect/schema/TimeZoneNamed",payload:null},toCode:()=>({runtime:"Schema.TimeZoneNamed",Type:"DateTime.TimeZone.Named",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone.Named",toCodecArbitrary:()=>YA()(ct(Eve),Pi(mz)),toCodecJson:()=>Nr()(Ave,_ve),toFormatter:()=>e=>_A(e)}),Jpt=Ave.pipe(An(Tve,_ve)),Ive=te.annotate({expected:"a time zone string (IANA identifier or offset like +03:00)"}),Cve=Rr(Bfe,{representation:{id:"effect/schema/TimeZone",payload:null},toCode:()=>({runtime:"Schema.TimeZone",Type:"DateTime.TimeZone",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.TimeZone",toCodecArbitrary:()=>YA()(Tdt(),Pi(e=>typeof e=="number"?c8(e):mz(e))),toCodecJson:()=>Nr()(Ive,wve),toFormatter:()=>e=>_A(e)}),Qpt=Ive.pipe(An(Cve,wve)),Rve=te.annotate({expected:"a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])"}),Ove=Rr(e=>dz(e)&&qfe(e),{representation:{id:"effect/schema/DateTimeZoned",payload:null},toCode:()=>({runtime:"Schema.DateTimeZoned",Type:"DateTime.Zoned",importDeclarations:['import * as DateTime from "effect/DateTime"']}),expected:"DateTime.Zoned",toCodecArbitrary:({constraint:e})=>{const[t,n]=Adt(e,jpt,Wpt);return YA()(V({epochMilliseconds:Bye(t,n),timeZone:Tdt()}),Pi(({epochMilliseconds:i,timeZone:r})=>Vfe(i,{timeZone:r})))},toCodecJson:()=>Nr()(Rve,xve),toFormatter:()=>e=>gz(e),toEquivalence:()=>Hfe}),Xpt=Rve.pipe(An(Ove,xve)),cm=(e,t,n,i)=>te.pipe(An(e,mu({decode:(r,o)=>{const s=t(r);return yl(s)?we(s.success):be(new ir({message:s.failure.message},r,o))},encode:r=>we(n(r))}))).annotate({identifier:i}),Dw=Rr(GA,{identifier:"MacAddress"}),w4=cm(Dw,Alt,gye,"MacAddressFromString"),p9=Rr(xd,{identifier:"Ipv4Address"}),Wq=cm(p9,q8,zv,"Ipv4AddressFromString"),zq=Rr(Ow,{identifier:"Ipv6Address"}),Pve=cm(zq,kq,zv,"Ipv6AddressFromString"),Lw=Rr(dlt,{identifier:"IpAddress"}),b4=cm(Lw,Eq,zv,"IpAddressFromString"),es=(e,t,n,i)=>ldt(t,{expected:n})(e).annotate({identifier:i}),Ypt=es(Lw,KA,"a multicast address","IpMulticastAddress"),Zpt=es(b4,KA,"a multicast address","IpMulticastAddressFromString"),eht=es(Dw,KA,"a multicast address","MacMulticastAddress"),tht=es(w4,KA,"a multicast address","MacMulticastAddressFromString"),nht=es(Lw,wye,"a unicast address","IpUnicastAddress"),iht=es(b4,wye,"a unicast address","IpUnicastAddressFromString"),rht=es(Dw,Tq,"a unicast address","MacUnicastAddress"),oht=es(w4,Tq,"a unicast address","MacUnicastAddressFromString"),sht=es(p9,Cq,"a broadcast address","Ipv4BroadcastAddress"),aht=es(Wq,Cq,"a broadcast address","Ipv4BroadcastAddressFromString"),cht=es(Dw,Aq,"a broadcast address","MacBroadcastAddress"),uht=es(w4,Aq,"a broadcast address","MacBroadcastAddressFromString"),lht=es(Lw,_ye,"a loopback address","IpLoopbackAddress"),dht=es(b4,_ye,"a loopback address","IpLoopbackAddressFromString"),pht=es(Lw,bye,"a link-local address","IpLinkLocalAddress"),hht=es(b4,bye,"a link-local address","IpLinkLocalAddressFromString"),mht=es(Lw,Iq,"an unspecified address","IpUnspecifiedAddress"),fht=es(b4,Iq,"an unspecified address","IpUnspecifiedAddressFromString"),ght=es(p9,xye,"a private address","Ipv4PrivateAddress"),yht=es(Wq,xye,"a private address","Ipv4PrivateAddressFromString"),vht=es(zq,Sye,"a unique-local address","Ipv6UniqueLocalAddress"),_ht=es(Pve,Sye,"a unique-local address","Ipv6UniqueLocalAddressFromString"),wht=es(Dw,yye,"a locally administered address","MacLocallyAdministeredAddress"),bht=es(w4,yye,"a locally administered address","MacLocallyAdministeredAddressFromString"),xht=es(Dw,vye,"a universally administered address","MacUniversallyAdministeredAddress"),Sht=es(w4,vye,"a universally administered address","MacUniversallyAdministeredAddressFromString"),Mve=Rr(Blt,{identifier:"Ipv4Interface"}),kht=cm(Mve,Aye,V8,"Ipv4InterfaceFromString"),Dve=Rr(jlt,{identifier:"Ipv6Interface"}),Eht=cm(Dve,Tye,V8,"Ipv6InterfaceFromString"),Lve=Rr(H8,{identifier:"IpInterface"}),Aht=cm(Lve,Iye,V8,"IpInterfaceFromString"),Nve=Rr(qlt,{identifier:"Ipv4Network"}),Tht=cm(Nve,Qlt,J8,"Ipv4NetworkFromString"),$ve=Rr(Hlt,{identifier:"Ipv6Network"}),Iht=cm($ve,Xlt,J8,"Ipv6NetworkFromString"),Uve=Rr(K8,{identifier:"IpNetwork"}),Cht=cm(Uve,Ylt,J8,"IpNetworkFromString"),Rht=Rr(W8,{identifier:"InetAddressV4"}),Oht=Rr(z8,{identifier:"InetAddressV6"}),Fve=Rr(mye,{identifier:"InetAddress"}),Pht=cm(Fve,Nlt,Rq,"InetAddressFromString"),Bve=Rr(Sq,{identifier:"UnixPathAddress"}),Mht=te.pipe(An(Bve,oo({decode:Flt,encode:e=>e.path}))).annotate({identifier:"UnixPathAddressFromString"}),Dht=Rr(plt,{identifier:"SocketAddress"}),Lht=mu({decode:(e,t)=>Oa(IKe(e),{onNone:()=>be(new ir({expected:"a valid Duration string"},e,t)),onSome:we}),encode:e=>we(globalThis.String(e))}),Nht=mu({decode:e=>we(ew(e)),encode:(e,t)=>Oa(BKe(e),{onNone:()=>be(new ir({expected:"a Duration representable as a bigint"},e,t)),onSome:n=>we(n)})}),$ht=oo({decode:e=>K5(e),encode:e=>tw(e)}),h9=Rr(kde,{representation:{id:"effect/schema/Duration",payload:null},toCode:()=>({runtime:"Schema.Duration",Type:"Duration.Duration",importDeclarations:['import * as Duration from "effect/Duration"']}),expected:"Duration",toCodecJson:()=>Nr()(At([V({_tag:Ce("Infinity")}),V({_tag:Ce("NegativeInfinity")}),V({_tag:Ce("Nanos"),value:qv}),V({_tag:Ce("Millis"),value:rt})]),oo({decode:e=>{switch(e._tag){case"Infinity":return O2;case"NegativeInfinity":return V5;case"Nanos":return ew(e.value);case"Millis":return K5(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}}}}))}),Uht=te.annotate({expected:"a string that will be decoded as a Duration"}),Fht=Uht.pipe(An(h9,Lht)),Bht=qv.pipe(An(h9,Nht)),jht=on.pipe(An(h9,$ht)),jve=Rr(wst,{representation:{id:"effect/http/Cookie",payload:null},toCode:()=>({runtime:"Schema.Cookie",Type:"Cookies.Cookie",importDeclarations:['import * as Cookies from "effect/http/Cookies"']}),expected:"Cookie"}),Wve=Rr(_st,{representation:{id:"effect/http/Cookies",payload:null},toCode:()=>({runtime:"Schema.Cookies",Type:"Cookies.Cookies",importDeclarations:['import * as Cookies from "effect/http/Cookies"']}),expected:"Cookies",toCodecJson:()=>Nr()(ut(te),oo({decode:Sst,encode:Cst})),toCodecIso:()=>Nr()(Vs(te,jve),oo({decode:yge,encode:e=>e.cookies}))}),Wht=Wve.pipe(An(Vs(te,te),oo({decode:Ist,encode:e=>vge(globalThis.Object.entries(e).map(([t,n])=>Tst(t,n)))}))),zht=Rr(Ost,{representation:{id:"effect/http/Headers",payload:null},toCode:()=>({runtime:"Schema.Headers",Type:"Headers.Headers",importDeclarations:['import * as Headers from "effect/http/Headers"']}),expected:"Headers",toEquivalence:()=>wge,toCodec:()=>Nr()(Vs(te,te),oo({decode:Mst,encode:e=>({...e})}))}),qq=Rr(bge,{representation:{id:"effect/http/UrlParams",payload:null},toCode:()=>({runtime:"Schema.UrlParams",Type:"UrlParams.UrlParams",importDeclarations:['import * as UrlParams from "effect/http/UrlParams"']}),expected:"UrlParams",toEquivalence:()=>Sge,toCodec:()=>Nr()(ut(Ka([te,te])),oo({decode:Iz,encode:e=>e.params}))}),qht=(e,t)=>qq.pipe(An(ti(Sl,t),mu({decode:n=>Oa(Fst(n,e),{onNone:()=>be(new yc([e],new b8(void 0))),onSome:we}),encode:n=>we(Iz([[e,n]]))}))),Hht=qq.pipe(An(Vs(te,At([te,a9(te)])),oo({decode:jst,encode:$st}))),Ght=globalThis.Symbol.for("immer-draftable"),Hq={},zve=e=>(t,n)=>{const i=r9(t)?t:V(t);return jye(xJe,e,i,n,r=>({toString(){return`${r}(${Qt({...this})})`}}))},Vht=e=>(t,n,i)=>{const r=r9(n)?n.mapFields(o=>({_tag:_a(t),...o}),{unsafePreserveChecks:!0}):Fq(t,n);return zve(e??t)(r,i)},Gq=e=>(t,n)=>{const i=r9(t)?t:V(t);return jye(ZB,e,i,n,o=>({name:o}))},Kht=e=>(t,n,i)=>{const r=r9(n)?n.mapFields(o=>({_tag:_a(t),...o}),{unsafePreserveChecks:!0}):Fq(t,n);return Gq(e??t)(r,i)},Vq=Cut,Jht=Put,Qht=Mut,Xht=p2n,Id=pn(Aw(BA,{toCode:()=>({runtime:"Schema.Json",Type:"Schema.Json"})})),qve=Vs(te,Id),Yht=V({message:te,name:Ue(te),stack:Ue(te),cause:Ue(Id)}),Zht=pn(Aw(Wct,{toCode:()=>({runtime:"Schema.MutableJson",Type:"Schema.MutableJson"})}))}});function Cd(e){const t=e instanceof Ne?e:new Ne("runtime","unavailable","Shiitake operation failed"),n={_tag:t._tag,boundary:t.boundary,cause:t.cause,message:t.message};return t.requestId!==void 0&&Object.assign(n,{requestId:t.requestId}),Object.freeze(n)}var emt,tmt,nmt,imt,Ne,Ei=A({"../../packages/shiitake/dist/errors.js"(){"use strict";wt(),emt=ct(["contract","extensions","instructions","model","runtime","store","tools"]),tmt=ct(["closed","conflict","incompatible","invalid","rejected","unavailable","state_reset_required","storage_pressure","archived","secret_in_prompt"]),nmt=te.pipe(Ze(rn(1)),Ze(ft(256))),imt=V({_tag:Ce("ShiitakeError"),boundary:emt,cause:tmt,message:te,requestId:Ue(nmt)}),Ne=class extends Error{boundary;requestId;_tag="ShiitakeError";cause;underlying;constructor(e,t,n,i,r){super(n),this.boundary=e,this.requestId=i,this.name="ShiitakeError",this.cause=t,this.underlying=r}}}});function m9(e){return te.check(rn(1),ft(e),vn(t=>Kq.encode(t).byteLength<=e))}function Hr(e){const t=Amt(e);if(t._tag==="Failure")throw new Ne("contract","invalid","Session id is invalid");return t.success}function $Sn(e){const t=pmt(e);if(t._tag==="Failure")throw new Ne("contract","invalid","Session cursor is invalid");return t.success}function Hve(e){const t=Jq(e);if(t._tag==="Failure")throw new Ne("contract","invalid","Session creation request is invalid");return t.success.requestId}function rmt(e){const t=Rmt(e);if(t._tag==="Failure")throw new Ne("contract","invalid","Read options are invalid");const n=t.success??{};let i={limit:n.limit??200};return n.before!==void 0&&(i={...i,before:n.before}),n.includeSandboxFailures!==void 0&&(i={...i,includeSandboxFailures:n.includeSandboxFailures}),Object.freeze(i)}function USn(e){const t=Pmt(e);if(t._tag==="Failure")throw new Ne("contract","invalid","Subscribe options are invalid");let n={};return t.success.after!==void 0&&(n={...n,after:t.success.after}),t.success.includeSandboxFailures!==void 0&&(n={...n,includeSandboxFailures:t.success.includeSandboxFailures}),Object.freeze(n)}function f9(e,t){if(kn(e))throw new Ne("contract","invalid",t);return e.success}var Kq,omt,um,smt,Gve,amt,cmt,umt,lmt,dmt,pmt,hmt,Vve,mmt,fmt,gmt,ymt,vmt,Kve,Jve,_mt,Qve,Xve,wmt,Yve,bmt,xmt,Smt,kmt,Emt,P0,Amt,Jq,Tmt,u6,Imt,Cmt,Rmt,Omt,Pmt,Mmt,M0=A({"../../packages/shiitake/dist/internal/client-boundary.js"(){"use strict";ki(),wt(),Ei(),Kq=new TextEncoder,omt=/\p{Cs}/u,um=m9(256).check(vn(e=>!omt.test(e))),smt=m9(256*1024),Gve=V({type:Ce("image"),data:te.check(rn(1),ft(1024*1024),Mye()),mimeType:te.check(vn(e=>["image/png","image/jpeg","image/gif","image/webp"].includes(e)))}),amt=ut(Gve).check(rn(1),ft(8)),cmt=ct(["steer","followUp"]),umt=um,lmt=It(V({commandId:um,timeoutMs:rt.check(Wt(0),Da(3e4))}),{onExcessProperty:"error"}),dmt=It(V({commandId:um,timeoutMs:u9.check(Ff(),Ad({minimum:0,maximum:3e4}))}),{onExcessProperty:"error"}),pmt=It(m9(512)),hmt=V({requestId:um}),Vve=V({delivery:cmt,requestId:um,type:Ce("prompt"),text:te.check(ft(256*1024),vn(e=>Kq.encode(e).byteLength<=256*1024)),images:Ue(amt)}).check(vn(e=>(e.text.length>0||(e.images?.length??0)>0)&&Kq.encode(e.text).byteLength+(e.images??[]).reduce((t,n)=>t+n.data.length,0)<=1024*1024)),mmt=V({type:Ce("abort")}),fmt=V({commandId:um,onlyIfPending:jt(ai),type:Ce("cancel")}),gmt=V({type:Ce("operator"),requestId:um,author:ct(["operator","party"]),text:smt}),ymt=V({type:Ce("branch"),entryId:um}),vmt=V({type:Ce("fork"),entryId:um}),Kve=te.check(rn(1),ft(4096)),Jve=V({type:Ce("compact"),requestId:um,instructions:Ue(Kve)}),_mt=At([Vve,Jve]),Qve=120,Xve=te.check(vn(e=>e.length>0&&e.trim()===e&&!/\p{Cc}/u.test(e)&&Array.from(e).length<=Qve)),wmt=V({type:Ce("title"),title:dt(Xve)}),Yve=At([Vve,mmt,fmt,ymt,vmt,gmt,Jve,wmt]),bmt=V({command:Yve}),xmt=V({includeSandboxFailures:jt(ai),limit:jt(rt.check(Ad({minimum:1,maximum:200}))),before:jt(m9(512))}),Smt=V({includeSandboxFailures:jt(Ce("true")),limit:jt(u9.check(Ff(),Ad({minimum:1,maximum:200}))),before:jt(m9(512))}),kmt=V({includeSandboxFailures:jt(ai),after:jt(te)}),Emt=V({includeSandboxFailures:jt(Ce("true")),mode:jt(Ce("subscribe")),after:jt(te),limit:jt(u9.check(Ff(),Ad({minimum:1,maximum:200})))}),P0={onExcessProperty:"error"},Amt=It(umt,P0),Jq=It(hmt,P0),Tmt=It(_mt,P0),u6=It(um),Imt=It(Yve,P0),Cmt=It(bmt,P0),Rmt=It(At([xmt,s6]),P0),Omt=It(Smt,P0),Pmt=It(kmt,P0),Mmt=It(Emt,P0)}});function Zve(e){const t={kind:"reason_unavailable",...e,provider:e.provider===""?null:e.provider,model:e.model===""?null:e.model};return`${t.kind}: run=${t.runId}; provider=${t.provider??"unknown"}; model=${t.model??"unknown"}`.slice(0,200)}function Dmt(e){return Zve({runId:e.run.value,provider:e.message.provider,model:e.message.model})}var e1e=A({"../../packages/shiitake/dist/internal/run-failure-reason.js"(){"use strict"}}),Lmt,Nmt,t1e,n1e,l6,d6,i1e,$mt,r1e,Umt=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/MutableList.js"(){Ode(),Lmt=Symbol.for("effect/MutableList/Empty"),Nmt=()=>({head:void 0,tail:void 0,length:0}),t1e=e=>{const t=e.head;t.offset>=1024&&t===e.tail&&t.mutable&&(t.array.length-t.offset)*8<=t.offset&&(e.head=e.tail={array:t.array.slice(t.offset),mutable:!0,offset:0,next:void 0})},n1e=()=>({array:[],mutable:!0,offset:0,next:void 0}),l6=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=n1e(),e.tail=e.tail.next):e.head=e.tail=n1e(),e.tail.array.push(t),e.length++},d6=e=>{e.head=e.tail=void 0,e.length=0},i1e=(e,t)=>{if(t=y7(t),t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){const o=e.head.array;return d6(e),o}const n=new Array(t);let i=0,r=e.head;for(;r;){for(;r.offset<r.array.length;)if(n[i++]=r.array[r.offset],r.mutable&&(r.array[r.offset]=void 0),r.offset++,i===t)return e.head=r.offset===r.array.length&&r.next?r.next:r,e.length-=t,e.length===0?d6(e):t1e(e),n;r=r.next}return d6(e),n},$mt=e=>i1e(e,e.length),r1e=e=>{if(!e.head)return Lmt;const t=e.head.array[e.head.offset];return e.head.mutable&&(e.head.array[e.head.offset]=void 0),e.head.offset++,e.length--,e.head.offset===e.head.array.length?e.head.next?e.head=e.head.next:d6(e):t1e(e),t}}}),Fmt,Bmt,jmt,Qq,Wmt,Nw,g9,zmt,qmt,D0,Wf,Up,y9,Hv,x4,Hmt,Gmt,o1e,s1e,Gv,Vmt,a1e,Kmt,c1e,v9,Jmt,Qmt,u1e,l1e,Xmt,_9,Xq,d1e,Ymt,Zmt,p1e,Yq,S4,eft,w9,k4=A({"../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Queue.js"(){Nn(),Tr(),Tr(),Ode(),Cs(),Umt(),ri(),Pv(),Fmt="~effect/Queue",Bmt="~effect/Queue/Enqueue",jmt="~effect/Queue/Dequeue",Qq={_A:an,_E:an},Wmt={[Fmt]:Qq,[Bmt]:Qq,[jmt]:Qq,...Ra,toJSON(){return{_id:"effect/Queue",state:this.state._tag,size:Kmt(this)}}},Nw=e=>Si(t=>{const n=Object.create(Wmt);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??Number.POSITIVE_INFINITY,n.strategy=e?.strategy??"suspend",n.messages=Nmt(),n.scheduleRunning=!1,n.state={_tag:"Open",takers:new Set,offers:new Set,awaiters:new Set},Xt(n)}),g9=e=>Nw({capacity:e}),zmt=e=>Nw({capacity:e,strategy:"sliding"}),qmt=e=>Nw({capacity:e,strategy:"dropping"}),D0=me(2,(e,t)=>Oi(()=>Wf(e,t)?v9:e.state._tag==="Open"&&e.strategy==="suspend"?Ymt(e,t):c1e)),Wf=(e,t)=>e.state._tag!=="Open"?!1:e.messages.length>=e.capacity?e.strategy==="sliding"?(r1e(e.messages),l6(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0?(l6(e.messages,t),u1e(e),!0):!1:(l6(e.messages,t),l1e(e),!0),Up=me(2,(e,t)=>dr(()=>y9(e,t))),y9=(e,t)=>{if(e.state._tag!=="Open")return!1;const n=_p(t),i=NQe(n,Jmt);return e.state.offers.size===0&&e.messages.length===0?(w9(e,i),!0):(e.state={...e.state,_tag:"Closing",exit:i},l1e(e),!0)},Hv=e=>y9(e,KB(s7())),x4=e=>dr(()=>Hmt(e)),Hmt=e=>{if(e.state._tag==="Done")return!1;d6(e.messages);const t=e.state.offers;w9(e,e.state._tag==="Open"?Qmt:e.state.exit);for(const n of t)p1e(n);return!0},Gmt=e=>_9(()=>{if(e.state._tag==="Done")return Cp(e.state.exit,()=>Xt([]));const t=eft(e);return S4(e),Xt(t)}),o1e=e=>s1e(e,1,Number.POSITIVE_INFINITY),s1e=me(3,(e,t,n)=>(t=y7(t),n=y7(n),_9(()=>Xmt(e,t,n)??aw(d1e(e,()=>Xq(e,t)),s1e(e,t,n))))),Gv=e=>_9(()=>a1e(e)??aw(d1e(e,()=>Xq(e,1)),Gv(e))),Vmt=e=>_9(()=>{const t=a1e(e);return t===void 0?Xt($t()):t._tag==="Success"?Xt(Mt(t.value)):Xt($t())}),a1e=e=>{if(e.state._tag==="Done")return e.state.exit;if(e.messages.length>0){const t=r1e(e.messages);return S4(e),To(t)}else if(e.capacity<=0&&e.state.offers.size>0){const t=Yq(e.state.offers);return S4(e),To(t)}},Kmt=e=>e.state._tag==="Done"?0:e.messages.length,c1e=To(!1),v9=To(!0),Jmt=p0(s7()),Qmt=Rpe(),u1e=e=>{if(!(e.state._tag==="Done"||e.state.takers.size===0)){for(const t of e.state.takers)if(t.ready()&&(e.state.takers.delete(t),t.resume(vl),e.messages.length===0))break}},l1e=e=>{e.scheduleRunning||e.state._tag==="Done"||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>{e.scheduleRunning=!1,u1e(e)},0))},Xmt=(e,t,n)=>{if(e.state._tag==="Done")return e.state.exit;if(n<=0||t<=0)return To([]);if(!Xq(e,t))return;const i=e.messages.length>0?i1e(e.messages,n):[Yq(e.state.offers)];return S4(e),To(i)},_9=yf({op:"QueueTake",[As](e){const t=this[Wi]();return qB(t)?t[As](e):t}}),Xq=(e,t)=>e.messages.length>=(e.state._tag==="Closing"?1:Math.min(t,e.capacity||1))||e.capacity<=0&&e.state._tag!=="Done"&&e.state.offers.size>0,d1e=(e,t)=>Lu(n=>{if(e.state._tag==="Done")return n(e.state.exit);if(t())return n(vl);const i={ready:t,resume:n};return e.state.takers.add(i),dr(()=>{e.state._tag!=="Done"&&e.state.takers.delete(i)})}),Ymt=(e,t)=>Lu(n=>Wf(e,t)?n(v9):Zmt(e,{_tag:"Single",message:t,resume:n})),Zmt=(e,t)=>{if(e.state._tag!=="Open")return p1e(t);const n=e.state.offers;return n.add(t),dr(()=>{e.state._tag!=="Done"&&(n.delete(t),e.state._tag==="Closing"&&n.size===0&&e.messages.length===0&&w9(e,e.state.exit))})},p1e=e=>e._tag==="Single"?e.resume(c1e):e.resume(To(e.remaining.slice(e.offset))),Yq=e=>{const t=e.values().next().value;if(t._tag==="Single")return e.delete(t),t.resume(v9),t.message;const n=t.remaining[t.offset++];return t.offset===t.remaining.length&&(e.delete(t),t.resume(To([]))),n},S4=e=>{if(e.state._tag==="Done")return Y2(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag==="Closing"&&e.messages.length===0?(w9(e,e.state.exit),Y2(e.state.exit.cause)):!1;for(const t of e.state.offers){let n=e.capacity-e.messages.length;if(n<=0)break;if(t._tag==="Single")l6(e.messages,t.message),e.state.offers.delete(t),t.resume(v9);else{for(;t.offset<t.remaining.length;t.offset++){if(n===0)return!1;l6(e.messages,t.remaining[t.offset]),n--}e.state.offers.delete(t),t.resume(To([]))}const i=e.state;if(i._tag==="Done")return Y2(i.exit.cause)}return!1},eft=e=>{if(e.messages.length>0){const t=$mt(e.messages);return S4(e),t}else if(e.state._tag!=="Done"&&e.state.offers.size>0){const t=[Yq(e.state.offers)];return S4(e),t}return[]},w9=(e,t)=>{if(e.state._tag==="Done")return;const n=e.state;e.state={_tag:"Done",exit:t};for(const i of n.takers)i.resume(t);n.takers.clear();for(const i of n.awaiters)i(t);n.awaiters.clear()}}});function Rd(e,t,n){Mp(zc("shiitake_operation_failed",wp(t)).pipe(Jh({operation:e,errorKind:t instanceof Error?"error":"non-error",...n})))}var p6=A({"../../packages/shiitake/dist/internal/failure.js"(){"use strict";gt(),bv()}});function h1e(e){const t=f1e.get(e);if(t!==void 0)return t;const n=JSON.stringify(e),i=Object.freeze({data:n,bytes:oft.encode(n).byteLength});return f1e.set(e,i),i}function FSn(e){if(e.kind==="update"&&e.sandboxFailures!==void 0){const t={...e};return delete t.sandboxFailures,t}if(e.kind==="reset"&&e.baseline.sandboxFailures!==void 0){const t={...e.baseline};return delete t.sandboxFailures,{...e,baseline:t}}return e}function BSn(e){const t=new Set;let n=!1,i;const r=o=>{bw(Gmt(o.frames)),o.bytes=0};return{register(o=!1){const s={frames:bw(qmt(256)),bytes:0,lagged:!1,closed:!1,observed:-1,includeSandboxFailures:o};t.add(s);const a=Ut(()=>s.closed?we("closed"):i!==void 0?be(i):s.lagged?we("reset"):n?we("closed"):Gv(s.frames).pipe(Cp(()=>we("closed")),De(c=>i!==void 0?be(i):(c!=="reset"&&c!=="closed"&&(s.bytes-=h1e(c).bytes),we(c)))));return Object.freeze({take:a,checkpoint:(c=-1)=>{r(s),s.lagged=!1,s.observed=c},close:()=>{s.closed||(s.closed=!0,r(s),t.delete(s),Hv(s.frames),t.size===0&&e())}})},publish(o,s=1/0){if(n)return;const a=FSn(o);for(const c of t){if(c.closed||c.lagged||s<=c.observed)continue;const u=c.includeSandboxFailures?o:a,{bytes:l}=h1e(u);c.bytes+l>1048576||!Wf(c.frames,u)?(r(c),c.lagged=!0,Wf(c.frames,"reset")):c.bytes+=l}},end(o){if(!n){n=!0,i=o;for(const s of t)r(s),s.lagged=!1,Hv(s.frames)}}}}function jSn(e,t){for(const n of E4.get(e)??[])if(n.observes(t))return!0;return!1}function WSn(e,t){return e==="closed"||t==="closed"?"closed":e==="reset"||t==="reset"?"reset":e==="durable"||t==="durable"?"durable":e==="activity"||t==="activity"?"activity":"progress"}function zSn(e,t){if(e.pendingCount>=rft){e.pendingCount=0,e.pendingReason=void 0,e.reset=!0;return}e.pendingCount+=1,e.pendingReason=e.pendingReason==="durable"||t==="durable"?"durable":e.pendingReason==="activity"||t==="activity"?"activity":"progress"}function tft(e,t){if(e.closed||(e.revision+=1,e.reset))return;const n=e.wake;if(n===void 0){zSn(e,t);return}e.wake=void 0;try{n(t)}catch(i){Rd("observation-delivery",i),e.pendingCount=0,e.pendingReason=void 0,e.reset=!0}}function nft(e,t){for(const n of e)n.queued&&!n.settlementOnly&&n.sessionId!==t&&tft(n,"activity")}function bo(e,t,n="durable"){const i=E4.get(e);if(i!==void 0)for(const r of i)try{r.publish({kind:"session",sessionId:t,reason:n})}catch(o){Rd("owner-observation-publish",o);continue}}function m1e(e){const t=E4.get(e);if(t!==void 0)for(const n of t)try{n.publish({kind:"agent-execution"})}catch(i){Rd("owner-execution-change-publish",i)}}function qSn(e){const t=new Map,n=new Set,i=E4.get(e)??new Set;let r=!1;const o=u=>{if(u.closed)return"closed";if(u.reset)return u.reset=!1,"reset";if(u.pendingCount===0)return;u.pendingCount=0;const l=u.pendingReason;return u.pendingReason=void 0,l??"progress"},s=u=>{if(u.closed)return;u.closed=!0,u.pendingCount=0,u.pendingReason=void 0,u.reset=!1;const l=u.wake;u.wake=void 0,n.delete(u);const d=t.get(u.sessionId);if(d?.delete(u),d?.size===0&&t.delete(u.sessionId),l!==void 0)try{l("closed")}catch(p){Rd("observation-listener-close",p)}},c={publish:u=>{if(u.kind==="agent-execution"){nft(n,null);return}u.sessionId!==null&&u.reason!=="settlement"&&nft(n,u.sessionId);const l=u.sessionId===null?n:t.get(u.sessionId);if(l!==void 0)for(const d of l)d.settlementOnly&&u.reason!=="settlement"||tft(d,u.reason==="settlement"?"durable":u.reason)},observes:u=>[...t.get(u)??[]].some(l=>!l.closed&&!l.settlementOnly)};return i.add(c),E4.set(e,i),Object.freeze({register:(u,l)=>Ut(()=>{if(r)return be(new Ne("runtime","closed","Shiitake is closed"));if(n.size>=ift)return be(new Ne("runtime","rejected","Observation capacity is exhausted"));const d={revision:0,sessionId:u,settlementOnly:l==="settlement",closed:!1,pendingCount:0,pendingReason:void 0,queued:!0,reset:!1,wake:void 0},p=t.get(u)??new Set;p.add(d),t.set(u,p),n.add(d);const h=nt(()=>o(d)),m=fc(f=>{const g=o(d);if(g!==void 0){f(we(g));return}const y=v=>{f(we(v))};return d.wake=y,nt(()=>{d.wake===y&&(d.wake=void 0)})});return we(Object.freeze({get revision(){return d.revision},pollSignal:h,awaitSignal:m,close:()=>{s(d)},setQueued:f=>{d.closed||(d.queued=f)}}))}),close:nt(()=>{if(!r){r=!0,i.delete(c),i.size===0&&E4.delete(e);for(const u of n)s(u)}})})}var ift,rft,f1e,oft,E4,zf=A({"../../packages/shiitake/dist/internal/observation-kernel.js"(){"use strict";gt(),Pv(),k4(),Ei(),p6(),ift=64,rft=256,f1e=new WeakMap,oft=new TextEncoder,E4=new WeakMap}}),sft,g1e,aft,y1e,v1e,cft,HSn,_1e,GSn,VSn,uft,KSn,JSn=A({"../../packages/shiitake/dist/internal/woodstock/cold-sessions.js"(){"use strict";wt(),Ei(),sft=200,g1e={onExcessProperty:"error"},aft=new TextEncoder,y1e=rt.pipe(Ze(Wt(0))),v1e=te.pipe(Ze(rn(1)),Ze(vn(e=>aft.encode(e).byteLength<=256))),cft=V({limit:Ue(rt.pipe(Ze(Ad({minimum:1,maximum:sft})))),after:Ue(te)}),HSn=It(cft,g1e),_1e=ti(Ka([y1e,v1e])),GSn=It(_1e),VSn=fu(_1e),uft=V({session_id:v1e,last_activity_at:y1e,state:ct(["needs_you","running","errored","done"]),bytes:rt.pipe(Ze(Wt(0)))}),KSn=It(uft,g1e)}});function w1e(e){const t=b9.safeParse(e);return t.success?t.data.author:void 0}function b1e(e){const{id:t,name:n,kind:i}=e;return i===void 0?{author:{id:t,name:n}}:{author:{id:t,name:n,kind:i}}}var lft,A4,dft,b9,QSn=A({"../../packages/agar/dist/agent-message-meta.js"(){"use strict";yt(),lft=Ln(()=>Dr({id:F().min(1).max(256),name:F().min(1).max(128),kind:Ie("agent").optional()})),A4=Ln(()=>F().min(1).max(256)),dft=Ln(()=>Dr({agentId:A4,sessionId:A4,commandId:A4,outcome:wn(["completed","failed","interrupted","cancelled","outcome_unknown"]),diagnostic:F().min(1).max(200).optional(),waitingOnYou:Me(Dr({itemId:A4,kind:F().min(1).max(64),summary:F().min(1).max(200)})).min(1).max(8).optional()})),b9=Dr({author:lft.optional(),sourceRequestId:A4.optional(),delegation:Dr({ancestors:Me(A4).max(8),maxDepth:et().int().min(1).max(8),steer:Ie(!0).optional(),goal:Et([F().min(1).max(4e3),Ie(!1)]).optional(),reply:dft.optional()}).optional()})}}),x1e,pft,XSn,YSn=A({"../../packages/agar/dist/backend-refusal.js"(){"use strict";yt(),x1e=["exec_isolation_required","execution_not_admitted","artifact_unavailable","disabled","timed_out","permission_changed","binding_reply_invalid","backend_error","cancelled","request_too_large","not_offered","internal"],pft=Dr({binding:F().min(1).max(64),method:F().min(1).max(128),path:F().max(256)}),XSn=Dr({error:Ie("App execution unavailable"),reason:wn(x1e),ref:F().min(1).max(64).optional(),where:pft.optional()})}});function ZSn(e){return`This needs ${e??"setup"} first.`}var hft,ekn,tkn,nkn,x9,ikn,rkn=A({"../../packages/agar/dist/errors.js"(){"use strict";wt(),YSn(),hft=["CANCELLED","CAPABILITY_DENIED","CAPABILITY_REVOKED","COMMAND_NOT_DECLARED","CONFLICT","DAILY_LIMIT_REACHED","DELIVERY_PENDING","DISCONNECTED","FILE_TOO_LARGE","HOST_FAILURE","IDENTITY","INSUFFICIENT_CREDIT","INVALID_ARGUMENT","MEDIA_PROVIDER_FAILURE","MEDIA_PROVIDER_FAILURE_UNCHARGED","PROTOCOL","SAFETY_FILTER_REFUSED","SELECTION_CHANGED","SETUP_REQUIRED","TIMEOUT"],ekn=V({name:Ce("AppError"),code:ct(hft),retryable:ai,need:jt(te),reason:jt(te),ref:jt(te),where:jt(Sl)}),tkn=ct(x1e),nkn=V({binding:te,method:te,path:te}),x9=class extends Error{code;retryable;need;reason;ref;where;constructor(e,t){super(e,{cause:t.cause}),this.name="AppError",this.code=t.code,this.retryable=t.retryable,this.need=t.need,this.reason=t.reason,this.ref=t.ref,this.where=t.where}},ikn={CANCELLED:{title:"Request cancelled",message:"It stopped before it finished. Start it again if you still want it."},CAPABILITY_DENIED:{title:"Access needed",message:"This App needs permission to do that.",action:"grant"},CAPABILITY_REVOKED:{title:"Access changed",message:"This App no longer has permission to do that.",action:"grant"},COMMAND_NOT_DECLARED:{title:"Action unavailable",message:"This App doesn't include that action. It may need an update."},CONFLICT:{title:"File changed",message:"This file changed elsewhere. Review it before saving again."},DAILY_LIMIT_REACHED:{title:"Daily limit reached",message:"Today's spending limit for this Oyster is used up. It resets at 00:00 UTC."},DELIVERY_PENDING:{title:"App delivery pending",message:"The App hasn't finished getting ready. Try opening it again."},DISCONNECTED:{title:"Connection lost",message:"Reopen the App to connect again.",action:"reconnect"},HOST_FAILURE:{title:"Couldn't complete the request",message:"The host stopped answering. Reopen the App or reload the workspace."},FILE_TOO_LARGE:{title:"File too large",message:"Choose a file within the supported size limit."},IDENTITY:{title:"Couldn't connect",message:"Reopen the App to connect again.",action:"reconnect"},INSUFFICIENT_CREDIT:{title:"Out of credit",message:"Your Team doesn't have enough credit for this. Add credit to continue.",action:"billing"},INVALID_ARGUMENT:{title:"Request not accepted",message:"Some of the details weren't usable. Check them and try again."},MEDIA_PROVIDER_FAILURE:{title:"Generation failed",message:"The model couldn't complete this generation. Change the prompt or model and send again."},MEDIA_PROVIDER_FAILURE_UNCHARGED:{title:"Generation failed",message:"The model couldn't complete this generation. You weren't charged. Change the prompt or model and send again."},PROTOCOL:{title:"Couldn't read the response",message:"The host sent something this App doesn't understand. Reload the workspace; if it keeps happening, the App may need an update."},SAFETY_FILTER_REFUSED:{title:"Generation refused",message:"The model refused this generation. Change the prompt or reference image and send again."},SELECTION_CHANGED:{title:"Selection changed",message:"The selection changed during this request. Reopen the App to continue.",action:"reconnect"},SETUP_REQUIRED:{title:"Setup needed",message:ZSn(void 0),action:"setup"},TIMEOUT:{title:"Still waiting",message:"The request didn't respond in time. Its outcome isn't known yet."},UNKNOWN:{title:"Something went wrong",message:"The App couldn't complete this request."}}}});function L0(e,t,n){return new mft(e,t,n)}var mft,okn=A({"../../packages/agar/dist/capabilities.js"(){"use strict";mft=class{id;version;#e;constructor(e,t,n){this.id=e,this.version=t,this.#e=n,Object.freeze(this)}get schema(){return this.#e}}}});function h6(e){switch(typeof e){case"boolean":case"number":case"string":return"primitive";case"undefined":return"undefined";case"object":case"function":break;case"bigint":return"bigint";default:return"unsupported"}if(e===null)return"primitive";let t=Object.getPrototypeOf(e);switch(t){case Object.prototype:return"object";case Function.prototype:case bft.prototype:return"function";case Array.prototype:return"array";case Date.prototype:return"date";case Uint8Array.prototype:case xft:case ArrayBuffer.prototype:case DataView.prototype:case Int8Array.prototype:case Uint8ClampedArray.prototype:case Int16Array.prototype:case Uint16Array.prototype:case Int32Array.prototype:case Uint32Array.prototype:case BigInt64Array.prototype:case BigUint64Array.prototype:case Float32Array.prototype:case Float64Array.prototype:return"bytes";case WritableStream.prototype:return"writable";case ReadableStream.prototype:return"readable";case URL.prototype:return"url";case Headers.prototype:return"headers";case Request.prototype:return"request";case Response.prototype:return"response";case Blob.prototype:return"blob";case $0.prototype:return"stub";case wa.prototype:return"rpc-promise";default:if($w){if(t==$w.RpcStub.prototype||e instanceof $w.ServiceStub)return"rpc-target";if(t==$w.RpcPromise.prototype||t==$w.RpcProperty.prototype)return"rpc-thenable"}return e instanceof E9?"rpc-target":e instanceof Error?"error":"unsupported"}}function fft(){throw new Error("RPC map() implementation was not loaded.")}function S1e(){throw new Error("Stream implementation was not loaded.")}function skn(e,t){let n=T9;T9=e;try{return t()}finally{T9=n}}function akn(e){let{hook:t,pathIfPromise:n}=e[lm];return n&&n.length>0?t.get(n):t}function ckn(e){let{hook:t,pathIfPromise:n}=e[lm];return n?t.get(n):t.dup()}function k1e(e){let{hook:t,pathIfPromise:n}=e[lm];if(!(n&&n.length>0))return t}function gft(e){return e[lm].hook}function S9(e){return e[lm]}async function E1e(e){let{hook:t,pathIfPromise:n}=e[lm];return n.length>0&&(t=t.get(n)),(await t.pull()).deliverResolve()}function A1e(e,t,n,i){for(let r=0;r<n.length;r++){t=e;let o=n[r];if(o in Object.prototype){e=void 0;continue}switch(h6(e)){case"object":case"function":Object.hasOwn(e,o)?e=e[o]:e=void 0;break;case"array":Number.isInteger(o)&&o>=0?e=e[o]:e=void 0;break;case"rpc-target":case"rpc-thenable":if(Object.hasOwn(e,o))throw new TypeError(`Attempted to access property '${o}', which is an instance property of the RpcTarget. To avoid leaking private internals, instance properties cannot be accessed over RPC. If you want to make this property available over RPC, define it as a method or getter on the class, instead of an instance property.`);e=e[o],i=null;break;case"stub":case"rpc-promise":{let{hook:s,pathIfPromise:a}=S9(e);return{hook:s,remainingPath:a?a.concat(n.slice(r)):n.slice(r)}}case"writable":e=void 0;break;case"readable":e=void 0;break;case"primitive":case"bigint":case"bytes":case"blob":case"date":case"error":case"url":case"headers":case"request":case"response":e=void 0;break;case"undefined":e=e[o];break;case"unsupported":if(r===0)throw new TypeError("RPC stub points at a non-serializable type.");{let s=n.slice(0,r).join("."),a=n.slice(0,r).join(".");throw new TypeError(`'${s}' is not a serializable type, so property ${a} cannot be accessed.`)}default:throw new TypeError("unreachable")}}if(e instanceof wa){let{hook:r,pathIfPromise:o}=S9(e);return{hook:r,remainingPath:o||[]}}return{value:e,parent:t,owner:i}}function yft(e){if(Symbol.dispose in e)try{e[Symbol.dispose]()}catch(t){Promise.reject(t)}}function ukn(e){return kft.includes(e)}function vft(e,t){if(t!==2&&t!==4&&t!==8)throw new RangeError(`Unsupported element size: ${t}`);let n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let i=0;i<e.byteLength;i+=t)switch(t){case 2:n.setUint16(i,n.getUint16(i,!1),!0);break;case 4:n.setUint32(i,n.getUint32(i,!1),!0);break;case 8:n.setBigUint64(i,n.getBigUint64(i,!1),!0)}}async function lkn(e,t){let n=await new Response(e).blob();return n.type===t?n:n.slice(0,n.size,t)}function dkn(e,t){let n=new Response(t).arrayBuffer().then(i=>{let r=new Uint8Array(i),o=new Request(e,{body:r});return new kl(Hc.fromAppReturn(o))});return new wa(new f6(n),[])}function pkn(e,t){let n=lkn(e,t).then(i=>new kl(Hc.fromAppReturn(i)));return new wa(new f6(n),[])}function m6(e){return 2+e.length*3}function Zq(e,t,n=0){if(n>=Cft)return g6;switch(typeof e){case"string":return m6(e);case"number":return 16;case"bigint":return 16;case"boolean":return 8;case"undefined":return 16;case"object":{if(e===null)return 8;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)return nH+e.byteLength;if(typeof Blob<"u"&&e instanceof Blob)return nH+e.size;if(e instanceof Date)return 16;if(t??=new WeakSet,t.has(e))return g6;if(t.add(e),e instanceof Array){let r=tH;for(let o of e)r+=g6+Zq(o,t,n+1);return r}if(e instanceof Error){let r=tH+m6(e.name)+m6(e.message)+m6(e.stack??"");for(let o of Object.keys(e))r+=g6+m6(o)+Zq(e[o],t,n+1);return r}let i=tH;for(let r of Object.keys(e))i+=g6+m6(r)+Zq(e[r],t,n+1);return i}default:return 16}}function hkn(e,t,n){typeof e=="string"&&(e=new WebSocket(e));let i=new Pft(e);return new M1e(i,t,n).getRemoteMain()}function k9(){throw new Error("Attempted to use an abstract placeholder from a mapper function. Please make sure your map function has no side effects.")}function _ft(e,t,n,i,r){let o=new kl(Hc.deepCopyFrom(e,t,n)),s=new Dft(i,o);try{return s.apply(r)}finally{s.dispose()}}function mkn(e){let t,n=!1,i=new Wft(()=>performance.now()),r,o;const s=()=>{n||(n=!0,e.dispose())};return new WritableStream({start(a){e.onBroken(c=>{t===void 0&&(t=c,a.error(c),s()),o&&(o(c),r=void 0,o=void 0)})},write(a,c){if(t!==void 0)throw t;const u=Hc.fromAppParams([a]),{promise:l,size:d}=e.stream(["write"],u);if(d===void 0)return l.catch(p=>{throw t===void 0&&(t=p),p});{let{token:p,shouldBlock:h}=i.onSend(d);if(l.then(()=>{i.onAck(p)&&r&&(r(),r=void 0,o=void 0)},m=>{i.onError(p),t===void 0&&(t=m,c.error(m),s()),o&&(o(m),r=void 0,o=void 0)}),h)return new Promise((m,f)=>{r=m,o=f})}},async close(){if(t!==void 0)throw s(),t;const{promise:a}=e.stream(["close"],Hc.fromAppParams([]));try{await a}catch(c){throw t??c}finally{s()}},abort(a){if(t!==void 0)return;t=a??new Error("WritableStream was aborted"),o&&(o(t),r=void 0,o=void 0);const{promise:c}=e.stream(["abort"],Hc.fromAppParams([a]));c.then(()=>s(),()=>s())}})}function fkn(e,t){return{open(n){let i=new Gft(n);n.data={__capnwebTransport:i,__capnwebStub:new M1e(i,e(),t).getRemoteMain()}},message(n,i){n.data.__capnwebTransport.dispatchMessage(i)},close(n,i,r){n.data.__capnwebTransport.dispatchClose(i,r)},error(n,i){n.data.__capnwebTransport.dispatchError(i)}}}var wft,$w,E9,bft,xft,A9,qc,N0,Wu,T1e,T9,lm,Sft,$0,wa,Hc,I1e,kl,T4,f6,eH,C1e,kft,R1e,O1e,P1e,Eft,Aft,Tft,U0,Ift,gkn,Vv,tH,g6,nH,Cft,Uw,Fw,Rft,Oft,M1e,Pft,I4,Mft,y6,Dft,Lft,Nft,$ft,Uft,Fft,D1e,Bft,jft,Wft,zft,qft,Hft,Gft,L1e=A({"../../forks/capnweb/dist/index-bun.js"(){"use strict";wft=Symbol("workers-module"),Symbol.dispose||(Symbol.dispose=Symbol.for("dispose")),Symbol.asyncDispose||(Symbol.asyncDispose=Symbol.for("asyncDispose")),Promise.withResolvers||(Promise.withResolvers=function(){let e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}),$w=globalThis[wft],E9=$w?$w.RpcTarget:class{},bft=async function(){}.constructor,xft=typeof Buffer<"u"?Buffer.prototype:void 0,A9={applyMap:fft,sendMap:fft},qc={createWritableStreamHook:S1e,createWritableStreamFromHook:S1e,createReadableStreamHook:S1e},N0=class{stream(e,t){let n=this.call(e,t),i;try{i=n.pull()}catch(o){throw n.dispose(),o}let r;return i instanceof Promise?r=i.then(o=>{o.dispose()}):(i.dispose(),r=Promise.resolve()),{promise:r}}},Wu=class extends N0{error;constructor(e){super(),this.error=e}call(e,t){return t.dispose(),this}map(e,t,n){for(let i of t)i.dispose();return this}get(e){return this}dup(){return this}pull(){return Promise.reject(this.error)}ignoreUnhandledRejections(){}dispose(){}onBroken(e){try{e(this.error)}catch(t){Promise.resolve(t)}}},T1e=new Wu(new Error("Attempted to use RPC stub after it has been disposed.")),T9=(e,t,n)=>e.call(t,n),lm=Symbol("realStub"),Sft={apply(e,t,n){let i=e.raw;return new wa(T9(i.hook,i.pathIfPromise||[],Hc.fromAppParams(n)),[])},get(e,t,n){let i=e.raw;return t===lm?i:t in wa.prototype?i[t]:typeof t=="string"?new wa(i.hook,i.pathIfPromise?[...i.pathIfPromise,t]:[t]):t===Symbol.dispose&&(!i.pathIfPromise||i.pathIfPromise.length==0)?()=>{i.hook.dispose(),i.hook=T1e}:void 0},has(e,t){let n=e.raw;return t===lm?!0:t in wa.prototype?t in n:typeof t=="string"?!0:t===Symbol.dispose&&(!n.pathIfPromise||n.pathIfPromise.length==0)},construct(e,t){throw new Error("An RPC stub cannot be used as a constructor.")},defineProperty(e,t,n){throw new Error("Can't define properties on RPC stubs.")},deleteProperty(e,t){throw new Error("Can't delete properties on RPC stubs.")},getOwnPropertyDescriptor(e,t){},getPrototypeOf(e){return Object.getPrototypeOf(e.raw)},isExtensible(e){return!1},ownKeys(e){return[]},preventExtensions(e){return!0},set(e,t,n,i){throw new Error("Can't assign properties on RPC stubs.")},setPrototypeOf(e,t){throw new Error("Can't override prototype of RPC stubs.")}},$0=class XBe extends E9{constructor(t,n){if(super(),!(t instanceof N0)){let r=t;if(r instanceof E9||r instanceof Function?t=T4.create(r,void 0):t=new kl(Hc.fromAppReturn(r)),n)throw new TypeError("RpcStub constructor expected one argument, received two.")}this.hook=t,this.pathIfPromise=n;let i=()=>{};return i.raw=this,new Proxy(i,Sft)}hook;pathIfPromise;dup(){let t=this[lm];return t.pathIfPromise?new XBe(t.hook.get(t.pathIfPromise)):new XBe(t.hook.dup())}onRpcBroken(t){this[lm].hook.onBroken(t)}map(t){let{hook:n,pathIfPromise:i}=this[lm];return A9.sendMap(n,i||[],t)}toString(){return"[object RpcStub]"}},wa=class extends $0{constructor(e,t){if(e instanceof N0)super(e,t??[]);else{if(t!==void 0)throw new TypeError("RpcPromise constructor expected one argument, received two.");let n=h6(e);if(n==="rpc-promise"){let i=S9(e);if(i.pathIfPromise.length>0)super(i.hook,i.pathIfPromise);else{let r=i.hook;i.hook=T1e,super(r,[])}}else if(n==="rpc-thenable")super(T4.create(e,void 0),[]);else{let i=new f6(Promise.resolve(e).then(r=>new kl(Hc.fromAppReturn(r))));i.ignoreUnhandledRejections(),super(i,[])}}}then(e,t){return E1e(this).then(...arguments)}catch(e){return E1e(this).catch(...arguments)}finally(e){return E1e(this).finally(...arguments)}toString(){return"[object RpcPromise]"}},Hc=class Ch{value;source;hooks;promises;static fromAppParams(t){return new Ch(t,"params")}static fromAppReturn(t){return new Ch(t,"return")}static fromArray(t){let n=[],i=[],r=[];for(let o of t){o.ensureDeepCopied();for(let s of o.hooks)n.push(s);for(let s of o.promises)s.parent===o&&(s={parent:r,property:r.length,promise:s.promise}),i.push(s);r.push(o.value)}return new Ch(r,"owned",n,i)}static forEvaluate(t,n){return new Ch(null,"owned",t,n)}static deepCopyFrom(t,n,i){let r=new Ch(null,"owned",[],[]);return r.value=r.deepCopy(t,n,"value",r,!0,i),r}constructor(t,n,i,r){this.value=t,this.source=n,this.hooks=i,this.promises=r}rpcTargets;getHookForRpcTarget(t,n,i=!0){if(this.source==="params"){if(i){let r=t;typeof r.dup=="function"&&(t=r.dup())}return T4.create(t,n)}else if(this.source==="return"){let r=this.rpcTargets?.get(t);return r?i?r.dup():(this.rpcTargets?.delete(t),r):(r=T4.create(t,n),i?(this.rpcTargets||(this.rpcTargets=new Map),this.rpcTargets.set(t,r),r.dup()):r)}else throw new Error("owned payload shouldn't contain raw RpcTargets")}getHookForWritableStream(t,n,i=!0){if(this.source==="params")return qc.createWritableStreamHook(t);if(this.source==="return"){let r=this.rpcTargets?.get(t);return r?i?r.dup():(this.rpcTargets?.delete(t),r):(r=qc.createWritableStreamHook(t),i?(this.rpcTargets||(this.rpcTargets=new Map),this.rpcTargets.set(t,r),r.dup()):r)}else throw new Error("owned payload shouldn't contain raw WritableStreams")}getHookForReadableStream(t,n,i=!0){if(this.source==="params")return qc.createReadableStreamHook(t);if(this.source==="return"){let r=this.rpcTargets?.get(t);return r?i?r.dup():(this.rpcTargets?.delete(t),r):(r=qc.createReadableStreamHook(t),i?(this.rpcTargets||(this.rpcTargets=new Map),this.rpcTargets.set(t,r),r.dup()):r)}else throw new Error("owned payload shouldn't contain raw ReadableStreams")}deepCopy(t,n,i,r,o,s){switch(h6(t)){case"unsupported":return t;case"primitive":case"bigint":case"date":case"bytes":case"blob":case"url":case"error":case"undefined":return t;case"array":{let a=t,c=a.length,u=new Array(c);for(let l=0;l<c;l++)u[l]=this.deepCopy(a[l],a,l,u,o,s);return u}case"object":{let a={},c=t;for(let u in c)a[u]=this.deepCopy(c[u],c,u,a,o,s);return a}case"stub":case"rpc-promise":{let a=t,c;if(o?c=ckn(a):c=akn(a),a instanceof wa){let u=new wa(c,[]);return this.promises.push({parent:r,property:i,promise:u}),u}else return this.hooks.push(c),new $0(c)}case"function":case"rpc-target":{let a=t,c;return s?c=s.getHookForRpcTarget(a,n,o):c=T4.create(a,n),this.hooks.push(c),new $0(c)}case"rpc-thenable":{let a=t,c;return s?c=new wa(s.getHookForRpcTarget(a,n,o),[]):c=new wa(T4.create(a,n),[]),this.promises.push({parent:r,property:i,promise:c}),c}case"writable":{let a=t,c;return s?c=s.getHookForWritableStream(a,n,o):c=qc.createWritableStreamHook(a),this.hooks.push(c),a}case"readable":{let a=t,c;return s?c=s.getHookForReadableStream(a,n,o):c=qc.createReadableStreamHook(a),this.hooks.push(c),a}case"headers":return new Headers(t);case"request":{let a=t;return a.body&&this.deepCopy(a.body,a,"body",a,o,s),new Request(a)}case"response":{let a=t;return a.body&&this.deepCopy(a.body,a,"body",a,o,s),new Response(a.body,a)}default:throw new Error("unreachable")}}ensureDeepCopied(){if(this.source!=="owned"){let t=this.source==="params";this.hooks=[],this.promises=[];try{this.value=this.deepCopy(this.value,void 0,"value",this,t,this)}catch(n){throw this.hooks=void 0,this.promises=void 0,n}if(this.source="owned",this.rpcTargets&&this.rpcTargets.size>0)throw new Error("Not all rpcTargets were accounted for in deep-copy?");this.rpcTargets=void 0}}deliverTo(t,n,i){if(this.ensureDeepCopied(),this.value instanceof wa)Ch.deliverRpcPromiseTo(this.value,t,n,i);else{t[n]=this.value;for(let r of this.promises)Ch.deliverRpcPromiseTo(r.promise,r.parent,r.property,i)}}static deliverRpcPromiseTo(t,n,i,r){let o=k1e(t);if(!o)throw new Error("property promises should have been resolved earlier");let s=o.pull();s instanceof Ch?s.deliverTo(n,i,r):r.push(s.then(a=>{let c=[];if(a.deliverTo(n,i,c),c.length>0)return Promise.all(c)}))}async deliverCall(t,n){try{let i=[];this.deliverTo(this,"value",i),i.length>0&&await Promise.all(i);let r=Function.prototype.apply.call(t,n,this.value);return r instanceof wa?Ch.fromAppReturn(r):Ch.fromAppReturn(await r)}finally{this.dispose()}}async deliverStreamWrite(t){try{let n=[];this.deliverTo(this,"value",n),n.length>0&&await Promise.all(n);let i=this.value[0];return(this.hooks.length>0||this.promises.length>0)&&i instanceof Object?(Symbol.dispose in i||Object.defineProperty(i,Symbol.dispose,{value:()=>this.dispose(),writable:!0,enumerable:!1,configurable:!0}),await t.write(i),Ch.fromAppReturn(void 0)):(await t.write(i),this.dispose(),Ch.fromAppReturn(void 0))}catch(n){throw this.dispose(),n}}async deliverResolve(){try{let t=[];this.deliverTo(this,"value",t),t.length>0&&await Promise.all(t);let n=this.value;return n instanceof Object&&(Symbol.dispose in n||Object.defineProperty(n,Symbol.dispose,{value:()=>this.dispose(),writable:!0,enumerable:!1,configurable:!0})),n}catch(t){throw this.dispose(),t}}dispose(){if(this.source==="owned")this.hooks.forEach(t=>t.dispose()),this.promises.forEach(t=>t.promise[Symbol.dispose]());else if(this.source==="return"&&(this.disposeImpl(this.value,void 0),this.rpcTargets&&this.rpcTargets.size>0))throw new Error("Not all rpcTargets were accounted for in disposeImpl()?");this.source="owned",this.hooks=[],this.promises=[]}disposeImpl(t,n){switch(h6(t)){case"unsupported":case"primitive":case"bigint":case"bytes":case"blob":case"date":case"url":case"error":case"undefined":return;case"array":{let i=t,r=i.length;for(let o=0;o<r;o++)this.disposeImpl(i[o],i);return}case"object":{let i=t;for(let r in i)this.disposeImpl(i[r],i);return}case"stub":case"rpc-promise":{let i=k1e(t);i&&i.dispose();return}case"function":case"rpc-target":{let i=t,r=this.rpcTargets?.get(i);r?(r.dispose(),this.rpcTargets.delete(i)):yft(i);return}case"rpc-thenable":return;case"headers":return;case"request":{let i=t;i.body&&this.disposeImpl(i.body,i);return}case"response":{let i=t;i.body&&this.disposeImpl(i.body,i);return}case"writable":{let i=t,r=this.rpcTargets?.get(i);r?this.rpcTargets.delete(i):r=qc.createWritableStreamHook(i),r.dispose();return}case"readable":{let i=t,r=this.rpcTargets?.get(i);r?this.rpcTargets.delete(i):r=qc.createReadableStreamHook(i),r.dispose();return}default:return}}ignoreUnhandledRejections(){this.hooks?(this.hooks.forEach(t=>{t.ignoreUnhandledRejections()}),this.promises.forEach(t=>gft(t.promise).ignoreUnhandledRejections())):this.ignoreUnhandledRejectionsImpl(this.value)}ignoreUnhandledRejectionsImpl(t){switch(h6(t)){case"unsupported":case"primitive":case"bigint":case"bytes":case"blob":case"date":case"error":case"undefined":case"function":case"rpc-target":case"writable":case"readable":case"url":case"headers":case"request":case"response":return;case"array":{let n=t,i=n.length;for(let r=0;r<i;r++)this.ignoreUnhandledRejectionsImpl(n[r]);return}case"object":{let n=t;for(let i in n)this.ignoreUnhandledRejectionsImpl(n[i]);return}case"stub":case"rpc-promise":gft(t).ignoreUnhandledRejections();return;case"rpc-thenable":t.then(n=>{},n=>{});return;default:return}}},I1e=class extends N0{call(e,t){let n;try{let{value:r,owner:o}=this.getValue();n=A1e(r,void 0,e,o)}catch(r){return t.dispose(),new Wu(r)}if(n.hook)return n.hook.call(n.remainingPath,t);if(typeof n.value!="function")return t.dispose(),new Wu(new TypeError(`'${e.join(".")}' is not a function.`));let i=t.deliverCall(n.value,n.parent);return new f6(i.then(r=>new kl(r)))}map(e,t,n){try{let i;try{let{value:r,owner:o}=this.getValue();i=A1e(r,void 0,e,o)}catch(r){for(let o of t)o.dispose();throw r}return i.hook?i.hook.map(i.remainingPath,t,n):A9.applyMap(i.value,i.parent,i.owner,t,n)}catch(i){return new Wu(i)}}get(e){try{let{value:t,owner:n}=this.getValue();if(e.length===0&&n===null){if(t instanceof Object&&"then"in t)return this.dup();throw new Error("Can't dup an RpcTarget stub as a promise.")}let i=A1e(t,void 0,e,n);return i.hook?i.hook.get(i.remainingPath):new kl(Hc.deepCopyFrom(i.value,i.parent,i.owner))}catch(t){return new Wu(t)}}},kl=class R0n extends I1e{constructor(t){super(),this.payload=t}payload;getPayload(){if(this.payload)return this.payload;throw new Error("Attempted to use an RPC StubHook after it was disposed.")}getValue(){let t=this.getPayload();return{value:t.value,owner:t}}dup(){let t=this.getPayload();return new R0n(Hc.deepCopyFrom(t.value,void 0,t))}pull(){return this.getPayload()}ignoreUnhandledRejections(){this.payload&&this.payload.ignoreUnhandledRejections()}dispose(){this.payload&&(this.payload.dispose(),this.payload=void 0)}onBroken(t){this.payload&&this.payload.value instanceof $0&&this.payload.value.onRpcBroken(t)}},T4=class YBe extends I1e{static create(t,n){return typeof t!="function"&&(n=void 0),new YBe(t,n)}constructor(t,n,i){super(),this.target=t,this.parent=n,i?i.refcount&&(this.refcount=i.refcount,++this.refcount.count):Symbol.dispose in t&&(this.refcount={count:1})}target;parent;refcount;getTarget(){if(this.target)return this.target;throw new Error("Attempted to use an RPC StubHook after it was disposed.")}getValue(){return{value:this.getTarget(),owner:null}}dup(){return new YBe(this.getTarget(),this.parent,this)}pull(){let t=this.getTarget();return"then"in t?Promise.resolve(t).then(n=>Hc.fromAppReturn(n)):Promise.reject(new Error("Tried to resolve a non-promise stub."))}ignoreUnhandledRejections(){}dispose(){this.target&&(this.refcount&&--this.refcount.count==0&&yft(this.target),this.target=void 0)}onBroken(t){let n=this.target;n&&"then"in n&&Promise.resolve(n).then(()=>{},t)}},f6=class mU extends N0{promise;resolution;constructor(t){super(),this.promise=t.then(n=>(this.resolution=n,n))}call(t,n){return n.ensureDeepCopied(),new mU(this.promise.then(i=>i.call(t,n),i=>{throw n.dispose(),i}))}stream(t,n){return n.ensureDeepCopied(),{promise:this.promise.then(i=>i.stream(t,n).promise,i=>{throw n.dispose(),i})}}map(t,n,i){return new mU(this.promise.then(r=>r.map(t,n,i),r=>{for(let o of n)o.dispose();throw r}))}get(t){return new mU(this.promise.then(n=>n.get(t)))}dup(){return this.resolution?this.resolution.dup():new mU(this.promise.then(t=>t.dup()))}pull(){return this.resolution?this.resolution.pull():this.promise.then(t=>t.pull())}ignoreUnhandledRejections(){this.resolution?this.resolution.ignoreUnhandledRejections():this.promise.then(t=>{t.ignoreUnhandledRejections()},t=>{})}dispose(){this.promise.then(t=>t.dispose(),()=>{})}onBroken(t){this.resolution?this.resolution.onBroken(t):this.promise.then(n=>{n.onBroken(t)},t)}},eH={maxBigIntDigits:16384,maxDepth:256,maxMessageSize:33554432},C1e=new Uint8Array(new Uint16Array([1]).buffer)[0]===1,kft=["ArrayBuffer","DataView","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","BigInt64Array","BigUint64Array","Float32Array","Float64Array"],R1e={ArrayBuffer:void 0,DataView:void 0,Int8Array:void 0,Uint8Array:void 0,Uint8ClampedArray:void 0,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,BigInt64Array:8,BigUint64Array:8,Float32Array:4,Float64Array:8},O1e={ArrayBuffer:ArrayBuffer.prototype,DataView:DataView.prototype,Int8Array:Int8Array.prototype,Uint8ClampedArray:Uint8ClampedArray.prototype,Int16Array:Int16Array.prototype,Uint16Array:Uint16Array.prototype,Int32Array:Int32Array.prototype,Uint32Array:Uint32Array.prototype,BigInt64Array:BigInt64Array.prototype,BigUint64Array:BigUint64Array.prototype,Float32Array:Float32Array.prototype,Float64Array:Float64Array.prototype},P1e=new Map;for(let e of Object.keys(O1e))P1e.set(O1e[e],e);Eft=class{exportStub(e){throw new Error("Cannot serialize RPC stubs without an RPC session.")}exportPromise(e){throw new Error("Cannot serialize RPC stubs without an RPC session.")}getImport(e){}unexport(e){}createPipe(e){throw new Error("Cannot create pipes without an RPC session.")}onSendError(e){}},Aft=new Eft,Tft={__proto__:null,Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError},U0=class O0n{exporter;source;encodingLevel;constructor(t,n,i){this.exporter=t,this.source=n,this.encodingLevel=i}static devaluate(t,n,i=Aft,r,o="string"){let s=new O0n(i,r,o);try{return s.devaluateImpl(t,n,0)}catch(a){if(s.exports)try{i.unexport(s.exports)}catch{}throw a}}exports;devaluateImpl(t,n,i){if(i>=256)throw new Error("Serialization exceeded maximum allowed depth. (Does the message contain cycles?)");switch(h6(t)){case"unsupported":{let r;try{r=`Cannot serialize value: ${t}`}catch{r="Cannot serialize value: (couldn't stringify value)"}throw new TypeError(r)}case"primitive":return typeof t=="number"&&!isFinite(t)?this.encodingLevel==="structuredClonable"?t:t===1/0?["inf"]:t===-1/0?["-inf"]:["nan"]:t;case"object":{let r=t,o={};for(let s in r)o[s]=this.devaluateImpl(r[s],r,i+1);return o}case"array":{let r=t,o=r.length,s=new Array(o);for(let a=0;a<o;a++)s[a]=this.devaluateImpl(r[a],r,i+1);return[s]}case"bigint":return this.encodingLevel==="structuredClonable"?t:["bigint",t.toString()];case"date":{if(this.encodingLevel==="structuredClonable")return t;const r=t.getTime();return["date",Number.isNaN(r)?null:r]}case"bytes":{let r=P1e.get(Object.getPrototypeOf(t)),o;if(r==="ArrayBuffer")o=new Uint8Array(t);else if(r===void 0)o=t;else{let a=t;o=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);let c=R1e[r];!C1e&&c&&(o=o.slice(),vft(o,c))}if(this.encodingLevel==="structuredClonable"||this.encodingLevel==="jsonCompatibleWithBytes")return r===void 0?["bytes",o]:["bytes",o,r];let s;if(o.toBase64)s=o.toBase64({omitPadding:!0});else if(typeof Buffer<"u")s=(o instanceof Buffer?o:Buffer.from(o.buffer,o.byteOffset,o.byteLength)).toString("base64");else{let a="";for(let c=0;c<o.length;c++)a+=String.fromCharCode(o[c]);s=btoa(a)}return s=s.replace(/=+$/,""),r===void 0?["bytes",s]:["bytes",s,r]}case"url":return["url",t.href];case"headers":return["headers",[...t]];case"request":{let r=t,o={};r.method!=="GET"&&(o.method=r.method);let s=[...r.headers];if(s.length>0&&(o.headers=s),r.body)o.body=this.devaluateImpl(r.body,r,i+1),o.duplex=r.duplex||"half";else if(r.body===void 0&&!["GET","HEAD","OPTIONS","TRACE","DELETE"].includes(r.method)){let c=r.arrayBuffer(),u=new ReadableStream({async start(d){try{d.enqueue(new Uint8Array(await c)),d.close()}catch(p){d.error(p)}}}),l=qc.createReadableStreamHook(u);o.body=["readable",this.exporter.createPipe(u,l)],o.duplex=r.duplex||"half"}r.cache&&r.cache!=="default"&&(o.cache=r.cache),r.redirect!=="follow"&&(o.redirect=r.redirect),r.integrity&&(o.integrity=r.integrity),r.mode&&r.mode!=="cors"&&(o.mode=r.mode),r.credentials&&r.credentials!=="same-origin"&&(o.credentials=r.credentials),r.referrer&&r.referrer!=="about:client"&&(o.referrer=r.referrer),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.keepalive&&(o.keepalive=r.keepalive);let a=r;return a.cf&&(o.cf=a.cf),a.encodeResponseBody&&a.encodeResponseBody!=="automatic"&&(o.encodeResponseBody=a.encodeResponseBody),["request",r.url,o]}case"response":{let r=t,o=this.devaluateImpl(r.body,r,i+1),s={};r.status!==200&&(s.status=r.status),r.statusText&&(s.statusText=r.statusText);let a=[...r.headers];a.length>0&&(s.headers=a);let c=r;if(c.cf&&(s.cf=c.cf),c.encodeBody&&c.encodeBody!=="automatic"&&(s.encodeBody=c.encodeBody),c.webSocket)throw new TypeError("Can't serialize a Response containing a webSocket.");return["response",o,s]}case"blob":{let r=t,o=r.stream(),s=qc.createReadableStreamHook(o),a=this.exporter.createPipe(o,s);return["blob",r.type,["readable",a]]}case"error":{let r=t,o=this.exporter.onSendError(r);o&&(r=o);let s=r,a,c=(l,d)=>{let p=this.exports?.length??0;try{let h=this.devaluateImpl(d,r,i+1);a||(a={}),a[l]=h}catch{if(this.exports&&this.exports.length>p){let m=this.exports.splice(p);try{this.exporter.unexport(m)}catch{}}}};for(let l of Object.keys(r))l==="name"||l==="message"||l==="stack"||c(l,s[l]);"cause"in r&&c("cause",s.cause),r instanceof AggregateError&&c("errors",r.errors);let u=["error",r.name,r.message];return a?(u.push(o&&o.stack?o.stack:null),u.push(a)):o&&o.stack&&u.push(o.stack),u}case"undefined":return this.encodingLevel==="structuredClonable"?void 0:["undefined"];case"stub":case"rpc-promise":{if(!this.source)throw new Error("Can't serialize RPC stubs in this context.");let{hook:r,pathIfPromise:o}=S9(t),s=this.exporter.getImport(r);return s!==void 0?o?o.length>0?["pipeline",s,o]:["pipeline",s]:["import",s]:(o?r=r.get(o):r=r.dup(),this.devaluateHook(o?"promise":"export",r))}case"function":case"rpc-target":{if(!this.source)throw new Error("Can't serialize RPC stubs in this context.");let r=this.source.getHookForRpcTarget(t,n);return this.devaluateHook("export",r)}case"rpc-thenable":{if(!this.source)throw new Error("Can't serialize RPC stubs in this context.");let r=this.source.getHookForRpcTarget(t,n);return this.devaluateHook("promise",r)}case"writable":{if(!this.source)throw new Error("Can't serialize WritableStream in this context.");let r=this.source.getHookForWritableStream(t,n);return this.devaluateHook("writable",r)}case"readable":{if(!this.source)throw new Error("Can't serialize ReadableStream in this context.");let r=t,o=this.source.getHookForReadableStream(r,n);return["readable",this.exporter.createPipe(r,o)]}default:throw new Error("unreachable")}}devaluateHook(t,n){this.exports||(this.exports=[]);let i=t==="promise"?this.exporter.exportPromise(n):this.exporter.exportStub(n);return this.exports.push(i),[t,i]}},Ift=class{importStub(e){throw new Error("Cannot deserialize RPC stubs without an RPC session.")}importPromise(e){throw new Error("Cannot deserialize RPC stubs without an RPC session.")}getExport(e){}getPipeReadable(e){throw new Error("Cannot retrieve pipe readable without an RPC session.")}getLimits(){return eH}},gkn=new Ift,Vv=class P0n{importer;encodingLevel;limits;constructor(t,n="string"){this.importer=t,this.encodingLevel=n,this.limits=t.getLimits()}hooks=[];promises=[];evaluate(t){return this.evaluateWithDepth(t,0)}evaluateWithDepth(t,n){let i=Hc.forEvaluate(this.hooks,this.promises);try{return i.value=this.evaluateImpl(t,i,"value",n),i}catch(r){throw i.dispose(),r}}evaluateCopy(t){return this.evaluate(structuredClone(t))}evaluateImpl(t,n,i,r){let o=this.limits.maxDepth;if(r>=o)throw new TypeError(`Deserialization exceeded maximum allowed message depth of ${o}.`);if(this.encodingLevel==="structuredClonable"&&(t instanceof Date||typeof t=="bigint"))return t;if(t instanceof Array){if(t.length==1&&t[0]instanceof Array){let s=t[0];for(let a=0;a<s.length;a++)s[a]=this.evaluateImpl(s[a],s,a,r+1);return s}else switch(t[0]){case"bigint":if(typeof t[1]=="string"){let s=t[1],a=this.limits.maxBigIntDigits;if(s.length>a)throw new TypeError(`Deserialized bigint exceeds maximum length of ${a} digits.`);return BigInt(s)}break;case"date":if(t[1]===null)return new Date(NaN);if(typeof t[1]=="number")return new Date(t[1]);break;case"bytes":{let s;if(t[1]instanceof Uint8Array)s=t[1];else if(typeof t[1]=="string")if(typeof Buffer<"u")s=Buffer.from(t[1],"base64");else if(Uint8Array.fromBase64)s=Uint8Array.fromBase64(t[1]);else{let l=atob(t[1]),d=l.length;s=new Uint8Array(d);for(let p=0;p<d;p++)s[p]=l.charCodeAt(p)}else break;if(t.length===2)return s;if(typeof t[2]!="string")throw new TypeError(`Unknown bytes type marker type: ${typeof t[2]}`);if(!ukn(t[2])){let l=t[2].slice(0,64);throw new TypeError(`Unknown bytes type marker: ${l}`)}let a=t[2],c=R1e[a];if(c!==void 0&&s.byteLength%c!==0)throw new TypeError(`Invalid byte length ${s.byteLength} for ${a}; expected a multiple of ${c}`);let u=s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength);switch(!C1e&&c!==void 0&&vft(new Uint8Array(u),c),a){case"ArrayBuffer":return u;case"DataView":return new DataView(u);case"Int8Array":return new Int8Array(u);case"Uint8Array":return new Uint8Array(u);case"Uint8ClampedArray":return new Uint8ClampedArray(u);case"Int16Array":return new Int16Array(u);case"Uint16Array":return new Uint16Array(u);case"Int32Array":return new Int32Array(u);case"Uint32Array":return new Uint32Array(u);case"BigInt64Array":return new BigInt64Array(u);case"BigUint64Array":return new BigUint64Array(u);case"Float32Array":return new Float32Array(u);case"Float64Array":return new Float64Array(u)}}case"error":if(t.length>=3&&typeof t[1]=="string"&&typeof t[2]=="string"){let s=Tft[t[1]]||Error,a=s===AggregateError?new s([],t[2]):new s(t[2]);if(typeof t[3]=="string"&&(a.stack=t[3]),t.length>=5){let c=t[4];if(!c||typeof c!="object"||Array.isArray(c))break;let u=a,l=c;for(let d of Object.keys(l))if(!(d==="name"||d==="message"||d==="stack")){if(d in Object.prototype||d==="toJSON"){this.evaluateImpl(l[d],a,d,r+1);continue}u[d]=this.evaluateImpl(l[d],a,d,r+1)}}return a}break;case"undefined":if(t.length===1)return;break;case"inf":return 1/0;case"-inf":return-1/0;case"nan":return NaN;case"url":if(t.length===2&&typeof t[1]=="string")return new URL(t[1]);break;case"headers":if(t.length===2&&t[1]instanceof Array)return new Headers(t[1]);break;case"request":{if(t.length!==3||typeof t[1]!="string")break;let s=t[1],a=t[2];if(typeof a!="object"||a===null)break;if(a.body&&(a.body=this.evaluateImpl(a.body,a,"body",r+1),!(a.body===null||typeof a.body=="string"||a.body instanceof Uint8Array||a.body instanceof ReadableStream)))throw new TypeError("Request body must be of type ReadableStream.");if(a.signal&&(a.signal=this.evaluateImpl(a.signal,a,"signal",r+1),!(a.signal instanceof AbortSignal)))throw new TypeError("Request siganl must be of type AbortSignal.");if(a.headers&&!(a.headers instanceof Array))throw new TypeError("Request headers must be serialized as an array of pairs.");let c=new Request(s,a);if(a.body instanceof ReadableStream&&c.body===void 0){let u=dkn(c,a.body);return this.promises.push({promise:u,parent:n,property:i}),u}else return c}case"response":{if(t.length!==3)break;let s=this.evaluateImpl(t[1],n,i,r+1);if(!(s===null||typeof s=="string"||s instanceof Uint8Array||s instanceof ReadableStream))throw new TypeError("Response body must be of type ReadableStream.");let a=t[2];if(typeof a!="object"||a===null)break;if(a.webSocket)throw new TypeError("Can't deserialize a Response containing a webSocket.");if(a.headers&&!(a.headers instanceof Array))throw new TypeError("Request headers must be serialized as an array of pairs.");return new Response(s,a)}case"blob":{if(t.length!==3||typeof t[1]!="string")break;let s=t[1],a=this.evaluateImpl(t[2],n,i,r+1);if(!(a instanceof ReadableStream))throw new TypeError("Blob content must be serialized as a ReadableStream.");let c=pkn(a,s);return this.promises.push({promise:c,parent:n,property:i}),c}case"import":case"pipeline":{if(t.length<2||t.length>4||typeof t[1]!="number")break;let s=this.importer.getExport(t[1]);if(!s)throw new Error(`no such entry on exports table: ${t[1]}`);let a=t[0]=="pipeline",c=d=>{if(a){let p=new wa(d,[]);return this.promises.push({promise:p,parent:n,property:i}),p}else return this.hooks.push(d),new wa(d,[])};if(t.length==2)return c(a?s.get([]):s.dup());let u=t[2];if(!(u instanceof Array)||!u.every(d=>typeof d=="string"||typeof d=="number"))break;if(t.length==3)return c(s.get(u));let l=t[3];if(!(l instanceof Array))break;return l=new P0n(this.importer).evaluateWithDepth([l],r),c(s.call(u,l))}case"remap":{if(t.length!==5||typeof t[1]!="number"||!(t[2]instanceof Array)||!(t[3]instanceof Array)||!(t[4]instanceof Array))break;let s=this.importer.getExport(t[1]);if(!s)throw new Error(`no such entry on exports table: ${t[1]}`);let a=t[2];if(!a.every(p=>typeof p=="string"||typeof p=="number"))break;let c=t[3].map(p=>{if(!(p instanceof Array)||p.length!==2||p[0]!=="import"&&p[0]!=="export"||typeof p[1]!="number")throw new TypeError(`unknown map capture: ${JSON.stringify(p)}`);if(p[0]==="export")return this.importer.importStub(p[1]);{let h=this.importer.getExport(p[1]);if(!h)throw new Error(`no such entry on exports table: ${p[1]}`);return h.dup()}}),u=t[4],l=s.map(a,c,u),d=new wa(l,[]);return this.promises.push({promise:d,parent:n,property:i}),d}case"export":case"promise":if(typeof t[1]=="number")if(t[0]=="promise"){let s=this.importer.importPromise(t[1]),a=new wa(s,[]);return this.promises.push({parent:n,property:i,promise:a}),a}else{let s=this.importer.importStub(t[1]);return this.hooks.push(s),new $0(s)}break;case"writable":if(typeof t[1]=="number"){let s=this.importer.importStub(t[1]),a=qc.createWritableStreamFromHook(s);return this.hooks.push(s),a}break;case"readable":if(typeof t[1]=="number"){let s=this.importer.getPipeReadable(t[1]),a=qc.createReadableStreamHook(s);return this.hooks.push(a),s}}throw new TypeError(`unknown special value: ${JSON.stringify(t)}`)}else if(t instanceof Object){let s=t;for(let a in s)a in Object.prototype||a==="toJSON"?(this.evaluateImpl(s[a],s,a,r+1),delete s[a]):s[a]=this.evaluateImpl(s[a],s,a,r+1);return s}else return t}},tH=16,g6=8,nH=16,Cft=64,Uw=class{session;importId;constructor(e,t,n){this.session=e,this.importId=t,n&&(this.activePull=Promise.withResolvers())}localRefcount=0;remoteRefcount=1;activePull;resolution;onBrokenRegistrations;resolve(e){if(this.localRefcount==0){e.dispose();return}if(this.resolution=e,this.sendRelease(),this.onBrokenRegistrations){for(let t of this.onBrokenRegistrations){let n=this.session.onBrokenCallbacks[t],i=this.session.onBrokenCallbacks.length;e.onBroken(n),this.session.onBrokenCallbacks[i]===n?delete this.session.onBrokenCallbacks[i]:delete this.session.onBrokenCallbacks[t]}this.onBrokenRegistrations=void 0}this.activePull&&(this.activePull.resolve(),this.activePull=void 0)}async awaitResolution(){return this.activePull||(this.session.sendPull(this.importId),this.activePull=Promise.withResolvers()),await this.activePull.promise,this.resolution.pull()}dispose(){this.resolution?this.resolution.dispose():(this.abort(new Error("RPC was canceled because the RpcPromise was disposed.")),this.sendRelease())}abort(e){if(!this.resolution){if(this.resolution=new Wu(e),this.activePull&&(this.activePull.reject(e),this.activePull=void 0),this.onBrokenRegistrations)for(let t of this.onBrokenRegistrations)delete this.session.onBrokenCallbacks[t];this.onBrokenRegistrations=void 0}}onBroken(e){if(this.resolution)this.resolution.onBroken(e);else{let t=this.session.onBrokenCallbacks.length;this.session.onBrokenCallbacks.push(e),this.onBrokenRegistrations||(this.onBrokenRegistrations=[]),this.onBrokenRegistrations.push(t)}}sendRelease(){this.remoteRefcount>0&&(this.session.sendRelease(this.importId,this.remoteRefcount),this.remoteRefcount=0)}},Fw=class M0n extends N0{isPromise;entry;constructor(t,n){super(),this.isPromise=t,++n.localRefcount,this.entry=n}collectPath(t){return this}getEntry(){if(this.entry)return this.entry;throw new Error("This RpcImportHook was already disposed.")}getEntryTakingOwnership(t){try{return this.getEntry()}catch(n){throw t(),n}}call(t,n){let i=this.getEntryTakingOwnership(()=>n.dispose());return i.resolution?i.resolution.call(t,n):i.session.sendCall(i.importId,t,n)}stream(t,n){let i=this.getEntryTakingOwnership(()=>n.dispose());return i.resolution?i.resolution.stream(t,n):i.session.sendStream(i.importId,t,n)}map(t,n,i){let r=this.getEntryTakingOwnership(()=>{for(let o of n)o.dispose()});return r.resolution?r.resolution.map(t,n,i):r.session.sendMap(r.importId,t,n,i)}get(t){let n=this.getEntry();return n.resolution?n.resolution.get(t):n.session.sendCall(n.importId,t)}dup(){return new M0n(!1,this.getEntry())}pull(){let t=this.getEntry();if(!this.isPromise)throw new Error("Can't pull this hook because it's not a promise hook.");return t.resolution?t.resolution.pull():t.awaitResolution()}ignoreUnhandledRejections(){}dispose(){let t=this.entry;this.entry=void 0,t&&--t.localRefcount===0&&t.dispose()}onBroken(t){this.entry&&this.entry.onBroken(t)}},Rft=class extends Fw{session;constructor(e){super(!1,e),this.session=e.session}dispose(){if(this.session){let e=this.session;this.session=void 0,e.shutdown()}}},Oft=class{transport;options;exports=[];reverseExports=new Map;imports=[];abortReason;cancelReadLoop;nextExportId=-1;onBatchDone;pullCount=0;onBrokenCallbacks=[];encodingLevel;limits;constructor(e,t,n){this.transport=e,this.options=n;let i="string";if("encodingLevel"in e){let r=e.encodingLevel;if(r!==void 0){if(r!=="string"&&r!=="jsonCompatible"&&r!=="jsonCompatibleWithBytes"&&r!=="structuredClonable")throw new TypeError(`Unknown transport encodingLevel: ${String(r)}`);i=r}}this.encodingLevel=i,this.limits={...eH,...n.limits},this.exports.push({hook:t,refcount:1}),this.imports.push(new Uw(this,0,!1)),this.readLoop().catch(r=>this.abort(r))}getMainImport(){return new Rft(this.imports[0])}shutdown(){this.abort(new Error("RPC session was shut down by disposing the main stub"),!1)}exportStub(e){if(this.abortReason)throw this.abortReason;let t=this.reverseExports.get(e);if(t!==void 0)return++this.exports[t].refcount,t;{let n=this.nextExportId--;return this.exports[n]={hook:e,refcount:1},this.reverseExports.set(e,n),this.watchExport(n,e),n}}exportPromise(e){if(this.abortReason)throw this.abortReason;let t=this.nextExportId--;return this.exports[t]={hook:e,refcount:1},this.reverseExports.set(e,t),this.ensureResolvingExport(t),t}unexport(e){for(let t of e)this.releaseExport(t,1)}watchExport(e,t){t.onBroken(n=>{queueMicrotask(()=>{if(!(this.abortReason!==void 0||this.exports[e]?.hook!==t))try{this.send(["reject",e,U0.devaluate(n,void 0,this,void 0,this.encodingLevel)])}catch(i){this.abort(i)}})})}releaseExport(e,t){let n=this.exports[e];if(!n)throw new Error(`no such export ID: ${e}`);if(n.refcount<t)throw new Error(`refcount would go negative: ${n.refcount} < ${t}`);n.refcount-=t,n.refcount===0&&(delete this.exports[e],this.reverseExports.delete(n.hook),n.hook.dispose())}onSendError(e){if(this.options.onSendError)return this.options.onSendError(e)}ensureResolvingExport(e){let t=this.exports[e];if(!t)throw new Error(`no such export ID: ${e}`);if(!t.pull){let n=async()=>{let r=t.hook;for(;;){let o=await r.pull();if(o.value instanceof $0){let{hook:s,pathIfPromise:a}=S9(o.value);if(a&&a.length==0&&this.getImport(r)===void 0){r=s;continue}}return o}},i=t.autoRelease;++this.pullCount,t.pull=n().then(r=>{let o=U0.devaluate(r.value,void 0,this,r,this.encodingLevel);this.send(["resolve",e,o]),i&&this.releaseExport(e,1)},r=>{this.send(["reject",e,U0.devaluate(r,void 0,this,void 0,this.encodingLevel)]),i&&this.releaseExport(e,1)}).catch(r=>{try{this.send(["reject",e,U0.devaluate(r,void 0,this,void 0,this.encodingLevel)]),i&&this.releaseExport(e,1)}catch(o){this.abort(o)}}).finally(()=>{--this.pullCount===0&&this.onBatchDone&&this.onBatchDone.resolve()})}}getImport(e){if(e instanceof Fw&&e.entry&&e.entry.session===this)return e.entry.importId}importStub(e){if(this.abortReason)throw this.abortReason;let t=this.imports[e];return t||(t=new Uw(this,e,!1),this.imports[e]=t),new Fw(!1,t)}importPromise(e){if(this.abortReason)throw this.abortReason;if(this.imports[e])return new Wu(new Error("Bug in RPC system: The peer sent a promise reusing an existing export ID."));let t=new Uw(this,e,!0);return this.imports[e]=t,new Fw(!0,t)}getExport(e){return this.exports[e]?.hook}getPipeReadable(e){let t=this.exports[e];if(!t||!t.pipeReadable)throw new Error(`Export ${e} is not a pipe or its readable end was already consumed.`);let n=t.pipeReadable;return t.pipeReadable=void 0,n}getLimits(){return this.limits}createPipe(e,t){if(this.abortReason)throw this.abortReason;this.send(["pipe"]);let n=this.imports.length,i=new Uw(this,n,!1);this.imports.push(i);let r=new Fw(!1,i),o=qc.createWritableStreamFromHook(r);return e.pipeTo(o).catch(()=>{}).finally(()=>t.dispose()),n}send(e){if(this.abortReason!==void 0)return 0;if(this.encodingLevel==="string"){let t;try{t=JSON.stringify(e)}catch(n){try{this.abort(n)}catch{}throw n}try{let n=this.transport.send(t);n!==void 0&&typeof n.catch=="function"&&n.catch(i=>this.abort(i,!1))}catch(n){queueMicrotask(()=>this.abort(n,!1))}return t.length}else try{let t=this.transport.send(e);if(typeof t=="number")return t;let n=t;n&&typeof n.then=="function"&&Promise.resolve(n).catch(i=>this.abort(i,!1));return}catch(t){queueMicrotask(()=>this.abort(t,!1));return}}sendCall(e,t,n){if(this.abortReason)throw n?.dispose(),this.abortReason;let i=["pipeline",e,t];if(n){let o;try{o=U0.devaluate(n.value,void 0,this,n,this.encodingLevel)}catch(s){throw n.dispose(),s}i.push(o[0])}this.send(["push",i]);let r=new Uw(this,this.imports.length,!1);return this.imports.push(r),new Fw(!0,r)}sendStream(e,t,n){if(this.abortReason)throw n.dispose(),this.abortReason;let i=["pipeline",e,t],r;try{r=U0.devaluate(n.value,void 0,this,n,this.encodingLevel)}catch(u){throw n.dispose(),u}i.push(r[0]);let o=["stream",i],s=this.send(o);s===void 0&&(s=Zq(o));let a=this.imports.length,c=new Uw(this,a,!0);return c.remoteRefcount=0,c.localRefcount=1,this.imports.push(c),{promise:c.awaitResolution().then(u=>{u.dispose(),delete this.imports[a]},u=>{throw delete this.imports[a],u}),size:s}}sendMap(e,t,n,i){if(this.abortReason){for(let s of n)s.dispose();throw this.abortReason}let r=["remap",e,t,n.map(s=>{let a=this.getImport(s);return a!==void 0?["import",a]:["export",this.exportStub(s)]}),i];this.send(["push",r]);let o=new Uw(this,this.imports.length,!1);return this.imports.push(o),new Fw(!0,o)}sendPull(e){if(this.abortReason)throw this.abortReason;this.send(["pull",e])}sendRelease(e,t){this.abortReason||(this.send(["release",e,t]),delete this.imports[e])}abort(e,t=!0){if(this.abortReason===void 0){if(this.cancelReadLoop?.(e),this.cancelReadLoop=void 0,t)try{let n=["abort",U0.devaluate(e,void 0,this,void 0,this.encodingLevel)];if(this.encodingLevel==="string"){let i=this.transport.send(JSON.stringify(n));i!==void 0&&typeof i.catch=="function"&&i.catch(r=>{})}else{let i=this.transport.send(n);i&&typeof i.then=="function"&&Promise.resolve(i).catch(r=>{})}}catch{}if(e===void 0&&(e="undefined"),this.abortReason=e,this.onBatchDone&&this.onBatchDone.reject(e),this.transport.abort)try{this.transport.abort(e)}catch(n){Promise.resolve(n)}for(let n of Object.values(this.onBrokenCallbacks))try{n(e)}catch(i){Promise.resolve(i)}for(let n in this.imports)this.imports[n].abort(e);for(let n in this.exports)this.exports[n].hook.dispose()}}async readLoop(){for(;!this.abortReason;){let e=Promise.withResolvers();this.cancelReadLoop=e.reject;let t;try{t=await Promise.race([this.transport.receive(),e.promise])}finally{this.cancelReadLoop===e.reject&&(this.cancelReadLoop=void 0)}if(this.encodingLevel==="string"&&t.length>this.limits.maxMessageSize)throw new TypeError(`Incoming message exceeds maximum size of ${this.limits.maxMessageSize} UTF-16 code units.`);if(this.abortReason)break;let n=this.encodingLevel==="string"?JSON.parse(t):t;if(n instanceof Array)switch(n[0]){case"push":if(n.length>1){let i=new Vv(this,this.encodingLevel).evaluate(n[1]),r=new kl(i);r.ignoreUnhandledRejections(),this.exports.push({hook:r,refcount:1});continue}break;case"stream":if(n.length>1){let i=new Vv(this,this.encodingLevel).evaluate(n[1]),r=new kl(i);r.ignoreUnhandledRejections();let o=this.exports.length;this.exports.push({hook:r,refcount:1,autoRelease:!0}),this.ensureResolvingExport(o);continue}break;case"pipe":{let{readable:i,writable:r}=new TransformStream,o=qc.createWritableStreamHook(r),s=this.exports.length;this.exports.push({hook:o,refcount:1,pipeReadable:i}),this.watchExport(s,o);continue}case"pull":{let i=n[1];if(typeof i=="number"){this.ensureResolvingExport(i);continue}break}case"resolve":case"reject":{let i=n[1];if(typeof i=="number"&&n.length>2){let r=this.imports[i];if(r)if(n[0]=="resolve")r.resolve(new kl(new Vv(this,this.encodingLevel).evaluate(n[2])));else{let o=new Vv(this,this.encodingLevel).evaluate(n[2]);o.dispose(),r.resolve(new Wu(o.value))}else n[0]=="resolve"&&new Vv(this,this.encodingLevel).evaluate(n[2]).dispose();continue}break}case"release":{let i=n[1],r=n[2];if(typeof i=="number"&&typeof r=="number"){this.releaseExport(i,r);continue}break}case"abort":{let i=new Vv(this,this.encodingLevel).evaluate(n[1]);i.dispose(),this.abort(i.value,!1);break}}throw new Error(`bad RPC message: ${JSON.stringify(n)}`)}}async drain(){if(this.abortReason)throw this.abortReason;if(this.pullCount>0){let{promise:e,resolve:t,reject:n}=Promise.withResolvers();this.onBatchDone={resolve:t,reject:n},await e}}getStats(){let e={imports:0,exports:0};for(let t in this.imports)++e.imports;for(let t in this.exports)++e.exports;return e}},M1e=class{#e;#t;constructor(e,t,n={}){let i;t?i=new kl(Hc.fromAppReturn(t)):i=new Wu(new Error("This connection has no main object.")),this.#e=new Oft(e,i,n),this.#t=new $0(this.#e.getMainImport())}getRemoteMain(){return this.#t}getStats(){return this.#e.getStats()}drain(){return this.#e.drain()}},Pft=class{constructor(e){this.#e=e,e.binaryType="arraybuffer",e.readyState===WebSocket.CONNECTING&&(this.#t=[],e.addEventListener("open",t=>{try{for(let n of this.#t)e.send(n)}catch(n){this.#a(n)}this.#t=void 0})),e.addEventListener("message",t=>{this.#o||(typeof t.data=="string"||t.data instanceof ArrayBuffer?this.#n?(this.#n(t.data),this.#n=void 0,this.#i=void 0):this.#r.push(t.data):this.#a(new TypeError("Received unexpected message type from WebSocket.")))}),e.addEventListener("close",t=>{this.#a(new Error(`Peer closed WebSocket: ${t.code} ${t.reason}`))}),e.addEventListener("error",t=>{this.#a(new Error("WebSocket connection failed."))})}#e;#t;#n;#i;#r=[];#o;send(e){this.#t===void 0?this.#e.send(e):this.#t.push(e)}receive(){return this.#r.length>0?Promise.resolve(this.#r.shift()):this.#o?Promise.reject(this.#o):new Promise((e,t)=>{this.#n=e,this.#i=t})}abort(e){let t;e instanceof Error?t=e.message:t=`${e}`;let n=new TextEncoder().encode(t);n.length>123&&(t=new TextDecoder().decode(n.subarray(0,123),{stream:!0})),this.#e.close(3e3,t),this.#a(e)}#a(e){this.#o||(this.#o=e,this.#i&&(this.#i(e),this.#n=void 0,this.#i=void 0))}},Mft=class{context;captureMap=new Map;instructions=[];constructor(e,t){I4?this.context={parent:I4,captures:[],subject:I4.capture(e),path:t}:this.context={parent:void 0,captures:[],subject:e,path:t},I4=this}unregister(){I4=this.context.parent}makeInput(){return new y6(this,0)}makeOutput(e){let t;try{t=U0.devaluate(e.value,void 0,this,e)}finally{e.dispose()}return this.instructions.push(t),this.context.parent?(this.context.parent.instructions.push(["remap",this.context.subject,this.context.path,this.context.captures.map(n=>["import",n]),this.instructions]),new y6(this.context.parent,this.context.parent.instructions.length)):this.context.subject.map(this.context.path,this.context.captures,this.instructions)}pushCall(e,t,n){let i=U0.devaluate(n.value,void 0,this,n);i=i[0];let r=this.capture(e.dup());return this.instructions.push(["pipeline",r,t,i]),new y6(this,this.instructions.length)}pushGet(e,t){let n=this.capture(e.dup());return this.instructions.push(["pipeline",n,t]),new y6(this,this.instructions.length)}capture(e){if(e instanceof y6&&e.mapper===this)return e.idx;let t=this.captureMap.get(e);if(t===void 0){if(this.context.parent){let n=this.context.parent.capture(e);this.context.captures.push(n)}else this.context.captures.push(e);t=-this.context.captures.length,this.captureMap.set(e,t)}return t}exportStub(e){throw new Error("Can't construct an RpcTarget or RPC callback inside a mapper function. Try creating a new RpcStub outside the callback first, then using it inside the callback.")}exportPromise(e){return this.exportStub(e)}getImport(e){return this.capture(e)}unexport(e){}createPipe(e){throw new Error("Cannot send ReadableStream inside a mapper function.")}onSendError(e){}},A9.sendMap=(e,t,n)=>{let i=new Mft(e,t),r;try{r=Hc.fromAppReturn(skn(i.pushCall.bind(i),()=>n(new wa(i.makeInput(),[]))))}finally{i.unregister()}if(r instanceof Promise)throw r.catch(o=>{}),new Error("RPC map() callbacks cannot be async.");return new wa(i.makeOutput(r),[])},y6=class extends N0{mapper;idx;constructor(e,t){super(),this.mapper=e,this.idx=t}dup(){return this}dispose(){}get(e){if(e.length==0)return this;if(I4)return I4.pushGet(this,e);k9()}call(e,t){t.dispose(),k9()}map(e,t,n){for(let i of t)i.dispose();k9()}pull(){k9()}ignoreUnhandledRejections(){}onBroken(e){k9()}},Dft=class{captures;variables;constructor(e,t){this.captures=e,this.variables=[t]}dispose(){for(let e of this.variables)e.dispose()}apply(e){try{if(e.length<1)throw new Error("Invalid empty mapper function.");for(let t of e.slice(0,-1)){let n=new Vv(this).evaluateCopy(t);if(n.value instanceof $0){let i=k1e(n.value);if(i){this.variables.push(i);continue}}this.variables.push(new kl(n))}return new Vv(this).evaluateCopy(e[e.length-1])}finally{for(let t of this.variables)t.dispose()}}importStub(e){throw new Error("A mapper function cannot refer to exports.")}importPromise(e){return this.importStub(e)}getExport(e){return e<0?this.captures[-e-1]:this.variables[e]}getPipeReadable(e){throw new Error("A mapper function cannot use pipe readables.")}getLimits(){return eH}},A9.applyMap=(e,t,n,i,r)=>{try{let o;if(e instanceof wa)throw new Error("applyMap() can't be called on RpcPromise");if(e instanceof Array){let s=[];try{for(let a of e)s.push(_ft(a,e,n,i,r))}catch(a){for(let c of s)c.dispose();throw a}o=Hc.fromArray(s)}else e==null?o=Hc.fromAppReturn(e):o=_ft(e,t,n,i,r);return new kl(o)}finally{for(let o of i)o.dispose()}},Lft=class ZBe extends N0{state;static create(t){let n=t.getWriter();return new ZBe({refcount:1,writer:n,closed:!1})}constructor(t,n){super(),this.state=t,n&&++t.refcount}getState(){if(this.state)return this.state;throw new Error("Attempted to use a WritableStreamStubHook after it was disposed.")}call(t,n){try{let i=this.getState();if(t.length!==1||typeof t[0]!="string")throw new Error("WritableStream stub only supports direct method calls");const r=t[0];if(r!=="write"&&r!=="close"&&r!=="abort")throw new Error(`Unknown WritableStream method: ${r}`);(r==="close"||r==="abort")&&(i.closed=!0);let o=r==="write"?n.deliverStreamWrite(i.writer):n.deliverCall(i.writer[r],i.writer);return new f6(o.then(s=>new kl(s)))}catch(i){return n.dispose(),new Wu(i)}}map(t,n,i){for(let r of n)r.dispose();return new Wu(new Error("Cannot use map() on a WritableStream"))}get(t){return new Wu(new Error("Cannot access properties on a WritableStream stub"))}dup(){let t=this.getState();return new ZBe(t,this)}pull(){return Promise.reject(new Error("Cannot pull a WritableStream stub"))}ignoreUnhandledRejections(){}dispose(){let t=this.state;this.state=void 0,t&&--t.refcount===0&&(t.closed||t.writer.abort(new Error("WritableStream RPC stub was disposed without calling close()")).catch(()=>{}),t.writer.releaseLock())}onBroken(t){this.getState().writer.closed.then(void 0,t)}},Nft=262144,$ft=1073741824,Uft=65536,Fft=2,D1e=1.25,Bft=.9,jft=3,Wft=class{now;window=Nft;bytesInFlight=0;inStartupPhase=!0;delivered=0;deliveredTime=0;firstAckTime=0;firstAckDelivered=0;minRtt=1/0;roundsWithoutIncrease=0;lastRoundWindow=0;roundStartTime=0;constructor(e){this.now=e}onSend(e){this.bytesInFlight+=e;let t={sentTime:this.now(),size:e,deliveredAtSend:this.delivered,deliveredTimeAtSend:this.deliveredTime,windowAtSend:this.window,windowFullAtSend:this.bytesInFlight>=this.window};return{token:t,shouldBlock:t.windowFullAtSend}}onError(e){this.bytesInFlight-=e.size}onAck(e){let t=this.now();this.delivered+=e.size,this.deliveredTime=t,this.bytesInFlight-=e.size;let n=t-e.sentTime;if(this.minRtt=Math.min(this.minRtt,n),this.firstAckTime===0)this.firstAckTime=t,this.firstAckDelivered=this.delivered;else{let i,r;e.deliveredTimeAtSend===0?(i=this.firstAckTime,r=this.firstAckDelivered):(i=e.deliveredTimeAtSend,r=e.deliveredAtSend);let o=t-i,s=(this.delivered-r)/o,a=this.inStartupPhase?Fft:D1e,c=s*this.minRtt*a;c=Math.min(c,e.windowAtSend*a),e.windowFullAtSend?c=Math.max(c,e.windowAtSend*Bft):c=Math.max(c,this.window),this.window=Math.max(Math.min(c,$ft),Uft),this.inStartupPhase&&e.sentTime>=this.roundStartTime&&(this.window>this.lastRoundWindow*D1e?this.roundsWithoutIncrease=0:++this.roundsWithoutIncrease>=jft&&(this.inStartupPhase=!1),this.roundStartTime=t,this.lastRoundWindow=this.window)}return this.bytesInFlight<this.window}},zft=class eje extends N0{state;static create(t){return new eje({refcount:1,stream:t,canceled:!1})}constructor(t,n){super(),this.state=t,n&&++t.refcount}call(t,n){return n.dispose(),new Wu(new Error("Cannot call methods on a ReadableStream stub"))}map(t,n,i){for(let r of n)r.dispose();return new Wu(new Error("Cannot use map() on a ReadableStream"))}get(t){return new Wu(new Error("Cannot access properties on a ReadableStream stub"))}dup(){let t=this.state;if(!t)throw new Error("Attempted to dup a ReadableStreamStubHook after it was disposed.");return new eje(t,this)}pull(){return Promise.reject(new Error("Cannot pull a ReadableStream stub"))}ignoreUnhandledRejections(){}dispose(){let t=this.state;this.state=void 0,t&&--t.refcount===0&&(t.canceled||(t.canceled=!0,t.stream.locked||t.stream.cancel(new Error("ReadableStream RPC stub was disposed without being consumed")).catch(()=>{})))}onBroken(t){}},qc.createWritableStreamHook=Lft.create,qc.createWritableStreamFromHook=mkn,qc.createReadableStreamHook=zft.create,qft=E9,Hft=hkn,Gft=class{constructor(e){this.#e=e}#e;#t;#n;#i=[];#r;async send(e){this.#e.send(e)}async receive(){if(this.#i.length>0)return this.#i.shift();if(this.#r)throw this.#r;return new Promise((e,t)=>{this.#t=e,this.#n=t})}abort(e){let t;e instanceof Error?t=e.message:t=`${e}`,this.#e.close(3e3,t),this.#r||(this.#r=e)}dispatchMessage(e){if(this.#r)return;let t=typeof e=="string"?e:new TextDecoder("utf-8",{ignoreBOM:!0}).decode(e);this.#t?(this.#t(t),this.#t=void 0,this.#n=void 0):this.#i.push(t)}dispatchClose(e,t){this.#o(new Error(`Peer closed WebSocket: ${e} ${t}`))}dispatchError(e){this.#o(new Error("WebSocket connection failed."))}#o(e){this.#r||(this.#r=e,this.#n&&(this.#n(e),this.#t=void 0,this.#n=void 0))}}}}),Vft,N1e,I9,v6,ykn,C9,Ja,Kft,Jft,Qft,R9,Xft,iH,Yft,Zft,egt,tgt,ngt,vkn,$1e,zo,igt,O9,U1e,F1e,P9,rgt,B1e,_kn=A({"../../packages/whistle/dist/wire.js"(){"use strict";yt(),Vft=l0(),N1e=Ln(()=>Ou("status",[de({status:Ie("available")}).strict(),de({status:Ie("unavailable"),reason:F()}).strict()])),I9=Vft,v6=Ln(()=>Ot(F(),I9)),ykn=Ln(()=>de({code:F().min(1).max(160),message:F().min(1).max(512),details:I9.optional()}).strict()),C9=v6,Ja=Ln(()=>F().refine(e=>e.trim().length>0)),Kft=N1e,Jft=Ln(()=>Et([de({type:Ie("action")}).strict(),de({type:Ie("custom"),data:v6}).strict(),de({type:Ie("choice"),options:Me(de({value:I9,label:Ja,description:Ja.optional()}))}).strict(),de({type:Ie("form"),submitLabel:Ja.optional()}).strict(),de({type:Ie("confirmation"),message:Ja,confirmLabel:Ja.optional(),cancelLabel:Ja.optional()}).strict()])),Qft=Ln(()=>de({inputSchema:C9.optional(),outputSchema:C9.optional(),presentation:Jft.optional()}).strict()),R9=Ln(()=>et().int().refine(e=>Number.isSafeInteger(e))),Xft=Ln(()=>de({hint:Ja.pipe(F().max(120)),words:Me(de({word:F().regex(/^\S{1,64}$/u),description:Ja.pipe(F().max(512)).optional(),arguments:v6}).strict()).max(32).optional(),text:de({field:Ja.pipe(F().max(120)),arguments:v6,requestIdField:Ja.pipe(F().max(120)).optional()}).strict().optional()}).strict().refine(e=>e.words!==void 0||e.text!==void 0,"slash arguments need words or text")),iH=Ln(()=>de({order:R9.optional()}).strict()),Yft=Ln(()=>de({bindings:de({order:R9.optional(),values:Me(Ja).max(16)}).strict().optional(),agent:de({keybind:Ja.optional(),order:R9.optional()}).strict().optional(),help:iH.optional(),menu:iH.optional(),palette:iH.optional(),slash:de({aliases:Me(Ja).max(16),consumesDraft:Rt().optional(),order:R9.optional(),arguments:Xft.optional()}).strict().optional()}).strict()),Zft=Ln(()=>de({id:Ja.refine(e=>!e.includes(":")),title:Ja,category:Ja,description:Ja.optional(),projections:Yft.optional(),action:Qft.optional(),availability:Kft.optional()}).strict()),egt=Ln(()=>de({inputSchema:C9.optional(),outputSchema:C9.optional()}).strict()),tgt=F().min(1).brand(),ngt=Ln(()=>de({commandId:tgt,command:de({namespace:F(),id:F()}).strict(),sourceId:F(),scope:F().optional(),title:F(),category:F(),description:F().optional(),order:et(),availability:N1e,action:egt.optional(),keybind:F().optional()}).strict()),vkn=Me(ngt),$1e=8192,zo=Ja.pipe(F().max($1e)),igt=60,O9=Ja.pipe(F().max(igt)),U1e=IR({protocol:/^https?$/u}),F1e=de({label:zo,value:zo}).strict(),P9={summary:zo.optional(),facts:Me(F1e).max(4).optional(),body:zo.optional(),bodyLabel:zo.optional(),details:Me(F1e).max(24).optional()},rgt=Ou("type",[de({type:Ie("choice"),message:O9,...P9,current:zo.optional(),collapsedGroup:zo.optional(),options:Me(de({value:zo,label:zo,description:zo.optional(),group:zo.optional(),destructive:Ie(!0).optional()}).strict()).min(1).max(256)}).strict(),de({type:Ie("text"),message:O9,...P9,placeholder:zo.optional(),secret:Rt().optional()}).strict(),de({type:Ie("confirmation"),message:O9,...P9,confirmLabel:zo.optional(),cancelLabel:zo.optional(),destructive:Ie(!0).optional()}).strict(),de({type:Ie("decision"),message:O9,...P9,options:Me(de({value:zo,label:zo,description:zo.optional(),destructive:Ie(!0).optional()}).strict()).min(1).max(8).refine(e=>new Set(e.map(t=>t.value)).size===e.length,"Decision option values must be unique"),multiple:Rt().optional(),other:de({label:zo,placeholder:zo.optional(),maxLength:et().int().min(1).max($1e),blank:zo.optional()}).strict().optional(),escape:zo.optional()}).strict().refine(e=>[e.escape,e.other?.blank].every(t=>t===void 0||e.options.some(n=>n.value===t)),"A decision's escape and blank answers must be offered options")]),B1e=Ln(()=>Ou("type",[de({type:Ie("info"),message:zo,links:Me(de({url:U1e,label:zo.optional()}).strict()).max(16).optional()}).strict(),de({type:Ie("progress"),message:zo}).strict(),de({type:Ie("handoff"),url:U1e,code:zo.optional(),message:zo.optional()}).strict(),de({type:Ie("success"),message:zo}).strict()]))}});function j1e(e){try{const t=ogt.parse(e);if(t===void 0||W1e.has(t.owner))return;W1e.add(t.owner),t.dispose?.call(t.owner)}catch(t){console.warn("RPC value disposal failed",t)}}var ogt,W1e,wkn=A({"../../packages/agar/dist/internal/capabilities.js"(){"use strict";yt(),wt(),ogt=qt().transform(e=>{const t=g5(Object).safeParse(e);if(!t.success)return;const n=Object.create(t.data),i=it(V({[Symbol.dispose]:jt(am(Function))}))(n);return{owner:t.data,dispose:i[Symbol.dispose]}}),W1e=new WeakSet}});function qf(e){const t=de(e),n=g5(Object),i=de(Object.fromEntries(Object.keys(e).map(r=>[r,qt().optional()])));return qt().transform(r=>{const o=n.parse(r),s=Object.create(o),a=i.parse(s),c=Object.fromEntries(Object.entries(a).flatMap(([u,l])=>l===void 0?[]:[[u,wv().parse(l).bind(o)]]));return{...t.parse(c),[Symbol.dispose](){j1e(r)}}})}function Od(e){return qt().transform(t=>{try{return e.parse(t)}catch(n){throw n instanceof x9?n:new x9("The capability returned malformed data",{cause:n,code:"PROTOCOL",retryable:!1})}finally{j1e(t)}})}function Qa(e){return wv({output:ale(qt().transform(t=>{try{return e.parse(t)}catch(n){throw j1e(t),n instanceof x9?n:new x9("The capability returned a malformed result",{cause:n,code:"PROTOCOL",retryable:!1})}}))})}var sgt,_6,bkn=A({"../../packages/agar/dist/internal/rpc-contract.js"(){"use strict";yt(),rkn(),wkn(),sgt=Qa(Od(Zue())),_6=qf({fetch:Qa(g5(Response)),close:sgt})}});import{webcrypto as agt}from"node:crypto";function xkn(e){if(e<0)throw new RangeError("Wrong ID size");try{!Bw||Bw.length<e?(Bw=Buffer.allocUnsafe(e*cgt),agt.getRandomValues(Bw),w6=0):w6+e>Bw.length&&(agt.getRandomValues(Bw),w6=0)}catch(t){throw Bw=void 0,t}w6+=e}function Skn(e){return xkn(e|=0),Bw.subarray(w6-e,w6)}function kkn(e,t,n){let i=256-256%e.length;if(i===256){let o=e.length-1;return(s=t)=>{if(!s)return"";let a="";for(;;){let c=n(s),u=s;for(;u--;)if(a+=e[c[u]&o],a.length>=s)return a}}}let r=Math.ceil(1.6*256*t/i);return(o=t)=>{if(!o)return"";let s="";for(;;){let a=n(r),c=r;for(;c--;)if(a[c]<i&&(s+=e[a[c]%e.length],s.length>=o))return s}}}function Ekn(e,t=21){return kkn(e,t,Skn)}var cgt,Bw,w6,Akn=A({"../../node_modules/.pnpm/nanoid@5.1.16/node_modules/nanoid/index.js"(){cgt=128}});function Pd(e=M9){if(e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY)throw new RangeError("nanoid length must be finite");return Ekn(ugt,e)()}var ugt,M9,lgt=A({"../../packages/cairn/dist/nanoid.js"(){"use strict";Akn(),ugt="abcdefghijklmnopqrstuvwxyz0123456789",M9=21}}),z1e,dgt,pgt,hgt,mgt,fgt,ggt,q1e,ygt=A({"../../packages/cairn/dist/input-schema.js"(){"use strict";yt(),z1e=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,dgt=/^[a-z][a-z0-9]*(?:_[a-z][a-z0-9]*)*$/,pgt=F().min(1).max(64).regex(z1e),hgt=F().min(1).max(64).regex(z1e),mgt=F().min(1).max(32).regex(dgt),fgt=de({prefix:mgt}),ggt=de({family:pgt,version:Ie(1),kinds:Ot(hgt,fgt)}).superRefine((e,t)=>{const n=Object.entries(e.kinds);if(n.length<1||n.length>64){t.addIssue({code:"custom",message:"Identifier families must declare between one and 64 kinds"});return}const i=new Set;for(const[,r]of n){if(i.has(r.prefix)){t.addIssue({code:"custom",message:"Identifier kind prefixes must be distinct"});return}i.add(r.prefix)}}),q1e=F()}});function vgt(e){return e===32||e>=9&&e<=13}function Tkn(e){let t=0,n=e.length;for(;t<n&&vgt(e.charCodeAt(t));)t+=1;for(;n>t&&vgt(e.charCodeAt(n-1));)n-=1;return e.slice(t,n).replace(/[A-Z]/g,i=>String.fromCharCode(i.charCodeAt(0)+32))}function Ikn(e){const t=`${e.prefix}_`;function n(a){if(!a.startsWith(t))return!1;const c=a.slice(t.length);return c.length===M9&&_gt.test(c)}const i=Ln(()=>c2(a=>{const c=q1e.safeParse(a);return c.success&&n(c.data)}));function r(a){let c;const u=a,l=wgt.encode(u).byteLength,d=i.safeParse(u),p=u.startsWith(t)?u.slice(t.length):void 0;if(l<3||l>96)c="bounds";else if(p!==void 0&&Array.from(p).length!==M9)c="bounds";else{if(d.success)return{ok:!0,value:d.data};n(Tkn(u))?c="non_canonical":c="grammar"}return{ok:!1,error:{code:"invalid_id",family:e.family,kind:e.kind,version:1,reason:c}}}const o=Ln(()=>q1e.transform((a,c)=>{const u=r(a);return u.ok?u.value:(c.addIssue({code:"custom",message:u.error.reason}),fR)}));function s(){let a;try{a=Pd(M9)}catch{throw e.entropyUnavailable()}return i.parse(`${t}${a}`)}return{family:e.family,kind:e.kind,version:1,generate:s,schema:o,parse:r,is:a=>r(a).ok}}var _gt,wgt,Ckn=A({"../../packages/cairn/dist/internal/identifier-codec.js"(){"use strict";lgt(),yt(),ygt(),_gt=/^[a-z0-9]+$/,wgt=new TextEncoder}});function F0(e){let t;try{t=ggt.safeParse(e)}catch{throw new rH}if(!t.success)throw new rH;const n=t.data,i={};for(const[s,a]of Object.entries(n.kinds)){const c=a.prefix;i[s]=Ikn({family:e.family,kind:s,prefix:c,entropyUnavailable:()=>new xgt({family:n.family,kind:s})})}const o=c2(s=>{const a=bgt.safeParse(s);if(!a.success)return!1;const c=Object.entries(a.data);return c.length===Object.keys(n.kinds).length&&c.every(([u,l])=>Object.hasOwn(n.kinds,u)&&l.kind===u&&l.family===n.family)}).safeParse(i);if(!o.success)throw new rH;return o.data}var bgt,rH,xgt,H1e=A({"../../packages/cairn/dist/identifier.js"(){"use strict";Ckn(),yt(),ygt(),bgt=Ot(F(),de({family:F(),kind:F(),version:Ie(1),generate:wv(),schema:g5(Ni),parse:wv(),is:wv()})),rH=class extends Error{name="CairnDefinitionError";code="invalid_definition";constructor(){super("Cairn identifier family definition is invalid")}},xgt=class extends Error{name="CairnGenerationError";code="entropy_unavailable";family;kind;version=1;constructor(e){super("Cairn entropy source is unavailable"),this.family=e.family,this.kind=e.kind}}}});function Sgt(e){const n=Math.floor(4294967296/e.length)*e.length;let i;do{const o=crypto.getRandomValues(new Uint32Array(1))[0];if(o===void 0)throw new Error("CSPRNG returned no candidate value");i=o}while(i>=n);const r=e[i%e.length];if(r===void 0)throw new Error("Candidate vocabulary is empty");return r}function Rkn(e){if(e?.count===Number.POSITIVE_INFINITY)throw new RangeError("words count must be finite");const t=Math.max(1,Math.floor(e?.count??2)),n=e?.separator??"-",i=[Sgt(kgt)];for(let r=1;r<t;r++)i.push(Sgt(Egt));return i.join(n)}var kgt,Egt,Okn=A({"../../packages/cairn/dist/words.js"(){"use strict";kgt=["gilled","velvety","spored","saprotrophic","mycorrhizal","luminescent","honeycomb","truffley","wispy","earthy","mossy","woody","waxy","gelatinous","coral","inkcapped","feathery","stiped","ringed","annulate","scaly","shaggy","fuzzy","spiky","conical","umbral","parasol","leathery","damp","dewy","bristly","powdery","yeasty","musty","ancient","patient","steady","faithful","hardy","rootbound","forested","shaded","sunlit","sporeladen","golden","honeyed","amber","ivory","crimson","violet","indigo","silver","mossgreen","midnight","creamy","buttery","porcelain","glossy","matte","ribbed","fluted","wavy","lobed","branched","curled","folded","hooded","crowned","blushing","weeping","laughing","dancing","singing","whistling","glowing","ghostly","fairy","elfin","rustic","homey","barnraised","pasture","orchard","mill","woven","gardened","herded","trailed","ridged","meadow","fielded","vined","rooted","tendered","seasoned","ripe","wild","tame","broody","stubborn","gentle","drowsy","watchful","wandering","migratory","burrowed","nested","perched","loamy","mulched","composted","fermented","brewed","cured","smoked","pickled","preserved","aged","vintage","heirloom","grandmothers","forgotten","remembered","beloved","cherished","worn","weathered","windblown","rainsoaked","frosted","snowed","bloomed","flowered","seeded","sprouted","grafted","pruned","harvested","threshed","milled","baked","proofed","risen","folded","twisted","braided","stitched","patched","mended","polished","burnished","glazed","gilded","verdigris","patinaed","microdosed","tripping","wavy","prismatic","shimmering","rippling","echoing","oracular","mystic","kaleidoscopic","auroral","nebular","azure","psychedelic","transcendent","visionary","wandering","dreaming","phantom","spectral","iridescent","liminal","tidal","celestial","cosmic","astral","ethereal","incandescent"],Egt=["shiitake","morel","chanterelle","bolete","puffball","oyster","enoki","maitake","lionsmane","truffle","porcini","agaric","amanita","bracket","conk","stipe","cap","gill","spore","hypha","mycelium","sporocarp","earthstar","stinkhorn","jelly","milkcap","blewit","cep","hedgehog","woodear","waxcap","inkcap","birdnest","cup","saddle","fieldcap","rust","smut","ergot","lichen","yeast","mold","toadstool","fruitingbody","basidiocarp","ascocarp","perithecium","apothecium","cystidium","basidium","clamp","septa","rhizomorph","sclerotium","gemma","annulus","volva","pileus","lamella","trama","gleba","peridium","sporangium","zygospora","conidia","teleomorph","anamorph","saprobe","endophyte","epiphyte","decomposer","recycler","alchemist","mycorrhiza","hyphae","web","net","lattice","thread","strand","root","tendril","runner","vine","ivy","moss","fern","liverwort","mule","cairn","almanac","parrot","birddog","watchdog","pigeon","ranch","barn","coop","pasture","meadow","field","orchard","gate","fence","silo","well","windmill","homestead","trail","ridge","creek","hill","grove","vineyard","apiary","garden","plot","furrow","shed","stable","trough","hayloft","rootcellar","smokehouse","springhouse","millstone","weathervane","lantern","tinderbox","candlemold","honeycomb","beeswax","propolis","nectar","pollen","comb","burrow","den","nest","perch","warren","colony","swarm","flock","herd","pod","grist","flour","starter","mother","scoby","kombucha","miso","tempeh","cheese","rennet","whey","curd","cream","butter","braid","loaf","crust","crumb","fiddlehead","sorrel","ramp","morelberry","huckleberry","thimbleberry","salmonberry","serviceberry","chokecherry","microdose","trip","shroom","liberty","teacher","treasure","wanderer","seeker","dreamer","shaman","visionary","tripper","oracle","seer","augur","prism","fractal","kaleidoscope","spectrum","nebula","aurora","comet","meteor","eclipse","zenith","horizon","mirage","echo","ripple","shimmer","glimmer","phantom","twilight","starlight","moonbeam"]}});function Pkn(e,t=0){return(Gc[e[t+0]]+Gc[e[t+1]]+Gc[e[t+2]]+Gc[e[t+3]]+"-"+Gc[e[t+4]]+Gc[e[t+5]]+"-"+Gc[e[t+6]]+Gc[e[t+7]]+"-"+Gc[e[t+8]]+Gc[e[t+9]]+"-"+Gc[e[t+10]]+Gc[e[t+11]]+Gc[e[t+12]]+Gc[e[t+13]]+Gc[e[t+14]]+Gc[e[t+15]]).toLowerCase()}var Gc,Mkn=A({"../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/stringify.js"(){Gc=[];for(let e=0;e<256;++e)Gc.push((e+256).toString(16).slice(1))}});import{randomFillSync as Dkn}from"crypto";function Lkn(){return L9>D9.length-16&&(Dkn(D9),L9=0),D9.slice(L9,L9+=16)}var D9,L9,Nkn=A({"../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/rng.js"(){D9=new Uint8Array(256),L9=D9.length}});import{randomUUID as $kn}from"crypto";var G1e,Ukn=A({"../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/native.js"(){G1e={randomUUID:$kn}}});function Fkn(e,t,n){if(G1e.randomUUID&&!t&&!e)return G1e.randomUUID();e=e||{};const i=e.random??e.rng?.()??Lkn();if(i.length<16)throw new Error("Random bytes length must be >= 16");if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){if(n=n||0,n<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let r=0;r<16;++r)t[n+r]=i[r];return t}return Pkn(i)}var Agt,Bkn=A({"../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/v4.js"(){Ukn(),Nkn(),Mkn(),Agt=Fkn}}),jkn=A({"../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/index.js"(){Bkn()}});async function Wkn(e,t){const n=new TextEncoder,i=["cairn:replay:v1\0",`${String(t.length)}:`];for(const s of[e,...t]){const a=JSON.stringify(s);i.push(`${String(n.encode(a).byteLength)}:`,a)}const r=await globalThis.crypto.subtle.digest("SHA-256",n.encode(i.join(""))),o=Array.from(new Uint8Array(r),s=>s.toString(16).padStart(2,"0")).join("");return Cgt.parse(`replay_${o}`)}function b6(){return Ogt.parse(Agt())}var Tgt,Igt,Cgt,Rgt,zkn,Ogt,qkn=A({"../../packages/cairn/dist/ephemeral-key.js"(){"use strict";jkn(),yt(),Tgt=GF({version:"v7"}),Igt=F().regex(/^replay_[a-f0-9]{64}$/),Cgt=c2(e=>Igt.safeParse(e).success),Rgt=GF({version:"v4"}),zkn=c2(e=>Tgt.safeParse(e).success),Ogt=c2(e=>Rgt.safeParse(e).success)}}),ba=A({"../../packages/cairn/dist/index.js"(){"use strict";H1e(),lgt(),qkn()}}),Pgt,Mgt,zu,tn,oH,C4,Vc,sH,Dgt,V1e,aH,B0,Md,K1e,x6,Lgt,Ngt,Hkn,Gkn,Vkn,Kkn,Jkn,Qkn,Xkn,Ykn=A({"../../packages/sprite/dist/render-style.js"(){"use strict";yt(),Pgt=["plain","pencil","manga","riso","halftone","blueprint","crt","watercolor"],Mgt=wn(Pgt),zu={ink:"var(--sprite-ink, var(--color-base-content, #1c1c1a))",paper:"var(--sprite-paper, var(--color-base-100, #fbfaf6))",accent:"var(--sprite-accent, var(--color-accent, #d20f39))",risoFirst:"var(--sprite-riso-first, var(--color-info, #1e66f5))",risoSecond:"var(--sprite-riso-second, var(--color-accent, #ea76cb))",blueprint:"var(--sprite-blueprint, color-mix(in oklab, var(--color-info, #1e66f5) 55%, #0b2350))",blueprintLine:"var(--sprite-blueprint-line, color-mix(in oklab, var(--color-info-content, #ffffff) 25%, #ffffff))",screen:"var(--sprite-screen, color-mix(in oklab, var(--color-base-content, #111111) 12%, #050805))",phosphor:"var(--sprite-phosphor, var(--color-success, #40a02b))"},tn=(e,t={},...n)=>({tag:e,attributes:t,children:n}),oH=(e,t,n=1)=>tn("feFlood",{style:`flood-color: ${e}`,"flood-opacity":n,result:t}),C4=(e,t,n)=>[tn("feImage",{href:`data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' width='${String(t)}' height='${String(t)}'>${e}</svg>`)}`,width:t,height:t,result:`${n}Cell`}),tn("feTile",{in:`${n}Cell`,result:n})],Vc=(e,t,n)=>tn("feColorMatrix",{in:t,type:"matrix",values:`0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ${e}`,result:n}),sH=(e,t)=>Vc("-0.333 -0.333 -0.333 1 0",e,t),Dgt=(e,t,n,i=1.1)=>[tn("feConvolveMatrix",{in:e,order:3,kernelMatrix:"0 1 0 1 -4 1 0 1 0",result:`${t}In`}),tn("feConvolveMatrix",{in:e,order:3,kernelMatrix:"0 -1 0 -1 4 -1 0 -1 0",result:`${t}Out`}),tn("feComposite",{in:`${t}In`,in2:`${t}Out`,operator:"arithmetic",k2:1,k3:1,result:`${t}Edges`}),Vc(`${String(n)} ${String(n)} ${String(n)} ${String(i)} 0`,`${t}Edges`,t)],V1e=(e,t,n,i)=>[tn("feConvolveMatrix",{in:e,order:3,kernelMatrix:"0 1 0 1 -4 1 0 1 0",preserveAlpha:"true",result:`${t}In`}),tn("feConvolveMatrix",{in:e,order:3,kernelMatrix:"0 -1 0 -1 4 -1 0 -1 0",preserveAlpha:"true",result:`${t}Out`}),tn("feComposite",{in:`${t}In`,in2:`${t}Out`,operator:"arithmetic",k2:1,k3:1,result:`${t}Edges`}),Vc(`${String(n)} ${String(n)} ${String(n)} 0 -0.15`,`${t}Edges`,`${t}Inner`),tn("feMorphology",{in:e,operator:"dilate",radius:i,result:`${t}Grown`}),tn("feComposite",{in:`${t}Grown`,in2:e,operator:"out",result:`${t}Ring`}),Vc("0 0 0 1 0",`${t}Ring`,`${t}Outline`),B0(t,`${t}Inner`,`${t}Outline`)],aH=(e,t,n)=>tn("feComponentTransfer",{in:e,result:n},tn("feFuncA",{type:"discrete",tableValues:t})),B0=(e,...t)=>tn("feMerge",{result:e},...t.map(n=>tn("feMergeNode",{in:n}))),Md=(e,t,n,i=1)=>[oH(e,`${n}Flood`,i),tn("feComposite",{in:`${n}Flood`,in2:t,operator:"in",result:n})],K1e={x:"0%",y:"0%",width:"100%",height:"100%"},x6={x:"-8%",y:"-8%",width:"116%",height:"116%"},Lgt={value:1.6,line:6,outline:2.4,midHatch:[3.2,-.05],darkHatch:[3.4,-.4],tooth:"0 0 0 -0.7 1.45",opacity:1},Ngt=e=>({region:x6,primitives:[tn("feComponentTransfer",{in:"SourceGraphic",result:"valued"},...["feFuncR","feFuncG","feFuncB"].map(t=>tn(t,{type:"gamma",amplitude:1,exponent:e.value,offset:0}))),tn("feTurbulence",{type:"fractalNoise",baseFrequency:.05,numOctaves:2,seed:1,result:"wobble","data-sprite-boil":"wobble"}),tn("feDisplacementMap",{in:"valued",in2:"wobble",scale:2.6,xChannelSelector:"R",yChannelSelector:"G",result:"drawn"}),...Dgt("drawn","line",e.line,e.outline),sH("drawn","dark"),...C4("<path d='M-1 1l2-2M0 6l6-6M5 7l2-2' stroke='black' stroke-width='1.1'/>",6,"hatch45"),tn("feOffset",{in:"hatch45",dx:0,dy:0,result:"hatchOffset","data-sprite-boil":"hatch"}),tn("feTurbulence",{type:"fractalNoise",baseFrequency:.07,numOctaves:2,seed:5,result:"strokeBend"}),tn("feDisplacementMap",{in:"hatchOffset",in2:"strokeBend",scale:4,xChannelSelector:"R",yChannelSelector:"B",result:"hatchA"}),...C4("<path d='M-1 4l2 2M0 0l5 5M4 -1l2 2' stroke='black' stroke-width='0.9'/>",5,"hatch135"),tn("feDisplacementMap",{in:"hatch135",in2:"strokeBend",scale:3,xChannelSelector:"G",yChannelSelector:"R",result:"hatchB"}),tn("feComposite",{in:"dark",in2:"hatchA",operator:"arithmetic",k1:e.midHatch[0],k4:e.midHatch[1],result:"shadeA"}),tn("feComposite",{in:"dark",in2:"hatchB",operator:"arithmetic",k1:e.darkHatch[0],k4:e.darkHatch[1],result:"shadeB"}),tn("feTurbulence",{type:"fractalNoise",baseFrequency:.9,numOctaves:1,seed:3,result:"tooth"}),Vc(e.tooth,"tooth","toothMask"),Vc("0 0 0 6 -4.6","dark","solid"),B0("graphiteRaw","solid","shadeA","shadeB","line"),tn("feComposite",{in:"graphiteRaw",in2:"toothMask",operator:"in",result:"graphite"}),...Md(zu.ink,"graphite","pencil",e.opacity)],boil:{intervalMs:160,tracks:[{name:"wobble",attribute:"seed",frames:[1,2,3]},{name:"hatch",attribute:"dx",frames:[0,1,2]}]}}),Hkn={region:x6,primitives:[tn("feTurbulence",{type:"fractalNoise",baseFrequency:.04,numOctaves:2,seed:2,result:"brush","data-sprite-boil":"brush"}),tn("feDisplacementMap",{in:"SourceGraphic",in2:"brush",scale:2,xChannelSelector:"R",yChannelSelector:"G",result:"drawn"}),...Md(zu.paper,"SourceAlpha","paperFill"),sH("drawn","dark"),...C4("<circle cx='2.5' cy='2.5' r='1.15' fill='black'/>",5,"dots"),aH("dark","0 1 1 0","midTone"),tn("feComposite",{in:"dots",in2:"midTone",operator:"in",result:"tone"}),aH("dark","0 0 0 1","solid"),Vc("3 -3 0 0 -0.35","drawn","satRG"),Vc("-3 3 0 0 -0.35","drawn","satGR"),Vc("0 3 -3 0 -0.35","drawn","satGB"),Vc("0 -3 3 0 -0.35","drawn","satBG"),B0("saturation","satRG","satGR","satGB","satBG"),aH("saturation","0 1","accentMask"),...Md(zu.accent,"accentMask","accentFill"),...V1e("drawn","edge",2,2.2),tn("feMorphology",{in:"edge",operator:"dilate",radius:.25,result:"stroke"}),B0("inkRaw","tone","solid","stroke"),...Md(zu.ink,"inkRaw","ink"),B0("manga","paperFill","accentFill","ink")],boil:{intervalMs:180,tracks:[{name:"brush",attribute:"seed",frames:[2,4,6]}]}},Gkn={region:x6,primitives:[Vc("-0.55 -0.55 -0.55 1.65 0","SourceGraphic","dark"),tn("feTurbulence",{type:"fractalNoise",baseFrequency:.85,numOctaves:1,seed:7,result:"grain"}),Vc("0 0 0 -0.9 1.35","grain","grainMask"),tn("feComposite",{in:"dark",in2:"grainMask",operator:"in",result:"firstMask"}),...Md(zu.risoFirst,"firstMask","firstInk",.92),Vc("0 -1.9 0 1.9 0","SourceGraphic","secondMask"),...Md(zu.risoSecond,"secondMask","secondInk",.9),tn("feOffset",{in:"firstInk",dx:-1.5,dy:1,result:"firstPlate","data-sprite-boil":"register"}),tn("feOffset",{in:"secondInk",dx:1.5,dy:-.5,result:"secondPlate"}),tn("feBlend",{in:"firstPlate",in2:"secondPlate",mode:"multiply"})],boil:{intervalMs:240,tracks:[{name:"register",attribute:"dx",frames:[-1.5,-1,-2]}]}},Vkn={region:x6,primitives:[Vc("-0.5 -0.5 -0.5 1.65 0","SourceGraphic","value"),Vc("0 0 0 0.16 0","SourceGraphic","floor"),B0("dark","floor","value"),...C4("<defs><radialGradient id='d'><stop offset='0' stop-opacity='1'/><stop offset='1' stop-opacity='0'/></radialGradient></defs><rect width='6' height='6' fill='url(#d)'/>",6,"screen"),tn("feComposite",{in:"dark",in2:"screen",operator:"arithmetic",k2:1,k3:1,k4:-.92,result:"dotField"}),tn("feComponentTransfer",{in:"dotField",result:"dotsRaw"},tn("feFuncA",{type:"linear",slope:12,intercept:0})),tn("feComposite",{in:"dotsRaw",in2:"SourceAlpha",operator:"in",result:"dots"}),...Md(zu.ink,"dots","halftone")]},Kkn={region:K1e,primitives:[oH(zu.blueprint,"ground"),tn("feTurbulence",{type:"fractalNoise",baseFrequency:.05,numOctaves:1,seed:4,result:"hand","data-sprite-boil":"hand"}),tn("feDisplacementMap",{in:"SourceGraphic",in2:"hand",scale:1.6,xChannelSelector:"R",yChannelSelector:"G",result:"drawn"}),...C4("<path d='M0 0.5h16M0.5 0v16' stroke='black' stroke-width='1' stroke-opacity='0.22'/>",16,"grid"),...Md(zu.blueprintLine,"grid","gridLines"),...Md(zu.blueprintLine,"SourceAlpha","wash",.12),...V1e("drawn","edge",3,1.2),tn("feMorphology",{in:"edge",operator:"dilate",radius:.3,result:"stroke"}),...Md(zu.blueprintLine,"stroke","lines"),B0("blueprint","ground","gridLines","wash","lines")],boil:{intervalMs:200,tracks:[{name:"hand",attribute:"seed",frames:[4,5,6]}]}},Jkn={region:K1e,primitives:[oH(zu.screen,"ground"),tn("feColorMatrix",{in:"SourceGraphic",type:"luminanceToAlpha",result:"lumRaw"}),tn("feComposite",{in:"lumRaw",in2:"SourceAlpha",operator:"in",result:"lum"}),tn("feComponentTransfer",{in:"lum",result:"beam"},tn("feFuncA",{type:"linear",slope:1.5,intercept:-.35})),tn("feComposite",{in:"beam",in2:"SourceAlpha",operator:"in",result:"trace"}),...Md(zu.phosphor,"trace","glow"),tn("feGaussianBlur",{in:"glow",stdDeviation:2.5,result:"bloom"}),...C4("<rect y='2' width='3' height='1' fill='black'/>",3,"scan"),tn("feOffset",{in:"scan",dx:0,dy:0,result:"scanRoll","data-sprite-boil":"roll"}),...Md(zu.screen,"scanRoll","scanlines",.6),B0("crt","ground","bloom","glow","scanlines")],boil:{intervalMs:120,tracks:[{name:"roll",attribute:"dy",frames:[0,1,2]}]}},Qkn={region:x6,primitives:[tn("feTurbulence",{type:"fractalNoise",baseFrequency:.03,numOctaves:3,seed:9,result:"flow"}),tn("feDisplacementMap",{in:"SourceGraphic",in2:"flow",scale:7,xChannelSelector:"R",yChannelSelector:"G",result:"bled"}),tn("feGaussianBlur",{in:"bled",stdDeviation:1.4,result:"wash"}),tn("feComponentTransfer",{in:"wash",result:"thin"},tn("feFuncR",{type:"linear",slope:.78,intercept:.2}),tn("feFuncG",{type:"linear",slope:.78,intercept:.2}),tn("feFuncB",{type:"linear",slope:.78,intercept:.2}),tn("feFuncA",{type:"linear",slope:.9,intercept:0})),tn("feGaussianBlur",{in:"wash",stdDeviation:3,result:"spread"}),tn("feComposite",{in:"wash",in2:"spread",operator:"arithmetic",k2:1.6,k3:-1.4,result:"rimMask"}),tn("feComponentTransfer",{in:"wash",result:"deep"},tn("feFuncR",{type:"linear",slope:.6,intercept:0}),tn("feFuncG",{type:"linear",slope:.6,intercept:0}),tn("feFuncB",{type:"linear",slope:.6,intercept:0})),tn("feComposite",{in:"deep",in2:"rimMask",operator:"in",result:"rim"}),tn("feTurbulence",{type:"fractalNoise",baseFrequency:.7,numOctaves:2,seed:11,result:"tooth"}),Vc("0 0 0 -0.8 1.5","tooth","toothMask"),sH("SourceGraphic","dark"),Vc("0 0 0 5 -3.8","dark","keyMask"),...Md(zu.ink,"keyMask","key",.9),B0("paint","thin","rim","key"),tn("feComposite",{in:"paint",in2:"toothMask",operator:"in"})]},Xkn=Ngt(Lgt)}}),$gt,Zkn,Ugt,Fgt,J1e,Bgt,eEn=A({"../../packages/sprite/dist/avatar.js"(){"use strict";yt(),Ykn(),$gt=["mushroom","cat","burger"],Zkn=wn(["shift","keep"]),Ugt=F().regex(/^#[0-9a-f]{6}$/i),Fgt=Et([Ugt,et(),Rt()]),J1e=16,Bgt=Dr({v:Ie(1),character:wn($gt),appearance:Ot(F().min(1),Fgt).refine(e=>Object.keys(e).length<=J1e,{message:`Avatar appearance cannot exceed ${String(J1e)} keys`}),expression:F().min(1),renderStyle:Mgt})}}),Q1e,jgt,qu,cH,N9,tEn,Wgt,zgt,qgt,Hgt,nEn,Ggt,Vgt,iEn,rEn,oEn,sEn,aEn,cEn,uEn,lEn,dEn,pEn,hEn,mEn,X1e,fEn,Y1e,Kgt,gEn,Z1e,e_e,Jgt,t_e,yEn,vEn,_En,Qgt,wEn,$9=A({"../../packages/agar/dist/agents.js"(){"use strict";QSn(),yt(),okn(),bkn(),wt(),eEn(),Q1e=F().trim().min(1).max(256).refine(e=>!/[\p{Cc}\p{Cf}]/u.test(e),{message:"An Agent name cannot contain control or invisible characters"}),jgt=Dr({rootAgentId:F(),agents:Me(Ou("outcome",[Dr({agentId:F(),name:F(),outcome:wn(["stopped","idle"])}),Dr({agentId:F(),name:F(),outcome:Ie("failed"),reason:F()})])),discoveryFailures:Me(Dr({agentId:F(),reason:F()})),notPermitted:et().int().nonnegative()}),qu=te.pipe(Ze(rn(1)),Ze(ft(256))),cH=Rr(e=>Bgt.safeParse(e).success,{expected:"an Avatar v1 descriptor"}),N9=V({agentId:qu,name:qu,avatar:cH,sessionOperations:ut(ct(["agent.read","agent.send","agent.manage"]))}),tEn=Ln(()=>Dr({agents:Me(Dr({agentId:F(),name:F()}))})),Wgt=At([ct(["new","none"]),V({computerId:qu})]),zgt=V({computerId:qu,name:qu,createdAt:on.pipe(Ze(Ff()))}),qgt=dt(ut(zgt)),Hgt=it(qgt,{onExcessProperty:"error"}),nEn=V({name:qu,requestId:qu,computer:Ue(Wgt),avatar:Ue(cH)}),Ggt=ut(N9),Vgt=it(Ggt,{onExcessProperty:"error"}),iEn=it(qu),rEn=it(am(Response)),oEn=L0("agent.list",1,Ln(()=>qf({list:Qa(Od(qt().transform(e=>Vgt(e))))}))),sEn=L0("agent.manage",1,Ln(()=>qf({open:Qa(_6),computers:Qa(Od(qt().transform(e=>Hgt(e)))),create:Qa(Od(qt().transform(e=>it(N9)(e))))}))),aEn=V({agentId:qu,name:qu}),cEn=L0("agent.rename",1,Ln(()=>qf({rename:Qa(Od(qt().transform(e=>it(N9)(e))))}))),uEn=V({agentId:qu}),lEn=L0("agent.stop",1,Ln(()=>qf({stopAll:Qa(Od(jgt))}))),dEn=V({agentId:qu,avatar:cH}),pEn=L0("agent.avatar",1,Ln(()=>qf({setAvatar:Qa(Od(qt().transform(e=>it(N9)(e))))}))),hEn=V({agentId:qu}),mEn=V({agentId:qu,expectedContent:dt(te),content:te}),X1e=V({agentId:qu,home:dt(V({name:te})),content:dt(te),bytes:rt.pipe(Ze(Wt(0))),limit:rt.pipe(Ze(Js(0)))}),fEn=L0("agent.instructions",2,Ln(()=>qf({read:Qa(Od(qt().transform(e=>it(X1e)(e)))),set:Qa(Od(qt().transform(e=>it(X1e)(e))))}))),Y1e=Ln(()=>Et([de({status:Ie("pending"),revision:F()}),de({status:Ie("approved"),revision:F()})])),Kgt=Ln(()=>Et([Y1e,de({error:F()})])),gEn=L0("agent.toolPolicy",1,Ln(()=>qf({status:Qa(Od(Et([Y1e,u0()]))),approve:Qa(Od(Kgt))}))),Z1e=Ln(()=>de({installationId:F(),name:F()})),e_e=Ln(()=>de({agentId:F(),attached:Me(Z1e),available:Me(Z1e)})),Jgt=Ln(()=>de({error:wn(["not_found","not_granted","not_extension"])})),t_e=Ln(()=>Et([e_e,Jgt])),yEn=L0("agent.extensions",1,Ln(()=>qf({list:Qa(Od(Et([e_e,u0()]))),attach:Qa(Od(t_e)),detach:Qa(Od(t_e))}))),vEn=L0("agent.read",1,Ln(()=>qf({open:Qa(_6),openInbox:Qa(_6)}))),_En=L0("agent.send",1,Ln(()=>qf({open:Qa(_6),openInbox:Qa(_6)}))),Qgt="https://agent-session.fungi.invalid",wEn=`${Qgt}/member`}}),S6,n_e,jw,uH,U9,i_e,lH,r_e,o_e,k6=A({"../../packages/shiitake/dist/session-attention.js"(){"use strict";wt(),S6=Td.check(ft(256)),n_e=rt.check(Wt(0)),jw=V({agentId:S6,sessionId:S6,name:S6}),uH=V({by:jw,reason:ct(["escalated","sender_archived","sender_absent"]),note:Ue(te.check(ft(1e3)))}),U9=V({id:S6,kind:Td.check(ft(64)),summary:Td.check(ft(200)),since:n_e,expiresAt:jt(n_e),inbox:jt(Ce(!1)),waitingOn:jt(jw),escalated:jt(uH)}),i_e=U9.mapFields(e=>({...e,extensionId:S6})),lH=64,r_e=4096,o_e=ut(i_e).check(ft(lH))}});function bEn(e){e.sql.exec(`CREATE TABLE IF NOT EXISTS session_attention_grants (
|
|
92
92
|
extension_id TEXT PRIMARY KEY
|
|
93
93
|
)`),e.sql.exec(`CREATE TABLE IF NOT EXISTS session_attention (
|
|
94
94
|
session_id TEXT NOT NULL REFERENCES sessions(id),
|