UNPKG

directus-extension-constrained-files-interface

Version:

Add files upload/select interface that allows for folder, storage, and MIME type constraints.

1 lines 298 kB
import{useApi as e,defineInterface as t}from"@directus/extensions-sdk";import{defineComponent as n,ref as r,computed as i,onMounted as s,watch as o,inject as a,nextTick as l,resolveComponent as c,createBlock as u,createElementBlock as f,openBlock as d,withCtx as p,createTextVNode as h,toDisplayString as m,unref as _,createElementVNode as g,createCommentVNode as v,createVNode as y,Fragment as b,renderList as w,normalizeClass as x,normalizeStyle as $,withModifiers as k}from"vue";import{useI18n as j}from"vue-i18n";var R="object"==typeof global&&global&&global.Object===Object&&global,S="object"==typeof self&&self&&self.Object===Object&&self,A=(R||S||Function("return this")()).Symbol,O=Object.prototype,E=O.hasOwnProperty,C=O.toString,I=A?A.toStringTag:void 0;var T=Object.prototype.toString;var D=A?A.toStringTag:void 0;function N(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":D&&D in Object(e)?function(e){var t=E.call(e,I),n=e[I];try{e[I]=void 0;var r=!0}catch(e){}var i=C.call(e);return r&&(t?e[I]=n:delete e[I]),i}(e):function(e){return T.call(e)}(e)}function M(e){return null!=e&&"object"==typeof e}var L,q,z=(L=Object.getPrototypeOf,q=Object,function(e){return L(q(e))}),P=Function.prototype,F=Object.prototype,U=P.toString,W=F.hasOwnProperty,B=U.call(Object);var V=(0).constructor,G=V.isFinite;V.isInteger;var K=[].constructor.isArray;function Z(e){return null!==e&&"object"==typeof e}function H(e,t){return void 0===t&&(t=0),"string"==typeof e&&e.length>=t}function Y(e){return G(e)}function J(e){return K(e)}function Q(e,t){return Z(e)&&t in e}var X=new(function(){function e(e){this.size=e,this.reset()}return e.prototype.reset=function(){this.oldestIndex=0,this.map={},this.cachedKeys=new Array(this.size)},e.prototype.get=function(e){return this.map[e]},e.prototype.set=function(e,t){this.map[e]=t;var n=this.cachedKeys[this.oldestIndex];void 0!==n&&delete this.map[n],this.cachedKeys[this.oldestIndex]=e,this.oldestIndex++,this.oldestIndex%=this.size},e}())(1e3);function ee(e){var t=e.charAt(0),n=e.substr(-1);if("'\"`".includes(t)||"'\"`".includes(n)){if(e.length<2||t!==n)throw new SyntaxError('Mismatching string quotation: "'+e+'"');return e.substring(1,e.length-1)}if(e.includes("["))throw new SyntaxError('Missing ] in varName "'+e+'"');return"+"===t?e.substr(1):e}function te(e,t,n){var r=t.trim();if(""===r)return e;if(r.startsWith(".")){if(!n)throw new SyntaxError('Unexpected . at the start of "'+t+'"');if(""===(r=r.substr(1).trim()))return e}else if(n)throw new SyntaxError('Missing . at the start of "'+t+'"');if(r.endsWith("."))throw new SyntaxError('Unexpected "." at the end of "'+t+'"');for(var i=0,s=r.split(".");i<s.length;i++){var o=s[i].trim();if(""===o)throw new SyntaxError('Empty prop name when parsing "'+t+'"');e.push(o)}return e}function ne(e){if(!H(e))throw new TypeError("Cannot parse path. Expected string. Got a "+typeof e);for(var t,n,r=0,i=!1,s=new Array(0),o=0;o<e.length&&-1!==(t=e.indexOf("[",o));o=r){if(-1===(r=e.indexOf("]",t)))throw new SyntaxError('Missing ] in varName "'+e+'"');if(0===(n=e.substring(t+1,r).trim()).length)throw new SyntaxError("Unexpected token ]");r++,te(s,e.substring(o,t),i),s.push(ee(n)),i=!0}return te(s,e.substring(r),i)}function re(e,t,n){if(void 0===n&&(n={}),!Z(n))throw new TypeError("get expects an object option. Got "+typeof n);var r=n.depth,i=void 0===r?10:r;if(!Y(i)||i<=0)throw new RangeError("Expected a positive number for depth. Got "+i);var s=Array.isArray(t)?t:ne.cached(t),o=function(){return s.join(" > ")};if(s.length>i)throw new ReferenceError("The path cannot be deeper than "+i+' levels. Got "'+o()+'"');for(var a=e,l=0,c=s;l<c.length;l++){var u=c[l];if(!Q(a,u)){if(n.propsExist)throw new ReferenceError(u+' is not defined in the scope at path: "'+o()+'"');return}a=a[u]}return a}ne.cached=function(e){var t=X.get(e);return void 0===t&&(t=ne(e),X.set(e,t)),t};var ie=function(){function e(e,t){var n=this;if(void 0===t&&(t={}),this.tokens=e,this.options=t,this.render=function(e){void 0===e&&(e={});var t=n.tokens.varNames.length;n.cacheParsedPaths();for(var r=new Array(t),i=0;i<t;i++)r[i]=re(e,n.toPathCache[i],n.options);return n.stringify(r)},this.renderFn=function(e,t){void 0===t&&(t={});var r=n.resolveVarNames(e,t);return n.stringify(r)},this.renderFnAsync=function(e,t){return void 0===t&&(t={}),Promise.all(n.resolveVarNames(e,t)).then(function(e){return n.stringify(e)})},!Z(e)||!J(e.strings)||!J(e.varNames)||e.strings.length!==e.varNames.length+1)throw new TypeError("Invalid tokens object");if(!Z(t))throw new TypeError("Options should be an object. Got a "+typeof t);t.validateVarNames&&this.cacheParsedPaths()}return e.prototype.cacheParsedPaths=function(){var e=this.tokens.varNames;if(void 0===this.toPathCache){this.toPathCache=new Array(e.length);for(var t=0;t<e.length;t++)this.toPathCache[t]=ne.cached(e[t])}},e.prototype.resolveVarNames=function(e,t){void 0===t&&(t={});var n=this.tokens.varNames;if(!function(e){return"function"==typeof e}(e))throw new TypeError("Expected a resolver function. Got "+String(e));for(var r=n.length,i=new Array(r),s=0;s<r;s++)i[s]=e.call(null,n[s],t);return i},e.prototype.stringify=function(e){for(var t=this.tokens.strings,n=this.options.explicit,r=e.length,i="",s=0;s<r;s++){i+=t[s];var o=e[s];(n||null!=o)&&(i+=o)}return i+=t[r]},e}();function se(e,t){void 0===t&&(t={});var n=function(e,t){if(void 0===t&&(t={}),!H(e))throw new TypeError("The template parameter must be a string. Got a "+typeof e);if(!Z(t))throw new TypeError("Options should be an object. Got a "+typeof t);var n=t.tags,r=void 0===n?["{{","}}"]:n,i=t.maxVarNameLength,s=void 0===i?1e3:i;if(!J(r)||2!==r.length)throw TypeError("tags should be an array of two elements. Got "+String(r));var o=r[0],a=r[1];if(!H(o,1)||!H(a,1)||o===a)throw new TypeError('The open and close symbols should be two distinct non-empty strings. Got "'+o+'" and "'+a+'"');if(!Y(s)||s<=0)throw new Error("Expected a positive number for maxVarNameLength. Got "+s);for(var l,c,u=o.length,f=a.length,d=0,p=[],h=[],m=0;m<e.length&&-1!==(l=e.indexOf(o,m));){var _=l+u;if(-1===(d=e.substr(_,s+f).indexOf(a)))throw new SyntaxError('Missing "'+a+'" in the template for the "'+o+'" at position '+l+" within "+s+" characters");if(d+=_,0===(c=e.substring(_,d).trim()).length)throw new SyntaxError('Unexpected "'+a+'" tag found at position '+l);if(c.includes(o))throw new SyntaxError('Variable names cannot have "'+o+'". But at position '+l+'. Got "'+c+'"');h.push(c),d+=f,p.push(e.substring(m,l)),m=d}return p.push(e.substring(d)),{strings:p,varNames:h}}(e,t);return new ie(n,t)}var oe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ae(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var le,ce={exports:{}};var ue,fe=(le||(le=1,ue=ce,function(e,t){ue.exports=t()}(self,()=>{return e={7629:(e,t,n)=>{const r=n(375),i=n(8571),s=n(9474),o=n(1687),a=n(8652),l=n(8160),c=n(3292),u=n(6354),f=n(8901),d=n(9708),p=n(6914),h=n(2294),m=n(6133),_=n(1152),g=n(8863),v=n(2036),y={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new h.Ids,this._preferences=null,this._refs=new m.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={ruleset:null,whens:{}}}describe(){return r("function"==typeof d.describe,"Manifest functionality disabled"),d.describe(this)}allow(...e){return l.verifyFlat(e,"allow"),this._values(e,"_valids")}alter(e){r(e&&"object"==typeof e&&!Array.isArray(e),"Invalid targets argument"),r(!this._inRuleset(),"Cannot set alterations inside a ruleset");const t=this.clone();t.$_terms.alterations=t.$_terms.alterations||[];for(const n in e){const i=e[n];r("function"==typeof i,"Alteration adjuster for",n,"must be a function"),t.$_terms.alterations.push({target:n,adjuster:i})}return t.$_temp.ruleset=!1,t}artifact(e){return r(void 0!==e,"Artifact cannot be undefined"),r(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",e)}cast(e){return r(!1===e||"string"==typeof e,"Invalid to value"),r(!1===e||this._definition.cast[e],"Type",this.type,"does not support casting to",e),this.$_setFlag("cast",!1===e?void 0:e)}default(e,t){return this._default("default",e,t)}description(e){return r(e&&"string"==typeof e,"Description must be a non-empty string"),this.$_setFlag("description",e)}empty(e){const t=this.clone();return void 0!==e&&(e=t.$_compile(e,{override:!1})),t.$_setFlag("empty",e,{clone:!1})}error(e){return r(e,"Missing error"),r(e instanceof Error||"function"==typeof e,"Must provide a valid Error object or a function"),this.$_setFlag("error",e)}example(e,t={}){return r(void 0!==e,"Missing example"),l.assertOptions(t,["override"]),this._inner("examples",e,{single:!0,override:t.override})}external(e,t){return"object"==typeof e&&(r(!t,"Cannot combine options with description"),t=e.description,e=e.method),r("function"==typeof e,"Method must be a function"),r(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this._inner("externals",{method:e,description:t},{single:!0})}failover(e,t){return this._default("failover",e,t)}forbidden(){return this.presence("forbidden")}id(e){return e?(r("string"==typeof e,"id must be a non-empty string"),r(/^[^\.]+$/.test(e),"id cannot contain period character"),this.$_setFlag("id",e)):this.$_setFlag("id",void 0)}invalid(...e){return this._values(e,"_invalids")}label(e){return r(e&&"string"==typeof e,"Label name must be a non-empty string"),this.$_setFlag("label",e)}meta(e){return r(void 0!==e,"Meta cannot be undefined"),this._inner("metas",e,{single:!0})}note(...e){r(e.length,"Missing notes");for(const t of e)r(t&&"string"==typeof t,"Notes must be non-empty strings");return this._inner("notes",e)}only(e=!0){return r("boolean"==typeof e,"Invalid mode:",e),this.$_setFlag("only",e)}optional(){return this.presence("optional")}prefs(e){r(e,"Missing preferences"),r(void 0===e.context,"Cannot override context"),r(void 0===e.externals,"Cannot override externals"),r(void 0===e.warnings,"Cannot override warnings"),r(void 0===e.debug,"Cannot override debug"),l.checkPreferences(e);const t=this.clone();return t._preferences=l.preferences(t._preferences,e),t}presence(e){return r(["optional","required","forbidden"].includes(e),"Unknown presence mode",e),this.$_setFlag("presence",e)}raw(e=!0){return this.$_setFlag("result",e?"raw":void 0)}result(e){return r(["raw","strip"].includes(e),"Unknown result mode",e),this.$_setFlag("result",e)}required(){return this.presence("required")}strict(e){const t=this.clone(),n=void 0!==e&&!e;return t._preferences=l.preferences(t._preferences,{convert:n}),t}strip(e=!0){return this.$_setFlag("result",e?"strip":void 0)}tag(...e){r(e.length,"Missing tags");for(const t of e)r(t&&"string"==typeof t,"Tags must be non-empty strings");return this._inner("tags",e)}unit(e){return r(e&&"string"==typeof e,"Unit name must be a non-empty string"),this.$_setFlag("unit",e)}valid(...e){l.verifyFlat(e,"valid");const t=this.allow(...e);return t.$_setFlag("only",!!t._valids,{clone:!1}),t}when(e,t){const n=this.clone();n.$_terms.whens||(n.$_terms.whens=[]);const i=c.when(n,e,t);if(!["any","link"].includes(n.type)){const e=i.is?[i]:i.switch;for(const t of e)r(!t.then||"any"===t.then.type||t.then.type===n.type,"Cannot combine",n.type,"with",t.then&&t.then.type),r(!t.otherwise||"any"===t.otherwise.type||t.otherwise.type===n.type,"Cannot combine",n.type,"with",t.otherwise&&t.otherwise.type)}return n.$_terms.whens.push(i),n.$_mutateRebuild()}cache(e){r(!this._inRuleset(),"Cannot set caching inside a ruleset"),r(!this._cache,"Cannot override schema cache"),r(void 0===this._flags.artifact,"Cannot cache a rule with an artifact");const t=this.clone();return t._cache=e||a.provider.provision(),t.$_temp.ruleset=!1,t}clone(){const e=Object.create(Object.getPrototypeOf(this));return this._assign(e)}concat(e){r(l.isSchema(e),"Invalid schema object"),r("any"===this.type||"any"===e.type||e.type===this.type,"Cannot merge type",this.type,"with another type:",e.type),r(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),r(!e._inRuleset(),"Cannot concatenate a schema with open ruleset");let t=this.clone();if("any"===this.type&&"any"!==e.type){const n=e.clone();for(const e of Object.keys(t))"type"!==e&&(n[e]=t[e]);t=n}t._ids.concat(e._ids),t._refs.register(e,m.toSibling),t._preferences=t._preferences?l.preferences(t._preferences,e._preferences):e._preferences,t._valids=v.merge(t._valids,e._valids,e._invalids),t._invalids=v.merge(t._invalids,e._invalids,e._valids);for(const n of e._singleRules.keys())t._singleRules.has(n)&&(t._rules=t._rules.filter(e=>e.keep||e.name!==n),t._singleRules.delete(n));for(const n of e._rules)e._definition.rules[n.method].multi||t._singleRules.set(n.name,n),t._rules.push(n);if(t._flags.empty&&e._flags.empty){t._flags.empty=t._flags.empty.concat(e._flags.empty);const n=Object.assign({},e._flags);delete n.empty,o(t._flags,n)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const n=Object.assign({},e._flags);delete n.empty,o(t._flags,n)}else o(t._flags,e._flags);for(const n in e.$_terms){const r=e.$_terms[n];r?t.$_terms[n]?t.$_terms[n]=t.$_terms[n].concat(r):t.$_terms[n]=r.slice():t.$_terms[n]||(t.$_terms[n]=r)}return this.$_root._tracer&&this.$_root._tracer._combine(t,[this,e]),t.$_mutateRebuild()}extend(e){return r(!e.base,"Cannot extend type with another base"),f.type(this,e)}extract(e){return e=Array.isArray(e)?e:e.split("."),this._ids.reach(e)}fork(e,t){r(!this._inRuleset(),"Cannot fork inside a ruleset");let n=this;for(let r of[].concat(e))r=Array.isArray(r)?r:r.split("."),n=n._ids.fork(r,t,n);return n.$_temp.ruleset=!1,n}rule(e){const t=this._definition;l.assertOptions(e,Object.keys(t.modifiers)),r(!1!==this.$_temp.ruleset,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const n=null===this.$_temp.ruleset?this._rules.length-1:this.$_temp.ruleset;r(n>=0&&n<this._rules.length,"Cannot apply rules to empty ruleset");const s=this.clone();for(let o=n;o<s._rules.length;++o){const n=s._rules[o],a=i(n);for(const i in e)t.modifiers[i](a,e[i]),r(a.name===n.name,"Cannot change rule name");s._rules[o]=a,s._singleRules.get(a.name)===n&&s._singleRules.set(a.name,a)}return s.$_temp.ruleset=!1,s.$_mutateRebuild()}get ruleset(){r(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const e=this.clone();return e.$_temp.ruleset=e._rules.length,e}get $(){return this.ruleset}tailor(e){e=[].concat(e),r(!this._inRuleset(),"Cannot tailor inside a ruleset");let t=this;if(this.$_terms.alterations)for(const{target:n,adjuster:i}of this.$_terms.alterations)e.includes(n)&&(t=i(t),r(l.isSchema(t),"Alteration adjuster for",n,"failed to return a schema object"));return t=t.$_modify({each:t=>t.tailor(e),ref:!1}),t.$_temp.ruleset=!1,t.$_mutateRebuild()}tracer(){return _.location?_.location(this):this}validate(e,t){return g.entry(e,this,t)}validateAsync(e,t){return g.entryAsync(e,this,t)}$_addRule(e){"string"==typeof e&&(e={name:e}),r(e&&"object"==typeof e,"Invalid options"),r(e.name&&"string"==typeof e.name,"Invalid rule name");for(const t in e)r("_"!==t[0],"Cannot set private rule properties");const t=Object.assign({},e);t._resolve=[],t.method=t.method||t.name;const n=this._definition.rules[t.method],i=t.args;r(n,"Unknown rule",t.method);const s=this.clone();if(i){r(1===Object.keys(i).length||Object.keys(i).length===this._definition.rules[t.name].args.length,"Invalid rule definition for",this.type,t.name);for(const e in i){let o=i[e];if(n.argsByName){const a=n.argsByName.get(e);if(a.ref&&l.isResolvable(o))t._resolve.push(e),s.$_mutateRegister(o);else if(a.normalize&&(o=a.normalize(o),i[e]=o),a.assert){const t=l.validateArg(o,e,a);r(!t,t,"or reference")}}void 0!==o?i[e]=o:delete i[e]}}return n.multi||(s._ruleRemove(t.name,{clone:!1}),s._singleRules.set(t.name,t)),!1===s.$_temp.ruleset&&(s.$_temp.ruleset=null),n.priority?s._rules.unshift(t):s._rules.push(t),s}$_compile(e,t){return c.schema(this.$_root,e,t)}$_createError(e,t,n,r,i,s={}){const o=!1!==s.flags?this._flags:{},a=s.messages?p.merge(this._definition.messages,s.messages):this._definition.messages;return new u.Report(e,t,n,o,a,r,i)}$_getFlag(e){return this._flags[e]}$_getRule(e){return this._singleRules.get(e)}$_mapLabels(e){return e=Array.isArray(e)?e:e.split("."),this._ids.labels(e)}$_match(e,t,n,r){(n=Object.assign({},n)).abortEarly=!0,n._externals=!1,t.snapshot();const i=!g.validate(e,this,t,n,r).errors;return t.restore(),i}$_modify(e){return l.assertOptions(e,["each","once","ref","schema"]),h.schema(this,e)||this}$_mutateRebuild(){return r(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset(),this.$_modify({each:(e,{source:t,name:n,path:r,key:i})=>{const s=this._definition[t][n]&&this._definition[t][n].register;!1!==s&&this.$_mutateRegister(e,{family:s,key:i})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(e,{family:t,key:n}={}){this._refs.register(e,t),this._ids.register(e,{key:n})}$_property(e){return this._definition.properties[e]}$_reach(e){return this._ids.reach(e)}$_rootReferences(){return this._refs.roots()}$_setFlag(e,t,n={}){r("_"===e[0]||!this._inRuleset(),"Cannot set flag inside a ruleset");const i=this._definition.flags[e]||{};if(s(t,i.default)&&(t=void 0),s(t,this._flags[e]))return this;const o=!1!==n.clone?this.clone():this;return void 0!==t?(o._flags[e]=t,o.$_mutateRegister(t)):delete o._flags[e],"_"!==e[0]&&(o.$_temp.ruleset=!1),o}$_parent(e,...t){return this[e][l.symbols.parent].call(this,...t)}$_validate(e,t,n){return g.validate(e,this,t,n)}_assign(e){e.type=this.type,e.$_root=this.$_root,e.$_temp=Object.assign({},this.$_temp),e.$_temp.whens={},e._ids=this._ids.clone(),e._preferences=this._preferences,e._valids=this._valids&&this._valids.clone(),e._invalids=this._invalids&&this._invalids.clone(),e._rules=this._rules.slice(),e._singleRules=i(this._singleRules,{shallow:!0}),e._refs=this._refs.clone(),e._flags=Object.assign({},this._flags),e._cache=null,e.$_terms={};for(const t in this.$_terms)e.$_terms[t]=this.$_terms[t]?this.$_terms[t].slice():null;e.$_super={};for(const t in this.$_super)e.$_super[t]=this._super[t].bind(e);return e}_bare(){const e=this.clone();e._reset();const t=e._definition.terms;for(const n in t){const r=t[n];e.$_terms[n]=r.init}return e.$_mutateRebuild()}_default(e,t,n={}){return l.assertOptions(n,"literal"),r(void 0!==t,"Missing",e,"value"),r("function"==typeof t||!n.literal,"Only function value supports literal option"),"function"==typeof t&&n.literal&&(t={[l.symbols.literal]:!0,literal:t}),this.$_setFlag(e,t)}_generate(e,t,n){if(!this.$_terms.whens)return{schema:this};const r=[],i=[];for(let s=0;s<this.$_terms.whens.length;++s){const o=this.$_terms.whens[s];if(o.concat){r.push(o.concat),i.push(`${s}.concat`);continue}const a=o.ref?o.ref.resolve(e,t,n):e,l=o.is?[o]:o.switch,c=i.length;for(let c=0;c<l.length;++c){const{is:u,then:f,otherwise:d}=l[c],p=`${s}${o.switch?"."+c:""}`;if(u.$_match(a,t.nest(u,`${p}.is`),n)){if(f){const s=t.localize([...t.path,`${p}.then`],t.ancestors,t.schemas),{schema:o,id:a}=f._generate(e,s,n);r.push(o),i.push(`${p}.then${a?`(${a})`:""}`);break}}else if(d){const s=t.localize([...t.path,`${p}.otherwise`],t.ancestors,t.schemas),{schema:o,id:a}=d._generate(e,s,n);r.push(o),i.push(`${p}.otherwise${a?`(${a})`:""}`);break}}if(o.break&&i.length>c)break}const s=i.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",s),!s)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[s])return{schema:this.$_temp.whens[s],id:s};let o=this;this._definition.generate&&(o=this._definition.generate(this,e,t,n));for(const e of r)o=o.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(o,[this,...r]),this.$_temp.whens[s]=o,{schema:o,id:s}}_inner(e,t,n={}){r(!this._inRuleset(),`Cannot set ${e} inside a ruleset`);const i=this.clone();return i.$_terms[e]&&!n.override||(i.$_terms[e]=[]),n.single?i.$_terms[e].push(t):i.$_terms[e].push(...t),i.$_temp.ruleset=!1,i}_inRuleset(){return null!==this.$_temp.ruleset&&!1!==this.$_temp.ruleset}_ruleRemove(e,t={}){if(!this._singleRules.has(e))return this;const n=!1!==t.clone?this.clone():this;n._singleRules.delete(e);const r=[];for(let t=0;t<n._rules.length;++t){const i=n._rules[t];i.name!==e||i.keep?r.push(i):n._inRuleset()&&t<n.$_temp.ruleset&&--n.$_temp.ruleset}return n._rules=r,n}_values(e,t){l.verifyFlat(e,t.slice(1,-1));const n=this.clone(),i=e[0]===l.symbols.override;if(i&&(e=e.slice(1)),!n[t]&&e.length?n[t]=new v:i&&(n[t]=e.length?new v:null,n.$_mutateRebuild()),!n[t])return n;i&&n[t].override();for(const i of e){r(void 0!==i,"Cannot call allow/valid/invalid with undefined"),r(i!==l.symbols.override,"Override must be the first value");const e="_invalids"===t?"_valids":"_invalids";n[e]&&(n[e].remove(i),n[e].length||(r("_valids"===t||!n._flags.only,"Setting invalid value",i,"leaves schema rejecting all values due to previous valid rule"),n[e]=null)),n[t].add(i,n._refs)}return n}}};y.Base.prototype[l.symbols.any]={version:l.version,compile:c.compile,root:"$_root"},y.Base.prototype.isImmutable=!0,y.Base.prototype.deny=y.Base.prototype.invalid,y.Base.prototype.disallow=y.Base.prototype.invalid,y.Base.prototype.equal=y.Base.prototype.valid,y.Base.prototype.exist=y.Base.prototype.required,y.Base.prototype.not=y.Base.prototype.invalid,y.Base.prototype.options=y.Base.prototype.prefs,y.Base.prototype.preferences=y.Base.prototype.prefs,e.exports=new y.Base},8652:(e,t,n)=>{const r=n(375),i=n(8571),s=n(8160),o={max:1e3,supported:new Set(["undefined","boolean","number","string"])};t.provider={provision:e=>new o.Cache(e)},o.Cache=class{constructor(e={}){s.assertOptions(e,["max"]),r(void 0===e.max||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||o.max,this._map=new Map,this._list=new o.List}get length(){return this._map.size}set(e,t){if(null!==e&&!o.supported.has(typeof e))return;let n=this._map.get(e);if(n)return n.value=t,void this._list.first(n);n=this._list.unshift({key:e,value:t}),this._map.set(e,n),this._compact()}get(e){const t=this._map.get(e);if(t)return this._list.first(t),i(t.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},o.List=class{constructor(){this.tail=null,this.head=null}unshift(e){return e.next=null,e.prev=this.head,this.head&&(this.head.next=e),this.head=e,this.tail||(this.tail=e),e}first(e){e!==this.head&&(this._remove(e),this.unshift(e))}pop(){return this._remove(this.tail)}_remove(e){const{next:t,prev:n}=e;return t.prev=n,n&&(n.next=t),e===this.tail&&(this.tail=t),e.prev=null,e.next=null,e}}},8160:(e,t,n)=>{const r=n(375),i=n(7916),s=n(5934);let o,a;const l={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};t.version=s.version,t.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},t.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},t.assertOptions=function(e,t,n="Options"){r(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const i=Object.keys(e).filter(e=>!t.includes(e));r(0===i.length,`${n} contain unknown keys: ${i}`)},t.checkPreferences=function(e){a=a||n(3378);const t=a.preferences.validate(e);if(t.error)throw new i([t.error.details[0].message])},t.compare=function(e,t,n){switch(n){case"=":return e===t;case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}},t.default=function(e,t){return void 0===e?t:e},t.isIsoDate=function(e){return l.isoDate.test(e)},t.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},t.isResolvable=function(e){return!!e&&(e[t.symbols.ref]||e[t.symbols.template])},t.isSchema=function(e,n={}){const i=e&&e[t.symbols.any];return!!i&&(r(n.legacy||i.version===t.version,"Cannot mix different versions of joi schemas"),!0)},t.isValues=function(e){return e[t.symbols.values]},t.limit=function(e){return Number.isSafeInteger(e)&&e>=0},t.preferences=function(e,r){o=o||n(6914),e=e||{},r=r||{};const i=Object.assign({},e,r);return r.errors&&e.errors&&(i.errors=Object.assign({},e.errors,r.errors),i.errors.wrap=Object.assign({},e.errors.wrap,r.errors.wrap)),r.messages&&(i.messages=o.compile(r.messages,e.messages)),delete i[t.symbols.prefs],i},t.tryWithPath=function(e,t,n={}){try{return e()}catch(e){throw void 0!==e.path?e.path=t+"."+e.path:e.path=t,n.append&&(e.message=`${e.message} (${e.path})`),e}},t.validateArg=function(e,n,{assert:r,message:i}){if(t.isSchema(r)){const t=r.validate(e);if(!t.error)return;return t.error.message}if(!r(e))return n?`${n} ${i}`:i},t.verifyFlat=function(e,t){for(const n of e)r(!Array.isArray(n),"Method no longer accepts array arguments:",t)}},3292:(e,t,n)=>{const r=n(375),i=n(8160),s=n(6133),o={};t.schema=function(e,t,n={}){i.assertOptions(n,["appendPath","override"]);try{return o.schema(e,t,n)}catch(e){throw n.appendPath&&void 0!==e.path&&(e.message=`${e.message} (${e.path})`),e}},o.schema=function(e,t,n){r(void 0!==t,"Invalid undefined schema"),Array.isArray(t)&&(r(t.length,"Invalid empty array schema"),1===t.length&&(t=t[0]));const s=(t,...r)=>!1!==n.override?t.valid(e.override,...r):t.valid(...r);if(o.simple(t))return s(e,t);if("function"==typeof t)return e.custom(t);if(r("object"==typeof t,"Invalid schema content:",typeof t),i.isResolvable(t))return s(e,t);if(i.isSchema(t))return t;if(Array.isArray(t)){for(const n of t)if(!o.simple(n))return e.alternatives().try(...t);return s(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?s(e.date(),t):(r(Object.getPrototypeOf(t)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(t))},t.ref=function(e,t){return s.isRef(e)?e:s.create(e,t)},t.compile=function(e,n,s={}){i.assertOptions(s,["legacy"]);const a=n&&n[i.symbols.any];if(a)return r(s.legacy||a.version===i.version,"Cannot mix different versions of joi schemas:",a.version,i.version),n;if("object"!=typeof n||!s.legacy)return t.schema(e,n,{appendPath:!0});const l=o.walk(n);return l?l.compile(l.root,n):t.schema(e,n,{appendPath:!0})},o.walk=function(e){if("object"!=typeof e)return null;if(Array.isArray(e)){for(const t of e){const e=o.walk(t);if(e)return e}return null}const t=e[i.symbols.any];if(t)return{root:e[t.root],compile:t.compile};r(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const t in e){const n=o.walk(e[t]);if(n)return n}return null},o.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,n,a){if(void 0===a&&(r(n&&"object"==typeof n,"Missing options"),a=n,n=s.create(".")),Array.isArray(a)&&(a={switch:a}),i.assertOptions(a,["is","not","then","otherwise","switch","break"]),i.isSchema(n))return r(void 0===a.is,'"is" can not be used with a schema condition'),r(void 0===a.not,'"not" can not be used with a schema condition'),r(void 0===a.switch,'"switch" can not be used with a schema condition'),o.condition(e,{is:n,then:a.then,otherwise:a.otherwise,break:a.break});if(r(s.isRef(n)||"string"==typeof n,"Invalid condition:",n),r(void 0===a.not||void 0===a.is,'Cannot combine "is" with "not"'),void 0===a.switch){let l=a;void 0!==a.not&&(l={is:a.not,then:a.otherwise,otherwise:a.then,break:a.break});let c=void 0!==l.is?e.$_compile(l.is):e.$_root.invalid(null,!1,0,"").required();return r(void 0!==l.then||void 0!==l.otherwise,'options must have at least one of "then", "otherwise", or "switch"'),r(void 0===l.break||void 0===l.then||void 0===l.otherwise,"Cannot specify then, otherwise, and break all together"),void 0===a.is||s.isRef(a.is)||i.isSchema(a.is)||(c=c.required()),o.condition(e,{ref:t.ref(n),is:c,then:l.then,otherwise:l.otherwise,break:l.break})}r(Array.isArray(a.switch),'"switch" must be an array'),r(void 0===a.is,'Cannot combine "switch" with "is"'),r(void 0===a.not,'Cannot combine "switch" with "not"'),r(void 0===a.then,'Cannot combine "switch" with "then"');const l={ref:t.ref(n),switch:[],break:a.break};for(let t=0;t<a.switch.length;++t){const n=a.switch[t],o=t===a.switch.length-1;i.assertOptions(n,o?["is","then","otherwise"]:["is","then"]),r(void 0!==n.is,'Switch statement missing "is"'),r(void 0!==n.then,'Switch statement missing "then"');const c={is:e.$_compile(n.is),then:e.$_compile(n.then)};if(s.isRef(n.is)||i.isSchema(n.is)||(c.is=c.is.required()),o){r(void 0===a.otherwise||void 0===n.otherwise,'Cannot specify "otherwise" inside and outside a "switch"');const t=void 0!==a.otherwise?a.otherwise:n.otherwise;void 0!==t&&(r(void 0===l.break,"Cannot specify both otherwise and break"),c.otherwise=e.$_compile(t))}l.switch.push(c)}return l},o.condition=function(e,t){for(const n of["then","otherwise"])void 0===t[n]?delete t[n]:t[n]=e.$_compile(t[n]);return t}},6354:(e,t,n)=>{const r=n(5688),i=n(8160),s=n(3328);t.Report=class{constructor(e,n,r,i,s,o,a){if(this.code=e,this.flags=i,this.messages=s,this.path=o.path,this.prefs=a,this.state=o,this.value=n,this.message=null,this.template=null,this.local=r||{},this.local.label=t.label(this.flags,this.state,this.prefs,this.messages),void 0===this.value||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const e=this.path[this.path.length-1];"object"!=typeof e&&(this.local.key=e)}}_setTemplate(e){if(this.template=e,!this.flags.label&&0===this.path.length){const e=this._template(this.template,"root");e&&(this.local.label=e)}}toString(){if(this.message)return this.message;const e=this.code;if(!this.prefs.errors.render)return this.code;const t=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return void 0===t?`Error code "${e}" is not defined, your custom type is missing the correct messages definition`:(this.message=t.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(e,n){return t.template(this.value,e,n||this.code,this.state,this.prefs)}},t.path=function(e){let t="";for(const n of e)"object"!=typeof n&&("string"==typeof n?(t&&(t+="."),t+=n):t+=`[${n}]`);return t},t.template=function(e,t,n,r,o){if(!t)return;if(s.isTemplate(t))return"root"!==n?t:null;let a=o.errors.language;if(i.isResolvable(a)&&(a=a.resolve(e,r,o)),a&&t[a]){if(void 0!==t[a][n])return t[a][n];if(void 0!==t[a]["*"])return t[a]["*"]}return t[n]?t[n]:t["*"]},t.label=function(e,n,r,i){if(!r.errors.label)return"";if(e.label)return e.label;let s=n.path;return"key"===r.errors.label&&n.path.length>1&&(s=n.path.slice(-1)),t.path(s)||t.template(null,r.messages,"root",n,r)||i&&t.template(null,i,"root",n,r)||"value"},t.process=function(e,n,r){if(!e)return null;const{override:i,message:s,details:o}=t.details(e);if(i)return i;if(r.errors.stack)return new t.ValidationError(s,o,n);const a=Error.stackTraceLimit;Error.stackTraceLimit=0;const l=new t.ValidationError(s,o,n);return Error.stackTraceLimit=a,l},t.details=function(e,t={}){let n=[];const r=[];for(const i of e){if(i instanceof Error){if(!1!==t.override)return{override:i};const e=i.toString();n.push(e),r.push({message:e,type:"override",context:{error:i}});continue}const e=i.toString();n.push(e),r.push({message:e,path:i.path.filter(e=>"object"!=typeof e),type:i.code,context:i.local})}return n.length>1&&(n=[...new Set(n)]),{message:n.join(". "),details:r}},t.ValidationError=class extends Error{constructor(e,t,n){super(e),this._original=n,this.details=t}static isError(e){return e instanceof t.ValidationError}},t.ValidationError.prototype.isJoi=!0,t.ValidationError.prototype.name="ValidationError",t.ValidationError.prototype.annotate=r.error},8901:(e,t,n)=>{const r=n(375),i=n(8571),s=n(8160),o=n(6914),a={};t.type=function(e,t){const n=Object.getPrototypeOf(e),l=i(n),c=e._assign(Object.create(l)),u=Object.assign({},t);delete u.base,l._definition=u;const f=n._definition||{};u.messages=o.merge(f.messages,u.messages),u.properties=Object.assign({},f.properties,u.properties),c.type=u.type,u.flags=Object.assign({},f.flags,u.flags);const d=Object.assign({},f.terms);if(u.terms)for(const e in u.terms){const t=u.terms[e];r(void 0===c.$_terms[e],"Invalid term override for",u.type,e),c.$_terms[e]=t.init,d[e]=t}u.terms=d,u.args||(u.args=f.args),u.prepare=a.prepare(u.prepare,f.prepare),u.coerce&&("function"==typeof u.coerce&&(u.coerce={method:u.coerce}),u.coerce.from&&!Array.isArray(u.coerce.from)&&(u.coerce={method:u.coerce.method,from:[].concat(u.coerce.from)})),u.coerce=a.coerce(u.coerce,f.coerce),u.validate=a.validate(u.validate,f.validate);const p=Object.assign({},f.rules);if(u.rules)for(const e in u.rules){const t=u.rules[e];r("object"==typeof t,"Invalid rule definition for",u.type,e);let n=t.method;if(void 0===n&&(n=function(){return this.$_addRule(e)}),n&&(r(!l[e],"Rule conflict in",u.type,e),l[e]=n),r(!p[e],"Rule conflict in",u.type,e),p[e]=t,t.alias){const e=[].concat(t.alias);for(const n of e)l[n]=t.method}t.args&&(t.argsByName=new Map,t.args=t.args.map(e=>("string"==typeof e&&(e={name:e}),r(!t.argsByName.has(e.name),"Duplicated argument name",e.name),s.isSchema(e.assert)&&(e.assert=e.assert.strict().label(e.name)),t.argsByName.set(e.name,e),e)))}u.rules=p;const h=Object.assign({},f.modifiers);if(u.modifiers)for(const e in u.modifiers){r(!l[e],"Rule conflict in",u.type,e);const t=u.modifiers[e];r("function"==typeof t,"Invalid modifier definition for",u.type,e);const n=function(t){return this.rule({[e]:t})};l[e]=n,h[e]=t}if(u.modifiers=h,u.overrides){l._super=n,c.$_super={};for(const e in u.overrides)r(n[e],"Cannot override missing",e),u.overrides[e][s.symbols.parent]=n[e],c.$_super[e]=n[e].bind(c);Object.assign(l,u.overrides)}u.cast=Object.assign({},f.cast,u.cast);const m=Object.assign({},f.manifest,u.manifest);return m.build=a.build(u.manifest&&u.manifest.build,f.manifest&&f.manifest.build),u.manifest=m,u.rebuild=a.rebuild(u.rebuild,f.rebuild),c},a.build=function(e,t){return e&&t?function(n,r){return t(e(n,r),r)}:e||t},a.coerce=function(e,t){return e&&t?{from:e.from&&t.from?[...new Set([...e.from,...t.from])]:null,method(n,r){let i;if((!t.from||t.from.includes(typeof n))&&(i=t.method(n,r),i)){if(i.errors||void 0===i.value)return i;n=i.value}if(!e.from||e.from.includes(typeof n)){const t=e.method(n,r);if(t)return t}return i}}:e||t},a.prepare=function(e,t){return e&&t?function(n,r){const i=e(n,r);if(i){if(i.errors||void 0===i.value)return i;n=i.value}return t(n,r)||i}:e||t},a.rebuild=function(e,t){return e&&t?function(n){t(n),e(n)}:e||t},a.validate=function(e,t){return e&&t?function(n,r){const i=t(n,r);if(i){if(i.errors&&(!Array.isArray(i.errors)||i.errors.length))return i;n=i.value}return e(n,r)||i}:e||t}},5107:(e,t,n)=>{const r=n(375),i=n(8571),s=n(8652),o=n(8160),a=n(3292),l=n(6354),c=n(8901),u=n(9708),f=n(6133),d=n(3328),p=n(1152);let h;const m={types:{alternatives:n(4946),any:n(8068),array:n(546),boolean:n(4937),date:n(7500),function:n(390),link:n(8785),number:n(3832),object:n(8966),string:n(7417),symbol:n(8826)},aliases:{alt:"alternatives",bool:"boolean",func:"function"},root:function(){const e={_types:new Set(Object.keys(m.types))};for(const t of e._types)e[t]=function(...e){return r(!e.length||["alternatives","link","object"].includes(t),"The",t,"type does not allow arguments"),m.generate(this,m.types[t],e)};for(const t of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])e[t]=function(...e){return this.any()[t](...e)};Object.assign(e,m.methods);for(const t in m.aliases){const n=m.aliases[t];e[t]=e[n]}return e.x=e.expression,p.setup&&p.setup(e),e}};m.methods={ValidationError:l.ValidationError,version:o.version,cache:s.provider,assert(e,t,...n){m.assert(e,t,!0,n)},attempt:(e,t,...n)=>m.assert(e,t,!1,n),build(e){return r("function"==typeof u.build,"Manifest functionality disabled"),u.build(this,e)},checkPreferences(e){o.checkPreferences(e)},compile(e,t){return a.compile(this,e,t)},defaults(e){r("function"==typeof e,"modifier must be a function");const t=Object.assign({},this);for(const n of t._types){const i=e(t[n]());r(o.isSchema(i),"modifier must return a valid schema object"),t[n]=function(...e){return m.generate(this,i,e)}}return t},expression:(...e)=>new d(...e),extend(...e){o.verifyFlat(e,"extend"),h=h||n(3378),r(e.length,"You need to provide at least one extension"),this.assert(e,h.extensions);const t=Object.assign({},this);t._types=new Set(t._types);for(let n of e){"function"==typeof n&&(n=n(t)),this.assert(n,h.extension);const e=m.expandExtension(n,t);for(const n of e){r(void 0===t[n.type]||t._types.has(n.type),"Cannot override name",n.type);const e=n.base||this.any(),i=c.type(e,n);t._types.add(n.type),t[n.type]=function(...e){return m.generate(this,i,e)}}}return t},isError:l.ValidationError.isError,isExpression:d.isTemplate,isRef:f.isRef,isSchema:o.isSchema,in:(...e)=>f.in(...e),override:o.symbols.override,ref:(...e)=>f.create(...e),types(){const e={};for(const t of this._types)e[t]=this[t]();for(const t in m.aliases)e[t]=this[t]();return e}},m.assert=function(e,t,n,r){const s=r[0]instanceof Error||"string"==typeof r[0]?r[0]:null,a=null!==s?r[1]:r[0],c=t.validate(e,o.preferences({errors:{stack:!0}},a||{}));let u=c.error;if(!u)return c.value;if(s instanceof Error)throw s;const f=n&&"function"==typeof u.annotate?u.annotate():u.message;throw u instanceof l.ValidationError==0&&(u=i(u)),u.message=s?`${s} ${f}`:f,u},m.generate=function(e,t,n){return r(e,"Must be invoked on a Joi instance."),t.$_root=e,t._definition.args&&n.length?t._definition.args(t,...n):t},m.expandExtension=function(e,t){if("string"==typeof e.type)return[e];const n=[];for(const r of t._types)if(e.type.test(r)){const i=Object.assign({},e);i.type=r,i.base=t[r](),n.push(i)}return n},e.exports=m.root()},6914:(e,t,n)=>{const r=n(375),i=n(8571),s=n(3328);t.compile=function(e,t){if("string"==typeof e)return r(!t,"Cannot set single message string"),new s(e);if(s.isTemplate(e))return r(!t,"Cannot set single message template"),e;r("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?i(t):{};for(let n in e){const i=e[n];if("root"===n||s.isTemplate(i)){t[n]=i;continue}if("string"==typeof i){t[n]=new s(i);continue}r("object"==typeof i&&!Array.isArray(i),"Invalid message for",n);const o=n;for(n in t[o]=t[o]||{},i){const e=i[n];"root"===n||s.isTemplate(e)?t[o][n]=e:(r("string"==typeof e,"Invalid message for",n,"in",o),t[o][n]=new s(e))}}return t},t.decompile=function(e){const t={};for(let n in e){const r=e[n];if("root"===n){t.root=r;continue}if(s.isTemplate(r)){t[n]=r.describe({compact:!0});continue}const i=n;for(n in t[i]={},r){const e=r[n];"root"!==n?t[i][n]=e.describe({compact:!0}):t[i].root=e}}return t},t.merge=function(e,n){if(!e)return t.compile(n);if(!n)return e;if("string"==typeof n)return new s(n);if(s.isTemplate(n))return n;const o=i(e);for(let e in n){const t=n[e];if("root"===e||s.isTemplate(t)){o[e]=t;continue}if("string"==typeof t){o[e]=new s(t);continue}r("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const i=e;for(e in o[i]=o[i]||{},t){const n=t[e];"root"===e||s.isTemplate(n)?o[i][e]=n:(r("string"==typeof n,"Invalid message for",e,"in",i),o[i][e]=new s(n))}}return o}},2294:(e,t,n)=>{const r=n(375),i=n(8160),s=n(6133),o={};t.Ids=o.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new o.Ids;return e._byId=new Map(this._byId),e._byKey=new Map(this._byKey),e._schemaChain=this._schemaChain,e}concat(e){e._schemaChain&&(this._schemaChain=!0);for(const[t,n]of e._byId.entries())r(!this._byKey.has(t),"Schema id conflicts with existing key:",t),this._byId.set(t,n);for(const[t,n]of e._byKey.entries())r(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,n)}fork(e,t,n){const s=this._collect(e);s.push({schema:n});const a=s.shift();let l={id:a.id,schema:t(a.schema)};r(i.isSchema(l.schema),"adjuster function failed to return a joi schema type");for(const e of s)l={id:e.id,schema:o.fork(e.schema,l.id,l.schema)};return l.schema}labels(e,t=[]){const n=e[0],r=this._get(n);if(!r)return[...t,...e].join(".");const i=e.slice(1);return t=[...t,r.schema._flags.label||n],i.length?r.schema._ids.labels(i,t):t.join(".")}reach(e,t=[]){const n=e[0],i=this._get(n);r(i,"Schema does not contain path",[...t,...e].join("."));const s=e.slice(1);return s.length?i.schema._ids.reach(s,[...t,n]):i.schema}register(e,{key:t}={}){if(!e||!i.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const n=e._flags.id;if(n){const t=this._byId.get(n);r(!t||t.schema===e,"Cannot add different schemas with the same id:",n),r(!this._byKey.has(n),"Schema id conflicts with existing key:",n),this._byId.set(n,{schema:e,id:n})}t&&(r(!this._byKey.has(t),"Schema already contains key:",t),r(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,{schema:e,id:t}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(e,t=[],n=[]){const i=e[0],s=this._get(i);r(s,"Schema does not contain path",[...t,...e].join(".")),n=[s,...n];const o=e.slice(1);return o.length?s.schema._ids._collect(o,[...t,i],n):n}_get(e){return this._byId.get(e)||this._byKey.get(e)}},o.fork=function(e,n,r){const i=t.schema(e,{each:(e,{key:t})=>{if(n===(e._flags.id||t))return r},ref:!1});return i?i.$_mutateRebuild():e},t.schema=function(e,t){let n;for(const r in e._flags){if("_"===r[0])continue;const i=o.scan(e._flags[r],{source:"flags",name:r},t);void 0!==i&&(n=n||e.clone(),n._flags[r]=i)}for(let r=0;r<e._rules.length;++r){const i=e._rules[r],s=o.scan(i.args,{source:"rules",name:i.name},t);if(void 0!==s){n=n||e.clone();const t=Object.assign({},i);t.args=s,n._rules[r]=t,n._singleRules.get(i.name)===i&&n._singleRules.set(i.name,t)}}for(const r in e.$_terms){if("_"===r[0])continue;const i=o.scan(e.$_terms[r],{source:"terms",name:r},t);void 0!==i&&(n=n||e.clone(),n.$_terms[r]=i)}return n},o.scan=function(e,t,n,r,a){const l=r||[];if(null===e||"object"!=typeof e)return;let c;if(Array.isArray(e)){for(let r=0;r<e.length;++r){const i="terms"===t.source&&"keys"===t.name&&e[r].key,s=o.scan(e[r],t,n,[r,...l],i);void 0!==s&&(c=c||e.slice(),c[r]=s)}return c}if(!1!==n.schema&&i.isSchema(e)||!1!==n.ref&&s.isRef(e)){const r=n.each(e,{...t,path:l,key:a});if(r===e)return;return r}for(const r in e){if("_"===r[0])continue;const i=o.scan(e[r],t,n,[r,...l],a);void 0!==i&&(c=c||Object.assign({},e),c[r]=i)}return c}},6133:(e,t,n)=>{const r=n(375),i=n(8571),s=n(9621),o=n(8160);let a;const l={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};t.create=function(e,t={}){r("string"==typeof e,"Invalid reference key:",e),o.assertOptions(t,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),r(!t.prefix||"object"==typeof t.prefix,"options.prefix must be of type object");const n=Object.assign({},l.defaults,t);delete n.prefix;const i=n.separator,s=l.context(e,i,t.prefix);if(n.type=s.type,e=s.key,"value"===n.type)if(s.root&&(r(!i||e[0]!==i,"Cannot specify relative path with root prefix"),n.ancestor="root",e||(e=null)),i&&i===e)e=null,n.ancestor=0;else if(void 0!==n.ancestor)r(!i||!e||e[0]!==i,"Cannot combine prefix with ancestor option");else{const[t,r]=l.ancestor(e,i);r&&""===(e=e.slice(r))&&(e=null),n.ancestor=t}return n.path=i?null===e?[]:e.split(i):[e],new l.Ref(n)},t.in=function(e,n={}){return t.create(e,{...n,in:!0})},t.isRef=function(e){return!!e&&!!e[o.symbols.ref]},l.Ref=class{constructor(e){r("object"==typeof e,"Invalid reference construction"),o.assertOptions(e,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),r([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),r(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),r(!e.map||Array.isArray(e.map),"options.map must be an array"),r(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,l.defaults,e),r("value"===this.type||void 0===this.ancestor,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(e,t,n,i,s={}){return r(!this.in||s.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(n.context,t,s):"local"===this.type?this._resolve(i,t,s):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,s):(r(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,s)):this._resolve(e,t,s)}_resolve(e,t,n){let r;if("value"===this.type&&t.mainstay.shadow&&!1!==n.shadow&&(r=t.mainstay.shadow.get(this.absolute(t))),void 0===r&&(r=s(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(r=this.adjust(r)),this.map){const e=this.map.get(r);void 0!==e&&(r=e)}return t.mainstay&&t.mainstay.tracer.resolve(t,this,r),r}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new l.Ref(this)}describe(){const e={path:this.path};"value"!==this.type&&(e.type=this.type),"."!==this.separator&&(e.separator=this.separator),"value"===this.type&&1!==this.ancestor&&(e.ancestor=this.ancestor),this.map&&(e.map=[...this.map]);for(const t of["adjust","iterables","render"])null!==this[t]&&void 0!==this[t]&&(e[t]=this[t]);return!1!==this.in&&(e.in=!0),{ref:e}}updateDisplay(){const e=null!==this.key?this.key:"";if("value"!==this.type)return void(this.display=`ref:${this.type}:${e}`);if(!this.separator)return void(this.display=`ref:${e}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${e}`);if("root"===this.ancestor)return void(this.display=`ref:root:${e}`);if(1===this.ancestor)return void(this.display=`ref:${e||".."}`);const t=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${t}${e||""}`}},l.Ref.prototype[o.symbols.ref]=!0,t.build=function(e){return"value"===(e=Object.assign({},l.defaults,e)).type&&void 0===e.ancestor&&(e.ancestor=1),new l.Ref(e)},l.context=function(e,t,n={}){if(e=e.trim(),n){const r=void 0===n.global?"$":n.global;if(r!==t&&e.startsWith(r))return{key:e.slice(r.length),type:"global"};const i=void 0===n.local?"#":n.local;if(i!==t&&e.startsWith(i))return{key:e.slice(i.length),type:"local"};const s=void 0===n.root?"/":n.root;if(s!==t&&e.startsWith(s))return{key:e.slice(s.length),type:"value",root:!0}}return{key:e,type:"value"}},l.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let n=2;for(;e[n]===t;)++n;return[n-1,n]},t.toSibling=0,t.toParent=1,t.Manager=class{constructor(){this.refs=[]}register(e,r){if(e)if(r=void 0===r?t.toParent:r,Array.isArray(e))for(const t of e)this.register(t,r);else if(o.isSchema(e))for(const t of e._refs.refs)t.ancestor-r>=0&&this.refs.push({ancestor:t.ancestor-r,root:t.root});else t.isRef(e)&&"value"===e.type&&e.ancestor-r>=0&&this.refs.push({ancestor:e.ancestor-r,root:e.root}),a=a||n(3328),a.isTemplate(e)&&this.register(e.refs(),r)}get length(){return this.refs.length}clone(){const e=new t.Manager;return e.refs=i(this.refs),e}reset(){this.refs=[]}roots(){return this.refs.filter(e=>!e.ancestor).map(e=>e.root)}}},3378:(e,t,n)=>{const r=n(5107),i={};i.wrap=r.string().min(1).max(2).allow(!1),t.preferences=r.object({allowUnknown:r.boolean(),abortEarly:r.boolean(),artifacts:r.boolean(),cache:r.boolean(),context:r.object(),convert:r.boolean(),dateFormat:r.valid("date","iso","string","time","utc"),debug:r.boolean(),errors:{escapeHtml:r.boolean(),label:r.valid("path","key",!1),language:[r.string(),r.object().ref()],render:r.boolean(),stack:r.boolean(),wrap:{label:i.wrap,array:i.wrap,string:i.wrap}},externals:r.boolean(),messages:r.object(),noDefaults:r.boolean(),nonEnumerables:r.boolean(),presence:r.valid("required","optional","forbidden"),skipFunctions:r.boolean(),stripUnknown:r.object({arrays:r.boolean(),objects:r.boolean()}).or("arrays","objects").allow(!0,!1),warnings:r.boolean()}).strict(),i.nameRx=/^[a-zA-Z0-9]\w*$/,i.rule=r.object({alias:r.array().items(r.string().pattern(i.nameRx)).single(),args:r.array().items(r.string(),r.object({name:r.string().pattern(i.nameRx).required(),ref:r.boolean(),assert:r.alternatives([r.function(),r.object().schema()]).conditional("ref",{is:!0,then:r.required()}),normalize:r.function(),message:r.string().when("assert",{is:r.function(),then:r.required()})})),convert:r.boolean(),manifest:r.boolean(),method:r.function().allow(!1),multi:r.boolean(),validate:r.function()}),t.extension=r.object({type:r.alternatives([r.string(),r.object().regex()]).required(),args:r.function(),cast:r.object().pattern(i.nameRx,r.object({from:r.function().maxArity(1).required(),to:r.func