@heylatch/cli 0.1.0 → 0.1.1

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/latch.js +3 -3
  3. package/package.json +40 -40
package/dist/latch.js CHANGED
@@ -7,7 +7,7 @@ var Hz=Object.create;var ap=Object.defineProperty;var Kz=Object.getOwnPropertyDe
7
7
  || ${a} === "boolean" || ${r} === null`).assign(s,(0,ee._)`[${r}]`)}}}function A4({gen:e,parentData:t,parentDataProperty:n},i){e.if((0,ee._)`${t} !== undefined`,()=>e.assign((0,ee._)`${t}[${n}]`,i))}function Qv(e,t,n,i=Do.Correct){let r=i===Do.Correct?ee.operators.EQ:ee.operators.NEQ,o;switch(e){case"null":return(0,ee._)`${t} ${r} null`;case"array":o=(0,ee._)`Array.isArray(${t})`;break;case"object":o=(0,ee._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=a((0,ee._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=a();break;default:return(0,ee._)`typeof ${t} ${r} ${e}`}return i===Do.Correct?o:(0,ee.not)(o);function a(s=ee.nil){return(0,ee.and)((0,ee._)`typeof ${t} == "number"`,s,n?(0,ee._)`isFinite(${t})`:ee.nil)}}st.checkDataType=Qv;function ey(e,t,n,i){if(e.length===1)return Qv(e[0],t,n,i);let r,o=(0,w0.toHash)(e);if(o.array&&o.object){let a=(0,ee._)`typeof ${t} != "object"`;r=o.null?a:(0,ee._)`!${t} || ${a}`,delete o.null,delete o.array,delete o.object}else r=ee.nil;o.number&&delete o.integer;for(let a in o)r=(0,ee.and)(r,Qv(a,t,n,i));return r}st.checkDataTypes=ey;var D4={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,ee._)`{type: ${e}}`:(0,ee._)`{type: ${t}}`};function ty(e){let t=R4(e);(0,T4.reportError)(t,D4)}st.reportTypeError=ty;function R4(e){let{gen:t,data:n,schema:i}=e,r=(0,w0.schemaRefOrVal)(e,i,"type");return{gen:t,keyword:"type",data:n,schema:i.type,schemaCode:r,schemaValue:r,parentSchema:i,params:{},it:e}}});var z0=N(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});yf.assignDefaults=void 0;var Ro=te(),C4=le();function U4(e,t){let{properties:n,items:i}=e.schema;if(t==="object"&&n)for(let r in n)I0(e,r,n[r].default);else t==="array"&&Array.isArray(i)&&i.forEach((r,o)=>I0(e,o,r.default))}yf.assignDefaults=U4;function I0(e,t,n){let{gen:i,compositeRule:r,data:o,opts:a}=e;if(n===void 0)return;let s=(0,Ro._)`${o}${(0,Ro.getProperty)(t)}`;if(r){(0,C4.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,Ro._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,Ro._)`${c} || ${s} === null || ${s} === ""`),i.if(c,(0,Ro._)`${s} = ${(0,Ro.stringify)(n)}`)}});var Yt=N(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.validateUnion=Ie.validateArray=Ie.usePattern=Ie.callValidateCode=Ie.schemaProperties=Ie.allSchemaProperties=Ie.noPropertyInData=Ie.propertyInData=Ie.isOwnProperty=Ie.hasPropFunc=Ie.reportMissingProp=Ie.checkMissingProp=Ie.checkReportMissingProp=void 0;var Oe=te(),ry=le(),_n=qr(),Z4=le();function M4(e,t){let{gen:n,data:i,it:r}=e;n.if(iy(n,i,t,r.opts.ownProperties),()=>{e.setParams({missingProperty:(0,Oe._)`${t}`},!0),e.error()})}Ie.checkReportMissingProp=M4;function L4({gen:e,data:t,it:{opts:n}},i,r){return(0,Oe.or)(...i.map(o=>(0,Oe.and)(iy(e,t,o,n.ownProperties),(0,Oe._)`${r} = ${o}`)))}Ie.checkMissingProp=L4;function V4(e,t){e.setParams({missingProperty:t},!0),e.error()}Ie.reportMissingProp=V4;function P0(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Oe._)`Object.prototype.hasOwnProperty`})}Ie.hasPropFunc=P0;function ny(e,t,n){return(0,Oe._)`${P0(e)}.call(${t}, ${n})`}Ie.isOwnProperty=ny;function F4(e,t,n,i){let r=(0,Oe._)`${t}${(0,Oe.getProperty)(n)} !== undefined`;return i?(0,Oe._)`${r} && ${ny(e,t,n)}`:r}Ie.propertyInData=F4;function iy(e,t,n,i){let r=(0,Oe._)`${t}${(0,Oe.getProperty)(n)} === undefined`;return i?(0,Oe.or)(r,(0,Oe.not)(ny(e,t,n))):r}Ie.noPropertyInData=iy;function T0(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}Ie.allSchemaProperties=T0;function q4(e,t){return T0(t).filter(n=>!(0,ry.alwaysValidSchema)(e,t[n]))}Ie.schemaProperties=q4;function B4({schemaCode:e,data:t,it:{gen:n,topSchemaRef:i,schemaPath:r,errorPath:o},it:a},s,c,u){let l=u?(0,Oe._)`${e}, ${t}, ${i}${r}`:t,d=[[_n.default.instancePath,(0,Oe.strConcat)(_n.default.instancePath,o)],[_n.default.parentData,a.parentData],[_n.default.parentDataProperty,a.parentDataProperty],[_n.default.rootData,_n.default.rootData]];a.opts.dynamicRef&&d.push([_n.default.dynamicAnchors,_n.default.dynamicAnchors]);let f=(0,Oe._)`${l}, ${n.object(...d)}`;return c!==Oe.nil?(0,Oe._)`${s}.call(${c}, ${f})`:(0,Oe._)`${s}(${f})`}Ie.callValidateCode=B4;var J4=(0,Oe._)`new RegExp`;function H4({gen:e,it:{opts:t}},n){let i=t.unicodeRegExp?"u":"",{regExp:r}=t.code,o=r(n,i);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,Oe._)`${r.code==="new RegExp"?J4:(0,Z4.useFunc)(e,r)}(${n}, ${i})`})}Ie.usePattern=H4;function K4(e){let{gen:t,data:n,keyword:i,it:r}=e,o=t.name("valid");if(r.allErrors){let s=t.let("valid",!0);return a(()=>t.assign(s,!1)),s}return t.var(o,!0),a(()=>t.break()),o;function a(s){let c=t.const("len",(0,Oe._)`${n}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:i,dataProp:u,dataPropType:ry.Type.Num},o),t.if((0,Oe.not)(o),s)})}}Ie.validateArray=K4;function G4(e){let{gen:t,schema:n,keyword:i,it:r}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some(c=>(0,ry.alwaysValidSchema)(r,c))&&!r.opts.unevaluated)return;let a=t.let("valid",!1),s=t.name("_valid");t.block(()=>n.forEach((c,u)=>{let l=e.subschema({keyword:i,schemaProp:u,compositeRule:!0},s);t.assign(a,(0,Oe._)`${a} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,Oe.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}Ie.validateUnion=G4});var E0=N(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.validateKeywordUsage=Sr.validSchemaType=Sr.funcKeywordCode=Sr.macroKeywordCode=void 0;var $t=te(),ei=qr(),W4=Yt(),X4=Js();function Y4(e,t){let{gen:n,keyword:i,schema:r,parentSchema:o,it:a}=e,s=t.macro.call(a.self,r,o,a),c=j0(n,i,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=n.name("valid");e.subschema({schema:s,schemaPath:$t.nil,errSchemaPath:`${a.errSchemaPath}/${i}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}Sr.macroKeywordCode=Y4;function Q4(e,t){var n;let{gen:i,keyword:r,schema:o,parentSchema:a,$data:s,it:c}=e;tA(c,t);let u=!s&&t.compile?t.compile.call(c.self,o,a,c):t.validate,l=j0(i,r,u),d=i.let("valid");e.block$data(d,f),e.ok((n=t.valid)!==null&&n!==void 0?n:d);function f(){if(t.errors===!1)h(),t.modifying&&O0(e),g(()=>e.error());else{let _=t.async?p():m();t.modifying&&O0(e),g(()=>eA(e,_))}}function p(){let _=i.let("ruleErrs",null);return i.try(()=>h((0,$t._)`await `),$=>i.assign(d,!1).if((0,$t._)`${$} instanceof ${c.ValidationError}`,()=>i.assign(_,(0,$t._)`${$}.errors`),()=>i.throw($))),_}function m(){let _=(0,$t._)`${l}.errors`;return i.assign(_,null),h($t.nil),_}function h(_=t.async?(0,$t._)`await `:$t.nil){let $=c.opts.passContext?ei.default.this:ei.default.self,k=!("compile"in t&&!s||t.schema===!1);i.assign(d,(0,$t._)`${_}${(0,W4.callValidateCode)(e,l,$,k)}`,t.modifying)}function g(_){var $;i.if((0,$t.not)(($=t.valid)!==null&&$!==void 0?$:d),_)}}Sr.funcKeywordCode=Q4;function O0(e){let{gen:t,data:n,it:i}=e;t.if(i.parentData,()=>t.assign(n,(0,$t._)`${i.parentData}[${i.parentDataProperty}]`))}function eA(e,t){let{gen:n}=e;n.if((0,$t._)`Array.isArray(${t})`,()=>{n.assign(ei.default.vErrors,(0,$t._)`${ei.default.vErrors} === null ? ${t} : ${ei.default.vErrors}.concat(${t})`).assign(ei.default.errors,(0,$t._)`${ei.default.vErrors}.length`),(0,X4.extendErrors)(e)},()=>e.error())}function tA({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function j0(e,t,n){if(n===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof n=="function"?{ref:n}:{ref:n,code:(0,$t.stringify)(n)})}function rA(e,t,n=!1){return!t.length||t.some(i=>i==="array"?Array.isArray(e):i==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==i||n&&typeof e>"u")}Sr.validSchemaType=rA;function nA({schema:e,opts:t,self:n,errSchemaPath:i},r,o){if(Array.isArray(r.keyword)?!r.keyword.includes(o):r.keyword!==o)throw new Error("ajv implementation error");let a=r.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${o}: ${a.join(",")}`);if(r.validateSchema&&!r.validateSchema(e[o])){let c=`keyword "${o}" value is invalid at path "${i}": `+n.errorsText(r.validateSchema.errors);if(t.validateSchema==="log")n.logger.error(c);else throw new Error(c)}}Sr.validateKeywordUsage=nA});var A0=N($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.extendSubschemaMode=$n.extendSubschemaData=$n.getSubschema=void 0;var Ir=te(),N0=le();function iA(e,{keyword:t,schemaProp:n,schema:i,schemaPath:r,errSchemaPath:o,topSchemaRef:a}){if(t!==void 0&&i!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return n===void 0?{schema:s,schemaPath:(0,Ir._)`${e.schemaPath}${(0,Ir.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[n],schemaPath:(0,Ir._)`${e.schemaPath}${(0,Ir.getProperty)(t)}${(0,Ir.getProperty)(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,N0.escapeFragment)(n)}`}}if(i!==void 0){if(r===void 0||o===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:r,topSchemaRef:a,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}$n.getSubschema=iA;function oA(e,t,{dataProp:n,dataPropType:i,data:r,dataTypes:o,propertyName:a}){if(r!==void 0&&n!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=t;if(n!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,f=s.let("data",(0,Ir._)`${t.data}${(0,Ir.getProperty)(n)}`,!0);c(f),e.errorPath=(0,Ir.str)`${u}${(0,N0.getErrorPath)(n,i,d.jsPropertySyntax)}`,e.parentDataProperty=(0,Ir._)`${n}`,e.dataPathArr=[...l,e.parentDataProperty]}if(r!==void 0){let u=r instanceof Ir.Name?r:s.let("data",r,!0);c(u),a!==void 0&&(e.propertyName=a)}o&&(e.dataTypes=o);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}$n.extendSubschemaData=oA;function aA(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:i,createErrors:r,allErrors:o}){i!==void 0&&(e.compositeRule=i),r!==void 0&&(e.createErrors=r),o!==void 0&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=n}$n.extendSubschemaMode=aA});var oy=N((I3,D0)=>{"use strict";D0.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var i,r,o;if(Array.isArray(t)){if(i=t.length,i!=n.length)return!1;for(r=i;r--!==0;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),i=o.length,i!==Object.keys(n).length)return!1;for(r=i;r--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[r]))return!1;for(r=i;r--!==0;){var a=o[r];if(!e(t[a],n[a]))return!1}return!0}return t!==t&&n!==n}});var C0=N((z3,R0)=>{"use strict";var bn=R0.exports=function(e,t,n){typeof t=="function"&&(n=t,t={}),n=t.cb||n;var i=typeof n=="function"?n:n.pre||function(){},r=n.post||function(){};_f(t,i,r,e,"",e)};bn.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};bn.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};bn.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};bn.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function _f(e,t,n,i,r,o,a,s,c,u){if(i&&typeof i=="object"&&!Array.isArray(i)){t(i,r,o,a,s,c,u);for(var l in i){var d=i[l];if(Array.isArray(d)){if(l in bn.arrayKeywords)for(var f=0;f<d.length;f++)_f(e,t,n,d[f],r+"/"+l+"/"+f,o,r,l,i,f)}else if(l in bn.propsKeywords){if(d&&typeof d=="object")for(var p in d)_f(e,t,n,d[p],r+"/"+l+"/"+sA(p),o,r,l,i,p)}else(l in bn.keywords||e.allKeys&&!(l in bn.skipKeywords))&&_f(e,t,n,d,r+"/"+l,o,r,l,i)}n(i,r,o,a,s,c,u)}}function sA(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ks=N(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.getSchemaRefs=jt.resolveUrl=jt.normalizeId=jt._getFullPath=jt.getFullPath=jt.inlineRef=void 0;var cA=le(),uA=oy(),lA=C0(),dA=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function fA(e,t=!0){return typeof e=="boolean"?!0:t===!0?!ay(e):t?U0(e)<=t:!1}jt.inlineRef=fA;var pA=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function ay(e){for(let t in e){if(pA.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(ay)||typeof n=="object"&&ay(n))return!0}return!1}function U0(e){let t=0;for(let n in e){if(n==="$ref")return 1/0;if(t++,!dA.has(n)&&(typeof e[n]=="object"&&(0,cA.eachItem)(e[n],i=>t+=U0(i)),t===1/0))return 1/0}return t}function Z0(e,t="",n){n!==!1&&(t=Co(t));let i=e.parse(t);return M0(e,i)}jt.getFullPath=Z0;function M0(e,t){return e.serialize(t).split("#")[0]+"#"}jt._getFullPath=M0;var mA=/#\/?$/;function Co(e){return e?e.replace(mA,""):""}jt.normalizeId=Co;function hA(e,t,n){return n=Co(n),e.resolve(t,n)}jt.resolveUrl=hA;var gA=/^[a-z_][-a-z0-9._]*$/i;function vA(e,t){if(typeof e=="boolean")return{};let{schemaId:n,uriResolver:i}=this.opts,r=Co(e[n]||t),o={"":r},a=Z0(i,r,!1),s={},c=new Set;return lA(e,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=a+f,g=o[m];typeof d[n]=="string"&&(g=_.call(this,d[n])),$.call(this,d.$anchor),$.call(this,d.$dynamicAnchor),o[f]=g;function _(k){let O=this.opts.uriResolver.resolve;if(k=Co(g?O(g,k):k),c.has(k))throw l(k);c.add(k);let T=this.refs[k];return typeof T=="string"&&(T=this.refs[T]),typeof T=="object"?u(d,T.schema,k):k!==Co(h)&&(k[0]==="#"?(u(d,s[k],k),s[k]=d):this.refs[k]=h),k}function $(k){if(typeof k=="string"){if(!gA.test(k))throw new Error(`invalid anchor "${k}"`);_.call(this,`#${k}`)}}}),s;function u(d,f,p){if(f!==void 0&&!uA(d,f))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}jt.getSchemaRefs=vA});var Xs=N(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.getData=xn.KeywordCxt=xn.validateFunctionCode=void 0;var B0=$0(),L0=Hs(),cy=Yv(),$f=Hs(),yA=z0(),Ws=E0(),sy=A0(),L=te(),G=qr(),_A=Ks(),Br=le(),Gs=Js();function $A(e){if(K0(e)&&(G0(e),H0(e))){wA(e);return}J0(e,()=>(0,B0.topBoolOrEmptySchema)(e))}xn.validateFunctionCode=$A;function J0({gen:e,validateName:t,schema:n,schemaEnv:i,opts:r},o){r.code.es5?e.func(t,(0,L._)`${G.default.data}, ${G.default.valCxt}`,i.$async,()=>{e.code((0,L._)`"use strict"; ${V0(n,r)}`),xA(e,r),e.code(o)}):e.func(t,(0,L._)`${G.default.data}, ${bA(r)}`,i.$async,()=>e.code(V0(n,r)).code(o))}function bA(e){return(0,L._)`{${G.default.instancePath}="", ${G.default.parentData}, ${G.default.parentDataProperty}, ${G.default.rootData}=${G.default.data}${e.dynamicRef?(0,L._)`, ${G.default.dynamicAnchors}={}`:L.nil}}={}`}function xA(e,t){e.if(G.default.valCxt,()=>{e.var(G.default.instancePath,(0,L._)`${G.default.valCxt}.${G.default.instancePath}`),e.var(G.default.parentData,(0,L._)`${G.default.valCxt}.${G.default.parentData}`),e.var(G.default.parentDataProperty,(0,L._)`${G.default.valCxt}.${G.default.parentDataProperty}`),e.var(G.default.rootData,(0,L._)`${G.default.valCxt}.${G.default.rootData}`),t.dynamicRef&&e.var(G.default.dynamicAnchors,(0,L._)`${G.default.valCxt}.${G.default.dynamicAnchors}`)},()=>{e.var(G.default.instancePath,(0,L._)`""`),e.var(G.default.parentData,(0,L._)`undefined`),e.var(G.default.parentDataProperty,(0,L._)`undefined`),e.var(G.default.rootData,G.default.data),t.dynamicRef&&e.var(G.default.dynamicAnchors,(0,L._)`{}`)})}function wA(e){let{schema:t,opts:n,gen:i}=e;J0(e,()=>{n.$comment&&t.$comment&&X0(e),PA(e),i.let(G.default.vErrors,null),i.let(G.default.errors,0),n.unevaluated&&kA(e),W0(e),jA(e)})}function kA(e){let{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",(0,L._)`${n}.evaluated`),t.if((0,L._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,L._)`${e.evaluated}.props`,(0,L._)`undefined`)),t.if((0,L._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,L._)`${e.evaluated}.items`,(0,L._)`undefined`))}function V0(e,t){let n=typeof e=="object"&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,L._)`/*# sourceURL=${n} */`:L.nil}function SA(e,t){if(K0(e)&&(G0(e),H0(e))){IA(e,t);return}(0,B0.boolOrEmptySchema)(e,t)}function H0({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function K0(e){return typeof e.schema!="boolean"}function IA(e,t){let{schema:n,gen:i,opts:r}=e;r.$comment&&n.$comment&&X0(e),TA(e),OA(e);let o=i.const("_errs",G.default.errors);W0(e,o),i.var(t,(0,L._)`${o} === ${G.default.errors}`)}function G0(e){(0,Br.checkUnknownRules)(e),zA(e)}function W0(e,t){if(e.opts.jtd)return F0(e,[],!1,t);let n=(0,L0.getSchemaTypes)(e.schema),i=(0,L0.coerceAndCheckDataType)(e,n);F0(e,n,!i,t)}function zA(e){let{schema:t,errSchemaPath:n,opts:i,self:r}=e;t.$ref&&i.ignoreKeywordsWithRef&&(0,Br.schemaHasRulesButRef)(t,r.RULES)&&r.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function PA(e){let{schema:t,opts:n}=e;t.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,Br.checkStrictMode)(e,"default is ignored in the schema root")}function TA(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,_A.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function OA(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function X0({gen:e,schemaEnv:t,schema:n,errSchemaPath:i,opts:r}){let o=n.$comment;if(r.$comment===!0)e.code((0,L._)`${G.default.self}.logger.log(${o})`);else if(typeof r.$comment=="function"){let a=(0,L.str)`${i}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,L._)`${G.default.self}.opts.$comment(${o}, ${a}, ${s}.schema)`)}}function jA(e){let{gen:t,schemaEnv:n,validateName:i,ValidationError:r,opts:o}=e;n.$async?t.if((0,L._)`${G.default.errors} === 0`,()=>t.return(G.default.data),()=>t.throw((0,L._)`new ${r}(${G.default.vErrors})`)):(t.assign((0,L._)`${i}.errors`,G.default.vErrors),o.unevaluated&&EA(e),t.return((0,L._)`${G.default.errors} === 0`))}function EA({gen:e,evaluated:t,props:n,items:i}){n instanceof L.Name&&e.assign((0,L._)`${t}.props`,n),i instanceof L.Name&&e.assign((0,L._)`${t}.items`,i)}function F0(e,t,n,i){let{gen:r,schema:o,data:a,allErrors:s,opts:c,self:u}=e,{RULES:l}=u;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,Br.schemaHasRulesButRef)(o,l))){r.block(()=>Q0(e,"$ref",l.all.$ref.definition));return}c.jtd||NA(e,t),r.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,cy.shouldUseGroup)(o,f)&&(f.type?(r.if((0,$f.checkDataType)(f.type,a,c.strictNumbers)),q0(e,f),t.length===1&&t[0]===f.type&&n&&(r.else(),(0,$f.reportTypeError)(e)),r.endIf()):q0(e,f),s||r.if((0,L._)`${G.default.errors} === ${i||0}`))}}function q0(e,t){let{gen:n,schema:i,opts:{useDefaults:r}}=e;r&&(0,yA.assignDefaults)(e,t.type),n.block(()=>{for(let o of t.rules)(0,cy.shouldUseRule)(i,o)&&Q0(e,o.keyword,o.definition,t.type)})}function NA(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(AA(e,t),e.opts.allowUnionTypes||DA(e,t),RA(e,e.dataTypes))}function AA(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(n=>{Y0(e.dataTypes,n)||uy(e,`type "${n}" not allowed by context "${e.dataTypes.join(",")}"`)}),UA(e,t)}}function DA(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&uy(e,"use allowUnionTypes to allow union type keyword")}function RA(e,t){let n=e.self.RULES.all;for(let i in n){let r=n[i];if(typeof r=="object"&&(0,cy.shouldUseRule)(e.schema,r)){let{type:o}=r.definition;o.length&&!o.some(a=>CA(t,a))&&uy(e,`missing type "${o.join(",")}" for keyword "${i}"`)}}}function CA(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Y0(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function UA(e,t){let n=[];for(let i of e.dataTypes)Y0(t,i)?n.push(i):t.includes("integer")&&i==="number"&&n.push("integer");e.dataTypes=n}function uy(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,Br.checkStrictMode)(e,t,e.opts.strictTypes)}var bf=class{constructor(t,n,i){if((0,Ws.validateKeywordUsage)(t,n,i),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=i,this.data=t.data,this.schema=t.schema[i],this.$data=n.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Br.schemaRefOrVal)(t,this.schema,i,this.$data),this.schemaType=n.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=n,this.$data)this.schemaCode=t.gen.const("vSchema",eS(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Ws.validSchemaType)(this.schema,n.schemaType,n.allowUndefined))throw new Error(`${i} value must be ${JSON.stringify(n.schemaType)}`);("code"in n?n.trackErrors:n.errors!==!1)&&(this.errsCount=t.gen.const("_errs",G.default.errors))}result(t,n,i){this.failResult((0,L.not)(t),n,i)}failResult(t,n,i){this.gen.if(t),i?i():this.error(),n?(this.gen.else(),n(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,n){this.failResult((0,L.not)(t),void 0,n)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:n}=this;this.fail((0,L._)`${n} !== undefined && (${(0,L.or)(this.invalid$data(),t)})`)}error(t,n,i){if(n){this.setParams(n),this._error(t,i),this.setParams({});return}this._error(t,i)}_error(t,n){(t?Gs.reportExtraError:Gs.reportError)(this,this.def.error,n)}$dataError(){(0,Gs.reportError)(this,this.def.$dataError||Gs.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Gs.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,n){n?Object.assign(this.params,t):this.params=t}block$data(t,n,i=L.nil){this.gen.block(()=>{this.check$data(t,i),n()})}check$data(t=L.nil,n=L.nil){if(!this.$data)return;let{gen:i,schemaCode:r,schemaType:o,def:a}=this;i.if((0,L.or)((0,L._)`${r} === undefined`,n)),t!==L.nil&&i.assign(t,!0),(o.length||a.validateSchema)&&(i.elseIf(this.invalid$data()),this.$dataError(),t!==L.nil&&i.assign(t,!1)),i.else()}invalid$data(){let{gen:t,schemaCode:n,schemaType:i,def:r,it:o}=this;return(0,L.or)(a(),s());function a(){if(i.length){if(!(n instanceof L.Name))throw new Error("ajv implementation error");let c=Array.isArray(i)?i:[i];return(0,L._)`${(0,$f.checkDataTypes)(c,n,o.opts.strictNumbers,$f.DataType.Wrong)}`}return L.nil}function s(){if(r.validateSchema){let c=t.scopeValue("validate$data",{ref:r.validateSchema});return(0,L._)`!${c}(${n})`}return L.nil}}subschema(t,n){let i=(0,sy.getSubschema)(this.it,t);(0,sy.extendSubschemaData)(i,this.it,t),(0,sy.extendSubschemaMode)(i,t);let r={...this.it,...i,items:void 0,props:void 0};return SA(r,n),r}mergeEvaluated(t,n){let{it:i,gen:r}=this;i.opts.unevaluated&&(i.props!==!0&&t.props!==void 0&&(i.props=Br.mergeEvaluated.props(r,t.props,i.props,n)),i.items!==!0&&t.items!==void 0&&(i.items=Br.mergeEvaluated.items(r,t.items,i.items,n)))}mergeValidEvaluated(t,n){let{it:i,gen:r}=this;if(i.opts.unevaluated&&(i.props!==!0||i.items!==!0))return r.if(n,()=>this.mergeEvaluated(t,L.Name)),!0}};xn.KeywordCxt=bf;function Q0(e,t,n,i){let r=new bf(e,n,t);"code"in n?n.code(r,i):r.$data&&n.validate?(0,Ws.funcKeywordCode)(r,n):"macro"in n?(0,Ws.macroKeywordCode)(r,n):(n.compile||n.validate)&&(0,Ws.funcKeywordCode)(r,n)}var ZA=/^\/(?:[^~]|~0|~1)*$/,MA=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function eS(e,{dataLevel:t,dataNames:n,dataPathArr:i}){let r,o;if(e==="")return G.default.rootData;if(e[0]==="/"){if(!ZA.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);r=e,o=G.default.rootData}else{let u=MA.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(r=u[2],r==="#"){if(l>=t)throw new Error(c("property/index",l));return i[t-l]}if(l>t)throw new Error(c("data",l));if(o=n[t-l],!r)return o}let a=o,s=r.split("/");for(let u of s)u&&(o=(0,L._)`${o}${(0,L.getProperty)((0,Br.unescapeJsonPointer)(u))}`,a=(0,L._)`${a} && ${o}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}xn.getData=eS});var xf=N(dy=>{"use strict";Object.defineProperty(dy,"__esModule",{value:!0});var ly=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};dy.default=ly});var Ys=N(my=>{"use strict";Object.defineProperty(my,"__esModule",{value:!0});var fy=Ks(),py=class extends Error{constructor(t,n,i,r){super(r||`can't resolve reference ${i} from id ${n}`),this.missingRef=(0,fy.resolveUrl)(t,n,i),this.missingSchema=(0,fy.normalizeId)((0,fy.getFullPath)(t,this.missingRef))}};my.default=py});var kf=N(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.resolveSchema=Qt.getCompilingSchema=Qt.resolveRef=Qt.compileSchema=Qt.SchemaEnv=void 0;var dr=te(),LA=xf(),ti=qr(),fr=Ks(),tS=le(),VA=Xs(),Uo=class{constructor(t){var n;this.refs={},this.dynamicAnchors={};let i;typeof t.schema=="object"&&(i=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(n=t.baseId)!==null&&n!==void 0?n:(0,fr.normalizeId)(i?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=i?.$async,this.refs={}}};Qt.SchemaEnv=Uo;function gy(e){let t=rS.call(this,e);if(t)return t;let n=(0,fr.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:i,lines:r}=this.opts.code,{ownProperties:o}=this.opts,a=new dr.CodeGen(this.scope,{es5:i,lines:r,ownProperties:o}),s;e.$async&&(s=a.scopeValue("Error",{ref:LA.default,code:(0,dr._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:ti.default.data,parentData:ti.default.parentData,parentDataProperty:ti.default.parentDataProperty,dataNames:[ti.default.data],dataPathArr:[dr.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,dr.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:dr.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,dr._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,VA.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(ti.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let p=new Function(`${ti.default.self}`,`${ti.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=e.schema,p.schemaEnv=e,e.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:m,items:h}=u;p.evaluated={props:m instanceof dr.Name?void 0:m,items:h instanceof dr.Name?void 0:h,dynamicProps:m instanceof dr.Name,dynamicItems:h instanceof dr.Name},p.source&&(p.source.evaluated=(0,dr.stringify)(p.evaluated))}return e.validate=p,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}Qt.compileSchema=gy;function FA(e,t,n){var i;n=(0,fr.resolveUrl)(this.opts.uriResolver,t,n);let r=e.refs[n];if(r)return r;let o=JA.call(this,e,n);if(o===void 0){let a=(i=e.localRefs)===null||i===void 0?void 0:i[n],{schemaId:s}=this.opts;a&&(o=new Uo({schema:a,schemaId:s,root:e,baseId:t}))}if(o!==void 0)return e.refs[n]=qA.call(this,o)}Qt.resolveRef=FA;function qA(e){return(0,fr.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:gy.call(this,e)}function rS(e){for(let t of this._compilations)if(BA(t,e))return t}Qt.getCompilingSchema=rS;function BA(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function JA(e,t){let n;for(;typeof(n=this.refs[t])=="string";)t=n;return n||this.schemas[t]||wf.call(this,e,t)}function wf(e,t){let n=this.opts.uriResolver.parse(t),i=(0,fr._getFullPath)(this.opts.uriResolver,n),r=(0,fr.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&i===r)return hy.call(this,n,e);let o=(0,fr.normalizeId)(i),a=this.refs[o]||this.schemas[o];if(typeof a=="string"){let s=wf.call(this,e,a);return typeof s?.schema!="object"?void 0:hy.call(this,n,s)}if(typeof a?.schema=="object"){if(a.validate||gy.call(this,a),o===(0,fr.normalizeId)(t)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];return u&&(r=(0,fr.resolveUrl)(this.opts.uriResolver,r,u)),new Uo({schema:s,schemaId:c,root:e,baseId:r})}return hy.call(this,n,a)}}Qt.resolveSchema=wf;var HA=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function hy(e,{baseId:t,schema:n,root:i}){var r;if(((r=e.fragment)===null||r===void 0?void 0:r[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof n=="boolean")return;let c=n[(0,tS.unescapeFragment)(s)];if(c===void 0)return;n=c;let u=typeof n=="object"&&n[this.opts.schemaId];!HA.has(s)&&u&&(t=(0,fr.resolveUrl)(this.opts.uriResolver,t,u))}let o;if(typeof n!="boolean"&&n.$ref&&!(0,tS.schemaHasRulesButRef)(n,this.RULES)){let s=(0,fr.resolveUrl)(this.opts.uriResolver,t,n.$ref);o=wf.call(this,i,s)}let{schemaId:a}=this.opts;if(o=o||new Uo({schema:n,schemaId:a,root:i,baseId:t}),o.schema!==o.root.schema)return o}});var nS=N((N3,KA)=>{KA.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var xy=N((A3,dS)=>{"use strict";var GA=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),yy=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),WA=RegExp.prototype.test.bind(/^\d*$/u),ri=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),_y=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),oS=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),$y=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),XA=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Et=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Et[t]="%"+e[t>>4]+e[t&15]}function ct(e){return e<2048?Et[192|e>>6]+Et[128|e&63]:e<65536?Et[224|e>>12]+Et[128|e>>6&63]+Et[128|e&63]:Et[240|e>>18]+Et[128|e>>12&63]+Et[128|e>>6&63]+Et[128|e&63]}function YA(e){let t="",n=0,i=0;for(i=0;i<e.length;i++)if(n=e[i].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[i];break}for(i+=1;i<e.length;i++){if(n=e[i].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[i]}return t}var QA=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),eD=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),tD=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),rD=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function nD(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!tD(e[t])){if(e[t]==="%"&&t+2<e.length&&ri(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function iS(e){let t=-1,n=0,i=-1,r=0;for(let s=0;s<e.length;s++)e[s]==="0"?(i===-1&&(i=s),r++,r>n&&(n=r,t=i)):(i=-1,r=0);if(n<2)return e.join(":");let o=e.slice(0,t).join(":"),a=e.slice(t+n).join(":");return o+"::"+a}function iD(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let n=t===-1?e.split(":"):e.slice(0,t).split(":"),i=t===-1?[]:e.slice(t+2).split(":");t!==-1&&(n.length===1&&n[0]===""&&(n.length=0),i.length===1&&i[0]===""&&(i.length=0));let r=n.concat(i),o=0;for(let s=0;s<r.length;s++){let c=r[s];if(c==="")return;if(c.indexOf(".")!==-1){if(s!==r.length-1||t!==-1&&i.length===0||!yy(c))return;o+=2;continue}if(!QA(c))return;r[s]=parseInt(c,16).toString(16),o++}if(t===-1)return o!==8?void 0:iS(r);if(o>=8)return;let a=r.slice(0,n.length);for(let s=o;s<8;s++)a.push("0");for(let s=n.length;s<r.length;s++)a.push(r[s]);return iS(a)}function vy(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let i=t?e.slice(1,-1):e;if(t&&eD(i))return i=i.toLowerCase(),{host:`[${i}]`,escapedHost:i,isIPV6:!1,isIPVFuture:!0};if(oD(i,":")<2)return{host:e,isIPV6:!1,error:t};let r="",o=i.indexOf("%");if(o!==-1){let s=i.slice(o,o+3).toLowerCase()==="%25"?3:1;if(r=i.slice(o+s),!nD(r))return{host:e,isIPV6:!1,error:!0};i=i.slice(0,o)}let a=iD(i);return a===void 0?{host:e,isIPV6:!1,error:!0}:{host:a+(r?"%"+r:""),escapedHost:a+(r?"%25"+r:""),isIPV6:!0}}function oD(e,t){let n=0;for(let i=0;i<e.length;i++)e[i]===t&&n++;return n}function aS(e){let t=e,n=[],i=-1,r=0;for(;r=t.length;){if(r===1){if(t===".")break;if(t==="/"){n.push("/");break}else{n.push(t);break}}else if(r===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){n.push("/");break}}else if(r===3&&t==="/.."){n.length!==0&&n.pop(),n.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),n.length!==0&&n.pop();continue}}if((i=t.indexOf("/",1))===-1){n.push(t);break}else n.push(t.slice(0,i)),t=t.slice(i)}return n.join("")}function aD(e){if(e===""||e[0]==="/")return aS(e);let t=e.split("/"),n=t.length-1,i=[],r=!1;for(let o=0;o<=n;o++){let a=t[o];a==="."||a===".."?(a===".."&&(i.length!==0&&i[i.length-1]!==".."?i.pop():i.push("..")),r=o===n):i.push(a)}return r&&i[i.length-1]!==".."&&i.push(""),(i.length===0||i[0]===""||i[0].includes(":"))&&i.unshift("."),i.join("/")}var sD={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},cD=/[@/?#:]/g,uD=/[@/?#]/g;function sS(e,t){let n=t?uD:cD;return n.lastIndex=0,e.replace(n,i=>sD[i])}function cS(e,t=!1){if(e.indexOf("%")===-1)return e;let n="";for(let i=0;i<e.length;i++){if(e[i]==="%"&&i+2<e.length){let r=e.slice(i+1,i+3);if(ri(r)){let o=r.toUpperCase(),a=String.fromCharCode(parseInt(o,16));t&&_y(a)?n+=a:n+="%"+o,i+=2;continue}}n+=e[i]}return n}function lD(e){let t="";for(let n=0;n<e.length;n++){let i=e[n];if(i==="%"&&n+2<e.length){let r=e.slice(n+1,n+3);if(ri(r)){let o=r.toUpperCase(),a=String.fromCharCode(parseInt(o,16));a!=="."&&_y(a)?t+=a:t+="%"+o,n+=2;continue}}if(oS(i))t+=i;else{let r=e.charCodeAt(n);if(r<128)t+=lS(r)?i:Et[r];else if(r<55296||r>57343)t+=ct(r);else if(r<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);o>=56320&&o<=57343?(t+=ct(65536+(r-55296<<10)+(o-56320)),n++):t+=ct(65533)}else t+=ct(65533)}}return t}function dD(e,t=!1){let n="",i=t&&e[0]!=="/";for(let r=0;r<e.length;r++){let o=e[r];if(o==="%"&&r+2<e.length){let a=e.slice(r+1,r+3);if(ri(a)){n+="%"+a.toUpperCase(),r+=2;continue}}if(o==="/"&&(i=!1),oS(o)&&(o!==":"||!i))n+=o;else{let a=e.charCodeAt(r);if(a<128)n+=Et[a];else if(a<55296||a>57343)n+=ct(a);else if(a<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(n+=ct(65536+(a-55296<<10)+(s-56320)),r++):n+=ct(65533)}else n+=ct(65533)}}return n}function by(e,t){let n="";for(let i=0;i<e.length;i++){let r=e[i];if(r==="%"&&i+2<e.length){let o=e.slice(i+1,i+3);if(ri(o)){n+="%"+o.toUpperCase(),i+=2;continue}}if(t(r))n+=r;else{let o=e.charCodeAt(i);if(o<128)n+=Et[o];else if(o<55296||o>57343)n+=ct(o);else if(o<=56319&&i+1<e.length){let a=e.charCodeAt(i+1);a>=56320&&a<=57343?(n+=ct(65536+(o-55296<<10)+(a-56320)),i++):n+=ct(65533)}else n+=ct(65533)}}return n}function uS(e){return by(e,XA)}function fD(e){return by(e,$y)}function pD(e){return by(e,$y)}function lS(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function mD(e){let t="";for(let n=0;n<e.length;n++){let i=e[n];if(i==="%"&&n+2<e.length){let r=e.slice(n+1,n+3);if(ri(r)){let o=r.toUpperCase(),a=String.fromCharCode(parseInt(o,16));_y(a)?t+=a:t+="%"+o,n+=2;continue}}if($y(i))t+=i;else{let r=e.charCodeAt(n);if(r<128)t+=lS(r)?i:Et[r];else if(r<55296||r>57343)t+=ct(r);else if(r<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);o>=56320&&o<=57343?(t+=ct(65536+(r-55296<<10)+(o-56320)),n++):t+=ct(65533)}else t+=ct(65533)}}return t}function hD(e){let t="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let i=e.slice(n+1,n+3);if(ri(i)){t+="%"+i.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function gD(e){let t=[];if(e.userinfo!==void 0&&(t.push(uS(e.userinfo)),t.push("@")),e.host!==void 0){let n=e.host;if(!yy(n)){let i=vy(n);i.isIPV6!==!0&&i.isIPVFuture!==!0&&(n=cS(n,!0),i=vy(n)),i.isIPV6===!0||i.isIPVFuture===!0?n=`[${i.escapedHost}]`:n=sS(n,!1)}t.push(n)}if(typeof e.port=="number"||typeof e.port=="string"){let n=String(e.port);if(!WA(n))throw new TypeError("URI port is malformed.");t.push(":"),t.push(n)}return t.length?t.join(""):void 0}dS.exports={nonSimpleDomain:rD,recomposeAuthority:gD,reescapeHostDelimiters:sS,normalizePercentEncoding:cS,normalizePathEncoding:lD,serializePathEncoding:dD,normalizeQueryFragmentEncoding:mD,encodeUserinfo:uS,encodeQuery:fD,encodeFragment:pD,escapePreservingEscapes:hD,removeDotSegments:aS,removeDotSegmentsRelative:aD,isIPv4:yy,isUUID:GA,normalizeIPv6:vy,stringArrayToHexStripped:YA}});var gS=N((D3,hS)=>{"use strict";var{isUUID:vD}=xy(),yD=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,_D=["http","https","ws","wss","urn","urn:uuid"];function $D(e){return _D.indexOf(e)!==-1}function wy(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function fS(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function pS(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function bD(e){return e.secure=wy(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function xD(e){if((e.port===(wy(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let t=e.resourceName.indexOf("?"),n=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=n&&n!=="/"?n:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function wD(e,t){if(!e.path)return e.error="URN can not be parsed",e;let n=e.path.match(yD);if(n&&n[0]===e.path){let i=t.scheme||e.scheme||"urn";e.nid=n[1].toLowerCase(),e.nss=n[2];let r=`${i}:${t.nid||e.nid}`,o=ky(r);e.path=void 0,o&&(e=o.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function kD(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let n=t.scheme||e.scheme||"urn",i=e.nid.toLowerCase(),r=`${n}:${t.nid||i}`,o=ky(r);o&&(e=o.serialize(e,t));let a=e,s=e.nss;return a.path=`${i||t.nid}:${s}`,t.skipEscape=!0,a}function SD(e,t){let n=e;return n.uuid=n.nss,n.nss=void 0,!t.tolerant&&(!n.uuid||!vD(n.uuid))&&(n.error=n.error||"UUID is not valid."),n}function ID(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var mS={scheme:"http",domainHost:!0,parse:fS,serialize:pS},zD={scheme:"https",domainHost:mS.domainHost,parse:fS,serialize:pS},Sf={scheme:"ws",domainHost:!0,parse:bD,serialize:xD},PD={scheme:"wss",domainHost:Sf.domainHost,parse:Sf.parse,serialize:Sf.serialize},TD={scheme:"urn",parse:wD,serialize:kD,skipNormalize:!0},OD={scheme:"urn:uuid",parse:SD,serialize:ID,skipNormalize:!0},If={http:mS,https:zD,ws:Sf,wss:PD,urn:TD,"urn:uuid":OD};Object.setPrototypeOf(If,null);function ky(e){return e&&(If[e]||If[e.toLowerCase()])||void 0}hS.exports={wsIsSecure:wy,SCHEMES:If,isValidSchemeName:$D,getSchemeHandler:ky}});var jS=N((R3,jf)=>{"use strict";var{normalizeIPv6:bS,removeDotSegments:ec,removeDotSegmentsRelative:xS,recomposeAuthority:jD,normalizePercentEncoding:Sy,normalizePathEncoding:ED,serializePathEncoding:vS,normalizeQueryFragmentEncoding:yS,encodeQuery:ND,encodeFragment:AD,reescapeHostDelimiters:DD,isIPv4:wS,nonSimpleDomain:RD}=xy(),{SCHEMES:kS,getSchemeHandler:Iy}=gS(),SS=/^[A-Za-z][A-Za-z0-9+.-]*$/u,IS="URI scheme is malformed.",zf="URI host is malformed.",CD=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function _S(e){let t=String(e);if(!SS.test(t))throw new TypeError(IS);return t}function UD(e,t){return typeof e=="string"?e=HD(e,t):typeof e=="object"&&(e=Tf(ni(e,t),t)),e}function ZD(e,t,n){let i=n?Object.assign({scheme:"null"},n):{scheme:"null"},{parsed:r,malformedAuthorityOrPort:o,malformedPercentEncoding:a,malformedSchemeSpecific:s,malformedHost:c,malformedScheme:u}=Pf(e,i),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:f,malformedSchemeSpecific:p,malformedHost:m,malformedScheme:h}=Pf(t,i);if(o||d||a||f||s||p||c||m||u||h)throw new Error(r.error||l.error||"URI is malformed.");let g=zS(r,l,i,!0),_=Iy(n&&n.scheme||g.scheme),$=g.host,k=$!==void 0&&$!==""&&(wS($)||bS($).isIPV6);if(TS(g,n||{},_,k))throw new Error(zf);PS(g,n||{},_,k);let O=$&&$.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test($);if(g.error&&!O)throw new Error(g.error);return i.skipEscape=!0,ni(g,i)}function zS(e,t,n,i){let r={};if(i||(e=Tf(ni(e,n),n),t=Tf(ni(t,n),n)),n=n||{},!n.tolerant&&t.scheme)r.scheme=t.scheme,r.userinfo=t.userinfo,r.host=t.host,r.port=t.port,r.path=ec(t.path||""),r.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)r.userinfo=t.userinfo,r.host=t.host,r.port=t.port,r.path=ec(t.path||""),r.query=t.query;else{if(!t.path)r.path=e.path,t.query!==void 0?r.query=t.query:r.query=e.query;else{if(t.path[0]==="/")r.path=ec(t.path);else{let o=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;o&&!e.path?r.path="/"+t.path:e.path?r.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:r.path=t.path,r.path=e.scheme===void 0&&!o&&r.path[0]!=="/"?xS(r.path):ec(r.path)}r.query=t.query}r.userinfo=e.userinfo,r.host=e.host,r.port=e.port}r.scheme=e.scheme}return r.fragment=t.fragment,r}function MD(e,t,n){let i=$S(e,n),r=$S(t,n);return i!==void 0&&r!==void 0&&i===r}function ni(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},i=Object.assign({},t),r=[];n.scheme&&(n.scheme=_S(n.scheme));let o=Iy(i.scheme||n.scheme);o&&o.serialize&&o.serialize(n,i);let a=n.userinfo!==void 0||n.host!==void 0||n.port!==void 0,s=(n.scheme===void 0||i.reference==="suffix")&&!a,c=!i.skipEscape&&s;n.path!==void 0&&(i.skipEscape?n.path=Sy(n.path):n.path=vS(n.path,c)),i.reference!=="suffix"&&n.scheme&&(n.scheme=_S(n.scheme),r.push(n.scheme,":"));let u=jD(n);if(u!==void 0&&(i.reference!=="suffix"&&r.push("//"),r.push(u),n.path&&n.path[0]!=="/"&&r.push("/")),n.path!==void 0){let l=n.path;!i.absolutePath&&(!o||!o.absolutePath)&&(l=s&&l[0]!=="/"?xS(l):ec(l)),s&&(l=vS(l,!0)),u===void 0&&l[0]==="/"&&l[1]==="/"&&(l="/%2F"+l.slice(2)),r.push(l)}return n.query!==void 0&&r.push("?",ND(n.query)),n.fragment!==void 0&&r.push("#",AD(n.fragment)),r.join("")}var LD=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,VD=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,FD=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function qD(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function Qs(e){if(e===void 0)return!1;let t=e.indexOf("%");for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function Of(e){return e[0]==="["&&e[e.length-1]==="]"}function BD(e){let t=e[4];return Qs(e[3])||t!==void 0&&!Of(t)&&Qs(t)||Qs(e[6])||Qs(e[7])||Qs(e[8])}function PS(e,t,n,i){if(TS(e,t,n,i))return e.error=e.error||zf,!0;if(!t.unicodeSupport&&(!n||!n.unicodeSupport)&&e.host&&!Of(e.host)&&(t.domainHost||n&&n.domainHost)&&i===!1&&RD(e.host)){let r;try{r=new URL("http://"+e.host)}catch(o){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+o,!0}if(!JD(r))return e.error=e.error||zf,!0;e.host=r.hostname}return!1}function TS(e,t,n,i){return!!(e.host&&i===!1&&!Of(e.host)&&(t.domainHost||n&&n.domainHost)&&CD.test(e.host))}function JD(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function Pf(e,t){let n=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},r=!1,o=!1,a=!1,s=!1,c=!1,u=!1,l=!1;n.reference==="suffix"&&(n.scheme?e=n.scheme+":"+e:e="//"+e);let d=e.match(VD);d!==null&&d[1].indexOf("\\")!==-1&&(i.error="URI authority must not contain a literal backslash.",r=!0);let f=e.match(FD);if(f!==null){let m=f[1],h=m.replace(/[\t\n\r]/g,"");h.length>=2&&(h.slice(0,2)!=="//"?(i.error=i.error||"URI authority must not contain a literal backslash.",r=!0):m.length!==h.length&&(i.error=i.error||"URI authority introducer must not contain whitespace.",r=!0))}let p=e.match(LD);if(p){i.scheme=p[1],i.userinfo=p[3],i.host=p[4],i.port=parseInt(p[5],10),i.path=p[6]||"",i.query=p[7],i.fragment=p[8],i.scheme!==void 0&&(SS.test(i.scheme)?i.scheme=i.scheme.toLowerCase():(i.error=i.error||IS,u=!0)),o=BD(p),o&&(i.error=i.error||"URI contains malformed percent-encoding."),isNaN(i.port)&&(i.port=p[5]);let m=qD(i,p);if(m!==void 0&&(i.error=i.error||m,r=!0),i.host)if(wS(i.host)===!1){let _=Of(i.host),$=i.host.indexOf("[")!==-1||i.host.indexOf("]")!==-1,k=bS(i.host);l=k.isIPV6||k.isIPVFuture===!0,c=$&&(!_||k.error===!0),i.host=l?k.host:k.host.toLowerCase(),c&&(i.error=i.error||zf,r=!0)}else l=!0;i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?i.reference="same-document":i.scheme===void 0?i.reference="relative":i.fragment===void 0?i.reference="absolute":i.reference="uri",n.reference&&n.reference!=="suffix"&&n.reference!==i.reference&&(i.error=i.error||"URI is not a "+n.reference+" reference.");let h=Iy(n.scheme||i.scheme);if(c||(s=PS(i,n,h,l)),e.indexOf("%")!==-1&&i.host!==void 0&&!c){let g=l?i.host:Sy(i.host,!0);l||(g=Sy(g.toLowerCase())),i.host=l||n.scheme!=="null"?DD(g,l):g}(!h||h&&!h.skipNormalize)&&(i.path&&(i.path=ED(i.path)),i.query&&(i.query=yS(i.query)),i.fragment&&(i.fragment=yS(i.fragment))),h&&h.parse&&(h.parse(i,n),h===kS.urn&&i.nid===void 0&&(a=!0))}else i.error=i.error||"URI can not be parsed.";return{parsed:i,malformedAuthorityOrPort:r,malformedPercentEncoding:o,malformedSchemeSpecific:a,malformedHost:s,malformedScheme:u}}function Tf(e,t){return Pf(e,t).parsed}function HD(e,t){return OS(e,t).normalized}function OS(e,t){let{parsed:n,malformedAuthorityOrPort:i,malformedPercentEncoding:r,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:s}=Pf(e,t);return{normalized:i||r||o||a||s?e:ni(n,t),malformedAuthorityOrPort:i,malformedPercentEncoding:r,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:s}}function $S(e,t){if(typeof e!="string"&&typeof e!="object")return;let n;try{n=typeof e=="string"?e:ni(e,t)}catch{return}let{normalized:i,malformedAuthorityOrPort:r,malformedPercentEncoding:o,malformedSchemeSpecific:a,malformedHost:s,malformedScheme:c}=OS(n,t);return r||o||a||s||c?void 0:i}var zy={SCHEMES:kS,normalize:UD,resolve:ZD,resolveComponent:zS,equal:MD,serialize:ni,parse:Tf};jf.exports=zy;jf.exports.default=zy;jf.exports.fastUri=zy});var NS=N(Py=>{"use strict";Object.defineProperty(Py,"__esModule",{value:!0});var ES=jS();ES.code='require("ajv/dist/runtime/uri").default';Py.default=ES});var LS=N(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.CodeGen=et.Name=et.nil=et.stringify=et.str=et._=et.KeywordCxt=void 0;var KD=Xs();Object.defineProperty(et,"KeywordCxt",{enumerable:!0,get:function(){return KD.KeywordCxt}});var Zo=te();Object.defineProperty(et,"_",{enumerable:!0,get:function(){return Zo._}});Object.defineProperty(et,"str",{enumerable:!0,get:function(){return Zo.str}});Object.defineProperty(et,"stringify",{enumerable:!0,get:function(){return Zo.stringify}});Object.defineProperty(et,"nil",{enumerable:!0,get:function(){return Zo.nil}});Object.defineProperty(et,"Name",{enumerable:!0,get:function(){return Zo.Name}});Object.defineProperty(et,"CodeGen",{enumerable:!0,get:function(){return Zo.CodeGen}});var GD=xf(),US=Ys(),WD=Xv(),tc=kf(),XD=te(),rc=Ks(),Ef=Hs(),Oy=le(),AS=nS(),YD=NS(),ZS=(e,t)=>new RegExp(e,t);ZS.code="new RegExp";var QD=["removeAdditional","useDefaults","coerceTypes"],eR=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),tR={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},rR={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},DS=200;function nR(e){var t,n,i,r,o,a,s,c,u,l,d,f,p,m,h,g,_,$,k,O,T,C,J,W,K;let ze=e.strict,Te=(t=e.code)===null||t===void 0?void 0:t.optimize,Ze=Te===!0||Te===void 0?1:Te||0,At=(i=(n=e.code)===null||n===void 0?void 0:n.regExp)!==null&&i!==void 0?i:ZS,lt=(r=e.uriResolver)!==null&&r!==void 0?r:YD.default;return{strictSchema:(a=(o=e.strictSchema)!==null&&o!==void 0?o:ze)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:ze)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:ze)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=e.strictTuples)!==null&&d!==void 0?d:ze)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=e.strictRequired)!==null&&p!==void 0?p:ze)!==null&&m!==void 0?m:!1,code:e.code?{...e.code,optimize:Ze,regExp:At}:{optimize:Ze,regExp:At},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:DS,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:DS,meta:(_=e.meta)!==null&&_!==void 0?_:!0,messages:($=e.messages)!==null&&$!==void 0?$:!0,inlineRefs:(k=e.inlineRefs)!==null&&k!==void 0?k:!0,schemaId:(O=e.schemaId)!==null&&O!==void 0?O:"$id",addUsedSchema:(T=e.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(C=e.validateSchema)!==null&&C!==void 0?C:!0,validateFormats:(J=e.validateFormats)!==null&&J!==void 0?J:!0,unicodeRegExp:(W=e.unicodeRegExp)!==null&&W!==void 0?W:!0,int32range:(K=e.int32range)!==null&&K!==void 0?K:!0,uriResolver:lt}}var nc=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...nR(t)};let{es5:n,lines:i}=this.opts.code;this.scope=new XD.ValueScope({scope:{},prefixes:eR,es5:n,lines:i}),this.logger=uR(t.logger);let r=t.validateFormats;t.validateFormats=!1,this.RULES=(0,WD.getRules)(),RS.call(this,tR,t,"NOT SUPPORTED"),RS.call(this,rR,t,"DEPRECATED","warn"),this._metaOpts=sR.call(this),t.formats&&oR.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&aR.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),iR.call(this),t.validateFormats=r}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:n,schemaId:i}=this.opts,r=AS;i==="id"&&(r={...AS},r.id=r.$id,delete r.$id),n&&t&&this.addMetaSchema(r,r[i],!1)}defaultMeta(){let{meta:t,schemaId:n}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[n]||t:void 0}validate(t,n){let i;if(typeof t=="string"){if(i=this.getSchema(t),!i)throw new Error(`no schema with key or ref "${t}"`)}else i=this.compile(t);let r=i(n);return"$async"in i||(this.errors=i.errors),r}compile(t,n){let i=this._addSchema(t,n);return i.validate||this._compileSchemaEnv(i)}compileAsync(t,n){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:i}=this.opts;return r.call(this,t,n);async function r(l,d){await o.call(this,l.$schema);let f=this._addSchema(l,d);return f.validate||a.call(this,f)}async function o(l){l&&!this.getSchema(l)&&await r.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof US.default))throw d;return s.call(this,d),await c.call(this,d.missingSchema),a.call(this,l)}}function s({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await o.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,n)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=i(l))}finally{delete this._loading[l]}}}addSchema(t,n,i,r=this.opts.validateSchema){if(Array.isArray(t)){for(let a of t)this.addSchema(a,void 0,i,r);return this}let o;if(typeof t=="object"){let{schemaId:a}=this.opts;if(o=t[a],o!==void 0&&typeof o!="string")throw new Error(`schema ${a} must be string`)}return n=(0,rc.normalizeId)(n||o),this._checkUnique(n),this.schemas[n]=this._addSchema(t,i,n,r,!0),this}addMetaSchema(t,n,i=this.opts.validateSchema){return this.addSchema(t,n,!0,i),this}validateSchema(t,n){if(typeof t=="boolean")return!0;let i;if(i=t.$schema,i!==void 0&&typeof i!="string")throw new Error("$schema must be a string");if(i=i||this.opts.defaultMeta||this.defaultMeta(),!i)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let r=this.validate(i,t);if(!r&&n){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return r}getSchema(t){let n;for(;typeof(n=CS.call(this,t))=="string";)t=n;if(n===void 0){let{schemaId:i}=this.opts,r=new tc.SchemaEnv({schema:{},schemaId:i});if(n=tc.resolveSchema.call(this,r,t),!n)return;this.refs[t]=n}return n.validate||this._compileSchemaEnv(n)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let n=CS.call(this,t);return typeof n=="object"&&this._cache.delete(n.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let n=t;this._cache.delete(n);let i=t[this.opts.schemaId];return i&&(i=(0,rc.normalizeId)(i),delete this.schemas[i],delete this.refs[i]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let n of t)this.addKeyword(n);return this}addKeyword(t,n){let i;if(typeof t=="string")i=t,typeof n=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),n.keyword=i);else if(typeof t=="object"&&n===void 0){if(n=t,i=n.keyword,Array.isArray(i)&&!i.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(dR.call(this,i,n),!n)return(0,Oy.eachItem)(i,o=>Ty.call(this,o)),this;pR.call(this,n);let r={...n,type:(0,Ef.getJSONTypes)(n.type),schemaType:(0,Ef.getJSONTypes)(n.schemaType)};return(0,Oy.eachItem)(i,r.type.length===0?o=>Ty.call(this,o,r):o=>r.type.forEach(a=>Ty.call(this,o,r,a))),this}getKeyword(t){let n=this.RULES.all[t];return typeof n=="object"?n.definition:!!n}removeKeyword(t){let{RULES:n}=this;delete n.keywords[t],delete n.all[t];for(let i of n.rules){let r=i.rules.findIndex(o=>o.keyword===t);r>=0&&i.rules.splice(r,1)}return this}addFormat(t,n){return typeof n=="string"&&(n=new RegExp(n)),this.formats[t]=n,this}errorsText(t=this.errors,{separator:n=", ",dataVar:i="data"}={}){return!t||t.length===0?"No errors":t.map(r=>`${i}${r.instancePath} ${r.message}`).reduce((r,o)=>r+n+o)}$dataMetaSchema(t,n){let i=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let r of n){let o=r.split("/").slice(1),a=t;for(let s of o)a=a[s];for(let s in i){let c=i[s];if(typeof c!="object")continue;let{$data:u}=c.definition,l=a[s];u&&l&&(a[s]=MS(l))}}return t}_removeAllSchemas(t,n){for(let i in t){let r=t[i];(!n||n.test(i))&&(typeof r=="string"?delete t[i]:r&&!r.meta&&(this._cache.delete(r.schema),delete t[i]))}}_addSchema(t,n,i,r=this.opts.validateSchema,o=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof t=="object")a=t[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;i=(0,rc.normalizeId)(a||i);let u=rc.getSchemaRefs.call(this,t,i);return c=new tc.SchemaEnv({schema:t,schemaId:s,meta:n,baseId:i,localRefs:u}),this._cache.set(c.schema,c),o&&!i.startsWith("#")&&(i&&this._checkUnique(i),this.refs[i]=c),r&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):tc.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let n=this.opts;this.opts=this._metaOpts;try{tc.compileSchema.call(this,t)}finally{this.opts=n}}};nc.ValidationError=GD.default;nc.MissingRefError=US.default;et.default=nc;function RS(e,t,n,i="error"){for(let r in e){let o=r;o in t&&this.logger[i](`${n}: option ${r}. ${e[o]}`)}}function CS(e){return e=(0,rc.normalizeId)(e),this.schemas[e]||this.refs[e]}function iR(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function oR(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function aR(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let n=e[t];n.keyword||(n.keyword=t),this.addKeyword(n)}}function sR(){let e={...this.opts};for(let t of QD)delete e[t];return e}var cR={log(){},warn(){},error(){}};function uR(e){if(e===!1)return cR;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var lR=/^[a-z_$][a-z0-9_$:-]*$/i;function dR(e,t){let{RULES:n}=this;if((0,Oy.eachItem)(e,i=>{if(n.keywords[i])throw new Error(`Keyword ${i} is already defined`);if(!lR.test(i))throw new Error(`Keyword ${i} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function Ty(e,t,n){var i;let r=t?.post;if(n&&r)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,a=r?o.post:o.rules.find(({type:c})=>c===n);if(a||(a={type:n,rules:[]},o.rules.push(a)),o.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,Ef.getJSONTypes)(t.type),schemaType:(0,Ef.getJSONTypes)(t.schemaType)}};t.before?fR.call(this,a,s,t.before):a.rules.push(s),o.all[e]=s,(i=t.implements)===null||i===void 0||i.forEach(c=>this.addKeyword(c))}function fR(e,t,n){let i=e.rules.findIndex(r=>r.keyword===n);i>=0?e.rules.splice(i,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function pR(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=MS(t)),e.validateSchema=this.compile(t,!0))}var mR={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function MS(e){return{anyOf:[e,mR]}}});var VS=N(jy=>{"use strict";Object.defineProperty(jy,"__esModule",{value:!0});var hR={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};jy.default=hR});var JS=N(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.callRef=ii.getValidate=void 0;var gR=Ys(),FS=Yt(),Nt=te(),Mo=qr(),qS=kf(),Nf=le(),vR={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:n,it:i}=e,{baseId:r,schemaEnv:o,validateName:a,opts:s,self:c}=i,{root:u}=o;if((n==="#"||n==="#/")&&r===u.baseId)return d();let l=qS.resolveRef.call(c,u,r,n);if(l===void 0)throw new gR.default(i.opts.uriResolver,r,n);if(l instanceof qS.SchemaEnv)return f(l);return p(l);function d(){if(o===u)return Af(e,a,o,o.$async);let m=t.scopeValue("root",{ref:u});return Af(e,(0,Nt._)`${m}.validate`,u,u.$async)}function f(m){let h=BS(e,m);Af(e,h,m,m.$async)}function p(m){let h=t.scopeValue("schema",s.code.source===!0?{ref:m,code:(0,Nt.stringify)(m)}:{ref:m}),g=t.name("valid"),_=e.subschema({schema:m,dataTypes:[],schemaPath:Nt.nil,topSchemaRef:h,errSchemaPath:n},g);e.mergeEvaluated(_),e.ok(g)}}};function BS(e,t){let{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):(0,Nt._)`${n.scopeValue("wrapper",{ref:t})}.validate`}ii.getValidate=BS;function Af(e,t,n,i){let{gen:r,it:o}=e,{allErrors:a,schemaEnv:s,opts:c}=o,u=c.passContext?Mo.default.this:Nt.nil;i?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let m=r.let("valid");r.try(()=>{r.code((0,Nt._)`await ${(0,FS.callValidateCode)(e,t,u)}`),p(t),a||r.assign(m,!0)},h=>{r.if((0,Nt._)`!(${h} instanceof ${o.ValidationError})`,()=>r.throw(h)),f(h),a||r.assign(m,!1)}),e.ok(m)}function d(){e.result((0,FS.callValidateCode)(e,t,u),()=>p(t),()=>f(t))}function f(m){let h=(0,Nt._)`${m}.errors`;r.assign(Mo.default.vErrors,(0,Nt._)`${Mo.default.vErrors} === null ? ${h} : ${Mo.default.vErrors}.concat(${h})`),r.assign(Mo.default.errors,(0,Nt._)`${Mo.default.vErrors}.length`)}function p(m){var h;if(!o.opts.unevaluated)return;let g=(h=n?.validate)===null||h===void 0?void 0:h.evaluated;if(o.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(o.props=Nf.mergeEvaluated.props(r,g.props,o.props));else{let _=r.var("props",(0,Nt._)`${m}.evaluated.props`);o.props=Nf.mergeEvaluated.props(r,_,o.props,Nt.Name)}if(o.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(o.items=Nf.mergeEvaluated.items(r,g.items,o.items));else{let _=r.var("items",(0,Nt._)`${m}.evaluated.items`);o.items=Nf.mergeEvaluated.items(r,_,o.items,Nt.Name)}}}ii.callRef=Af;ii.default=vR});var HS=N(Ey=>{"use strict";Object.defineProperty(Ey,"__esModule",{value:!0});var yR=VS(),_R=JS(),$R=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",yR.default,_R.default];Ey.default=$R});var KS=N(Ny=>{"use strict";Object.defineProperty(Ny,"__esModule",{value:!0});var Df=te(),wn=Df.operators,Rf={maximum:{okStr:"<=",ok:wn.LTE,fail:wn.GT},minimum:{okStr:">=",ok:wn.GTE,fail:wn.LT},exclusiveMaximum:{okStr:"<",ok:wn.LT,fail:wn.GTE},exclusiveMinimum:{okStr:">",ok:wn.GT,fail:wn.LTE}},bR={message:({keyword:e,schemaCode:t})=>(0,Df.str)`must be ${Rf[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Df._)`{comparison: ${Rf[e].okStr}, limit: ${t}}`},xR={keyword:Object.keys(Rf),type:"number",schemaType:"number",$data:!0,error:bR,code(e){let{keyword:t,data:n,schemaCode:i}=e;e.fail$data((0,Df._)`${n} ${Rf[t].fail} ${i} || isNaN(${n})`)}};Ny.default=xR});var GS=N(Ay=>{"use strict";Object.defineProperty(Ay,"__esModule",{value:!0});var ic=te(),wR={message:({schemaCode:e})=>(0,ic.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,ic._)`{multipleOf: ${e}}`},kR={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:wR,code(e){let{gen:t,data:n,schemaCode:i,it:r}=e,o=r.opts.multipleOfPrecision,a=t.let("res"),s=o?(0,ic._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:(0,ic._)`${a} !== parseInt(${a})`;e.fail$data((0,ic._)`(${i} === 0 || (${a} = ${n}/${i}, ${s}))`)}};Ay.default=kR});var XS=N(Dy=>{"use strict";Object.defineProperty(Dy,"__esModule",{value:!0});function WS(e){let t=e.length,n=0,i=0,r;for(;i<t;)n++,r=e.charCodeAt(i++),r>=55296&&r<=56319&&i<t&&(r=e.charCodeAt(i),(r&64512)===56320&&i++);return n}Dy.default=WS;WS.code='require("ajv/dist/runtime/ucs2length").default'});var YS=N(Ry=>{"use strict";Object.defineProperty(Ry,"__esModule",{value:!0});var oi=te(),SR=le(),IR=XS(),zR={message({keyword:e,schemaCode:t}){let n=e==="maxLength"?"more":"fewer";return(0,oi.str)`must NOT have ${n} than ${t} characters`},params:({schemaCode:e})=>(0,oi._)`{limit: ${e}}`},PR={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:zR,code(e){let{keyword:t,data:n,schemaCode:i,it:r}=e,o=t==="maxLength"?oi.operators.GT:oi.operators.LT,a=r.opts.unicode===!1?(0,oi._)`${n}.length`:(0,oi._)`${(0,SR.useFunc)(e.gen,IR.default)}(${n})`;e.fail$data((0,oi._)`${a} ${o} ${i}`)}};Ry.default=PR});var QS=N(Cy=>{"use strict";Object.defineProperty(Cy,"__esModule",{value:!0});var TR=Yt(),OR=le(),Lo=te(),jR={message:({schemaCode:e})=>(0,Lo.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,Lo._)`{pattern: ${e}}`},ER={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:jR,code(e){let{gen:t,data:n,$data:i,schema:r,schemaCode:o,it:a}=e,s=a.opts.unicodeRegExp?"u":"";if(i){let{regExp:c}=a.opts.code,u=c.code==="new RegExp"?(0,Lo._)`new RegExp`:(0,OR.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,Lo._)`${u}(${o}, ${s}).test(${n})`),()=>t.assign(l,!1)),e.fail$data((0,Lo._)`!${l}`)}else{let c=(0,TR.usePattern)(e,r);e.fail$data((0,Lo._)`!${c}.test(${n})`)}}};Cy.default=ER});var eI=N(Uy=>{"use strict";Object.defineProperty(Uy,"__esModule",{value:!0});var oc=te(),NR={message({keyword:e,schemaCode:t}){let n=e==="maxProperties"?"more":"fewer";return(0,oc.str)`must NOT have ${n} than ${t} properties`},params:({schemaCode:e})=>(0,oc._)`{limit: ${e}}`},AR={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:NR,code(e){let{keyword:t,data:n,schemaCode:i}=e,r=t==="maxProperties"?oc.operators.GT:oc.operators.LT;e.fail$data((0,oc._)`Object.keys(${n}).length ${r} ${i}`)}};Uy.default=AR});var tI=N(Zy=>{"use strict";Object.defineProperty(Zy,"__esModule",{value:!0});var ac=Yt(),sc=te(),DR=le(),RR={message:({params:{missingProperty:e}})=>(0,sc.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,sc._)`{missingProperty: ${e}}`},CR={keyword:"required",type:"object",schemaType:"array",$data:!0,error:RR,code(e){let{gen:t,schema:n,schemaCode:i,data:r,$data:o,it:a}=e,{opts:s}=a;if(!o&&n.length===0)return;let c=n.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let p=e.parentSchema.properties,{definedProperties:m}=e.it;for(let h of n)if(p?.[h]===void 0&&!m.has(h)){let g=a.schemaEnv.baseId+a.errSchemaPath,_=`required property "${h}" is not defined at "${g}" (strictRequired)`;(0,DR.checkStrictMode)(a,_,a.opts.strictRequired)}}function u(){if(c||o)e.block$data(sc.nil,d);else for(let p of n)(0,ac.checkReportMissingProp)(e,p)}function l(){let p=t.let("missing");if(c||o){let m=t.let("valid",!0);e.block$data(m,()=>f(p,m)),e.ok(m)}else t.if((0,ac.checkMissingProp)(e,n,p)),(0,ac.reportMissingProp)(e,p),t.else()}function d(){t.forOf("prop",i,p=>{e.setParams({missingProperty:p}),t.if((0,ac.noPropertyInData)(t,r,p,s.ownProperties),()=>e.error())})}function f(p,m){e.setParams({missingProperty:p}),t.forOf(p,i,()=>{t.assign(m,(0,ac.propertyInData)(t,r,p,s.ownProperties)),t.if((0,sc.not)(m),()=>{e.error(),t.break()})},sc.nil)}}};Zy.default=CR});var rI=N(My=>{"use strict";Object.defineProperty(My,"__esModule",{value:!0});var cc=te(),UR={message({keyword:e,schemaCode:t}){let n=e==="maxItems"?"more":"fewer";return(0,cc.str)`must NOT have ${n} than ${t} items`},params:({schemaCode:e})=>(0,cc._)`{limit: ${e}}`},ZR={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:UR,code(e){let{keyword:t,data:n,schemaCode:i}=e,r=t==="maxItems"?cc.operators.GT:cc.operators.LT;e.fail$data((0,cc._)`${n}.length ${r} ${i}`)}};My.default=ZR});var Cf=N(Ly=>{"use strict";Object.defineProperty(Ly,"__esModule",{value:!0});var nI=oy();nI.code='require("ajv/dist/runtime/equal").default';Ly.default=nI});var iI=N(Fy=>{"use strict";Object.defineProperty(Fy,"__esModule",{value:!0});var Vy=Hs(),tt=te(),MR=le(),LR=Cf(),VR={message:({params:{i:e,j:t}})=>(0,tt.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,tt._)`{i: ${e}, j: ${t}}`},FR={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:VR,code(e){let{gen:t,data:n,$data:i,schema:r,parentSchema:o,schemaCode:a,it:s}=e;if(!i&&!r)return;let c=t.let("valid"),u=o.items?(0,Vy.getSchemaTypes)(o.items):[];e.block$data(c,l,(0,tt._)`${a} === false`),e.ok(c);function l(){let m=t.let("i",(0,tt._)`${n}.length`),h=t.let("j");e.setParams({i:m,j:h}),t.assign(c,!0),t.if((0,tt._)`${m} > 1`,()=>(d()?f:p)(m,h))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function f(m,h){let g=t.name("item"),_=(0,Vy.checkDataTypes)(u,g,s.opts.strictNumbers,Vy.DataType.Wrong),$=t.const("indices",(0,tt._)`{}`);t.for((0,tt._)`;${m}--;`,()=>{t.let(g,(0,tt._)`${n}[${m}]`),t.if(_,(0,tt._)`continue`),u.length>1&&t.if((0,tt._)`typeof ${g} == "string"`,(0,tt._)`${g} += "_"`),t.if((0,tt._)`typeof ${$}[${g}] == "number"`,()=>{t.assign(h,(0,tt._)`${$}[${g}]`),e.error(),t.assign(c,!1).break()}).code((0,tt._)`${$}[${g}] = ${m}`)})}function p(m,h){let g=(0,MR.useFunc)(t,LR.default),_=t.name("outer");t.label(_).for((0,tt._)`;${m}--;`,()=>t.for((0,tt._)`${h} = ${m}; ${h}--;`,()=>t.if((0,tt._)`${g}(${n}[${m}], ${n}[${h}])`,()=>{e.error(),t.assign(c,!1).break(_)})))}}};Fy.default=FR});var oI=N(By=>{"use strict";Object.defineProperty(By,"__esModule",{value:!0});var qy=te(),qR=le(),BR=Cf(),JR={message:"must be equal to constant",params:({schemaCode:e})=>(0,qy._)`{allowedValue: ${e}}`},HR={keyword:"const",$data:!0,error:JR,code(e){let{gen:t,data:n,$data:i,schemaCode:r,schema:o}=e;i||o&&typeof o=="object"?e.fail$data((0,qy._)`!${(0,qR.useFunc)(t,BR.default)}(${n}, ${r})`):e.fail((0,qy._)`${o} !== ${n}`)}};By.default=HR});var aI=N(Jy=>{"use strict";Object.defineProperty(Jy,"__esModule",{value:!0});var uc=te(),KR=le(),GR=Cf(),WR={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,uc._)`{allowedValues: ${e}}`},XR={keyword:"enum",schemaType:"array",$data:!0,error:WR,code(e){let{gen:t,data:n,$data:i,schema:r,schemaCode:o,it:a}=e;if(!i&&r.length===0)throw new Error("enum must have non-empty array");let s=r.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,KR.useFunc)(t,GR.default)),l;if(s||i)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(r))throw new Error("ajv implementation error");let p=t.const("vSchema",o);l=(0,uc.or)(...r.map((m,h)=>f(p,h)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",o,p=>t.if((0,uc._)`${u()}(${n}, ${p})`,()=>t.assign(l,!0).break()))}function f(p,m){let h=r[m];return typeof h=="object"&&h!==null?(0,uc._)`${u()}(${n}, ${p}[${m}])`:(0,uc._)`${n} === ${h}`}}};Jy.default=XR});var sI=N(Hy=>{"use strict";Object.defineProperty(Hy,"__esModule",{value:!0});var YR=KS(),QR=GS(),eC=YS(),tC=QS(),rC=eI(),nC=tI(),iC=rI(),oC=iI(),aC=oI(),sC=aI(),cC=[YR.default,QR.default,eC.default,tC.default,rC.default,nC.default,iC.default,oC.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},aC.default,sC.default];Hy.default=cC});var Gy=N(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});lc.validateAdditionalItems=void 0;var ai=te(),Ky=le(),uC={message:({params:{len:e}})=>(0,ai.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,ai._)`{limit: ${e}}`},lC={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:uC,code(e){let{parentSchema:t,it:n}=e,{items:i}=t;if(!Array.isArray(i)){(0,Ky.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}cI(e,i)}};function cI(e,t){let{gen:n,schema:i,data:r,keyword:o,it:a}=e;a.items=!0;let s=n.const("len",(0,ai._)`${r}.length`);if(i===!1)e.setParams({len:t.length}),e.pass((0,ai._)`${s} <= ${t.length}`);else if(typeof i=="object"&&!(0,Ky.alwaysValidSchema)(a,i)){let u=n.var("valid",(0,ai._)`${s} <= ${t.length}`);n.if((0,ai.not)(u),()=>c(u)),e.ok(u)}function c(u){n.forRange("i",t.length,s,l=>{e.subschema({keyword:o,dataProp:l,dataPropType:Ky.Type.Num},u),a.allErrors||n.if((0,ai.not)(u),()=>n.break())})}}lc.validateAdditionalItems=cI;lc.default=lC});var Wy=N(dc=>{"use strict";Object.defineProperty(dc,"__esModule",{value:!0});dc.validateTuple=void 0;var uI=te(),Uf=le(),dC=Yt(),fC={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:n}=e;if(Array.isArray(t))return lI(e,"additionalItems",t);n.items=!0,!(0,Uf.alwaysValidSchema)(n,t)&&e.ok((0,dC.validateArray)(e))}};function lI(e,t,n=e.schema){let{gen:i,parentSchema:r,data:o,keyword:a,it:s}=e;l(r),s.opts.unevaluated&&n.length&&s.items!==!0&&(s.items=Uf.mergeEvaluated.items(i,n.length,s.items));let c=i.name("valid"),u=i.const("len",(0,uI._)`${o}.length`);n.forEach((d,f)=>{(0,Uf.alwaysValidSchema)(s,d)||(i.if((0,uI._)`${u} > ${f}`,()=>e.subschema({keyword:a,schemaProp:f,dataProp:f},c)),e.ok(c))});function l(d){let{opts:f,errSchemaPath:p}=s,m=n.length,h=m===d.minItems&&(m===d.maxItems||d[t]===!1);if(f.strictTuples&&!h){let g=`"${a}" is ${m}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;(0,Uf.checkStrictMode)(s,g,f.strictTuples)}}}dc.validateTuple=lI;dc.default=fC});var dI=N(Xy=>{"use strict";Object.defineProperty(Xy,"__esModule",{value:!0});var pC=Wy(),mC={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,pC.validateTuple)(e,"items")};Xy.default=mC});var pI=N(Yy=>{"use strict";Object.defineProperty(Yy,"__esModule",{value:!0});var fI=te(),hC=le(),gC=Yt(),vC=Gy(),yC={message:({params:{len:e}})=>(0,fI.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,fI._)`{limit: ${e}}`},_C={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:yC,code(e){let{schema:t,parentSchema:n,it:i}=e,{prefixItems:r}=n;i.items=!0,!(0,hC.alwaysValidSchema)(i,t)&&(r?(0,vC.validateAdditionalItems)(e,r):e.ok((0,gC.validateArray)(e)))}};Yy.default=_C});var mI=N(Qy=>{"use strict";Object.defineProperty(Qy,"__esModule",{value:!0});var er=te(),Zf=le(),$C={message:({params:{min:e,max:t}})=>t===void 0?(0,er.str)`must contain at least ${e} valid item(s)`:(0,er.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,er._)`{minContains: ${e}}`:(0,er._)`{minContains: ${e}, maxContains: ${t}}`},bC={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:$C,code(e){let{gen:t,schema:n,parentSchema:i,data:r,it:o}=e,a,s,{minContains:c,maxContains:u}=i;o.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=t.const("len",(0,er._)`${r}.length`);if(e.setParams({min:a,max:s}),s===void 0&&a===0){(0,Zf.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,Zf.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Zf.alwaysValidSchema)(o,n)){let h=(0,er._)`${l} >= ${a}`;s!==void 0&&(h=(0,er._)`${h} && ${l} <= ${s}`),e.pass(h);return}o.items=!0;let d=t.name("valid");s===void 0&&a===1?p(d,()=>t.if(d,()=>t.break())):a===0?(t.let(d,!0),s!==void 0&&t.if((0,er._)`${r}.length > 0`,f)):(t.let(d,!1),f()),e.result(d,()=>e.reset());function f(){let h=t.name("_valid"),g=t.let("count",0);p(h,()=>t.if(h,()=>m(g)))}function p(h,g){t.forRange("i",0,l,_=>{e.subschema({keyword:"contains",dataProp:_,dataPropType:Zf.Type.Num,compositeRule:!0},h),g()})}function m(h){t.code((0,er._)`${h}++`),s===void 0?t.if((0,er._)`${h} >= ${a}`,()=>t.assign(d,!0).break()):(t.if((0,er._)`${h} > ${s}`,()=>t.assign(d,!1).break()),a===1?t.assign(d,!0):t.if((0,er._)`${h} >= ${a}`,()=>t.assign(d,!0)))}}};Qy.default=bC});var vI=N(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.validateSchemaDeps=zr.validatePropertyDeps=zr.error=void 0;var e_=te(),xC=le(),fc=Yt();zr.error={message:({params:{property:e,depsCount:t,deps:n}})=>{let i=t===1?"property":"properties";return(0,e_.str)`must have ${i} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:n,missingProperty:i}})=>(0,e_._)`{property: ${e},
8
8
  missingProperty: ${i},
9
9
  depsCount: ${t},
10
- deps: ${n}}`};var wC={keyword:"dependencies",type:"object",schemaType:"object",error:zr.error,code(e){let[t,n]=kC(e);hI(e,t),gI(e,n)}};function kC({schema:e}){let t={},n={};for(let i in e){if(i==="__proto__")continue;let r=Array.isArray(e[i])?t:n;r[i]=e[i]}return[t,n]}function hI(e,t=e.schema){let{gen:n,data:i,it:r}=e;if(Object.keys(t).length===0)return;let o=n.let("missing");for(let a in t){let s=t[a];if(s.length===0)continue;let c=(0,fc.propertyInData)(n,i,a,r.opts.ownProperties);e.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),r.allErrors?n.if(c,()=>{for(let u of s)(0,fc.checkReportMissingProp)(e,u)}):(n.if((0,e_._)`${c} && (${(0,fc.checkMissingProp)(e,s,o)})`),(0,fc.reportMissingProp)(e,o),n.else())}}zr.validatePropertyDeps=hI;function gI(e,t=e.schema){let{gen:n,data:i,keyword:r,it:o}=e,a=n.name("valid");for(let s in t)(0,xC.alwaysValidSchema)(o,t[s])||(n.if((0,fc.propertyInData)(n,i,s,o.opts.ownProperties),()=>{let c=e.subschema({keyword:r,schemaProp:s},a);e.mergeValidEvaluated(c,a)},()=>n.var(a,!0)),e.ok(a))}zr.validateSchemaDeps=gI;zr.default=wC});var _I=N(t_=>{"use strict";Object.defineProperty(t_,"__esModule",{value:!0});var yI=te(),SC=le(),IC={message:"property name must be valid",params:({params:e})=>(0,yI._)`{propertyName: ${e.propertyName}}`},zC={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:IC,code(e){let{gen:t,schema:n,data:i,it:r}=e;if((0,SC.alwaysValidSchema)(r,n))return;let o=t.name("valid");t.forIn("key",i,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},o),t.if((0,yI.not)(o),()=>{e.error(!0),r.allErrors||t.break()})}),e.ok(o)}};t_.default=zC});var n_=N(r_=>{"use strict";Object.defineProperty(r_,"__esModule",{value:!0});var Mf=Yt(),pr=te(),PC=qr(),Lf=le(),TC={message:"must NOT have additional properties",params:({params:e})=>(0,pr._)`{additionalProperty: ${e.additionalProperty}}`},OC={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:TC,code(e){let{gen:t,schema:n,parentSchema:i,data:r,errsCount:o,it:a}=e;if(!o)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,Lf.alwaysValidSchema)(a,n))return;let u=(0,Mf.allSchemaProperties)(i.properties),l=(0,Mf.allSchemaProperties)(i.patternProperties);d(),e.ok((0,pr._)`${o} === ${PC.default.errors}`);function d(){t.forIn("key",r,g=>{!u.length&&!l.length?m(g):t.if(f(g),()=>m(g))})}function f(g){let _;if(u.length>8){let $=(0,Lf.schemaRefOrVal)(a,i.properties,"properties");_=(0,Mf.isOwnProperty)(t,$,g)}else u.length?_=(0,pr.or)(...u.map($=>(0,pr._)`${g} === ${$}`)):_=pr.nil;return l.length&&(_=(0,pr.or)(_,...l.map($=>(0,pr._)`${(0,Mf.usePattern)(e,$)}.test(${g})`))),(0,pr.not)(_)}function p(g){t.code((0,pr._)`delete ${r}[${g}]`)}function m(g){if(c.removeAdditional==="all"||c.removeAdditional&&n===!1){p(g);return}if(n===!1){e.setParams({additionalProperty:g}),e.error(),s||t.break();return}if(typeof n=="object"&&!(0,Lf.alwaysValidSchema)(a,n)){let _=t.name("valid");c.removeAdditional==="failing"?(h(g,_,!1),t.if((0,pr.not)(_),()=>{e.reset(),p(g)})):(h(g,_),s||t.if((0,pr.not)(_),()=>t.break()))}}function h(g,_,$){let k={keyword:"additionalProperties",dataProp:g,dataPropType:Lf.Type.Str};$===!1&&Object.assign(k,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(k,_)}}};r_.default=OC});var xI=N(o_=>{"use strict";Object.defineProperty(o_,"__esModule",{value:!0});var jC=Xs(),$I=Yt(),i_=le(),bI=n_(),EC={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,parentSchema:i,data:r,it:o}=e;o.opts.removeAdditional==="all"&&i.additionalProperties===void 0&&bI.default.code(new jC.KeywordCxt(o,bI.default,"additionalProperties"));let a=(0,$I.allSchemaProperties)(n);for(let d of a)o.definedProperties.add(d);o.opts.unevaluated&&a.length&&o.props!==!0&&(o.props=i_.mergeEvaluated.props(t,(0,i_.toHash)(a),o.props));let s=a.filter(d=>!(0,i_.alwaysValidSchema)(o,n[d]));if(s.length===0)return;let c=t.name("valid");for(let d of s)u(d)?l(d):(t.if((0,$I.propertyInData)(t,r,d,o.opts.ownProperties)),l(d),o.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return o.opts.useDefaults&&!o.compositeRule&&n[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};o_.default=EC});var II=N(a_=>{"use strict";Object.defineProperty(a_,"__esModule",{value:!0});var wI=Yt(),Vf=te(),kI=le(),SI=le(),NC={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,data:i,parentSchema:r,it:o}=e,{opts:a}=o,s=(0,wI.allSchemaProperties)(n),c=s.filter(h=>(0,kI.alwaysValidSchema)(o,n[h]));if(s.length===0||c.length===s.length&&(!o.opts.unevaluated||o.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&r.properties,l=t.name("valid");o.props!==!0&&!(o.props instanceof Vf.Name)&&(o.props=(0,SI.evaluatedPropsToName)(t,o.props));let{props:d}=o;f();function f(){for(let h of s)u&&p(h),o.allErrors?m(h):(t.var(l,!0),m(h),t.if(l))}function p(h){for(let g in u)new RegExp(h).test(g)&&(0,kI.checkStrictMode)(o,`property ${g} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){t.forIn("key",i,g=>{t.if((0,Vf._)`${(0,wI.usePattern)(e,h)}.test(${g})`,()=>{let _=c.includes(h);_||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:g,dataPropType:SI.Type.Str},l),o.opts.unevaluated&&d!==!0?t.assign((0,Vf._)`${d}[${g}]`,!0):!_&&!o.allErrors&&t.if((0,Vf.not)(l),()=>t.break())})})}}};a_.default=NC});var zI=N(s_=>{"use strict";Object.defineProperty(s_,"__esModule",{value:!0});var AC=le(),DC={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:n,it:i}=e;if((0,AC.alwaysValidSchema)(i,n)){e.fail();return}let r=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},r),e.failResult(r,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};s_.default=DC});var PI=N(c_=>{"use strict";Object.defineProperty(c_,"__esModule",{value:!0});var RC=Yt(),CC={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:RC.validateUnion,error:{message:"must match a schema in anyOf"}};c_.default=CC});var TI=N(u_=>{"use strict";Object.defineProperty(u_,"__esModule",{value:!0});var Ff=te(),UC=le(),ZC={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Ff._)`{passingSchemas: ${e.passing}}`},MC={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:ZC,code(e){let{gen:t,schema:n,parentSchema:i,it:r}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(r.opts.discriminator&&i.discriminator)return;let o=n,a=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(!0));function u(){o.forEach((l,d)=>{let f;(0,UC.alwaysValidSchema)(r,l)?t.var(c,!0):f=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,Ff._)`${c} && ${a}`).assign(a,!1).assign(s,(0,Ff._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),f&&e.mergeEvaluated(f,Ff.Name)})})}}};u_.default=MC});var OI=N(l_=>{"use strict";Object.defineProperty(l_,"__esModule",{value:!0});var LC=le(),VC={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:n,it:i}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");let r=t.name("valid");n.forEach((o,a)=>{if((0,LC.alwaysValidSchema)(i,o))return;let s=e.subschema({keyword:"allOf",schemaProp:a},r);e.ok(r),e.mergeEvaluated(s)})}};l_.default=VC});var NI=N(d_=>{"use strict";Object.defineProperty(d_,"__esModule",{value:!0});var qf=te(),EI=le(),FC={message:({params:e})=>(0,qf.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,qf._)`{failingKeyword: ${e.ifClause}}`},qC={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:FC,code(e){let{gen:t,parentSchema:n,it:i}=e;n.then===void 0&&n.else===void 0&&(0,EI.checkStrictMode)(i,'"if" without "then" and "else" is ignored');let r=jI(i,"then"),o=jI(i,"else");if(!r&&!o)return;let a=t.let("valid",!0),s=t.name("_valid");if(c(),e.reset(),r&&o){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,u("then",l),u("else",l))}else r?t.if(s,u("then")):t.if((0,qf.not)(s),u("else"));e.pass(a,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(l)}function u(l,d){return()=>{let f=e.subschema({keyword:l},s);t.assign(a,s),e.mergeValidEvaluated(f,a),d?t.assign(d,(0,qf._)`${l}`):e.setParams({ifClause:l})}}}};function jI(e,t){let n=e.schema[t];return n!==void 0&&!(0,EI.alwaysValidSchema)(e,n)}d_.default=qC});var AI=N(f_=>{"use strict";Object.defineProperty(f_,"__esModule",{value:!0});var BC=le(),JC={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){t.if===void 0&&(0,BC.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};f_.default=JC});var DI=N(p_=>{"use strict";Object.defineProperty(p_,"__esModule",{value:!0});var HC=Gy(),KC=dI(),GC=Wy(),WC=pI(),XC=mI(),YC=vI(),QC=_I(),e6=n_(),t6=xI(),r6=II(),n6=zI(),i6=PI(),o6=TI(),a6=OI(),s6=NI(),c6=AI();function u6(e=!1){let t=[n6.default,i6.default,o6.default,a6.default,s6.default,c6.default,QC.default,e6.default,YC.default,t6.default,r6.default];return e?t.push(KC.default,WC.default):t.push(HC.default,GC.default),t.push(XC.default),t}p_.default=u6});var RI=N(m_=>{"use strict";Object.defineProperty(m_,"__esModule",{value:!0});var Le=te(),l6={message:({schemaCode:e})=>(0,Le.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,Le._)`{format: ${e}}`},d6={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:l6,code(e,t){let{gen:n,data:i,$data:r,schema:o,schemaCode:a,it:s}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;r?f():p();function f(){let m=n.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=n.const("fDef",(0,Le._)`${m}[${a}]`),g=n.let("fType"),_=n.let("format");n.if((0,Le._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>n.assign(g,(0,Le._)`${h}.type || "string"`).assign(_,(0,Le._)`${h}.validate`),()=>n.assign(g,(0,Le._)`"string"`).assign(_,h)),e.fail$data((0,Le.or)($(),k()));function $(){return c.strictSchema===!1?Le.nil:(0,Le._)`${a} && !${_}`}function k(){let O=l.$async?(0,Le._)`(${h}.async ? await ${_}(${i}) : ${_}(${i}))`:(0,Le._)`${_}(${i})`,T=(0,Le._)`(typeof ${_} == "function" ? ${O} : ${_}.test(${i}))`;return(0,Le._)`${_} && ${_} !== true && ${g} === ${t} && !${T}`}}function p(){let m=d.formats[o];if(!m){$();return}if(m===!0)return;let[h,g,_]=k(m);h===t&&e.pass(O());function $(){if(c.strictSchema===!1){d.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function k(T){let C=T instanceof RegExp?(0,Le.regexpCode)(T):c.code.formats?(0,Le._)`${c.code.formats}${(0,Le.getProperty)(o)}`:void 0,J=n.scopeValue("formats",{key:o,ref:T,code:C});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,Le._)`${J}.validate`]:["string",T,J]}function O(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,Le._)`await ${_}(${i})`}return typeof g=="function"?(0,Le._)`${_}(${i})`:(0,Le._)`${_}.test(${i})`}}}};m_.default=d6});var CI=N(h_=>{"use strict";Object.defineProperty(h_,"__esModule",{value:!0});var f6=RI(),p6=[f6.default];h_.default=p6});var UI=N(Vo=>{"use strict";Object.defineProperty(Vo,"__esModule",{value:!0});Vo.contentVocabulary=Vo.metadataVocabulary=void 0;Vo.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Vo.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var MI=N(g_=>{"use strict";Object.defineProperty(g_,"__esModule",{value:!0});var m6=HS(),h6=sI(),g6=DI(),v6=CI(),ZI=UI(),y6=[m6.default,h6.default,(0,g6.default)(),v6.default,ZI.metadataVocabulary,ZI.contentVocabulary];g_.default=y6});var VI=N(Bf=>{"use strict";Object.defineProperty(Bf,"__esModule",{value:!0});Bf.DiscrError=void 0;var LI;(function(e){e.Tag="tag",e.Mapping="mapping"})(LI||(Bf.DiscrError=LI={}))});var qI=N(y_=>{"use strict";Object.defineProperty(y_,"__esModule",{value:!0});var Fo=te(),v_=VI(),FI=kf(),_6=Ys(),$6=le(),b6={message:({params:{discrError:e,tagName:t}})=>e===v_.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>(0,Fo._)`{error: ${e}, tag: ${n}, tagValue: ${t}}`},x6={keyword:"discriminator",type:"object",schemaType:"object",error:b6,code(e){let{gen:t,data:n,schema:i,parentSchema:r,it:o}=e,{oneOf:a}=r;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=i.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(i.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,Fo._)`${n}${(0,Fo.getProperty)(s)}`);t.if((0,Fo._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:v_.DiscrError.Tag,tag:u,tagName:s})),e.ok(c);function l(){let p=f();t.if(!1);for(let m in p)t.elseIf((0,Fo._)`${u} === ${m}`),t.assign(c,d(p[m]));t.else(),e.error(!1,{discrError:v_.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function d(p){let m=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:p},m);return e.mergeEvaluated(h,Fo.Name),m}function f(){var p;let m={},h=_(r),g=!0;for(let O=0;O<a.length;O++){let T=a[O];if(T?.$ref&&!(0,$6.schemaHasRulesButRef)(T,o.self.RULES)){let J=T.$ref;if(T=FI.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,J),T instanceof FI.SchemaEnv&&(T=T.schema),T===void 0)throw new _6.default(o.opts.uriResolver,o.baseId,J)}let C=(p=T?.properties)===null||p===void 0?void 0:p[s];if(typeof C!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);g=g&&(h||_(T)),$(C,O)}if(!g)throw new Error(`discriminator: "${s}" must be required`);return m;function _({required:O}){return Array.isArray(O)&&O.includes(s)}function $(O,T){if(O.const)k(O.const,T);else if(O.enum)for(let C of O.enum)k(C,T);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function k(O,T){if(typeof O!="string"||O in m)throw new Error(`discriminator: "${s}" values must be unique strings`);m[O]=T}}}};y_.default=x6});var BI=N((k5,w6)=>{w6.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var $_=N((je,__)=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.MissingRefError=je.ValidationError=je.CodeGen=je.Name=je.nil=je.stringify=je.str=je._=je.KeywordCxt=je.Ajv=void 0;var k6=LS(),S6=MI(),I6=qI(),JI=BI(),z6=["/properties"],Jf="http://json-schema.org/draft-07/schema",qo=class extends k6.default{_addVocabularies(){super._addVocabularies(),S6.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(I6.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(JI,z6):JI;this.addMetaSchema(t,Jf,!1),this.refs["http://json-schema.org/schema"]=Jf}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Jf)?Jf:void 0)}};je.Ajv=qo;__.exports=je=qo;__.exports.Ajv=qo;Object.defineProperty(je,"__esModule",{value:!0});je.default=qo;var P6=Xs();Object.defineProperty(je,"KeywordCxt",{enumerable:!0,get:function(){return P6.KeywordCxt}});var Bo=te();Object.defineProperty(je,"_",{enumerable:!0,get:function(){return Bo._}});Object.defineProperty(je,"str",{enumerable:!0,get:function(){return Bo.str}});Object.defineProperty(je,"stringify",{enumerable:!0,get:function(){return Bo.stringify}});Object.defineProperty(je,"nil",{enumerable:!0,get:function(){return Bo.nil}});Object.defineProperty(je,"Name",{enumerable:!0,get:function(){return Bo.Name}});Object.defineProperty(je,"CodeGen",{enumerable:!0,get:function(){return Bo.CodeGen}});var T6=xf();Object.defineProperty(je,"ValidationError",{enumerable:!0,get:function(){return T6.default}});var O6=Ys();Object.defineProperty(je,"MissingRefError",{enumerable:!0,get:function(){return O6.default}})});var ez=N(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.formatNames=Tr.fastFormats=Tr.fullFormats=void 0;function Pr(e,t){return{validate:e,compare:t}}Tr.fullFormats={date:Pr(WI,k_),time:Pr(x_(!0),S_),"date-time":Pr(HI(!0),YI),"iso-time":Pr(x_(),XI),"iso-date-time":Pr(HI(),QI),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:R6,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:F6,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:C6,int32:{type:"number",validate:M6},int64:{type:"number",validate:L6},float:{type:"number",validate:GI},double:{type:"number",validate:GI},password:!0,binary:!0};Tr.fastFormats={...Tr.fullFormats,date:Pr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,k_),time:Pr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,S_),"date-time":Pr(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,YI),"iso-time":Pr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,XI),"iso-date-time":Pr(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,QI),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Tr.formatNames=Object.keys(Tr.fullFormats);function j6(e){return e%4===0&&(e%100!==0||e%400===0)}var E6=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,N6=[0,31,28,31,30,31,30,31,31,30,31,30,31];function WI(e){let t=E6.exec(e);if(!t)return!1;let n=+t[1],i=+t[2],r=+t[3];return i>=1&&i<=12&&r>=1&&r<=(i===2&&j6(n)?29:N6[i])}function k_(e,t){if(e&&t)return e>t?1:e<t?-1:0}var b_=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function x_(e){return function(n){let i=b_.exec(n);if(!i)return!1;let r=+i[1],o=+i[2],a=+i[3],s=i[4],c=i[5]==="-"?-1:1,u=+(i[6]||0),l=+(i[7]||0);if(u>23||l>59||e&&!s)return!1;if(r<=23&&o<=59&&a<60)return!0;let d=o-l*c,f=r-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function S_(e,t){if(!(e&&t))return;let n=new Date("2020-01-01T"+e).valueOf(),i=new Date("2020-01-01T"+t).valueOf();if(n&&i)return n-i}function XI(e,t){if(!(e&&t))return;let n=b_.exec(e),i=b_.exec(t);if(n&&i)return e=n[1]+n[2]+n[3],t=i[1]+i[2]+i[3],e>t?1:e<t?-1:0}var w_=/t|\s/i;function HI(e){let t=x_(e);return function(i){let r=i.split(w_);return r.length===2&&WI(r[0])&&t(r[1])}}function YI(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),i=new Date(t).valueOf();if(n&&i)return n-i}function QI(e,t){if(!(e&&t))return;let[n,i]=e.split(w_),[r,o]=t.split(w_),a=k_(n,r);if(a!==void 0)return a||S_(i,o)}var A6=/\/|:/,D6=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function R6(e){return A6.test(e)&&D6.test(e)}var KI=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function C6(e){return KI.lastIndex=0,KI.test(e)}var U6=-(2**31),Z6=2**31-1;function M6(e){return Number.isInteger(e)&&e<=Z6&&e>=U6}function L6(e){return Number.isInteger(e)}function GI(){return!0}var V6=/[^\\]\\Z/;function F6(e){if(V6.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var tz=N(Jo=>{"use strict";Object.defineProperty(Jo,"__esModule",{value:!0});Jo.formatLimitDefinition=void 0;var q6=$_(),mr=te(),kn=mr.operators,Hf={formatMaximum:{okStr:"<=",ok:kn.LTE,fail:kn.GT},formatMinimum:{okStr:">=",ok:kn.GTE,fail:kn.LT},formatExclusiveMaximum:{okStr:"<",ok:kn.LT,fail:kn.GTE},formatExclusiveMinimum:{okStr:">",ok:kn.GT,fail:kn.LTE}},B6={message:({keyword:e,schemaCode:t})=>(0,mr.str)`should be ${Hf[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,mr._)`{comparison: ${Hf[e].okStr}, limit: ${t}}`};Jo.formatLimitDefinition={keyword:Object.keys(Hf),type:"string",schemaType:"string",$data:!0,error:B6,code(e){let{gen:t,data:n,schemaCode:i,keyword:r,it:o}=e,{opts:a,self:s}=o;if(!a.validateFormats)return;let c=new q6.KeywordCxt(o,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let f=t.scopeValue("formats",{ref:s.formats,code:a.code.formats}),p=t.const("fmt",(0,mr._)`${f}[${c.schemaCode}]`);e.fail$data((0,mr.or)((0,mr._)`typeof ${p} != "object"`,(0,mr._)`${p} instanceof RegExp`,(0,mr._)`typeof ${p}.compare != "function"`,d(p)))}function l(){let f=c.schema,p=s.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${r}": format "${f}" does not define "compare" function`);let m=t.scopeValue("formats",{key:f,ref:p,code:a.code.formats?(0,mr._)`${a.code.formats}${(0,mr.getProperty)(f)}`:void 0});e.fail$data(d(m))}function d(f){return(0,mr._)`${f}.compare(${n}, ${i}) ${Hf[r].fail} 0`}},dependencies:["format"]};var J6=e=>(e.addKeyword(Jo.formatLimitDefinition),e);Jo.default=J6});var oz=N((pc,iz)=>{"use strict";Object.defineProperty(pc,"__esModule",{value:!0});var Ho=ez(),H6=tz(),I_=te(),rz=new I_.Name("fullFormats"),K6=new I_.Name("fastFormats"),z_=(e,t={keywords:!0})=>{if(Array.isArray(t))return nz(e,t,Ho.fullFormats,rz),e;let[n,i]=t.mode==="fast"?[Ho.fastFormats,K6]:[Ho.fullFormats,rz],r=t.formats||Ho.formatNames;return nz(e,r,n,i),t.keywords&&(0,H6.default)(e),e};z_.get=(e,t="full")=>{let i=(t==="fast"?Ho.fastFormats:Ho.fullFormats)[e];if(!i)throw new Error(`Unknown format "${e}"`);return i};function nz(e,t,n,i){var r,o;(r=(o=e.opts.code).formats)!==null&&r!==void 0||(o.formats=(0,I_._)`require("ajv-formats/dist/formats").${i}`);for(let a of t)e.addFormat(a,n[a])}iz.exports=pc=z_;Object.defineProperty(pc,"__esModule",{value:!0});pc.default=z_});import{parseArgs as QU}from"node:util";var di="0.1.0",Qz="https://api.heylatch.app",$e=class extends Error{constructor(n,i,r=0,o={}){super(i);this.code=n;this.status=r;this.params=o}code;status;params},li=class{key;baseUrl;fetcher;constructor({key:t=process.env.LATCH_API_KEY,baseUrl:n=process.env.LATCH_API_URL??Qz,fetch:i=fetch}={}){if(!t)throw new $e("noApiKey","No API key. Set LATCH_API_KEY to a key from your workspace's API page on heylatch.app.");if(!t.startsWith("ltk_"))throw new $e("noApiKey","LATCH_API_KEY doesn't look like a Latch API key (it should start with ltk_).");this.key=t,this.baseUrl=n.replace(/\/+$/,""),this.fetcher=i}async request(t,n,i){let r;try{r=await this.fetcher(`${this.baseUrl}/public/v1${n}`,{method:t,headers:{authorization:`Bearer ${this.key}`,"user-agent":`latch-cli/${di}`,...i!==void 0?{"content-type":"application/json"}:{}},body:i!==void 0?JSON.stringify(i):void 0})}catch(a){throw new $e("network",`Couldn't reach ${this.baseUrl}: ${a.message}`)}let o=await r.json().catch(()=>null);if(!r.ok){let a=o?.error;throw new $e(a?.code??"generic",a?.message??`Request failed (${r.status}).`,r.status,a?.params??{})}return o}async upload(t,n){let i=await this.fetcher(t,{method:"PUT",headers:{"content-type":"application/zip"},body:n});if(!i.ok)throw new $e("uploadFailed",`Uploading the package failed (${i.status}). The upload link may have expired; try again.`,i.status)}workspace=()=>this.request("GET","/workspace");listScripts=()=>this.request("GET","/scripts").then(t=>t.data);getScript=t=>this.request("GET",`/scripts/${dt(t)}`);createScript=t=>this.request("POST","/scripts",t);createVersion=(t,n)=>this.request("POST",`/scripts/${dt(t)}/versions`,n);getVersion=(t,n)=>this.request("GET",`/scripts/${dt(t)}/versions/${dt(n)}`);publishVersion=(t,n)=>this.request("POST",`/scripts/${dt(t)}/versions/${dt(n)}/publish`);withdrawVersion=(t,n)=>this.request("POST",`/scripts/${dt(t)}/versions/${dt(n)}/withdraw`);listGrants=(t,n={})=>this.request("GET",`/scripts/${dt(t)}/grants${sp(n)}`);grant=(t,n)=>this.request("POST",`/scripts/${dt(t)}/grants`,{accountId:n});grantBulk=(t,n)=>this.request("POST",`/scripts/${dt(t)}/grants/bulk`,{accountIds:n});revoke=(t,n)=>this.request("POST",`/scripts/${dt(t)}/grants/revoke`,{accountId:n});listActivations=(t,n={})=>this.request("GET",`/scripts/${dt(t)}/activations${sp(n)}`);listFlags=(t,n={})=>this.request("GET",`/scripts/${dt(t)}/flags${sp(n)}`);resolveFlag=t=>this.request("POST",`/flags/${dt(t)}/resolve`)},dt=encodeURIComponent;function sp(e){let t=Object.entries(e).filter(([,n])=>n!=null&&n!=="");return t.length?`?${new URLSearchParams(t.map(([n,i])=>[n,String(i)]))}`:""}var se;(function(e){e.assertEqual=r=>{};function t(r){}e.assertIs=t;function n(r){throw new Error}e.assertNever=n,e.arrayToEnum=r=>{let o={};for(let a of r)o[a]=a;return o},e.getValidEnumValues=r=>{let o=e.objectKeys(r).filter(s=>typeof r[r[s]]!="number"),a={};for(let s of o)a[s]=r[s];return e.objectValues(a)},e.objectValues=r=>e.objectKeys(r).map(function(o){return r[o]}),e.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let o=[];for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&o.push(a);return o},e.find=(r,o)=>{for(let a of r)if(o(a))return a},e.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function i(r,o=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=i,e.jsonStringifyReplacer=(r,o)=>typeof o=="bigint"?o.toString():o})(se||(se={}));var H_;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(H_||(H_={}));var D=se.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ar=e=>{switch(typeof e){case"undefined":return D.undefined;case"string":return D.string;case"number":return Number.isNaN(e)?D.nan:D.number;case"boolean":return D.boolean;case"function":return D.function;case"bigint":return D.bigint;case"symbol":return D.symbol;case"object":return Array.isArray(e)?D.array:e===null?D.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?D.promise:typeof Map<"u"&&e instanceof Map?D.map:typeof Set<"u"&&e instanceof Set?D.set:typeof Date<"u"&&e instanceof Date?D.date:D.object;default:return D.unknown}};var I=se.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 Ct=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(o){return o.message},i={_errors:[]},r=o=>{for(let a of o.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)i._errors.push(n(a));else{let s=i,c=0;for(;c<a.path.length;){let u=a.path[c],l=c===a.path.length-1;if(u==="_errors"){l&&s._errors.push(n(a)),c++;continue}Object.prototype.hasOwnProperty.call(s,u)||(u==="__proto__"?Object.defineProperty(s,u,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):s[u]={_errors:[]}),s=s[u],l&&s._errors.push(n(a)),c++}}};return r(this),i}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,se.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n=Object.create(null),i=[];for(let r of this.issues)if(r.path.length>0){let o=r.path[0];n[o]=n[o]||[],n[o].push(t(r))}else i.push(t(r));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}};Ct.create=e=>new Ct(e);var eP=(e,t)=>{let n;switch(e.code){case I.invalid_type:e.received===D.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case I.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,se.jsonStringifyReplacer)}`;break;case I.unrecognized_keys:n=`Unrecognized key(s) in object: ${se.joinValues(e.keys,", ")}`;break;case I.invalid_union:n="Invalid input";break;case I.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${se.joinValues(e.options)}`;break;case I.invalid_enum_value:n=`Invalid enum value. Expected ${se.joinValues(e.options)}, received '${e.received}'`;break;case I.invalid_arguments:n="Invalid function arguments";break;case I.invalid_return_type:n="Invalid function return type";break;case I.invalid_date:n="Invalid date";break;case I.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:se.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case I.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case I.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case I.custom:n="Invalid input";break;case I.invalid_intersection_types:n="Intersection results could not be merged";break;case I.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case I.not_finite:n="Number must be finite";break;default:n=t.defaultError,se.assertNever(e)}return{message:n}},Gr=eP;var tP=Gr;function ea(){return tP}var xc=e=>{let{data:t,path:n,errorMaps:i,issueData:r}=e,o=[...n,...r.path||[]],a={...r,path:o};if(r.message!==void 0)return{...r,path:o,message:r.message};let s="",c=i.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:t,defaultError:s}).message;return{...r,path:o,message:s}};function j(e,t){let n=ea(),i=xc({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Gr?void 0:Gr].filter(r=>!!r)});e.common.issues.push(i)}var nt=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let i=[];for(let r of n){if(r.status==="aborted")return F;r.status==="dirty"&&t.dirty(),i.push(r.value)}return{status:t.value,value:i}}static async mergeObjectAsync(t,n){let i=[];for(let r of n){let o=await r.key,a=await r.value;i.push({key:o,value:a})}return e.mergeObjectSync(t,i)}static mergeObjectSync(t,n){let i={};for(let r of n){let{key:o,value:a}=r;if(o.status==="aborted"||a.status==="aborted")return F;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||r.alwaysSet)&&(i[o.value]=a.value)}return{status:t.value,value:i}}},F=Object.freeze({status:"aborted"}),fi=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),cp=e=>e.status==="aborted",up=e=>e.status==="dirty",zn=e=>e.status==="valid",ta=e=>typeof Promise<"u"&&e instanceof Promise;var U;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(U||(U={}));var Bt=class{constructor(t,n,i,r){this._cachedPath=[],this.parent=t,this.data=n,this._path=i,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}},K_=(e,t)=>{if(zn(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new Ct(e.common.issues);return this._error=n,this._error}}};function X(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:i,description:r}=e;if(t&&(n||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:r}:{errorMap:(a,s)=>{let{message:c}=e;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??i??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??n??s.defaultError}},description:r}}var re=class{get description(){return this._def.description}_getType(t){return Ar(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Ar(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new nt,ctx:{common:t.parent.common,data:t.data,parsedType:Ar(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(ta(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let i=this.safeParse(t,n);if(i.success)return i.data;throw i.error}safeParse(t,n){let i={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ar(t)},r=this._parseSync({data:t,path:i.path,parent:i});return K_(i,r)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ar(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:n});return zn(i)?{value:i.value}:{issues:n.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>zn(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(t,n){let i=await this.safeParseAsync(t,n);if(i.success)return i.data;throw i.error}async safeParseAsync(t,n){let i={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ar(t)},r=this._parse({data:t,path:i.path,parent:i}),o=await(ta(r)?r:Promise.resolve(r));return K_(i,o)}refine(t,n){let i=r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,o)=>{let a=t(r),s=()=>o.addIssue({code:I.custom,...i(r)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,n){return this._refinement((i,r)=>t(i)?!0:(r.addIssue(typeof n=="function"?n(i,r):n),!1))}_refinement(t){return new ir({schema:this,typeName:P.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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:n=>this["~validate"](n)}}optional(){return nr.create(this,this._def)}nullable(){return Cr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Xr.create(this)}promise(){return Pn.create(this,this._def)}or(t){return vi.create([this,t],this._def)}and(t){return yi.create(this,t,this._def)}transform(t){return new ir({...X(this._def),schema:this,typeName:P.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new wi({...X(this._def),innerType:this,defaultValue:n,typeName:P.ZodDefault})}brand(){return new wc({typeName:P.ZodBranded,type:this,...X(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new ki({...X(this._def),innerType:this,catchValue:n,typeName:P.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return kc.create(this,t)}readonly(){return Si.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},rP=/^c[^\s-]{8,}$/i,nP=/^[0-9a-z]+$/,iP=/^[0-9A-HJKMNP-TV-Z]{26}$/i,oP=/^[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,aP=/^[a-z0-9_-]{21}$/i,sP=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,cP=/^[-+]?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)?)??$/,uP=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,lP="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",lp,dP=/^(?:(?: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])$/,fP=/^(?:(?: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])$/,pP=/^(([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]))$/,mP=/^(([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])$/,hP=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,gP=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,G_="((\\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])))",vP=new RegExp(`^${G_}$`);function W_(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function yP(e){return new RegExp(`^${W_(e)}$`)}function _P(e){let t=`${G_}T${W_(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function $P(e,t){return!!((t==="v4"||!t)&&dP.test(e)||(t==="v6"||!t)&&pP.test(e))}function bP(e,t){if(!sP.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let i=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(i));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||t&&r.alg!==t)}catch{return!1}}function xP(e,t){return!!((t==="v4"||!t)&&fP.test(e)||(t==="v6"||!t)&&mP.test(e))}var mi=class e extends re{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==D.string){let o=this._getOrReturnCtx(t);return j(o,{code:I.invalid_type,expected:D.string,received:o.parsedType}),F}let i=new nt,r;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(r=this._getOrReturnCtx(t,r),j(r,{code:I.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="max")t.data.length>o.value&&(r=this._getOrReturnCtx(t,r),j(r,{code:I.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="length"){let a=t.data.length>o.value,s=t.data.length<o.value;(a||s)&&(r=this._getOrReturnCtx(t,r),a?j(r,{code:I.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):s&&j(r,{code:I.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),i.dirty())}else if(o.kind==="email")uP.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"email",code:I.invalid_string,message:o.message}),i.dirty());else if(o.kind==="emoji")lp||(lp=new RegExp(lP,"u")),lp.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"emoji",code:I.invalid_string,message:o.message}),i.dirty());else if(o.kind==="uuid")oP.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"uuid",code:I.invalid_string,message:o.message}),i.dirty());else if(o.kind==="nanoid")aP.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"nanoid",code:I.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid")rP.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"cuid",code:I.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid2")nP.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"cuid2",code:I.invalid_string,message:o.message}),i.dirty());else if(o.kind==="ulid")iP.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"ulid",code:I.invalid_string,message:o.message}),i.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{r=this._getOrReturnCtx(t,r),j(r,{validation:"url",code:I.invalid_string,message:o.message}),i.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"regex",code:I.invalid_string,message:o.message}),i.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(r=this._getOrReturnCtx(t,r),j(r,{code:I.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),i.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(r=this._getOrReturnCtx(t,r),j(r,{code:I.invalid_string,validation:{startsWith:o.value},message:o.message}),i.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(r=this._getOrReturnCtx(t,r),j(r,{code:I.invalid_string,validation:{endsWith:o.value},message:o.message}),i.dirty()):o.kind==="datetime"?_P(o).test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{code:I.invalid_string,validation:"datetime",message:o.message}),i.dirty()):o.kind==="date"?vP.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{code:I.invalid_string,validation:"date",message:o.message}),i.dirty()):o.kind==="time"?yP(o).test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{code:I.invalid_string,validation:"time",message:o.message}),i.dirty()):o.kind==="duration"?cP.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"duration",code:I.invalid_string,message:o.message}),i.dirty()):o.kind==="ip"?$P(t.data,o.version)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"ip",code:I.invalid_string,message:o.message}),i.dirty()):o.kind==="jwt"?bP(t.data,o.alg)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"jwt",code:I.invalid_string,message:o.message}),i.dirty()):o.kind==="cidr"?xP(t.data,o.version)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"cidr",code:I.invalid_string,message:o.message}),i.dirty()):o.kind==="base64"?hP.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"base64",code:I.invalid_string,message:o.message}),i.dirty()):o.kind==="base64url"?gP.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"base64url",code:I.invalid_string,message:o.message}),i.dirty()):se.assertNever(o);return{status:i.value,value:t.data}}_regex(t,n,i){return this.refinement(r=>t.test(r),{validation:n,code:I.invalid_string,...U.errToObj(i)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...U.errToObj(t)})}url(t){return this._addCheck({kind:"url",...U.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...U.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...U.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...U.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...U.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...U.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...U.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...U.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...U.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...U.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...U.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...U.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...U.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...U.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...U.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...U.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...U.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...U.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...U.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...U.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...U.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...U.errToObj(n)})}nonempty(t){return this.min(1,U.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};mi.create=e=>new mi({checks:[],typeName:P.ZodString,coerce:e?.coerce??!1,...X(e)});function wP(e,t){let n=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,r=n>i?n:i,o=Number.parseInt(e.toFixed(r).replace(".","")),a=Number.parseInt(t.toFixed(r).replace(".",""));return o%a/10**r}var ra=class e extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==D.number){let o=this._getOrReturnCtx(t);return j(o,{code:I.invalid_type,expected:D.number,received:o.parsedType}),F}let i,r=new nt;for(let o of this._def.checks)o.kind==="int"?se.isInteger(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{code:I.invalid_type,expected:"integer",received:"float",message:o.message}),r.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(i=this._getOrReturnCtx(t,i),j(i,{code:I.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(i=this._getOrReturnCtx(t,i),j(i,{code:I.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty()):o.kind==="multipleOf"?wP(t.data,o.value)!==0&&(i=this._getOrReturnCtx(t,i),j(i,{code:I.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{code:I.not_finite,message:o.message}),r.dirty()):se.assertNever(o);return{status:r.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,U.toString(n))}gt(t,n){return this.setLimit("min",t,!1,U.toString(n))}lte(t,n){return this.setLimit("max",t,!0,U.toString(n))}lt(t,n){return this.setLimit("max",t,!1,U.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:U.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:U.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:U.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:U.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:U.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:U.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:U.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:U.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:U.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:U.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&se.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(t===null||i.value<t)&&(t=i.value)}return Number.isFinite(n)&&Number.isFinite(t)}};ra.create=e=>new ra({checks:[],typeName:P.ZodNumber,coerce:e?.coerce||!1,...X(e)});var na=class e extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==D.bigint)return this._getInvalidInput(t);let i,r=new nt;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(i=this._getOrReturnCtx(t,i),j(i,{code:I.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),r.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(i=this._getOrReturnCtx(t,i),j(i,{code:I.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),r.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(i=this._getOrReturnCtx(t,i),j(i,{code:I.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()):se.assertNever(o);return{status:r.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return j(n,{code:I.invalid_type,expected:D.bigint,received:n.parsedType}),F}gte(t,n){return this.setLimit("min",t,!0,U.toString(n))}gt(t,n){return this.setLimit("min",t,!1,U.toString(n))}lte(t,n){return this.setLimit("max",t,!0,U.toString(n))}lt(t,n){return this.setLimit("max",t,!1,U.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:U.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:U.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:U.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:U.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:U.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:U.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};na.create=e=>new na({checks:[],typeName:P.ZodBigInt,coerce:e?.coerce??!1,...X(e)});var ia=class extends re{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==D.boolean){let i=this._getOrReturnCtx(t);return j(i,{code:I.invalid_type,expected:D.boolean,received:i.parsedType}),F}return ft(t.data)}};ia.create=e=>new ia({typeName:P.ZodBoolean,coerce:e?.coerce||!1,...X(e)});var oa=class e extends re{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==D.date){let o=this._getOrReturnCtx(t);return j(o,{code:I.invalid_type,expected:D.date,received:o.parsedType}),F}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return j(o,{code:I.invalid_date}),F}let i=new nt,r;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(r=this._getOrReturnCtx(t,r),j(r,{code:I.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),i.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(r=this._getOrReturnCtx(t,r),j(r,{code:I.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),i.dirty()):se.assertNever(o);return{status:i.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:U.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:U.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};oa.create=e=>new oa({checks:[],coerce:e?.coerce||!1,typeName:P.ZodDate,...X(e)});var aa=class extends re{_parse(t){if(this._getType(t)!==D.symbol){let i=this._getOrReturnCtx(t);return j(i,{code:I.invalid_type,expected:D.symbol,received:i.parsedType}),F}return ft(t.data)}};aa.create=e=>new aa({typeName:P.ZodSymbol,...X(e)});var hi=class extends re{_parse(t){if(this._getType(t)!==D.undefined){let i=this._getOrReturnCtx(t);return j(i,{code:I.invalid_type,expected:D.undefined,received:i.parsedType}),F}return ft(t.data)}};hi.create=e=>new hi({typeName:P.ZodUndefined,...X(e)});var gi=class extends re{_parse(t){if(this._getType(t)!==D.null){let i=this._getOrReturnCtx(t);return j(i,{code:I.invalid_type,expected:D.null,received:i.parsedType}),F}return ft(t.data)}};gi.create=e=>new gi({typeName:P.ZodNull,...X(e)});var sa=class extends re{constructor(){super(...arguments),this._any=!0}_parse(t){return ft(t.data)}};sa.create=e=>new sa({typeName:P.ZodAny,...X(e)});var Wr=class extends re{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ft(t.data)}};Wr.create=e=>new Wr({typeName:P.ZodUnknown,...X(e)});var yr=class extends re{_parse(t){let n=this._getOrReturnCtx(t);return j(n,{code:I.invalid_type,expected:D.never,received:n.parsedType}),F}};yr.create=e=>new yr({typeName:P.ZodNever,...X(e)});var ca=class extends re{_parse(t){if(this._getType(t)!==D.undefined){let i=this._getOrReturnCtx(t);return j(i,{code:I.invalid_type,expected:D.void,received:i.parsedType}),F}return ft(t.data)}};ca.create=e=>new ca({typeName:P.ZodVoid,...X(e)});var Xr=class e extends re{_parse(t){let{ctx:n,status:i}=this._processInputParams(t),r=this._def;if(n.parsedType!==D.array)return j(n,{code:I.invalid_type,expected:D.array,received:n.parsedType}),F;if(r.exactLength!==null){let a=n.data.length>r.exactLength.value,s=n.data.length<r.exactLength.value;(a||s)&&(j(n,{code:a?I.too_big:I.too_small,minimum:s?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),i.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(j(n,{code:I.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(j(n,{code:I.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((a,s)=>r.type._parseAsync(new Bt(n,a,n.path,s)))).then(a=>nt.mergeArray(i,a));let o=[...n.data].map((a,s)=>r.type._parseSync(new Bt(n,a,n.path,s)));return nt.mergeArray(i,o)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:U.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:U.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:U.toString(n)}})}nonempty(t){return this.min(1,t)}};Xr.create=(e,t)=>new Xr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:P.ZodArray,...X(t)});function pi(e){if(e instanceof Ut){let t={};for(let n in e.shape){let i=e.shape[n];t[n]=nr.create(pi(i))}return new Ut({...e._def,shape:()=>t})}else return e instanceof Xr?new Xr({...e._def,type:pi(e.element)}):e instanceof nr?nr.create(pi(e.unwrap())):e instanceof Cr?Cr.create(pi(e.unwrap())):e instanceof Rr?Rr.create(e.items.map(t=>pi(t))):e}var Ut=class e extends re{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=se.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==D.object){let u=this._getOrReturnCtx(t);return j(u,{code:I.invalid_type,expected:D.object,received:u.parsedType}),F}let{status:i,ctx:r}=this._processInputParams(t),{shape:o,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof yr&&this._def.unknownKeys==="strip"))for(let u in r.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=o[u],d=r.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Bt(r,d,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof yr){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:r.data[l]}});else if(u==="strict")s.length>0&&(j(r,{code:I.unrecognized_keys,keys:s}),i.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of s){let d=r.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Bt(r,d,r.path,l)),alwaysSet:l in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>nt.mergeObjectSync(i,u)):nt.mergeObjectSync(i,c)}get shape(){return this._def.shape()}strict(t){return U.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,i)=>{let r=this._def.errorMap?.(n,i).message??i.defaultError;return n.code==="unrecognized_keys"?{message:U.errToObj(t).message??r}:{message:r}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:P.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let i of se.objectKeys(t))t[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let i of se.objectKeys(this.shape))t[i]||(n[i]=this.shape[i]);return new e({...this._def,shape:()=>n})}deepPartial(){return pi(this)}partial(t){let n={};for(let i of se.objectKeys(this.shape)){let r=this.shape[i];t&&!t[i]?n[i]=r:n[i]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let i of se.objectKeys(this.shape))if(t&&!t[i])n[i]=this.shape[i];else{let o=this.shape[i];for(;o instanceof nr;)o=o._def.innerType;n[i]=o}return new e({...this._def,shape:()=>n})}keyof(){return X_(se.objectKeys(this.shape))}};Ut.create=(e,t)=>new Ut({shape:()=>e,unknownKeys:"strip",catchall:yr.create(),typeName:P.ZodObject,...X(t)});Ut.strictCreate=(e,t)=>new Ut({shape:()=>e,unknownKeys:"strict",catchall:yr.create(),typeName:P.ZodObject,...X(t)});Ut.lazycreate=(e,t)=>new Ut({shape:e,unknownKeys:"strip",catchall:yr.create(),typeName:P.ZodObject,...X(t)});var vi=class extends re{_parse(t){let{ctx:n}=this._processInputParams(t),i=this._def.options;function r(o){for(let s of o)if(s.result.status==="valid")return s.result;for(let s of o)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(s=>new Ct(s.ctx.common.issues));return j(n,{code:I.invalid_union,unionErrors:a}),F}if(n.common.async)return Promise.all(i.map(async o=>{let a={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(r);{let o,a=[];for(let c of i){let u={...n,common:{...n.common,issues:[]},parent:null},l=c._parseSync({data:n.data,path:n.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;let s=a.map(c=>new Ct(c));return j(n,{code:I.invalid_union,unionErrors:s}),F}}get options(){return this._def.options}};vi.create=(e,t)=>new vi({options:e,typeName:P.ZodUnion,...X(t)});var Dr=e=>e instanceof _i?Dr(e.schema):e instanceof ir?Dr(e.innerType()):e instanceof $i?[e.value]:e instanceof bi?e.options:e instanceof xi?se.objectValues(e.enum):e instanceof wi?Dr(e._def.innerType):e instanceof hi?[void 0]:e instanceof gi?[null]:e instanceof nr?[void 0,...Dr(e.unwrap())]:e instanceof Cr?[null,...Dr(e.unwrap())]:e instanceof wc||e instanceof Si?Dr(e.unwrap()):e instanceof ki?Dr(e._def.innerType):[],dp=class e extends re{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==D.object)return j(n,{code:I.invalid_type,expected:D.object,received:n.parsedType}),F;let i=this.discriminator,r=n.data[i],o=this.optionsMap.get(r);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(j(n,{code:I.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),F)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,i){let r=new Map;for(let o of n){let a=Dr(o.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(r.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);r.set(s,o)}}return new e({typeName:P.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...X(i)})}};function fp(e,t){let n=Ar(e),i=Ar(t);if(e===t)return{valid:!0,data:e};if(n===D.object&&i===D.object){let r=se.objectKeys(t),o=se.objectKeys(e).filter(s=>r.indexOf(s)!==-1),a={...e,...t};Object.prototype.hasOwnProperty.call(a,"__proto__")&&delete a.__proto__;for(let s of o){if(s==="__proto__")continue;let c=fp(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(n===D.array&&i===D.array){if(e.length!==t.length)return{valid:!1};let r=[];for(let o=0;o<e.length;o++){let a=e[o],s=t[o],c=fp(a,s);if(!c.valid)return{valid:!1};r.push(c.data)}return{valid:!0,data:r}}else return n===D.date&&i===D.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var yi=class extends re{_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=(o,a)=>{if(cp(o)||cp(a))return F;let s=fp(o.value,a.value);return s.valid?((up(o)||up(a))&&n.dirty(),{status:n.value,value:s.data}):(j(i,{code:I.invalid_intersection_types}),F)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([o,a])=>r(o,a)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};yi.create=(e,t,n)=>new yi({left:e,right:t,typeName:P.ZodIntersection,...X(n)});var Rr=class e extends re{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==D.array)return j(i,{code:I.invalid_type,expected:D.array,received:i.parsedType}),F;if(i.data.length<this._def.items.length)return j(i,{code:I.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F;!this._def.rest&&i.data.length>this._def.items.length&&(j(i,{code:I.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let o=[...i.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new Bt(i,a,i.path,s)):null}).filter(a=>!!a);return i.common.async?Promise.all(o).then(a=>nt.mergeArray(n,a)):nt.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Rr.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Rr({items:e,typeName:P.ZodTuple,rest:null,...X(t)})};var pp=class e extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==D.object)return j(i,{code:I.invalid_type,expected:D.object,received:i.parsedType}),F;let r=[],o=this._def.keyType,a=this._def.valueType;for(let s in i.data)r.push({key:o._parse(new Bt(i,s,i.path,s)),value:a._parse(new Bt(i,i.data[s],i.path,s)),alwaysSet:s in i.data});return i.common.async?nt.mergeObjectAsync(n,r):nt.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(t,n,i){return n instanceof re?new e({keyType:t,valueType:n,typeName:P.ZodRecord,...X(i)}):new e({keyType:mi.create(),valueType:t,typeName:P.ZodRecord,...X(n)})}},ua=class extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==D.map)return j(i,{code:I.invalid_type,expected:D.map,received:i.parsedType}),F;let r=this._def.keyType,o=this._def.valueType,a=[...i.data.entries()].map(([s,c],u)=>({key:r._parse(new Bt(i,s,i.path,[u,"key"])),value:o._parse(new Bt(i,c,i.path,[u,"value"]))}));if(i.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return F;(u.status==="dirty"||l.status==="dirty")&&n.dirty(),s.set(u.value,l.value)}return{status:n.value,value:s}})}else{let s=new Map;for(let c of a){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return F;(u.status==="dirty"||l.status==="dirty")&&n.dirty(),s.set(u.value,l.value)}return{status:n.value,value:s}}}};ua.create=(e,t,n)=>new ua({valueType:t,keyType:e,typeName:P.ZodMap,...X(n)});var la=class e extends re{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==D.set)return j(i,{code:I.invalid_type,expected:D.set,received:i.parsedType}),F;let r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(j(i,{code:I.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&i.data.size>r.maxSize.value&&(j(i,{code:I.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());let o=this._def.valueType;function a(c){let u=new Set;for(let l of c){if(l.status==="aborted")return F;l.status==="dirty"&&n.dirty(),u.add(l.value)}return{status:n.value,value:u}}let s=[...i.data.values()].map((c,u)=>o._parse(new Bt(i,c,i.path,u)));return i.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,n){return new e({...this._def,minSize:{value:t,message:U.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:U.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};la.create=(e,t)=>new la({valueType:e,minSize:null,maxSize:null,typeName:P.ZodSet,...X(t)});var mp=class e extends re{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==D.function)return j(n,{code:I.invalid_type,expected:D.function,received:n.parsedType}),F;function i(s,c){return xc({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ea(),Gr].filter(u=>!!u),issueData:{code:I.invalid_arguments,argumentsError:c}})}function r(s,c){return xc({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ea(),Gr].filter(u=>!!u),issueData:{code:I.invalid_return_type,returnTypeError:c}})}let o={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof Pn){let s=this;return ft(async function(...c){let u=new Ct([]),l=await s._def.args.parseAsync(c,o).catch(p=>{throw u.addIssue(i(c,p)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,o).catch(p=>{throw u.addIssue(r(d,p)),u})})}else{let s=this;return ft(function(...c){let u=s._def.args.safeParse(c,o);if(!u.success)throw new Ct([i(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,o);if(!d.success)throw new Ct([r(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Rr.create(t).rest(Wr.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,i){return new e({args:t||Rr.create([]).rest(Wr.create()),returns:n||Wr.create(),typeName:P.ZodFunction,...X(i)})}},_i=class extends re{get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};_i.create=(e,t)=>new _i({getter:e,typeName:P.ZodLazy,...X(t)});var $i=class extends re{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return j(n,{received:n.data,code:I.invalid_literal,expected:this._def.value}),F}return{status:"valid",value:t.data}}get value(){return this._def.value}};$i.create=(e,t)=>new $i({value:e,typeName:P.ZodLiteral,...X(t)});function X_(e,t){return new bi({values:e,typeName:P.ZodEnum,...X(t)})}var bi=class e extends re{_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),i=this._def.values;return j(n,{expected:se.joinValues(i),received:n.parsedType,code:I.invalid_type}),F}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),i=this._def.values;return j(n,{received:n.data,code:I.invalid_enum_value,options:i}),F}return ft(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(i=>!t.includes(i)),{...this._def,...n})}};bi.create=X_;var xi=class extends re{_parse(t){let n=se.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(t);if(i.parsedType!==D.string&&i.parsedType!==D.number){let r=se.objectValues(n);return j(i,{expected:se.joinValues(r),received:i.parsedType,code:I.invalid_type}),F}if(this._cache||(this._cache=new Set(se.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let r=se.objectValues(n);return j(i,{received:i.data,code:I.invalid_enum_value,options:r}),F}return ft(t.data)}get enum(){return this._def.values}};xi.create=(e,t)=>new xi({values:e,typeName:P.ZodNativeEnum,...X(t)});var Pn=class extends re{unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==D.promise&&n.common.async===!1)return j(n,{code:I.invalid_type,expected:D.promise,received:n.parsedType}),F;let i=n.parsedType===D.promise?n.data:Promise.resolve(n.data);return ft(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Pn.create=(e,t)=>new Pn({type:e,typeName:P.ZodPromise,...X(t)});var ir=class extends re{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===P.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=this._def.effect||null,o={addIssue:a=>{j(i,a),a.fatal?n.abort():n.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),r.type==="preprocess"){let a=r.transform(i.data,o);if(i.common.async)return Promise.resolve(a).then(async s=>{if(n.value==="aborted")return F;let c=await this._def.schema._parseAsync({data:s,path:i.path,parent:i});return c.status==="aborted"?F:c.status==="dirty"?fi(c.value):n.value==="dirty"?fi(c.value):c});{if(n.value==="aborted")return F;let s=this._def.schema._parseSync({data:a,path:i.path,parent:i});return s.status==="aborted"?F:s.status==="dirty"?fi(s.value):n.value==="dirty"?fi(s.value):s}}if(r.type==="refinement"){let a=s=>{let c=r.refinement(s,o);if(i.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(i.common.async===!1){let s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?F:(s.status==="dirty"&&n.dirty(),a(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>s.status==="aborted"?F:(s.status==="dirty"&&n.dirty(),a(s.value).then(()=>({status:n.value,value:s.value}))))}if(r.type==="transform")if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!zn(a))return F;let s=r.transform(a.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>zn(a)?Promise.resolve(r.transform(a.value,o)).then(s=>({status:n.value,value:s})):F);se.assertNever(r)}};ir.create=(e,t,n)=>new ir({schema:e,typeName:P.ZodEffects,effect:t,...X(n)});ir.createWithPreprocess=(e,t,n)=>new ir({schema:t,effect:{type:"preprocess",transform:e},typeName:P.ZodEffects,...X(n)});var nr=class extends re{_parse(t){return this._getType(t)===D.undefined?ft(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};nr.create=(e,t)=>new nr({innerType:e,typeName:P.ZodOptional,...X(t)});var Cr=class extends re{_parse(t){return this._getType(t)===D.null?ft(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Cr.create=(e,t)=>new Cr({innerType:e,typeName:P.ZodNullable,...X(t)});var wi=class extends re{_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return n.parsedType===D.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};wi.create=(e,t)=>new wi({innerType:e,typeName:P.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...X(t)});var ki=class extends re{_parse(t){let{ctx:n}=this._processInputParams(t),i={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return ta(r)?r.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ct(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Ct(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};ki.create=(e,t)=>new ki({innerType:e,typeName:P.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...X(t)});var da=class extends re{_parse(t){if(this._getType(t)!==D.nan){let i=this._getOrReturnCtx(t);return j(i,{code:I.invalid_type,expected:D.nan,received:i.parsedType}),F}return{status:"valid",value:t.data}}};da.create=e=>new da({typeName:P.ZodNaN,...X(e)});var wc=class extends re{_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}},kc=class e extends re{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?F:o.status==="dirty"?(n.dirty(),fi(o.value)):this._def.out._parseAsync({data:o.value,path:i.path,parent:i})})();{let r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?F:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(t,n){return new e({in:t,out:n,typeName:P.ZodPipeline})}},Si=class extends re{_parse(t){let n=this._def.innerType._parse(t),i=r=>(zn(r)&&(r.value=Object.freeze(r.value)),r);return ta(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}};Si.create=(e,t)=>new Si({innerType:e,typeName:P.ZodReadonly,...X(t)});var xZ={object:Ut.lazycreate},P;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(P||(P={}));var wZ=mi.create,kZ=ra.create,SZ=da.create,IZ=na.create,zZ=ia.create,PZ=oa.create,TZ=aa.create,OZ=hi.create,jZ=gi.create,EZ=sa.create,NZ=Wr.create,AZ=yr.create,DZ=ca.create,RZ=Xr.create,Y_=Ut.create,CZ=Ut.strictCreate,UZ=vi.create,ZZ=dp.create,MZ=yi.create,LZ=Rr.create,VZ=pp.create,FZ=ua.create,qZ=la.create,BZ=mp.create,JZ=_i.create,HZ=$i.create,KZ=bi.create,GZ=xi.create,WZ=Pn.create,XZ=ir.create,YZ=nr.create,QZ=Cr.create,eM=ir.createWithPreprocess,tM=kc.create;var sr={};Nr(sr,{$ZodAny:()=>Eu,$ZodArray:()=>Cu,$ZodAsyncError:()=>It,$ZodBase64:()=>gu,$ZodBase64URL:()=>yu,$ZodBigInt:()=>Na,$ZodBigIntFormat:()=>Pu,$ZodBoolean:()=>qi,$ZodCIDRv4:()=>fu,$ZodCIDRv6:()=>mu,$ZodCUID:()=>iu,$ZodCUID2:()=>ou,$ZodCatch:()=>tl,$ZodCheck:()=>be,$ZodCheckBigIntFormat:()=>$m,$ZodCheckEndsWith:()=>Em,$ZodCheckGreaterThan:()=>Fc,$ZodCheckIncludes:()=>Om,$ZodCheckLengthEquals:()=>Im,$ZodCheckLessThan:()=>Vc,$ZodCheckLowerCase:()=>Pm,$ZodCheckMaxLength:()=>km,$ZodCheckMaxSize:()=>bm,$ZodCheckMimeType:()=>Dm,$ZodCheckMinLength:()=>Sm,$ZodCheckMinSize:()=>xm,$ZodCheckMultipleOf:()=>ym,$ZodCheckNumberFormat:()=>_m,$ZodCheckOverwrite:()=>Rm,$ZodCheckProperties:()=>Am,$ZodCheckProperty:()=>Nm,$ZodCheckRegex:()=>zm,$ZodCheckSizeEquals:()=>wm,$ZodCheckStartsWith:()=>jm,$ZodCheckStringFormat:()=>Vi,$ZodCheckUpperCase:()=>Tm,$ZodCodec:()=>Ji,$ZodCreditCard:()=>bu,$ZodCustom:()=>sl,$ZodCustomStringFormat:()=>Iu,$ZodCyclicError:()=>dl,$ZodDate:()=>Ru,$ZodDefault:()=>Xu,$ZodDiscriminatedUnion:()=>Mu,$ZodE164:()=>_u,$ZodEmail:()=>Xc,$ZodEmoji:()=>ru,$ZodEncodeError:()=>Qr,$ZodEnum:()=>Bu,$ZodError:()=>Ep,$ZodExactOptional:()=>Gu,$ZodFile:()=>Hu,$ZodFunction:()=>ol,$ZodGUID:()=>Gc,$ZodIBAN:()=>wu,$ZodIPv4:()=>uu,$ZodIPv6:()=>lu,$ZodISODate:()=>Vm,$ZodISODateTime:()=>Lm,$ZodISODuration:()=>qm,$ZodISOTime:()=>Fm,$ZodIntersection:()=>Lu,$ZodJWT:()=>Su,$ZodKSUID:()=>cu,$ZodLazy:()=>Hi,$ZodLiteral:()=>Ju,$ZodMAC:()=>du,$ZodMap:()=>Fu,$ZodNaN:()=>rl,$ZodNanoID:()=>nu,$ZodNever:()=>Au,$ZodNonOptional:()=>Qu,$ZodNull:()=>ju,$ZodNullable:()=>Wu,$ZodNumber:()=>Ea,$ZodNumberFormat:()=>zu,$ZodObject:()=>Uu,$ZodObjectJIT:()=>Jm,$ZodOptional:()=>Da,$ZodPipe:()=>Ra,$ZodPrefault:()=>Yu,$ZodPreprocess:()=>Km,$ZodPromise:()=>al,$ZodReadonly:()=>nl,$ZodRealError:()=>zt,$ZodRecord:()=>Vu,$ZodRegistry:()=>vl,$ZodSet:()=>qu,$ZodString:()=>en,$ZodStringFormat:()=>ge,$ZodSuccess:()=>el,$ZodSymbol:()=>Tu,$ZodTemplateLiteral:()=>il,$ZodTransform:()=>Ku,$ZodTuple:()=>Aa,$ZodType:()=>H,$ZodULID:()=>au,$ZodURL:()=>tu,$ZodUUID:()=>Wc,$ZodUndefined:()=>Ou,$ZodUnion:()=>Bi,$ZodUnknown:()=>Nu,$ZodVoid:()=>Du,$ZodXID:()=>su,$ZodXor:()=>Zu,$brand:()=>Tp,$constructor:()=>v,$input:()=>Ym,$output:()=>Xm,Doc:()=>Dn,INVALID:()=>ht,JSONSchema:()=>Ax,JSONSchemaGenerator:()=>ad,NEVER:()=>Pp,TimePrecision:()=>ah,URL_BAD_FORMAT:()=>Zm,URL_UNPARSEABLE:()=>za,ZodCompileAsyncError:()=>or,ZodCompileUnsupportedError:()=>oe,_any:()=>Zl,_array:()=>dh,_base64:()=>is,_base64url:()=>os,_bigint:()=>Nl,_boolean:()=>El,_catch:()=>fj,_check:()=>yx,_cidrv4:()=>rs,_cidrv6:()=>ns,_coercedBigint:()=>uh,_coercedBoolean:()=>ch,_coercedDate:()=>lh,_coercedNumber:()=>sh,_coercedString:()=>oh,_creditCard:()=>kl,_cuid:()=>Ga,_cuid2:()=>Wa,_custom:()=>Xl,_date:()=>Fl,_decode:()=>jc,_decodeAsync:()=>Nc,_default:()=>uj,_discriminatedUnion:()=>XO,_e164:()=>as,_email:()=>La,_emoji:()=>Ha,_encode:()=>Oc,_encodeAsync:()=>Ec,_endsWith:()=>io,_enum:()=>nj,_file:()=>Wl,_float32:()=>Pl,_float64:()=>Tl,_gt:()=>br,_gte:()=>Lt,_guid:()=>Va,_iban:()=>Sl,_includes:()=>ro,_int:()=>zl,_int32:()=>Ol,_int64:()=>Al,_intersection:()=>YO,_ipv4:()=>es,_ipv6:()=>ts,_isoDate:()=>us,_isoDateTime:()=>cs,_isoDuration:()=>ds,_isoTime:()=>ls,_jwt:()=>ss,_ksuid:()=>Qa,_lazy:()=>gj,_length:()=>Ln,_literal:()=>oj,_lowercase:()=>eo,_lt:()=>$r,_lte:()=>Mt,_mac:()=>wl,_map:()=>tj,_max:()=>Mt,_maxLength:()=>Mn,_maxSize:()=>nn,_mime:()=>ao,_min:()=>Lt,_minLength:()=>Lr,_minSize:()=>xr,_multipleOf:()=>rn,_nan:()=>ql,_nanoid:()=>Ka,_nativeEnum:()=>ij,_negative:()=>Jl,_never:()=>Ll,_nonnegative:()=>Kl,_nonoptional:()=>lj,_nonpositive:()=>Hl,_normalize:()=>so,_null:()=>Ul,_nullable:()=>cj,_number:()=>Il,_optional:()=>sj,_overwrite:()=>ar,_parse:()=>Ai,_parseAsync:()=>Di,_pipe:()=>pj,_positive:()=>Bl,_promise:()=>vj,_properties:()=>oo,_property:()=>Gl,_readonly:()=>mj,_record:()=>ej,_refine:()=>Yl,_regex:()=>Qi,_safeDecode:()=>Dc,_safeDecodeAsync:()=>Cc,_safeEncode:()=>Ac,_safeEncodeAsync:()=>Rc,_safeParse:()=>Ri,_safeParseAsync:()=>Ui,_set:()=>rj,_size:()=>Zn,_slugify:()=>fo,_startsWith:()=>no,_string:()=>xl,_stringFormat:()=>on,_stringbool:()=>rd,_success:()=>dj,_superRefine:()=>Ql,_symbol:()=>Rl,_templateLiteral:()=>hj,_toLowerCase:()=>uo,_toUpperCase:()=>lo,_transform:()=>aj,_trim:()=>co,_tuple:()=>QO,_uint32:()=>jl,_uint64:()=>Dl,_ulid:()=>Xa,_undefined:()=>Cl,_union:()=>GO,_unknown:()=>Ml,_uppercase:()=>to,_url:()=>Yi,_uuid:()=>Fa,_uuidv4:()=>qa,_uuidv6:()=>Ba,_uuidv7:()=>Ja,_void:()=>Vl,_xid:()=>Ya,_xor:()=>WO,base64Charset:()=>hu,base64urlCharset:()=>ja,canParseURL:()=>Mm,clone:()=>fe,compile:()=>rh,compileFn:()=>$l,config:()=>Ce,createStandardJSONSchemaMethod:()=>po,createToJSONSchemaMethod:()=>ph,decode:()=>_$,decodeAsync:()=>b$,describe:()=>ed,encode:()=>y$,encodeAsync:()=>$$,extractDefs:()=>sn,finalize:()=>cn,flattenError:()=>ba,formatError:()=>xa,getDiscriminatedOption:()=>Hm,globalConfig:()=>Be,globalRegistry:()=>Ge,handleUnrepresentable:()=>Ve,initializeContext:()=>an,isBackEdge:()=>pl,isRecursiveSchema:()=>fl,isValidBase64:()=>Oa,isValidBase64URL:()=>vu,isValidCIDRv6:()=>pu,isValidCreditCard:()=>$u,isValidIBAN:()=>xu,isValidIPv6:()=>Ta,isValidJWT:()=>ku,locales:()=>Wi,memoizer:()=>Za,mergeValues:()=>Fi,meta:()=>td,parse:()=>En,parseAsync:()=>Nn,parseURLObject:()=>B$,prettifyError:()=>Ap,process:()=>ye,processSchema:()=>ye,regexes:()=>Zt,registry:()=>yl,safeDecode:()=>w$,safeDecodeAsync:()=>S$,safeEncode:()=>x$,safeEncodeAsync:()=>k$,safeParse:()=>Ci,safeParseAsync:()=>Zi,standardProps:()=>Kc,stripTabAndNewline:()=>Pa,toDotPath:()=>g$,toJSONSchema:()=>Vn,toZod:()=>fa,treeifyError:()=>Np,urlHostnameOk:()=>Qc,urlProtocolOk:()=>eu,util:()=>x,validate:()=>Mi,validateAsync:()=>Li,validateURL:()=>Yc,version:()=>Cm,withParser:()=>_l});var x={};Nr(x,{BIGINT_FORMAT_RANGES:()=>ga,CONSTANT_CATCH:()=>Pc,Class:()=>vp,NUMBER_FORMAT_RANGES:()=>ha,aborted:()=>mt,allowsEval:()=>$p,assert:()=>PP,assertEqual:()=>kP,assertIs:()=>IP,assertNever:()=>zP,assertNotEqual:()=>SP,assignProp:()=>Ke,attachSchema:()=>va,base64ToUint8Array:()=>l$,base64urlToUint8Array:()=>MP,cached:()=>Ti,captureStackTrace:()=>Ic,cleanEnum:()=>ZP,cleanRegex:()=>Zr,clone:()=>fe,cloneDef:()=>jP,codePointLength:()=>jn,constantCatch:()=>Ip,createTransparentProxy:()=>CP,defineLazy:()=>yp,defineLazyInternal:()=>Q,derived:()=>qP,esc:()=>pt,escapeRegex:()=>Kt,explicitlyAborted:()=>wp,extend:()=>i$,finalizeIssue:()=>St,floatSafeRemainder:()=>pa,getElementAtPath:()=>EP,getEnumValues:()=>zi,getLengthableOrigin:()=>_a,getParsedType:()=>RP,getSizableOrigin:()=>ya,hexToUint8Array:()=>VP,hide:()=>$a,installLazyProp:()=>Sp,isObject:()=>On,isPlainObject:()=>Ht,issue:()=>Ni,joinValues:()=>y,jsonStringifyReplacer:()=>Pi,members:()=>kp,merge:()=>s$,mergeDefs:()=>Jt,normalizeParams:()=>z,nullish:()=>Sc,numKeys:()=>DP,objectClone:()=>TP,omit:()=>n$,optionalKeys:()=>xp,own:()=>_r,parsedType:()=>S,partial:()=>c$,pick:()=>r$,prefixIssues:()=>kt,primitiveTypes:()=>bp,promiseAllObject:()=>NP,propertyKeyTypes:()=>ma,randomString:()=>AP,rawShape:()=>Oi,required:()=>u$,safeExtend:()=>a$,shallowClone:()=>ji,sizeCaps:()=>Ei,slugify:()=>_p,stringifyPrimitive:()=>w,toZod:()=>fa,uint8ArrayToBase64:()=>d$,uint8ArrayToBase64url:()=>LP,uint8ArrayToHex:()=>FP,unwrapMessage:()=>Ii});function kP(e){return e}function SP(e){return e}function fa(){return e=>e}function IP(e){}function zP(e){throw new Error("Unexpected value in exhaustive check")}function PP(e){}function zi(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,r])=>t.indexOf(+i)===-1).map(([i,r])=>r)}function y(e,t="|"){return e.map(n=>w(n)).join(t)}function Pi(e,t){return typeof t=="bigint"?t.toString():t}var gp=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function Ti(e){return new gp(e)}function Sc(e){return e==null}function Zr(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function pa(e,t){let n=e/t,i=Math.round(n),r=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-i)<r?0:n-i}var Q_=Symbol("evaluating");function yp(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==Q_)return i===void 0&&(i=Q_,i=n()),i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function TP(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Ke(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Oi(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Ur(e){return Oi(e._zod.def)??e._zod.def.shape}function e$(e,t,n){Object.defineProperty(e,t,{get(){let i=n();return Ke(this,t,i),i},enumerable:!0,configurable:!0})}function t$(e,t,n){t in e?Ke(e,t,n):e[t]=n}function Tn(e,t,n,i){let r=Ur(t);for(let o of n){let a=Object.getOwnPropertyDescriptor(r,o);a.enumerable&&(a.get?e$(e,o,()=>{let s=t._zod.def.shape[o];return i?i(s,o):s}):t$(e,o,i?i(a.value,o):a.value))}}function OP(e,t){for(let n of Reflect.ownKeys(t)){let i=Object.getOwnPropertyDescriptor(t,n);i.enumerable&&(i.get?e$(e,n,()=>t[n]):t$(e,n,i.value))}}function Jt(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function jP(e){return Jt(e._zod.def)}function EP(e,t){return t?t.reduce((n,i)=>n?.[i],e):e}function NP(e){let t=Object.keys(e),n=t.map(i=>e[i]);return Promise.all(n).then(i=>{let r={};for(let o=0;o<t.length;o++)r[t[o]]=i[o];return r})}function AP(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let i=0;i<e;i++)n+=t[Math.floor(Math.random()*t.length)];return n}function pt(e){return JSON.stringify(e)}function _p(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ic="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function On(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var $p=Ti(()=>{if(Be.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Ht(e){if(On(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(On(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function ji(e){return Ht(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function DP(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var RP=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},ma=new Set(["string","number","symbol"]),bp=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Kt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fe(e,t,n){let i=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(i._zod.parent=e),i}function z(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function CP(e){let t;return new Proxy({},{get(n,i,r){return t??(t=e()),Reflect.get(t,i,r)},set(n,i,r,o){return t??(t=e()),Reflect.set(t,i,r,o)},has(n,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(n,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(n,i,r){return t??(t=e()),Reflect.defineProperty(t,i,r)}})}function w(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function xp(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var ha={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ga={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function r$(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o={};return Tn(o,e,zc(e,t)),fe(e,Jt(n,{shape:o,checks:[]}))}function zc(e,t){let n=Ur(e),i=[];for(let r of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,r)?.enumerable)throw new Error(`Unrecognized key: "${String(r)}"`);t[r]&&i.push(r)}return i}function n$(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=new Set(zc(e,t)),a={};return Tn(a,e,Reflect.ownKeys(Ur(e)).filter(s=>!o.has(s))),fe(e,Jt(n,{shape:a,checks:[]}))}function i$(e,t){if(!Ht(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let r=Ur(e);for(let o of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(r,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return fe(e,Jt(e._zod.def,{shape:o$(e,t)}))}function o$(e,t){let n={};return Tn(n,e,Reflect.ownKeys(Ur(e))),OP(n,t),n}function a$(e,t){if(!Ht(t))throw new Error("Invalid input to safeExtend: expected a plain object");return fe(e,Jt(e._zod.def,{shape:o$(e,t)}))}function s$(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};Tn(n,e,Reflect.ownKeys(Ur(e))),Tn(n,t,Reflect.ownKeys(Ur(t)));let i=Jt(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return fe(e,i)}function c$(e,t,n,i="partial"){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(`.${i}() cannot be used on object schemas containing refinements`);let s=n?new Set(zc(t,n)):void 0,c={};return Tn(c,t,Reflect.ownKeys(Ur(t)),e&&((u,l)=>s&&!s.has(l)?u:new e({type:"optional",innerType:u}))),fe(t,Jt(t._zod.def,{shape:c,checks:[]}))}function u$(e,t,n){let i=n?new Set(zc(t,n)):void 0,r={};return Tn(r,t,Reflect.ownKeys(Ur(t)),(o,a)=>i&&!i.has(a)?o:new e({type:"nonoptional",innerType:o})),fe(t,Jt(t._zod.def,{shape:r}))}function mt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function wp(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function kt(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function Ii(e){return typeof e=="string"?e:e?.message}function Ei(e){let t=[];for(let n of e??[]){let i=n._zod.def;if(!/_(length|size)$|_equals$/.test(i.check))break;let r=i.maximum??i.length??i.size;r>=0&&t.push([r,n])}return t}function va(e,t,n){var i;for(let r=t;r<e.length;r++)(i=e[r]).schema??(i.schema=n)}function St(e,t,n){var i;let r=e.inst?._zod?.traits;r?.has("$ZodType")&&(r.has("$ZodCheck")?(i=e).schema??(i.schema=e.inst):e.schema=e.inst);let o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,a=e.message?e.message:Ii(e.inst?._zod.def?.error?.(e))??Ii(o?.(e))??Ii(t?.error?.(e))??Ii(n.customError?.(e))??Ii(n.localeError?.(e))??"Invalid input",s={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(s[c]=e[c]);return s.path??(s.path=[]),s.message=a,t?.reportInput&&(s.input=e.input),s}function ya(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var UP=/[\uD800-\uDBFF]/;function jn(e){let t=e.length;if(!UP.test(e))return t;let n=t;for(let i=0;i<t-1;i++)(e.charCodeAt(i)&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320&&(n--,i++);return n}function _a(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function S(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Ni(...e){let[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}function ZP(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function l$(e){let t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}function d$(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function MP(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return l$(t+n)}function LP(e){return d$(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function VP(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)n[i/2]=Number.parseInt(t.slice(i,i+2),16);return n}function FP(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var vp=class{constructor(...t){}};function kp(e,t){for(let n in t){let i=Object.getOwnPropertyDescriptor(t,n);i.get?Object.defineProperty(e,n,{...i,enumerable:!1}):BP(e,n,i.value)}}function _r(e,t,n,i=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:i,value:n}),n}function $a(e,t,n){return _r(e,t,n,!1)}function qP(e,t){for(let n in e){let i=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return _r(this,n,i(this))},set(r){_r(this,n,r)}})}return t}function BP(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:_r(this,t,n.bind(this))},set(i){_r(this,t,i)}})}function JP(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var hp,Yr=!1,HP={configurable:!0,get(){Yr=!0}};function Q(e,t,n){let i=Object.getPrototypeOf(e._zod);if(t in i&&hp!==e._zod){hp=void 0;return}hp=e._zod,Object.defineProperty(i,t,{configurable:!0,get(){Object.defineProperty(this,t,HP);let r=Yr;Yr=!1;try{let o=n(this);return Yr?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o}),Yr=Yr||r,o}catch(o){throw delete this[t],Yr=Yr||r,o}},set(r){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r})}})}function Sp(e,t,n,i){let r=JP(e,t);r&&Object.defineProperty(r,t,{configurable:!0,get(){let o={configurable:!0,writable:!0,enumerable:i,value:void 0};return Object.defineProperty(this,t,o),o.value=n(this),Object.defineProperty(this,t,o),o.value},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:i,value:o})}})}var Pc="~constantCatch";function Ip(e){let t=()=>e;return t[Pc]=!0,t}var f$,Pp=Object.freeze({status:"aborted"}),zp={value:void 0,enumerable:!1},p$="captureStackTrace"in Error?Error:null;function KP(e){let t=p$;if(t){let n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return p$=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function v(e,t,n,i){let r={};function o(f){this.def=f,this.constr=d,this.traits=new Set}o.prototype=r;let a=n,s=a&&new WeakSet;function c(f,p){if(f._zod){if(f._zod.traits.has(e))return}else{zp.value=new o(p);try{Object.defineProperty(f,"_zod",zp)}finally{zp.value=void 0}}if(f._zod.traits.add(e),t(f,p),s){let h=Object.getPrototypeOf(f),g=f._zod.constr.prototype,_=h;for(;_&&_!==g;)_=Object.getPrototypeOf(_);let $=_??h;s.has($)||(s.add($),kp($,a))}let m=d.prototype;for(let h in m)Object.prototype.hasOwnProperty.call(m,h)&&(h in f||(f[h]=m[h].bind(f)))}let u=i?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function d(f){let p=i?.Parent?KP(l):this;c(p,f);let m=p._zod.deferred;if(m){for(let g of m)g();p._zod.deferred=void 0}let h=globalThis.__zod_globalConfig?.postProcessor;return h&&h(p),p}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:f=>i?.Parent&&f instanceof i.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Tp=Symbol("zod_brand"),It=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Qr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(f$=globalThis).__zod_globalConfig??(f$.__zod_globalConfig={});var Be=globalThis.__zod_globalConfig;function Ce(e){return e&&Object.assign(Be,e),Be}function GP(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Pi,2)),e.message}function WP(e){this._zod.message=e}var XP={get:GP,set:WP,enumerable:!0,configurable:!0},jp={value:void 0,enumerable:!1},m$=new WeakSet([Object.prototype,Error.prototype]),h$=(e,t)=>{e.name="$ZodError",jp.value=t,Object.defineProperty(e,"issues",jp),jp.value=void 0,Object.defineProperty(e,"message",XP);let n=Object.getPrototypeOf(e);m$.has(n)||(m$.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let i=()=>this.message;return Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0})}}))},Ep=v("$ZodError",h$),zt=v("$ZodError",h$,void 0,{Parent:Error});function YP(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function ba(e,t=n=>n.message){let n={},i=[];for(let r of e.issues)r.path.length>0?YP(n,r.path[0],()=>[]).push(t(r)):i.push(t(r));return{formErrors:i,fieldErrors:n}}function xa(e,t=n=>n.message){let n={_errors:[]},i=(r,o=[])=>{for(let a of r.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(s=>i({issues:s},[...o,...a.path]));else if(a.code==="invalid_key")i({issues:a.issues},[...o,...a.path]);else if(a.code==="invalid_element")i({issues:a.issues},[...o,...a.path]);else{let s=[...o,...a.path];if(s.length===0)n._errors.push(t(a));else{let c=n,u=0;for(;u<s.length;){let l=s[u],d=u===s.length-1;if(l==="_errors"){d&&c._errors.push(t(a)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let f=c[l];d&&f._errors.push(t(a)),c=f,u++}}}};return i(e),n}function Np(e,t=n=>n.message){let n={errors:[]},i=(r,o=[])=>{var a;for(let s of r.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(c=>i({issues:c},[...o,...s.path]));else if(s.code==="invalid_key")i({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")i({issues:s.issues},[...o,...s.path]);else{let c=[...o,...s.path];if(c.length===0){n.errors.push(t(s));continue}let u=n,l=0;for(;l<c.length;){let d=c[l],f=l===c.length-1;typeof d=="string"?(u.properties??(u.properties={}),Object.prototype.hasOwnProperty.call(u.properties,d)||Object.defineProperty(u.properties,d,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),u=u.properties[d]):(u.items??(u.items=[]),(a=u.items)[d]??(a[d]={errors:[]}),u=u.items[d]),f&&u.errors.push(t(s)),l++}}};return i(e),n}function g$(e){let t=[],n=e.map(i=>typeof i=="object"?i.key:i);for(let i of n)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}function Ap(e){let t=[],n=[...e.issues].sort((i,r)=>(i.path??[]).length-(r.path??[]).length);for(let i of n)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${g$(i.path)}`);return t.join(`
10
+ deps: ${n}}`};var wC={keyword:"dependencies",type:"object",schemaType:"object",error:zr.error,code(e){let[t,n]=kC(e);hI(e,t),gI(e,n)}};function kC({schema:e}){let t={},n={};for(let i in e){if(i==="__proto__")continue;let r=Array.isArray(e[i])?t:n;r[i]=e[i]}return[t,n]}function hI(e,t=e.schema){let{gen:n,data:i,it:r}=e;if(Object.keys(t).length===0)return;let o=n.let("missing");for(let a in t){let s=t[a];if(s.length===0)continue;let c=(0,fc.propertyInData)(n,i,a,r.opts.ownProperties);e.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),r.allErrors?n.if(c,()=>{for(let u of s)(0,fc.checkReportMissingProp)(e,u)}):(n.if((0,e_._)`${c} && (${(0,fc.checkMissingProp)(e,s,o)})`),(0,fc.reportMissingProp)(e,o),n.else())}}zr.validatePropertyDeps=hI;function gI(e,t=e.schema){let{gen:n,data:i,keyword:r,it:o}=e,a=n.name("valid");for(let s in t)(0,xC.alwaysValidSchema)(o,t[s])||(n.if((0,fc.propertyInData)(n,i,s,o.opts.ownProperties),()=>{let c=e.subschema({keyword:r,schemaProp:s},a);e.mergeValidEvaluated(c,a)},()=>n.var(a,!0)),e.ok(a))}zr.validateSchemaDeps=gI;zr.default=wC});var _I=N(t_=>{"use strict";Object.defineProperty(t_,"__esModule",{value:!0});var yI=te(),SC=le(),IC={message:"property name must be valid",params:({params:e})=>(0,yI._)`{propertyName: ${e.propertyName}}`},zC={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:IC,code(e){let{gen:t,schema:n,data:i,it:r}=e;if((0,SC.alwaysValidSchema)(r,n))return;let o=t.name("valid");t.forIn("key",i,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},o),t.if((0,yI.not)(o),()=>{e.error(!0),r.allErrors||t.break()})}),e.ok(o)}};t_.default=zC});var n_=N(r_=>{"use strict";Object.defineProperty(r_,"__esModule",{value:!0});var Mf=Yt(),pr=te(),PC=qr(),Lf=le(),TC={message:"must NOT have additional properties",params:({params:e})=>(0,pr._)`{additionalProperty: ${e.additionalProperty}}`},OC={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:TC,code(e){let{gen:t,schema:n,parentSchema:i,data:r,errsCount:o,it:a}=e;if(!o)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,Lf.alwaysValidSchema)(a,n))return;let u=(0,Mf.allSchemaProperties)(i.properties),l=(0,Mf.allSchemaProperties)(i.patternProperties);d(),e.ok((0,pr._)`${o} === ${PC.default.errors}`);function d(){t.forIn("key",r,g=>{!u.length&&!l.length?m(g):t.if(f(g),()=>m(g))})}function f(g){let _;if(u.length>8){let $=(0,Lf.schemaRefOrVal)(a,i.properties,"properties");_=(0,Mf.isOwnProperty)(t,$,g)}else u.length?_=(0,pr.or)(...u.map($=>(0,pr._)`${g} === ${$}`)):_=pr.nil;return l.length&&(_=(0,pr.or)(_,...l.map($=>(0,pr._)`${(0,Mf.usePattern)(e,$)}.test(${g})`))),(0,pr.not)(_)}function p(g){t.code((0,pr._)`delete ${r}[${g}]`)}function m(g){if(c.removeAdditional==="all"||c.removeAdditional&&n===!1){p(g);return}if(n===!1){e.setParams({additionalProperty:g}),e.error(),s||t.break();return}if(typeof n=="object"&&!(0,Lf.alwaysValidSchema)(a,n)){let _=t.name("valid");c.removeAdditional==="failing"?(h(g,_,!1),t.if((0,pr.not)(_),()=>{e.reset(),p(g)})):(h(g,_),s||t.if((0,pr.not)(_),()=>t.break()))}}function h(g,_,$){let k={keyword:"additionalProperties",dataProp:g,dataPropType:Lf.Type.Str};$===!1&&Object.assign(k,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(k,_)}}};r_.default=OC});var xI=N(o_=>{"use strict";Object.defineProperty(o_,"__esModule",{value:!0});var jC=Xs(),$I=Yt(),i_=le(),bI=n_(),EC={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,parentSchema:i,data:r,it:o}=e;o.opts.removeAdditional==="all"&&i.additionalProperties===void 0&&bI.default.code(new jC.KeywordCxt(o,bI.default,"additionalProperties"));let a=(0,$I.allSchemaProperties)(n);for(let d of a)o.definedProperties.add(d);o.opts.unevaluated&&a.length&&o.props!==!0&&(o.props=i_.mergeEvaluated.props(t,(0,i_.toHash)(a),o.props));let s=a.filter(d=>!(0,i_.alwaysValidSchema)(o,n[d]));if(s.length===0)return;let c=t.name("valid");for(let d of s)u(d)?l(d):(t.if((0,$I.propertyInData)(t,r,d,o.opts.ownProperties)),l(d),o.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return o.opts.useDefaults&&!o.compositeRule&&n[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};o_.default=EC});var II=N(a_=>{"use strict";Object.defineProperty(a_,"__esModule",{value:!0});var wI=Yt(),Vf=te(),kI=le(),SI=le(),NC={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,data:i,parentSchema:r,it:o}=e,{opts:a}=o,s=(0,wI.allSchemaProperties)(n),c=s.filter(h=>(0,kI.alwaysValidSchema)(o,n[h]));if(s.length===0||c.length===s.length&&(!o.opts.unevaluated||o.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&r.properties,l=t.name("valid");o.props!==!0&&!(o.props instanceof Vf.Name)&&(o.props=(0,SI.evaluatedPropsToName)(t,o.props));let{props:d}=o;f();function f(){for(let h of s)u&&p(h),o.allErrors?m(h):(t.var(l,!0),m(h),t.if(l))}function p(h){for(let g in u)new RegExp(h).test(g)&&(0,kI.checkStrictMode)(o,`property ${g} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){t.forIn("key",i,g=>{t.if((0,Vf._)`${(0,wI.usePattern)(e,h)}.test(${g})`,()=>{let _=c.includes(h);_||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:g,dataPropType:SI.Type.Str},l),o.opts.unevaluated&&d!==!0?t.assign((0,Vf._)`${d}[${g}]`,!0):!_&&!o.allErrors&&t.if((0,Vf.not)(l),()=>t.break())})})}}};a_.default=NC});var zI=N(s_=>{"use strict";Object.defineProperty(s_,"__esModule",{value:!0});var AC=le(),DC={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:n,it:i}=e;if((0,AC.alwaysValidSchema)(i,n)){e.fail();return}let r=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},r),e.failResult(r,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};s_.default=DC});var PI=N(c_=>{"use strict";Object.defineProperty(c_,"__esModule",{value:!0});var RC=Yt(),CC={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:RC.validateUnion,error:{message:"must match a schema in anyOf"}};c_.default=CC});var TI=N(u_=>{"use strict";Object.defineProperty(u_,"__esModule",{value:!0});var Ff=te(),UC=le(),ZC={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Ff._)`{passingSchemas: ${e.passing}}`},MC={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:ZC,code(e){let{gen:t,schema:n,parentSchema:i,it:r}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");if(r.opts.discriminator&&i.discriminator)return;let o=n,a=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(!0));function u(){o.forEach((l,d)=>{let f;(0,UC.alwaysValidSchema)(r,l)?t.var(c,!0):f=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,Ff._)`${c} && ${a}`).assign(a,!1).assign(s,(0,Ff._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),f&&e.mergeEvaluated(f,Ff.Name)})})}}};u_.default=MC});var OI=N(l_=>{"use strict";Object.defineProperty(l_,"__esModule",{value:!0});var LC=le(),VC={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:n,it:i}=e;if(!Array.isArray(n))throw new Error("ajv implementation error");let r=t.name("valid");n.forEach((o,a)=>{if((0,LC.alwaysValidSchema)(i,o))return;let s=e.subschema({keyword:"allOf",schemaProp:a},r);e.ok(r),e.mergeEvaluated(s)})}};l_.default=VC});var NI=N(d_=>{"use strict";Object.defineProperty(d_,"__esModule",{value:!0});var qf=te(),EI=le(),FC={message:({params:e})=>(0,qf.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,qf._)`{failingKeyword: ${e.ifClause}}`},qC={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:FC,code(e){let{gen:t,parentSchema:n,it:i}=e;n.then===void 0&&n.else===void 0&&(0,EI.checkStrictMode)(i,'"if" without "then" and "else" is ignored');let r=jI(i,"then"),o=jI(i,"else");if(!r&&!o)return;let a=t.let("valid",!0),s=t.name("_valid");if(c(),e.reset(),r&&o){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,u("then",l),u("else",l))}else r?t.if(s,u("then")):t.if((0,qf.not)(s),u("else"));e.pass(a,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(l)}function u(l,d){return()=>{let f=e.subschema({keyword:l},s);t.assign(a,s),e.mergeValidEvaluated(f,a),d?t.assign(d,(0,qf._)`${l}`):e.setParams({ifClause:l})}}}};function jI(e,t){let n=e.schema[t];return n!==void 0&&!(0,EI.alwaysValidSchema)(e,n)}d_.default=qC});var AI=N(f_=>{"use strict";Object.defineProperty(f_,"__esModule",{value:!0});var BC=le(),JC={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){t.if===void 0&&(0,BC.checkStrictMode)(n,`"${e}" without "if" is ignored`)}};f_.default=JC});var DI=N(p_=>{"use strict";Object.defineProperty(p_,"__esModule",{value:!0});var HC=Gy(),KC=dI(),GC=Wy(),WC=pI(),XC=mI(),YC=vI(),QC=_I(),e6=n_(),t6=xI(),r6=II(),n6=zI(),i6=PI(),o6=TI(),a6=OI(),s6=NI(),c6=AI();function u6(e=!1){let t=[n6.default,i6.default,o6.default,a6.default,s6.default,c6.default,QC.default,e6.default,YC.default,t6.default,r6.default];return e?t.push(KC.default,WC.default):t.push(HC.default,GC.default),t.push(XC.default),t}p_.default=u6});var RI=N(m_=>{"use strict";Object.defineProperty(m_,"__esModule",{value:!0});var Le=te(),l6={message:({schemaCode:e})=>(0,Le.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,Le._)`{format: ${e}}`},d6={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:l6,code(e,t){let{gen:n,data:i,$data:r,schema:o,schemaCode:a,it:s}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;r?f():p();function f(){let m=n.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=n.const("fDef",(0,Le._)`${m}[${a}]`),g=n.let("fType"),_=n.let("format");n.if((0,Le._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>n.assign(g,(0,Le._)`${h}.type || "string"`).assign(_,(0,Le._)`${h}.validate`),()=>n.assign(g,(0,Le._)`"string"`).assign(_,h)),e.fail$data((0,Le.or)($(),k()));function $(){return c.strictSchema===!1?Le.nil:(0,Le._)`${a} && !${_}`}function k(){let O=l.$async?(0,Le._)`(${h}.async ? await ${_}(${i}) : ${_}(${i}))`:(0,Le._)`${_}(${i})`,T=(0,Le._)`(typeof ${_} == "function" ? ${O} : ${_}.test(${i}))`;return(0,Le._)`${_} && ${_} !== true && ${g} === ${t} && !${T}`}}function p(){let m=d.formats[o];if(!m){$();return}if(m===!0)return;let[h,g,_]=k(m);h===t&&e.pass(O());function $(){if(c.strictSchema===!1){d.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function k(T){let C=T instanceof RegExp?(0,Le.regexpCode)(T):c.code.formats?(0,Le._)`${c.code.formats}${(0,Le.getProperty)(o)}`:void 0,J=n.scopeValue("formats",{key:o,ref:T,code:C});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,Le._)`${J}.validate`]:["string",T,J]}function O(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,Le._)`await ${_}(${i})`}return typeof g=="function"?(0,Le._)`${_}(${i})`:(0,Le._)`${_}.test(${i})`}}}};m_.default=d6});var CI=N(h_=>{"use strict";Object.defineProperty(h_,"__esModule",{value:!0});var f6=RI(),p6=[f6.default];h_.default=p6});var UI=N(Vo=>{"use strict";Object.defineProperty(Vo,"__esModule",{value:!0});Vo.contentVocabulary=Vo.metadataVocabulary=void 0;Vo.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Vo.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var MI=N(g_=>{"use strict";Object.defineProperty(g_,"__esModule",{value:!0});var m6=HS(),h6=sI(),g6=DI(),v6=CI(),ZI=UI(),y6=[m6.default,h6.default,(0,g6.default)(),v6.default,ZI.metadataVocabulary,ZI.contentVocabulary];g_.default=y6});var VI=N(Bf=>{"use strict";Object.defineProperty(Bf,"__esModule",{value:!0});Bf.DiscrError=void 0;var LI;(function(e){e.Tag="tag",e.Mapping="mapping"})(LI||(Bf.DiscrError=LI={}))});var qI=N(y_=>{"use strict";Object.defineProperty(y_,"__esModule",{value:!0});var Fo=te(),v_=VI(),FI=kf(),_6=Ys(),$6=le(),b6={message:({params:{discrError:e,tagName:t}})=>e===v_.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>(0,Fo._)`{error: ${e}, tag: ${n}, tagValue: ${t}}`},x6={keyword:"discriminator",type:"object",schemaType:"object",error:b6,code(e){let{gen:t,data:n,schema:i,parentSchema:r,it:o}=e,{oneOf:a}=r;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=i.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(i.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,Fo._)`${n}${(0,Fo.getProperty)(s)}`);t.if((0,Fo._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:v_.DiscrError.Tag,tag:u,tagName:s})),e.ok(c);function l(){let p=f();t.if(!1);for(let m in p)t.elseIf((0,Fo._)`${u} === ${m}`),t.assign(c,d(p[m]));t.else(),e.error(!1,{discrError:v_.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function d(p){let m=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:p},m);return e.mergeEvaluated(h,Fo.Name),m}function f(){var p;let m={},h=_(r),g=!0;for(let O=0;O<a.length;O++){let T=a[O];if(T?.$ref&&!(0,$6.schemaHasRulesButRef)(T,o.self.RULES)){let J=T.$ref;if(T=FI.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,J),T instanceof FI.SchemaEnv&&(T=T.schema),T===void 0)throw new _6.default(o.opts.uriResolver,o.baseId,J)}let C=(p=T?.properties)===null||p===void 0?void 0:p[s];if(typeof C!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);g=g&&(h||_(T)),$(C,O)}if(!g)throw new Error(`discriminator: "${s}" must be required`);return m;function _({required:O}){return Array.isArray(O)&&O.includes(s)}function $(O,T){if(O.const)k(O.const,T);else if(O.enum)for(let C of O.enum)k(C,T);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function k(O,T){if(typeof O!="string"||O in m)throw new Error(`discriminator: "${s}" values must be unique strings`);m[O]=T}}}};y_.default=x6});var BI=N((k5,w6)=>{w6.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var $_=N((je,__)=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.MissingRefError=je.ValidationError=je.CodeGen=je.Name=je.nil=je.stringify=je.str=je._=je.KeywordCxt=je.Ajv=void 0;var k6=LS(),S6=MI(),I6=qI(),JI=BI(),z6=["/properties"],Jf="http://json-schema.org/draft-07/schema",qo=class extends k6.default{_addVocabularies(){super._addVocabularies(),S6.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(I6.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(JI,z6):JI;this.addMetaSchema(t,Jf,!1),this.refs["http://json-schema.org/schema"]=Jf}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Jf)?Jf:void 0)}};je.Ajv=qo;__.exports=je=qo;__.exports.Ajv=qo;Object.defineProperty(je,"__esModule",{value:!0});je.default=qo;var P6=Xs();Object.defineProperty(je,"KeywordCxt",{enumerable:!0,get:function(){return P6.KeywordCxt}});var Bo=te();Object.defineProperty(je,"_",{enumerable:!0,get:function(){return Bo._}});Object.defineProperty(je,"str",{enumerable:!0,get:function(){return Bo.str}});Object.defineProperty(je,"stringify",{enumerable:!0,get:function(){return Bo.stringify}});Object.defineProperty(je,"nil",{enumerable:!0,get:function(){return Bo.nil}});Object.defineProperty(je,"Name",{enumerable:!0,get:function(){return Bo.Name}});Object.defineProperty(je,"CodeGen",{enumerable:!0,get:function(){return Bo.CodeGen}});var T6=xf();Object.defineProperty(je,"ValidationError",{enumerable:!0,get:function(){return T6.default}});var O6=Ys();Object.defineProperty(je,"MissingRefError",{enumerable:!0,get:function(){return O6.default}})});var ez=N(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.formatNames=Tr.fastFormats=Tr.fullFormats=void 0;function Pr(e,t){return{validate:e,compare:t}}Tr.fullFormats={date:Pr(WI,k_),time:Pr(x_(!0),S_),"date-time":Pr(HI(!0),YI),"iso-time":Pr(x_(),XI),"iso-date-time":Pr(HI(),QI),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:R6,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:F6,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:C6,int32:{type:"number",validate:M6},int64:{type:"number",validate:L6},float:{type:"number",validate:GI},double:{type:"number",validate:GI},password:!0,binary:!0};Tr.fastFormats={...Tr.fullFormats,date:Pr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,k_),time:Pr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,S_),"date-time":Pr(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,YI),"iso-time":Pr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,XI),"iso-date-time":Pr(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,QI),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Tr.formatNames=Object.keys(Tr.fullFormats);function j6(e){return e%4===0&&(e%100!==0||e%400===0)}var E6=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,N6=[0,31,28,31,30,31,30,31,31,30,31,30,31];function WI(e){let t=E6.exec(e);if(!t)return!1;let n=+t[1],i=+t[2],r=+t[3];return i>=1&&i<=12&&r>=1&&r<=(i===2&&j6(n)?29:N6[i])}function k_(e,t){if(e&&t)return e>t?1:e<t?-1:0}var b_=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function x_(e){return function(n){let i=b_.exec(n);if(!i)return!1;let r=+i[1],o=+i[2],a=+i[3],s=i[4],c=i[5]==="-"?-1:1,u=+(i[6]||0),l=+(i[7]||0);if(u>23||l>59||e&&!s)return!1;if(r<=23&&o<=59&&a<60)return!0;let d=o-l*c,f=r-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function S_(e,t){if(!(e&&t))return;let n=new Date("2020-01-01T"+e).valueOf(),i=new Date("2020-01-01T"+t).valueOf();if(n&&i)return n-i}function XI(e,t){if(!(e&&t))return;let n=b_.exec(e),i=b_.exec(t);if(n&&i)return e=n[1]+n[2]+n[3],t=i[1]+i[2]+i[3],e>t?1:e<t?-1:0}var w_=/t|\s/i;function HI(e){let t=x_(e);return function(i){let r=i.split(w_);return r.length===2&&WI(r[0])&&t(r[1])}}function YI(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),i=new Date(t).valueOf();if(n&&i)return n-i}function QI(e,t){if(!(e&&t))return;let[n,i]=e.split(w_),[r,o]=t.split(w_),a=k_(n,r);if(a!==void 0)return a||S_(i,o)}var A6=/\/|:/,D6=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function R6(e){return A6.test(e)&&D6.test(e)}var KI=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function C6(e){return KI.lastIndex=0,KI.test(e)}var U6=-(2**31),Z6=2**31-1;function M6(e){return Number.isInteger(e)&&e<=Z6&&e>=U6}function L6(e){return Number.isInteger(e)}function GI(){return!0}var V6=/[^\\]\\Z/;function F6(e){if(V6.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var tz=N(Jo=>{"use strict";Object.defineProperty(Jo,"__esModule",{value:!0});Jo.formatLimitDefinition=void 0;var q6=$_(),mr=te(),kn=mr.operators,Hf={formatMaximum:{okStr:"<=",ok:kn.LTE,fail:kn.GT},formatMinimum:{okStr:">=",ok:kn.GTE,fail:kn.LT},formatExclusiveMaximum:{okStr:"<",ok:kn.LT,fail:kn.GTE},formatExclusiveMinimum:{okStr:">",ok:kn.GT,fail:kn.LTE}},B6={message:({keyword:e,schemaCode:t})=>(0,mr.str)`should be ${Hf[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,mr._)`{comparison: ${Hf[e].okStr}, limit: ${t}}`};Jo.formatLimitDefinition={keyword:Object.keys(Hf),type:"string",schemaType:"string",$data:!0,error:B6,code(e){let{gen:t,data:n,schemaCode:i,keyword:r,it:o}=e,{opts:a,self:s}=o;if(!a.validateFormats)return;let c=new q6.KeywordCxt(o,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let f=t.scopeValue("formats",{ref:s.formats,code:a.code.formats}),p=t.const("fmt",(0,mr._)`${f}[${c.schemaCode}]`);e.fail$data((0,mr.or)((0,mr._)`typeof ${p} != "object"`,(0,mr._)`${p} instanceof RegExp`,(0,mr._)`typeof ${p}.compare != "function"`,d(p)))}function l(){let f=c.schema,p=s.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${r}": format "${f}" does not define "compare" function`);let m=t.scopeValue("formats",{key:f,ref:p,code:a.code.formats?(0,mr._)`${a.code.formats}${(0,mr.getProperty)(f)}`:void 0});e.fail$data(d(m))}function d(f){return(0,mr._)`${f}.compare(${n}, ${i}) ${Hf[r].fail} 0`}},dependencies:["format"]};var J6=e=>(e.addKeyword(Jo.formatLimitDefinition),e);Jo.default=J6});var oz=N((pc,iz)=>{"use strict";Object.defineProperty(pc,"__esModule",{value:!0});var Ho=ez(),H6=tz(),I_=te(),rz=new I_.Name("fullFormats"),K6=new I_.Name("fastFormats"),z_=(e,t={keywords:!0})=>{if(Array.isArray(t))return nz(e,t,Ho.fullFormats,rz),e;let[n,i]=t.mode==="fast"?[Ho.fastFormats,K6]:[Ho.fullFormats,rz],r=t.formats||Ho.formatNames;return nz(e,r,n,i),t.keywords&&(0,H6.default)(e),e};z_.get=(e,t="full")=>{let i=(t==="fast"?Ho.fastFormats:Ho.fullFormats)[e];if(!i)throw new Error(`Unknown format "${e}"`);return i};function nz(e,t,n,i){var r,o;(r=(o=e.opts.code).formats)!==null&&r!==void 0||(o.formats=(0,I_._)`require("ajv-formats/dist/formats").${i}`);for(let a of t)e.addFormat(a,n[a])}iz.exports=pc=z_;Object.defineProperty(pc,"__esModule",{value:!0});pc.default=z_});import{parseArgs as QU}from"node:util";var di="0.1.1",Qz="https://api.heylatch.app",$e=class extends Error{constructor(n,i,r=0,o={}){super(i);this.code=n;this.status=r;this.params=o}code;status;params},li=class{key;baseUrl;fetcher;constructor({key:t=process.env.LATCH_API_KEY,baseUrl:n=process.env.LATCH_API_URL??Qz,fetch:i=fetch}={}){if(!t)throw new $e("noApiKey","No API key. Set LATCH_API_KEY to a key from your workspace's API page on heylatch.app.");if(!t.startsWith("ltk_"))throw new $e("noApiKey","LATCH_API_KEY doesn't look like a Latch API key (it should start with ltk_).");this.key=t,this.baseUrl=n.replace(/\/+$/,""),this.fetcher=i}async request(t,n,i){let r;try{r=await this.fetcher(`${this.baseUrl}/public/v1${n}`,{method:t,headers:{authorization:`Bearer ${this.key}`,"user-agent":`latch-cli/${di}`,...i!==void 0?{"content-type":"application/json"}:{}},body:i!==void 0?JSON.stringify(i):void 0})}catch(a){throw new $e("network",`Couldn't reach ${this.baseUrl}: ${a.message}`)}let o=await r.json().catch(()=>null);if(!r.ok){let a=o?.error;throw new $e(a?.code??"generic",a?.message??`Request failed (${r.status}).`,r.status,a?.params??{})}return o}async upload(t,n){let i=await this.fetcher(t,{method:"PUT",headers:{"content-type":"application/zip"},body:n});if(!i.ok)throw new $e("uploadFailed",`Uploading the package failed (${i.status}). The upload link may have expired; try again.`,i.status)}workspace=()=>this.request("GET","/workspace");listScripts=()=>this.request("GET","/scripts").then(t=>t.data);getScript=t=>this.request("GET",`/scripts/${dt(t)}`);createScript=t=>this.request("POST","/scripts",t);createVersion=(t,n)=>this.request("POST",`/scripts/${dt(t)}/versions`,n);getVersion=(t,n)=>this.request("GET",`/scripts/${dt(t)}/versions/${dt(n)}`);publishVersion=(t,n)=>this.request("POST",`/scripts/${dt(t)}/versions/${dt(n)}/publish`);withdrawVersion=(t,n)=>this.request("POST",`/scripts/${dt(t)}/versions/${dt(n)}/withdraw`);listGrants=(t,n={})=>this.request("GET",`/scripts/${dt(t)}/grants${sp(n)}`);grant=(t,n)=>this.request("POST",`/scripts/${dt(t)}/grants`,{accountId:n});grantBulk=(t,n)=>this.request("POST",`/scripts/${dt(t)}/grants/bulk`,{accountIds:n});revoke=(t,n)=>this.request("POST",`/scripts/${dt(t)}/grants/revoke`,{accountId:n});listActivations=(t,n={})=>this.request("GET",`/scripts/${dt(t)}/activations${sp(n)}`);listFlags=(t,n={})=>this.request("GET",`/scripts/${dt(t)}/flags${sp(n)}`);resolveFlag=t=>this.request("POST",`/flags/${dt(t)}/resolve`)},dt=encodeURIComponent;function sp(e){let t=Object.entries(e).filter(([,n])=>n!=null&&n!=="");return t.length?`?${new URLSearchParams(t.map(([n,i])=>[n,String(i)]))}`:""}var se;(function(e){e.assertEqual=r=>{};function t(r){}e.assertIs=t;function n(r){throw new Error}e.assertNever=n,e.arrayToEnum=r=>{let o={};for(let a of r)o[a]=a;return o},e.getValidEnumValues=r=>{let o=e.objectKeys(r).filter(s=>typeof r[r[s]]!="number"),a={};for(let s of o)a[s]=r[s];return e.objectValues(a)},e.objectValues=r=>e.objectKeys(r).map(function(o){return r[o]}),e.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let o=[];for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&o.push(a);return o},e.find=(r,o)=>{for(let a of r)if(o(a))return a},e.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function i(r,o=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=i,e.jsonStringifyReplacer=(r,o)=>typeof o=="bigint"?o.toString():o})(se||(se={}));var H_;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(H_||(H_={}));var D=se.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ar=e=>{switch(typeof e){case"undefined":return D.undefined;case"string":return D.string;case"number":return Number.isNaN(e)?D.nan:D.number;case"boolean":return D.boolean;case"function":return D.function;case"bigint":return D.bigint;case"symbol":return D.symbol;case"object":return Array.isArray(e)?D.array:e===null?D.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?D.promise:typeof Map<"u"&&e instanceof Map?D.map:typeof Set<"u"&&e instanceof Set?D.set:typeof Date<"u"&&e instanceof Date?D.date:D.object;default:return D.unknown}};var I=se.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 Ct=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(o){return o.message},i={_errors:[]},r=o=>{for(let a of o.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)i._errors.push(n(a));else{let s=i,c=0;for(;c<a.path.length;){let u=a.path[c],l=c===a.path.length-1;if(u==="_errors"){l&&s._errors.push(n(a)),c++;continue}Object.prototype.hasOwnProperty.call(s,u)||(u==="__proto__"?Object.defineProperty(s,u,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):s[u]={_errors:[]}),s=s[u],l&&s._errors.push(n(a)),c++}}};return r(this),i}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,se.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n=Object.create(null),i=[];for(let r of this.issues)if(r.path.length>0){let o=r.path[0];n[o]=n[o]||[],n[o].push(t(r))}else i.push(t(r));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}};Ct.create=e=>new Ct(e);var eP=(e,t)=>{let n;switch(e.code){case I.invalid_type:e.received===D.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case I.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,se.jsonStringifyReplacer)}`;break;case I.unrecognized_keys:n=`Unrecognized key(s) in object: ${se.joinValues(e.keys,", ")}`;break;case I.invalid_union:n="Invalid input";break;case I.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${se.joinValues(e.options)}`;break;case I.invalid_enum_value:n=`Invalid enum value. Expected ${se.joinValues(e.options)}, received '${e.received}'`;break;case I.invalid_arguments:n="Invalid function arguments";break;case I.invalid_return_type:n="Invalid function return type";break;case I.invalid_date:n="Invalid date";break;case I.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:se.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case I.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case I.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case I.custom:n="Invalid input";break;case I.invalid_intersection_types:n="Intersection results could not be merged";break;case I.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case I.not_finite:n="Number must be finite";break;default:n=t.defaultError,se.assertNever(e)}return{message:n}},Gr=eP;var tP=Gr;function ea(){return tP}var xc=e=>{let{data:t,path:n,errorMaps:i,issueData:r}=e,o=[...n,...r.path||[]],a={...r,path:o};if(r.message!==void 0)return{...r,path:o,message:r.message};let s="",c=i.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:t,defaultError:s}).message;return{...r,path:o,message:s}};function j(e,t){let n=ea(),i=xc({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Gr?void 0:Gr].filter(r=>!!r)});e.common.issues.push(i)}var nt=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let i=[];for(let r of n){if(r.status==="aborted")return F;r.status==="dirty"&&t.dirty(),i.push(r.value)}return{status:t.value,value:i}}static async mergeObjectAsync(t,n){let i=[];for(let r of n){let o=await r.key,a=await r.value;i.push({key:o,value:a})}return e.mergeObjectSync(t,i)}static mergeObjectSync(t,n){let i={};for(let r of n){let{key:o,value:a}=r;if(o.status==="aborted"||a.status==="aborted")return F;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||r.alwaysSet)&&(i[o.value]=a.value)}return{status:t.value,value:i}}},F=Object.freeze({status:"aborted"}),fi=e=>({status:"dirty",value:e}),ft=e=>({status:"valid",value:e}),cp=e=>e.status==="aborted",up=e=>e.status==="dirty",zn=e=>e.status==="valid",ta=e=>typeof Promise<"u"&&e instanceof Promise;var U;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(U||(U={}));var Bt=class{constructor(t,n,i,r){this._cachedPath=[],this.parent=t,this.data=n,this._path=i,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}},K_=(e,t)=>{if(zn(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new Ct(e.common.issues);return this._error=n,this._error}}};function X(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:i,description:r}=e;if(t&&(n||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:r}:{errorMap:(a,s)=>{let{message:c}=e;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??i??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??n??s.defaultError}},description:r}}var re=class{get description(){return this._def.description}_getType(t){return Ar(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Ar(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new nt,ctx:{common:t.parent.common,data:t.data,parsedType:Ar(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(ta(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let i=this.safeParse(t,n);if(i.success)return i.data;throw i.error}safeParse(t,n){let i={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ar(t)},r=this._parseSync({data:t,path:i.path,parent:i});return K_(i,r)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ar(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:n});return zn(i)?{value:i.value}:{issues:n.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>zn(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(t,n){let i=await this.safeParseAsync(t,n);if(i.success)return i.data;throw i.error}async safeParseAsync(t,n){let i={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ar(t)},r=this._parse({data:t,path:i.path,parent:i}),o=await(ta(r)?r:Promise.resolve(r));return K_(i,o)}refine(t,n){let i=r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,o)=>{let a=t(r),s=()=>o.addIssue({code:I.custom,...i(r)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,n){return this._refinement((i,r)=>t(i)?!0:(r.addIssue(typeof n=="function"?n(i,r):n),!1))}_refinement(t){return new ir({schema:this,typeName:P.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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:n=>this["~validate"](n)}}optional(){return nr.create(this,this._def)}nullable(){return Cr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Xr.create(this)}promise(){return Pn.create(this,this._def)}or(t){return vi.create([this,t],this._def)}and(t){return yi.create(this,t,this._def)}transform(t){return new ir({...X(this._def),schema:this,typeName:P.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new wi({...X(this._def),innerType:this,defaultValue:n,typeName:P.ZodDefault})}brand(){return new wc({typeName:P.ZodBranded,type:this,...X(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new ki({...X(this._def),innerType:this,catchValue:n,typeName:P.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return kc.create(this,t)}readonly(){return Si.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},rP=/^c[^\s-]{8,}$/i,nP=/^[0-9a-z]+$/,iP=/^[0-9A-HJKMNP-TV-Z]{26}$/i,oP=/^[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,aP=/^[a-z0-9_-]{21}$/i,sP=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,cP=/^[-+]?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)?)??$/,uP=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,lP="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",lp,dP=/^(?:(?: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])$/,fP=/^(?:(?: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])$/,pP=/^(([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]))$/,mP=/^(([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])$/,hP=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,gP=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,G_="((\\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])))",vP=new RegExp(`^${G_}$`);function W_(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function yP(e){return new RegExp(`^${W_(e)}$`)}function _P(e){let t=`${G_}T${W_(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function $P(e,t){return!!((t==="v4"||!t)&&dP.test(e)||(t==="v6"||!t)&&pP.test(e))}function bP(e,t){if(!sP.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let i=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(i));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||t&&r.alg!==t)}catch{return!1}}function xP(e,t){return!!((t==="v4"||!t)&&fP.test(e)||(t==="v6"||!t)&&mP.test(e))}var mi=class e extends re{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==D.string){let o=this._getOrReturnCtx(t);return j(o,{code:I.invalid_type,expected:D.string,received:o.parsedType}),F}let i=new nt,r;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(r=this._getOrReturnCtx(t,r),j(r,{code:I.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="max")t.data.length>o.value&&(r=this._getOrReturnCtx(t,r),j(r,{code:I.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="length"){let a=t.data.length>o.value,s=t.data.length<o.value;(a||s)&&(r=this._getOrReturnCtx(t,r),a?j(r,{code:I.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):s&&j(r,{code:I.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),i.dirty())}else if(o.kind==="email")uP.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"email",code:I.invalid_string,message:o.message}),i.dirty());else if(o.kind==="emoji")lp||(lp=new RegExp(lP,"u")),lp.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"emoji",code:I.invalid_string,message:o.message}),i.dirty());else if(o.kind==="uuid")oP.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"uuid",code:I.invalid_string,message:o.message}),i.dirty());else if(o.kind==="nanoid")aP.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"nanoid",code:I.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid")rP.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"cuid",code:I.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid2")nP.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"cuid2",code:I.invalid_string,message:o.message}),i.dirty());else if(o.kind==="ulid")iP.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"ulid",code:I.invalid_string,message:o.message}),i.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{r=this._getOrReturnCtx(t,r),j(r,{validation:"url",code:I.invalid_string,message:o.message}),i.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"regex",code:I.invalid_string,message:o.message}),i.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(r=this._getOrReturnCtx(t,r),j(r,{code:I.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),i.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(r=this._getOrReturnCtx(t,r),j(r,{code:I.invalid_string,validation:{startsWith:o.value},message:o.message}),i.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(r=this._getOrReturnCtx(t,r),j(r,{code:I.invalid_string,validation:{endsWith:o.value},message:o.message}),i.dirty()):o.kind==="datetime"?_P(o).test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{code:I.invalid_string,validation:"datetime",message:o.message}),i.dirty()):o.kind==="date"?vP.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{code:I.invalid_string,validation:"date",message:o.message}),i.dirty()):o.kind==="time"?yP(o).test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{code:I.invalid_string,validation:"time",message:o.message}),i.dirty()):o.kind==="duration"?cP.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"duration",code:I.invalid_string,message:o.message}),i.dirty()):o.kind==="ip"?$P(t.data,o.version)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"ip",code:I.invalid_string,message:o.message}),i.dirty()):o.kind==="jwt"?bP(t.data,o.alg)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"jwt",code:I.invalid_string,message:o.message}),i.dirty()):o.kind==="cidr"?xP(t.data,o.version)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"cidr",code:I.invalid_string,message:o.message}),i.dirty()):o.kind==="base64"?hP.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"base64",code:I.invalid_string,message:o.message}),i.dirty()):o.kind==="base64url"?gP.test(t.data)||(r=this._getOrReturnCtx(t,r),j(r,{validation:"base64url",code:I.invalid_string,message:o.message}),i.dirty()):se.assertNever(o);return{status:i.value,value:t.data}}_regex(t,n,i){return this.refinement(r=>t.test(r),{validation:n,code:I.invalid_string,...U.errToObj(i)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...U.errToObj(t)})}url(t){return this._addCheck({kind:"url",...U.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...U.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...U.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...U.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...U.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...U.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...U.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...U.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...U.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...U.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...U.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...U.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...U.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...U.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...U.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...U.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...U.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...U.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...U.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...U.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...U.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...U.errToObj(n)})}nonempty(t){return this.min(1,U.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};mi.create=e=>new mi({checks:[],typeName:P.ZodString,coerce:e?.coerce??!1,...X(e)});function wP(e,t){let n=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,r=n>i?n:i,o=Number.parseInt(e.toFixed(r).replace(".","")),a=Number.parseInt(t.toFixed(r).replace(".",""));return o%a/10**r}var ra=class e extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==D.number){let o=this._getOrReturnCtx(t);return j(o,{code:I.invalid_type,expected:D.number,received:o.parsedType}),F}let i,r=new nt;for(let o of this._def.checks)o.kind==="int"?se.isInteger(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{code:I.invalid_type,expected:"integer",received:"float",message:o.message}),r.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(i=this._getOrReturnCtx(t,i),j(i,{code:I.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(i=this._getOrReturnCtx(t,i),j(i,{code:I.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty()):o.kind==="multipleOf"?wP(t.data,o.value)!==0&&(i=this._getOrReturnCtx(t,i),j(i,{code:I.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(i=this._getOrReturnCtx(t,i),j(i,{code:I.not_finite,message:o.message}),r.dirty()):se.assertNever(o);return{status:r.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,U.toString(n))}gt(t,n){return this.setLimit("min",t,!1,U.toString(n))}lte(t,n){return this.setLimit("max",t,!0,U.toString(n))}lt(t,n){return this.setLimit("max",t,!1,U.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:U.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:U.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:U.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:U.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:U.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:U.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:U.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:U.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:U.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:U.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&se.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(t===null||i.value<t)&&(t=i.value)}return Number.isFinite(n)&&Number.isFinite(t)}};ra.create=e=>new ra({checks:[],typeName:P.ZodNumber,coerce:e?.coerce||!1,...X(e)});var na=class e extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==D.bigint)return this._getInvalidInput(t);let i,r=new nt;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(i=this._getOrReturnCtx(t,i),j(i,{code:I.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),r.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(i=this._getOrReturnCtx(t,i),j(i,{code:I.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),r.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(i=this._getOrReturnCtx(t,i),j(i,{code:I.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()):se.assertNever(o);return{status:r.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return j(n,{code:I.invalid_type,expected:D.bigint,received:n.parsedType}),F}gte(t,n){return this.setLimit("min",t,!0,U.toString(n))}gt(t,n){return this.setLimit("min",t,!1,U.toString(n))}lte(t,n){return this.setLimit("max",t,!0,U.toString(n))}lt(t,n){return this.setLimit("max",t,!1,U.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:U.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:U.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:U.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:U.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:U.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:U.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};na.create=e=>new na({checks:[],typeName:P.ZodBigInt,coerce:e?.coerce??!1,...X(e)});var ia=class extends re{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==D.boolean){let i=this._getOrReturnCtx(t);return j(i,{code:I.invalid_type,expected:D.boolean,received:i.parsedType}),F}return ft(t.data)}};ia.create=e=>new ia({typeName:P.ZodBoolean,coerce:e?.coerce||!1,...X(e)});var oa=class e extends re{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==D.date){let o=this._getOrReturnCtx(t);return j(o,{code:I.invalid_type,expected:D.date,received:o.parsedType}),F}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return j(o,{code:I.invalid_date}),F}let i=new nt,r;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(r=this._getOrReturnCtx(t,r),j(r,{code:I.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),i.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(r=this._getOrReturnCtx(t,r),j(r,{code:I.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),i.dirty()):se.assertNever(o);return{status:i.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:U.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:U.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};oa.create=e=>new oa({checks:[],coerce:e?.coerce||!1,typeName:P.ZodDate,...X(e)});var aa=class extends re{_parse(t){if(this._getType(t)!==D.symbol){let i=this._getOrReturnCtx(t);return j(i,{code:I.invalid_type,expected:D.symbol,received:i.parsedType}),F}return ft(t.data)}};aa.create=e=>new aa({typeName:P.ZodSymbol,...X(e)});var hi=class extends re{_parse(t){if(this._getType(t)!==D.undefined){let i=this._getOrReturnCtx(t);return j(i,{code:I.invalid_type,expected:D.undefined,received:i.parsedType}),F}return ft(t.data)}};hi.create=e=>new hi({typeName:P.ZodUndefined,...X(e)});var gi=class extends re{_parse(t){if(this._getType(t)!==D.null){let i=this._getOrReturnCtx(t);return j(i,{code:I.invalid_type,expected:D.null,received:i.parsedType}),F}return ft(t.data)}};gi.create=e=>new gi({typeName:P.ZodNull,...X(e)});var sa=class extends re{constructor(){super(...arguments),this._any=!0}_parse(t){return ft(t.data)}};sa.create=e=>new sa({typeName:P.ZodAny,...X(e)});var Wr=class extends re{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ft(t.data)}};Wr.create=e=>new Wr({typeName:P.ZodUnknown,...X(e)});var yr=class extends re{_parse(t){let n=this._getOrReturnCtx(t);return j(n,{code:I.invalid_type,expected:D.never,received:n.parsedType}),F}};yr.create=e=>new yr({typeName:P.ZodNever,...X(e)});var ca=class extends re{_parse(t){if(this._getType(t)!==D.undefined){let i=this._getOrReturnCtx(t);return j(i,{code:I.invalid_type,expected:D.void,received:i.parsedType}),F}return ft(t.data)}};ca.create=e=>new ca({typeName:P.ZodVoid,...X(e)});var Xr=class e extends re{_parse(t){let{ctx:n,status:i}=this._processInputParams(t),r=this._def;if(n.parsedType!==D.array)return j(n,{code:I.invalid_type,expected:D.array,received:n.parsedType}),F;if(r.exactLength!==null){let a=n.data.length>r.exactLength.value,s=n.data.length<r.exactLength.value;(a||s)&&(j(n,{code:a?I.too_big:I.too_small,minimum:s?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),i.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(j(n,{code:I.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(j(n,{code:I.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((a,s)=>r.type._parseAsync(new Bt(n,a,n.path,s)))).then(a=>nt.mergeArray(i,a));let o=[...n.data].map((a,s)=>r.type._parseSync(new Bt(n,a,n.path,s)));return nt.mergeArray(i,o)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:U.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:U.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:U.toString(n)}})}nonempty(t){return this.min(1,t)}};Xr.create=(e,t)=>new Xr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:P.ZodArray,...X(t)});function pi(e){if(e instanceof Ut){let t={};for(let n in e.shape){let i=e.shape[n];t[n]=nr.create(pi(i))}return new Ut({...e._def,shape:()=>t})}else return e instanceof Xr?new Xr({...e._def,type:pi(e.element)}):e instanceof nr?nr.create(pi(e.unwrap())):e instanceof Cr?Cr.create(pi(e.unwrap())):e instanceof Rr?Rr.create(e.items.map(t=>pi(t))):e}var Ut=class e extends re{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=se.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==D.object){let u=this._getOrReturnCtx(t);return j(u,{code:I.invalid_type,expected:D.object,received:u.parsedType}),F}let{status:i,ctx:r}=this._processInputParams(t),{shape:o,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof yr&&this._def.unknownKeys==="strip"))for(let u in r.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=o[u],d=r.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Bt(r,d,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof yr){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:r.data[l]}});else if(u==="strict")s.length>0&&(j(r,{code:I.unrecognized_keys,keys:s}),i.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of s){let d=r.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Bt(r,d,r.path,l)),alwaysSet:l in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>nt.mergeObjectSync(i,u)):nt.mergeObjectSync(i,c)}get shape(){return this._def.shape()}strict(t){return U.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,i)=>{let r=this._def.errorMap?.(n,i).message??i.defaultError;return n.code==="unrecognized_keys"?{message:U.errToObj(t).message??r}:{message:r}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:P.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let i of se.objectKeys(t))t[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let i of se.objectKeys(this.shape))t[i]||(n[i]=this.shape[i]);return new e({...this._def,shape:()=>n})}deepPartial(){return pi(this)}partial(t){let n={};for(let i of se.objectKeys(this.shape)){let r=this.shape[i];t&&!t[i]?n[i]=r:n[i]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let i of se.objectKeys(this.shape))if(t&&!t[i])n[i]=this.shape[i];else{let o=this.shape[i];for(;o instanceof nr;)o=o._def.innerType;n[i]=o}return new e({...this._def,shape:()=>n})}keyof(){return X_(se.objectKeys(this.shape))}};Ut.create=(e,t)=>new Ut({shape:()=>e,unknownKeys:"strip",catchall:yr.create(),typeName:P.ZodObject,...X(t)});Ut.strictCreate=(e,t)=>new Ut({shape:()=>e,unknownKeys:"strict",catchall:yr.create(),typeName:P.ZodObject,...X(t)});Ut.lazycreate=(e,t)=>new Ut({shape:e,unknownKeys:"strip",catchall:yr.create(),typeName:P.ZodObject,...X(t)});var vi=class extends re{_parse(t){let{ctx:n}=this._processInputParams(t),i=this._def.options;function r(o){for(let s of o)if(s.result.status==="valid")return s.result;for(let s of o)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(s=>new Ct(s.ctx.common.issues));return j(n,{code:I.invalid_union,unionErrors:a}),F}if(n.common.async)return Promise.all(i.map(async o=>{let a={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(r);{let o,a=[];for(let c of i){let u={...n,common:{...n.common,issues:[]},parent:null},l=c._parseSync({data:n.data,path:n.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;let s=a.map(c=>new Ct(c));return j(n,{code:I.invalid_union,unionErrors:s}),F}}get options(){return this._def.options}};vi.create=(e,t)=>new vi({options:e,typeName:P.ZodUnion,...X(t)});var Dr=e=>e instanceof _i?Dr(e.schema):e instanceof ir?Dr(e.innerType()):e instanceof $i?[e.value]:e instanceof bi?e.options:e instanceof xi?se.objectValues(e.enum):e instanceof wi?Dr(e._def.innerType):e instanceof hi?[void 0]:e instanceof gi?[null]:e instanceof nr?[void 0,...Dr(e.unwrap())]:e instanceof Cr?[null,...Dr(e.unwrap())]:e instanceof wc||e instanceof Si?Dr(e.unwrap()):e instanceof ki?Dr(e._def.innerType):[],dp=class e extends re{_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==D.object)return j(n,{code:I.invalid_type,expected:D.object,received:n.parsedType}),F;let i=this.discriminator,r=n.data[i],o=this.optionsMap.get(r);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(j(n,{code:I.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),F)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,i){let r=new Map;for(let o of n){let a=Dr(o.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(r.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);r.set(s,o)}}return new e({typeName:P.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...X(i)})}};function fp(e,t){let n=Ar(e),i=Ar(t);if(e===t)return{valid:!0,data:e};if(n===D.object&&i===D.object){let r=se.objectKeys(t),o=se.objectKeys(e).filter(s=>r.indexOf(s)!==-1),a={...e,...t};Object.prototype.hasOwnProperty.call(a,"__proto__")&&delete a.__proto__;for(let s of o){if(s==="__proto__")continue;let c=fp(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(n===D.array&&i===D.array){if(e.length!==t.length)return{valid:!1};let r=[];for(let o=0;o<e.length;o++){let a=e[o],s=t[o],c=fp(a,s);if(!c.valid)return{valid:!1};r.push(c.data)}return{valid:!0,data:r}}else return n===D.date&&i===D.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var yi=class extends re{_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=(o,a)=>{if(cp(o)||cp(a))return F;let s=fp(o.value,a.value);return s.valid?((up(o)||up(a))&&n.dirty(),{status:n.value,value:s.data}):(j(i,{code:I.invalid_intersection_types}),F)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([o,a])=>r(o,a)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};yi.create=(e,t,n)=>new yi({left:e,right:t,typeName:P.ZodIntersection,...X(n)});var Rr=class e extends re{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==D.array)return j(i,{code:I.invalid_type,expected:D.array,received:i.parsedType}),F;if(i.data.length<this._def.items.length)return j(i,{code:I.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F;!this._def.rest&&i.data.length>this._def.items.length&&(j(i,{code:I.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let o=[...i.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new Bt(i,a,i.path,s)):null}).filter(a=>!!a);return i.common.async?Promise.all(o).then(a=>nt.mergeArray(n,a)):nt.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Rr.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Rr({items:e,typeName:P.ZodTuple,rest:null,...X(t)})};var pp=class e extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==D.object)return j(i,{code:I.invalid_type,expected:D.object,received:i.parsedType}),F;let r=[],o=this._def.keyType,a=this._def.valueType;for(let s in i.data)r.push({key:o._parse(new Bt(i,s,i.path,s)),value:a._parse(new Bt(i,i.data[s],i.path,s)),alwaysSet:s in i.data});return i.common.async?nt.mergeObjectAsync(n,r):nt.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(t,n,i){return n instanceof re?new e({keyType:t,valueType:n,typeName:P.ZodRecord,...X(i)}):new e({keyType:mi.create(),valueType:t,typeName:P.ZodRecord,...X(n)})}},ua=class extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==D.map)return j(i,{code:I.invalid_type,expected:D.map,received:i.parsedType}),F;let r=this._def.keyType,o=this._def.valueType,a=[...i.data.entries()].map(([s,c],u)=>({key:r._parse(new Bt(i,s,i.path,[u,"key"])),value:o._parse(new Bt(i,c,i.path,[u,"value"]))}));if(i.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return F;(u.status==="dirty"||l.status==="dirty")&&n.dirty(),s.set(u.value,l.value)}return{status:n.value,value:s}})}else{let s=new Map;for(let c of a){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return F;(u.status==="dirty"||l.status==="dirty")&&n.dirty(),s.set(u.value,l.value)}return{status:n.value,value:s}}}};ua.create=(e,t,n)=>new ua({valueType:t,keyType:e,typeName:P.ZodMap,...X(n)});var la=class e extends re{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==D.set)return j(i,{code:I.invalid_type,expected:D.set,received:i.parsedType}),F;let r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(j(i,{code:I.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&i.data.size>r.maxSize.value&&(j(i,{code:I.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());let o=this._def.valueType;function a(c){let u=new Set;for(let l of c){if(l.status==="aborted")return F;l.status==="dirty"&&n.dirty(),u.add(l.value)}return{status:n.value,value:u}}let s=[...i.data.values()].map((c,u)=>o._parse(new Bt(i,c,i.path,u)));return i.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,n){return new e({...this._def,minSize:{value:t,message:U.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:U.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};la.create=(e,t)=>new la({valueType:e,minSize:null,maxSize:null,typeName:P.ZodSet,...X(t)});var mp=class e extends re{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==D.function)return j(n,{code:I.invalid_type,expected:D.function,received:n.parsedType}),F;function i(s,c){return xc({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ea(),Gr].filter(u=>!!u),issueData:{code:I.invalid_arguments,argumentsError:c}})}function r(s,c){return xc({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,ea(),Gr].filter(u=>!!u),issueData:{code:I.invalid_return_type,returnTypeError:c}})}let o={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof Pn){let s=this;return ft(async function(...c){let u=new Ct([]),l=await s._def.args.parseAsync(c,o).catch(p=>{throw u.addIssue(i(c,p)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,o).catch(p=>{throw u.addIssue(r(d,p)),u})})}else{let s=this;return ft(function(...c){let u=s._def.args.safeParse(c,o);if(!u.success)throw new Ct([i(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,o);if(!d.success)throw new Ct([r(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Rr.create(t).rest(Wr.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,i){return new e({args:t||Rr.create([]).rest(Wr.create()),returns:n||Wr.create(),typeName:P.ZodFunction,...X(i)})}},_i=class extends re{get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};_i.create=(e,t)=>new _i({getter:e,typeName:P.ZodLazy,...X(t)});var $i=class extends re{_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return j(n,{received:n.data,code:I.invalid_literal,expected:this._def.value}),F}return{status:"valid",value:t.data}}get value(){return this._def.value}};$i.create=(e,t)=>new $i({value:e,typeName:P.ZodLiteral,...X(t)});function X_(e,t){return new bi({values:e,typeName:P.ZodEnum,...X(t)})}var bi=class e extends re{_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),i=this._def.values;return j(n,{expected:se.joinValues(i),received:n.parsedType,code:I.invalid_type}),F}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),i=this._def.values;return j(n,{received:n.data,code:I.invalid_enum_value,options:i}),F}return ft(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(i=>!t.includes(i)),{...this._def,...n})}};bi.create=X_;var xi=class extends re{_parse(t){let n=se.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(t);if(i.parsedType!==D.string&&i.parsedType!==D.number){let r=se.objectValues(n);return j(i,{expected:se.joinValues(r),received:i.parsedType,code:I.invalid_type}),F}if(this._cache||(this._cache=new Set(se.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let r=se.objectValues(n);return j(i,{received:i.data,code:I.invalid_enum_value,options:r}),F}return ft(t.data)}get enum(){return this._def.values}};xi.create=(e,t)=>new xi({values:e,typeName:P.ZodNativeEnum,...X(t)});var Pn=class extends re{unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==D.promise&&n.common.async===!1)return j(n,{code:I.invalid_type,expected:D.promise,received:n.parsedType}),F;let i=n.parsedType===D.promise?n.data:Promise.resolve(n.data);return ft(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Pn.create=(e,t)=>new Pn({type:e,typeName:P.ZodPromise,...X(t)});var ir=class extends re{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===P.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=this._def.effect||null,o={addIssue:a=>{j(i,a),a.fatal?n.abort():n.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),r.type==="preprocess"){let a=r.transform(i.data,o);if(i.common.async)return Promise.resolve(a).then(async s=>{if(n.value==="aborted")return F;let c=await this._def.schema._parseAsync({data:s,path:i.path,parent:i});return c.status==="aborted"?F:c.status==="dirty"?fi(c.value):n.value==="dirty"?fi(c.value):c});{if(n.value==="aborted")return F;let s=this._def.schema._parseSync({data:a,path:i.path,parent:i});return s.status==="aborted"?F:s.status==="dirty"?fi(s.value):n.value==="dirty"?fi(s.value):s}}if(r.type==="refinement"){let a=s=>{let c=r.refinement(s,o);if(i.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(i.common.async===!1){let s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?F:(s.status==="dirty"&&n.dirty(),a(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>s.status==="aborted"?F:(s.status==="dirty"&&n.dirty(),a(s.value).then(()=>({status:n.value,value:s.value}))))}if(r.type==="transform")if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!zn(a))return F;let s=r.transform(a.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>zn(a)?Promise.resolve(r.transform(a.value,o)).then(s=>({status:n.value,value:s})):F);se.assertNever(r)}};ir.create=(e,t,n)=>new ir({schema:e,typeName:P.ZodEffects,effect:t,...X(n)});ir.createWithPreprocess=(e,t,n)=>new ir({schema:t,effect:{type:"preprocess",transform:e},typeName:P.ZodEffects,...X(n)});var nr=class extends re{_parse(t){return this._getType(t)===D.undefined?ft(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};nr.create=(e,t)=>new nr({innerType:e,typeName:P.ZodOptional,...X(t)});var Cr=class extends re{_parse(t){return this._getType(t)===D.null?ft(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Cr.create=(e,t)=>new Cr({innerType:e,typeName:P.ZodNullable,...X(t)});var wi=class extends re{_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return n.parsedType===D.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};wi.create=(e,t)=>new wi({innerType:e,typeName:P.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...X(t)});var ki=class extends re{_parse(t){let{ctx:n}=this._processInputParams(t),i={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return ta(r)?r.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ct(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Ct(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};ki.create=(e,t)=>new ki({innerType:e,typeName:P.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...X(t)});var da=class extends re{_parse(t){if(this._getType(t)!==D.nan){let i=this._getOrReturnCtx(t);return j(i,{code:I.invalid_type,expected:D.nan,received:i.parsedType}),F}return{status:"valid",value:t.data}}};da.create=e=>new da({typeName:P.ZodNaN,...X(e)});var wc=class extends re{_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}},kc=class e extends re{_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?F:o.status==="dirty"?(n.dirty(),fi(o.value)):this._def.out._parseAsync({data:o.value,path:i.path,parent:i})})();{let r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?F:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(t,n){return new e({in:t,out:n,typeName:P.ZodPipeline})}},Si=class extends re{_parse(t){let n=this._def.innerType._parse(t),i=r=>(zn(r)&&(r.value=Object.freeze(r.value)),r);return ta(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}};Si.create=(e,t)=>new Si({innerType:e,typeName:P.ZodReadonly,...X(t)});var xZ={object:Ut.lazycreate},P;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(P||(P={}));var wZ=mi.create,kZ=ra.create,SZ=da.create,IZ=na.create,zZ=ia.create,PZ=oa.create,TZ=aa.create,OZ=hi.create,jZ=gi.create,EZ=sa.create,NZ=Wr.create,AZ=yr.create,DZ=ca.create,RZ=Xr.create,Y_=Ut.create,CZ=Ut.strictCreate,UZ=vi.create,ZZ=dp.create,MZ=yi.create,LZ=Rr.create,VZ=pp.create,FZ=ua.create,qZ=la.create,BZ=mp.create,JZ=_i.create,HZ=$i.create,KZ=bi.create,GZ=xi.create,WZ=Pn.create,XZ=ir.create,YZ=nr.create,QZ=Cr.create,eM=ir.createWithPreprocess,tM=kc.create;var sr={};Nr(sr,{$ZodAny:()=>Eu,$ZodArray:()=>Cu,$ZodAsyncError:()=>It,$ZodBase64:()=>gu,$ZodBase64URL:()=>yu,$ZodBigInt:()=>Na,$ZodBigIntFormat:()=>Pu,$ZodBoolean:()=>qi,$ZodCIDRv4:()=>fu,$ZodCIDRv6:()=>mu,$ZodCUID:()=>iu,$ZodCUID2:()=>ou,$ZodCatch:()=>tl,$ZodCheck:()=>be,$ZodCheckBigIntFormat:()=>$m,$ZodCheckEndsWith:()=>Em,$ZodCheckGreaterThan:()=>Fc,$ZodCheckIncludes:()=>Om,$ZodCheckLengthEquals:()=>Im,$ZodCheckLessThan:()=>Vc,$ZodCheckLowerCase:()=>Pm,$ZodCheckMaxLength:()=>km,$ZodCheckMaxSize:()=>bm,$ZodCheckMimeType:()=>Dm,$ZodCheckMinLength:()=>Sm,$ZodCheckMinSize:()=>xm,$ZodCheckMultipleOf:()=>ym,$ZodCheckNumberFormat:()=>_m,$ZodCheckOverwrite:()=>Rm,$ZodCheckProperties:()=>Am,$ZodCheckProperty:()=>Nm,$ZodCheckRegex:()=>zm,$ZodCheckSizeEquals:()=>wm,$ZodCheckStartsWith:()=>jm,$ZodCheckStringFormat:()=>Vi,$ZodCheckUpperCase:()=>Tm,$ZodCodec:()=>Ji,$ZodCreditCard:()=>bu,$ZodCustom:()=>sl,$ZodCustomStringFormat:()=>Iu,$ZodCyclicError:()=>dl,$ZodDate:()=>Ru,$ZodDefault:()=>Xu,$ZodDiscriminatedUnion:()=>Mu,$ZodE164:()=>_u,$ZodEmail:()=>Xc,$ZodEmoji:()=>ru,$ZodEncodeError:()=>Qr,$ZodEnum:()=>Bu,$ZodError:()=>Ep,$ZodExactOptional:()=>Gu,$ZodFile:()=>Hu,$ZodFunction:()=>ol,$ZodGUID:()=>Gc,$ZodIBAN:()=>wu,$ZodIPv4:()=>uu,$ZodIPv6:()=>lu,$ZodISODate:()=>Vm,$ZodISODateTime:()=>Lm,$ZodISODuration:()=>qm,$ZodISOTime:()=>Fm,$ZodIntersection:()=>Lu,$ZodJWT:()=>Su,$ZodKSUID:()=>cu,$ZodLazy:()=>Hi,$ZodLiteral:()=>Ju,$ZodMAC:()=>du,$ZodMap:()=>Fu,$ZodNaN:()=>rl,$ZodNanoID:()=>nu,$ZodNever:()=>Au,$ZodNonOptional:()=>Qu,$ZodNull:()=>ju,$ZodNullable:()=>Wu,$ZodNumber:()=>Ea,$ZodNumberFormat:()=>zu,$ZodObject:()=>Uu,$ZodObjectJIT:()=>Jm,$ZodOptional:()=>Da,$ZodPipe:()=>Ra,$ZodPrefault:()=>Yu,$ZodPreprocess:()=>Km,$ZodPromise:()=>al,$ZodReadonly:()=>nl,$ZodRealError:()=>zt,$ZodRecord:()=>Vu,$ZodRegistry:()=>vl,$ZodSet:()=>qu,$ZodString:()=>en,$ZodStringFormat:()=>ge,$ZodSuccess:()=>el,$ZodSymbol:()=>Tu,$ZodTemplateLiteral:()=>il,$ZodTransform:()=>Ku,$ZodTuple:()=>Aa,$ZodType:()=>H,$ZodULID:()=>au,$ZodURL:()=>tu,$ZodUUID:()=>Wc,$ZodUndefined:()=>Ou,$ZodUnion:()=>Bi,$ZodUnknown:()=>Nu,$ZodVoid:()=>Du,$ZodXID:()=>su,$ZodXor:()=>Zu,$brand:()=>Tp,$constructor:()=>v,$input:()=>Ym,$output:()=>Xm,Doc:()=>Dn,INVALID:()=>ht,JSONSchema:()=>Ax,JSONSchemaGenerator:()=>ad,NEVER:()=>Pp,TimePrecision:()=>ah,URL_BAD_FORMAT:()=>Zm,URL_UNPARSEABLE:()=>za,ZodCompileAsyncError:()=>or,ZodCompileUnsupportedError:()=>oe,_any:()=>Zl,_array:()=>dh,_base64:()=>is,_base64url:()=>os,_bigint:()=>Nl,_boolean:()=>El,_catch:()=>fj,_check:()=>yx,_cidrv4:()=>rs,_cidrv6:()=>ns,_coercedBigint:()=>uh,_coercedBoolean:()=>ch,_coercedDate:()=>lh,_coercedNumber:()=>sh,_coercedString:()=>oh,_creditCard:()=>kl,_cuid:()=>Ga,_cuid2:()=>Wa,_custom:()=>Xl,_date:()=>Fl,_decode:()=>jc,_decodeAsync:()=>Nc,_default:()=>uj,_discriminatedUnion:()=>XO,_e164:()=>as,_email:()=>La,_emoji:()=>Ha,_encode:()=>Oc,_encodeAsync:()=>Ec,_endsWith:()=>io,_enum:()=>nj,_file:()=>Wl,_float32:()=>Pl,_float64:()=>Tl,_gt:()=>br,_gte:()=>Lt,_guid:()=>Va,_iban:()=>Sl,_includes:()=>ro,_int:()=>zl,_int32:()=>Ol,_int64:()=>Al,_intersection:()=>YO,_ipv4:()=>es,_ipv6:()=>ts,_isoDate:()=>us,_isoDateTime:()=>cs,_isoDuration:()=>ds,_isoTime:()=>ls,_jwt:()=>ss,_ksuid:()=>Qa,_lazy:()=>gj,_length:()=>Ln,_literal:()=>oj,_lowercase:()=>eo,_lt:()=>$r,_lte:()=>Mt,_mac:()=>wl,_map:()=>tj,_max:()=>Mt,_maxLength:()=>Mn,_maxSize:()=>nn,_mime:()=>ao,_min:()=>Lt,_minLength:()=>Lr,_minSize:()=>xr,_multipleOf:()=>rn,_nan:()=>ql,_nanoid:()=>Ka,_nativeEnum:()=>ij,_negative:()=>Jl,_never:()=>Ll,_nonnegative:()=>Kl,_nonoptional:()=>lj,_nonpositive:()=>Hl,_normalize:()=>so,_null:()=>Ul,_nullable:()=>cj,_number:()=>Il,_optional:()=>sj,_overwrite:()=>ar,_parse:()=>Ai,_parseAsync:()=>Di,_pipe:()=>pj,_positive:()=>Bl,_promise:()=>vj,_properties:()=>oo,_property:()=>Gl,_readonly:()=>mj,_record:()=>ej,_refine:()=>Yl,_regex:()=>Qi,_safeDecode:()=>Dc,_safeDecodeAsync:()=>Cc,_safeEncode:()=>Ac,_safeEncodeAsync:()=>Rc,_safeParse:()=>Ri,_safeParseAsync:()=>Ui,_set:()=>rj,_size:()=>Zn,_slugify:()=>fo,_startsWith:()=>no,_string:()=>xl,_stringFormat:()=>on,_stringbool:()=>rd,_success:()=>dj,_superRefine:()=>Ql,_symbol:()=>Rl,_templateLiteral:()=>hj,_toLowerCase:()=>uo,_toUpperCase:()=>lo,_transform:()=>aj,_trim:()=>co,_tuple:()=>QO,_uint32:()=>jl,_uint64:()=>Dl,_ulid:()=>Xa,_undefined:()=>Cl,_union:()=>GO,_unknown:()=>Ml,_uppercase:()=>to,_url:()=>Yi,_uuid:()=>Fa,_uuidv4:()=>qa,_uuidv6:()=>Ba,_uuidv7:()=>Ja,_void:()=>Vl,_xid:()=>Ya,_xor:()=>WO,base64Charset:()=>hu,base64urlCharset:()=>ja,canParseURL:()=>Mm,clone:()=>fe,compile:()=>rh,compileFn:()=>$l,config:()=>Ce,createStandardJSONSchemaMethod:()=>po,createToJSONSchemaMethod:()=>ph,decode:()=>_$,decodeAsync:()=>b$,describe:()=>ed,encode:()=>y$,encodeAsync:()=>$$,extractDefs:()=>sn,finalize:()=>cn,flattenError:()=>ba,formatError:()=>xa,getDiscriminatedOption:()=>Hm,globalConfig:()=>Be,globalRegistry:()=>Ge,handleUnrepresentable:()=>Ve,initializeContext:()=>an,isBackEdge:()=>pl,isRecursiveSchema:()=>fl,isValidBase64:()=>Oa,isValidBase64URL:()=>vu,isValidCIDRv6:()=>pu,isValidCreditCard:()=>$u,isValidIBAN:()=>xu,isValidIPv6:()=>Ta,isValidJWT:()=>ku,locales:()=>Wi,memoizer:()=>Za,mergeValues:()=>Fi,meta:()=>td,parse:()=>En,parseAsync:()=>Nn,parseURLObject:()=>B$,prettifyError:()=>Ap,process:()=>ye,processSchema:()=>ye,regexes:()=>Zt,registry:()=>yl,safeDecode:()=>w$,safeDecodeAsync:()=>S$,safeEncode:()=>x$,safeEncodeAsync:()=>k$,safeParse:()=>Ci,safeParseAsync:()=>Zi,standardProps:()=>Kc,stripTabAndNewline:()=>Pa,toDotPath:()=>g$,toJSONSchema:()=>Vn,toZod:()=>fa,treeifyError:()=>Np,urlHostnameOk:()=>Qc,urlProtocolOk:()=>eu,util:()=>x,validate:()=>Mi,validateAsync:()=>Li,validateURL:()=>Yc,version:()=>Cm,withParser:()=>_l});var x={};Nr(x,{BIGINT_FORMAT_RANGES:()=>ga,CONSTANT_CATCH:()=>Pc,Class:()=>vp,NUMBER_FORMAT_RANGES:()=>ha,aborted:()=>mt,allowsEval:()=>$p,assert:()=>PP,assertEqual:()=>kP,assertIs:()=>IP,assertNever:()=>zP,assertNotEqual:()=>SP,assignProp:()=>Ke,attachSchema:()=>va,base64ToUint8Array:()=>l$,base64urlToUint8Array:()=>MP,cached:()=>Ti,captureStackTrace:()=>Ic,cleanEnum:()=>ZP,cleanRegex:()=>Zr,clone:()=>fe,cloneDef:()=>jP,codePointLength:()=>jn,constantCatch:()=>Ip,createTransparentProxy:()=>CP,defineLazy:()=>yp,defineLazyInternal:()=>Q,derived:()=>qP,esc:()=>pt,escapeRegex:()=>Kt,explicitlyAborted:()=>wp,extend:()=>i$,finalizeIssue:()=>St,floatSafeRemainder:()=>pa,getElementAtPath:()=>EP,getEnumValues:()=>zi,getLengthableOrigin:()=>_a,getParsedType:()=>RP,getSizableOrigin:()=>ya,hexToUint8Array:()=>VP,hide:()=>$a,installLazyProp:()=>Sp,isObject:()=>On,isPlainObject:()=>Ht,issue:()=>Ni,joinValues:()=>y,jsonStringifyReplacer:()=>Pi,members:()=>kp,merge:()=>s$,mergeDefs:()=>Jt,normalizeParams:()=>z,nullish:()=>Sc,numKeys:()=>DP,objectClone:()=>TP,omit:()=>n$,optionalKeys:()=>xp,own:()=>_r,parsedType:()=>S,partial:()=>c$,pick:()=>r$,prefixIssues:()=>kt,primitiveTypes:()=>bp,promiseAllObject:()=>NP,propertyKeyTypes:()=>ma,randomString:()=>AP,rawShape:()=>Oi,required:()=>u$,safeExtend:()=>a$,shallowClone:()=>ji,sizeCaps:()=>Ei,slugify:()=>_p,stringifyPrimitive:()=>w,toZod:()=>fa,uint8ArrayToBase64:()=>d$,uint8ArrayToBase64url:()=>LP,uint8ArrayToHex:()=>FP,unwrapMessage:()=>Ii});function kP(e){return e}function SP(e){return e}function fa(){return e=>e}function IP(e){}function zP(e){throw new Error("Unexpected value in exhaustive check")}function PP(e){}function zi(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,r])=>t.indexOf(+i)===-1).map(([i,r])=>r)}function y(e,t="|"){return e.map(n=>w(n)).join(t)}function Pi(e,t){return typeof t=="bigint"?t.toString():t}var gp=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function Ti(e){return new gp(e)}function Sc(e){return e==null}function Zr(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function pa(e,t){let n=e/t,i=Math.round(n),r=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-i)<r?0:n-i}var Q_=Symbol("evaluating");function yp(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==Q_)return i===void 0&&(i=Q_,i=n()),i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function TP(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Ke(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Oi(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Ur(e){return Oi(e._zod.def)??e._zod.def.shape}function e$(e,t,n){Object.defineProperty(e,t,{get(){let i=n();return Ke(this,t,i),i},enumerable:!0,configurable:!0})}function t$(e,t,n){t in e?Ke(e,t,n):e[t]=n}function Tn(e,t,n,i){let r=Ur(t);for(let o of n){let a=Object.getOwnPropertyDescriptor(r,o);a.enumerable&&(a.get?e$(e,o,()=>{let s=t._zod.def.shape[o];return i?i(s,o):s}):t$(e,o,i?i(a.value,o):a.value))}}function OP(e,t){for(let n of Reflect.ownKeys(t)){let i=Object.getOwnPropertyDescriptor(t,n);i.enumerable&&(i.get?e$(e,n,()=>t[n]):t$(e,n,i.value))}}function Jt(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function jP(e){return Jt(e._zod.def)}function EP(e,t){return t?t.reduce((n,i)=>n?.[i],e):e}function NP(e){let t=Object.keys(e),n=t.map(i=>e[i]);return Promise.all(n).then(i=>{let r={};for(let o=0;o<t.length;o++)r[t[o]]=i[o];return r})}function AP(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let i=0;i<e;i++)n+=t[Math.floor(Math.random()*t.length)];return n}function pt(e){return JSON.stringify(e)}function _p(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ic="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function On(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var $p=Ti(()=>{if(Be.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Ht(e){if(On(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(On(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function ji(e){return Ht(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function DP(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var RP=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},ma=new Set(["string","number","symbol"]),bp=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Kt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fe(e,t,n){let i=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(i._zod.parent=e),i}function z(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function CP(e){let t;return new Proxy({},{get(n,i,r){return t??(t=e()),Reflect.get(t,i,r)},set(n,i,r,o){return t??(t=e()),Reflect.set(t,i,r,o)},has(n,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(n,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(n,i,r){return t??(t=e()),Reflect.defineProperty(t,i,r)}})}function w(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function xp(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var ha={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ga={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function r$(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o={};return Tn(o,e,zc(e,t)),fe(e,Jt(n,{shape:o,checks:[]}))}function zc(e,t){let n=Ur(e),i=[];for(let r of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,r)?.enumerable)throw new Error(`Unrecognized key: "${String(r)}"`);t[r]&&i.push(r)}return i}function n$(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=new Set(zc(e,t)),a={};return Tn(a,e,Reflect.ownKeys(Ur(e)).filter(s=>!o.has(s))),fe(e,Jt(n,{shape:a,checks:[]}))}function i$(e,t){if(!Ht(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let r=Ur(e);for(let o of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(r,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return fe(e,Jt(e._zod.def,{shape:o$(e,t)}))}function o$(e,t){let n={};return Tn(n,e,Reflect.ownKeys(Ur(e))),OP(n,t),n}function a$(e,t){if(!Ht(t))throw new Error("Invalid input to safeExtend: expected a plain object");return fe(e,Jt(e._zod.def,{shape:o$(e,t)}))}function s$(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};Tn(n,e,Reflect.ownKeys(Ur(e))),Tn(n,t,Reflect.ownKeys(Ur(t)));let i=Jt(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return fe(e,i)}function c$(e,t,n,i="partial"){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(`.${i}() cannot be used on object schemas containing refinements`);let s=n?new Set(zc(t,n)):void 0,c={};return Tn(c,t,Reflect.ownKeys(Ur(t)),e&&((u,l)=>s&&!s.has(l)?u:new e({type:"optional",innerType:u}))),fe(t,Jt(t._zod.def,{shape:c,checks:[]}))}function u$(e,t,n){let i=n?new Set(zc(t,n)):void 0,r={};return Tn(r,t,Reflect.ownKeys(Ur(t)),(o,a)=>i&&!i.has(a)?o:new e({type:"nonoptional",innerType:o})),fe(t,Jt(t._zod.def,{shape:r}))}function mt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function wp(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function kt(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function Ii(e){return typeof e=="string"?e:e?.message}function Ei(e){let t=[];for(let n of e??[]){let i=n._zod.def;if(!/_(length|size)$|_equals$/.test(i.check))break;let r=i.maximum??i.length??i.size;r>=0&&t.push([r,n])}return t}function va(e,t,n){var i;for(let r=t;r<e.length;r++)(i=e[r]).schema??(i.schema=n)}function St(e,t,n){var i;let r=e.inst?._zod?.traits;r?.has("$ZodType")&&(r.has("$ZodCheck")?(i=e).schema??(i.schema=e.inst):e.schema=e.inst);let o=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,a=e.message?e.message:Ii(e.inst?._zod.def?.error?.(e))??Ii(o?.(e))??Ii(t?.error?.(e))??Ii(n.customError?.(e))??Ii(n.localeError?.(e))??"Invalid input",s={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(s[c]=e[c]);return s.path??(s.path=[]),s.message=a,t?.reportInput&&(s.input=e.input),s}function ya(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var UP=/[\uD800-\uDBFF]/;function jn(e){let t=e.length;if(!UP.test(e))return t;let n=t;for(let i=0;i<t-1;i++)(e.charCodeAt(i)&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320&&(n--,i++);return n}function _a(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function S(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Ni(...e){let[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}function ZP(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function l$(e){let t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}function d$(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function MP(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return l$(t+n)}function LP(e){return d$(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function VP(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)n[i/2]=Number.parseInt(t.slice(i,i+2),16);return n}function FP(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var vp=class{constructor(...t){}};function kp(e,t){for(let n in t){let i=Object.getOwnPropertyDescriptor(t,n);i.get?Object.defineProperty(e,n,{...i,enumerable:!1}):BP(e,n,i.value)}}function _r(e,t,n,i=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:i,value:n}),n}function $a(e,t,n){return _r(e,t,n,!1)}function qP(e,t){for(let n in e){let i=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return _r(this,n,i(this))},set(r){_r(this,n,r)}})}return t}function BP(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:_r(this,t,n.bind(this))},set(i){_r(this,t,i)}})}function JP(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var hp,Yr=!1,HP={configurable:!0,get(){Yr=!0}};function Q(e,t,n){let i=Object.getPrototypeOf(e._zod);if(t in i&&hp!==e._zod){hp=void 0;return}hp=e._zod,Object.defineProperty(i,t,{configurable:!0,get(){Object.defineProperty(this,t,HP);let r=Yr;Yr=!1;try{let o=n(this);return Yr?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o}),Yr=Yr||r,o}catch(o){throw delete this[t],Yr=Yr||r,o}},set(r){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r})}})}function Sp(e,t,n,i){let r=JP(e,t);r&&Object.defineProperty(r,t,{configurable:!0,get(){let o={configurable:!0,writable:!0,enumerable:i,value:void 0};return Object.defineProperty(this,t,o),o.value=n(this),Object.defineProperty(this,t,o),o.value},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:i,value:o})}})}var Pc="~constantCatch";function Ip(e){let t=()=>e;return t[Pc]=!0,t}var f$,Pp=Object.freeze({status:"aborted"}),zp={value:void 0,enumerable:!1},p$="captureStackTrace"in Error?Error:null;function KP(e){let t=p$;if(t){let n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return p$=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function v(e,t,n,i){let r={};function o(f){this.def=f,this.constr=d,this.traits=new Set}o.prototype=r;let a=n,s=a&&new WeakSet;function c(f,p){if(f._zod){if(f._zod.traits.has(e))return}else{zp.value=new o(p);try{Object.defineProperty(f,"_zod",zp)}finally{zp.value=void 0}}if(f._zod.traits.add(e),t(f,p),s){let h=Object.getPrototypeOf(f),g=f._zod.constr.prototype,_=h;for(;_&&_!==g;)_=Object.getPrototypeOf(_);let $=_??h;s.has($)||(s.add($),kp($,a))}let m=d.prototype;for(let h in m)Object.prototype.hasOwnProperty.call(m,h)&&(h in f||(f[h]=m[h].bind(f)))}let u=i?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function d(f){let p=i?.Parent?KP(l):this;c(p,f);let m=p._zod.deferred;if(m){for(let g of m)g();p._zod.deferred=void 0}let h=globalThis.__zod_globalConfig?.postProcessor;return h&&h(p),p}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:f=>i?.Parent&&f instanceof i.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Tp=Symbol("zod_brand"),It=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Qr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(f$=globalThis).__zod_globalConfig??(f$.__zod_globalConfig={});var Be=globalThis.__zod_globalConfig;function Ce(e){return e&&Object.assign(Be,e),Be}function GP(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Pi,2)),e.message}function WP(e){this._zod.message=e}var XP={get:GP,set:WP,enumerable:!0,configurable:!0},jp={value:void 0,enumerable:!1},m$=new WeakSet([Object.prototype,Error.prototype]),h$=(e,t)=>{e.name="$ZodError",jp.value=t,Object.defineProperty(e,"issues",jp),jp.value=void 0,Object.defineProperty(e,"message",XP);let n=Object.getPrototypeOf(e);m$.has(n)||(m$.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let i=()=>this.message;return Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0})}}))},Ep=v("$ZodError",h$),zt=v("$ZodError",h$,void 0,{Parent:Error});function YP(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function ba(e,t=n=>n.message){let n={},i=[];for(let r of e.issues)r.path.length>0?YP(n,r.path[0],()=>[]).push(t(r)):i.push(t(r));return{formErrors:i,fieldErrors:n}}function xa(e,t=n=>n.message){let n={_errors:[]},i=(r,o=[])=>{for(let a of r.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(s=>i({issues:s},[...o,...a.path]));else if(a.code==="invalid_key")i({issues:a.issues},[...o,...a.path]);else if(a.code==="invalid_element")i({issues:a.issues},[...o,...a.path]);else{let s=[...o,...a.path];if(s.length===0)n._errors.push(t(a));else{let c=n,u=0;for(;u<s.length;){let l=s[u],d=u===s.length-1;if(l==="_errors"){d&&c._errors.push(t(a)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let f=c[l];d&&f._errors.push(t(a)),c=f,u++}}}};return i(e),n}function Np(e,t=n=>n.message){let n={errors:[]},i=(r,o=[])=>{var a;for(let s of r.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(c=>i({issues:c},[...o,...s.path]));else if(s.code==="invalid_key")i({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")i({issues:s.issues},[...o,...s.path]);else{let c=[...o,...s.path];if(c.length===0){n.errors.push(t(s));continue}let u=n,l=0;for(;l<c.length;){let d=c[l],f=l===c.length-1;typeof d=="string"?(u.properties??(u.properties={}),Object.prototype.hasOwnProperty.call(u.properties,d)||Object.defineProperty(u.properties,d,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),u=u.properties[d]):(u.items??(u.items=[]),(a=u.items)[d]??(a[d]={errors:[]}),u=u.items[d]),f&&u.errors.push(t(s)),l++}}};return i(e),n}function g$(e){let t=[],n=e.map(i=>typeof i=="object"?i.key:i);for(let i of n)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}function Ap(e){let t=[],n=[...e.issues].sort((i,r)=>(i.path??[]).length-(r.path??[]).length);for(let i of n)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${g$(i.path)}`);return t.join(`
11
11
  `)}function Tc(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ai=e=>{let t=(n,i,r,o)=>{let a=r?{...r,async:!1}:{async:!1},s=n._zod.run({value:i,issues:[]},a);if(s instanceof Promise)throw new It;if(s.issues.length){let c=new(o?.Err??e)(s.issues.map(u=>St(u,a,Ce())));throw Ic(c,o?.callee??t),c}return s.value};return t},En=Ai(zt),Di=e=>{let t=async(n,i,r,o)=>{let a=r?{...r,async:!0}:{async:!0},s=n._zod.run({value:i,issues:[]},a);if(s instanceof Promise&&(s=await s),s.issues.length){let c=new(o?.Err??e)(s.issues.map(u=>St(u,a,Ce())));throw Ic(c,o?.callee??t),c}return s.value};return t},Nn=Di(zt),Ri=e=>(t,n,i)=>{let r=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},r);if(o instanceof Promise)throw new It;return o.issues.length?v$(e,o.issues,r):{success:!0,data:o.value}},Ci=Ri(zt);function v$(e,t,n){let i;return{success:!1,get error(){return i||(i=new e(t.map(r=>St(r,n,Ce()))),t=void 0,n=void 0),i},set error(r){i=r,t=void 0,n=void 0}}}var Ui=e=>async(t,n,i)=>{let r=i?{...i,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length?v$(e,o.issues,r):{success:!0,data:o.value}},Zi=Ui(zt),eT=Symbol.for("zod.compile.invalid"),tT=Symbol.for("zod.compile.fallback"),Mi=((e,t,n)=>{let i=e._zod.bag.validator;if(i!==void 0){if(i(t)!==eT)return!0;if(i.definite===!0&&n===void 0)return!1}return rT(e,t,n)});function rT(e,t,n){let i=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},r=e._zod.bag.fallbackRun,o;if(r?(i[tT]=!0,o=r({value:t,issues:[]},i)):o=e._zod.run({value:t,issues:[]},i),o instanceof Promise)throw new It;return o.issues.length===0}var Li=async(e,t,n)=>{let i=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},r=e._zod.run({value:t,issues:[]},i);return r instanceof Promise&&(r=await r),r.issues.length===0},Oc=e=>{let t=Ai(e),n=(i,r,o,a)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return t(i,r,s,Tc(n,a))};return n},y$=Oc(zt),jc=e=>{let t=Ai(e),n=(i,r,o,a)=>t(i,r,o,Tc(n,a));return n},_$=jc(zt),Ec=e=>{let t=Di(e),n=async(i,r,o,a)=>{let s=o?{...o,direction:"backward"}:{direction:"backward"};return await t(i,r,s,Tc(n,a))};return n},$$=Ec(zt),Nc=e=>{let t=Di(e),n=async(i,r,o,a)=>await t(i,r,o,Tc(n,a));return n},b$=Nc(zt),Ac=e=>(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return Ri(e)(t,n,r)},x$=Ac(zt),Dc=e=>(t,n,i)=>Ri(e)(t,n,i),w$=Dc(zt),Rc=e=>async(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return Ui(e)(t,n,r)},k$=Rc(zt),Cc=e=>async(t,n,i)=>Ui(e)(t,n,i),S$=Cc(zt);var Zt={};Nr(Zt,{anyString:()=>sm,base64:()=>Yp,base64url:()=>Qp,bigint:()=>um,boolean:()=>lm,browserEmail:()=>lT,cidrv4:()=>Wp,cidrv6:()=>Xp,creditCard:()=>Uc,cuid:()=>Rp,cuid2:()=>Cp,currencyCode:()=>nm,date:()=>im,datetime:()=>am,domain:()=>tm,duration:()=>Fp,e164:()=>rm,email:()=>Bp,emoji:()=>Jp,extendedDuration:()=>nT,guid:()=>qp,hex:()=>hm,hostname:()=>em,html5Email:()=>sT,httpProtocol:()=>wa,iban:()=>Zc,idnEmail:()=>uT,integer:()=>ka,ipv4:()=>Hp,ipv6:()=>Kp,ksuid:()=>Mp,lowercase:()=>pm,mac:()=>Gp,md5_base64:()=>mT,md5_base64url:()=>hT,md5_hex:()=>pT,nanoid:()=>Lp,nanoidOfLength:()=>Vp,null:()=>dm,number:()=>Mr,rfc5322Email:()=>cT,sha1_base64:()=>vT,sha1_base64url:()=>yT,sha1_hex:()=>gT,sha256_base64:()=>$T,sha256_base64url:()=>bT,sha256_hex:()=>_T,sha384_base64:()=>wT,sha384_base64url:()=>kT,sha384_hex:()=>xT,sha512_base64:()=>IT,sha512_base64url:()=>zT,sha512_hex:()=>ST,string:()=>cm,time:()=>om,ulid:()=>Up,undefined:()=>fm,unicodeEmail:()=>I$,uppercase:()=>mm,uuid:()=>An,uuid4:()=>iT,uuid6:()=>oT,uuid7:()=>aT,xid:()=>Zp});var Rp=/^[cC][0-9a-z]{6,}$/,Cp=/^[0-9a-z]+$/,Up=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Zp=/^[0-9a-vA-V]{20}$/,Mp=/^[A-Za-z0-9]{27}$/,Lp=/^[a-zA-Z0-9_-]{21}$/;function Vp(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Fp=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,nT=/^[-+]?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)?)??$/,qp=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,An=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,iT=An(4),oT=An(6),aT=An(7),Bp=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,sT=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,cT=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,I$=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,uT=I$,lT=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,dT="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Jp(){return new RegExp(dT,"u")}var Hp=/^(?:(?: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])$/,Kp=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Gp=e=>{let t=Kt(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Wp=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Xp=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Yp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Qp=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,em=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,tm=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,wa=/^https?$/,rm=/^\+[1-9]\d{6,14}$/,Uc=/^\d(?:[ -]?\d){11,18}$/,nm=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,Zc=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,z$="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function fT(e){return new RegExp(`^${e}$`)}var im=fT(z$);function Dp(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function om(e){return new RegExp(`^${Dp(e)}$`)}function am(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${Dp({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,i=e.local?`${n}|${Dp({precision:e.precision})}`:n;return new RegExp(`^${z$}T(?:${i})$`)}var sm=/^[\s\S]{0,}$/,cm=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},um=/^-?\d+n?$/,ka=/^-?\d+$/,Mr=/^-?\d+(?:\.\d+)?$/,lm=/^(?:true|false)$/i,dm=/^null$/i;var fm=/^undefined$/i;var pm=/^[^A-Z]*$/,mm=/^[^a-z]*$/,hm=/^[0-9a-fA-F]*$/;function Sa(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Ia(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var pT=/^[0-9a-fA-F]{32}$/,mT=Sa(22,"=="),hT=Ia(22),gT=/^[0-9a-fA-F]{40}$/,vT=Sa(27,"="),yT=Ia(27),_T=/^[0-9a-fA-F]{64}$/,$T=Sa(43,"="),bT=Ia(43),xT=/^[0-9a-fA-F]{96}$/,wT=Sa(64,""),kT=Ia(64),ST=/^[0-9a-fA-F]{128}$/,IT=Sa(86,"=="),zT=Ia(86);var be=v("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),gm=e=>{let t=e.value;return!Sc(t)&&t.size!==void 0},vm=e=>{let t=e.value;return!Sc(t)&&t.length!==void 0},Mc={number:"number",bigint:"bigint",object:"date"},Vc=v("$ZodCheckLessThan",(e,t)=>{be.init(e,t);let n=Mc[typeof t.value];e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:Mc[typeof i.value]??n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Fc=v("$ZodCheckGreaterThan",(e,t)=>{be.init(e,t);let n=Mc[typeof t.value];e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:Mc[typeof i.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ym=v("$ZodCheckMultipleOf",(e,t)=>{be.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):pa(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),_m=v("$ZodCheckNumberFormat",(e,t)=>{be.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),i=n?"int":"number",[r,o]=ha[t.format];e._zod.check=a=>{let s=a.value;if(n){if(!Number.isInteger(s)){a.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}s<r&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),$m=v("$ZodCheckBigIntFormat",(e,t)=>{be.init(e,t);let[n,i]=ga[t.format];e._zod.check=r=>{let o=r.value;o<n&&r.issues.push({origin:"bigint",input:o,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),o>i&&r.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),bm=v("$ZodCheckMaxSize",(e,t)=>{var n;be.init(e,t),(n=e._zod.def).when??(n.when=gm),e._zod.check=i=>{let r=i.value;r.size<=t.maximum||i.issues.push({origin:ya(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),xm=v("$ZodCheckMinSize",(e,t)=>{var n;be.init(e,t),(n=e._zod.def).when??(n.when=gm),e._zod.check=i=>{let r=i.value;r.size>=t.minimum||i.issues.push({origin:ya(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),wm=v("$ZodCheckSizeEquals",(e,t)=>{var n;be.init(e,t),(n=e._zod.def).when??(n.when=gm),e._zod.check=i=>{let r=i.value,o=r.size;if(o===t.size)return;let a=o>t.size;i.issues.push({origin:ya(r),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),km=v("$ZodCheckMaxLength",(e,t)=>{var n;be.init(e,t),(n=e._zod.def).when??(n.when=vm),e._zod.check=i=>{let r=i.value,o=r.length;if((typeof r=="string"&&o>t.maximum?jn(r):o)<=t.maximum)return;let s=_a(r);i.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Sm=v("$ZodCheckMinLength",(e,t)=>{var n;be.init(e,t),(n=e._zod.def).when??(n.when=vm),e._zod.check=i=>{let r=i.value,o=r.length;if((typeof r=="string"&&o>=t.minimum&&o<t.minimum*2?jn(r):o)>=t.minimum)return;let s=_a(r);i.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Im=v("$ZodCheckLengthEquals",(e,t)=>{var n;be.init(e,t),(n=e._zod.def).when??(n.when=vm),e._zod.check=i=>{let r=i.value,o=r.length,a=typeof r=="string"&&o>=t.length&&o<=t.length*2?jn(r):o;if(a===t.length)return;let s=_a(r),c=a>t.length;i.issues.push({origin:s,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),Vi=v("$ZodCheckStringFormat",(e,t)=>{var n,i;be.init(e,t),t.pattern?(n=e._zod).check??(n.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),zm=v("$ZodCheckRegex",(e,t)=>{Vi.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Pm=v("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=pm),Vi.init(e,t)}),Tm=v("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=mm),Vi.init(e,t)}),Om=v("$ZodCheckIncludes",(e,t)=>{be.init(e,t);let n=Kt(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=i,e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),jm=v("$ZodCheckStartsWith",(e,t)=>{be.init(e,t);let n=new RegExp(`^${Kt(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),Em=v("$ZodCheckEndsWith",(e,t)=>{be.init(e,t);let n=new RegExp(`.*${Kt(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});function Lc(e,t,n){e.issues.length&&t.issues.push(...kt(n,e.issues))}var Nm=v("$ZodCheckProperty",(e,t)=>{be.init(e,t),e._zod.check=n=>{let i=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then(r=>Lc(r,n,t.property));Lc(i,n,t.property)}}),Am=v("$ZodCheckProperties",(e,t)=>{be.init(e,t),$a(e,Symbol.iterator,function*(){yield e});let n;e._zod.check=i=>{if(i.value==null){i.issues.push({expected:"object",code:"invalid_type",input:i.value,inst:e});return}n??(n=Reflect.ownKeys(t.shape).map(a=>[a,t.shape[a]]));let r=i.value,o;for(let[a,s]of n){let c=s._zod.run({value:r[a],issues:[]},{});c instanceof Promise?(o??(o=[]),o.push(c.then(u=>Lc(u,i,a)))):Lc(c,i,a)}if(o)return Promise.all(o).then(()=>{})}}),Dm=v("$ZodCheckMimeType",(e,t)=>{be.init(e,t);let n=new Set(t.mime);e._zod.check=i=>{n.has(i.value.type)||i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,inst:e,continue:!t.abort})}}),Rm=v("$ZodCheckOverwrite",(e,t)=>{be.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});var Dn=class{constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let i=t.split(`
12
12
  `).filter(a=>a),r=Math.min(...i.map(a=>a.length-a.trimStart().length)),o=i.map(a=>a.slice(r)).map(a=>" ".repeat(this.indent*2)+a);for(let a of o)this.content.push(a)}compile(){let t=Function,n=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
13
13
  ${n.join(`
@@ -75,9 +75,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
75
75
  `:`[${i[c]}\r
76
76
  ]`;continue}r+=i[c],i[c]==="\\"?o=!0:a&&i[c]==="]"?a=!1:!a&&i[c]==="["&&(a=!0)}try{new RegExp(r)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return r}function cf(e,t){if(t.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),t.target==="openApi3"&&e.keyType?._def.typeName===P.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((i,r)=>({...i,[r]:B(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",r]})??Ne(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let n={type:"object",additionalProperties:B(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return n;if(e.keyType?._def.typeName===P.ZodString&&e.keyType._def.checks?.length){let{type:i,...r}=sf(e.keyType._def,t);return{...n,propertyNames:r}}else{if(e.keyType?._def.typeName===P.ZodEnum)return{...n,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===P.ZodBranded&&e.keyType._def.type._def.typeName===P.ZodString&&e.keyType._def.type._def.checks?.length){let{type:i,...r}=af(e.keyType._def,t);return{...n,propertyNames:r}}}return n}function Zk(e,t){if(t.mapStrategy==="record")return cf(e,t);let n=B(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Ne(t),i=B(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Ne(t);return{type:"array",maxItems:125,items:{type:"array",items:[n,i],minItems:2,maxItems:2}}}function Mk(e){let t=e.values,i=Object.keys(e.values).filter(o=>typeof t[t[o]]!="number").map(o=>t[o]),r=Array.from(new Set(i.map(o=>typeof o)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:i}}function Lk(e){return e.target==="openAi"?void 0:{not:Ne({...e,currentPath:[...e.currentPath,"not"]})}}function Vk(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Cs={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function qk(e,t){if(t.target==="openApi3")return Fk(e,t);let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(i=>i._def.typeName in Cs&&(!i._def.checks||!i._def.checks.length))){let i=n.reduce((r,o)=>{let a=Cs[o._def.typeName];return a&&!r.includes(a)?[...r,a]:r},[]);return{type:i.length>1?i:i[0]}}else if(n.every(i=>i._def.typeName==="ZodLiteral"&&!i.description)){let i=n.reduce((r,o)=>{let a=typeof o._def.value;switch(a){case"string":case"number":case"boolean":return[...r,a];case"bigint":return[...r,"integer"];case"object":if(o._def.value===null)return[...r,"null"];default:return r}},[]);if(i.length===n.length){let r=i.filter((o,a,s)=>s.indexOf(o)===a);return{type:r.length>1?r:r[0],enum:n.reduce((o,a)=>o.includes(a._def.value)?o:[...o,a._def.value],[])}}}else if(n.every(i=>i._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((i,r)=>[...i,...r._def.values.filter(o=>!i.includes(o))],[])};return Fk(e,t)}var Fk=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((i,r)=>B(i._def,{...t,currentPath:[...t.currentPath,"anyOf",`${r}`]})).filter(i=>!!i&&(!t.strictUnions||typeof i=="object"&&Object.keys(i).length>0));return n.length?{anyOf:n}:void 0};function Bk(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target==="openApi3"?{type:Cs[e.innerType._def.typeName],nullable:!0}:{type:[Cs[e.innerType._def.typeName],"null"]};if(t.target==="openApi3"){let i=B(e.innerType._def,{...t,currentPath:[...t.currentPath]});return i&&"$ref"in i?{allOf:[i],nullable:!0}:i&&{...i,nullable:!0}}let n=B(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function Jk(e,t){let n={type:"number"};if(!e.checks)return n;for(let i of e.checks)switch(i.kind){case"int":n.type="integer",xv(n,"type",i.message,t);break;case"min":t.target==="jsonSchema7"?i.inclusive?ce(n,"minimum",i.value,i.message,t):ce(n,"exclusiveMinimum",i.value,i.message,t):(i.inclusive||(n.exclusiveMinimum=!0),ce(n,"minimum",i.value,i.message,t));break;case"max":t.target==="jsonSchema7"?i.inclusive?ce(n,"maximum",i.value,i.message,t):ce(n,"exclusiveMaximum",i.value,i.message,t):(i.inclusive||(n.exclusiveMaximum=!0),ce(n,"maximum",i.value,i.message,t));break;case"multipleOf":ce(n,"multipleOf",i.value,i.message,t);break}return n}function Hk(e,t){let n=t.target==="openAi",i={type:"object",properties:{}},r=[],o=e.shape();for(let s in o){let c=o[s];if(c===void 0||c._def===void 0)continue;let u=EN(c);u&&n&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=B(c._def,{...t,currentPath:[...t.currentPath,"properties",s],propertyPath:[...t.currentPath,"properties",s]});l!==void 0&&(i.properties[s]=l,u||r.push(s))}r.length&&(i.required=r);let a=jN(e,t);return a!==void 0&&(i.additionalProperties=a),i}function jN(e,t){if(e.catchall._def.typeName!=="ZodNever")return B(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function EN(e){try{return e.isOptional()}catch{return!0}}var Kk=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return B(e.innerType._def,t);let n=B(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:Ne(t)},n]}:Ne(t)};var Gk=(e,t)=>{if(t.pipeStrategy==="input")return B(e.in._def,t);if(t.pipeStrategy==="output")return B(e.out._def,t);let n=B(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),i=B(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,i].filter(r=>r!==void 0)}};function Wk(e,t){return B(e.type._def,t)}function Xk(e,t){let i={type:"array",uniqueItems:!0,items:B(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&ce(i,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&ce(i,"maxItems",e.maxSize.value,e.maxSize.message,t),i}function Yk(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,i)=>B(n._def,{...t,currentPath:[...t.currentPath,"items",`${i}`]})).reduce((n,i)=>i===void 0?n:[...n,i],[]),additionalItems:B(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,i)=>B(n._def,{...t,currentPath:[...t.currentPath,"items",`${i}`]})).reduce((n,i)=>i===void 0?n:[...n,i],[])}}function Qk(e){return{not:Ne(e)}}function e0(e){return Ne(e)}var t0=(e,t)=>B(e.innerType._def,t);var r0=(e,t,n)=>{switch(t){case P.ZodString:return sf(e,n);case P.ZodNumber:return Jk(e,n);case P.ZodObject:return Hk(e,n);case P.ZodBigInt:return Ok(e,n);case P.ZodBoolean:return jk();case P.ZodDate:return wv(e,n);case P.ZodUndefined:return Qk(n);case P.ZodNull:return Vk(n);case P.ZodArray:return Tk(e,n);case P.ZodUnion:case P.ZodDiscriminatedUnion:return qk(e,n);case P.ZodIntersection:return Rk(e,n);case P.ZodTuple:return Yk(e,n);case P.ZodRecord:return cf(e,n);case P.ZodLiteral:return Ck(e,n);case P.ZodEnum:return Dk(e);case P.ZodNativeEnum:return Mk(e);case P.ZodNullable:return Bk(e,n);case P.ZodOptional:return Kk(e,n);case P.ZodMap:return Zk(e,n);case P.ZodSet:return Xk(e,n);case P.ZodLazy:return()=>e.getter()._def;case P.ZodPromise:return Wk(e,n);case P.ZodNaN:case P.ZodNever:return Lk(n);case P.ZodEffects:return Ak(e,n);case P.ZodAny:return Ne(n);case P.ZodUnknown:return e0(n);case P.ZodDefault:return Nk(e,n);case P.ZodBranded:return af(e,n);case P.ZodReadonly:return t0(e,n);case P.ZodCatch:return Ek(e,n);case P.ZodPipeline:return Gk(e,n);case P.ZodFunction:case P.ZodVoid:case P.ZodSymbol:return;default:return(i=>{})(t)}};function B(e,t,n=!1){let i=t.seen.get(e);if(t.override){let s=t.override?.(e,t,i,n);if(s!==Ik)return s}if(i&&!n){let s=NN(i,t);if(s!==void 0)return s}let r={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,r);let o=r0(e,e.typeName,t),a=typeof o=="function"?B(o(),t):o;if(a&&AN(e,t,a),t.postProcess){let s=t.postProcess(a,e,t);return r.jsonSchema=a,s}return r.jsonSchema=a,a}var NN=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:of(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((n,i)=>t.currentPath[i]===n)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Ne(t)):t.$refStrategy==="seen"?Ne(t):void 0}},AN=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n);var Iv=(e,t)=>{let n=Pk(t),i=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[u,l])=>({...c,[u]:B(l._def,{...n,currentPath:[...n.basePath,n.definitionPath,u]},!0)??Ne(n)}),{}):void 0,r=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,o=B(e._def,r===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,r]},!1)??Ne(n),a=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;a!==void 0&&(o.title=a),n.flags.hasReferencedOpenAiAnyType&&(i||(i={}),i[n.openAiAnyTypeName]||(i[n.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:n.$refStrategy==="relative"?"1":[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join("/")}}));let s=r===void 0?i?{...o,[n.definitionPath]:i}:o:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,r].join("/"),[n.definitionPath]:{...i,[r]:o}};return n.target==="jsonSchema7"?s.$schema="http://json-schema.org/draft-07/schema#":(n.target==="jsonSchema2019-09"||n.target==="openAi")&&(s.$schema="https://json-schema.org/draft/2019-09/schema#"),n.target==="openAi"&&("anyOf"in s||"oneOf"in s||"allOf"in s||"type"in s&&Array.isArray(s.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),s};function DN(e){return!e||e==="jsonSchema7"||e==="draft-7"?"draft-7":e==="jsonSchema2019-09"||e==="draft-2020-12"?"draft-2020-12":"draft-7"}function zv(e,t){return wr(e)?Vn(e,{target:DN(t?.target),io:t?.pipeStrategy??"input"}):Iv(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function Pv(e){let n=ln(e)?.method;if(!n)throw new Error("Schema is missing a method literal");let i=vo(n);if(typeof i!="string")throw new Error("Schema method literal must be a string");return i}function Tv(e,t){let n=un(e,t);if(!n.success)throw n.error;return n.data}var RN=6e4,uf=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Ld,n=>{this._oncancel(n)}),this.setNotificationHandler(Fd,n=>{this._onprogress(n)}),this.setRequestHandler(Vd,n=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(qd,async(n,i)=>{let r=await this._taskStore.getTask(n.params.taskId,i.sessionId);if(!r)throw new R(M.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(Jd,async(n,i)=>{let r=async()=>{let o=n.params.taskId;if(!await this._taskStore.getTask(o,i.sessionId))throw new R(M.InvalidParams,`Task not found: ${o}`);if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(o,i.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let d=c,f=new R(d.error.code,d.error.message,d.error.data);l(f)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:i.requestId})}}let a=await this._taskStore.getTask(o,i.sessionId);if(!a)throw new R(M.InvalidParams,`Task not found: ${o}`);if(!gn(a.status))return await this._waitForTaskUpdate(o,i.signal,i.sessionId),await r();if(gn(a.status)){let s=await this._taskStore.getTaskResult(o,i.sessionId);return this._clearTaskQueue(o,i.sessionId),{...s,_meta:{...s._meta,[hn]:{taskId:o}}}}return await r()};return await r()}),this.setRequestHandler(Hd,async(n,i)=>{try{let{tasks:r,nextCursor:o}=await this._taskStore.listTasks(n.params?.cursor,i.sessionId);return{tasks:r,nextCursor:o,_meta:{}}}catch(r){throw new R(M.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(Gd,async(n,i)=>{try{let r=await this._taskStore.getTask(n.params.taskId,i.sessionId);if(!r)throw new R(M.InvalidParams,`Task not found: ${n.params.taskId}`);if(gn(r.status))throw new R(M.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",i.sessionId),this._clearTaskQueue(n.params.taskId,i.sessionId);let o=await this._taskStore.getTask(n.params.taskId,i.sessionId);if(!o)throw new R(M.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...o}}catch(r){throw r instanceof R?r:new R(M.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,n,i,r,o=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(r,n),startTime:Date.now(),timeout:n,maxTotalTimeout:i,resetTimeoutOnProgress:o,onTimeout:r})}_resetTimeout(t){let n=this._timeoutInfo.get(t);if(!n)return!1;let i=Date.now()-n.startTime;if(n.maxTotalTimeout&&i>=n.maxTotalTimeout)throw this._timeoutInfo.delete(t),R.fromError(M.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:i});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(t){let n=this._timeoutInfo.get(t);n&&(clearTimeout(n.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let n=this.transport?.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let i=this.transport?.onerror;this._transport.onerror=o=>{i?.(o),this._onerror(o)};let r=this._transport?.onmessage;this._transport.onmessage=(o,a)=>{r?.(o,a),Ps(o)||mk(o)?this._onresponse(o):cv(o)?this._onrequest(o,a):pk(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let i of this._timeoutInfo.values())clearTimeout(i.timeoutId);this._timeoutInfo.clear();for(let i of this._requestHandlerAbortControllers.values())i.abort();this._requestHandlerAbortControllers.clear();let n=R.fromError(M.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let i of t.values())i(n)}_onerror(t){this.onerror?.(t)}_onnotification(t){let n=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(t)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(t,n){let i=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,r=this._transport,o=t.params?._meta?.[hn]?.taskId,a=r?.sessionId,s=this._taskStore,c=!0,u;if(o&&s&&this._taskMessageQueue&&a!==void 0&&(c=!1,u=(async()=>{if(!await s.getTask(o,a))throw new R(M.InvalidParams,`Task not found: ${o}`);c=!0})()),i===void 0){let m={jsonrpc:"2.0",id:t.id,error:{code:M.MethodNotFound,message:"Method not found"}};if(o&&u){let h={type:"error",message:m,timestamp:Date.now()};u.then(()=>this._enqueueTaskMessage(o,h,a),()=>r?.send(m)).catch(g=>this._onerror(new Error(`Failed to send an error response: ${g}`)))}else o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:m,timestamp:Date.now()},r?.sessionId).catch(h=>this._onerror(new Error(`Failed to enqueue error response: ${h}`))):r?.send(m).catch(h=>this._onerror(new Error(`Failed to send an error response: ${h}`)));return}let l=new AbortController;this._requestHandlerAbortControllers.set(t.id,l);let d=lk(t.params)?t.params.task:void 0,f=this._taskStore?this.requestTaskStore(t,r?.sessionId):void 0,p={signal:l.signal,sessionId:r?.sessionId,_meta:t.params?._meta,sendNotification:async m=>{if(l.signal.aborted)return;let h={relatedRequestId:t.id};o&&(h.relatedTask={taskId:o}),await this.notification(m,h)},sendRequest:async(m,h,g)=>{if(l.signal.aborted)throw new R(M.ConnectionClosed,"Request was cancelled");let _={...g,relatedRequestId:t.id};o&&!_.relatedTask&&(_.relatedTask={taskId:o});let $=_.relatedTask?.taskId??o;return $&&f&&await f.updateTaskStatus($,"input_required"),await this.request(m,h,_)},authInfo:n?.authInfo,requestId:t.id,requestInfo:n?.requestInfo,taskId:o,taskStore:f,taskRequestedTtl:d?.ttl,closeSSEStream:n?.closeSSEStream,closeStandaloneSSEStream:n?.closeStandaloneSSEStream};(u??Promise.resolve()).then(()=>{if(u&&l.signal.aborted)throw new R(M.ConnectionClosed,"Request was cancelled");d&&this.assertTaskHandlerCapability(t.method)}).then(()=>i(t,p)).then(async m=>{if(l.signal.aborted)return;let h={result:m,jsonrpc:"2.0",id:t.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:h,timestamp:Date.now()},r?.sessionId):await r?.send(h)},async m=>{if(l.signal.aborted)return;let h={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(m.code)?m.code:M.InternalError,message:m.message??"Internal error",...m.data!==void 0&&{data:m.data}}};o&&this._taskMessageQueue&&c?await this._enqueueTaskMessage(o,{type:"error",message:h,timestamp:Date.now()},r?.sessionId):await r?.send(h)}).catch(m=>this._onerror(new Error(`Failed to send response: ${m}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===l&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:n,...i}=t.params,r=Number(n),o=this._progressHandlers.get(r);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let a=this._responseHandlers.get(r),s=this._timeoutInfo.get(r);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(c){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(c);return}o(i)}_onresponse(t){let n=Number(t.id),i=this._requestResolvers.get(n);if(i){if(this._requestResolvers.delete(n),Ps(t))i(t);else{let a=new R(t.error.code,t.error.message,t.error.data);i(a)}return}let r=this._responseHandlers.get(n);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let o=!1;if(Ps(t)&&t.result&&typeof t.result=="object"){let a=t.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(o=!0,this._taskProgressTokens.set(s.taskId,n))}}if(o||this._progressHandlers.delete(n),Ps(t))r(t);else{let a=R.fromError(t.error.code,t.error.message,t.error.data);r(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,n,i){let{task:r}=i??{};if(!r){try{yield{type:"result",result:await this.request(t,n,i)}}catch(a){yield{type:"error",error:a instanceof R?a:new R(M.InternalError,String(a))}}return}let o;try{let a=await this.request(t,zo,i);if(a.task)o=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new R(M.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:o},i);if(yield{type:"taskStatus",task:s},gn(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},n,i)}:s.status==="failed"?yield{type:"error",error:new R(M.InternalError,`Task ${o} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new R(M.InternalError,`Task ${o} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},n,i)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),i?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof R?a:new R(M.InternalError,String(a))}}}request(t,n,i){let{relatedRequestId:r,resumptionToken:o,onresumptiontoken:a,task:s,relatedTask:c}=i??{};return new Promise((u,l)=>{let d=$=>{l($)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),s&&this.assertTaskCapability(t.method)}catch($){d($);return}i?.signal?.throwIfAborted();let f=this._requestMessageId++,p={...t,jsonrpc:"2.0",id:f};i?.onprogress&&(this._progressHandlers.set(f,i.onprogress),p.params={...t.params,_meta:{...t.params?._meta||{},progressToken:f}}),s&&(p.params={...p.params,task:s}),c&&(p.params={...p.params,_meta:{...p.params?._meta||{},[hn]:c}});let m=$=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String($)}},{relatedRequestId:r,resumptionToken:o,onresumptiontoken:a}).catch(O=>this._onerror(new Error(`Failed to send cancellation: ${O}`)));let k=$ instanceof R?$:new R(M.RequestTimeout,String($));l(k)};this._responseHandlers.set(f,$=>{if(!i?.signal?.aborted){if($ instanceof Error)return l($);try{let k=un(n,$.result);k.success?u(k.data):l(k.error)}catch(k){l(k)}}}),i?.signal?.addEventListener("abort",()=>{m(i?.signal?.reason)});let h=i?.timeout??RN,g=()=>m(R.fromError(M.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(f,h,i?.maxTotalTimeout,g,i?.resetTimeoutOnProgress??!1);let _=c?.taskId;if(_){let $=k=>{let O=this._responseHandlers.get(f);O?O(k):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,$),this._enqueueTaskMessage(_,{type:"request",message:p,timestamp:Date.now()}).catch(k=>{this._cleanupTimeout(f),l(k)})}else this._transport.send(p,{relatedRequestId:r,resumptionToken:o,onresumptiontoken:a}).catch($=>{this._cleanupTimeout(f),l($)})})}async getTask(t,n){return this.request({method:"tasks/get",params:t},Bd,n)}async getTaskResult(t,n,i){return this.request({method:"tasks/result",params:t},n,i)}async listTasks(t,n){return this.request({method:"tasks/list",params:t},Kd,n)}async cancelTask(t,n){return this.request({method:"tasks/cancel",params:t},vk,n)}async notification(t,n){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let i=n?.relatedTask?.taskId;if(i){let s={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[hn]:n.relatedTask}}};await this._enqueueTaskMessage(i,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!n?.relatedRequestId&&!n?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let s={...t,jsonrpc:"2.0"};n?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[hn]:n.relatedTask}}}),this._transport?.send(s,n).catch(c=>this._onerror(c))});return}let a={...t,jsonrpc:"2.0"};n?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[hn]:n.relatedTask}}}),await this._transport.send(a,n)}setRequestHandler(t,n){let i=Pv(t);this.assertRequestHandlerCapability(i),this._requestHandlers.set(i,(r,o)=>{let a=Tv(t,r);return Promise.resolve(n(a,o))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,n){let i=Pv(t);this._notificationHandlers.set(i,r=>{let o=Tv(t,r);return Promise.resolve(n(o))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let n=this._taskProgressTokens.get(t);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,n,i){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,n,i??this._transport?.sessionId,r)}async _clearTaskQueue(t,n){if(this._taskMessageQueue){let i=await this._taskMessageQueue.dequeueAll(t,n);for(let r of i)if(r.type==="request"&&cv(r.message)){let o=r.message.id,a=this._requestResolvers.get(o);a?(a(new R(M.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,n,i){let r=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t,i);o?.pollInterval&&(r=o.pollInterval)}catch{}return new Promise((o,a)=>{if(n.aborted){a(new R(M.InvalidRequest,"Request cancelled"));return}let s=setTimeout(o,r);n.addEventListener("abort",()=>{clearTimeout(s),a(new R(M.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,n){let i=this._taskStore;if(!i)throw new Error("No task store configured");return{createTask:async r=>{if(!t)throw new Error("No request provided");return await i.createTask(r,t.id,{method:t.method,params:t.params},n)},getTask:async r=>{let o=await i.getTask(r,n);if(!o)throw new R(M.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(r,o,a)=>{await i.storeTaskResult(r,o,a,n);let s=await i.getTask(r,n);if(s){let c=Ns.parse({method:"notifications/tasks/status",params:s});await this.notification(c),gn(s.status)&&this._cleanupTaskProgressHandler(r)}},getTaskResult:r=>i.getTaskResult(r,n),updateTaskStatus:async(r,o,a)=>{let s=await i.getTask(r,n);if(!s)throw new R(M.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(gn(s.status))throw new R(M.InvalidParams,`Cannot update task "${r}" from terminal status "${s.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await i.updateTaskStatus(r,o,a,n);let c=await i.getTask(r,n);if(c){let u=Ns.parse({method:"notifications/tasks/status",params:c});await this.notification(u),gn(c.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>i.listTasks(r,n)}}};function n0(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function i0(e,t){let n={...e};for(let i in t){let r=i,o=t[r];if(o===void 0)continue;let a=n[r];n0(a)&&n0(o)?n[r]={...a,...o}:n[r]=o}return n}var az=J_($_(),1),sz=J_(oz(),1);function G6(){let e=new az.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,sz.default)(e),e}var Kf=class{constructor(t){this._ajv=t??G6()}getValidator(t){let n="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return i=>n(i)?{valid:!0,data:i,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}};var Gf=class{constructor(t){this._server=t}requestStream(t,n,i){return this._server.requestStream(t,n,i)}createMessageStream(t,n){let i=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!i?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let r=t.messages[t.messages.length-1],o=Array.isArray(r.content)?r.content:[r.content],a=o.some(l=>l.type==="tool_result"),s=t.messages.length>1?t.messages[t.messages.length-2]:void 0,c=s?Array.isArray(s.content)?s.content:[s.content]:[],u=c.some(l=>l.type==="tool_use");if(a){if(o.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(f=>f.type==="tool_use").map(f=>f.id)),d=new Set(o.filter(f=>f.type==="tool_result").map(f=>f.toolUseId));if(l.size!==d.size||![...l].every(f=>d.has(f)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:t},Rs,n)}elicitInputStream(t,n){let i=this._server.getClientCapabilities(),r=t.mode??"form";switch(r){case"url":{if(!i?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!i?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let o=r==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:o},Oo,n)}async getTask(t,n){return this._server.getTask({taskId:t},n)}async getTaskResult(t,n,i){return this._server.getTaskResult({taskId:t},n,i)}async listTasks(t,n){return this._server.listTasks(t?{cursor:t}:void 0,n)}async cancelTask(t,n){return this._server.cancelTask({taskId:t},n)}};function cz(e,t,n){if(!e)throw new Error(`${n} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${n} does not support task creation for tools/call (required for ${t})`);break;default:break}}function uz(e,t,n){if(!e)throw new Error(`${n} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${n} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${n} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var Wf=class extends uf{constructor(t,n){super(n),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Ds.options.map((i,r)=>[i,r])),this.isMessageIgnored=(i,r)=>{let o=this._loggingLevels.get(r);return o?this.LOG_LEVEL_SEVERITY.get(i)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=n?.capabilities??{},this._instructions=n?.instructions,this._jsonSchemaValidator=n?.jsonSchemaValidator??new Kf,this.setRequestHandler(dv,i=>this._oninitialize(i)),this.setNotificationHandler(fv,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(_v,async(i,r)=>{let o=r.sessionId||r.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=i.params,s=Ds.safeParse(a);return s.success&&this._loggingLevels.set(o,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Gf(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=i0(this._capabilities,t)}setRequestHandler(t,n){let r=ln(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=vo(r);if(typeof o!="string")throw new Error("Schema method literal must be a string");if(o==="tools/call"){let s=async(c,u)=>{let l=un(To,c);if(!l.success){let m=l.error instanceof Error?l.error.message:String(l.error);throw new R(M.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=l.data,f=await Promise.resolve(n(c,u));if(d.task){let m=un(zo,f);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new R(M.InvalidParams,`Invalid task creation result: ${h}`)}return m.data}let p=un(rf,f);if(!p.success){let m=p.error instanceof Error?p.error.message:String(p.error);throw new R(M.InvalidParams,`Invalid tools/call result: ${m}`)}return p.data};return super.setRequestHandler(t,s)}return super.setRequestHandler(t,n)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){uz(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&cz(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let n=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:sk.includes(n)?n:av,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Md)}async createMessage(t,n){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let i=t.messages[t.messages.length-1],r=Array.isArray(i.content)?i.content:[i.content],o=r.some(u=>u.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],c=s.some(u=>u.type==="tool_use");if(o){if(r.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(s.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(r.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},$v,n):this.request({method:"sampling/createMessage",params:t},Rs,n)}async elicitInput(t,n){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let r=t;return this.request({method:"elicitation/create",params:r},Oo,n)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let r=t.mode==="form"?t:{...t,mode:"form"},o=await this.request({method:"elicitation/create",params:r},Oo,n);if(o.action==="accept"&&o.content&&r.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(r.requestedSchema)(o.content);if(!s.valid)throw new R(M.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof R?a:new R(M.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return o}}}createElicitationCompletionNotifier(t,n){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},n)}async listRoots(t,n){return this.request({method:"roots/list",params:t},bv,n)}async sendLoggingMessage(t,n){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,n))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var dz=Symbol.for("mcp.completable");function P_(e){return!!e&&typeof e=="object"&&dz in e}function fz(e){return e[dz]?.complete}var lz;(function(e){e.Completable="McpCompletable"})(lz||(lz={}));var W6=/^[A-Za-z0-9._-]{1,128}$/;function X6(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),e.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(e.startsWith("-")||e.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(e.startsWith(".")||e.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!W6.test(e)){let n=e.split("").filter(i=>!/[A-Za-z0-9._-]/.test(i)).filter((i,r,o)=>o.indexOf(i)===r);return t.push(`Tool name contains invalid characters: ${n.map(i=>`"${i}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function Y6(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let n of t)console.warn(` - ${n}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function T_(e){let t=X6(e);return Y6(e,t.warnings),t.isValid}var Xf=class{constructor(t){this._mcpServer=t}registerToolTask(t,n,i){let r={taskSupport:"required",...n.execution};if(r.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${t}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(t,n.title,n.description,n.inputSchema,n.outputSchema,n.annotations,r,n._meta,i)}};function Q6(e,t){let n=0,i=[e];for(;i.length>0;){let r=i.pop();if(!(r===null||typeof r!="object"))if(Array.isArray(r))for(let o of r){if(++n>t)return n;o!==null&&typeof o=="object"&&i.push(o)}else for(let o in r){if(!Object.prototype.hasOwnProperty.call(r,o))continue;if(++n>t)return n;let a=r[o];a!==null&&typeof a=="object"&&i.push(a)}}return n}function eU(e){if(!(e===void 0||e===1/0)){if(typeof e!="number"||Number.isNaN(e)||e<1)throw new RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(e)}`);return e}}var Yf=class{constructor(t,n){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Wf(t,n),this._maxToolInputElements=eU(n?.maxToolInputElements),n?.capabilities?.tools&&this.setToolRequestHandlers(),n?.capabilities?.resources&&this.setResourceRequestHandlers(),n?.capabilities?.prompts&&this.setPromptRequestHandlers()}get experimental(){return this._experimental||(this._experimental={tasks:new Xf(this)}),this._experimental}async connect(t){return await this.server.connect(t)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Sn(tf)),this.server.assertCanSetRequestHandler(Sn(To)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(tf,()=>({tools:Object.entries(this._registeredTools).filter(([,t])=>t.enabled).map(([t,n])=>{let i={name:t,title:n.title,description:n.description,inputSchema:(()=>{let r=go(n.inputSchema);return r?zv(r,{strictUnions:!0,pipeStrategy:"input"}):tU})(),annotations:n.annotations,execution:n.execution,_meta:n._meta};if(n.outputSchema){let r=go(n.outputSchema);r&&(i.outputSchema=zv(r,{strictUnions:!0,pipeStrategy:"output"}))}return i})})),this.server.setRequestHandler(To,async(t,n)=>{try{let i=this._registeredTools[t.params.name];if(!i)throw new R(M.InvalidParams,`Tool ${t.params.name} not found`);if(!i.enabled)throw new R(M.InvalidParams,`Tool ${t.params.name} disabled`);let r=!!t.params.task,o=i.execution?.taskSupport,a="createTask"in i.handler;if((o==="required"||o==="optional")&&!a)throw new R(M.InternalError,`Tool ${t.params.name} has taskSupport '${o}' but was not registered with registerToolTask`);if(o==="required"&&!r)throw new R(M.MethodNotFound,`Tool ${t.params.name} requires task augmentation (taskSupport: 'required')`);if(o==="optional"&&!r&&a)return await this.handleAutomaticTaskPolling(i,t,n);let s=await this.validateToolInput(i,t.params.arguments,t.params.name),c=await this.executeToolHandler(i,s,n);return r||await this.validateToolOutput(i,c,t.params.name),c}catch(i){if(i instanceof R&&i.code===M.UrlElicitationRequired)throw i;return this.createToolError(i instanceof Error?i.message:String(i))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,n,i){if(this._maxToolInputElements!==void 0&&Q6(n,this._maxToolInputElements)>this._maxToolInputElements)throw new R(M.InvalidParams,`Invalid arguments for tool ${i}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);if(!t.inputSchema)return;let o=go(t.inputSchema)??t.inputSchema,a=await sd(o,n??{});if(!a.success){let s="error"in a?a.error:"Unknown error",c=cd(s);throw new R(M.InvalidParams,`Input validation error: Invalid arguments for tool ${i}: ${c}`)}return a.data}async validateToolOutput(t,n,i){if(!t.outputSchema||!("content"in n)||n.isError)return;if(!n.structuredContent)throw new R(M.InvalidParams,`Output validation error: Tool ${i} has an output schema but no structured content was provided`);let r=go(t.outputSchema),o=await sd(r,n.structuredContent);if(!o.success){let a="error"in o?o.error:"Unknown error",s=cd(a);throw new R(M.InvalidParams,`Output validation error: Invalid structured content for tool ${i}: ${s}`)}}async executeToolHandler(t,n,i){let r=t.handler;if("createTask"in r){if(!i.taskStore)throw new Error("No task store provided.");let a={...i,taskStore:i.taskStore};if(t.inputSchema){let s=r;return await Promise.resolve(s.createTask(n,a))}else{let s=r;return await Promise.resolve(s.createTask(a))}}if(t.inputSchema){let a=r;return await Promise.resolve(a(n,i))}else{let a=r;return await Promise.resolve(a(i))}}async handleAutomaticTaskPolling(t,n,i){if(!i.taskStore)throw new Error("No task store provided for task-capable tool.");let r=await this.validateToolInput(t,n.params.arguments,n.params.name),o=t.handler,a={...i,taskStore:i.taskStore},s=r?await Promise.resolve(o.createTask(r,a)):await Promise.resolve(o.createTask(a)),c=s.task.taskId,u=s.task,l=u.pollInterval??5e3;for(;u.status!=="completed"&&u.status!=="failed"&&u.status!=="cancelled";){await new Promise(f=>setTimeout(f,l));let d=await i.taskStore.getTask(c);if(!d)throw new R(M.InternalError,`Task ${c} not found during polling`);u=d}return await i.taskStore.getTaskResult(c)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Sn(nf)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(nf,async t=>{switch(t.params.ref.type){case"ref/prompt":return wk(t),this.handlePromptCompletion(t,t.params.ref);case"ref/resource":return kk(t),this.handleResourceCompletion(t,t.params.ref);default:throw new R(M.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,n){let i=this._registeredPrompts[n.name];if(!i)throw new R(M.InvalidParams,`Prompt ${n.name} not found`);if(!i.enabled)throw new R(M.InvalidParams,`Prompt ${n.name} disabled`);if(!i.argsSchema)return mc;let o=ln(i.argsSchema)?.[t.params.argument.name];if(!P_(o))return mc;let a=fz(o);if(!a)return mc;let s=await a(t.params.argument.value,t.params.context);return mz(s)}async handleResourceCompletion(t,n){let i=Object.values(this._registeredResourceTemplates).find(a=>a.resourceTemplate.uriTemplate.toString()===n.uri);if(!i){if(this._registeredResources[n.uri])return mc;throw new R(M.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let r=i.resourceTemplate.completeCallback(t.params.argument.name);if(!r)return mc;let o=await r(t.params.argument.value,t.params.context);return mz(o)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Sn(Wd)),this.server.assertCanSetRequestHandler(Sn(Xd)),this.server.assertCanSetRequestHandler(Sn(Yd)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Wd,async(t,n)=>{let i=Object.entries(this._registeredResources).filter(([o,a])=>a.enabled).map(([o,a])=>({uri:o,name:a.name,...a.metadata})),r=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let a=await o.resourceTemplate.listCallback(n);for(let s of a.resources)r.push({...o.metadata,...s})}return{resources:[...i,...r]}}),this.server.setRequestHandler(Xd,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([n,i])=>({name:n,uriTemplate:i.resourceTemplate.uriTemplate.toString(),...i.metadata}))})),this.server.setRequestHandler(Yd,async(t,n)=>{let i=new URL(t.params.uri),r=this._registeredResources[i.toString()];if(r){if(!r.enabled)throw new R(M.InvalidParams,`Resource ${i} disabled`);return r.readCallback(i,n)}for(let o of Object.values(this._registeredResourceTemplates)){let a=o.resourceTemplate.uriTemplate.match(i.toString());if(a)return o.readCallback(i,a,n)}throw new R(M.InvalidParams,`Resource ${i} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Sn(Qd)),this.server.assertCanSetRequestHandler(Sn(ef)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Qd,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,t])=>t.enabled).map(([t,n])=>({name:t,title:n.title,description:n.description,arguments:n.argsSchema?rU(n.argsSchema):void 0}))})),this.server.setRequestHandler(ef,async(t,n)=>{let i=this._registeredPrompts[t.params.name];if(!i)throw new R(M.InvalidParams,`Prompt ${t.params.name} not found`);if(!i.enabled)throw new R(M.InvalidParams,`Prompt ${t.params.name} disabled`);if(i.argsSchema){let r=go(i.argsSchema),o=await sd(r,t.params.arguments??{});if(!o.success){let c="error"in o?o.error:"Unknown error",u=cd(c);throw new R(M.InvalidParams,`Invalid arguments for prompt ${t.params.name}: ${u}`)}let a=o.data,s=i.callback;return await Promise.resolve(s(a,n))}else{let r=i.callback;return await Promise.resolve(r(n))}}),this._promptHandlersInitialized=!0)}resource(t,n,...i){let r;typeof i[0]=="object"&&(r=i.shift());let o=i[0];if(typeof n=="string"){if(this._registeredResources[n])throw new Error(`Resource ${n} is already registered`);let a=this._createRegisteredResource(t,void 0,n,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let a=this._createRegisteredResourceTemplate(t,void 0,n,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}}registerResource(t,n,i,r){if(typeof n=="string"){if(this._registeredResources[n])throw new Error(`Resource ${n} is already registered`);let o=this._createRegisteredResource(t,i.title,n,i,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let o=this._createRegisteredResourceTemplate(t,i.title,n,i,r);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(t,n,i,r,o){let a={name:t,title:n,metadata:r,readCallback:o,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({uri:null}),update:s=>{typeof s.uri<"u"&&s.uri!==i&&(delete this._registeredResources[i],s.uri&&(this._registeredResources[s.uri]=a)),typeof s.name<"u"&&(a.name=s.name),typeof s.title<"u"&&(a.title=s.title),typeof s.metadata<"u"&&(a.metadata=s.metadata),typeof s.callback<"u"&&(a.readCallback=s.callback),typeof s.enabled<"u"&&(a.enabled=s.enabled),this.sendResourceListChanged()}};return this._registeredResources[i]=a,a}_createRegisteredResourceTemplate(t,n,i,r,o){let a={resourceTemplate:i,title:n,metadata:r,readCallback:o,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==t&&(delete this._registeredResourceTemplates[t],u.name&&(this._registeredResourceTemplates[u.name]=a)),typeof u.title<"u"&&(a.title=u.title),typeof u.template<"u"&&(a.resourceTemplate=u.template),typeof u.metadata<"u"&&(a.metadata=u.metadata),typeof u.callback<"u"&&(a.readCallback=u.callback),typeof u.enabled<"u"&&(a.enabled=u.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[t]=a;let s=i.uriTemplate.variableNames;return Array.isArray(s)&&s.some(u=>!!i.completeCallback(u))&&this.setCompletionRequestHandler(),a}_createRegisteredPrompt(t,n,i,r,o){let a={title:n,description:i,argsSchema:r===void 0?void 0:Fn(r),callback:o,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({name:null}),update:s=>{typeof s.name<"u"&&s.name!==t&&(delete this._registeredPrompts[t],s.name&&(this._registeredPrompts[s.name]=a)),typeof s.title<"u"&&(a.title=s.title),typeof s.description<"u"&&(a.description=s.description),typeof s.argsSchema<"u"&&(a.argsSchema=Fn(s.argsSchema)),typeof s.callback<"u"&&(a.callback=s.callback),typeof s.enabled<"u"&&(a.enabled=s.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[t]=a,r&&Object.values(r).some(c=>{let u=c instanceof Hn?c._def?.innerType:c;return P_(u)})&&this.setCompletionRequestHandler(),a}_createRegisteredTool(t,n,i,r,o,a,s,c,u){T_(t);let l={title:n,description:i,inputSchema:pz(r),outputSchema:pz(o),annotations:a,execution:s,_meta:c,handler:u,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==t&&(typeof d.name=="string"&&T_(d.name),delete this._registeredTools[t],d.name&&(this._registeredTools[d.name]=l)),typeof d.title<"u"&&(l.title=d.title),typeof d.description<"u"&&(l.description=d.description),typeof d.paramsSchema<"u"&&(l.inputSchema=Fn(d.paramsSchema)),typeof d.outputSchema<"u"&&(l.outputSchema=Fn(d.outputSchema)),typeof d.callback<"u"&&(l.handler=d.callback),typeof d.annotations<"u"&&(l.annotations=d.annotations),typeof d._meta<"u"&&(l._meta=d._meta),typeof d.enabled<"u"&&(l.enabled=d.enabled),this.sendToolListChanged()}};return this._registeredTools[t]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(t,...n){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let i,r,o,a;if(typeof n[0]=="string"&&(i=n.shift()),n.length>1){let c=n[0];if(O_(c))r=n.shift(),n.length>1&&typeof n[0]=="object"&&n[0]!==null&&!O_(n[0])&&(a=n.shift());else if(typeof c=="object"&&c!==null){if(Object.values(c).some(u=>typeof u=="object"&&u!==null))throw new Error(`Tool ${t} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);a=n.shift()}}let s=n[0];return this._createRegisteredTool(t,void 0,i,r,o,a,{taskSupport:"forbidden"},void 0,s)}registerTool(t,n,i){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let{title:r,description:o,inputSchema:a,outputSchema:s,annotations:c,_meta:u}=n;return this._createRegisteredTool(t,r,o,a,s,c,{taskSupport:"forbidden"},u,i)}prompt(t,...n){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let i;typeof n[0]=="string"&&(i=n.shift());let r;n.length>1&&(r=n.shift());let o=n[0],a=this._createRegisteredPrompt(t,void 0,i,r,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}registerPrompt(t,n,i){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let{title:r,description:o,argsSchema:a}=n,s=this._createRegisteredPrompt(t,r,o,a,i);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(t,n){return this.server.sendLoggingMessage(t,n)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var tU={type:"object",properties:{}};function hz(e){return e!==null&&typeof e=="object"&&"parse"in e&&typeof e.parse=="function"&&"safeParse"in e&&typeof e.safeParse=="function"}function gz(e){return"_def"in e||"_zod"in e||hz(e)}function O_(e){return typeof e!="object"||e===null||gz(e)?!1:Object.keys(e).length===0?!0:Object.values(e).some(hz)}function pz(e){if(e){if(O_(e))return Fn(e);if(!gz(e))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}}function rU(e){let t=ln(e);return t?Object.entries(t).map(([n,i])=>{let r=Rx(i),o=Cx(i);return{name:n,description:r,required:!o}}):[]}function Sn(e){let n=ln(e)?.method;if(!n)throw new Error("Schema is missing a method literal");let i=vo(n);if(typeof i=="string")return i;throw new Error("Schema method literal must be a string")}function mz(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var mc={completion:{values:[],hasMore:!1}};import yz from"node:process";var nU=10*1024*1024,Qf=class{constructor(t){this._maxBufferSize=t?.maxBufferSize??nU}append(t){if((this._buffer?.length??0)+t.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
77
77
  `);if(t===-1)return null;let n=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),iU(n)}clear(){this._buffer=void 0}};function iU(e){return hk.parse(JSON.parse(e))}function vz(e){return JSON.stringify(e)+`
78
- `}var ep=class{constructor(t=yz.stdin,n=yz.stdout,i){this._stdin=t,this._stdout=n,this._started=!1,this._ondata=r=>{try{this._readBuffer.append(r),this.processReadBuffer()}catch(o){this.onerror?.(o),this.close().catch(()=>{})}},this._onerror=r=>{this.onerror?.(r)},this._readBuffer=new Qf({maxBufferSize:i?.maxBufferSize})}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(n=>{let i=vz(t);this._stdout.write(i)?n():this._stdout.once("drain",n)})}};import{readdir as VU,readFile as Zz,stat as FU}from"node:fs/promises";import{basename as Cz,join as qU,relative as BU,sep as JU}from"node:path";import{createRequire as oU}from"module";var aU=oU("/"),Ko,sU,cU;try{Ko=aU("worker_threads"),sU=Ko.Worker,cU=Ko.isMarkedAsUntransferable}catch{}var Ue=Uint8Array,Ft=Uint16Array,L_=Int32Array,tp=new Ue([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),rp=new Ue([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),D_=new Ue([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Sz=function(e,t){for(var n=new Ft(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];for(var r=new L_(n[30]),i=1;i<30;++i)for(var o=n[i];o<n[i+1];++o)r[o]=o-n[i]<<5|i;return{b:n,r}},Ko=Sz(tp,2),Iz=Ko.b,R_=Ko.r;Iz[28]=258,R_[258]=28;var zz=Sz(rp,0),uU=zz.b,_z=zz.r,C_=new Ft(32768);for(ve=0;ve<32768;++ve)Jr=(ve&43690)>>1|(ve&21845)<<1,Jr=(Jr&52428)>>2|(Jr&13107)<<2,Jr=(Jr&61680)>>4|(Jr&3855)<<4,C_[ve]=((Jr&65280)>>8|(Jr&255)<<8)>>1;var Jr,ve,jr=(function(e,t,n){for(var i=e.length,r=0,o=new Ft(t);r<i;++r)e[r]&&++o[e[r]-1];var a=new Ft(t);for(r=1;r<t;++r)a[r]=a[r-1]+o[r-1]<<1;var s;if(n){s=new Ft(1<<t);var c=15-t;for(r=0;r<i;++r)if(e[r])for(var u=r<<4|e[r],l=t-e[r],d=a[e[r]-1]++<<l,f=d|(1<<l)-1;d<=f;++d)s[C_[d]>>c]=u}else for(s=new Ft(i),r=0;r<i;++r)e[r]&&(s[r]=C_[a[e[r]-1]++]>>15-e[r]);return s}),In=new Ue(288);for(ve=0;ve<144;++ve)In[ve]=8;var ve;for(ve=144;ve<256;++ve)In[ve]=9;var ve;for(ve=256;ve<280;++ve)In[ve]=7;var ve;for(ve=280;ve<288;++ve)In[ve]=8;var ve,vc=new Ue(32);for(ve=0;ve<32;++ve)vc[ve]=5;var ve,lU=jr(In,9,0),dU=jr(In,9,1),fU=jr(vc,5,0),pU=jr(vc,5,1),j_=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},hr=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(t&7)&n},E_=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},V_=function(e){return(e+7)/8|0},yc=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Ue(e.subarray(t,n))};var mU=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ut=function(e,t,n){var i=new Error(t||mU[e]);if(i.code=e,Error.captureStackTrace&&Error.captureStackTrace(i,ut),!n)throw i;return i},hU=function(e,t,n,i){var r=e.length,o=i?i.length:0;if(!r||t.f&&!t.l)return n||new Ue(0);var a=!n,s=a||t.i!=2,c=t.i;a&&(n=new Ue(r*3));var u=function(Yo){var Qo=n.length;if(Yo>Qo){var ui=new Ue(Math.max(Qo*2,Yo));ui.set(n),n=ui}},l=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=r*8;do{if(!p){l=hr(e,d,1);var $=hr(e,d+1,3);if(d+=3,$)if($==1)p=dU,m=pU,h=9,g=5;else if($==2){var C=hr(e,d,31)+257,J=hr(e,d+10,15)+4,W=C+hr(e,d+5,31)+1;d+=14;for(var K=new Ue(W),ze=new Ue(19),Te=0;Te<J;++Te)ze[D_[Te]]=hr(e,d+Te*3,7);d+=J*3;for(var Ze=j_(ze),At=(1<<Ze)-1,lt=jr(ze,Ze,1),Te=0;Te<W;){var xt=lt[hr(e,d,At)];d+=xt&15;var k=xt>>4;if(k<16)K[Te++]=k;else{var Je=0,De=0;for(k==16?(De=3+hr(e,d,3),d+=2,Je=K[Te-1]):k==17?(De=3+hr(e,d,7),d+=3):k==18&&(De=11+hr(e,d,127),d+=7);De--;)K[Te++]=Je}}var wt=K.subarray(0,C),He=K.subarray(C);h=j_(wt),g=j_(He),p=jr(wt,h,1),m=jr(He,g,1)}else ut(1);else{var k=V_(d)+4,O=e[k-4]|e[k-3]<<8,T=k+O;if(T>r){c&&ut(0);break}s&&u(f+O),n.set(e.subarray(k,T),f),t.b=f+=O,t.p=d=T*8,t.f=l;continue}if(d>_){c&&ut(0);break}}s&&u(f+131072);for(var Xo=(1<<h)-1,qt=(1<<g)-1,Er=d;;Er=d){var Je=p[E_(e,d)&Xo],Dt=Je>>4;if(d+=Je&15,d>_){c&&ut(0);break}if(Je||ut(2),Dt<256)n[f++]=Dt;else if(Dt==256){Er=d,p=null;break}else{var Rt=Dt-254;if(Dt>264){var Te=Dt-257,Re=tp[Te];Rt=hr(e,d,(1<<Re)-1)+Iz[Te],d+=Re}var vr=m[E_(e,d)&qt],si=vr>>4;vr||ut(3),d+=vr&15;var He=uU[si];if(si>3){var Re=rp[si];He+=E_(e,d)&(1<<Re)-1,d+=Re}if(d>_){c&&ut(0);break}s&&u(f+131072);var ci=f+Rt;if(f<He){var $c=o-He,bc=Math.min(He,ci);for($c+f<0&&ut(3);f<bc;++f)n[f]=i[$c+f]}for(;f<ci;++f)n[f]=n[f-He]}}t.l=p,t.p=Er,t.b=f,t.f=l,p&&(l=1,t.m=h,t.d=m,t.n=g)}while(!l);return f!=n.length&&a?yc(n,0,f):n.subarray(0,f)},Hr=function(e,t,n){n<<=t&7;var i=t/8|0;e[i]|=n,e[i+1]|=n>>8},hc=function(e,t,n){n<<=t&7;var i=t/8|0;e[i]|=n,e[i+1]|=n>>8,e[i+2]|=n>>16},N_=function(e,t){for(var n=[],i=0;i<e.length;++i)e[i]&&n.push({s:i,f:e[i]});var r=n.length,o=n.slice();if(!r)return{t:Tz,l:0};if(r==1){var a=new Ue(n[0].s+1);return a[n[0].s]=1,{t:a,l:1}}n.sort(function(T,C){return T.f-C.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],u=0,l=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};l!=r-1;)s=n[n[u].f<n[d].f?u++:d++],c=n[u!=l&&n[u].f<n[d].f?u++:d++],n[l++]={s:-1,f:s.f+c.f,l:s,r:c};for(var f=o[0].s,i=1;i<r;++i)o[i].s>f&&(f=o[i].s);var p=new Ft(f+1),m=U_(n[l-1],p,0);if(m>t){var i=0,h=0,g=m-t,_=1<<g;for(o.sort(function(C,J){return p[J.s]-p[C.s]||C.f-J.f});i<r;++i){var $=o[i].s;if(p[$]>t)h+=_-(1<<m-p[$]),p[$]=t;else break}for(h>>=g;h>0;){var k=o[i].s;p[k]<t?h-=1<<t-p[k]++-1:++i}for(;i>=0&&h;--i){var O=o[i].s;p[O]==t&&(--p[O],++h)}m=t}return{t:new Ue(p),l:m}},U_=function(e,t,n){return e.s==-1?Math.max(U_(e.l,t,n+1),U_(e.r,t,n+1)):t[e.s]=n},$z=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Ft(++t),i=0,r=e[0],o=1,a=function(c){n[i++]=c},s=1;s<=t;++s)if(e[s]==r&&s!=t)++o;else{if(!r&&o>2){for(;o>138;o-=138)a(32754);o>2&&(a(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(a(r),--o;o>6;o-=6)a(8304);o>2&&(a(o-3<<5|8208),o=0)}for(;o--;)a(r);o=1,r=e[s]}return{c:n.subarray(0,i),n:t}},gc=function(e,t){for(var n=0,i=0;i<t.length;++i)n+=e[i]*t[i];return n},Pz=function(e,t,n){var i=n.length,r=V_(t+2);e[r]=i&255,e[r+1]=i>>8,e[r+2]=e[r]^255,e[r+3]=e[r+1]^255;for(var o=0;o<i;++o)e[r+o+4]=n[o];return(r+4+i)*8},bz=function(e,t,n,i,r,o,a,s,c,u,l){Hr(t,l++,n),++r[256];for(var d=N_(r,15),f=d.t,p=d.l,m=N_(o,15),h=m.t,g=m.l,_=$z(f),$=_.c,k=_.n,O=$z(h),T=O.c,C=O.n,J=new Ft(19),W=0;W<$.length;++W)++J[$[W]&31];for(var W=0;W<T.length;++W)++J[T[W]&31];for(var K=N_(J,7),ze=K.t,Te=K.l,Ze=19;Ze>4&&!ze[D_[Ze-1]];--Ze);var At=u+5<<3,lt=gc(r,In)+gc(o,vc)+a,xt=gc(r,f)+gc(o,h)+a+14+3*Ze+gc(J,ze)+2*J[16]+3*J[17]+7*J[18];if(c>=0&&At<=lt&&At<=xt)return Pz(t,l,e.subarray(c,c+u));var Je,De,wt,He;if(Hr(t,l,1+(xt<lt)),l+=2,xt<lt){Je=jr(f,p,0),De=f,wt=jr(h,g,0),He=h;var Xo=jr(ze,Te,0);Hr(t,l,k-257),Hr(t,l+5,C-1),Hr(t,l+10,Ze-4),l+=14;for(var W=0;W<Ze;++W)Hr(t,l+3*W,ze[D_[W]]);l+=3*Ze;for(var qt=[$,T],Er=0;Er<2;++Er)for(var Dt=qt[Er],W=0;W<Dt.length;++W){var Rt=Dt[W]&31;Hr(t,l,Xo[Rt]),l+=ze[Rt],Rt>15&&(Hr(t,l,Dt[W]>>5&127),l+=Dt[W]>>12)}}else Je=lU,De=In,wt=fU,He=vc;for(var W=0;W<s;++W){var Re=i[W];if(Re>255){var Rt=Re>>18&31;hc(t,l,Je[Rt+257]),l+=De[Rt+257],Rt>7&&(Hr(t,l,Re>>23&31),l+=tp[Rt]);var vr=Re&31;hc(t,l,wt[vr]),l+=He[vr],vr>3&&(hc(t,l,Re>>5&8191),l+=rp[vr])}else hc(t,l,Je[Re]),l+=De[Re]}return hc(t,l,Je[256]),l+De[256]},gU=new L_([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Tz=new Ue(0),vU=function(e,t,n,i,r,o){var a=o.z||e.length,s=new Ue(i+a+5*(1+Math.ceil(a/7e3))+r),c=s.subarray(i,s.length-r),u=o.l,l=(o.r||0)&7;if(t){l&&(c[0]=o.r>>3);for(var d=gU[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=o.p||new Ft(32768),g=o.h||new Ft(m+1),_=Math.ceil(n/3),$=2*_,k=function(op){return(e[op]^e[op+1]<<_^e[op+2]<<$)&m},O=new L_(25e3),T=new Ft(288),C=new Ft(32),J=0,W=0,K=o.i||0,ze=0,Te=o.w||0,Ze=0;K+2<a;++K){var At=k(K),lt=K&32767,xt=g[At];if(h[lt]=xt,g[At]=lt,Te<=K){var Je=a-K;if((J>7e3||ze>24576)&&(Je>423||!u)){l=bz(e,c,0,O,T,C,W,ze,Ze,K-Ze,l),ze=J=W=0,Ze=K;for(var De=0;De<286;++De)T[De]=0;for(var De=0;De<30;++De)C[De]=0}var wt=2,He=0,Xo=p,qt=lt-xt&32767;if(Je>2&&At==k(K-qt))for(var Er=Math.min(f,Je)-1,Dt=Math.min(32767,K),Rt=Math.min(258,Je);qt<=Dt&&--Xo&&lt!=xt;){if(e[K+wt]==e[K+wt-qt]){for(var Re=0;Re<Rt&&e[K+Re]==e[K+Re-qt];++Re);if(Re>wt){if(wt=Re,He=qt,Re>Er)break;for(var vr=Math.min(qt,Re-2),si=0,De=0;De<vr;++De){var ci=K-qt+De&32767,$c=h[ci],bc=ci-$c&32767;bc>si&&(si=bc,xt=ci)}}}lt=xt,xt=h[lt],qt+=lt-xt&32767}if(He){O[ze++]=268435456|R_[wt]<<18|_z[He];var Yo=R_[wt]&31,Qo=_z[He]&31;W+=tp[Yo]+rp[Qo],++T[257+Yo],++C[Qo],Te=K+wt,++J}else O[ze++]=e[K],++T[e[K]]}}for(K=Math.max(K,Te);K<a;++K)O[ze++]=e[K],++T[e[K]];l=bz(e,c,u,O,T,C,W,ze,Ze,K-Ze,l),u||(o.r=l&7|c[l/8|0]<<3,l-=7,o.h=g,o.p=h,o.i=K,o.w=Te)}else{for(var K=o.w||0;K<a+u;K+=65535){var ui=K+65535;ui>=a&&(c[l/8|0]=u,ui=a),l=Pz(c,l+1,e.subarray(K,ui))}o.i=a}return yc(s,0,i+V_(l)+r)},yU=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,i=9;--i;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),_U=function(){var e=-1;return{p:function(t){for(var n=e,i=0;i<t.length;++i)n=yU[n&255^t[i]]^n>>>8;e=n},d:function(){return~e}}};var $U=function(e,t,n,i,r){if(!r&&(r={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),a=new Ue(o.length+e.length);a.set(o),a.set(e,o.length),e=a,r.w=o.length}return vU(e,t.level==null?6:t.level,t.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,i,r)},Oz=function(e,t){var n={};for(var i in e)n[i]=e[i];for(var i in t)n[i]=t[i];return n};var Or=function(e,t){return e[t]|e[t+1]<<8},tr=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},A_=function(e,t){return tr(e,t)+tr(e,t+4)*4294967296},rt=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function bU(e,t){return $U(e,t||{},0,0)}function xU(e,t){return hU(e,{i:2},t&&t.out,t&&t.dictionary)}var jz=function(e,t,n,i){for(var r in e){var o=e[r],a=t+r,s=i;Array.isArray(o)&&(s=Oz(i,o[1]),o=o[0]),ArrayBuffer.isView(o)?n[a]=[o,s]:(n[a+="/"]=[new Ue(0),s],jz(o,a,n,i))}},xz=typeof TextEncoder<"u"&&new TextEncoder,Z_=typeof TextDecoder<"u"&&new TextDecoder,wU=0;try{Z_.decode(Tz,{stream:!0}),wU=1}catch{}var kU=function(e){for(var t="",n=0;;){var i=e[n++],r=(i>127)+(i>223)+(i>239);if(n+r>e.length)return{s:t,r:yc(e,n-1)};r?r==3?(i=((i&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|i>>10,56320|i&1023)):r&1?t+=String.fromCharCode((i&31)<<6|e[n++]&63):t+=String.fromCharCode((i&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(i)}};function wz(e,t){if(t){for(var n=new Ue(e.length),i=0;i<e.length;++i)n[i]=e.charCodeAt(i);return n}if(xz)return xz.encode(e);for(var r=e.length,o=new Ue(e.length+(e.length>>1)),a=0,s=function(l){o[a++]=l},i=0;i<r;++i){if(a+5>o.length){var c=new Ue(a+8+(r-i<<1));c.set(o),o=c}var u=e.charCodeAt(i);u<128||t?s(u):u<2048?(s(192|u>>6),s(128|u&63)):u>55295&&u<57344?(u=65536+(u&1047552)|e.charCodeAt(++i)&1023,s(240|u>>18),s(128|u>>12&63),s(128|u>>6&63),s(128|u&63)):(s(224|u>>12),s(128|u>>6&63),s(128|u&63))}return yc(o,0,a)}function SU(e,t){if(t){for(var n="",i=0;i<e.length;i+=16384)n+=String.fromCharCode.apply(null,e.subarray(i,i+16384));return n}else{if(Z_)return Z_.decode(e);var r=kU(e),o=r.s,n=r.r;return n.length&&ut(8),o}}var IU=function(e,t){return t+30+Or(e,t+26)+Or(e,t+28)},zU=function(e,t,n){var i=Or(e,t+28),r=Or(e,t+30),o=SU(e.subarray(t+46,t+46+i),!(Or(e,t+8)&2048)),a=t+46+i,s=PU(e,a,r,n,tr(e,t+20),tr(e,t+24),tr(e,t+42)),c=s[0],u=s[1],l=s[2];return[Or(e,t+10),c,u,o,a+r+Or(e,t+32),l]},PU=function(e,t,n,i,r,o,a){var s=r==4294967295,c=o==4294967295,u=a==4294967295,l=t+n,d=s+c+u;if(i&&d){for(;t+4<l;t+=4+Or(e,t+2))if(Or(e,t)==1)return[s?A_(e,t+4+8*c):r,c?A_(e,t+4):o,u?A_(e,t+4+8*(c+s)):a,1];i<2&&ut(13)}return[r,o,a,0]},M_=function(e){var t=0;if(e)for(var n in e){var i=e[n].length;i>65535&&ut(9),t+=i+4}return t},kz=function(e,t,n,i,r,o,a,s){var c=i.length,u=n.extra,l=s&&s.length,d=M_(u);rt(e,t,a!=null?33639248:67324752),t+=4,a!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(o<0&&8),e[t++]=r&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&ut(10),rt(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,o!=-1&&(rt(e,t,n.crc),rt(e,t+4,o<0?-o-2:o),rt(e,t+8,n.size)),rt(e,t+12,c),rt(e,t+14,d),t+=16,a!=null&&(rt(e,t,l),rt(e,t+6,n.attrs),rt(e,t+10,a),t+=14),e.set(i,t),t+=c,d)for(var m in u){var h=u[m],g=h.length;rt(e,t,+m),rt(e,t+2,g),e.set(h,t+4),t+=4+g}return l&&(e.set(s,t),t+=l),t},TU=function(e,t,n,i,r){rt(e,t,101010256),rt(e,t+8,n),rt(e,t+10,n),rt(e,t+12,i),rt(e,t+16,r)};function Ez(e,t){t||(t={});var n={},i=[];jz(e,"",n,t);var r=0,o=0;for(var a in n){var s=n[a],c=s[0],u=s[1],l=u.level==0?0:8,d=wz(a),f=d.length,p=u.comment,m=p&&wz(p),h=m&&m.length,g=M_(u.extra);f>65535&&ut(11);var _=l?bU(c,u):c,$=_.length,k=_U();k.p(c),i.push(Oz(u,{size:c.length,crc:k.d(),c:_,f:d,m,u:f!=a.length||m&&p.length!=h,o:r,compression:l})),r+=30+f+g+$,o+=76+2*(f+g)+(h||0)+$}for(var O=new Ue(o+22),T=r,C=o-r,J=0;J<i.length;++J){var d=i[J];kz(O,d.o,d,d.f,d.u,d.c.length);var W=30+d.f.length+M_(d.extra);O.set(d.c,d.o+W),kz(O,r,d,d.f,d.u,d.c.length,d.o,d.m),r+=16+W+(d.m?d.m.length:0)}return TU(O,r,i.length,C,T),O}function Nz(e,t){for(var n={},i=e.length-22;tr(e,i)!=101010256;--i)(!i||e.length-i>65558)&&ut(13);var r=Or(e,i+8);if(!r)return{};var o=tr(e,i+16),a=tr(e,i-20)==117853008;if(a){var s=tr(e,i-12);a=tr(e,s)==101075792,a&&(r=tr(e,s+32),o=tr(e,s+48))}for(var c=t&&t.filter,u=0;u<r;++u){var l=zU(e,o,a),d=l[0],f=l[1],p=l[2],m=l[3],h=l[4],g=l[5],_=IU(e,g);o=h,(!c||c({name:m,size:f,originalSize:p,compression:d}))&&(d?d==8?n[m]=xU(e.subarray(_,_+f),{out:new Ue(p)}):ut(14,"unknown compression type "+d):n[m]=yc(e,_,_+f))}return n}var Az=/\.(ts|tsx|mts|cts|map)$/i,OU=/\.(c?js|json)$/i,jU=/\.c?js$/i,EU=/\.(node|exe|dll|so|dylib|bat|cmd|ps1|sh|vbs|jar|msi|scr|com)$/i;function NU(e,t){let n=0,i=0,r=-1,o=0;for(;i<t.length;)if(n<e.length&&e[n]!=="*"&&e[n]===t[i])n++,i++;else if(n<e.length&&e[n]==="*")r=n++,o=i;else if(r!==-1)n=r+1,i=++o;else return!1;for(;n<e.length&&e[n]==="*";)n++;return n===e.length}function F_(e,t){return e.some(n=>n===t?!0:n.endsWith("/**")?t.startsWith(n.slice(0,-2)):n.endsWith("/*")?t.startsWith(n.slice(0,-1))&&!t.slice(n.length-1).includes("/"):n.includes("*")?NU(n,t):!1)}var _c=e=>Array.isArray(e)?e.map(String):e?[String(e)]:[];function AU(e){let t=new Set(e.map(n=>n.includes("/")?n.split("/")[0]:""));return t.size===1&&!t.has("")?`${[...t][0]}/`:""}var DU=e=>!!(e&&typeof e=="object"&&e.mafiahub&&typeof e.mafiahub=="object"),RU=(e,t=[])=>[...new Set([..._c(e?.latch?.ignore),...t])],CU=(e,t)=>typeof t=="boolean"?t:e?.latch?.obfuscateClient!==!1;function UU(e,t,n={}){let i=t.mafiahub,r=_c(i.serverScripts??i.server),o=new Set([..._c(i.clientScripts??i.client),..._c(i.sharedScripts)]),a=_c(i.files??i.clientFiles),s=RU(t,n.keepReadable),c=CU(t,n.obfuscateClient),u=[],l=[];r.length||u.push({code:"noServerScripts"});let d=e.map(f=>Az.test(f)?{name:f,kind:"removed"}:f==="package.json"?{name:f,kind:"manifest"}:(EU.test(f)&&l.push({code:"binary",file:f}),f.startsWith("node_modules/")?{name:f,kind:"readable",why:"dependency"}:o.has(f)||F_(a,f)?{name:f,kind:"client",obfuscated:c&&jU.test(f)}:OU.test(f)?F_(s,f)&&!r.includes(f)?{name:f,kind:"readable",why:"kept"}:{name:f,kind:"encrypted",entry:r.includes(f),keepable:!r.includes(f)}:{name:f,kind:"readable",why:"asset"}));for(let f of r){let p=d.find(m=>m.name===f);p?p.kind!=="encrypted"&&u.push({code:"serverScriptShipped",file:f}):u.push({code:"serverScriptMissing",file:f})}for(let f of s)r.some(p=>F_([f],p))&&l.push({code:"entryNotReadable",file:f});return{rows:d,errors:u,warnings:l,serverScripts:r,obfuscate:c}}var ZU=e=>!!(e&&typeof e=="object"&&typeof e.Main=="string"&&!e.mafiahub),MU=/^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*)+$/;function LU(e,t){let n=[],i=[],r=typeof t?.Main=="string"?t.Main:null;r?MU.test(r)||n.push({code:"badMain",file:r}):n.push({code:"noMain"});let o=e.map(a=>a==="manifest.json"?{name:a,kind:"manifest"}:Az.test(a)||a.endsWith(".java")?{name:a,kind:"removed"}:{name:a,kind:"encrypted",entry:r!=null&&a===r.replace(/\./g,"/")+".class"});return o.some(a=>a.kind==="encrypted"&&a.name.endsWith(".class"))||n.push({code:"noClasses"}),r&&!e.includes(r.replace(/\./g,"/")+".class")&&i.push({code:"mainClassMissing",file:r}),{rows:o,errors:n,warnings:i,realMain:r}}function Dz(e,t={}){let n=Object.keys(e).filter(u=>!u.startsWith("__MACOSX/")&&!u.endsWith(".DS_Store")),i=AU(n),r=n.map(u=>u.slice(i.length)),o=u=>new TextDecoder().decode(u),a=e[`${i}package.json`],s=e[`${i}manifest.json`];if(t.ecosystem==="hytale"||!a&&s){if(!s)return{error:"noManifest",names:r,hytale:!0};let u;try{u=JSON.parse(o(s))}catch{return{error:"badManifest",names:r,hytale:!0}}return ZU(u)?{manifest:u,names:r,hytale:!0,plan:LU(r,u)}:{error:"noHytaleMain",names:r,hytale:!0,manifest:u}}if(!a)return{error:"noManifest",names:r};let c;try{c=JSON.parse(o(a))}catch{return{error:"badManifest",names:r}}return DU(c)?{pkg:c,names:r,plan:UU(r,c,t)}:{error:"noMafiahub",names:r,pkg:c}}var Rz=e=>!!(e?.error||e?.plan?.errors.length);var HU=100*1024*1024,KU=300*1024*1024,q_=6e3,GU=e=>e===".git"||e===".DS_Store"||e==="__MACOSX"||e==="Thumbs.db"||/^\.env(\..+)?$/.test(e);async function Mz(e,t,n,i){for(let r of await VU(t,{withFileTypes:!0})){let o=qU(t,r.name),a=BU(e,o).split(JU).join("/");if(GU(r.name)){i.push(a);continue}if(r.isDirectory())await Mz(e,o,n,i);else if(r.isFile()&&(n[a]=new Uint8Array(await Zz(o)),Object.keys(n).length>q_))throw new $e("tooLarge",`The folder has more than ${q_} files.`)}}async function Go(e,t={}){let n;try{n=await FU(e)}catch{throw new $e("notFound",`Nothing found at ${e}.`)}let i,r,o=[];if(n.isDirectory()){if(i={},await Mz(e,e,i,o),!Object.keys(i).length)throw new $e("emptyPackage",`${e} is empty.`);r=Ez(i,{level:6})}else if(/\.(zip|jar)$/i.test(e)){r=new Uint8Array(await Zz(e));try{i=Object.fromEntries(Object.entries(Nz(r)).map(([c,u])=>[c.replace(/\\/g,"/"),u]).filter(([c])=>!c.endsWith("/")))}catch{throw new $e("invalidArchive",`${e} isn't a valid zip archive.`)}}else throw new $e("unsupported","Pass a folder, a .zip or a .jar. Convert .rar/.7z archives to .zip first.");let a=Object.values(i).reduce((c,u)=>c+u.byteLength,0);if(r.byteLength>HU)throw new $e("tooLarge",`The package is ${WU(r.byteLength)}; the limit is 100 MB.`);if(a>KU||Object.keys(i).length>q_)throw new $e("tooLarge","The package is too large once extracted (max 300 MB and 6,000 files).");let s=Dz(i,t);return{bytes:r,fileName:n.isDirectory()?`${Cz(e)}.zip`:Cz(e),files:Object.keys(i).length,skipped:o,ecosystem:s.hytale?"hytale":null,preview:s}}var WU=e=>`${(e/1024/1024).toFixed(1)} MB`;function Wo(e){let t=e.preview,n=t.plan?.rows??[],i=r=>n.filter(o=>o.kind===r).length;return{ok:!Rz(t),fileName:e.fileName,size:e.bytes.byteLength,files:e.files,ecosystem:e.ecosystem??"mafiahub",error:t.error?Lz[t.error]??t.error:null,errors:(t.plan?.errors??[]).map(r=>Uz(r)),warnings:(t.plan?.warnings??[]).map(r=>Uz(r)),counts:{encrypted:i("encrypted"),sentToPlayers:i("client"),readable:i("readable"),leftOut:i("removed")},skipped:e.skipped,rows:n.filter(r=>r.kind!=="manifest").map(r=>({file:r.name,result:r.kind==="client"?r.obfuscated?"obfuscated":"sent as is":r.kind}))}}var Lz={noManifest:"There's no package.json (or manifest.json for a Hytale plugin) at the root.",badManifest:"The manifest isn't valid JSON.",noMafiahub:'package.json has no "mafiahub" block.',noHytaleMain:`manifest.json has no "Main" field, so this isn't a Hytale plugin.`,noServerScripts:`"mafiahub.serverScripts" is empty, so there's nothing to protect.`,serverScriptMissing:"{file} is listed in serverScripts but isn't in the package.",serverScriptShipped:"{file} is a server script but is also listed for players (clientScripts, sharedScripts or files).",binary:"{file} is a program or native file. The team reviews packages that contain these.",entryNotReadable:'"{file}" in latch.ignore matches a server script. Server scripts always stay encrypted.',noMain:'manifest.json has no "Main" field.',badMain:`"Main" ({file}) isn't a valid class name.`,noClasses:"The .jar has no .class files to protect.",mainClassMissing:"The Main class {file} isn't in the .jar."},Uz=e=>(Lz[e.code]??e.code).replace("{file}",e.file??"");var Vz=["gameplay","economy","vehicles","ui","world","admin","other"],np=["hogwartsmp","kcdc"];async function ip(e,t){let n=t.onProgress??(()=>{}),i={keepReadable:t.keepReadable??[],...t.obfuscateClient===void 0?{}:{obfuscateClient:t.obfuscateClient}};n(`Reading ${t.path}`);let r=await Go(t.path,i),o=Wo(r);if(!o.ok){let d=[o.error,...o.errors].filter(Boolean).join(`
78
+ `}var ep=class{constructor(t=yz.stdin,n=yz.stdout,i){this._stdin=t,this._stdout=n,this._started=!1,this._ondata=r=>{try{this._readBuffer.append(r),this.processReadBuffer()}catch(o){this.onerror?.(o),this.close().catch(()=>{})}},this._onerror=r=>{this.onerror?.(r)},this._readBuffer=new Qf({maxBufferSize:i?.maxBufferSize})}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(n=>{let i=vz(t);this._stdout.write(i)?n():this._stdout.once("drain",n)})}};import{readdir as VU,readFile as Zz,stat as FU}from"node:fs/promises";import{basename as Cz,join as qU,relative as BU,sep as JU}from"node:path";import{createRequire as oU}from"module";var aU=oU("/"),Ko,sU,cU;try{Ko=aU("worker_threads"),sU=Ko.Worker,cU=Ko.isMarkedAsUntransferable}catch{}var Ue=Uint8Array,Ft=Uint16Array,L_=Int32Array,tp=new Ue([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),rp=new Ue([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),D_=new Ue([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Sz=function(e,t){for(var n=new Ft(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];for(var r=new L_(n[30]),i=1;i<30;++i)for(var o=n[i];o<n[i+1];++o)r[o]=o-n[i]<<5|i;return{b:n,r}},Ko=Sz(tp,2),Iz=Ko.b,R_=Ko.r;Iz[28]=258,R_[258]=28;var zz=Sz(rp,0),uU=zz.b,_z=zz.r,C_=new Ft(32768);for(ve=0;ve<32768;++ve)Jr=(ve&43690)>>1|(ve&21845)<<1,Jr=(Jr&52428)>>2|(Jr&13107)<<2,Jr=(Jr&61680)>>4|(Jr&3855)<<4,C_[ve]=((Jr&65280)>>8|(Jr&255)<<8)>>1;var Jr,ve,jr=(function(e,t,n){for(var i=e.length,r=0,o=new Ft(t);r<i;++r)e[r]&&++o[e[r]-1];var a=new Ft(t);for(r=1;r<t;++r)a[r]=a[r-1]+o[r-1]<<1;var s;if(n){s=new Ft(1<<t);var c=15-t;for(r=0;r<i;++r)if(e[r])for(var u=r<<4|e[r],l=t-e[r],d=a[e[r]-1]++<<l,f=d|(1<<l)-1;d<=f;++d)s[C_[d]>>c]=u}else for(s=new Ft(i),r=0;r<i;++r)e[r]&&(s[r]=C_[a[e[r]-1]++]>>15-e[r]);return s}),In=new Ue(288);for(ve=0;ve<144;++ve)In[ve]=8;var ve;for(ve=144;ve<256;++ve)In[ve]=9;var ve;for(ve=256;ve<280;++ve)In[ve]=7;var ve;for(ve=280;ve<288;++ve)In[ve]=8;var ve,vc=new Ue(32);for(ve=0;ve<32;++ve)vc[ve]=5;var ve,lU=jr(In,9,0),dU=jr(In,9,1),fU=jr(vc,5,0),pU=jr(vc,5,1),j_=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},hr=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(t&7)&n},E_=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},V_=function(e){return(e+7)/8|0},yc=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Ue(e.subarray(t,n))};var mU=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ut=function(e,t,n){var i=new Error(t||mU[e]);if(i.code=e,Error.captureStackTrace&&Error.captureStackTrace(i,ut),!n)throw i;return i},hU=function(e,t,n,i){var r=e.length,o=i?i.length:0;if(!r||t.f&&!t.l)return n||new Ue(0);var a=!n,s=a||t.i!=2,c=t.i;a&&(n=new Ue(r*3));var u=function(Yo){var Qo=n.length;if(Yo>Qo){var ui=new Ue(Math.max(Qo*2,Yo));ui.set(n),n=ui}},l=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=r*8;do{if(!p){l=hr(e,d,1);var $=hr(e,d+1,3);if(d+=3,$)if($==1)p=dU,m=pU,h=9,g=5;else if($==2){var C=hr(e,d,31)+257,J=hr(e,d+10,15)+4,W=C+hr(e,d+5,31)+1;d+=14;for(var K=new Ue(W),ze=new Ue(19),Te=0;Te<J;++Te)ze[D_[Te]]=hr(e,d+Te*3,7);d+=J*3;for(var Ze=j_(ze),At=(1<<Ze)-1,lt=jr(ze,Ze,1),Te=0;Te<W;){var xt=lt[hr(e,d,At)];d+=xt&15;var k=xt>>4;if(k<16)K[Te++]=k;else{var Je=0,De=0;for(k==16?(De=3+hr(e,d,3),d+=2,Je=K[Te-1]):k==17?(De=3+hr(e,d,7),d+=3):k==18&&(De=11+hr(e,d,127),d+=7);De--;)K[Te++]=Je}}var wt=K.subarray(0,C),He=K.subarray(C);h=j_(wt),g=j_(He),p=jr(wt,h,1),m=jr(He,g,1)}else ut(1);else{var k=V_(d)+4,O=e[k-4]|e[k-3]<<8,T=k+O;if(T>r){c&&ut(0);break}s&&u(f+O),n.set(e.subarray(k,T),f),t.b=f+=O,t.p=d=T*8,t.f=l;continue}if(d>_){c&&ut(0);break}}s&&u(f+131072);for(var Xo=(1<<h)-1,qt=(1<<g)-1,Er=d;;Er=d){var Je=p[E_(e,d)&Xo],Dt=Je>>4;if(d+=Je&15,d>_){c&&ut(0);break}if(Je||ut(2),Dt<256)n[f++]=Dt;else if(Dt==256){Er=d,p=null;break}else{var Rt=Dt-254;if(Dt>264){var Te=Dt-257,Re=tp[Te];Rt=hr(e,d,(1<<Re)-1)+Iz[Te],d+=Re}var vr=m[E_(e,d)&qt],si=vr>>4;vr||ut(3),d+=vr&15;var He=uU[si];if(si>3){var Re=rp[si];He+=E_(e,d)&(1<<Re)-1,d+=Re}if(d>_){c&&ut(0);break}s&&u(f+131072);var ci=f+Rt;if(f<He){var $c=o-He,bc=Math.min(He,ci);for($c+f<0&&ut(3);f<bc;++f)n[f]=i[$c+f]}for(;f<ci;++f)n[f]=n[f-He]}}t.l=p,t.p=Er,t.b=f,t.f=l,p&&(l=1,t.m=h,t.d=m,t.n=g)}while(!l);return f!=n.length&&a?yc(n,0,f):n.subarray(0,f)},Hr=function(e,t,n){n<<=t&7;var i=t/8|0;e[i]|=n,e[i+1]|=n>>8},hc=function(e,t,n){n<<=t&7;var i=t/8|0;e[i]|=n,e[i+1]|=n>>8,e[i+2]|=n>>16},N_=function(e,t){for(var n=[],i=0;i<e.length;++i)e[i]&&n.push({s:i,f:e[i]});var r=n.length,o=n.slice();if(!r)return{t:Tz,l:0};if(r==1){var a=new Ue(n[0].s+1);return a[n[0].s]=1,{t:a,l:1}}n.sort(function(T,C){return T.f-C.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],u=0,l=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};l!=r-1;)s=n[n[u].f<n[d].f?u++:d++],c=n[u!=l&&n[u].f<n[d].f?u++:d++],n[l++]={s:-1,f:s.f+c.f,l:s,r:c};for(var f=o[0].s,i=1;i<r;++i)o[i].s>f&&(f=o[i].s);var p=new Ft(f+1),m=U_(n[l-1],p,0);if(m>t){var i=0,h=0,g=m-t,_=1<<g;for(o.sort(function(C,J){return p[J.s]-p[C.s]||C.f-J.f});i<r;++i){var $=o[i].s;if(p[$]>t)h+=_-(1<<m-p[$]),p[$]=t;else break}for(h>>=g;h>0;){var k=o[i].s;p[k]<t?h-=1<<t-p[k]++-1:++i}for(;i>=0&&h;--i){var O=o[i].s;p[O]==t&&(--p[O],++h)}m=t}return{t:new Ue(p),l:m}},U_=function(e,t,n){return e.s==-1?Math.max(U_(e.l,t,n+1),U_(e.r,t,n+1)):t[e.s]=n},$z=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Ft(++t),i=0,r=e[0],o=1,a=function(c){n[i++]=c},s=1;s<=t;++s)if(e[s]==r&&s!=t)++o;else{if(!r&&o>2){for(;o>138;o-=138)a(32754);o>2&&(a(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(a(r),--o;o>6;o-=6)a(8304);o>2&&(a(o-3<<5|8208),o=0)}for(;o--;)a(r);o=1,r=e[s]}return{c:n.subarray(0,i),n:t}},gc=function(e,t){for(var n=0,i=0;i<t.length;++i)n+=e[i]*t[i];return n},Pz=function(e,t,n){var i=n.length,r=V_(t+2);e[r]=i&255,e[r+1]=i>>8,e[r+2]=e[r]^255,e[r+3]=e[r+1]^255;for(var o=0;o<i;++o)e[r+o+4]=n[o];return(r+4+i)*8},bz=function(e,t,n,i,r,o,a,s,c,u,l){Hr(t,l++,n),++r[256];for(var d=N_(r,15),f=d.t,p=d.l,m=N_(o,15),h=m.t,g=m.l,_=$z(f),$=_.c,k=_.n,O=$z(h),T=O.c,C=O.n,J=new Ft(19),W=0;W<$.length;++W)++J[$[W]&31];for(var W=0;W<T.length;++W)++J[T[W]&31];for(var K=N_(J,7),ze=K.t,Te=K.l,Ze=19;Ze>4&&!ze[D_[Ze-1]];--Ze);var At=u+5<<3,lt=gc(r,In)+gc(o,vc)+a,xt=gc(r,f)+gc(o,h)+a+14+3*Ze+gc(J,ze)+2*J[16]+3*J[17]+7*J[18];if(c>=0&&At<=lt&&At<=xt)return Pz(t,l,e.subarray(c,c+u));var Je,De,wt,He;if(Hr(t,l,1+(xt<lt)),l+=2,xt<lt){Je=jr(f,p,0),De=f,wt=jr(h,g,0),He=h;var Xo=jr(ze,Te,0);Hr(t,l,k-257),Hr(t,l+5,C-1),Hr(t,l+10,Ze-4),l+=14;for(var W=0;W<Ze;++W)Hr(t,l+3*W,ze[D_[W]]);l+=3*Ze;for(var qt=[$,T],Er=0;Er<2;++Er)for(var Dt=qt[Er],W=0;W<Dt.length;++W){var Rt=Dt[W]&31;Hr(t,l,Xo[Rt]),l+=ze[Rt],Rt>15&&(Hr(t,l,Dt[W]>>5&127),l+=Dt[W]>>12)}}else Je=lU,De=In,wt=fU,He=vc;for(var W=0;W<s;++W){var Re=i[W];if(Re>255){var Rt=Re>>18&31;hc(t,l,Je[Rt+257]),l+=De[Rt+257],Rt>7&&(Hr(t,l,Re>>23&31),l+=tp[Rt]);var vr=Re&31;hc(t,l,wt[vr]),l+=He[vr],vr>3&&(hc(t,l,Re>>5&8191),l+=rp[vr])}else hc(t,l,Je[Re]),l+=De[Re]}return hc(t,l,Je[256]),l+De[256]},gU=new L_([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Tz=new Ue(0),vU=function(e,t,n,i,r,o){var a=o.z||e.length,s=new Ue(i+a+5*(1+Math.ceil(a/7e3))+r),c=s.subarray(i,s.length-r),u=o.l,l=(o.r||0)&7;if(t){l&&(c[0]=o.r>>3);for(var d=gU[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=o.p||new Ft(32768),g=o.h||new Ft(m+1),_=Math.ceil(n/3),$=2*_,k=function(op){return(e[op]^e[op+1]<<_^e[op+2]<<$)&m},O=new L_(25e3),T=new Ft(288),C=new Ft(32),J=0,W=0,K=o.i||0,ze=0,Te=o.w||0,Ze=0;K+2<a;++K){var At=k(K),lt=K&32767,xt=g[At];if(h[lt]=xt,g[At]=lt,Te<=K){var Je=a-K;if((J>7e3||ze>24576)&&(Je>423||!u)){l=bz(e,c,0,O,T,C,W,ze,Ze,K-Ze,l),ze=J=W=0,Ze=K;for(var De=0;De<286;++De)T[De]=0;for(var De=0;De<30;++De)C[De]=0}var wt=2,He=0,Xo=p,qt=lt-xt&32767;if(Je>2&&At==k(K-qt))for(var Er=Math.min(f,Je)-1,Dt=Math.min(32767,K),Rt=Math.min(258,Je);qt<=Dt&&--Xo&&lt!=xt;){if(e[K+wt]==e[K+wt-qt]){for(var Re=0;Re<Rt&&e[K+Re]==e[K+Re-qt];++Re);if(Re>wt){if(wt=Re,He=qt,Re>Er)break;for(var vr=Math.min(qt,Re-2),si=0,De=0;De<vr;++De){var ci=K-qt+De&32767,$c=h[ci],bc=ci-$c&32767;bc>si&&(si=bc,xt=ci)}}}lt=xt,xt=h[lt],qt+=lt-xt&32767}if(He){O[ze++]=268435456|R_[wt]<<18|_z[He];var Yo=R_[wt]&31,Qo=_z[He]&31;W+=tp[Yo]+rp[Qo],++T[257+Yo],++C[Qo],Te=K+wt,++J}else O[ze++]=e[K],++T[e[K]]}}for(K=Math.max(K,Te);K<a;++K)O[ze++]=e[K],++T[e[K]];l=bz(e,c,u,O,T,C,W,ze,Ze,K-Ze,l),u||(o.r=l&7|c[l/8|0]<<3,l-=7,o.h=g,o.p=h,o.i=K,o.w=Te)}else{for(var K=o.w||0;K<a+u;K+=65535){var ui=K+65535;ui>=a&&(c[l/8|0]=u,ui=a),l=Pz(c,l+1,e.subarray(K,ui))}o.i=a}return yc(s,0,i+V_(l)+r)},yU=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,i=9;--i;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),_U=function(){var e=-1;return{p:function(t){for(var n=e,i=0;i<t.length;++i)n=yU[n&255^t[i]]^n>>>8;e=n},d:function(){return~e}}};var $U=function(e,t,n,i,r){if(!r&&(r={l:1},t.dictionary)){var o=t.dictionary.subarray(-32768),a=new Ue(o.length+e.length);a.set(o),a.set(e,o.length),e=a,r.w=o.length}return vU(e,t.level==null?6:t.level,t.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,i,r)},Oz=function(e,t){var n={};for(var i in e)n[i]=e[i];for(var i in t)n[i]=t[i];return n};var Or=function(e,t){return e[t]|e[t+1]<<8},tr=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},A_=function(e,t){return tr(e,t)+tr(e,t+4)*4294967296},rt=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function bU(e,t){return $U(e,t||{},0,0)}function xU(e,t){return hU(e,{i:2},t&&t.out,t&&t.dictionary)}var jz=function(e,t,n,i){for(var r in e){var o=e[r],a=t+r,s=i;Array.isArray(o)&&(s=Oz(i,o[1]),o=o[0]),ArrayBuffer.isView(o)?n[a]=[o,s]:(n[a+="/"]=[new Ue(0),s],jz(o,a,n,i))}},xz=typeof TextEncoder<"u"&&new TextEncoder,Z_=typeof TextDecoder<"u"&&new TextDecoder,wU=0;try{Z_.decode(Tz,{stream:!0}),wU=1}catch{}var kU=function(e){for(var t="",n=0;;){var i=e[n++],r=(i>127)+(i>223)+(i>239);if(n+r>e.length)return{s:t,r:yc(e,n-1)};r?r==3?(i=((i&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|i>>10,56320|i&1023)):r&1?t+=String.fromCharCode((i&31)<<6|e[n++]&63):t+=String.fromCharCode((i&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(i)}};function wz(e,t){if(t){for(var n=new Ue(e.length),i=0;i<e.length;++i)n[i]=e.charCodeAt(i);return n}if(xz)return xz.encode(e);for(var r=e.length,o=new Ue(e.length+(e.length>>1)),a=0,s=function(l){o[a++]=l},i=0;i<r;++i){if(a+5>o.length){var c=new Ue(a+8+(r-i<<1));c.set(o),o=c}var u=e.charCodeAt(i);u<128||t?s(u):u<2048?(s(192|u>>6),s(128|u&63)):u>55295&&u<57344?(u=65536+(u&1047552)|e.charCodeAt(++i)&1023,s(240|u>>18),s(128|u>>12&63),s(128|u>>6&63),s(128|u&63)):(s(224|u>>12),s(128|u>>6&63),s(128|u&63))}return yc(o,0,a)}function SU(e,t){if(t){for(var n="",i=0;i<e.length;i+=16384)n+=String.fromCharCode.apply(null,e.subarray(i,i+16384));return n}else{if(Z_)return Z_.decode(e);var r=kU(e),o=r.s,n=r.r;return n.length&&ut(8),o}}var IU=function(e,t){return t+30+Or(e,t+26)+Or(e,t+28)},zU=function(e,t,n){var i=Or(e,t+28),r=Or(e,t+30),o=SU(e.subarray(t+46,t+46+i),!(Or(e,t+8)&2048)),a=t+46+i,s=PU(e,a,r,n,tr(e,t+20),tr(e,t+24),tr(e,t+42)),c=s[0],u=s[1],l=s[2];return[Or(e,t+10),c,u,o,a+r+Or(e,t+32),l]},PU=function(e,t,n,i,r,o,a){var s=r==4294967295,c=o==4294967295,u=a==4294967295,l=t+n,d=s+c+u;if(i&&d){for(;t+4<l;t+=4+Or(e,t+2))if(Or(e,t)==1)return[s?A_(e,t+4+8*c):r,c?A_(e,t+4):o,u?A_(e,t+4+8*(c+s)):a,1];i<2&&ut(13)}return[r,o,a,0]},M_=function(e){var t=0;if(e)for(var n in e){var i=e[n].length;i>65535&&ut(9),t+=i+4}return t},kz=function(e,t,n,i,r,o,a,s){var c=i.length,u=n.extra,l=s&&s.length,d=M_(u);rt(e,t,a!=null?33639248:67324752),t+=4,a!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(o<0&&8),e[t++]=r&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&ut(10),rt(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,o!=-1&&(rt(e,t,n.crc),rt(e,t+4,o<0?-o-2:o),rt(e,t+8,n.size)),rt(e,t+12,c),rt(e,t+14,d),t+=16,a!=null&&(rt(e,t,l),rt(e,t+6,n.attrs),rt(e,t+10,a),t+=14),e.set(i,t),t+=c,d)for(var m in u){var h=u[m],g=h.length;rt(e,t,+m),rt(e,t+2,g),e.set(h,t+4),t+=4+g}return l&&(e.set(s,t),t+=l),t},TU=function(e,t,n,i,r){rt(e,t,101010256),rt(e,t+8,n),rt(e,t+10,n),rt(e,t+12,i),rt(e,t+16,r)};function Ez(e,t){t||(t={});var n={},i=[];jz(e,"",n,t);var r=0,o=0;for(var a in n){var s=n[a],c=s[0],u=s[1],l=u.level==0?0:8,d=wz(a),f=d.length,p=u.comment,m=p&&wz(p),h=m&&m.length,g=M_(u.extra);f>65535&&ut(11);var _=l?bU(c,u):c,$=_.length,k=_U();k.p(c),i.push(Oz(u,{size:c.length,crc:k.d(),c:_,f:d,m,u:f!=a.length||m&&p.length!=h,o:r,compression:l})),r+=30+f+g+$,o+=76+2*(f+g)+(h||0)+$}for(var O=new Ue(o+22),T=r,C=o-r,J=0;J<i.length;++J){var d=i[J];kz(O,d.o,d,d.f,d.u,d.c.length);var W=30+d.f.length+M_(d.extra);O.set(d.c,d.o+W),kz(O,r,d,d.f,d.u,d.c.length,d.o,d.m),r+=16+W+(d.m?d.m.length:0)}return TU(O,r,i.length,C,T),O}function Nz(e,t){for(var n={},i=e.length-22;tr(e,i)!=101010256;--i)(!i||e.length-i>65558)&&ut(13);var r=Or(e,i+8);if(!r)return{};var o=tr(e,i+16),a=tr(e,i-20)==117853008;if(a){var s=tr(e,i-12);a=tr(e,s)==101075792,a&&(r=tr(e,s+32),o=tr(e,s+48))}for(var c=t&&t.filter,u=0;u<r;++u){var l=zU(e,o,a),d=l[0],f=l[1],p=l[2],m=l[3],h=l[4],g=l[5],_=IU(e,g);o=h,(!c||c({name:m,size:f,originalSize:p,compression:d}))&&(d?d==8?n[m]=xU(e.subarray(_,_+f),{out:new Ue(p)}):ut(14,"unknown compression type "+d):n[m]=yc(e,_,_+f))}return n}var Az=/\.(ts|tsx|mts|cts|map)$/i,OU=/\.(c?js|json)$/i,jU=/\.c?js$/i,EU=/\.(node|exe|dll|so|dylib|bat|cmd|ps1|sh|vbs|jar|msi|scr|com)$/i;function NU(e,t){let n=0,i=0,r=-1,o=0;for(;i<t.length;)if(n<e.length&&e[n]!=="*"&&e[n]===t[i])n++,i++;else if(n<e.length&&e[n]==="*")r=n++,o=i;else if(r!==-1)n=r+1,i=++o;else return!1;for(;n<e.length&&e[n]==="*";)n++;return n===e.length}function F_(e,t){return e.some(n=>n===t?!0:n.endsWith("/**")?t.startsWith(n.slice(0,-2)):n.endsWith("/*")?t.startsWith(n.slice(0,-1))&&!t.slice(n.length-1).includes("/"):n.includes("*")?NU(n,t):!1)}var _c=e=>Array.isArray(e)?e.map(String):e?[String(e)]:[];function AU(e){let t=new Set(e.map(n=>n.includes("/")?n.split("/")[0]:""));return t.size===1&&!t.has("")?`${[...t][0]}/`:""}var DU=e=>!!(e&&typeof e=="object"&&e.mafiahub&&typeof e.mafiahub=="object"),RU=(e,t=[])=>[...new Set([..._c(e?.latch?.ignore),...t])],CU=(e,t)=>typeof t=="boolean"?t:e?.latch?.obfuscateClient!==!1;function UU(e,t,n={}){let i=t.mafiahub,r=_c(i.serverScripts??i.server),o=new Set([..._c(i.clientScripts??i.client),..._c(i.sharedScripts)]),a=_c(i.files??i.clientFiles),s=RU(t,n.keepReadable),c=CU(t,n.obfuscateClient),u=[],l=[];r.length||u.push({code:"noServerScripts"});let d=e.map(f=>Az.test(f)?{name:f,kind:"removed"}:f==="package.json"?{name:f,kind:"manifest"}:(EU.test(f)&&l.push({code:"binary",file:f}),f.startsWith("node_modules/")?{name:f,kind:"readable",why:"dependency"}:o.has(f)||F_(a,f)?{name:f,kind:"client",obfuscated:c&&jU.test(f)}:OU.test(f)?F_(s,f)&&!r.includes(f)?{name:f,kind:"readable",why:"kept"}:{name:f,kind:"encrypted",entry:r.includes(f),keepable:!r.includes(f)}:{name:f,kind:"readable",why:"asset"}));for(let f of r){let p=d.find(m=>m.name===f);p?p.kind!=="encrypted"&&u.push({code:"serverScriptShipped",file:f}):u.push({code:"serverScriptMissing",file:f})}for(let f of s)r.some(p=>F_([f],p))&&l.push({code:"entryNotReadable",file:f});return{rows:d,errors:u,warnings:l,serverScripts:r,obfuscate:c}}var ZU=e=>!!(e&&typeof e=="object"&&typeof e.Main=="string"&&!e.mafiahub),MU=/^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*)+$/;function LU(e,t){let n=[],i=[],r=typeof t?.Main=="string"?t.Main:null;r?MU.test(r)||n.push({code:"badMain",file:r}):n.push({code:"noMain"});let o=e.map(a=>a==="manifest.json"?{name:a,kind:"manifest"}:Az.test(a)||a.endsWith(".java")?{name:a,kind:"removed"}:{name:a,kind:"encrypted",entry:r!=null&&a===r.replace(/\./g,"/")+".class"});return o.some(a=>a.kind==="encrypted"&&a.name.endsWith(".class"))||n.push({code:"noClasses"}),r&&!e.includes(r.replace(/\./g,"/")+".class")&&i.push({code:"mainClassMissing",file:r}),{rows:o,errors:n,warnings:i,realMain:r}}function Dz(e,t={}){let n=Object.keys(e).filter(u=>!u.startsWith("__MACOSX/")&&!u.endsWith(".DS_Store")),i=AU(n),r=n.map(u=>u.slice(i.length)),o=u=>new TextDecoder().decode(u),a=e[`${i}package.json`],s=e[`${i}manifest.json`];if(t.ecosystem==="hytale"||!a&&s){if(!s)return{error:"noManifest",names:r,hytale:!0};let u;try{u=JSON.parse(o(s))}catch{return{error:"badManifest",names:r,hytale:!0}}return ZU(u)?{manifest:u,names:r,hytale:!0,plan:LU(r,u)}:{error:"noHytaleMain",names:r,hytale:!0,manifest:u}}if(!a)return{error:"noManifest",names:r};let c;try{c=JSON.parse(o(a))}catch{return{error:"badManifest",names:r}}return DU(c)?{pkg:c,names:r,plan:UU(r,c,t)}:{error:"noMafiahub",names:r,pkg:c}}var Rz=e=>!!(e?.error||e?.plan?.errors.length);var HU=100*1024*1024,KU=300*1024*1024,q_=6e3,GU=e=>e===".git"||e===".DS_Store"||e==="__MACOSX"||e==="Thumbs.db"||/^\.env(\..+)?$/.test(e);async function Mz(e,t,n,i){for(let r of await VU(t,{withFileTypes:!0})){let o=qU(t,r.name),a=BU(e,o).split(JU).join("/");if(GU(r.name)){i.push(a);continue}if(r.isDirectory())await Mz(e,o,n,i);else if(r.isFile()&&(n[a]=new Uint8Array(await Zz(o)),Object.keys(n).length>q_))throw new $e("tooLarge",`The folder has more than ${q_} files.`)}}async function Go(e,t={}){let n;try{n=await FU(e)}catch{throw new $e("notFound",`Nothing found at ${e}.`)}let i,r,o=[];if(n.isDirectory()){if(i={},await Mz(e,e,i,o),!Object.keys(i).length)throw new $e("emptyPackage",`${e} is empty.`);r=Ez(i,{level:6})}else if(/\.(zip|jar)$/i.test(e)){r=new Uint8Array(await Zz(e));try{i=Object.fromEntries(Object.entries(Nz(r)).map(([c,u])=>[c.replace(/\\/g,"/"),u]).filter(([c])=>!c.endsWith("/")))}catch{throw new $e("invalidArchive",`${e} isn't a valid zip archive.`)}}else throw new $e("unsupported","Pass a folder, a .zip or a .jar. Convert .rar/.7z archives to .zip first.");let a=Object.values(i).reduce((c,u)=>c+u.byteLength,0);if(r.byteLength>HU)throw new $e("tooLarge",`The package is ${WU(r.byteLength)}; the limit is 100 MB.`);if(a>KU||Object.keys(i).length>q_)throw new $e("tooLarge","The package is too large once extracted (max 300 MB and 6,000 files).");let s=Dz(i,t);return{bytes:r,fileName:n.isDirectory()?`${Cz(e)}.zip`:Cz(e),files:Object.keys(i).length,skipped:o,ecosystem:s.hytale?"hytale":null,preview:s}}var WU=e=>`${(e/1024/1024).toFixed(1)} MB`;function Wo(e){let t=e.preview,n=t.plan?.rows??[],i=r=>n.filter(o=>o.kind===r).length;return{ok:!Rz(t),fileName:e.fileName,size:e.bytes.byteLength,files:e.files,ecosystem:e.ecosystem??"mafiahub",error:t.error?Lz[t.error]??t.error:null,errors:(t.plan?.errors??[]).map(r=>Uz(r)),warnings:(t.plan?.warnings??[]).map(r=>Uz(r)),counts:{encrypted:i("encrypted"),sentToPlayers:i("client"),readable:i("readable"),leftOut:i("removed")},skipped:e.skipped,rows:n.filter(r=>r.kind!=="manifest").map(r=>({file:r.name,result:r.kind==="client"?r.obfuscated?"obfuscated":"sent as is":r.kind}))}}var Lz={noManifest:"There's no package.json (or manifest.json for a Hytale plugin) at the root.",badManifest:"The manifest isn't valid JSON.",noMafiahub:'package.json has no "mafiahub" block.',noHytaleMain:`manifest.json has no "Main" field, so this isn't a Hytale plugin.`,noServerScripts:`"mafiahub.serverScripts" is empty, so there's nothing to protect.`,serverScriptMissing:"{file} is listed in serverScripts but isn't in the package.",serverScriptShipped:"{file} is a server script but is also listed for players (clientScripts, sharedScripts or files).",binary:"{file} is a program or native file. The team reviews packages that contain these.",entryNotReadable:'"{file}" in latch.ignore matches a server script. Server scripts always stay encrypted.',noMain:'manifest.json has no "Main" field.',badMain:`"Main" ({file}) isn't a valid class name.`,noClasses:"The .jar has no .class files to protect.",mainClassMissing:"The Main class {file} isn't in the .jar."},Uz=e=>(Lz[e.code]??e.code).replace("{file}",e.file??"");var Vz=["gameplay","economy","vehicles","ui","world","admin","other"],np=["hogwartsmp","kcdc","hytale"];async function ip(e,t){let n=t.onProgress??(()=>{}),i={keepReadable:t.keepReadable??[],...t.obfuscateClient===void 0?{}:{obfuscateClient:t.obfuscateClient}};n(`Reading ${t.path}`);let r=await Go(t.path,i),o=Wo(r);if(!o.ok){let d=[o.error,...o.errors].filter(Boolean).join(`
79
79
  - `);throw new $e("packageBlocked",`The package can't be published:
80
- - ${d}`)}let a=await e.getScript(t.script).catch(d=>{if(d instanceof $e&&d.code==="notFound")return null;throw d}),s={version:t.version,changelog:t.changelog??"",...i},c,u=!1;if(a)n(`Creating version ${t.version} of ${a.slug}`),c=(await e.createVersion(a.slug,s)).upload;else{if(!t.create)throw new $e("scriptNotFound",`There's no script "${t.script}" in this workspace. To create it, also give a name, description and ecosystem.`);n(`Creating script ${t.script}`);let d=t.create;c=(await e.createScript({slug:t.script,name:d.name,description:d.description,ecosystem:d.ecosystem,category:d.category??"other",tags:d.tags??[],...s})).upload,u=!0}if(!c)throw new $e("generic","The API didn't return an upload link.");if(n(`Uploading ${r.fileName} (${(r.bytes.byteLength/1024).toFixed(0)} KB)`),await e.upload(c.url,r.bytes),t.draft)return{script:t.script,created:u,version:await e.getVersion(t.script,t.version),preview:o};n("Publishing");let l=await e.publishVersion(t.script,t.version);if(t.wait!==!1){n("Waiting for the build");let d=Date.now()+(t.timeoutMs??5*6e4);for(;l.status==="processing"&&Date.now()<d;)await new Promise(f=>setTimeout(f,t.pollMs??2e3)),l=await e.getVersion(t.script,t.version)}return{script:t.script,created:u,version:l,preview:o}}var XU=`Latch protects and licenses game server scripts (HogwartsMP / Kingdoms Connected resources). Developers upload a package; Latch encrypts the server code and the script only runs on servers whose owners were granted access by account ID (like LA-7K2M-9QXD).
80
+ - ${d}`)}let a=await e.getScript(t.script).catch(d=>{if(d instanceof $e&&d.code==="notFound")return null;throw d}),s={version:t.version,changelog:t.changelog??"",...i},c,u=!1;if(a)n(`Creating version ${t.version} of ${a.slug}`),c=(await e.createVersion(a.slug,s)).upload;else{if(!t.create)throw new $e("scriptNotFound",`There's no script "${t.script}" in this workspace. To create it, also give a name, description and ecosystem.`);n(`Creating script ${t.script}`);let d=t.create;c=(await e.createScript({slug:t.script,name:d.name,description:d.description,ecosystem:d.ecosystem,category:d.category??"other",tags:d.tags??[],...s})).upload,u=!0}if(!c)throw new $e("generic","The API didn't return an upload link.");if(n(`Uploading ${r.fileName} (${(r.bytes.byteLength/1024).toFixed(0)} KB)`),await e.upload(c.url,r.bytes),t.draft)return{script:t.script,created:u,version:await e.getVersion(t.script,t.version),preview:o};n("Publishing");let l=await e.publishVersion(t.script,t.version);if(t.wait!==!1){n("Waiting for the build");let d=Date.now()+(t.timeoutMs??5*6e4);for(;l.status==="processing"&&Date.now()<d;)await new Promise(f=>setTimeout(f,t.pollMs??2e3)),l=await e.getVersion(t.script,t.version)}return{script:t.script,created:u,version:l,preview:o}}var XU=`Latch protects and licenses game server scripts (HogwartsMP / Kingdoms Connected resources and Hytale plugins). Developers upload a package; Latch encrypts the server code and the script only runs on servers whose owners were granted access by account ID (like LA-7K2M-9QXD).
81
81
 
82
82
  Typical flows:
83
83
  - Publish a new version: preview_package on the local folder first, then publish_version. It uploads, publishes and waits for the build; report buildError if the status is "error".