directus-extension-api-docs 1.7.2 → 1.7.4

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 (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +9 -9
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";const{findWorkspaceDir:s}=require("@pnpm/find-workspace-dir"),t=require("js-yaml"),e=require("path"),n=require("fs"),o=()=>process.cwd();let a;async function i(s,t){if(a)return JSON.parse(a);const{SpecificationService:e}=s,n=new e({accountability:{admin:!0},schema:t});return a=JSON.stringify(await n.oas.generate()),JSON.parse(a)}function r(s,t){return Object.entries(t).reduce(((s,[t,e])=>(s[t]=e&&"object"==typeof e?r(s[t]=s[t]||(Array.isArray(e)?[]:{}),e):e,s)),s)}const c=require("swagger-ui-express"),p=require("express-openapi-validator"),u=function(){const s=function(){const s={docsPath:"api-docs",info:{},tags:[],publishedTags:[],paths:{},components:{}};try{const a=e.join(o(),"./extensions/endpoints/oasconfig.yaml"),i=t.load(n.readFileSync(a,{encoding:"utf-8"}));return i.docsPath=i.docsPath||s.docsPath,i.info=i.info||s.info,i.tags=i.tags||s.tags,i.paths=i.paths||s.paths,i.components=i.components||s.components,i}catch{return s}}();try{const a=e.join(o(),"./extensions/endpoints"),i=n.readdirSync(a,{withFileTypes:!0});for(const e of i){const o=`${a}/${e.name}/oas.yaml`;if(e.isDirectory()&&n.existsSync(o)){const e=t.load(n.readFileSync(o,{encoding:"utf-8"}));s.tags=[...s.tags,...e.tags||[]],s.paths={...s.paths,...e.paths||{}},s.components=r(s.components||{},e.components||{})}}return s}catch(t){return s}}(),d=u.docsPath;var f={id:d,validate:async function(s,t,e,n){if(null==u?void 0:u.paths){const o=await i(t,e);if(n)for(const s of n)o.paths[s]=u.paths[s];else o.paths=u.paths;u.components?o.components=u.components:(delete o.components.definitions,delete o.components.schemas),s.use(p.middleware({apiSpec:o})),s.use(((s,t,e,n)=>{e.status(s.status||500).json({message:s.message,errors:s.errors})}))}return s},handler:(t,{services:e,logger:n,getSchema:a})=>{const p={swaggerOptions:{url:`/${d}/oas`}};t.use("/",c.serve),t.get("/",c.setup({},p)),t.get("/oas",(async(t,c,p)=>{var d;try{const t=await a(),p=await i(e,t),f=await async function(){try{const t=await s(".");return require(`${t||o()}/package.json`)}catch(s){return{}}}();p.info.title=u.info.title||(null==f?void 0:f.name)||p.info.title,p.info.version=u.info.version||(null==f?void 0:f.version)||p.info.version,p.info.description=u.info.description||(null==f?void 0:f.description)||p.info.description;try{for(const s in u.paths)p.paths[s]=u.paths[s];for(const s of u.tags)p.tags.push(s);p.components=r(u.components,p.components)}catch(s){n.info("No custom definitions")}(null==(d=u.publishedTags)?void 0:d.length)&&function(s,t){for(const e in t.paths)for(const n in t.paths[e]){let o=!1;t.paths[e][n].tags.forEach((t=>{o=o||s.publishedTags.includes(t)})),t.paths[e][n].tags&&(t.paths[e][n].tags=t.paths[e][n].tags.filter((t=>s.publishedTags.includes(t)))),o||delete t.paths[e][n]}t.tags=t.tags.filter((t=>s.publishedTags.includes(t.name)))}(u,p),c.json(p)}catch(s){return p(new Error(s.message||s[0].message))}}))}};module.exports=f;
1
+ "use strict";var e=require("url"),t=require("util"),r=(0).constructor;r.isFinite,r.isInteger,[].constructor.isArray;function s(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}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 r=this.cachedKeys[this.oldestIndex];void 0!==r&&delete this.map[r],this.cachedKeys[this.oldestIndex]=e,this.oldestIndex++,this.oldestIndex%=this.size},e}())(1e3);var n={exports:{}},i=function(...e){try{return JSON.stringify(...e)}catch(e){return"[Cannot display object: "+e.message+"]"}};!function(e,t){const r=i;n.exports=class extends Error{constructor(e){super(e.filter((e=>""!==e)).map((e=>"string"==typeof e?e:e instanceof Error?e.message:r(e))).join(" ")||"Unknown error"),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t.assert)}}}(0,n.exports);var a=n.exports;const o=a;var l=function(e,...t){if(!e){if(1===t.length&&t[0]instanceof Error)throw t[0];throw new o(t)}};const c=l,u={};var f=function(e,t,r){if(!1===t||null==t)return e;"string"==typeof(r=r||{})&&(r={separator:r});const s=Array.isArray(t);c(!s||!r.separator,"Separator option is not valid for array-based chain");const n=s?t:t.split(r.separator||".");let i=e;for(let e=0;e<n.length;++e){let s=n[e];const a=r.iterables&&u.iterables(i);if(Array.isArray(i)||"set"===a){const e=Number(s);Number.isInteger(e)&&(s=e<0?i.length+e:e)}if(!i||"function"==typeof i&&!1===r.functions||!a&&void 0===i[s]){c(!r.strict||e+1===n.length,"Missing segment",s,"in reach path ",t),c("object"==typeof i||!0===r.functions||"function"!=typeof i,"Invalid segment",s,"in reach path ",t),i=r.default;break}i=a?"set"===a?[...i][s]:i.get(s):i[s]}return i};u.iterables=function(e){return e instanceof Set?"set":e instanceof Map?"map":void 0};var m={exports:{}};!function(e,t){const r={};t=m.exports={array:Array.prototype,buffer:Buffer&&Buffer.prototype,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},r.typeMap=new Map([["[object Error]",t.error],["[object Map]",t.map],["[object Promise]",t.promise],["[object Set]",t.set],["[object WeakMap]",t.weakMap],["[object WeakSet]",t.weakSet]]),t.getInternalProto=function(e){if(Array.isArray(e))return t.array;if(Buffer&&e instanceof Buffer)return t.buffer;if(e instanceof Date)return t.date;if(e instanceof RegExp)return t.regex;if(e instanceof Error)return t.error;const s=Object.prototype.toString.call(e);return r.typeMap.get(s)||t.generic}}(0,m.exports);var h=m.exports,d={keys:function(e,t={}){return!1!==t.symbols?Reflect.ownKeys(e):Object.getOwnPropertyNames(e)}};const p=f,g=h,y=d,b={needsProtoHack:new Set([g.set,g.map,g.weakSet,g.weakMap])};var v=b.clone=function(e,t={},r=null){if("object"!=typeof e||null===e)return e;let s=b.clone,n=r;if(t.shallow){if(!0!==t.shallow)return b.cloneWithShallow(e,t);s=e=>e}else if(n){const t=n.get(e);if(t)return t}else n=new Map;const i=g.getInternalProto(e);if(i===g.buffer)return Buffer&&Buffer.from(e);if(i===g.date)return new Date(e.getTime());if(i===g.regex)return new RegExp(e);const a=b.base(e,i,t);if(a===e)return e;if(n&&n.set(e,a),i===g.set)for(const r of e)a.add(s(r,t,n));else if(i===g.map)for(const[r,i]of e)a.set(r,s(i,t,n));const o=y.keys(e,t);for(const r of o){if("__proto__"===r)continue;if(i===g.array&&"length"===r){a.length=e.length;continue}const o=Object.getOwnPropertyDescriptor(e,r);o?o.get||o.set?Object.defineProperty(a,r,o):o.enumerable?a[r]=s(e[r],t,n):Object.defineProperty(a,r,{enumerable:!1,writable:!0,configurable:!0,value:s(e[r],t,n)}):Object.defineProperty(a,r,{enumerable:!0,writable:!0,configurable:!0,value:s(e[r],t,n)})}return a};b.cloneWithShallow=function(e,t){const r=t.shallow;(t=Object.assign({},t)).shallow=!1;const s=new Map;for(const t of r){const r=p(e,t);"object"!=typeof r&&"function"!=typeof r||s.set(r,r)}return b.clone(e,t,s)},b.base=function(e,t,r){if(!1===r.prototype)return b.needsProtoHack.has(t)?new t.constructor:t===g.array?[]:{};const s=Object.getPrototypeOf(e);if(s&&s.isImmutable)return e;if(t===g.array){const e=[];return s!==t&&Object.setPrototypeOf(e,s),e}if(b.needsProtoHack.has(t)){const e=new s.constructor;return s!==t&&Object.setPrototypeOf(e,s),e}return Object.create(s)};var _,A={},E={},S={name:"joi",description:"Object schema validation",version:"17.9.2",repository:"git://github.com/hapijs/joi",main:"lib/index.js",types:"lib/index.d.ts",browser:"dist/joi-browser.min.js",files:["lib/**/*","dist/*"],keywords:["schema","validation"],dependencies:{"@hapi/hoek":"^9.0.0","@hapi/topo":"^5.0.0","@sideway/address":"^4.1.3","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},devDependencies:{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.0.1","@types/node":"^14.18.24",typescript:"4.3.x"},scripts:{prepublishOnly:"cd browser && npm install && npm run build",test:"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},license:"BSD-3-Clause"},R={};function O(){if(_)return R;_=1;const e=Gt(),t={};return t.wrap=e.string().min(1).max(2).allow(!1),R.preferences=e.object({allowUnknown:e.boolean(),abortEarly:e.boolean(),artifacts:e.boolean(),cache:e.boolean(),context:e.object(),convert:e.boolean(),dateFormat:e.valid("date","iso","string","time","utc"),debug:e.boolean(),errors:{escapeHtml:e.boolean(),label:e.valid("path","key",!1),language:[e.string(),e.object().ref()],render:e.boolean(),stack:e.boolean(),wrap:{label:t.wrap,array:t.wrap,string:t.wrap}},externals:e.boolean(),messages:e.object(),noDefaults:e.boolean(),nonEnumerables:e.boolean(),presence:e.valid("required","optional","forbidden"),skipFunctions:e.boolean(),stripUnknown:e.object({arrays:e.boolean(),objects:e.boolean()}).or("arrays","objects").allow(!0,!1),warnings:e.boolean()}).strict(),t.nameRx=/^[a-zA-Z0-9]\w*$/,t.rule=e.object({alias:e.array().items(e.string().pattern(t.nameRx)).single(),args:e.array().items(e.string(),e.object({name:e.string().pattern(t.nameRx).required(),ref:e.boolean(),assert:e.alternatives([e.function(),e.object().schema()]).conditional("ref",{is:!0,then:e.required()}),normalize:e.function(),message:e.string().when("assert",{is:e.function(),then:e.required()})})),convert:e.boolean(),manifest:e.boolean(),method:e.function().allow(!1),multi:e.boolean(),validate:e.function()}),R.extension=e.object({type:e.alternatives([e.string(),e.object().regex()]).required(),args:e.function(),cast:e.object().pattern(t.nameRx,e.object({from:e.function().maxArity(1).required(),to:e.function().minArity(1).maxArity(2).required()})),base:e.object().schema().when("type",{is:e.object().regex(),then:e.forbidden()}),coerce:[e.function().maxArity(3),e.object({method:e.function().maxArity(3).required(),from:e.array().items(e.string()).single()})],flags:e.object().pattern(t.nameRx,e.object({setter:e.string(),default:e.any()})),manifest:{build:e.function().arity(2)},messages:[e.object(),e.string()],modifiers:e.object().pattern(t.nameRx,e.function().minArity(1).maxArity(2)),overrides:e.object().pattern(t.nameRx,e.function()),prepare:e.function().maxArity(3),rebuild:e.function().arity(1),rules:e.object().pattern(t.nameRx,t.rule),terms:e.object().pattern(t.nameRx,e.object({init:e.array().allow(null).required(),manifest:e.object().pattern(/.+/,[e.valid("schema","single"),e.object({mapped:e.object({from:e.string().required(),to:e.string().required()}).required()})])})),validate:e.function().maxArity(3)}).strict(),R.extensions=e.array().items(e.object(),e.function().arity(1)).strict(),t.desc={buffer:e.object({buffer:e.string()}),func:e.object({function:e.function().required(),options:{literal:!0}}),override:e.object({override:!0}),ref:e.object({ref:e.object({type:e.valid("value","global","local"),path:e.array().required(),separator:e.string().length(1).allow(!1),ancestor:e.number().min(0).integer().allow("root"),map:e.array().items(e.array().length(2)).min(1),adjust:e.function(),iterables:e.boolean(),in:e.boolean(),render:e.boolean()}).required()}),regex:e.object({regex:e.string().min(3)}),special:e.object({special:e.valid("deep").required()}),template:e.object({template:e.string().required(),options:e.object()}),value:e.object({value:e.alternatives([e.object(),e.array()]).required()})},t.desc.entity=e.alternatives([e.array().items(e.link("...")),e.boolean(),e.function(),e.number(),e.string(),t.desc.buffer,t.desc.func,t.desc.ref,t.desc.regex,t.desc.special,t.desc.template,t.desc.value,e.link("/")]),t.desc.values=e.array().items(null,e.boolean(),e.function(),e.number().allow(1/0,-1/0),e.string().allow(""),e.symbol(),t.desc.buffer,t.desc.func,t.desc.override,t.desc.ref,t.desc.regex,t.desc.template,t.desc.value),t.desc.messages=e.object().pattern(/.+/,[e.string(),t.desc.template,e.object().pattern(/.+/,[e.string(),t.desc.template])]),R.description=e.object({type:e.string().required(),flags:e.object({cast:e.string(),default:e.any(),description:e.string(),empty:e.link("/"),failover:t.desc.entity,id:e.string(),label:e.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:e.boolean(),unit:e.string()}).unknown(),preferences:{allowUnknown:e.boolean(),abortEarly:e.boolean(),artifacts:e.boolean(),cache:e.boolean(),convert:e.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:e.boolean(),label:["path","key"],language:[e.string(),t.desc.ref],wrap:{label:t.wrap,array:t.wrap}},externals:e.boolean(),messages:t.desc.messages,noDefaults:e.boolean(),nonEnumerables:e.boolean(),presence:["required","optional","forbidden"],skipFunctions:e.boolean(),stripUnknown:e.object({arrays:e.boolean(),objects:e.boolean()}).or("arrays","objects").allow(!0,!1),warnings:e.boolean()},allow:t.desc.values,invalid:t.desc.values,rules:e.array().min(1).items({name:e.string().required(),args:e.object().min(1),keep:e.boolean(),message:[e.string(),t.desc.messages],warn:e.boolean()}),keys:e.object().pattern(/.*/,e.link("/")),link:t.desc.ref}).pattern(/^[a-z]\w*$/,e.any()),R}var N={},I={exports:{}};const w={};var $=function(e){if(!e)return"";let t="";for(let r=0;r<e.length;++r){const s=e.charCodeAt(r);w.isSafe(s)?t+=e[r]:t+=w.escapeHtmlChar(s)}return t};w.escapeHtmlChar=function(e){const t=w.namedHtml.get(e);if(t)return t;if(e>=256)return"&#"+e+";";return`&#x${e.toString(16).padStart(2,"0")};`},w.isSafe=function(e){return w.safeCharCodes.has(e)},w.namedHtml=new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[34,"&quot;"],[160,"&nbsp;"],[162,"&cent;"],[163,"&pound;"],[164,"&curren;"],[169,"&copy;"],[174,"&reg;"]]),w.safeCharCodes=function(){const e=new Set;for(let t=32;t<123;++t)(t>=97||t>=65&&t<=90||t>=48&&t<=57||32===t||46===t||44===t||45===t||58===t||95===t)&&e.add(t);return e}();var T={};!function(e){const t={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};e.Parser=class{constructor(e,r={}){if(!r[t.settings]&&r.constants)for(const e in r.constants){const t=r.constants[e];if(null!==t&&!["boolean","number","string"].includes(typeof t))throw new Error(`Formula constant ${e} contains invalid ${typeof t} value type`)}this.settings=r[t.settings]?r:Object.assign({[t.settings]:!0,constants:{},functions:{}},r),this.single=null,this._parts=null,this._parse(e)}_parse(r){let s=[],n="",i=0,a=!1;const o=r=>{if(i)throw new Error("Formula missing closing parenthesis");const o=s.length?s[s.length-1]:null;if(a||n||r){if(o&&"reference"===o.type&&")"===r)return o.type="function",o.value=this._subFormula(n,o.value),void(n="");if(")"===r){const t=new e.Parser(n,this.settings);s.push({type:"segment",value:t})}else if(a){if("]"===a)return s.push({type:"reference",value:n}),void(n="");s.push({type:"literal",value:n})}else if(t.operatorCharacters.includes(n))o&&"operator"===o.type&&t.operators.includes(o.value+n)?o.value+=n:s.push({type:"operator",value:n});else if(n.match(t.numberRx))s.push({type:"constant",value:parseFloat(n)});else if(void 0!==this.settings.constants[n])s.push({type:"constant",value:this.settings.constants[n]});else{if(!n.match(t.tokenRx))throw new Error(`Formula contains invalid token: ${n}`);s.push({type:"reference",value:n})}n=""}};for(const e of r)a?e===a?(o(),a=!1):n+=e:i?"("===e?(n+=e,++i):")"===e?(--i,i?n+=e:o(e)):n+=e:e in t.literals?a=t.literals[e]:"("===e?(o(),++i):t.operatorCharacters.includes(e)?(o(),n=e,o()):" "!==e?n+=e:o();o(),s=s.map(((e,t)=>"operator"!==e.type||"-"!==e.value||t&&"operator"!==s[t-1].type?e:{type:"operator",value:"n"}));let l=!1;for(const e of s){if("operator"===e.type){if(t.operatorsPrefix.includes(e.value))continue;if(!l)throw new Error("Formula contains an operator in invalid position");if(!t.operators.includes(e.value))throw new Error(`Formula contains an unknown operator ${e.value}`)}else if(l)throw new Error("Formula missing expected operator");l=!l}if(!l)throw new Error("Formula contains invalid trailing operator");1===s.length&&["reference","literal","constant"].includes(s[0].type)&&(this.single={type:"reference"===s[0].type?"reference":"value",value:s[0].value}),this._parts=s.map((e=>{if("operator"===e.type)return t.operatorsPrefix.includes(e.value)?e:e.value;if("reference"!==e.type)return e.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(e.value))throw new Error(`Formula contains invalid reference ${e.value}`);return this.settings.reference?this.settings.reference(e.value):t.reference(e.value)}))}_subFormula(r,s){const n=this.settings.functions[s];if("function"!=typeof n)throw new Error(`Formula contains unknown function ${s}`);let i=[];if(r){let e="",n=0,a=!1;const o=()=>{if(!e)throw new Error(`Formula contains function ${s} with invalid arguments ${r}`);i.push(e),e=""};for(let s=0;s<r.length;++s){const i=r[s];a?(e+=i,i===a&&(a=!1)):i in t.literals&&!n?(e+=i,a=t.literals[i]):","!==i||n?(e+=i,"("===i?++n:")"===i&&--n):o()}o()}return i=i.map((t=>new e.Parser(t,this.settings))),function(e){const t=[];for(const r of i)t.push(r.evaluate(e));return n.call(e,...t)}}evaluate(e){const r=this._parts.slice();for(let s=r.length-2;s>=0;--s){const n=r[s];if(n&&"operator"===n.type){const i=r[s+1];r.splice(s+1,1);const a=t.evaluate(i,e);r[s]=t.single(n.value,a)}}return t.operatorsOrder.forEach((s=>{for(let n=1;n<r.length-1;)if(s.includes(r[n])){const s=r[n],i=t.evaluate(r[n-1],e),a=t.evaluate(r[n+1],e);r.splice(n,2);const o=t.calculate(s,i,a);r[n-1]=0===o?0:o}else n+=2})),t.evaluate(r[0],e)}},e.Parser.prototype[t.symbol]=!0,t.reference=function(e){return function(t){return t&&void 0!==t[e]?t[e]:null}},t.evaluate=function(e,r){return null===e?null:"function"==typeof e?e(r):e[t.symbol]?e.evaluate(r):e},t.single=function(e,t){if("!"===e)return!t;const r=-t;return 0===r?0:r},t.calculate=function(e,r,s){if("??"===e)return t.exists(r)?r:s;if("string"==typeof r||"string"==typeof s){if("+"===e)return(r=t.exists(r)?r:"")+(s=t.exists(s)?s:"")}else switch(e){case"^":return Math.pow(r,s);case"*":return r*s;case"/":return r/s;case"%":return r%s;case"+":return r+s;case"-":return r-s}switch(e){case"<":return r<s;case"<=":return r<=s;case">":return r>s;case">=":return r>=s;case"==":return r===s;case"!=":return r!==s;case"&&":return r&&s;case"||":return r||s}return null},t.exists=function(e){return null!=e}}(T);var C,L,x={},D={};function M(){if(C)return D;C=1;const e=v,t=V(),r={annotations:Symbol("annotations")};return D.error=function(s){if(!this._original||"object"!=typeof this._original)return this.details[0].message;const n=s?"":"",i=s?"":"",a=s?"":"",o=e(this._original);for(let e=this.details.length-1;e>=0;--e){const s=e+1,n=this.details[e],i=n.path;let a=o;for(let e=0;;++e){const o=i[e];if(t.isSchema(a)&&(a=a.clone()),!(e+1<i.length&&"string"!=typeof a[o])){const e=a[r.annotations]||{errors:{},missing:{}};a[r.annotations]=e;const t=o||n.context.key;void 0!==a[o]?(e.errors[t]=e.errors[t]||[],e.errors[t].push(s)):e.missing[t]=s;break}a=a[o]}}const l=/_\$key\$_([, \d]+)_\$end\$_"/g,c=/"_\$miss\$_([^|]+)\|(\d+)_\$end\$_": "__missing__"/g,u=/\s*"_\$idx\$_([, \d]+)_\$end\$_",?\n(.*)/g,f=/"\[(NaN|Symbol.*|-?Infinity|function.*|\(.*)]"/g;let m=r.safeStringify(o,2).replace(l,((e,t)=>`" ${n}[${t}]${a}`)).replace(c,((e,t,r)=>`${i}"${t}"${a}${n} [${r}]: -- missing --${a}`)).replace(u,((e,t,r)=>`\n${r} ${n}[${t}]${a}`)).replace(f,((e,t)=>t));m=`${m}\n${n}`;for(let e=0;e<this.details.length;++e){m=`${m}\n[${e+1}] ${this.details[e].message}`}return m+=a,m},r.safeStringify=function(e,t){return JSON.stringify(e,r.serializer(),t)},r.serializer=function(){const e=[],t=[],s=(r,s)=>t[0]===s?"[Circular ~]":"[Circular ~."+e.slice(0,t.indexOf(s)).join(".")+"]";return function(n,i){if(t.length>0){const r=t.indexOf(this);~r?(t.length=r+1,e.length=r+1,e[r]=n):(t.push(this),e.push(n)),~t.indexOf(i)&&(i=s.call(this,n,i))}else t.push(i);if(i){const e=i[r.annotations];if(e){if(Array.isArray(i)){const t=[];for(let r=0;r<i.length;++r)e.errors[r]&&t.push(`_$idx$_${e.errors[r].sort().join(", ")}_$end$_`),t.push(i[r]);i=t}else{for(const t in e.errors)i[`${t}_$key$_${e.errors[t].sort().join(", ")}_$end$_`]=i[t],i[t]=void 0;for(const t in e.missing)i[`_$miss$_${t}|${e.missing[t]}_$end$_`]="__missing__"}return i}}return i===1/0||i===-1/0||Number.isNaN(i)||"function"==typeof i||"symbol"==typeof i?"["+i.toString()+"]":i}},D}function j(){return L||(L=1,function(e){const t=M(),r=V(),s=X();e.Report=class{constructor(t,r,s,n,i,a,o){if(this.code=t,this.flags=n,this.messages=i,this.path=a.path,this.prefs=o,this.state=a,this.value=r,this.message=null,this.template=null,this.local=s||{},this.local.label=e.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(t,r){return e.template(this.value,t,r||this.code,this.state,this.prefs)}},e.path=function(e){let t="";for(const r of e)"object"!=typeof r&&("string"==typeof r?(t&&(t+="."),t+=r):t+=`[${r}]`);return t},e.template=function(e,t,n,i,a){if(!t)return;if(s.isTemplate(t))return"root"!==n?t:null;let o=a.errors.language;if(r.isResolvable(o)&&(o=o.resolve(e,i,a)),o&&t[o]){if(void 0!==t[o][n])return t[o][n];if(void 0!==t[o]["*"])return t[o]["*"]}return t[n]?t[n]:t["*"]},e.label=function(t,r,s,n){if(t.label)return t.label;if(!s.errors.label)return"";let i=r.path;"key"===s.errors.label&&r.path.length>1&&(i=r.path.slice(-1));const a=e.path(i);return a||(e.template(null,s.messages,"root",r,s)||n&&e.template(null,n,"root",r,s)||"value")},e.process=function(t,r,s){if(!t)return null;const{override:n,message:i,details:a}=e.details(t);if(n)return n;if(s.errors.stack)return new e.ValidationError(i,a,r);const o=Error.stackTraceLimit;Error.stackTraceLimit=0;const l=new e.ValidationError(i,a,r);return Error.stackTraceLimit=o,l},e.details=function(e,t={}){let r=[];const s=[];for(const n of e){if(n instanceof Error){if(!1!==t.override)return{override:n};const e=n.toString();r.push(e),s.push({message:e,type:"override",context:{error:n}});continue}const e=n.toString();r.push(e),s.push({message:e,path:n.path.filter((e=>"object"!=typeof e)),type:n.code,context:n.local})}return r.length>1&&(r=[...new Set(r)]),{message:r.join(". "),details:s}},e.ValidationError=class extends Error{constructor(e,t,r){super(e),this._original=r,this.details=t}static isError(t){return t instanceof e.ValidationError}},e.ValidationError.prototype.isJoi=!0,e.ValidationError.prototype.name="ValidationError",e.ValidationError.prototype.annotate=t.error}(x)),x}var B,k,P,U,G,F={};function H(){return B||(B=1,function(e){const t=l,r=v,s=f,n=V();let i;const a={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};e.create=function(e,r={}){t("string"==typeof e,"Invalid reference key:",e),n.assertOptions(r,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),t(!r.prefix||"object"==typeof r.prefix,"options.prefix must be of type object");const s=Object.assign({},a.defaults,r);delete s.prefix;const i=s.separator,o=a.context(e,i,r.prefix);if(s.type=o.type,e=o.key,"value"===s.type)if(o.root&&(t(!i||e[0]!==i,"Cannot specify relative path with root prefix"),s.ancestor="root",e||(e=null)),i&&i===e)e=null,s.ancestor=0;else if(void 0!==s.ancestor)t(!i||!e||e[0]!==i,"Cannot combine prefix with ancestor option");else{const[t,r]=a.ancestor(e,i);r&&""===(e=e.slice(r))&&(e=null),s.ancestor=t}return s.path=i?null===e?[]:e.split(i):[e],new a.Ref(s)},e.in=function(t,r={}){return e.create(t,{...r,in:!0})},e.isRef=function(e){return!!e&&!!e[n.symbols.ref]},a.Ref=class{constructor(e){t("object"==typeof e,"Invalid reference construction"),n.assertOptions(e,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),t([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),t(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),t(!e.map||Array.isArray(e.map),"options.map must be an array"),t(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,a.defaults,e),t("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,r,s,n,i={}){return t(!this.in||i.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(s.context,r,i):"local"===this.type?this._resolve(n,r,i):this.ancestor?"root"===this.ancestor?this._resolve(r.ancestors[r.ancestors.length-1],r,i):(t(this.ancestor<=r.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(r.ancestors[this.ancestor-1],r,i)):this._resolve(e,r,i)}_resolve(e,t,r){let n;if("value"===this.type&&t.mainstay.shadow&&!1!==r.shadow&&(n=t.mainstay.shadow.get(this.absolute(t))),void 0===n&&(n=s(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(n=this.adjust(n)),this.map){const e=this.map.get(n);void 0!==e&&(n=e)}return t.mainstay&&t.mainstay.tracer.resolve(t,this,n),n}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new a.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||""}`}},a.Ref.prototype[n.symbols.ref]=!0,e.build=function(e){return"value"===(e=Object.assign({},a.defaults,e)).type&&void 0===e.ancestor&&(e.ancestor=1),new a.Ref(e)},a.context=function(e,t,r={}){if(e=e.trim(),r){const s=void 0===r.global?"$":r.global;if(s!==t&&e.startsWith(s))return{key:e.slice(s.length),type:"global"};const n=void 0===r.local?"#":r.local;if(n!==t&&e.startsWith(n))return{key:e.slice(n.length),type:"local"};const i=void 0===r.root?"/":r.root;if(i!==t&&e.startsWith(i))return{key:e.slice(i.length),type:"value",root:!0}}return{key:e,type:"value"}},a.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let r=2;for(;e[r]===t;)++r;return[r-1,r]},e.toSibling=0,e.toParent=1,e.Manager=class{constructor(){this.refs=[]}register(t,r){if(t)if(r=void 0===r?e.toParent:r,Array.isArray(t))for(const e of t)this.register(e,r);else if(n.isSchema(t))for(const e of t._refs.refs)e.ancestor-r>=0&&this.refs.push({ancestor:e.ancestor-r,root:e.root});else e.isRef(t)&&"value"===t.type&&t.ancestor-r>=0&&this.refs.push({ancestor:t.ancestor-r,root:t.root}),i=i||X(),i.isTemplate(t)&&this.register(t.refs(),r)}get length(){return this.refs.length}clone(){const t=new e.Manager;return t.refs=r(this.refs),t}reset(){this.refs=[]}roots(){return this.refs.filter((e=>!e.ancestor)).map((e=>e.root))}}}(F)),F}function X(){return k||(k=1,function(e,t){const r=l,s=v,n=$,i=T,a=V(),o=j(),c=H(),u={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};e.exports=u.Template=class{constructor(e,t){r("string"==typeof e,"Template source must be a string"),r(!e.includes("\0")&&!e.includes(""),"Template source cannot contain reserved control characters"),this.source=e,this.rendered=e,this._template=null,this._settings=s(t),this._parse()}_parse(){if(!this.source.includes("{"))return;const e=u.encode(this.source),t=u.split(e);let r=!1;const s=[],n=t.shift();n&&s.push(n);for(const e of t){const t="{"!==e[0],n=t?"}":"}}",i=e.indexOf(n);if(-1===i||"{"===e[1]){s.push(`{${u.decode(e)}`);continue}let a=e.slice(t?0:1,i);const o=":"===a[0];o&&(a=a.slice(1));const l=this._ref(u.decode(a),{raw:t,wrapped:o});s.push(l),"string"!=typeof l&&(r=!0);const c=e.slice(i+n.length);c&&s.push(u.decode(c))}r?this._template=s:this.rendered=s.join("")}static date(e,t){return u.dateFormat[t.dateFormat].call(e)}describe(e={}){if(!this._settings&&e.compact)return this.source;const t={template:this.source};return this._settings&&(t.options=this._settings),t}static build(e){return new u.Template(e.template,e.options)}isDynamic(){return!!this._template}static isTemplate(e){return!!e&&!!e[a.symbols.template]}refs(){if(!this._template)return;const e=[];for(const t of this._template)"string"!=typeof t&&e.push(...t.refs);return e}resolve(e,t,r,s){return this._template&&1===this._template.length?this._part(this._template[0],e,t,r,s,{}):this.render(e,t,r,s)}_part(e,...t){return e.ref?e.ref.resolve(...t):e.formula.evaluate(t)}render(e,t,r,s,i={}){if(!this.isDynamic())return this.rendered;const a=[];for(const o of this._template)if("string"==typeof o)a.push(o);else{const l=this._part(o,e,t,r,s,i),c=u.stringify(l,e,t,r,s,i);if(void 0!==c){const e=o.raw||!1===(i.errors&&i.errors.escapeHtml)?c:n(c);a.push(u.wrap(e,o.wrapped&&r.errors.wrap.label))}}return a.join("")}_ref(e,{raw:t,wrapped:r}){const s=[],n=e=>{const t=c.create(e,this._settings);return s.push(t),e=>t.resolve(...e)};try{var a=new i.Parser(e,{reference:n,functions:u.functions,constants:u.constants})}catch(t){throw t.message=`Invalid template variable "${e}" fails due to: ${t.message}`,t}if(a.single){if("reference"===a.single.type){const e=s[0];return{ref:e,raw:t,refs:s,wrapped:r||"local"===e.type&&"label"===e.key}}return u.stringify(a.single.value)}return{formula:a,raw:t,refs:s}}toString(){return this.source}},u.Template.prototype[a.symbols.template]=!0,u.Template.prototype.isImmutable=!0,u.encode=function(e){return e.replace(/\\(\{+)/g,((e,t)=>u.opens.slice(0,t.length))).replace(/\\(\}+)/g,((e,t)=>u.closes.slice(0,t.length)))},u.decode=function(e){return e.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},u.split=function(e){const t=[];let r="";for(let s=0;s<e.length;++s){const n=e[s];if("{"===n){let n="";for(;s+1<e.length&&"{"===e[s+1];)n+="{",++s;t.push(r),r=n}else r+=n}return t.push(r),t},u.wrap=function(e,t){return t?1===t.length?`${t}${e}${t}`:`${t[0]}${e}${t[1]}`:e},u.stringify=function(e,t,r,s,n,i={}){const a=typeof e,o=s&&s.errors&&s.errors.wrap||{};let l=!1;if(c.isRef(e)&&e.render&&(l=e.in,e=e.resolve(t,r,s,n,{in:e.in,...i})),null===e)return"null";if("string"===a)return u.wrap(e,i.arrayItems&&o.string);if("number"===a||"function"===a||"symbol"===a)return e.toString();if("object"!==a)return JSON.stringify(e);if(e instanceof Date)return u.Template.date(e,s);if(e instanceof Map){const t=[];for(const[r,s]of e.entries())t.push(`${r.toString()} -> ${s.toString()}`);e=t}if(!Array.isArray(e))return e.toString();const f=[];for(const a of e)f.push(u.stringify(a,t,r,s,n,{arrayItems:!0,...i}));return u.wrap(f.join(", "),!l&&o.array)},u.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},u.functions={if:(e,t,r)=>e?t:r,length:e=>"string"==typeof e?e.length:e&&"object"==typeof e?Array.isArray(e)?e.length:Object.keys(e).length:null,msg(e){const[t,r,s,n,i]=this,a=i.messages;if(!a)return"";const l=o.template(t,a[0],e,r,s)||o.template(t,a[1],e,r,s);return l?l.render(t,r,s,n,i):""},number:e=>"number"==typeof e?e:"string"==typeof e?parseFloat(e):"boolean"==typeof e?e?1:0:e instanceof Date?e.getTime():null}}(I)),I.exports}function K(){return P||(P=1,function(e){const t=l,r=v,s=X();e.compile=function(e,n){if("string"==typeof e)return t(!n,"Cannot set single message string"),new s(e);if(s.isTemplate(e))return t(!n,"Cannot set single message template"),e;t("object"==typeof e&&!Array.isArray(e),"Invalid message options"),n=n?r(n):{};for(let r in e){const i=e[r];if("root"===r||s.isTemplate(i)){n[r]=i;continue}if("string"==typeof i){n[r]=new s(i);continue}t("object"==typeof i&&!Array.isArray(i),"Invalid message for",r);const a=r;for(r in n[a]=n[a]||{},i){const e=i[r];"root"===r||s.isTemplate(e)?n[a][r]=e:(t("string"==typeof e,"Invalid message for",r,"in",a),n[a][r]=new s(e))}}return n},e.decompile=function(e){const t={};for(let r in e){const n=e[r];if("root"===r){t.root=n;continue}if(s.isTemplate(n)){t[r]=n.describe({compact:!0});continue}const i=r;for(r in t[i]={},n){const e=n[r];"root"!==r?t[i][r]=e.describe({compact:!0}):t[i].root=e}}return t},e.merge=function(n,i){if(!n)return e.compile(i);if(!i)return n;if("string"==typeof i)return new s(i);if(s.isTemplate(i))return i;const a=r(n);for(let e in i){const r=i[e];if("root"===e||s.isTemplate(r)){a[e]=r;continue}if("string"==typeof r){a[e]=new s(r);continue}t("object"==typeof r&&!Array.isArray(r),"Invalid message for",e);const n=e;for(e in a[n]=a[n]||{},r){const i=r[e];"root"===e||s.isTemplate(i)?a[n][e]=i:(t("string"==typeof i,"Invalid message for",e,"in",n),a[n][e]=new s(i))}}return a}}(N)),N}function V(){return U||(U=1,function(e){const t=l,r=a,s=S;let n,i;const o={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)?)?)?)?$/};e.version=s.version,e.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},e.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")},e.assertOptions=function(e,r,s="Options"){t(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const n=Object.keys(e).filter((e=>!r.includes(e)));t(0===n.length,`${s} contain unknown keys: ${n}`)},e.checkPreferences=function(e){i=i||O();const t=i.preferences.validate(e);if(t.error)throw new r([t.error.details[0].message])},e.compare=function(e,t,r){switch(r){case"=":return e===t;case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}},e.default=function(e,t){return void 0===e?t:e},e.isIsoDate=function(e){return o.isoDate.test(e)},e.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},e.isResolvable=function(t){return!!t&&(t[e.symbols.ref]||t[e.symbols.template])},e.isSchema=function(r,s={}){const n=r&&r[e.symbols.any];return!!n&&(t(s.legacy||n.version===e.version,"Cannot mix different versions of joi schemas"),!0)},e.isValues=function(t){return t[e.symbols.values]},e.limit=function(e){return Number.isSafeInteger(e)&&e>=0},e.preferences=function(t,r){n=n||K(),t=t||{},r=r||{};const s=Object.assign({},t,r);return r.errors&&t.errors&&(s.errors=Object.assign({},t.errors,r.errors),s.errors.wrap=Object.assign({},t.errors.wrap,r.errors.wrap)),r.messages&&(s.messages=n.compile(r.messages,t.messages)),delete s[e.symbols.prefs],s},e.tryWithPath=function(e,t,r={}){try{return e()}catch(e){throw void 0!==e.path?e.path=t+"."+e.path:e.path=t,r.append&&(e.message=`${e.message} (${e.path})`),e}},e.validateArg=function(t,r,{assert:s,message:n}){if(e.isSchema(s)){const e=s.validate(t);if(!e.error)return;return e.error.message}if(!s(t))return r?`${r} ${n}`:n},e.verifyFlat=function(e,r){for(const s of e)t(!Array.isArray(s),"Method no longer accepts array arguments:",r)}}(E)),E}function Y(){if(G)return A;G=1;const e=l,t=v,r=V(),s={max:1e3,supported:new Set(["undefined","boolean","number","string"])};return A.provider={provision:e=>new s.Cache(e)},s.Cache=class{constructor(t={}){r.assertOptions(t,["max"]),e(void 0===t.max||t.max&&t.max>0&&isFinite(t.max),"Invalid max cache size"),this._max=t.max||s.max,this._map=new Map,this._list=new s.List}get length(){return this._map.size}set(e,t){if(null!==e&&!s.supported.has(typeof e))return;let r=this._map.get(e);if(r)return r.value=t,void this._list.first(r);r=this._list.unshift({key:e,value:t}),this._map.set(e,r),this._compact()}get(e){const r=this._map.get(e);if(r)return this._list.first(r),t(r.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},s.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:r}=e;return t.prev=r,r&&(r.next=t),e===this.tail&&(this.tail=t),e.prev=null,e.next=null,e}},A}var W,q={};function z(){return W||(W=1,function(e){const t=l,r=V(),s=H(),n={};e.schema=function(e,t,s={}){r.assertOptions(s,["appendPath","override"]);try{return n.schema(e,t,s)}catch(e){throw s.appendPath&&void 0!==e.path&&(e.message=`${e.message} (${e.path})`),e}},n.schema=function(e,s,i){t(void 0!==s,"Invalid undefined schema"),Array.isArray(s)&&(t(s.length,"Invalid empty array schema"),1===s.length&&(s=s[0]));const a=(t,...r)=>!1!==i.override?t.valid(e.override,...r):t.valid(...r);if(n.simple(s))return a(e,s);if("function"==typeof s)return e.custom(s);if(t("object"==typeof s,"Invalid schema content:",typeof s),r.isResolvable(s))return a(e,s);if(r.isSchema(s))return s;if(Array.isArray(s)){for(const t of s)if(!n.simple(t))return e.alternatives().try(...s);return a(e,...s)}return s instanceof RegExp?e.string().regex(s):s instanceof Date?a(e.date(),s):(t(Object.getPrototypeOf(s)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(s))},e.ref=function(e,t){return s.isRef(e)?e:s.create(e,t)},e.compile=function(s,i,a={}){r.assertOptions(a,["legacy"]);const o=i&&i[r.symbols.any];if(o)return t(a.legacy||o.version===r.version,"Cannot mix different versions of joi schemas:",o.version,r.version),i;if("object"!=typeof i||!a.legacy)return e.schema(s,i,{appendPath:!0});const l=n.walk(i);return l?l.compile(l.root,i):e.schema(s,i,{appendPath:!0})},n.walk=function(e){if("object"!=typeof e)return null;if(Array.isArray(e)){for(const t of e){const e=n.walk(t);if(e)return e}return null}const s=e[r.symbols.any];if(s)return{root:e[s.root],compile:s.compile};t(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const t in e){const r=n.walk(e[t]);if(r)return r}return null},n.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},e.when=function(i,a,o){if(void 0===o&&(t(a&&"object"==typeof a,"Missing options"),o=a,a=s.create(".")),Array.isArray(o)&&(o={switch:o}),r.assertOptions(o,["is","not","then","otherwise","switch","break"]),r.isSchema(a))return t(void 0===o.is,'"is" can not be used with a schema condition'),t(void 0===o.not,'"not" can not be used with a schema condition'),t(void 0===o.switch,'"switch" can not be used with a schema condition'),n.condition(i,{is:a,then:o.then,otherwise:o.otherwise,break:o.break});if(t(s.isRef(a)||"string"==typeof a,"Invalid condition:",a),t(void 0===o.not||void 0===o.is,'Cannot combine "is" with "not"'),void 0===o.switch){let l=o;void 0!==o.not&&(l={is:o.not,then:o.otherwise,otherwise:o.then,break:o.break});let c=void 0!==l.is?i.$_compile(l.is):i.$_root.invalid(null,!1,0,"").required();return t(void 0!==l.then||void 0!==l.otherwise,'options must have at least one of "then", "otherwise", or "switch"'),t(void 0===l.break||void 0===l.then||void 0===l.otherwise,"Cannot specify then, otherwise, and break all together"),void 0===o.is||s.isRef(o.is)||r.isSchema(o.is)||(c=c.required()),n.condition(i,{ref:e.ref(a),is:c,then:l.then,otherwise:l.otherwise,break:l.break})}t(Array.isArray(o.switch),'"switch" must be an array'),t(void 0===o.is,'Cannot combine "switch" with "is"'),t(void 0===o.not,'Cannot combine "switch" with "not"'),t(void 0===o.then,'Cannot combine "switch" with "then"');const l={ref:e.ref(a),switch:[],break:o.break};for(let e=0;e<o.switch.length;++e){const n=o.switch[e],a=e===o.switch.length-1;r.assertOptions(n,a?["is","then","otherwise"]:["is","then"]),t(void 0!==n.is,'Switch statement missing "is"'),t(void 0!==n.then,'Switch statement missing "then"');const c={is:i.$_compile(n.is),then:i.$_compile(n.then)};if(s.isRef(n.is)||r.isSchema(n.is)||(c.is=c.is.required()),a){t(void 0===o.otherwise||void 0===n.otherwise,'Cannot specify "otherwise" inside and outside a "switch"');const e=void 0!==o.otherwise?o.otherwise:n.otherwise;void 0!==e&&(t(void 0===l.break,"Cannot specify both otherwise and break"),c.otherwise=i.$_compile(e))}l.switch.push(c)}return l},n.condition=function(e,t){for(const r of["then","otherwise"])void 0===t[r]?delete t[r]:t[r]=e.$_compile(t[r]);return t}}(q)),q}var Z,J={};function Q(){if(Z)return J;Z=1;const e=l,t=v,r=V(),s=K(),n={};return J.type=function(i,a){const o=Object.getPrototypeOf(i),l=t(o),c=i._assign(Object.create(l)),u=Object.assign({},a);delete u.base,l._definition=u;const f=o._definition||{};u.messages=s.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 m=Object.assign({},f.terms);if(u.terms)for(const t in u.terms){const r=u.terms[t];e(void 0===c.$_terms[t],"Invalid term override for",u.type,t),c.$_terms[t]=r.init,m[t]=r}u.terms=m,u.args||(u.args=f.args),u.prepare=n.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=n.coerce(u.coerce,f.coerce),u.validate=n.validate(u.validate,f.validate);const h=Object.assign({},f.rules);if(u.rules)for(const t in u.rules){const s=u.rules[t];e("object"==typeof s,"Invalid rule definition for",u.type,t);let n=s.method;if(void 0===n&&(n=function(){return this.$_addRule(t)}),n&&(e(!l[t],"Rule conflict in",u.type,t),l[t]=n),e(!h[t],"Rule conflict in",u.type,t),h[t]=s,s.alias){const e=[].concat(s.alias);for(const t of e)l[t]=s.method}s.args&&(s.argsByName=new Map,s.args=s.args.map((t=>("string"==typeof t&&(t={name:t}),e(!s.argsByName.has(t.name),"Duplicated argument name",t.name),r.isSchema(t.assert)&&(t.assert=t.assert.strict().label(t.name)),s.argsByName.set(t.name,t),t))))}u.rules=h;const d=Object.assign({},f.modifiers);if(u.modifiers)for(const t in u.modifiers){e(!l[t],"Rule conflict in",u.type,t);const r=u.modifiers[t];e("function"==typeof r,"Invalid modifier definition for",u.type,t);const s=function(e){return this.rule({[t]:e})};l[t]=s,d[t]=r}if(u.modifiers=d,u.overrides){l._super=o,c.$_super={};for(const t in u.overrides)e(o[t],"Cannot override missing",t),u.overrides[t][r.symbols.parent]=o[t],c.$_super[t]=o[t].bind(c);Object.assign(l,u.overrides)}u.cast=Object.assign({},f.cast,u.cast);const p=Object.assign({},f.manifest,u.manifest);return p.build=n.build(u.manifest&&u.manifest.build,f.manifest&&f.manifest.build),u.manifest=p,u.rebuild=n.rebuild(u.rebuild,f.rebuild),c},n.build=function(e,t){return e&&t?function(r,s){return t(e(r,s),s)}:e||t},n.coerce=function(e,t){return e&&t?{from:e.from&&t.from?[...new Set([...e.from,...t.from])]:null,method(r,s){let n;if((!t.from||t.from.includes(typeof r))&&(n=t.method(r,s),n)){if(n.errors||void 0===n.value)return n;r=n.value}if(!e.from||e.from.includes(typeof r)){const t=e.method(r,s);if(t)return t}return n}}:e||t},n.prepare=function(e,t){return e&&t?function(r,s){const n=e(r,s);if(n){if(n.errors||void 0===n.value)return n;r=n.value}return t(r,s)||n}:e||t},n.rebuild=function(e,t){return e&&t?function(r){t(r),e(r)}:e||t},n.validate=function(e,t){return e&&t?function(r,s){const n=t(r,s);if(n){if(n.errors&&(!Array.isArray(n.errors)||n.errors.length))return n;r=n.value}return e(r,s)||n}:e||t},J}var ee,te={};function re(){if(ee)return te;ee=1;const e=l,t=v,r=V(),s=K(),n=H(),i=X();let a;const o={};return te.describe=function(n){const i=n._definition,a={type:n.type,flags:{},rules:[]};for(const e in n._flags)"_"!==e[0]&&(a.flags[e]=o.describe(n._flags[e]));Object.keys(a.flags).length||delete a.flags,n._preferences&&(a.preferences=t(n._preferences,{shallow:["messages"]}),delete a.preferences[r.symbols.prefs],a.preferences.messages&&(a.preferences.messages=s.decompile(a.preferences.messages))),n._valids&&(a.allow=n._valids.describe()),n._invalids&&(a.invalid=n._invalids.describe());for(const e of n._rules){if(!1===i.rules[e.name].manifest)continue;const t={name:e.name};for(const r in i.modifiers)void 0!==e[r]&&(t[r]=o.describe(e[r]));if(e.args){t.args={};for(const r in e.args){const s=e.args[r];("options"!==r||Object.keys(s).length)&&(t.args[r]=o.describe(s,{assign:r}))}Object.keys(t.args).length||delete t.args}a.rules.push(t)}a.rules.length||delete a.rules;for(const t in n.$_terms){if("_"===t[0])continue;e(!a[t],"Cannot describe schema due to internal name conflict with",t);const s=n.$_terms[t];if(!s)continue;if(s instanceof Map){s.size&&(a[t]=[...s.entries()]);continue}if(r.isValues(s)){a[t]=s.describe();continue}e(i.terms[t],"Term",t,"missing configuration");const l=i.terms[t].manifest,c="object"==typeof l;if(!s.length&&!c)continue;const u=[];for(const e of s)u.push(o.describe(e));if(c){const{from:e,to:r}=l.mapped;a[t]={};for(const s of u)a[t][s[r]]=s[e]}else"single"!==l?a[t]=u:(e(1===u.length,"Term",t,"contains more than one item"),a[t]=u[0])}return o.validate(n.$_root,a),a},o.describe=function(e,s={}){if(Array.isArray(e))return e.map(o.describe);if(e===r.symbols.deepDefault)return{special:"deep"};if("object"!=typeof e||null===e)return e;if("options"===s.assign)return t(e);if(Buffer&&Buffer.isBuffer(e))return{buffer:e.toString("binary")};if(e instanceof Date)return e.toISOString();if(e instanceof Error)return e;if(e instanceof RegExp)return"regex"===s.assign?e.toString():{regex:e.toString()};if(e[r.symbols.literal])return{function:e.literal};if("function"==typeof e.describe)return"ref"===s.assign?e.describe().ref:e.describe();const n={};for(const t in e){const r=e[t];void 0!==r&&(n[t]=o.describe(r,{assign:t}))}return n},te.build=function(e,t){return new o.Builder(e).parse(t)},o.Builder=class{constructor(e){this.joi=e}parse(t){o.validate(this.joi,t);let r=this.joi[t.type]()._bare();const s=r._definition;if(t.flags)for(const n in t.flags){const i=s.flags[n]&&s.flags[n].setter||n;e("function"==typeof r[i],"Invalid flag",n,"for type",t.type),r=r[i](this.build(t.flags[n]))}if(t.preferences&&(r=r.preferences(this.build(t.preferences))),t.allow&&(r=r.allow(...this.build(t.allow))),t.invalid&&(r=r.invalid(...this.build(t.invalid))),t.rules)for(const n of t.rules){e("function"==typeof r[n.name],"Invalid rule",n.name,"for type",t.type);const i=[];if(n.args){const r={};for(const e in n.args)r[e]=this.build(n.args[e],{assign:e});const a=Object.keys(r),o=s.rules[n.name].args;if(o){e(a.length<=o.length,"Invalid number of arguments for",t.type,n.name,"(expected up to",o.length,", found",a.length,")");for(const{name:e}of o)i.push(r[e])}else e(1===a.length,"Invalid number of arguments for",t.type,n.name,"(expected up to 1, found",a.length,")"),i.push(r[a[0]])}r=r[n.name](...i);const a={};for(const e in s.modifiers)void 0!==n[e]&&(a[e]=this.build(n[e]));Object.keys(a).length&&(r=r.rule(a))}const n={};for(const r in t){if(["allow","flags","invalid","whens","preferences","rules","type"].includes(r))continue;e(s.terms[r],"Term",r,"missing configuration");const i=s.terms[r].manifest;if("schema"!==i)if("values"!==i)if("single"!==i)if("object"!=typeof i)n[r]=this.build(t[r]);else{n[r]={};for(const e in t[r]){const s=t[r][e];n[r][e]=this.parse(s)}}else n[r]=this.build(t[r]);else n[r]=t[r].map((e=>this.build(e)));else n[r]=t[r].map((e=>this.parse(e)))}return t.whens&&(n.whens=t.whens.map((e=>this.build(e)))),r=s.manifest.build(r,n),r.$_temp.ruleset=!1,r}build(s,a={}){if(null===s)return null;if(Array.isArray(s))return s.map((e=>this.build(e)));if(s instanceof Error)return s;if("options"===a.assign)return t(s);if("regex"===a.assign)return o.regex(s);if("ref"===a.assign)return n.build(s);if("object"!=typeof s)return s;if(1===Object.keys(s).length){if(s.buffer)return e(Buffer,"Buffers are not supported"),Buffer&&Buffer.from(s.buffer,"binary");if(s.function)return{[r.symbols.literal]:!0,literal:s.function};if(s.override)return r.symbols.override;if(s.ref)return n.build(s.ref);if(s.regex)return o.regex(s.regex);if(s.special)return e(["deep"].includes(s.special),"Unknown special value",s.special),r.symbols.deepDefault;if(s.value)return t(s.value)}if(s.type)return this.parse(s);if(s.template)return i.build(s);const l={};for(const e in s)l[e]=this.build(s[e],{assign:e});return l}},o.regex=function(e){const t=e.lastIndexOf("/"),r=e.slice(1,t),s=e.slice(t+1);return new RegExp(r,s)},o.validate=function(e,t){a=a||O(),e.assert(t,a.description)},te}var se={};const ne=h,ie={mismatched:null};var ae=function(e,t,r){return r=Object.assign({prototype:!0},r),!!ie.isDeepEqual(e,t,r,[])};ie.isDeepEqual=function(e,t,r,s){if(e===t)return 0!==e||1/e==1/t;const n=typeof e;if(n!==typeof t)return!1;if(null===e||null===t)return!1;if("function"===n){if(!r.deepFunction||e.toString()!==t.toString())return!1}else if("object"!==n)return e!=e&&t!=t;const i=ie.getSharedType(e,t,!!r.prototype);switch(i){case ne.buffer:return Buffer&&Buffer.prototype.equals.call(e,t);case ne.promise:return e===t;case ne.regex:return e.toString()===t.toString();case ie.mismatched:return!1}for(let r=s.length-1;r>=0;--r)if(s[r].isSame(e,t))return!0;s.push(new ie.SeenEntry(e,t));try{return!!ie.isDeepEqualObj(i,e,t,r,s)}finally{s.pop()}},ie.getSharedType=function(e,t,r){if(r)return Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?ie.mismatched:ne.getInternalProto(e);const s=ne.getInternalProto(e);return s!==ne.getInternalProto(t)?ie.mismatched:s},ie.valueOf=function(e){const t=e.valueOf;if(void 0===t)return e;try{return t.call(e)}catch(e){return e}},ie.hasOwnEnumerableProperty=function(e,t){return Object.prototype.propertyIsEnumerable.call(e,t)},ie.isSetSimpleEqual=function(e,t){for(const r of Set.prototype.values.call(e))if(!Set.prototype.has.call(t,r))return!1;return!0},ie.isDeepEqualObj=function(e,t,r,s,n){const{isDeepEqual:i,valueOf:a,hasOwnEnumerableProperty:o}=ie,{keys:l,getOwnPropertySymbols:c}=Object;if(e===ne.array){if(!s.part){if(t.length!==r.length)return!1;for(let e=0;e<t.length;++e)if(!i(t[e],r[e],s,n))return!1;return!0}for(const e of t)for(const t of r)if(i(e,t,s,n))return!0}else if(e===ne.set){if(t.size!==r.size)return!1;if(!ie.isSetSimpleEqual(t,r)){const e=new Set(Set.prototype.values.call(r));for(const r of Set.prototype.values.call(t)){if(e.delete(r))continue;let t=!1;for(const a of e)if(i(r,a,s,n)){e.delete(a),t=!0;break}if(!t)return!1}}}else if(e===ne.map){if(t.size!==r.size)return!1;for(const[e,a]of Map.prototype.entries.call(t)){if(void 0===a&&!Map.prototype.has.call(r,e))return!1;if(!i(a,Map.prototype.get.call(r,e),s,n))return!1}}else if(e===ne.error&&(t.name!==r.name||t.message!==r.message))return!1;const u=a(t),f=a(r);if((t!==u||r!==f)&&!i(u,f,s,n))return!1;const m=l(t);if(!s.part&&m.length!==l(r).length&&!s.skip)return!1;let h=0;for(const e of m)if(s.skip&&s.skip.includes(e))void 0===r[e]&&++h;else{if(!o(r,e))return!1;if(!i(t[e],r[e],s,n))return!1}if(!s.part&&m.length-h!==l(r).length)return!1;if(!1!==s.symbols){const e=c(t),a=new Set(c(r));for(const l of e){if(!s.skip||!s.skip.includes(l))if(o(t,l)){if(!o(r,l))return!1;if(!i(t[l],r[l],s,n))return!1}else if(o(r,l))return!1;a.delete(l)}for(const e of a)if(o(r,e))return!1}return!0},ie.SeenEntry=class{constructor(e,t){this.obj=e,this.ref=t}isSame(e,t){return this.obj===e&&this.ref===t}};var oe,le={};function ce(){if(oe)return se;oe=1;const e=ae,t=le,r=j(),s={codes:{error:1,pass:2,full:3},labels:{0:"never used",1:"always error",2:"always pass"}};return se.setup=function(e){const t=function(){return e._tracer=e._tracer||new s.Tracer,e._tracer};e.trace=t,e[Symbol.for("@hapi/lab/coverage/initialize")]=t,e.untrace=()=>{e._tracer=null}},se.location=function(e){return e.$_setFlag("_tracerLocation",t.location(2))},s.Tracer=class{constructor(){this.name="Joi",this._schemas=new Map}_register(e){const r=this._schemas.get(e);if(r)return r.store;const n=new s.Store(e),{filename:i,line:a}=e._flags._tracerLocation||t.location(5);return this._schemas.set(e,{filename:i,line:a,store:n}),n}_combine(e,t){for(const{store:r}of this._schemas.values())r._combine(e,t)}report(e){const t=[];for(const{filename:r,line:n,store:i}of this._schemas.values()){if(e&&e!==r)continue;const a=[],o=[];for(const[e,t]of i._sources.entries()){if(s.sub(t.paths,o))continue;if(!t.entry){a.push({status:"never reached",paths:[...t.paths]}),o.push(...t.paths);continue}for(const r of["valid","invalid"]){const s=e[`_${r}s`];if(!s)continue;const n=new Set(s._values),i=new Set(s._refs);for(const{value:e,ref:s}of t[r])n.delete(e),i.delete(s);(n.size||i.size)&&a.push({status:[...n,...[...i].map((e=>e.display))],rule:`${r}s`})}const r=e._rules.map((e=>e.name));for(const t of["default","failover"])void 0!==e._flags[t]&&r.push(t);for(const e of r){const r=s.labels[t.rule[e]||0];if(r){const s={rule:e,status:r};t.paths.size&&(s.paths=[...t.paths]),a.push(s)}}}a.length&&t.push({filename:r,line:n,missing:a,severity:"error",message:`Schema missing tests for ${a.map(s.message).join(", ")}`})}return t.length?t:null}},s.Store=class{constructor(e){this.active=!0,this._sources=new Map,this._combos=new Map,this._scan(e)}debug(e,t,r,s){e.mainstay.debug&&e.mainstay.debug.push({type:t,name:r,result:s,path:e.path})}entry(e,t){s.debug(t,{type:"entry"}),this._record(e,(e=>{e.entry=!0}))}filter(e,t,r,n){s.debug(t,{type:r,...n}),this._record(e,(e=>{e[r].add(n)}))}log(e,t,r,n,i){s.debug(t,{type:r,name:n,result:"full"===i?"pass":i}),this._record(e,(e=>{e[r][n]=e[r][n]||0,e[r][n]|=s.codes[i]}))}resolve(e,t,r){if(!e.mainstay.debug)return;const s={type:"resolve",ref:t.display,to:r,path:e.path};e.mainstay.debug.push(s)}value(t,r,s,n,i){if(!t.mainstay.debug||e(s,n))return;const a={type:"value",by:r,from:s,to:n,path:t.path};i&&(a.name=i),t.mainstay.debug.push(a)}_record(e,t){const r=this._sources.get(e);if(r)return void t(r);const s=this._combos.get(e);for(const e of s)this._record(e,t)}_scan(e,t){const r=t||[];let n=this._sources.get(e);n||(n={paths:new Set,entry:!1,rule:{},valid:new Set,invalid:new Set},this._sources.set(e,n)),r.length&&n.paths.add(r);e.$_modify({each:(e,t)=>{const n=s.id(e,t);this._scan(e,r.concat(n))},ref:!1})}_combine(e,t){this._combos.set(e,t)}},s.message=function(e){return`${e.paths?r.path(e.paths[0])+(e.rule?":":""):""}${e.rule||""} (${e.status})`},s.id=function(e,{source:t,name:r,path:s,key:n}){return e._flags.id?e._flags.id:n||(r=`@${r}`,"terms"===t?[r,s[Math.min(s.length-1,1)]]:r)},s.sub=function(t,r){for(const s of t)for(const t of r)if(e(s.slice(0,t.length),t))return!0;return!1},s.debug=function(e,t){e.mainstay.debug&&(t.path=e.debug?[...e.path,e.debug]:e.path,e.mainstay.debug.push(t))},se}le.location=function(e=0){const t=Error.prepareStackTrace;Error.prepareStackTrace=(e,t)=>t;const r={};Error.captureStackTrace(r,this);const s=r.stack[e+1];return Error.prepareStackTrace=t,{filename:s.getFileName(),line:s.getLineNumber()}};const ue=l,fe=v,me=d,he={};var de,pe=he.merge=function(e,t,r){if(ue(e&&"object"==typeof e,"Invalid target value: must be an object"),ue(null==t||"object"==typeof t,"Invalid source value: must be null, undefined, or an object"),!t)return e;if(r=Object.assign({nullOverride:!0,mergeArrays:!0},r),Array.isArray(t)){ue(Array.isArray(e),"Cannot merge array onto an object"),r.mergeArrays||(e.length=0);for(let s=0;s<t.length;++s)e.push(fe(t[s],{symbols:r.symbols}));return e}const s=me.keys(t,r);for(let n=0;n<s.length;++n){const i=s[n];if("__proto__"===i||!Object.prototype.propertyIsEnumerable.call(t,i))continue;const a=t[i];if(a&&"object"==typeof a){if(e[i]===a)continue;!e[i]||"object"!=typeof e[i]||Array.isArray(e[i])!==Array.isArray(a)||a instanceof Date||Buffer&&Buffer.isBuffer(a)||a instanceof RegExp?e[i]=fe(a,{symbols:r.symbols}):he.merge(e[i],a,r)}else(null!=a||r.nullOverride)&&(e[i]=a)}return e},ge={};var ye,be,ve,_e,Ae,Ee,Se,Re,Oe,Ne,Ie,we,$e,Te,Ce,Le,xe,De={},Me=function(){};function je(){return ve||(ve=1,function(e){const t=l,r=v,s=Me,n=f,i=V(),a=j(),o=function(){if(be)return ye;be=1;const e=v,t=f,r=V(),s={value:Symbol("value")};return ye=s.State=class{constructor(e,t,r){this.path=e,this.ancestors=t,this.mainstay=r.mainstay,this.schemas=r.schemas,this.debug=null}localize(e,t=null,r=null){const n=new s.State(e,t,this);return r&&n.schemas&&(n.schemas=[s.schemas(r),...n.schemas]),n}nest(e,t){const r=new s.State(this.path,this.ancestors,this);return r.schemas=r.schemas&&[s.schemas(e),...r.schemas],r.debug=t,r}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new s.Shadow,this.mainstay.shadow.set(this.path,e,t)}snapshot(){this.mainstay.shadow&&(this._snapshot=e(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},s.schemas=function(e){return r.isSchema(e)?{schema:e}:e},s.Shadow=class{constructor(){this._values=null}set(e,t,r){if(!e.length)return;if("strip"===r&&"number"==typeof e[e.length-1])return;this._values=this._values||new Map;let n=this._values;for(let t=0;t<e.length;++t){const r=e[t];let s=n.get(r);s||(s=new Map,n.set(r,s)),n=s}n[s.value]=t}get(e){const t=this.node(e);if(t)return t[s.value]}node(e){if(this._values)return t(this._values,e,{iterables:!0})}override(e,r){if(!this._values)return;const s=e.slice(0,-1),n=e[e.length-1],i=t(this._values,s,{iterables:!0});r?i.set(n,r):i&&i.delete(n)}},ye}(),c={result:Symbol("result")};e.entry=function(e,r,s){let n=i.defaults;s&&(t(void 0===s.warnings,"Cannot override warnings preference in synchronous validation"),t(void 0===s.artifacts,"Cannot override artifacts preference in synchronous validation"),n=i.preferences(i.defaults,s));const o=c.entry(e,r,n);t(!o.mainstay.externals.length,"Schema with external rules must use validateAsync()");const l={value:o.value};return o.error&&(l.error=o.error),o.mainstay.warnings.length&&(l.warning=a.details(o.mainstay.warnings)),o.mainstay.debug&&(l.debug=o.mainstay.debug),o.mainstay.artifacts&&(l.artifacts=o.mainstay.artifacts),l},e.entryAsync=async function(e,t,r){let s=i.defaults;r&&(s=i.preferences(i.defaults,r));const o=c.entry(e,t,s),l=o.mainstay;if(o.error)throw l.debug&&(o.error.debug=l.debug),o.error;if(l.externals.length){let t=o.value;const u=[];for(const o of l.externals){const f=o.state.path,m="link"===o.schema.type?l.links.get(o.schema):null;let h,d,p=t;const g=f.length?[t]:[],y=f.length?n(e,f):e;if(f.length){h=f[f.length-1];let e=t;for(const t of f.slice(0,-1))e=e[t],g.unshift(e);d=g[0],p=d[h]}try{const e=(e,t)=>(m||o.schema).$_createError(e,p,t,o.state,s),n=await o.method(p,{schema:o.schema,linked:m,state:o.state,prefs:r,original:y,error:e,errorsArray:c.errorsArray,warn:(e,t)=>l.warnings.push((m||o.schema).$_createError(e,p,t,o.state,s)),message:(e,t)=>(m||o.schema).$_createError("external",p,t,o.state,s,{messages:e})});if(void 0===n||n===p)continue;if(n instanceof a.Report){if(l.tracer.log(o.schema,o.state,"rule","external","error"),u.push(n),s.abortEarly)break;continue}if(Array.isArray(n)&&n[i.symbols.errors]){if(l.tracer.log(o.schema,o.state,"rule","external","error"),u.push(...n),s.abortEarly)break;continue}d?(l.tracer.value(o.state,"rule",p,n,"external"),d[h]=n):(l.tracer.value(o.state,"rule",t,n,"external"),t=n)}catch(e){throw s.errors.label&&(e.message+=` (${o.label})`),e}}if(o.value=t,u.length)throw o.error=a.process(u,e,s),l.debug&&(o.error.debug=l.debug),o.error}if(!s.warnings&&!s.debug&&!s.artifacts)return o.value;const u={value:o.value};return l.warnings.length&&(u.warning=a.details(l.warnings)),l.debug&&(u.debug=l.debug),l.artifacts&&(u.artifacts=l.artifacts),u},c.Mainstay=class{constructor(e,t,r){this.externals=[],this.warnings=[],this.tracer=e,this.debug=t,this.links=r,this.shadow=null,this.artifacts=null,this._snapshots=[]}snapshot(){this._snapshots.push({externals:this.externals.slice(),warnings:this.warnings.slice()})}restore(){const e=this._snapshots.pop();this.externals=e.externals,this.warnings=e.warnings}commit(){this._snapshots.pop()}},c.entry=function(t,r,s){const{tracer:n,cleanup:i}=c.tracer(r,s),l=s.debug?[]:null,u=r._ids._schemaChain?new Map:null,f=new c.Mainstay(n,l,u),m=r._ids._schemaChain?[{schema:r}]:null,h=new o([],[],{mainstay:f,schemas:m}),d=e.validate(t,r,h,s);i&&r.$_root.untrace();const p=a.process(d.errors,t,s);return{value:d.value,error:p,mainstay:f}},c.tracer=function(e,r){return e.$_root._tracer?{tracer:e.$_root._tracer._register(e)}:r.debug?(t(e.$_root.trace,"Debug mode not supported"),{tracer:e.$_root.trace()._register(e),cleanup:!0}):{tracer:c.ignore}},e.validate=function(e,t,r,s,n={}){if(t.$_terms.whens&&(t=t._generate(e,r,s).schema),t._preferences&&(s=c.prefs(t,s)),t._cache&&s.cache){const s=t._cache.get(e);if(r.mainstay.tracer.debug(r,"validate","cached",!!s),s)return s}const a=(n,i,a)=>t.$_createError(n,e,i,a||r,s),o={original:e,prefs:s,schema:t,state:r,error:a,errorsArray:c.errorsArray,warn:(e,t,s)=>r.mainstay.warnings.push(a(e,t,s)),message:(n,i)=>t.$_createError("custom",e,i,r,s,{messages:n})};r.mainstay.tracer.entry(t,r);const l=t._definition;if(l.prepare&&void 0!==e&&s.convert){const t=l.prepare(e,o);if(t){if(r.mainstay.tracer.value(r,"prepare",e,t.value),t.errors)return c.finalize(t.value,[].concat(t.errors),o);e=t.value}}if(l.coerce&&void 0!==e&&s.convert&&(!l.coerce.from||l.coerce.from.includes(typeof e))){const t=l.coerce.method(e,o);if(t){if(r.mainstay.tracer.value(r,"coerced",e,t.value),t.errors)return c.finalize(t.value,[].concat(t.errors),o);e=t.value}}const u=t._flags.empty;u&&u.$_match(c.trim(e,t),r.nest(u),i.defaults)&&(r.mainstay.tracer.value(r,"empty",e,void 0),e=void 0);const f=n.presence||t._flags.presence||(t._flags._endedSwitch?null:s.presence);if(void 0===e){if("forbidden"===f)return c.finalize(e,null,o);if("required"===f)return c.finalize(e,[t.$_createError("any.required",e,null,r,s)],o);if("optional"===f){if(t._flags.default!==i.symbols.deepDefault)return c.finalize(e,null,o);r.mainstay.tracer.value(r,"default",e,{}),e={}}}else if("forbidden"===f)return c.finalize(e,[t.$_createError("any.unknown",e,null,r,s)],o);const m=[];if(t._valids){const n=t._valids.get(e,r,s,t._flags.insensitive);if(n)return s.convert&&(r.mainstay.tracer.value(r,"valids",e,n.value),e=n.value),r.mainstay.tracer.filter(t,r,"valid",n),c.finalize(e,null,o);if(t._flags.only){const n=t.$_createError("any.only",e,{valids:t._valids.values({display:!0})},r,s);if(s.abortEarly)return c.finalize(e,[n],o);m.push(n)}}if(t._invalids){const n=t._invalids.get(e,r,s,t._flags.insensitive);if(n){r.mainstay.tracer.filter(t,r,"invalid",n);const i=t.$_createError("any.invalid",e,{invalids:t._invalids.values({display:!0})},r,s);if(s.abortEarly)return c.finalize(e,[i],o);m.push(i)}}if(l.validate){const t=l.validate(e,o);if(t&&(r.mainstay.tracer.value(r,"base",e,t.value),e=t.value,t.errors)){if(!Array.isArray(t.errors))return m.push(t.errors),c.finalize(e,m,o);if(t.errors.length)return m.push(...t.errors),c.finalize(e,m,o)}}return t._rules.length?c.rules(e,m,o):c.finalize(e,m,o)},c.rules=function(e,t,r){const{schema:s,state:n,prefs:a}=r;for(const o of s._rules){const l=s._definition.rules[o.method];if(l.convert&&a.convert){n.mainstay.tracer.log(s,n,"rule",o.name,"full");continue}let u,f=o.args;if(o._resolve.length){f=Object.assign({},f);for(const t of o._resolve){const r=l.argsByName.get(t),o=f[t].resolve(e,n,a),c=r.normalize?r.normalize(o):o,m=i.validateArg(c,null,r);if(m){u=s.$_createError("any.ref",o,{arg:t,ref:f[t],reason:m},n,a);break}f[t]=c}}u=u||l.validate(e,r,f,o);const m=c.rule(u,o);if(m.errors){if(n.mainstay.tracer.log(s,n,"rule",o.name,"error"),o.warn){n.mainstay.warnings.push(...m.errors);continue}if(a.abortEarly)return c.finalize(e,m.errors,r);t.push(...m.errors)}else n.mainstay.tracer.log(s,n,"rule",o.name,"pass"),n.mainstay.tracer.value(n,"rule",e,m.value,o.name),e=m.value}return c.finalize(e,t,r)},c.rule=function(e,t){return e instanceof a.Report?(c.error(e,t),{errors:[e],value:null}):Array.isArray(e)&&e[i.symbols.errors]?(e.forEach((e=>c.error(e,t))),{errors:e,value:null}):{errors:null,value:e}},c.error=function(e,t){return t.message&&e._setTemplate(t.message),e},c.finalize=function(e,r,s){r=r||[];const{schema:n,state:i,prefs:o}=s;if(r.length){const t=c.default("failover",void 0,r,s);void 0!==t&&(i.mainstay.tracer.value(i,"failover",e,t),e=t,r=[])}if(r.length&&n._flags.error)if("function"==typeof n._flags.error){r=n._flags.error(r),Array.isArray(r)||(r=[r]);for(const e of r)t(e instanceof Error||e instanceof a.Report,"error() must return an Error object")}else r=[n._flags.error];if(void 0===e){const t=c.default("default",e,r,s);i.mainstay.tracer.value(i,"default",e,t),e=t}if(n._flags.cast&&void 0!==e){const t=n._definition.cast[n._flags.cast];if(t.from(e)){const r=t.to(e,s);i.mainstay.tracer.value(i,"cast",e,r,n._flags.cast),e=r}}if(n.$_terms.externals&&o.externals&&!1!==o._externals)for(const{method:e}of n.$_terms.externals)i.mainstay.externals.push({method:e,schema:n,state:i,label:a.label(n._flags,i,o)});const l={value:e,errors:r.length?r:null};return n._flags.result&&(l.value="strip"===n._flags.result?void 0:s.original,i.mainstay.tracer.value(i,n._flags.result,e,l.value),i.shadow(e,n._flags.result)),n._cache&&!1!==o.cache&&!n._refs.length&&n._cache.set(s.original,l),void 0===e||l.errors||void 0===n._flags.artifact||(i.mainstay.artifacts=i.mainstay.artifacts||new Map,i.mainstay.artifacts.has(n._flags.artifact)||i.mainstay.artifacts.set(n._flags.artifact,[]),i.mainstay.artifacts.get(n._flags.artifact).push(i.path)),l},c.prefs=function(e,t){const r=t===i.defaults;return r&&e._preferences[i.symbols.prefs]?e._preferences[i.symbols.prefs]:(t=i.preferences(t,e._preferences),r&&(e._preferences[i.symbols.prefs]=t),t)},c.default=function(e,t,s,n){const{schema:a,state:o,prefs:l}=n,c=a._flags[e];if(l.noDefaults||void 0===c)return t;if(o.mainstay.tracer.log(a,o,"rule",e,"full"),!c)return c;if("function"==typeof c){const t=c.length?[r(o.ancestors[0]),n]:[];try{return c(...t)}catch(t){return void s.push(a.$_createError(`any.${e}`,null,{error:t},o,l))}}return"object"!=typeof c?c:c[i.symbols.literal]?c.literal:i.isResolvable(c)?c.resolve(t,o,l):r(c)},c.trim=function(e,t){if("string"!=typeof e)return e;const r=t.$_getRule("trim");return r&&r.args.enabled?e.trim():e},c.ignore={active:!1,debug:s,entry:s,filter:s,log:s,resolve:s,value:s},c.errorsArray=function(){const e=[];return e[i.symbols.errors]=!0,e}}(De)),De}function Be(){if(Ae)return _e;Ae=1;const e=l,t=ae,r=V(),s={};return _e=s.Values=class{constructor(e,t){this._values=new Set(e),this._refs=new Set(t),this._lowercase=s.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,t){r.isResolvable(e)?this._refs.has(e)||(this._refs.add(e),t&&t.register(e)):this.has(e,null,null,!1)||(this._values.add(e),"string"==typeof e&&this._lowercase.set(e.toLowerCase(),e))}static merge(e,t,r){if(e=e||new s.Values,t){if(t._override)return t.clone();for(const r of[...t._values,...t._refs])e.add(r)}if(r)for(const t of[...r._values,...r._refs])e.remove(t);return e.length?e:null}remove(e){r.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),"string"==typeof e&&this._lowercase.delete(e.toLowerCase()))}has(e,t,r,s){return!!this.get(e,t,r,s)}get(e,r,s,n){if(!this.length)return!1;if(this._values.has(e))return{value:e};if("string"==typeof e&&e&&n){const t=this._lowercase.get(e.toLowerCase());if(t)return{value:t}}if(!this._refs.size&&"object"!=typeof e)return!1;if("object"==typeof e)for(const r of this._values)if(t(r,e))return{value:r};if(r)for(const i of this._refs){const a=i.resolve(e,r,s,null,{in:!0});if(void 0===a)continue;const o=i.in&&"object"==typeof a?Array.isArray(a)?a:Object.keys(a):[a];for(const r of o)if(typeof r==typeof e)if(n&&e&&"string"==typeof e){if(r.toLowerCase()===e.toLowerCase())return{value:r,ref:i}}else if(t(r,e))return{value:r,ref:i}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const e=[];for(const t of[...this._values,...this._refs])void 0!==t&&e.push(t);return e}return Array.from([...this._values,...this._refs])}clone(){const e=new s.Values(this._values,this._refs);return e._override=this._override,e}concat(t){e(!t._override,"Cannot concat override set of values");const r=new s.Values([...this._values,...t._values],[...this._refs,...t._refs]);return r._override=this._override,r}describe(){const e=[];this._override&&e.push({override:!0});for(const t of this._values.values())e.push(t&&"object"==typeof t?{value:t}:t);for(const t of this._refs.values())e.push(t.describe());return e}},s.Values.prototype[r.symbols.values]=!0,s.Values.prototype.slice=s.Values.prototype.clone,s.lowercases=function(e){const t=new Map;if(e)for(const r of e)"string"==typeof r&&t.set(r.toLowerCase(),r);return t},_e}function ke(){if(Se)return Ee;Se=1;const e=l,t=v,r=ae,s=pe,n=Y(),i=V(),a=z(),o=j(),c=Q(),u=re(),f=K(),m=(de||(de=1,function(e){const t=l,r=V(),s=H(),n={};e.Ids=n.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new n.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[r,s]of e._byId.entries())t(!this._byKey.has(r),"Schema id conflicts with existing key:",r),this._byId.set(r,s);for(const[r,s]of e._byKey.entries())t(!this._byId.has(r),"Schema key conflicts with existing id:",r),this._byKey.set(r,s)}fork(e,s,i){const a=this._collect(e);a.push({schema:i});const o=a.shift();let l={id:o.id,schema:s(o.schema)};t(r.isSchema(l.schema),"adjuster function failed to return a joi schema type");for(const e of a)l={id:e.id,schema:n.fork(e.schema,l.id,l.schema)};return l.schema}labels(e,t=[]){const r=e[0],s=this._get(r);if(!s)return[...t,...e].join(".");const n=e.slice(1);return t=[...t,s.schema._flags.label||r],n.length?s.schema._ids.labels(n,t):t.join(".")}reach(e,r=[]){const s=e[0],n=this._get(s);t(n,"Schema does not contain path",[...r,...e].join("."));const i=e.slice(1);return i.length?n.schema._ids.reach(i,[...r,s]):n.schema}register(e,{key:s}={}){if(!e||!r.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const n=e._flags.id;if(n){const r=this._byId.get(n);t(!r||r.schema===e,"Cannot add different schemas with the same id:",n),t(!this._byKey.has(n),"Schema id conflicts with existing key:",n),this._byId.set(n,{schema:e,id:n})}s&&(t(!this._byKey.has(s),"Schema already contains key:",s),t(!this._byId.has(s),"Schema key conflicts with existing id:",s),this._byKey.set(s,{schema:e,id:s}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(e,r=[],s=[]){const n=e[0],i=this._get(n);t(i,"Schema does not contain path",[...r,...e].join(".")),s=[i,...s];const a=e.slice(1);return a.length?i.schema._ids._collect(a,[...r,n],s):s}_get(e){return this._byId.get(e)||this._byKey.get(e)}},n.fork=function(t,r,s){const n=e.schema(t,{each:(e,{key:t})=>{if(r===(e._flags.id||t))return s},ref:!1});return n?n.$_mutateRebuild():t},e.schema=function(e,t){let r;for(const s in e._flags){if("_"===s[0])continue;const i=n.scan(e._flags[s],{source:"flags",name:s},t);void 0!==i&&(r=r||e.clone(),r._flags[s]=i)}for(let s=0;s<e._rules.length;++s){const i=e._rules[s],a=n.scan(i.args,{source:"rules",name:i.name},t);if(void 0!==a){r=r||e.clone();const t=Object.assign({},i);t.args=a,r._rules[s]=t,r._singleRules.get(i.name)===i&&r._singleRules.set(i.name,t)}}for(const s in e.$_terms){if("_"===s[0])continue;const i=n.scan(e.$_terms[s],{source:"terms",name:s},t);void 0!==i&&(r=r||e.clone(),r.$_terms[s]=i)}return r},n.scan=function(e,t,i,a,o){const l=a||[];if(null===e||"object"!=typeof e)return;let c;if(Array.isArray(e)){for(let r=0;r<e.length;++r){const s="terms"===t.source&&"keys"===t.name&&e[r].key,a=n.scan(e[r],t,i,[r,...l],s);void 0!==a&&(c=c||e.slice(),c[r]=a)}return c}if(!1!==i.schema&&r.isSchema(e)||!1!==i.ref&&s.isRef(e)){const r=i.each(e,{...t,path:l,key:o});if(r===e)return;return r}for(const r in e){if("_"===r[0])continue;const s=n.scan(e[r],t,i,[r,...l],o);void 0!==s&&(c=c||Object.assign({},e),c[r]=s)}return c}}(ge)),ge),h=H(),d=ce(),p=je(),g=Be(),y={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new m.Ids,this._preferences=null,this._refs=new h.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 e("function"==typeof u.describe,"Manifest functionality disabled"),u.describe(this)}allow(...e){return i.verifyFlat(e,"allow"),this._values(e,"_valids")}alter(t){e(t&&"object"==typeof t&&!Array.isArray(t),"Invalid targets argument"),e(!this._inRuleset(),"Cannot set alterations inside a ruleset");const r=this.clone();r.$_terms.alterations=r.$_terms.alterations||[];for(const s in t){const n=t[s];e("function"==typeof n,"Alteration adjuster for",s,"must be a function"),r.$_terms.alterations.push({target:s,adjuster:n})}return r.$_temp.ruleset=!1,r}artifact(t){return e(void 0!==t,"Artifact cannot be undefined"),e(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",t)}cast(t){return e(!1===t||"string"==typeof t,"Invalid to value"),e(!1===t||this._definition.cast[t],"Type",this.type,"does not support casting to",t),this.$_setFlag("cast",!1===t?void 0:t)}default(e,t){return this._default("default",e,t)}description(t){return e(t&&"string"==typeof t,"Description must be a non-empty string"),this.$_setFlag("description",t)}empty(e){const t=this.clone();return void 0!==e&&(e=t.$_compile(e,{override:!1})),t.$_setFlag("empty",e,{clone:!1})}error(t){return e(t,"Missing error"),e(t instanceof Error||"function"==typeof t,"Must provide a valid Error object or a function"),this.$_setFlag("error",t)}example(t,r={}){return e(void 0!==t,"Missing example"),i.assertOptions(r,["override"]),this._inner("examples",t,{single:!0,override:r.override})}external(t,r){return"object"==typeof t&&(e(!r,"Cannot combine options with description"),r=t.description,t=t.method),e("function"==typeof t,"Method must be a function"),e(void 0===r||r&&"string"==typeof r,"Description must be a non-empty string"),this._inner("externals",{method:t,description:r},{single:!0})}failover(e,t){return this._default("failover",e,t)}forbidden(){return this.presence("forbidden")}id(t){return t?(e("string"==typeof t,"id must be a non-empty string"),e(/^[^\.]+$/.test(t),"id cannot contain period character"),this.$_setFlag("id",t)):this.$_setFlag("id",void 0)}invalid(...e){return this._values(e,"_invalids")}label(t){return e(t&&"string"==typeof t,"Label name must be a non-empty string"),this.$_setFlag("label",t)}meta(t){return e(void 0!==t,"Meta cannot be undefined"),this._inner("metas",t,{single:!0})}note(...t){e(t.length,"Missing notes");for(const r of t)e(r&&"string"==typeof r,"Notes must be non-empty strings");return this._inner("notes",t)}only(t=!0){return e("boolean"==typeof t,"Invalid mode:",t),this.$_setFlag("only",t)}optional(){return this.presence("optional")}prefs(t){e(t,"Missing preferences"),e(void 0===t.context,"Cannot override context"),e(void 0===t.externals,"Cannot override externals"),e(void 0===t.warnings,"Cannot override warnings"),e(void 0===t.debug,"Cannot override debug"),i.checkPreferences(t);const r=this.clone();return r._preferences=i.preferences(r._preferences,t),r}presence(t){return e(["optional","required","forbidden"].includes(t),"Unknown presence mode",t),this.$_setFlag("presence",t)}raw(e=!0){return this.$_setFlag("result",e?"raw":void 0)}result(t){return e(["raw","strip"].includes(t),"Unknown result mode",t),this.$_setFlag("result",t)}required(){return this.presence("required")}strict(e){const t=this.clone(),r=void 0!==e&&!e;return t._preferences=i.preferences(t._preferences,{convert:r}),t}strip(e=!0){return this.$_setFlag("result",e?"strip":void 0)}tag(...t){e(t.length,"Missing tags");for(const r of t)e(r&&"string"==typeof r,"Tags must be non-empty strings");return this._inner("tags",t)}unit(t){return e(t&&"string"==typeof t,"Unit name must be a non-empty string"),this.$_setFlag("unit",t)}valid(...e){i.verifyFlat(e,"valid");const t=this.allow(...e);return t.$_setFlag("only",!!t._valids,{clone:!1}),t}when(t,r){const s=this.clone();s.$_terms.whens||(s.$_terms.whens=[]);const n=a.when(s,t,r);if(!["any","link"].includes(s.type)){const t=n.is?[n]:n.switch;for(const r of t)e(!r.then||"any"===r.then.type||r.then.type===s.type,"Cannot combine",s.type,"with",r.then&&r.then.type),e(!r.otherwise||"any"===r.otherwise.type||r.otherwise.type===s.type,"Cannot combine",s.type,"with",r.otherwise&&r.otherwise.type)}return s.$_terms.whens.push(n),s.$_mutateRebuild()}cache(t){e(!this._inRuleset(),"Cannot set caching inside a ruleset"),e(!this._cache,"Cannot override schema cache"),e(void 0===this._flags.artifact,"Cannot cache a rule with an artifact");const r=this.clone();return r._cache=t||n.provider.provision(),r.$_temp.ruleset=!1,r}clone(){const e=Object.create(Object.getPrototypeOf(this));return this._assign(e)}concat(t){e(i.isSchema(t),"Invalid schema object"),e("any"===this.type||"any"===t.type||t.type===this.type,"Cannot merge type",this.type,"with another type:",t.type),e(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),e(!t._inRuleset(),"Cannot concatenate a schema with open ruleset");let r=this.clone();if("any"===this.type&&"any"!==t.type){const e=t.clone();for(const t of Object.keys(r))"type"!==t&&(e[t]=r[t]);r=e}r._ids.concat(t._ids),r._refs.register(t,h.toSibling),r._preferences=r._preferences?i.preferences(r._preferences,t._preferences):t._preferences,r._valids=g.merge(r._valids,t._valids,t._invalids),r._invalids=g.merge(r._invalids,t._invalids,t._valids);for(const e of t._singleRules.keys())r._singleRules.has(e)&&(r._rules=r._rules.filter((t=>t.keep||t.name!==e)),r._singleRules.delete(e));for(const e of t._rules)t._definition.rules[e.method].multi||r._singleRules.set(e.name,e),r._rules.push(e);if(r._flags.empty&&t._flags.empty){r._flags.empty=r._flags.empty.concat(t._flags.empty);const e=Object.assign({},t._flags);delete e.empty,s(r._flags,e)}else if(t._flags.empty){r._flags.empty=t._flags.empty;const e=Object.assign({},t._flags);delete e.empty,s(r._flags,e)}else s(r._flags,t._flags);for(const e in t.$_terms){const s=t.$_terms[e];s?r.$_terms[e]?r.$_terms[e]=r.$_terms[e].concat(s):r.$_terms[e]=s.slice():r.$_terms[e]||(r.$_terms[e]=s)}return this.$_root._tracer&&this.$_root._tracer._combine(r,[this,t]),r.$_mutateRebuild()}extend(t){return e(!t.base,"Cannot extend type with another base"),c.type(this,t)}extract(e){return e=Array.isArray(e)?e:e.split("."),this._ids.reach(e)}fork(t,r){e(!this._inRuleset(),"Cannot fork inside a ruleset");let s=this;for(let e of[].concat(t))e=Array.isArray(e)?e:e.split("."),s=s._ids.fork(e,r,s);return s.$_temp.ruleset=!1,s}rule(r){const s=this._definition;i.assertOptions(r,Object.keys(s.modifiers)),e(!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;e(n>=0&&n<this._rules.length,"Cannot apply rules to empty ruleset");const a=this.clone();for(let i=n;i<a._rules.length;++i){const n=a._rules[i],o=t(n);for(const t in r)s.modifiers[t](o,r[t]),e(o.name===n.name,"Cannot change rule name");a._rules[i]=o,a._singleRules.get(o.name)===n&&a._singleRules.set(o.name,o)}return a.$_temp.ruleset=!1,a.$_mutateRebuild()}get ruleset(){e(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const t=this.clone();return t.$_temp.ruleset=t._rules.length,t}get $(){return this.ruleset}tailor(t){t=[].concat(t),e(!this._inRuleset(),"Cannot tailor inside a ruleset");let r=this;if(this.$_terms.alterations)for(const{target:s,adjuster:n}of this.$_terms.alterations)t.includes(s)&&(r=n(r),e(i.isSchema(r),"Alteration adjuster for",s,"failed to return a schema object"));return r=r.$_modify({each:e=>e.tailor(t),ref:!1}),r.$_temp.ruleset=!1,r.$_mutateRebuild()}tracer(){return d.location?d.location(this):this}validate(e,t){return p.entry(e,this,t)}validateAsync(e,t){return p.entryAsync(e,this,t)}$_addRule(t){"string"==typeof t&&(t={name:t}),e(t&&"object"==typeof t,"Invalid options"),e(t.name&&"string"==typeof t.name,"Invalid rule name");for(const r in t)e("_"!==r[0],"Cannot set private rule properties");const r=Object.assign({},t);r._resolve=[],r.method=r.method||r.name;const s=this._definition.rules[r.method],n=r.args;e(s,"Unknown rule",r.method);const a=this.clone();if(n){e(1===Object.keys(n).length||Object.keys(n).length===this._definition.rules[r.name].args.length,"Invalid rule definition for",this.type,r.name);for(const t in n){let o=n[t];if(s.argsByName){const l=s.argsByName.get(t);if(l.ref&&i.isResolvable(o))r._resolve.push(t),a.$_mutateRegister(o);else if(l.normalize&&(o=l.normalize(o),n[t]=o),l.assert){const r=i.validateArg(o,t,l);e(!r,r,"or reference")}}void 0!==o?n[t]=o:delete n[t]}}return s.multi||(a._ruleRemove(r.name,{clone:!1}),a._singleRules.set(r.name,r)),!1===a.$_temp.ruleset&&(a.$_temp.ruleset=null),s.priority?a._rules.unshift(r):a._rules.push(r),a}$_compile(e,t){return a.schema(this.$_root,e,t)}$_createError(e,t,r,s,n,i={}){const a=!1!==i.flags?this._flags:{},l=i.messages?f.merge(this._definition.messages,i.messages):this._definition.messages;return new o.Report(e,t,r,a,l,s,n)}$_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,r,s){(r=Object.assign({},r)).abortEarly=!0,r._externals=!1,t.snapshot();const n=!p.validate(e,this,t,r,s).errors;return t.restore(),n}$_modify(e){return i.assertOptions(e,["each","once","ref","schema"]),m.schema(this,e)||this}$_mutateRebuild(){e(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset();return this.$_modify({each:(e,{source:t,name:r,path:s,key:n})=>{const i=this._definition[t][r]&&this._definition[t][r].register;!1!==i&&this.$_mutateRegister(e,{family:i,key:n})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(e,{family:t,key:r}={}){this._refs.register(e,t),this._ids.register(e,{key:r})}$_property(e){return this._definition.properties[e]}$_reach(e){return this._ids.reach(e)}$_rootReferences(){return this._refs.roots()}$_setFlag(t,s,n={}){e("_"===t[0]||!this._inRuleset(),"Cannot set flag inside a ruleset");const i=this._definition.flags[t]||{};if(r(s,i.default)&&(s=void 0),r(s,this._flags[t]))return this;const a=!1!==n.clone?this.clone():this;return void 0!==s?(a._flags[t]=s,a.$_mutateRegister(s)):delete a._flags[t],"_"!==t[0]&&(a.$_temp.ruleset=!1),a}$_parent(e,...t){return this[e][i.symbols.parent].call(this,...t)}$_validate(e,t,r){return p.validate(e,this,t,r)}_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=t(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 r in t){const s=t[r];e.$_terms[r]=s.init}return e.$_mutateRebuild()}_default(t,r,s={}){i.assertOptions(s,"literal"),e(void 0!==r,"Missing",t,"value"),e("function"==typeof r||!s.literal,"Only function value supports literal option"),"function"==typeof r&&s.literal&&(r={[i.symbols.literal]:!0,literal:r});return this.$_setFlag(t,r)}_generate(e,t,r){if(!this.$_terms.whens)return{schema:this};const s=[],n=[];for(let i=0;i<this.$_terms.whens.length;++i){const a=this.$_terms.whens[i];if(a.concat){s.push(a.concat),n.push(`${i}.concat`);continue}const o=a.ref?a.ref.resolve(e,t,r):e,l=a.is?[a]:a.switch,c=n.length;for(let c=0;c<l.length;++c){const{is:u,then:f,otherwise:m}=l[c],h=`${i}${a.switch?"."+c:""}`;if(u.$_match(o,t.nest(u,`${h}.is`),r)){if(f){const i=t.localize([...t.path,`${h}.then`],t.ancestors,t.schemas),{schema:a,id:o}=f._generate(e,i,r);s.push(a),n.push(`${h}.then${o?`(${o})`:""}`);break}}else if(m){const i=t.localize([...t.path,`${h}.otherwise`],t.ancestors,t.schemas),{schema:a,id:o}=m._generate(e,i,r);s.push(a),n.push(`${h}.otherwise${o?`(${o})`:""}`);break}}if(a.break&&n.length>c)break}const i=n.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",i),!i)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[i])return{schema:this.$_temp.whens[i],id:i};let a=this;this._definition.generate&&(a=this._definition.generate(this,e,t,r));for(const e of s)a=a.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(a,[this,...s]),this.$_temp.whens[i]=a,{schema:a,id:i}}_inner(t,r,s={}){e(!this._inRuleset(),`Cannot set ${t} inside a ruleset`);const n=this.clone();return n.$_terms[t]&&!s.override||(n.$_terms[t]=[]),s.single?n.$_terms[t].push(r):n.$_terms[t].push(...r),n.$_temp.ruleset=!1,n}_inRuleset(){return null!==this.$_temp.ruleset&&!1!==this.$_temp.ruleset}_ruleRemove(e,t={}){if(!this._singleRules.has(e))return this;const r=!1!==t.clone?this.clone():this;r._singleRules.delete(e);const s=[];for(let t=0;t<r._rules.length;++t){const n=r._rules[t];n.name!==e||n.keep?s.push(n):r._inRuleset()&&t<r.$_temp.ruleset&&--r.$_temp.ruleset}return r._rules=s,r}_values(t,r){i.verifyFlat(t,r.slice(1,-1));const s=this.clone(),n=t[0]===i.symbols.override;if(n&&(t=t.slice(1)),!s[r]&&t.length?s[r]=new g:n&&(s[r]=t.length?new g:null,s.$_mutateRebuild()),!s[r])return s;n&&s[r].override();for(const n of t){e(void 0!==n,"Cannot call allow/valid/invalid with undefined"),e(n!==i.symbols.override,"Override must be the first value");const t="_invalids"===r?"_valids":"_invalids";s[t]&&(s[t].remove(n),s[t].length||(e("_valids"===r||!s._flags.only,"Setting invalid value",n,"leaves schema rejecting all values due to previous valid rule"),s[t]=null)),s[r].add(n,s._refs)}return s}}};return y.Base.prototype[i.symbols.any]={version:i.version,compile:a.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,Ee=new y.Base}function Pe(){if(Oe)return Re;Oe=1;const e=l,t=ke(),r=V(),s=K();return Re=t.extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},externals:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(t,r){return e("function"==typeof t,"Method must be a function"),e(void 0===r||r&&"string"==typeof r,"Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:t,description:r}})},validate(e,t,{method:r}){try{return r(e,t)}catch(e){return t.error("any.custom",{error:e})}},args:["method","description"],multi:!0},messages:{method(e){return this.prefs({messages:e})}},shared:{method(t){e(r.isSchema(t)&&t._flags.id,"Schema must be a schema with an id");const s=this.clone();return s.$_terms.shared=s.$_terms.shared||[],s.$_terms.shared.push(t),s.$_mutateRegister(t),s}},warning:{method(t,r){return e(t&&"string"==typeof t,"Invalid warning code"),this.$_addRule({name:"warning",args:{code:t,local:r},warn:!0})},validate:(e,t,{code:r,local:s})=>t.error(r,s),args:["code","local"],multi:!0}},modifiers:{keep(e,t=!0){e.keep=t},message(e,t){e.message=s.compile(t)},warn(e,t=!0){e.warn=t}},manifest:{build(e,t){for(const r in t){const s=t[r];if(["examples","externals","metas","notes","tags"].includes(r))for(const t of s)e=e[r.slice(0,-1)](t);else if("alterations"!==r)if("whens"!==r){if("shared"===r)for(const t of s)e=e.shared(t)}else for(const t of s){const{ref:r,is:s,not:n,then:i,otherwise:a,concat:o}=t;e=o?e.concat(o):r?e.when(r,{is:s,not:n,then:i,otherwise:a,switch:t.switch,break:t.break}):e.when(s,{then:i,otherwise:a,break:t.break})}else{const t={};for(const{target:e,adjuster:r}of s)t[e]=r;e=e.alter(t)}}return e}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}}),Re}function Ue(){if(Ie)return Ne;Ie=1;const e=l,t=pe,r=Pe(),s=V(),n=z(),i=j(),a=H(),o={};return Ne=r.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:a.toSibling}},args:(e,...t)=>1===t.length&&Array.isArray(t[0])?e.try(...t[0]):e.try(...t),validate(e,r){const{schema:s,error:n,state:a,prefs:l}=r;if(s._flags.match){const r=[],o=[];for(let t=0;t<s.$_terms.matches.length;++t){const n=s.$_terms.matches[t],i=a.nest(n.schema,`match.${t}`);i.snapshot();const c=n.schema.$_validate(e,i,l);c.errors?(o.push(c.errors),i.restore()):(r.push(c.value),i.commit())}if(0===r.length){return{errors:n("alternatives.any",{details:o.map((e=>i.details(e,{override:!1})))})}}if("one"===s._flags.match)return 1===r.length?{value:r[0]}:{errors:n("alternatives.one")};if(r.length!==s.$_terms.matches.length){return{errors:n("alternatives.all",{details:o.map((e=>i.details(e,{override:!1})))})}}const c=e=>e.$_terms.matches.some((e=>"object"===e.schema.type||"alternatives"===e.schema.type&&c(e.schema)));return c(s)?{value:r.reduce(((e,r)=>t(e,r,{mergeArrays:!1})))}:{value:r[r.length-1]}}const c=[];for(let t=0;t<s.$_terms.matches.length;++t){const r=s.$_terms.matches[t];if(r.schema){const s=a.nest(r.schema,`match.${t}`);s.snapshot();const n=r.schema.$_validate(e,s,l);if(!n.errors)return s.commit(),n;s.restore(),c.push({schema:r.schema,reports:n.errors});continue}const n=r.ref?r.ref.resolve(e,a,l):e,i=r.is?[r]:r.switch;for(let s=0;s<i.length;++s){const o=i[s],{is:c,then:u,otherwise:f}=o,m=`match.${t}${r.switch?"."+s:""}`;if(c.$_match(n,a.nest(c,`${m}.is`),l)){if(u)return u.$_validate(e,a.nest(u,`${m}.then`),l)}else if(f)return f.$_validate(e,a.nest(f,`${m}.otherwise`),l)}}return o.errors(c,r)},rules:{conditional:{method(t,r){e(!this._flags._endedSwitch,"Unreachable condition"),e(!this._flags.match,"Cannot combine match mode",this._flags.match,"with conditional rule"),e(void 0===r.break,"Cannot use break option with alternatives conditional");const s=this.clone(),i=n.when(s,t,r),a=i.is?[i]:i.switch;for(const e of a)if(e.then&&e.otherwise){s.$_setFlag("_endedSwitch",!0,{clone:!1});break}return s.$_terms.matches.push(i),s.$_mutateRebuild()}},match:{method(t){if(e(["any","one","all"].includes(t),"Invalid alternatives match mode",t),"any"!==t)for(const r of this.$_terms.matches)e(r.schema,"Cannot combine match mode",t,"with conditional rules");return this.$_setFlag("match",t)}},try:{method(...t){e(t.length,"Missing alternative schemas"),s.verifyFlat(t,"try"),e(!this._flags._endedSwitch,"Unreachable condition");const r=this.clone();for(const e of t)r.$_terms.matches.push({schema:r.$_compile(e)});return r.$_mutateRebuild()}}},overrides:{label(e){return this.$_parent("label",e).$_modify({each:(t,r)=>"is"!==r.path[0]?t.label(e):void 0,ref:!1})}},rebuild(e){e.$_modify({each:t=>{s.isSchema(t)&&"array"===t.type&&e.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(e,t){if(t.matches)for(const r of t.matches){const{schema:t,ref:s,is:n,not:i,then:a,otherwise:o}=r;e=t?e.try(t):s?e.conditional(s,{is:n,then:a,not:i,otherwise:o,switch:r.switch}):e.conditional(n,{then:a,otherwise:o})}return e}},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),o.errors=function(e,{error:t,state:r}){if(!e.length)return{errors:t("alternatives.any")};if(1===e.length)return{errors:e[0].reports};const s=new Set,n=[];for(const{reports:a,schema:l}of e){if(a.length>1)return o.unmatched(e,t);const c=a[0];if(c instanceof i.Report==!1)return o.unmatched(e,t);if(c.state.path.length!==r.path.length){n.push({type:l.type,report:c});continue}if("any.only"===c.code){for(const e of c.local.valids)s.add(e);continue}const[u,f]=c.code.split(".");"base"===f?s.add(u):n.push({type:l.type,report:c})}return n.length?1===n.length?{errors:n[0].report}:o.unmatched(e,t):{errors:t("alternatives.types",{types:[...s]})}},o.unmatched=function(e,t){const r=[];for(const t of e)r.push(...t.reports);return{errors:t("alternatives.match",i.details(r,{override:!1}))}},Ne}function Ge(){if($e)return we;$e=1;const e=l,t=ae,r=f,s=Pe(),n=V(),i=z(),a={};return we=s.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(e,{schema:t,state:r,prefs:s}){if(!Array.isArray(e))return;const n=t.$_getRule("sort");return n?a.sort(t,e,n.args.options,r,s):void 0}},validate(e,{schema:t,error:r}){if(!Array.isArray(e)){if(t._flags.single){const t=[e];return t[n.symbols.arraySingle]=!0,{value:t}}return{errors:r("array.base")}}if(t.$_getRule("items")||t.$_terms.externals)return{value:e.slice()}},rules:{has:{method(e){e=this.$_compile(e,{appendPath:!0});const t=this.$_addRule({name:"has",args:{schema:e}});return t.$_mutateRegister(e),t},validate(e,{state:t,prefs:r,error:s},{schema:n}){const i=[e,...t.ancestors];for(let s=0;s<e.length;++s){const a=t.localize([...t.path,s],i,n);if(n.$_match(e[s],a,r))return e}const a=n._flags.label;return a?s("array.hasKnown",{patternLabel:a}):s("array.hasUnknown",null)},multi:!0},items:{method(...e){n.verifyFlat(e,"items");const t=this.$_addRule("items");for(let r=0;r<e.length;++r){const s=n.tryWithPath((()=>this.$_compile(e[r])),r,{append:!0});t.$_terms.items.push(s)}return t.$_mutateRebuild()},validate(e,{schema:t,error:r,state:s,prefs:i,errorsArray:o}){const l=t.$_terms._requireds.slice(),c=t.$_terms.ordered.slice(),u=[...t.$_terms._inclusions,...l],f=!e[n.symbols.arraySingle];delete e[n.symbols.arraySingle];const m=o();let h=e.length;for(let n=0;n<h;++n){const o=e[n];let d=!1,p=!1;const g=f?n:new Number(n),y=[...s.path,g];if(!t._flags.sparse&&void 0===o){if(m.push(r("array.sparse",{key:g,path:y,pos:n,value:void 0},s.localize(y))),i.abortEarly)return m;c.shift();continue}const b=[e,...s.ancestors];for(const e of t.$_terms._exclusions)if(e.$_match(o,s.localize(y,b,e),i,{presence:"ignore"})){if(m.push(r("array.excludes",{pos:n,value:o},s.localize(y))),i.abortEarly)return m;d=!0,c.shift();break}if(d)continue;if(t.$_terms.ordered.length){if(c.length){const l=c.shift(),u=l.$_validate(o,s.localize(y,b,l),i);if(u.errors){if(m.push(...u.errors),i.abortEarly)return m}else if("strip"===l._flags.result)a.fastSplice(e,n),--n,--h;else{if(!t._flags.sparse&&void 0===u.value){if(m.push(r("array.sparse",{key:g,path:y,pos:n,value:void 0},s.localize(y))),i.abortEarly)return m;continue}e[n]=u.value}continue}if(!t.$_terms.items.length){if(m.push(r("array.orderedLength",{pos:n,limit:t.$_terms.ordered.length})),i.abortEarly)return m;break}}const v=[];let _=l.length;for(let c=0;c<_;++c){const u=s.localize(y,b,l[c]);u.snapshot();const f=l[c].$_validate(o,u,i);if(v[c]=f,!f.errors){if(u.commit(),e[n]=f.value,p=!0,a.fastSplice(l,c),--c,--_,!t._flags.sparse&&void 0===f.value&&(m.push(r("array.sparse",{key:g,path:y,pos:n,value:void 0},s.localize(y))),i.abortEarly))return m;break}u.restore()}if(p)continue;const A=i.stripUnknown&&!!i.stripUnknown.arrays||!1;_=u.length;for(const c of u){let u;const f=l.indexOf(c);if(-1!==f)u=v[f];else{const l=s.localize(y,b,c);if(l.snapshot(),u=c.$_validate(o,l,i),!u.errors){l.commit(),"strip"===c._flags.result?(a.fastSplice(e,n),--n,--h):t._flags.sparse||void 0!==u.value?e[n]=u.value:(m.push(r("array.sparse",{key:g,path:y,pos:n,value:void 0},s.localize(y))),d=!0),p=!0;break}l.restore()}if(1===_){if(A){a.fastSplice(e,n),--n,--h,p=!0;break}if(m.push(...u.errors),i.abortEarly)return m;d=!0;break}}if(!d&&((t.$_terms._inclusions.length||t.$_terms._requireds.length)&&!p)){if(A){a.fastSplice(e,n),--n,--h;continue}if(m.push(r("array.includes",{pos:n,value:o},s.localize(y))),i.abortEarly)return m}}return l.length&&a.fillMissedErrors(t,m,l,e,s,i),c.length&&(a.fillOrderedErrors(t,m,c,e,s,i),m.length||a.fillDefault(c,e,s,i)),m.length?m:e},priority:!0,manifest:!1},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:s,operator:i,args:a})=>n.compare(e.length,r,i)?e:t.error("array."+s,{limit:a.limit,value:e}),args:[{name:"limit",ref:!0,assert:n.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},ordered:{method(...e){n.verifyFlat(e,"ordered");const t=this.$_addRule("items");for(let r=0;r<e.length;++r){const s=n.tryWithPath((()=>this.$_compile(e[r])),r,{append:!0});a.validateSingle(s,t),t.$_mutateRegister(s),t.$_terms.ordered.push(s)}return t.$_mutateRebuild()}},single:{method(t){const r=void 0===t||!!t;return e(!r||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",r)}},sort:{method(t={}){n.assertOptions(t,["by","order"]);const r={order:t.order||"ascending"};return t.by&&(r.by=i.ref(t.by,{ancestor:0}),e(!r.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:r}})},validate(e,{error:t,state:r,prefs:s,schema:n},{options:i}){const{value:o,errors:l}=a.sort(n,e,i,r,s);if(l)return l;for(let r=0;r<e.length;++r)if(e[r]!==o[r])return t("array.sort",{order:i.order,by:i.by?i.by.key:"value"});return e},convert:!0},sparse:{method(e){const t=void 0===e||!!e;if(this._flags.sparse===t)return this;return(t?this.clone():this.$_addRule("items")).$_setFlag("sparse",t,{clone:!1})}},unique:{method(t,r={}){e(!t||"function"==typeof t||"string"==typeof t,"comparator must be a function or a string"),n.assertOptions(r,["ignoreUndefined","separator"]);const s={name:"unique",args:{options:r,comparator:t}};if(t)if("string"==typeof t){const e=n.default(r.separator,".");s.path=e?t.split(e):[t]}else s.comparator=t;return this.$_addRule(s)},validate(s,{state:n,error:i,schema:a},{comparator:o,options:l},{comparator:c,path:u}){const f={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),object:new Map,function:new Map,custom:new Map},m=c||t,h=l.ignoreUndefined;for(let t=0;t<s.length;++t){const a=u?r(s[t],u):s[t],l=c?f.custom:f[typeof a];if(e(l,"Failed to find unique map container for type",typeof a),l instanceof Map){const e=l.entries();let r;for(;!(r=e.next()).done;)if(m(r.value[0],a)){const e=n.localize([...n.path,t],[s,...n.ancestors]),a={pos:t,value:s[t],dupePos:r.value[1],dupeValue:s[r.value[1]]};return u&&(a.path=o),i("array.unique",a,e)}l.set(a,t)}else{if((!h||void 0!==a)&&void 0!==l[a]){const e={pos:t,value:s[t],dupePos:l[a],dupeValue:s[l[a]]};u&&(e.path=o);return i("array.unique",e,n.localize([...n.path,t],[s,...n.ancestors]))}l[a]=t}}return s},args:["comparator","options"],multi:!0}},cast:{set:{from:Array.isArray,to:(e,t)=>new Set(e)}},rebuild(e){e.$_terms._inclusions=[],e.$_terms._exclusions=[],e.$_terms._requireds=[];for(const t of e.$_terms.items)a.validateSingle(t,e),"required"===t._flags.presence?e.$_terms._requireds.push(t):"forbidden"===t._flags.presence?e.$_terms._exclusions.push(t):e.$_terms._inclusions.push(t);for(const t of e.$_terms.ordered)a.validateSingle(t,e)},manifest:{build:(e,t)=>(t.items&&(e=e.items(...t.items)),t.ordered&&(e=e.ordered(...t.ordered)),e)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasKnown":"{{#label}} does not contain at least one required match for type {:#patternLabel}","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),a.fillMissedErrors=function(e,t,r,s,n,i){const a=[];let o=0;for(const e of r){const t=e._flags.label;t?a.push(t):++o}a.length?o?t.push(e.$_createError("array.includesRequiredBoth",s,{knownMisses:a,unknownMisses:o},n,i)):t.push(e.$_createError("array.includesRequiredKnowns",s,{knownMisses:a},n,i)):t.push(e.$_createError("array.includesRequiredUnknowns",s,{unknownMisses:o},n,i))},a.fillOrderedErrors=function(e,t,r,s,n,i){const o=[];for(const e of r)"required"===e._flags.presence&&o.push(e);o.length&&a.fillMissedErrors(e,t,o,s,n,i)},a.fillDefault=function(e,t,r,s){const n=[];let i=!0;for(let a=e.length-1;a>=0;--a){const o=e[a],l=[t,...r.ancestors],c=o.$_validate(void 0,r.localize(r.path,l,o),s).value;if(i){if(void 0===c)continue;i=!1}n.unshift(c)}n.length&&t.push(...n)},a.fastSplice=function(e,t){let r=t;for(;r<e.length;)e[r++]=e[r];--e.length},a.validateSingle=function(t,r){("array"===t.type||t._flags._arrayItems)&&(e(!r._flags.single,"Cannot specify array item with single rule enabled"),r.$_setFlag("_arrayItems",!0,{clone:!1}))},a.sort=function(e,t,r,s,n){const i="ascending"===r.order?1:-1,o=-1*i,l=i,c=(c,u)=>{let f=a.compare(c,u,o,l);if(null!==f)return f;if(r.by&&(c=r.by.resolve(c,s,n),u=r.by.resolve(u,s,n)),f=a.compare(c,u,o,l),null!==f)return f;const m=typeof c;if(m!==typeof u)throw e.$_createError("array.sort.mismatching",t,null,s,n);if("number"!==m&&"string"!==m)throw e.$_createError("array.sort.unsupported",t,{type:m},s,n);return"number"===m?(c-u)*i:c<u?o:l};try{return{value:t.slice().sort(c)}}catch(e){return{errors:e}}},a.compare=function(e,t,r,s){return e===t?0:void 0===e?1:void 0===t?-1:null===e?s:null===t?r:null},we}function Fe(){if(Ce)return Te;Ce=1;const e=l,t=Pe(),r=V(),s=Be(),n={isBool:function(e){return"boolean"==typeof e}};return Te=t.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(e,{schema:t}){if("boolean"!=typeof e){if("string"==typeof e){const r=t._flags.sensitive?e:e.toLowerCase();e="true"===r||"false"!==r&&e}return"boolean"!=typeof e&&(e=t.$_terms.truthy&&t.$_terms.truthy.has(e,null,null,!t._flags.sensitive)||(!t.$_terms.falsy||!t.$_terms.falsy.has(e,null,null,!t._flags.sensitive))&&e),{value:e}}},validate(e,{error:t}){if("boolean"!=typeof e)return{value:e,errors:t("boolean.base")}},rules:{truthy:{method(...t){r.verifyFlat(t,"truthy");const n=this.clone();n.$_terms.truthy=n.$_terms.truthy||new s;for(let r=0;r<t.length;++r){const s=t[r];e(void 0!==s,"Cannot call truthy with undefined"),n.$_terms.truthy.add(s)}return n}},falsy:{method(...t){r.verifyFlat(t,"falsy");const n=this.clone();n.$_terms.falsy=n.$_terms.falsy||new s;for(let r=0;r<t.length;++r){const s=t[r];e(void 0!==s,"Cannot call falsy with undefined"),n.$_terms.falsy.add(s)}return n}},sensitive:{method(e=!0){return this.$_setFlag("sensitive",e)}}},cast:{number:{from:n.isBool,to:(e,t)=>e?1:0},string:{from:n.isBool,to:(e,t)=>e?"true":"false"}},manifest:{build:(e,t)=>(t.truthy&&(e=e.truthy(...t.truthy)),t.falsy&&(e=e.falsy(...t.falsy)),e)},messages:{"boolean.base":"{{#label}} must be a boolean"}}),Te}function He(){if(xe)return Le;xe=1;const e=l,t=Pe(),r=V(),s=X(),n={isDate:function(e){return e instanceof Date}};return Le=t.extend({type:"date",coerce:{from:["number","string"],method:(e,{schema:t})=>({value:n.parse(e,t._flags.format)||e})},validate(e,{schema:t,error:r,prefs:s}){if(e instanceof Date&&!isNaN(e.getTime()))return;const n=t._flags.format;return s.convert&&n&&"string"==typeof e?{value:e,errors:r("date.format",{format:n})}:{value:e,errors:r("date.base")}},rules:{compare:{method:!1,validate(e,t,{date:s},{name:n,operator:i,args:a}){const o="now"===s?Date.now():s.getTime();return r.compare(e.getTime(),o,i)?e:t.error("date."+n,{limit:a.date,value:e})},args:[{name:"date",ref:!0,normalize:e=>"now"===e?e:n.parse(e),assert:e=>null!==e,message:"must have a valid date format"}]},format:{method(t){return e(["iso","javascript","unix"].includes(t),"Unknown date format",t),this.$_setFlag("format",t)}},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{date:e},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{date:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{date:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{date:e},operator:">="})}},timestamp:{method(t="javascript"){return e(["javascript","unix"].includes(t),'"type" must be one of "javascript, unix"'),this.format(t)}}},cast:{number:{from:n.isDate,to:(e,t)=>e.getTime()},string:{from:n.isDate,to:(e,{prefs:t})=>s.date(e,t)}},messages:{"date.base":"{{#label}} must be a valid date","date.format":'{{#label}} must be in {msg("date.format." + #format) || #format} format',"date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}","date.format.iso":"ISO 8601 date","date.format.javascript":"timestamp or number of milliseconds","date.format.unix":"timestamp or number of seconds"}}),n.parse=function(e,t){if(e instanceof Date)return e;if("string"!=typeof e&&(isNaN(e)||!isFinite(e)))return null;if(/^\s*$/.test(e))return null;if("iso"===t)return r.isIsoDate(e)?n.date(e.toString()):null;const s=e;if("string"==typeof e&&/^[+-]?\d+(\.\d+)?$/.test(e)&&(e=parseFloat(e)),t){if("javascript"===t)return n.date(1*e);if("unix"===t)return n.date(1e3*e);if("string"==typeof s)return null}return n.date(e)},n.date=function(e){const t=new Date(e);return isNaN(t.getTime())?null:t},Le}const Xe=l,Ke=v,Ve=pe,Ye=f,We={};var qe=function(e,t,r={}){if(Xe(e&&"object"==typeof e,"Invalid defaults value: must be an object"),Xe(!t||!0===t||"object"==typeof t,"Invalid source value: must be true, falsy or an object"),Xe("object"==typeof r,"Invalid options: must be an object"),!t)return null;if(r.shallow)return We.applyToDefaultsWithShallow(e,t,r);const s=Ke(e);if(!0===t)return s;const n=void 0!==r.nullOverride&&r.nullOverride;return Ve(s,t,{nullOverride:n,mergeArrays:!1})};We.applyToDefaultsWithShallow=function(e,t,r){const s=r.shallow;Xe(Array.isArray(s),"Invalid keys");const n=new Map,i=!0===t?null:new Set;for(let r of s){r=Array.isArray(r)?r:r.split(".");const s=Ye(e,r);s&&"object"==typeof s?n.set(s,i&&Ye(t,r)||s):i&&i.add(r)}const a=Ke(e,{},n);if(!i)return a;for(const e of i)We.reachCopy(a,t,e);const o=void 0!==r.nullOverride&&r.nullOverride;return Ve(a,t,{nullOverride:o,mergeArrays:!1})},We.reachCopy=function(e,t,r){for(const e of r){if(!(e in t))return;const r=t[e];if("object"!=typeof r||null===r)return;t=r}const s=t;let n=e;for(let e=0;e<r.length-1;++e){const t=r[e];"object"!=typeof n[t]&&(n[t]={}),n=n[t]}n[r[r.length-1]]=s};var ze={};const Ze=l,Je={};var Qe,et,tt,rt,st,nt,it,at,ot,lt;function ct(){if(et)return Qe;et=1;const e=qe,t=l,r=v,s=ze,n=Pe(),i=V(),a=z(),o=j(),c=H(),u=X(),f={renameDefaults:{alias:!1,multiple:!1,override:!1}};return Qe=n.extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:!1}},terms:{dependencies:{init:null},keys:{init:null,manifest:{mapped:{from:"schema",to:"key"}}},patterns:{init:null},renames:{init:null}},args:(e,t)=>e.keys(t),validate(e,{schema:t,error:r,state:s,prefs:n}){if(!e||typeof e!==t.$_property("typeof")||Array.isArray(e))return{value:e,errors:r("object.base",{type:t.$_property("typeof")})};if(!(t.$_terms.renames||t.$_terms.dependencies||t.$_terms.keys||t.$_terms.patterns||t.$_terms.externals))return;e=f.clone(e,n);const i=[];if(t.$_terms.renames&&!f.rename(t,e,s,n,i))return{value:e,errors:i};if(!t.$_terms.keys&&!t.$_terms.patterns&&!t.$_terms.dependencies)return{value:e,errors:i};const a=new Set(Object.keys(e));if(t.$_terms.keys){const r=[e,...s.ancestors];for(const o of t.$_terms.keys){const t=o.key,l=e[t];a.delete(t);const c=s.localize([...s.path,t],r,o),u=o.schema.$_validate(l,c,n);if(u.errors){if(n.abortEarly)return{value:e,errors:u.errors};void 0!==u.value&&(e[t]=u.value),i.push(...u.errors)}else"strip"===o.schema._flags.result||void 0===u.value&&void 0!==l?delete e[t]:void 0!==u.value&&(e[t]=u.value)}}if(a.size||t._flags._hasPatternMatch){const r=f.unknown(t,e,a,i,s,n);if(r)return r}if(t.$_terms.dependencies)for(const r of t.$_terms.dependencies){if(null!==r.key&&!1===f.isPresent(r.options)(r.key.resolve(e,s,n,null,{shadow:!1})))continue;const a=f.dependencies[r.rel](t,r,e,s,n);if(a){const r=t.$_createError(a.code,e,a.context,s,n);if(n.abortEarly)return{value:e,errors:r};i.push(r)}}return{value:e,errors:i}},rules:{and:{method(...e){return i.verifyFlat(e,"and"),f.dependency(this,"and",null,e)}},append:{method(e){return null==e||0===Object.keys(e).length?this:this.keys(e)}},assert:{method(e,r,s){u.isTemplate(e)||(e=a.ref(e)),t(void 0===s||"string"==typeof s,"Message must be a string"),r=this.$_compile(r,{appendPath:!0});const n=this.$_addRule({name:"assert",args:{subject:e,schema:r,message:s}});return n.$_mutateRegister(e),n.$_mutateRegister(r),n},validate(e,{error:t,prefs:r,state:s},{subject:n,schema:i,message:a}){const o=n.resolve(e,s,r),l=c.isRef(n)?n.absolute(s):[];return i.$_match(o,s.localize(l,[e,...s.ancestors],i),r)?e:t("object.assert",{subject:n,message:a})},args:["subject","schema","message"],multi:!0},instance:{method(e,r){return t("function"==typeof e,"constructor must be a function"),r=r||e.name,this.$_addRule({name:"instance",args:{constructor:e,name:r}})},validate:(e,t,{constructor:r,name:s})=>e instanceof r?e:t.error("object.instance",{type:s,value:e}),args:["constructor","name"]},keys:{method(e){t(void 0===e||"object"==typeof e,"Object schema must be a valid object"),t(!i.isSchema(e),"Object schema cannot be a joi schema");const r=this.clone();if(e)if(Object.keys(e).length){r.$_terms.keys=r.$_terms.keys?r.$_terms.keys.filter((t=>!e.hasOwnProperty(t.key))):new f.Keys;for(const t in e)i.tryWithPath((()=>r.$_terms.keys.push({key:t,schema:this.$_compile(e[t])})),t)}else r.$_terms.keys=new f.Keys;else r.$_terms.keys=null;return r.$_mutateRebuild()}},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:s,operator:n,args:a})=>i.compare(Object.keys(e).length,r,n)?e:t.error("object."+s,{limit:a.limit,value:e}),args:[{name:"limit",ref:!0,assert:i.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},nand:{method(...e){return i.verifyFlat(e,"nand"),f.dependency(this,"nand",null,e)}},or:{method(...e){return i.verifyFlat(e,"or"),f.dependency(this,"or",null,e)}},oxor:{method(...e){return f.dependency(this,"oxor",null,e)}},pattern:{method(e,r,s={}){const n=e instanceof RegExp;n||(e=this.$_compile(e,{appendPath:!0})),t(void 0!==r,"Invalid rule"),i.assertOptions(s,["fallthrough","matches"]),n&&t(!e.flags.includes("g")&&!e.flags.includes("y"),"pattern should not use global or sticky mode"),r=this.$_compile(r,{appendPath:!0});const a=this.clone();a.$_terms.patterns=a.$_terms.patterns||[];const o={[n?"regex":"schema"]:e,rule:r};return s.matches&&(o.matches=this.$_compile(s.matches),"array"!==o.matches.type&&(o.matches=o.matches.$_root.array().items(o.matches)),a.$_mutateRegister(o.matches),a.$_setFlag("_hasPatternMatch",!0,{clone:!1})),s.fallthrough&&(o.fallthrough=!0),a.$_terms.patterns.push(o),a.$_mutateRegister(r),a}},ref:{method(){return this.$_addRule("ref")},validate:(e,t)=>c.isRef(e)?e:t.error("object.refType",{value:e})},regex:{method(){return this.$_addRule("regex")},validate:(e,t)=>e instanceof RegExp?e:t.error("object.regex",{value:e})},rename:{method(r,s,n={}){t("string"==typeof r||r instanceof RegExp,"Rename missing the from argument"),t("string"==typeof s||s instanceof u,"Invalid rename to argument"),t(s!==r,"Cannot rename key to same name:",r),i.assertOptions(n,["alias","ignoreUndefined","override","multiple"]);const a=this.clone();a.$_terms.renames=a.$_terms.renames||[];for(const e of a.$_terms.renames)t(e.from!==r,"Cannot rename the same key multiple times");return s instanceof u&&a.$_mutateRegister(s),a.$_terms.renames.push({from:r,to:s,options:e(f.renameDefaults,n)}),a}},schema:{method(e="any"){return this.$_addRule({name:"schema",args:{type:e}})},validate:(e,t,{type:r})=>!i.isSchema(e)||"any"!==r&&e.type!==r?t.error("object.schema",{type:r}):e},unknown:{method(e){return this.$_setFlag("unknown",!1!==e)}},with:{method(e,t,r={}){return f.dependency(this,"with",e,t,r)}},without:{method(e,t,r={}){return f.dependency(this,"without",e,t,r)}},xor:{method(...e){return i.verifyFlat(e,"xor"),f.dependency(this,"xor",null,e)}}},overrides:{default(e,t){return void 0===e&&(e=i.symbols.deepDefault),this.$_parent("default",e,t)}},rebuild(e){if(e.$_terms.keys){const t=new s.Sorter;for(const r of e.$_terms.keys)i.tryWithPath((()=>t.add(r,{after:r.schema.$_rootReferences(),group:r.key})),r.key);e.$_terms.keys=new f.Keys(...t.nodes)}},manifest:{build(e,t){if(t.keys&&(e=e.keys(t.keys)),t.dependencies)for(const{rel:r,key:s=null,peers:n,options:i}of t.dependencies)e=f.dependency(e,r,s,n,i);if(t.patterns)for(const{regex:r,schema:s,rule:n,fallthrough:i,matches:a}of t.patterns)e=e.pattern(r||s,n,{fallthrough:i,matches:a});if(t.renames)for(const{from:r,to:s,options:n}of t.renames)e=e.rename(r,s,n);return e}},messages:{"object.and":"{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}","object.assert":'{{#label}} is invalid because {if(#subject.key, `"` + #subject.key + `" failed to ` + (#message || "pass the assertion test"), #message || "the assertion failed")}',"object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":'{{#label}} must have {{#limit}} key{if(#limit == 1, "", "s")}',"object.max":'{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, "", "s")}',"object.min":'{{#label}} must have at least {{#limit}} key{if(#limit == 1, "", "s")}',"object.missing":"{{#label}} must contain at least one of {{#peersWithLabels}}","object.nand":"{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}","object.without":"{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}"}}),f.clone=function(e,t){if("object"==typeof e){if(t.nonEnumerables)return r(e,{shallow:!0});const s=Object.create(Object.getPrototypeOf(e));return Object.assign(s,e),s}const s=function(...t){return e.apply(this,t)};return s.prototype=r(e.prototype),Object.defineProperty(s,"name",{value:e.name,writable:!1}),Object.defineProperty(s,"length",{value:e.length,writable:!1}),Object.assign(s,e),s},f.dependency=function(e,r,s,n,o){t(null===s||"string"==typeof s,r,"key must be a strings"),o||(o=n.length>1&&"object"==typeof n[n.length-1]?n.pop():{}),i.assertOptions(o,["separator","isPresent"]),n=[].concat(n);const l=i.default(o.separator,"."),c=[];for(const e of n)t("string"==typeof e,r,"peers must be strings"),c.push(a.ref(e,{separator:l,ancestor:0,prefix:!1}));null!==s&&(s=a.ref(s,{separator:l,ancestor:0,prefix:!1}));const u=e.clone();return u.$_terms.dependencies=u.$_terms.dependencies||[],u.$_terms.dependencies.push(new f.Dependency(r,s,c,n,o)),u},f.dependencies={and(e,t,r,s,n){const i=[],a=[],o=t.peers.length,l=f.isPresent(t.options);for(const e of t.peers)!1===l(e.resolve(r,s,n,null,{shadow:!1}))?i.push(e.key):a.push(e.key);if(i.length!==o&&a.length!==o)return{code:"object.and",context:{present:a,presentWithLabels:f.keysToLabels(e,a),missing:i,missingWithLabels:f.keysToLabels(e,i)}}},nand(e,t,r,s,n){const i=[],a=f.isPresent(t.options);for(const e of t.peers)a(e.resolve(r,s,n,null,{shadow:!1}))&&i.push(e.key);if(i.length!==t.peers.length)return;const o=t.paths[0],l=t.paths.slice(1);return{code:"object.nand",context:{main:o,mainWithLabel:f.keysToLabels(e,o),peers:l,peersWithLabels:f.keysToLabels(e,l)}}},or(e,t,r,s,n){const i=f.isPresent(t.options);for(const e of t.peers)if(i(e.resolve(r,s,n,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)}}},oxor(e,t,r,s,n){const i=[],a=f.isPresent(t.options);for(const e of t.peers)a(e.resolve(r,s,n,null,{shadow:!1}))&&i.push(e.key);if(!i.length||1===i.length)return;const o={peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)};return o.present=i,o.presentWithLabels=f.keysToLabels(e,i),{code:"object.oxor",context:o}},with(e,t,r,s,n){const i=f.isPresent(t.options);for(const a of t.peers)if(!1===i(a.resolve(r,s,n,null,{shadow:!1})))return{code:"object.with",context:{main:t.key.key,mainWithLabel:f.keysToLabels(e,t.key.key),peer:a.key,peerWithLabel:f.keysToLabels(e,a.key)}}},without(e,t,r,s,n){const i=f.isPresent(t.options);for(const a of t.peers)if(i(a.resolve(r,s,n,null,{shadow:!1})))return{code:"object.without",context:{main:t.key.key,mainWithLabel:f.keysToLabels(e,t.key.key),peer:a.key,peerWithLabel:f.keysToLabels(e,a.key)}}},xor(e,t,r,s,n){const i=[],a=f.isPresent(t.options);for(const e of t.peers)a(e.resolve(r,s,n,null,{shadow:!1}))&&i.push(e.key);if(1===i.length)return;const o={peers:t.paths,peersWithLabels:f.keysToLabels(e,t.paths)};return 0===i.length?{code:"object.missing",context:o}:(o.present=i,o.presentWithLabels=f.keysToLabels(e,i),{code:"object.xor",context:o})}},f.keysToLabels=function(e,t){return Array.isArray(t)?t.map((t=>e.$_mapLabels(t))):e.$_mapLabels(t)},f.isPresent=function(e){return"function"==typeof e.isPresent?e.isPresent:e=>void 0!==e},f.rename=function(e,t,r,s,n){const i={};for(const a of e.$_terms.renames){const o=[],l="string"!=typeof a.from;if(l)for(const e in t){if(void 0===t[e]&&a.options.ignoreUndefined)continue;if(e===a.to)continue;const r=a.from.exec(e);r&&o.push({from:e,to:a.to,match:r})}else!Object.prototype.hasOwnProperty.call(t,a.from)||void 0===t[a.from]&&a.options.ignoreUndefined||o.push(a);for(const c of o){const o=c.from;let f=c.to;if(f instanceof u&&(f=f.render(t,r,s,c.match)),o!==f){if(!a.options.multiple&&i[f]&&(n.push(e.$_createError("object.rename.multiple",t,{from:o,to:f,pattern:l},r,s)),s.abortEarly))return!1;if(Object.prototype.hasOwnProperty.call(t,f)&&!a.options.override&&!i[f]&&(n.push(e.$_createError("object.rename.override",t,{from:o,to:f,pattern:l},r,s)),s.abortEarly))return!1;void 0===t[o]?delete t[f]:t[f]=t[o],i[f]=!0,a.options.alias||delete t[o]}}}return!0},f.unknown=function(e,t,r,s,n,a){if(e.$_terms.patterns){let i=!1;const l=e.$_terms.patterns.map((e=>{if(e.matches)return i=!0,[]})),c=[t,...n.ancestors];for(const i of r){const o=t[i],u=[...n.path,i];for(let f=0;f<e.$_terms.patterns.length;++f){const m=e.$_terms.patterns[f];if(m.regex){const e=m.regex.test(i);if(n.mainstay.tracer.debug(n,"rule",`pattern.${f}`,e?"pass":"error"),!e)continue}else if(!m.schema.$_match(i,n.nest(m.schema,`pattern.${f}`),a))continue;r.delete(i);const h=n.localize(u,c,{schema:m.rule,key:i}),d=m.rule.$_validate(o,h,a);if(d.errors){if(a.abortEarly)return{value:t,errors:d.errors};s.push(...d.errors)}if(m.matches&&l[f].push(i),t[i]=d.value,!m.fallthrough)break}}if(i)for(let r=0;r<l.length;++r){const i=l[r];if(!i)continue;const u=e.$_terms.patterns[r].matches,f=n.localize(n.path,c,u),m=u.$_validate(i,f,a);if(m.errors){const r=o.details(m.errors,{override:!1});r.matches=i;const l=e.$_createError("object.pattern.match",t,r,n,a);if(a.abortEarly)return{value:t,errors:l};s.push(l)}}}if(!r.size||!e.$_terms.keys&&!e.$_terms.patterns)return;if(a.stripUnknown&&!e._flags.unknown||a.skipFunctions){const e=!!a.stripUnknown&&(!0===a.stripUnknown||!!a.stripUnknown.objects);for(const s of r)e?(delete t[s],r.delete(s)):"function"==typeof t[s]&&r.delete(s)}if(!i.default(e._flags.unknown,a.allowUnknown))for(const i of r){const r=n.localize([...n.path,i],[]),o=e.$_createError("object.unknown",t[i],{child:i},r,a,{flags:!1});if(a.abortEarly)return{value:t,errors:o};s.push(o)}},f.Dependency=class{constructor(e,t,r,s,n){this.rel=e,this.key=t,this.peers=r,this.paths=s,this.options=n}describe(){const e={rel:this.rel,peers:this.paths};return null!==this.key&&(e.key=this.key.key),"."!==this.peers[0].separator&&(e.options={...e.options,separator:this.peers[0].separator}),this.options.isPresent&&(e.options={...e.options,isPresent:this.options.isPresent}),e}},f.Keys=class extends Array{concat(e){const t=this.slice(),r=new Map;for(let e=0;e<t.length;++e)r.set(t[e].key,e);for(const s of e){const e=s.key,n=r.get(e);void 0!==n?t[n]={key:e,schema:t[n].schema.concat(s.schema)}:t.push(s)}return t}},Qe}function ut(){if(rt)return tt;rt=1;const e=l,t=ct();return tt=t.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(t){return e(Number.isSafeInteger(t)&&t>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:t}})},validate:(e,t,{n:r})=>e.length===r?e:t.error("function.arity",{n:r})},class:{method(){return this.$_addRule("class")},validate:(e,t)=>/^\s*class\s/.test(e.toString())?e:t.error("function.class",{value:e})},minArity:{method(t){return e(Number.isSafeInteger(t)&&t>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:t}})},validate:(e,t,{n:r})=>e.length>=r?e:t.error("function.minArity",{n:r})},maxArity:{method(t){return e(Number.isSafeInteger(t)&&t>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:t}})},validate:(e,t,{n:r})=>e.length<=r?e:t.error("function.maxArity",{n:r})}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})}function ft(){if(nt)return st;nt=1;const e=l,t=Pe(),r=V(),s=z(),n=j(),i={};return st=t.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(e,t)=>e.ref(t),validate(t,{schema:r,state:s,prefs:n}){e(r.$_terms.link,"Uninitialized link schema");const a=i.generate(r,t,s,n),o=r.$_terms.link[0].ref;return a.$_validate(t,s.nest(a,`link:${o.display}:${a.type}`),n)},generate:(e,t,r,s)=>i.generate(e,t,r,s),rules:{ref:{method(t){e(!this.$_terms.link,"Cannot reinitialize schema"),t=s.ref(t),e("value"===t.type||"local"===t.type,"Invalid reference type:",t.type),e("local"===t.type||"root"===t.ancestor||t.ancestor>0,"Link cannot reference itself");const r=this.clone();return r.$_terms.link=[{ref:t}],r}},relative:{method(e=!0){return this.$_setFlag("relative",e)}}},overrides:{concat(t){e(this.$_terms.link,"Uninitialized link schema"),e(r.isSchema(t),"Invalid schema object"),e("link"!==t.type,"Cannot merge type link with another link");const s=this.clone();return s.$_terms.whens||(s.$_terms.whens=[]),s.$_terms.whens.push({concat:t}),s.$_mutateRebuild()}},manifest:{build:(t,r)=>(e(r.link,"Invalid link description missing link"),t.ref(r.link))}}),i.generate=function(e,t,r,s){let n=r.mainstay.links.get(e);if(n)return n._generate(t,r,s).schema;const a=e.$_terms.link[0].ref,{perspective:o,path:l}=i.perspective(a,r);i.assert(o,"which is outside of schema boundaries",a,e,r,s);try{n=l.length?o.$_reach(l):o}catch(t){i.assert(!1,"to non-existing schema",a,e,r,s)}return i.assert("link"!==n.type,"which is another link",a,e,r,s),e._flags.relative||r.mainstay.links.set(e,n),n._generate(t,r,s).schema},i.perspective=function(e,t){if("local"===e.type){for(const{schema:r,key:s}of t.schemas){if((r._flags.id||s)===e.path[0])return{perspective:r,path:e.path.slice(1)};if(r.$_terms.shared)for(const t of r.$_terms.shared)if(t._flags.id===e.path[0])return{perspective:t,path:e.path.slice(1)}}return{perspective:null,path:null}}return"root"===e.ancestor?{perspective:t.schemas[t.schemas.length-1].schema,path:e.path}:{perspective:t.schemas[e.ancestor]&&t.schemas[e.ancestor].schema,path:e.path}},i.assert=function(t,r,s,i,a,o){t||e(!1,`"${n.label(i._flags,a,o)}" contains link reference "${s.display}" ${r}`)},st}function mt(){if(at)return it;at=1;const e=l,t=Pe(),r=V(),s={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/};return it=t.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:t,error:r}){if(!e.match(s.numberRx))return;e=e.trim();const n={value:parseFloat(e)};if(0===n.value&&(n.value=0),!t._flags.unsafe)if(e.match(/e/i)){if(s.extractSignificantDigits(e)!==s.extractSignificantDigits(String(n.value)))return n.errors=r("number.unsafe"),n}else{const t=n.value.toString();if(t.match(/e/i))return n;if(t!==s.normalizeDecimal(e))return n.errors=r("number.unsafe"),n}return n}},validate(e,{schema:t,error:s,prefs:n}){if(e===1/0||e===-1/0)return{value:e,errors:s("number.infinity")};if(!r.isNumber(e))return{value:e,errors:s("number.base")};const i={value:e};if(n.convert){const e=t.$_getRule("precision");if(e){const t=Math.pow(10,e.args.limit);i.value=Math.round(i.value*t)/t}}return 0===i.value&&(i.value=0),!t._flags.unsafe&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)&&(i.errors=s("number.unsafe")),i},rules:{compare:{method:!1,validate:(e,t,{limit:s},{name:n,operator:i,args:a})=>r.compare(e,s,i)?e:t.error("number."+n,{limit:a.limit,value:e}),args:[{name:"limit",ref:!0,assert:r.isNumber,message:"must be a number"}]},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{limit:e},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(e,t)=>Math.trunc(e)-e==0?e:t.error("number.integer")},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{limit:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{limit:e},operator:">="})}},multiple:{method(e){return this.$_addRule({name:"multiple",args:{base:e}})},validate:(e,t,{base:r},s)=>e*(1/r)%1==0?e:t.error("number.multiple",{multiple:s.args.base,value:e}),args:[{name:"base",ref:!0,assert:e=>"number"==typeof e&&isFinite(e)&&e>0,message:"must be a positive number"}],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(e,t)=>Number.isSafeInteger(e)&&e>=0&&e<=65535?e:t.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(t){return e(Number.isSafeInteger(t),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:t}})},validate(e,t,{limit:r}){const n=e.toString().match(s.precisionRx);return Math.max((n[1]?n[1].length:0)-(n[2]?parseInt(n[2],10):0),0)<=r?e:t.error("number.precision",{limit:r,value:e})},convert:!0},sign:{method(t){return e(["negative","positive"].includes(t),"Invalid sign",t),this.$_addRule({name:"sign",args:{sign:t}})},validate:(e,t,{sign:r})=>"negative"===r&&e<0||"positive"===r&&e>0?e:t.error(`number.${r}`)},unsafe:{method(t=!0){return e("boolean"==typeof t,"enabled must be a boolean"),this.$_setFlag("unsafe",t)}}},cast:{string:{from:e=>"number"==typeof e,to:(e,t)=>e.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),s.extractSignificantDigits=function(e){return e.replace(s.exponentialPartRegex,"").replace(s.dotRegex,"").replace(s.trailingZerosRegex,"").replace(s.leadingSignAndZerosRegex,"")},s.normalizeDecimal=function(e){return(e=e.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&e.endsWith("0")&&(e=e.replace(/0+$/,"")),"-0"===e?"0":e},it}function ht(){if(lt)return ot;lt=1;const e=ct();return ot=e.extend({type:"object",cast:{map:{from:e=>e&&"object"==typeof e,to:(e,t)=>new Map(Object.entries(e))}}})}ze.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(e,t){const r=[].concat((t=t||{}).before||[]),s=[].concat(t.after||[]),n=t.group||"?",i=t.sort||0;Ze(!r.includes(n),`Item cannot come before itself: ${n}`),Ze(!r.includes("?"),"Item cannot come before unassociated items"),Ze(!s.includes(n),`Item cannot come after itself: ${n}`),Ze(!s.includes("?"),"Item cannot come after unassociated items"),Array.isArray(e)||(e=[e]);for(const t of e){const e={seq:this._items.length,sort:i,before:r,after:s,group:n,node:t};this._items.push(e)}if(!t.manual){const e=this._sort();Ze(e,"item","?"!==n?`added into group ${n}`:"","created a dependencies error")}return this.nodes}merge(e){Array.isArray(e)||(e=[e]);for(const t of e)if(t)for(const e of t._items)this._items.push(Object.assign({},e));this._items.sort(Je.mergeSort);for(let e=0;e<this._items.length;++e)this._items[e].seq=e;const t=this._sort();return Ze(t,"merge created a dependencies error"),this.nodes}sort(){const e=this._sort();return Ze(e,"sort created a dependencies error"),this.nodes}_sort(){const e={},t=Object.create(null),r=Object.create(null);for(const s of this._items){const n=s.seq,i=s.group;r[i]=r[i]||[],r[i].push(n),e[n]=s.before;for(const e of s.after)t[e]=t[e]||[],t[e].push(n)}for(const t in e){const s=[];for(const n in e[t]){const i=e[t][n];r[i]=r[i]||[],s.push(...r[i])}e[t]=s}for(const s in t)if(r[s])for(const n of r[s])e[n].push(...t[s]);const s={};for(const t in e){const r=e[t];for(const e of r)s[e]=s[e]||[],s[e].push(t)}const n={},i=[];for(let e=0;e<this._items.length;++e){let t=e;if(s[e]){t=null;for(let e=0;e<this._items.length;++e){if(!0===n[e])continue;s[e]||(s[e]=[]);const r=s[e].length;let i=0;for(let t=0;t<r;++t)n[s[e][t]]&&++i;if(i===r){t=e;break}}}null!==t&&(n[t]=!0,i.push(t))}if(i.length!==this._items.length)return!1;const a={};for(const e of this._items)a[e.seq]=e;this._items=[],this.nodes=[];for(const e of i){const t=a[e];this.nodes.push(t.node),this._items.push(t)}return!0}},Je.mergeSort=(e,t)=>e.sort===t.sort?0:e.sort<t.sort?-1:1;var dt,pt={},gt={};(dt=gt).codes={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"},dt.code=function(e){return{code:e,error:dt.codes[e]}},function(t){const r=gt,s={minDomainSegments:2,nonAsciiRx:/[^\x00-\x7f]/,domainControlRx:/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,tldSegmentRx:/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,URL:e.URL||URL};t.analyze=function(e,t={}){if(!e)return r.code("DOMAIN_NON_EMPTY_STRING");if("string"!=typeof e)throw new Error("Invalid input: domain must be a string");if(e.length>256)return r.code("DOMAIN_TOO_LONG");if(!!s.nonAsciiRx.test(e)){if(!1===t.allowUnicode)return r.code("DOMAIN_INVALID_UNICODE_CHARS");e=e.normalize("NFC")}if(s.domainControlRx.test(e))return r.code("DOMAIN_INVALID_CHARS");e=s.punycode(e),t.allowFullyQualified&&"."===e[e.length-1]&&(e=e.slice(0,-1));const n=t.minDomainSegments||s.minDomainSegments,i=e.split(".");if(i.length<n)return r.code("DOMAIN_SEGMENTS_COUNT");if(t.maxDomainSegments&&i.length>t.maxDomainSegments)return r.code("DOMAIN_SEGMENTS_COUNT_MAX");const a=t.tlds;if(a){const e=i[i.length-1].toLowerCase();if(a.deny&&a.deny.has(e)||a.allow&&!a.allow.has(e))return r.code("DOMAIN_FORBIDDEN_TLDS")}for(let e=0;e<i.length;++e){const t=i[e];if(!t.length)return r.code("DOMAIN_EMPTY_SEGMENT");if(t.length>63)return r.code("DOMAIN_LONG_SEGMENT");if(e<i.length-1){if(!s.domainSegmentRx.test(t))return r.code("DOMAIN_INVALID_CHARS")}else if(!s.tldSegmentRx.test(t))return r.code("DOMAIN_INVALID_TLDS_CHARS")}return null},t.isValid=function(e,r){return!t.analyze(e,r)},s.punycode=function(e){e.includes("%")&&(e=e.replace(/%/g,"%25"));try{return new s.URL(`http://${e}`).host}catch(t){return e}}}(pt);var yt={};const bt=pt,vt=gt,_t={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(t.TextEncoder||TextEncoder)};yt.analyze=function(e,t){return _t.email(e,t)},yt.isValid=function(e,t){return!_t.email(e,t)},_t.email=function(e,t={}){if("string"!=typeof e)throw new Error("Invalid input: email must be a string");if(!e)return vt.code("EMPTY_STRING");const r=!_t.nonAsciiRx.test(e);if(!r){if(!1===t.allowUnicode)return vt.code("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const s=e.split("@");if(2!==s.length)return s.length>2?vt.code("MULTIPLE_AT_CHAR"):vt.code("MISSING_AT_CHAR");const[n,i]=s;if(!n)return vt.code("EMPTY_LOCAL");if(!t.ignoreLength){if(e.length>254)return vt.code("ADDRESS_TOO_LONG");if(_t.encoder.encode(n).length>64)return vt.code("LOCAL_TOO_LONG")}return _t.local(n,r)||bt.analyze(i,t)},_t.local=function(e,t){const r=e.split(".");for(const e of r){if(!e.length)return vt.code("EMPTY_LOCAL_SEGMENT");if(t){if(!_t.atextRx.test(e))return vt.code("INVALID_LOCAL_CHARS")}else for(const t of e){if(_t.atextRx.test(t))continue;const e=_t.binary(t);if(!_t.atomRx.test(e))return vt.code("INVALID_LOCAL_CHARS")}}},_t.binary=function(e){return Array.from(_t.encoder.encode(e)).map((e=>String.fromCharCode(e))).join("")},_t.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,_t.atomRx=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"));var At={},Et={},St=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")};const Rt=l,Ot=St,Nt={generate:function(){const e={},t="\\dA-Fa-f",r="["+t+"]",s="\\w-\\.~",n="!\\$&'\\(\\)\\*\\+,;=",i="%"+t,a=s+i+n+":@",o="["+a+"]",l="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";e.ipv4address="(?:"+l+"\\.){3}"+l;const c=r+"{1,4}",u="(?:"+c+":"+c+"|"+e.ipv4address+")",f="(?:"+c+":){6}"+u,m="::(?:"+c+":){5}"+u,h="(?:"+c+")?::(?:"+c+":){4}"+u,d="(?:(?:"+c+":){0,1}"+c+")?::(?:"+c+":){3}"+u,p="(?:(?:"+c+":){0,2}"+c+")?::(?:"+c+":){2}"+u,g="(?:(?:"+c+":){0,3}"+c+")?::"+c+":"+u,y="(?:(?:"+c+":){0,4}"+c+")?::"+u,b="(?:(?:"+c+":){0,5}"+c+")?::"+c,v="(?:(?:"+c+":){0,6}"+c+")?::";e.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",e.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",e.ipv6address="(?:"+f+"|"+m+"|"+h+"|"+d+"|"+p+"|"+g+"|"+y+"|"+b+"|"+v+")",e.ipvFuture="v"+r+"+\\.["+s+n+":]+",e.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",e.schemeRegex=new RegExp(e.scheme);const _="["+s+i+n+":]*",A="["+s+i+n+"]{1,255}",E="(?:"+("\\[(?:"+e.ipv6address+"|"+e.ipvFuture+")\\]")+"|"+e.ipv4address+"|"+A+")",S="(?:"+_+"@)?"+E+"(?::\\d*)?",R="(?:"+_+"@)?("+E+")(?::\\d*)?",O=o+"*",N=o+"+",I="(?:\\/"+O+")*",w="\\/(?:"+N+I+")?",$=N+I,T="["+s+i+n+"@]+"+I,C="(?:\\/\\/\\/"+O+I+")";return e.hierPart="(?:(?:\\/\\/"+S+I+")|"+w+"|"+$+"|"+C+")",e.hierPartCapture="(?:(?:\\/\\/"+R+I+")|"+w+"|"+$+")",e.relativeRef="(?:(?:\\/\\/"+S+I+")|"+w+"|"+T+"|)",e.relativeRefCapture="(?:(?:\\/\\/"+R+I+")|"+w+"|"+T+"|)",e.query="["+a+"\\/\\?]*(?=#|$)",e.queryWithSquareBrackets="["+a+"\\[\\]\\/\\?]*(?=#|$)",e.fragment="["+a+"\\/\\?]*",e}};Nt.rfc3986=Nt.generate(),Et.ip={v4Cidr:Nt.rfc3986.ipv4Cidr,v6Cidr:Nt.rfc3986.ipv6Cidr,ipv4:Nt.rfc3986.ipv4address,ipv6:Nt.rfc3986.ipv6address,ipvfuture:Nt.rfc3986.ipvFuture},Nt.createRegex=function(e){const t=Nt.rfc3986,r="(?:\\?"+(e.allowQuerySquareBrackets?t.queryWithSquareBrackets:t.query)+")?(?:#"+t.fragment+")?",s=e.domain?t.relativeRefCapture:t.relativeRef;if(e.relativeOnly)return Nt.wrap(s+r);let n="";if(e.scheme){Rt(e.scheme instanceof RegExp||"string"==typeof e.scheme||Array.isArray(e.scheme),"scheme must be a RegExp, String, or Array");const r=[].concat(e.scheme);Rt(r.length>=1,"scheme must have at least 1 scheme specified");const s=[];for(let e=0;e<r.length;++e){const n=r[e];Rt(n instanceof RegExp||"string"==typeof n,"scheme at position "+e+" must be a RegExp or String"),n instanceof RegExp?s.push(n.source.toString()):(Rt(t.schemeRegex.test(n),"scheme at position "+e+" must be a valid scheme"),s.push(Ot(n)))}n=s.join("|")}const i="(?:"+(n?"(?:"+n+")":t.scheme)+":"+(e.domain?t.hierPartCapture:t.hierPart)+")",a=e.allowRelative?"(?:"+i+"|"+s+")":i;return Nt.wrap(a+r,n)},Nt.wrap=function(e,t){return{raw:e=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${e}`,regex:new RegExp(`^${e}$`),scheme:t}},Nt.uriRegex=Nt.createRegex({}),Et.regex=function(e={}){return e.scheme||e.allowRelative||e.relativeOnly||e.allowQuerySquareBrackets||e.domain?Nt.createRegex(e):Nt.uriRegex};const It=l,wt=Et;At.regex=function(e={}){It(void 0===e.cidr||"string"==typeof e.cidr,"options.cidr must be a string");const t=e.cidr?e.cidr.toLowerCase():"optional";It(["required","optional","forbidden"].includes(t),"options.cidr must be one of required, optional, forbidden"),It(void 0===e.version||"string"==typeof e.version||Array.isArray(e.version),"options.version must be a string or an array of string");let r=e.version||["ipv4","ipv6","ipvfuture"];Array.isArray(r)||(r=[r]),It(r.length>=1,"options.version must have at least 1 version specified");for(let e=0;e<r.length;++e)It("string"==typeof r[e],"options.version must only contain strings"),r[e]=r[e].toLowerCase(),It(["ipv4","ipv6","ipvfuture"].includes(r[e]),"options.version contains unknown version "+r[e]+" - must be one of ipv4, ipv6, ipvfuture");r=Array.from(new Set(r));const s=r.map((e=>{if("forbidden"===t)return wt.ip[e];const r=`\\/${"ipv4"===e?wt.ip.v4Cidr:wt.ip.v6Cidr}`;return"required"===t?`${wt.ip[e]}${r}`:`${wt.ip[e]}(?:${r})?`})),n=`(?:${s.join("|")})`,i=new RegExp(`^${n}$`);return{cidr:t,versions:r,regex:i,raw:n}};const $t={tlds:["AAA","AARP","ABARTH","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADAC","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALFAROMEO","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BANANAREPUBLIC","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUGATTI","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANCERRESEARCH","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CBS","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CITYEATS","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMMBANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOKINGCHANNEL","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","ETISALAT","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIAT","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOODNETWORK","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTDOOR","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HGTV","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELES","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIM","KINDER","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LANCIA","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINDE","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOFT","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MACYS","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARSHALLS","MASERATI","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MUTUAL","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTHWESTERNMUTUAL","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLDNAVY","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PASSAGENS","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCHER","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCA","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SHOWTIME","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SOCIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIFFANY","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELCHANNEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLKSWAGEN","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","VUELOS","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JLQ61U9W7B","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAKC7DVF","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"]};var Tt,Ct,Lt,xt,Dt,Mt,jt,Bt,kt=new Set($t.tlds.map((e=>e.toLowerCase())));function Pt(){if(Ct)return Tt;Ct=1;const e=l,t=pt,r=yt,s=At,n=St,i=kt,a=Et,o=Pe(),c=V(),u={tlds:i instanceof Set&&{tlds:{allow:i,deny:null}},base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:/^[a-f0-9]+$/i,ipRegex:s.regex({cidr:"forbidden"}).regex,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};return Tt=o.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(e,{schema:t,state:r,prefs:s}){const n=t.$_getRule("normalize");n&&(e=e.normalize(n.args.form));const i=t.$_getRule("case");i&&(e="upper"===i.args.direction?e.toLocaleUpperCase():e.toLocaleLowerCase());const a=t.$_getRule("trim");if(a&&a.args.enabled&&(e=e.trim()),t.$_terms.replacements)for(const r of t.$_terms.replacements)e=e.replace(r.pattern,r.replacement);const o=t.$_getRule("hex");if(o&&o.args.options.byteAligned&&e.length%2!=0&&(e=`0${e}`),t.$_getRule("isoDate")){const t=u.isoDate(e);t&&(e=t)}if(t._flags.truncate){const n=t.$_getRule("max");if(n){let i=n.args.limit;if(c.isResolvable(i)&&(i=i.resolve(e,r,s),!c.limit(i)))return{value:e,errors:t.$_createError("any.ref",i,{ref:n.args.limit,arg:"limit",reason:"must be a positive integer"},r,s)};e=e.slice(0,i)}}return{value:e}}},validate(e,{schema:t,error:r}){if("string"!=typeof e)return{value:e,errors:r("string.base")};if(""===e){const s=t.$_getRule("min");if(s&&0===s.args.limit)return;return{value:e,errors:r("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(e,t)=>/^[a-zA-Z0-9]+$/.test(e)?e:t.error("string.alphanum")},base64:{method(t={}){return c.assertOptions(t,["paddingRequired","urlSafe"]),t={urlSafe:!1,paddingRequired:!0,...t},e("boolean"==typeof t.paddingRequired,"paddingRequired must be boolean"),e("boolean"==typeof t.urlSafe,"urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:t}})},validate:(e,t,{options:r})=>u.base64Regex[r.paddingRequired][r.urlSafe].test(e)?e:t.error("string.base64")},case:{method(t){return e(["lower","upper"].includes(t),"Invalid case:",t),this.$_addRule({name:"case",args:{direction:t}})},validate:(e,t,{direction:r})=>"lower"===r&&e===e.toLocaleLowerCase()||"upper"===r&&e===e.toLocaleUpperCase()?e:t.error(`string.${r}case`),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(e,t){let r=e.length,s=0,n=1;for(;r--;){const t=e.charAt(r)*n;s+=t-9*(t>9),n^=3}return s>0&&s%10==0?e:t.error("string.creditCard")}},dataUri:{method(t={}){return c.assertOptions(t,["paddingRequired"]),t={paddingRequired:!0,...t},e("boolean"==typeof t.paddingRequired,"paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:t}})},validate(e,t,{options:r}){const s=e.match(u.dataUriRegex);if(s){if(!s[2])return e;if("base64"!==s[2])return e;if(u.base64Regex[r.paddingRequired].false.test(s[3]))return e}return t.error("string.dataUri")}},domain:{method(e){e&&c.assertOptions(e,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const t=u.addressOptions(e);return this.$_addRule({name:"domain",args:{options:e},address:t})},validate:(e,r,s,{address:n})=>t.isValid(e,n)?e:r.error("string.domain")},email:{method(t={}){c.assertOptions(t,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),e(void 0===t.multiple||"boolean"==typeof t.multiple,"multiple option must be an boolean");const r=u.addressOptions(t),s=new RegExp(`\\s*[${t.separator?n(t.separator):","}]\\s*`);return this.$_addRule({name:"email",args:{options:t},regex:s,address:r})},validate(e,t,{options:s},{regex:n,address:i}){const a=s.multiple?e.split(n):[e],o=[];for(const e of a)r.isValid(e,i)||o.push(e);return o.length?t.error("string.email",{value:e,invalids:o}):e}},guid:{alias:"uuid",method(t={}){c.assertOptions(t,["version","separator"]);let r="";if(t.version){const s=[].concat(t.version);e(s.length>=1,"version must have at least 1 valid version specified");const n=new Set;for(let t=0;t<s.length;++t){const i=s[t];e("string"==typeof i,"version at position "+t+" must be a string");const a=u.guidVersions[i.toLowerCase()];e(a,"version at position "+t+" must be one of "+Object.keys(u.guidVersions).join(", ")),e(!n.has(a),"version at position "+t+" must not be a duplicate"),r+=a,n.add(a)}}e(u.guidSeparators.has(t.separator),'separator must be one of true, false, "-", or ":"');const s=void 0===t.separator?"[:-]?":!0===t.separator?"[:-]":!1===t.separator?"[]?":`\\${t.separator}`,n=new RegExp(`^([\\[{\\(]?)[0-9A-F]{8}(${s})[0-9A-F]{4}\\2?[${r||"0-9A-F"}][0-9A-F]{3}\\2?[${r?"89AB":"0-9A-F"}][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$`,"i");return this.$_addRule({name:"guid",args:{options:t},regex:n})},validate(e,t,r,{regex:s}){const n=s.exec(e);return n?u.guidBrackets[n[1]]!==n[n.length-1]?t.error("string.guid"):e:t.error("string.guid")}},hex:{method(t={}){return c.assertOptions(t,["byteAligned"]),t={byteAligned:!1,...t},e("boolean"==typeof t.byteAligned,"byteAligned must be boolean"),this.$_addRule({name:"hex",args:{options:t}})},validate:(e,t,{options:r})=>u.hexRegex.test(e)?r.byteAligned&&e.length%2!=0?t.error("string.hexAlign"):e:t.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(e,r)=>t.isValid(e,{minDomainSegments:1})||u.ipRegex.test(e)?e:r.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(e={}){c.assertOptions(e,["cidr","version"]);const{cidr:t,versions:r,regex:n}=s.regex(e),i=e.version?r:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:t,version:i}},regex:n})},validate:(e,t,{options:r},{regex:s})=>s.test(e)?e:r.version?t.error("string.ipVersion",{value:e,cidr:r.cidr,version:r.version}):t.error("string.ip",{value:e,cidr:r.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(e,{error:t})=>u.isoDate(e)?e:t("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(e,t)=>u.isoDurationRegex.test(e)?e:t.error("string.isoDuration")},length:{method(e,t){return u.length(this,"length",e,"=",t)},validate(e,t,{limit:r,encoding:s},{name:n,operator:i,args:a}){const o=s?Buffer&&Buffer.byteLength(e,s):e.length;return c.compare(o,r,i)?e:t.error("string."+n,{limit:a.limit,value:e,encoding:s})},args:[{name:"limit",ref:!0,assert:c.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(e,t){return u.length(this,"max",e,"<=",t)},args:["limit","encoding"]},min:{method(e,t){return u.length(this,"min",e,">=",t)},args:["limit","encoding"]},normalize:{method(t="NFC"){return e(u.normalizationForms.includes(t),"normalization form must be one of "+u.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:t}})},validate:(e,{error:t},{form:r})=>e===e.normalize(r)?e:t("string.normalize",{value:e,form:r}),convert:!0},pattern:{alias:"regex",method(t,r={}){e(t instanceof RegExp,"regex must be a RegExp"),e(!t.flags.includes("g")&&!t.flags.includes("y"),"regex should not use global or sticky mode"),"string"==typeof r&&(r={name:r}),c.assertOptions(r,["invert","name"]);const s=["string.pattern",r.invert?".invert":"",r.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:t,options:r},errorCode:s})},validate:(e,t,{regex:r,options:s},{errorCode:n})=>r.test(e)^s.invert?e:t.error(n,{name:s.name,regex:r,value:e}),args:["regex","options"],multi:!0},replace:{method(t,r){"string"==typeof t&&(t=new RegExp(n(t),"g")),e(t instanceof RegExp,"pattern must be a RegExp"),e("string"==typeof r,"replacement must be a String");const s=this.clone();return s.$_terms.replacements||(s.$_terms.replacements=[]),s.$_terms.replacements.push({pattern:t,replacement:r}),s}},token:{method(){return this.$_addRule("token")},validate:(e,t)=>/^\w+$/.test(e)?e:t.error("string.token")},trim:{method(t=!0){return e("boolean"==typeof t,"enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:t}})},validate:(e,t,{enabled:r})=>r&&e!==e.trim()?t.error("string.trim"):e,convert:!0},truncate:{method(t=!0){return e("boolean"==typeof t,"enabled must be a boolean"),this.$_setFlag("truncate",t)}},uppercase:{method(){return this.case("upper")}},uri:{method(e={}){c.assertOptions(e,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme"]),e.domain&&c.assertOptions(e.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:t,scheme:r}=a.regex(e),s=e.domain?u.addressOptions(e.domain):null;return this.$_addRule({name:"uri",args:{options:e},regex:t,domain:s,scheme:r})},validate(e,r,{options:s},{regex:n,domain:i,scheme:a}){if(["http:/","https:/"].includes(e))return r.error("string.uri");const o=n.exec(e);if(o){const n=o[1]||o[2];return!i||s.allowRelative&&!n||t.isValid(n,i)?e:r.error("string.domain",{value:n})}return s.relativeOnly?r.error("string.uriRelativeOnly"):s.scheme?r.error("string.uriCustomScheme",{scheme:a,value:e}):r.error("string.uri")}}},manifest:{build(e,t){if(t.replacements)for(const{pattern:r,replacement:s}of t.replacements)e=e.replace(r,s);return e}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.domain":"{{#label}} must contain a valid domain name","string.email":"{{#label}} must be a valid email","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.ip":"{{#label}} must be a valid ip address with a {{#cidr}} CIDR","string.ipVersion":"{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:[.]} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:[.]} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uri":"{{#label}} must be a valid uri","string.uriCustomScheme":"{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern","string.uriRelativeOnly":"{{#label}} must be a valid relative uri","string.uppercase":"{{#label}} must only contain uppercase characters"}}),u.addressOptions=function(t){if(!t)return t;if(e(void 0===t.minDomainSegments||Number.isSafeInteger(t.minDomainSegments)&&t.minDomainSegments>0,"minDomainSegments must be a positive integer"),e(void 0===t.maxDomainSegments||Number.isSafeInteger(t.maxDomainSegments)&&t.maxDomainSegments>0,"maxDomainSegments must be a positive integer"),!1===t.tlds)return t;if(!0===t.tlds||void 0===t.tlds)return e(u.tlds,"Built-in TLD list disabled"),Object.assign({},t,u.tlds);e("object"==typeof t.tlds,"tlds must be true, false, or an object");const r=t.tlds.deny;if(r)return Array.isArray(r)&&(t=Object.assign({},t,{tlds:{deny:new Set(r)}})),e(t.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),e(!t.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),u.validateTlds(t.tlds.deny,"tlds.deny"),t;const s=t.tlds.allow;return s?!0===s?(e(u.tlds,"Built-in TLD list disabled"),Object.assign({},t,u.tlds)):(Array.isArray(s)&&(t=Object.assign({},t,{tlds:{allow:new Set(s)}})),e(t.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),u.validateTlds(t.tlds.allow,"tlds.allow"),t):t},u.validateTlds=function(r,s){for(const n of r)e(t.isValid(n,{minDomainSegments:1,maxDomainSegments:1}),`${s} must contain valid top level domain names`)},u.isoDate=function(e){if(!c.isIsoDate(e))return null;/.*T.*[+-]\d\d$/.test(e)&&(e+="00");const t=new Date(e);return isNaN(t.getTime())?null:t.toISOString()},u.length=function(t,r,s,n,i){return e(!i||Buffer&&Buffer.isEncoding(i),"Invalid encoding:",i),t.$_addRule({name:r,method:"length",args:{limit:s,encoding:i},operator:n})},Tt}function Ut(){if(xt)return Lt;xt=1;const e=l,t=Pe(),r={};return r.Map=class extends Map{slice(){return new r.Map(this)}},Lt=t.extend({type:"symbol",terms:{map:{init:new r.Map}},coerce:{method(e,{schema:t,error:r}){const s=t.$_terms.map.get(e);return s&&(e=s),t._flags.only&&"symbol"!=typeof e?{value:e,errors:r("symbol.map",{map:t.$_terms.map})}:{value:e}}},validate(e,{error:t}){if("symbol"!=typeof e)return{value:e,errors:t("symbol.base")}},rules:{map:{method(t){t&&!t[Symbol.iterator]&&"object"==typeof t&&(t=Object.entries(t)),e(t&&t[Symbol.iterator],"Iterable must be an iterable or object");const r=this.clone(),s=[];for(const n of t){e(n&&n[Symbol.iterator],"Entry must be an iterable");const[t,i]=n;e("object"!=typeof t&&"function"!=typeof t&&"symbol"!=typeof t,"Key must not be of type object, function, or Symbol"),e("symbol"==typeof i,"Value must be a Symbol"),r.$_terms.map.set(t,i),s.push(i)}return r.valid(...s)}}},manifest:{build:(e,t)=>(t.map&&(e=e.map(t.map)),e)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}}),Lt}function Gt(){if(Bt)return jt;Bt=1;const e=l,t=v,r=Y(),s=V(),n=z(),i=j(),a=Q(),o=re(),c=H(),u=X(),f=ce();let m;const h={types:{alternatives:Ue(),any:Pe(),array:Ge(),boolean:Fe(),date:He(),function:ut(),link:ft(),number:mt(),object:ht(),string:Pt(),symbol:Ut()},aliases:{alt:"alternatives",bool:"boolean",func:"function"}};return Buffer&&(h.types.binary=function(){if(Mt)return Dt;Mt=1;const e=l,t=Pe(),r=V();return Dt=t.extend({type:"binary",coerce:{from:"string",method(e,{schema:t}){try{return{value:Buffer.from(e,t._flags.encoding)}}catch(e){}}},validate(e,{error:t}){if(!Buffer.isBuffer(e))return{value:e,errors:t("binary.base")}},rules:{encoding:{method(t){return e(Buffer.isEncoding(t),"Invalid encoding:",t),this.$_setFlag("encoding",t)}},length:{method(e){return this.$_addRule({name:"length",method:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:s},{name:n,operator:i,args:a})=>r.compare(e.length,s,i)?e:t.error("binary."+n,{limit:a.limit,value:e}),args:[{name:"limit",ref:!0,assert:r.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}}},cast:{string:{from:e=>Buffer.isBuffer(e),to:(e,t)=>e.toString()}},messages:{"binary.base":"{{#label}} must be a buffer or a string","binary.length":"{{#label}} must be {{#limit}} bytes","binary.max":"{{#label}} must be less than or equal to {{#limit}} bytes","binary.min":"{{#label}} must be at least {{#limit}} bytes"}}),Dt}()),h.root=function(){const t={_types:new Set(Object.keys(h.types))};for(const r of t._types)t[r]=function(...t){return e(!t.length||["alternatives","link","object"].includes(r),"The",r,"type does not allow arguments"),h.generate(this,h.types[r],t)};for(const e of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])t[e]=function(...t){return this.any()[e](...t)};Object.assign(t,h.methods);for(const e in h.aliases){const r=h.aliases[e];t[e]=t[r]}return t.x=t.expression,f.setup&&f.setup(t),t},h.methods={ValidationError:i.ValidationError,version:s.version,cache:r.provider,assert(e,t,...r){h.assert(e,t,!0,r)},attempt:(e,t,...r)=>h.assert(e,t,!1,r),build(t){return e("function"==typeof o.build,"Manifest functionality disabled"),o.build(this,t)},checkPreferences(e){s.checkPreferences(e)},compile(e,t){return n.compile(this,e,t)},defaults(t){e("function"==typeof t,"modifier must be a function");const r=Object.assign({},this);for(const n of r._types){const i=t(r[n]());e(s.isSchema(i),"modifier must return a valid schema object"),r[n]=function(...e){return h.generate(this,i,e)}}return r},expression:(...e)=>new u(...e),extend(...t){s.verifyFlat(t,"extend"),m=m||O(),e(t.length,"You need to provide at least one extension"),this.assert(t,m.extensions);const r=Object.assign({},this);r._types=new Set(r._types);for(let s of t){"function"==typeof s&&(s=s(r)),this.assert(s,m.extension);const t=h.expandExtension(s,r);for(const s of t){e(void 0===r[s.type]||r._types.has(s.type),"Cannot override name",s.type);const t=s.base||this.any(),n=a.type(t,s);r._types.add(s.type),r[s.type]=function(...e){return h.generate(this,n,e)}}}return r},isError:i.ValidationError.isError,isExpression:u.isTemplate,isRef:c.isRef,isSchema:s.isSchema,in:(...e)=>c.in(...e),override:s.symbols.override,ref:(...e)=>c.create(...e),types(){const e={};for(const t of this._types)e[t]=this[t]();for(const t in h.aliases)e[t]=this[t]();return e}},h.assert=function(e,r,n,a){const o=a[0]instanceof Error||"string"==typeof a[0]?a[0]:null,l=null!==o?a[1]:a[0],c=r.validate(e,s.preferences({errors:{stack:!0}},l||{}));let u=c.error;if(!u)return c.value;if(o instanceof Error)throw o;const f=n&&"function"==typeof u.annotate?u.annotate():u.message;throw u instanceof i.ValidationError==!1&&(u=t(u)),u.message=o?`${o} ${f}`:f,u},h.generate=function(t,r,s){return e(t,"Must be invoked on a Joi instance."),r.$_root=t,r._definition.args&&s.length?r._definition.args(r,...s):r},h.expandExtension=function(e,t){if("string"==typeof e.type)return[e];const r=[];for(const s of t._types)if(e.type.test(s)){const n=Object.assign({},e);n.type=s,n.base=t[s](),r.push(n)}return r},jt=h.root()}var Ft=s(Gt());Ft.extend({type:"string",base:Ft.string(),messages:{"string.contains":"{{#label}} must contain [{{#substring}}]","string.ncontains":"{{#label}} can't contain [{{#substring}}]"},rules:{contains:{args:[{name:"substring",ref:!0,assert:e=>"string"==typeof e,message:"must be a string"}],method(e){return this.$_addRule({name:"contains",args:{substring:e}})},validate:(e,t,{substring:r})=>!1===e.includes(r)?t.error("string.contains",{substring:r}):e},ncontains:{args:[{name:"substring",ref:!0,assert:e=>"string"==typeof e,message:"must be a string"}],method(e){return this.$_addRule({name:"ncontains",args:{substring:e}})},validate:(e,t,{substring:r})=>!0===e.includes(r)?t.error("string.ncontains",{substring:r}):e}}});const{findWorkspaceDir:Ht}=require("@pnpm/find-workspace-dir"),Xt=require("js-yaml"),Kt=require("path"),Vt=require("fs"),Yt=()=>process.cwd();let Wt;async function qt(e,t){if(Wt)return JSON.parse(Wt);const{SpecificationService:r}=e,s=new r({accountability:{admin:!0},schema:t});return Wt=JSON.stringify(await s.oas.generate()),JSON.parse(Wt)}function zt(e,t){return Object.entries(t).reduce(((e,[t,r])=>(e[t]=r&&"object"==typeof r?zt(e[t]=e[t]||(Array.isArray(r)?[]:{}),r):r,e)),e)}const Zt=require("swagger-ui-express"),Jt=require("express-openapi-validator"),Qt=function(){const e=function(){const e={docsPath:"api-docs",info:{},tags:[],publishedTags:[],paths:{},components:{}};try{const t=Kt.join(Yt(),"./extensions/endpoints/oasconfig.yaml"),r=Xt.load(Vt.readFileSync(t,{encoding:"utf-8"}));return r.docsPath=r.docsPath||e.docsPath,r.info=r.info||e.info,r.tags=r.tags||e.tags,r.paths=r.paths||e.paths,r.components=r.components||e.components,r}catch{return e}}();try{const t=Kt.join(Yt(),"./extensions/endpoints"),r=Vt.readdirSync(t,{withFileTypes:!0});for(const s of r){const r=`${t}/${s.name}/oas.yaml`;if(s.isDirectory()&&Vt.existsSync(r)){const t=Xt.load(Vt.readFileSync(r,{encoding:"utf-8"}));e.tags=[...e.tags,...t.tags||[]],e.paths={...e.paths,...t.paths||{}},e.components=zt(e.components||{},t.components||{})}}return e}catch(t){return e}}(),er=Qt.docsPath;var tr={id:er,validate:async function(e,t,r,s){if(null==Qt?void 0:Qt.paths){const n=await qt(t,r);if(s)for(const e of s)n.paths[e]=Qt.paths[e];else n.paths=Qt.paths;Qt.components?n.components=Qt.components:(delete n.components.definitions,delete n.components.schemas),e.use(Jt.middleware({apiSpec:n})),e.use(((e,t,r,s)=>{r.status(e.status||500).json({message:e.message,errors:e.errors})}))}return e},handler:(e,{services:t,logger:r,getSchema:s})=>{const n={swaggerOptions:{url:`/${er}/oas`}};e.use("/",Zt.serve),e.get("/",Zt.setup({},n)),e.get("/oas",(async(e,n,i)=>{var a;try{const e=await s(),i=await qt(t,e),o=await async function(){try{const e=await Ht(".");return require(`${e||Yt()}/package.json`)}catch(e){return{}}}();i.info.title=Qt.info.title||(null==o?void 0:o.name)||i.info.title,i.info.version=Qt.info.version||(null==o?void 0:o.version)||i.info.version,i.info.description=Qt.info.description||(null==o?void 0:o.description)||i.info.description;try{for(const e in Qt.paths)i.paths[e]=Qt.paths[e];for(const e of Qt.tags)i.tags.push(e);i.components=zt(Qt.components,i.components)}catch(e){r.info("No custom definitions")}(null==(a=Qt.publishedTags)?void 0:a.length)&&function(e,t){for(const r in t.paths)for(const s in t.paths[r]){let n=!1;const i=t.paths[r][s].tags||[];i.forEach((t=>{n=n||e.publishedTags.includes(t)})),t.paths[r][s].tags=i.filter((t=>e.publishedTags.includes(t))),n||delete t.paths[r][s]}t.tags=t.tags.filter((t=>e.publishedTags.includes(t.name)))}(Qt,i),n.json(i)}catch(e){return i(new Error(e.message||e[0].message))}}))}};module.exports=tr;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "directus-extension-api-docs",
3
- "version": "1.7.2",
3
+ "version": "1.7.4",
4
4
  "description": "directus extension for swagger interface and custom endpoints definitions",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -39,22 +39,22 @@
39
39
  "swagger-ui-express": "^4.6.3"
40
40
  },
41
41
  "devDependencies": {
42
- "@directus/extensions-sdk": "^10.1.7",
42
+ "@directus/extensions-sdk": "^10.1.11",
43
43
  "@directus/shared": "^9.24.0",
44
- "@types/express": "^4.17.17",
45
- "@types/jest": "^29.5.3",
46
- "@types/node": "^18.17.3",
44
+ "@types/express": "^4.17.18",
45
+ "@types/jest": "^29.5.5",
46
+ "@types/node": "^18.18.0",
47
47
  "@typescript-eslint/eslint-plugin": "^5.62.0",
48
48
  "@typescript-eslint/parser": "^5.62.0",
49
- "eslint": "^8.46.0",
49
+ "eslint": "^8.50.0",
50
50
  "eslint-config-prettier": "^8.10.0",
51
- "eslint-plugin-import": "^2.28.0",
51
+ "eslint-plugin-import": "^2.28.1",
52
52
  "eslint-plugin-prettier": "^4.2.1",
53
53
  "express": "^4.18.2",
54
- "jest": "^29.6.2",
54
+ "jest": "^29.7.0",
55
55
  "jest-extended": "^3.2.4",
56
56
  "openapi-schema-validator": "^12.1.3",
57
- "pino": "^8.15.0",
57
+ "pino": "^8.15.1",
58
58
  "prettier": "^2.8.8",
59
59
  "ts-jest": "^29.1.1",
60
60
  "ts-node": "^10.9.1",