allthings 0.0.0-stage → 2.0.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/LICENSE +21 -0
- package/README.md +47 -2
- package/dist/atw.js +3 -0
- package/dist/index-3352akwf.js +104 -0
- package/dist/index.js +3 -0
- package/package.json +44 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 Erik Thorelli and Andre Landgraf
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
|
-
#
|
|
1
|
+
# allthings
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
allthings from your terminal: what's coming up, who's on stage and how to get in. It reads the same public MCP server agents use, so what you see here is what they see.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
curl -fsSL https://allthingsweb-dev.github.io/allthingsweb/install.bash | bash
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
That installs the latest stable release, `allthings` 2, in `~/.allthings/bin`.
|
|
10
|
+
|
|
11
|
+
It is also on npm as `allthings`, for Bun:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
bunx allthings events
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Use
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
allthings events # what's coming up
|
|
21
|
+
allthings events --past --limit 5 # the five most recent evenings
|
|
22
|
+
allthings event <slug> # one evening: when, where, the talks
|
|
23
|
+
allthings speakers react # who has been on stage about react
|
|
24
|
+
allthings rsvp <slug> # open the evening's page to say you're in
|
|
25
|
+
allthings about # where to find everyone between evenings
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Add `--json` to any of them for the public contract, unformatted, for scripts and agents. Exit codes are part of that contract: 0 ok, 1 service error, 2 usage error, 3 no such evening.
|
|
29
|
+
|
|
30
|
+
`ALLTHINGS_MCP_URL` points it at another server, such as a local Worker.
|
|
31
|
+
|
|
32
|
+
## The old name
|
|
33
|
+
|
|
34
|
+
This CLI used to be `atw`. The installer still puts an `atw` beside `allthings`, and the package still has an `atw` bin. Both run the same CLI and print a note on stderr, so scripts reading stdout keep working. The old name goes away in a later release. `ATW_MCP_URL` and `ATW_VERSION` are still read when the new names are unset.
|
|
35
|
+
|
|
36
|
+
## Working on it
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
bun install
|
|
40
|
+
bun run check && bun run typecheck && bun test
|
|
41
|
+
bun run src/index.ts events
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`src/config.ts` holds the site it talks to, `siteOrigin`: https://allthings.dev, whose MCP server is at `/mcp`.
|
|
45
|
+
|
|
46
|
+
Releases are GitHub releases, cut by pushing an annotated tag that matches `version` in `package.json` (`.github/workflows/cli-release.yaml`). A hyphenated tag (`2.0.0-alpha.2`) is a prerelease, and the installer skips it unless asked.
|
|
47
|
+
|
|
48
|
+
The same workflow then publishes the package to npm with `bun publish`, after the binaries. `bun run build` (which packing runs) bundles `src/index.ts` and `src/atw.ts` for Bun into `dist/`, and the package ships only that, with zod inside. A prerelease gets the `alpha` dist-tag, a release `latest`. npm gives a package's first version `latest` whatever its tag, and `latest` can't be removed, so until there is a stable release `latest` follows the newest prerelease. The step then checks the registry's dist-tags. It publishes with `--tolerate-republish`, so rerunning it after a publish that went through repairs and checks the dist-tags instead of failing on the existing version. Publishing uses the `NPM_TOKEN` repository secret.
|
package/dist/atw.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var Ds=Object.defineProperty;var Ls=(r)=>r;function Us(r,n){this[r]=Ls.bind(null,n)}var Fs=(r,n)=>{for(var o in n)Ds(r,o,{get:n[o],enumerable:!0,configurable:!0,set:Us.bind(n,o)})};var Ie={};Fs(Ie,{ZodISODate:()=>Pe,ZodISODateTime:()=>Se,ZodISODuration:()=>Ee,ZodISOTime:()=>Oe,date:()=>Xu,datetime:()=>Gu,duration:()=>Hu,time:()=>Yu});var Ae="https://allthings.dev/mcp",A="allthings",ar="atw",lr="ALLTHINGS_MCP_URL";function t(r){return(r.split(/[\\/]/).at(-1)??"").replace(/\.exe$/i,"")==="atw"}function pr(r){return r.ALLTHINGS_MCP_URL??r.ATW_MCP_URL??"https://allthings.dev/mcp"}import{parseArgs as ca}from"util";var fr={name:"allthings",version:"2.0.0",description:"allthings from your terminal and your agents: the evenings, who is on stage and how to get in.",license:"MIT",keywords:["allthings","events","meetups","san francisco","mcp","cli"],homepage:"https://allthings.dev",repository:{type:"git",url:"git+https://github.com/allthingsweb-dev/allthingsweb.git",directory:"cli"},bugs:"https://github.com/allthingsweb-dev/allthingsweb/issues",type:"module",bin:{allthings:"./dist/index.js",atw:"./dist/atw.js"},files:["dist"],engines:{bun:">=1.3"},scripts:{build:"rm -rf dist && bun build src/index.ts src/atw.ts --target=bun --minify --splitting --outdir dist",prepack:"bun run build",fmt:"prettier --write .",check:"prettier --check .",typecheck:"tsc --noEmit",test:"bun test"},devDependencies:{"@types/bun":"^1.4.2",prettier:"^3.6.2",typescript:"7.0.2",zod:"^4.6.5"}};function ye(r){let n=Object.values(r).filter((i)=>typeof i==="number");return Object.entries(r).filter(([i,s])=>n.indexOf(+i)===-1).map(([i,s])=>s)}function mt(r,n="|"){return r.map((o)=>_t(o)).join(n)}function xe(r,n){if(typeof n==="bigint")return n.toString();return n}class dr{constructor(r){this._getter=r,this._value=void 0}get value(){let r=this._getter;if(r!==void 0)this._value=r(),this._getter=void 0;return this._value}}function Te(r){return new dr(r)}function mr(r){return r===null||r===void 0}function Ce(r){let n=r.startsWith("^")?1:0,o=r.endsWith("$")?r.length-1:r.length;return r.slice(n,o)}function V(r,n,o){Object.defineProperty(r,n,{value:o,writable:!0,enumerable:!0,configurable:!0})}function Ne(r){let n=Object.getOwnPropertyDescriptor(r,"shape");return n?.get?n.get.raw:n?.value}function Y(r){return Ne(r._zod.def)??r._zod.def.shape}function hr(r,n,o){Object.defineProperty(r,n,{get(){let i=o();return V(this,n,i),i},enumerable:!0,configurable:!0})}function gr(r,n,o){if(n in r)V(r,n,o);else r[n]=o}function ie(r,n,o,i){let s=Y(n);for(let c of o){let u=Object.getOwnPropertyDescriptor(s,c);if(!u.enumerable)continue;if(u.get)hr(r,c,()=>{let a=n._zod.def.shape[c];return i?i(a,c):a});else gr(r,c,i?i(u.value,c):u.value)}}function Js(r,n){for(let o of Reflect.ownKeys(n)){let i=Object.getOwnPropertyDescriptor(n,o);if(!i.enumerable)continue;if(i.get)hr(r,o,()=>n[o]);else gr(r,o,i.value)}}function j(...r){let n={};for(let o of r){let i=Object.getOwnPropertyDescriptors(o);Object.assign(n,i)}return Object.defineProperties({},n)}function _r(r){return JSON.stringify(r)}function yr(r){return r.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ht="captureStackTrace"in Error?Error.captureStackTrace:(...r)=>{};function _e(r){return typeof r==="object"&&r!==null&&!Array.isArray(r)}var xr=Te(()=>{if(D.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(r){return!1}});function ue(r){if(_e(r)===!1)return!1;let n=r.constructor;if(n===void 0)return!0;if(typeof n!=="function")return!0;let o=n.prototype;if(_e(o)===!1)return!1;if(Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")===!1)return!1;return!0}function gt(r){if(ue(r))return{...r};if(Array.isArray(r))return[...r];if(r instanceof Map)return new Map(r);if(r instanceof Set)return new Set(r);return r}var br=new Set(["string","number","symbol"]);function ee(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function W(r,n,o){let i=new r._zod.constr(n??r._zod.def);if(!n||o?.parent)i._zod.parent=r;return i}function y(r){let n=r;if(!n)return{};if(typeof n==="string")return{error:()=>n};if(n?.message!==void 0){if(n?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");n.error=n.message}if(delete n.message,typeof n.error==="string")return{...n,error:()=>n.error};return n}function _t(r){if(typeof r==="bigint")return r.toString()+"n";if(typeof r==="string")return`"${r}"`;return`${r}`}function vr(r){return Object.keys(r).filter((n)=>r[n]._zod.optin!==void 0&&r[n]._zod.optout==="optional")}var yt=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),xt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Bs(r,n){let o=r._zod.def,i=o.checks;if(i&&i.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let c={};return ie(c,r,Re(r,n)),W(r,j(o,{shape:c,checks:[]}))}function Re(r,n){let o=Y(r),i=[];for(let s of Reflect.ownKeys(n)){if(!Object.getOwnPropertyDescriptor(o,s)?.enumerable)throw Error(`Unrecognized key: "${String(s)}"`);if(n[s])i.push(s)}return i}function Ks(r,n){let o=r._zod.def,i=o.checks;if(i&&i.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let c=new Set(Re(r,n)),u={};return ie(u,r,Reflect.ownKeys(Y(r)).filter((a)=>!c.has(a))),W(r,j(o,{shape:u,checks:[]}))}function Vs(r,n){if(!ue(n))throw Error("Invalid input to extend: expected a plain object");let o=r._zod.def.checks;if(o&&o.length>0){let s=Y(r);for(let c of Reflect.ownKeys(n))if(Object.getOwnPropertyDescriptor(s,c)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return W(r,j(r._zod.def,{shape:$r(r,n)}))}function $r(r,n){let o={};return ie(o,r,Reflect.ownKeys(Y(r))),Js(o,n),o}function Ws(r,n){if(!ue(n))throw Error("Invalid input to safeExtend: expected a plain object");return W(r,j(r._zod.def,{shape:$r(r,n)}))}function Gs(r,n){if(!n?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(r._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let o={};ie(o,r,Reflect.ownKeys(Y(r))),ie(o,n,Reflect.ownKeys(Y(n)));let i=j(r._zod.def,{shape:o,get catchall(){return n._zod.def.catchall},checks:n._zod.def.checks??[]});return W(r,i)}function zr(r,n,o,i="partial"){let c=n._zod.def.checks;if(c&&c.length>0)throw Error(`.${i}() cannot be used on object schemas containing refinements`);let a=o?new Set(Re(n,o)):void 0,l={};return ie(l,n,Reflect.ownKeys(Y(n)),r&&((p,f)=>a&&!a.has(f)?p:new r({type:"optional",innerType:p}))),W(n,j(n._zod.def,{shape:l,checks:[]}))}function Xs(r,n,o){let i=o?new Set(Re(n,o)):void 0,s={};return ie(s,n,Reflect.ownKeys(Y(n)),(c,u)=>i&&!i.has(u)?c:new r({type:"nonoptional",innerType:c})),W(n,j(n._zod.def,{shape:s}))}function G(r,n=0){if(r.aborted===!0)return!0;for(let o=n;o<r.issues.length;o++)if(r.issues[o]?.continue!==!0)return!0;return!1}function wr(r,n=0){if(r.aborted===!0)return!0;for(let o=n;o<r.issues.length;o++)if(r.issues[o]?.continue===!1)return!0;return!1}function je(r,n){return n.map((o)=>{var i;return(i=o).path??(i.path=[]),o.path.unshift(r),o})}function ge(r){return typeof r==="string"?r:r?.message}function bt(r,n,o){var i;for(let s=n;s<r.length;s++)(i=r[s]).schema??(i.schema=o)}function te(r,n,o){var i;let s=r.inst?._zod?.traits;if(s?.has("$ZodType"))if(s.has("$ZodCheck"))(i=r).schema??(i.schema=r.inst);else r.schema=r.inst;let c=r.schema!==r.inst?r.schema?._zod.def?.error:void 0,u=r.message?r.message:ge(r.inst?._zod.def?.error?.(r))??ge(c?.(r))??ge(n?.error?.(r))??ge(o.customError?.(r))??ge(o.localeError?.(r))??"Invalid input",a={};for(let l of Object.keys(r)){if(l==="inst"||l==="schema"||l==="continue"||l==="input"||l==="__proto__")continue;a[l]=r[l]}if(a.path??(a.path=[]),a.message=u,n?.reportInput)a.input=r.input;return a}var Ys=/[\uD800-\uDBFF]/;function De(r){let n=r.length;if(!Ys.test(r))return n;let o=n;for(let i=0;i<n-1;i++)if((r.charCodeAt(i)&64512)===55296&&(r.charCodeAt(i+1)&64512)===56320)o--,i++;return o}function Le(r){if(Array.isArray(r))return"array";if(typeof r==="string")return"string";return"unknown"}function kr(r){let n=typeof r;switch(n){case"number":return Number.isNaN(r)?"nan":"number";case"object":{if(r===null)return"null";if(Array.isArray(r))return"array";let o=r;if(o&&Object.getPrototypeOf(o)!==Object.prototype&&"constructor"in o&&o.constructor)return o.constructor.name}}return n}function se(...r){let[n,o,i]=r;if(typeof n==="string")return{message:n,code:"custom",input:o,inst:i};return{...n}}function Zr(r,n){for(let o in n){let i=Object.getOwnPropertyDescriptor(n,o);if(i.get)Object.defineProperty(r,o,{...i,enumerable:!1});else qs(r,o,i.value)}}function H(r,n,o,i=!0){return Object.defineProperty(r,n,{configurable:!0,writable:!0,enumerable:i,value:o}),o}function Ue(r,n,o){return H(r,n,o,!1)}function Hs(r,n){for(let o in r){let i=r[o];Object.defineProperty(n,o,{configurable:!0,enumerable:!0,get(){return H(this,o,i(this))},set(s){H(this,o,s)}})}return n}function qs(r,n,o){Object.defineProperty(r,n,{configurable:!0,get(){return this==null?o:H(this,n,o.bind(this))},set(i){H(this,n,i)}})}function Qs(r,n){let o=Object.getPrototypeOf(r);return n in o?void 0:o}var dt,Q=!1,ec={configurable:!0,get(){Q=!0;return}};function v(r,n,o){let i=Object.getPrototypeOf(r._zod);if(n in i&&dt!==r._zod){dt=void 0;return}dt=r._zod,Object.defineProperty(i,n,{configurable:!0,get(){Object.defineProperty(this,n,ec);let s=Q;Q=!1;try{let c=o(this);if(Q)delete this[n];else Object.defineProperty(this,n,{configurable:!0,writable:!0,value:c});return Q=Q||s,c}catch(c){throw delete this[n],Q=Q||s,c}},set(s){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:s})}})}function tc(r,n,o,i){let s=Qs(r,n);if(!s)return;Object.defineProperty(s,n,{configurable:!0,get(){let c={configurable:!0,writable:!0,enumerable:i,value:void 0};return Object.defineProperty(this,n,c),c.value=o(this),Object.defineProperty(this,n,c),c.value},set(c){Object.defineProperty(this,n,{configurable:!0,writable:!0,enumerable:i,value:c})}})}var rc="~constantCatch";function Sr(r){let n=()=>r;return n[rc]=!0,n}var Pr;var vt={value:void 0,enumerable:!1},Or="captureStackTrace"in Error?Error:null;function nc(r){let n=Or;if(n){let o=n.stackTraceLimit;if(typeof o==="number"){try{n.stackTraceLimit=0}catch{return Or=null,new r}try{return new r}finally{n.stackTraceLimit=o}}}return new r}function d(r,n,o,i){let s={};function c(h){this.def=h,this.constr=m,this.traits=new Set}c.prototype=s;let u=o,a=u&&new WeakSet;function l(h,g){if(!h._zod){vt.value=new c(g);try{Object.defineProperty(h,"_zod",vt)}finally{vt.value=void 0}}else if(h._zod.traits.has(r))return;if(h._zod.traits.add(r),n(h,g),a){let b=Object.getPrototypeOf(h),x=h._zod.constr.prototype,I=b;while(I&&I!==x)I=Object.getPrototypeOf(I);let B=I??b;if(!a.has(B))a.add(B),Zr(B,u)}let _=m.prototype;for(let b in _){if(!Object.prototype.hasOwnProperty.call(_,b))continue;if(!(b in h))h[b]=_[b].bind(h)}}let p=i?.Parent??Object;class f extends p{}Object.defineProperty(f,"name",{value:r});function m(h){let g=i?.Parent?nc(f):this;l(g,h);let _=g._zod.deferred;if(_){for(let x of _)x();g._zod.deferred=void 0}let b=globalThis.__zod_globalConfig?.postProcessor;if(b)b(g);return g}return Object.defineProperty(m,"init",{value:l}),Object.defineProperty(m,Symbol.hasInstance,{value:(h)=>{if(i?.Parent&&h instanceof i.Parent)return!0;return h?._zod?.traits?.has(r)}}),Object.defineProperty(m,"name",{value:r}),m}class X extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class be extends Error{constructor(r){super(`Encountered unidirectional transform during encode: ${r}`);this.name="ZodEncodeError"}}(Pr=globalThis).__zod_globalConfig??(Pr.__zod_globalConfig={});var D=globalThis.__zod_globalConfig;function J(r){if(r)Object.assign(D,r);return D}function oc(){let r=this._zod;return r.message??(r.message=JSON.stringify(r.def,xe,2)),r.message}function ic(r){this._zod.message=r}var sc={get:oc,set:ic,enumerable:!0,configurable:!0},zt={value:void 0,enumerable:!1},Er=new WeakSet([Object.prototype,Error.prototype]),Ir=(r,n)=>{r.name="$ZodError",zt.value=n,Object.defineProperty(r,"issues",zt),zt.value=void 0,Object.defineProperty(r,"message",sc);let o=Object.getPrototypeOf(r);if(!Er.has(o))Er.add(o),Object.defineProperty(o,"toString",{configurable:!0,enumerable:!1,get(){let i=()=>this.message;return Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0})}})},Ar=d("$ZodError",Ir),_a=d("$ZodError",Ir,void 0,{Parent:Error});function cc(r,n,o){if(!Object.prototype.hasOwnProperty.call(r,n))if(n==="__proto__")Object.defineProperty(r,n,{value:o(),writable:!0,enumerable:!0,configurable:!0});else r[n]=o();return r[n]}function Tr(r,n=(o)=>o.message){let o={},i=[];for(let s of r.issues)if(s.path.length>0)cc(o,s.path[0],()=>[]).push(n(s));else i.push(n(s));return{formErrors:i,fieldErrors:o}}function Cr(r,n=(o)=>o.message){let o={_errors:[]},i=(s,c=[])=>{for(let u of s.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map((a)=>i({issues:a},[...c,...u.path]));else if(u.code==="invalid_key")i({issues:u.issues},[...c,...u.path]);else if(u.code==="invalid_element")i({issues:u.issues},[...c,...u.path]);else{let a=[...c,...u.path];if(a.length===0)o._errors.push(n(u));else{let l=o,p=0;while(p<a.length){let f=a[p],m=p===a.length-1;if(f==="_errors"){if(m)l._errors.push(n(u));p++;continue}if(!Object.prototype.hasOwnProperty.call(l,f))Object.defineProperty(l,f,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let h=l[f];if(m)h._errors.push(n(u));l=h,p++}}}};return i(r),o}function Fe(r,n){return{callee:n?.callee??r,Err:n?.Err}}var Me=(r)=>{let n=(o,i,s,c)=>{let u=s?{...s,async:!1}:{async:!1},a=o._zod.run({value:i,issues:[]},u);if(a instanceof Promise)throw new X;if(a.issues.length){let l=new(c?.Err??r)(a.issues.map((p)=>te(p,u,J())));throw ht(l,c?.callee??n),l}return a.value};return n};var Je=(r)=>{let n=async(o,i,s,c)=>{let u=s?{...s,async:!0}:{async:!0},a=o._zod.run({value:i,issues:[]},u);if(a instanceof Promise)a=await a;if(a.issues.length){let l=new(c?.Err??r)(a.issues.map((p)=>te(p,u,J())));throw ht(l,c?.callee??n),l}return a.value};return n};var Be=(r)=>(n,o,i)=>{let s=i?{...i,async:!1}:{async:!1},c=n._zod.run({value:o,issues:[]},s);if(c instanceof Promise)throw new X;return c.issues.length?Nr(r,c.issues,s):{success:!0,data:c.value}};function Nr(r,n,o){let i;return{success:!1,get error(){if(!i)i=new r(n.map((s)=>te(s,o,J()))),n=void 0,o=void 0;return i},set error(s){i=s,n=void 0,o=void 0}}}var Ke=(r)=>async(n,o,i)=>{let s=i?{...i,async:!0}:{async:!0},c=n._zod.run({value:o,issues:[]},s);if(c instanceof Promise)c=await c;return c.issues.length?Nr(r,c.issues,s):{success:!0,data:c.value}};var uc=Symbol.for("zod.compile.invalid"),ac=Symbol.for("zod.compile.fallback"),wt=(r,n,o)=>{let i=r._zod.bag.validator;if(i!==void 0){if(i(n)!==uc)return!0;if(i.definite===!0&&o===void 0)return!1}return lc(r,n,o)};function lc(r,n,o){let i=o?{...o,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},s=r._zod.bag.fallbackRun,c;if(s)i[ac]=!0,c=s({value:n,issues:[]},i);else c=r._zod.run({value:n,issues:[]},i);if(c instanceof Promise)throw new X;return c.issues.length===0}var kt=async(r,n,o)=>{let i=o?{...o,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},s=r._zod.run({value:n,issues:[]},i);if(s instanceof Promise)s=await s;return s.issues.length===0},Rr=(r)=>{let n=Me(r),o=(i,s,c,u)=>{let a=c?{...c,direction:"backward"}:{direction:"backward"};return n(i,s,a,Fe(o,u))};return o};var jr=(r)=>{let n=Me(r),o=(i,s,c,u)=>n(i,s,c,Fe(o,u));return o};var Dr=(r)=>{let n=Je(r),o=async(i,s,c,u)=>{let a=c?{...c,direction:"backward"}:{direction:"backward"};return await n(i,s,a,Fe(o,u))};return o};var Lr=(r)=>{let n=Je(r),o=async(i,s,c,u)=>await n(i,s,c,Fe(o,u));return o};var Ur=(r)=>(n,o,i)=>{let s=i?{...i,direction:"backward"}:{direction:"backward"};return Be(r)(n,o,s)};var Fr=(r)=>(n,o,i)=>Be(r)(n,o,i);var Mr=(r)=>async(n,o,i)=>{let s=i?{...i,direction:"backward"}:{direction:"backward"};return Ke(r)(n,o,s)};var Jr=(r)=>async(n,o,i)=>Ke(r)(n,o,i);var Br=/^[cC][0-9a-z]{6,}$/,Kr=/^[0-9a-z]+$/,Vr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Wr=/^[0-9a-vA-V]{20}$/,Gr=/^[A-Za-z0-9]{27}$/,Xr=/^[a-zA-Z0-9_-]{21}$/;function Yr(r){return new RegExp(`^[a-zA-Z0-9_-]{${r}}$`)}var Hr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var qr=/^([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})$/,St=(r)=>{if(!r)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${r}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Qr=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var pc="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function en(){return new RegExp(pc,"u")}var tn=/^(?:(?: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])$/,rn=/^(([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}|:))$/;var nn=/^((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])$/,on=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,sn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,cn=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var un=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,Ve=/^https?$/,an=/^\+[1-9]\d{6,14}$/;var ln="(?:(?:\\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])))";function fc(r){return new RegExp(`^${r}$`)}var pn=fc(ln);function Zt(r){return typeof r.precision==="number"?r.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":r.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${r.precision}}`:r.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function fn(r){return new RegExp(`^${Zt(r)}$`)}function dn(r){let n=["Z"];if(r.offset)n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${Zt({precision:r.precision,seconds:!0})}(?:${n.join("|")})`,i=r.local?`${o}|${Zt({precision:r.precision})}`:o;return new RegExp(`^${ln}T(?:${i})$`)}var mn=/^[\s\S]{0,}$/;var hn=/^(?:true|false)$/i;var gn=/^[^A-Z]*$/,_n=/^[^a-z]*$/;var L=d("$ZodCheck",(r,n)=>{var o;r._zod??(r._zod={}),r._zod.def=n,(o=r._zod).onattach??(o.onattach=[])});var Pt=(r)=>{let n=r.value;return!mr(n)&&n.length!==void 0};var yn=d("$ZodCheckMaxLength",(r,n)=>{var o;L.init(r,n),(o=r._zod.def).when??(o.when=Pt),r._zod.check=(i)=>{let s=i.value,c=s.length;if((typeof s==="string"&&c>n.maximum?De(s):c)<=n.maximum)return;let a=Le(s);i.issues.push({origin:a,code:"too_big",maximum:n.maximum,inclusive:!0,input:s,inst:r,continue:!n.abort})}}),xn=d("$ZodCheckMinLength",(r,n)=>{var o;L.init(r,n),(o=r._zod.def).when??(o.when=Pt),r._zod.check=(i)=>{let s=i.value,c=s.length;if((typeof s==="string"&&c>=n.minimum&&c<n.minimum*2?De(s):c)>=n.minimum)return;let a=Le(s);i.issues.push({origin:a,code:"too_small",minimum:n.minimum,inclusive:!0,input:s,inst:r,continue:!n.abort})}}),bn=d("$ZodCheckLengthEquals",(r,n)=>{var o;L.init(r,n),(o=r._zod.def).when??(o.when=Pt),r._zod.check=(i)=>{let s=i.value,c=s.length,u=typeof s==="string"&&c>=n.length&&c<=n.length*2?De(s):c;if(u===n.length)return;let a=Le(s),l=u>n.length;i.issues.push({origin:a,...l?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:i.value,inst:r,continue:!n.abort})}}),ve=d("$ZodCheckStringFormat",(r,n)=>{var o,i;if(L.init(r,n),n.pattern)(o=r._zod).check??(o.check=(s)=>{if(n.pattern.lastIndex=0,n.pattern.test(s.value))return;s.issues.push({origin:"string",code:"invalid_format",format:n.format,input:s.value,...n.pattern?{pattern:n.pattern.toString()}:{},inst:r,continue:!n.abort})});else(i=r._zod).check??(i.check=()=>{})}),vn=d("$ZodCheckRegex",(r,n)=>{ve.init(r,n),r._zod.check=(o)=>{if(n.pattern.lastIndex=0,n.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:"regex",input:o.value,pattern:n.pattern.toString(),inst:r,continue:!n.abort})}}),$n=d("$ZodCheckLowerCase",(r,n)=>{n.pattern??(n.pattern=gn),ve.init(r,n)}),zn=d("$ZodCheckUpperCase",(r,n)=>{n.pattern??(n.pattern=_n),ve.init(r,n)}),wn=d("$ZodCheckIncludes",(r,n)=>{L.init(r,n);let o=ee(n.includes),i=new RegExp(typeof n.position==="number"?`^.{${n.position},}${o}`:o);n.pattern=i,r._zod.check=(s)=>{if(s.value.includes(n.includes,n.position))return;s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:n.includes,input:s.value,inst:r,continue:!n.abort})}}),kn=d("$ZodCheckStartsWith",(r,n)=>{L.init(r,n);let o=new RegExp(`^${ee(n.prefix)}.*`);n.pattern??(n.pattern=o),r._zod.check=(i)=>{if(i.value.startsWith(n.prefix))return;i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:n.prefix,input:i.value,inst:r,continue:!n.abort})}}),Zn=d("$ZodCheckEndsWith",(r,n)=>{L.init(r,n);let o=new RegExp(`.*${ee(n.suffix)}$`);n.pattern??(n.pattern=o),r._zod.check=(i)=>{if(i.value.endsWith(n.suffix))return;i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:n.suffix,input:i.value,inst:r,continue:!n.abort})}});var Sn=d("$ZodCheckOverwrite",(r,n)=>{L.init(r,n),r._zod.check=(o)=>{o.value=n.tx(o.value)}});class Ot{constructor(r=[],n={}){this.content=[],this.indent=0,this.args=r,this.closed=n}indented(r){this.indent+=1;try{r(this)}finally{this.indent-=1}}write(r){if(typeof r==="function"){r(this,{execution:"sync"}),r(this,{execution:"async"});return}let o=r.split(`
|
|
3
|
+
`).filter((c)=>c),i=Math.min(...o.map((c)=>c.length-c.trimStart().length)),s=o.map((c)=>c.slice(i)).map((c)=>" ".repeat(this.indent*2)+c);for(let c of s)this.content.push(c)}compile(){let r=Function,n=this?.content??[""];return new r(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
4
|
+
${n.join(`
|
|
5
|
+
`)}
|
|
6
|
+
};`)(...Object.values(this.closed))}}var On={major:4,minor:6,patch:5};var S=d("$ZodType",(r,n)=>{var o;r??(r={}),r._zod.def=n,r._zod.bag=r._zod.bag||{},r._zod.version=On;let i=r._zod.def.checks,s=r._zod.traits.has("$ZodCheck")?[r,...i??[]]:i?.length?[...i]:[];for(let c of s)for(let u of c._zod.onattach)u(r);if(s.length===0)(o=r._zod).deferred??(o.deferred=[]),r._zod.deferred?.push(()=>{r._zod.run=r._zod.parse});else{let c=(a,l,p)=>{if(a.memo)return a;let f=G(a),m;for(let h of l){if(h._zod.def.when){if(wr(a))continue;if(!h._zod.def.when(a))continue}else if(f)continue;let g=a.issues.length,_=h._zod.check(a);if(_ instanceof Promise&&p?.async===!1)throw new X;if(m||_ instanceof Promise)m=(m??Promise.resolve()).then(async()=>{if(await _,a.issues.length===g)return;if(bt(a.issues,g,r),!f)f=G(a,g)});else{if(a.issues.length===g)continue;if(bt(a.issues,g,r),!f)f=G(a,g)}}if(m)return m.then(()=>a);return a},u=(a,l,p)=>{if(G(a))return a.aborted=!0,a;let f=c(l,s,p);if(f instanceof Promise){if(p.async===!1)throw new X;return f.then((m)=>r._zod.parse(m,p))}return r._zod.parse(f,p)};r._zod.run=(a,l)=>{if(l.skipChecks)return r._zod.parse(a,l);if(l.direction==="backward"){let f=r._zod.parse({value:a.value,issues:[]},{...l,skipChecks:!0});if(f instanceof Promise)return f.then((m)=>u(m,a,l));return u(f,a,l)}let p=r._zod.parse(a,l);if(p instanceof Promise){if(l.async===!1)throw new X;return p.then((f)=>c(f,s,l))}return c(p,s,l)}}},{get "~standard"(){return Ue(this,"~standard",It(this))},set "~standard"(r){H(this,"~standard",r)}}),Un=(r,n)=>r.issues.length?{issues:r.issues.map((o)=>te(o,n,J()))}:{value:r.value};async function hc(r,n){let o={async:!0};return Un(await r._zod.run({value:n,issues:[]},o),o)}function It(r){return{validate:(n)=>{let o={async:!1};try{let i=r._zod.run({value:n,issues:[]},o);if(!(i instanceof Promise))return Un(i,o)}catch(i){}return hc(r,n)},vendor:"zod",version:1}}var Ye=d("$ZodString",(r,n)=>{S.init(r,n),r._zod.pattern=n.pattern??mn,r._zod.parse=(o,i)=>{if(n.coerce)try{o.value=String(o.value)}catch(s){}if(typeof o.value==="string")return o;return o.issues.push({expected:"string",code:"invalid_type",input:o.value,inst:r}),o}}),k=d("$ZodStringFormat",(r,n)=>{ve.init(r,n),Ye.init(r,n)}),Fn=d("$ZodGUID",(r,n)=>{n.pattern??(n.pattern=qr),k.init(r,n)}),Mn=d("$ZodUUID",(r,n)=>{if(n.version){let i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[n.version];if(i===void 0)throw Error(`Invalid UUID version: "${n.version}"`);n.pattern??(n.pattern=St(i))}else n.pattern??(n.pattern=St());k.init(r,n)}),Jn=d("$ZodEmail",(r,n)=>{n.pattern??(n.pattern=Qr),k.init(r,n)}),Bn=1,Ge=2;function Kn(r){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(r);return new URL(r),!0}catch{return!1}}function gc(r,n){if(!("normalize"in n)&&!("hostname"in n)&&!("protocol"in n))return Kn(r)||Ge;return _c(r,n)}function _c(r,n){if(!n.normalize&&n.protocol?.source===Ve.source&&!/^https?:\/\//i.test(r))return Bn;try{if(typeof URL<"u"){let o=URL;if(typeof o.parse==="function")return o.parse(r)??Ge}return new URL(r)}catch{return Ge}}var yc=/[\t\n\r]/g;function En(r){return r.replace(yc,"")}function xc(r,n){return n.lastIndex=0,n.test(r.hostname)}function bc(r,n){return n.lastIndex=0,n.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)}var Vn=d("$ZodURL",(r,n)=>{k.init(r,n),r._zod.check=(o)=>{try{let i=o.value.trim(),s=gc(i,n);if(s===Bn){o.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:o.value,inst:r,continue:!n.abort});return}if(s===Ge){o.issues.push({code:"invalid_format",format:"url",input:o.value,inst:r,continue:!n.abort});return}if(s===!0){o.value=En(i);return}if(n.hostname&&!xc(s,n.hostname))o.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:n.hostname.source,input:o.value,inst:r,continue:!n.abort});if(n.protocol&&!bc(s,n.protocol))o.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:n.protocol.source,input:o.value,inst:r,continue:!n.abort});o.value=n.normalize?s.href:En(i);return}catch(i){o.issues.push({code:"invalid_format",format:"url",input:o.value,inst:r,continue:!n.abort})}}}),Wn=d("$ZodEmoji",(r,n)=>{n.pattern??(n.pattern=en()),k.init(r,n)}),Gn=d("$ZodNanoID",(r,n)=>{if(n.length!==void 0&&(!Number.isInteger(n.length)||n.length<1))throw Error(`Invalid nanoid length: ${n.length}`);n.pattern??(n.pattern=n.length===void 0?Xr:Yr(n.length)),k.init(r,n)}),Xn=d("$ZodCUID",(r,n)=>{n.pattern??(n.pattern=Br),k.init(r,n)}),Yn=d("$ZodCUID2",(r,n)=>{n.pattern??(n.pattern=Kr),k.init(r,n)}),Hn=d("$ZodULID",(r,n)=>{n.pattern??(n.pattern=Vr),k.init(r,n)}),qn=d("$ZodXID",(r,n)=>{n.pattern??(n.pattern=Wr),k.init(r,n)}),Qn=d("$ZodKSUID",(r,n)=>{n.pattern??(n.pattern=Gr),k.init(r,n)}),eo=d("$ZodISODateTime",(r,n)=>{n.pattern??(n.pattern=dn(n)),k.init(r,n)}),to=d("$ZodISODate",(r,n)=>{n.pattern??(n.pattern=pn),k.init(r,n)}),ro=d("$ZodISOTime",(r,n)=>{n.pattern??(n.pattern=fn(n)),k.init(r,n)}),no=d("$ZodISODuration",(r,n)=>{n.pattern??(n.pattern=Hr),k.init(r,n)}),oo=d("$ZodIPv4",(r,n)=>{n.pattern??(n.pattern=tn),k.init(r,n)}),vc=/^[0-9a-fA-F:.]+$/;function io(r){if(!vc.test(r))return!1;return Kn(`http://[${r}]`)}var so=d("$ZodIPv6",(r,n)=>{n.pattern??(n.pattern=rn),k.init(r,n),r._zod.check=(o)=>{if(!io(o.value))o.issues.push({code:"invalid_format",format:"ipv6",input:o.value,inst:r,continue:!n.abort})}});var co=d("$ZodCIDRv4",(r,n)=>{n.pattern??(n.pattern=nn),k.init(r,n)});function $c(r){let n=r.split("/");if(n.length!==2)return!1;let[o,i]=n;if(!i)return!1;let s=Number(i);if(`${s}`!==i)return!1;if(s<0||s>128)return!1;return io(o)}var uo=d("$ZodCIDRv6",(r,n)=>{n.pattern??(n.pattern=on),k.init(r,n),r._zod.check=(o)=>{if(!$c(o.value))o.issues.push({code:"invalid_format",format:"cidrv6",input:o.value,inst:r,continue:!n.abort})}});function ao(r){if(r==="")return!0;if(/\s/.test(r))return!1;if(r.length%4!==0)return!1;try{return atob(r),!0}catch{return!1}}var At=/^[0-9a-zA-Z+/]*={0,2}$/,lo=d("$ZodBase64",(r,n)=>{n.pattern??(n.pattern=At),k.init(r,n),r._zod.check=(o)=>{if(ao(o.value))return;o.issues.push({code:"invalid_format",format:"base64",input:o.value,inst:r,continue:!n.abort})}}),He=/^[A-Za-z0-9_-]*$/;function zc(r){if(!He.test(r))return!1;let n=r.replace(/[-_]/g,(i)=>i==="-"?"+":"/"),o=n.padEnd(Math.ceil(n.length/4)*4,"=");return ao(o)}var po=d("$ZodBase64URL",(r,n)=>{n.pattern??(n.pattern=He),k.init(r,n),r._zod.check=(o)=>{if(zc(o.value))return;o.issues.push({code:"invalid_format",format:"base64url",input:o.value,inst:r,continue:!n.abort})}}),fo=d("$ZodE164",(r,n)=>{n.pattern??(n.pattern=an),k.init(r,n)});function wc(r,n=null){try{let o=r.split(".");if(o.length!==3)return!1;let[i]=o;if(!i)return!1;let s=JSON.parse(atob(i));if("typ"in s&&s?.typ!=="JWT")return!1;if(!s.alg)return!1;if(n&&(!("alg"in s)||s.alg!==n))return!1;return!0}catch{return!1}}var mo=d("$ZodJWT",(r,n)=>{k.init(r,n),r._zod.check=(o)=>{if(wc(o.value,n.alg))return;o.issues.push({code:"invalid_format",format:"jwt",input:o.value,inst:r,continue:!n.abort})}});var ho=d("$ZodBoolean",(r,n)=>{S.init(r,n),r._zod.pattern=hn,r._zod.parse=(o,i)=>{if(n.coerce)try{o.value=Boolean(o.value)}catch(c){}let s=o.value;if(typeof s==="boolean")return o;return o.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:r}),o}});var go=d("$ZodUnknown",(r,n)=>{S.init(r,n),r._zod.parse=(o)=>o}),_o=d("$ZodNever",(r,n)=>{S.init(r,n),r._zod.parse=(o,i)=>(o.issues.push({expected:"never",code:"invalid_type",input:o.value,inst:r}),o)});function In(r,n,o){if(r.issues.length)n.issues.push(...je(o,r.issues));n.value[o]=r.value}var yo=d("$ZodArray",(r,n)=>{S.init(r,n);let o=D.memoizer;o?.attach(r),r._zod.parse=(i,s)=>{let c=i.value;if(!Array.isArray(c))return i.issues.push({expected:"array",code:"invalid_type",input:c,inst:r}),i;i.value=o?o.alloc(r,i,Array(c.length),s):Array(c.length);let u=[],a=s?.abortEarly;for(let l=0;l<c.length;l++){let p=c[l],f=n.element._zod.run({value:p,issues:[]},s);if(f instanceof Promise)u.push(f.then((m)=>In(m,i,l)));else if(In(f,i,l),a&&f.issues.length!==0&&G(f))break}if(u.length)return Promise.all(u).then(()=>i);return i}});function Xe(r,n,o,i,s,c){let u=o in i,a=c==="optional";if(!u&&a&&s==="optional")return;if(r.issues.length){if(s!==void 0&&a&&!u)return;n.issues.push(...je(o,r.issues))}if(!u&&s===void 0){if(!r.issues.length)n.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[o]});return}if(r.value===void 0){if(u||s==="defaulted"&&!a)n.value[o]=void 0}else n.value[o]=r.value}var kc=[];function xo(r){let n=Object.keys(r.shape),o=Object.getOwnPropertySymbols(r.shape),i=o.length?o:kc,s=i.length?[...n,...i]:n;for(let u of s)if(!r.shape?.[u]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(u)}": expected a Zod schema`);let c=vr(r.shape);return{...r,allKeys:s,symbolKeys:i,keySet:new Set(n),numKeys:n.length,optionalKeys:new Set(c)}}function bo(r,n,o,i,s,c,u){let a=[],l=s.keySet,p=s.catchall._zod,f=p.def.type,{optin:m,optout:h}=p,g=0;for(let _ in n){if(u&&o.issues.length!==g){if(G(o,g))break;g=o.issues.length}if(l.has(_))continue;if(_==="__proto__"){if(f==="never")a.push(_);continue}if(f==="never"){a.push(_);continue}let b=p.run({value:n[_],issues:[]},i);if(b instanceof Promise)r.push(b.then((x)=>Xe(x,o,_,n,m,h)));else Xe(b,o,_,n,m,h)}if(a.length)o.issues.push({code:"unrecognized_keys",keys:a,input:n,inst:c,continue:!0});if(!r.length)return o;return Promise.all(r).then(()=>o)}var Zc=d("$ZodObject",(r,n)=>{S.init(r,n);let o=Object.getOwnPropertyDescriptor(n,"shape"),i=o?.get?o.get.raw:n.shape??{};if(i){let p=()=>{let f={...i};return Object.defineProperty(n,"shape",{value:f}),p.raw=f,f};p.raw=i,Object.defineProperty(n,"shape",{get:p})}let s=Te(()=>xo(n));v(r,"propValues",(p)=>{let f=p.def.shape,m={};for(let h in f){let g=f[h]._zod;if(g.values){if(!Object.prototype.hasOwnProperty.call(m,h))V(m,h,new Set);for(let _ of g.values)m[h].add(_);if(g.optin!==void 0)m[h].add(void 0)}}return m});let c=_e,u=n.catchall,a,l=D.memoizer;l?.attach(r),r._zod.parse=(p,f)=>{a??(a=s.value);let m=p.value;if(!c(m))return p.issues.push({expected:"object",code:"invalid_type",input:m,inst:r}),p;p.value=l?l.alloc(r,p,{},f):{};let h=[],g=a.shape,_=f?.abortEarly,b=p.issues.length;for(let x of a.allKeys){if(_&&p.issues.length!==b){if(G(p,b))break;b=p.issues.length}if(x==="__proto__")continue;let I=g[x],B=I._zod.optin,me=I._zod.optout,he=I._zod.run({value:m[x],issues:[]},f);if(he instanceof Promise)h.push(he.then((E)=>Xe(E,p,x,m,B,me)));else Xe(he,p,x,m,B,me)}if(!u)return h.length?Promise.all(h).then(()=>p):p;return bo(h,m,p,f,s.value,r,_===!0)}}),vo=d("$ZodObjectJIT",(r,n)=>{Zc.init(r,n);let o=r._zod.parse,i=Te(()=>xo(n)),s=D.memoizer,c=(g)=>{let _=i.value,b=_.symbolKeys,x=new Ot(["payload","ctx"],{shape:g,inst:r,memo:s,syms:b}),I=(E)=>`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`,B=(E,w)=>`
|
|
7
|
+
let ${E}_ab = false;
|
|
8
|
+
for (let i = 0; i < ${E}.issues.length; i++) {
|
|
9
|
+
const iss = ${E}.issues[i];
|
|
10
|
+
iss.path = iss.path ? [${w}, ...iss.path] : [${w}];
|
|
11
|
+
payload.issues.push(iss);
|
|
12
|
+
if (iss.continue !== true) ${E}_ab = true;
|
|
13
|
+
}
|
|
14
|
+
if (${E}_ab && ctx && ctx.abortEarly) {
|
|
15
|
+
payload.value = newResult;
|
|
16
|
+
return payload;
|
|
17
|
+
}`;x.write("const input = payload.value;");let me=Object.create(null),he=0;for(let E of _.allKeys)me[E]=`key_${he++}`;x.write(s?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let E of _.allKeys){if(E==="__proto__")continue;let w=me[E],K=typeof E==="symbol"?`syms[${b.indexOf(E)}]`:_r(E),pt=`${K} in input`,cr=g[E],ft=cr?._zod?.optin,ur=ft!==void 0,Rs=cr?._zod?.optout==="optional";if(x.write(`const ${w} = ${I(K)};`),ur&&Rs){let js=ft==="optional"?`${w}_present`:`${w}.value !== undefined || ${w}_present`;x.write(`
|
|
18
|
+
const ${w}_present = ${pt};
|
|
19
|
+
if (!${w}.issues.length || ${w}_present) {
|
|
20
|
+
if (${w}.issues.length) {${B(w,K)}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (${js}) {
|
|
24
|
+
newResult[${K}] = ${w}.value;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
`)}else if(!ur)x.write(`
|
|
29
|
+
const ${w}_present = ${pt};
|
|
30
|
+
if (${w}.issues.length) {${B(w,K)}
|
|
31
|
+
}
|
|
32
|
+
if (!${w}_present && !${w}.issues.length) {
|
|
33
|
+
payload.issues.push({
|
|
34
|
+
code: "invalid_type",
|
|
35
|
+
expected: "nonoptional",
|
|
36
|
+
input: undefined,
|
|
37
|
+
path: [${K}]
|
|
38
|
+
});
|
|
39
|
+
if (ctx && ctx.abortEarly) {
|
|
40
|
+
payload.value = newResult;
|
|
41
|
+
return payload;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (${w}_present) {
|
|
46
|
+
newResult[${K}] = ${w}.value;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
`);else if(x.write(`
|
|
50
|
+
if (${w}.issues.length) {${B(w,K)}
|
|
51
|
+
}
|
|
52
|
+
`),ft==="defaulted")x.write(`newResult[${K}] = ${w}.value;`);else x.write(`
|
|
53
|
+
if (${w}.value !== undefined || ${pt}) {
|
|
54
|
+
newResult[${K}] = ${w}.value;
|
|
55
|
+
}
|
|
56
|
+
`)}return x.write("payload.value = newResult;"),x.write("return payload;"),x.compile()},u,a=_e,l=!D.jitless,f=l&&xr.value,m=n.catchall,h;r._zod.parse=(g,_)=>{h??(h=i.value);let b=g.value;if(!a(b))return g.issues.push({expected:"object",code:"invalid_type",input:b,inst:r}),g;if(l&&f&&_?.async===!1&&_.jitless!==!0){if(!u)u=c(n.shape);if(g=u(g,_),!m)return g;return bo([],b,g,_,h,r,_?.abortEarly===!0)}return o(g,_)}});function An(r,n,o,i){for(let c of r)if(c.issues.length===0)return n.value=c.value,n;let s=r.filter((c)=>!G(c));if(s.length===1)return n.value=s[0].value,s[0];return n.issues.push({code:"invalid_union",input:n.value,inst:o,errors:r.map((c)=>c.issues.map((u)=>te(u,i,J())))}),n}var $o=d("$ZodUnion",(r,n)=>{S.init(r,n),v(r,"optin",(i)=>i.def.options.some((s)=>s._zod.optin==="defaulted")?"defaulted":i.def.options.some((s)=>s._zod.optin!==void 0)?"optional":void 0),v(r,"optout",(i)=>i.def.options.some((s)=>s._zod.optout==="optional")?"optional":void 0),v(r,"values",(i)=>{if(i.def.options.every((s)=>s._zod.values))return new Set(i.def.options.flatMap((s)=>Array.from(s._zod.values)));return}),v(r,"pattern",(i)=>{if(i.def.options.every((s)=>s._zod.pattern)){let s=i.def.options.map((c)=>c._zod.pattern);return new RegExp(`^(${s.map((c)=>Ce(c.source)).join("|")})$`)}return});let o=n.options.length===1?n.options[0]._zod.run:null;r._zod.parse=(i,s)=>{if(o)return o(i,s);let c=!1,u=[];for(let a of n.options){let l=a._zod.run({value:i.value,issues:[]},s);if(l instanceof Promise)u.push(l),c=!0;else{if(l.issues.length===0)return l;u.push(l)}}if(!c)return An(u,i,r,s);return Promise.all(u).then((a)=>An(a,i,r,s))}});var zo=d("$ZodIntersection",(r,n)=>{S.init(r,n),r._zod.parse=(o,i)=>{let s=o.value,c=n.left._zod.run({value:s,issues:[]},i),u=n.right._zod.run({value:s,issues:[]},i);if(c instanceof Promise||u instanceof Promise)return Promise.all([c,u]).then(([l,p])=>Tn(o,l,p));return Tn(o,c,u)}});function Et(r,n){if(r===n)return{valid:!0,data:r};if(r instanceof Date&&n instanceof Date&&+r===+n)return{valid:!0,data:r};if(ue(r)&&ue(n)){let o=Object.keys(n),i=Object.keys(r).filter((c)=>o.indexOf(c)!==-1),s={...r,...n};if(Object.prototype.hasOwnProperty.call(s,"__proto__"))delete s.__proto__;for(let c of i){if(c==="__proto__")continue;let u=Et(r[c],n[c]);if(!u.valid)return{valid:!1,mergeErrorPath:[c,...u.mergeErrorPath]};s[c]=u.data}return{valid:!0,data:s}}if(Array.isArray(r)&&Array.isArray(n)){if(r.length!==n.length)return{valid:!1,mergeErrorPath:[]};let o=[];for(let i=0;i<r.length;i++){let s=r[i],c=n[i],u=Et(s,c);if(!u.valid)return{valid:!1,mergeErrorPath:[i,...u.mergeErrorPath]};o.push(u.data)}return{valid:!0,data:o}}return{valid:!1,mergeErrorPath:[]}}function Tn(r,n,o){let i=new Map,s,c=new Map,u=(p,f)=>{let m;if(p.code==="unrecognized_keys"&&!p.path?.length)s??(s=p),m=p.keys;else if(p.code==="invalid_key"&&p.origin==="record"&&p.path?.length===1){let h=String(p.path[0]);if(!c.has(h))c.set(h,p);m=[h]}else return!1;for(let h of m){if(!i.has(h))i.set(h,{});i.get(h)[f]=!0}return!0};for(let p of n.issues)if(!u(p,"l"))r.issues.push(p);for(let p of o.issues)if(!u(p,"r"))r.issues.push(p);let a=[...i].filter(([,p])=>p.l&&p.r).map(([p])=>p);if(a.length){let p=s?a.filter((f)=>s.keys.includes(f)):[];if(p.length)r.issues.push({...s,keys:p});for(let f of a)if(!p.includes(f)&&c.has(f))r.issues.push(c.get(f))}let l=Et(n.value,o.value);if(!l.valid){if(G(r))return r;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(l.mergeErrorPath)}`)}return r.value=l.data,r}var wo=d("$ZodEnum",(r,n)=>{S.init(r,n);let o=ye(n.entries),i=new Set(o);r._zod.values=i,v(r,"pattern",(s)=>{let c=ye(s.def.entries).filter((u)=>br.has(typeof u));return new RegExp(c.length?`^(${c.map((u)=>ee(u.toString())).join("|")})$`:"^[^\\s\\S]$")}),r._zod.parse=(s,c)=>{let u=s.value;if(i.has(u))return s;return s.issues.push({code:"invalid_value",values:o,input:u,inst:r}),s}}),ko=d("$ZodLiteral",(r,n)=>{S.init(r,n);let o=new Set(n.values);r._zod.values=o,v(r,"pattern",(i)=>{let s=i.def.values;return new RegExp(s.length?`^(${s.map((c)=>typeof c==="string"?ee(c):c?ee(c.toString()):String(c)).join("|")})$`:"^[^\\s\\S]$")}),r._zod.parse=(i,s)=>{let c=i.value;if(o.has(c))return i;return i.issues.push({code:"invalid_value",values:n.values,input:c,inst:r}),i}});var Zo=d("$ZodTransform",(r,n)=>{S.init(r,n),r._zod.optin="optional",D.memoizer?.guard(r),r._zod.parse=(o,i)=>{if(i.direction==="backward")throw new be(r.constructor.name);let s=n.transform(o.value,o);if(i.async)return(s instanceof Promise?s:Promise.resolve(s)).then((u)=>(o.value=u,o));if(s instanceof Promise)throw new X;return o.value=s,o}});function Cn(r,n){return r.value=n.issues.length?void 0:n.value,r}var Tt=d("$ZodOptional",(r,n)=>{S.init(r,n),v(r,"optin",(o)=>o.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),r._zod.optout="optional",v(r,"values",(o)=>{let i=o.def.innerType._zod.values;return i?new Set([...i,void 0]):void 0}),v(r,"pattern",(o)=>{let i=o.def.innerType._zod.pattern;return i?new RegExp(`^(${Ce(i.source)})?$`):void 0}),r._zod.parse=(o,i)=>{if(o.value===void 0){if(n.innerType._zod.optin!=="defaulted")return o;let s=n.innerType._zod.run({value:o.value,issues:[]},i);if(s instanceof Promise)return s.then((c)=>Cn(o,c));return Cn(o,s)}return n.innerType._zod.run(o,i)}}),So=d("$ZodExactOptional",(r,n)=>{Tt.init(r,n),v(r,"values",(o)=>o.def.innerType._zod.values),v(r,"pattern",(o)=>o.def.innerType._zod.pattern),r._zod.parse=(o,i)=>n.innerType._zod.run(o,i)}),Po=d("$ZodNullable",(r,n)=>{S.init(r,n),v(r,"optin",(o)=>o.def.innerType._zod.optin),v(r,"optout",(o)=>o.def.innerType._zod.optout),v(r,"pattern",(o)=>{let i=o.def.innerType._zod.pattern;return i?new RegExp(`^(${Ce(i.source)}|null)$`):void 0}),v(r,"values",(o)=>o.def.innerType._zod.values?new Set([...o.def.innerType._zod.values,null]):void 0),r._zod.parse=(o,i)=>{if(o.value===null)return o;return n.innerType._zod.run(o,i)}}),Oo=d("$ZodDefault",(r,n)=>{S.init(r,n),r._zod.optin="defaulted",v(r,"values",(o)=>o.def.innerType._zod.values),r._zod.parse=(o,i)=>{if(i.direction==="backward")return n.innerType._zod.run(o,i);if(o.value===void 0)return o.value=n.defaultValue,o;let s=n.innerType._zod.run(o,i);if(s instanceof Promise)return s.then((c)=>Nn(c,n));return Nn(s,n)}});function Nn(r,n){if(r.value===void 0)r.value=n.defaultValue;return r}var Eo=d("$ZodPrefault",(r,n)=>{S.init(r,n),r._zod.optin="defaulted",v(r,"values",(o)=>o.def.innerType._zod.values),r._zod.parse=(o,i)=>{if(i.direction==="backward")return n.innerType._zod.run(o,i);if(o.value===void 0)o.value=n.defaultValue;return n.innerType._zod.run(o,i)}}),Io=d("$ZodNonOptional",(r,n)=>{S.init(r,n),v(r,"values",(o)=>{let i=o.def.innerType._zod.values;return i?new Set([...i].filter((s)=>s!==void 0)):void 0}),r._zod.parse=(o,i)=>{let s=n.innerType._zod.run(o,i);if(s instanceof Promise)return s.then((c)=>Rn(c,r));return Rn(s,r)}});function Rn(r,n){if(!r.issues.length&&r.value===void 0)r.issues.push({code:"invalid_type",expected:"nonoptional",input:r.value,inst:n});return r}function jn(r,n,o,i){if(!n.issues.length){if(r.value=n.value,n.memo)r.memo=!0;return r}return r.value=o.catchValue({...n,value:r.value,error:{issues:n.issues.map((s)=>te(s,i,J()))},input:r.value}),r}var Ao=d("$ZodCatch",(r,n)=>{S.init(r,n),v(r,"optin",(o)=>o.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),v(r,"optout",(o)=>o.def.innerType._zod.optout),v(r,"values",(o)=>o.def.innerType._zod.values),r._zod.parse=(o,i)=>{if(i.direction==="backward")return n.innerType._zod.run(o,i);let s=n.innerType._zod.run({value:o.value,issues:[]},i);if(s instanceof Promise)return s.then((c)=>jn(o,c,n,i));return jn(o,s,n,i)}});var To=d("$ZodPipe",(r,n)=>{S.init(r,n),v(r,"values",(o)=>o.def.in._zod.values),v(r,"optin",(o)=>o.def.in._zod.optin),v(r,"optout",(o)=>o.def.out._zod.optout),v(r,"propValues",(o)=>o.def.in._zod.propValues),r._zod.parse=(o,i)=>{if(i.direction==="backward"){let c=n.out._zod.run(o,i);if(c instanceof Promise)return c.then((u)=>We(u,n.in,i));return We(c,n.in,i)}let s=n.in._zod.run(o,i);if(s instanceof Promise)return s.then((c)=>We(c,n.out,i));return We(s,n.out,i)}});function We(r,n,o){if(r.issues.some((i)=>i.code!=="unrecognized_keys"))return r.aborted=!0,r;return n._zod.run({value:r.value,issues:r.issues},o)}var Co=d("$ZodReadonly",(r,n)=>{S.init(r,n),v(r,"propValues",(o)=>o.def.innerType._zod.propValues),v(r,"values",(o)=>o.def.innerType._zod.values),v(r,"optin",(o)=>o.def.innerType?._zod?.optin),v(r,"optout",(o)=>o.def.innerType?._zod?.optout),r._zod.parse=(o,i)=>{if(i.direction==="backward")return n.innerType._zod.run(o,i);let s=n.innerType._zod.run(o,i);if(s instanceof Promise)return s.then(Dn);return Dn(s)}});function Dn(r){if(!r.memo)r.value=Object.freeze(r.value);return r}var No=d("$ZodCustom",(r,n)=>{L.init(r,n),S.init(r,n),r._zod.parse=(o,i)=>o,r._zod.check=(o)=>{let i=o.value,s=n.fn(i);if(s instanceof Promise)return s.then((c)=>Ln(c,o,i,r));Ln(s,o,i,r);return}});function Ln(r,n,o,i){if(!r){let s={code:"custom",input:o,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};if(i._zod.def.params)s.params=i._zod.def.params;n.issues.push(se(s))}}class jo extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Nt="~memo",Ro=[];function Do(r){return r!==null&&typeof r==="object"}function Ct(r){return r.map((n)=>n.path?{...n,path:n.path.slice()}:{...n})}var Lo=new WeakMap,$e=0,et=1,ze=2;function tt(r,n,o){let i=Lo.get(r);if(i!==void 0)return i?ze:$e;if(n.has(r))return ze;n.add(r);let s=$e,c=(f)=>{if(s!==ze&&f?._zod){let m=tt(f,n,o);if(m>s)s=m}},u=(f,m)=>{let h=$e;for(let g of Reflect.ownKeys(f)){let _=Object.getOwnPropertyDescriptor(f,g);if(m&&!_.enumerable)continue;let b=_.get?et:_.value?._zod?tt(_.value,n,o):$e;if(b>h)h=b}return h},a=(f)=>{if(f>s)s=f},l=r._zod.def,p=l.type;switch(p){case"object":{let f=Ne(l);a(f?u(f,!0):et),c(l.catchall);break}case"array":c(l.element);break;case"tuple":for(let f of l.items)c(f);c(l.rest);break;case"record":case"map":c(l.keyType),c(l.valueType);break;case"set":c(l.valueType);break;case"union":for(let f of l.options)c(f);break;case"intersection":c(l.left),c(l.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":c(l.innerType);break;case"pipe":c(l.in),c(l.out);break;case"function":c(l.input),c(l.output);break;case"lazy":{let f=l._cachedInner??(o?r._zod.innerType:void 0);a(f?tt(f,n,!1):et);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let f in l){let m=Object.getOwnPropertyDescriptor(l,f);if(!m||m.get)continue;let h=m.value;if(!h||typeof h!=="object")continue;if(h._zod)c(h);else if(Array.isArray(h))for(let g of h)c(g)}}return n.delete(r),Sc(r,s)}function Sc(r,n){if(n!==et)Lo.set(r,n===ze);return n}function Pc(r,n){let o=r.buckets.get(n);if(!o)o=new WeakMap,r.buckets.set(n,o);return o}var qe,Qe=[],Oc={alloc(r,n,o){let i=qe;if(!i)return o;qe=void 0;let s={value:o,issues:null};return i.set(n.value,s),Qe.push(s),o},guard(r){var n;(n=r._zod).deferred??(n.deferred=[]),r._zod.deferred.push(()=>{let o=r._zod.parse,i=(s,c)=>{if(c.direction!=="backward"&&Ec(c,s.value))throw new jo;return o(s,c)};if(r._zod.parse=i,r._zod.run===o)r._zod.run=i})},attach(r){var n;let o,i=!1,s,c;(n=r._zod).deferred??(n.deferred=[]),r._zod.deferred.push(()=>{let u=r._zod.parse,a=(l,p)=>{if(o===void 0){let I=tt(r,new Set,!1);if(I===$e){if(r._zod.parse=u,r._zod.run===a)r._zod.run=u;return u(l,p)}if(I===ze||i)o=!0;else i=!0}let f=l.value;if(!Do(f))return u(l,p);let m=p[Nt];if(!m)m={buckets:new WeakMap,backEdges:void 0},p[Nt]=m;let h;if(s===p)h=c;else h=Pc(m,r),s=p,c=h;let g=h.get(f);if(g){if(l.value=g.value,g.issues){if(g.issues.length)l.issues.push(...Ct(g.issues))}else l.memo=!0,m.backEdges??(m.backEdges=new WeakSet),m.backEdges.add(g.value);return l}qe=h;let _=Qe.length,b=u(l,p);qe=void 0;let x=Qe.length>_?Qe.pop():void 0;if(b instanceof Promise)return b.then((I)=>{if(x)x.issues=I.issues.length?Ct(I.issues):Ro;return I});if(x)x.issues=b.issues.length?Ct(b.issues):Ro;return b};if(r._zod.parse=a,r._zod.run===u)r._zod.run=a})}};function Uo(){return Oc}function Ec(r,n){let o=r[Nt]?.backEdges;return o!==void 0&&Do(n)&&o.has(n)}var Ic=()=>{let r={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function n(c){return r[c]??null}let o={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};function s(c,u){if(c==="number"&&typeof u==="number"&&!Number.isFinite(u))return String(u);return i[c]??c}return(c)=>{switch(c.code){case"invalid_type":{let u=s(c.expected),a=kr(c.input),l=s(a,c.input);return`Invalid input: expected ${u}, received ${l}`}case"invalid_value":if(c.values.length===1)return`Invalid input: expected ${_t(c.values[0])}`;return`Invalid option: expected one of ${mt(c.values,"|")}`;case"too_big":{let u=c.exact?"exactly ":c.inclusive?"<=":"<",a=n(c.origin);if(a)return`Too big: expected ${c.origin??"value"} to have ${u}${c.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${c.origin??"value"} to be ${u}${c.maximum.toString()}`}case"too_small":{let u=c.exact?"exactly ":c.inclusive?">=":">",a=n(c.origin);if(a)return`Too small: expected ${c.origin} to have ${u}${c.minimum.toString()} ${a.unit}`;return`Too small: expected ${c.origin} to be ${u}${c.minimum.toString()}`}case"invalid_format":{let u=c;if(u.format==="starts_with")return`Invalid string: must start with "${u.prefix}"`;if(u.format==="ends_with")return`Invalid string: must end with "${u.suffix}"`;if(u.format==="includes")return`Invalid string: must include "${u.includes}"`;if(u.format==="regex")return`Invalid string: must match pattern ${u.pattern}`;return`Invalid ${o[u.format]??c.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${c.divisor}`;case"unrecognized_keys":return`Unrecognized key${c.keys.length>1?"s":""}: ${mt(c.keys,", ")}`;case"invalid_key":return`Invalid key in ${c.origin}`;case"invalid_union":if(c.options&&Array.isArray(c.options)&&c.options.length>0)return`Invalid discriminator value. Expected ${c.options.map((a)=>`'${a}'`).join(" | ")}`;if(c.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${c.origin}`;default:return"Invalid input"}}};function Rt(){return{localeError:Ic()}}var Fo;class Mo{constructor(){this._map=new WeakMap,this._idmap=new Map}add(r,...n){let o=n[0];if(this._map.set(r,o),o&&typeof o==="object"&&"id"in o)this._idmap.set(o.id,r);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(r){let n=this._map.get(r);if(n&&typeof n==="object"&&"id"in n)this._idmap.delete(n.id);return this._map.delete(r),this}get(r){let n=r._zod.parent;if(n){let o={...this.get(n)??{}};delete o.id;let i={...o,...this._map.get(r)};return Object.keys(i).length?i:void 0}return this._map.get(r)}has(r){return this._map.has(r)}}function Ac(){return new Mo}(Fo=globalThis).__zod_globalRegistry??(Fo.__zod_globalRegistry=Ac());var ce=globalThis.__zod_globalRegistry;function Tc(r){if(r.checks)r.checks=[...r.checks];return r}function Jo(r,n){return new r(Tc({type:"string",...y(n)}))}function Bo(r,n){return new r({type:"string",format:"email",check:"string_format",abort:!1,...y(n)})}function Ko(r,n){return new r({type:"string",format:"guid",check:"string_format",abort:!1,...y(n)})}function Vo(r,n){return new r({type:"string",format:"uuid",check:"string_format",abort:!1,...y(n)})}function Wo(r,n){return new r({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...y(n)})}function Go(r,n){return new r({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...y(n)})}function Xo(r,n){return new r({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...y(n)})}function jt(r,n){return new r({type:"string",format:"url",check:"string_format",abort:!1,...y(n)})}function Yo(r,n){return new r({type:"string",format:"emoji",check:"string_format",abort:!1,...y(n)})}function Ho(r,n){return new r({type:"string",format:"nanoid",check:"string_format",abort:!1,...y(n)})}function qo(r,n){return new r({type:"string",format:"cuid",check:"string_format",abort:!1,...y(n)})}function Qo(r,n){return new r({type:"string",format:"cuid2",check:"string_format",abort:!1,...y(n)})}function ei(r,n){return new r({type:"string",format:"ulid",check:"string_format",abort:!1,...y(n)})}function ti(r,n){return new r({type:"string",format:"xid",check:"string_format",abort:!1,...y(n)})}function ri(r,n){return new r({type:"string",format:"ksuid",check:"string_format",abort:!1,...y(n)})}function ni(r,n){return new r({type:"string",format:"ipv4",check:"string_format",abort:!1,...y(n)})}function oi(r,n){return new r({type:"string",format:"ipv6",check:"string_format",abort:!1,...y(n)})}function ii(r,n){return new r({type:"string",format:"cidrv4",check:"string_format",abort:!1,...y(n)})}function si(r,n){return new r({type:"string",format:"cidrv6",check:"string_format",abort:!1,...y(n)})}function ci(r,n){return new r({type:"string",format:"base64",check:"string_format",abort:!1,...y(n)})}function ui(r,n){return new r({type:"string",format:"base64url",check:"string_format",abort:!1,...y(n)})}function ai(r,n){return new r({type:"string",format:"e164",check:"string_format",abort:!1,...y(n)})}function li(r,n){return new r({type:"string",format:"jwt",check:"string_format",abort:!1,...y(n)})}function rt(r,n){return new r({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...y(n)})}function nt(r,n){return new r({type:"string",format:"date",check:"string_format",...y(n)})}function ot(r,n){return new r({type:"string",format:"time",check:"string_format",precision:null,...y(n)})}function it(r,n){return new r({type:"string",format:"duration",check:"string_format",...y(n)})}function pi(r,n){return new r({type:"boolean",...y(n)})}function fi(r){return new r({type:"unknown"})}function di(r,n){return new r({type:"never",...y(n)})}function st(r,n){return new yn({check:"max_length",...y(n),maximum:r})}function le(r,n){return new xn({check:"min_length",...y(n),minimum:r})}function ct(r,n){return new bn({check:"length_equals",...y(n),length:r})}function Dt(r,n){return new vn({check:"string_format",format:"regex",...y(n),pattern:r})}function Lt(r){return new $n({check:"string_format",format:"lowercase",...y(r)})}function Ut(r){return new zn({check:"string_format",format:"uppercase",...y(r)})}function Ft(r,n){return new wn({check:"string_format",format:"includes",...y(n),includes:r})}function Mt(r,n){return new kn({check:"string_format",format:"starts_with",...y(n),prefix:r})}function Jt(r,n){return new Zn({check:"string_format",format:"ends_with",...y(n),suffix:r})}function re(r){return new Sn({check:"overwrite",tx:r})}function Bt(r){return re((n)=>n.normalize(r))}function Kt(){return re((r)=>r.trim())}function Vt(){return re((r)=>r.toLowerCase())}function Wt(){return re((r)=>r.toUpperCase())}function Gt(){return re((r)=>yr(r))}function mi(r,n,o){return new r({type:"array",element:n,...y(o)})}function hi(r,n,o){return new r({type:"custom",check:"custom",fn:n,...y(o)})}function gi(r,n){let o=Cc((i)=>(i.addIssue=(s)=>{if(typeof s==="string")i.issues.push(se(s,i.value,o._zod.def));else{let c=s;if(c.fatal)c.continue=!1;if(c.code??(c.code="custom"),!("input"in c))c.input=i.value;c.inst??(c.inst=o),c.continue??(c.continue=!o._zod.def.abort),i.issues.push(se(c))}},r(i.value,i)),n);return o}function Cc(r,n){let o=new L({check:"custom",...y(n)});return o._zod.check=r,o}function we(r,...n){for(let o of n)for(let i of Reflect.ownKeys(o))if(Object.prototype.propertyIsEnumerable.call(o,i))V(r,i,o[i]);return r}function Yt(r){let n=r?.target??"draft-2020-12";if(n==="draft-4")n="draft-04";if(n==="draft-7")n="draft-07";return{processors:r.processors??{},metadataRegistry:r?.metadata??ce,target:n,unrepresentable:r?.unrepresentable??"throw",override:r?.override??(()=>{}),io:r?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:r?.cycles??"ref",reused:r?.reused??"inline",intersections:[],deferred:[],external:r?.external??void 0}}function ne(r,n,o,i,s){let c=typeof n.unrepresentable==="function"?n.unrepresentable({zodSchema:r,path:i.path,message:s}):n.unrepresentable;if(c==="any")return!1;if(c===void 0||c==="throw")throw Error(s);return Object.assign(o,c),!0}function T(r,n,o={path:[],schemaPath:[]}){var i;let s=r._zod.def,c=n.seen.get(r);if(c){if(c.count++,o.schemaPath.includes(r))c.cycle=o.path;return c.schema}let u={schema:{},count:1,cycle:void 0,path:o.path};n.seen.set(r,u),n.sharedDefsExtractedFor=void 0,n.sharedEmitDoneFor=void 0;let a=r._zod.toJSONSchema?.();if(a)u.schema=a;else{let f={...o,schemaPath:[...o.schemaPath,r],path:o.path};if(r._zod.processJSONSchema)r._zod.processJSONSchema(n,u.schema,f);else{let h=u.schema,g=n.processors[s.type];if(!g)throw Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);g(r,n,h,f)}let m=r._zod.parent;if(m){if(!u.ref)u.ref=m;T(m,n,f),n.seen.get(m).isParent=!0}}let l=n.metadataRegistry.get(r);if(l)we(u.schema,l);if(n.io==="input"&&N(r))delete u.schema.examples,delete u.schema.default;if(n.io==="input"&&"_prefault"in u.schema)(i=u.schema).default??(i.default=u.schema._prefault);return delete u.schema._prefault,n.seen.get(r).schema}function _i(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}function Ht(r,n){let o=r.seen.get(n);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");if(r.external&&r.sharedDefsExtractedFor===r.external)return;let i=new Map;for(let u of r.seen.entries()){let a=r.metadataRegistry.get(u[0])?.id;if(a){let l=i.get(a);if(l&&l!==u[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(a,u[0])}}let s=(u)=>{let a=r.target==="draft-2020-12"?"$defs":"definitions";if(r.external){let m=r.external.registry.get(u[0])?.id,h=r.external.uri??((_)=>_);if(m)return{ref:h(m)};let g=u[1].defId??u[1].schema.id??`schema${r.counter++}`;return u[1].defId=g,{defId:g,ref:`${h("__shared")}#/${a}/${_i(g)}`}}let l="#",p=`${l}/${a}/`;if(u[1]===o&&!u[1].schema.id)return{ref:l};let f=u[1].schema.id??`__schema${r.counter++}`;return{defId:f,ref:p+_i(f)}},c=(u)=>{if(u[1].schema.$ref)return;let a=u[1],{ref:l,defId:p}=s(u);if(a.def={...a.schema},p)a.defId=p;let f=a.schema;for(let m in f)delete f[m];f.$ref=l};if(r.cycles==="throw")for(let u of r.seen.entries()){let a=u[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
57
|
+
|
|
58
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let u of r.seen.entries()){let a=u[1];if(n===u[0]){c(u);continue}if(r.external){let p=r.external.registry.get(u[0])?.id;if(n!==u[0]&&p){c(u);continue}}if(r.metadataRegistry.get(u[0])?.id){c(u);continue}if(a.cycle){c(u);continue}if(a.count>1){if(r.reused==="ref")c(u)}}if(r.external)r.sharedDefsExtractedFor=r.external}function bi(r){let n=r.anyOf;if(!Array.isArray(n)||n.length===0||r.type!==void 0)return;let o=[];for(let i of n){if(!i||typeof i!=="object")return;bi(i);let s=Object.keys(i);if(s.length!==1||s[0]!=="type")return;let c=i.type;for(let u of Array.isArray(c)?c:[c]){if(typeof u!=="string")return;if(!o.includes(u))o.push(u)}}delete r.anyOf,r.type=o.length===1?o[0]:o}var vi=new Set(["type","properties","required","additionalProperties"]),yi=["oneOf","anyOf"];function xi(r){let n=r.additionalProperties;if(n===void 0||n===!1||typeof n!=="object"||n===null)return null;return Object.keys(n).length?n:null}function Xt(r){let n=[];for(let c of r){if(typeof c!=="object"||c.type!=="object")return null;for(let u in c)if(!vi.has(u))return null;n.push(c)}let o={},i=new Set;for(let c of n){for(let u in c.properties){if(Object.prototype.hasOwnProperty.call(o,u))continue;let a=[];for(let p of n){let f=p.properties?.[u]??xi(p);if(f===null||f===void 0)continue;if(!a.some((m)=>JSON.stringify(m)===JSON.stringify(f)))a.push(f)}let l=a.length===1?a[0]:Xt(a)??{allOf:a};V(o,u,l)}for(let u of c.required??[])i.add(u)}let s={type:"object",properties:o};if(i.size)s.required=[...i];if(n.every((c)=>c.additionalProperties===!1))s.additionalProperties=!1;else{let c=[];for(let u of n){let a=xi(u);if(a&&!c.some((l)=>JSON.stringify(l)===JSON.stringify(a)))c.push(a)}if(c.length===1)s.additionalProperties=c[0];else if(c.length>1)s.additionalProperties={allOf:c}}return s}function Nc(r){let n=r.allOf;if(!Array.isArray(n)||n.length<2)return;for(let s of vi)if(s in r)return;let o=n.filter((s)=>yi.some((c)=>Array.isArray(s[c]))),i=null;if(!o.length)i=Xt(n);else{let s=o[0],c=yi.find((l)=>Array.isArray(s[l]));if(Object.keys(s).length!==1)return;let u=n.filter((l)=>l!==s),a=s[c].map((l)=>Xt([...u,l]));if(a.some((l)=>!l))return;i={[c]:a}}if(!i)return;delete r.allOf,we(r,i)}function qt(r,n){let o=r.seen.get(n);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");let i=(a)=>{let l=r.seen.get(a);if(l.ref===null)return;let p=l.def??l.schema,f={...p},m=l.ref;if(l.ref=null,m){i(m);let g=r.seen.get(m),_=g.schema;if(_.$ref&&(r.target==="draft-07"||r.target==="draft-04"||r.target==="openapi-3.0"))p.allOf=p.allOf??[],p.allOf.push(_);else we(p,_);if(we(p,f),a._zod.parent===m)for(let x in p){if(x==="$ref"||x==="allOf")continue;if(!(x in f))delete p[x]}if(_.$ref&&g.def)for(let x in p){if(x==="$ref"||x==="allOf")continue;if(x in g.def&&JSON.stringify(p[x])===JSON.stringify(g.def[x]))delete p[x]}}let h=a._zod.parent;if(h&&h!==m){i(h);let g=r.seen.get(h);if(g?.schema.$ref){if(p.$ref=g.schema.$ref,g.def)for(let _ in p){if(_==="$ref"||_==="allOf")continue;if(_ in g.def&&JSON.stringify(p[_])===JSON.stringify(g.def[_]))delete p[_]}}}r.override({zodSchema:a,jsonSchema:p,path:l.path??[]})};if(!r.external||r.sharedEmitDoneFor!==r.external){for(let a of[...r.seen.entries()].reverse())i(a[0]);if(r.target!=="openapi-3.0")for(let a of r.seen.entries())bi(a[1].def??a[1].schema);for(let a of r.deferred)a();if(r.intersections.length){let a=new Map;for(let l of r.seen.values())for(let p of[l.schema,l.def]){let f=p?.allOf;if(!Array.isArray(f))continue;let m=a.get(f);if(m)m.push(p);else a.set(f,[p])}for(let l of r.intersections)for(let p of a.get(l)??[])Nc(p)}}let s={};if(r.target==="draft-2020-12")s.$schema="https://json-schema.org/draft/2020-12/schema";else if(r.target==="draft-07")s.$schema="http://json-schema.org/draft-07/schema#";else if(r.target==="draft-04")s.$schema="http://json-schema.org/draft-04/schema#";else if(r.target==="openapi-3.0");if(r.external?.uri){let a=r.external.registry.get(n)?.id;if(!a)throw Error("Schema is missing an `id` property");s.$id=r.external.uri(a)}we(s,o.defId?o.schema:o.def??o.schema);let c=r.metadataRegistry.get(n)?.id;if(c!==void 0&&s.id===c)delete s.id;let u=r.external?.defs??{};if(!r.external||r.sharedEmitDoneFor!==r.external)for(let a of r.seen.entries()){let l=a[1];if(l.def&&l.defId){if(l.def.id===l.defId)delete l.def.id;V(u,l.defId,l.def)}}if(r.external)r.sharedEmitDoneFor=r.external;if(r.external);else if(Object.keys(u).length>0)if(r.target==="draft-2020-12")s.$defs=u;else s.definitions=u;try{let a=JSON.parse(JSON.stringify(s));return Object.defineProperty(a,"~standard",{value:{...n["~standard"],jsonSchema:{input:ke(n,"input",r.processors),output:ke(n,"output",r.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function N(r,n){let o=n??{seen:new Set};if(o.seen.has(r))return!1;o.seen.add(r);let i=r._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return N(i.element,o);if(i.type==="set")return N(i.valueType,o);if(i.type==="lazy")return N(i.getter(),o);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return N(i.innerType,o);if(i.type==="intersection")return N(i.left,o)||N(i.right,o);if(i.type==="record"||i.type==="map")return N(i.keyType,o)||N(i.valueType,o);if(i.type==="pipe"){if(r._zod.traits.has("$ZodCodec"))return!0;return N(i.in,o)||N(i.out,o)}if(i.type==="object"){for(let s in i.shape)if(N(i.shape[s],o))return!0;return!1}if(i.type==="union"){for(let s of i.options)if(N(s,o))return!0;return!1}if(i.type==="tuple"){for(let s of i.items)if(N(s,o))return!0;if(i.rest&&N(i.rest,o))return!0;return!1}return!1}var $i=(r,n={})=>(o)=>{let i=Yt({...o,processors:n});return T(r,i),Ht(i,r),qt(i,r)},ke=(r,n,o={})=>(i)=>{let{libraryOptions:s,target:c}=i??{},u=Yt({...s??{},target:c,io:n,processors:o});return T(r,u),Ht(u,r),qt(u,r)};var pe=(r,n,o)=>{if(r[n]===void 0||o>r[n])r[n]=o},fe=(r,n,o)=>{if(r[n]===void 0||o<r[n])r[n]=o},zi=(r,n)=>{pe(r,"minimum",n),fe(r,"maximum",n)},Si=(r,n)=>{if(r.multipleOf??(r.multipleOf=[]),!r.multipleOf.includes(n))r.multipleOf.push(n)},Pi=(r,n)=>{r.patterns??(r.patterns=new Set),r.patterns.add(n)},Oi=(r,n)=>{r.mime=r.mime?r.mime.filter((o)=>n.includes(o)):[...n]},Ei=(r,n)=>{if(r.format=n,n.includes("int"))r.isInt=!0},wi=(r,n)=>pe(r,"minimum",n.minimum),ki=(r,n)=>fe(r,"maximum",n.maximum),Zi=(r)=>(n,o)=>{Ei(n,o.format);let[i,s]=r[o.format];pe(n,"minimum",i),fe(n,"maximum",s)},Rc={greater_than:(r,n)=>pe(r,n.inclusive?"minimum":"exclusiveMinimum",n.value),less_than:(r,n)=>fe(r,n.inclusive?"maximum":"exclusiveMaximum",n.value),multiple_of:(r,n)=>Si(r,n.value),number_format:Zi(yt),bigint_format:Zi(xt),min_length:wi,max_length:ki,length_equals:(r,n)=>zi(r,n.length),min_size:wi,max_size:ki,size_equals:(r,n)=>zi(r,n.size),string_format:(r,n)=>{if(Ei(r,n.format),n.pattern)Pi(r,n.pattern);if(n.format==="base64"||n.format==="base64url")r.contentEncoding=n.format;if(n.local||n.precision===-1)r.laxFormat=!0},mime_type:(r,n)=>Oi(r,n.mime)};function de(r){let n={},o=r._zod.def,i=r._zod.traits.has("$ZodCheck")?[r,...o.checks??[]]:o.checks??[];for(let c of i)Rc[c._zod.def.check]?.(n,c._zod.def);let s=r._zod.bag;if(s.minimum!==void 0)pe(n,"minimum",s.minimum);if(s.exclusiveMinimum!==void 0)pe(n,"exclusiveMinimum",s.exclusiveMinimum);if(s.maximum!==void 0)fe(n,"maximum",s.maximum);if(s.exclusiveMaximum!==void 0)fe(n,"exclusiveMaximum",s.exclusiveMaximum);if(s.multipleOf!==void 0)Si(n,s.multipleOf);if(s.format!==void 0){if(n.format??(n.format=s.format),s.format.includes("int"))n.isInt=!0}if(s.mime)Oi(n,s.mime);for(let c of s.patterns??[])Pi(n,c);return n}var jc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Dc=new Map([[At,sn],[He,cn]]),Lc=(r)=>Dc.get(r)??r,Ii=(r,n,o,i)=>{let s=o;s.type="string";let{minimum:c,maximum:u,format:a,patterns:l,contentEncoding:p,laxFormat:f}=de(r);if(typeof c==="number")s.minLength=c;if(typeof u==="number")s.maxLength=u;if(a){if(s.format=jc[a]??a,s.format==="")delete s.format;if(a==="time"||f)delete s.format}if(p)s.contentEncoding=p;if(l&&l.size>0){let m=[...l].map(Lc);if(m.length===1)s.pattern=m[0].source;else if(m.length>1)s.allOf=[...m.map((h)=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))]}};var Ai=(r,n,o,i)=>{o.type="boolean"};var Ti=(r,n,o,i)=>{o.not={}};var Ci=(r,n,o,i)=>{};var Ni=(r,n,o,i)=>{let s=r._zod.def,c=ye(s.entries);if(c.length===0){o.not={};return}if(c.every((u)=>typeof u==="number"))o.type="number";if(c.every((u)=>typeof u==="string"))o.type="string";o.enum=c},Ri=(r,n,o,i)=>{let s=r._zod.def;if(s.values.length===0){o.not={};return}let c=[];for(let u of s.values)if(u===void 0){if(ne(r,n,o,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof u==="bigint"){if(ne(r,n,o,i,"BigInt literals cannot be represented in JSON Schema"))return;c.push(Number(u))}else c.push(u);if(c.length===0);else if(c.length===1){let u=c[0];if(o.type=u===null?"null":typeof u,n.target==="draft-04"||n.target==="openapi-3.0")o.enum=[u];else o.const=u}else{if(c.every((u)=>typeof u==="number"))o.type="number";if(c.every((u)=>typeof u==="string"))o.type="string";if(c.every((u)=>typeof u==="boolean"))o.type="boolean";if(c.every((u)=>u===null))o.type="null";o.enum=c}};var ji=(r,n,o,i)=>{ne(r,n,o,i,"Custom types cannot be represented in JSON Schema")};var Di=(r,n,o,i)=>{ne(r,n,o,i,"Transforms cannot be represented in JSON Schema")};var Li=(r,n,o,i)=>{let s=o,c=r._zod.def,{minimum:u,maximum:a}=de(r);if(typeof u==="number")s.minItems=u;if(typeof a==="number")s.maxItems=a;s.type="array",s.items=T(c.element,n,{...i,path:[...i.path,"items"]})};function Qt(r){let n=r._zod.def;if(n.type==="pipe"&&n.in._zod.traits.has("$ZodTransform"))return Qt(n.out);if(n.type==="catch")return Qt(n.innerType);return r._zod.optin}var Ui=(r,n,o,i)=>{let s=o,c=r._zod.def,u=c.shape;if(Object.getOwnPropertySymbols(u).length&&ne(r,n,s,i,"Symbol keys cannot be represented in JSON Schema"))return;s.type="object",s.properties={};for(let p in u)V(s.properties,p,T(u[p],n,{...i,path:[...i.path,"properties",p]}));let l=[];for(let p of Object.keys(u)){let f=c.shape[p];if(n.io==="input"?Qt(f)===void 0:f._zod.optout===void 0)l.push(p)}if(l.length>0)s.required=l;if(c.catchall?._zod.def.type==="never")s.additionalProperties=!1;else if(!c.catchall){if(n.io==="output")s.additionalProperties=!1}else if(c.catchall)s.additionalProperties=T(c.catchall,n,{...i,path:[...i.path,"additionalProperties"]})},Fi=(r,n,o,i)=>{let s=r._zod.def,c=s.inclusive===!1,u=s.options.map((a,l)=>T(a,n,{...i,path:[...i.path,c?"oneOf":"anyOf",l]}));if(c)o.oneOf=u;else o.anyOf=u},Mi=(r,n,o,i)=>{let s=r._zod.def,c=T(s.left,n,{...i,path:[...i.path,"allOf",0]}),u=T(s.right,n,{...i,path:[...i.path,"allOf",1]}),a=(p)=>("allOf"in p)&&Object.keys(p).length===1,l=[...a(c)?c.allOf:[c],...a(u)?u.allOf:[u]];o.allOf=l,n.intersections.push(l)};var Ji=(r,n,o,i)=>{let s=r._zod.def,c=T(s.innerType,n,i),u=n.seen.get(r);if(n.target==="openapi-3.0")u.ref=s.innerType,o.nullable=!0;else o.anyOf=[c,{type:"null"}]},Bi=(r,n,o,i)=>{let s=r._zod.def;T(s.innerType,n,i);let c=n.seen.get(r);c.ref=s.innerType},er=Symbol();function Ki(r,n,o,i,s){let c=!1,u=JSON.stringify(r,(a,l)=>{if(typeof l!=="bigint")return l;return c=!0,null});if(!c)return JSON.parse(u);return ne(n,o,i,s,"BigInt defaults cannot be represented in JSON Schema"),er}var Vi=(r,n,o,i)=>{let s=r._zod.def;T(s.innerType,n,i);let c=n.seen.get(r);c.ref=s.innerType;let u=Ki(s.defaultValue,r,n,o,i);if(u!==er)o.default=u},Wi=(r,n,o,i)=>{let s=r._zod.def;T(s.innerType,n,i);let c=n.seen.get(r);if(c.ref=s.innerType,n.io!=="input")return;let u=Ki(s.defaultValue,r,n,o,i);if(u!==er)o._prefault=u},Gi=(r,n,o,i)=>{let s=r._zod.def;T(s.innerType,n,i);let c=n.seen.get(r);c.ref=s.innerType;let u;try{u=s.catchValue(void 0)}catch{ne(r,n,o,i,"Dynamic catch values are not supported in JSON Schema");return}o.default=u},Xi=(r,n,o,i)=>{let s=r._zod.def,c=s.in._zod.traits.has("$ZodTransform"),u=n.io==="input"?c?s.out:s.in:s.out;T(u,n,i);let a=n.seen.get(r);a.ref=u},Yi=(r,n,o,i)=>{let s=r._zod.def;T(s.innerType,n,i);let c=n.seen.get(r);c.ref=s.innerType,o.readOnly=!0};var tr=(r,n,o,i)=>{let s=r._zod.def;T(s.innerType,n,i);let c=n.seen.get(r);c.ref=s.innerType};var Hi=new WeakSet([Object.prototype,Error.prototype]);function ut(r,n,o){Object.defineProperty(r,n,{configurable:!0,enumerable:!1,get(){let i=o(this);return Object.defineProperty(this,n,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,n,{value:i,configurable:!0,writable:!0})}})}var Qc=(r,n)=>{Ar.init(r,n),r.name="ZodError";let o=Object.getPrototypeOf(r);if(Hi.has(o))return;Hi.add(o),ut(o,"format",(i)=>(s)=>Cr(i,s)),ut(o,"flatten",(i)=>(s)=>Tr(i,s)),ut(o,"addIssue",(i)=>(s)=>{i.issues.push(s),i.message=JSON.stringify(i.issues,xe,2)}),ut(o,"addIssues",(i)=>(s)=>{i.issues.push(...s),i.message=JSON.stringify(i.issues,xe,2)}),Object.defineProperty(o,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var U=d("ZodError",Qc,void 0,{Parent:Error});var qi=Me(U),Qi=Je(U),es=Be(U),ts=Ke(U),rs=Rr(U),ns=jr(U),os=Dr(U),is=Lr(U),ss=Ur(U),cs=Fr(U),us=Mr(U),as=Jr(U);function tu(){if(!D.localeError)J(Rt())}function or(){if(!D.memoizer)J({memoizer:Uo()})}var P=d("ZodType",(r,n)=>(tu(),S.init(r,n),r.def=n,r.type=n.type,r),{check(...r){let n=this.def;return this.clone(j(n,{checks:[...n.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return W(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(Vu(r,n))},superRefine(r,n){return this.check(Wu(r,n))},overwrite(r){return this.check(re(r))},optional(){return ls(this)},exactOptional(){return Tu(this)},nullable(){return ps(this)},nullish(){return ls(ps(this))},nonoptional(r){return Lu(this,r)},array(){return oe(this)},or(r){return gs([this,r])},and(r){return Pu(this,r)},transform(r){return fs(this,Au(r))},default(r){return Ru(this,r)},prefault(r){return Du(this,r)},catch(r){return Fu(this,r)},pipe(r){return fs(this,r)},readonly(){return Bu(this)},describe(r){let n=this.clone();return ce.add(n,{description:r}),n},meta(...r){if(r.length===0)return ce.get(this);let n=this.clone();return ce.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r,...n){return n.length===0?r(this):r(this,...n)},get "~standard"(){return Ue(this,"~standard",{...It(this),jsonSchema:{input:ke(this,"input"),output:ke(this,"output")}})},set "~standard"(r){H(this,"~standard",r)},parse:function r(n,o){return qi(this,n,o,{callee:r})},parseAsync:async function r(n,o){return await Qi(this,n,o,{callee:r})},safeParse(r,n){return es(this,r,n)},async safeParseAsync(r,n){return ts(this,r,n)},get spa(){return this?.safeParseAsync},set spa(r){H(this,"spa",r)},validate(r,n){return wt(this,r,n)},validateAsync(r,n){return kt(this,r,n)},encode:function r(n,o){return rs(this,n,o,{callee:r})},decode:function r(n,o){return ns(this,n,o,{callee:r})},encodeAsync:async function r(n,o){return await os(this,n,o,{callee:r})},decodeAsync:async function r(n,o){return await is(this,n,o,{callee:r})},safeEncode(r,n){return ss(this,r,n)},safeDecode(r,n){return cs(this,r,n)},async safeEncodeAsync(r,n){return us(this,r,n)},async safeDecodeAsync(r,n){return as(this,r,n)},toJSONSchema(r){return $i(this,{})(r)},get description(){return ce.get(this)?.description},get _def(){return this._zod.def}}),ds=d("_ZodString",(r,n)=>{Ye.init(r,n),P.init(r,n),r._zod.processJSONSchema=(o,i,s)=>Ii(r,o,i,s)},Hs({format:(r)=>de(r).format??null,minLength:(r)=>de(r).minimum??null,maxLength:(r)=>de(r).maximum??null},{regex(...r){return this.check(Dt(...r))},includes(...r){return this.check(Ft(...r))},startsWith(...r){return this.check(Mt(...r))},endsWith(...r){return this.check(Jt(...r))},min(...r){return this.check(le(...r))},max(...r){return this.check(st(...r))},length(...r){return this.check(ct(...r))},nonempty(...r){return this.check(le(1,...r))},lowercase(r){return this.check(Lt(r))},uppercase(r){return this.check(Ut(r))},trim(){return this.check(Kt())},normalize(...r){return this.check(Bt(...r))},toLowerCase(){return this.check(Vt())},toUpperCase(){return this.check(Wt())},slugify(){return this.check(Gt())}})),ru=d("ZodString",(r,n)=>{Ye.init(r,n),ds.init(r,n)},{email(r){return this.check(Bo(nu,r))},url(r){return this.check(jt(ms,r))},jwt(r){return this.check(li(xu,r))},emoji(r){return this.check(Yo(iu,r))},guid(r){return this.check(Ko(ou,r))},uuid(r){return this.check(Vo(at,r))},uuidv4(r){return this.check(Wo(at,r))},uuidv6(r){return this.check(Go(at,r))},uuidv7(r){return this.check(Xo(at,r))},nanoid(r){return this.check(Ho(su,r))},cuid(r){return this.check(qo(cu,r))},cuid2(r){return this.check(Qo(uu,r))},ulid(r){return this.check(ei(au,r))},base64(r){return this.check(ci(gu,r))},base64url(r){return this.check(ui(_u,r))},xid(r){return this.check(ti(lu,r))},ksuid(r){return this.check(ri(pu,r))},ipv4(r){return this.check(ni(fu,r))},ipv6(r){return this.check(oi(du,r))},cidrv4(r){return this.check(ii(mu,r))},cidrv6(r){return this.check(si(hu,r))},e164(r){return this.check(ai(yu,r))},datetime(r){return this.check(rt(Se,r))},date(r){return this.check(nt(Pe,r))},time(r){return this.check(ot(Oe,r))},duration(r){return this.check(it(Ee,r))}});function z(r){return Jo(ru,r)}var Z=d("ZodStringFormat",(r,n)=>{k.init(r,n),ds.init(r,n)}),Se=d("ZodISODateTime",(r,n)=>{eo.init(r,n),Z.init(r,n)}),Pe=d("ZodISODate",(r,n)=>{to.init(r,n),Z.init(r,n)}),Oe=d("ZodISOTime",(r,n)=>{ro.init(r,n),Z.init(r,n)}),Ee=d("ZodISODuration",(r,n)=>{no.init(r,n),Z.init(r,n)}),nu=d("ZodEmail",(r,n)=>{Jn.init(r,n),Z.init(r,n)});var ou=d("ZodGUID",(r,n)=>{Fn.init(r,n),Z.init(r,n)});var at=d("ZodUUID",(r,n)=>{Mn.init(r,n),Z.init(r,n)});var ms=d("ZodURL",(r,n)=>{Vn.init(r,n),Z.init(r,n)});function F(r){return jt(ms,{protocol:Ve,hostname:un,...y(r)})}var iu=d("ZodEmoji",(r,n)=>{Wn.init(r,n),Z.init(r,n)});var su=d("ZodNanoID",(r,n)=>{Gn.init(r,n),Z.init(r,n)});var cu=d("ZodCUID",(r,n)=>{Xn.init(r,n),Z.init(r,n)});var uu=d("ZodCUID2",(r,n)=>{Yn.init(r,n),Z.init(r,n)});var au=d("ZodULID",(r,n)=>{Hn.init(r,n),Z.init(r,n)});var lu=d("ZodXID",(r,n)=>{qn.init(r,n),Z.init(r,n)});var pu=d("ZodKSUID",(r,n)=>{Qn.init(r,n),Z.init(r,n)});var fu=d("ZodIPv4",(r,n)=>{oo.init(r,n),Z.init(r,n)});var du=d("ZodIPv6",(r,n)=>{so.init(r,n),Z.init(r,n)});var mu=d("ZodCIDRv4",(r,n)=>{co.init(r,n),Z.init(r,n)});var hu=d("ZodCIDRv6",(r,n)=>{uo.init(r,n),Z.init(r,n)});var gu=d("ZodBase64",(r,n)=>{lo.init(r,n),Z.init(r,n)});var _u=d("ZodBase64URL",(r,n)=>{po.init(r,n),Z.init(r,n)});var yu=d("ZodE164",(r,n)=>{fo.init(r,n),Z.init(r,n)});var xu=d("ZodJWT",(r,n)=>{mo.init(r,n),Z.init(r,n)});var bu=d("ZodBoolean",(r,n)=>{ho.init(r,n),P.init(r,n),r._zod.processJSONSchema=(o,i,s)=>Ai(r,o,i,s)});function hs(r){return pi(bu,r)}var vu=d("ZodUnknown",(r,n)=>{go.init(r,n),P.init(r,n),r._zod.processJSONSchema=(o,i,s)=>Ci(r,o,i,s)});function rr(){return fi(vu)}var $u=d("ZodNever",(r,n)=>{_o.init(r,n),P.init(r,n),r._zod.processJSONSchema=(o,i,s)=>Ti(r,o,i,s)});function zu(r){return di($u,r)}var wu=d("ZodArray",(r,n)=>{or(),yo.init(r,n),P.init(r,n),r._zod.processJSONSchema=(o,i,s)=>Li(r,o,i,s),r.element=n.element},{min(r,n){return this.check(le(r,n))},nonempty(r){return this.check(le(1,r))},max(r,n){return this.check(st(r,n))},length(r,n){return this.check(ct(r,n))},unwrap(){return this.element}});function oe(r,n){return mi(wu,r,n)}var ku=d("ZodObject",(r,n)=>{or(),vo.init(r,n),P.init(r,n),r._zod.processJSONSchema=(o,i,s)=>Ui(r,o,i,s),tc(r,"shape",(o)=>o._zod.def.shape,!1)},{keyof(){return ir(Object.keys(this._zod.def.shape))},catchall(r){return this.clone(j(this._zod.def,{catchall:r}))},passthrough(){return this.clone(j(this._zod.def,{catchall:rr()}))},loose(){return this.clone(j(this._zod.def,{catchall:rr()}))},strict(){return this.clone(j(this._zod.def,{catchall:zu()}))},strip(){return this.clone(j(this._zod.def,{catchall:void 0}))},extend(r){return Vs(this,r)},safeExtend(r){return Ws(this,r)},merge(r){return Gs(this,r)},pick(r){return Bs(this,r)},omit(r){return Ks(this,r)},partial(...r){return zr(_s,this,r[0])},exactPartial(...r){return zr(ys,this,r[0],"exactPartial")},required(...r){return Xs(xs,this,r[0])}});function C(r,n){let o={type:"object",shape:r??{},...y(n)};return new ku(o)}var Zu=d("ZodUnion",(r,n)=>{$o.init(r,n),P.init(r,n),r._zod.processJSONSchema=(o,i,s)=>Fi(r,o,i,s),r.options=n.options});function gs(r,n){return new Zu({type:"union",options:r,...y(n)})}var Su=d("ZodIntersection",(r,n)=>{zo.init(r,n),P.init(r,n),r._zod.processJSONSchema=(o,i,s)=>Mi(r,o,i,s)});function Pu(r,n){return new Su({type:"intersection",left:r,right:n})}var nr=d("ZodEnum",(r,n)=>{wo.init(r,n),P.init(r,n),r._zod.processJSONSchema=(i,s,c)=>Ni(r,i,s,c),r.enum=n.entries,r.options=[...r._zod.values];let o=new Set(Object.keys(n.entries));r.extract=(i,s)=>{let c={};for(let u of i)if(o.has(u))c[u]=n.entries[u];else throw Error(`Key ${u} not found in enum`);return new nr({...n,checks:[],...y(s),entries:c})},r.exclude=(i,s)=>{let c={...n.entries};for(let u of i)if(o.has(u))delete c[u];else throw Error(`Key ${u} not found in enum`);return new nr({...n,checks:[],...y(s),entries:c})}});function ir(r,n){let o=Array.isArray(r)?Object.fromEntries(r.map((i)=>[i,i])):r;return new nr({type:"enum",entries:o,...y(n)})}var Ou=d("ZodLiteral",(r,n)=>{ko.init(r,n),P.init(r,n),r._zod.processJSONSchema=(o,i,s)=>Ri(r,o,i,s),r.values=new Set(n.values),Object.defineProperty(r,"value",{get(){if(n.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function Eu(r,n){return new Ou({type:"literal",values:Array.isArray(r)?r:[r],...y(n)})}var Iu=d("ZodTransform",(r,n)=>{or(),Zo.init(r,n),P.init(r,n),r._zod.processJSONSchema=(o,i,s)=>Di(r,o,i,s),r._zod.parse=(o,i)=>{if(i.direction==="backward")throw new be(r.constructor.name);o.addIssue=(c)=>{if(typeof c==="string")o.issues.push(se(c,o.value,n));else{let u=c;if(u.fatal)u.continue=!1;if(u.code??(u.code="custom"),!("input"in u))u.input=o.value;u.inst??(u.inst=r),o.issues.push(se(u))}};let s=n.transform(o.value,o);if(s instanceof Promise)return s.then((c)=>(o.value=c,o));return o.value=s,o}});function Au(r){return new Iu({type:"transform",transform:r})}var _s=d("ZodOptional",(r,n)=>{Tt.init(r,n),P.init(r,n),r._zod.processJSONSchema=(o,i,s)=>tr(r,o,i,s),r.unwrap=()=>r._zod.def.innerType});function ls(r){return new _s({type:"optional",innerType:r})}var ys=d("ZodExactOptional",(r,n)=>{So.init(r,n),P.init(r,n),r._zod.processJSONSchema=(o,i,s)=>tr(r,o,i,s),r.unwrap=()=>r._zod.def.innerType});function Tu(r){return new ys({type:"optional",innerType:r})}var Cu=d("ZodNullable",(r,n)=>{Po.init(r,n),P.init(r,n),r._zod.processJSONSchema=(o,i,s)=>Ji(r,o,i,s),r.unwrap=()=>r._zod.def.innerType});function ps(r){return new Cu({type:"nullable",innerType:r})}var Nu=d("ZodDefault",(r,n)=>{Oo.init(r,n),P.init(r,n),r._zod.processJSONSchema=(o,i,s)=>Vi(r,o,i,s),r.unwrap=()=>r._zod.def.innerType,r.removeDefault=r.unwrap});function Ru(r,n){return new Nu({type:"default",innerType:r,get defaultValue(){return typeof n==="function"?n():gt(n)}})}var ju=d("ZodPrefault",(r,n)=>{Eo.init(r,n),P.init(r,n),r._zod.processJSONSchema=(o,i,s)=>Wi(r,o,i,s),r.unwrap=()=>r._zod.def.innerType});function Du(r,n){return new ju({type:"prefault",innerType:r,get defaultValue(){return typeof n==="function"?n():gt(n)}})}var xs=d("ZodNonOptional",(r,n)=>{Io.init(r,n),P.init(r,n),r._zod.processJSONSchema=(o,i,s)=>Bi(r,o,i,s),r.unwrap=()=>r._zod.def.innerType});function Lu(r,n){return new xs({type:"nonoptional",innerType:r,...y(n)})}var Uu=d("ZodCatch",(r,n)=>{Ao.init(r,n),P.init(r,n),r._zod.processJSONSchema=(o,i,s)=>Gi(r,o,i,s),r.unwrap=()=>r._zod.def.innerType,r.removeCatch=r.unwrap});function Fu(r,n){return new Uu({type:"catch",innerType:r,catchValue:typeof n==="function"?n:Sr(n)})}var Mu=d("ZodPipe",(r,n)=>{To.init(r,n),P.init(r,n),r._zod.processJSONSchema=(o,i,s)=>Xi(r,o,i,s),r.in=n.in,r.out=n.out});function fs(r,n){return new Mu({type:"pipe",in:r,out:n})}var Ju=d("ZodReadonly",(r,n)=>{Co.init(r,n),P.init(r,n),r._zod.processJSONSchema=(o,i,s)=>Yi(r,o,i,s),r.unwrap=()=>r._zod.def.innerType});function Bu(r){return new Ju({type:"readonly",innerType:r})}var Ku=d("ZodCustom",(r,n)=>{No.init(r,n),P.init(r,n),r._zod.processJSONSchema=(o,i,s)=>ji(r,o,i,s)});function Vu(r,n={}){return hi(Ku,r,n)}function Wu(r,n){return gi(r,n)}function Gu(r){return rt(Se,r)}function Xu(r){return nt(Pe,r)}function Yu(r){return ot(Oe,r)}function Hu(r){return it(Ee,r)}var O={Ok:0,ServiceError:1,UsageError:2,NotFound:3};class R extends Error{exitCode;constructor(r,n){super(r);this.name="CliError",this.exitCode=n}}var qu=ir(["upcoming","live","past"]),Qu=C({x:F().nullable(),bluesky:F().nullable(),linkedin:F().nullable()}),bs=C({slug:z(),name:z(),tagline:z(),url:F(),status:qu,startsAt:Ie.datetime(),endsAt:Ie.datetime(),timeZone:Eu("America/Los_Angeles"),venue:C({name:z().nullable(),address:z().nullable()}).nullable(),rsvpUrl:F().nullable(),recordingUrl:F().nullable(),isHackathon:hs(),curation:ir(["ours","shared"]),organizer:C({name:z(),url:F().nullable()}).nullable()}),vs=C({name:z(),title:z().nullable(),bio:z().nullable(),links:Qu}),$s=bs.extend({talks:oe(C({title:z(),description:z(),speakers:oe(vs)})),hosts:oe(C({name:z(),about:z()}))}),ea=vs.extend({talks:oe(C({title:z(),eventName:z(),eventSlug:z(),eventUrl:F(),date:Ie.datetime()}))}),zs=C({name:z(),oneLiner:z(),introduction:z(),mission:z(),history:z(),independence:z(),hosting:z(),links:C({website:F(),events:F(),discord:F(),codeOfConduct:F()})}),ws=C({events:oe(bs)}),ks=C({speakers:oe(ea)});function ta(r){return r.startsWith("No published event")}function Zs(r,n){let o=n instanceof Error&&n.name==="TimeoutError"?"timed out":n instanceof Error?n.message:String(n);return new R(`Could not reach ${r}: ${o}`,O.ServiceError)}var ra=C({isError:hs().optional(),content:oe(C({type:z(),text:z().optional()})),structuredContent:rr().optional()}),na=gs([C({result:ra}),C({error:C({message:z()})})]);function oa(r,n){if(!n.includes("text/event-stream"))return JSON.parse(r);let o=r.split(`
|
|
59
|
+
`).filter((i)=>i.startsWith("data:")).map((i)=>i.slice(5).trim()).join("");return JSON.parse(o)}function Ss({endpoint:r=Ae,fetch:n=globalThis.fetch}={}){async function o(i,s,c){let u;try{u=await n(r,{method:"POST",headers:{"content-type":"application/json",accept:"application/json, text/event-stream","mcp-protocol-version":"2025-06-18"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"tools/call",params:{name:i,arguments:s}}),signal:AbortSignal.timeout(20000)})}catch(m){throw Zs(r,m)}if(!u.ok)throw new R(`${r} answered ${u.status} ${u.statusText}`.trim(),O.ServiceError);let a;try{a=await u.text()}catch(m){throw Zs(r,m)}let l;try{l=na.parse(oa(a,u.headers.get("content-type")??""))}catch{throw new R(`Unexpected response from ${r}`,O.ServiceError)}if("error"in l)throw new R(l.error.message,O.ServiceError);let{result:p}=l;if(p.isError){let m=p.content.map((h)=>h.text??"").join(`
|
|
60
|
+
`);throw new R(m,ta(m)?O.NotFound:O.ServiceError)}let f=c.safeParse(p.structuredContent);if(!f.success)throw new R(`The ${i} response does not match the contract this CLI expects. Updating the CLI may fix this.`,O.ServiceError);return f.data}return{listEvents:async(i,s)=>(await o("list_events",{when:i,limit:s},ws)).events,getEvent:async(i)=>{try{return await o("get_event",{slug:i},$s)}catch(s){if(s instanceof R&&s.exitCode===O.NotFound)throw new R(`No published event has the slug "${i}". Run "${A} events --all" to find one.`,O.NotFound);throw s}},listSpeakers:async(i,s)=>(await o("list_speakers",i===void 0?{limit:s}:{query:i,limit:s},ks)).speakers,getCommunity:()=>o("get_community",{},zs)}}import{styleText as ia}from"util";function lt(r){return(n,o)=>r?ia(n,o,{validateStream:!1}):o}function Ps(r){if(r.curation!=="shared")return null;return r.organizer===null?"shared":`shared \xB7 by ${r.organizer.name}`}function sa(r){return r.venue?.name??r.venue?.address??null}function Os(r){let n=Object.fromEntries(new Intl.DateTimeFormat("en-US",{timeZone:r.timeZone,weekday:"short",month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}).formatToParts(new Date(r.startsAt)).map((o)=>[o.type,o.value]));return`${n.weekday}, ${n.month} ${n.day}, ${n.year}, ${n.hour}:${n.minute} ${n.dayPeriod} ${n.timeZoneName}`}function Es(r,n){let o=lt(n);if(r.length===0)return`No events found.
|
|
61
|
+
`;return r.map((i)=>{let s=i.status==="past"?"":` ${o("yellow",`[${i.status}]`)}`,c=sa(i),u=Ps(i);return[`${o("bold",i.name)}${s}${u?` ${o("dim",u)}`:""}`,` ${Os(i)}${c?` \xB7 ${c}`:""}`,i.rsvpUrl&&i.status!=="past"?` ${o("dim","rsvp")} ${i.rsvpUrl}`:null,` ${o("dim","slug")} ${i.slug}`].filter((a)=>a!==null).join(`
|
|
62
|
+
`)}).join(`
|
|
63
|
+
|
|
64
|
+
`)+`
|
|
65
|
+
`}function Is(r,n){let o=lt(n),i=Ps(r),s=[o("bold",r.name),r.tagline,...i===null?[]:[o("dim",i)],"",`${o("dim","when ")} ${Os(r)}`],c=[r.venue?.name,r.venue?.address].filter((u)=>Boolean(u)).filter((u,a,l)=>l.indexOf(u)===a).join(", ");if(c)s.push(`${o("dim","where")} ${c}`);if(r.rsvpUrl)s.push(`${o("dim","rsvp ")} ${r.rsvpUrl}`);if(r.recordingUrl)s.push(`${o("dim","video")} ${r.recordingUrl}`);if(s.push(`${o("dim","page ")} ${r.url}`),r.organizer?.url)s.push(`${o("dim","by ")} ${r.organizer.url}`);for(let u of r.talks){s.push("",o("bold",u.title));let a=u.speakers.map((l)=>l.title?`${l.name} (${l.title})`:l.name).join(", ");if(a)s.push(a);if(u.description)s.push(o("dim",u.description))}if(r.hosts.length>0)s.push("",`${o("dim","hosted by")} ${r.hosts.map((u)=>u.name).join(", ")}`);return s.join(`
|
|
66
|
+
`)+`
|
|
67
|
+
`}function As(r,n){let o=lt(n);if(r.length===0)return`No speakers found.
|
|
68
|
+
`;return r.map((i)=>[i.title?`${o("bold",i.name)} \xB7 ${i.title}`:o("bold",i.name),...i.talks.map((s)=>` ${s.title} ${o("dim",`(${s.eventName})`)}`)].join(`
|
|
69
|
+
`)).join(`
|
|
70
|
+
|
|
71
|
+
`)+`
|
|
72
|
+
`}function Ts(r,n){let o=lt(n);return[o("bold",r.name),r.oneLiner,"",r.mission,"",`${o("dim","events ")} ${r.links.events}`,`${o("dim","discord")} ${r.links.discord}`,`${o("dim","website")} ${r.links.website}`,`${o("dim","conduct")} ${r.links.codeOfConduct}`,""].join(`
|
|
73
|
+
`)}var ua=`${A} \xB7 evenings for people who build software, from your terminal and your agents
|
|
74
|
+
|
|
75
|
+
Usage
|
|
76
|
+
${A} events [--past | --all] [--limit <n>] [--json]
|
|
77
|
+
${A} event <slug> [--json]
|
|
78
|
+
${A} speakers [search] [--limit <n>] [--json]
|
|
79
|
+
${A} rsvp <slug> [--print]
|
|
80
|
+
${A} about [--json]
|
|
81
|
+
|
|
82
|
+
Examples
|
|
83
|
+
${A} events What's coming up
|
|
84
|
+
${A} events --past --limit 5 The five most recent evenings
|
|
85
|
+
${A} event <slug> --json One evening in full, for scripts and agents
|
|
86
|
+
${A} speakers react Who has been on stage about react
|
|
87
|
+
${A} rsvp <slug> Open the evening's page to say you're in
|
|
88
|
+
|
|
89
|
+
Options
|
|
90
|
+
--json Print the public JSON contract instead of text
|
|
91
|
+
-h, --help Show this help
|
|
92
|
+
-v, --version Show the version
|
|
93
|
+
|
|
94
|
+
Exit codes: 0 ok, 1 service error, 2 usage error, 3 event not found.
|
|
95
|
+
Set ${lr} to use another server (default ${Ae}).
|
|
96
|
+
`;function q(r){throw new R(`${r}
|
|
97
|
+
Run "${A} --help" for usage.`,O.UsageError)}function Cs(r,n,o){if(r===void 0)return n;let i=Number(r);if(!Number.isInteger(i)||i<1||i>o)q(`--limit must be a whole number from 1 to ${o}.`);return i}var aa=`${ar} is now ${A}. The old name still works for now and goes away in a later release.
|
|
98
|
+
`;async function Ns(r,n){if(n.legacy===!0)n.stderr(aa);try{let o=(()=>{try{return ca({args:r,allowPositionals:!0,strict:!0,options:{json:{type:"boolean",default:!1},past:{type:"boolean",default:!1},all:{type:"boolean",default:!1},limit:{type:"string"},print:{type:"boolean",default:!1},help:{type:"boolean",short:"h",default:!1},version:{type:"boolean",short:"v",default:!1}}})}catch(f){return q(f instanceof Error?f.message:String(f))}})(),{values:i,positionals:s}=o,[c,...u]=s;if(i.version)return n.stdout(`${fr.version}
|
|
99
|
+
`),O.Ok;if(i.help||c===void 0||c==="help")return n.stdout(ua),O.Ok;let a=n.isTTY&&!n.env.NO_COLOR&&!i.json,l=n.client??Ss({endpoint:pr(n.env)}),p=(f,m)=>n.stdout(i.json?`${JSON.stringify(m,null,2)}
|
|
100
|
+
`:f);switch(c){case"events":{if(u.length>0)q('"events" takes no arguments.');if(i.past&&i.all)q("Use --past or --all, not both.");let f=i.all?"all":i.past?"past":"upcoming",m=await l.listEvents(f,Cs(i.limit,20,100));return p(Es(m,a),{events:m}),O.Ok}case"event":{let[f,...m]=u;if(f===void 0||m.length>0)q('"event" takes one event slug.');let h=await l.getEvent(f);return p(Is(h,a),h),O.Ok}case"speakers":{if(u.length>1)q('"speakers" takes at most one search term.');let f=await l.listSpeakers(u[0],Cs(i.limit,50,200));return p(As(f,a),{speakers:f}),O.Ok}case"rsvp":{let[f,...m]=u;if(f===void 0||m.length>0)q('"rsvp" takes one event slug.');let h=await l.getEvent(f);if(!h.rsvpUrl)throw new R(`${h.name} has no RSVP page.`,O.NotFound);if(n.stdout(`${h.rsvpUrl}
|
|
101
|
+
`),!i.print&&n.isTTY)await n.openUrl(h.rsvpUrl);return O.Ok}case"about":{if(u.length>0)q('"about" takes no arguments.');let f=await l.getCommunity();return p(Ts(f,a),f),O.Ok}default:return q(`Unknown command "${c}".`)}}catch(o){if(o instanceof R)return n.stderr(`${A}: ${o.message}
|
|
102
|
+
`),o.exitCode;return n.stderr(`${A}: ${o instanceof Error?o.message:String(o)}
|
|
103
|
+
`),O.ServiceError}}var la=process.platform==="darwin"?["open"]:process.platform==="win32"?["cmd","/c","start",""]:["xdg-open"];async function e(r){let n=await Ns(process.argv.slice(2),{stdout:(o)=>process.stdout.write(o),stderr:(o)=>process.stderr.write(o),isTTY:process.stdout.isTTY===!0,env:process.env,legacy:r,openUrl:async(o)=>{try{await Bun.spawn([...la,o],{stdout:"ignore",stderr:"ignore"}).exited}catch{return}}});process.exit(n)}
|
|
104
|
+
export{t,e};
|
package/dist/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "allthings",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "allthings from your terminal and your agents: the evenings, who is on stage and how to get in.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"allthings",
|
|
8
|
+
"events",
|
|
9
|
+
"meetups",
|
|
10
|
+
"san francisco",
|
|
11
|
+
"mcp",
|
|
12
|
+
"cli"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://allthings.dev",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/allthingsweb-dev/allthingsweb.git",
|
|
18
|
+
"directory": "cli"
|
|
19
|
+
},
|
|
20
|
+
"bugs": "https://github.com/allthingsweb-dev/allthingsweb/issues",
|
|
21
|
+
"type": "module",
|
|
22
|
+
"bin": {
|
|
23
|
+
"allthings": "./dist/index.js",
|
|
24
|
+
"atw": "./dist/atw.js"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"engines": {
|
|
30
|
+
"bun": ">=1.3"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "rm -rf dist && bun build src/index.ts src/atw.ts --target=bun --minify --splitting --outdir dist",
|
|
34
|
+
"prepack": "bun run build",
|
|
35
|
+
"fmt": "prettier --write .",
|
|
36
|
+
"check": "prettier --check .",
|
|
37
|
+
"typecheck": "tsc --noEmit",
|
|
38
|
+
"test": "bun test"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/bun": "^1.4.2",
|
|
42
|
+
"prettier": "^3.6.2",
|
|
43
|
+
"typescript": "7.0.2",
|
|
44
|
+
"zod": "^4.6.5"
|
|
45
|
+
}
|
|
46
|
+
}
|