@hyperjump/json-schema-core
Advanced tools
Comparing version 0.13.2 to 0.13.3
@@ -1183,3 +1183,3 @@ define(['exports'], function (exports) { 'use strict'; | ||
if (jsonTypeOf$2(subject, "object")) { | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? subject["$schema"] : schemaVersion; | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? splitUrl$1(subject["$schema"])[0] : schemaVersion; | ||
const embeddedIdToken = getConfig(embeddedSchemaVersion, "idToken"); | ||
@@ -1403,8 +1403,5 @@ const embeddedAnchorToken = getConfig(embeddedSchemaVersion, "anchorToken"); | ||
result.errors.unshift(topResult, ...errors); | ||
if (isRef(result)) { | ||
break; | ||
} | ||
} | ||
if (outputFormat === VERBOSE || outputFormat !== FLAG && !result.valid) { | ||
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !result.valid)) { | ||
resultStack.push(result); | ||
@@ -1418,9 +1415,6 @@ } | ||
const isChild = (topResult, nextResult) => { | ||
return topResult.instanceLocation.startsWith(nextResult.instanceLocation) | ||
&& (topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation) | ||
|| isRef(topResult)); | ||
return topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation) | ||
|| nextResult.keyword.endsWith("#validate") && topResult.instanceLocation === nextResult.instanceLocation; | ||
}; | ||
const isRef = (result) => result.keyword.endsWith("#$ref") || result.keyword.endsWith("#$recursiveRef"); | ||
const setMetaOutputFormat = (format) => { | ||
@@ -1427,0 +1421,0 @@ metaOutputFormat = format; |
@@ -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]}),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-]+$/; | ||
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,B=/([\\"])/g,D=/^[!#$%&'*+.^_`|~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=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})})); | ||
*/function W(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(B,"\\$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||!D.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+"="+W(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(!D.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?ae(e.$schema)[0]: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",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 We(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=[];e===Te&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n)}(e===Ve||e!==Se&&!i.valid)&&r.push(i),t[0]=i}},_e=(e,t)=>e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||t.keyword.endsWith("#validate")&&e.instanceLocation===t.instanceLocation,Ce={},qe=e=>Ce[e],Re=e=>e in Ce,Ue={},Be={},De=async(e,t)=>{if(!Re(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 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(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 qe(e.schemaVersion+"#validate").compile(e,t),Ae.uri(e)},We=(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 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:qe,hasKeyword:Re,defineVocabulary:(e,t)=>{Ue[e]=t},compileSchema:De,interpretSchema:We,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=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])=>Fe.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Y.map(async([r,n])=>{const o=await Fe.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=Fe.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&&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:Ae,Instance:_,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Me}},Ze=Ne.Core,Je=Ne.Schema,Ge=Ne.Instance,He=Ne.Keywords;e.Core=Ze,e.Instance=Ge,e.Keywords=He,e.Schema=Je,e.default=Ne,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-amd.min.js.map |
@@ -1185,3 +1185,3 @@ 'use strict'; | ||
if (jsonTypeOf$2(subject, "object")) { | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? subject["$schema"] : schemaVersion; | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? splitUrl$1(subject["$schema"])[0] : schemaVersion; | ||
const embeddedIdToken = getConfig(embeddedSchemaVersion, "idToken"); | ||
@@ -1405,8 +1405,5 @@ const embeddedAnchorToken = getConfig(embeddedSchemaVersion, "anchorToken"); | ||
result.errors.unshift(topResult, ...errors); | ||
if (isRef(result)) { | ||
break; | ||
} | ||
} | ||
if (outputFormat === VERBOSE || outputFormat !== FLAG && !result.valid) { | ||
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !result.valid)) { | ||
resultStack.push(result); | ||
@@ -1420,9 +1417,6 @@ } | ||
const isChild = (topResult, nextResult) => { | ||
return topResult.instanceLocation.startsWith(nextResult.instanceLocation) | ||
&& (topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation) | ||
|| isRef(topResult)); | ||
return topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation) | ||
|| nextResult.keyword.endsWith("#validate") && topResult.instanceLocation === nextResult.instanceLocation; | ||
}; | ||
const isRef = (result) => result.keyword.endsWith("#$ref") || result.keyword.endsWith("#$recursiveRef"); | ||
const setMetaOutputFormat = (format) => { | ||
@@ -1429,0 +1423,0 @@ metaOutputFormat = format; |
@@ -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))),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-]+$/; | ||
"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,B=/^[!#$%&'*+.^_`|~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=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; | ||
*/function D(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 W(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||!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],!q.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 W(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?ie(e.$schema)[0]: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 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=[];e===Se&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n)}(e===Ie||e!==Pe&&!i.valid)&&r.push(i),t[0]=i}},Le=(e,t)=>e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||t.keyword.endsWith("#validate")&&e.instanceLocation===t.instanceLocation,_e={},Ce=e=>_e[e],qe=e=>e in _e,Re={},Ue={},Be=async(e,t)=>{if(!qe(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 Re)Object.entries(Re[e]).forEach(([e,r])=>{((e,t)=>{_e[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 Ue)){const t=await je.get(e.schemaVersion),r={},n=await Be(t,r);Ue[t.id]=ze(r,n)}const t=L.cons(e.schema,e.id),r=Ue[e.schemaVersion](t,Ve);if(!r.valid)throw new Ae(r)}return await Ce(e.schemaVersion+"#validate").compile(e,t),je.uri(e)},De=(e,t,r)=>{const[n]=r[e];return Ce(n).interpret(e,t,r)};var We={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:Ce,hasKeyword:qe,defineVocabulary:(e,t)=>{Re[e]=t},compileSchema:Be,interpretSchema:De,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Ce(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Ce(o).collectEvaluatedItems(e,t,r,n)}};var Fe={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])=>We.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),X.map(async([r,n])=>{const o=await We.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=We.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&&We.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&&We.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Me={Core:We,Schema:je,Instance:L,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Fe}},Ne=Me.Core,Ze=Me.Schema,Je=Me.Instance,Ge=Me.Keywords;exports.Core=Ne,exports.Instance=Je,exports.Keywords=Ge,exports.Schema=Ze,exports.default=Me; | ||
//# sourceMappingURL=json-schema-core-cjs.min.js.map |
@@ -1181,3 +1181,3 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
if (jsonTypeOf$2(subject, "object")) { | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? subject["$schema"] : schemaVersion; | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? splitUrl$1(subject["$schema"])[0] : schemaVersion; | ||
const embeddedIdToken = getConfig(embeddedSchemaVersion, "idToken"); | ||
@@ -1401,8 +1401,5 @@ const embeddedAnchorToken = getConfig(embeddedSchemaVersion, "anchorToken"); | ||
result.errors.unshift(topResult, ...errors); | ||
if (isRef(result)) { | ||
break; | ||
} | ||
} | ||
if (outputFormat === VERBOSE || outputFormat !== FLAG && !result.valid) { | ||
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !result.valid)) { | ||
resultStack.push(result); | ||
@@ -1416,9 +1413,6 @@ } | ||
const isChild = (topResult, nextResult) => { | ||
return topResult.instanceLocation.startsWith(nextResult.instanceLocation) | ||
&& (topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation) | ||
|| isRef(topResult)); | ||
return topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation) | ||
|| nextResult.keyword.endsWith("#validate") && topResult.instanceLocation === nextResult.instanceLocation; | ||
}; | ||
const isRef = (result) => result.keyword.endsWith("#$ref") || result.keyword.endsWith("#$recursiveRef"); | ||
const setMetaOutputFormat = (format) => { | ||
@@ -1425,0 +1419,0 @@ metaOutputFormat = format; |
@@ -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))),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-]+$/; | ||
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]+$/,_=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,R=/\\([\u000b\u0020-\u00ff])/g,U=/([\\"])/g,B=/^[!#$%&'*+.^_`|~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=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}; | ||
*/function D(e){var t=String(e);if(_.test(t))return t;if(t.length>0&&!q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(U,"\\$1")+'"'}function W(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||!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 W(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(R,"$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?ie(e.$schema)[0]: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 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=[];e===Se&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n)}(e===Ie||e!==Pe&&!i.valid)&&r.push(i),t[0]=i}},Le=(e,t)=>e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||t.keyword.endsWith("#validate")&&e.instanceLocation===t.instanceLocation,Ce={},qe=e=>Ce[e],_e=e=>e in Ce,Re={},Ue={},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 Re)Object.entries(Re[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 Ue)){const t=await je.get(e.schemaVersion),r={},n=await Be(t,r);Ue[t.id]=ze(r,n)}const t=L.cons(e.schema,e.id),r=Ue[e.schemaVersion](t,Ve);if(!r.valid)throw new xe(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 We={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:_e,defineVocabulary:(e,t)=>{Re[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 Fe={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])=>We.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),X.map(async([r,n])=>{const o=await We.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=We.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&&We.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&&We.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ne={Core:We,Schema:je,Instance:L,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Fe}},Ze=Ne.Core,Je=Ne.Schema,Me=Ne.Instance,Ge=Ne.Keywords;export default Ne;export{Ze as Core,Me as Instance,Ge as Keywords,Je as Schema}; | ||
//# sourceMappingURL=json-schema-core-esm.min.js.map |
@@ -1184,3 +1184,3 @@ var JSC = (function (exports) { | ||
if (jsonTypeOf$2(subject, "object")) { | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? subject["$schema"] : schemaVersion; | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? splitUrl$1(subject["$schema"])[0] : schemaVersion; | ||
const embeddedIdToken = getConfig(embeddedSchemaVersion, "idToken"); | ||
@@ -1404,8 +1404,5 @@ const embeddedAnchorToken = getConfig(embeddedSchemaVersion, "anchorToken"); | ||
result.errors.unshift(topResult, ...errors); | ||
if (isRef(result)) { | ||
break; | ||
} | ||
} | ||
if (outputFormat === VERBOSE || outputFormat !== FLAG && !result.valid) { | ||
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !result.valid)) { | ||
resultStack.push(result); | ||
@@ -1419,9 +1416,6 @@ } | ||
const isChild = (topResult, nextResult) => { | ||
return topResult.instanceLocation.startsWith(nextResult.instanceLocation) | ||
&& (topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation) | ||
|| isRef(topResult)); | ||
return topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation) | ||
|| nextResult.keyword.endsWith("#validate") && topResult.instanceLocation === nextResult.instanceLocation; | ||
}; | ||
const isRef = (result) => result.keyword.endsWith("#$ref") || result.keyword.endsWith("#$recursiveRef"); | ||
const setMetaOutputFormat = (format) => { | ||
@@ -1428,0 +1422,0 @@ metaOutputFormat = format; |
@@ -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]}),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-]+$/; | ||
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,_=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,U=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,D=/^[!#$%&'*+.^_`|~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=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}({}); | ||
*/function W(e){var t=String(e);if(R.test(t))return t;if(t.length>0&&!_.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(B,"\\$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||!D.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+"="+W(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(!D.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?ae(e.$schema)[0]: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",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 We(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=[];e===Te&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n)}(e===Ve||e!==xe&&!i.valid)&&r.push(i),t[0]=i}},Le=(e,t)=>e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||t.keyword.endsWith("#validate")&&e.instanceLocation===t.instanceLocation,qe={},_e=e=>qe[e],Re=e=>e in qe,Ue={},Be={},De=async(e,t)=>{if(!Re(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 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(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)},We=(e,t,r)=>{const[n]=r[e];return _e(n).interpret(e,t,r)};var Fe={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:Re,defineVocabulary:(e,t)=>{Ue[e]=t},compileSchema:De,interpretSchema:We,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 Je={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])=>Fe.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Y.map(async([r,n])=>{const o=await Fe.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=Fe.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&&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:Ae,Instance:L,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Je}},Ze=Ne.Core,Me=Ne.Schema,Ge=Ne.Instance,He=Ne.Keywords;return e.Core=Ze,e.Instance=Ge,e.Keywords=He,e.Schema=Me,e.default=Ne,e}({}); | ||
//# sourceMappingURL=json-schema-core-iife.min.js.map |
@@ -1186,3 +1186,3 @@ System.register('JSC', [], function (exports) { | ||
if (jsonTypeOf$2(subject, "object")) { | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? subject["$schema"] : schemaVersion; | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? splitUrl$1(subject["$schema"])[0] : schemaVersion; | ||
const embeddedIdToken = getConfig(embeddedSchemaVersion, "idToken"); | ||
@@ -1406,8 +1406,5 @@ const embeddedAnchorToken = getConfig(embeddedSchemaVersion, "anchorToken"); | ||
result.errors.unshift(topResult, ...errors); | ||
if (isRef(result)) { | ||
break; | ||
} | ||
} | ||
if (outputFormat === VERBOSE || outputFormat !== FLAG && !result.valid) { | ||
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !result.valid)) { | ||
resultStack.push(result); | ||
@@ -1421,9 +1418,6 @@ } | ||
const isChild = (topResult, nextResult) => { | ||
return topResult.instanceLocation.startsWith(nextResult.instanceLocation) | ||
&& (topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation) | ||
|| isRef(topResult)); | ||
return topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation) | ||
|| nextResult.keyword.endsWith("#validate") && topResult.instanceLocation === nextResult.instanceLocation; | ||
}; | ||
const isRef = (result) => result.keyword.endsWith("#$ref") || result.keyword.endsWith("#$recursiveRef"); | ||
const setMetaOutputFormat = (format) => { | ||
@@ -1430,0 +1424,0 @@ metaOutputFormat = format; |
@@ -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]}),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-]+$/; | ||
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 m={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 b=Symbol("$__value"),w=Symbol("$__href"),g=Symbol("$__isDynamic");var O=(e,t,r=!1)=>Object.freeze({[w]:e,[b]:t,[g]:r}),E=e=>e&&void 0!==e[w],$=e=>e[w],j=e=>e[b],A=e=>e[g];const{jsonTypeOf:S}=m,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,_=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,U=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,D=/^[!#$%&'*+.^_`|~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=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)}}})); | ||
*/function W(e){var t=String(e);if(R.test(t))return t;if(t.length>0&&!_.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(B,"\\$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||!D.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+"="+W(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(!D.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}=m,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=be(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?ae(e.$schema)[0]:r,s=ue(a,"idToken"),c=ue(a,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=be(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=be(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 me(u)},me=e=>E(e.value)?ve($(e.value),e,A(e.value)):e,be=(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 me(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 We(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=[];e===Te&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n)}(e===Ve||e!==Pe&&!i.valid)&&r.push(i),t[0]=i}},Le=(e,t)=>e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||t.keyword.endsWith("#validate")&&e.instanceLocation===t.instanceLocation,qe={},_e=e=>qe[e],Re=e=>e in qe,Ue={},Be={},De=async(e,t)=>{if(!Re(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 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(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)},We=(e,t,r)=>{const[n]=r[e];return _e(n).interpret(e,t,r)};var Fe={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:Re,defineVocabulary:(e,t)=>{Ue[e]=t},compileSchema:De,interpretSchema:We,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 Je={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])=>Fe.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Y.map(async([r,n])=>{const o=await Fe.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=Fe.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&&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=e("default",{Core:Fe,Schema:Ae,Instance:L,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Je}});e("Core",Ne.Core),e("Schema",Ne.Schema),e("Instance",Ne.Instance),e("Keywords",Ne.Keywords)}}})); | ||
//# sourceMappingURL=json-schema-core-system.min.js.map |
@@ -1187,3 +1187,3 @@ (function (global, factory) { | ||
if (jsonTypeOf$2(subject, "object")) { | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? subject["$schema"] : schemaVersion; | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? splitUrl$1(subject["$schema"])[0] : schemaVersion; | ||
const embeddedIdToken = getConfig(embeddedSchemaVersion, "idToken"); | ||
@@ -1407,8 +1407,5 @@ const embeddedAnchorToken = getConfig(embeddedSchemaVersion, "anchorToken"); | ||
result.errors.unshift(topResult, ...errors); | ||
if (isRef(result)) { | ||
break; | ||
} | ||
} | ||
if (outputFormat === VERBOSE || outputFormat !== FLAG && !result.valid) { | ||
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !result.valid)) { | ||
resultStack.push(result); | ||
@@ -1422,9 +1419,6 @@ } | ||
const isChild = (topResult, nextResult) => { | ||
return topResult.instanceLocation.startsWith(nextResult.instanceLocation) | ||
&& (topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation) | ||
|| isRef(topResult)); | ||
return topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation) | ||
|| nextResult.keyword.endsWith("#validate") && topResult.instanceLocation === nextResult.instanceLocation; | ||
}; | ||
const isRef = (result) => result.keyword.endsWith("#$ref") || result.keyword.endsWith("#$recursiveRef"); | ||
const setMetaOutputFormat = (format) => { | ||
@@ -1431,0 +1425,0 @@ metaOutputFormat = format; |
@@ -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],$=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-]+$/; | ||
!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,B=/([\\"])/g,D=/^[!#$%&'*+.^_`|~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=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})})); | ||
*/function W(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(B,"\\$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||!D.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+"="+W(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(!D.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?ae(e.$schema)[0]: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(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 We(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=[];e===Te&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n)}(e===Ve||e!==Se&&!i.valid)&&r.push(i),t[0]=i}},Le=(e,t)=>e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||t.keyword.endsWith("#validate")&&e.instanceLocation===t.instanceLocation,_e={},qe=e=>_e[e],Re=e=>e in _e,Ue={},Be={},De=async(e,t)=>{if(!Re(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 Ue)Object.entries(Ue[e]).forEach(([e,r])=>{((e,t)=>{_e[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 qe(e.schemaVersion+"#validate").compile(e,t),xe.uri(e)},We=(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 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:qe,hasKeyword:Re,defineVocabulary:(e,t)=>{Ue[e]=t},compileSchema:De,interpretSchema:We,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 Je={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])=>Fe.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Y.map(async([r,n])=>{const o=await Fe.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=Fe.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&&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)}},Me={Core:Fe,Schema:xe,Instance:L,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Je}},Ne=Me.Core,Ze=Me.Schema,Ge=Me.Instance,He=Me.Keywords;e.Core=Ne,e.Instance=Ge,e.Keywords=He,e.Schema=Ze,e.default=Me,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-umd.min.js.map |
@@ -46,8 +46,5 @@ const PubSub = require("pubsub-js"); | ||
result.errors.unshift(topResult, ...errors); | ||
if (isRef(result)) { | ||
break; | ||
} | ||
} | ||
if (outputFormat === VERBOSE || outputFormat !== FLAG && !result.valid) { | ||
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !result.valid)) { | ||
resultStack.push(result); | ||
@@ -61,9 +58,6 @@ } | ||
const isChild = (topResult, nextResult) => { | ||
return topResult.instanceLocation.startsWith(nextResult.instanceLocation) | ||
&& (topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation) | ||
|| isRef(topResult)); | ||
return topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation) | ||
|| nextResult.keyword.endsWith("#validate") && topResult.instanceLocation === nextResult.instanceLocation; | ||
}; | ||
const isRef = (result) => result.keyword.endsWith("#$ref") || result.keyword.endsWith("#$recursiveRef"); | ||
const setMetaOutputFormat = (format) => { | ||
@@ -70,0 +64,0 @@ metaOutputFormat = format; |
@@ -96,3 +96,3 @@ const contentTypeParser = require("content-type"); | ||
if (jsonTypeOf(subject, "object")) { | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? subject["$schema"] : schemaVersion; | ||
const embeddedSchemaVersion = typeof subject["$schema"] === "string" ? splitUrl(subject["$schema"])[0] : schemaVersion; | ||
const embeddedIdToken = getConfig(embeddedSchemaVersion, "idToken"); | ||
@@ -99,0 +99,0 @@ const embeddedAnchorToken = getConfig(embeddedSchemaVersion, "anchorToken"); |
{ | ||
"name": "@hyperjump/json-schema-core", | ||
"version": "0.13.2", | ||
"version": "0.13.3", | ||
"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
1578379
8978