=l?o[d-l+1]:o[0]}let c=l=>{let{input:d,len:p,options:m}=l;if(n.rest.length===0&&p>s)for(let g=s;g{let p=l.length,m={ast:n,getParser:a,input:l,len:p,tailThreshold:Math.max(s,p-i),output:new globalThis.Array(p),issues:void 0,options:d},g=n.rest.length===0?s:Math.max(p,s+i),b=d.concurrency===void 0?1:fE(d.concurrency),x=b===1?V8(m,l,0,g):UTe(m,l,{concurrency:b,end:g});if(!x)return c(m);if(jt(x))return At(x,()=>c(m));let w=!0;return B(()=>w?(w=!1,O(x,()=>c(m))):f(l,d))};return(l,d)=>{if(l===ot)return pi;try{return Array.isArray(l)?(r||(r=n.elements.map(p=>({ast:p,parser:t(p)})),o=n.rest.map(p=>({ast:p,parser:t(p)}))),f(l,d)):j(new or(n,l,d))}catch(p){return _n(p)}}}_rebuild(e,t,n){let r=Ad(this.elements,e),o=Ad(this.rest,e);return r===this.elements&&o===this.rest&&t===this.checks&&n===this.encodingChecks?this:new Yi(this.isMutable,r,o,this.annotations,t,void 0,this.context,n)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return"array"}};function J8(e,t,n,r){if(n._tag==="Failure")return Hk(e,e.ast,r,n);let o=n===fn?t:n[Ye];if(o!==ot)e.output[r]=o;else{let s=e.getParser(e.tailThreshold,r);if(Ar(s.ast))return;let i=new rr([r],new Hu(s.ast.context?.annotations));if(e.options.errors==="all")e.issues?e.issues.push(i):e.issues=[i];else return Lf(new kr(e.ast,[i],e.input,e.options))}}var K8={onItem(e,t,n){let r=n{if(r.cause.reasons.length===0)return r;let o=Bb(r.cause);if(o===void 0)return Lr(Df(r.cause,i=>new kr(t,[new rr([n],i)],e.input,e.options)));let s=new rr([n],o);if(e.options.errors==="all")e.issues?e.issues.push(s):e.issues=[s];else return Lf(new kr(t,[s],e.input,e.options))},eI="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?";function zc(e,t,n=zs){let r,o;function s(i){switch(i._tag){case"String":case"TemplateLiteral":return(r??=Object.keys(e)).filter(a=>i.matchPart(a,n)!==void 0);case"Number":return(r??=Object.keys(e)).filter(a=>i.matchKey(a,n)!==void 0);case"Symbol":return(o??=Object.getOwnPropertySymbols(e)).filter(a=>Object.prototype.propertyIsEnumerable.call(e,a)&&i.matchKey(a,n)!==void 0);case"Union":return[...new Set(i.types.flatMap(s))];default:return[]}}return s(oC(yi(t)))}var Vk=class{name;type;constructor(e,t){this.name=e,this.type=t}};function Z8(e){switch(e._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return e.types.every(Z8);default:return!1}}function Q8(e){let t=Km(e);switch(t._tag){case"String":case"Number":case"Symbol":case"TemplateLiteral":return!0;case"Union":return t.types.every(Q8);default:return!1}}function DTe(e){return Z8(e)&&Q8(e)}var Zk=class{parameter;type;constructor(e,t){if(!DTe(e))throw new Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,Ar(t)&&!v2(t))throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},Md=class extends pr{_tag="Objects";propertySignatures;indexSignatures;encodingChecks;constructor(e,t,n,r,o,s,i){super(n,r,o,s),this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=i}getParser(e,t=e){let n=this,r=n.propertySignatures.length,o=n.indexSignatures.length;if(!r&&!o)return Wc(n,Yy);let s,i,a=()=>(s||(s=n.propertySignatures.map(d=>({parser:t(d.type),name:d.name,type:d.type})),i=o?n.indexSignatures.map(d=>({is:d,parserKey:e(oC(d.parameter)),parserValue:t(d.type)})):void 0),s),c=()=>{let d=new Set(n.propertySignatures.map(x=>typeof x.name=="number"?globalThis.String(x.name):x.name)),p=(x,w,E,S,y)=>{if(y._tag==="Failure")return Hk(x,n,w,y)??un;let h=y===fn?S:y[Ye];if(E!==ot&&h!==ot){if(r&&(d.has(w)||d.has(typeof E=="number"?globalThis.String(E):E)))return un;U(x.out,E,h)}return un},m=(x,w,E,S)=>{if(!S){let T=E.parserKey(w,x.options);if(!jt(T))return O(Zo(T),C=>m(x,w,E,C));S=T}if(S._tag==="Failure")return Hk(x,n,w,S)??un;let y=S===fn?w:S[Ye],h=x.input[w],I=E.parserValue(h,x.options);return jt(I)?p(x,w,y,h,I):O(Zo(I),T=>p(x,w,y,h,T))},g=(x,w,E)=>{let S=x.input[w],y=E.parserValue(S,x.options);return jt(y)?p(x,w,w,S,y):O(Zo(y),h=>p(x,w,w,S,h))},b=o?PT()({onItem:(x,[w,E])=>E.is.parameter===Is?g(x,w,E):m(x,w,E),step:(x,w,E)=>E._tag==="Failure"?E:void 0}):void 0;return I1(function*(x,w){if(x===ot)return ot;if(!(typeof x=="object"&&x!==null&&!Array.isArray(x)))return yield*j(new or(n,x,w));a();let E=x,S={},y={ast:n,input:E,out:S,issues:void 0,options:w},h=w.errors==="all",I=w.onExcessProperty==="error",T=w.concurrency===void 0?1:fE(w.concurrency),C=o&&I?n.indexSignatures.map(k=>zc(E,k.parameter,w)):void 0;if(I){let k=C?new Set(d):d;if(C)for(let D of C)for(let z of D)k.add(z);let _=Reflect.ownKeys(E);for(let D=0;D<_.length;D++){let z=_[D];if(!k.has(z)&&Object.prototype.propertyIsEnumerable.call(E,z)){let he=new Mk(n,E[z],w),Re=new rr([z],he);if(h){y.issues?y.issues.push(Re):y.issues=[Re];continue}else return yield*j(new kr(n,[Re],x,w))}}}if(r){let k=T===1?VD(y,s):LTe(y,s,{concurrency:T});k&&(yield*k)}if(o&&T===1)for(let k=0;k{let g=s[p];return O(Zo(m),b=>{let x=zk(d,g,b);if(x)return x;let w=()=>_o(d.out),E=VD(d,s.slice(p+1));return E?At(E,w):w()})};return(d,p)=>{if(d===ot)return pi;if(p.errors==="all"||p.onExcessProperty!==void 0||p.concurrency!==void 0&&fE(p.concurrency)!==1)return(f??=c())(d,p);if(!(typeof d=="object"&&d!==null&&!Array.isArray(d)))return j(new or(n,d,p));let m=a(),g=d,b={},x={ast:n,input:g,out:b,issues:void 0,options:p};try{for(let w=0;w{let a=e(i.type);return a===i.type?i:new Vk(i.name,a)}),s=Ad(this.indexSignatures,i=>{let a=t(i.parameter),c=e(i.type);return a===i.parameter&&c===i.type?i:new Zk(a,c)});return o===this.propertySignatures&&s===this.indexSignatures&&n===this.checks&&r===this.encodingChecks?this:new Md(o,s,this.annotations,n,void 0,this.context,r)}flip(e){return this._rebuild(e,e,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?"object | array":"object"}};function zk(e,t,n){if(n._tag==="Failure")return Hk(e,e.ast,t.name,n);if(n===fn)return;let r=n[Ye];if(r!==ot){U(e.out,t.name,r);return}if(delete e.out[t.name],!Ar(t.type)){let o=new rr([t.name],new Hu(t.type.context?.annotations));if(e.options.errors==="all"){e.issues?e.issues.push(o):e.issues=[o];return}else return Lf(new kr(e.ast,[o],e.input,e.options))}}var Y8={onItem(e,t){if(!Ix(e.input,t.name))return t.parser(ot,e.options);let n=e.input[t.name];return U(e.out,t.name,n),t.parser(n,e.options)},step:zk},VD=NT()(Y8),LTe=PT()(Y8);function l2(e,t){return e?t?[...e,...t]:e:t}function tI(e,t,n){return new Md(Reflect.ownKeys(e).map(r=>new Vk(r,e[r].ast)),[],n,t)}function wx(e){return e.ast}function Qk(e,t=void 0){return new Yi(!1,e.map(n=>n.ast),[],void 0,t)}function nI(e,t,n){return new js(e.map(wx),t,void 0,n)}function d2(e,t){if(e.encoding||t.some(s=>s.encoding))throw new Error("StructWithRest does not support encodings");let n=e.propertySignatures,r=e.indexSignatures,o=e.checks;for(let s of t){for(let i of s.propertySignatures)if(n.some(a=>a.name===i.name))throw new Error(`Duplicate identifier: ${JSON.stringify(i.name)}. ts(2300)`);n=n.concat(s.propertySignatures),r=r.concat(s.indexSignatures),o=l2(o,s.checks)}return new Md(n,r,void 0,o)}function p2(e,t){if(e.encoding)throw new Error("TupleWithRest does not support encodings");return new Yi(e.isMutable,e.elements,t,void 0,e.checks)}function m2(e){if(e.encoding)throw new Error("mutable does not support encodings");return new Yi(!0,e.elements,e.rest,e.annotations,e.checks,void 0,e.context,e.encodingChecks)}var h2=bl(e=>{for(;;){if(t2(e))return Ba;let t=e.encoding;if(!t)return e.recur?.(h2,L)??e;if(t.some(n=>n.transformation._tag==="Middleware"&&n.transformation.decode!==L))return Ba;e=t[t.length-1].to}});function X8(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(X8)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function zm(e){switch(e._tag){default:return[];case"Declaration":{let t=e.annotations?.[Nb];return Array.isArray(t)?t:[]}case"Objects":return e.propertySignatures.flatMap(t=>{let n=t.type;if(!Ar(n)){if(Hm(n))return[{key:t.name,literal:n.literal}];if(Bk(n))return[{key:t.name,literal:n.symbol}]}return[]});case"Arrays":return e.elements.flatMap((t,n)=>{if(!Ar(t)){if(Hm(t))return[{key:n,literal:t.literal}];if(Bk(t))return[{key:n,literal:t.symbol}]}return[]});case"Union":{if(e.types.length===0)return[];let t=e.types.map(n=>zm(h2(n)));return t[0].filter(n=>t.every(r=>r.some(o=>o.key===n.key&&o.literal===n.literal)))}case"Suspend":return zm(e.thunk())}}var k8=new WeakMap,$k=Object.freeze([]),C8=e=>e===null?"null":Array.isArray(e)?"array":typeof e,Ix=(e,t)=>t==="__proto__"?Object.hasOwn(e,t):t in e;function Tx(e){let t=k8.get(e);if(t)return t;let n,r=0,o,s,i=!0,a=[];for(let l=0;lc[l]??=Object.freeze(o?.[l]??$k);if(i&&s)s.forEach(Object.freeze),t=l=>s.get(l)??$k;else if(n?.size===1&&!o){let[l,[d]]=n.entries().next().value,p=new Map;for(let[g,b]of d)p.set(g,Object.freeze(Array.from(b)));let m=Object.freeze(e.map((g,b)=>b));t=(g,b)=>{if(Bh(g)){let x=Ix(g,l)?g[l]:void 0;if(x!==void 0)return p.get(x)??$k;if(b)return m}return $k}}else if(n){let l;for(let d of n)(!l||d[1][0].size>l[1][0].size)&&d[1][1].size===r&&(l=d);t=(d,p)=>{let m=C8(d);if(!Bh(d))return f(m);let g=new Set(o?.[m]),b;if(l){let[x,[w]]=l,E=Ix(d,x),S=E?d[x]:void 0;if(E&&(!p||S!==void 0)){let y=w.get(S);if(!y)return f(m);for(let h of y)g.add(h);b=x}}if(b===void 0)for(let[x,[w,E]]of n){let S=Ix(d,x),y=S?d[x]:void 0;if(S&&(!p||y!==void 0)){let h=w.get(y);if(h)for(let I of h)g.add(I)}else if(p)for(let h of E)g.add(h)}for(let[x,[w,E]]of n){if(x===b)continue;let S=Ix(d,x),y=S?d[x]:void 0;if(S&&(!p||y!==void 0)){let h=w.get(y);for(let I of g)E.has(I)&&!h?.has(I)&&g.delete(I)}}return Array.from(g).sort((x,w)=>x-w)}}else t=l=>{let d=f(C8(l));return s?d.filter(p=>a[p]===void 0||a[p]===l):d};return k8.set(e,t),t}var js=class extends pr{_tag="Union";types;options;encodingChecks;constructor(e,t,n,r,o,s,i){super(n,r,o,s),this.types=e,this.options=t,this.encodingChecks=i}getParser(e,t){let n=this,r=t!==void 0,o=[],s=a=>o[a]??=e(n.types[a]),i;return(a,c)=>{if(a===ot)return pi;let f=(i??=Tx(n.types))(a,r);if(f.length===0)return j(new Ex(n,[],a,c));if(f.length===1){let l=s(f[0])(a,c);return l._tag==="Success"?l:jt(l)?eQ(n,l.cause,a,c):$Te(n,l,a,c)}return tQ(n,s,f,a,c)}}_rebuild(e,t,n){let r=Ad(this.types,e);return r===this.types&&t===this.checks&&n===this.encodingChecks?this:new js(r,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(let n of this.types){let r=n.matchPart(e,t);if(r!==void 0)return r}}getExpected(e){let t=this.annotations?.expected;if(typeof t=="string")return t;if(this.types.length===0)return"never";let n=this.types.map(r=>{let o=yi(r);switch(o._tag){case"Arrays":{let s=o.elements.filter(Hm);if(s.length>0)return`${M8(o.isMutable)}[ ${s.map(i=>e(i)+O8(i.context?.isOptional)).join(", ")}, ... ]`;break}case"Objects":{let s=o.propertySignatures.filter(i=>Hm(i.type));if(s.length>0)return`{ ${s.map(i=>`${M8(i.type.context?.isMutable)}${Ms(i.name)}${O8(i.type.context?.isOptional)}: ${e(i.type)}`).join(", ")}, ... }`;break}}return e(o)});return Array.from(new Set(n)).join(" | ")}};function eQ(e,t,n,r){let o=Bb(t);return o?Lf(new Ex(e,[o],n,r)):Lr(t)}function $Te(e,t,n,r){return Lt(t,o=>eQ(e,o,n,r))}function tQ(e,t,n,r,o){let s={ast:e,parser:t,input:r,out:void 0,successes:e.options?.mode==="oneOf"?[]:void 0,issues:void 0,options:o},i=BTe(s,n);if(!i)return s.out?s.out:j(new Ex(e,s.issues??[],r,o));if(jt(i))return A8(i,s);let a=!0;return B(()=>a?(a=!1,A8(i,s)):tQ(e,t,n,r,o))}function A8(e,t){return At(e,n=>t.out===fn?v(t.input):t.out?t.out:j(new Ex(t.ast,t.issues??[],t.input,t.options)))}var BTe=NT()({onItem(e,t){return e.parser(t)(e.input,e.options)},step(e,t,n){if(n._tag==="Failure"){let r=Bb(n.cause);if(r===void 0)return n;e.issues?e.issues.push(r):e.issues=[r]}else{if(e.out&&e.successes)return e.successes.push(e.ast.types[t]),Lf(new BU(e.ast,e.successes,e.input,e.options));if(e.out=n,e.successes)e.successes.push(e.ast.types[t]);else return un}}}),nQ=new js([new gi("Infinity"),new gi("-Infinity"),new gi("NaN")]);function M8(e){return e?"":"readonly "}function O8(e){return e?"?":""}var Yk=class extends pr{_tag="Suspend";thunk;constructor(e,t,n,r,o){if(n)throw new Error("Cannot add checks to Suspend");super(t,void 0,r,o);let s;this.thunk=()=>s??=e()}getParser(e){let t;return(n,r)=>(t??=e(this.thunk()))(n,r)}recur(e){return new Yk(()=>e(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(e){return e(this.thunk())}},Xb=class extends lf{_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 Xb(this.run,{...this.annotations,...e},this.aborted)}abort(){return new Xb(this.run,this.annotations,!0)}and(e,t){return new Cd([this,e],t)}},Cd=class extends lf{_tag="FilterGroup";checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(e){return new Cd(this.checks,{...this.annotations,...e})}and(e,t){return new Cd([this,e],t)}};function Gm(e,t,n=!1){return new Xb((r,o,s)=>HU(o,e(r,o,s),r,s),t,n)}function vx(e,t){return new Xb((n,r,o)=>e(n)?void 0:new _e(void 0,n,o),t,!0)}function Xk(e){return Gm(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})}var eC=qc(Kk,[Xk()]),HTe=new Kn(new js([eC,nQ]),new pt(qb(),Se(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function kx(e,t){let n=new globalThis.RegExp(e),r={source:n.source,flags:n.flags};return Gm(o=>(n.lastIndex=0,n.test(o)),{expected:`a string matching the RegExp ${r.source}`,representation:{id:"effect/schema/isPattern",payload:r},toJsonSchema:()=>[{},!0],arbitraryConstraint:{patterns:[r]},...t})}var ZD=new WeakMap;function rI(e,t){let n=Object.assign(Object.create(Object.getPrototypeOf(e)),e,t);return Reflect.ownKeys(t).every(r=>r==="context"||r==="encoding")&&ZD.set(n,Jm(e)),n}function Jm(e){let t=ZD.get(e);if(t!==void 0)return t;if(e.encoding===void 0)return e;let n=Object.assign(Object.create(Object.getPrototypeOf(e)),e,{encoding:void 0});return ZD.set(e,n),n}function ln(e,t){return e.encoding===t?e:rI(e,{encoding:t})}function Od(e,t){if(e.context===t)return e;let n=Jm(e);return n.context===t&&n.encoding===e.encoding?n:rI(e,{context:t})}function Km(e){return e.encoding?Km(e.encoding[e.encoding.length-1].to):e}function Ha(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return oI(e,Nl(e.checks.slice(0,-1),n.annotate(t)))}return rI(e,{annotations:{...e.annotations,...t}})}function oI(e,t){if(e._tag==="Suspend"&&t)throw new Error("Cannot add checks to Suspend");return e.checks===t?e:rI(e,{checks:t})}function qc(e,t){return oI(e,l2(e.checks,t))}function Vm(e,t){let n=t(e.to);return n===e.to?e:new Kn(n,e.transformation)}function g2(e,t){let n=e,r=n[n.length-1],o=Vm(r,t);return o===r?e:Nl(e.slice(0,e.length-1),o)}function tC(e){return t=>t.encoding?ln(t,g2(t.encoding,e)):t}function sI(e,t){return tC(n=>Od(n,t))(e)}function x2(e){function t(n){return n.encoding?ln(n,g2(n.encoding,t)):e(n)}return Zs(t)}function Rd(e,t){function n(r){if(r.encoding){let o=r.encoding[r.encoding.length-1];return t?.stopAt?.(o)?r:ln(r,g2(r.encoding,n))}return e(r)}return bl(n)}function y2(e,t){return E2(e,t,Sn(e))}function S2(e,t){return E2(yi(e),t,e)}function E2(e,t,n){let r=new Kn(e,t);return ln(n,n.encoding?[...n.encoding,r]:[r])}function Ad(e,t){let n;for(let r=0;r{let t=e.context?e.context.isOptional===!1?new jc(!0,e.context.isMutable,e.context.constructorDefault,e.context.annotations):e.context:new jc(!0,!1);return zTe(Od(e,t))}),zTe=tC(_d),b2=Zs(e=>_d(new js([e,Wk]))),nC=bl(e=>{let t=e.context?e.context.isMutable===!1?new jc(e.context.isOptional,!0,e.context.constructorDefault,e.context.annotations):e.context:new jc(!1,!0);return jTe(Od(e,t))}),jTe=tC(nC);function I2(e,t){let n=e.context?new jc(e.context.isOptional,e.context.isMutable,t,e.context.annotations):new jc(!1,!1,t);return Od(e,n)}function Xf(e,t,n){return E2(e,n,t)}function qTe(e){let t=[],n=[];function r(o){switch(o._tag){case"Literal":up(o.literal)&&!t.includes(o.literal)&&t.push(o.literal);return;case"UniqueSymbol":t.includes(o.symbol)||t.push(o.symbol);return;case"Never":return;case"Union":for(let s=0;snew Vk(o,t)),r.map(o=>new Zk(o,t)))}function Ar(e){return e.context?.isOptional??!1}function T2(e){return e.context?.isMutable??!1}function rQ(e){return e.annotations?.[di]===!0||e._tag==="FilterGroup"&&e.checks.every(rQ)}function WTe(e){function t(r){return rQ(r)?[r]:r._tag==="FilterGroup"?r.checks.flatMap(t):[]}let n=e.flatMap(t);return pn(n)?n:void 0}function GTe(e){let t=!0;function n(r){return t=t&&!r.encoding&&!t2(r),t&&"recur"in r&&r.recur(n),r}return"recur"in e&&e.recur(n),t}var Sn=bl(e=>{let t=Jm(e);if(t!==e){let r=Sn(t);return r===t&&e.encoding===void 0?e:Od(r,e.context)}let n="recur"in e?e.recur(Sn):e;if("encodingChecks"in n&&n.encodingChecks){let r=GTe(e)?n.encodingChecks:jk(n)||_8(n)||qm(n)&&n.typeParameters.length>0?WTe(n.encodingChecks):void 0;return rI(n,{encodingChecks:void 0,checks:l2(n.checks,r)})}return n}),yi=bl(e=>Sn(xi(e)));function JTe(e,t){let n=t,r=n.length,o=n[r-1],s=[new Kn(xi(ln(e,void 0)),n[0].transformation.flip())];for(let a=1;a{if(e.encoding)return JTe(e,e.encoding);let t=Jm(e);if(t!==e){let n=xi(t);return n===t?e:Od(n,e.context)}return"flip"in e?e.flip(xi):"recur"in e?e.recur(xi):e});function v2(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(v2);default:return!1}}function rC(e,t){let n=t===0?fn:_o(t);return(r,o)=>r===ot?pi:r===t?n:j(new or(e,r,o))}function Wc(e,t){return(n,r)=>n===ot?pi:t(n)?fn:j(new or(e,n,r))}function oQ(e,t,n){let r=e.encodedParts,o=e.literals,s=t.length;for(let f=0;fs)return;let i=new Array(r.length),a;function c(f,l){if(f===r.length)return l===s;if(a?.has(f*(s+1)+l))return!1;let d=r[f];if(f===r.length-1){let p=t.slice(l);if(d.matchPart(p,n)!==void 0)return i[f]=p,!0}else if(d._tag==="Literal"){let p=o[f];if(t.startsWith(p,l)&&c(f+1,l+p.length))return i[f]=p,!0}else{let p=s-e.suffixLengths[f+1],m=o[f+1],g=m===void 0?p:t.lastIndexOf(m,p);for(;g>=l;){let b=t.slice(l,g);if(d.matchPart(b,n)!==void 0&&c(f+1,g))return i[f]=b,!0;if(g===0)break;g=m===void 0?g-1:t.lastIndexOf(m,g-1)}}return a??=new Set,a.add(f*(s+1)+l),!1}return c(0,0)?i:void 0}var oC=Rd(e=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(oC)}}),iI=Rd(e=>{switch(e._tag){default:return e;case"Symbol":case"UniqueSymbol":return e.toCodecStringTree();case"Union":return e.recur(iI)}}),k2=Rd(e=>{switch(e._tag){default:return e;case"Number":case"Literal":case"BigInt":return e.toCodecStringTree();case"Union":return e.recur(k2)}}),C2="[\\s\\S]*?",QD=new globalThis.RegExp(`^${eI}$`),KTe=new globalThis.RegExp(`^(?:${eI}|Infinity|-Infinity|NaN)$`);function sC(e){return kx(QD,{expected:"a string representing a finite number",representation:{id:"effect/schema/isStringFinite",payload:null},toJsonSchema:()=>({pattern:QD.source}),...e})}var sQ=qc(Is,[sC()]),VTe=new Kn(sQ,$m),ZTe=new Kn(new js([sQ,nQ]),$m),QTe="-?\\d+",YD=new globalThis.RegExp(`^${QTe}$`);function iC(e){return kx(YD,{expected:"a string representing a bigint",representation:{id:"effect/schema/isStringBigInt",payload:null},toJsonSchema:()=>({pattern:YD.source}),...e})}var aC=qc(Is,[iC({expected:"a string representing a bigint"})]),YTe=new Kn(aC,Qb),XTe="Symbol\\(([\\s\\S]*)\\)",XD=new globalThis.RegExp(`^${XTe}$`),iQ=qc(Is,[cC()]),aQ=new Kn(iQ,new pt(Se(e=>globalThis.Symbol.for(XD.exec(e)[1])),Jn((e,t)=>globalThis.Symbol.keyFor(e)!==void 0?v(globalThis.String(e)):j(new Sx({message:"cannot serialize to string, Symbol is not registered"},e,t)))));function cC(e){return kx(XD,{expected:"a string representing a symbol",representation:{id:"effect/schema/isStringSymbol",payload:null},toJsonSchema:()=>({pattern:XD.source}),...e})}function za(e,t,n,r,o){for(let s=0;s0;){let o=r[r.length-1],s=o.keys;if(typeof s=="number"){if(o.index(e,t,n)=>Gc(e)?fn:j(new or(t,e,n)),{representation:{id:"effect/schema/Json",payload:null},expected:"JSON value",toCodecJson:()=>{},toCodecStringTree:()=>fC}),M2=Ha(jm,{representation:{id:"effect/schema/MutableJson",payload:null}}),uC=new Kn(jm,Lm()),O2=new Kn(new js([new Yi(!1,[],[jm]),new Md([],[new Zk(Is,jm)])]),Lm());function uQ(e){return cQ(e,ive)}var ave=new Wm([],()=>(e,t,n)=>uQ(e)?fn:j(new or(t,e,n)),{expected:"StringTree",toCodecStringTree:()=>{}}),fC=new Kn(ave,Lm());var Si={};H(Si,{_is:()=>Nd,_issue:()=>P2,asOption:()=>j2,asserts:()=>F2,decodeEffect:()=>fI,decodeExit:()=>yve,decodeOption:()=>U2,decodePromise:()=>xve,decodeResult:()=>Sve,decodeSync:()=>lI,decodeUnknownEffect:()=>Pn,decodeUnknownExit:()=>yC,decodeUnknownOption:()=>SC,decodeUnknownPromise:()=>gve,decodeUnknownResult:()=>Ox,decodeUnknownSync:()=>gQ,encodeEffect:()=>D2,encodeExit:()=>bve,encodeOption:()=>L2,encodePromise:()=>Eve,encodeResult:()=>Ive,encodeSync:()=>dI,encodeUnknownEffect:()=>el,encodeUnknownExit:()=>EC,encodeUnknownOption:()=>bC,encodeUnknownPromise:()=>xQ,encodeUnknownResult:()=>IC,encodeUnknownSync:()=>yQ,is:()=>xC,make:()=>uI,makeEffect:()=>gC,makeOption:()=>cI,run:()=>ju});var lC=(e,t,n)=>e===fn?n(t):At(e,n);function lQ(e){if(e._tag==="Middleware")return(n,r,o)=>{let s=n===fn?e.decode(_o(Fb(r)),o):e.decode(Mo(n,Fb),o);return fQ(s)};let t=e.decode;switch(t._tag){case"Passthrough":return(n,r)=>n===fn?_o(r):n;case"Transform":{let n=r=>r===ot?pi:_o(t.transform(r));return(r,o)=>lC(r,o,n)}case"TransformOptional":{let n=r=>UU(t.transform(Fb(r)));return(r,o)=>lC(r,o,n)}case"TransformEffect":return(n,r,o)=>lC(n,r,s=>s===ot?pi:t.transform(s,o));case"TransformOptionalEffect":return(n,r,o)=>lC(n,r,s=>fQ(t.transform(Fb(s),o)))}}var fQ=e=>At(e,UU),dQ=(e,t,n,r)=>Lt(r,o=>Cu(()=>Df(o,s=>new $U(e,s,t,n))));function cve(e,t){let n=lQ(e.link.transformation),r;return(o,s)=>{if(o===ot)return pi;if(e.isConstructed(o))return fn;let i=(r??=t(e.link.to))(o,s);return n(i,o,s)}}function uve(e,t){let n=e.context.constructorDefault;return(r,o)=>{if(r!==ot&&r!==void 0)return t(r,o);let s=n;if(jt(s)&&s._tag==="Success"){let i=t(s[Ye],o);return i===fn?s:i}return At(dQ(e,r,o,s),i=>{let a=t(i,o);return a===fn?_o(i):a})}}function R2(e,t){let n=t(e);return e.context?.constructorDefault===void 0?n:uve(e,n)}function aI(e,t,n,r,o){if(e._tag==="Declaration")for(let g of e.typeParameters)t(g);let s=n?A2(e):void 0,i=s?cve(s,t):r??e.getParser(t,n),a=e.checks,c=e.encoding,f=c?.map(g=>lQ(g.transformation)),l=e.encodingChecks;if(!c&&!a&&!l)return i;let d,p=(g,b)=>{let x=i(g,b);if(l&&!b.disableChecks)if(jt(x)){if(x._tag==="Success"){let w=x===fn?g:x[Ye];if(g!==ot&&w!==ot){let E=za(l,g,void 0,e,b);E&&(x=j(new kr(e,E,g,b)))}}}else x=O(x,w=>{if(g!==ot&&w!==ot){let E=za(l,g,void 0,e,b);if(E)return j(new kr(e,E,g,b))}return v(w)});if(a&&!b.disableChecks)if(jt(x)){if(x._tag==="Success"){let w=x===fn?g:x[Ye];if(w===ot)return x;let E=za(a,w,void 0,e,b);E&&(x=j(new kr(e,E,w,b)))}}else x=O(x,w=>{if(w!==ot){let E=za(a,w,void 0,e,b);if(E)return j(new kr(e,E,w,b))}return v(w)});return x},m=o===void 0?p:o(p);return c?(g,b)=>{let x=d??=c.map(S=>t(S.to)),w=g,E=x[x.length-1](g,b);for(let S=c.length-1;S>=0;S--)if(E=f[S](E,w,b),S!==0){let y=x[S-1];E._tag==="Success"?(w=E[Ye],E=y(w,b)):E=At(E,h=>{let I=y(h,b);return I===fn?_o(h):I})}if(E._tag==="Success"){let S=E[Ye],y=m(S,b);return y===fn?E:y}return E=dQ(e,g,b,E),At(E,S=>{let y=m(S,b);return y===fn?_o(S):y})}:m}var mC=Symbol(),pQ=new WeakMap,mQ,Mx=!1;var lve=e=>Mx?pC(Xi,e,"parser"):Xi(e).parser,hQ=e=>Mx?pC(Xi,e,"makeEffect"):Xi(e).makeEffect,dve=e=>R2(e,hQ),dC=class{ast;constructor(t){this.ast=t}get decodeEffect(){return this.cachedDecodeEffect??=aI(this.ast,lve)}get parser(){return this.decodeEffect}get makeEffect(){return this.cachedMakeEffect??=aI(this.ast,hQ,dve)}},_2=class extends dC{compiled;resolve;constructor(t,n,r){super(t),this.compiled=n,this.resolve=r}save(t,n){return Object.defineProperty(this,t,{value:n}),n}operation(t){let n=this.compiled;return typeof n=="function"?n(this.ast,this.resolve,t):n?.[t]}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")??aI(this.ast,t=>pC(this.resolve,t,"parser")))}get parser(){let t=this.decode;return t===void 0?this.decodeEffect:this.save("parser",pve(t,()=>this.decodeEffect))}get makeEffect(){let t=this.operation("makeEffect");if(t!==void 0)return this.save("makeEffect",t);let n=r=>pC(this.resolve,r,"makeEffect");return this.save("makeEffect",aI(this.ast,n,r=>R2(r,n)))}};function pve(e,t){let n;return(r,o)=>{if(r!==ot)try{let s=e(r,o);if(s!==mC)return s===r?fn:_o(s)}catch(s){return _n(s)}return(n??=t())(r,o)}}function pC(e,t,n){let r=e(t);if(r.compiled===void 0||Object.hasOwn(r,n))return r[n];let o;return(s,i)=>(o??=r[n])(s,i)}function Xi(e){let t=pQ.get(e);if(t!==void 0)return t;let n=mQ===void 0?new dC(e):new _2(e,mQ(e,Xi),Xi);return pQ.set(e,n),n}function gC(e){let t=e.ast,n;return(r,o)=>(n??=H2(Cve,Sn(t)))(r,o?.disableChecks?o?.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions)}function cI(e){let t=gC(e);return(n,r)=>{let o=_a(t(n,r));return Dt(o)?N(o.value):(hi(o.cause,"Option adapter can only return none for schema issues"),R())}}function uI(e){return vve(Sn(e.ast))}function xC(e){return Nd(e.ast)}function hve(e){if(!Mx){let o=Rx(ju(e));return s=>{let i=o(s,zs);return Dt(i)?!0:(hi(i.cause,"Type guard adapter can only return false for schema issues"),!1)}}let t=Xi(e),n=t.is;if(n!==void 0)return o=>{try{return n(o,zs)}catch(s){return hi(Kp(s),"Type guard adapter can only return false for schema issues"),!1}};let r=t.parser;return o=>{let s=_a(B2(r(o,zs),o));return Dt(s)?!0:(hi(s.cause,"Type guard adapter can only return false for schema issues"),!1)}}function Nd(e){let t=Sn(e),n=r=>(n=hve(t),n(r));return r=>n(r)}function P2(e){let t=ju(e);return(n,r)=>{let o=_a(t(n,r));if(!Dt(o))return hi(o.cause,"Issue adapter can only return schema issues")}}function F2(e,t){let n=Sn(e.ast),r=Xi(n).parser(t,zs),o=_a(B2(r,t));if(Jr(o)){let s=hi(o.cause,"Assertion adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}function Pn(e,t){let n=ju(e.ast);return t===void 0?n:(r,o)=>n(r,$2(t,o))}var fI=Pn;function gve(e,t){return z2(Pn(e,t))}function xve(e,t){return z2(fI(e,t))}function yC(e,t){return Rx(Pn(e,t))}var yve=yC;function SC(e,t){return j2(Pn(e,t))}var U2=SC;function Ox(e,t){return SQ(Pn(e,t))}var Sve=Ox;function gQ(e,t){return Mx?EQ(e.ast,t):q2(Pn(e,t))}var lI=gQ;function el(e,t){let n=ju(xi(e.ast));return t===void 0?n:(r,o)=>n(r,$2(t,o))}var D2=el,xQ=(e,t)=>z2(el(e,t)),Eve=xQ;function EC(e,t){return Rx(el(e,t))}var bve=EC;function bC(e,t){return j2(el(e,t))}var L2=bC;function IC(e,t){return SQ(el(e,t))}var Ive=IC;function yQ(e,t){return Mx?EQ(xi(e.ast),t):q2(el(e,t))}var dI=yQ,$2=(e,t)=>t?{...e,...t}:e,hC=e=>e===ot?j(new _e):v(e);function ju(e){return H2(kve,e)}function B2(e,t){return e===fn?v(t):jt(e)?e[Ye]===ot?hC(ot):e:At(e,hC)}function H2(e,t){let n;return(r,o)=>{let s=(n??=e(t))(r,o??zs);return s===fn?v(r):jt(s)?s[Ye]===ot?hC(ot):s:At(s,hC)}}function z2(e){return(t,n)=>dm(e(t,n)).then(r=>{if(Dt(r))return r.value;let o=hi(r.cause,"Promise adapter can only reject schema issues");throw new Error("Schema validation failed",{cause:o})})}function Rx(e){return(t,n)=>_a(e(t,n))}function j2(e){let t=Rx(e);return(n,r)=>{let o=t(n,r);return Dt(o)?N(o.value):(hi(o.cause,"Option adapter can only return none for schema issues"),R())}}function SQ(e){let t=Rx(e);return(n,r)=>{let o=t(n,r);return Dt(o)?G(o.value):Z(hi(o.cause,"Result adapter can only return schema issues"))}}function EQ(e,t){let n;return(r,o)=>(n??=wve(Xi(e),t))(r,o)}function wve(e,t){let n=e.decode,r,o=n===void 0?(s,i=zs)=>(r??=N2(e))(s,i):(s,i=zs)=>{if(s===ot)return(r??=N2(e))(s,i);let a;try{a=n(s,i)}catch(c){throw hi(Kp(c),"Sync adapter can only throw schema issues"),c}return a!==mC?a:(r??=N2(e))(s,i)};return t===void 0?o:(s,i)=>o(s,$2(t,i))}function N2(e){return q2(H2(()=>e.decodeEffect,e.ast))}function q2(e){let t=Rx(e);return(n,r)=>{let o=t(n,r);if(Dt(o))return o.value;let s=hi(o.cause,"Sync adapter can only throw schema issues");throw new Error("Schema validation failed",{cause:s})}}function Tve(e,t){let n=_a(e);if(Dt(n))return n.value;let r=hi(n.cause,t);throw new Error("Schema validation failed",{cause:r})}function vve(e){let t,n;return(r,o)=>{t??=Xi(e);let s=o?.disableChecks?o.parseOptions?{...o.parseOptions,disableChecks:!0}:{disableChecks:!0}:o?.parseOptions??zs,i=t.make;if(i!==void 0&&r!==ot){let c;try{c=i(r,s)}catch(f){throw hi(Kp(f),"Constructor adapter can only throw schema issues"),f}if(c!==mC&&c!==ot)return c}let a=(n??=t.makeEffect)(r,s);return Tve(B2(a,r),"Constructor adapter can only throw schema issues")}}var kve=e=>Xi(e).parser,Cve=e=>Xi(e).makeEffect;var wC="~effect/Schema/Schema",bQ=Symbol(),Ave={[wC]:wC,get make(){let e=uI(this);return Object.defineProperty(this,"make",{value:e,enumerable:!0}),e},get makeEffect(){let e=gC(this);return Object.defineProperty(this,"makeEffect",{value:e,enumerable:!0}),e},get makeOption(){let e=cI(this);return Object.defineProperty(this,"makeOption",{value:e,enumerable:!0}),e},pipe(){return re(this,arguments)},annotate(e){return this.rebuild(Ha(this.ast,e))},annotateKey(e){return this.rebuild(Cx(this.ast,e))},check(...e){return this.rebuild(qc(this.ast,e))},rebuild(e){return Jc(e,this[bQ])}};function Jc(e,t){function n(){}let r=Object.setPrototypeOf(n,Ave);return t&&(Object.hasOwn(t,"name")||Object.hasOwn(t,"length")||Object.hasOwn(t,"__proto__"))?Object.defineProperties(r,Object.getOwnPropertyDescriptors({...t})):Object.assign(r,t),r[bQ]=t,r.ast=e,r}var gI={};H(gI,{META_SCHEMA_URI_DRAFT_04:()=>CQ,META_SCHEMA_URI_DRAFT_07:()=>K2,META_SCHEMA_URI_DRAFT_2020_12:()=>mI,VALID_OPEN_API_COMPONENTS_SCHEMAS_KEY_REGEXP:()=>J2,fromSchemaDraft07:()=>Rve,fromSchemaDraft2020_12:()=>MC,fromSchemaOpenApi3_0:()=>Nve,fromSchemaOpenApi3_1:()=>_ve,getReferenceKey:()=>Z2,rewriteRefs:()=>Y2,sanitizeOpenApiComponentsSchemasKey:()=>MQ,toDocumentDraft04:()=>Pve,toDocumentDraft07:()=>V2,toMultiDocumentOpenApi3_1:()=>Fve});var W2={};H(W2,{decodeUriFragment:()=>kC,escapeToken:()=>TC,formatUriFragment:()=>pI,formatUriFragmentToken:()=>vC,parseUriFragment:()=>Nx,unescapeToken:()=>_x});function TC(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function _x(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function vC(e){return encodeURI(TC(e)).replace(/#/g,"%23")}function kC(e){if(e.length===0||e==="#")return"";if(!e.startsWith("#"))return;let t=e.slice(1);try{if(encodeURI(t).replace(/%25/g,"%").replace(/#/g,"%23")!==t)return;let n=decodeURIComponent(t);return n.startsWith("/")&&!/~(?:[^01]|$)/.test(n)?n:void 0}catch{return}}function Nx(e){let t=kC(e);return t===void 0?void 0:t.length===0?[]:t.slice(1).split("/").map(_x)}function pI(e){return e.reduce((t,n)=>`${t}/${vC(n)}`,"#")}var CQ="http://json-schema.org/draft-04/schema#",K2="http://json-schema.org/draft-07/schema#",mI="https://json-schema.org/draft/2020-12/schema",Mve="https://spec.openapis.org/oas/3.1/dialect/base";function AC(e,t){return e===t||e===(t.endsWith("#")?t.slice(0,-1):`${t}#`)}function AQ(e){let t=e.startsWith("#")?Nx(e):void 0;return t!==void 0&&t[0]==="components"&&t[1]==="schemas"?pI(["$defs",...t.slice(2)]):e}var Ove=["example","discriminator","xml","externalDocs"];function Rve(e){return MC(Wve(e))}function MC(e){let{$defs:t,...n}=e;return{dialect:"draft-2020-12",schema:n,definitions:qn(t)?t:{}}}function _ve(e){let t=OC(e.$id),n=Q2(e,(r,o)=>{if(!t&&!o&&X2(r,AQ),AC(r.$schema,Mve)&&U(r,"$schema",mI),Object.hasOwn(r,"example")){let s=r.examples;(s===void 0||Array.isArray(s))&&(U(r,"examples",[r.example,...s??[]]),delete r.example)}});return MC(n)}function Nve(e){return MC(Vve(e))}function V2(e){return{dialect:"draft-07",...NQ(e,Kve)}}function Pve(e){return{dialect:"draft-04",...NQ(e,Qve,{booleanAdapter:t=>t?{}:{not:{}}})}}function Fve(e){let t=Object.keys(e.definitions),n=new Map,r=new Set(t.filter(c=>J2.test(c))),o=t.filter(c=>!J2.test(c)).sort().map(c=>[c,MQ(c)]);for(let[c,f]of o)r.has(f)||(r.add(f),n.set(c,f));for(let[c,f]of o){if(n.has(c))continue;let l,d=0;do l=`${f}_${++d}`;while(r.has(l));r.add(l),n.set(c,l)}function s(c,f=!1){let l=OC(c.$id),d=qn(c.$defs)?c.$defs:void 0;return Q2(c,(p,m)=>{hI(p,Ove,"OpenAPI 3.1","Draft 2020-12"),X2(p,(g,b)=>{let x=g.startsWith("#")?Nx(g):void 0;if(x===void 0||x[0]!=="$defs"||x.length<2)return g;let w=x[1];return l?(f&&!m&&Object.hasOwn(e.definitions,w)&&(d===void 0||!Object.hasOwn(d,w))&&ja(b,"OpenAPI 3.1","a schema resource cannot reference the shared definitions pool"),g):m?g:pI(["components","schemas",n.get(w)??w,...x.slice(2)])})})}let i=e.schemas.map(c=>s(c,!0)),a={};for(let c of t)U(a,n.get(c)??c,s(e.definitions[c]));return{dialect:"openapi-3.1",schemas:i,definitions:a}}var J2=/^[a-zA-Z0-9.\-_]+$/;function MQ(e){return e.length===0?"_":e.replace(/[^a-zA-Z0-9._-]/gu,"_")}function Z2(e){let t=e.startsWith("#")?Nx(e):void 0;return t!==void 0&&t.length===2&&t[0]==="$defs"?t[1]:void 0}function Q2(e,t){return n(e,!1,!0);function n(r,o,s=!1){if(!qn(r))return r;let i=o||!s&&OC(r.$id),a={};for(let c of Object.keys(r)){let f=r[c],l=f;switch(c){case"$defs":case"properties":case"patternProperties":case"dependentSchemas":l=eL(f,d=>n(d,i))??f;break;case"allOf":case"anyOf":case"oneOf":case"prefixItems":l=Array.isArray(f)?f.map(d=>n(d,i)):f;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(f,i)}U(a,c,l)}return t(a,i),a}}function Y2(e,t){return Q2(e,n=>{X2(n,t)})}function X2(e,t){typeof e.$ref=="string"&&U(e,"$ref",t(e.$ref,"$ref")),typeof e.$dynamicRef=="string"&&U(e,"$dynamicRef",t(e.$dynamicRef,"$dynamicRef"))}function eL(e,t){if(!qn(e))return;let n={};for(let r of Object.keys(e))U(n,r,t(e[r],r));return n}function OQ(e,t,n){let r=new Map,o=[],s=G2;function i(p,m=[],g=[]){if(m.length===0&&t?.trackIds){let b=qn(p)?l(p):void 0;s=wQ(b,G2)??G2}return f(p,m,g,{sourceRoot:[],targetRoot:[],uri:s})}function a(){for(let[p,m,g]of o){let b=m,x=RQ(m,g);if(x!==void 0){let w=Nx(x.hash);if(x.hash="",w!==void 0){let E=r.get(TQ(x.href,w));E!==void 0&&(b=Uve(m,E))}}U(p,"$ref",b)}}let c=n(i);return a(),c;function f(p,m,g,b){if(typeof p=="boolean")return d(m,g,b),t?.booleanAdapter?.(p)??p;if(!qn(p))return p;let x=b,w=l(p);if(m.length>0&&t?.trackIds&&OC(w)){let y=wQ(w,b.uri);y!==void 0&&(x={parent:b,sourceRoot:m,targetRoot:g,uri:y})}d(m,g,x);let E=x.uri,S={isDocumentRoot:m.length===0,schema(y,h,I=h){return f(y,[...m,h],[...g,I],x)},schemaAt(y,h,I){return f(y,[...m,...h],[...g,...I],x)},schemaArray(y,h,I=h){return Array.isArray(y)?y.map((T,C)=>f(T,[...m,h,String(C)],[...g,I,String(C)],x)):y},schemaMap(y,h,I=h){return qn(y)?eL(y,(T,C)=>f(T,[...m,h,C],[...g,I,C],x)):y},reference(y,h){typeof h=="string"?o.push([y,h,E]):U(y,"$ref",h)}};return e(p,S)}function l(p){return t?.ignoreRefSiblings===!0&&typeof p.$ref=="string"?void 0:p.$id}function d(p,m,g){g.parent!==void 0&&d(p,m,g.parent),r.set(TQ(g.uri,p.slice(g.sourceRoot.length)),m.slice(g.targetRoot.length))}}var G2="https://effect.invalid/.json-schema/";function RQ(e,t){return URL.canParse(e,t)?new URL(e,t):void 0}function wQ(e,t){if(typeof e!="string")return;let n=RQ(e,t);if(n!==void 0)return n.hash="",n.href}function Uve(e,t){let n=e.indexOf("#");return n===-1&&t.length===0?e:`${n===-1?e:e.slice(0,n)}${pI(t)}`}function TQ(e,t){return`${e}\0${JSON.stringify(t)}`}function OC(e){return typeof e=="string"&&e.length>0&&e[0]!=="#"}function _Q(e,t,n){return OQ(t,n,r=>r(e))}function NQ(e,t,n){return OQ(t,{...n,trackIds:!0},r=>({schema:r(e.schema),definitions:eL(e.definitions,(o,s)=>r(o,["$defs",s],["definitions",s]))}))}var Dve=new Set(["properties","patternProperties"]),Lve=new Set(["allOf","anyOf","oneOf"]),PQ=new Set(["not","additionalProperties","propertyNames","contains","if","then","else","contentSchema"]),$ve=new Set(["properties"]),Bve=new Set(["not","items","additionalProperties"]),Hve=new Set(["not","additionalProperties","contentSchema"]);function RC(e,t,n,r,o,s=Dve){let i;if(s.has(t))i=r.schemaMap(n,t);else if(Lve.has(t))i=r.schemaArray(n,t);else if(o.has(t))i=r.schema(n,t);else return!1;return U(e,t,i),!0}var FQ=["$anchor","$defs","$dynamicAnchor","$dynamicRef","$vocabulary","contentSchema","dependentRequired","dependentSchemas","maxContains","minContains","prefixItems","unevaluatedItems","unevaluatedProperties"],zve=[...FQ,"deprecated"],jve=[...FQ,"$comment","$id","$schema","const","contains","contentEncoding","contentMediaType","else","examples","if","patternProperties","propertyNames","then"],UQ=/^[A-Za-z_][-A-Za-z0-9._]*$/,qve=/^[A-Za-z][-A-Za-z0-9._:]*$/;function Wve(e){return _Q(e,(t,n)=>{let r={};if(typeof t.$ref=="string")return n.reference(r,t.$ref),Object.hasOwn(t,"definitions")&&U(r,"$defs",n.schemaMap(t.definitions,"definitions","$defs")),r;hI(t,zve,"Draft 2020-12","Draft-07");let o,s;for(let i of Object.keys(t)){let a=t[i];if(!RC(r,i,a,n,PQ))switch(i){case"$schema":U(r,i,AC(a,K2)?mI:a);break;case"$id":Gve(r,a);break;case"definitions":U(r,"$defs",n.schemaMap(a,i,"$defs"));break;case"dependencies":{if(!qn(a)){U(r,i,a);break}let c={},f={};for(let l of Object.keys(a)){let d=a[l];U(Array.isArray(d)?c:f,l,Array.isArray(d)?d:n.schemaAt(d,["dependencies",l],["dependentSchemas",l]))}Object.keys(c).length>0&&U(r,"dependentRequired",c),Object.keys(f).length>0&&U(r,"dependentSchemas",f);break}case"items":o=a;break;case"additionalItems":s=a;break;default:U(r,i,a)}}return o!==void 0&&(Array.isArray(o)?(U(r,"prefixItems",n.schemaArray(o,"items","prefixItems")),s!==void 0&&U(r,"items",n.schema(s,"additionalItems","items"))):U(r,"items",n.schema(o,"items"))),r},{trackIds:!0,ignoreRefSiblings:!0})}function Gve(e,t){if(typeof t!="string"||!t.includes("#")){U(e,"$id",t);return}let n=t.indexOf("#"),r=t.slice(0,n),o=t.slice(n+1);if(o.length===0){r.length>0&&U(e,"$id",r);return}UQ.test(o)||ja("$id","Draft 2020-12",`fragment "#${o}" is not a valid $anchor`),r.length>0&&U(e,"$id",r),U(e,"$anchor",o)}function ja(e,t,n){throw new Error(`Cannot convert JSON Schema keyword "${e}" to ${t}: ${n}`)}function hI(e,t,n,r){for(let o of t)Object.hasOwn(e,o)&&ja(o,n,`it is not active in ${r} but would become active in the target`)}var Jve=["additionalItems","definitions","dependencies"];function DQ(e,t,n,r,o){n.isDocumentRoot?U(e,"$schema",AC(t,mI)?r:t):AC(t,mI)||ja("$schema",o,"an embedded resource cannot declare a different dialect")}function Kve(e,t){hI(e,Jve,"Draft-07","Draft 2020-12");let n={},r,o,s;for(let i of Object.keys(e)){let a=e[i];if(!RC(n,i,a,t,PQ))switch(i){case"$ref":r=a;break;case"$schema":DQ(n,a,t,K2,"Draft-07");break;case"$id":case"$anchor":break;case"$defs":U(n,"definitions",t.schemaMap(a,i,"definitions"));break;case"prefixItems":o=a;break;case"items":s=a;break;case"dependentRequired":case"dependentSchemas":case"minContains":case"maxContains":break;case"$dynamicRef":case"$dynamicAnchor":case"$vocabulary":case"unevaluatedProperties":case"unevaluatedItems":ja(i,"Draft-07","the target dialect has no equivalent");case"required":if(Array.isArray(a)&&a.length===0)break;U(n,i,a);break;default:U(n,i,a)}}if(LQ(n,o,s,t),Object.hasOwn(e,"contains")){let i=e.minContains,a=e.maxContains;(i!==void 0&&i!==1||a!==void 0)&&ja("minContains/maxContains","Draft-07","contains cardinality cannot be represented"),Object.hasOwn(e,"minContains")&&U(n,"minContains",i)}else Object.hasOwn(e,"minContains")&&U(n,"minContains",e.minContains),Object.hasOwn(e,"maxContains")&&U(n,"maxContains",e.maxContains);return BQ(e,n,t,"draft-07"),HQ(e,n,"$id","Draft-07"),$Q(n,r,t),n}function LQ(e,t,n,r){if(t===void 0){n!==void 0&&U(e,"items",r.schema(n,"items"));return}U(e,"items",r.schemaArray(t,"prefixItems","items")),n!==void 0&&U(e,"additionalItems",r.schema(n,"items","additionalItems"))}function $Q(e,t,n){if(t!==void 0)if(typeof t=="string"&&Object.keys(e).length>0){let r={};n.reference(r,t),_C(e,r)}else n.reference(e,t)}function BQ(e,t,n,r){let o=qn(e.dependentRequired)?e.dependentRequired:void 0,s=qn(e.dependentSchemas)?e.dependentSchemas:void 0;if(o===void 0&&s===void 0)return;let i={},a=new Set([...Object.keys(o??{}),...Object.keys(s??{})]);for(let c of a){let f=o?.[c],l=s?.[c],d=r==="draft-04"&&Array.isArray(f)&&f.length===0;l===void 0?d||U(i,c,f):f===void 0||d?U(i,c,n.schemaAt(l,["dependentSchemas",c],["dependencies",c])):U(i,c,{allOf:[n.schemaAt(l,["dependentSchemas",c],["dependencies",c,"allOf","0"]),{required:f}]})}Object.keys(i).length>0&&U(t,"dependencies",i)}function Vve(e){return _Q(e,(t,n)=>{let r={};if(typeof t.$ref=="string")return n.reference(r,AQ(t.$ref)),r;hI(t,jve,"Draft 2020-12","OpenAPI 3.0");for(let o of Object.keys(t)){let s=t[o];if(!RC(r,o,s,n,Bve,$ve))switch(o){case"example":U(r,"examples",[s]);break;case"nullable":case"exclusiveMinimum":case"exclusiveMaximum":break;default:U(r,o,s)}}return vQ(t,r,"minimum"),vQ(t,r,"maximum"),t.nullable===!0&&typeof t.type=="string"&&U(r,"type",[t.type,"null"]),r})}function vQ(e,t,n){let r=n==="minimum"?"exclusiveMinimum":"exclusiveMaximum",o=e[r];if(typeof o!="boolean"){o!==void 0&&U(t,r,o);return}o&&typeof e[n]=="number"&&(U(t,r,e[n]),delete t[n])}var Zve=["additionalItems","definitions","dependencies","id"];function Qve(e,t){hI(e,Zve,"Draft-04","Draft 2020-12");let n={},r,o,s,i;for(let a of Object.keys(e)){let c=e[a];if(!RC(n,a,c,t,Hve))switch(a){case"$ref":r=c;break;case"$schema":DQ(n,c,t,CQ,"Draft-04");break;case"$id":case"$anchor":break;case"$defs":U(n,"definitions",t.schemaMap(c,a,"definitions"));break;case"prefixItems":o=c;break;case"items":s=c;break;case"$dynamicRef":case"$dynamicAnchor":case"$vocabulary":case"unevaluatedProperties":case"unevaluatedItems":case"propertyNames":ja(a,"Draft-04","the target dialect has no equivalent");case"dependentRequired":case"dependentSchemas":case"contains":case"minContains":case"maxContains":case"if":case"then":case"else":case"minimum":case"maximum":case"exclusiveMinimum":case"exclusiveMaximum":break;case"const":i={enum:[c]};break;case"required":if(Array.isArray(c)&&c.length===0)break;U(n,a,c);break;default:U(n,a,c)}}return LQ(n,o,s,t),kQ(e,n,"minimum"),kQ(e,n,"maximum"),BQ(e,n,t,"draft-04"),HQ(e,n,"id","Draft-04"),Yve(e,n,t),Xve(e,n,t),i!==void 0&&(Object.hasOwn(e,"enum")?_C(n,i):U(n,"enum",i.enum)),$Q(n,r,t),n}function Yve(e,t,n){let r=Object.hasOwn(e,"if"),o=Object.hasOwn(e,"then"),s=Object.hasOwn(e,"else");if(!r||!o&&!s){r&&U(t,"if",n.schema(e.if,"if")),o&&U(t,"then",n.schema(e.then,"then")),s&&U(t,"else",n.schema(e.else,"else"));return}let i=Array.isArray(t.allOf)?t.allOf.length:0,a=["allOf",String(i),"anyOf"],c=(l,d)=>n.schemaAt(e[l],[l],[...a,...d]),f;o&&s?(CC(e.if)&&ja("if","Draft-04","lowering both branches would duplicate a schema identifier"),f={anyOf:[{allOf:[c("if",["0","allOf","0"]),c("then",["0","allOf","1"])]},{allOf:[{not:c("if",["1","allOf","0","not"])},c("else",["1","allOf","1"])]}]}):o?f={anyOf:[{not:c("if",["0","not"])},c("then",["1"])]}:f={anyOf:[c("if",["0"]),c("else",["1"])]},_C(t,f)}function CC(e){if(!qn(e))return!1;if(Object.hasOwn(e,"$id")||Object.hasOwn(e,"$anchor"))return!0;for(let t of Object.keys(e)){let n=e[t];switch(t){case"$defs":case"properties":case"patternProperties":case"dependentSchemas":if(qn(n)&&Object.values(n).some(CC))return!0;break;case"allOf":case"anyOf":case"oneOf":case"prefixItems":if(Array.isArray(n)&&n.some(CC))return!0;break;case"not":case"additionalProperties":case"propertyNames":case"unevaluatedProperties":case"items":case"contains":case"unevaluatedItems":case"if":case"then":case"else":case"contentSchema":if(CC(n))return!0}}return!1}function Xve(e,t,n){if(!Object.hasOwn(e,"contains")){Object.hasOwn(e,"minContains")&&U(t,"minContains",e.minContains),Object.hasOwn(e,"maxContains")&&U(t,"maxContains",e.maxContains);return}let r=e.minContains,o=e.maxContains;(r!==void 0&&r!==1||o!==void 0)&&ja("minContains/maxContains","Draft-04","contains cardinality cannot be represented");let s=Array.isArray(t.allOf)?t.allOf.length:0,i=n.schemaAt(e.contains,["contains"],["allOf",String(s),"anyOf","1","not","items","not"]);_C(t,{anyOf:[{not:{type:"array"}},{not:{items:{not:i}}}]})}function _C(e,t){Array.isArray(e.allOf)?e.allOf.push(t):U(e,"allOf",[t])}function HQ(e,t,n,r){let o=e.$id,s=e.$anchor;if(s===void 0){o!==void 0&&U(t,n,o);return}(typeof s!="string"||!UQ.test(s))&&ja("$anchor",r,"the anchor is not valid"),qve.test(s)||ja("$anchor",r,"the anchor cannot be represented as a plain-name fragment identifier"),o===void 0?U(t,n,`#${s}`):ja("$anchor",r,"it cannot be combined with the schema $id")}function kQ(e,t,n){let r=n==="minimum"?"exclusiveMinimum":"exclusiveMaximum",o=e[n],s=e[r];typeof s=="number"?typeof o=="number"&&(n==="minimum"?o>s:o{let t=tke(e,Fx),n=e.context;return t===e||n===void 0?t:sI(t,tL(n))});function tL(e){return e.constructorDefault===void 0?e:new jc(e.isOptional,e.isMutable,void 0,e.annotations)}function jQ(e){if(e.propertySignatures.some(t=>typeof t.name!="string"))throw new globalThis.Error("Objects property names must be strings",{cause:e})}function qQ(e){return t=>{let n=[...t].sort((o,s)=>e(yi(o))-e(yi(s)));return n.some((o,s)=>o!==t[s])?n:t}}var eke=qQ(e=>{switch(e._tag){case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function tke(e,t){switch(e._tag){case"Declaration":{let n=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!jr(n))return ln(e,[uC]);let r=e.typeParameters.map(s=>Jc(yi(s))),o=n(r);return o===void 0?e:ln(e,[Vm(o,t)])}case"Unknown":return ln(e,[uC]);case"ObjectKeyword":return ln(e,[O2]);case"Undefined":case"Void":case"Literal":case"Number":return e.toCodecJson();case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return jQ(e),e.recur(t,iI);case"Union":{let n=eke(e.types);return n!==e.types?new js(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 NC(e){return Jc(WQ(Sn(e.ast)))}var WQ=Zs(e=>{let t=nke(e,WQ);return t!==e&&e.context!==void 0?sI(t,tL(e.context)):t});function nke(e,t){switch(e._tag){case"Declaration":{let n=e.annotations?.toCodecIso??e.annotations?.toCodec;if(jr(n)){let r=n(e.typeParameters.map(o=>Jc(o)));return ln(e,[Vm(r,t)])}return e}case"Arrays":case"Objects":case"Union":case"Suspend":return e.recur(t)}return e}function PC(e){return Jc(VQ(e.ast),{schema:e})}function GQ(e){return Jc(ZQ(e.ast))}var rke=qQ(e=>{switch(e._tag){case"Null":case"Boolean":case"Number":case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}});function oke(e,t,n){switch(e._tag){case"Declaration":{let r=e.typeParameters.map(f=>Jc(t(yi(f)))),o=e.annotations?.toCodecStringTree;if(jr(o)){let f=o(r);return f===void 0?e:ln(e,[Vm(f,t)])}let s=e.annotations?.toCodecJson,i=jr(s)?s(r):void 0,a=i===void 0?e.annotations?.toCodec:void 0,c=i??(jr(a)?a(r):void 0);return c===void 0?n(e):ln(e,[Vm(c,t)])}case"Null":return ln(e,[ske]);case"Boolean":return ln(e,[ike]);case"Unknown":case"ObjectKeyword":return ln(e,[fC]);case"Enum":case"Number":case"Literal":case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":return jQ(e),e.recur(t,iI);case"Union":{let r=rke(e.types);return r!==e.types?new js(r,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}var ske=new Kn(new gi("null"),new pt(Se(()=>null),Se(()=>"null"))),ike=new Kn(new js([new gi("true"),new gi("false")]),new pt(Se(e=>e==="true"),kd())),JQ=new pt(Se(e=>typeof e=="string"?[e]:e),Cr()),KQ=e=>e.transformation===JQ,VQ=Rd(e=>{let t=oke(e,VQ,n=>{throw new globalThis.Error("Missing structural codec for StringTree",{cause:n})});return t!==e&&e.context!==void 0?sI(t,tL(e.context)):t},{stopAt:KQ}),zQ=e=>Ar(e)?_d(Ba):Ba,ZQ=Rd(e=>{let t=ake(e);if(jk(t)){let n=Xf(new js([new Yi(t.isMutable,t.elements.map(zQ),t.rest.map(zQ)),Is],{mode:"anyOf"}),t,JQ);return Ar(e)?_d(n):n}return t},{stopAt:KQ});function ake(e){return e._tag==="Declaration"||e._tag==="Arrays"||e._tag==="Objects"||e._tag==="Union"||e._tag==="Suspend"?e.recur(ZQ):e}var xI={};H(xI,{RegExp:()=>cke,escape:()=>qu,isRegExp:()=>uke});var cke=globalThis.RegExp,uke=eS,qu=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&");function Gt(e,t){return t.length>0&&(e+=`
+ at ${rS(t)}`),new Error(e)}function QQ(e){return`#/$defs/${vC(e)}`}var fke=new Set([...kk,Um,...p8]);function yI(e,t){if(e===void 0)return;let n={},r=e.title;typeof r=="string"&&(n.title=r);let o=e.description,s=e.expected;typeof o=="string"?n.description=o:t?.generateDescriptions===!0&&typeof s=="string"&&(n.description=s);let i=e.default;Gc(i)&&(n.default=i);let a=e.examples;Array.isArray(a)&&Gc(a)&&(n.examples=a);let c=e.readOnly;typeof c=="boolean"&&(n.readOnly=c);let f=e.writeOnly;typeof f=="boolean"&&(n.writeOnly=f);let l=e.format;typeof l=="string"&&(n.format=l);let d=e.contentEncoding;typeof d=="string"&&(n.contentEncoding=d);let p=e.contentMediaType;typeof p=="string"&&(n.contentMediaType=p);let m=e.contentSchema;if(Gc(m)&&(n.contentSchema=m),t?.includeAnnotationKey!==void 0)for(let[g,b]of Object.entries(e))fke.has(g)||!t.includeAnnotationKey(g)||Gc(b)&&U(n,g,b);return Object.keys(n).length===0?void 0:n}function YQ(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)){let r=[],o=!1;for(let s of n.allOf){let i=YQ(s);i.type!==void 0&&(o=!0,(t===void 0||i.type==="integer")&&(t=i.type)),Object.keys(i.schema).length>0&&r.push(i.schema)}if(o){let{allOf:s,...i}=n;n=r.length===0?i:{...i,allOf:r}}}return{type:t,schema:n}}function lke(e){if(!Array.isArray(e.anyOf)||e.anyOf.length!==2||e.anyOf[0]?.type!=="number")return!1;let 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")}var XQ="|type|format|pattern|multipleOf|minimum|maximum|exclusiveMinimum|exclusiveMaximum|minLength|maxLength|minItems|maxItems|uniqueItems|minProperties|maxProperties|propertyNames|";function FC(e,t){return Object.keys(e).every(n=>t.includes(`|${n}|`))}function dke(e,t){return typeof e.$ref!="string"&&t.every(n=>!Object.hasOwn(e,n))}var pke="|minimum|exclusiveMinimum|minLength|minItems|minProperties|",mke="|maximum|exclusiveMaximum|maxLength|maxItems|maxProperties|";function hke(e,t,n){if(typeof e.$ref=="string")return;let r={...e,...t};for(let o of n){if(!Object.hasOwn(e,o))continue;let s=e[o],i=t[o];if(typeof s!="number"||typeof i!="number")return;if(pke.includes(`|${o}|`))r[o]=Math.max(s,i);else if(mke.includes(`|${o}|`))r[o]=Math.min(s,i);else return}return typeof r.minimum=="number"&&typeof r.exclusiveMinimum=="number"&&delete r[r.exclusiveMinimum>=r.minimum?"minimum":"exclusiveMinimum"],typeof r.maximum=="number"&&typeof r.exclusiveMaximum=="number"&&delete r[r.exclusiveMaximum<=r.maximum?"maximum":"exclusiveMaximum"],r}var rL="|title|description|default|examples|readOnly|writeOnly|",gke=XQ+rL;function SI(e,t,n){if(Object.keys(e).length===0)return t;let r=Object.keys(t);if(r.length===0)return e;let o=e.type==="number"||e.type==="integer"?e.type:void 0,s=lke(e);if(o!==void 0||s){let a=YQ(t);if(a.type!==void 0){let c=o==="integer"||a.type==="integer"?"integer":"number",f={...e,type:c};s&&delete f.anyOf;let l=Object.keys(a.schema);return l.length===0?f:FC(a.schema,rL)&&dke(f,l)?{...f,...a.schema}:SI(f,a.schema,n)}}if(n){let a=hke(e,t,r);if(a!==void 0)return a}let i=Array.isArray(t.allOf)&&r.length===1?t.allOf:[t];return Array.isArray(e.allOf)?{...e,allOf:[...e.allOf,...i]}:typeof e.$ref=="string"?{allOf:[e,...i]}:{...e,allOf:i}}function nL(e,t=new Set){return typeof e=="boolean"?e:t.has(e)?!0:(t.add(e),e.every(n=>nL(n,t)))}function xke(e){return Array.isArray(e)}function e9(e,t,n,r){let o=new Map,s=new Map,i=new WeakMap,a=new Map,c=new Map,f=Object.keys(n);for(let h of f)g(h,["references",h]);let l=vn(e,(h,I)=>E(h,t[I],[]));for(let[h,I]of a.values())if(!nL(h))for(let T of I)Array.isArray(T.oneOf)&&(T.anyOf=T.oneOf,delete T.oneOf);for(let h of f){let I=n[h],T=x(I);if(T===void 0)continue;let C=o.get(h)[0],k=c.get(T),_=k?.find(D=>ce(o.get(D)[0],C));_===void 0?k===void 0?c.set(T,[h]):k.push(h):s.set(h,_)}let d=vn(l,b),p={};for(let h of f)s.has(h)||U(p,h,b(o.get(h)[0]));return{dialect:"draft-2020-12",schemas:d,definitions:p};function m(h){return Array.isArray(h.oneOf)&&a.get(h.oneOf)?.[1].push(h),h}function g(h,I){if(!Object.hasOwn(n,h))throw Gt(`Invalid reference ${h}`,[...I,"$ref"]);let T=o.get(h);if(T!==void 0)return T;let C=[{},[]];return o.set(h,C),C[0]=E(n[h],["references",h],C[1]),C}function b(h){return Y2(h,I=>{let T=kC(I);if(T===void 0){if(/^#(?:\/|%2f)/i.test(I))throw new Error(`Invalid JSON Pointer URI fragment ${JSON.stringify(I)}`);return I}if(!T.startsWith("/$defs/"))return I;let C=T.indexOf("/",7),k=s.get(_x(T.slice(7,C<0?void 0:C)));return k===void 0?I:I.replace(/^#(?:\/|%2f).*?(?:\/|%2f).*?(?=\/|%2f|$)/i,QQ(k))})}function x(h){if(h._tag==="Reference")return;let I=h.checks.length===0?h.annotations:h.checks[h.checks.length-1].annotations;return typeof I?.identifier!="string"&&typeof I?.[Um]=="string"?I[Um]:void 0}function w(h,I,T,C){let k=h.annotations,_=k?.toJsonSchema;if(_!==void 0){let Re=h.representation?.schemas?.map((Ve,dn)=>E(Ve,[...T,"representation","schemas",dn],C))??[],Zn=_({type:I,schemas:Re}),Q=xke(Zn);Q&&C.push(!1);let Qe=Q?Zn[0]:Zn,et=yI(k,r),en=et===void 0?Qe:{...Qe,...et},Ke=et===void 0?XQ:gke;return[en,h._tag==="Filter"&&FC(en,Ke)&&(et===void 0||FC(et,rL))?!0:void 0]}if(h._tag==="Filter"){C.push(!1);return}let D=h.checks.flatMap((Re,Zn)=>{let Q=w(Re,I,[...T,"checks",Zn],C);return Q===void 0?[]:[Q[0]]});if(D.length===0)return;let z=yI(k,r),he={allOf:D};return[z===void 0?he:{...he,...z}]}function E(h,I,T){if(h._tag==="Reference")return T.push(g(h.$ref,I)[1]),{$ref:QQ(h.$ref)};let C=i.get(h);if(C!==void 0)return T.push(C[1]),C[0];let k=[];T.push(k);let _=S(h,I,k),D=yI(h.annotations,r);D!==void 0&&(_={..._,...D});for(let z=0;z{if(typeof _=="number"&&!globalThis.Number.isFinite(_))throw Gt(`Invalid numeric enum value ${globalThis.String(_)}`,[...I,"enums",D,1]);return{type:typeof _,enum:[_],title:k}});return C.length===0?{not:{}}:{anyOf:C}}case"TemplateLiteral":return{type:"string",pattern:`^${h.parts.map(UC).join("")}$`};case"Arrays":{if(h.rest.length>1)throw Gt("Invalid schema representation document",[...I,"rest"]);let C={type:"array"},k=h.elements.length,_=h.elements.map((D,z)=>{D.isOptional&&k--;let he=E(D.type,[...I,"elements",z,"type"],T),Re=yI(D.annotations,r);return Re===void 0?he:m(SI(he,Re))});if(_.length>0?(C.prefixItems=_,C.maxItems=h.elements.length,k>0&&(C.minItems=k)):C.items=!1,h.rest.length===1){delete C.maxItems;let D=E(h.rest[0],[...I,"rest",0],T);Object.keys(D).length>0?C.items=D:delete C.items}return C}case"Objects":{if(h.propertySignatures.length===0&&h.indexSignatures.length===0)return{not:{type:"null"}};let C={type:"object"},k={},_=[];for(let Q=0;Q0&&(C.properties=k),_.length>0&&(C.required=_);let D={},z=[],he=[],Re=!1;for(let Q=0;Q0;if(Zn&&(C.patternProperties=D),Re&&r?.onExcessProperty==="error"){let Q=[];h.propertySignatures.length>0&&Q.push({enum:Object.keys(k)});for(let Qe=0;Qe0&&(C.allOf=z.map(Qe=>({type:"object",additionalProperties:Qe})))}else z.length===0?C.additionalProperties=Re||r?.onExcessProperty!=="error":z.length===1&&h.propertySignatures.length===0&&!Zn?C.additionalProperties=z[0]:z.length>0&&(C.allOf=z.map(Q=>({type:"object",additionalProperties:Q})));return typeof C.additionalProperties=="object"&&C.additionalProperties!==null&&Object.keys(C.additionalProperties).length===0&&delete C.additionalProperties,C}case"Union":{let C=[],k=h.types.map((D,z)=>E(D,[...I,"types",z],C));if(T.push(C),k.length===0)return{not:{}};let _=h.options?.mode??"anyOf";if(_==="anyOf"&&k.length>1){let D=Ske(k);if(D!==void 0)return D}return _==="oneOf"&&a.set(k,[C,[]]),{[_]:k}}}}function y(h,I,T){switch(h._tag){case"Reference":{if(!Object.hasOwn(n,h.$ref))throw Gt(`Invalid reference ${h.$ref}`,[...I,"$ref"]);if(g(h.$ref,I),T.has(h.$ref))return;let C=new Set(T).add(h.$ref);return y(n[h.$ref],["references",h.$ref],C)}case"String":{if(h.checks.length===0)return[];if(h.checks.length!==1||h.checks[0]._tag!=="Filter"||h.checks[0].annotations?.toJsonSchema===void 0)return;let C=[],k=E(h,I,C);return nL(C)&&k.type==="string"&&typeof k.pattern=="string"&&FC(k,"|type|pattern|title|description|default|examples|readOnly|writeOnly|")?[k.pattern]:void 0}case"TemplateLiteral":return h.checks.length===0?[`^${h.parts.map(UC).join("")}$`]:void 0;case"Union":{if(h.types.length===0||h.checks.length>0||h.options?.mode==="oneOf")return;let C=[];for(let k=0;k["representations",r]),e.references,t)}var Eke=({identifier:e})=>e;function Kc(e){return e===void 0?void 0:{annotations:e}}function Zm(e,t){let{references:n,representations:r}=sL([e],t);return{representation:r[0],references:n}}function sL(e,t){let n={},r=new Map,o=new Set,s=new Map,i=new Set;for(let h of e)m(h);let a=t?.referencePolicy??Eke;for(let h of s.values())for(let I of h.values()){let T=a({ast:I.ast,occurrences:I.occurrences,identifier:I.identifier});if(T!==void 0){let C=T===I.identifier||!T.endsWith("_")?"_":"";I.reference=f(T,I,C)}else I.isRecursive&&(I.reference=f(`${I.ast._tag}_`,I,""))}return{representations:vn(e,h=>b(h)),references:n};function f(h,I,T="_"){let C=h,k=0;for(;r.has(C);){if(r.get(C)===I)return C;C=`${h}${T}${++k}`}return r.set(C,I),C}function l(h,I,T){let C=I.fallback;return C!==void 0?FU(h)===C?h:Ha(h,{[Um]:C}):T===I.identifier?h:Ha(h,{identifier:T})}function d(h,I){if(!Object.hasOwn(n,h)&&!o.has(h)){o.add(h);let T=x(I);o.delete(h),U(n,h,T)}return{_tag:"Reference",$ref:h}}function p(h){let I=Km(h),T=Jm(I),C=Dm(I),k=C===void 0?(I!==h?Dm(h):void 0)??FU(I):void 0;k!==void 0&&(C=`${k}Encoded`);let _=s.get(T);_===void 0&&(_=new Map,s.set(T,_));let D=_.get(C);return D===void 0&&(D={ast:T,identifier:C,fallback:k,occurrences:0,isRecursive:!1,reference:void 0},_.set(C,D)),D}function m(h){let I=p(h),T=I.ast;if(I.occurrences++,i.has(I)){I.isRecursive=!0;return}if(!(I.occurrences>1)){switch(i.add(I),g(T.checks),T._tag){case"Declaration":case"Arrays":case"Objects":case"Union":T.recur(C=>(m(C),C));break;case"TemplateLiteral":T.parts.forEach(m);break;case"Suspend":m(T.thunk());break}i.delete(I)}}function g(h){h?.forEach(I=>{I.annotations?.representation?.schemas?.forEach(T=>m(Sn(T))),I._tag==="FilterGroup"&&g(I.checks)})}function b(h){let I=p(h),T=I.ast,C=I.reference;if(C!==void 0){let k=I.identifier===void 0?T:l(T,I,C);return d(C,k)}return x(T)}function x(h){let I=w(h.checks);switch(h._tag){case"Declaration":return{_tag:"Declaration",typeParameters:h.typeParameters.map(T=>b(T)),checks:I,...S(h.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:h._tag,checks:I,...Kc(h.annotations)};case"Literal":return{_tag:"Literal",literal:h.literal,checks:I,...Kc(h.annotations)};case"UniqueSymbol":return{_tag:"UniqueSymbol",symbol:h.symbol,checks:I,...Kc(h.annotations)};case"Enum":return{_tag:"Enum",enums:h.enums,checks:I,...Kc(h.annotations)};case"TemplateLiteral":return{_tag:"TemplateLiteral",parts:h.parts.map(T=>b(T)),checks:I,...Kc(h.annotations)};case"Arrays":return{_tag:"Arrays",elements:h.elements.map(T=>{let C=Km(T),k=C.context?.annotations;return{isOptional:Ar(C),type:b(T),...Kc(k)}}),rest:h.rest.map(T=>b(T)),checks:I,...Kc(h.annotations)};case"Objects":return{_tag:"Objects",propertySignatures:h.propertySignatures.map(T=>{let C=Km(T.type),k=C.context?.annotations;return{name:T.name,type:b(T.type),isOptional:Ar(C),isMutable:T2(C),...Kc(k)}}),indexSignatures:h.indexSignatures.map(T=>({parameter:b(T.parameter),type:b(T.type)})),checks:I,...Kc(h.annotations)};case"Union":return{_tag:"Union",types:h.types.map(T=>b(T)),...h.options===void 0?{}:{options:h.options},checks:I,...Kc(h.annotations)};case"Suspend":return{_tag:"Suspend",checks:[],thunk:b(h.thunk()),...Kc(h.annotations)}}}function w(h){return h?.map(E)??[]}function E(h){switch(h._tag){case"Filter":return{_tag:"Filter",aborted:h.aborted,...y(h.annotations)};case"FilterGroup":return{_tag:"FilterGroup",checks:vn(h.checks,E),...y(h.annotations)}}}function S(h){if(h===void 0)return;let{representation:I,...T}=h;return{...I===void 0?void 0:{representation:I},...Object.keys(T).length===0?void 0:{annotations:T}}}function y(h){if(h===void 0)return;let{representation:I,...T}=h,C=I===void 0?void 0:I.schemas===void 0?I:{...I,schemas:I.schemas.map(k=>b(Sn(k)))};return{...C===void 0?void 0:{representation:C},...Object.keys(T).length===0?void 0:{annotations:T}}}}function n9(e){return Dt(e)?e.value:{issues:[{message:hE(e.cause)}]}}function o9(e,t){let n=Pn(e),r={errors:"all",...t?.parseOptions},o=qU(t),s=i=>{let a=new Dl("sync"),c=Qo(a1(n(i,r),{onFailure:o,onSuccess:l=>({value:l})}),{scheduler:a});c.currentDispatcher?.flush();let f=c.pollUnsafe();return f?n9(f):new Promise(l=>{c.addObserver(d=>{l(n9(d))})})};if(Object.hasOwn(e,"~standard")){let i=e;return"validate"in i["~standard"]||Object.assign(i["~standard"],{validate:s}),i}return Object.assign(e,{"~standard":{version:1,vendor:"effect",validate:s}})}function bke(e){let t=Zm(Fx(e));return Dx(t)}function r9(e,t){let n=bke(e);if(t==="draft-2020-12"){let r=n.schema;return Object.keys(n.definitions).length>0&&(r.$defs=n.definitions),r}else if(t==="draft-07"){let r=V2(n),o=r.schema;return Object.keys(r.definitions).length>0&&(o.definitions=r.definitions),o}throw new globalThis.Error(`Unsupported target: ${t}`)}function s9(e){let t={input(n){return r9(e.ast,n.target)},output(n){return r9(Sn(e.ast),n.target)}};if(Object.hasOwn(e,"~standard")){let 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 LC={};H(LC,{apply:()=>uL,get:()=>cL});function cL(e,t){let n=[];return aL(e,t,"",n),n}function aL(e,t,n,r){if(!Object.is(e,t)){if(Array.isArray(e)&&Array.isArray(t)){let o=e.length,s=t.length,i=Math.min(o,s);for(let a=0;a=s;a--)r.push({op:"remove",path:`${n}/${a}`});for(let a=o;aa)throw new Error(`Array index out of bounds at "${t.path}".`);let c=o.slice();return t.op==="add"?c.splice(i,0,t.value):t.op==="remove"?c.splice(i,1):c[i]=t.value,i9(s,c)}if(DC(o)){if(t.op!=="add"&&!Object.hasOwn(o,r))throw new Error(`Property "${r}" does not exist at "${t.path}".`);let i={...o};return t.op==="remove"?delete i[r]:U(i,r,t.value),i9(s,i)}throw new Error(`Cannot ${t.op} at "${t.path}" (parent not found or not a container).`)}function vke(e,t){let n=wke(t);if(n.length===0)return null;let r=n[n.length-1],o=[],s=e;for(let i=0;i=s.length)return null;o.push({container:s,token:c}),s=s[c];continue}if(DC(s)){if(!Object.hasOwn(s,a))return null;o.push({container:s,token:a}),s=s[a];continue}return null}return{stack:o,parent:s,lastToken:r}}function i9(e,t){let n=t;for(let r=e.length-1;r>=0;r--){let{container:o,token:s}=e[r];if(Array.isArray(o)){let i=o.slice();i[s]=n,n=i}else{let i={...o};U(i,s,n),n=i}}return n}function c9(e){let t=Px(e),n=dI(t),r=lI(t);return{empty:[],diff:(o,s)=>cL(n(o),n(s)),combine:(o,s)=>[...o,...s],patch:(o,s)=>{let i=n(o),a=uL(s,i);return Object.is(a,i)?o:r(a)}}}function u9(e,t){let n=Dm(e.ast)??vk(e.ast),r=D2(PC(e));return o=>r(o).pipe(F(s=>Cke(s,{rootName:n,...t})))}function Cke(e,t){let n=t.rootName??"root",r=t.arrayItemName??"item",o=t.pretty??!0,s=t.indent??" ",i=t.sortKeys??!0,a=new Set,c=[];return l(n,e,0),c.join(o?`
+`:"");function f(d,p){c.push(o?s.repeat(d)+p:p)}function l(d,p,m,g){let{attrs:b,safe:x}=Lx.tagInfo(d,g);if(p===void 0)f(m,`<${x}${b}/>`);else if(typeof p=="string")f(m,`<${x}${b}>${Lx.escapeText(p)}${x}>`);else if(typeof p!="object"||p===null)f(m,`<${x}${b}>${Lx.escapeText(V(p))}${x}>`);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){f(m,`<${x}${b}/>`);return}f(m,`<${x}${b}>`);for(let S of p)l(r,S,m+1);f(m,`${x}>`);return}let w=p,E=Object.keys(w);if(i&&E.sort(),E.length===0){f(m,`<${x}${b}/>`);return}f(m,`<${x}${b}>`);for(let S of E)l(Lx.parseTagName(S).safe,w[S],m+1,S);f(m,`${x}>`)}finally{a.delete(p)}}}}var Lx={escapeText(e){return e.replace(/&/g,"&").replace(//g,">")},escapeAttribute(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(//g,">")},parseTagName(e){let t=e,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){let{changed:n,safe:r}=Lx.parseTagName(e),s=n||t&&t!==e?` data-name="${Lx.escapeAttribute(t??e)}"`:"";return{safe:r,attrs:s}}};var fL=Zs(e=>Pd(e));function Pd(e){let t=Bu(e)?.toEquivalence;if(t)return t(qm(e)?e.typeParameters.map(Pd):[]);switch(e._tag){case"Never":return fc();case"Declaration":return Mke(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 ce;case"Arrays":{let n=e.elements.map(Pd),r=e.rest.map(Pd),[o,...s]=r,i=s.length;return rn((a,c)=>{if(!Array.isArray(a)||!Array.isArray(c))return!1;let f=a.length;if(f!==c.length)return!1;let l=0;for(;l0){for(;lPd(o.type)),r=e.indexSignatures.map(o=>Pd(o.type));return rn((o,s)=>{if(!qn(o)||!qn(s))return!1;for(let i=0;i[Nd(s),Pd(e.types[i])]);return rn((s,i)=>{let a=r(s,!1);for(let c=0;c(n??=fL(e.thunk()))(r,o))}}}function Mke(e){let t=e.annotations?.representation;if(t===void 0)return ce;switch(t.id){case"effect/schema/Option":{let[n]=Qm(e);return(r,o)=>r._tag===o._tag&&(r._tag==="None"||n(r.value,o.value))}case"effect/schema/Result":{let[n,r]=Qm(e);return(o,s)=>o._tag===s._tag&&(o._tag==="Success"?n(o.success,s.success):r(o.failure,s.failure))}case"effect/schema/CauseReason":{let[n,r]=Qm(e);return l9(n,r)}case"effect/schema/Cause":{let[n,r]=Qm(e);return f9(n,r)}case"effect/schema/Exit":{let[n,r,o]=Qm(e),s=f9(r,o);return(i,a)=>i._tag===a._tag&&(i._tag==="Success"?n(i.value,a.value):s(i.cause,a.cause))}case"effect/schema/ReadonlyMap":{let[n,r]=Qm(e);return tS(n,r)}case"effect/schema/ReadonlySet":return jh(Qm(e)[0]);case"effect/schema/RegExp":return(n,r)=>n.source===r.source&&n.flags===r.flags;case"effect/schema/URL":return(n,r)=>n.toString()===r.toString();default:return ce}}function Qm(e){return e.typeParameters.map(Pd)}function l9(e,t){return(n,r)=>{if(n._tag!==r._tag)return!1;switch(n._tag){case"Fail":return e(n.error,r.error);case"Die":return t(n.defect,r.defect);case"Interrupt":return n.fiberId===r.fiberId}}}function f9(e,t){let n=bp(l9(e,t));return(r,o)=>n(r.reasons,o.reasons)}function p9(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 d9(e,t){let n=p9(e,t);return r=>`Cause([${r.reasons.map(n).join(", ")}])`}function m9(e,t){let n=new Map;return r(e);function r(i){let a=n.get(i);return a===void 0&&(a=o(i),n.set(i,a)),a}function o(i){let a=Bu(i)?.toFormatter;if(typeof a=="function")return a(qm(i)?i.typeParameters.map(r):[]);if(t?.onBefore){let c=t.onBefore(i,r);if(c!==void 0)return c}return s(i)}function s(i){switch(i._tag){default:return V;case"Never":return()=>"never";case"Void":return()=>"void";case"Declaration":{let a=i.annotations?.representation;if(a===void 0)return V;let c=i.typeParameters.map(r);switch(a.id){case"effect/schema/Option":{let[f]=c;return Tn({onNone:()=>"none()",onSome:l=>`some(${f(l)})`})}case"effect/schema/Result":{let[f,l]=c;return Sr({onSuccess:d=>`success(${f(d)})`,onFailure:d=>`failure(${l(d)})`})}case"effect/schema/CauseReason":return p9(c[0],c[1]);case"effect/schema/Cause":return d9(c[0],c[1]);case"effect/schema/Exit":{let[f,l,d]=c,p=d9(l,d);return m=>{switch(m._tag){case"Success":return`Exit.Success(${f(m.value)})`;case"Failure":return`Exit.Failure(${p(m.cause)})`}}}case"effect/schema/ReadonlyMap":{let[f,l]=c;return d=>{let p=d.size;if(p===0)return"ReadonlyMap(0) {}";let m=globalThis.Array.from(d.entries()).sort().map(([g,b])=>`${f(g)} => ${l(b)}`);return`ReadonlyMap(${p}) { ${m.join(", ")} }`}}case"effect/schema/HashMap":{let[f,l]=c;return d=>{let p=Ed(d);if(p===0)return"HashMap(0) {}";let m=Lu(d).sort().map(([g,b])=>`${f(g)} => ${l(b)}`);return`HashMap(${p}) { ${m.join(", ")} }`}}case"effect/schema/ReadonlySet":{let[f]=c;return l=>{let d=l.size;if(d===0)return"ReadonlySet(0) {}";let p=globalThis.Array.from(l.values()).sort().map(m=>`${f(m)}`);return`ReadonlySet(${d}) { ${p.join(", ")} }`}}case"effect/schema/HashSet":{let[f]=c;return l=>{let d=Ab(l);if(d===0)return"HashSet(0) {}";let p=globalThis.Array.from(l).sort().map(m=>`${f(m)}`);return`HashSet(${d}) { ${p.join(", ")} }`}}case"effect/schema/Chunk":{let[f]=c;return l=>{let d=wm(l);if(d===0)return"Chunk(0) {}";let p=globalThis.Array.from(l).sort().map(m=>`${f(m)}`);return`Chunk(${d}) { ${p.join(", ")} }`}}default:return V}}case"Arrays":{let a=i.elements.map(p=>r(p)),c=i.rest.map(r),[f,...l]=c,d=l.length;return p=>{let m=[],g=0;for(;g0){for(;gr(f.type)),c=i.indexSignatures.map(f=>r(f.type));return i.propertySignatures.length===0&&i.indexSignatures.length===0?V:f=>{let l=[],d=new Set;for(let p=0;p0?"{ "+l.join(", ")+" }":"{}"}}case"Union":{let a=Sn(i).types,c=Tx(a),f=a.map((l,d)=>[Nd(l),r(i.types[d])]);return l=>{let d=c(l,!1);for(let p=0;p(a??=r(i.thunk()))(c)}}}}var TI={};H(TI,{entries:()=>oCe,failure:()=>cCe,fromChecks:()=>qke,get:()=>Vke,getAll:()=>tCe,getResult:()=>Zke,id:()=>wI,makeIso:()=>bI,makeLens:()=>dL,makeOptional:()=>x9,makePrism:()=>II,modify:()=>eCe,modifyAll:()=>nCe,none:()=>iCe,replace:()=>Yke,replaceResult:()=>Xke,set:()=>Qke,some:()=>sCe,success:()=>aCe});var EI={};H(EI,{Record:()=>jke,assign:()=>lL,evolve:()=>Pke,evolveEntries:()=>Uke,evolveKeys:()=>Fke,get:()=>_ke,keys:()=>Nke,lambda:()=>Yo,makeCombiner:()=>h9,makeEquivalence:()=>Dke,makeOrder:()=>Lke,makeReducer:()=>zke,map:()=>$ke,mapOmit:()=>Hke,mapPick:()=>Bke,omit:()=>BC,pick:()=>$C,renameKeys:()=>HC});var _ke=u(2,(e,t)=>e[t]),Nke=e=>Object.keys(e),$C=u(2,(e,t)=>tl(e,(n,r)=>zC(t,n)?[n,r]:void 0)),BC=u(2,(e,t)=>tl(e,(n,r)=>zC(t,n)?void 0:[n,r])),lL=u(2,(e,t)=>({...e,...t})),Pke=u(2,(e,t)=>tl(e,(n,r)=>[n,Object.hasOwn(t,n)?t[n](r):r])),Fke=u(2,(e,t)=>tl(e,(n,r)=>[Object.hasOwn(t,n)?t[n](n):n,r])),Uke=u(2,(e,t)=>tl(e,(n,r)=>Object.hasOwn(t,n)?t[n](n,r):[n,r])),HC=u(2,(e,t)=>tl(e,(n,r)=>[Object.hasOwn(t,n)?t[n]:n,r])),Dke=SR,Lke=vR,Yo=e=>e,$ke=u(2,(e,t)=>tl(e,(n,r)=>[n,t(r)])),Bke=u(3,(e,t,n)=>tl(e,(r,o)=>[r,zC(t,r)?n(o):o])),Hke=u(3,(e,t,n)=>tl(e,(r,o)=>[r,zC(t,r)?o:n(o)]));function zC(e,t){return e.some(n=>n===t||typeof n=="number"&&String(n)===t)}function tl(e,t){let n={};for(let r of Reflect.ownKeys(e)){if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;let o=t(r,e[r]);if(o){let[s,i]=o;U(n,s,i)}}return n}function h9(e,t){let n=t?.omitKeyWhen??(()=>!1);return us((r,o)=>{let s=Reflect.ownKeys(e),i={};for(let a of s){let c=e[a].combine(r[a],o[a]);n(c)||U(i,a,c)}return i})}function zke(e,t){let n=h9(e,t).combine,r={};for(let o of Reflect.ownKeys(e)){let s=e[o].initialValue;t?.omitKeyWhen?.(s)||U(r,o,s)}return kt(n,r)}function jke(e,t){let n={};for(let r of e)U(n,r,t);return n}function bI(e,t){return Ei(Fd("Iso",e,t))}function dL(e,t){return Ei(Fd("Lens",e,t))}function II(e,t){return Ei(Fd("Prism",e,t))}function qke(...e){return Ei([new $x(e)])}function Fd(e,t,n){return[{_tag:"PrimitiveNode",kind:e,get:t,set:n}]}var Wke={kind:"Iso",get:L,set:L},jC=class{_tag="PathNode";kind="Lens";path;get;set;constructor(t){this.path=t,this.get=n=>{let r=n;for(let o=0;o{let o=qC(r),s=o,i=0;for(;iAx(t,n)}};function Ym(e,t){if(e.length===0)return t;if(t.length===0)return e;let n=e.slice();for(let r=0;rn)}modify(t){return n=>Ol(er(this.getResult(n),r=>this.replaceResult(t(r),n)),()=>n)}compose(t){return Ei(Ym(this.node,t.node))}key(t){return Ei(Ym(this.node,[new jC([t])]))}optionalKey(t){return Ei(Ym(this.node,Fd("Lens",n=>n[t],(n,r)=>{let o=qC(r);return n===void 0?Array.isArray(o)&&(typeof t=="number"||typeof t=="string"&&Op(t))?o.splice(Number(t),1):delete o[t]:U(o,t,n),o})))}check(...t){return Ei(Ym(this.node,[new $x(t)]))}refine(t,n){return Ei(Ym(this.node,[new $x([vx(t,n)])]))}tag(t){let n=Z(new _e({expected:`${JSON.stringify(t)} tag`}));return Ei(Ym(this.node,Fd("Prism",r=>r._tag===t?G(r):n,L)))}at(t,...n){let r=Z(new rr([t],new Hu(void 0)));return Ei(Ym(this.node,Fd("Optional",o=>Object.hasOwn(o,t)?G(o[t]):r,(o,s)=>{if(Object.hasOwn(s,t)){let i=qC(s);return U(i,t,o),G(i)}else return r})))}pick(t){return this.compose(dL($C(t),(n,r)=>({...BC(r,t),...n})))}omit(t){return this.compose(dL(BC(t),(n,r)=>({...$C(r,t),...n})))}notUndefined(){return this.refine(Io,{expected:"a value other than `undefined`"})}forEach(t){let n=t(wI());return x9(r=>Xt(this.getResult(r),o=>{let s=[];for(let i=0;ier(this.getResult(o),s=>{let i=[];for(let c=0;cOl(er(this.getResult(n),r=>this.replaceResult(r.map(t),n)),()=>n)}},pL=class extends Bx{get;set;constructor(t,n,r){super(t,o=>G(n(o)),o=>G(r(o))),this.get=n,this.set=r}replace(t,n){return this.set(t)}modify(t){return n=>this.set(t(this.get(n)))}},mL=class extends Bx{get;constructor(t,n,r){super(t,o=>G(n(o)),(o,s)=>G(r(o,s))),this.get=n,this.replace=r}modify(t){return n=>this.replace(t(this.get(n)),n)}},hL=class extends Bx{set;constructor(t,n,r){super(t,n,(o,s)=>G(r(o))),this.set=r}replace(t,n){return this.set(t)}modify(t){return n=>Ol(Xt(this.getResult(n),r=>this.set(t(r))),()=>n)}};function Ei(e){let t=e[0]??Wke;if(e.length>1){let n=e.reduce((r,o)=>Kke(r,o.kind),"Iso");t={kind:n,get:Gke(e,n),set:Jke(e,n)}}switch(t.kind){case"Iso":return new pL(e,t.get,t.set);case"Lens":return new mL(e,t.get,t.set);case"Prism":return new hL(e,t.get,t.set);case"Optional":return new Bx(e,t.get,t.set)}}function qC(e){if(Array.isArray(e))return e.slice();if(typeof e=="object"&&e!==null){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)throw new Error("Cannot clone object with non-Object constructor or null prototype");return{...e}}return e}function Gke(e,t){return n=>{for(let r=0;r{for(let r=e.length-1;r>=0;r--)n=e[r].set(n);return n}:(n,r)=>{let o=e.length,s=new Array(o);for(let i=0;i=0;i--){let a=e[i];if(g9(a.kind))n=a.set(n);else if(a.kind==="Lens")n=a.set(n,s[i]);else{let c=a.set(n,s[i]);if(le(c))return c;n=c.success}}return t==="Optional"?G(n):n}}function gL(e){return e==="Prism"||e==="Optional"}function g9(e){return e==="Iso"||e==="Prism"}function Kke(e,t){return e==="Iso"?t:t==="Iso"||e===t?e:"Optional"}var Vke=u(2,(e,t)=>t.get(e)),Zke=u(2,(e,t)=>t.getResult(e)),Qke=u(2,(e,t)=>t.set(e)),Yke=u(3,(e,t,n)=>t.replace(n,e)),Xke=u(3,(e,t,n)=>t.replaceResult(n,e)),eCe=u(3,(e,t,n)=>t.modify(n)(e)),tCe=u(2,(e,t)=>Sr(t.getResult(e),{onFailure:()=>[],onSuccess:n=>[...n]})),nCe=u(3,(e,t,n)=>t.modifyAll(n)(e)),rCe=Ei([]);function wI(){return rCe}function oCe(){return Ei(Fd("Iso",Object.entries,Object.fromEntries))}function sCe(){let e=WC(ie,{expected:"a Some value"});return II(t=>Xt(e(t),n=>n.value),N)}function iCe(){let e=WC(Y,{expected:"a None value"});return II(t=>Xt(e(t),()=>{}),()=>R())}function aCe(){let e=WC(Ne,{expected:"a Result.Success value"});return II(t=>Xt(e(t),n=>n.success),G)}function cCe(){let e=WC(le,{expected:"a Result.Failure value"});return II(t=>Xt(e(t),n=>n.failure),Z)}function WC(e,t){return n=>Ax([vx(e,t)],n)}function y9(e){let t=NC(e);return bI(dI(t),lI(t))}function S9(e){return wI()}function E9(e){return wI()}var Hx="~effect/Schema/SchemaError";function b9(e){return P(e,Hx)&&e[Hx]===Hx}var ea="~effect/net/NetAddress";var Vc=e=>e.value,Zc=e=>e,nl=e=>e.bytes,qa=class extends vo("NetAddressError"){},zx=e=>P(e,ea),No=e=>zx(e)&&e._tag==="Ipv4Address",Wa=e=>zx(e)&&e._tag==="Ipv6Address",xL=e=>No(e)||Wa(e),jx=e=>No(e)?32:128;var qx=e=>zx(e)&&e._tag==="MacAddress",kI=e=>zx(e)&&e._tag==="InetAddressV4",CI=e=>zx(e)&&e._tag==="InetAddressV6",yL=e=>kI(e)||CI(e),GC=e=>zx(e)&&e._tag==="UnixPathAddress",I9=e=>yL(e)||GC(e),fCe={...yr,_tag:"Ipv4Address",[ea]:ea,[Te](e){return No(e)&&Vc(this)===Vc(e)},[we](){return Qn(ke(mCe,Vc(this)|0))},toString(){return Po(this)},toJSON(){return this.toString()}},lCe={...yr,_tag:"Ipv6Address",[ea]:ea,[Te](e){if(!Wa(e))return!1;let t=Zc(this),n=Zc(e);return t.w0===n.w0&&t.w1===n.w1&&t.w2===n.w2&&t.w3===n.w3},[we](){let e=Zc(this),t=ke(hCe,e.w0|0);return t=ke(t,e.w1|0),t=ke(t,e.w2|0),Qn(ke(t,e.w3|0))},toString(){return Po(this)},toJSON(){return this.toString()}},dCe={...yr,_tag:"MacAddress",[ea]:ea,[Te](e){return qx(e)&&pCe(nl(this),nl(e))},[we](){return ke(gCe,wo(nl(this)))},toString(){return bL(this)},toJSON(){return this.toString()}},pCe=(e,t)=>{if(e.length!==t.length)return!1;for(let n=0;n{let t=Object.create(fCe);return t.value=e>>>0,Object.freeze(t)},yCe=(e,t,n,r)=>{let o=Object.create(lCe);return o.w0=e>>>0,o.w1=t>>>0,o.w2=n>>>0,o.w3=r>>>0,Object.freeze(o)},SCe=(e,t,n,r)=>(e<<24|t<<16|n<<8|r)>>>0;var vI=e=>[e>>>24,e>>>16&255,e>>>8&255,e&255],ECe=e=>{let t=Object.assign(Object.create(dCe),{bytes:new Uint8Array(e)});return Object.freeze(t)};var Vn=(e,t)=>Z(new qa({input:e,message:t})),w9=(e,t)=>{for(let n=0;nt)return!1}return!0},bCe=e=>w9(e,255)?G(xCe(SCe(e[0],e[1],e[2],e[3]))):Vn(e,"octets must be integers from 0 through 255"),ICe=e=>w9(e,65535)?G(yCe(e[0]*65536+e[1],e[2]*65536+e[3],e[4]*65536+e[5],e[6]*65536+e[7])):Vn(e,"segments must be integers from 0 through 65535");var T9=e=>/^(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/.test(e)?G(ECe(new Uint8Array(e.split(":").map(t=>Number.parseInt(t,16))))):Vn(e,"expected six two-digit hexadecimal octets separated by colons");var Xm=e=>{let t=e.split(".");if(t.length!==4||t.some(r=>!/^\d{1,3}$/.test(r)))return Vn(e,"expected exactly four decimal octets");if(t.some(r=>r.length>1&&r[0]==="0"))return Vn(e,"leading zeroes are not allowed");let n=t.map(Number);return n.some(r=>r>255)?Vn(e,"octets must be at most 255"):bCe([n[0],n[1],n[2],n[3]])},wCe=e=>{if(e.includes("[")||e.includes("]")||e.includes("%"))return Vn(e,"brackets and zone identifiers are not valid in a bare IPv6 address");let t=e.split("::");if(t.length>2)return Vn(e,"only one compression marker is allowed");let n=t[0]===""?[]:t[0].split(":"),r=t.length===2&&t[1]!==""?t[1].split(":"):[];if(n.some(l=>l==="")||r.some(l=>l===""))return Vn(e,"empty segments are only valid in the compression marker");let o=r.length>0?r[r.length-1]:n.length>0?n[n.length-1]:"",s;if(o.includes(".")){if(t.length===2&&r.length===0)return Vn(e,"embedded IPv4 syntax must be trailing");let l=Xt(Xm(o),d=>{let p=Vc(d);return[p>>>16,p&65535]});if(le(l))return l;s=l.success,r.length>0?r.pop():n.pop()}let i=n.length+r.length+(s?2:0);if(t.length===1?i!==8:i>=8)return Vn(e,t.length===1?"expected eight segments":"compression must replace at least one segment");let a=l=>/^[0-9a-fA-F]{1,4}$/.test(l)?Number.parseInt(l,16):void 0,c=n.map(a),f=r.map(a);return c.some(l=>l===void 0)||f.some(l=>l===void 0)?Vn(e,"segments must contain one through four hexadecimal digits"):G([...c,...Array(8-i).fill(0),...f,...s??[]])},eh=e=>er(wCe(e),t=>ICe(t)),Ud=e=>e.includes(":")?eh(e):Xm(e);var SL=e=>{if(typeof e!="string"||!e.includes("%"))return!1;let t=AI(e);return Ne(t)&&t.success===e},AI=e=>{let t=e.indexOf("%");if(t===-1)return Vn(e,"expected an IPv6 zone");let n=e.slice(t+1);if(n.length===0||/[%[\]/\s\p{Cc}]/u.test(n))return Vn(e,"invalid IPv6 scope identifier");if(/^\d+$/.test(n)){let r=Number(n);if(r>4294967295)return Vn(e,"scope identifier must be an unsigned 32-bit integer");n=String(r)}return Xt(eh(e.slice(0,t)),r=>`${Po(r)}%${n}`)};var JC=e=>vI(Vc(e)),TCe=e=>{let{w0:t,w1:n,w2:r,w3:o}=Zc(e);return[t>>>16,t&65535,n>>>16,n&65535,r>>>16,r&65535,o>>>16,o&65535]},EL=e=>{let{w0:t,w1:n,w2:r,w3:o}=Zc(e);return[...vI(t),...vI(n),...vI(r),...vI(o)]};var bL=e=>Array.from(nl(e),t=>t.toString(16).padStart(2,"0")).join(":"),KC=e=>nl(e).every(t=>t===255),vCe=e=>(nl(e)[0]&1)!==0,VC=e=>(nl(e)[0]&1)===0,IL=e=>(nl(e)[0]&2)!==0,wL=e=>(nl(e)[0]&2)===0;var Po=e=>{if(No(e))return JC(e).join(".");let t=TCe(e);if(kCe(e))return`::ffff:${t[6]>>8}.${t[6]&255}.${t[7]>>8}.${t[7]&255}`;let n=-1,r=0,o=-1;for(let a=0;a<=8;a++)a<8&&t[a]===0?o===-1&&(o=a):o!==-1&&(a-o>r&&(n=o,r=a-o),o=-1);if(r<2)return t.map(a=>a.toString(16)).join(":");let s=t.slice(0,n).map(a=>a.toString(16)).join(":"),i=t.slice(n+r).map(a=>a.toString(16)).join(":");return`${s}::${i}`},ZC=e=>{if(No(e))return Vc(e)===0;let{w0:t,w1:n,w2:r,w3:o}=Zc(e);return t===0&&n===0&&r===0&&o===0},TL=e=>{if(No(e))return Vc(e)>>>24===127;let{w0:t,w1:n,w2:r,w3:o}=Zc(e);return t===0&&n===0&&r===0&&o===1},Wx=e=>qx(e)?vCe(e):No(e)?Vc(e)>>>28===14:Zc(e).w0>>>24===255,QC=e=>qx(e)?KC(e):Vc(e)===4294967295,vL=e=>qx(e)?VC(e):!Wx(e)&&!ZC(e)&&(!No(e)||!QC(e)),kL=e=>No(e)?Vc(e)>>>16===43518:(Zc(e).w0>>>16&65472)===65152,CL=e=>{let t=Vc(e);return t>>>24===10||(t>>>16&65520)===44048||t>>>16===49320},AL=e=>(Zc(e).w0>>>24&254)===252,kCe=e=>{let{w0:t,w1:n,w2:r}=Zc(e);return t===0&&n===0&&r===65535};var CCe={...yr,_tag:"InetAddressV4",[ea]:ea,[Te](e){return kI(e)&&this.port===e.port&&ce(this.address,e.address)},[we](){return ke(pe(this.address),xr(this.port))},toString(){return YC(this)},toJSON(){return this.toString()}},ACe={...yr,_tag:"InetAddressV6",[ea]:ea,[Te](e){return CI(e)&&this.port===e.port&&this.scopeId===e.scopeId&&ce(this.address,e.address)},[we](){return ke(ke(pe(this.address),xr(this.port)),xr(this.scopeId))},toString(){return YC(this)},toJSON(){return this.toString()}},v9=e=>Number.isInteger(e)&&e>=0&&e<=65535,MCe=(e,t)=>{if(!v9(t))return Vn(e,"port must be an integer from 0 through 65535");let n=Object.create(CCe);return n.address=e,n.port=t,G(Object.freeze(n))},OCe=(e,t,n)=>{if(!v9(t))return Vn(e,"port must be an integer from 0 through 65535");let r=n?.scopeId??0;if(!Number.isInteger(r)||r<0||r>4294967295)return Vn(e,"scopeId must be an unsigned 32-bit integer");let o=Object.create(ACe);return o.address=e,o.port=t,o.scopeId=r,G(Object.freeze(o))};var ML=e=>{let t,n,r=0,o=e.startsWith("[");if(o){let s=e.indexOf("]");if(s<0||e[s+1]!==":"||e.indexOf("]",s+1)!==-1)return Vn(e,"expected [IPv6]:port");t=e.slice(1,s),n=e.slice(s+2);let i=t.indexOf("%");if(i!==-1){let a=t.slice(i+1);if(t.indexOf("%",i+1)!==-1||!/^\d+$/.test(a))return Vn(e,"scope identifier must be decimal");if(r=Number(a),!Number.isInteger(r)||r>4294967295)return Vn(e,"scope identifier must be an unsigned 32-bit integer");t=t.slice(0,i)}}else{let s=e.lastIndexOf(":");if(s<0)return Vn(e,"expected host:port or [IPv6]:port");if(e.indexOf(":")!==s)return Vn(e,"IPv6 addresses must be bracketed");t=e.slice(0,s),n=e.slice(s+1)}return/^(0|[1-9]\d*)$/.test(n)?er(Ud(t),s=>o!==Wa(s)?Vn(e,"only IPv6 addresses use brackets"):Wa(s)?OCe(s,Number(n),{scopeId:r}):MCe(s,Number(n))):Vn(e,"port must be an unpadded decimal integer")};var RCe=e=>Po(e.address)+(CI(e)&&e.scopeId!==0?`%${e.scopeId}`:"");var YC=e=>{let t=RCe(e);return kI(e)?`${t}:${e.port}`:`[${t}]:${e.port}`};var _Ce={...yr,_tag:"UnixPathAddress",[ea]:ea,[Te](e){return GC(e)&&this.path===e.path},[we](){return ke(St("UnixPathAddress"),St(this.path))},toString(){return this.path},toJSON(){return this.toString()}},k9=e=>{let t=Object.create(_Ce);return t.path=e,Object.freeze(t)};var OL="~effect/net/Host",Dd=(e,t)=>Z(new qa({input:e,message:t})),NCe=/^[a-z0-9_.-]$/i,PCe=/^[a-z0-9_](?:[a-z0-9_-]{0,61}[a-z0-9_])?$/,FCe=/^(?:\d+|0x[0-9a-f]*)$/,C9=e=>{if(e===".")return;let t=e.endsWith(".")?e.slice(0,-1):e;if(t.length===0)return"domain name must not be empty";if(t.length>253)return"domain name must be at most 253 characters";let n=t.split(".");for(let r of n){if(r.length===0)return"domain name labels must not be empty";if(r.length>63)return"domain name labels must be at most 63 characters";if(!PCe.test(r))return"domain name labels must contain only letters, digits, hyphens, or underscores and must not start or end with a hyphen"}if(FCe.test(n[n.length-1]))return"the last domain name label must not be numeric"},UCe=e=>{let t=!0;for(let n of e)if(n.charCodeAt(0)<128){if(!NCe.test(n))return}else t=!1;if(t)return e.toLowerCase();try{return new URL(`http://${e}`).hostname}catch{return}},rl=e=>typeof e=="string"&&/^[a-z0-9_.-]+$/.test(e)&&C9(e)===void 0;var _L=e=>P(e,OL),XC=e=>{let t=UCe(e);if(t===void 0)return Dd(e,"invalid domain name");let n=C9(t);return n===void 0?G(t):Dd(e,n)};var DCe=e=>{if(e.includes("%"))return AI(e);if(e.includes(":"))return Ud(e);if(/^[\d.]+$/.test(e)){let t=Ud(e);if(Ne(t))return t}return XC(e)};var LCe=e=>typeof e=="string"?e:Po(e);var $Ce={...yr,_tag:"HostPort",[OL]:OL,[Te](e){return _L(e)&&this.port===e.port&&ce(this.host,e.host)},[we](){return ke(pe(this.host),xr(this.port))},toString(){return NL(this)},toJSON(){return this.toString()}},BCe=e=>Number.isInteger(e)&&e>=0&&e<=65535,HCe=(e,t)=>{let n=Object.create($Ce);return n.host=e,n.port=t,Object.freeze(n)};var A9=e=>{let t,n;if(e.startsWith("[")){let o=e.indexOf("]");if(o===-1||e[o+1]!==":")return Dd(e,"expected [IPv6]:port");if(t=e.slice(1,o),n=e.slice(o+2),!t.includes(":"))return Dd(e,"only IPv6 addresses use brackets")}else{let o=e.lastIndexOf(":");if(o===-1)return Dd(e,"expected host:port");if(e.indexOf(":")!==o)return Dd(e,"IPv6 addresses must be bracketed");t=e.slice(0,o),n=e.slice(o+1)}if(!/^(0|[1-9]\d*)$/.test(n))return Dd(e,"port must be an unpadded decimal integer");let r=Number(n);return BCe(r)?Xt(DCe(t),o=>HCe(o,r)):Dd(e,"port must be an integer from 0 through 65535")};var NL=e=>{let t=LCe(e.host);return t.includes(":")?`[${t}]:${e.port}`:`${t}:${e.port}`};var FL="~effect/net/Dns/DnsRecord",PL=e=>Number.isInteger(e)&&e>=0&&e<=255,Gx=e=>Number.isInteger(e)&&e>=0&&e<=65535,R9=e=>Number.isInteger(e)&&e>=0&&e<=4294967295,Ld=e=>typeof e=="string",eA=e=>ug(e)&&Xr(e)&&R9(gc(e)),_9={A:{address:No},AAAA:{address:Wa},CAA:{critical:e=>typeof e=="boolean",tag:e=>Ld(e)&&/^[a-z0-9]+$/i.test(e),value:Ld},CNAME:{target:rl},MX:{exchange:rl,priority:Gx},NAPTR:{order:Gx,preference:Gx,flags:Ld,service:Ld,regexp:Ld,replacement:rl},NS:{host:rl},PTR:{host:e=>Ld(e)&&e.length>0},SOA:{primary:rl,admin:e=>Ld(e)&&e.length>0,serial:R9,refresh:eA,retry:eA,expire:eA,minimum:eA},SRV:{target:rl,port:Gx,priority:Gx,weight:Gx},TLSA:{certUsage:PL,selector:PL,matchingType:PL,data:e=>e instanceof Uint8Array&&e.length>0},TXT:{chunks:e=>Array.isArray(e)&&e.length>0&&e.every(Ld)}},UL=Object.keys(_9),zCe=e=>UL.includes(e),DL=e=>P(e,FL),jCe={...yr,[FL]:FL,[Te](e){return DL(e)&&e._tag===this._tag&&Object.keys(this).every(t=>ce(this[t],e[t]))},[we](){return Hh(this,Object.keys(this))},toString(){return WCe(this)},toJSON(){return{...this}}},N9=(e,t)=>{if(!zCe(e))return Z(new qa({input:e,message:"unknown DNS record type"}));let n=typeof t=="object"&&t!==null?t:{},r=Object.create(jCe);r._tag=e;for(let[o,s]of Object.entries(_9[e])){let i=n[o];if(!s(i))return Z(new qa({input:t,message:`invalid ${e} record ${o}`}));r[o]=Array.isArray(i)?Object.freeze([...i]):i instanceof Uint8Array?new Uint8Array(i):i}return G(Object.freeze(r))};var P9=new TextEncoder,F9=e=>`\\${e.toString().padStart(3,"0")}`,OI=e=>{let t='"';for(let n of P9.encode(e))t+=n===34||n===92?`\\${String.fromCharCode(n)}`:n<32||n>126?F9(n):String.fromCharCode(n);return t+'"'},qCe=[34,36,40,41,59,64],O9=e=>{let t=P9.encode(e),n="";for(let r=0;r126?n+=F9(o):n+=qCe.includes(o)?`\\${String.fromCharCode(o)}`:String.fromCharCode(o)}return n},WCe=e=>{switch(e._tag){case"A":case"AAAA":return`${e._tag} ${Po(e.address)}`;case"CAA":return`CAA ${e.critical?128:0} ${e.tag} ${OI(e.value)}`;case"CNAME":return`CNAME ${e.target}`;case"MX":return`MX ${e.priority} ${e.exchange}`;case"NAPTR":return`NAPTR ${e.order} ${e.preference} ${OI(e.flags)} ${OI(e.service)} ${OI(e.regexp)} ${e.replacement}`;case"NS":return`NS ${e.host}`;case"PTR":return`PTR ${O9(e.host)}`;case"SOA":return`SOA ${e.primary} ${O9(e.admin)} ${e.serial} ${gc(e.refresh)} ${gc(e.retry)} ${gc(e.expire)} ${gc(e.minimum)}`;case"SRV":return`SRV ${e.priority} ${e.weight} ${e.port} ${e.target}`;case"TLSA":return`TLSA ${e.certUsage} ${e.selector} ${e.matchingType} ${Yw(e.data).toUpperCase()}`;case"TXT":return`TXT ${e.chunks.map(OI).join(" ")}`}};var LL="~effect/net/IpInterface",U9=e=>RI(e)&&No(e.address),D9=e=>RI(e)&&Wa(e.address),RI=e=>P(e,LL),VCe={...yr,_tag:"IpInterface",[LL]:LL,[Te](e){return RI(e)&&this.prefixLength===e.prefixLength&&ce(this.address,e.address)},[we](){return ke(pe(this.address),xr(this.prefixLength))},toString(){return NI(this)},toJSON(){return this.toString()}},$L=(e,t)=>Z(new qa({input:e,message:t})),_I=(e,t)=>{let n=jx(e);if(!Number.isInteger(t)||t<0||t>n)return $L(e,`prefix length must be an integer from 0 through ${n}`);let r=Object.assign(Object.create(VCe),{address:e,prefixLength:t});return G(Object.freeze(r))},BL=(e,t)=>{let n=e.indexOf("/");if(n===-1&&t?.prefix!=="required")return G({address:e,prefixLength:void 0});if(n<=0||n!==e.lastIndexOf("/")||n===e.length-1)return $L(e,"expected an address and prefix length separated by one slash");let r=e.slice(n+1);return/^(0|[1-9][0-9]*)$/.test(r)?G({address:e.slice(0,n),prefixLength:Number(r)}):$L(e,"prefix length must be an unpadded ASCII decimal integer")},tA=(e,t)=>er(BL(e,t),n=>er(Xm(n.address),r=>_I(r,n.prefixLength??jx(r)))),nA=(e,t)=>er(BL(e,t),n=>er(eh(n.address),r=>_I(r,n.prefixLength??jx(r)))),rA=(e,t)=>er(BL(e,t),n=>er(Ud(n.address),r=>_I(r,n.prefixLength??jx(r))));var NI=e=>`${Po(e.address)}/${e.prefixLength}`;var HL="~effect/net/IpNetwork",$9=e=>PI(e)&&No(e.address),B9=e=>PI(e)&&Wa(e.address),PI=e=>P(e,HL),ZCe={...yr,_tag:"IpNetwork",[HL]:HL,[Te](e){return PI(e)&&this.prefixLength===e.prefixLength&&ce(this.address,e.address)},[we](){return ke(pe(this.address),xr(this.prefixLength))},toString(){return FI(this)},toJSON(){return this.toString()}},QCe=e=>{let t=Object.assign(Object.create(ZCe),{address:e.address,prefixLength:e.prefixLength});return Object.freeze(t)},YCe=e=>No(e)?JC(e):EL(e);var XCe=(e,t)=>{let n=Math.floor(t/8),r=t%8;return e.map((o,s)=>ser(_I(e,t),n=>{let r=YCe(e),o=XCe(r,t);return r.some((s,i)=>s!==o[i])?Z(new qa({input:e,message:"address has non-zero host bits"})):G(QCe(n))});var H9=e=>er(tA(e,{prefix:"required"}),t=>zL(t.address,t.prefixLength)),z9=e=>er(nA(e,{prefix:"required"}),t=>zL(t.address,t.prefixLength)),j9=e=>er(rA(e,{prefix:"required"}),t=>zL(t.address,t.prefixLength));var FI=e=>`${Po(e.address)}/${e.prefixLength}`;var UI=wC;function Ii(){return(e,t,n)=>Ie(new Wm(e.map(wx),r=>t(r.map(o=>Ie(o))),n))}function qt(e,t){return Ii()([],()=>(n,r,o)=>e(n)?v(n):j(new or(r,n,o)),t)}function tAe(e){return e}function nAe(e){return t=>t.annotate(e)}function rAe(e){return t=>qL(qL(t).annotate(e))}function oAe(e){return t=>t.rebuild(Cx(t.ast,e))}function sAe(e){return e}var ol=class extends vo("SchemaError"){[Hx]=Hx;constructor(t){let n=Bo();In(0);try{super({issue:t})}finally{In(n)}}get message(){return $b(this.issue)}toJSON(){return{_tag:this._tag,message:this.message}}[De](){return this.toJSON()}toString(){return`SchemaError(${this.message})`}};function rY(e){return b9(e)}function oY(e){return jt(e)?JL(e):Lt(e,t=>Cu(()=>Df(t,n=>new ol(n))))}function JL(e){return Dt(e)?e:Lr(Df(e.cause,t=>new ol(t)))}function sY(e,t){let n;for(let r of e.reasons){if(!Su(r)||!rY(r.error))throw new globalThis.Error(t,{cause:e});n??=r.error}if(n===void 0)throw new globalThis.Error(t,{cause:e});return n}function iY(e){return dm(e).then(t=>{if(Dt(t))return t.value;throw sY(t.cause,"Promise adapter can only reject schema errors")})}function aY(e){let t=_a(e);if(Dt(t))return t.value;throw sY(t.cause,"Sync adapter can only throw schema errors")}function iAe(e,t){return o9(e,t)}function aAe(e){return s9(e)}var cAe=xC,uAe=F2;function sA(e,t){let n=Pn(e,t);return(r,o)=>oY(n(r,o))}var KL=sA;function cY(e,t){let n=yC(e,t);return(r,o)=>JL(n(r,o))}var fAe=cY,lAe=SC,dAe=U2;function uY(e,t){let n=Ox(e,t);return(r,o)=>Ml(n(r,o),s=>new ol(s))}var pAe=uY;function fY(e,t){let n=sA(e,t);return(r,o)=>iY(n(r,o))}var mAe=fY;function lY(e,t){let n=sA(e,t);return(r,o)=>aY(n(r,o))}var iA=lY;function aA(e,t){let n=el(e,t);return(r,o)=>oY(n(r,o))}var VL=aA;function dY(e,t){let n=EC(e,t);return(r,o)=>JL(n(r,o))}var hAe=dY,gAe=bC,xAe=L2;function pY(e,t){let n=IC(e,t);return(r,o)=>Ml(n(r,o),s=>new ol(s))}var yAe=pY;function mY(e,t){let n=aA(e,t);return(r,o)=>iY(n(r,o))}var SAe=mY;function hY(e,t){let n=aA(e,t);return(r,o)=>aY(n(r,o))}var cA=hY,Ie=Jc;function uA(e){return P(e,UI)&&e[UI]===UI}var bi=Yo(e=>Ie(_d(e.ast),{schema:e})),EAe=Yo(e=>e.schema),Uo=Yo(e=>{let t=fA(e);return Ie(b2(e.ast),{schema:t})}),bAe=Yo(e=>e.schema.members[0]),ZL=Yo(e=>Ie(nC(e.ast),{schema:e})),IAe=Yo(e=>e.schema),wi=Yo(e=>Ie(Sn(e.ast),{schema:e})),Qx=Yo(e=>Ie(yi(e.ast),{schema:e})),DI="~effect/Schema/flip";function wAe(e){return P(e,DI)&&e[DI]===DI}function qL(e){return wAe(e)?e.schema.rebuild(xi(e.ast)):Ie(xi(e.ast),{[DI]:DI,schema:e})}function an(e){let t=Ie(new gi(e),{literal:e,transform(n){return t.pipe(ve(an(n),{decode:Se(()=>n),encode:Se(()=>e)}))}});return t}function gY(e){return e.map(t=>uA(t)?t.ast:new gi(t))}function QL(e){return Ie(new Jk(gY(e)),{parts:e})}function TAe(e){return Ie(i2(gY(e)),{parts:e})}function YL(e){return Ie(new s2(Object.keys(e).filter(t=>typeof e[e[t]]!="number").map(t=>[t,e[t]])),{enums:e})}var XL=Ie(Gk),e$=Ie(r2),sl=Ie(Ba),bt=Ie(qk),BI=Ie(Wk),ae=Ie(Is),vAe=ae,Qc=Ie(Kk),Vr=Ie(c2),th=Ie(u2),Ts=Ie(f2),t$=Ie(n2),n$=Ie(o2);function r$(e){return Ie(new a2(e))}function o$(e,t){return Ie(e,{fields:t,mapFields(n,r){let o=n(this.fields);return o$(tI(o,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function oe(e){return o$(tI(e,void 0),e)}function kAe(e){return Yo(t=>t.mapFields(lL(e)))}var CAe=e=>typeof e=="symbol"?e:globalThis.String(e);function AAe(e){return function(t){let n={},r=Object.create(null),o=Object.create(null),s=new Set;for(let i of Reflect.ownKeys(t.fields)){let a=Qx(t.fields[i]),c=Object.hasOwn(e,i),f=c?e[i]:i,l=CAe(f);if(s.has(l))throw new globalThis.Error(`Duplicate encoded keys: ${Ms(f)}`);s.add(l),U(n,f,a),c&&(r[i]=f,o[f]=i)}return oe(n).pipe(ve(t,$t({decode:HC(o),encode:HC(r)})))}}function MAe(e,t){return n=>{let r=Rl(n.fields,wi),o=oe({...r,...e});return n.pipe(ve(o,$t({decode:s=>{let i={...s};for(let a in e){let c=t[a],f=c(s);ie(f)&&U(i,a,f.value)}return i},encode:s=>{let i={...s};for(let a in e)delete i[a];return i}})))}}function vs(e,t){return Ie(w2(e.ast,t.ast),{key:e,value:t})}function s$(e,t){return Ie(d2(e.ast,t.map(wx)),{schema:e,records:t})}function xY(e,t){return Ie(e,{elements:t,mapElements(n,r){let o=n(this.elements);return xY(Qk(o,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Fo(e){return xY(Qk(e),e)}function i$(e,t){return Ie(p2(e.ast,t.map(wx)),{schema:e,rest:t})}var st=Yo(e=>Ie(new Yi(!1,[],[e.ast]),{value:e}));function $d(e,t,n){return t!==void 0&&n!==void 0?e.check(JI(t,n)):t!==void 0?e.check(nh(t)):n!==void 0?e.check(il(n)):e}var Wu=Yo(e=>Ie(new Yi(!1,[e.ast],[e.ast]),{value:e}));function OAe(e){let t=st(e),n=st(wi(e)),r=ve(Fo([sl]),$t({decode:o=>[o],encode:([o])=>o}))(e);return Ie(Et([r,t]).pipe(ve(n)).ast,{from:Et([e,t]),to:n})}function RAe(e){return st(e).check(rh())}var _Ae=Yo(e=>Ie(m2(e.ast),{schema:e}));function yY(e,t){return Ie(e,{members:t,mapMembers(n,r){let o=n(this.members);return yY(nI(o,this.ast.options,r?.unsafePreserveChecks?this.ast.checks:void 0),o)}})}function Et(e,t){return yY(nI(e,t,void 0),e)}function fo(e){let t=e.map(an);return Ie(nI(t,void 0,void 0),{literals:e,members:t,mapMembers(n){return Et(n(this.members))},pick(n){return fo(n)},transform(n){return Et(t.map((r,o)=>r.transform(n[o])))}})}var a$=Yo(e=>Et([e,bt])),fA=Yo(e=>Et([e,BI])),SY=Yo(e=>Et([e,bt,BI]));function Yc(e){return Ie(new Yk(()=>e().ast))}function NAe(...e){return t=>t.check(...e)}function EY(e,t){return n=>Ie(qc(n.ast,[vx(e,t)]),{schema:n})}function lA(e){return t=>Ie(t.ast,{schema:t,identifier:e})}function PAe(e,t){return n=>(t.checks?n.check(...t.checks):n).pipe(lA(e))}function bY(e){return t=>Ie(y2(t.ast,new Kb(e,L)),{schema:t})}function IY(e){return t=>Ie(S2(t.ast,new Kb(L,e)),{schema:t})}function FAe(e){return wY(e)}function wY(e){return t=>bY(Jg(e))(t)}function UAe(e){return TY(e)}function TY(e){return t=>IY(Jg(e))(t)}function ve(e,t){return n=>Ie(Xf(n.ast,e.ast,t?Vb(t):Lm()),{from:n,to:e})}function Bd(){return(e,t)=>Ht()(e,{decode:t,encode:ZU})}var vY=fo(["true","yes","on","1","y"]),kY=fo(["false","no","off","0","n"]),c$=fo([...vY.literals,...kY.literals]).pipe(ve(Vr,$t({decode:e=>e==="true"||e==="yes"||e==="on"||e==="1"||e==="y",encode:e=>e?"true":"false"})));function DAe(e){return t=>ve(wi(t),e)(t)}function Yx(e,t){return n=>t?ve(n,t)(e):ve(n)(e)}function LAe(e){return t=>ve(t,e)(Qx(t))}function CY(e){return t=>Ie(I2(t.ast,e),{schema:t})}function AY(e){return jt(e)&&e._tag==="Success"?e:Lt(e,t=>Cu(()=>Df(t,n=>n.issue)))}function u$(e,t){let n=t?.encodingStrategy==="omit"?_k():Cr();return r=>bi(Qx(r)).pipe(ve(r,{decode:Nk(AY(e)),encode:n}))}function $Ae(e,t){return n=>wi(n).pipe(u$(e,t),Yx(bi(n)))}function MY(e,t){let n=t?.encodingStrategy==="omit"?_k():Cr();return r=>Uo(Qx(r)).pipe(ve(r,{decode:Nk(AY(e)),encode:n}))}function BAe(e,t){return n=>wi(n).pipe(MY(e,t),Yx(Uo(n)))}function $n(e){return an(e).pipe(CY(v(e)))}function HAe(e){return $n(e).pipe(u$(v(e),{encodingStrategy:"omit"}))}function HI(e,t){return oe({_tag:$n(e),...t})}function OY(e){return t=>{let n={},r=[],o=new Set,s={},i=l=>d=>l.includes(d[e]);return a(t),Object.assign(t,{tag:e,cases:n,discriminants:r,isAnyOf:i,guards:s,match:c,matchOrElse:f});function a(l){let d=l.ast;if(e2(d)&&"members"in l&&globalThis.Array.isArray(l.members)&&l.members.every(uA))return l.members.forEach(a);let p=zm(d);if(p.length>0){let m=p.find(g=>g.key===e)?.literal;if(up(m)){let g=typeof m=="number"?globalThis.String(m):m;if(o.has(g))throw new globalThis.Error(`Duplicate discriminant: ${globalThis.String(m)}`);o.add(g),r.push(m),U(n,m,l),U(s,m,xC(wi(l)));return}}throw new globalThis.Error("No literal or unique symbol found")}function c(){if(arguments.length===1){let g=arguments[0];return function(b){let x=b[e];return(Object.hasOwn(g,x)?g[x]:void 0)(b)}}let l=arguments[0],d=arguments[1],p=l[e];return(Object.hasOwn(d,p)?d[p]:void 0)(l)}function f(){if(arguments.length===2){let b=arguments[0],x=arguments[1];return function(w){let E=w[e];return(Object.hasOwn(b,E)?b[E]??x:x)(w)}}let l=arguments[0],d=arguments[1],p=arguments[2],m=l[e];return(Object.hasOwn(d,m)?d[m]??p:p)(l)}}}function zAe(e){let t={},n=[];for(let f of Object.keys(e)){let l=HI(f,e[f]);U(t,f,l),n.push(l)}let r=Et(n),{tag:o,guards:s,isAnyOf:i,match:a,matchOrElse:c}=OY("_tag")(r);return Ie(r.ast,{tag:o,cases:t,isAnyOf:i,guards:s,match:a,matchOrElse:c})}function jAe(){return e=>e}function Hd(e,t){return qt(n=>n instanceof e,t)}function Ht(){return(e,t)=>new Kn(e.ast,Vb(t))}var zt=Gm;function f$(e,t=void 0){return new Cd(e,t)}var q9="^\\S[\\s\\S]*\\S$|^\\S$|^$";function dA(e){let t=new globalThis.RegExp(q9);return zt(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:q9,flags:""}]},...e})}function ta(e,t){let n=e.source,r=e.flags,o=/^[dg]*uy?$/.test(r),s=r===""?`new RegExp(${V(n)})`:`new RegExp(${V(n)}, ${V(r)})`;return kx(e,{toJsonSchema:()=>o?{pattern:r.endsWith("y")?`^(?:${n})`:n}:[{},!0],toCode:()=>({runtime:`Schema.isPattern(${s})`}),...t})}function l$(e){return sC({toCode:()=>({runtime:"Schema.isStringFinite()"}),...e})}function d$(e){return iC({toCode:()=>({runtime:"Schema.isStringBigInt()"}),...e})}function p$(e){return cC({toCode:()=>({runtime:"Schema.isStringSymbol()"}),...e})}var qAe=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})$/;function m$(e,t){let n=qAe(e);return ta(n,{expected:e?`a UUID v${e}`:"a UUID",representation:{id:"effect/schema/isUUID",payload:{version:e??null}},toJsonSchema:()=>({pattern:n.source,format:"uuid"}),toCode:()=>({runtime:e===void 0?"Schema.isUUID()":`Schema.isUUID(${e})`}),...t})}var W9=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;function h$(e){return ta(W9,{expected:"a GUID",representation:{id:"effect/schema/isGUID",payload:null},toJsonSchema:()=>({pattern:W9.source}),toCode:()=>({runtime:"Schema.isGUID()"}),...e})}function g$(e){let t=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;return ta(t,{representation:{id:"effect/schema/isULID",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isULID()"}),...e})}function pA(e){let t=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;return ta(t,{expected:"a base64 encoded string",representation:{id:"effect/schema/isBase64",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64()"}),...e})}function x$(e){let t=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;return ta(t,{expected:"a base64url encoded string",representation:{id:"effect/schema/isBase64Url",payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:"Schema.isBase64Url()"}),...e})}function y$(e,t,n){if(e.length===0)return t.length===0?{}:[{},!0];let r={pattern:new globalThis.RegExp(n).source};return e===t?r:[r,!0]}function S$(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(`^${qu(e)}`),o=e.replace(/[\uD800-\uDBFF]$/,"");return zt(s=>s.startsWith(e),{expected:`a string starting with ${n}`,representation:{id:"effect/schema/isStartingWith",payload:{startsWith:e}},toJsonSchema:()=>y$(o,e,`^${qu(o)}`),toCode:()=>({runtime:`Schema.isStartingWith(${V(e)})`}),arbitraryConstraint:{patterns:[{source:r.source,flags:r.flags}]},...t})}function E$(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(`${qu(e)}$`),o=e.replace(/^[\uDC00-\uDFFF]/,"");return zt(s=>s.endsWith(e),{expected:`a string ending with ${n}`,representation:{id:"effect/schema/isEndingWith",payload:{endsWith:e}},toJsonSchema:()=>y$(o,e,`${qu(o)}$`),toCode:()=>({runtime:`Schema.isEndingWith(${V(e)})`}),arbitraryConstraint:{patterns:[{source:r.source,flags:r.flags}]},...t})}function b$(e,t){let n=JSON.stringify(e),r=new globalThis.RegExp(qu(e)),o=e.replace(/^[\uDC00-\uDFFF]|[\uD800-\uDBFF]$/g,"");return zt(s=>s.includes(e),{expected:`a string including ${n}`,representation:{id:"effect/schema/isIncluding",payload:{includes:e}},toJsonSchema:()=>y$(o,e,qu(o)),toCode:()=>({runtime:`Schema.isIncluding(${V(e)})`}),arbitraryConstraint:{patterns:[{source:r.source,flags:r.flags}]},...t})}var G9="^[^a-z]*$";function I$(e){let t=new globalThis.RegExp(G9);return zt(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:G9,flags:""}]},...e})}var J9="^[^A-Z]*$";function w$(e){let t=new globalThis.RegExp(J9);return zt(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:J9,flags:""}]},...e})}var K9="^(?:[^a-z][\\s\\S]*)?$";function T$(e){let t=new globalThis.RegExp(K9);return zt(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:K9,flags:""}]},...e})}var V9="^(?:[^A-Z][\\s\\S]*)?$";function v$(e){let t=new globalThis.RegExp(V9);return zt(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:V9,flags:""}]},...e})}var Xo=Ie(eC),k$=Xk;function zI(e){let t=qo(e.order),n=e.formatter??V;return(r,o)=>zt(s=>t(s,r),{expected:`a value greater than ${n(r)}`,arbitraryConstraint:{order:e.order,minimum:r,exclusiveMinimum:!0},...e.annotate?.(r),...o})}function jI(e){let t=ls(e.order),n=e.formatter??V;return(r,o)=>zt(s=>t(s,r),{expected:`a value greater than or equal to ${n(r)}`,arbitraryConstraint:{order:e.order,minimum:r},...e.annotate?.(r),...o})}function qI(e){let t=jo(e.order),n=e.formatter??V;return(r,o)=>zt(s=>t(s,r),{expected:`a value less than ${n(r)}`,arbitraryConstraint:{order:e.order,maximum:r,exclusiveMaximum:!0},...e.annotate?.(r),...o})}function WI(e){let t=fs(e.order),n=e.formatter??V;return(r,o)=>zt(s=>t(s,r),{expected:`a value less than or equal to ${n(r)}`,arbitraryConstraint:{order:e.order,maximum:r},...e.annotate?.(r),...o})}function GI(e){let t=ls(e.order),n=qo(e.order),r=fs(e.order),o=jo(e.order),s=e.formatter??V;return(i,a)=>{let c=i.exclusiveMinimum?n:t,f=i.exclusiveMaximum?o:r;return zt(l=>c(l,i.minimum)&&f(l,i.maximum),{expected:`a value between ${s(i.minimum)}${i.exclusiveMinimum?" (excluded)":""} and ${s(i.maximum)}${i.exclusiveMaximum?" (excluded)":""}`,arbitraryConstraint:{order:e.order,minimum:i.minimum,maximum:i.maximum,...i.exclusiveMinimum&&{exclusiveMinimum:!0},...i.exclusiveMaximum&&{exclusiveMaximum:!0}},...e.annotate?.(i),...a})}}function WAe(e){return(t,n)=>{let r=e.formatter??V;return zt(o=>e.remainder(o,t)===e.zero,{expected:`a value that is a multiple of ${r(t)}`,...e.annotate?.(t),...n})}}function Kx(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${V(e)}`);return e}var C$=zI({order:Yr,annotate:e=>({representation:{id:"effect/schema/isGreaterThan",payload:{exclusiveMinimum:Kx(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${V(e)})`})})}),mA=jI({order:Yr,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualTo",payload:{minimum:Kx(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${V(e)})`})})}),A$=qI({order:Yr,annotate:e=>({representation:{id:"effect/schema/isLessThan",payload:{exclusiveMaximum:Kx(e)}},toJsonSchema:()=>({exclusiveMaximum:e}),toCode:()=>({runtime:`Schema.isLessThan(${V(e)})`})})}),M$=WI({order:Yr,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualTo",payload:{maximum:Kx(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${V(e)})`})})}),qs=GI({order:Yr,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetween",payload:{minimum:Kx(e.minimum),maximum:Kx(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?"exclusiveMinimum":"minimum"]:e.minimum,[n?"exclusiveMaximum":"maximum"]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${V(e.minimum)}, maximum: ${V(e.maximum)}, exclusiveMinimum: ${V(t)}, exclusiveMaximum: ${V(n)} })`})}}});function O$(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),zt(n=>_E(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(${V(e)})`}),...t})}function Xx(e){return zt(t=>globalThis.Number.isSafeInteger(t),{expected:"an integer",representation:{id:"effect/schema/isInt",payload:null},toJsonSchema:()=>({type:"integer",minimum:globalThis.Number.MIN_SAFE_INTEGER,maximum:globalThis.Number.MAX_SAFE_INTEGER}),toCode:()=>({runtime:"Schema.isInt()"}),arbitraryConstraint:{number:"integer"},...e})}var Do=Qc.check(Xx()),sr=Do.check(mA(0));function GAe(e){return new Cd([Xx(),qs({minimum:-2147483648,maximum:2147483647})],{expected:"a 32-bit integer",...e})}function JAe(e){return new Cd([Xx(),qs({minimum:0,maximum:4294967295})],{expected:"a 32-bit unsigned integer",...e})}function Vx(e){if(globalThis.Number.isNaN(e.getTime()))throw new globalThis.RangeError(`Expected a valid Date, got ${V(e)}`);return e.toISOString()}function Zx(e){return`new Date(${V(e.getTime())})`}var R$=zI({order:wp,annotate:e=>({representation:{id:"effect/schema/isGreaterThanDate",payload:{exclusiveMinimum:Vx(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanDate(${Zx(e)})`})})}),_$=jI({order:wp,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToDate",payload:{minimum:Vx(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToDate(${Zx(e)})`})})}),N$=qI({order:wp,annotate:e=>({representation:{id:"effect/schema/isLessThanDate",payload:{exclusiveMaximum:Vx(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanDate(${Zx(e)})`})})}),P$=WI({order:wp,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToDate",payload:{maximum:Vx(e)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToDate(${Zx(e)})`})})}),F$=GI({order:wp,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenDate",payload:{minimum:Vx(e.minimum),maximum:Vx(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenDate({ minimum: ${Zx(e.minimum)}, maximum: ${Zx(e.maximum)}, exclusiveMinimum: ${V(t)}, exclusiveMaximum: ${V(n)} })`})}}}),U$=zI({order:pa,annotate:e=>({representation:{id:"effect/schema/isGreaterThanBigInt",payload:{exclusiveMinimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanBigInt(${V(e)})`})})}),hA=jI({order:pa,annotate:e=>({representation:{id:"effect/schema/isGreaterThanOrEqualToBigInt",payload:{minimum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isGreaterThanOrEqualToBigInt(${V(e)})`})})}),D$=qI({order:pa,annotate:e=>({representation:{id:"effect/schema/isLessThanBigInt",payload:{exclusiveMaximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanBigInt(${V(e)})`})})}),L$=WI({order:pa,annotate:e=>({representation:{id:"effect/schema/isLessThanOrEqualToBigInt",payload:{maximum:e.toString(10)}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isLessThanOrEqualToBigInt(${V(e)})`})})}),$$=GI({order:pa,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:"effect/schema/isBetweenBigInt",payload:{minimum:e.minimum.toString(10),maximum:e.maximum.toString(10),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenBigInt({ minimum: ${V(e.minimum)}, maximum: ${V(e.maximum)}, exclusiveMinimum: ${V(t)}, exclusiveMaximum: ${V(n)} })`})}}});function nh(e,t){return e=ws(e),RY(e,Math.ceil(e/2),t)}function RY(e,t,n){return zt(r=>r.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:"effect/schema/isMinLength",payload:{minLength:e}},toJsonSchema:({type:r})=>r==="string"?e<=1?{minLength:t}:[{minLength:t},!0]:r==="array"?{minItems:e}:r===void 0?[{minLength:t,minItems:e},!0]:[{},!0],toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[di]:!0,arbitraryConstraint:{minLength:e},...n})}function _Y(e){return RY(1,1,e)}function il(e,t){return e=ws(e),zt(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})`}),[di]:!0,arbitraryConstraint:{maxLength:e},...t})}function JI(e,t,n){return e=ws(e),t=ws(t),zt(r=>r.length>=e&&r.length<=t,{expected:e===t?`a value with a length of ${e}`:`a value with a length between ${e} and ${t}`,representation:{id:"effect/schema/isBetweenLength",payload:{minimum:e,maximum:t}},toJsonSchema:({type:r})=>r==="string"?t===0||Math.ceil(e/2)>t?{minLength:Math.ceil(e/2),maxLength:t}:[{minLength:Math.ceil(e/2),maxLength:t},!0]:r==="array"?{minItems:e,maxItems:t}:r===void 0?[{minLength:Math.ceil(e/2),maxLength:t,minItems:e,maxItems:t},!0]:[{},!0],toCode:()=>({runtime:`Schema.isBetweenLength(${e}, ${t})`}),[di]:!0,arbitraryConstraint:{minLength:e,maxLength:t},...n})}function B$(e,t){return e=ws(e),zt(n=>j$(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 H$(e,t){return e=ws(e),zt(n=>j$(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 z$(e,t,n){return e=ws(e),t=ws(t),zt(r=>{let o=j$(r,t+1);return o>=e&&o<=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 j$(e,t){if(t===0)return 0;let n=0;for(let r of e)if(++n>=t)break;return n}function ws(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${e}`);return Math.max(0,Math.floor(e))}function q$(e,t){return e=ws(e),zt(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})`}),[di]:!0,arbitraryConstraint:{minSize:e},...t})}function W$(e,t){return e=ws(e),zt(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})`}),[di]:!0,arbitraryConstraint:{maxSize:e},...t})}function G$(e,t,n){return e=ws(e),t=ws(t),zt(r=>r.size>=e&&r.size<=t,{expected:e===t?`a value with a size of ${e}`:`a value with a size between ${e} and ${t}`,representation:{id:"effect/schema/isBetweenSize",payload:{minimum:e,maximum:t}},toJsonSchema:()=>[{},!0],toCode:()=>({runtime:`Schema.isBetweenSize(${e}, ${t})`}),[di]:!0,arbitraryConstraint:{minSize:e,maxSize:t},...n})}function J$(e,t){return e=ws(e),zt(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})`}),[di]:!0,arbitraryConstraint:{minProperties:e},...t})}function K$(e,t){return e=ws(e),zt(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})`}),[di]:!0,arbitraryConstraint:{maxProperties:e},...t})}function V$(e,t,n){return e=ws(e),t=ws(t),zt(r=>Reflect.ownKeys(r).length>=e&&Reflect.ownKeys(r).length<=t,{expected:e===t?`a value with exactly ${e===1?"1 entry":`${e} entries`}`:`a value with between ${e} and ${t} entries`,representation:{id:"effect/schema/isBetweenProperties",payload:{minimum:e,maximum:t}},toJsonSchema:({type:r})=>r==="object"?{minProperties:e,maxProperties:t}:[{minProperties:e,maxProperties:t},!0],toCode:()=>({runtime:`Schema.isBetweenProperties(${e}, ${t})`}),[di]:!0,arbitraryConstraint:{minProperties:e,maxProperties:t},...n})}function Z$(e,t){let n=Qx(e),r=P2(n.ast);return zt((o,s,i)=>{let a=Reflect.ownKeys(o),c=[];for(let f of a){let l=r(f,i);if(l!==void 0&&(c.push(new rr([f],l)),i.errors==="first"))break}return pn(c)?new kr(s,c,o,i):!0},{expected:"an object with property names matching the schema",representation:{id:"effect/schema/isPropertyNames",payload:null,schemas:[n.ast]},toJsonSchema:({schemas:o,type:s})=>s==="object"?{propertyNames:o[0]}:[{propertyNames:o[0]},!0],toCode:({schemas:o})=>({runtime:`Schema.isPropertyNames(${o[0].runtime})`}),[di]:!0,...t})}function rh(e){return zt(t=>_p(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:L},...e})}function ey(e){return zt(t=>_p(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})}var zd=ae.check(_Y()),KAe=ae.check(JI(1,1)),NY=e=>(e?.includeStack===!0?1:0)|(e?.excludeCause===!0?2:0),PY=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},Z9=[];function Q$(e){let t=NY(e),n=Z9[t];if(n!==void 0)return n;let r=PY(t),o=Hd(globalThis.Error,{representation:{id:"effect/schema/Error",payload:r??null},toCode:()=>({runtime:r!==void 0?`Schema.ErrorInstance(${V(r)})`:"Schema.ErrorInstance()",Type:"globalThis.Error"}),expected:"Error",toCodecJson:()=>Ht()(uRe,_D(r))});return Z9[t]=o,o}var Q9=[];function Y$(e){let t=NY(e),n=Q9[t];if(n!==void 0)return n;let r=Gu.pipe(ve(sl,ND(PY(t))));return Q9[t]=r,r}function X$(e,t){let n=Ii()([e,t],([r,o])=>{let s=st(Fo([r,o]));return(i,a,c)=>i instanceof globalThis.Map?Oo(Pn(s)([...i],c),{onSuccess:f=>new globalThis.Map(f),onFailure:f=>Hs(a,"entries",f,i,c)}):j(new or(a,i,c))},{representation:{id:"effect/schema/ReadonlyMap",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.ReadonlyMap(${r[0].runtime}, ${r[1].runtime})`,Type:`globalThis.ReadonlyMap<${r[0].Type}, ${r[1].Type}>`}),expected:"ReadonlyMap",toCodec:([r,o])=>Ht()(st(Fo([r,o])),$t({decode:s=>new globalThis.Map(s),encode:s=>[...s.entries()]}))});return Ie(n.ast,{key:e,value:t})}function eB(e){let t=Ii()([e],([n])=>{let r=st(n);return(o,s,i)=>o instanceof globalThis.Set?Oo(Pn(r)([...o],i),{onSuccess:a=>new globalThis.Set(a),onFailure:a=>Hs(s,"values",a,o,i)}):j(new or(s,o,i))},{representation:{id:"effect/schema/ReadonlySet",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.ReadonlySet(${n[0].runtime})`,Type:`globalThis.ReadonlySet<${n[0].Type}>`}),expected:"ReadonlySet",toCodec:([n])=>Ht()(st(n),$t({decode:r=>new globalThis.Set(r),encode:r=>[...r.values()]}))});return Ie(t.ast,{value:e})}var tB=Hd(globalThis.RegExp,{representation:{id:"effect/schema/RegExp",payload:null},toCode:()=>({runtime:"Schema.RegExp",Type:"globalThis.RegExp"}),expected:"RegExp",toCodecJson:()=>Ht()(oe({source:ae,flags:ae}),yn({decode:(e,t)=>jf({try:()=>new globalThis.RegExp(e.source,e.flags),catch:()=>new _e({expected:"valid RegExp source and flags"},e,t)}),encode:e=>v({source:e.source,flags:e.flags})}))}),FY=ae.annotate({expected:"a string that will be decoded as a URL"}),ty=Hd(globalThis.URL,{representation:{id:"effect/schema/URL",payload:null},toCode:()=>({runtime:"Schema.URL",Type:"globalThis.URL"}),expected:"URL",toCodecJson:()=>Ht()(FY,Dk)}),VAe=FY.pipe(ve(ty,Dk)),UY=ae.annotate({expected:"a string that will be decoded as a Date"}),Ti=qt(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:()=>Ht()(UY,Fk)}),ZAe=UY.pipe(ve(Ti,Fk)),QAe=Do.pipe(ve(Ti,MD)),YAe=ae.annotate({expected:"a string that will be decoded as JSON",contentMediaType:"application/json"});function nB(e,t){return YAe.pipe(ve(e,jD(t)))}var XAe=nB(sl),gA=Hd(globalThis.File,{representation:{id:"effect/schema/File",payload:null},toCode:()=>({runtime:"Schema.File",Type:"globalThis.File"}),expected:"File",toCodecJson:()=>Ht()(oe({data:ae.check(pA()),type:ae,name:ae,lastModified:Do}),yn({decode:(e,t)=>Sr(vm(e.data),{onFailure:()=>j(new _e({expected:"a valid Base64 string"},e.data,t)),onSuccess:n=>{let r=new globalThis.Uint8Array(n);return v(new globalThis.File([r],e.name,{type:e.type,lastModified:e.lastModified}))}}),encode:(e,t)=>sd({try:async()=>{let n=new globalThis.Uint8Array(await e.arrayBuffer());return{data:ax(n),type:e.type,name:e.name,lastModified:e.lastModified}},catch:()=>new _e({expected:"a readable File"},e,t)})}))}),xA=Hd(globalThis.FormData,{representation:{id:"effect/schema/FormData",payload:null},toCode:()=>({runtime:"Schema.FormData",Type:"globalThis.FormData"}),expected:"FormData",toCodecJson:()=>Ht()(st(Fo([ae,Et([oe({_tag:$n("String"),value:ae}),oe({_tag:$n("File"),value:gA})])])),yn({decode:e=>{let t=new globalThis.FormData;for(let[n,r]of e)t.append(n,r.value);return v(t)},encode:e=>v(globalThis.Array.from(e.entries()).map(([t,n])=>typeof n=="string"?[t,{_tag:"String",value:n}]:[t,{_tag:"File",value:n}]))}))});function eMe(e){return xA.pipe(ve(e,qD))}var yA=Hd(globalThis.URLSearchParams,{representation:{id:"effect/schema/URLSearchParams",payload:null},toCode:()=>({runtime:"Schema.URLSearchParams",Type:"globalThis.URLSearchParams"}),expected:"URLSearchParams",toCodecJson:()=>Ht()(ae.annotate({expected:"a query string that will be decoded as URLSearchParams"}),$t({decode:e=>new globalThis.URLSearchParams(e),encode:e=>e.toString()}))});function tMe(e){return yA.pipe(ve(e,WD))}var nMe=ae.annotate({expected:"a string that will be decoded as a number"}).pipe(ve(Qc,$m)),rMe=ae.annotate({expected:"a string that will be decoded as a finite number"}).pipe(ve(Xo,$m)),oMe=Ie(aC).pipe(ve(Ts,Qb)),DY=ae.check(dA()),sMe=ae.annotate({expected:"a string that will be decoded as a trimmed string"}).pipe(ve(DY,kD())),iMe=ae.annotate({expected:"a base64 encoded string that will be decoded as a UTF-8 string"}).pipe(ve(ae,$D)),aMe=ae.annotate({expected:"a base64 (URL) encoded string that will be decoded as a UTF-8 string"}).pipe(ve(ae,BD)),cMe=ae.annotate({expected:"a hex encoded string that will be decoded as a UTF-8 string"}).pipe(ve(ae,HD)),uMe=ae.annotate({expected:"a URI component encoded string that will be decoded as a UTF-8 string"}).pipe(ve(ae,zD)),WL=Et([Xo,th,ae]),fMe=oe({issues:st(oe({message:ae,path:Uo(st(Et([WL,oe({key:WL})])))}))}),lMe=fo([0,1]).pipe(ve(Vr,$t({decode:e=>e===1,encode:e=>e?1:0}))),LY=ae.annotate({expected:"a base64 encoded string that will be decoded as Uint8Array",format:"byte",contentEncoding:"base64"}),ny=Hd(globalThis.Uint8Array,{representation:{id:"effect/schema/Uint8Array",payload:null},toCode:()=>({runtime:"Schema.Uint8Array",Type:"globalThis.Uint8Array"}),expected:"Uint8Array",toCodecJson:()=>Ht()(LY,Lk)}),dMe=LY.pipe(ve(ny,Lk)),pMe=ae.annotate({expected:"a base64 (URL) encoded string that will be decoded as a Uint8Array"}).pipe(ve(ny,{decode:mD(),encode:Wb()})),$Y=ae.annotate({expected:"a hex encoded string that will be decoded as a Uint8Array"}).pipe(ve(ny,{decode:gD(),encode:Gb()})),BY=yn({decode:(e,t)=>{let n=Sm(e);return Y(n)?j(new _e({expected:"a valid BigDecimal string"},e,t)):v(n.value)},encode:e=>v(Vi(e))}),mMe=zI({order:co,formatter:e=>Vi(e)}),hMe=jI({order:co,formatter:e=>Vi(e)}),gMe=qI({order:co,formatter:e=>Vi(e)}),xMe=WI({order:co,formatter:e=>Vi(e)}),yMe=GI({order:co,formatter:e=>Vi(e)}),HY=ae.annotate({expected:"a string that will be decoded as a BigDecimal"}),SA=qt(mb,{representation:{id:"effect/schema/BigDecimal",payload:null},toCode:()=>({runtime:"Schema.BigDecimal",Type:"BigDecimal.BigDecimal",importDeclarations:['import * as BigDecimal from "effect/BigDecimal"']}),expected:"BigDecimal",toCodecJson:()=>Ht()(HY,BY),toFormatter:()=>e=>Vi(e)}),SMe=HY.pipe(ve(SA,BY)),jd=qt(sF,{representation:{id:"effect/schema/ByteSize",payload:null},toCode:()=>({runtime:"Schema.ByteSize",Type:"ByteSize.ByteSize",importDeclarations:['import * as ByteSize from "effect/ByteSize"']}),expected:"ByteSize",toCodecJson:()=>Ht()(Ts.check(hA(globalThis.BigInt(0))),$t({decode:oF,encode:gb})),toCodecStringTree:()=>Ht()(zY,Uk)}),zY=ae.annotate({expected:"a string that will be decoded as a ByteSize"}),EMe=zY.pipe(ve(jd,Uk)),bMe=Ts.pipe(ve(jd,OD)),IMe=Qc.pipe(ve(jd,RD));function LI(e,t){let n=Ii()([e,t],([r,o])=>(s,i,a)=>{if(!HN(s))return j(new or(i,s,a));switch(s._tag){case"Fail":return Oo(Pn(r)(s.error,a),{onSuccess:Ag,onFailure:c=>Hs(i,"error",c,s,a)});case"Die":return Oo(Pn(o)(s.defect,a),{onSuccess:Mg,onFailure:c=>Hs(i,"defect",c,s,a)});case"Interrupt":return v(s)}},{representation:{id:"effect/schema/CauseReason",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.CauseReason(${r[0].runtime}, ${r[1].runtime})`,Type:`Cause.Failure<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause.Failure",toCodec:([r,o])=>Ht()(Et([oe({_tag:an("Fail"),error:r}),oe({_tag:an("Die"),defect:o}),oe({_tag:an("Interrupt"),fiberId:fA(Xo)})]),$t({decode:s=>{switch(s._tag){case"Fail":return Ag(s.error);case"Die":return Mg(s.defect);case"Interrupt":return qN(s.fiberId)}},encode:s=>{switch(s._tag){case"Fail":return{_tag:"Fail",error:s.error};case"Die":return{_tag:"Die",defect:s.defect};case"Interrupt":return{_tag:"Interrupt",fiberId:s.fiberId}}}}))});return Ie(n.ast,{error:e,defect:t})}function $I(e,t){let n=Ii()([e,t],([r,o])=>{let s=st(LI(r,o));return(i,a,c)=>dE(i)?Oo(Pn(s)(i.reasons,c),{onSuccess:Eu,onFailure:f=>Hs(a,"failures",f,i,c)}):j(new or(a,i,c))},{representation:{id:"effect/schema/Cause",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Cause(${r[0].runtime}, ${r[1].runtime})`,Type:`Cause.Cause<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as Cause from "effect/Cause"']}),expected:"Cause",toCodec:([r,o])=>Ht()(st(LI(r,o)),$t({decode:Eu,encode:({reasons:s})=>s}))});return Ie(n.ast,{error:e,defect:t})}function Y9(e){return Ht()(e,$t({decode:Uu,encode:ue}))}function rB(e){let t=Ii()([e],([n])=>{let r=st(n);return(o,s,i)=>xb(o)?Oo(Pn(r)(ue(o),i),{onSuccess:Uu,onFailure:a=>Hs(s,"values",a,o,i)}):j(new or(s,o,i))},{representation:{id:"effect/schema/Chunk",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Chunk(${n[0].runtime})`,Type:`Chunk.Chunk<${n[0].Type}>`}),expected:"Chunk",toCodec:([n])=>Y9(st(n)),toCodecArbitrary:({constraint:n,typeParameters:[r]})=>Y9($d(st(r),n?.minLength,n?.maxLength)),toEquivalence:([n])=>uk(n)});return Ie(t.ast,{value:e})}function jY(){return Jn((e,t)=>Tn(hd(e),{onNone:()=>j(new _e({message:"Invalid DateTime input"},e,t)),onSome:n=>v(gd(n))}))}var wMe=$t({decode:e=>Tm(e),encode:e=>e.offset}),qY=yn({decode:(e,t)=>Tn(Sb(e),{onNone:()=>j(new _e({expected:"a valid IANA time zone"},e,t)),onSome:v}),encode:e=>v(e.id)}),WY=yn({decode:(e,t)=>Tn(Eb(e),{onNone:()=>j(new _e({expected:"a valid time zone"},e,t)),onSome:v}),encode:e=>v(xd(e))}),GY=yn({decode:(e,t)=>Tn(hd(e),{onNone:()=>j(new _e({expected:"a valid UTC DateTime string"},e,t)),onSome:n=>v(gd(n))}),encode:e=>v(bb(e))}),JY=yn({decode:(e,t)=>Tn(yb(e),{onNone:()=>j(new _e({expected:"a valid Zoned DateTime string"},e,t)),onSome:v}),encode:e=>v(sx(e))}),KY=-864e13,VY=864e13,TMe=KY+840*60*1e3,vMe=VY-840*60*1e3,kMe=-720*60*1e3,CMe=840*60*1e3,ZY=["UTC","Europe/London","America/New_York","Asia/Tokyo","Australia/Sydney"];function QY(e,t,n){let r=Math.max(t,e?.minimum===void 0?t:e.minimum.epochMilliseconds+(e.exclusiveMinimum===!0?1:0)),o=Math.min(n,e?.maximum===void 0?n:e.maximum.epochMilliseconds-(e.exclusiveMaximum===!0?1:0));return r<=o?[r,o]:[t,n]}function oB(e,t){return Do.check(qs({minimum:e,maximum:t}))}function YY(){return Et([oB(kMe,CMe),fo(ZY)])}var ry=qt(e=>fk(e)&&yF(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})=>{let[t,n]=QY(e,KY,VY);return Bd()(oB(t,n),Se(bF))},toCodecJson:()=>Ht()(ae,GY),toFormatter:()=>e=>e.toString()}),AMe=Ti.pipe(ve(ry,{decode:jY(),encode:Se(TF)})),MMe=ae.annotate({expected:"a string that will be decoded as a DateTime.Utc"}).pipe(ve(ry,GY)),OMe=Do.pipe(ve(ry,{decode:jY(),encode:Se(vF)})),sB=qt(gF,{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:()=>Ht()(Do,wMe),toFormatter:()=>e=>xd(e)}),XY=ae.annotate({expected:"an IANA time zone identifier"}),EA=qt(xF,{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:()=>Bd()(fo(ZY),Se(lk)),toCodecJson:()=>Ht()(XY,qY),toFormatter:()=>e=>xd(e)}),RMe=XY.pipe(ve(EA,qY)),e7=ae.annotate({expected:"a time zone string (IANA identifier or offset like +03:00)"}),bA=qt(hF,{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:()=>Bd()(YY(),Se(e=>typeof e=="number"?Tm(e):lk(e))),toCodecJson:()=>Ht()(e7,WY),toFormatter:()=>e=>xd(e)}),_Me=e7.pipe(ve(bA,WY)),t7=ae.annotate({expected:"a zoned DateTime string (e.g. 2024-01-01T00:00:00.000+00:00[Europe/London])"}),IA=qt(e=>fk(e)&&SF(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})=>{let[t,n]=QY(e,TMe,vMe);return Bd()(oe({epochMilliseconds:oB(t,n),timeZone:YY()}),Se(({epochMilliseconds:r,timeZone:o})=>IF(r,{timeZone:o})))},toCodecJson:()=>Ht()(t7,JY),toFormatter:()=>e=>sx(e),toEquivalence:()=>EF}),NMe=t7.pipe(ve(IA,JY)),vi=(e,t,n,r)=>ae.pipe(ve(e,yn({decode:(o,s)=>{let i=t(o);return Ne(i)?v(i.success):j(new _e({message:i.failure.message},o,s))},encode:o=>v(n(o))}))).annotate({identifier:r}),oh=qt(qx,{identifier:"MacAddress"}),oy=vi(oh,T9,bL,"MacAddressFromString"),KI=qt(No,{identifier:"Ipv4Address"}),iB=vi(KI,Xm,Po,"Ipv4AddressFromString"),wA=qt(Wa,{identifier:"Ipv6Address"}),n7=vi(wA,eh,Po,"Ipv6AddressFromString"),qd=qt(xL,{identifier:"IpAddress"}),sh=vi(qd,Ud,Po,"IpAddressFromString"),Bn=(e,t,n,r)=>EY(t,{expected:n})(e).annotate({identifier:r}),PMe=Bn(qd,Wx,"a multicast address","IpMulticastAddress"),FMe=Bn(sh,Wx,"a multicast address","IpMulticastAddressFromString"),UMe=Bn(oh,Wx,"a multicast address","MacMulticastAddress"),DMe=Bn(oy,Wx,"a multicast address","MacMulticastAddressFromString"),LMe=Bn(qd,vL,"a unicast address","IpUnicastAddress"),$Me=Bn(sh,vL,"a unicast address","IpUnicastAddressFromString"),BMe=Bn(oh,VC,"a unicast address","MacUnicastAddress"),HMe=Bn(oy,VC,"a unicast address","MacUnicastAddressFromString"),zMe=Bn(KI,QC,"a broadcast address","Ipv4BroadcastAddress"),jMe=Bn(iB,QC,"a broadcast address","Ipv4BroadcastAddressFromString"),qMe=Bn(oh,KC,"a broadcast address","MacBroadcastAddress"),WMe=Bn(oy,KC,"a broadcast address","MacBroadcastAddressFromString"),GMe=Bn(qd,TL,"a loopback address","IpLoopbackAddress"),JMe=Bn(sh,TL,"a loopback address","IpLoopbackAddressFromString"),KMe=Bn(qd,kL,"a link-local address","IpLinkLocalAddress"),VMe=Bn(sh,kL,"a link-local address","IpLinkLocalAddressFromString"),ZMe=Bn(qd,ZC,"an unspecified address","IpUnspecifiedAddress"),QMe=Bn(sh,ZC,"an unspecified address","IpUnspecifiedAddressFromString"),YMe=Bn(KI,CL,"a private address","Ipv4PrivateAddress"),XMe=Bn(iB,CL,"a private address","Ipv4PrivateAddressFromString"),eOe=Bn(wA,AL,"a unique-local address","Ipv6UniqueLocalAddress"),tOe=Bn(n7,AL,"a unique-local address","Ipv6UniqueLocalAddressFromString"),nOe=Bn(oh,IL,"a locally administered address","MacLocallyAdministeredAddress"),rOe=Bn(oy,IL,"a locally administered address","MacLocallyAdministeredAddressFromString"),oOe=Bn(oh,wL,"a universally administered address","MacUniversallyAdministeredAddress"),sOe=Bn(oy,wL,"a universally administered address","MacUniversallyAdministeredAddressFromString"),r7=qt(U9,{identifier:"Ipv4Interface"}),iOe=vi(r7,tA,NI,"Ipv4InterfaceFromString"),o7=qt(D9,{identifier:"Ipv6Interface"}),aOe=vi(o7,nA,NI,"Ipv6InterfaceFromString"),s7=qt(RI,{identifier:"IpInterface"}),cOe=vi(s7,rA,NI,"IpInterfaceFromString"),i7=qt($9,{identifier:"Ipv4Network"}),uOe=vi(i7,H9,FI,"Ipv4NetworkFromString"),a7=qt(B9,{identifier:"Ipv6Network"}),fOe=vi(a7,z9,FI,"Ipv6NetworkFromString"),c7=qt(PI,{identifier:"IpNetwork"}),lOe=vi(c7,j9,FI,"IpNetworkFromString"),dOe=qt(kI,{identifier:"InetAddressV4"}),pOe=qt(CI,{identifier:"InetAddressV6"}),u7=qt(yL,{identifier:"InetAddress"}),mOe=vi(u7,ML,YC,"InetAddressFromString"),f7=qt(GC,{identifier:"UnixPathAddress"}),hOe=ae.pipe(ve(f7,$t({decode:k9,encode:e=>e.path}))).annotate({identifier:"UnixPathAddressFromString"}),gOe=qt(I9,{identifier:"SocketAddress"}),al=ae.check(zt(rl,{expected:"a normalized domain name"})).pipe(lA("~effect/net/Host/DomainName")).annotate({identifier:"DomainName"}),l7=vi(al,XC,e=>e,"DomainNameFromString"),aB=ae.check(zt(SL,{expected:"a canonical scoped IPv6 literal"})).pipe(lA("~effect/net/NetAddress/ScopedIpv6Literal")).annotate({identifier:"ScopedIpv6Literal"}),d7=vi(aB,AI,e=>e,"ScopedIpv6LiteralFromString"),xOe=Et([qd,aB,al]).annotate({identifier:"Host"}),yOe=Et([sh,d7,l7]).annotate({identifier:"HostFromString"}),p7=qt(_L,{identifier:"HostPort"}),SOe=vi(p7,A9,NL,"HostPortFromString"),EOe=Do.check(qs({minimum:0,maximum:65535},{expected:"a port number"})),bOe=yn({decode:(e,t)=>Tn(_S(e),{onNone:()=>j(new _e({expected:"a valid Duration string"},e,t)),onSome:v}),encode:e=>v(globalThis.String(e))}),IOe=yn({decode:e=>v(Rs(e)),encode:(e,t)=>Tn(NS(e),{onNone:()=>j(new _e({expected:"a Duration representable as a bigint"},e,t)),onSome:n=>v(n)})}),wOe=$t({decode:e=>br(e),encode:e=>ht(e)}),ih=qt(ug,{representation:{id:"effect/schema/Duration",payload:null},toCode:()=>({runtime:"Schema.Duration",Type:"Duration.Duration",importDeclarations:['import * as Duration from "effect/Duration"']}),expected:"Duration",toCodecJson:()=>Ht()(Et([oe({_tag:an("Infinity")}),oe({_tag:an("NegativeInfinity")}),oe({_tag:an("Nanos"),value:Ts}),oe({_tag:an("Millis"),value:Do})]),$t({decode:e=>{switch(e._tag){case"Infinity":return fr;case"NegativeInfinity":return ms;case"Nanos":return Rs(e.value);case"Millis":return br(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}}}}))}),TOe=ae.annotate({expected:"a string that will be decoded as a Duration"}),cB=TOe.pipe(ve(ih,bOe)),vOe=Ts.pipe(ve(ih,IOe)),kOe=Qc.pipe(ve(ih,wOe)),COe=fo(UL),m7=(e,t)=>ae.pipe(ve(e,yn({decode:(n,r)=>{let o=t(n);return le(o)?j(new _e({message:o.failure.message},n,r)):Po(o.success)===n?v(o.success):j(new _e({message:"expected a canonical address"},n,r))},encode:n=>v(Po(n))}))),jL=Do.check(qs({minimum:0,maximum:255})),Jx=Do.check(qs({minimum:0,maximum:65535})),h7=Do.check(qs({minimum:0,maximum:4294967295})),oA=h7.pipe(ve(ih,$t({decode:fg,encode:gc}))),Ga=(e,t)=>qt(n=>DL(n)&&n._tag===e,{identifier:`Dns${e.charAt(0)}${e.slice(1).toLowerCase()}Record`,toCodecJson:()=>{let n=HI(e,t);return Ht()(n,yn({decode:(r,o)=>{let{_tag:s,...i}=r,a=N9(e,i);return Ne(a)?v(a.success):j(new _e({message:a.failure.message},r,o))},encode:r=>v({...r})}))}}),g7=Ga("A",{address:m7(KI,Xm)}),x7=Ga("AAAA",{address:m7(wA,eh)}),y7=Ga("CAA",{critical:Vr,tag:ae.check(ta(/^[a-z0-9]+$/i)),value:ae}),S7=Ga("CNAME",{target:al}),E7=Ga("MX",{exchange:al,priority:Jx}),b7=Ga("NAPTR",{order:Jx,preference:Jx,flags:ae,service:ae,regexp:ae,replacement:al}),I7=Ga("NS",{host:al}),w7=Ga("PTR",{host:zd}),T7=Ga("SOA",{primary:al,admin:zd,serial:h7,refresh:oA,retry:oA,expire:oA,minimum:oA}),v7=Ga("SRV",{target:al,port:Jx,priority:Jx,weight:Jx}),k7=Ga("TLSA",{certUsage:jL,selector:jL,matchingType:jL,data:$Y}),C7=Ga("TXT",{chunks:Wu(ae)}),AOe=Et([g7,x7,y7,S7,E7,b7,I7,w7,T7,v7,k7,C7]).annotate({identifier:"DnsRecord"});function uB(e,t,n){let r=Ii()([e,t,n],([o,s,i])=>{let a=$I(s,i);return(c,f,l)=>{if(!yE(c))return j(new or(f,c,l));switch(c._tag){case"Success":return Oo(Pn(o)(c.value,l),{onSuccess:Jo,onFailure:d=>Hs(f,"value",d,c,l)});case"Failure":return Oo(Pn(a)(c.cause,l),{onSuccess:Lr,onFailure:d=>Hs(f,"cause",d,c,l)})}}},{representation:{id:"effect/schema/Exit",payload:null},toCode:({typeParameters:o})=>({runtime:`Schema.Exit(${o[0].runtime}, ${o[1].runtime}, ${o[2].runtime})`,Type:`Exit.Exit<${o[0].Type}, ${o[1].Type}, ${o[2].Type}>`,importDeclarations:['import * as Exit from "effect/Exit"']}),expected:"Exit",toCodec:([o,s,i])=>Ht()(Et([oe({_tag:an("Success"),value:o}),oe({_tag:an("Failure"),cause:$I(s,i)})]),$t({decode:a=>a._tag==="Success"?Jo(a.value):Lr(a.cause),encode:a=>Dt(a)?{_tag:"Success",value:a.value}:{_tag:"Failure",cause:a.cause}}))});return Ie(r.ast,{value:e,error:t,defect:n})}function X9(e,t,n){return oe({type:an(e),nodes:st(oe({index:sr,data:t})),edges:st(oe({index:sr,source:sr,target:sr,data:n}))})}function eY(e,t){let n=-1,r=new Set;for(let o=0;o{let o=_b(n),s=_b(r);if(o.type!==s.type||o.nodes.length!==s.nodes.length||o.edges.length!==s.edges.length)return!1;for(let i=0;i{if(r===null)return hx({type:e,nodes:[],edges:[]});let o=r.nodes.map((s,i)=>({index:i,data:s}));return hx({type:e,nodes:o,edges:r.edges.map(([s,i,a],c)=>({index:c,source:s%o.length,target:i%o.length,data:a}))})}))}function fB(e,t,n){let r=Ii()([t,n],([o,s])=>{let i=X9(e,o,s);return(a,c,f)=>!Ob(a)||a.mutable||a.type!==e?j(new or(c,a,f)):O(Pn(i)(_b(a),f),l=>eY(l,f))},{representation:{id:"effect/schema/Graph",payload:e},toCode:({typeParameters:o})=>({runtime:`Schema.Graph(${V(e)}, ${o[0].runtime}, ${o[1].runtime})`,Type:`Graph.Graph<${o[0].Type}, ${o[1].Type}, ${V(e)}>`,importDeclarations:['import * as Graph from "effect/Graph"']}),expected:`an immutable ${e} Graph`,toCodec:([o,s])=>Ht()(X9(e,o,s),yn({decode:eY,encode:(i,a)=>MOe(i,e,a)})),toCodecArbitrary:({typeParameters:[o,s]})=>ROe(e,o,s),toEquivalence:([o,s])=>OOe(o,s)});return Ie(r.ast,{type:e,node:t,edge:n})}function tY(e){return Ht()(e,$t({decode:fx,encode:Lu}))}function lB(e,t){let n=Ii()([e,t],([r,o])=>{let s=st(Fo([r,o]));return(i,a,c)=>$F(i)?Oo(Pn(s)(Lu(i),c),{onSuccess:fx,onFailure:f=>Hs(a,"entries",f,i,c)}):j(new or(a,i,c))},{representation:{id:"effect/schema/HashMap",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.HashMap(${r[0].runtime}, ${r[1].runtime})`,Type:`HashMap.HashMap<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as HashMap from "effect/HashMap"']}),expected:"HashMap",toCodec:([r,o])=>tY(st(Fo([r,o]))),toCodecArbitrary:({constraint:r,typeParameters:[o,s]})=>tY($d(st(Fo([o,s])).check(ey()),r?.minSize,r?.maxSize)),toEquivalence:([r,o])=>tS(r,o)});return Ie(n.ast,{key:e,value:t})}function nY(e){return Ht()(e,$t({decode:px,encode:ue}))}function dB(e){let t=Ii()([e],([n])=>{let r=st(n);return(o,s,i)=>cU(o)?Oo(Pn(r)(ue(o),i),{onSuccess:px,onFailure:a=>Hs(s,"values",a,o,i)}):j(new or(s,o,i))},{representation:{id:"effect/schema/HashSet",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.HashSet(${n[0].runtime})`,Type:`HashSet.HashSet<${n[0].Type}>`}),expected:"HashSet",toCodec:([n])=>nY(st(n)),toCodecArbitrary:({constraint:n,typeParameters:[r]})=>nY($d(st(r).check(rh()),n?.minSize,n?.maxSize)),toEquivalence:([n])=>jh(n)});return Ie(t.ast,{value:e})}function cl(e){let t=Ii()([e],([n])=>(r,o,s)=>Xh(r)?Y(r)?Aa:Oo(Pn(n)(r.value,s),{onSuccess:N,onFailure:i=>Hs(o,"value",i,r,s)}):j(new or(o,r,s)),{representation:{id:"effect/schema/Option",payload:null},toCode:({typeParameters:n})=>({runtime:`Schema.Option(${n[0].runtime})`,Type:`Option.Option<${n[0].Type}>`,importDeclarations:['import * as Option from "effect/Option"']}),expected:"Option",toCodec:([n])=>Ht()(Et([oe({_tag:an("Some"),value:n}),oe({_tag:an("None")})]),$t({decode:r=>r._tag==="None"?R():N(r.value),encode:r=>ie(r)?{_tag:"Some",value:r.value}:{_tag:"None"}}))});return Ie(t.ast,{value:e})}function _Oe(e){return a$(e).pipe(ve(cl(wi(e)),PD()))}function NOe(e){return fA(e).pipe(ve(cl(wi(e)),FD()))}function POe(e,t){return SY(e).pipe(ve(cl(wi(e)),UD(t)))}var A7=qt(jZ,{representation:{id:"effect/http/Cookie",payload:null},toCode:()=>({runtime:"Schema.Cookie",Type:"Cookies.Cookie",importDeclarations:['import * as Cookies from "effect/http/Cookies"']}),expected:"Cookie"}),M7=qt(zZ,{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:()=>Ht()(st(ae),$t({decode:qZ,encode:VZ})),toCodecIso:()=>Ht()(vs(ae,A7),$t({decode:vU,encode:e=>e.cookies}))}),FOe=M7.pipe(ve(vs(ae,ae),$t({decode:KZ,encode:e=>kU(globalThis.Object.entries(e).map(([t,n])=>JZ(t,n)))}))),UOe=qt(YZ,{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:()=>OU,toCodec:()=>Ht()(vs(ae,ae),$t({decode:XZ,encode:e=>({...e})}))}),pB=qt(_U,{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:()=>NU,toCodec:()=>Ht()(st(Fo([ae,ae])),$t({decode:Ik,encode:e=>e.params.map(([t,n])=>[t,Mb(n)])}))}),DOe=(e,t)=>pB.pipe(ve(nB(sl,t),yn({decode:n=>Tn(i8(n,e),{onNone:()=>j(new rr([e],new Hu(void 0))),onSome:v}),encode:n=>v(Ik([[e,n]]))}))),LOe=pB.pipe(ve(vs(ae,Et([ae,Wu(ae)])),$t({decode:a8,encode:o8})));function $Oe(e){return bi(e).pipe(ve(cl(wi(e)),DD()))}function BOe(e){return Uo(e).pipe(ve(cl(wi(e)),LD()))}function HOe(e,t){let n=t===void 0?"omit":t.onNoneEncoding,r=n===null?null:void 0;return Uo(a$(e)).pipe(ve(cl(wi(e)),Zb({decode:o=>o.pipe(Ni(Yy),N),encode:n==="omit"?vp:o=>N(pc(vp(o),()=>r))})))}function sy(e,t){let n=typeof t?.label=="string"?t.label:void 0,r=t?.disallowJsonEncode===!0,o=n!==void 0?r?{label:n,disallowJsonEncode:!0}:{label:n}:r?{disallowJsonEncode:!0}:void 0,s=n!==void 0?Pn(an(n)):void 0,i=Ii()([e],([a])=>(c,f,l)=>{if(Nm(c)){let d=s!==void 0?cb(s(c.label,l),p=>new rr(["label"],p)):J;return At(d,()=>Oo(Pn(a)(Qf(c),l),{onSuccess:p=>$u(p,{label:c.label}),onFailure:()=>new kr(f,[new rr(["value"],new _e(void 0,c,l))],c,l)}))}return j(new or(f,c,l))},{representation:{id:"effect/schema/Redacted",payload:o??null},toCode:({typeParameters:a})=>({runtime:o!==void 0?`Schema.Redacted(${a[0].runtime}, ${V(o)})`:`Schema.Redacted(${a[0].runtime})`,Type:`Redacted.Redacted<${a[0].Type}>`,importDeclarations:['import * as Redacted from "effect/Redacted"']}),expected:"Redacted",toCodecJson:([a])=>Ht()(a,{decode:Se(c=>$u(c,{label:n})),encode:r?zb(c=>"Cannot serialize Redacted"+(ie(c)&&typeof c.value.label=="string"?` with label: "${c.value.label}"`:"")):Se(Qf)}),toEquivalence:([a])=>CU(a)});return Ie(i.ast,{value:e})}function zOe(e,t){return ve(sy(wi(e),{label:t?.label,disallowJsonEncode:t?.disallowEncode}),{decode:Se(n=>$u(n,{label:t?.label})),encode:t?.disallowEncode?zb(n=>"Cannot encode Redacted"+(ie(n)&&typeof n.value.label=="string"?` with label: "${n.value.label}"`:"")):Se(Qf)})(e)}function mB(e,t){let n=Ii()([e,t],([r,o])=>(s,i,a)=>{if(!Al(s))return j(new or(i,s,a));switch(s._tag){case"Success":return Oo(fI(r)(s.success,a),{onSuccess:G,onFailure:c=>Hs(i,"success",c,s,a)});case"Failure":return Oo(fI(o)(s.failure,a),{onSuccess:Z,onFailure:c=>Hs(i,"failure",c,s,a)})}},{representation:{id:"effect/schema/Result",payload:null},toCode:({typeParameters:r})=>({runtime:`Schema.Result(${r[0].runtime}, ${r[1].runtime})`,Type:`Result.Result<${r[0].Type}, ${r[1].Type}>`,importDeclarations:['import * as Result from "effect/Result"']}),expected:"Result",toCodec:([r,o])=>Ht()(Et([oe({_tag:an("Success"),success:r}),oe({_tag:an("Failure"),failure:o})]),$t({decode:s=>s._tag==="Success"?G(s.success):Z(s.failure),encode:s=>Ne(s)?{_tag:"Success",success:s.success}:{_tag:"Failure",failure:s.failure}}))});return Ie(n.ast,{success:e,failure:t})}var jOe=globalThis.Symbol.for("immer-draftable"),GL={};function hB(e,t,n,r,o){let s=WOe(n,t,r),i=O7(t),a=class extends e{constructor(...[c,f]){let d=f?.["~payload"],p=d?.token===GL?d.value:n.make(c??{},f);super(p,{...f,disableChecks:!0,"~payload":{token:GL,value:p}})}static[UI]=UI;get[i](){return i}static[jOe]=!0;static identifier=t;static fields=n.fields;static get ast(){return s(this).ast}static pipe(){return re(this,arguments)}static rebuild(c){return s(this).rebuild(c)}static make(c,f){return uI(s(this))(c??{},f)}static makeOption(c,f){return cI(s(this))(c??{},f)}static makeEffect(c,f){return s(this).makeEffect(c??{},f)}static annotate(c){return this.rebuild(Ha(this.ast,c))}static annotateKey(c){return this.rebuild(Cx(this.ast,c))}static check(...c){return this.rebuild(qc(this.ast,c))}static extend(c){return(f,l)=>{let d=VI(f)?f:oe(f),p={...n.fields,...d.fields},m=tI(p,n.ast.checks,{identifier:c});return hB(this,c,o$(qc(m,d.ast.checks),p),l,o)}}static mapFields(c,f){return n.mapFields(c,f)}};return o!==void 0&&Object.assign(a.prototype,o(t)),a}function qOe(e){return new pt(Se(t=>new e(t,{"~payload":{token:GL,value:t}})),Cr())}function O7(e){return`~effect/Schema/Class/${e}`}function WOe(e,t,n){let r;return o=>{if(r!==void 0)return r;let s=O7(t),i=f=>f instanceof o||P(f,s),a=qOe(o),c=Ie(new Wm([e.ast],()=>(f,l,d)=>i(f)?v(f):j(new or(l,f,d)),{identifier:t,[Tk]:([f])=>({isConstructed:i,link:new Kn(f,a)}),toCodec:([f])=>new Kn(f.ast,a),toEquivalence:([f])=>f,toFormatter:([f])=>l=>`${o.identifier}(${f(l)})`,[Nb]:zm(e.ast),...n}));return r=ve(c,a)(e)}}function VI(e){return uA(e)}var R7=e=>(t,n)=>{let r=VI(t)?t:oe(t);return hB(Qw,e,r,n,o=>({toString(){return`${o}(${V({...this})})`}}))},GOe=e=>(t,n,r)=>{let o=VI(n)?n.mapFields(s=>({_tag:$n(t),...s}),{unsafePreserveChecks:!0}):HI(t,n);return R7(e??t)(o,r)},iy=e=>(t,n)=>{let r=VI(t)?t:oe(t);return hB(fS,e,r,n,s=>({name:s}))},JOe=e=>(t,n,r)=>{let o=VI(n)?n.mapFields(s=>({_tag:$n(t),...s}),{unsafePreserveChecks:!0}):HI(t,n);return iy(e??t)(o,r)};function KOe(e){return t=>t.annotate({toFormatter:e})}function VOe(e,t){return m9(e.ast,t)}function ZOe(e){return t=>t.annotate({toEquivalence:e})}function QOe(e){return fL(e.ast)}function YOe(e,t){return Zm(e.ast,t)}function XOe(e,t){let n=Zm(Fx(e.ast),t);return Dx(n,t)}var TA=Px,eRe=NC,ZI=PC,tRe=GQ;function nRe(e,t){return u9(e,t)}function rRe(e){return y9(e)}function oRe(e){return S9(e)}function sRe(e){return E9(e)}function iRe(e,t){return n=>Ie(Ha(n.ast,{toCodecIso:()=>new Kn(e.ast,Vb(t))}),{schema:n})}function aRe(e){return c9(e)}function cRe(e){let t=Yc(()=>n),n=Et([e,st(t),vs(ae,t)]);return n}var Gu=Ie(Ha(jm,{toCode:()=>({runtime:"Schema.Json",Type:"Schema.Json"})})),gB=vs(ae,Gu),uRe=oe({message:ae,name:bi(ae),stack:bi(ae),cause:bi(Gu)}),xB=Ie(Ha(M2,{toCode:()=>({runtime:"Schema.MutableJson",Type:"Schema.MutableJson"})}));function fRe(e){return Bu(e.ast)}function lRe(e){return e.ast.context?.annotations}var Ws=BigInt(0),Xc=BigInt(1),ah=BigInt(10),dRe=425,kA=4096,pRe=[-512,-256,-128,-64,-32,-16,-8,-4,-2,-1,0,1,2,4,8,16,32,64,128,256,512],ay=co;function yB(e,t){if(t.minimum!==void 0){let n=ay(e,t.minimum);if(n<0||n===0&&t.exclusiveMinimum===!0)return!1}if(t.maximum!==void 0){let n=ay(e,t.maximum);if(n>0||n===0&&t.exclusiveMaximum===!0)return!1}return!0}function CA(e,t,n=Number.MAX_SAFE_INTEGER){return Math.min(n,e+t)}function _7(e,t,n){return e===void 0||t!==!0?e:e.scale=Ws)return o>BigInt(r)?void 0:e.value*ah**o;let s=-o>=BigInt(SB(e.value))?void 0:ah**-o,i=s===void 0?Ws:e.value/s,a=s===void 0?e.value:e.value%s;return i+(n&&a>Ws?Xc:!n&&aWs)&&!(s===void 0&&r!==void 0&&r.values?void 0:[o,s]}function mRe(e,t){let[n,r]=t;if(n!==void 0&&r!==void 0)return ex(e,n,r);let s=Zt(e,0,3)!==0?Zt(e,0,20):Zt(e,1,dRe),i=s===0?Ws:Xc<BigInt(kA)))return e.value*ah**n}function gRe(e,t,n){let r=CA(Math.max(e.scale,t.scale),1,n),o=EB(e,r),s=EB(t,r);if(o===void 0||s===void 0)return;let i=o+(s-o)/BigInt(2);return i===o||i===s?void 0:Je(i,r)}function P7(e,t,n,r=CA(Math.max(e.scale,t.scale),128)){return _u(e,()=>{let o=n?.[0]??t,s=ay(e,o);if(s===0)return;let i;if(n!==void 0){let l=ym(n[0]),d=CA(l.scale,Math.min(n[1]+1,128),r),p=EB(l,d);p!==void 0&&(i=Je(p+BigInt(s),d))}let a=(n===void 0?pRe.map(l=>Je(BigInt(s),-l)):[i]).filter(l=>l!==void 0&&l.scale<=r&&ay(l,o)===s&&ay(l,e)===-s);n===void 0&&a.unshift(t);let c=n,f=0;return B(()=>{let l=f0,()=>Mt(l))}let t=Je(Ws,0),n=_7(e.minimum,e.exclusiveMinimum,1),r=_7(e.maximum,e.exclusiveMaximum,-1),o=[t,n,r].find(l=>l!==void 0&&yB(l,e));if(o===void 0)return;let s=o.valueyB(l,e)),a=n===void 0?r?.scale:r===void 0?n.scale:Math.max(n.scale,r.scale),c=a===void 0?void 0:N7(a,e),f=c?.[0]!==void 0&&c[1]!==void 0?lb(c[0],c[1]):void 0;return Tr([],()=>0,l=>{let d;if(Zt(l,0,7)===0)d=i[$s(l,i.length)];else if(f!==void 0&&Zt(l,0,3)!==0)d=Je(f(l),a);else{d=o;for(let p=0;p<16;p++){let m=hRe(l,a),g=N7(m,e);if(g===void 0)continue;let b=mRe(l,g);if(Zt(l,0,7)===0&&m=t)&&(n===void 0||e<=n)}function AA(e){return e===lo?0:(e[i,-i])].filter(i=>ERe(i,e,t)),r=e??t,o=e===void 0?-Hr:Hr,s=r!==void 0&&r*o<=lo?-r*o:void 0;return i=>{if(Zt(i,0,7)===0)return n[$s(i,n.length)];if(r!==void 0&&(r*o>lo||ud(i)))return r+o*U7(i);let a=ud(i)?Hr:-Hr;return a*U7(i,a===-o?s:void 0)}}function IB(e,t,n){return _u(e,()=>{let r=n??t,o=e-r;if(o===lo)return;if(n!==void 0&&(o===Hr||o===-Hr))return Ru([IB(n,t)]);let s=o>lo?Hr:-Hr,i=new Set(n===void 0?[t]:[]),a=d=>{(d-r)*s>lo&&(e-d)*s>lo&&i.add(d)};if(n===void 0){for(let p of D7)a(t+s*p);let d=AA(o);for(let p=1;p1&&(n===lo||n>lo==e>lo)){let m=Math.floor((d+p)/2);a(s*((Hr<dp?Number(s):0),l=n;return F(Ru(f),d=>{let p=IB(d,t,l);return l=d,p})})}function L7(e,t){let n=bRe(e,t),r=e!==void 0&&e>lo?e:t!==void 0&&t0,o=>{let s=n(o);return o.shrinks?IB(s,r):Mt(s)})}var vB={_tag:"Literal",value:""},RA=1114111,YI=55296,_A=57343,$7=[{minimum:48,maximum:57}],B7=[{minimum:48,maximum:57},{minimum:65,maximum:90},{minimum:95,maximum:95},{minimum:97,maximum:122}],H7=[{minimum:9,maximum:13},{minimum:32,maximum:32},{minimum:160,maximum:160},{minimum:5760,maximum:5760},{minimum:8192,maximum:8202},{minimum:8232,maximum:8233},{minimum:8239,maximum:8239},{minimum:8287,maximum:8287},{minimum:12288,maximum:12288},{minimum:65279,maximum:65279}],wRe=[{minimum:10,maximum:10},{minimum:13,maximum:13},{minimum:8232,maximum:8233}],TRe=[{minimum:0,maximum:RA}],vRe=[{minimum:32,maximum:126}],kRe=[...globalThis.Array.from({length:95},(e,t)=>t+32),9,10,11,12,13,0,128,233,937,128512];function z7(e,t){return{preferred:kRe.filter(n=>ORe(n)===t&&ARe(n,e)),count:e.reduce((n,r)=>n+XI(r,t),0)}}function Ku(e){let t=CB(e),n=z7(t,1),r=z7(t,2);return{_tag:"Character",intervals:t,preferred:[n.preferred,r.preferred],counts:[n.count,r.count]}}function na(e){return e.length===0?vB:{_tag:"Literal",value:e}}function kB(e){let t=[],n="",r=()=>{n.length!==0&&(t.push(na(n)),n="")};for(let o of e)o._tag==="Literal"?n+=o.value:o._tag==="Concatenation"?(r(),t.push(...o.nodes)):(r(),t.push(o));return r(),t.length===0?vB:t.length===1?t[0]:{_tag:"Concatenation",nodes:t}}function G7(e){let t=[];for(let n of e)n._tag==="Alternation"?t.push(...n.nodes):t.push(n);return t.length===1?t[0]:{_tag:"Alternation",nodes:t}}function CB(e){if(e.length<=1)return e;let t=e.slice().sort((r,o)=>r.minimum-o.minimum||r.maximum-o.maximum),n=[];for(let r of t){let o=n[n.length-1];o===void 0||r.minimum>o.maximum+1?n.push(r):r.maximum>o.maximum&&(n[n.length-1]={minimum:o.minimum,maximum:r.maximum})}return n}function CRe(e,t){return e.flatMap(n=>n.minimum>t?[]:[{minimum:n.minimum,maximum:Math.min(n.maximum,t)}])}function MA(e,t){switch(e._tag){case"Character":return Ku(CRe(e.intervals,t));case"Concatenation":return kB(e.nodes.map(n=>MA(n,t)));case"Alternation":return G7(e.nodes.map(n=>MA(n,t)));case"Repetition":return{...e,node:MA(e.node,t)};case"Literal":return e}}function QI(e){let t=CB(e),n=[],r=0;for(let o of t)r=YI&&e<=_A}function ORe(e){return e>65535?2:1}function XI(e,t){let n=t===1?e.minimum:Math.max(e.minimum,65536),r=t===1?Math.min(e.maximum,65535):e.maximum;return n>r?0:t===1&&n<=_A&&r>=YI?r-n+1-(Math.min(r,_A)-Math.max(n,YI)+1):r-n+1}function J7(e,t,n){let r=(t===1?e.minimum:Math.max(e.minimum,65536))+n;return t===1&&r>=YI&&(r+=_A-YI+1),r}function RRe(e,t,n){let r=e.preferred[t-1];if(r.length>0&&Zt(n,1,n.biasFactor)===1)return globalThis.String.fromCodePoint(r[$s(n,r.length)]);let o=e.counts[t-1];if(o===0)return;let s=Zt(n,0,o-1);for(let i of e.intervals){let a=XI(i,t);if(s0)return globalThis.String.fromCodePoint(J7(r,t,0))}function wB(e){return e!==void 0&&e>="0"&&e<="9"}function j7(e){return e!==void 0&&(e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F")}var TB=class{index=0;supported=!0;source;dotAll;constructor(t,n){this.source=t,this.dotAll=n}parse(){let t=this.parseAlternation();return this.supported&&this.index===this.source.length?t:void 0}parseAlternation(){let t=[this.parseConcatenation()];for(;this.peek()==="|";)this.index++,t.push(this.parseConcatenation());return G7(t)}parseConcatenation(){let t=[];for(;this.index";)this.index++;if(this.peek()!==">")return;this.index++}else return;let t=this.parseAlternation();if(this.peek()===")")return this.index++,t}parseQuantifier(t){let n=this.index,r,o;switch(this.peek()){case"*":r=0,this.index++;break;case"+":r=1,this.index++;break;case"?":r=0,o=1,this.index++;break;case"{":{this.index++;let s=this.parseNatural();if(s===void 0)return this.index=n,t;if(r=s,this.peek()==="}")o=s,this.index++;else if(this.peek()===","){if(this.index++,o=this.parseNatural(),this.peek()!=="}")return this.index=n,t;this.index++}else return this.index=n,t;break}default:return t}return this.peek()==="?"&&this.index++,{_tag:"Repetition",node:t,minimum:r,maximum:o}}parseNatural(){let t=this.index;for(;wB(this.peek());)this.index++;if(t===this.index)return;let n=globalThis.Number(this.source.slice(t,this.index));return Number.isSafeInteger(n)?n:void 0}parseCharacterClass(){let t=this.peek()==="^";t&&this.index++;let n=[],r=!0;for(;this.indexi[0].minimum)return;n.push({minimum:s[0].minimum,maximum:i[0].minimum})}else n.push(...s)}if(this.peek()!=="]")return;this.index++;let o=CB(n);return Ku(t?QI(o):o)}parseClassAtom(){let t=this.source[this.index++];if(t==="\\"){let r=this.parseEscape(!0);return r?._tag==="Character"?r.intervals:r?._tag==="Literal"?this.literalIntervals(r.value):void 0}if(t===void 0)return;let n=t.codePointAt(0);return[{minimum:n,maximum:n}]}parseEscape(t){let n=this.source[this.index++];switch(n){case"d":return Ku($7);case"D":return Ku(QI($7));case"w":return Ku(B7);case"W":return Ku(QI(B7));case"s":return Ku(H7);case"S":return Ku(QI(H7));case"b":return t?na("\b"):void 0;case"B":return;case"n":return na(`
+`);case"r":return na("\r");case"t":return na(" ");case"v":return na("\v");case"f":return na("\f");case"0":return wB(this.peek())?void 0:na("\0");case"c":{let r=this.source[this.index++];return r===void 0||!/[A-Za-z]/.test(r)?void 0:na(globalThis.String.fromCharCode(r.toUpperCase().charCodeAt(0)%32))}case"x":return this.parseCodePoint(2);case"u":if(this.peek()==="{"){this.index++;let r=this.index;for(;j7(this.peek());)this.index++;if(r===this.index||this.peek()!=="}")return;let o=Number.parseInt(this.source.slice(r,this.index),16);return this.index++,o<=RA&&!MRe(o)?na(globalThis.String.fromCodePoint(o)):void 0}return this.parseCodePoint(4);case"p":case"P":case"k":return;case void 0:return;default:return wB(n)?void 0:na(n)}}parseCodePoint(t){let n=this.source.slice(this.index,this.index+t);if(!(n.length!==t||![...n].every(j7)))return this.index+=t,na(globalThis.String.fromCharCode(Number.parseInt(n,16)))}literalIntervals(t){let n=[...t];if(n.length!==1)return;let r=n[0].codePointAt(0);return[{minimum:r,maximum:r}]}peek(){return this.source[this.index]}};function ul(e){return globalThis.Array(e+1).fill(!1)}function NA(e,t,n){let r=ul(n);for(let o=0;o<=n&&on?0:Math.floor(n/s),a=o?0:e.minimum,c=Math.min(e.maximum??i,i);if(a>c)return r;let f=ul(n);f[0]=!0;for(let l=0;l<=c;l++){if(l>=a)for(let d=0;d<=n;d++)f[d]&&(r[d]=!0);lt)return r;let o;switch(e._tag){case"Literal":{o=ul(t),e.value.length<=t&&(o[e.value.length]=!0);break}case"Character":{o=ul(t),e.intervals.some(s=>XI(s,1)>0)&&t>=1&&(o[1]=!0),e.intervals.some(s=>XI(s,2)>0)&&t>=2&&(o[2]=!0);break}case"Alternation":{o=ul(t);for(let s of e.nodes){let i=eu(s,t,n);for(let a=0;a<=t;a++)i[a]&&(o[a]=!0)}break}case"Concatenation":{let s=ul(t);s[0]=!0;for(let i of e.nodes)s=NA(s,eu(i,t,n),t);o=s;break}case"Repetition":o=NRe(e,eu(e.node,t,n),t);break}return n.set(e,o),o}function K7(e,t,n){let r=new Array(e.length+1),o=ul(t);o[0]=!0,r[e.length]=o;for(let s=e.length-1;s>=0;s--)r[s]=NA(eu(e[s],t,n),r[s+1],t);return r}function q7(e,t,n,r){let o=K7(e,t,r),s=t,i="";for(let a=0;at?0:Math.floor(t/s),a=o?0:e.minimum,c=Math.min(e.maximum??i,i);if(a>c)return[];let f=[],l=ul(t);l[0]=!0;for(let d=0;d<=c;d++)d>=a&&l[t]&&f.push(d),deu(s,t,r)[t]);return o.length===0?void 0:AB(o[$s(n,o.length)],t,n,r)}case"Concatenation":return q7(e.nodes,t,n,r);case"Repetition":{let o=V7(e,t,r);if(o.length===0)return;let s=o[$s(n,o.length)];return q7(globalThis.Array(s).fill(e.node),t,n,r)}}}function W7(e,t,n){let r=K7(e,t,n),o=t,s="";for(let i=0;io)return;let d=MB(a,l,n);if(d===void 0)return;s+=d,o-=l}return o===0?s:void 0}function MB(e,t,n){switch(e._tag){case"Literal":return e.value.length===t?e.value:void 0;case"Character":return _Re(e,t);case"Alternation":{let r=e.nodes.find(o=>eu(o,t,n)[t]);return r===void 0?void 0:MB(r,t,n)}case"Concatenation":return W7(e.nodes,t,n);case"Repetition":{let r=V7(e,t,n)[0];return r===void 0?void 0:W7(globalThis.Array(r).fill(e.node),t,n)}}}function PRe(e,t,n,r,o){let s=eu(e,n.length,o),i=[];for(let f=r;f0&&a.push(i[0],i[Math.floor((i.length-1)/2)],i[i.length-1]),a.push(n.length);let c=[];for(let f of a){let l=MB(e,f,o);l!==void 0&&l!==n&&!c.includes(l)&&Z7(t,l)&&c.push(l)}return c}function OA(e){switch(e._tag){case"Literal":return e.value.length;case"Character":return e.intervals.length===0?Number.POSITIVE_INFINITY:e.intervals[0].minimum>65535?2:1;case"Alternation":return Math.min(...e.nodes.map(OA));case"Concatenation":return e.nodes.reduce((t,n)=>t+OA(n),0);case"Repetition":return OA(e.node)*e.minimum}}function Z7(e,t){return e.lastIndex=0,e.test(t)}function FRe(e){if(!e.endsWith("$"))return!1;let t=0;for(let n=e.length-2;n>=0&&e[n]==="\\";n--)t++;return t%2===0}function URe(e,t,n){let r=[],o={_tag:"Repetition",node:Ku(vRe),minimum:0,maximum:void 0};return!n.includes("y")&&!t.startsWith("^")&&r.push(o),r.push(e),FRe(t)||r.push(o),kB(r)}function Q7(e){let{flags:t,source:n}=e;if(t.includes("i")||t.includes("m")||t.includes("v"))return;let r=new TB(n,t.includes("s")).parse();if(r===void 0)return;let o=t.includes("u")?r:MA(r,65535),s=URe(o,n,t),i=new globalThis.RegExp(n,t),a=OA(s),c=new Map;return{minimumLength:a,generate:(f,l,d)=>{let p=eu(s,d,c),m=[];for(let x=l;x<=d;x++)p[x]&&m.push(x);if(m.length===0)return;let g=Pu(f,0,m.length-1),b=AB(s,m[g],f,c);return b!==void 0&&Z7(i,b)?b:void 0},shrink:(f,l)=>PRe(s,i,f,l,c)}}var ra=Number.POSITIVE_INFINITY,LRe={number:"finite"},e0=e=>{let t=tb(e,{onFailure:Na(()=>Aa),onSuccess:KE});return jt(t)&&t._tag==="Success"?t.value:t};function aX(e){let t=ju(Sn(e.ast));return n=>e0(t(n))}function po(e,t){return Gt(`Unable to derive an arbitrary for ${e}`,t)}function fl(e){let t=0;for(let n of e){if(n===ra)return ra;t+=n}return t}function Y7(e,t,n,r,o,s){if(r===void 0||t===void 0)return r===void 0?[t,n]:[r,o];let i=e(t,r);return i===s?[r,o]:i===0?[t,n||o]:[t,n]}function PA(e,t){return e===void 0?t:t===void 0?e:Math.max(e,t)}function FA(e,t){return e===void 0?t:t===void 0?e:Math.min(e,t)}function cX(e,t){let n=t.order??e?.order;if(e?.order!==void 0&&t.order!==void 0&&e.order!==t.order)throw new Error("Cannot merge ordered arbitrary constraints with different Order instances");let[r,o]=n===void 0?[t.minimum??e?.minimum,t.exclusiveMinimum??e?.exclusiveMinimum]:Y7(n,e?.minimum,e?.exclusiveMinimum,t.minimum,t.exclusiveMinimum,-1),[s,i]=n===void 0?[t.maximum??e?.maximum,t.exclusiveMaximum??e?.exclusiveMaximum]:Y7(n,e?.maximum,e?.exclusiveMaximum,t.maximum,t.exclusiveMaximum,1),a=PA(e?.minLength,t.minLength),c=FA(e?.maxLength,t.maxLength),f=PA(e?.minCodePoints,t.minCodePoints),l=FA(e?.maxCodePoints,t.maxCodePoints),d=PA(e?.minSize,t.minSize),p=FA(e?.maxSize,t.maxSize),m=PA(e?.minProperties,t.minProperties),g=FA(e?.maxProperties,t.maxProperties),b=e?.patterns===void 0?t.patterns:t.patterns===void 0?e.patterns:[...e.patterns,...t.patterns],x=e?.number==="integer"||t.number==="integer"?"integer":e?.number==="finite"||t.number==="finite"?"finite":void 0,w=t.uniqueBy??e?.uniqueBy;return{...n===void 0?void 0:{order:n},...r===void 0?void 0:{minimum:r},...o===!0?{exclusiveMinimum:!0}:void 0,...s===void 0?void 0:{maximum:s},...i===!0?{exclusiveMaximum:!0}:void 0,...a===void 0?void 0:{minLength:a},...c===void 0?void 0:{maxLength:c},...f===void 0?void 0:{minCodePoints:f},...l===void 0?void 0:{maxCodePoints:l},...d===void 0?void 0:{minSize:d},...p===void 0?void 0:{maxSize:p},...m===void 0?void 0:{minProperties:m},...g===void 0?void 0:{maxProperties:g},...b===void 0?void 0:{patterns:b},...x===void 0?void 0:{number:x},...w===void 0?void 0:{uniqueBy:w}}}function OB(e,t){let n=t,r=[],o=s=>{let i=s.annotations?.arbitraryConstraint;i!==void 0&&(n=cX(n,i)),s._tag==="Filter"?r.push(s):s.checks.forEach(o)};return e?.forEach(o),{constraint:n,filters:r}}function X7(e,t,n){if(n.length===0)return;let r=e.generate,o=s=>{for(let i=0;iKi(r(s),i=>i._tag==="Discarded"?Xe:s.shrinks?Xg(i,o)??Xe:o(i.value)?i:Xe)}function $Re(e,t){if(e===void 0)return;let n=[[e.minLength,e.maxLength],[e.minCodePoints,e.maxCodePoints],[e.minSize,e.maxSize],[e.minProperties,e.maxProperties]];for(let[r,o]of n)if(r!==void 0&&(!Number.isSafeInteger(r)||r<0)||o!==void 0&&(!Number.isSafeInteger(o)||o<0)||r!==void 0&&o!==void 0&&r>o)throw po("constraints",t);if(e.order!==void 0&&e.minimum!==void 0&&e.maximum!==void 0){let r=e.order(e.minimum,e.maximum);if(r>0||r===0&&(e.exclusiveMinimum===!0||e.exclusiveMaximum===!0))throw po("constraints",t)}}function eX(e){if(e===void 0)return;let{order:t,...n}=e;return Object.keys(n).length===0?void 0:n}var tX=-864e13,nX=864e13,BRe=["g","i","m","s","u","y"];function rX(){let e;return e=Et([bt,Xo,Vr,ae,st(Yc(()=>e)),vs(ae,Yc(()=>e))]),e}function HRe(){return oe({source:fo(["",".",".*","\\d+","\\w+","[a-z]+","[A-Z]+","[0-9]+","^[a-zA-Z0-9]+$","^\\d{4}-\\d{2}-\\d{2}$"]),flags:oe({g:Vr,i:Vr,m:Vr,s:Vr,u:Vr,y:Vr})})}function zRe(){return oe({protocol:fo(["http","https"]),label:ae.check(ta(/^[a-z0-9]+$/),nh(1),il(63)),suffix:ae.check(ta(/^[a-z]+$/),nh(2),il(10)),path:st(ae.check(ta(/^[A-Za-z0-9._~%-]*$/),il(16))).check(il(4))})}function jRe(e){let t=Math.max(tX,e?.minimum===void 0?tX:e.minimum.getTime()+(e.exclusiveMinimum===!0?1:0)),n=Math.min(nX,e?.maximum===void 0?nX:e.maximum.getTime()-(e.exclusiveMaximum===!0?1:0));return Do.check(qs({minimum:t,maximum:n}))}var Wd=Bd;function qRe(e,t,n){let r=e.annotations?.representation;if(r!==void 0)switch(r.id){case"effect/schema/Json":return Wd()(rX(),Cr());case"effect/schema/MutableJson":return Wd()(rX(),Cr({strict:!1}));case"effect/schema/RegExp":return Wd()(HRe(),Se(({flags:o,source:s})=>new globalThis.RegExp(s,BRe.filter(i=>o[i]).join(""))));case"effect/schema/URL":return Wd()(zRe(),Se(({label:o,path:s,protocol:i,suffix:a})=>new globalThis.URL(`${i}://${o}.${a}/${s.join("/")}`)));case"effect/schema/Date":return Wd()(jRe(n),bx());case"effect/schema/ReadonlyMap":{let[o,s]=t;return Wd()($d(st(Fo([o,s])).check(ey()),n?.minSize,n?.maxSize),Se(i=>new globalThis.Map(i)))}case"effect/schema/ReadonlySet":return Wd()($d(st(t[0]).check(rh()),n?.minSize,n?.maxSize),Se(o=>new globalThis.Set(o)));case"effect/schema/Uint8Array":return Wd()($d(st(Do.check(qs({minimum:0,maximum:255}))),n?.minLength,n?.maxLength),Se(o=>globalThis.Uint8Array.from(o)));default:return}}function UA(e,t,n,r){let o=e?.[t[0]]??0,s=e?.[t[1]];if(!Number.isSafeInteger(o)||o<0||s!==void 0&&(!Number.isSafeInteger(s)||s0,()=>t)}var WRe=Tr([],()=>ra,()=>Xe);function GRe(e){let t=Xg(e,up);return t===void 0?void 0:mm(t,n=>typeof n=="symbol"?n:globalThis.String(n))}function oX(e,t,n,r,o=!0){let s=a=>{let c=fb(n);for(let f of a)U(c,f.key,f.sample.value);return c};if(!o)return Mt(s(e));let i=(a,c=0,f=0)=>{let l=[];if(a.length>t){let d=a.flatMap((p,m)=>p.removable?[()=>i(a.slice(0,m).concat(a.slice(m+1)))]:[]);d.length>0&&l.push(F(Ru(d),p=>p()))}for(let d=c;dm._tag==="Discarded"?m:i(Cp(a,d,{...p,sample:m}),d)))}for(let d=f;d!r.has(g)&&!a.some((b,x)=>x!==d&&b.key===g));m?.shrinks!==void 0&&l.push(F(m.shrinks,g=>g._tag==="Discarded"?g:i(Cp(a,d,{...p,key:g.value,keySample:cd(g)}),a.length,d)))}return Mt(s(a),l.length===0?void 0:Qg(l))};return _u(s(e),()=>i(e.map(a=>({...a,sample:cd(a.sample),keySample:a.keySample===void 0?void 0:cd(a.keySample)}))).shrinks)}var RB=(e,t,n=0)=>{let r=n,o;for(let i=0;it.budget.remaining)return;let s;if(o!==void 0&&o.length>1){s=e.map((c,f)=>f);let i=fd(t,o),a=0;for(let c=0;c{let r=0,o;for(let f=0;ft.budget.remaining)return Xe;let s;if(o!==void 0&&o.length>1){s=e.map((d,p)=>p);let f=fd(t,o),l=0;for(let d=0;d{for(;am._tag==="Discarded"?v(Xe):(i[l]=m.value,ci(c())))}let f=fb(n);for(let l=0;l{let r=[],o=t,s=t*e.minCost,i=()=>{for(;o>0;){s-=e.minCost;let a=Nu(e,n,s);if(Pa(a)){if(a._tag==="Discarded")return Xe;r.push(a.value),o--;continue}return At(a,c=>c._tag==="Discarded"?v(Xe):(r.push(c.value),o--,ci(i())))}return Mt(r)};return i()},VRe=(e,t,n)=>{let r=new Array(t),o=fd(n,Array.from({length:t},(c,f)=>f)),s=0,i=t*e.minCost,a=()=>{for(;sf._tag==="Discarded"?v(Xe):(r[o[s++]]=f.value,ci(a())))}return Mt(r)};return a()},ZRe=()=>{let e,t;return n=>{if(n===null||typeof n!="object"&&typeof n!="function"){let i=e??=new Set,a=i.size;return i.add(n),i.size!==a}let r=pe(n),o=t??=new Map,s=o.get(r);if(s!==void 0){for(let i=0;i{let t=ZRe();return e===L?t:n=>t(e(n))},QRe=(e,t,n,r)=>{let o=[],s=uX(r),i=t,a=t*e.minCost,c=0,f=n.budget.remaining,l=()=>{for(;i>0;){c===0&&(a-=e.minCost,f=n.budget.remaining);let d=Nu(e,n,a);if(Pa(d)){if(d._tag==="Discarded")return Xe;if(!s(d.value)){if(++c>=t)return Xe;n.budget.remaining=f;continue}o.push(d.value),i--,c=0;continue}return At(d,p=>{if(p._tag==="Discarded")return v(Xe);if(s(p.value))o.push(p.value),i--,c=0;else{if(++c>=t)return v(Xe);n.budget.remaining=f}return ci(l())})}return Mt(o)};return l()};function YRe(e,t){let n=e.length<=t?[]:[e.slice(0,t),e.slice(0,Math.max(t,Math.floor(e.length/2))),e.slice(0,-1)];for(let r=0;rr!==e)}var sX=[""," "," ",`
+`,"\0","0","-1","4294967295","__proto__","constructor","prototype","toString","\uD800","\uDC00","\u{1F600}"];function XRe(e,t,n){if(Zt(e,1,e.biasFactor)===1){let s=0;for(let i of sX)i.length>=t&&i.length<=n&&s++;if(s>0){let i=$s(e,s);for(let a of sX)if(!(a.lengthn)&&i--===0)return a}}let r=Pu(e,t,n),o="";for(let s=0;s0;f--)Zt(e,1,f)<=a?(c+=globalThis.String.fromCodePoint(Zt(e,65536,1114111)),a--):c+=globalThis.String.fromCharCode(Zt(e,32,126));return c}function t_e(e,t,n){let r=e?.order===Yr?e:void 0,o=r?.minimum,s=r?.maximum;if(o!==void 0&&Number.isNaN(o)||s!==void 0&&Number.isNaN(s))throw po(t?"integer constraints":"number constraints",n);if(t)o!==void 0&&(o=r?.exclusiveMinimum===!0?Math.floor(o)+1:Math.ceil(o)),s!==void 0&&(s=r?.exclusiveMaximum===!0?Math.ceil(s)-1:Math.floor(s));else{if(o!==void 0&&r?.exclusiveMinimum===!0&&o===1/0||s!==void 0&&r?.exclusiveMaximum===!0&&s===-1/0)throw po("number constraints",n);o!==void 0&&(o=r?.exclusiveMinimum===!0?a5(o):o===0?-0:o),s!==void 0&&(s=r?.exclusiveMaximum===!0?c5(s):s===0?0:s)}if(t||e?.number==="finite"){if(o===1/0||s===-1/0)throw po(t?"integer constraints":"number constraints",n);o===-1/0&&(o=t?Number.MIN_SAFE_INTEGER:-Number.MAX_VALUE),s===1/0&&(s=t?Number.MAX_SAFE_INTEGER:Number.MAX_VALUE)}if(t){if(o!==void 0&&o>Number.MAX_SAFE_INTEGER||s!==void 0&&ss:Ji(o)>Ji(s)))throw po(t?"integer constraints":"number constraints",n);return{minimum:o,maximum:s}}function _B(e,t,n){let r=[],o=e-t,s=n?void 0:t;for(let i=n?o:Math.trunc(o/2);i!==0;i=Math.trunc(i/2)){let a=i===o?t:e-i;r.push({value:a,context:s}),s=a}return r}function iX(e,t,n){if(Number.isNaN(e))return[{value:t,context:void 0}];let r=Ji(e),o=Ji(t),s=r-o,i=n?void 0:t,a=[];for(let c=n?s:s/BigInt(2);c!==BigInt(0);c/=BigInt(2)){let f=c===s?t:db(r-c);a.push({value:f,context:i}),i=f}return a}function n_e(e,t){return e!==void 0&&e>0?e:t!==void 0&&t<0?t:0}function NB(e,t,n,r,o){if(!r){let i,a=n_e(t,n);return o===void 0?i=iX(e,a,!0):!Number.isNaN(e)&&(Ji(e)===Ji(o)+BigInt(1)||Ji(e)===Ji(o)-BigInt(1))?i=[{value:o,context:void 0}]:i=iX(e,o,!1),Mt(e,i.length===0?void 0:F(Ru(i),c=>NB(c.value,t,n,!1,c.context)))}let s;if(o===void 0){let i=Math.min(n??0,Math.max(t??0,0));s=_B(e,i,!0)}else e>0&&e===o+1&&(t===void 0||e>t)||e<0&&e===o-1&&(n===void 0||eNB(i.value,t,n,!0,i.context)))}function fX(e){let t=Sn(e.ast),n=new WeakMap,r=[],o=new Map,s=[],i=(x,w,E)=>{let S=n.get(x),y=S?.get(E);if(y!==void 0)return y;S===void 0&&(S=new Map,n.set(x,S));let h=Tr([],()=>ra,()=>Xe);return S.set(E,h),r.push(h),s.push(()=>{let I=OB(x.checks,E),T=x.checks===void 0?x:oI(x,void 0),C=a(T,w,I.constraint);if(T._tag==="Suspend"){let k=C.dependencies[0];h.dependencies=[k],h.computeMinCost=()=>k.minCost===ra?ra:k.minCost+(h.recursive?1:0),h.generate=_=>B(()=>{if(h.recursive){if(_.budget.remaining<=0)return v(Xe);_.budget.remaining--}return ci(k.generate(_))}),o.set(h,k)}else h.dependencies=C.dependencies,h.computeMinCost=C.computeMinCost,h.generate=C.generate;X7(h,x,I.filters)}),h},a=(x,w,E)=>{switch(x._tag){case"Never":return WRe;case"Null":return DA(null);case"Undefined":case"Void":return DA(void 0);case"Literal":return DA(x.literal);case"UniqueSymbol":return DA(x.symbol);case"Boolean":return Tr([],()=>0,S=>{let y=ud(S);return Mt(y,S.shrinks&&y?Ru([Mt(!1)]):void 0)});case"String":{let S=[];for(let k of E?.patterns??[]){let _=Q7(k);_!==void 0&&S.push(_)}let[y,h=ra]=UA(E,["minLength","maxLength"],w,"string"),I=E?.minCodePoints!==void 0||E?.maxCodePoints!==void 0,[T,C=ra]=UA(E,["minCodePoints","maxCodePoints"],w,"string code point");if(I&&(y=Math.max(y,T),h=Math.min(h,C*2),T=Math.max(T,Math.ceil(y/2)),C=Math.min(C,h),y>h||T>C))throw po("string constraints",w);return Tr([],()=>0,k=>{let _=S.length===0?void 0:S.length===1?S[0]:S[$s(k,S.length)],D=Math.max(y,_?.minimumLength??0,k.size);I&&_!==void 0&&(D*=2);let z=Math.min(h,D),he=_!==void 0?_.generate(k,y,z):I?e_e(k,y,z,T,Math.min(C,z)):XRe(k,y,z);return he===void 0?Xe:k.shrinks?M1(he,_===void 0?Re=>YRe(Re,y):Re=>_.shrink(Re,y)):Mt(he)})}case"Number":{let S=E?.number==="integer",y=t_e(E,S,w),h=y.minimum??(E?.number!==void 0?-Number.MAX_VALUE:Number.NEGATIVE_INFINITY),I=y.maximum??(E?.number!==void 0?Number.MAX_VALUE:Number.POSITIVE_INFINITY),T=S?void 0:u5(h,I,E?.number===void 0&&y.minimum===void 0),C,k,_;return Tr([],()=>0,D=>{let z=h,he=I;if(S){let Zn=Math.max(1,D.size*D.size),Q=y.minimum!==void 0&&y.minimum>0?y.minimum:y.maximum!==void 0&&y.maximum<0?y.maximum:0;z=y.minimum??Q-Zn,he=y.maximum??Q+Zn,(_===void 0||z!==C||he!==k)&&(C=z,k=he,_=s5(z,he))}let Re=S?_(D):T(D);return D.shrinks?NB(Re,y.minimum,y.maximum,S):Mt(Re)})}case"BigInt":{let S=E?.order===pa?E:void 0,y=S?.minimum,h=S?.maximum;if(y!==void 0&&S?.exclusiveMinimum===!0&&y++,h!==void 0&&S?.exclusiveMaximum===!0&&h--,y!==void 0&&h!==void 0&&y>h)throw po("bigint constraints",w);return L7(y,h)}case"Symbol":{let S=i(Is,w,E);return Tr([S],()=>S.minCost,y=>Ki(S.generate(y),h=>h._tag==="Discarded"?h:mm(h,I=>Symbol.for(I))))}case"Unknown":case"Any":{let S=i(Gu.ast,w);return Tr([S],()=>S.minCost,y=>S.generate(y))}case"ObjectKeyword":{let S=i(Gu.ast,w);return Tr([S],()=>0,y=>Ki(S.generate(y),h=>h._tag==="Generated"&&typeof h.value=="object"&&h.value!==null?h:Mt({})))}case"Enum":{let S=[...new Set(x.enums.map(([,y])=>y))];if(S.length===0)throw po("an enum with no members",w);return Tr([],()=>0,y=>Mt(S[$s(y,S.length)]))}case"TemplateLiteral":{let S=x.parts.map((y,h)=>i(y,[...w,h],LRe));return Tr(S,()=>fl(S.map(y=>y.minCost)),y=>Wf(RB(S,y),h=>{if(h===void 0)return Xe;let I=pb(h,{fixedCount:h.length,optionalCount:0,repeatCount:0,tailCount:0,minimum:h.length},y.shrinks);return mm(I,T=>T.map(globalThis.String).join(""))}))}case"Union":{let S=x.types.map(h=>i(h,w,E));if(S.length===0)throw po("a union with no members",w);let y=h=>R1(S,h);if(x.options?.mode==="oneOf"){let h=ju(x),I=T=>e0(h(T));y=T=>Yg(R1(S,T),I)}return Tr(S,()=>Math.min(...S.map(h=>h.minCost)),y)}case"Arrays":return c(x,w,E);case"Objects":{let S=f(x,w,E);if(x.indexSignatures.length===0||x.indexSignatures.length===1&&x.propertySignatures.length===0)return S;let y=ju(new Md([],x.indexSignatures)),h=S.generate;return S.generate=I=>Yg(h(I),T=>Wf(e0(y(T)),C=>Y(C)?C:N(T))),S}case"Suspend":{let S=i(x.thunk(),w);return Tr([S],()=>S.minCost,y=>S.generate(y))}case"Declaration":return l(x,w,E)}},c=(x,w,E)=>{let S=E?.uniqueBy,y=x.elements.map((Ke,Ve)=>({optional:Ar(Ke),compiled:i(Ke,[...w,Ve])})),h=y.findIndex(Ke=>Ke.optional),I=h===-1?y.length:h,T=y.length-I,C=x.rest.map((Ke,Ve)=>i(Ke,[...w,y.length+Ve])),k=C[0],_=C.slice(1),[D,z]=UA(E,["minLength","maxLength"],w,"array");if(z!==void 0&&zy.length+_.length)throw po("array constraints",w);let he=[...y.map(Ke=>Ke.compiled),...C],Re=Ke=>{let Ve=[],dn=fl(y.slice(0,I).map(Nr=>Nr.compiled.minCost)),ar=fl(_.map(Nr=>Nr.minCost)),_r=Math.max(D,I+_.length,Ke),$o=z===void 0?_r:Math.min(z,_r);for(let Nr=0;Nr<=T;Nr++){let Eo=I+Nr+_.length,zn=Math.max(0,D-Eo),oc=k===void 0?0:Math.max(zn,$o-Eo);if(Eo+zn>$o||k===void 0&&zn>0)continue;let bo=fl(y.slice(I,I+Nr).map(zr=>zr.compiled.minCost));for(let zr=zn;zr<=oc;zr++){if((zr>0||_.length>0)&&Nr(Ke!==Zn&&(Zn=Ke,Q=void 0,Qe=Re(Ke)),Ve!==Q&&(Q=Ve,et=Qe.filter(([,,dn])=>dn<=Ve)),et);return Tr(he,()=>{let Ke=Re(0);return Ke.length===0?ra:Math.min(...Ke.map(([,,Ve])=>Ve))},Ke=>{let Ve=en(Ke.size,Ke.budget.remaining);if(Ve.length===0)return Xe;let[dn,ar]=Ve[Pu(Ke,0,Ve.length-1)],_r=Ke.size>=ar?Ke:{...Ke,size:ar};if(!Ke.shrinks&&y.length===0&&_.length===0&&k!==void 0&&(!k.mayRecurse||S===void 0))return k.mayRecurse?VRe(k,ar,_r):S!==void 0?QRe(k,ar,_r,S):KRe(k,ar,_r);let $o=[...y.slice(0,I+dn).map(q=>q.compiled),...Array.from({length:ar},()=>k),..._],Nr=q=>pb(q,{fixedCount:I+dn,optionalCount:dn,repeatCount:ar,tailCount:_.length,minimum:D},Ke.shrinks);if(S===void 0)return Wf(RB($o,_r),q=>q===void 0?Xe:Nr(q));let Eo=[],zn=uX(S),oc=fl($o.map(q=>q.minCost)),bo=$o.length,zr=0,A=0,M=Ke.budget.remaining,X=()=>{for(;zr<$o.length;){let q=$o[zr];A===0&&(oc-=q.minCost,M=Ke.budget.remaining);let $e=Nu(q,_r,oc);if(Pa($e)){let Oe=$e;if(Oe._tag==="Discarded")return Xe;if(!zn(Oe.value)){if(++A>=bo)return Xe;Ke.budget.remaining=M;continue}Eo.push(Oe),zr++,A=0;continue}return At($e,Oe=>{if(Oe._tag==="Discarded")return v(Xe);if(zn(Oe.value))Eo.push(Oe),zr++,A=0;else{if(++A>=bo)return v(Xe);Ke.budget.remaining=M}return Zg(X())})}return Nr(Eo)};return X()})},f=(x,w,E)=>{let S=x.indexSignatures.flatMap((Q,Qe)=>{let et=OB(Q.type.checks,void 0).constraint;return et===void 0?[]:[{index:Q,position:Qe,constraint:et}]}),y=(Q,Qe)=>{let et=i(Q,Qe),en=Q._tag==="String"||Q._tag==="Number"||Q._tag==="BigInt"?S.filter(({index:dn})=>dn.type!==Q&&dn.type._tag===Q._tag):[],Ke=new Map;return{compiled:et,forKey:dn=>{if(en.length===0)return et;let ar={[dn]:void 0},_r=en.filter(({index:zn})=>zc(ar,zn.parameter).length>0);if(_r.length===0)return et;let $o=_r.map(({position:zn})=>zn).join(","),Nr=Ke.get($o);if(Nr!==void 0)return Nr;let Eo=et;try{let zn;for(let bo of _r)zn=cX(zn,bo.constraint);let oc=OB(Q.checks,zn);Eo=a(Q,Qe,oc.constraint),Eo.minCost=0,X7(Eo,Q,oc.filters)}catch{}return Ke.set($o,Eo),Eo}}},h=x.propertySignatures.map(Q=>({property:Q,optional:Ar(Q.type),compiled:y(Q.type,[...w,Q.name]).forKey(Q.name)})),I=new Set(h.map(({property:Q})=>typeof Q.name=="symbol"?Q.name:globalThis.String(Q.name))),T=x.indexSignatures.map((Q,Qe)=>{let et=y(Q.type,[...w,`index-${Qe}-value`]);return{parameter:i(Q.parameter,[...w,`index-${Qe}-key`]),value:et.compiled,valueForKey:et.forKey}}),C=h.filter(Q=>!Q.optional),k=h.filter(Q=>Q.optional),[_,D]=UA(E,["minProperties","maxProperties"],w,"object property");if(D!==void 0&&Dh.length)throw po("object property constraints",w);let z=Math.max(0,_-C.length),he=T.length===0?z:0,Re=()=>{let Q=Math.min(...T.map(en=>en.parameter.minCost+en.value.minCost)),Qe=k.filter(en=>en.compiled.minCost<=Q).sort((en,Ke)=>en.compiled.minCost-Ke.compiled.minCost).slice(0,z),et=z-Qe.length;return{optional:Qe,indexCount:et,indexCost:Q,cost:fl(Qe.map(en=>en.compiled.minCost))+(et===0?0:et*Q)}},Zn=[...h.map(Q=>Q.compiled),...T.flatMap(Q=>[Q.parameter,Q.value])];return Tr(Zn,()=>fl(C.map(Q=>Q.compiled.minCost))+Re().cost,Q=>{if(!Q.shrinks&&k.length===0&&T.length===0)return JRe(C,Q,Q.nullPrototype);let Qe=Math.max(_,C.length,Q.size),et=D===void 0?Qe:Math.min(D,Qe),en=Math.min(k.length,et-C.length),Ke=Re(),Ve=Ke.indexCost,dn=Zt(Q,he,en),ar=dn===0?C:[...C,...fd(Q,k).slice(0,dn)],_r=Math.max(0,_-ar.length),$o=fl(ar.map(bo=>bo.compiled.minCost));$o+(_r===0?0:_r*Ve)>Q.budget.remaining&&(ar=[...C,...Ke.optional],_r=Ke.indexCount,$o=fl(ar.map(bo=>bo.compiled.minCost)));let Nr=T.length===0?0:et-ar.length,Eo=Ve===0?Nr:Ve===ra?0:Math.min(Nr,Math.floor((Q.budget.remaining-$o)/Ve));if(Eo<_r)return Xe;let zn=Pu(Q,_r,Eo),oc=zn===0?0:zn*Ve;return C1(RB(ar.map(bo=>bo.compiled),Q,oc),bo=>{if(bo===void 0)return Xe;let zr=bo.map((A,M)=>({key:ar[M].property.name,sample:A,removable:ar[M].optional}));return zn===0?oX(zr,_,Q.nullPrototype,I,Q.shrinks):K(function*(){for(let A=0;Atn.parameter.minCost+tn.value.minCost+M<=Q.budget.remaining);if(X.length===0)return Xe;let q=X[$s(Q,X.length)],$e=Q.budget.remaining,Oe=q.value.minCost+M,ft=Q.size>=zn?Q:{...Q,size:zn},Ee=yield*ci(Nu(q.parameter,ft,Oe)),rt,cr=0;for(;;){if(Ee._tag==="Discarded")return Xe;let tn=GRe(Ee);if(tn===void 0)return Xe;if(rt=tn,!I.has(rt.value)&&!zr.some(Oi=>Oi.key===rt.value))break;if(cr++>=10)return Xe;Q.budget.remaining=$e,Ee=yield*ci(Nu(q.parameter,ft,Oe))}let jn=yield*ci(Nu(q.valueForKey(rt.value),Q,M));if(jn._tag==="Discarded")return Xe;zr.push({key:rt.value,keySample:rt,sample:jn,removable:!0})}return oX(zr,_,Q.nullPrototype,I,Q.shrinks)})})})},l=(x,w,E)=>{$Re(E,w);let S=x.typeParameters.map((D,z)=>i(D,[...w,z])),y=x.typeParameters.map(D=>Ie(Sn(D))),h=x.annotations?.toCodecArbitrary,I=x.annotations?.representation;if(typeof h!="function"&&I?.id==="effect/schema/BigDecimal"){let D=E?.order===co?E:void 0,z=F7({minimum:D?.minimum,exclusiveMinimum:D?.exclusiveMinimum,maximum:D?.maximum,exclusiveMaximum:D?.exclusiveMaximum});if(z===void 0)throw po("BigDecimal constraints",w);return z}let T;if(typeof h=="function")T=h({typeParameters:y,constraint:eX(E)});else{let D=qRe(x,y,eX(E));if(D!==void 0)T=D;else{let z=x.annotations?.toCodecJson;if(typeof z=="function"){let he=z(y);if(he===void 0)throw po("an opaque self-canonical Declaration",w);T=he}else{let he=x.annotations?.toCodec;if(typeof he!="function")throw po("an unsupported Declaration",w);T=he(y)}}}let C=i(Sn(T.to),w),k=ju(x),_=D=>{let z=T.transformation._tag==="Transformation"?VU(T.transformation.decode,N(D),zs):T.transformation.decode(v(N(D)),zs);return C1(e0(z),he=>Y(he)||Y(he.value)?R():e0(k(he.value.value)))};return Tr([C,...S],()=>C.minCost,D=>Yg(C.generate(D),_))},d=i(t,[]);for(let x=0;xx.recursive);for(let x=0;x=w.minCost)){w.minCost=E;for(let S of p.get(w))b.has(S)||(b.add(S),g.push(S))}}if(d.minCost===ra)throw po("a schema without a finite generation path",[]);return d}function r_e(e,t){let n=new Set,r=[];for(let a of e){if(n.has(a))continue;n.add(a);let c=[{node:a,index:0}];for(;c.length>0;){let f=c[c.length-1];if(f.index