@texaryn/schema-json 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +2 -2
  3. package/THIRD-PARTY-NOTICES.md +3 -2
  4. package/dist/adapter.d.ts.map +1 -1
  5. package/dist/adapter.js +0 -2
  6. package/dist/adapter.js.map +1 -1
  7. package/dist/bare-maps.d.ts +1 -1
  8. package/dist/bare-maps.d.ts.map +1 -1
  9. package/dist/bare-maps.js.map +1 -1
  10. package/dist/identity.d.ts +1 -1
  11. package/dist/identity.d.ts.map +1 -1
  12. package/dist/identity.js.map +1 -1
  13. package/dist/metaschemas/2019-09.d.ts +1 -1
  14. package/dist/metaschemas/2019-09.d.ts.map +1 -1
  15. package/dist/metaschemas/2020-12.d.ts +1 -1
  16. package/dist/metaschemas/2020-12.d.ts.map +1 -1
  17. package/dist/metaschemas/draft-07.d.ts +1 -1
  18. package/dist/metaschemas/draft-07.d.ts.map +1 -1
  19. package/dist/metaschemas/index.d.ts +1 -1
  20. package/dist/metaschemas/index.d.ts.map +1 -1
  21. package/dist/projection-validation-coherence.d.ts +1 -1
  22. package/dist/projection-validation-coherence.d.ts.map +1 -1
  23. package/dist/projection-validation-coherence.js.map +1 -1
  24. package/dist/projection.d.ts +1 -1
  25. package/dist/projection.d.ts.map +1 -1
  26. package/dist/projection.js +38 -7
  27. package/dist/projection.js.map +1 -1
  28. package/dist/submission-projection.d.ts +1 -1
  29. package/dist/submission-projection.d.ts.map +1 -1
  30. package/dist/submission-projection.js +19 -3
  31. package/dist/submission-projection.js.map +1 -1
  32. package/dist/vendor/json-schema-library/index.mjs +1 -1
  33. package/dist/vendor/json-schema-library/index.mjs.map +1 -1
  34. package/dist/vendor/json-schema-library/rolldown-runtime-D9-fqq9M.mjs +1 -0
  35. package/package.json +2 -3
  36. package/dist/root-reference.d.ts +0 -4
  37. package/dist/root-reference.d.ts.map +0 -1
  38. package/dist/root-reference.js +0 -86
  39. package/dist/root-reference.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{copy as e}from"fast-copy";import{get as t,join as n,split as r}from"@sagold/json-pointer";import{resolve as i}from"uri-js";import{isWebUri as a}from"valid-url";import o from"fast-deep-equal";function s(e,t=[]){if(!Array.isArray(e))return e===void 0?[]:[e];for(let n of e)Array.isArray(n)?s(n,t):(Ae(n)||n instanceof Promise)&&t.push(n);return t}var c={DECLARATOR_ONEOF:`oneOfProperty`,propertyBlacklist:[`_id`],DYNAMIC_PROPERTIES:[`$ref`,`$defs`,`if`,`then`,`else`,`allOf`,`anyOf`,`oneOf`,`dependentSchemas`,`dependentRequired`,`definitions`,`dependencies`,`patternProperties`,`propertyDependencies`],REGEX_FLAGS:`u`,VALID_ANNOTATION_KEYWORDS:[`$id`,`$schema`,`title`,`description`,`default`,`oneOfProperty`],PROPERTIES_TO_MERGE:[`title`,`description`,`default`,`options`,`x-options`,`readOnly`,`writeOnly`]};const l=Object.prototype.toString;function u(e){let t=l.call(e).slice(8,-1).toLowerCase();return t===`file`?`object`:t}function d(e){return u(e)===`object`}function f(e){let t=e===void 0?{}:{type:u(e)};return t.type===`object`&&d(e)&&(t.properties={},Object.keys(e).forEach(n=>t.properties[n]=f(e[n]))),t.type===`array`&&Array.isArray(e)&&(e.length===1?t.items=f(e[0]):(t.items=e.map(f),t.items.find(e=>e.type!==t.items[0].type)??(t.items=t.items[0]))),t}function ee(e,t){t!=null&&Object.values(t).forEach(t=>p(t,e))}function te(e,t){t?.forEach(t=>p(t,e))}function p(e,t=[]){return b(e)?(t.push(e),ee(t,e.$defs),e.additionalProperties&&p(e.additionalProperties,t),te(t,e.allOf),te(t,e.anyOf),e.contains&&p(e.contains,t),ee(t,e.dependentSchemas),e.if&&p(e.if,t),e.else&&p(e.else,t),e.then&&p(e.then,t),e.items&&p(e.items,t),te(t,e.prefixItems),e.not&&p(e.not,t),te(t,e.oneOf),e.patternProperties&&Object.values(e.patternProperties).forEach(({node:e})=>p(e,t)),ee(t,e.properties),e.propertyNames&&p(e.propertyNames,t),e.unevaluatedProperties&&p(e.unevaluatedProperties,t),e.unevaluatedItems&&p(e.unevaluatedItems,t),t):t}const ne=/(#)+$/,re=/#$/,ie=/^[^:]+:\/\/[^/]+\//,ae=/#.*$/;function m(e,t){return t==null?e?.replace(re,``)??`#`:e==null||e===`#`?t?.replace(re,``):t[0]===`#`?e[0]===`/`?t:`${e.replace(ae,``)}${t.replace(ne,``)}`:ie.test(t)?t.replace(re,``):i(e,t??``)??`#`}function h(e,t,...n){if(t?.type===`error`)return t;if(e?.type===`error`||u(e)!==u(t))return e;let r=oe(e,t);for(let e of n)delete r[e];return r}function oe(e,t,n){if(d(e)&&d(t)){let n={};return[...Object.keys(e),...Object.keys(t)].filter((e,t,n)=>n.indexOf(e)===t).forEach(r=>n[r]=oe(e[r],t[r],r)),n}let r=Array.isArray(e),i=Array.isArray(t);if(r&&i){if(n===`required`||n===`anyOf`)return e.concat(t).filter((e,t,n)=>n.indexOf(e)===t);if(n===`items`||n===`prefixItems`){let n=[];for(let r=0;r<t.length;r+=1)d(e[r])&&d(t[r])&&e[r].type===t[r].type?n[r]=oe(e[r],t[r]):n.push(t[r]??e[r]);return n}let r=[],i=[];for(let n=0;n<Math.max(e.length,t.length);n+=1)d(e[n])&&d(t[n])?r[n]=oe(e[n],t[n]):e[n]!==void 0&&t[n]!==void 0?(r[n]=e[n],i.push(t[n])):e[n]===void 0?t[n]!==void 0&&i.push(t[n]):r[n]=e[n];return[...r,...i].filter((e,t,n)=>n.indexOf(e)===t)}if(n===`type`&&(r||i)){if(r&&e.includes(t))return t;if(i&&t.includes(e))return e;if(r)return[...e,t];if(i)return[...t,e]}return i?t:r||t===void 0?e:t}function se(e,t){return(t.order??0)-(e.order??0)}function ce(e,t,n){if(e==null||n.indexOf(e)!==t)return!1;let r=e.toJSON?.()??e.name;return n.find((e,n)=>(e.toJSON?.()??e.name)===r&&n===t)}function le(e,t){if(e==null||t==null)return t||e;let n={};return[...Object.keys(e),...Object.keys(t)].filter((e,t,n)=>n.indexOf(e)===t).forEach(r=>{let i=g(e[r],t[r]);b(i)&&(n[r]=i)}),n}function ue(e,t){return e==null||t==null?t||e:e.concat(t).filter((e,t,n)=>n.indexOf(e)===t)}function de(e,t){if(e==null||t==null)return e||t;let n=[...e],r=e.map(e=>e.node.evaluationPath);return t.forEach(e=>{r.includes(e.node.evaluationPath)||n.push(e)}),n}function g(e,t,...n){if(e==null||t==null)return e||t;let r={};e.items&&t.prefixItems||e.prefixItems&&t.items?t.prefixItems?r.prefixItems=t.prefixItems:r.items=t.items:(r.prefixItems=t.prefixItems??e.prefixItems,r.items=g(e.items,t.items));let i={...e,...t,...r,dynamicId:we(e.dynamicId,t.dynamicId),oneOfIndex:e.oneOfIndex??t.oneOfIndex,schema:h(e.schema,t.schema,...n),parent:e.parent,resolvers:e.resolvers.concat(t.resolvers).filter(ce).sort(se),reducers:e.reducers.concat(t.reducers).filter(ce).sort(se),validators:e.validators.concat(t.validators).filter(ce).sort(se),additionalProperties:g(e.additionalProperties,t.additionalProperties),contains:g(e.contains,t.contains),enum:ue(e.enum,t.enum),if:g(e.if,t.if),then:g(e.then,t.then),else:g(e.else,t.else),not:g(e.not,t.not),propertyNames:g(e.propertyNames,t.propertyNames),unevaluatedProperties:g(e.unevaluatedProperties,t.unevaluatedProperties),unevaluatedItems:g(e.unevaluatedItems,t.unevaluatedItems),$defs:le(e.$defs,t.$defs),patternProperties:de(e.patternProperties,t.patternProperties),properties:le(e.properties,t.properties),required:ue(e.required,t.required)};function a(e){let t=e.toJSON?.()??e.name;return i.schema?.[t]===void 0?(i[t]=void 0,!1):!0}return n?.forEach(e=>i[e]=void 0),i.resolvers=i.resolvers.filter(a),i.reducers=i.reducers.filter(a),i.validators=i.validators.filter(a),i}function fe(e,...t){let n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}function pe(e,...t){if(!d(e)||t.length===0)return e;let n={};return t.forEach(t=>{e[t]!==void 0&&(n[t]=e[t])}),n}function me(e,t={}){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>{let r=t[n];return r==null?``:typeof r==`object`?JSON.stringify(r):String(r)})}function _(e,t,n,r){if(C(e))return[e];r.push({pointer:n,node:e});let i=e.schema;if(i===!0)return[];if(i===!1)return[e.createError(`invalid-data-error`,{value:t,pointer:n,schema:e.schema})];let a=[];for(let i of e.validators){let o=i({node:e,data:t,pointer:n,path:r});Array.isArray(o)?a.push(...o):o&&a.push(o)}return s(a)}const he=Object.prototype.hasOwnProperty,v=(e,t)=>!(e[t]===void 0||!he.call(e,t));function y(e,t){if(d(e)&&v(e,`${t}`)||Array.isArray(e))return e[t]}function ge(e,t,n={}){n.path=n.path??[],n.withSchemaWarning=n.withSchemaWarning??!1,n.pointer=n.pointer??`#`;let i=this,a=r(e);if(a.length===0){let e=i.resolveRef(n);return C(e)?{node:void 0,error:e}:{node:e,error:void 0}}let o=`#`,s=i;for(let e=0,r=a.length;e<r;e+=1){o=`${o}/${a[e]}`;let r=s.getNodeChild(a[e],t,{...n,pointer:o});if(r.error||r.node==null)return r;s=r.node,t=y(t,a[e])}let{node:c,error:l}=s.resolveRef(n).reduceNode(t);return C(l)?{node:void 0,error:l}:b(c)?{node:c,error:void 0}:{error:void 0}}function _e(e,t,n={}){n.path=n.path??[],n.withSchemaWarning=n.withSchemaWarning??!1,n.pointer=n.pointer??`#`;let{path:r,pointer:i}=n,a=this;if(a.reducers.length){let n=a.reduceNode(t,{key:e,path:r,pointer:i});if(n.error)return n;b(n.node)&&(a=n.node)}for(let n of a.resolvers){let o=n({data:t,key:e,node:a});if(C(o))return{node:void 0,error:o};if(b(o))return{node:o.resolveRef({pointer:i,path:r}),error:void 0}}return n.createSchema===!0?{node:a.compileSchema(a.createSchema(y(t,e)),`${a.evaluationPath}/additional`,`${a.schemaLocation}/additional`),error:void 0}:n.withSchemaWarning===!0?{node:void 0,error:a.createError(`schema-warning`,{pointer:i,value:t,schema:a.schema,key:e})}:{node:void 0}}const{DYNAMIC_PROPERTIES:ve,REGEX_FLAGS:ye,DECLARATOR_ONEOF:be,VALID_ANNOTATION_KEYWORDS:xe}=c;function b(e){return d(e)&&Array.isArray(e?.reducers)&&Array.isArray(e?.resolvers)}function Se(e){for(let t=0,n=ve.length;t<n;t+=1)if(v(e,ve[t]))return!0;return!1}function Ce(e,t){if(!Array.isArray(e)||e.length===0)throw Error(`Missing drafts in 'compileSchema({ $schema: "${t}" })'`);return e.length===1?e[0]:e.find(e=>new RegExp(e.$schemaRegEx,ye).test(t))??e[e.length-1]}function we(e,t){return e==t?e??``:e==null||t==null?(e||t)??``:e.startsWith(t)?e:t.startsWith(e)?t:`${e}+${t}`}const Te={compileSchema(e,t,r,i){let a=this;t??=a.evaluationPath;let o=t.split(`/$ref`)[0],c={lastIdPointer:a.lastIdPointer,context:a.context,parent:a,evaluationPath:t,dynamicId:we(a.dynamicId,i),schemaLocation:r??n(a.schemaLocation,o),reducers:[],resolvers:[],validators:[],schema:e,...Te};return!x(e)&&!S(e)?(c.schemaValidation=[c.createError(`schema-error`,{pointer:r??t,schema:e,value:void 0,message:`JSON schema must be object or boolean - reveived: '${e}'`})],c):(c.schemaValidation=s(Oe(c).filter(e=>e!=null)),c)},createError(e,t,n){let r=this,i=n;if(i===void 0){let n=r.schema?.errorMessages?.[e]??r.context.errors[e];if(typeof n==`function`)return n(t);i=me(n??name,t)}return{type:`error`,code:e,message:i,data:t}},createAnnotation(e,t,n){let r=this,i=n;if(i===void 0){let n=r.schema?.errorMessages?.[e]??r.context.errors[e];if(typeof n==`function`)return n(t);i=me(n??name,t)}return{type:`annotation`,code:e,message:i,data:t}},createSchema:f,getChildSelection(e){let t=this;return t.context.methods.getChildSelection(t,e)},getNode:ge,getNodeChild:_e,getNodeRef(e){return this.compileSchema({$ref:e},`$dynamic`).resolveRef()},getNodeRoot(){return this.context.rootNode},getDraftVersion(){return this.context.version},getData(e,t){let n=this,r={recursionLimit:1,...n.context.getDataDefaultOptions,cache:{},...t??{}};return n.context.methods.getData(n,e,r)},reduceNode(e,t={}){let n=this,{key:r=`missing-key`,pointer:i=n.evaluationPath,path:a}=t;if(n.schema===!1)return{node:n,error:void 0};if(n.schema===!0){let t=n.compileSchema(f(e),n.evaluationPath,n.schemaLocation);return a?.push({pointer:i,node:n}),{node:t,error:void 0}}let o,s=n.compileSchema(n.schema,n.evaluationPath,n.schemaLocation),c=n.reducers;for(let t of c){let c=t({data:e,key:r,node:n,pointer:i,path:a??[]});if(C(c))return{node:void 0,error:c};if(c){if(c.schema===!1){o=!1;break}s=g(s,c)}}return o===!1?{node:{...n,schema:!1,reducers:[]},error:void 0}:(s!==n&&a?.push({pointer:i,node:n}),s.schema=fe(s.schema,be,...ve),ve.forEach(e=>s[e]=void 0),{node:s,error:void 0})},validate(e,t=`#`,n=[]){let r=this,i=_(r,e,t,n)??[],a=[],o=[],c=s(Array.isArray(i)?i:[i]).filter(C),l=[];return s(Array.isArray(i)?i:[i]).forEach(e=>{if(C(e)){if(r.context.throwOnInvalidRef&&e.code===`ref-error`){let t=Error(`Invalid $ref: `+e.message);throw t.data=a,t}a.push(e)}else e instanceof Promise?l.push(e.then(s)):je(e)&&o.push(e)}),{valid:c.length===0,errors:a,annotations:o,errorsAsync:l}},addRemoteSchema(t,n){x(n)&&(n.$id=m(n.$id||t));let r=this,{context:i}=r,a=x(n)?r.context.draft??n.$schema:void 0,o=Ce(i.drafts,a??i.rootNode.schema?.$schema),c={evaluationPath:`#`,lastIdPointer:`#`,schemaLocation:`#`,dynamicId:``,reducers:[],resolvers:[],validators:[],schema:n,context:{...i,refs:{},anchors:{},...e(pe(o,`methods`,`keywords`,`version`,`formats`,`errors`))},...Te};c.context.rootNode=c,c.context.remotes[m(t)]=c;let l=Oe(c).filter(e=>e!=null);l=s(l);let u=[],d=[];return l.forEach(e=>{C(e)?u.push(e):je(e)&&d.push(e)}),r.schemaErrors=u,r.schemaAnnotations=d,r},resolveRef(e){throw Error(`method 'resolveRef' is not implemented`)},toSchemaNodes(){return p(this)},toDataNodes(e,t){let n=this;return n.context.methods.toDataNodes(n,e,t)},toJSON(){let e=this;return{...e,context:void 0,errors:void 0,parent:e.parent?.evaluationPath}}},Ee=[`$ref`,`if`,`$defs`],De=[`draft-04`,`draft-06`,`draft-07`];function Oe(e){if(e.schema.$ref&&De.includes(e.context.version))return e.context.keywords.filter(({keyword:e})=>Ee.includes(e)).map(t=>ke(t,e));let t=Object.keys(e.schema),n=e.context.keywords.filter(({keyword:e})=>Ee.includes(e)||t.includes(e)).map(t=>ke(t,e));return t.filter(t=>!t.startsWith(`x-`)&&!xe.includes(t)&&e.context.keywords.find(e=>e.keyword===t)==null).forEach(t=>{n.push(e.createAnnotation(`unknown-keyword-warning`,{$id:e.$id,pointer:`${e.schemaLocation}/${t}`,schema:e.schema,value:t,draft:e.getDraftVersion()}))}),n}function ke(e,t){let n=e.parse?.(t);return e.reduce&&e.addReduce?.(t)&&t.reducers.push(e.reduce),e.resolve&&e.addResolve?.(t)&&t.resolvers.push(e.resolve),e.validate&&e.addValidate?.(t)&&t.validators.push(e.validate),n}function x(e){return d(e)}function S(e){return typeof e==`boolean`}function Ae(e){return d(e)&&(e?.type&&e?.code&&e?.data)!=null}function je(e){return d(e)&&e.type===`annotation`}function C(e){return d(e)&&e.type===`error`}function w(e){return typeof e==`number`}const Me=/(#)+$/g,Ne=[``,null,`#`];function Pe(e){if(Ne.includes(e))return[];if(e=e.replace(Me,``),e.indexOf(`#`)===-1)return[e.replace(/(#|\/)+$/g,``)];if(e.indexOf(`#`)===0)return[e.replace(Me,``)];let t=e.split(`#`);return t[0]=t[0].replace(/(#|\/)+$/g,``),t[1]=`#${t[1].replace(Me,``)}`,t}const Fe={id:`$ref`,keyword:`$ref`,order:10,parse:Le,addReduce:e=>e.$ref!=null||e.schema.$dynamicRef!=null,reduce:Re,addValidate:({schema:e})=>e.$ref!=null||e.$dynamicRef!=null,validate:Be};function Ie(e,t){e.context.refs[t]??(e.context.refs[t]=e)}function Le(e){e.resolveRef=ze;let n=m(e.parent?.$id,e.schema?.$id);e.$id=n,e.lastIdPointer=e.parent?.lastIdPointer??`#`,n!==e.parent?.$id&&e.evaluationPath!==`#`&&(e.lastIdPointer=e.evaluationPath),e.lastIdPointer!==`#`&&e.evaluationPath.startsWith(e.lastIdPointer)&&Ie(e,m(n,`#${e.evaluationPath.replace(e.lastIdPointer,``)}`)),Ie(e,m(e.context.rootNode.$id,e.evaluationPath));let r=e.schema.$anchor;if(r){let t=`${n.replace(/#$/,``)}#${r}`;e.context.anchors[t]??(e.context.anchors[t]=e)}let i=e.schema.$dynamicAnchor;if(i){let t=`${n.replace(/#$/,``)}#${i}`;e.context.dynamicAnchors[t]??(e.context.dynamicAnchors[t]=e)}if(e.schema.$ref&&(e.$ref=m(n,e.schema.$ref),e.$ref.startsWith(`/`)&&(e.$ref=`#${e.$ref}`)),e.$ref?.startsWith(`#/$defs/`)&&t(e.getNodeRoot().schema,e.$ref)==null)return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/$ref`,schema:e.schema,value:e.schema.$ref,message:`Invalid $ref to missing target '${e.schema.ref}'`})}function Re({node:e,data:t,key:n,pointer:r,path:i}){if(e==null)return;let a=e.resolveRef({pointer:r,path:i});if(a==null)return e.createError(`ref-error`,{ref:e.schema.$ref??e.schema.$dynamicRef,pointer:r,schema:e.schema,value:t});if(a.schemaLocation===e.schemaLocation)return a;let{node:o,error:s}=g(e,a).reduceNode(t,{key:n,pointer:r,path:i});return o??s}function ze({pointer:e,path:t=[]}={}){if(this.schema.$dynamicRef){let n=Ve(this,t);return C(n)||t.push({pointer:e,node:n}),n}if(this.$ref==null)return this;let n=He(this);return b(n)&&t.push({pointer:e,node:n}),n}function Be({node:e,data:t,pointer:n=`#`,path:r}){let i=e.resolveRef({pointer:n,path:r});return i==null?e.createError(`ref-error`,{ref:e.schema.$ref??e.schema.$dynamicRef,pointer:n,schema:e.schema,value:t}):_(i,t,n,r)}function Ve(e,t){let n=t,r=m(e.$id,e.schema.$dynamicRef);if(e.context.dynamicAnchors[r]==null&&e.context.anchors[r])return T(e.context.anchors[r],e);for(let t of n){if(t.node.schema.$dynamicAnchor)return T(t.node,e);let n=e.schema.$dynamicRef.split(`#`).pop(),r=m(t.node.$id,`#${n}`);if(e.context.dynamicAnchors[r])return T(e.context.dynamicAnchors[r],e)}return He(e,r)}function T(e,t){let n=e.schema;return d(e.schema)&&(n={...fe(e.schema,`$id`),...pe(t.schema,...c.PROPERTIES_TO_MERGE)}),e.compileSchema(n,`${t.evaluationPath}/$ref`,e.schemaLocation)}function He(e,n=e?.$ref){if(n==null)return e;if(e.context.refs[n])return T(e.context.refs[n],e);if(e.context.anchors[n])return T(e.context.anchors[n],e);if(e.context.dynamicAnchors[n])return T(e.context.dynamicAnchors[n],e);let i=Pe(n);if(i.length===0)return e.createError(`ref-error`,{ref:n,pointer:e.evaluationPath,schema:e.schema,value:void 0});if(i.length===1){let n=i[0];if(e.context.remotes[n])return T(e.context.remotes[n],e);if(n[0]===`#`){let r=e.context.rootNode.schema,i=t(r,n);if(i)return e.compileSchema(i,`${e.evaluationPath}/$ref`,n)}return e.createError(`ref-error`,{ref:n,pointer:e.evaluationPath,schema:e.schema,value:void 0})}if(i.length===2){let t=i[0];if(e.context.remotes[t]&&e!==e.context.remotes[t]){let r=e.context.remotes[t],a=He(r,n);if(a||(a=He(r,i[1]),a))return a}if(e.context.refs[t]){let a=e.context.refs[t],o=r(i[1]),s=a;for(let t of o)if(s=s[t===`definitions`?`$defs`:t],s==null)return e.createError(`ref-error`,{ref:n,pointer:e.evaluationPath,schema:e.schema,value:void 0,host:i[0],local:i[1]});return s}}return e.createError(`ref-error`,{ref:n,pointer:e.evaluationPath,schema:e.schema,value:void 0})}function E(e,...t){return t.reduce((e,t)=>(t.schemaValidation&&e.push(...t.schemaValidation),e),e)}const Ue={id:`$defs`,keyword:`$defs`,parse:We};function We(e){let t=[];return e.schema.$defs&&(d(e.schema.$defs)?(e.$defs=e.$defs??{},Object.keys(e.schema.$defs).forEach(n=>{e.$defs[n]=e.compileSchema(e.schema.$defs[n],`${e.evaluationPath}/$defs/${Ge(n)}`,`${e.schemaLocation}/$defs/${n}`),E(t,e.$defs[n])})):t.push(e.createError(`schema-error`,{pointer:e.schemaLocation,schema:e.schema,value:e.schema.$defs,message:`$defs must be an object - received: ${typeof e.schema.$defs}`}))),e.schema.definitions&&(d(e.schema.definitions)||t.push(e.createError(`schema-error`,{pointer:e.schemaLocation,schema:e.schema,value:e.schema.$defs,message:`definitions must be an object - received: ${typeof e.schema.definitions}`})),e.$defs=e.$defs??{},Object.keys(e.schema.definitions).forEach(n=>{e.$defs[n]=e.compileSchema(e.schema.definitions[n],`${e.evaluationPath}/definitions/${Ge(n)}`,`${e.schemaLocation}/definitions/${Ge(n)}`),E(t,e.$defs[n])})),t}function Ge(e){return e=e.replace(/~/g,`~0`),e=e.replace(/\//g,`~1`),encodeURIComponent(e)}const Ke={id:`$ref`,keyword:`$ref`,parse:qe,addValidate:({schema:e})=>e.$ref!=null,validate:Je};function qe(e){let t=e.parent?.$id;if(e.schema?.$ref??(t=m(e.parent?.$id,e.schema?.$id)),e.$id=t,e.lastIdPointer=e.parent?.lastIdPointer??`#`,e.resolveRef=ze,e.context.refs[t]??(e.context.refs[t]=e),t!==e.parent?.$id&&(e.lastIdPointer=e.evaluationPath),e.lastIdPointer!==`#`&&e.evaluationPath.startsWith(e.lastIdPointer)){let n=`#${e.evaluationPath.replace(e.lastIdPointer,``)}`;e.context.refs[m(t,n)]=e}else e.context.refs[m(t,e.evaluationPath)]=e;e.context.refs[m(e.context.rootNode.$id,e.evaluationPath)]=e,e.schema.$ref&&(e.$ref=m(t,e.schema.$ref))}function Je({node:e,data:t,pointer:n=`#`,path:r}){let i=Ye(e,n,r);return b(i)?_(i,t,n,r):e.createError(`ref-error`,{ref:e.schema.$ref,pointer:n,schema:e.schema,value:t})}function Ye(e,t,n){let r=e.resolveRef({pointer:t,path:n});return b(r)?r!==e&&r?Ye(r,t,n):e:e.createError(`ref-error`,{ref:e.schema.$ref,pointer:t,schema:e.schema,value:void 0})}const Xe={id:`$ref`,keyword:`$ref`,parse:Qe,addValidate:({schema:e})=>e.$ref!=null,validate:Ke.validate};function Ze(e,t){e.context.refs[t]??(e.context.refs[t]=e)}function Qe(e){let t=e.parent?.$id;if(e.schema?.$ref==null&&e.schema?.id&&(t=m(e.parent?.$id,e.schema.id)),e.$id=t,e.lastIdPointer=e.parent?.lastIdPointer??`#`,e.resolveRef=$e,e.context.refs[t]??(e.context.refs[t]=e),t!==e.parent?.$id&&(e.lastIdPointer=e.evaluationPath),e.lastIdPointer!==`#`&&e.evaluationPath.startsWith(e.lastIdPointer)){let n=`#${e.evaluationPath.replace(e.lastIdPointer,``)}`;Ze(e,m(t,n))}else Ze(e,m(t,e.evaluationPath));Ze(e,m(e.context.rootNode.$id,e.evaluationPath)),e.schema.$ref&&(e.$ref=m(t,e.schema.$ref))}function $e({pointer:e,path:t}={}){if(this.$ref==null)return this;let n=tt(this);return b(n)&&t?.push({pointer:e,node:n}),n}function et(e,t=e.evaluationPath){let n=d(e.schema)?fe(e.schema,`id`):e.schema;return e.compileSchema(n,`${t}/$ref`,n.schemaLocation)}function tt(e,t=e?.$ref){if(t==null)return e;if(e.context.refs[t])return et(e.context.refs[t],e.evaluationPath);if(e.context.anchors[t])return et(e.context.anchors[t],e.evaluationPath);let n=Pe(t);if(n.length===0)return e.createError(`ref-error`,{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0});if(n.length===1){let t=n[0];return e.context.remotes[t]?et(e.context.remotes[t],e.evaluationPath):e.createError(`ref-error`,{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0})}if(n.length===2){let r=n[0];if(e.context.remotes[r]&&e!==e.context.remotes[r]){let i=e.context.remotes[r],a=tt(i,t);if(a||(a=tt(i,n[1]),a))return a}let i=n[0];if(e.context.refs[i]){let t=e.context.refs[i],r=n[1].split(`$defs/`).pop();if(r&&t?.$defs)return tt(t.$defs[r])}return}return e.createError(`ref-error`,{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0})}const nt=`additionalItems`,rt={id:nt,keyword:nt,order:-10,parse:it,addResolve:e=>e.items!=null,resolve:at,addValidate:({schema:e})=>e[nt]!=null&&e[nt]!==!0&&Array.isArray(e.items),validate:ot};function it(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e;if(t.additionalItems==null||t.additionalItems===!1)return;let i=t[nt];if(!(d(i)||i===!0))return e.createError(`schema-error`,{pointer:n,schema:t,value:void 0,message:`Keyword '${nt}' must be an object or a boolean - received '${typeof i}'`});if(!Array.isArray(t.items))return e.createAnnotation(`schema-error`,{pointer:n,schema:t,value:void 0,message:`Keyword '${nt}' is only evaluated with a given items-array`});e.items=e.compileSchema(t.additionalItems,`${n}/additionalItems`,`${r}/additionalItems`)}function at({node:e,key:t,data:n}){if(Array.isArray(n)){let r=y(n,t),{node:i,error:a}=e.items.reduceNode(r);return i??a}}function ot({node:e,data:t,pointer:n,path:r}){let{schema:i}=e;if(!Array.isArray(t)||t.length===0||Array.isArray(i.items)&&i.items.length>=t.length)return;let a=Array.isArray(i.items)?i.items.length:0,o=[];for(let s=a;s<t.length;s+=1){let a=t[s];if(e.items){let t=_(e.items,a,`${n}/${s}`,r);t&&o.push(...t)}else i.additionalItems===!1&&o.push(e.createError(`additional-items-error`,{key:s,pointer:`${n}/${s}`,value:t,schema:i}))}return o}const st={id:`additionalProperties`,keyword:`additionalProperties`,order:-10,parse:ct,addResolve:({schema:e})=>e.additionalProperties!=null,resolve:lt,addValidate:({schema:e})=>e.additionalProperties!==!0&&e.additionalProperties!=null&&!(e.additionalProperties===!1&&d(e.patternProperties)),validate:ut};function ct(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e;if(!(t.additionalProperties==null||S(t.additionalProperties)))return d(t.additionalProperties)?(e.additionalProperties=e.compileSchema(t.additionalProperties,`${n}/additionalProperties`,`${r}/additionalProperties`),e.additionalProperties.schemaValidation):e.createError(`schema-error`,{pointer:e.schemaLocation,schema:t,value:t.additionalProperties,message:`keyword 'additionalProperties' must be a valid JSON Schema - receoved: ${typeof t.additionalProperties}`})}function lt({node:e,data:t,key:n}){let r=y(t,n);if(e.additionalProperties){let{node:t,error:n}=e.additionalProperties.reduceNode(r);return t??n}if(e.schema.additionalProperties===!1)return e.createError(`no-additional-properties-error`,{pointer:`${n}`,schema:e.schema,value:y(t,n),property:`${n}`})}function ut({node:e,data:t,pointer:n=`#`,path:r}){if(!d(t))return;let{schema:i}=e,a=[],o=Object.keys(t).filter(e=>c.propertyBlacklist.includes(e)===!1),s=e.patternProperties;Array.isArray(s)&&(o=o.filter(e=>{for(let t of s)if(t.pattern.test(e))return!1;return!0}));let l=e.properties?Object.keys(e.properties):[];return o.filter(e=>l.indexOf(e)===-1).forEach(o=>{let s=y(t,o);if(s!==void 0)if(d(e.additionalProperties)){let t=_(e.additionalProperties,s,`${n}/${o}`,r);t&&a.push(...t)}else a.push(e.createError(`no-additional-properties-error`,{pointer:`${n}/${o}`,schema:i,value:t,property:o,properties:l}))}),a}const D=`allOf`,dt={id:D,keyword:D,parse:ft,addReduce:e=>e[D]!=null,reduce:pt,addValidate:e=>e[D]!=null,validate:mt};function ft(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e;if(t[D]!=null){if(!Array.isArray(t[D]))return e.createError(`schema-error`,{pointer:r,schema:t,value:t[D],message:`Keyword '${D}' must be an array - received '${typeof t[D]}'`});if(t[D].length!==0)return e[D]=t[D].map((t,i)=>e.compileSchema(t,`${n}/${D}/${i}`,`${r}/${D}/${i}`)),E([],...e[D])}}function pt({node:e,data:t,key:n,pointer:r,path:i}){if(e[D]==null)return;let a={},o=``;for(let s=0;s<e[D].length;s+=1){let{node:c}=e[D][s].reduceNode(t,{key:n,pointer:r,path:i});if(c){let t=c.dynamicId?.replace(e.dynamicId,``)??``,n=t===``?`${D}/${s}`:t;o+=`${o===``?``:`,`}${n}`;let r=h(e[D][s].schema,c.schema);a=h(a,r,D,`contains`)}}return e.compileSchema(a,`${e.evaluationPath}/${o}`,e.schemaLocation,`${e.schemaLocation}(${o})`)}function mt({node:e,data:t,pointer:n,path:r}){if(!Array.isArray(e[D])||e[D].length===0)return;let i=[];return e[D].forEach(e=>{i.push(..._(e,t,n,r))}),i}const O=`anyOf`,ht={id:O,keyword:O,parse:gt,addReduce:e=>e[O]!=null,reduce:_t,addValidate:e=>e[O]!=null,validate:vt};function gt(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e;if(t[O]!=null){if(!Array.isArray(t[O]))return e.createError(`schema-error`,{pointer:r,schema:t,value:t[O],message:`Keyword '${O}' must be an array - received '${typeof t[O]}'`});if(t[O].length!==0)return e[O]=t[O].map((t,i)=>e.compileSchema(t,`${n}/${O}/${i}`,`${r}/${O}/${i}`)),E([],...e[O])}}function _t({node:e,data:t,pointer:n,path:r}){if(e[O]==null)return;let i={},a=``;for(let o=0;o<e[O].length;o+=1)if(_(e[O][o],t,n,r).length===0){let{node:n}=e[O][o].reduceNode(t);if(n){let t=n.dynamicId?.replace(e.dynamicId,``)??``,r=t===``?`${O}/${o}`:t;a+=`${a===``?``:`,`}${r}`;let s=h(e[O][o].schema,n.schema);i=h(i,s,O)}}return e.compileSchema(i,`${e.evaluationPath}${a}`,e.schemaLocation,`${e.schemaLocation}(${a})`)}function vt({node:e,data:t,pointer:n,path:r}){if(e[O]!=null){for(let i of e[O])if(_(i,t,n,r).length===0)return;return e.createError(`any-of-error`,{pointer:n,schema:e.schema,value:t,anyOf:e.schema[O]})}}const k=`contains`,yt={id:k,keyword:k,parse:bt,addValidate:e=>e[k]!=null,validate:xt,addReduce:e=>e[k]!=null,reduce:({node:e})=>e.compileSchema({items:{anyOf:[e[k].schema]}},e.evaluationPath,e.schemaLocation)};function bt(e){let t=e.schema[k];if(t!=null)return x(t)||S(t)?(e[k]=e.compileSchema(t,`${e.evaluationPath}/${k}`),e[k].schemaValidation):e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${k}`,schema:e.schema,value:t,message:`Keyword '${k}' must be a valid JSON Schema - received '${typeof t}'`})}function xt({node:e,data:t,pointer:n,path:r}){let{schema:i}=e;if(!Array.isArray(t))return;if(i.contains===!1)return e.createError(`contains-array-error`,{pointer:n,value:t,schema:i});if(i.contains===!0)return Array.isArray(t)&&t.length===0?e.createError(`contains-any-error`,{pointer:n,value:t,schema:i}):void 0;if(!d(i.contains)||!Array.isArray(t))return;let a=0;for(let i of t)_(e.contains,i,n,r).length===0&&a++;let o=i.maxContains??1/0,s=i.minContains??1;if(!(o>=a&&s<=a))return o<a?e.createError(`contains-max-error`,{pointer:n,schema:i,delta:a-o,value:t}):s>a?e.createError(`contains-min-error`,{pointer:n,schema:i,delta:s-a,value:t}):e.createError(`contains-error`,{pointer:n,schema:i,value:t})}function St(e){return Array.isArray(e)&&e.find(e=>typeof e!=`string`)==null}const A=`dependentRequired`,Ct={id:A,keyword:A,parse:wt,addValidate:e=>e[A]!=null,validate:Tt};function wt(e){let{schema:t}=e;if(t[A]==null)return;if(!d(t[A]))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${A}`,schema:t,value:t[A],message:`Keyword '${A}' must be an object - received '${typeof t[A]}'`});let n=[];e.dependentRequired={};for(let r of Object.keys(t[A])){let i=t[A][r];St(i)?e.dependentRequired[r]=i:n.push(e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${A}/${r}`,schema:t,value:i,message:`Keyword '${A}[string]' must be a string[] - received '${typeof i}'`}))}return n}function Tt({node:e,data:t,pointer:n=`#`}){let{dependentRequired:r}=e;if(r==null||!d(t))return;let i=[];return Object.keys(t).forEach(a=>{let o=r[a];if(Array.isArray(o))for(let r=0,a=o.length;r<a;r+=1)t[o[r]]===void 0&&i.push(e.createError(`missing-dependency-error`,{missingProperty:o[r],pointer:n,schema:e.schema,value:t}))}),i}const j=`dependentSchemas`,Et={id:j,keyword:j,parse:Dt,addReduce:e=>e.dependentSchemas!=null,reduce:Ot,addValidate:e=>e.dependentSchemas!=null,validate:kt};function Dt(e){let{dependentSchemas:t}=e.schema;if(t==null)return;if(!d(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${j}`,schema:e.schema,value:t,message:`Keyword '${j}' must be an object - received '${typeof t}'`});if(Object.keys(t).length===0)return;let n=[],r={};for(let i of Object.keys(t)){let a=t[i];d(a)?(r[i]=e.compileSchema(a,`${e.evaluationPath}/${j}/${i}`,`${e.schemaLocation}/${j}/${i}`),E(n,r[i])):S(a)?r[i]=a:n.push(e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${j}/${i}`,schema:e.schema,value:a,message:`Keyword '${j}[string]' must be a valid JSON Schema'`}))}return e.dependentSchemas=r,n}function Ot({node:e,data:t}){let{dependentSchemas:n}=e;if(!d(t)||n==null)return e;let r,i=0,a=`${e.schemaLocation}(`;return Object.keys(t).forEach(e=>{n[e]!=null&&(r??={properties:{}},b(n[e])?r=h(r,n[e].schema):r.properties[e]=n[e],a+=`${i?`,`:``}${j}/${e}`,i++)}),r==null?e:(r=h(e.schema,r,j),e.compileSchema(r,e.evaluationPath,e.schemaLocation,`${a})`))}function kt({node:e,data:t,pointer:n,path:r}){let{schema:i,dependentSchemas:a}=e;if(!d(t)||a==null)return;let o=[];return Object.keys(t).forEach(c=>{let l=a[c];if(l!==!0){if(l===!1){o.push(e.createError(`missing-dependency-error`,{pointer:n,schema:i,value:t}));return}if(b(l)){s(_(l,t,n,r),o);return}}}),o}const M=`dependencies`,At={id:M,keyword:M,parse:jt,order:-9,addReduce:e=>e.schema[M]!=null,reduce:Mt,addValidate:e=>e.schema[M]!=null,validate:Nt};function jt(e){let{dependencies:t}=e.schema;if(!d(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${M}`,schema:e.schema,value:t,message:`Keyword '${M}' must be an object - received ${typeof t}`});let n=[];for(let r of Object.keys(t)){let i=t[r];x(i)||S(i)?(e.dependentSchemas=e.dependentSchemas??{},e.dependentSchemas[r]=e.compileSchema(i,`${e.evaluationPath}/${M}/${r}`,`${e.schemaLocation}/${M}/${r}`),E(n,e.dependentSchemas[r])):St(i)?(e.dependentRequired=e.dependentRequired??{},e.dependentRequired[r]=i):n.push(e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${M}`,schema:e.schema,value:t,message:`Keyword '${M}[string]' must be JSON Schema or string[]`}))}return n}function Mt({node:e,data:t,key:n,pointer:r,path:i}){if(!d(t)||e.dependentRequired==null&&e.dependentSchemas==null)return e;let a=e.compileSchema(e.schema,e.evaluationPath,e.schemaLocation),o=a.schema.required??[],s=``,c=e.dependentRequired;c&&Object.keys(c).forEach(e=>{if(!v(t,e)&&!o.includes(e)||c[e]==null)return;o.push(...c[e]);let n=`${M}/${e}`;s+=`${s===``?``:`,`}${n}`});let l=e.dependentSchemas,error;return l&&Object.keys(l).forEach(c=>{if(error)return;if(!v(t,c)&&!o.includes(c))return!0;let u=l[c];if(!b(u))return!0;Array.isArray(u.schema.required)&&o.push(...u.schema.required);let d={...u,schema:{...u.schema,required:o}}.reduceNode(t,{key:n,pointer:`${r}/${M}/${c}`,path:i});if(d.error){error=d.error;return}let p=d.node;if(!p)return;a=g(a,p);let f=p.dynamicId?.replace(e.dynamicId,``)??``,ee=f===``?`${M}/${c}`:f;s+=`${s===``?``:`,`}${ee}`}),error?error:a===e?e:o.length===0?a:(o=a.schema.required?a.schema.required.concat(...o):o,o=o.filter((e,t,n)=>n.indexOf(e)===t),a=g(a,a,M),a.compileSchema({...a.schema,required:o},a.evaluationPath,a.schemaLocation,`${e.schemaLocation}(${s})`))}function Nt({node:e,data:t,pointer:n,path:r}){if(!d(t))return;let i=[];return e.dependentRequired&&s(Tt({node:e,data:t,pointer:n,path:r}),i),e.dependentSchemas&&s(kt({node:e,data:t,pointer:n,path:r}),i),i}const N=`deprecated`,Pt={id:N,keyword:N,parse:Ft,addValidate:e=>e[N]===!0,validate:It};function Ft(e){let t=e.schema[N];if(t!=null){if(typeof t!=`boolean`)return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${N}`,schema:e.schema,value:t,message:`Keyword '${N}' must be a boolean - received '${typeof t}'`});e[N]=t}}function It({node:e,data:t,pointer:n}){return[e.createAnnotation(`deprecated-warning`,{pointer:n,schema:e.schema,value:t},e.schema.deprecatedMessage)]}const P=`enum`,Lt={id:P,keyword:P,parse:Rt,addValidate:e=>e.enum!=null,validate:zt};function Rt(e){let{schema:t}=e;if(t[P]!=null){if(!Array.isArray(t[P]))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${P}`,schema:t,value:t[P],message:`Keyword '${P}' must be an array - received '${typeof t[P]}'`});e.enum=t[P]}}function zt({node:e,data:t,pointer:n=`#`}){if(e.enum==null)return;let r=u(t);if(r===`object`||r===`array`){let n=JSON.stringify(t);for(let t of e.enum)if(JSON.stringify(t)===n)return}else if(e.enum.includes(t))return;return e.createError(`enum-error`,{pointer:n,schema:e.schema,value:t,values:e.enum})}const Bt={"additional-items-error":"Array at `{{pointer}}` may not have an additional item `{{key}}`","additional-properties-error":"Additional property `{{property}}` on `{{pointer}}` does not match schema `{{schema}}`","all-of-error":"Value `{{value}}` at `{{pointer}}` does not match schema of `{{allOf}}`","any-of-error":"Value `{{value}}` at `{{pointer}}` does not match any schema of `{{anyOf}}`","const-error":"Expected value at `{{pointer}}` to be `{{expected}}`, but value given is `{{value}}`","contains-any-error":"The array at `{{pointer}}` must contain at least one item","contains-array-error":"The property at `{{pointer}}` must not be an array","contains-error":"The array at `{{pointer}}` must contain an element that matches `{{schema}}`","contains-min-error":"The array at `{{pointer}}` contains {{delta}} too few items matching `{{schema}}`","contains-max-error":"The array at `{{pointer}}` contains {{delta}} too many items matching `{{schema}}`","enum-error":"Expected given value `{{value}}` in `{{pointer}}` to be one of `{{values}}`","exclusive-maximum-error":"Value in `{{pointer}}` is `{{length}}`, but should be at most `{{maximum}}`","exclusive-minimum-error":"Value in `{{pointer}}` is `{{length}}`, but should be at minimum `{{minimum}}`","forbidden-property-error":"Property name `{{property}}` at `{{pointer}}` is not allowed","format-date-error":"Value `{{value}}` at `{{pointer}}` is not a valid date","format-date-time-error":"Value `{{value}}` at `{{pointer}}` is not a valid date-time","format-duration-error":"Value `{{value}}` at `{{pointer}}` is not a valid duration","format-email-error":"Value `{{value}}` at `{{pointer}}` is not a valid email","format-hostname-error":"Value `{{value}}` at `{{pointer}}` is not a valid hostname","format-idn-hostname-error":"Value `{{value}}` at `{{pointer}}` is not a valid idn hostname","format-ipv4-error":"Value `{{value}}` at `{{pointer}}` is not a valid IPv4 address","format-ipv4-leading-zero-error":`IPv4 addresses starting with zero are invalid, since they are interpreted as octals`,"format-ipv6-error":"Value `{{value}}` at `{{pointer}}` is not a valid IPv6 address","format-ipv6-leading-zero-error":`IPv6 addresses starting with zero are invalid, since they are interpreted as octals`,"format-iri-error":"Value `{{value}}` at `{{pointer}}` is not a valid iri","format-iri-reference-error":"Value `{{value}}` at `{{pointer}}` is not a valid iri-reference","format-json-pointer-error":"Value `{{value}}` at `{{pointer}}` is not a valid json-pointer","format-regex-error":"Value `{{value}}` at `{{pointer}}` is not a valid regular expression","format-time-error":"Value `{{value}}` at `{{pointer}}` is not a valid time","format-uri-error":"Value `{{value}}` at `{{pointer}}` is not a valid uri","format-uri-reference-error":"Value `{{value}}` at `{{pointer}}` is not a valid uri-reference","format-uri-template-error":"Value `{{value}}` at `{{pointer}}` is not a valid uri-template","format-url-error":"Value `{{value}}` at `{{pointer}}` is not a valid url","format-uuid-error":"Value `{{value}}` at `{{pointer}}` is not a valid uuid","invalid-data-error":"No value may be specified in `{{pointer}}`","invalid-property-name-error":"Invalid property name `{{property}}` at `{{pointer}}`","maximum-error":"Value in `{{pointer}}` is `{{length}}`, but should be `{{maximum}}` at maximum","max-items-error":"Too many items in `{{pointer}}`, should be `{{maximum}}` at most, but got `{{length}}`","max-length-error":"Value `{{pointer}}` should have a maximum length of `{{maxLength}}`, but got `{{length}}`.","max-properties-error":"Too many properties in `{{pointer}}`, should be `{{maxProperties}}` at most, but got `{{length}}`","minimum-error":"Value in `{{pointer}}` is `{{length}}`, but should be `{{minimum}}` at minimum","min-items-error":"Too few items in `{{pointer}}`, should be at least `{{minItems}}`, but got `{{length}}`","min-items-one-error":"At least one item is required in `{{pointer}}`","min-length-error":"Value `{{pointer}}` should have a minimum length of `{{minLength}}`, but got `{{length}}`.","min-length-one-error":"A value is required in `{{pointer}}`","missing-one-of-declarator-error":"Missing oneOf declarator `{{declarator}}` in schema `{{schemaLocation}}`","min-properties-error":"Too few properties in `{{pointer}}`, should be at least `{{minProperties}}`, but got `{{length}}`","missing-array-item-error":`Array at '{{pointer}}' has a missing item at '{{key}}'`,"missing-dependency-error":"The required propery '{{missingProperty}}' in `{{pointer}}` is missing","missing-one-of-property-error":"Value at `{{pointer}}` must be object or array and have a property ${oneOfProperty}: ${value}","multiple-of-error":"Expected `{{value}}` in `{{pointer}}` to be multiple of `{{multipleOf}}`","multiple-one-of-error":"Value `{{value}}` should not match multiple schemas in oneOf `{{matches}}`","no-additional-properties-error":"Additional property `{{property}}` in `{{pointer}}` is not allowed","not-error":"Value `{{value}}` at pointer should not match schema `{{not}}`","one-of-error":"Value `{{value}}` in `{{pointer}}` does not match any given oneof schema","one-of-property-error":"Failed finding a matching oneOfProperty schema in `{{pointer}}` where `{{property}}` matches `{{value}}`","pattern-error":"Value in `{{pointer}}` should match `{{description}}`, but received `{{received}}`","pattern-properties-error":"Property `{{key}}` does not match any patterns in `{{pointer}}`. Valid patterns are: {{patterns}}","ref-error":`Could not resolve $ref '{{ref}}' from '{{pointer}}'`,"required-property-error":"The required property `{{key}}` is missing at `{{pointer}}`","schema-warning":`Failed retrieving a schema from '{{pointer}}' to key '{{key}}'`,"type-error":"Expected `{{value}}` ({{received}}) in `{{pointer}}` to be of type `{{expected}}`","undefined-value-error":"Value must not be undefined in `{{pointer}}`","unevaluated-property-error":"Invalid unevaluated property `{{pointer}}`","unevaluated-items-error":"Invalid unevaluated item `{{pointer}}`","unique-items-error":"Items in array must be unique. Value `{{value}}` in `{{pointer}}` is a duplicate of {{duplicatePointer}}.","unknown-property-error":"Could not find a valid schema for property `{{pointer}}` within object","value-not-empty-error":"A value for `{{property}}` is required at `{{pointer}}`","deprecated-warning":"Value at `{{pointer}}` is deprecated","schema-error":`Invalid schema found at {{pointer}}: {{message}}`,"unknown-keyword-warning":`Keyword '{{value}}' is not a valid keyword to draft '{{draft}}'`,"unknown-format-warning":`Format {{value}} is not a valid format`},Vt={id:`exclusiveMaximum`,keyword:`exclusiveMaximum`,parse:Ht,addValidate:({schema:e})=>e.exclusiveMaximum===!0||!isNaN(e.maximum),validate:Ut};function Ht(e){let{exclusiveMaximum:t}=e.schema;if(t!=null&&typeof t!=`number`&&typeof t!=`boolean`)return e.createError(`schema-error`,{pointer:e.evaluationPath,schema:e.schema,value:void 0,message:`Keyword 'exclusiveMaximum' must be a number - received '${typeof t}'`})}function Ut({node:e,data:t,pointer:n}){if(typeof t==`number`&&e.schema.exclusiveMaximum&&e.schema.maximum===t)return e.createError(`maximum-error`,{maximum:e.schema.exclusiveMaximum,length:t,pointer:n,schema:e.schema,value:t})}const Wt={id:`exclusiveMinimum`,keyword:`exclusiveMinimum`,parse:Gt,addValidate:({schema:e})=>e.exclusiveMinimum===!0||!isNaN(e.minimum),validate:Kt};function Gt(e){let{exclusiveMinimum:t}=e.schema;if(t!=null&&typeof t!=`number`&&typeof t!=`boolean`)return e.createError(`schema-error`,{pointer:e.evaluationPath,schema:e.schema,value:void 0,message:`Keyword 'exclusiveMinimum' must be a number - received '${typeof t}'`})}function Kt({node:e,data:t,pointer:n}){if(typeof t==`number`&&e.schema.exclusiveMinimum&&e.schema.minimum===t)return e.createError(`minimum-error`,{minimum:e.schema.exclusiveMinimum,length:t,pointer:n,schema:e.schema,value:t})}const F=`format`,qt={id:F,keyword:F,parse:Jt,addValidate:({schema:e})=>e?.format!=null,validate:Yt};function Jt(e){let t=e.schema[F];if(t!=null){if(typeof t!=`string`)return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${F}`,schema:e.schema,value:t,message:`Keyword '${F}' must be a string - received '${typeof t}'`});if(e.context.formats[t]==null)return e.createAnnotation(`unknown-format-warning`,{pointer:`${e.schemaLocation}/${F}`,schema:e.schema,value:t,message:`Keyword '${F}' must be a string - received '${typeof t}'`})}}function Yt(e){let{node:t}=e,n=t.context.formats[t.schema.format];return n?.(e)}const{REGEX_FLAGS:Xt}=c,Zt=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Qt=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,$t=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,en=/^(?<time>(?:([0-1]\d|2[0-3]):[0-5]\d:(?<second>[0-5]\d|60)))(?:\.\d+)?(?<offset>(?:z|[+-]([0-1]\d|2[0-3])(?::?[0-5]\d)?))$/i,tn=[0,31,28,31,30,31,30,31,31,30,31,30,31],nn=/^(?:\/(?:[^~/]|~0|~1)*)*$/,rn=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,an=/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,I={date:({node:e,pointer:t,data:n})=>{let{schema:r}=e;if(typeof n!=`string`||n===``)return;let i=n.match($t);if(!i)return e.createError(`format-date-error`,{value:n,pointer:t,schema:r});let a=+i[1],o=+i[2],s=+i[3],c=a%4==0&&(a%100!=0||a%400==0);if(!(o>=1&&o<=12&&s>=1&&s<=(o==2&&c?29:tn[o])))return e.createError(`format-date-error`,{value:n,pointer:t,schema:r})},"date-time":({node:e,pointer:t,data:n,path:r})=>{let{schema:i}=e;if(typeof n!=`string`||n===``)return;let a=n.split(/t/i);if(a.length===2){let n=I.date({node:e,pointer:t,data:a[0],path:r})===void 0,i=I.time({node:e,pointer:t,data:a[1],path:r})===void 0;if(n&&i)return}return e.createError(`format-date-time-error`,{value:n,pointer:t,schema:i})},duration:({node:e,pointer:t,data:n})=>{if(u(n)===`string`&&(!an.test(n)||/(\d+M)(\d+W)|(\d+Y)(\d+W)/.test(n)))return e.createError(`format-duration-error`,{value:n,pointer:t,schema:e.schema})},email:({node:e,pointer:t,data:n})=>{let{schema:r}=e;if(typeof n!=`string`||n===``)return;let i=n.lastIndexOf(`@`),a=n.substr(0,i),o=n.substr(i+1);if(!a||!o||a.length>64||o.length>253)return e.createError(`format-email-error`,{value:n,pointer:t,schema:r});let s=a;if(/^".*"$/.test(a)&&(s=a.replace(/(^")|([. @]+)|("$)/g,``)),s[0]===`.`||s.endsWith(`.`)||s.includes(`..`)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(s))return e.createError(`format-email-error`,{value:n,pointer:t,schema:r});if(/^\[.*\]$/.test(o)){let e=o.substr(1,o.length-2);if(Zt.test(e)||Qt.test(e)||/IPv6:::[0-9a-f]{1,4}/.test(e))return}if(!/^[a-z0-9.-]+$/i.test(o)||!o.split(`.`).every(e=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(e)))return e.createError(`format-email-error`,{value:n,pointer:t,schema:r})},"json-pointer":({node:e,pointer:t,data:n})=>{let{schema:r}=e;if(typeof n==`string`&&n!==``&&!nn.test(n))return e.createError(`format-json-pointer-error`,{value:n,pointer:t,schema:r})},"relative-json-pointer":({node:e,pointer:t,data:n})=>{let{schema:r}=e;if(typeof n==`string`&&!rn.test(n))return e.createError(`format-json-pointer-error`,{value:n,pointer:t,schema:r})},regex:({node:e,pointer:t,data:n})=>{let{schema:r}=e;if(!(typeof n==`object`||typeof n==`number`||Array.isArray(n)||u(n)===`boolean`)){if(typeof n==`string`&&/\\Z$/.test(n)===!1){try{new RegExp(n,r.regexFlags??Xt);return}catch{}return e.createError(`format-regex-error`,{value:n,pointer:t,schema:r})}return e.createError(`format-regex-error`,{value:n,pointer:t,schema:r})}},time:({node:e,pointer:t,data:n})=>{let{schema:r}=e;if(typeof n!=`string`||n===``)return;let i=n.match(en);if(!i)return e.createError(`format-date-time-error`,{value:n,pointer:t,schema:r});if(i.groups?.second===`60`){if(/23:59:60(z|\+00:00)/i.test(n))return;let a=i.groups.time.match(/(\d+):(\d+):/),o=i.groups.offset.match(/(\d+):(\d+)/);if(a&&o){let e=parseInt(a[1]),t=parseInt(o[1]),n=parseInt(a[2]),r=parseInt(o[2]),s;s=/^-/.test(i.groups.offset)?(e+t)*60+(n+r):(24+e-t)*60+(n-r);let c=Math.floor(s/60),l=c%24,u=s-c*60;if(l===23&&u===59)return}return e.createError(`format-date-time-error`,{value:n,pointer:t,schema:r})}},url:({node:e,data:t,pointer:n})=>{let{schema:r}=e;if(!(t===``||a(`${t}`)))return e.createError(`format-url-error`,{value:t,pointer:n,schema:r})},uuid:({node:e,data:t,pointer:n})=>{let{schema:r}=e;if(typeof t==`string`&&t!==``&&!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t))return e.createError(`format-uuid-error`,{value:t,pointer:n,schema:r})}};function on(e,t){if(e.oneOf)return e.oneOf.map(e=>e.resolveRef());if(e.items?.oneOf)return e.items.oneOf.map(e=>e.resolveRef());if(e.prefixItems&&e.prefixItems.length>+t){let{node:n,error:r}=e.getNodeChild(t);return n?[n]:r}if(e.schema.additionalItems){if(e.schema.additionalItems===!0)return[e.compileSchema({type:`string`})];if(e.items)return[e.items.resolveRef()]}if(e.prefixItems&&e.prefixItems.length<=+t)return[];let{node:n,error:r}=e.getNodeChild(t);return n?[n]:r}const sn=[`string`,`number`,`integer`,`boolean`,`null`,`array`,`object`],cn=[`additionalProperties`,`dependencies`,`dependentSchemas`,`dependentRequired`,`maxProperties`,`minProperties`,`patternProperties`,`properties`,`propertyNames`,`required`,`unevaluatedProperties`],ln=[`contains`,`items`,`maxItems`,`minItems`,`unevaluatedItems`,`uniqueItems`];function L(e,t){let n=u(t),r=e.schema;if(r===!0)return n===`bigint`?`number`:sn.some(e=>e===n)?n:void 0;if(!d(r))return;let i=r.type;if(Array.isArray(i)){if(i.includes(n))return n;let e=u(r.default);return i.includes(e)?e:i[0]}if(i)return i;if(Array.isArray(r.enum)){let e=r.enum.map(e=>u(e)).filter((e,t,n)=>n.indexOf(e)===t);if(e.includes(n))return n;let t=u(r.default);return e.includes(t)?t:e[0]}let a=Object.keys(e.schema),o=a.filter(e=>cn.includes(e)),s=a.filter(e=>ln.includes(e));if(o.length>0&&o.length>s.length)return`object`;if(s.length>0&&s.length>o.length)return`array`;if(e.if)return L(e.if.resolveRef()??e.if,t);if(e.allOf)for(let n of e.allOf){let e=L(n.resolveRef()??n,t);if(e)return e}if(e.oneOf)for(let n of e.oneOf){let e=L(n.resolveRef()??n,t);if(e)return e}if(e.anyOf)for(let n of e.anyOf){let e=L(n.resolveRef()??n,t);if(e)return e}if(r.$ref){let n=e.resolveRef();if(n)return L(n,t)}}function un(e){switch(u(e)){case`string`:case`array`:return e?.length===0;case`null`:case`undefined`:return!0;case`object`:return Object.keys(e).length===0;default:return!1}}const R=`oneOf`,{DECLARATOR_ONEOF:dn}=c,fn={id:R,keyword:R,parse:mn,addReduce:e=>e[R]!=null,reduce:hn,addValidate:e=>e[R]!=null,validate:bn},pn={id:`oneOf-fuzzy`,keyword:`oneOf`,parse:mn,addReduce:e=>e.oneOf!=null,reduce:vn,addValidate:e=>e.oneOf!=null,validate:bn};function mn(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e;if(t[R]!=null){if(!Array.isArray(t[R]))return e.createError(`schema-error`,{pointer:r,schema:t,value:t[R],message:`Keyword '${R}' must be an array - received '${typeof t[R]}'`});if(t[R].length!==0)return e[R]=t[R].map((t,i)=>e.compileSchema(t,`${n}/${R}/${i}`,`${r}/${R}/${i}`)),E([],...e[R])}}function hn({node:e,data:t,pointer:n,path:r}){if(e.oneOf==null)return;if(t!=null&&e.schema[dn])return gn({node:e,data:t,pointer:n,path:r});let i=[],a=[];for(let o=0;o<e.oneOf.length;o+=1){let s=_(e.oneOf[o],t,n,r);s.length===0?i.push({index:o,node:e.oneOf[o]}):a.push(...s)}if(i.length===1){let{node:e,index:a}=i[0],{node:o,error:s}=e.reduceNode(t,{pointer:n,path:r});if(o){let t=o.dynamicId?.replace(e.dynamicId,``)??``,n=t===``?`oneOf/${a}`:t;return o.oneOfIndex=a,o.dynamicId=we(o.dynamicId,`+${e.schemaLocation}(${n})`),o}return s}return i.length,e.createError(`one-of-error`,{value:JSON.stringify(t),pointer:n,schema:e.schema,oneOf:e.schema.oneOf,errors:a})}function gn({node:e,data:t,pointer:n,path:r}){if(e.oneOf==null)return;let i=e.schema[dn],a=y(t,i);if(t===void 0||a===void 0)return e.createError(`missing-one-of-property-error`,{oneOfProperty:i,pointer:n,schema:e.schema,value:t});let o=[];for(let c=0;c<e.oneOf.length;c+=1){let{node:l}=e.oneOf[c].getNodeChild(i,t);if(!b(l))return e.createError(`missing-one-of-declarator-error`,{declarator:dn,oneOfProperty:i,schemaLocation:e.oneOf[c].schemaLocation,pointer:`${n}/oneOf/${c}`,schema:e.schema,value:t});let u=s(_(l,a,`${n}/${i}`,r));if(u.length>0)o.push(...u);else{let{node:i}=e.oneOf[c].reduceNode(t,{pointer:n,path:r});if(i)return i.oneOfIndex=c,i}}return e.createError(`one-of-property-error`,{property:i,value:t,pointer:n,schema:e.schema,errors:o})}function _n(e,t,n,r){if(t==null||e.properties==null)return-1;let i=0,a=Object.keys(e.properties??{});for(let o of a)t[o]&&_(e.properties[o],t[o],n,r).length===0&&(i+=1);return i}function vn({node:e,data:t,pointer:n,path:r}){if(e.oneOf==null)return e;let i=hn({node:e,data:t,pointer:n,path:r});if(b(i))return i;if(d(t)){let i,a=-1,o=0;for(let s=0;s<e.oneOf.length;s+=1){let c=e.oneOf[s],l=_n(c,t,n,r);o<l&&(o=l,i=c,a=s)}if(i===void 0)return e.createError(`one-of-error`,{value:JSON.stringify(t),pointer:n,schema:e.schema,oneOf:e.schema.oneOf});let{node:s,error:c}=i.reduceNode(t,{pointer:n,path:r});return s?(s.oneOfIndex=a,s):c}else if(Array.isArray(t)){let i,a=-1,o=1/0;for(let n=0;n<e.oneOf.length;n+=1){let r=e.oneOf[n],{errors:s}=r.validate(t),c=s.length;c<o&&(o=c,i=r,a=n)}if(i===void 0)return e.createError(`one-of-error`,{value:JSON.stringify(t),pointer:n,schema:e.schema,oneOf:e.schema.oneOf});let{node:s,error:c}=i.reduceNode(t,{pointer:n,path:r});return s?(s.oneOfIndex=a,s):c}return i}function yn({node:e,data:t,pointer:n=`#`,path:r}){let{oneOf:i,schema:a}=e;if(!i)return;let o=a[dn],s=y(t,o),c=[],l=[];for(let e of i){let{node:t,error:a}=e.getNodeChild(o,s);if(t){let a=_(t,s,`${n}/${o}`,r);a.length>0?l.push(...a):c.push({index:i.indexOf(e),node:e})}else console.log(`jlib oneOf error: failed getting schema for '${o}' to resolve ${dn} in ${n}/oneOf/${i.indexOf(e)}`,a)}if(c.length===1){let e=c[0];return e.node.oneOfIndex=e.index,_(e.node,t,n,r)}return c.length>1?e.createError(`multiple-one-of-error`,{value:t,pointer:n,schema:a,matches:c}):e.createError(`one-of-error`,{value:JSON.stringify(t),pointer:n,schema:a,oneOf:a.oneOf,errors:l})}function bn({node:e,data:t,pointer:n=`#`,path:r}){let{oneOf:i,schema:a}=e;if(!i)return;if(a[dn])return yn({node:e,data:t,pointer:n,path:r});let o=[],s=[];for(let e=0;e<i.length;e+=1){let a=_(i[e],t,n,r);a.length>0?s.push(...a):o.push({index:e,node:i[e]})}if(o.length===1){let{node:e,index:t}=o[0];e.oneOfIndex=t;return}return o.length>1?e.createError(`multiple-one-of-error`,{value:t,pointer:n,schema:a,matches:o}):e.createError(`one-of-error`,{value:JSON.stringify(t),pointer:n,schema:a,oneOf:a.oneOf,errors:s})}let xn=()=>!1;try{typeof File==`function`&&(xn=e=>e instanceof File)}catch{}function Sn(e,t){if(e.$ref==null)return;t.cache=t.cache??{};let{cache:n,recursionLimit:r=1}=t,i=e.schemaLocation;if(n[i]=n[i]??{},n[i][e.$ref]=n[i][e.$ref]??0,n[i][e.$ref]>=r&&t.disableRecursionLimit!==!0)return!1;t.disableRecursionLimit=!1,n[i][e.$ref]+=1;let a=e.resolveRef();if(a&&a!==e)return a}function Cn(e,t){return(t.cache?.[e.schemaLocation]?.[e.$ref]??-1)<(t.recursionLimit??1)}function wn(e,t){let n=u(t);if(e===void 0||t==null||n===e||n===`number`&&e===`integer`)return t;if(e===`string`)return JSON.stringify(t);if(n!==`string`)return t;try{let n=JSON.parse(t);if(u(n)===e)return n}catch{}return t}function Tn(e,t,n){if(n?.cache==null)throw Error(`Missing options`);if(e.schema===!1||e.schema===!0||xn(t))return t;if(e.schema?.const!==void 0)return e.schema?.const;let r=e,i=t;if(Array.isArray(e.schema.enum)&&e.schema.enum.length>0&&t===void 0)return e.schema.default??e.schema.enum[0];if(e.schema.default!==void 0&&i===void 0&&(i=e.schema.default),r.allOf?.length&&r.allOf.forEach(e=>{i=e.getData(i,n)??i}),r.anyOf&&r.anyOf?.length>0&&(i=r.anyOf[0].getData(i,n)??i),r.oneOf&&r.oneOf?.length>0)if(un(i))r=g(r,r.oneOf[0]);else{let e=vn({node:r,data:i,path:[],pointer:`#`});if(C(e)){if(i!=null&&n.removeInvalidData!==!0)return i;r=r.oneOf[0],i=void 0}else r=g(r,e)}let a=Sn(r,n);if(a===!1)return i;b(a)&&(i=a.getData(i,n)??i,r=a);let o=L(r,i),s=En[o]?.(r,i,n);return s===void 0?i:s}const En={null:(e,t,n)=>Dn(e,t,null,n.useTypeDefaults),string:(e,t,n)=>Dn(e,t,``,n.useTypeDefaults),number:(e,t,n)=>Dn(e,t,0,n.useTypeDefaults),integer:(e,t,n)=>Dn(e,t,0,n.useTypeDefaults),boolean:(e,t,n)=>Dn(e,t,!1,n.useTypeDefaults),object:(e,t,n)=>{let r=e.schema,i=r.default===void 0?{}:r.default,a={},o=n.extendDefaults===!1&&r.default!==void 0?[]:r.required??[],s=e.properties;s&&Object.keys(s).forEach(e=>{let r=s[e],c=o.includes(e),l=y(t,e),d=t===void 0||l===void 0?y(i,e):l;if(d!==void 0||c||n.addOptionalProps){let t=r.getData(d,n),i=u(t);if(n.removeInvalidData&&i!==`object`&&i!==`array`&&!r.validate(t).valid)return;(t!==void 0||n.useTypeDefaults!==!1)&&(a[e]=t)}});let c=e.dependentRequired;d(c)&&Object.keys(c).forEach(t=>{let r=c[t];y(a,t)!==void 0&&r.forEach(t=>{let{node:r}=e.getNodeChild(t,a);r&&(a[t]=r.getData(y(a,t),n))})});let l=e.dependentSchemas;if(l&&Object.keys(l).forEach(e=>{let r=l[e];if(a[e]!==void 0&&b(r)){let e=r.getData(t??a,n);Object.assign(a,e)}}),t)if(n.removeInvalidData===!0&&(r.additionalProperties===!1||d(r.additionalProperties))){let n=e.additionalProperties;b(n)&&Object.keys(t).forEach(e=>{if(a[e]==null){let r=y(t,e);n.validate(r).valid&&(a[e]=r)}})}else Object.keys(t).forEach(r=>{let i=u(r);if(n.removeInvalidData&&e.properties&&e.properties[r]&&i!==`object`&&i!==`array`){let i=e.properties[r],a=i.getData(y(t,r),n);if(!i.validate(a).valid)return}a[r]??(a[r]=y(t,r))});if(e.if){let{valid:t}=e.if.validate(a);if(t&&e.then){let t=e.then.getData(a,n);Object.assign(a,t)}else if(!t&&e.else){let t=e.else.getData(a,n);Object.assign(a,t)}}return{...i,...a}},array:(t,n,r)=>{let i=t.schema,a=i.default===void 0?[]:i.default,o=Array.isArray(n)?[...n]:a,s=r.extendDefaults===!1&&i.default!==void 0?0:i.minItems??0;if(i.items==null){if(t.items){let e=Math.max(s,o.length);for(let n=0;n<e;n+=1)o[n]=t.items.getData(o[n],r)}return o||[]}if(t.prefixItems){let e=Array.isArray(n)?n:[],i=Math.max(s??0,t.prefixItems.length);for(let n=0;n<i;n+=1){let i=t.prefixItems[n]??t.items;if(i&&Cn(i,r)||e[n]!==void 0){let e=i.getData(o[n]==null?a[n]:o[n],r);e!==void 0&&(o[n]=e)}}return o||[]}if(t.items==null)return o;if(t.items&&Cn(t.items,r)||Array.isArray(n)&&n?.length>0){let n={...r.cache};for(let i=0,c=Math.max(s,o.length);i<c;i+=1){r.cache=e(n);let s={...r,disableRecursionLimit:!0},c=t.items.getData(o[i]==null?a[i]:o[i],s);if(c===void 0)return o;o[i]=c}}return o}};function Dn({schema:e},t,n,r){return t===void 0?e.const?e.const:e.default===void 0&&Array.isArray(e.enum)?e.enum[0]:e.default===void 0&&r!==!1?n:e.default:wn(e.type,t)}const z=`items`,On={id:z,keyword:z,parse:An,addResolve:e=>(e.prefixItems||e[z])!=null,resolve:kn,addValidate:({schema:e})=>e.items!=null,validate:jn};function kn({node:e,key:t}){if(e.prefixItems?.[t])return e.prefixItems[t];if(e.items)return e.items}function An(e){let{schema:t,evaluationPath:n}=e,r=t[z];if(r!=null&&typeof r!=`boolean`){if(d(r)){e.items=e.compileSchema(r,`${n}/${z}`,`${e.schemaLocation}/${z}`);return}if(Array.isArray(r)){e.prefixItems=r.map((t,r)=>e.compileSchema(t,`${n}/${z}/${r}`,`${e.schemaLocation}/${z}/${r}`));return}return e.createError(`schema-error`,{pointer:n,schema:t,value:void 0,message:`Keyword '${z}' must be an object or array - received '${typeof r}'`})}}function jn({node:e,data:t,pointer:n=`#`,path:r}){let{schema:i}=e;if(!Array.isArray(t)||t.length===0)return;if(i.items===!1)return Array.isArray(t)&&t.length===0?void 0:e.createError(`invalid-data-error`,{pointer:n,value:t,schema:i});let a=[];if(e.prefixItems){for(let i=0;i<Math.min(e.prefixItems.length,t.length);i+=1){let o=t[i],s=e.prefixItems[i],c=_(s,o,`${n}/${i}`,r);a.push(...c)}return a}if(e.items){for(let i=0;i<t.length;i+=1){let o=t[i],s=_(e.items,o,`${n}/${i}`,r);s&&a.push(...s)}return a}}const B=`maximum`,Mn={id:B,keyword:B,parse:Nn,addValidate:e=>e.maximum!=null,validate:Pn};function Nn(e){let t=e.schema[B];if(t!=null){if(!w(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${B}`,schema:e.schema,value:t,message:`Keyword '${B}' must be a number - received '${typeof t}'`});e[B]=t}}function Pn({node:e,data:t,pointer:n}){if(!w(t))return;let r=e[B],{schema:i}=e;if(r&&r<t)return e.createError(`maximum-error`,{maximum:r,length:t,value:t,pointer:n,schema:i});if(r&&i.exclusiveMaximum===!0&&r===t)return e.createError(`maximum-error`,{maximum:r,length:t,pointer:n,schema:i,value:t})}const Fn=`maxItems`,In={id:Fn,keyword:Fn,parse:Ln,addValidate:({schema:e})=>!isNaN(e.maxItems),validate:Rn};function Ln(e){let t=e.schema[Fn];if(t!=null){if(!w(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Fn}`,schema:e.schema,value:t,message:`Keyword '${Fn}' must be a number - received '${typeof t}'`});e[Fn]=t}}function Rn({node:e,data:t,pointer:n}){let{schema:r}=e;if(Array.isArray(t)&&r.maxItems<t.length)return e.createError(`max-items-error`,{maximum:r.maxItems,length:t.length,schema:r,value:t,pointer:n})}function zn(e){let t=[],n=0,r=e.length;for(;n<r;){let i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){let r=e.charCodeAt(n++);(r&64512)==56320?t.push(((i&1023)<<10)+(r&1023)+65536):(t.push(i),n--)}else t.push(i)}return t}const V=`maxLength`,Bn={id:V,keyword:V,parse:Vn,addValidate:e=>e[V]!=null,validate:Hn};function Vn(e){let t=e.schema[V];if(t!=null){if(!w(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${V}`,schema:e.schema,value:t,message:`Keyword '${V}' must be a number - received '${typeof t}'`});e[V]=t}}function Hn({node:e,data:t,pointer:n=`#`}){if(typeof t!=`string`)return;let r=e[V],i=zn(t).length;if(r<i)return e.createError(`max-length-error`,{maxLength:r,length:i,pointer:n,schema:e.schema,value:t})}const H=`maxProperties`,Un={id:H,keyword:H,parse:Wn,addValidate:e=>e[H]!=null,validate:Gn};function Wn(e){let t=e.schema[H];if(t!=null){if(!w(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${H}`,schema:e.schema,value:t,message:`Keyword '${H}' must be a number - received '${typeof t}'`});e[H]=t}}function Gn({node:e,data:t,pointer:n=`#`}){if(!d(t))return;let r=e[H],i=Object.keys(t).length;if(r<i)return e.createError(`max-properties-error`,{maxProperties:r,length:i,pointer:n,schema:e.schema,value:t})}const U=`minimum`,Kn={id:U,keyword:U,parse:qn,addValidate:e=>e[U]!=null,validate:Jn};function qn(e){let t=e.schema[U];if(t!=null){if(!w(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${U}`,schema:e.schema,value:t,message:`Keyword '${U}' must be a number - received '${typeof t}'`});e[U]=t}}function Jn({node:e,data:t,pointer:n}){if(!w(t))return;let r=e[U];if(r>t||e.schema.exclusiveMinimum===!0&&e.schema.minimum===t)return e.createError(`minimum-error`,{minimum:r,length:t,pointer:n,schema:e.schema,value:t})}const W=`minItems`,Yn={id:W,keyword:W,parse:Xn,addValidate:e=>e[W]!=null,validate:Zn};function Xn(e){let t=e.schema[W];if(t!=null){if(!w(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${W}`,schema:e.schema,value:t,message:`Keyword '${W}' must be a number - received '${typeof t}'`});e[W]=t}}function Zn({node:e,data:t,pointer:n}){if(!Array.isArray(t))return;let r=e[W];if(r>t.length)return e.createError(`min-items-error`,{minItems:r,length:t.length,pointer:n,schema:e.schema,value:t})}const G=`minLength`,Qn={id:G,keyword:G,parse:$n,addValidate:e=>e[G]!=null,validate:er};function $n(e){let t=e.schema[G];if(t!=null){if(!w(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${G}`,schema:e.schema,value:t,message:`Keyword '${G}' must be a number - received '${typeof t}'`});e[G]=t}}function er({node:e,data:t,pointer:n=`#`}){if(typeof t!=`string`)return;let r=zn(t).length,i=e[G];if(!(i<=r))return e.createError(`min-length-error`,{minLength:i,length:r,pointer:n,schema:e.schema,value:t})}const K=`minProperties`,tr={id:K,keyword:K,parse:nr,addValidate:e=>e[K]!=null,validate:rr};function nr(e){let t=e.schema[K];if(t!=null){if(!w(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${K}`,schema:e.schema,value:t,message:`Keyword '${K}' must be a number - received '${typeof t}'`});e[K]=t}}function rr({node:e,data:t,pointer:n=`#`}){if(!d(t))return;let r=Object.keys(t).length;if(e.schema.minProperties>r)return e.createError(`min-properties-error`,{minProperties:e.schema.minProperties,length:r,pointer:n,schema:e.schema,value:t})}function ir(e){let t=`${e}`;if(t.includes(`e-`))return parseInt(t.replace(/.*e-/,``));let n=t.indexOf(`.`);return n===-1?0:t.length-(n+1)}const q=`multipleOf`,ar={id:q,keyword:q,parse:or,addValidate:e=>e[q]!=null,validate:sr};function or(e){let t=e.schema[q];if(t!=null){if(!w(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${q}`,schema:e.schema,value:t,message:`Keyword '${q}' must be a number - received '${typeof t}'`});e[q]=t}}function sr({node:e,data:t,pointer:n}){if(typeof t!=`number`)return;let r=e[q],i=ir(t),a=ir(r);if(i>a)return e.createError(`multiple-of-error`,{multipleOf:r,value:t,pointer:n,schema:e.schema});let o=10**a;if(Math.round(t*o)%Math.round(r*o)/o!==0)return e.createError(`multiple-of-error`,{multipleOf:r,value:t,pointer:n,schema:e.schema})}const cr={id:`not`,keyword:`not`,parse:lr,addValidate:e=>e.not!=null,validate:ur};function lr(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e,i=t.not;if(i!=null)return!x(i)&&!S(i)?e.createError(`schema-error`,{pointer:`${r}/not`,schema:t,value:i,message:`Keyword 'not' must be a valid JSON Schema - received '${typeof i}'`}):(e.not=e.compileSchema(t.not,`${n}/not`,`${r}/not`),e.not.schemaValidation)}function ur({node:e,data:t,pointer:n,path:r}){let{schema:i}=e;if(_(e.not,t,n,r).length===0)return e.createError(`not-error`,{value:t,not:i.not,pointer:n,schema:i})}const dr=`pattern`,{REGEX_FLAGS:fr}=c,pr={id:dr,keyword:dr,parse:mr,addValidate:e=>e[dr]!=null,validate:hr};function mr(e){let t=e.schema[dr];if(t!=null){if(typeof t!=`string`)return e.createError(`schema-error`,{pointer:e.schemaLocation,schema:e.schema,value:t,message:`Keyword 'pattern' must be a string - received '${typeof t}'`});try{e[dr]=new RegExp(t,e.schema.regexFlags??fr)}catch(n){return e.createError(`schema-error`,{pointer:e.schemaLocation,schema:e.schema,value:t,message:n.message})}}}function hr({node:e,data:t,pointer:n=`#`}){if(typeof t==`string`&&e.pattern.test(t)===!1){let{schema:r}=e;return e.createError(`pattern-error`,{pattern:r.pattern,description:r.patternExample||r.pattern,received:t,schema:r,value:t,pointer:n})}}const{REGEX_FLAGS:gr}=c,_r={id:`patternProperties`,keyword:`patternProperties`,parse:vr,addReduce:e=>e.patternProperties!=null,reduce:br,addResolve:e=>e.patternProperties!=null,resolve:yr,addValidate:e=>e.patternProperties!=null,validate:xr};function vr(e){let{schema:t}=e;if(!d(t.patternProperties))return;let n=Object.keys(t.patternProperties);if(n.length!==0)return e.patternProperties=n.map(n=>({name:n,pattern:new RegExp(n,t.regexFlags??gr),node:e.compileSchema(t.patternProperties[n],`${e.evaluationPath}/patternProperties/${n}`,`${e.schemaLocation}/patternProperties/${n}`)})),E([],...e.patternProperties.map(({node:e})=>e))}function yr({node:e,key:t}){return e.patternProperties?.find(({pattern:e})=>e.test(`${t}`))?.node}function br({node:e,data:t,key:n}){let{patternProperties:r}=e;if(r==null)return;let i,a=Object.keys(t??{});n&&a.push(`${n}`);let o=`${e.schemaLocation}(`;return a.push(...Object.keys(e.schema.properties??{})),a.forEach((t,n,a)=>{if(a.indexOf(t)!==n)return;let s=e.schema.properties?.[t]??{},c=r.filter(e=>e.pattern.test(t));c.forEach(e=>s=h(s,e.node.schema)),c.length>0&&(i??={properties:{}},i.properties[t]=s,o+=`${c.map(({name:e})=>`patternProperties/${e}`).join(`,`)}`)}),i==null?e:(i=h(e.schema,i,`patternProperties`),e.compileSchema(i,e.evaluationPath,e.schemaLocation,`${o})`))}function xr({node:e,data:t,pointer:n,path:r}){if(!d(t))return;let{schema:i,patternProperties:a}=e,o=i.properties||{},s=Object.keys(i.patternProperties).join(`,`),c=[];return Object.keys(t).forEach(l=>{let u=y(t,l),d=a.filter(e=>e.pattern.test(l));d.forEach(({node:e})=>c.push(..._(e,u,`${n}/${l}`,r))),!o[l]&&d.length===0&&i.additionalProperties===!1&&c.push(e.createError(`no-additional-properties-error`,{key:l,pointer:`${n}/${l}`,schema:i,value:u,patterns:s}))}),c}const Sr={id:`property`,keyword:`properties`,parse:wr,addResolve:e=>e.properties!=null,resolve:Cr,addValidate:e=>e.properties!=null,validate:Tr};function Cr({node:e,key:t}){return e.properties?.[t]}function wr(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e;if(t.properties==null)return;if(t.properties&&!d(t.properties))return e.createError(`schema-error`,{pointer:r,schema:t,value:void 0,message:"keyword `properties` must be of type `object`"});let i=[],a={};return Object.keys(t.properties).forEach(o=>{let s=e.compileSchema(t.properties[o],`${n}/properties/${o}`,`${r}/properties/${o}`);a[o]=s,E(i,a[o])}),e.properties=a,i}function Tr({node:e,data:t,pointer:n,path:r}){if(!d(t))return;let i=[],a=e.properties??{};return Object.keys(t).forEach(e=>{let o=y(t,e),s=a[e];if(s==null||o===void 0)return;let c=_(s,o,`${n}/${e}`,r);i.push(...c)}),i}const J=`propertyNames`,Er={id:J,keyword:J,parse:Dr,addValidate:e=>e.schema[J]!=null,validate:Or};function Dr(e){let t=e.schema[J];if(t!=null){if(!(x(t)||S(t)))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${J}`,schema:e.schema,value:t,message:`Keyword '${J}' must be a valid JSON Schema - received '${typeof t}'`});if(!S(t))return e.propertyNames=e.compileSchema(t,`${e.evaluationPath}/propertyNames`,`${e.schemaLocation}/propertyNames`),e.propertyNames.schemaValidation}}function Or({node:e,data:t,pointer:n,path:r}){let{schema:i}=e;if(!d(t))return;if(i.propertyNames===!1)return Object.keys(t).length===0?void 0:e.createError(`invalid-property-name-error`,{property:Object.keys(t),pointer:n,value:t,schema:i});if(i[J]===!0)return;let a=e[J];if(!d(a))return;let o=[];return Object.keys(t).forEach(s=>{let c=_(a,s,`${n}/${s}`,r);c.length>0&&o.push(e.createError(`invalid-property-name-error`,{property:s,pointer:n,validationError:c[0],value:t[s],schema:i}))}),o}const kr=`required`,Ar={id:kr,keyword:kr,parse:jr,addValidate:e=>e.required!=null,validate:Mr};function jr(e){let t=e.schema[kr];if(t!=null){if(!St(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${kr}`,schema:e.schema,value:t,message:`Keyword '${kr}' must be a string[]`});e.required=t}}function Mr({node:e,data:t,pointer:n=`#`}){let{required:r}=e;if(d(t))return r.map(r=>{if(!v(t,r))return e.createError(`required-property-error`,{key:r,pointer:n,schema:e.schema,value:t})})}function Nr(e){return{...e,keywords:[...e.keywords.map(e=>({...e}))]}}function Pr(e,t){let{keywords:n}=Fr(e,...t.keywords??[]),r={...e.errors,...t.errors??{}},i={...e.formats,...t.formats??{}};return Lr({...e,...t,formats:i,keywords:n,errors:r})}function Fr(e,...t){let n=Nr(e);return t.forEach(e=>Ir(n,e)),n}function Ir(e,t){let n=e.keywords.findIndex(e=>e.keyword===t.keyword);n===-1?e.keywords.push(t):e.keywords[n]=t}function Lr(e){return e.keywords?.forEach(e=>{let t=()=>e.keyword;e.validate&&(e.validate.toJSON=t,e.validate.order=e.order??0),e.reduce&&(e.reduce.toJSON=t,e.reduce.order=e.order??0),e.resolve&&(e.resolve.toJSON=t,e.resolve.order=e.order??0)}),e.keywords?.sort((e,t)=>(t.order??0)-(e.order??0)),e}function Rr(e,t,n=`#`,r=[]){let i=e.resolveRef()??e;return r.push({node:i,value:t,pointer:n}),d(t)?Object.keys(t).forEach(e=>{let{node:a}=i.getNodeChild(e,t);a&&Rr(a,y(t,e),`${n}/${e}`,r)}):Array.isArray(t)&&t.forEach((e,a)=>{let{node:o}=i.getNodeChild(a,t);o&&Rr(o,y(t,a),`${n}/${a}`,r)}),r}const Y=`type`,zr=[`null`,`boolean`,`number`,`integer`,`string`,`object`,`array`],Br={id:Y,keyword:Y,parse:Vr,addReduce:e=>Array.isArray(e.type),reduce:Hr,addValidate:e=>e.type!=null,validate:Wr};function Vr(e){let t=e.schema[Y];if(t!=null){if(typeof t!=`string`&&!Array.isArray(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Y}`,schema:e.schema,value:t,message:`Keyword '${Y}' must be a string or a string[] - received ${typeof t}`});if(typeof t==`string`&&!zr.includes(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Y}`,schema:e.schema,value:t,message:`Keyword '${Y}' is not a valid JSON Schema type - received '${t}'. Expected one of ${zr.join(`, `)}`});if(Array.isArray(t)){let n=t.findIndex(e=>!zr.includes(e));if(n!==-1)return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Y}/${n}`,schema:e.schema,value:t[n],message:`Keyword '${Y}' contains an invalid JSON Schema type: '${t[n]}'`})}e[Y]=t}}function Hr({node:e,pointer:t,data:n}){let r=Ur(n,e.type);if(r!==`undefined`&&Array.isArray(e.schema.type)&&e.schema.type.includes(r))return e.compileSchema({...e.schema,pointer:t,type:r},e.evaluationPath)}function Ur(e,t){let n=u(e);return n===`number`&&(t===`integer`||Array.isArray(t)&&t.includes(`integer`))?Number.isInteger(e)||isNaN(e)?`integer`:`number`:n}function Wr({node:e,data:t,pointer:n}){let r=e[Y],i=Ur(t,r);if(!(t===void 0||r===i||Array.isArray(r)&&r.includes(i)))return e.createError(`type-error`,{value:t,received:i,expected:r,schema:e.schema,pointer:n})}const Gr=`uniqueItems`,Kr={id:Gr,keyword:Gr,parse:qr,addValidate:({schema:e})=>e[Gr]===!0,validate:Jr};function qr(e){let t=e.schema[Gr];if(t!=null&&t!==!1){if(typeof t!=`boolean`)return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Gr}`,schema:e.schema,value:t,message:`Keyword '${Gr}' must be a boolean - received ${typeof t}`});e.uniqueItems=!0}}function Jr({node:e,data:t,pointer:n}){if(!Array.isArray(t))return;let{schema:r}=e,i=[],a=[];return t.forEach((s,c)=>{for(let l=c+1;l<t.length;l+=1)o(s,t[l])&&!i.includes(l)&&(a.push(e.createError(`unique-items-error`,{pointer:`${n}/${l}`,duplicatePointer:`${n}/${c}`,arrayPointer:n,value:JSON.stringify(s),schema:r})),i.push(l))}),a}const Yr=Lr({version:`draft-04`,$schemaRegEx:`draft-?0?4`,$schema:`http://json-schema.org/draft-04/schema#`,errors:Bt,formats:I,methods:{createSchema:f,getData:Tn,getChildSelection:on,toDataNodes:Rr},keywords:[Xe,dt,ht,yt,Ue,At,Pt,Lt,Vt,Wt,qt,On,Mn,In,Bn,Un,Kn,Yn,Qn,tr,ar,cr,_r,pr,Sr,Er,Ar,Br,Kr,fn,rt,st]}),Xr={id:`const`,keyword:`const`,addValidate:({schema:e})=>e.const!==void 0,validate:Zr};function Zr({node:e,data:t,pointer:n}){if(!o(t,e.schema.const))return[e.createError(`const-error`,{pointer:n,schema:e.schema,value:t,expected:e.schema.const})]}const Qr=`exclusiveMaximum`,$r={id:Qr,keyword:Qr,parse:ei,addValidate:({schema:e})=>e.exclusiveMaximum!=null&&!isNaN(parseInt(e.exclusiveMaximum)),validate:ti};function ei(e){let t=e.schema[Qr];if(t!=null&&typeof t!=`number`)return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Qr}`,schema:e.schema,value:t,message:`Keyword '${Qr}' must be a number - received '${typeof t}'`})}function ti({node:e,data:t,pointer:n}){if(typeof t==`number`&&e.schema.exclusiveMaximum<=t)return e.createError(`exclusive-maximum-error`,{maximum:e.schema.exclusiveMaximum,length:t,pointer:n,schema:e.schema,value:t})}const ni=`exclusiveMinimum`,ri={id:ni,keyword:ni,parse:ii,addValidate:({schema:e})=>e[ni]!=null&&!isNaN(parseInt(e[ni])),validate:ai};function ii(e){let t=e.schema[ni];if(t!=null&&typeof t!=`number`)return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${ni}`,schema:e.schema,value:t,message:`Keyword '${ni}' must be a number - received '${typeof t}'`})}function ai({node:e,data:t,pointer:n}){if(typeof t==`number`&&e.schema.exclusiveMinimum>=t)return e.createError(`exclusive-minimum-error`,{minimum:e.schema.exclusiveMinimum,length:t,pointer:n,schema:e.schema,value:t})}const oi=Lr({version:`draft-06`,$schemaRegEx:`draft-?0?6`,$schema:`http://json-schema.org/draft-06/schema#`,errors:Bt,formats:I,methods:{createSchema:f,getData:Tn,getChildSelection:on,toDataNodes:Rr},keywords:[Ke,dt,ht,Xr,yt,Ue,At,Pt,Lt,$r,ri,qt,On,Mn,In,Bn,Un,Kn,Yn,Qn,tr,ar,cr,_r,pr,Sr,Er,Ar,Br,Kr,fn,rt,st]}),si={id:`if-then-else`,keyword:`if`,parse:ci,addReduce:e=>e.if!=null&&(e.then!=null||e.else!=null),reduce:li,addValidate:e=>e.if!=null,validate:ui};function ci(e){let{schema:t,evaluationPath:n}=e,r=[];return t.if!=null&&(x(t.if)||S(t.if)?(e.if=e.compileSchema(t.if,`${n}/if`),E(r,e.if)):r.push(e.createError(`schema-error`,{pointer:`${e.schemaLocation}/if`,schema:e.schema,value:t.if,message:`Keyword 'if' must be valid JSON Schema - received '${typeof t.if}'`}))),t.then!=null&&(x(t.then)||S(t.then)?(e.then=e.compileSchema(t.then,`${n}/then`),E(r,e.then)):r.push(e.createError(`schema-error`,{pointer:`${e.schemaLocation}/then`,schema:e.schema,value:t.then,message:`Keyword 'then' must be valid JSON Schema - received '${typeof t.then}'`}))),t.else!=null&&(x(t.else)||S(t.else)?(e.else=e.compileSchema(t.else,`${n}/else`),E(r,e.else)):r.push(e.createError(`schema-error`,{pointer:`${e.schemaLocation}/else`,schema:e.schema,value:t.else,message:`Keyword 'else' must be valid JSON Schema - received '${typeof t.else}'`}))),r}function li({node:e,data:t,pointer:n,path:r}){if(t!==void 0&&e.if!=null){if(_(e.if,t,n,[...r??[]]).length===0){if(e.then){let{node:n}=e.then.reduceNode(t);if(n){let t=n.dynamicId?.replace(e.dynamicId,``).replace(/^#/,``)??``,r=t===``?`(then)`:t,i=h(e.then.schema,n.schema,`if`,`then`,`else`);return e.compileSchema(i,e.then.evaluationPath,e.schemaLocation,`${e.schemaLocation}${r}`)}}}else if(e.else){let{node:n}=e.else.reduceNode(t);if(n){let t=n.dynamicId?.replace(e.dynamicId,``)??``,r=t===``?`(else)`:t,i=h(e.else.schema,n.schema,`if`,`then`,`else`);return e.compileSchema(i,e.else.evaluationPath,e.schemaLocation,`${e.schemaLocation}${r}`)}}}}function ui({node:e,data:t,pointer:n,path:r}){if(e.if!=null){if(_(e.if,t,n,[...r??[]]).length===0){if(e.then)return _(e.then,t,n,r)}else if(e.else)return _(e.else,t,n,r)}}const di=Lr({version:`draft-07`,$schemaRegEx:`draft-?0?7`,$schema:`http://json-schema.org/draft-07/schema#`,errors:Bt,formats:I,methods:{createSchema:f,getData:Tn,getChildSelection:on,toDataNodes:Rr},keywords:[Ke,dt,ht,Xr,yt,Ue,At,Pt,Lt,$r,ri,qt,si,On,Mn,In,Bn,Un,Kn,Yn,Qn,tr,ar,cr,_r,pr,Sr,Er,Ar,Br,Kr,fn,rt,st]}),fi={id:`$ref`,keyword:`$ref`,parse:mi,addValidate:({schema:e})=>e.$ref!=null||e.$recursiveRef!=null,validate:gi,addReduce:({schema:e})=>e.$ref!=null||e.$recursiveRef!=null,reduce:Re};function pi(e,t){e.context.refs[t]??(e.context.refs[t]=e)}function mi(e){e.resolveRef=hi;let t=m(e.parent?.$id,e.schema?.$id);e.$id=t,e.lastIdPointer=e.parent?.lastIdPointer??`#`,t!==e.parent?.$id&&e.evaluationPath!==`#`&&(e.lastIdPointer=e.evaluationPath),e.lastIdPointer!==`#`&&e.evaluationPath.startsWith(e.lastIdPointer)&&pi(e,m(t,`#${e.evaluationPath.replace(e.lastIdPointer,``)}`)),pi(e,m(e.context.rootNode.$id,e.evaluationPath)),e.schema.$anchor&&(e.context.anchors[`${t.replace(/#$/,``)}#${e.schema.$anchor}`]=e),e.schema.$ref&&(e.$ref=m(t,e.schema.$ref),e.$ref.startsWith(`/`)&&(e.$ref=`#${e.$ref}`))}function hi({pointer:e,path:t}={}){if(this.schema.$recursiveRef){let n=_i(this,t??[]);return b(n)&&t?.push({pointer:e,node:n}),n}if(this.$ref==null)return this;let n=vi(this);return b(n)&&t?.push({pointer:e,node:n}),n}function gi({node:e,data:t,pointer:n=`#`,path:r}){let i=e.resolveRef({pointer:n,path:r});return i==null?e.createError(`ref-error`,{ref:e.schema.$ref??e.schema.$recursiveRef,pointer:n,schema:e.schema,value:t}):_(i,t,n,r)}function _i(e,t){let n=t,r=0;for(let t=n.length-1;t>=0;t--){if(n[t].node.schema.$recursiveAnchor===!1)return vi(e,m(e.$id,e.schema.$recursiveRef));if(/^https?:\/\//.test(n[t].node.schema.$id??``)&&n[t].node.schema.$recursiveAnchor!==!0){r=t;break}}let i=n.find((e,t)=>t>=r&&e.node.schema.$recursiveAnchor===!0);return i?i.node:vi(e,m(e.$id,e.schema.$recursiveRef))}function vi(e,n=e?.$ref){if(n==null)return e;if(e.context.refs[n])return T(e.context.refs[n],e);if(e.context.anchors[n])return T(e.context.anchors[n],e);let i=Pe(n);if(i.length===0)return e.createError(`ref-error`,{ref:n,pointer:e.evaluationPath,schema:e.schema,value:void 0});if(i.length===1){let n=i[0];if(e.context.remotes[n])return T(e.context.remotes[n],e);if(n[0]===`#`){let r=n.match(/#[^#]*$/)?.pop(),i=e.context.rootNode.schema,a=t(i,r);if(a)return e.compileSchema(a,`${e.evaluationPath}/$ref`,r)}return e.createError(`ref-error`,{ref:n,pointer:e.evaluationPath,schema:e.schema,value:void 0})}if(i.length===2){let t=i[0];if(e.context.remotes[t]&&e!==e.context.remotes[t]){let r=e.context.remotes[t],a=vi(r,n);if(a||(a=vi(r,i[1]),a))return a}if(e.context.refs[t]){let a=e.context.refs[t],o=r(i[1]),s=a;for(let t of o)if(s=s[t===`definitions`?`$defs`:t],s==null)return e.createError(`ref-error`,{ref:n,pointer:e.evaluationPath,schema:e.schema,value:void 0,host:i[0],local:i[1]});return s}}return e.createError(`ref-error`,{ref:n,pointer:e.evaluationPath,schema:e.schema,value:void 0})}const yi=`unevaluatedItems`,bi={id:yi,keyword:yi,parse:xi,addValidate:({schema:e})=>e[yi]!=null,validate:Si};function xi(e){let{unevaluatedItems:t}=e.schema;if(t!=null&&typeof t!=`boolean`){if(!d(t))return e.createError(`schema-error`,{pointer:e.evaluationPath,schema:e.schema,value:void 0,message:`Keyword '${yi}' must be an object - received '${typeof t}'`});e.unevaluatedItems=e.compileSchema(e.schema.unevaluatedItems,`${e.evaluationPath}/${yi}`,`${e.schemaLocation}/${yi}`)}}function Si({node:e,data:t,pointer:n,path:r}){let{schema:i}=e;if(!Array.isArray(t)||t.length===0||i.unevaluatedItems==null||i.unevaluatedItems===!0)return;let{node:a}=e.reduceNode(t,{pointer:n,path:r});if(a??=e,a.schema.unevaluatedItems===!0||a.schema.additionalItems===!0)return;let o=e.if!=null&&_(e.if,t,n,r).length===0,s=[];for(let a=0;a<t.length;a+=1){let c=t[a],{node:l}=e.getNodeChild(a,t,{path:r});if(l&&_(l,c,`${n}/${a}`,r).length>0){let o=e.unevaluatedItems;if(o&&t.forEach(e=>{let t=_(o,e,`${n}/${a}`,r);if(t!=null){if(Array.isArray(t))return s.push(...t);s.push(t)}}),e.schema.unevaluatedItems===!1)return e.createError(`unevaluated-items-error`,{pointer:`${n}/${a}`,value:JSON.stringify(c),schema:i})}if(l===void 0&&!(o&&e.if.prefixItems&&e.if.prefixItems.length>a))if(e.unevaluatedItems){let t=_(e.unevaluatedItems,c,`${n}/${a}`,r);t.length>0&&s.push(...t)}else s.push(e.createError(`unevaluated-items-error`,{pointer:`${n}/${a}`,value:JSON.stringify(c),schema:i}))}return s}function X({node:e,data:t,key:n,pointer:r,path:i}){if(Array.isArray(e.schema.required)&&!e.schema.required.find(e=>v(t,e)))return!1;if(e.schema.unevaluatedProperties===!0||e.schema.additionalProperties===!0||e.properties?.[n]&&e.properties[n].validate(t[n],r,i).valid||e.patternProperties&&e.patternProperties.find(e=>e.pattern.test(n)))return!0;if(e.allOf){for(let a of e.allOf)if(X({node:a,data:t,key:n,pointer:r,path:i}))return!0}if(e.anyOf){for(let a of e.anyOf)if(X({node:a,data:t,key:n,pointer:r,path:i}))return!0}if(e.oneOf){for(let a of e.oneOf)if(X({node:a,data:t,key:n,pointer:r,path:i}))return!0}if(e.if){if(X({node:e.if,data:t,key:n,pointer:r,path:i}))return!0;let a=_(e.if,t,r,i).length===0;if(a&&e.then){if(X({node:e.then,data:t,key:n,pointer:r,path:i}))return!0}else if(!a&&e.else&&X({node:e.else,data:t,key:n,pointer:r,path:i}))return!0}let a=e.resolveRef({pointer:r,path:i});return!!(a!==e&&X({node:a,data:t,key:n,pointer:r,path:i}))}const Z=`unevaluatedProperties`,Ci={id:Z,keyword:Z,parse:wi,addValidate:({schema:e})=>e[Z]!=null,validate:Ti};function wi(e){let t=e.schema[Z];if(t!=null){if(!(x(t)||S(t)))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Z}`,schema:e.schema,value:t,message:`Keyword '${Z}' must be a valid JSON Schema - received '${typeof t}'`});if(!S(t))return e.unevaluatedProperties=e.compileSchema(e.schema.unevaluatedProperties,`${e.evaluationPath}/${Z}`,`${e.schemaLocation}/${Z}`),e.unevaluatedProperties.schemaValidation}}function Ti({node:e,data:t,pointer:n,path:r}){if(!d(t))return;let i=Object.keys(t).filter(e=>t[e]!==void 0);if(i.length===0)return;let a=[];for(let o of i){if(e.properties?.[o]||X({node:e,data:t,key:o,pointer:n,path:r}))continue;let{node:i}=e.getNodeChild(o,t,{pointer:n,path:r});if(i===void 0)if(e.unevaluatedProperties){let i=_(e.unevaluatedProperties,t[o],`${n}/${o}`,r);a.push(...i)}else e.schema.unevaluatedProperties===!1&&a.push(e.createError(`unevaluated-property-error`,{pointer:`${n}/${o}`,value:JSON.stringify(t[o]),schema:e.schema}));if(i&&_(i,t[o],`${n}/${o}`,r).length>0)if(e.unevaluatedProperties){let i=_(e.unevaluatedProperties,t[o],`${n}/${o}`,r);a.push(...i)}else e.schema.unevaluatedProperties===!1&&a.push(e.createError(`unevaluated-property-error`,{pointer:`${n}/${o}`,value:JSON.stringify(t[o]),schema:e.schema}))}return a}const Ei=Lr({version:`draft-2019-09`,$schemaRegEx:`draft[/-]2019-?(09)?`,$schema:`https://json-schema.org/draft/2019-09/schema`,errors:Bt,formats:I,methods:{createSchema:f,getData:Tn,getChildSelection:on,toDataNodes:Rr},keywords:[fi,dt,ht,Xr,yt,Ue,At,Ct,Et,Pt,Lt,$r,ri,qt,si,On,Mn,In,Bn,Un,Kn,Yn,Qn,tr,ar,cr,_r,pr,Sr,Er,Ar,Br,bi,Ci,Kr,fn,rt,st]});function Di(e,t){if(e.items){let t=e.items.resolveRef();if(t?.oneOf)return t.oneOf.map(e=>e.resolveRef())}if(e.oneOf)return e.oneOf.map(e=>e.resolveRef());if(e.prefixItems&&e.prefixItems.length>+t){let{node:n,error:r}=e.getNodeChild(t);return b(n)?[n]:r}if(e.schema.items===!0)return[e.compileSchema({type:`string`})];if(e.schema.items===!1)return[];if(e.items)return[e.items.resolveRef()];if(e.prefixItems&&e.prefixItems.length<=+t)return[];let{node:n,error:r}=e.getNodeChild(t);return r??[n]}function Oi(e,t){if(e.$ref==null)return;t.cache=t.cache??{};let{cache:n,recursionLimit:r=1}=t,i=e.schemaLocation;if(n[i]=n[i]??{},n[i][e.$ref]=n[i][e.$ref]??0,n[i][e.$ref]>=r&&t.disableRecursionLimit!==!0)return!1;t.disableRecursionLimit=!1,n[i][e.$ref]+=1;let a=e.resolveRef();if(a&&a!==e)return a}function ki(e,t){return(t.cache?.[e.schemaLocation]?.[e.$ref]??-1)<(t.recursionLimit??1)}function Ai(e,t){let n=u(t);if(e===void 0||t==null||n===e||n===`number`&&e===`integer`)return t;if(e===`string`)return JSON.stringify(t);if(n!==`string`)return t;try{let n=JSON.parse(t);if(u(n)===e)return n}catch{}return t}function ji(e,t,n){if(n?.cache==null)throw Error(`Missing options`);if(e.schema===!1||e.schema===!0||xn(t))return t;if(e.schema?.const!==void 0)return e.schema?.const;let r=e,i=t;if(Array.isArray(e.schema.enum)&&e.schema.enum.length>0&&t===void 0)return e.schema.default??e.schema.enum[0];if(e.schema.default!==void 0&&i===void 0&&(i=e.schema.default),r.allOf?.length&&r.allOf.forEach(e=>{i=e.getData(i,n)??i}),r.anyOf&&r.anyOf?.length>0&&(i=r.anyOf[0].getData(i,n)??i),r.oneOf&&r.oneOf?.length>0)if(un(i))r=g(r,r.oneOf[0]);else{let e=vn({node:r,data:i,path:[],pointer:`#`});if(C(e)){if(i!=null&&n.removeInvalidData!==!0)return i;r=r.oneOf[0],i=void 0}else r=g(r,e)}let a=Oi(r,n);if(a===!1)return i;b(a)&&(i=a.getData(i,n)??i,r=a);let o=L(r,i),s=Mi[o]?.(r,i,n);return s===void 0?i:s}const Mi={null:(e,t,n)=>Ni(e,t,null,n.useTypeDefaults),string:(e,t,n)=>Ni(e,t,``,n.useTypeDefaults),number:(e,t,n)=>Ni(e,t,0,n.useTypeDefaults),integer:(e,t,n)=>Ni(e,t,0,n.useTypeDefaults),boolean:(e,t,n)=>Ni(e,t,!1,n.useTypeDefaults),object:(e,t,n)=>{let r=e.schema,i=r.default===void 0?{}:r.default,a={},o=n.extendDefaults===!1&&r.default!==void 0?[]:r.required??[],s=e.properties;s&&Object.keys(s).forEach(e=>{let r=s[e],c=o.includes(e),l=y(t,e),d=t===void 0||l===void 0?y(i,e):l;if(d!==void 0||c||n.addOptionalProps){let t=r.getData(d,n),i=u(t);if(n.removeInvalidData&&i!==`object`&&i!==`array`&&!r.validate(t).valid)return;(t!==void 0||n.useTypeDefaults!==!1)&&(a[e]=t)}});let c=e.dependentRequired;d(c)&&Object.keys(c).forEach(t=>{let r=c[t];y(a,t)!==void 0&&r.forEach(t=>{let{node:r}=e.getNodeChild(t,a);r&&(a[t]=r.getData(y(a,t),n))})});let l=e.dependentSchemas;if(l&&Object.keys(l).forEach(e=>{let r=l[e];if(a[e]!==void 0&&b(r)){let e=r.getData(t??a,n);Object.assign(a,e)}}),t&&(n.removeInvalidData===!0&&(r.additionalProperties===!1||d(r.additionalProperties))?b(e.additionalProperties)&&Object.keys(t).forEach(n=>{if(a[n]==null){let r=y(t,n);e.additionalProperties?.validate(r).valid&&(a[n]=r)}}):Object.keys(t).forEach(r=>{let i=u(r);if(n.removeInvalidData&&e.properties&&e.properties[r]&&i!==`object`&&i!==`array`){let i=e.properties[r],a=i.getData(y(t,r),n);if(!i.validate(a).valid)return}a[r]??(a[r]=y(t,r))})),e.if){let{errors:t}=e.if.validate(a);if(t.length===0&&e.then){let t=e.then.getData(a,n);Object.assign(a,t)}else if(t.length>0&&e.else){let t=e.else.getData(a,n);Object.assign(a,t)}}return{...i,...a}},array:(t,n,r)=>{let i=t.schema,a=i.default===void 0?[]:i.default,o=Array.isArray(n)?[...n]:a,s=r.extendDefaults===!1&&i.default!==void 0?0:i.minItems??0;if(i.prefixItems==null){if(t.items&&(ki(t.items,r)||o?.length>0)){let n={...r.cache},i=Math.max(s,o.length);for(let s=0;s<i;s+=1){r.cache=e(n);let i={...r,disableRecursionLimit:!0};o[s]=t.items.getData(o[s]==null?a[s]:o[s],i)}}return o||[]}if(t.prefixItems){let e=Array.isArray(n)?n:[],i=Math.max(s??0,t.prefixItems.length);for(let n=0;n<i;n+=1){let i=t.prefixItems[n]??t.items;if(i&&ki(i,r)||e[n]!==void 0){let e=i.getData(o[n]==null?a[n]:o[n],r);e!==void 0&&(o[n]=e)}}return o||[]}if(t.items==null)return o;if(t.items&&ki(t.items,r)||n?.length>0){let n={...r.cache};for(let i=0,c=Math.max(s,o.length);i<c;i+=1){r.cache=e(n);let s={...r,disableRecursionLimit:!0},c=t.items.getData(o[i]==null?a[i]:o[i],s);if(c===void 0)return o;o[i]=c}}return o}};function Ni({schema:e},t,n,r){return t===void 0?e.const?e.const:e.default===void 0&&Array.isArray(e.enum)?e.enum[0]:e.default===void 0&&r!==!1?n:e.default:Ai(e.type,t)}const Q=`items`,Pi={id:Q,keyword:Q,parse:Ii,addResolve:e=>e[Q]!=null,resolve:Fi,addValidate:e=>e[Q]!=null,validate:Li};function Fi({node:e,key:t}){if(!(e.prefixItems&&e.prefixItems?.length>+t))return e.items}function Ii(e){let t=e.schema[Q];if(t!=null){if(!(x(t)||S(t)))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Q}`,schema:e.schema,value:t,message:`Keyword '${Q}' must be a valid JSON Schema - received '${typeof t}'`});if(t!==!0)return e[Q]=e.compileSchema(t,`${e.evaluationPath}/${Q}`,`${e.schemaLocation}/${Q}`),e[Q].schemaValidation}}function Li({node:e,data:t,pointer:n=`#`,path:r}){let{schema:i}=e;if(!Array.isArray(t)||t.length===0||Array.isArray(i.prefixItems)&&i.prefixItems.length>=t.length)return;if(i.items===!1)return Array.isArray(t)&&t.length===0?void 0:e.createError(`invalid-data-error`,{pointer:n,value:t,schema:i});let a=[];if(e.items){for(let o=i.prefixItems?.length??0;o<t.length;o+=1){let i=t[o],s=_(e.items,i,`${n}/${o}`,r);s&&a.push(...s)}return a}}const Ri=`prefixItems`,zi={id:Ri,keyword:Ri,parse:Vi,addResolve:e=>e[Ri]!=null,resolve:Bi,addValidate:e=>e[Ri]!=null,validate:Hi};function Bi({node:e,key:t}){if(e.prefixItems&&e.prefixItems[t])return e.prefixItems[t]}function Vi(e){let{schema:t,evaluationPath:n}=e;if(Array.isArray(t.prefixItems))return e.prefixItems=t.prefixItems.map((t,r)=>e.compileSchema(t,`${n}/${Ri}/${r}`,`${e.schemaLocation}/${Ri}/${r}`)),E([],...e.prefixItems)}function Hi({node:e,data:t,pointer:n=`#`,path:r}){if(!Array.isArray(t)||t.length===0)return;let i=[],a=e[Ri];if(a){for(let e=0;e<Math.min(a.length,t.length);e+=1){let o=t[e],s=a[e],c=_(s,o,`${n}/${e}`,r);i.push(...c)}return i}}function Ui({node:e,data:t,key:n,pointer:r,path:i}){let a=y(t,n);if(e.schema.unevaluatedItems===!0||e.schema.items===!0||e.contains&&_(e.contains,a,`${r}/${n}`,i).length===0)return!0;if(e.allOf){for(let a of e.allOf)if(Ui({node:a,data:t,key:n,pointer:r,path:i}))return!0}if(e.anyOf){for(let a of e.anyOf)if(Ui({node:a,data:t,key:n,pointer:r,path:i}))return!0}if(e.oneOf){for(let a of e.oneOf)if(Ui({node:a,data:t,key:n,pointer:r,path:i}))return!0}if(e.if){if(Ui({node:e.if,data:t,key:n,pointer:r,path:i}))return!0;let a=_(e.if,t,r,i).length===0;if(a&&e.if.prefixItems&&e.if.prefixItems.length>n)return!0;if(a&&e.then){if(Ui({node:e.then,data:t,key:n,pointer:r,path:i}))return!0}else if(!a&&e.else&&Ui({node:e.else,data:t,key:n,pointer:r,path:i}))return!0}}const Wi=`unevaluatedItems`,Gi={id:Wi,keyword:Wi,parse:Ki,addValidate:({schema:e})=>e.unevaluatedItems!=null,validate:qi};function Ki(e){let t=e.schema[Wi];if(t!=null){if(!(x(t)||S(t)))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Wi}`,schema:e.schema,value:t,message:`Keyword '${Wi}' must be a valid JSON Schema - received '${typeof t}'`});if(!S(t))return e.unevaluatedItems=e.compileSchema(e.schema.unevaluatedItems,`${e.evaluationPath}/${Wi}`,`${e.schemaLocation}/${Wi}`),e.unevaluatedItems.schemaValidation}}function qi({node:e,data:t,pointer:n,path:r}){let{schema:i}=e;if(!Array.isArray(t)||t.length===0||i.unevaluatedItems==null||i.unevaluatedItems===!0)return;let a=[];for(let o=0;o<t.length;o+=1){if(Ui({node:e,data:t,pointer:n,key:o,path:r}))continue;let s=t[o],{node:c}=e.getNodeChild(o,t,{path:r});if(c===void 0)if(e.unevaluatedItems){let t=_(e.unevaluatedItems,s,`${n}/${o}`,r);t.length>0&&a.push(...t)}else a.push(e.createError(`unevaluated-items-error`,{pointer:`${n}/${o}`,value:JSON.stringify(s),schema:i}));if(c&&_(c,s,`${n}/${o}`,r).length>0&&(e.unevaluatedItems&&e.unevaluatedItems.validate(s,`${n}/${o}`,r).valid===!1||e.schema.unevaluatedItems===!1))return e.createError(`unevaluated-items-error`,{pointer:`${n}/${o}`,value:JSON.stringify(s),schema:i})}return a}const Ji=Lr({version:`draft-2020-12`,$schemaRegEx:`draft[/-]2020-?(12)?`,$schema:`https://json-schema.org/draft/2020-12/schema`,errors:Bt,formats:I,methods:{createSchema:f,getData:ji,getChildSelection:Di,toDataNodes:Rr},keywords:[Fe,st,dt,ht,Xr,yt,Ue,At,Ct,Et,Pt,Lt,$r,ri,qt,si,Pi,Mn,In,Bn,Un,Kn,Yn,Qn,tr,ar,cr,fn,pr,_r,zi,Sr,Er,Ar,Br,Gi,Ci,Kr]}),{REGEX_FLAGS:Yi}=c,Xi=[Yr,oi,di,Ei,Ji];function Zi(e,t){return e.find(e=>new RegExp(e.$schemaRegEx,Yi).test(t))??e[e.length-1]}function Qi(t,n={}){let r=n.remote;if(Array.isArray(n.remotes)&&n.remotes.length>0&&!n.remote){let e=[...n.remotes];e.forEach((e,t)=>{if(e.$id==null)throw Error(`required $id on remotes[${t}] is missing`)}),r=Qi(e.shift()),e.forEach(e=>r?.addRemoteSchema(e.$id,e))}let i=n.formatAssertion??!0,a=n.drafts??Xi,o=Zi(a,x(t)?n.draft??t.$schema:void 0),c={evaluationPath:`#`,lastIdPointer:`#`,schemaLocation:`#`,dynamicId:``,reducers:[],resolvers:[],validators:[],schema:t,context:{remotes:{},dynamicAnchors:{},...r?.context??{},anchors:{},refs:{},...e(pe(o,`methods`,`keywords`,`version`,`formats`,`errors`)),draft:n.draft,getDataDefaultOptions:n.getDataDefaultOptions,throwOnInvalidRef:n.throwOnInvalidRef??!1,drafts:a},...Te};if(c.context.rootNode=c,c.context.remotes[(x(t)?t.$id:void 0)??`#`]=c,r){let e=He(c,c.schema.$schema);if(b(e)&&e.schema.$vocabulary){let t=Object.keys(e.schema.$vocabulary).find(e=>e.includes(`vocab/format-assertion`));t&&i===`meta-schema`&&(i=e.schema.$vocabulary[t]===!0);let n=Object.keys(e.getData({},{addOptionalProps:!0}));n.length>0&&(c.context.keywords=c.context.keywords.filter(e=>n.includes(e.keyword)))}}if(i===!1&&(c.context.keywords=c.context.keywords.filter(e=>e.keyword!==`format`)),!x(t)&&!S(t))return c.schemaErrors=[c.createError(`schema-error`,{pointer:`#`,schema:t,value:void 0,message:`JSON schema must be object or boolean - reveived: '${t}'`})],c;let l=Oe(c).filter(e=>e!=null);l=s(l);let u=[],d=[];if(l.forEach(e=>{C(e)?(e.data.schemaId=c.context.rootNode.$id??`#`,u.push(e)):je(e)&&(e.data.schemaId=c.context.rootNode.$id??`#`,d.push(e))}),Array.isArray(r?.schemaErrors)&&u.push(...r.schemaErrors),Array.isArray(r?.schemaAnnotations)&&d.push(...r.schemaAnnotations),n.throwOnInvalidSchema&&u.length>0){let e=Error(`Invalid schema passed to compileSchema`);throw e.data=u,e}return c.schemaErrors=u,c.schemaAnnotations=d,c}const $i=Pr(Ji,{$schemaRegEx:`.`,keywords:[pn],errors:{"min-length-error":e=>e.minLength===1?{type:`error`,code:`min-length-one-error`,message:`An input is required`,data:e}:{type:`error`,code:`min-length-error`,message:me("Value in `{{pointer}}` is `{{length}}`, but should be `{{minLength}}` at minimum",e),data:e}}}),$=`propertyDependencies`;function ea(e,t){let n=e[$];if(n==null)return;let r=Object.keys(n),i=[];for(let e of r)if(v(t,e)){let r=n[e],a=`${t[e]}`;v(r,a)&&i.push({property:e,value:a,node:r[a]})}return i}const ta={id:$,keyword:$,parse:na,addValidate:e=>e[$]!=null,validate:ra,addReduce:e=>e[$]!=null,reduce:ia};function na(e){let t=e.schema[$];if(!d(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${$}`,schema:e.schema,value:t,message:`Keyword '${$}' must be an object - received '${typeof t}'`});let n=Object.create(null),r=[];return Object.keys(t).map(i=>{let a=t[i];if(!d(a)){r.push(e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${$}/${i}`,schema:e.schema,value:t,message:`Keyword '${$}[string]' must be an object - received '${typeof t}'`}));return}Object.keys(a).forEach(t=>{let o=a[t];if(!(x(o)||S(o))){r.push(e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${$}/${i}/${t}`,schema:e.schema,value:o,message:`Keyword '${$}[string][string]' must be a valid JSON Schema - received '${typeof o}'`}));return}n[i]=n[i]??Object.create(null),n[i][t]=e.compileSchema(o,`${e.evaluationPath}/${$}/${i}/${t}`,`${e.schemaLocation}/${$}/${i}/${t}`),E(r,n[i][t])})}),e[$]=n,r}function ra({node:e,data:t,pointer:n=`#`,path:r}){if(!d(t))return;let i=ea(e,t);if(i==null||i.length===0)return;let a=[];for(let e of i){let i=_(e.node,t,n,r);a.push(i)}return s(a)}function ia({node:e,data:t,key:n,pointer:r,path:i}){if(!d(t))return;let a=ea(e,t);if(a==null||a.length===0)return;let o={},s=``;for(let c of a){let{node:a}=c.node.reduceNode(t,{key:n,pointer:r,path:i});if(a){let t=a.dynamicId?.replace(e.dynamicId,``)??``,n=t===``?`propertyDependencies/${c.property}/${c.value}`:t;s+=`${s===``?``:`,`}${n}`;let r=h(c.node.schema,a.schema);o=h(o,r,`propertyDependencies`)}}return e.compileSchema(o,`${e.evaluationPath}/${s}`,e.schemaLocation,`${e.schemaLocation}(${s})`)}export{Fr as addKeywords,Qi as compileSchema,Yr as draft04,oi as draft06,di as draft07,Ei as draft2019,Ji as draft2020,$i as draftEditor,Pr as extendDraft,L as getSchemaType,u as getTypeOf,Ae as isAnnotation,S as isBooleanSchema,je as isJsonAnnotation,C as isJsonError,x as isJsonSchema,Se as isReduceable,b as isSchemaNode,g as mergeNode,h as mergeSchema,pn as oneOfFuzzyKeyword,fn as oneOfKeyword,ta as propertyDependenciesKeyword,me as render,s as sanitizeErrors,c as settings};
1
+ import{t as e}from"./rolldown-runtime-D9-fqq9M.mjs";import{copy as t}from"fast-copy";import{get as n,join as r,split as i}from"@sagold/json-pointer";import{isWebUri as a}from"valid-url";import o from"fast-deep-equal";function s(e,t=[]){if(!Array.isArray(e))return e===void 0?[]:[e];for(let n of e)Array.isArray(n)?s(n,t):(ye(n)||n instanceof Promise)&&t.push(n);return t}var c={DECLARATOR_ONEOF:`oneOfProperty`,propertyBlacklist:[`_id`],DYNAMIC_PROPERTIES:[`$ref`,`$dynamicRef`,`$recursiveRef`,`$defs`,`if`,`then`,`else`,`allOf`,`anyOf`,`oneOf`,`dependentSchemas`,`dependentRequired`,`definitions`,`dependencies`,`patternProperties`,`propertyDependencies`],REGEX_FLAGS:`u`,VALID_ANNOTATION_KEYWORDS:[`$id`,`$schema`,`title`,`description`,`default`,`oneOfProperty`],PROPERTIES_TO_MERGE:[`title`,`description`,`default`,`options`,`x-options`,`readOnly`,`writeOnly`]};const l=Object.prototype.toString;function u(e){let t=l.call(e).slice(8,-1).toLowerCase();return t===`file`?`object`:t}function d(e){return u(e)===`object`}function f(e){let t=e===void 0?{}:{type:u(e)};return t.type===`object`&&d(e)&&(t.properties={},Object.keys(e).forEach(n=>t.properties[n]=f(e[n]))),t.type===`array`&&Array.isArray(e)&&(e.length===1?t.items=f(e[0]):(t.items=e.map(f),t.items.find(e=>e.type!==t.items[0].type)??(t.items=t.items[0]))),t}function p(e,t){t!=null&&Object.values(t).forEach(t=>h(t,e))}function m(e,t){t?.forEach(t=>h(t,e))}function h(e,t=[]){return P(e)?(t.push(e),p(t,e.$defs),e.additionalProperties&&h(e.additionalProperties,t),m(t,e.allOf),m(t,e.anyOf),e.contains&&h(e.contains,t),p(t,e.dependentSchemas),e.if&&h(e.if,t),e.else&&h(e.else,t),e.then&&h(e.then,t),e.items&&h(e.items,t),m(t,e.prefixItems),e.not&&h(e.not,t),m(t,e.oneOf),e.patternProperties&&Object.values(e.patternProperties).forEach(({node:e})=>h(e,t)),p(t,e.properties),e.propertyNames&&h(e.propertyNames,t),e.unevaluatedProperties&&h(e.unevaluatedProperties,t),e.unevaluatedItems&&h(e.unevaluatedItems,t),t):t}var g=e(((e,t)=>{let n=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),i=RegExp.prototype.test.bind(/^\d*$/u),a=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),s=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),c=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),l=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);function u(e){let t=``,n=0,r=0;for(r=0;r<e.length;r++)if(n=e[r].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r]}return t}let d=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),f=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),p=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),m=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),h=RegExp.prototype.test.bind(/[^\d!"$&'()*+,\-.;=_`a-z{}~]/u),g=RegExp.prototype.test.bind(/(?:^|\.)\d+$/u);function ee(e){return h(e)||g(e)}function te(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!p(e[t])){if(e[t]===`%`&&t+2<e.length&&a(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function _(e){let t=-1,n=0,r=-1,i=0;for(let a=0;a<e.length;a++)e[a]===`0`?(r===-1&&(r=a),i++,i>n&&(n=i,t=r)):(r=-1,i=0);if(n<2)return e.join(`:`);let a=e.slice(0,t).join(`:`),o=e.slice(t+n).join(`:`);return a+`::`+o}function v(e){let t=e.indexOf(`::`);if(t!==-1&&e.indexOf(`::`,t+1)!==-1)return;let n=t===-1?e.split(`:`):e.slice(0,t).split(`:`),i=t===-1?[]:e.slice(t+2).split(`:`);t!==-1&&(n.length===1&&n[0]===``&&(n.length=0),i.length===1&&i[0]===``&&(i.length=0));let a=n.concat(i),o=0;for(let e=0;e<a.length;e++){let n=a[e];if(n===``)return;if(n.indexOf(`.`)!==-1){if(e!==a.length-1||t!==-1&&i.length===0||!r(n))return;o+=2;continue}if(!d(n))return;a[e]=parseInt(n,16).toString(16),o++}if(t===-1)return o===8?_(a):void 0;if(o>=8)return;let s=a.slice(0,n.length);for(let e=o;e<8;e++)s.push(`0`);for(let e=n.length;e<a.length;e++)s.push(a[e]);return _(s)}function y(e){let t=e[0]===`[`&&e[e.length-1]===`]`;if((e[0]===`[`||e[e.length-1]===`]`)&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&f(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(ne(n,`:`)<2)return{host:e,isIPV6:!1,error:t};let r=``,i=n.indexOf(`%`);if(i!==-1){let t=n.slice(i,i+3).toLowerCase()===`%25`?3:1;if(r=n.slice(i+t),!te(r))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let a=v(n);return a===void 0?{host:e,isIPV6:!1,error:!0}:{host:a+(r?`%`+r:``),escapedHost:a+(r?`%25`+r:``),isIPV6:!0}}function ne(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}function b(e){let t=e,n=[],r=-1,i=0;for(;i=t.length;){if(i===1){if(t===`.`)break;if(t===`/`){n.push(`/`);break}else{n.push(t);break}}else if(i===2){if(t[0]===`.`){if(t[1]===`.`)break;if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&t[1]===`.`){n.push(`/`);break}}else if(i===3&&t===`/..`){n.length!==0&&n.pop(),n.push(`/`);break}if(t[0]===`.`){if(t[1]===`.`){if(t[2]===`/`){t=t.slice(3);continue}}else if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&t[1]===`.`){if(t[2]===`/`){t=t.slice(2);continue}else if(t[2]===`.`&&t[3]===`/`){t=t.slice(3),n.length!==0&&n.pop();continue}}if((r=t.indexOf(`/`,1))===-1){n.push(t);break}else n.push(t.slice(0,r)),t=t.slice(r)}return n.join(``)}let x={"@":`%40`,"/":`%2F`,"?":`%3F`,"#":`%23`,":":`%3A`},S=/[@/?#:]/g,C=/[@/?#]/g;function re(e,t){let n=t?C:S;return n.lastIndex=0,e.replace(n,e=>x[e])}function w(e,t=!1){if(e.indexOf(`%`)===-1)return e;let n=``;for(let r=0;r<e.length;r++){if(e[r]===`%`&&r+2<e.length){let i=e.slice(r+1,r+3);if(a(i)){let e=i.toUpperCase(),a=String.fromCharCode(parseInt(e,16));t&&o(a)?n+=a:n+=`%`+e,r+=2;continue}}n+=e[r]}return n}let T=Array(256);{let e=`0123456789ABCDEF`;for(let t=0;t<256;t++)T[t]=`%`+e[t>>4]+e[t&15]}function ie(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function E(e){return e<2048?T[192|e>>6]+T[128|e&63]:e<65536?T[224|e>>12]+T[128|e>>6&63]+T[128|e&63]:T[240|e>>18]+T[128|e>>12&63]+T[128|e>>6&63]+T[128|e&63]}function D(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(r===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(a(r)){let e=r.toUpperCase(),i=String.fromCharCode(parseInt(e,16));i!==`.`&&o(i)?t+=i:t+=`%`+e,n+=2;continue}}if(s(r))t+=r;else{let i=e.charCodeAt(n);if(i<128)t+=ie(i)?r:T[i];else if(i<55296||i>57343)t+=E(i);else if(i<=56319&&n+1<e.length){let r=e.charCodeAt(n+1);r>=56320&&r<=57343?(t+=E(65536+(i-55296<<10)+(r-56320)),n++):t+=E(65533)}else t+=E(65533)}}return t}function O(e,t=!1){let n=``,r=t&&e[0]!==`/`;for(let t=0;t<e.length;t++){let i=e[t];if(i===`%`&&t+2<e.length){let r=e.slice(t+1,t+3);if(a(r)){n+=`%`+r.toUpperCase(),t+=2;continue}}if(i===`/`&&(r=!1),s(i)&&(i!==`:`||!r))n+=i;else{let r=e.charCodeAt(t);if(r<128)n+=T[r];else if(r<55296||r>57343)n+=E(r);else if(r<=56319&&t+1<e.length){let i=e.charCodeAt(t+1);i>=56320&&i<=57343?(n+=E(65536+(r-55296<<10)+(i-56320)),t++):n+=E(65533)}else n+=E(65533)}}return n}function k(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(r===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(a(r)){let e=r.toUpperCase(),i=String.fromCharCode(parseInt(e,16));o(i)?t+=i:t+=`%`+e,n+=2;continue}}if(c(r))t+=r;else{let i=e.charCodeAt(n);if(i<128)t+=ie(i)?r:T[i];else if(i<55296||i>57343)t+=E(i);else if(i<=56319&&n+1<e.length){let r=e.charCodeAt(n+1);r>=56320&&r<=57343?(t+=E(65536+(i-55296<<10)+(r-56320)),n++):t+=E(65533)}else t+=E(65533)}}return t}function A(e,t){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(i===`%`&&r+2<e.length){let t=e.slice(r+1,r+3);if(a(t)){n+=`%`+t.toUpperCase(),r+=2;continue}}if(t(i))n+=i;else{let t=e.charCodeAt(r);if(t<128)n+=T[t];else if(t<55296||t>57343)n+=E(t);else if(t<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(n+=E(65536+(t-55296<<10)+(i-56320)),r++):n+=E(65533)}else n+=E(65533)}}return n}function j(e){return A(e,l)}function M(e){return A(e,c)}function N(e){return A(e,c)}function ae(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(r===`%`&&n+2<e.length){let r=e.slice(n+1,n+3);if(a(r)){t+=`%`+r.toUpperCase(),n+=2;continue}}let i=e.charCodeAt(n);if(i<128)t+=ie(i)?r:T[i];else if(i<55296||i>57343)t+=E(i);else if(i<=56319&&n+1<e.length){let r=e.charCodeAt(n+1);r>=56320&&r<=57343?(t+=E(65536+(i-55296<<10)+(r-56320)),n++):t+=E(65533)}else t+=E(65533)}return t}function oe(e){let t=e.ipv6Zone;if(t===void 0)return;let n=e.host,r=n.indexOf(`%`);if(r===-1)return;let i=n.slice(0,r)+`%25`+t,a=y(`[`+i+`]`);if(a.isIPV6===!0&&a.host===n)return`[`+i+`]`}function se(e){let t=[];if(e.userinfo!==void 0&&(t.push(j(e.userinfo)),t.push(`@`)),e.host!==void 0){let n=e.host;if(!r(n)){let t=oe(e);if(t!==void 0)n=t;else{let e=y(n);e.isIPV6!==!0&&e.isIPVFuture!==!0&&(n=w(n,!0),e=y(n)),n=e.isIPV6===!0||e.isIPVFuture===!0?`[${e.escapedHost}]`:re(n,!1)}}t.push(n)}if(typeof e.port==`number`||typeof e.port==`string`){let n=String(e.port);if(!i(n))throw TypeError(`URI port is malformed.`);t.push(`:`),t.push(n)}return t.length?t.join(``):void 0}t.exports={BYTE_HEX:T,percentEncodeNonAscii:E,nonSimpleDomain:m,nonSimpleMailtoDomain:ee,recomposeAuthority:se,reescapeHostDelimiters:re,normalizePercentEncoding:w,normalizePathEncoding:D,serializePathEncoding:O,normalizeQueryFragmentEncoding:k,encodeUserinfo:j,encodeQuery:M,encodeFragment:N,escapePreservingEscapes:ae,removeDotSegments:b,isIPv4:r,isUUID:n,normalizeIPv6:y,stringArrayToHexStripped:u}})),ee=e(((e,t)=>{let{isUUID:n,BYTE_HEX:r,percentEncodeNonAscii:i,nonSimpleMailtoDomain:a}=g(),o=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,s=[`http`,`https`,`ws`,`wss`,`urn`,`urn:uuid`,`mailto`];function c(e){return s.indexOf(e)!==-1}function l(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]===`w`||e.scheme[0]===`W`)&&(e.scheme[1]===`s`||e.scheme[1]===`S`)&&(e.scheme[2]===`s`||e.scheme[2]===`S`):!1}function u(e){return e.host||(e.error=e.error||`HTTP URIs must have a host.`),e}function d(e){let t=String(e.scheme).toLowerCase()===`https`;return(e.port===(t?443:80)||e.port===``)&&(e.port=void 0),e.path||=`/`,e}function f(e){return e.secure=l(e),e.resourceName=(e.path||`/`)+(e.query?`?`+e.query:``),e.path=void 0,e.query=void 0,e}function p(e){if((e.port===(l(e)?443:80)||e.port===``)&&(e.port=void 0),typeof e.secure==`boolean`&&(e.scheme=e.secure?`wss`:`ws`,e.secure=void 0),e.resourceName){let t=e.resourceName.indexOf(`?`),n=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=n&&n!==`/`?n:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function m(e,t){if(!e.path)return e.error=`URN can not be parsed`,e;let n=e.path.match(o);if(n&&n[0]===e.path){let r=t.scheme||e.scheme||`urn`;e.nid=n[1].toLowerCase(),e.nss=n[2];let i=ue(`${r}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||`URN can not be parsed.`;return e}function h(e,t){if(e.nid===void 0)throw Error(`URN without nid cannot be serialized`);let n=t.scheme||e.scheme||`urn`,r=e.nid.toLowerCase(),i=ue(`${n}:${t.nid||r}`);i&&(e=i.serialize(e,t));let a=e,o=e.nss;return a.path=`${r||t.nid}:${o}`,t.skipEscape=!0,a}function ee(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!n(r.uuid))&&(r.error=r.error||`UUID is not valid.`),r}function te(e){let t=e;return t.nss=(e.uuid||``).toLowerCase(),t}let _={scheme:`http`,domainHost:!0,parse:u,serialize:d},v={scheme:`https`,domainHost:_.domainHost,parse:u,serialize:d},y={scheme:`ws`,domainHost:!0,parse:f,serialize:p},ne={scheme:`wss`,domainHost:y.domainHost,parse:y.parse,serialize:y.serialize},b={scheme:`urn`,parse:m,serialize:h,skipNormalize:!0},x={scheme:`urn:uuid`,parse:ee,serialize:te,skipNormalize:!0},S=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+;:`;function C(e,t=!1){let n=new Uint8Array(128);for(let t=0;t<e.length;t++)n[e.charCodeAt(t)]=1;let r=e.replace(/[\\\]^-]/gu,`\\$&`),i=t?`[${r}]|[^\\0-\\x7F\\uD800-\\uDFFF]`:`[${r}]`;return{all:RegExp(`^(?:${i})*$`,`u`),table:n,allowNonAscii:t}}let re=C(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+=`),w=C(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+,;:@`),T=C(S),ie=C(S,!0),E=/^[\da-f]{2}$/iu,D=/^\[[\x21-\x5A\x5E-\x7E]*\]$/u,O=`URI mailto has an invalid recipient domain.`,k=/[\uD800-\uDFFF]/u;function A(e){if(typeof e!=`string`||e.indexOf(`%`)===-1)return e;try{return decodeURIComponent(e)}catch{return e}}function j(e){let t=``;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r>=55296&&r<=56319&&n+1<e.length){let r=e.charCodeAt(n+1);if(r>=56320&&r<=57343){t+=e[n]+e[n+1],n++;continue}}t+=r>=55296&&r<=57343?`�`:e[n]}return t}function M(e,t){if(t.all.test(e))return e;let n=t.table,a=``;for(let o=0;o<e.length;o++){let s=e.charCodeAt(o);if(s<128){n[s]===1?a+=e[o]:s===37&&o+2<e.length&&E.test(e.slice(o+1,o+3))?(a+=`%`+e.slice(o+1,o+3).toUpperCase(),o+=2):a+=r[s];continue}if(s<55296||s>57343){a+=t.allowNonAscii?e[o]:i(s);continue}if(s<=56319&&o+1<e.length){let n=e.charCodeAt(o+1);if(n>=56320&&n<=57343){a+=t.allowNonAscii?e[o]+e[o+1]:i(65536+(s-55296<<10)+(n-56320)),o++;continue}}a+=t.allowNonAscii?`�`:i(65533)}return a}function N(e,t,n){let r=String(e).toLowerCase();if(D.test(r)||r!==``&&!a(r))return r;try{let e=new URL(`http://`+r);if(e.username||e.password||e.port||e.pathname!==`/`||e.search||e.hash||!e.hostname)throw Error(O);return t&&t.unicodeSupport?r:e.hostname}catch{return n&&(n.error=n.error||O),r}}function ae(e,t){let n=t&&t.unicodeSupport?ie:T;return e.length>1&&e[0]===`[`&&e[e.length-1]===`]`?`[`+M(e.slice(1,-1),n)+`]`:M(e,n)}function oe(e,t){let n=e,r=n.path,i=n.query;r&&k.test(r)&&(r=j(r)),i&&k.test(i)&&(i=j(i));let a=r?r.indexOf(`,`)===-1?[r]:r.split(`,`):[];if(n.path=void 0,i){let e=null,t=0;for(;t<=i.length;){let r=i.indexOf(`&`,t);r===-1&&(r=i.length);let o=i.slice(t,r);t=r+1;let s=o.indexOf(`=`);if(s!==o.lastIndexOf(`=`)){n.error=n.error||`URI mailto has malformed header fields.`;continue}let c=A(s===-1?o:o.slice(0,s)),l=c.toLowerCase(),u=s===-1?``:o.slice(s+1);if(l===`to`){let e=u.split(`,`);for(let t=0;t<e.length;t++)a.push(e[t]);continue}if(l===`subject`){n.subject=A(u);continue}if(l===`body`){n.body=A(u);continue}e===null&&(e=Object.create(null)),e[c]=A(u)}e!==null&&(n.headers=e)}n.query=void 0,a.length>0&&(n.userinfo!==void 0||n.host!==void 0||n.port!==void 0)&&(n.userinfo=void 0,n.host=void 0,n.port=void 0,n.error=n.error||`URI mailto must not have an authority component.`);for(let e=0;e<a.length;e++){let r=a[e],i=r.lastIndexOf(`@`);if(i<0){n.error=n.error||O,a[e]=A(r);continue}let o=A(r.slice(0,i)),s=N(A(r.slice(i+1)),t,n);a[e]=o+`@`+s}return a.length&&(n.to=a),n}function se(e){return M(e.replace(/%/gu,`%25`),w)}function ce(e,t){let n=e,r=Array.isArray(n.to)?n.to.slice():[],i=n.headers&&typeof n.headers==`object`?Object.assign(Object.create(null),n.headers):Object.create(null),a=Object.create(null);for(let e in i){let t=e.toLowerCase();if(t===`to`){let t=String(i[e]).split(`,`);for(let e=0;e<t.length;e++)r.push(t[e])}else t===`subject`||t===`body`?a[t]=i[e]:a[e]=i[e]}if(n.subject!==void 0&&(a.subject=n.subject),n.body!==void 0&&(a.body=n.body),n.headers=a,r.length){n.userinfo=void 0,n.host=void 0,n.port=void 0;for(let e=0;e<r.length;e++){let n=String(r[e]),i=n.lastIndexOf(`@`),a=i>=0?n.slice(0,i):n,o=i>=0?n.slice(i+1):``,s=M(a,re),c=N(A(o),t);r[e]=s+`@`+ae(c,t)}n.path=r.join(`,`),t.skipEscape=!0}else n.path=void 0;let o=``,s=0;for(let e in a)s++!==0&&(o+=`&`),o+=se(e)+`=`+M(String(a[e]),w);return s===0?n.headers=void 0:n.query=o,n}let le={http:_,https:v,ws:y,wss:ne,urn:b,"urn:uuid":x,mailto:{scheme:`mailto`,parse:oe,serialize:ce,domainHost:!1,unicodeSupport:!0,skipNormalize:!0,absolutePath:!0}};Object.setPrototypeOf(le,null);function ue(e){return e&&(le[e]||le[e.toLowerCase()])||void 0}t.exports={wsIsSecure:l,SCHEMES:le,isValidSchemeName:c,getSchemeHandler:ue}})),te=e(((e,t)=>{let{normalizeIPv6:n,removeDotSegments:r,recomposeAuthority:i,normalizePercentEncoding:a,normalizePathEncoding:o,serializePathEncoding:s,normalizeQueryFragmentEncoding:c,encodeQuery:l,encodeFragment:u,reescapeHostDelimiters:d,isIPv4:f,nonSimpleDomain:p}=g(),{SCHEMES:m,getSchemeHandler:h}=ee(),te=/^[A-Za-z][A-Za-z0-9+.-]*$/u,_=`URI scheme is malformed.`;function v(e){let t=unescape(String(e));if(!te.test(t))throw TypeError(_);return t}function y(e,t){return typeof e==`string`?e=M(e,t):typeof e==`object`&&(e=j(C(e,t),t)),e}function ne(e,t,r){let i=r?Object.assign({scheme:`null`},r):{scheme:`null`},{parsed:a,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:c,malformedHost:l,malformedScheme:u}=A(e,i),{parsed:d,malformedAuthorityOrPort:p,malformedPercentEncoding:m,malformedSchemeSpecific:g,malformedHost:ee,malformedScheme:te}=A(t,i);if(o||p||s||m||c||g||l||ee||u||te)throw Error(a.error||d.error||`URI is malformed.`);let _=x(a,d,i,!0),v=h(r&&r.scheme||_.scheme),y=_.host,ne=y!==void 0&&y!==``&&(f(y)||n(y).isIPV6);k(_,r||{},v,ne);let b=y&&y.indexOf(`%`)!==-1&&!/\P{ASCII}/u.test(y);if(_.error&&!b)throw Error(_.error);return i.skipEscape=!0,C(_,i)}function b(e,t){e.host=t.host,t.ipv6Zone!==void 0&&(e.ipv6Zone=t.ipv6Zone)}function x(e,t,n,i){let a={};return i||(e=j(C(e,n),n),t=j(C(t,n),n)),n||={},!n.tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,b(a,t),a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(a.userinfo=t.userinfo,b(a,t),a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.path?(t.path[0]===`/`?a.path=r(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?a.path=`/`+t.path:e.path?a.path=e.path.slice(0,e.path.lastIndexOf(`/`)+1)+t.path:a.path=t.path,a.path=r(a.path)),a.query=t.query):(a.path=e.path,t.query===void 0?a.query=e.query:a.query=t.query),a.userinfo=e.userinfo,b(a,e),a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function S(e,t,n){let r=ae(e,n),i=ae(t,n);return r!==void 0&&i!==void 0&&r===i}function C(e,t){let n={host:e.host,ipv6Zone:e.ipv6Zone,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,to:e.to,subject:e.subject,body:e.body,headers:e.headers,error:``},o=Object.assign({},t),c=[];n.scheme&&=v(n.scheme);let d=h(o.scheme||n.scheme);d&&d.serialize&&d.serialize(n,o);let f=n.userinfo!==void 0||n.host!==void 0||n.port!==void 0,p=!o.skipEscape&&n.scheme===void 0&&!f;n.path!==void 0&&(o.skipEscape?n.path=a(n.path):n.path=s(n.path,p)),o.reference!==`suffix`&&n.scheme&&(n.scheme=v(n.scheme),c.push(n.scheme,`:`));let m=i(n);if(m!==void 0&&(o.reference!==`suffix`&&c.push(`//`),c.push(m),n.path&&n.path[0]!==`/`&&c.push(`/`)),n.path!==void 0){let e=n.path;!o.absolutePath&&(!d||!d.absolutePath)&&(e=r(e)),p&&(e=s(e,!0)),m===void 0&&e[0]===`/`&&e[1]===`/`&&(e=`/%2F`+e.slice(2)),c.push(e)}return n.query!==void 0&&c.push(`?`,l(n.query)),n.fragment!==void 0&&c.push(`#`,u(n.fragment)),c.join(``)}let re=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,w=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,T=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function ie(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!==`/`)return`URI path must start with "/" when authority is present.`;if(typeof e.port==`number`&&(e.port<0||e.port>65535))return`URI port is malformed.`}function E(e){if(e===void 0)return!1;let t=e.indexOf(`%`);for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf(`%`,t+3)}return!1}function D(e){return e[0]===`[`&&e[e.length-1]===`]`}function O(e){let t=e[4];return E(e[3])||t!==void 0&&!D(t)&&E(t)||E(e[6])||E(e[7])||E(e[8])}function k(e,t,n,r){let i=e.host&&e.host[0]===`[`&&e.host[e.host.length-1]===`]`;if(!t.unicodeSupport&&(!n||!n.unicodeSupport)&&e.host&&!D(e.host)&&(t.domainHost||n&&n.domainHost)&&r===!1&&!i&&p(e.host))try{e.host=new URL(`http://`+e.host).hostname}catch(t){return e.error=e.error||`Host's domain name can not be converted to ASCII: `+t,!0}return!1}function A(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:``,port:void 0,path:``,query:void 0,fragment:void 0},s=!1,l=!1,u=!1,p=!1,g=!1,ee=!1,v=!1;r.reference===`suffix`&&(e=r.scheme?r.scheme+`:`+e:`//`+e);let y=e.match(w);y!==null&&y[1].indexOf(`\\`)!==-1&&(i.error=`URI authority must not contain a literal backslash.`,s=!0);let ne=e.match(T);if(ne!==null){let e=ne[1],t=e.replace(/[\t\n\r]/g,``);t.length>=2&&(t.slice(0,2)===`//`?e.length!==t.length&&(i.error=i.error||`URI authority introducer must not contain whitespace.`,s=!0):(i.error=i.error||`URI authority must not contain a literal backslash.`,s=!0))}let b=e.match(re);if(b){if(i.scheme=b[1],i.userinfo=b[3],i.host=b[4],i.port=parseInt(b[5],10),i.path=b[6]||``,i.query=b[7],i.fragment=b[8],i.scheme!==void 0){let e=unescape(i.scheme);te.test(e)?i.scheme=e.toLowerCase():(i.error=i.error||_,ee=!0)}l=O(b),l&&(i.error=i.error||`URI contains malformed percent-encoding.`),isNaN(i.port)&&(i.port=b[5]);let t=ie(i,b);if(t!==void 0&&(i.error=i.error||t,s=!0),i.host)if(f(i.host)===!1){let e=D(i.host),t=i.host.indexOf(`[`)!==-1||i.host.indexOf(`]`)!==-1,r=n(i.host);v=r.isIPV6||r.isIPVFuture===!0,g=t&&(!e||r.error===!0),i.host=v?r.host:r.host.toLowerCase(),v&&r.isIPV6===!0&&i.host.indexOf(`%`)!==-1&&(i.ipv6Zone=i.host.slice(i.host.indexOf(`%`)+1)),g&&(i.error=i.error||`URI host is malformed.`,s=!0)}else v=!0;i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?i.reference=`same-document`:i.scheme===void 0?i.reference=`relative`:i.fragment===void 0?i.reference=`absolute`:i.reference=`uri`,r.reference&&r.reference!==`suffix`&&r.reference!==i.reference&&(i.error=i.error||`URI is not a `+r.reference+` reference.`);let y=h(r.scheme||i.scheme);if(g||(p=k(i,r,y,v)),e.indexOf(`%`)!==-1&&i.host!==void 0&&!g){let e=v?i.host:a(i.host,!0);v||(e=a(e.toLowerCase())),i.host=d(e,v)}(!y||y&&!y.skipNormalize)&&(i.path&&=o(i.path),i.query&&=c(i.query),i.fragment&&=c(i.fragment)),y&&y.parse&&(y.parse(i,r),y===m.urn&&i.nid===void 0&&(u=!0))}else i.error=i.error||`URI can not be parsed.`;return{parsed:i,malformedAuthorityOrPort:s,malformedPercentEncoding:l,malformedSchemeSpecific:u,malformedHost:p,malformedScheme:ee}}function j(e,t){return A(e,t).parsed}function M(e,t){return N(e,t).normalized}function N(e,t){let{parsed:n,malformedAuthorityOrPort:r,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:o,malformedScheme:s}=A(e,t);return{normalized:r||i||a||o||s?e:C(n,t),malformedAuthorityOrPort:r,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:o,malformedScheme:s}}function ae(e,t){if(typeof e!=`string`&&typeof e!=`object`)return;let n;try{n=typeof e==`string`?e:C(e,t)}catch{return}let{normalized:r,malformedAuthorityOrPort:i,malformedPercentEncoding:a,malformedSchemeSpecific:o,malformedHost:s,malformedScheme:c}=N(n,t);return i||a||o||s||c?void 0:r}let oe={SCHEMES:m,normalize:y,resolve:ne,resolveComponent:x,equal:S,serialize:C,parse:j};t.exports=oe,t.exports.default=oe,t.exports.fastUri=oe}))();const _=/(#)+$/,v=/#$/,y=/^[^:]+:\/\/[^/]+\//,ne=/#.*$/;function b(e,t){return t==null?e?.replace(v,``)||`#`:e==null||e===`#`?t.replace(v,``)||`#`:t[0]===`#`?e[0]===`/`?t:`${e.replace(ne,``)}${t.replace(_,``)}`||`#`:y.test(t)?t.replace(v,``):(0,te.resolve)(e,t)||`#`}function x(e,t,...n){if(t?.type===`error`)return t;if(e?.type===`error`||u(e)!==u(t))return e;let r=S(e,t);for(let e of n)delete r[e];return r}function S(e,t,n){if(d(e)&&d(t)){let n={};return[...Object.keys(e),...Object.keys(t)].filter((e,t,n)=>n.indexOf(e)===t).forEach(r=>n[r]=S(e[r],t[r],r)),n}let r=Array.isArray(e),i=Array.isArray(t);if(r&&i){if(n===`required`||n===`anyOf`)return e.concat(t).filter((e,t,n)=>n.indexOf(e)===t);if(n===`items`||n===`prefixItems`){let n=[];for(let r=0;r<t.length;r+=1)d(e[r])&&d(t[r])&&e[r].type===t[r].type?n[r]=S(e[r],t[r]):n.push(t[r]??e[r]);return n}let r=[],i=[];for(let n=0;n<Math.max(e.length,t.length);n+=1)d(e[n])&&d(t[n])?r[n]=S(e[n],t[n]):e[n]!==void 0&&t[n]!==void 0?(r[n]=e[n],i.push(t[n])):e[n]===void 0?t[n]!==void 0&&i.push(t[n]):r[n]=e[n];return[...r,...i].filter((e,t,n)=>n.indexOf(e)===t)}if(n===`type`&&(r||i)){if(r&&e.includes(t))return t;if(i&&t.includes(e))return e;if(r)return[...e,t];if(i)return[...t,e]}return i?t:r||t===void 0?e:t}function C(e,...t){if(!d(e)||t.length===0)return e;let n={};return t.forEach(t=>{e[t]!==void 0&&(n[t]=e[t])}),n}function re(e,t){return(t.order??0)-(e.order??0)}function w(e,t,n){if(e==null||n.indexOf(e)!==t)return!1;let r=e.toJSON?.()??e.name;return n.find((e,n)=>(e.toJSON?.()??e.name)===r&&n===t)}function T(e,t){if(e==null||t==null)return t||e;let n={};return[...Object.keys(e),...Object.keys(t)].filter((e,t,n)=>n.indexOf(e)===t).forEach(r=>{let i=O(e[r],t[r]);P(i)&&(n[r]=i)}),n}function ie(e,t){return e==null||t==null?t||e:e.concat(t).filter((e,t,n)=>n.indexOf(e)===t)}function E(e,t){if(e==null||t==null)return e||t;let n=[...e],r=e.map(e=>e.node.evaluationPath);return t.forEach(e=>{r.includes(e.node.evaluationPath)||n.push(e)}),n}function D(e,t,...n){return t?.toSchemaNodes().some(t=>t.context!==e.context||t.$id!==e.$id)?{...e,...O(e,t,...n),...C(e,`schema`,`context`,`$id`,`schemaLocation`,`evaluationPath`,`dynamicId`)}:e}function O(e,t,...n){if(e==null||t==null)return e||t;let r={};e.items&&t.prefixItems||e.prefixItems&&t.items?t.prefixItems?r.prefixItems=t.prefixItems:r.items=t.items:(r.prefixItems=t.prefixItems??e.prefixItems,r.items=O(e.items,t.items));let i={...e,...t,...r,dynamicId:pe(e.dynamicId,t.dynamicId),oneOfIndex:e.oneOfIndex??t.oneOfIndex,schema:x(e.schema,t.schema,...n),parent:e.parent,resolvers:e.resolvers.concat(t.resolvers).filter(w).sort(re),reducers:e.reducers.concat(t.reducers).filter(w).sort(re),validators:e.validators.concat(t.validators).filter(w).sort(re),additionalProperties:O(e.additionalProperties,t.additionalProperties),contains:O(e.contains,t.contains),enum:ie(e.enum,t.enum),if:O(e.if,t.if),then:O(e.then,t.then),else:O(e.else,t.else),not:O(e.not,t.not),propertyNames:O(e.propertyNames,t.propertyNames),unevaluatedProperties:O(e.unevaluatedProperties,t.unevaluatedProperties),unevaluatedItems:O(e.unevaluatedItems,t.unevaluatedItems),$defs:T(e.$defs,t.$defs),patternProperties:E(e.patternProperties,t.patternProperties),properties:T(e.properties,t.properties),required:ie(e.required,t.required)};function a(e){let t=e.toJSON?.()??e.name,n=t===`$ref`?i.context.keywords.find(e=>e.keyword===`$ref`):void 0;return i.schema?.[t]===void 0&&!n?.addValidate?.(i)?(i[t]=void 0,!1):!0}return n?.forEach(e=>i[e]=void 0),i.resolvers=i.resolvers.filter(a),i.reducers=i.reducers.filter(a),i.validators=i.validators.filter(a),i}function k(e,t={}){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>{let r=t[n];return r==null?``:typeof r==`object`?JSON.stringify(r):String(r)})}function A(e,t,n,r){if(L(e))return[e];let i=e.schema;if(i===!0)return[];if(i===!1)return[e.createError(`invalid-data-error`,{value:t,pointer:n,schema:e.schema})];let a=[];for(let i of e.validators){let o=i({node:e,data:t,pointer:n,path:[...r,{pointer:n,node:e}]});Array.isArray(o)?a.push(...o):o&&a.push(o)}return s(a)}const j=Object.prototype.hasOwnProperty,M=(e,t)=>!(e[t]===void 0||!j.call(e,t));function N(e,t){if(d(e)&&M(e,`${t}`)||Array.isArray(e))return e[t]}function ae(e,t,n={}){n.path=n.path??[],n.withSchemaWarning=n.withSchemaWarning??!1,n.pointer=n.pointer??`#`;let r=this,a=i(e);if(a.length===0){let e=r.resolveRef(n);return L(e)?{node:void 0,error:e}:{node:e,error:void 0}}let o=`#`,s=r;for(let e=0,r=a.length;e<r;e+=1){o=`${o}/${a[e]}`;let r=s.getNodeChild(a[e],t,{...n,pointer:o});if(r.error||r.node==null)return r;s=r.node,t=N(t,a[e])}let{node:c,error:l}=s.resolveRef(n).reduceNode(t,n);return L(l)?{node:void 0,error:l}:P(c)?{node:c,error:void 0}:{error:void 0}}function oe(e,t,n={}){n.path=n.path??[],n.withSchemaWarning=n.withSchemaWarning??!1,n.pointer=n.pointer??`#`;let{path:r,pointer:i}=n,a=this;if(r.push({pointer:i,node:a}),a.reducers.length){let n=a.reduceNode(t,{key:e,path:r,pointer:i});if(n.error)return n;P(n.node)&&(a=n.node)}for(let n of a.resolvers){let o=n({data:t,key:e,node:a,pointer:i,path:r});if(L(o))return{node:void 0,error:o};if(P(o))return{node:o.resolveRef({pointer:i,path:r}),error:void 0}}return n.createSchema===!0?{node:a.compileSchema(a.createSchema(N(t,e)),`${a.evaluationPath}/additional`,`${a.schemaLocation}/additional`,`${a.schemaLocation}(createSchema)`),error:void 0}:n.withSchemaWarning===!0?{node:void 0,error:a.createError(`schema-warning`,{pointer:i,value:t,schema:a.schema,key:e})}:{node:void 0}}const{DYNAMIC_PROPERTIES:se,REGEX_FLAGS:ce,DECLARATOR_ONEOF:le,VALID_ANNOTATION_KEYWORDS:ue}=c;function P(e){return d(e)&&Array.isArray(e?.reducers)&&Array.isArray(e?.resolvers)}function de(e){for(let t=0,n=se.length;t<n;t+=1)if(M(e,se[t]))return!0;return!1}function fe(e,t){if(!Array.isArray(e)||e.length===0)throw Error(`Missing drafts in 'compileSchema({ $schema: "${t}" })'`);return e.length===1?e[0]:e.find(e=>new RegExp(e.$schemaRegEx,ce).test(t))??e[e.length-1]}function pe(e,t){return e==t?e??``:e==null||t==null?(e||t)??``:e.startsWith(t)?e:t.startsWith(e)?t:`${e}+${t}`}const me={compileSchema(e,t,n,i){let a=this;t??=a.evaluationPath;let o=t===a.evaluationPath?`#`:t.startsWith(`${a.evaluationPath}/`)?`#${t.slice(a.evaluationPath.length)}`:t,c={lastIdPointer:a.lastIdPointer,context:a.context,parent:a,evaluationPath:t,dynamicId:pe(a.dynamicId,i),schemaLocation:n??r(a.schemaLocation,o),reducers:[],resolvers:[],validators:[],schema:e,...me};return!F(e)&&!I(e)?(c.schemaValidation=[c.createError(`schema-error`,{pointer:n??t,schema:e,value:void 0,message:`JSON schema must be object or boolean - reveived: '${e}'`})],c):(c.schemaValidation=s(_e(c).filter(e=>e!=null)),c)},createError(e,t,n){let r=this,i=n;if(i===void 0){let n=r.schema?.errorMessages?.[e]??r.context.errors[e];if(typeof n==`function`)return n(t);i=k(n??name,t)}return{type:`error`,code:e,message:i,data:t}},createAnnotation(e,t,n){let r=this,i=n;if(i===void 0){let n=r.schema?.errorMessages?.[e]??r.context.errors[e];if(typeof n==`function`)return n(t);i=k(n??name,t)}return{type:`annotation`,code:e,message:i,data:t}},createSchema:f,getChildSelection(e){let t=this;return t.context.methods.getChildSelection(t,e)},getNode:ae,getNodeChild:oe,getNodeRef(e){return this.compileSchema({$ref:e},`$dynamic`).resolveRef()},getNodeRoot(){return this.context.rootNode},getDraftVersion(){return this.context.version},getData(e,t){let n=this,r={recursionLimit:1,...n.context.getDataDefaultOptions,cache:{},...t??{}};return n.context.methods.getData(n,e,r)},reduceNode(e,t={}){let n=this,{key:r=`missing-key`,pointer:i=n.evaluationPath,path:a}=t;if(n.schema===!1)return{node:n,error:void 0};if(n.schema===!0){let t=n.compileSchema(f(e),n.evaluationPath,n.schemaLocation,`${n.schemaLocation}(createSchema)`);return a?.push({pointer:i,node:n}),{node:t,error:void 0}}let o,s={...n},c=n.reducers;for(let t of c){let c=t({data:e,key:r,node:n,pointer:i,path:[...a??[],{pointer:i,node:n}]});if(L(c))return{node:void 0,error:c};if(c){if(c.schema===!1){o=!1;break}s=O(s,c)}}return o===!1?{node:{...n,schema:!1,reducers:[]},error:void 0}:(s!==n&&a?.push({pointer:i,node:n}),s=O(s,s,le,...se),{node:s,error:void 0})},validate(e,t=`#`,n=[]){let r=this,i=A(r,e,t,n)??[],a=[],o=[],c=s(Array.isArray(i)?i:[i]).filter(L),l=[];return s(Array.isArray(i)?i:[i]).forEach(e=>{if(L(e)){if(r.context.throwOnInvalidRef&&e.code===`ref-error`){let t=Error(`Invalid $ref: `+e.message);throw t.data=a,t}a.push(e)}else e instanceof Promise?l.push(e.then(s)):be(e)&&o.push(e)}),{valid:c.length===0,errors:a,annotations:o,errorsAsync:l}},addRemoteSchema(e,n){let r=this,{context:i}=r,a=F(n)?r.context.draft??n.$schema:void 0,o=fe(i.drafts,a??i.rootNode.schema?.$schema),c={$id:b(e),evaluationPath:`#`,lastIdPointer:`#`,schemaLocation:`#`,dynamicId:``,reducers:[],resolvers:[],validators:[],schema:n,context:{...i,refs:{},anchors:{},...t(C(o,`methods`,`keywords`,`version`,`formats`,`errors`))},...me};c.context.rootNode=c,c.context.remotes[b(e)]=c;let l=_e(c).filter(e=>e!=null);c.$id!=null&&(c.context.remotes[c.$id]=c),l=s(l);let u=[],d=[],f=c.context.rootNode.$id??b(e);return l.forEach(e=>{L(e)?(e.data.schemaId=f,u.push(e)):be(e)&&(e.data.schemaId=f,d.push(e))}),r.schemaErrors=(r.schemaErrors??[]).concat(u),r.schemaAnnotations=(r.schemaAnnotations??[]).concat(d),r},resolveRef(e){throw Error(`method 'resolveRef' is not implemented`)},toSchemaNodes(){return h(this)},toDataNodes(e,t){let n=this;return n.context.methods.toDataNodes(n,e,t)},toJSON(){let e=this;return{...e,context:void 0,errors:void 0,parent:e.parent?.evaluationPath}}},he=[`$ref`,`if`,`$defs`],ge=[`draft-04`,`draft-06`,`draft-07`];function _e(e){if(e.schema.$ref!=null&&ge.includes(e.context.version))return e.context.keywords.filter(({keyword:e})=>e===`$ref`||e===`$defs`).map(t=>ve(t,e));let t=Object.keys(e.schema),n=e.context.keywords.filter(({keyword:e})=>he.includes(e)||t.includes(e)).map(t=>ve(t,e));return t.filter(t=>!t.startsWith(`x-`)&&!ue.includes(t)&&e.context.keywords.find(e=>e.keyword===t)==null).forEach(t=>{n.push(e.createAnnotation(`unknown-keyword-warning`,{$id:e.$id,pointer:`${e.schemaLocation}/${t}`,schema:e.schema,value:t,draft:e.getDraftVersion()}))}),n}function ve(e,t){let n=e.parse?.(t);return e.reduce&&e.addReduce?.(t)&&t.reducers.push(e.reduce),e.resolve&&e.addResolve?.(t)&&t.resolvers.push(e.resolve),e.validate&&e.addValidate?.(t)&&t.validators.push(e.validate),n}function F(e){return d(e)}function I(e){return typeof e==`boolean`}function ye(e){return d(e)&&(e?.type&&e?.code&&e?.data)!=null}function be(e){return d(e)&&e.type===`annotation`}function L(e){return d(e)&&e.type===`error`}function R(e){return typeof e==`number`}const xe=/(#)+$/g,Se=[``,null,`#`];function Ce(e){if(Se.includes(e))return[];if(e=e.replace(xe,``),e.indexOf(`#`)===-1)return[e.replace(/(#|\/)+$/g,``)];if(e.indexOf(`#`)===0)return[e.replace(xe,``)];let t=e.split(`#`);return t[0]=t[0].replace(/(#|\/)+$/g,``),t[1]=`#${t[1].replace(xe,``)}`,t}function we(e,...t){let n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}const Te={id:`$ref`,keyword:`$ref`,order:10,parse:De,addReduce:e=>e.$ref!=null||e.schema.$dynamicRef!=null,reduce:Oe,addValidate:({schema:e})=>e.$ref!=null||e.$dynamicRef!=null,validate:Me};function Ee(e,t){!e.dynamicId&&e.context.refs[t]==null&&(e.context.refs[t]=e)}function De(e){e.resolveRef=e.schema.$ref!=null&&e.schema.$dynamicRef!=null?je:ke;let t=b(e.parent?.$id??e.$id,e.schema?.$id);e.$id=t,e.lastIdPointer=e.parent?.lastIdPointer??`#`,t!==e.parent?.$id&&e.evaluationPath!==`#`&&(e.lastIdPointer=e.evaluationPath),e.lastIdPointer!==`#`&&e.evaluationPath.startsWith(e.lastIdPointer)&&Ee(e,b(t,`#${e.evaluationPath.replace(e.lastIdPointer,``)}`)),Ee(e,b(e.context.rootNode.$id,e.evaluationPath));let r=e.schema.$anchor;if(r&&!e.dynamicId){let n=`${t.replace(/#$/,``)}#${r}`;e.context.anchors[n]??(e.context.anchors[n]=e)}let i=e.schema.$dynamicAnchor;if(i&&!e.dynamicId){let n=`${t.replace(/#$/,``)}#${i}`;e.context.dynamicAnchors[n]??(e.context.dynamicAnchors[n]=e)}if(e.schema.$ref!=null&&(e.$ref=b(t,e.schema.$ref),e.$ref.startsWith(`/`)&&(e.$ref=`#${e.$ref}`)),e.$ref?.startsWith(`#/$defs/`)&&n(e.getNodeRoot().schema,e.$ref)==null)return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/$ref`,schema:e.schema,value:e.schema.$ref,message:`Invalid $ref to missing target '${e.schema.ref}'`})}function Oe({node:e,data:t,key:n,pointer:r,path:i}){if(e==null)return;let a=e.resolveRef({pointer:r,path:i});if(L(a))return a;if(a==null)return e.createError(`ref-error`,{ref:e.schema.$ref??e.schema.$dynamicRef,pointer:r,schema:e.schema,value:t});if(e.resolveRef===je){let e=a.reduceNode(t,{key:n,pointer:r,path:i});return e.node??e.error}if(a.context===e.context&&a.$id===e.$id&&a.schemaLocation===e.schemaLocation)return a;let{node:o,error:s}=O(e,a).reduceNode(t,{key:n,pointer:r,path:i});return o??s}function ke(e={}){let{pointer:t,path:n=[]}=e;if(this.schema.$dynamicRef!=null){let e=Ne(this,n);return L(e)||n.push({pointer:t,node:e}),e}return Ae.call(this,e)}function Ae({pointer:e,path:t=[]}={}){if(this.$ref==null)return this;let n=Pe(this);return P(n)&&t.push({pointer:e,node:n}),n}function je(){let e=this.context.version===`draft-2019-09`?`$recursiveRef`:`$dynamicRef`;return this.compileSchema({...C(this.schema,...c.PROPERTIES_TO_MERGE),allOf:[{$ref:this.schema.$ref},{[e]:this.schema[e]}]},`${this.evaluationPath}/$ref`,`${this.schemaLocation}/$ref`,`${this.schemaLocation}($ref+${e})`)}function Me({node:e,data:t,pointer:n=`#`,path:r}){let i=e.resolveRef({pointer:n,path:r});return i==null?e.createError(`ref-error`,{ref:e.schema.$ref??e.schema.$dynamicRef,pointer:n,schema:e.schema,value:t}):A(i,t,n,r)}function Ne(e,t){let n=b(e.$id,e.schema.$dynamicRef),[r,i]=Ce(n),a=r&&e.context.remotes[r];if(a&&i&&(n=b(a.$id,i)),e.context.dynamicAnchors[n]==null)return Pe(e,n);let o=e.schema.$dynamicRef.split(`#`).pop();for(let n of t){let t=b(n.node.$id,`#${o}`),r=e.context.dynamicAnchors[t];if(r)return z(r,e)}return Pe(e,n)}function z(e,t){let n=e.schema;return d(e.schema)&&(n={...we(e.schema,`$id`),...C(t.schema,...c.PROPERTIES_TO_MERGE)}),e.compileSchema(n,`${t.evaluationPath}/$ref`,e.schemaLocation,t.dynamicId||`${t.schemaLocation}($ref)`)}function Pe(e,t=e?.$ref){if(t==null)return e;if(e.context.refs[t])return z(e.context.refs[t],e);if(e.context.anchors[t])return z(e.context.anchors[t],e);if(e.context.dynamicAnchors[t])return z(e.context.dynamicAnchors[t],e);let r=Ce(t);if(r.length===0)return e.createError(`ref-error`,{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0});if(r.length===1){let t=r[0];if(e.context.remotes[t])return z(e.context.remotes[t],e);if(t[0]===`#`){let r=e.context.rootNode.schema,i=n(r,t);if(F(i)||I(i))return z(e.context.rootNode.compileSchema(i,t,t),e)}return e.createError(`ref-error`,{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0})}if(r.length===2){let n=r[0];if(e.context.remotes[n]&&e!==e.context.remotes[n]){let t=e.context.remotes[n],i=Pe(t,b(t.$id,r[1]));if(P(i)||(i=Pe(t,r[1]),P(i)))return i}if(e.context.refs[n]){let a=e.context.refs[n],o=i(r[1]),s=a;for(let n of o)if(s=s[n===`definitions`?`$defs`:n],s==null)return e.createError(`ref-error`,{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0,host:r[0],local:r[1]});return s}}return e.createError(`ref-error`,{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0})}function B(e,...t){return t.reduce((e,t)=>(t.schemaValidation&&e.push(...t.schemaValidation),e),e)}const Fe={id:`$defs`,keyword:`$defs`,parse:Ie};function Ie(e){let t=[];return e.schema.$defs&&(d(e.schema.$defs)?(e.$defs=e.$defs??{},Object.keys(e.schema.$defs).forEach(n=>{e.$defs[n]=e.compileSchema(e.schema.$defs[n],`${e.evaluationPath}/$defs/${Le(n)}`,`${e.schemaLocation}/$defs/${n}`),B(t,e.$defs[n])})):t.push(e.createError(`schema-error`,{pointer:e.schemaLocation,schema:e.schema,value:e.schema.$defs,message:`$defs must be an object - received: ${typeof e.schema.$defs}`}))),e.schema.definitions&&(d(e.schema.definitions)||t.push(e.createError(`schema-error`,{pointer:e.schemaLocation,schema:e.schema,value:e.schema.$defs,message:`definitions must be an object - received: ${typeof e.schema.definitions}`})),e.$defs=e.$defs??{},Object.keys(e.schema.definitions).forEach(n=>{e.$defs[n]=e.compileSchema(e.schema.definitions[n],`${e.evaluationPath}/definitions/${Le(n)}`,`${e.schemaLocation}/definitions/${Le(n)}`),B(t,e.$defs[n])})),t}function Le(e){return e=e.replace(/~/g,`~0`),e=e.replace(/\//g,`~1`),encodeURIComponent(e)}const Re={id:`$ref`,keyword:`$ref`,parse:ze,addValidate:({schema:e})=>e.$ref!=null,validate:Be};function ze(e){let t=e.parent?.$id??e.$id;if(e.schema?.$ref??(t=b(t,e.schema?.$id)),e.$id=t,e.lastIdPointer=e.parent?.lastIdPointer??`#`,e.resolveRef=Ae,!e.dynamicId&&e.context.refs[t]==null&&(e.context.refs[t]=e),t!==e.parent?.$id&&(e.lastIdPointer=e.evaluationPath),!e.dynamicId){if(e.lastIdPointer!==`#`&&e.evaluationPath.startsWith(e.lastIdPointer)){let n=`#${e.evaluationPath.replace(e.lastIdPointer,``)}`;e.context.refs[b(t,n)]=e}else e.context.refs[b(t,e.evaluationPath)]=e;e.context.refs[b(e.context.rootNode.$id,e.evaluationPath)]=e}e.schema.$ref!=null&&(e.$ref=b(t,e.schema.$ref))}function Be({node:e,data:t,pointer:n=`#`,path:r}){let i=Ve(e,n,r);return P(i)?A(i,t,n,r):e.createError(`ref-error`,{ref:e.schema.$ref,pointer:n,schema:e.schema,value:t})}function Ve(e,t,n){let r=e.resolveRef({pointer:t,path:n});return P(r)?r!==e&&r?Ve(r,t,n):e:e.createError(`ref-error`,{ref:e.schema.$ref,pointer:t,schema:e.schema,value:void 0})}const He={id:`$ref`,keyword:`$ref`,parse:We,addValidate:({schema:e})=>e.$ref!=null,validate:Re.validate};function Ue(e,t){!e.dynamicId&&e.context.refs[t]==null&&(e.context.refs[t]=e)}function We(e){let t=e.parent?.$id??e.$id;if(e.schema?.$ref==null&&e.schema?.id&&(t=b(t,e.schema.id)),e.$id=t,e.lastIdPointer=e.parent?.lastIdPointer??`#`,e.resolveRef=Ge,Ue(e,t),t!==e.parent?.$id&&(e.lastIdPointer=e.evaluationPath),e.lastIdPointer!==`#`&&e.evaluationPath.startsWith(e.lastIdPointer)){let n=`#${e.evaluationPath.replace(e.lastIdPointer,``)}`;Ue(e,b(t,n))}else Ue(e,b(t,e.evaluationPath));Ue(e,b(e.context.rootNode.$id,e.evaluationPath)),e.schema.$ref!=null&&(e.$ref=b(t,e.schema.$ref))}function Ge({pointer:e,path:t}={}){if(this.$ref==null)return this;let n=qe(this);return P(n)&&t?.push({pointer:e,node:n}),n}function Ke(e,t){let n=d(e.schema)?we(e.schema,`id`):e.schema;return e.compileSchema(n,`${t.evaluationPath}/$ref`,e.schemaLocation,t.dynamicId||`${t.schemaLocation}($ref)`)}function qe(e,t=e?.$ref){if(t==null)return e;if(e.context.refs[t])return Ke(e.context.refs[t],e);if(e.context.anchors[t])return Ke(e.context.anchors[t],e);let n=Ce(t);if(n.length===0)return e.createError(`ref-error`,{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0});if(n.length===1){let t=n[0];return e.context.remotes[t]?Ke(e.context.remotes[t],e):e.createError(`ref-error`,{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0})}if(n.length===2){let t=n[0];if(e.context.remotes[t]&&e!==e.context.remotes[t]){let r=e.context.remotes[t],i=qe(r,b(r.$id,n[1]));if(P(i)||(i=qe(r,n[1]),P(i)))return i}let r=n[0];if(e.context.refs[r]){let t=e.context.refs[r],i=n[1].split(`$defs/`).pop();if(i&&t?.$defs)return qe(t.$defs[i])}return}return e.createError(`ref-error`,{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0})}const Je=`additionalItems`,Ye={id:Je,keyword:Je,order:-10,parse:Xe,addResolve:e=>e.items!=null,resolve:Ze,addValidate:({schema:e})=>e[Je]!=null&&e[Je]!==!0&&Array.isArray(e.items),validate:Qe};function Xe(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e;if(t.additionalItems==null||t.additionalItems===!1)return;let i=t[Je];if(!(d(i)||i===!0))return e.createError(`schema-error`,{pointer:n,schema:t,value:void 0,message:`Keyword '${Je}' must be an object or a boolean - received '${typeof i}'`});if(!Array.isArray(t.items))return e.createAnnotation(`schema-error`,{pointer:n,schema:t,value:void 0,message:`Keyword '${Je}' is only evaluated with a given items-array`});e.items=e.compileSchema(t.additionalItems,`${n}/additionalItems`,`${r}/additionalItems`)}function Ze({node:e,key:t,data:n}){if(Array.isArray(n)){let r=N(n,t),{node:i,error:a}=e.items.reduceNode(r);return i??a}}function Qe({node:e,data:t,pointer:n,path:r}){let{schema:i}=e;if(!Array.isArray(t)||t.length===0||Array.isArray(i.items)&&i.items.length>=t.length)return;let a=Array.isArray(i.items)?i.items.length:0,o=[];for(let s=a;s<t.length;s+=1){let a=t[s];if(e.items){let t=A(e.items,a,`${n}/${s}`,r);t&&o.push(...t)}else i.additionalItems===!1&&o.push(e.createError(`additional-items-error`,{key:s,pointer:`${n}/${s}`,value:t,schema:i}))}return o}const $e={id:`additionalProperties`,keyword:`additionalProperties`,order:-10,parse:et,addResolve:({schema:e})=>e.additionalProperties!=null,resolve:tt,addValidate:({schema:e})=>e.additionalProperties!==!0&&e.additionalProperties!=null&&!(e.additionalProperties===!1&&d(e.patternProperties)),validate:nt};function et(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e;if(!(t.additionalProperties==null||I(t.additionalProperties)))return d(t.additionalProperties)?(e.additionalProperties=e.compileSchema(t.additionalProperties,`${n}/additionalProperties`,`${r}/additionalProperties`),e.additionalProperties.schemaValidation):e.createError(`schema-error`,{pointer:e.schemaLocation,schema:t,value:t.additionalProperties,message:`keyword 'additionalProperties' must be a valid JSON Schema - receoved: ${typeof t.additionalProperties}`})}function tt({node:e,data:t,key:n,pointer:r=`#`,path:i=[]}){let a=N(t,n);if(e.additionalProperties){let{node:t,error:n}=e.additionalProperties.reduceNode(a,{pointer:r,path:i});return t??n}if(e.schema.additionalProperties===!1)return e.createError(`no-additional-properties-error`,{pointer:`${n}`,schema:e.schema,value:N(t,n),property:`${n}`})}function nt({node:e,data:t,pointer:n=`#`,path:r}){if(!d(t))return;let{schema:i}=e,a=[],o=Object.keys(t).filter(e=>c.propertyBlacklist.includes(e)===!1),s=e.patternProperties;Array.isArray(s)&&(o=o.filter(e=>{for(let t of s)if(t.pattern.test(e))return!1;return!0}));let l=e.properties?Object.keys(e.properties):[];return o.filter(e=>l.indexOf(e)===-1).forEach(o=>{let s=N(t,o);if(s!==void 0)if(d(e.additionalProperties)){let t=A(e.additionalProperties,s,`${n}/${o}`,r);t&&a.push(...t)}else a.push(e.createError(`no-additional-properties-error`,{pointer:`${n}/${o}`,schema:i,value:t,property:o,properties:l}))}),a}const V=`allOf`,rt={id:V,keyword:V,parse:it,addReduce:e=>e[V]!=null,reduce:at,addValidate:e=>e[V]!=null,validate:ot};function it(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e;if(t[V]!=null){if(!Array.isArray(t[V]))return e.createError(`schema-error`,{pointer:r,schema:t,value:t[V],message:`Keyword '${V}' must be an array - received '${typeof t[V]}'`});if(t[V].length!==0)return e[V]=t[V].map((t,i)=>e.compileSchema(t,`${n}/${V}/${i}`,`${r}/${V}/${i}`)),B([],...e[V])}}function at({node:e,data:t,key:n,pointer:r,path:i}){if(e[V]==null)return;let a={},o,s=``;for(let c=0;c<e[V].length;c+=1){let{node:l}=e[V][c].reduceNode(t,{key:n,pointer:r,path:[...i]});if(l){let t=l.dynamicId?.replace(e.dynamicId,``)??``,n=t===``?`${V}/${c}`:t;s+=`${s===``?``:`,`}${n}`;let r=I(e[V][c].schema)?e[V][c]:l;a=x(a,r.schema,V,`contains`),o=O(o,r,V,`contains`)}}return D(e.compileSchema(a,`${e.evaluationPath}/${s}`,e.schemaLocation,`${e.schemaLocation}(${s})`),o,V,`contains`)}function ot({node:e,data:t,pointer:n,path:r}){if(!Array.isArray(e[V])||e[V].length===0)return;let i=[];return e[V].forEach(e=>{i.push(...A(e,t,n,r))}),i}const H=`anyOf`,st={id:H,keyword:H,parse:ct,addReduce:e=>e[H]!=null,reduce:lt,addValidate:e=>e[H]!=null,validate:ut};function ct(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e;if(t[H]!=null){if(!Array.isArray(t[H]))return e.createError(`schema-error`,{pointer:r,schema:t,value:t[H],message:`Keyword '${H}' must be an array - received '${typeof t[H]}'`});if(t[H].length!==0)return e[H]=t[H].map((t,i)=>e.compileSchema(t,`${n}/${H}/${i}`,`${r}/${H}/${i}`)),B([],...e[H])}}function lt({node:e,data:t,key:n,pointer:r,path:i}){if(e[H]==null)return;let a={},o,s=``;for(let c=0;c<e[H].length;c+=1)if(A(e[H][c],t,r,i).length===0){let{node:l}=e[H][c].reduceNode(t,{key:n,pointer:r,path:[...i]});if(l){let t=l.dynamicId?.replace(e.dynamicId,``)??``,n=t===``?`${H}/${c}`:t;s+=`${s===``?``:`,`}${n}`;let r=I(e[H][c].schema)?e[H][c]:l;a=x(a,r.schema,H),o=O(o,r,H)}}return D(e.compileSchema(a,`${e.evaluationPath}${s}`,e.schemaLocation,`${e.schemaLocation}(${s})`),o,H)}function ut({node:e,data:t,pointer:n,path:r}){if(e[H]!=null){for(let i of e[H])if(A(i,t,n,r).length===0)return;return e.createError(`any-of-error`,{pointer:n,schema:e.schema,value:t,anyOf:e.schema[H]})}}const U=`contains`,dt={id:U,keyword:U,parse:ft,addValidate:e=>e[U]!=null,validate:pt,addReduce:e=>e[U]!=null,reduce:({node:e})=>e.compileSchema({items:{anyOf:[e[U].schema]}},e.evaluationPath,e.schemaLocation)};function ft(e){let t=e.schema[U];if(t!=null)return F(t)||I(t)?(e[U]=e.compileSchema(t,`${e.evaluationPath}/${U}`),e[U].schemaValidation):e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${U}`,schema:e.schema,value:t,message:`Keyword '${U}' must be a valid JSON Schema - received '${typeof t}'`})}function pt({node:e,data:t,pointer:n,path:r}){let{schema:i}=e;if(!Array.isArray(t))return;if(i.contains===!1)return e.createError(`contains-array-error`,{pointer:n,value:t,schema:i});if(i.contains===!0)return Array.isArray(t)&&t.length===0?e.createError(`contains-any-error`,{pointer:n,value:t,schema:i}):void 0;if(!d(i.contains)||!Array.isArray(t))return;let a=0;for(let i of t)A(e.contains,i,n,r).length===0&&a++;let o=i.maxContains??1/0,s=i.minContains??1;if(!(o>=a&&s<=a))return o<a?e.createError(`contains-max-error`,{pointer:n,schema:i,delta:a-o,value:t}):s>a?e.createError(`contains-min-error`,{pointer:n,schema:i,delta:s-a,value:t}):e.createError(`contains-error`,{pointer:n,schema:i,value:t})}function mt(e){return Array.isArray(e)&&e.find(e=>typeof e!=`string`)==null}const W=`dependentRequired`,ht={id:W,keyword:W,parse:gt,addValidate:e=>e[W]!=null,validate:_t};function gt(e){let{schema:t}=e;if(t[W]==null)return;if(!d(t[W]))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${W}`,schema:t,value:t[W],message:`Keyword '${W}' must be an object - received '${typeof t[W]}'`});let n=[];e.dependentRequired={};for(let r of Object.keys(t[W])){let i=t[W][r];mt(i)?e.dependentRequired[r]=i:n.push(e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${W}/${r}`,schema:t,value:i,message:`Keyword '${W}[string]' must be a string[] - received '${typeof i}'`}))}return n}function _t({node:e,data:t,pointer:n=`#`}){let{dependentRequired:r}=e;if(r==null||!d(t))return;let i=[];return Object.keys(t).forEach(a=>{let o=r[a];if(Array.isArray(o))for(let r=0,a=o.length;r<a;r+=1)t[o[r]]===void 0&&i.push(e.createError(`missing-dependency-error`,{missingProperty:o[r],pointer:n,schema:e.schema,value:t}))}),i}const G=`dependentSchemas`,vt={id:G,keyword:G,parse:yt,addReduce:e=>e.dependentSchemas!=null,reduce:bt,addValidate:e=>e.dependentSchemas!=null,validate:xt};function yt(e){let{dependentSchemas:t}=e.schema;if(t==null)return;if(!d(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${G}`,schema:e.schema,value:t,message:`Keyword '${G}' must be an object - received '${typeof t}'`});if(Object.keys(t).length===0)return;let n=[],r={};for(let i of Object.keys(t)){let a=t[i];d(a)?(r[i]=e.compileSchema(a,`${e.evaluationPath}/${G}/${i}`,`${e.schemaLocation}/${G}/${i}`),B(n,r[i])):I(a)?r[i]=a:n.push(e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${G}/${i}`,schema:e.schema,value:a,message:`Keyword '${G}[string]' must be a valid JSON Schema'`}))}return e.dependentSchemas=r,n}function bt({node:e,data:t,key:n,pointer:r,path:i}){let{dependentSchemas:a}=e;if(!d(t)||a==null)return e;let o,s,c=0,l=`${e.schemaLocation}(`;for(let u of Object.keys(t)){let d=a[u];if(d!=null){if(d===!1)return e.compileSchema(!1,e.evaluationPath,e.schemaLocation,`${e.schemaLocation}(${G}/${u})`);if(o??={},P(d)){let{node:e}=d.reduceNode(t,{key:n,pointer:r,path:[...i]});e&&(o=x(o,e.schema),s=O(s,e,G))}l+=`${c?`,`:``}${G}/${u}`,c++}}return o==null?e:(o=x(e.schema,o,G),D(e.compileSchema(o,e.evaluationPath,e.schemaLocation,`${l})`),s,G))}function xt({node:e,data:t,pointer:n,path:r}){let{schema:i,dependentSchemas:a}=e;if(!d(t)||a==null)return;let o=[];return Object.keys(t).forEach(c=>{let l=a[c];if(l!==!0){if(l===!1){o.push(e.createError(`missing-dependency-error`,{pointer:n,schema:i,value:t}));return}if(P(l)){s(A(l,t,n,r),o);return}}}),o}const K=`dependencies`,St={id:K,keyword:K,parse:Ct,order:-9,addReduce:e=>e.schema[K]!=null,reduce:wt,addValidate:e=>e.schema[K]!=null,validate:Tt};function Ct(e){let{dependencies:t}=e.schema;if(!d(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${K}`,schema:e.schema,value:t,message:`Keyword '${K}' must be an object - received ${typeof t}`});let n=[];for(let r of Object.keys(t)){let i=t[r];F(i)||I(i)?(e.dependentSchemas=e.dependentSchemas??{},e.dependentSchemas[r]=e.compileSchema(i,`${e.evaluationPath}/${K}/${r}`,`${e.schemaLocation}/${K}/${r}`),B(n,e.dependentSchemas[r])):mt(i)?(e.dependentRequired=e.dependentRequired??{},e.dependentRequired[r]=i):n.push(e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${K}`,schema:e.schema,value:t,message:`Keyword '${K}[string]' must be JSON Schema or string[]`}))}return n}function wt({node:e,data:t,key:n,pointer:r,path:i}){if(!d(t)||e.dependentRequired==null&&e.dependentSchemas==null)return e;let a=e.compileSchema(e.schema,e.evaluationPath,e.schemaLocation),o=a.schema.required??[],s=``,c=e.dependentRequired;c&&Object.keys(c).forEach(e=>{if(!M(t,e)&&!o.includes(e)||c[e]==null)return;o.push(...c[e]);let n=`${K}/${e}`;s+=`${s===``?``:`,`}${n}`});let l=e.dependentSchemas;if(l)for(let c of Object.keys(l)){if(!M(t,c)&&!o.includes(c))continue;let u=l[c];if(!P(u))continue;Array.isArray(u.schema.required)&&o.push(...u.schema.required);let{node:d,error:f}={...u,schema:{...u.schema,required:o}}.reduceNode(t,{key:n,pointer:`${r}/${K}/${c}`,path:[...i]});if(!d)return f;a=O(a,d);let p=d.dynamicId?.replace(e.dynamicId,``)??``,m=p===``?`${K}/${c}`:p;s+=`${s===``?``:`,`}${m}`}return a===e?e:o.length===0?a:(o=a.schema.required?a.schema.required.concat(...o):o,o=o.filter((e,t,n)=>n.indexOf(e)===t),a=O(a,a,K),a.compileSchema({...a.schema,required:o},a.evaluationPath,a.schemaLocation,`${e.schemaLocation}(${s})`))}function Tt({node:e,data:t,pointer:n,path:r}){if(!d(t))return;let i=[];return e.dependentRequired&&s(_t({node:e,data:t,pointer:n,path:r}),i),e.dependentSchemas&&s(xt({node:e,data:t,pointer:n,path:r}),i),i}const Et=`deprecated`,Dt={id:Et,keyword:Et,parse:Ot,addValidate:e=>e[Et]===!0,validate:kt};function Ot(e){let t=e.schema[Et];if(t!=null){if(typeof t!=`boolean`)return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Et}`,schema:e.schema,value:t,message:`Keyword '${Et}' must be a boolean - received '${typeof t}'`});e[Et]=t}}function kt({node:e,data:t,pointer:n}){return[e.createAnnotation(`deprecated-warning`,{pointer:n,schema:e.schema,value:t},e.schema.deprecatedMessage)]}const q=`enum`,At={id:q,keyword:q,parse:jt,addValidate:e=>e.enum!=null,validate:Mt};function jt(e){let{schema:t}=e;if(t[q]!=null){if(!Array.isArray(t[q]))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${q}`,schema:t,value:t[q],message:`Keyword '${q}' must be an array - received '${typeof t[q]}'`});e.enum=t[q]}}function Mt({node:e,data:t,pointer:n=`#`}){if(e.enum==null)return;let r=u(t);if(r===`object`||r===`array`){let n=JSON.stringify(t);for(let t of e.enum)if(JSON.stringify(t)===n)return}else if(e.enum.includes(t))return;return e.createError(`enum-error`,{pointer:n,schema:e.schema,value:t,values:e.enum})}const Nt={"additional-items-error":"Array at `{{pointer}}` may not have an additional item `{{key}}`","additional-properties-error":"Additional property `{{property}}` on `{{pointer}}` does not match schema `{{schema}}`","all-of-error":"Value `{{value}}` at `{{pointer}}` does not match schema of `{{allOf}}`","any-of-error":"Value `{{value}}` at `{{pointer}}` does not match any schema of `{{anyOf}}`","const-error":"Expected value at `{{pointer}}` to be `{{expected}}`, but value given is `{{value}}`","contains-any-error":"The array at `{{pointer}}` must contain at least one item","contains-array-error":"The property at `{{pointer}}` must not be an array","contains-error":"The array at `{{pointer}}` must contain an element that matches `{{schema}}`","contains-min-error":"The array at `{{pointer}}` contains {{delta}} too few items matching `{{schema}}`","contains-max-error":"The array at `{{pointer}}` contains {{delta}} too many items matching `{{schema}}`","enum-error":"Expected given value `{{value}}` in `{{pointer}}` to be one of `{{values}}`","exclusive-maximum-error":"Value in `{{pointer}}` is `{{length}}`, but should be at most `{{maximum}}`","exclusive-minimum-error":"Value in `{{pointer}}` is `{{length}}`, but should be at minimum `{{minimum}}`","forbidden-property-error":"Property name `{{property}}` at `{{pointer}}` is not allowed","format-date-error":"Value `{{value}}` at `{{pointer}}` is not a valid date","format-date-time-error":"Value `{{value}}` at `{{pointer}}` is not a valid date-time","format-duration-error":"Value `{{value}}` at `{{pointer}}` is not a valid duration","format-email-error":"Value `{{value}}` at `{{pointer}}` is not a valid email","format-hostname-error":"Value `{{value}}` at `{{pointer}}` is not a valid hostname","format-idn-hostname-error":"Value `{{value}}` at `{{pointer}}` is not a valid idn hostname","format-ipv4-error":"Value `{{value}}` at `{{pointer}}` is not a valid IPv4 address","format-ipv4-leading-zero-error":`IPv4 addresses starting with zero are invalid, since they are interpreted as octals`,"format-ipv6-error":"Value `{{value}}` at `{{pointer}}` is not a valid IPv6 address","format-ipv6-leading-zero-error":`IPv6 addresses starting with zero are invalid, since they are interpreted as octals`,"format-iri-error":"Value `{{value}}` at `{{pointer}}` is not a valid iri","format-iri-reference-error":"Value `{{value}}` at `{{pointer}}` is not a valid iri-reference","format-json-pointer-error":"Value `{{value}}` at `{{pointer}}` is not a valid json-pointer","format-regex-error":"Value `{{value}}` at `{{pointer}}` is not a valid regular expression","format-time-error":"Value `{{value}}` at `{{pointer}}` is not a valid time","format-uri-error":"Value `{{value}}` at `{{pointer}}` is not a valid uri","format-uri-reference-error":"Value `{{value}}` at `{{pointer}}` is not a valid uri-reference","format-uri-template-error":"Value `{{value}}` at `{{pointer}}` is not a valid uri-template","format-url-error":"Value `{{value}}` at `{{pointer}}` is not a valid url","format-uuid-error":"Value `{{value}}` at `{{pointer}}` is not a valid uuid","invalid-data-error":"No value may be specified in `{{pointer}}`","invalid-property-name-error":"Invalid property name `{{property}}` at `{{pointer}}`","maximum-error":"Value in `{{pointer}}` is `{{length}}`, but should be `{{maximum}}` at maximum","max-items-error":"Too many items in `{{pointer}}`, should be `{{maximum}}` at most, but got `{{length}}`","max-length-error":"Value `{{pointer}}` should have a maximum length of `{{maxLength}}`, but got `{{length}}`.","max-properties-error":"Too many properties in `{{pointer}}`, should be `{{maxProperties}}` at most, but got `{{length}}`","minimum-error":"Value in `{{pointer}}` is `{{length}}`, but should be `{{minimum}}` at minimum","min-items-error":"Too few items in `{{pointer}}`, should be at least `{{minItems}}`, but got `{{length}}`","min-items-one-error":"At least one item is required in `{{pointer}}`","min-length-error":"Value `{{pointer}}` should have a minimum length of `{{minLength}}`, but got `{{length}}`.","min-length-one-error":"A value is required in `{{pointer}}`","missing-one-of-declarator-error":"Missing oneOf declarator `{{declarator}}` in schema `{{schemaLocation}}`","min-properties-error":"Too few properties in `{{pointer}}`, should be at least `{{minProperties}}`, but got `{{length}}`","missing-array-item-error":`Array at '{{pointer}}' has a missing item at '{{key}}'`,"missing-dependency-error":"The required propery '{{missingProperty}}' in `{{pointer}}` is missing","missing-one-of-property-error":"Value at `{{pointer}}` must be object or array and have a property ${oneOfProperty}: ${value}","multiple-of-error":"Expected `{{value}}` in `{{pointer}}` to be multiple of `{{multipleOf}}`","multiple-one-of-error":"Value `{{value}}` should not match multiple schemas in oneOf `{{matches}}`","no-additional-properties-error":"Additional property `{{property}}` in `{{pointer}}` is not allowed","not-error":"Value `{{value}}` at pointer should not match schema `{{not}}`","one-of-error":"Value `{{value}}` in `{{pointer}}` does not match any given oneof schema","one-of-property-error":"Failed finding a matching oneOfProperty schema in `{{pointer}}` where `{{property}}` matches `{{value}}`","pattern-error":"Value in `{{pointer}}` should match `{{description}}`, but received `{{received}}`","pattern-properties-error":"Property `{{key}}` does not match any patterns in `{{pointer}}`. Valid patterns are: {{patterns}}","ref-error":`Could not resolve $ref '{{ref}}' from '{{pointer}}'`,"required-property-error":"The required property `{{key}}` is missing at `{{pointer}}`","schema-warning":`Failed retrieving a schema from '{{pointer}}' to key '{{key}}'`,"type-error":"Expected `{{value}}` ({{received}}) in `{{pointer}}` to be of type `{{expected}}`","undefined-value-error":"Value must not be undefined in `{{pointer}}`","unevaluated-property-error":"Invalid unevaluated property `{{pointer}}`","unevaluated-items-error":"Invalid unevaluated item `{{pointer}}`","unique-items-error":"Items in array must be unique. Value `{{value}}` in `{{pointer}}` is a duplicate of {{duplicatePointer}}.","unknown-property-error":"Could not find a valid schema for property `{{pointer}}` within object","value-not-empty-error":"A value for `{{property}}` is required at `{{pointer}}`","deprecated-warning":"Value at `{{pointer}}` is deprecated","schema-error":`Invalid schema found at {{pointer}}: {{message}}`,"unknown-keyword-warning":`Keyword '{{value}}' is not a valid keyword to draft '{{draft}}'`,"unknown-format-warning":`Format {{value}} is not a valid format`},Pt={id:`exclusiveMaximum`,keyword:`exclusiveMaximum`,parse:Ft,addValidate:({schema:e})=>e.exclusiveMaximum===!0||!isNaN(e.maximum),validate:It};function Ft(e){let{exclusiveMaximum:t}=e.schema;if(t!=null&&typeof t!=`number`&&typeof t!=`boolean`)return e.createError(`schema-error`,{pointer:e.evaluationPath,schema:e.schema,value:void 0,message:`Keyword 'exclusiveMaximum' must be a number - received '${typeof t}'`})}function It({node:e,data:t,pointer:n}){if(typeof t==`number`&&e.schema.exclusiveMaximum&&e.schema.maximum===t)return e.createError(`maximum-error`,{maximum:e.schema.exclusiveMaximum,length:t,pointer:n,schema:e.schema,value:t})}const Lt={id:`exclusiveMinimum`,keyword:`exclusiveMinimum`,parse:Rt,addValidate:({schema:e})=>e.exclusiveMinimum===!0||!isNaN(e.minimum),validate:zt};function Rt(e){let{exclusiveMinimum:t}=e.schema;if(t!=null&&typeof t!=`number`&&typeof t!=`boolean`)return e.createError(`schema-error`,{pointer:e.evaluationPath,schema:e.schema,value:void 0,message:`Keyword 'exclusiveMinimum' must be a number - received '${typeof t}'`})}function zt({node:e,data:t,pointer:n}){if(typeof t==`number`&&e.schema.exclusiveMinimum&&e.schema.minimum===t)return e.createError(`minimum-error`,{minimum:e.schema.exclusiveMinimum,length:t,pointer:n,schema:e.schema,value:t})}const Bt=`format`,Vt={id:Bt,keyword:Bt,parse:Ht,addValidate:({schema:e})=>e?.format!=null,validate:Ut};function Ht(e){let t=e.schema[Bt];if(t!=null){if(typeof t!=`string`)return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Bt}`,schema:e.schema,value:t,message:`Keyword '${Bt}' must be a string - received '${typeof t}'`});if(e.context.formats[t]==null)return e.createAnnotation(`unknown-format-warning`,{pointer:`${e.schemaLocation}/${Bt}`,schema:e.schema,value:t,message:`Keyword '${Bt}' must be a string - received '${typeof t}'`})}}function Ut(e){let{node:t}=e,n=t.context.formats[t.schema.format];return n?.(e)}const{REGEX_FLAGS:Wt}=c,Gt=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Kt=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,qt=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Jt=/^(?<time>(?:([0-1]\d|2[0-3]):[0-5]\d:(?<second>[0-5]\d|60)))(?:\.\d+)?(?<offset>(?:z|[+-]([0-1]\d|2[0-3])(?::?[0-5]\d)?))$/i,Yt=[0,31,28,31,30,31,30,31,31,30,31,30,31],Xt=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Zt=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Qt=/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,$t={date:({node:e,pointer:t,data:n})=>{let{schema:r}=e;if(typeof n!=`string`||n===``)return;let i=n.match(qt);if(!i)return e.createError(`format-date-error`,{value:n,pointer:t,schema:r});let a=+i[1],o=+i[2],s=+i[3],c=a%4==0&&(a%100!=0||a%400==0);if(!(o>=1&&o<=12&&s>=1&&s<=(o==2&&c?29:Yt[o])))return e.createError(`format-date-error`,{value:n,pointer:t,schema:r})},"date-time":({node:e,pointer:t,data:n,path:r})=>{let{schema:i}=e;if(typeof n!=`string`||n===``)return;let a=n.split(/t/i);if(a.length===2){let n=$t.date({node:e,pointer:t,data:a[0],path:r})===void 0,i=$t.time({node:e,pointer:t,data:a[1],path:r})===void 0;if(n&&i)return}return e.createError(`format-date-time-error`,{value:n,pointer:t,schema:i})},duration:({node:e,pointer:t,data:n})=>{if(u(n)===`string`&&(!Qt.test(n)||/(\d+M)(\d+W)|(\d+Y)(\d+W)/.test(n)))return e.createError(`format-duration-error`,{value:n,pointer:t,schema:e.schema})},email:({node:e,pointer:t,data:n})=>{let{schema:r}=e;if(typeof n!=`string`||n===``)return;let i=n.lastIndexOf(`@`),a=n.substr(0,i),o=n.substr(i+1);if(!a||!o||a.length>64||o.length>253)return e.createError(`format-email-error`,{value:n,pointer:t,schema:r});let s=a;if(/^".*"$/.test(a)&&(s=a.replace(/(^")|([. @]+)|("$)/g,``)),s[0]===`.`||s.endsWith(`.`)||s.includes(`..`)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(s))return e.createError(`format-email-error`,{value:n,pointer:t,schema:r});if(/^\[.*\]$/.test(o)){let e=o.substr(1,o.length-2);if(Gt.test(e)||Kt.test(e)||/IPv6:::[0-9a-f]{1,4}/.test(e))return}if(!/^[a-z0-9.-]+$/i.test(o)||!o.split(`.`).every(e=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(e)))return e.createError(`format-email-error`,{value:n,pointer:t,schema:r})},"json-pointer":({node:e,pointer:t,data:n})=>{let{schema:r}=e;if(typeof n==`string`&&n!==``&&!Xt.test(n))return e.createError(`format-json-pointer-error`,{value:n,pointer:t,schema:r})},"relative-json-pointer":({node:e,pointer:t,data:n})=>{let{schema:r}=e;if(typeof n==`string`&&!Zt.test(n))return e.createError(`format-json-pointer-error`,{value:n,pointer:t,schema:r})},regex:({node:e,pointer:t,data:n})=>{let{schema:r}=e;if(!(typeof n==`object`||typeof n==`number`||Array.isArray(n)||u(n)===`boolean`)){if(typeof n==`string`&&/\\Z$/.test(n)===!1){try{new RegExp(n,r.regexFlags??Wt);return}catch{}return e.createError(`format-regex-error`,{value:n,pointer:t,schema:r})}return e.createError(`format-regex-error`,{value:n,pointer:t,schema:r})}},time:({node:e,pointer:t,data:n})=>{let{schema:r}=e;if(typeof n!=`string`||n===``)return;let i=n.match(Jt);if(!i)return e.createError(`format-date-time-error`,{value:n,pointer:t,schema:r});if(i.groups?.second===`60`){if(/23:59:60(z|\+00:00)/i.test(n))return;let a=i.groups.time.match(/(\d+):(\d+):/),o=i.groups.offset.match(/(\d+):(\d+)/);if(a&&o){let e=parseInt(a[1]),t=parseInt(o[1]),n=parseInt(a[2]),r=parseInt(o[2]),s;s=/^-/.test(i.groups.offset)?(e+t)*60+(n+r):(24+e-t)*60+(n-r);let c=Math.floor(s/60),l=c%24,u=s-c*60;if(l===23&&u===59)return}return e.createError(`format-date-time-error`,{value:n,pointer:t,schema:r})}},url:({node:e,data:t,pointer:n})=>{let{schema:r}=e;if(!(t===``||a(`${t}`)))return e.createError(`format-url-error`,{value:t,pointer:n,schema:r})},uuid:({node:e,data:t,pointer:n})=>{let{schema:r}=e;if(typeof t==`string`&&t!==``&&!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t))return e.createError(`format-uuid-error`,{value:t,pointer:n,schema:r})}};function en(e,t){if(e.oneOf)return e.oneOf.map(e=>e.resolveRef());if(e.items?.oneOf)return e.items.oneOf.map(e=>e.resolveRef());if(e.prefixItems&&e.prefixItems.length>+t){let{node:n,error:r}=e.getNodeChild(t);return n?[n]:r}if(e.schema.additionalItems){if(e.schema.additionalItems===!0)return[e.compileSchema({type:`string`})];if(e.items)return[e.items.resolveRef()]}if(e.prefixItems&&e.prefixItems.length<=+t)return[];let{node:n,error:r}=e.getNodeChild(t);return n?[n]:r}const tn=[`string`,`number`,`integer`,`boolean`,`null`,`array`,`object`],nn=[`additionalProperties`,`dependencies`,`dependentSchemas`,`dependentRequired`,`maxProperties`,`minProperties`,`patternProperties`,`properties`,`propertyNames`,`required`,`unevaluatedProperties`],rn=[`contains`,`items`,`maxItems`,`minItems`,`unevaluatedItems`,`uniqueItems`];function J(e,t){let n=u(t),r=e.schema;if(r===!0)return n===`bigint`?`number`:tn.some(e=>e===n)?n:void 0;if(!d(r))return;let i=r.type;if(Array.isArray(i)){if(i.includes(n))return n;let e=u(r.default);return i.includes(e)?e:i[0]}if(i)return i;if(Array.isArray(r.enum)){let e=r.enum.map(e=>u(e)).filter((e,t,n)=>n.indexOf(e)===t);if(e.includes(n))return n;let t=u(r.default);return e.includes(t)?t:e[0]}let a=Object.keys(e.schema),o=a.filter(e=>nn.includes(e)),s=a.filter(e=>rn.includes(e));if(o.length>0&&o.length>s.length)return`object`;if(s.length>0&&s.length>o.length)return`array`;if(e.if)return J(e.if.resolveRef()??e.if,t);if(e.allOf)for(let n of e.allOf){let e=J(n.resolveRef()??n,t);if(e)return e}if(e.oneOf)for(let n of e.oneOf){let e=J(n.resolveRef()??n,t);if(e)return e}if(e.anyOf)for(let n of e.anyOf){let e=J(n.resolveRef()??n,t);if(e)return e}if(r.$ref){let n=e.resolveRef();if(n)return J(n,t)}}function an(e){switch(u(e)){case`string`:case`array`:return e?.length===0;case`null`:case`undefined`:return!0;case`object`:return Object.keys(e).length===0;default:return!1}}const Y=`oneOf`,{DECLARATOR_ONEOF:on}=c,sn={id:Y,keyword:Y,parse:ln,addReduce:e=>e[Y]!=null,reduce:dn,addValidate:e=>e[Y]!=null,validate:gn},cn={id:`oneOf-fuzzy`,keyword:`oneOf`,parse:ln,addReduce:e=>e.oneOf!=null,reduce:mn,addValidate:e=>e.oneOf!=null,validate:gn};function ln(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e;if(t[Y]!=null){if(!Array.isArray(t[Y]))return e.createError(`schema-error`,{pointer:r,schema:t,value:t[Y],message:`Keyword '${Y}' must be an array - received '${typeof t[Y]}'`});if(t[Y].length!==0)return e[Y]=t[Y].map((t,i)=>e.compileSchema(t,`${n}/${Y}/${i}`,`${r}/${Y}/${i}`)),B([],...e[Y])}}function un(e,t,n,r){return I(e.schema)?{node:{...e},error:void 0}:e.reduceNode(t,{pointer:n,path:r})}function dn({node:e,data:t,pointer:n,path:r}){if(e.oneOf==null)return;if(t!=null&&e.schema[on])return fn({node:e,data:t,pointer:n,path:r});let i=[],a=[];for(let o=0;o<e.oneOf.length;o+=1){let s=A(e.oneOf[o],t,n,r);s.length===0?i.push({index:o,node:e.oneOf[o]}):a.push(...s)}if(i.length===1){let{node:e,index:a}=i[0],{node:o,error:s}=un(e,t,n,r);if(o){let t=o.dynamicId?.replace(e.dynamicId,``)??``,n=t===``?`oneOf/${a}`:t;return o.oneOfIndex=a,o.dynamicId=pe(o.dynamicId,`+${e.schemaLocation}(${n})`),o}return s}return i.length,e.createError(`one-of-error`,{value:JSON.stringify(t),pointer:n,schema:e.schema,oneOf:e.schema.oneOf,errors:a})}function fn({node:e,data:t,pointer:n,path:r}){if(e.oneOf==null)return;let i=e.schema[on],a=N(t,i);if(t===void 0||a===void 0)return e.createError(`missing-one-of-property-error`,{oneOfProperty:i,pointer:n,schema:e.schema,value:t});let o=[];for(let c=0;c<e.oneOf.length;c+=1){let{node:l}=e.oneOf[c].getNodeChild(i,t);if(!P(l))return e.createError(`missing-one-of-declarator-error`,{declarator:on,oneOfProperty:i,schemaLocation:e.oneOf[c].schemaLocation,pointer:`${n}/oneOf/${c}`,schema:e.schema,value:t});let u=s(A(l,a,`${n}/${i}`,r));if(u.length>0)o.push(...u);else{let{node:i}=un(e.oneOf[c],t,n,r);if(i)return i.oneOfIndex=c,i}}return e.createError(`one-of-property-error`,{property:i,value:t,pointer:n,schema:e.schema,errors:o})}function pn(e,t,n,r){if(t==null||e.properties==null)return-1;let i=0,a=Object.keys(e.properties??{});for(let o of a)t[o]&&A(e.properties[o],t[o],n,r).length===0&&(i+=1);return i}function mn({node:e,data:t,pointer:n,path:r}){if(e.oneOf==null)return e;let i=dn({node:e,data:t,pointer:n,path:r});if(P(i))return i;if(d(t)){let i,a=-1,o=0;for(let s=0;s<e.oneOf.length;s+=1){let c=e.oneOf[s],l=pn(c,t,n,r);o<l&&(o=l,i=c,a=s)}if(i===void 0)return e.createError(`one-of-error`,{value:JSON.stringify(t),pointer:n,schema:e.schema,oneOf:e.schema.oneOf});let{node:s,error:c}=un(i,t,n,r);return s?(s.oneOfIndex=a,s):c}else if(Array.isArray(t)){let i,a=-1,o=1/0;for(let n=0;n<e.oneOf.length;n+=1){let r=e.oneOf[n],{errors:s}=r.validate(t),c=s.length;c<o&&(o=c,i=r,a=n)}if(i===void 0)return e.createError(`one-of-error`,{value:JSON.stringify(t),pointer:n,schema:e.schema,oneOf:e.schema.oneOf});let{node:s,error:c}=un(i,t,n,r);return s?(s.oneOfIndex=a,s):c}return i}function hn({node:e,data:t,pointer:n=`#`,path:r}){let{oneOf:i,schema:a}=e;if(!i)return;let o=a[on],s=N(t,o),c=[],l=[];for(let e of i){let{node:t,error:a}=e.getNodeChild(o,s);if(t){let a=A(t,s,`${n}/${o}`,r);a.length>0?l.push(...a):c.push({index:i.indexOf(e),node:e})}else console.log(`jlib oneOf error: failed getting schema for '${o}' to resolve ${on} in ${n}/oneOf/${i.indexOf(e)}`,a)}if(c.length===1){let e=c[0];return e.node.oneOfIndex=e.index,A(e.node,t,n,r)}return c.length>1?e.createError(`multiple-one-of-error`,{value:t,pointer:n,schema:a,matches:c}):e.createError(`one-of-error`,{value:JSON.stringify(t),pointer:n,schema:a,oneOf:a.oneOf,errors:l})}function gn({node:e,data:t,pointer:n=`#`,path:r}){let{oneOf:i,schema:a}=e;if(!i)return;if(a[on])return hn({node:e,data:t,pointer:n,path:r});let o=[],s=[];for(let e=0;e<i.length;e+=1){let a=A(i[e],t,n,r);a.length>0?s.push(...a):o.push({index:e,node:i[e]})}if(o.length===1){let{node:e,index:t}=o[0];e.oneOfIndex=t;return}return o.length>1?e.createError(`multiple-one-of-error`,{value:t,pointer:n,schema:a,matches:o}):e.createError(`one-of-error`,{value:JSON.stringify(t),pointer:n,schema:a,oneOf:a.oneOf,errors:s})}let _n=()=>!1;try{typeof File==`function`&&(_n=e=>e instanceof File)}catch{}function vn(e,t){if(e.$ref==null)return;t.cache=t.cache??{};let{cache:n,recursionLimit:r=1}=t,i=e.schemaLocation;if(n[i]=n[i]??{},n[i][e.$ref]=n[i][e.$ref]??0,n[i][e.$ref]>=r&&t.disableRecursionLimit!==!0)return!1;t.disableRecursionLimit=!1,n[i][e.$ref]+=1;let a=e.resolveRef();if(a&&a!==e)return a}function yn(e,t){return(t.cache?.[e.schemaLocation]?.[e.$ref]??-1)<(t.recursionLimit??1)}function bn(e,t){let n=u(t);if(e===void 0||t==null||n===e||n===`number`&&e===`integer`)return t;if(e===`string`)return JSON.stringify(t);if(n!==`string`)return t;try{let n=JSON.parse(t);if(u(n)===e)return n}catch{}return t}function xn(e,t,n){if(n?.cache==null)throw Error(`Missing options`);if(e.schema===!1||e.schema===!0||_n(t))return t;if(e.schema?.const!==void 0)return e.schema?.const;let r=e,i=t;if(Array.isArray(e.schema.enum)&&e.schema.enum.length>0&&t===void 0)return e.schema.default??e.schema.enum[0];if(e.schema.default!==void 0&&i===void 0&&(i=e.schema.default),r.allOf?.length&&r.allOf.forEach(e=>{i=e.getData(i,n)??i}),r.anyOf&&r.anyOf?.length>0&&(i=r.anyOf[0].getData(i,n)??i),r.oneOf&&r.oneOf?.length>0)if(an(i))r=O(r,r.oneOf[0]);else{let e=mn({node:r,data:i,path:[],pointer:`#`});if(L(e)){if(i!=null&&n.removeInvalidData!==!0)return i;r=r.oneOf[0],i=void 0}else r=O(r,e)}let a=vn(r,n);if(a===!1)return i;P(a)&&(i=a.getData(i,n)??i,r=a);let o=J(r,i),s=Sn[o]?.(r,i,n);return s===void 0?i:s}const Sn={null:(e,t,n)=>Cn(e,t,null,n.useTypeDefaults),string:(e,t,n)=>Cn(e,t,``,n.useTypeDefaults),number:(e,t,n)=>Cn(e,t,0,n.useTypeDefaults),integer:(e,t,n)=>Cn(e,t,0,n.useTypeDefaults),boolean:(e,t,n)=>Cn(e,t,!1,n.useTypeDefaults),object:(e,t,n)=>{let r=e.schema,i=r.default===void 0?{}:r.default,a={},o=n.extendDefaults===!1&&r.default!==void 0?[]:r.required??[],s=e.properties;s&&Object.keys(s).forEach(e=>{let r=s[e],c=o.includes(e),l=N(t,e),d=t===void 0||l===void 0?N(i,e):l;if(d!==void 0||c||n.addOptionalProps){let t=r.getData(d,n),i=u(t);if(n.removeInvalidData&&i!==`object`&&i!==`array`&&!r.validate(t).valid)return;(t!==void 0||n.useTypeDefaults!==!1)&&(a[e]=t)}});let c=e.dependentRequired;d(c)&&Object.keys(c).forEach(t=>{let r=c[t];N(a,t)!==void 0&&r.forEach(t=>{let{node:r}=e.getNodeChild(t,a);r&&(a[t]=r.getData(N(a,t),n))})});let l=e.dependentSchemas;if(l&&Object.keys(l).forEach(e=>{let r=l[e];if(a[e]!==void 0&&P(r)){let e=r.getData(t??a,n);Object.assign(a,e)}}),t)if(n.removeInvalidData===!0&&(r.additionalProperties===!1||d(r.additionalProperties))){let n=e.additionalProperties;P(n)&&Object.keys(t).forEach(e=>{if(a[e]==null){let r=N(t,e);n.validate(r).valid&&(a[e]=r)}})}else Object.keys(t).forEach(r=>{let i=u(r);if(n.removeInvalidData&&e.properties&&e.properties[r]&&i!==`object`&&i!==`array`){let i=e.properties[r],a=i.getData(N(t,r),n);if(!i.validate(a).valid)return}a[r]??(a[r]=N(t,r))});if(e.if){let{valid:t}=e.if.validate(a);if(t&&e.then){let t=e.then.getData(a,n);Object.assign(a,t)}else if(!t&&e.else){let t=e.else.getData(a,n);Object.assign(a,t)}}return{...i,...a}},array:(e,n,r)=>{let i=e.schema,a=i.default===void 0?[]:i.default,o=Array.isArray(n)?[...n]:a,s=r.extendDefaults===!1&&i.default!==void 0?0:i.minItems??0;if(i.items==null){if(e.items){let t=Math.max(s,o.length);for(let n=0;n<t;n+=1)o[n]=e.items.getData(o[n],r)}return o||[]}if(e.prefixItems){let t=Array.isArray(n)?n:[],i=Math.max(s??0,e.prefixItems.length);for(let n=0;n<i;n+=1){let i=e.prefixItems[n]??e.items;if(i&&yn(i,r)||t[n]!==void 0){let e=i.getData(o[n]==null?a[n]:o[n],r);e!==void 0&&(o[n]=e)}}return o||[]}if(e.items==null)return o;if(e.items&&yn(e.items,r)||Array.isArray(n)&&n?.length>0){let n={...r.cache};for(let i=0,c=Math.max(s,o.length);i<c;i+=1){r.cache=t(n);let s={...r,disableRecursionLimit:!0},c=e.items.getData(o[i]==null?a[i]:o[i],s);if(c===void 0)return o;o[i]=c}}return o}};function Cn({schema:e},t,n,r){return t===void 0?e.const?e.const:e.default===void 0&&Array.isArray(e.enum)?e.enum[0]:e.default===void 0&&r!==!1?n:e.default:bn(e.type,t)}const X=`items`,wn={id:X,keyword:X,parse:En,addResolve:e=>(e.prefixItems||e[X])!=null,resolve:Tn,addValidate:({schema:e})=>e.items!=null,validate:Dn};function Tn({node:e,key:t}){if(e.prefixItems?.[t])return e.prefixItems[t];if(e.items)return e.items}function En(e){let{schema:t,evaluationPath:n}=e,r=t[X];if(r!=null&&typeof r!=`boolean`){if(d(r)){e.items=e.compileSchema(r,`${n}/${X}`,`${e.schemaLocation}/${X}`);return}if(Array.isArray(r)){e.prefixItems=r.map((t,r)=>e.compileSchema(t,`${n}/${X}/${r}`,`${e.schemaLocation}/${X}/${r}`));return}return e.createError(`schema-error`,{pointer:n,schema:t,value:void 0,message:`Keyword '${X}' must be an object or array - received '${typeof r}'`})}}function Dn({node:e,data:t,pointer:n=`#`,path:r}){let{schema:i}=e;if(!Array.isArray(t)||t.length===0)return;if(i.items===!1)return Array.isArray(t)&&t.length===0?void 0:e.createError(`invalid-data-error`,{pointer:n,value:t,schema:i});let a=[];if(e.prefixItems){for(let i=0;i<Math.min(e.prefixItems.length,t.length);i+=1){let o=t[i],s=e.prefixItems[i],c=A(s,o,`${n}/${i}`,r);a.push(...c)}return a}if(e.items){for(let i=0;i<t.length;i+=1){let o=t[i],s=A(e.items,o,`${n}/${i}`,r);s&&a.push(...s)}return a}}const On=`maximum`,kn={id:On,keyword:On,parse:An,addValidate:e=>e.maximum!=null,validate:jn};function An(e){let t=e.schema[On];if(t!=null){if(!R(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${On}`,schema:e.schema,value:t,message:`Keyword '${On}' must be a number - received '${typeof t}'`});e[On]=t}}function jn({node:e,data:t,pointer:n}){if(!R(t))return;let r=e[On],{schema:i}=e;if(r&&r<t)return e.createError(`maximum-error`,{maximum:r,length:t,value:t,pointer:n,schema:i});if(r&&i.exclusiveMaximum===!0&&r===t)return e.createError(`maximum-error`,{maximum:r,length:t,pointer:n,schema:i,value:t})}const Mn=`maxItems`,Nn={id:Mn,keyword:Mn,parse:Pn,addValidate:({schema:e})=>!isNaN(e.maxItems),validate:Fn};function Pn(e){let t=e.schema[Mn];if(t!=null){if(!R(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Mn}`,schema:e.schema,value:t,message:`Keyword '${Mn}' must be a number - received '${typeof t}'`});e[Mn]=t}}function Fn({node:e,data:t,pointer:n}){let{schema:r}=e;if(Array.isArray(t)&&r.maxItems<t.length)return e.createError(`max-items-error`,{maximum:r.maxItems,length:t.length,schema:r,value:t,pointer:n})}function In(e){let t=[],n=0,r=e.length;for(;n<r;){let i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){let r=e.charCodeAt(n++);(r&64512)==56320?t.push(((i&1023)<<10)+(r&1023)+65536):(t.push(i),n--)}else t.push(i)}return t}const Ln=`maxLength`,Rn={id:Ln,keyword:Ln,parse:zn,addValidate:e=>e[Ln]!=null,validate:Bn};function zn(e){let t=e.schema[Ln];if(t!=null){if(!R(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Ln}`,schema:e.schema,value:t,message:`Keyword '${Ln}' must be a number - received '${typeof t}'`});e[Ln]=t}}function Bn({node:e,data:t,pointer:n=`#`}){if(typeof t!=`string`)return;let r=e[Ln],i=In(t).length;if(r<i)return e.createError(`max-length-error`,{maxLength:r,length:i,pointer:n,schema:e.schema,value:t})}const Vn=`maxProperties`,Hn={id:Vn,keyword:Vn,parse:Un,addValidate:e=>e[Vn]!=null,validate:Wn};function Un(e){let t=e.schema[Vn];if(t!=null){if(!R(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Vn}`,schema:e.schema,value:t,message:`Keyword '${Vn}' must be a number - received '${typeof t}'`});e[Vn]=t}}function Wn({node:e,data:t,pointer:n=`#`}){if(!d(t))return;let r=e[Vn],i=Object.keys(t).length;if(r<i)return e.createError(`max-properties-error`,{maxProperties:r,length:i,pointer:n,schema:e.schema,value:t})}const Gn=`minimum`,Kn={id:Gn,keyword:Gn,parse:qn,addValidate:e=>e[Gn]!=null,validate:Jn};function qn(e){let t=e.schema[Gn];if(t!=null){if(!R(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Gn}`,schema:e.schema,value:t,message:`Keyword '${Gn}' must be a number - received '${typeof t}'`});e[Gn]=t}}function Jn({node:e,data:t,pointer:n}){if(!R(t))return;let r=e[Gn];if(r>t||e.schema.exclusiveMinimum===!0&&e.schema.minimum===t)return e.createError(`minimum-error`,{minimum:r,length:t,pointer:n,schema:e.schema,value:t})}const Yn=`minItems`,Xn={id:Yn,keyword:Yn,parse:Zn,addValidate:e=>e[Yn]!=null,validate:Qn};function Zn(e){let t=e.schema[Yn];if(t!=null){if(!R(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Yn}`,schema:e.schema,value:t,message:`Keyword '${Yn}' must be a number - received '${typeof t}'`});e[Yn]=t}}function Qn({node:e,data:t,pointer:n}){if(!Array.isArray(t))return;let r=e[Yn];if(r>t.length)return e.createError(`min-items-error`,{minItems:r,length:t.length,pointer:n,schema:e.schema,value:t})}const $n=`minLength`,er={id:$n,keyword:$n,parse:tr,addValidate:e=>e[$n]!=null,validate:nr};function tr(e){let t=e.schema[$n];if(t!=null){if(!R(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${$n}`,schema:e.schema,value:t,message:`Keyword '${$n}' must be a number - received '${typeof t}'`});e[$n]=t}}function nr({node:e,data:t,pointer:n=`#`}){if(typeof t!=`string`)return;let r=In(t).length,i=e[$n];if(!(i<=r))return e.createError(`min-length-error`,{minLength:i,length:r,pointer:n,schema:e.schema,value:t})}const rr=`minProperties`,ir={id:rr,keyword:rr,parse:ar,addValidate:e=>e[rr]!=null,validate:or};function ar(e){let t=e.schema[rr];if(t!=null){if(!R(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${rr}`,schema:e.schema,value:t,message:`Keyword '${rr}' must be a number - received '${typeof t}'`});e[rr]=t}}function or({node:e,data:t,pointer:n=`#`}){if(!d(t))return;let r=Object.keys(t).length;if(e.schema.minProperties>r)return e.createError(`min-properties-error`,{minProperties:e.schema.minProperties,length:r,pointer:n,schema:e.schema,value:t})}function sr(e){let t=`${e}`;if(t.includes(`e-`))return parseInt(t.replace(/.*e-/,``));let n=t.indexOf(`.`);return n===-1?0:t.length-(n+1)}const cr=`multipleOf`,lr={id:cr,keyword:cr,parse:ur,addValidate:e=>e[cr]!=null,validate:dr};function ur(e){let t=e.schema[cr];if(t!=null){if(!R(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${cr}`,schema:e.schema,value:t,message:`Keyword '${cr}' must be a number - received '${typeof t}'`});e[cr]=t}}function dr({node:e,data:t,pointer:n}){if(typeof t!=`number`)return;let r=e[cr],i=sr(t),a=sr(r);if(i>a)return e.createError(`multiple-of-error`,{multipleOf:r,value:t,pointer:n,schema:e.schema});let o=10**a;if(Math.round(t*o)%Math.round(r*o)/o!==0)return e.createError(`multiple-of-error`,{multipleOf:r,value:t,pointer:n,schema:e.schema})}const fr={id:`not`,keyword:`not`,parse:pr,addValidate:e=>e.not!=null,validate:mr};function pr(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e,i=t.not;if(i!=null)return!F(i)&&!I(i)?e.createError(`schema-error`,{pointer:`${r}/not`,schema:t,value:i,message:`Keyword 'not' must be a valid JSON Schema - received '${typeof i}'`}):(e.not=e.compileSchema(t.not,`${n}/not`,`${r}/not`),e.not.schemaValidation)}function mr({node:e,data:t,pointer:n,path:r}){let{schema:i}=e;if(A(e.not,t,n,r).length===0)return e.createError(`not-error`,{value:t,not:i.not,pointer:n,schema:i})}const hr=`pattern`,{REGEX_FLAGS:gr}=c,_r={id:hr,keyword:hr,parse:vr,addValidate:e=>e[hr]!=null,validate:yr};function vr(e){let t=e.schema[hr];if(t!=null){if(typeof t!=`string`)return e.createError(`schema-error`,{pointer:e.schemaLocation,schema:e.schema,value:t,message:`Keyword 'pattern' must be a string - received '${typeof t}'`});try{e[hr]=new RegExp(t,e.schema.regexFlags??gr)}catch(n){return e.createError(`schema-error`,{pointer:e.schemaLocation,schema:e.schema,value:t,message:n.message})}}}function yr({node:e,data:t,pointer:n=`#`}){if(typeof t==`string`&&e.pattern.test(t)===!1){let{schema:r}=e;return e.createError(`pattern-error`,{pattern:r.pattern,description:r.patternExample||r.pattern,received:t,schema:r,value:t,pointer:n})}}const{REGEX_FLAGS:br}=c,xr={id:`patternProperties`,keyword:`patternProperties`,parse:Sr,addReduce:e=>e.patternProperties!=null,reduce:wr,addResolve:e=>e.patternProperties!=null,resolve:Cr,addValidate:e=>e.patternProperties!=null,validate:Tr};function Sr(e){let{schema:t}=e;if(!d(t.patternProperties))return;let n=Object.keys(t.patternProperties);if(n.length!==0)return e.patternProperties=n.map(n=>({name:n,pattern:new RegExp(n,t.regexFlags??br),node:e.compileSchema(t.patternProperties[n],`${e.evaluationPath}/patternProperties/${n}`,`${e.schemaLocation}/patternProperties/${n}`)})),B([],...e.patternProperties.map(({node:e})=>e))}function Cr({node:e,key:t}){return e.patternProperties?.find(({pattern:e})=>e.test(`${t}`))?.node}function wr({node:e,data:t,key:n}){let{patternProperties:r}=e;if(r==null)return;let i,a=Object.keys(t??{});n&&a.push(`${n}`);let o=`${e.schemaLocation}(`;return a.push(...Object.keys(e.schema.properties??{})),a.forEach((t,n,a)=>{if(a.indexOf(t)!==n)return;let s=e.schema.properties?.[t]??{},c=r.filter(e=>e.pattern.test(t));c.forEach(e=>s=x(s,e.node.schema)),c.length>0&&(i??={properties:{}},i.properties[t]=s,o+=`${c.map(({name:e})=>`patternProperties/${e}`).join(`,`)}`)}),i==null?e:(i=x(e.schema,i,`patternProperties`),e.compileSchema(i,e.evaluationPath,e.schemaLocation,`${o})`))}function Tr({node:e,data:t,pointer:n,path:r}){if(!d(t))return;let{schema:i,patternProperties:a}=e,o=i.properties||{},s=Object.keys(i.patternProperties).join(`,`),c=[];return Object.keys(t).forEach(l=>{let u=N(t,l),d=a.filter(e=>e.pattern.test(l));d.forEach(({node:e})=>c.push(...A(e,u,`${n}/${l}`,r))),!o[l]&&d.length===0&&i.additionalProperties===!1&&c.push(e.createError(`no-additional-properties-error`,{key:l,pointer:`${n}/${l}`,schema:i,value:u,patterns:s}))}),c}const Er={id:`property`,keyword:`properties`,parse:Or,addResolve:e=>e.properties!=null,resolve:Dr,addValidate:e=>e.properties!=null,validate:kr};function Dr({node:e,key:t}){return e.properties?.[t]}function Or(e){let{schema:t,evaluationPath:n,schemaLocation:r}=e;if(t.properties==null)return;if(t.properties&&!d(t.properties))return e.createError(`schema-error`,{pointer:r,schema:t,value:void 0,message:"keyword `properties` must be of type `object`"});let i=[],a={};return Object.keys(t.properties).forEach(o=>{let s=e.compileSchema(t.properties[o],`${n}/properties/${o}`,`${r}/properties/${o}`);a[o]=s,B(i,a[o])}),e.properties=a,i}function kr({node:e,data:t,pointer:n,path:r}){if(!d(t))return;let i=[],a=e.properties??{};return Object.keys(t).forEach(e=>{let o=N(t,e),s=a[e];if(s==null||o===void 0)return;let c=A(s,o,`${n}/${e}`,r);i.push(...c)}),i}const Ar=`propertyNames`,jr={id:Ar,keyword:Ar,parse:Mr,addValidate:e=>e.schema[Ar]!=null,validate:Nr};function Mr(e){let t=e.schema[Ar];if(t!=null){if(!(F(t)||I(t)))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Ar}`,schema:e.schema,value:t,message:`Keyword '${Ar}' must be a valid JSON Schema - received '${typeof t}'`});if(!I(t))return e.propertyNames=e.compileSchema(t,`${e.evaluationPath}/propertyNames`,`${e.schemaLocation}/propertyNames`),e.propertyNames.schemaValidation}}function Nr({node:e,data:t,pointer:n,path:r}){let{schema:i}=e;if(!d(t))return;if(i.propertyNames===!1)return Object.keys(t).length===0?void 0:e.createError(`invalid-property-name-error`,{property:Object.keys(t),pointer:n,value:t,schema:i});if(i[Ar]===!0)return;let a=e[Ar];if(!d(a))return;let o=[];return Object.keys(t).forEach(s=>{let c=A(a,s,`${n}/${s}`,r);c.length>0&&o.push(e.createError(`invalid-property-name-error`,{property:s,pointer:n,validationError:c[0],value:t[s],schema:i}))}),o}const Pr=`required`,Fr={id:Pr,keyword:Pr,parse:Ir,addValidate:e=>e.required!=null,validate:Lr};function Ir(e){let t=e.schema[Pr];if(t!=null){if(!mt(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Pr}`,schema:e.schema,value:t,message:`Keyword '${Pr}' must be a string[]`});e.required=t}}function Lr({node:e,data:t,pointer:n=`#`}){let{required:r}=e;if(d(t))return r.map(r=>{if(!M(t,r))return e.createError(`required-property-error`,{key:r,pointer:n,schema:e.schema,value:t})})}function Rr(e){return{...e,keywords:[...e.keywords.map(e=>({...e}))]}}function zr(e,t){let{keywords:n}=Br(e,...t.keywords??[]),r={...e.errors,...t.errors??{}},i={...e.formats,...t.formats??{}};return Hr({...e,...t,formats:i,keywords:n,errors:r})}function Br(e,...t){let n=Rr(e);return t.forEach(e=>Vr(n,e)),n}function Vr(e,t){let n=e.keywords.findIndex(e=>e.keyword===t.keyword);n===-1?e.keywords.push(t):e.keywords[n]=t}function Hr(e){return e.keywords?.forEach(e=>{let t=()=>e.keyword;e.validate&&(e.validate.toJSON=t,e.validate.order=e.order??0),e.reduce&&(e.reduce.toJSON=t,e.reduce.order=e.order??0),e.resolve&&(e.resolve.toJSON=t,e.resolve.order=e.order??0)}),e.keywords?.sort((e,t)=>(t.order??0)-(e.order??0)),e}function Ur(e,t,n=`#`,r=[]){let i=e.resolveRef()??e;return r.push({node:i,value:t,pointer:n}),d(t)?Object.keys(t).forEach(e=>{let{node:a}=i.getNodeChild(e,t);a&&Ur(a,N(t,e),`${n}/${e}`,r)}):Array.isArray(t)&&t.forEach((e,a)=>{let{node:o}=i.getNodeChild(a,t);o&&Ur(o,N(t,a),`${n}/${a}`,r)}),r}const Z=`type`,Wr=[`null`,`boolean`,`number`,`integer`,`string`,`object`,`array`],Gr={id:Z,keyword:Z,parse:Kr,addReduce:e=>Array.isArray(e.type),reduce:qr,addValidate:e=>e.type!=null,validate:Yr};function Kr(e){let t=e.schema[Z];if(t!=null){if(typeof t!=`string`&&!Array.isArray(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Z}`,schema:e.schema,value:t,message:`Keyword '${Z}' must be a string or a string[] - received ${typeof t}`});if(typeof t==`string`&&!Wr.includes(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Z}`,schema:e.schema,value:t,message:`Keyword '${Z}' is not a valid JSON Schema type - received '${t}'. Expected one of ${Wr.join(`, `)}`});if(Array.isArray(t)){let n=t.findIndex(e=>!Wr.includes(e));if(n!==-1)return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Z}/${n}`,schema:e.schema,value:t[n],message:`Keyword '${Z}' contains an invalid JSON Schema type: '${t[n]}'`})}e[Z]=t}}function qr({node:e,pointer:t,data:n}){let r=Jr(n,e.type);if(r!==`undefined`&&Array.isArray(e.schema.type)&&e.schema.type.includes(r))return e.compileSchema({...e.schema,pointer:t,type:r},e.evaluationPath)}function Jr(e,t){let n=u(e);return n===`number`&&(t===`integer`||Array.isArray(t)&&t.includes(`integer`))?Number.isInteger(e)||isNaN(e)?`integer`:`number`:n}function Yr({node:e,data:t,pointer:n}){let r=e[Z],i=Jr(t,r);if(!(t===void 0||r===i||Array.isArray(r)&&r.includes(i)))return e.createError(`type-error`,{value:t,received:i,expected:r,schema:e.schema,pointer:n})}const Xr=`uniqueItems`,Zr={id:Xr,keyword:Xr,parse:Qr,addValidate:({schema:e})=>e[Xr]===!0,validate:$r};function Qr(e){let t=e.schema[Xr];if(t!=null&&t!==!1){if(typeof t!=`boolean`)return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Xr}`,schema:e.schema,value:t,message:`Keyword '${Xr}' must be a boolean - received ${typeof t}`});e.uniqueItems=!0}}function $r({node:e,data:t,pointer:n}){if(!Array.isArray(t))return;let{schema:r}=e,i=[],a=[];return t.forEach((s,c)=>{for(let l=c+1;l<t.length;l+=1)o(s,t[l])&&!i.includes(l)&&(a.push(e.createError(`unique-items-error`,{pointer:`${n}/${l}`,duplicatePointer:`${n}/${c}`,arrayPointer:n,value:JSON.stringify(s),schema:r})),i.push(l))}),a}const ei=Hr({version:`draft-04`,$schemaRegEx:`draft-?0?4`,$schema:`http://json-schema.org/draft-04/schema#`,errors:Nt,formats:$t,methods:{createSchema:f,getData:xn,getChildSelection:en,toDataNodes:Ur},keywords:[He,rt,st,dt,Fe,St,Dt,At,Pt,Lt,Vt,wn,kn,Nn,Rn,Hn,Kn,Xn,er,ir,lr,fr,xr,_r,Er,jr,Fr,Gr,Zr,sn,Ye,$e]}),ti={id:`const`,keyword:`const`,addValidate:({schema:e})=>e.const!==void 0,validate:ni};function ni({node:e,data:t,pointer:n}){if(!o(t,e.schema.const))return[e.createError(`const-error`,{pointer:n,schema:e.schema,value:t,expected:e.schema.const})]}const ri=`exclusiveMaximum`,ii={id:ri,keyword:ri,parse:ai,addValidate:({schema:e})=>e.exclusiveMaximum!=null&&!isNaN(parseInt(e.exclusiveMaximum)),validate:oi};function ai(e){let t=e.schema[ri];if(t!=null&&typeof t!=`number`)return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${ri}`,schema:e.schema,value:t,message:`Keyword '${ri}' must be a number - received '${typeof t}'`})}function oi({node:e,data:t,pointer:n}){if(typeof t==`number`&&e.schema.exclusiveMaximum<=t)return e.createError(`exclusive-maximum-error`,{maximum:e.schema.exclusiveMaximum,length:t,pointer:n,schema:e.schema,value:t})}const si=`exclusiveMinimum`,ci={id:si,keyword:si,parse:li,addValidate:({schema:e})=>e[si]!=null&&!isNaN(parseInt(e[si])),validate:ui};function li(e){let t=e.schema[si];if(t!=null&&typeof t!=`number`)return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${si}`,schema:e.schema,value:t,message:`Keyword '${si}' must be a number - received '${typeof t}'`})}function ui({node:e,data:t,pointer:n}){if(typeof t==`number`&&e.schema.exclusiveMinimum>=t)return e.createError(`exclusive-minimum-error`,{minimum:e.schema.exclusiveMinimum,length:t,pointer:n,schema:e.schema,value:t})}const di=Hr({version:`draft-06`,$schemaRegEx:`draft-?0?6`,$schema:`http://json-schema.org/draft-06/schema#`,errors:Nt,formats:$t,methods:{createSchema:f,getData:xn,getChildSelection:en,toDataNodes:Ur},keywords:[Re,rt,st,ti,dt,Fe,St,Dt,At,ii,ci,Vt,wn,kn,Nn,Rn,Hn,Kn,Xn,er,ir,lr,fr,xr,_r,Er,jr,Fr,Gr,Zr,sn,Ye,$e]}),fi={id:`if-then-else`,keyword:`if`,parse:pi,addReduce:e=>e.if!=null&&(e.then!=null||e.else!=null),reduce:mi,addValidate:e=>e.if!=null,validate:hi};function pi(e){let{schema:t,evaluationPath:n}=e,r=[];return t.if!=null&&(F(t.if)||I(t.if)?(e.if=e.compileSchema(t.if,`${n}/if`),B(r,e.if)):r.push(e.createError(`schema-error`,{pointer:`${e.schemaLocation}/if`,schema:e.schema,value:t.if,message:`Keyword 'if' must be valid JSON Schema - received '${typeof t.if}'`}))),t.then!=null&&(F(t.then)||I(t.then)?(e.then=e.compileSchema(t.then,`${n}/then`),B(r,e.then)):r.push(e.createError(`schema-error`,{pointer:`${e.schemaLocation}/then`,schema:e.schema,value:t.then,message:`Keyword 'then' must be valid JSON Schema - received '${typeof t.then}'`}))),t.else!=null&&(F(t.else)||I(t.else)?(e.else=e.compileSchema(t.else,`${n}/else`),B(r,e.else)):r.push(e.createError(`schema-error`,{pointer:`${e.schemaLocation}/else`,schema:e.schema,value:t.else,message:`Keyword 'else' must be valid JSON Schema - received '${typeof t.else}'`}))),r}function mi({node:e,data:t,key:n,pointer:r,path:i}){if(t!==void 0&&e.if!=null){if(A(e.if,t,r,[...i??[]]).length===0){if(e.then){let{node:a}=e.then.reduceNode(t,{key:n,pointer:r,path:[...i]});if(a){let t=a.dynamicId?.replace(e.dynamicId,``).replace(/^#/,``)??``,n=t===``?`(then)`:t,r=I(e.then.schema)?e.then:a;return D(e.compileSchema(r.schema,e.then.evaluationPath,e.schemaLocation,`${e.schemaLocation}${n}`),r,`if`,`then`,`else`)}}}else if(e.else){let{node:a}=e.else.reduceNode(t,{key:n,pointer:r,path:[...i]});if(a){let t=a.dynamicId?.replace(e.dynamicId,``)??``,n=t===``?`(else)`:t,r=I(e.else.schema)?e.else:a;return D(e.compileSchema(r.schema,e.else.evaluationPath,e.schemaLocation,`${e.schemaLocation}${n}`),r,`if`,`then`,`else`)}}}}function hi({node:e,data:t,pointer:n,path:r}){if(e.if!=null){if(A(e.if,t,n,[...r??[]]).length===0){if(e.then)return A(e.then,t,n,r)}else if(e.else)return A(e.else,t,n,r)}}const gi=Hr({version:`draft-07`,$schemaRegEx:`draft-?0?7`,$schema:`http://json-schema.org/draft-07/schema#`,errors:Nt,formats:$t,methods:{createSchema:f,getData:xn,getChildSelection:en,toDataNodes:Ur},keywords:[Re,rt,st,ti,dt,Fe,St,Dt,At,ii,ci,Vt,fi,wn,kn,Nn,Rn,Hn,Kn,Xn,er,ir,lr,fr,xr,_r,Er,jr,Fr,Gr,Zr,sn,Ye,$e]}),_i={id:`$ref`,keyword:`$ref`,parse:yi,addValidate:({schema:e})=>e.$ref!=null||e.$recursiveRef!=null,validate:xi,addReduce:({schema:e})=>e.$ref!=null||e.$recursiveRef!=null,reduce:Oe};function vi(e,t){!e.dynamicId&&e.context.refs[t]==null&&(e.context.refs[t]=e)}function yi(e){e.resolveRef=e.schema.$ref!=null&&e.schema.$recursiveRef!=null?je:bi;let t=b(e.parent?.$id??e.$id,e.schema?.$id);e.$id=t,e.lastIdPointer=e.parent?.lastIdPointer??`#`,t!==e.parent?.$id&&e.evaluationPath!==`#`&&(e.lastIdPointer=e.evaluationPath),e.lastIdPointer!==`#`&&e.evaluationPath.startsWith(e.lastIdPointer)&&vi(e,b(t,`#${e.evaluationPath.replace(e.lastIdPointer,``)}`)),vi(e,b(e.context.rootNode.$id,e.evaluationPath)),e.schema.$anchor&&!e.dynamicId&&(e.context.anchors[`${t.replace(/#$/,``)}#${e.schema.$anchor}`]=e),e.schema.$ref!=null&&(e.$ref=b(t,e.schema.$ref),e.$ref.startsWith(`/`)&&(e.$ref=`#${e.$ref}`))}function bi({pointer:e,path:t}={}){if(this.schema.$recursiveRef){let n=Si(this,t??[]);return P(n)&&t?.push({pointer:e,node:n}),n}if(this.$ref==null)return this;let n=Ci(this);return P(n)&&t?.push({pointer:e,node:n}),n}function xi({node:e,data:t,pointer:n=`#`,path:r}){let i=e.resolveRef({pointer:n,path:r});return i==null?e.createError(`ref-error`,{ref:e.schema.$ref??e.schema.$recursiveRef,pointer:n,schema:e.schema,value:t}):A(i,t,n,r)}function Si(e,t){let n=Ci(e,b(e.$id,e.schema.$recursiveRef));if(!P(n)||n.schema.$recursiveAnchor!==!0)return n;let r=n,i=e.$id;for(let n=t.length-1;n>=0;n--){let a=t[n].node;if(a.$id===i)continue;i=a.$id;let o=a.context.refs[i??`#`];if(o?.schema.$recursiveAnchor!==!0)break;r=z(o,e)}return r}function Ci(e,t=e?.$ref){if(t==null)return e;if(e.context.refs[t])return z(e.context.refs[t],e);if(e.context.anchors[t])return z(e.context.anchors[t],e);let r=Ce(t);if(r.length===0)return e.createError(`ref-error`,{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0});if(r.length===1){let t=r[0];if(e.context.remotes[t])return z(e.context.remotes[t],e);if(t[0]===`#`){let r=t.match(/#[^#]*$/)?.pop(),i=e.context.rootNode.schema,a=n(i,r);if(F(a)||I(a))return z(e.context.rootNode.compileSchema(a,r,r),e)}return e.createError(`ref-error`,{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0})}if(r.length===2){let n=r[0];if(e.context.remotes[n]&&e!==e.context.remotes[n]){let t=e.context.remotes[n],i=Ci(t,b(t.$id,r[1]));if(P(i)||(i=Ci(t,r[1]),P(i)))return i}if(e.context.refs[n]){let a=e.context.refs[n],o=i(r[1]),s=a;for(let n of o)if(s=s[n===`definitions`?`$defs`:n],s==null)return e.createError(`ref-error`,{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0,host:r[0],local:r[1]});return s}}return e.createError(`ref-error`,{ref:t,pointer:e.evaluationPath,schema:e.schema,value:void 0})}const wi=`unevaluatedItems`,Ti={id:wi,keyword:wi,parse:Ei,addValidate:({schema:e})=>e[wi]!=null,validate:Di};function Ei(e){let{unevaluatedItems:t}=e.schema;if(t!=null&&typeof t!=`boolean`){if(!d(t))return e.createError(`schema-error`,{pointer:e.evaluationPath,schema:e.schema,value:void 0,message:`Keyword '${wi}' must be an object - received '${typeof t}'`});e.unevaluatedItems=e.compileSchema(e.schema.unevaluatedItems,`${e.evaluationPath}/${wi}`,`${e.schemaLocation}/${wi}`)}}function Di({node:e,data:t,pointer:n,path:r}){let{schema:i}=e;if(!Array.isArray(t)||t.length===0||i.unevaluatedItems==null||i.unevaluatedItems===!0)return;let{node:a}=e.reduceNode(t,{pointer:n,path:r});if(a??=e,a.schema.unevaluatedItems===!0||a.schema.additionalItems===!0)return;let o=e.if!=null&&A(e.if,t,n,r).length===0,s=[];for(let a=0;a<t.length;a+=1){let c=t[a],{node:l}=e.getNodeChild(a,t,{path:r});if(l&&A(l,c,`${n}/${a}`,r).length>0){let o=e.unevaluatedItems;if(o&&t.forEach(e=>{let t=A(o,e,`${n}/${a}`,r);if(t!=null){if(Array.isArray(t))return s.push(...t);s.push(t)}}),e.schema.unevaluatedItems===!1)return e.createError(`unevaluated-items-error`,{pointer:`${n}/${a}`,value:JSON.stringify(c),schema:i})}if(l===void 0&&!(o&&e.if.prefixItems&&e.if.prefixItems.length>a))if(e.unevaluatedItems){let t=A(e.unevaluatedItems,c,`${n}/${a}`,r);t.length>0&&s.push(...t)}else s.push(e.createError(`unevaluated-items-error`,{pointer:`${n}/${a}`,value:JSON.stringify(c),schema:i}))}return s}function Oi({node:e,data:t,key:n,pointer:r,path:i}){if(i=[...i,{pointer:r,node:e}],Array.isArray(e.schema.required)&&!e.schema.required.find(e=>M(t,e)))return!1;if(e.schema.unevaluatedProperties===!0||e.schema.additionalProperties===!0||e.properties?.[n]&&e.properties[n].validate(t[n],r,i).valid||e.patternProperties&&e.patternProperties.find(e=>e.pattern.test(n)))return!0;if(e.allOf){for(let a of e.allOf)if(Oi({node:a,data:t,key:n,pointer:r,path:i}))return!0}if(e.anyOf){for(let a of e.anyOf)if(Oi({node:a,data:t,key:n,pointer:r,path:i}))return!0}if(e.oneOf){for(let a of e.oneOf)if(Oi({node:a,data:t,key:n,pointer:r,path:i}))return!0}if(e.if){if(Oi({node:e.if,data:t,key:n,pointer:r,path:i}))return!0;let a=A(e.if,t,r,i).length===0;if(a&&e.then){if(Oi({node:e.then,data:t,key:n,pointer:r,path:i}))return!0}else if(!a&&e.else&&Oi({node:e.else,data:t,key:n,pointer:r,path:i}))return!0}let a=e.resolveRef({pointer:r,path:i});return!!(P(a)&&a!==e&&Oi({node:a,data:t,key:n,pointer:r,path:i}))}const ki=`unevaluatedProperties`,Ai={id:ki,keyword:ki,parse:ji,addValidate:({schema:e})=>e[ki]!=null,validate:Mi};function ji(e){let t=e.schema[ki];if(t!=null){if(!(F(t)||I(t)))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${ki}`,schema:e.schema,value:t,message:`Keyword '${ki}' must be a valid JSON Schema - received '${typeof t}'`});if(!I(t))return e.unevaluatedProperties=e.compileSchema(e.schema.unevaluatedProperties,`${e.evaluationPath}/${ki}`,`${e.schemaLocation}/${ki}`),e.unevaluatedProperties.schemaValidation}}function Mi({node:e,data:t,pointer:n,path:r}){if(!d(t))return;let i=Object.keys(t).filter(e=>t[e]!==void 0);if(i.length===0)return;let a=[];for(let o of i){if(e.properties?.[o]||Oi({node:e,data:t,key:o,pointer:n,path:r}))continue;let{node:i}=e.getNodeChild(o,t,{pointer:n,path:r});if(i===void 0)if(e.unevaluatedProperties){let i=A(e.unevaluatedProperties,t[o],`${n}/${o}`,r);a.push(...i)}else e.schema.unevaluatedProperties===!1&&a.push(e.createError(`unevaluated-property-error`,{pointer:`${n}/${o}`,value:JSON.stringify(t[o]),schema:e.schema}));if(i&&A(i,t[o],`${n}/${o}`,r).length>0)if(e.unevaluatedProperties){let i=A(e.unevaluatedProperties,t[o],`${n}/${o}`,r);a.push(...i)}else e.schema.unevaluatedProperties===!1&&a.push(e.createError(`unevaluated-property-error`,{pointer:`${n}/${o}`,value:JSON.stringify(t[o]),schema:e.schema}))}return a}const Ni=Hr({version:`draft-2019-09`,$schemaRegEx:`draft[/-]2019-?(09)?`,$schema:`https://json-schema.org/draft/2019-09/schema`,errors:Nt,formats:$t,methods:{createSchema:f,getData:xn,getChildSelection:en,toDataNodes:Ur},keywords:[_i,rt,st,ti,dt,Fe,St,ht,vt,Dt,At,ii,ci,Vt,fi,wn,kn,Nn,Rn,Hn,Kn,Xn,er,ir,lr,fr,xr,_r,Er,jr,Fr,Gr,Ti,Ai,Zr,sn,Ye,$e]});function Pi(e,t){if(e.items){let t=e.items.resolveRef();if(t?.oneOf)return t.oneOf.map(e=>e.resolveRef())}if(e.oneOf)return e.oneOf.map(e=>e.resolveRef());if(e.prefixItems&&e.prefixItems.length>+t){let{node:n,error:r}=e.getNodeChild(t);return P(n)?[n]:r}if(e.schema.items===!0)return[e.compileSchema({type:`string`})];if(e.schema.items===!1)return[];if(e.items)return[e.items.resolveRef()];if(e.prefixItems&&e.prefixItems.length<=+t)return[];let{node:n,error:r}=e.getNodeChild(t);return r??[n]}function Fi(e,t){if(e.$ref==null)return;t.cache=t.cache??{};let{cache:n,recursionLimit:r=1}=t,i=e.schemaLocation;if(n[i]=n[i]??{},n[i][e.$ref]=n[i][e.$ref]??0,n[i][e.$ref]>=r&&t.disableRecursionLimit!==!0)return!1;t.disableRecursionLimit=!1,n[i][e.$ref]+=1;let a=e.resolveRef();if(a&&a!==e)return a}function Ii(e,t){return(t.cache?.[e.schemaLocation]?.[e.$ref]??-1)<(t.recursionLimit??1)}function Li(e,t){let n=u(t);if(e===void 0||t==null||n===e||n===`number`&&e===`integer`)return t;if(e===`string`)return JSON.stringify(t);if(n!==`string`)return t;try{let n=JSON.parse(t);if(u(n)===e)return n}catch{}return t}function Ri(e,t,n){if(n?.cache==null)throw Error(`Missing options`);if(e.schema===!1||e.schema===!0||_n(t))return t;if(e.schema?.const!==void 0)return e.schema?.const;let r=e,i=t;if(Array.isArray(e.schema.enum)&&e.schema.enum.length>0&&t===void 0)return e.schema.default??e.schema.enum[0];if(e.schema.default!==void 0&&i===void 0&&(i=e.schema.default),r.allOf?.length&&r.allOf.forEach(e=>{i=e.getData(i,n)??i}),r.anyOf&&r.anyOf?.length>0&&(i=r.anyOf[0].getData(i,n)??i),r.oneOf&&r.oneOf?.length>0)if(an(i))r=O(r,r.oneOf[0]);else{let e=mn({node:r,data:i,path:[],pointer:`#`});if(L(e)){if(i!=null&&n.removeInvalidData!==!0)return i;r=r.oneOf[0],i=void 0}else r=O(r,e)}let a=Fi(r,n);if(a===!1)return i;P(a)&&(i=a.getData(i,n)??i,r=a);let o=J(r,i),s=zi[o]?.(r,i,n);return s===void 0?i:s}const zi={null:(e,t,n)=>Bi(e,t,null,n.useTypeDefaults),string:(e,t,n)=>Bi(e,t,``,n.useTypeDefaults),number:(e,t,n)=>Bi(e,t,0,n.useTypeDefaults),integer:(e,t,n)=>Bi(e,t,0,n.useTypeDefaults),boolean:(e,t,n)=>Bi(e,t,!1,n.useTypeDefaults),object:(e,t,n)=>{let r=e.schema,i=r.default===void 0?{}:r.default,a={},o=n.extendDefaults===!1&&r.default!==void 0?[]:r.required??[],s=e.properties;s&&Object.keys(s).forEach(e=>{let r=s[e],c=o.includes(e),l=N(t,e),d=t===void 0||l===void 0?N(i,e):l;if(d!==void 0||c||n.addOptionalProps){let t=r.getData(d,n),i=u(t);if(n.removeInvalidData&&i!==`object`&&i!==`array`&&!r.validate(t).valid)return;(t!==void 0||n.useTypeDefaults!==!1)&&(a[e]=t)}});let c=e.dependentRequired;d(c)&&Object.keys(c).forEach(t=>{let r=c[t];N(a,t)!==void 0&&r.forEach(t=>{let{node:r}=e.getNodeChild(t,a);r&&(a[t]=r.getData(N(a,t),n))})});let l=e.dependentSchemas;if(l&&Object.keys(l).forEach(e=>{let r=l[e];if(a[e]!==void 0&&P(r)){let e=r.getData(t??a,n);Object.assign(a,e)}}),t&&(n.removeInvalidData===!0&&(r.additionalProperties===!1||d(r.additionalProperties))?P(e.additionalProperties)&&Object.keys(t).forEach(n=>{if(a[n]==null){let r=N(t,n);e.additionalProperties?.validate(r).valid&&(a[n]=r)}}):Object.keys(t).forEach(r=>{let i=u(r);if(n.removeInvalidData&&e.properties&&e.properties[r]&&i!==`object`&&i!==`array`){let i=e.properties[r],a=i.getData(N(t,r),n);if(!i.validate(a).valid)return}a[r]??(a[r]=N(t,r))})),e.if){let{errors:t}=e.if.validate(a);if(t.length===0&&e.then){let t=e.then.getData(a,n);Object.assign(a,t)}else if(t.length>0&&e.else){let t=e.else.getData(a,n);Object.assign(a,t)}}return{...i,...a}},array:(e,n,r)=>{let i=e.schema,a=i.default===void 0?[]:i.default,o=Array.isArray(n)?[...n]:a,s=r.extendDefaults===!1&&i.default!==void 0?0:i.minItems??0;if(i.prefixItems==null){if(e.items&&(Ii(e.items,r)||o?.length>0)){let n={...r.cache},i=Math.max(s,o.length);for(let s=0;s<i;s+=1){r.cache=t(n);let i={...r,disableRecursionLimit:!0};o[s]=e.items.getData(o[s]==null?a[s]:o[s],i)}}return o||[]}if(e.prefixItems){let t=Array.isArray(n)?n:[],i=Math.max(s??0,e.prefixItems.length);for(let n=0;n<i;n+=1){let i=e.prefixItems[n]??e.items;if(i&&Ii(i,r)||t[n]!==void 0){let e=i.getData(o[n]==null?a[n]:o[n],r);e!==void 0&&(o[n]=e)}}return o||[]}if(e.items==null)return o;if(e.items&&Ii(e.items,r)||n?.length>0){let n={...r.cache};for(let i=0,c=Math.max(s,o.length);i<c;i+=1){r.cache=t(n);let s={...r,disableRecursionLimit:!0},c=e.items.getData(o[i]==null?a[i]:o[i],s);if(c===void 0)return o;o[i]=c}}return o}};function Bi({schema:e},t,n,r){return t===void 0?e.const?e.const:e.default===void 0&&Array.isArray(e.enum)?e.enum[0]:e.default===void 0&&r!==!1?n:e.default:Li(e.type,t)}const Q=`items`,Vi={id:Q,keyword:Q,parse:Ui,addResolve:e=>e[Q]!=null,resolve:Hi,addValidate:e=>e[Q]!=null,validate:Wi};function Hi({node:e,key:t}){if(!(e.prefixItems&&e.prefixItems?.length>+t))return e.items}function Ui(e){let t=e.schema[Q];if(t!=null){if(!(F(t)||I(t)))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Q}`,schema:e.schema,value:t,message:`Keyword '${Q}' must be a valid JSON Schema - received '${typeof t}'`});if(t!==!0)return e[Q]=e.compileSchema(t,`${e.evaluationPath}/${Q}`,`${e.schemaLocation}/${Q}`),e[Q].schemaValidation}}function Wi({node:e,data:t,pointer:n=`#`,path:r}){let{schema:i}=e;if(!Array.isArray(t)||t.length===0||Array.isArray(i.prefixItems)&&i.prefixItems.length>=t.length)return;if(i.items===!1)return Array.isArray(t)&&t.length===0?void 0:e.createError(`invalid-data-error`,{pointer:n,value:t,schema:i});let a=[];if(e.items){for(let o=i.prefixItems?.length??0;o<t.length;o+=1){let i=t[o],s=A(e.items,i,`${n}/${o}`,r);s&&a.push(...s)}return a}}const Gi=`prefixItems`,Ki={id:Gi,keyword:Gi,parse:Ji,addResolve:e=>e[Gi]!=null,resolve:qi,addValidate:e=>e[Gi]!=null,validate:Yi};function qi({node:e,key:t}){if(e.prefixItems&&e.prefixItems[t])return e.prefixItems[t]}function Ji(e){let{schema:t,evaluationPath:n}=e;if(Array.isArray(t.prefixItems))return e.prefixItems=t.prefixItems.map((t,r)=>e.compileSchema(t,`${n}/${Gi}/${r}`,`${e.schemaLocation}/${Gi}/${r}`)),B([],...e.prefixItems)}function Yi({node:e,data:t,pointer:n=`#`,path:r}){if(!Array.isArray(t)||t.length===0)return;let i=[],a=e[Gi];if(a){for(let e=0;e<Math.min(a.length,t.length);e+=1){let o=t[e],s=a[e],c=A(s,o,`${n}/${e}`,r);i.push(...c)}return i}}function Xi({node:e,data:t,key:n,pointer:r,path:i}){let a=N(t,n);if(e.schema.unevaluatedItems===!0||e.schema.items===!0||e.contains&&A(e.contains,a,`${r}/${n}`,i).length===0)return!0;if(e.allOf){for(let a of e.allOf)if(Xi({node:a,data:t,key:n,pointer:r,path:i}))return!0}if(e.anyOf){for(let a of e.anyOf)if(Xi({node:a,data:t,key:n,pointer:r,path:i}))return!0}if(e.oneOf){for(let a of e.oneOf)if(Xi({node:a,data:t,key:n,pointer:r,path:i}))return!0}if(e.if){if(Xi({node:e.if,data:t,key:n,pointer:r,path:i}))return!0;let a=A(e.if,t,r,i).length===0;if(a&&e.if.prefixItems&&e.if.prefixItems.length>n)return!0;if(a&&e.then){if(Xi({node:e.then,data:t,key:n,pointer:r,path:i}))return!0}else if(!a&&e.else&&Xi({node:e.else,data:t,key:n,pointer:r,path:i}))return!0}}const Zi=`unevaluatedItems`,Qi={id:Zi,keyword:Zi,parse:$i,addValidate:({schema:e})=>e.unevaluatedItems!=null,validate:ea};function $i(e){let t=e.schema[Zi];if(t!=null){if(!(F(t)||I(t)))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${Zi}`,schema:e.schema,value:t,message:`Keyword '${Zi}' must be a valid JSON Schema - received '${typeof t}'`});if(!I(t))return e.unevaluatedItems=e.compileSchema(e.schema.unevaluatedItems,`${e.evaluationPath}/${Zi}`,`${e.schemaLocation}/${Zi}`),e.unevaluatedItems.schemaValidation}}function ea({node:e,data:t,pointer:n,path:r}){let{schema:i}=e;if(!Array.isArray(t)||t.length===0||i.unevaluatedItems==null||i.unevaluatedItems===!0)return;let a=[];for(let o=0;o<t.length;o+=1){if(Xi({node:e,data:t,pointer:n,key:o,path:r}))continue;let s=t[o],{node:c}=e.getNodeChild(o,t,{path:r});if(c===void 0)if(e.unevaluatedItems){let t=A(e.unevaluatedItems,s,`${n}/${o}`,r);t.length>0&&a.push(...t)}else a.push(e.createError(`unevaluated-items-error`,{pointer:`${n}/${o}`,value:JSON.stringify(s),schema:i}));if(c&&A(c,s,`${n}/${o}`,r).length>0&&(e.unevaluatedItems&&e.unevaluatedItems.validate(s,`${n}/${o}`,r).valid===!1||e.schema.unevaluatedItems===!1))return e.createError(`unevaluated-items-error`,{pointer:`${n}/${o}`,value:JSON.stringify(s),schema:i})}return a}const ta=Hr({version:`draft-2020-12`,$schemaRegEx:`draft[/-]2020-?(12)?`,$schema:`https://json-schema.org/draft/2020-12/schema`,errors:Nt,formats:$t,methods:{createSchema:f,getData:Ri,getChildSelection:Pi,toDataNodes:Ur},keywords:[Te,$e,rt,st,ti,dt,Fe,St,ht,vt,Dt,At,ii,ci,Vt,fi,Vi,kn,Nn,Rn,Hn,Kn,Xn,er,ir,lr,fr,sn,_r,xr,Ki,Er,jr,Fr,Gr,Qi,Ai,Zr]}),{REGEX_FLAGS:na}=c,ra=[ei,di,gi,Ni,ta];function ia(e,t){return e.find(e=>new RegExp(e.$schemaRegEx,na).test(t))??e[e.length-1]}function aa(e,n={}){let r=n.remote;if(Array.isArray(n.remotes)&&n.remotes.length>0&&!n.remote){let e=[...n.remotes];e.forEach((e,t)=>{if(e.$id==null)throw Error(`required $id on remotes[${t}] is missing`)});let t=e.shift();r=aa(t,{baseUri:t.$id}),e.forEach(e=>r?.addRemoteSchema(e.$id,e))}let i=n.formatAssertion??!0,a=n.drafts??ra,o=ia(a,F(e)?n.draft??e.$schema:void 0),c={evaluationPath:`#`,lastIdPointer:`#`,schemaLocation:`#`,dynamicId:``,reducers:[],resolvers:[],validators:[],schema:e,...n.baseUri===void 0?{}:{$id:b(n.baseUri)},context:{remotes:{},dynamicAnchors:{},...r?.context??{},anchors:{},refs:{},...t(C(o,`methods`,`keywords`,`version`,`formats`,`errors`)),draft:n.draft,getDataDefaultOptions:n.getDataDefaultOptions,throwOnInvalidRef:n.throwOnInvalidRef??!1,drafts:a},...me};if(c.context.rootNode=c,c.context.remotes[c.$id??(F(e)?e.$id:void 0)??`#`]=c,r){let e=Pe(c,c.schema.$schema);if(P(e)&&e.schema.$vocabulary){let t=Object.keys(e.schema.$vocabulary).find(e=>e.includes(`vocab/format-assertion`));t&&i===`meta-schema`&&(i=e.schema.$vocabulary[t]===!0);let n=Object.keys(e.getData({},{addOptionalProps:!0}));n.length>0&&(c.context.keywords=c.context.keywords.filter(e=>n.includes(e.keyword)))}}if(i===!1&&(c.context.keywords=c.context.keywords.filter(e=>e.keyword!==`format`)),!F(e)&&!I(e))return c.schemaErrors=[c.createError(`schema-error`,{pointer:`#`,schema:e,value:void 0,message:`JSON schema must be object or boolean - reveived: '${e}'`})],c;let l=_e(c).filter(e=>e!=null);c.$id!=null&&(c.context.remotes[c.$id]=c),l=s(l);let u=[],d=[];if(l.forEach(e=>{L(e)?(e.data.schemaId=c.context.rootNode.$id??`#`,u.push(e)):be(e)&&(e.data.schemaId=c.context.rootNode.$id??`#`,d.push(e))}),Array.isArray(r?.schemaErrors)&&u.push(...r.schemaErrors),Array.isArray(r?.schemaAnnotations)&&d.push(...r.schemaAnnotations),n.throwOnInvalidSchema&&u.length>0){let e=Error(`Invalid schema passed to compileSchema`);throw e.data=u,e}return c.schemaErrors=u,c.schemaAnnotations=d,c}const oa=zr(ta,{$schemaRegEx:`.`,keywords:[cn],errors:{"min-length-error":e=>e.minLength===1?{type:`error`,code:`min-length-one-error`,message:`An input is required`,data:e}:{type:`error`,code:`min-length-error`,message:k("Value in `{{pointer}}` is `{{length}}`, but should be `{{minLength}}` at minimum",e),data:e}}}),$=`propertyDependencies`;function sa(e,t){let n=e[$];if(n==null)return;let r=Object.keys(n),i=[];for(let e of r)if(M(t,e)){let r=n[e],a=`${t[e]}`;M(r,a)&&i.push({property:e,value:a,node:r[a]})}return i}const ca={id:$,keyword:$,parse:la,addValidate:e=>e[$]!=null,validate:ua,addReduce:e=>e[$]!=null,reduce:da};function la(e){let t=e.schema[$];if(!d(t))return e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${$}`,schema:e.schema,value:t,message:`Keyword '${$}' must be an object - received '${typeof t}'`});let n=Object.create(null),r=[];return Object.keys(t).map(i=>{let a=t[i];if(!d(a)){r.push(e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${$}/${i}`,schema:e.schema,value:t,message:`Keyword '${$}[string]' must be an object - received '${typeof t}'`}));return}Object.keys(a).forEach(t=>{let o=a[t];if(!(F(o)||I(o))){r.push(e.createError(`schema-error`,{pointer:`${e.schemaLocation}/${$}/${i}/${t}`,schema:e.schema,value:o,message:`Keyword '${$}[string][string]' must be a valid JSON Schema - received '${typeof o}'`}));return}n[i]=n[i]??Object.create(null),n[i][t]=e.compileSchema(o,`${e.evaluationPath}/${$}/${i}/${t}`,`${e.schemaLocation}/${$}/${i}/${t}`),B(r,n[i][t])})}),e[$]=n,r}function ua({node:e,data:t,pointer:n=`#`,path:r}){if(!d(t))return;let i=sa(e,t);if(i==null||i.length===0)return;let a=[];for(let e of i){let i=A(e.node,t,n,r);a.push(i)}return s(a)}function da({node:e,data:t,key:n,pointer:r,path:i}){if(!d(t))return;let a=sa(e,t);if(a==null||a.length===0)return;let o={},s,c=``;for(let l of a){let{node:a}=l.node.reduceNode(t,{key:n,pointer:r,path:[...i]});if(a){let t=a.dynamicId?.replace(e.dynamicId,``)??``,n=t===``?`propertyDependencies/${l.property}/${l.value}`:t;c+=`${c===``?``:`,`}${n}`;let r=I(l.node.schema)?l.node:a;o=x(o,r.schema,`propertyDependencies`),s=O(s,r,`propertyDependencies`)}}return D(e.compileSchema(o,`${e.evaluationPath}/${c}`,e.schemaLocation,`${e.schemaLocation}(${c})`),s,`propertyDependencies`)}export{Br as addKeywords,aa as compileSchema,ei as draft04,di as draft06,gi as draft07,Ni as draft2019,ta as draft2020,oa as draftEditor,zr as extendDraft,J as getSchemaType,u as getTypeOf,ye as isAnnotation,I as isBooleanSchema,be as isJsonAnnotation,L as isJsonError,F as isJsonSchema,de as isReduceable,P as isSchemaNode,O as mergeNode,x as mergeSchema,cn as oneOfFuzzyKeyword,sn as oneOfKeyword,ca as propertyDependenciesKeyword,k as render,s as sanitizeErrors,c as settings};
2
2
  //# sourceMappingURL=index.mjs.map