@voiden/runner 2.3.0-beta.12 → 2.3.0-beta.13
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/CHANGELOG.md +6 -0
- package/bundled-runners/versions.json +1 -1
- package/bundled-runners/voiden-faker-runner.js +12 -5
- package/bundled-runners/voiden-mcp-tool-runner.js +3 -3
- package/bundled-runners/voiden-rest-api-runner.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcpServing.d.ts.map +1 -1
- package/dist/mcpServing.js +8 -4
- package/dist/mcpServing.js.map +1 -1
- package/dist/runner.d.ts +9 -0
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +44 -3
- package/dist/runner.js.map +1 -1
- package/dist/toolRegistry.d.ts +5 -2
- package/dist/toolRegistry.d.ts.map +1 -1
- package/dist/toolRegistry.js.map +1 -1
- package/package.json +2 -2
|
@@ -136,8 +136,8 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
|
|
|
136
136
|
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
137
137
|
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Ws(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",i=[];if(r&&t.sep&&!t.value){let a=[];for(let o=0;o<t.sep.length;++o){let l=t.sep[o];switch(l.type){case"newline":a.push(o);break;case"space":break;case"comment":l.indent>e.indent&&(a.length=0);break;default:a.length=0}}a.length>=2&&(i=t.sep.splice(a[1]))}switch(this.type){case"anchor":case"tag":r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Se(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if($o(t.key)&&!Se(t.sep,"newline")){let a=lt(t.start),o=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:o,sep:l}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else if(Se(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let a=lt(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):Se(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let a=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:a,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(a):(Object.assign(t,{key:a,sep:[]}),this.onKeyLine=!0);return}default:{let a=this.startBlockValue(e);if(a){if(a.type==="block-seq"){if(!t.explicitKey&&t.sep&&!Se(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(a);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Ws(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||Se(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:r,sep:[]}):t.sep?this.stack.push(r):Object.assign(t,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let r=zs(n),i=lt(r);Do(e);let a=e.end.splice(1,e.end.length);a.push(this.sourceToken);let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
|
|
138
138
|
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
139
|
-
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=zs(e),n=lt(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=zs(e),n=lt(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Zo.Parser=Rr});var Uo=_(Kt=>{"use strict";var Ro=Cr(),Vf=Dt(),Ft=Rt(),Bf=kn(),Uf=q(),Ff=Zr(),jo=jr();function Vo(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new Ff.LineCounter||null,prettyErrors:e}}function Kf(s,e={}){let{lineCounter:t,prettyErrors:n}=Vo(e),r=new jo.Parser(t?.addNewLine),i=new Ro.Composer(e),a=Array.from(i.compose(r.parse(s)));if(n&&t)for(let o of a)o.errors.forEach(Ft.prettifyError(s,t)),o.warnings.forEach(Ft.prettifyError(s,t));return a.length>0?a:Object.assign([],{empty:!0},i.streamInfo())}function Bo(s,e={}){let{lineCounter:t,prettyErrors:n}=Vo(e),r=new jo.Parser(t?.addNewLine),i=new Ro.Composer(e),a=null;for(let o of i.compose(r.parse(s),!0,s.length))if(!a)a=o;else if(a.options.logLevel!=="silent"){a.errors.push(new Ft.YAMLParseError(o.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(a.errors.forEach(Ft.prettifyError(s,t)),a.warnings.forEach(Ft.prettifyError(s,t))),a}function Yf(s,e,t){let n;typeof e=="function"?n=e:t===void 0&&e&&typeof e=="object"&&(t=e);let r=Bo(s,t);if(!r)return null;if(r.warnings.forEach(i=>Bf.warn(r.options.logLevel,i)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:n},t))}function Jf(s,e,t){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let r=Math.round(t);t=r<1?void 0:r>8?{indent:8}:{indent:r}}if(s===void 0){let{keepUndefined:r}=t??e??{};if(!r)return}return Uf.isDocument(s)&&!n?s.toString(t):new Vf.Document(s,n,t).toString(t)}Kt.parse=Yf;Kt.parseAllDocuments=Kf;Kt.parseDocument=Bo;Kt.stringify=Jf});var Ko=_(M=>{"use strict";var zf=Cr(),Wf=Dt(),Hf=ar(),Vr=Rt(),Gf=wt(),Te=q(),Qf=ve(),Xf=Z(),eh=we(),th=_e(),sh=Ys(),nh=Dr(),rh=Zr(),ih=jr(),Hs=Uo(),Fo=yt();M.Composer=zf.Composer;M.Document=Wf.Document;M.Schema=Hf.Schema;M.YAMLError=Vr.YAMLError;M.YAMLParseError=Vr.YAMLParseError;M.YAMLWarning=Vr.YAMLWarning;M.Alias=Gf.Alias;M.isAlias=Te.isAlias;M.isCollection=Te.isCollection;M.isDocument=Te.isDocument;M.isMap=Te.isMap;M.isNode=Te.isNode;M.isPair=Te.isPair;M.isScalar=Te.isScalar;M.isSeq=Te.isSeq;M.Pair=Qf.Pair;M.Scalar=Xf.Scalar;M.YAMLMap=eh.YAMLMap;M.YAMLSeq=th.YAMLSeq;M.CST=sh;M.Lexer=nh.Lexer;M.LineCounter=rh.LineCounter;M.Parser=ih.Parser;M.parse=Hs.parse;M.parseAllDocuments=Hs.parseAllDocuments;M.parseDocument=Hs.parseDocument;M.stringify=Hs.stringify;M.visit=Fo.visit;M.visitAsync=Fo.visitAsync});var Yt=_($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.getParsedType=$.ZodParsedType=$.objectUtil=$.util=void 0;var Br;(function(s){s.assertEqual=r=>{};function e(r){}s.assertIs=e;function t(r){throw new Error}s.assertNever=t,s.arrayToEnum=r=>{let i={};for(let a of r)i[a]=a;return i},s.getValidEnumValues=r=>{let i=s.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),a={};for(let o of i)a[o]=r[o];return s.objectValues(a)},s.objectValues=r=>s.objectKeys(r).map(function(i){return r[i]}),s.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let i=[];for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&i.push(a);return i},s.find=(r,i)=>{for(let a of r)if(i(a))return a},s.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function n(r,i=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}s.joinValues=n,s.jsonStringifyReplacer=(r,i)=>typeof i=="bigint"?i.toString():i})(Br||($.util=Br={}));var Yo;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(Yo||($.objectUtil=Yo={}));$.ZodParsedType=Br.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var ah=s=>{switch(typeof s){case"undefined":return $.ZodParsedType.undefined;case"string":return $.ZodParsedType.string;case"number":return Number.isNaN(s)?$.ZodParsedType.nan:$.ZodParsedType.number;case"boolean":return $.ZodParsedType.boolean;case"function":return $.ZodParsedType.function;case"bigint":return $.ZodParsedType.bigint;case"symbol":return $.ZodParsedType.symbol;case"object":return Array.isArray(s)?$.ZodParsedType.array:s===null?$.ZodParsedType.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?$.ZodParsedType.promise:typeof Map<"u"&&s instanceof Map?$.ZodParsedType.map:typeof Set<"u"&&s instanceof Set?$.ZodParsedType.set:typeof Date<"u"&&s instanceof Date?$.ZodParsedType.date:$.ZodParsedType.object;default:return $.ZodParsedType.unknown}};$.getParsedType=ah});var Gs=_(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.ZodError=ke.quotelessJson=ke.ZodIssueCode=void 0;var Jo=Yt();ke.ZodIssueCode=Jo.util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var oh=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:");ke.quotelessJson=oh;var Jt=class s extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(i){return i.message},n={_errors:[]},r=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)n._errors.push(t(a));else{let o=n,l=0;for(;l<a.path.length;){let c=a.path[l];l===a.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(t(a))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return r(this),n}static assert(e){if(!(e instanceof s))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Jo.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let i=r.path[0];t[i]=t[i]||[],t[i].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};ke.ZodError=Jt;Jt.create=s=>new Jt(s)});var Fr=_(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});var U=Gs(),Me=Yt(),lh=(s,e)=>{let t;switch(s.code){case U.ZodIssueCode.invalid_type:s.received===Me.ZodParsedType.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case U.ZodIssueCode.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,Me.util.jsonStringifyReplacer)}`;break;case U.ZodIssueCode.unrecognized_keys:t=`Unrecognized key(s) in object: ${Me.util.joinValues(s.keys,", ")}`;break;case U.ZodIssueCode.invalid_union:t="Invalid input";break;case U.ZodIssueCode.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Me.util.joinValues(s.options)}`;break;case U.ZodIssueCode.invalid_enum_value:t=`Invalid enum value. Expected ${Me.util.joinValues(s.options)}, received '${s.received}'`;break;case U.ZodIssueCode.invalid_arguments:t="Invalid function arguments";break;case U.ZodIssueCode.invalid_return_type:t="Invalid function return type";break;case U.ZodIssueCode.invalid_date:t="Invalid date";break;case U.ZodIssueCode.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:Me.util.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case U.ZodIssueCode.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case U.ZodIssueCode.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case U.ZodIssueCode.custom:t="Invalid input";break;case U.ZodIssueCode.invalid_intersection_types:t="Intersection results could not be merged";break;case U.ZodIssueCode.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case U.ZodIssueCode.not_finite:t="Number must be finite";break;default:t=e.defaultError,Me.util.assertNever(s)}return{message:t}};Ur.default=lh});var Qs=_(Ie=>{"use strict";var ch=Ie&&Ie.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.defaultErrorMap=void 0;Ie.setErrorMap=uh;Ie.getErrorMap=dh;var zo=ch(Fr());Ie.defaultErrorMap=zo.default;var Wo=zo.default;function uh(s){Wo=s}function dh(){return Wo}});var Yr=_(D=>{"use strict";var fh=D&&D.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(D,"__esModule",{value:!0});D.isAsync=D.isValid=D.isDirty=D.isAborted=D.OK=D.DIRTY=D.INVALID=D.ParseStatus=D.EMPTY_PATH=D.makeIssue=void 0;D.addIssueToContext=mh;var hh=Qs(),Ho=fh(Fr()),ph=s=>{let{data:e,path:t,errorMaps:n,issueData:r}=s,i=[...t,...r.path||[]],a={...r,path:i};if(r.message!==void 0)return{...r,path:i,message:r.message};let o="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)o=c(a,{data:e,defaultError:o}).message;return{...r,path:i,message:o}};D.makeIssue=ph;D.EMPTY_PATH=[];function mh(s,e){let t=(0,hh.getErrorMap)(),n=(0,D.makeIssue)({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===Ho.default?void 0:Ho.default].filter(r=>!!r)});s.common.issues.push(n)}var Kr=class s{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let r of t){if(r.status==="aborted")return D.INVALID;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let r of t){let i=await r.key,a=await r.value;n.push({key:i,value:a})}return s.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:i,value:a}=r;if(i.status==="aborted"||a.status==="aborted")return D.INVALID;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||r.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}};D.ParseStatus=Kr;D.INVALID=Object.freeze({status:"aborted"});var yh=s=>({status:"dirty",value:s});D.DIRTY=yh;var gh=s=>({status:"valid",value:s});D.OK=gh;var vh=s=>s.status==="aborted";D.isAborted=vh;var bh=s=>s.status==="dirty";D.isDirty=bh;var wh=s=>s.status==="valid";D.isValid=wh;var _h=s=>typeof Promise<"u"&&s instanceof Promise;D.isAsync=_h});var Qo=_(Go=>{"use strict";Object.defineProperty(Go,"__esModule",{value:!0})});var el=_(Xs=>{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});Xs.errorUtil=void 0;var Xo;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e?.message})(Xo||(Xs.errorUtil=Xo={}))});var fl=_(h=>{"use strict";Object.defineProperty(h,"__esModule",{value:!0});h.discriminatedUnion=h.date=h.boolean=h.bigint=h.array=h.any=h.coerce=h.ZodFirstPartyTypeKind=h.late=h.ZodSchema=h.Schema=h.ZodReadonly=h.ZodPipeline=h.ZodBranded=h.BRAND=h.ZodNaN=h.ZodCatch=h.ZodDefault=h.ZodNullable=h.ZodOptional=h.ZodTransformer=h.ZodEffects=h.ZodPromise=h.ZodNativeEnum=h.ZodEnum=h.ZodLiteral=h.ZodLazy=h.ZodFunction=h.ZodSet=h.ZodMap=h.ZodRecord=h.ZodTuple=h.ZodIntersection=h.ZodDiscriminatedUnion=h.ZodUnion=h.ZodObject=h.ZodArray=h.ZodVoid=h.ZodNever=h.ZodUnknown=h.ZodAny=h.ZodNull=h.ZodUndefined=h.ZodSymbol=h.ZodDate=h.ZodBoolean=h.ZodBigInt=h.ZodNumber=h.ZodString=h.ZodType=void 0;h.NEVER=h.void=h.unknown=h.union=h.undefined=h.tuple=h.transformer=h.symbol=h.string=h.strictObject=h.set=h.record=h.promise=h.preprocess=h.pipeline=h.ostring=h.optional=h.onumber=h.oboolean=h.object=h.number=h.nullable=h.null=h.never=h.nativeEnum=h.nan=h.map=h.literal=h.lazy=h.intersection=h.instanceof=h.function=h.enum=h.effect=void 0;h.datetimeRegex=il;h.custom=ol;var w=Gs(),en=Qs(),C=el(),p=Yr(),S=Yt(),Q=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},tl=(s,e)=>{if((0,p.isValid)(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new w.ZodError(s.common.issues);return this._error=t,this._error}}};function P(s){if(!s)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:r}=s;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(a,o)=>{let{message:l}=s;return a.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??n??o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:l??t??o.defaultError}},description:r}}var x=class{get description(){return this._def.description}_getType(e){return(0,S.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0,S.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new p.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,S.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if((0,p.isAsync)(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,S.getParsedType)(e)},r=this._parseSync({data:e,path:n.path,parent:n});return tl(n,r)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,S.getParsedType)(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return(0,p.isValid)(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>(0,p.isValid)(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,S.getParsedType)(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await((0,p.isAsync)(r)?r:Promise.resolve(r));return tl(n,i)}refine(e,t){let n=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,i)=>{let a=e(r),o=()=>i.addIssue({code:w.ZodIssueCode.custom,...n(r)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t=="function"?t(n,r):t),!1))}_refinement(e){return new z({schema:this,typeName:O.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return G.create(this,this._def)}nullable(){return ae.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return de.create(this)}promise(){return Ae.create(this,this._def)}or(e){return Be.create([this,e],this._def)}and(e){return Ue.create(this,e,this._def)}transform(e){return new z({...P(this._def),schema:this,typeName:O.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new ze({...P(this._def),innerType:this,defaultValue:t,typeName:O.ZodDefault})}brand(){return new zt({typeName:O.ZodBranded,type:this,...P(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new We({...P(this._def),innerType:this,catchValue:t,typeName:O.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Wt.create(this,e)}readonly(){return He.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};h.ZodType=x;h.Schema=x;h.ZodSchema=x;var Sh=/^c[^\s-]{8,}$/i,Th=/^[0-9a-z]+$/,kh=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ih=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ch=/^[a-z0-9_-]{21}$/i,Nh=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ah=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Oh=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Eh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Jr,Ph=/^(?:(?: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])$/,xh=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,qh=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Lh=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Mh=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Dh=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nl="((\\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])))",$h=new RegExp(`^${nl}$`);function rl(s){let e="[0-5]\\d";s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`);let t=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Zh(s){return new RegExp(`^${rl(s)}$`)}function il(s){let e=`${nl}T${rl(s)}`,t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Rh(s,e){return!!((e==="v4"||!e)&&Ph.test(s)||(e==="v6"||!e)&&qh.test(s))}function jh(s,e){if(!Nh.test(s))return!1;try{let[t]=s.split(".");if(!t)return!1;let n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(n));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function Vh(s,e){return!!((e==="v4"||!e)&&xh.test(s)||(e==="v6"||!e)&&Lh.test(s))}var Ce=class s extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==S.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(i,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.string,received:i.parsedType}),p.INVALID}let n=new p.ParseStatus,r;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,o=e.data.length<i.value;(a||o)&&(r=this._getOrReturnCtx(e,r),a?(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Oh.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"email",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Jr||(Jr=new RegExp(Eh,"u")),Jr.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"emoji",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Ih.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"uuid",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Ch.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"nanoid",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Sh.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"cuid",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Th.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"cuid2",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")kh.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"ulid",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"url",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"regex",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?il(i).test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?$h.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Zh(i).test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Ah.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"duration",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Rh(e.data,i.version)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"ip",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?jh(e.data,i.alg)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"jwt",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Vh(e.data,i.version)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"cidr",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Mh.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"base64",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Dh.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"base64url",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):S.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(r=>e.test(r),{validation:t,code:w.ZodIssueCode.invalid_string,...C.errorUtil.errToObj(n)})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...C.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...C.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...C.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...C.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...C.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...C.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...C.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...C.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...C.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...C.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...C.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...C.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...C.errorUtil.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...C.errorUtil.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...C.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...C.errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...C.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...C.errorUtil.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...C.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...C.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...C.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...C.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...C.errorUtil.errToObj(t)})}nonempty(e){return this.min(1,C.errorUtil.errToObj(e))}trim(){return new s({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new s({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new s({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};h.ZodString=Ce;Ce.create=s=>new Ce({checks:[],typeName:O.ZodString,coerce:s?.coerce??!1,...P(s)});function Bh(s,e){let t=(s.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=t>n?t:n,i=Number.parseInt(s.toFixed(r).replace(".","")),a=Number.parseInt(e.toFixed(r).replace(".",""));return i%a/10**r}var De=class s extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==S.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(i,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.number,received:i.parsedType}),p.INVALID}let n,r=new p.ParseStatus;for(let i of this._def.checks)i.kind==="int"?S.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="multipleOf"?Bh(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.not_finite,message:i.message}),r.dirty()):S.util.assertNever(i);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,C.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,C.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,C.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,C.errorUtil.toString(t))}setLimit(e,t,n,r){return new s({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:C.errorUtil.toString(r)}]})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:C.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:C.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:C.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:C.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:C.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:C.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:C.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:C.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:C.errorUtil.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&S.util.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};h.ZodNumber=De;De.create=s=>new De({checks:[],typeName:O.ZodNumber,coerce:s?.coerce||!1,...P(s)});var $e=class s extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==S.ZodParsedType.bigint)return this._getInvalidInput(e);let n,r=new p.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):S.util.assertNever(i);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(t,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.bigint,received:t.parsedType}),p.INVALID}gte(e,t){return this.setLimit("min",e,!0,C.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,C.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,C.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,C.errorUtil.toString(t))}setLimit(e,t,n,r){return new s({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:C.errorUtil.toString(r)}]})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:C.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:C.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:C.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:C.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:C.errorUtil.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};h.ZodBigInt=$e;$e.create=s=>new $e({checks:[],typeName:O.ZodBigInt,coerce:s?.coerce??!1,...P(s)});var Ze=class extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==S.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.boolean,received:n.parsedType}),p.INVALID}return(0,p.OK)(e.data)}};h.ZodBoolean=Ze;Ze.create=s=>new Ze({typeName:O.ZodBoolean,coerce:s?.coerce||!1,...P(s)});var Re=class s extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==S.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(i,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.date,received:i.parsedType}),p.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(i,{code:w.ZodIssueCode.invalid_date}),p.INVALID}let n=new p.ParseStatus,r;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):S.util.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:C.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:C.errorUtil.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};h.ZodDate=Re;Re.create=s=>new Re({checks:[],coerce:s?.coerce||!1,typeName:O.ZodDate,...P(s)});var ut=class extends x{_parse(e){if(this._getType(e)!==S.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.symbol,received:n.parsedType}),p.INVALID}return(0,p.OK)(e.data)}};h.ZodSymbol=ut;ut.create=s=>new ut({typeName:O.ZodSymbol,...P(s)});var je=class extends x{_parse(e){if(this._getType(e)!==S.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.undefined,received:n.parsedType}),p.INVALID}return(0,p.OK)(e.data)}};h.ZodUndefined=je;je.create=s=>new je({typeName:O.ZodUndefined,...P(s)});var Ve=class extends x{_parse(e){if(this._getType(e)!==S.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.null,received:n.parsedType}),p.INVALID}return(0,p.OK)(e.data)}};h.ZodNull=Ve;Ve.create=s=>new Ve({typeName:O.ZodNull,...P(s)});var Ne=class extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,p.OK)(e.data)}};h.ZodAny=Ne;Ne.create=s=>new Ne({typeName:O.ZodAny,...P(s)});var ue=class extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,p.OK)(e.data)}};h.ZodUnknown=ue;ue.create=s=>new ue({typeName:O.ZodUnknown,...P(s)});var se=class extends x{_parse(e){let t=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(t,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.never,received:t.parsedType}),p.INVALID}};h.ZodNever=se;se.create=s=>new se({typeName:O.ZodNever,...P(s)});var dt=class extends x{_parse(e){if(this._getType(e)!==S.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.void,received:n.parsedType}),p.INVALID}return(0,p.OK)(e.data)}};h.ZodVoid=dt;dt.create=s=>new dt({typeName:O.ZodVoid,...P(s)});var de=class s extends x{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==S.ZodParsedType.array)return(0,p.addIssueToContext)(t,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.array,received:t.parsedType}),p.INVALID;if(r.exactLength!==null){let a=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(a||o)&&((0,p.addIssueToContext)(t,{code:a?w.ZodIssueCode.too_big:w.ZodIssueCode.too_small,minimum:o?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&((0,p.addIssueToContext)(t,{code:w.ZodIssueCode.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&((0,p.addIssueToContext)(t,{code:w.ZodIssueCode.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((a,o)=>r.type._parseAsync(new Q(t,a,t.path,o)))).then(a=>p.ParseStatus.mergeArray(n,a));let i=[...t.data].map((a,o)=>r.type._parseSync(new Q(t,a,t.path,o)));return p.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new s({...this._def,minLength:{value:e,message:C.errorUtil.toString(t)}})}max(e,t){return new s({...this._def,maxLength:{value:e,message:C.errorUtil.toString(t)}})}length(e,t){return new s({...this._def,exactLength:{value:e,message:C.errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}};h.ZodArray=de;de.create=(s,e)=>new de({type:s,minLength:null,maxLength:null,exactLength:null,typeName:O.ZodArray,...P(e)});function ct(s){if(s instanceof Y){let e={};for(let t in s.shape){let n=s.shape[t];e[t]=G.create(ct(n))}return new Y({...s._def,shape:()=>e})}else return s instanceof de?new de({...s._def,type:ct(s.element)}):s instanceof G?G.create(ct(s.unwrap())):s instanceof ae?ae.create(ct(s.unwrap())):s instanceof ie?ie.create(s.items.map(e=>ct(e))):s}var Y=class s extends x{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=S.util.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==S.ZodParsedType.object){let c=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(c,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.object,received:c.parsedType}),p.INVALID}let{status:n,ctx:r}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof se&&this._def.unknownKeys==="strip"))for(let c in r.data)a.includes(c)||o.push(c);let l=[];for(let c of a){let f=i[c],d=r.data[c];l.push({key:{status:"valid",value:c},value:f._parse(new Q(r,d,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof se){let c=this._def.unknownKeys;if(c==="passthrough")for(let f of o)l.push({key:{status:"valid",value:f},value:{status:"valid",value:r.data[f]}});else if(c==="strict")o.length>0&&((0,p.addIssueToContext)(r,{code:w.ZodIssueCode.unrecognized_keys,keys:o}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let f of o){let d=r.data[f];l.push({key:{status:"valid",value:f},value:c._parse(new Q(r,d,r.path,f)),alwaysSet:f in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let c=[];for(let f of l){let d=await f.key,u=await f.value;c.push({key:d,value:u,alwaysSet:f.alwaysSet})}return c}).then(c=>p.ParseStatus.mergeObjectSync(n,c)):p.ParseStatus.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return C.errorUtil.errToObj,new s({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{let r=this._def.errorMap?.(t,n).message??n.defaultError;return t.code==="unrecognized_keys"?{message:C.errorUtil.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new s({...this._def,unknownKeys:"strip"})}passthrough(){return new s({...this._def,unknownKeys:"passthrough"})}extend(e){return new s({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new s({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:O.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new s({...this._def,catchall:e})}pick(e){let t={};for(let n of S.util.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new s({...this._def,shape:()=>t})}omit(e){let t={};for(let n of S.util.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new s({...this._def,shape:()=>t})}deepPartial(){return ct(this)}partial(e){let t={};for(let n of S.util.objectKeys(this.shape)){let r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}return new s({...this._def,shape:()=>t})}required(e){let t={};for(let n of S.util.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof G;)i=i._def.innerType;t[n]=i}return new s({...this._def,shape:()=>t})}keyof(){return al(S.util.objectKeys(this.shape))}};h.ZodObject=Y;Y.create=(s,e)=>new Y({shape:()=>s,unknownKeys:"strip",catchall:se.create(),typeName:O.ZodObject,...P(e)});Y.strictCreate=(s,e)=>new Y({shape:()=>s,unknownKeys:"strict",catchall:se.create(),typeName:O.ZodObject,...P(e)});Y.lazycreate=(s,e)=>new Y({shape:s,unknownKeys:"strip",catchall:se.create(),typeName:O.ZodObject,...P(e)});var Be=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(i){for(let o of i)if(o.result.status==="valid")return o.result;for(let o of i)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let a=i.map(o=>new w.ZodError(o.ctx.common.issues));return(0,p.addIssueToContext)(t,{code:w.ZodIssueCode.invalid_union,unionErrors:a}),p.INVALID}if(t.common.async)return Promise.all(n.map(async i=>{let a={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(r);{let i,a=[];for(let l of n){let c={...t,common:{...t.common,issues:[]},parent:null},f=l._parseSync({data:t.data,path:t.path,parent:c});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let o=a.map(l=>new w.ZodError(l));return(0,p.addIssueToContext)(t,{code:w.ZodIssueCode.invalid_union,unionErrors:o}),p.INVALID}}get options(){return this._def.options}};h.ZodUnion=Be;Be.create=(s,e)=>new Be({options:s,typeName:O.ZodUnion,...P(e)});var ce=s=>s instanceof Fe?ce(s.schema):s instanceof z?ce(s.innerType()):s instanceof Ke?[s.value]:s instanceof Ye?s.options:s instanceof Je?S.util.objectValues(s.enum):s instanceof ze?ce(s._def.innerType):s instanceof je?[void 0]:s instanceof Ve?[null]:s instanceof G?[void 0,...ce(s.unwrap())]:s instanceof ae?[null,...ce(s.unwrap())]:s instanceof zt||s instanceof He?ce(s.unwrap()):s instanceof We?ce(s._def.innerType):[],tn=class s extends x{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.ZodParsedType.object)return(0,p.addIssueToContext)(t,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.object,received:t.parsedType}),p.INVALID;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):((0,p.addIssueToContext)(t,{code:w.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),p.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let r=new Map;for(let i of t){let a=ce(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of a){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,i)}}return new s({typeName:O.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...P(n)})}};h.ZodDiscriminatedUnion=tn;function zr(s,e){let t=(0,S.getParsedType)(s),n=(0,S.getParsedType)(e);if(s===e)return{valid:!0,data:s};if(t===S.ZodParsedType.object&&n===S.ZodParsedType.object){let r=S.util.objectKeys(e),i=S.util.objectKeys(s).filter(o=>r.indexOf(o)!==-1),a={...s,...e};for(let o of i){let l=zr(s[o],e[o]);if(!l.valid)return{valid:!1};a[o]=l.data}return{valid:!0,data:a}}else if(t===S.ZodParsedType.array&&n===S.ZodParsedType.array){if(s.length!==e.length)return{valid:!1};let r=[];for(let i=0;i<s.length;i++){let a=s[i],o=e[i],l=zr(a,o);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return t===S.ZodParsedType.date&&n===S.ZodParsedType.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}var Ue=class extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(i,a)=>{if((0,p.isAborted)(i)||(0,p.isAborted)(a))return p.INVALID;let o=zr(i.value,a.value);return o.valid?(((0,p.isDirty)(i)||(0,p.isDirty)(a))&&t.dirty(),{status:t.value,value:o.data}):((0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_intersection_types}),p.INVALID)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>r(i,a)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};h.ZodIntersection=Ue;Ue.create=(s,e,t)=>new Ue({left:s,right:e,typeName:O.ZodIntersection,...P(t)});var ie=class s extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==S.ZodParsedType.array)return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.array,received:n.parsedType}),p.INVALID;if(n.data.length<this._def.items.length)return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,p.addIssueToContext)(n,{code:w.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...n.data].map((a,o)=>{let l=this._def.items[o]||this._def.rest;return l?l._parse(new Q(n,a,n.path,o)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>p.ParseStatus.mergeArray(t,a)):p.ParseStatus.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new s({...this._def,rest:e})}};h.ZodTuple=ie;ie.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ie({items:s,typeName:O.ZodTuple,rest:null,...P(e)})};var sn=class s extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==S.ZodParsedType.object)return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.object,received:n.parsedType}),p.INVALID;let r=[],i=this._def.keyType,a=this._def.valueType;for(let o in n.data)r.push({key:i._parse(new Q(n,o,n.path,o)),value:a._parse(new Q(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?p.ParseStatus.mergeObjectAsync(t,r):p.ParseStatus.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof x?new s({keyType:e,valueType:t,typeName:O.ZodRecord,...P(n)}):new s({keyType:Ce.create(),valueType:e,typeName:O.ZodRecord,...P(t)})}};h.ZodRecord=sn;var ft=class extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==S.ZodParsedType.map)return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.map,received:n.parsedType}),p.INVALID;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([o,l],c)=>({key:r._parse(new Q(n,o,n.path,[c,"key"])),value:i._parse(new Q(n,l,n.path,[c,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let l of a){let c=await l.key,f=await l.value;if(c.status==="aborted"||f.status==="aborted")return p.INVALID;(c.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(c.value,f.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let l of a){let c=l.key,f=l.value;if(c.status==="aborted"||f.status==="aborted")return p.INVALID;(c.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(c.value,f.value)}return{status:t.value,value:o}}}};h.ZodMap=ft;ft.create=(s,e,t)=>new ft({valueType:e,keyType:s,typeName:O.ZodMap,...P(t)});var ht=class s extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==S.ZodParsedType.set)return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.set,received:n.parsedType}),p.INVALID;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&((0,p.addIssueToContext)(n,{code:w.ZodIssueCode.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&((0,p.addIssueToContext)(n,{code:w.ZodIssueCode.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(l){let c=new Set;for(let f of l){if(f.status==="aborted")return p.INVALID;f.status==="dirty"&&t.dirty(),c.add(f.value)}return{status:t.value,value:c}}let o=[...n.data.values()].map((l,c)=>i._parse(new Q(n,l,n.path,c)));return n.common.async?Promise.all(o).then(l=>a(l)):a(o)}min(e,t){return new s({...this._def,minSize:{value:e,message:C.errorUtil.toString(t)}})}max(e,t){return new s({...this._def,maxSize:{value:e,message:C.errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};h.ZodSet=ht;ht.create=(s,e)=>new ht({valueType:s,minSize:null,maxSize:null,typeName:O.ZodSet,...P(e)});var nn=class s extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.ZodParsedType.function)return(0,p.addIssueToContext)(t,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.function,received:t.parsedType}),p.INVALID;function n(o,l){return(0,p.makeIssue)({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,en.getErrorMap)(),en.defaultErrorMap].filter(c=>!!c),issueData:{code:w.ZodIssueCode.invalid_arguments,argumentsError:l}})}function r(o,l){return(0,p.makeIssue)({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,en.getErrorMap)(),en.defaultErrorMap].filter(c=>!!c),issueData:{code:w.ZodIssueCode.invalid_return_type,returnTypeError:l}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Ae){let o=this;return(0,p.OK)(async function(...l){let c=new w.ZodError([]),f=await o._def.args.parseAsync(l,i).catch(y=>{throw c.addIssue(n(l,y)),c}),d=await Reflect.apply(a,this,f);return await o._def.returns._def.type.parseAsync(d,i).catch(y=>{throw c.addIssue(r(d,y)),c})})}else{let o=this;return(0,p.OK)(function(...l){let c=o._def.args.safeParse(l,i);if(!c.success)throw new w.ZodError([n(l,c.error)]);let f=Reflect.apply(a,this,c.data),d=o._def.returns.safeParse(f,i);if(!d.success)throw new w.ZodError([r(f,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new s({...this._def,args:ie.create(e).rest(ue.create())})}returns(e){return new s({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new s({args:e||ie.create([]).rest(ue.create()),returns:t||ue.create(),typeName:O.ZodFunction,...P(n)})}};h.ZodFunction=nn;var Fe=class extends x{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};h.ZodLazy=Fe;Fe.create=(s,e)=>new Fe({getter:s,typeName:O.ZodLazy,...P(e)});var Ke=class extends x{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(t,{received:t.data,code:w.ZodIssueCode.invalid_literal,expected:this._def.value}),p.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};h.ZodLiteral=Ke;Ke.create=(s,e)=>new Ke({value:s,typeName:O.ZodLiteral,...P(e)});function al(s,e){return new Ye({values:s,typeName:O.ZodEnum,...P(e)})}var Ye=class s extends x{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return(0,p.addIssueToContext)(t,{expected:S.util.joinValues(n),received:t.parsedType,code:w.ZodIssueCode.invalid_type}),p.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return(0,p.addIssueToContext)(t,{received:t.data,code:w.ZodIssueCode.invalid_enum_value,options:n}),p.INVALID}return(0,p.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return s.create(e,{...this._def,...t})}exclude(e,t=this._def){return s.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};h.ZodEnum=Ye;Ye.create=al;var Je=class extends x{_parse(e){let t=S.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==S.ZodParsedType.string&&n.parsedType!==S.ZodParsedType.number){let r=S.util.objectValues(t);return(0,p.addIssueToContext)(n,{expected:S.util.joinValues(r),received:n.parsedType,code:w.ZodIssueCode.invalid_type}),p.INVALID}if(this._cache||(this._cache=new Set(S.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=S.util.objectValues(t);return(0,p.addIssueToContext)(n,{received:n.data,code:w.ZodIssueCode.invalid_enum_value,options:r}),p.INVALID}return(0,p.OK)(e.data)}get enum(){return this._def.values}};h.ZodNativeEnum=Je;Je.create=(s,e)=>new Je({values:s,typeName:O.ZodNativeEnum,...P(e)});var Ae=class extends x{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.ZodParsedType.promise&&t.common.async===!1)return(0,p.addIssueToContext)(t,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.promise,received:t.parsedType}),p.INVALID;let n=t.parsedType===S.ZodParsedType.promise?t.data:Promise.resolve(t.data);return(0,p.OK)(n.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};h.ZodPromise=Ae;Ae.create=(s,e)=>new Ae({type:s,typeName:O.ZodPromise,...P(e)});var z=class extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===O.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:a=>{(0,p.addIssueToContext)(n,a),a.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type==="preprocess"){let a=r.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async o=>{if(t.value==="aborted")return p.INVALID;let l=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return l.status==="aborted"?p.INVALID:l.status==="dirty"||t.value==="dirty"?(0,p.DIRTY)(l.value):l});{if(t.value==="aborted")return p.INVALID;let o=this._def.schema._parseSync({data:a,path:n.path,parent:n});return o.status==="aborted"?p.INVALID:o.status==="dirty"||t.value==="dirty"?(0,p.DIRTY)(o.value):o}}if(r.type==="refinement"){let a=o=>{let l=r.refinement(o,i);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?p.INVALID:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?p.INVALID:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(r.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,p.isValid)(a))return p.INVALID;let o=r.transform(a.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>(0,p.isValid)(a)?Promise.resolve(r.transform(a.value,i)).then(o=>({status:t.value,value:o})):p.INVALID);S.util.assertNever(r)}};h.ZodEffects=z;h.ZodTransformer=z;z.create=(s,e,t)=>new z({schema:s,typeName:O.ZodEffects,effect:e,...P(t)});z.createWithPreprocess=(s,e,t)=>new z({schema:e,effect:{type:"preprocess",transform:s},typeName:O.ZodEffects,...P(t)});var G=class extends x{_parse(e){return this._getType(e)===S.ZodParsedType.undefined?(0,p.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};h.ZodOptional=G;G.create=(s,e)=>new G({innerType:s,typeName:O.ZodOptional,...P(e)});var ae=class extends x{_parse(e){return this._getType(e)===S.ZodParsedType.null?(0,p.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};h.ZodNullable=ae;ae.create=(s,e)=>new ae({innerType:s,typeName:O.ZodNullable,...P(e)});var ze=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===S.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};h.ZodDefault=ze;ze.create=(s,e)=>new ze({innerType:s,typeName:O.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...P(e)});var We=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,p.isAsync)(r)?r.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new w.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new w.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};h.ZodCatch=We;We.create=(s,e)=>new We({innerType:s,typeName:O.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...P(e)});var pt=class extends x{_parse(e){if(this._getType(e)!==S.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.nan,received:n.parsedType}),p.INVALID}return{status:"valid",value:e.data}}};h.ZodNaN=pt;pt.create=s=>new pt({typeName:O.ZodNaN,...P(s)});h.BRAND=Symbol("zod_brand");var zt=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}};h.ZodBranded=zt;var Wt=class s extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?p.INVALID:i.status==="dirty"?(t.dirty(),(0,p.DIRTY)(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?p.INVALID:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,t){return new s({in:e,out:t,typeName:O.ZodPipeline})}};h.ZodPipeline=Wt;var He=class extends x{_parse(e){let t=this._def.innerType._parse(e),n=r=>((0,p.isValid)(r)&&(r.value=Object.freeze(r.value)),r);return(0,p.isAsync)(t)?t.then(r=>n(r)):n(t)}unwrap(){return this._def.innerType}};h.ZodReadonly=He;He.create=(s,e)=>new He({innerType:s,typeName:O.ZodReadonly,...P(e)});function sl(s,e){let t=typeof s=="function"?s(e):typeof s=="string"?{message:s}:s;return typeof t=="string"?{message:t}:t}function ol(s,e={},t){return s?Ne.create().superRefine((n,r)=>{let i=s(n);if(i instanceof Promise)return i.then(a=>{if(!a){let o=sl(e,n),l=o.fatal??t??!0;r.addIssue({code:"custom",...o,fatal:l})}});if(!i){let a=sl(e,n),o=a.fatal??t??!0;r.addIssue({code:"custom",...a,fatal:o})}}):Ne.create()}h.late={object:Y.lazycreate};var O;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(O||(h.ZodFirstPartyTypeKind=O={}));var Uh=(s,e={message:`Input not instance of ${s.name}`})=>ol(t=>t instanceof s,e);h.instanceof=Uh;var ll=Ce.create;h.string=ll;var cl=De.create;h.number=cl;var Fh=pt.create;h.nan=Fh;var Kh=$e.create;h.bigint=Kh;var ul=Ze.create;h.boolean=ul;var Yh=Re.create;h.date=Yh;var Jh=ut.create;h.symbol=Jh;var zh=je.create;h.undefined=zh;var Wh=Ve.create;h.null=Wh;var Hh=Ne.create;h.any=Hh;var Gh=ue.create;h.unknown=Gh;var Qh=se.create;h.never=Qh;var Xh=dt.create;h.void=Xh;var ep=de.create;h.array=ep;var tp=Y.create;h.object=tp;var sp=Y.strictCreate;h.strictObject=sp;var np=Be.create;h.union=np;var rp=tn.create;h.discriminatedUnion=rp;var ip=Ue.create;h.intersection=ip;var ap=ie.create;h.tuple=ap;var op=sn.create;h.record=op;var lp=ft.create;h.map=lp;var cp=ht.create;h.set=cp;var up=nn.create;h.function=up;var dp=Fe.create;h.lazy=dp;var fp=Ke.create;h.literal=fp;var hp=Ye.create;h.enum=hp;var pp=Je.create;h.nativeEnum=pp;var mp=Ae.create;h.promise=mp;var dl=z.create;h.effect=dl;h.transformer=dl;var yp=G.create;h.optional=yp;var gp=ae.create;h.nullable=gp;var vp=z.createWithPreprocess;h.preprocess=vp;var bp=Wt.create;h.pipeline=bp;var wp=()=>ll().optional();h.ostring=wp;var _p=()=>cl().optional();h.onumber=_p;var Sp=()=>ul().optional();h.oboolean=Sp;h.coerce={string:s=>Ce.create({...s,coerce:!0}),number:s=>De.create({...s,coerce:!0}),boolean:s=>Ze.create({...s,coerce:!0}),bigint:s=>$e.create({...s,coerce:!0}),date:s=>Re.create({...s,coerce:!0})};h.NEVER=p.INVALID});var Wr=_(X=>{"use strict";var Tp=X&&X.__createBinding||(Object.create?function(s,e,t,n){n===void 0&&(n=t);var r=Object.getOwnPropertyDescriptor(e,t);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,r)}:function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]}),mt=X&&X.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Tp(e,s,t)};Object.defineProperty(X,"__esModule",{value:!0});mt(Qs(),X);mt(Yr(),X);mt(Qo(),X);mt(Yt(),X);mt(fl(),X);mt(Gs(),X)});var ml=_(J=>{"use strict";var hl=J&&J.__createBinding||(Object.create?function(s,e,t,n){n===void 0&&(n=t);var r=Object.getOwnPropertyDescriptor(e,t);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,r)}:function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]}),kp=J&&J.__setModuleDefault||(Object.create?function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}:function(s,e){s.default=e}),Ip=J&&J.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.prototype.hasOwnProperty.call(s,t)&&hl(e,s,t);return kp(e,s),e},Cp=J&&J.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&hl(e,s,t)};Object.defineProperty(J,"__esModule",{value:!0});J.z=void 0;var pl=Ip(Wr());J.z=pl;Cp(Wr(),J);J.default=pl});var Jp={};El(Jp,{default:()=>Yp,extractTools:()=>Qr});module.exports=Pl(Jp);function ti(s){let e=s?.find(d=>d.type==="tool");if(!e)return null;let t=Array.isArray(e.content)?e.content:[],n=t.find(d=>d.type==="toolparams"),r=t.find(d=>d.type==="toolverifies"),i=Array.isArray(n?.attrs?.rows)?n.attrs.rows:[],a=Array.isArray(r?.attrs?.rows)?r.attrs.rows:[],o=r?.attrs?.onFailure||"withdraw",l=a.map(d=>({...d,onFailure:d.onFailure||o})),c=e.attrs?.requestSectionLabel,f=c!=null;return{uid:e.attrs?.uid,name:e.attrs?.name||"",title:e.attrs?.title||void 0,description:e.attrs?.description||"",annotations:e.attrs?.annotations||{},requestUid:e.attrs?.requestUid||void 0,params:i,verifies:l,enabled:e.attrs?.enabled!==!1,requestFilePath:e.attrs?.requestFilePath||void 0,requestSectionLabel:f?c:void 0}}var fe=require("fs"),vl=require("node:child_process"),Gt=require("node:path"),Ht=on(Ko(),1),W=on(ml(),1),Hr;async function rn(s){return Hr||({parseVoidFileSections:Hr}=await import("@voiden/executors")),Hr(s)}function Gr(s,e){return(0,Gt.isAbsolute)(s)||!e?s:(0,Gt.join)(e,s)}function an(s,e){if(s.requestSectionLabel!==void 0){let t=s.requestFilePath||s.filePath;return{filePath:Gr(t,e),sectionLabel:s.requestSectionLabel}}return{filePath:s.filePath,sectionLabel:s.sectionLabel}}async function bl(s,e,t,n){let r=await s.collectVoidFiles(t),i=[];for(let a of r){let o=(0,fe.readFileSync)(a,"utf-8"),l=await rn(o);for(let c of l){let f=e(c.blocks);for(let d of f)i.push({...d,filePath:a,sectionLabel:c.label})}}return i}var Np=/\{\{([^}]+)\}\}/g;function Ap(s){let e=new Set,t=new RegExp(Np.source,"g"),n;for(;(n=t.exec(s))!==null;)e.add(n[1].trim());return e}async function wl(s,e,t){let n=[],r=new Set,i=new Map,a=new Set,o=new Set,l=await s.collectVoidFiles(e);for(let u of l){let y=(0,fe.readFileSync)(u,"utf-8"),v=await rn(y);v.length===1&&o.add(u);for(let m of v)a.add(`${u}::${m.label??""}`)}let c=async u=>{let{filePath:y,sectionLabel:v}=an(u,e),m=`${y}::${v??""}`;if(i.has(m))return i.get(m);let g;try{let T=(0,fe.readFileSync)(y,"utf-8"),b=await rn(T),k=b.length===1?b[0]:b.find(N=>N.label===v);g=k?JSON.stringify(k.blocks):null}catch{g=null}return i.set(m,g),g},f=(u,y,v)=>{n.push({tool:u,check:y,message:v}),r.add(u)};for(let u of t){let y=await c(u);for(let v of u.params)v.binds&&y!==null&&!y.includes(`{{${v.binds}}}`)&&f(u,"unbound-param",`Tool "${u.name}" param "${v.name}" binds to "{{${v.binds}}}", which doesn't appear anywhere in the request it decorates.`);if(y!==null){let v=new Set(u.params.map(m=>m.binds).filter(Boolean));for(let m of Ap(y))v.has(m)||f(u,"unresolved-placeholder",`Tool "${u.name}" request uses "{{${m}}}", which isn't declared as any parameter's "binds" \u2014 it can only resolve if it happens to be a real environment variable outside Voiden's knowledge.`)}for(let v of u.verifies){let m=Gr(v.filePath||u.filePath,e),g=`${m}::${v.sectionLabel}`;!o.has(m)&&!a.has(g)&&f(u,"missing-section",`Tool "${u.name}" verifies entry points at section "${v.sectionLabel}"${v.filePath?` in ${v.filePath}`:""}, which doesn't exist.`)}if(u.requestSectionLabel!==void 0){let{filePath:v,sectionLabel:m}=an(u,e),g=`${v}::${m}`;!o.has(v)&&!a.has(g)&&f(u,"dangling-request-reference",`Tool "${u.name}" is bound to section "${m}"${u.requestFilePath?` in ${u.requestFilePath}`:""}, which doesn't exist.`)}if(u.annotations?.readOnlyHint){let{filePath:v,sectionLabel:m}=an(u,e);try{let g=(0,fe.readFileSync)(v,"utf-8"),T=(await rn(g)).find(b=>b.label===m);if(T){let{method:b}=s.getRequestPreview(T.blocks);["POST","PUT","PATCH","DELETE"].includes(b.toUpperCase())&&f(u,"readonly-mutating",`Tool "${u.name}" is annotated readOnlyHint but its request uses ${b.toUpperCase()}.`)}}catch{}}}let d=new Map;for(let u of t){if(!u.name)continue;let y=d.get(u.name)??[];y.push(u),d.set(u.name,y)}for(let[u,y]of d)if(y.length>1)for(let v of y)f(v,"duplicate-name",`Tool name "${u}" is used by ${y.length} tools \u2014 names must be unique across the served set.`);return{validTools:t.filter(u=>!r.has(u)),issues:n}}function Op(s){let e=(s.reportEntries??[]).filter(t=>t.type==="assertion");return e.length>0?e.every(t=>t.passed===!0):s.success===!0}var Ep={hourly:60,daily:60*24,weekly:60*24*7,monthly:60*24*30},yl=60;function Pp(s){return s?Ep[s.trim().toLowerCase()]??yl:yl}async function _l(s,e,t){let n=[];for(let r of e){if(r.verifies.length===0){n.push({tool:r,state:"unverified",results:[],note:"No verification requests attached."});continue}let i=t.cadence?r.verifies.filter(b=>b.cadence===t.cadence):r.verifies;if(i.length===0){n.push({tool:r,state:"unverified",results:[],note:`No verification requests matched cadence "${t.cadence}".`});continue}let a=i.filter(b=>b.mode!=="none");if(a.length===0){n.push({tool:r,state:"unverified",results:[],note:'Every matching verification request has mode "none" \u2014 none were automatically run.'});continue}let o=a.filter(b=>b.role==="auth-check"),l=a.filter(b=>b.role!=="auth-check"),c=t.runtimeVars??{},f=[],d=t.now??Date.now(),u=t.entryCache,y=async b=>{let k=Gr(b.filePath||r.filePath,t.projectRoot);return(await s.runVoidFile(k,{sectionLabel:b.sectionLabel,env:t.env,runtimeVars:c,activePlugins:t.activePlugins})).results[0]?.result},v=async(b,k)=>{let N=`${r.toolBlockUid}::${k}`;if(u){let L=u.get(N);if(L&&d-L.verifiedAt<Pp(b.cadence)*6e4)return{passed:L.passed,runResult:L.runResult}}let A=await y(b),E=A?Op(A):!1;return u&&u.set(N,{passed:E,runResult:A,verifiedAt:d}),console.error(` ${E?"\u2713":"\u2717"} verify "${r.name}" [${b.role}${b.cadence?`, cadence: ${b.cadence}`:""}] \u2014 ${E?"passed":`failed${A?.error?`: ${A.error}`:""}`}`),{passed:E,runResult:A}},m=!1,g;for(let b of o){let{passed:k,runResult:N}=await v(b,r.verifies.indexOf(b));f.push({entry:b,passed:k,reason:k?void 0:"auth-failure",runResult:N}),k||(m=!0,g=`Auth check "${b.sectionLabel}" failed \u2014 dependent verification requests were skipped.`)}if(m){n.push({tool:r,state:"failing",results:f,note:g});continue}let T=!1;for(let b of l){let{passed:k,runResult:N}=await v(b,r.verifies.indexOf(b));k||(T=!0),f.push({entry:b,passed:k,reason:k?void 0:"contract-failure",runResult:N})}n.push({tool:r,state:T?"failing":l.length>0?"verified":"unverified",results:f})}return n}function xp(s){return s.results.filter(t=>!t.passed).map(t=>t.entry.onFailure||"withdraw").some(t=>t==="withdraw")?"withdraw":"advertise-degraded"}function qp(s){return s.map(e=>{let{tool:t,state:n}=e;return t.enabled===!1?{tool:t,status:e,served:!1,disabledManually:!0}:n==="failing"?xp(e)==="withdraw"?{tool:t,status:e,served:!1}:{tool:t,status:e,served:!0,descriptionNote:`\u26A0 DEGRADED \u2014 recent verification failed (${e.note??"see voiden-runner tool verify for details"}). `}:n==="unverified"?{tool:t,status:e,served:!0,descriptionNote:`[unverified \u2014 ${e.note??"no automated verification passed yet"}] `}:{tool:t,status:e,served:!0}})}function Lp(s){let e=new Map;for(let t of s){let n=e.get(t.tool)??[];n.push(`[${t.check}] ${t.message}`),e.set(t.tool,n)}return[...e.entries()].map(([t,n])=>({tool:t,served:!1,excluded:!0,excludedReasons:n}))}async function Mp(s,e,t,n,r,i){let a=await bl(s,e,t,{activePlugins:r}),{validTools:o,issues:l}=await wl(s,t,a),c={...Sl(t),...n},f=await _l(s,o,{env:c,activePlugins:r,entryCache:i?.entryCache,now:i?.now,projectRoot:t});return[...Lp(l),...qp(f)]}function Sl(s){let e=a=>{try{let o=(0,fe.readFileSync)((0,Gt.join)(s,a),"utf-8");return Ht.default.parse(o)||{}}catch{return{}}},t=e(".voiden/env-public.yaml"),n=e(".voiden/env-private.yaml"),r=new Set([...Object.keys(t),...Object.keys(n)]);if(r.size!==1)return{};let[i]=r;return{...t[i]?.variables??{},...n[i]?.variables??{}}}function Dp(s){let e={string:W.z.string(),number:W.z.number(),integer:W.z.number().int(),boolean:W.z.boolean(),object:W.z.record(W.z.any()),array:W.z.array(W.z.any())}[s.type],t=s.description?e.describe(s.description):e;return s.required?t:t.optional()}function $p(s){let e=s.params.filter(t=>t.source==="agent");return Object.fromEntries(e.map(t=>[t.name,Dp(t)]))}function Tl(s,e,t,n,r,i){return async a=>{let o={...t};for(let d of e.params)d.source==="agent"&&a[d.name]!==void 0&&(o[d.binds]=typeof a[d.name]=="string"?a[d.name]:JSON.stringify(a[d.name]));let{filePath:l,sectionLabel:c}=an(e,i),f=await s.runVoidFile(l,{sectionLabel:c,env:o,runtimeVars:n,activePlugins:r});return{content:[{type:"text",text:JSON.stringify(f.results[0]?.result,null,2)}]}}}function Zp(s){return s.params.filter(e=>e.source==="agent").map(e=>({name:e.name,type:e.type,required:e.required,description:e.description}))}function Rp(s,e,t,n,r,i,a,o){for(let l of t){if(!l.served||!l.status)continue;let{tool:c,status:f}=l;e.registerTool(c.name,{title:c.title,description:(l.descriptionNote??"")+c.description,inputSchema:$p(c),annotations:c.annotations,_meta:{"md.voiden/verification":{state:f.state,last_verified:new Date().toISOString(),...a?{commit:a}:{}}}},Tl(s,c,n,r,i,o))}}function jp(s,e,t,n,r,i,a,o){let l=new Map;for(let c of t)!c.served||!c.status||l.set(c.tool.name,{tool:c.tool,status:c.status,descriptionNote:c.descriptionNote});e.registerTool("search_tools",{title:"Search Tools",description:"List every tool this server currently publishes \u2014 name, description, parameters, and verification state. Call this first; call_tool needs an exact name from here.",inputSchema:{query:W.z.string().optional().describe("Optional case-insensitive substring to filter by name/title/description. Omit to list everything.")}},async({query:c})=>{let f=c?.trim().toLowerCase(),d=[...l.values()].filter(({tool:u})=>!f||[u.name,u.title,u.description].some(y=>y?.toLowerCase().includes(f))).map(({tool:u,status:y,descriptionNote:v})=>({name:u.name,title:u.title,description:(v??"")+u.description,params:Zp(u),annotations:u.annotations,verification:{state:y.state,...a?{commit:a}:{}}}));return{content:[{type:"text",text:JSON.stringify(d,null,2)}]}}),e.registerTool("call_tool",{title:"Call Tool",description:"Call one of the tools listed by search_tools, by its exact name.",inputSchema:{name:W.z.string().describe("A tool name from search_tools' results."),arguments:W.z.record(W.z.any()).optional().describe("Arguments matching that tool's own params (see search_tools).")}},async({name:c,arguments:f})=>{let d=l.get(c);return d?Tl(s,d.tool,n,r,i,o)(f??{}):{content:[{type:"text",text:`No tool named "${c}" is currently served. Call search_tools to see what's available.`}],isError:!0}})}function Vp(s,e,t,n,r,i,a,o,l="static"){let c={...Sl(o),...n};l==="dynamic"?jp(s,e,t,c,r,i,a,o):Rp(s,e,t,c,r,i,a,o)}function Bp(s){try{return(0,vl.execSync)("git rev-parse --short HEAD",{cwd:s,stdio:["ignore","pipe","ignore"]}).toString().trim()||void 0}catch{return}}var gl=/^```void\n([\s\S]*?)^```/gm;function Up(s){let e=[],t=new RegExp(gl.source,gl.flags),n;for(;(n=t.exec(s))!==null;){let r=n.index,i=r+n[0].length,a=n[1],o=a.trim().split(`
|
|
139
|
+
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=zs(e),n=lt(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=zs(e),n=lt(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Zo.Parser=Rr});var Uo=_(Kt=>{"use strict";var Ro=Cr(),Vf=Dt(),Ft=Rt(),Bf=kn(),Uf=q(),Ff=Zr(),jo=jr();function Vo(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new Ff.LineCounter||null,prettyErrors:e}}function Kf(s,e={}){let{lineCounter:t,prettyErrors:n}=Vo(e),r=new jo.Parser(t?.addNewLine),i=new Ro.Composer(e),a=Array.from(i.compose(r.parse(s)));if(n&&t)for(let o of a)o.errors.forEach(Ft.prettifyError(s,t)),o.warnings.forEach(Ft.prettifyError(s,t));return a.length>0?a:Object.assign([],{empty:!0},i.streamInfo())}function Bo(s,e={}){let{lineCounter:t,prettyErrors:n}=Vo(e),r=new jo.Parser(t?.addNewLine),i=new Ro.Composer(e),a=null;for(let o of i.compose(r.parse(s),!0,s.length))if(!a)a=o;else if(a.options.logLevel!=="silent"){a.errors.push(new Ft.YAMLParseError(o.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(a.errors.forEach(Ft.prettifyError(s,t)),a.warnings.forEach(Ft.prettifyError(s,t))),a}function Yf(s,e,t){let n;typeof e=="function"?n=e:t===void 0&&e&&typeof e=="object"&&(t=e);let r=Bo(s,t);if(!r)return null;if(r.warnings.forEach(i=>Bf.warn(r.options.logLevel,i)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:n},t))}function Jf(s,e,t){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let r=Math.round(t);t=r<1?void 0:r>8?{indent:8}:{indent:r}}if(s===void 0){let{keepUndefined:r}=t??e??{};if(!r)return}return Uf.isDocument(s)&&!n?s.toString(t):new Vf.Document(s,n,t).toString(t)}Kt.parse=Yf;Kt.parseAllDocuments=Kf;Kt.parseDocument=Bo;Kt.stringify=Jf});var Ko=_(M=>{"use strict";var zf=Cr(),Wf=Dt(),Hf=ar(),Vr=Rt(),Gf=wt(),Te=q(),Qf=ve(),Xf=Z(),eh=we(),th=_e(),sh=Ys(),nh=Dr(),rh=Zr(),ih=jr(),Hs=Uo(),Fo=yt();M.Composer=zf.Composer;M.Document=Wf.Document;M.Schema=Hf.Schema;M.YAMLError=Vr.YAMLError;M.YAMLParseError=Vr.YAMLParseError;M.YAMLWarning=Vr.YAMLWarning;M.Alias=Gf.Alias;M.isAlias=Te.isAlias;M.isCollection=Te.isCollection;M.isDocument=Te.isDocument;M.isMap=Te.isMap;M.isNode=Te.isNode;M.isPair=Te.isPair;M.isScalar=Te.isScalar;M.isSeq=Te.isSeq;M.Pair=Qf.Pair;M.Scalar=Xf.Scalar;M.YAMLMap=eh.YAMLMap;M.YAMLSeq=th.YAMLSeq;M.CST=sh;M.Lexer=nh.Lexer;M.LineCounter=rh.LineCounter;M.Parser=ih.Parser;M.parse=Hs.parse;M.parseAllDocuments=Hs.parseAllDocuments;M.parseDocument=Hs.parseDocument;M.stringify=Hs.stringify;M.visit=Fo.visit;M.visitAsync=Fo.visitAsync});var Yt=_($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.getParsedType=$.ZodParsedType=$.objectUtil=$.util=void 0;var Br;(function(s){s.assertEqual=r=>{};function e(r){}s.assertIs=e;function t(r){throw new Error}s.assertNever=t,s.arrayToEnum=r=>{let i={};for(let a of r)i[a]=a;return i},s.getValidEnumValues=r=>{let i=s.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),a={};for(let o of i)a[o]=r[o];return s.objectValues(a)},s.objectValues=r=>s.objectKeys(r).map(function(i){return r[i]}),s.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let i=[];for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&i.push(a);return i},s.find=(r,i)=>{for(let a of r)if(i(a))return a},s.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function n(r,i=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}s.joinValues=n,s.jsonStringifyReplacer=(r,i)=>typeof i=="bigint"?i.toString():i})(Br||($.util=Br={}));var Yo;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(Yo||($.objectUtil=Yo={}));$.ZodParsedType=Br.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var ah=s=>{switch(typeof s){case"undefined":return $.ZodParsedType.undefined;case"string":return $.ZodParsedType.string;case"number":return Number.isNaN(s)?$.ZodParsedType.nan:$.ZodParsedType.number;case"boolean":return $.ZodParsedType.boolean;case"function":return $.ZodParsedType.function;case"bigint":return $.ZodParsedType.bigint;case"symbol":return $.ZodParsedType.symbol;case"object":return Array.isArray(s)?$.ZodParsedType.array:s===null?$.ZodParsedType.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?$.ZodParsedType.promise:typeof Map<"u"&&s instanceof Map?$.ZodParsedType.map:typeof Set<"u"&&s instanceof Set?$.ZodParsedType.set:typeof Date<"u"&&s instanceof Date?$.ZodParsedType.date:$.ZodParsedType.object;default:return $.ZodParsedType.unknown}};$.getParsedType=ah});var Gs=_(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.ZodError=ke.quotelessJson=ke.ZodIssueCode=void 0;var Jo=Yt();ke.ZodIssueCode=Jo.util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var oh=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:");ke.quotelessJson=oh;var Jt=class s extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(i){return i.message},n={_errors:[]},r=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)n._errors.push(t(a));else{let o=n,l=0;for(;l<a.path.length;){let c=a.path[l];l===a.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(t(a))):o[c]=o[c]||{_errors:[]},o=o[c],l++}}};return r(this),n}static assert(e){if(!(e instanceof s))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Jo.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let i=r.path[0];t[i]=t[i]||[],t[i].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};ke.ZodError=Jt;Jt.create=s=>new Jt(s)});var Fr=_(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0});var U=Gs(),Me=Yt(),lh=(s,e)=>{let t;switch(s.code){case U.ZodIssueCode.invalid_type:s.received===Me.ZodParsedType.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case U.ZodIssueCode.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,Me.util.jsonStringifyReplacer)}`;break;case U.ZodIssueCode.unrecognized_keys:t=`Unrecognized key(s) in object: ${Me.util.joinValues(s.keys,", ")}`;break;case U.ZodIssueCode.invalid_union:t="Invalid input";break;case U.ZodIssueCode.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Me.util.joinValues(s.options)}`;break;case U.ZodIssueCode.invalid_enum_value:t=`Invalid enum value. Expected ${Me.util.joinValues(s.options)}, received '${s.received}'`;break;case U.ZodIssueCode.invalid_arguments:t="Invalid function arguments";break;case U.ZodIssueCode.invalid_return_type:t="Invalid function return type";break;case U.ZodIssueCode.invalid_date:t="Invalid date";break;case U.ZodIssueCode.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:Me.util.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case U.ZodIssueCode.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case U.ZodIssueCode.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case U.ZodIssueCode.custom:t="Invalid input";break;case U.ZodIssueCode.invalid_intersection_types:t="Intersection results could not be merged";break;case U.ZodIssueCode.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case U.ZodIssueCode.not_finite:t="Number must be finite";break;default:t=e.defaultError,Me.util.assertNever(s)}return{message:t}};Ur.default=lh});var Qs=_(Ie=>{"use strict";var ch=Ie&&Ie.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.defaultErrorMap=void 0;Ie.setErrorMap=uh;Ie.getErrorMap=dh;var zo=ch(Fr());Ie.defaultErrorMap=zo.default;var Wo=zo.default;function uh(s){Wo=s}function dh(){return Wo}});var Yr=_(D=>{"use strict";var fh=D&&D.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(D,"__esModule",{value:!0});D.isAsync=D.isValid=D.isDirty=D.isAborted=D.OK=D.DIRTY=D.INVALID=D.ParseStatus=D.EMPTY_PATH=D.makeIssue=void 0;D.addIssueToContext=mh;var hh=Qs(),Ho=fh(Fr()),ph=s=>{let{data:e,path:t,errorMaps:n,issueData:r}=s,i=[...t,...r.path||[]],a={...r,path:i};if(r.message!==void 0)return{...r,path:i,message:r.message};let o="",l=n.filter(c=>!!c).slice().reverse();for(let c of l)o=c(a,{data:e,defaultError:o}).message;return{...r,path:i,message:o}};D.makeIssue=ph;D.EMPTY_PATH=[];function mh(s,e){let t=(0,hh.getErrorMap)(),n=(0,D.makeIssue)({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===Ho.default?void 0:Ho.default].filter(r=>!!r)});s.common.issues.push(n)}var Kr=class s{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let r of t){if(r.status==="aborted")return D.INVALID;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let r of t){let i=await r.key,a=await r.value;n.push({key:i,value:a})}return s.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:i,value:a}=r;if(i.status==="aborted"||a.status==="aborted")return D.INVALID;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||r.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}};D.ParseStatus=Kr;D.INVALID=Object.freeze({status:"aborted"});var yh=s=>({status:"dirty",value:s});D.DIRTY=yh;var gh=s=>({status:"valid",value:s});D.OK=gh;var vh=s=>s.status==="aborted";D.isAborted=vh;var bh=s=>s.status==="dirty";D.isDirty=bh;var wh=s=>s.status==="valid";D.isValid=wh;var _h=s=>typeof Promise<"u"&&s instanceof Promise;D.isAsync=_h});var Qo=_(Go=>{"use strict";Object.defineProperty(Go,"__esModule",{value:!0})});var el=_(Xs=>{"use strict";Object.defineProperty(Xs,"__esModule",{value:!0});Xs.errorUtil=void 0;var Xo;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e?.message})(Xo||(Xs.errorUtil=Xo={}))});var fl=_(h=>{"use strict";Object.defineProperty(h,"__esModule",{value:!0});h.discriminatedUnion=h.date=h.boolean=h.bigint=h.array=h.any=h.coerce=h.ZodFirstPartyTypeKind=h.late=h.ZodSchema=h.Schema=h.ZodReadonly=h.ZodPipeline=h.ZodBranded=h.BRAND=h.ZodNaN=h.ZodCatch=h.ZodDefault=h.ZodNullable=h.ZodOptional=h.ZodTransformer=h.ZodEffects=h.ZodPromise=h.ZodNativeEnum=h.ZodEnum=h.ZodLiteral=h.ZodLazy=h.ZodFunction=h.ZodSet=h.ZodMap=h.ZodRecord=h.ZodTuple=h.ZodIntersection=h.ZodDiscriminatedUnion=h.ZodUnion=h.ZodObject=h.ZodArray=h.ZodVoid=h.ZodNever=h.ZodUnknown=h.ZodAny=h.ZodNull=h.ZodUndefined=h.ZodSymbol=h.ZodDate=h.ZodBoolean=h.ZodBigInt=h.ZodNumber=h.ZodString=h.ZodType=void 0;h.NEVER=h.void=h.unknown=h.union=h.undefined=h.tuple=h.transformer=h.symbol=h.string=h.strictObject=h.set=h.record=h.promise=h.preprocess=h.pipeline=h.ostring=h.optional=h.onumber=h.oboolean=h.object=h.number=h.nullable=h.null=h.never=h.nativeEnum=h.nan=h.map=h.literal=h.lazy=h.intersection=h.instanceof=h.function=h.enum=h.effect=void 0;h.datetimeRegex=il;h.custom=ol;var w=Gs(),en=Qs(),C=el(),p=Yr(),S=Yt(),Q=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},tl=(s,e)=>{if((0,p.isValid)(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new w.ZodError(s.common.issues);return this._error=t,this._error}}};function P(s){if(!s)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:r}=s;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(a,o)=>{let{message:l}=s;return a.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??n??o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:l??t??o.defaultError}},description:r}}var x=class{get description(){return this._def.description}_getType(e){return(0,S.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0,S.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new p.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,S.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if((0,p.isAsync)(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,S.getParsedType)(e)},r=this._parseSync({data:e,path:n.path,parent:n});return tl(n,r)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,S.getParsedType)(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return(0,p.isValid)(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>(0,p.isValid)(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,S.getParsedType)(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await((0,p.isAsync)(r)?r:Promise.resolve(r));return tl(n,i)}refine(e,t){let n=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,i)=>{let a=e(r),o=()=>i.addIssue({code:w.ZodIssueCode.custom,...n(r)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t=="function"?t(n,r):t),!1))}_refinement(e){return new z({schema:this,typeName:O.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return G.create(this,this._def)}nullable(){return ae.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return de.create(this)}promise(){return Ae.create(this,this._def)}or(e){return Be.create([this,e],this._def)}and(e){return Ue.create(this,e,this._def)}transform(e){return new z({...P(this._def),schema:this,typeName:O.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new ze({...P(this._def),innerType:this,defaultValue:t,typeName:O.ZodDefault})}brand(){return new zt({typeName:O.ZodBranded,type:this,...P(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new We({...P(this._def),innerType:this,catchValue:t,typeName:O.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Wt.create(this,e)}readonly(){return He.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};h.ZodType=x;h.Schema=x;h.ZodSchema=x;var Sh=/^c[^\s-]{8,}$/i,Th=/^[0-9a-z]+$/,kh=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ih=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ch=/^[a-z0-9_-]{21}$/i,Nh=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ah=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Oh=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Eh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Jr,Ph=/^(?:(?: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])$/,xh=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,qh=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Lh=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Mh=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Dh=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nl="((\\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])))",$h=new RegExp(`^${nl}$`);function rl(s){let e="[0-5]\\d";s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`);let t=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Zh(s){return new RegExp(`^${rl(s)}$`)}function il(s){let e=`${nl}T${rl(s)}`,t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Rh(s,e){return!!((e==="v4"||!e)&&Ph.test(s)||(e==="v6"||!e)&&qh.test(s))}function jh(s,e){if(!Nh.test(s))return!1;try{let[t]=s.split(".");if(!t)return!1;let n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(n));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function Vh(s,e){return!!((e==="v4"||!e)&&xh.test(s)||(e==="v6"||!e)&&Lh.test(s))}var Ce=class s extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==S.ZodParsedType.string){let i=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(i,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.string,received:i.parsedType}),p.INVALID}let n=new p.ParseStatus,r;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,o=e.data.length<i.value;(a||o)&&(r=this._getOrReturnCtx(e,r),a?(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Oh.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"email",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Jr||(Jr=new RegExp(Eh,"u")),Jr.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"emoji",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Ih.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"uuid",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Ch.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"nanoid",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Sh.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"cuid",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Th.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"cuid2",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")kh.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"ulid",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"url",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"regex",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?il(i).test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?$h.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Zh(i).test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Ah.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"duration",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Rh(e.data,i.version)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"ip",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?jh(e.data,i.alg)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"jwt",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Vh(e.data,i.version)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"cidr",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Mh.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"base64",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Dh.test(e.data)||(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{validation:"base64url",code:w.ZodIssueCode.invalid_string,message:i.message}),n.dirty()):S.util.assertNever(i);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(r=>e.test(r),{validation:t,code:w.ZodIssueCode.invalid_string,...C.errorUtil.errToObj(n)})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...C.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...C.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...C.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...C.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...C.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...C.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...C.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...C.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...C.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...C.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...C.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...C.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...C.errorUtil.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...C.errorUtil.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...C.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...C.errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...C.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...C.errorUtil.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...C.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...C.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...C.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...C.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...C.errorUtil.errToObj(t)})}nonempty(e){return this.min(1,C.errorUtil.errToObj(e))}trim(){return new s({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new s({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new s({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};h.ZodString=Ce;Ce.create=s=>new Ce({checks:[],typeName:O.ZodString,coerce:s?.coerce??!1,...P(s)});function Bh(s,e){let t=(s.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=t>n?t:n,i=Number.parseInt(s.toFixed(r).replace(".","")),a=Number.parseInt(e.toFixed(r).replace(".",""));return i%a/10**r}var De=class s extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==S.ZodParsedType.number){let i=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(i,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.number,received:i.parsedType}),p.INVALID}let n,r=new p.ParseStatus;for(let i of this._def.checks)i.kind==="int"?S.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="multipleOf"?Bh(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.not_finite,message:i.message}),r.dirty()):S.util.assertNever(i);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,C.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,C.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,C.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,C.errorUtil.toString(t))}setLimit(e,t,n,r){return new s({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:C.errorUtil.toString(r)}]})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:C.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:C.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:C.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:C.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:C.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:C.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:C.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:C.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:C.errorUtil.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&S.util.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};h.ZodNumber=De;De.create=s=>new De({checks:[],typeName:O.ZodNumber,coerce:s?.coerce||!1,...P(s)});var $e=class s extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==S.ZodParsedType.bigint)return this._getInvalidInput(e);let n,r=new p.ParseStatus;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):S.util.assertNever(i);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(t,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.bigint,received:t.parsedType}),p.INVALID}gte(e,t){return this.setLimit("min",e,!0,C.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,C.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,C.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,C.errorUtil.toString(t))}setLimit(e,t,n,r){return new s({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:C.errorUtil.toString(r)}]})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:C.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:C.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:C.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:C.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:C.errorUtil.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};h.ZodBigInt=$e;$e.create=s=>new $e({checks:[],typeName:O.ZodBigInt,coerce:s?.coerce??!1,...P(s)});var Ze=class extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==S.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.boolean,received:n.parsedType}),p.INVALID}return(0,p.OK)(e.data)}};h.ZodBoolean=Ze;Ze.create=s=>new Ze({typeName:O.ZodBoolean,coerce:s?.coerce||!1,...P(s)});var Re=class s extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==S.ZodParsedType.date){let i=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(i,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.date,received:i.parsedType}),p.INVALID}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(i,{code:w.ZodIssueCode.invalid_date}),p.INVALID}let n=new p.ParseStatus,r;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(r=this._getOrReturnCtx(e,r),(0,p.addIssueToContext)(r,{code:w.ZodIssueCode.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):S.util.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:C.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:C.errorUtil.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};h.ZodDate=Re;Re.create=s=>new Re({checks:[],coerce:s?.coerce||!1,typeName:O.ZodDate,...P(s)});var ut=class extends x{_parse(e){if(this._getType(e)!==S.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.symbol,received:n.parsedType}),p.INVALID}return(0,p.OK)(e.data)}};h.ZodSymbol=ut;ut.create=s=>new ut({typeName:O.ZodSymbol,...P(s)});var je=class extends x{_parse(e){if(this._getType(e)!==S.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.undefined,received:n.parsedType}),p.INVALID}return(0,p.OK)(e.data)}};h.ZodUndefined=je;je.create=s=>new je({typeName:O.ZodUndefined,...P(s)});var Ve=class extends x{_parse(e){if(this._getType(e)!==S.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.null,received:n.parsedType}),p.INVALID}return(0,p.OK)(e.data)}};h.ZodNull=Ve;Ve.create=s=>new Ve({typeName:O.ZodNull,...P(s)});var Ne=class extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,p.OK)(e.data)}};h.ZodAny=Ne;Ne.create=s=>new Ne({typeName:O.ZodAny,...P(s)});var ue=class extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,p.OK)(e.data)}};h.ZodUnknown=ue;ue.create=s=>new ue({typeName:O.ZodUnknown,...P(s)});var se=class extends x{_parse(e){let t=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(t,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.never,received:t.parsedType}),p.INVALID}};h.ZodNever=se;se.create=s=>new se({typeName:O.ZodNever,...P(s)});var dt=class extends x{_parse(e){if(this._getType(e)!==S.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.void,received:n.parsedType}),p.INVALID}return(0,p.OK)(e.data)}};h.ZodVoid=dt;dt.create=s=>new dt({typeName:O.ZodVoid,...P(s)});var de=class s extends x{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==S.ZodParsedType.array)return(0,p.addIssueToContext)(t,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.array,received:t.parsedType}),p.INVALID;if(r.exactLength!==null){let a=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(a||o)&&((0,p.addIssueToContext)(t,{code:a?w.ZodIssueCode.too_big:w.ZodIssueCode.too_small,minimum:o?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&((0,p.addIssueToContext)(t,{code:w.ZodIssueCode.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&((0,p.addIssueToContext)(t,{code:w.ZodIssueCode.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((a,o)=>r.type._parseAsync(new Q(t,a,t.path,o)))).then(a=>p.ParseStatus.mergeArray(n,a));let i=[...t.data].map((a,o)=>r.type._parseSync(new Q(t,a,t.path,o)));return p.ParseStatus.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new s({...this._def,minLength:{value:e,message:C.errorUtil.toString(t)}})}max(e,t){return new s({...this._def,maxLength:{value:e,message:C.errorUtil.toString(t)}})}length(e,t){return new s({...this._def,exactLength:{value:e,message:C.errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}};h.ZodArray=de;de.create=(s,e)=>new de({type:s,minLength:null,maxLength:null,exactLength:null,typeName:O.ZodArray,...P(e)});function ct(s){if(s instanceof Y){let e={};for(let t in s.shape){let n=s.shape[t];e[t]=G.create(ct(n))}return new Y({...s._def,shape:()=>e})}else return s instanceof de?new de({...s._def,type:ct(s.element)}):s instanceof G?G.create(ct(s.unwrap())):s instanceof ae?ae.create(ct(s.unwrap())):s instanceof ie?ie.create(s.items.map(e=>ct(e))):s}var Y=class s extends x{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=S.util.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==S.ZodParsedType.object){let c=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(c,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.object,received:c.parsedType}),p.INVALID}let{status:n,ctx:r}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof se&&this._def.unknownKeys==="strip"))for(let c in r.data)a.includes(c)||o.push(c);let l=[];for(let c of a){let f=i[c],d=r.data[c];l.push({key:{status:"valid",value:c},value:f._parse(new Q(r,d,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof se){let c=this._def.unknownKeys;if(c==="passthrough")for(let f of o)l.push({key:{status:"valid",value:f},value:{status:"valid",value:r.data[f]}});else if(c==="strict")o.length>0&&((0,p.addIssueToContext)(r,{code:w.ZodIssueCode.unrecognized_keys,keys:o}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let f of o){let d=r.data[f];l.push({key:{status:"valid",value:f},value:c._parse(new Q(r,d,r.path,f)),alwaysSet:f in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let c=[];for(let f of l){let d=await f.key,u=await f.value;c.push({key:d,value:u,alwaysSet:f.alwaysSet})}return c}).then(c=>p.ParseStatus.mergeObjectSync(n,c)):p.ParseStatus.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return C.errorUtil.errToObj,new s({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{let r=this._def.errorMap?.(t,n).message??n.defaultError;return t.code==="unrecognized_keys"?{message:C.errorUtil.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new s({...this._def,unknownKeys:"strip"})}passthrough(){return new s({...this._def,unknownKeys:"passthrough"})}extend(e){return new s({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new s({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:O.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new s({...this._def,catchall:e})}pick(e){let t={};for(let n of S.util.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new s({...this._def,shape:()=>t})}omit(e){let t={};for(let n of S.util.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new s({...this._def,shape:()=>t})}deepPartial(){return ct(this)}partial(e){let t={};for(let n of S.util.objectKeys(this.shape)){let r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}return new s({...this._def,shape:()=>t})}required(e){let t={};for(let n of S.util.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof G;)i=i._def.innerType;t[n]=i}return new s({...this._def,shape:()=>t})}keyof(){return al(S.util.objectKeys(this.shape))}};h.ZodObject=Y;Y.create=(s,e)=>new Y({shape:()=>s,unknownKeys:"strip",catchall:se.create(),typeName:O.ZodObject,...P(e)});Y.strictCreate=(s,e)=>new Y({shape:()=>s,unknownKeys:"strict",catchall:se.create(),typeName:O.ZodObject,...P(e)});Y.lazycreate=(s,e)=>new Y({shape:s,unknownKeys:"strip",catchall:se.create(),typeName:O.ZodObject,...P(e)});var Be=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(i){for(let o of i)if(o.result.status==="valid")return o.result;for(let o of i)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let a=i.map(o=>new w.ZodError(o.ctx.common.issues));return(0,p.addIssueToContext)(t,{code:w.ZodIssueCode.invalid_union,unionErrors:a}),p.INVALID}if(t.common.async)return Promise.all(n.map(async i=>{let a={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(r);{let i,a=[];for(let l of n){let c={...t,common:{...t.common,issues:[]},parent:null},f=l._parseSync({data:t.data,path:t.path,parent:c});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:c}),c.common.issues.length&&a.push(c.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let o=a.map(l=>new w.ZodError(l));return(0,p.addIssueToContext)(t,{code:w.ZodIssueCode.invalid_union,unionErrors:o}),p.INVALID}}get options(){return this._def.options}};h.ZodUnion=Be;Be.create=(s,e)=>new Be({options:s,typeName:O.ZodUnion,...P(e)});var ce=s=>s instanceof Fe?ce(s.schema):s instanceof z?ce(s.innerType()):s instanceof Ke?[s.value]:s instanceof Ye?s.options:s instanceof Je?S.util.objectValues(s.enum):s instanceof ze?ce(s._def.innerType):s instanceof je?[void 0]:s instanceof Ve?[null]:s instanceof G?[void 0,...ce(s.unwrap())]:s instanceof ae?[null,...ce(s.unwrap())]:s instanceof zt||s instanceof He?ce(s.unwrap()):s instanceof We?ce(s._def.innerType):[],tn=class s extends x{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.ZodParsedType.object)return(0,p.addIssueToContext)(t,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.object,received:t.parsedType}),p.INVALID;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):((0,p.addIssueToContext)(t,{code:w.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),p.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let r=new Map;for(let i of t){let a=ce(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of a){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,i)}}return new s({typeName:O.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...P(n)})}};h.ZodDiscriminatedUnion=tn;function zr(s,e){let t=(0,S.getParsedType)(s),n=(0,S.getParsedType)(e);if(s===e)return{valid:!0,data:s};if(t===S.ZodParsedType.object&&n===S.ZodParsedType.object){let r=S.util.objectKeys(e),i=S.util.objectKeys(s).filter(o=>r.indexOf(o)!==-1),a={...s,...e};for(let o of i){let l=zr(s[o],e[o]);if(!l.valid)return{valid:!1};a[o]=l.data}return{valid:!0,data:a}}else if(t===S.ZodParsedType.array&&n===S.ZodParsedType.array){if(s.length!==e.length)return{valid:!1};let r=[];for(let i=0;i<s.length;i++){let a=s[i],o=e[i],l=zr(a,o);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return t===S.ZodParsedType.date&&n===S.ZodParsedType.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}var Ue=class extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(i,a)=>{if((0,p.isAborted)(i)||(0,p.isAborted)(a))return p.INVALID;let o=zr(i.value,a.value);return o.valid?(((0,p.isDirty)(i)||(0,p.isDirty)(a))&&t.dirty(),{status:t.value,value:o.data}):((0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_intersection_types}),p.INVALID)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>r(i,a)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};h.ZodIntersection=Ue;Ue.create=(s,e,t)=>new Ue({left:s,right:e,typeName:O.ZodIntersection,...P(t)});var ie=class s extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==S.ZodParsedType.array)return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.array,received:n.parsedType}),p.INVALID;if(n.data.length<this._def.items.length)return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,p.addIssueToContext)(n,{code:w.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...n.data].map((a,o)=>{let l=this._def.items[o]||this._def.rest;return l?l._parse(new Q(n,a,n.path,o)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>p.ParseStatus.mergeArray(t,a)):p.ParseStatus.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new s({...this._def,rest:e})}};h.ZodTuple=ie;ie.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ie({items:s,typeName:O.ZodTuple,rest:null,...P(e)})};var sn=class s extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==S.ZodParsedType.object)return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.object,received:n.parsedType}),p.INVALID;let r=[],i=this._def.keyType,a=this._def.valueType;for(let o in n.data)r.push({key:i._parse(new Q(n,o,n.path,o)),value:a._parse(new Q(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?p.ParseStatus.mergeObjectAsync(t,r):p.ParseStatus.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof x?new s({keyType:e,valueType:t,typeName:O.ZodRecord,...P(n)}):new s({keyType:Ce.create(),valueType:e,typeName:O.ZodRecord,...P(t)})}};h.ZodRecord=sn;var ft=class extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==S.ZodParsedType.map)return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.map,received:n.parsedType}),p.INVALID;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([o,l],c)=>({key:r._parse(new Q(n,o,n.path,[c,"key"])),value:i._parse(new Q(n,l,n.path,[c,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let l of a){let c=await l.key,f=await l.value;if(c.status==="aborted"||f.status==="aborted")return p.INVALID;(c.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(c.value,f.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let l of a){let c=l.key,f=l.value;if(c.status==="aborted"||f.status==="aborted")return p.INVALID;(c.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(c.value,f.value)}return{status:t.value,value:o}}}};h.ZodMap=ft;ft.create=(s,e,t)=>new ft({valueType:e,keyType:s,typeName:O.ZodMap,...P(t)});var ht=class s extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==S.ZodParsedType.set)return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.set,received:n.parsedType}),p.INVALID;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&((0,p.addIssueToContext)(n,{code:w.ZodIssueCode.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&((0,p.addIssueToContext)(n,{code:w.ZodIssueCode.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(l){let c=new Set;for(let f of l){if(f.status==="aborted")return p.INVALID;f.status==="dirty"&&t.dirty(),c.add(f.value)}return{status:t.value,value:c}}let o=[...n.data.values()].map((l,c)=>i._parse(new Q(n,l,n.path,c)));return n.common.async?Promise.all(o).then(l=>a(l)):a(o)}min(e,t){return new s({...this._def,minSize:{value:e,message:C.errorUtil.toString(t)}})}max(e,t){return new s({...this._def,maxSize:{value:e,message:C.errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};h.ZodSet=ht;ht.create=(s,e)=>new ht({valueType:s,minSize:null,maxSize:null,typeName:O.ZodSet,...P(e)});var nn=class s extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.ZodParsedType.function)return(0,p.addIssueToContext)(t,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.function,received:t.parsedType}),p.INVALID;function n(o,l){return(0,p.makeIssue)({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,en.getErrorMap)(),en.defaultErrorMap].filter(c=>!!c),issueData:{code:w.ZodIssueCode.invalid_arguments,argumentsError:l}})}function r(o,l){return(0,p.makeIssue)({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0,en.getErrorMap)(),en.defaultErrorMap].filter(c=>!!c),issueData:{code:w.ZodIssueCode.invalid_return_type,returnTypeError:l}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Ae){let o=this;return(0,p.OK)(async function(...l){let c=new w.ZodError([]),f=await o._def.args.parseAsync(l,i).catch(y=>{throw c.addIssue(n(l,y)),c}),d=await Reflect.apply(a,this,f);return await o._def.returns._def.type.parseAsync(d,i).catch(y=>{throw c.addIssue(r(d,y)),c})})}else{let o=this;return(0,p.OK)(function(...l){let c=o._def.args.safeParse(l,i);if(!c.success)throw new w.ZodError([n(l,c.error)]);let f=Reflect.apply(a,this,c.data),d=o._def.returns.safeParse(f,i);if(!d.success)throw new w.ZodError([r(f,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new s({...this._def,args:ie.create(e).rest(ue.create())})}returns(e){return new s({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new s({args:e||ie.create([]).rest(ue.create()),returns:t||ue.create(),typeName:O.ZodFunction,...P(n)})}};h.ZodFunction=nn;var Fe=class extends x{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};h.ZodLazy=Fe;Fe.create=(s,e)=>new Fe({getter:s,typeName:O.ZodLazy,...P(e)});var Ke=class extends x{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(t,{received:t.data,code:w.ZodIssueCode.invalid_literal,expected:this._def.value}),p.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};h.ZodLiteral=Ke;Ke.create=(s,e)=>new Ke({value:s,typeName:O.ZodLiteral,...P(e)});function al(s,e){return new Ye({values:s,typeName:O.ZodEnum,...P(e)})}var Ye=class s extends x{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return(0,p.addIssueToContext)(t,{expected:S.util.joinValues(n),received:t.parsedType,code:w.ZodIssueCode.invalid_type}),p.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return(0,p.addIssueToContext)(t,{received:t.data,code:w.ZodIssueCode.invalid_enum_value,options:n}),p.INVALID}return(0,p.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return s.create(e,{...this._def,...t})}exclude(e,t=this._def){return s.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};h.ZodEnum=Ye;Ye.create=al;var Je=class extends x{_parse(e){let t=S.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==S.ZodParsedType.string&&n.parsedType!==S.ZodParsedType.number){let r=S.util.objectValues(t);return(0,p.addIssueToContext)(n,{expected:S.util.joinValues(r),received:n.parsedType,code:w.ZodIssueCode.invalid_type}),p.INVALID}if(this._cache||(this._cache=new Set(S.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=S.util.objectValues(t);return(0,p.addIssueToContext)(n,{received:n.data,code:w.ZodIssueCode.invalid_enum_value,options:r}),p.INVALID}return(0,p.OK)(e.data)}get enum(){return this._def.values}};h.ZodNativeEnum=Je;Je.create=(s,e)=>new Je({values:s,typeName:O.ZodNativeEnum,...P(e)});var Ae=class extends x{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==S.ZodParsedType.promise&&t.common.async===!1)return(0,p.addIssueToContext)(t,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.promise,received:t.parsedType}),p.INVALID;let n=t.parsedType===S.ZodParsedType.promise?t.data:Promise.resolve(t.data);return(0,p.OK)(n.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};h.ZodPromise=Ae;Ae.create=(s,e)=>new Ae({type:s,typeName:O.ZodPromise,...P(e)});var z=class extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===O.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:a=>{(0,p.addIssueToContext)(n,a),a.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type==="preprocess"){let a=r.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async o=>{if(t.value==="aborted")return p.INVALID;let l=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return l.status==="aborted"?p.INVALID:l.status==="dirty"||t.value==="dirty"?(0,p.DIRTY)(l.value):l});{if(t.value==="aborted")return p.INVALID;let o=this._def.schema._parseSync({data:a,path:n.path,parent:n});return o.status==="aborted"?p.INVALID:o.status==="dirty"||t.value==="dirty"?(0,p.DIRTY)(o.value):o}}if(r.type==="refinement"){let a=o=>{let l=r.refinement(o,i);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?p.INVALID:(o.status==="dirty"&&t.dirty(),a(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?p.INVALID:(o.status==="dirty"&&t.dirty(),a(o.value).then(()=>({status:t.value,value:o.value}))))}if(r.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,p.isValid)(a))return p.INVALID;let o=r.transform(a.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>(0,p.isValid)(a)?Promise.resolve(r.transform(a.value,i)).then(o=>({status:t.value,value:o})):p.INVALID);S.util.assertNever(r)}};h.ZodEffects=z;h.ZodTransformer=z;z.create=(s,e,t)=>new z({schema:s,typeName:O.ZodEffects,effect:e,...P(t)});z.createWithPreprocess=(s,e,t)=>new z({schema:e,effect:{type:"preprocess",transform:s},typeName:O.ZodEffects,...P(t)});var G=class extends x{_parse(e){return this._getType(e)===S.ZodParsedType.undefined?(0,p.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};h.ZodOptional=G;G.create=(s,e)=>new G({innerType:s,typeName:O.ZodOptional,...P(e)});var ae=class extends x{_parse(e){return this._getType(e)===S.ZodParsedType.null?(0,p.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};h.ZodNullable=ae;ae.create=(s,e)=>new ae({innerType:s,typeName:O.ZodNullable,...P(e)});var ze=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===S.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};h.ZodDefault=ze;ze.create=(s,e)=>new ze({innerType:s,typeName:O.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...P(e)});var We=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,p.isAsync)(r)?r.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new w.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new w.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};h.ZodCatch=We;We.create=(s,e)=>new We({innerType:s,typeName:O.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...P(e)});var pt=class extends x{_parse(e){if(this._getType(e)!==S.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,p.addIssueToContext)(n,{code:w.ZodIssueCode.invalid_type,expected:S.ZodParsedType.nan,received:n.parsedType}),p.INVALID}return{status:"valid",value:e.data}}};h.ZodNaN=pt;pt.create=s=>new pt({typeName:O.ZodNaN,...P(s)});h.BRAND=Symbol("zod_brand");var zt=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}};h.ZodBranded=zt;var Wt=class s extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?p.INVALID:i.status==="dirty"?(t.dirty(),(0,p.DIRTY)(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?p.INVALID:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,t){return new s({in:e,out:t,typeName:O.ZodPipeline})}};h.ZodPipeline=Wt;var He=class extends x{_parse(e){let t=this._def.innerType._parse(e),n=r=>((0,p.isValid)(r)&&(r.value=Object.freeze(r.value)),r);return(0,p.isAsync)(t)?t.then(r=>n(r)):n(t)}unwrap(){return this._def.innerType}};h.ZodReadonly=He;He.create=(s,e)=>new He({innerType:s,typeName:O.ZodReadonly,...P(e)});function sl(s,e){let t=typeof s=="function"?s(e):typeof s=="string"?{message:s}:s;return typeof t=="string"?{message:t}:t}function ol(s,e={},t){return s?Ne.create().superRefine((n,r)=>{let i=s(n);if(i instanceof Promise)return i.then(a=>{if(!a){let o=sl(e,n),l=o.fatal??t??!0;r.addIssue({code:"custom",...o,fatal:l})}});if(!i){let a=sl(e,n),o=a.fatal??t??!0;r.addIssue({code:"custom",...a,fatal:o})}}):Ne.create()}h.late={object:Y.lazycreate};var O;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(O||(h.ZodFirstPartyTypeKind=O={}));var Uh=(s,e={message:`Input not instance of ${s.name}`})=>ol(t=>t instanceof s,e);h.instanceof=Uh;var ll=Ce.create;h.string=ll;var cl=De.create;h.number=cl;var Fh=pt.create;h.nan=Fh;var Kh=$e.create;h.bigint=Kh;var ul=Ze.create;h.boolean=ul;var Yh=Re.create;h.date=Yh;var Jh=ut.create;h.symbol=Jh;var zh=je.create;h.undefined=zh;var Wh=Ve.create;h.null=Wh;var Hh=Ne.create;h.any=Hh;var Gh=ue.create;h.unknown=Gh;var Qh=se.create;h.never=Qh;var Xh=dt.create;h.void=Xh;var ep=de.create;h.array=ep;var tp=Y.create;h.object=tp;var sp=Y.strictCreate;h.strictObject=sp;var np=Be.create;h.union=np;var rp=tn.create;h.discriminatedUnion=rp;var ip=Ue.create;h.intersection=ip;var ap=ie.create;h.tuple=ap;var op=sn.create;h.record=op;var lp=ft.create;h.map=lp;var cp=ht.create;h.set=cp;var up=nn.create;h.function=up;var dp=Fe.create;h.lazy=dp;var fp=Ke.create;h.literal=fp;var hp=Ye.create;h.enum=hp;var pp=Je.create;h.nativeEnum=pp;var mp=Ae.create;h.promise=mp;var dl=z.create;h.effect=dl;h.transformer=dl;var yp=G.create;h.optional=yp;var gp=ae.create;h.nullable=gp;var vp=z.createWithPreprocess;h.preprocess=vp;var bp=Wt.create;h.pipeline=bp;var wp=()=>ll().optional();h.ostring=wp;var _p=()=>cl().optional();h.onumber=_p;var Sp=()=>ul().optional();h.oboolean=Sp;h.coerce={string:s=>Ce.create({...s,coerce:!0}),number:s=>De.create({...s,coerce:!0}),boolean:s=>Ze.create({...s,coerce:!0}),bigint:s=>$e.create({...s,coerce:!0}),date:s=>Re.create({...s,coerce:!0})};h.NEVER=p.INVALID});var Wr=_(X=>{"use strict";var Tp=X&&X.__createBinding||(Object.create?function(s,e,t,n){n===void 0&&(n=t);var r=Object.getOwnPropertyDescriptor(e,t);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,r)}:function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]}),mt=X&&X.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Tp(e,s,t)};Object.defineProperty(X,"__esModule",{value:!0});mt(Qs(),X);mt(Yr(),X);mt(Qo(),X);mt(Yt(),X);mt(fl(),X);mt(Gs(),X)});var ml=_(J=>{"use strict";var hl=J&&J.__createBinding||(Object.create?function(s,e,t,n){n===void 0&&(n=t);var r=Object.getOwnPropertyDescriptor(e,t);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,n,r)}:function(s,e,t,n){n===void 0&&(n=t),s[n]=e[t]}),kp=J&&J.__setModuleDefault||(Object.create?function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}:function(s,e){s.default=e}),Ip=J&&J.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.prototype.hasOwnProperty.call(s,t)&&hl(e,s,t);return kp(e,s),e},Cp=J&&J.__exportStar||function(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&hl(e,s,t)};Object.defineProperty(J,"__esModule",{value:!0});J.z=void 0;var pl=Ip(Wr());J.z=pl;Cp(Wr(),J);J.default=pl});var zp={};El(zp,{default:()=>Jp,extractTools:()=>Qr});module.exports=Pl(zp);function ti(s){let e=s?.find(d=>d.type==="tool");if(!e)return null;let t=Array.isArray(e.content)?e.content:[],n=t.find(d=>d.type==="toolparams"),r=t.find(d=>d.type==="toolverifies"),i=Array.isArray(n?.attrs?.rows)?n.attrs.rows:[],a=Array.isArray(r?.attrs?.rows)?r.attrs.rows:[],o=r?.attrs?.onFailure||"withdraw",l=a.map(d=>({...d,onFailure:d.onFailure||o})),c=e.attrs?.requestSectionLabel,f=c!=null;return{uid:e.attrs?.uid,name:e.attrs?.name||"",title:e.attrs?.title||void 0,description:e.attrs?.description||"",annotations:e.attrs?.annotations||{},requestUid:e.attrs?.requestUid||void 0,params:i,verifies:l,enabled:e.attrs?.enabled!==!1,requestFilePath:e.attrs?.requestFilePath||void 0,requestSectionLabel:f?c:void 0}}var fe=require("fs"),vl=require("node:child_process"),Gt=require("node:path"),Ht=on(Ko(),1),W=on(ml(),1),Hr;async function rn(s){return Hr||({parseVoidFileSections:Hr}=await import("@voiden/executors")),Hr(s)}function Gr(s,e){return(0,Gt.isAbsolute)(s)||!e?s:(0,Gt.join)(e,s)}function an(s,e){if(s.requestSectionLabel!==void 0){let t=s.requestFilePath||s.filePath;return{filePath:Gr(t,e),sectionLabel:s.requestSectionLabel}}return{filePath:s.filePath,sectionLabel:s.sectionLabel}}async function bl(s,e,t,n){let r=await s.collectVoidFiles(t),i=[];for(let a of r){let o=(0,fe.readFileSync)(a,"utf-8"),l=await rn(o);for(let c of l){let f=e(c.blocks);for(let d of f)i.push({...d,filePath:a,sectionLabel:c.label})}}return i}var Np=/\{\{([^}]+)\}\}/g;function Ap(s){let e=new Set,t=new RegExp(Np.source,"g"),n;for(;(n=t.exec(s))!==null;)e.add(n[1].trim());return e}async function wl(s,e,t){let n=[],r=new Set,i=new Map,a=new Set,o=new Set,l=await s.collectVoidFiles(e);for(let u of l){let y=(0,fe.readFileSync)(u,"utf-8"),v=await rn(y);v.length===1&&o.add(u);for(let m of v)a.add(`${u}::${m.label??""}`)}let c=async u=>{let{filePath:y,sectionLabel:v}=an(u,e),m=`${y}::${v??""}`;if(i.has(m))return i.get(m);let g;try{let T=(0,fe.readFileSync)(y,"utf-8"),b=await rn(T),k=b.length===1?b[0]:b.find(N=>N.label===v);g=k?JSON.stringify(k.blocks):null}catch{g=null}return i.set(m,g),g},f=(u,y,v)=>{n.push({tool:u,check:y,message:v}),r.add(u)};for(let u of t){let y=await c(u);for(let v of u.params)v.binds&&y!==null&&!y.includes(`{{${v.binds}}}`)&&f(u,"unbound-param",`Tool "${u.name}" param "${v.name}" binds to "{{${v.binds}}}", which doesn't appear anywhere in the request it decorates.`);if(y!==null){let v=new Set(u.params.map(m=>m.binds).filter(Boolean));for(let m of Ap(y))v.has(m)||f(u,"unresolved-placeholder",`Tool "${u.name}" request uses "{{${m}}}", which isn't declared as any parameter's "binds" \u2014 it can only resolve if it happens to be a real environment variable outside Voiden's knowledge.`)}for(let v of u.verifies){let m=Gr(v.filePath||u.filePath,e),g=`${m}::${v.sectionLabel}`;!o.has(m)&&!a.has(g)&&f(u,"missing-section",`Tool "${u.name}" verifies entry points at section "${v.sectionLabel}"${v.filePath?` in ${v.filePath}`:""}, which doesn't exist.`)}if(u.requestSectionLabel!==void 0){let{filePath:v,sectionLabel:m}=an(u,e),g=`${v}::${m}`;!o.has(v)&&!a.has(g)&&f(u,"dangling-request-reference",`Tool "${u.name}" is bound to section "${m}"${u.requestFilePath?` in ${u.requestFilePath}`:""}, which doesn't exist.`)}if(u.annotations?.readOnlyHint){let{filePath:v,sectionLabel:m}=an(u,e);try{let g=(0,fe.readFileSync)(v,"utf-8"),T=(await rn(g)).find(b=>b.label===m);if(T){let{method:b}=s.getRequestPreview(T.blocks);["POST","PUT","PATCH","DELETE"].includes(b.toUpperCase())&&f(u,"readonly-mutating",`Tool "${u.name}" is annotated readOnlyHint but its request uses ${b.toUpperCase()}.`)}}catch{}}}let d=new Map;for(let u of t){if(!u.name)continue;let y=d.get(u.name)??[];y.push(u),d.set(u.name,y)}for(let[u,y]of d)if(y.length>1)for(let v of y)f(v,"duplicate-name",`Tool name "${u}" is used by ${y.length} tools \u2014 names must be unique across the served set.`);return{validTools:t.filter(u=>!r.has(u)),issues:n}}function Op(s){let e=(s.reportEntries??[]).filter(t=>t.type==="assertion");return e.length>0?e.every(t=>t.passed===!0):s.success===!0}var Ep={hourly:60,daily:60*24,weekly:60*24*7,monthly:60*24*30},yl=60;function Pp(s){return s?Ep[s.trim().toLowerCase()]??yl:yl}function xp(s){let e={};for(let t of s)t.testValue!==void 0&&t.testValue!==""&&(e[t.binds]=t.testValue);return e}async function _l(s,e,t){let n=[];for(let r of e){if(r.verifies.length===0){n.push({tool:r,state:"unverified",results:[],note:"No verification requests attached."});continue}let i=t.cadence?r.verifies.filter(b=>b.cadence===t.cadence):r.verifies;if(i.length===0){n.push({tool:r,state:"unverified",results:[],note:`No verification requests matched cadence "${t.cadence}".`});continue}let a=i.filter(b=>b.mode!=="none");if(a.length===0){n.push({tool:r,state:"unverified",results:[],note:'Every matching verification request has mode "none" \u2014 none were automatically run.'});continue}let o=a.filter(b=>b.role==="auth-check"),l=a.filter(b=>b.role!=="auth-check"),c=t.runtimeVars??{},f=[],d=t.now??Date.now(),u=t.entryCache,y=async b=>{let k=Gr(b.filePath||r.filePath,t.projectRoot);return(await s.runVoidFile(k,{sectionLabel:b.sectionLabel,env:{...t.env,...xp(r.params)},runtimeVars:c,activePlugins:t.activePlugins})).results[0]?.result},v=async(b,k)=>{let N=`${r.toolBlockUid}::${k}`;if(u){let L=u.get(N);if(L&&d-L.verifiedAt<Pp(b.cadence)*6e4)return{passed:L.passed,runResult:L.runResult}}let A=await y(b),E=A?Op(A):!1;return u&&u.set(N,{passed:E,runResult:A,verifiedAt:d}),console.error(` ${E?"\u2713":"\u2717"} verify "${r.name}" [${b.role}${b.cadence?`, cadence: ${b.cadence}`:""}] \u2014 ${E?"passed":`failed${A?.error?`: ${A.error}`:""}`}`),{passed:E,runResult:A}},m=!1,g;for(let b of o){let{passed:k,runResult:N}=await v(b,r.verifies.indexOf(b));f.push({entry:b,passed:k,reason:k?void 0:"auth-failure",runResult:N}),k||(m=!0,g=`Auth check "${b.sectionLabel}" failed \u2014 dependent verification requests were skipped.`)}if(m){n.push({tool:r,state:"failing",results:f,note:g});continue}let T=!1;for(let b of l){let{passed:k,runResult:N}=await v(b,r.verifies.indexOf(b));k||(T=!0),f.push({entry:b,passed:k,reason:k?void 0:"contract-failure",runResult:N})}n.push({tool:r,state:T?"failing":l.length>0?"verified":"unverified",results:f})}return n}function qp(s){return s.results.filter(t=>!t.passed).map(t=>t.entry.onFailure||"withdraw").some(t=>t==="withdraw")?"withdraw":"advertise-degraded"}function Lp(s){return s.map(e=>{let{tool:t,state:n}=e;return t.enabled===!1?{tool:t,status:e,served:!1,disabledManually:!0}:n==="failing"?qp(e)==="withdraw"?{tool:t,status:e,served:!1}:{tool:t,status:e,served:!0,descriptionNote:`\u26A0 DEGRADED \u2014 recent verification failed (${e.note??"see voiden-runner tool verify for details"}). `}:n==="unverified"?{tool:t,status:e,served:!0,descriptionNote:`[unverified \u2014 ${e.note??"no automated verification passed yet"}] `}:{tool:t,status:e,served:!0}})}function Mp(s){let e=new Map;for(let t of s){let n=e.get(t.tool)??[];n.push(`[${t.check}] ${t.message}`),e.set(t.tool,n)}return[...e.entries()].map(([t,n])=>({tool:t,served:!1,excluded:!0,excludedReasons:n}))}async function Dp(s,e,t,n,r,i){let a=await bl(s,e,t,{activePlugins:r}),{validTools:o,issues:l}=await wl(s,t,a),c={...Sl(t),...n},f=await _l(s,o,{env:c,activePlugins:r,entryCache:i?.entryCache,now:i?.now,projectRoot:t});return[...Mp(l),...Lp(f)]}function Sl(s){let e=a=>{try{let o=(0,fe.readFileSync)((0,Gt.join)(s,a),"utf-8");return Ht.default.parse(o)||{}}catch{return{}}},t=e(".voiden/env-public.yaml"),n=e(".voiden/env-private.yaml"),r=new Set([...Object.keys(t),...Object.keys(n)]);if(r.size!==1)return{};let[i]=r;return{...t[i]?.variables??{},...n[i]?.variables??{}}}function $p(s){let e={string:W.z.string(),number:W.z.number(),integer:W.z.number().int(),boolean:W.z.boolean(),object:W.z.record(W.z.any()),array:W.z.array(W.z.any())}[s.type],t=s.description?e.describe(s.description):e;return s.required?t:t.optional()}function Zp(s){return Object.fromEntries(s.params.map(e=>[e.name,$p(e)]))}function Tl(s,e,t,n,r,i){return async a=>{let o={...t};for(let d of e.params)a[d.name]!==void 0&&(o[d.binds]=typeof a[d.name]=="string"?a[d.name]:JSON.stringify(a[d.name]));let{filePath:l,sectionLabel:c}=an(e,i),f=await s.runVoidFile(l,{sectionLabel:c,env:o,runtimeVars:n,activePlugins:r});return{content:[{type:"text",text:JSON.stringify(f.results[0]?.result,null,2)}]}}}function Rp(s){return s.params.map(e=>({name:e.name,type:e.type,required:e.required,description:e.description}))}function jp(s,e,t,n,r,i,a,o){for(let l of t){if(!l.served||!l.status)continue;let{tool:c,status:f}=l;e.registerTool(c.name,{title:c.title,description:(l.descriptionNote??"")+c.description,inputSchema:Zp(c),annotations:c.annotations,_meta:{"md.voiden/verification":{state:f.state,last_verified:new Date().toISOString(),...a?{commit:a}:{}}}},Tl(s,c,n,r,i,o))}}function Vp(s,e,t,n,r,i,a,o){let l=new Map;for(let c of t)!c.served||!c.status||l.set(c.tool.name,{tool:c.tool,status:c.status,descriptionNote:c.descriptionNote});e.registerTool("search_tools",{title:"Search Tools",description:"List every tool this server currently publishes \u2014 name, description, parameters, and verification state. Call this first; call_tool needs an exact name from here.",inputSchema:{query:W.z.string().optional().describe("Optional case-insensitive substring to filter by name/title/description. Omit to list everything.")}},async({query:c})=>{let f=c?.trim().toLowerCase(),d=[...l.values()].filter(({tool:u})=>!f||[u.name,u.title,u.description].some(y=>y?.toLowerCase().includes(f))).map(({tool:u,status:y,descriptionNote:v})=>({name:u.name,title:u.title,description:(v??"")+u.description,params:Rp(u),annotations:u.annotations,verification:{state:y.state,...a?{commit:a}:{}}}));return{content:[{type:"text",text:JSON.stringify(d,null,2)}]}}),e.registerTool("call_tool",{title:"Call Tool",description:"Call one of the tools listed by search_tools, by its exact name.",inputSchema:{name:W.z.string().describe("A tool name from search_tools' results."),arguments:W.z.record(W.z.any()).optional().describe("Arguments matching that tool's own params (see search_tools).")}},async({name:c,arguments:f})=>{let d=l.get(c);return d?Tl(s,d.tool,n,r,i,o)(f??{}):{content:[{type:"text",text:`No tool named "${c}" is currently served. Call search_tools to see what's available.`}],isError:!0}})}function Bp(s,e,t,n,r,i,a,o,l="static"){let c={...Sl(o),...n};l==="dynamic"?Vp(s,e,t,c,r,i,a,o):jp(s,e,t,c,r,i,a,o)}function Up(s){try{return(0,vl.execSync)("git rev-parse --short HEAD",{cwd:s,stdio:["ignore","pipe","ignore"]}).toString().trim()||void 0}catch{return}}var gl=/^```void\n([\s\S]*?)^```/gm;function Fp(s){let e=[],t=new RegExp(gl.source,gl.flags),n;for(;(n=t.exec(s))!==null;){let r=n.index,i=r+n[0].length,a=n[1],o=a.trim().split(`
|
|
140
140
|
`),l,c,f=-1;if(o[0]?.trim()==="---"&&(f=o.indexOf("---",1),f!==-1))try{let d=Ht.default.parse(o.slice(1,f).join(`
|
|
141
|
-
`));l=d?.type,c=d?.attrs?.uid}catch{}e.push({start:r,end:i,type:l,uid:c,body:a,headerEnd:f})}return e}function
|
|
141
|
+
`));l=d?.type,c=d?.attrs?.uid}catch{}e.push({start:r,end:i,type:l,uid:c,body:a,headerEnd:f})}return e}function Kp(s,e,t){let n=(0,fe.readFileSync)(s,"utf-8"),i=Fp(n).find(u=>u.type==="tool"&&u.uid===e);if(!i)throw new Error(`No tool block with uid "${e}" found in ${s}`);let a=i.body.trim().split(`
|
|
142
142
|
`),o=Ht.default.parse(a.slice(1,i.headerEnd).join(`
|
|
143
|
-
`)),l={state:t.state,lastCheckedAt:new Date().toISOString(),...t.note?{note:t.note}:{}};o.attrs={...o.attrs??{},verificationStatus:l};let f="```void\n---\n"+Ht.default.stringify(o)+"---\n```",d=n.slice(0,i.start)+f+n.slice(i.end);(0,fe.writeFileSync)(s,d,"utf-8")}function kl(s,e){return{discoverTools:(t,n)=>bl(s,e,t,n),validateTools:(t,n)=>wl(s,t,n),verifyTools:(t,n)=>_l(s,t,n),planServedTools:(t,n,r,i)=>
|
|
143
|
+
`)),l={state:t.state,lastCheckedAt:new Date().toISOString(),...t.note?{note:t.note}:{}};o.attrs={...o.attrs??{},verificationStatus:l};let f="```void\n---\n"+Ht.default.stringify(o)+"---\n```",d=n.slice(0,i.start)+f+n.slice(i.end);(0,fe.writeFileSync)(s,d,"utf-8")}function kl(s,e){return{discoverTools:(t,n)=>bl(s,e,t,n),validateTools:(t,n)=>wl(s,t,n),verifyTools:(t,n)=>_l(s,t,n),planServedTools:(t,n,r,i)=>Dp(s,e,t,n,r,i),registerServedTools:(t,n,r,i,a,o,l,c)=>Bp(s,t,n,r,i,a,o,l,c),upsertToolStatus:Kp,getCommitSha:Up}}function Qr(s){let e=ti(s);return!e||!e.name?[]:[{name:e.name,title:e.title,description:e.description,annotations:e.annotations,toolBlockUid:e.uid||"",requestUid:e.requestUid,params:e.params,verifies:e.verifies,enabled:e.enabled,requestFilePath:e.requestFilePath,requestSectionLabel:e.requestSectionLabel}]}var Yp=s=>({onload(){s.registerBlockSchema({name:"tool",attrs:{uid:{},name:{default:""},title:{default:""},description:{default:""},annotations:{default:{}},requestUid:{default:""},enabled:{default:!0},requestFilePath:{default:""},requestSectionLabel:{default:null}}}),s.registerBlockSchema({name:"toolparams",attrs:{uid:{},rows:{default:[]}}}),s.registerBlockSchema({name:"toolverifies",attrs:{uid:{},rows:{default:[]}}}),s.registerToolProvider?.(Qr);let e=s.runnerPrimitives;if(e){let t=kl(e,Qr);s.registerMcpToolCapabilityProvider?.(t)}}}),Jp=Yp;0&&(module.exports={extractTools});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var w=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var N=(r,e)=>{for(var i in e)w(r,i,{get:e[i],enumerable:!0})},O=(r,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of A(e))!B.call(r,p)&&p!==i&&w(r,p,{get:()=>e[p],enumerable:!(n=v(e,p))||n.enumerable});return r};var q=r=>O(w({},"__esModule",{value:!0}),r);var D={};N(D,{buildRequest:()=>S,default:()=>J});module.exports=q(D);var k=r=>({"application/json":".json","text/plain":".txt","application/xml":".xml","application/pdf":".pdf","image/png":".png","image/jpeg":".jpg","audio/mpeg":".mp3","video/mp4":".mp4","text/csv":".csv","text/html":".html","application/zip":".zip","application/octet-stream":"","audio/wav":".wav","video/webm":".webm","image/gif":".gif","application/vnd.ms-excel":".xls","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":".xlsx","application/msword":".doc","application/vnd.openxmlformats-officedocument.wordprocessingml.document":".docx","text/css":".css","application/javascript":".js"})[r]||"",C=(r,e,i)=>{let a=e("headers-table",r,i).find(o=>o.key?.toLowerCase()==="content-type")?.value?.split(";")[0]?.trim()?.toLowerCase()||"";if(a){if(["application/json","application/hal+json","text/json"].includes(a))return"application/json";if(["application/xml","text/xml"].includes(a))return"application/xml";if(["application/x-yaml","application/yaml","text/yaml","text/x-yaml"].includes(a))return"application/x-yaml"}let s="none";return r.content?.forEach(o=>{o.type==="multipart-table"?s="multipart/form-data":o.type==="url-table"?s="application/x-www-form-urlencoded":o.type==="json_body"?s="application/json":o.type==="xml_body"?s="application/xml":o.type==="yml_body"?s="application/x-yaml":o.type==="file"&&(s=k(o.attrs?.extension||""))}),s},P=async(r,e)=>{let i=(()=>{switch(e){case"multipart/form-data":return"multipart-table";case"application/x-www-form-urlencoded":return"url-table";default:return"json_body"}})(),n=[];for(let a of r.content||[]){if(a.type!==i)continue;let s=a.attrs?.importedFrom;for(let o of a.content||[])if(o.type==="table")for(let d of o.content||[]){if(d.type!=="tableRow")continue;let c=d.content?.[0],f=d.content?.[1];if(!c||c.type!=="tableCell"||!f||f.type!=="tableCell")continue;let y=(c.content?.[0]?.content?.[0]?.text||"").trim(),m,b="text";if(i==="multipart-table"){let t=!d.attrs?.disabled,h=f.attrs?.file;if(h){y&&n.push({enabled:t,type:"file",key:y,value:h,importedFrom:s});continue}let u=f.content?.[0]?.content||[],x=u.filter(l=>l.type==="fileLink"&&l.attrs?.filePath),g=u.filter(l=>l.type==="file"&&(l.attrs?.filePath||l.attrs?.actualFile)),_=u.filter(l=>l.type==="table-file"&&l.attrs?.file),F=[...x.map(l=>l.attrs.filePath),...g.map(l=>l.attrs.filePath||l.attrs.actualFile),..._.map(l=>l.attrs.file)].filter(Boolean);if(F.length>0)for(let l of F)y&&n.push({enabled:t,type:"file",key:y,value:l,importedFrom:s});else{let l=(f.content?.[0]?.content?.[0]?.text||"").trim();y&&l&&n.push({enabled:t,type:"text",key:y,value:l,importedFrom:s})}continue}else m=(f.content?.[0]?.content?.[0]?.text||"").trim(),b="text";!y||!m||n.push({enabled:!d.attrs?.disabled,type:b,key:y,value:m,importedFrom:s})}}let p=n.reduce((a,s)=>{let o=a[s.key]||[];return o.push(s),{...a,[s.key]:o}},{});return Object.values(p).flatMap(a=>{if(a.every(c=>c.type==="file")&&a.length>1){let c=a.filter(y=>!y.importedFrom);return(c.length>0?c:a).map(({importedFrom:y,...m})=>m)}if(a.length>1){let c=a.find(f=>!f.importedFrom);if(c){let{importedFrom:f,...y}=c;return[y]}}let{importedFrom:o,...d}=a[0];return[d]})},T=r=>{let e=[];if(r.content?.forEach(i=>{i.type==="restFile"&&i.content?.forEach(n=>{n.type==="fileLink"&&n.attrs?.filePath||n.type==="file"&&n.attrs?.filePath?e.push(n.attrs.filePath):n.type==="file"&&(n.attrs?.actualFile||n.attrs?.file)&&e.push(n.attrs.actualFile||n.attrs.file)})}),e.length!==0)return e.length===1?e[0]:e};function R(r){let e=[];if(!Array.isArray(r.content))return e;for(let i of r.content)if(i.type==="table"&&Array.isArray(i.rows))for(let n of i.rows){let p=n.attrs?.disabled===!0;if(Array.isArray(n.row)&&n.row.length>=2){let a=String(n.row[0]??"").trim(),s=String(n.row[1]??"").trim();a&&e.push({key:a,value:s,enabled:!p})}}return e}async function S(r){if(r.some(t=>t.type==="gqlquery")||r.some(t=>t.type==="socket-request"))return null;let e=r.find(t=>t.type==="request");if(!e)return null;let i="GET",n="";if(Array.isArray(e.content))for(let t of e.content)t.type==="method"&&typeof t.content=="string"&&(i=t.content.trim().toUpperCase()||"GET"),t.type==="url"&&typeof t.content=="string"&&(n=t.content.trim());if(!n)return null;let p=R(r.find(t=>t.type==="headers-table")??{}),a=R(r.find(t=>t.type==="query-table")??{}),s=R(r.find(t=>t.type==="path-table")??{}),o,d,c=r.find(t=>t.type==="json_body");if(c?.attrs?.body){o=String(c.attrs.body);let t=c.attrs.contentType;d=t==="html"?"text/html":t==="text"?"text/plain":"application/json"}let f=r.find(t=>t.type==="xml_body");f?.attrs?.body&&(o=String(f.attrs.body),d=["application/xml","text/xml","application/xhtml+xml"].includes(f.attrs.contentType)?f.attrs.contentType:"application/xml");let y=r.find(t=>t.type==="yml_body");y?.attrs?.body&&(o=String(y.attrs.body),d=["application/x-yaml","application/yaml","text/yaml","text/x-yaml"].includes(y.attrs.contentType)?y.attrs.contentType:"application/x-yaml");let m,b;if(!o){let t={content:r},u=C(t,g=>g==="headers-table"?p:[],void 0);if(u==="multipart/form-data"||u==="application/x-www-form-urlencoded"){let g=await P(t,u);g.length>0&&(m=g,d=u)}let x=T(t);x&&(b=x,u&&u!=="none"&&(d=u))}return{method:i,url:n,headers:p,queryParams:a,pathParams:s,body:o,contentType:d,bodyParams:m,binary:b,metadata:{}}}var j=r=>({onload(){r.registerRequestContainer?.({type:"request",urlType:"url",methodType:"method"}),r.onBuildRequest(async(e,i)=>{let n=await S(i);if(!n)return e;let p=Array.isArray(e?.headers)?e.headers:[],a=Array.isArray(e?.queryParams)?e.queryParams:[];return{...n,headers:[...p,...n.headers],queryParams:[...a,...n.queryParams]}})}}),J=j;0&&(module.exports={buildRequest});
|
package/dist/index.js
CHANGED
|
@@ -560,7 +560,7 @@ program
|
|
|
560
560
|
// --no-session: each file is fully isolated — no vars flow from one file to another.
|
|
561
561
|
// Session mode: all files share runtimeVars so captured vars chain across files.
|
|
562
562
|
const fileVars = opts.session ? runtimeVars : {};
|
|
563
|
-
const { results } = await runVoidFile(file, { env, verbose: opts.verbose, runtimeVars: fileVars, activePlugins });
|
|
563
|
+
const { results } = await runVoidFile(file, { env, verbose: opts.verbose, runtimeVars: fileVars, activePlugins, projectRoot: process.cwd() });
|
|
564
564
|
stopSpinner();
|
|
565
565
|
for (const { result } of results) {
|
|
566
566
|
if (!result.success)
|