@hyperjump/json-schema-core
Advanced tools
Comparing version 0.9.0 to 0.10.0
@@ -793,2 +793,71 @@ define(['exports'], function (exports) { 'use strict'; | ||
var entries$1 = async (doc) => Object.entries(await doc); | ||
var map$1 = justCurryIt(async (fn, doc) => (await doc).map(fn)); | ||
var reduce$1 = justCurryIt(async (fn, acc, doc) => { | ||
return (await doc).reduce(async (acc, item) => { | ||
let resolvedAcc; | ||
try { | ||
resolvedAcc = await acc; | ||
} catch (e) { | ||
try { | ||
await item; | ||
} catch (e) { | ||
// If we've already encountered an error, ignore subsequent errors. | ||
} | ||
return acc; | ||
} | ||
return fn(resolvedAcc, item); | ||
}, acc); | ||
}); | ||
var filter$1 = justCurryIt(async (fn, doc, options = {}) => { | ||
return reduce$1(async (acc, item) => { | ||
return (await fn(item)) ? acc.concat([item]) : acc; | ||
}, [], doc, options); | ||
}); | ||
var some$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$1(fn, doc); | ||
return (await Promise.all(results)) | ||
.some((a) => a); | ||
}); | ||
var every$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$1(fn, doc); | ||
return (await Promise.all(results)) | ||
.every((a) => a); | ||
}); | ||
var pipeline = justCurryIt((fns, doc) => { | ||
return fns.reduce(async (acc, fn) => fn(await acc), doc); | ||
}); | ||
var all = (doc) => Promise.all(doc); | ||
var allValues = (doc) => { | ||
return pipeline([ | ||
entries$1, | ||
reduce$1(async (acc, [propertyName, propertyValue]) => { | ||
acc[propertyName] = await propertyValue; | ||
return acc; | ||
}, {}) | ||
], doc); | ||
}; | ||
var lib = { | ||
entries: entries$1, | ||
map: map$1, | ||
filter: filter$1, | ||
reduce: reduce$1, | ||
some: some$1, | ||
every: every$1, | ||
pipeline: pipeline, | ||
all: all, | ||
allValues: allValues | ||
}; | ||
var urlResolveBrowser = urlResolve; | ||
@@ -1215,7 +1284,14 @@ | ||
const entries$1 = (doc) => Object.keys(value$1(doc)) | ||
.map(async (key) => [key, await step$1(key, doc)]); | ||
const entries$2 = (doc) => lib.pipeline([ | ||
value$1, | ||
Object.keys, | ||
lib.map(async (key) => [key, await step$1(key, doc)]), | ||
lib.all | ||
], doc); | ||
const map$1 = justCurryIt((fn, doc) => value$1(doc) | ||
.map(async (item, ndx) => fn(await step$1(ndx, doc), ndx))); | ||
const map$2 = justCurryIt((fn, doc) => lib.pipeline([ | ||
value$1, | ||
lib.map(async (item, ndx) => fn(await step$1(ndx, doc), ndx)), | ||
lib.all | ||
], doc)); | ||
@@ -1225,3 +1301,3 @@ var schema = { | ||
add, get: get$2, markValidated, | ||
uri: uri$1, value: value$1, has, step: step$1, entries: entries$1, map: map$1 | ||
uri: uri$1, value: value$1, has, step: step$1, entries: entries$2, map: map$2 | ||
}; | ||
@@ -1392,71 +1468,2 @@ | ||
var entries$2 = async (doc) => Object.entries(await doc); | ||
var map$2 = justCurryIt(async (fn, doc) => (await doc).map(fn)); | ||
var reduce$1 = justCurryIt(async (fn, acc, doc) => { | ||
return (await doc).reduce(async (acc, item) => { | ||
let resolvedAcc; | ||
try { | ||
resolvedAcc = await acc; | ||
} catch (e) { | ||
try { | ||
await item; | ||
} catch (e) { | ||
// If we've already encountered an error, ignore subsequent errors. | ||
} | ||
return acc; | ||
} | ||
return fn(resolvedAcc, item); | ||
}, acc); | ||
}); | ||
var filter$1 = justCurryIt(async (fn, doc, options = {}) => { | ||
return reduce$1(async (acc, item) => { | ||
return (await fn(item)) ? acc.concat([item]) : acc; | ||
}, [], doc, options); | ||
}); | ||
var some$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$2(fn, doc); | ||
return (await Promise.all(results)) | ||
.some((a) => a); | ||
}); | ||
var every$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$2(fn, doc); | ||
return (await Promise.all(results)) | ||
.every((a) => a); | ||
}); | ||
var pipeline = justCurryIt((fns, doc) => { | ||
return fns.reduce(async (acc, fn) => fn(await acc), doc); | ||
}); | ||
var all = (doc) => Promise.all(doc); | ||
var allValues = (doc) => { | ||
return pipeline([ | ||
entries$2, | ||
reduce$1(async (acc, [propertyName, propertyValue]) => { | ||
acc[propertyName] = await propertyValue; | ||
return acc; | ||
}, {}) | ||
], doc); | ||
}; | ||
var lib = { | ||
entries: entries$2, | ||
map: map$2, | ||
filter: filter$1, | ||
reduce: reduce$1, | ||
some: some$1, | ||
every: every$1, | ||
pipeline: pipeline, | ||
all: all, | ||
allValues: allValues | ||
}; | ||
const compile$2 = async (schema$1, ast) => { | ||
@@ -1472,14 +1479,5 @@ const url = schema.uri(schema$1); | ||
schema.entries, | ||
lib.map(async (entry) => { | ||
const [keyword, keywordSchema] = await entry; | ||
const keywordId = `${schema$1.schemaVersion}#${keyword}`; | ||
return [keywordId, keywordSchema]; | ||
}), | ||
lib.filter(async (entry) => { | ||
const [keywordId] = await entry; | ||
return core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`; | ||
}), | ||
lib.map(async (entry) => { | ||
const [keywordId, keywordSchemaPromise] = await entry; | ||
const keywordSchema = await keywordSchemaPromise; | ||
lib.map(([keyword, keywordSchema]) => [`${schema$1.schemaVersion}#${keyword}`, keywordSchema]), | ||
lib.filter(([keywordId]) => core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`), | ||
lib.map(async ([keywordId, keywordSchema]) => { | ||
const keywordAst = await core.getKeyword(keywordId).compile(keywordSchema, ast, schema$1); | ||
@@ -1486,0 +1484,0 @@ return [keywordId, schema.uri(keywordSchema), keywordAst]; |
@@ -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)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==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{splitUrl:b}=v,w=Object.freeze({id:"",pointer:"",instance:void 0}),m=(e,t=w)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return m("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),P=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),j=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),x=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var A={cons:(e,t="")=>Object.freeze({...w,id:t,instance:e}),get:m,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:P,every:j,some:x},S=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~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)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==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{splitUrl:b}=v,m=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=m)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return w("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),P=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),j=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),x=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var A={cons:(e,t="")=>Object.freeze({...m,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:P,every:j,some:x},S=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function K(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function L(e){this.parameters=Object.create(null),this.type=e}var C={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.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],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+K(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(!R.test(n))throw new TypeError("invalid media type");var o=new L(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.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(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=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(W.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)?q(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+z(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=z(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:q(e)}};function q(e){return e+("/"===e[e.length-1]?"":"/")}function z(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 W=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var _=fetch;const{isObject:B,splitUrl:D}=v,F=Symbol("$__jref"),M={},Z={},N=(e,t)=>{const r=e in Z?Z[e]:e;if(r in M)return M[r][t]},J={},G={},H=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=D(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=N(n,"idToken"),i=D(t)[0],a=ee(i,e[o]||""),s=D(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(G[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,N(n,"vocabulary")&&B(e)&&"$vocabulary"in e?(Z[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};J[s]={id:s,schemaVersion:n,schema:Q(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},Q=(e,t,r,n,o)=>{if(B(e)){const i=N(r,"idToken"),a=N(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ee(t,n),[s,c]=D(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return H(e,ee(t,s),r),{[F]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=Q(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>Q(e,t,r,y.append(i,n),o)):e},X=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),Y=async(e,t=X,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:ne(t),o=ee(n,e),[i,a]=D(o);if(!(e=>e in J||e in G)(i)){const e=await _(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=C.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}`)}H(await e.json(),i)}const s=(e=>J[G[e]]||J[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?re(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=oe(c);return B(u)&&F in u?Y(u[F],c):N(c.schemaVersion,"jsonReference")&&B(u)&&"string"==typeof u.$ref?Y(u.$ref,c):N(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?Y(u,c):N(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?Y(u,c,!0):c},ee=(e,t)=>{const r=U(e,t),n=D(e)[0];if(n&&"file"===te(r)&&"file"!==te(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},te=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},re=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ne=e=>`${e.id}#${encodeURI(e.pointer)}`,oe=e=>y.get(e.pointer,e.schema),ie=(e,t)=>{const r=y.append(e,t.pointer);return Y("#"+encodeURI(r),t)},ae=n((e,t)=>oe(t).map(async(r,n)=>e(await ie(n,t),n)));var se={setConfig:(e,t,r)=>{M[e]||(M[e]={}),M[e][t]=r},getConfig:N,add:H,get:Y,markValidated:e=>{J[e].validated=!0},uri:ne,value:oe,has:(e,t)=>e in oe(t),step:ie,entries:e=>Object.keys(oe(e)).map(async t=>[t,await ie(t,e)]),map:ae};const ce="FLAG",ue="BASIC",le="DETAILED",fe="VERBOSE";let de=le,pe=!0;const he=(e,t)=>(n,o=ce)=>{if(![ce,ue,le,fe].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",ye(o,i));return Pe(t,n,e),r.unsubscribe(a),i[0]},ye=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ve(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ue&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),be(i))break}(e===fe||e!==ce&&!i.valid)&&r.push(i),t[0]=i}},ve=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||be(e)),be=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),we={},me=e=>we[e],ge=e=>e in we,Oe={},Ee={},$e=async(e,t)=>{if(!ge(e.schemaVersion+"#validate")){const t=await se.get(e.schemaVersion);(se.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 Oe)Object.entries(Oe[e]).forEach(([e,r])=>{((e,t)=>{we[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(pe&&!e.validated){if(se.markValidated(e.id),!(e.schemaVersion in Ee)){const t=await se.get(e.schemaVersion),r={},n=await $e(t,r);Ee[t.id]=he(r,n)}const t=A.cons(e.schema,e.id),r=Ee[e.schemaVersion](t,de);if(!r.valid)throw r}return await me(e.schemaVersion+"#validate").compile(e,t),se.uri(e)},Pe=(e,t,r)=>{const[n]=r[e];return me(n).interpret(e,t,r)};var je={validate:async(e,t,r)=>{const n={},o=await $e(e,n),i=(e,t=ce)=>he(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{de=e},setShouldMetaValidate:e=>{pe=e},FLAG:ce,BASIC:ue,DETAILED:le,VERBOSE:fe,getKeyword:me,hasKeyword:ge,defineVocabulary:(e,t)=>{Oe[e]=t},compileSchema:$e,interpretSchema:Pe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return me(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return me(o).collectEvaluatedItems(e,t,r,n)}};var xe={compile:()=>{},interpret:()=>!0},Ae=async e=>Object.entries(await e),Se=n(async(e,t)=>(await t).map(e)),Ie=n(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),Ve=n(async(e,t,r={})=>Ie(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Te=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).some(e=>e)}),ke=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).every(e=>e)}),Re=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ke={entries:Ae,map:Se,filter:Ve,reduce:Ie,some:Te,every:ke,pipeline:Re,all:e=>Promise.all(e),allValues:e=>Re([Ae,Ie(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Le={compile:async(e,t)=>{const r=se.uri(e);if(!(r in t)){t[r]=!1;const n=se.value(e);t[r]=[e.schemaVersion+"#validate",se.uri(e),"boolean"==typeof n?n:await Ke.pipeline([se.entries,Ke.map(async t=>{const[r,n]=await t;return[`${e.schemaVersion}#${r}`,n]}),Ke.filter(async t=>{const[r]=await t;return je.hasKeyword(r)&&r!==e.schemaVersion+"#validate"}),Ke.map(async r=>{const[n,o]=await r,i=await o,a=await je.getKeyword(n).compile(i,t,e);return[n,se.uri(i),a]}),Ke.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:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.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)}},Ce={Core:je,Schema:se,Instance:A,Keywords:{metaData:xe,validate:Le}},Ue=Ce.Core,qe=Ce.Schema,ze=Ce.Instance,We=Ce.Keywords;e.Core=Ue,e.Instance=ze,e.Keywords=We,e.Schema=qe,e.default=Ce,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
*/function K(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function L(e){this.parameters=Object.create(null),this.type=e}var C={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.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],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+K(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(!R.test(n))throw new TypeError("invalid media type");var o=new L(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.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(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=async e=>Object.entries(await e),q=n(async(e,t)=>(await t).map(e)),z=n(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),W=n(async(e,t,r={})=>z(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),_=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).some(e=>e)}),B=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).every(e=>e)}),D=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),F={entries:U,map:q,filter:W,reduce:z,some:_,every:B,pipeline:D,all:e=>Promise.all(e),allValues:e=>D([U,z(async(e,[t,r])=>(e[t]=await r,e),{})],e)},M=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(J.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)?Z(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+N(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=N(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:Z(e)}};function Z(e){return e+("/"===e[e.length-1]?"":"/")}function N(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 J=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var G=fetch;const{isObject:H,splitUrl:Q}=v,X=Symbol("$__jref"),Y={},ee={},te=(e,t)=>{const r=e in ee?ee[e]:e;if(r in Y)return Y[r][t]},re={},ne={},oe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=Q(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=te(n,"idToken"),i=Q(t)[0],a=ce(i,e[o]||""),s=Q(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(ne[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,te(n,"vocabulary")&&H(e)&&"$vocabulary"in e?(ee[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};re[s]={id:s,schemaVersion:n,schema:ie(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},ie=(e,t,r,n,o)=>{if(H(e)){const i=te(r,"idToken"),a=te(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ce(t,n),[s,c]=Q(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return oe(e,ce(t,s),r),{[X]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=ie(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>ie(e,t,r,y.append(i,n),o)):e},ae=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),se=async(e,t=ae,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:fe(t),o=ce(n,e),[i,a]=Q(o);if(!(e=>e in re||e in ne)(i)){const e=await G(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=C.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}`)}oe(await e.json(),i)}const s=(e=>re[ne[e]]||re[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?le(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=de(c);return H(u)&&X in u?se(u[X],c):te(c.schemaVersion,"jsonReference")&&H(u)&&"string"==typeof u.$ref?se(u.$ref,c):te(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?se(u,c):te(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?se(u,c,!0):c},ce=(e,t)=>{const r=M(e,t),n=Q(e)[0];if(n&&"file"===ue(r)&&"file"!==ue(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ue=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},le=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},fe=e=>`${e.id}#${encodeURI(e.pointer)}`,de=e=>y.get(e.pointer,e.schema),pe=(e,t)=>{const r=y.append(e,t.pointer);return se("#"+encodeURI(r),t)},he=n((e,t)=>F.pipeline([de,F.map(async(r,n)=>e(await pe(n,t),n)),F.all],t));var ye={setConfig:(e,t,r)=>{Y[e]||(Y[e]={}),Y[e][t]=r},getConfig:te,add:oe,get:se,markValidated:e=>{re[e].validated=!0},uri:fe,value:de,has:(e,t)=>e in de(t),step:pe,entries:e=>F.pipeline([de,Object.keys,F.map(async t=>[t,await pe(t,e)]),F.all],e),map:he};const ve="FLAG",be="BASIC",me="DETAILED",we="VERBOSE";let ge=me,Oe=!0;const Ee=(e,t)=>(n,o=ve)=>{if(![ve,be,me,we].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",$e(o,i));return ke(t,n,e),r.unsubscribe(a),i[0]},$e=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&Pe(r[r.length-1],i);){const t=r.pop();let n=[];if(e===be&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),je(i))break}(e===we||e!==ve&&!i.valid)&&r.push(i),t[0]=i}},Pe=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||je(e)),je=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),xe={},Ae=e=>xe[e],Se=e=>e in xe,Ie={},Ve={},Te=async(e,t)=>{if(!Se(e.schemaVersion+"#validate")){const t=await ye.get(e.schemaVersion);(ye.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 Ie)Object.entries(Ie[e]).forEach(([e,r])=>{((e,t)=>{xe[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(Oe&&!e.validated){if(ye.markValidated(e.id),!(e.schemaVersion in Ve)){const t=await ye.get(e.schemaVersion),r={},n=await Te(t,r);Ve[t.id]=Ee(r,n)}const t=A.cons(e.schema,e.id),r=Ve[e.schemaVersion](t,ge);if(!r.valid)throw r}return await Ae(e.schemaVersion+"#validate").compile(e,t),ye.uri(e)},ke=(e,t,r)=>{const[n]=r[e];return Ae(n).interpret(e,t,r)};var Re={validate:async(e,t,r)=>{const n={},o=await Te(e,n),i=(e,t=ve)=>Ee(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{ge=e},setShouldMetaValidate:e=>{Oe=e},FLAG:ve,BASIC:be,DETAILED:me,VERBOSE:we,getKeyword:Ae,hasKeyword:Se,defineVocabulary:(e,t)=>{Ie[e]=t},compileSchema:Te,interpretSchema:ke,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Ae(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Ae(o).collectEvaluatedItems(e,t,r,n)}};var Ke={compile:async(e,t)=>{const r=ye.uri(e);if(!(r in t)){t[r]=!1;const n=ye.value(e);t[r]=[e.schemaVersion+"#validate",ye.uri(e),"boolean"==typeof n?n:await F.pipeline([ye.entries,F.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),F.filter(([t])=>Re.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),F.map(async([r,n])=>{const o=await Re.getKeyword(r).compile(n,t,e);return[r,ye.uri(n),o]}),F.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Re.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.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&&Re.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&&Re.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:Re,Schema:ye,Instance:A,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Ke}},Ce=Le.Core,Ue=Le.Schema,qe=Le.Instance,ze=Le.Keywords;e.Core=Ce,e.Instance=qe,e.Keywords=ze,e.Schema=Ue,e.default=Le,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-amd.min.js.map |
@@ -795,2 +795,71 @@ 'use strict'; | ||
var entries$1 = async (doc) => Object.entries(await doc); | ||
var map$1 = justCurryIt(async (fn, doc) => (await doc).map(fn)); | ||
var reduce$1 = justCurryIt(async (fn, acc, doc) => { | ||
return (await doc).reduce(async (acc, item) => { | ||
let resolvedAcc; | ||
try { | ||
resolvedAcc = await acc; | ||
} catch (e) { | ||
try { | ||
await item; | ||
} catch (e) { | ||
// If we've already encountered an error, ignore subsequent errors. | ||
} | ||
return acc; | ||
} | ||
return fn(resolvedAcc, item); | ||
}, acc); | ||
}); | ||
var filter$1 = justCurryIt(async (fn, doc, options = {}) => { | ||
return reduce$1(async (acc, item) => { | ||
return (await fn(item)) ? acc.concat([item]) : acc; | ||
}, [], doc, options); | ||
}); | ||
var some$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$1(fn, doc); | ||
return (await Promise.all(results)) | ||
.some((a) => a); | ||
}); | ||
var every$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$1(fn, doc); | ||
return (await Promise.all(results)) | ||
.every((a) => a); | ||
}); | ||
var pipeline = justCurryIt((fns, doc) => { | ||
return fns.reduce(async (acc, fn) => fn(await acc), doc); | ||
}); | ||
var all = (doc) => Promise.all(doc); | ||
var allValues = (doc) => { | ||
return pipeline([ | ||
entries$1, | ||
reduce$1(async (acc, [propertyName, propertyValue]) => { | ||
acc[propertyName] = await propertyValue; | ||
return acc; | ||
}, {}) | ||
], doc); | ||
}; | ||
var lib = { | ||
entries: entries$1, | ||
map: map$1, | ||
filter: filter$1, | ||
reduce: reduce$1, | ||
some: some$1, | ||
every: every$1, | ||
pipeline: pipeline, | ||
all: all, | ||
allValues: allValues | ||
}; | ||
var urlResolveBrowser = urlResolve; | ||
@@ -1217,7 +1286,14 @@ | ||
const entries$1 = (doc) => Object.keys(value$1(doc)) | ||
.map(async (key) => [key, await step$1(key, doc)]); | ||
const entries$2 = (doc) => lib.pipeline([ | ||
value$1, | ||
Object.keys, | ||
lib.map(async (key) => [key, await step$1(key, doc)]), | ||
lib.all | ||
], doc); | ||
const map$1 = justCurryIt((fn, doc) => value$1(doc) | ||
.map(async (item, ndx) => fn(await step$1(ndx, doc), ndx))); | ||
const map$2 = justCurryIt((fn, doc) => lib.pipeline([ | ||
value$1, | ||
lib.map(async (item, ndx) => fn(await step$1(ndx, doc), ndx)), | ||
lib.all | ||
], doc)); | ||
@@ -1227,3 +1303,3 @@ var schema = { | ||
add, get: get$2, markValidated, | ||
uri: uri$1, value: value$1, has, step: step$1, entries: entries$1, map: map$1 | ||
uri: uri$1, value: value$1, has, step: step$1, entries: entries$2, map: map$2 | ||
}; | ||
@@ -1394,71 +1470,2 @@ | ||
var entries$2 = async (doc) => Object.entries(await doc); | ||
var map$2 = justCurryIt(async (fn, doc) => (await doc).map(fn)); | ||
var reduce$1 = justCurryIt(async (fn, acc, doc) => { | ||
return (await doc).reduce(async (acc, item) => { | ||
let resolvedAcc; | ||
try { | ||
resolvedAcc = await acc; | ||
} catch (e) { | ||
try { | ||
await item; | ||
} catch (e) { | ||
// If we've already encountered an error, ignore subsequent errors. | ||
} | ||
return acc; | ||
} | ||
return fn(resolvedAcc, item); | ||
}, acc); | ||
}); | ||
var filter$1 = justCurryIt(async (fn, doc, options = {}) => { | ||
return reduce$1(async (acc, item) => { | ||
return (await fn(item)) ? acc.concat([item]) : acc; | ||
}, [], doc, options); | ||
}); | ||
var some$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$2(fn, doc); | ||
return (await Promise.all(results)) | ||
.some((a) => a); | ||
}); | ||
var every$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$2(fn, doc); | ||
return (await Promise.all(results)) | ||
.every((a) => a); | ||
}); | ||
var pipeline = justCurryIt((fns, doc) => { | ||
return fns.reduce(async (acc, fn) => fn(await acc), doc); | ||
}); | ||
var all = (doc) => Promise.all(doc); | ||
var allValues = (doc) => { | ||
return pipeline([ | ||
entries$2, | ||
reduce$1(async (acc, [propertyName, propertyValue]) => { | ||
acc[propertyName] = await propertyValue; | ||
return acc; | ||
}, {}) | ||
], doc); | ||
}; | ||
var lib = { | ||
entries: entries$2, | ||
map: map$2, | ||
filter: filter$1, | ||
reduce: reduce$1, | ||
some: some$1, | ||
every: every$1, | ||
pipeline: pipeline, | ||
all: all, | ||
allValues: allValues | ||
}; | ||
const compile$2 = async (schema$1, ast) => { | ||
@@ -1474,14 +1481,5 @@ const url = schema.uri(schema$1); | ||
schema.entries, | ||
lib.map(async (entry) => { | ||
const [keyword, keywordSchema] = await entry; | ||
const keywordId = `${schema$1.schemaVersion}#${keyword}`; | ||
return [keywordId, keywordSchema]; | ||
}), | ||
lib.filter(async (entry) => { | ||
const [keywordId] = await entry; | ||
return core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`; | ||
}), | ||
lib.map(async (entry) => { | ||
const [keywordId, keywordSchemaPromise] = await entry; | ||
const keywordSchema = await keywordSchemaPromise; | ||
lib.map(([keyword, keywordSchema]) => [`${schema$1.schemaVersion}#${keyword}`, keywordSchema]), | ||
lib.filter(([keywordId]) => core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`), | ||
lib.map(async ([keywordId, keywordSchema]) => { | ||
const keywordAst = await core.getKeyword(keywordId).compile(keywordSchema, ast, schema$1); | ||
@@ -1488,0 +1486,0 @@ return [keywordId, schema.uri(keywordSchema), keywordAst]; |
@@ -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)}};var y={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==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{splitUrl:v}=y,b=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=b)=>Object.freeze({...t,pointer:v(e)[1]}),m=e=>h.get(e.pointer,e.instance),g=(e,t)=>{const r=h.append(e,t.pointer);return w("#"+encodeURI(r),t)},O=r((e,t)=>m(t).map((r,n)=>e(g(n,t),n))),E=r((e,t)=>m(t).map((e,r)=>g(r,t)).filter((t,r)=>e(t,r))),$=r((e,t,r)=>m(r).reduce((t,n,o)=>e(t,g(o,r),o),t)),x=r((e,t)=>Object.keys(m(t)).every((r,n)=>e(g(r,t),n))),P=r((e,t)=>Object.keys(m(t)).some((r,n)=>e(g(r,t),n)));var j={cons:(e,t="")=>Object.freeze({...b,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:m,step:g,entries:e=>Object.keys(m(e)).map(t=>[t,g(t,e)]),map:O,filter:E,reduce:$,every:x,some:P},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,S=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,I=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,V=/\\([\u000b\u0020-\u00ff])/g,T=/([\\"])/g,k=/^[!#$%&'*+.^_`|~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)}};var y={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==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{splitUrl:v}=y,b=Object.freeze({id:"",pointer:"",instance:void 0}),m=(e,t=b)=>Object.freeze({...t,pointer:v(e)[1]}),w=e=>h.get(e.pointer,e.instance),g=(e,t)=>{const r=h.append(e,t.pointer);return m("#"+encodeURI(r),t)},O=r((e,t)=>w(t).map((r,n)=>e(g(n,t),n))),E=r((e,t)=>w(t).map((e,r)=>g(r,t)).filter((t,r)=>e(t,r))),$=r((e,t,r)=>w(r).reduce((t,n,o)=>e(t,g(o,r),o),t)),x=r((e,t)=>Object.keys(w(t)).every((r,n)=>e(g(r,t),n))),P=r((e,t)=>Object.keys(w(t)).some((r,n)=>e(g(r,t),n)));var j={cons:(e,t="")=>Object.freeze({...b,id:t,instance:e}),get:m,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:w,step:g,entries:e=>Object.keys(w(e)).map(t=>[t,g(t,e)]),map:O,filter:E,reduce:$,every:x,some:P},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,S=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,I=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,V=/\\([\u000b\u0020-\u00ff])/g,T=/([\\"])/g,k=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function R(e){var t=String(e);if(I.test(t))return t;if(t.length>0&&!S.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(T,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!k.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],!I.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+R(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(!k.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=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(V,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},C=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(z.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)?U(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+q(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=q(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:U(e)}};function U(e){return e+("/"===e[e.length-1]?"":"/")}function q(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 z=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var W=fetch;const{isObject:_,splitUrl:B}=y,D=Symbol("$__jref"),F={},M={},Z=(e,t)=>{const r=e in M?M[e]:e;if(r in F)return F[r][t]},N={},J={},G=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=B(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=Z(n,"idToken"),i=B(t)[0],a=Y(i,e[o]||""),s=B(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(J[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,Z(n,"vocabulary")&&_(e)&&"$vocabulary"in e?(M[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};N[s]={id:s,schemaVersion:n,schema:H(e,s,n,h.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},H=(e,t,r,n,o)=>{if(_(e)){const i=Z(r,"idToken"),a=Z(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=Y(t,n),[s,c]=B(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return G(e,Y(t,s),r),{[D]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=H(a,t,r,h.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>H(e,t,r,h.append(i,n),o)):e},Q=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),X=async(e,t=Q,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:re(t),o=Y(n,e),[i,a]=B(o);if(!(e=>e in N||e in J)(i)){const e=await W(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=L.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}`)}G(await e.json(),i)}const s=(e=>N[J[e]]||N[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?te(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=ne(c);return _(u)&&D in u?X(u[D],c):Z(c.schemaVersion,"jsonReference")&&_(u)&&"string"==typeof u.$ref?X(u.$ref,c):Z(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?X(u,c):Z(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?X(u,c,!0):c},Y=(e,t)=>{const r=C(e,t),n=B(e)[0];if(n&&"file"===ee(r)&&"file"!==ee(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ee=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},te=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},re=e=>`${e.id}#${encodeURI(e.pointer)}`,ne=e=>h.get(e.pointer,e.schema),oe=(e,t)=>{const r=h.append(e,t.pointer);return X("#"+encodeURI(r),t)},ie=r((e,t)=>ne(t).map(async(r,n)=>e(await oe(n,t),n)));var ae={setConfig:(e,t,r)=>{F[e]||(F[e]={}),F[e][t]=r},getConfig:Z,add:G,get:X,markValidated:e=>{N[e].validated=!0},uri:re,value:ne,has:(e,t)=>e in ne(t),step:oe,entries:e=>Object.keys(ne(e)).map(async t=>[t,await oe(t,e)]),map:ie};const se="FLAG",ce="BASIC",ue="DETAILED",le="VERBOSE";let fe=ue,de=!0;const pe=(e,r)=>(n,o=se)=>{if(![se,ce,ue,le].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=t.subscribe("result",he(o,i));return $e(r,n,e),t.unsubscribe(a),i[0]},he=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ye(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ce&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),ve(i))break}(e===le||e!==se&&!i.valid)&&r.push(i),t[0]=i}},ye=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||ve(e)),ve=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),be={},we=e=>be[e],me=e=>e in be,ge={},Oe={},Ee=async(e,t)=>{if(!me(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 ge)Object.entries(ge[e]).forEach(([e,r])=>{((e,t)=>{be[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(de&&!e.validated){if(ae.markValidated(e.id),!(e.schemaVersion in Oe)){const t=await ae.get(e.schemaVersion),r={},n=await Ee(t,r);Oe[t.id]=pe(r,n)}const t=j.cons(e.schema,e.id),r=Oe[e.schemaVersion](t,fe);if(!r.valid)throw r}return await we(e.schemaVersion+"#validate").compile(e,t),ae.uri(e)},$e=(e,t,r)=>{const[n]=r[e];return we(n).interpret(e,t,r)};var xe={validate:async(e,t,r)=>{const n={},o=await Ee(e,n),i=(e,t=se)=>pe(n,o)(j.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{fe=e},setShouldMetaValidate:e=>{de=e},FLAG:se,BASIC:ce,DETAILED:ue,VERBOSE:le,getKeyword:we,hasKeyword:me,defineVocabulary:(e,t)=>{ge[e]=t},compileSchema:Ee,interpretSchema:$e,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedItems(e,t,r,n)}};var Pe={compile:()=>{},interpret:()=>!0},je=async e=>Object.entries(await e),Ae=r(async(e,t)=>(await t).map(e)),Se=r(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),Ie=r(async(e,t,r={})=>Se(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Ve=r(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).some(e=>e)}),Te=r(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).every(e=>e)}),ke=r((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Re={entries:je,map:Ae,filter:Ie,reduce:Se,some:Ve,every:Te,pipeline:ke,all:e=>Promise.all(e),allValues:e=>ke([je,Se(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ke={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 Re.pipeline([ae.entries,Re.map(async t=>{const[r,n]=await t;return[`${e.schemaVersion}#${r}`,n]}),Re.filter(async t=>{const[r]=await t;return xe.hasKeyword(r)&&r!==e.schemaVersion+"#validate"}),Re.map(async r=>{const[n,o]=await r,i=await o,a=await xe.getKeyword(n).compile(i,t,e);return[n,ae.uri(i),a]}),Re.all],e)]}},interpret:(e,r,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=xe.getKeyword(e).interpret(i,r,n);return t.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:j.uri(r),valid:a}),a});return t.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:j.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&&xe.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&&xe.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:xe,Schema:ae,Instance:j,Keywords:{metaData:Pe,validate:Ke}},Ce=Le.Core,Ue=Le.Schema,qe=Le.Instance,ze=Le.Keywords;exports.Core=Ce,exports.Instance=qe,exports.Keywords=ze,exports.Schema=Ue,exports.default=Le; | ||
*/function R(e){var t=String(e);if(I.test(t))return t;if(t.length>0&&!S.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(T,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!k.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],!I.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+R(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(!k.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=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(V,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},C=async e=>Object.entries(await e),U=r(async(e,t)=>(await t).map(e)),q=r(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),z=r(async(e,t,r={})=>q(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),W=r(async(e,t)=>{const r=await U(e,t);return(await Promise.all(r)).some(e=>e)}),_=r(async(e,t)=>{const r=await U(e,t);return(await Promise.all(r)).every(e=>e)}),B=r((e,t)=>e.reduce(async(e,t)=>t(await e),t)),D={entries:C,map:U,filter:z,reduce:q,some:W,every:_,pipeline:B,all:e=>Promise.all(e),allValues:e=>B([C,q(async(e,[t,r])=>(e[t]=await r,e),{})],e)},F=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(N.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)?M(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+Z(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=Z(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:M(e)}};function M(e){return e+("/"===e[e.length-1]?"":"/")}function Z(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 N=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var J=fetch;const{isObject:G,splitUrl:H}=y,Q=Symbol("$__jref"),X={},Y={},ee=(e,t)=>{const r=e in Y?Y[e]:e;if(r in X)return X[r][t]},te={},re={},ne=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=H(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ee(n,"idToken"),i=H(t)[0],a=se(i,e[o]||""),s=H(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(re[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,ee(n,"vocabulary")&&G(e)&&"$vocabulary"in e?(Y[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};te[s]={id:s,schemaVersion:n,schema:oe(e,s,n,h.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},oe=(e,t,r,n,o)=>{if(G(e)){const i=ee(r,"idToken"),a=ee(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=se(t,n),[s,c]=H(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return ne(e,se(t,s),r),{[Q]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=oe(a,t,r,h.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>oe(e,t,r,h.append(i,n),o)):e},ie=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),ae=async(e,t=ie,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:le(t),o=se(n,e),[i,a]=H(o);if(!(e=>e in te||e in re)(i)){const e=await J(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=L.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}`)}ne(await e.json(),i)}const s=(e=>te[re[e]]||te[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?ue(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=fe(c);return G(u)&&Q in u?ae(u[Q],c):ee(c.schemaVersion,"jsonReference")&&G(u)&&"string"==typeof u.$ref?ae(u.$ref,c):ee(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?ae(u,c):ee(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?ae(u,c,!0):c},se=(e,t)=>{const r=F(e,t),n=H(e)[0];if(n&&"file"===ce(r)&&"file"!==ce(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ce=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ue=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},le=e=>`${e.id}#${encodeURI(e.pointer)}`,fe=e=>h.get(e.pointer,e.schema),de=(e,t)=>{const r=h.append(e,t.pointer);return ae("#"+encodeURI(r),t)},pe=r((e,t)=>D.pipeline([fe,D.map(async(r,n)=>e(await de(n,t),n)),D.all],t));var he={setConfig:(e,t,r)=>{X[e]||(X[e]={}),X[e][t]=r},getConfig:ee,add:ne,get:ae,markValidated:e=>{te[e].validated=!0},uri:le,value:fe,has:(e,t)=>e in fe(t),step:de,entries:e=>D.pipeline([fe,Object.keys,D.map(async t=>[t,await de(t,e)]),D.all],e),map:pe};const ye="FLAG",ve="BASIC",be="DETAILED",me="VERBOSE";let we=be,ge=!0;const Oe=(e,r)=>(n,o=ye)=>{if(![ye,ve,be,me].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=t.subscribe("result",Ee(o,i));return Te(r,n,e),t.unsubscribe(a),i[0]},Ee=(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===ve&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),xe(i))break}(e===me||e!==ye&&!i.valid)&&r.push(i),t[0]=i}},$e=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||xe(e)),xe=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),Pe={},je=e=>Pe[e],Ae=e=>e in Pe,Se={},Ie={},Ve=async(e,t)=>{if(!Ae(e.schemaVersion+"#validate")){const t=await he.get(e.schemaVersion);(he.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 Se)Object.entries(Se[e]).forEach(([e,r])=>{((e,t)=>{Pe[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(ge&&!e.validated){if(he.markValidated(e.id),!(e.schemaVersion in Ie)){const t=await he.get(e.schemaVersion),r={},n=await Ve(t,r);Ie[t.id]=Oe(r,n)}const t=j.cons(e.schema,e.id),r=Ie[e.schemaVersion](t,we);if(!r.valid)throw r}return await je(e.schemaVersion+"#validate").compile(e,t),he.uri(e)},Te=(e,t,r)=>{const[n]=r[e];return je(n).interpret(e,t,r)};var ke={validate:async(e,t,r)=>{const n={},o=await Ve(e,n),i=(e,t=ye)=>Oe(n,o)(j.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{we=e},setShouldMetaValidate:e=>{ge=e},FLAG:ye,BASIC:ve,DETAILED:be,VERBOSE:me,getKeyword:je,hasKeyword:Ae,defineVocabulary:(e,t)=>{Se[e]=t},compileSchema:Ve,interpretSchema:Te,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return je(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return je(o).collectEvaluatedItems(e,t,r,n)}};var Re={compile:async(e,t)=>{const r=he.uri(e);if(!(r in t)){t[r]=!1;const n=he.value(e);t[r]=[e.schemaVersion+"#validate",he.uri(e),"boolean"==typeof n?n:await D.pipeline([he.entries,D.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),D.filter(([t])=>ke.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),D.map(async([r,n])=>{const o=await ke.getKeyword(r).compile(n,t,e);return[r,he.uri(n),o]}),D.all],e)]}},interpret:(e,r,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=ke.getKeyword(e).interpret(i,r,n);return t.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:j.uri(r),valid:a}),a});return t.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:j.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&&ke.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&&ke.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ke={Core:ke,Schema:he,Instance:j,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Re}},Le=Ke.Core,Ce=Ke.Schema,Ue=Ke.Instance,qe=Ke.Keywords;exports.Core=Le,exports.Instance=Ue,exports.Keywords=qe,exports.Schema=Ce,exports.default=Ke; | ||
//# sourceMappingURL=json-schema-core-cjs.min.js.map |
@@ -791,2 +791,71 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
var entries$1 = async (doc) => Object.entries(await doc); | ||
var map$1 = justCurryIt(async (fn, doc) => (await doc).map(fn)); | ||
var reduce$1 = justCurryIt(async (fn, acc, doc) => { | ||
return (await doc).reduce(async (acc, item) => { | ||
let resolvedAcc; | ||
try { | ||
resolvedAcc = await acc; | ||
} catch (e) { | ||
try { | ||
await item; | ||
} catch (e) { | ||
// If we've already encountered an error, ignore subsequent errors. | ||
} | ||
return acc; | ||
} | ||
return fn(resolvedAcc, item); | ||
}, acc); | ||
}); | ||
var filter$1 = justCurryIt(async (fn, doc, options = {}) => { | ||
return reduce$1(async (acc, item) => { | ||
return (await fn(item)) ? acc.concat([item]) : acc; | ||
}, [], doc, options); | ||
}); | ||
var some$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$1(fn, doc); | ||
return (await Promise.all(results)) | ||
.some((a) => a); | ||
}); | ||
var every$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$1(fn, doc); | ||
return (await Promise.all(results)) | ||
.every((a) => a); | ||
}); | ||
var pipeline = justCurryIt((fns, doc) => { | ||
return fns.reduce(async (acc, fn) => fn(await acc), doc); | ||
}); | ||
var all = (doc) => Promise.all(doc); | ||
var allValues = (doc) => { | ||
return pipeline([ | ||
entries$1, | ||
reduce$1(async (acc, [propertyName, propertyValue]) => { | ||
acc[propertyName] = await propertyValue; | ||
return acc; | ||
}, {}) | ||
], doc); | ||
}; | ||
var lib = { | ||
entries: entries$1, | ||
map: map$1, | ||
filter: filter$1, | ||
reduce: reduce$1, | ||
some: some$1, | ||
every: every$1, | ||
pipeline: pipeline, | ||
all: all, | ||
allValues: allValues | ||
}; | ||
var urlResolveBrowser = urlResolve; | ||
@@ -1213,7 +1282,14 @@ | ||
const entries$1 = (doc) => Object.keys(value$1(doc)) | ||
.map(async (key) => [key, await step$1(key, doc)]); | ||
const entries$2 = (doc) => lib.pipeline([ | ||
value$1, | ||
Object.keys, | ||
lib.map(async (key) => [key, await step$1(key, doc)]), | ||
lib.all | ||
], doc); | ||
const map$1 = justCurryIt((fn, doc) => value$1(doc) | ||
.map(async (item, ndx) => fn(await step$1(ndx, doc), ndx))); | ||
const map$2 = justCurryIt((fn, doc) => lib.pipeline([ | ||
value$1, | ||
lib.map(async (item, ndx) => fn(await step$1(ndx, doc), ndx)), | ||
lib.all | ||
], doc)); | ||
@@ -1223,3 +1299,3 @@ var schema = { | ||
add, get: get$2, markValidated, | ||
uri: uri$1, value: value$1, has, step: step$1, entries: entries$1, map: map$1 | ||
uri: uri$1, value: value$1, has, step: step$1, entries: entries$2, map: map$2 | ||
}; | ||
@@ -1390,71 +1466,2 @@ | ||
var entries$2 = async (doc) => Object.entries(await doc); | ||
var map$2 = justCurryIt(async (fn, doc) => (await doc).map(fn)); | ||
var reduce$1 = justCurryIt(async (fn, acc, doc) => { | ||
return (await doc).reduce(async (acc, item) => { | ||
let resolvedAcc; | ||
try { | ||
resolvedAcc = await acc; | ||
} catch (e) { | ||
try { | ||
await item; | ||
} catch (e) { | ||
// If we've already encountered an error, ignore subsequent errors. | ||
} | ||
return acc; | ||
} | ||
return fn(resolvedAcc, item); | ||
}, acc); | ||
}); | ||
var filter$1 = justCurryIt(async (fn, doc, options = {}) => { | ||
return reduce$1(async (acc, item) => { | ||
return (await fn(item)) ? acc.concat([item]) : acc; | ||
}, [], doc, options); | ||
}); | ||
var some$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$2(fn, doc); | ||
return (await Promise.all(results)) | ||
.some((a) => a); | ||
}); | ||
var every$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$2(fn, doc); | ||
return (await Promise.all(results)) | ||
.every((a) => a); | ||
}); | ||
var pipeline = justCurryIt((fns, doc) => { | ||
return fns.reduce(async (acc, fn) => fn(await acc), doc); | ||
}); | ||
var all = (doc) => Promise.all(doc); | ||
var allValues = (doc) => { | ||
return pipeline([ | ||
entries$2, | ||
reduce$1(async (acc, [propertyName, propertyValue]) => { | ||
acc[propertyName] = await propertyValue; | ||
return acc; | ||
}, {}) | ||
], doc); | ||
}; | ||
var lib = { | ||
entries: entries$2, | ||
map: map$2, | ||
filter: filter$1, | ||
reduce: reduce$1, | ||
some: some$1, | ||
every: every$1, | ||
pipeline: pipeline, | ||
all: all, | ||
allValues: allValues | ||
}; | ||
const compile$2 = async (schema$1, ast) => { | ||
@@ -1470,14 +1477,5 @@ const url = schema.uri(schema$1); | ||
schema.entries, | ||
lib.map(async (entry) => { | ||
const [keyword, keywordSchema] = await entry; | ||
const keywordId = `${schema$1.schemaVersion}#${keyword}`; | ||
return [keywordId, keywordSchema]; | ||
}), | ||
lib.filter(async (entry) => { | ||
const [keywordId] = await entry; | ||
return core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`; | ||
}), | ||
lib.map(async (entry) => { | ||
const [keywordId, keywordSchemaPromise] = await entry; | ||
const keywordSchema = await keywordSchemaPromise; | ||
lib.map(([keyword, keywordSchema]) => [`${schema$1.schemaVersion}#${keyword}`, keywordSchema]), | ||
lib.filter(([keywordId]) => core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`), | ||
lib.map(async ([keywordId, keywordSchema]) => { | ||
const keywordAst = await core.getKeyword(keywordId).compile(keywordSchema, ast, schema$1); | ||
@@ -1484,0 +1482,0 @@ return [keywordId, schema.uri(keywordSchema), keywordAst]; |
@@ -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)}};var y={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==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{splitUrl:v}=y,b=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=b)=>Object.freeze({...t,pointer:v(e)[1]}),m=e=>h.get(e.pointer,e.instance),g=(e,t)=>{const r=h.append(e,t.pointer);return w("#"+encodeURI(r),t)},O=r((e,t)=>m(t).map((r,n)=>e(g(n,t),n))),E=r((e,t)=>m(t).map((e,r)=>g(r,t)).filter((t,r)=>e(t,r))),$=r((e,t,r)=>m(r).reduce((t,n,o)=>e(t,g(o,r),o),t)),x=r((e,t)=>Object.keys(m(t)).every((r,n)=>e(g(r,t),n))),P=r((e,t)=>Object.keys(m(t)).some((r,n)=>e(g(r,t),n)));var j={cons:(e,t="")=>Object.freeze({...b,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:m,step:g,entries:e=>Object.keys(m(e)).map(t=>[t,g(t,e)]),map:O,filter:E,reduce:$,every:x,some:P},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,S=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,I=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,V=/\\([\u000b\u0020-\u00ff])/g,T=/([\\"])/g,k=/^[!#$%&'*+.^_`|~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)}};var y={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==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{splitUrl:v}=y,b=Object.freeze({id:"",pointer:"",instance:void 0}),m=(e,t=b)=>Object.freeze({...t,pointer:v(e)[1]}),w=e=>h.get(e.pointer,e.instance),g=(e,t)=>{const r=h.append(e,t.pointer);return m("#"+encodeURI(r),t)},O=r((e,t)=>w(t).map((r,n)=>e(g(n,t),n))),E=r((e,t)=>w(t).map((e,r)=>g(r,t)).filter((t,r)=>e(t,r))),$=r((e,t,r)=>w(r).reduce((t,n,o)=>e(t,g(o,r),o),t)),x=r((e,t)=>Object.keys(w(t)).every((r,n)=>e(g(r,t),n))),P=r((e,t)=>Object.keys(w(t)).some((r,n)=>e(g(r,t),n)));var j={cons:(e,t="")=>Object.freeze({...b,id:t,instance:e}),get:m,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:w,step:g,entries:e=>Object.keys(w(e)).map(t=>[t,g(t,e)]),map:O,filter:E,reduce:$,every:x,some:P},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,S=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,I=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,V=/\\([\u000b\u0020-\u00ff])/g,T=/([\\"])/g,k=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function R(e){var t=String(e);if(I.test(t))return t;if(t.length>0&&!S.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(T,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!k.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],!I.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+R(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(!k.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=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(V,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},C=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(z.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)?U(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+q(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=q(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:U(e)}};function U(e){return e+("/"===e[e.length-1]?"":"/")}function q(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 z=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var W=fetch;const{isObject:_,splitUrl:B}=y,D=Symbol("$__jref"),F={},Z={},M=(e,t)=>{const r=e in Z?Z[e]:e;if(r in F)return F[r][t]},N={},J={},G=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=B(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=M(n,"idToken"),i=B(t)[0],a=Y(i,e[o]||""),s=B(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(J[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,M(n,"vocabulary")&&_(e)&&"$vocabulary"in e?(Z[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};N[s]={id:s,schemaVersion:n,schema:H(e,s,n,h.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},H=(e,t,r,n,o)=>{if(_(e)){const i=M(r,"idToken"),a=M(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=Y(t,n),[s,c]=B(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return G(e,Y(t,s),r),{[D]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=H(a,t,r,h.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>H(e,t,r,h.append(i,n),o)):e},Q=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),X=async(e,t=Q,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:re(t),o=Y(n,e),[i,a]=B(o);if(!(e=>e in N||e in J)(i)){const e=await W(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=L.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}`)}G(await e.json(),i)}const s=(e=>N[J[e]]||N[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?te(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=ne(c);return _(u)&&D in u?X(u[D],c):M(c.schemaVersion,"jsonReference")&&_(u)&&"string"==typeof u.$ref?X(u.$ref,c):M(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?X(u,c):M(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?X(u,c,!0):c},Y=(e,t)=>{const r=C(e,t),n=B(e)[0];if(n&&"file"===ee(r)&&"file"!==ee(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ee=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},te=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},re=e=>`${e.id}#${encodeURI(e.pointer)}`,ne=e=>h.get(e.pointer,e.schema),oe=(e,t)=>{const r=h.append(e,t.pointer);return X("#"+encodeURI(r),t)},ie=r((e,t)=>ne(t).map(async(r,n)=>e(await oe(n,t),n)));var ae={setConfig:(e,t,r)=>{F[e]||(F[e]={}),F[e][t]=r},getConfig:M,add:G,get:X,markValidated:e=>{N[e].validated=!0},uri:re,value:ne,has:(e,t)=>e in ne(t),step:oe,entries:e=>Object.keys(ne(e)).map(async t=>[t,await oe(t,e)]),map:ie};const se="FLAG",ce="BASIC",ue="DETAILED",le="VERBOSE";let fe=ue,de=!0;const pe=(e,r)=>(n,o=se)=>{if(![se,ce,ue,le].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=t.subscribe("result",he(o,i));return $e(r,n,e),t.unsubscribe(a),i[0]},he=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ye(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ce&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),ve(i))break}(e===le||e!==se&&!i.valid)&&r.push(i),t[0]=i}},ye=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||ve(e)),ve=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),be={},we=e=>be[e],me=e=>e in be,ge={},Oe={},Ee=async(e,t)=>{if(!me(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 ge)Object.entries(ge[e]).forEach(([e,r])=>{((e,t)=>{be[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(de&&!e.validated){if(ae.markValidated(e.id),!(e.schemaVersion in Oe)){const t=await ae.get(e.schemaVersion),r={},n=await Ee(t,r);Oe[t.id]=pe(r,n)}const t=j.cons(e.schema,e.id),r=Oe[e.schemaVersion](t,fe);if(!r.valid)throw r}return await we(e.schemaVersion+"#validate").compile(e,t),ae.uri(e)},$e=(e,t,r)=>{const[n]=r[e];return we(n).interpret(e,t,r)};var xe={validate:async(e,t,r)=>{const n={},o=await Ee(e,n),i=(e,t=se)=>pe(n,o)(j.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{fe=e},setShouldMetaValidate:e=>{de=e},FLAG:se,BASIC:ce,DETAILED:ue,VERBOSE:le,getKeyword:we,hasKeyword:me,defineVocabulary:(e,t)=>{ge[e]=t},compileSchema:Ee,interpretSchema:$e,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedItems(e,t,r,n)}};var Pe={compile:()=>{},interpret:()=>!0},je=async e=>Object.entries(await e),Ae=r(async(e,t)=>(await t).map(e)),Se=r(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),Ie=r(async(e,t,r={})=>Se(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Ve=r(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).some(e=>e)}),Te=r(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).every(e=>e)}),ke=r((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Re={entries:je,map:Ae,filter:Ie,reduce:Se,some:Ve,every:Te,pipeline:ke,all:e=>Promise.all(e),allValues:e=>ke([je,Se(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ke={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 Re.pipeline([ae.entries,Re.map(async t=>{const[r,n]=await t;return[`${e.schemaVersion}#${r}`,n]}),Re.filter(async t=>{const[r]=await t;return xe.hasKeyword(r)&&r!==e.schemaVersion+"#validate"}),Re.map(async r=>{const[n,o]=await r,i=await o,a=await xe.getKeyword(n).compile(i,t,e);return[n,ae.uri(i),a]}),Re.all],e)]}},interpret:(e,r,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=xe.getKeyword(e).interpret(i,r,n);return t.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:j.uri(r),valid:a}),a});return t.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:j.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&&xe.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&&xe.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:xe,Schema:ae,Instance:j,Keywords:{metaData:Pe,validate:Ke}},Ce=Le.Core,Ue=Le.Schema,qe=Le.Instance,ze=Le.Keywords;export default Le;export{Ce as Core,qe as Instance,ze as Keywords,Ue as Schema}; | ||
*/function R(e){var t=String(e);if(I.test(t))return t;if(t.length>0&&!S.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(T,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!k.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],!I.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+R(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(!k.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=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(V,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},C=async e=>Object.entries(await e),U=r(async(e,t)=>(await t).map(e)),q=r(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),z=r(async(e,t,r={})=>q(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),W=r(async(e,t)=>{const r=await U(e,t);return(await Promise.all(r)).some(e=>e)}),_=r(async(e,t)=>{const r=await U(e,t);return(await Promise.all(r)).every(e=>e)}),B=r((e,t)=>e.reduce(async(e,t)=>t(await e),t)),D={entries:C,map:U,filter:z,reduce:q,some:W,every:_,pipeline:B,all:e=>Promise.all(e),allValues:e=>B([C,q(async(e,[t,r])=>(e[t]=await r,e),{})],e)},F=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(N.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)?Z(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+M(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=M(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:Z(e)}};function Z(e){return e+("/"===e[e.length-1]?"":"/")}function M(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 N=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var J=fetch;const{isObject:G,splitUrl:H}=y,Q=Symbol("$__jref"),X={},Y={},ee=(e,t)=>{const r=e in Y?Y[e]:e;if(r in X)return X[r][t]},te={},re={},ne=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=H(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ee(n,"idToken"),i=H(t)[0],a=se(i,e[o]||""),s=H(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(re[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,ee(n,"vocabulary")&&G(e)&&"$vocabulary"in e?(Y[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};te[s]={id:s,schemaVersion:n,schema:oe(e,s,n,h.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},oe=(e,t,r,n,o)=>{if(G(e)){const i=ee(r,"idToken"),a=ee(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=se(t,n),[s,c]=H(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return ne(e,se(t,s),r),{[Q]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=oe(a,t,r,h.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>oe(e,t,r,h.append(i,n),o)):e},ie=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),ae=async(e,t=ie,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:le(t),o=se(n,e),[i,a]=H(o);if(!(e=>e in te||e in re)(i)){const e=await J(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=L.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}`)}ne(await e.json(),i)}const s=(e=>te[re[e]]||te[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?ue(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=fe(c);return G(u)&&Q in u?ae(u[Q],c):ee(c.schemaVersion,"jsonReference")&&G(u)&&"string"==typeof u.$ref?ae(u.$ref,c):ee(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?ae(u,c):ee(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?ae(u,c,!0):c},se=(e,t)=>{const r=F(e,t),n=H(e)[0];if(n&&"file"===ce(r)&&"file"!==ce(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ce=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ue=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},le=e=>`${e.id}#${encodeURI(e.pointer)}`,fe=e=>h.get(e.pointer,e.schema),de=(e,t)=>{const r=h.append(e,t.pointer);return ae("#"+encodeURI(r),t)},pe=r((e,t)=>D.pipeline([fe,D.map(async(r,n)=>e(await de(n,t),n)),D.all],t));var he={setConfig:(e,t,r)=>{X[e]||(X[e]={}),X[e][t]=r},getConfig:ee,add:ne,get:ae,markValidated:e=>{te[e].validated=!0},uri:le,value:fe,has:(e,t)=>e in fe(t),step:de,entries:e=>D.pipeline([fe,Object.keys,D.map(async t=>[t,await de(t,e)]),D.all],e),map:pe};const ye="FLAG",ve="BASIC",be="DETAILED",me="VERBOSE";let we=be,ge=!0;const Oe=(e,r)=>(n,o=ye)=>{if(![ye,ve,be,me].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=t.subscribe("result",Ee(o,i));return Te(r,n,e),t.unsubscribe(a),i[0]},Ee=(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===ve&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),xe(i))break}(e===me||e!==ye&&!i.valid)&&r.push(i),t[0]=i}},$e=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||xe(e)),xe=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),Pe={},je=e=>Pe[e],Ae=e=>e in Pe,Se={},Ie={},Ve=async(e,t)=>{if(!Ae(e.schemaVersion+"#validate")){const t=await he.get(e.schemaVersion);(he.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 Se)Object.entries(Se[e]).forEach(([e,r])=>{((e,t)=>{Pe[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(ge&&!e.validated){if(he.markValidated(e.id),!(e.schemaVersion in Ie)){const t=await he.get(e.schemaVersion),r={},n=await Ve(t,r);Ie[t.id]=Oe(r,n)}const t=j.cons(e.schema,e.id),r=Ie[e.schemaVersion](t,we);if(!r.valid)throw r}return await je(e.schemaVersion+"#validate").compile(e,t),he.uri(e)},Te=(e,t,r)=>{const[n]=r[e];return je(n).interpret(e,t,r)};var ke={validate:async(e,t,r)=>{const n={},o=await Ve(e,n),i=(e,t=ye)=>Oe(n,o)(j.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{we=e},setShouldMetaValidate:e=>{ge=e},FLAG:ye,BASIC:ve,DETAILED:be,VERBOSE:me,getKeyword:je,hasKeyword:Ae,defineVocabulary:(e,t)=>{Se[e]=t},compileSchema:Ve,interpretSchema:Te,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return je(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return je(o).collectEvaluatedItems(e,t,r,n)}};var Re={compile:async(e,t)=>{const r=he.uri(e);if(!(r in t)){t[r]=!1;const n=he.value(e);t[r]=[e.schemaVersion+"#validate",he.uri(e),"boolean"==typeof n?n:await D.pipeline([he.entries,D.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),D.filter(([t])=>ke.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),D.map(async([r,n])=>{const o=await ke.getKeyword(r).compile(n,t,e);return[r,he.uri(n),o]}),D.all],e)]}},interpret:(e,r,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=ke.getKeyword(e).interpret(i,r,n);return t.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:j.uri(r),valid:a}),a});return t.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:j.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&&ke.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&&ke.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ke={Core:ke,Schema:he,Instance:j,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Re}},Le=Ke.Core,Ce=Ke.Schema,Ue=Ke.Instance,qe=Ke.Keywords;export default Ke;export{Le as Core,Ue as Instance,qe as Keywords,Ce as Schema}; | ||
//# sourceMappingURL=json-schema-core-esm.min.js.map |
@@ -794,2 +794,71 @@ var JSC = (function (exports) { | ||
var entries$1 = async (doc) => Object.entries(await doc); | ||
var map$1 = justCurryIt(async (fn, doc) => (await doc).map(fn)); | ||
var reduce$1 = justCurryIt(async (fn, acc, doc) => { | ||
return (await doc).reduce(async (acc, item) => { | ||
let resolvedAcc; | ||
try { | ||
resolvedAcc = await acc; | ||
} catch (e) { | ||
try { | ||
await item; | ||
} catch (e) { | ||
// If we've already encountered an error, ignore subsequent errors. | ||
} | ||
return acc; | ||
} | ||
return fn(resolvedAcc, item); | ||
}, acc); | ||
}); | ||
var filter$1 = justCurryIt(async (fn, doc, options = {}) => { | ||
return reduce$1(async (acc, item) => { | ||
return (await fn(item)) ? acc.concat([item]) : acc; | ||
}, [], doc, options); | ||
}); | ||
var some$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$1(fn, doc); | ||
return (await Promise.all(results)) | ||
.some((a) => a); | ||
}); | ||
var every$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$1(fn, doc); | ||
return (await Promise.all(results)) | ||
.every((a) => a); | ||
}); | ||
var pipeline = justCurryIt((fns, doc) => { | ||
return fns.reduce(async (acc, fn) => fn(await acc), doc); | ||
}); | ||
var all = (doc) => Promise.all(doc); | ||
var allValues = (doc) => { | ||
return pipeline([ | ||
entries$1, | ||
reduce$1(async (acc, [propertyName, propertyValue]) => { | ||
acc[propertyName] = await propertyValue; | ||
return acc; | ||
}, {}) | ||
], doc); | ||
}; | ||
var lib = { | ||
entries: entries$1, | ||
map: map$1, | ||
filter: filter$1, | ||
reduce: reduce$1, | ||
some: some$1, | ||
every: every$1, | ||
pipeline: pipeline, | ||
all: all, | ||
allValues: allValues | ||
}; | ||
var urlResolveBrowser = urlResolve; | ||
@@ -1216,7 +1285,14 @@ | ||
const entries$1 = (doc) => Object.keys(value$1(doc)) | ||
.map(async (key) => [key, await step$1(key, doc)]); | ||
const entries$2 = (doc) => lib.pipeline([ | ||
value$1, | ||
Object.keys, | ||
lib.map(async (key) => [key, await step$1(key, doc)]), | ||
lib.all | ||
], doc); | ||
const map$1 = justCurryIt((fn, doc) => value$1(doc) | ||
.map(async (item, ndx) => fn(await step$1(ndx, doc), ndx))); | ||
const map$2 = justCurryIt((fn, doc) => lib.pipeline([ | ||
value$1, | ||
lib.map(async (item, ndx) => fn(await step$1(ndx, doc), ndx)), | ||
lib.all | ||
], doc)); | ||
@@ -1226,3 +1302,3 @@ var schema = { | ||
add, get: get$2, markValidated, | ||
uri: uri$1, value: value$1, has, step: step$1, entries: entries$1, map: map$1 | ||
uri: uri$1, value: value$1, has, step: step$1, entries: entries$2, map: map$2 | ||
}; | ||
@@ -1393,71 +1469,2 @@ | ||
var entries$2 = async (doc) => Object.entries(await doc); | ||
var map$2 = justCurryIt(async (fn, doc) => (await doc).map(fn)); | ||
var reduce$1 = justCurryIt(async (fn, acc, doc) => { | ||
return (await doc).reduce(async (acc, item) => { | ||
let resolvedAcc; | ||
try { | ||
resolvedAcc = await acc; | ||
} catch (e) { | ||
try { | ||
await item; | ||
} catch (e) { | ||
// If we've already encountered an error, ignore subsequent errors. | ||
} | ||
return acc; | ||
} | ||
return fn(resolvedAcc, item); | ||
}, acc); | ||
}); | ||
var filter$1 = justCurryIt(async (fn, doc, options = {}) => { | ||
return reduce$1(async (acc, item) => { | ||
return (await fn(item)) ? acc.concat([item]) : acc; | ||
}, [], doc, options); | ||
}); | ||
var some$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$2(fn, doc); | ||
return (await Promise.all(results)) | ||
.some((a) => a); | ||
}); | ||
var every$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$2(fn, doc); | ||
return (await Promise.all(results)) | ||
.every((a) => a); | ||
}); | ||
var pipeline = justCurryIt((fns, doc) => { | ||
return fns.reduce(async (acc, fn) => fn(await acc), doc); | ||
}); | ||
var all = (doc) => Promise.all(doc); | ||
var allValues = (doc) => { | ||
return pipeline([ | ||
entries$2, | ||
reduce$1(async (acc, [propertyName, propertyValue]) => { | ||
acc[propertyName] = await propertyValue; | ||
return acc; | ||
}, {}) | ||
], doc); | ||
}; | ||
var lib = { | ||
entries: entries$2, | ||
map: map$2, | ||
filter: filter$1, | ||
reduce: reduce$1, | ||
some: some$1, | ||
every: every$1, | ||
pipeline: pipeline, | ||
all: all, | ||
allValues: allValues | ||
}; | ||
const compile$2 = async (schema$1, ast) => { | ||
@@ -1473,14 +1480,5 @@ const url = schema.uri(schema$1); | ||
schema.entries, | ||
lib.map(async (entry) => { | ||
const [keyword, keywordSchema] = await entry; | ||
const keywordId = `${schema$1.schemaVersion}#${keyword}`; | ||
return [keywordId, keywordSchema]; | ||
}), | ||
lib.filter(async (entry) => { | ||
const [keywordId] = await entry; | ||
return core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`; | ||
}), | ||
lib.map(async (entry) => { | ||
const [keywordId, keywordSchemaPromise] = await entry; | ||
const keywordSchema = await keywordSchemaPromise; | ||
lib.map(([keyword, keywordSchema]) => [`${schema$1.schemaVersion}#${keyword}`, keywordSchema]), | ||
lib.filter(([keywordId]) => core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`), | ||
lib.map(async ([keywordId, keywordSchema]) => { | ||
const keywordAst = await core.getKeyword(keywordId).compile(keywordSchema, ast, schema$1); | ||
@@ -1487,0 +1485,0 @@ return [keywordId, schema.uri(keywordSchema), keywordAst]; |
@@ -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)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==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{splitUrl:b}=v,w=Object.freeze({id:"",pointer:"",instance:void 0}),m=(e,t=w)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return m("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),P=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),j=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),x=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var A={cons:(e,t="")=>Object.freeze({...w,id:t,instance:e}),get:m,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:P,every:j,some:x},S=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~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)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==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{splitUrl:b}=v,m=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=m)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return w("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),P=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),j=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),x=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var A={cons:(e,t="")=>Object.freeze({...m,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:P,every:j,some:x},S=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.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],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(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(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.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(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=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(W.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)?q(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+z(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=z(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:q(e)}};function q(e){return e+("/"===e[e.length-1]?"":"/")}function z(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 W=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var _=fetch;const{isObject:B,splitUrl:D}=v,F=Symbol("$__jref"),Z={},J={},M=(e,t)=>{const r=e in J?J[e]:e;if(r in Z)return Z[r][t]},N={},G={},H=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=D(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=M(n,"idToken"),i=D(t)[0],a=ee(i,e[o]||""),s=D(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(G[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,M(n,"vocabulary")&&B(e)&&"$vocabulary"in e?(J[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};N[s]={id:s,schemaVersion:n,schema:Q(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},Q=(e,t,r,n,o)=>{if(B(e)){const i=M(r,"idToken"),a=M(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ee(t,n),[s,c]=D(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return H(e,ee(t,s),r),{[F]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=Q(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>Q(e,t,r,y.append(i,n),o)):e},X=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),Y=async(e,t=X,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:ne(t),o=ee(n,e),[i,a]=D(o);if(!(e=>e in N||e in G)(i)){const e=await _(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=L.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}`)}H(await e.json(),i)}const s=(e=>N[G[e]]||N[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?re(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=oe(c);return B(u)&&F in u?Y(u[F],c):M(c.schemaVersion,"jsonReference")&&B(u)&&"string"==typeof u.$ref?Y(u.$ref,c):M(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?Y(u,c):M(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?Y(u,c,!0):c},ee=(e,t)=>{const r=U(e,t),n=D(e)[0];if(n&&"file"===te(r)&&"file"!==te(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},te=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},re=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ne=e=>`${e.id}#${encodeURI(e.pointer)}`,oe=e=>y.get(e.pointer,e.schema),ie=(e,t)=>{const r=y.append(e,t.pointer);return Y("#"+encodeURI(r),t)},ae=n((e,t)=>oe(t).map(async(r,n)=>e(await ie(n,t),n)));var se={setConfig:(e,t,r)=>{Z[e]||(Z[e]={}),Z[e][t]=r},getConfig:M,add:H,get:Y,markValidated:e=>{N[e].validated=!0},uri:ne,value:oe,has:(e,t)=>e in oe(t),step:ie,entries:e=>Object.keys(oe(e)).map(async t=>[t,await ie(t,e)]),map:ae};const ce="FLAG",ue="BASIC",le="DETAILED",fe="VERBOSE";let de=le,pe=!0;const he=(e,t)=>(n,o=ce)=>{if(![ce,ue,le,fe].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",ye(o,i));return Pe(t,n,e),r.unsubscribe(a),i[0]},ye=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ve(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ue&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),be(i))break}(e===fe||e!==ce&&!i.valid)&&r.push(i),t[0]=i}},ve=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||be(e)),be=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),we={},me=e=>we[e],ge=e=>e in we,Oe={},Ee={},$e=async(e,t)=>{if(!ge(e.schemaVersion+"#validate")){const t=await se.get(e.schemaVersion);(se.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 Oe)Object.entries(Oe[e]).forEach(([e,r])=>{((e,t)=>{we[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(pe&&!e.validated){if(se.markValidated(e.id),!(e.schemaVersion in Ee)){const t=await se.get(e.schemaVersion),r={},n=await $e(t,r);Ee[t.id]=he(r,n)}const t=A.cons(e.schema,e.id),r=Ee[e.schemaVersion](t,de);if(!r.valid)throw r}return await me(e.schemaVersion+"#validate").compile(e,t),se.uri(e)},Pe=(e,t,r)=>{const[n]=r[e];return me(n).interpret(e,t,r)};var je={validate:async(e,t,r)=>{const n={},o=await $e(e,n),i=(e,t=ce)=>he(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{de=e},setShouldMetaValidate:e=>{pe=e},FLAG:ce,BASIC:ue,DETAILED:le,VERBOSE:fe,getKeyword:me,hasKeyword:ge,defineVocabulary:(e,t)=>{Oe[e]=t},compileSchema:$e,interpretSchema:Pe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return me(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return me(o).collectEvaluatedItems(e,t,r,n)}};var xe={compile:()=>{},interpret:()=>!0},Ae=async e=>Object.entries(await e),Se=n(async(e,t)=>(await t).map(e)),Ie=n(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),Ve=n(async(e,t,r={})=>Ie(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Te=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).some(e=>e)}),ke=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).every(e=>e)}),Re=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ce={entries:Ae,map:Se,filter:Ve,reduce:Ie,some:Te,every:ke,pipeline:Re,all:e=>Promise.all(e),allValues:e=>Re([Ae,Ie(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ke={compile:async(e,t)=>{const r=se.uri(e);if(!(r in t)){t[r]=!1;const n=se.value(e);t[r]=[e.schemaVersion+"#validate",se.uri(e),"boolean"==typeof n?n:await Ce.pipeline([se.entries,Ce.map(async t=>{const[r,n]=await t;return[`${e.schemaVersion}#${r}`,n]}),Ce.filter(async t=>{const[r]=await t;return je.hasKeyword(r)&&r!==e.schemaVersion+"#validate"}),Ce.map(async r=>{const[n,o]=await r,i=await o,a=await je.getKeyword(n).compile(i,t,e);return[n,se.uri(i),a]}),Ce.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:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.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)}},Le={Core:je,Schema:se,Instance:A,Keywords:{metaData:xe,validate:Ke}},Ue=Le.Core,qe=Le.Schema,ze=Le.Instance,We=Le.Keywords;return e.Core=Ue,e.Instance=ze,e.Keywords=We,e.Schema=qe,e.default=Le,e}({}); | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.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],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(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(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.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(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=async e=>Object.entries(await e),q=n(async(e,t)=>(await t).map(e)),z=n(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),W=n(async(e,t,r={})=>z(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),_=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).some(e=>e)}),B=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).every(e=>e)}),D=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),F={entries:U,map:q,filter:W,reduce:z,some:_,every:B,pipeline:D,all:e=>Promise.all(e),allValues:e=>D([U,z(async(e,[t,r])=>(e[t]=await r,e),{})],e)},Z=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(N.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)?J(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+M(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=M(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:J(e)}};function J(e){return e+("/"===e[e.length-1]?"":"/")}function M(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 N=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var G=fetch;const{isObject:H,splitUrl:Q}=v,X=Symbol("$__jref"),Y={},ee={},te=(e,t)=>{const r=e in ee?ee[e]:e;if(r in Y)return Y[r][t]},re={},ne={},oe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=Q(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=te(n,"idToken"),i=Q(t)[0],a=ce(i,e[o]||""),s=Q(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(ne[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,te(n,"vocabulary")&&H(e)&&"$vocabulary"in e?(ee[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};re[s]={id:s,schemaVersion:n,schema:ie(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},ie=(e,t,r,n,o)=>{if(H(e)){const i=te(r,"idToken"),a=te(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ce(t,n),[s,c]=Q(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return oe(e,ce(t,s),r),{[X]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=ie(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>ie(e,t,r,y.append(i,n),o)):e},ae=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),se=async(e,t=ae,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:fe(t),o=ce(n,e),[i,a]=Q(o);if(!(e=>e in re||e in ne)(i)){const e=await G(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=L.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}`)}oe(await e.json(),i)}const s=(e=>re[ne[e]]||re[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?le(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=de(c);return H(u)&&X in u?se(u[X],c):te(c.schemaVersion,"jsonReference")&&H(u)&&"string"==typeof u.$ref?se(u.$ref,c):te(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?se(u,c):te(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?se(u,c,!0):c},ce=(e,t)=>{const r=Z(e,t),n=Q(e)[0];if(n&&"file"===ue(r)&&"file"!==ue(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ue=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},le=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},fe=e=>`${e.id}#${encodeURI(e.pointer)}`,de=e=>y.get(e.pointer,e.schema),pe=(e,t)=>{const r=y.append(e,t.pointer);return se("#"+encodeURI(r),t)},he=n((e,t)=>F.pipeline([de,F.map(async(r,n)=>e(await pe(n,t),n)),F.all],t));var ye={setConfig:(e,t,r)=>{Y[e]||(Y[e]={}),Y[e][t]=r},getConfig:te,add:oe,get:se,markValidated:e=>{re[e].validated=!0},uri:fe,value:de,has:(e,t)=>e in de(t),step:pe,entries:e=>F.pipeline([de,Object.keys,F.map(async t=>[t,await pe(t,e)]),F.all],e),map:he};const ve="FLAG",be="BASIC",me="DETAILED",we="VERBOSE";let ge=me,Oe=!0;const Ee=(e,t)=>(n,o=ve)=>{if(![ve,be,me,we].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",$e(o,i));return ke(t,n,e),r.unsubscribe(a),i[0]},$e=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&Pe(r[r.length-1],i);){const t=r.pop();let n=[];if(e===be&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),je(i))break}(e===we||e!==ve&&!i.valid)&&r.push(i),t[0]=i}},Pe=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||je(e)),je=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),xe={},Ae=e=>xe[e],Se=e=>e in xe,Ie={},Ve={},Te=async(e,t)=>{if(!Se(e.schemaVersion+"#validate")){const t=await ye.get(e.schemaVersion);(ye.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 Ie)Object.entries(Ie[e]).forEach(([e,r])=>{((e,t)=>{xe[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(Oe&&!e.validated){if(ye.markValidated(e.id),!(e.schemaVersion in Ve)){const t=await ye.get(e.schemaVersion),r={},n=await Te(t,r);Ve[t.id]=Ee(r,n)}const t=A.cons(e.schema,e.id),r=Ve[e.schemaVersion](t,ge);if(!r.valid)throw r}return await Ae(e.schemaVersion+"#validate").compile(e,t),ye.uri(e)},ke=(e,t,r)=>{const[n]=r[e];return Ae(n).interpret(e,t,r)};var Re={validate:async(e,t,r)=>{const n={},o=await Te(e,n),i=(e,t=ve)=>Ee(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{ge=e},setShouldMetaValidate:e=>{Oe=e},FLAG:ve,BASIC:be,DETAILED:me,VERBOSE:we,getKeyword:Ae,hasKeyword:Se,defineVocabulary:(e,t)=>{Ie[e]=t},compileSchema:Te,interpretSchema:ke,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Ae(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Ae(o).collectEvaluatedItems(e,t,r,n)}};var Ce={compile:async(e,t)=>{const r=ye.uri(e);if(!(r in t)){t[r]=!1;const n=ye.value(e);t[r]=[e.schemaVersion+"#validate",ye.uri(e),"boolean"==typeof n?n:await F.pipeline([ye.entries,F.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),F.filter(([t])=>Re.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),F.map(async([r,n])=>{const o=await Re.getKeyword(r).compile(n,t,e);return[r,ye.uri(n),o]}),F.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Re.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.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&&Re.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&&Re.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ke={Core:Re,Schema:ye,Instance:A,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Ce}},Le=Ke.Core,Ue=Ke.Schema,qe=Ke.Instance,ze=Ke.Keywords;return e.Core=Le,e.Instance=qe,e.Keywords=ze,e.Schema=Ue,e.default=Ke,e}({}); | ||
//# sourceMappingURL=json-schema-core-iife.min.js.map |
@@ -796,2 +796,71 @@ System.register('JSC', [], function (exports) { | ||
var entries$1 = async (doc) => Object.entries(await doc); | ||
var map$1 = justCurryIt(async (fn, doc) => (await doc).map(fn)); | ||
var reduce$1 = justCurryIt(async (fn, acc, doc) => { | ||
return (await doc).reduce(async (acc, item) => { | ||
let resolvedAcc; | ||
try { | ||
resolvedAcc = await acc; | ||
} catch (e) { | ||
try { | ||
await item; | ||
} catch (e) { | ||
// If we've already encountered an error, ignore subsequent errors. | ||
} | ||
return acc; | ||
} | ||
return fn(resolvedAcc, item); | ||
}, acc); | ||
}); | ||
var filter$1 = justCurryIt(async (fn, doc, options = {}) => { | ||
return reduce$1(async (acc, item) => { | ||
return (await fn(item)) ? acc.concat([item]) : acc; | ||
}, [], doc, options); | ||
}); | ||
var some$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$1(fn, doc); | ||
return (await Promise.all(results)) | ||
.some((a) => a); | ||
}); | ||
var every$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$1(fn, doc); | ||
return (await Promise.all(results)) | ||
.every((a) => a); | ||
}); | ||
var pipeline = justCurryIt((fns, doc) => { | ||
return fns.reduce(async (acc, fn) => fn(await acc), doc); | ||
}); | ||
var all = (doc) => Promise.all(doc); | ||
var allValues = (doc) => { | ||
return pipeline([ | ||
entries$1, | ||
reduce$1(async (acc, [propertyName, propertyValue]) => { | ||
acc[propertyName] = await propertyValue; | ||
return acc; | ||
}, {}) | ||
], doc); | ||
}; | ||
var lib = { | ||
entries: entries$1, | ||
map: map$1, | ||
filter: filter$1, | ||
reduce: reduce$1, | ||
some: some$1, | ||
every: every$1, | ||
pipeline: pipeline, | ||
all: all, | ||
allValues: allValues | ||
}; | ||
var urlResolveBrowser = urlResolve; | ||
@@ -1218,7 +1287,14 @@ | ||
const entries$1 = (doc) => Object.keys(value$1(doc)) | ||
.map(async (key) => [key, await step$1(key, doc)]); | ||
const entries$2 = (doc) => lib.pipeline([ | ||
value$1, | ||
Object.keys, | ||
lib.map(async (key) => [key, await step$1(key, doc)]), | ||
lib.all | ||
], doc); | ||
const map$1 = justCurryIt((fn, doc) => value$1(doc) | ||
.map(async (item, ndx) => fn(await step$1(ndx, doc), ndx))); | ||
const map$2 = justCurryIt((fn, doc) => lib.pipeline([ | ||
value$1, | ||
lib.map(async (item, ndx) => fn(await step$1(ndx, doc), ndx)), | ||
lib.all | ||
], doc)); | ||
@@ -1228,3 +1304,3 @@ var schema = { | ||
add, get: get$2, markValidated, | ||
uri: uri$1, value: value$1, has, step: step$1, entries: entries$1, map: map$1 | ||
uri: uri$1, value: value$1, has, step: step$1, entries: entries$2, map: map$2 | ||
}; | ||
@@ -1395,71 +1471,2 @@ | ||
var entries$2 = async (doc) => Object.entries(await doc); | ||
var map$2 = justCurryIt(async (fn, doc) => (await doc).map(fn)); | ||
var reduce$1 = justCurryIt(async (fn, acc, doc) => { | ||
return (await doc).reduce(async (acc, item) => { | ||
let resolvedAcc; | ||
try { | ||
resolvedAcc = await acc; | ||
} catch (e) { | ||
try { | ||
await item; | ||
} catch (e) { | ||
// If we've already encountered an error, ignore subsequent errors. | ||
} | ||
return acc; | ||
} | ||
return fn(resolvedAcc, item); | ||
}, acc); | ||
}); | ||
var filter$1 = justCurryIt(async (fn, doc, options = {}) => { | ||
return reduce$1(async (acc, item) => { | ||
return (await fn(item)) ? acc.concat([item]) : acc; | ||
}, [], doc, options); | ||
}); | ||
var some$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$2(fn, doc); | ||
return (await Promise.all(results)) | ||
.some((a) => a); | ||
}); | ||
var every$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$2(fn, doc); | ||
return (await Promise.all(results)) | ||
.every((a) => a); | ||
}); | ||
var pipeline = justCurryIt((fns, doc) => { | ||
return fns.reduce(async (acc, fn) => fn(await acc), doc); | ||
}); | ||
var all = (doc) => Promise.all(doc); | ||
var allValues = (doc) => { | ||
return pipeline([ | ||
entries$2, | ||
reduce$1(async (acc, [propertyName, propertyValue]) => { | ||
acc[propertyName] = await propertyValue; | ||
return acc; | ||
}, {}) | ||
], doc); | ||
}; | ||
var lib = { | ||
entries: entries$2, | ||
map: map$2, | ||
filter: filter$1, | ||
reduce: reduce$1, | ||
some: some$1, | ||
every: every$1, | ||
pipeline: pipeline, | ||
all: all, | ||
allValues: allValues | ||
}; | ||
const compile$2 = async (schema$1, ast) => { | ||
@@ -1475,14 +1482,5 @@ const url = schema.uri(schema$1); | ||
schema.entries, | ||
lib.map(async (entry) => { | ||
const [keyword, keywordSchema] = await entry; | ||
const keywordId = `${schema$1.schemaVersion}#${keyword}`; | ||
return [keywordId, keywordSchema]; | ||
}), | ||
lib.filter(async (entry) => { | ||
const [keywordId] = await entry; | ||
return core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`; | ||
}), | ||
lib.map(async (entry) => { | ||
const [keywordId, keywordSchemaPromise] = await entry; | ||
const keywordSchema = await keywordSchemaPromise; | ||
lib.map(([keyword, keywordSchema]) => [`${schema$1.schemaVersion}#${keyword}`, keywordSchema]), | ||
lib.filter(([keywordId]) => core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`), | ||
lib.map(async ([keywordId, keywordSchema]) => { | ||
const keywordAst = await core.getKeyword(keywordId).compile(keywordSchema, ast, schema$1); | ||
@@ -1489,0 +1487,0 @@ return [keywordId, schema.uri(keywordSchema), keywordAst]; |
@@ -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)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==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{splitUrl:b}=v,w=Object.freeze({id:"",pointer:"",instance:void 0}),m=(e,t=w)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return m("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),P=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),j=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),x=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var S={cons:(e,t="")=>Object.freeze({...w,id:t,instance:e}),get:m,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:P,every:j,some:x},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~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)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==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{splitUrl:b}=v,m=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=m)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return w("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),P=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),j=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),x=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var S={cons:(e,t="")=>Object.freeze({...m,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:P,every:j,some:x},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.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],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(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(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=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(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=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(W.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)?q(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+z(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=z(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:q(e)}};function q(e){return e+("/"===e[e.length-1]?"":"/")}function z(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 W=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var _=fetch;const{isObject:B,splitUrl:D}=v,F=Symbol("$__jref"),Z={},J={},M=(e,t)=>{const r=e in J?J[e]:e;if(r in Z)return Z[r][t]},N={},G={},H=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=D(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=M(n,"idToken"),i=D(t)[0],a=ee(i,e[o]||""),s=D(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(G[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,M(n,"vocabulary")&&B(e)&&"$vocabulary"in e?(J[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};N[s]={id:s,schemaVersion:n,schema:Q(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},Q=(e,t,r,n,o)=>{if(B(e)){const i=M(r,"idToken"),a=M(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ee(t,n),[s,c]=D(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return H(e,ee(t,s),r),{[F]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=Q(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>Q(e,t,r,y.append(i,n),o)):e},X=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),Y=async(e,t=X,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:ne(t),o=ee(n,e),[i,a]=D(o);if(!(e=>e in N||e in G)(i)){const e=await _(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=L.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}`)}H(await e.json(),i)}const s=(e=>N[G[e]]||N[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?re(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=oe(c);return B(u)&&F in u?Y(u[F],c):M(c.schemaVersion,"jsonReference")&&B(u)&&"string"==typeof u.$ref?Y(u.$ref,c):M(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?Y(u,c):M(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?Y(u,c,!0):c},ee=(e,t)=>{const r=U(e,t),n=D(e)[0];if(n&&"file"===te(r)&&"file"!==te(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},te=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},re=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ne=e=>`${e.id}#${encodeURI(e.pointer)}`,oe=e=>y.get(e.pointer,e.schema),ie=(e,t)=>{const r=y.append(e,t.pointer);return Y("#"+encodeURI(r),t)},ae=n((e,t)=>oe(t).map(async(r,n)=>e(await ie(n,t),n)));var se={setConfig:(e,t,r)=>{Z[e]||(Z[e]={}),Z[e][t]=r},getConfig:M,add:H,get:Y,markValidated:e=>{N[e].validated=!0},uri:ne,value:oe,has:(e,t)=>e in oe(t),step:ie,entries:e=>Object.keys(oe(e)).map(async t=>[t,await ie(t,e)]),map:ae};const ce="FLAG",ue="BASIC",le="DETAILED",fe="VERBOSE";let de=le,pe=!0;const he=(e,t)=>(n,o=ce)=>{if(![ce,ue,le,fe].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",ye(o,i));return Pe(t,n,e),r.unsubscribe(a),i[0]},ye=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ve(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ue&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),be(i))break}(e===fe||e!==ce&&!i.valid)&&r.push(i),t[0]=i}},ve=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||be(e)),be=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),we={},me=e=>we[e],ge=e=>e in we,Oe={},Ee={},$e=async(e,t)=>{if(!ge(e.schemaVersion+"#validate")){const t=await se.get(e.schemaVersion);(se.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 Oe)Object.entries(Oe[e]).forEach(([e,r])=>{((e,t)=>{we[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(pe&&!e.validated){if(se.markValidated(e.id),!(e.schemaVersion in Ee)){const t=await se.get(e.schemaVersion),r={},n=await $e(t,r);Ee[t.id]=he(r,n)}const t=S.cons(e.schema,e.id),r=Ee[e.schemaVersion](t,de);if(!r.valid)throw r}return await me(e.schemaVersion+"#validate").compile(e,t),se.uri(e)},Pe=(e,t,r)=>{const[n]=r[e];return me(n).interpret(e,t,r)};var je={validate:async(e,t,r)=>{const n={},o=await $e(e,n),i=(e,t=ce)=>he(n,o)(S.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{de=e},setShouldMetaValidate:e=>{pe=e},FLAG:ce,BASIC:ue,DETAILED:le,VERBOSE:fe,getKeyword:me,hasKeyword:ge,defineVocabulary:(e,t)=>{Oe[e]=t},compileSchema:$e,interpretSchema:Pe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return me(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return me(o).collectEvaluatedItems(e,t,r,n)}};var xe={compile:()=>{},interpret:()=>!0},Se=async e=>Object.entries(await e),Ae=n(async(e,t)=>(await t).map(e)),Ie=n(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),Ve=n(async(e,t,r={})=>Ie(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Te=n(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).some(e=>e)}),ke=n(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).every(e=>e)}),Re=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ce={entries:Se,map:Ae,filter:Ve,reduce:Ie,some:Te,every:ke,pipeline:Re,all:e=>Promise.all(e),allValues:e=>Re([Se,Ie(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ke={compile:async(e,t)=>{const r=se.uri(e);if(!(r in t)){t[r]=!1;const n=se.value(e);t[r]=[e.schemaVersion+"#validate",se.uri(e),"boolean"==typeof n?n:await Ce.pipeline([se.entries,Ce.map(async t=>{const[r,n]=await t;return[`${e.schemaVersion}#${r}`,n]}),Ce.filter(async t=>{const[r]=await t;return je.hasKeyword(r)&&r!==e.schemaVersion+"#validate"}),Ce.map(async r=>{const[n,o]=await r,i=await o,a=await je.getKeyword(n).compile(i,t,e);return[n,se.uri(i),a]}),Ce.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:S.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:S.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)}},Le={Core:je,Schema:se,Instance:S,Keywords:{metaData:xe,validate:Ke}};e("default",Le);e("Core",Le.Core),e("Schema",Le.Schema),e("Instance",Le.Instance),e("Keywords",Le.Keywords)}}})); | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.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],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(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(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=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(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=async e=>Object.entries(await e),q=n(async(e,t)=>(await t).map(e)),z=n(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),W=n(async(e,t,r={})=>z(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),_=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).some(e=>e)}),B=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).every(e=>e)}),D=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),F={entries:U,map:q,filter:W,reduce:z,some:_,every:B,pipeline:D,all:e=>Promise.all(e),allValues:e=>D([U,z(async(e,[t,r])=>(e[t]=await r,e),{})],e)},Z=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(N.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)?J(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+M(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=M(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:J(e)}};function J(e){return e+("/"===e[e.length-1]?"":"/")}function M(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 N=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var G=fetch;const{isObject:H,splitUrl:Q}=v,X=Symbol("$__jref"),Y={},ee={},te=(e,t)=>{const r=e in ee?ee[e]:e;if(r in Y)return Y[r][t]},re={},ne={},oe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=Q(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=te(n,"idToken"),i=Q(t)[0],a=ce(i,e[o]||""),s=Q(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(ne[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,te(n,"vocabulary")&&H(e)&&"$vocabulary"in e?(ee[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};re[s]={id:s,schemaVersion:n,schema:ie(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},ie=(e,t,r,n,o)=>{if(H(e)){const i=te(r,"idToken"),a=te(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ce(t,n),[s,c]=Q(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return oe(e,ce(t,s),r),{[X]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=ie(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>ie(e,t,r,y.append(i,n),o)):e},ae=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),se=async(e,t=ae,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:fe(t),o=ce(n,e),[i,a]=Q(o);if(!(e=>e in re||e in ne)(i)){const e=await G(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=L.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}`)}oe(await e.json(),i)}const s=(e=>re[ne[e]]||re[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?le(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=de(c);return H(u)&&X in u?se(u[X],c):te(c.schemaVersion,"jsonReference")&&H(u)&&"string"==typeof u.$ref?se(u.$ref,c):te(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?se(u,c):te(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?se(u,c,!0):c},ce=(e,t)=>{const r=Z(e,t),n=Q(e)[0];if(n&&"file"===ue(r)&&"file"!==ue(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ue=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},le=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},fe=e=>`${e.id}#${encodeURI(e.pointer)}`,de=e=>y.get(e.pointer,e.schema),pe=(e,t)=>{const r=y.append(e,t.pointer);return se("#"+encodeURI(r),t)},he=n((e,t)=>F.pipeline([de,F.map(async(r,n)=>e(await pe(n,t),n)),F.all],t));var ye={setConfig:(e,t,r)=>{Y[e]||(Y[e]={}),Y[e][t]=r},getConfig:te,add:oe,get:se,markValidated:e=>{re[e].validated=!0},uri:fe,value:de,has:(e,t)=>e in de(t),step:pe,entries:e=>F.pipeline([de,Object.keys,F.map(async t=>[t,await pe(t,e)]),F.all],e),map:he};const ve="FLAG",be="BASIC",me="DETAILED",we="VERBOSE";let ge=me,Oe=!0;const Ee=(e,t)=>(n,o=ve)=>{if(![ve,be,me,we].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",$e(o,i));return ke(t,n,e),r.unsubscribe(a),i[0]},$e=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&Pe(r[r.length-1],i);){const t=r.pop();let n=[];if(e===be&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),je(i))break}(e===we||e!==ve&&!i.valid)&&r.push(i),t[0]=i}},Pe=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||je(e)),je=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),xe={},Se=e=>xe[e],Ae=e=>e in xe,Ie={},Ve={},Te=async(e,t)=>{if(!Ae(e.schemaVersion+"#validate")){const t=await ye.get(e.schemaVersion);(ye.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 Ie)Object.entries(Ie[e]).forEach(([e,r])=>{((e,t)=>{xe[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(Oe&&!e.validated){if(ye.markValidated(e.id),!(e.schemaVersion in Ve)){const t=await ye.get(e.schemaVersion),r={},n=await Te(t,r);Ve[t.id]=Ee(r,n)}const t=S.cons(e.schema,e.id),r=Ve[e.schemaVersion](t,ge);if(!r.valid)throw r}return await Se(e.schemaVersion+"#validate").compile(e,t),ye.uri(e)},ke=(e,t,r)=>{const[n]=r[e];return Se(n).interpret(e,t,r)};var Re={validate:async(e,t,r)=>{const n={},o=await Te(e,n),i=(e,t=ve)=>Ee(n,o)(S.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{ge=e},setShouldMetaValidate:e=>{Oe=e},FLAG:ve,BASIC:be,DETAILED:me,VERBOSE:we,getKeyword:Se,hasKeyword:Ae,defineVocabulary:(e,t)=>{Ie[e]=t},compileSchema:Te,interpretSchema:ke,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Se(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Se(o).collectEvaluatedItems(e,t,r,n)}};var Ce={compile:async(e,t)=>{const r=ye.uri(e);if(!(r in t)){t[r]=!1;const n=ye.value(e);t[r]=[e.schemaVersion+"#validate",ye.uri(e),"boolean"==typeof n?n:await F.pipeline([ye.entries,F.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),F.filter(([t])=>Re.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),F.map(async([r,n])=>{const o=await Re.getKeyword(r).compile(n,t,e);return[r,ye.uri(n),o]}),F.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Re.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:S.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:S.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&&Re.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&&Re.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ke={Core:Re,Schema:ye,Instance:S,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Ce}};e("default",Ke);e("Core",Ke.Core),e("Schema",Ke.Schema),e("Instance",Ke.Instance),e("Keywords",Ke.Keywords)}}})); | ||
//# sourceMappingURL=json-schema-core-system.min.js.map |
@@ -797,2 +797,71 @@ (function (global, factory) { | ||
var entries$1 = async (doc) => Object.entries(await doc); | ||
var map$1 = justCurryIt(async (fn, doc) => (await doc).map(fn)); | ||
var reduce$1 = justCurryIt(async (fn, acc, doc) => { | ||
return (await doc).reduce(async (acc, item) => { | ||
let resolvedAcc; | ||
try { | ||
resolvedAcc = await acc; | ||
} catch (e) { | ||
try { | ||
await item; | ||
} catch (e) { | ||
// If we've already encountered an error, ignore subsequent errors. | ||
} | ||
return acc; | ||
} | ||
return fn(resolvedAcc, item); | ||
}, acc); | ||
}); | ||
var filter$1 = justCurryIt(async (fn, doc, options = {}) => { | ||
return reduce$1(async (acc, item) => { | ||
return (await fn(item)) ? acc.concat([item]) : acc; | ||
}, [], doc, options); | ||
}); | ||
var some$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$1(fn, doc); | ||
return (await Promise.all(results)) | ||
.some((a) => a); | ||
}); | ||
var every$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$1(fn, doc); | ||
return (await Promise.all(results)) | ||
.every((a) => a); | ||
}); | ||
var pipeline = justCurryIt((fns, doc) => { | ||
return fns.reduce(async (acc, fn) => fn(await acc), doc); | ||
}); | ||
var all = (doc) => Promise.all(doc); | ||
var allValues = (doc) => { | ||
return pipeline([ | ||
entries$1, | ||
reduce$1(async (acc, [propertyName, propertyValue]) => { | ||
acc[propertyName] = await propertyValue; | ||
return acc; | ||
}, {}) | ||
], doc); | ||
}; | ||
var lib = { | ||
entries: entries$1, | ||
map: map$1, | ||
filter: filter$1, | ||
reduce: reduce$1, | ||
some: some$1, | ||
every: every$1, | ||
pipeline: pipeline, | ||
all: all, | ||
allValues: allValues | ||
}; | ||
var urlResolveBrowser = urlResolve; | ||
@@ -1219,7 +1288,14 @@ | ||
const entries$1 = (doc) => Object.keys(value$1(doc)) | ||
.map(async (key) => [key, await step$1(key, doc)]); | ||
const entries$2 = (doc) => lib.pipeline([ | ||
value$1, | ||
Object.keys, | ||
lib.map(async (key) => [key, await step$1(key, doc)]), | ||
lib.all | ||
], doc); | ||
const map$1 = justCurryIt((fn, doc) => value$1(doc) | ||
.map(async (item, ndx) => fn(await step$1(ndx, doc), ndx))); | ||
const map$2 = justCurryIt((fn, doc) => lib.pipeline([ | ||
value$1, | ||
lib.map(async (item, ndx) => fn(await step$1(ndx, doc), ndx)), | ||
lib.all | ||
], doc)); | ||
@@ -1229,3 +1305,3 @@ var schema = { | ||
add, get: get$2, markValidated, | ||
uri: uri$1, value: value$1, has, step: step$1, entries: entries$1, map: map$1 | ||
uri: uri$1, value: value$1, has, step: step$1, entries: entries$2, map: map$2 | ||
}; | ||
@@ -1396,71 +1472,2 @@ | ||
var entries$2 = async (doc) => Object.entries(await doc); | ||
var map$2 = justCurryIt(async (fn, doc) => (await doc).map(fn)); | ||
var reduce$1 = justCurryIt(async (fn, acc, doc) => { | ||
return (await doc).reduce(async (acc, item) => { | ||
let resolvedAcc; | ||
try { | ||
resolvedAcc = await acc; | ||
} catch (e) { | ||
try { | ||
await item; | ||
} catch (e) { | ||
// If we've already encountered an error, ignore subsequent errors. | ||
} | ||
return acc; | ||
} | ||
return fn(resolvedAcc, item); | ||
}, acc); | ||
}); | ||
var filter$1 = justCurryIt(async (fn, doc, options = {}) => { | ||
return reduce$1(async (acc, item) => { | ||
return (await fn(item)) ? acc.concat([item]) : acc; | ||
}, [], doc, options); | ||
}); | ||
var some$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$2(fn, doc); | ||
return (await Promise.all(results)) | ||
.some((a) => a); | ||
}); | ||
var every$1 = justCurryIt(async (fn, doc) => { | ||
const results = await map$2(fn, doc); | ||
return (await Promise.all(results)) | ||
.every((a) => a); | ||
}); | ||
var pipeline = justCurryIt((fns, doc) => { | ||
return fns.reduce(async (acc, fn) => fn(await acc), doc); | ||
}); | ||
var all = (doc) => Promise.all(doc); | ||
var allValues = (doc) => { | ||
return pipeline([ | ||
entries$2, | ||
reduce$1(async (acc, [propertyName, propertyValue]) => { | ||
acc[propertyName] = await propertyValue; | ||
return acc; | ||
}, {}) | ||
], doc); | ||
}; | ||
var lib = { | ||
entries: entries$2, | ||
map: map$2, | ||
filter: filter$1, | ||
reduce: reduce$1, | ||
some: some$1, | ||
every: every$1, | ||
pipeline: pipeline, | ||
all: all, | ||
allValues: allValues | ||
}; | ||
const compile$2 = async (schema$1, ast) => { | ||
@@ -1476,14 +1483,5 @@ const url = schema.uri(schema$1); | ||
schema.entries, | ||
lib.map(async (entry) => { | ||
const [keyword, keywordSchema] = await entry; | ||
const keywordId = `${schema$1.schemaVersion}#${keyword}`; | ||
return [keywordId, keywordSchema]; | ||
}), | ||
lib.filter(async (entry) => { | ||
const [keywordId] = await entry; | ||
return core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`; | ||
}), | ||
lib.map(async (entry) => { | ||
const [keywordId, keywordSchemaPromise] = await entry; | ||
const keywordSchema = await keywordSchemaPromise; | ||
lib.map(([keyword, keywordSchema]) => [`${schema$1.schemaVersion}#${keyword}`, keywordSchema]), | ||
lib.filter(([keywordId]) => core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`), | ||
lib.map(async ([keywordId, keywordSchema]) => { | ||
const keywordAst = await core.getKeyword(keywordId).compile(keywordSchema, ast, schema$1); | ||
@@ -1490,0 +1488,0 @@ return [keywordId, schema.uri(keywordSchema), keywordAst]; |
@@ -6,3 +6,3 @@ !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)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==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{splitUrl:b}=v,m=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=m)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return w("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),j=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),x=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),P=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var A={cons:(e,t="")=>Object.freeze({...m,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:j,every:x,some:P},S=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
* MIT Licensed | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.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],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(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(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.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(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=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(W.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)?q(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+z(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=z(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:q(e)}};function q(e){return e+("/"===e[e.length-1]?"":"/")}function z(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 W=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var _=fetch;const{isObject:B,splitUrl:D}=v,F=Symbol("$__jref"),M={},Z={},J=(e,t)=>{const r=e in Z?Z[e]:e;if(r in M)return M[r][t]},N={},G={},H=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=D(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=J(n,"idToken"),i=D(t)[0],a=ee(i,e[o]||""),s=D(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(G[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,J(n,"vocabulary")&&B(e)&&"$vocabulary"in e?(Z[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};N[s]={id:s,schemaVersion:n,schema:Q(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},Q=(e,t,r,n,o)=>{if(B(e)){const i=J(r,"idToken"),a=J(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ee(t,n),[s,c]=D(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return H(e,ee(t,s),r),{[F]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=Q(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>Q(e,t,r,y.append(i,n),o)):e},X=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),Y=async(e,t=X,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:ne(t),o=ee(n,e),[i,a]=D(o);if(!(e=>e in N||e in G)(i)){const e=await _(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=L.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}`)}H(await e.json(),i)}const s=(e=>N[G[e]]||N[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?re(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=oe(c);return B(u)&&F in u?Y(u[F],c):J(c.schemaVersion,"jsonReference")&&B(u)&&"string"==typeof u.$ref?Y(u.$ref,c):J(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?Y(u,c):J(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?Y(u,c,!0):c},ee=(e,t)=>{const r=U(e,t),n=D(e)[0];if(n&&"file"===te(r)&&"file"!==te(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},te=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},re=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ne=e=>`${e.id}#${encodeURI(e.pointer)}`,oe=e=>y.get(e.pointer,e.schema),ie=(e,t)=>{const r=y.append(e,t.pointer);return Y("#"+encodeURI(r),t)},ae=n((e,t)=>oe(t).map(async(r,n)=>e(await ie(n,t),n)));var se={setConfig:(e,t,r)=>{M[e]||(M[e]={}),M[e][t]=r},getConfig:J,add:H,get:Y,markValidated:e=>{N[e].validated=!0},uri:ne,value:oe,has:(e,t)=>e in oe(t),step:ie,entries:e=>Object.keys(oe(e)).map(async t=>[t,await ie(t,e)]),map:ae};const ce="FLAG",ue="BASIC",le="DETAILED",fe="VERBOSE";let de=le,pe=!0;const he=(e,t)=>(n,o=ce)=>{if(![ce,ue,le,fe].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",ye(o,i));return je(t,n,e),r.unsubscribe(a),i[0]},ye=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ve(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ue&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),be(i))break}(e===fe||e!==ce&&!i.valid)&&r.push(i),t[0]=i}},ve=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||be(e)),be=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),me={},we=e=>me[e],ge=e=>e in me,Oe={},Ee={},$e=async(e,t)=>{if(!ge(e.schemaVersion+"#validate")){const t=await se.get(e.schemaVersion);(se.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 Oe)Object.entries(Oe[e]).forEach(([e,r])=>{((e,t)=>{me[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(pe&&!e.validated){if(se.markValidated(e.id),!(e.schemaVersion in Ee)){const t=await se.get(e.schemaVersion),r={},n=await $e(t,r);Ee[t.id]=he(r,n)}const t=A.cons(e.schema,e.id),r=Ee[e.schemaVersion](t,de);if(!r.valid)throw r}return await we(e.schemaVersion+"#validate").compile(e,t),se.uri(e)},je=(e,t,r)=>{const[n]=r[e];return we(n).interpret(e,t,r)};var xe={validate:async(e,t,r)=>{const n={},o=await $e(e,n),i=(e,t=ce)=>he(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{de=e},setShouldMetaValidate:e=>{pe=e},FLAG:ce,BASIC:ue,DETAILED:le,VERBOSE:fe,getKeyword:we,hasKeyword:ge,defineVocabulary:(e,t)=>{Oe[e]=t},compileSchema:$e,interpretSchema:je,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedItems(e,t,r,n)}};var Pe={compile:()=>{},interpret:()=>!0},Ae=async e=>Object.entries(await e),Se=n(async(e,t)=>(await t).map(e)),Ie=n(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),Ve=n(async(e,t,r={})=>Ie(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Te=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).some(e=>e)}),ke=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).every(e=>e)}),Re=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ce={entries:Ae,map:Se,filter:Ve,reduce:Ie,some:Te,every:ke,pipeline:Re,all:e=>Promise.all(e),allValues:e=>Re([Ae,Ie(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ke={compile:async(e,t)=>{const r=se.uri(e);if(!(r in t)){t[r]=!1;const n=se.value(e);t[r]=[e.schemaVersion+"#validate",se.uri(e),"boolean"==typeof n?n:await Ce.pipeline([se.entries,Ce.map(async t=>{const[r,n]=await t;return[`${e.schemaVersion}#${r}`,n]}),Ce.filter(async t=>{const[r]=await t;return xe.hasKeyword(r)&&r!==e.schemaVersion+"#validate"}),Ce.map(async r=>{const[n,o]=await r,i=await o,a=await xe.getKeyword(n).compile(i,t,e);return[n,se.uri(i),a]}),Ce.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=xe.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.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&&xe.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&&xe.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:xe,Schema:se,Instance:A,Keywords:{metaData:Pe,validate:Ke}},Ue=Le.Core,qe=Le.Schema,ze=Le.Instance,We=Le.Keywords;e.Core=Ue,e.Instance=ze,e.Keywords=We,e.Schema=qe,e.default=Le,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.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],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(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(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.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(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=async e=>Object.entries(await e),q=n(async(e,t)=>(await t).map(e)),z=n(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),W=n(async(e,t,r={})=>z(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),_=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).some(e=>e)}),B=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).every(e=>e)}),D=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),F={entries:U,map:q,filter:W,reduce:z,some:_,every:B,pipeline:D,all:e=>Promise.all(e),allValues:e=>D([U,z(async(e,[t,r])=>(e[t]=await r,e),{})],e)},M=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(N.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)?Z(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+J(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=J(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:Z(e)}};function Z(e){return e+("/"===e[e.length-1]?"":"/")}function J(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 N=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var G=fetch;const{isObject:H,splitUrl:Q}=v,X=Symbol("$__jref"),Y={},ee={},te=(e,t)=>{const r=e in ee?ee[e]:e;if(r in Y)return Y[r][t]},re={},ne={},oe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=Q(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=te(n,"idToken"),i=Q(t)[0],a=ce(i,e[o]||""),s=Q(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(ne[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,te(n,"vocabulary")&&H(e)&&"$vocabulary"in e?(ee[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};re[s]={id:s,schemaVersion:n,schema:ie(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},ie=(e,t,r,n,o)=>{if(H(e)){const i=te(r,"idToken"),a=te(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ce(t,n),[s,c]=Q(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return oe(e,ce(t,s),r),{[X]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=ie(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>ie(e,t,r,y.append(i,n),o)):e},ae=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),se=async(e,t=ae,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:fe(t),o=ce(n,e),[i,a]=Q(o);if(!(e=>e in re||e in ne)(i)){const e=await G(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=L.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}`)}oe(await e.json(),i)}const s=(e=>re[ne[e]]||re[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?le(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=de(c);return H(u)&&X in u?se(u[X],c):te(c.schemaVersion,"jsonReference")&&H(u)&&"string"==typeof u.$ref?se(u.$ref,c):te(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?se(u,c):te(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?se(u,c,!0):c},ce=(e,t)=>{const r=M(e,t),n=Q(e)[0];if(n&&"file"===ue(r)&&"file"!==ue(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ue=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},le=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},fe=e=>`${e.id}#${encodeURI(e.pointer)}`,de=e=>y.get(e.pointer,e.schema),pe=(e,t)=>{const r=y.append(e,t.pointer);return se("#"+encodeURI(r),t)},he=n((e,t)=>F.pipeline([de,F.map(async(r,n)=>e(await pe(n,t),n)),F.all],t));var ye={setConfig:(e,t,r)=>{Y[e]||(Y[e]={}),Y[e][t]=r},getConfig:te,add:oe,get:se,markValidated:e=>{re[e].validated=!0},uri:fe,value:de,has:(e,t)=>e in de(t),step:pe,entries:e=>F.pipeline([de,Object.keys,F.map(async t=>[t,await pe(t,e)]),F.all],e),map:he};const ve="FLAG",be="BASIC",me="DETAILED",we="VERBOSE";let ge=me,Oe=!0;const Ee=(e,t)=>(n,o=ve)=>{if(![ve,be,me,we].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",$e(o,i));return ke(t,n,e),r.unsubscribe(a),i[0]},$e=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&je(r[r.length-1],i);){const t=r.pop();let n=[];if(e===be&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),xe(i))break}(e===we||e!==ve&&!i.valid)&&r.push(i),t[0]=i}},je=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||xe(e)),xe=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),Pe={},Ae=e=>Pe[e],Se=e=>e in Pe,Ie={},Ve={},Te=async(e,t)=>{if(!Se(e.schemaVersion+"#validate")){const t=await ye.get(e.schemaVersion);(ye.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 Ie)Object.entries(Ie[e]).forEach(([e,r])=>{((e,t)=>{Pe[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(Oe&&!e.validated){if(ye.markValidated(e.id),!(e.schemaVersion in Ve)){const t=await ye.get(e.schemaVersion),r={},n=await Te(t,r);Ve[t.id]=Ee(r,n)}const t=A.cons(e.schema,e.id),r=Ve[e.schemaVersion](t,ge);if(!r.valid)throw r}return await Ae(e.schemaVersion+"#validate").compile(e,t),ye.uri(e)},ke=(e,t,r)=>{const[n]=r[e];return Ae(n).interpret(e,t,r)};var Re={validate:async(e,t,r)=>{const n={},o=await Te(e,n),i=(e,t=ve)=>Ee(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{ge=e},setShouldMetaValidate:e=>{Oe=e},FLAG:ve,BASIC:be,DETAILED:me,VERBOSE:we,getKeyword:Ae,hasKeyword:Se,defineVocabulary:(e,t)=>{Ie[e]=t},compileSchema:Te,interpretSchema:ke,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Ae(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Ae(o).collectEvaluatedItems(e,t,r,n)}};var Ce={compile:async(e,t)=>{const r=ye.uri(e);if(!(r in t)){t[r]=!1;const n=ye.value(e);t[r]=[e.schemaVersion+"#validate",ye.uri(e),"boolean"==typeof n?n:await F.pipeline([ye.entries,F.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),F.filter(([t])=>Re.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),F.map(async([r,n])=>{const o=await Re.getKeyword(r).compile(n,t,e);return[r,ye.uri(n),o]}),F.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Re.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.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&&Re.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&&Re.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ke={Core:Re,Schema:ye,Instance:A,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Ce}},Le=Ke.Core,Ue=Ke.Schema,qe=Ke.Instance,ze=Ke.Keywords;e.Core=Le,e.Instance=qe,e.Keywords=ze,e.Schema=Ue,e.default=Ke,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-umd.min.js.map |
@@ -18,14 +18,5 @@ const Pact = require("@hyperjump/pact"); | ||
Schema.entries, | ||
Pact.map(async (entry) => { | ||
const [keyword, keywordSchema] = await entry; | ||
const keywordId = `${schema.schemaVersion}#${keyword}`; | ||
return [keywordId, keywordSchema]; | ||
}), | ||
Pact.filter(async (entry) => { | ||
const [keywordId] = await entry; | ||
return Core.hasKeyword(keywordId) && keywordId !== `${schema.schemaVersion}#validate`; | ||
}), | ||
Pact.map(async (entry) => { | ||
const [keywordId, keywordSchemaPromise] = await entry; | ||
const keywordSchema = await keywordSchemaPromise; | ||
Pact.map(([keyword, keywordSchema]) => [`${schema.schemaVersion}#${keyword}`, keywordSchema]), | ||
Pact.filter(([keywordId]) => Core.hasKeyword(keywordId) && keywordId !== `${schema.schemaVersion}#validate`), | ||
Pact.map(async ([keywordId, keywordSchema]) => { | ||
const keywordAst = await Core.getKeyword(keywordId).compile(keywordSchema, ast, schema); | ||
@@ -32,0 +23,0 @@ return [keywordId, Schema.uri(keywordSchema), keywordAst]; |
const contentTypeParser = require("content-type"); | ||
const curry = require("just-curry-it"); | ||
const Pact = require("@hyperjump/pact"); | ||
const JsonPointer = require("@hyperjump/json-pointer"); | ||
const resolveUrl = require("./url-resolve-browser"); | ||
const JsonPointer = require("@hyperjump/json-pointer"); | ||
const { isObject, splitUrl } = require("./common"); | ||
@@ -213,7 +214,14 @@ const fetch = require("./fetch"); | ||
const entries = (doc) => Object.keys(value(doc)) | ||
.map(async (key) => [key, await step(key, doc)]); | ||
const entries = (doc) => Pact.pipeline([ | ||
value, | ||
Object.keys, | ||
Pact.map(async (key) => [key, await step(key, doc)]), | ||
Pact.all | ||
], doc); | ||
const map = curry((fn, doc) => value(doc) | ||
.map(async (item, ndx) => fn(await step(ndx, doc), ndx))); | ||
const map = curry((fn, doc) => Pact.pipeline([ | ||
value, | ||
Pact.map(async (item, ndx) => fn(await step(ndx, doc), ndx)), | ||
Pact.all | ||
], doc)); | ||
@@ -220,0 +228,0 @@ module.exports = { |
{ | ||
"name": "@hyperjump/json-schema-core", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"description": "A framework for building JSON Schema tools", | ||
@@ -45,3 +45,3 @@ "main": "lib/index.js", | ||
"@hyperjump/json-pointer": "^0.8.0", | ||
"@hyperjump/pact": "^0.1.1", | ||
"@hyperjump/pact": "^0.1.0", | ||
"content-type": "^1.0.4", | ||
@@ -48,0 +48,0 @@ "make-fetch-happen": "^8.0.4", |
@@ -71,3 +71,3 @@ # Hyperjump - JSON Schema Core | ||
Similar to `Schema.step`, but gets an adjacent key. | ||
* **Schema.entries**: (doc: SDoc) => [Promise<[string, SDoc]>] | ||
* **Schema.entries**: (doc: SDoc) => Promise<[[string, SDoc]]> | ||
@@ -74,0 +74,0 @@ Similar to `Object.entries`, but returns SDocs for values. |
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
1490113
8805
Updated@hyperjump/pact@^0.1.0