From e8d172dfee63dc20c5ad962c2d724d8eb7d58ecf Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Sun, 10 Jul 2022 21:48:35 -0500 Subject: [PATCH 1/8] Add next.config.js validation with ajv --- errors/invalid-next-config.md | 13 + errors/manifest.json | 4 + packages/next/compiled/ajv-keywords/LICENSE | 21 + packages/next/compiled/ajv-keywords/index.js | 1 + .../next/compiled/ajv-keywords/package.json | 1 + packages/next/compiled/ajv/LICENSE | 22 + packages/next/compiled/ajv/ajv.js | 9 + packages/next/compiled/ajv/package.json | 1 + packages/next/index.d.ts | 3 +- packages/next/package.json | 3 + packages/next/server/config-shared.ts | 614 ++++++++++++++++++ packages/next/server/config.ts | 36 +- packages/next/taskfile.js | 18 + packages/next/tsconfig.json | 8 +- packages/next/types/compiled.d.ts | 7 + packages/next/types/misc.d.ts | 12 + pnpm-lock.yaml | 43 +- .../config-validation/pages/index.js | 3 + .../config-validation/test/index.test.ts | 62 ++ 19 files changed, 845 insertions(+), 36 deletions(-) create mode 100644 errors/invalid-next-config.md create mode 100644 packages/next/compiled/ajv-keywords/LICENSE create mode 100644 packages/next/compiled/ajv-keywords/index.js create mode 100644 packages/next/compiled/ajv-keywords/package.json create mode 100644 packages/next/compiled/ajv/LICENSE create mode 100644 packages/next/compiled/ajv/ajv.js create mode 100644 packages/next/compiled/ajv/package.json create mode 100644 packages/next/types/compiled.d.ts create mode 100644 test/integration/config-validation/pages/index.js create mode 100644 test/integration/config-validation/test/index.test.ts diff --git a/errors/invalid-next-config.md b/errors/invalid-next-config.md new file mode 100644 index 000000000000..efe53f762654 --- /dev/null +++ b/errors/invalid-next-config.md @@ -0,0 +1,13 @@ +# Invalid next.config.js + +#### Why This Error Occurred + +In your `next.config.js` file you passed invalid options that either are the incorrect type or an unknown field. + +#### Possible Ways to Fix It + +Fixing the listed config errors will remove this warning. You can also leverage the `NextConfig` type by importing from `next` to help ensure your config is correct. + +### Useful Links + +- [`next.config.js` types](https://github.com/vercel/next.js/blob/canary/packages/next/server/config-shared.ts) diff --git a/errors/manifest.json b/errors/manifest.json index 5f2f48eb5fee..df0fa5f76351 100644 --- a/errors/manifest.json +++ b/errors/manifest.json @@ -711,6 +711,10 @@ { "title": "node-module-in-edge-runtime", "path": "/errors/node-module-in-edge-runtime.md" + }, + { + "title": "invalid-next.config.js", + "path": "/errors/invalid-next.config.js.md" } ] } diff --git a/packages/next/compiled/ajv-keywords/LICENSE b/packages/next/compiled/ajv-keywords/LICENSE new file mode 100644 index 000000000000..90139aa74cef --- /dev/null +++ b/packages/next/compiled/ajv-keywords/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Evgeny Poberezkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/next/compiled/ajv-keywords/index.js b/packages/next/compiled/ajv-keywords/index.js new file mode 100644 index 000000000000..da1a01132f5a --- /dev/null +++ b/packages/next/compiled/ajv-keywords/index.js @@ -0,0 +1 @@ +(()=>{"use strict";var e={409:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});function getRangeDef(e){return()=>({keyword:e,type:"number",schemaType:"array",macro:function([t,r]){validateRangeSchema(t,r);return e==="range"?{minimum:t,maximum:r}:{exclusiveMinimum:t,exclusiveMaximum:r}},metaSchema:{type:"array",minItems:2,maxItems:2,items:{type:"number"}}});function validateRangeSchema(t,r){if(t>r||e==="exclusiveRange"&&t===r){throw new Error("There are no numbers in range")}}}t["default"]=getRangeDef},666:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});function getRequiredDef(e){return()=>({keyword:e,type:"object",schemaType:"array",macro(t){if(t.length===0)return true;if(t.length===1)return{required:t};const r=e==="anyRequired"?"anyOf":"oneOf";return{[r]:t.map((e=>({required:[e]})))}},metaSchema:{type:"array",items:{type:"string"}}})}t["default"]=getRequiredDef},775:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.usePattern=t.metaSchemaRef=void 0;const n=r(794);const s="http://json-schema.org/schema";function metaSchemaRef({defaultMeta:e}={}){return e===false?{}:{$ref:e||s}}t.metaSchemaRef=metaSchemaRef;function usePattern({gen:e,it:{opts:t}},r,s=(t.unicodeRegExp?"u":"")){const o=new RegExp(r,s);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,n._)`new RegExp(${r}, ${s})`})}t.usePattern=usePattern},830:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});function getDef(){return{keyword:"allRequired",type:"object",schemaType:"boolean",macro(e,t){if(!e)return true;const r=Object.keys(t.properties);if(r.length===0)return true;return{required:r}},dependencies:["properties"]}}t["default"]=getDef;e.exports=getDef},550:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(666));const o=(0,s.default)("anyRequired");t["default"]=o;e.exports=o},774:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});const n=r(775);function getDef(e){return{keyword:"deepProperties",type:"object",schemaType:"object",macro:function(e){const t=[];for(const r in e)t.push(getSchema(r,e[r]));return{allOf:t}},metaSchema:{type:"object",propertyNames:{type:"string",format:"json-pointer"},additionalProperties:(0,n.metaSchemaRef)(e)}}}t["default"]=getDef;function getSchema(e,t){const r=e.split("/");const n={};let s=n;for(let e=1;e{Object.defineProperty(t,"__esModule",{value:true});const n=r(794);function getDef(){return{keyword:"deepRequired",type:"object",schemaType:"array",code(e){const{schema:t,data:r}=e;const s=t.map((e=>(0,n._)`(${getData(e)}) === undefined`));e.fail((0,n.or)(...s));function getData(e){if(e==="")throw new Error("empty JSON pointer not allowed");const t=e.split("/");let s=r;const o=t.map(((e,t)=>t?s=(0,n._)`${s}${(0,n.getProperty)(unescapeJPSegment(e))}`:s));return(0,n.and)(...o)}},metaSchema:{type:"array",items:{type:"string",format:"json-pointer"}}}}t["default"]=getDef;function unescapeJPSegment(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}e.exports=getDef},407:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});const r={};const n={timestamp:()=>()=>Date.now(),datetime:()=>()=>(new Date).toISOString(),date:()=>()=>(new Date).toISOString().slice(0,10),time:()=>()=>(new Date).toISOString().slice(11),random:()=>()=>Math.random(),randomint:e=>{var t;const r=(t=e===null||e===void 0?void 0:e.max)!==null&&t!==void 0?t:2;return()=>Math.floor(Math.random()*r)},seq:e=>{var t;const n=(t=e===null||e===void 0?void 0:e.name)!==null&&t!==void 0?t:"";r[n]||(r[n]=0);return()=>r[n]++}};const s=Object.assign(_getDef,{DEFAULTS:n});function _getDef(){return{keyword:"dynamicDefaults",type:"object",schemaType:["string","object"],modifying:true,valid:true,compile(e,t,r){if(!r.opts.useDefaults||r.compositeRule)return()=>true;const n={};for(const t in e)n[t]=getDefault(e[t]);const s=r.opts.useDefaults==="empty";return t=>{for(const r in e){if(t[r]===undefined||s&&(t[r]===null||t[r]==="")){t[r]=n[r]()}}return true}},metaSchema:{type:"object",additionalProperties:{anyOf:[{type:"string"},{type:"object",additionalProperties:false,required:["func","args"],properties:{func:{type:"string"},args:{type:"object"}}}]}}}}function getDefault(e){return typeof e=="object"?getObjDefault(e):getStrDefault(e)}function getObjDefault({func:e,args:t}){const r=n[e];assertDefined(e,r);return r(t)}function getStrDefault(e=""){const t=n[e];assertDefined(e,t);return t()}function assertDefined(e,t){if(!t)throw new Error(`invalid "dynamicDefaults" keyword property value: ${e}`)}t["default"]=s;e.exports=s},4:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(409));const o=(0,s.default)("exclusiveRange");t["default"]=o;e.exports=o},372:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});const r={Object:Object,Array:Array,Function:Function,Number:Number,String:String,Date:Date,RegExp:RegExp};if(typeof Buffer!="undefined")r.Buffer=Buffer;if(typeof Promise!="undefined")r.Promise=Promise;const n=Object.assign(_getDef,{CONSTRUCTORS:r});function _getDef(){return{keyword:"instanceof",schemaType:["string","array"],compile(e){if(typeof e=="string"){const t=getConstructor(e);return e=>e instanceof t}if(Array.isArray(e)){const t=e.map(getConstructor);return e=>{for(const r of t){if(e instanceof r)return true}return false}}throw new Error("ajv implementation error")},metaSchema:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]}}}function getConstructor(e){const t=r[e];if(t)return t;throw new Error(`invalid "instanceof" keyword value ${e}`)}t["default"]=n;e.exports=n},762:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(666));const o=(0,s.default)("oneRequired");t["default"]=o;e.exports=o},816:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});const n=r(794);const s=r(775);const o={message:({params:{missingPattern:e}})=>(0,n.str)`should have property matching pattern '${e}'`,params:({params:{missingPattern:e}})=>(0,n._)`{missingPattern: ${e}}`};function getDef(){return{keyword:"patternRequired",type:"object",schemaType:"array",error:o,code(e){const{gen:t,schema:r,data:o}=e;if(r.length===0)return;const i=t.let("valid",true);for(const e of r)validateProperties(e);function validateProperties(r){const a=t.let("matched",false);t.forIn("key",o,(o=>{t.assign(a,(0,n._)`${(0,s.usePattern)(e,r)}.test(${o})`);t.if(a,(()=>t.break()))}));e.setParams({missingPattern:r});t.assign(i,(0,n.and)(i,a));e.pass(i)}},metaSchema:{type:"array",items:{type:"string",format:"regex"},uniqueItems:true}}}t["default"]=getDef;e.exports=getDef},583:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});function getDef(){return{keyword:"prohibited",type:"object",schemaType:"array",macro:function(e){if(e.length===0)return true;if(e.length===1)return{not:{required:e}};return{not:{anyOf:e.map((e=>({required:[e]})))}}},metaSchema:{type:"array",items:{type:"string"}}}}t["default"]=getDef;e.exports=getDef},851:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(409));const o=(0,s.default)("range");t["default"]=o;e.exports=o},545:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});const n=r(794);const s=r(775);const o={type:"object",properties:{pattern:{type:"string"},flags:{type:"string",nullable:true}},required:["pattern"],additionalProperties:false};const i=/^\/(.*)\/([gimuy]*)$/;function getDef(){return{keyword:"regexp",type:"string",schemaType:["string","object"],code(e){const{data:t,schema:r}=e;const o=getRegExp(r);e.pass((0,n._)`${o}.test(${t})`);function getRegExp(t){if(typeof t=="object")return(0,s.usePattern)(e,t.pattern,t.flags);const r=i.exec(t);if(r)return(0,s.usePattern)(e,r[1],r[2]);throw new Error("cannot parse string into RegExp")}},metaSchema:{anyOf:[{type:"string"},o]}}}t["default"]=getDef;e.exports=getDef},637:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});const n=r(794);const s=r(775);const o={message:({params:{schemaProp:e}})=>e?(0,n.str)`should match case "${e}" schema`:(0,n.str)`should match default case schema`,params:({params:{schemaProp:e}})=>e?(0,n._)`{failingCase: ${e}}`:(0,n._)`{failingDefault: true}`};function getDef(e){const t=(0,s.metaSchemaRef)(e);return[{keyword:"select",schemaType:["string","number","boolean","null"],$data:true,error:o,dependencies:["selectCases"],code(e){const{gen:t,schemaCode:r,parentSchema:s}=e;e.block$data(n.nil,(()=>{const o=t.let("valid",true);const i=t.name("_valid");const a=t.const("value",(0,n._)`${r} === null ? "null" : ${r}`);t.if(false);for(const r in s.selectCases){e.setParams({schemaProp:r});t.elseIf((0,n._)`"" + ${a} == ${r}`);const s=e.subschema({keyword:"selectCases",schemaProp:r},i);e.mergeEvaluated(s,n.Name);t.assign(o,i)}t.else();if(s.selectDefault!==undefined){e.setParams({schemaProp:undefined});const r=e.subschema({keyword:"selectDefault"},i);e.mergeEvaluated(r,n.Name);t.assign(o,i)}t.endIf();e.pass(o)}))}},{keyword:"selectCases",dependencies:["select"],metaSchema:{type:"object",additionalProperties:t}},{keyword:"selectDefault",dependencies:["select","selectCases"],metaSchema:t}]}t["default"]=getDef;e.exports=getDef},542:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});const n=r(794);const s={trimStart:e=>e.trimStart(),trimEnd:e=>e.trimEnd(),trimLeft:e=>e.trimStart(),trimRight:e=>e.trimEnd(),trim:e=>e.trim(),toLowerCase:e=>e.toLowerCase(),toUpperCase:e=>e.toUpperCase(),toEnumCase:(e,t)=>(t===null||t===void 0?void 0:t.hash[configKey(e)])||e};const o=Object.assign(_getDef,{transform:s});function _getDef(){return{keyword:"transform",schemaType:"array",before:"enum",code(e){const{gen:t,data:r,schema:o,parentSchema:i,it:a}=e;const{parentData:u,parentDataProperty:c}=a;const d=o;if(!d.length)return;let f;if(d.includes("toEnumCase")){const e=getEnumCaseCfg(i);f=t.scopeValue("obj",{ref:e,code:(0,n.stringify)(e)})}t.if((0,n._)`typeof ${r} == "string" && ${u} !== undefined`,(()=>{t.assign(r,transformExpr(d.slice()));t.assign((0,n._)`${u}[${c}]`,r)}));function transformExpr(e){if(!e.length)return r;const o=e.pop();if(!(o in s))throw new Error(`transform: unknown transformation ${o}`);const i=t.scopeValue("func",{ref:s[o],code:(0,n._)`require("ajv-keywords/dist/definitions/transform").transform${(0,n.getProperty)(o)}`});const a=transformExpr(e);return f&&o==="toEnumCase"?(0,n._)`${i}(${a}, ${f})`:(0,n._)`${i}(${a})`}},metaSchema:{type:"array",items:{type:"string",enum:Object.keys(s)}}}}function getEnumCaseCfg(e){const t={hash:{}};if(!e.enum)throw new Error('transform: "toEnumCase" requires "enum"');for(const r of e.enum){if(typeof r!=="string")continue;const e=configKey(r);if(t.hash[e]){throw new Error('transform: "toEnumCase" requires all lowercased "enum" values to be unique')}t.hash[e]=r}return t}function configKey(e){return e.toLowerCase()}t["default"]=o;e.exports=o},227:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});const n=r(794);const s=["undefined","string","number","object","function","boolean","symbol"];function getDef(){return{keyword:"typeof",schemaType:["string","array"],code(e){const{data:t,schema:r,schemaValue:s}=e;e.fail(typeof r=="string"?(0,n._)`typeof ${t} != ${r}`:(0,n._)`${s}.indexOf(typeof ${t}) < 0`)},metaSchema:{anyOf:[{type:"string",enum:s},{type:"array",items:{type:"string",enum:s}}]}}}t["default"]=getDef;e.exports=getDef},639:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});const n=r(914);const s=["number","integer","string","boolean","null"];function getDef(){return{keyword:"uniqueItemProperties",type:"array",schemaType:"array",compile(e,t){const r=getScalarKeys(e,t);return t=>{if(t.length<=1)return true;for(let s=0;s{var r,n,o;const i=(o=(n=(r=t.items)===null||r===void 0?void 0:r.properties)===null||n===void 0?void 0:n[e])===null||o===void 0?void 0:o.type;return Array.isArray(i)?!i.includes("object")&&!i.includes("array"):s.includes(i)}))}e.exports=getDef},523:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(149));const ajvKeywords=(e,t)=>{if(Array.isArray(t)){for(const r of t)get(r)(e);return e}if(t){get(t)(e);return e}for(t in s.default)get(t)(e);return e};ajvKeywords.get=get;function get(e){const t=s.default[e];if(!t)throw new Error("Unknown keyword "+e);return t}t["default"]=ajvKeywords;e.exports=ajvKeywords;e.exports["default"]=ajvKeywords},63:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(830));const allRequired=e=>e.addKeyword((0,s.default)());t["default"]=allRequired;e.exports=allRequired},890:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(550));const anyRequired=e=>e.addKeyword((0,s.default)());t["default"]=anyRequired;e.exports=anyRequired},952:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(774));const deepProperties=(e,t)=>e.addKeyword((0,s.default)(t));t["default"]=deepProperties;e.exports=deepProperties},97:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(464));const deepRequired=e=>e.addKeyword((0,s.default)());t["default"]=deepRequired;e.exports=deepRequired},949:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(407));const dynamicDefaults=e=>e.addKeyword((0,s.default)());t["default"]=dynamicDefaults;e.exports=dynamicDefaults},738:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(4));const exclusiveRange=e=>e.addKeyword((0,s.default)());t["default"]=exclusiveRange;e.exports=exclusiveRange},149:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(432));const o=n(r(825));const i=n(r(716));const a=n(r(738));const u=n(r(769));const c=n(r(928));const d=n(r(165));const f=n(r(63));const l=n(r(890));const p=n(r(257));const h=n(r(232));const m=n(r(371));const g=n(r(952));const y=n(r(97));const v=n(r(949));const w=n(r(863));const b={typeof:s.default,instanceof:o.default,range:i.default,exclusiveRange:a.default,regexp:u.default,transform:c.default,uniqueItemProperties:d.default,allRequired:f.default,anyRequired:l.default,oneRequired:p.default,patternRequired:h.default,prohibited:m.default,deepProperties:g.default,deepRequired:y.default,dynamicDefaults:v.default,select:w.default};t["default"]=b;e.exports=b},825:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(372));const instanceofPlugin=e=>e.addKeyword((0,s.default)());t["default"]=instanceofPlugin;e.exports=instanceofPlugin},257:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(762));const oneRequired=e=>e.addKeyword((0,s.default)());t["default"]=oneRequired;e.exports=oneRequired},232:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(816));const patternRequired=e=>e.addKeyword((0,s.default)());t["default"]=patternRequired;e.exports=patternRequired},371:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(583));const prohibited=e=>e.addKeyword((0,s.default)());t["default"]=prohibited;e.exports=prohibited},716:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(851));const range=e=>e.addKeyword((0,s.default)());t["default"]=range;e.exports=range},769:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(545));const regexp=e=>e.addKeyword((0,s.default)());t["default"]=regexp;e.exports=regexp},863:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(637));const select=(e,t)=>{(0,s.default)(t).forEach((t=>e.addKeyword(t)));return e};t["default"]=select;e.exports=select},928:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(542));const transform=e=>e.addKeyword((0,s.default)());t["default"]=transform;e.exports=transform},432:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(227));const typeofPlugin=e=>e.addKeyword((0,s.default)());t["default"]=typeofPlugin;e.exports=typeofPlugin},165:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(639));const uniqueItemProperties=e=>e.addKeyword((0,s.default)());t["default"]=uniqueItemProperties;e.exports=uniqueItemProperties},621:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class _CodeOrName{}t._CodeOrName=_CodeOrName;t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Name extends _CodeOrName{constructor(e){super();if(!t.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return false}get names(){return{[this.str]:1}}}t.Name=Name;class _Code extends _CodeOrName{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return false;const e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce(((e,t)=>`${e}${t}`),"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce(((e,t)=>{if(t instanceof Name)e[t.str]=(e[t.str]||0)+1;return e}),{})}}t._Code=_Code;t.nil=new _Code("");function _(e,...t){const r=[e[0]];let n=0;while(n{Object.defineProperty(t,"__esModule",{value:true});t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const n=r(621);const s=r(997);var o=r(621);Object.defineProperty(t,"_",{enumerable:true,get:function(){return o._}});Object.defineProperty(t,"str",{enumerable:true,get:function(){return o.str}});Object.defineProperty(t,"strConcat",{enumerable:true,get:function(){return o.strConcat}});Object.defineProperty(t,"nil",{enumerable:true,get:function(){return o.nil}});Object.defineProperty(t,"getProperty",{enumerable:true,get:function(){return o.getProperty}});Object.defineProperty(t,"stringify",{enumerable:true,get:function(){return o.stringify}});Object.defineProperty(t,"regexpCode",{enumerable:true,get:function(){return o.regexpCode}});Object.defineProperty(t,"Name",{enumerable:true,get:function(){return o.Name}});var i=r(997);Object.defineProperty(t,"Scope",{enumerable:true,get:function(){return i.Scope}});Object.defineProperty(t,"ValueScope",{enumerable:true,get:function(){return i.ValueScope}});Object.defineProperty(t,"ValueScopeName",{enumerable:true,get:function(){return i.ValueScopeName}});Object.defineProperty(t,"varKinds",{enumerable:true,get:function(){return i.varKinds}});t.operators={GT:new n._Code(">"),GTE:new n._Code(">="),LT:new n._Code("<"),LTE:new n._Code("<="),EQ:new n._Code("==="),NEQ:new n._Code("!=="),NOT:new n._Code("!"),OR:new n._Code("||"),AND:new n._Code("&&"),ADD:new n._Code("+")};class Node{optimizeNodes(){return this}optimizeNames(e,t){return this}}class Def extends Node{constructor(e,t,r){super();this.varKind=e;this.name=t;this.rhs=r}render({es5:e,_n:t}){const r=e?s.varKinds.var:this.varKind;const n=this.rhs===undefined?"":` = ${this.rhs}`;return`${r} ${this.name}${n};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=optimizeExpr(this.rhs,e,t);return this}get names(){return this.rhs instanceof n._CodeOrName?this.rhs.names:{}}}class Assign extends Node{constructor(e,t,r){super();this.lhs=e;this.rhs=t;this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof n.Name&&!e[this.lhs.str]&&!this.sideEffects)return;this.rhs=optimizeExpr(this.rhs,e,t);return this}get names(){const e=this.lhs instanceof n.Name?{}:{...this.lhs.names};return addExprNames(e,this.rhs)}}class AssignOp extends Assign{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class Label extends Node{constructor(e){super();this.label=e;this.names={}}render({_n:e}){return`${this.label}:`+e}}class Break extends Node{constructor(e){super();this.label=e;this.names={}}render({_n:e}){const t=this.label?` ${this.label}`:"";return`break${t};`+e}}class Throw extends Node{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class AnyCode extends Node{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:undefined}optimizeNames(e,t){this.code=optimizeExpr(this.code,e,t);return this}get names(){return this.code instanceof n._CodeOrName?this.code.names:{}}}class ParentNode extends Node{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce(((t,r)=>t+r.render(e)),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;while(t--){const r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:undefined}optimizeNames(e,t){const{nodes:r}=this;let n=r.length;while(n--){const s=r[n];if(s.optimizeNames(e,t))continue;subtractNames(e,s.names);r.splice(n,1)}return r.length>0?this:undefined}get names(){return this.nodes.reduce(((e,t)=>addNames(e,t.names)),{})}}class BlockNode extends ParentNode{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class Root extends ParentNode{}class Else extends BlockNode{}Else.kind="else";class If extends BlockNode{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(e===true)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new Else(e):e}if(t){if(e===false)return t instanceof If?t:t.nodes;if(this.nodes.length)return this;return new If(not(e),t instanceof If?[t]:t.nodes)}if(e===false||!this.nodes.length)return undefined;return this}optimizeNames(e,t){var r;this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t);if(!(super.optimizeNames(e,t)||this.else))return;this.condition=optimizeExpr(this.condition,e,t);return this}get names(){const e=super.names;addExprNames(e,this.condition);if(this.else)addNames(e,this.else.names);return e}}If.kind="if";class For extends BlockNode{}For.kind="for";class ForLoop extends For{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;this.iteration=optimizeExpr(this.iteration,e,t);return this}get names(){return addNames(super.names,this.iteration.names)}}class ForRange extends For{constructor(e,t,r,n){super();this.varKind=e;this.name=t;this.from=r;this.to=n}render(e){const t=e.es5?s.varKinds.var:this.varKind;const{name:r,from:n,to:o}=this;return`for(${t} ${r}=${n}; ${r}<${o}; ${r}++)`+super.render(e)}get names(){const e=addExprNames(super.names,this.from);return addExprNames(e,this.to)}}class ForIter extends For{constructor(e,t,r,n){super();this.loop=e;this.varKind=t;this.name=r;this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;this.iterable=optimizeExpr(this.iterable,e,t);return this}get names(){return addNames(super.names,this.iterable.names)}}class Func extends BlockNode{constructor(e,t,r){super();this.name=e;this.args=t;this.async=r}render(e){const t=this.async?"async ":"";return`${t}function ${this.name}(${this.args})`+super.render(e)}}Func.kind="func";class Return extends ParentNode{render(e){return"return "+super.render(e)}}Return.kind="return";class Try extends BlockNode{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;super.optimizeNodes();(e=this.catch)===null||e===void 0?void 0:e.optimizeNodes();(t=this.finally)===null||t===void 0?void 0:t.optimizeNodes();return this}optimizeNames(e,t){var r,n;super.optimizeNames(e,t);(r=this.catch)===null||r===void 0?void 0:r.optimizeNames(e,t);(n=this.finally)===null||n===void 0?void 0:n.optimizeNames(e,t);return this}get names(){const e=super.names;if(this.catch)addNames(e,this.catch.names);if(this.finally)addNames(e,this.finally.names);return e}}class Catch extends BlockNode{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Catch.kind="catch";class Finally extends BlockNode{render(e){return"finally"+super.render(e)}}Finally.kind="finally";class CodeGen{constructor(e,t={}){this._values={};this._blockStarts=[];this._constants={};this.opts={...t,_n:t.lines?"\n":""};this._extScope=e;this._scope=new s.Scope({parent:e});this._nodes=[new Root]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);const n=this._values[r.prefix]||(this._values[r.prefix]=new Set);n.add(r);return r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){const s=this._scope.toName(t);if(r!==undefined&&n)this._constants[s.str]=r;this._leafNode(new Def(e,s,r));return s}const(e,t,r){return this._def(s.varKinds.const,e,t,r)}let(e,t,r){return this._def(s.varKinds.let,e,t,r)}var(e,t,r){return this._def(s.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Assign(e,t,r))}add(e,r){return this._leafNode(new AssignOp(e,t.operators.ADD,r))}code(e){if(typeof e=="function")e();else if(e!==n.nil)this._leafNode(new AnyCode(e));return this}object(...e){const t=["{"];for(const[r,s]of e){if(t.length>1)t.push(",");t.push(r);if(r!==s||this.opts.es5){t.push(":");(0,n.addCodeArg)(t,s)}}t.push("}");return new n._Code(t)}if(e,t,r){this._blockNode(new If(e));if(t&&r){this.code(t).else().code(r).endIf()}else if(t){this.code(t).endIf()}else if(r){throw new Error('CodeGen: "else" body without "then" body')}return this}elseIf(e){return this._elseNode(new If(e))}else(){return this._elseNode(new Else)}endIf(){return this._endBlockNode(If,Else)}_for(e,t){this._blockNode(e);if(t)this.code(t).endFor();return this}for(e,t){return this._for(new ForLoop(e),t)}forRange(e,t,r,n,o=(this.opts.es5?s.varKinds.var:s.varKinds.let)){const i=this._scope.toName(e);return this._for(new ForRange(o,i,t,r),(()=>n(i)))}forOf(e,t,r,o=s.varKinds.const){const i=this._scope.toName(e);if(this.opts.es5){const e=t instanceof n.Name?t:this.var("_arr",t);return this.forRange("_i",0,(0,n._)`${e}.length`,(t=>{this.var(i,(0,n._)`${e}[${t}]`);r(i)}))}return this._for(new ForIter("of",o,i,t),(()=>r(i)))}forIn(e,t,r,o=(this.opts.es5?s.varKinds.var:s.varKinds.const)){if(this.opts.ownProperties){return this.forOf(e,(0,n._)`Object.keys(${t})`,r)}const i=this._scope.toName(e);return this._for(new ForIter("in",o,i,t),(()=>r(i)))}endFor(){return this._endBlockNode(For)}label(e){return this._leafNode(new Label(e))}break(e){return this._leafNode(new Break(e))}return(e){const t=new Return;this._blockNode(t);this.code(e);if(t.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Return)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const n=new Try;this._blockNode(n);this.code(e);if(t){const e=this.name("e");this._currNode=n.catch=new Catch(e);t(e)}if(r){this._currNode=n.finally=new Finally;this.code(r)}return this._endBlockNode(Catch,Finally)}throw(e){return this._leafNode(new Throw(e))}block(e,t){this._blockStarts.push(this._nodes.length);if(e)this.code(e).endBlock(t);return this}endBlock(e){const t=this._blockStarts.pop();if(t===undefined)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||e!==undefined&&r!==e){throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`)}this._nodes.length=t;return this}func(e,t=n.nil,r,s){this._blockNode(new Func(e,t,r));if(s)this.code(s).endFunc();return this}endFunc(){return this._endBlockNode(Func)}optimize(e=1){while(e-- >0){this._root.optimizeNodes();this._root.optimizeNames(this._root.names,this._constants)}}_leafNode(e){this._currNode.nodes.push(e);return this}_blockNode(e){this._currNode.nodes.push(e);this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t){this._nodes.pop();return this}throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof If)){throw new Error('CodeGen: "else" without "if"')}this._currNode=t.else=e;return this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}}t.CodeGen=CodeGen;function addNames(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function addExprNames(e,t){return t instanceof n._CodeOrName?addNames(e,t.names):e}function optimizeExpr(e,t,r){if(e instanceof n.Name)return replaceName(e);if(!canOptimize(e))return e;return new n._Code(e._items.reduce(((e,t)=>{if(t instanceof n.Name)t=replaceName(t);if(t instanceof n._Code)e.push(...t._items);else e.push(t);return e}),[]));function replaceName(e){const n=r[e.str];if(n===undefined||t[e.str]!==1)return e;delete t[e.str];return n}function canOptimize(e){return e instanceof n._Code&&e._items.some((e=>e instanceof n.Name&&t[e.str]===1&&r[e.str]!==undefined))}}function subtractNames(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function not(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,n._)`!${par(e)}`}t.not=not;const a=mappend(t.operators.AND);function and(...e){return e.reduce(a)}t.and=and;const u=mappend(t.operators.OR);function or(...e){return e.reduce(u)}t.or=or;function mappend(e){return(t,r)=>t===n.nil?r:r===n.nil?t:(0,n._)`${par(t)} ${e} ${par(r)}`}function par(e){return e instanceof n.Name?e:(0,n._)`(${e})`}},997:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const n=r(621);class ValueError extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var s;(function(e){e[e["Started"]=0]="Started";e[e["Completed"]=1]="Completed"})(s=t.UsedValueState||(t.UsedValueState={}));t.varKinds={const:new n.Name("const"),let:new n.Name("let"),var:new n.Name("var")};class Scope{constructor({prefixes:e,parent:t}={}){this._names={};this._prefixes=e;this._parent=t}toName(e){return e instanceof n.Name?e:this.name(e)}name(e){return new n.Name(this._newName(e))}_newName(e){const t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e)){throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`)}return this._names[e]={prefix:e,index:0}}}t.Scope=Scope;class ValueScopeName extends n.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e;this.scopePath=(0,n._)`.${new n.Name(t)}[${r}]`}}t.ValueScopeName=ValueScopeName;const o=(0,n._)`\n`;class ValueScope extends Scope{constructor(e){super(e);this._values={};this._scope=e.scope;this.opts={...e,_n:e.lines?o:n.nil}}get(){return this._scope}name(e){return new ValueScopeName(e,this._newName(e))}value(e,t){var r;if(t.ref===undefined)throw new Error("CodeGen: ref must be passed in value");const n=this.toName(e);const{prefix:s}=n;const o=(r=t.key)!==null&&r!==void 0?r:t.ref;let i=this._values[s];if(i){const e=i.get(o);if(e)return e}else{i=this._values[s]=new Map}i.set(o,n);const a=this._scope[s]||(this._scope[s]=[]);const u=a.length;a[u]=t.ref;n.setValue(t,{property:s,itemIndex:u});return n}getValue(e,t){const r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(t=>{if(t.scopePath===undefined)throw new Error(`CodeGen: name "${t}" has no value`);return(0,n._)`${e}${t.scopePath}`}))}scopeCode(e=this._values,t,r){return this._reduceValues(e,(e=>{if(e.value===undefined)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),t,r)}_reduceValues(e,r,o={},i){let a=n.nil;for(const u in e){const c=e[u];if(!c)continue;const d=o[u]=o[u]||new Map;c.forEach((e=>{if(d.has(e))return;d.set(e,s.Started);let o=r(e);if(o){const r=this.opts.es5?t.varKinds.var:t.varKinds.const;a=(0,n._)`${a}${r} ${e} = ${o};${this.opts._n}`}else if(o=i===null||i===void 0?void 0:i(e)){a=(0,n._)`${a}${o}${this.opts._n}`}else{throw new ValueError(e)}d.set(e,s.Completed)}))}return a}}t.ValueScope=ValueScope},914:e=>{e.exports=function equal(e,t){if(e===t)return true;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return false;var r,n,s;if(Array.isArray(e)){r=e.length;if(r!=t.length)return false;for(n=r;n--!==0;)if(!equal(e[n],t[n]))return false;return true}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();s=Object.keys(e);r=s.length;if(r!==Object.keys(t).length)return false;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,s[n]))return false;for(n=r;n--!==0;){var o=s[n];if(!equal(e[o],t[o]))return false}return true}return e!==e&&t!==t}}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var s=t[r]={exports:{}};var o=true;try{e[r].call(s.exports,s,s.exports,__nccwpck_require__);o=false}finally{if(o)delete t[r]}return s.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(523);module.exports=r})(); \ No newline at end of file diff --git a/packages/next/compiled/ajv-keywords/package.json b/packages/next/compiled/ajv-keywords/package.json new file mode 100644 index 000000000000..807d8a201280 --- /dev/null +++ b/packages/next/compiled/ajv-keywords/package.json @@ -0,0 +1 @@ +{"name":"ajv-keywords","main":"index.js","author":"Evgeny Poberezkin","license":"MIT"} diff --git a/packages/next/compiled/ajv/LICENSE b/packages/next/compiled/ajv/LICENSE new file mode 100644 index 000000000000..139162ad2c38 --- /dev/null +++ b/packages/next/compiled/ajv/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015-2021 Evgeny Poberezkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/packages/next/compiled/ajv/ajv.js b/packages/next/compiled/ajv/ajv.js new file mode 100644 index 000000000000..385b65f13247 --- /dev/null +++ b/packages/next/compiled/ajv/ajv.js @@ -0,0 +1,9 @@ +(()=>{var e={7097:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const s=r(2046);const a=r(7127);const n=r(764);const o=r(9520);const i=["/properties"];const c="http://json-schema.org/draft-07/schema";class Ajv extends s.default{_addVocabularies(){super._addVocabularies();a.default.forEach((e=>this.addVocabulary(e)));if(this.opts.discriminator)this.addKeyword(n.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();if(!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(o,i):o;this.addMetaSchema(e,c,false);this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:undefined)}}e.exports=t=Ajv;Object.defineProperty(t,"__esModule",{value:true});t["default"]=Ajv;var u=r(2069);Object.defineProperty(t,"KeywordCxt",{enumerable:true,get:function(){return u.KeywordCxt}});var l=r(7794);Object.defineProperty(t,"_",{enumerable:true,get:function(){return l._}});Object.defineProperty(t,"str",{enumerable:true,get:function(){return l.str}});Object.defineProperty(t,"stringify",{enumerable:true,get:function(){return l.stringify}});Object.defineProperty(t,"nil",{enumerable:true,get:function(){return l.nil}});Object.defineProperty(t,"Name",{enumerable:true,get:function(){return l.Name}});Object.defineProperty(t,"CodeGen",{enumerable:true,get:function(){return l.CodeGen}})},7621:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class _CodeOrName{}t._CodeOrName=_CodeOrName;t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Name extends _CodeOrName{constructor(e){super();if(!t.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return false}get names(){return{[this.str]:1}}}t.Name=Name;class _Code extends _CodeOrName{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return false;const e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce(((e,t)=>`${e}${t}`),"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce(((e,t)=>{if(t instanceof Name)e[t.str]=(e[t.str]||0)+1;return e}),{})}}t._Code=_Code;t.nil=new _Code("");function _(e,...t){const r=[e[0]];let s=0;while(s{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const s=r(7621);const a=r(4997);var n=r(7621);Object.defineProperty(t,"_",{enumerable:true,get:function(){return n._}});Object.defineProperty(t,"str",{enumerable:true,get:function(){return n.str}});Object.defineProperty(t,"strConcat",{enumerable:true,get:function(){return n.strConcat}});Object.defineProperty(t,"nil",{enumerable:true,get:function(){return n.nil}});Object.defineProperty(t,"getProperty",{enumerable:true,get:function(){return n.getProperty}});Object.defineProperty(t,"stringify",{enumerable:true,get:function(){return n.stringify}});Object.defineProperty(t,"regexpCode",{enumerable:true,get:function(){return n.regexpCode}});Object.defineProperty(t,"Name",{enumerable:true,get:function(){return n.Name}});var o=r(4997);Object.defineProperty(t,"Scope",{enumerable:true,get:function(){return o.Scope}});Object.defineProperty(t,"ValueScope",{enumerable:true,get:function(){return o.ValueScope}});Object.defineProperty(t,"ValueScopeName",{enumerable:true,get:function(){return o.ValueScopeName}});Object.defineProperty(t,"varKinds",{enumerable:true,get:function(){return o.varKinds}});t.operators={GT:new s._Code(">"),GTE:new s._Code(">="),LT:new s._Code("<"),LTE:new s._Code("<="),EQ:new s._Code("==="),NEQ:new s._Code("!=="),NOT:new s._Code("!"),OR:new s._Code("||"),AND:new s._Code("&&"),ADD:new s._Code("+")};class Node{optimizeNodes(){return this}optimizeNames(e,t){return this}}class Def extends Node{constructor(e,t,r){super();this.varKind=e;this.name=t;this.rhs=r}render({es5:e,_n:t}){const r=e?a.varKinds.var:this.varKind;const s=this.rhs===undefined?"":` = ${this.rhs}`;return`${r} ${this.name}${s};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=optimizeExpr(this.rhs,e,t);return this}get names(){return this.rhs instanceof s._CodeOrName?this.rhs.names:{}}}class Assign extends Node{constructor(e,t,r){super();this.lhs=e;this.rhs=t;this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof s.Name&&!e[this.lhs.str]&&!this.sideEffects)return;this.rhs=optimizeExpr(this.rhs,e,t);return this}get names(){const e=this.lhs instanceof s.Name?{}:{...this.lhs.names};return addExprNames(e,this.rhs)}}class AssignOp extends Assign{constructor(e,t,r,s){super(e,r,s);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class Label extends Node{constructor(e){super();this.label=e;this.names={}}render({_n:e}){return`${this.label}:`+e}}class Break extends Node{constructor(e){super();this.label=e;this.names={}}render({_n:e}){const t=this.label?` ${this.label}`:"";return`break${t};`+e}}class Throw extends Node{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class AnyCode extends Node{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:undefined}optimizeNames(e,t){this.code=optimizeExpr(this.code,e,t);return this}get names(){return this.code instanceof s._CodeOrName?this.code.names:{}}}class ParentNode extends Node{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce(((t,r)=>t+r.render(e)),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;while(t--){const r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:undefined}optimizeNames(e,t){const{nodes:r}=this;let s=r.length;while(s--){const a=r[s];if(a.optimizeNames(e,t))continue;subtractNames(e,a.names);r.splice(s,1)}return r.length>0?this:undefined}get names(){return this.nodes.reduce(((e,t)=>addNames(e,t.names)),{})}}class BlockNode extends ParentNode{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class Root extends ParentNode{}class Else extends BlockNode{}Else.kind="else";class If extends BlockNode{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(e===true)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new Else(e):e}if(t){if(e===false)return t instanceof If?t:t.nodes;if(this.nodes.length)return this;return new If(not(e),t instanceof If?[t]:t.nodes)}if(e===false||!this.nodes.length)return undefined;return this}optimizeNames(e,t){var r;this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t);if(!(super.optimizeNames(e,t)||this.else))return;this.condition=optimizeExpr(this.condition,e,t);return this}get names(){const e=super.names;addExprNames(e,this.condition);if(this.else)addNames(e,this.else.names);return e}}If.kind="if";class For extends BlockNode{}For.kind="for";class ForLoop extends For{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;this.iteration=optimizeExpr(this.iteration,e,t);return this}get names(){return addNames(super.names,this.iteration.names)}}class ForRange extends For{constructor(e,t,r,s){super();this.varKind=e;this.name=t;this.from=r;this.to=s}render(e){const t=e.es5?a.varKinds.var:this.varKind;const{name:r,from:s,to:n}=this;return`for(${t} ${r}=${s}; ${r}<${n}; ${r}++)`+super.render(e)}get names(){const e=addExprNames(super.names,this.from);return addExprNames(e,this.to)}}class ForIter extends For{constructor(e,t,r,s){super();this.loop=e;this.varKind=t;this.name=r;this.iterable=s}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;this.iterable=optimizeExpr(this.iterable,e,t);return this}get names(){return addNames(super.names,this.iterable.names)}}class Func extends BlockNode{constructor(e,t,r){super();this.name=e;this.args=t;this.async=r}render(e){const t=this.async?"async ":"";return`${t}function ${this.name}(${this.args})`+super.render(e)}}Func.kind="func";class Return extends ParentNode{render(e){return"return "+super.render(e)}}Return.kind="return";class Try extends BlockNode{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;super.optimizeNodes();(e=this.catch)===null||e===void 0?void 0:e.optimizeNodes();(t=this.finally)===null||t===void 0?void 0:t.optimizeNodes();return this}optimizeNames(e,t){var r,s;super.optimizeNames(e,t);(r=this.catch)===null||r===void 0?void 0:r.optimizeNames(e,t);(s=this.finally)===null||s===void 0?void 0:s.optimizeNames(e,t);return this}get names(){const e=super.names;if(this.catch)addNames(e,this.catch.names);if(this.finally)addNames(e,this.finally.names);return e}}class Catch extends BlockNode{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Catch.kind="catch";class Finally extends BlockNode{render(e){return"finally"+super.render(e)}}Finally.kind="finally";class CodeGen{constructor(e,t={}){this._values={};this._blockStarts=[];this._constants={};this.opts={...t,_n:t.lines?"\n":""};this._extScope=e;this._scope=new a.Scope({parent:e});this._nodes=[new Root]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);const s=this._values[r.prefix]||(this._values[r.prefix]=new Set);s.add(r);return r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,s){const a=this._scope.toName(t);if(r!==undefined&&s)this._constants[a.str]=r;this._leafNode(new Def(e,a,r));return a}const(e,t,r){return this._def(a.varKinds.const,e,t,r)}let(e,t,r){return this._def(a.varKinds.let,e,t,r)}var(e,t,r){return this._def(a.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Assign(e,t,r))}add(e,r){return this._leafNode(new AssignOp(e,t.operators.ADD,r))}code(e){if(typeof e=="function")e();else if(e!==s.nil)this._leafNode(new AnyCode(e));return this}object(...e){const t=["{"];for(const[r,a]of e){if(t.length>1)t.push(",");t.push(r);if(r!==a||this.opts.es5){t.push(":");(0,s.addCodeArg)(t,a)}}t.push("}");return new s._Code(t)}if(e,t,r){this._blockNode(new If(e));if(t&&r){this.code(t).else().code(r).endIf()}else if(t){this.code(t).endIf()}else if(r){throw new Error('CodeGen: "else" body without "then" body')}return this}elseIf(e){return this._elseNode(new If(e))}else(){return this._elseNode(new Else)}endIf(){return this._endBlockNode(If,Else)}_for(e,t){this._blockNode(e);if(t)this.code(t).endFor();return this}for(e,t){return this._for(new ForLoop(e),t)}forRange(e,t,r,s,n=(this.opts.es5?a.varKinds.var:a.varKinds.let)){const o=this._scope.toName(e);return this._for(new ForRange(n,o,t,r),(()=>s(o)))}forOf(e,t,r,n=a.varKinds.const){const o=this._scope.toName(e);if(this.opts.es5){const e=t instanceof s.Name?t:this.var("_arr",t);return this.forRange("_i",0,(0,s._)`${e}.length`,(t=>{this.var(o,(0,s._)`${e}[${t}]`);r(o)}))}return this._for(new ForIter("of",n,o,t),(()=>r(o)))}forIn(e,t,r,n=(this.opts.es5?a.varKinds.var:a.varKinds.const)){if(this.opts.ownProperties){return this.forOf(e,(0,s._)`Object.keys(${t})`,r)}const o=this._scope.toName(e);return this._for(new ForIter("in",n,o,t),(()=>r(o)))}endFor(){return this._endBlockNode(For)}label(e){return this._leafNode(new Label(e))}break(e){return this._leafNode(new Break(e))}return(e){const t=new Return;this._blockNode(t);this.code(e);if(t.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Return)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const s=new Try;this._blockNode(s);this.code(e);if(t){const e=this.name("e");this._currNode=s.catch=new Catch(e);t(e)}if(r){this._currNode=s.finally=new Finally;this.code(r)}return this._endBlockNode(Catch,Finally)}throw(e){return this._leafNode(new Throw(e))}block(e,t){this._blockStarts.push(this._nodes.length);if(e)this.code(e).endBlock(t);return this}endBlock(e){const t=this._blockStarts.pop();if(t===undefined)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||e!==undefined&&r!==e){throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`)}this._nodes.length=t;return this}func(e,t=s.nil,r,a){this._blockNode(new Func(e,t,r));if(a)this.code(a).endFunc();return this}endFunc(){return this._endBlockNode(Func)}optimize(e=1){while(e-- >0){this._root.optimizeNodes();this._root.optimizeNames(this._root.names,this._constants)}}_leafNode(e){this._currNode.nodes.push(e);return this}_blockNode(e){this._currNode.nodes.push(e);this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t){this._nodes.pop();return this}throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof If)){throw new Error('CodeGen: "else" without "if"')}this._currNode=t.else=e;return this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}}t.CodeGen=CodeGen;function addNames(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function addExprNames(e,t){return t instanceof s._CodeOrName?addNames(e,t.names):e}function optimizeExpr(e,t,r){if(e instanceof s.Name)return replaceName(e);if(!canOptimize(e))return e;return new s._Code(e._items.reduce(((e,t)=>{if(t instanceof s.Name)t=replaceName(t);if(t instanceof s._Code)e.push(...t._items);else e.push(t);return e}),[]));function replaceName(e){const s=r[e.str];if(s===undefined||t[e.str]!==1)return e;delete t[e.str];return s}function canOptimize(e){return e instanceof s._Code&&e._items.some((e=>e instanceof s.Name&&t[e.str]===1&&r[e.str]!==undefined))}}function subtractNames(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function not(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,s._)`!${par(e)}`}t.not=not;const i=mappend(t.operators.AND);function and(...e){return e.reduce(i)}t.and=and;const c=mappend(t.operators.OR);function or(...e){return e.reduce(c)}t.or=or;function mappend(e){return(t,r)=>t===s.nil?r:r===s.nil?t:(0,s._)`${par(t)} ${e} ${par(r)}`}function par(e){return e instanceof s.Name?e:(0,s._)`(${e})`}},4997:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const s=r(7621);class ValueError extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var a;(function(e){e[e["Started"]=0]="Started";e[e["Completed"]=1]="Completed"})(a=t.UsedValueState||(t.UsedValueState={}));t.varKinds={const:new s.Name("const"),let:new s.Name("let"),var:new s.Name("var")};class Scope{constructor({prefixes:e,parent:t}={}){this._names={};this._prefixes=e;this._parent=t}toName(e){return e instanceof s.Name?e:this.name(e)}name(e){return new s.Name(this._newName(e))}_newName(e){const t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e)){throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`)}return this._names[e]={prefix:e,index:0}}}t.Scope=Scope;class ValueScopeName extends s.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e;this.scopePath=(0,s._)`.${new s.Name(t)}[${r}]`}}t.ValueScopeName=ValueScopeName;const n=(0,s._)`\n`;class ValueScope extends Scope{constructor(e){super(e);this._values={};this._scope=e.scope;this.opts={...e,_n:e.lines?n:s.nil}}get(){return this._scope}name(e){return new ValueScopeName(e,this._newName(e))}value(e,t){var r;if(t.ref===undefined)throw new Error("CodeGen: ref must be passed in value");const s=this.toName(e);const{prefix:a}=s;const n=(r=t.key)!==null&&r!==void 0?r:t.ref;let o=this._values[a];if(o){const e=o.get(n);if(e)return e}else{o=this._values[a]=new Map}o.set(n,s);const i=this._scope[a]||(this._scope[a]=[]);const c=i.length;i[c]=t.ref;s.setValue(t,{property:a,itemIndex:c});return s}getValue(e,t){const r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(t=>{if(t.scopePath===undefined)throw new Error(`CodeGen: name "${t}" has no value`);return(0,s._)`${e}${t.scopePath}`}))}scopeCode(e=this._values,t,r){return this._reduceValues(e,(e=>{if(e.value===undefined)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),t,r)}_reduceValues(e,r,n={},o){let i=s.nil;for(const c in e){const u=e[c];if(!u)continue;const l=n[c]=n[c]||new Map;u.forEach((e=>{if(l.has(e))return;l.set(e,a.Started);let n=r(e);if(n){const r=this.opts.es5?t.varKinds.var:t.varKinds.const;i=(0,s._)`${i}${r} ${e} = ${n};${this.opts._n}`}else if(n=o===null||o===void 0?void 0:o(e)){i=(0,s._)`${i}${n}${this.opts._n}`}else{throw new ValueError(e)}l.set(e,a.Completed)}))}return i}}t.ValueScope=ValueScope},4337:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const s=r(7794);const a=r(5470);const n=r(8030);t.keywordError={message:({keyword:e})=>(0,s.str)`must pass "${e}" keyword validation`};t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,s.str)`"${e}" keyword must be ${t} ($data)`:(0,s.str)`"${e}" keyword is invalid ($data)`};function reportError(e,r=t.keywordError,a,n){const{it:o}=e;const{gen:i,compositeRule:c,allErrors:u}=o;const l=errorObjectCode(e,r,a);if(n!==null&&n!==void 0?n:c||u){addError(i,l)}else{returnErrors(o,(0,s._)`[${l}]`)}}t.reportError=reportError;function reportExtraError(e,r=t.keywordError,s){const{it:a}=e;const{gen:o,compositeRule:i,allErrors:c}=a;const u=errorObjectCode(e,r,s);addError(o,u);if(!(i||c)){returnErrors(a,n.default.vErrors)}}t.reportExtraError=reportExtraError;function resetErrorsCount(e,t){e.assign(n.default.errors,t);e.if((0,s._)`${n.default.vErrors} !== null`,(()=>e.if(t,(()=>e.assign((0,s._)`${n.default.vErrors}.length`,t)),(()=>e.assign(n.default.vErrors,null)))))}t.resetErrorsCount=resetErrorsCount;function extendErrors({gen:e,keyword:t,schemaValue:r,data:a,errsCount:o,it:i}){if(o===undefined)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",o,n.default.errors,(o=>{e.const(c,(0,s._)`${n.default.vErrors}[${o}]`);e.if((0,s._)`${c}.instancePath === undefined`,(()=>e.assign((0,s._)`${c}.instancePath`,(0,s.strConcat)(n.default.instancePath,i.errorPath))));e.assign((0,s._)`${c}.schemaPath`,(0,s.str)`${i.errSchemaPath}/${t}`);if(i.opts.verbose){e.assign((0,s._)`${c}.schema`,r);e.assign((0,s._)`${c}.data`,a)}}))}t.extendErrors=extendErrors;function addError(e,t){const r=e.const("err",t);e.if((0,s._)`${n.default.vErrors} === null`,(()=>e.assign(n.default.vErrors,(0,s._)`[${r}]`)),(0,s._)`${n.default.vErrors}.push(${r})`);e.code((0,s._)`${n.default.errors}++`)}function returnErrors(e,t){const{gen:r,validateName:a,schemaEnv:n}=e;if(n.$async){r.throw((0,s._)`new ${e.ValidationError}(${t})`)}else{r.assign((0,s._)`${a}.errors`,t);r.return(false)}}const o={keyword:new s.Name("keyword"),schemaPath:new s.Name("schemaPath"),params:new s.Name("params"),propertyName:new s.Name("propertyName"),message:new s.Name("message"),schema:new s.Name("schema"),parentSchema:new s.Name("parentSchema")};function errorObjectCode(e,t,r){const{createErrors:a}=e.it;if(a===false)return(0,s._)`{}`;return errorObject(e,t,r)}function errorObject(e,t,r={}){const{gen:s,it:a}=e;const n=[errorInstancePath(a,r),errorSchemaPath(e,r)];extraErrorProps(e,t,n);return s.object(...n)}function errorInstancePath({errorPath:e},{instancePath:t}){const r=t?(0,s.str)`${e}${(0,a.getErrorPath)(t,a.Type.Str)}`:e;return[n.default.instancePath,(0,s.strConcat)(n.default.instancePath,r)]}function errorSchemaPath({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let i=n?t:(0,s.str)`${t}/${e}`;if(r){i=(0,s.str)`${i}${(0,a.getErrorPath)(r,a.Type.Str)}`}return[o.schemaPath,i]}function extraErrorProps(e,{params:t,message:r},a){const{keyword:i,data:c,schemaValue:u,it:l}=e;const{opts:d,propertyName:f,topSchemaRef:p,schemaPath:h}=l;a.push([o.keyword,i],[o.params,typeof t=="function"?t(e):t||(0,s._)`{}`]);if(d.messages){a.push([o.message,typeof r=="function"?r(e):r])}if(d.verbose){a.push([o.schema,u],[o.parentSchema,(0,s._)`${p}${h}`],[n.default.data,c])}if(f)a.push([o.propertyName,f])}},8612:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;const s=r(7794);const a=r(4591);const n=r(8030);const o=r(8241);const i=r(5470);const c=r(2069);class SchemaEnv{constructor(e){var t;this.refs={};this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema;this.schemaId=e.schemaId;this.root=e.root||this;this.baseId=(t=e.baseId)!==null&&t!==void 0?t:(0,o.normalizeId)(r===null||r===void 0?void 0:r[e.schemaId||"$id"]);this.schemaPath=e.schemaPath;this.localRefs=e.localRefs;this.meta=e.meta;this.$async=r===null||r===void 0?void 0:r.$async;this.refs={}}}t.SchemaEnv=SchemaEnv;function compileSchema(e){const t=getCompilingSchema.call(this,e);if(t)return t;const r=(0,o.getFullPath)(this.opts.uriResolver,e.root.baseId);const{es5:i,lines:u}=this.opts.code;const{ownProperties:l}=this.opts;const d=new s.CodeGen(this.scope,{es5:i,lines:u,ownProperties:l});let f;if(e.$async){f=d.scopeValue("Error",{ref:a.default,code:(0,s._)`require("ajv/dist/runtime/validation_error").default`})}const p=d.scopeName("validate");e.validateName=p;const h={gen:d,allErrors:this.opts.allErrors,data:n.default.data,parentData:n.default.parentData,parentDataProperty:n.default.parentDataProperty,dataNames:[n.default.data],dataPathArr:[s.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:d.scopeValue("schema",this.opts.code.source===true?{ref:e.schema,code:(0,s.stringify)(e.schema)}:{ref:e.schema}),validateName:p,ValidationError:f,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:s.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,s._)`""`,opts:this.opts,self:this};let m;try{this._compilations.add(e);(0,c.validateFunctionCode)(h);d.optimize(this.opts.code.optimize);const t=d.toString();m=`${d.scopeRefs(n.default.scope)}return ${t}`;if(this.opts.code.process)m=this.opts.code.process(m,e);const r=new Function(`${n.default.self}`,`${n.default.scope}`,m);const a=r(this,this.scope.get());this.scope.value(p,{ref:a});a.errors=null;a.schema=e.schema;a.schemaEnv=e;if(e.$async)a.$async=true;if(this.opts.code.source===true){a.source={validateName:p,validateCode:t,scopeValues:d._values}}if(this.opts.unevaluated){const{props:e,items:t}=h;a.evaluated={props:e instanceof s.Name?undefined:e,items:t instanceof s.Name?undefined:t,dynamicProps:e instanceof s.Name,dynamicItems:t instanceof s.Name};if(a.source)a.source.evaluated=(0,s.stringify)(a.evaluated)}e.validate=a;return e}catch(t){delete e.validate;delete e.validateName;if(m)this.logger.error("Error compiling schema, function code:",m);throw t}finally{this._compilations.delete(e)}}t.compileSchema=compileSchema;function resolveRef(e,t,r){var s;r=(0,o.resolveUrl)(this.opts.uriResolver,t,r);const a=e.refs[r];if(a)return a;let n=resolve.call(this,e,r);if(n===undefined){const a=(s=e.localRefs)===null||s===void 0?void 0:s[r];const{schemaId:o}=this.opts;if(a)n=new SchemaEnv({schema:a,schemaId:o,root:e,baseId:t})}if(n===undefined)return;return e.refs[r]=inlineOrCompile.call(this,n)}t.resolveRef=resolveRef;function inlineOrCompile(e){if((0,o.inlineRef)(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:compileSchema.call(this,e)}function getCompilingSchema(e){for(const t of this._compilations){if(sameSchemaEnv(t,e))return t}}t.getCompilingSchema=getCompilingSchema;function sameSchemaEnv(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function resolve(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||resolveSchema.call(this,e,t)}function resolveSchema(e,t){const r=this.opts.uriResolver.parse(t);const s=(0,o._getFullPath)(this.opts.uriResolver,r);let a=(0,o.getFullPath)(this.opts.uriResolver,e.baseId,undefined);if(Object.keys(e.schema).length>0&&s===a){return getJsonPointer.call(this,r,e)}const n=(0,o.normalizeId)(s);const i=this.refs[n]||this.schemas[n];if(typeof i=="string"){const t=resolveSchema.call(this,e,i);if(typeof(t===null||t===void 0?void 0:t.schema)!=="object")return;return getJsonPointer.call(this,r,t)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)compileSchema.call(this,i);if(n===(0,o.normalizeId)(t)){const{schema:t}=i;const{schemaId:r}=this.opts;const s=t[r];if(s)a=(0,o.resolveUrl)(this.opts.uriResolver,a,s);return new SchemaEnv({schema:t,schemaId:r,root:e,baseId:a})}return getJsonPointer.call(this,r,i)}t.resolveSchema=resolveSchema;const u=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function getJsonPointer(e,{baseId:t,schema:r,root:s}){var a;if(((a=e.fragment)===null||a===void 0?void 0:a[0])!=="/")return;for(const s of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;const e=r[(0,i.unescapeFragment)(s)];if(e===undefined)return;r=e;const a=typeof r==="object"&&r[this.opts.schemaId];if(!u.has(s)&&a){t=(0,o.resolveUrl)(this.opts.uriResolver,t,a)}}let n;if(typeof r!="boolean"&&r.$ref&&!(0,i.schemaHasRulesButRef)(r,this.RULES)){const e=(0,o.resolveUrl)(this.opts.uriResolver,t,r.$ref);n=resolveSchema.call(this,s,e)}const{schemaId:c}=this.opts;n=n||new SchemaEnv({schema:r,schemaId:c,root:s,baseId:t});if(n.schema!==n.root.schema)return n;return undefined}},8030:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a={data:new s.Name("data"),valCxt:new s.Name("valCxt"),instancePath:new s.Name("instancePath"),parentData:new s.Name("parentData"),parentDataProperty:new s.Name("parentDataProperty"),rootData:new s.Name("rootData"),dynamicAnchors:new s.Name("dynamicAnchors"),vErrors:new s.Name("vErrors"),errors:new s.Name("errors"),this:new s.Name("this"),self:new s.Name("self"),scope:new s.Name("scope"),json:new s.Name("json"),jsonPos:new s.Name("jsonPos"),jsonLen:new s.Name("jsonLen"),jsonPart:new s.Name("jsonPart")};t["default"]=a},7983:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(8241);class MissingRefError extends Error{constructor(e,t,r,a){super(a||`can't resolve reference ${r} from id ${t}`);this.missingRef=(0,s.resolveUrl)(e,t,r);this.missingSchema=(0,s.normalizeId)((0,s.getFullPath)(e,this.missingRef))}}t["default"]=MissingRefError},8241:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;const s=r(5470);const a=r(7914);const n=r(2486);const o=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function inlineRef(e,t=true){if(typeof e=="boolean")return true;if(t===true)return!hasRef(e);if(!t)return false;return countKeys(e)<=t}t.inlineRef=inlineRef;const i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function hasRef(e){for(const t in e){if(i.has(t))return true;const r=e[t];if(Array.isArray(r)&&r.some(hasRef))return true;if(typeof r=="object"&&hasRef(r))return true}return false}function countKeys(e){let t=0;for(const r in e){if(r==="$ref")return Infinity;t++;if(o.has(r))continue;if(typeof e[r]=="object"){(0,s.eachItem)(e[r],(e=>t+=countKeys(e)))}if(t===Infinity)return Infinity}return t}function getFullPath(e,t="",r){if(r!==false)t=normalizeId(t);const s=e.parse(t);return _getFullPath(e,s)}t.getFullPath=getFullPath;function _getFullPath(e,t){const r=e.serialize(t);return r.split("#")[0]+"#"}t._getFullPath=_getFullPath;const c=/#\/?$/;function normalizeId(e){return e?e.replace(c,""):""}t.normalizeId=normalizeId;function resolveUrl(e,t,r){r=normalizeId(r);return e.resolve(t,r)}t.resolveUrl=resolveUrl;const u=/^[a-z_][-a-z0-9._]*$/i;function getSchemaRefs(e,t){if(typeof e=="boolean")return{};const{schemaId:r,uriResolver:s}=this.opts;const o=normalizeId(e[r]||t);const i={"":o};const c=getFullPath(s,o,false);const l={};const d=new Set;n(e,{allKeys:true},((e,t,s,a)=>{if(a===undefined)return;const n=c+t;let o=i[a];if(typeof e[r]=="string")o=addRef.call(this,e[r]);addAnchor.call(this,e.$anchor);addAnchor.call(this,e.$dynamicAnchor);i[t]=o;function addRef(t){const r=this.opts.uriResolver.resolve;t=normalizeId(o?r(o,t):t);if(d.has(t))throw ambiguos(t);d.add(t);let s=this.refs[t];if(typeof s=="string")s=this.refs[s];if(typeof s=="object"){checkAmbiguosRef(e,s.schema,t)}else if(t!==normalizeId(n)){if(t[0]==="#"){checkAmbiguosRef(e,l[t],t);l[t]=e}else{this.refs[t]=n}}return t}function addAnchor(e){if(typeof e=="string"){if(!u.test(e))throw new Error(`invalid anchor "${e}"`);addRef.call(this,`#${e}`)}}}));return l;function checkAmbiguosRef(e,t,r){if(t!==undefined&&!a(e,t))throw ambiguos(r)}function ambiguos(e){return new Error(`reference "${e}" resolves to more than one schema`)}}t.getSchemaRefs=getSchemaRefs},3145:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getRules=t.isJSONType=void 0;const r=["string","number","integer","boolean","null","object","array"];const s=new Set(r);function isJSONType(e){return typeof e=="string"&&s.has(e)}t.isJSONType=isJSONType;function getRules(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:true,boolean:true,null:true},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}t.getRules=getRules},5470:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;const s=r(7794);const a=r(7621);function toHash(e){const t={};for(const r of e)t[r]=true;return t}t.toHash=toHash;function alwaysValidSchema(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return true;checkUnknownRules(e,t);return!schemaHasRules(t,e.self.RULES.all)}t.alwaysValidSchema=alwaysValidSchema;function checkUnknownRules(e,t=e.schema){const{opts:r,self:s}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;const a=s.RULES.keywords;for(const r in t){if(!a[r])checkStrictMode(e,`unknown keyword: "${r}"`)}}t.checkUnknownRules=checkUnknownRules;function schemaHasRules(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(t[r])return true;return false}t.schemaHasRules=schemaHasRules;function schemaHasRulesButRef(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(r!=="$ref"&&t.all[r])return true;return false}t.schemaHasRulesButRef=schemaHasRulesButRef;function schemaRefOrVal({topSchemaRef:e,schemaPath:t},r,a,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,s._)`${r}`}return(0,s._)`${e}${t}${(0,s.getProperty)(a)}`}t.schemaRefOrVal=schemaRefOrVal;function unescapeFragment(e){return unescapeJsonPointer(decodeURIComponent(e))}t.unescapeFragment=unescapeFragment;function escapeFragment(e){return encodeURIComponent(escapeJsonPointer(e))}t.escapeFragment=escapeFragment;function escapeJsonPointer(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}t.escapeJsonPointer=escapeJsonPointer;function unescapeJsonPointer(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}t.unescapeJsonPointer=unescapeJsonPointer;function eachItem(e,t){if(Array.isArray(e)){for(const r of e)t(r)}else{t(e)}}t.eachItem=eachItem;function makeMergeEvaluated({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:a}){return(n,o,i,c)=>{const u=i===undefined?o:i instanceof s.Name?(o instanceof s.Name?e(n,o,i):t(n,o,i),i):o instanceof s.Name?(t(n,i,o),o):r(o,i);return c===s.Name&&!(u instanceof s.Name)?a(n,u):u}}t.mergeEvaluated={props:makeMergeEvaluated({mergeNames:(e,t,r)=>e.if((0,s._)`${r} !== true && ${t} !== undefined`,(()=>{e.if((0,s._)`${t} === true`,(()=>e.assign(r,true)),(()=>e.assign(r,(0,s._)`${r} || {}`).code((0,s._)`Object.assign(${r}, ${t})`)))})),mergeToName:(e,t,r)=>e.if((0,s._)`${r} !== true`,(()=>{if(t===true){e.assign(r,true)}else{e.assign(r,(0,s._)`${r} || {}`);setEvaluated(e,r,t)}})),mergeValues:(e,t)=>e===true?true:{...e,...t},resultToName:evaluatedPropsToName}),items:makeMergeEvaluated({mergeNames:(e,t,r)=>e.if((0,s._)`${r} !== true && ${t} !== undefined`,(()=>e.assign(r,(0,s._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`))),mergeToName:(e,t,r)=>e.if((0,s._)`${r} !== true`,(()=>e.assign(r,t===true?true:(0,s._)`${r} > ${t} ? ${r} : ${t}`))),mergeValues:(e,t)=>e===true?true:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function evaluatedPropsToName(e,t){if(t===true)return e.var("props",true);const r=e.var("props",(0,s._)`{}`);if(t!==undefined)setEvaluated(e,r,t);return r}t.evaluatedPropsToName=evaluatedPropsToName;function setEvaluated(e,t,r){Object.keys(r).forEach((r=>e.assign((0,s._)`${t}${(0,s.getProperty)(r)}`,true)))}t.setEvaluated=setEvaluated;const n={};function useFunc(e,t){return e.scopeValue("func",{ref:t,code:n[t.code]||(n[t.code]=new a._Code(t.code))})}t.useFunc=useFunc;var o;(function(e){e[e["Num"]=0]="Num";e[e["Str"]=1]="Str"})(o=t.Type||(t.Type={}));function getErrorPath(e,t,r){if(e instanceof s.Name){const a=t===o.Num;return r?a?(0,s._)`"[" + ${e} + "]"`:(0,s._)`"['" + ${e} + "']"`:a?(0,s._)`"/" + ${e}`:(0,s._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,s.getProperty)(e).toString():"/"+escapeJsonPointer(e)}t.getErrorPath=getErrorPath;function checkStrictMode(e,t,r=e.opts.strictSchema){if(!r)return;t=`strict mode: ${t}`;if(r===true)throw new Error(t);e.self.logger.warn(t)}t.checkStrictMode=checkStrictMode},6693:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0;function schemaHasRulesForType({schema:e,self:t},r){const s=t.RULES.types[r];return s&&s!==true&&shouldUseGroup(e,s)}t.schemaHasRulesForType=schemaHasRulesForType;function shouldUseGroup(e,t){return t.rules.some((t=>shouldUseRule(e,t)))}t.shouldUseGroup=shouldUseGroup;function shouldUseRule(e,t){var r;return e[t.keyword]!==undefined||((r=t.definition.implements)===null||r===void 0?void 0:r.some((t=>e[t]!==undefined)))}t.shouldUseRule=shouldUseRule},7353:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;const s=r(4337);const a=r(7794);const n=r(8030);const o={message:"boolean schema is false"};function topBoolOrEmptySchema(e){const{gen:t,schema:r,validateName:s}=e;if(r===false){falseSchemaError(e,false)}else if(typeof r=="object"&&r.$async===true){t.return(n.default.data)}else{t.assign((0,a._)`${s}.errors`,null);t.return(true)}}t.topBoolOrEmptySchema=topBoolOrEmptySchema;function boolOrEmptySchema(e,t){const{gen:r,schema:s}=e;if(s===false){r.var(t,false);falseSchemaError(e)}else{r.var(t,true)}}t.boolOrEmptySchema=boolOrEmptySchema;function falseSchemaError(e,t){const{gen:r,data:a}=e;const n={gen:r,keyword:"false schema",data:a,schema:false,schemaCode:false,schemaValue:false,params:{},it:e};(0,s.reportError)(n,o,undefined,t)}},7795:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;const s=r(3145);const a=r(6693);const n=r(4337);const o=r(7794);const i=r(5470);var c;(function(e){e[e["Correct"]=0]="Correct";e[e["Wrong"]=1]="Wrong"})(c=t.DataType||(t.DataType={}));function getSchemaTypes(e){const t=getJSONTypes(e.type);const r=t.includes("null");if(r){if(e.nullable===false)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==undefined){throw new Error('"nullable" cannot be used without "type"')}if(e.nullable===true)t.push("null")}return t}t.getSchemaTypes=getSchemaTypes;function getJSONTypes(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(s.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}t.getJSONTypes=getJSONTypes;function coerceAndCheckDataType(e,t){const{gen:r,data:s,opts:n}=e;const o=coerceToTypes(t,n.coerceTypes);const i=t.length>0&&!(o.length===0&&t.length===1&&(0,a.schemaHasRulesForType)(e,t[0]));if(i){const a=checkDataTypes(t,s,n.strictNumbers,c.Wrong);r.if(a,(()=>{if(o.length)coerceData(e,t,o);else reportTypeError(e)}))}return i}t.coerceAndCheckDataType=coerceAndCheckDataType;const u=new Set(["string","number","integer","boolean","null"]);function coerceToTypes(e,t){return t?e.filter((e=>u.has(e)||t==="array"&&e==="array")):[]}function coerceData(e,t,r){const{gen:s,data:a,opts:n}=e;const i=s.let("dataType",(0,o._)`typeof ${a}`);const c=s.let("coerced",(0,o._)`undefined`);if(n.coerceTypes==="array"){s.if((0,o._)`${i} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,(()=>s.assign(a,(0,o._)`${a}[0]`).assign(i,(0,o._)`typeof ${a}`).if(checkDataTypes(t,a,n.strictNumbers),(()=>s.assign(c,a)))))}s.if((0,o._)`${c} !== undefined`);for(const e of r){if(u.has(e)||e==="array"&&n.coerceTypes==="array"){coerceSpecificType(e)}}s.else();reportTypeError(e);s.endIf();s.if((0,o._)`${c} !== undefined`,(()=>{s.assign(a,c);assignParentData(e,c)}));function coerceSpecificType(e){switch(e){case"string":s.elseIf((0,o._)`${i} == "number" || ${i} == "boolean"`).assign(c,(0,o._)`"" + ${a}`).elseIf((0,o._)`${a} === null`).assign(c,(0,o._)`""`);return;case"number":s.elseIf((0,o._)`${i} == "boolean" || ${a} === null + || (${i} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,o._)`+${a}`);return;case"integer":s.elseIf((0,o._)`${i} === "boolean" || ${a} === null + || (${i} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(c,(0,o._)`+${a}`);return;case"boolean":s.elseIf((0,o._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(c,false).elseIf((0,o._)`${a} === "true" || ${a} === 1`).assign(c,true);return;case"null":s.elseIf((0,o._)`${a} === "" || ${a} === 0 || ${a} === false`);s.assign(c,null);return;case"array":s.elseIf((0,o._)`${i} === "string" || ${i} === "number" + || ${i} === "boolean" || ${a} === null`).assign(c,(0,o._)`[${a}]`)}}}function assignParentData({gen:e,parentData:t,parentDataProperty:r},s){e.if((0,o._)`${t} !== undefined`,(()=>e.assign((0,o._)`${t}[${r}]`,s)))}function checkDataType(e,t,r,s=c.Correct){const a=s===c.Correct?o.operators.EQ:o.operators.NEQ;let n;switch(e){case"null":return(0,o._)`${t} ${a} null`;case"array":n=(0,o._)`Array.isArray(${t})`;break;case"object":n=(0,o._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":n=numCond((0,o._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":n=numCond();break;default:return(0,o._)`typeof ${t} ${a} ${e}`}return s===c.Correct?n:(0,o.not)(n);function numCond(e=o.nil){return(0,o.and)((0,o._)`typeof ${t} == "number"`,e,r?(0,o._)`isFinite(${t})`:o.nil)}}t.checkDataType=checkDataType;function checkDataTypes(e,t,r,s){if(e.length===1){return checkDataType(e[0],t,r,s)}let a;const n=(0,i.toHash)(e);if(n.array&&n.object){const e=(0,o._)`typeof ${t} != "object"`;a=n.null?e:(0,o._)`!${t} || ${e}`;delete n.null;delete n.array;delete n.object}else{a=o.nil}if(n.number)delete n.integer;for(const e in n)a=(0,o.and)(a,checkDataType(e,t,r,s));return a}t.checkDataTypes=checkDataTypes;const l={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,o._)`{type: ${e}}`:(0,o._)`{type: ${t}}`};function reportTypeError(e){const t=getTypeErrorContext(e);(0,n.reportError)(t,l)}t.reportTypeError=reportTypeError;function getTypeErrorContext(e){const{gen:t,data:r,schema:s}=e;const a=(0,i.schemaRefOrVal)(e,s,"type");return{gen:t,keyword:"type",data:r,schema:s.type,schemaCode:a,schemaValue:a,parentSchema:s,params:{},it:e}}},2798:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.assignDefaults=void 0;const s=r(7794);const a=r(5470);function assignDefaults(e,t){const{properties:r,items:s}=e.schema;if(t==="object"&&r){for(const t in r){assignDefault(e,t,r[t].default)}}else if(t==="array"&&Array.isArray(s)){s.forEach(((t,r)=>assignDefault(e,r,t.default)))}}t.assignDefaults=assignDefaults;function assignDefault(e,t,r){const{gen:n,compositeRule:o,data:i,opts:c}=e;if(r===undefined)return;const u=(0,s._)`${i}${(0,s.getProperty)(t)}`;if(o){(0,a.checkStrictMode)(e,`default is ignored for: ${u}`);return}let l=(0,s._)`${u} === undefined`;if(c.useDefaults==="empty"){l=(0,s._)`${l} || ${u} === null || ${u} === ""`}n.if(l,(0,s._)`${u} = ${(0,s.stringify)(r)}`)}},2069:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;const s=r(7353);const a=r(7795);const n=r(6693);const o=r(7795);const i=r(2798);const c=r(5522);const u=r(1298);const l=r(7794);const d=r(8030);const f=r(8241);const p=r(5470);const h=r(4337);function validateFunctionCode(e){if(isSchemaObj(e)){checkKeywords(e);if(schemaCxtHasRules(e)){topSchemaObjCode(e);return}}validateFunction(e,(()=>(0,s.topBoolOrEmptySchema)(e)))}t.validateFunctionCode=validateFunctionCode;function validateFunction({gen:e,validateName:t,schema:r,schemaEnv:s,opts:a},n){if(a.code.es5){e.func(t,(0,l._)`${d.default.data}, ${d.default.valCxt}`,s.$async,(()=>{e.code((0,l._)`"use strict"; ${funcSourceUrl(r,a)}`);destructureValCxtES5(e,a);e.code(n)}))}else{e.func(t,(0,l._)`${d.default.data}, ${destructureValCxt(a)}`,s.$async,(()=>e.code(funcSourceUrl(r,a)).code(n)))}}function destructureValCxt(e){return(0,l._)`{${d.default.instancePath}="", ${d.default.parentData}, ${d.default.parentDataProperty}, ${d.default.rootData}=${d.default.data}${e.dynamicRef?(0,l._)`, ${d.default.dynamicAnchors}={}`:l.nil}}={}`}function destructureValCxtES5(e,t){e.if(d.default.valCxt,(()=>{e.var(d.default.instancePath,(0,l._)`${d.default.valCxt}.${d.default.instancePath}`);e.var(d.default.parentData,(0,l._)`${d.default.valCxt}.${d.default.parentData}`);e.var(d.default.parentDataProperty,(0,l._)`${d.default.valCxt}.${d.default.parentDataProperty}`);e.var(d.default.rootData,(0,l._)`${d.default.valCxt}.${d.default.rootData}`);if(t.dynamicRef)e.var(d.default.dynamicAnchors,(0,l._)`${d.default.valCxt}.${d.default.dynamicAnchors}`)}),(()=>{e.var(d.default.instancePath,(0,l._)`""`);e.var(d.default.parentData,(0,l._)`undefined`);e.var(d.default.parentDataProperty,(0,l._)`undefined`);e.var(d.default.rootData,d.default.data);if(t.dynamicRef)e.var(d.default.dynamicAnchors,(0,l._)`{}`)}))}function topSchemaObjCode(e){const{schema:t,opts:r,gen:s}=e;validateFunction(e,(()=>{if(r.$comment&&t.$comment)commentKeyword(e);checkNoDefault(e);s.let(d.default.vErrors,null);s.let(d.default.errors,0);if(r.unevaluated)resetEvaluated(e);typeAndKeywords(e);returnResults(e)}));return}function resetEvaluated(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,l._)`${r}.evaluated`);t.if((0,l._)`${e.evaluated}.dynamicProps`,(()=>t.assign((0,l._)`${e.evaluated}.props`,(0,l._)`undefined`)));t.if((0,l._)`${e.evaluated}.dynamicItems`,(()=>t.assign((0,l._)`${e.evaluated}.items`,(0,l._)`undefined`)))}function funcSourceUrl(e,t){const r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,l._)`/*# sourceURL=${r} */`:l.nil}function subschemaCode(e,t){if(isSchemaObj(e)){checkKeywords(e);if(schemaCxtHasRules(e)){subSchemaObjCode(e,t);return}}(0,s.boolOrEmptySchema)(e,t)}function schemaCxtHasRules({schema:e,self:t}){if(typeof e=="boolean")return!e;for(const r in e)if(t.RULES.all[r])return true;return false}function isSchemaObj(e){return typeof e.schema!="boolean"}function subSchemaObjCode(e,t){const{schema:r,gen:s,opts:a}=e;if(a.$comment&&r.$comment)commentKeyword(e);updateContext(e);checkAsyncSchema(e);const n=s.const("_errs",d.default.errors);typeAndKeywords(e,n);s.var(t,(0,l._)`${n} === ${d.default.errors}`)}function checkKeywords(e){(0,p.checkUnknownRules)(e);checkRefsAndKeywords(e)}function typeAndKeywords(e,t){if(e.opts.jtd)return schemaKeywords(e,[],false,t);const r=(0,a.getSchemaTypes)(e.schema);const s=(0,a.coerceAndCheckDataType)(e,r);schemaKeywords(e,r,!s,t)}function checkRefsAndKeywords(e){const{schema:t,errSchemaPath:r,opts:s,self:a}=e;if(t.$ref&&s.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(t,a.RULES)){a.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}}function checkNoDefault(e){const{schema:t,opts:r}=e;if(t.default!==undefined&&r.useDefaults&&r.strictSchema){(0,p.checkStrictMode)(e,"default is ignored in the schema root")}}function updateContext(e){const t=e.schema[e.opts.schemaId];if(t)e.baseId=(0,f.resolveUrl)(e.opts.uriResolver,e.baseId,t)}function checkAsyncSchema(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function commentKeyword({gen:e,schemaEnv:t,schema:r,errSchemaPath:s,opts:a}){const n=r.$comment;if(a.$comment===true){e.code((0,l._)`${d.default.self}.logger.log(${n})`)}else if(typeof a.$comment=="function"){const r=(0,l.str)`${s}/$comment`;const a=e.scopeValue("root",{ref:t.root});e.code((0,l._)`${d.default.self}.opts.$comment(${n}, ${r}, ${a}.schema)`)}}function returnResults(e){const{gen:t,schemaEnv:r,validateName:s,ValidationError:a,opts:n}=e;if(r.$async){t.if((0,l._)`${d.default.errors} === 0`,(()=>t.return(d.default.data)),(()=>t.throw((0,l._)`new ${a}(${d.default.vErrors})`)))}else{t.assign((0,l._)`${s}.errors`,d.default.vErrors);if(n.unevaluated)assignEvaluated(e);t.return((0,l._)`${d.default.errors} === 0`)}}function assignEvaluated({gen:e,evaluated:t,props:r,items:s}){if(r instanceof l.Name)e.assign((0,l._)`${t}.props`,r);if(s instanceof l.Name)e.assign((0,l._)`${t}.items`,s)}function schemaKeywords(e,t,r,s){const{gen:a,schema:i,data:c,allErrors:u,opts:f,self:h}=e;const{RULES:m}=h;if(i.$ref&&(f.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(i,m))){a.block((()=>keywordCode(e,"$ref",m.all.$ref.definition)));return}if(!f.jtd)checkStrictTypes(e,t);a.block((()=>{for(const e of m.rules)groupKeywords(e);groupKeywords(m.post)}));function groupKeywords(p){if(!(0,n.shouldUseGroup)(i,p))return;if(p.type){a.if((0,o.checkDataType)(p.type,c,f.strictNumbers));iterateKeywords(e,p);if(t.length===1&&t[0]===p.type&&r){a.else();(0,o.reportTypeError)(e)}a.endIf()}else{iterateKeywords(e,p)}if(!u)a.if((0,l._)`${d.default.errors} === ${s||0}`)}}function iterateKeywords(e,t){const{gen:r,schema:s,opts:{useDefaults:a}}=e;if(a)(0,i.assignDefaults)(e,t.type);r.block((()=>{for(const r of t.rules){if((0,n.shouldUseRule)(s,r)){keywordCode(e,r.keyword,r.definition,t.type)}}}))}function checkStrictTypes(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;checkContextTypes(e,t);if(!e.opts.allowUnionTypes)checkMultipleTypes(e,t);checkKeywordTypes(e,e.dataTypes)}function checkContextTypes(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((t=>{if(!includesType(e.dataTypes,t)){strictTypesError(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}}));e.dataTypes=e.dataTypes.filter((e=>includesType(t,e)))}function checkMultipleTypes(e,t){if(t.length>1&&!(t.length===2&&t.includes("null"))){strictTypesError(e,"use allowUnionTypes to allow union type keyword")}}function checkKeywordTypes(e,t){const r=e.self.RULES.all;for(const s in r){const a=r[s];if(typeof a=="object"&&(0,n.shouldUseRule)(e.schema,a)){const{type:r}=a.definition;if(r.length&&!r.some((e=>hasApplicableType(t,e)))){strictTypesError(e,`missing type "${r.join(",")}" for keyword "${s}"`)}}}}function hasApplicableType(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function includesType(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function strictTypesError(e,t){const r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`;(0,p.checkStrictMode)(e,t,e.opts.strictTypes)}class KeywordCxt{constructor(e,t,r){(0,c.validateKeywordUsage)(e,t,r);this.gen=e.gen;this.allErrors=e.allErrors;this.keyword=r;this.data=e.data;this.schema=e.schema[r];this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data;this.schemaValue=(0,p.schemaRefOrVal)(e,this.schema,r,this.$data);this.schemaType=t.schemaType;this.parentSchema=e.schema;this.params={};this.it=e;this.def=t;if(this.$data){this.schemaCode=e.gen.const("vSchema",getData(this.$data,e))}else{this.schemaCode=this.schemaValue;if(!(0,c.validSchemaType)(this.schema,t.schemaType,t.allowUndefined)){throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`)}}if("code"in t?t.trackErrors:t.errors!==false){this.errsCount=e.gen.const("_errs",d.default.errors)}}result(e,t,r){this.failResult((0,l.not)(e),t,r)}failResult(e,t,r){this.gen.if(e);if(r)r();else this.error();if(t){this.gen.else();t();if(this.allErrors)this.gen.endIf()}else{if(this.allErrors)this.gen.endIf();else this.gen.else()}}pass(e,t){this.failResult((0,l.not)(e),undefined,t)}fail(e){if(e===undefined){this.error();if(!this.allErrors)this.gen.if(false);return}this.gen.if(e);this.error();if(this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail((0,l._)`${t} !== undefined && (${(0,l.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t);this._error(e,r);this.setParams({});return}this._error(e,r)}_error(e,t){(e?h.reportExtraError:h.reportError)(this,this.def.error,t)}$dataError(){(0,h.reportError)(this,this.def.$dataError||h.keyword$DataError)}reset(){if(this.errsCount===undefined)throw new Error('add "trackErrors" to keyword definition');(0,h.resetErrorsCount)(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=l.nil){this.gen.block((()=>{this.check$data(e,r);t()}))}check$data(e=l.nil,t=l.nil){if(!this.$data)return;const{gen:r,schemaCode:s,schemaType:a,def:n}=this;r.if((0,l.or)((0,l._)`${s} === undefined`,t));if(e!==l.nil)r.assign(e,true);if(a.length||n.validateSchema){r.elseIf(this.invalid$data());this.$dataError();if(e!==l.nil)r.assign(e,false)}r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:s,it:a}=this;return(0,l.or)(wrong$DataType(),invalid$DataSchema());function wrong$DataType(){if(r.length){if(!(t instanceof l.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return(0,l._)`${(0,o.checkDataTypes)(e,t,a.opts.strictNumbers,o.DataType.Wrong)}`}return l.nil}function invalid$DataSchema(){if(s.validateSchema){const r=e.scopeValue("validate$data",{ref:s.validateSchema});return(0,l._)`!${r}(${t})`}return l.nil}}subschema(e,t){const r=(0,u.getSubschema)(this.it,e);(0,u.extendSubschemaData)(r,this.it,e);(0,u.extendSubschemaMode)(r,e);const s={...this.it,...r,items:undefined,props:undefined};subschemaCode(s,t);return s}mergeEvaluated(e,t){const{it:r,gen:s}=this;if(!r.opts.unevaluated)return;if(r.props!==true&&e.props!==undefined){r.props=p.mergeEvaluated.props(s,e.props,r.props,t)}if(r.items!==true&&e.items!==undefined){r.items=p.mergeEvaluated.items(s,e.items,r.items,t)}}mergeValidEvaluated(e,t){const{it:r,gen:s}=this;if(r.opts.unevaluated&&(r.props!==true||r.items!==true)){s.if(t,(()=>this.mergeEvaluated(e,l.Name)));return true}}}t.KeywordCxt=KeywordCxt;function keywordCode(e,t,r,s){const a=new KeywordCxt(e,r,t);if("code"in r){r.code(a,s)}else if(a.$data&&r.validate){(0,c.funcKeywordCode)(a,r)}else if("macro"in r){(0,c.macroKeywordCode)(a,r)}else if(r.compile||r.validate){(0,c.funcKeywordCode)(a,r)}}const m=/^\/(?:[^~]|~0|~1)*$/;const y=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function getData(e,{dataLevel:t,dataNames:r,dataPathArr:s}){let a;let n;if(e==="")return d.default.rootData;if(e[0]==="/"){if(!m.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);a=e;n=d.default.rootData}else{const o=y.exec(e);if(!o)throw new Error(`Invalid JSON-pointer: ${e}`);const i=+o[1];a=o[2];if(a==="#"){if(i>=t)throw new Error(errorMsg("property/index",i));return s[t-i]}if(i>t)throw new Error(errorMsg("data",i));n=r[t-i];if(!a)return n}let o=n;const i=a.split("/");for(const e of i){if(e){n=(0,l._)`${n}${(0,l.getProperty)((0,p.unescapeJsonPointer)(e))}`;o=(0,l._)`${o} && ${n}`}}return o;function errorMsg(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}t.getData=getData},5522:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;const s=r(7794);const a=r(8030);const n=r(1139);const o=r(4337);function macroKeywordCode(e,t){const{gen:r,keyword:a,schema:n,parentSchema:o,it:i}=e;const c=t.macro.call(i.self,n,o,i);const u=useKeyword(r,a,c);if(i.opts.validateSchema!==false)i.self.validateSchema(c,true);const l=r.name("valid");e.subschema({schema:c,schemaPath:s.nil,errSchemaPath:`${i.errSchemaPath}/${a}`,topSchemaRef:u,compositeRule:true},l);e.pass(l,(()=>e.error(true)))}t.macroKeywordCode=macroKeywordCode;function funcKeywordCode(e,t){var r;const{gen:o,keyword:i,schema:c,parentSchema:u,$data:l,it:d}=e;checkAsyncKeyword(d,t);const f=!l&&t.compile?t.compile.call(d.self,c,u,d):t.validate;const p=useKeyword(o,i,f);const h=o.let("valid");e.block$data(h,validateKeyword);e.ok((r=t.valid)!==null&&r!==void 0?r:h);function validateKeyword(){if(t.errors===false){assignValid();if(t.modifying)modifyData(e);reportErrs((()=>e.error()))}else{const r=t.async?validateAsync():validateSync();if(t.modifying)modifyData(e);reportErrs((()=>addErrs(e,r)))}}function validateAsync(){const e=o.let("ruleErrs",null);o.try((()=>assignValid((0,s._)`await `)),(t=>o.assign(h,false).if((0,s._)`${t} instanceof ${d.ValidationError}`,(()=>o.assign(e,(0,s._)`${t}.errors`)),(()=>o.throw(t)))));return e}function validateSync(){const e=(0,s._)`${p}.errors`;o.assign(e,null);assignValid(s.nil);return e}function assignValid(r=(t.async?(0,s._)`await `:s.nil)){const i=d.opts.passContext?a.default.this:a.default.self;const c=!("compile"in t&&!l||t.schema===false);o.assign(h,(0,s._)`${r}${(0,n.callValidateCode)(e,p,i,c)}`,t.modifying)}function reportErrs(e){var r;o.if((0,s.not)((r=t.valid)!==null&&r!==void 0?r:h),e)}}t.funcKeywordCode=funcKeywordCode;function modifyData(e){const{gen:t,data:r,it:a}=e;t.if(a.parentData,(()=>t.assign(r,(0,s._)`${a.parentData}[${a.parentDataProperty}]`)))}function addErrs(e,t){const{gen:r}=e;r.if((0,s._)`Array.isArray(${t})`,(()=>{r.assign(a.default.vErrors,(0,s._)`${a.default.vErrors} === null ? ${t} : ${a.default.vErrors}.concat(${t})`).assign(a.default.errors,(0,s._)`${a.default.vErrors}.length`);(0,o.extendErrors)(e)}),(()=>e.error()))}function checkAsyncKeyword({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function useKeyword(e,t,r){if(r===undefined)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,s.stringify)(r)})}function validSchemaType(e,t,r=false){return!t.length||t.some((t=>t==="array"?Array.isArray(e):t==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==t||r&&typeof e=="undefined"))}t.validSchemaType=validSchemaType;function validateKeywordUsage({schema:e,opts:t,self:r,errSchemaPath:s},a,n){if(Array.isArray(a.keyword)?!a.keyword.includes(n):a.keyword!==n){throw new Error("ajv implementation error")}const o=a.dependencies;if(o===null||o===void 0?void 0:o.some((t=>!Object.prototype.hasOwnProperty.call(e,t)))){throw new Error(`parent schema must have dependencies of ${n}: ${o.join(",")}`)}if(a.validateSchema){const o=a.validateSchema(e[n]);if(!o){const e=`keyword "${n}" value is invalid at path "${s}": `+r.errorsText(a.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(e);else throw new Error(e)}}}t.validateKeywordUsage=validateKeywordUsage},1298:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;const s=r(7794);const a=r(5470);function getSubschema(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:c}){if(t!==undefined&&n!==undefined){throw new Error('both "keyword" and "schema" passed, only one allowed')}if(t!==undefined){const n=e.schema[t];return r===undefined?{schema:n,schemaPath:(0,s._)`${e.schemaPath}${(0,s.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:n[r],schemaPath:(0,s._)`${e.schemaPath}${(0,s.getProperty)(t)}${(0,s.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,a.escapeFragment)(r)}`}}if(n!==undefined){if(o===undefined||i===undefined||c===undefined){throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"')}return{schema:n,schemaPath:o,topSchemaRef:c,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}t.getSubschema=getSubschema;function extendSubschemaData(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:c}){if(o!==undefined&&r!==undefined){throw new Error('both "data" and "dataProp" passed, only one allowed')}const{gen:u}=t;if(r!==undefined){const{errorPath:o,dataPathArr:i,opts:c}=t;const l=u.let("data",(0,s._)`${t.data}${(0,s.getProperty)(r)}`,true);dataContextProps(l);e.errorPath=(0,s.str)`${o}${(0,a.getErrorPath)(r,n,c.jsPropertySyntax)}`;e.parentDataProperty=(0,s._)`${r}`;e.dataPathArr=[...i,e.parentDataProperty]}if(o!==undefined){const t=o instanceof s.Name?o:u.let("data",o,true);dataContextProps(t);if(c!==undefined)e.propertyName=c}if(i)e.dataTypes=i;function dataContextProps(r){e.data=r;e.dataLevel=t.dataLevel+1;e.dataTypes=[];t.definedProperties=new Set;e.parentData=t.data;e.dataNames=[...t.dataNames,r]}}t.extendSubschemaData=extendSubschemaData;function extendSubschemaMode(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:s,createErrors:a,allErrors:n}){if(s!==undefined)e.compositeRule=s;if(a!==undefined)e.createErrors=a;if(n!==undefined)e.allErrors=n;e.jtdDiscriminator=t;e.jtdMetadata=r}t.extendSubschemaMode=extendSubschemaMode},2046:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var s=r(2069);Object.defineProperty(t,"KeywordCxt",{enumerable:true,get:function(){return s.KeywordCxt}});var a=r(7794);Object.defineProperty(t,"_",{enumerable:true,get:function(){return a._}});Object.defineProperty(t,"str",{enumerable:true,get:function(){return a.str}});Object.defineProperty(t,"stringify",{enumerable:true,get:function(){return a.stringify}});Object.defineProperty(t,"nil",{enumerable:true,get:function(){return a.nil}});Object.defineProperty(t,"Name",{enumerable:true,get:function(){return a.Name}});Object.defineProperty(t,"CodeGen",{enumerable:true,get:function(){return a.CodeGen}});const n=r(4591);const o=r(7983);const i=r(3145);const c=r(8612);const u=r(7794);const l=r(8241);const d=r(7795);const f=r(5470);const p=r(7918);const h=r(6250);const defaultRegExp=(e,t)=>new RegExp(e,t);defaultRegExp.code="new RegExp";const m=["removeAdditional","useDefaults","coerceTypes"];const y=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]);const g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."};const v={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};const $=200;function requiredOptions(e){var t,r,s,a,n,o,i,c,u,l,d,f,p,m,y,g,v,b,w,E,S,P,C,x,k;const N=e.strict;const O=(t=e.code)===null||t===void 0?void 0:t.optimize;const R=O===true||O===undefined?1:O||0;const T=(s=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&s!==void 0?s:defaultRegExp;const j=(a=e.uriResolver)!==null&&a!==void 0?a:h.default;return{strictSchema:(o=(n=e.strictSchema)!==null&&n!==void 0?n:N)!==null&&o!==void 0?o:true,strictNumbers:(c=(i=e.strictNumbers)!==null&&i!==void 0?i:N)!==null&&c!==void 0?c:true,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:N)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=e.strictTuples)!==null&&d!==void 0?d:N)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=e.strictRequired)!==null&&p!==void 0?p:N)!==null&&m!==void 0?m:false,code:e.code?{...e.code,optimize:R,regExp:T}:{optimize:R,regExp:T},loopRequired:(y=e.loopRequired)!==null&&y!==void 0?y:$,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:$,meta:(v=e.meta)!==null&&v!==void 0?v:true,messages:(b=e.messages)!==null&&b!==void 0?b:true,inlineRefs:(w=e.inlineRefs)!==null&&w!==void 0?w:true,schemaId:(E=e.schemaId)!==null&&E!==void 0?E:"$id",addUsedSchema:(S=e.addUsedSchema)!==null&&S!==void 0?S:true,validateSchema:(P=e.validateSchema)!==null&&P!==void 0?P:true,validateFormats:(C=e.validateFormats)!==null&&C!==void 0?C:true,unicodeRegExp:(x=e.unicodeRegExp)!==null&&x!==void 0?x:true,int32range:(k=e.int32range)!==null&&k!==void 0?k:true,uriResolver:j}}class Ajv{constructor(e={}){this.schemas={};this.refs={};this.formats={};this._compilations=new Set;this._loading={};this._cache=new Map;e=this.opts={...e,...requiredOptions(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new u.ValueScope({scope:{},prefixes:y,es5:t,lines:r});this.logger=getLogger(e.logger);const s=e.validateFormats;e.validateFormats=false;this.RULES=(0,i.getRules)();checkOptions.call(this,g,e,"NOT SUPPORTED");checkOptions.call(this,v,e,"DEPRECATED","warn");this._metaOpts=getMetaSchemaOptions.call(this);if(e.formats)addInitialFormats.call(this);this._addVocabularies();this._addDefaultMetaSchema();if(e.keywords)addInitialKeywords.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);addInitialSchemas.call(this);e.validateFormats=s}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let s=p;if(r==="id"){s={...p};s.id=s.$id;delete s.$id}if(t&&e)this.addMetaSchema(s,s[r],false)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:undefined}validate(e,t){let r;if(typeof e=="string"){r=this.getSchema(e);if(!r)throw new Error(`no schema with key or ref "${e}"`)}else{r=this.compile(e)}const s=r(t);if(!("$async"in r))this.errors=r.errors;return s}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function"){throw new Error("options.loadSchema should be a function")}const{loadSchema:r}=this.opts;return runCompileAsync.call(this,e,t);async function runCompileAsync(e,t){await loadMetaSchema.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||_compileAsync.call(this,r)}async function loadMetaSchema(e){if(e&&!this.getSchema(e)){await runCompileAsync.call(this,{$ref:e},true)}}async function _compileAsync(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof o.default))throw t;checkLoaded.call(this,t);await loadMissingSchema.call(this,t.missingSchema);return _compileAsync.call(this,e)}}function checkLoaded({missingSchema:e,missingRef:t}){if(this.refs[e]){throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}}async function loadMissingSchema(e){const r=await _loadSchema.call(this,e);if(!this.refs[e])await loadMetaSchema.call(this,r.$schema);if(!this.refs[e])this.addSchema(r,e,t)}async function _loadSchema(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,s=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,undefined,r,s);return this}let a;if(typeof e==="object"){const{schemaId:t}=this.opts;a=e[t];if(a!==undefined&&typeof a!="string"){throw new Error(`schema ${t} must be string`)}}t=(0,l.normalizeId)(t||a);this._checkUnique(t);this.schemas[t]=this._addSchema(e,r,t,s,true);return this}addMetaSchema(e,t,r=this.opts.validateSchema){this.addSchema(e,t,true,r);return this}validateSchema(e,t){if(typeof e=="boolean")return true;let r;r=e.$schema;if(r!==undefined&&typeof r!="string"){throw new Error("$schema must be a string")}r=r||this.opts.defaultMeta||this.defaultMeta();if(!r){this.logger.warn("meta-schema not available");this.errors=null;return true}const s=this.validate(r,e);if(!s&&t){const e="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(e);else throw new Error(e)}return s}getSchema(e){let t;while(typeof(t=getSchEnv.call(this,e))=="string")e=t;if(t===undefined){const{schemaId:r}=this.opts;const s=new c.SchemaEnv({schema:{},schemaId:r});t=c.resolveSchema.call(this,s,e);if(!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp){this._removeAllSchemas(this.schemas,e);this._removeAllSchemas(this.refs,e);return this}switch(typeof e){case"undefined":this._removeAllSchemas(this.schemas);this._removeAllSchemas(this.refs);this._cache.clear();return this;case"string":{const t=getSchEnv.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);delete this.schemas[e];delete this.refs[e];return this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r){r=(0,l.normalizeId)(r);delete this.schemas[r];delete this.refs[r]}return this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){r=e;if(typeof t=="object"){this.logger.warn("these parameters are deprecated, see docs for addKeyword");t.keyword=r}}else if(typeof e=="object"&&t===undefined){t=e;r=t.keyword;if(Array.isArray(r)&&!r.length){throw new Error("addKeywords: keyword must be string or non-empty array")}}else{throw new Error("invalid addKeywords parameters")}checkKeyword.call(this,r,t);if(!t){(0,f.eachItem)(r,(e=>addRule.call(this,e)));return this}keywordMetaschema.call(this,t);const s={...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)};(0,f.eachItem)(r,s.type.length===0?e=>addRule.call(this,e,s):e=>s.type.forEach((t=>addRule.call(this,e,s,t))));return this}getKeyword(e){const t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e];delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex((t=>t.keyword===e));if(t>=0)r.rules.splice(t,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);this.formats[e]=t;return this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((e=>`${r}${e.instancePath} ${e.message}`)).reduce(((e,r)=>e+t+r))}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const s of t){const t=s.split("/").slice(1);let a=e;for(const e of t)a=a[e];for(const e in r){const t=r[e];if(typeof t!="object")continue;const{$data:s}=t.definition;const n=a[e];if(s&&n)a[e]=schemaOrData(n)}}return e}_removeAllSchemas(e,t){for(const r in e){const s=e[r];if(!t||t.test(r)){if(typeof s=="string"){delete e[r]}else if(s&&!s.meta){this._cache.delete(s.schema);delete e[r]}}}}_addSchema(e,t,r,s=this.opts.validateSchema,a=this.opts.addUsedSchema){let n;const{schemaId:o}=this.opts;if(typeof e=="object"){n=e[o]}else{if(this.opts.jtd)throw new Error("schema must be object");else if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let i=this._cache.get(e);if(i!==undefined)return i;r=(0,l.normalizeId)(n||r);const u=l.getSchemaRefs.call(this,e,r);i=new c.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:r,localRefs:u});this._cache.set(i.schema,i);if(a&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=i}if(s)this.validateSchema(e,true);return i}_checkUnique(e){if(this.schemas[e]||this.refs[e]){throw new Error(`schema with key or id "${e}" already exists`)}}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else c.compileSchema.call(this,e);if(!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{c.compileSchema.call(this,e)}finally{this.opts=t}}}t["default"]=Ajv;Ajv.ValidationError=n.default;Ajv.MissingRefError=o.default;function checkOptions(e,t,r,s="error"){for(const a in e){const n=a;if(n in t)this.logger[s](`${r}: option ${a}. ${e[n]}`)}}function getSchEnv(e){e=(0,l.normalizeId)(e);return this.schemas[e]||this.refs[e]}function addInitialSchemas(){const e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function addInitialFormats(){for(const e in this.opts.formats){const t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function addInitialKeywords(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function getMetaSchemaOptions(){const e={...this.opts};for(const t of m)delete e[t];return e}const b={log(){},warn(){},error(){}};function getLogger(e){if(e===false)return b;if(e===undefined)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}const w=/^[a-z_$][a-z0-9_$:-]*$/i;function checkKeyword(e,t){const{RULES:r}=this;(0,f.eachItem)(e,(e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!w.test(e))throw new Error(`Keyword ${e} has invalid name`)}));if(!t)return;if(t.$data&&!("code"in t||"validate"in t)){throw new Error('$data keyword must have "code" or "validate" function')}}function addRule(e,t,r){var s;const a=t===null||t===void 0?void 0:t.post;if(r&&a)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:n}=this;let o=a?n.post:n.rules.find((({type:e})=>e===r));if(!o){o={type:r,rules:[]};n.rules.push(o)}n.keywords[e]=true;if(!t)return;const i={keyword:e,definition:{...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)}};if(t.before)addBeforeRule.call(this,o,i,t.before);else o.rules.push(i);n.all[e]=i;(s=t.implements)===null||s===void 0?void 0:s.forEach((e=>this.addKeyword(e)))}function addBeforeRule(e,t,r){const s=e.rules.findIndex((e=>e.keyword===r));if(s>=0){e.rules.splice(s,0,t)}else{e.rules.push(t);this.logger.warn(`rule ${r} is not defined`)}}function keywordMetaschema(e){let{metaSchema:t}=e;if(t===undefined)return;if(e.$data&&this.opts.$data)t=schemaOrData(t);e.validateSchema=this.compile(t,true)}const E={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function schemaOrData(e){return{anyOf:[e,E]}}},6560:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7914);s.code='require("ajv/dist/runtime/equal").default';t["default"]=s},1528:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});function ucs2length(e){const t=e.length;let r=0;let s=0;let a;while(s=55296&&a<=56319&&s{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(8424);s.code='require("ajv/dist/runtime/uri").default';t["default"]=s},4591:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});class ValidationError extends Error{constructor(e){super("validation failed");this.errors=e;this.ajv=this.validation=true}}t["default"]=ValidationError},8366:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.validateAdditionalItems=void 0;const s=r(7794);const a=r(5470);const n={message:({params:{len:e}})=>(0,s.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,s._)`{limit: ${e}}`};const o={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:n,code(e){const{parentSchema:t,it:r}=e;const{items:s}=t;if(!Array.isArray(s)){(0,a.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}validateAdditionalItems(e,s)}};function validateAdditionalItems(e,t){const{gen:r,schema:n,data:o,keyword:i,it:c}=e;c.items=true;const u=r.const("len",(0,s._)`${o}.length`);if(n===false){e.setParams({len:t.length});e.pass((0,s._)`${u} <= ${t.length}`)}else if(typeof n=="object"&&!(0,a.alwaysValidSchema)(c,n)){const a=r.var("valid",(0,s._)`${u} <= ${t.length}`);r.if((0,s.not)(a),(()=>validateItems(a)));e.ok(a)}function validateItems(n){r.forRange("i",t.length,u,(t=>{e.subschema({keyword:i,dataProp:t,dataPropType:a.Type.Num},n);if(!c.allErrors)r.if((0,s.not)(n),(()=>r.break()))}))}}t.validateAdditionalItems=validateAdditionalItems;t["default"]=o},6002:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(1139);const a=r(7794);const n=r(8030);const o=r(5470);const i={message:"must NOT have additional properties",params:({params:e})=>(0,a._)`{additionalProperty: ${e.additionalProperty}}`};const c={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:true,trackErrors:true,error:i,code(e){const{gen:t,schema:r,parentSchema:i,data:c,errsCount:u,it:l}=e;if(!u)throw new Error("ajv implementation error");const{allErrors:d,opts:f}=l;l.props=true;if(f.removeAdditional!=="all"&&(0,o.alwaysValidSchema)(l,r))return;const p=(0,s.allSchemaProperties)(i.properties);const h=(0,s.allSchemaProperties)(i.patternProperties);checkAdditionalProperties();e.ok((0,a._)`${u} === ${n.default.errors}`);function checkAdditionalProperties(){t.forIn("key",c,(e=>{if(!p.length&&!h.length)additionalPropertyCode(e);else t.if(isAdditional(e),(()=>additionalPropertyCode(e)))}))}function isAdditional(r){let n;if(p.length>8){const e=(0,o.schemaRefOrVal)(l,i.properties,"properties");n=(0,s.isOwnProperty)(t,e,r)}else if(p.length){n=(0,a.or)(...p.map((e=>(0,a._)`${r} === ${e}`)))}else{n=a.nil}if(h.length){n=(0,a.or)(n,...h.map((t=>(0,a._)`${(0,s.usePattern)(e,t)}.test(${r})`)))}return(0,a.not)(n)}function deleteAdditional(e){t.code((0,a._)`delete ${c}[${e}]`)}function additionalPropertyCode(s){if(f.removeAdditional==="all"||f.removeAdditional&&r===false){deleteAdditional(s);return}if(r===false){e.setParams({additionalProperty:s});e.error();if(!d)t.break();return}if(typeof r=="object"&&!(0,o.alwaysValidSchema)(l,r)){const r=t.name("valid");if(f.removeAdditional==="failing"){applyAdditionalSchema(s,r,false);t.if((0,a.not)(r),(()=>{e.reset();deleteAdditional(s)}))}else{applyAdditionalSchema(s,r);if(!d)t.if((0,a.not)(r),(()=>t.break()))}}}function applyAdditionalSchema(t,r,s){const a={keyword:"additionalProperties",dataProp:t,dataPropType:o.Type.Str};if(s===false){Object.assign(a,{compositeRule:true,createErrors:false,allErrors:false})}e.subschema(a,r)}}};t["default"]=c},1027:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(5470);const a={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:a}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const n=t.name("valid");r.forEach(((t,r)=>{if((0,s.alwaysValidSchema)(a,t))return;const o=e.subschema({keyword:"allOf",schemaProp:r},n);e.ok(n);e.mergeEvaluated(o)}))}};t["default"]=a},6090:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(1139);const a={keyword:"anyOf",schemaType:"array",trackErrors:true,code:s.validateUnion,error:{message:"must match a schema in anyOf"}};t["default"]=a},6970:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a=r(5470);const n={message:({params:{min:e,max:t}})=>t===undefined?(0,s.str)`must contain at least ${e} valid item(s)`:(0,s.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===undefined?(0,s._)`{minContains: ${e}}`:(0,s._)`{minContains: ${e}, maxContains: ${t}}`};const o={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:true,error:n,code(e){const{gen:t,schema:r,parentSchema:n,data:o,it:i}=e;let c;let u;const{minContains:l,maxContains:d}=n;if(i.opts.next){c=l===undefined?1:l;u=d}else{c=1}const f=t.const("len",(0,s._)`${o}.length`);e.setParams({min:c,max:u});if(u===undefined&&c===0){(0,a.checkStrictMode)(i,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(u!==undefined&&c>u){(0,a.checkStrictMode)(i,`"minContains" > "maxContains" is always invalid`);e.fail();return}if((0,a.alwaysValidSchema)(i,r)){let t=(0,s._)`${f} >= ${c}`;if(u!==undefined)t=(0,s._)`${t} && ${f} <= ${u}`;e.pass(t);return}i.items=true;const p=t.name("valid");if(u===undefined&&c===1){validateItems(p,(()=>t.if(p,(()=>t.break()))))}else if(c===0){t.let(p,true);if(u!==undefined)t.if((0,s._)`${o}.length > 0`,validateItemsWithCount)}else{t.let(p,false);validateItemsWithCount()}e.result(p,(()=>e.reset()));function validateItemsWithCount(){const e=t.name("_valid");const r=t.let("count",0);validateItems(e,(()=>t.if(e,(()=>checkLimits(r)))))}function validateItems(r,s){t.forRange("i",0,f,(t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:a.Type.Num,compositeRule:true},r);s()}))}function checkLimits(e){t.code((0,s._)`${e}++`);if(u===undefined){t.if((0,s._)`${e} >= ${c}`,(()=>t.assign(p,true).break()))}else{t.if((0,s._)`${e} > ${u}`,(()=>t.assign(p,false).break()));if(c===1)t.assign(p,true);else t.if((0,s._)`${e} >= ${c}`,(()=>t.assign(p,true)))}}}};t["default"]=o},264:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const s=r(7794);const a=r(5470);const n=r(1139);t.error={message:({params:{property:e,depsCount:t,deps:r}})=>{const a=t===1?"property":"properties";return(0,s.str)`must have ${a} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:a}})=>(0,s._)`{property: ${e}, + missingProperty: ${a}, + depsCount: ${t}, + deps: ${r}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){const[t,r]=splitDependencies(e);validatePropertyDeps(e,t);validateSchemaDeps(e,r)}};function splitDependencies({schema:e}){const t={};const r={};for(const s in e){if(s==="__proto__")continue;const a=Array.isArray(e[s])?t:r;a[s]=e[s]}return[t,r]}function validatePropertyDeps(e,t=e.schema){const{gen:r,data:a,it:o}=e;if(Object.keys(t).length===0)return;const i=r.let("missing");for(const c in t){const u=t[c];if(u.length===0)continue;const l=(0,n.propertyInData)(r,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:u.length,deps:u.join(", ")});if(o.allErrors){r.if(l,(()=>{for(const t of u){(0,n.checkReportMissingProp)(e,t)}}))}else{r.if((0,s._)`${l} && (${(0,n.checkMissingProp)(e,u,i)})`);(0,n.reportMissingProp)(e,i);r.else()}}}t.validatePropertyDeps=validatePropertyDeps;function validateSchemaDeps(e,t=e.schema){const{gen:r,data:s,keyword:o,it:i}=e;const c=r.name("valid");for(const u in t){if((0,a.alwaysValidSchema)(i,t[u]))continue;r.if((0,n.propertyInData)(r,s,u,i.opts.ownProperties),(()=>{const t=e.subschema({keyword:o,schemaProp:u},c);e.mergeValidEvaluated(t,c)}),(()=>r.var(c,true)));e.ok(c)}}t.validateSchemaDeps=validateSchemaDeps;t["default"]=o},8228:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a=r(5470);const n={message:({params:e})=>(0,s.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,s._)`{failingKeyword: ${e.ifClause}}`};const o={keyword:"if",schemaType:["object","boolean"],trackErrors:true,error:n,code(e){const{gen:t,parentSchema:r,it:n}=e;if(r.then===undefined&&r.else===undefined){(0,a.checkStrictMode)(n,'"if" without "then" and "else" is ignored')}const o=hasSchema(n,"then");const i=hasSchema(n,"else");if(!o&&!i)return;const c=t.let("valid",true);const u=t.name("_valid");validateIf();e.reset();if(o&&i){const r=t.let("ifClause");e.setParams({ifClause:r});t.if(u,validateClause("then",r),validateClause("else",r))}else if(o){t.if(u,validateClause("then"))}else{t.if((0,s.not)(u),validateClause("else"))}e.pass(c,(()=>e.error(true)));function validateIf(){const t=e.subschema({keyword:"if",compositeRule:true,createErrors:false,allErrors:false},u);e.mergeEvaluated(t)}function validateClause(r,a){return()=>{const n=e.subschema({keyword:r},u);t.assign(c,u);e.mergeValidEvaluated(n,c);if(a)t.assign(a,(0,s._)`${r}`);else e.setParams({ifClause:r})}}}};function hasSchema(e,t){const r=e.schema[t];return r!==undefined&&!(0,a.alwaysValidSchema)(e,r)}t["default"]=o},2803:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(8366);const a=r(2382);const n=r(1237);const o=r(5e3);const i=r(6970);const c=r(264);const u=r(1697);const l=r(6002);const d=r(2661);const f=r(2471);const p=r(3012);const h=r(6090);const m=r(5501);const y=r(1027);const g=r(8228);const v=r(7522);function getApplicator(e=false){const t=[p.default,h.default,m.default,y.default,g.default,v.default,u.default,l.default,c.default,d.default,f.default];if(e)t.push(a.default,o.default);else t.push(s.default,n.default);t.push(i.default);return t}t["default"]=getApplicator},1237:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.validateTuple=void 0;const s=r(7794);const a=r(5470);const n=r(1139);const o={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return validateTuple(e,"additionalItems",t);r.items=true;if((0,a.alwaysValidSchema)(r,t))return;e.ok((0,n.validateArray)(e))}};function validateTuple(e,t,r=e.schema){const{gen:n,parentSchema:o,data:i,keyword:c,it:u}=e;checkStrictTuple(o);if(u.opts.unevaluated&&r.length&&u.items!==true){u.items=a.mergeEvaluated.items(n,r.length,u.items)}const l=n.name("valid");const d=n.const("len",(0,s._)`${i}.length`);r.forEach(((t,r)=>{if((0,a.alwaysValidSchema)(u,t))return;n.if((0,s._)`${d} > ${r}`,(()=>e.subschema({keyword:c,schemaProp:r,dataProp:r},l)));e.ok(l)}));function checkStrictTuple(e){const{opts:s,errSchemaPath:n}=u;const o=r.length;const i=o===e.minItems&&(o===e.maxItems||e[t]===false);if(s.strictTuples&&!i){const e=`"${c}" is ${o}-tuple, but minItems or maxItems/${t} are not specified or different at path "${n}"`;(0,a.checkStrictMode)(u,e,s.strictTuples)}}}t.validateTuple=validateTuple;t["default"]=o},5e3:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a=r(5470);const n=r(1139);const o=r(8366);const i={message:({params:{len:e}})=>(0,s.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,s._)`{limit: ${e}}`};const c={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:i,code(e){const{schema:t,parentSchema:r,it:s}=e;const{prefixItems:i}=r;s.items=true;if((0,a.alwaysValidSchema)(s,t))return;if(i)(0,o.validateAdditionalItems)(e,i);else e.ok((0,n.validateArray)(e))}};t["default"]=c},3012:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(5470);const a={keyword:"not",schemaType:["object","boolean"],trackErrors:true,code(e){const{gen:t,schema:r,it:a}=e;if((0,s.alwaysValidSchema)(a,r)){e.fail();return}const n=t.name("valid");e.subschema({keyword:"not",compositeRule:true,createErrors:false,allErrors:false},n);e.failResult(n,(()=>e.reset()),(()=>e.error()))},error:{message:"must NOT be valid"}};t["default"]=a},5501:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a=r(5470);const n={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,s._)`{passingSchemas: ${e.passing}}`};const o={keyword:"oneOf",schemaType:"array",trackErrors:true,error:n,code(e){const{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;const i=r;const c=t.let("valid",false);const u=t.let("passing",null);const l=t.name("_valid");e.setParams({passing:u});t.block(validateOneOf);e.result(c,(()=>e.reset()),(()=>e.error(true)));function validateOneOf(){i.forEach(((r,n)=>{let i;if((0,a.alwaysValidSchema)(o,r)){t.var(l,true)}else{i=e.subschema({keyword:"oneOf",schemaProp:n,compositeRule:true},l)}if(n>0){t.if((0,s._)`${l} && ${c}`).assign(c,false).assign(u,(0,s._)`[${u}, ${n}]`).else()}t.if(l,(()=>{t.assign(c,true);t.assign(u,n);if(i)e.mergeEvaluated(i,s.Name)}))}))}}};t["default"]=o},2471:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(1139);const a=r(7794);const n=r(5470);const o=r(5470);const i={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:i,parentSchema:c,it:u}=e;const{opts:l}=u;const d=(0,s.allSchemaProperties)(r);const f=d.filter((e=>(0,n.alwaysValidSchema)(u,r[e])));if(d.length===0||f.length===d.length&&(!u.opts.unevaluated||u.props===true)){return}const p=l.strictSchema&&!l.allowMatchingProperties&&c.properties;const h=t.name("valid");if(u.props!==true&&!(u.props instanceof a.Name)){u.props=(0,o.evaluatedPropsToName)(t,u.props)}const{props:m}=u;validatePatternProperties();function validatePatternProperties(){for(const e of d){if(p)checkMatchingProperties(e);if(u.allErrors){validateProperties(e)}else{t.var(h,true);validateProperties(e);t.if(h)}}}function checkMatchingProperties(e){for(const t in p){if(new RegExp(e).test(t)){(0,n.checkStrictMode)(u,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}}}function validateProperties(r){t.forIn("key",i,(n=>{t.if((0,a._)`${(0,s.usePattern)(e,r)}.test(${n})`,(()=>{const s=f.includes(r);if(!s){e.subschema({keyword:"patternProperties",schemaProp:r,dataProp:n,dataPropType:o.Type.Str},h)}if(u.opts.unevaluated&&m!==true){t.assign((0,a._)`${m}[${n}]`,true)}else if(!s&&!u.allErrors){t.if((0,a.not)(h),(()=>t.break()))}}))}))}}};t["default"]=i},2382:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(1237);const a={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,s.validateTuple)(e,"items")};t["default"]=a},2661:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(2069);const a=r(1139);const n=r(5470);const o=r(6002);const i={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:i,data:c,it:u}=e;if(u.opts.removeAdditional==="all"&&i.additionalProperties===undefined){o.default.code(new s.KeywordCxt(u,o.default,"additionalProperties"))}const l=(0,a.allSchemaProperties)(r);for(const e of l){u.definedProperties.add(e)}if(u.opts.unevaluated&&l.length&&u.props!==true){u.props=n.mergeEvaluated.props(t,(0,n.toHash)(l),u.props)}const d=l.filter((e=>!(0,n.alwaysValidSchema)(u,r[e])));if(d.length===0)return;const f=t.name("valid");for(const r of d){if(hasDefault(r)){applyPropertySchema(r)}else{t.if((0,a.propertyInData)(t,c,r,u.opts.ownProperties));applyPropertySchema(r);if(!u.allErrors)t.else().var(f,true);t.endIf()}e.it.definedProperties.add(r);e.ok(f)}function hasDefault(e){return u.opts.useDefaults&&!u.compositeRule&&r[e].default!==undefined}function applyPropertySchema(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},f)}}};t["default"]=i},1697:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a=r(5470);const n={message:"property name must be valid",params:({params:e})=>(0,s._)`{propertyName: ${e.propertyName}}`};const o={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:n,code(e){const{gen:t,schema:r,data:n,it:o}=e;if((0,a.alwaysValidSchema)(o,r))return;const i=t.name("valid");t.forIn("key",n,(r=>{e.setParams({propertyName:r});e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:true},i);t.if((0,s.not)(i),(()=>{e.error(true);if(!o.allErrors)t.break()}))}));e.ok(i)}};t["default"]=o},7522:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(5470);const a={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===undefined)(0,s.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};t["default"]=a},1139:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;const s=r(7794);const a=r(5470);const n=r(8030);const o=r(5470);function checkReportMissingProp(e,t){const{gen:r,data:a,it:n}=e;r.if(noPropertyInData(r,a,t,n.opts.ownProperties),(()=>{e.setParams({missingProperty:(0,s._)`${t}`},true);e.error()}))}t.checkReportMissingProp=checkReportMissingProp;function checkMissingProp({gen:e,data:t,it:{opts:r}},a,n){return(0,s.or)(...a.map((a=>(0,s.and)(noPropertyInData(e,t,a,r.ownProperties),(0,s._)`${n} = ${a}`))))}t.checkMissingProp=checkMissingProp;function reportMissingProp(e,t){e.setParams({missingProperty:t},true);e.error()}t.reportMissingProp=reportMissingProp;function hasPropFunc(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,s._)`Object.prototype.hasOwnProperty`})}t.hasPropFunc=hasPropFunc;function isOwnProperty(e,t,r){return(0,s._)`${hasPropFunc(e)}.call(${t}, ${r})`}t.isOwnProperty=isOwnProperty;function propertyInData(e,t,r,a){const n=(0,s._)`${t}${(0,s.getProperty)(r)} !== undefined`;return a?(0,s._)`${n} && ${isOwnProperty(e,t,r)}`:n}t.propertyInData=propertyInData;function noPropertyInData(e,t,r,a){const n=(0,s._)`${t}${(0,s.getProperty)(r)} === undefined`;return a?(0,s.or)(n,(0,s.not)(isOwnProperty(e,t,r))):n}t.noPropertyInData=noPropertyInData;function allSchemaProperties(e){return e?Object.keys(e).filter((e=>e!=="__proto__")):[]}t.allSchemaProperties=allSchemaProperties;function schemaProperties(e,t){return allSchemaProperties(t).filter((r=>!(0,a.alwaysValidSchema)(e,t[r])))}t.schemaProperties=schemaProperties;function callValidateCode({schemaCode:e,data:t,it:{gen:r,topSchemaRef:a,schemaPath:o,errorPath:i},it:c},u,l,d){const f=d?(0,s._)`${e}, ${t}, ${a}${o}`:t;const p=[[n.default.instancePath,(0,s.strConcat)(n.default.instancePath,i)],[n.default.parentData,c.parentData],[n.default.parentDataProperty,c.parentDataProperty],[n.default.rootData,n.default.rootData]];if(c.opts.dynamicRef)p.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);const h=(0,s._)`${f}, ${r.object(...p)}`;return l!==s.nil?(0,s._)`${u}.call(${l}, ${h})`:(0,s._)`${u}(${h})`}t.callValidateCode=callValidateCode;const i=(0,s._)`new RegExp`;function usePattern({gen:e,it:{opts:t}},r){const a=t.unicodeRegExp?"u":"";const{regExp:n}=t.code;const c=n(r,a);return e.scopeValue("pattern",{key:c.toString(),ref:c,code:(0,s._)`${n.code==="new RegExp"?i:(0,o.useFunc)(e,n)}(${r}, ${a})`})}t.usePattern=usePattern;function validateArray(e){const{gen:t,data:r,keyword:n,it:o}=e;const i=t.name("valid");if(o.allErrors){const e=t.let("valid",true);validateItems((()=>t.assign(e,false)));return e}t.var(i,true);validateItems((()=>t.break()));return i;function validateItems(o){const c=t.const("len",(0,s._)`${r}.length`);t.forRange("i",0,c,(r=>{e.subschema({keyword:n,dataProp:r,dataPropType:a.Type.Num},i);t.if((0,s.not)(i),o)}))}}t.validateArray=validateArray;function validateUnion(e){const{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const i=r.some((e=>(0,a.alwaysValidSchema)(o,e)));if(i&&!o.opts.unevaluated)return;const c=t.let("valid",false);const u=t.name("_valid");t.block((()=>r.forEach(((r,a)=>{const o=e.subschema({keyword:n,schemaProp:a,compositeRule:true},u);t.assign(c,(0,s._)`${c} || ${u}`);const i=e.mergeValidEvaluated(o,u);if(!i)t.if((0,s.not)(c))}))));e.result(c,(()=>e.reset()),(()=>e.error(true)))}t.validateUnion=validateUnion},4545:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const r={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};t["default"]=r},5841:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(4545);const a=r(5755);const n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",s.default,a.default];t["default"]=n},5755:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.callRef=t.getValidate=void 0;const s=r(7983);const a=r(1139);const n=r(7794);const o=r(8030);const i=r(8612);const c=r(5470);const u={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:a}=e;const{baseId:o,schemaEnv:c,validateName:u,opts:l,self:d}=a;const{root:f}=c;if((r==="#"||r==="#/")&&o===f.baseId)return callRootRef();const p=i.resolveRef.call(d,f,o,r);if(p===undefined)throw new s.default(a.opts.uriResolver,o,r);if(p instanceof i.SchemaEnv)return callValidate(p);return inlineRefSchema(p);function callRootRef(){if(c===f)return callRef(e,u,c,c.$async);const r=t.scopeValue("root",{ref:f});return callRef(e,(0,n._)`${r}.validate`,f,f.$async)}function callValidate(t){const r=getValidate(e,t);callRef(e,r,t,t.$async)}function inlineRefSchema(s){const a=t.scopeValue("schema",l.code.source===true?{ref:s,code:(0,n.stringify)(s)}:{ref:s});const o=t.name("valid");const i=e.subschema({schema:s,dataTypes:[],schemaPath:n.nil,topSchemaRef:a,errSchemaPath:r},o);e.mergeEvaluated(i);e.ok(o)}}};function getValidate(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,n._)`${r.scopeValue("wrapper",{ref:t})}.validate`}t.getValidate=getValidate;function callRef(e,t,r,s){const{gen:i,it:u}=e;const{allErrors:l,schemaEnv:d,opts:f}=u;const p=f.passContext?o.default.this:n.nil;if(s)callAsyncRef();else callSyncRef();function callAsyncRef(){if(!d.$async)throw new Error("async schema referenced by sync schema");const r=i.let("valid");i.try((()=>{i.code((0,n._)`await ${(0,a.callValidateCode)(e,t,p)}`);addEvaluatedFrom(t);if(!l)i.assign(r,true)}),(e=>{i.if((0,n._)`!(${e} instanceof ${u.ValidationError})`,(()=>i.throw(e)));addErrorsFrom(e);if(!l)i.assign(r,false)}));e.ok(r)}function callSyncRef(){e.result((0,a.callValidateCode)(e,t,p),(()=>addEvaluatedFrom(t)),(()=>addErrorsFrom(t)))}function addErrorsFrom(e){const t=(0,n._)`${e}.errors`;i.assign(o.default.vErrors,(0,n._)`${o.default.vErrors} === null ? ${t} : ${o.default.vErrors}.concat(${t})`);i.assign(o.default.errors,(0,n._)`${o.default.vErrors}.length`)}function addEvaluatedFrom(e){var t;if(!u.opts.unevaluated)return;const s=(t=r===null||r===void 0?void 0:r.validate)===null||t===void 0?void 0:t.evaluated;if(u.props!==true){if(s&&!s.dynamicProps){if(s.props!==undefined){u.props=c.mergeEvaluated.props(i,s.props,u.props)}}else{const t=i.var("props",(0,n._)`${e}.evaluated.props`);u.props=c.mergeEvaluated.props(i,t,u.props,n.Name)}}if(u.items!==true){if(s&&!s.dynamicItems){if(s.items!==undefined){u.items=c.mergeEvaluated.items(i,s.items,u.items)}}else{const t=i.var("items",(0,n._)`${e}.evaluated.items`);u.items=c.mergeEvaluated.items(i,t,u.items,n.Name)}}}}t.callRef=callRef;t["default"]=u},764:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a=r(638);const n=r(8612);const o=r(5470);const i={message:({params:{discrError:e,tagName:t}})=>e===a.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,s._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`};const c={keyword:"discriminator",type:"object",schemaType:"object",error:i,code(e){const{gen:t,data:r,schema:i,parentSchema:c,it:u}=e;const{oneOf:l}=c;if(!u.opts.discriminator){throw new Error("discriminator: requires discriminator option")}const d=i.propertyName;if(typeof d!="string")throw new Error("discriminator: requires propertyName");if(i.mapping)throw new Error("discriminator: mapping is not supported");if(!l)throw new Error("discriminator: requires oneOf keyword");const f=t.let("valid",false);const p=t.const("tag",(0,s._)`${r}${(0,s.getProperty)(d)}`);t.if((0,s._)`typeof ${p} == "string"`,(()=>validateMapping()),(()=>e.error(false,{discrError:a.DiscrError.Tag,tag:p,tagName:d})));e.ok(f);function validateMapping(){const r=getMapping();t.if(false);for(const e in r){t.elseIf((0,s._)`${p} === ${e}`);t.assign(f,applyTagSchema(r[e]))}t.else();e.error(false,{discrError:a.DiscrError.Mapping,tag:p,tagName:d});t.endIf()}function applyTagSchema(r){const a=t.name("valid");const n=e.subschema({keyword:"oneOf",schemaProp:r},a);e.mergeEvaluated(n,s.Name);return a}function getMapping(){var e;const t={};const r=hasRequired(c);let s=true;for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.DiscrError=void 0;var r;(function(e){e["Tag"]="tag";e["Mapping"]="mapping"})(r=t.DiscrError||(t.DiscrError={}))},7127:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(5841);const a=r(6163);const n=r(2803);const o=r(2879);const i=r(8590);const c=[s.default,a.default,(0,n.default)(),o.default,i.metadataVocabulary,i.contentVocabulary];t["default"]=c},5240:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a={message:({schemaCode:e})=>(0,s.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,s._)`{format: ${e}}`};const n={keyword:"format",type:["number","string"],schemaType:"string",$data:true,error:a,code(e,t){const{gen:r,data:a,$data:n,schema:o,schemaCode:i,it:c}=e;const{opts:u,errSchemaPath:l,schemaEnv:d,self:f}=c;if(!u.validateFormats)return;if(n)validate$DataFormat();else validateFormat();function validate$DataFormat(){const n=r.scopeValue("formats",{ref:f.formats,code:u.code.formats});const o=r.const("fDef",(0,s._)`${n}[${i}]`);const c=r.let("fType");const l=r.let("format");r.if((0,s._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,(()=>r.assign(c,(0,s._)`${o}.type || "string"`).assign(l,(0,s._)`${o}.validate`)),(()=>r.assign(c,(0,s._)`"string"`).assign(l,o)));e.fail$data((0,s.or)(unknownFmt(),invalidFmt()));function unknownFmt(){if(u.strictSchema===false)return s.nil;return(0,s._)`${i} && !${l}`}function invalidFmt(){const e=d.$async?(0,s._)`(${o}.async ? await ${l}(${a}) : ${l}(${a}))`:(0,s._)`${l}(${a})`;const r=(0,s._)`(typeof ${l} == "function" ? ${e} : ${l}.test(${a}))`;return(0,s._)`${l} && ${l} !== true && ${c} === ${t} && !${r}`}}function validateFormat(){const n=f.formats[o];if(!n){unknownFormat();return}if(n===true)return;const[i,c,p]=getFormat(n);if(i===t)e.pass(validCondition());function unknownFormat(){if(u.strictSchema===false){f.logger.warn(unknownMsg());return}throw new Error(unknownMsg());function unknownMsg(){return`unknown format "${o}" ignored in schema at path "${l}"`}}function getFormat(e){const t=e instanceof RegExp?(0,s.regexpCode)(e):u.code.formats?(0,s._)`${u.code.formats}${(0,s.getProperty)(o)}`:undefined;const a=r.scopeValue("formats",{key:o,ref:e,code:t});if(typeof e=="object"&&!(e instanceof RegExp)){return[e.type||"string",e.validate,(0,s._)`${a}.validate`]}return["string",e,a]}function validCondition(){if(typeof n=="object"&&!(n instanceof RegExp)&&n.async){if(!d.$async)throw new Error("async format in sync schema");return(0,s._)`await ${p}(${a})`}return typeof c=="function"?(0,s._)`${p}(${a})`:(0,s._)`${p}.test(${a})`}}}};t["default"]=n},2879:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(5240);const a=[s.default];t["default"]=a},8590:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.contentVocabulary=t.metadataVocabulary=void 0;t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},7802:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a=r(5470);const n=r(6560);const o={message:"must be equal to constant",params:({schemaCode:e})=>(0,s._)`{allowedValue: ${e}}`};const i={keyword:"const",$data:true,error:o,code(e){const{gen:t,data:r,$data:o,schemaCode:i,schema:c}=e;if(o||c&&typeof c=="object"){e.fail$data((0,s._)`!${(0,a.useFunc)(t,n.default)}(${r}, ${i})`)}else{e.fail((0,s._)`${c} !== ${r}`)}}};t["default"]=i},2844:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a=r(5470);const n=r(6560);const o={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,s._)`{allowedValues: ${e}}`};const i={keyword:"enum",schemaType:"array",$data:true,error:o,code(e){const{gen:t,data:r,$data:o,schema:i,schemaCode:c,it:u}=e;if(!o&&i.length===0)throw new Error("enum must have non-empty array");const l=i.length>=u.opts.loopEnum;let d;const getEql=()=>d!==null&&d!==void 0?d:d=(0,a.useFunc)(t,n.default);let f;if(l||o){f=t.let("valid");e.block$data(f,loopEnum)}else{if(!Array.isArray(i))throw new Error("ajv implementation error");const e=t.const("vSchema",c);f=(0,s.or)(...i.map(((t,r)=>equalCode(e,r))))}e.pass(f);function loopEnum(){t.assign(f,false);t.forOf("v",c,(e=>t.if((0,s._)`${getEql()}(${r}, ${e})`,(()=>t.assign(f,true).break()))))}function equalCode(e,t){const a=i[t];return typeof a==="object"&&a!==null?(0,s._)`${getEql()}(${r}, ${e}[${t}])`:(0,s._)`${r} === ${a}`}}};t["default"]=i},6163:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(715);const a=r(1408);const n=r(6809);const o=r(1355);const i=r(5205);const c=r(9818);const u=r(4660);const l=r(1620);const d=r(7802);const f=r(2844);const p=[s.default,a.default,n.default,o.default,i.default,c.default,u.default,l.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},d.default,f.default];t["default"]=p},4660:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a={message({keyword:e,schemaCode:t}){const r=e==="maxItems"?"more":"fewer";return(0,s.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,s._)`{limit: ${e}}`};const n={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:true,error:a,code(e){const{keyword:t,data:r,schemaCode:a}=e;const n=t==="maxItems"?s.operators.GT:s.operators.LT;e.fail$data((0,s._)`${r}.length ${n} ${a}`)}};t["default"]=n},6809:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a=r(5470);const n=r(1528);const o={message({keyword:e,schemaCode:t}){const r=e==="maxLength"?"more":"fewer";return(0,s.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,s._)`{limit: ${e}}`};const i={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:true,error:o,code(e){const{keyword:t,data:r,schemaCode:o,it:i}=e;const c=t==="maxLength"?s.operators.GT:s.operators.LT;const u=i.opts.unicode===false?(0,s._)`${r}.length`:(0,s._)`${(0,a.useFunc)(e.gen,n.default)}(${r})`;e.fail$data((0,s._)`${u} ${c} ${o}`)}};t["default"]=i},715:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a=s.operators;const n={maximum:{okStr:"<=",ok:a.LTE,fail:a.GT},minimum:{okStr:">=",ok:a.GTE,fail:a.LT},exclusiveMaximum:{okStr:"<",ok:a.LT,fail:a.GTE},exclusiveMinimum:{okStr:">",ok:a.GT,fail:a.LTE}};const o={message:({keyword:e,schemaCode:t})=>(0,s.str)`must be ${n[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,s._)`{comparison: ${n[e].okStr}, limit: ${t}}`};const i={keyword:Object.keys(n),type:"number",schemaType:"number",$data:true,error:o,code(e){const{keyword:t,data:r,schemaCode:a}=e;e.fail$data((0,s._)`${r} ${n[t].fail} ${a} || isNaN(${r})`)}};t["default"]=i},5205:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a={message({keyword:e,schemaCode:t}){const r=e==="maxProperties"?"more":"fewer";return(0,s.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,s._)`{limit: ${e}}`};const n={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:true,error:a,code(e){const{keyword:t,data:r,schemaCode:a}=e;const n=t==="maxProperties"?s.operators.GT:s.operators.LT;e.fail$data((0,s._)`Object.keys(${r}).length ${n} ${a}`)}};t["default"]=n},1408:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a={message:({schemaCode:e})=>(0,s.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,s._)`{multipleOf: ${e}}`};const n={keyword:"multipleOf",type:"number",schemaType:"number",$data:true,error:a,code(e){const{gen:t,data:r,schemaCode:a,it:n}=e;const o=n.opts.multipleOfPrecision;const i=t.let("res");const c=o?(0,s._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:(0,s._)`${i} !== parseInt(${i})`;e.fail$data((0,s._)`(${a} === 0 || (${i} = ${r}/${a}, ${c}))`)}};t["default"]=n},1355:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(1139);const a=r(7794);const n={message:({schemaCode:e})=>(0,a.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,a._)`{pattern: ${e}}`};const o={keyword:"pattern",type:"string",schemaType:"string",$data:true,error:n,code(e){const{data:t,$data:r,schema:n,schemaCode:o,it:i}=e;const c=i.opts.unicodeRegExp?"u":"";const u=r?(0,a._)`(new RegExp(${o}, ${c}))`:(0,s.usePattern)(e,n);e.fail$data((0,a._)`!${u}.test(${t})`)}};t["default"]=o},9818:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(1139);const a=r(7794);const n=r(5470);const o={message:({params:{missingProperty:e}})=>(0,a.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,a._)`{missingProperty: ${e}}`};const i={keyword:"required",type:"object",schemaType:"array",$data:true,error:o,code(e){const{gen:t,schema:r,schemaCode:o,data:i,$data:c,it:u}=e;const{opts:l}=u;if(!c&&r.length===0)return;const d=r.length>=l.loopRequired;if(u.allErrors)allErrorsMode();else exitOnErrorMode();if(l.strictRequired){const t=e.parentSchema.properties;const{definedProperties:s}=e.it;for(const e of r){if((t===null||t===void 0?void 0:t[e])===undefined&&!s.has(e)){const t=u.schemaEnv.baseId+u.errSchemaPath;const r=`required property "${e}" is not defined at "${t}" (strictRequired)`;(0,n.checkStrictMode)(u,r,u.opts.strictRequired)}}}function allErrorsMode(){if(d||c){e.block$data(a.nil,loopAllRequired)}else{for(const t of r){(0,s.checkReportMissingProp)(e,t)}}}function exitOnErrorMode(){const a=t.let("missing");if(d||c){const r=t.let("valid",true);e.block$data(r,(()=>loopUntilMissing(a,r)));e.ok(r)}else{t.if((0,s.checkMissingProp)(e,r,a));(0,s.reportMissingProp)(e,a);t.else()}}function loopAllRequired(){t.forOf("prop",o,(r=>{e.setParams({missingProperty:r});t.if((0,s.noPropertyInData)(t,i,r,l.ownProperties),(()=>e.error()))}))}function loopUntilMissing(r,n){e.setParams({missingProperty:r});t.forOf(r,o,(()=>{t.assign(n,(0,s.propertyInData)(t,i,r,l.ownProperties));t.if((0,a.not)(n),(()=>{e.error();t.break()}))}),a.nil)}}};t["default"]=i},1620:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7795);const a=r(7794);const n=r(5470);const o=r(6560);const i={message:({params:{i:e,j:t}})=>(0,a.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,a._)`{i: ${e}, j: ${t}}`};const c={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:true,error:i,code(e){const{gen:t,data:r,$data:i,schema:c,parentSchema:u,schemaCode:l,it:d}=e;if(!i&&!c)return;const f=t.let("valid");const p=u.items?(0,s.getSchemaTypes)(u.items):[];e.block$data(f,validateUniqueItems,(0,a._)`${l} === false`);e.ok(f);function validateUniqueItems(){const s=t.let("i",(0,a._)`${r}.length`);const n=t.let("j");e.setParams({i:s,j:n});t.assign(f,true);t.if((0,a._)`${s} > 1`,(()=>(canOptimize()?loopN:loopN2)(s,n)))}function canOptimize(){return p.length>0&&!p.some((e=>e==="object"||e==="array"))}function loopN(n,o){const i=t.name("item");const c=(0,s.checkDataTypes)(p,i,d.opts.strictNumbers,s.DataType.Wrong);const u=t.const("indices",(0,a._)`{}`);t.for((0,a._)`;${n}--;`,(()=>{t.let(i,(0,a._)`${r}[${n}]`);t.if(c,(0,a._)`continue`);if(p.length>1)t.if((0,a._)`typeof ${i} == "string"`,(0,a._)`${i} += "_"`);t.if((0,a._)`typeof ${u}[${i}] == "number"`,(()=>{t.assign(o,(0,a._)`${u}[${i}]`);e.error();t.assign(f,false).break()})).code((0,a._)`${u}[${i}] = ${n}`)}))}function loopN2(s,i){const c=(0,n.useFunc)(t,o.default);const u=t.name("outer");t.label(u).for((0,a._)`;${s}--;`,(()=>t.for((0,a._)`${i} = ${s}; ${i}--;`,(()=>t.if((0,a._)`${c}(${r}[${s}], ${r}[${i}])`,(()=>{e.error();t.assign(f,false).break(u)}))))))}}};t["default"]=c},7914:e=>{"use strict";e.exports=function equal(e,t){if(e===t)return true;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return false;var r,s,a;if(Array.isArray(e)){r=e.length;if(r!=t.length)return false;for(s=r;s--!==0;)if(!equal(e[s],t[s]))return false;return true}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();a=Object.keys(e);r=a.length;if(r!==Object.keys(t).length)return false;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,a[s]))return false;for(s=r;s--!==0;){var n=a[s];if(!equal(e[n],t[n]))return false}return true}return e!==e&&t!==t}},2486:e=>{"use strict";var t=e.exports=function(e,t,r){if(typeof t=="function"){r=t;t={}}r=t.cb||r;var s=typeof r=="function"?r:r.pre||function(){};var a=r.post||function(){};_traverse(t,s,a,e,"",e)};t.keywords={additionalItems:true,items:true,contains:true,additionalProperties:true,propertyNames:true,not:true,if:true,then:true,else:true};t.arrayKeywords={items:true,allOf:true,anyOf:true,oneOf:true};t.propsKeywords={$defs:true,definitions:true,properties:true,patternProperties:true,dependencies:true};t.skipKeywords={default:true,enum:true,const:true,required:true,maximum:true,minimum:true,exclusiveMaximum:true,exclusiveMinimum:true,multipleOf:true,maxLength:true,minLength:true,pattern:true,format:true,maxItems:true,minItems:true,uniqueItems:true,maxProperties:true,minProperties:true};function _traverse(e,r,s,a,n,o,i,c,u,l){if(a&&typeof a=="object"&&!Array.isArray(a)){r(a,n,o,i,c,u,l);for(var d in a){var f=a[d];if(Array.isArray(f)){if(d in t.arrayKeywords){for(var p=0;p1){t[0]=t[0].slice(0,-1);var s=t.length-1;for(var a=1;a= 0x80 (not a basic code point)","invalid-input":"Invalid input"};var g=n-o;var v=Math.floor;var $=String.fromCharCode;function error$1(e){throw new RangeError(y[e])}function map(e,t){var r=[];var s=e.length;while(s--){r[s]=t(e[s])}return r}function mapDomain(e,t){var r=e.split("@");var s="";if(r.length>1){s=r[0]+"@";e=r[1]}e=e.replace(m,".");var a=e.split(".");var n=map(a,t).join(".");return s+n}function ucs2decode(e){var t=[];var r=0;var s=e.length;while(r=55296&&a<=56319&&r>1;e+=v(e/t);for(;e>g*i>>1;s+=n){e=v(e/g)}return v(s+(g+1)*e/(e+c))};var P=function decode(e){var t=[];var r=e.length;var s=0;var c=d;var u=l;var p=e.lastIndexOf(f);if(p<0){p=0}for(var h=0;h=128){error$1("not-basic")}t.push(e.charCodeAt(h))}for(var m=p>0?p+1:0;m=r){error$1("invalid-input")}var b=w(e.charCodeAt(m++));if(b>=n||b>v((a-s)/g)){error$1("overflow")}s+=b*g;var E=$<=u?o:$>=u+i?i:$-u;if(bv(a/P)){error$1("overflow")}g*=P}var C=t.length+1;u=S(s-y,C,y==0);if(v(s/C)>a-c){error$1("overflow")}c+=v(s/C);s%=C;t.splice(s++,0,c)}return String.fromCodePoint.apply(String,t)};var C=function encode(e){var t=[];e=ucs2decode(e);var r=e.length;var s=d;var c=0;var u=l;var p=true;var h=false;var m=undefined;try{for(var y=e[Symbol.iterator](),g;!(p=(g=y.next()).done);p=true){var b=g.value;if(b<128){t.push($(b))}}}catch(e){h=true;m=e}finally{try{if(!p&&y.return){y.return()}}finally{if(h){throw m}}}var w=t.length;var P=w;if(w){t.push(f)}while(P=s&&Tv((a-c)/j)){error$1("overflow")}c+=(C-s)*j;s=C;var I=true;var D=false;var A=undefined;try{for(var M=e[Symbol.iterator](),F;!(I=(F=M.next()).done);I=true){var V=F.value;if(Va){error$1("overflow")}if(V==s){var U=c;for(var z=n;;z+=n){var K=z<=u?o:z>=u+i?i:z-u;if(U>6|192).toString(16).toUpperCase()+"%"+(t&63|128).toString(16).toUpperCase();else r="%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(t&63|128).toString(16).toUpperCase();return r}function pctDecChars(e){var t="";var r=0;var s=e.length;while(r=194&&a<224){if(s-r>=6){var n=parseInt(e.substr(r+4,2),16);t+=String.fromCharCode((a&31)<<6|n&63)}else{t+=e.substr(r,6)}r+=6}else if(a>=224){if(s-r>=9){var o=parseInt(e.substr(r+4,2),16);var i=parseInt(e.substr(r+7,2),16);t+=String.fromCharCode((a&15)<<12|(o&63)<<6|i&63)}else{t+=e.substr(r,9)}r+=9}else{t+=e.substr(r,3);r+=3}}return t}function _normalizeComponentEncoding(e,t){function decodeUnreserved(e){var r=pctDecChars(e);return!r.match(t.UNRESERVED)?e:r}if(e.scheme)e.scheme=String(e.scheme).replace(t.PCT_ENCODED,decodeUnreserved).toLowerCase().replace(t.NOT_SCHEME,"");if(e.userinfo!==undefined)e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,decodeUnreserved).replace(t.NOT_USERINFO,pctEncChar).replace(t.PCT_ENCODED,toUpperCase);if(e.host!==undefined)e.host=String(e.host).replace(t.PCT_ENCODED,decodeUnreserved).toLowerCase().replace(t.NOT_HOST,pctEncChar).replace(t.PCT_ENCODED,toUpperCase);if(e.path!==undefined)e.path=String(e.path).replace(t.PCT_ENCODED,decodeUnreserved).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,pctEncChar).replace(t.PCT_ENCODED,toUpperCase);if(e.query!==undefined)e.query=String(e.query).replace(t.PCT_ENCODED,decodeUnreserved).replace(t.NOT_QUERY,pctEncChar).replace(t.PCT_ENCODED,toUpperCase);if(e.fragment!==undefined)e.fragment=String(e.fragment).replace(t.PCT_ENCODED,decodeUnreserved).replace(t.NOT_FRAGMENT,pctEncChar).replace(t.PCT_ENCODED,toUpperCase);return e}function _stripLeadingZeros(e){return e.replace(/^0*(.*)/,"$1")||"0"}function _normalizeIPv4(e,t){var r=e.match(t.IPV4ADDRESS)||[];var a=s(r,2),n=a[1];if(n){return n.split(".").map(_stripLeadingZeros).join(".")}else{return e}}function _normalizeIPv6(e,t){var r=e.match(t.IPV6ADDRESS)||[];var a=s(r,3),n=a[1],o=a[2];if(n){var i=n.toLowerCase().split("::").reverse(),c=s(i,2),u=c[0],l=c[1];var d=l?l.split(":").map(_stripLeadingZeros):[];var f=u.split(":").map(_stripLeadingZeros);var p=t.IPV4ADDRESS.test(f[f.length-1]);var h=p?7:8;var m=f.length-h;var y=Array(h);for(var g=0;g1){var w=y.slice(0,$.index);var E=y.slice($.index+$.length);b=w.join(":")+"::"+E.join(":")}else{b=y.join(":")}if(o){b+="%"+o}return b}else{return e}}var R=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;var T="".match(/(){0}/)[1]===undefined;function parse(e){var s=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var a={};var n=s.iri!==false?r:t;if(s.reference==="suffix")e=(s.scheme?s.scheme+":":"")+"//"+e;var o=e.match(R);if(o){if(T){a.scheme=o[1];a.userinfo=o[3];a.host=o[4];a.port=parseInt(o[5],10);a.path=o[6]||"";a.query=o[7];a.fragment=o[8];if(isNaN(a.port)){a.port=o[5]}}else{a.scheme=o[1]||undefined;a.userinfo=e.indexOf("@")!==-1?o[3]:undefined;a.host=e.indexOf("//")!==-1?o[4]:undefined;a.port=parseInt(o[5],10);a.path=o[6]||"";a.query=e.indexOf("?")!==-1?o[7]:undefined;a.fragment=e.indexOf("#")!==-1?o[8]:undefined;if(isNaN(a.port)){a.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?o[4]:undefined}}if(a.host){a.host=_normalizeIPv6(_normalizeIPv4(a.host,n),n)}if(a.scheme===undefined&&a.userinfo===undefined&&a.host===undefined&&a.port===undefined&&!a.path&&a.query===undefined){a.reference="same-document"}else if(a.scheme===undefined){a.reference="relative"}else if(a.fragment===undefined){a.reference="absolute"}else{a.reference="uri"}if(s.reference&&s.reference!=="suffix"&&s.reference!==a.reference){a.error=a.error||"URI is not a "+s.reference+" reference."}var i=O[(s.scheme||a.scheme||"").toLowerCase()];if(!s.unicodeSupport&&(!i||!i.unicodeSupport)){if(a.host&&(s.domainHost||i&&i.domainHost)){try{a.host=N.toASCII(a.host.replace(n.PCT_ENCODED,pctDecChars).toLowerCase())}catch(e){a.error=a.error||"Host's domain name can not be converted to ASCII via punycode: "+e}}_normalizeComponentEncoding(a,t)}else{_normalizeComponentEncoding(a,n)}if(i&&i.parse){i.parse(a,s)}}else{a.error=a.error||"URI can not be parsed."}return a}function _recomposeAuthority(e,s){var a=s.iri!==false?r:t;var n=[];if(e.userinfo!==undefined){n.push(e.userinfo);n.push("@")}if(e.host!==undefined){n.push(_normalizeIPv6(_normalizeIPv4(String(e.host),a),a).replace(a.IPV6ADDRESS,(function(e,t,r){return"["+t+(r?"%25"+r:"")+"]"})))}if(typeof e.port==="number"){n.push(":");n.push(e.port.toString(10))}return n.length?n.join(""):undefined}var j=/^\.\.?\//;var I=/^\/\.(\/|$)/;var D=/^\/\.\.(\/|$)/;var A=/^\/?(?:.|\n)*?(?=\/|$)/;function removeDotSegments(e){var t=[];while(e.length){if(e.match(j)){e=e.replace(j,"")}else if(e.match(I)){e=e.replace(I,"/")}else if(e.match(D)){e=e.replace(D,"/");t.pop()}else if(e==="."||e===".."){e=""}else{var r=e.match(A);if(r){var s=r[0];e=e.slice(s.length);t.push(s)}else{throw new Error("Unexpected dot segment condition")}}}return t.join("")}function serialize(e){var s=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var a=s.iri?r:t;var n=[];var o=O[(s.scheme||e.scheme||"").toLowerCase()];if(o&&o.serialize)o.serialize(e,s);if(e.host){if(a.IPV6ADDRESS.test(e.host)){}else if(s.domainHost||o&&o.domainHost){try{e.host=!s.iri?N.toASCII(e.host.replace(a.PCT_ENCODED,pctDecChars).toLowerCase()):N.toUnicode(e.host)}catch(t){e.error=e.error||"Host's domain name can not be converted to "+(!s.iri?"ASCII":"Unicode")+" via punycode: "+t}}}_normalizeComponentEncoding(e,a);if(s.reference!=="suffix"&&e.scheme){n.push(e.scheme);n.push(":")}var i=_recomposeAuthority(e,s);if(i!==undefined){if(s.reference!=="suffix"){n.push("//")}n.push(i);if(e.path&&e.path.charAt(0)!=="/"){n.push("/")}}if(e.path!==undefined){var c=e.path;if(!s.absolutePath&&(!o||!o.absolutePath)){c=removeDotSegments(c)}if(i===undefined){c=c.replace(/^\/\//,"/%2F")}n.push(c)}if(e.query!==undefined){n.push("?");n.push(e.query)}if(e.fragment!==undefined){n.push("#");n.push(e.fragment)}return n.join("")}function resolveComponents(e,t){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var s=arguments[3];var a={};if(!s){e=parse(serialize(e,r),r);t=parse(serialize(t,r),r)}r=r||{};if(!r.tolerant&&t.scheme){a.scheme=t.scheme;a.userinfo=t.userinfo;a.host=t.host;a.port=t.port;a.path=removeDotSegments(t.path||"");a.query=t.query}else{if(t.userinfo!==undefined||t.host!==undefined||t.port!==undefined){a.userinfo=t.userinfo;a.host=t.host;a.port=t.port;a.path=removeDotSegments(t.path||"");a.query=t.query}else{if(!t.path){a.path=e.path;if(t.query!==undefined){a.query=t.query}else{a.query=e.query}}else{if(t.path.charAt(0)==="/"){a.path=removeDotSegments(t.path)}else{if((e.userinfo!==undefined||e.host!==undefined||e.port!==undefined)&&!e.path){a.path="/"+t.path}else if(!e.path){a.path=t.path}else{a.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path}a.path=removeDotSegments(a.path)}a.query=t.query}a.userinfo=e.userinfo;a.host=e.host;a.port=e.port}a.scheme=e.scheme}a.fragment=t.fragment;return a}function resolve(e,t,r){var s=assign({scheme:"null"},r);return serialize(resolveComponents(parse(e,s),parse(t,s),s,true),s)}function normalize(e,t){if(typeof e==="string"){e=serialize(parse(e,t),t)}else if(typeOf(e)==="object"){e=parse(serialize(e,t),t)}return e}function equal(e,t,r){if(typeof e==="string"){e=serialize(parse(e,r),r)}else if(typeOf(e)==="object"){e=serialize(e,r)}if(typeof t==="string"){t=serialize(parse(t,r),r)}else if(typeOf(t)==="object"){t=serialize(t,r)}return e===t}function escapeComponent(e,s){return e&&e.toString().replace(!s||!s.iri?t.ESCAPE:r.ESCAPE,pctEncChar)}function unescapeComponent(e,s){return e&&e.toString().replace(!s||!s.iri?t.PCT_ENCODED:r.PCT_ENCODED,pctDecChars)}var M={scheme:"http",domainHost:true,parse:function parse(e,t){if(!e.host){e.error=e.error||"HTTP URIs must have a host."}return e},serialize:function serialize(e,t){if(e.port===(String(e.scheme).toLowerCase()!=="https"?80:443)||e.port===""){e.port=undefined}if(!e.path){e.path="/"}return e}};var F={scheme:"https",domainHost:M.domainHost,parse:M.parse,serialize:M.serialize};var V={};var U=true;var z="[A-Za-z0-9\\-\\.\\_\\~"+(U?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]";var K="[0-9A-Fa-f]";var q=subexp(subexp("%[EFef]"+K+"%"+K+K+"%"+K+K)+"|"+subexp("%[89A-Fa-f]"+K+"%"+K+K)+"|"+subexp("%"+K+K));var L="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";var H="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";var G=merge(H,'[\\"\\\\]');var J="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";var B=new RegExp(z,"g");var W=new RegExp(q,"g");var Z=new RegExp(merge("[^]",L,"[\\.]",'[\\"]',G),"g");var Q=new RegExp(merge("[^]",z,J),"g");var Y=Q;function decodeUnreserved(e){var t=pctDecChars(e);return!t.match(B)?e:t}var X={scheme:"mailto",parse:function parse$$1(e,t){var r=e;var s=r.to=r.path?r.path.split(","):[];r.path=undefined;if(r.query){var a=false;var n={};var o=r.query.split("&");for(var i=0,c=o.length;i{"use strict";e.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},9520:e=>{"use strict";e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')}};var t={};function __nccwpck_require__(r){var s=t[r];if(s!==undefined){return s.exports}var a=t[r]={exports:{}};var n=true;try{e[r].call(a.exports,a,a.exports,__nccwpck_require__);n=false}finally{if(n)delete t[r]}return a.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(7097);module.exports=r})(); \ No newline at end of file diff --git a/packages/next/compiled/ajv/package.json b/packages/next/compiled/ajv/package.json new file mode 100644 index 000000000000..15276ae218f0 --- /dev/null +++ b/packages/next/compiled/ajv/package.json @@ -0,0 +1 @@ +{"name":"ajv","main":"ajv.js","author":"Evgeny Poberezkin","license":"MIT"} diff --git a/packages/next/index.d.ts b/packages/next/index.d.ts index 6a660719f6dd..a73cb9959c1d 100644 --- a/packages/next/index.d.ts +++ b/packages/next/index.d.ts @@ -1,4 +1,5 @@ /// +/// /// /// /// @@ -11,7 +12,7 @@ /// /// /// -/// +/// export { default } from './types' export * from './types' diff --git a/packages/next/package.json b/packages/next/package.json index 3020835e775b..85ccd9d6a7a5 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -50,6 +50,7 @@ "index.d.ts", "types/index.d.ts", "types/global.d.ts", + "types/compiled.d.ts", "image-types/global.d.ts" ], "bin": { @@ -168,6 +169,8 @@ "@vercel/ncc": "0.33.4", "@vercel/nft": "0.20.0", "acorn": "8.5.0", + "ajv": "8.11.0", + "ajv-keywords": "5.1.0", "amphtml-validator": "1.0.35", "arg": "4.1.0", "assert": "2.0.0", diff --git a/packages/next/server/config-shared.ts b/packages/next/server/config-shared.ts index 3b55d24a08e2..14149a93beea 100644 --- a/packages/next/server/config-shared.ts +++ b/packages/next/server/config-shared.ts @@ -1,4 +1,7 @@ import os from 'os' +import Ajv from 'next/dist/compiled/ajv' +import ajvKeywords from 'next/dist/compiled/ajv-keywords' +import { JSONSchemaType } from 'next/dist/compiled/ajv' import type { webpack5 } from 'next/dist/compiled/webpack/webpack' import { Header, Redirect, Rewrite } from '../lib/load-custom-routes' import { @@ -6,6 +9,7 @@ import { ImageConfigComplete, imageConfigDefault, RemotePattern, + VALID_LOADERS, } from '../shared/lib/image-config' export type ServerRuntime = 'nodejs' | 'experimental-edge' | undefined @@ -565,3 +569,613 @@ export function isServerRuntime(value?: string): value is ServerRuntime { value === undefined || value === 'nodejs' || value === 'experimental-edge' ) } + +const configSchema = { + type: 'object', + additionalProperties: false, + properties: { + amp: { + additionalProperties: false, + properties: { + canonicalBase: { + minLength: 1, + type: 'string', + }, + }, + type: 'object', + }, + assetPrefix: { + minLength: 1, + type: 'string', + }, + basePath: { + minLength: 1, + type: 'string', + }, + cleanDistDir: { + type: 'boolean', + }, + compiler: { + additionalProperties: false, + properties: { + emotion: { + oneOf: [ + { + type: 'boolean', + }, + { + type: 'object', + additionalProperties: false, + properties: { + sourceMap: { + type: 'boolean', + }, + autoLabel: { + type: 'string', + enum: ['always', 'dev-only', 'never'], + }, + labelFormat: { + type: 'string', + minLength: 1, + }, + }, + }, + ] as any, + }, + reactRemoveProperties: { + oneOf: [ + { + type: 'boolean', + }, + { + type: 'object', + additionalProperties: false, + properties: { + properties: { + type: 'array', + items: { + type: 'string', + }, + }, + }, + }, + ] as any, + }, + relay: { + additionalProperties: false, + properties: { + artifactDirectory: { + minLength: 1, + type: 'string', + }, + language: { + // automatic typing doesn't like enum + enum: ['flow', 'typescript'] as any, + type: 'string', + }, + src: { + minLength: 1, + type: 'string', + }, + }, + type: 'object', + }, + removeConsole: { + oneOf: [ + { + type: 'boolean', + }, + { + type: 'object', + additionalProperties: false, + properties: { + exclude: { + type: 'array', + items: { + type: 'string', + minLength: 1, + }, + }, + }, + }, + ] as any, + }, + styledComponents: { + oneOf: [ + { + type: 'boolean', + }, + { + type: 'object', + additionalProperties: false, + properties: { + displayName: { + type: 'boolean', + }, + topLevelImportPaths: { + type: 'array', + items: { + type: 'string', + minLength: 1, + }, + }, + ssr: { + type: 'boolean', + }, + fileName: { + type: 'boolean', + }, + meaninglessFileNames: { + type: 'boolean', + }, + minify: { + type: 'boolean', + }, + transpileTemplateLiterals: { + type: 'boolean', + }, + namespace: { + type: 'string', + minLength: 1, + }, + pure: { + type: 'boolean', + }, + cssProp: { + type: 'boolean', + }, + }, + }, + ] as any, + }, + }, + type: 'object', + }, + compress: { + type: 'boolean', + }, + crossOrigin: { + oneOf: [ + false, + { + enum: ['anonymous', 'use-credentials'], + type: 'string', + }, + ], // automatic typing does not like enum + } as any, + devIndicators: { + additionalProperties: false, + properties: { + buildActivity: { + type: 'boolean', + }, + buildActivityPosition: { + // automatic typing does not like enum + enum: ['bottom-left', 'bottom-right', 'top-left', 'top-right'] as any, + type: 'string', + }, + }, + type: 'object', + }, + distDir: { + maxLength: 1, + type: 'string', + }, + env: { + type: 'object', + }, + eslint: { + additionalProperties: false, + properties: { + dirs: { + items: { + minLength: 1, + type: 'string', + }, + type: 'array', + }, + ignoreDuringBuilds: { + type: 'boolean', + }, + }, + type: 'object', + }, + excludeDefaultMomentLocales: { + type: 'boolean', + }, + experimental: { + additionalProperties: false, + properties: { + amp: { + additionalProperties: false, + properties: { + optimizer: { + type: 'object', + }, + skipValidation: { + type: 'boolean', + }, + validator: { + type: 'string', + }, + }, + type: 'object', + }, + appDir: { + type: 'boolean', + }, + browsersListForSwc: { + type: 'boolean', + }, + cpus: { + type: 'number', + }, + craCompat: { + type: 'boolean', + }, + disableOptimizedLoading: { + type: 'boolean', + }, + disablePostcssPresetEnv: { + type: 'boolean', + }, + esmExternals: { + type: 'boolean', + }, + externalDir: { + type: 'boolean', + }, + forceSwcTransforms: { + type: 'boolean', + }, + fullySpecified: { + type: 'boolean', + }, + gzipSize: { + type: 'boolean', + }, + images: { + additionalProperties: false, + properties: { + allowFutureImage: { + type: 'boolean', + }, + remotePatterns: { + items: { + additionalProperties: false, + properties: { + hostname: { + minLength: 1, + type: 'string', + }, + pathname: { + minLength: 1, + type: 'string', + }, + port: { + minLength: 1, + type: 'string', + }, + protocol: { + // automatic typing doesn't like enum + enum: ['http', 'https'] as any, + type: 'string', + }, + }, + type: 'object', + }, + type: 'array', + }, + unoptimized: { + type: 'boolean', + }, + }, + type: 'object', + }, + incrementalCacheHandlerPath: { + type: 'string', + }, + isrFlushToDisk: { + type: 'boolean', + }, + isrMemoryCacheSize: { + type: 'number', + }, + largePageDataBytes: { + type: 'number', + }, + legacyBrowsers: { + type: 'boolean', + }, + manualClientBasePath: { + type: 'boolean', + }, + modularizeImports: { + type: 'object', + }, + newNextLinkBehavior: { + type: 'boolean', + }, + nextScriptWorkers: { + type: 'boolean', + }, + optimizeCss: { + type: 'boolean', + }, + outputFileTracingRoot: { + minLength: 1, + type: 'string', + }, + pageEnv: { + type: 'boolean', + }, + profiling: { + type: 'boolean', + }, + runtime: { + // automatic typing doesn't like enum + enum: ['experimental-edge', 'nodejs'] as any, + type: 'string', + }, + scrollRestoration: { + type: 'boolean', + }, + serverComponents: { + type: 'boolean', + }, + sharedPool: { + type: 'boolean', + }, + swcFileReading: { + type: 'boolean', + }, + swcMinify: { + type: 'boolean', + }, + swcMinifyDebugOptions: { + additionalProperties: false, + properties: { + compress: { + type: 'object', + }, + mangle: { + type: 'object', + }, + }, + type: 'object', + }, + swcPlugins: { + type: 'array', + }, + swcTraceProfiling: { + type: 'boolean', + }, + urlImports: { + items: { + type: 'string', + }, + type: 'array', + }, + workerThreads: { + type: 'boolean', + }, + }, + type: 'object', + }, + future: { + additionalProperties: false, + properties: {}, + type: 'object', + }, + generateBuildId: { + instanceof: 'Function', + } as any, + generateEtags: { + instanceof: 'Function', + } as any, + headers: { + instanceof: 'Function', + } as any, + httpAgentOptions: { + additionalProperties: false, + properties: { + keepAlive: { + type: 'boolean', + }, + }, + type: 'object', + }, + i18n: { + additionalProperties: false, + properties: { + defaultLocale: { + minLength: 1, + type: 'string', + }, + domains: { + items: { + additionalProperties: false, + properties: { + defaultLocale: { + minLength: 1, + type: 'string', + }, + domain: { + minLength: 1, + type: 'string', + }, + http: { + type: 'boolean', + }, + locales: { + items: { + minLength: 1, + type: 'string', + }, + type: 'array', + }, + }, + type: 'object', + }, + type: 'array', + }, + localeDetection: { + type: 'boolean', + }, + locales: { + items: { + minLength: 1, + type: 'string', + }, + type: 'array', + }, + }, + type: 'object', + }, + images: { + additionalProperties: false, + properties: { + contentSecurityPolicy: { + minLength: 1, + type: 'string', + }, + dangerouslyAllowSVG: { + type: 'boolean', + }, + deviceSizes: { + items: { + type: 'number', + }, + minItems: 1, + type: 'array', + }, + disableStaticImages: { + type: 'boolean', + }, + domains: { + items: { + type: 'string', + }, + type: 'array', + }, + formats: { + items: { + enum: ['image/avif', 'image/webp'], // automatic typing does not like enum + type: 'string', + } as any, + type: 'array', + }, + imageSizes: { + items: { + type: 'number', + }, + minItems: 1, + type: 'array', + }, + loader: { + // automatic typing does not like enum + enum: VALID_LOADERS as any, + type: 'string', + }, + minimumCacheTTL: { + type: 'number', + }, + path: { + minLength: 1, + type: 'string', + }, + }, + type: 'object', + }, + onDemandEntries: { + additionalProperties: false, + properties: { + maxInactiveAge: { + type: 'number', + }, + pagesBufferLength: { + type: 'number', + }, + }, + type: 'object', + }, + optimizeFonts: { + type: 'boolean', + }, + output: { + // automatic typing doesn't like enum + enum: ['standalone'] as any, + type: 'string', + }, + outputFileTracing: { + type: 'boolean', + }, + pageExtensions: { + minItems: 1, + type: 'array', + }, + poweredByHeader: { + type: 'boolean', + }, + productionBrowserSourceMaps: { + type: 'boolean', + }, + publicRuntimeConfig: { + type: 'object', + }, + reactStrictMode: { + type: 'boolean', + }, + redirects: { + instanceof: 'Function', + } as any, + rewrites: { + instanceof: 'Function', + } as any, + sassOptions: { + type: 'object', + }, + serverRuntimeConfig: { + type: 'object', + }, + staticPageGenerationTimeout: { + type: 'number', + }, + swcMinify: { + type: 'boolean', + }, + trailingSlash: { + type: 'boolean', + }, + typescript: { + additionalProperties: false, + properties: { + ignoreBuildErrors: { + type: 'boolean', + }, + tsconfigPath: { + minLength: 1, + type: 'string', + }, + }, + type: 'object', + }, + useFileSystemPublicRoutes: { + type: 'boolean', + }, + webpack: { + instanceof: 'Function', + } as any, + }, +} as JSONSchemaType + +export function validateConfig(userConfig: NextConfig): { + errors?: Array | null +} { + const ajv = new Ajv({ allErrors: true }) + ajvKeywords(ajv, ['instanceof']) + ajv.validate(configSchema, userConfig) + return { + errors: ajv.errors, + } +} diff --git a/packages/next/server/config.ts b/packages/next/server/config.ts index 181282c00b2a..b982bbf20a62 100644 --- a/packages/next/server/config.ts +++ b/packages/next/server/config.ts @@ -12,6 +12,7 @@ import { normalizeConfig, ExperimentalConfig, NextConfigComplete, + validateConfig, } from './config-shared' import { loadWebpackHook } from './config-utils' import { @@ -44,23 +45,6 @@ const experimentalWarning = execOnce( } ) -const missingExperimentalWarning = execOnce( - (configFileName: string, features: string[]) => { - const s = features.length > 1 ? 's' : '' - const dont = features.length > 1 ? 'do not' : 'does not' - const them = features.length > 1 ? 'them' : 'it' - Log.warn( - chalk.bold( - `You have defined experimental feature${s} (${features.join( - ', ' - )}) in ${configFileName} that ${dont} exist in this version of Next.js.` - ) - ) - Log.warn(`Please remove ${them} from your configuration.`) - console.warn() - } -) - function assignDefaults(userConfig: { [key: string]: any }) { const configFileName = userConfig.configFileName if (typeof userConfig.exportTrailingSlash !== 'undefined') { @@ -83,7 +67,6 @@ function assignDefaults(userConfig: { [key: string]: any }) { } if (key === 'experimental' && typeof value === 'object') { - const enabledMissingExperiments: string[] = [] const enabledExperiments: (keyof ExperimentalConfig)[] = [] // defaultConfig.experimental is predefined and will never be undefined @@ -92,9 +75,7 @@ function assignDefaults(userConfig: { [key: string]: any }) { for (const featureName of Object.keys( value ) as (keyof ExperimentalConfig)[]) { - if (!(featureName in defaultConfig.experimental)) { - enabledMissingExperiments.push(featureName) - } else if ( + if ( value[featureName] !== defaultConfig.experimental[featureName] ) { enabledExperiments.push(featureName) @@ -102,9 +83,6 @@ function assignDefaults(userConfig: { [key: string]: any }) { } } - if (enabledMissingExperiments.length > 0) { - missingExperimentalWarning(configFileName, enabledMissingExperiments) - } if (enabledExperiments.length > 0) { experimentalWarning(configFileName, enabledExperiments) } @@ -796,6 +774,16 @@ export default async function loadConfig( userConfigModule.default || userConfigModule ) + const validateResult = validateConfig(userConfig) + + if (validateResult.errors) { + Log.warn(`Invalid next.config.js options detected: `) + console.error( + JSON.stringify(validateResult.errors, null, 2), + '\nSee more info here: https://nextjs.org/docs/messages/invalid-next-config' + ) + } + if (Object.keys(userConfig).length === 0) { Log.warn( `Detected ${configFileName}, no exported configuration found. https://nextjs.org/docs/messages/empty-configuration` diff --git a/packages/next/taskfile.js b/packages/next/taskfile.js index fa8f54b68e71..0e635bf93161 100644 --- a/packages/next/taskfile.js +++ b/packages/next/taskfile.js @@ -176,6 +176,22 @@ export async function ncc_node_fetch(task, opts) { .target('compiled/node-fetch') } +// eslint-disable-next-line camelcase +export async function ncc_ajv(task, opts) { + await task + .source(opts.src || relative(__dirname, require.resolve('ajv'))) + .ncc({ packageName: 'ajv', externals }) + .target('compiled/ajv') +} + +// eslint-disable-next-line camelcase +export async function ncc_ajv_keywords(task, opts) { + await task + .source(opts.src || relative(__dirname, require.resolve('ajv-keywords'))) + .ncc({ packageName: 'ajv-keywords', externals }) + .target('compiled/ajv-keywords') +} + // eslint-disable-next-line camelcase externals['acorn'] = 'next/dist/compiled/acorn' export async function ncc_acorn(task, opts) { @@ -1708,6 +1724,8 @@ export async function ncc(task, opts) { 'ncc_hapi_accept', 'ncc_node_fetch', 'ncc_acorn', + 'ncc_ajv', + 'ncc_ajv_keywords', 'ncc_amphtml_validator', 'ncc_arg', 'ncc_async_retry', diff --git a/packages/next/tsconfig.json b/packages/next/tsconfig.json index b023d7fb53c5..62e323988175 100644 --- a/packages/next/tsconfig.json +++ b/packages/next/tsconfig.json @@ -8,5 +8,11 @@ "moduleResolution": "node", "jsx": "react" }, - "exclude": ["dist", "./*.d.ts", "future/*.d.ts", "image-types/global.d.ts"] + "exclude": [ + "dist", + "./*.d.ts", + "future/*.d.ts", + "image-types/global.d.ts", + "types/compiled.d.ts" + ] } diff --git a/packages/next/types/compiled.d.ts b/packages/next/types/compiled.d.ts new file mode 100644 index 000000000000..14cb5c6a6a02 --- /dev/null +++ b/packages/next/types/compiled.d.ts @@ -0,0 +1,7 @@ +declare module 'next/dist/compiled/ajv' { + // eslint-disable-next-line + export type JSONSchemaType = any + function Ajv(..._args: any[]): any + export default Ajv +} +declare module 'next/dist/compiled/ajv-keywords' diff --git a/packages/next/types/misc.d.ts b/packages/next/types/misc.d.ts index 641cc7069d5d..76aa3cb2c0f0 100644 --- a/packages/next/types/misc.d.ts +++ b/packages/next/types/misc.d.ts @@ -32,6 +32,18 @@ declare module 'next/dist/compiled/jest-worker' { export * from 'jest-worker' } +declare module 'next/dist/compiled/ajv' { + import ajv from 'ajv' + export default ajv + export * from 'ajv' +} + +declare module 'next/dist/compiled/ajv-keywords' { + import ajvKeywords from 'ajv-keywords' + export default ajvKeywords + export * from 'ajv-keywords' +} + declare module 'next/dist/compiled/react-is' { export * from 'react-is' } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 02eeb4bf01f7..f09e0dfedec4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -468,6 +468,8 @@ importers: '@vercel/ncc': 0.33.4 '@vercel/nft': 0.20.0 acorn: 8.5.0 + ajv: 8.11.0 + ajv-keywords: 5.1.0 amphtml-validator: 1.0.35 arg: 4.1.0 assert: 2.0.0 @@ -660,6 +662,8 @@ importers: '@vercel/ncc': 0.33.4 '@vercel/nft': 0.20.0 acorn: 8.5.0 + ajv: 8.11.0 + ajv-keywords: 5.1.0_ajv@8.11.0 amphtml-validator: 1.0.35 arg: 4.1.0 assert: 2.0.0 @@ -6646,6 +6650,15 @@ packages: ajv: 6.12.6 dev: true + /ajv-keywords/5.1.0_ajv@8.11.0: + resolution: {integrity: sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==} + peerDependencies: + ajv: ^8.8.2 + dependencies: + ajv: 8.11.0 + fast-deep-equal: 3.1.3 + dev: true + /ajv/6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} dependencies: @@ -6654,8 +6667,8 @@ packages: json-schema-traverse: 0.4.1 uri-js: 4.2.2 - /ajv/8.1.0: - resolution: {integrity: sha512-B/Sk2Ix7A36fs/ZkuGLIR86EdjbgR6fsAcbx9lOP/QBSXujDNbVmIS/U4Itz5k8fPFDeVZl/zQ/gJW4Jrq6XjQ==} + /ajv/8.11.0: + resolution: {integrity: sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==} dependencies: fast-deep-equal: 3.1.3 json-schema-traverse: 1.0.0 @@ -7729,7 +7742,7 @@ packages: mississippi: 3.0.0 mkdirp: 0.5.5 move-concurrently: 1.0.1 - promise-inflight: 1.0.1 + promise-inflight: 1.0.1_bluebird@3.7.2 rimraf: 2.7.1 ssri: 6.0.1 unique-filename: 1.1.1 @@ -18137,6 +18150,17 @@ packages: optional: true dev: true + /promise-inflight/1.0.1_bluebird@3.7.2: + resolution: {integrity: sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==} + peerDependencies: + bluebird: '*' + peerDependenciesMeta: + bluebird: + optional: true + dependencies: + bluebird: 3.7.2 + dev: true + /promise-polyfill/6.1.0: resolution: {integrity: sha512-g0LWaH0gFsxovsU7R5LrrhHhWAWiHRnh1GPrhXnPgYsDkIqjRYUYSZEsej/wtleDrz5xVSIDbeKfidztp2XHFQ==} dev: true @@ -20630,7 +20654,7 @@ packages: resolution: {integrity: sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA==} engines: {node: '>=10.0.0'} dependencies: - ajv: 8.1.0 + ajv: 8.11.0 lodash.truncate: 4.4.2 slice-ansi: 4.0.0 string-width: 4.2.3 @@ -20778,7 +20802,7 @@ packages: worker-farm: 1.7.0 dev: true - /terser-webpack-plugin/5.2.4_webpack@5.73.0: + /terser-webpack-plugin/5.2.4: resolution: {integrity: sha512-E2CkNMN+1cho04YpdANyRrn8CyN4yMy+WdFKZIySFZrGXZxJwJP6PMNGGc/Mcr6qygQHUUqRxnAPmi0M9f00XA==} engines: {node: '>= 10.13.0'} peerDependencies: @@ -20800,7 +20824,6 @@ packages: serialize-javascript: 6.0.0 source-map: 0.6.1 terser: 5.10.0 - webpack: 5.73.0 dev: true /terser/4.8.0: @@ -21728,7 +21751,7 @@ packages: dev: true /unset-value/1.0.0: - resolution: {integrity: sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=} + resolution: {integrity: sha512-PcA2tsuGSF9cnySLHTLSh2qrQiJ70mn+r+Glzxv2TWZblxsxCC52BDlZoPCsz7STd9pN7EZetkWZBAvk4cgZdQ==} engines: {node: '>=0.10.0'} requiresBuild: true dependencies: @@ -21808,7 +21831,7 @@ packages: punycode: 2.1.1 /urix/0.1.0: - resolution: {integrity: sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=} + resolution: {integrity: sha512-Am1ousAhSLBeB9cG/7k7r2R0zj50uDRlZHPGbazid5s9rlF1F/QKYObEKSIunSjIOkJZqwRRLpvewjEkM7pSqg==} deprecated: Please see https://github.com/lydell/urix#deprecated requiresBuild: true @@ -21854,7 +21877,7 @@ packages: requiresBuild: true /util-deprecate/1.0.2: - resolution: {integrity: sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=} + resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} dev: true /util-promisify/2.1.0: @@ -22229,7 +22252,7 @@ packages: neo-async: 2.6.2 schema-utils: 3.1.1 tapable: 2.2.0 - terser-webpack-plugin: 5.2.4_webpack@5.73.0 + terser-webpack-plugin: 5.2.4 watchpack: 2.4.0 webpack-sources: 3.2.3 transitivePeerDependencies: diff --git a/test/integration/config-validation/pages/index.js b/test/integration/config-validation/pages/index.js new file mode 100644 index 000000000000..08263e34c35f --- /dev/null +++ b/test/integration/config-validation/pages/index.js @@ -0,0 +1,3 @@ +export default function Page() { + return

index page

+} diff --git a/test/integration/config-validation/test/index.test.ts b/test/integration/config-validation/test/index.test.ts new file mode 100644 index 000000000000..451bf0f95203 --- /dev/null +++ b/test/integration/config-validation/test/index.test.ts @@ -0,0 +1,62 @@ +import path from 'path' +import { nextBuild } from 'next-test-utils' +import fs from 'fs-extra' + +const nextConfigPath = path.join(__dirname, '../next.config.js') + +describe('next.config.js validation', () => { + it.each([ + { + name: 'invalid config types', + configContent: ` + module.exports = { + swcMinify: 'hello', + rewrites: true, + images: { + loader: 'something' + } + } + `, + outputs: [ + '/images/loader', + 'must be equal to one of the allowed values', + 'imgix', + '/rewrites', + 'must pass \\"instanceof\\" keyword validation', + '/swcMinify', + 'must be boolean', + ], + }, + { + name: 'unexpected config fields', + configContent: ` + module.exports = { + nonExistent: true, + experimental: { + anotherNonExistent: true + } + } + `, + outputs: [ + 'nonExistent', + 'must NOT have additional properties', + 'anotherNonExistent', + 'must NOT have additional properties', + ], + }, + ])( + 'it should validate correctly for $name', + async ({ outputs, configContent }) => { + await fs.writeFile(nextConfigPath, configContent) + const result = await nextBuild(path.join(__dirname, '../'), undefined, { + stderr: true, + stdout: true, + }) + await fs.remove(nextConfigPath) + + for (const output of outputs) { + expect(result.stdout + result.stderr).toContain(output) + } + } + ) +}) From be07a8e5ec0d2485e38b78d8306fa25514f26f56 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Sun, 10 Jul 2022 21:53:33 -0500 Subject: [PATCH 2/8] update manifest --- errors/manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/errors/manifest.json b/errors/manifest.json index df0fa5f76351..9bc09eebbd1b 100644 --- a/errors/manifest.json +++ b/errors/manifest.json @@ -713,8 +713,8 @@ "path": "/errors/node-module-in-edge-runtime.md" }, { - "title": "invalid-next.config.js", - "path": "/errors/invalid-next.config.js.md" + "title": "invalid-next-config", + "path": "/errors/invalid-next-config.md" } ] } From 26700539f028fd304f0b21fa9cad590fc5272ad2 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Sun, 10 Jul 2022 21:58:15 -0500 Subject: [PATCH 3/8] update lib type --- packages/next/types/compiled.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next/types/compiled.d.ts b/packages/next/types/compiled.d.ts index 14cb5c6a6a02..423080f42961 100644 --- a/packages/next/types/compiled.d.ts +++ b/packages/next/types/compiled.d.ts @@ -1,7 +1,7 @@ declare module 'next/dist/compiled/ajv' { // eslint-disable-next-line export type JSONSchemaType = any - function Ajv(..._args: any[]): any + function Ajv(..._args: any[]): void export default Ajv } declare module 'next/dist/compiled/ajv-keywords' From b3f02534716f45839ae095bf199972f4a745f047 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Sun, 10 Jul 2022 22:16:30 -0500 Subject: [PATCH 4/8] remove old tests --- packages/next/server/config-shared.ts | 5 +- .../test/index.test.js | 46 ------------------- 2 files changed, 3 insertions(+), 48 deletions(-) diff --git a/packages/next/server/config-shared.ts b/packages/next/server/config-shared.ts index 14149a93beea..e835c4492922 100644 --- a/packages/next/server/config-shared.ts +++ b/packages/next/server/config-shared.ts @@ -758,8 +758,9 @@ const configSchema = { type: 'object', }, distDir: { - maxLength: 1, + minLength: 1, type: 'string', + nullable: true, }, env: { type: 'object', @@ -1167,7 +1168,7 @@ const configSchema = { instanceof: 'Function', } as any, }, -} as JSONSchemaType +} as JSONSchemaType export function validateConfig(userConfig: NextConfig): { errors?: Array | null diff --git a/test/integration/config-experimental-warning/test/index.test.js b/test/integration/config-experimental-warning/test/index.test.js index 151684dfb9ee..1f63e260e5c4 100644 --- a/test/integration/config-experimental-warning/test/index.test.js +++ b/test/integration/config-experimental-warning/test/index.test.js @@ -113,50 +113,4 @@ describe('Config Experimental Warning', () => { 'You have enabled experimental feature (newNextLinkBehavior) in next.config.mjs.' ) }) - - it('should show warning with next.config.js from object with non-exist experimental', async () => { - configFile.write(` - const config = { - experimental: { - foo: true - } - } - module.exports = config - `) - const { stderr } = await nextBuild(appDir, [], { stderr: true }) - expect(stderr).toMatch( - 'You have defined experimental feature (foo) in next.config.js that does not exist in this version' - ) - }) - - it('should show warning with next.config.mjs from object with non-exist experimental', async () => { - configFileMjs.write(` - const config = { - experimental: { - foo: true - } - } - export default config - `) - const { stderr } = await nextBuild(appDir, [], { stderr: true }) - expect(stderr).toMatch( - 'You have defined experimental feature (foo) in next.config.mjs that does not exist in this version' - ) - }) - - it('should show warning with next.config.js from object with multiple non-exist experimental', async () => { - configFile.write(` - const config = { - experimental: { - foo: true, - bar: false - } - } - module.exports = config - `) - const { stderr } = await nextBuild(appDir, [], { stderr: true }) - expect(stderr).toMatch( - 'You have defined experimental features (foo, bar) in next.config.js that do not exist in this version' - ) - }) }) From 51828c0f0d354ee9b090ae84a53a039f1e0fe050 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Mon, 11 Jul 2022 12:40:09 -0500 Subject: [PATCH 5/8] update to pre-build validation code --- packages/next/compiled/ajv-keywords/LICENSE | 21 - packages/next/compiled/ajv-keywords/index.js | 1 - .../next/compiled/ajv-keywords/package.json | 1 - packages/next/compiled/ajv/LICENSE | 22 - packages/next/compiled/ajv/ajv.js | 9 - packages/next/compiled/ajv/package.json | 1 - packages/next/index.d.ts | 1 - packages/next/package.json | 1 - packages/next/server/config-schema.ts | 609 +++++++++++++++++ packages/next/server/config-shared.ts | 611 +----------------- packages/next/taskfile.js | 44 +- packages/next/tsconfig.json | 8 +- packages/next/types/compiled.d.ts | 7 - packages/next/types/misc.d.ts | 12 - pnpm-lock.yaml | 42 +- .../config-validation/test/index.test.ts | 2 +- 16 files changed, 658 insertions(+), 734 deletions(-) delete mode 100644 packages/next/compiled/ajv-keywords/LICENSE delete mode 100644 packages/next/compiled/ajv-keywords/index.js delete mode 100644 packages/next/compiled/ajv-keywords/package.json delete mode 100644 packages/next/compiled/ajv/LICENSE delete mode 100644 packages/next/compiled/ajv/ajv.js delete mode 100644 packages/next/compiled/ajv/package.json create mode 100644 packages/next/server/config-schema.ts delete mode 100644 packages/next/types/compiled.d.ts diff --git a/packages/next/compiled/ajv-keywords/LICENSE b/packages/next/compiled/ajv-keywords/LICENSE deleted file mode 100644 index 90139aa74cef..000000000000 --- a/packages/next/compiled/ajv-keywords/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Evgeny Poberezkin - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/packages/next/compiled/ajv-keywords/index.js b/packages/next/compiled/ajv-keywords/index.js deleted file mode 100644 index da1a01132f5a..000000000000 --- a/packages/next/compiled/ajv-keywords/index.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{"use strict";var e={409:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});function getRangeDef(e){return()=>({keyword:e,type:"number",schemaType:"array",macro:function([t,r]){validateRangeSchema(t,r);return e==="range"?{minimum:t,maximum:r}:{exclusiveMinimum:t,exclusiveMaximum:r}},metaSchema:{type:"array",minItems:2,maxItems:2,items:{type:"number"}}});function validateRangeSchema(t,r){if(t>r||e==="exclusiveRange"&&t===r){throw new Error("There are no numbers in range")}}}t["default"]=getRangeDef},666:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});function getRequiredDef(e){return()=>({keyword:e,type:"object",schemaType:"array",macro(t){if(t.length===0)return true;if(t.length===1)return{required:t};const r=e==="anyRequired"?"anyOf":"oneOf";return{[r]:t.map((e=>({required:[e]})))}},metaSchema:{type:"array",items:{type:"string"}}})}t["default"]=getRequiredDef},775:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.usePattern=t.metaSchemaRef=void 0;const n=r(794);const s="http://json-schema.org/schema";function metaSchemaRef({defaultMeta:e}={}){return e===false?{}:{$ref:e||s}}t.metaSchemaRef=metaSchemaRef;function usePattern({gen:e,it:{opts:t}},r,s=(t.unicodeRegExp?"u":"")){const o=new RegExp(r,s);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,n._)`new RegExp(${r}, ${s})`})}t.usePattern=usePattern},830:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});function getDef(){return{keyword:"allRequired",type:"object",schemaType:"boolean",macro(e,t){if(!e)return true;const r=Object.keys(t.properties);if(r.length===0)return true;return{required:r}},dependencies:["properties"]}}t["default"]=getDef;e.exports=getDef},550:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(666));const o=(0,s.default)("anyRequired");t["default"]=o;e.exports=o},774:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});const n=r(775);function getDef(e){return{keyword:"deepProperties",type:"object",schemaType:"object",macro:function(e){const t=[];for(const r in e)t.push(getSchema(r,e[r]));return{allOf:t}},metaSchema:{type:"object",propertyNames:{type:"string",format:"json-pointer"},additionalProperties:(0,n.metaSchemaRef)(e)}}}t["default"]=getDef;function getSchema(e,t){const r=e.split("/");const n={};let s=n;for(let e=1;e{Object.defineProperty(t,"__esModule",{value:true});const n=r(794);function getDef(){return{keyword:"deepRequired",type:"object",schemaType:"array",code(e){const{schema:t,data:r}=e;const s=t.map((e=>(0,n._)`(${getData(e)}) === undefined`));e.fail((0,n.or)(...s));function getData(e){if(e==="")throw new Error("empty JSON pointer not allowed");const t=e.split("/");let s=r;const o=t.map(((e,t)=>t?s=(0,n._)`${s}${(0,n.getProperty)(unescapeJPSegment(e))}`:s));return(0,n.and)(...o)}},metaSchema:{type:"array",items:{type:"string",format:"json-pointer"}}}}t["default"]=getDef;function unescapeJPSegment(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}e.exports=getDef},407:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});const r={};const n={timestamp:()=>()=>Date.now(),datetime:()=>()=>(new Date).toISOString(),date:()=>()=>(new Date).toISOString().slice(0,10),time:()=>()=>(new Date).toISOString().slice(11),random:()=>()=>Math.random(),randomint:e=>{var t;const r=(t=e===null||e===void 0?void 0:e.max)!==null&&t!==void 0?t:2;return()=>Math.floor(Math.random()*r)},seq:e=>{var t;const n=(t=e===null||e===void 0?void 0:e.name)!==null&&t!==void 0?t:"";r[n]||(r[n]=0);return()=>r[n]++}};const s=Object.assign(_getDef,{DEFAULTS:n});function _getDef(){return{keyword:"dynamicDefaults",type:"object",schemaType:["string","object"],modifying:true,valid:true,compile(e,t,r){if(!r.opts.useDefaults||r.compositeRule)return()=>true;const n={};for(const t in e)n[t]=getDefault(e[t]);const s=r.opts.useDefaults==="empty";return t=>{for(const r in e){if(t[r]===undefined||s&&(t[r]===null||t[r]==="")){t[r]=n[r]()}}return true}},metaSchema:{type:"object",additionalProperties:{anyOf:[{type:"string"},{type:"object",additionalProperties:false,required:["func","args"],properties:{func:{type:"string"},args:{type:"object"}}}]}}}}function getDefault(e){return typeof e=="object"?getObjDefault(e):getStrDefault(e)}function getObjDefault({func:e,args:t}){const r=n[e];assertDefined(e,r);return r(t)}function getStrDefault(e=""){const t=n[e];assertDefined(e,t);return t()}function assertDefined(e,t){if(!t)throw new Error(`invalid "dynamicDefaults" keyword property value: ${e}`)}t["default"]=s;e.exports=s},4:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(409));const o=(0,s.default)("exclusiveRange");t["default"]=o;e.exports=o},372:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});const r={Object:Object,Array:Array,Function:Function,Number:Number,String:String,Date:Date,RegExp:RegExp};if(typeof Buffer!="undefined")r.Buffer=Buffer;if(typeof Promise!="undefined")r.Promise=Promise;const n=Object.assign(_getDef,{CONSTRUCTORS:r});function _getDef(){return{keyword:"instanceof",schemaType:["string","array"],compile(e){if(typeof e=="string"){const t=getConstructor(e);return e=>e instanceof t}if(Array.isArray(e)){const t=e.map(getConstructor);return e=>{for(const r of t){if(e instanceof r)return true}return false}}throw new Error("ajv implementation error")},metaSchema:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]}}}function getConstructor(e){const t=r[e];if(t)return t;throw new Error(`invalid "instanceof" keyword value ${e}`)}t["default"]=n;e.exports=n},762:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(666));const o=(0,s.default)("oneRequired");t["default"]=o;e.exports=o},816:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});const n=r(794);const s=r(775);const o={message:({params:{missingPattern:e}})=>(0,n.str)`should have property matching pattern '${e}'`,params:({params:{missingPattern:e}})=>(0,n._)`{missingPattern: ${e}}`};function getDef(){return{keyword:"patternRequired",type:"object",schemaType:"array",error:o,code(e){const{gen:t,schema:r,data:o}=e;if(r.length===0)return;const i=t.let("valid",true);for(const e of r)validateProperties(e);function validateProperties(r){const a=t.let("matched",false);t.forIn("key",o,(o=>{t.assign(a,(0,n._)`${(0,s.usePattern)(e,r)}.test(${o})`);t.if(a,(()=>t.break()))}));e.setParams({missingPattern:r});t.assign(i,(0,n.and)(i,a));e.pass(i)}},metaSchema:{type:"array",items:{type:"string",format:"regex"},uniqueItems:true}}}t["default"]=getDef;e.exports=getDef},583:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});function getDef(){return{keyword:"prohibited",type:"object",schemaType:"array",macro:function(e){if(e.length===0)return true;if(e.length===1)return{not:{required:e}};return{not:{anyOf:e.map((e=>({required:[e]})))}}},metaSchema:{type:"array",items:{type:"string"}}}}t["default"]=getDef;e.exports=getDef},851:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(409));const o=(0,s.default)("range");t["default"]=o;e.exports=o},545:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});const n=r(794);const s=r(775);const o={type:"object",properties:{pattern:{type:"string"},flags:{type:"string",nullable:true}},required:["pattern"],additionalProperties:false};const i=/^\/(.*)\/([gimuy]*)$/;function getDef(){return{keyword:"regexp",type:"string",schemaType:["string","object"],code(e){const{data:t,schema:r}=e;const o=getRegExp(r);e.pass((0,n._)`${o}.test(${t})`);function getRegExp(t){if(typeof t=="object")return(0,s.usePattern)(e,t.pattern,t.flags);const r=i.exec(t);if(r)return(0,s.usePattern)(e,r[1],r[2]);throw new Error("cannot parse string into RegExp")}},metaSchema:{anyOf:[{type:"string"},o]}}}t["default"]=getDef;e.exports=getDef},637:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});const n=r(794);const s=r(775);const o={message:({params:{schemaProp:e}})=>e?(0,n.str)`should match case "${e}" schema`:(0,n.str)`should match default case schema`,params:({params:{schemaProp:e}})=>e?(0,n._)`{failingCase: ${e}}`:(0,n._)`{failingDefault: true}`};function getDef(e){const t=(0,s.metaSchemaRef)(e);return[{keyword:"select",schemaType:["string","number","boolean","null"],$data:true,error:o,dependencies:["selectCases"],code(e){const{gen:t,schemaCode:r,parentSchema:s}=e;e.block$data(n.nil,(()=>{const o=t.let("valid",true);const i=t.name("_valid");const a=t.const("value",(0,n._)`${r} === null ? "null" : ${r}`);t.if(false);for(const r in s.selectCases){e.setParams({schemaProp:r});t.elseIf((0,n._)`"" + ${a} == ${r}`);const s=e.subschema({keyword:"selectCases",schemaProp:r},i);e.mergeEvaluated(s,n.Name);t.assign(o,i)}t.else();if(s.selectDefault!==undefined){e.setParams({schemaProp:undefined});const r=e.subschema({keyword:"selectDefault"},i);e.mergeEvaluated(r,n.Name);t.assign(o,i)}t.endIf();e.pass(o)}))}},{keyword:"selectCases",dependencies:["select"],metaSchema:{type:"object",additionalProperties:t}},{keyword:"selectDefault",dependencies:["select","selectCases"],metaSchema:t}]}t["default"]=getDef;e.exports=getDef},542:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});const n=r(794);const s={trimStart:e=>e.trimStart(),trimEnd:e=>e.trimEnd(),trimLeft:e=>e.trimStart(),trimRight:e=>e.trimEnd(),trim:e=>e.trim(),toLowerCase:e=>e.toLowerCase(),toUpperCase:e=>e.toUpperCase(),toEnumCase:(e,t)=>(t===null||t===void 0?void 0:t.hash[configKey(e)])||e};const o=Object.assign(_getDef,{transform:s});function _getDef(){return{keyword:"transform",schemaType:"array",before:"enum",code(e){const{gen:t,data:r,schema:o,parentSchema:i,it:a}=e;const{parentData:u,parentDataProperty:c}=a;const d=o;if(!d.length)return;let f;if(d.includes("toEnumCase")){const e=getEnumCaseCfg(i);f=t.scopeValue("obj",{ref:e,code:(0,n.stringify)(e)})}t.if((0,n._)`typeof ${r} == "string" && ${u} !== undefined`,(()=>{t.assign(r,transformExpr(d.slice()));t.assign((0,n._)`${u}[${c}]`,r)}));function transformExpr(e){if(!e.length)return r;const o=e.pop();if(!(o in s))throw new Error(`transform: unknown transformation ${o}`);const i=t.scopeValue("func",{ref:s[o],code:(0,n._)`require("ajv-keywords/dist/definitions/transform").transform${(0,n.getProperty)(o)}`});const a=transformExpr(e);return f&&o==="toEnumCase"?(0,n._)`${i}(${a}, ${f})`:(0,n._)`${i}(${a})`}},metaSchema:{type:"array",items:{type:"string",enum:Object.keys(s)}}}}function getEnumCaseCfg(e){const t={hash:{}};if(!e.enum)throw new Error('transform: "toEnumCase" requires "enum"');for(const r of e.enum){if(typeof r!=="string")continue;const e=configKey(r);if(t.hash[e]){throw new Error('transform: "toEnumCase" requires all lowercased "enum" values to be unique')}t.hash[e]=r}return t}function configKey(e){return e.toLowerCase()}t["default"]=o;e.exports=o},227:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});const n=r(794);const s=["undefined","string","number","object","function","boolean","symbol"];function getDef(){return{keyword:"typeof",schemaType:["string","array"],code(e){const{data:t,schema:r,schemaValue:s}=e;e.fail(typeof r=="string"?(0,n._)`typeof ${t} != ${r}`:(0,n._)`${s}.indexOf(typeof ${t}) < 0`)},metaSchema:{anyOf:[{type:"string",enum:s},{type:"array",items:{type:"string",enum:s}}]}}}t["default"]=getDef;e.exports=getDef},639:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});const n=r(914);const s=["number","integer","string","boolean","null"];function getDef(){return{keyword:"uniqueItemProperties",type:"array",schemaType:"array",compile(e,t){const r=getScalarKeys(e,t);return t=>{if(t.length<=1)return true;for(let s=0;s{var r,n,o;const i=(o=(n=(r=t.items)===null||r===void 0?void 0:r.properties)===null||n===void 0?void 0:n[e])===null||o===void 0?void 0:o.type;return Array.isArray(i)?!i.includes("object")&&!i.includes("array"):s.includes(i)}))}e.exports=getDef},523:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(149));const ajvKeywords=(e,t)=>{if(Array.isArray(t)){for(const r of t)get(r)(e);return e}if(t){get(t)(e);return e}for(t in s.default)get(t)(e);return e};ajvKeywords.get=get;function get(e){const t=s.default[e];if(!t)throw new Error("Unknown keyword "+e);return t}t["default"]=ajvKeywords;e.exports=ajvKeywords;e.exports["default"]=ajvKeywords},63:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(830));const allRequired=e=>e.addKeyword((0,s.default)());t["default"]=allRequired;e.exports=allRequired},890:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(550));const anyRequired=e=>e.addKeyword((0,s.default)());t["default"]=anyRequired;e.exports=anyRequired},952:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(774));const deepProperties=(e,t)=>e.addKeyword((0,s.default)(t));t["default"]=deepProperties;e.exports=deepProperties},97:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(464));const deepRequired=e=>e.addKeyword((0,s.default)());t["default"]=deepRequired;e.exports=deepRequired},949:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(407));const dynamicDefaults=e=>e.addKeyword((0,s.default)());t["default"]=dynamicDefaults;e.exports=dynamicDefaults},738:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(4));const exclusiveRange=e=>e.addKeyword((0,s.default)());t["default"]=exclusiveRange;e.exports=exclusiveRange},149:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(432));const o=n(r(825));const i=n(r(716));const a=n(r(738));const u=n(r(769));const c=n(r(928));const d=n(r(165));const f=n(r(63));const l=n(r(890));const p=n(r(257));const h=n(r(232));const m=n(r(371));const g=n(r(952));const y=n(r(97));const v=n(r(949));const w=n(r(863));const b={typeof:s.default,instanceof:o.default,range:i.default,exclusiveRange:a.default,regexp:u.default,transform:c.default,uniqueItemProperties:d.default,allRequired:f.default,anyRequired:l.default,oneRequired:p.default,patternRequired:h.default,prohibited:m.default,deepProperties:g.default,deepRequired:y.default,dynamicDefaults:v.default,select:w.default};t["default"]=b;e.exports=b},825:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(372));const instanceofPlugin=e=>e.addKeyword((0,s.default)());t["default"]=instanceofPlugin;e.exports=instanceofPlugin},257:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(762));const oneRequired=e=>e.addKeyword((0,s.default)());t["default"]=oneRequired;e.exports=oneRequired},232:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(816));const patternRequired=e=>e.addKeyword((0,s.default)());t["default"]=patternRequired;e.exports=patternRequired},371:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(583));const prohibited=e=>e.addKeyword((0,s.default)());t["default"]=prohibited;e.exports=prohibited},716:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(851));const range=e=>e.addKeyword((0,s.default)());t["default"]=range;e.exports=range},769:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(545));const regexp=e=>e.addKeyword((0,s.default)());t["default"]=regexp;e.exports=regexp},863:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(637));const select=(e,t)=>{(0,s.default)(t).forEach((t=>e.addKeyword(t)));return e};t["default"]=select;e.exports=select},928:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(542));const transform=e=>e.addKeyword((0,s.default)());t["default"]=transform;e.exports=transform},432:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(227));const typeofPlugin=e=>e.addKeyword((0,s.default)());t["default"]=typeofPlugin;e.exports=typeofPlugin},165:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const s=n(r(639));const uniqueItemProperties=e=>e.addKeyword((0,s.default)());t["default"]=uniqueItemProperties;e.exports=uniqueItemProperties},621:(e,t)=>{Object.defineProperty(t,"__esModule",{value:true});t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class _CodeOrName{}t._CodeOrName=_CodeOrName;t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Name extends _CodeOrName{constructor(e){super();if(!t.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return false}get names(){return{[this.str]:1}}}t.Name=Name;class _Code extends _CodeOrName{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return false;const e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce(((e,t)=>`${e}${t}`),"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce(((e,t)=>{if(t instanceof Name)e[t.str]=(e[t.str]||0)+1;return e}),{})}}t._Code=_Code;t.nil=new _Code("");function _(e,...t){const r=[e[0]];let n=0;while(n{Object.defineProperty(t,"__esModule",{value:true});t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const n=r(621);const s=r(997);var o=r(621);Object.defineProperty(t,"_",{enumerable:true,get:function(){return o._}});Object.defineProperty(t,"str",{enumerable:true,get:function(){return o.str}});Object.defineProperty(t,"strConcat",{enumerable:true,get:function(){return o.strConcat}});Object.defineProperty(t,"nil",{enumerable:true,get:function(){return o.nil}});Object.defineProperty(t,"getProperty",{enumerable:true,get:function(){return o.getProperty}});Object.defineProperty(t,"stringify",{enumerable:true,get:function(){return o.stringify}});Object.defineProperty(t,"regexpCode",{enumerable:true,get:function(){return o.regexpCode}});Object.defineProperty(t,"Name",{enumerable:true,get:function(){return o.Name}});var i=r(997);Object.defineProperty(t,"Scope",{enumerable:true,get:function(){return i.Scope}});Object.defineProperty(t,"ValueScope",{enumerable:true,get:function(){return i.ValueScope}});Object.defineProperty(t,"ValueScopeName",{enumerable:true,get:function(){return i.ValueScopeName}});Object.defineProperty(t,"varKinds",{enumerable:true,get:function(){return i.varKinds}});t.operators={GT:new n._Code(">"),GTE:new n._Code(">="),LT:new n._Code("<"),LTE:new n._Code("<="),EQ:new n._Code("==="),NEQ:new n._Code("!=="),NOT:new n._Code("!"),OR:new n._Code("||"),AND:new n._Code("&&"),ADD:new n._Code("+")};class Node{optimizeNodes(){return this}optimizeNames(e,t){return this}}class Def extends Node{constructor(e,t,r){super();this.varKind=e;this.name=t;this.rhs=r}render({es5:e,_n:t}){const r=e?s.varKinds.var:this.varKind;const n=this.rhs===undefined?"":` = ${this.rhs}`;return`${r} ${this.name}${n};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=optimizeExpr(this.rhs,e,t);return this}get names(){return this.rhs instanceof n._CodeOrName?this.rhs.names:{}}}class Assign extends Node{constructor(e,t,r){super();this.lhs=e;this.rhs=t;this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof n.Name&&!e[this.lhs.str]&&!this.sideEffects)return;this.rhs=optimizeExpr(this.rhs,e,t);return this}get names(){const e=this.lhs instanceof n.Name?{}:{...this.lhs.names};return addExprNames(e,this.rhs)}}class AssignOp extends Assign{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class Label extends Node{constructor(e){super();this.label=e;this.names={}}render({_n:e}){return`${this.label}:`+e}}class Break extends Node{constructor(e){super();this.label=e;this.names={}}render({_n:e}){const t=this.label?` ${this.label}`:"";return`break${t};`+e}}class Throw extends Node{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class AnyCode extends Node{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:undefined}optimizeNames(e,t){this.code=optimizeExpr(this.code,e,t);return this}get names(){return this.code instanceof n._CodeOrName?this.code.names:{}}}class ParentNode extends Node{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce(((t,r)=>t+r.render(e)),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;while(t--){const r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:undefined}optimizeNames(e,t){const{nodes:r}=this;let n=r.length;while(n--){const s=r[n];if(s.optimizeNames(e,t))continue;subtractNames(e,s.names);r.splice(n,1)}return r.length>0?this:undefined}get names(){return this.nodes.reduce(((e,t)=>addNames(e,t.names)),{})}}class BlockNode extends ParentNode{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class Root extends ParentNode{}class Else extends BlockNode{}Else.kind="else";class If extends BlockNode{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(e===true)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new Else(e):e}if(t){if(e===false)return t instanceof If?t:t.nodes;if(this.nodes.length)return this;return new If(not(e),t instanceof If?[t]:t.nodes)}if(e===false||!this.nodes.length)return undefined;return this}optimizeNames(e,t){var r;this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t);if(!(super.optimizeNames(e,t)||this.else))return;this.condition=optimizeExpr(this.condition,e,t);return this}get names(){const e=super.names;addExprNames(e,this.condition);if(this.else)addNames(e,this.else.names);return e}}If.kind="if";class For extends BlockNode{}For.kind="for";class ForLoop extends For{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;this.iteration=optimizeExpr(this.iteration,e,t);return this}get names(){return addNames(super.names,this.iteration.names)}}class ForRange extends For{constructor(e,t,r,n){super();this.varKind=e;this.name=t;this.from=r;this.to=n}render(e){const t=e.es5?s.varKinds.var:this.varKind;const{name:r,from:n,to:o}=this;return`for(${t} ${r}=${n}; ${r}<${o}; ${r}++)`+super.render(e)}get names(){const e=addExprNames(super.names,this.from);return addExprNames(e,this.to)}}class ForIter extends For{constructor(e,t,r,n){super();this.loop=e;this.varKind=t;this.name=r;this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;this.iterable=optimizeExpr(this.iterable,e,t);return this}get names(){return addNames(super.names,this.iterable.names)}}class Func extends BlockNode{constructor(e,t,r){super();this.name=e;this.args=t;this.async=r}render(e){const t=this.async?"async ":"";return`${t}function ${this.name}(${this.args})`+super.render(e)}}Func.kind="func";class Return extends ParentNode{render(e){return"return "+super.render(e)}}Return.kind="return";class Try extends BlockNode{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;super.optimizeNodes();(e=this.catch)===null||e===void 0?void 0:e.optimizeNodes();(t=this.finally)===null||t===void 0?void 0:t.optimizeNodes();return this}optimizeNames(e,t){var r,n;super.optimizeNames(e,t);(r=this.catch)===null||r===void 0?void 0:r.optimizeNames(e,t);(n=this.finally)===null||n===void 0?void 0:n.optimizeNames(e,t);return this}get names(){const e=super.names;if(this.catch)addNames(e,this.catch.names);if(this.finally)addNames(e,this.finally.names);return e}}class Catch extends BlockNode{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Catch.kind="catch";class Finally extends BlockNode{render(e){return"finally"+super.render(e)}}Finally.kind="finally";class CodeGen{constructor(e,t={}){this._values={};this._blockStarts=[];this._constants={};this.opts={...t,_n:t.lines?"\n":""};this._extScope=e;this._scope=new s.Scope({parent:e});this._nodes=[new Root]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);const n=this._values[r.prefix]||(this._values[r.prefix]=new Set);n.add(r);return r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){const s=this._scope.toName(t);if(r!==undefined&&n)this._constants[s.str]=r;this._leafNode(new Def(e,s,r));return s}const(e,t,r){return this._def(s.varKinds.const,e,t,r)}let(e,t,r){return this._def(s.varKinds.let,e,t,r)}var(e,t,r){return this._def(s.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Assign(e,t,r))}add(e,r){return this._leafNode(new AssignOp(e,t.operators.ADD,r))}code(e){if(typeof e=="function")e();else if(e!==n.nil)this._leafNode(new AnyCode(e));return this}object(...e){const t=["{"];for(const[r,s]of e){if(t.length>1)t.push(",");t.push(r);if(r!==s||this.opts.es5){t.push(":");(0,n.addCodeArg)(t,s)}}t.push("}");return new n._Code(t)}if(e,t,r){this._blockNode(new If(e));if(t&&r){this.code(t).else().code(r).endIf()}else if(t){this.code(t).endIf()}else if(r){throw new Error('CodeGen: "else" body without "then" body')}return this}elseIf(e){return this._elseNode(new If(e))}else(){return this._elseNode(new Else)}endIf(){return this._endBlockNode(If,Else)}_for(e,t){this._blockNode(e);if(t)this.code(t).endFor();return this}for(e,t){return this._for(new ForLoop(e),t)}forRange(e,t,r,n,o=(this.opts.es5?s.varKinds.var:s.varKinds.let)){const i=this._scope.toName(e);return this._for(new ForRange(o,i,t,r),(()=>n(i)))}forOf(e,t,r,o=s.varKinds.const){const i=this._scope.toName(e);if(this.opts.es5){const e=t instanceof n.Name?t:this.var("_arr",t);return this.forRange("_i",0,(0,n._)`${e}.length`,(t=>{this.var(i,(0,n._)`${e}[${t}]`);r(i)}))}return this._for(new ForIter("of",o,i,t),(()=>r(i)))}forIn(e,t,r,o=(this.opts.es5?s.varKinds.var:s.varKinds.const)){if(this.opts.ownProperties){return this.forOf(e,(0,n._)`Object.keys(${t})`,r)}const i=this._scope.toName(e);return this._for(new ForIter("in",o,i,t),(()=>r(i)))}endFor(){return this._endBlockNode(For)}label(e){return this._leafNode(new Label(e))}break(e){return this._leafNode(new Break(e))}return(e){const t=new Return;this._blockNode(t);this.code(e);if(t.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Return)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const n=new Try;this._blockNode(n);this.code(e);if(t){const e=this.name("e");this._currNode=n.catch=new Catch(e);t(e)}if(r){this._currNode=n.finally=new Finally;this.code(r)}return this._endBlockNode(Catch,Finally)}throw(e){return this._leafNode(new Throw(e))}block(e,t){this._blockStarts.push(this._nodes.length);if(e)this.code(e).endBlock(t);return this}endBlock(e){const t=this._blockStarts.pop();if(t===undefined)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||e!==undefined&&r!==e){throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`)}this._nodes.length=t;return this}func(e,t=n.nil,r,s){this._blockNode(new Func(e,t,r));if(s)this.code(s).endFunc();return this}endFunc(){return this._endBlockNode(Func)}optimize(e=1){while(e-- >0){this._root.optimizeNodes();this._root.optimizeNames(this._root.names,this._constants)}}_leafNode(e){this._currNode.nodes.push(e);return this}_blockNode(e){this._currNode.nodes.push(e);this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t){this._nodes.pop();return this}throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof If)){throw new Error('CodeGen: "else" without "if"')}this._currNode=t.else=e;return this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}}t.CodeGen=CodeGen;function addNames(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function addExprNames(e,t){return t instanceof n._CodeOrName?addNames(e,t.names):e}function optimizeExpr(e,t,r){if(e instanceof n.Name)return replaceName(e);if(!canOptimize(e))return e;return new n._Code(e._items.reduce(((e,t)=>{if(t instanceof n.Name)t=replaceName(t);if(t instanceof n._Code)e.push(...t._items);else e.push(t);return e}),[]));function replaceName(e){const n=r[e.str];if(n===undefined||t[e.str]!==1)return e;delete t[e.str];return n}function canOptimize(e){return e instanceof n._Code&&e._items.some((e=>e instanceof n.Name&&t[e.str]===1&&r[e.str]!==undefined))}}function subtractNames(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function not(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,n._)`!${par(e)}`}t.not=not;const a=mappend(t.operators.AND);function and(...e){return e.reduce(a)}t.and=and;const u=mappend(t.operators.OR);function or(...e){return e.reduce(u)}t.or=or;function mappend(e){return(t,r)=>t===n.nil?r:r===n.nil?t:(0,n._)`${par(t)} ${e} ${par(r)}`}function par(e){return e instanceof n.Name?e:(0,n._)`(${e})`}},997:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:true});t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const n=r(621);class ValueError extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var s;(function(e){e[e["Started"]=0]="Started";e[e["Completed"]=1]="Completed"})(s=t.UsedValueState||(t.UsedValueState={}));t.varKinds={const:new n.Name("const"),let:new n.Name("let"),var:new n.Name("var")};class Scope{constructor({prefixes:e,parent:t}={}){this._names={};this._prefixes=e;this._parent=t}toName(e){return e instanceof n.Name?e:this.name(e)}name(e){return new n.Name(this._newName(e))}_newName(e){const t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e)){throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`)}return this._names[e]={prefix:e,index:0}}}t.Scope=Scope;class ValueScopeName extends n.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e;this.scopePath=(0,n._)`.${new n.Name(t)}[${r}]`}}t.ValueScopeName=ValueScopeName;const o=(0,n._)`\n`;class ValueScope extends Scope{constructor(e){super(e);this._values={};this._scope=e.scope;this.opts={...e,_n:e.lines?o:n.nil}}get(){return this._scope}name(e){return new ValueScopeName(e,this._newName(e))}value(e,t){var r;if(t.ref===undefined)throw new Error("CodeGen: ref must be passed in value");const n=this.toName(e);const{prefix:s}=n;const o=(r=t.key)!==null&&r!==void 0?r:t.ref;let i=this._values[s];if(i){const e=i.get(o);if(e)return e}else{i=this._values[s]=new Map}i.set(o,n);const a=this._scope[s]||(this._scope[s]=[]);const u=a.length;a[u]=t.ref;n.setValue(t,{property:s,itemIndex:u});return n}getValue(e,t){const r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(t=>{if(t.scopePath===undefined)throw new Error(`CodeGen: name "${t}" has no value`);return(0,n._)`${e}${t.scopePath}`}))}scopeCode(e=this._values,t,r){return this._reduceValues(e,(e=>{if(e.value===undefined)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),t,r)}_reduceValues(e,r,o={},i){let a=n.nil;for(const u in e){const c=e[u];if(!c)continue;const d=o[u]=o[u]||new Map;c.forEach((e=>{if(d.has(e))return;d.set(e,s.Started);let o=r(e);if(o){const r=this.opts.es5?t.varKinds.var:t.varKinds.const;a=(0,n._)`${a}${r} ${e} = ${o};${this.opts._n}`}else if(o=i===null||i===void 0?void 0:i(e)){a=(0,n._)`${a}${o}${this.opts._n}`}else{throw new ValueError(e)}d.set(e,s.Completed)}))}return a}}t.ValueScope=ValueScope},914:e=>{e.exports=function equal(e,t){if(e===t)return true;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return false;var r,n,s;if(Array.isArray(e)){r=e.length;if(r!=t.length)return false;for(n=r;n--!==0;)if(!equal(e[n],t[n]))return false;return true}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();s=Object.keys(e);r=s.length;if(r!==Object.keys(t).length)return false;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,s[n]))return false;for(n=r;n--!==0;){var o=s[n];if(!equal(e[o],t[o]))return false}return true}return e!==e&&t!==t}}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var s=t[r]={exports:{}};var o=true;try{e[r].call(s.exports,s,s.exports,__nccwpck_require__);o=false}finally{if(o)delete t[r]}return s.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(523);module.exports=r})(); \ No newline at end of file diff --git a/packages/next/compiled/ajv-keywords/package.json b/packages/next/compiled/ajv-keywords/package.json deleted file mode 100644 index 807d8a201280..000000000000 --- a/packages/next/compiled/ajv-keywords/package.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"ajv-keywords","main":"index.js","author":"Evgeny Poberezkin","license":"MIT"} diff --git a/packages/next/compiled/ajv/LICENSE b/packages/next/compiled/ajv/LICENSE deleted file mode 100644 index 139162ad2c38..000000000000 --- a/packages/next/compiled/ajv/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015-2021 Evgeny Poberezkin - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/packages/next/compiled/ajv/ajv.js b/packages/next/compiled/ajv/ajv.js deleted file mode 100644 index 385b65f13247..000000000000 --- a/packages/next/compiled/ajv/ajv.js +++ /dev/null @@ -1,9 +0,0 @@ -(()=>{var e={7097:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;const s=r(2046);const a=r(7127);const n=r(764);const o=r(9520);const i=["/properties"];const c="http://json-schema.org/draft-07/schema";class Ajv extends s.default{_addVocabularies(){super._addVocabularies();a.default.forEach((e=>this.addVocabulary(e)));if(this.opts.discriminator)this.addKeyword(n.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();if(!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(o,i):o;this.addMetaSchema(e,c,false);this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:undefined)}}e.exports=t=Ajv;Object.defineProperty(t,"__esModule",{value:true});t["default"]=Ajv;var u=r(2069);Object.defineProperty(t,"KeywordCxt",{enumerable:true,get:function(){return u.KeywordCxt}});var l=r(7794);Object.defineProperty(t,"_",{enumerable:true,get:function(){return l._}});Object.defineProperty(t,"str",{enumerable:true,get:function(){return l.str}});Object.defineProperty(t,"stringify",{enumerable:true,get:function(){return l.stringify}});Object.defineProperty(t,"nil",{enumerable:true,get:function(){return l.nil}});Object.defineProperty(t,"Name",{enumerable:true,get:function(){return l.Name}});Object.defineProperty(t,"CodeGen",{enumerable:true,get:function(){return l.CodeGen}})},7621:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class _CodeOrName{}t._CodeOrName=_CodeOrName;t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Name extends _CodeOrName{constructor(e){super();if(!t.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return false}get names(){return{[this.str]:1}}}t.Name=Name;class _Code extends _CodeOrName{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return false;const e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce(((e,t)=>`${e}${t}`),"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce(((e,t)=>{if(t instanceof Name)e[t.str]=(e[t.str]||0)+1;return e}),{})}}t._Code=_Code;t.nil=new _Code("");function _(e,...t){const r=[e[0]];let s=0;while(s{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;const s=r(7621);const a=r(4997);var n=r(7621);Object.defineProperty(t,"_",{enumerable:true,get:function(){return n._}});Object.defineProperty(t,"str",{enumerable:true,get:function(){return n.str}});Object.defineProperty(t,"strConcat",{enumerable:true,get:function(){return n.strConcat}});Object.defineProperty(t,"nil",{enumerable:true,get:function(){return n.nil}});Object.defineProperty(t,"getProperty",{enumerable:true,get:function(){return n.getProperty}});Object.defineProperty(t,"stringify",{enumerable:true,get:function(){return n.stringify}});Object.defineProperty(t,"regexpCode",{enumerable:true,get:function(){return n.regexpCode}});Object.defineProperty(t,"Name",{enumerable:true,get:function(){return n.Name}});var o=r(4997);Object.defineProperty(t,"Scope",{enumerable:true,get:function(){return o.Scope}});Object.defineProperty(t,"ValueScope",{enumerable:true,get:function(){return o.ValueScope}});Object.defineProperty(t,"ValueScopeName",{enumerable:true,get:function(){return o.ValueScopeName}});Object.defineProperty(t,"varKinds",{enumerable:true,get:function(){return o.varKinds}});t.operators={GT:new s._Code(">"),GTE:new s._Code(">="),LT:new s._Code("<"),LTE:new s._Code("<="),EQ:new s._Code("==="),NEQ:new s._Code("!=="),NOT:new s._Code("!"),OR:new s._Code("||"),AND:new s._Code("&&"),ADD:new s._Code("+")};class Node{optimizeNodes(){return this}optimizeNames(e,t){return this}}class Def extends Node{constructor(e,t,r){super();this.varKind=e;this.name=t;this.rhs=r}render({es5:e,_n:t}){const r=e?a.varKinds.var:this.varKind;const s=this.rhs===undefined?"":` = ${this.rhs}`;return`${r} ${this.name}${s};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=optimizeExpr(this.rhs,e,t);return this}get names(){return this.rhs instanceof s._CodeOrName?this.rhs.names:{}}}class Assign extends Node{constructor(e,t,r){super();this.lhs=e;this.rhs=t;this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof s.Name&&!e[this.lhs.str]&&!this.sideEffects)return;this.rhs=optimizeExpr(this.rhs,e,t);return this}get names(){const e=this.lhs instanceof s.Name?{}:{...this.lhs.names};return addExprNames(e,this.rhs)}}class AssignOp extends Assign{constructor(e,t,r,s){super(e,r,s);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class Label extends Node{constructor(e){super();this.label=e;this.names={}}render({_n:e}){return`${this.label}:`+e}}class Break extends Node{constructor(e){super();this.label=e;this.names={}}render({_n:e}){const t=this.label?` ${this.label}`:"";return`break${t};`+e}}class Throw extends Node{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class AnyCode extends Node{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:undefined}optimizeNames(e,t){this.code=optimizeExpr(this.code,e,t);return this}get names(){return this.code instanceof s._CodeOrName?this.code.names:{}}}class ParentNode extends Node{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce(((t,r)=>t+r.render(e)),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;while(t--){const r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:undefined}optimizeNames(e,t){const{nodes:r}=this;let s=r.length;while(s--){const a=r[s];if(a.optimizeNames(e,t))continue;subtractNames(e,a.names);r.splice(s,1)}return r.length>0?this:undefined}get names(){return this.nodes.reduce(((e,t)=>addNames(e,t.names)),{})}}class BlockNode extends ParentNode{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class Root extends ParentNode{}class Else extends BlockNode{}Else.kind="else";class If extends BlockNode{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(e===true)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new Else(e):e}if(t){if(e===false)return t instanceof If?t:t.nodes;if(this.nodes.length)return this;return new If(not(e),t instanceof If?[t]:t.nodes)}if(e===false||!this.nodes.length)return undefined;return this}optimizeNames(e,t){var r;this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t);if(!(super.optimizeNames(e,t)||this.else))return;this.condition=optimizeExpr(this.condition,e,t);return this}get names(){const e=super.names;addExprNames(e,this.condition);if(this.else)addNames(e,this.else.names);return e}}If.kind="if";class For extends BlockNode{}For.kind="for";class ForLoop extends For{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;this.iteration=optimizeExpr(this.iteration,e,t);return this}get names(){return addNames(super.names,this.iteration.names)}}class ForRange extends For{constructor(e,t,r,s){super();this.varKind=e;this.name=t;this.from=r;this.to=s}render(e){const t=e.es5?a.varKinds.var:this.varKind;const{name:r,from:s,to:n}=this;return`for(${t} ${r}=${s}; ${r}<${n}; ${r}++)`+super.render(e)}get names(){const e=addExprNames(super.names,this.from);return addExprNames(e,this.to)}}class ForIter extends For{constructor(e,t,r,s){super();this.loop=e;this.varKind=t;this.name=r;this.iterable=s}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;this.iterable=optimizeExpr(this.iterable,e,t);return this}get names(){return addNames(super.names,this.iterable.names)}}class Func extends BlockNode{constructor(e,t,r){super();this.name=e;this.args=t;this.async=r}render(e){const t=this.async?"async ":"";return`${t}function ${this.name}(${this.args})`+super.render(e)}}Func.kind="func";class Return extends ParentNode{render(e){return"return "+super.render(e)}}Return.kind="return";class Try extends BlockNode{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;super.optimizeNodes();(e=this.catch)===null||e===void 0?void 0:e.optimizeNodes();(t=this.finally)===null||t===void 0?void 0:t.optimizeNodes();return this}optimizeNames(e,t){var r,s;super.optimizeNames(e,t);(r=this.catch)===null||r===void 0?void 0:r.optimizeNames(e,t);(s=this.finally)===null||s===void 0?void 0:s.optimizeNames(e,t);return this}get names(){const e=super.names;if(this.catch)addNames(e,this.catch.names);if(this.finally)addNames(e,this.finally.names);return e}}class Catch extends BlockNode{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Catch.kind="catch";class Finally extends BlockNode{render(e){return"finally"+super.render(e)}}Finally.kind="finally";class CodeGen{constructor(e,t={}){this._values={};this._blockStarts=[];this._constants={};this.opts={...t,_n:t.lines?"\n":""};this._extScope=e;this._scope=new a.Scope({parent:e});this._nodes=[new Root]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);const s=this._values[r.prefix]||(this._values[r.prefix]=new Set);s.add(r);return r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,s){const a=this._scope.toName(t);if(r!==undefined&&s)this._constants[a.str]=r;this._leafNode(new Def(e,a,r));return a}const(e,t,r){return this._def(a.varKinds.const,e,t,r)}let(e,t,r){return this._def(a.varKinds.let,e,t,r)}var(e,t,r){return this._def(a.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Assign(e,t,r))}add(e,r){return this._leafNode(new AssignOp(e,t.operators.ADD,r))}code(e){if(typeof e=="function")e();else if(e!==s.nil)this._leafNode(new AnyCode(e));return this}object(...e){const t=["{"];for(const[r,a]of e){if(t.length>1)t.push(",");t.push(r);if(r!==a||this.opts.es5){t.push(":");(0,s.addCodeArg)(t,a)}}t.push("}");return new s._Code(t)}if(e,t,r){this._blockNode(new If(e));if(t&&r){this.code(t).else().code(r).endIf()}else if(t){this.code(t).endIf()}else if(r){throw new Error('CodeGen: "else" body without "then" body')}return this}elseIf(e){return this._elseNode(new If(e))}else(){return this._elseNode(new Else)}endIf(){return this._endBlockNode(If,Else)}_for(e,t){this._blockNode(e);if(t)this.code(t).endFor();return this}for(e,t){return this._for(new ForLoop(e),t)}forRange(e,t,r,s,n=(this.opts.es5?a.varKinds.var:a.varKinds.let)){const o=this._scope.toName(e);return this._for(new ForRange(n,o,t,r),(()=>s(o)))}forOf(e,t,r,n=a.varKinds.const){const o=this._scope.toName(e);if(this.opts.es5){const e=t instanceof s.Name?t:this.var("_arr",t);return this.forRange("_i",0,(0,s._)`${e}.length`,(t=>{this.var(o,(0,s._)`${e}[${t}]`);r(o)}))}return this._for(new ForIter("of",n,o,t),(()=>r(o)))}forIn(e,t,r,n=(this.opts.es5?a.varKinds.var:a.varKinds.const)){if(this.opts.ownProperties){return this.forOf(e,(0,s._)`Object.keys(${t})`,r)}const o=this._scope.toName(e);return this._for(new ForIter("in",n,o,t),(()=>r(o)))}endFor(){return this._endBlockNode(For)}label(e){return this._leafNode(new Label(e))}break(e){return this._leafNode(new Break(e))}return(e){const t=new Return;this._blockNode(t);this.code(e);if(t.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Return)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const s=new Try;this._blockNode(s);this.code(e);if(t){const e=this.name("e");this._currNode=s.catch=new Catch(e);t(e)}if(r){this._currNode=s.finally=new Finally;this.code(r)}return this._endBlockNode(Catch,Finally)}throw(e){return this._leafNode(new Throw(e))}block(e,t){this._blockStarts.push(this._nodes.length);if(e)this.code(e).endBlock(t);return this}endBlock(e){const t=this._blockStarts.pop();if(t===undefined)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||e!==undefined&&r!==e){throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`)}this._nodes.length=t;return this}func(e,t=s.nil,r,a){this._blockNode(new Func(e,t,r));if(a)this.code(a).endFunc();return this}endFunc(){return this._endBlockNode(Func)}optimize(e=1){while(e-- >0){this._root.optimizeNodes();this._root.optimizeNames(this._root.names,this._constants)}}_leafNode(e){this._currNode.nodes.push(e);return this}_blockNode(e){this._currNode.nodes.push(e);this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t){this._nodes.pop();return this}throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof If)){throw new Error('CodeGen: "else" without "if"')}this._currNode=t.else=e;return this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}}t.CodeGen=CodeGen;function addNames(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function addExprNames(e,t){return t instanceof s._CodeOrName?addNames(e,t.names):e}function optimizeExpr(e,t,r){if(e instanceof s.Name)return replaceName(e);if(!canOptimize(e))return e;return new s._Code(e._items.reduce(((e,t)=>{if(t instanceof s.Name)t=replaceName(t);if(t instanceof s._Code)e.push(...t._items);else e.push(t);return e}),[]));function replaceName(e){const s=r[e.str];if(s===undefined||t[e.str]!==1)return e;delete t[e.str];return s}function canOptimize(e){return e instanceof s._Code&&e._items.some((e=>e instanceof s.Name&&t[e.str]===1&&r[e.str]!==undefined))}}function subtractNames(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function not(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,s._)`!${par(e)}`}t.not=not;const i=mappend(t.operators.AND);function and(...e){return e.reduce(i)}t.and=and;const c=mappend(t.operators.OR);function or(...e){return e.reduce(c)}t.or=or;function mappend(e){return(t,r)=>t===s.nil?r:r===s.nil?t:(0,s._)`${par(t)} ${e} ${par(r)}`}function par(e){return e instanceof s.Name?e:(0,s._)`(${e})`}},4997:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;const s=r(7621);class ValueError extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var a;(function(e){e[e["Started"]=0]="Started";e[e["Completed"]=1]="Completed"})(a=t.UsedValueState||(t.UsedValueState={}));t.varKinds={const:new s.Name("const"),let:new s.Name("let"),var:new s.Name("var")};class Scope{constructor({prefixes:e,parent:t}={}){this._names={};this._prefixes=e;this._parent=t}toName(e){return e instanceof s.Name?e:this.name(e)}name(e){return new s.Name(this._newName(e))}_newName(e){const t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e)){throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`)}return this._names[e]={prefix:e,index:0}}}t.Scope=Scope;class ValueScopeName extends s.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e;this.scopePath=(0,s._)`.${new s.Name(t)}[${r}]`}}t.ValueScopeName=ValueScopeName;const n=(0,s._)`\n`;class ValueScope extends Scope{constructor(e){super(e);this._values={};this._scope=e.scope;this.opts={...e,_n:e.lines?n:s.nil}}get(){return this._scope}name(e){return new ValueScopeName(e,this._newName(e))}value(e,t){var r;if(t.ref===undefined)throw new Error("CodeGen: ref must be passed in value");const s=this.toName(e);const{prefix:a}=s;const n=(r=t.key)!==null&&r!==void 0?r:t.ref;let o=this._values[a];if(o){const e=o.get(n);if(e)return e}else{o=this._values[a]=new Map}o.set(n,s);const i=this._scope[a]||(this._scope[a]=[]);const c=i.length;i[c]=t.ref;s.setValue(t,{property:a,itemIndex:c});return s}getValue(e,t){const r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(t=>{if(t.scopePath===undefined)throw new Error(`CodeGen: name "${t}" has no value`);return(0,s._)`${e}${t.scopePath}`}))}scopeCode(e=this._values,t,r){return this._reduceValues(e,(e=>{if(e.value===undefined)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code}),t,r)}_reduceValues(e,r,n={},o){let i=s.nil;for(const c in e){const u=e[c];if(!u)continue;const l=n[c]=n[c]||new Map;u.forEach((e=>{if(l.has(e))return;l.set(e,a.Started);let n=r(e);if(n){const r=this.opts.es5?t.varKinds.var:t.varKinds.const;i=(0,s._)`${i}${r} ${e} = ${n};${this.opts._n}`}else if(n=o===null||o===void 0?void 0:o(e)){i=(0,s._)`${i}${n}${this.opts._n}`}else{throw new ValueError(e)}l.set(e,a.Completed)}))}return i}}t.ValueScope=ValueScope},4337:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;const s=r(7794);const a=r(5470);const n=r(8030);t.keywordError={message:({keyword:e})=>(0,s.str)`must pass "${e}" keyword validation`};t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,s.str)`"${e}" keyword must be ${t} ($data)`:(0,s.str)`"${e}" keyword is invalid ($data)`};function reportError(e,r=t.keywordError,a,n){const{it:o}=e;const{gen:i,compositeRule:c,allErrors:u}=o;const l=errorObjectCode(e,r,a);if(n!==null&&n!==void 0?n:c||u){addError(i,l)}else{returnErrors(o,(0,s._)`[${l}]`)}}t.reportError=reportError;function reportExtraError(e,r=t.keywordError,s){const{it:a}=e;const{gen:o,compositeRule:i,allErrors:c}=a;const u=errorObjectCode(e,r,s);addError(o,u);if(!(i||c)){returnErrors(a,n.default.vErrors)}}t.reportExtraError=reportExtraError;function resetErrorsCount(e,t){e.assign(n.default.errors,t);e.if((0,s._)`${n.default.vErrors} !== null`,(()=>e.if(t,(()=>e.assign((0,s._)`${n.default.vErrors}.length`,t)),(()=>e.assign(n.default.vErrors,null)))))}t.resetErrorsCount=resetErrorsCount;function extendErrors({gen:e,keyword:t,schemaValue:r,data:a,errsCount:o,it:i}){if(o===undefined)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",o,n.default.errors,(o=>{e.const(c,(0,s._)`${n.default.vErrors}[${o}]`);e.if((0,s._)`${c}.instancePath === undefined`,(()=>e.assign((0,s._)`${c}.instancePath`,(0,s.strConcat)(n.default.instancePath,i.errorPath))));e.assign((0,s._)`${c}.schemaPath`,(0,s.str)`${i.errSchemaPath}/${t}`);if(i.opts.verbose){e.assign((0,s._)`${c}.schema`,r);e.assign((0,s._)`${c}.data`,a)}}))}t.extendErrors=extendErrors;function addError(e,t){const r=e.const("err",t);e.if((0,s._)`${n.default.vErrors} === null`,(()=>e.assign(n.default.vErrors,(0,s._)`[${r}]`)),(0,s._)`${n.default.vErrors}.push(${r})`);e.code((0,s._)`${n.default.errors}++`)}function returnErrors(e,t){const{gen:r,validateName:a,schemaEnv:n}=e;if(n.$async){r.throw((0,s._)`new ${e.ValidationError}(${t})`)}else{r.assign((0,s._)`${a}.errors`,t);r.return(false)}}const o={keyword:new s.Name("keyword"),schemaPath:new s.Name("schemaPath"),params:new s.Name("params"),propertyName:new s.Name("propertyName"),message:new s.Name("message"),schema:new s.Name("schema"),parentSchema:new s.Name("parentSchema")};function errorObjectCode(e,t,r){const{createErrors:a}=e.it;if(a===false)return(0,s._)`{}`;return errorObject(e,t,r)}function errorObject(e,t,r={}){const{gen:s,it:a}=e;const n=[errorInstancePath(a,r),errorSchemaPath(e,r)];extraErrorProps(e,t,n);return s.object(...n)}function errorInstancePath({errorPath:e},{instancePath:t}){const r=t?(0,s.str)`${e}${(0,a.getErrorPath)(t,a.Type.Str)}`:e;return[n.default.instancePath,(0,s.strConcat)(n.default.instancePath,r)]}function errorSchemaPath({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let i=n?t:(0,s.str)`${t}/${e}`;if(r){i=(0,s.str)`${i}${(0,a.getErrorPath)(r,a.Type.Str)}`}return[o.schemaPath,i]}function extraErrorProps(e,{params:t,message:r},a){const{keyword:i,data:c,schemaValue:u,it:l}=e;const{opts:d,propertyName:f,topSchemaRef:p,schemaPath:h}=l;a.push([o.keyword,i],[o.params,typeof t=="function"?t(e):t||(0,s._)`{}`]);if(d.messages){a.push([o.message,typeof r=="function"?r(e):r])}if(d.verbose){a.push([o.schema,u],[o.parentSchema,(0,s._)`${p}${h}`],[n.default.data,c])}if(f)a.push([o.propertyName,f])}},8612:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;const s=r(7794);const a=r(4591);const n=r(8030);const o=r(8241);const i=r(5470);const c=r(2069);class SchemaEnv{constructor(e){var t;this.refs={};this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema;this.schemaId=e.schemaId;this.root=e.root||this;this.baseId=(t=e.baseId)!==null&&t!==void 0?t:(0,o.normalizeId)(r===null||r===void 0?void 0:r[e.schemaId||"$id"]);this.schemaPath=e.schemaPath;this.localRefs=e.localRefs;this.meta=e.meta;this.$async=r===null||r===void 0?void 0:r.$async;this.refs={}}}t.SchemaEnv=SchemaEnv;function compileSchema(e){const t=getCompilingSchema.call(this,e);if(t)return t;const r=(0,o.getFullPath)(this.opts.uriResolver,e.root.baseId);const{es5:i,lines:u}=this.opts.code;const{ownProperties:l}=this.opts;const d=new s.CodeGen(this.scope,{es5:i,lines:u,ownProperties:l});let f;if(e.$async){f=d.scopeValue("Error",{ref:a.default,code:(0,s._)`require("ajv/dist/runtime/validation_error").default`})}const p=d.scopeName("validate");e.validateName=p;const h={gen:d,allErrors:this.opts.allErrors,data:n.default.data,parentData:n.default.parentData,parentDataProperty:n.default.parentDataProperty,dataNames:[n.default.data],dataPathArr:[s.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:d.scopeValue("schema",this.opts.code.source===true?{ref:e.schema,code:(0,s.stringify)(e.schema)}:{ref:e.schema}),validateName:p,ValidationError:f,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:s.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,s._)`""`,opts:this.opts,self:this};let m;try{this._compilations.add(e);(0,c.validateFunctionCode)(h);d.optimize(this.opts.code.optimize);const t=d.toString();m=`${d.scopeRefs(n.default.scope)}return ${t}`;if(this.opts.code.process)m=this.opts.code.process(m,e);const r=new Function(`${n.default.self}`,`${n.default.scope}`,m);const a=r(this,this.scope.get());this.scope.value(p,{ref:a});a.errors=null;a.schema=e.schema;a.schemaEnv=e;if(e.$async)a.$async=true;if(this.opts.code.source===true){a.source={validateName:p,validateCode:t,scopeValues:d._values}}if(this.opts.unevaluated){const{props:e,items:t}=h;a.evaluated={props:e instanceof s.Name?undefined:e,items:t instanceof s.Name?undefined:t,dynamicProps:e instanceof s.Name,dynamicItems:t instanceof s.Name};if(a.source)a.source.evaluated=(0,s.stringify)(a.evaluated)}e.validate=a;return e}catch(t){delete e.validate;delete e.validateName;if(m)this.logger.error("Error compiling schema, function code:",m);throw t}finally{this._compilations.delete(e)}}t.compileSchema=compileSchema;function resolveRef(e,t,r){var s;r=(0,o.resolveUrl)(this.opts.uriResolver,t,r);const a=e.refs[r];if(a)return a;let n=resolve.call(this,e,r);if(n===undefined){const a=(s=e.localRefs)===null||s===void 0?void 0:s[r];const{schemaId:o}=this.opts;if(a)n=new SchemaEnv({schema:a,schemaId:o,root:e,baseId:t})}if(n===undefined)return;return e.refs[r]=inlineOrCompile.call(this,n)}t.resolveRef=resolveRef;function inlineOrCompile(e){if((0,o.inlineRef)(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:compileSchema.call(this,e)}function getCompilingSchema(e){for(const t of this._compilations){if(sameSchemaEnv(t,e))return t}}t.getCompilingSchema=getCompilingSchema;function sameSchemaEnv(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function resolve(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||resolveSchema.call(this,e,t)}function resolveSchema(e,t){const r=this.opts.uriResolver.parse(t);const s=(0,o._getFullPath)(this.opts.uriResolver,r);let a=(0,o.getFullPath)(this.opts.uriResolver,e.baseId,undefined);if(Object.keys(e.schema).length>0&&s===a){return getJsonPointer.call(this,r,e)}const n=(0,o.normalizeId)(s);const i=this.refs[n]||this.schemas[n];if(typeof i=="string"){const t=resolveSchema.call(this,e,i);if(typeof(t===null||t===void 0?void 0:t.schema)!=="object")return;return getJsonPointer.call(this,r,t)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)compileSchema.call(this,i);if(n===(0,o.normalizeId)(t)){const{schema:t}=i;const{schemaId:r}=this.opts;const s=t[r];if(s)a=(0,o.resolveUrl)(this.opts.uriResolver,a,s);return new SchemaEnv({schema:t,schemaId:r,root:e,baseId:a})}return getJsonPointer.call(this,r,i)}t.resolveSchema=resolveSchema;const u=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function getJsonPointer(e,{baseId:t,schema:r,root:s}){var a;if(((a=e.fragment)===null||a===void 0?void 0:a[0])!=="/")return;for(const s of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;const e=r[(0,i.unescapeFragment)(s)];if(e===undefined)return;r=e;const a=typeof r==="object"&&r[this.opts.schemaId];if(!u.has(s)&&a){t=(0,o.resolveUrl)(this.opts.uriResolver,t,a)}}let n;if(typeof r!="boolean"&&r.$ref&&!(0,i.schemaHasRulesButRef)(r,this.RULES)){const e=(0,o.resolveUrl)(this.opts.uriResolver,t,r.$ref);n=resolveSchema.call(this,s,e)}const{schemaId:c}=this.opts;n=n||new SchemaEnv({schema:r,schemaId:c,root:s,baseId:t});if(n.schema!==n.root.schema)return n;return undefined}},8030:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a={data:new s.Name("data"),valCxt:new s.Name("valCxt"),instancePath:new s.Name("instancePath"),parentData:new s.Name("parentData"),parentDataProperty:new s.Name("parentDataProperty"),rootData:new s.Name("rootData"),dynamicAnchors:new s.Name("dynamicAnchors"),vErrors:new s.Name("vErrors"),errors:new s.Name("errors"),this:new s.Name("this"),self:new s.Name("self"),scope:new s.Name("scope"),json:new s.Name("json"),jsonPos:new s.Name("jsonPos"),jsonLen:new s.Name("jsonLen"),jsonPart:new s.Name("jsonPart")};t["default"]=a},7983:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(8241);class MissingRefError extends Error{constructor(e,t,r,a){super(a||`can't resolve reference ${r} from id ${t}`);this.missingRef=(0,s.resolveUrl)(e,t,r);this.missingSchema=(0,s.normalizeId)((0,s.getFullPath)(e,this.missingRef))}}t["default"]=MissingRefError},8241:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;const s=r(5470);const a=r(7914);const n=r(2486);const o=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function inlineRef(e,t=true){if(typeof e=="boolean")return true;if(t===true)return!hasRef(e);if(!t)return false;return countKeys(e)<=t}t.inlineRef=inlineRef;const i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function hasRef(e){for(const t in e){if(i.has(t))return true;const r=e[t];if(Array.isArray(r)&&r.some(hasRef))return true;if(typeof r=="object"&&hasRef(r))return true}return false}function countKeys(e){let t=0;for(const r in e){if(r==="$ref")return Infinity;t++;if(o.has(r))continue;if(typeof e[r]=="object"){(0,s.eachItem)(e[r],(e=>t+=countKeys(e)))}if(t===Infinity)return Infinity}return t}function getFullPath(e,t="",r){if(r!==false)t=normalizeId(t);const s=e.parse(t);return _getFullPath(e,s)}t.getFullPath=getFullPath;function _getFullPath(e,t){const r=e.serialize(t);return r.split("#")[0]+"#"}t._getFullPath=_getFullPath;const c=/#\/?$/;function normalizeId(e){return e?e.replace(c,""):""}t.normalizeId=normalizeId;function resolveUrl(e,t,r){r=normalizeId(r);return e.resolve(t,r)}t.resolveUrl=resolveUrl;const u=/^[a-z_][-a-z0-9._]*$/i;function getSchemaRefs(e,t){if(typeof e=="boolean")return{};const{schemaId:r,uriResolver:s}=this.opts;const o=normalizeId(e[r]||t);const i={"":o};const c=getFullPath(s,o,false);const l={};const d=new Set;n(e,{allKeys:true},((e,t,s,a)=>{if(a===undefined)return;const n=c+t;let o=i[a];if(typeof e[r]=="string")o=addRef.call(this,e[r]);addAnchor.call(this,e.$anchor);addAnchor.call(this,e.$dynamicAnchor);i[t]=o;function addRef(t){const r=this.opts.uriResolver.resolve;t=normalizeId(o?r(o,t):t);if(d.has(t))throw ambiguos(t);d.add(t);let s=this.refs[t];if(typeof s=="string")s=this.refs[s];if(typeof s=="object"){checkAmbiguosRef(e,s.schema,t)}else if(t!==normalizeId(n)){if(t[0]==="#"){checkAmbiguosRef(e,l[t],t);l[t]=e}else{this.refs[t]=n}}return t}function addAnchor(e){if(typeof e=="string"){if(!u.test(e))throw new Error(`invalid anchor "${e}"`);addRef.call(this,`#${e}`)}}}));return l;function checkAmbiguosRef(e,t,r){if(t!==undefined&&!a(e,t))throw ambiguos(r)}function ambiguos(e){return new Error(`reference "${e}" resolves to more than one schema`)}}t.getSchemaRefs=getSchemaRefs},3145:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getRules=t.isJSONType=void 0;const r=["string","number","integer","boolean","null","object","array"];const s=new Set(r);function isJSONType(e){return typeof e=="string"&&s.has(e)}t.isJSONType=isJSONType;function getRules(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:true,boolean:true,null:true},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}t.getRules=getRules},5470:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;const s=r(7794);const a=r(7621);function toHash(e){const t={};for(const r of e)t[r]=true;return t}t.toHash=toHash;function alwaysValidSchema(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return true;checkUnknownRules(e,t);return!schemaHasRules(t,e.self.RULES.all)}t.alwaysValidSchema=alwaysValidSchema;function checkUnknownRules(e,t=e.schema){const{opts:r,self:s}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;const a=s.RULES.keywords;for(const r in t){if(!a[r])checkStrictMode(e,`unknown keyword: "${r}"`)}}t.checkUnknownRules=checkUnknownRules;function schemaHasRules(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(t[r])return true;return false}t.schemaHasRules=schemaHasRules;function schemaHasRulesButRef(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(r!=="$ref"&&t.all[r])return true;return false}t.schemaHasRulesButRef=schemaHasRulesButRef;function schemaRefOrVal({topSchemaRef:e,schemaPath:t},r,a,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,s._)`${r}`}return(0,s._)`${e}${t}${(0,s.getProperty)(a)}`}t.schemaRefOrVal=schemaRefOrVal;function unescapeFragment(e){return unescapeJsonPointer(decodeURIComponent(e))}t.unescapeFragment=unescapeFragment;function escapeFragment(e){return encodeURIComponent(escapeJsonPointer(e))}t.escapeFragment=escapeFragment;function escapeJsonPointer(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}t.escapeJsonPointer=escapeJsonPointer;function unescapeJsonPointer(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}t.unescapeJsonPointer=unescapeJsonPointer;function eachItem(e,t){if(Array.isArray(e)){for(const r of e)t(r)}else{t(e)}}t.eachItem=eachItem;function makeMergeEvaluated({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:a}){return(n,o,i,c)=>{const u=i===undefined?o:i instanceof s.Name?(o instanceof s.Name?e(n,o,i):t(n,o,i),i):o instanceof s.Name?(t(n,i,o),o):r(o,i);return c===s.Name&&!(u instanceof s.Name)?a(n,u):u}}t.mergeEvaluated={props:makeMergeEvaluated({mergeNames:(e,t,r)=>e.if((0,s._)`${r} !== true && ${t} !== undefined`,(()=>{e.if((0,s._)`${t} === true`,(()=>e.assign(r,true)),(()=>e.assign(r,(0,s._)`${r} || {}`).code((0,s._)`Object.assign(${r}, ${t})`)))})),mergeToName:(e,t,r)=>e.if((0,s._)`${r} !== true`,(()=>{if(t===true){e.assign(r,true)}else{e.assign(r,(0,s._)`${r} || {}`);setEvaluated(e,r,t)}})),mergeValues:(e,t)=>e===true?true:{...e,...t},resultToName:evaluatedPropsToName}),items:makeMergeEvaluated({mergeNames:(e,t,r)=>e.if((0,s._)`${r} !== true && ${t} !== undefined`,(()=>e.assign(r,(0,s._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`))),mergeToName:(e,t,r)=>e.if((0,s._)`${r} !== true`,(()=>e.assign(r,t===true?true:(0,s._)`${r} > ${t} ? ${r} : ${t}`))),mergeValues:(e,t)=>e===true?true:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function evaluatedPropsToName(e,t){if(t===true)return e.var("props",true);const r=e.var("props",(0,s._)`{}`);if(t!==undefined)setEvaluated(e,r,t);return r}t.evaluatedPropsToName=evaluatedPropsToName;function setEvaluated(e,t,r){Object.keys(r).forEach((r=>e.assign((0,s._)`${t}${(0,s.getProperty)(r)}`,true)))}t.setEvaluated=setEvaluated;const n={};function useFunc(e,t){return e.scopeValue("func",{ref:t,code:n[t.code]||(n[t.code]=new a._Code(t.code))})}t.useFunc=useFunc;var o;(function(e){e[e["Num"]=0]="Num";e[e["Str"]=1]="Str"})(o=t.Type||(t.Type={}));function getErrorPath(e,t,r){if(e instanceof s.Name){const a=t===o.Num;return r?a?(0,s._)`"[" + ${e} + "]"`:(0,s._)`"['" + ${e} + "']"`:a?(0,s._)`"/" + ${e}`:(0,s._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,s.getProperty)(e).toString():"/"+escapeJsonPointer(e)}t.getErrorPath=getErrorPath;function checkStrictMode(e,t,r=e.opts.strictSchema){if(!r)return;t=`strict mode: ${t}`;if(r===true)throw new Error(t);e.self.logger.warn(t)}t.checkStrictMode=checkStrictMode},6693:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0;function schemaHasRulesForType({schema:e,self:t},r){const s=t.RULES.types[r];return s&&s!==true&&shouldUseGroup(e,s)}t.schemaHasRulesForType=schemaHasRulesForType;function shouldUseGroup(e,t){return t.rules.some((t=>shouldUseRule(e,t)))}t.shouldUseGroup=shouldUseGroup;function shouldUseRule(e,t){var r;return e[t.keyword]!==undefined||((r=t.definition.implements)===null||r===void 0?void 0:r.some((t=>e[t]!==undefined)))}t.shouldUseRule=shouldUseRule},7353:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;const s=r(4337);const a=r(7794);const n=r(8030);const o={message:"boolean schema is false"};function topBoolOrEmptySchema(e){const{gen:t,schema:r,validateName:s}=e;if(r===false){falseSchemaError(e,false)}else if(typeof r=="object"&&r.$async===true){t.return(n.default.data)}else{t.assign((0,a._)`${s}.errors`,null);t.return(true)}}t.topBoolOrEmptySchema=topBoolOrEmptySchema;function boolOrEmptySchema(e,t){const{gen:r,schema:s}=e;if(s===false){r.var(t,false);falseSchemaError(e)}else{r.var(t,true)}}t.boolOrEmptySchema=boolOrEmptySchema;function falseSchemaError(e,t){const{gen:r,data:a}=e;const n={gen:r,keyword:"false schema",data:a,schema:false,schemaCode:false,schemaValue:false,params:{},it:e};(0,s.reportError)(n,o,undefined,t)}},7795:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;const s=r(3145);const a=r(6693);const n=r(4337);const o=r(7794);const i=r(5470);var c;(function(e){e[e["Correct"]=0]="Correct";e[e["Wrong"]=1]="Wrong"})(c=t.DataType||(t.DataType={}));function getSchemaTypes(e){const t=getJSONTypes(e.type);const r=t.includes("null");if(r){if(e.nullable===false)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==undefined){throw new Error('"nullable" cannot be used without "type"')}if(e.nullable===true)t.push("null")}return t}t.getSchemaTypes=getSchemaTypes;function getJSONTypes(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(s.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}t.getJSONTypes=getJSONTypes;function coerceAndCheckDataType(e,t){const{gen:r,data:s,opts:n}=e;const o=coerceToTypes(t,n.coerceTypes);const i=t.length>0&&!(o.length===0&&t.length===1&&(0,a.schemaHasRulesForType)(e,t[0]));if(i){const a=checkDataTypes(t,s,n.strictNumbers,c.Wrong);r.if(a,(()=>{if(o.length)coerceData(e,t,o);else reportTypeError(e)}))}return i}t.coerceAndCheckDataType=coerceAndCheckDataType;const u=new Set(["string","number","integer","boolean","null"]);function coerceToTypes(e,t){return t?e.filter((e=>u.has(e)||t==="array"&&e==="array")):[]}function coerceData(e,t,r){const{gen:s,data:a,opts:n}=e;const i=s.let("dataType",(0,o._)`typeof ${a}`);const c=s.let("coerced",(0,o._)`undefined`);if(n.coerceTypes==="array"){s.if((0,o._)`${i} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,(()=>s.assign(a,(0,o._)`${a}[0]`).assign(i,(0,o._)`typeof ${a}`).if(checkDataTypes(t,a,n.strictNumbers),(()=>s.assign(c,a)))))}s.if((0,o._)`${c} !== undefined`);for(const e of r){if(u.has(e)||e==="array"&&n.coerceTypes==="array"){coerceSpecificType(e)}}s.else();reportTypeError(e);s.endIf();s.if((0,o._)`${c} !== undefined`,(()=>{s.assign(a,c);assignParentData(e,c)}));function coerceSpecificType(e){switch(e){case"string":s.elseIf((0,o._)`${i} == "number" || ${i} == "boolean"`).assign(c,(0,o._)`"" + ${a}`).elseIf((0,o._)`${a} === null`).assign(c,(0,o._)`""`);return;case"number":s.elseIf((0,o._)`${i} == "boolean" || ${a} === null - || (${i} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,o._)`+${a}`);return;case"integer":s.elseIf((0,o._)`${i} === "boolean" || ${a} === null - || (${i} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(c,(0,o._)`+${a}`);return;case"boolean":s.elseIf((0,o._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(c,false).elseIf((0,o._)`${a} === "true" || ${a} === 1`).assign(c,true);return;case"null":s.elseIf((0,o._)`${a} === "" || ${a} === 0 || ${a} === false`);s.assign(c,null);return;case"array":s.elseIf((0,o._)`${i} === "string" || ${i} === "number" - || ${i} === "boolean" || ${a} === null`).assign(c,(0,o._)`[${a}]`)}}}function assignParentData({gen:e,parentData:t,parentDataProperty:r},s){e.if((0,o._)`${t} !== undefined`,(()=>e.assign((0,o._)`${t}[${r}]`,s)))}function checkDataType(e,t,r,s=c.Correct){const a=s===c.Correct?o.operators.EQ:o.operators.NEQ;let n;switch(e){case"null":return(0,o._)`${t} ${a} null`;case"array":n=(0,o._)`Array.isArray(${t})`;break;case"object":n=(0,o._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":n=numCond((0,o._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":n=numCond();break;default:return(0,o._)`typeof ${t} ${a} ${e}`}return s===c.Correct?n:(0,o.not)(n);function numCond(e=o.nil){return(0,o.and)((0,o._)`typeof ${t} == "number"`,e,r?(0,o._)`isFinite(${t})`:o.nil)}}t.checkDataType=checkDataType;function checkDataTypes(e,t,r,s){if(e.length===1){return checkDataType(e[0],t,r,s)}let a;const n=(0,i.toHash)(e);if(n.array&&n.object){const e=(0,o._)`typeof ${t} != "object"`;a=n.null?e:(0,o._)`!${t} || ${e}`;delete n.null;delete n.array;delete n.object}else{a=o.nil}if(n.number)delete n.integer;for(const e in n)a=(0,o.and)(a,checkDataType(e,t,r,s));return a}t.checkDataTypes=checkDataTypes;const l={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,o._)`{type: ${e}}`:(0,o._)`{type: ${t}}`};function reportTypeError(e){const t=getTypeErrorContext(e);(0,n.reportError)(t,l)}t.reportTypeError=reportTypeError;function getTypeErrorContext(e){const{gen:t,data:r,schema:s}=e;const a=(0,i.schemaRefOrVal)(e,s,"type");return{gen:t,keyword:"type",data:r,schema:s.type,schemaCode:a,schemaValue:a,parentSchema:s,params:{},it:e}}},2798:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.assignDefaults=void 0;const s=r(7794);const a=r(5470);function assignDefaults(e,t){const{properties:r,items:s}=e.schema;if(t==="object"&&r){for(const t in r){assignDefault(e,t,r[t].default)}}else if(t==="array"&&Array.isArray(s)){s.forEach(((t,r)=>assignDefault(e,r,t.default)))}}t.assignDefaults=assignDefaults;function assignDefault(e,t,r){const{gen:n,compositeRule:o,data:i,opts:c}=e;if(r===undefined)return;const u=(0,s._)`${i}${(0,s.getProperty)(t)}`;if(o){(0,a.checkStrictMode)(e,`default is ignored for: ${u}`);return}let l=(0,s._)`${u} === undefined`;if(c.useDefaults==="empty"){l=(0,s._)`${l} || ${u} === null || ${u} === ""`}n.if(l,(0,s._)`${u} = ${(0,s.stringify)(r)}`)}},2069:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;const s=r(7353);const a=r(7795);const n=r(6693);const o=r(7795);const i=r(2798);const c=r(5522);const u=r(1298);const l=r(7794);const d=r(8030);const f=r(8241);const p=r(5470);const h=r(4337);function validateFunctionCode(e){if(isSchemaObj(e)){checkKeywords(e);if(schemaCxtHasRules(e)){topSchemaObjCode(e);return}}validateFunction(e,(()=>(0,s.topBoolOrEmptySchema)(e)))}t.validateFunctionCode=validateFunctionCode;function validateFunction({gen:e,validateName:t,schema:r,schemaEnv:s,opts:a},n){if(a.code.es5){e.func(t,(0,l._)`${d.default.data}, ${d.default.valCxt}`,s.$async,(()=>{e.code((0,l._)`"use strict"; ${funcSourceUrl(r,a)}`);destructureValCxtES5(e,a);e.code(n)}))}else{e.func(t,(0,l._)`${d.default.data}, ${destructureValCxt(a)}`,s.$async,(()=>e.code(funcSourceUrl(r,a)).code(n)))}}function destructureValCxt(e){return(0,l._)`{${d.default.instancePath}="", ${d.default.parentData}, ${d.default.parentDataProperty}, ${d.default.rootData}=${d.default.data}${e.dynamicRef?(0,l._)`, ${d.default.dynamicAnchors}={}`:l.nil}}={}`}function destructureValCxtES5(e,t){e.if(d.default.valCxt,(()=>{e.var(d.default.instancePath,(0,l._)`${d.default.valCxt}.${d.default.instancePath}`);e.var(d.default.parentData,(0,l._)`${d.default.valCxt}.${d.default.parentData}`);e.var(d.default.parentDataProperty,(0,l._)`${d.default.valCxt}.${d.default.parentDataProperty}`);e.var(d.default.rootData,(0,l._)`${d.default.valCxt}.${d.default.rootData}`);if(t.dynamicRef)e.var(d.default.dynamicAnchors,(0,l._)`${d.default.valCxt}.${d.default.dynamicAnchors}`)}),(()=>{e.var(d.default.instancePath,(0,l._)`""`);e.var(d.default.parentData,(0,l._)`undefined`);e.var(d.default.parentDataProperty,(0,l._)`undefined`);e.var(d.default.rootData,d.default.data);if(t.dynamicRef)e.var(d.default.dynamicAnchors,(0,l._)`{}`)}))}function topSchemaObjCode(e){const{schema:t,opts:r,gen:s}=e;validateFunction(e,(()=>{if(r.$comment&&t.$comment)commentKeyword(e);checkNoDefault(e);s.let(d.default.vErrors,null);s.let(d.default.errors,0);if(r.unevaluated)resetEvaluated(e);typeAndKeywords(e);returnResults(e)}));return}function resetEvaluated(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,l._)`${r}.evaluated`);t.if((0,l._)`${e.evaluated}.dynamicProps`,(()=>t.assign((0,l._)`${e.evaluated}.props`,(0,l._)`undefined`)));t.if((0,l._)`${e.evaluated}.dynamicItems`,(()=>t.assign((0,l._)`${e.evaluated}.items`,(0,l._)`undefined`)))}function funcSourceUrl(e,t){const r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,l._)`/*# sourceURL=${r} */`:l.nil}function subschemaCode(e,t){if(isSchemaObj(e)){checkKeywords(e);if(schemaCxtHasRules(e)){subSchemaObjCode(e,t);return}}(0,s.boolOrEmptySchema)(e,t)}function schemaCxtHasRules({schema:e,self:t}){if(typeof e=="boolean")return!e;for(const r in e)if(t.RULES.all[r])return true;return false}function isSchemaObj(e){return typeof e.schema!="boolean"}function subSchemaObjCode(e,t){const{schema:r,gen:s,opts:a}=e;if(a.$comment&&r.$comment)commentKeyword(e);updateContext(e);checkAsyncSchema(e);const n=s.const("_errs",d.default.errors);typeAndKeywords(e,n);s.var(t,(0,l._)`${n} === ${d.default.errors}`)}function checkKeywords(e){(0,p.checkUnknownRules)(e);checkRefsAndKeywords(e)}function typeAndKeywords(e,t){if(e.opts.jtd)return schemaKeywords(e,[],false,t);const r=(0,a.getSchemaTypes)(e.schema);const s=(0,a.coerceAndCheckDataType)(e,r);schemaKeywords(e,r,!s,t)}function checkRefsAndKeywords(e){const{schema:t,errSchemaPath:r,opts:s,self:a}=e;if(t.$ref&&s.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(t,a.RULES)){a.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}}function checkNoDefault(e){const{schema:t,opts:r}=e;if(t.default!==undefined&&r.useDefaults&&r.strictSchema){(0,p.checkStrictMode)(e,"default is ignored in the schema root")}}function updateContext(e){const t=e.schema[e.opts.schemaId];if(t)e.baseId=(0,f.resolveUrl)(e.opts.uriResolver,e.baseId,t)}function checkAsyncSchema(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function commentKeyword({gen:e,schemaEnv:t,schema:r,errSchemaPath:s,opts:a}){const n=r.$comment;if(a.$comment===true){e.code((0,l._)`${d.default.self}.logger.log(${n})`)}else if(typeof a.$comment=="function"){const r=(0,l.str)`${s}/$comment`;const a=e.scopeValue("root",{ref:t.root});e.code((0,l._)`${d.default.self}.opts.$comment(${n}, ${r}, ${a}.schema)`)}}function returnResults(e){const{gen:t,schemaEnv:r,validateName:s,ValidationError:a,opts:n}=e;if(r.$async){t.if((0,l._)`${d.default.errors} === 0`,(()=>t.return(d.default.data)),(()=>t.throw((0,l._)`new ${a}(${d.default.vErrors})`)))}else{t.assign((0,l._)`${s}.errors`,d.default.vErrors);if(n.unevaluated)assignEvaluated(e);t.return((0,l._)`${d.default.errors} === 0`)}}function assignEvaluated({gen:e,evaluated:t,props:r,items:s}){if(r instanceof l.Name)e.assign((0,l._)`${t}.props`,r);if(s instanceof l.Name)e.assign((0,l._)`${t}.items`,s)}function schemaKeywords(e,t,r,s){const{gen:a,schema:i,data:c,allErrors:u,opts:f,self:h}=e;const{RULES:m}=h;if(i.$ref&&(f.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(i,m))){a.block((()=>keywordCode(e,"$ref",m.all.$ref.definition)));return}if(!f.jtd)checkStrictTypes(e,t);a.block((()=>{for(const e of m.rules)groupKeywords(e);groupKeywords(m.post)}));function groupKeywords(p){if(!(0,n.shouldUseGroup)(i,p))return;if(p.type){a.if((0,o.checkDataType)(p.type,c,f.strictNumbers));iterateKeywords(e,p);if(t.length===1&&t[0]===p.type&&r){a.else();(0,o.reportTypeError)(e)}a.endIf()}else{iterateKeywords(e,p)}if(!u)a.if((0,l._)`${d.default.errors} === ${s||0}`)}}function iterateKeywords(e,t){const{gen:r,schema:s,opts:{useDefaults:a}}=e;if(a)(0,i.assignDefaults)(e,t.type);r.block((()=>{for(const r of t.rules){if((0,n.shouldUseRule)(s,r)){keywordCode(e,r.keyword,r.definition,t.type)}}}))}function checkStrictTypes(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;checkContextTypes(e,t);if(!e.opts.allowUnionTypes)checkMultipleTypes(e,t);checkKeywordTypes(e,e.dataTypes)}function checkContextTypes(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((t=>{if(!includesType(e.dataTypes,t)){strictTypesError(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}}));e.dataTypes=e.dataTypes.filter((e=>includesType(t,e)))}function checkMultipleTypes(e,t){if(t.length>1&&!(t.length===2&&t.includes("null"))){strictTypesError(e,"use allowUnionTypes to allow union type keyword")}}function checkKeywordTypes(e,t){const r=e.self.RULES.all;for(const s in r){const a=r[s];if(typeof a=="object"&&(0,n.shouldUseRule)(e.schema,a)){const{type:r}=a.definition;if(r.length&&!r.some((e=>hasApplicableType(t,e)))){strictTypesError(e,`missing type "${r.join(",")}" for keyword "${s}"`)}}}}function hasApplicableType(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function includesType(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function strictTypesError(e,t){const r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`;(0,p.checkStrictMode)(e,t,e.opts.strictTypes)}class KeywordCxt{constructor(e,t,r){(0,c.validateKeywordUsage)(e,t,r);this.gen=e.gen;this.allErrors=e.allErrors;this.keyword=r;this.data=e.data;this.schema=e.schema[r];this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data;this.schemaValue=(0,p.schemaRefOrVal)(e,this.schema,r,this.$data);this.schemaType=t.schemaType;this.parentSchema=e.schema;this.params={};this.it=e;this.def=t;if(this.$data){this.schemaCode=e.gen.const("vSchema",getData(this.$data,e))}else{this.schemaCode=this.schemaValue;if(!(0,c.validSchemaType)(this.schema,t.schemaType,t.allowUndefined)){throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`)}}if("code"in t?t.trackErrors:t.errors!==false){this.errsCount=e.gen.const("_errs",d.default.errors)}}result(e,t,r){this.failResult((0,l.not)(e),t,r)}failResult(e,t,r){this.gen.if(e);if(r)r();else this.error();if(t){this.gen.else();t();if(this.allErrors)this.gen.endIf()}else{if(this.allErrors)this.gen.endIf();else this.gen.else()}}pass(e,t){this.failResult((0,l.not)(e),undefined,t)}fail(e){if(e===undefined){this.error();if(!this.allErrors)this.gen.if(false);return}this.gen.if(e);this.error();if(this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail((0,l._)`${t} !== undefined && (${(0,l.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t);this._error(e,r);this.setParams({});return}this._error(e,r)}_error(e,t){(e?h.reportExtraError:h.reportError)(this,this.def.error,t)}$dataError(){(0,h.reportError)(this,this.def.$dataError||h.keyword$DataError)}reset(){if(this.errsCount===undefined)throw new Error('add "trackErrors" to keyword definition');(0,h.resetErrorsCount)(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=l.nil){this.gen.block((()=>{this.check$data(e,r);t()}))}check$data(e=l.nil,t=l.nil){if(!this.$data)return;const{gen:r,schemaCode:s,schemaType:a,def:n}=this;r.if((0,l.or)((0,l._)`${s} === undefined`,t));if(e!==l.nil)r.assign(e,true);if(a.length||n.validateSchema){r.elseIf(this.invalid$data());this.$dataError();if(e!==l.nil)r.assign(e,false)}r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:s,it:a}=this;return(0,l.or)(wrong$DataType(),invalid$DataSchema());function wrong$DataType(){if(r.length){if(!(t instanceof l.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return(0,l._)`${(0,o.checkDataTypes)(e,t,a.opts.strictNumbers,o.DataType.Wrong)}`}return l.nil}function invalid$DataSchema(){if(s.validateSchema){const r=e.scopeValue("validate$data",{ref:s.validateSchema});return(0,l._)`!${r}(${t})`}return l.nil}}subschema(e,t){const r=(0,u.getSubschema)(this.it,e);(0,u.extendSubschemaData)(r,this.it,e);(0,u.extendSubschemaMode)(r,e);const s={...this.it,...r,items:undefined,props:undefined};subschemaCode(s,t);return s}mergeEvaluated(e,t){const{it:r,gen:s}=this;if(!r.opts.unevaluated)return;if(r.props!==true&&e.props!==undefined){r.props=p.mergeEvaluated.props(s,e.props,r.props,t)}if(r.items!==true&&e.items!==undefined){r.items=p.mergeEvaluated.items(s,e.items,r.items,t)}}mergeValidEvaluated(e,t){const{it:r,gen:s}=this;if(r.opts.unevaluated&&(r.props!==true||r.items!==true)){s.if(t,(()=>this.mergeEvaluated(e,l.Name)));return true}}}t.KeywordCxt=KeywordCxt;function keywordCode(e,t,r,s){const a=new KeywordCxt(e,r,t);if("code"in r){r.code(a,s)}else if(a.$data&&r.validate){(0,c.funcKeywordCode)(a,r)}else if("macro"in r){(0,c.macroKeywordCode)(a,r)}else if(r.compile||r.validate){(0,c.funcKeywordCode)(a,r)}}const m=/^\/(?:[^~]|~0|~1)*$/;const y=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function getData(e,{dataLevel:t,dataNames:r,dataPathArr:s}){let a;let n;if(e==="")return d.default.rootData;if(e[0]==="/"){if(!m.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);a=e;n=d.default.rootData}else{const o=y.exec(e);if(!o)throw new Error(`Invalid JSON-pointer: ${e}`);const i=+o[1];a=o[2];if(a==="#"){if(i>=t)throw new Error(errorMsg("property/index",i));return s[t-i]}if(i>t)throw new Error(errorMsg("data",i));n=r[t-i];if(!a)return n}let o=n;const i=a.split("/");for(const e of i){if(e){n=(0,l._)`${n}${(0,l.getProperty)((0,p.unescapeJsonPointer)(e))}`;o=(0,l._)`${o} && ${n}`}}return o;function errorMsg(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}t.getData=getData},5522:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;const s=r(7794);const a=r(8030);const n=r(1139);const o=r(4337);function macroKeywordCode(e,t){const{gen:r,keyword:a,schema:n,parentSchema:o,it:i}=e;const c=t.macro.call(i.self,n,o,i);const u=useKeyword(r,a,c);if(i.opts.validateSchema!==false)i.self.validateSchema(c,true);const l=r.name("valid");e.subschema({schema:c,schemaPath:s.nil,errSchemaPath:`${i.errSchemaPath}/${a}`,topSchemaRef:u,compositeRule:true},l);e.pass(l,(()=>e.error(true)))}t.macroKeywordCode=macroKeywordCode;function funcKeywordCode(e,t){var r;const{gen:o,keyword:i,schema:c,parentSchema:u,$data:l,it:d}=e;checkAsyncKeyword(d,t);const f=!l&&t.compile?t.compile.call(d.self,c,u,d):t.validate;const p=useKeyword(o,i,f);const h=o.let("valid");e.block$data(h,validateKeyword);e.ok((r=t.valid)!==null&&r!==void 0?r:h);function validateKeyword(){if(t.errors===false){assignValid();if(t.modifying)modifyData(e);reportErrs((()=>e.error()))}else{const r=t.async?validateAsync():validateSync();if(t.modifying)modifyData(e);reportErrs((()=>addErrs(e,r)))}}function validateAsync(){const e=o.let("ruleErrs",null);o.try((()=>assignValid((0,s._)`await `)),(t=>o.assign(h,false).if((0,s._)`${t} instanceof ${d.ValidationError}`,(()=>o.assign(e,(0,s._)`${t}.errors`)),(()=>o.throw(t)))));return e}function validateSync(){const e=(0,s._)`${p}.errors`;o.assign(e,null);assignValid(s.nil);return e}function assignValid(r=(t.async?(0,s._)`await `:s.nil)){const i=d.opts.passContext?a.default.this:a.default.self;const c=!("compile"in t&&!l||t.schema===false);o.assign(h,(0,s._)`${r}${(0,n.callValidateCode)(e,p,i,c)}`,t.modifying)}function reportErrs(e){var r;o.if((0,s.not)((r=t.valid)!==null&&r!==void 0?r:h),e)}}t.funcKeywordCode=funcKeywordCode;function modifyData(e){const{gen:t,data:r,it:a}=e;t.if(a.parentData,(()=>t.assign(r,(0,s._)`${a.parentData}[${a.parentDataProperty}]`)))}function addErrs(e,t){const{gen:r}=e;r.if((0,s._)`Array.isArray(${t})`,(()=>{r.assign(a.default.vErrors,(0,s._)`${a.default.vErrors} === null ? ${t} : ${a.default.vErrors}.concat(${t})`).assign(a.default.errors,(0,s._)`${a.default.vErrors}.length`);(0,o.extendErrors)(e)}),(()=>e.error()))}function checkAsyncKeyword({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function useKeyword(e,t,r){if(r===undefined)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,s.stringify)(r)})}function validSchemaType(e,t,r=false){return!t.length||t.some((t=>t==="array"?Array.isArray(e):t==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==t||r&&typeof e=="undefined"))}t.validSchemaType=validSchemaType;function validateKeywordUsage({schema:e,opts:t,self:r,errSchemaPath:s},a,n){if(Array.isArray(a.keyword)?!a.keyword.includes(n):a.keyword!==n){throw new Error("ajv implementation error")}const o=a.dependencies;if(o===null||o===void 0?void 0:o.some((t=>!Object.prototype.hasOwnProperty.call(e,t)))){throw new Error(`parent schema must have dependencies of ${n}: ${o.join(",")}`)}if(a.validateSchema){const o=a.validateSchema(e[n]);if(!o){const e=`keyword "${n}" value is invalid at path "${s}": `+r.errorsText(a.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(e);else throw new Error(e)}}}t.validateKeywordUsage=validateKeywordUsage},1298:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;const s=r(7794);const a=r(5470);function getSubschema(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:c}){if(t!==undefined&&n!==undefined){throw new Error('both "keyword" and "schema" passed, only one allowed')}if(t!==undefined){const n=e.schema[t];return r===undefined?{schema:n,schemaPath:(0,s._)`${e.schemaPath}${(0,s.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:n[r],schemaPath:(0,s._)`${e.schemaPath}${(0,s.getProperty)(t)}${(0,s.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,a.escapeFragment)(r)}`}}if(n!==undefined){if(o===undefined||i===undefined||c===undefined){throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"')}return{schema:n,schemaPath:o,topSchemaRef:c,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}t.getSubschema=getSubschema;function extendSubschemaData(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:c}){if(o!==undefined&&r!==undefined){throw new Error('both "data" and "dataProp" passed, only one allowed')}const{gen:u}=t;if(r!==undefined){const{errorPath:o,dataPathArr:i,opts:c}=t;const l=u.let("data",(0,s._)`${t.data}${(0,s.getProperty)(r)}`,true);dataContextProps(l);e.errorPath=(0,s.str)`${o}${(0,a.getErrorPath)(r,n,c.jsPropertySyntax)}`;e.parentDataProperty=(0,s._)`${r}`;e.dataPathArr=[...i,e.parentDataProperty]}if(o!==undefined){const t=o instanceof s.Name?o:u.let("data",o,true);dataContextProps(t);if(c!==undefined)e.propertyName=c}if(i)e.dataTypes=i;function dataContextProps(r){e.data=r;e.dataLevel=t.dataLevel+1;e.dataTypes=[];t.definedProperties=new Set;e.parentData=t.data;e.dataNames=[...t.dataNames,r]}}t.extendSubschemaData=extendSubschemaData;function extendSubschemaMode(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:s,createErrors:a,allErrors:n}){if(s!==undefined)e.compositeRule=s;if(a!==undefined)e.createErrors=a;if(n!==undefined)e.allErrors=n;e.jtdDiscriminator=t;e.jtdMetadata=r}t.extendSubschemaMode=extendSubschemaMode},2046:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var s=r(2069);Object.defineProperty(t,"KeywordCxt",{enumerable:true,get:function(){return s.KeywordCxt}});var a=r(7794);Object.defineProperty(t,"_",{enumerable:true,get:function(){return a._}});Object.defineProperty(t,"str",{enumerable:true,get:function(){return a.str}});Object.defineProperty(t,"stringify",{enumerable:true,get:function(){return a.stringify}});Object.defineProperty(t,"nil",{enumerable:true,get:function(){return a.nil}});Object.defineProperty(t,"Name",{enumerable:true,get:function(){return a.Name}});Object.defineProperty(t,"CodeGen",{enumerable:true,get:function(){return a.CodeGen}});const n=r(4591);const o=r(7983);const i=r(3145);const c=r(8612);const u=r(7794);const l=r(8241);const d=r(7795);const f=r(5470);const p=r(7918);const h=r(6250);const defaultRegExp=(e,t)=>new RegExp(e,t);defaultRegExp.code="new RegExp";const m=["removeAdditional","useDefaults","coerceTypes"];const y=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]);const g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."};const v={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};const $=200;function requiredOptions(e){var t,r,s,a,n,o,i,c,u,l,d,f,p,m,y,g,v,b,w,E,S,P,C,x,k;const N=e.strict;const O=(t=e.code)===null||t===void 0?void 0:t.optimize;const R=O===true||O===undefined?1:O||0;const T=(s=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&s!==void 0?s:defaultRegExp;const j=(a=e.uriResolver)!==null&&a!==void 0?a:h.default;return{strictSchema:(o=(n=e.strictSchema)!==null&&n!==void 0?n:N)!==null&&o!==void 0?o:true,strictNumbers:(c=(i=e.strictNumbers)!==null&&i!==void 0?i:N)!==null&&c!==void 0?c:true,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:N)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=e.strictTuples)!==null&&d!==void 0?d:N)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=e.strictRequired)!==null&&p!==void 0?p:N)!==null&&m!==void 0?m:false,code:e.code?{...e.code,optimize:R,regExp:T}:{optimize:R,regExp:T},loopRequired:(y=e.loopRequired)!==null&&y!==void 0?y:$,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:$,meta:(v=e.meta)!==null&&v!==void 0?v:true,messages:(b=e.messages)!==null&&b!==void 0?b:true,inlineRefs:(w=e.inlineRefs)!==null&&w!==void 0?w:true,schemaId:(E=e.schemaId)!==null&&E!==void 0?E:"$id",addUsedSchema:(S=e.addUsedSchema)!==null&&S!==void 0?S:true,validateSchema:(P=e.validateSchema)!==null&&P!==void 0?P:true,validateFormats:(C=e.validateFormats)!==null&&C!==void 0?C:true,unicodeRegExp:(x=e.unicodeRegExp)!==null&&x!==void 0?x:true,int32range:(k=e.int32range)!==null&&k!==void 0?k:true,uriResolver:j}}class Ajv{constructor(e={}){this.schemas={};this.refs={};this.formats={};this._compilations=new Set;this._loading={};this._cache=new Map;e=this.opts={...e,...requiredOptions(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new u.ValueScope({scope:{},prefixes:y,es5:t,lines:r});this.logger=getLogger(e.logger);const s=e.validateFormats;e.validateFormats=false;this.RULES=(0,i.getRules)();checkOptions.call(this,g,e,"NOT SUPPORTED");checkOptions.call(this,v,e,"DEPRECATED","warn");this._metaOpts=getMetaSchemaOptions.call(this);if(e.formats)addInitialFormats.call(this);this._addVocabularies();this._addDefaultMetaSchema();if(e.keywords)addInitialKeywords.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);addInitialSchemas.call(this);e.validateFormats=s}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let s=p;if(r==="id"){s={...p};s.id=s.$id;delete s.$id}if(t&&e)this.addMetaSchema(s,s[r],false)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:undefined}validate(e,t){let r;if(typeof e=="string"){r=this.getSchema(e);if(!r)throw new Error(`no schema with key or ref "${e}"`)}else{r=this.compile(e)}const s=r(t);if(!("$async"in r))this.errors=r.errors;return s}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function"){throw new Error("options.loadSchema should be a function")}const{loadSchema:r}=this.opts;return runCompileAsync.call(this,e,t);async function runCompileAsync(e,t){await loadMetaSchema.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||_compileAsync.call(this,r)}async function loadMetaSchema(e){if(e&&!this.getSchema(e)){await runCompileAsync.call(this,{$ref:e},true)}}async function _compileAsync(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof o.default))throw t;checkLoaded.call(this,t);await loadMissingSchema.call(this,t.missingSchema);return _compileAsync.call(this,e)}}function checkLoaded({missingSchema:e,missingRef:t}){if(this.refs[e]){throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}}async function loadMissingSchema(e){const r=await _loadSchema.call(this,e);if(!this.refs[e])await loadMetaSchema.call(this,r.$schema);if(!this.refs[e])this.addSchema(r,e,t)}async function _loadSchema(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,s=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,undefined,r,s);return this}let a;if(typeof e==="object"){const{schemaId:t}=this.opts;a=e[t];if(a!==undefined&&typeof a!="string"){throw new Error(`schema ${t} must be string`)}}t=(0,l.normalizeId)(t||a);this._checkUnique(t);this.schemas[t]=this._addSchema(e,r,t,s,true);return this}addMetaSchema(e,t,r=this.opts.validateSchema){this.addSchema(e,t,true,r);return this}validateSchema(e,t){if(typeof e=="boolean")return true;let r;r=e.$schema;if(r!==undefined&&typeof r!="string"){throw new Error("$schema must be a string")}r=r||this.opts.defaultMeta||this.defaultMeta();if(!r){this.logger.warn("meta-schema not available");this.errors=null;return true}const s=this.validate(r,e);if(!s&&t){const e="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(e);else throw new Error(e)}return s}getSchema(e){let t;while(typeof(t=getSchEnv.call(this,e))=="string")e=t;if(t===undefined){const{schemaId:r}=this.opts;const s=new c.SchemaEnv({schema:{},schemaId:r});t=c.resolveSchema.call(this,s,e);if(!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp){this._removeAllSchemas(this.schemas,e);this._removeAllSchemas(this.refs,e);return this}switch(typeof e){case"undefined":this._removeAllSchemas(this.schemas);this._removeAllSchemas(this.refs);this._cache.clear();return this;case"string":{const t=getSchEnv.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);delete this.schemas[e];delete this.refs[e];return this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r){r=(0,l.normalizeId)(r);delete this.schemas[r];delete this.refs[r]}return this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){r=e;if(typeof t=="object"){this.logger.warn("these parameters are deprecated, see docs for addKeyword");t.keyword=r}}else if(typeof e=="object"&&t===undefined){t=e;r=t.keyword;if(Array.isArray(r)&&!r.length){throw new Error("addKeywords: keyword must be string or non-empty array")}}else{throw new Error("invalid addKeywords parameters")}checkKeyword.call(this,r,t);if(!t){(0,f.eachItem)(r,(e=>addRule.call(this,e)));return this}keywordMetaschema.call(this,t);const s={...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)};(0,f.eachItem)(r,s.type.length===0?e=>addRule.call(this,e,s):e=>s.type.forEach((t=>addRule.call(this,e,s,t))));return this}getKeyword(e){const t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e];delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex((t=>t.keyword===e));if(t>=0)r.rules.splice(t,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);this.formats[e]=t;return this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((e=>`${r}${e.instancePath} ${e.message}`)).reduce(((e,r)=>e+t+r))}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const s of t){const t=s.split("/").slice(1);let a=e;for(const e of t)a=a[e];for(const e in r){const t=r[e];if(typeof t!="object")continue;const{$data:s}=t.definition;const n=a[e];if(s&&n)a[e]=schemaOrData(n)}}return e}_removeAllSchemas(e,t){for(const r in e){const s=e[r];if(!t||t.test(r)){if(typeof s=="string"){delete e[r]}else if(s&&!s.meta){this._cache.delete(s.schema);delete e[r]}}}}_addSchema(e,t,r,s=this.opts.validateSchema,a=this.opts.addUsedSchema){let n;const{schemaId:o}=this.opts;if(typeof e=="object"){n=e[o]}else{if(this.opts.jtd)throw new Error("schema must be object");else if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let i=this._cache.get(e);if(i!==undefined)return i;r=(0,l.normalizeId)(n||r);const u=l.getSchemaRefs.call(this,e,r);i=new c.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:r,localRefs:u});this._cache.set(i.schema,i);if(a&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=i}if(s)this.validateSchema(e,true);return i}_checkUnique(e){if(this.schemas[e]||this.refs[e]){throw new Error(`schema with key or id "${e}" already exists`)}}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else c.compileSchema.call(this,e);if(!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{c.compileSchema.call(this,e)}finally{this.opts=t}}}t["default"]=Ajv;Ajv.ValidationError=n.default;Ajv.MissingRefError=o.default;function checkOptions(e,t,r,s="error"){for(const a in e){const n=a;if(n in t)this.logger[s](`${r}: option ${a}. ${e[n]}`)}}function getSchEnv(e){e=(0,l.normalizeId)(e);return this.schemas[e]||this.refs[e]}function addInitialSchemas(){const e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function addInitialFormats(){for(const e in this.opts.formats){const t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function addInitialKeywords(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function getMetaSchemaOptions(){const e={...this.opts};for(const t of m)delete e[t];return e}const b={log(){},warn(){},error(){}};function getLogger(e){if(e===false)return b;if(e===undefined)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}const w=/^[a-z_$][a-z0-9_$:-]*$/i;function checkKeyword(e,t){const{RULES:r}=this;(0,f.eachItem)(e,(e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!w.test(e))throw new Error(`Keyword ${e} has invalid name`)}));if(!t)return;if(t.$data&&!("code"in t||"validate"in t)){throw new Error('$data keyword must have "code" or "validate" function')}}function addRule(e,t,r){var s;const a=t===null||t===void 0?void 0:t.post;if(r&&a)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:n}=this;let o=a?n.post:n.rules.find((({type:e})=>e===r));if(!o){o={type:r,rules:[]};n.rules.push(o)}n.keywords[e]=true;if(!t)return;const i={keyword:e,definition:{...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)}};if(t.before)addBeforeRule.call(this,o,i,t.before);else o.rules.push(i);n.all[e]=i;(s=t.implements)===null||s===void 0?void 0:s.forEach((e=>this.addKeyword(e)))}function addBeforeRule(e,t,r){const s=e.rules.findIndex((e=>e.keyword===r));if(s>=0){e.rules.splice(s,0,t)}else{e.rules.push(t);this.logger.warn(`rule ${r} is not defined`)}}function keywordMetaschema(e){let{metaSchema:t}=e;if(t===undefined)return;if(e.$data&&this.opts.$data)t=schemaOrData(t);e.validateSchema=this.compile(t,true)}const E={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function schemaOrData(e){return{anyOf:[e,E]}}},6560:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7914);s.code='require("ajv/dist/runtime/equal").default';t["default"]=s},1528:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});function ucs2length(e){const t=e.length;let r=0;let s=0;let a;while(s=55296&&a<=56319&&s{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(8424);s.code='require("ajv/dist/runtime/uri").default';t["default"]=s},4591:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});class ValidationError extends Error{constructor(e){super("validation failed");this.errors=e;this.ajv=this.validation=true}}t["default"]=ValidationError},8366:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.validateAdditionalItems=void 0;const s=r(7794);const a=r(5470);const n={message:({params:{len:e}})=>(0,s.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,s._)`{limit: ${e}}`};const o={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:n,code(e){const{parentSchema:t,it:r}=e;const{items:s}=t;if(!Array.isArray(s)){(0,a.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}validateAdditionalItems(e,s)}};function validateAdditionalItems(e,t){const{gen:r,schema:n,data:o,keyword:i,it:c}=e;c.items=true;const u=r.const("len",(0,s._)`${o}.length`);if(n===false){e.setParams({len:t.length});e.pass((0,s._)`${u} <= ${t.length}`)}else if(typeof n=="object"&&!(0,a.alwaysValidSchema)(c,n)){const a=r.var("valid",(0,s._)`${u} <= ${t.length}`);r.if((0,s.not)(a),(()=>validateItems(a)));e.ok(a)}function validateItems(n){r.forRange("i",t.length,u,(t=>{e.subschema({keyword:i,dataProp:t,dataPropType:a.Type.Num},n);if(!c.allErrors)r.if((0,s.not)(n),(()=>r.break()))}))}}t.validateAdditionalItems=validateAdditionalItems;t["default"]=o},6002:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(1139);const a=r(7794);const n=r(8030);const o=r(5470);const i={message:"must NOT have additional properties",params:({params:e})=>(0,a._)`{additionalProperty: ${e.additionalProperty}}`};const c={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:true,trackErrors:true,error:i,code(e){const{gen:t,schema:r,parentSchema:i,data:c,errsCount:u,it:l}=e;if(!u)throw new Error("ajv implementation error");const{allErrors:d,opts:f}=l;l.props=true;if(f.removeAdditional!=="all"&&(0,o.alwaysValidSchema)(l,r))return;const p=(0,s.allSchemaProperties)(i.properties);const h=(0,s.allSchemaProperties)(i.patternProperties);checkAdditionalProperties();e.ok((0,a._)`${u} === ${n.default.errors}`);function checkAdditionalProperties(){t.forIn("key",c,(e=>{if(!p.length&&!h.length)additionalPropertyCode(e);else t.if(isAdditional(e),(()=>additionalPropertyCode(e)))}))}function isAdditional(r){let n;if(p.length>8){const e=(0,o.schemaRefOrVal)(l,i.properties,"properties");n=(0,s.isOwnProperty)(t,e,r)}else if(p.length){n=(0,a.or)(...p.map((e=>(0,a._)`${r} === ${e}`)))}else{n=a.nil}if(h.length){n=(0,a.or)(n,...h.map((t=>(0,a._)`${(0,s.usePattern)(e,t)}.test(${r})`)))}return(0,a.not)(n)}function deleteAdditional(e){t.code((0,a._)`delete ${c}[${e}]`)}function additionalPropertyCode(s){if(f.removeAdditional==="all"||f.removeAdditional&&r===false){deleteAdditional(s);return}if(r===false){e.setParams({additionalProperty:s});e.error();if(!d)t.break();return}if(typeof r=="object"&&!(0,o.alwaysValidSchema)(l,r)){const r=t.name("valid");if(f.removeAdditional==="failing"){applyAdditionalSchema(s,r,false);t.if((0,a.not)(r),(()=>{e.reset();deleteAdditional(s)}))}else{applyAdditionalSchema(s,r);if(!d)t.if((0,a.not)(r),(()=>t.break()))}}}function applyAdditionalSchema(t,r,s){const a={keyword:"additionalProperties",dataProp:t,dataPropType:o.Type.Str};if(s===false){Object.assign(a,{compositeRule:true,createErrors:false,allErrors:false})}e.subschema(a,r)}}};t["default"]=c},1027:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(5470);const a={keyword:"allOf",schemaType:"array",code(e){const{gen:t,schema:r,it:a}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const n=t.name("valid");r.forEach(((t,r)=>{if((0,s.alwaysValidSchema)(a,t))return;const o=e.subschema({keyword:"allOf",schemaProp:r},n);e.ok(n);e.mergeEvaluated(o)}))}};t["default"]=a},6090:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(1139);const a={keyword:"anyOf",schemaType:"array",trackErrors:true,code:s.validateUnion,error:{message:"must match a schema in anyOf"}};t["default"]=a},6970:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a=r(5470);const n={message:({params:{min:e,max:t}})=>t===undefined?(0,s.str)`must contain at least ${e} valid item(s)`:(0,s.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===undefined?(0,s._)`{minContains: ${e}}`:(0,s._)`{minContains: ${e}, maxContains: ${t}}`};const o={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:true,error:n,code(e){const{gen:t,schema:r,parentSchema:n,data:o,it:i}=e;let c;let u;const{minContains:l,maxContains:d}=n;if(i.opts.next){c=l===undefined?1:l;u=d}else{c=1}const f=t.const("len",(0,s._)`${o}.length`);e.setParams({min:c,max:u});if(u===undefined&&c===0){(0,a.checkStrictMode)(i,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(u!==undefined&&c>u){(0,a.checkStrictMode)(i,`"minContains" > "maxContains" is always invalid`);e.fail();return}if((0,a.alwaysValidSchema)(i,r)){let t=(0,s._)`${f} >= ${c}`;if(u!==undefined)t=(0,s._)`${t} && ${f} <= ${u}`;e.pass(t);return}i.items=true;const p=t.name("valid");if(u===undefined&&c===1){validateItems(p,(()=>t.if(p,(()=>t.break()))))}else if(c===0){t.let(p,true);if(u!==undefined)t.if((0,s._)`${o}.length > 0`,validateItemsWithCount)}else{t.let(p,false);validateItemsWithCount()}e.result(p,(()=>e.reset()));function validateItemsWithCount(){const e=t.name("_valid");const r=t.let("count",0);validateItems(e,(()=>t.if(e,(()=>checkLimits(r)))))}function validateItems(r,s){t.forRange("i",0,f,(t=>{e.subschema({keyword:"contains",dataProp:t,dataPropType:a.Type.Num,compositeRule:true},r);s()}))}function checkLimits(e){t.code((0,s._)`${e}++`);if(u===undefined){t.if((0,s._)`${e} >= ${c}`,(()=>t.assign(p,true).break()))}else{t.if((0,s._)`${e} > ${u}`,(()=>t.assign(p,false).break()));if(c===1)t.assign(p,true);else t.if((0,s._)`${e} >= ${c}`,(()=>t.assign(p,true)))}}}};t["default"]=o},264:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;const s=r(7794);const a=r(5470);const n=r(1139);t.error={message:({params:{property:e,depsCount:t,deps:r}})=>{const a=t===1?"property":"properties";return(0,s.str)`must have ${a} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:a}})=>(0,s._)`{property: ${e}, - missingProperty: ${a}, - depsCount: ${t}, - deps: ${r}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){const[t,r]=splitDependencies(e);validatePropertyDeps(e,t);validateSchemaDeps(e,r)}};function splitDependencies({schema:e}){const t={};const r={};for(const s in e){if(s==="__proto__")continue;const a=Array.isArray(e[s])?t:r;a[s]=e[s]}return[t,r]}function validatePropertyDeps(e,t=e.schema){const{gen:r,data:a,it:o}=e;if(Object.keys(t).length===0)return;const i=r.let("missing");for(const c in t){const u=t[c];if(u.length===0)continue;const l=(0,n.propertyInData)(r,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:u.length,deps:u.join(", ")});if(o.allErrors){r.if(l,(()=>{for(const t of u){(0,n.checkReportMissingProp)(e,t)}}))}else{r.if((0,s._)`${l} && (${(0,n.checkMissingProp)(e,u,i)})`);(0,n.reportMissingProp)(e,i);r.else()}}}t.validatePropertyDeps=validatePropertyDeps;function validateSchemaDeps(e,t=e.schema){const{gen:r,data:s,keyword:o,it:i}=e;const c=r.name("valid");for(const u in t){if((0,a.alwaysValidSchema)(i,t[u]))continue;r.if((0,n.propertyInData)(r,s,u,i.opts.ownProperties),(()=>{const t=e.subschema({keyword:o,schemaProp:u},c);e.mergeValidEvaluated(t,c)}),(()=>r.var(c,true)));e.ok(c)}}t.validateSchemaDeps=validateSchemaDeps;t["default"]=o},8228:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a=r(5470);const n={message:({params:e})=>(0,s.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,s._)`{failingKeyword: ${e.ifClause}}`};const o={keyword:"if",schemaType:["object","boolean"],trackErrors:true,error:n,code(e){const{gen:t,parentSchema:r,it:n}=e;if(r.then===undefined&&r.else===undefined){(0,a.checkStrictMode)(n,'"if" without "then" and "else" is ignored')}const o=hasSchema(n,"then");const i=hasSchema(n,"else");if(!o&&!i)return;const c=t.let("valid",true);const u=t.name("_valid");validateIf();e.reset();if(o&&i){const r=t.let("ifClause");e.setParams({ifClause:r});t.if(u,validateClause("then",r),validateClause("else",r))}else if(o){t.if(u,validateClause("then"))}else{t.if((0,s.not)(u),validateClause("else"))}e.pass(c,(()=>e.error(true)));function validateIf(){const t=e.subschema({keyword:"if",compositeRule:true,createErrors:false,allErrors:false},u);e.mergeEvaluated(t)}function validateClause(r,a){return()=>{const n=e.subschema({keyword:r},u);t.assign(c,u);e.mergeValidEvaluated(n,c);if(a)t.assign(a,(0,s._)`${r}`);else e.setParams({ifClause:r})}}}};function hasSchema(e,t){const r=e.schema[t];return r!==undefined&&!(0,a.alwaysValidSchema)(e,r)}t["default"]=o},2803:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(8366);const a=r(2382);const n=r(1237);const o=r(5e3);const i=r(6970);const c=r(264);const u=r(1697);const l=r(6002);const d=r(2661);const f=r(2471);const p=r(3012);const h=r(6090);const m=r(5501);const y=r(1027);const g=r(8228);const v=r(7522);function getApplicator(e=false){const t=[p.default,h.default,m.default,y.default,g.default,v.default,u.default,l.default,c.default,d.default,f.default];if(e)t.push(a.default,o.default);else t.push(s.default,n.default);t.push(i.default);return t}t["default"]=getApplicator},1237:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.validateTuple=void 0;const s=r(7794);const a=r(5470);const n=r(1139);const o={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:t,it:r}=e;if(Array.isArray(t))return validateTuple(e,"additionalItems",t);r.items=true;if((0,a.alwaysValidSchema)(r,t))return;e.ok((0,n.validateArray)(e))}};function validateTuple(e,t,r=e.schema){const{gen:n,parentSchema:o,data:i,keyword:c,it:u}=e;checkStrictTuple(o);if(u.opts.unevaluated&&r.length&&u.items!==true){u.items=a.mergeEvaluated.items(n,r.length,u.items)}const l=n.name("valid");const d=n.const("len",(0,s._)`${i}.length`);r.forEach(((t,r)=>{if((0,a.alwaysValidSchema)(u,t))return;n.if((0,s._)`${d} > ${r}`,(()=>e.subschema({keyword:c,schemaProp:r,dataProp:r},l)));e.ok(l)}));function checkStrictTuple(e){const{opts:s,errSchemaPath:n}=u;const o=r.length;const i=o===e.minItems&&(o===e.maxItems||e[t]===false);if(s.strictTuples&&!i){const e=`"${c}" is ${o}-tuple, but minItems or maxItems/${t} are not specified or different at path "${n}"`;(0,a.checkStrictMode)(u,e,s.strictTuples)}}}t.validateTuple=validateTuple;t["default"]=o},5e3:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a=r(5470);const n=r(1139);const o=r(8366);const i={message:({params:{len:e}})=>(0,s.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,s._)`{limit: ${e}}`};const c={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:i,code(e){const{schema:t,parentSchema:r,it:s}=e;const{prefixItems:i}=r;s.items=true;if((0,a.alwaysValidSchema)(s,t))return;if(i)(0,o.validateAdditionalItems)(e,i);else e.ok((0,n.validateArray)(e))}};t["default"]=c},3012:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(5470);const a={keyword:"not",schemaType:["object","boolean"],trackErrors:true,code(e){const{gen:t,schema:r,it:a}=e;if((0,s.alwaysValidSchema)(a,r)){e.fail();return}const n=t.name("valid");e.subschema({keyword:"not",compositeRule:true,createErrors:false,allErrors:false},n);e.failResult(n,(()=>e.reset()),(()=>e.error()))},error:{message:"must NOT be valid"}};t["default"]=a},5501:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a=r(5470);const n={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,s._)`{passingSchemas: ${e.passing}}`};const o={keyword:"oneOf",schemaType:"array",trackErrors:true,error:n,code(e){const{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;const i=r;const c=t.let("valid",false);const u=t.let("passing",null);const l=t.name("_valid");e.setParams({passing:u});t.block(validateOneOf);e.result(c,(()=>e.reset()),(()=>e.error(true)));function validateOneOf(){i.forEach(((r,n)=>{let i;if((0,a.alwaysValidSchema)(o,r)){t.var(l,true)}else{i=e.subschema({keyword:"oneOf",schemaProp:n,compositeRule:true},l)}if(n>0){t.if((0,s._)`${l} && ${c}`).assign(c,false).assign(u,(0,s._)`[${u}, ${n}]`).else()}t.if(l,(()=>{t.assign(c,true);t.assign(u,n);if(i)e.mergeEvaluated(i,s.Name)}))}))}}};t["default"]=o},2471:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(1139);const a=r(7794);const n=r(5470);const o=r(5470);const i={keyword:"patternProperties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,data:i,parentSchema:c,it:u}=e;const{opts:l}=u;const d=(0,s.allSchemaProperties)(r);const f=d.filter((e=>(0,n.alwaysValidSchema)(u,r[e])));if(d.length===0||f.length===d.length&&(!u.opts.unevaluated||u.props===true)){return}const p=l.strictSchema&&!l.allowMatchingProperties&&c.properties;const h=t.name("valid");if(u.props!==true&&!(u.props instanceof a.Name)){u.props=(0,o.evaluatedPropsToName)(t,u.props)}const{props:m}=u;validatePatternProperties();function validatePatternProperties(){for(const e of d){if(p)checkMatchingProperties(e);if(u.allErrors){validateProperties(e)}else{t.var(h,true);validateProperties(e);t.if(h)}}}function checkMatchingProperties(e){for(const t in p){if(new RegExp(e).test(t)){(0,n.checkStrictMode)(u,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}}}function validateProperties(r){t.forIn("key",i,(n=>{t.if((0,a._)`${(0,s.usePattern)(e,r)}.test(${n})`,(()=>{const s=f.includes(r);if(!s){e.subschema({keyword:"patternProperties",schemaProp:r,dataProp:n,dataPropType:o.Type.Str},h)}if(u.opts.unevaluated&&m!==true){t.assign((0,a._)`${m}[${n}]`,true)}else if(!s&&!u.allErrors){t.if((0,a.not)(h),(()=>t.break()))}}))}))}}};t["default"]=i},2382:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(1237);const a={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,s.validateTuple)(e,"items")};t["default"]=a},2661:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(2069);const a=r(1139);const n=r(5470);const o=r(6002);const i={keyword:"properties",type:"object",schemaType:"object",code(e){const{gen:t,schema:r,parentSchema:i,data:c,it:u}=e;if(u.opts.removeAdditional==="all"&&i.additionalProperties===undefined){o.default.code(new s.KeywordCxt(u,o.default,"additionalProperties"))}const l=(0,a.allSchemaProperties)(r);for(const e of l){u.definedProperties.add(e)}if(u.opts.unevaluated&&l.length&&u.props!==true){u.props=n.mergeEvaluated.props(t,(0,n.toHash)(l),u.props)}const d=l.filter((e=>!(0,n.alwaysValidSchema)(u,r[e])));if(d.length===0)return;const f=t.name("valid");for(const r of d){if(hasDefault(r)){applyPropertySchema(r)}else{t.if((0,a.propertyInData)(t,c,r,u.opts.ownProperties));applyPropertySchema(r);if(!u.allErrors)t.else().var(f,true);t.endIf()}e.it.definedProperties.add(r);e.ok(f)}function hasDefault(e){return u.opts.useDefaults&&!u.compositeRule&&r[e].default!==undefined}function applyPropertySchema(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},f)}}};t["default"]=i},1697:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a=r(5470);const n={message:"property name must be valid",params:({params:e})=>(0,s._)`{propertyName: ${e.propertyName}}`};const o={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:n,code(e){const{gen:t,schema:r,data:n,it:o}=e;if((0,a.alwaysValidSchema)(o,r))return;const i=t.name("valid");t.forIn("key",n,(r=>{e.setParams({propertyName:r});e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:true},i);t.if((0,s.not)(i),(()=>{e.error(true);if(!o.allErrors)t.break()}))}));e.ok(i)}};t["default"]=o},7522:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(5470);const a={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===undefined)(0,s.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};t["default"]=a},1139:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;const s=r(7794);const a=r(5470);const n=r(8030);const o=r(5470);function checkReportMissingProp(e,t){const{gen:r,data:a,it:n}=e;r.if(noPropertyInData(r,a,t,n.opts.ownProperties),(()=>{e.setParams({missingProperty:(0,s._)`${t}`},true);e.error()}))}t.checkReportMissingProp=checkReportMissingProp;function checkMissingProp({gen:e,data:t,it:{opts:r}},a,n){return(0,s.or)(...a.map((a=>(0,s.and)(noPropertyInData(e,t,a,r.ownProperties),(0,s._)`${n} = ${a}`))))}t.checkMissingProp=checkMissingProp;function reportMissingProp(e,t){e.setParams({missingProperty:t},true);e.error()}t.reportMissingProp=reportMissingProp;function hasPropFunc(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,s._)`Object.prototype.hasOwnProperty`})}t.hasPropFunc=hasPropFunc;function isOwnProperty(e,t,r){return(0,s._)`${hasPropFunc(e)}.call(${t}, ${r})`}t.isOwnProperty=isOwnProperty;function propertyInData(e,t,r,a){const n=(0,s._)`${t}${(0,s.getProperty)(r)} !== undefined`;return a?(0,s._)`${n} && ${isOwnProperty(e,t,r)}`:n}t.propertyInData=propertyInData;function noPropertyInData(e,t,r,a){const n=(0,s._)`${t}${(0,s.getProperty)(r)} === undefined`;return a?(0,s.or)(n,(0,s.not)(isOwnProperty(e,t,r))):n}t.noPropertyInData=noPropertyInData;function allSchemaProperties(e){return e?Object.keys(e).filter((e=>e!=="__proto__")):[]}t.allSchemaProperties=allSchemaProperties;function schemaProperties(e,t){return allSchemaProperties(t).filter((r=>!(0,a.alwaysValidSchema)(e,t[r])))}t.schemaProperties=schemaProperties;function callValidateCode({schemaCode:e,data:t,it:{gen:r,topSchemaRef:a,schemaPath:o,errorPath:i},it:c},u,l,d){const f=d?(0,s._)`${e}, ${t}, ${a}${o}`:t;const p=[[n.default.instancePath,(0,s.strConcat)(n.default.instancePath,i)],[n.default.parentData,c.parentData],[n.default.parentDataProperty,c.parentDataProperty],[n.default.rootData,n.default.rootData]];if(c.opts.dynamicRef)p.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);const h=(0,s._)`${f}, ${r.object(...p)}`;return l!==s.nil?(0,s._)`${u}.call(${l}, ${h})`:(0,s._)`${u}(${h})`}t.callValidateCode=callValidateCode;const i=(0,s._)`new RegExp`;function usePattern({gen:e,it:{opts:t}},r){const a=t.unicodeRegExp?"u":"";const{regExp:n}=t.code;const c=n(r,a);return e.scopeValue("pattern",{key:c.toString(),ref:c,code:(0,s._)`${n.code==="new RegExp"?i:(0,o.useFunc)(e,n)}(${r}, ${a})`})}t.usePattern=usePattern;function validateArray(e){const{gen:t,data:r,keyword:n,it:o}=e;const i=t.name("valid");if(o.allErrors){const e=t.let("valid",true);validateItems((()=>t.assign(e,false)));return e}t.var(i,true);validateItems((()=>t.break()));return i;function validateItems(o){const c=t.const("len",(0,s._)`${r}.length`);t.forRange("i",0,c,(r=>{e.subschema({keyword:n,dataProp:r,dataPropType:a.Type.Num},i);t.if((0,s.not)(i),o)}))}}t.validateArray=validateArray;function validateUnion(e){const{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");const i=r.some((e=>(0,a.alwaysValidSchema)(o,e)));if(i&&!o.opts.unevaluated)return;const c=t.let("valid",false);const u=t.name("_valid");t.block((()=>r.forEach(((r,a)=>{const o=e.subschema({keyword:n,schemaProp:a,compositeRule:true},u);t.assign(c,(0,s._)`${c} || ${u}`);const i=e.mergeValidEvaluated(o,u);if(!i)t.if((0,s.not)(c))}))));e.result(c,(()=>e.reset()),(()=>e.error(true)))}t.validateUnion=validateUnion},4545:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const r={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};t["default"]=r},5841:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(4545);const a=r(5755);const n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",s.default,a.default];t["default"]=n},5755:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.callRef=t.getValidate=void 0;const s=r(7983);const a=r(1139);const n=r(7794);const o=r(8030);const i=r(8612);const c=r(5470);const u={keyword:"$ref",schemaType:"string",code(e){const{gen:t,schema:r,it:a}=e;const{baseId:o,schemaEnv:c,validateName:u,opts:l,self:d}=a;const{root:f}=c;if((r==="#"||r==="#/")&&o===f.baseId)return callRootRef();const p=i.resolveRef.call(d,f,o,r);if(p===undefined)throw new s.default(a.opts.uriResolver,o,r);if(p instanceof i.SchemaEnv)return callValidate(p);return inlineRefSchema(p);function callRootRef(){if(c===f)return callRef(e,u,c,c.$async);const r=t.scopeValue("root",{ref:f});return callRef(e,(0,n._)`${r}.validate`,f,f.$async)}function callValidate(t){const r=getValidate(e,t);callRef(e,r,t,t.$async)}function inlineRefSchema(s){const a=t.scopeValue("schema",l.code.source===true?{ref:s,code:(0,n.stringify)(s)}:{ref:s});const o=t.name("valid");const i=e.subschema({schema:s,dataTypes:[],schemaPath:n.nil,topSchemaRef:a,errSchemaPath:r},o);e.mergeEvaluated(i);e.ok(o)}}};function getValidate(e,t){const{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,n._)`${r.scopeValue("wrapper",{ref:t})}.validate`}t.getValidate=getValidate;function callRef(e,t,r,s){const{gen:i,it:u}=e;const{allErrors:l,schemaEnv:d,opts:f}=u;const p=f.passContext?o.default.this:n.nil;if(s)callAsyncRef();else callSyncRef();function callAsyncRef(){if(!d.$async)throw new Error("async schema referenced by sync schema");const r=i.let("valid");i.try((()=>{i.code((0,n._)`await ${(0,a.callValidateCode)(e,t,p)}`);addEvaluatedFrom(t);if(!l)i.assign(r,true)}),(e=>{i.if((0,n._)`!(${e} instanceof ${u.ValidationError})`,(()=>i.throw(e)));addErrorsFrom(e);if(!l)i.assign(r,false)}));e.ok(r)}function callSyncRef(){e.result((0,a.callValidateCode)(e,t,p),(()=>addEvaluatedFrom(t)),(()=>addErrorsFrom(t)))}function addErrorsFrom(e){const t=(0,n._)`${e}.errors`;i.assign(o.default.vErrors,(0,n._)`${o.default.vErrors} === null ? ${t} : ${o.default.vErrors}.concat(${t})`);i.assign(o.default.errors,(0,n._)`${o.default.vErrors}.length`)}function addEvaluatedFrom(e){var t;if(!u.opts.unevaluated)return;const s=(t=r===null||r===void 0?void 0:r.validate)===null||t===void 0?void 0:t.evaluated;if(u.props!==true){if(s&&!s.dynamicProps){if(s.props!==undefined){u.props=c.mergeEvaluated.props(i,s.props,u.props)}}else{const t=i.var("props",(0,n._)`${e}.evaluated.props`);u.props=c.mergeEvaluated.props(i,t,u.props,n.Name)}}if(u.items!==true){if(s&&!s.dynamicItems){if(s.items!==undefined){u.items=c.mergeEvaluated.items(i,s.items,u.items)}}else{const t=i.var("items",(0,n._)`${e}.evaluated.items`);u.items=c.mergeEvaluated.items(i,t,u.items,n.Name)}}}}t.callRef=callRef;t["default"]=u},764:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a=r(638);const n=r(8612);const o=r(5470);const i={message:({params:{discrError:e,tagName:t}})=>e===a.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,s._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`};const c={keyword:"discriminator",type:"object",schemaType:"object",error:i,code(e){const{gen:t,data:r,schema:i,parentSchema:c,it:u}=e;const{oneOf:l}=c;if(!u.opts.discriminator){throw new Error("discriminator: requires discriminator option")}const d=i.propertyName;if(typeof d!="string")throw new Error("discriminator: requires propertyName");if(i.mapping)throw new Error("discriminator: mapping is not supported");if(!l)throw new Error("discriminator: requires oneOf keyword");const f=t.let("valid",false);const p=t.const("tag",(0,s._)`${r}${(0,s.getProperty)(d)}`);t.if((0,s._)`typeof ${p} == "string"`,(()=>validateMapping()),(()=>e.error(false,{discrError:a.DiscrError.Tag,tag:p,tagName:d})));e.ok(f);function validateMapping(){const r=getMapping();t.if(false);for(const e in r){t.elseIf((0,s._)`${p} === ${e}`);t.assign(f,applyTagSchema(r[e]))}t.else();e.error(false,{discrError:a.DiscrError.Mapping,tag:p,tagName:d});t.endIf()}function applyTagSchema(r){const a=t.name("valid");const n=e.subschema({keyword:"oneOf",schemaProp:r},a);e.mergeEvaluated(n,s.Name);return a}function getMapping(){var e;const t={};const r=hasRequired(c);let s=true;for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.DiscrError=void 0;var r;(function(e){e["Tag"]="tag";e["Mapping"]="mapping"})(r=t.DiscrError||(t.DiscrError={}))},7127:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(5841);const a=r(6163);const n=r(2803);const o=r(2879);const i=r(8590);const c=[s.default,a.default,(0,n.default)(),o.default,i.metadataVocabulary,i.contentVocabulary];t["default"]=c},5240:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a={message:({schemaCode:e})=>(0,s.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,s._)`{format: ${e}}`};const n={keyword:"format",type:["number","string"],schemaType:"string",$data:true,error:a,code(e,t){const{gen:r,data:a,$data:n,schema:o,schemaCode:i,it:c}=e;const{opts:u,errSchemaPath:l,schemaEnv:d,self:f}=c;if(!u.validateFormats)return;if(n)validate$DataFormat();else validateFormat();function validate$DataFormat(){const n=r.scopeValue("formats",{ref:f.formats,code:u.code.formats});const o=r.const("fDef",(0,s._)`${n}[${i}]`);const c=r.let("fType");const l=r.let("format");r.if((0,s._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,(()=>r.assign(c,(0,s._)`${o}.type || "string"`).assign(l,(0,s._)`${o}.validate`)),(()=>r.assign(c,(0,s._)`"string"`).assign(l,o)));e.fail$data((0,s.or)(unknownFmt(),invalidFmt()));function unknownFmt(){if(u.strictSchema===false)return s.nil;return(0,s._)`${i} && !${l}`}function invalidFmt(){const e=d.$async?(0,s._)`(${o}.async ? await ${l}(${a}) : ${l}(${a}))`:(0,s._)`${l}(${a})`;const r=(0,s._)`(typeof ${l} == "function" ? ${e} : ${l}.test(${a}))`;return(0,s._)`${l} && ${l} !== true && ${c} === ${t} && !${r}`}}function validateFormat(){const n=f.formats[o];if(!n){unknownFormat();return}if(n===true)return;const[i,c,p]=getFormat(n);if(i===t)e.pass(validCondition());function unknownFormat(){if(u.strictSchema===false){f.logger.warn(unknownMsg());return}throw new Error(unknownMsg());function unknownMsg(){return`unknown format "${o}" ignored in schema at path "${l}"`}}function getFormat(e){const t=e instanceof RegExp?(0,s.regexpCode)(e):u.code.formats?(0,s._)`${u.code.formats}${(0,s.getProperty)(o)}`:undefined;const a=r.scopeValue("formats",{key:o,ref:e,code:t});if(typeof e=="object"&&!(e instanceof RegExp)){return[e.type||"string",e.validate,(0,s._)`${a}.validate`]}return["string",e,a]}function validCondition(){if(typeof n=="object"&&!(n instanceof RegExp)&&n.async){if(!d.$async)throw new Error("async format in sync schema");return(0,s._)`await ${p}(${a})`}return typeof c=="function"?(0,s._)`${p}(${a})`:(0,s._)`${p}.test(${a})`}}}};t["default"]=n},2879:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(5240);const a=[s.default];t["default"]=a},8590:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.contentVocabulary=t.metadataVocabulary=void 0;t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},7802:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a=r(5470);const n=r(6560);const o={message:"must be equal to constant",params:({schemaCode:e})=>(0,s._)`{allowedValue: ${e}}`};const i={keyword:"const",$data:true,error:o,code(e){const{gen:t,data:r,$data:o,schemaCode:i,schema:c}=e;if(o||c&&typeof c=="object"){e.fail$data((0,s._)`!${(0,a.useFunc)(t,n.default)}(${r}, ${i})`)}else{e.fail((0,s._)`${c} !== ${r}`)}}};t["default"]=i},2844:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a=r(5470);const n=r(6560);const o={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,s._)`{allowedValues: ${e}}`};const i={keyword:"enum",schemaType:"array",$data:true,error:o,code(e){const{gen:t,data:r,$data:o,schema:i,schemaCode:c,it:u}=e;if(!o&&i.length===0)throw new Error("enum must have non-empty array");const l=i.length>=u.opts.loopEnum;let d;const getEql=()=>d!==null&&d!==void 0?d:d=(0,a.useFunc)(t,n.default);let f;if(l||o){f=t.let("valid");e.block$data(f,loopEnum)}else{if(!Array.isArray(i))throw new Error("ajv implementation error");const e=t.const("vSchema",c);f=(0,s.or)(...i.map(((t,r)=>equalCode(e,r))))}e.pass(f);function loopEnum(){t.assign(f,false);t.forOf("v",c,(e=>t.if((0,s._)`${getEql()}(${r}, ${e})`,(()=>t.assign(f,true).break()))))}function equalCode(e,t){const a=i[t];return typeof a==="object"&&a!==null?(0,s._)`${getEql()}(${r}, ${e}[${t}])`:(0,s._)`${r} === ${a}`}}};t["default"]=i},6163:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(715);const a=r(1408);const n=r(6809);const o=r(1355);const i=r(5205);const c=r(9818);const u=r(4660);const l=r(1620);const d=r(7802);const f=r(2844);const p=[s.default,a.default,n.default,o.default,i.default,c.default,u.default,l.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},d.default,f.default];t["default"]=p},4660:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a={message({keyword:e,schemaCode:t}){const r=e==="maxItems"?"more":"fewer";return(0,s.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,s._)`{limit: ${e}}`};const n={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:true,error:a,code(e){const{keyword:t,data:r,schemaCode:a}=e;const n=t==="maxItems"?s.operators.GT:s.operators.LT;e.fail$data((0,s._)`${r}.length ${n} ${a}`)}};t["default"]=n},6809:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a=r(5470);const n=r(1528);const o={message({keyword:e,schemaCode:t}){const r=e==="maxLength"?"more":"fewer";return(0,s.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,s._)`{limit: ${e}}`};const i={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:true,error:o,code(e){const{keyword:t,data:r,schemaCode:o,it:i}=e;const c=t==="maxLength"?s.operators.GT:s.operators.LT;const u=i.opts.unicode===false?(0,s._)`${r}.length`:(0,s._)`${(0,a.useFunc)(e.gen,n.default)}(${r})`;e.fail$data((0,s._)`${u} ${c} ${o}`)}};t["default"]=i},715:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a=s.operators;const n={maximum:{okStr:"<=",ok:a.LTE,fail:a.GT},minimum:{okStr:">=",ok:a.GTE,fail:a.LT},exclusiveMaximum:{okStr:"<",ok:a.LT,fail:a.GTE},exclusiveMinimum:{okStr:">",ok:a.GT,fail:a.LTE}};const o={message:({keyword:e,schemaCode:t})=>(0,s.str)`must be ${n[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,s._)`{comparison: ${n[e].okStr}, limit: ${t}}`};const i={keyword:Object.keys(n),type:"number",schemaType:"number",$data:true,error:o,code(e){const{keyword:t,data:r,schemaCode:a}=e;e.fail$data((0,s._)`${r} ${n[t].fail} ${a} || isNaN(${r})`)}};t["default"]=i},5205:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a={message({keyword:e,schemaCode:t}){const r=e==="maxProperties"?"more":"fewer";return(0,s.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,s._)`{limit: ${e}}`};const n={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:true,error:a,code(e){const{keyword:t,data:r,schemaCode:a}=e;const n=t==="maxProperties"?s.operators.GT:s.operators.LT;e.fail$data((0,s._)`Object.keys(${r}).length ${n} ${a}`)}};t["default"]=n},1408:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7794);const a={message:({schemaCode:e})=>(0,s.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,s._)`{multipleOf: ${e}}`};const n={keyword:"multipleOf",type:"number",schemaType:"number",$data:true,error:a,code(e){const{gen:t,data:r,schemaCode:a,it:n}=e;const o=n.opts.multipleOfPrecision;const i=t.let("res");const c=o?(0,s._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:(0,s._)`${i} !== parseInt(${i})`;e.fail$data((0,s._)`(${a} === 0 || (${i} = ${r}/${a}, ${c}))`)}};t["default"]=n},1355:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(1139);const a=r(7794);const n={message:({schemaCode:e})=>(0,a.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,a._)`{pattern: ${e}}`};const o={keyword:"pattern",type:"string",schemaType:"string",$data:true,error:n,code(e){const{data:t,$data:r,schema:n,schemaCode:o,it:i}=e;const c=i.opts.unicodeRegExp?"u":"";const u=r?(0,a._)`(new RegExp(${o}, ${c}))`:(0,s.usePattern)(e,n);e.fail$data((0,a._)`!${u}.test(${t})`)}};t["default"]=o},9818:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(1139);const a=r(7794);const n=r(5470);const o={message:({params:{missingProperty:e}})=>(0,a.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,a._)`{missingProperty: ${e}}`};const i={keyword:"required",type:"object",schemaType:"array",$data:true,error:o,code(e){const{gen:t,schema:r,schemaCode:o,data:i,$data:c,it:u}=e;const{opts:l}=u;if(!c&&r.length===0)return;const d=r.length>=l.loopRequired;if(u.allErrors)allErrorsMode();else exitOnErrorMode();if(l.strictRequired){const t=e.parentSchema.properties;const{definedProperties:s}=e.it;for(const e of r){if((t===null||t===void 0?void 0:t[e])===undefined&&!s.has(e)){const t=u.schemaEnv.baseId+u.errSchemaPath;const r=`required property "${e}" is not defined at "${t}" (strictRequired)`;(0,n.checkStrictMode)(u,r,u.opts.strictRequired)}}}function allErrorsMode(){if(d||c){e.block$data(a.nil,loopAllRequired)}else{for(const t of r){(0,s.checkReportMissingProp)(e,t)}}}function exitOnErrorMode(){const a=t.let("missing");if(d||c){const r=t.let("valid",true);e.block$data(r,(()=>loopUntilMissing(a,r)));e.ok(r)}else{t.if((0,s.checkMissingProp)(e,r,a));(0,s.reportMissingProp)(e,a);t.else()}}function loopAllRequired(){t.forOf("prop",o,(r=>{e.setParams({missingProperty:r});t.if((0,s.noPropertyInData)(t,i,r,l.ownProperties),(()=>e.error()))}))}function loopUntilMissing(r,n){e.setParams({missingProperty:r});t.forOf(r,o,(()=>{t.assign(n,(0,s.propertyInData)(t,i,r,l.ownProperties));t.if((0,a.not)(n),(()=>{e.error();t.break()}))}),a.nil)}}};t["default"]=i},1620:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});const s=r(7795);const a=r(7794);const n=r(5470);const o=r(6560);const i={message:({params:{i:e,j:t}})=>(0,a.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,a._)`{i: ${e}, j: ${t}}`};const c={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:true,error:i,code(e){const{gen:t,data:r,$data:i,schema:c,parentSchema:u,schemaCode:l,it:d}=e;if(!i&&!c)return;const f=t.let("valid");const p=u.items?(0,s.getSchemaTypes)(u.items):[];e.block$data(f,validateUniqueItems,(0,a._)`${l} === false`);e.ok(f);function validateUniqueItems(){const s=t.let("i",(0,a._)`${r}.length`);const n=t.let("j");e.setParams({i:s,j:n});t.assign(f,true);t.if((0,a._)`${s} > 1`,(()=>(canOptimize()?loopN:loopN2)(s,n)))}function canOptimize(){return p.length>0&&!p.some((e=>e==="object"||e==="array"))}function loopN(n,o){const i=t.name("item");const c=(0,s.checkDataTypes)(p,i,d.opts.strictNumbers,s.DataType.Wrong);const u=t.const("indices",(0,a._)`{}`);t.for((0,a._)`;${n}--;`,(()=>{t.let(i,(0,a._)`${r}[${n}]`);t.if(c,(0,a._)`continue`);if(p.length>1)t.if((0,a._)`typeof ${i} == "string"`,(0,a._)`${i} += "_"`);t.if((0,a._)`typeof ${u}[${i}] == "number"`,(()=>{t.assign(o,(0,a._)`${u}[${i}]`);e.error();t.assign(f,false).break()})).code((0,a._)`${u}[${i}] = ${n}`)}))}function loopN2(s,i){const c=(0,n.useFunc)(t,o.default);const u=t.name("outer");t.label(u).for((0,a._)`;${s}--;`,(()=>t.for((0,a._)`${i} = ${s}; ${i}--;`,(()=>t.if((0,a._)`${c}(${r}[${s}], ${r}[${i}])`,(()=>{e.error();t.assign(f,false).break(u)}))))))}}};t["default"]=c},7914:e=>{"use strict";e.exports=function equal(e,t){if(e===t)return true;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return false;var r,s,a;if(Array.isArray(e)){r=e.length;if(r!=t.length)return false;for(s=r;s--!==0;)if(!equal(e[s],t[s]))return false;return true}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();a=Object.keys(e);r=a.length;if(r!==Object.keys(t).length)return false;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,a[s]))return false;for(s=r;s--!==0;){var n=a[s];if(!equal(e[n],t[n]))return false}return true}return e!==e&&t!==t}},2486:e=>{"use strict";var t=e.exports=function(e,t,r){if(typeof t=="function"){r=t;t={}}r=t.cb||r;var s=typeof r=="function"?r:r.pre||function(){};var a=r.post||function(){};_traverse(t,s,a,e,"",e)};t.keywords={additionalItems:true,items:true,contains:true,additionalProperties:true,propertyNames:true,not:true,if:true,then:true,else:true};t.arrayKeywords={items:true,allOf:true,anyOf:true,oneOf:true};t.propsKeywords={$defs:true,definitions:true,properties:true,patternProperties:true,dependencies:true};t.skipKeywords={default:true,enum:true,const:true,required:true,maximum:true,minimum:true,exclusiveMaximum:true,exclusiveMinimum:true,multipleOf:true,maxLength:true,minLength:true,pattern:true,format:true,maxItems:true,minItems:true,uniqueItems:true,maxProperties:true,minProperties:true};function _traverse(e,r,s,a,n,o,i,c,u,l){if(a&&typeof a=="object"&&!Array.isArray(a)){r(a,n,o,i,c,u,l);for(var d in a){var f=a[d];if(Array.isArray(f)){if(d in t.arrayKeywords){for(var p=0;p1){t[0]=t[0].slice(0,-1);var s=t.length-1;for(var a=1;a= 0x80 (not a basic code point)","invalid-input":"Invalid input"};var g=n-o;var v=Math.floor;var $=String.fromCharCode;function error$1(e){throw new RangeError(y[e])}function map(e,t){var r=[];var s=e.length;while(s--){r[s]=t(e[s])}return r}function mapDomain(e,t){var r=e.split("@");var s="";if(r.length>1){s=r[0]+"@";e=r[1]}e=e.replace(m,".");var a=e.split(".");var n=map(a,t).join(".");return s+n}function ucs2decode(e){var t=[];var r=0;var s=e.length;while(r=55296&&a<=56319&&r>1;e+=v(e/t);for(;e>g*i>>1;s+=n){e=v(e/g)}return v(s+(g+1)*e/(e+c))};var P=function decode(e){var t=[];var r=e.length;var s=0;var c=d;var u=l;var p=e.lastIndexOf(f);if(p<0){p=0}for(var h=0;h=128){error$1("not-basic")}t.push(e.charCodeAt(h))}for(var m=p>0?p+1:0;m=r){error$1("invalid-input")}var b=w(e.charCodeAt(m++));if(b>=n||b>v((a-s)/g)){error$1("overflow")}s+=b*g;var E=$<=u?o:$>=u+i?i:$-u;if(bv(a/P)){error$1("overflow")}g*=P}var C=t.length+1;u=S(s-y,C,y==0);if(v(s/C)>a-c){error$1("overflow")}c+=v(s/C);s%=C;t.splice(s++,0,c)}return String.fromCodePoint.apply(String,t)};var C=function encode(e){var t=[];e=ucs2decode(e);var r=e.length;var s=d;var c=0;var u=l;var p=true;var h=false;var m=undefined;try{for(var y=e[Symbol.iterator](),g;!(p=(g=y.next()).done);p=true){var b=g.value;if(b<128){t.push($(b))}}}catch(e){h=true;m=e}finally{try{if(!p&&y.return){y.return()}}finally{if(h){throw m}}}var w=t.length;var P=w;if(w){t.push(f)}while(P=s&&Tv((a-c)/j)){error$1("overflow")}c+=(C-s)*j;s=C;var I=true;var D=false;var A=undefined;try{for(var M=e[Symbol.iterator](),F;!(I=(F=M.next()).done);I=true){var V=F.value;if(Va){error$1("overflow")}if(V==s){var U=c;for(var z=n;;z+=n){var K=z<=u?o:z>=u+i?i:z-u;if(U>6|192).toString(16).toUpperCase()+"%"+(t&63|128).toString(16).toUpperCase();else r="%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(t&63|128).toString(16).toUpperCase();return r}function pctDecChars(e){var t="";var r=0;var s=e.length;while(r=194&&a<224){if(s-r>=6){var n=parseInt(e.substr(r+4,2),16);t+=String.fromCharCode((a&31)<<6|n&63)}else{t+=e.substr(r,6)}r+=6}else if(a>=224){if(s-r>=9){var o=parseInt(e.substr(r+4,2),16);var i=parseInt(e.substr(r+7,2),16);t+=String.fromCharCode((a&15)<<12|(o&63)<<6|i&63)}else{t+=e.substr(r,9)}r+=9}else{t+=e.substr(r,3);r+=3}}return t}function _normalizeComponentEncoding(e,t){function decodeUnreserved(e){var r=pctDecChars(e);return!r.match(t.UNRESERVED)?e:r}if(e.scheme)e.scheme=String(e.scheme).replace(t.PCT_ENCODED,decodeUnreserved).toLowerCase().replace(t.NOT_SCHEME,"");if(e.userinfo!==undefined)e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,decodeUnreserved).replace(t.NOT_USERINFO,pctEncChar).replace(t.PCT_ENCODED,toUpperCase);if(e.host!==undefined)e.host=String(e.host).replace(t.PCT_ENCODED,decodeUnreserved).toLowerCase().replace(t.NOT_HOST,pctEncChar).replace(t.PCT_ENCODED,toUpperCase);if(e.path!==undefined)e.path=String(e.path).replace(t.PCT_ENCODED,decodeUnreserved).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,pctEncChar).replace(t.PCT_ENCODED,toUpperCase);if(e.query!==undefined)e.query=String(e.query).replace(t.PCT_ENCODED,decodeUnreserved).replace(t.NOT_QUERY,pctEncChar).replace(t.PCT_ENCODED,toUpperCase);if(e.fragment!==undefined)e.fragment=String(e.fragment).replace(t.PCT_ENCODED,decodeUnreserved).replace(t.NOT_FRAGMENT,pctEncChar).replace(t.PCT_ENCODED,toUpperCase);return e}function _stripLeadingZeros(e){return e.replace(/^0*(.*)/,"$1")||"0"}function _normalizeIPv4(e,t){var r=e.match(t.IPV4ADDRESS)||[];var a=s(r,2),n=a[1];if(n){return n.split(".").map(_stripLeadingZeros).join(".")}else{return e}}function _normalizeIPv6(e,t){var r=e.match(t.IPV6ADDRESS)||[];var a=s(r,3),n=a[1],o=a[2];if(n){var i=n.toLowerCase().split("::").reverse(),c=s(i,2),u=c[0],l=c[1];var d=l?l.split(":").map(_stripLeadingZeros):[];var f=u.split(":").map(_stripLeadingZeros);var p=t.IPV4ADDRESS.test(f[f.length-1]);var h=p?7:8;var m=f.length-h;var y=Array(h);for(var g=0;g1){var w=y.slice(0,$.index);var E=y.slice($.index+$.length);b=w.join(":")+"::"+E.join(":")}else{b=y.join(":")}if(o){b+="%"+o}return b}else{return e}}var R=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;var T="".match(/(){0}/)[1]===undefined;function parse(e){var s=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var a={};var n=s.iri!==false?r:t;if(s.reference==="suffix")e=(s.scheme?s.scheme+":":"")+"//"+e;var o=e.match(R);if(o){if(T){a.scheme=o[1];a.userinfo=o[3];a.host=o[4];a.port=parseInt(o[5],10);a.path=o[6]||"";a.query=o[7];a.fragment=o[8];if(isNaN(a.port)){a.port=o[5]}}else{a.scheme=o[1]||undefined;a.userinfo=e.indexOf("@")!==-1?o[3]:undefined;a.host=e.indexOf("//")!==-1?o[4]:undefined;a.port=parseInt(o[5],10);a.path=o[6]||"";a.query=e.indexOf("?")!==-1?o[7]:undefined;a.fragment=e.indexOf("#")!==-1?o[8]:undefined;if(isNaN(a.port)){a.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?o[4]:undefined}}if(a.host){a.host=_normalizeIPv6(_normalizeIPv4(a.host,n),n)}if(a.scheme===undefined&&a.userinfo===undefined&&a.host===undefined&&a.port===undefined&&!a.path&&a.query===undefined){a.reference="same-document"}else if(a.scheme===undefined){a.reference="relative"}else if(a.fragment===undefined){a.reference="absolute"}else{a.reference="uri"}if(s.reference&&s.reference!=="suffix"&&s.reference!==a.reference){a.error=a.error||"URI is not a "+s.reference+" reference."}var i=O[(s.scheme||a.scheme||"").toLowerCase()];if(!s.unicodeSupport&&(!i||!i.unicodeSupport)){if(a.host&&(s.domainHost||i&&i.domainHost)){try{a.host=N.toASCII(a.host.replace(n.PCT_ENCODED,pctDecChars).toLowerCase())}catch(e){a.error=a.error||"Host's domain name can not be converted to ASCII via punycode: "+e}}_normalizeComponentEncoding(a,t)}else{_normalizeComponentEncoding(a,n)}if(i&&i.parse){i.parse(a,s)}}else{a.error=a.error||"URI can not be parsed."}return a}function _recomposeAuthority(e,s){var a=s.iri!==false?r:t;var n=[];if(e.userinfo!==undefined){n.push(e.userinfo);n.push("@")}if(e.host!==undefined){n.push(_normalizeIPv6(_normalizeIPv4(String(e.host),a),a).replace(a.IPV6ADDRESS,(function(e,t,r){return"["+t+(r?"%25"+r:"")+"]"})))}if(typeof e.port==="number"){n.push(":");n.push(e.port.toString(10))}return n.length?n.join(""):undefined}var j=/^\.\.?\//;var I=/^\/\.(\/|$)/;var D=/^\/\.\.(\/|$)/;var A=/^\/?(?:.|\n)*?(?=\/|$)/;function removeDotSegments(e){var t=[];while(e.length){if(e.match(j)){e=e.replace(j,"")}else if(e.match(I)){e=e.replace(I,"/")}else if(e.match(D)){e=e.replace(D,"/");t.pop()}else if(e==="."||e===".."){e=""}else{var r=e.match(A);if(r){var s=r[0];e=e.slice(s.length);t.push(s)}else{throw new Error("Unexpected dot segment condition")}}}return t.join("")}function serialize(e){var s=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var a=s.iri?r:t;var n=[];var o=O[(s.scheme||e.scheme||"").toLowerCase()];if(o&&o.serialize)o.serialize(e,s);if(e.host){if(a.IPV6ADDRESS.test(e.host)){}else if(s.domainHost||o&&o.domainHost){try{e.host=!s.iri?N.toASCII(e.host.replace(a.PCT_ENCODED,pctDecChars).toLowerCase()):N.toUnicode(e.host)}catch(t){e.error=e.error||"Host's domain name can not be converted to "+(!s.iri?"ASCII":"Unicode")+" via punycode: "+t}}}_normalizeComponentEncoding(e,a);if(s.reference!=="suffix"&&e.scheme){n.push(e.scheme);n.push(":")}var i=_recomposeAuthority(e,s);if(i!==undefined){if(s.reference!=="suffix"){n.push("//")}n.push(i);if(e.path&&e.path.charAt(0)!=="/"){n.push("/")}}if(e.path!==undefined){var c=e.path;if(!s.absolutePath&&(!o||!o.absolutePath)){c=removeDotSegments(c)}if(i===undefined){c=c.replace(/^\/\//,"/%2F")}n.push(c)}if(e.query!==undefined){n.push("?");n.push(e.query)}if(e.fragment!==undefined){n.push("#");n.push(e.fragment)}return n.join("")}function resolveComponents(e,t){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var s=arguments[3];var a={};if(!s){e=parse(serialize(e,r),r);t=parse(serialize(t,r),r)}r=r||{};if(!r.tolerant&&t.scheme){a.scheme=t.scheme;a.userinfo=t.userinfo;a.host=t.host;a.port=t.port;a.path=removeDotSegments(t.path||"");a.query=t.query}else{if(t.userinfo!==undefined||t.host!==undefined||t.port!==undefined){a.userinfo=t.userinfo;a.host=t.host;a.port=t.port;a.path=removeDotSegments(t.path||"");a.query=t.query}else{if(!t.path){a.path=e.path;if(t.query!==undefined){a.query=t.query}else{a.query=e.query}}else{if(t.path.charAt(0)==="/"){a.path=removeDotSegments(t.path)}else{if((e.userinfo!==undefined||e.host!==undefined||e.port!==undefined)&&!e.path){a.path="/"+t.path}else if(!e.path){a.path=t.path}else{a.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path}a.path=removeDotSegments(a.path)}a.query=t.query}a.userinfo=e.userinfo;a.host=e.host;a.port=e.port}a.scheme=e.scheme}a.fragment=t.fragment;return a}function resolve(e,t,r){var s=assign({scheme:"null"},r);return serialize(resolveComponents(parse(e,s),parse(t,s),s,true),s)}function normalize(e,t){if(typeof e==="string"){e=serialize(parse(e,t),t)}else if(typeOf(e)==="object"){e=parse(serialize(e,t),t)}return e}function equal(e,t,r){if(typeof e==="string"){e=serialize(parse(e,r),r)}else if(typeOf(e)==="object"){e=serialize(e,r)}if(typeof t==="string"){t=serialize(parse(t,r),r)}else if(typeOf(t)==="object"){t=serialize(t,r)}return e===t}function escapeComponent(e,s){return e&&e.toString().replace(!s||!s.iri?t.ESCAPE:r.ESCAPE,pctEncChar)}function unescapeComponent(e,s){return e&&e.toString().replace(!s||!s.iri?t.PCT_ENCODED:r.PCT_ENCODED,pctDecChars)}var M={scheme:"http",domainHost:true,parse:function parse(e,t){if(!e.host){e.error=e.error||"HTTP URIs must have a host."}return e},serialize:function serialize(e,t){if(e.port===(String(e.scheme).toLowerCase()!=="https"?80:443)||e.port===""){e.port=undefined}if(!e.path){e.path="/"}return e}};var F={scheme:"https",domainHost:M.domainHost,parse:M.parse,serialize:M.serialize};var V={};var U=true;var z="[A-Za-z0-9\\-\\.\\_\\~"+(U?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]";var K="[0-9A-Fa-f]";var q=subexp(subexp("%[EFef]"+K+"%"+K+K+"%"+K+K)+"|"+subexp("%[89A-Fa-f]"+K+"%"+K+K)+"|"+subexp("%"+K+K));var L="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]";var H="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]";var G=merge(H,'[\\"\\\\]');var J="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]";var B=new RegExp(z,"g");var W=new RegExp(q,"g");var Z=new RegExp(merge("[^]",L,"[\\.]",'[\\"]',G),"g");var Q=new RegExp(merge("[^]",z,J),"g");var Y=Q;function decodeUnreserved(e){var t=pctDecChars(e);return!t.match(B)?e:t}var X={scheme:"mailto",parse:function parse$$1(e,t){var r=e;var s=r.to=r.path?r.path.split(","):[];r.path=undefined;if(r.query){var a=false;var n={};var o=r.query.split("&");for(var i=0,c=o.length;i{"use strict";e.exports=JSON.parse('{"$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON AnySchema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}')},9520:e=>{"use strict";e.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')}};var t={};function __nccwpck_require__(r){var s=t[r];if(s!==undefined){return s.exports}var a=t[r]={exports:{}};var n=true;try{e[r].call(a.exports,a,a.exports,__nccwpck_require__);n=false}finally{if(n)delete t[r]}return a.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(7097);module.exports=r})(); \ No newline at end of file diff --git a/packages/next/compiled/ajv/package.json b/packages/next/compiled/ajv/package.json deleted file mode 100644 index 15276ae218f0..000000000000 --- a/packages/next/compiled/ajv/package.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"ajv","main":"ajv.js","author":"Evgeny Poberezkin","license":"MIT"} diff --git a/packages/next/index.d.ts b/packages/next/index.d.ts index a73cb9959c1d..dd922052fa49 100644 --- a/packages/next/index.d.ts +++ b/packages/next/index.d.ts @@ -12,7 +12,6 @@ /// /// /// -/// export { default } from './types' export * from './types' diff --git a/packages/next/package.json b/packages/next/package.json index 85ccd9d6a7a5..9a870199107a 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -170,7 +170,6 @@ "@vercel/nft": "0.20.0", "acorn": "8.5.0", "ajv": "8.11.0", - "ajv-keywords": "5.1.0", "amphtml-validator": "1.0.35", "arg": "4.1.0", "assert": "2.0.0", diff --git a/packages/next/server/config-schema.ts b/packages/next/server/config-schema.ts new file mode 100644 index 000000000000..f9d18748f444 --- /dev/null +++ b/packages/next/server/config-schema.ts @@ -0,0 +1,609 @@ +import { NextConfig } from './config' +import type { JSONSchemaType } from 'ajv' +import { VALID_LOADERS } from '../shared/lib/image-config' + +const configSchema = { + type: 'object', + additionalProperties: false, + properties: { + amp: { + additionalProperties: false, + properties: { + canonicalBase: { + minLength: 1, + type: 'string', + }, + }, + type: 'object', + }, + assetPrefix: { + minLength: 1, + type: 'string', + }, + basePath: { + minLength: 1, + type: 'string', + }, + cleanDistDir: { + type: 'boolean', + }, + compiler: { + additionalProperties: false, + properties: { + emotion: { + oneOf: [ + { + type: 'boolean', + }, + { + type: 'object', + additionalProperties: false, + properties: { + sourceMap: { + type: 'boolean', + }, + autoLabel: { + type: 'string', + enum: ['always', 'dev-only', 'never'], + }, + labelFormat: { + type: 'string', + minLength: 1, + }, + }, + }, + ] as any, + }, + reactRemoveProperties: { + oneOf: [ + { + type: 'boolean', + }, + { + type: 'object', + additionalProperties: false, + properties: { + properties: { + type: 'array', + items: { + type: 'string', + }, + }, + }, + }, + ] as any, + }, + relay: { + additionalProperties: false, + properties: { + artifactDirectory: { + minLength: 1, + type: 'string', + }, + language: { + // automatic typing doesn't like enum + enum: ['flow', 'typescript'] as any, + type: 'string', + }, + src: { + minLength: 1, + type: 'string', + }, + }, + type: 'object', + }, + removeConsole: { + oneOf: [ + { + type: 'boolean', + }, + { + type: 'object', + additionalProperties: false, + properties: { + exclude: { + type: 'array', + items: { + type: 'string', + minLength: 1, + }, + }, + }, + }, + ] as any, + }, + styledComponents: { + oneOf: [ + { + type: 'boolean', + }, + { + type: 'object', + additionalProperties: false, + properties: { + displayName: { + type: 'boolean', + }, + topLevelImportPaths: { + type: 'array', + items: { + type: 'string', + minLength: 1, + }, + }, + ssr: { + type: 'boolean', + }, + fileName: { + type: 'boolean', + }, + meaninglessFileNames: { + type: 'boolean', + }, + minify: { + type: 'boolean', + }, + transpileTemplateLiterals: { + type: 'boolean', + }, + namespace: { + type: 'string', + minLength: 1, + }, + pure: { + type: 'boolean', + }, + cssProp: { + type: 'boolean', + }, + }, + }, + ] as any, + }, + }, + type: 'object', + }, + compress: { + type: 'boolean', + }, + crossOrigin: { + oneOf: [ + false, + { + enum: ['anonymous', 'use-credentials'], + type: 'string', + }, + ], // automatic typing does not like enum + } as any, + devIndicators: { + additionalProperties: false, + properties: { + buildActivity: { + type: 'boolean', + }, + buildActivityPosition: { + // automatic typing does not like enum + enum: ['bottom-left', 'bottom-right', 'top-left', 'top-right'] as any, + type: 'string', + }, + }, + type: 'object', + }, + distDir: { + minLength: 1, + type: 'string', + nullable: true, + }, + env: { + type: 'object', + }, + eslint: { + additionalProperties: false, + properties: { + dirs: { + items: { + minLength: 1, + type: 'string', + }, + type: 'array', + }, + ignoreDuringBuilds: { + type: 'boolean', + }, + }, + type: 'object', + }, + excludeDefaultMomentLocales: { + type: 'boolean', + }, + experimental: { + additionalProperties: false, + properties: { + amp: { + additionalProperties: false, + properties: { + optimizer: { + type: 'object', + }, + skipValidation: { + type: 'boolean', + }, + validator: { + type: 'string', + }, + }, + type: 'object', + }, + appDir: { + type: 'boolean', + }, + browsersListForSwc: { + type: 'boolean', + }, + cpus: { + type: 'number', + }, + craCompat: { + type: 'boolean', + }, + disableOptimizedLoading: { + type: 'boolean', + }, + disablePostcssPresetEnv: { + type: 'boolean', + }, + esmExternals: { + type: 'boolean', + }, + externalDir: { + type: 'boolean', + }, + forceSwcTransforms: { + type: 'boolean', + }, + fullySpecified: { + type: 'boolean', + }, + gzipSize: { + type: 'boolean', + }, + images: { + additionalProperties: false, + properties: { + allowFutureImage: { + type: 'boolean', + }, + remotePatterns: { + items: { + additionalProperties: false, + properties: { + hostname: { + minLength: 1, + type: 'string', + }, + pathname: { + minLength: 1, + type: 'string', + }, + port: { + minLength: 1, + type: 'string', + }, + protocol: { + // automatic typing doesn't like enum + enum: ['http', 'https'] as any, + type: 'string', + }, + }, + type: 'object', + }, + type: 'array', + }, + unoptimized: { + type: 'boolean', + }, + }, + type: 'object', + }, + incrementalCacheHandlerPath: { + type: 'string', + }, + isrFlushToDisk: { + type: 'boolean', + }, + isrMemoryCacheSize: { + type: 'number', + }, + largePageDataBytes: { + type: 'number', + }, + legacyBrowsers: { + type: 'boolean', + }, + manualClientBasePath: { + type: 'boolean', + }, + modularizeImports: { + type: 'object', + }, + newNextLinkBehavior: { + type: 'boolean', + }, + nextScriptWorkers: { + type: 'boolean', + }, + optimizeCss: { + type: 'boolean', + }, + outputFileTracingRoot: { + minLength: 1, + type: 'string', + }, + pageEnv: { + type: 'boolean', + }, + profiling: { + type: 'boolean', + }, + runtime: { + // automatic typing doesn't like enum + enum: ['experimental-edge', 'nodejs'] as any, + type: 'string', + }, + scrollRestoration: { + type: 'boolean', + }, + serverComponents: { + type: 'boolean', + }, + sharedPool: { + type: 'boolean', + }, + swcFileReading: { + type: 'boolean', + }, + swcMinify: { + type: 'boolean', + }, + swcMinifyDebugOptions: { + additionalProperties: false, + properties: { + compress: { + type: 'object', + }, + mangle: { + type: 'object', + }, + }, + type: 'object', + }, + swcPlugins: { + type: 'array', + }, + swcTraceProfiling: { + type: 'boolean', + }, + urlImports: { + items: { + type: 'string', + }, + type: 'array', + }, + workerThreads: { + type: 'boolean', + }, + }, + type: 'object', + }, + future: { + additionalProperties: false, + properties: {}, + type: 'object', + }, + generateBuildId: { + isFunction: true, + } as any, + generateEtags: { + isFunction: true, + } as any, + headers: { + isFunction: true, + } as any, + httpAgentOptions: { + additionalProperties: false, + properties: { + keepAlive: { + type: 'boolean', + }, + }, + type: 'object', + }, + i18n: { + additionalProperties: false, + properties: { + defaultLocale: { + minLength: 1, + type: 'string', + }, + domains: { + items: { + additionalProperties: false, + properties: { + defaultLocale: { + minLength: 1, + type: 'string', + }, + domain: { + minLength: 1, + type: 'string', + }, + http: { + type: 'boolean', + }, + locales: { + items: { + minLength: 1, + type: 'string', + }, + type: 'array', + }, + }, + type: 'object', + }, + type: 'array', + }, + localeDetection: { + type: 'boolean', + }, + locales: { + items: { + minLength: 1, + type: 'string', + }, + type: 'array', + }, + }, + type: 'object', + }, + images: { + additionalProperties: false, + properties: { + contentSecurityPolicy: { + minLength: 1, + type: 'string', + }, + dangerouslyAllowSVG: { + type: 'boolean', + }, + deviceSizes: { + items: { + type: 'number', + }, + minItems: 1, + type: 'array', + }, + disableStaticImages: { + type: 'boolean', + }, + domains: { + items: { + type: 'string', + }, + type: 'array', + }, + formats: { + items: { + enum: ['image/avif', 'image/webp'], // automatic typing does not like enum + type: 'string', + } as any, + type: 'array', + }, + imageSizes: { + items: { + type: 'number', + }, + minItems: 1, + type: 'array', + }, + loader: { + // automatic typing does not like enum + enum: VALID_LOADERS as any, + type: 'string', + }, + minimumCacheTTL: { + type: 'number', + }, + path: { + minLength: 1, + type: 'string', + }, + }, + type: 'object', + }, + onDemandEntries: { + additionalProperties: false, + properties: { + maxInactiveAge: { + type: 'number', + }, + pagesBufferLength: { + type: 'number', + }, + }, + type: 'object', + }, + optimizeFonts: { + type: 'boolean', + }, + output: { + // automatic typing doesn't like enum + enum: ['standalone'] as any, + type: 'string', + }, + outputFileTracing: { + type: 'boolean', + }, + pageExtensions: { + minItems: 1, + type: 'array', + }, + poweredByHeader: { + type: 'boolean', + }, + productionBrowserSourceMaps: { + type: 'boolean', + }, + publicRuntimeConfig: { + type: 'object', + }, + reactStrictMode: { + type: 'boolean', + }, + redirects: { + isFunction: true, + } as any, + rewrites: { + isFunction: true, + } as any, + sassOptions: { + type: 'object', + }, + serverRuntimeConfig: { + type: 'object', + }, + staticPageGenerationTimeout: { + type: 'number', + }, + swcMinify: { + type: 'boolean', + }, + trailingSlash: { + type: 'boolean', + }, + typescript: { + additionalProperties: false, + properties: { + ignoreBuildErrors: { + type: 'boolean', + }, + tsconfigPath: { + minLength: 1, + type: 'string', + }, + }, + type: 'object', + }, + useFileSystemPublicRoutes: { + type: 'boolean', + }, + webpack: { + isFunction: true, + } as any, + }, +} as JSONSchemaType + +// module.exports is used to get around an export bug with TypeScript +// and the Ajv automatic typing +module.exports = { + configSchema, +} diff --git a/packages/next/server/config-shared.ts b/packages/next/server/config-shared.ts index e835c4492922..5eff9fb6359f 100644 --- a/packages/next/server/config-shared.ts +++ b/packages/next/server/config-shared.ts @@ -1,7 +1,4 @@ import os from 'os' -import Ajv from 'next/dist/compiled/ajv' -import ajvKeywords from 'next/dist/compiled/ajv-keywords' -import { JSONSchemaType } from 'next/dist/compiled/ajv' import type { webpack5 } from 'next/dist/compiled/webpack/webpack' import { Header, Redirect, Rewrite } from '../lib/load-custom-routes' import { @@ -9,7 +6,6 @@ import { ImageConfigComplete, imageConfigDefault, RemotePattern, - VALID_LOADERS, } from '../shared/lib/image-config' export type ServerRuntime = 'nodejs' | 'experimental-edge' | undefined @@ -570,613 +566,12 @@ export function isServerRuntime(value?: string): value is ServerRuntime { ) } -const configSchema = { - type: 'object', - additionalProperties: false, - properties: { - amp: { - additionalProperties: false, - properties: { - canonicalBase: { - minLength: 1, - type: 'string', - }, - }, - type: 'object', - }, - assetPrefix: { - minLength: 1, - type: 'string', - }, - basePath: { - minLength: 1, - type: 'string', - }, - cleanDistDir: { - type: 'boolean', - }, - compiler: { - additionalProperties: false, - properties: { - emotion: { - oneOf: [ - { - type: 'boolean', - }, - { - type: 'object', - additionalProperties: false, - properties: { - sourceMap: { - type: 'boolean', - }, - autoLabel: { - type: 'string', - enum: ['always', 'dev-only', 'never'], - }, - labelFormat: { - type: 'string', - minLength: 1, - }, - }, - }, - ] as any, - }, - reactRemoveProperties: { - oneOf: [ - { - type: 'boolean', - }, - { - type: 'object', - additionalProperties: false, - properties: { - properties: { - type: 'array', - items: { - type: 'string', - }, - }, - }, - }, - ] as any, - }, - relay: { - additionalProperties: false, - properties: { - artifactDirectory: { - minLength: 1, - type: 'string', - }, - language: { - // automatic typing doesn't like enum - enum: ['flow', 'typescript'] as any, - type: 'string', - }, - src: { - minLength: 1, - type: 'string', - }, - }, - type: 'object', - }, - removeConsole: { - oneOf: [ - { - type: 'boolean', - }, - { - type: 'object', - additionalProperties: false, - properties: { - exclude: { - type: 'array', - items: { - type: 'string', - minLength: 1, - }, - }, - }, - }, - ] as any, - }, - styledComponents: { - oneOf: [ - { - type: 'boolean', - }, - { - type: 'object', - additionalProperties: false, - properties: { - displayName: { - type: 'boolean', - }, - topLevelImportPaths: { - type: 'array', - items: { - type: 'string', - minLength: 1, - }, - }, - ssr: { - type: 'boolean', - }, - fileName: { - type: 'boolean', - }, - meaninglessFileNames: { - type: 'boolean', - }, - minify: { - type: 'boolean', - }, - transpileTemplateLiterals: { - type: 'boolean', - }, - namespace: { - type: 'string', - minLength: 1, - }, - pure: { - type: 'boolean', - }, - cssProp: { - type: 'boolean', - }, - }, - }, - ] as any, - }, - }, - type: 'object', - }, - compress: { - type: 'boolean', - }, - crossOrigin: { - oneOf: [ - false, - { - enum: ['anonymous', 'use-credentials'], - type: 'string', - }, - ], // automatic typing does not like enum - } as any, - devIndicators: { - additionalProperties: false, - properties: { - buildActivity: { - type: 'boolean', - }, - buildActivityPosition: { - // automatic typing does not like enum - enum: ['bottom-left', 'bottom-right', 'top-left', 'top-right'] as any, - type: 'string', - }, - }, - type: 'object', - }, - distDir: { - minLength: 1, - type: 'string', - nullable: true, - }, - env: { - type: 'object', - }, - eslint: { - additionalProperties: false, - properties: { - dirs: { - items: { - minLength: 1, - type: 'string', - }, - type: 'array', - }, - ignoreDuringBuilds: { - type: 'boolean', - }, - }, - type: 'object', - }, - excludeDefaultMomentLocales: { - type: 'boolean', - }, - experimental: { - additionalProperties: false, - properties: { - amp: { - additionalProperties: false, - properties: { - optimizer: { - type: 'object', - }, - skipValidation: { - type: 'boolean', - }, - validator: { - type: 'string', - }, - }, - type: 'object', - }, - appDir: { - type: 'boolean', - }, - browsersListForSwc: { - type: 'boolean', - }, - cpus: { - type: 'number', - }, - craCompat: { - type: 'boolean', - }, - disableOptimizedLoading: { - type: 'boolean', - }, - disablePostcssPresetEnv: { - type: 'boolean', - }, - esmExternals: { - type: 'boolean', - }, - externalDir: { - type: 'boolean', - }, - forceSwcTransforms: { - type: 'boolean', - }, - fullySpecified: { - type: 'boolean', - }, - gzipSize: { - type: 'boolean', - }, - images: { - additionalProperties: false, - properties: { - allowFutureImage: { - type: 'boolean', - }, - remotePatterns: { - items: { - additionalProperties: false, - properties: { - hostname: { - minLength: 1, - type: 'string', - }, - pathname: { - minLength: 1, - type: 'string', - }, - port: { - minLength: 1, - type: 'string', - }, - protocol: { - // automatic typing doesn't like enum - enum: ['http', 'https'] as any, - type: 'string', - }, - }, - type: 'object', - }, - type: 'array', - }, - unoptimized: { - type: 'boolean', - }, - }, - type: 'object', - }, - incrementalCacheHandlerPath: { - type: 'string', - }, - isrFlushToDisk: { - type: 'boolean', - }, - isrMemoryCacheSize: { - type: 'number', - }, - largePageDataBytes: { - type: 'number', - }, - legacyBrowsers: { - type: 'boolean', - }, - manualClientBasePath: { - type: 'boolean', - }, - modularizeImports: { - type: 'object', - }, - newNextLinkBehavior: { - type: 'boolean', - }, - nextScriptWorkers: { - type: 'boolean', - }, - optimizeCss: { - type: 'boolean', - }, - outputFileTracingRoot: { - minLength: 1, - type: 'string', - }, - pageEnv: { - type: 'boolean', - }, - profiling: { - type: 'boolean', - }, - runtime: { - // automatic typing doesn't like enum - enum: ['experimental-edge', 'nodejs'] as any, - type: 'string', - }, - scrollRestoration: { - type: 'boolean', - }, - serverComponents: { - type: 'boolean', - }, - sharedPool: { - type: 'boolean', - }, - swcFileReading: { - type: 'boolean', - }, - swcMinify: { - type: 'boolean', - }, - swcMinifyDebugOptions: { - additionalProperties: false, - properties: { - compress: { - type: 'object', - }, - mangle: { - type: 'object', - }, - }, - type: 'object', - }, - swcPlugins: { - type: 'array', - }, - swcTraceProfiling: { - type: 'boolean', - }, - urlImports: { - items: { - type: 'string', - }, - type: 'array', - }, - workerThreads: { - type: 'boolean', - }, - }, - type: 'object', - }, - future: { - additionalProperties: false, - properties: {}, - type: 'object', - }, - generateBuildId: { - instanceof: 'Function', - } as any, - generateEtags: { - instanceof: 'Function', - } as any, - headers: { - instanceof: 'Function', - } as any, - httpAgentOptions: { - additionalProperties: false, - properties: { - keepAlive: { - type: 'boolean', - }, - }, - type: 'object', - }, - i18n: { - additionalProperties: false, - properties: { - defaultLocale: { - minLength: 1, - type: 'string', - }, - domains: { - items: { - additionalProperties: false, - properties: { - defaultLocale: { - minLength: 1, - type: 'string', - }, - domain: { - minLength: 1, - type: 'string', - }, - http: { - type: 'boolean', - }, - locales: { - items: { - minLength: 1, - type: 'string', - }, - type: 'array', - }, - }, - type: 'object', - }, - type: 'array', - }, - localeDetection: { - type: 'boolean', - }, - locales: { - items: { - minLength: 1, - type: 'string', - }, - type: 'array', - }, - }, - type: 'object', - }, - images: { - additionalProperties: false, - properties: { - contentSecurityPolicy: { - minLength: 1, - type: 'string', - }, - dangerouslyAllowSVG: { - type: 'boolean', - }, - deviceSizes: { - items: { - type: 'number', - }, - minItems: 1, - type: 'array', - }, - disableStaticImages: { - type: 'boolean', - }, - domains: { - items: { - type: 'string', - }, - type: 'array', - }, - formats: { - items: { - enum: ['image/avif', 'image/webp'], // automatic typing does not like enum - type: 'string', - } as any, - type: 'array', - }, - imageSizes: { - items: { - type: 'number', - }, - minItems: 1, - type: 'array', - }, - loader: { - // automatic typing does not like enum - enum: VALID_LOADERS as any, - type: 'string', - }, - minimumCacheTTL: { - type: 'number', - }, - path: { - minLength: 1, - type: 'string', - }, - }, - type: 'object', - }, - onDemandEntries: { - additionalProperties: false, - properties: { - maxInactiveAge: { - type: 'number', - }, - pagesBufferLength: { - type: 'number', - }, - }, - type: 'object', - }, - optimizeFonts: { - type: 'boolean', - }, - output: { - // automatic typing doesn't like enum - enum: ['standalone'] as any, - type: 'string', - }, - outputFileTracing: { - type: 'boolean', - }, - pageExtensions: { - minItems: 1, - type: 'array', - }, - poweredByHeader: { - type: 'boolean', - }, - productionBrowserSourceMaps: { - type: 'boolean', - }, - publicRuntimeConfig: { - type: 'object', - }, - reactStrictMode: { - type: 'boolean', - }, - redirects: { - instanceof: 'Function', - } as any, - rewrites: { - instanceof: 'Function', - } as any, - sassOptions: { - type: 'object', - }, - serverRuntimeConfig: { - type: 'object', - }, - staticPageGenerationTimeout: { - type: 'number', - }, - swcMinify: { - type: 'boolean', - }, - trailingSlash: { - type: 'boolean', - }, - typescript: { - additionalProperties: false, - properties: { - ignoreBuildErrors: { - type: 'boolean', - }, - tsconfigPath: { - minLength: 1, - type: 'string', - }, - }, - type: 'object', - }, - useFileSystemPublicRoutes: { - type: 'boolean', - }, - webpack: { - instanceof: 'Function', - } as any, - }, -} as JSONSchemaType - export function validateConfig(userConfig: NextConfig): { errors?: Array | null } { - const ajv = new Ajv({ allErrors: true }) - ajvKeywords(ajv, ['instanceof']) - ajv.validate(configSchema, userConfig) + const configValidator = require('next/dist/next-config-validate.js') + configValidator(userConfig) return { - errors: ajv.errors, + errors: configValidator.errors, } } diff --git a/packages/next/taskfile.js b/packages/next/taskfile.js index 0e635bf93161..ca6a5362c04b 100644 --- a/packages/next/taskfile.js +++ b/packages/next/taskfile.js @@ -177,19 +177,35 @@ export async function ncc_node_fetch(task, opts) { } // eslint-disable-next-line camelcase -export async function ncc_ajv(task, opts) { - await task - .source(opts.src || relative(__dirname, require.resolve('ajv'))) - .ncc({ packageName: 'ajv', externals }) - .target('compiled/ajv') -} +export async function compile_config_schema(task, opts) { + const { configSchema } = require('./dist/server/config-schema') + // eslint-disable-next-line + const Ajv = require('ajv') + // eslint-disable-next-line + const standaloneCode = require('ajv/dist/standalone').default + // eslint-disable-next-line + const ajv = new Ajv({ code: { source: true }, allErrors: true }) + ajv.addKeyword({ + keyword: 'isFunction', + schemaType: 'boolean', + compile() { + return (data) => data instanceof Function + }, + code(ctx) { + const { data } = ctx + ctx.fail(Ajv._`!(${data} instanceof Function)`) + }, + metaSchema: { + anyOf: [{ type: 'boolean' }], + }, + }) -// eslint-disable-next-line camelcase -export async function ncc_ajv_keywords(task, opts) { - await task - .source(opts.src || relative(__dirname, require.resolve('ajv-keywords'))) - .ncc({ packageName: 'ajv-keywords', externals }) - .target('compiled/ajv-keywords') + const compiled = ajv.compile(configSchema) + const validateCode = standaloneCode(ajv, compiled) + await fs.writeFile( + join(__dirname, 'dist', 'next-config-validate.js'), + validateCode + ) } // eslint-disable-next-line camelcase @@ -1724,8 +1740,6 @@ export async function ncc(task, opts) { 'ncc_hapi_accept', 'ncc_node_fetch', 'ncc_acorn', - 'ncc_ajv', - 'ncc_ajv_keywords', 'ncc_amphtml_validator', 'ncc_arg', 'ncc_async_retry', @@ -1971,7 +1985,7 @@ export async function trace(task, opts) { } export async function build(task, opts) { - await task.serial(['precompile', 'compile'], opts) + await task.serial(['precompile', 'compile', 'compile_config_schema'], opts) } export default async function (task) { diff --git a/packages/next/tsconfig.json b/packages/next/tsconfig.json index 62e323988175..b023d7fb53c5 100644 --- a/packages/next/tsconfig.json +++ b/packages/next/tsconfig.json @@ -8,11 +8,5 @@ "moduleResolution": "node", "jsx": "react" }, - "exclude": [ - "dist", - "./*.d.ts", - "future/*.d.ts", - "image-types/global.d.ts", - "types/compiled.d.ts" - ] + "exclude": ["dist", "./*.d.ts", "future/*.d.ts", "image-types/global.d.ts"] } diff --git a/packages/next/types/compiled.d.ts b/packages/next/types/compiled.d.ts deleted file mode 100644 index 423080f42961..000000000000 --- a/packages/next/types/compiled.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -declare module 'next/dist/compiled/ajv' { - // eslint-disable-next-line - export type JSONSchemaType = any - function Ajv(..._args: any[]): void - export default Ajv -} -declare module 'next/dist/compiled/ajv-keywords' diff --git a/packages/next/types/misc.d.ts b/packages/next/types/misc.d.ts index 76aa3cb2c0f0..641cc7069d5d 100644 --- a/packages/next/types/misc.d.ts +++ b/packages/next/types/misc.d.ts @@ -32,18 +32,6 @@ declare module 'next/dist/compiled/jest-worker' { export * from 'jest-worker' } -declare module 'next/dist/compiled/ajv' { - import ajv from 'ajv' - export default ajv - export * from 'ajv' -} - -declare module 'next/dist/compiled/ajv-keywords' { - import ajvKeywords from 'ajv-keywords' - export default ajvKeywords - export * from 'ajv-keywords' -} - declare module 'next/dist/compiled/react-is' { export * from 'react-is' } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f09e0dfedec4..c3cf4d4e6213 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -469,7 +469,6 @@ importers: '@vercel/nft': 0.20.0 acorn: 8.5.0 ajv: 8.11.0 - ajv-keywords: 5.1.0 amphtml-validator: 1.0.35 arg: 4.1.0 assert: 2.0.0 @@ -663,7 +662,6 @@ importers: '@vercel/nft': 0.20.0 acorn: 8.5.0 ajv: 8.11.0 - ajv-keywords: 5.1.0_ajv@8.11.0 amphtml-validator: 1.0.35 arg: 4.1.0 assert: 2.0.0 @@ -6650,15 +6648,6 @@ packages: ajv: 6.12.6 dev: true - /ajv-keywords/5.1.0_ajv@8.11.0: - resolution: {integrity: sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==} - peerDependencies: - ajv: ^8.8.2 - dependencies: - ajv: 8.11.0 - fast-deep-equal: 3.1.3 - dev: true - /ajv/6.12.6: resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} dependencies: @@ -6667,6 +6656,14 @@ packages: json-schema-traverse: 0.4.1 uri-js: 4.2.2 + /ajv/8.1.0: + resolution: {integrity: sha512-B/Sk2Ix7A36fs/ZkuGLIR86EdjbgR6fsAcbx9lOP/QBSXujDNbVmIS/U4Itz5k8fPFDeVZl/zQ/gJW4Jrq6XjQ==} + dependencies: + fast-deep-equal: 3.1.3 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + uri-js: 4.2.2 + /ajv/8.11.0: resolution: {integrity: sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==} dependencies: @@ -6674,6 +6671,7 @@ packages: json-schema-traverse: 1.0.0 require-from-string: 2.0.2 uri-js: 4.2.2 + dev: true /alex/9.1.0: resolution: {integrity: sha512-mlNQ0CBGinzZj1pjiXaSLsihjZ4Kzq0U0EjR+DrZ3IQQfM4pf4OtxHI1agBIiEwv0tQUzimjgTk+5t9iHeT7Vw==} @@ -7742,7 +7740,7 @@ packages: mississippi: 3.0.0 mkdirp: 0.5.5 move-concurrently: 1.0.1 - promise-inflight: 1.0.1_bluebird@3.7.2 + promise-inflight: 1.0.1 rimraf: 2.7.1 ssri: 6.0.1 unique-filename: 1.1.1 @@ -18150,17 +18148,6 @@ packages: optional: true dev: true - /promise-inflight/1.0.1_bluebird@3.7.2: - resolution: {integrity: sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==} - peerDependencies: - bluebird: '*' - peerDependenciesMeta: - bluebird: - optional: true - dependencies: - bluebird: 3.7.2 - dev: true - /promise-polyfill/6.1.0: resolution: {integrity: sha512-g0LWaH0gFsxovsU7R5LrrhHhWAWiHRnh1GPrhXnPgYsDkIqjRYUYSZEsej/wtleDrz5xVSIDbeKfidztp2XHFQ==} dev: true @@ -20654,7 +20641,7 @@ packages: resolution: {integrity: sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA==} engines: {node: '>=10.0.0'} dependencies: - ajv: 8.11.0 + ajv: 8.1.0 lodash.truncate: 4.4.2 slice-ansi: 4.0.0 string-width: 4.2.3 @@ -20802,7 +20789,7 @@ packages: worker-farm: 1.7.0 dev: true - /terser-webpack-plugin/5.2.4: + /terser-webpack-plugin/5.2.4_webpack@5.73.0: resolution: {integrity: sha512-E2CkNMN+1cho04YpdANyRrn8CyN4yMy+WdFKZIySFZrGXZxJwJP6PMNGGc/Mcr6qygQHUUqRxnAPmi0M9f00XA==} engines: {node: '>= 10.13.0'} peerDependencies: @@ -20824,6 +20811,7 @@ packages: serialize-javascript: 6.0.0 source-map: 0.6.1 terser: 5.10.0 + webpack: 5.73.0 dev: true /terser/4.8.0: @@ -21877,7 +21865,7 @@ packages: requiresBuild: true /util-deprecate/1.0.2: - resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + resolution: {integrity: sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=} dev: true /util-promisify/2.1.0: @@ -22252,7 +22240,7 @@ packages: neo-async: 2.6.2 schema-utils: 3.1.1 tapable: 2.2.0 - terser-webpack-plugin: 5.2.4 + terser-webpack-plugin: 5.2.4_webpack@5.73.0 watchpack: 2.4.0 webpack-sources: 3.2.3 transitivePeerDependencies: diff --git a/test/integration/config-validation/test/index.test.ts b/test/integration/config-validation/test/index.test.ts index 451bf0f95203..276998f9a9f1 100644 --- a/test/integration/config-validation/test/index.test.ts +++ b/test/integration/config-validation/test/index.test.ts @@ -22,7 +22,7 @@ describe('next.config.js validation', () => { 'must be equal to one of the allowed values', 'imgix', '/rewrites', - 'must pass \\"instanceof\\" keyword validation', + 'must pass \\"isFunction\\" keyword validation', '/swcMinify', 'must be boolean', ], From 6d5b206455f96207a80081656391317b13e3724b Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Mon, 11 Jul 2022 13:54:14 -0500 Subject: [PATCH 6/8] ensure validate output is ncced --- packages/next/taskfile.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/next/taskfile.js b/packages/next/taskfile.js index ca6a5362c04b..9d0fcc8f81b7 100644 --- a/packages/next/taskfile.js +++ b/packages/next/taskfile.js @@ -202,10 +202,19 @@ export async function compile_config_schema(task, opts) { const compiled = ajv.compile(configSchema) const validateCode = standaloneCode(ajv, compiled) - await fs.writeFile( - join(__dirname, 'dist', 'next-config-validate.js'), - validateCode + const preNccFilename = join(__dirname, 'dist', 'next-config-validate.js') + await fs.writeFile(preNccFilename, validateCode) + await task + .source(opts.src || './dist/next-config-validate.js') + .ncc({}) + .target('dist/next-config-validate') + + await fs.unlink(preNccFilename) + await fs.rename( + join(__dirname, 'dist/next-config-validate/next-config-validate.js'), + join(__dirname, 'dist/next-config-validate.js') ) + await fs.rmdir(join(__dirname, 'dist/next-config-validate')) } // eslint-disable-next-line camelcase From 99d0266318412ae6a44bc7908ea5bac94d4f064a Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Wed, 13 Jul 2022 10:31:29 -0500 Subject: [PATCH 7/8] Apply suggestions from code review Co-authored-by: Steven --- errors/invalid-next-config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/errors/invalid-next-config.md b/errors/invalid-next-config.md index efe53f762654..ef3a266ced95 100644 --- a/errors/invalid-next-config.md +++ b/errors/invalid-next-config.md @@ -10,4 +10,4 @@ Fixing the listed config errors will remove this warning. You can also leverage ### Useful Links -- [`next.config.js` types](https://github.com/vercel/next.js/blob/canary/packages/next/server/config-shared.ts) +- [`next.config.js`](https://nextjs.org/docs/api-reference/next.config.js/introduction) From e8d4a8353c4b22b09840dac73f07ae7f5e860514 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Wed, 13 Jul 2022 10:32:47 -0500 Subject: [PATCH 8/8] Add example of typing next.config.js --- errors/invalid-next-config.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/errors/invalid-next-config.md b/errors/invalid-next-config.md index ef3a266ced95..ffe6a08e491c 100644 --- a/errors/invalid-next-config.md +++ b/errors/invalid-next-config.md @@ -8,6 +8,17 @@ In your `next.config.js` file you passed invalid options that either are the inc Fixing the listed config errors will remove this warning. You can also leverage the `NextConfig` type by importing from `next` to help ensure your config is correct. +```ts +/** + * @type {import('next').NextConfig} + */ +const nextConfig = { + /* config options here */ +} + +module.exports = nextConfig +``` + ### Useful Links - [`next.config.js`](https://nextjs.org/docs/api-reference/next.config.js/introduction)