@hyperjump/json-schema-core
Advanced tools
Comparing version 0.13.1 to 0.13.2
@@ -1132,2 +1132,3 @@ define(['exports'], function (exports) { 'use strict'; | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
const externalId = splitUrl$1(url)[0]; | ||
@@ -1138,3 +1139,7 @@ if (!externalId && !splitUrl$1(schema[idToken] || "")[0]) { | ||
const internalUrl = safeResolveUrl(externalId, schema[idToken] || ""); | ||
const id = splitUrl$1(internalUrl)[0]; | ||
const [id, fragment] = splitUrl$1(internalUrl); | ||
delete schema[idToken]; | ||
if (fragment && idToken === anchorToken) { | ||
schema[anchorToken] = anchorToken !== idToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`; | ||
} | ||
if (externalId) { | ||
@@ -1144,2 +1149,11 @@ schemaStoreAlias[externalId] = id; | ||
// recursiveAnchor | ||
const recursiveAnchors = {}; | ||
const recursiveAnchorToken = getConfig(schemaVersion, "recursiveAnchorToken"); | ||
if (schema[recursiveAnchorToken] === true) { | ||
recursiveAnchors["#"] = id; | ||
schema[anchorToken] = ""; | ||
delete schema[recursiveAnchorToken]; | ||
} | ||
// Vocabulary | ||
@@ -1159,3 +1173,2 @@ let vocabulary; | ||
const anchors = {}; | ||
const recursiveAnchors = {}; | ||
schemaStore[id] = { | ||
@@ -1174,20 +1187,13 @@ id: id, | ||
if (jsonTypeOf$2(subject, "object")) { | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
if (typeof subject[idToken] === "string") { | ||
const ref = subject[idToken]; | ||
const resolvedUrl = safeResolveUrl(id, ref); | ||
const [schemaId, fragment] = splitUrl$1(resolvedUrl); | ||
delete subject[idToken]; | ||
if (fragment && idToken === anchorToken) { | ||
subject[anchorToken] = anchorToken !== idToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`; | ||
} | ||
if (schemaId !== id) { | ||
add(subject, safeResolveUrl(id, schemaId), schemaVersion); | ||
return reference.cons(ref, subject); | ||
} | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? subject["$schema"] : schemaVersion; | ||
const embeddedIdToken = getConfig(embeddedSchemaVersion, "idToken"); | ||
const embeddedAnchorToken = getConfig(embeddedSchemaVersion, "anchorToken"); | ||
if (typeof subject[embeddedIdToken] === "string" && (embeddedIdToken !== embeddedAnchorToken || subject[embeddedIdToken][0] !== "#")) { | ||
const ref = safeResolveUrl(id, subject[embeddedIdToken]); | ||
subject[embeddedIdToken] = ref; | ||
add(subject, ref, schemaVersion); | ||
return reference.cons(subject[embeddedIdToken], subject); | ||
} | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
const dynamicAnchorToken = getConfig(schemaVersion, "dynamicAnchorToken"); | ||
@@ -1200,8 +1206,3 @@ if (typeof subject[dynamicAnchorToken] === "string") { | ||
const recursiveAnchorToken = getConfig(schemaVersion, "recursiveAnchorToken"); | ||
if (pointer === jsonPointer.nil && subject[recursiveAnchorToken] === true) { | ||
recursiveAnchors["#"] = id; | ||
delete subject[recursiveAnchorToken]; | ||
} | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
if (typeof subject[anchorToken] === "string") { | ||
@@ -1208,0 +1209,0 @@ const anchor = anchorToken !== idToken ? subject[anchorToken] : subject[anchorToken].slice(1); |
@@ -1,2 +0,2 @@ | ||
define(["exports"],(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};const v={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var b={jsonTypeOf:(e,t)=>v[t](e),splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const m=Symbol("$__value"),w=Symbol("$__href"),g=Symbol("$__isDynamic");var O=(e,t,r=!1)=>Object.freeze({[w]:e,[m]:t,[g]:r}),E=e=>e&&void 0!==e[w],$=e=>e[w],j=e=>e[m],A=e=>e[g];const{jsonTypeOf:P}=b,x=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),S=e=>E(e.value)?j(e.value):e.value,T=n((e,t)=>P(S(e),t)),I=(e,t)=>Object.freeze({...t,pointer:y.append(e,t.pointer),value:S(t)[e]}),V=n((e,t)=>S(t).map((r,n,o,i)=>e(I(n,t),n,o,i))),k=n((e,t)=>S(t).map((e,r,n,o)=>I(r,t)).filter((t,r,n,o)=>e(t,r,n,o))),z=n((e,t,r)=>S(r).reduce((t,n,o)=>e(t,I(o,r),o),t)),K=n((e,t)=>S(t).every((r,n,o,i)=>e(I(n,t),n,o,i))),L=n((e,t)=>S(t).some((r,n,o,i)=>e(I(n,t),n,o,i)));var _={cons:(e,t="")=>Object.freeze({...x,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:S,typeOf:T,step:I,entries:e=>Object.keys(S(e)).map(t=>[t,I(t,e)]),keys:e=>Object.keys(S(e)),map:V,filter:k,reduce:z,every:K,some:L,length:e=>S(e).length},C=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,q=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,U=/\\([\u000b\u0020-\u00ff])/g,W=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
define(["exports"],(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};const v={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var b={jsonTypeOf:(e,t)=>v[t](e),splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const m=Symbol("$__value"),w=Symbol("$__href"),g=Symbol("$__isDynamic");var O=(e,t,r=!1)=>Object.freeze({[w]:e,[m]:t,[g]:r}),E=e=>e&&void 0!==e[w],$=e=>e[w],j=e=>e[m],A=e=>e[g];const{jsonTypeOf:P}=b,x=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),S=e=>E(e.value)?j(e.value):e.value,T=n((e,t)=>P(S(e),t)),I=(e,t)=>Object.freeze({...t,pointer:y.append(e,t.pointer),value:S(t)[e]}),k=n((e,t)=>S(t).map((r,n,o,i)=>e(I(n,t),n,o,i))),V=n((e,t)=>S(t).map((e,r,n,o)=>I(r,t)).filter((t,r,n,o)=>e(t,r,n,o))),z=n((e,t,r)=>S(r).reduce((t,n,o)=>e(t,I(o,r),o),t)),K=n((e,t)=>S(t).every((r,n,o,i)=>e(I(n,t),n,o,i))),L=n((e,t)=>S(t).some((r,n,o,i)=>e(I(n,t),n,o,i)));var _={cons:(e,t="")=>Object.freeze({...x,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:S,typeOf:T,step:I,entries:e=>Object.keys(S(e)).map(t=>[t,I(t,e)]),keys:e=>Object.keys(S(e)),map:k,filter:V,reduce:z,every:K,some:L,length:e=>S(e).length},C=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,q=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,U=/\\([\u000b\u0020-\u00ff])/g,W=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function D(e){var t=String(e);if(R.test(t))return t;if(t.length>0&&!q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(W,"\\$1")+'"'}function F(e){this.parameters=Object.create(null),this.type=e}var M={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!B.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!R.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+D(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!B.test(n))throw new TypeError("invalid media type");var o=new F(n.toLowerCase());if(-1!==r){var i,a,s;for(C.lastIndex=r;a=C.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(U,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},N=async e=>Object.entries(await e),Z=n(async(e,t)=>(await t).map(e)),J=n(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),G=n(async(e,t,r={})=>J(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),H=n(async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).some(e=>e)}),Q=n(async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).every(e=>e)}),X=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Y={entries:N,map:Z,filter:G,reduce:J,some:H,every:Q,pipeline:X,all:e=>Promise.all(e),allValues:e=>X([N,J(async(e,[t,r])=>(e[t]=await r,e),{})],e)},ee=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(ne.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?te(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+re(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=re(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:te(e)}};function te(e){return e+("/"===e[e.length-1]?"":"/")}function re(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const ne=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var oe=fetch;const{jsonTypeOf:ie,splitUrl:ae}=b,se={},ce={},ue=(e,t)=>{const r=e in ce?ce[e]:e;if(r in se)return se[r][t]},le={},fe={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ae(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ue(n,"idToken"),i=ae(t)[0];if(!i&&!ae(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const a=me(i,e[o]||""),s=ae(a)[0];let c;i&&(fe[i]=s),ue(n,"vocabulary")&&ie(e,"object")&&"$vocabulary"in e?(ce[s]=n,c=e.$vocabulary,delete e.$vocabulary):c=s===n?{[n]:!0}:{};const u={},l={};le[s]={id:s,schemaVersion:n,schema:pe(e,s,n,y.nil,u,l),anchors:u,recursiveAnchors:l,vocabulary:c,validated:!1}},pe=(e,t,r,n,o,i)=>{if(ie(e,"object")){const a=ue(r,"idToken"),s=ue(r,"anchorToken");if("string"==typeof e[a]){const n=e[a],o=me(t,n),[i,c]=ae(o);if(delete e[a],c&&a===s&&(e[s]=s!==a?encodeURI(c):"#"+encodeURI(c)),i!==t)return de(e,me(t,i),r),O(n,e)}const c=ue(r,"dynamicAnchorToken");"string"==typeof e[c]&&(i["#"+e[c]]=t,e[s]=e[c],delete e[c]);const u=ue(r,"recursiveAnchorToken");if(n===y.nil&&!0===e[u]&&(i["#"]=t,delete e[u]),"string"==typeof e[s]){const t=s!==a?e[s]:e[s].slice(1);o[t]=n,delete e[s]}const l=ue(r,"jrefToken");if("string"==typeof e[l])return O(e[l],e);e=Object.entries(e).reduce((e,[a,s])=>(e[a]=pe(s,t,r,y.append(a,n),o,i),e),{});const f=ue(r,"jsrefToken");"string"==typeof e[f]&&(e[f]=O(e[f],e[f]));const d=ue(r,"dynamicJsrefToken");return"string"==typeof e[d]&&(e[d]=O(e[d],e[d],!0)),e}return Array.isArray(e)?e.map((e,a)=>pe(e,t,r,y.append(a,n),o,i)):e},he=e=>le[fe[e]]||le[e],ye=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchors:{}}),ve=async(e,t=ye,r=!1)=>{const n=r&&t.recursiveAnchors[e]?t.recursiveAnchors[e]:Oe(t),o=me(n,e),[i,a]=ae(o);if(!(e=>e in le||e in fe)(i)){const e=await oe(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=M.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),i)}const s=he(i),c=a&&"/"!==a[0]?ge(s,a):a,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:y.get(c,s.schema),recursiveAnchors:{...s.recursiveAnchors,...t.recursiveAnchors},validated:s.validated});return be(u)},be=e=>E(e.value)?ve($(e.value),e,A(e.value)):e,me=(e,t)=>{const r=ee(e,t),n=ae(e)[0];if(n&&"file"===we(r)&&"file"!==we(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},we=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ge=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Oe=e=>`${e.id}#${encodeURI(e.pointer)}`,Ee=e=>E(e.value)?j(e.value):e.value,$e=(e,t)=>{const r=he(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:y.append(e,t.pointer),schema:r.schema,value:Ee(t)[e],recursiveAnchors:t.recursiveAnchors,validated:r.validated});return be(n)},je=n((e,t)=>Y.pipeline([Ee,Y.map(async(r,n)=>e(await $e(n,t),n)),Y.all],t));var Ae={setConfig:(e,t,r)=>{se[e]||(se[e]={}),se[e][t]=r},getConfig:ue,add:de,get:ve,markValidated:e=>{le[e].validated=!0},uri:Oe,value:Ee,typeOf:(e,t)=>ie(Ee(e),t),has:(e,t)=>e in Ee(t),step:$e,keys:e=>Object.keys(Ee(e)),entries:e=>Y.pipeline([Ee,Object.keys,Y.map(async t=>[t,await $e(t,e)]),Y.all],e),map:je,length:e=>Ee(e).length};class Pe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=Pe;const Se="FLAG",Te="BASIC",Ie="DETAILED",Ve="VERBOSE";let ke=Ie,ze=!0;const Ke=(e,t)=>(n,o=Se)=>{if(![Se,Te,Ie,Ve].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",Le(o,i));return Fe(t,n,e),r.unsubscribe(a),i[0]},Le=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&_e(r[r.length-1],i);){const t=r.pop();let n=[];if(e===Te&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),Ce(i))break}(e===Ve||e!==Se&&!i.valid)&&r.push(i),t[0]=i}},_e=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||Ce(e)),Ce=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),qe={},Re=e=>qe[e],Ue=e=>e in qe,We={},Be={},De=async(e,t)=>{if(!Ue(e.schemaVersion+"#validate")){const t=await Ae.get(e.schemaVersion);(Ae.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in We)Object.entries(We[e]).forEach(([e,r])=>{((e,t)=>{qe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(ze&&!e.validated){if(Ae.markValidated(e.id),!(e.schemaVersion in Be)){const t=await Ae.get(e.schemaVersion),r={},n=await De(t,r);Be[t.id]=Ke(r,n)}const t=_.cons(e.schema,e.id),r=Be[e.schemaVersion](t,ke);if(!r.valid)throw new xe(r)}return await Re(e.schemaVersion+"#validate").compile(e,t),Ae.uri(e)},Fe=(e,t,r)=>{const[n]=r[e];return Re(n).interpret(e,t,r)};var Me={validate:async(e,t,r)=>{const n={},o=await De(e,n),i=(e,t=Se)=>Ke(n,o)(_.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{ke=e},setShouldMetaValidate:e=>{ze=e},FLAG:Se,BASIC:Te,DETAILED:Ie,VERBOSE:Ve,getKeyword:Re,hasKeyword:Ue,defineVocabulary:(e,t)=>{We[e]=t},compileSchema:De,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Re(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Re(o).collectEvaluatedItems(e,t,r,n)}};var Ne={compile:async(e,t)=>{const r=Ae.uri(e);if(!(r in t)){t[r]=!1;const n=Ae.value(e);t[r]=[e.schemaVersion+"#validate",Ae.uri(e),"boolean"==typeof n?n:await Y.pipeline([Ae.entries,Y.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Y.filter(([t])=>Me.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Y.map(async([r,n])=>{const o=await Me.getKeyword(r).compile(n,t,e);return[r,Ae.uri(n),o]}),Y.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Me.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:_.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:_.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Me.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Me.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ze={Core:Me,Schema:Ae,Instance:_,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Ne}},Je=Ze.Core,Ge=Ze.Schema,He=Ze.Instance,Qe=Ze.Keywords;e.Core=Je,e.Instance=He,e.Keywords=Qe,e.Schema=Ge,e.default=Ze,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
*/function D(e){var t=String(e);if(R.test(t))return t;if(t.length>0&&!q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(W,"\\$1")+'"'}function F(e){this.parameters=Object.create(null),this.type=e}var M={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!B.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!R.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+D(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!B.test(n))throw new TypeError("invalid media type");var o=new F(n.toLowerCase());if(-1!==r){var i,a,s;for(C.lastIndex=r;a=C.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(U,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},N=async e=>Object.entries(await e),Z=n(async(e,t)=>(await t).map(e)),J=n(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),G=n(async(e,t,r={})=>J(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),H=n(async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).some(e=>e)}),Q=n(async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).every(e=>e)}),X=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Y={entries:N,map:Z,filter:G,reduce:J,some:H,every:Q,pipeline:X,all:e=>Promise.all(e),allValues:e=>X([N,J(async(e,[t,r])=>(e[t]=await r,e),{})],e)},ee=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(ne.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?te(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+re(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=re(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:te(e)}};function te(e){return e+("/"===e[e.length-1]?"":"/")}function re(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const ne=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var oe=fetch;const{jsonTypeOf:ie,splitUrl:ae}=b,se={},ce={},ue=(e,t)=>{const r=e in ce?ce[e]:e;if(r in se)return se[r][t]},le={},fe={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ae(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ue(n,"idToken"),i=ue(n,"anchorToken"),a=ae(t)[0];if(!a&&!ae(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=me(a,e[o]||""),[c,u]=ae(s);delete e[o],u&&o===i&&(e[i]=i!==o?encodeURI(u):"#"+encodeURI(u)),a&&(fe[a]=c);const l={},f=ue(n,"recursiveAnchorToken");let d;!0===e[f]&&(l["#"]=c,e[i]="",delete e[f]),ue(n,"vocabulary")&&ie(e,"object")&&"$vocabulary"in e?(ce[c]=n,d=e.$vocabulary,delete e.$vocabulary):d=c===n?{[n]:!0}:{};const p={};le[c]={id:c,schemaVersion:n,schema:pe(e,c,n,y.nil,p,l),anchors:p,recursiveAnchors:l,vocabulary:d,validated:!1}},pe=(e,t,r,n,o,i)=>{if(ie(e,"object")){const a="string"==typeof e.$schema?e.$schema:r,s=ue(a,"idToken"),c=ue(a,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=me(t,e[s]);return e[s]=n,de(e,n,r),O(e[s],e)}const u=ue(r,"anchorToken"),l=ue(r,"dynamicAnchorToken");"string"==typeof e[l]&&(i["#"+e[l]]=t,e[u]=e[l],delete e[l]);const f=ue(r,"idToken");if("string"==typeof e[u]){const t=u!==f?e[u]:e[u].slice(1);o[t]=n,delete e[u]}const d=ue(r,"jrefToken");if("string"==typeof e[d])return O(e[d],e);e=Object.entries(e).reduce((e,[a,s])=>(e[a]=pe(s,t,r,y.append(a,n),o,i),e),{});const p=ue(r,"jsrefToken");"string"==typeof e[p]&&(e[p]=O(e[p],e[p]));const h=ue(r,"dynamicJsrefToken");return"string"==typeof e[h]&&(e[h]=O(e[h],e[h],!0)),e}return Array.isArray(e)?e.map((e,a)=>pe(e,t,r,y.append(a,n),o,i)):e},he=e=>le[fe[e]]||le[e],ye=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchors:{}}),ve=async(e,t=ye,r=!1)=>{const n=r&&t.recursiveAnchors[e]?t.recursiveAnchors[e]:Oe(t),o=me(n,e),[i,a]=ae(o);if(!(e=>e in le||e in fe)(i)){const e=await oe(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=M.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),i)}const s=he(i),c=a&&"/"!==a[0]?ge(s,a):a,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:y.get(c,s.schema),recursiveAnchors:{...s.recursiveAnchors,...t.recursiveAnchors},validated:s.validated});return be(u)},be=e=>E(e.value)?ve($(e.value),e,A(e.value)):e,me=(e,t)=>{const r=ee(e,t),n=ae(e)[0];if(n&&"file"===we(r)&&"file"!==we(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},we=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ge=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Oe=e=>`${e.id}#${encodeURI(e.pointer)}`,Ee=e=>E(e.value)?j(e.value):e.value,$e=(e,t)=>{const r=he(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:y.append(e,t.pointer),schema:r.schema,value:Ee(t)[e],recursiveAnchors:t.recursiveAnchors,validated:r.validated});return be(n)},je=n((e,t)=>Y.pipeline([Ee,Y.map(async(r,n)=>e(await $e(n,t),n)),Y.all],t));var Ae={setConfig:(e,t,r)=>{se[e]||(se[e]={}),se[e][t]=r},getConfig:ue,add:de,get:ve,markValidated:e=>{le[e].validated=!0},uri:Oe,value:Ee,typeOf:(e,t)=>ie(Ee(e),t),has:(e,t)=>e in Ee(t),step:$e,keys:e=>Object.keys(Ee(e)),entries:e=>Y.pipeline([Ee,Object.keys,Y.map(async t=>[t,await $e(t,e)]),Y.all],e),map:je,length:e=>Ee(e).length};class Pe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=Pe;const Se="FLAG",Te="BASIC",Ie="DETAILED",ke="VERBOSE";let Ve=Ie,ze=!0;const Ke=(e,t)=>(n,o=Se)=>{if(![Se,Te,Ie,ke].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",Le(o,i));return Fe(t,n,e),r.unsubscribe(a),i[0]},Le=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&_e(r[r.length-1],i);){const t=r.pop();let n=[];if(e===Te&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),Ce(i))break}(e===ke||e!==Se&&!i.valid)&&r.push(i),t[0]=i}},_e=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||Ce(e)),Ce=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),qe={},Re=e=>qe[e],Ue=e=>e in qe,We={},Be={},De=async(e,t)=>{if(!Ue(e.schemaVersion+"#validate")){const t=await Ae.get(e.schemaVersion);(Ae.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in We)Object.entries(We[e]).forEach(([e,r])=>{((e,t)=>{qe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(ze&&!e.validated){if(Ae.markValidated(e.id),!(e.schemaVersion in Be)){const t=await Ae.get(e.schemaVersion),r={},n=await De(t,r);Be[t.id]=Ke(r,n)}const t=_.cons(e.schema,e.id),r=Be[e.schemaVersion](t,Ve);if(!r.valid)throw new xe(r)}return await Re(e.schemaVersion+"#validate").compile(e,t),Ae.uri(e)},Fe=(e,t,r)=>{const[n]=r[e];return Re(n).interpret(e,t,r)};var Me={validate:async(e,t,r)=>{const n={},o=await De(e,n),i=(e,t=Se)=>Ke(n,o)(_.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{Ve=e},setShouldMetaValidate:e=>{ze=e},FLAG:Se,BASIC:Te,DETAILED:Ie,VERBOSE:ke,getKeyword:Re,hasKeyword:Ue,defineVocabulary:(e,t)=>{We[e]=t},compileSchema:De,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Re(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Re(o).collectEvaluatedItems(e,t,r,n)}};var Ne={compile:async(e,t)=>{const r=Ae.uri(e);if(!(r in t)){t[r]=!1;const n=Ae.value(e);t[r]=[e.schemaVersion+"#validate",Ae.uri(e),"boolean"==typeof n?n:await Y.pipeline([Ae.entries,Y.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Y.filter(([t])=>Me.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Y.map(async([r,n])=>{const o=await Me.getKeyword(r).compile(n,t,e);return[r,Ae.uri(n),o]}),Y.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Me.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:_.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:_.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Me.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Me.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ze={Core:Me,Schema:Ae,Instance:_,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Ne}},Je=Ze.Core,Ge=Ze.Schema,He=Ze.Instance,Qe=Ze.Keywords;e.Core=Je,e.Instance=He,e.Keywords=Qe,e.Schema=Ge,e.default=Ze,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-amd.min.js.map |
@@ -1134,2 +1134,3 @@ 'use strict'; | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
const externalId = splitUrl$1(url)[0]; | ||
@@ -1140,3 +1141,7 @@ if (!externalId && !splitUrl$1(schema[idToken] || "")[0]) { | ||
const internalUrl = safeResolveUrl(externalId, schema[idToken] || ""); | ||
const id = splitUrl$1(internalUrl)[0]; | ||
const [id, fragment] = splitUrl$1(internalUrl); | ||
delete schema[idToken]; | ||
if (fragment && idToken === anchorToken) { | ||
schema[anchorToken] = anchorToken !== idToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`; | ||
} | ||
if (externalId) { | ||
@@ -1146,2 +1151,11 @@ schemaStoreAlias[externalId] = id; | ||
// recursiveAnchor | ||
const recursiveAnchors = {}; | ||
const recursiveAnchorToken = getConfig(schemaVersion, "recursiveAnchorToken"); | ||
if (schema[recursiveAnchorToken] === true) { | ||
recursiveAnchors["#"] = id; | ||
schema[anchorToken] = ""; | ||
delete schema[recursiveAnchorToken]; | ||
} | ||
// Vocabulary | ||
@@ -1161,3 +1175,2 @@ let vocabulary; | ||
const anchors = {}; | ||
const recursiveAnchors = {}; | ||
schemaStore[id] = { | ||
@@ -1176,20 +1189,13 @@ id: id, | ||
if (jsonTypeOf$2(subject, "object")) { | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
if (typeof subject[idToken] === "string") { | ||
const ref = subject[idToken]; | ||
const resolvedUrl = safeResolveUrl(id, ref); | ||
const [schemaId, fragment] = splitUrl$1(resolvedUrl); | ||
delete subject[idToken]; | ||
if (fragment && idToken === anchorToken) { | ||
subject[anchorToken] = anchorToken !== idToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`; | ||
} | ||
if (schemaId !== id) { | ||
add(subject, safeResolveUrl(id, schemaId), schemaVersion); | ||
return reference.cons(ref, subject); | ||
} | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? subject["$schema"] : schemaVersion; | ||
const embeddedIdToken = getConfig(embeddedSchemaVersion, "idToken"); | ||
const embeddedAnchorToken = getConfig(embeddedSchemaVersion, "anchorToken"); | ||
if (typeof subject[embeddedIdToken] === "string" && (embeddedIdToken !== embeddedAnchorToken || subject[embeddedIdToken][0] !== "#")) { | ||
const ref = safeResolveUrl(id, subject[embeddedIdToken]); | ||
subject[embeddedIdToken] = ref; | ||
add(subject, ref, schemaVersion); | ||
return reference.cons(subject[embeddedIdToken], subject); | ||
} | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
const dynamicAnchorToken = getConfig(schemaVersion, "dynamicAnchorToken"); | ||
@@ -1202,8 +1208,3 @@ if (typeof subject[dynamicAnchorToken] === "string") { | ||
const recursiveAnchorToken = getConfig(schemaVersion, "recursiveAnchorToken"); | ||
if (pointer === jsonPointer.nil && subject[recursiveAnchorToken] === true) { | ||
recursiveAnchors["#"] = id; | ||
delete subject[recursiveAnchorToken]; | ||
} | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
if (typeof subject[anchorToken] === "string") { | ||
@@ -1210,0 +1211,0 @@ const anchor = anchorToken !== idToken ? subject[anchorToken] : subject[anchorToken].slice(1); |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var t=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(t,r){!function(e,n){var o={};e.PubSub=o;var i=e.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==t&&t.exports&&(r=t.exports=o),r.PubSub=o,t.exports=r=o)}("object"==typeof window&&window||e)})),r=(t.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const n=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(l)},o=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const i=e.shift();return{...t,[i]:o(e,d(t,i,n),r,c(i,n))}}if(Array.isArray(t)){const n=[...t];return n[f(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:d(t,e[0],n)},i=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||p(t)){const o=e.shift();i(e,d(t,o,n),r,c(o,n))}else{t[f(t,e[0])]=r}},a=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=d(t,n,r);return{...t,[n]:a(e,o,c(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return d(t,e[0],r)}},s=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=d(t,n,r);s(e,o,c(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:d(t,e[0],r)},c=r((e,t)=>t+"/"+u(e)),u=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),l=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),f=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,d=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(p(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[f(e,t)]},p=e=>null===e||"object"!=typeof e;var h={nil:"",append:c,get:(e,t)=>{const r=n(e),o=e=>r.reduce(([e,t],r)=>[d(e,r,t),c(r,t)],[e,""])[0];return void 0===t?o:o(t)},set:(e,t,i)=>{const a=n(e),s=r((e,t)=>o(a,e,t,""));return void 0===t?s:s(t,i)},assign:(e,t,o)=>{const a=n(e),s=r((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,o)},unset:(e,t)=>{const r=n(e),o=e=>a(r,e,"");return void 0===t?o:o(t)},delete:(e,t)=>{const r=n(e),o=e=>s(r,e,"");return void 0===t?o:o(t)}};const y={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var v={jsonTypeOf:(e,t)=>y[t](e),splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const b=Symbol("$__value"),m=Symbol("$__href"),w=Symbol("$__isDynamic");var g=(e,t,r=!1)=>Object.freeze({[m]:e,[b]:t,[w]:r}),O=e=>e&&void 0!==e[m],E=e=>e[m],$=e=>e[b],j=e=>e[w];const{jsonTypeOf:x}=v,A=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),P=e=>O(e.value)?$(e.value):e.value,S=r((e,t)=>x(P(e),t)),T=(e,t)=>Object.freeze({...t,pointer:h.append(e,t.pointer),value:P(t)[e]}),I=r((e,t)=>P(t).map((r,n,o,i)=>e(T(n,t),n,o,i))),V=r((e,t)=>P(t).map((e,r,n,o)=>T(r,t)).filter((t,r,n,o)=>e(t,r,n,o))),k=r((e,t,r)=>P(r).reduce((t,n,o)=>e(t,T(o,r),o),t)),z=r((e,t)=>P(t).every((r,n,o,i)=>e(T(n,t),n,o,i))),K=r((e,t)=>P(t).some((r,n,o,i)=>e(T(n,t),n,o,i)));var L={cons:(e,t="")=>Object.freeze({...A,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:P,typeOf:S,step:T,entries:e=>Object.keys(P(e)).map(t=>[t,T(t,e)]),keys:e=>Object.keys(P(e)),map:I,filter:V,reduce:k,every:z,some:K,length:e=>P(e).length},_=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,C=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,q=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,R=/\\([\u000b\u0020-\u00ff])/g,U=/([\\"])/g,W=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var t=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(t,r){!function(e,n){var o={};e.PubSub=o;var i=e.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==t&&t.exports&&(r=t.exports=o),r.PubSub=o,t.exports=r=o)}("object"==typeof window&&window||e)})),r=(t.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const n=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(l)},o=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const i=e.shift();return{...t,[i]:o(e,d(t,i,n),r,c(i,n))}}if(Array.isArray(t)){const n=[...t];return n[f(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:d(t,e[0],n)},i=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||p(t)){const o=e.shift();i(e,d(t,o,n),r,c(o,n))}else{t[f(t,e[0])]=r}},a=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=d(t,n,r);return{...t,[n]:a(e,o,c(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return d(t,e[0],r)}},s=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=d(t,n,r);s(e,o,c(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:d(t,e[0],r)},c=r((e,t)=>t+"/"+u(e)),u=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),l=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),f=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,d=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(p(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[f(e,t)]},p=e=>null===e||"object"!=typeof e;var h={nil:"",append:c,get:(e,t)=>{const r=n(e),o=e=>r.reduce(([e,t],r)=>[d(e,r,t),c(r,t)],[e,""])[0];return void 0===t?o:o(t)},set:(e,t,i)=>{const a=n(e),s=r((e,t)=>o(a,e,t,""));return void 0===t?s:s(t,i)},assign:(e,t,o)=>{const a=n(e),s=r((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,o)},unset:(e,t)=>{const r=n(e),o=e=>a(r,e,"");return void 0===t?o:o(t)},delete:(e,t)=>{const r=n(e),o=e=>s(r,e,"");return void 0===t?o:o(t)}};const y={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var v={jsonTypeOf:(e,t)=>y[t](e),splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const b=Symbol("$__value"),m=Symbol("$__href"),w=Symbol("$__isDynamic");var g=(e,t,r=!1)=>Object.freeze({[m]:e,[b]:t,[w]:r}),O=e=>e&&void 0!==e[m],E=e=>e[m],$=e=>e[b],j=e=>e[w];const{jsonTypeOf:x}=v,A=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),P=e=>O(e.value)?$(e.value):e.value,S=r((e,t)=>x(P(e),t)),T=(e,t)=>Object.freeze({...t,pointer:h.append(e,t.pointer),value:P(t)[e]}),I=r((e,t)=>P(t).map((r,n,o,i)=>e(T(n,t),n,o,i))),k=r((e,t)=>P(t).map((e,r,n,o)=>T(r,t)).filter((t,r,n,o)=>e(t,r,n,o))),V=r((e,t,r)=>P(r).reduce((t,n,o)=>e(t,T(o,r),o),t)),z=r((e,t)=>P(t).every((r,n,o,i)=>e(T(n,t),n,o,i))),K=r((e,t)=>P(t).some((r,n,o,i)=>e(T(n,t),n,o,i)));var L={cons:(e,t="")=>Object.freeze({...A,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:P,typeOf:S,step:T,entries:e=>Object.keys(P(e)).map(t=>[t,T(t,e)]),keys:e=>Object.keys(P(e)),map:I,filter:k,reduce:V,every:z,some:K,length:e=>P(e).length},_=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,C=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,q=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,R=/\\([\u000b\u0020-\u00ff])/g,U=/([\\"])/g,W=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function B(e){var t=String(e);if(q.test(t))return t;if(t.length>0&&!C.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(U,"\\$1")+'"'}function D(e){this.parameters=Object.create(null),this.type=e}var F={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!W.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!q.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+B(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!W.test(n))throw new TypeError("invalid media type");var o=new D(n.toLowerCase());if(-1!==r){var i,a,s;for(_.lastIndex=r;a=_.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(R,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},M=async e=>Object.entries(await e),N=r(async(e,t)=>(await t).map(e)),Z=r(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),J=r(async(e,t,r={})=>Z(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),G=r(async(e,t)=>{const r=await N(e,t);return(await Promise.all(r)).some(e=>e)}),H=r(async(e,t)=>{const r=await N(e,t);return(await Promise.all(r)).every(e=>e)}),Q=r((e,t)=>e.reduce(async(e,t)=>t(await e),t)),X={entries:M,map:N,filter:J,reduce:Z,some:G,every:H,pipeline:Q,all:e=>Promise.all(e),allValues:e=>Q([M,Z(async(e,[t,r])=>(e[t]=await r,e),{})],e)},Y=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(re.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?ee(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+te(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=te(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:ee(e)}};function ee(e){return e+("/"===e[e.length-1]?"":"/")}function te(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const re=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var ne=fetch;const{jsonTypeOf:oe,splitUrl:ie}=v,ae={},se={},ce=(e,t)=>{const r=e in se?se[e]:e;if(r in ae)return ae[r][t]},ue={},le={},fe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ie(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ce(n,"idToken"),i=ie(t)[0];if(!i&&!ie(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const a=be(i,e[o]||""),s=ie(a)[0];let c;i&&(le[i]=s),ce(n,"vocabulary")&&oe(e,"object")&&"$vocabulary"in e?(se[s]=n,c=e.$vocabulary,delete e.$vocabulary):c=s===n?{[n]:!0}:{};const u={},l={};ue[s]={id:s,schemaVersion:n,schema:de(e,s,n,h.nil,u,l),anchors:u,recursiveAnchors:l,vocabulary:c,validated:!1}},de=(e,t,r,n,o,i)=>{if(oe(e,"object")){const a=ce(r,"idToken"),s=ce(r,"anchorToken");if("string"==typeof e[a]){const n=e[a],o=be(t,n),[i,c]=ie(o);if(delete e[a],c&&a===s&&(e[s]=s!==a?encodeURI(c):"#"+encodeURI(c)),i!==t)return fe(e,be(t,i),r),g(n,e)}const c=ce(r,"dynamicAnchorToken");"string"==typeof e[c]&&(i["#"+e[c]]=t,e[s]=e[c],delete e[c]);const u=ce(r,"recursiveAnchorToken");if(n===h.nil&&!0===e[u]&&(i["#"]=t,delete e[u]),"string"==typeof e[s]){const t=s!==a?e[s]:e[s].slice(1);o[t]=n,delete e[s]}const l=ce(r,"jrefToken");if("string"==typeof e[l])return g(e[l],e);e=Object.entries(e).reduce((e,[a,s])=>(e[a]=de(s,t,r,h.append(a,n),o,i),e),{});const f=ce(r,"jsrefToken");"string"==typeof e[f]&&(e[f]=g(e[f],e[f]));const d=ce(r,"dynamicJsrefToken");return"string"==typeof e[d]&&(e[d]=g(e[d],e[d],!0)),e}return Array.isArray(e)?e.map((e,a)=>de(e,t,r,h.append(a,n),o,i)):e},pe=e=>ue[le[e]]||ue[e],he=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchors:{}}),ye=async(e,t=he,r=!1)=>{const n=r&&t.recursiveAnchors[e]?t.recursiveAnchors[e]:ge(t),o=be(n,e),[i,a]=ie(o);if(!(e=>e in ue||e in le)(i)){const e=await ne(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=F.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}fe(await e.json(),i)}const s=pe(i),c=a&&"/"!==a[0]?we(s,a):a,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:h.get(c,s.schema),recursiveAnchors:{...s.recursiveAnchors,...t.recursiveAnchors},validated:s.validated});return ve(u)},ve=e=>O(e.value)?ye(E(e.value),e,j(e.value)):e,be=(e,t)=>{const r=Y(e,t),n=ie(e)[0];if(n&&"file"===me(r)&&"file"!==me(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},me=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},we=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ge=e=>`${e.id}#${encodeURI(e.pointer)}`,Oe=e=>O(e.value)?$(e.value):e.value,Ee=(e,t)=>{const r=pe(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:h.append(e,t.pointer),schema:r.schema,value:Oe(t)[e],recursiveAnchors:t.recursiveAnchors,validated:r.validated});return ve(n)},$e=r((e,t)=>X.pipeline([Oe,X.map(async(r,n)=>e(await Ee(n,t),n)),X.all],t));var je={setConfig:(e,t,r)=>{ae[e]||(ae[e]={}),ae[e][t]=r},getConfig:ce,add:fe,get:ye,markValidated:e=>{ue[e].validated=!0},uri:ge,value:Oe,typeOf:(e,t)=>oe(Oe(e),t),has:(e,t)=>e in Oe(t),step:Ee,keys:e=>Object.keys(Oe(e)),entries:e=>X.pipeline([Oe,Object.keys,X.map(async t=>[t,await Ee(t,e)]),X.all],e),map:$e,length:e=>Oe(e).length};class xe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Ae=xe;const Pe="FLAG",Se="BASIC",Te="DETAILED",Ie="VERBOSE";let Ve=Te,ke=!0;const ze=(e,r)=>(n,o=Pe)=>{if(![Pe,Se,Te,Ie].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=t.subscribe("result",Ke(o,i));return De(r,n,e),t.unsubscribe(a),i[0]},Ke=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&Le(r[r.length-1],i);){const t=r.pop();let n=[];if(e===Se&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),_e(i))break}(e===Ie||e!==Pe&&!i.valid)&&r.push(i),t[0]=i}},Le=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||_e(e)),_e=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),Ce={},qe=e=>Ce[e],Re=e=>e in Ce,Ue={},We={},Be=async(e,t)=>{if(!Re(e.schemaVersion+"#validate")){const t=await je.get(e.schemaVersion);(je.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Ue)Object.entries(Ue[e]).forEach(([e,r])=>{((e,t)=>{Ce[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(ke&&!e.validated){if(je.markValidated(e.id),!(e.schemaVersion in We)){const t=await je.get(e.schemaVersion),r={},n=await Be(t,r);We[t.id]=ze(r,n)}const t=L.cons(e.schema,e.id),r=We[e.schemaVersion](t,Ve);if(!r.valid)throw new Ae(r)}return await qe(e.schemaVersion+"#validate").compile(e,t),je.uri(e)},De=(e,t,r)=>{const[n]=r[e];return qe(n).interpret(e,t,r)};var Fe={validate:async(e,t,r)=>{const n={},o=await Be(e,n),i=(e,t=Pe)=>ze(n,o)(L.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{Ve=e},setShouldMetaValidate:e=>{ke=e},FLAG:Pe,BASIC:Se,DETAILED:Te,VERBOSE:Ie,getKeyword:qe,hasKeyword:Re,defineVocabulary:(e,t)=>{Ue[e]=t},compileSchema:Be,interpretSchema:De,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return qe(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return qe(o).collectEvaluatedItems(e,t,r,n)}};var Me={compile:async(e,t)=>{const r=je.uri(e);if(!(r in t)){t[r]=!1;const n=je.value(e);t[r]=[e.schemaVersion+"#validate",je.uri(e),"boolean"==typeof n?n:await X.pipeline([je.entries,X.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),X.filter(([t])=>Fe.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),X.map(async([r,n])=>{const o=await Fe.getKeyword(r).compile(n,t,e);return[r,je.uri(n),o]}),X.all],e)]}},interpret:(e,r,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Fe.getKeyword(e).interpret(i,r,n);return t.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:L.uri(r),valid:a}),a});return t.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:L.uri(r),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Fe.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Fe.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ne={Core:Fe,Schema:je,Instance:L,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Me}},Ze=Ne.Core,Je=Ne.Schema,Ge=Ne.Instance,He=Ne.Keywords;exports.Core=Ze,exports.Instance=Ge,exports.Keywords=He,exports.Schema=Je,exports.default=Ne; | ||
*/function B(e){var t=String(e);if(q.test(t))return t;if(t.length>0&&!C.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(U,"\\$1")+'"'}function D(e){this.parameters=Object.create(null),this.type=e}var F={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!W.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!q.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+B(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!W.test(n))throw new TypeError("invalid media type");var o=new D(n.toLowerCase());if(-1!==r){var i,a,s;for(_.lastIndex=r;a=_.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(R,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},M=async e=>Object.entries(await e),N=r(async(e,t)=>(await t).map(e)),Z=r(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),J=r(async(e,t,r={})=>Z(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),G=r(async(e,t)=>{const r=await N(e,t);return(await Promise.all(r)).some(e=>e)}),H=r(async(e,t)=>{const r=await N(e,t);return(await Promise.all(r)).every(e=>e)}),Q=r((e,t)=>e.reduce(async(e,t)=>t(await e),t)),X={entries:M,map:N,filter:J,reduce:Z,some:G,every:H,pipeline:Q,all:e=>Promise.all(e),allValues:e=>Q([M,Z(async(e,[t,r])=>(e[t]=await r,e),{})],e)},Y=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(re.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?ee(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+te(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=te(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:ee(e)}};function ee(e){return e+("/"===e[e.length-1]?"":"/")}function te(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const re=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var ne=fetch;const{jsonTypeOf:oe,splitUrl:ie}=v,ae={},se={},ce=(e,t)=>{const r=e in se?se[e]:e;if(r in ae)return ae[r][t]},ue={},le={},fe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ie(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ce(n,"idToken"),i=ce(n,"anchorToken"),a=ie(t)[0];if(!a&&!ie(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=be(a,e[o]||""),[c,u]=ie(s);delete e[o],u&&o===i&&(e[i]=i!==o?encodeURI(u):"#"+encodeURI(u)),a&&(le[a]=c);const l={},f=ce(n,"recursiveAnchorToken");let d;!0===e[f]&&(l["#"]=c,e[i]="",delete e[f]),ce(n,"vocabulary")&&oe(e,"object")&&"$vocabulary"in e?(se[c]=n,d=e.$vocabulary,delete e.$vocabulary):d=c===n?{[n]:!0}:{};const p={};ue[c]={id:c,schemaVersion:n,schema:de(e,c,n,h.nil,p,l),anchors:p,recursiveAnchors:l,vocabulary:d,validated:!1}},de=(e,t,r,n,o,i)=>{if(oe(e,"object")){const a="string"==typeof e.$schema?e.$schema:r,s=ce(a,"idToken"),c=ce(a,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=be(t,e[s]);return e[s]=n,fe(e,n,r),g(e[s],e)}const u=ce(r,"anchorToken"),l=ce(r,"dynamicAnchorToken");"string"==typeof e[l]&&(i["#"+e[l]]=t,e[u]=e[l],delete e[l]);const f=ce(r,"idToken");if("string"==typeof e[u]){const t=u!==f?e[u]:e[u].slice(1);o[t]=n,delete e[u]}const d=ce(r,"jrefToken");if("string"==typeof e[d])return g(e[d],e);e=Object.entries(e).reduce((e,[a,s])=>(e[a]=de(s,t,r,h.append(a,n),o,i),e),{});const p=ce(r,"jsrefToken");"string"==typeof e[p]&&(e[p]=g(e[p],e[p]));const y=ce(r,"dynamicJsrefToken");return"string"==typeof e[y]&&(e[y]=g(e[y],e[y],!0)),e}return Array.isArray(e)?e.map((e,a)=>de(e,t,r,h.append(a,n),o,i)):e},pe=e=>ue[le[e]]||ue[e],he=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchors:{}}),ye=async(e,t=he,r=!1)=>{const n=r&&t.recursiveAnchors[e]?t.recursiveAnchors[e]:ge(t),o=be(n,e),[i,a]=ie(o);if(!(e=>e in ue||e in le)(i)){const e=await ne(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=F.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}fe(await e.json(),i)}const s=pe(i),c=a&&"/"!==a[0]?we(s,a):a,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:h.get(c,s.schema),recursiveAnchors:{...s.recursiveAnchors,...t.recursiveAnchors},validated:s.validated});return ve(u)},ve=e=>O(e.value)?ye(E(e.value),e,j(e.value)):e,be=(e,t)=>{const r=Y(e,t),n=ie(e)[0];if(n&&"file"===me(r)&&"file"!==me(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},me=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},we=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ge=e=>`${e.id}#${encodeURI(e.pointer)}`,Oe=e=>O(e.value)?$(e.value):e.value,Ee=(e,t)=>{const r=pe(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:h.append(e,t.pointer),schema:r.schema,value:Oe(t)[e],recursiveAnchors:t.recursiveAnchors,validated:r.validated});return ve(n)},$e=r((e,t)=>X.pipeline([Oe,X.map(async(r,n)=>e(await Ee(n,t),n)),X.all],t));var je={setConfig:(e,t,r)=>{ae[e]||(ae[e]={}),ae[e][t]=r},getConfig:ce,add:fe,get:ye,markValidated:e=>{ue[e].validated=!0},uri:ge,value:Oe,typeOf:(e,t)=>oe(Oe(e),t),has:(e,t)=>e in Oe(t),step:Ee,keys:e=>Object.keys(Oe(e)),entries:e=>X.pipeline([Oe,Object.keys,X.map(async t=>[t,await Ee(t,e)]),X.all],e),map:$e,length:e=>Oe(e).length};class xe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Ae=xe;const Pe="FLAG",Se="BASIC",Te="DETAILED",Ie="VERBOSE";let ke=Te,Ve=!0;const ze=(e,r)=>(n,o=Pe)=>{if(![Pe,Se,Te,Ie].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=t.subscribe("result",Ke(o,i));return De(r,n,e),t.unsubscribe(a),i[0]},Ke=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&Le(r[r.length-1],i);){const t=r.pop();let n=[];if(e===Se&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),_e(i))break}(e===Ie||e!==Pe&&!i.valid)&&r.push(i),t[0]=i}},Le=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||_e(e)),_e=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),Ce={},qe=e=>Ce[e],Re=e=>e in Ce,Ue={},We={},Be=async(e,t)=>{if(!Re(e.schemaVersion+"#validate")){const t=await je.get(e.schemaVersion);(je.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Ue)Object.entries(Ue[e]).forEach(([e,r])=>{((e,t)=>{Ce[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(Ve&&!e.validated){if(je.markValidated(e.id),!(e.schemaVersion in We)){const t=await je.get(e.schemaVersion),r={},n=await Be(t,r);We[t.id]=ze(r,n)}const t=L.cons(e.schema,e.id),r=We[e.schemaVersion](t,ke);if(!r.valid)throw new Ae(r)}return await qe(e.schemaVersion+"#validate").compile(e,t),je.uri(e)},De=(e,t,r)=>{const[n]=r[e];return qe(n).interpret(e,t,r)};var Fe={validate:async(e,t,r)=>{const n={},o=await Be(e,n),i=(e,t=Pe)=>ze(n,o)(L.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{ke=e},setShouldMetaValidate:e=>{Ve=e},FLAG:Pe,BASIC:Se,DETAILED:Te,VERBOSE:Ie,getKeyword:qe,hasKeyword:Re,defineVocabulary:(e,t)=>{Ue[e]=t},compileSchema:Be,interpretSchema:De,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return qe(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return qe(o).collectEvaluatedItems(e,t,r,n)}};var Me={compile:async(e,t)=>{const r=je.uri(e);if(!(r in t)){t[r]=!1;const n=je.value(e);t[r]=[e.schemaVersion+"#validate",je.uri(e),"boolean"==typeof n?n:await X.pipeline([je.entries,X.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),X.filter(([t])=>Fe.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),X.map(async([r,n])=>{const o=await Fe.getKeyword(r).compile(n,t,e);return[r,je.uri(n),o]}),X.all],e)]}},interpret:(e,r,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Fe.getKeyword(e).interpret(i,r,n);return t.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:L.uri(r),valid:a}),a});return t.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:L.uri(r),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Fe.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Fe.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ne={Core:Fe,Schema:je,Instance:L,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Me}},Ze=Ne.Core,Je=Ne.Schema,Ge=Ne.Instance,He=Ne.Keywords;exports.Core=Ze,exports.Instance=Ge,exports.Keywords=He,exports.Schema=Je,exports.default=Ne; | ||
//# sourceMappingURL=json-schema-core-cjs.min.js.map |
@@ -1130,2 +1130,3 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
const externalId = splitUrl$1(url)[0]; | ||
@@ -1136,3 +1137,7 @@ if (!externalId && !splitUrl$1(schema[idToken] || "")[0]) { | ||
const internalUrl = safeResolveUrl(externalId, schema[idToken] || ""); | ||
const id = splitUrl$1(internalUrl)[0]; | ||
const [id, fragment] = splitUrl$1(internalUrl); | ||
delete schema[idToken]; | ||
if (fragment && idToken === anchorToken) { | ||
schema[anchorToken] = anchorToken !== idToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`; | ||
} | ||
if (externalId) { | ||
@@ -1142,2 +1147,11 @@ schemaStoreAlias[externalId] = id; | ||
// recursiveAnchor | ||
const recursiveAnchors = {}; | ||
const recursiveAnchorToken = getConfig(schemaVersion, "recursiveAnchorToken"); | ||
if (schema[recursiveAnchorToken] === true) { | ||
recursiveAnchors["#"] = id; | ||
schema[anchorToken] = ""; | ||
delete schema[recursiveAnchorToken]; | ||
} | ||
// Vocabulary | ||
@@ -1157,3 +1171,2 @@ let vocabulary; | ||
const anchors = {}; | ||
const recursiveAnchors = {}; | ||
schemaStore[id] = { | ||
@@ -1172,20 +1185,13 @@ id: id, | ||
if (jsonTypeOf$2(subject, "object")) { | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
if (typeof subject[idToken] === "string") { | ||
const ref = subject[idToken]; | ||
const resolvedUrl = safeResolveUrl(id, ref); | ||
const [schemaId, fragment] = splitUrl$1(resolvedUrl); | ||
delete subject[idToken]; | ||
if (fragment && idToken === anchorToken) { | ||
subject[anchorToken] = anchorToken !== idToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`; | ||
} | ||
if (schemaId !== id) { | ||
add(subject, safeResolveUrl(id, schemaId), schemaVersion); | ||
return reference.cons(ref, subject); | ||
} | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? subject["$schema"] : schemaVersion; | ||
const embeddedIdToken = getConfig(embeddedSchemaVersion, "idToken"); | ||
const embeddedAnchorToken = getConfig(embeddedSchemaVersion, "anchorToken"); | ||
if (typeof subject[embeddedIdToken] === "string" && (embeddedIdToken !== embeddedAnchorToken || subject[embeddedIdToken][0] !== "#")) { | ||
const ref = safeResolveUrl(id, subject[embeddedIdToken]); | ||
subject[embeddedIdToken] = ref; | ||
add(subject, ref, schemaVersion); | ||
return reference.cons(subject[embeddedIdToken], subject); | ||
} | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
const dynamicAnchorToken = getConfig(schemaVersion, "dynamicAnchorToken"); | ||
@@ -1198,8 +1204,3 @@ if (typeof subject[dynamicAnchorToken] === "string") { | ||
const recursiveAnchorToken = getConfig(schemaVersion, "recursiveAnchorToken"); | ||
if (pointer === jsonPointer.nil && subject[recursiveAnchorToken] === true) { | ||
recursiveAnchors["#"] = id; | ||
delete subject[recursiveAnchorToken]; | ||
} | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
if (typeof subject[anchorToken] === "string") { | ||
@@ -1206,0 +1207,0 @@ const anchor = anchorToken !== idToken ? subject[anchorToken] : subject[anchorToken].slice(1); |
@@ -1,2 +0,2 @@ | ||
var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var t=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(t,r){!function(e,n){var o={};e.PubSub=o;var i=e.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==t&&t.exports&&(r=t.exports=o),r.PubSub=o,t.exports=r=o)}("object"==typeof window&&window||e)})),r=(t.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const n=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(l)},o=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const i=e.shift();return{...t,[i]:o(e,d(t,i,n),r,c(i,n))}}if(Array.isArray(t)){const n=[...t];return n[f(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:d(t,e[0],n)},i=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||p(t)){const o=e.shift();i(e,d(t,o,n),r,c(o,n))}else{t[f(t,e[0])]=r}},a=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=d(t,n,r);return{...t,[n]:a(e,o,c(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return d(t,e[0],r)}},s=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=d(t,n,r);s(e,o,c(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:d(t,e[0],r)},c=r((e,t)=>t+"/"+u(e)),u=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),l=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),f=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,d=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(p(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[f(e,t)]},p=e=>null===e||"object"!=typeof e;var h={nil:"",append:c,get:(e,t)=>{const r=n(e),o=e=>r.reduce(([e,t],r)=>[d(e,r,t),c(r,t)],[e,""])[0];return void 0===t?o:o(t)},set:(e,t,i)=>{const a=n(e),s=r((e,t)=>o(a,e,t,""));return void 0===t?s:s(t,i)},assign:(e,t,o)=>{const a=n(e),s=r((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,o)},unset:(e,t)=>{const r=n(e),o=e=>a(r,e,"");return void 0===t?o:o(t)},delete:(e,t)=>{const r=n(e),o=e=>s(r,e,"");return void 0===t?o:o(t)}};const y={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var v={jsonTypeOf:(e,t)=>y[t](e),splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const b=Symbol("$__value"),m=Symbol("$__href"),w=Symbol("$__isDynamic");var g=(e,t,r=!1)=>Object.freeze({[m]:e,[b]:t,[w]:r}),O=e=>e&&void 0!==e[m],E=e=>e[m],$=e=>e[b],j=e=>e[w];const{jsonTypeOf:A}=v,x=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),P=e=>O(e.value)?$(e.value):e.value,S=r((e,t)=>A(P(e),t)),T=(e,t)=>Object.freeze({...t,pointer:h.append(e,t.pointer),value:P(t)[e]}),I=r((e,t)=>P(t).map((r,n,o,i)=>e(T(n,t),n,o,i))),V=r((e,t)=>P(t).map((e,r,n,o)=>T(r,t)).filter((t,r,n,o)=>e(t,r,n,o))),k=r((e,t,r)=>P(r).reduce((t,n,o)=>e(t,T(o,r),o),t)),z=r((e,t)=>P(t).every((r,n,o,i)=>e(T(n,t),n,o,i))),K=r((e,t)=>P(t).some((r,n,o,i)=>e(T(n,t),n,o,i)));var L={cons:(e,t="")=>Object.freeze({...x,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:P,typeOf:S,step:T,entries:e=>Object.keys(P(e)).map(t=>[t,T(t,e)]),keys:e=>Object.keys(P(e)),map:I,filter:V,reduce:k,every:z,some:K,length:e=>P(e).length},C=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,q=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,_=/\\([\u000b\u0020-\u00ff])/g,U=/([\\"])/g,W=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var t=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(t,r){!function(e,n){var o={};e.PubSub=o;var i=e.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==t&&t.exports&&(r=t.exports=o),r.PubSub=o,t.exports=r=o)}("object"==typeof window&&window||e)})),r=(t.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const n=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(l)},o=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const i=e.shift();return{...t,[i]:o(e,d(t,i,n),r,c(i,n))}}if(Array.isArray(t)){const n=[...t];return n[f(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:d(t,e[0],n)},i=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||p(t)){const o=e.shift();i(e,d(t,o,n),r,c(o,n))}else{t[f(t,e[0])]=r}},a=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=d(t,n,r);return{...t,[n]:a(e,o,c(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return d(t,e[0],r)}},s=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=d(t,n,r);s(e,o,c(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:d(t,e[0],r)},c=r((e,t)=>t+"/"+u(e)),u=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),l=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),f=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,d=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(p(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[f(e,t)]},p=e=>null===e||"object"!=typeof e;var h={nil:"",append:c,get:(e,t)=>{const r=n(e),o=e=>r.reduce(([e,t],r)=>[d(e,r,t),c(r,t)],[e,""])[0];return void 0===t?o:o(t)},set:(e,t,i)=>{const a=n(e),s=r((e,t)=>o(a,e,t,""));return void 0===t?s:s(t,i)},assign:(e,t,o)=>{const a=n(e),s=r((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,o)},unset:(e,t)=>{const r=n(e),o=e=>a(r,e,"");return void 0===t?o:o(t)},delete:(e,t)=>{const r=n(e),o=e=>s(r,e,"");return void 0===t?o:o(t)}};const y={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var v={jsonTypeOf:(e,t)=>y[t](e),splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const b=Symbol("$__value"),m=Symbol("$__href"),w=Symbol("$__isDynamic");var g=(e,t,r=!1)=>Object.freeze({[m]:e,[b]:t,[w]:r}),O=e=>e&&void 0!==e[m],E=e=>e[m],$=e=>e[b],j=e=>e[w];const{jsonTypeOf:A}=v,x=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),P=e=>O(e.value)?$(e.value):e.value,S=r((e,t)=>A(P(e),t)),T=(e,t)=>Object.freeze({...t,pointer:h.append(e,t.pointer),value:P(t)[e]}),I=r((e,t)=>P(t).map((r,n,o,i)=>e(T(n,t),n,o,i))),k=r((e,t)=>P(t).map((e,r,n,o)=>T(r,t)).filter((t,r,n,o)=>e(t,r,n,o))),V=r((e,t,r)=>P(r).reduce((t,n,o)=>e(t,T(o,r),o),t)),z=r((e,t)=>P(t).every((r,n,o,i)=>e(T(n,t),n,o,i))),K=r((e,t)=>P(t).some((r,n,o,i)=>e(T(n,t),n,o,i)));var L={cons:(e,t="")=>Object.freeze({...x,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:P,typeOf:S,step:T,entries:e=>Object.keys(P(e)).map(t=>[t,T(t,e)]),keys:e=>Object.keys(P(e)),map:I,filter:k,reduce:V,every:z,some:K,length:e=>P(e).length},C=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,q=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,_=/\\([\u000b\u0020-\u00ff])/g,U=/([\\"])/g,W=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function B(e){var t=String(e);if(R.test(t))return t;if(t.length>0&&!q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(U,"\\$1")+'"'}function D(e){this.parameters=Object.create(null),this.type=e}var F={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!W.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!R.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+B(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!W.test(n))throw new TypeError("invalid media type");var o=new D(n.toLowerCase());if(-1!==r){var i,a,s;for(C.lastIndex=r;a=C.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(_,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},N=async e=>Object.entries(await e),Z=r(async(e,t)=>(await t).map(e)),J=r(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),M=r(async(e,t,r={})=>J(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),G=r(async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).some(e=>e)}),H=r(async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).every(e=>e)}),Q=r((e,t)=>e.reduce(async(e,t)=>t(await e),t)),X={entries:N,map:Z,filter:M,reduce:J,some:G,every:H,pipeline:Q,all:e=>Promise.all(e),allValues:e=>Q([N,J(async(e,[t,r])=>(e[t]=await r,e),{})],e)},Y=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(re.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?ee(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+te(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=te(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:ee(e)}};function ee(e){return e+("/"===e[e.length-1]?"":"/")}function te(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const re=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var ne=fetch;const{jsonTypeOf:oe,splitUrl:ie}=v,ae={},se={},ce=(e,t)=>{const r=e in se?se[e]:e;if(r in ae)return ae[r][t]},ue={},le={},fe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ie(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ce(n,"idToken"),i=ie(t)[0];if(!i&&!ie(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const a=be(i,e[o]||""),s=ie(a)[0];let c;i&&(le[i]=s),ce(n,"vocabulary")&&oe(e,"object")&&"$vocabulary"in e?(se[s]=n,c=e.$vocabulary,delete e.$vocabulary):c=s===n?{[n]:!0}:{};const u={},l={};ue[s]={id:s,schemaVersion:n,schema:de(e,s,n,h.nil,u,l),anchors:u,recursiveAnchors:l,vocabulary:c,validated:!1}},de=(e,t,r,n,o,i)=>{if(oe(e,"object")){const a=ce(r,"idToken"),s=ce(r,"anchorToken");if("string"==typeof e[a]){const n=e[a],o=be(t,n),[i,c]=ie(o);if(delete e[a],c&&a===s&&(e[s]=s!==a?encodeURI(c):"#"+encodeURI(c)),i!==t)return fe(e,be(t,i),r),g(n,e)}const c=ce(r,"dynamicAnchorToken");"string"==typeof e[c]&&(i["#"+e[c]]=t,e[s]=e[c],delete e[c]);const u=ce(r,"recursiveAnchorToken");if(n===h.nil&&!0===e[u]&&(i["#"]=t,delete e[u]),"string"==typeof e[s]){const t=s!==a?e[s]:e[s].slice(1);o[t]=n,delete e[s]}const l=ce(r,"jrefToken");if("string"==typeof e[l])return g(e[l],e);e=Object.entries(e).reduce((e,[a,s])=>(e[a]=de(s,t,r,h.append(a,n),o,i),e),{});const f=ce(r,"jsrefToken");"string"==typeof e[f]&&(e[f]=g(e[f],e[f]));const d=ce(r,"dynamicJsrefToken");return"string"==typeof e[d]&&(e[d]=g(e[d],e[d],!0)),e}return Array.isArray(e)?e.map((e,a)=>de(e,t,r,h.append(a,n),o,i)):e},pe=e=>ue[le[e]]||ue[e],he=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchors:{}}),ye=async(e,t=he,r=!1)=>{const n=r&&t.recursiveAnchors[e]?t.recursiveAnchors[e]:ge(t),o=be(n,e),[i,a]=ie(o);if(!(e=>e in ue||e in le)(i)){const e=await ne(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=F.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}fe(await e.json(),i)}const s=pe(i),c=a&&"/"!==a[0]?we(s,a):a,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:h.get(c,s.schema),recursiveAnchors:{...s.recursiveAnchors,...t.recursiveAnchors},validated:s.validated});return ve(u)},ve=e=>O(e.value)?ye(E(e.value),e,j(e.value)):e,be=(e,t)=>{const r=Y(e,t),n=ie(e)[0];if(n&&"file"===me(r)&&"file"!==me(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},me=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},we=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ge=e=>`${e.id}#${encodeURI(e.pointer)}`,Oe=e=>O(e.value)?$(e.value):e.value,Ee=(e,t)=>{const r=pe(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:h.append(e,t.pointer),schema:r.schema,value:Oe(t)[e],recursiveAnchors:t.recursiveAnchors,validated:r.validated});return ve(n)},$e=r((e,t)=>X.pipeline([Oe,X.map(async(r,n)=>e(await Ee(n,t),n)),X.all],t));var je={setConfig:(e,t,r)=>{ae[e]||(ae[e]={}),ae[e][t]=r},getConfig:ce,add:fe,get:ye,markValidated:e=>{ue[e].validated=!0},uri:ge,value:Oe,typeOf:(e,t)=>oe(Oe(e),t),has:(e,t)=>e in Oe(t),step:Ee,keys:e=>Object.keys(Oe(e)),entries:e=>X.pipeline([Oe,Object.keys,X.map(async t=>[t,await Ee(t,e)]),X.all],e),map:$e,length:e=>Oe(e).length};class Ae extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=Ae;const Pe="FLAG",Se="BASIC",Te="DETAILED",Ie="VERBOSE";let Ve=Te,ke=!0;const ze=(e,r)=>(n,o=Pe)=>{if(![Pe,Se,Te,Ie].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=t.subscribe("result",Ke(o,i));return De(r,n,e),t.unsubscribe(a),i[0]},Ke=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&Le(r[r.length-1],i);){const t=r.pop();let n=[];if(e===Se&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),Ce(i))break}(e===Ie||e!==Pe&&!i.valid)&&r.push(i),t[0]=i}},Le=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||Ce(e)),Ce=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),qe={},Re=e=>qe[e],_e=e=>e in qe,Ue={},We={},Be=async(e,t)=>{if(!_e(e.schemaVersion+"#validate")){const t=await je.get(e.schemaVersion);(je.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Ue)Object.entries(Ue[e]).forEach(([e,r])=>{((e,t)=>{qe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(ke&&!e.validated){if(je.markValidated(e.id),!(e.schemaVersion in We)){const t=await je.get(e.schemaVersion),r={},n=await Be(t,r);We[t.id]=ze(r,n)}const t=L.cons(e.schema,e.id),r=We[e.schemaVersion](t,Ve);if(!r.valid)throw new xe(r)}return await Re(e.schemaVersion+"#validate").compile(e,t),je.uri(e)},De=(e,t,r)=>{const[n]=r[e];return Re(n).interpret(e,t,r)};var Fe={validate:async(e,t,r)=>{const n={},o=await Be(e,n),i=(e,t=Pe)=>ze(n,o)(L.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{Ve=e},setShouldMetaValidate:e=>{ke=e},FLAG:Pe,BASIC:Se,DETAILED:Te,VERBOSE:Ie,getKeyword:Re,hasKeyword:_e,defineVocabulary:(e,t)=>{Ue[e]=t},compileSchema:Be,interpretSchema:De,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Re(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Re(o).collectEvaluatedItems(e,t,r,n)}};var Ne={compile:async(e,t)=>{const r=je.uri(e);if(!(r in t)){t[r]=!1;const n=je.value(e);t[r]=[e.schemaVersion+"#validate",je.uri(e),"boolean"==typeof n?n:await X.pipeline([je.entries,X.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),X.filter(([t])=>Fe.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),X.map(async([r,n])=>{const o=await Fe.getKeyword(r).compile(n,t,e);return[r,je.uri(n),o]}),X.all],e)]}},interpret:(e,r,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Fe.getKeyword(e).interpret(i,r,n);return t.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:L.uri(r),valid:a}),a});return t.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:L.uri(r),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Fe.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Fe.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ze={Core:Fe,Schema:je,Instance:L,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Ne}},Je=Ze.Core,Me=Ze.Schema,Ge=Ze.Instance,He=Ze.Keywords;export default Ze;export{Je as Core,Ge as Instance,He as Keywords,Me as Schema}; | ||
*/function B(e){var t=String(e);if(R.test(t))return t;if(t.length>0&&!q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(U,"\\$1")+'"'}function D(e){this.parameters=Object.create(null),this.type=e}var F={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!W.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!R.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+B(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!W.test(n))throw new TypeError("invalid media type");var o=new D(n.toLowerCase());if(-1!==r){var i,a,s;for(C.lastIndex=r;a=C.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(_,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},N=async e=>Object.entries(await e),Z=r(async(e,t)=>(await t).map(e)),J=r(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),M=r(async(e,t,r={})=>J(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),G=r(async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).some(e=>e)}),H=r(async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).every(e=>e)}),Q=r((e,t)=>e.reduce(async(e,t)=>t(await e),t)),X={entries:N,map:Z,filter:M,reduce:J,some:G,every:H,pipeline:Q,all:e=>Promise.all(e),allValues:e=>Q([N,J(async(e,[t,r])=>(e[t]=await r,e),{})],e)},Y=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(re.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?ee(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+te(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=te(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:ee(e)}};function ee(e){return e+("/"===e[e.length-1]?"":"/")}function te(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const re=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var ne=fetch;const{jsonTypeOf:oe,splitUrl:ie}=v,ae={},se={},ce=(e,t)=>{const r=e in se?se[e]:e;if(r in ae)return ae[r][t]},ue={},le={},fe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ie(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ce(n,"idToken"),i=ce(n,"anchorToken"),a=ie(t)[0];if(!a&&!ie(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=be(a,e[o]||""),[c,u]=ie(s);delete e[o],u&&o===i&&(e[i]=i!==o?encodeURI(u):"#"+encodeURI(u)),a&&(le[a]=c);const l={},f=ce(n,"recursiveAnchorToken");let d;!0===e[f]&&(l["#"]=c,e[i]="",delete e[f]),ce(n,"vocabulary")&&oe(e,"object")&&"$vocabulary"in e?(se[c]=n,d=e.$vocabulary,delete e.$vocabulary):d=c===n?{[n]:!0}:{};const p={};ue[c]={id:c,schemaVersion:n,schema:de(e,c,n,h.nil,p,l),anchors:p,recursiveAnchors:l,vocabulary:d,validated:!1}},de=(e,t,r,n,o,i)=>{if(oe(e,"object")){const a="string"==typeof e.$schema?e.$schema:r,s=ce(a,"idToken"),c=ce(a,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=be(t,e[s]);return e[s]=n,fe(e,n,r),g(e[s],e)}const u=ce(r,"anchorToken"),l=ce(r,"dynamicAnchorToken");"string"==typeof e[l]&&(i["#"+e[l]]=t,e[u]=e[l],delete e[l]);const f=ce(r,"idToken");if("string"==typeof e[u]){const t=u!==f?e[u]:e[u].slice(1);o[t]=n,delete e[u]}const d=ce(r,"jrefToken");if("string"==typeof e[d])return g(e[d],e);e=Object.entries(e).reduce((e,[a,s])=>(e[a]=de(s,t,r,h.append(a,n),o,i),e),{});const p=ce(r,"jsrefToken");"string"==typeof e[p]&&(e[p]=g(e[p],e[p]));const y=ce(r,"dynamicJsrefToken");return"string"==typeof e[y]&&(e[y]=g(e[y],e[y],!0)),e}return Array.isArray(e)?e.map((e,a)=>de(e,t,r,h.append(a,n),o,i)):e},pe=e=>ue[le[e]]||ue[e],he=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchors:{}}),ye=async(e,t=he,r=!1)=>{const n=r&&t.recursiveAnchors[e]?t.recursiveAnchors[e]:ge(t),o=be(n,e),[i,a]=ie(o);if(!(e=>e in ue||e in le)(i)){const e=await ne(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=F.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}fe(await e.json(),i)}const s=pe(i),c=a&&"/"!==a[0]?we(s,a):a,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:h.get(c,s.schema),recursiveAnchors:{...s.recursiveAnchors,...t.recursiveAnchors},validated:s.validated});return ve(u)},ve=e=>O(e.value)?ye(E(e.value),e,j(e.value)):e,be=(e,t)=>{const r=Y(e,t),n=ie(e)[0];if(n&&"file"===me(r)&&"file"!==me(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},me=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},we=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ge=e=>`${e.id}#${encodeURI(e.pointer)}`,Oe=e=>O(e.value)?$(e.value):e.value,Ee=(e,t)=>{const r=pe(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:h.append(e,t.pointer),schema:r.schema,value:Oe(t)[e],recursiveAnchors:t.recursiveAnchors,validated:r.validated});return ve(n)},$e=r((e,t)=>X.pipeline([Oe,X.map(async(r,n)=>e(await Ee(n,t),n)),X.all],t));var je={setConfig:(e,t,r)=>{ae[e]||(ae[e]={}),ae[e][t]=r},getConfig:ce,add:fe,get:ye,markValidated:e=>{ue[e].validated=!0},uri:ge,value:Oe,typeOf:(e,t)=>oe(Oe(e),t),has:(e,t)=>e in Oe(t),step:Ee,keys:e=>Object.keys(Oe(e)),entries:e=>X.pipeline([Oe,Object.keys,X.map(async t=>[t,await Ee(t,e)]),X.all],e),map:$e,length:e=>Oe(e).length};class Ae extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=Ae;const Pe="FLAG",Se="BASIC",Te="DETAILED",Ie="VERBOSE";let ke=Te,Ve=!0;const ze=(e,r)=>(n,o=Pe)=>{if(![Pe,Se,Te,Ie].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=t.subscribe("result",Ke(o,i));return De(r,n,e),t.unsubscribe(a),i[0]},Ke=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&Le(r[r.length-1],i);){const t=r.pop();let n=[];if(e===Se&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),Ce(i))break}(e===Ie||e!==Pe&&!i.valid)&&r.push(i),t[0]=i}},Le=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||Ce(e)),Ce=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),qe={},Re=e=>qe[e],_e=e=>e in qe,Ue={},We={},Be=async(e,t)=>{if(!_e(e.schemaVersion+"#validate")){const t=await je.get(e.schemaVersion);(je.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Ue)Object.entries(Ue[e]).forEach(([e,r])=>{((e,t)=>{qe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(Ve&&!e.validated){if(je.markValidated(e.id),!(e.schemaVersion in We)){const t=await je.get(e.schemaVersion),r={},n=await Be(t,r);We[t.id]=ze(r,n)}const t=L.cons(e.schema,e.id),r=We[e.schemaVersion](t,ke);if(!r.valid)throw new xe(r)}return await Re(e.schemaVersion+"#validate").compile(e,t),je.uri(e)},De=(e,t,r)=>{const[n]=r[e];return Re(n).interpret(e,t,r)};var Fe={validate:async(e,t,r)=>{const n={},o=await Be(e,n),i=(e,t=Pe)=>ze(n,o)(L.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{ke=e},setShouldMetaValidate:e=>{Ve=e},FLAG:Pe,BASIC:Se,DETAILED:Te,VERBOSE:Ie,getKeyword:Re,hasKeyword:_e,defineVocabulary:(e,t)=>{Ue[e]=t},compileSchema:Be,interpretSchema:De,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Re(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Re(o).collectEvaluatedItems(e,t,r,n)}};var Ne={compile:async(e,t)=>{const r=je.uri(e);if(!(r in t)){t[r]=!1;const n=je.value(e);t[r]=[e.schemaVersion+"#validate",je.uri(e),"boolean"==typeof n?n:await X.pipeline([je.entries,X.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),X.filter(([t])=>Fe.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),X.map(async([r,n])=>{const o=await Fe.getKeyword(r).compile(n,t,e);return[r,je.uri(n),o]}),X.all],e)]}},interpret:(e,r,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Fe.getKeyword(e).interpret(i,r,n);return t.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:L.uri(r),valid:a}),a});return t.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:L.uri(r),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Fe.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Fe.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ze={Core:Fe,Schema:je,Instance:L,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Ne}},Je=Ze.Core,Me=Ze.Schema,Ge=Ze.Instance,He=Ze.Keywords;export default Ze;export{Je as Core,Ge as Instance,He as Keywords,Me as Schema}; | ||
//# sourceMappingURL=json-schema-core-esm.min.js.map |
@@ -1133,2 +1133,3 @@ var JSC = (function (exports) { | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
const externalId = splitUrl$1(url)[0]; | ||
@@ -1139,3 +1140,7 @@ if (!externalId && !splitUrl$1(schema[idToken] || "")[0]) { | ||
const internalUrl = safeResolveUrl(externalId, schema[idToken] || ""); | ||
const id = splitUrl$1(internalUrl)[0]; | ||
const [id, fragment] = splitUrl$1(internalUrl); | ||
delete schema[idToken]; | ||
if (fragment && idToken === anchorToken) { | ||
schema[anchorToken] = anchorToken !== idToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`; | ||
} | ||
if (externalId) { | ||
@@ -1145,2 +1150,11 @@ schemaStoreAlias[externalId] = id; | ||
// recursiveAnchor | ||
const recursiveAnchors = {}; | ||
const recursiveAnchorToken = getConfig(schemaVersion, "recursiveAnchorToken"); | ||
if (schema[recursiveAnchorToken] === true) { | ||
recursiveAnchors["#"] = id; | ||
schema[anchorToken] = ""; | ||
delete schema[recursiveAnchorToken]; | ||
} | ||
// Vocabulary | ||
@@ -1160,3 +1174,2 @@ let vocabulary; | ||
const anchors = {}; | ||
const recursiveAnchors = {}; | ||
schemaStore[id] = { | ||
@@ -1175,20 +1188,13 @@ id: id, | ||
if (jsonTypeOf$2(subject, "object")) { | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
if (typeof subject[idToken] === "string") { | ||
const ref = subject[idToken]; | ||
const resolvedUrl = safeResolveUrl(id, ref); | ||
const [schemaId, fragment] = splitUrl$1(resolvedUrl); | ||
delete subject[idToken]; | ||
if (fragment && idToken === anchorToken) { | ||
subject[anchorToken] = anchorToken !== idToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`; | ||
} | ||
if (schemaId !== id) { | ||
add(subject, safeResolveUrl(id, schemaId), schemaVersion); | ||
return reference.cons(ref, subject); | ||
} | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? subject["$schema"] : schemaVersion; | ||
const embeddedIdToken = getConfig(embeddedSchemaVersion, "idToken"); | ||
const embeddedAnchorToken = getConfig(embeddedSchemaVersion, "anchorToken"); | ||
if (typeof subject[embeddedIdToken] === "string" && (embeddedIdToken !== embeddedAnchorToken || subject[embeddedIdToken][0] !== "#")) { | ||
const ref = safeResolveUrl(id, subject[embeddedIdToken]); | ||
subject[embeddedIdToken] = ref; | ||
add(subject, ref, schemaVersion); | ||
return reference.cons(subject[embeddedIdToken], subject); | ||
} | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
const dynamicAnchorToken = getConfig(schemaVersion, "dynamicAnchorToken"); | ||
@@ -1201,8 +1207,3 @@ if (typeof subject[dynamicAnchorToken] === "string") { | ||
const recursiveAnchorToken = getConfig(schemaVersion, "recursiveAnchorToken"); | ||
if (pointer === jsonPointer.nil && subject[recursiveAnchorToken] === true) { | ||
recursiveAnchors["#"] = id; | ||
delete subject[recursiveAnchorToken]; | ||
} | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
if (typeof subject[anchorToken] === "string") { | ||
@@ -1209,0 +1210,0 @@ const anchor = anchorToken !== idToken ? subject[anchorToken] : subject[anchorToken].slice(1); |
@@ -1,2 +0,2 @@ | ||
var JSC=function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};const v={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var b={jsonTypeOf:(e,t)=>v[t](e),splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const m=Symbol("$__value"),w=Symbol("$__href"),g=Symbol("$__isDynamic");var O=(e,t,r=!1)=>Object.freeze({[w]:e,[m]:t,[g]:r}),E=e=>e&&void 0!==e[w],$=e=>e[w],j=e=>e[m],A=e=>e[g];const{jsonTypeOf:S}=b,P=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),x=e=>E(e.value)?j(e.value):e.value,T=n((e,t)=>S(x(e),t)),I=(e,t)=>Object.freeze({...t,pointer:y.append(e,t.pointer),value:x(t)[e]}),V=n((e,t)=>x(t).map((r,n,o,i)=>e(I(n,t),n,o,i))),k=n((e,t)=>x(t).map((e,r,n,o)=>I(r,t)).filter((t,r,n,o)=>e(t,r,n,o))),z=n((e,t,r)=>x(r).reduce((t,n,o)=>e(t,I(o,r),o),t)),C=n((e,t)=>x(t).every((r,n,o,i)=>e(I(n,t),n,o,i))),K=n((e,t)=>x(t).some((r,n,o,i)=>e(I(n,t),n,o,i)));var L={cons:(e,t="")=>Object.freeze({...P,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:x,typeOf:T,step:I,entries:e=>Object.keys(x(e)).map(t=>[t,I(t,e)]),keys:e=>Object.keys(x(e)),map:V,filter:k,reduce:z,every:C,some:K,length:e=>x(e).length},q=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,R=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,_=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,U=/\\([\u000b\u0020-\u00ff])/g,W=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
var JSC=function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};const v={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var b={jsonTypeOf:(e,t)=>v[t](e),splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const m=Symbol("$__value"),w=Symbol("$__href"),g=Symbol("$__isDynamic");var O=(e,t,r=!1)=>Object.freeze({[w]:e,[m]:t,[g]:r}),E=e=>e&&void 0!==e[w],$=e=>e[w],j=e=>e[m],A=e=>e[g];const{jsonTypeOf:S}=b,P=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),x=e=>E(e.value)?j(e.value):e.value,T=n((e,t)=>S(x(e),t)),I=(e,t)=>Object.freeze({...t,pointer:y.append(e,t.pointer),value:x(t)[e]}),k=n((e,t)=>x(t).map((r,n,o,i)=>e(I(n,t),n,o,i))),V=n((e,t)=>x(t).map((e,r,n,o)=>I(r,t)).filter((t,r,n,o)=>e(t,r,n,o))),z=n((e,t,r)=>x(r).reduce((t,n,o)=>e(t,I(o,r),o),t)),C=n((e,t)=>x(t).every((r,n,o,i)=>e(I(n,t),n,o,i))),K=n((e,t)=>x(t).some((r,n,o,i)=>e(I(n,t),n,o,i)));var L={cons:(e,t="")=>Object.freeze({...P,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:x,typeOf:T,step:I,entries:e=>Object.keys(x(e)).map(t=>[t,I(t,e)]),keys:e=>Object.keys(x(e)),map:k,filter:V,reduce:z,every:C,some:K,length:e=>x(e).length},q=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,R=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,_=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,U=/\\([\u000b\u0020-\u00ff])/g,W=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function D(e){var t=String(e);if(_.test(t))return t;if(t.length>0&&!R.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(W,"\\$1")+'"'}function F(e){this.parameters=Object.create(null),this.type=e}var J={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!B.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!_.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+D(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!B.test(n))throw new TypeError("invalid media type");var o=new F(n.toLowerCase());if(-1!==r){var i,a,s;for(q.lastIndex=r;a=q.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(U,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},N=async e=>Object.entries(await e),Z=n(async(e,t)=>(await t).map(e)),M=n(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),G=n(async(e,t,r={})=>M(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),H=n(async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).some(e=>e)}),Q=n(async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).every(e=>e)}),X=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Y={entries:N,map:Z,filter:G,reduce:M,some:H,every:Q,pipeline:X,all:e=>Promise.all(e),allValues:e=>X([N,M(async(e,[t,r])=>(e[t]=await r,e),{})],e)},ee=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(ne.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?te(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+re(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=re(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:te(e)}};function te(e){return e+("/"===e[e.length-1]?"":"/")}function re(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const ne=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var oe=fetch;const{jsonTypeOf:ie,splitUrl:ae}=b,se={},ce={},ue=(e,t)=>{const r=e in ce?ce[e]:e;if(r in se)return se[r][t]},le={},fe={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ae(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ue(n,"idToken"),i=ae(t)[0];if(!i&&!ae(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const a=me(i,e[o]||""),s=ae(a)[0];let c;i&&(fe[i]=s),ue(n,"vocabulary")&&ie(e,"object")&&"$vocabulary"in e?(ce[s]=n,c=e.$vocabulary,delete e.$vocabulary):c=s===n?{[n]:!0}:{};const u={},l={};le[s]={id:s,schemaVersion:n,schema:pe(e,s,n,y.nil,u,l),anchors:u,recursiveAnchors:l,vocabulary:c,validated:!1}},pe=(e,t,r,n,o,i)=>{if(ie(e,"object")){const a=ue(r,"idToken"),s=ue(r,"anchorToken");if("string"==typeof e[a]){const n=e[a],o=me(t,n),[i,c]=ae(o);if(delete e[a],c&&a===s&&(e[s]=s!==a?encodeURI(c):"#"+encodeURI(c)),i!==t)return de(e,me(t,i),r),O(n,e)}const c=ue(r,"dynamicAnchorToken");"string"==typeof e[c]&&(i["#"+e[c]]=t,e[s]=e[c],delete e[c]);const u=ue(r,"recursiveAnchorToken");if(n===y.nil&&!0===e[u]&&(i["#"]=t,delete e[u]),"string"==typeof e[s]){const t=s!==a?e[s]:e[s].slice(1);o[t]=n,delete e[s]}const l=ue(r,"jrefToken");if("string"==typeof e[l])return O(e[l],e);e=Object.entries(e).reduce((e,[a,s])=>(e[a]=pe(s,t,r,y.append(a,n),o,i),e),{});const f=ue(r,"jsrefToken");"string"==typeof e[f]&&(e[f]=O(e[f],e[f]));const d=ue(r,"dynamicJsrefToken");return"string"==typeof e[d]&&(e[d]=O(e[d],e[d],!0)),e}return Array.isArray(e)?e.map((e,a)=>pe(e,t,r,y.append(a,n),o,i)):e},he=e=>le[fe[e]]||le[e],ye=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchors:{}}),ve=async(e,t=ye,r=!1)=>{const n=r&&t.recursiveAnchors[e]?t.recursiveAnchors[e]:Oe(t),o=me(n,e),[i,a]=ae(o);if(!(e=>e in le||e in fe)(i)){const e=await oe(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=J.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),i)}const s=he(i),c=a&&"/"!==a[0]?ge(s,a):a,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:y.get(c,s.schema),recursiveAnchors:{...s.recursiveAnchors,...t.recursiveAnchors},validated:s.validated});return be(u)},be=e=>E(e.value)?ve($(e.value),e,A(e.value)):e,me=(e,t)=>{const r=ee(e,t),n=ae(e)[0];if(n&&"file"===we(r)&&"file"!==we(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},we=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ge=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Oe=e=>`${e.id}#${encodeURI(e.pointer)}`,Ee=e=>E(e.value)?j(e.value):e.value,$e=(e,t)=>{const r=he(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:y.append(e,t.pointer),schema:r.schema,value:Ee(t)[e],recursiveAnchors:t.recursiveAnchors,validated:r.validated});return be(n)},je=n((e,t)=>Y.pipeline([Ee,Y.map(async(r,n)=>e(await $e(n,t),n)),Y.all],t));var Ae={setConfig:(e,t,r)=>{se[e]||(se[e]={}),se[e][t]=r},getConfig:ue,add:de,get:ve,markValidated:e=>{le[e].validated=!0},uri:Oe,value:Ee,typeOf:(e,t)=>ie(Ee(e),t),has:(e,t)=>e in Ee(t),step:$e,keys:e=>Object.keys(Ee(e)),entries:e=>Y.pipeline([Ee,Object.keys,Y.map(async t=>[t,await $e(t,e)]),Y.all],e),map:je,length:e=>Ee(e).length};class Se extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Pe=Se;const xe="FLAG",Te="BASIC",Ie="DETAILED",Ve="VERBOSE";let ke=Ie,ze=!0;const Ce=(e,t)=>(n,o=xe)=>{if(![xe,Te,Ie,Ve].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",Ke(o,i));return Fe(t,n,e),r.unsubscribe(a),i[0]},Ke=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&Le(r[r.length-1],i);){const t=r.pop();let n=[];if(e===Te&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),qe(i))break}(e===Ve||e!==xe&&!i.valid)&&r.push(i),t[0]=i}},Le=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||qe(e)),qe=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),Re={},_e=e=>Re[e],Ue=e=>e in Re,We={},Be={},De=async(e,t)=>{if(!Ue(e.schemaVersion+"#validate")){const t=await Ae.get(e.schemaVersion);(Ae.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in We)Object.entries(We[e]).forEach(([e,r])=>{((e,t)=>{Re[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(ze&&!e.validated){if(Ae.markValidated(e.id),!(e.schemaVersion in Be)){const t=await Ae.get(e.schemaVersion),r={},n=await De(t,r);Be[t.id]=Ce(r,n)}const t=L.cons(e.schema,e.id),r=Be[e.schemaVersion](t,ke);if(!r.valid)throw new Pe(r)}return await _e(e.schemaVersion+"#validate").compile(e,t),Ae.uri(e)},Fe=(e,t,r)=>{const[n]=r[e];return _e(n).interpret(e,t,r)};var Je={validate:async(e,t,r)=>{const n={},o=await De(e,n),i=(e,t=xe)=>Ce(n,o)(L.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{ke=e},setShouldMetaValidate:e=>{ze=e},FLAG:xe,BASIC:Te,DETAILED:Ie,VERBOSE:Ve,getKeyword:_e,hasKeyword:Ue,defineVocabulary:(e,t)=>{We[e]=t},compileSchema:De,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return _e(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return _e(o).collectEvaluatedItems(e,t,r,n)}};var Ne={compile:async(e,t)=>{const r=Ae.uri(e);if(!(r in t)){t[r]=!1;const n=Ae.value(e);t[r]=[e.schemaVersion+"#validate",Ae.uri(e),"boolean"==typeof n?n:await Y.pipeline([Ae.entries,Y.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Y.filter(([t])=>Je.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Y.map(async([r,n])=>{const o=await Je.getKeyword(r).compile(n,t,e);return[r,Ae.uri(n),o]}),Y.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Je.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:L.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:L.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Je.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Je.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ze={Core:Je,Schema:Ae,Instance:L,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Ne}},Me=Ze.Core,Ge=Ze.Schema,He=Ze.Instance,Qe=Ze.Keywords;return e.Core=Me,e.Instance=He,e.Keywords=Qe,e.Schema=Ge,e.default=Ze,e}({}); | ||
*/function D(e){var t=String(e);if(_.test(t))return t;if(t.length>0&&!R.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(W,"\\$1")+'"'}function F(e){this.parameters=Object.create(null),this.type=e}var J={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!B.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!_.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+D(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!B.test(n))throw new TypeError("invalid media type");var o=new F(n.toLowerCase());if(-1!==r){var i,a,s;for(q.lastIndex=r;a=q.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(U,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},N=async e=>Object.entries(await e),Z=n(async(e,t)=>(await t).map(e)),M=n(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),G=n(async(e,t,r={})=>M(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),H=n(async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).some(e=>e)}),Q=n(async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).every(e=>e)}),X=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Y={entries:N,map:Z,filter:G,reduce:M,some:H,every:Q,pipeline:X,all:e=>Promise.all(e),allValues:e=>X([N,M(async(e,[t,r])=>(e[t]=await r,e),{})],e)},ee=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(ne.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?te(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+re(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=re(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:te(e)}};function te(e){return e+("/"===e[e.length-1]?"":"/")}function re(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const ne=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var oe=fetch;const{jsonTypeOf:ie,splitUrl:ae}=b,se={},ce={},ue=(e,t)=>{const r=e in ce?ce[e]:e;if(r in se)return se[r][t]},le={},fe={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ae(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ue(n,"idToken"),i=ue(n,"anchorToken"),a=ae(t)[0];if(!a&&!ae(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=me(a,e[o]||""),[c,u]=ae(s);delete e[o],u&&o===i&&(e[i]=i!==o?encodeURI(u):"#"+encodeURI(u)),a&&(fe[a]=c);const l={},f=ue(n,"recursiveAnchorToken");let d;!0===e[f]&&(l["#"]=c,e[i]="",delete e[f]),ue(n,"vocabulary")&&ie(e,"object")&&"$vocabulary"in e?(ce[c]=n,d=e.$vocabulary,delete e.$vocabulary):d=c===n?{[n]:!0}:{};const p={};le[c]={id:c,schemaVersion:n,schema:pe(e,c,n,y.nil,p,l),anchors:p,recursiveAnchors:l,vocabulary:d,validated:!1}},pe=(e,t,r,n,o,i)=>{if(ie(e,"object")){const a="string"==typeof e.$schema?e.$schema:r,s=ue(a,"idToken"),c=ue(a,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=me(t,e[s]);return e[s]=n,de(e,n,r),O(e[s],e)}const u=ue(r,"anchorToken"),l=ue(r,"dynamicAnchorToken");"string"==typeof e[l]&&(i["#"+e[l]]=t,e[u]=e[l],delete e[l]);const f=ue(r,"idToken");if("string"==typeof e[u]){const t=u!==f?e[u]:e[u].slice(1);o[t]=n,delete e[u]}const d=ue(r,"jrefToken");if("string"==typeof e[d])return O(e[d],e);e=Object.entries(e).reduce((e,[a,s])=>(e[a]=pe(s,t,r,y.append(a,n),o,i),e),{});const p=ue(r,"jsrefToken");"string"==typeof e[p]&&(e[p]=O(e[p],e[p]));const h=ue(r,"dynamicJsrefToken");return"string"==typeof e[h]&&(e[h]=O(e[h],e[h],!0)),e}return Array.isArray(e)?e.map((e,a)=>pe(e,t,r,y.append(a,n),o,i)):e},he=e=>le[fe[e]]||le[e],ye=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchors:{}}),ve=async(e,t=ye,r=!1)=>{const n=r&&t.recursiveAnchors[e]?t.recursiveAnchors[e]:Oe(t),o=me(n,e),[i,a]=ae(o);if(!(e=>e in le||e in fe)(i)){const e=await oe(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=J.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),i)}const s=he(i),c=a&&"/"!==a[0]?ge(s,a):a,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:y.get(c,s.schema),recursiveAnchors:{...s.recursiveAnchors,...t.recursiveAnchors},validated:s.validated});return be(u)},be=e=>E(e.value)?ve($(e.value),e,A(e.value)):e,me=(e,t)=>{const r=ee(e,t),n=ae(e)[0];if(n&&"file"===we(r)&&"file"!==we(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},we=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ge=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Oe=e=>`${e.id}#${encodeURI(e.pointer)}`,Ee=e=>E(e.value)?j(e.value):e.value,$e=(e,t)=>{const r=he(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:y.append(e,t.pointer),schema:r.schema,value:Ee(t)[e],recursiveAnchors:t.recursiveAnchors,validated:r.validated});return be(n)},je=n((e,t)=>Y.pipeline([Ee,Y.map(async(r,n)=>e(await $e(n,t),n)),Y.all],t));var Ae={setConfig:(e,t,r)=>{se[e]||(se[e]={}),se[e][t]=r},getConfig:ue,add:de,get:ve,markValidated:e=>{le[e].validated=!0},uri:Oe,value:Ee,typeOf:(e,t)=>ie(Ee(e),t),has:(e,t)=>e in Ee(t),step:$e,keys:e=>Object.keys(Ee(e)),entries:e=>Y.pipeline([Ee,Object.keys,Y.map(async t=>[t,await $e(t,e)]),Y.all],e),map:je,length:e=>Ee(e).length};class Se extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Pe=Se;const xe="FLAG",Te="BASIC",Ie="DETAILED",ke="VERBOSE";let Ve=Ie,ze=!0;const Ce=(e,t)=>(n,o=xe)=>{if(![xe,Te,Ie,ke].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",Ke(o,i));return Fe(t,n,e),r.unsubscribe(a),i[0]},Ke=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&Le(r[r.length-1],i);){const t=r.pop();let n=[];if(e===Te&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),qe(i))break}(e===ke||e!==xe&&!i.valid)&&r.push(i),t[0]=i}},Le=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||qe(e)),qe=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),Re={},_e=e=>Re[e],Ue=e=>e in Re,We={},Be={},De=async(e,t)=>{if(!Ue(e.schemaVersion+"#validate")){const t=await Ae.get(e.schemaVersion);(Ae.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in We)Object.entries(We[e]).forEach(([e,r])=>{((e,t)=>{Re[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(ze&&!e.validated){if(Ae.markValidated(e.id),!(e.schemaVersion in Be)){const t=await Ae.get(e.schemaVersion),r={},n=await De(t,r);Be[t.id]=Ce(r,n)}const t=L.cons(e.schema,e.id),r=Be[e.schemaVersion](t,Ve);if(!r.valid)throw new Pe(r)}return await _e(e.schemaVersion+"#validate").compile(e,t),Ae.uri(e)},Fe=(e,t,r)=>{const[n]=r[e];return _e(n).interpret(e,t,r)};var Je={validate:async(e,t,r)=>{const n={},o=await De(e,n),i=(e,t=xe)=>Ce(n,o)(L.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{Ve=e},setShouldMetaValidate:e=>{ze=e},FLAG:xe,BASIC:Te,DETAILED:Ie,VERBOSE:ke,getKeyword:_e,hasKeyword:Ue,defineVocabulary:(e,t)=>{We[e]=t},compileSchema:De,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return _e(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return _e(o).collectEvaluatedItems(e,t,r,n)}};var Ne={compile:async(e,t)=>{const r=Ae.uri(e);if(!(r in t)){t[r]=!1;const n=Ae.value(e);t[r]=[e.schemaVersion+"#validate",Ae.uri(e),"boolean"==typeof n?n:await Y.pipeline([Ae.entries,Y.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Y.filter(([t])=>Je.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Y.map(async([r,n])=>{const o=await Je.getKeyword(r).compile(n,t,e);return[r,Ae.uri(n),o]}),Y.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Je.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:L.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:L.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Je.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Je.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ze={Core:Je,Schema:Ae,Instance:L,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Ne}},Me=Ze.Core,Ge=Ze.Schema,He=Ze.Instance,Qe=Ze.Keywords;return e.Core=Me,e.Instance=He,e.Keywords=Qe,e.Schema=Ge,e.default=Ze,e}({}); | ||
//# sourceMappingURL=json-schema-core-iife.min.js.map |
@@ -1135,2 +1135,3 @@ System.register('JSC', [], function (exports) { | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
const externalId = splitUrl$1(url)[0]; | ||
@@ -1141,3 +1142,7 @@ if (!externalId && !splitUrl$1(schema[idToken] || "")[0]) { | ||
const internalUrl = safeResolveUrl(externalId, schema[idToken] || ""); | ||
const id = splitUrl$1(internalUrl)[0]; | ||
const [id, fragment] = splitUrl$1(internalUrl); | ||
delete schema[idToken]; | ||
if (fragment && idToken === anchorToken) { | ||
schema[anchorToken] = anchorToken !== idToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`; | ||
} | ||
if (externalId) { | ||
@@ -1147,2 +1152,11 @@ schemaStoreAlias[externalId] = id; | ||
// recursiveAnchor | ||
const recursiveAnchors = {}; | ||
const recursiveAnchorToken = getConfig(schemaVersion, "recursiveAnchorToken"); | ||
if (schema[recursiveAnchorToken] === true) { | ||
recursiveAnchors["#"] = id; | ||
schema[anchorToken] = ""; | ||
delete schema[recursiveAnchorToken]; | ||
} | ||
// Vocabulary | ||
@@ -1162,3 +1176,2 @@ let vocabulary; | ||
const anchors = {}; | ||
const recursiveAnchors = {}; | ||
schemaStore[id] = { | ||
@@ -1177,20 +1190,13 @@ id: id, | ||
if (jsonTypeOf$2(subject, "object")) { | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
if (typeof subject[idToken] === "string") { | ||
const ref = subject[idToken]; | ||
const resolvedUrl = safeResolveUrl(id, ref); | ||
const [schemaId, fragment] = splitUrl$1(resolvedUrl); | ||
delete subject[idToken]; | ||
if (fragment && idToken === anchorToken) { | ||
subject[anchorToken] = anchorToken !== idToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`; | ||
} | ||
if (schemaId !== id) { | ||
add(subject, safeResolveUrl(id, schemaId), schemaVersion); | ||
return reference.cons(ref, subject); | ||
} | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? subject["$schema"] : schemaVersion; | ||
const embeddedIdToken = getConfig(embeddedSchemaVersion, "idToken"); | ||
const embeddedAnchorToken = getConfig(embeddedSchemaVersion, "anchorToken"); | ||
if (typeof subject[embeddedIdToken] === "string" && (embeddedIdToken !== embeddedAnchorToken || subject[embeddedIdToken][0] !== "#")) { | ||
const ref = safeResolveUrl(id, subject[embeddedIdToken]); | ||
subject[embeddedIdToken] = ref; | ||
add(subject, ref, schemaVersion); | ||
return reference.cons(subject[embeddedIdToken], subject); | ||
} | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
const dynamicAnchorToken = getConfig(schemaVersion, "dynamicAnchorToken"); | ||
@@ -1203,8 +1209,3 @@ if (typeof subject[dynamicAnchorToken] === "string") { | ||
const recursiveAnchorToken = getConfig(schemaVersion, "recursiveAnchorToken"); | ||
if (pointer === jsonPointer.nil && subject[recursiveAnchorToken] === true) { | ||
recursiveAnchors["#"] = id; | ||
delete subject[recursiveAnchorToken]; | ||
} | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
if (typeof subject[anchorToken] === "string") { | ||
@@ -1211,0 +1212,0 @@ const anchor = anchorToken !== idToken ? subject[anchorToken] : subject[anchorToken].slice(1); |
@@ -1,2 +0,2 @@ | ||
System.register("JSC",[],(function(e){"use strict";return{execute:function(){var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};const v={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var b={jsonTypeOf:(e,t)=>v[t](e),splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const m=Symbol("$__value"),w=Symbol("$__href"),g=Symbol("$__isDynamic");var O=(e,t,r=!1)=>Object.freeze({[w]:e,[m]:t,[g]:r}),E=e=>e&&void 0!==e[w],$=e=>e[w],j=e=>e[m],A=e=>e[g];const{jsonTypeOf:S}=b,x=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),P=e=>E(e.value)?j(e.value):e.value,T=n((e,t)=>S(P(e),t)),I=(e,t)=>Object.freeze({...t,pointer:y.append(e,t.pointer),value:P(t)[e]}),V=n((e,t)=>P(t).map((r,n,o,i)=>e(I(n,t),n,o,i))),k=n((e,t)=>P(t).map((e,r,n,o)=>I(r,t)).filter((t,r,n,o)=>e(t,r,n,o))),z=n((e,t,r)=>P(r).reduce((t,n,o)=>e(t,I(o,r),o),t)),C=n((e,t)=>P(t).every((r,n,o,i)=>e(I(n,t),n,o,i))),K=n((e,t)=>P(t).some((r,n,o,i)=>e(I(n,t),n,o,i)));var L={cons:(e,t="")=>Object.freeze({...x,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:P,typeOf:T,step:I,entries:e=>Object.keys(P(e)).map(t=>[t,I(t,e)]),keys:e=>Object.keys(P(e)),map:V,filter:k,reduce:z,every:C,some:K,length:e=>P(e).length},q=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,R=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,_=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,U=/\\([\u000b\u0020-\u00ff])/g,W=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
System.register("JSC",[],(function(e){"use strict";return{execute:function(){var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};const v={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var b={jsonTypeOf:(e,t)=>v[t](e),splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const m=Symbol("$__value"),w=Symbol("$__href"),g=Symbol("$__isDynamic");var O=(e,t,r=!1)=>Object.freeze({[w]:e,[m]:t,[g]:r}),E=e=>e&&void 0!==e[w],$=e=>e[w],j=e=>e[m],A=e=>e[g];const{jsonTypeOf:S}=b,x=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),P=e=>E(e.value)?j(e.value):e.value,T=n((e,t)=>S(P(e),t)),I=(e,t)=>Object.freeze({...t,pointer:y.append(e,t.pointer),value:P(t)[e]}),k=n((e,t)=>P(t).map((r,n,o,i)=>e(I(n,t),n,o,i))),V=n((e,t)=>P(t).map((e,r,n,o)=>I(r,t)).filter((t,r,n,o)=>e(t,r,n,o))),z=n((e,t,r)=>P(r).reduce((t,n,o)=>e(t,I(o,r),o),t)),C=n((e,t)=>P(t).every((r,n,o,i)=>e(I(n,t),n,o,i))),K=n((e,t)=>P(t).some((r,n,o,i)=>e(I(n,t),n,o,i)));var L={cons:(e,t="")=>Object.freeze({...x,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:P,typeOf:T,step:I,entries:e=>Object.keys(P(e)).map(t=>[t,I(t,e)]),keys:e=>Object.keys(P(e)),map:k,filter:V,reduce:z,every:C,some:K,length:e=>P(e).length},q=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,R=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,_=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,U=/\\([\u000b\u0020-\u00ff])/g,W=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function D(e){var t=String(e);if(_.test(t))return t;if(t.length>0&&!R.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(W,"\\$1")+'"'}function F(e){this.parameters=Object.create(null),this.type=e}var J={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!B.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!_.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+D(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!B.test(n))throw new TypeError("invalid media type");var o=new F(n.toLowerCase());if(-1!==r){var i,a,s;for(q.lastIndex=r;a=q.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(U,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},N=async e=>Object.entries(await e),Z=n(async(e,t)=>(await t).map(e)),M=n(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),G=n(async(e,t,r={})=>M(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),H=n(async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).some(e=>e)}),Q=n(async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).every(e=>e)}),X=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Y={entries:N,map:Z,filter:G,reduce:M,some:H,every:Q,pipeline:X,all:e=>Promise.all(e),allValues:e=>X([N,M(async(e,[t,r])=>(e[t]=await r,e),{})],e)},ee=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(ne.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?te(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+re(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=re(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:te(e)}};function te(e){return e+("/"===e[e.length-1]?"":"/")}function re(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const ne=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var oe=fetch;const{jsonTypeOf:ie,splitUrl:ae}=b,se={},ce={},ue=(e,t)=>{const r=e in ce?ce[e]:e;if(r in se)return se[r][t]},le={},fe={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ae(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ue(n,"idToken"),i=ae(t)[0];if(!i&&!ae(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const a=me(i,e[o]||""),s=ae(a)[0];let c;i&&(fe[i]=s),ue(n,"vocabulary")&&ie(e,"object")&&"$vocabulary"in e?(ce[s]=n,c=e.$vocabulary,delete e.$vocabulary):c=s===n?{[n]:!0}:{};const u={},l={};le[s]={id:s,schemaVersion:n,schema:pe(e,s,n,y.nil,u,l),anchors:u,recursiveAnchors:l,vocabulary:c,validated:!1}},pe=(e,t,r,n,o,i)=>{if(ie(e,"object")){const a=ue(r,"idToken"),s=ue(r,"anchorToken");if("string"==typeof e[a]){const n=e[a],o=me(t,n),[i,c]=ae(o);if(delete e[a],c&&a===s&&(e[s]=s!==a?encodeURI(c):"#"+encodeURI(c)),i!==t)return de(e,me(t,i),r),O(n,e)}const c=ue(r,"dynamicAnchorToken");"string"==typeof e[c]&&(i["#"+e[c]]=t,e[s]=e[c],delete e[c]);const u=ue(r,"recursiveAnchorToken");if(n===y.nil&&!0===e[u]&&(i["#"]=t,delete e[u]),"string"==typeof e[s]){const t=s!==a?e[s]:e[s].slice(1);o[t]=n,delete e[s]}const l=ue(r,"jrefToken");if("string"==typeof e[l])return O(e[l],e);e=Object.entries(e).reduce((e,[a,s])=>(e[a]=pe(s,t,r,y.append(a,n),o,i),e),{});const f=ue(r,"jsrefToken");"string"==typeof e[f]&&(e[f]=O(e[f],e[f]));const d=ue(r,"dynamicJsrefToken");return"string"==typeof e[d]&&(e[d]=O(e[d],e[d],!0)),e}return Array.isArray(e)?e.map((e,a)=>pe(e,t,r,y.append(a,n),o,i)):e},he=e=>le[fe[e]]||le[e],ye=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchors:{}}),ve=async(e,t=ye,r=!1)=>{const n=r&&t.recursiveAnchors[e]?t.recursiveAnchors[e]:Oe(t),o=me(n,e),[i,a]=ae(o);if(!(e=>e in le||e in fe)(i)){const e=await oe(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=J.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),i)}const s=he(i),c=a&&"/"!==a[0]?ge(s,a):a,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:y.get(c,s.schema),recursiveAnchors:{...s.recursiveAnchors,...t.recursiveAnchors},validated:s.validated});return be(u)},be=e=>E(e.value)?ve($(e.value),e,A(e.value)):e,me=(e,t)=>{const r=ee(e,t),n=ae(e)[0];if(n&&"file"===we(r)&&"file"!==we(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},we=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ge=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Oe=e=>`${e.id}#${encodeURI(e.pointer)}`,Ee=e=>E(e.value)?j(e.value):e.value,$e=(e,t)=>{const r=he(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:y.append(e,t.pointer),schema:r.schema,value:Ee(t)[e],recursiveAnchors:t.recursiveAnchors,validated:r.validated});return be(n)},je=n((e,t)=>Y.pipeline([Ee,Y.map(async(r,n)=>e(await $e(n,t),n)),Y.all],t));var Ae={setConfig:(e,t,r)=>{se[e]||(se[e]={}),se[e][t]=r},getConfig:ue,add:de,get:ve,markValidated:e=>{le[e].validated=!0},uri:Oe,value:Ee,typeOf:(e,t)=>ie(Ee(e),t),has:(e,t)=>e in Ee(t),step:$e,keys:e=>Object.keys(Ee(e)),entries:e=>Y.pipeline([Ee,Object.keys,Y.map(async t=>[t,await $e(t,e)]),Y.all],e),map:je,length:e=>Ee(e).length};class Se extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=Se;const Pe="FLAG",Te="BASIC",Ie="DETAILED",Ve="VERBOSE";let ke=Ie,ze=!0;const Ce=(e,t)=>(n,o=Pe)=>{if(![Pe,Te,Ie,Ve].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",Ke(o,i));return Fe(t,n,e),r.unsubscribe(a),i[0]},Ke=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&Le(r[r.length-1],i);){const t=r.pop();let n=[];if(e===Te&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),qe(i))break}(e===Ve||e!==Pe&&!i.valid)&&r.push(i),t[0]=i}},Le=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||qe(e)),qe=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),Re={},_e=e=>Re[e],Ue=e=>e in Re,We={},Be={},De=async(e,t)=>{if(!Ue(e.schemaVersion+"#validate")){const t=await Ae.get(e.schemaVersion);(Ae.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in We)Object.entries(We[e]).forEach(([e,r])=>{((e,t)=>{Re[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(ze&&!e.validated){if(Ae.markValidated(e.id),!(e.schemaVersion in Be)){const t=await Ae.get(e.schemaVersion),r={},n=await De(t,r);Be[t.id]=Ce(r,n)}const t=L.cons(e.schema,e.id),r=Be[e.schemaVersion](t,ke);if(!r.valid)throw new xe(r)}return await _e(e.schemaVersion+"#validate").compile(e,t),Ae.uri(e)},Fe=(e,t,r)=>{const[n]=r[e];return _e(n).interpret(e,t,r)};var Je={validate:async(e,t,r)=>{const n={},o=await De(e,n),i=(e,t=Pe)=>Ce(n,o)(L.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{ke=e},setShouldMetaValidate:e=>{ze=e},FLAG:Pe,BASIC:Te,DETAILED:Ie,VERBOSE:Ve,getKeyword:_e,hasKeyword:Ue,defineVocabulary:(e,t)=>{We[e]=t},compileSchema:De,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return _e(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return _e(o).collectEvaluatedItems(e,t,r,n)}};var Ne={compile:async(e,t)=>{const r=Ae.uri(e);if(!(r in t)){t[r]=!1;const n=Ae.value(e);t[r]=[e.schemaVersion+"#validate",Ae.uri(e),"boolean"==typeof n?n:await Y.pipeline([Ae.entries,Y.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Y.filter(([t])=>Je.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Y.map(async([r,n])=>{const o=await Je.getKeyword(r).compile(n,t,e);return[r,Ae.uri(n),o]}),Y.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Je.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:L.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:L.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Je.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Je.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ze=e("default",{Core:Je,Schema:Ae,Instance:L,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Ne}});e("Core",Ze.Core),e("Schema",Ze.Schema),e("Instance",Ze.Instance),e("Keywords",Ze.Keywords)}}})); | ||
*/function D(e){var t=String(e);if(_.test(t))return t;if(t.length>0&&!R.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(W,"\\$1")+'"'}function F(e){this.parameters=Object.create(null),this.type=e}var J={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!B.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!_.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+D(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!B.test(n))throw new TypeError("invalid media type");var o=new F(n.toLowerCase());if(-1!==r){var i,a,s;for(q.lastIndex=r;a=q.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(U,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},N=async e=>Object.entries(await e),Z=n(async(e,t)=>(await t).map(e)),M=n(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),G=n(async(e,t,r={})=>M(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),H=n(async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).some(e=>e)}),Q=n(async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).every(e=>e)}),X=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Y={entries:N,map:Z,filter:G,reduce:M,some:H,every:Q,pipeline:X,all:e=>Promise.all(e),allValues:e=>X([N,M(async(e,[t,r])=>(e[t]=await r,e),{})],e)},ee=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(ne.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?te(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+re(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=re(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:te(e)}};function te(e){return e+("/"===e[e.length-1]?"":"/")}function re(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const ne=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var oe=fetch;const{jsonTypeOf:ie,splitUrl:ae}=b,se={},ce={},ue=(e,t)=>{const r=e in ce?ce[e]:e;if(r in se)return se[r][t]},le={},fe={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ae(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ue(n,"idToken"),i=ue(n,"anchorToken"),a=ae(t)[0];if(!a&&!ae(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=me(a,e[o]||""),[c,u]=ae(s);delete e[o],u&&o===i&&(e[i]=i!==o?encodeURI(u):"#"+encodeURI(u)),a&&(fe[a]=c);const l={},f=ue(n,"recursiveAnchorToken");let d;!0===e[f]&&(l["#"]=c,e[i]="",delete e[f]),ue(n,"vocabulary")&&ie(e,"object")&&"$vocabulary"in e?(ce[c]=n,d=e.$vocabulary,delete e.$vocabulary):d=c===n?{[n]:!0}:{};const p={};le[c]={id:c,schemaVersion:n,schema:pe(e,c,n,y.nil,p,l),anchors:p,recursiveAnchors:l,vocabulary:d,validated:!1}},pe=(e,t,r,n,o,i)=>{if(ie(e,"object")){const a="string"==typeof e.$schema?e.$schema:r,s=ue(a,"idToken"),c=ue(a,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=me(t,e[s]);return e[s]=n,de(e,n,r),O(e[s],e)}const u=ue(r,"anchorToken"),l=ue(r,"dynamicAnchorToken");"string"==typeof e[l]&&(i["#"+e[l]]=t,e[u]=e[l],delete e[l]);const f=ue(r,"idToken");if("string"==typeof e[u]){const t=u!==f?e[u]:e[u].slice(1);o[t]=n,delete e[u]}const d=ue(r,"jrefToken");if("string"==typeof e[d])return O(e[d],e);e=Object.entries(e).reduce((e,[a,s])=>(e[a]=pe(s,t,r,y.append(a,n),o,i),e),{});const p=ue(r,"jsrefToken");"string"==typeof e[p]&&(e[p]=O(e[p],e[p]));const h=ue(r,"dynamicJsrefToken");return"string"==typeof e[h]&&(e[h]=O(e[h],e[h],!0)),e}return Array.isArray(e)?e.map((e,a)=>pe(e,t,r,y.append(a,n),o,i)):e},he=e=>le[fe[e]]||le[e],ye=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchors:{}}),ve=async(e,t=ye,r=!1)=>{const n=r&&t.recursiveAnchors[e]?t.recursiveAnchors[e]:Oe(t),o=me(n,e),[i,a]=ae(o);if(!(e=>e in le||e in fe)(i)){const e=await oe(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=J.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),i)}const s=he(i),c=a&&"/"!==a[0]?ge(s,a):a,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:y.get(c,s.schema),recursiveAnchors:{...s.recursiveAnchors,...t.recursiveAnchors},validated:s.validated});return be(u)},be=e=>E(e.value)?ve($(e.value),e,A(e.value)):e,me=(e,t)=>{const r=ee(e,t),n=ae(e)[0];if(n&&"file"===we(r)&&"file"!==we(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},we=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ge=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Oe=e=>`${e.id}#${encodeURI(e.pointer)}`,Ee=e=>E(e.value)?j(e.value):e.value,$e=(e,t)=>{const r=he(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:y.append(e,t.pointer),schema:r.schema,value:Ee(t)[e],recursiveAnchors:t.recursiveAnchors,validated:r.validated});return be(n)},je=n((e,t)=>Y.pipeline([Ee,Y.map(async(r,n)=>e(await $e(n,t),n)),Y.all],t));var Ae={setConfig:(e,t,r)=>{se[e]||(se[e]={}),se[e][t]=r},getConfig:ue,add:de,get:ve,markValidated:e=>{le[e].validated=!0},uri:Oe,value:Ee,typeOf:(e,t)=>ie(Ee(e),t),has:(e,t)=>e in Ee(t),step:$e,keys:e=>Object.keys(Ee(e)),entries:e=>Y.pipeline([Ee,Object.keys,Y.map(async t=>[t,await $e(t,e)]),Y.all],e),map:je,length:e=>Ee(e).length};class Se extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=Se;const Pe="FLAG",Te="BASIC",Ie="DETAILED",ke="VERBOSE";let Ve=Ie,ze=!0;const Ce=(e,t)=>(n,o=Pe)=>{if(![Pe,Te,Ie,ke].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",Ke(o,i));return Fe(t,n,e),r.unsubscribe(a),i[0]},Ke=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&Le(r[r.length-1],i);){const t=r.pop();let n=[];if(e===Te&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),qe(i))break}(e===ke||e!==Pe&&!i.valid)&&r.push(i),t[0]=i}},Le=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||qe(e)),qe=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),Re={},_e=e=>Re[e],Ue=e=>e in Re,We={},Be={},De=async(e,t)=>{if(!Ue(e.schemaVersion+"#validate")){const t=await Ae.get(e.schemaVersion);(Ae.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in We)Object.entries(We[e]).forEach(([e,r])=>{((e,t)=>{Re[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(ze&&!e.validated){if(Ae.markValidated(e.id),!(e.schemaVersion in Be)){const t=await Ae.get(e.schemaVersion),r={},n=await De(t,r);Be[t.id]=Ce(r,n)}const t=L.cons(e.schema,e.id),r=Be[e.schemaVersion](t,Ve);if(!r.valid)throw new xe(r)}return await _e(e.schemaVersion+"#validate").compile(e,t),Ae.uri(e)},Fe=(e,t,r)=>{const[n]=r[e];return _e(n).interpret(e,t,r)};var Je={validate:async(e,t,r)=>{const n={},o=await De(e,n),i=(e,t=Pe)=>Ce(n,o)(L.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{Ve=e},setShouldMetaValidate:e=>{ze=e},FLAG:Pe,BASIC:Te,DETAILED:Ie,VERBOSE:ke,getKeyword:_e,hasKeyword:Ue,defineVocabulary:(e,t)=>{We[e]=t},compileSchema:De,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return _e(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return _e(o).collectEvaluatedItems(e,t,r,n)}};var Ne={compile:async(e,t)=>{const r=Ae.uri(e);if(!(r in t)){t[r]=!1;const n=Ae.value(e);t[r]=[e.schemaVersion+"#validate",Ae.uri(e),"boolean"==typeof n?n:await Y.pipeline([Ae.entries,Y.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Y.filter(([t])=>Je.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Y.map(async([r,n])=>{const o=await Je.getKeyword(r).compile(n,t,e);return[r,Ae.uri(n),o]}),Y.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Je.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:L.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:L.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Je.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Je.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ze=e("default",{Core:Je,Schema:Ae,Instance:L,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Ne}});e("Core",Ze.Core),e("Schema",Ze.Schema),e("Instance",Ze.Instance),e("Keywords",Ze.Keywords)}}})); | ||
//# sourceMappingURL=json-schema-core-system.min.js.map |
@@ -1136,2 +1136,3 @@ (function (global, factory) { | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
const externalId = splitUrl$1(url)[0]; | ||
@@ -1142,3 +1143,7 @@ if (!externalId && !splitUrl$1(schema[idToken] || "")[0]) { | ||
const internalUrl = safeResolveUrl(externalId, schema[idToken] || ""); | ||
const id = splitUrl$1(internalUrl)[0]; | ||
const [id, fragment] = splitUrl$1(internalUrl); | ||
delete schema[idToken]; | ||
if (fragment && idToken === anchorToken) { | ||
schema[anchorToken] = anchorToken !== idToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`; | ||
} | ||
if (externalId) { | ||
@@ -1148,2 +1153,11 @@ schemaStoreAlias[externalId] = id; | ||
// recursiveAnchor | ||
const recursiveAnchors = {}; | ||
const recursiveAnchorToken = getConfig(schemaVersion, "recursiveAnchorToken"); | ||
if (schema[recursiveAnchorToken] === true) { | ||
recursiveAnchors["#"] = id; | ||
schema[anchorToken] = ""; | ||
delete schema[recursiveAnchorToken]; | ||
} | ||
// Vocabulary | ||
@@ -1163,3 +1177,2 @@ let vocabulary; | ||
const anchors = {}; | ||
const recursiveAnchors = {}; | ||
schemaStore[id] = { | ||
@@ -1178,20 +1191,13 @@ id: id, | ||
if (jsonTypeOf$2(subject, "object")) { | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
if (typeof subject[idToken] === "string") { | ||
const ref = subject[idToken]; | ||
const resolvedUrl = safeResolveUrl(id, ref); | ||
const [schemaId, fragment] = splitUrl$1(resolvedUrl); | ||
delete subject[idToken]; | ||
if (fragment && idToken === anchorToken) { | ||
subject[anchorToken] = anchorToken !== idToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`; | ||
} | ||
if (schemaId !== id) { | ||
add(subject, safeResolveUrl(id, schemaId), schemaVersion); | ||
return reference.cons(ref, subject); | ||
} | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? subject["$schema"] : schemaVersion; | ||
const embeddedIdToken = getConfig(embeddedSchemaVersion, "idToken"); | ||
const embeddedAnchorToken = getConfig(embeddedSchemaVersion, "anchorToken"); | ||
if (typeof subject[embeddedIdToken] === "string" && (embeddedIdToken !== embeddedAnchorToken || subject[embeddedIdToken][0] !== "#")) { | ||
const ref = safeResolveUrl(id, subject[embeddedIdToken]); | ||
subject[embeddedIdToken] = ref; | ||
add(subject, ref, schemaVersion); | ||
return reference.cons(subject[embeddedIdToken], subject); | ||
} | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
const dynamicAnchorToken = getConfig(schemaVersion, "dynamicAnchorToken"); | ||
@@ -1204,8 +1210,3 @@ if (typeof subject[dynamicAnchorToken] === "string") { | ||
const recursiveAnchorToken = getConfig(schemaVersion, "recursiveAnchorToken"); | ||
if (pointer === jsonPointer.nil && subject[recursiveAnchorToken] === true) { | ||
recursiveAnchors["#"] = id; | ||
delete subject[recursiveAnchorToken]; | ||
} | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
if (typeof subject[anchorToken] === "string") { | ||
@@ -1212,0 +1213,0 @@ const anchor = anchorToken !== idToken ? subject[anchorToken] : subject[anchorToken].slice(1); |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).JSC={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};const v={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var b={jsonTypeOf:(e,t)=>v[t](e),splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const m=Symbol("$__value"),w=Symbol("$__href"),g=Symbol("$__isDynamic");var O=(e,t,r=!1)=>Object.freeze({[w]:e,[m]:t,[g]:r}),E=e=>e&&void 0!==e[w],j=e=>e[w],$=e=>e[m],x=e=>e[g];const{jsonTypeOf:A}=b,P=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),S=e=>E(e.value)?$(e.value):e.value,T=n((e,t)=>A(S(e),t)),I=(e,t)=>Object.freeze({...t,pointer:y.append(e,t.pointer),value:S(t)[e]}),V=n((e,t)=>S(t).map((r,n,o,i)=>e(I(n,t),n,o,i))),k=n((e,t)=>S(t).map((e,r,n,o)=>I(r,t)).filter((t,r,n,o)=>e(t,r,n,o))),z=n((e,t,r)=>S(r).reduce((t,n,o)=>e(t,I(o,r),o),t)),C=n((e,t)=>S(t).every((r,n,o,i)=>e(I(n,t),n,o,i))),K=n((e,t)=>S(t).some((r,n,o,i)=>e(I(n,t),n,o,i)));var L={cons:(e,t="")=>Object.freeze({...P,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:S,typeOf:T,step:I,entries:e=>Object.keys(S(e)).map(t=>[t,I(t,e)]),keys:e=>Object.keys(S(e)),map:V,filter:k,reduce:z,every:C,some:K,length:e=>S(e).length},_=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,q=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,U=/\\([\u000b\u0020-\u00ff])/g,W=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).JSC={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};const v={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var b={jsonTypeOf:(e,t)=>v[t](e),splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const m=Symbol("$__value"),w=Symbol("$__href"),g=Symbol("$__isDynamic");var O=(e,t,r=!1)=>Object.freeze({[w]:e,[m]:t,[g]:r}),E=e=>e&&void 0!==e[w],$=e=>e[w],j=e=>e[m],x=e=>e[g];const{jsonTypeOf:A}=b,P=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),S=e=>E(e.value)?j(e.value):e.value,T=n((e,t)=>A(S(e),t)),I=(e,t)=>Object.freeze({...t,pointer:y.append(e,t.pointer),value:S(t)[e]}),k=n((e,t)=>S(t).map((r,n,o,i)=>e(I(n,t),n,o,i))),V=n((e,t)=>S(t).map((e,r,n,o)=>I(r,t)).filter((t,r,n,o)=>e(t,r,n,o))),z=n((e,t,r)=>S(r).reduce((t,n,o)=>e(t,I(o,r),o),t)),C=n((e,t)=>S(t).every((r,n,o,i)=>e(I(n,t),n,o,i))),K=n((e,t)=>S(t).some((r,n,o,i)=>e(I(n,t),n,o,i)));var L={cons:(e,t="")=>Object.freeze({...P,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:S,typeOf:T,step:I,entries:e=>Object.keys(S(e)).map(t=>[t,I(t,e)]),keys:e=>Object.keys(S(e)),map:k,filter:V,reduce:z,every:C,some:K,length:e=>S(e).length},_=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,q=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,U=/\\([\u000b\u0020-\u00ff])/g,W=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function D(e){var t=String(e);if(R.test(t))return t;if(t.length>0&&!q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(W,"\\$1")+'"'}function F(e){this.parameters=Object.create(null),this.type=e}var J={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!B.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!R.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+D(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!B.test(n))throw new TypeError("invalid media type");var o=new F(n.toLowerCase());if(-1!==r){var i,a,s;for(_.lastIndex=r;a=_.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(U,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},M=async e=>Object.entries(await e),N=n(async(e,t)=>(await t).map(e)),Z=n(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),G=n(async(e,t,r={})=>Z(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),H=n(async(e,t)=>{const r=await N(e,t);return(await Promise.all(r)).some(e=>e)}),Q=n(async(e,t)=>{const r=await N(e,t);return(await Promise.all(r)).every(e=>e)}),X=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Y={entries:M,map:N,filter:G,reduce:Z,some:H,every:Q,pipeline:X,all:e=>Promise.all(e),allValues:e=>X([M,Z(async(e,[t,r])=>(e[t]=await r,e),{})],e)},ee=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(ne.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?te(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+re(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=re(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:te(e)}};function te(e){return e+("/"===e[e.length-1]?"":"/")}function re(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const ne=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var oe=fetch;const{jsonTypeOf:ie,splitUrl:ae}=b,se={},ce={},ue=(e,t)=>{const r=e in ce?ce[e]:e;if(r in se)return se[r][t]},le={},fe={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ae(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ue(n,"idToken"),i=ae(t)[0];if(!i&&!ae(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const a=me(i,e[o]||""),s=ae(a)[0];let c;i&&(fe[i]=s),ue(n,"vocabulary")&&ie(e,"object")&&"$vocabulary"in e?(ce[s]=n,c=e.$vocabulary,delete e.$vocabulary):c=s===n?{[n]:!0}:{};const u={},l={};le[s]={id:s,schemaVersion:n,schema:pe(e,s,n,y.nil,u,l),anchors:u,recursiveAnchors:l,vocabulary:c,validated:!1}},pe=(e,t,r,n,o,i)=>{if(ie(e,"object")){const a=ue(r,"idToken"),s=ue(r,"anchorToken");if("string"==typeof e[a]){const n=e[a],o=me(t,n),[i,c]=ae(o);if(delete e[a],c&&a===s&&(e[s]=s!==a?encodeURI(c):"#"+encodeURI(c)),i!==t)return de(e,me(t,i),r),O(n,e)}const c=ue(r,"dynamicAnchorToken");"string"==typeof e[c]&&(i["#"+e[c]]=t,e[s]=e[c],delete e[c]);const u=ue(r,"recursiveAnchorToken");if(n===y.nil&&!0===e[u]&&(i["#"]=t,delete e[u]),"string"==typeof e[s]){const t=s!==a?e[s]:e[s].slice(1);o[t]=n,delete e[s]}const l=ue(r,"jrefToken");if("string"==typeof e[l])return O(e[l],e);e=Object.entries(e).reduce((e,[a,s])=>(e[a]=pe(s,t,r,y.append(a,n),o,i),e),{});const f=ue(r,"jsrefToken");"string"==typeof e[f]&&(e[f]=O(e[f],e[f]));const d=ue(r,"dynamicJsrefToken");return"string"==typeof e[d]&&(e[d]=O(e[d],e[d],!0)),e}return Array.isArray(e)?e.map((e,a)=>pe(e,t,r,y.append(a,n),o,i)):e},he=e=>le[fe[e]]||le[e],ye=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchors:{}}),ve=async(e,t=ye,r=!1)=>{const n=r&&t.recursiveAnchors[e]?t.recursiveAnchors[e]:Oe(t),o=me(n,e),[i,a]=ae(o);if(!(e=>e in le||e in fe)(i)){const e=await oe(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=J.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),i)}const s=he(i),c=a&&"/"!==a[0]?ge(s,a):a,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:y.get(c,s.schema),recursiveAnchors:{...s.recursiveAnchors,...t.recursiveAnchors},validated:s.validated});return be(u)},be=e=>E(e.value)?ve(j(e.value),e,x(e.value)):e,me=(e,t)=>{const r=ee(e,t),n=ae(e)[0];if(n&&"file"===we(r)&&"file"!==we(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},we=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ge=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Oe=e=>`${e.id}#${encodeURI(e.pointer)}`,Ee=e=>E(e.value)?$(e.value):e.value,je=(e,t)=>{const r=he(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:y.append(e,t.pointer),schema:r.schema,value:Ee(t)[e],recursiveAnchors:t.recursiveAnchors,validated:r.validated});return be(n)},$e=n((e,t)=>Y.pipeline([Ee,Y.map(async(r,n)=>e(await je(n,t),n)),Y.all],t));var xe={setConfig:(e,t,r)=>{se[e]||(se[e]={}),se[e][t]=r},getConfig:ue,add:de,get:ve,markValidated:e=>{le[e].validated=!0},uri:Oe,value:Ee,typeOf:(e,t)=>ie(Ee(e),t),has:(e,t)=>e in Ee(t),step:je,keys:e=>Object.keys(Ee(e)),entries:e=>Y.pipeline([Ee,Object.keys,Y.map(async t=>[t,await je(t,e)]),Y.all],e),map:$e,length:e=>Ee(e).length};class Ae extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Pe=Ae;const Se="FLAG",Te="BASIC",Ie="DETAILED",Ve="VERBOSE";let ke=Ie,ze=!0;const Ce=(e,t)=>(n,o=Se)=>{if(![Se,Te,Ie,Ve].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",Ke(o,i));return Fe(t,n,e),r.unsubscribe(a),i[0]},Ke=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&Le(r[r.length-1],i);){const t=r.pop();let n=[];if(e===Te&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),_e(i))break}(e===Ve||e!==Se&&!i.valid)&&r.push(i),t[0]=i}},Le=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||_e(e)),_e=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),qe={},Re=e=>qe[e],Ue=e=>e in qe,We={},Be={},De=async(e,t)=>{if(!Ue(e.schemaVersion+"#validate")){const t=await xe.get(e.schemaVersion);(xe.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in We)Object.entries(We[e]).forEach(([e,r])=>{((e,t)=>{qe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(ze&&!e.validated){if(xe.markValidated(e.id),!(e.schemaVersion in Be)){const t=await xe.get(e.schemaVersion),r={},n=await De(t,r);Be[t.id]=Ce(r,n)}const t=L.cons(e.schema,e.id),r=Be[e.schemaVersion](t,ke);if(!r.valid)throw new Pe(r)}return await Re(e.schemaVersion+"#validate").compile(e,t),xe.uri(e)},Fe=(e,t,r)=>{const[n]=r[e];return Re(n).interpret(e,t,r)};var Je={validate:async(e,t,r)=>{const n={},o=await De(e,n),i=(e,t=Se)=>Ce(n,o)(L.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{ke=e},setShouldMetaValidate:e=>{ze=e},FLAG:Se,BASIC:Te,DETAILED:Ie,VERBOSE:Ve,getKeyword:Re,hasKeyword:Ue,defineVocabulary:(e,t)=>{We[e]=t},compileSchema:De,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Re(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Re(o).collectEvaluatedItems(e,t,r,n)}};var Me={compile:async(e,t)=>{const r=xe.uri(e);if(!(r in t)){t[r]=!1;const n=xe.value(e);t[r]=[e.schemaVersion+"#validate",xe.uri(e),"boolean"==typeof n?n:await Y.pipeline([xe.entries,Y.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Y.filter(([t])=>Je.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Y.map(async([r,n])=>{const o=await Je.getKeyword(r).compile(n,t,e);return[r,xe.uri(n),o]}),Y.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Je.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:L.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:L.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Je.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Je.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ne={Core:Je,Schema:xe,Instance:L,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Me}},Ze=Ne.Core,Ge=Ne.Schema,He=Ne.Instance,Qe=Ne.Keywords;e.Core=Ze,e.Instance=He,e.Keywords=Qe,e.Schema=Ge,e.default=Ne,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
*/function D(e){var t=String(e);if(R.test(t))return t;if(t.length>0&&!q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(W,"\\$1")+'"'}function F(e){this.parameters=Object.create(null),this.type=e}var J={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!B.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!R.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+D(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!B.test(n))throw new TypeError("invalid media type");var o=new F(n.toLowerCase());if(-1!==r){var i,a,s;for(_.lastIndex=r;a=_.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(U,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},M=async e=>Object.entries(await e),N=n(async(e,t)=>(await t).map(e)),Z=n(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),G=n(async(e,t,r={})=>Z(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),H=n(async(e,t)=>{const r=await N(e,t);return(await Promise.all(r)).some(e=>e)}),Q=n(async(e,t)=>{const r=await N(e,t);return(await Promise.all(r)).every(e=>e)}),X=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Y={entries:M,map:N,filter:G,reduce:Z,some:H,every:Q,pipeline:X,all:e=>Promise.all(e),allValues:e=>X([M,Z(async(e,[t,r])=>(e[t]=await r,e),{})],e)},ee=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(ne.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?te(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+re(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=re(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:te(e)}};function te(e){return e+("/"===e[e.length-1]?"":"/")}function re(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const ne=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var oe=fetch;const{jsonTypeOf:ie,splitUrl:ae}=b,se={},ce={},ue=(e,t)=>{const r=e in ce?ce[e]:e;if(r in se)return se[r][t]},le={},fe={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ae(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ue(n,"idToken"),i=ue(n,"anchorToken"),a=ae(t)[0];if(!a&&!ae(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=me(a,e[o]||""),[c,u]=ae(s);delete e[o],u&&o===i&&(e[i]=i!==o?encodeURI(u):"#"+encodeURI(u)),a&&(fe[a]=c);const l={},f=ue(n,"recursiveAnchorToken");let d;!0===e[f]&&(l["#"]=c,e[i]="",delete e[f]),ue(n,"vocabulary")&&ie(e,"object")&&"$vocabulary"in e?(ce[c]=n,d=e.$vocabulary,delete e.$vocabulary):d=c===n?{[n]:!0}:{};const p={};le[c]={id:c,schemaVersion:n,schema:pe(e,c,n,y.nil,p,l),anchors:p,recursiveAnchors:l,vocabulary:d,validated:!1}},pe=(e,t,r,n,o,i)=>{if(ie(e,"object")){const a="string"==typeof e.$schema?e.$schema:r,s=ue(a,"idToken"),c=ue(a,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=me(t,e[s]);return e[s]=n,de(e,n,r),O(e[s],e)}const u=ue(r,"anchorToken"),l=ue(r,"dynamicAnchorToken");"string"==typeof e[l]&&(i["#"+e[l]]=t,e[u]=e[l],delete e[l]);const f=ue(r,"idToken");if("string"==typeof e[u]){const t=u!==f?e[u]:e[u].slice(1);o[t]=n,delete e[u]}const d=ue(r,"jrefToken");if("string"==typeof e[d])return O(e[d],e);e=Object.entries(e).reduce((e,[a,s])=>(e[a]=pe(s,t,r,y.append(a,n),o,i),e),{});const p=ue(r,"jsrefToken");"string"==typeof e[p]&&(e[p]=O(e[p],e[p]));const h=ue(r,"dynamicJsrefToken");return"string"==typeof e[h]&&(e[h]=O(e[h],e[h],!0)),e}return Array.isArray(e)?e.map((e,a)=>pe(e,t,r,y.append(a,n),o,i)):e},he=e=>le[fe[e]]||le[e],ye=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchors:{}}),ve=async(e,t=ye,r=!1)=>{const n=r&&t.recursiveAnchors[e]?t.recursiveAnchors[e]:Oe(t),o=me(n,e),[i,a]=ae(o);if(!(e=>e in le||e in fe)(i)){const e=await oe(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=J.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),i)}const s=he(i),c=a&&"/"!==a[0]?ge(s,a):a,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:y.get(c,s.schema),recursiveAnchors:{...s.recursiveAnchors,...t.recursiveAnchors},validated:s.validated});return be(u)},be=e=>E(e.value)?ve($(e.value),e,x(e.value)):e,me=(e,t)=>{const r=ee(e,t),n=ae(e)[0];if(n&&"file"===we(r)&&"file"!==we(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},we=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ge=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Oe=e=>`${e.id}#${encodeURI(e.pointer)}`,Ee=e=>E(e.value)?j(e.value):e.value,$e=(e,t)=>{const r=he(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:y.append(e,t.pointer),schema:r.schema,value:Ee(t)[e],recursiveAnchors:t.recursiveAnchors,validated:r.validated});return be(n)},je=n((e,t)=>Y.pipeline([Ee,Y.map(async(r,n)=>e(await $e(n,t),n)),Y.all],t));var xe={setConfig:(e,t,r)=>{se[e]||(se[e]={}),se[e][t]=r},getConfig:ue,add:de,get:ve,markValidated:e=>{le[e].validated=!0},uri:Oe,value:Ee,typeOf:(e,t)=>ie(Ee(e),t),has:(e,t)=>e in Ee(t),step:$e,keys:e=>Object.keys(Ee(e)),entries:e=>Y.pipeline([Ee,Object.keys,Y.map(async t=>[t,await $e(t,e)]),Y.all],e),map:je,length:e=>Ee(e).length};class Ae extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Pe=Ae;const Se="FLAG",Te="BASIC",Ie="DETAILED",ke="VERBOSE";let Ve=Ie,ze=!0;const Ce=(e,t)=>(n,o=Se)=>{if(![Se,Te,Ie,ke].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",Ke(o,i));return Fe(t,n,e),r.unsubscribe(a),i[0]},Ke=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&Le(r[r.length-1],i);){const t=r.pop();let n=[];if(e===Te&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),_e(i))break}(e===ke||e!==Se&&!i.valid)&&r.push(i),t[0]=i}},Le=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||_e(e)),_e=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),qe={},Re=e=>qe[e],Ue=e=>e in qe,We={},Be={},De=async(e,t)=>{if(!Ue(e.schemaVersion+"#validate")){const t=await xe.get(e.schemaVersion);(xe.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in We)Object.entries(We[e]).forEach(([e,r])=>{((e,t)=>{qe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(ze&&!e.validated){if(xe.markValidated(e.id),!(e.schemaVersion in Be)){const t=await xe.get(e.schemaVersion),r={},n=await De(t,r);Be[t.id]=Ce(r,n)}const t=L.cons(e.schema,e.id),r=Be[e.schemaVersion](t,Ve);if(!r.valid)throw new Pe(r)}return await Re(e.schemaVersion+"#validate").compile(e,t),xe.uri(e)},Fe=(e,t,r)=>{const[n]=r[e];return Re(n).interpret(e,t,r)};var Je={validate:async(e,t,r)=>{const n={},o=await De(e,n),i=(e,t=Se)=>Ce(n,o)(L.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{Ve=e},setShouldMetaValidate:e=>{ze=e},FLAG:Se,BASIC:Te,DETAILED:Ie,VERBOSE:ke,getKeyword:Re,hasKeyword:Ue,defineVocabulary:(e,t)=>{We[e]=t},compileSchema:De,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Re(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Re(o).collectEvaluatedItems(e,t,r,n)}};var Me={compile:async(e,t)=>{const r=xe.uri(e);if(!(r in t)){t[r]=!1;const n=xe.value(e);t[r]=[e.schemaVersion+"#validate",xe.uri(e),"boolean"==typeof n?n:await Y.pipeline([xe.entries,Y.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Y.filter(([t])=>Je.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Y.map(async([r,n])=>{const o=await Je.getKeyword(r).compile(n,t,e);return[r,xe.uri(n),o]}),Y.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Je.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:L.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:L.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Je.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Je.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ne={Core:Je,Schema:xe,Instance:L,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Me}},Ze=Ne.Core,Ge=Ne.Schema,He=Ne.Instance,Qe=Ne.Keywords;e.Core=Ze,e.Instance=He,e.Keywords=Qe,e.Schema=Ge,e.default=Ne,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-umd.min.js.map |
@@ -45,2 +45,3 @@ const contentTypeParser = require("content-type"); | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
const externalId = splitUrl(url)[0]; | ||
@@ -51,3 +52,7 @@ if (!externalId && !splitUrl(schema[idToken] || "")[0]) { | ||
const internalUrl = safeResolveUrl(externalId, schema[idToken] || ""); | ||
const id = splitUrl(internalUrl)[0]; | ||
const [id, fragment] = splitUrl(internalUrl); | ||
delete schema[idToken]; | ||
if (fragment && idToken === anchorToken) { | ||
schema[anchorToken] = anchorToken !== idToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`; | ||
} | ||
if (externalId) { | ||
@@ -57,2 +62,11 @@ schemaStoreAlias[externalId] = id; | ||
// recursiveAnchor | ||
const recursiveAnchors = {}; | ||
const recursiveAnchorToken = getConfig(schemaVersion, "recursiveAnchorToken"); | ||
if (schema[recursiveAnchorToken] === true) { | ||
recursiveAnchors["#"] = id; | ||
schema[anchorToken] = ""; | ||
delete schema[recursiveAnchorToken]; | ||
} | ||
// Vocabulary | ||
@@ -72,3 +86,2 @@ let vocabulary; | ||
const anchors = {}; | ||
const recursiveAnchors = {}; | ||
schemaStore[id] = { | ||
@@ -87,20 +100,13 @@ id: id, | ||
if (jsonTypeOf(subject, "object")) { | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
if (typeof subject[idToken] === "string") { | ||
const ref = subject[idToken]; | ||
const resolvedUrl = safeResolveUrl(id, ref); | ||
const [schemaId, fragment] = splitUrl(resolvedUrl); | ||
delete subject[idToken]; | ||
if (fragment && idToken === anchorToken) { | ||
subject[anchorToken] = anchorToken !== idToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`; | ||
} | ||
if (schemaId !== id) { | ||
add(subject, safeResolveUrl(id, schemaId), schemaVersion); | ||
return Reference.cons(ref, subject); | ||
} | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? subject["$schema"] : schemaVersion; | ||
const embeddedIdToken = getConfig(embeddedSchemaVersion, "idToken"); | ||
const embeddedAnchorToken = getConfig(embeddedSchemaVersion, "anchorToken"); | ||
if (typeof subject[embeddedIdToken] === "string" && (embeddedIdToken !== embeddedAnchorToken || subject[embeddedIdToken][0] !== "#")) { | ||
const ref = safeResolveUrl(id, subject[embeddedIdToken]); | ||
subject[embeddedIdToken] = ref; | ||
add(subject, ref, schemaVersion); | ||
return Reference.cons(subject[embeddedIdToken], subject); | ||
} | ||
const anchorToken = getConfig(schemaVersion, "anchorToken"); | ||
const dynamicAnchorToken = getConfig(schemaVersion, "dynamicAnchorToken"); | ||
@@ -113,8 +119,3 @@ if (typeof subject[dynamicAnchorToken] === "string") { | ||
const recursiveAnchorToken = getConfig(schemaVersion, "recursiveAnchorToken"); | ||
if (pointer === JsonPointer.nil && subject[recursiveAnchorToken] === true) { | ||
recursiveAnchors["#"] = id; | ||
delete subject[recursiveAnchorToken]; | ||
} | ||
const idToken = getConfig(schemaVersion, "idToken"); | ||
if (typeof subject[anchorToken] === "string") { | ||
@@ -121,0 +122,0 @@ const anchor = anchorToken !== idToken ? subject[anchorToken] : subject[anchorToken].slice(1); |
{ | ||
"name": "@hyperjump/json-schema-core", | ||
"version": "0.13.1", | ||
"version": "0.13.2", | ||
"description": "A framework for building JSON Schema tools", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1582936
9013