@longzai-intelligence-oxlint/cli 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +55 -53
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import{createRequire as e}from"node:module";import{homedir as t}from"node:os";import{stripVTControlCharacters as n}from"node:util";import{existsSync as r,mkdirSync as i,readFileSync as a,writeFileSync as o}from"node:fs";import{join as s,resolve as c}from"node:path";import"node:url";import{AsyncLocalStorage as l}from"node:async_hooks";import u,{stdin as d,stdout as f}from"node:process";import p,*as m from"node:readline";import{Writable as h}from"node:stream";var g=Object.create,_=Object.defineProperty,v=Object.getOwnPropertyDescriptor,y=Object.getOwnPropertyNames,b=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty,S=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),C=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=y(t),a=0,o=i.length,s;a<o;a++)s=i[a],!x.call(e,s)&&s!==n&&_(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=v(t,s))||r.enumerable});return e},w=(e,t,n)=>(n=e==null?{}:g(b(e)),C(t||!e||!e.__esModule||!x.call(e,`default`)?_(n,`default`,{value:e,enumerable:!0}):n,e)),T=/* @__PURE__ */ e(import.meta.url),E=/* @__PURE__ */ S(((e,t)=>{let n=e=>e&&typeof e.message==`string`,r=e=>{if(!e)return;let t=e.cause;if(typeof t==`function`){let t=e.cause();return n(t)?t:void 0}return n(t)?t:void 0},i=(e,t)=>{if(!n(e))return``;let a=e.stack||``;if(t.has(e))return a+`
|
|
2
|
+
import{createRequire as e}from"node:module";import{homedir as t}from"node:os";import{stripVTControlCharacters as n}from"node:util";import{existsSync as r,mkdirSync as i,readFileSync as a,writeFileSync as o}from"node:fs";import{join as s,resolve as c}from"node:path";import"node:url";import{AsyncLocalStorage as l}from"node:async_hooks";import u,{stdin as d,stdout as f}from"node:process";import p,*as m from"node:readline";import{Writable as h}from"node:stream";var g=Object.create,_=Object.defineProperty,v=Object.getOwnPropertyDescriptor,y=Object.getOwnPropertyNames,b=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty,S=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),C=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=y(t),a=0,o=i.length,s;a<o;a++)s=i[a],!x.call(e,s)&&s!==n&&_(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=v(t,s))||r.enumerable});return e},w=(e,t,n)=>(n=e==null?{}:g(b(e)),C(t||!e||!e.__esModule||!x.call(e,`default`)?_(n,`default`,{value:e,enumerable:!0}):n,e)),T=/* @__PURE__ */ e(import.meta.url),E=/* @__PURE__ */ S(((e,t)=>{let n=e=>e&&typeof e.message==`string`,r=e=>{if(!e)return;let t=e.cause;if(typeof t==`function`){let t=e.cause();return n(t)?t:void 0}return n(t)?t:void 0},i=(e,t)=>{if(!n(e))return``;let a=e.stack||``;if(t.has(e))return a+`
|
|
3
3
|
causes have become circular...`;let o=r(e);return o?(t.add(e),a+`
|
|
4
4
|
caused by: `+i(o,t)):a},a=e=>i(e,/* @__PURE__ */ new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?``:e.message||``;if(t.has(e))return a+`: ...`;let s=r(e);if(s){t.add(e);let n=typeof e.cause==`function`;return a+(n?``:`: `)+o(s,t,n)}return a};t.exports={isErrorLike:n,getErrorCause:r,stackWithCauses:a,messageWithCauses:e=>o(e,/* @__PURE__ */ new Set)}})),D=/* @__PURE__ */ S(((e,t)=>{let n=Symbol(`circular-ref-tag`),r=Symbol(`pino-raw-err-ref`),i=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[r]},set:function(e){this[r]=e}}});Object.defineProperty(i,r,{writable:!0,value:{}}),t.exports={pinoErrProto:i,pinoErrorSymbols:{seen:n,rawSymbol:r}}})),O=/* @__PURE__ */ S(((e,t)=>{t.exports=l;let{messageWithCauses:n,stackWithCauses:r,isErrorLike:i}=E(),{pinoErrProto:a,pinoErrorSymbols:o}=D(),{seen:s}=o,{toString:c}=Object.prototype;function l(e){if(!i(e))return e;e[s]=void 0;let t=Object.create(a);t.type=c.call(e.constructor)===`[object Function]`?e.constructor.name:e.name,t.message=n(e),t.stack=r(e),Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(e=>l(e)));for(let n in e)if(t[n]===void 0){let r=e[n];i(r)?n!==`cause`&&!Object.prototype.hasOwnProperty.call(r,s)&&(t[n]=l(r)):t[n]=r}return delete e[s],t.raw=e,t}})),k=/* @__PURE__ */ S(((e,t)=>{t.exports=s;let{isErrorLike:n}=E(),{pinoErrProto:r,pinoErrorSymbols:i}=D(),{seen:a}=i,{toString:o}=Object.prototype;function s(e){if(!n(e))return e;e[a]=void 0;let t=Object.create(r);t.type=o.call(e.constructor)===`[object Function]`?e.constructor.name:e.name,t.message=e.message,t.stack=e.stack,Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(e=>s(e))),n(e.cause)&&!Object.prototype.hasOwnProperty.call(e.cause,a)&&(t.cause=s(e.cause));for(let r in e)if(t[r]===void 0){let i=e[r];n(i)?Object.prototype.hasOwnProperty.call(i,a)||(t[r]=s(i)):t[r]=i}return delete e[a],t.raw=e,t}})),A=/* @__PURE__ */ S(((e,t)=>{t.exports={mapHttpRequest:a,reqSerializer:i};let n=Symbol(`pino-raw-req-ref`),r=Object.create({},{id:{enumerable:!0,writable:!0,value:``},method:{enumerable:!0,writable:!0,value:``},url:{enumerable:!0,writable:!0,value:``},query:{enumerable:!0,writable:!0,value:``},params:{enumerable:!0,writable:!0,value:``},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:``},remotePort:{enumerable:!0,writable:!0,value:``},raw:{enumerable:!1,get:function(){return this[n]},set:function(e){this[n]=e}}});Object.defineProperty(r,n,{writable:!0,value:{}});function i(e){let t=e.info||e.socket,n=Object.create(r);if(n.id=typeof e.id==`function`?e.id():e.id||(e.info?e.info.id:void 0),n.method=e.method,e.originalUrl)n.url=e.originalUrl;else{let t=e.path;n.url=typeof t==`string`?t:e.url?e.url.path||e.url:void 0}return e.query&&(n.query=e.query),e.params&&(n.params=e.params),n.headers=e.headers,n.remoteAddress=t&&t.remoteAddress,n.remotePort=t&&t.remotePort,n.raw=e.raw||e,n}function a(e){return{req:i(e)}}})),j=/* @__PURE__ */ S(((e,t)=>{t.exports={mapHttpResponse:a,resSerializer:i};let n=Symbol(`pino-raw-res-ref`),r=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:``},raw:{enumerable:!1,get:function(){return this[n]},set:function(e){this[n]=e}}});Object.defineProperty(r,n,{writable:!0,value:{}});function i(e){let t=Object.create(r);return t.statusCode=e.headersSent?e.statusCode:null,t.headers=e.getHeaders?e.getHeaders():e._headers,t.raw=e,t}function a(e){return{res:i(e)}}})),ee=/* @__PURE__ */ S(((e,t)=>{let n=O(),r=k(),i=A(),a=j();t.exports={err:n,errWithCause:r,mapHttpRequest:i.mapHttpRequest,mapHttpResponse:a.mapHttpResponse,req:i.reqSerializer,res:a.resSerializer,wrapErrorSerializer:function(e){return e===n?e:function(t){return e(n(t))}},wrapRequestSerializer:function(e){return e===i.reqSerializer?e:function(t){return e(i.reqSerializer(t))}},wrapResponseSerializer:function(e){return e===a.resSerializer?e:function(t){return e(a.resSerializer(t))}}}})),M=/* @__PURE__ */ S(((e,t)=>{let n=T(`node:util`),r=n.getCallSites??n.getCallSite;function i(e,t){return t}t.exports=function(){if(r)return r().slice(2).map(e=>e.scriptName);let e=Error.prepareStackTrace;Error.prepareStackTrace=i;let t=(/* @__PURE__ */ Error()).stack;if(Error.prepareStackTrace=e,!Array.isArray(t))return;let n=t.slice(2),a=[];for(let e of n)e&&a.push(e.getFileName());return a}})),te=/* @__PURE__ */ S(((e,t)=>{function n(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array){let t=[];for(let r=0;r<e.length;r++)t[r]=n(e[r]);return t}if(typeof e==`object`){let t=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=n(e[r]));return t}return e}function r(e){let t=[],n=``,r=!1,i=!1,a=``;for(let o=0;o<e.length;o++){let s=e[o];!r&&s===`.`?n&&=(t.push(n),``):s===`[`?(n&&=(t.push(n),``),r=!0):s===`]`&&r?(t.push(n),n=``,r=!1,i=!1):(s===`"`||s===`'`)&&r?i?s===a?(i=!1,a=``):n+=s:(i=!0,a=s):n+=s}return n&&t.push(n),t}function i(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){let n=t[e];if(typeof r!=`object`||!r||!(n in r)||typeof r[n]!=`object`||r[n]===null)return!1;r=r[n]}let i=t[t.length-1];if(i===`*`){if(Array.isArray(r))for(let e=0;e<r.length;e++)r[e]=n;else if(typeof r==`object`&&r)for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(r[e]=n)}else typeof r==`object`&&r&&i in r&&Object.prototype.hasOwnProperty.call(r,i)&&(r[i]=n);return!0}function a(e,t){let n=e;for(let e=0;e<t.length-1;e++){let r=t[e];if(typeof n!=`object`||!n||!(r in n)||typeof n[r]!=`object`||n[r]===null)return!1;n=n[r]}let r=t[t.length-1];if(r===`*`){if(Array.isArray(n))for(let e=0;e<n.length;e++)n[e]=void 0;else if(typeof n==`object`&&n)for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&delete n[e]}else typeof n==`object`&&n&&r in n&&Object.prototype.hasOwnProperty.call(n,r)&&delete n[r];return!0}let o=Symbol(`PATH_NOT_FOUND`);function s(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||!n||!(e in n))return o;n=n[e]}return n}function c(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||!n)return;n=n[e]}return n}function l(e,t,n,c=!1){for(let l of t){let t=r(l);if(t.includes(`*`))u(e,t,n,l,c);else if(c)a(e,t);else{let r=s(e,t);if(r===o)continue;i(e,t,typeof n==`function`?n(r,t):n)}}}function u(e,t,n,r,i=!1){let a=t.indexOf(`*`);if(a===t.length-1){let r=t.slice(0,-1),a=e;for(let e of r){if(typeof a!=`object`||!a||!a)return;a=a[e]}if(Array.isArray(a)){if(i)for(let e=0;e<a.length;e++)a[e]=void 0;else for(let e=0;e<a.length;e++){let t=[...r,e.toString()],i=typeof n==`function`?n(a[e],t):n;a[e]=i}}else if(typeof a==`object`&&a){if(i){let e=[];for(let t in a)Object.prototype.hasOwnProperty.call(a,t)&&e.push(t);for(let t of e)delete a[t]}else for(let e in a){let t=[...r,e],i=typeof n==`function`?n(a[e],t):n;a[e]=i}}}else d(e,t,n,a,r,i)}function d(e,t,n,r,o,s=!1){let l=t.slice(0,r),d=t.slice(r+1),f=[];function p(e,t){if(t===l.length){if(Array.isArray(e))for(let n=0;n<e.length;n++)f[t]=n.toString(),p(e[n],t+1);else if(typeof e==`object`&&e)for(let n in e)f[t]=n,p(e[n],t+1)}else if(t<l.length){let n=l[t];e&&typeof e==`object`&&e&&n in e&&(f[t]=n,p(e[n],t+1))}else if(d.includes(`*`))u(e,d,typeof n==`function`?(e,r)=>n(e,[...f.slice(0,t),...r]):n,o,s);else if(s)a(e,d);else{let r=typeof n==`function`?n(c(e,d),[...f.slice(0,t),...d]):n;i(e,d,r)}}if(l.length===0)p(e,0);else{let t=e;for(let e=0;e<l.length;e++){let n=l[e];if(typeof t!=`object`||!t||!t)return;t=t[n],f[e]=n}t!=null&&p(t,l.length)}}function f(e){if(e.length===0)return null;let t=/* @__PURE__ */ new Map;for(let n of e){let e=r(n),i=t;for(let t=0;t<e.length;t++){let n=e[t];i.has(n)||i.set(n,/* @__PURE__ */ new Map),i=i.get(n)}}return t}function p(e,t){if(!t)return e;function n(e,t,r=0){if(!t||t.size===0||typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let r=[];for(let i=0;i<e.length;i++){let a=i.toString();t.has(a)||t.has(`*`)?r[i]=n(e[i],t.get(a)||t.get(`*`)):r[i]=e[i]}return r}let i=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=t.has(r)||t.has(`*`)?n(e[r],t.get(r)||t.get(`*`)):e[r]);return i}return n(e,t)}function m(e){if(typeof e!=`string`)throw Error(`Paths must be (non-empty) strings`);if(e===``)throw Error(`Invalid redaction path ()`);if(e.includes(`..`)||e.includes(`,`))throw Error(`Invalid redaction path (${e})`);let t=0,n=!1,r=``;for(let i=0;i<e.length;i++){let a=e[i];if((a===`"`||a===`'`)&&t>0)n?a===r&&(n=!1,r=``):(n=!0,r=a);else if(a===`[`&&!n)t++;else if(a===`]`&&!n&&(t--,t<0))throw Error(`Invalid redaction path (${e})`)}if(t!==0)throw Error(`Invalid redaction path (${e})`)}function h(e){if(!Array.isArray(e))throw TypeError(`paths must be an array`);for(let t of e)m(t)}function g(e={}){let{paths:t=[],censor:r=`[REDACTED]`,serialize:i=JSON.stringify,strict:a=!0,remove:o=!1}=e;h(t);let s=f(t);return function(e){if(a&&(typeof e!=`object`||!e)&&(typeof e!=`object`||!e))return i?i(e):e;let c=p(e,s),u=e,d=r;return typeof r==`function`&&(d=r),l(c,t,d,o),i===!1?(c.restore=function(){return n(u)},c):typeof i==`function`?i(c):JSON.stringify(c)}}t.exports=g})),N=/* @__PURE__ */ S(((e,t)=>{let n=Symbol(`pino.setLevel`),r=Symbol(`pino.getLevel`),i=Symbol(`pino.levelVal`),a=Symbol(`pino.levelComp`),o=Symbol(`pino.useLevelLabels`),s=Symbol(`pino.useOnlyCustomLevels`),c=Symbol(`pino.mixin`),l=Symbol(`pino.lsCache`),u=Symbol(`pino.chindings`),d=Symbol(`pino.asJson`),f=Symbol(`pino.write`),p=Symbol(`pino.redactFmt`),m=Symbol(`pino.time`),h=Symbol(`pino.timeSliceIndex`),g=Symbol(`pino.stream`),_=Symbol(`pino.stringify`),v=Symbol(`pino.stringifySafe`),y=Symbol(`pino.stringifiers`),b=Symbol(`pino.end`),x=Symbol(`pino.formatOpts`),S=Symbol(`pino.messageKey`),C=Symbol(`pino.errorKey`),w=Symbol(`pino.nestedKey`),T=Symbol(`pino.nestedKeyStr`),E=Symbol(`pino.mixinMergeStrategy`),D=Symbol(`pino.msgPrefix`),O=Symbol(`pino.wildcardFirst`),k=Symbol.for(`pino.serializers`),A=Symbol.for(`pino.formatters`),j=Symbol.for(`pino.hooks`);t.exports={setLevelSym:n,getLevelSym:r,levelValSym:i,levelCompSym:a,useLevelLabelsSym:o,mixinSym:c,lsCacheSym:l,chindingsSym:u,asJsonSym:d,writeSym:f,serializersSym:k,redactFmtSym:p,timeSym:m,timeSliceIndexSym:h,streamSym:g,stringifySym:_,stringifySafeSym:v,stringifiersSym:y,endSym:b,formatOptsSym:x,messageKeySym:S,errorKeySym:C,nestedKeySym:w,wildcardFirstSym:O,needsMetadataGsym:Symbol.for(`pino.metadata`),useOnlyCustomLevelsSym:s,formattersSym:A,hooksSym:j,nestedKeyStrSym:T,mixinMergeStrategySym:E,msgPrefixSym:D,transportUsesMultistreamSym:Symbol.for(`pino.transport.usesMultistream`)}})),ne=/* @__PURE__ */ S(((e,t)=>{let n=te(),{redactFmtSym:r,wildcardFirstSym:i}=N(),a=/[^.[\]]+|\[([^[\]]*?)\]/g,o=`[Redacted]`;function s(e,t){let{paths:o,censor:s,remove:l}=c(e),u=o.reduce((e,t)=>{a.lastIndex=0;let n=a.exec(t),r=a.exec(t),o=n[1]===void 0?n[0]:n[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,`$1`);if(o===`*`&&(o=i),r===null)return e[o]=null,e;if(e[o]===null)return e;let{index:s}=r,c=`${t.substr(s,t.length-1)}`;return e[o]=e[o]||[],o!==i&&e[o].length===0&&e[o].push(...e[i]||[]),o===i&&Object.keys(e).forEach(function(t){e[t]&&e[t].push(c)}),e[o].push(c),e},Object.create(null)),d=Object.assign(Object.create(null),{[r]:n({paths:o,censor:s,serialize:t,strict:!1,remove:l})}),f=(...e)=>t(typeof s==`function`?s(...e):s);return[...Object.keys(u),...Object.getOwnPropertySymbols(u)].reduce((e,r)=>{if(u[r]===null)e[r]=e=>f(e,[r]);else{let i=typeof s==`function`?(e,t)=>s(e,[r,...t]):s;e[r]=n({paths:u[r],censor:i,serialize:t,strict:!1,remove:l})}return e},d)}function c(e){if(Array.isArray(e))return e={paths:e,censor:o},e;let{paths:t,censor:n=o,remove:r}=e;if(Array.isArray(t)===!1)throw Error(`pino – redact must contain an array of strings`);return r===!0&&(n=void 0),{paths:t,censor:n,remove:r}}t.exports=s})),P=/* @__PURE__ */ S(((e,t)=>{let n=()=>``,r=()=>`,"time":${Date.now()}`,i=()=>`,"time":${Math.round(Date.now()/1e3)}`,a=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,o=1000000000n,s=BigInt(Date.now())*1000000n,c=process.hrtime.bigint();t.exports={nullTime:n,epochTime:r,unixTime:i,isoTime:a,isoTimeNano:()=>{let e=process.hrtime.bigint()-c,t=s+e,n=t/o,r=t%o,i=Number(n*1000n+r/1000000n),a=new Date(i);return`,"time":"${a.getUTCFullYear()}-${(a.getUTCMonth()+1).toString().padStart(2,`0`)}-${a.getUTCDate().toString().padStart(2,`0`)}T${a.getUTCHours().toString().padStart(2,`0`)}:${a.getUTCMinutes().toString().padStart(2,`0`)}:${a.getUTCSeconds().toString().padStart(2,`0`)}.${r.toString().padStart(9,`0`)}Z"`}}})),re=/* @__PURE__ */ S(((e,t)=>{function n(e){try{return JSON.stringify(e)}catch{return`"[Circular]"`}}t.exports=r;function r(e,t,r){var i=r&&r.stringify||n,a=1;if(typeof e==`object`&&e){var o=t.length+a;if(o===1)return e;var s=Array(o);s[0]=i(e);for(var c=1;c<o;c++)s[c]=i(t[c]);return s.join(` `)}if(typeof e!=`string`)return e;var l=t.length;if(l===0)return e;for(var u=``,d=1-a,f=-1,p=e&&e.length||0,m=0;m<p;){if(e.charCodeAt(m)===37&&m+1<p){switch(f=f>-1?f:0,e.charCodeAt(m+1)){case 100:case 102:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Number(t[d]),f=m+2,m++;break;case 105:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Math.floor(Number(t[d])),f=m+2,m++;break;case 79:case 111:case 106:if(d>=l||t[d]===void 0)break;f<m&&(u+=e.slice(f,m));var h=typeof t[d];if(h===`string`){u+=`'`+t[d]+`'`,f=m+2,m++;break}if(h===`function`){u+=t[d].name||`<anonymous>`,f=m+2,m++;break}u+=i(t[d]),f=m+2,m++;break;case 115:if(d>=l)break;f<m&&(u+=e.slice(f,m)),u+=String(t[d]),f=m+2,m++;break;case 37:f<m&&(u+=e.slice(f,m)),u+=`%`,f=m+2,m++,d--}++d}++m}return f===-1?e:(f<p&&(u+=e.slice(f)),u)}})),ie=/* @__PURE__ */ S(((e,t)=>{if(typeof SharedArrayBuffer<`u`&&typeof Atomics<`u`){let e=new Int32Array(new SharedArrayBuffer(4));function n(t){if(!(t>0&&t<1/0))throw typeof t!=`number`&&typeof t!=`bigint`?TypeError(`sleep: ms must be a number`):RangeError(`sleep: ms must be a number that is greater than 0 but less than Infinity`);Atomics.wait(e,0,0,Number(t))}t.exports=n}else{function e(e){if(!(e>0&&e<1/0))throw typeof e!=`number`&&typeof e!=`bigint`?TypeError(`sleep: ms must be a number`):RangeError(`sleep: ms must be a number that is greater than 0 but less than Infinity`);let t=Date.now()+Number(e);for(;t>Date.now(););}t.exports=e}})),ae=/* @__PURE__ */ S(((e,t)=>{let n=T(`fs`),r=T(`events`),i=T(`util`).inherits,a=T(`path`),o=ie(),s=T(`assert`),c=Buffer.allocUnsafe(0),l=`buffer`,u=`utf8`,[d,f]=(process.versions.node||`0.0`).split(`.`).map(Number),p=d>=22&&f>=7;function m(e,t){t._opening=!0,t._writing=!0,t._asyncDrainScheduled=!1;function r(n,r){if(n){t._reopening=!1,t._writing=!1,t._opening=!1,t.sync?process.nextTick(()=>{t.listenerCount(`error`)>0&&t.emit(`error`,n)}):t.emit(`error`,n);return}let i=t._reopening;t.fd=r,t.file=e,t._reopening=!1,t._opening=!1,t._writing=!1,t.sync?process.nextTick(()=>t.emit(`ready`)):t.emit(`ready`),!t.destroyed&&(!t._writing&&t._len>t.minLength||t._flushPending?t._actualWrite():i&&process.nextTick(()=>t.emit(`drain`)))}let i=t.append?`a`:`w`,o=t.mode;if(t.sync)try{t.mkdir&&n.mkdirSync(a.dirname(e),{recursive:!0}),r(null,n.openSync(e,i,o))}catch(e){throw r(e),e}else t.mkdir?n.mkdir(a.dirname(e),{recursive:!0},t=>{if(t)return r(t);n.open(e,i,o,r)}):n.open(e,i,o,r)}function h(e){if(!(this instanceof h))return new h(e);let{fd:t,dest:r,minLength:i,maxLength:a,maxWrite:s,periodicFlush:d,sync:f,append:p=!0,mkdir:v,retryEAGAIN:x,fsync:T,contentMode:A,mode:j}=e||{};t||=r,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(i||0,16387),this.file=null,this.destroyed=!1,this.minLength=i||0,this.maxLength=a||0,this.maxWrite=s||16384,this._periodicFlush=d||0,this._periodicFlushTimer=void 0,this.sync=f||!1,this.writable=!0,this._fsync=T||!1,this.append=p||!1,this.mode=j,this.retryEAGAIN=x||(()=>!0),this.mkdir=v||!1;let ee,M;if(A===l)this._writingBuf=c,this.write=b,this.flush=C,this.flushSync=E,this._actualWrite=O,ee=()=>n.writeSync(this.fd,this._writingBuf),M=()=>n.write(this.fd,this._writingBuf,this.release);else if(A===void 0||A===u)this._writingBuf=``,this.write=y,this.flush=S,this.flushSync=w,this._actualWrite=D,ee=()=>Buffer.isBuffer(this._writingBuf)?n.writeSync(this.fd,this._writingBuf):n.writeSync(this.fd,this._writingBuf,`utf8`),M=()=>Buffer.isBuffer(this._writingBuf)?n.write(this.fd,this._writingBuf,this.release):n.write(this.fd,this._writingBuf,`utf8`,this.release);else throw Error(`SonicBoom supports "${u}" and "${l}", but passed ${A}`);if(typeof t==`number`)this.fd=t,process.nextTick(()=>this.emit(`ready`));else if(typeof t==`string`)m(t,this);else throw Error(`SonicBoom supports only file descriptors and files`);if(this.minLength>=this.maxWrite)throw Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(e,t)=>{if(e){if((e.code===`EAGAIN`||e.code===`EBUSY`)&&this.retryEAGAIN(e,this._writingBuf.length,this._len-this._writingBuf.length)){if(this.sync)try{o(100),this.release(void 0,0)}catch(e){this.release(e)}else setTimeout(M,100)}else this._writing=!1,this.emit(`error`,e);return}this.emit(`write`,t);let r=g(this._writingBuf,this._len,t);if(this._len=r.len,this._writingBuf=r.writingBuf,this._writingBuf.length){if(!this.sync){M();return}try{do{let e=ee(),t=g(this._writingBuf,this._len,e);this._len=t.len,this._writingBuf=t.writingBuf}while(this._writingBuf.length)}catch(e){this.release(e);return}}this._fsync&&n.fsyncSync(this.fd);let i=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):i>this.minLength?this._actualWrite():this._ending?i>0?this._actualWrite():(this._writing=!1,k(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(_,this)):this.emit(`drain`))},this.on(`newListener`,function(e){e===`drain`&&(this._asyncDrainScheduled=!1)}),this._periodicFlush!==0&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref())}function g(e,t,n){return typeof e==`string`&&(e=Buffer.from(e)),t=Math.max(t-n,0),e=e.subarray(n),{writingBuf:e,len:t}}function _(e){e.listenerCount(`drain`)>0&&(e._asyncDrainScheduled=!1,e.emit(`drain`))}i(h,r);function v(e,t){return e.length===0?c:e.length===1?e[0]:Buffer.concat(e,t)}function y(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);e=``+e;let t=Buffer.byteLength(e),n=this._len+t,r=this._bufs;return this.maxLength&&n>this.maxLength?(this.emit(`drop`,e),this._len<this._hwm):(r.length===0||Buffer.byteLength(r[r.length-1])+t>this.maxWrite?r.push(e):r[r.length-1]+=e,this._len=n,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function b(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);let t=this._len+e.length,n=this._bufs,r=this._lens;return this.maxLength&&t>this.maxLength?(this.emit(`drop`,e),this._len<this._hwm):(n.length===0||r[r.length-1]+e.length>this.maxWrite?(n.push([e]),r.push(e.length)):(n[n.length-1].push(e),r[r.length-1]+=e.length),this._len=t,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function x(e){this._flushPending=!0;let t=()=>{if(this._fsync)this._flushPending=!1,e();else try{n.fsync(this.fd,t=>{this._flushPending=!1,e(t)})}catch(t){e(t)}this.off(`error`,r)},r=n=>{this._flushPending=!1,e(n),this.off(`drain`,t)};this.once(`drain`,t),this.once(`error`,r)}function S(e){if(e!=null&&typeof e!=`function`)throw Error(`flush cb must be a function`);if(this.destroyed){let t=/* @__PURE__ */ Error(`SonicBoom destroyed`);if(e){e(t);return}throw t}this.minLength<=0?e?.():(e&&x.call(this,e),!this._writing&&(this._bufs.length===0&&this._bufs.push(``),this._actualWrite()))}function C(e){if(e!=null&&typeof e!=`function`)throw Error(`flush cb must be a function`);if(this.destroyed){let t=/* @__PURE__ */ Error(`SonicBoom destroyed`);if(e){e(t);return}throw t}this.minLength<=0?e?.():(e&&x.call(this,e),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite()))}h.prototype.reopen=function(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this._opening){this.once(`ready`,()=>{this.reopen(e)});return}if(this._ending)return;if(!this.file)throw Error(`Unable to reopen a file descriptor, you must pass a file to SonicBoom`);if(e&&(this.file=e),this._reopening=!0,this._writing)return;let t=this.fd;this.once(`ready`,()=>{t!==this.fd&&n.close(t,e=>{if(e)return this.emit(`error`,e)})}),m(this.file,this)},h.prototype.end=function(){if(this.destroyed)throw Error(`SonicBoom destroyed`);this._opening?this.once(`ready`,()=>{this.end()}):this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?this._actualWrite():k(this)))};function w(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this.fd<0)throw Error(`sonic boom is not ready yet`);!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf=``);let e=``;for(;this._bufs.length||e.length;){e.length<=0&&(e=this._bufs[0]);try{let t=Buffer.isBuffer(e)?n.writeSync(this.fd,e):n.writeSync(this.fd,e,`utf8`),r=g(e,this._len,t);e=r.writingBuf,this._len=r.len,e.length<=0&&this._bufs.shift()}catch(t){if((t.code===`EAGAIN`||t.code===`EBUSY`)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;o(100)}}try{n.fsyncSync(this.fd)}catch{}}function E(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this.fd<0)throw Error(`sonic boom is not ready yet`);!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=c);let e=c;for(;this._bufs.length||e.length;){e.length<=0&&(e=v(this._bufs[0],this._lens[0]));try{let t=n.writeSync(this.fd,e);e=e.subarray(t),this._len=Math.max(this._len-t,0),e.length<=0&&(this._bufs.shift(),this._lens.shift())}catch(t){if((t.code===`EAGAIN`||t.code===`EBUSY`)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;o(100)}}}h.prototype.destroy=function(){this.destroyed||k(this)};function D(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:this._bufs.shift()||``,this.sync)try{e(null,Buffer.isBuffer(this._writingBuf)?n.writeSync(this.fd,this._writingBuf):n.writeSync(this.fd,this._writingBuf,`utf8`))}catch(t){e(t)}else n.write(this.fd,this._writingBuf,e)}function O(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:v(this._bufs.shift(),this._lens.shift()),this.sync)try{e(null,n.writeSync(this.fd,this._writingBuf))}catch(t){e(t)}else p&&(this._writingBuf=Buffer.from(this._writingBuf)),n.write(this.fd,this._writingBuf,e)}function k(e){if(e.fd===-1){e.once(`ready`,k.bind(null,e));return}e._periodicFlushTimer!==void 0&&clearInterval(e._periodicFlushTimer),e.destroyed=!0,e._bufs=[],e._lens=[],s(typeof e.fd==`number`,`sonic.fd must be a number, got ${typeof e.fd}`);try{n.fsync(e.fd,t)}catch{}function t(){e.fd!==1&&e.fd!==2?n.close(e.fd,r):r()}function r(t){t?e.emit(`error`,t):(e._ending&&!e._writing&&e.emit(`finish`),e.emit(`close`))}}h.SonicBoom=h,h.default=h,t.exports=h})),oe=/* @__PURE__ */ S(((e,t)=>{let n={exit:[],beforeExit:[]},r={exit:c,beforeExit:l},i;function a(){i===void 0&&(i=new FinalizationRegistry(d))}function o(e){n[e].length>0||process.on(e,r[e])}function s(e){n[e].length>0||(process.removeListener(e,r[e]),n.exit.length===0&&n.beforeExit.length===0&&(i=void 0))}function c(){u(`exit`)}function l(){u(`beforeExit`)}function u(e){for(let t of n[e]){let n=t.deref(),r=t.fn;
|
|
5
5
|
/* istanbul ignore else */
|
|
@@ -81,9 +81,11 @@ ${L.default.gray(yn+_n.repeat(a+2)+bn)}
|
|
|
81
81
|
`);process.stdout.write(I.cursor.move(-999,e.length-1)),process.stdout.write(I.erase.down(e.length))},g=e=>e.replace(/\.+$/,``),_=e=>{let t=(performance.now()-e)/1e3,n=Math.floor(t/60),r=Math.floor(t%60);return n>0?`[${n}m ${r}s]`:`[${r}s]`},v=(u=``)=>{o=!0,i=Zt(),s=g(u),l=performance.now(),process.stdout.write(`${L.default.gray(V)}
|
|
82
82
|
`);let d=0,f=0;p(),a=setInterval(()=>{if(r&&s===c)return;h(),c=s;let n=L.default.magenta(t[d]);if(r)process.stdout.write(`${n} ${s}...`);else if(e===`timer`)process.stdout.write(`${n} ${s} ${_(l)}`);else{let e=`.`.repeat(Math.floor(f)).slice(0,3);process.stdout.write(`${n} ${s}${e}`)}d=d+1<t.length?d+1:0,f=f<t.length?f+.125:0},n)},y=(t=``,n=0)=>{o=!1,clearInterval(a),h();let r=n===0?L.default.green(pn):n===1?L.default.red(dn):L.default.red(fn);s=g(t??s),e===`timer`?process.stdout.write(`${r} ${s} ${_(l)}
|
|
83
83
|
`):process.stdout.write(`${r} ${s}
|
|
84
|
-
`),m(),i()};return{start:v,stop:y,message:(e=``)=>{s=g(e??s)}}},Pn={red:e=>L.default.red(e),green:e=>L.default.green(e),yellow:e=>L.default.yellow(e),blue:e=>L.default.blue(e),cyan:e=>L.default.cyan(e),magenta:e=>L.default.magenta(e),gray:e=>L.default.gray(e),bold:e=>L.default.bold(e),dim:e=>L.default.dim(e)},Fn={async select(e,t){let n=await kn({message:e,options:t.map(e=>({value:e.value,label:e.label,hint:e.hint}))});return Yt(n)&&(jn(`操作已取消`),process.exit(0)),typeof n==`string`?n:String(n)},async textInput(e,t){let n=await Dn({message:e,placeholder:t?.placeholder,defaultValue:t?.defaultValue});return Yt(n)&&(jn(`操作已取消`),process.exit(0)),typeof n==`string`?n:String(n)},async confirm(e,t){let n=await On({message:e,initialValue:t?.defaultValue??!1});return Yt(n)&&(jn(`操作已取消`),process.exit(0)),typeof n==`boolean`?n:!!n},spinner(){let e=Nn();return{start(t){e.start(t)},stop(t){e.stop(t)}}},note(e,t){An(e,t)},log:{info(e){Mn.info(L.default.blue(e))},success(e){Mn.success(L.default.green(e))},warn(e){Mn.warn(L.default.yellow(e))},error(e){Mn.error(L.default.red(e))},step(e){Mn.step(e)}}};function In(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Ln(e,t=`|`){return e.map(e=>or(e)).join(t)}function Rn(e,t){return typeof t==`bigint`?t.toString():t}var zn=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Bn(e){return new zn(e)}function Vn(e){return e==null}function Hn(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Un(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Wn(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function Gn(e){return Wn(e._zod.def)??e._zod.def.shape}function Kn(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return Un(this,t,e),e},enumerable:!0,configurable:!0})}function qn(e,t,n){t in e?Un(e,t,n):e[t]=n}function Jn(e,t,n,r){let i=Gn(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?Kn(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):qn(e,a,r?r(n.value,a):n.value))}}function Yn(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Kn(e,n,()=>t[n]):qn(e,n,r.value))}}function H(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Xn(e){return JSON.stringify(e)}function Zn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const Qn=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function $n(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const er=/* @__PURE__*/ Bn(()=>{if(Jr.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function tr(e){if($n(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return $n(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function nr(e){return tr(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const rr=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]);function ir(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ar(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function U(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function or(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function sr(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}const cr={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},lr={int64:[/* @__PURE__*/ BigInt(`-9223372036854775808`),/* @__PURE__*/ BigInt(`9223372036854775807`)],uint64:[/* @__PURE__*/ BigInt(0),/* @__PURE__*/ BigInt(`18446744073709551615`)]};function ur(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return Jn(i,e,dr(e,t)),ar(e,H(n,{shape:i,checks:[]}))}function dr(e,t){let n=Gn(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function fr(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(dr(e,t)),a={};return Jn(a,e,Reflect.ownKeys(Gn(e)).filter(e=>!i.has(e))),ar(e,H(n,{shape:a,checks:[]}))}function pr(e,t){if(!tr(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=Gn(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ar(e,H(e._zod.def,{shape:mr(e,t)}))}function mr(e,t){let n={};return Jn(n,e,Reflect.ownKeys(Gn(e))),Yn(n,t),n}function hr(e,t){if(!tr(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return ar(e,H(e._zod.def,{shape:mr(e,t)}))}function gr(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return Jn(n,e,Reflect.ownKeys(Gn(e))),Jn(n,t,Reflect.ownKeys(Gn(t))),ar(e,H(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function _r(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(dr(t,n)):void 0,o={};return Jn(o,t,Reflect.ownKeys(Gn(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),ar(t,H(t._zod.def,{shape:o,checks:[]}))}function vr(e,t,n){let r=n?new Set(dr(t,n)):void 0,i={};return Jn(i,t,Reflect.ownKeys(Gn(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),ar(t,H(t._zod.def,{shape:i}))}function yr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function br(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function xr(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Sr(e){return typeof e==`string`?e:e?.message}function Cr(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function wr(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Tr(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Sr(e.inst?._zod.def?.error?.(e))??Sr(a?.(e))??Sr(t?.error?.(e))??Sr(n.customError?.(e))??Sr(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}const Er=/[\uD800-\uDBFF]/;function Dr(e){let t=e.length;if(!Er.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Or(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function kr(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Ar(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function jr(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Fr(e,n,r.value)}}function Mr(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Nr(e,t,n){return Mr(e,t,n,!1)}function Pr(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Mr(this,n,r(this))},set(e){Mr(this,n,e)}})}return t}function Fr(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Mr(this,t,n.bind(this))},set(e){Mr(this,t,e)}})}function Ir(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let Lr,Rr=!1;const zr={configurable:!0,get(){Rr=!0}};function W(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&Lr!==e._zod?Lr=void 0:(Lr=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,zr);let e=Rr;Rr=!1;try{let r=n(this);return Rr?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Rr||=e,r}catch(n){throw delete this[t],Rr||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function Br(e,t,n,r){let i=Ir(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}function Vr(e){let t=()=>e;return t[`~constantCatch`]=!0,t}var Hr;const Ur={value:void 0,enumerable:!1};let Wr=`captureStackTrace`in Error?Error:null;function Gr(e){let t=Wr;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Wr=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function G(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=/* @__PURE__ */ new Set}a.prototype=i;let o=n,s=o&&/* @__PURE__ */ new WeakSet;function c(n,r){if(!n._zod){Ur.value=new a(r);try{Object.defineProperty(n,"_zod",Ur)}finally{Ur.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),jr(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Gr(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Kr=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},qr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Hr=globalThis).__zod_globalConfig??(Hr.__zod_globalConfig={});const Jr=globalThis.__zod_globalConfig;function Yr(e){return e&&Object.assign(Jr,e),Jr}function Xr(){let e=this._zod;return e.message??=JSON.stringify(e.def,Rn,2),e.message}function Zr(e){this._zod.message=e}const Qr={get:Xr,set:Zr,enumerable:!0,configurable:!0},$r={value:void 0,enumerable:!1},ei=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]),ti=(e,t)=>{e.name=`$ZodError`,$r.value=t,Object.defineProperty(e,"issues",$r),$r.value=void 0,Object.defineProperty(e,"message",Qr);let n=Object.getPrototypeOf(e);ei.has(n)||(ei.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},ni=G(`$ZodError`,ti);G(`$ZodError`,ti,void 0,{Parent:Error});function ri(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function ii(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?ri(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ai(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function oi(e,t){return{callee:t?.callee??e,Err:t?.Err}}const si=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Kr;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Tr(e,o,Yr())));throw Qn(n,a?.callee??t),n}return s.value};return t},ci=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Tr(e,o,Yr())));throw Qn(n,a?.callee??t),n}return s.value};return t},li=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Kr;return a.issues.length?ui(e,a.issues,i):{success:!0,data:a.value}};function ui(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Tr(e,n,Yr()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}const di=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?ui(e,a.issues,i):{success:!0,data:a.value}},fi=/* @__PURE__ */ Symbol.for(`zod.compile.invalid`),pi=/* @__PURE__ */ Symbol.for(`zod.compile.fallback`),mi=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==fi)return!0;if(r.definite===!0&&n===void 0)return!1}return hi(e,t,n)});function hi(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[pi]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Kr;return a.issues.length===0}const gi=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},_i=e=>{let t=si(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,oi(n,a))};return n},vi=e=>{let t=si(e),n=(e,r,i,a)=>t(e,r,i,oi(n,a));return n},yi=e=>{let t=ci(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,oi(n,a))};return n},bi=e=>{let t=ci(e),n=async(e,r,i,a)=>await t(e,r,i,oi(n,a));return n},xi=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return li(e)(t,n,i)},Si=e=>(t,n,r)=>li(e)(t,n,r),Ci=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return di(e)(t,n,i)},wi=e=>async(t,n,r)=>di(e)(t,n,r),Ti=/^[cC][0-9a-z]{6,}$/,Ei=/^[0-9a-z]+$/,Di=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Oi=/^[0-9a-vA-V]{20}$/,ki=/^[A-Za-z0-9]{27}$/,Ai=/^[a-zA-Z0-9_-]{21}$/;function ji(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const Mi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ni=/^([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})$/,Pi=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Fi=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Ii(){return RegExp(`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,`u`)}const Li=/^(?:(?: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])$/,Ri=/^(([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}|:))$/,zi=/^((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])$/,Bi=/^(([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])$/,Vi=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Hi=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ui=/^https?$/,Wi=/^\+[1-9]\d{6,14}$/,Gi=`(?:(?:\\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 Ki(e){return RegExp(`^${e}$`)}const qi=/*@__PURE__*/ Ki(Gi);function Ji(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Yi(e){return RegExp(`^${Ji(e)}$`)}function Xi(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Ji({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Ji({precision:e.precision})}`:n;return RegExp(`^${Gi}T(?:${r})$`)}const Zi=/^[\s\S]{0,}$/,Qi=/^-?\d+$/,$i=/^-?\d+(?:\.\d+)?$/,ea=/^[^A-Z]*$/,ta=/^[^a-z]*$/,na=/*@__PURE__*/ G(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ra=e=>{let t=e.value;return!Vn(t)&&t.length!==void 0},ia=/*@__PURE__*/ G(`$ZodCheckMaxLength`,(e,t)=>{var n;na.init(e,t),(n=e._zod.def).when??(n.when=ra),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Dr(r):i)<=t.maximum)return;let a=Or(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),aa=/*@__PURE__*/ G(`$ZodCheckMinLength`,(e,t)=>{var n;na.init(e,t),(n=e._zod.def).when??(n.when=ra),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Dr(r):i)>=t.minimum)return;let a=Or(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),oa=/*@__PURE__*/ G(`$ZodCheckLengthEquals`,(e,t)=>{var n;na.init(e,t),(n=e._zod.def).when??(n.when=ra),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Dr(r):i;if(a===t.length)return;let o=Or(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),sa=/*@__PURE__*/ G(`$ZodCheckStringFormat`,(e,t)=>{var n,r;na.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ca=/*@__PURE__*/ G(`$ZodCheckRegex`,(e,t)=>{sa.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),la=/*@__PURE__*/ G(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ea,sa.init(e,t)}),ua=/*@__PURE__*/ G(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ta,sa.init(e,t)}),da=/*@__PURE__*/ G(`$ZodCheckIncludes`,(e,t)=>{na.init(e,t);let n=ir(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),fa=/*@__PURE__*/ G(`$ZodCheckStartsWith`,(e,t)=>{na.init(e,t);let n=RegExp(`^${ir(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),pa=/*@__PURE__*/ G(`$ZodCheckEndsWith`,(e,t)=>{na.init(e,t);let n=RegExp(`.*${ir(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),ma=/*@__PURE__*/ G(`$ZodCheckOverwrite`,(e,t)=>{na.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var ha=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
84
|
+
`),m(),i()};return{start:v,stop:y,message:(e=``)=>{s=g(e??s)}}},Pn={red:e=>L.default.red(e),green:e=>L.default.green(e),yellow:e=>L.default.yellow(e),blue:e=>L.default.blue(e),cyan:e=>L.default.cyan(e),magenta:e=>L.default.magenta(e),gray:e=>L.default.gray(e),bold:e=>L.default.bold(e),dim:e=>L.default.dim(e)},Fn={async select(e,t){let n=await kn({message:e,options:t.map(e=>({value:e.value,label:e.label,hint:e.hint}))});return Yt(n)&&(jn(`操作已取消`),process.exit(0)),typeof n==`string`?n:String(n)},async textInput(e,t){let n=await Dn({message:e,placeholder:t?.placeholder,defaultValue:t?.defaultValue});return Yt(n)&&(jn(`操作已取消`),process.exit(0)),typeof n==`string`?n:String(n)},async confirm(e,t){let n=await On({message:e,initialValue:t?.defaultValue??!1});return Yt(n)&&(jn(`操作已取消`),process.exit(0)),typeof n==`boolean`?n:!!n},spinner(){let e=Nn();return{start(t){e.start(t)},stop(t){e.stop(t)}}},note(e,t){An(e,t)},log:{info(e){Mn.info(L.default.blue(e))},success(e){Mn.success(L.default.green(e))},warn(e){Mn.warn(L.default.yellow(e))},error(e){Mn.error(L.default.red(e))},step(e){Mn.step(e)}}};function In(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Ln(e,t=`|`){return e.map(e=>or(e)).join(t)}function Rn(e,t){return typeof t==`bigint`?t.toString():t}var zn=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Bn(e){return new zn(e)}function Vn(e){return e==null}function Hn(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Un(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Wn(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function Gn(e){return Wn(e._zod.def)??e._zod.def.shape}function Kn(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return Un(this,t,e),e},enumerable:!0,configurable:!0})}function qn(e,t,n){t in e?Un(e,t,n):e[t]=n}function Jn(e,t,n,r){let i=Gn(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?Kn(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):qn(e,a,r?r(n.value,a):n.value))}}function Yn(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Kn(e,n,()=>t[n]):qn(e,n,r.value))}}function H(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Xn(e){return JSON.stringify(e)}function Zn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const Qn=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function $n(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const er=/* @__PURE__*/ Bn(()=>{if(Jr.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function tr(e){if($n(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return $n(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function nr(e){return tr(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const rr=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]);function ir(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ar(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function U(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function or(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function sr(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}const cr={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},lr={int64:[/* @__PURE__*/ BigInt(`-9223372036854775808`),/* @__PURE__*/ BigInt(`9223372036854775807`)],uint64:[/* @__PURE__*/ BigInt(0),/* @__PURE__*/ BigInt(`18446744073709551615`)]};function ur(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return Jn(i,e,dr(e,t)),ar(e,H(n,{shape:i,checks:[]}))}function dr(e,t){let n=Gn(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function fr(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(dr(e,t)),a={};return Jn(a,e,Reflect.ownKeys(Gn(e)).filter(e=>!i.has(e))),ar(e,H(n,{shape:a,checks:[]}))}function pr(e,t){if(!tr(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=Gn(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ar(e,H(e._zod.def,{shape:mr(e,t)}))}function mr(e,t){let n={};return Jn(n,e,Reflect.ownKeys(Gn(e))),Yn(n,t),n}function hr(e,t){if(!tr(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return ar(e,H(e._zod.def,{shape:mr(e,t)}))}function gr(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return Jn(n,e,Reflect.ownKeys(Gn(e))),Jn(n,t,Reflect.ownKeys(Gn(t))),ar(e,H(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function _r(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(dr(t,n)):void 0,o={};return Jn(o,t,Reflect.ownKeys(Gn(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),ar(t,H(t._zod.def,{shape:o,checks:[]}))}function vr(e,t,n){let r=n?new Set(dr(t,n)):void 0,i={};return Jn(i,t,Reflect.ownKeys(Gn(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),ar(t,H(t._zod.def,{shape:i}))}function yr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function br(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function xr(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Sr(e){return typeof e==`string`?e:e?.message}function Cr(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function wr(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Tr(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Sr(e.inst?._zod.def?.error?.(e))??Sr(a?.(e))??Sr(t?.error?.(e))??Sr(n.customError?.(e))??Sr(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}const Er=/[\uD800-\uDBFF]/;function Dr(e){let t=e.length;if(!Er.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Or(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function kr(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Ar(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function jr(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Fr(e,n,r.value)}}function Mr(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Nr(e,t,n){return Mr(e,t,n,!1)}/* @__NO_SIDE_EFFECTS__ */
|
|
85
|
+
function Pr(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Mr(this,n,r(this))},set(e){Mr(this,n,e)}})}return t}function Fr(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Mr(this,t,n.bind(this))},set(e){Mr(this,t,e)}})}function Ir(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let Lr,Rr=!1;const zr={configurable:!0,get(){Rr=!0}};function W(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&Lr!==e._zod?Lr=void 0:(Lr=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,zr);let e=Rr;Rr=!1;try{let r=n(this);return Rr?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Rr||=e,r}catch(n){throw delete this[t],Rr||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function Br(e,t,n,r){let i=Ir(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}function Vr(e){let t=()=>e;return t[`~constantCatch`]=!0,t}var Hr;const Ur={value:void 0,enumerable:!1};let Wr=`captureStackTrace`in Error?Error:null;function Gr(e){let t=Wr;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Wr=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}/* @__NO_SIDE_EFFECTS__ */
|
|
86
|
+
function G(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=/* @__PURE__ */ new Set}a.prototype=i;let o=n,s=o&&/* @__PURE__ */ new WeakSet;function c(n,r){if(!n._zod){Ur.value=new a(r);try{Object.defineProperty(n,"_zod",Ur)}finally{Ur.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),jr(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Gr(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Kr=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},qr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Hr=globalThis).__zod_globalConfig??(Hr.__zod_globalConfig={});const Jr=globalThis.__zod_globalConfig;function Yr(e){return e&&Object.assign(Jr,e),Jr}function Xr(){let e=this._zod;return e.message??=JSON.stringify(e.def,Rn,2),e.message}function Zr(e){this._zod.message=e}const Qr={get:Xr,set:Zr,enumerable:!0,configurable:!0},$r={value:void 0,enumerable:!1},ei=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]),ti=/* @__PURE__ */ G(`$ZodError`,(e,t)=>{e.name=`$ZodError`,$r.value=t,Object.defineProperty(e,"issues",$r),$r.value=void 0,Object.defineProperty(e,"message",Qr);let n=Object.getPrototypeOf(e);ei.has(n)||(ei.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function ni(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function ri(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?ni(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ii(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function ai(e,t){return{callee:t?.callee??e,Err:t?.Err}}const oi=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Kr;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Tr(e,o,Yr())));throw Qn(n,a?.callee??t),n}return s.value};return t},si=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Tr(e,o,Yr())));throw Qn(n,a?.callee??t),n}return s.value};return t},ci=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Kr;return a.issues.length?li(e,a.issues,i):{success:!0,data:a.value}};function li(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>Tr(e,n,Yr()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}const ui=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?li(e,a.issues,i):{success:!0,data:a.value}},di=/* @__PURE__ */ Symbol.for(`zod.compile.invalid`),fi=/* @__PURE__ */ Symbol.for(`zod.compile.fallback`),pi=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==di)return!0;if(r.definite===!0&&n===void 0)return!1}return mi(e,t,n)});function mi(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[fi]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Kr;return a.issues.length===0}const hi=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},gi=e=>{let t=oi(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,ai(n,a))};return n},_i=e=>{let t=oi(e),n=(e,r,i,a)=>t(e,r,i,ai(n,a));return n},vi=e=>{let t=si(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,ai(n,a))};return n},yi=e=>{let t=si(e),n=async(e,r,i,a)=>await t(e,r,i,ai(n,a));return n},bi=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ci(e)(t,n,i)},xi=e=>(t,n,r)=>ci(e)(t,n,r),Si=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ui(e)(t,n,i)},Ci=e=>async(t,n,r)=>ui(e)(t,n,r),wi=/^[cC][0-9a-z]{6,}$/,Ti=/^[0-9a-z]+$/,Ei=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Di=/^[0-9a-vA-V]{20}$/,Oi=/^[A-Za-z0-9]{27}$/,ki=/^[a-zA-Z0-9_-]{21}$/;function Ai(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const ji=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Mi=/^([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})$/,Ni=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Pi=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Fi(){return RegExp(`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,`u`)}const Ii=/^(?:(?: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])$/,Li=/^(([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}|:))$/,Ri=/^((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])$/,zi=/^(([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])$/,Bi=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Vi=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Hi=/^https?$/,Ui=/^\+[1-9]\d{6,14}$/,Wi=`(?:(?:\\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 Gi(e){return RegExp(`^${e}$`)}const Ki=/*@__PURE__*/ Gi(Wi);function qi(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ji(e){return RegExp(`^${qi(e)}$`)}function Yi(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${qi({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${qi({precision:e.precision})}`:n;return RegExp(`^${Wi}T(?:${r})$`)}const Xi=/^[\s\S]{0,}$/,Zi=/^-?\d+$/,Qi=/^-?\d+(?:\.\d+)?$/,$i=/^[^A-Z]*$/,ea=/^[^a-z]*$/,ta=/*@__PURE__*/ G(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),na=e=>{let t=e.value;return!Vn(t)&&t.length!==void 0},ra=/*@__PURE__*/ G(`$ZodCheckMaxLength`,(e,t)=>{var n;ta.init(e,t),(n=e._zod.def).when??(n.when=na),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Dr(r):i)<=t.maximum)return;let a=Or(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ia=/*@__PURE__*/ G(`$ZodCheckMinLength`,(e,t)=>{var n;ta.init(e,t),(n=e._zod.def).when??(n.when=na),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Dr(r):i)>=t.minimum)return;let a=Or(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),aa=/*@__PURE__*/ G(`$ZodCheckLengthEquals`,(e,t)=>{var n;ta.init(e,t),(n=e._zod.def).when??(n.when=na),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Dr(r):i;if(a===t.length)return;let o=Or(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),oa=/*@__PURE__*/ G(`$ZodCheckStringFormat`,(e,t)=>{var n,r;ta.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),sa=/*@__PURE__*/ G(`$ZodCheckRegex`,(e,t)=>{oa.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ca=/*@__PURE__*/ G(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=$i,oa.init(e,t)}),la=/*@__PURE__*/ G(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ea,oa.init(e,t)}),ua=/*@__PURE__*/ G(`$ZodCheckIncludes`,(e,t)=>{ta.init(e,t);let n=ir(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),da=/*@__PURE__*/ G(`$ZodCheckStartsWith`,(e,t)=>{ta.init(e,t);let n=RegExp(`^${ir(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),fa=/*@__PURE__*/ G(`$ZodCheckEndsWith`,(e,t)=>{ta.init(e,t);let n=RegExp(`.*${ir(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),pa=/*@__PURE__*/ G(`$ZodCheckOverwrite`,(e,t)=>{ta.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var ma=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
85
87
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
|
|
86
|
-
`)}\n};`)(...Object.values(this.closed))}};const ga={major:4,minor:6,patch:6},K=/*@__PURE__*/ G(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ga;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=yr(t),a;for(let o of n){if(o._zod.def.when){if(br(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Kr;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(wr(t.issues,n,e),i||=yr(t,n))});else{if(t.issues.length===n)continue;wr(t.issues,n,e),i||=yr(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(yr(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Kr;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Kr;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Nr(this,`~standard`,ya(this))},set"~standard"(e){Mr(this,`~standard`,e)}}),_a=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Tr(e,t,Yr()))}:{value:e.value};async function va(e,t){let n={async:!0};return _a(await e._zod.run({value:t,issues:[]},n),n)}function ya(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return _a(r,n)}catch{}return va(e,t)},vendor:`zod`,version:1}}const ba=/*@__PURE__*/ G(`$ZodString`,(e,t)=>{K.init(e,t),e._zod.pattern=t.pattern??Zi,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),q=/*@__PURE__*/ G(`$ZodStringFormat`,(e,t)=>{sa.init(e,t),ba.init(e,t)}),xa=/*@__PURE__*/ G(`$ZodGUID`,(e,t)=>{t.pattern??=Ni,q.init(e,t)}),Sa=/*@__PURE__*/ G(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Pi(e)}else t.pattern??=Pi();q.init(e,t)}),Ca=/*@__PURE__*/ G(`$ZodEmail`,(e,t)=>{t.pattern??=Fi,q.init(e,t)});function wa(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Ta(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?wa(e)||2:Ea(e,t)}function Ea(e,t){if(!t.normalize&&t.protocol?.source===Ui.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}const Da=/[\t\n\r]/g;function Oa(e){return e.replace(Da,``)}function ka(e,t){return t.lastIndex=0,t.test(e.hostname)}function Aa(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}const ja=/*@__PURE__*/ G(`$ZodURL`,(e,t)=>{q.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Ta(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Oa(r);return}t.hostname&&!ka(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Aa(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Oa(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Ma=/*@__PURE__*/ G(`$ZodEmoji`,(e,t)=>{t.pattern??=Ii(),q.init(e,t)}),Na=/*@__PURE__*/ G(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Ai:ji(t.length),q.init(e,t)}),Pa=/*@__PURE__*/ G(`$ZodCUID`,(e,t)=>{t.pattern??=Ti,q.init(e,t)}),Fa=/*@__PURE__*/ G(`$ZodCUID2`,(e,t)=>{t.pattern??=Ei,q.init(e,t)}),Ia=/*@__PURE__*/ G(`$ZodULID`,(e,t)=>{t.pattern??=Di,q.init(e,t)}),La=/*@__PURE__*/ G(`$ZodXID`,(e,t)=>{t.pattern??=Oi,q.init(e,t)}),Ra=/*@__PURE__*/ G(`$ZodKSUID`,(e,t)=>{t.pattern??=ki,q.init(e,t)}),za=/*@__PURE__*/ G(`$ZodISODateTime`,(e,t)=>{t.pattern??=Xi(t),q.init(e,t)}),Ba=/*@__PURE__*/ G(`$ZodISODate`,(e,t)=>{t.pattern??=qi,q.init(e,t)}),Va=/*@__PURE__*/ G(`$ZodISOTime`,(e,t)=>{t.pattern??=Yi(t),q.init(e,t)}),Ha=/*@__PURE__*/ G(`$ZodISODuration`,(e,t)=>{t.pattern??=Mi,q.init(e,t)}),Ua=/*@__PURE__*/ G(`$ZodIPv4`,(e,t)=>{t.pattern??=Li,q.init(e,t)}),Wa=/^[0-9a-fA-F:.]+$/;function Ga(e){return Wa.test(e)?wa(`http://[${e}]`):!1}const Ka=/*@__PURE__*/ G(`$ZodIPv6`,(e,t)=>{t.pattern??=Ri,q.init(e,t),e._zod.check=n=>{Ga(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),qa=/*@__PURE__*/ G(`$ZodCIDRv4`,(e,t)=>{t.pattern??=zi,q.init(e,t)});function Ja(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Ga(n)}const Ya=/*@__PURE__*/ G(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Bi,q.init(e,t),e._zod.check=n=>{Ja(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Xa(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Za=/^[0-9a-zA-Z+/]*={0,2}$/,Qa=/*@__PURE__*/ G(`$ZodBase64`,(e,t)=>{t.pattern??=Za,q.init(e,t),e._zod.check=n=>{Xa(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),$a=/^[A-Za-z0-9_-]*$/;function eo(e){if(!$a.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Xa(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const to=/*@__PURE__*/ G(`$ZodBase64URL`,(e,t)=>{t.pattern??=$a,q.init(e,t),e._zod.check=n=>{eo(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),no=/*@__PURE__*/ G(`$ZodE164`,(e,t)=>{t.pattern??=Wi,q.init(e,t)});function ro(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const io=/*@__PURE__*/ G(`$ZodJWT`,(e,t)=>{q.init(e,t),e._zod.check=n=>{ro(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),ao=/*@__PURE__*/ G(`$ZodUnknown`,(e,t)=>{K.init(e,t),e._zod.parse=e=>e}),oo=/*@__PURE__*/ G(`$ZodNever`,(e,t)=>{K.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function so(e,t){let n=Cr(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of Cr(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,wr(n.issues,t,e),n}}return i(n,a)}}const co=e=>Array.isArray(e)?e.length:-1;function lo(e,t,n){e.issues.length&&t.issues.push(...xr(n,e.issues)),t.value[n]=e.value}const uo=/*@__PURE__*/ G(`$ZodArray`,(e,t)=>{K.init(e,t);let n=Jr.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>lo(t,r,e)));else if(lo(c,r,e),s&&c.issues.length!==0&&yr(c))break}return o.length?Promise.all(o).then(()=>r):r},so(e,co)});function fo(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...xr(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}const po=[];function mo(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:po,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=sr(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function ho(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(yr(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>fo(e,n,i,t,d,f))):fo(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const go=/*@__PURE__*/ G(`$ZodObject`,(e,t)=>{K.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=Bn(()=>mo(t));W(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||Un(n,e,/* @__PURE__ */ new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=$n,o=t.catchall,s,c=Jr.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(yr(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>fo(n,t,e,r,a,o))):fo(s,t,e,r,a,o)}return o?ho(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),_o=/*@__PURE__*/ G(`$ZodObjectJIT`,(e,t)=>{go.init(e,t);let n=e._zod.parse,r=Bn(()=>mo(t)),i=Jr.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new ha([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
88
|
+
`)}\n};`)(...Object.values(this.closed))}};const ha={major:4,minor:6,patch:7},K=/*@__PURE__*/ G(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ha;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=yr(t),a;for(let o of n){if(o._zod.def.when){if(br(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Kr;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(wr(t.issues,n,e),i||=yr(t,n))});else{if(t.issues.length===n)continue;wr(t.issues,n,e),i||=yr(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(yr(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Kr;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Kr;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Nr(this,`~standard`,va(this))},set"~standard"(e){Mr(this,`~standard`,e)}}),ga=(e,t)=>e.issues.length?{issues:e.issues.map(e=>Tr(e,t,Yr()))}:{value:e.value};async function _a(e,t){let n={async:!0};return ga(await e._zod.run({value:t,issues:[]},n),n)}function va(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return ga(r,n)}catch{}return _a(e,t)},vendor:`zod`,version:1}}const ya=/*@__PURE__*/ G(`$ZodString`,(e,t)=>{K.init(e,t),e._zod.pattern=t.pattern??Xi,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),q=/*@__PURE__*/ G(`$ZodStringFormat`,(e,t)=>{oa.init(e,t),ya.init(e,t)}),ba=/*@__PURE__*/ G(`$ZodGUID`,(e,t)=>{t.pattern??=Mi,q.init(e,t)}),xa=/*@__PURE__*/ G(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Ni(e)}else t.pattern??=Ni();q.init(e,t)}),Sa=/*@__PURE__*/ G(`$ZodEmail`,(e,t)=>{t.pattern??=Pi,q.init(e,t)});function Ca(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function wa(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Ca(e)||2:Ta(e,t)}function Ta(e,t){if(!t.normalize&&t.protocol?.source===Hi.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}const Ea=/[\t\n\r]/g;function Da(e){return e.replace(Ea,``)}function Oa(e,t){return t.lastIndex=0,t.test(e.hostname)}function ka(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}const Aa=/*@__PURE__*/ G(`$ZodURL`,(e,t)=>{q.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=wa(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Da(r);return}t.hostname&&!Oa(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!ka(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Da(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),ja=/*@__PURE__*/ G(`$ZodEmoji`,(e,t)=>{t.pattern??=Fi(),q.init(e,t)}),Ma=/*@__PURE__*/ G(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?ki:Ai(t.length),q.init(e,t)}),Na=/*@__PURE__*/ G(`$ZodCUID`,(e,t)=>{t.pattern??=wi,q.init(e,t)}),Pa=/*@__PURE__*/ G(`$ZodCUID2`,(e,t)=>{t.pattern??=Ti,q.init(e,t)}),Fa=/*@__PURE__*/ G(`$ZodULID`,(e,t)=>{t.pattern??=Ei,q.init(e,t)}),Ia=/*@__PURE__*/ G(`$ZodXID`,(e,t)=>{t.pattern??=Di,q.init(e,t)}),La=/*@__PURE__*/ G(`$ZodKSUID`,(e,t)=>{t.pattern??=Oi,q.init(e,t)}),Ra=/*@__PURE__*/ G(`$ZodISODateTime`,(e,t)=>{t.pattern??=Yi(t),q.init(e,t)}),za=/*@__PURE__*/ G(`$ZodISODate`,(e,t)=>{t.pattern??=Ki,q.init(e,t)}),Ba=/*@__PURE__*/ G(`$ZodISOTime`,(e,t)=>{t.pattern??=Ji(t),q.init(e,t)}),Va=/*@__PURE__*/ G(`$ZodISODuration`,(e,t)=>{t.pattern??=ji,q.init(e,t)}),Ha=/*@__PURE__*/ G(`$ZodIPv4`,(e,t)=>{t.pattern??=Ii,q.init(e,t)}),Ua=/^[0-9a-fA-F:.]+$/;function Wa(e){return Ua.test(e)?Ca(`http://[${e}]`):!1}const Ga=/*@__PURE__*/ G(`$ZodIPv6`,(e,t)=>{t.pattern??=Li,q.init(e,t),e._zod.check=n=>{Wa(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Ka=/*@__PURE__*/ G(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Ri,q.init(e,t)});function qa(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Wa(n)}const Ja=/*@__PURE__*/ G(`$ZodCIDRv6`,(e,t)=>{t.pattern??=zi,q.init(e,t),e._zod.check=n=>{qa(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Ya(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Xa=/^[0-9a-zA-Z+/]*={0,2}$/,Za=/*@__PURE__*/ G(`$ZodBase64`,(e,t)=>{t.pattern??=Xa,q.init(e,t),e._zod.check=n=>{Ya(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Qa=/^[A-Za-z0-9_-]*$/;function $a(e){if(!Qa.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Ya(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const eo=/*@__PURE__*/ G(`$ZodBase64URL`,(e,t)=>{t.pattern??=Qa,q.init(e,t),e._zod.check=n=>{$a(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),to=/*@__PURE__*/ G(`$ZodE164`,(e,t)=>{t.pattern??=Ui,q.init(e,t)});function no(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const ro=/*@__PURE__*/ G(`$ZodJWT`,(e,t)=>{q.init(e,t),e._zod.check=n=>{no(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),io=/*@__PURE__*/ G(`$ZodUnknown`,(e,t)=>{K.init(e,t),e._zod.parse=e=>e}),ao=/*@__PURE__*/ G(`$ZodNever`,(e,t)=>{K.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function oo(e,t){let n=Cr(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of Cr(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,wr(n.issues,t,e),n}}return i(n,a)}}const so=e=>Array.isArray(e)?e.length:-1;function co(e,t,n){e.issues.length&&t.issues.push(...xr(n,e.issues)),t.value[n]=e.value}const lo=/*@__PURE__*/ G(`$ZodArray`,(e,t)=>{K.init(e,t);let n=Jr.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>co(t,r,e)));else if(co(c,r,e),s&&c.issues.length!==0&&yr(c))break}return o.length?Promise.all(o).then(()=>r):r},oo(e,so)});function uo(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...xr(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}const fo=[];function po(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:fo,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=sr(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function mo(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(yr(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>uo(e,n,i,t,d,f))):uo(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const ho=/*@__PURE__*/ G(`$ZodObject`,(e,t)=>{K.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=Bn(()=>po(t));W(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||Un(n,e,/* @__PURE__ */ new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=$n,o=t.catchall,s,c=Jr.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(yr(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>uo(n,t,e,r,a,o))):uo(s,t,e,r,a,o)}return o?mo(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),go=/*@__PURE__*/ G(`$ZodObjectJIT`,(e,t)=>{ho.init(e,t);let n=e._zod.parse,r=Bn(()=>po(t)),i=Jr.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new ma([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
87
89
|
let ${e}_ab = false;
|
|
88
90
|
for (let i = 0; i < ${e}.issues.length; i++) {
|
|
89
91
|
const iss = ${e}.issues[i];
|
|
@@ -133,54 +135,54 @@ ${L.default.gray(yn+_n.repeat(a+2)+bn)}
|
|
|
133
135
|
newResult[${r}] = ${n}.value;
|
|
134
136
|
}
|
|
135
137
|
|
|
136
|
-
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=$n,c=!Jr.jitless,l=c&&er.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?ho([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function vo(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!yr(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Tr(e,r,Yr())))}),t)}const yo=/*@__PURE__*/ G(`$ZodUnion`,(e,t)=>{K.init(e,t),W(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),W(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),W(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),W(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>Hn(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>vo(t,r,e,i)):vo(o,r,e,i)}}),bo=/*@__PURE__*/ G(`$ZodIntersection`,(e,t)=>{K.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>So(e,t,n)):So(e,i,a)}});function xo(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(tr(e)&&tr(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=xo(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=xo(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function So(e,t,n){let r=/* @__PURE__ */ new Map,i,a=/* @__PURE__ */ new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=xo(t.value,n.value);if(!c.valid){if(yr(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}const Co=/*@__PURE__*/ G(`$ZodRecord`,(e,t)=>{K.init(e,t);let n=Jr.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!tr(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=/* @__PURE__ */ new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Tr(e,i,Yr())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...xr(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...xr(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&$i.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>Tr(e,i,Yr())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...xr(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...xr(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),wo=/*@__PURE__*/ G(`$ZodEnum`,(e,t)=>{K.init(e,t);let n=In(t.entries),r=new Set(n);e._zod.values=r,W(e,`pattern`,e=>{let t=In(e.def.entries).filter(e=>rr.has(typeof e));return RegExp(t.length?`^(${t.map(e=>ir(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),To=/*@__PURE__*/ G(`$ZodTransform`,(e,t)=>{K.init(e,t),e._zod.optin=`optional`,Jr.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new qr(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Kr;return n.value=i,n}});function Eo(e,t){return e.value=t.issues.length?void 0:t.value,e}const Do=/*@__PURE__*/ G(`$ZodOptional`,(e,t)=>{K.init(e,t),W(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,W(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?/* @__PURE__ */ new Set([...t,void 0]):void 0}),W(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Hn(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Eo(e,t)):Eo(e,r)}return t.innerType._zod.run(e,n)}}),Oo=/*@__PURE__*/ G(`$ZodExactOptional`,(e,t)=>{Do.init(e,t),W(e,`values`,e=>e.def.innerType._zod.values),W(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),ko=/*@__PURE__*/ G(`$ZodNullable`,(e,t)=>{K.init(e,t),W(e,`optin`,e=>e.def.innerType._zod.optin),W(e,`optout`,e=>e.def.innerType._zod.optout),W(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Hn(t.source)}|null)$`):void 0}),W(e,`values`,e=>e.def.innerType._zod.values?/* @__PURE__ */ new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Ao=/*@__PURE__*/ G(`$ZodDefault`,(e,t)=>{K.init(e,t),e._zod.optin=`defaulted`,W(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>jo(e,t)):jo(r,t)}});function jo(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Mo=/*@__PURE__*/ G(`$ZodPrefault`,(e,t)=>{K.init(e,t),e._zod.optin=`defaulted`,W(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),No=/*@__PURE__*/ G(`$ZodNonOptional`,(e,t)=>{K.init(e,t),W(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Po(t,e)):Po(i,e)}});function Po(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Fo(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Tr(e,r,Yr()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const Io=/*@__PURE__*/ G(`$ZodCatch`,(e,t)=>{K.init(e,t),W(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),W(e,`optout`,e=>e.def.innerType._zod.optout),W(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Fo(e,r,t,n)):Fo(e,r,t,n)}}),Lo=/*@__PURE__*/ G(`$ZodPipe`,(e,t)=>{K.init(e,t),W(e,`values`,e=>e.def.in._zod.values),W(e,`optin`,e=>e.def.in._zod.optin),W(e,`optout`,e=>e.def.out._zod.optout),W(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Ro(e,t.in,n)):Ro(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Ro(e,t.out,n)):Ro(r,t.out,n)}});function Ro(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const zo=/*@__PURE__*/ G(`$ZodReadonly`,(e,t)=>{K.init(e,t),W(e,`propValues`,e=>e.def.innerType._zod.propValues),W(e,`values`,e=>e.def.innerType._zod.values),W(e,`optin`,e=>e.def.innerType?._zod?.optin),W(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Bo):Bo(r)}});function Bo(e){return e.memo||(e.value=Object.freeze(e.value)),e}const Vo=/*@__PURE__*/ G(`$ZodCustom`,(e,t)=>{na.init(e,t),K.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Ho(t,n,r,e));Ho(i,n,r,e)}});function Ho(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ar(e))}}var Uo=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}};const Wo=`~memo`,Go=[];function Ko(e){return typeof e==`object`&&!!e}function qo(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}const Jo=/*@__PURE__*/ new WeakMap;function Yo(e,t,n){let r=Jo.get(e);if(r!==void 0)return r?2:0;if(t.has(e))return 2;t.add(e);let i=0,a=e=>{if(i!==2&&e?._zod){let r=Yo(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=0;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?1:o.value?._zod?Yo(o.value,t,n):0;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=Wn(c);s(e?o(e,!0):1),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Yo(r,t,!1):1);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 e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Xo(e,i)}function Xo(e,t){return t!==1&&Jo.set(e,t===2),t}function Zo(e,t){let n=e.buckets.get(t);return n||(n=/* @__PURE__ */ new WeakMap,e.buckets.set(t,n)),n}let Qo;const $o=[],es={alloc(e,t,n){let r=Qo;if(!r)return n;Qo=void 0;let i={value:n,issues:null};return r.set(t.value,i),$o.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&ns(n,e.value))throw new Uo;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Yo(e,/* @__PURE__ */ new Set,!1);if(i===0)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===2||r?n=!0:r=!0}let l=s.value;if(!Ko(l))return t(s,c);let u=c[Wo];u||(u={buckets:/* @__PURE__ */ new WeakMap,backEdges:void 0},c[Wo]=u);let d;i===c?d=a:(d=Zo(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...qo(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=/* @__PURE__ */ new WeakSet),u.backEdges.add(f.value)),s;Qo=d;let p=$o.length,m=t(s,c);Qo=void 0;let h=$o.length>p?$o.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?qo(e.issues):Go),e)):(h&&(h.issues=m.issues.length?qo(m.issues):Go),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function ts(){return es}function ns(e,t){let n=e[Wo]?.backEdges;return n!==void 0&&Ko(t)&&n.has(t)}const rs=()=>{let e={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 t(t){return e[t]??null}let n={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`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(kr(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${or(e.values[0])}`:`Invalid option: expected one of ${Ln(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${Ln(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function is(){return{localeError:rs()}}var as,os=class{constructor(){this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function ss(){return new os}(as=globalThis).__zod_globalRegistry??(as.__zod_globalRegistry=ss());const cs=globalThis.__zod_globalRegistry;function ls(e){return e.checks&&=[...e.checks],e}// @__NO_SIDE_EFFECTS__
|
|
137
|
-
function
|
|
138
|
-
function
|
|
139
|
-
function
|
|
140
|
-
function
|
|
141
|
-
function
|
|
142
|
-
function
|
|
143
|
-
function
|
|
144
|
-
function
|
|
145
|
-
function
|
|
146
|
-
function
|
|
147
|
-
function
|
|
148
|
-
function
|
|
149
|
-
function
|
|
150
|
-
function
|
|
151
|
-
function
|
|
152
|
-
function
|
|
153
|
-
function
|
|
154
|
-
function
|
|
155
|
-
function
|
|
156
|
-
function
|
|
157
|
-
function
|
|
158
|
-
function
|
|
159
|
-
function
|
|
160
|
-
function
|
|
161
|
-
function
|
|
162
|
-
function
|
|
163
|
-
function
|
|
164
|
-
function
|
|
165
|
-
function
|
|
166
|
-
function
|
|
167
|
-
function
|
|
168
|
-
function
|
|
169
|
-
function
|
|
170
|
-
function
|
|
171
|
-
function
|
|
172
|
-
function
|
|
173
|
-
function
|
|
174
|
-
function
|
|
175
|
-
function
|
|
176
|
-
function
|
|
177
|
-
function
|
|
178
|
-
function
|
|
179
|
-
function
|
|
180
|
-
function
|
|
181
|
-
function
|
|
182
|
-
function
|
|
183
|
-
function
|
|
184
|
-
function
|
|
138
|
+
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=$n,c=!Jr.jitless,l=c&&er.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?mo([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function _o(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!yr(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Tr(e,r,Yr())))}),t)}const vo=/*@__PURE__*/ G(`$ZodUnion`,(e,t)=>{K.init(e,t),W(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),W(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),W(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),W(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>Hn(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>_o(t,r,e,i)):_o(o,r,e,i)}}),yo=/*@__PURE__*/ G(`$ZodIntersection`,(e,t)=>{K.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>xo(e,t,n)):xo(e,i,a)}});function bo(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(tr(e)&&tr(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=bo(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=bo(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function xo(e,t,n){let r=/* @__PURE__ */ new Map,i,a=/* @__PURE__ */ new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=bo(t.value,n.value);if(!c.valid){if(yr(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}const So=/*@__PURE__*/ G(`$ZodRecord`,(e,t)=>{K.init(e,t);let n=Jr.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!tr(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=/* @__PURE__ */ new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Tr(e,i,Yr())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...xr(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...xr(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&Qi.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>Tr(e,i,Yr())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...xr(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...xr(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Co=/*@__PURE__*/ G(`$ZodEnum`,(e,t)=>{K.init(e,t);let n=In(t.entries),r=new Set(n);e._zod.values=r,W(e,`pattern`,e=>{let t=In(e.def.entries).filter(e=>rr.has(typeof e));return RegExp(t.length?`^(${t.map(e=>ir(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),wo=/*@__PURE__*/ G(`$ZodTransform`,(e,t)=>{K.init(e,t),e._zod.optin=`optional`,Jr.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new qr(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Kr;return n.value=i,n}});function To(e,t){return e.value=t.issues.length?void 0:t.value,e}const Eo=/*@__PURE__*/ G(`$ZodOptional`,(e,t)=>{K.init(e,t),W(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,W(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?/* @__PURE__ */ new Set([...t,void 0]):void 0}),W(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Hn(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>To(e,t)):To(e,r)}return t.innerType._zod.run(e,n)}}),Do=/*@__PURE__*/ G(`$ZodExactOptional`,(e,t)=>{Eo.init(e,t),W(e,`values`,e=>e.def.innerType._zod.values),W(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Oo=/*@__PURE__*/ G(`$ZodNullable`,(e,t)=>{K.init(e,t),W(e,`optin`,e=>e.def.innerType._zod.optin),W(e,`optout`,e=>e.def.innerType._zod.optout),W(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Hn(t.source)}|null)$`):void 0}),W(e,`values`,e=>e.def.innerType._zod.values?/* @__PURE__ */ new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),ko=/*@__PURE__*/ G(`$ZodDefault`,(e,t)=>{K.init(e,t),e._zod.optin=`defaulted`,W(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Ao(e,t)):Ao(r,t)}});function Ao(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const jo=/*@__PURE__*/ G(`$ZodPrefault`,(e,t)=>{K.init(e,t),e._zod.optin=`defaulted`,W(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Mo=/*@__PURE__*/ G(`$ZodNonOptional`,(e,t)=>{K.init(e,t),W(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>No(t,e)):No(i,e)}});function No(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Po(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Tr(e,r,Yr()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const Fo=/*@__PURE__*/ G(`$ZodCatch`,(e,t)=>{K.init(e,t),W(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),W(e,`optout`,e=>e.def.innerType._zod.optout),W(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Po(e,r,t,n)):Po(e,r,t,n)}}),Io=/*@__PURE__*/ G(`$ZodPipe`,(e,t)=>{K.init(e,t),W(e,`values`,e=>e.def.in._zod.values),W(e,`optin`,e=>e.def.in._zod.optin),W(e,`optout`,e=>e.def.out._zod.optout),W(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Lo(e,t.in,n)):Lo(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Lo(e,t.out,n)):Lo(r,t.out,n)}});function Lo(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Ro=/*@__PURE__*/ G(`$ZodReadonly`,(e,t)=>{K.init(e,t),W(e,`propValues`,e=>e.def.innerType._zod.propValues),W(e,`values`,e=>e.def.innerType._zod.values),W(e,`optin`,e=>e.def.innerType?._zod?.optin),W(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(zo):zo(r)}});function zo(e){return e.memo||(e.value=Object.freeze(e.value)),e}const Bo=/*@__PURE__*/ G(`$ZodCustom`,(e,t)=>{ta.init(e,t),K.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Vo(t,n,r,e));Vo(i,n,r,e)}});function Vo(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ar(e))}}var Ho=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}};const Uo=`~memo`,Wo=[];function Go(e){return typeof e==`object`&&!!e}function Ko(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}const qo=/*@__PURE__*/ new WeakMap;function Jo(e,t,n){let r=qo.get(e);if(r!==void 0)return r?2:0;if(t.has(e))return 2;t.add(e);let i=0,a=e=>{if(i!==2&&e?._zod){let r=Jo(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=0;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?1:o.value?._zod?Jo(o.value,t,n):0;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=Wn(c);s(e?o(e,!0):1),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Jo(r,t,!1):1);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 e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Yo(e,i)}function Yo(e,t){return t!==1&&qo.set(e,t===2),t}function Xo(e,t){let n=e.buckets.get(t);return n||(n=/* @__PURE__ */ new WeakMap,e.buckets.set(t,n)),n}let Zo;const Qo=[],$o={alloc(e,t,n){let r=Zo;if(!r)return n;Zo=void 0;let i={value:n,issues:null};return r.set(t.value,i),Qo.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&ts(n,e.value))throw new Ho;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Jo(e,/* @__PURE__ */ new Set,!1);if(i===0)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===2||r?n=!0:r=!0}let l=s.value;if(!Go(l))return t(s,c);let u=c[Uo];u||(u={buckets:/* @__PURE__ */ new WeakMap,backEdges:void 0},c[Uo]=u);let d;i===c?d=a:(d=Xo(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Ko(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=/* @__PURE__ */ new WeakSet),u.backEdges.add(f.value)),s;Zo=d;let p=Qo.length,m=t(s,c);Zo=void 0;let h=Qo.length>p?Qo.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Ko(e.issues):Wo),e)):(h&&(h.issues=m.issues.length?Ko(m.issues):Wo),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function es(){return $o}function ts(e,t){let n=e[Uo]?.backEdges;return n!==void 0&&Go(t)&&n.has(t)}const ns=()=>{let e={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 t(t){return e[t]??null}let n={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`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(kr(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${or(e.values[0])}`:`Invalid option: expected one of ${Ln(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${Ln(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function rs(){return{localeError:ns()}}var is,as=class{constructor(){this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function os(){return new as}(is=globalThis).__zod_globalRegistry??(is.__zod_globalRegistry=os());const ss=globalThis.__zod_globalRegistry;function cs(e){return e.checks&&=[...e.checks],e}// @__NO_SIDE_EFFECTS__
|
|
139
|
+
function ls(e,t){return new e(cs({type:`string`,...U(t)}))}// @__NO_SIDE_EFFECTS__
|
|
140
|
+
function us(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
141
|
+
function ds(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
142
|
+
function fs(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
143
|
+
function ps(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
144
|
+
function ms(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
145
|
+
function hs(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
146
|
+
function gs(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
147
|
+
function _s(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
148
|
+
function vs(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
149
|
+
function ys(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
150
|
+
function bs(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
151
|
+
function xs(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
152
|
+
function Ss(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
153
|
+
function Cs(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
154
|
+
function ws(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
155
|
+
function Ts(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
156
|
+
function Es(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
157
|
+
function Ds(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
158
|
+
function Os(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
159
|
+
function ks(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
160
|
+
function As(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
161
|
+
function js(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
162
|
+
function Ms(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
163
|
+
function Ns(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
164
|
+
function Ps(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
165
|
+
function Fs(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
166
|
+
function Is(e){return new e({type:`unknown`})}// @__NO_SIDE_EFFECTS__
|
|
167
|
+
function Ls(e,t){return new e({type:`never`,...U(t)})}// @__NO_SIDE_EFFECTS__
|
|
168
|
+
function Rs(e,t){return new ra({check:`max_length`,...U(t),maximum:e})}// @__NO_SIDE_EFFECTS__
|
|
169
|
+
function zs(e,t){return new ia({check:`min_length`,...U(t),minimum:e})}// @__NO_SIDE_EFFECTS__
|
|
170
|
+
function Bs(e,t){return new aa({check:`length_equals`,...U(t),length:e})}// @__NO_SIDE_EFFECTS__
|
|
171
|
+
function Vs(e,t){return new sa({check:`string_format`,format:`regex`,...U(t),pattern:e})}// @__NO_SIDE_EFFECTS__
|
|
172
|
+
function Hs(e){return new ca({check:`string_format`,format:`lowercase`,...U(e)})}// @__NO_SIDE_EFFECTS__
|
|
173
|
+
function Us(e){return new la({check:`string_format`,format:`uppercase`,...U(e)})}// @__NO_SIDE_EFFECTS__
|
|
174
|
+
function Ws(e,t){return new ua({check:`string_format`,format:`includes`,...U(t),includes:e})}// @__NO_SIDE_EFFECTS__
|
|
175
|
+
function Gs(e,t){return new da({check:`string_format`,format:`starts_with`,...U(t),prefix:e})}// @__NO_SIDE_EFFECTS__
|
|
176
|
+
function Ks(e,t){return new fa({check:`string_format`,format:`ends_with`,...U(t),suffix:e})}// @__NO_SIDE_EFFECTS__
|
|
177
|
+
function qs(e){return new pa({check:`overwrite`,tx:e})}// @__NO_SIDE_EFFECTS__
|
|
178
|
+
function Js(e){return/* @__PURE__ */ qs(t=>t.normalize(e))}// @__NO_SIDE_EFFECTS__
|
|
179
|
+
function Ys(){return/* @__PURE__ */ qs(e=>e.trim())}// @__NO_SIDE_EFFECTS__
|
|
180
|
+
function Xs(){return/* @__PURE__ */ qs(e=>e.toLowerCase())}// @__NO_SIDE_EFFECTS__
|
|
181
|
+
function Zs(){return/* @__PURE__ */ qs(e=>e.toUpperCase())}// @__NO_SIDE_EFFECTS__
|
|
182
|
+
function Qs(){return/* @__PURE__ */ qs(e=>Zn(e))}// @__NO_SIDE_EFFECTS__
|
|
183
|
+
function $s(e,t,n){return new e({type:`array`,element:t,...U(n)})}// @__NO_SIDE_EFFECTS__
|
|
184
|
+
function ec(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...U(n)})}// @__NO_SIDE_EFFECTS__
|
|
185
|
+
function tc(e,t){let n=/* @__PURE__ */ nc(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Ar(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Ar(r))}},e(t.value,t)),t);return n}// @__NO_SIDE_EFFECTS__
|
|
186
|
+
function nc(e,t){let n=new ta({check:`custom`,...U(t)});return n._zod.check=e,n}function rc(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&Un(e,t,n[t]);return e}function ic(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??ss,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:/* @__PURE__ */ new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function ac(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function J(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,J(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&rc(o.schema,c),t.io===`input`&&Y(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function oc(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function sc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=/* @__PURE__ */ new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${oc(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+oc(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
185
187
|
|
|
186
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function lc(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;lc(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const uc=/* @__PURE__ */ new Set([`type`,`properties`,`required`,`additionalProperties`]),dc=[`oneOf`,`anyOf`];function fc(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function pc(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!uc.has(e))return null;t.push(n)}let n={},r=/* @__PURE__ */ new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??fc(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}Un(n,r,e.length===1?e[0]:pc(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=fc(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function mc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of uc)if(t in e)return;let n=t.filter(e=>dc.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=pc(t);else{let e=n[0],i=dc.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>pc([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,ic(e,r))}function hc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):ic(i,s),ic(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())lc(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=/* @__PURE__ */ new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])mc(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}ic(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,Un(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:_c(t,`input`,e.processors),output:_c(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Y(e,t){let n=t??{seen:/* @__PURE__ */ new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Y(r.element,n);if(r.type===`set`)return Y(r.valueType,n);if(r.type===`lazy`)return Y(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return Y(r.innerType,n);if(r.type===`intersection`)return Y(r.left,n)||Y(r.right,n);if(r.type===`record`||r.type===`map`)return Y(r.keyType,n)||Y(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Y(r.in,n)||Y(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Y(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Y(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Y(e,n))return!0;return!!(r.rest&&Y(r.rest,n))}return!1}const gc=(e,t={})=>n=>{let r=ac({...n,processors:t});return J(e,r),cc(r,e),hc(r,e)},_c=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ac({...i??{},target:a,io:t,processors:n});return J(e,o),cc(o,e),hc(o,e)},vc=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},yc=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},bc=(e,t)=>{vc(e,`minimum`,t),yc(e,`maximum`,t)},xc=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Sc=(e,t)=>{e.patterns??=/* @__PURE__ */ new Set,e.patterns.add(t)},Cc=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},wc=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Tc=(e,t)=>vc(e,`minimum`,t.minimum),Ec=(e,t)=>yc(e,`maximum`,t.maximum),Dc=e=>(t,n)=>{wc(t,n.format);let[r,i]=e[n.format];vc(t,`minimum`,r),yc(t,`maximum`,i)},Oc={greater_than:(e,t)=>vc(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>yc(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>xc(e,t.value),number_format:Dc(cr),bigint_format:Dc(lr),min_length:Tc,max_length:Ec,length_equals:(e,t)=>bc(e,t.length),min_size:Tc,max_size:Ec,size_equals:(e,t)=>bc(e,t.size),string_format:(e,t)=>{wc(e,t.format),t.pattern&&Sc(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Cc(e,t.mime)};function kc(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Oc[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&vc(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&vc(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&yc(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&yc(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&xc(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Cc(t,i.mime);for(let e of i.patterns??[])Sc(t,e);return t}const Ac={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},jc=/* @__PURE__ */ new Map([[Za,Vi],[$a,Hi]]),Mc=e=>jc.get(e)??e,Nc=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=kc(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ac[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Mc);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Pc=(e,t,n,r)=>{n.not={}},Fc=(e,t,n,r)=>{let i=e._zod.def,a=In(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},Ic=(e,t,n,r)=>{oc(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Lc=(e,t,n,r)=>{oc(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Rc=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=kc(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=J(a.element,t,{...r,path:[...r.path,`items`]})};function zc(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?zc(t.out):t.type===`catch`?zc(t.innerType):e._zod.optin}const Bc=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&oc(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)Un(i.properties,e,J(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?zc(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=J(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Vc=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>J(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Hc=(e,t,n,r)=>{let i=e._zod.def,a=J(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=J(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function Uc(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Uc(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Uc(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?$i:Qi).source)),p}const Wc=/* @__PURE__ */ new WeakMap;function Gc(e){let t=/* @__PURE__ */ new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=/* @__PURE__ */ new Map;for(let r of Wc.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Uc(t,a,/* @__PURE__ */ new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}const Kc=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=kc(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=J(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)Un(i.patternProperties,Mc(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=J(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Wc.get(t);n||(n=[],Wc.set(t,n),t.deferred.push(()=>Gc(t))),n.push(e)}i.additionalProperties=J(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&zc(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},qc=(e,t,n,r)=>{let i=e._zod.def,a=J(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Jc=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Yc=Symbol();function Xc(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(oc(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Yc):JSON.parse(o)}const Zc=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Xc(i.defaultValue,e,t,n,r);o!==Yc&&(n.default=o)},Qc=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Xc(i.defaultValue,e,t,n,r);o!==Yc&&(n._prefault=o)},$c=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{oc(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},el=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;J(o,t,r);let s=t.seen.get(e);s.ref=o},tl=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},nl=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},rl=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]);function il(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}const X=/*@__PURE__*/ G(`ZodError`,(e,t)=>{ni.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);rl.has(n)||(rl.add(n),il(n,`format`,e=>t=>ai(e,t)),il(n,`flatten`,e=>t=>ii(e,t)),il(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Rn,2)}),il(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Rn,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),al=/* @__PURE__ */ si(X),ol=/* @__PURE__ */ ci(X),sl=/* @__PURE__ */ li(X),cl=/* @__PURE__ */ di(X),ll=/* @__PURE__ */ _i(X),ul=/* @__PURE__ */ vi(X),dl=/* @__PURE__ */ yi(X),fl=/* @__PURE__ */ bi(X),pl=/* @__PURE__ */ xi(X),ml=/* @__PURE__ */ Si(X),hl=/* @__PURE__ */ Ci(X),gl=/* @__PURE__ */ wi(X);function _l(){Jr.localeError||Yr(is())}function vl(){Jr.memoizer||Yr({memoizer:ts()})}const Z=/*@__PURE__*/ G(`ZodType`,(e,t)=>(_l(),K.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(H(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ar(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ou(e,t))},superRefine(e,t){return this.check(ku(e,t))},overwrite(e){return this.check(/* @__PURE__ */ Js(e))},optional(){return uu(this)},exactOptional(){return fu(this)},nullable(){return mu(this)},nullish(){return uu(mu(this))},nonoptional(e){return bu(this,e)},array(){return Yl(this)},or(e){return eu([this,e])},and(e){return nu(this,e)},transform(e){return wu(this,cu(e))},default(e){return gu(this,e)},prefault(e){return vu(this,e)},catch(e){return Su(this,e)},pipe(e){return wu(this,e)},readonly(){return Eu(this)},describe(e){let t=this.clone();return cs.add(t,{description:e}),t},meta(...e){if(e.length===0)return cs.get(this);let t=this.clone();return cs.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Nr(this,`~standard`,{...ya(this),jsonSchema:{input:_c(this,`input`),output:_c(this,`output`)}})},set"~standard"(e){Mr(this,`~standard`,e)},parse:function e(t,n){return al(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await ol(this,t,n,{callee:e})},safeParse(e,t){return sl(this,e,t)},async safeParseAsync(e,t){return cl(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Mr(this,`spa`,e)},validate(e,t){return mi(this,e,t)},validateAsync(e,t){return gi(this,e,t)},encode:function e(t,n){return ll(this,t,n,{callee:e})},decode:function e(t,n){return ul(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await dl(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await fl(this,t,n,{callee:e})},safeEncode(e,t){return pl(this,e,t)},safeDecode(e,t){return ml(this,e,t)},async safeEncodeAsync(e,t){return hl(this,e,t)},async safeDecodeAsync(e,t){return gl(this,e,t)},toJSONSchema(e){return gc(this,{})(e)},get description(){return cs.get(this)?.description},get _def(){return this._zod.def}}),yl=/*@__PURE__*/ G(`_ZodString`,(e,t)=>{ba.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nc(e,t,n,r)},/*@__PURE__*/ Pr({format:e=>kc(e).format??null,minLength:e=>kc(e).minimum??null,maxLength:e=>kc(e).maximum??null},{regex(...e){return this.check(/* @__PURE__ */ Hs(...e))},includes(...e){return this.check(/* @__PURE__ */ Gs(...e))},startsWith(...e){return this.check(/* @__PURE__ */ Ks(...e))},endsWith(...e){return this.check(/* @__PURE__ */ qs(...e))},min(...e){return this.check(/* @__PURE__ */ Bs(...e))},max(...e){return this.check(/* @__PURE__ */ zs(...e))},length(...e){return this.check(/* @__PURE__ */ Vs(...e))},nonempty(...e){return this.check(/* @__PURE__ */ Bs(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ Us(e))},uppercase(e){return this.check(/* @__PURE__ */ Ws(e))},trim(){return this.check(/* @__PURE__ */ Xs())},normalize(...e){return this.check(/* @__PURE__ */ Ys(...e))},toLowerCase(){return this.check(/* @__PURE__ */ Zs())},toUpperCase(){return this.check(/* @__PURE__ */ Qs())},slugify(){return this.check(/* @__PURE__ */ $s())}})),bl=/*@__PURE__*/ G(`ZodString`,(e,t)=>{ba.init(e,t),yl.init(e,t)},{email(e){return this.check(/* @__PURE__ */ ds(Tl,e))},url(e){return this.check(/* @__PURE__ */ _s(Ol,e))},jwt(e){return this.check(/* @__PURE__ */ Ms(Ul,e))},emoji(e){return this.check(/* @__PURE__ */ vs(kl,e))},guid(e){return this.check(/* @__PURE__ */ fs(El,e))},uuid(e){return this.check(/* @__PURE__ */ ps(Dl,e))},uuidv4(e){return this.check(/* @__PURE__ */ ms(Dl,e))},uuidv6(e){return this.check(/* @__PURE__ */ hs(Dl,e))},uuidv7(e){return this.check(/* @__PURE__ */ gs(Dl,e))},nanoid(e){return this.check(/* @__PURE__ */ ys(Al,e))},cuid(e){return this.check(/* @__PURE__ */ bs(jl,e))},cuid2(e){return this.check(/* @__PURE__ */ xs(Ml,e))},ulid(e){return this.check(/* @__PURE__ */ Ss(Nl,e))},base64(e){return this.check(/* @__PURE__ */ ks(Bl,e))},base64url(e){return this.check(/* @__PURE__ */ As(Vl,e))},xid(e){return this.check(/* @__PURE__ */ Cs(Pl,e))},ksuid(e){return this.check(/* @__PURE__ */ ws(Fl,e))},ipv4(e){return this.check(/* @__PURE__ */ Ts(Il,e))},ipv6(e){return this.check(/* @__PURE__ */ Es(Ll,e))},cidrv4(e){return this.check(/* @__PURE__ */ Ds(Rl,e))},cidrv6(e){return this.check(/* @__PURE__ */ Os(zl,e))},e164(e){return this.check(/* @__PURE__ */ js(Hl,e))},datetime(e){return this.check(/* @__PURE__ */ Ns(xl,e))},date(e){return this.check(/* @__PURE__ */ Ps(Sl,e))},time(e){return this.check(/* @__PURE__ */ Fs(Cl,e))},duration(e){return this.check(/* @__PURE__ */ Is(wl,e))}});function Q(e){return/* @__PURE__ */ us(bl,e)}const $=/*@__PURE__*/ G(`ZodStringFormat`,(e,t)=>{q.init(e,t),yl.init(e,t)}),xl=/*@__PURE__*/ G(`ZodISODateTime`,(e,t)=>{za.init(e,t),$.init(e,t)}),Sl=/*@__PURE__*/ G(`ZodISODate`,(e,t)=>{Ba.init(e,t),$.init(e,t)}),Cl=/*@__PURE__*/ G(`ZodISOTime`,(e,t)=>{Va.init(e,t),$.init(e,t)}),wl=/*@__PURE__*/ G(`ZodISODuration`,(e,t)=>{Ha.init(e,t),$.init(e,t)}),Tl=/*@__PURE__*/ G(`ZodEmail`,(e,t)=>{Ca.init(e,t),$.init(e,t)}),El=/*@__PURE__*/ G(`ZodGUID`,(e,t)=>{xa.init(e,t),$.init(e,t)}),Dl=/*@__PURE__*/ G(`ZodUUID`,(e,t)=>{Sa.init(e,t),$.init(e,t)}),Ol=/*@__PURE__*/ G(`ZodURL`,(e,t)=>{ja.init(e,t),$.init(e,t)}),kl=/*@__PURE__*/ G(`ZodEmoji`,(e,t)=>{Ma.init(e,t),$.init(e,t)}),Al=/*@__PURE__*/ G(`ZodNanoID`,(e,t)=>{Na.init(e,t),$.init(e,t)}),jl=/*@__PURE__*/ G(`ZodCUID`,(e,t)=>{Pa.init(e,t),$.init(e,t)}),Ml=/*@__PURE__*/ G(`ZodCUID2`,(e,t)=>{Fa.init(e,t),$.init(e,t)}),Nl=/*@__PURE__*/ G(`ZodULID`,(e,t)=>{Ia.init(e,t),$.init(e,t)}),Pl=/*@__PURE__*/ G(`ZodXID`,(e,t)=>{La.init(e,t),$.init(e,t)}),Fl=/*@__PURE__*/ G(`ZodKSUID`,(e,t)=>{Ra.init(e,t),$.init(e,t)}),Il=/*@__PURE__*/ G(`ZodIPv4`,(e,t)=>{Ua.init(e,t),$.init(e,t)}),Ll=/*@__PURE__*/ G(`ZodIPv6`,(e,t)=>{Ka.init(e,t),$.init(e,t)}),Rl=/*@__PURE__*/ G(`ZodCIDRv4`,(e,t)=>{qa.init(e,t),$.init(e,t)}),zl=/*@__PURE__*/ G(`ZodCIDRv6`,(e,t)=>{Ya.init(e,t),$.init(e,t)}),Bl=/*@__PURE__*/ G(`ZodBase64`,(e,t)=>{Qa.init(e,t),$.init(e,t)}),Vl=/*@__PURE__*/ G(`ZodBase64URL`,(e,t)=>{to.init(e,t),$.init(e,t)}),Hl=/*@__PURE__*/ G(`ZodE164`,(e,t)=>{no.init(e,t),$.init(e,t)}),Ul=/*@__PURE__*/ G(`ZodJWT`,(e,t)=>{io.init(e,t),$.init(e,t)}),Wl=/*@__PURE__*/ G(`ZodUnknown`,(e,t)=>{ao.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Gl(){return/* @__PURE__ */ Ls(Wl)}const Kl=/*@__PURE__*/ G(`ZodNever`,(e,t)=>{oo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pc(e,t,n,r)});function ql(e){return/* @__PURE__ */ Rs(Kl,e)}const Jl=/*@__PURE__*/ G(`ZodArray`,(e,t)=>{vl(),uo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rc(e,t,n,r),e.element=t.element},{min(e,t){return this.check(/* @__PURE__ */ Bs(e,t))},nonempty(e){return this.check(/* @__PURE__ */ Bs(1,e))},max(e,t){return this.check(/* @__PURE__ */ zs(e,t))},length(e,t){return this.check(/* @__PURE__ */ Vs(e,t))},unwrap(){return this.element}});function Yl(e,t){return/* @__PURE__ */ ec(Jl,e,t)}const Xl=/*@__PURE__*/ G(`ZodObject`,(e,t)=>{vl(),_o.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bc(e,t,n,r),Br(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return ou(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(H(this._zod.def,{catchall:e}))},passthrough(){return this.clone(H(this._zod.def,{catchall:Gl()}))},loose(){return this.clone(H(this._zod.def,{catchall:Gl()}))},strict(){return this.clone(H(this._zod.def,{catchall:ql()}))},strip(){return this.clone(H(this._zod.def,{catchall:void 0}))},extend(e){return pr(this,e)},safeExtend(e){return hr(this,e)},merge(e){return gr(this,e)},pick(e){return ur(this,e)},omit(e){return fr(this,e)},partial(...e){return _r(lu,this,e[0])},exactPartial(...e){return _r(du,this,e[0],`exactPartial`)},required(...e){return vr(yu,this,e[0])}});function Zl(e,t){let n={type:`object`,shape:e??{},...U(t)};return new Xl(n)}function Ql(e,t){return new Xl({type:`object`,shape:e,catchall:Gl(),...U(t)})}const $l=/*@__PURE__*/ G(`ZodUnion`,(e,t)=>{yo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vc(e,t,n,r),e.options=t.options});function eu(e,t){return new $l({type:`union`,options:e,...U(t)})}const tu=/*@__PURE__*/ G(`ZodIntersection`,(e,t)=>{bo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hc(e,t,n,r)});function nu(e,t){return new tu({type:`intersection`,left:e,right:t})}const ru=/*@__PURE__*/ G(`ZodRecord`,(e,t)=>{vl(),Co.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kc(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function iu(e,t,n){return!t||!t._zod?new ru({type:`record`,keyType:Q(),valueType:e,...U(t)}):new ru({type:`record`,keyType:e,valueType:t,...U(n)})}const au=/*@__PURE__*/ G(`ZodEnum`,(e,t)=>{wo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fc(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new au({...t,checks:[],...U(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new au({...t,checks:[],...U(r),entries:i})}});function ou(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new au({type:`enum`,entries:n,...U(t)})}const su=/*@__PURE__*/ G(`ZodTransform`,(e,t)=>{vl(),To.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lc(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new qr(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ar(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Ar(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function cu(e){return new su({type:`transform`,transform:e})}const lu=/*@__PURE__*/ G(`ZodOptional`,(e,t)=>{Do.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function uu(e){return new lu({type:`optional`,innerType:e})}const du=/*@__PURE__*/ G(`ZodExactOptional`,(e,t)=>{Oo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function fu(e){return new du({type:`optional`,innerType:e})}const pu=/*@__PURE__*/ G(`ZodNullable`,(e,t)=>{ko.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function mu(e){return new pu({type:`nullable`,innerType:e})}const hu=/*@__PURE__*/ G(`ZodDefault`,(e,t)=>{Ao.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function gu(e,t){return new hu({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():nr(t)}})}const _u=/*@__PURE__*/ G(`ZodPrefault`,(e,t)=>{Mo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function vu(e,t){return new _u({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():nr(t)}})}const yu=/*@__PURE__*/ G(`ZodNonOptional`,(e,t)=>{No.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bu(e,t){return new yu({type:`nonoptional`,innerType:e,...U(t)})}const xu=/*@__PURE__*/ G(`ZodCatch`,(e,t)=>{Io.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$c(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Su(e,t){return new xu({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Vr(t)})}const Cu=/*@__PURE__*/ G(`ZodPipe`,(e,t)=>{Lo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>el(e,t,n,r),e.in=t.in,e.out=t.out});function wu(e,t){return new Cu({type:`pipe`,in:e,out:t})}const Tu=/*@__PURE__*/ G(`ZodReadonly`,(e,t)=>{zo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Eu(e){return new Tu({type:`readonly`,innerType:e})}const Du=/*@__PURE__*/ G(`ZodCustom`,(e,t)=>{Vo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ic(e,t,n,r)});function Ou(e,t={}){return/* @__PURE__ */ tc(Du,e,t)}function ku(e,t){return/* @__PURE__ */ nc(e,t)}const Au=[`dependencies`,`devDependencies`,`peerDependencies`,`optionalDependencies`],ju=[`dependencies`,`peerDependencies`,`optionalDependencies`],Mu=iu(Q(),Q()),Nu=Ql({name:Q().optional(),workspaces:eu([Yl(Q()),Zl({packages:Yl(Q()).optional()})]).optional(),dependencies:Mu.optional(),devDependencies:Mu.optional(),peerDependencies:Mu.optional(),optionalDependencies:Mu.optional()});function Pu(e){let t=a(e,`utf8`),n=Nu.safeParse(JSON.parse(t));if(!n.success)throw Error(`package.json 结构不符合预期:${e}`);return n.data}function Fu(e){return Object.entries(e??{}).filter(([e])=>e.startsWith(`@longzai-intelligence-oxlint/`))}function Iu(e,t){let n=Array.isArray(t)?t:t?.packages??[],r=/* @__PURE__ */ new Set;for(let t of n){let n=new Bun.Glob(`${t}/package.json`);for(let t of n.scanSync({cwd:e}))t.includes(`node_modules/`)||r.add(t)}return[...r].sort()}async function Lu(e,t){let n=Pu(s(e,`package.json`));if(n.name===`@longzai-intelligence-oxlint/root`)return{applicable:!1,versionChecked:[],violations:[]};let r=Iu(e,n.workspaces),i=[];for(let t of r){let n=Pu(s(e,t));for(let e of Au)for(let[r,a]of Fu(n[e]))i.push({kind:`non-root`,manifestPath:t,field:e,name:r,specifier:a})}for(let e of ju)for(let[t,r]of Fu(n[e]))i.push({kind:`root-placement`,manifestPath:`package.json`,field:e,name:t,specifier:r});let a=[],o=Fu(n.devDependencies);return await Promise.all(o.map(async([e,n])=>{if(n.startsWith(`workspace:`))return;a.push(e);let r=await t(e);n!==r&&i.push({kind:`version`,manifestPath:`package.json`,field:`devDependencies`,name:e,specifier:n,expected:r})})),{applicable:!0,versionChecked:a,violations:i}}const Ru=Zl({"dist-tags":Zl({latest:Q().optional()})});async function zu(e){let t=`https://registry.npmjs.org/${encodeURIComponent(e)}`,n=await fetch(t);if(!n.ok)throw Error(`registry 查询失败:${e} 响应状态 ${n.status}`);let r=Ru.safeParse(await n.json());if(!r.success)throw Error(`registry 元数据结构异常:${e}`);let i=r.data[`dist-tags`]?.latest;if(!i)throw Error(`registry 元数据缺失 latest 标签:${e}`);return i}const Bu=Ql({cwd:Q().optional(),format:ou([`text`,`json`]).optional()}),Vu={"non-root":`非根声明`,"root-placement":`根位置误置`,version:`版本非最新`};function Hu(e){gt(e,{name:`check`,description:`插件域依赖声明检查——仅根 devDependencies 合法且须为 registry 最新版`,options:[{flags:`--cwd <v>`,description:`目标仓根目录,默认当前目录`},{flags:`--format <text|json>`,defaultValue:`text`,description:`输出格式,默认 text`}],schema:Bu,action:async e=>{let t=new lt(ut(e.format)),n=c(e.cwd??`.`),r;try{r=await Lu(n,zu)}catch(e){t.error(e),process.exit(1)}if(!r.applicable)t.info(`当前仓为插件源仓,声明政策不适用,跳过检查`);else if(r.violations.length===0)t.success({versionChecked:r.versionChecked.length},`[SUCCESS] lzi-oxlint check 通过|根开发依赖 ${r.versionChecked.length} 项全部为最新版且无非根声明`);else{if(e.format===`json`)process.stdout.write(`${JSON.stringify({success:!1,data:{violations:r.violations}},null,2)}\n`);else{let e=r.violations.map(e=>[e.manifestPath,Vu[e.kind]??e.kind,e.name,e.specifier,e.expected??`—`]);t.table([`位置`,`判据`,`包名`,`声明值`,`应然值`],e)}process.stderr.write(`错误: lzi-oxlint check 发现 ${r.violations.length} 项违规|政策:插件域依赖只能声明在根 devDependencies 且必须为最新版\n`),process.exit(1)}}})}const Uu={apiEndpoint:`http://localhost:3000`,defaultSeverity:`warn`,logLevel:`info`};function Wu(){return s(t(),`.lzi`,`oxlint`,`config.json`)}const Gu=Zl({format:ou([`text`,`json`]).default(`text`)});function Ku(e){let t=e.command(`config`).description(`管理 CLI 配置`);gt(t,{name:`init`,description:`初始化默认配置`,options:[{flags:`--format <text|json>`,defaultValue:`text`}],schema:Gu,action:async e=>{let t=new lt(ut(e.format)),n=Wu(),a=s(n,`..`);r(a)||i(a,{recursive:!0}),o(n,JSON.stringify(Uu,null,2),`utf-8`),mt.success(`配置已初始化`),t.success({configPath:n,config:Uu},`配置初始化成功`)}}),gt(t,{name:`show`,description:`显示当前配置`,options:[{flags:`--format <text|json>`,defaultValue:`text`}],schema:Gu,action:async e=>{let t=new lt(ut(e.format)),n=Wu();if(!r(n)){t.warn(`配置文件不存在,请先运行 config init`);return}let i=a(n,`utf-8`);t.success(JSON.parse(i),`当前配置`)}})}function qu(e){return Array.isArray(e)}var Ju=class{filePath;constructor(e){this.filePath=e;let t=s(e,`..`);r(t)||i(t,{recursive:!0}),r(this.filePath)||o(this.filePath,`[]`,`utf-8`)}read(){let e=a(this.filePath,`utf-8`);try{let t=JSON.parse(e);return qu(t)?t:[]}catch{return[]}}write(e){o(this.filePath,JSON.stringify(e,null,2),`utf-8`)}add(e){let t=this.read();t.push(e),this.write(t)}find(e){return this.read().find(e)}remove(e){let t=this.read().filter(t=>!e(t));this.write(t)}};function Yu(){let e=t();return s(e,`.lzi`,`oxlint`,`rules.json`)}const Xu=Zl({format:ou([`text`,`json`]).default(`text`),id:Q().min(1),name:Q().min(1),plugin:Q().min(1),severity:Q().min(1),description:Q(),createdAt:Q()}),Zu=Zl({format:ou([`text`,`json`]).default(`text`),id:Q().optional(),name:Q().optional(),n:Q().optional(),plugin:Q().optional(),p:Q().optional(),severity:Q().optional(),description:Q().optional(),d:Q().optional()});function Qu(e){let t=e.command(`rule`).description(`管理 oxlint 规则记录`);gt(t,{name:`list`,description:`列出所有规则记录`,options:[{flags:`--format <text|json>`,defaultValue:`text`}],schema:Zl({format:ou([`text`,`json`]).default(`text`)}),action:async e=>{let t=new lt(ut(e.format)),n=new Ju(Yu()).read();n.length===0?t.info(`暂无规则记录`):t.table([`规则标识`,`规则名称`,`插件`,`严重级别`,`创建时间`],n.map(e=>[e.id,e.name,e.plugin,e.severity,e.createdAt]))}}),gt(t,{name:`add`,description:`添加规则记录`,options:[{flags:`--id <id>`,description:`规则标识`},{flags:`-n, --name <name>`,description:`规则名称`},{flags:`-p, --plugin <plugin>`,description:`所属插件`},{flags:`--severity <severity>`,description:`严重级别`},{flags:`-d, --description <description>`,description:`规则描述`},{flags:`--format <text|json>`,defaultValue:`text`}],schema:Zu,action:async e=>{let t=new lt(ut(e.format)),n={id:e.id||await ft(`请输入规则标识`),name:e.name||e.n||await ft(`请输入规则名称`),plugin:e.plugin||e.p||await dt(`请选择所属插件`,[{value:`typescript`,label:`TypeScript`},{value:`unicorn`,label:`Unicorn`},{value:`import`,label:`Import`},{value:`eslint-core`,label:`ESLint Core`},{value:`react`,label:`React`}]),severity:e.severity||await dt(`请选择严重级别`,[{value:`error`,label:`错误`},{value:`warn`,label:`警告`},{value:`off`,label:`关闭`}]),description:e.description||e.d||await ft(`请输入规则描述`),createdAt:(/* @__PURE__ */ new Date()).toISOString()},r=Xu.safeParse(n);r.success?(new Ju(Yu()).add(r.data),mt.success(`规则记录已添加`),t.success(r.data,`规则记录创建成功`)):t.error(/* @__PURE__ */ Error(`规则记录校验失败`))}}),gt(t,{name:`remove`,description:`删除规则记录`,arguments:[{signature:`[id]`,description:`规则标识`}],options:[{flags:`--id <id>`,description:`规则标识`},{flags:`--format <text|json>`,defaultValue:`text`}],schema:Zl({format:ou([`text`,`json`]).default(`text`),id:Q().optional()}),action:async(e,t)=>{let n=new lt(ut(e.format)),r=e.id||t[0]||await ft(`请输入要删除的规则标识`),i=new Ju(Yu());i.find(e=>e.id===r)?await pt(`确认删除规则 ${r} 吗?`)?(i.remove(e=>e.id===r),mt.success(`规则记录已删除`),n.success({id:r},`规则记录删除成功`)):n.info(`已取消删除`):n.warn(`未找到规则标识: ${r}`)}}),t.action(async()=>{await $u()})}async function $u(){let e=await dt(`请选择操作`,[{value:`list`,label:`查看规则列表`,hint:`列出所有 oxlint 规则`},{value:`add`,label:`添加规则记录`,hint:`录入新的 oxlint 规则`},{value:`remove`,label:`删除规则记录`,hint:`移除指定规则`}]),t=new lt(`text`),n=new Ju(Yu());if(e===`list`){let e=n.read();if(e.length===0){t.info(`暂无规则记录`);return}t.table([`规则标识`,`规则名称`,`插件`,`严重级别`,`创建时间`],e.map(e=>[e.id,e.name,e.plugin,e.severity,e.createdAt]))}else if(e===`add`){let e={id:await ft(`请输入规则标识`),name:await ft(`请输入规则名称`),plugin:await dt(`请选择所属插件`,[{value:`typescript`,label:`TypeScript`},{value:`unicorn`,label:`Unicorn`},{value:`import`,label:`Import`},{value:`eslint-core`,label:`ESLint Core`},{value:`react`,label:`React`}]),severity:await dt(`请选择严重级别`,[{value:`error`,label:`错误`},{value:`warn`,label:`警告`},{value:`off`,label:`关闭`}]),description:await ft(`请输入规则描述`),createdAt:(/* @__PURE__ */ new Date()).toISOString()},r=Xu.safeParse(e);if(!r.success){t.error(/* @__PURE__ */ Error(`规则记录校验失败`));return}n.add(r.data),mt.success(`规则记录已添加`),t.success(r.data,`规则记录创建成功`)}else if(e===`remove`){let e=await ft(`请输入要删除的规则标识`);if(!n.find(t=>t.id===e)){t.warn(`未找到规则标识: ${e}`);return}if(!await pt(`确认删除规则 ${e} 吗?`)){t.info(`已取消删除`);return}n.remove(t=>t.id===e),mt.success(`规则记录已删除`),t.success({id:e},`规则记录删除成功`)}}function ed(e){Qu(e),Ku(e),Hu(e)}async function td(){let e=ct({name:`lzi-oxlint`,description:`Longzai Intelligence oxlint CLI`,interaction:Fn,color:Pn});ed(e),await e.parseAsync(process.argv)}await td();export{};
|
|
188
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function cc(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;cc(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const lc=/* @__PURE__ */ new Set([`type`,`properties`,`required`,`additionalProperties`]),uc=[`oneOf`,`anyOf`];function dc(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function fc(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!lc.has(e))return null;t.push(n)}let n={},r=/* @__PURE__ */ new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??dc(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}Un(n,r,e.length===1?e[0]:fc(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=dc(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function pc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of lc)if(t in e)return;let n=t.filter(e=>uc.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=fc(t);else{let e=n[0],i=uc.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>fc([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,rc(e,r))}function mc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):rc(i,s),rc(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())cc(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=/* @__PURE__ */ new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])pc(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}rc(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,Un(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:gc(t,`input`,e.processors),output:gc(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Y(e,t){let n=t??{seen:/* @__PURE__ */ new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Y(r.element,n);if(r.type===`set`)return Y(r.valueType,n);if(r.type===`lazy`)return Y(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return Y(r.innerType,n);if(r.type===`intersection`)return Y(r.left,n)||Y(r.right,n);if(r.type===`record`||r.type===`map`)return Y(r.keyType,n)||Y(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Y(r.in,n)||Y(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Y(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Y(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Y(e,n))return!0;return!!(r.rest&&Y(r.rest,n))}return!1}const hc=(e,t={})=>n=>{let r=ic({...n,processors:t});return J(e,r),sc(r,e),mc(r,e)},gc=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ic({...i??{},target:a,io:t,processors:n});return J(e,o),sc(o,e),mc(o,e)},_c=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},vc=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},yc=(e,t)=>{_c(e,`minimum`,t),vc(e,`maximum`,t)},bc=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},xc=(e,t)=>{e.patterns??=/* @__PURE__ */ new Set,e.patterns.add(t)},Sc=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Cc=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},wc=(e,t)=>_c(e,`minimum`,t.minimum),Tc=(e,t)=>vc(e,`maximum`,t.maximum),Ec=e=>(t,n)=>{Cc(t,n.format);let[r,i]=e[n.format];_c(t,`minimum`,r),vc(t,`maximum`,i)},Dc={greater_than:(e,t)=>_c(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>vc(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>bc(e,t.value),number_format:Ec(cr),bigint_format:Ec(lr),min_length:wc,max_length:Tc,length_equals:(e,t)=>yc(e,t.length),min_size:wc,max_size:Tc,size_equals:(e,t)=>yc(e,t.size),string_format:(e,t)=>{Cc(e,t.format),t.pattern&&xc(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Sc(e,t.mime)};function Oc(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Dc[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&_c(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&_c(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&vc(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&vc(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&bc(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Sc(t,i.mime);for(let e of i.patterns??[])xc(t,e);return t}const kc={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Ac=/* @__PURE__ */ new Map([[Xa,Bi],[Qa,Vi]]),jc=e=>Ac.get(e)??e,Mc=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Oc(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=kc[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(jc);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Nc=(e,t,n,r)=>{n.not={}},Pc=(e,t,n,r)=>{let i=e._zod.def,a=In(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},Fc=(e,t,n,r)=>{ac(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Ic=(e,t,n,r)=>{ac(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Lc=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Oc(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=J(a.element,t,{...r,path:[...r.path,`items`]})};function Rc(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Rc(t.out):t.type===`catch`?Rc(t.innerType):e._zod.optin}const zc=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&ac(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)Un(i.properties,e,J(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Rc(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=J(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Bc=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>J(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Vc=(e,t,n,r)=>{let i=e._zod.def,a=J(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=J(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function Hc(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Hc(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Hc(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?Qi:Zi).source)),p}const Uc=/* @__PURE__ */ new WeakMap;function Wc(e){let t=/* @__PURE__ */ new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=/* @__PURE__ */ new Map;for(let r of Uc.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Hc(t,a,/* @__PURE__ */ new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}const Gc=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=Oc(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=J(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)Un(i.patternProperties,jc(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=J(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Uc.get(t);n||(n=[],Uc.set(t,n),t.deferred.push(()=>Wc(t))),n.push(e)}i.additionalProperties=J(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Rc(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Kc=(e,t,n,r)=>{let i=e._zod.def,a=J(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},qc=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Jc=Symbol();function Yc(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(ac(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Jc):JSON.parse(o)}const Xc=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Yc(i.defaultValue,e,t,n,r);o!==Jc&&(n.default=o)},Zc=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Yc(i.defaultValue,e,t,n,r);o!==Jc&&(n._prefault=o)},Qc=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{ac(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},$c=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;J(o,t,r);let s=t.seen.get(e);s.ref=o},el=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},tl=(e,t,n,r)=>{let i=e._zod.def;J(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},nl=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]);function rl(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}const X=/*@__PURE__*/ G(`ZodError`,(e,t)=>{ti.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);nl.has(n)||(nl.add(n),rl(n,`format`,e=>t=>ii(e,t)),rl(n,`flatten`,e=>t=>ri(e,t)),rl(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Rn,2)}),rl(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Rn,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),il=/* @__PURE__ */ oi(X),al=/* @__PURE__ */ si(X),ol=/* @__PURE__ */ ci(X),sl=/* @__PURE__ */ ui(X),cl=/* @__PURE__ */ gi(X),ll=/* @__PURE__ */ _i(X),ul=/* @__PURE__ */ vi(X),dl=/* @__PURE__ */ yi(X),fl=/* @__PURE__ */ bi(X),pl=/* @__PURE__ */ xi(X),ml=/* @__PURE__ */ Si(X),hl=/* @__PURE__ */ Ci(X);function gl(){Jr.localeError||Yr(rs())}function _l(){Jr.memoizer||Yr({memoizer:es()})}const Z=/*@__PURE__*/ G(`ZodType`,(e,t)=>(gl(),K.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(H(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ar(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Du(e,t))},superRefine(e,t){return this.check(Ou(e,t))},overwrite(e){return this.check(/* @__PURE__ */ qs(e))},optional(){return lu(this)},exactOptional(){return du(this)},nullable(){return pu(this)},nullish(){return lu(pu(this))},nonoptional(e){return yu(this,e)},array(){return Jl(this)},or(e){return $l([this,e])},and(e){return tu(this,e)},transform(e){return Cu(this,su(e))},default(e){return hu(this,e)},prefault(e){return _u(this,e)},catch(e){return xu(this,e)},pipe(e){return Cu(this,e)},readonly(){return Tu(this)},describe(e){let t=this.clone();return ss.add(t,{description:e}),t},meta(...e){if(e.length===0)return ss.get(this);let t=this.clone();return ss.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Nr(this,`~standard`,{...va(this),jsonSchema:{input:gc(this,`input`),output:gc(this,`output`)}})},set"~standard"(e){Mr(this,`~standard`,e)},parse:function e(t,n){return il(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await al(this,t,n,{callee:e})},safeParse(e,t){return ol(this,e,t)},async safeParseAsync(e,t){return sl(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Mr(this,`spa`,e)},validate(e,t){return pi(this,e,t)},validateAsync(e,t){return hi(this,e,t)},encode:function e(t,n){return cl(this,t,n,{callee:e})},decode:function e(t,n){return ll(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await ul(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await dl(this,t,n,{callee:e})},safeEncode(e,t){return fl(this,e,t)},safeDecode(e,t){return pl(this,e,t)},async safeEncodeAsync(e,t){return ml(this,e,t)},async safeDecodeAsync(e,t){return hl(this,e,t)},toJSONSchema(e){return hc(this,{})(e)},get description(){return ss.get(this)?.description},get _def(){return this._zod.def}}),vl=/*@__PURE__*/ G(`_ZodString`,(e,t)=>{ya.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mc(e,t,n,r)},/*@__PURE__*/ Pr({format:e=>Oc(e).format??null,minLength:e=>Oc(e).minimum??null,maxLength:e=>Oc(e).maximum??null},{regex(...e){return this.check(/* @__PURE__ */ Vs(...e))},includes(...e){return this.check(/* @__PURE__ */ Ws(...e))},startsWith(...e){return this.check(/* @__PURE__ */ Gs(...e))},endsWith(...e){return this.check(/* @__PURE__ */ Ks(...e))},min(...e){return this.check(/* @__PURE__ */ zs(...e))},max(...e){return this.check(/* @__PURE__ */ Rs(...e))},length(...e){return this.check(/* @__PURE__ */ Bs(...e))},nonempty(...e){return this.check(/* @__PURE__ */ zs(1,...e))},lowercase(e){return this.check(/* @__PURE__ */ Hs(e))},uppercase(e){return this.check(/* @__PURE__ */ Us(e))},trim(){return this.check(/* @__PURE__ */ Ys())},normalize(...e){return this.check(/* @__PURE__ */ Js(...e))},toLowerCase(){return this.check(/* @__PURE__ */ Xs())},toUpperCase(){return this.check(/* @__PURE__ */ Zs())},slugify(){return this.check(/* @__PURE__ */ Qs())}})),yl=/*@__PURE__*/ G(`ZodString`,(e,t)=>{ya.init(e,t),vl.init(e,t)},{email(e){return this.check(/* @__PURE__ */ us(wl,e))},url(e){return this.check(/* @__PURE__ */ gs(Dl,e))},jwt(e){return this.check(/* @__PURE__ */ js(Hl,e))},emoji(e){return this.check(/* @__PURE__ */ _s(Ol,e))},guid(e){return this.check(/* @__PURE__ */ ds(Tl,e))},uuid(e){return this.check(/* @__PURE__ */ fs(El,e))},uuidv4(e){return this.check(/* @__PURE__ */ ps(El,e))},uuidv6(e){return this.check(/* @__PURE__ */ ms(El,e))},uuidv7(e){return this.check(/* @__PURE__ */ hs(El,e))},nanoid(e){return this.check(/* @__PURE__ */ vs(kl,e))},cuid(e){return this.check(/* @__PURE__ */ ys(Al,e))},cuid2(e){return this.check(/* @__PURE__ */ bs(jl,e))},ulid(e){return this.check(/* @__PURE__ */ xs(Ml,e))},base64(e){return this.check(/* @__PURE__ */ Os(zl,e))},base64url(e){return this.check(/* @__PURE__ */ ks(Bl,e))},xid(e){return this.check(/* @__PURE__ */ Ss(Nl,e))},ksuid(e){return this.check(/* @__PURE__ */ Cs(Pl,e))},ipv4(e){return this.check(/* @__PURE__ */ ws(Fl,e))},ipv6(e){return this.check(/* @__PURE__ */ Ts(Il,e))},cidrv4(e){return this.check(/* @__PURE__ */ Es(Ll,e))},cidrv6(e){return this.check(/* @__PURE__ */ Ds(Rl,e))},e164(e){return this.check(/* @__PURE__ */ As(Vl,e))},datetime(e){return this.check(/* @__PURE__ */ Ms(bl,e))},date(e){return this.check(/* @__PURE__ */ Ns(xl,e))},time(e){return this.check(/* @__PURE__ */ Ps(Sl,e))},duration(e){return this.check(/* @__PURE__ */ Fs(Cl,e))}});function Q(e){return/* @__PURE__ */ ls(yl,e)}const $=/*@__PURE__*/ G(`ZodStringFormat`,(e,t)=>{q.init(e,t),vl.init(e,t)}),bl=/*@__PURE__*/ G(`ZodISODateTime`,(e,t)=>{Ra.init(e,t),$.init(e,t)}),xl=/*@__PURE__*/ G(`ZodISODate`,(e,t)=>{za.init(e,t),$.init(e,t)}),Sl=/*@__PURE__*/ G(`ZodISOTime`,(e,t)=>{Ba.init(e,t),$.init(e,t)}),Cl=/*@__PURE__*/ G(`ZodISODuration`,(e,t)=>{Va.init(e,t),$.init(e,t)}),wl=/*@__PURE__*/ G(`ZodEmail`,(e,t)=>{Sa.init(e,t),$.init(e,t)}),Tl=/*@__PURE__*/ G(`ZodGUID`,(e,t)=>{ba.init(e,t),$.init(e,t)}),El=/*@__PURE__*/ G(`ZodUUID`,(e,t)=>{xa.init(e,t),$.init(e,t)}),Dl=/*@__PURE__*/ G(`ZodURL`,(e,t)=>{Aa.init(e,t),$.init(e,t)}),Ol=/*@__PURE__*/ G(`ZodEmoji`,(e,t)=>{ja.init(e,t),$.init(e,t)}),kl=/*@__PURE__*/ G(`ZodNanoID`,(e,t)=>{Ma.init(e,t),$.init(e,t)}),Al=/*@__PURE__*/ G(`ZodCUID`,(e,t)=>{Na.init(e,t),$.init(e,t)}),jl=/*@__PURE__*/ G(`ZodCUID2`,(e,t)=>{Pa.init(e,t),$.init(e,t)}),Ml=/*@__PURE__*/ G(`ZodULID`,(e,t)=>{Fa.init(e,t),$.init(e,t)}),Nl=/*@__PURE__*/ G(`ZodXID`,(e,t)=>{Ia.init(e,t),$.init(e,t)}),Pl=/*@__PURE__*/ G(`ZodKSUID`,(e,t)=>{La.init(e,t),$.init(e,t)}),Fl=/*@__PURE__*/ G(`ZodIPv4`,(e,t)=>{Ha.init(e,t),$.init(e,t)}),Il=/*@__PURE__*/ G(`ZodIPv6`,(e,t)=>{Ga.init(e,t),$.init(e,t)}),Ll=/*@__PURE__*/ G(`ZodCIDRv4`,(e,t)=>{Ka.init(e,t),$.init(e,t)}),Rl=/*@__PURE__*/ G(`ZodCIDRv6`,(e,t)=>{Ja.init(e,t),$.init(e,t)}),zl=/*@__PURE__*/ G(`ZodBase64`,(e,t)=>{Za.init(e,t),$.init(e,t)}),Bl=/*@__PURE__*/ G(`ZodBase64URL`,(e,t)=>{eo.init(e,t),$.init(e,t)}),Vl=/*@__PURE__*/ G(`ZodE164`,(e,t)=>{to.init(e,t),$.init(e,t)}),Hl=/*@__PURE__*/ G(`ZodJWT`,(e,t)=>{ro.init(e,t),$.init(e,t)}),Ul=/*@__PURE__*/ G(`ZodUnknown`,(e,t)=>{io.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Wl(){return/* @__PURE__ */ Is(Ul)}const Gl=/*@__PURE__*/ G(`ZodNever`,(e,t)=>{ao.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nc(e,t,n,r)});function Kl(e){return/* @__PURE__ */ Ls(Gl,e)}const ql=/*@__PURE__*/ G(`ZodArray`,(e,t)=>{_l(),lo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lc(e,t,n,r),e.element=t.element},{min(e,t){return this.check(/* @__PURE__ */ zs(e,t))},nonempty(e){return this.check(/* @__PURE__ */ zs(1,e))},max(e,t){return this.check(/* @__PURE__ */ Rs(e,t))},length(e,t){return this.check(/* @__PURE__ */ Bs(e,t))},unwrap(){return this.element}});function Jl(e,t){return/* @__PURE__ */ $s(ql,e,t)}const Yl=/*@__PURE__*/ G(`ZodObject`,(e,t)=>{_l(),go.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zc(e,t,n,r),Br(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return au(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(H(this._zod.def,{catchall:e}))},passthrough(){return this.clone(H(this._zod.def,{catchall:Wl()}))},loose(){return this.clone(H(this._zod.def,{catchall:Wl()}))},strict(){return this.clone(H(this._zod.def,{catchall:Kl()}))},strip(){return this.clone(H(this._zod.def,{catchall:void 0}))},extend(e){return pr(this,e)},safeExtend(e){return hr(this,e)},merge(e){return gr(this,e)},pick(e){return ur(this,e)},omit(e){return fr(this,e)},partial(...e){return _r(cu,this,e[0])},exactPartial(...e){return _r(uu,this,e[0],`exactPartial`)},required(...e){return vr(vu,this,e[0])}});function Xl(e,t){let n={type:`object`,shape:e??{},...U(t)};return new Yl(n)}function Zl(e,t){return new Yl({type:`object`,shape:e,catchall:Wl(),...U(t)})}const Ql=/*@__PURE__*/ G(`ZodUnion`,(e,t)=>{vo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bc(e,t,n,r),e.options=t.options});function $l(e,t){return new Ql({type:`union`,options:e,...U(t)})}const eu=/*@__PURE__*/ G(`ZodIntersection`,(e,t)=>{yo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vc(e,t,n,r)});function tu(e,t){return new eu({type:`intersection`,left:e,right:t})}const nu=/*@__PURE__*/ G(`ZodRecord`,(e,t)=>{_l(),So.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gc(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function ru(e,t,n){return!t||!t._zod?new nu({type:`record`,keyType:Q(),valueType:e,...U(t)}):new nu({type:`record`,keyType:e,valueType:t,...U(n)})}const iu=/*@__PURE__*/ G(`ZodEnum`,(e,t)=>{Co.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pc(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new iu({...t,checks:[],...U(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new iu({...t,checks:[],...U(r),entries:i})}});function au(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new iu({type:`enum`,entries:n,...U(t)})}const ou=/*@__PURE__*/ G(`ZodTransform`,(e,t)=>{_l(),wo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ic(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new qr(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ar(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Ar(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function su(e){return new ou({type:`transform`,transform:e})}const cu=/*@__PURE__*/ G(`ZodOptional`,(e,t)=>{Eo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function lu(e){return new cu({type:`optional`,innerType:e})}const uu=/*@__PURE__*/ G(`ZodExactOptional`,(e,t)=>{Do.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function du(e){return new uu({type:`optional`,innerType:e})}const fu=/*@__PURE__*/ G(`ZodNullable`,(e,t)=>{Oo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pu(e){return new fu({type:`nullable`,innerType:e})}const mu=/*@__PURE__*/ G(`ZodDefault`,(e,t)=>{ko.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function hu(e,t){return new mu({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():nr(t)}})}const gu=/*@__PURE__*/ G(`ZodPrefault`,(e,t)=>{jo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _u(e,t){return new gu({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():nr(t)}})}const vu=/*@__PURE__*/ G(`ZodNonOptional`,(e,t)=>{Mo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yu(e,t){return new vu({type:`nonoptional`,innerType:e,...U(t)})}const bu=/*@__PURE__*/ G(`ZodCatch`,(e,t)=>{Fo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function xu(e,t){return new bu({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Vr(t)})}const Su=/*@__PURE__*/ G(`ZodPipe`,(e,t)=>{Io.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$c(e,t,n,r),e.in=t.in,e.out=t.out});function Cu(e,t){return new Su({type:`pipe`,in:e,out:t})}const wu=/*@__PURE__*/ G(`ZodReadonly`,(e,t)=>{Ro.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>el(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Tu(e){return new wu({type:`readonly`,innerType:e})}const Eu=/*@__PURE__*/ G(`ZodCustom`,(e,t)=>{Bo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fc(e,t,n,r)});function Du(e,t={}){return/* @__PURE__ */ ec(Eu,e,t)}function Ou(e,t){return/* @__PURE__ */ tc(e,t)}const ku=[`dependencies`,`devDependencies`,`peerDependencies`,`optionalDependencies`],Au=[`dependencies`,`peerDependencies`,`optionalDependencies`],ju=ru(Q(),Q()),Mu=Zl({name:Q().optional(),workspaces:$l([Jl(Q()),Xl({packages:Jl(Q()).optional()})]).optional(),dependencies:ju.optional(),devDependencies:ju.optional(),peerDependencies:ju.optional(),optionalDependencies:ju.optional()});function Nu(e){let t=a(e,`utf8`),n=Mu.safeParse(JSON.parse(t));if(!n.success)throw Error(`package.json 结构不符合预期:${e}`);return n.data}function Pu(e){return Object.entries(e??{}).filter(([e])=>e.startsWith(`@longzai-intelligence-oxlint/`))}function Fu(e,t){let n=Array.isArray(t)?t:t?.packages??[],r=/* @__PURE__ */ new Set;for(let t of n){let n=new Bun.Glob(`${t}/package.json`);for(let t of n.scanSync({cwd:e}))t.includes(`node_modules/`)||r.add(t)}return[...r].sort()}async function Iu(e,t){let n=Nu(s(e,`package.json`));if(n.name===`@longzai-intelligence-oxlint/root`)return{applicable:!1,versionChecked:[],violations:[]};let r=Fu(e,n.workspaces),i=[];for(let t of r){let n=Nu(s(e,t));for(let e of ku)for(let[r,a]of Pu(n[e]))i.push({kind:`non-root`,manifestPath:t,field:e,name:r,specifier:a})}for(let e of Au)for(let[t,r]of Pu(n[e]))i.push({kind:`root-placement`,manifestPath:`package.json`,field:e,name:t,specifier:r});let a=[],o=Pu(n.devDependencies);return await Promise.all(o.map(async([e,n])=>{if(n.startsWith(`workspace:`))return;a.push(e);let r=await t(e);n!==r&&i.push({kind:`version`,manifestPath:`package.json`,field:`devDependencies`,name:e,specifier:n,expected:r})})),{applicable:!0,versionChecked:a,violations:i}}const Lu=Xl({"dist-tags":Xl({latest:Q().optional()})});async function Ru(e){let t=`https://registry.npmjs.org/${encodeURIComponent(e)}`,n=await fetch(t);if(!n.ok)throw Error(`registry 查询失败:${e} 响应状态 ${n.status}`);let r=Lu.safeParse(await n.json());if(!r.success)throw Error(`registry 元数据结构异常:${e}`);let i=r.data[`dist-tags`]?.latest;if(!i)throw Error(`registry 元数据缺失 latest 标签:${e}`);return i}const zu=Zl({cwd:Q().optional(),format:au([`text`,`json`]).optional()}),Bu={"non-root":`非根声明`,"root-placement":`根位置误置`,version:`版本非最新`};function Vu(e){gt(e,{name:`check`,description:`插件域依赖声明检查——仅根 devDependencies 合法且须为 registry 最新版`,options:[{flags:`--cwd <v>`,description:`目标仓根目录,默认当前目录`},{flags:`--format <text|json>`,defaultValue:`text`,description:`输出格式,默认 text`}],schema:zu,action:async e=>{let t=new lt(ut(e.format)),n=c(e.cwd??`.`),r;try{r=await Iu(n,Ru)}catch(e){t.error(e),process.exit(1)}if(!r.applicable)t.info(`当前仓为插件源仓,声明政策不适用,跳过检查`);else if(r.violations.length===0)t.success({versionChecked:r.versionChecked.length},`[SUCCESS] lzi-oxlint check 通过|根开发依赖 ${r.versionChecked.length} 项全部为最新版且无非根声明`);else{if(e.format===`json`)process.stdout.write(`${JSON.stringify({success:!1,data:{violations:r.violations}},null,2)}\n`);else{let e=r.violations.map(e=>[e.manifestPath,Bu[e.kind]??e.kind,e.name,e.specifier,e.expected??`—`]);t.table([`位置`,`判据`,`包名`,`声明值`,`应然值`],e)}process.stderr.write(`错误: lzi-oxlint check 发现 ${r.violations.length} 项违规|政策:插件域依赖只能声明在根 devDependencies 且必须为最新版\n`),process.exit(1)}}})}const Hu={apiEndpoint:`http://localhost:3000`,defaultSeverity:`warn`,logLevel:`info`};function Uu(){return s(t(),`.lzi`,`oxlint`,`config.json`)}const Wu=Xl({format:au([`text`,`json`]).default(`text`)});function Gu(e){let t=e.command(`config`).description(`管理 CLI 配置`);gt(t,{name:`init`,description:`初始化默认配置`,options:[{flags:`--format <text|json>`,defaultValue:`text`}],schema:Wu,action:async e=>{let t=new lt(ut(e.format)),n=Uu(),a=s(n,`..`);r(a)||i(a,{recursive:!0}),o(n,JSON.stringify(Hu,null,2),`utf-8`),mt.success(`配置已初始化`),t.success({configPath:n,config:Hu},`配置初始化成功`)}}),gt(t,{name:`show`,description:`显示当前配置`,options:[{flags:`--format <text|json>`,defaultValue:`text`}],schema:Wu,action:async e=>{let t=new lt(ut(e.format)),n=Uu();if(!r(n)){t.warn(`配置文件不存在,请先运行 config init`);return}let i=a(n,`utf-8`);t.success(JSON.parse(i),`当前配置`)}})}function Ku(e){return Array.isArray(e)}var qu=class{filePath;constructor(e){this.filePath=e;let t=s(e,`..`);r(t)||i(t,{recursive:!0}),r(this.filePath)||o(this.filePath,`[]`,`utf-8`)}read(){let e=a(this.filePath,`utf-8`);try{let t=JSON.parse(e);return Ku(t)?t:[]}catch{return[]}}write(e){o(this.filePath,JSON.stringify(e,null,2),`utf-8`)}add(e){let t=this.read();t.push(e),this.write(t)}find(e){return this.read().find(e)}remove(e){let t=this.read().filter(t=>!e(t));this.write(t)}};function Ju(){let e=t();return s(e,`.lzi`,`oxlint`,`rules.json`)}const Yu=Xl({format:au([`text`,`json`]).default(`text`),id:Q().min(1),name:Q().min(1),plugin:Q().min(1),severity:Q().min(1),description:Q(),createdAt:Q()}),Xu=Xl({format:au([`text`,`json`]).default(`text`),id:Q().optional(),name:Q().optional(),n:Q().optional(),plugin:Q().optional(),p:Q().optional(),severity:Q().optional(),description:Q().optional(),d:Q().optional()});function Zu(e){let t=e.command(`rule`).description(`管理 oxlint 规则记录`);gt(t,{name:`list`,description:`列出所有规则记录`,options:[{flags:`--format <text|json>`,defaultValue:`text`}],schema:Xl({format:au([`text`,`json`]).default(`text`)}),action:async e=>{let t=new lt(ut(e.format)),n=new qu(Ju()).read();n.length===0?t.info(`暂无规则记录`):t.table([`规则标识`,`规则名称`,`插件`,`严重级别`,`创建时间`],n.map(e=>[e.id,e.name,e.plugin,e.severity,e.createdAt]))}}),gt(t,{name:`add`,description:`添加规则记录`,options:[{flags:`--id <id>`,description:`规则标识`},{flags:`-n, --name <name>`,description:`规则名称`},{flags:`-p, --plugin <plugin>`,description:`所属插件`},{flags:`--severity <severity>`,description:`严重级别`},{flags:`-d, --description <description>`,description:`规则描述`},{flags:`--format <text|json>`,defaultValue:`text`}],schema:Xu,action:async e=>{let t=new lt(ut(e.format)),n={id:e.id||await ft(`请输入规则标识`),name:e.name||e.n||await ft(`请输入规则名称`),plugin:e.plugin||e.p||await dt(`请选择所属插件`,[{value:`typescript`,label:`TypeScript`},{value:`unicorn`,label:`Unicorn`},{value:`import`,label:`Import`},{value:`eslint-core`,label:`ESLint Core`},{value:`react`,label:`React`}]),severity:e.severity||await dt(`请选择严重级别`,[{value:`error`,label:`错误`},{value:`warn`,label:`警告`},{value:`off`,label:`关闭`}]),description:e.description||e.d||await ft(`请输入规则描述`),createdAt:(/* @__PURE__ */ new Date()).toISOString()},r=Yu.safeParse(n);r.success?(new qu(Ju()).add(r.data),mt.success(`规则记录已添加`),t.success(r.data,`规则记录创建成功`)):t.error(/* @__PURE__ */ Error(`规则记录校验失败`))}}),gt(t,{name:`remove`,description:`删除规则记录`,arguments:[{signature:`[id]`,description:`规则标识`}],options:[{flags:`--id <id>`,description:`规则标识`},{flags:`--format <text|json>`,defaultValue:`text`}],schema:Xl({format:au([`text`,`json`]).default(`text`),id:Q().optional()}),action:async(e,t)=>{let n=new lt(ut(e.format)),r=e.id||t[0]||await ft(`请输入要删除的规则标识`),i=new qu(Ju());i.find(e=>e.id===r)?await pt(`确认删除规则 ${r} 吗?`)?(i.remove(e=>e.id===r),mt.success(`规则记录已删除`),n.success({id:r},`规则记录删除成功`)):n.info(`已取消删除`):n.warn(`未找到规则标识: ${r}`)}}),t.action(async()=>{await Qu()})}async function Qu(){let e=await dt(`请选择操作`,[{value:`list`,label:`查看规则列表`,hint:`列出所有 oxlint 规则`},{value:`add`,label:`添加规则记录`,hint:`录入新的 oxlint 规则`},{value:`remove`,label:`删除规则记录`,hint:`移除指定规则`}]),t=new lt(`text`),n=new qu(Ju());if(e===`list`){let e=n.read();if(e.length===0){t.info(`暂无规则记录`);return}t.table([`规则标识`,`规则名称`,`插件`,`严重级别`,`创建时间`],e.map(e=>[e.id,e.name,e.plugin,e.severity,e.createdAt]))}else if(e===`add`){let e={id:await ft(`请输入规则标识`),name:await ft(`请输入规则名称`),plugin:await dt(`请选择所属插件`,[{value:`typescript`,label:`TypeScript`},{value:`unicorn`,label:`Unicorn`},{value:`import`,label:`Import`},{value:`eslint-core`,label:`ESLint Core`},{value:`react`,label:`React`}]),severity:await dt(`请选择严重级别`,[{value:`error`,label:`错误`},{value:`warn`,label:`警告`},{value:`off`,label:`关闭`}]),description:await ft(`请输入规则描述`),createdAt:(/* @__PURE__ */ new Date()).toISOString()},r=Yu.safeParse(e);if(!r.success){t.error(/* @__PURE__ */ Error(`规则记录校验失败`));return}n.add(r.data),mt.success(`规则记录已添加`),t.success(r.data,`规则记录创建成功`)}else if(e===`remove`){let e=await ft(`请输入要删除的规则标识`);if(!n.find(t=>t.id===e)){t.warn(`未找到规则标识: ${e}`);return}if(!await pt(`确认删除规则 ${e} 吗?`)){t.info(`已取消删除`);return}n.remove(t=>t.id===e),mt.success(`规则记录已删除`),t.success({id:e},`规则记录删除成功`)}}function $u(e){Zu(e),Gu(e),Vu(e)}async function ed(){let e=ct({name:`lzi-oxlint`,description:`Longzai Intelligence oxlint CLI`,interaction:Fn,color:Pn});$u(e),await e.parseAsync(process.argv)}await ed();export{};
|