og-tester 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/dist/index.mjs +19 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,6 +21,33 @@
|
|
|
21
21
|
- **Icons Panel** - Display all favicons with sizes and types
|
|
22
22
|
- 🖼️ **Image Previews** - Visual preview of Open Graph and Twitter Card images
|
|
23
23
|
|
|
24
|
+
## 🔀 Comparing two pages
|
|
25
|
+
|
|
26
|
+
When a link preview breaks, `og-tester diff` shows what differs between a page that works and one that doesn't, such as staging against production or before against after a deploy.
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
og-tester diff https://example.com https://staging.example.com
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
A 63 → B 23 (−40)
|
|
34
|
+
|
|
35
|
+
Differing tags: title, description, og:url, ...
|
|
36
|
+
Categories: og 20 → 6 (−14), twitter 10 → 0 (−10), ...
|
|
37
|
+
Regressed (only in B): og:url, twitter:card, ...
|
|
38
|
+
Fixed (only in A): ...
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- URLs without a scheme default to `https://`.
|
|
42
|
+
- `--json` prints the diff (`a`, `b`, `scoreDelta`, `categories`, `tags`, `fixed`, `regressed`) to stdout. Errors go to stderr as `{ "error": "..." }`.
|
|
43
|
+
- `--fail-on-regression` exits 1 when B scores lower than A or has a diagnostic A doesn't, so a deploy pipeline can gate on it.
|
|
44
|
+
- A diagnostic counts as the same on both sides when it targets the same tag. A tag whose message changed (a title going from 61 to 65 characters) shows up in the score and category deltas, not in the Fixed and Regressed lists.
|
|
45
|
+
- Only the general, Open Graph and Twitter tags that `check` reports are compared. Favicons are not.
|
|
46
|
+
|
|
47
|
+
## 🤝 Contributing
|
|
48
|
+
|
|
49
|
+
See [CONTRIBUTING.md](https://github.com/PunGrumpy/og-tester/blob/main/CONTRIBUTING.md) for setup, environment variables, and the `bun run check` workflow.
|
|
50
|
+
|
|
24
51
|
## 📝 License
|
|
25
52
|
|
|
26
53
|
Licensed under the [MIT License](LICENSE).
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{Command as e,InvalidArgumentError as t}from"commander";import{setTimeout as n}from"node:timers/promises";import{intro as r,log as i,note as a,outro as o,spinner as s}from"@clack/prompts";import c from"picocolors";import{readFile as l,readdir as u,writeFile as d}from"node:fs/promises";import{existsSync as f,lstatSync as p,readFileSync as
|
|
3
|
-
`+a(n+1));return`[\n${a(n+1)}${t}\n${a(n)}]`}if(e instanceof Date)return
|
|
4
|
-
`)}\n${a(n)}}`;return o(e,l)}return String(e)}return c(e,0)}const
|
|
2
|
+
import{Command as e,InvalidArgumentError as t}from"commander";import{setTimeout as n}from"node:timers/promises";import{intro as r,log as i,note as a,outro as o,spinner as s}from"@clack/prompts";import c from"picocolors";import{readFile as l,readdir as u,writeFile as d}from"node:fs/promises";import{existsSync as f,lstatSync as p,readFileSync as m}from"node:fs";import h from"node:path";var g=`0.2.0`;const _=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let e=0,r=t.length;e<r;e++)n=t[e](n);return n}}},ee={pipe(){return _(this,arguments)}},te=function(){function e(){}return e.prototype=ee,e}(),v=function(e,t){if(typeof e==`function`)return function(){return e(arguments)?t.apply(this,arguments):e=>t(e,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(e,n){return arguments.length>=2?t(e,n):function(n){return t(n,e)}};case 3:return function(e,n,r){return arguments.length>=3?t(e,n,r):function(r){return t(r,e,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(e){return t(e,...n)}}}},ne=e=>e,re=(e=>()=>e)(void 0),ie=re;function ae(e,t,n,r,i,a,o,s,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return i(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return a(i(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return o(a(i(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return s(o(a(i(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return c(s(o(a(i(r(n(t(e.apply(this,arguments)))))))))}}}function oe(e){let t=new WeakMap;return n=>{if(t.has(n))return t.get(n);let r=e(n);return t.set(n,r),r}}const se=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete(`stack`);let n=Object.getPrototypeOf(e),r=n;for(;r!==null&&r!==Object.prototype;){let e=Reflect.ownKeys(r);for(let n=0;n<e.length;n++)t.add(e[n]);r=Object.getPrototypeOf(r)}return t.has(`constructor`)&&typeof e.constructor==`function`&&n===e.constructor.prototype&&t.delete(`constructor`),t},ce=new WeakSet;function le(e){return typeof e==`string`}function ue(e){return typeof e==`number`}function de(e){return typeof e==`boolean`}function fe(e){return typeof e==`function`}function pe(e){return e!=null}function me(e){return typeof e==`object`&&!!e||fe(e)}const y=v(2,(e,t)=>me(e)&&t in e);function he(e){return y(e,Symbol.iterator)||le(e)}const b=`~effect/interfaces/Hash`,x=e=>{switch(typeof e){case`number`:return ye(e);case`bigint`:return C(e.toString(10));case`boolean`:return C(String(e));case`symbol`:return C(String(e));case`string`:return C(e);case`undefined`:return C(`undefined`);case`function`:case`object`:if(e===null)return C(`null`);if(e instanceof Date)return C(e.toISOString());if(e instanceof RegExp)return C(e.toString());{if(ce.has(e))return ge(e);if(De.has(e))return De.get(e);let t=ke(e,()=>ve(e)?e[b]():typeof e==`function`?ge(e):Array.isArray(e)||ArrayBuffer.isView(e)?Ce(e):e instanceof Map?we(e):e instanceof Set?Te(e):xe(e));return De.set(e,t),t}default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},ge=e=>(Ee.has(e)||Ee.set(e,ye(Math.floor(Math.random()*(2**53-1)))),Ee.get(e)),S=v(2,(e,t)=>e*53^t),_e=e=>e&3221225471|e>>>1&1073741824,ve=e=>y(e,b),ye=e=>{if(e!==e)return C(`NaN`);if(e===1/0)return C(`Infinity`);if(e===-1/0)return C(`-Infinity`);let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return _e(t)},C=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return _e(t)},be=(e,t)=>{let n=12289;for(let r of t)n^=S(x(r),x(e[r]));return _e(n)},xe=e=>be(e,se(e)),Se=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return _e(r)},Ce=Se(6151,x),we=Se(C(`Map`),([e,t])=>S(x(e),x(t))),Te=Se(C(`Set`),x),Ee=new WeakMap,De=new WeakMap,Oe=new WeakSet;function ke(e,t){if(Oe.has(e))return C(`[Circular]`);Oe.add(e);let n=t();return Oe.delete(e),n}const w=`~effect/interfaces/Equal`;function T(){return arguments.length===1?e=>Ae(e,arguments[0]):Ae(arguments[0],arguments[1])}function Ae(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;return n===typeof t?n===`number`&&e!==e&&t!==t?!0:n!==`object`&&n!==`function`||ce.has(e)||ce.has(t)?!1:Fe(e,t,Pe):!1}function je(e,t,n){let r=Me.has(e),i=Ne.has(t);if(r&&i)return!0;if(r||i)return!1;Me.add(e),Ne.add(t);let a=n();return Me.delete(e),Ne.delete(t),a}const Me=new WeakSet,Ne=new WeakSet;function Pe(e,t){if(x(e)!==x(t))return!1;if(e instanceof Date)return t instanceof Date&&e.toISOString()===t.toISOString();if(e instanceof RegExp)return t instanceof RegExp&&e.toString()===t.toString();let n=We(e),r=We(t);if(n!==r)return!1;let i=n&&r;return typeof e==`function`&&!i?!1:je(e,t,()=>i?e[w](t):Array.isArray(e)?!Array.isArray(t)||e.length!==t.length?!1:Le(e,t):ArrayBuffer.isView(e)?!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength?!1:Re(e,t):e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:Ve(e,t):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:Ue(e,t):ze(e,t))}function Fe(e,t,n){let r=Ie.get(e);if(!r)r=new WeakMap,Ie.set(e,r);else if(r.has(t))return r.get(t);let i=n(e,t);r.set(t,i);let a=Ie.get(t);return a||(a=new WeakMap,Ie.set(t,a)),a.set(e,i),i}const Ie=new WeakMap;function Le(e,t){for(let n=0;n<e.length;n++)if(!Ae(e[n],t[n]))return!1;return!0}function Re(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function ze(e,t){let n=se(e),r=se(t);if(n.size!==r.size)return!1;for(let i of n)if(!r.has(i)||!Ae(e[i],t[i]))return!1;return!0}function Be(e,t){return function(n,r){for(let[i,a]of n){let n=!1;for(let[o,s]of r)if(e(i,o)&&t(a,s)){n=!0;break}if(!n)return!1}return!0}}const Ve=Be(Ae,Ae);function He(e){return function(t,n){for(let r of t){let t=!1;for(let i of n)if(e(r,i)){t=!0;break}if(!t)return!1}return!0}}const Ue=He(Ae),We=e=>y(e,w),Ge=()=>T,Ke=Symbol.for(`~effect/Redactable`),qe=e=>y(e,Ke);function Je(e){return qe(e)?Ye(e):e}function Ye(e){return e[Ke](globalThis[`~effect/Fiber/currentFiber`]?.context??Ze)}const Xe=`~effect/Fiber/currentFiber`,Ze={"~effect/Context":{},mapUnsafe:new Map,pipe(){return _(this,arguments)}};function E(e,t){let n=t?.space??0,r=new WeakSet,i=n?typeof n==`number`?` `.repeat(n):n:``,a=e=>i.repeat(e),o=(e,t)=>{let n=e?.constructor;return n&&n!==Object.prototype.constructor&&n.name?`${n.name}(${t})`:t},s=e=>{try{return Reflect.ownKeys(e)}catch{return[`[ownKeys threw]`]}};function c(e,n=0){if(Array.isArray(e)){if(r.has(e))return Qe;if(r.add(e),!i||e.length<=1)return`[${e.map(e=>c(e,n)).join(`,`)}]`;let t=e.map(e=>c(e,n+1)).join(`,
|
|
3
|
+
`+a(n+1));return`[\n${a(n+1)}${t}\n${a(n)}]`}if(e instanceof Date)return tt(e);if(!t?.ignoreToString&&y(e,`toString`)&&typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=nt(e);return e instanceof Error&&e.cause?`${t} (cause: ${c(e.cause,n)})`:t}if(typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`||e==null||typeof e==`boolean`||typeof e==`symbol`)return String(e);if(typeof e==`bigint`)return String(e)+`n`;if(typeof e==`object`||typeof e==`function`){if(r.has(e))return Qe;if(r.add(e),Ke in e)return E(Ye(e));if(Symbol.iterator in e)return`${e.constructor.name}(${c(Array.from(e),n)})`;let t=s(e);if(!i||t.length<=1){let r=`{${t.map(t=>`${$e(t)}:${c(e[t],n)}`).join(`,`)}}`;return o(e,r)}let l=`{\n${t.map(t=>`${a(n+1)}${$e(t)}: ${c(e[t],n+1)}`).join(`,
|
|
4
|
+
`)}\n${a(n)}}`;return o(e,l)}return String(e)}return c(e,0)}const Qe=`[Circular]`;function $e(e){return typeof e==`string`?JSON.stringify(e):String(e)}function et(e){return e.map(e=>`[${$e(e)}]`).join(``)}function tt(e){try{return e.toISOString()}catch{return`Invalid Date`}}function nt(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}const rt=Symbol.for(`nodejs.util.inspect.custom`),it=e=>{try{if(y(e,`toJSON`)&&fe(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(it)}catch{return`[toJSON threw]`}return Je(e)};var at=class e{called=!1;self;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new e(this.self)}};const ot=`~effect/Utils/internal`,st={[ot]:e=>e()},ct={[ot]:e=>{try{return e()}finally{}}},D=st[ot](()=>Error().stack)?.includes(ot)===!0?st[ot]:ct[ot],lt=`~effect/Effect`,ut=`~effect/Exit`,dt={_A:ne,_E:ne,_R:ne},ft=`${lt}/identifier`,O=`${lt}/args`,k=`${lt}/evaluate`,A=`${lt}/successCont`,pt=`${lt}/failureCont`,mt=`${lt}/ensureCont`,ht=Symbol.for(`effect/Effect/Yield`),gt={pipe(){return _(this,arguments)},toJSON(){return{...this}},toString(){return E(this.toJSON(),{ignoreToString:!0,space:2})},[rt](){return this.toJSON()}},_t={[lt]:dt,...gt,[Symbol.iterator](){return new at(this)},toJSON(){return{_id:`Effect`,op:this[ft],...O in this?{args:this[O]}:void 0}}},vt=e=>y(e,ut),yt=`~effect/Cause`,bt=`~effect/Cause/Reason`,xt=e=>y(e,yt);var St=class{[yt];reasons;constructor(e){this[yt]=yt,this.reasons=e}pipe(){return _(this,arguments)}toJSON(){return{_id:`Cause`,failures:this.reasons.map(e=>e.toJSON())}}toString(){return`Cause(${E(this.reasons)})`}[rt](){return this.toJSON()}[w](e){return xt(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>T(t,e.reasons[n]))}[b](){return Ce(this.reasons)}};const Ct=new WeakMap;var wt=class{[bt];annotations;_tag;constructor(e,t,n){if(this[bt]=bt,this._tag=e,t!==Tt&&typeof n==`object`&&n&&t.size>0){let e=Ct.get(n);e&&(t=new Map([...e,...t])),Ct.set(n,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let n=new Map(this.annotations);e.mapUnsafe.forEach((e,r)=>{t?.overwrite!==!0&&n.has(r)||n.set(r,e)});let r=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return r.annotations=n,r}pipe(){return _(this,arguments)}toString(){return E(this)}[rt](){return this.toString()}};const Tt=new Map;var Et=class extends wt{error;constructor(e,t=Tt){super(`Fail`,t,e),this.error=e}toString(){return`Fail(${E(this.error)})`}toJSON(){return{_tag:`Fail`,error:this.error}}[w](e){return Mt(e)&&T(this.error,e.error)&&T(this.annotations,e.annotations)}[b](){return S(C(this._tag))(S(x(this.error))(x(this.annotations)))}};const Dt=e=>new St(e),Ot=e=>new St([new Et(e)]);var kt=class extends wt{defect;constructor(e,t=Tt){super(`Die`,t,e),this.defect=e}toString(){return`Die(${E(this.defect)})`}toJSON(){return{_tag:`Die`,defect:this.defect}}[w](e){return Nt(e)&&T(this.defect,e.defect)&&T(this.annotations,e.annotations)}[b](){return S(C(this._tag))(S(x(this.defect))(x(this.annotations)))}};const At=e=>new St([new kt(e)]),jt=v(e=>xt(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new St(e.reasons.map(e=>e.annotate(t,n)))),Mt=e=>e._tag===`Fail`,Nt=e=>e._tag===`Die`,Pt=e=>e._tag===`Interrupt`;function Ft(e){return Ut(`Effect.evaluate: Not implemented`)}const It=e=>({..._t,[ft]:e.op,[k]:e[k]??Ft,[A]:e[A],[pt]:e[pt],[mt]:e[mt]}),Lt=e=>{let t=It(e);return function(){let n=Object.create(t);return n[O]=e.single===!1?arguments:arguments[0],n}},Rt=e=>{let t={...It(e),[ut]:ut,_tag:e.op,get[e.prop](){return this[O]},toString(){return`${e.op}(${E(this[O])})`},toJSON(){return{_id:`Exit`,_tag:e.op,[e.prop]:this[O]}},[w](e){return vt(e)&&e._tag===this._tag&&T(this[O],e[O])},[b](){return S(C(e.op),x(this[O]))}};return function(e){let n=Object.create(t);return n[O]=e,n}},zt=Rt({op:`Success`,prop:`value`,[k](e){let t=e.getCont(A);return t?t[A](this[O],e,this):e.yieldWith(this)}}),Bt={key:`effect/Cause/StackTrace`},Vt=Rt({op:`Failure`,prop:`cause`,[k](e){let t=this[O],n=!1;e.currentStackFrame&&(t=jt(t,{mapUnsafe:new Map([[Bt.key,e.currentStackFrame]])}),n=!0);let r=e.getCont(pt);for(;e.interruptible&&e._interruptedCause&&r;)r=e.getCont(pt);return r?r[pt](t,e,n?void 0:this):e.yieldWith(n?this:Vt(t))}}),Ht=e=>Vt(Ot(e)),Ut=e=>Vt(At(e)),Wt=Lt({op:`WithFiber`,[k](e){return this[O](e)}}),Gt=function(){class e extends globalThis.Error{}let t=It({op:`YieldableError`,[k](){return Ht(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),Kt=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return class extends Gt{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(Object.assign(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}(),qt=e=>{class t extends Kt{_tag=e}return t.prototype.name=e,t};qt(`NoSuchElementError`);const Jt=e=>It({op:e.label,[k]:e.evaluate}),Yt=e=>(t,n)=>t===n||e(t,n),Xt=`~effect/data/Option`,Zt={[Xt]:{_A:e=>e},...gt,[Symbol.iterator](){return new at(this)}},Qt=Object.assign(Object.create(Zt),{_tag:`Some`,_op:`Some`,[w](e){return tn(e)&&rn(e)&&T(this.value,e.value)},[b](){return S(x(this._tag))(x(this.value))},toString(){return`some(${E(this.value)})`},toJSON(){return{_id:`Option`,_tag:this._tag,value:it(this.value)}}});Object.defineProperty(Qt,"valueOrUndefined",{get(){return this.value}});const $t=x(`None`),en=Object.assign(Object.create(Zt),{_tag:`None`,_op:`None`,valueOrUndefined:void 0,[w](e){return tn(e)&&nn(e)},[b](){return $t},toString(){return`none()`},toJSON(){return{_id:`Option`,_tag:this._tag}}}),tn=e=>y(e,Xt),nn=e=>e._tag===`None`,rn=e=>e._tag===`Some`,an=Object.create(en),on=e=>{let t=Object.create(Qt);return t.value=e,t},sn=`~effect/data/Result`,cn={[sn]:{_A:e=>e,_E:e=>e},...gt,[Symbol.iterator](){return new at(this)}},ln=Object.assign(Object.create(cn),{_tag:`Success`,_op:`Success`,[w](e){return dn(e)&&pn(e)&&T(this.success,e.success)},[b](){return S(x(this._tag))(x(this.success))},toString(){return`success(${E(this.success)})`},toJSON(){return{_id:`Result`,_tag:this._tag,value:it(this.success)}}}),un=Object.assign(Object.create(cn),{_tag:`Failure`,_op:`Failure`,[w](e){return dn(e)&&fn(e)&&T(this.failure,e.failure)},[b](){return S(x(this._tag))(x(this.failure))},toString(){return`failure(${E(this.failure)})`},toJSON(){return{_id:`Result`,_tag:this._tag,failure:it(this.failure)}}}),dn=e=>y(e,sn),fn=e=>e._tag===`Failure`,pn=e=>e._tag===`Success`,mn=e=>{let t=Object.create(un);return t.failure=e,t},hn=e=>{let t=Object.create(ln);return t.success=e,t},gn=()=>an,j=on,_n=nn,vn=rn,yn=v(2,(e,t)=>_n(e)?gn():j(t(e.value))),bn=`~effect/Context/Service`,xn=function(){let e=Error.stackTraceLimit;Error.stackTraceLimit=2;let t=Error();Error.stackTraceLimit=e;function n(){}let r=n;return Object.setPrototypeOf(r,Sn),Object.defineProperty(r,"stack",{get(){return t.stack}}),arguments.length>0?(r.key=arguments[0],arguments[1]?.defaultValue&&(r[Cn]=Cn,r.defaultValue=arguments[1].defaultValue),r):function(e,t){return r.key=e,t?.make&&(r.make=t.make),r}},Sn={[bn]:bn,...Jt({label:`Service`,evaluate(e){return zt(Mn(e.context,this))}}),toJSON(){return{_id:`Service`,key:this.key,stack:this.stack}},of(e){return e},context(e){return An(this,e)},use(e){return Wt(t=>e(Mn(t.context,this)))},useSync(e){return Wt(t=>zt(e(Mn(t.context,this))))}},Cn=`~effect/Context/Reference`,wn=`~effect/Context`,Tn=e=>{let t=Object.create(En);return t.mapUnsafe=e,t.mutable=!1,t},En={...gt,[wn]:{_Services:e=>e},toJSON(){return{_id:`Context`,services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[w](e){if(!Dn(e)||this.mapUnsafe.size!==e.mapUnsafe.size)return!1;for(let t of this.mapUnsafe.keys())if(!e.mapUnsafe.has(t)||!T(this.mapUnsafe.get(t),e.mapUnsafe.get(t)))return!1;return!0},[b](){return ye(this.mapUnsafe.size)}},Dn=e=>y(e,wn),On=()=>kn,kn=Tn(new Map),An=(e,t)=>Tn(new Map([[e.key,t]])),jn=v(3,(e,t,n)=>Ln(e,e=>{e.set(t.key,n)})),Mn=v(2,(e,t)=>{if(!e.mapUnsafe.has(t.key)){if(Cn in t)return Fn(t);throw In(t)}return e.mapUnsafe.get(t.key)}),Nn=(e,t)=>e.mapUnsafe.has(t.key)?e.mapUnsafe.get(t.key):Fn(t),Pn=`~effect/Context/defaultValue`,Fn=e=>Pn in e?e[Pn]:e[Pn]=e.defaultValue(),In=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(e.stack){let n=e.stack.split(`
|
|
5
5
|
`);if(n.length>2){let e=n[2].match(/at (.*)/);e&&(t.message+=` (defined at ${e[1]})`)}}if(t.stack){let e=t.stack.split(`
|
|
6
6
|
`);e.splice(1,3),t.stack=e.join(`
|
|
7
|
-
`)}return t},zn=(e,t)=>{if(e.mutable)return t(e.mapUnsafe),e;let n=new Map(e.mapUnsafe);return t(n),Dn(n)},Bn=Cn,Vn=e=>e.length>0,Hn=_n,Un=gn,Wn=mn,Gn=globalThis.Array,Kn=e=>Gn.isArray(e)?e:Gn.from(e),qn=g(2,(e,t)=>[...e,t]),Jn=g(2,(e,t)=>Kn(e).concat(Kn(t)));Gn.isArray;const Yn=Vn,Xn=Vn;function Zn(e,t){return e<0||e>=t.length}const Qn=g(2,(e,t)=>{let n=Math.floor(t);if(Zn(n,e))throw Error(`Index out of bounds: ${n}`);return e[n]})(0),$n=e=>e.slice(1),er=g(3,(e,t,n)=>{let r=Kn(e),i=Kn(t);return Xn(r)?Xn(i)?ir(n)(Jn(r,i)):r:i}),tr=g(2,(e,t)=>er(e,t,qe())),nr=()=>[],rr=g(2,(e,t)=>e.map(t)),ir=g(2,(e,t)=>{let n=Kn(e);if(Xn(n)){let e=[Qn(n)],r=$n(n);for(let n of r)e.every(e=>!t(n,e))&&e.push(n);return e}return[]}),ar=Bn(`effect/Scheduler`,{defaultValue:()=>new cr}),or=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)};var sr=class{buckets=[];scheduleTask(e,t){let n=this.buckets,r=n.length,i,a=0;for(;a<r&&!(n[a][0]>t);a++)i=n[a];i&&i[0]===t?i[1].push(e):a===r?n.push([t,[e]]):n.splice(a,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}},cr=class{executionMode;setImmediate;constructor(e=`async`,t=or){this.executionMode=e,this.setImmediate=t}shouldYield(e){return e.currentOpCount>=e.maxOpsBeforeYield}makeDispatcher(){return new lr(this.setImmediate)}},lr=class{tasks=new sr;running=void 0;setImmediate;constructor(e=or){this.setImmediate=e}scheduleTask(e,t){this.tasks.scheduleTask(e,t),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let n=e[t][1];for(let e=0;e<n.length;e++)n[e]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}};const ur=Bn(`effect/Scheduler/MaxOpsBeforeYield`,{defaultValue:()=>2048}),dr=Bn(`effect/Scheduler/PreventSchedulerYield`,{defaultValue:()=>!1}),fr=`effect/Tracer/ParentSpan`;Cn()(fr);const pr=Bn(`effect/References/CurrentConcurrency`,{defaultValue:()=>`unbounded`}),mr=Bn(`effect/References/CurrentStackFrame`,{defaultValue:ae}),hr=Bn(`effect/References/CurrentLogLevel`,{defaultValue:()=>`Info`}),gr=Bn(`effect/References/MinimumLogLevel`,{defaultValue:()=>`Info`});var _r=class extends Dt{fiberId;constructor(e,t=Ot){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[S](e){return Lt(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[v](){return b(x(`${this._tag}:${this.fiberId}`))(ve(this.annotations))}};const vr=e=>new Tt([new _r(e)]),yr=e=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag===`Fail`)return Hn(n.error)}return Un(e)},br=e=>e.reasons.some(Lt),xr=g(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new Tt(tr(e.reasons,t.reasons));return C(e,n)?e:n}),Sr=e=>{let t={Fail:[],Die:[],Interrupt:[]};for(let n=0;n<e.reasons.length;n++)t[e.reasons[n]._tag].push(e.reasons[n]);return t},Cr=e=>{let t=Sr(e);return t.Fail.length>0?t.Fail[0].error:t.Die.length>0?t.Die[0].defect:t.Interrupt.length>0?new globalThis.Error(`All fibers interrupted without error`):new globalThis.Error(`Empty cause`)},wr=`~effect/Fiber/dev`,Tr={_A:ie,_E:ie},Er={id:0},Dr=()=>globalThis[Qe];var Or=class{constructor(e,t=!0){this[wr]=Tr,this.setContext(e),this.id=++Er.id,this.currentOpCount=0,this.currentLoopCount=0,this.interruptible=t,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this.runtimeMetrics?.recordFiberStart(this.context)}[wr];id;interruptible;currentOpCount;currentLoopCount;_stack;_observers;_exit;_currentExit;_children;_interruptedCause;_yielded;context;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;currentPreventYield;_dispatcher=void 0;get currentDispatcher(){return this._dispatcher??=this.currentScheduler.makeDispatcher()}getRef(e){return Fn(this.context,e)}addObserver(e){return this._exit?(e(this._exit),oe):(this._observers.push(e),()=>{let t=this._observers.indexOf(e);t>=0&&this._observers.splice(t,1)})}interruptUnsafe(e,t){if(this._exit)return;let n=vr(e);this.currentStackFrame&&(n=Pt(n,Mn(Ht,this.currentStackFrame))),t&&(n=Pt(n,t)),this._interruptedCause=this._interruptedCause?xr(this._interruptedCause,n):n,this.interruptible&&this.evaluate(Nr(this._interruptedCause))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;if(this._yielded!==void 0){let e=this._yielded;this._yielded=void 0,e()}let t=this.runLoop(e);if(t===vt)return;let n=kr.interruptChildren&&kr.interruptChildren(this);if(n!==void 0)return this.evaluate(j(n,()=>t));this._exit=t,this.runtimeMetrics?.recordFiberEnd(this.context,this._exit);for(let e=0;e<this._observers.length;e++)this._observers[e](t);this._observers.length=0}runLoop(e){let t=globalThis[Qe];globalThis[Qe]=this;let n=!1,r=e;this.currentOpCount=0;let i=++this.currentLoopCount;try{for(;;){if(this.currentOpCount++,!n&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){n=!0;let e=r;r=j(Lr,()=>e)}if(r=this.currentTracerContext?this.currentTracerContext(r,this):r[E](this),i!==this.currentLoopCount)return vt;if(r===vt){let e=this._yielded;return pt in e?(this._yielded=void 0,e):vt}}}catch(e){return _(r,E)?this.runLoop(Gt(e)):Gt(`Fiber.runLoop: Not a valid effect: ${String(r)}`)}finally{globalThis[Qe]=t}}getCont(e){for(;;){let t=this._stack.pop();if(!t)return;let n=t[_t]&&t[_t](this);if(n)return n[e]=n,n;if(t[e])return t}}yieldWith(e){return this._yielded=e,vt}children(){return this._children??=new Set}pipe(){return h(this,arguments)}setContext(e){this.context=e;let t=this.getRef(ar);t!==this.currentScheduler&&(this.currentScheduler=t,this._dispatcher=void 0),this.currentSpan=e.mapUnsafe.get(fr),this.currentLogLevel=this.getRef(hr),this.minimumLogLevel=this.getRef(gr),this.currentStackFrame=e.mapUnsafe.get(mr.key),this.maxOpsBeforeYield=this.getRef(ur),this.currentPreventYield=this.getRef(dr),this.runtimeMetrics=e.mapUnsafe.get(`effect/observability/Metric/FiberRuntimeMetricsKey`);let n=e.mapUnsafe.get(`effect/Tracer`);this.currentTracerContext=n?n.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag===`Span`?this.currentSpan:void 0}};const kr={interruptChildren:void 0},Ar=e=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(Ht.key,e.currentStackFrame),Dn(t)},jr=e=>qr(t=>{let n=e[Symbol.iterator](),r=[],i;function a(){let e=n.next();for(;!e.done;){if(e.value._exit){r.push(e.value._exit),e=n.next();continue}i=e.value.addObserver(e=>{r.push(e),a()});return}t(A(r))}return a(),Fr(()=>i?.())}),Mr=e=>Kt(t=>{let n=Ar(t);for(let r of e)r.interruptUnsafe(t.id,n);return ei(jr(e))}),A=Vt,Nr=Ut,Pr=Wt,Fr=O({op:`Sync`,[E](e){let t=this[T](),n=e.getCont(D);return n?n[D](t,e):e.yieldWith(Vt(t))}}),Ir=O({op:`Suspend`,[E](e){return this[T]()}}),Lr=O({op:`Yield`,[E](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(ci)},this[T]??0),e.yieldWith(()=>{t=!0})}})(0),Rr=e=>A(k(e)),zr=A(vn()),Br=e=>Gt(e),Vr=e=>Ir(()=>Pr(dt(e))),Hr=A(void 0),Ur=e=>Ir(()=>{try{return A(dt(e.try))}catch(t){return Pr(dt(()=>e.catch(t)))}}),Wr=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new Ui(e,`An error occurred in Effect.tryPromise`):e.catch;return Gr(function(e,r){try{dt(()=>t(r)).then(t=>e(A(t)),t=>e(Pr(dt(()=>n(t)))))}catch(t){e(Pr(dt(()=>n(t))))}},eval.length!==0)},Gr=O({op:`Async`,single:!1,[E](e){let t=dt(()=>this[T][0].bind(e.currentScheduler)),n=!1,r=!1,i=this[T][1]?new AbortController:void 0,a=t(t=>{n||(n=!0,r?e.evaluate(t):r=t)},i?.signal);return r===!1?(r=!0,e._yielded=()=>{n=!0},i===void 0&&a===void 0||e._stack.push(Kr(()=>(n=!0,i?.abort(),a??ci))),vt):r}}),Kr=O({op:`AsyncFinalizer`,[_t](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Ti))},[gt](e,t){return br(e)?j(this[T](),()=>Nr(e)):Nr(e)}}),qr=e=>Gr(e,e.length>=2),Jr=(...e)=>Ir(()=>Qr(e.length===1?e[0]():e[1].call(e[0].self))),Yr=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),Xr=(e,...t)=>Yr(e.length,t.length===0?function(){return Zr(()=>e.apply(this,arguments))}:function(){let n=Zr(()=>e.apply(this,arguments));for(let e of t)n=e(n);return n}),Zr=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return A(r.value);let i=r.value;if(i&&i._tag===`Success`){n=i.value;continue}if(i&&i._tag===`Failure`)return r.value;{let n=!0;return Ir(()=>n?(n=!1,j(r.value,e=>Qr(t,e))):Ir(()=>Qr(e())))}}}catch(e){return Br(e)}},Qr=O({op:`Iterator`,single:!1,[D](e,t){let n=this[T][0];for(;;){let r=n.next(e);if(r.done)return A(r.value);if(!M(r.value))return t._stack.push(this),r.value;if(r.value._tag===`Failure`)return r.value;e=r.value.value}},[E](e){return this[D](this[T][1],e)}}),$r=g(2,(e,t)=>{let n=A(t);return j(e,e=>n)}),ei=e=>j(e,e=>ci),j=g(2,(e,t)=>{let n=Object.create(ti);return n[T]=e,n[D]=t.length===1?t:e=>t(e),n}),ti=zt({op:`OnSuccess`,[E](e){return e._stack.push(this),this[T]}}),M=e=>pt in e,ni=g(2,(e,t)=>M(e)?e._tag===`Success`?t(e.value):e:j(e,t)),ri=g(2,(e,t)=>j(e,e=>A(dt(()=>t(e))))),ii=g(2,(e,t)=>M(e)?li(e,t):ri(e,t)),ai=g(2,(e,t)=>M(e)?ui(e,t):gi(e,t)),oi=g(2,(e,t)=>{if(M(e)){if(e._tag===`Success`)return e;let n=yr(e.cause);return Wn(n)?e:t(n.success)}return hi(e,t)}),si=e=>e._tag===`Success`,ci=Vt(void 0),li=g(2,(e,t)=>e._tag===`Success`?Vt(t(e.value)):e),ui=g(2,(e,t)=>{if(e._tag===`Success`)return e;let n=yr(e.cause);return Wn(n)?e:Wt(t(n.success))}),di=e=>si(e)?k(e.value):vn(),fi=g(2,(e,t)=>{let n=Object.create(pi);return n[T]=e,n[gt]=t.length===1?t:e=>t(e),n}),pi=zt({op:`OnFailure`,[E](e){return e._stack.push(this),this[T]}}),mi=g(3,(e,t,n)=>fi(e,e=>{let r=t(e);return Wn(r)?Nr(r.failure):dt(()=>n(r.success,e))})),hi=g(2,(e,t)=>mi(e,yr,e=>t(e))),gi=g(2,(e,t)=>hi(e,e=>Vr(()=>t(e)))),_i=e=>Si(e,{onFailure:Un,onSuccess:Hn}),vi=g(2,(e,t)=>{let n=Object.create(yi);return n[T]=e,n[D]=t.onSuccess.length===1?t.onSuccess:e=>t.onSuccess(e),n[gt]=t.onFailure.length===1?t.onFailure:e=>t.onFailure(e),n}),yi=zt({op:`OnSuccessAndFailure`,[E](e){return e._stack.push(this),this[T]}}),bi=g(2,(e,t)=>vi(e,{onFailure:e=>{let n=e.reasons.find(Ft);return n?dt(()=>t.onFailure(n.error)):Nr(e)},onSuccess:t.onSuccess})),xi=g(2,(e,t)=>bi(e,{onFailure:e=>Fr(()=>t.onFailure(e)),onSuccess:e=>Fr(()=>t.onSuccess(e))})),Si=g(2,(e,t)=>{if(M(e)){if(e._tag===`Success`)return Vt(t.onSuccess(e.value));let n=yr(e.cause);return Wn(n)?e:Vt(t.onFailure(n.success))}return xi(e,t)}),Ci=e=>M(e)?Vt(e):wi(e),wi=O({op:`Exit`,[E](e){return e._stack.push(this),this[T]},[D](e,t,n){return A(n??Vt(e))},[gt](e,t,n){return A(n??Ut(e))}}),Ti=O({op:`SetInterruptible`,[_t](e){if(e.interruptible=this[T],e._interruptedCause&&e.interruptible)return()=>Nr(e._interruptedCause)}})(!0),Ei=(e,t)=>_e(e)?t?.mode===`result`?Oi(e,_i,t):Oi(e,ie,t):t?.discard?t.mode===`result`?Oi(Object.values(e),_i,t):Oi(Object.values(e),ie,t):Ir(()=>{let n={};return $r(Oi(Object.entries(e),([e,r])=>ri(t?.mode===`result`?_i(r):r,t=>{n[e]=t}),{discard:!0,concurrency:t?.concurrency}),n)}),Di=O({op:`While`,[D](e,t){return this[T].step(e),this[T].while()?(t._stack.push(this),this[T].body()):ci},[E](e){return this[T].while()?(e._stack.push(this),this[T].body()):ci}}),Oi=g(e=>typeof e[1]==`function`,(e,t,n)=>Kt(r=>{let i=n?.concurrency===`inherit`?r.getRef(pr):n?.concurrency??1,a=i===`unbounded`?1/0:Math.max(1,i);if(a===1)return ki(e,t,n);let o=Kn(e),s=o.length;if(s===0)return n?.discard?Hr:A([]);let c=n?.discard?void 0:Array(s),l=Mi({f:t,out:c},o,{concurrency:a});return l?$r(l,c):A(c)})),ki=(e,t,n)=>Ir(()=>{let r=n?.discard?void 0:[],i=e[Symbol.iterator](),a=i.next(),o=0;return $r(Di({while:()=>!a.done,body:()=>t(a.value,o++),step:e=>{r&&r.push(e),a=i.next()}}),r)}),Ai=e=>{let t=e.onItem,n=e.step;return(e,r,i)=>{let a=i?.start??0,o=i?.end??r.length,s=i?.concurrency??1,c=!1,l,u,d,f=!1,p,ee,m=()=>{let i=!1;for(;!p&&a<o;a++){let o=r[a],te=ee??t(e,o,a);if(M(te)){if(p=n(e,o,te,a),p)break}else if(s===1)return j(Ci(te),t=>(p=n(e,o,t,a),a++,p??m()??Hr));else if(l){ee=void 0;let t=Ni(l,te,!0,!0,`inherit`);if(t._exit){if(p=n(e,o,t._exit,a),p)break;continue}u?u.add(t):u=new Set([t]);let r=a;if(t.addObserver(a=>{if(u.delete(t),p){if(!f&&a._tag===`Failure`)for(let e of a.cause.reasons)if(e._tag===`Interrupt`)continue;else p._tag===`Failure`?p.cause.reasons.push(e):p=Ut(At([e]))}else{let t=n(e,o,a,r);t&&(p=t._tag===`Failure`?Ut(At(t.cause.reasons.slice())):t,m())}if(i){let e=m();e&&d(e)}else c&&u.size===0&&d(p??Hr)}),u.size<s)continue;i=!0,a++;return}else return qr(e=>{l=Dr(),ee=te,d=e;let t=m();return t?e(t):Ir(()=>(p=ci,f=!0,u?Mr(u):Hr))})}if(c=!0,p){if(u&&u.size>0){let e=Ar(l);u.forEach(t=>t.interruptUnsafe(l.id,e));return}if(d||p._tag===`Failure`)return p}else if(d){if(u)u.size===0&&d(Hr);else return ci}};return m()}},ji=()=>Ai,Mi=Ai({onItem(e,t,n){return e.f(t,n)},step(e,t,n,r){if(n._tag===`Failure`)return n;e.out&&(e.out[r]=n.value)}}),Ni=(e,t,n=!1,r=!1,i=!1)=>{let a=i===`inherit`?e.interruptible:!i,o=new Or(e.context,a);return n?o.evaluate(t):e.currentDispatcher.scheduleTask(()=>o.evaluate(t),0),!r&&!o._exit&&(e.children().add(o),o.addObserver(()=>e._children.delete(o))),o},Pi=e=>(t,n)=>{let r=new Or(n?.scheduler?Nn(e,ar,n.scheduler):e,n?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(n?.signal){if(n.signal.aborted)r.interruptUnsafe();else{let e=()=>r.interruptUnsafe();n.signal.addEventListener(`abort`,e,{once:!0}),r.addObserver(()=>n.signal.removeEventListener(`abort`,e))}}return n?.onFiberStart&&n.onFiberStart(r),r},Fi=e=>{let t=Pi(e);return(e,n)=>{let r=t(e,n);return new Promise(e=>{r.addObserver(t=>e(t))})}},Ii=(e=>{let t=Fi(e);return(e,n)=>t(e,n).then(e=>{if(e._tag===`Failure`)throw Cr(e.cause);return e.value})})(An()),Li=e=>{let t=Pi(e);return e=>{if(M(e))return e;let n=new cr(`sync`),r=t(e,{scheduler:n});return r.currentDispatcher?.flush(),r._exit??Gt(new Vi(r))}},Ri=Li(An()),zi=(e=>{let t=Li(e);return e=>{let n=t(e);if(n._tag===`Failure`)throw Cr(n.cause);return n.value}})(An());Yt(`TimeoutError`),Yt(`IllegalArgumentError`),Yt(`ExceededCapacityError`);const Bi=`~effect/Cause/AsyncFiberError`;var Vi=class extends Yt(`AsyncFiberError`){[Bi]=Bi;constructor(e){super({message:`An asynchronous Effect was executed with Effect.runSync`,fiber:e})}};const Hi=`~effect/Cause/UnknownError`;var Ui=class extends Yt(`UnknownError`){[Hi]=Hi;constructor(e,t){super({message:t,cause:e})}};const Wi={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};Wi.gray,Wi.blue,Wi.green,Wi.yellow,Wi.red,Wi.bgBrightRed,Wi.black;const Gi=typeof process==`object`&&process!==null&&typeof process.stdout==`object`&&process.stdout!==null;Gi&&process.stdout.isTTY,Gi||`Deno`in globalThis;const Ki=Wt,qi=ci,Ji=di,Yi=yr;Cn()(`effect/Cause/StackTrace`),Cn()(`effect/Cause/InterruptorStackTrace`);const Xi=class extends re{constructor(e){super(),e&&Object.assign(this,e)}},Zi=Yt,Qi=`~effect/time/DateTime`,$i=`~effect/time/DateTime/TimeZone`,ea={[Qi]:Qi,pipe(){return h(this,arguments)},[at](){return this.toString()},toJSON(){return na(this).toJSON()}};({...ea}),{...ea};const ta={[$i]:$i,[at](){return this.toString()}};({...ta}),{...ta};const na=e=>new Date(e.epochMilliseconds),ra=Ei,N=Wr,P=A,ia=zr,aa=Rr,F=Jr,I=Pr,oa=Ur,sa=j,ca=_i,la=Ci,ua=ri,da=hi,fa=gi,pa=Ii,ma=zi,ha=Ri;Cn()(`effect/Effect/Transaction`);const ga=ii,_a=ai,va=ni,ya=oi,ba=Xr,xa=2097152,Sa=(e,t=1e4)=>(n,r)=>{let i=AbortSignal.timeout(t),a=r?.signal?AbortSignal.any([r.signal,i]):i;return e(n,{...r,signal:a})},Ca=async(e,t)=>{let n=e.headers.get(`content-length`);if(n&&Number(n)>t)return null;let{body:r}=e;if(!r){let n=new Uint8Array(await e.arrayBuffer());return n.byteLength>t?null:n}let i=r.getReader(),a=[],o=0;for(;;){let{done:e,value:n}=await i.read();if(e)break;if(o+=n.byteLength,o>t)return await i.cancel(),null;a.push(n)}let s=new Uint8Array(o),c=0;for(let e of a)s.set(e,c),c+=e.byteLength;return s},wa=async(e,t)=>{let n=await Ca(e,t);return n?new TextDecoder().decode(n):null},Ta=async(e,t)=>{let n=await Ca(e,t);return n?new Uint8Array(n).buffer:null},Ea=/<title[^>]*>(?<g1>[^<]+)<\/title>/iu,Da=/<html[^>]*lang=["']?(?<g1>[^"'\s>]+)["']?/iu,Oa=/<meta[^>]*charset=["']?(?<g1>[^"'\s>]+)["']?/iu,ka=/<meta[^>]*http-equiv=["']?content-type["']?[^>]*content=["']?[^"'>]*charset=["']?(?<g1>[^"'\s>;]+)/iu,Aa=/<head[^>]*>(?<g1>[\s\S]*?)<\/head>/iu,ja=/\b(?<g1>dark|light)\b/u,Ma=/<(?<name>meta|link)\b(?<body>(?:[^>"']|"[^"]*"|'[^']*')*)>/giu,Na=/(?<name>[^\s"'<>/=]+)(?:\s*=\s*(?:"(?<double>[^"]*)"|'(?<single>[^']*)'|(?<bare>[^\s"'=<>`]+)))?/gu,Pa=e=>{let t=new Map;for(let n of e.matchAll(Na)){let{name:e,double:r,single:i,bare:a}=n.groups??{};if(!e)continue;let o=e.toLowerCase();t.has(o)||t.set(o,r??i??a??``)}return t},Fa=e=>{let t=[];for(let n of e.matchAll(Ma)){let{name:e,body:r}=n.groups??{};(e===`meta`||e===`link`)&&t.push({attributes:Pa(r??``),name:e})}return t},Ia={amp:`&`,apos:`'`,copy:`©`,gt:`>`,hellip:`…`,ldquo:`“`,lsquo:`‘`,lt:`<`,mdash:`—`,nbsp:` `,ndash:`–`,quot:`"`,rdquo:`”`,reg:`®`,rsquo:`’`,trade:`™`},La=/&(?:#x(?<hex>[0-9a-f]{1,6})|#(?<dec>\d{1,7})|(?<named>[a-z]{2,31}));/giu,Ra=e=>e.replace(La,(e,...t)=>{let n=t.at(-1);if(n.hex!==void 0||n.dec!==void 0){let t=n.hex===void 0?Number(n.dec):Number.parseInt(n.hex,16);return t>0&&t<=1114111?String.fromCodePoint(t):e}return Ia[n.named.toLowerCase()]??e}),za=(e,t,n)=>e.attributes.get(t)?.toLowerCase()===n,Ba=(e,t)=>e.find(e=>e.name===`meta`&&za(e,`name`,t)&&e.attributes.has(`content`))?.attributes.get(`content`),Va=(e,t)=>{let n=e.trim();return n.startsWith(`http://`)||n.startsWith(`https://`)||n.startsWith(`data:`)?n:n.startsWith(`//`)?`https:${n}`:t?n.startsWith(`/`)?`${t}${n}`:`${t}/${n}`:n},Ha=(e,t)=>{let n=e.match(Ea);n&&(t.title=Ra(n[1].trim()))},Ua=(e,t)=>{let n=Ba(e,`description`);n!==void 0&&(t.description=Ra(n))},Wa=(e,t)=>{for(let[n,r]of Object.entries({"application-name":`applicationName`,author:`author`,"color-scheme":`colorScheme`,"format-detection":`formatDetection`,generator:`generator`,keywords:`keywords`,license:`license`,robots:`robots`,viewport:`viewport`})){let i=Ba(e,n);i&&(t[r]=Ra(i))}},Ga=(e,t,n,r,i)=>{for(let a of e){if(a.name!==`meta`)continue;let e=[a.attributes.get(`property`),a.attributes.get(`name`)].find(e=>e?.toLowerCase().startsWith(n)),o=a.attributes.get(`content`);if(!e||!o)continue;let s=Ra(o);t[e]=e===r?Va(s,i):s}},Ka=(e,t)=>{for(let n of e){if(n.name!==`meta`||!za(n,`name`,`theme-color`))continue;let e=n.attributes.get(`content`);if(e===void 0)continue;let r=n.attributes.get(`media`)?.match(ja)?.[1];r===`dark`?t.themeColorDark=e:r===`light`?t.themeColorLight=e:t.themeColor=e}},qa=(e,t,n)=>{let r=e.find(e=>e.name===`link`&&za(e,`rel`,`canonical`)&&e.attributes.has(`href`))?.attributes.get(`href`);r!==void 0&&(t.canonical=Va(r,n))},Ja=(e,t)=>{let n=e.match(Da);n&&(t.lang=Ra(n[1]))},Ya=(e,t)=>{let n=e.match(Oa)||e.match(ka);n&&(t.charset=Ra(n[1]))},Xa=(e,t)=>{let n=e.match(Aa);n&&(t.rawHead=n[1].trim())},Za=(e,t,n)=>{let r=[];for(let t of e){let e=t.attributes.get(`rel`),i=t.attributes.get(`href`);if(t.name!==`link`||!e?.toLowerCase().includes(`icon`)||i===void 0)continue;let a={href:Va(i,n),rel:e,sizes:t.attributes.get(`sizes`),type:t.attributes.get(`type`)};e.toLowerCase()===`shortcut icon`?r.unshift(a):r.push(a)}r.length>0&&(t.favicons=r)},Qa=(e,t)=>{let n={},r;if(t)try{r=new URL(t).origin}catch{r=void 0}let i=Fa(e);return Ha(e,n),Ua(i,n),Wa(i,n),Ga(i,n,`og:`,`og:image`,r),Ga(i,n,`twitter:`,`twitter:image`,r),Ka(i,n),qa(i,n,r),Ja(e,n),Ya(e,n),Xa(e,n),Za(i,n,r),n},$a=(e,t)=>F(function*(){let n=Sa(t?.fetch??fetch),r=yield*N({catch:t=>Error(`Failed to fetch ${e}: ${t instanceof Error?t.message:String(t)}`),try:()=>n(e,{headers:{"User-Agent":`OGTester/1.0 (+https://github.com/PunGrumpy/og-tester)`}})});if(!r.ok)return yield*I(Error(`Failed to fetch ${e}: ${r.status} ${r.statusText}`));let i=yield*N({catch:e=>Error(`Failed to read response body: ${e instanceof Error?e.message:String(e)}`),try:()=>wa(r,xa)});return i===null?yield*I(Error(`Failed to fetch ${e}: response body is too large`)):Qa(i,e)}),eo=(e,t)=>pa($a(e,t)),to=(e,t)=>F(function*(){let n=Sa(t?.fetch??fetch),r=`${(yield*oa({catch:e=>Error(`Invalid URL: ${e instanceof Error?e.message:String(e)}`),try:()=>new URL(e)})).origin}/robots.txt`,i=yield*N({catch:e=>Error(`Failed to fetch robots.txt: ${e instanceof Error?e.message:String(e)}`),try:()=>n(r)});if(!i.ok)return yield*I(Error(`Failed to fetch robots.txt: ${i.status}`));let a=yield*N({catch:e=>Error(`Failed to read robots.txt body: ${e instanceof Error?e.message:String(e)}`),try:()=>wa(i,xa)});return a===null?yield*I(Error(`Failed to read robots.txt body: response is too large`)):{content:a}}),no=async(e,t)=>{try{return await pa(to(e,t))}catch(e){return{error:e instanceof Error?e.message:String(e)}}},ro=/<url>(?<g1>[\s\S]*?)<\/url>/giu,io=/<loc>(?<g1>[^<]+)<\/loc>/iu,ao=/<lastmod>(?<g1>[^<]+)<\/lastmod>/iu,oo=/<changefreq>(?<g1>[^<]+)<\/changefreq>/iu,so=/<priority>(?<g1>[^<]+)<\/priority>/iu,co=e=>{let t=[];for(let n of e.matchAll(ro)){let[,e]=n;if(e===void 0)continue;let r=e.match(io);if(!r)continue;let i={loc:r[1].trim()},a=e.match(ao);a&&(i.lastmod=a[1].trim());let o=e.match(oo);o&&(i.changefreq=o[1].trim());let s=e.match(so);s&&(i.priority=s[1].trim()),t.push(i)}return t},lo=/<sitemap>(?<g1>[\s\S]*?)<\/sitemap>/giu,uo=e=>/<sitemapindex/iu.test(e),fo=e=>{let t=[];for(let n of e.matchAll(lo)){let[,e]=n;if(e===void 0)continue;let r=e.match(io);r&&t.push(r[1].trim())}return t},po=(e,t)=>F(function*(){let n=Sa(t?.fetch??fetch),r=yield*N({catch:t=>Error(`Failed to fetch sitemap at ${e}: ${t instanceof Error?t.message:String(t)}`),try:()=>n(e)});if(!r.ok)return yield*I(Error(`Failed to fetch sitemap at ${e}: ${r.status}`));let i=yield*N({catch:t=>Error(`Failed to read sitemap body at ${e}: ${t instanceof Error?t.message:String(t)}`),try:()=>wa(r,xa)});if(i===null)return yield*I(Error(`Failed to read sitemap body at ${e}: response is too large`));if(uo(i)){let e=fo(i);return(yield*ra(e.map(e=>po(e,t)),{concurrency:5})).flat()}return co(i)}),mo=(e,t)=>F(function*(){let n=Sa(t?.fetch??fetch),r=yield*oa({catch:e=>Error(`Invalid URL: ${e instanceof Error?e.message:String(e)}`),try:()=>new URL(e)}),i=r.pathname.endsWith(`.xml`)?r.href:`${r.origin}/sitemap.xml`,a=yield*N({catch:e=>Error(`Failed to fetch sitemap.xml: ${e instanceof Error?e.message:String(e)}`),try:()=>n(i)});if(!a.ok)return yield*I(Error(`Failed to fetch sitemap.xml: ${a.status}`));let o=yield*N({catch:e=>Error(`Failed to read sitemap.xml body: ${e instanceof Error?e.message:String(e)}`),try:()=>wa(a,xa)});if(o===null)return yield*I(Error(`Failed to read sitemap.xml body: response is too large`));if(uo(o)){let e=fo(o);return{content:o,urls:(yield*ra(e.map(e=>po(e,t)),{concurrency:5})).flat()}}return{content:o,urls:co(o)}}),ho=async(e,t)=>{try{return await pa(mo(e,t))}catch(e){return{error:e instanceof Error?e.message:String(e)}}};var go;function L(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var _o=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},vo=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(go=globalThis).__zod_globalConfig??(go.__zod_globalConfig={});const yo=globalThis.__zod_globalConfig;function bo(e){return e&&Object.assign(yo,e),yo}function xo(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function So(e,t){return typeof t==`bigint`?t.toString():t}function Co(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function wo(e){return e==null}function To(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Eo(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}const Do=Symbol(`evaluating`);function R(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Do)return r===void 0&&(r=Do,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Oo(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ko(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Ao(e){return JSON.stringify(e)}function jo(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const Mo=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function No(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Po=Co(()=>{if(yo.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Fo(e){if(No(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return No(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Io(e){return Fo(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Lo=new Set([`string`,`number`,`symbol`]);function Ro(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function zo(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function z(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Bo(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}const Vo={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ho(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return zo(e,ko(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Oo(this,`shape`,e),e},checks:[]}))}function Uo(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return zo(e,ko(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Oo(this,`shape`,r),r},checks:[]}))}function Wo(e,t){if(!Fo(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return zo(e,ko(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Oo(this,`shape`,n),n}}))}function Go(e,t){if(!Fo(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return zo(e,ko(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Oo(this,`shape`,n),n}}))}function Ko(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return zo(e,ko(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Oo(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function qo(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return zo(t,ko(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Oo(this,`shape`,i),i},checks:[]}))}function Jo(e,t,n){return zo(t,ko(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Oo(this,`shape`,i),i}}))}function Yo(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Xo(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Zo(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Qo(e){return typeof e==`string`?e:e?.message}function $o(e,t,n){let r=e.message?e.message:Qo(e.inst?._zod.def?.error?.(e))??Qo(t?.error?.(e))??Qo(n.customError?.(e))??Qo(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function es(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function ts(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}const ns=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,So,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},rs=L(`$ZodError`,ns),is=L(`$ZodError`,ns,{Parent:Error});function as(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function os(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}const ss=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new _o;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>$o(e,a,bo())));throw Mo(t,i?.callee),t}return o.value},cs=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>$o(e,a,bo())));throw Mo(t,i?.callee),t}return o.value},ls=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new _o;return a.issues.length?{success:!1,error:new(e??rs)(a.issues.map(e=>$o(e,i,bo())))}:{success:!0,data:a.value}},us=ls(is),ds=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>$o(e,i,bo())))}:{success:!0,data:a.value}},fs=ds(is),ps=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ss(e)(t,n,i)},ms=e=>(t,n,r)=>ss(e)(t,n,r),hs=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return cs(e)(t,n,i)},gs=e=>async(t,n,r)=>cs(e)(t,n,r),_s=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ls(e)(t,n,i)},vs=e=>(t,n,r)=>ls(e)(t,n,r),ys=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ds(e)(t,n,i)},bs=e=>async(t,n,r)=>ds(e)(t,n,r),xs=/^[cC][0-9a-z]{6,}$/,Ss=/^[0-9a-z]+$/,Cs=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ws=/^[0-9a-vA-V]{20}$/,Ts=/^[A-Za-z0-9]{27}$/,Es=/^[a-zA-Z0-9_-]{21}$/,Ds=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Os=/^([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})$/,ks=e=>e?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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,As=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function js(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}const Ms=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ns=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ps=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Fs=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Is=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ls=/^[A-Za-z0-9_-]*$/,Rs=/^https?$/,zs=/^\+[1-9]\d{6,14}$/,Bs=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Vs=RegExp(`^${Bs}$`);function Hs(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Us(e){return RegExp(`^${Hs(e)}$`)}function Ws(e){let t=Hs({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Bs}T(?:${r})$`)}const Gs=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Ks=/^-?\d+$/,qs=/^-?\d+(?:\.\d+)?$/,Js=/^[^A-Z]*$/,Ys=/^[^a-z]*$/,B=L(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Xs={number:`number`,bigint:`bigint`,object:`date`},Zs=L(`$ZodCheckLessThan`,(e,t)=>{B.init(e,t);let n=Xs[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Qs=L(`$ZodCheckGreaterThan`,(e,t)=>{B.init(e,t);let n=Xs[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$s=L(`$ZodCheckMultipleOf`,(e,t)=>{B.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Eo(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ec=L(`$ZodCheckNumberFormat`,(e,t)=>{B.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Vo[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Ks)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),tc=L(`$ZodCheckMaxLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!wo(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=es(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),nc=L(`$ZodCheckMinLength`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!wo(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=es(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),rc=L(`$ZodCheckLengthEquals`,(e,t)=>{var n;B.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!wo(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=es(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ic=L(`$ZodCheckStringFormat`,(e,t)=>{var n,r;B.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ac=L(`$ZodCheckRegex`,(e,t)=>{ic.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),oc=L(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Js,ic.init(e,t)}),sc=L(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Ys,ic.init(e,t)}),cc=L(`$ZodCheckIncludes`,(e,t)=>{B.init(e,t);let n=Ro(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),lc=L(`$ZodCheckStartsWith`,(e,t)=>{B.init(e,t);let n=RegExp(`^${Ro(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),uc=L(`$ZodCheckEndsWith`,(e,t)=>{B.init(e,t);let n=RegExp(`.*${Ro(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),dc=L(`$ZodCheckOverwrite`,(e,t)=>{B.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var fc=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
7
|
+
`)}return t},Ln=(e,t)=>{if(e.mutable)return t(e.mapUnsafe),e;let n=new Map(e.mapUnsafe);return t(n),Tn(n)},Rn=xn,zn=e=>e.length>0,Bn=hn,Vn=mn,Hn=fn,Un=globalThis.Array,Wn=e=>Un.isArray(e)?e:Un.from(e),Gn=v(2,(e,t)=>[...e,t]),Kn=v(2,(e,t)=>Wn(e).concat(Wn(t)));Un.isArray;const qn=zn,Jn=zn;function Yn(e,t){return e<0||e>=t.length}const Xn=v(2,(e,t)=>{let n=Math.floor(t);if(Yn(n,e))throw Error(`Index out of bounds: ${n}`);return e[n]})(0),Zn=e=>e.slice(1),Qn=v(3,(e,t,n)=>{let r=Wn(e),i=Wn(t);return Jn(r)?Jn(i)?nr(n)(Kn(r,i)):r:i}),$n=v(2,(e,t)=>Qn(e,t,Ge())),er=()=>[],tr=v(2,(e,t)=>e.map(t)),nr=v(2,(e,t)=>{let n=Wn(e);if(Jn(n)){let e=[Xn(n)],r=Zn(n);for(let n of r)e.every(e=>!t(n,e))&&e.push(n);return e}return[]}),rr=Rn(`effect/Scheduler`,{defaultValue:()=>new or}),ir=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)};var ar=class{buckets=[];scheduleTask(e,t){let n=this.buckets,r=n.length,i,a=0;for(;a<r&&!(n[a][0]>t);a++)i=n[a];i&&i[0]===t?i[1].push(e):a===r?n.push([t,[e]]):n.splice(a,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}},or=class{executionMode;setImmediate;constructor(e=`async`,t=ir){this.executionMode=e,this.setImmediate=t}shouldYield(e){return e.currentOpCount>=e.maxOpsBeforeYield}makeDispatcher(){return new sr(this.setImmediate)}},sr=class{tasks=new ar;running=void 0;setImmediate;constructor(e=ir){this.setImmediate=e}scheduleTask(e,t){this.tasks.scheduleTask(e,t),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let n=e[t][1];for(let e=0;e<n.length;e++)n[e]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}};const cr=Rn(`effect/Scheduler/MaxOpsBeforeYield`,{defaultValue:()=>2048}),lr=Rn(`effect/Scheduler/PreventSchedulerYield`,{defaultValue:()=>!1}),ur=`effect/Tracer/ParentSpan`;xn()(ur);const dr=Rn(`effect/References/CurrentConcurrency`,{defaultValue:()=>`unbounded`}),fr=Rn(`effect/References/CurrentStackFrame`,{defaultValue:re}),pr=Rn(`effect/References/CurrentLogLevel`,{defaultValue:()=>`Info`}),mr=Rn(`effect/References/MinimumLogLevel`,{defaultValue:()=>`Info`});var hr=class extends wt{fiberId;constructor(e,t=Tt){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[w](e){return Pt(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[b](){return S(C(`${this._tag}:${this.fiberId}`))(ge(this.annotations))}};const gr=e=>new St([new hr(e)]),_r=e=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag===`Fail`)return Bn(n.error)}return Vn(e)},vr=e=>e.reasons.some(Pt),yr=v(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new St($n(e.reasons,t.reasons));return T(e,n)?e:n}),br=e=>{let t={Fail:[],Die:[],Interrupt:[]};for(let n=0;n<e.reasons.length;n++)t[e.reasons[n]._tag].push(e.reasons[n]);return t},xr=e=>{let t=br(e);return t.Fail.length>0?t.Fail[0].error:t.Die.length>0?t.Die[0].defect:t.Interrupt.length>0?new globalThis.Error(`All fibers interrupted without error`):new globalThis.Error(`Empty cause`)},Sr=`~effect/Fiber/dev`,Cr={_A:ne,_E:ne},wr={id:0},Tr=()=>globalThis[Xe];var Er=class{constructor(e,t=!0){this[Sr]=Cr,this.setContext(e),this.id=++wr.id,this.currentOpCount=0,this.currentLoopCount=0,this.interruptible=t,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this.runtimeMetrics?.recordFiberStart(this.context)}[Sr];id;interruptible;currentOpCount;currentLoopCount;_stack;_observers;_exit;_currentExit;_children;_interruptedCause;_yielded;context;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;currentPreventYield;_dispatcher=void 0;get currentDispatcher(){return this._dispatcher??=this.currentScheduler.makeDispatcher()}getRef(e){return Nn(this.context,e)}addObserver(e){return this._exit?(e(this._exit),ie):(this._observers.push(e),()=>{let t=this._observers.indexOf(e);t>=0&&this._observers.splice(t,1)})}interruptUnsafe(e,t){if(this._exit)return;let n=gr(e);this.currentStackFrame&&(n=jt(n,An(Bt,this.currentStackFrame))),t&&(n=jt(n,t)),this._interruptedCause=this._interruptedCause?yr(this._interruptedCause,n):n,this.interruptible&&this.evaluate(jr(this._interruptedCause))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;if(this._yielded!==void 0){let e=this._yielded;this._yielded=void 0,e()}let t=this.runLoop(e);if(t===ht)return;let n=Dr.interruptChildren&&Dr.interruptChildren(this);if(n!==void 0)return this.evaluate(ei(n,()=>t));this._exit=t,this.runtimeMetrics?.recordFiberEnd(this.context,this._exit);for(let e=0;e<this._observers.length;e++)this._observers[e](t);this._observers.length=0}runLoop(e){let t=globalThis[Xe];globalThis[Xe]=this;let n=!1,r=e;this.currentOpCount=0;let i=++this.currentLoopCount;try{for(;;){if(this.currentOpCount++,!n&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){n=!0;let e=r;r=ei(Fr,()=>e)}if(r=this.currentTracerContext?this.currentTracerContext(r,this):r[k](this),i!==this.currentLoopCount)return ht;if(r===ht){let e=this._yielded;return ut in e?(this._yielded=void 0,e):ht}}}catch(e){return y(r,k)?this.runLoop(Ut(e)):Ut(`Fiber.runLoop: Not a valid effect: ${String(r)}`)}finally{globalThis[Xe]=t}}getCont(e){for(;;){let t=this._stack.pop();if(!t)return;let n=t[mt]&&t[mt](this);if(n)return n[e]=n,n;if(t[e])return t}}yieldWith(e){return this._yielded=e,ht}children(){return this._children??=new Set}pipe(){return _(this,arguments)}setContext(e){this.context=e;let t=this.getRef(rr);t!==this.currentScheduler&&(this.currentScheduler=t,this._dispatcher=void 0),this.currentSpan=e.mapUnsafe.get(ur),this.currentLogLevel=this.getRef(pr),this.minimumLogLevel=this.getRef(mr),this.currentStackFrame=e.mapUnsafe.get(fr.key),this.maxOpsBeforeYield=this.getRef(cr),this.currentPreventYield=this.getRef(lr),this.runtimeMetrics=e.mapUnsafe.get(`effect/observability/Metric/FiberRuntimeMetricsKey`);let n=e.mapUnsafe.get(`effect/Tracer`);this.currentTracerContext=n?n.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag===`Span`?this.currentSpan:void 0}};const Dr={interruptChildren:void 0},Or=e=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(Bt.key,e.currentStackFrame),Tn(t)},kr=e=>Kr(t=>{let n=e[Symbol.iterator](),r=[],i;function a(){let e=n.next();for(;!e.done;){if(e.value._exit){r.push(e.value._exit),e=n.next();continue}i=e.value.addObserver(e=>{r.push(e),a()});return}t(M(r))}return a(),Nr(()=>i?.())}),Ar=e=>Wt(t=>{let n=Or(t);for(let r of e)r.interruptUnsafe(t.id,n);return $r(kr(e))}),M=zt,jr=Vt,Mr=Ht,Nr=Lt({op:`Sync`,[k](e){let t=this[O](),n=e.getCont(A);return n?n[A](t,e):e.yieldWith(zt(t))}}),Pr=Lt({op:`Suspend`,[k](e){return this[O]()}}),Fr=Lt({op:`Yield`,[k](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(ci)},this[O]??0),e.yieldWith(()=>{t=!0})}})(0),Ir=e=>M(j(e)),Lr=M(gn()),Rr=e=>Ut(e),zr=e=>Pr(()=>Mr(D(e))),Br=M(void 0),Vr=e=>Pr(()=>{try{return M(D(e.try))}catch(t){return Mr(D(()=>e.catch(t)))}}),Hr=e=>Wr(function(t,n){D(()=>e(n)).then(e=>t(M(e)),e=>t(Rr(e)))},e.length!==0),Ur=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new Ui(e,`An error occurred in Effect.tryPromise`):e.catch;return Wr(function(e,r){try{D(()=>t(r)).then(t=>e(M(t)),t=>e(Mr(D(()=>n(t)))))}catch(t){e(Mr(D(()=>n(t))))}},eval.length!==0)},Wr=Lt({op:`Async`,single:!1,[k](e){let t=D(()=>this[O][0].bind(e.currentScheduler)),n=!1,r=!1,i=this[O][1]?new AbortController:void 0,a=t(t=>{n||(n=!0,r?e.evaluate(t):r=t)},i?.signal);return r===!1?(r=!0,e._yielded=()=>{n=!0},i===void 0&&a===void 0||e._stack.push(Gr(()=>(n=!0,i?.abort(),a??ci))),ht):r}}),Gr=Lt({op:`AsyncFinalizer`,[mt](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Ti))},[pt](e,t){return vr(e)?ei(this[O](),()=>jr(e)):jr(e)}}),Kr=e=>Wr(e,e.length>=2),qr=(...e)=>Pr(()=>Zr(e.length===1?e[0]():e[1].call(e[0].self))),Jr=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),Yr=(e,...t)=>Jr(e.length,t.length===0?function(){return Xr(()=>e.apply(this,arguments))}:function(){let n=Xr(()=>e.apply(this,arguments));for(let e of t)n=e(n);return n}),Xr=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return M(r.value);let i=r.value;if(i&&i._tag===`Success`){n=i.value;continue}if(i&&i._tag===`Failure`)return r.value;{let n=!0;return Pr(()=>n?(n=!1,ei(r.value,e=>Zr(t,e))):Pr(()=>Zr(e())))}}}catch(e){return Rr(e)}},Zr=Lt({op:`Iterator`,single:!1,[A](e,t){let n=this[O][0];for(;;){let r=n.next(e);if(r.done)return M(r.value);if(!N(r.value))return t._stack.push(this),r.value;if(r.value._tag===`Failure`)return r.value;e=r.value.value}},[k](e){return this[A](this[O][1],e)}}),Qr=v(2,(e,t)=>{let n=M(t);return ei(e,e=>n)}),$r=e=>ei(e,e=>ci),ei=v(2,(e,t)=>{let n=Object.create(ti);return n[O]=e,n[A]=t.length===1?t:e=>t(e),n}),ti=It({op:`OnSuccess`,[k](e){return e._stack.push(this),this[O]}}),N=e=>ut in e,ni=v(2,(e,t)=>N(e)?e._tag===`Success`?t(e.value):e:ei(e,t)),ri=v(2,(e,t)=>ei(e,e=>M(D(()=>t(e))))),ii=v(2,(e,t)=>N(e)?li(e,t):ri(e,t)),ai=v(2,(e,t)=>N(e)?ui(e,t):gi(e,t)),oi=v(2,(e,t)=>{if(N(e)){if(e._tag===`Success`)return e;let n=_r(e.cause);return Hn(n)?e:t(n.success)}return hi(e,t)}),si=e=>e._tag===`Success`,ci=zt(void 0),li=v(2,(e,t)=>e._tag===`Success`?zt(t(e.value)):e),ui=v(2,(e,t)=>{if(e._tag===`Success`)return e;let n=_r(e.cause);return Hn(n)?e:Ht(t(n.success))}),di=e=>si(e)?j(e.value):gn(),fi=v(2,(e,t)=>{let n=Object.create(pi);return n[O]=e,n[pt]=t.length===1?t:e=>t(e),n}),pi=It({op:`OnFailure`,[k](e){return e._stack.push(this),this[O]}}),mi=v(3,(e,t,n)=>fi(e,e=>{let r=t(e);return Hn(r)?jr(r.failure):D(()=>n(r.success,e))})),hi=v(2,(e,t)=>mi(e,_r,e=>t(e))),gi=v(2,(e,t)=>hi(e,e=>zr(()=>t(e)))),_i=e=>Si(e,{onFailure:Vn,onSuccess:Bn}),vi=v(2,(e,t)=>{let n=Object.create(yi);return n[O]=e,n[A]=t.onSuccess.length===1?t.onSuccess:e=>t.onSuccess(e),n[pt]=t.onFailure.length===1?t.onFailure:e=>t.onFailure(e),n}),yi=It({op:`OnSuccessAndFailure`,[k](e){return e._stack.push(this),this[O]}}),bi=v(2,(e,t)=>vi(e,{onFailure:e=>{let n=e.reasons.find(Mt);return n?D(()=>t.onFailure(n.error)):jr(e)},onSuccess:t.onSuccess})),xi=v(2,(e,t)=>bi(e,{onFailure:e=>Nr(()=>t.onFailure(e)),onSuccess:e=>Nr(()=>t.onSuccess(e))})),Si=v(2,(e,t)=>{if(N(e)){if(e._tag===`Success`)return zt(t.onSuccess(e.value));let n=_r(e.cause);return Hn(n)?e:zt(t.onFailure(n.success))}return xi(e,t)}),Ci=e=>N(e)?zt(e):wi(e),wi=Lt({op:`Exit`,[k](e){return e._stack.push(this),this[O]},[A](e,t,n){return M(n??zt(e))},[pt](e,t,n){return M(n??Vt(e))}}),Ti=Lt({op:`SetInterruptible`,[mt](e){if(e.interruptible=this[O],e._interruptedCause&&e.interruptible)return()=>jr(e._interruptedCause)}})(!0),Ei=(e,t)=>he(e)?t?.mode===`result`?Oi(e,_i,t):Oi(e,ne,t):t?.discard?t.mode===`result`?Oi(Object.values(e),_i,t):Oi(Object.values(e),ne,t):Pr(()=>{let n={};return Qr(Oi(Object.entries(e),([e,r])=>ri(t?.mode===`result`?_i(r):r,t=>{n[e]=t}),{discard:!0,concurrency:t?.concurrency}),n)}),Di=Lt({op:`While`,[A](e,t){return this[O].step(e),this[O].while()?(t._stack.push(this),this[O].body()):ci},[k](e){return this[O].while()?(e._stack.push(this),this[O].body()):ci}}),Oi=v(e=>typeof e[1]==`function`,(e,t,n)=>Wt(r=>{let i=n?.concurrency===`inherit`?r.getRef(dr):n?.concurrency??1,a=i===`unbounded`?1/0:Math.max(1,i);if(a===1)return ki(e,t,n);let o=Wn(e),s=o.length;if(s===0)return n?.discard?Br:M([]);let c=n?.discard?void 0:Array(s),l=Mi({f:t,out:c},o,{concurrency:a});return l?Qr(l,c):M(c)})),ki=(e,t,n)=>Pr(()=>{let r=n?.discard?void 0:[],i=e[Symbol.iterator](),a=i.next(),o=0;return Qr(Di({while:()=>!a.done,body:()=>t(a.value,o++),step:e=>{r&&r.push(e),a=i.next()}}),r)}),Ai=e=>{let t=e.onItem,n=e.step;return(e,r,i)=>{let a=i?.start??0,o=i?.end??r.length,s=i?.concurrency??1,c=!1,l,u,d,f=!1,p,m,h=()=>{let i=!1;for(;!p&&a<o;a++){let o=r[a],g=m??t(e,o,a);if(N(g)){if(p=n(e,o,g,a),p)break}else if(s===1)return ei(Ci(g),t=>(p=n(e,o,t,a),a++,p??h()??Br));else if(l){m=void 0;let t=Ni(l,g,!0,!0,`inherit`);if(t._exit){if(p=n(e,o,t._exit,a),p)break;continue}u?u.add(t):u=new Set([t]);let r=a;if(t.addObserver(a=>{if(u.delete(t),p){if(!f&&a._tag===`Failure`)for(let e of a.cause.reasons)if(e._tag===`Interrupt`)continue;else p._tag===`Failure`?p.cause.reasons.push(e):p=Vt(Dt([e]))}else{let t=n(e,o,a,r);t&&(p=t._tag===`Failure`?Vt(Dt(t.cause.reasons.slice())):t,h())}if(i){let e=h();e&&d(e)}else c&&u.size===0&&d(p??Br)}),u.size<s)continue;i=!0,a++;return}else return Kr(e=>{l=Tr(),m=g,d=e;let t=h();return t?e(t):Pr(()=>(p=ci,f=!0,u?Ar(u):Br))})}if(c=!0,p){if(u&&u.size>0){let e=Or(l);u.forEach(t=>t.interruptUnsafe(l.id,e));return}if(d||p._tag===`Failure`)return p}else if(d){if(u)u.size===0&&d(Br);else return ci}};return h()}},ji=()=>Ai,Mi=Ai({onItem(e,t,n){return e.f(t,n)},step(e,t,n,r){if(n._tag===`Failure`)return n;e.out&&(e.out[r]=n.value)}}),Ni=(e,t,n=!1,r=!1,i=!1)=>{let a=i===`inherit`?e.interruptible:!i,o=new Er(e.context,a);return n?o.evaluate(t):e.currentDispatcher.scheduleTask(()=>o.evaluate(t),0),!r&&!o._exit&&(e.children().add(o),o.addObserver(()=>e._children.delete(o))),o},Pi=e=>(t,n)=>{let r=new Er(n?.scheduler?jn(e,rr,n.scheduler):e,n?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(n?.signal){if(n.signal.aborted)r.interruptUnsafe();else{let e=()=>r.interruptUnsafe();n.signal.addEventListener(`abort`,e,{once:!0}),r.addObserver(()=>n.signal.removeEventListener(`abort`,e))}}return n?.onFiberStart&&n.onFiberStart(r),r},Fi=e=>{let t=Pi(e);return(e,n)=>{let r=t(e,n);return new Promise(e=>{r.addObserver(t=>e(t))})}},Ii=(e=>{let t=Fi(e);return(e,n)=>t(e,n).then(e=>{if(e._tag===`Failure`)throw xr(e.cause);return e.value})})(On()),Li=e=>{let t=Pi(e);return e=>{if(N(e))return e;let n=new or(`sync`),r=t(e,{scheduler:n});return r.currentDispatcher?.flush(),r._exit??Ut(new Vi(r))}},Ri=Li(On()),zi=(e=>{let t=Li(e);return e=>{let n=t(e);if(n._tag===`Failure`)throw xr(n.cause);return n.value}})(On());qt(`TimeoutError`),qt(`IllegalArgumentError`),qt(`ExceededCapacityError`);const Bi=`~effect/Cause/AsyncFiberError`;var Vi=class extends qt(`AsyncFiberError`){[Bi]=Bi;constructor(e){super({message:`An asynchronous Effect was executed with Effect.runSync`,fiber:e})}};const Hi=`~effect/Cause/UnknownError`;var Ui=class extends qt(`UnknownError`){[Hi]=Hi;constructor(e,t){super({message:t,cause:e})}};const Wi={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};Wi.gray,Wi.blue,Wi.green,Wi.yellow,Wi.red,Wi.bgBrightRed,Wi.black;const Gi=typeof process==`object`&&process!==null&&typeof process.stdout==`object`&&process.stdout!==null;Gi&&process.stdout.isTTY,Gi||`Deno`in globalThis;const Ki=Ht,qi=ci,Ji=di,Yi=_r;xn()(`effect/Cause/StackTrace`),xn()(`effect/Cause/InterruptorStackTrace`);const Xi=class extends te{constructor(e){super(),e&&Object.assign(this,e)}},Zi=qt,Qi=`~effect/time/DateTime`,$i=`~effect/time/DateTime/TimeZone`,ea={[Qi]:Qi,pipe(){return _(this,arguments)},[rt](){return this.toString()},toJSON(){return na(this).toJSON()}};({...ea}),{...ea};const ta={[$i]:$i,[rt](){return this.toString()}};({...ta}),{...ta};const na=e=>new Date(e.epochMilliseconds),ra=Ei,ia=Hr,P=Ur,F=M,aa=Lr,oa=Ir,I=qr,L=Mr,sa=Vr,ca=ei,la=_i,ua=Ci,da=ri,fa=gi,pa=Ii,ma=zi,ha=Ri;xn()(`effect/Effect/Transaction`);const ga=ii,_a=ai,va=ni,ya=oi,ba=Yr,xa=2097152,Sa=(e,t=1e4)=>(n,r)=>{let i=AbortSignal.timeout(t),a=r?.signal?AbortSignal.any([r.signal,i]):i;return e(n,{...r,signal:a})},Ca=async(e,t)=>{let n=e.headers.get(`content-length`);if(n&&Number(n)>t)return null;let{body:r}=e;if(!r){let n=new Uint8Array(await e.arrayBuffer());return n.byteLength>t?null:n}let i=r.getReader(),a=[],o=0;for(;;){let{done:e,value:n}=await i.read();if(e)break;if(o+=n.byteLength,o>t)return await i.cancel(),null;a.push(n)}let s=new Uint8Array(o),c=0;for(let e of a)s.set(e,c),c+=e.byteLength;return s},wa=async(e,t)=>{let n=await Ca(e,t);return n?new TextDecoder().decode(n):null},Ta=async(e,t)=>{let n=await Ca(e,t);return n?new Uint8Array(n).buffer:null},Ea=/<title[^>]*>(?<g1>[^<]+)<\/title>/iu,Da=/<html[^>]*lang=["']?(?<g1>[^"'\s>]+)["']?/iu,Oa=/<meta[^>]*charset=["']?(?<g1>[^"'\s>]+)["']?/iu,ka=/<meta[^>]*http-equiv=["']?content-type["']?[^>]*content=["']?[^"'>]*charset=["']?(?<g1>[^"'\s>;]+)/iu,Aa=/<head[^>]*>(?<g1>[\s\S]*?)<\/head>/iu,ja=/\b(?<g1>dark|light)\b/u,Ma=/<(?<name>meta|link)\b(?<body>(?:[^>"']|"[^"]*"|'[^']*')*)>/giu,Na=/(?<name>[^\s"'<>/=]+)(?:\s*=\s*(?:"(?<double>[^"]*)"|'(?<single>[^']*)'|(?<bare>[^\s"'=<>`]+)))?/gu,Pa=e=>{let t=new Map;for(let n of e.matchAll(Na)){let{name:e,double:r,single:i,bare:a}=n.groups??{};if(!e)continue;let o=e.toLowerCase();t.has(o)||t.set(o,r??i??a??``)}return t},Fa=e=>{let t=[];for(let n of e.matchAll(Ma)){let{name:e,body:r}=n.groups??{};(e===`meta`||e===`link`)&&t.push({attributes:Pa(r??``),name:e})}return t},Ia={amp:`&`,apos:`'`,copy:`©`,gt:`>`,hellip:`…`,ldquo:`“`,lsquo:`‘`,lt:`<`,mdash:`—`,nbsp:` `,ndash:`–`,quot:`"`,rdquo:`”`,reg:`®`,rsquo:`’`,trade:`™`},La=/&(?:#x(?<hex>[0-9a-f]{1,6})|#(?<dec>\d{1,7})|(?<named>[a-z]{2,31}));/giu,Ra=e=>e.replace(La,(e,...t)=>{let n=t.at(-1);if(n.hex!==void 0||n.dec!==void 0){let t=n.hex===void 0?Number(n.dec):Number.parseInt(n.hex,16);return t>0&&t<=1114111?String.fromCodePoint(t):e}return Ia[n.named.toLowerCase()]??e}),za=(e,t,n)=>e.attributes.get(t)?.toLowerCase()===n,Ba=(e,t)=>e.find(e=>e.name===`meta`&&za(e,`name`,t)&&e.attributes.has(`content`))?.attributes.get(`content`),Va=(e,t)=>{let n=e.trim();return n.startsWith(`http://`)||n.startsWith(`https://`)||n.startsWith(`data:`)?n:n.startsWith(`//`)?`https:${n}`:t?n.startsWith(`/`)?`${t}${n}`:`${t}/${n}`:n},Ha=(e,t)=>{let n=e.match(Ea);n&&(t.title=Ra(n[1].trim()))},Ua=(e,t)=>{let n=Ba(e,`description`);n!==void 0&&(t.description=Ra(n))},Wa=(e,t)=>{for(let[n,r]of Object.entries({"application-name":`applicationName`,author:`author`,"color-scheme":`colorScheme`,"format-detection":`formatDetection`,generator:`generator`,keywords:`keywords`,license:`license`,robots:`robots`,viewport:`viewport`})){let i=Ba(e,n);i&&(t[r]=Ra(i))}},Ga=(e,t,n,r,i)=>{for(let a of e){if(a.name!==`meta`)continue;let e=[a.attributes.get(`property`),a.attributes.get(`name`)].find(e=>e?.toLowerCase().startsWith(n)),o=a.attributes.get(`content`);if(!e||!o)continue;let s=Ra(o);t[e]=e===r?Va(s,i):s}},Ka=(e,t)=>{for(let n of e){if(n.name!==`meta`||!za(n,`name`,`theme-color`))continue;let e=n.attributes.get(`content`);if(e===void 0)continue;let r=n.attributes.get(`media`)?.match(ja)?.[1];r===`dark`?t.themeColorDark=e:r===`light`?t.themeColorLight=e:t.themeColor=e}},qa=(e,t,n)=>{let r=e.find(e=>e.name===`link`&&za(e,`rel`,`canonical`)&&e.attributes.has(`href`))?.attributes.get(`href`);r!==void 0&&(t.canonical=Va(r,n))},Ja=(e,t)=>{let n=e.match(Da);n&&(t.lang=Ra(n[1]))},Ya=(e,t)=>{let n=e.match(Oa)||e.match(ka);n&&(t.charset=Ra(n[1]))},Xa=(e,t)=>{let n=e.match(Aa);n&&(t.rawHead=n[1].trim())},Za=(e,t,n)=>{let r=[];for(let t of e){let e=t.attributes.get(`rel`),i=t.attributes.get(`href`);if(t.name!==`link`||!e?.toLowerCase().includes(`icon`)||i===void 0)continue;let a={href:Va(i,n),rel:e,sizes:t.attributes.get(`sizes`),type:t.attributes.get(`type`)};e.toLowerCase()===`shortcut icon`?r.unshift(a):r.push(a)}r.length>0&&(t.favicons=r)},Qa=(e,t)=>{let n={},r;if(t)try{r=new URL(t).origin}catch{r=void 0}let i=Fa(e);return Ha(e,n),Ua(i,n),Wa(i,n),Ga(i,n,`og:`,`og:image`,r),Ga(i,n,`twitter:`,`twitter:image`,r),Ka(i,n),qa(i,n,r),Ja(e,n),Ya(e,n),Xa(e,n),Za(i,n,r),n},$a=`OGTester/1.0 (+https://github.com/PunGrumpy/og-tester)`,eo=(e,t)=>I(function*(){let n=Sa(t?.fetch??fetch),r=yield*P({catch:t=>Error(`Failed to fetch ${e}: ${t instanceof Error?t.message:String(t)}`),try:()=>n(e,{headers:{"User-Agent":$a}})});if(!r.ok)return yield*L(Error(`Failed to fetch ${e}: ${r.status} ${r.statusText}`));let i=yield*P({catch:e=>Error(`Failed to read response body: ${e instanceof Error?e.message:String(e)}`),try:()=>wa(r,xa)});return i===null?yield*L(Error(`Failed to fetch ${e}: response body is too large`)):Qa(i,e)}),to=(e,t)=>pa(eo(e,t)),no=(e,t)=>I(function*(){let n=Sa(t?.fetch??fetch),r=`${(yield*sa({catch:e=>Error(`Invalid URL: ${e instanceof Error?e.message:String(e)}`),try:()=>new URL(e)})).origin}/robots.txt`,i=yield*P({catch:e=>Error(`Failed to fetch robots.txt: ${e instanceof Error?e.message:String(e)}`),try:()=>n(r)});if(!i.ok)return yield*L(Error(`Failed to fetch robots.txt: ${i.status}`));let a=yield*P({catch:e=>Error(`Failed to read robots.txt body: ${e instanceof Error?e.message:String(e)}`),try:()=>wa(i,xa)});return a===null?yield*L(Error(`Failed to read robots.txt body: response is too large`)):{content:a}}),ro=async(e,t)=>{try{return await pa(no(e,t))}catch(e){return{error:e instanceof Error?e.message:String(e)}}},io=/<url>(?<g1>[\s\S]*?)<\/url>/giu,ao=/<loc>(?<g1>[^<]+)<\/loc>/iu,oo=/<lastmod>(?<g1>[^<]+)<\/lastmod>/iu,so=/<changefreq>(?<g1>[^<]+)<\/changefreq>/iu,co=/<priority>(?<g1>[^<]+)<\/priority>/iu,lo=e=>{let t=[];for(let n of e.matchAll(io)){let[,e]=n;if(e===void 0)continue;let r=e.match(ao);if(!r)continue;let i={loc:r[1].trim()},a=e.match(oo);a&&(i.lastmod=a[1].trim());let o=e.match(so);o&&(i.changefreq=o[1].trim());let s=e.match(co);s&&(i.priority=s[1].trim()),t.push(i)}return t},uo=/<sitemap>(?<g1>[\s\S]*?)<\/sitemap>/giu,fo=e=>/<sitemapindex/iu.test(e),po=e=>{let t=[];for(let n of e.matchAll(uo)){let[,e]=n;if(e===void 0)continue;let r=e.match(ao);r&&t.push(r[1].trim())}return t},mo=(e,t)=>I(function*(){let n=Sa(t?.fetch??fetch),r=yield*P({catch:t=>Error(`Failed to fetch sitemap at ${e}: ${t instanceof Error?t.message:String(t)}`),try:()=>n(e)});if(!r.ok)return yield*L(Error(`Failed to fetch sitemap at ${e}: ${r.status}`));let i=yield*P({catch:t=>Error(`Failed to read sitemap body at ${e}: ${t instanceof Error?t.message:String(t)}`),try:()=>wa(r,xa)});if(i===null)return yield*L(Error(`Failed to read sitemap body at ${e}: response is too large`));if(fo(i)){let e=po(i);return(yield*ra(e.map(e=>mo(e,t)),{concurrency:5})).flat()}return lo(i)}),ho=(e,t)=>I(function*(){let n=Sa(t?.fetch??fetch),r=yield*sa({catch:e=>Error(`Invalid URL: ${e instanceof Error?e.message:String(e)}`),try:()=>new URL(e)}),i=r.pathname.endsWith(`.xml`)?r.href:`${r.origin}/sitemap.xml`,a=yield*P({catch:e=>Error(`Failed to fetch sitemap.xml: ${e instanceof Error?e.message:String(e)}`),try:()=>n(i)});if(!a.ok)return yield*L(Error(`Failed to fetch sitemap.xml: ${a.status}`));let o=yield*P({catch:e=>Error(`Failed to read sitemap.xml body: ${e instanceof Error?e.message:String(e)}`),try:()=>wa(a,xa)});if(o===null)return yield*L(Error(`Failed to read sitemap.xml body: response is too large`));if(fo(o)){let e=po(o);return{content:o,urls:(yield*ra(e.map(e=>mo(e,t)),{concurrency:5})).flat()}}return{content:o,urls:lo(o)}}),go=async(e,t)=>{try{return await pa(ho(e,t))}catch(e){return{error:e instanceof Error?e.message:String(e)}}};var _o;function R(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var vo=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},yo=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(_o=globalThis).__zod_globalConfig??(_o.__zod_globalConfig={});const bo=globalThis.__zod_globalConfig;function xo(e){return e&&Object.assign(bo,e),bo}function So(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Co(e,t){return typeof t==`bigint`?t.toString():t}function wo(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function To(e){return e==null}function Eo(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Do(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}const Oo=Symbol(`evaluating`);function z(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Oo)return r===void 0&&(r=Oo,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function ko(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ao(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function jo(e){return JSON.stringify(e)}function Mo(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const No=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Po(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Fo=wo(()=>{if(bo.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Io(e){if(Po(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Po(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Lo(e){return Io(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Ro=new Set([`string`,`number`,`symbol`]);function zo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Bo(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function B(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Vo(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}const Ho={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Uo(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Bo(e,Ao(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return ko(this,`shape`,e),e},checks:[]}))}function Wo(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Bo(e,Ao(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return ko(this,`shape`,r),r},checks:[]}))}function Go(e,t){if(!Io(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Bo(e,Ao(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ko(this,`shape`,n),n}}))}function Ko(e,t){if(!Io(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Bo(e,Ao(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ko(this,`shape`,n),n}}))}function qo(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Bo(e,Ao(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ko(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Jo(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return Bo(t,Ao(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return ko(this,`shape`,i),i},checks:[]}))}function Yo(e,t,n){return Bo(t,Ao(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return ko(this,`shape`,i),i}}))}function Xo(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Zo(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Qo(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function $o(e){return typeof e==`string`?e:e?.message}function es(e,t,n){let r=e.message?e.message:$o(e.inst?._zod.def?.error?.(e))??$o(t?.error?.(e))??$o(n.customError?.(e))??$o(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function ts(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function ns(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}const rs=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Co,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},is=R(`$ZodError`,rs),as=R(`$ZodError`,rs,{Parent:Error});function os(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ss(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}const cs=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new vo;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>es(e,a,xo())));throw No(t,i?.callee),t}return o.value},ls=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>es(e,a,xo())));throw No(t,i?.callee),t}return o.value},us=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new vo;return a.issues.length?{success:!1,error:new(e??is)(a.issues.map(e=>es(e,i,xo())))}:{success:!0,data:a.value}},ds=us(as),fs=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>es(e,i,xo())))}:{success:!0,data:a.value}},ps=fs(as),ms=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return cs(e)(t,n,i)},hs=e=>(t,n,r)=>cs(e)(t,n,r),gs=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ls(e)(t,n,i)},_s=e=>async(t,n,r)=>ls(e)(t,n,r),vs=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return us(e)(t,n,i)},ys=e=>(t,n,r)=>us(e)(t,n,r),bs=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return fs(e)(t,n,i)},xs=e=>async(t,n,r)=>fs(e)(t,n,r),Ss=/^[cC][0-9a-z]{6,}$/,Cs=/^[0-9a-z]+$/,ws=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ts=/^[0-9a-vA-V]{20}$/,Es=/^[A-Za-z0-9]{27}$/,Ds=/^[a-zA-Z0-9_-]{21}$/,Os=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ks=/^([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})$/,As=e=>e?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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,js=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Ms(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}const Ns=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ps=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Fs=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Is=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ls=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Rs=/^[A-Za-z0-9_-]*$/,zs=/^https?$/,Bs=/^\+[1-9]\d{6,14}$/,Vs=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Hs=RegExp(`^${Vs}$`);function Us(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ws(e){return RegExp(`^${Us(e)}$`)}function Gs(e){let t=Us({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Vs}T(?:${r})$`)}const Ks=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},qs=/^-?\d+$/,Js=/^-?\d+(?:\.\d+)?$/,Ys=/^[^A-Z]*$/,Xs=/^[^a-z]*$/,V=R(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Zs={number:`number`,bigint:`bigint`,object:`date`},Qs=R(`$ZodCheckLessThan`,(e,t)=>{V.init(e,t);let n=Zs[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$s=R(`$ZodCheckGreaterThan`,(e,t)=>{V.init(e,t);let n=Zs[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ec=R(`$ZodCheckMultipleOf`,(e,t)=>{V.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Do(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),tc=R(`$ZodCheckNumberFormat`,(e,t)=>{V.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Ho[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=qs)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),nc=R(`$ZodCheckMaxLength`,(e,t)=>{var n;V.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!To(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=ts(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),rc=R(`$ZodCheckMinLength`,(e,t)=>{var n;V.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!To(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=ts(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ic=R(`$ZodCheckLengthEquals`,(e,t)=>{var n;V.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!To(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=ts(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ac=R(`$ZodCheckStringFormat`,(e,t)=>{var n,r;V.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),oc=R(`$ZodCheckRegex`,(e,t)=>{ac.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),sc=R(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ys,ac.init(e,t)}),cc=R(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Xs,ac.init(e,t)}),lc=R(`$ZodCheckIncludes`,(e,t)=>{V.init(e,t);let n=zo(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),uc=R(`$ZodCheckStartsWith`,(e,t)=>{V.init(e,t);let n=RegExp(`^${zo(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),dc=R(`$ZodCheckEndsWith`,(e,t)=>{V.init(e,t);let n=RegExp(`.*${zo(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),fc=R(`$ZodCheckOverwrite`,(e,t)=>{V.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var pc=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
8
8
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
9
|
-
`))}};const
|
|
9
|
+
`))}};const mc={major:4,minor:4,patch:3},H=R(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=mc;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=Xo(e),i;for(let a of t){if(a._zod.def.when){if(Zo(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new vo;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Xo(e,t))});else{if(e.issues.length===t)continue;r||=Xo(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Xo(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new vo;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new vo;return o.then(e=>t(e,r,a))}return t(o,r,a)}}z(e,`~standard`,()=>({validate:t=>{try{let n=ds(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return ps(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),hc=R(`$ZodString`,(e,t)=>{H.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ks(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),U=R(`$ZodStringFormat`,(e,t)=>{ac.init(e,t),hc.init(e,t)}),gc=R(`$ZodGUID`,(e,t)=>{t.pattern??=ks,U.init(e,t)}),_c=R(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=As(e)}else t.pattern??=As();U.init(e,t)}),vc=R(`$ZodEmail`,(e,t)=>{t.pattern??=js,U.init(e,t)}),yc=R(`$ZodURL`,(e,t)=>{U.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===zs.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),n.value=t.normalize?i.href:r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),bc=R(`$ZodEmoji`,(e,t)=>{t.pattern??=Ms(),U.init(e,t)}),xc=R(`$ZodNanoID`,(e,t)=>{t.pattern??=Ds,U.init(e,t)}),Sc=R(`$ZodCUID`,(e,t)=>{t.pattern??=Ss,U.init(e,t)}),Cc=R(`$ZodCUID2`,(e,t)=>{t.pattern??=Cs,U.init(e,t)}),wc=R(`$ZodULID`,(e,t)=>{t.pattern??=ws,U.init(e,t)}),Tc=R(`$ZodXID`,(e,t)=>{t.pattern??=Ts,U.init(e,t)}),Ec=R(`$ZodKSUID`,(e,t)=>{t.pattern??=Es,U.init(e,t)}),Dc=R(`$ZodISODateTime`,(e,t)=>{t.pattern??=Gs(t),U.init(e,t)}),Oc=R(`$ZodISODate`,(e,t)=>{t.pattern??=Hs,U.init(e,t)}),kc=R(`$ZodISOTime`,(e,t)=>{t.pattern??=Ws(t),U.init(e,t)}),Ac=R(`$ZodISODuration`,(e,t)=>{t.pattern??=Os,U.init(e,t)}),jc=R(`$ZodIPv4`,(e,t)=>{t.pattern??=Ns,U.init(e,t),e._zod.bag.format=`ipv4`}),Mc=R(`$ZodIPv6`,(e,t)=>{t.pattern??=Ps,U.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Nc=R(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Fs,U.init(e,t)}),Pc=R(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Is,U.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Fc(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Ic=R(`$ZodBase64`,(e,t)=>{t.pattern??=Ls,U.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Fc(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Lc(e){if(!Rs.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Fc(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const Rc=R(`$ZodBase64URL`,(e,t)=>{t.pattern??=Rs,U.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Lc(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),zc=R(`$ZodE164`,(e,t)=>{t.pattern??=Bs,U.init(e,t)});function Bc(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const Vc=R(`$ZodJWT`,(e,t)=>{U.init(e,t),e._zod.check=n=>{Bc(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Hc=R(`$ZodNumber`,(e,t)=>{H.init(e,t),e._zod.pattern=e._zod.bag.pattern??Js,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Uc=R(`$ZodNumberFormat`,(e,t)=>{tc.init(e,t),Hc.init(e,t)}),Wc=R(`$ZodUnknown`,(e,t)=>{H.init(e,t),e._zod.parse=e=>e}),Gc=R(`$ZodNever`,(e,t)=>{H.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Kc(e,t,n){e.issues.length&&t.issues.push(...Qo(n,e.issues)),t.value[n]=e.value}const qc=R(`$ZodArray`,(e,t)=>{H.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Kc(t,n,e))):Kc(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Jc(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...Qo(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Yc(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Vo(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Xc(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Jc(e,n,i,t,u,d))):Jc(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const Zc=R(`$ZodObject`,(e,t)=>{if(H.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=wo(()=>Yc(t));z(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Po,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>Jc(n,t,e,s,r,i))):Jc(a,t,e,s,r,i)}return i?Xc(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Qc=R(`$ZodObjectJIT`,(e,t)=>{Zc.init(e,t);let n=e._zod.parse,r=wo(()=>Yc(t)),i=e=>{let t=new pc([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=jo(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=jo(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
10
10
|
if (${n}.issues.length) {
|
|
11
11
|
if (${o} in input) {
|
|
12
12
|
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
@@ -65,25 +65,27 @@ import{Command as e,InvalidArgumentError as t}from"commander";import{setTimeout
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=No,s=!yo.jitless,c=s&&Po.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Yc([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Qc(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Yo(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>$o(e,r,bo())))}),t)}const $c=L(`$ZodUnion`,(e,t)=>{V.init(e,t),R(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),R(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),R(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),R(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>To(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Qc(t,r,e,i)):Qc(o,r,e,i)}}),el=L(`$ZodIntersection`,(e,t)=>{V.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>nl(e,t,n)):nl(e,i,a)}});function tl(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Fo(e)&&Fo(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=tl(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=tl(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function nl(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Yo(e))return e;let o=tl(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const rl=L(`$ZodEnum`,(e,t)=>{V.init(e,t);let n=xo(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Lo.has(typeof e)).map(e=>typeof e==`string`?Ro(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),il=L(`$ZodTransform`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new vo(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new _o;return n.value=i,n.fallback=!0,n}});function al(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const ol=L(`$ZodOptional`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,R(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),R(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${To(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>al(e,r)):al(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),sl=L(`$ZodExactOptional`,(e,t)=>{ol.init(e,t),R(e._zod,`values`,()=>t.innerType._zod.values),R(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),cl=L(`$ZodNullable`,(e,t)=>{V.init(e,t),R(e._zod,`optin`,()=>t.innerType._zod.optin),R(e._zod,`optout`,()=>t.innerType._zod.optout),R(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${To(e.source)}|null)$`):void 0}),R(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),ll=L(`$ZodDefault`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,R(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>ul(e,t)):ul(r,t)}});function ul(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const dl=L(`$ZodPrefault`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,R(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),fl=L(`$ZodNonOptional`,(e,t)=>{V.init(e,t),R(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>pl(t,e)):pl(i,e)}});function pl(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const ml=L(`$ZodCatch`,(e,t)=>{V.init(e,t),e._zod.optin=`optional`,R(e._zod,`optout`,()=>t.innerType._zod.optout),R(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>$o(e,n,bo()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>$o(e,n,bo()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),hl=L(`$ZodPipe`,(e,t)=>{V.init(e,t),R(e._zod,`values`,()=>t.in._zod.values),R(e._zod,`optin`,()=>t.in._zod.optin),R(e._zod,`optout`,()=>t.out._zod.optout),R(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>gl(e,t.in,n)):gl(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>gl(e,t.out,n)):gl(r,t.out,n)}});function gl(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const _l=L(`$ZodReadonly`,(e,t)=>{V.init(e,t),R(e._zod,`propValues`,()=>t.innerType._zod.propValues),R(e._zod,`values`,()=>t.innerType._zod.values),R(e._zod,`optin`,()=>t.innerType?._zod?.optin),R(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(vl):vl(r)}});function vl(e){return e.value=Object.freeze(e.value),e}const yl=L(`$ZodCustom`,(e,t)=>{B.init(e,t),V.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>bl(t,n,r,e));bl(i,n,r,e)}});function bl(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(ts(e))}}var xl,Sl=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Cl(){return new Sl}(xl=globalThis).__zod_globalRegistry??(xl.__zod_globalRegistry=Cl());const wl=globalThis.__zod_globalRegistry;function Tl(e,t){return new e({type:`string`,...z(t)})}function El(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...z(t)})}function Dl(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...z(t)})}function Ol(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...z(t)})}function kl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...z(t)})}function Al(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...z(t)})}function jl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...z(t)})}function Ml(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...z(t)})}function Nl(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...z(t)})}function Pl(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...z(t)})}function Fl(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...z(t)})}function Il(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...z(t)})}function Ll(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...z(t)})}function Rl(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...z(t)})}function zl(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...z(t)})}function Bl(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...z(t)})}function Vl(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...z(t)})}function Hl(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...z(t)})}function Ul(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...z(t)})}function Wl(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...z(t)})}function Gl(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...z(t)})}function Kl(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...z(t)})}function ql(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...z(t)})}function Jl(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...z(t)})}function Yl(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...z(t)})}function Xl(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...z(t)})}function Zl(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...z(t)})}function Ql(e,t){return new e({type:`number`,checks:[],...z(t)})}function $l(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...z(t)})}function eu(e){return new e({type:`unknown`})}function tu(e,t){return new e({type:`never`,...z(t)})}function nu(e,t){return new Zs({check:`less_than`,...z(t),value:e,inclusive:!1})}function ru(e,t){return new Zs({check:`less_than`,...z(t),value:e,inclusive:!0})}function iu(e,t){return new Qs({check:`greater_than`,...z(t),value:e,inclusive:!1})}function au(e,t){return new Qs({check:`greater_than`,...z(t),value:e,inclusive:!0})}function ou(e,t){return new $s({check:`multiple_of`,...z(t),value:e})}function su(e,t){return new tc({check:`max_length`,...z(t),maximum:e})}function cu(e,t){return new nc({check:`min_length`,...z(t),minimum:e})}function lu(e,t){return new rc({check:`length_equals`,...z(t),length:e})}function uu(e,t){return new ac({check:`string_format`,format:`regex`,...z(t),pattern:e})}function du(e){return new oc({check:`string_format`,format:`lowercase`,...z(e)})}function fu(e){return new sc({check:`string_format`,format:`uppercase`,...z(e)})}function pu(e,t){return new cc({check:`string_format`,format:`includes`,...z(t),includes:e})}function mu(e,t){return new lc({check:`string_format`,format:`starts_with`,...z(t),prefix:e})}function hu(e,t){return new uc({check:`string_format`,format:`ends_with`,...z(t),suffix:e})}function gu(e){return new dc({check:`overwrite`,tx:e})}function _u(e){return gu(t=>t.normalize(e))}function vu(){return gu(e=>e.trim())}function yu(){return gu(e=>e.toLowerCase())}function bu(){return gu(e=>e.toUpperCase())}function xu(){return gu(e=>jo(e))}function Su(e,t,n){return new e({type:`array`,element:t,...z(n)})}function Cu(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...z(n)})}function wu(e,t){let n=Tu(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(ts(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(ts(r))}},e(t.value,t)),t);return n}function Tu(e,t){let n=new B({check:`custom`,...z(t)});return n._zod.check=e,n}function Eu(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??wl,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function U(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,U(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&W(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Du(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
68
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Po,s=!bo.jitless,c=s&&Fo.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Xc([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function $c(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Xo(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>es(e,r,xo())))}),t)}const el=R(`$ZodUnion`,(e,t)=>{H.init(e,t),z(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),z(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),z(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),z(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Eo(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>$c(t,r,e,i)):$c(o,r,e,i)}}),tl=R(`$ZodIntersection`,(e,t)=>{H.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>rl(e,t,n)):rl(e,i,a)}});function nl(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Io(e)&&Io(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=nl(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=nl(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function rl(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Xo(e))return e;let o=nl(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const il=R(`$ZodEnum`,(e,t)=>{H.init(e,t);let n=So(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Ro.has(typeof e)).map(e=>typeof e==`string`?zo(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),al=R(`$ZodTransform`,(e,t)=>{H.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new yo(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new vo;return n.value=i,n.fallback=!0,n}});function ol(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const sl=R(`$ZodOptional`,(e,t)=>{H.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,z(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),z(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Eo(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>ol(e,r)):ol(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),cl=R(`$ZodExactOptional`,(e,t)=>{sl.init(e,t),z(e._zod,`values`,()=>t.innerType._zod.values),z(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),ll=R(`$ZodNullable`,(e,t)=>{H.init(e,t),z(e._zod,`optin`,()=>t.innerType._zod.optin),z(e._zod,`optout`,()=>t.innerType._zod.optout),z(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Eo(e.source)}|null)$`):void 0}),z(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),ul=R(`$ZodDefault`,(e,t)=>{H.init(e,t),e._zod.optin=`optional`,z(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>dl(e,t)):dl(r,t)}});function dl(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const fl=R(`$ZodPrefault`,(e,t)=>{H.init(e,t),e._zod.optin=`optional`,z(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),pl=R(`$ZodNonOptional`,(e,t)=>{H.init(e,t),z(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>ml(t,e)):ml(i,e)}});function ml(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const hl=R(`$ZodCatch`,(e,t)=>{H.init(e,t),e._zod.optin=`optional`,z(e._zod,`optout`,()=>t.innerType._zod.optout),z(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>es(e,n,xo()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>es(e,n,xo()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),gl=R(`$ZodPipe`,(e,t)=>{H.init(e,t),z(e._zod,`values`,()=>t.in._zod.values),z(e._zod,`optin`,()=>t.in._zod.optin),z(e._zod,`optout`,()=>t.out._zod.optout),z(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>_l(e,t.in,n)):_l(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>_l(e,t.out,n)):_l(r,t.out,n)}});function _l(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const vl=R(`$ZodReadonly`,(e,t)=>{H.init(e,t),z(e._zod,`propValues`,()=>t.innerType._zod.propValues),z(e._zod,`values`,()=>t.innerType._zod.values),z(e._zod,`optin`,()=>t.innerType?._zod?.optin),z(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(yl):yl(r)}});function yl(e){return e.value=Object.freeze(e.value),e}const bl=R(`$ZodCustom`,(e,t)=>{V.init(e,t),H.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>xl(t,n,r,e));xl(i,n,r,e)}});function xl(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(ns(e))}}var Sl,Cl=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function wl(){return new Cl}(Sl=globalThis).__zod_globalRegistry??(Sl.__zod_globalRegistry=wl());const Tl=globalThis.__zod_globalRegistry;function El(e,t){return new e({type:`string`,...B(t)})}function Dl(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...B(t)})}function Ol(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...B(t)})}function kl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...B(t)})}function Al(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...B(t)})}function jl(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...B(t)})}function Ml(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...B(t)})}function Nl(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...B(t)})}function Pl(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...B(t)})}function Fl(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...B(t)})}function Il(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...B(t)})}function Ll(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...B(t)})}function Rl(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...B(t)})}function zl(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...B(t)})}function Bl(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...B(t)})}function Vl(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...B(t)})}function Hl(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...B(t)})}function Ul(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...B(t)})}function Wl(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...B(t)})}function Gl(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...B(t)})}function Kl(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...B(t)})}function ql(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...B(t)})}function Jl(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...B(t)})}function Yl(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...B(t)})}function Xl(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...B(t)})}function Zl(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...B(t)})}function Ql(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...B(t)})}function $l(e,t){return new e({type:`number`,checks:[],...B(t)})}function eu(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...B(t)})}function tu(e){return new e({type:`unknown`})}function nu(e,t){return new e({type:`never`,...B(t)})}function ru(e,t){return new Qs({check:`less_than`,...B(t),value:e,inclusive:!1})}function iu(e,t){return new Qs({check:`less_than`,...B(t),value:e,inclusive:!0})}function au(e,t){return new $s({check:`greater_than`,...B(t),value:e,inclusive:!1})}function ou(e,t){return new $s({check:`greater_than`,...B(t),value:e,inclusive:!0})}function su(e,t){return new ec({check:`multiple_of`,...B(t),value:e})}function cu(e,t){return new nc({check:`max_length`,...B(t),maximum:e})}function lu(e,t){return new rc({check:`min_length`,...B(t),minimum:e})}function uu(e,t){return new ic({check:`length_equals`,...B(t),length:e})}function du(e,t){return new oc({check:`string_format`,format:`regex`,...B(t),pattern:e})}function fu(e){return new sc({check:`string_format`,format:`lowercase`,...B(e)})}function pu(e){return new cc({check:`string_format`,format:`uppercase`,...B(e)})}function mu(e,t){return new lc({check:`string_format`,format:`includes`,...B(t),includes:e})}function hu(e,t){return new uc({check:`string_format`,format:`starts_with`,...B(t),prefix:e})}function gu(e,t){return new dc({check:`string_format`,format:`ends_with`,...B(t),suffix:e})}function _u(e){return new fc({check:`overwrite`,tx:e})}function vu(e){return _u(t=>t.normalize(e))}function yu(){return _u(e=>e.trim())}function bu(){return _u(e=>e.toLowerCase())}function xu(){return _u(e=>e.toUpperCase())}function Su(){return _u(e=>Mo(e))}function Cu(e,t,n){return new e({type:`array`,element:t,...B(n)})}function wu(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...B(n)})}function Tu(e,t){let n=Eu(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(ns(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(ns(r))}},e(t.value,t)),t);return n}function Eu(e,t){let n=new V({check:`custom`,...B(t)});return n._zod.check=e,n}function Du(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Tl,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function W(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,W(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&G(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ou(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
69
69
|
|
|
70
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Ou(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Au(t,`input`,e.processors),output:Au(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function W(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return W(r.element,n);if(r.type===`set`)return W(r.valueType,n);if(r.type===`lazy`)return W(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return W(r.innerType,n);if(r.type===`intersection`)return W(r.left,n)||W(r.right,n);if(r.type===`record`||r.type===`map`)return W(r.keyType,n)||W(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:W(r.in,n)||W(r.out,n);if(r.type===`object`){for(let e in r.shape)if(W(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(W(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(W(e,n))return!0;return!!(r.rest&&W(r.rest,n))}return!1}const ku=(e,t={})=>n=>{let r=Eu({...n,processors:t});return U(e,r),Du(r,e),Ou(r,e)},Au=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Eu({...i??{},target:a,io:t,processors:n});return U(e,o),Du(o,e),Ou(o,e)},ju={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Mu=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ju[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Nu=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Pu=(e,t,n,r)=>{n.not={}},Fu=(e,t,n,r)=>{let i=e._zod.def,a=xo(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Iu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Lu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Ru=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=U(a.element,t,{...r,path:[...r.path,`items`]})},zu=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=U(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=U(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Bu=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>U(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Vu=(e,t,n,r)=>{let i=e._zod.def,a=U(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=U(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Hu=(e,t,n,r)=>{let i=e._zod.def,a=U(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Uu=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Wu=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Gu=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ku=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},qu=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;U(o,t,r);let s=t.seen.get(e);s.ref=o},Ju=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Yu=(e,t,n,r)=>{let i=e._zod.def;U(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Xu=L(`ZodISODateTime`,(e,t)=>{Ec.init(e,t),J.init(e,t)});function Zu(e){return Jl(Xu,e)}const Qu=L(`ZodISODate`,(e,t)=>{Dc.init(e,t),J.init(e,t)});function $u(e){return Yl(Qu,e)}const ed=L(`ZodISOTime`,(e,t)=>{Oc.init(e,t),J.init(e,t)});function td(e){return Xl(ed,e)}const nd=L(`ZodISODuration`,(e,t)=>{kc.init(e,t),J.init(e,t)});function rd(e){return Zl(nd,e)}const G=L(`ZodError`,(e,t)=>{rs.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>os(e,t)},flatten:{value:t=>as(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,So,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,So,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),id=ss(G),ad=cs(G),od=ls(G),sd=ds(G),cd=ps(G),ld=ms(G),ud=hs(G),dd=gs(G),fd=_s(G),pd=vs(G),md=ys(G),hd=bs(G),gd=new WeakMap;function _d(e,t,n){let r=Object.getPrototypeOf(e),i=gd.get(r);if(i||(i=new Set,gd.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const K=L(`ZodType`,(e,t)=>(V.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Au(e,`input`),output:Au(e,`output`)}}),e.toJSONSchema=ku(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>id(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>od(e,t,n),e.parseAsync=async(t,n)=>ad(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>sd(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>cd(e,t,n),e.decode=(t,n)=>ld(e,t,n),e.encodeAsync=async(t,n)=>ud(e,t,n),e.decodeAsync=async(t,n)=>dd(e,t,n),e.safeEncode=(t,n)=>fd(e,t,n),e.safeDecode=(t,n)=>pd(e,t,n),e.safeEncodeAsync=async(t,n)=>md(e,t,n),e.safeDecodeAsync=async(t,n)=>hd(e,t,n),_d(e,`ZodType`,{check(...e){let t=this.def;return this.clone(ko(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return zo(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Tf(e,t))},superRefine(e,t){return this.check(Ef(e,t))},overwrite(e){return this.check(gu(e))},optional(){return sf(this)},exactOptional(){return lf(this)},nullable(){return df(this)},nullish(){return sf(df(this))},nonoptional(e){return _f(this,e)},array(){return Jd(this)},or(e){return Qd([this,e])},and(e){return ef(this,e)},transform(e){return xf(this,af(e))},default(e){return pf(this,e)},prefault(e){return hf(this,e)},catch(e){return yf(this,e)},pipe(e){return xf(this,e)},readonly(){return Cf(this)},describe(e){let t=this.clone();return wl.add(t,{description:e}),t},meta(...e){if(e.length===0)return wl.get(this);let t=this.clone();return wl.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return wl.get(e)?.description},configurable:!0}),e)),vd=L(`_ZodString`,(e,t)=>{mc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mu(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,_d(e,`_ZodString`,{regex(...e){return this.check(uu(...e))},includes(...e){return this.check(pu(...e))},startsWith(...e){return this.check(mu(...e))},endsWith(...e){return this.check(hu(...e))},min(...e){return this.check(cu(...e))},max(...e){return this.check(su(...e))},length(...e){return this.check(lu(...e))},nonempty(...e){return this.check(cu(1,...e))},lowercase(e){return this.check(du(e))},uppercase(e){return this.check(fu(e))},trim(){return this.check(vu())},normalize(...e){return this.check(_u(...e))},toLowerCase(){return this.check(yu())},toUpperCase(){return this.check(bu())},slugify(){return this.check(xu())}})}),yd=L(`ZodString`,(e,t)=>{mc.init(e,t),vd.init(e,t),e.email=t=>e.check(El(bd,t)),e.url=t=>e.check(Ml(Cd,t)),e.jwt=t=>e.check(ql(Rd,t)),e.emoji=t=>e.check(Nl(wd,t)),e.guid=t=>e.check(Dl(xd,t)),e.uuid=t=>e.check(Ol(Sd,t)),e.uuidv4=t=>e.check(kl(Sd,t)),e.uuidv6=t=>e.check(Al(Sd,t)),e.uuidv7=t=>e.check(jl(Sd,t)),e.nanoid=t=>e.check(Pl(Td,t)),e.guid=t=>e.check(Dl(xd,t)),e.cuid=t=>e.check(Fl(Ed,t)),e.cuid2=t=>e.check(Il(Dd,t)),e.ulid=t=>e.check(Ll(Od,t)),e.base64=t=>e.check(Wl(Fd,t)),e.base64url=t=>e.check(Gl(Id,t)),e.xid=t=>e.check(Rl(kd,t)),e.ksuid=t=>e.check(zl(Ad,t)),e.ipv4=t=>e.check(Bl(jd,t)),e.ipv6=t=>e.check(Vl(Md,t)),e.cidrv4=t=>e.check(Hl(Nd,t)),e.cidrv6=t=>e.check(Ul(Pd,t)),e.e164=t=>e.check(Kl(Ld,t)),e.datetime=t=>e.check(Zu(t)),e.date=t=>e.check($u(t)),e.time=t=>e.check(td(t)),e.duration=t=>e.check(rd(t))});function q(e){return Tl(yd,e)}const J=L(`ZodStringFormat`,(e,t)=>{H.init(e,t),vd.init(e,t)}),bd=L(`ZodEmail`,(e,t)=>{_c.init(e,t),J.init(e,t)}),xd=L(`ZodGUID`,(e,t)=>{hc.init(e,t),J.init(e,t)}),Sd=L(`ZodUUID`,(e,t)=>{gc.init(e,t),J.init(e,t)}),Cd=L(`ZodURL`,(e,t)=>{vc.init(e,t),J.init(e,t)}),wd=L(`ZodEmoji`,(e,t)=>{yc.init(e,t),J.init(e,t)}),Td=L(`ZodNanoID`,(e,t)=>{bc.init(e,t),J.init(e,t)}),Ed=L(`ZodCUID`,(e,t)=>{xc.init(e,t),J.init(e,t)}),Dd=L(`ZodCUID2`,(e,t)=>{Sc.init(e,t),J.init(e,t)}),Od=L(`ZodULID`,(e,t)=>{Cc.init(e,t),J.init(e,t)}),kd=L(`ZodXID`,(e,t)=>{wc.init(e,t),J.init(e,t)}),Ad=L(`ZodKSUID`,(e,t)=>{Tc.init(e,t),J.init(e,t)}),jd=L(`ZodIPv4`,(e,t)=>{Ac.init(e,t),J.init(e,t)}),Md=L(`ZodIPv6`,(e,t)=>{jc.init(e,t),J.init(e,t)}),Nd=L(`ZodCIDRv4`,(e,t)=>{Mc.init(e,t),J.init(e,t)}),Pd=L(`ZodCIDRv6`,(e,t)=>{Nc.init(e,t),J.init(e,t)}),Fd=L(`ZodBase64`,(e,t)=>{Fc.init(e,t),J.init(e,t)}),Id=L(`ZodBase64URL`,(e,t)=>{Lc.init(e,t),J.init(e,t)}),Ld=L(`ZodE164`,(e,t)=>{Rc.init(e,t),J.init(e,t)}),Rd=L(`ZodJWT`,(e,t)=>{Bc.init(e,t),J.init(e,t)}),zd=L(`ZodNumber`,(e,t)=>{Vc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nu(e,t,n,r),_d(e,`ZodNumber`,{gt(e,t){return this.check(iu(e,t))},gte(e,t){return this.check(au(e,t))},min(e,t){return this.check(au(e,t))},lt(e,t){return this.check(nu(e,t))},lte(e,t){return this.check(ru(e,t))},max(e,t){return this.check(ru(e,t))},int(e){return this.check(Hd(e))},safe(e){return this.check(Hd(e))},positive(e){return this.check(iu(0,e))},nonnegative(e){return this.check(au(0,e))},negative(e){return this.check(nu(0,e))},nonpositive(e){return this.check(ru(0,e))},multipleOf(e,t){return this.check(ou(e,t))},step(e,t){return this.check(ou(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Bd(e){return Ql(zd,e)}const Vd=L(`ZodNumberFormat`,(e,t)=>{Hc.init(e,t),zd.init(e,t)});function Hd(e){return $l(Vd,e)}const Ud=L(`ZodUnknown`,(e,t)=>{Uc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Wd(){return eu(Ud)}const Gd=L(`ZodNever`,(e,t)=>{Wc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pu(e,t,n,r)});function Kd(e){return tu(Gd,e)}const qd=L(`ZodArray`,(e,t)=>{Kc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ru(e,t,n,r),e.element=t.element,_d(e,`ZodArray`,{min(e,t){return this.check(cu(e,t))},nonempty(e){return this.check(cu(1,e))},max(e,t){return this.check(su(e,t))},length(e,t){return this.check(lu(e,t))},unwrap(){return this.element}})});function Jd(e,t){return Su(qd,e,t)}const Yd=L(`ZodObject`,(e,t)=>{Zc.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zu(e,t,n,r),R(e,`shape`,()=>t.shape),_d(e,`ZodObject`,{keyof(){return nf(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Wd()})},loose(){return this.clone({...this._zod.def,catchall:Wd()})},strict(){return this.clone({...this._zod.def,catchall:Kd()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Wo(this,e)},safeExtend(e){return Go(this,e)},merge(e){return Ko(this,e)},pick(e){return Ho(this,e)},omit(e){return Uo(this,e)},partial(...e){return qo(of,this,e[0])},required(...e){return Jo(gf,this,e[0])}})});function Xd(e,t){let n={type:`object`,shape:e??{},...z(t)};return new Yd(n)}const Zd=L(`ZodUnion`,(e,t)=>{$c.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bu(e,t,n,r),e.options=t.options});function Qd(e,t){return new Zd({type:`union`,options:e,...z(t)})}const $d=L(`ZodIntersection`,(e,t)=>{el.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vu(e,t,n,r)});function ef(e,t){return new $d({type:`intersection`,left:e,right:t})}const tf=L(`ZodEnum`,(e,t)=>{rl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fu(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new tf({...t,checks:[],...z(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new tf({...t,checks:[],...z(r),entries:i})}});function nf(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new tf({type:`enum`,entries:n,...z(t)})}const rf=L(`ZodTransform`,(e,t)=>{il.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lu(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new vo(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(ts(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(ts(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function af(e){return new rf({type:`transform`,transform:e})}const of=L(`ZodOptional`,(e,t)=>{ol.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sf(e){return new of({type:`optional`,innerType:e})}const cf=L(`ZodExactOptional`,(e,t)=>{sl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function lf(e){return new cf({type:`optional`,innerType:e})}const uf=L(`ZodNullable`,(e,t)=>{cl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function df(e){return new uf({type:`nullable`,innerType:e})}const ff=L(`ZodDefault`,(e,t)=>{ll.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function pf(e,t){return new ff({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Io(t)}})}const mf=L(`ZodPrefault`,(e,t)=>{dl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function hf(e,t){return new mf({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Io(t)}})}const gf=L(`ZodNonOptional`,(e,t)=>{fl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _f(e,t){return new gf({type:`nonoptional`,innerType:e,...z(t)})}const vf=L(`ZodCatch`,(e,t)=>{ml.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ku(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yf(e,t){return new vf({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const bf=L(`ZodPipe`,(e,t)=>{hl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qu(e,t,n,r),e.in=t.in,e.out=t.out});function xf(e,t){return new bf({type:`pipe`,in:e,out:t})}const Sf=L(`ZodReadonly`,(e,t)=>{_l.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ju(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cf(e){return new Sf({type:`readonly`,innerType:e})}const wf=L(`ZodCustom`,(e,t)=>{yl.init(e,t),K.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Iu(e,t,n,r)});function Tf(e,t={}){return Cu(wf,e,t)}function Ef(e,t){return wu(e,t)}const Df=Xd({href:q(),rel:q(),sizes:q().optional(),type:q().optional()});Xd({applicationName:q().optional(),author:q().optional(),canonical:q().optional(),charset:q().optional(),colorScheme:q().optional(),description:q().optional(),favicons:Jd(Df).optional(),formatDetection:q().optional(),generator:q().optional(),keywords:q().optional(),lang:q().optional(),license:q().optional(),"og:description":q().optional(),"og:image":q().optional(),"og:image:height":q().optional(),"og:image:type":q().optional(),"og:image:width":q().optional(),"og:locale":q().optional(),"og:site_name":q().optional(),"og:title":q().optional(),"og:type":q().optional(),"og:url":q().optional(),rawHead:q().optional(),robots:q().optional(),themeColor:q().optional(),themeColorDark:q().optional(),themeColorLight:q().optional(),title:q().optional(),"twitter:card":q().optional(),"twitter:creator":q().optional(),"twitter:description":q().optional(),"twitter:image":q().optional(),"twitter:site":q().optional(),"twitter:title":q().optional(),viewport:q().optional()}).loose(),Xd({height:Bd().optional(),size:Bd().optional(),type:q().optional(),url:q(),width:Bd().optional()}),Xd({content:q().optional(),error:q().optional()});const Of=Xd({changefreq:q().optional(),lastmod:q().optional(),loc:q(),priority:q().optional()});Xd({content:q().optional(),error:q().optional(),urls:Jd(Of).optional()});const kf=[`og`,`twitter`,`seo`,`image`],Af={image:{maxScore:15,name:`og:image Validation`},og:{maxScore:40,name:`Open Graph`},seo:{maxScore:25,name:`Core SEO`},twitter:{maxScore:20,name:`Twitter Card`}},jf=`~effect/BigDecimal`,Mf={[jf]:jf,[v](){let e=zf(this);return b(y(e.value),xe(e.scale))},[S](e){return Nf(e)&&Uf(this,e)},toString(){return`BigDecimal(${Wf(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[at](){return this.toJSON()},pipe(){return h(this,arguments)}},Nf=e=>_(e,jf),Pf=(e,t)=>{let n=Object.create(Mf);return n.value=e,n.scale=t,n},Ff=(e,t)=>{if(e!==If&&e%Lf===If)throw RangeError(`Value must be normalized`);let n=Pf(e,t);return n.normalized=n,n},If=BigInt(0),Lf=BigInt(10),Rf=Ff(If,0),zf=e=>{if(e.normalized===void 0){if(e.value===If)e.normalized=Rf;else{let t=`${e.value}`,n=0;for(let e=t.length-1;e>=0&&t[e]===`0`;e--)n++;n===0&&(e.normalized=e);let r=BigInt(t.substring(0,t.length-n)),i=e.scale-n;e.normalized=Ff(r,i)}}return e.normalized},Bf=g(2,(e,t)=>t>e.scale?Pf(e.value*Lf**BigInt(t-e.scale),t):t<e.scale?Pf(e.value/Lf**BigInt(e.scale-t),t):e),Vf=e=>e.value<If?Pf(-e.value,e.scale):e,Hf=Zt((e,t)=>e.scale>t.scale?Bf(t,e.scale).value===e.value:e.scale<t.scale?Bf(e,t.scale).value===t.value:e.value===t.value),Uf=g(2,(e,t)=>Hf(e,t)),Wf=e=>{let t=zf(e);if(Math.abs(t.scale)>=16)return Gf(t);let n=t.value<If,r=n?`${t.value}`.substring(1):`${t.value}`,i,a;if(t.scale>=r.length)i=`0`,a=`0`.repeat(t.scale-r.length)+r;else{let e=r.length-t.scale;if(e>r.length){let t=e-r.length;i=`${r}${`0`.repeat(t)}`,a=``}else a=r.slice(e),i=r.slice(0,e)}let o=a===``?i:`${i}.${a}`;return n?`-${o}`:o},Gf=e=>{if(Kf(e))return`0e+0`;let t=zf(e),n=`${Vf(t).value}`,r=n.slice(0,1),i=n.slice(1),a=`${qf(t)?`-`:``}${r}`;i!==``&&(a+=`.${i}`);let o=i.length-t.scale;return`${a}e${o>=0?`+`:``}${o}`},Kf=e=>e.value===If,qf=e=>e.value<If;Cn()(`effect/DateTime/CurrentTimeZone`),Zi(`EncodingError`);function Jf(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function Yf(e){return t=>Jf(t)?.[e]}const Xf=Yf(`identifier`),Zf=ce(e=>{let t=Xf(e);return typeof t==`string`?t:e.getExpected(Zf)});function Qf(e,t,n){return t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n,e}globalThis.RegExp;const $f=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,`\\$&`),ep=`~effect/SchemaIssue/Issue`;function tp(e){return _(e,ep)}var Y=class{[ep]=ep;toString(){return bp(this)}},np=class extends Y{_tag=`Filter`;actual;filter;issue;constructor(e,t,n){super(),this.actual=e,this.filter=t,this.issue=n}},rp=class extends Y{_tag=`Encoding`;ast;actual;issue;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issue=n}},ip=class extends Y{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},ap=class extends Y{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},op=class extends Y{_tag=`UnexpectedKey`;ast;actual;constructor(e,t){super(),this.ast=e,this.actual=t}},X=class extends Y{_tag=`Composite`;ast;actual;issues;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issues=n}},sp=class extends Y{_tag=`InvalidType`;ast;actual;constructor(e,t){super(),this.ast=e,this.actual=t}},cp=class extends Y{_tag=`InvalidValue`;actual;annotations;constructor(e,t){super(),this.actual=e,this.annotations=t}},lp=class extends Y{_tag=`AnyOf`;ast;actual;issues;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issues=n}},up=class extends Y{_tag=`OneOf`;ast;actual;successes;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.successes=n}};function dp(e,t){if(tp(t))return t;if(typeof t==`string`)return new cp(k(e),{message:t});let n=typeof t.issue==`string`?new cp(k(e),{message:t.issue}):t.issue;return new ip(t.path,n)}function fp(e,t){if(t!==void 0)return typeof t==`boolean`?t?void 0:new cp(k(e)):dp(e,t)}function pp(e,t,n){return Array.isArray(n)?Xn(n)?n.length===1?dp(e,n[0]):new X(t,k(e),rr(n,t=>dp(e,t))):void 0:fp(e,n)}const mp=e=>{let t=Sp(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return gp(Zf(e.ast),wp(e.actual));case`InvalidValue`:return`Invalid data ${wp(e.actual)}`;case`MissingKey`:return`Missing key`;case`UnexpectedKey`:return`Unexpected key with value ${w(e.actual)}`;case`Forbidden`:return`Forbidden operation`;case`OneOf`:return`Expected exactly one member to match the input ${w(e.actual)}`}},hp=e=>Sp(e.issue)??Sp(e);function gp(e,t){return`Expected ${e}, got ${t}`}function _p(e,t,n,r){switch(e._tag){case`Filter`:{let i=r(e);if(i!==void 0)return[{path:t,message:i}];switch(e.issue._tag){case`InvalidValue`:return[{path:t,message:gp(vp(e.filter),w(e.actual))}];default:return _p(e.issue,t,n,r)}}case`Encoding`:return _p(e.issue,t,n,r);case`Pointer`:return _p(e.issue,[...t,...e.path],n,r);case`Composite`:return e.issues.flatMap(e=>_p(e,t,n,r));case`AnyOf`:{let i=Sp(e);return e.issues.length===0?i===void 0?[{path:t,message:gp(Zf(e.ast),w(e.actual))}]:[{path:t,message:i}]:e.issues.flatMap(e=>_p(e,t,n,r))}default:return[{path:t,message:n(e)}]}}function vp(e){let t=e.annotations?.expected;if(typeof t==`string`)return t;switch(e._tag){case`Filter`:return`<filter>`;case`FilterGroup`:return e.checks.map(e=>vp(e)).join(` & `)}}function yp(){return e=>_p(e,[],mp,hp).map(xp).join(`
|
|
71
|
-
`)}const bp=yp();function xp(e){let t=e.message;if(e.path&&e.path.length>0){let n=nt(e.path);t+=`\n at ${n}`}return t}function Sp(e){switch(e._tag){case`InvalidType`:case`OneOf`:case`Composite`:case`AnyOf`:return Cp(e.ast.annotations);case`InvalidValue`:case`Forbidden`:return Cp(e.annotations);case`MissingKey`:return Cp(e.annotations,`messageMissingKey`);case`UnexpectedKey`:return Cp(e.ast.annotations,`messageUnexpectedKey`);case`Filter`:return Cp(e.filter.annotations);case`Encoding`:return Sp(e.issue)}}function Cp(e,t=`message`){let n=e?.[t];if(typeof n==`string`)return n}function wp(e){return yn(e)?`no value provided`:w(e.value)}var Tp=class e extends re{run;constructor(e){super(),this.run=e}map(t){return new e((e,n)=>this.run(e,n).pipe(ga(xn(t))))}compose(t){return Dp(this)?t:Dp(t)?this:new e((e,n)=>this.run(e,n).pipe(va(e=>t.run(e,n))))}};const Ep=new Tp(P);function Dp(e){return e.run===Ep.run}function Op(){return Ep}function kp(e){return Ap(xn(e))}function Ap(e){return new Tp(t=>P(e(t)))}function jp(){return kp(globalThis.String)}function Mp(){return kp(globalThis.Number)}const Np=`~effect/SchemaTransformation/Transformation`;var Pp=class e{[Np]=Np;_tag=`Transformation`;decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new e(this.encode,this.decode)}compose(t){return new e(this.decode.compose(t.decode),t.encode.compose(this.encode))}};function Fp(e){return _(e,Np)}const Ip=e=>Fp(e)?e:new Pp(e.decode,e.encode),Lp=new Pp(Op(),Op());function Rp(){return Lp}const zp=new Pp(Mp(),jp());function Bp(e){return t=>t._tag===e}const Vp=Bp(`Declaration`),Hp=Bp(`Never`),Up=Bp(`Literal`),Wp=Bp(`UniqueSymbol`),Gp=Bp(`Arrays`),Kp=Bp(`Objects`),qp=Bp(`Union`);var Z=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}};const Jp={};var Yp=class{isOptional;isMutable;defaultValue;annotations;constructor(e,t,n=void 0,r=void 0){this.isOptional=e,this.isMutable=t,this.defaultValue=n,this.annotations=r}};const Xp=`~effect/Schema`;var Zp=class{[Xp]=Xp;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,r=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=r}toString(){return`<${this._tag}>`}},Qp=class e extends Zp{_tag=`Declaration`;typeParameters;run;constructor(e,t,n,r,i,a){super(n,r,i,a),this.typeParameters=e,this.run=t}getParser(){let e=this.run(this.typeParameters);return(t,n)=>yn(t)?ia:ga(e(t.value,this,n),k)}recur(t){let n=Gm(this.typeParameters,t);return n===this.typeParameters?this:new e(n,this.run,this.annotations,this.checks,void 0,this.context)}getExpected(){let e=this.annotations?.expected;return typeof e==`string`?e:`<Declaration>`}},$p=class extends Zp{_tag=`Literal`;literal;constructor(e,t,n,r,i){if(super(t,n,r,i),typeof e==`number`&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${w(e)}`);this.literal=e}getParser(){return oh(this,this.literal)}toCodecJson(){return typeof this.literal==`bigint`?em(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:em(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function em(e){let t=globalThis.String(e.literal);return Q(e,[new Z(new $p(t),new Pp(kp(()=>e.literal),kp(()=>t)))])}const tm=new class extends Zp{_tag=`String`;getParser(){return sh(this,de)}getExpected(){return`string`}};var nm=class extends Zp{_tag=`Number`;getParser(){return sh(this,fe)}toCodecJson(){return this.checks&&(rm(this.checks,`isFinite`)||rm(this.checks,`isInt`))?this:Q(this,[Am])}toCodecStringTree(){return this.checks&&(rm(this.checks,`isFinite`)||rm(this.checks,`isInt`))?Q(this,[mh]):Q(this,[hh])}getExpected(){return`number`}};function rm(e,t){return e.some(e=>{switch(e._tag){case`Filter`:return e.annotations?.meta?._tag===t;case`FilterGroup`:return rm(e.checks,t)}})}const im=new nm,am=new class extends Zp{_tag=`Boolean`;getParser(){return sh(this,pe)}getExpected(){return`boolean`}};var om=class e extends Zp{_tag=`Arrays`;isMutable;elements;rest;constructor(e,t,n,r,i,a,o){super(r,i,a,o),this.isMutable=e,this.elements=t,this.rest=n;let s=t.findIndex(Xm);if(s!==-1&&(t.slice(s+1).some(e=>!Xm(e))||n.length>1))throw Error(`A required element cannot follow an optional element. ts(1257)`);if(n.length>1&&n.slice(1).some(Xm))throw Error(`An optional element cannot follow a rest element. ts(1266)`)}getParser(e){let t=this,n=t.elements.map(t=>({ast:t,parser:e(t)})),r=t.rest.map(t=>({ast:t,parser:e(t)})),i=n.length,[a,...o]=r,s=o.length;function c(e,t){return t<i?n[t]:t>=e?o[t-e]:a}return ba(function*(e,n){if(e._tag===`None`)return e;let r=e.value;if(!Array.isArray(r))return yield*I(new sp(t,e));let a=r.length,o={ast:t,getParser:c,oinput:e,len:a,tailThreshold:cm(a,i,s),output:new globalThis.Array(a),issues:void 0,options:n},l=lm(n?.concurrency),u=sm(o,r,{concurrency:l?.concurrency,end:t.rest.length===0?i:Math.max(a,i+s)});if(u&&(yield*u),t.rest.length===0&&a>i)for(let s=i;s<=a-1;s++){let i=new ip([s],new op(t,r[s]));if(n.errors===`all`)o.issues?o.issues.push(i):o.issues=[i];else return yield*I(new X(t,e,[i]))}return o.issues?yield*I(new X(t,e,o.issues)):k(o.output)})}recur(t){let n=Gm(this.elements,t),r=Gm(this.rest,t);return n===this.elements&&r===this.rest?this:new e(this.isMutable,n,r,this.annotations,this.checks,void 0,this.context)}getExpected(){return`array`}};const sm=ji()({onItem(e,t,n){let r=n<e.len?k(t):vn();return e.getParser(e.tailThreshold,n).parser(r,e.options)},step(e,t,n,r){if(n._tag===`Failure`)return um(e,e.ast,r,n);if(n.value._tag===`Some`)e.output[r]=n.value.value;else{let t=e.getParser(e.tailThreshold,r);if(Xm(t.ast))return;let n=new ip([r],new ap(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return Ki(new X(e.ast,e.oinput,[n]))}}});function cm(e,t,n){return Math.max(t,e-n)}const lm=e=>(e=e===`unbounded`?1/0:e??1,e>1?{concurrency:e}:void 0),um=(e,t,n,r)=>{let i=Yi(r.cause);if(Wn(i))return r;let a=new ip([n],i.success);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return Ki(new X(t,e.oinput,[a]))},dm=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`,fm=new globalThis.RegExp(`(?:${dm}|Infinity|-Infinity|NaN)`);function pm(e,t){let n=Qm(t);switch(n._tag){case`String`:return Object.keys(e);case`TemplateLiteral`:{let t=rh(n);return Object.keys(e).filter(e=>t.test(e))}case`Symbol`:return Object.getOwnPropertySymbols(e);case`Number`:return Object.keys(e).filter(e=>fm.test(e));case`Union`:return[...new Set(n.types.flatMap(t=>pm(e,t)))];default:return[]}}var mm=class{name;type;constructor(e,t){this.name=e,this.type=t}},hm=class{parameter;type;merge;constructor(e,t,n){if(this.parameter=e,this.type=t,this.merge=n,Xm(t)&&!th(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},gm=class e extends Zp{_tag=`Objects`;propertySignatures;indexSignatures;constructor(e,t,n,r,i,a){super(n,r,i,a),this.propertySignatures=e,this.indexSignatures=t;let o=e.map(e=>e.name).filter((e,t,n)=>n.indexOf(e)!==t);if(o.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(o)}. ts(2300)`)}getParser(e){let t=this,n=[],r=new Set,i=[];for(let a of t.propertySignatures)n.push(a.name),r.add(a.name),i.push({ps:a,parser:e(a.type),name:a.name,type:a.type});let a=t.indexSignatures.length;if(t.propertySignatures.length===0&&t.indexSignatures.length===0)return sh(t,he);let o=a>0?ji()({onItem:ba(function*(n,[r,i]){let a=e(lh(i.parameter))(k(r),n.options),o=M(a)?a:yield*la(a);if(o._tag===`Failure`){let e=um(n,t,r,o);e&&(yield*e);return}let s=k(n.input[r]),c=e(i.type)(s,n.options),l=M(c)?c:yield*la(c);if(l._tag===`Failure`){let e=um(n,t,r,l);e&&(yield*e);return}if(o.value._tag===`Some`&&l.value._tag===`Some`){let e=o.value.value,t=l.value.value;if(i.merge&&i.merge.decode&&Object.hasOwn(n.out,e)){let[r,a]=i.merge.decode.combine([e,n.out[e]],[e,t]);Qf(n.out,r,a)}else Qf(n.out,e,t)}}),step:(e,t,n)=>n._tag===`Failure`?n:void 0}):void 0;return ba(function*(e,s){if(e._tag===`None`)return e;let c=e.value;if(!(typeof c==`object`&&c&&!Array.isArray(c)))return yield*I(new sp(t,e));let l={},u={ast:t,oinput:e,input:c,out:l,issues:void 0,options:s},d=s.errors===`all`,f=s.onExcessProperty===`error`,p=s.onExcessProperty===`preserve`,ee;if(t.indexSignatures.length===0&&(f||p)){ee=Reflect.ownKeys(c);for(let n=0;n<ee.length;n++){let i=ee[n];if(!r.has(i)){if(f){let n=new ip([i],new op(t,c[i]));if(d){u.issues?u.issues.push(n):u.issues=[n];continue}return yield*I(new X(t,e,[n]))}Qf(l,i,c[i])}}}let m=lm(s?.concurrency),te=_m(u,i,m);if(te&&(yield*te),o){let e=nr();for(let n=0;n<a;n++){let r=t.indexSignatures[n],i=pm(c,r.parameter);for(let t=0;t<i.length;t++){let n=i[t];e.push([n,r])}}let n=o(u,e,m);n&&(yield*n)}if(u.issues)return yield*I(new X(t,e,u.issues));if(s.propertyOrder===`original`){let e=(ee??Reflect.ownKeys(c)).concat(n),t={};for(let n of e)Object.hasOwn(l,n)&&Qf(t,n,l[n]);return k(t)}return k(l)})}rebuild(t,n){let r=Gm(this.propertySignatures,e=>{let n=t(e.type);return n===e.type?e:new mm(e.name,n)}),i=Gm(this.indexSignatures,e=>{let r=t(e.parameter),i=t(e.type),a=n?e.merge?.flip():e.merge;return r===e.parameter&&i===e.type&&a===e.merge?e:new hm(r,i,a)});return r===this.propertySignatures&&i===this.indexSignatures?this:new e(r,i,this.annotations,this.checks,void 0,this.context)}flip(e){return this.rebuild(e,!0)}recur(e){return this.rebuild(e,!1)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?`object | array`:`object`}};const _m=ji()({onItem(e,t){let n=Object.hasOwn(e.input,t.name)?k(e.input[t.name]):vn();return t.parser(n,e.options)},step(e,t,n){if(n._tag===`Failure`)return um(e,e.ast,t.name,n);if(n.value._tag===`Some`)Qf(e.out,t.name,n.value.value);else if(!Xm(t.type)){let n=new ip([t.name],new ap(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}return Ki(new X(e.ast,e.oinput,[n]))}}});function vm(e,t,n){return new gm(Reflect.ownKeys(e).map(t=>new mm(t,e[t].ast)),[],n,t)}function ym(e){return e.ast}function bm(e,t,n){return new Dm(e.map(ym),t,void 0,n)}function xm(e){switch(e._tag){case`Null`:return[`null`];case`Undefined`:case`Void`: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`]:[`object`,`array`];case`Enum`:return Array.from(new Set(e.enums.map(([,e])=>typeof e)));case`Literal`:return[typeof e.literal];case`Union`:return Array.from(new Set(e.types.flatMap(xm)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function Sm(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[`~sentinels`];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!Xm(t)){if(Up(t))return[{key:e.name,literal:t.literal}];if(Wp(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>Up(e)&&!Xm(e)?[{key:t,literal:e.literal}]:[]);case`Suspend`:return Sm(e.thunk())}}const Cm=new WeakMap;function wm(e){let t=Cm.get(e);if(t)return t;t={};for(let n of e){let e=Qm(n);if(Hp(e))continue;let r=xm(e),i=Sm(e);t.byType??={};for(let e of r)(t.byType[e]??=[]).push(n);if(i.length>0){t.bySentinel??=new Map;for(let{key:e,literal:r}of i){let i=t.bySentinel.get(e);i||t.bySentinel.set(e,i=new Map);let a=i.get(r);a||i.set(r,a=[]),a.push(n)}}else{t.otherwise??={};for(let e of r)(t.otherwise[e]??=[]).push(n)}}return Cm.set(e,t),t}function Tm(e){return t=>{let n=Qm(t);return n._tag===`Literal`?n.literal===e:n._tag!==`UniqueSymbol`||n.symbol===e}}function Em(e,t){let n=wm(t),r=e===null?`null`:Array.isArray(e)?`array`:typeof e;if(n.bySentinel){let t=n.otherwise?.[r]??[];if(r===`object`||r===`array`){for(let[r,i]of n.bySentinel)if(Object.hasOwn(e,r)){let n=i.get(e[r]);if(n)return[...n,...t].filter(Tm(e))}}return t}return(n.byType?.[r]??[]).filter(Tm(e))}var Dm=class e extends Zp{_tag=`Union`;types;mode;constructor(e,t,n,r,i,a){super(n,r,i,a),this.types=e,this.mode=t}getParser(e){let t=this;return(n,r)=>{if(n._tag===`None`)return P(n);let i=n.value,a=Em(i,t.types),o={ast:t,recur:e,oinput:n,input:i,out:void 0,successes:[],issues:void 0,options:r},s=lm(r?.concurrency),c=Om(o,a,s);return c?sa(c,e=>o.out?P(o.out):I(new lp(t,i,o.issues??[]))):o.out?P(o.out):I(new lp(t,i,o.issues??[]))}}recur(t){let n=Gm(this.types,t);return n===this.types?this:new e(n,this.mode,this.annotations,this.checks,void 0,this.context)}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(t=>{let n=Qm(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(Up);if(t.length>0)return`${jm(n.isMutable)}[ ${t.map(t=>e(t)+Mm(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>Up(e.type));if(t.length>0)return`{ ${t.map(t=>`${jm(t.type.context?.isMutable)}${tt(t.name)}${Mm(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};const Om=ji()({onItem(e,t){return e.recur(t)(e.oinput,e.options)},step(e,t,n){if(n._tag===`Failure`){let t=Yi(n.cause);if(Wn(t))return n;e.issues?e.issues.push(t.success):e.issues=[t.success]}else{if(e.out&&e.ast.mode===`oneOf`)return e.successes.push(t),Ki(new up(e.ast,e.input,e.successes));if(e.out=n.value,e.successes.push(t),e.ast.mode===`anyOf`)return qi}}}),km=new Dm([new $p(`Infinity`),new $p(`-Infinity`),new $p(`NaN`)],`anyOf`),Am=new Z(new Dm([im,km],`anyOf`),new Pp(Mp(),kp(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function jm(e){return e?``:`readonly `}function Mm(e){return e?`?`:``}var Nm=class e extends re{_tag=`Filter`;run;annotations;aborted;constructor(e,t=void 0,n=!1){super(),this.run=e,this.annotations=t,this.aborted=n}annotate(t){return new e(this.run,{...this.annotations,...t},this.aborted)}abort(){return new e(this.run,this.annotations,!0)}and(e,t){return new Pm([this,e],t)}},Pm=class e extends re{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(t){return new e(this.checks,{...this.annotations,...t})}and(t,n){return new e([this,t],n)}};function Fm(e,t,n=!1){return new Nm((t,n,r)=>pp(t,n,e(t,n,r)),t,n)}function Im(e,t){let n=e.source;return Fm(t=>e.test(t),{expected:`a string matching the RegExp ${n}`,meta:{_tag:`isPattern`,regExp:e},toArbitraryConstraint:{string:{patterns:[e.source]}},...t})}function Lm(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}function Q(e,t){return e.encoding===t?e:Lm(e,e=>{e.encoding.value=t})}function Rm(e,t){return e.context===t?e:Lm(e,e=>{e.context.value=t})}function zm(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return Bm(e,qn(e.checks.slice(0,-1),n.annotate(t)))}return Lm(e,e=>{e.annotations.value={...e.annotations.value,...t}})}function Bm(e,t){return e.checks===t?e:Lm(e,e=>{e.checks.value=t})}function Vm(e,t){return Bm(e,e.checks?[...e.checks,...t]:t)}function Hm(e,t){let n=e,r=n[n.length-1],i=t(r.to);return i===r.to?e:qn(e.slice(0,e.length-1),new Z(i,r.transformation))}function Um(e){return t=>t.encoding?Q(t,Hm(t.encoding,e)):t}function Wm(e,t,n){let r=new Z(e,t);return Q(n,n.encoding?[...n.encoding,r]:[r])}function Gm(e,t){let n=!1,r=Array(e.length);for(let i=0;i<e.length;i++){let a=e[i],o=t(a);o!==a&&(n=!0),r[i]=o}return n?r:e}function Km(e,t){return Rm(e,e.context?new Yp(e.context.isOptional,e.context.isMutable,e.context.defaultValue,{...e.context.annotations,...t}):new Yp(!1,!1,void 0,t))}const qm=Um(Jm);function Jm(e){let t=e.context?e.context.isOptional===!1?new Yp(!0,e.context.isMutable,e.context.defaultValue,e.context.annotations):e.context:new Yp(!0,!1);return qm(Rm(e,t))}function Ym(e,t,n){return Wm(e,n,t)}function Xm(e){return e.context?.isOptional??!1}const Zm=ce(e=>{if(e.encoding)return Zm(Q(e,void 0));let t=e;return t.recur?.(Zm)??t}),Qm=ce(e=>Zm(eh(e)));function $m(e,t){let n=t,r=n.length,i=n[r-1],a=[new Z(eh(Q(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new Z(eh(n[e-1].to),n[e].transformation.flip()));let o=eh(i.to);return o.encoding?Q(o,[...o.encoding,...a]):Q(o,a)}const eh=ce(e=>{if(e.encoding)return $m(e,e.encoding);let t=e;return t.flip?.(eh)??t.recur?.(eh)??t});function th(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(th);default:return!1}}function nh(e,t){return e.encodedParts.map(e=>ah(e,ih(e),t)).join(``)}const rh=ce(e=>new globalThis.RegExp(`^${nh(e,!0)}$`));function ih(e){switch(e._tag){case`Literal`:return $f(globalThis.String(e.literal));case`String`:return uh;case`Number`:return dm;case`BigInt`:return gh;case`TemplateLiteral`:return nh(e,!1);case`Union`:return e.types.map(ih).join(`|`)}}function ah(e,t,n){if(qp(e)){if(!n)return`(?:${t})`}else if(!n)return t;return`(${t})`}function oh(e,t){let n=aa(t);return r=>r._tag===`None`?ia:r.value===t?n:I(new sp(e,r))}function sh(e,t){return n=>n._tag===`None`?ia:t(n.value)?P(n):I(new sp(e,n))}function ch(e){function t(n){return n.encoding?Q(n,Hm(n.encoding,t)):e(n)}return ce(t)}const lh=ch(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(lh)}}),uh=`[\\s\\S]*?`,dh=new globalThis.RegExp(`^${dm}$`);function fh(e){return Im(dh,{expected:`a string representing a finite number`,meta:{_tag:`isStringFinite`,regExp:dh},...e})}const ph=Vm(tm,[fh()]),mh=new Z(ph,zp),hh=new Z(new Dm([ph,km],`anyOf`),zp),gh=`-?\\d+`;function _h(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`)_h(o.checks,t,n,r,i);else{let e=o.run(t,r,i);if(e&&(n.push(new np(t,o,e)),o.aborted||i?.errors!==`all`))return}}}const vh=`~effect/Schema/Class`,yh=e=>e,bh=ce(e=>{switch(e._tag){case`Declaration`:{let t=e.annotations?.[vh];if(me(t)){let n=t(e.typeParameters),r=bh(n.to);return Q(e,r===n.to?[n]:[new Z(r,n.transformation)])}return e}case`Objects`:case`Arrays`:return e.recur(e=>{let t=e.context?.defaultValue;return t?Q(bh(e),t):bh(e)});case`Suspend`:return e.recur(bh);default:return e}});function xh(e){let t=wh(bh(Zm(e.ast)));return(e,n)=>t(e,n?.disableChecks?n?.parseOptions?{...n.parseOptions,disableChecks:!0}:{disableChecks:!0}:n?.parseOptions)}function Sh(e){let t=xh(e);return(e,n)=>Ji(ha(t(e,n)))}function Ch(e){let t=xh(e);return(e,n)=>ma(_a(t(e,n),e=>Error(e.toString(),{cause:e})))}function wh(e){let t=Th(e);return(e,n)=>va(t(k(e),n??Jp),e=>e._tag===`None`?I(new cp(e)):P(e.value))}const Th=ce(e=>{let t,n=Jf(e)?.parseOptions;if(!e.context&&!e.encoding&&!e.checks)return(r,i)=>(t??=e.getParser(Th),n&&(i={...i,...n}),t(r,i));let r=Gp(e)||Kp(e)||Vp(e)&&e.typeParameters.length>0;return(i,a)=>{n&&(a={...a,...n});let o=e.encoding,s;if(o){let t=o,n=t.length;for(let e=n-1;e>=0;e--){let n=t[e],r=n.to,o=Th(r);if(s=s?va(s,e=>o(e,a)):o(i,a),n.transformation._tag===`Transformation`){let e=n.transformation.decode;s=va(s,t=>e.run(t,a))}else s=n.transformation.decode(s,a)}s=_a(s,t=>new rp(e,i,t))}t??=e.getParser(Th);let c=s?va(s,e=>t(e,a)):t(i,a);if(e.checks&&!a?.disableChecks){let t=e.checks;a?.errors===`all`&&r&&bn(i)&&(c=ya(c,n=>{let r=[];_h(t.filter(e=>e.annotations?.[`~structural`]),i.value,r,e,a);let o=Yn(r)?n._tag===`Composite`&&n.ast===e?new X(e,n.actual,[...n.issues,...r]):new X(e,i,[n,...r]):n;return I(o)})),c=va(c,n=>{if(bn(n)){let r=n.value,i=[];if(_h(t,r,i,e,a),Yn(i))return I(new X(e,n,i))}return P(n)})}return c}}),Eh=`~effect/Schema/Schema`,Dh={[Eh]:Eh,pipe(){return h(this,arguments)},annotate(e){return this.rebuild(zm(this.ast,e))},annotateKey(e){return this.rebuild(Km(this.ast,e))},check(...e){return this.rebuild(Vm(this.ast,e))}};function Oh(e,t){let n=Object.create(Dh);return t&&Object.assign(n,t),n.ast=e,n.rebuild=e=>Oh(e,t),n.makeEffect=se(xh(n),_a(e=>new Ah(e))),n.make=Ch(n),n.makeOption=Sh(n),n}const kh=`~effect/Schema/SchemaError`;var Ah=class{[kh]=kh;_tag=`SchemaError`;name=`SchemaError`;issue;constructor(e){this.issue=e}get message(){return this.issue.toString()}toString(){return`SchemaError(${this.message})`}};const jh=Eh,Mh=Oh;function Nh(e){return _(e,jh)&&e[jh]===jh}function Ph(e){let t=Mh(new $p(e),{literal:e,transform(n){return t.pipe(Wh(Ph(n),{decode:kp(()=>n),encode:kp(()=>e)}))}});return t}const Fh=Mh(tm),Ih=Mh(im),Lh=Mh(am);function Rh(e,t){return Mh(e,{fields:t,mapFields(e,t){let n=e(this.fields);return Rh(vm(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function zh(e){return Rh(vm(e,void 0),e)}const Bh=yh(e=>Mh(new om(!1,[],[e.ast]),{schema:e}));function Vh(e,t){return Mh(e,{members:t,mapMembers(e,t){let n=e(this.members);return Vh(bm(n,this.ast.mode,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Hh(e,t){return Vh(bm(e,t?.mode??`anyOf`,void 0),e)}function Uh(e){let t=e.map(Ph);return Mh(bm(t,`anyOf`,void 0),{literals:e,members:t,mapMembers(e){return Hh(e(this.members))},pick(e){return Uh(e)},transform(e){return Hh(t.map((t,n)=>t.transform(e[n])))}})}function Wh(e,t){return n=>Mh(Ym(n.ast,e.ast,t?Ip(t):Rp()),{from:n,to:e})}globalThis.Error,globalThis.Error,globalThis.RegExp,globalThis.URL,globalThis.File,globalThis.FormData,globalThis.URLSearchParams,globalThis.Uint8Array;const Gh=globalThis.Symbol.for(`immer-draftable`);function Kh(e,t,n,r,i){let a=Yh(n,t,r),o=Jh(t),s=class extends e{constructor(...[e,t]){e??={};let r=n.make(e,t);super({...e,...r},{...t,disableChecks:!0})}static[jh]=jh;get[o](){return o}static[Gh]=!0;static identifier=t;static fields=n.fields;static get ast(){return a(this).ast}static pipe(){return h(this,arguments)}static rebuild(e){return a(this).rebuild(e)}static make(e,t){return new this(e,t)}static makeOption(e,t){return Sh(a(this))(e??{},t)}static makeEffect(e,t){return a(this).makeEffect(e??{},t)}static annotate(e){return this.rebuild(zm(this.ast,e))}static annotateKey(e){return this.rebuild(Km(this.ast,e))}static check(...e){return this.rebuild(Vm(this.ast,e))}static extend(e){return(t,r)=>{let a={...n.fields,...t};return Kh(this,e,Rh(vm(a,n.ast.checks,{identifier:e}),a),r,i)}}static mapFields(e,t){return n.mapFields(e,t)}};return i!==void 0&&Object.assign(s.prototype,i(t)),s}function qh(e){return new Pp(kp(t=>new e(t)),Op())}function Jh(e){return`~effect/Schema/Class/${e}`}function Yh(e,t,n){let r;return i=>{if(r===void 0){let a=qh(i),o=Mh(new Qp([e.ast],()=>(e,n)=>e instanceof i||_(e,Jh(t))?P(e):I(new sp(n,k(e))),{identifier:t,[vh]:([e])=>new Z(e,a),toCodec:([e])=>new Z(e.ast,a),toArbitrary:([e])=>()=>e.map(e=>new i(e)),toFormatter:([e])=>t=>`${i.identifier}(${e(t)})`,"~sentinels":Sm(e.ast),...n}));r=e.pipe(Wh(o,a))}return r}}function Xh(e){return Nh(e)}const Zh=e=>(t,n)=>{let r=Xh(t)?t:zh(t);return Kh(Xi,e,r,n,e=>({toString(){return`${e}(${w({...this})})`}}))},Qh=Uh([`error`,`warning`,`info`]);var $=class extends Zh(`OgDiagnostic`)({message:Fh,points:Ih,severity:Qh,suggestion:Fh,tag:Fh}){};const $h=(e,t,n,r,i,a)=>({category:n,check:n=>P(n[e]?null:new $({message:i,points:t,severity:r,suggestion:a,tag:String(e)})),tag:String(e),weight:t}),eg=[{category:`og`,check:e=>{let t=e[`og:title`];if(!t)return P(new $({message:`Missing og:title tag`,points:10,severity:`error`,suggestion:`<meta property="og:title" content="Your Page Title" />`,tag:`og:title`}));let n=t.length;return P(n<30||n>60?new $({message:`og:title length (${n}) is not optimal (30-60 characters)`,points:4,severity:`warning`,suggestion:`Make your og:title between 30 and 60 characters. Current is: "${t}"`,tag:`og:title`}):null)},tag:`og:title`,weight:10},{category:`og`,check:e=>{let t=e[`og:description`];if(!t)return P(new $({message:`Missing og:description tag`,points:10,severity:`error`,suggestion:`<meta property="og:description" content="Your page description here." />`,tag:`og:description`}));let n=t.length;return P(n<55||n>200?new $({message:`og:description length (${n}) is not optimal (55-200 characters)`,points:4,severity:`warning`,suggestion:`Make your og:description between 55 and 200 characters. Current length: ${n}`,tag:`og:description`}):null)},tag:`og:description`,weight:10},$h(`og:image`,10,`og`,`error`,`Missing og:image tag`,`<meta property="og:image" content="https://example.com/og-image.png" />`),{category:`og`,check:e=>{let t=e[`og:url`];if(!t)return P(new $({message:`Missing og:url tag`,points:4,severity:`warning`,suggestion:`<meta property="og:url" content="https://example.com/page-path" />`,tag:`og:url`}));try{return new URL(t),P(null)}catch{return P(new $({message:`og:url is not a valid absolute URL`,points:2,severity:`warning`,suggestion:`Ensure og:url is an absolute URL (e.g., https://example.com/path). Current: "${t}"`,tag:`og:url`}))}},tag:`og:url`,weight:4},$h(`og:type`,2,`og`,`info`,`Missing og:type tag`,`<meta property="og:type" content="website" />`),$h(`og:locale`,2,`og`,`info`,`Missing og:locale tag`,`<meta property="og:locale" content="en_US" />`),$h(`og:site_name`,2,`og`,`info`,`Missing og:site_name tag`,`<meta property="og:site_name" content="Your Site Name" />`),{category:`twitter`,check:e=>{let t=e[`twitter:card`];return t?[`summary`,`summary_large_image`,`app`,`player`].includes(t)?P(null):P(new $({message:`Invalid twitter:card value: "${t}"`,points:3,severity:`warning`,suggestion:`Use one of: "summary", "summary_large_image", "app", "player"`,tag:`twitter:card`})):P(new $({message:`Missing twitter:card tag`,points:5,severity:`warning`,suggestion:`<meta name="twitter:card" content="summary_large_image" />`,tag:`twitter:card`}))},tag:`twitter:card`,weight:5},{category:`twitter`,check:e=>{let t=e[`twitter:title`];if(!t)return P(new $({message:`Missing twitter:title tag`,points:5,severity:`warning`,suggestion:`<meta name="twitter:title" content="Your Page Title" />`,tag:`twitter:title`}));let n=t.length;return P(n<30||n>60?new $({message:`twitter:title length (${n}) is not optimal (30-60 characters)`,points:2,severity:`info`,suggestion:`Keep twitter:title between 30 and 60 characters for optimal display. Current: "${t}"`,tag:`twitter:title`}):null)},tag:`twitter:title`,weight:5},{category:`twitter`,check:e=>{let t=e[`twitter:description`];if(!t)return P(new $({message:`Missing twitter:description tag`,points:5,severity:`warning`,suggestion:`<meta name="twitter:description" content="Your page description." />`,tag:`twitter:description`}));let n=t.length;return P(n<55||n>200?new $({message:`twitter:description length (${n}) is not optimal (55-200 characters)`,points:2,severity:`info`,suggestion:`Keep twitter:description between 55 and 200 characters. Current length: ${n}`,tag:`twitter:description`}):null)},tag:`twitter:description`,weight:5},$h(`twitter:image`,3,`twitter`,`warning`,`Missing twitter:image tag`,`<meta name="twitter:image" content="https://example.com/og-image.png" />`),$h(`twitter:site`,2,`twitter`,`info`,`Missing twitter:site tag`,`<meta name="twitter:site" content="@yourusername" />`),{category:`seo`,check:e=>{let t=e.title;if(!t)return P(new $({message:`Missing <title> tag`,points:6,severity:`error`,suggestion:`<title>Your page title for search results</title>`,tag:`title`}));let n=t.length;return P(n<30||n>60?new $({message:`<title> tag length (${n}) is not optimal (30-60 characters)`,points:2,severity:`warning`,suggestion:`Adjust your title tag length to be between 30 and 60 characters. Current: "${t}"`,tag:`title`}):null)},tag:`title`,weight:6},{category:`seo`,check:e=>{let t=e.description;if(!t)return P(new $({message:`Missing meta description`,points:6,severity:`error`,suggestion:`<meta name="description" content="A brief summary of the page content." />`,tag:`description`}));let n=t.length;return P(n<50||n>160?new $({message:`Meta description length (${n}) is not optimal (50-160 characters)`,points:2,severity:`warning`,suggestion:`Keep meta description between 50 and 160 characters for search snippets. Current length: ${n}`,tag:`description`}):null)},tag:`description`,weight:6},{category:`seo`,check:(e,t)=>{let n=e.canonical;if(!n)return P(new $({message:`Missing link[rel=canonical] tag`,points:5,severity:`warning`,suggestion:`<link rel="canonical" href="https://example.com/page-canonical" />`,tag:`canonical`}));try{new URL(n)}catch{return P(new $({message:`Canonical URL is not a valid absolute URL`,points:3,severity:`warning`,suggestion:`Ensure the canonical URL is absolute. Current: "${n}"`,tag:`canonical`}))}if(t?.pageUrl&&n!==t.pageUrl)try{let e=new URL(n),r=new URL(t.pageUrl);if(e.origin!==r.origin||e.pathname.replace(/\/$/u,``)!==r.pathname.replace(/\/$/u,``))return P(new $({message:`Canonical URL (${n}) does not match current page URL (${t.pageUrl})`,points:2,severity:`warning`,suggestion:`The canonical tag should point to the primary URL of this page.`,tag:`canonical`}))}catch{}return P(null)},tag:`canonical`,weight:5},{category:`seo`,check:e=>{let t=e.robots;return t&&t.toLowerCase().includes(`noindex`)?P(new $({message:`Page has noindex directives in robots meta tag`,points:3,severity:`warning`,suggestion:`If you want this page indexed by search engines, remove "noindex" from: "${t}"`,tag:`robots`})):P(null)},tag:`robots`,weight:3},$h(`viewport`,2,`seo`,`warning`,`Missing viewport meta tag`,`<meta name="viewport" content="width=device-width, initial-scale=1.0" />`),$h(`charset`,1,`seo`,`warning`,`Missing charset declaration`,`<meta charset="utf-8" />`),$h(`lang`,2,`seo`,`warning`,`Missing lang attribute on <html> tag`,`<html lang="en">`),{category:`image`,check:(e,t)=>{if(!e[`og:image`])return P(new $({message:`Image cannot be validated because og:image tag is missing`,points:5,severity:`error`,suggestion:`Add a valid og:image tag to pass image validations.`,tag:`og:image:reachable`}));let n=t?.imageMeta;return!n||n.size===void 0&&!n.width?P(new $({message:`og:image URL is unreachable or failed to fetch: "${e[`og:image`]}"`,points:5,severity:`error`,suggestion:`Verify the og:image URL is correct and publically accessible.`,tag:`og:image:reachable`})):P(null)},tag:`og:image:reachable`,weight:5},{category:`image`,check:(e,t)=>{if(!e[`og:image`])return P(null);let n=t?.imageMeta;return!n||!n.width||!n.height?P(null):n.width<1200||n.height<630?P(new $({message:`og:image dimensions (${n.width}x${n.height}) are below the recommended 1200x630 pixels`,points:5,severity:`warning`,suggestion:`Use an image that is at least 1200x630 pixels for rich social sharing previews.`,tag:`og:image:dimensions`})):P(null)},tag:`og:image:dimensions`,weight:5},{category:`image`,check:(e,t)=>{if(!e[`og:image`])return P(null);let n=t?.imageMeta;if(!n)return P(null);let r=n.type?.toLowerCase()||``;return[`png`,`jpeg`,`jpg`,`webp`,`image/png`,`image/jpeg`,`image/jpg`,`image/webp`].some(e=>r.includes(e))?P(null):P(new $({message:`og:image format (${r||`unknown`}) is not optimal. Use PNG, JPEG, or WebP`,points:3,severity:`warning`,suggestion:`Convert your image to PNG, JPEG, or WebP. SVG and GIF are not fully supported by all social platforms.`,tag:`og:image:format`}))},tag:`og:image:format`,weight:3},{category:`image`,check:(e,t)=>{if(!e[`og:image`])return P(null);let n=t?.imageMeta;if(!n||!n.size)return P(null);let r=n.size/1048576;return P(r>8?new $({message:`og:image size (${r.toFixed(2)}MB) exceeds 8MB`,points:2,severity:`warning`,suggestion:`Compress your og:image. Some platforms (like Discord/Twitter) will not render previews for images larger than 8MB.`,tag:`og:image:size`}):null)},tag:`og:image:size`,weight:2}],tg=(e,t)=>F(function*(){let n=(yield*ra(eg.map(n=>n.check(e,t).pipe(ua(e=>e?{category:n.category,diag:e}:null))))).filter(e=>e!==null),r=kf.map(e=>{let t=Af[e],r=n.filter(t=>t.category===e).map(e=>e.diag),i=r.reduce((e,t)=>e+t.points,0),a=Math.max(0,t.maxScore-i);return{diagnostics:r,id:e,maxScore:t.maxScore,name:t.name,score:a}}),i=r.reduce((e,t)=>e+t.score,0),a=n.map(e=>e.diag);return{categories:r,diagnostics:a,maxScore:100,passed:a.length===0,score:i,url:t?.pageUrl}}),ng=e=>{if(e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71&&e.length>=24){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=t.getUint32(16,!1);return{height:t.getUint32(20,!1),type:`png`,width:n}}if(e[0]===255&&e[1]===216){let t=2,n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(;t<e.length-8;){let r=n.getUint16(t,!1);if(t+=2,r===65497||r===65498)break;let i=n.getUint16(t,!1);if(r>=65472&&r<=65475&&t+7<e.length)return{height:n.getUint16(t+3,!1),type:`jpeg`,width:n.getUint16(t+5,!1)};t+=i}}if(e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=String.fromCodePoint(e[12],e[13],e[14],e[15]);if(n===`VP8 `&&e.length>=30){let e=t.getUint16(26,!0)&16383;return{height:t.getUint16(28,!0)&16383,type:`webp`,width:e}}if(n===`VP8L`&&e.length>=25){let[t,n,r,i]=e.subarray(21,25),a=1+(t|(n&63)<<8);return{height:1+((n&192)>>6|r<<2|(i&15)<<10),type:`webp`,width:a}}if(n===`VP8X`&&e.length>=30){let t=1+(e[24]|e[25]<<8|e[26]<<16);return{height:1+(e[27]|e[28]<<8|e[29]<<16),type:`webp`,width:t}}}return{}},rg=e=>F(function*(){let t=e.headers.get(`Content-Length`),n=e.headers.get(`Content-Range`),r;if(n){let e=n.match(/\/(?<g1>\d+)$/u);e&&(r=Math.trunc(Number(e[1])))}if(!r&&t){let e=Math.trunc(Number(t));r=Number.isFinite(e)&&e>=0?e:void 0}let i=e.headers.get(`Content-Type`)||void 0,a=yield*N({catch:e=>Error(`Failed to read image body: ${e instanceof Error?e.message:String(e)}`),try:()=>Ta(e,262144)});if(a===null)return yield*I(Error(`Failed to read image body: response is too large`));let o=ng(new Uint8Array(a));return{...o,size:r,type:o.type||i}}),ig=(e,t)=>F(function*(){let n=Sa(t?.fetch??fetch),r=yield*N({catch:e=>Error(`Failed to fetch image: ${e instanceof Error?e.message:String(e)}`),try:()=>n(e,{headers:{Range:`bytes=0-131072`}})});if(!r.ok&&r.status!==206){let t=yield*N({catch:e=>Error(`Failed fallback fetch image: ${e instanceof Error?e.message:String(e)}`),try:()=>n(e)});return t.ok?yield*rg(t):yield*I(Error(`Failed to fetch image: Status ${t.status}`))}return yield*rg(r)}),ag=(e,t,n)=>F(function*(){let r=null,i=e[`og:image`];if(i){let e=yield*ig(i,n).pipe(ca);e._tag===`Success`&&(r=e.success)}return yield*tg(e,{imageMeta:r,pageUrl:t})}),og=(e,t,n)=>pa(ag(e,t,n));Zh(`ScoreResult`)({diagnostics:Bh($),maxScore:Ih,passed:Lh,score:Ih});const sg=e=>{let t=[],n=e.split(/\r?\n/u),r=!1;for(let e of n){if(e=e.trim(),e.startsWith(`#`)||e===``)continue;let n=e.split(`:`);if(n.length<2)continue;let i=n[0].trim().toLowerCase(),a=n.slice(1).join(`:`).trim();if(i===`user-agent`)r=a===`*`;else if(r&&i===`disallow`&&a!==``){if(a.length>512)continue;let e=a.startsWith(`/`)?a:`*${a}`;t.push(e)}}return{disallowedPatterns:t}},cg=(e,t)=>{let n=e.toLowerCase(),r=t.toLowerCase(),i=0,a=0,o=-1,s=0;for(;a<r.length;){let e=r[a];if(i<n.length&&(e===`?`||e===n[i]))i+=1,a+=1;else if(e===`*`)o=a,s=i,a+=1;else if(o===-1)return!1;else{if(s+=1,s>n.length)return!1;i=s,a=o+1}}return!0},lg=(e,t)=>t.disallowedPatterns.some(t=>cg(e,t)),ug=e=>{let{pathname:t}=e;if(t.includes(`/_next/`)||t.startsWith(`/_next`)||t.includes(`/node_modules/`))return!1;let n=`.png,.jpg,.jpeg,.gif,.svg,.ico,.webp,.avif,.css,.js,.mjs,.ts,.map,.pdf,.epub,.zip,.tar,.gz,.mp4,.webm,.ogg,.mp3,.wav,.woff,.woff2,.ttf,.eot,.xml,.json,.txt`.split(`,`),r=t.split(`/`).pop()||``;if(r.includes(`.`)){let e=r.slice(r.lastIndexOf(`.`)).toLowerCase();if(n.includes(e))return!1}return!0},dg=(e,t)=>e.hostname.replace(/^www\./iu,``)===t.hostname.replace(/^www\./iu,``)&&e.protocol===t.protocol,fg=(e,t)=>F(function*(){let n=yield*oa({catch:e=>Error(`Invalid start URL: ${e instanceof Error?e.message:String(e)}`),try:()=>new URL(e)}),{origin:r}=n,i=Sa(t.fetch??fetch),a=yield*to(e,{fetch:i}).pipe(ca),o={disallowedPatterns:[]};a._tag===`Success`&&(o=sg(a.success.content));let s=new Set,c=new Map,l=[n.href];c.set(n.href,void 0);let{maxUrls:u}=t,d=t.concurrency||5,f=(e,t)=>{let i=[],a=/href=["'](?<g1>[^"']+)["']/giu,o;for(;(o=a.exec(e))!==null;){let[,e]=o;try{let a=new URL(e,t);if(dg(a,n)&&ug(a)){a.hash=``;let{href:e}=a;e.endsWith(`/`)&&e!==`${r}/`&&(e=e.slice(0,-1)),i.push(e)}}catch{}}return i};for(;l.length>0&&s.size<u;){let e=Math.min(d,l.length,u-s.size),t=l.splice(0,e),n=yield*ra(t.map(e=>{s.add(e);let t=new URL(e);return lg(t.pathname+t.search,o)?P({html:``,skipped:!0,url:e}):N({catch:()=>Error(`Failed fetch`),try:()=>i(e)}).pipe(sa(t=>t.ok?N({catch:()=>Error(`Failed read text`),try:()=>wa(t,xa)}).pipe(ua(t=>({html:t??``,skipped:t===null,url:e}))):P({html:``,skipped:!0,url:e})),da(()=>P({html:``,skipped:!0,url:e})))}),{concurrency:d});for(let e of n){if(e.skipped||!e.html)continue;let t=f(e.html,e.url);for(let n of t)!c.has(n)&&c.size<u*2&&(c.set(n,e.url),l.push(n))}}return[...s].slice(0,u).map(e=>({foundOn:c.get(e),url:e}))}).pipe(fa(e=>e instanceof Error?e:Error(String(e)))),pg=(e,t)=>F(function*(){let n=yield*mo(e,{fetch:t.fetch}).pipe(ca),r=[];if(n._tag===`Success`&&(r=(n.success.urls||[]).map(e=>e.loc)),r.length>0){let n=yield*oa({catch:e=>Error(`Invalid site URL: ${e instanceof Error?e.message:String(e)}`),try:()=>new URL(e)}),i=r.filter(e=>{try{let t=new URL(e);return dg(t,n)&&ug(t)}catch{return!1}});if(i.length>0)return i.slice(0,t.maxUrls).map(e=>({url:e}))}return yield*fg(e,{concurrency:t.concurrency,fetch:t.fetch,maxUrls:t.maxUrls})}).pipe(fa(e=>e instanceof Error?e:Error(String(e)))),mg=e=>F(function*(){e.onProgress&&e.onProgress({completedUrls:0,totalUrls:0,type:`discovery`});let t=yield*pg(e.siteUrl,{concurrency:e.concurrency,fetch:e.fetch,maxUrls:e.maxUrls});if(t.length===0)return{averageScore:0,categoryAverages:{image:0,og:0,seo:0,twitter:0},pages:[],scannedAt:new Date().toISOString(),siteUrl:e.siteUrl,summary:{excellent:0,fair:0,good:0,poor:0},totalPages:0};let n=0,r=t.length;e.onProgress&&e.onProgress({completedUrls:0,totalUrls:r,type:`checking`});let i=({foundOn:t,url:i})=>F(function*(){if(e.signal?.aborted)return yield*I(Error(`Scan aborted`));let a=yield*$a(i,{fetch:e.fetch}).pipe(ca),o={};a._tag===`Success`&&(o=a.success);let s={...yield*ag(o,i,{fetch:e.fetch}),foundOn:t};return n+=1,e.onProgress&&e.onProgress({completedUrls:n,result:s,totalUrls:r,type:`checking`,url:i}),s}),a=yield*ra(t.map(e=>i(e)),{concurrency:e.concurrency}),o=a.length,s=a.reduce((e,t)=>e+t.score,0),c=Math.round(s/o),l={image:0,og:0,seo:0,twitter:0};for(let e of a)for(let t of e.categories){let e=t.maxScore>0?t.score/t.maxScore*100:0;l[t.id]+=e}let u={image:Math.round(l.image/o),og:Math.round(l.og/o),seo:Math.round(l.seo/o),twitter:Math.round(l.twitter/o)},d={excellent:0,fair:0,good:0,poor:0};for(let e of a)e.score>=90?d.excellent+=1:e.score>=75?d.good+=1:e.score>=50?d.fair+=1:d.poor+=1;let f={averageScore:c,categoryAverages:u,pages:a,scannedAt:new Date().toISOString(),siteUrl:e.siteUrl,summary:d,totalPages:o};return e.onProgress&&e.onProgress({completedUrls:n,totalUrls:r,type:`complete`}),f}).pipe(fa(e=>e instanceof Error?e:Error(String(e)))),hg=e=>pa(mg(e)),gg=e=>{let n=Math.trunc(Number(e));if(!Number.isFinite(n))throw new t(`Expected a whole number.`);return n},_g=e=>{let n=gg(e);if(n<1)throw new t(`Expected a whole number of 1 or more.`);return n},vg=e=>{let n=gg(e);if(n<0||n>100)throw new t(`Expected a whole number between 0 and 100.`);return n},yg=(e,t,n)=>{let r=e,i=t.map(e=>{let t=r[e];return t?` ${c.dim(e)}: ${t}`:null}).filter(e=>e!==null);return i.length>0?`${i.join(`
|
|
72
|
-
`)}\n`:` ${n}\n`},
|
|
70
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ku(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ju(t,`input`,e.processors),output:ju(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function G(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return G(r.element,n);if(r.type===`set`)return G(r.valueType,n);if(r.type===`lazy`)return G(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return G(r.innerType,n);if(r.type===`intersection`)return G(r.left,n)||G(r.right,n);if(r.type===`record`||r.type===`map`)return G(r.keyType,n)||G(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:G(r.in,n)||G(r.out,n);if(r.type===`object`){for(let e in r.shape)if(G(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(G(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(G(e,n))return!0;return!!(r.rest&&G(r.rest,n))}return!1}const Au=(e,t={})=>n=>{let r=Du({...n,processors:t});return W(e,r),Ou(r,e),ku(r,e)},ju=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Du({...i??{},target:a,io:t,processors:n});return W(e,o),Ou(o,e),ku(o,e)},Mu={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Nu=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Mu[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Pu=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Fu=(e,t,n,r)=>{n.not={}},Iu=(e,t,n,r)=>{let i=e._zod.def,a=So(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Lu=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Ru=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},zu=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=W(a.element,t,{...r,path:[...r.path,`items`]})},Bu=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=W(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=W(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Vu=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>W(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Hu=(e,t,n,r)=>{let i=e._zod.def,a=W(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=W(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Uu=(e,t,n,r)=>{let i=e._zod.def,a=W(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Wu=(e,t,n,r)=>{let i=e._zod.def;W(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Gu=(e,t,n,r)=>{let i=e._zod.def;W(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Ku=(e,t,n,r)=>{let i=e._zod.def;W(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},qu=(e,t,n,r)=>{let i=e._zod.def;W(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Ju=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;W(o,t,r);let s=t.seen.get(e);s.ref=o},Yu=(e,t,n,r)=>{let i=e._zod.def;W(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Xu=(e,t,n,r)=>{let i=e._zod.def;W(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Zu=R(`ZodISODateTime`,(e,t)=>{Dc.init(e,t),Y.init(e,t)});function Qu(e){return Yl(Zu,e)}const $u=R(`ZodISODate`,(e,t)=>{Oc.init(e,t),Y.init(e,t)});function ed(e){return Xl($u,e)}const td=R(`ZodISOTime`,(e,t)=>{kc.init(e,t),Y.init(e,t)});function nd(e){return Zl(td,e)}const rd=R(`ZodISODuration`,(e,t)=>{Ac.init(e,t),Y.init(e,t)});function id(e){return Ql(rd,e)}const K=R(`ZodError`,(e,t)=>{is.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>ss(e,t)},flatten:{value:t=>os(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Co,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Co,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),ad=cs(K),od=ls(K),sd=us(K),cd=fs(K),ld=ms(K),ud=hs(K),dd=gs(K),fd=_s(K),pd=vs(K),md=ys(K),hd=bs(K),gd=xs(K),_d=new WeakMap;function vd(e,t,n){let r=Object.getPrototypeOf(e),i=_d.get(r);if(i||(i=new Set,_d.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const q=R(`ZodType`,(e,t)=>(H.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ju(e,`input`),output:ju(e,`output`)}}),e.toJSONSchema=Au(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>ad(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>sd(e,t,n),e.parseAsync=async(t,n)=>od(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>cd(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ld(e,t,n),e.decode=(t,n)=>ud(e,t,n),e.encodeAsync=async(t,n)=>dd(e,t,n),e.decodeAsync=async(t,n)=>fd(e,t,n),e.safeEncode=(t,n)=>pd(e,t,n),e.safeDecode=(t,n)=>md(e,t,n),e.safeEncodeAsync=async(t,n)=>hd(e,t,n),e.safeDecodeAsync=async(t,n)=>gd(e,t,n),vd(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Ao(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Bo(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ef(e,t))},superRefine(e,t){return this.check(Df(e,t))},overwrite(e){return this.check(_u(e))},optional(){return cf(this)},exactOptional(){return uf(this)},nullable(){return ff(this)},nullish(){return cf(ff(this))},nonoptional(e){return vf(this,e)},array(){return Yd(this)},or(e){return $d([this,e])},and(e){return tf(this,e)},transform(e){return Sf(this,of(e))},default(e){return mf(this,e)},prefault(e){return gf(this,e)},catch(e){return bf(this,e)},pipe(e){return Sf(this,e)},readonly(){return wf(this)},describe(e){let t=this.clone();return Tl.add(t,{description:e}),t},meta(...e){if(e.length===0)return Tl.get(this);let t=this.clone();return Tl.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return Tl.get(e)?.description},configurable:!0}),e)),yd=R(`_ZodString`,(e,t)=>{hc.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nu(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,vd(e,`_ZodString`,{regex(...e){return this.check(du(...e))},includes(...e){return this.check(mu(...e))},startsWith(...e){return this.check(hu(...e))},endsWith(...e){return this.check(gu(...e))},min(...e){return this.check(lu(...e))},max(...e){return this.check(cu(...e))},length(...e){return this.check(uu(...e))},nonempty(...e){return this.check(lu(1,...e))},lowercase(e){return this.check(fu(e))},uppercase(e){return this.check(pu(e))},trim(){return this.check(yu())},normalize(...e){return this.check(vu(...e))},toLowerCase(){return this.check(bu())},toUpperCase(){return this.check(xu())},slugify(){return this.check(Su())}})}),bd=R(`ZodString`,(e,t)=>{hc.init(e,t),yd.init(e,t),e.email=t=>e.check(Dl(xd,t)),e.url=t=>e.check(Nl(wd,t)),e.jwt=t=>e.check(Jl(zd,t)),e.emoji=t=>e.check(Pl(Td,t)),e.guid=t=>e.check(Ol(Sd,t)),e.uuid=t=>e.check(kl(Cd,t)),e.uuidv4=t=>e.check(Al(Cd,t)),e.uuidv6=t=>e.check(jl(Cd,t)),e.uuidv7=t=>e.check(Ml(Cd,t)),e.nanoid=t=>e.check(Fl(Ed,t)),e.guid=t=>e.check(Ol(Sd,t)),e.cuid=t=>e.check(Il(Dd,t)),e.cuid2=t=>e.check(Ll(Od,t)),e.ulid=t=>e.check(Rl(kd,t)),e.base64=t=>e.check(Gl(Id,t)),e.base64url=t=>e.check(Kl(Ld,t)),e.xid=t=>e.check(zl(Ad,t)),e.ksuid=t=>e.check(Bl(jd,t)),e.ipv4=t=>e.check(Vl(Md,t)),e.ipv6=t=>e.check(Hl(Nd,t)),e.cidrv4=t=>e.check(Ul(Pd,t)),e.cidrv6=t=>e.check(Wl(Fd,t)),e.e164=t=>e.check(ql(Rd,t)),e.datetime=t=>e.check(Qu(t)),e.date=t=>e.check(ed(t)),e.time=t=>e.check(nd(t)),e.duration=t=>e.check(id(t))});function J(e){return El(bd,e)}const Y=R(`ZodStringFormat`,(e,t)=>{U.init(e,t),yd.init(e,t)}),xd=R(`ZodEmail`,(e,t)=>{vc.init(e,t),Y.init(e,t)}),Sd=R(`ZodGUID`,(e,t)=>{gc.init(e,t),Y.init(e,t)}),Cd=R(`ZodUUID`,(e,t)=>{_c.init(e,t),Y.init(e,t)}),wd=R(`ZodURL`,(e,t)=>{yc.init(e,t),Y.init(e,t)}),Td=R(`ZodEmoji`,(e,t)=>{bc.init(e,t),Y.init(e,t)}),Ed=R(`ZodNanoID`,(e,t)=>{xc.init(e,t),Y.init(e,t)}),Dd=R(`ZodCUID`,(e,t)=>{Sc.init(e,t),Y.init(e,t)}),Od=R(`ZodCUID2`,(e,t)=>{Cc.init(e,t),Y.init(e,t)}),kd=R(`ZodULID`,(e,t)=>{wc.init(e,t),Y.init(e,t)}),Ad=R(`ZodXID`,(e,t)=>{Tc.init(e,t),Y.init(e,t)}),jd=R(`ZodKSUID`,(e,t)=>{Ec.init(e,t),Y.init(e,t)}),Md=R(`ZodIPv4`,(e,t)=>{jc.init(e,t),Y.init(e,t)}),Nd=R(`ZodIPv6`,(e,t)=>{Mc.init(e,t),Y.init(e,t)}),Pd=R(`ZodCIDRv4`,(e,t)=>{Nc.init(e,t),Y.init(e,t)}),Fd=R(`ZodCIDRv6`,(e,t)=>{Pc.init(e,t),Y.init(e,t)}),Id=R(`ZodBase64`,(e,t)=>{Ic.init(e,t),Y.init(e,t)}),Ld=R(`ZodBase64URL`,(e,t)=>{Rc.init(e,t),Y.init(e,t)}),Rd=R(`ZodE164`,(e,t)=>{zc.init(e,t),Y.init(e,t)}),zd=R(`ZodJWT`,(e,t)=>{Vc.init(e,t),Y.init(e,t)}),Bd=R(`ZodNumber`,(e,t)=>{Hc.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pu(e,t,n,r),vd(e,`ZodNumber`,{gt(e,t){return this.check(au(e,t))},gte(e,t){return this.check(ou(e,t))},min(e,t){return this.check(ou(e,t))},lt(e,t){return this.check(ru(e,t))},lte(e,t){return this.check(iu(e,t))},max(e,t){return this.check(iu(e,t))},int(e){return this.check(Ud(e))},safe(e){return this.check(Ud(e))},positive(e){return this.check(au(0,e))},nonnegative(e){return this.check(ou(0,e))},negative(e){return this.check(ru(0,e))},nonpositive(e){return this.check(iu(0,e))},multipleOf(e,t){return this.check(su(e,t))},step(e,t){return this.check(su(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Vd(e){return $l(Bd,e)}const Hd=R(`ZodNumberFormat`,(e,t)=>{Uc.init(e,t),Bd.init(e,t)});function Ud(e){return eu(Hd,e)}const Wd=R(`ZodUnknown`,(e,t)=>{Wc.init(e,t),q.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Gd(){return tu(Wd)}const Kd=R(`ZodNever`,(e,t)=>{Gc.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fu(e,t,n,r)});function qd(e){return nu(Kd,e)}const Jd=R(`ZodArray`,(e,t)=>{qc.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zu(e,t,n,r),e.element=t.element,vd(e,`ZodArray`,{min(e,t){return this.check(lu(e,t))},nonempty(e){return this.check(lu(1,e))},max(e,t){return this.check(cu(e,t))},length(e,t){return this.check(uu(e,t))},unwrap(){return this.element}})});function Yd(e,t){return Cu(Jd,e,t)}const Xd=R(`ZodObject`,(e,t)=>{Qc.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bu(e,t,n,r),z(e,`shape`,()=>t.shape),vd(e,`ZodObject`,{keyof(){return rf(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Gd()})},loose(){return this.clone({...this._zod.def,catchall:Gd()})},strict(){return this.clone({...this._zod.def,catchall:qd()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Go(this,e)},safeExtend(e){return Ko(this,e)},merge(e){return qo(this,e)},pick(e){return Uo(this,e)},omit(e){return Wo(this,e)},partial(...e){return Jo(sf,this,e[0])},required(...e){return Yo(_f,this,e[0])}})});function Zd(e,t){let n={type:`object`,shape:e??{},...B(t)};return new Xd(n)}const Qd=R(`ZodUnion`,(e,t)=>{el.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vu(e,t,n,r),e.options=t.options});function $d(e,t){return new Qd({type:`union`,options:e,...B(t)})}const ef=R(`ZodIntersection`,(e,t)=>{tl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hu(e,t,n,r)});function tf(e,t){return new ef({type:`intersection`,left:e,right:t})}const nf=R(`ZodEnum`,(e,t)=>{il.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Iu(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new nf({...t,checks:[],...B(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new nf({...t,checks:[],...B(r),entries:i})}});function rf(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new nf({type:`enum`,entries:n,...B(t)})}const af=R(`ZodTransform`,(e,t)=>{al.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ru(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new yo(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(ns(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(ns(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function of(e){return new af({type:`transform`,transform:e})}const sf=R(`ZodOptional`,(e,t)=>{sl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function cf(e){return new sf({type:`optional`,innerType:e})}const lf=R(`ZodExactOptional`,(e,t)=>{cl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uf(e){return new lf({type:`optional`,innerType:e})}const df=R(`ZodNullable`,(e,t)=>{ll.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ff(e){return new df({type:`nullable`,innerType:e})}const pf=R(`ZodDefault`,(e,t)=>{ul.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function mf(e,t){return new pf({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Lo(t)}})}const hf=R(`ZodPrefault`,(e,t)=>{fl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ku(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gf(e,t){return new hf({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Lo(t)}})}const _f=R(`ZodNonOptional`,(e,t)=>{pl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function vf(e,t){return new _f({type:`nonoptional`,innerType:e,...B(t)})}const yf=R(`ZodCatch`,(e,t)=>{hl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function bf(e,t){return new yf({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const xf=R(`ZodPipe`,(e,t)=>{gl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ju(e,t,n,r),e.in=t.in,e.out=t.out});function Sf(e,t){return new xf({type:`pipe`,in:e,out:t})}const Cf=R(`ZodReadonly`,(e,t)=>{vl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yu(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function wf(e){return new Cf({type:`readonly`,innerType:e})}const Tf=R(`ZodCustom`,(e,t)=>{bl.init(e,t),q.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lu(e,t,n,r)});function Ef(e,t={}){return wu(Tf,e,t)}function Df(e,t){return Tu(e,t)}const Of=Zd({href:J(),rel:J(),sizes:J().optional(),type:J().optional()});Zd({applicationName:J().optional(),author:J().optional(),canonical:J().optional(),charset:J().optional(),colorScheme:J().optional(),description:J().optional(),favicons:Yd(Of).optional(),formatDetection:J().optional(),generator:J().optional(),keywords:J().optional(),lang:J().optional(),license:J().optional(),"og:description":J().optional(),"og:image":J().optional(),"og:image:height":J().optional(),"og:image:type":J().optional(),"og:image:width":J().optional(),"og:locale":J().optional(),"og:site_name":J().optional(),"og:title":J().optional(),"og:type":J().optional(),"og:url":J().optional(),rawHead:J().optional(),robots:J().optional(),themeColor:J().optional(),themeColorDark:J().optional(),themeColorLight:J().optional(),title:J().optional(),"twitter:card":J().optional(),"twitter:creator":J().optional(),"twitter:description":J().optional(),"twitter:image":J().optional(),"twitter:site":J().optional(),"twitter:title":J().optional(),viewport:J().optional()}).loose(),Zd({height:Vd().optional(),size:Vd().optional(),type:J().optional(),url:J(),width:Vd().optional()}),Zd({content:J().optional(),error:J().optional()});const kf=Zd({changefreq:J().optional(),lastmod:J().optional(),loc:J(),priority:J().optional()});Zd({content:J().optional(),error:J().optional(),urls:Yd(kf).optional()});const Af=[`og`,`twitter`,`seo`,`image`],jf={image:{maxScore:15,name:`og:image Validation`},og:{maxScore:40,name:`Open Graph`},seo:{maxScore:25,name:`Core SEO`},twitter:{maxScore:20,name:`Twitter Card`}},Mf=`~effect/BigDecimal`,Nf={[Mf]:Mf,[b](){let e=Bf(this);return S(x(e.value),ye(e.scale))},[w](e){return Pf(e)&&Wf(this,e)},toString(){return`BigDecimal(${Gf(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[rt](){return this.toJSON()},pipe(){return _(this,arguments)}},Pf=e=>y(e,Mf),Ff=(e,t)=>{let n=Object.create(Nf);return n.value=e,n.scale=t,n},If=(e,t)=>{if(e!==Lf&&e%Rf===Lf)throw RangeError(`Value must be normalized`);let n=Ff(e,t);return n.normalized=n,n},Lf=BigInt(0),Rf=BigInt(10),zf=If(Lf,0),Bf=e=>{if(e.normalized===void 0){if(e.value===Lf)e.normalized=zf;else{let t=`${e.value}`,n=0;for(let e=t.length-1;e>=0&&t[e]===`0`;e--)n++;n===0&&(e.normalized=e);let r=BigInt(t.substring(0,t.length-n)),i=e.scale-n;e.normalized=If(r,i)}}return e.normalized},Vf=v(2,(e,t)=>t>e.scale?Ff(e.value*Rf**BigInt(t-e.scale),t):t<e.scale?Ff(e.value/Rf**BigInt(e.scale-t),t):e),Hf=e=>e.value<Lf?Ff(-e.value,e.scale):e,Uf=Yt((e,t)=>e.scale>t.scale?Vf(t,e.scale).value===e.value:e.scale<t.scale?Vf(e,t.scale).value===t.value:e.value===t.value),Wf=v(2,(e,t)=>Uf(e,t)),Gf=e=>{let t=Bf(e);if(Math.abs(t.scale)>=16)return Kf(t);let n=t.value<Lf,r=n?`${t.value}`.substring(1):`${t.value}`,i,a;if(t.scale>=r.length)i=`0`,a=`0`.repeat(t.scale-r.length)+r;else{let e=r.length-t.scale;if(e>r.length){let t=e-r.length;i=`${r}${`0`.repeat(t)}`,a=``}else a=r.slice(e),i=r.slice(0,e)}let o=a===``?i:`${i}.${a}`;return n?`-${o}`:o},Kf=e=>{if(qf(e))return`0e+0`;let t=Bf(e),n=`${Hf(t).value}`,r=n.slice(0,1),i=n.slice(1),a=`${Jf(t)?`-`:``}${r}`;i!==``&&(a+=`.${i}`);let o=i.length-t.scale;return`${a}e${o>=0?`+`:``}${o}`},qf=e=>e.value===Lf,Jf=e=>e.value<Lf;xn()(`effect/DateTime/CurrentTimeZone`),Zi(`EncodingError`);function Yf(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function Xf(e){return t=>Yf(t)?.[e]}const Zf=Xf(`identifier`),Qf=oe(e=>{let t=Zf(e);return typeof t==`string`?t:e.getExpected(Qf)});function $f(e,t,n){return t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n,e}globalThis.RegExp;const ep=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,`\\$&`),tp=`~effect/SchemaIssue/Issue`;function np(e){return y(e,tp)}var rp=class{[tp]=tp;toString(){return Sp(this)}},ip=class extends rp{_tag=`Filter`;actual;filter;issue;constructor(e,t,n){super(),this.actual=e,this.filter=t,this.issue=n}},ap=class extends rp{_tag=`Encoding`;ast;actual;issue;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issue=n}},op=class extends rp{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},sp=class extends rp{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},cp=class extends rp{_tag=`UnexpectedKey`;ast;actual;constructor(e,t){super(),this.ast=e,this.actual=t}},X=class extends rp{_tag=`Composite`;ast;actual;issues;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issues=n}},lp=class extends rp{_tag=`InvalidType`;ast;actual;constructor(e,t){super(),this.ast=e,this.actual=t}},up=class extends rp{_tag=`InvalidValue`;actual;annotations;constructor(e,t){super(),this.actual=e,this.annotations=t}},dp=class extends rp{_tag=`AnyOf`;ast;actual;issues;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issues=n}},fp=class extends rp{_tag=`OneOf`;ast;actual;successes;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.successes=n}};function pp(e,t){if(np(t))return t;if(typeof t==`string`)return new up(j(e),{message:t});let n=typeof t.issue==`string`?new up(j(e),{message:t.issue}):t.issue;return new op(t.path,n)}function mp(e,t){if(t!==void 0)return typeof t==`boolean`?t?void 0:new up(j(e)):pp(e,t)}function hp(e,t,n){return Array.isArray(n)?Jn(n)?n.length===1?pp(e,n[0]):new X(t,j(e),tr(n,t=>pp(e,t))):void 0:mp(e,n)}const gp=e=>{let t=wp(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return vp(Qf(e.ast),Ep(e.actual));case`InvalidValue`:return`Invalid data ${Ep(e.actual)}`;case`MissingKey`:return`Missing key`;case`UnexpectedKey`:return`Unexpected key with value ${E(e.actual)}`;case`Forbidden`:return`Forbidden operation`;case`OneOf`:return`Expected exactly one member to match the input ${E(e.actual)}`}},_p=e=>wp(e.issue)??wp(e);function vp(e,t){return`Expected ${e}, got ${t}`}function yp(e,t,n,r){switch(e._tag){case`Filter`:{let i=r(e);if(i!==void 0)return[{path:t,message:i}];switch(e.issue._tag){case`InvalidValue`:return[{path:t,message:vp(bp(e.filter),E(e.actual))}];default:return yp(e.issue,t,n,r)}}case`Encoding`:return yp(e.issue,t,n,r);case`Pointer`:return yp(e.issue,[...t,...e.path],n,r);case`Composite`:return e.issues.flatMap(e=>yp(e,t,n,r));case`AnyOf`:{let i=wp(e);return e.issues.length===0?i===void 0?[{path:t,message:vp(Qf(e.ast),E(e.actual))}]:[{path:t,message:i}]:e.issues.flatMap(e=>yp(e,t,n,r))}default:return[{path:t,message:n(e)}]}}function bp(e){let t=e.annotations?.expected;if(typeof t==`string`)return t;switch(e._tag){case`Filter`:return`<filter>`;case`FilterGroup`:return e.checks.map(e=>bp(e)).join(` & `)}}function xp(){return e=>yp(e,[],gp,_p).map(Cp).join(`
|
|
71
|
+
`)}const Sp=xp();function Cp(e){let t=e.message;if(e.path&&e.path.length>0){let n=et(e.path);t+=`\n at ${n}`}return t}function wp(e){switch(e._tag){case`InvalidType`:case`OneOf`:case`Composite`:case`AnyOf`:return Tp(e.ast.annotations);case`InvalidValue`:case`Forbidden`:return Tp(e.annotations);case`MissingKey`:return Tp(e.annotations,`messageMissingKey`);case`UnexpectedKey`:return Tp(e.ast.annotations,`messageUnexpectedKey`);case`Filter`:return Tp(e.filter.annotations);case`Encoding`:return wp(e.issue)}}function Tp(e,t=`message`){let n=e?.[t];if(typeof n==`string`)return n}function Ep(e){return _n(e)?`no value provided`:E(e.value)}var Dp=class e extends te{run;constructor(e){super(),this.run=e}map(t){return new e((e,n)=>this.run(e,n).pipe(ga(yn(t))))}compose(t){return kp(this)?t:kp(t)?this:new e((e,n)=>this.run(e,n).pipe(va(e=>t.run(e,n))))}};const Op=new Dp(F);function kp(e){return e.run===Op.run}function Ap(){return Op}function jp(e){return Mp(yn(e))}function Mp(e){return new Dp(t=>F(e(t)))}function Np(){return jp(globalThis.String)}function Pp(){return jp(globalThis.Number)}const Fp=`~effect/SchemaTransformation/Transformation`;var Ip=class e{[Fp]=Fp;_tag=`Transformation`;decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new e(this.encode,this.decode)}compose(t){return new e(this.decode.compose(t.decode),t.encode.compose(this.encode))}};function Lp(e){return y(e,Fp)}const Rp=e=>Lp(e)?e:new Ip(e.decode,e.encode),zp=new Ip(Ap(),Ap());function Bp(){return zp}const Vp=new Ip(Pp(),Np());function Hp(e){return t=>t._tag===e}const Up=Hp(`Declaration`),Wp=Hp(`Never`),Gp=Hp(`Literal`),Kp=Hp(`UniqueSymbol`),qp=Hp(`Arrays`),Jp=Hp(`Objects`),Yp=Hp(`Union`);var Z=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}};const Xp={};var Zp=class{isOptional;isMutable;defaultValue;annotations;constructor(e,t,n=void 0,r=void 0){this.isOptional=e,this.isMutable=t,this.defaultValue=n,this.annotations=r}};const Qp=`~effect/Schema`;var $p=class{[Qp]=Qp;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,r=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=r}toString(){return`<${this._tag}>`}},em=class e extends $p{_tag=`Declaration`;typeParameters;run;constructor(e,t,n,r,i,a){super(n,r,i,a),this.typeParameters=e,this.run=t}getParser(){let e=this.run(this.typeParameters);return(t,n)=>_n(t)?aa:ga(e(t.value,this,n),j)}recur(t){let n=qm(this.typeParameters,t);return n===this.typeParameters?this:new e(n,this.run,this.annotations,this.checks,void 0,this.context)}getExpected(){let e=this.annotations?.expected;return typeof e==`string`?e:`<Declaration>`}},tm=class extends $p{_tag=`Literal`;literal;constructor(e,t,n,r,i){if(super(t,n,r,i),typeof e==`number`&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${E(e)}`);this.literal=e}getParser(){return ch(this,this.literal)}toCodecJson(){return typeof this.literal==`bigint`?nm(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:nm(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function nm(e){let t=globalThis.String(e.literal);return Q(e,[new Z(new tm(t),new Ip(jp(()=>e.literal),jp(()=>t)))])}const rm=new class extends $p{_tag=`String`;getParser(){return lh(this,le)}getExpected(){return`string`}};var im=class extends $p{_tag=`Number`;getParser(){return lh(this,ue)}toCodecJson(){return this.checks&&(am(this.checks,`isFinite`)||am(this.checks,`isInt`))?this:Q(this,[Mm])}toCodecStringTree(){return this.checks&&(am(this.checks,`isFinite`)||am(this.checks,`isInt`))?Q(this,[gh]):Q(this,[_h])}getExpected(){return`number`}};function am(e,t){return e.some(e=>{switch(e._tag){case`Filter`:return e.annotations?.meta?._tag===t;case`FilterGroup`:return am(e.checks,t)}})}const om=new im,sm=new class extends $p{_tag=`Boolean`;getParser(){return lh(this,de)}getExpected(){return`boolean`}};var cm=class e extends $p{_tag=`Arrays`;isMutable;elements;rest;constructor(e,t,n,r,i,a,o){super(r,i,a,o),this.isMutable=e,this.elements=t,this.rest=n;let s=t.findIndex(Qm);if(s!==-1&&(t.slice(s+1).some(e=>!Qm(e))||n.length>1))throw Error(`A required element cannot follow an optional element. ts(1257)`);if(n.length>1&&n.slice(1).some(Qm))throw Error(`An optional element cannot follow a rest element. ts(1266)`)}getParser(e){let t=this,n=t.elements.map(t=>({ast:t,parser:e(t)})),r=t.rest.map(t=>({ast:t,parser:e(t)})),i=n.length,[a,...o]=r,s=o.length;function c(e,t){return t<i?n[t]:t>=e?o[t-e]:a}return ba(function*(e,n){if(e._tag===`None`)return e;let r=e.value;if(!Array.isArray(r))return yield*L(new lp(t,e));let a=r.length,o={ast:t,getParser:c,oinput:e,len:a,tailThreshold:um(a,i,s),output:new globalThis.Array(a),issues:void 0,options:n},l=dm(n?.concurrency),u=lm(o,r,{concurrency:l?.concurrency,end:t.rest.length===0?i:Math.max(a,i+s)});if(u&&(yield*u),t.rest.length===0&&a>i)for(let s=i;s<=a-1;s++){let i=new op([s],new cp(t,r[s]));if(n.errors===`all`)o.issues?o.issues.push(i):o.issues=[i];else return yield*L(new X(t,e,[i]))}return o.issues?yield*L(new X(t,e,o.issues)):j(o.output)})}recur(t){let n=qm(this.elements,t),r=qm(this.rest,t);return n===this.elements&&r===this.rest?this:new e(this.isMutable,n,r,this.annotations,this.checks,void 0,this.context)}getExpected(){return`array`}};const lm=ji()({onItem(e,t,n){let r=n<e.len?j(t):gn();return e.getParser(e.tailThreshold,n).parser(r,e.options)},step(e,t,n,r){if(n._tag===`Failure`)return fm(e,e.ast,r,n);if(n.value._tag===`Some`)e.output[r]=n.value.value;else{let t=e.getParser(e.tailThreshold,r);if(Qm(t.ast))return;let n=new op([r],new sp(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return Ki(new X(e.ast,e.oinput,[n]))}}});function um(e,t,n){return Math.max(t,e-n)}const dm=e=>(e=e===`unbounded`?1/0:e??1,e>1?{concurrency:e}:void 0),fm=(e,t,n,r)=>{let i=Yi(r.cause);if(Hn(i))return r;let a=new op([n],i.success);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return Ki(new X(t,e.oinput,[a]))},pm=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`,mm=new globalThis.RegExp(`(?:${pm}|Infinity|-Infinity|NaN)`);function hm(e,t){let n=eh(t);switch(n._tag){case`String`:return Object.keys(e);case`TemplateLiteral`:{let t=ah(n);return Object.keys(e).filter(e=>t.test(e))}case`Symbol`:return Object.getOwnPropertySymbols(e);case`Number`:return Object.keys(e).filter(e=>mm.test(e));case`Union`:return[...new Set(n.types.flatMap(t=>hm(e,t)))];default:return[]}}var gm=class{name;type;constructor(e,t){this.name=e,this.type=t}},_m=class{parameter;type;merge;constructor(e,t,n){if(this.parameter=e,this.type=t,this.merge=n,Qm(t)&&!rh(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},vm=class e extends $p{_tag=`Objects`;propertySignatures;indexSignatures;constructor(e,t,n,r,i,a){super(n,r,i,a),this.propertySignatures=e,this.indexSignatures=t;let o=e.map(e=>e.name).filter((e,t,n)=>n.indexOf(e)!==t);if(o.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(o)}. ts(2300)`)}getParser(e){let t=this,n=[],r=new Set,i=[];for(let a of t.propertySignatures)n.push(a.name),r.add(a.name),i.push({ps:a,parser:e(a.type),name:a.name,type:a.type});let a=t.indexSignatures.length;if(t.propertySignatures.length===0&&t.indexSignatures.length===0)return lh(t,pe);let o=a>0?ji()({onItem:ba(function*(n,[r,i]){let a=e(dh(i.parameter))(j(r),n.options),o=N(a)?a:yield*ua(a);if(o._tag===`Failure`){let e=fm(n,t,r,o);e&&(yield*e);return}let s=j(n.input[r]),c=e(i.type)(s,n.options),l=N(c)?c:yield*ua(c);if(l._tag===`Failure`){let e=fm(n,t,r,l);e&&(yield*e);return}if(o.value._tag===`Some`&&l.value._tag===`Some`){let e=o.value.value,t=l.value.value;if(i.merge&&i.merge.decode&&Object.hasOwn(n.out,e)){let[r,a]=i.merge.decode.combine([e,n.out[e]],[e,t]);$f(n.out,r,a)}else $f(n.out,e,t)}}),step:(e,t,n)=>n._tag===`Failure`?n:void 0}):void 0;return ba(function*(e,s){if(e._tag===`None`)return e;let c=e.value;if(!(typeof c==`object`&&c&&!Array.isArray(c)))return yield*L(new lp(t,e));let l={},u={ast:t,oinput:e,input:c,out:l,issues:void 0,options:s},d=s.errors===`all`,f=s.onExcessProperty===`error`,p=s.onExcessProperty===`preserve`,m;if(t.indexSignatures.length===0&&(f||p)){m=Reflect.ownKeys(c);for(let n=0;n<m.length;n++){let i=m[n];if(!r.has(i)){if(f){let n=new op([i],new cp(t,c[i]));if(d){u.issues?u.issues.push(n):u.issues=[n];continue}return yield*L(new X(t,e,[n]))}$f(l,i,c[i])}}}let h=dm(s?.concurrency),g=ym(u,i,h);if(g&&(yield*g),o){let e=er();for(let n=0;n<a;n++){let r=t.indexSignatures[n],i=hm(c,r.parameter);for(let t=0;t<i.length;t++){let n=i[t];e.push([n,r])}}let n=o(u,e,h);n&&(yield*n)}if(u.issues)return yield*L(new X(t,e,u.issues));if(s.propertyOrder===`original`){let e=(m??Reflect.ownKeys(c)).concat(n),t={};for(let n of e)Object.hasOwn(l,n)&&$f(t,n,l[n]);return j(t)}return j(l)})}rebuild(t,n){let r=qm(this.propertySignatures,e=>{let n=t(e.type);return n===e.type?e:new gm(e.name,n)}),i=qm(this.indexSignatures,e=>{let r=t(e.parameter),i=t(e.type),a=n?e.merge?.flip():e.merge;return r===e.parameter&&i===e.type&&a===e.merge?e:new _m(r,i,a)});return r===this.propertySignatures&&i===this.indexSignatures?this:new e(r,i,this.annotations,this.checks,void 0,this.context)}flip(e){return this.rebuild(e,!0)}recur(e){return this.rebuild(e,!1)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?`object | array`:`object`}};const ym=ji()({onItem(e,t){let n=Object.hasOwn(e.input,t.name)?j(e.input[t.name]):gn();return t.parser(n,e.options)},step(e,t,n){if(n._tag===`Failure`)return fm(e,e.ast,t.name,n);if(n.value._tag===`Some`)$f(e.out,t.name,n.value.value);else if(!Qm(t.type)){let n=new op([t.name],new sp(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}return Ki(new X(e.ast,e.oinput,[n]))}}});function bm(e,t,n){return new vm(Reflect.ownKeys(e).map(t=>new gm(t,e[t].ast)),[],n,t)}function xm(e){return e.ast}function Sm(e,t,n){return new km(e.map(xm),t,void 0,n)}function Cm(e){switch(e._tag){case`Null`:return[`null`];case`Undefined`:case`Void`: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`]:[`object`,`array`];case`Enum`:return Array.from(new Set(e.enums.map(([,e])=>typeof e)));case`Literal`:return[typeof e.literal];case`Union`:return Array.from(new Set(e.types.flatMap(Cm)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function wm(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[`~sentinels`];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!Qm(t)){if(Gp(t))return[{key:e.name,literal:t.literal}];if(Kp(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>Gp(e)&&!Qm(e)?[{key:t,literal:e.literal}]:[]);case`Suspend`:return wm(e.thunk())}}const Tm=new WeakMap;function Em(e){let t=Tm.get(e);if(t)return t;t={};for(let n of e){let e=eh(n);if(Wp(e))continue;let r=Cm(e),i=wm(e);t.byType??={};for(let e of r)(t.byType[e]??=[]).push(n);if(i.length>0){t.bySentinel??=new Map;for(let{key:e,literal:r}of i){let i=t.bySentinel.get(e);i||t.bySentinel.set(e,i=new Map);let a=i.get(r);a||i.set(r,a=[]),a.push(n)}}else{t.otherwise??={};for(let e of r)(t.otherwise[e]??=[]).push(n)}}return Tm.set(e,t),t}function Dm(e){return t=>{let n=eh(t);return n._tag===`Literal`?n.literal===e:n._tag!==`UniqueSymbol`||n.symbol===e}}function Om(e,t){let n=Em(t),r=e===null?`null`:Array.isArray(e)?`array`:typeof e;if(n.bySentinel){let t=n.otherwise?.[r]??[];if(r===`object`||r===`array`){for(let[r,i]of n.bySentinel)if(Object.hasOwn(e,r)){let n=i.get(e[r]);if(n)return[...n,...t].filter(Dm(e))}}return t}return(n.byType?.[r]??[]).filter(Dm(e))}var km=class e extends $p{_tag=`Union`;types;mode;constructor(e,t,n,r,i,a){super(n,r,i,a),this.types=e,this.mode=t}getParser(e){let t=this;return(n,r)=>{if(n._tag===`None`)return F(n);let i=n.value,a=Om(i,t.types),o={ast:t,recur:e,oinput:n,input:i,out:void 0,successes:[],issues:void 0,options:r},s=dm(r?.concurrency),c=Am(o,a,s);return c?ca(c,e=>o.out?F(o.out):L(new dp(t,i,o.issues??[]))):o.out?F(o.out):L(new dp(t,i,o.issues??[]))}}recur(t){let n=qm(this.types,t);return n===this.types?this:new e(n,this.mode,this.annotations,this.checks,void 0,this.context)}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(t=>{let n=eh(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(Gp);if(t.length>0)return`${Nm(n.isMutable)}[ ${t.map(t=>e(t)+Pm(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>Gp(e.type));if(t.length>0)return`{ ${t.map(t=>`${Nm(t.type.context?.isMutable)}${$e(t.name)}${Pm(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}};const Am=ji()({onItem(e,t){return e.recur(t)(e.oinput,e.options)},step(e,t,n){if(n._tag===`Failure`){let t=Yi(n.cause);if(Hn(t))return n;e.issues?e.issues.push(t.success):e.issues=[t.success]}else{if(e.out&&e.ast.mode===`oneOf`)return e.successes.push(t),Ki(new fp(e.ast,e.input,e.successes));if(e.out=n.value,e.successes.push(t),e.ast.mode===`anyOf`)return qi}}}),jm=new km([new tm(`Infinity`),new tm(`-Infinity`),new tm(`NaN`)],`anyOf`),Mm=new Z(new km([om,jm],`anyOf`),new Ip(Pp(),jp(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function Nm(e){return e?``:`readonly `}function Pm(e){return e?`?`:``}var Fm=class e extends te{_tag=`Filter`;run;annotations;aborted;constructor(e,t=void 0,n=!1){super(),this.run=e,this.annotations=t,this.aborted=n}annotate(t){return new e(this.run,{...this.annotations,...t},this.aborted)}abort(){return new e(this.run,this.annotations,!0)}and(e,t){return new Im([this,e],t)}},Im=class e extends te{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(t){return new e(this.checks,{...this.annotations,...t})}and(t,n){return new e([this,t],n)}};function Lm(e,t,n=!1){return new Fm((t,n,r)=>hp(t,n,e(t,n,r)),t,n)}function Rm(e,t){let n=e.source;return Lm(t=>e.test(t),{expected:`a string matching the RegExp ${n}`,meta:{_tag:`isPattern`,regExp:e},toArbitraryConstraint:{string:{patterns:[e.source]}},...t})}function zm(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}function Q(e,t){return e.encoding===t?e:zm(e,e=>{e.encoding.value=t})}function Bm(e,t){return e.context===t?e:zm(e,e=>{e.context.value=t})}function Vm(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return Hm(e,Gn(e.checks.slice(0,-1),n.annotate(t)))}return zm(e,e=>{e.annotations.value={...e.annotations.value,...t}})}function Hm(e,t){return e.checks===t?e:zm(e,e=>{e.checks.value=t})}function Um(e,t){return Hm(e,e.checks?[...e.checks,...t]:t)}function Wm(e,t){let n=e,r=n[n.length-1],i=t(r.to);return i===r.to?e:Gn(e.slice(0,e.length-1),new Z(i,r.transformation))}function Gm(e){return t=>t.encoding?Q(t,Wm(t.encoding,e)):t}function Km(e,t,n){let r=new Z(e,t);return Q(n,n.encoding?[...n.encoding,r]:[r])}function qm(e,t){let n=!1,r=Array(e.length);for(let i=0;i<e.length;i++){let a=e[i],o=t(a);o!==a&&(n=!0),r[i]=o}return n?r:e}function Jm(e,t){return Bm(e,e.context?new Zp(e.context.isOptional,e.context.isMutable,e.context.defaultValue,{...e.context.annotations,...t}):new Zp(!1,!1,void 0,t))}const Ym=Gm(Xm);function Xm(e){let t=e.context?e.context.isOptional===!1?new Zp(!0,e.context.isMutable,e.context.defaultValue,e.context.annotations):e.context:new Zp(!0,!1);return Ym(Bm(e,t))}function Zm(e,t,n){return Km(e,n,t)}function Qm(e){return e.context?.isOptional??!1}const $m=oe(e=>{if(e.encoding)return $m(Q(e,void 0));let t=e;return t.recur?.($m)??t}),eh=oe(e=>$m(nh(e)));function th(e,t){let n=t,r=n.length,i=n[r-1],a=[new Z(nh(Q(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new Z(nh(n[e-1].to),n[e].transformation.flip()));let o=nh(i.to);return o.encoding?Q(o,[...o.encoding,...a]):Q(o,a)}const nh=oe(e=>{if(e.encoding)return th(e,e.encoding);let t=e;return t.flip?.(nh)??t.recur?.(nh)??t});function rh(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(rh);default:return!1}}function ih(e,t){return e.encodedParts.map(e=>sh(e,oh(e),t)).join(``)}const ah=oe(e=>new globalThis.RegExp(`^${ih(e,!0)}$`));function oh(e){switch(e._tag){case`Literal`:return ep(globalThis.String(e.literal));case`String`:return fh;case`Number`:return pm;case`BigInt`:return vh;case`TemplateLiteral`:return ih(e,!1);case`Union`:return e.types.map(oh).join(`|`)}}function sh(e,t,n){if(Yp(e)){if(!n)return`(?:${t})`}else if(!n)return t;return`(${t})`}function ch(e,t){let n=oa(t);return r=>r._tag===`None`?aa:r.value===t?n:L(new lp(e,r))}function lh(e,t){return n=>n._tag===`None`?aa:t(n.value)?F(n):L(new lp(e,n))}function uh(e){function t(n){return n.encoding?Q(n,Wm(n.encoding,t)):e(n)}return oe(t)}const dh=uh(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(dh)}}),fh=`[\\s\\S]*?`,ph=new globalThis.RegExp(`^${pm}$`);function mh(e){return Rm(ph,{expected:`a string representing a finite number`,meta:{_tag:`isStringFinite`,regExp:ph},...e})}const hh=Um(rm,[mh()]),gh=new Z(hh,Vp),_h=new Z(new km([hh,jm],`anyOf`),Vp),vh=`-?\\d+`;function yh(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`)yh(o.checks,t,n,r,i);else{let e=o.run(t,r,i);if(e&&(n.push(new ip(t,o,e)),o.aborted||i?.errors!==`all`))return}}}const bh=`~effect/Schema/Class`,xh=e=>e,Sh=oe(e=>{switch(e._tag){case`Declaration`:{let t=e.annotations?.[bh];if(fe(t)){let n=t(e.typeParameters),r=Sh(n.to);return Q(e,r===n.to?[n]:[new Z(r,n.transformation)])}return e}case`Objects`:case`Arrays`:return e.recur(e=>{let t=e.context?.defaultValue;return t?Q(Sh(e),t):Sh(e)});case`Suspend`:return e.recur(Sh);default:return e}});function Ch(e){let t=Eh(Sh($m(e.ast)));return(e,n)=>t(e,n?.disableChecks?n?.parseOptions?{...n.parseOptions,disableChecks:!0}:{disableChecks:!0}:n?.parseOptions)}function wh(e){let t=Ch(e);return(e,n)=>Ji(ha(t(e,n)))}function Th(e){let t=Ch(e);return(e,n)=>ma(_a(t(e,n),e=>Error(e.toString(),{cause:e})))}function Eh(e){let t=Dh(e);return(e,n)=>va(t(j(e),n??Xp),e=>e._tag===`None`?L(new up(e)):F(e.value))}const Dh=oe(e=>{let t,n=Yf(e)?.parseOptions;if(!e.context&&!e.encoding&&!e.checks)return(r,i)=>(t??=e.getParser(Dh),n&&(i={...i,...n}),t(r,i));let r=qp(e)||Jp(e)||Up(e)&&e.typeParameters.length>0;return(i,a)=>{n&&(a={...a,...n});let o=e.encoding,s;if(o){let t=o,n=t.length;for(let e=n-1;e>=0;e--){let n=t[e],r=n.to,o=Dh(r);if(s=s?va(s,e=>o(e,a)):o(i,a),n.transformation._tag===`Transformation`){let e=n.transformation.decode;s=va(s,t=>e.run(t,a))}else s=n.transformation.decode(s,a)}s=_a(s,t=>new ap(e,i,t))}t??=e.getParser(Dh);let c=s?va(s,e=>t(e,a)):t(i,a);if(e.checks&&!a?.disableChecks){let t=e.checks;a?.errors===`all`&&r&&vn(i)&&(c=ya(c,n=>{let r=[];yh(t.filter(e=>e.annotations?.[`~structural`]),i.value,r,e,a);let o=qn(r)?n._tag===`Composite`&&n.ast===e?new X(e,n.actual,[...n.issues,...r]):new X(e,i,[n,...r]):n;return L(o)})),c=va(c,n=>{if(vn(n)){let r=n.value,i=[];if(yh(t,r,i,e,a),qn(i))return L(new X(e,n,i))}return F(n)})}return c}}),Oh=`~effect/Schema/Schema`,kh={[Oh]:Oh,pipe(){return _(this,arguments)},annotate(e){return this.rebuild(Vm(this.ast,e))},annotateKey(e){return this.rebuild(Jm(this.ast,e))},check(...e){return this.rebuild(Um(this.ast,e))}};function Ah(e,t){let n=Object.create(kh);return t&&Object.assign(n,t),n.ast=e,n.rebuild=e=>Ah(e,t),n.makeEffect=ae(Ch(n),_a(e=>new Mh(e))),n.make=Th(n),n.makeOption=wh(n),n}const jh=`~effect/Schema/SchemaError`;var Mh=class{[jh]=jh;_tag=`SchemaError`;name=`SchemaError`;issue;constructor(e){this.issue=e}get message(){return this.issue.toString()}toString(){return`SchemaError(${this.message})`}};const Nh=Oh,Ph=Ah;function Fh(e){return y(e,Nh)&&e[Nh]===Nh}function Ih(e){let t=Ph(new tm(e),{literal:e,transform(n){return t.pipe(Kh(Ih(n),{decode:jp(()=>n),encode:jp(()=>e)}))}});return t}const Lh=Ph(rm),Rh=Ph(om),zh=Ph(sm);function Bh(e,t){return Ph(e,{fields:t,mapFields(e,t){let n=e(this.fields);return Bh(bm(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Vh(e){return Bh(bm(e,void 0),e)}const Hh=xh(e=>Ph(new cm(!1,[],[e.ast]),{schema:e}));function Uh(e,t){return Ph(e,{members:t,mapMembers(e,t){let n=e(this.members);return Uh(Sm(n,this.ast.mode,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Wh(e,t){return Uh(Sm(e,t?.mode??`anyOf`,void 0),e)}function Gh(e){let t=e.map(Ih);return Ph(Sm(t,`anyOf`,void 0),{literals:e,members:t,mapMembers(e){return Wh(e(this.members))},pick(e){return Gh(e)},transform(e){return Wh(t.map((t,n)=>t.transform(e[n])))}})}function Kh(e,t){return n=>Ph(Zm(n.ast,e.ast,t?Rp(t):Bp()),{from:n,to:e})}globalThis.Error,globalThis.Error,globalThis.RegExp,globalThis.URL,globalThis.File,globalThis.FormData,globalThis.URLSearchParams,globalThis.Uint8Array;const qh=globalThis.Symbol.for(`immer-draftable`);function Jh(e,t,n,r,i){let a=Zh(n,t,r),o=Xh(t),s=class extends e{constructor(...[e,t]){e??={};let r=n.make(e,t);super({...e,...r},{...t,disableChecks:!0})}static[Nh]=Nh;get[o](){return o}static[qh]=!0;static identifier=t;static fields=n.fields;static get ast(){return a(this).ast}static pipe(){return _(this,arguments)}static rebuild(e){return a(this).rebuild(e)}static make(e,t){return new this(e,t)}static makeOption(e,t){return wh(a(this))(e??{},t)}static makeEffect(e,t){return a(this).makeEffect(e??{},t)}static annotate(e){return this.rebuild(Vm(this.ast,e))}static annotateKey(e){return this.rebuild(Jm(this.ast,e))}static check(...e){return this.rebuild(Um(this.ast,e))}static extend(e){return(t,r)=>{let a={...n.fields,...t};return Jh(this,e,Bh(bm(a,n.ast.checks,{identifier:e}),a),r,i)}}static mapFields(e,t){return n.mapFields(e,t)}};return i!==void 0&&Object.assign(s.prototype,i(t)),s}function Yh(e){return new Ip(jp(t=>new e(t)),Ap())}function Xh(e){return`~effect/Schema/Class/${e}`}function Zh(e,t,n){let r;return i=>{if(r===void 0){let a=Yh(i),o=Ph(new em([e.ast],()=>(e,n)=>e instanceof i||y(e,Xh(t))?F(e):L(new lp(n,j(e))),{identifier:t,[bh]:([e])=>new Z(e,a),toCodec:([e])=>new Z(e.ast,a),toArbitrary:([e])=>()=>e.map(e=>new i(e)),toFormatter:([e])=>t=>`${i.identifier}(${e(t)})`,"~sentinels":wm(e.ast),...n}));r=e.pipe(Kh(o,a))}return r}}function Qh(e){return Fh(e)}const $h=e=>(t,n)=>{let r=Qh(t)?t:Vh(t);return Jh(Xi,e,r,n,e=>({toString(){return`${e}(${E({...this})})`}}))},eg=Gh([`error`,`warning`,`info`]);var $=class extends $h(`OgDiagnostic`)({message:Lh,points:Rh,severity:eg,suggestion:Lh,tag:Lh}){};const tg=(e,t,n,r,i,a)=>({category:n,check:n=>F(n[e]?null:new $({message:i,points:t,severity:r,suggestion:a,tag:String(e)})),tag:String(e),weight:t}),ng=[{category:`og`,check:e=>{let t=e[`og:title`];if(!t)return F(new $({message:`Missing og:title tag`,points:10,severity:`error`,suggestion:`<meta property="og:title" content="Your Page Title" />`,tag:`og:title`}));let n=t.length;return F(n<30||n>60?new $({message:`og:title length (${n}) is not optimal (30-60 characters)`,points:4,severity:`warning`,suggestion:`Make your og:title between 30 and 60 characters. Current is: "${t}"`,tag:`og:title`}):null)},tag:`og:title`,weight:10},{category:`og`,check:e=>{let t=e[`og:description`];if(!t)return F(new $({message:`Missing og:description tag`,points:10,severity:`error`,suggestion:`<meta property="og:description" content="Your page description here." />`,tag:`og:description`}));let n=t.length;return F(n<55||n>200?new $({message:`og:description length (${n}) is not optimal (55-200 characters)`,points:4,severity:`warning`,suggestion:`Make your og:description between 55 and 200 characters. Current length: ${n}`,tag:`og:description`}):null)},tag:`og:description`,weight:10},tg(`og:image`,10,`og`,`error`,`Missing og:image tag`,`<meta property="og:image" content="https://example.com/og-image.png" />`),{category:`og`,check:e=>{let t=e[`og:url`];if(!t)return F(new $({message:`Missing og:url tag`,points:4,severity:`warning`,suggestion:`<meta property="og:url" content="https://example.com/page-path" />`,tag:`og:url`}));try{return new URL(t),F(null)}catch{return F(new $({message:`og:url is not a valid absolute URL`,points:2,severity:`warning`,suggestion:`Ensure og:url is an absolute URL (e.g., https://example.com/path). Current: "${t}"`,tag:`og:url`}))}},tag:`og:url`,weight:4},tg(`og:type`,2,`og`,`info`,`Missing og:type tag`,`<meta property="og:type" content="website" />`),tg(`og:locale`,2,`og`,`info`,`Missing og:locale tag`,`<meta property="og:locale" content="en_US" />`),tg(`og:site_name`,2,`og`,`info`,`Missing og:site_name tag`,`<meta property="og:site_name" content="Your Site Name" />`),{category:`twitter`,check:e=>{let t=e[`twitter:card`];return t?[`summary`,`summary_large_image`,`app`,`player`].includes(t)?F(null):F(new $({message:`Invalid twitter:card value: "${t}"`,points:3,severity:`warning`,suggestion:`Use one of: "summary", "summary_large_image", "app", "player"`,tag:`twitter:card`})):F(new $({message:`Missing twitter:card tag`,points:5,severity:`warning`,suggestion:`<meta name="twitter:card" content="summary_large_image" />`,tag:`twitter:card`}))},tag:`twitter:card`,weight:5},{category:`twitter`,check:e=>{let t=e[`twitter:title`];if(!t)return F(new $({message:`Missing twitter:title tag`,points:5,severity:`warning`,suggestion:`<meta name="twitter:title" content="Your Page Title" />`,tag:`twitter:title`}));let n=t.length;return F(n<30||n>60?new $({message:`twitter:title length (${n}) is not optimal (30-60 characters)`,points:2,severity:`info`,suggestion:`Keep twitter:title between 30 and 60 characters for optimal display. Current: "${t}"`,tag:`twitter:title`}):null)},tag:`twitter:title`,weight:5},{category:`twitter`,check:e=>{let t=e[`twitter:description`];if(!t)return F(new $({message:`Missing twitter:description tag`,points:5,severity:`warning`,suggestion:`<meta name="twitter:description" content="Your page description." />`,tag:`twitter:description`}));let n=t.length;return F(n<55||n>200?new $({message:`twitter:description length (${n}) is not optimal (55-200 characters)`,points:2,severity:`info`,suggestion:`Keep twitter:description between 55 and 200 characters. Current length: ${n}`,tag:`twitter:description`}):null)},tag:`twitter:description`,weight:5},tg(`twitter:image`,3,`twitter`,`warning`,`Missing twitter:image tag`,`<meta name="twitter:image" content="https://example.com/og-image.png" />`),tg(`twitter:site`,2,`twitter`,`info`,`Missing twitter:site tag`,`<meta name="twitter:site" content="@yourusername" />`),{category:`seo`,check:e=>{let t=e.title;if(!t)return F(new $({message:`Missing <title> tag`,points:6,severity:`error`,suggestion:`<title>Your page title for search results</title>`,tag:`title`}));let n=t.length;return F(n<30||n>60?new $({message:`<title> tag length (${n}) is not optimal (30-60 characters)`,points:2,severity:`warning`,suggestion:`Adjust your title tag length to be between 30 and 60 characters. Current: "${t}"`,tag:`title`}):null)},tag:`title`,weight:6},{category:`seo`,check:e=>{let t=e.description;if(!t)return F(new $({message:`Missing meta description`,points:6,severity:`error`,suggestion:`<meta name="description" content="A brief summary of the page content." />`,tag:`description`}));let n=t.length;return F(n<50||n>160?new $({message:`Meta description length (${n}) is not optimal (50-160 characters)`,points:2,severity:`warning`,suggestion:`Keep meta description between 50 and 160 characters for search snippets. Current length: ${n}`,tag:`description`}):null)},tag:`description`,weight:6},{category:`seo`,check:(e,t)=>{let n=e.canonical;if(!n)return F(new $({message:`Missing link[rel=canonical] tag`,points:5,severity:`warning`,suggestion:`<link rel="canonical" href="https://example.com/page-canonical" />`,tag:`canonical`}));try{new URL(n)}catch{return F(new $({message:`Canonical URL is not a valid absolute URL`,points:3,severity:`warning`,suggestion:`Ensure the canonical URL is absolute. Current: "${n}"`,tag:`canonical`}))}if(t?.pageUrl&&n!==t.pageUrl)try{let e=new URL(n),r=new URL(t.pageUrl);if(e.origin!==r.origin||e.pathname.replace(/\/$/u,``)!==r.pathname.replace(/\/$/u,``))return F(new $({message:`Canonical URL (${n}) does not match current page URL (${t.pageUrl})`,points:2,severity:`warning`,suggestion:`The canonical tag should point to the primary URL of this page.`,tag:`canonical`}))}catch{}return F(null)},tag:`canonical`,weight:5},{category:`seo`,check:e=>{let t=e.robots;return t&&t.toLowerCase().includes(`noindex`)?F(new $({message:`Page has noindex directives in robots meta tag`,points:3,severity:`warning`,suggestion:`If you want this page indexed by search engines, remove "noindex" from: "${t}"`,tag:`robots`})):F(null)},tag:`robots`,weight:3},tg(`viewport`,2,`seo`,`warning`,`Missing viewport meta tag`,`<meta name="viewport" content="width=device-width, initial-scale=1.0" />`),tg(`charset`,1,`seo`,`warning`,`Missing charset declaration`,`<meta charset="utf-8" />`),tg(`lang`,2,`seo`,`warning`,`Missing lang attribute on <html> tag`,`<html lang="en">`),{category:`image`,check:(e,t)=>{if(!e[`og:image`])return F(new $({message:`Image cannot be validated because og:image tag is missing`,points:5,severity:`error`,suggestion:`Add a valid og:image tag to pass image validations.`,tag:`og:image:reachable`}));let n=t?.imageMeta;return!n||n.size===void 0&&!n.width?F(new $({message:`og:image URL is unreachable or failed to fetch: "${e[`og:image`]}"`,points:5,severity:`error`,suggestion:`Verify the og:image URL is correct and publically accessible.`,tag:`og:image:reachable`})):F(null)},tag:`og:image:reachable`,weight:5},{category:`image`,check:(e,t)=>{if(!e[`og:image`])return F(null);let n=t?.imageMeta;return!n||!n.width||!n.height?F(null):n.width<1200||n.height<630?F(new $({message:`og:image dimensions (${n.width}x${n.height}) are below the recommended 1200x630 pixels`,points:5,severity:`warning`,suggestion:`Use an image that is at least 1200x630 pixels for rich social sharing previews.`,tag:`og:image:dimensions`})):F(null)},tag:`og:image:dimensions`,weight:5},{category:`image`,check:(e,t)=>{if(!e[`og:image`])return F(null);let n=t?.imageMeta;if(!n)return F(null);let r=n.type?.toLowerCase()||``;return[`png`,`jpeg`,`jpg`,`webp`,`image/png`,`image/jpeg`,`image/jpg`,`image/webp`].some(e=>r.includes(e))?F(null):F(new $({message:`og:image format (${r||`unknown`}) is not optimal. Use PNG, JPEG, or WebP`,points:3,severity:`warning`,suggestion:`Convert your image to PNG, JPEG, or WebP. SVG and GIF are not fully supported by all social platforms.`,tag:`og:image:format`}))},tag:`og:image:format`,weight:3},{category:`image`,check:(e,t)=>{if(!e[`og:image`])return F(null);let n=t?.imageMeta;if(!n||!n.size)return F(null);let r=n.size/1048576;return F(r>8?new $({message:`og:image size (${r.toFixed(2)}MB) exceeds 8MB`,points:2,severity:`warning`,suggestion:`Compress your og:image. Some platforms (like Discord/Twitter) will not render previews for images larger than 8MB.`,tag:`og:image:size`}):null)},tag:`og:image:size`,weight:2}],rg=(e,t)=>I(function*(){let n=(yield*ra(ng.map(n=>n.check(e,t).pipe(da(e=>e?{category:n.category,diag:e}:null))))).filter(e=>e!==null),r=Af.map(e=>{let t=jf[e],r=n.filter(t=>t.category===e).map(e=>e.diag),i=r.reduce((e,t)=>e+t.points,0),a=Math.max(0,t.maxScore-i);return{diagnostics:r,id:e,maxScore:t.maxScore,name:t.name,score:a}}),i=r.reduce((e,t)=>e+t.score,0),a=n.map(e=>e.diag);return{categories:r,diagnostics:a,maxScore:100,passed:a.length===0,score:i,url:t?.pageUrl}}),ig=e=>{if(e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71&&e.length>=24){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=t.getUint32(16,!1);return{height:t.getUint32(20,!1),type:`png`,width:n}}if(e[0]===255&&e[1]===216){let t=2,n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(;t<e.length-8;){let r=n.getUint16(t,!1);if(t+=2,r===65497||r===65498)break;let i=n.getUint16(t,!1);if(r>=65472&&r<=65475&&t+7<e.length)return{height:n.getUint16(t+3,!1),type:`jpeg`,width:n.getUint16(t+5,!1)};t+=i}}if(e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=String.fromCodePoint(e[12],e[13],e[14],e[15]);if(n===`VP8 `&&e.length>=30){let e=t.getUint16(26,!0)&16383;return{height:t.getUint16(28,!0)&16383,type:`webp`,width:e}}if(n===`VP8L`&&e.length>=25){let[t,n,r,i]=e.subarray(21,25),a=1+(t|(n&63)<<8);return{height:1+((n&192)>>6|r<<2|(i&15)<<10),type:`webp`,width:a}}if(n===`VP8X`&&e.length>=30){let t=1+(e[24]|e[25]<<8|e[26]<<16);return{height:1+(e[27]|e[28]<<8|e[29]<<16),type:`webp`,width:t}}}return{}},ag=e=>I(function*(){let t=e.headers.get(`Content-Length`),n=e.headers.get(`Content-Range`),r;if(n){let e=n.match(/\/(?<g1>\d+)$/u);e&&(r=Math.trunc(Number(e[1])))}if(!r&&t){let e=Math.trunc(Number(t));r=Number.isFinite(e)&&e>=0?e:void 0}let i=e.headers.get(`Content-Type`)||void 0,a=yield*P({catch:e=>Error(`Failed to read image body: ${e instanceof Error?e.message:String(e)}`),try:()=>Ta(e,262144)});if(a===null)return yield*L(Error(`Failed to read image body: response is too large`));let o=ig(new Uint8Array(a));return{...o,size:r,type:o.type||i}}),og=(e,t)=>I(function*(){let n=Sa(t?.fetch??fetch),r=yield*P({catch:e=>Error(`Failed to fetch image: ${e instanceof Error?e.message:String(e)}`),try:()=>n(e,{headers:{Range:`bytes=0-131072`}})});if(!r.ok&&r.status!==206){let t=yield*P({catch:e=>Error(`Failed fallback fetch image: ${e instanceof Error?e.message:String(e)}`),try:()=>n(e)});return t.ok?yield*ag(t):yield*L(Error(`Failed to fetch image: Status ${t.status}`))}return yield*ag(r)}),sg=(e,t,n)=>I(function*(){let r=null,i=e[`og:image`];if(i){let e=yield*og(i,n).pipe(la);e._tag===`Success`&&(r=e.success)}return yield*rg(e,{imageMeta:r,pageUrl:t})}),cg=(e,t,n)=>pa(sg(e,t,n));$h(`ScoreResult`)({diagnostics:Hh($),maxScore:Rh,passed:zh,score:Rh});const lg=[`title`,`description`,`author`,`canonical`,`robots`,`keywords`,`themeColor`],ug=[`og:title`,`og:description`,`og:image`,`og:url`,`og:type`,`og:site_name`,`og:locale`],dg=[`twitter:card`,`twitter:title`,`twitter:description`,`twitter:image`,`twitter:site`,`twitter:creator`],fg=[...lg,...ug,...dg],pg=(e,t)=>{let n=new Set(t.map(e=>e.tag));return e.filter(e=>!n.has(e.tag))},mg=(e,t)=>e[t]||void 0,hg=(e,t)=>{let n=new Map(t.result.categories.map(e=>[e.id,e.score])),r=[];for(let n of fg){let i=mg(e.data,n),a=mg(t.data,n);i!==a&&r.push({a:i,b:a,key:n})}return{a:{score:e.result.score,url:e.url},b:{score:t.result.score,url:t.url},categories:e.result.categories.map(e=>{let t=n.get(e.id)??0;return{a:e.score,b:t,delta:t-e.score,id:e.id}}),fixed:pg(e.result.diagnostics,t.result.diagnostics),regressed:pg(t.result.diagnostics,e.result.diagnostics),scoreDelta:t.result.score-e.result.score,tags:r}},gg=e=>{let t=[],n=e.split(/\r?\n/u),r=!1;for(let e of n){if(e=e.trim(),e.startsWith(`#`)||e===``)continue;let n=e.split(`:`);if(n.length<2)continue;let i=n[0].trim().toLowerCase(),a=n.slice(1).join(`:`).trim();if(i===`user-agent`)r=a===`*`;else if(r&&i===`disallow`&&a!==``){if(a.length>512)continue;let e=a.startsWith(`/`)?a:`*${a}`;t.push(e)}}return{disallowedPatterns:t}},_g=(e,t)=>{let n=e.toLowerCase(),r=t.toLowerCase(),i=0,a=0,o=-1,s=0;for(;a<r.length;){let e=r[a];if(i<n.length&&(e===`?`||e===n[i]))i+=1,a+=1;else if(e===`*`)o=a,s=i,a+=1;else if(o===-1)return!1;else{if(s+=1,s>n.length)return!1;i=s,a=o+1}}return!0},vg=(e,t)=>t.disallowedPatterns.some(t=>_g(e,t)),yg=e=>{let{pathname:t}=e;if(t.includes(`/_next/`)||t.startsWith(`/_next`)||t.includes(`/node_modules/`))return!1;let n=`.png,.jpg,.jpeg,.gif,.svg,.ico,.webp,.avif,.css,.js,.mjs,.ts,.map,.pdf,.epub,.zip,.tar,.gz,.mp4,.webm,.ogg,.mp3,.wav,.woff,.woff2,.ttf,.eot,.xml,.json,.txt`.split(`,`),r=t.split(`/`).pop()||``;if(r.includes(`.`)){let e=r.slice(r.lastIndexOf(`.`)).toLowerCase();if(n.includes(e))return!1}return!0},bg=(e,t)=>e.hostname.replace(/^www\./iu,``)===t.hostname.replace(/^www\./iu,``)&&e.protocol===t.protocol,xg=(e,t)=>I(function*(){let n=yield*sa({catch:e=>Error(`Invalid start URL: ${e instanceof Error?e.message:String(e)}`),try:()=>new URL(e)}),{origin:r}=n,i=Sa(t.fetch??fetch),a=yield*no(e,{fetch:i}).pipe(la),o={disallowedPatterns:[]};a._tag===`Success`&&(o=gg(a.success.content));let s=new Set,c=new Map,l=new Map,u=[n.href];c.set(n.href,void 0);let{maxUrls:d}=t,f=t.concurrency||5,p=(e,t)=>{let i=[],a=/href=["'](?<g1>[^"']+)["']/giu,o;for(;(o=a.exec(e))!==null;){let[,e]=o;try{let a=new URL(e,t);if(bg(a,n)&&yg(a)){a.hash=``;let{href:e}=a;e.endsWith(`/`)&&e!==`${r}/`&&(e=e.slice(0,-1)),i.push(e)}}catch{}}return i},m=async e=>{let t=new URL(e);if(vg(t.pathname+t.search,o))return null;try{let t=await i(e,{headers:{"User-Agent":$a}});return t.ok?await wa(t,xa):null}catch{return null}},h=[],g=0,_=(e,t,n)=>{let r=[];if(n)try{l.set(t,Qa(n,t)),r=p(n,t)}catch{l.delete(t)}h[e]={links:r,url:t};for(let e=h[g];e;e=h[g]){g+=1;for(let t of e.links)!c.has(t)&&c.size<d*2&&(c.set(t,e.url),u.push(t))}};return yield*ia(async()=>{let e=new Set,t=async(t,n,r)=>{let i=await m(n);e.delete(r()),_(t,n,i)};for(;u.length>0||e.size>0;){for(;e.size<f&&u.length>0&&s.size<d;){let n=u.shift(),r=s.size;s.add(n);let i=t(r,n,()=>i);e.add(i)}if(e.size===0)return;await Promise.race(e)}}),[...s].slice(0,d).map(e=>({foundOn:c.get(e),og:l.get(e),url:e}))}).pipe(fa(e=>e instanceof Error?e:Error(String(e)))),Sg=(e,t)=>I(function*(){let n=yield*ho(e,{fetch:t.fetch}).pipe(la),r=[];if(n._tag===`Success`&&(r=(n.success.urls||[]).map(e=>e.loc)),r.length>0){let n=yield*sa({catch:e=>Error(`Invalid site URL: ${e instanceof Error?e.message:String(e)}`),try:()=>new URL(e)}),i=r.filter(e=>{try{let t=new URL(e);return bg(t,n)&&yg(t)}catch{return!1}});if(i.length>0)return i.slice(0,t.maxUrls).map(e=>({url:e}))}return yield*xg(e,{concurrency:t.concurrency,fetch:t.fetch,maxUrls:t.maxUrls})}).pipe(fa(e=>e instanceof Error?e:Error(String(e)))),Cg=e=>{try{return new URL(e).href}catch{return}},wg=e=>I(function*(){e.onProgress&&e.onProgress({completedUrls:0,totalUrls:0,type:`discovery`});let t=yield*Sg(e.siteUrl,{concurrency:e.concurrency,fetch:e.fetch,maxUrls:e.maxUrls});if(t.length===0)return{averageScore:0,categoryAverages:{image:0,og:0,seo:0,twitter:0},pages:[],scannedAt:new Date().toISOString(),siteUrl:e.siteUrl,summary:{excellent:0,fair:0,good:0,poor:0},totalPages:0};let n=0,r=t.length;e.onProgress&&e.onProgress({completedUrls:0,totalUrls:r,type:`checking`});let i=Cg(e.siteUrl),a,o=({foundOn:t,og:o,url:s})=>I(function*(){if(e.signal?.aborted)return yield*L(Error(`Scan aborted`));let c=o??{};if(!o){let t=yield*eo(s,{fetch:e.fetch}).pipe(la);t._tag===`Success`&&(c=t.success)}i!==void 0&&Cg(s)===i&&(a=c);let l={...yield*sg(c,s,{fetch:e.fetch}),foundOn:t};return n+=1,e.onProgress&&e.onProgress({completedUrls:n,result:l,totalUrls:r,type:`checking`,url:s}),l}),s=yield*ra(t.map(e=>o(e)),{concurrency:e.concurrency}),c=s.length,l=s.reduce((e,t)=>e+t.score,0),u=Math.round(l/c),d={image:0,og:0,seo:0,twitter:0};for(let e of s)for(let t of e.categories){let e=t.maxScore>0?t.score/t.maxScore*100:0;d[t.id]+=e}let f={image:Math.round(d.image/c),og:Math.round(d.og/c),seo:Math.round(d.seo/c),twitter:Math.round(d.twitter/c)},p={excellent:0,fair:0,good:0,poor:0};for(let e of s)e.score>=90?p.excellent+=1:e.score>=75?p.good+=1:e.score>=50?p.fair+=1:p.poor+=1;let m={averageScore:u,categoryAverages:f,entryOg:a,pages:s,scannedAt:new Date().toISOString(),siteUrl:e.siteUrl,summary:p,totalPages:c};return e.onProgress&&e.onProgress({completedUrls:n,totalUrls:r,type:`complete`}),m}).pipe(fa(e=>e instanceof Error?e:Error(String(e)))),Tg=e=>pa(wg(e)),Eg=e=>{let n=Math.trunc(Number(e));if(!Number.isFinite(n))throw new t(`Expected a whole number.`);return n},Dg=e=>{let n=Eg(e);if(n<1)throw new t(`Expected a whole number of 1 or more.`);return n},Og=e=>{let n=Eg(e);if(n<0||n>100)throw new t(`Expected a whole number between 0 and 100.`);return n},kg=(e,t,n)=>{let r=e,i=t.map(e=>{let t=r[e];return t?` ${c.dim(e)}: ${t}`:null}).filter(e=>e!==null);return i.length>0?`${i.join(`
|
|
72
|
+
`)}\n`:` ${n}\n`},Ag=e=>[`${c.bold(c.cyan(`General Tags:`))}\n${kg(e,lg,`No general tags detected.`)}`,`${c.bold(c.magenta(`Open Graph Tags (og:*):`))}\n${kg(e,ug,`No Open Graph tags detected.`)}`,`${c.bold(c.blue(`Twitter Card Tags (twitter:*):`))}\n${kg(e,dg,`No Twitter Card tags detected.`)}`,`${c.bold(c.yellow(`Favicons & Icons:`))}\n${e.favicons&&e.favicons.length>0?`${e.favicons.map(e=>` ${c.dim(e.rel)}: ${e.href}${e.sizes?` (${e.sizes})`:``}`).join(`
|
|
73
73
|
`)}\n`:` No icons detected.
|
|
74
74
|
`}`].join(`
|
|
75
|
-
`),
|
|
76
|
-
`)},
|
|
75
|
+
`),jg=e=>e===100?`Great`:e>=75?`Good`:e>=50?`Fair`:`Poor`,Mg=(e,t)=>t>=75?c.green(e):t>=50?c.yellow(e):c.red(e),Ng=(e,t=`OG Tester — Check Tags`)=>{let n=jg(e),r=[];r=e===100?[`╭/\\─────/\\╮`,`│ ( ^.^ ) │`,`│ ⚞ ⩊ ⚟ │`,`╰─────────╯`]:e>=75?[`╭/\\─────/\\╮`,`│ ( ◕.◕ ) │`,`│ ⚞ ◡ ⚟ │`,`╰─────────╯`]:e>=50?[`╭/\\─────/\\╮`,`│ ( •.• ) │`,`│ ⚞ ─ ⚟ │`,`╰─────────╯`]:[`╭/\\─────/\\╮`,`│ ( ✕.✕ ) │`,`│ ⚞ ︵ ⚟ │`,`╰─────────╯`];let i=r.map(t=>Mg(t,e)),a=Math.round(e/100*20),o=20-a,s=Mg(`█`.repeat(a),e)+c.dim(`░`.repeat(o)),l=[`${Mg(`${e}`,e)} ${c.dim(`/ 100`)} ${Mg(n,e)}`,s,c.dim(t),``];return i.map((e,t)=>{let n=l[t];return`${e}${n?` `:``}${n}`}).join(`
|
|
76
|
+
`)},Pg=(e,t=`OG Tester — Check Tags`,n=`Score`)=>{let r=Ng(e,t).split(`
|
|
77
77
|
`).map(e=>`${c.dim(`│`)} ${e}`).join(`
|
|
78
78
|
`);return[`${c.cyan(`◇`)} ${c.bold(n)}`,c.dim(`│`),r,c.dim(`│`),``].join(`
|
|
79
|
-
`)},
|
|
79
|
+
`)},Fg=new e(`check`).description(`Fetch and analyze Open Graph and meta tags for a URL`).argument(`<url>`,`The URL to check`).option(`--json`,`Output raw JSON instead of pretty formatting`).option(`--min-score <number>`,`Minimum score threshold (exit 1 if below)`,Og).action(async(e,t)=>{let l=e;/^https?:\/\//iu.test(e)||(l=`https://${e}`),t.json||r(c.bgCyan(c.black(` OG Tester — Check Tags `)));let u=s();t.json||u.start(`Fetching and parsing ${c.underline(l)}...`);try{let e=await to(l),r=await cg(e,l);if(t.json){let n={...e,diagnostics:r.diagnostics,maxScore:r.maxScore,passed:r.passed,score:r.score};console.log(JSON.stringify(n,null,2)),t.minScore!==void 0&&r.score<t.minScore&&process.exit(1);return}if(u.stop(`Successfully fetched and parsed tags!`),a(Ag(e),`Report`),process.stdout.isTTY&&!t.json){process.stdout.write(`\x1B[?25l`);try{for(let e=0;e<=15;e+=1){let t=Math.round(r.score*e/15);e>0&&process.stdout.write(`\x1B[7A\x1B[J`),process.stdout.write(Pg(t)),await n(30)}}finally{process.stdout.write(`\x1B[?25h`)}}else process.stdout.write(Pg(r.score));if(r.diagnostics.length>0){let e=r.diagnostics.map(e=>{let t=c.blue(`ℹ`);return e.severity===`error`?t=c.red(`✖`):e.severity===`warning`&&(t=c.yellow(`⚠`)),`${t} ${c.bold(e.tag)} — ${e.message} (-${e.points} points)\n ${c.dim(`→ Add:`)} ${c.green(e.suggestion)}`}).join(`
|
|
80
80
|
|
|
81
|
-
`);a(e,`Recommendations`)}t.minScore!==void 0&&r.score<t.minScore&&(o(c.red(`Score ${r.score} is below minimum ${t.minScore}`)),process.exit(1)),o(c.green(`Done!`))}catch(e){let n=e instanceof Error?e.message:String(e);t.json&&(console.error(JSON.stringify({error:n},null,2)),process.exit(1)),u.stop(c.red(`Failed to fetch or parse tags`)),i.error(c.red(n)),o(c.red(`Exited with errors.`)),process.exit(1)}}),
|
|
82
|
-
`);
|
|
81
|
+
`);a(e,`Recommendations`)}t.minScore!==void 0&&r.score<t.minScore&&(o(c.red(`Score ${r.score} is below minimum ${t.minScore}`)),process.exit(1)),o(c.green(`Done!`))}catch(e){let n=e instanceof Error?e.message:String(e);t.json&&(console.error(JSON.stringify({error:n},null,2)),process.exit(1)),u.stop(c.red(`Failed to fetch or parse tags`)),i.error(c.red(n)),o(c.red(`Exited with errors.`)),process.exit(1)}}),Ig=e=>/^https?:\/\//iu.test(e)?e:`https://${e}`,Lg=async(e,t)=>{try{let e=await to(t);return{data:e,result:await cg(e,t),url:t}}catch(n){let r=n instanceof Error?n.message:String(n);throw Error(`${e} (${t}): ${r}`,{cause:n})}},Rg=e=>e===0?`0`:e>0?`+${e}`:`−${Math.abs(e)}`,zg=(e,t)=>e>0?c.green(t):e<0?c.red(t):c.dim(t),Bg=(e,t)=>`${t(c.bold(e.tag))} — ${e.message} (${e.points} points)`,Vg=e=>{let t=`A ${e.a.score} → B ${e.b.score} (${Rg(e.scoreDelta)})`,n=[c.bold(zg(e.scoreDelta,t)),` ${c.dim(`A:`)} ${e.a.url}`,` ${c.dim(`B:`)} ${e.b.url}`],r=e.categories.filter(e=>e.delta!==0);if(e.tags.length===0&&r.length===0&&e.fixed.length===0&&e.regressed.length===0)return n.push(``,c.green(`No differences.`)),n.join(`
|
|
82
|
+
`);if(e.tags.length>0){n.push(``,c.bold(c.cyan(`Differing tags:`)));for(let t of e.tags)n.push(` ${c.dim(t.key)}`,` ${c.red(`A:`)} ${t.a??c.dim(`(missing)`)}`,` ${c.green(`B:`)} ${t.b??c.dim(`(missing)`)}`)}if(r.length>0){n.push(``,c.bold(c.magenta(`Categories:`)));for(let e of r)n.push(` ${e.id.padEnd(8)} ${e.a} → ${e.b} ${zg(e.delta,`(${Rg(e.delta)})`)}`)}if(e.regressed.length>0){n.push(``,c.bold(c.red(`Regressed (only in B):`)));for(let t of e.regressed)n.push(` ${c.red(`✖`)} ${Bg(t,c.red)}`)}if(e.fixed.length>0){n.push(``,c.bold(c.green(`Fixed (only in A):`)));for(let t of e.fixed)n.push(` ${c.green(`✔`)} ${Bg(t,c.green)}`)}return n.join(`
|
|
83
|
+
`)},Hg=new e(`diff`).description(`Compare the tags and scores of two URLs, such as staging against production`).argument(`<a>`,`The baseline URL`).argument(`<b>`,`The URL to compare against the baseline`).option(`--json`,`Output the diff as JSON instead of pretty formatting`).option(`--fail-on-regression`,`Exit 1 if B scores lower than A or has diagnostics A does not`).action(async(e,t,n)=>{let l=Ig(e),u=Ig(t);n.json||r(c.bgCyan(c.black(` OG Tester — Diff `)));let d=s();n.json||d.start(`Fetching ${c.underline(l)} and ${c.underline(u)}...`);try{let[e,t]=await Promise.all([Lg(`A`,l),Lg(`B`,u)]),r=hg(e,t);n.json?console.log(JSON.stringify(r,null,2)):(d.stop(`Fetched both pages.`),a(Vg(r),`Diff`));let i=r.regressed.length>0||r.scoreDelta<0;n.failOnRegression&&i&&(n.json||o(c.red(`B regressed compared to A.`)),process.exit(1)),n.json||o(c.green(`Done!`))}catch(e){let t=e instanceof Error?e.message:String(e);n.json&&(console.error(JSON.stringify({error:t},null,2)),process.exit(1)),d.stop(c.red(`Failed to fetch or parse tags`)),i.error(c.red(t)),o(c.red(`Exited with errors.`)),process.exit(1)}}),Ug=new e(`robots`).description(`Fetch a site's robots.txt`).argument(`<url>`,`The URL of the site`).option(`--json`,`Output raw JSON instead of pretty formatting`).action(async(e,t)=>{let n=e;/^https?:\/\//iu.test(e)||(n=`https://${e}`),t.json||r(c.bgCyan(c.black(` OG Tester — Robots.txt `)));let l=s();t.json||l.start(`Fetching robots.txt for ${c.underline(n)}...`);try{let e=await ro(n);if(t.json){console.log(JSON.stringify(e,null,2));return}l.stop(`Successfully fetched robots.txt!`),e.error&&(i.error(c.red(e.error)),o(c.red(`Exited with errors.`)),process.exit(1)),a(e.content??`Empty robots.txt`,`robots.txt content`),o(c.green(`Done!`))}catch(e){let n=e instanceof Error?e.message:String(e);t.json&&(console.error(JSON.stringify({error:n},null,2)),process.exit(1)),l.stop(c.red(`Failed to fetch robots.txt`)),i.error(c.red(n)),o(c.red(`Exited with errors.`)),process.exit(1)}}),Wg=e=>{if(!e)return`/`;let t=URL.parse(e);return t?t.pathname:e},Gg=e=>e>=90?c.green:e>=75?c.cyan:e>=50?c.yellow:c.red,Kg=async(e,t,n)=>{try{await d(e,JSON.stringify(t,null,2),`utf-8`),n||i.info(`Report saved to ${c.cyan(e)}`)}catch(t){n||i.error(`Failed to save report to ${e}: ${t instanceof Error?t.message:String(t)}`)}},qg=e=>{process.stdout.write(Pg(e.averageScore,`OG Tester — Site Scan`,`Site-wide Average Score`));let t=[`${c.bold(`Category Breakdown:`)}`,` ${c.dim(`•`)} Open Graph (OG) Tags: ${Gg(e.categoryAverages.og)(e.categoryAverages.og)}%`,` ${c.dim(`•`)} Twitter Card Tags: ${Gg(e.categoryAverages.twitter)(e.categoryAverages.twitter)}%`,` ${c.dim(`•`)} Core Search SEO: ${Gg(e.categoryAverages.seo)(e.categoryAverages.seo)}%`,` ${c.dim(`•`)} og:image Validation: ${Gg(e.categoryAverages.image)(e.categoryAverages.image)}%`,``,`${c.bold(`Page Score Distribution:`)}`,` ${c.green(`Excellent (90-100)`)}: ${e.summary.excellent} pages`,` ${c.cyan(`Good (75-89)`)}: ${e.summary.good} pages`,` ${c.yellow(`Fair (50-74)`)}: ${e.summary.fair} pages`,` ${c.red(`Poor (0-49)`)}: ${e.summary.poor} pages`].join(`
|
|
84
|
+
`);a(t,`Dashboard`);let n=[...e.pages].toSorted((e,t)=>e.score-t.score),r=Math.min(10,n.length);if(r>0){let e=n.slice(0,r).map(e=>{let t=Wg(e.url);return` [${Gg(e.score)(e.score.toString().padStart(3))}/100] ${c.dim(t||`/`)} — ${e.diagnostics.length} issues`}).join(`
|
|
83
85
|
`);a(e+(n.length>10?`\n ... and ${n.length-10} more pages`:``),`Top Issues - Worst ${r} Pages`)}let i={};for(let t of e.pages)for(let e of t.diagnostics){let t=`${e.tag}:${e.message}`;i[t]||(i[t]={count:0,message:e.message,severity:e.severity,tag:e.tag}),i[t].count+=1}let o=Object.values(i).toSorted((e,t)=>t.count-e.count),s=Math.min(5,o.length);if(s>0){let t=o.slice(0,s).map(t=>{let n=c.blue;return t.severity===`error`?n=c.red:t.severity===`warning`&&(n=c.yellow),` ${n(t.tag)} — ${t.message}\n Failing on ${c.bold(t.count)} pages (${Math.round(t.count/e.totalPages*100)}% of site)`}).join(`
|
|
84
86
|
|
|
85
|
-
`);a(t,`Top ${s} Site-wide Common Issues`)}},
|
|
87
|
+
`);a(t,`Top ${s} Site-wide Common Issues`)}},Jg=new e(`scan`).description(`Scan an entire site (sitemap & crawler fallback) and perform OG/SEO scoring`).argument(`<site-url>`,`The website base URL to scan`).option(`--concurrency <number>`,`Number of concurrent URL requests`,Dg,5).option(`--max-urls <number>`,`Maximum number of URLs to discover and scan`,Dg,200).option(`--json`,`Output raw JSON report to stdout instead of TUI`).option(`--output <path>`,`File path to write the JSON report`,`./og-report.json`).option(`--min-score <number>`,`Minimum average score threshold (exit 1 if below)`,Og).action(async(e,t)=>{let n=e;/^https?:\/\//iu.test(e)||(n=`https://${e}`),t.json||r(c.bgCyan(c.black(` OG Tester — Site Scanner `)));let a=s(),l=`discovery`;t.json||a.start(`Discovering URLs from sitemap / homepage for ${c.underline(n)}...`);try{let e=await Tg({concurrency:t.concurrency,maxUrls:t.maxUrls,onProgress:e=>{if(!t.json){if(e.type===`discovery`)l=`discovery`,a.message(`Discovering site URLs...`);else if(e.type===`checking`){l!==`checking`&&(l=`checking`);let t=`Scanning: [${e.completedUrls}/${e.totalUrls}] ${e.url} (${Gg(e.result?.score||0)(e.result?.score||0)}/100)`;a.message(t)}else e.type===`complete`&&(l=`complete`)}},siteUrl:n});if(t.json||a.stop(`Successfully scanned ${e.totalPages} pages!`),t.output&&await Kg(t.output,e,!!t.json),t.json){console.log(JSON.stringify(e,null,2)),t.minScore!==void 0&&e.averageScore<t.minScore&&process.exit(1);return}qg(e),t.minScore!==void 0&&e.averageScore<t.minScore&&(o(c.red(`Scan failed: Average score ${e.averageScore} is below the threshold of ${t.minScore}`)),process.exit(1)),o(c.green(`Scan complete! Average score: ${e.averageScore}/100`))}catch(e){let n=e instanceof Error?e.message:String(e);t.json?console.error(JSON.stringify({error:n})):(a.stop(`Failed to scan!`),i.error(`Scan error: ${n}`)),process.exit(1)}}),Yg=new e(`sitemap`).description(`Fetch and parse a site's sitemap.xml`).argument(`<url>`,`The URL of the site`).option(`--json`,`Output raw JSON instead of pretty formatting`).action(async(e,t)=>{let n=e;/^https?:\/\//iu.test(e)||(n=`https://${e}`),t.json||r(c.bgCyan(c.black(` OG Tester — Sitemap.xml `)));let l=s();t.json||l.start(`Fetching and parsing sitemap.xml for ${c.underline(n)}...`);try{let e=await go(n);if(t.json){console.log(JSON.stringify(e,null,2));return}l.stop(`Successfully fetched and parsed sitemap.xml!`),e.error&&(i.error(c.red(e.error)),o(c.red(`Exited with errors.`)),process.exit(1));let r=`Total URLs: ${c.bold(e.urls?.length??0)}\n\n`;if(e.urls&&e.urls.length>0){let t=e.urls.slice(0,15);r+=`${c.bold(`URLs Preview:`)}\n`;for(let e of t)r+=` - ${c.cyan(e.loc)}`,e.priority&&(r+=` ${c.dim(`[priority: ${e.priority}]`)}`),e.lastmod&&(r+=` ${c.dim(`(lastmod: ${e.lastmod})`)}`),r+=`
|
|
86
88
|
`;e.urls.length>15&&(r+=`\n ${c.dim(`... and ${e.urls.length-15} more URLs. Use --json to see all.`)}\n`)}else r+=`No URLs parsed from sitemap.
|
|
87
|
-
`;a(r,`Sitemap Summary`),o(c.green(`Done!`))}catch(e){let n=e instanceof Error?e.message:String(e);t.json&&(console.error(JSON.stringify({error:n},null,2)),process.exit(1)),l.stop(c.red(`Failed to fetch or parse sitemap`)),i.error(c.red(n)),o(c.red(`Exited with errors.`)),process.exit(1)}}),
|
|
89
|
+
`;a(r,`Sitemap Summary`),o(c.green(`Done!`))}catch(e){let n=e instanceof Error?e.message:String(e);t.json&&(console.error(JSON.stringify({error:n},null,2)),process.exit(1)),l.stop(c.red(`Failed to fetch or parse sitemap`)),i.error(c.red(n)),o(c.red(`Exited with errors.`)),process.exit(1)}}),Xg=async(e,t)=>{let n=[],r=await u(e,{withFileTypes:!0});for(let i of r){let r=h.join(e,i.name);if(i.isDirectory()){if(i.name===`node_modules`||i.name===`.git`||i.name===`.next`||i.name===`.turbo`||i.name===`build`||i.name===`dist`&&e!==t)continue;n.push(...await Xg(r,t))}else i.isFile()&&i.name.endsWith(`.html`)&&n.push(r)}return n},Zg=e=>{let t=h.join(e,`og-tester.config.json`);if(f(t))try{let e=m(t,`utf-8`);return JSON.parse(e)}catch{i.warn(`Warning: Failed to parse ${t}`)}let n=h.join(e,`package.json`);if(f(n))try{let e=m(n,`utf-8`),t=JSON.parse(e);if(t.ogTester)return t.ogTester}catch{}return null},Qg=async(e,t,n)=>{try{await d(e,JSON.stringify(t,null,2),`utf-8`),n||i.info(`Report saved to ${c.cyan(e)}`)}catch(t){n||i.error(`Failed to save report to ${e}: ${t instanceof Error?t.message:String(t)}`)}},$g=async(e,t)=>{let l=e;/^https?:\/\//iu.test(e)||(l=`https://${e}`),t.json||r(c.bgCyan(c.black(` OG Tester — Check Tags `)));let u=s();t.json||u.start(`Fetching and parsing ${c.underline(l)}...`);try{let e=await to(l),r=await cg(e,l);if(t.json){let n={...e,diagnostics:r.diagnostics,maxScore:r.maxScore,passed:r.passed,score:r.score};console.log(JSON.stringify(n,null,2)),t.minScore!==void 0&&r.score<t.minScore&&process.exit(1);return}if(u.stop(`Successfully fetched and parsed tags!`),a(Ag(e),`Report`),process.stdout.isTTY&&!t.json){process.stdout.write(`\x1B[?25l`);try{for(let e=0;e<=15;e+=1){let t=Math.round(r.score*e/15);e>0&&process.stdout.write(`\x1B[7A\x1B[J`),process.stdout.write(Pg(t)),await n(30)}}finally{process.stdout.write(`\x1B[?25h`)}}else process.stdout.write(Pg(r.score));if(r.diagnostics.length>0){let e=r.diagnostics.map(e=>{let t=c.blue(`ℹ`);return e.severity===`error`?t=c.red(`✖`):e.severity===`warning`&&(t=c.yellow(`⚠`)),`${t} ${c.bold(e.tag)} — ${e.message} (-${e.points} points)\n ${c.dim(`→ Add:`)} ${c.green(e.suggestion)}`}).join(`
|
|
88
90
|
|
|
89
|
-
`);a(e,`Recommendations`)}t.minScore!==void 0&&r.score<t.minScore&&(o(c.red(`Score ${r.score} is below minimum ${t.minScore}`)),process.exit(1)),o(c.green(`Done!`))}catch(e){let n=e instanceof Error?e.message:String(e);t.json&&(console.error(JSON.stringify({error:n},null,2)),process.exit(1)),u.stop(c.red(`Failed to fetch or parse tags`)),i.error(c.red(n)),o(c.red(`Exited with errors.`)),process.exit(1)}},
|
|
91
|
+
`);a(e,`Recommendations`)}t.minScore!==void 0&&r.score<t.minScore&&(o(c.red(`Score ${r.score} is below minimum ${t.minScore}`)),process.exit(1)),o(c.green(`Done!`))}catch(e){let n=e instanceof Error?e.message:String(e);t.json&&(console.error(JSON.stringify({error:n},null,2)),process.exit(1)),u.stop(c.red(`Failed to fetch or parse tags`)),i.error(c.red(n)),o(c.red(`Exited with errors.`)),process.exit(1)}},e_=async(e,t)=>{let n=e;/^https?:\/\//iu.test(e)||(n=`https://${e}`),t.json||r(c.bgCyan(c.black(` OG Tester — Site Scanner `)));let a=s(),l=`discovery`;t.json||a.start(`Discovering URLs from sitemap / homepage for ${c.underline(n)}...`);try{let e=await Tg({concurrency:t.concurrency,maxUrls:t.maxUrls,onProgress:e=>{if(!t.json){if(e.type===`discovery`)l=`discovery`,a.message(`Discovering site URLs...`);else if(e.type===`checking`){l!==`checking`&&(l=`checking`);let t=`Scanning: [${e.completedUrls}/${e.totalUrls}] ${e.url} (${Gg(e.result?.score||0)(e.result?.score||0)}/100)`;a.message(t)}else e.type===`complete`&&(l=`complete`)}},siteUrl:n});if(t.json||a.stop(`Successfully scanned ${e.totalPages} pages!`),t.output&&await Qg(t.output,e,t.json),t.json){console.log(JSON.stringify(e,null,2)),t.minScore!==void 0&&e.averageScore<t.minScore&&process.exit(1);return}qg(e),t.minScore!==void 0&&e.averageScore<t.minScore&&(o(c.red(`Scan failed: Average score ${e.averageScore} is below the threshold of ${t.minScore}`)),process.exit(1)),o(c.green(`Scan complete! Average score: ${e.averageScore}/100`))}catch(e){let n=e instanceof Error?e.message:String(e);t.json?console.error(JSON.stringify({error:n})):(a.stop(`Failed to scan!`),i.error(`Scan error: ${n}`)),process.exit(1)}},t_=async(e,t,n)=>{let r=e.length,i=e.reduce((e,t)=>e+t.score,0),a=Math.round(i/r),s={image:0,og:0,seo:0,twitter:0};for(let t of e)for(let e of t.categories){let t=e.maxScore>0?e.score/e.maxScore*100:0;e.id in s&&(s[e.id]+=t)}let l={image:Math.round(s.image/r),og:Math.round(s.og/r),seo:Math.round(s.seo/r),twitter:Math.round(s.twitter/r)},u={excellent:0,fair:0,good:0,poor:0};for(let t of e)t.score>=90?u.excellent+=1:t.score>=75?u.good+=1:t.score>=50?u.fair+=1:u.poor+=1;let d={averageScore:a,categoryAverages:l,pages:e,scannedAt:new Date().toISOString(),siteUrl:t,summary:u,totalPages:r};if(n.output&&await Qg(n.output,d,n.json),n.json){console.log(JSON.stringify(d,null,2)),n.minScore!==void 0&&d.averageScore<n.minScore&&process.exit(1);return}qg(d),n.minScore!==void 0&&d.averageScore<n.minScore&&(o(c.red(`Scan failed: Average score ${d.averageScore} is below the threshold of ${n.minScore}`)),process.exit(1)),o(c.green(`Scan complete! Average score: ${d.averageScore}/100`))},n_=async(e,t)=>{let n=h.resolve(e);t.json||r(c.bgCyan(c.black(` OG Tester — Local HTML Scanner `)));let a=s();t.json||a.start(`Searching for HTML files in ${c.underline(n)}...`);try{let e=await Xg(n,n);e.length===0&&(a.stop(`No HTML files found!`),t.json?console.error(JSON.stringify({error:`No HTML files found`})):(i.warn(`No .html files were found recursively in ${n}.`),o(`Ensure the directory contains HTML files (e.g. from static export/build).`)),process.exit(1)),t.json||a.message(`Found ${e.length} HTML files. Parsing and scoring...`);let r=[],s=0;for(let i of e){let o=h.relative(n,i),c=await l(i,`utf-8`),u=`file:///${o.replaceAll(`\\`,`/`)}`,d=Qa(c,u),f=await cg(d,u);f.url=`/${o.replaceAll(`\\`,`/`)}`,r.push(f),s+=1,t.json||a.message(`Scanned: [${s}/${e.length}] ${f.url} (${Gg(f.score)(f.score)}/100)`)}a.stop(`Successfully scanned ${r.length} pages!`),await t_(r,n,t)}catch(e){t.json?console.error(JSON.stringify({error:e instanceof Error?e.message:String(e)})):(a.stop(`Failed to scan!`),i.error(`Scan error: ${e instanceof Error?e.message:String(e)}`)),process.exit(1)}},r_=(e,t)=>({concurrency:e.concurrency??t?.concurrency??5,json:e.json??!1,maxUrls:e.maxUrls??t?.maxUrls??200,minScore:e.minScore??t?.minScore,output:e.output??t?.output,scan:e.site||e.scan||t?.scan||!1}),i_=(e,t)=>{if(e&&(e.startsWith(`http://`)||e.startsWith(`https://`)))return{isUrl:!0,url:e};if(e){let t=URL.parse(`https://${e}`);if(t&&t.hostname.replaceAll(`.`,``)!==``&&t.hostname.includes(`.`))return{isUrl:!0,url:t.href}}return t?.url?{isUrl:!0,url:t.url}:{isUrl:!1,url:``}},a_=async(e,t)=>{let n=h.resolve(e||`.`),r=null,a=!1;try{let e=f(n)?p(n):null;a=e?e.isDirectory():!1,a&&(r=Zg(n))}catch{}let o=r_(t,r),s=i_(e,r);s.isUrl?await(o.scan?e_(s.url,o):$g(s.url,o)):a?await n_(n,o):(i.error(`Error: Path or URL "${e}" is not accessible.`),process.exit(1))},o_=new e;o_.name(`og-tester`).version(g).enablePositionalOptions().description(`Test and analyze Open Graph, Twitter Card, and meta tags from the command line`).argument(`[url-or-dir]`,`URL to check or directory of a local web app to scan`,`.`).option(`-s, --site`,`Scan the entire site (sitemap & crawler) instead of a single page`).option(`--concurrency <number>`,`Number of concurrent URL requests during scanning`,Dg).option(`--max-urls <number>`,`Maximum number of URLs to discover and scan`,Dg).option(`--json`,`Output raw JSON report to stdout instead of TUI`).option(`--output <path>`,`File path to write the JSON report`).option(`--min-score <number>`,`Minimum average score threshold (exit 1 if below)`,Og).action(a_),o_.addCommand(Fg),o_.addCommand(Hg),o_.addCommand(Ug),o_.addCommand(Yg),o_.addCommand(Jg),o_.parse();export{};
|