@hyperjump/json-schema-core
Advanced tools
Comparing version 0.22.2 to 0.22.3
@@ -798,2 +798,6 @@ define(['exports'], (function (exports) { 'use strict'; | ||
var reference = { cons: cons$1, isReference, href, value: value$2 }; | ||
reference.cons; | ||
reference.isReference; | ||
reference.href; | ||
reference.value; | ||
@@ -1726,13 +1730,15 @@ const { jsonTypeOf: jsonTypeOf$1 } = common; | ||
var lib = { Core: core, Schema: schema, Instance: instance, Keywords: keywords, InvalidSchemaError: invalidSchemaError }; | ||
var lib = { Core: core, Schema: schema, Instance: instance, Reference: reference, Keywords: keywords, InvalidSchemaError: invalidSchemaError }; | ||
var lib_1 = lib.Core; | ||
var lib_2 = lib.Schema; | ||
var lib_3 = lib.Instance; | ||
var lib_4 = lib.Keywords; | ||
var lib_5 = lib.InvalidSchemaError; | ||
var lib_4 = lib.Reference; | ||
var lib_5 = lib.Keywords; | ||
var lib_6 = lib.InvalidSchemaError; | ||
exports.Core = lib_1; | ||
exports.Instance = lib_3; | ||
exports.InvalidSchemaError = lib_5; | ||
exports.Keywords = lib_4; | ||
exports.InvalidSchemaError = lib_6; | ||
exports.Keywords = lib_5; | ||
exports.Reference = lib_4; | ||
exports.Schema = lib_2; | ||
@@ -1739,0 +1745,0 @@ exports["default"] = lib; |
@@ -1,2 +0,2 @@ | ||
define(["exports"],(function(e){"use strict";var t=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)))}}};var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var n,o=(function(e,t){var n,o;n="object"==typeof window&&window||r,o={},n.PubSub=o,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},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)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(o),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}(n={exports:{}},n.exports),n.exports);o.PubSub;var a=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),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}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(c.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)?i(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+s(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,i=r.path,c=r.host;return 0===e.length?a=i:(i=i.substring(0,i.lastIndexOf("/")),a=s(i+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:i(e)}};function i(e){return e+("/"===e[e.length-1]?"":"/")}function s(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 c=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const l={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},u=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)]},f=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var p={jsonTypeOf:(e,t)=>l[t](e),splitUrl:u,safeResolveUrl:(e,t)=>{const r=a(e,t),n=u(e)[0];if(n&&"file"===f(r)&&"file"!==f(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const d=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(g)},h=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:h(e,E(t,o,n),r,m(o,n))}}if(Array.isArray(t)){const n=[...t];return n[O(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:E(t,e[0],n)},y=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||j(t)){const o=e.shift();y(e,E(t,o,n),r,m(o,n))}else{t[O(t,e[0])]=r}},b=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=E(t,n,r);return{...t,[n]:b(e,o,m(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 E(t,e[0],r)}},v=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=E(t,n,r);v(e,o,m(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:E(t,e[0],r)},m=t(((e,t)=>t+"/"+w(e))),w=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),g=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),O=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,E=(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(j(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[O(e,t)]},j=e=>null===e||"object"!=typeof e;var $={nil:"",append:m,get:(e,t)=>{const r=d(e),n=e=>r.reduce((([e,t],r)=>[E(e,r,t),m(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=d(e),a=t(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(e,r,n)=>{const o=d(e),a=t(((e,t)=>y(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=d(e),n=e=>b(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=d(e),n=e=>v(r,e,"");return void 0===t?n:n(t)}};$.nil,$.append,$.get,$.set,$.assign,$.unset,$.remove;const S=Symbol("$__value"),P=Symbol("$__href");var x=(e,t)=>Object.freeze({[P]:e,[S]:t}),A=e=>e&&void 0!==e[P],I=e=>e[P],T=e=>e[S];const{jsonTypeOf:k}=p,V=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),U=e=>A(e.value)?T(e.value):e.value,C=t(((e,t)=>k(U(e),t))),R=(e,t)=>Object.freeze({...t,pointer:$.append(e,t.pointer),value:U(t)[e]}),z=t(((e,t)=>U(t).map(((r,n,o,a)=>e(R(n,t),n,o,a))))),K=t(((e,t)=>U(t).map(((e,r,n,o)=>R(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),L=t(((e,t,r)=>U(r).reduce(((t,n,o)=>e(t,R(o,r),o)),t))),q=t(((e,t)=>U(t).every(((r,n,o,a)=>e(R(n,t),n,o,a))))),_=t(((e,t)=>U(t).some(((r,n,o,a)=>e(R(n,t),n,o,a)))));var D={nil:V,cons:(e,t="")=>Object.freeze({...V,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:U,has:(e,t)=>e in U(t),typeOf:C,step:R,entries:e=>Object.keys(U(e)).map((t=>[t,R(t,e)])),keys:e=>Object.keys(U(e)),map:z,filter:K,reduce:L,every:q,some:_,length:e=>U(e).length},N=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,B=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,F=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,Z=/\\([\u000b\u0020-\u00ff])/g,M=/([\\"])/g,W=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function J(e){var t=String(e);if(F.test(t))return t;if(t.length>0&&!B.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(M,"\\$1")+'"'}function G(e){this.parameters=Object.create(null),this.type=e}var H={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!W.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!F.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+J(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!W.test(n))throw new TypeError("invalid media type");var o=new G(n.toLowerCase());if(-1!==r){var a,i,s;for(N.lastIndex=r;i=N.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(Z,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},Q=async e=>Object.entries(await e),X=t((async(e,t)=>(await t).map(e))),Y=t((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),ee=t((async(e,t,r={})=>Y((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),te=t((async(e,t)=>{const r=await X(e,t);return(await Promise.all(r)).some((e=>e))})),re=t((async(e,t)=>{const r=await X(e,t);return(await Promise.all(r)).every((e=>e))})),ne=t(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),oe={entries:Q,map:X,filter:ee,reduce:Y,some:te,every:re,pipeline:ne,all:e=>Promise.all(e),allValues:e=>ne([Q,Y((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};oe.entries,oe.map,oe.filter,oe.reduce,oe.some,oe.every,oe.pipeline,oe.all,oe.allValues;var ae=fetch;const{jsonTypeOf:ie,splitUrl:se,safeResolveUrl:ce}=p,le={},ue={},fe=(e,t)=>{const r=e in ue?ue[e]:e;if(r in le)return le[r][t]},pe={},de={},he=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=se(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=fe(n,"baseToken"),a=fe(n,"anchorToken"),i=se(t)[0];if(!i&&!se(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=ce(i,e[o]||""),[c,l]=se(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(de[i]=c);const u={},f=fe(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=fe(n,"vocabularyToken");ie(e[d],"object")?(ue[c]=n,p=e[d],delete e[d]):(ue[c]=n,p={[n]:!0});const h={"":""};return pe[c]={id:c,schemaVersion:n,schema:ye(e,c,n,$.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:p,validated:!1},c},ye=(e,t,r,n,o,a)=>{if(ie(e,"object")){const i="string"==typeof e.$schema?se(e.$schema)[0]:r,s=fe(i,"embeddedToken"),c=fe(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=ce(t,e[s]);return e[s]=n,he(e,n,r),x(e[s],e)}const l=fe(r,"anchorToken"),u=fe(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=fe(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=fe(r,"jrefToken");if("string"==typeof e[p])return x(e[p],e);for(const i in e)e[i]=ye(e[i],t,r,$.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ye(e,t,r,$.append(i,n),o,a))):e},be=e=>pe[de[e]]||pe[e],ve=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:$.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),me=async(e,t=ve)=>{const r=ce(Oe(t),e),[n,o]=se(r);if(!(e=>e in pe||e in de)(n)){const e=await ae(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=H.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}he(await e.json(),n)}const a=be(n),i="/"!==o[0]?ge(a,o):o,s=Object.freeze({...a,pointer:i,value:$.get(i,a.schema)});return we(s)},we=e=>A(e.value)?me(I(e.value),e):e,ge=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Oe=e=>`${e.id}#${encodeURI(e.pointer)}`,Ee=e=>A(e.value)?T(e.value):e.value,je=(e,t)=>{const r=be(t.id),n=Object.freeze({...t,pointer:$.append(e,t.pointer),value:Ee(t)[e],validated:r.validated});return we(n)},$e=t(((e,t)=>oe.pipeline([Ee,oe.map((async(r,n)=>e(await je(n,t),n))),oe.all],t)));var Se={setConfig:(e,t,r)=>{le[e]||(le[e]={}),le[e][t]=r},getConfig:fe,add:he,get:me,markValidated:e=>{pe[e].validated=!0},uri:Oe,value:Ee,getAnchorPointer:ge,typeOf:(e,t)=>ie(Ee(e),t),has:(e,t)=>e in Ee(t),step:je,keys:e=>Object.keys(Ee(e)),entries:e=>oe.pipeline([Ee,Object.keys,oe.map((async t=>[t,await je(t,e)])),oe.all],e),map:$e,length:e=>Ee(e).length};Se.setConfig,Se.getConfig,Se.add,Se.get,Se.markValidated,Se.uri,Se.value,Se.getAnchorPointer,Se.typeOf,Se.has,Se.step,Se.keys,Se.entries,Se.map,Se.length;class Pe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=Pe;const{splitUrl:Ae}=p,Ie="FLAG",Te="BASIC",ke="DETAILED",Ve="VERBOSE";let Ue=ke,Ce=!0;const Re=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await Be(e,t)}},ze=t((({ast:e,schemaUri:t},r,n=Ie)=>{if(![Ie,Te,ke,Ve].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",Ke(n,a));return Ze(t,r,e,{}),o.unsubscribe(i),a[0]})),Ke=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===Te&&(o.push(...t.errors),delete t.errors),(e===Ve||e!==Ie&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Le={},qe=e=>Le[e],_e=e=>e in Le,De={},Ne={},Be=async(e,t)=>{if(e=await Fe(e),!_e(`${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 De)Object.entries(De[e]).forEach((([e,r])=>{((e,t)=>{Le[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Ce&&!e.validated){if(Se.markValidated(e.id),!(e.schemaVersion in Ne)){const t=await Se.get(e.schemaVersion),r=await Re(t);Ne[t.id]=ze(r)}const t=D.cons(e.schema,e.id),r=Ne[e.schemaVersion](t,Ue);if(!r.valid)throw new xe(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),qe(`${e.schemaVersion}#validate`).compile(e,t)},Fe=async e=>Se.typeOf(e,"string")?Fe(await Se.get(Se.value(e),e)):e,Ze=(e,t,r,n)=>{const o=Me(e,r),a=Ae(e)[0];return qe(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Me=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var We={validate:async(e,t,r)=>{const n=await Re(e),o=(e,t)=>ze(n,D.cons(e),t);return void 0===t?o:o(t,r)},compile:Re,interpret:ze,setMetaOutputFormat:e=>{Ue=e},setShouldMetaValidate:e=>{Ce=e},FLAG:Ie,BASIC:Te,DETAILED:ke,VERBOSE:Ve,add:(e,t="",r="")=>{const n=Se.add(e,t,r);delete Ne[n]},getKeyword:qe,hasKeyword:_e,defineVocabulary:(e,t)=>{De[e]=t},compileSchema:Be,interpretSchema:Ze,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Me(e,r);return qe(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Me(e,r);return qe(a).collectEvaluatedItems(e,t,r,n,o)}};var Je={compile:e=>Se.value(e),interpret:()=>!0};var Ge={compile:async(e,t)=>{const r=Se.uri(e);if(!(r in t)){t[r]=!1;const n=Se.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Se.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Se.uri(e),"boolean"==typeof n?n:await oe.pipeline([Se.entries,oe.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),oe.filter((([t])=>We.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),oe.map((async([r,n])=>{const o=await We.getKeyword(r).compile(n,t,e);return[r,Se.uri(n),o]})),oe.all],e)]}return r},interpret:(e,t,r,n)=>{const[a,i,s]=r[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=We.getKeyword(e).interpret(i,t,r,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:D.uri(t),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:D.uri(t),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&We.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&We.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},He={metaData:Je,validate:Ge},Qe={Core:We,Schema:Se,Instance:D,Keywords:He,InvalidSchemaError:xe},Xe=Qe.Core,Ye=Qe.Schema,et=Qe.Instance,tt=Qe.Keywords,rt=Qe.InvalidSchemaError;e.Core=Xe,e.Instance=et,e.InvalidSchemaError=rt,e.Keywords=tt,e.Schema=Ye,e.default=Qe,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
define(["exports"],(function(e){"use strict";var t=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)))}}};var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var n,o=(function(e,t){var n,o;n="object"==typeof window&&window||r,o={},n.PubSub=o,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},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)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(o),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}(n={exports:{}},n.exports),n.exports);o.PubSub;var a=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),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}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(c.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)?i(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+s(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,i=r.path,c=r.host;return 0===e.length?a=i:(i=i.substring(0,i.lastIndexOf("/")),a=s(i+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:i(e)}};function i(e){return e+("/"===e[e.length-1]?"":"/")}function s(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 c=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const l={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},u=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)]},f=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var p={jsonTypeOf:(e,t)=>l[t](e),splitUrl:u,safeResolveUrl:(e,t)=>{const r=a(e,t),n=u(e)[0];if(n&&"file"===f(r)&&"file"!==f(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const d=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(g)},h=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:h(e,E(t,o,n),r,m(o,n))}}if(Array.isArray(t)){const n=[...t];return n[O(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:E(t,e[0],n)},y=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||j(t)){const o=e.shift();y(e,E(t,o,n),r,m(o,n))}else{t[O(t,e[0])]=r}},v=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=E(t,n,r);return{...t,[n]:v(e,o,m(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 E(t,e[0],r)}},b=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=E(t,n,r);b(e,o,m(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:E(t,e[0],r)},m=t(((e,t)=>t+"/"+w(e))),w=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),g=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),O=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,E=(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(j(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[O(e,t)]},j=e=>null===e||"object"!=typeof e;var $={nil:"",append:m,get:(e,t)=>{const r=d(e),n=e=>r.reduce((([e,t],r)=>[E(e,r,t),m(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=d(e),a=t(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(e,r,n)=>{const o=d(e),a=t(((e,t)=>y(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=d(e),n=e=>v(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=d(e),n=e=>b(r,e,"");return void 0===t?n:n(t)}};$.nil,$.append,$.get,$.set,$.assign,$.unset,$.remove;const S=Symbol("$__value"),P=Symbol("$__href");var x={cons:(e,t)=>Object.freeze({[P]:e,[S]:t}),isReference:e=>e&&void 0!==e[P],href:e=>e[P],value:e=>e[S]};const{jsonTypeOf:A}=p,I=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>x.isReference(e.value)?x.value(e.value):e.value,k=t(((e,t)=>A(T(e),t))),V=(e,t)=>Object.freeze({...t,pointer:$.append(e,t.pointer),value:T(t)[e]}),R=t(((e,t)=>T(t).map(((r,n,o,a)=>e(V(n,t),n,o,a))))),U=t(((e,t)=>T(t).map(((e,r,n,o)=>V(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),C=t(((e,t,r)=>T(r).reduce(((t,n,o)=>e(t,V(o,r),o)),t))),z=t(((e,t)=>T(t).every(((r,n,o,a)=>e(V(n,t),n,o,a))))),K=t(((e,t)=>T(t).some(((r,n,o,a)=>e(V(n,t),n,o,a)))));var L={nil:I,cons:(e,t="")=>Object.freeze({...I,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:T,has:(e,t)=>e in T(t),typeOf:k,step:V,entries:e=>Object.keys(T(e)).map((t=>[t,V(t,e)])),keys:e=>Object.keys(T(e)),map:R,filter:U,reduce:C,every:z,some:K,length:e=>T(e).length},q=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,_=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,D=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,N=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,F=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function Z(e){var t=String(e);if(D.test(t))return t;if(t.length>0&&!_.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(B,"\\$1")+'"'}function M(e){this.parameters=Object.create(null),this.type=e}var W={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!F.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!D.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+Z(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(!F.test(n))throw new TypeError("invalid media type");var o=new M(n.toLowerCase());if(-1!==r){var a,i,s;for(q.lastIndex=r;i=q.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(N,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},J=async e=>Object.entries(await e),G=t((async(e,t)=>(await t).map(e))),H=t((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),Q=t((async(e,t,r={})=>H((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),X=t((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).some((e=>e))})),Y=t((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).every((e=>e))})),ee=t(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),te={entries:J,map:G,filter:Q,reduce:H,some:X,every:Y,pipeline:ee,all:e=>Promise.all(e),allValues:e=>ee([J,H((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};te.entries,te.map,te.filter,te.reduce,te.some,te.every,te.pipeline,te.all,te.allValues;var re=fetch;const{jsonTypeOf:ne,splitUrl:oe,safeResolveUrl:ae}=p,ie={},se={},ce=(e,t)=>{const r=e in se?se[e]:e;if(r in ie)return ie[r][t]},le={},ue={},fe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=oe(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ce(n,"baseToken"),a=ce(n,"anchorToken"),i=oe(t)[0];if(!i&&!oe(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=ae(i,e[o]||""),[c,l]=oe(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(ue[i]=c);const u={},f=ce(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=ce(n,"vocabularyToken");ne(e[d],"object")?(se[c]=n,p=e[d],delete e[d]):(se[c]=n,p={[n]:!0});const h={"":""};return le[c]={id:c,schemaVersion:n,schema:pe(e,c,n,$.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:p,validated:!1},c},pe=(e,t,r,n,o,a)=>{if(ne(e,"object")){const i="string"==typeof e.$schema?oe(e.$schema)[0]:r,s=ce(i,"embeddedToken"),c=ce(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=ae(t,e[s]);return e[s]=n,fe(e,n,r),x.cons(e[s],e)}const l=ce(r,"anchorToken"),u=ce(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=ce(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=ce(r,"jrefToken");if("string"==typeof e[p])return x.cons(e[p],e);for(const i in e)e[i]=pe(e[i],t,r,$.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>pe(e,t,r,$.append(i,n),o,a))):e},de=e=>le[ue[e]]||le[e],he=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:$.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ye=async(e,t=he)=>{const r=ae(me(t),e),[n,o]=oe(r);if(!(e=>e in le||e in ue)(n)){const e=await re(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=W.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}fe(await e.json(),n)}const a=de(n),i="/"!==o[0]?be(a,o):o,s=Object.freeze({...a,pointer:i,value:$.get(i,a.schema)});return ve(s)},ve=e=>x.isReference(e.value)?ye(x.href(e.value),e):e,be=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},me=e=>`${e.id}#${encodeURI(e.pointer)}`,we=e=>x.isReference(e.value)?x.value(e.value):e.value,ge=(e,t)=>{const r=de(t.id),n=Object.freeze({...t,pointer:$.append(e,t.pointer),value:we(t)[e],validated:r.validated});return ve(n)},Oe=t(((e,t)=>te.pipeline([we,te.map((async(r,n)=>e(await ge(n,t),n))),te.all],t)));var Ee={setConfig:(e,t,r)=>{ie[e]||(ie[e]={}),ie[e][t]=r},getConfig:ce,add:fe,get:ye,markValidated:e=>{le[e].validated=!0},uri:me,value:we,getAnchorPointer:be,typeOf:(e,t)=>ne(we(e),t),has:(e,t)=>e in we(t),step:ge,keys:e=>Object.keys(we(e)),entries:e=>te.pipeline([we,Object.keys,te.map((async t=>[t,await ge(t,e)])),te.all],e),map:Oe,length:e=>we(e).length};Ee.setConfig,Ee.getConfig,Ee.add,Ee.get,Ee.markValidated,Ee.uri,Ee.value,Ee.getAnchorPointer,Ee.typeOf,Ee.has,Ee.step,Ee.keys,Ee.entries,Ee.map,Ee.length;class je extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var $e=je;const{splitUrl:Se}=p,Pe="FLAG",xe="BASIC",Ae="DETAILED",Ie="VERBOSE";let Te=Ae,ke=!0;const Ve=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await _e(e,t)}},Re=t((({ast:e,schemaUri:t},r,n=Pe)=>{if(![Pe,xe,Ae,Ie].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",Ue(n,a));return Ne(t,r,e,{}),o.unsubscribe(i),a[0]})),Ue=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===xe&&(o.push(...t.errors),delete t.errors),(e===Ie||e!==Pe&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ce={},ze=e=>Ce[e],Ke=e=>e in Ce,Le={},qe={},_e=async(e,t)=>{if(e=await De(e),!Ke(`${e.schemaVersion}#validate`)){const t=await Ee.get(e.schemaVersion);(Ee.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 Le)Object.entries(Le[e]).forEach((([e,r])=>{((e,t)=>{Ce[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(ke&&!e.validated){if(Ee.markValidated(e.id),!(e.schemaVersion in qe)){const t=await Ee.get(e.schemaVersion),r=await Ve(t);qe[t.id]=Re(r)}const t=L.cons(e.schema,e.id),r=qe[e.schemaVersion](t,Te);if(!r.valid)throw new $e(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),ze(`${e.schemaVersion}#validate`).compile(e,t)},De=async e=>Ee.typeOf(e,"string")?De(await Ee.get(Ee.value(e),e)):e,Ne=(e,t,r,n)=>{const o=Be(e,r),a=Se(e)[0];return ze(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Be=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Fe={validate:async(e,t,r)=>{const n=await Ve(e),o=(e,t)=>Re(n,L.cons(e),t);return void 0===t?o:o(t,r)},compile:Ve,interpret:Re,setMetaOutputFormat:e=>{Te=e},setShouldMetaValidate:e=>{ke=e},FLAG:Pe,BASIC:xe,DETAILED:Ae,VERBOSE:Ie,add:(e,t="",r="")=>{const n=Ee.add(e,t,r);delete qe[n]},getKeyword:ze,hasKeyword:Ke,defineVocabulary:(e,t)=>{Le[e]=t},compileSchema:_e,interpretSchema:Ne,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Be(e,r);return ze(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Be(e,r);return ze(a).collectEvaluatedItems(e,t,r,n,o)}};var Ze={compile:e=>Ee.value(e),interpret:()=>!0};var Me={compile:async(e,t)=>{const r=Ee.uri(e);if(!(r in t)){t[r]=!1;const n=Ee.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Ee.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Ee.uri(e),"boolean"==typeof n?n:await te.pipeline([Ee.entries,te.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),te.filter((([t])=>Fe.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),te.map((async([r,n])=>{const o=await Fe.getKeyword(r).compile(n,t,e);return[r,Ee.uri(n),o]})),te.all],e)]}return r},interpret:(e,t,r,n)=>{const[a,i,s]=r[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=Fe.getKeyword(e).interpret(i,t,r,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:L.uri(t),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:L.uri(t),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Fe.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Fe.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},We={metaData:Ze,validate:Me},Je={Core:Fe,Schema:Ee,Instance:L,Reference:x,Keywords:We,InvalidSchemaError:$e},Ge=Je.Core,He=Je.Schema,Qe=Je.Instance,Xe=Je.Reference,Ye=Je.Keywords,et=Je.InvalidSchemaError;e.Core=Ge,e.Instance=Qe,e.InvalidSchemaError=et,e.Keywords=Ye,e.Reference=Xe,e.Schema=He,e.default=Je,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-amd.min.js.map |
@@ -800,2 +800,6 @@ 'use strict'; | ||
var reference = { cons: cons$1, isReference, href, value: value$2 }; | ||
reference.cons; | ||
reference.isReference; | ||
reference.href; | ||
reference.value; | ||
@@ -1728,15 +1732,17 @@ const { jsonTypeOf: jsonTypeOf$1 } = common; | ||
var lib = { Core: core, Schema: schema, Instance: instance, Keywords: keywords, InvalidSchemaError: invalidSchemaError }; | ||
var lib = { Core: core, Schema: schema, Instance: instance, Reference: reference, Keywords: keywords, InvalidSchemaError: invalidSchemaError }; | ||
var lib_1 = lib.Core; | ||
var lib_2 = lib.Schema; | ||
var lib_3 = lib.Instance; | ||
var lib_4 = lib.Keywords; | ||
var lib_5 = lib.InvalidSchemaError; | ||
var lib_4 = lib.Reference; | ||
var lib_5 = lib.Keywords; | ||
var lib_6 = lib.InvalidSchemaError; | ||
exports.Core = lib_1; | ||
exports.Instance = lib_3; | ||
exports.InvalidSchemaError = lib_5; | ||
exports.Keywords = lib_4; | ||
exports.InvalidSchemaError = lib_6; | ||
exports.Keywords = lib_5; | ||
exports.Reference = lib_4; | ||
exports.Schema = lib_2; | ||
exports["default"] = lib; | ||
//# sourceMappingURL=json-schema-core-cjs.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=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)))}}};var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r,n=(function(e,r){var n;n={},("object"==typeof window&&window||t).PubSub=n,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function p(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function f(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!p(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return f(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return f(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},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)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(r=e.exports=n),r.PubSub=n,e.exports=r=n}(r={exports:{}},r.exports),r.exports);n.PubSub;var o=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),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}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(s.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)?a(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+i(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,s=r.path,c=r.host;return 0===e.length?a=s:(s=s.substring(0,s.lastIndexOf("/")),a=i(s+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:a(e)}};function a(e){return e+("/"===e[e.length-1]?"":"/")}function i(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 s=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const c={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},l=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)]},u=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var p={jsonTypeOf:(e,t)=>c[t](e),splitUrl:l,safeResolveUrl:(e,t)=>{const r=o(e,t),n=l(e)[0];if(n&&"file"===u(r)&&"file"!==u(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const f=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(w)},d=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:d(e,O(t,o,n),r,v(o,n))}}if(Array.isArray(t)){const n=[...t];return n[g(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:O(t,e[0],n)},h=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||E(t)){const o=e.shift();h(e,O(t,o,n),r,v(o,n))}else{t[g(t,e[0])]=r}},y=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=O(t,n,r);return{...t,[n]:y(e,o,v(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 O(t,e[0],r)}},b=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=O(t,n,r);b(e,o,v(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:O(t,e[0],r)},v=e(((e,t)=>t+"/"+m(e))),m=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),w=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),g=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,O=(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(E(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[g(e,t)]},E=e=>null===e||"object"!=typeof e;var j={nil:"",append:v,get:(e,t)=>{const r=f(e),n=e=>r.reduce((([e,t],r)=>[O(e,r,t),v(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(t,r,n)=>{const o=f(t),a=e(((e,t)=>d(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(t,r,n)=>{const o=f(t),a=e(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=f(e),n=e=>y(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=f(e),n=e=>b(r,e,"");return void 0===t?n:n(t)}};j.nil,j.append,j.get,j.set,j.assign,j.unset,j.remove;const $=Symbol("$__value"),S=Symbol("$__href");var x=(e,t)=>Object.freeze({[S]:e,[$]:t}),P=e=>e&&void 0!==e[S],A=e=>e[S],I=e=>e[$];const{jsonTypeOf:T}=p,k=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),V=e=>P(e.value)?I(e.value):e.value,U=e(((e,t)=>T(V(e),t))),C=(e,t)=>Object.freeze({...t,pointer:j.append(e,t.pointer),value:V(t)[e]}),R=e(((e,t)=>V(t).map(((r,n,o,a)=>e(C(n,t),n,o,a))))),z=e(((e,t)=>V(t).map(((e,r,n,o)=>C(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),K=e(((e,t,r)=>V(r).reduce(((t,n,o)=>e(t,C(o,r),o)),t))),L=e(((e,t)=>V(t).every(((r,n,o,a)=>e(C(n,t),n,o,a))))),q=e(((e,t)=>V(t).some(((r,n,o,a)=>e(C(n,t),n,o,a)))));var _={nil:k,cons:(e,t="")=>Object.freeze({...k,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:V,has:(e,t)=>e in V(t),typeOf:U,step:C,entries:e=>Object.keys(V(e)).map((t=>[t,C(t,e)])),keys:e=>Object.keys(V(e)),map:R,filter:z,reduce:K,every:L,some:q,length:e=>V(e).length},D=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,N=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,F=/\\([\u000b\u0020-\u00ff])/g,Z=/([\\"])/g,M=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function W(e){var t=String(e);if(B.test(t))return t;if(t.length>0&&!N.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(Z,"\\$1")+'"'}function J(e){this.parameters=Object.create(null),this.type=e}var G={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!M.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!B.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+W(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!M.test(n))throw new TypeError("invalid media type");var o=new J(n.toLowerCase());if(-1!==r){var a,i,s;for(D.lastIndex=r;i=D.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(F,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},H=async e=>Object.entries(await e),Q=e((async(e,t)=>(await t).map(e))),X=e((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),Y=e((async(e,t,r={})=>X((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),ee=e((async(e,t)=>{const r=await Q(e,t);return(await Promise.all(r)).some((e=>e))})),te=e((async(e,t)=>{const r=await Q(e,t);return(await Promise.all(r)).every((e=>e))})),re=e(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),ne={entries:H,map:Q,filter:Y,reduce:X,some:ee,every:te,pipeline:re,all:e=>Promise.all(e),allValues:e=>re([H,X((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};ne.entries,ne.map,ne.filter,ne.reduce,ne.some,ne.every,ne.pipeline,ne.all,ne.allValues;var oe=fetch;const{jsonTypeOf:ae,splitUrl:ie,safeResolveUrl:se}=p,ce={},le={},ue=(e,t)=>{const r=e in le?le[e]:e;if(r in ce)return ce[r][t]},pe={},fe={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ie(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ue(n,"baseToken"),a=ue(n,"anchorToken"),i=ie(t)[0];if(!i&&!ie(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=se(i,e[o]||""),[c,l]=ie(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(fe[i]=c);const u={},p=ue(n,"recursiveAnchorToken");let f;!0===e[p]&&(u[""]=`${c}#`,e[a]="",delete e[p]);const d=ue(n,"vocabularyToken");ae(e[d],"object")?(le[c]=n,f=e[d],delete e[d]):(le[c]=n,f={[n]:!0});const h={"":""};return pe[c]={id:c,schemaVersion:n,schema:he(e,c,n,j.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:f,validated:!1},c},he=(e,t,r,n,o,a)=>{if(ae(e,"object")){const i="string"==typeof e.$schema?ie(e.$schema)[0]:r,s=ue(i,"embeddedToken"),c=ue(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=se(t,e[s]);return e[s]=n,de(e,n,r),x(e[s],e)}const l=ue(r,"anchorToken"),u=ue(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const p=ue(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==p?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const f=ue(r,"jrefToken");if("string"==typeof e[f])return x(e[f],e);for(const i in e)e[i]=he(e[i],t,r,j.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>he(e,t,r,j.append(i,n),o,a))):e},ye=e=>pe[fe[e]]||pe[e],be=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:j.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ve=async(e,t=be)=>{const r=se(ge(t),e),[n,o]=ie(r);if(!(e=>e in pe||e in fe)(n)){const e=await oe(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=G.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),n)}const a=ye(n),i="/"!==o[0]?we(a,o):o,s=Object.freeze({...a,pointer:i,value:j.get(i,a.schema)});return me(s)},me=e=>P(e.value)?ve(A(e.value),e):e,we=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ge=e=>`${e.id}#${encodeURI(e.pointer)}`,Oe=e=>P(e.value)?I(e.value):e.value,Ee=(e,t)=>{const r=ye(t.id),n=Object.freeze({...t,pointer:j.append(e,t.pointer),value:Oe(t)[e],validated:r.validated});return me(n)},je=e(((e,t)=>ne.pipeline([Oe,ne.map((async(r,n)=>e(await Ee(n,t),n))),ne.all],t)));var $e={setConfig:(e,t,r)=>{ce[e]||(ce[e]={}),ce[e][t]=r},getConfig:ue,add:de,get:ve,markValidated:e=>{pe[e].validated=!0},uri:ge,value:Oe,getAnchorPointer:we,typeOf:(e,t)=>ae(Oe(e),t),has:(e,t)=>e in Oe(t),step:Ee,keys:e=>Object.keys(Oe(e)),entries:e=>ne.pipeline([Oe,Object.keys,ne.map((async t=>[t,await Ee(t,e)])),ne.all],e),map:je,length:e=>Oe(e).length};$e.setConfig,$e.getConfig,$e.add,$e.get,$e.markValidated,$e.uri,$e.value,$e.getAnchorPointer,$e.typeOf,$e.has,$e.step,$e.keys,$e.entries,$e.map,$e.length;class Se extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=Se;const{splitUrl:Pe}=p,Ae="FLAG",Ie="BASIC",Te="DETAILED",ke="VERBOSE";let Ve=Te,Ue=!0;const Ce=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await Ne(e,t)}},Re=e((({ast:e,schemaUri:t},r,o=Ae)=>{if(![Ae,Ie,Te,ke].includes(o))throw Error(`The '${o}' error format is not supported`);const a=[],i=n.subscribe("result",ze(o,a));return Fe(t,r,e,{}),n.unsubscribe(i),a[0]})),ze=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===Ie&&(o.push(...t.errors),delete t.errors),(e===ke||e!==Ae&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ke={},Le=e=>Ke[e],qe=e=>e in Ke,_e={},De={},Ne=async(e,t)=>{if(e=await Be(e),!qe(`${e.schemaVersion}#validate`)){const t=await $e.get(e.schemaVersion);($e.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 _e)Object.entries(_e[e]).forEach((([e,r])=>{((e,t)=>{Ke[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Ue&&!e.validated){if($e.markValidated(e.id),!(e.schemaVersion in De)){const t=await $e.get(e.schemaVersion),r=await Ce(t);De[t.id]=Re(r)}const t=_.cons(e.schema,e.id),r=De[e.schemaVersion](t,Ve);if(!r.valid)throw new xe(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Le(`${e.schemaVersion}#validate`).compile(e,t)},Be=async e=>$e.typeOf(e,"string")?Be(await $e.get($e.value(e),e)):e,Fe=(e,t,r,n)=>{const o=Ze(e,r),a=Pe(e)[0];return Le(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Ze=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Me={validate:async(e,t,r)=>{const n=await Ce(e),o=(e,t)=>Re(n,_.cons(e),t);return void 0===t?o:o(t,r)},compile:Ce,interpret:Re,setMetaOutputFormat:e=>{Ve=e},setShouldMetaValidate:e=>{Ue=e},FLAG:Ae,BASIC:Ie,DETAILED:Te,VERBOSE:ke,add:(e,t="",r="")=>{const n=$e.add(e,t,r);delete De[n]},getKeyword:Le,hasKeyword:qe,defineVocabulary:(e,t)=>{_e[e]=t},compileSchema:Ne,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Ze(e,r);return Le(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Ze(e,r);return Le(a).collectEvaluatedItems(e,t,r,n,o)}};var We={compile:e=>$e.value(e),interpret:()=>!0};var Je={compile:async(e,t)=>{const r=$e.uri(e);if(!(r in t)){t[r]=!1;const n=$e.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${$e.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,$e.uri(e),"boolean"==typeof n?n:await ne.pipeline([$e.entries,ne.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ne.filter((([t])=>Me.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),ne.map((async([r,n])=>{const o=await Me.getKeyword(r).compile(n,t,e);return[r,$e.uri(n),o]})),ne.all],e)]}return r},interpret:(e,t,r,o)=>{const[a,i,s]=r[e];n.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{n.publishSync("result.start");const s=Me.getKeyword(e).interpret(i,t,r,o);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:_.uri(t),valid:s,ast:i}),n.publishSync("result.end"),s}));return n.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:_.uri(t),valid:c,ast:e}),n.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Me.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Me.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Ge={metaData:We,validate:Je},He={Core:Me,Schema:$e,Instance:_,Keywords:Ge,InvalidSchemaError:xe},Qe=He.Core,Xe=He.Schema,Ye=He.Instance,et=He.Keywords,tt=He.InvalidSchemaError;exports.Core=Qe,exports.Instance=Ye,exports.InvalidSchemaError=tt,exports.Keywords=et,exports.Schema=Xe,exports.default=He; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=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)))}}};var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r,n=(function(e,r){var n;n={},("object"==typeof window&&window||t).PubSub=n,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},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)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(r=e.exports=n),r.PubSub=n,e.exports=r=n}(r={exports:{}},r.exports),r.exports);n.PubSub;var o=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),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}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(s.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)?a(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+i(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,s=r.path,c=r.host;return 0===e.length?a=s:(s=s.substring(0,s.lastIndexOf("/")),a=i(s+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:a(e)}};function a(e){return e+("/"===e[e.length-1]?"":"/")}function i(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 s=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const c={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},l=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)]},u=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var f={jsonTypeOf:(e,t)=>c[t](e),splitUrl:l,safeResolveUrl:(e,t)=>{const r=o(e,t),n=l(e)[0];if(n&&"file"===u(r)&&"file"!==u(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const p=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(w)},d=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:d(e,O(t,o,n),r,b(o,n))}}if(Array.isArray(t)){const n=[...t];return n[g(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:O(t,e[0],n)},h=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||E(t)){const o=e.shift();h(e,O(t,o,n),r,b(o,n))}else{t[g(t,e[0])]=r}},y=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=O(t,n,r);return{...t,[n]:y(e,o,b(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 O(t,e[0],r)}},v=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=O(t,n,r);v(e,o,b(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:O(t,e[0],r)},b=e(((e,t)=>t+"/"+m(e))),m=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),w=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),g=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,O=(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(E(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[g(e,t)]},E=e=>null===e||"object"!=typeof e;var j={nil:"",append:b,get:(e,t)=>{const r=p(e),n=e=>r.reduce((([e,t],r)=>[O(e,r,t),b(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(t,r,n)=>{const o=p(t),a=e(((e,t)=>d(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(t,r,n)=>{const o=p(t),a=e(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=p(e),n=e=>y(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=p(e),n=e=>v(r,e,"");return void 0===t?n:n(t)}};j.nil,j.append,j.get,j.set,j.assign,j.unset,j.remove;const $=Symbol("$__value"),S=Symbol("$__href");var x={cons:(e,t)=>Object.freeze({[S]:e,[$]:t}),isReference:e=>e&&void 0!==e[S],href:e=>e[S],value:e=>e[$]};const{jsonTypeOf:P}=f,A=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),I=e=>x.isReference(e.value)?x.value(e.value):e.value,T=e(((e,t)=>P(I(e),t))),k=(e,t)=>Object.freeze({...t,pointer:j.append(e,t.pointer),value:I(t)[e]}),V=e(((e,t)=>I(t).map(((r,n,o,a)=>e(k(n,t),n,o,a))))),R=e(((e,t)=>I(t).map(((e,r,n,o)=>k(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),U=e(((e,t,r)=>I(r).reduce(((t,n,o)=>e(t,k(o,r),o)),t))),C=e(((e,t)=>I(t).every(((r,n,o,a)=>e(k(n,t),n,o,a))))),z=e(((e,t)=>I(t).some(((r,n,o,a)=>e(k(n,t),n,o,a)))));var K={nil:A,cons:(e,t="")=>Object.freeze({...A,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:I,has:(e,t)=>e in I(t),typeOf:T,step:k,entries:e=>Object.keys(I(e)).map((t=>[t,k(t,e)])),keys:e=>Object.keys(I(e)),map:V,filter:R,reduce:U,every:C,some:z,length:e=>I(e).length},L=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,q=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,_=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,D=/\\([\u000b\u0020-\u00ff])/g,N=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function F(e){var t=String(e);if(_.test(t))return t;if(t.length>0&&!q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(N,"\\$1")+'"'}function Z(e){this.parameters=Object.create(null),this.type=e}var M={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!B.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!_.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+F(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!B.test(n))throw new TypeError("invalid media type");var o=new Z(n.toLowerCase());if(-1!==r){var a,i,s;for(L.lastIndex=r;i=L.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(D,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},W=async e=>Object.entries(await e),J=e((async(e,t)=>(await t).map(e))),G=e((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),H=e((async(e,t,r={})=>G((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),Q=e((async(e,t)=>{const r=await J(e,t);return(await Promise.all(r)).some((e=>e))})),X=e((async(e,t)=>{const r=await J(e,t);return(await Promise.all(r)).every((e=>e))})),Y=e(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),ee={entries:W,map:J,filter:H,reduce:G,some:Q,every:X,pipeline:Y,all:e=>Promise.all(e),allValues:e=>Y([W,G((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};ee.entries,ee.map,ee.filter,ee.reduce,ee.some,ee.every,ee.pipeline,ee.all,ee.allValues;var te=fetch;const{jsonTypeOf:re,splitUrl:ne,safeResolveUrl:oe}=f,ae={},ie={},se=(e,t)=>{const r=e in ie?ie[e]:e;if(r in ae)return ae[r][t]},ce={},le={},ue=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ne(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=se(n,"baseToken"),a=se(n,"anchorToken"),i=ne(t)[0];if(!i&&!ne(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=oe(i,e[o]||""),[c,l]=ne(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(le[i]=c);const u={},f=se(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=se(n,"vocabularyToken");re(e[d],"object")?(ie[c]=n,p=e[d],delete e[d]):(ie[c]=n,p={[n]:!0});const h={"":""};return ce[c]={id:c,schemaVersion:n,schema:fe(e,c,n,j.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:p,validated:!1},c},fe=(e,t,r,n,o,a)=>{if(re(e,"object")){const i="string"==typeof e.$schema?ne(e.$schema)[0]:r,s=se(i,"embeddedToken"),c=se(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(t,e[s]);return e[s]=n,ue(e,n,r),x.cons(e[s],e)}const l=se(r,"anchorToken"),u=se(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=se(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=se(r,"jrefToken");if("string"==typeof e[p])return x.cons(e[p],e);for(const i in e)e[i]=fe(e[i],t,r,j.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>fe(e,t,r,j.append(i,n),o,a))):e},pe=e=>ce[le[e]]||ce[e],de=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:j.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),he=async(e,t=de)=>{const r=oe(be(t),e),[n,o]=ne(r);if(!(e=>e in ce||e in le)(n)){const e=await te(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=M.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}ue(await e.json(),n)}const a=pe(n),i="/"!==o[0]?ve(a,o):o,s=Object.freeze({...a,pointer:i,value:j.get(i,a.schema)});return ye(s)},ye=e=>x.isReference(e.value)?he(x.href(e.value),e):e,ve=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},be=e=>`${e.id}#${encodeURI(e.pointer)}`,me=e=>x.isReference(e.value)?x.value(e.value):e.value,we=(e,t)=>{const r=pe(t.id),n=Object.freeze({...t,pointer:j.append(e,t.pointer),value:me(t)[e],validated:r.validated});return ye(n)},ge=e(((e,t)=>ee.pipeline([me,ee.map((async(r,n)=>e(await we(n,t),n))),ee.all],t)));var Oe={setConfig:(e,t,r)=>{ae[e]||(ae[e]={}),ae[e][t]=r},getConfig:se,add:ue,get:he,markValidated:e=>{ce[e].validated=!0},uri:be,value:me,getAnchorPointer:ve,typeOf:(e,t)=>re(me(e),t),has:(e,t)=>e in me(t),step:we,keys:e=>Object.keys(me(e)),entries:e=>ee.pipeline([me,Object.keys,ee.map((async t=>[t,await we(t,e)])),ee.all],e),map:ge,length:e=>me(e).length};Oe.setConfig,Oe.getConfig,Oe.add,Oe.get,Oe.markValidated,Oe.uri,Oe.value,Oe.getAnchorPointer,Oe.typeOf,Oe.has,Oe.step,Oe.keys,Oe.entries,Oe.map,Oe.length;class Ee extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var je=Ee;const{splitUrl:$e}=f,Se="FLAG",xe="BASIC",Pe="DETAILED",Ae="VERBOSE";let Ie=Pe,Te=!0;const ke=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await qe(e,t)}},Ve=e((({ast:e,schemaUri:t},r,o=Se)=>{if(![Se,xe,Pe,Ae].includes(o))throw Error(`The '${o}' error format is not supported`);const a=[],i=n.subscribe("result",Re(o,a));return De(t,r,e,{}),n.unsubscribe(i),a[0]})),Re=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===xe&&(o.push(...t.errors),delete t.errors),(e===Ae||e!==Se&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ue={},Ce=e=>Ue[e],ze=e=>e in Ue,Ke={},Le={},qe=async(e,t)=>{if(e=await _e(e),!ze(`${e.schemaVersion}#validate`)){const t=await Oe.get(e.schemaVersion);(Oe.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 Ke)Object.entries(Ke[e]).forEach((([e,r])=>{((e,t)=>{Ue[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Te&&!e.validated){if(Oe.markValidated(e.id),!(e.schemaVersion in Le)){const t=await Oe.get(e.schemaVersion),r=await ke(t);Le[t.id]=Ve(r)}const t=K.cons(e.schema,e.id),r=Le[e.schemaVersion](t,Ie);if(!r.valid)throw new je(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Ce(`${e.schemaVersion}#validate`).compile(e,t)},_e=async e=>Oe.typeOf(e,"string")?_e(await Oe.get(Oe.value(e),e)):e,De=(e,t,r,n)=>{const o=Ne(e,r),a=$e(e)[0];return Ce(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Ne=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Be={validate:async(e,t,r)=>{const n=await ke(e),o=(e,t)=>Ve(n,K.cons(e),t);return void 0===t?o:o(t,r)},compile:ke,interpret:Ve,setMetaOutputFormat:e=>{Ie=e},setShouldMetaValidate:e=>{Te=e},FLAG:Se,BASIC:xe,DETAILED:Pe,VERBOSE:Ae,add:(e,t="",r="")=>{const n=Oe.add(e,t,r);delete Le[n]},getKeyword:Ce,hasKeyword:ze,defineVocabulary:(e,t)=>{Ke[e]=t},compileSchema:qe,interpretSchema:De,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Ne(e,r);return Ce(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Ne(e,r);return Ce(a).collectEvaluatedItems(e,t,r,n,o)}};var Fe={compile:e=>Oe.value(e),interpret:()=>!0};var Ze={compile:async(e,t)=>{const r=Oe.uri(e);if(!(r in t)){t[r]=!1;const n=Oe.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Oe.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Oe.uri(e),"boolean"==typeof n?n:await ee.pipeline([Oe.entries,ee.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ee.filter((([t])=>Be.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),ee.map((async([r,n])=>{const o=await Be.getKeyword(r).compile(n,t,e);return[r,Oe.uri(n),o]})),ee.all],e)]}return r},interpret:(e,t,r,o)=>{const[a,i,s]=r[e];n.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{n.publishSync("result.start");const s=Be.getKeyword(e).interpret(i,t,r,o);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:K.uri(t),valid:s,ast:i}),n.publishSync("result.end"),s}));return n.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:K.uri(t),valid:c,ast:e}),n.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Be.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Be.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Me={metaData:Fe,validate:Ze},We={Core:Be,Schema:Oe,Instance:K,Reference:x,Keywords:Me,InvalidSchemaError:je},Je=We.Core,Ge=We.Schema,He=We.Instance,Qe=We.Reference,Xe=We.Keywords,Ye=We.InvalidSchemaError;exports.Core=Je,exports.Instance=He,exports.InvalidSchemaError=Ye,exports.Keywords=Xe,exports.Reference=Qe,exports.Schema=Ge,exports.default=We; | ||
//# sourceMappingURL=json-schema-core-cjs.min.js.map |
@@ -796,2 +796,6 @@ var justCurryIt = curry; | ||
var reference = { cons: cons$1, isReference, href, value: value$2 }; | ||
reference.cons; | ||
reference.isReference; | ||
reference.href; | ||
reference.value; | ||
@@ -1724,10 +1728,11 @@ const { jsonTypeOf: jsonTypeOf$1 } = common; | ||
var lib = { Core: core, Schema: schema, Instance: instance, Keywords: keywords, InvalidSchemaError: invalidSchemaError }; | ||
var lib = { Core: core, Schema: schema, Instance: instance, Reference: reference, Keywords: keywords, InvalidSchemaError: invalidSchemaError }; | ||
var lib_1 = lib.Core; | ||
var lib_2 = lib.Schema; | ||
var lib_3 = lib.Instance; | ||
var lib_4 = lib.Keywords; | ||
var lib_5 = lib.InvalidSchemaError; | ||
var lib_4 = lib.Reference; | ||
var lib_5 = lib.Keywords; | ||
var lib_6 = lib.InvalidSchemaError; | ||
export { lib_1 as Core, lib_3 as Instance, lib_5 as InvalidSchemaError, lib_4 as Keywords, lib_2 as Schema, lib as default }; | ||
export { lib_1 as Core, lib_3 as Instance, lib_6 as InvalidSchemaError, lib_5 as Keywords, lib_4 as Reference, lib_2 as Schema, lib as default }; | ||
//# sourceMappingURL=json-schema-core-esm.js.map |
@@ -1,2 +0,2 @@ | ||
var e=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)))}}};var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r,n=(function(e,r){var n;n={},("object"==typeof window&&window||t).PubSub=n,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},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)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(r=e.exports=n),r.PubSub=n,e.exports=r=n}(r={exports:{}},r.exports),r.exports);n.PubSub;var o=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),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}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(s.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)?a(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+i(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,s=r.path,c=r.host;return 0===e.length?a=s:(s=s.substring(0,s.lastIndexOf("/")),a=i(s+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:a(e)}};function a(e){return e+("/"===e[e.length-1]?"":"/")}function i(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 s=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const c={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},l=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)]},u=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var f={jsonTypeOf:(e,t)=>c[t](e),splitUrl:l,safeResolveUrl:(e,t)=>{const r=o(e,t),n=l(e)[0];if(n&&"file"===u(r)&&"file"!==u(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const p=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(w)},d=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:d(e,O(t,o,n),r,v(o,n))}}if(Array.isArray(t)){const n=[...t];return n[g(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:O(t,e[0],n)},h=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||E(t)){const o=e.shift();h(e,O(t,o,n),r,v(o,n))}else{t[g(t,e[0])]=r}},y=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=O(t,n,r);return{...t,[n]:y(e,o,v(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 O(t,e[0],r)}},b=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=O(t,n,r);b(e,o,v(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:O(t,e[0],r)},v=e(((e,t)=>t+"/"+m(e))),m=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),w=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),g=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,O=(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(E(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[g(e,t)]},E=e=>null===e||"object"!=typeof e;var j={nil:"",append:v,get:(e,t)=>{const r=p(e),n=e=>r.reduce((([e,t],r)=>[O(e,r,t),v(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(t,r,n)=>{const o=p(t),a=e(((e,t)=>d(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(t,r,n)=>{const o=p(t),a=e(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=p(e),n=e=>y(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=p(e),n=e=>b(r,e,"");return void 0===t?n:n(t)}};j.nil,j.append,j.get,j.set,j.assign,j.unset,j.remove;const $=Symbol("$__value"),S=Symbol("$__href");var x=(e,t)=>Object.freeze({[S]:e,[$]:t}),A=e=>e&&void 0!==e[S],P=e=>e[S],I=e=>e[$];const{jsonTypeOf:T}=f,k=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),V=e=>A(e.value)?I(e.value):e.value,U=e(((e,t)=>T(V(e),t))),C=(e,t)=>Object.freeze({...t,pointer:j.append(e,t.pointer),value:V(t)[e]}),R=e(((e,t)=>V(t).map(((r,n,o,a)=>e(C(n,t),n,o,a))))),z=e(((e,t)=>V(t).map(((e,r,n,o)=>C(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),K=e(((e,t,r)=>V(r).reduce(((t,n,o)=>e(t,C(o,r),o)),t))),L=e(((e,t)=>V(t).every(((r,n,o,a)=>e(C(n,t),n,o,a))))),q=e(((e,t)=>V(t).some(((r,n,o,a)=>e(C(n,t),n,o,a)))));var _={nil:k,cons:(e,t="")=>Object.freeze({...k,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:V,has:(e,t)=>e in V(t),typeOf:U,step:C,entries:e=>Object.keys(V(e)).map((t=>[t,C(t,e)])),keys:e=>Object.keys(V(e)),map:R,filter:z,reduce:K,every:L,some:q,length:e=>V(e).length},D=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,N=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,F=/\\([\u000b\u0020-\u00ff])/g,Z=/([\\"])/g,W=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function J(e){var t=String(e);if(B.test(t))return t;if(t.length>0&&!N.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(Z,"\\$1")+'"'}function M(e){this.parameters=Object.create(null),this.type=e}var G={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!W.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!B.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+J(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!W.test(n))throw new TypeError("invalid media type");var o=new M(n.toLowerCase());if(-1!==r){var a,i,s;for(D.lastIndex=r;i=D.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(F,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},H=async e=>Object.entries(await e),Q=e((async(e,t)=>(await t).map(e))),X=e((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),Y=e((async(e,t,r={})=>X((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),ee=e((async(e,t)=>{const r=await Q(e,t);return(await Promise.all(r)).some((e=>e))})),te=e((async(e,t)=>{const r=await Q(e,t);return(await Promise.all(r)).every((e=>e))})),re=e(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),ne={entries:H,map:Q,filter:Y,reduce:X,some:ee,every:te,pipeline:re,all:e=>Promise.all(e),allValues:e=>re([H,X((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};ne.entries,ne.map,ne.filter,ne.reduce,ne.some,ne.every,ne.pipeline,ne.all,ne.allValues;var oe=fetch;const{jsonTypeOf:ae,splitUrl:ie,safeResolveUrl:se}=f,ce={},le={},ue=(e,t)=>{const r=e in le?le[e]:e;if(r in ce)return ce[r][t]},fe={},pe={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ie(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ue(n,"baseToken"),a=ue(n,"anchorToken"),i=ie(t)[0];if(!i&&!ie(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=se(i,e[o]||""),[c,l]=ie(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(pe[i]=c);const u={},f=ue(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=ue(n,"vocabularyToken");ae(e[d],"object")?(le[c]=n,p=e[d],delete e[d]):(le[c]=n,p={[n]:!0});const h={"":""};return fe[c]={id:c,schemaVersion:n,schema:he(e,c,n,j.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:p,validated:!1},c},he=(e,t,r,n,o,a)=>{if(ae(e,"object")){const i="string"==typeof e.$schema?ie(e.$schema)[0]:r,s=ue(i,"embeddedToken"),c=ue(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=se(t,e[s]);return e[s]=n,de(e,n,r),x(e[s],e)}const l=ue(r,"anchorToken"),u=ue(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=ue(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=ue(r,"jrefToken");if("string"==typeof e[p])return x(e[p],e);for(const i in e)e[i]=he(e[i],t,r,j.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>he(e,t,r,j.append(i,n),o,a))):e},ye=e=>fe[pe[e]]||fe[e],be=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:j.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ve=async(e,t=be)=>{const r=se(ge(t),e),[n,o]=ie(r);if(!(e=>e in fe||e in pe)(n)){const e=await oe(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=G.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),n)}const a=ye(n),i="/"!==o[0]?we(a,o):o,s=Object.freeze({...a,pointer:i,value:j.get(i,a.schema)});return me(s)},me=e=>A(e.value)?ve(P(e.value),e):e,we=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ge=e=>`${e.id}#${encodeURI(e.pointer)}`,Oe=e=>A(e.value)?I(e.value):e.value,Ee=(e,t)=>{const r=ye(t.id),n=Object.freeze({...t,pointer:j.append(e,t.pointer),value:Oe(t)[e],validated:r.validated});return me(n)},je=e(((e,t)=>ne.pipeline([Oe,ne.map((async(r,n)=>e(await Ee(n,t),n))),ne.all],t)));var $e={setConfig:(e,t,r)=>{ce[e]||(ce[e]={}),ce[e][t]=r},getConfig:ue,add:de,get:ve,markValidated:e=>{fe[e].validated=!0},uri:ge,value:Oe,getAnchorPointer:we,typeOf:(e,t)=>ae(Oe(e),t),has:(e,t)=>e in Oe(t),step:Ee,keys:e=>Object.keys(Oe(e)),entries:e=>ne.pipeline([Oe,Object.keys,ne.map((async t=>[t,await Ee(t,e)])),ne.all],e),map:je,length:e=>Oe(e).length};$e.setConfig,$e.getConfig,$e.add,$e.get,$e.markValidated,$e.uri,$e.value,$e.getAnchorPointer,$e.typeOf,$e.has,$e.step,$e.keys,$e.entries,$e.map,$e.length;class Se extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=Se;const{splitUrl:Ae}=f,Pe="FLAG",Ie="BASIC",Te="DETAILED",ke="VERBOSE";let Ve=Te,Ue=!0;const Ce=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await Ne(e,t)}},Re=e((({ast:e,schemaUri:t},r,o=Pe)=>{if(![Pe,Ie,Te,ke].includes(o))throw Error(`The '${o}' error format is not supported`);const a=[],i=n.subscribe("result",ze(o,a));return Fe(t,r,e,{}),n.unsubscribe(i),a[0]})),ze=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===Ie&&(o.push(...t.errors),delete t.errors),(e===ke||e!==Pe&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ke={},Le=e=>Ke[e],qe=e=>e in Ke,_e={},De={},Ne=async(e,t)=>{if(e=await Be(e),!qe(`${e.schemaVersion}#validate`)){const t=await $e.get(e.schemaVersion);($e.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 _e)Object.entries(_e[e]).forEach((([e,r])=>{((e,t)=>{Ke[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Ue&&!e.validated){if($e.markValidated(e.id),!(e.schemaVersion in De)){const t=await $e.get(e.schemaVersion),r=await Ce(t);De[t.id]=Re(r)}const t=_.cons(e.schema,e.id),r=De[e.schemaVersion](t,Ve);if(!r.valid)throw new xe(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Le(`${e.schemaVersion}#validate`).compile(e,t)},Be=async e=>$e.typeOf(e,"string")?Be(await $e.get($e.value(e),e)):e,Fe=(e,t,r,n)=>{const o=Ze(e,r),a=Ae(e)[0];return Le(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Ze=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var We={validate:async(e,t,r)=>{const n=await Ce(e),o=(e,t)=>Re(n,_.cons(e),t);return void 0===t?o:o(t,r)},compile:Ce,interpret:Re,setMetaOutputFormat:e=>{Ve=e},setShouldMetaValidate:e=>{Ue=e},FLAG:Pe,BASIC:Ie,DETAILED:Te,VERBOSE:ke,add:(e,t="",r="")=>{const n=$e.add(e,t,r);delete De[n]},getKeyword:Le,hasKeyword:qe,defineVocabulary:(e,t)=>{_e[e]=t},compileSchema:Ne,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Ze(e,r);return Le(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Ze(e,r);return Le(a).collectEvaluatedItems(e,t,r,n,o)}};var Je={compile:e=>$e.value(e),interpret:()=>!0};var Me={compile:async(e,t)=>{const r=$e.uri(e);if(!(r in t)){t[r]=!1;const n=$e.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${$e.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,$e.uri(e),"boolean"==typeof n?n:await ne.pipeline([$e.entries,ne.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ne.filter((([t])=>We.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),ne.map((async([r,n])=>{const o=await We.getKeyword(r).compile(n,t,e);return[r,$e.uri(n),o]})),ne.all],e)]}return r},interpret:(e,t,r,o)=>{const[a,i,s]=r[e];n.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{n.publishSync("result.start");const s=We.getKeyword(e).interpret(i,t,r,o);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:_.uri(t),valid:s,ast:i}),n.publishSync("result.end"),s}));return n.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:_.uri(t),valid:c,ast:e}),n.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&We.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&We.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Ge={metaData:Je,validate:Me},He={Core:We,Schema:$e,Instance:_,Keywords:Ge,InvalidSchemaError:xe},Qe=He.Core,Xe=He.Schema,Ye=He.Instance,et=He.Keywords,tt=He.InvalidSchemaError;export{Qe as Core,Ye as Instance,tt as InvalidSchemaError,et as Keywords,Xe as Schema,He as default}; | ||
var e=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)))}}};var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r,n=(function(e,r){var n;n={},("object"==typeof window&&window||t).PubSub=n,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},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)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(r=e.exports=n),r.PubSub=n,e.exports=r=n}(r={exports:{}},r.exports),r.exports);n.PubSub;var o=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),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}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(s.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)?a(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+i(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,s=r.path,c=r.host;return 0===e.length?a=s:(s=s.substring(0,s.lastIndexOf("/")),a=i(s+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:a(e)}};function a(e){return e+("/"===e[e.length-1]?"":"/")}function i(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 s=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const c={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},l=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)]},u=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var f={jsonTypeOf:(e,t)=>c[t](e),splitUrl:l,safeResolveUrl:(e,t)=>{const r=o(e,t),n=l(e)[0];if(n&&"file"===u(r)&&"file"!==u(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const p=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(w)},d=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:d(e,O(t,o,n),r,b(o,n))}}if(Array.isArray(t)){const n=[...t];return n[g(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:O(t,e[0],n)},h=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||E(t)){const o=e.shift();h(e,O(t,o,n),r,b(o,n))}else{t[g(t,e[0])]=r}},y=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=O(t,n,r);return{...t,[n]:y(e,o,b(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 O(t,e[0],r)}},v=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=O(t,n,r);v(e,o,b(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:O(t,e[0],r)},b=e(((e,t)=>t+"/"+m(e))),m=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),w=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),g=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,O=(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(E(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[g(e,t)]},E=e=>null===e||"object"!=typeof e;var j={nil:"",append:b,get:(e,t)=>{const r=p(e),n=e=>r.reduce((([e,t],r)=>[O(e,r,t),b(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(t,r,n)=>{const o=p(t),a=e(((e,t)=>d(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(t,r,n)=>{const o=p(t),a=e(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=p(e),n=e=>y(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=p(e),n=e=>v(r,e,"");return void 0===t?n:n(t)}};j.nil,j.append,j.get,j.set,j.assign,j.unset,j.remove;const $=Symbol("$__value"),S=Symbol("$__href");var x={cons:(e,t)=>Object.freeze({[S]:e,[$]:t}),isReference:e=>e&&void 0!==e[S],href:e=>e[S],value:e=>e[$]};const{jsonTypeOf:A}=f,P=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),I=e=>x.isReference(e.value)?x.value(e.value):e.value,T=e(((e,t)=>A(I(e),t))),k=(e,t)=>Object.freeze({...t,pointer:j.append(e,t.pointer),value:I(t)[e]}),V=e(((e,t)=>I(t).map(((r,n,o,a)=>e(k(n,t),n,o,a))))),R=e(((e,t)=>I(t).map(((e,r,n,o)=>k(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),U=e(((e,t,r)=>I(r).reduce(((t,n,o)=>e(t,k(o,r),o)),t))),C=e(((e,t)=>I(t).every(((r,n,o,a)=>e(k(n,t),n,o,a))))),z=e(((e,t)=>I(t).some(((r,n,o,a)=>e(k(n,t),n,o,a)))));var K={nil:P,cons:(e,t="")=>Object.freeze({...P,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:I,has:(e,t)=>e in I(t),typeOf:T,step:k,entries:e=>Object.keys(I(e)).map((t=>[t,k(t,e)])),keys:e=>Object.keys(I(e)),map:V,filter:R,reduce:U,every:C,some:z,length:e=>I(e).length},L=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,q=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,_=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,D=/\\([\u000b\u0020-\u00ff])/g,N=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function F(e){var t=String(e);if(_.test(t))return t;if(t.length>0&&!q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(N,"\\$1")+'"'}function Z(e){this.parameters=Object.create(null),this.type=e}var W={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!B.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!_.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+F(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!B.test(n))throw new TypeError("invalid media type");var o=new Z(n.toLowerCase());if(-1!==r){var a,i,s;for(L.lastIndex=r;i=L.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(D,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},J=async e=>Object.entries(await e),M=e((async(e,t)=>(await t).map(e))),G=e((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),H=e((async(e,t,r={})=>G((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),Q=e((async(e,t)=>{const r=await M(e,t);return(await Promise.all(r)).some((e=>e))})),X=e((async(e,t)=>{const r=await M(e,t);return(await Promise.all(r)).every((e=>e))})),Y=e(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),ee={entries:J,map:M,filter:H,reduce:G,some:Q,every:X,pipeline:Y,all:e=>Promise.all(e),allValues:e=>Y([J,G((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};ee.entries,ee.map,ee.filter,ee.reduce,ee.some,ee.every,ee.pipeline,ee.all,ee.allValues;var te=fetch;const{jsonTypeOf:re,splitUrl:ne,safeResolveUrl:oe}=f,ae={},ie={},se=(e,t)=>{const r=e in ie?ie[e]:e;if(r in ae)return ae[r][t]},ce={},le={},ue=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ne(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=se(n,"baseToken"),a=se(n,"anchorToken"),i=ne(t)[0];if(!i&&!ne(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=oe(i,e[o]||""),[c,l]=ne(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(le[i]=c);const u={},f=se(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=se(n,"vocabularyToken");re(e[d],"object")?(ie[c]=n,p=e[d],delete e[d]):(ie[c]=n,p={[n]:!0});const h={"":""};return ce[c]={id:c,schemaVersion:n,schema:fe(e,c,n,j.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:p,validated:!1},c},fe=(e,t,r,n,o,a)=>{if(re(e,"object")){const i="string"==typeof e.$schema?ne(e.$schema)[0]:r,s=se(i,"embeddedToken"),c=se(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(t,e[s]);return e[s]=n,ue(e,n,r),x.cons(e[s],e)}const l=se(r,"anchorToken"),u=se(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=se(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=se(r,"jrefToken");if("string"==typeof e[p])return x.cons(e[p],e);for(const i in e)e[i]=fe(e[i],t,r,j.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>fe(e,t,r,j.append(i,n),o,a))):e},pe=e=>ce[le[e]]||ce[e],de=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:j.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),he=async(e,t=de)=>{const r=oe(be(t),e),[n,o]=ne(r);if(!(e=>e in ce||e in le)(n)){const e=await te(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=W.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}ue(await e.json(),n)}const a=pe(n),i="/"!==o[0]?ve(a,o):o,s=Object.freeze({...a,pointer:i,value:j.get(i,a.schema)});return ye(s)},ye=e=>x.isReference(e.value)?he(x.href(e.value),e):e,ve=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},be=e=>`${e.id}#${encodeURI(e.pointer)}`,me=e=>x.isReference(e.value)?x.value(e.value):e.value,we=(e,t)=>{const r=pe(t.id),n=Object.freeze({...t,pointer:j.append(e,t.pointer),value:me(t)[e],validated:r.validated});return ye(n)},ge=e(((e,t)=>ee.pipeline([me,ee.map((async(r,n)=>e(await we(n,t),n))),ee.all],t)));var Oe={setConfig:(e,t,r)=>{ae[e]||(ae[e]={}),ae[e][t]=r},getConfig:se,add:ue,get:he,markValidated:e=>{ce[e].validated=!0},uri:be,value:me,getAnchorPointer:ve,typeOf:(e,t)=>re(me(e),t),has:(e,t)=>e in me(t),step:we,keys:e=>Object.keys(me(e)),entries:e=>ee.pipeline([me,Object.keys,ee.map((async t=>[t,await we(t,e)])),ee.all],e),map:ge,length:e=>me(e).length};Oe.setConfig,Oe.getConfig,Oe.add,Oe.get,Oe.markValidated,Oe.uri,Oe.value,Oe.getAnchorPointer,Oe.typeOf,Oe.has,Oe.step,Oe.keys,Oe.entries,Oe.map,Oe.length;class Ee extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var je=Ee;const{splitUrl:$e}=f,Se="FLAG",xe="BASIC",Ae="DETAILED",Pe="VERBOSE";let Ie=Ae,Te=!0;const ke=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await qe(e,t)}},Ve=e((({ast:e,schemaUri:t},r,o=Se)=>{if(![Se,xe,Ae,Pe].includes(o))throw Error(`The '${o}' error format is not supported`);const a=[],i=n.subscribe("result",Re(o,a));return De(t,r,e,{}),n.unsubscribe(i),a[0]})),Re=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===xe&&(o.push(...t.errors),delete t.errors),(e===Pe||e!==Se&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ue={},Ce=e=>Ue[e],ze=e=>e in Ue,Ke={},Le={},qe=async(e,t)=>{if(e=await _e(e),!ze(`${e.schemaVersion}#validate`)){const t=await Oe.get(e.schemaVersion);(Oe.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 Ke)Object.entries(Ke[e]).forEach((([e,r])=>{((e,t)=>{Ue[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Te&&!e.validated){if(Oe.markValidated(e.id),!(e.schemaVersion in Le)){const t=await Oe.get(e.schemaVersion),r=await ke(t);Le[t.id]=Ve(r)}const t=K.cons(e.schema,e.id),r=Le[e.schemaVersion](t,Ie);if(!r.valid)throw new je(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Ce(`${e.schemaVersion}#validate`).compile(e,t)},_e=async e=>Oe.typeOf(e,"string")?_e(await Oe.get(Oe.value(e),e)):e,De=(e,t,r,n)=>{const o=Ne(e,r),a=$e(e)[0];return Ce(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Ne=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Be={validate:async(e,t,r)=>{const n=await ke(e),o=(e,t)=>Ve(n,K.cons(e),t);return void 0===t?o:o(t,r)},compile:ke,interpret:Ve,setMetaOutputFormat:e=>{Ie=e},setShouldMetaValidate:e=>{Te=e},FLAG:Se,BASIC:xe,DETAILED:Ae,VERBOSE:Pe,add:(e,t="",r="")=>{const n=Oe.add(e,t,r);delete Le[n]},getKeyword:Ce,hasKeyword:ze,defineVocabulary:(e,t)=>{Ke[e]=t},compileSchema:qe,interpretSchema:De,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Ne(e,r);return Ce(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Ne(e,r);return Ce(a).collectEvaluatedItems(e,t,r,n,o)}};var Fe={compile:e=>Oe.value(e),interpret:()=>!0};var Ze={compile:async(e,t)=>{const r=Oe.uri(e);if(!(r in t)){t[r]=!1;const n=Oe.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Oe.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Oe.uri(e),"boolean"==typeof n?n:await ee.pipeline([Oe.entries,ee.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ee.filter((([t])=>Be.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),ee.map((async([r,n])=>{const o=await Be.getKeyword(r).compile(n,t,e);return[r,Oe.uri(n),o]})),ee.all],e)]}return r},interpret:(e,t,r,o)=>{const[a,i,s]=r[e];n.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{n.publishSync("result.start");const s=Be.getKeyword(e).interpret(i,t,r,o);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:K.uri(t),valid:s,ast:i}),n.publishSync("result.end"),s}));return n.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:K.uri(t),valid:c,ast:e}),n.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Be.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Be.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},We={metaData:Fe,validate:Ze},Je={Core:Be,Schema:Oe,Instance:K,Reference:x,Keywords:We,InvalidSchemaError:je},Me=Je.Core,Ge=Je.Schema,He=Je.Instance,Qe=Je.Reference,Xe=Je.Keywords,Ye=Je.InvalidSchemaError;export{Me as Core,He as Instance,Ye as InvalidSchemaError,Xe as Keywords,Qe as Reference,Ge as Schema,Je as default}; | ||
//# sourceMappingURL=json-schema-core-esm.min.js.map |
@@ -799,2 +799,6 @@ var JSC = (function (exports) { | ||
var reference = { cons: cons$1, isReference, href, value: value$2 }; | ||
reference.cons; | ||
reference.isReference; | ||
reference.href; | ||
reference.value; | ||
@@ -1727,13 +1731,15 @@ const { jsonTypeOf: jsonTypeOf$1 } = common; | ||
var lib = { Core: core, Schema: schema, Instance: instance, Keywords: keywords, InvalidSchemaError: invalidSchemaError }; | ||
var lib = { Core: core, Schema: schema, Instance: instance, Reference: reference, Keywords: keywords, InvalidSchemaError: invalidSchemaError }; | ||
var lib_1 = lib.Core; | ||
var lib_2 = lib.Schema; | ||
var lib_3 = lib.Instance; | ||
var lib_4 = lib.Keywords; | ||
var lib_5 = lib.InvalidSchemaError; | ||
var lib_4 = lib.Reference; | ||
var lib_5 = lib.Keywords; | ||
var lib_6 = lib.InvalidSchemaError; | ||
exports.Core = lib_1; | ||
exports.Instance = lib_3; | ||
exports.InvalidSchemaError = lib_5; | ||
exports.Keywords = lib_4; | ||
exports.InvalidSchemaError = lib_6; | ||
exports.Keywords = lib_5; | ||
exports.Reference = lib_4; | ||
exports.Schema = lib_2; | ||
@@ -1740,0 +1746,0 @@ exports["default"] = lib; |
@@ -1,2 +0,2 @@ | ||
var JSC=function(e){"use strict";var t=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)))}}};var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var n,o=(function(e,t){var n,o;n="object"==typeof window&&window||r,o={},n.PubSub=o,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},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)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(o),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}(n={exports:{}},n.exports),n.exports);o.PubSub;var a=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),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}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(c.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)?i(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+s(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,i=r.path,c=r.host;return 0===e.length?a=i:(i=i.substring(0,i.lastIndexOf("/")),a=s(i+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:i(e)}};function i(e){return e+("/"===e[e.length-1]?"":"/")}function s(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 c=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const l={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},u=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)]},f=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var p={jsonTypeOf:(e,t)=>l[t](e),splitUrl:u,safeResolveUrl:(e,t)=>{const r=a(e,t),n=u(e)[0];if(n&&"file"===f(r)&&"file"!==f(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const d=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(g)},h=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:h(e,E(t,o,n),r,m(o,n))}}if(Array.isArray(t)){const n=[...t];return n[O(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:E(t,e[0],n)},y=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||j(t)){const o=e.shift();y(e,E(t,o,n),r,m(o,n))}else{t[O(t,e[0])]=r}},b=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=E(t,n,r);return{...t,[n]:b(e,o,m(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 E(t,e[0],r)}},v=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=E(t,n,r);v(e,o,m(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:E(t,e[0],r)},m=t(((e,t)=>t+"/"+w(e))),w=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),g=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),O=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,E=(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(j(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[O(e,t)]},j=e=>null===e||"object"!=typeof e;var $={nil:"",append:m,get:(e,t)=>{const r=d(e),n=e=>r.reduce((([e,t],r)=>[E(e,r,t),m(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=d(e),a=t(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(e,r,n)=>{const o=d(e),a=t(((e,t)=>y(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=d(e),n=e=>b(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=d(e),n=e=>v(r,e,"");return void 0===t?n:n(t)}};$.nil,$.append,$.get,$.set,$.assign,$.unset,$.remove;const S=Symbol("$__value"),P=Symbol("$__href");var A=(e,t)=>Object.freeze({[P]:e,[S]:t}),x=e=>e&&void 0!==e[P],I=e=>e[P],T=e=>e[S];const{jsonTypeOf:k}=p,V=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),C=e=>x(e.value)?T(e.value):e.value,U=t(((e,t)=>k(C(e),t))),R=(e,t)=>Object.freeze({...t,pointer:$.append(e,t.pointer),value:C(t)[e]}),z=t(((e,t)=>C(t).map(((r,n,o,a)=>e(R(n,t),n,o,a))))),K=t(((e,t)=>C(t).map(((e,r,n,o)=>R(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),L=t(((e,t,r)=>C(r).reduce(((t,n,o)=>e(t,R(o,r),o)),t))),q=t(((e,t)=>C(t).every(((r,n,o,a)=>e(R(n,t),n,o,a))))),_=t(((e,t)=>C(t).some(((r,n,o,a)=>e(R(n,t),n,o,a)))));var D={nil:V,cons:(e,t="")=>Object.freeze({...V,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:C,has:(e,t)=>e in C(t),typeOf:U,step:R,entries:e=>Object.keys(C(e)).map((t=>[t,R(t,e)])),keys:e=>Object.keys(C(e)),map:z,filter:K,reduce:L,every:q,some:_,length:e=>C(e).length},N=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,B=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,F=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,Z=/\\([\u000b\u0020-\u00ff])/g,J=/([\\"])/g,M=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function W(e){var t=String(e);if(F.test(t))return t;if(t.length>0&&!B.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(J,"\\$1")+'"'}function G(e){this.parameters=Object.create(null),this.type=e}var H={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!M.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!F.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+W(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!M.test(n))throw new TypeError("invalid media type");var o=new G(n.toLowerCase());if(-1!==r){var a,i,s;for(N.lastIndex=r;i=N.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(Z,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},Q=async e=>Object.entries(await e),X=t((async(e,t)=>(await t).map(e))),Y=t((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),ee=t((async(e,t,r={})=>Y((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),te=t((async(e,t)=>{const r=await X(e,t);return(await Promise.all(r)).some((e=>e))})),re=t((async(e,t)=>{const r=await X(e,t);return(await Promise.all(r)).every((e=>e))})),ne=t(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),oe={entries:Q,map:X,filter:ee,reduce:Y,some:te,every:re,pipeline:ne,all:e=>Promise.all(e),allValues:e=>ne([Q,Y((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};oe.entries,oe.map,oe.filter,oe.reduce,oe.some,oe.every,oe.pipeline,oe.all,oe.allValues;var ae=fetch;const{jsonTypeOf:ie,splitUrl:se,safeResolveUrl:ce}=p,le={},ue={},fe=(e,t)=>{const r=e in ue?ue[e]:e;if(r in le)return le[r][t]},pe={},de={},he=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=se(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=fe(n,"baseToken"),a=fe(n,"anchorToken"),i=se(t)[0];if(!i&&!se(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=ce(i,e[o]||""),[c,l]=se(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(de[i]=c);const u={},f=fe(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=fe(n,"vocabularyToken");ie(e[d],"object")?(ue[c]=n,p=e[d],delete e[d]):(ue[c]=n,p={[n]:!0});const h={"":""};return pe[c]={id:c,schemaVersion:n,schema:ye(e,c,n,$.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:p,validated:!1},c},ye=(e,t,r,n,o,a)=>{if(ie(e,"object")){const i="string"==typeof e.$schema?se(e.$schema)[0]:r,s=fe(i,"embeddedToken"),c=fe(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=ce(t,e[s]);return e[s]=n,he(e,n,r),A(e[s],e)}const l=fe(r,"anchorToken"),u=fe(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=fe(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=fe(r,"jrefToken");if("string"==typeof e[p])return A(e[p],e);for(const i in e)e[i]=ye(e[i],t,r,$.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ye(e,t,r,$.append(i,n),o,a))):e},be=e=>pe[de[e]]||pe[e],ve=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:$.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),me=async(e,t=ve)=>{const r=ce(Oe(t),e),[n,o]=se(r);if(!(e=>e in pe||e in de)(n)){const e=await ae(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=H.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}he(await e.json(),n)}const a=be(n),i="/"!==o[0]?ge(a,o):o,s=Object.freeze({...a,pointer:i,value:$.get(i,a.schema)});return we(s)},we=e=>x(e.value)?me(I(e.value),e):e,ge=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Oe=e=>`${e.id}#${encodeURI(e.pointer)}`,Ee=e=>x(e.value)?T(e.value):e.value,je=(e,t)=>{const r=be(t.id),n=Object.freeze({...t,pointer:$.append(e,t.pointer),value:Ee(t)[e],validated:r.validated});return we(n)},$e=t(((e,t)=>oe.pipeline([Ee,oe.map((async(r,n)=>e(await je(n,t),n))),oe.all],t)));var Se={setConfig:(e,t,r)=>{le[e]||(le[e]={}),le[e][t]=r},getConfig:fe,add:he,get:me,markValidated:e=>{pe[e].validated=!0},uri:Oe,value:Ee,getAnchorPointer:ge,typeOf:(e,t)=>ie(Ee(e),t),has:(e,t)=>e in Ee(t),step:je,keys:e=>Object.keys(Ee(e)),entries:e=>oe.pipeline([Ee,Object.keys,oe.map((async t=>[t,await je(t,e)])),oe.all],e),map:$e,length:e=>Ee(e).length};Se.setConfig,Se.getConfig,Se.add,Se.get,Se.markValidated,Se.uri,Se.value,Se.getAnchorPointer,Se.typeOf,Se.has,Se.step,Se.keys,Se.entries,Se.map,Se.length;class Pe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Ae=Pe;const{splitUrl:xe}=p,Ie="FLAG",Te="BASIC",ke="DETAILED",Ve="VERBOSE";let Ce=ke,Ue=!0;const Re=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await Be(e,t)}},ze=t((({ast:e,schemaUri:t},r,n=Ie)=>{if(![Ie,Te,ke,Ve].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",Ke(n,a));return Ze(t,r,e,{}),o.unsubscribe(i),a[0]})),Ke=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===Te&&(o.push(...t.errors),delete t.errors),(e===Ve||e!==Ie&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Le={},qe=e=>Le[e],_e=e=>e in Le,De={},Ne={},Be=async(e,t)=>{if(e=await Fe(e),!_e(`${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 De)Object.entries(De[e]).forEach((([e,r])=>{((e,t)=>{Le[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Ue&&!e.validated){if(Se.markValidated(e.id),!(e.schemaVersion in Ne)){const t=await Se.get(e.schemaVersion),r=await Re(t);Ne[t.id]=ze(r)}const t=D.cons(e.schema,e.id),r=Ne[e.schemaVersion](t,Ce);if(!r.valid)throw new Ae(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),qe(`${e.schemaVersion}#validate`).compile(e,t)},Fe=async e=>Se.typeOf(e,"string")?Fe(await Se.get(Se.value(e),e)):e,Ze=(e,t,r,n)=>{const o=Je(e,r),a=xe(e)[0];return qe(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Je=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Me={validate:async(e,t,r)=>{const n=await Re(e),o=(e,t)=>ze(n,D.cons(e),t);return void 0===t?o:o(t,r)},compile:Re,interpret:ze,setMetaOutputFormat:e=>{Ce=e},setShouldMetaValidate:e=>{Ue=e},FLAG:Ie,BASIC:Te,DETAILED:ke,VERBOSE:Ve,add:(e,t="",r="")=>{const n=Se.add(e,t,r);delete Ne[n]},getKeyword:qe,hasKeyword:_e,defineVocabulary:(e,t)=>{De[e]=t},compileSchema:Be,interpretSchema:Ze,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Je(e,r);return qe(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Je(e,r);return qe(a).collectEvaluatedItems(e,t,r,n,o)}};var We={compile:e=>Se.value(e),interpret:()=>!0};var Ge={compile:async(e,t)=>{const r=Se.uri(e);if(!(r in t)){t[r]=!1;const n=Se.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Se.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Se.uri(e),"boolean"==typeof n?n:await oe.pipeline([Se.entries,oe.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),oe.filter((([t])=>Me.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),oe.map((async([r,n])=>{const o=await Me.getKeyword(r).compile(n,t,e);return[r,Se.uri(n),o]})),oe.all],e)]}return r},interpret:(e,t,r,n)=>{const[a,i,s]=r[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=Me.getKeyword(e).interpret(i,t,r,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:D.uri(t),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:D.uri(t),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Me.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Me.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},He={metaData:We,validate:Ge},Qe={Core:Me,Schema:Se,Instance:D,Keywords:He,InvalidSchemaError:Ae},Xe=Qe.Core,Ye=Qe.Schema,et=Qe.Instance,tt=Qe.Keywords,rt=Qe.InvalidSchemaError;return e.Core=Xe,e.Instance=et,e.InvalidSchemaError=rt,e.Keywords=tt,e.Schema=Ye,e.default=Qe,Object.defineProperty(e,"__esModule",{value:!0}),e}({}); | ||
var JSC=function(e){"use strict";var t=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)))}}};var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var n,o=(function(e,t){var n,o;n="object"==typeof window&&window||r,o={},n.PubSub=o,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},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)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(o),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}(n={exports:{}},n.exports),n.exports);o.PubSub;var a=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),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}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(c.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)?i(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+s(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,i=r.path,c=r.host;return 0===e.length?a=i:(i=i.substring(0,i.lastIndexOf("/")),a=s(i+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:i(e)}};function i(e){return e+("/"===e[e.length-1]?"":"/")}function s(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 c=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const l={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},u=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)]},f=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var p={jsonTypeOf:(e,t)=>l[t](e),splitUrl:u,safeResolveUrl:(e,t)=>{const r=a(e,t),n=u(e)[0];if(n&&"file"===f(r)&&"file"!==f(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const d=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(g)},h=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:h(e,E(t,o,n),r,m(o,n))}}if(Array.isArray(t)){const n=[...t];return n[O(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:E(t,e[0],n)},y=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||j(t)){const o=e.shift();y(e,E(t,o,n),r,m(o,n))}else{t[O(t,e[0])]=r}},v=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=E(t,n,r);return{...t,[n]:v(e,o,m(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 E(t,e[0],r)}},b=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=E(t,n,r);b(e,o,m(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:E(t,e[0],r)},m=t(((e,t)=>t+"/"+w(e))),w=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),g=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),O=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,E=(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(j(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[O(e,t)]},j=e=>null===e||"object"!=typeof e;var $={nil:"",append:m,get:(e,t)=>{const r=d(e),n=e=>r.reduce((([e,t],r)=>[E(e,r,t),m(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=d(e),a=t(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(e,r,n)=>{const o=d(e),a=t(((e,t)=>y(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=d(e),n=e=>v(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=d(e),n=e=>b(r,e,"");return void 0===t?n:n(t)}};$.nil,$.append,$.get,$.set,$.assign,$.unset,$.remove;const S=Symbol("$__value"),P=Symbol("$__href");var A={cons:(e,t)=>Object.freeze({[P]:e,[S]:t}),isReference:e=>e&&void 0!==e[P],href:e=>e[P],value:e=>e[S]};const{jsonTypeOf:x}=p,I=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>A.isReference(e.value)?A.value(e.value):e.value,k=t(((e,t)=>x(T(e),t))),V=(e,t)=>Object.freeze({...t,pointer:$.append(e,t.pointer),value:T(t)[e]}),R=t(((e,t)=>T(t).map(((r,n,o,a)=>e(V(n,t),n,o,a))))),C=t(((e,t)=>T(t).map(((e,r,n,o)=>V(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),U=t(((e,t,r)=>T(r).reduce(((t,n,o)=>e(t,V(o,r),o)),t))),z=t(((e,t)=>T(t).every(((r,n,o,a)=>e(V(n,t),n,o,a))))),K=t(((e,t)=>T(t).some(((r,n,o,a)=>e(V(n,t),n,o,a)))));var L={nil:I,cons:(e,t="")=>Object.freeze({...I,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:T,has:(e,t)=>e in T(t),typeOf:k,step:V,entries:e=>Object.keys(T(e)).map((t=>[t,V(t,e)])),keys:e=>Object.keys(T(e)),map:R,filter:C,reduce:U,every:z,some:K,length:e=>T(e).length},q=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,_=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,D=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,N=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,F=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function Z(e){var t=String(e);if(D.test(t))return t;if(t.length>0&&!_.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(B,"\\$1")+'"'}function J(e){this.parameters=Object.create(null),this.type=e}var M={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!F.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!D.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+Z(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(!F.test(n))throw new TypeError("invalid media type");var o=new J(n.toLowerCase());if(-1!==r){var a,i,s;for(q.lastIndex=r;i=q.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(N,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},W=async e=>Object.entries(await e),G=t((async(e,t)=>(await t).map(e))),H=t((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),Q=t((async(e,t,r={})=>H((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),X=t((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).some((e=>e))})),Y=t((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).every((e=>e))})),ee=t(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),te={entries:W,map:G,filter:Q,reduce:H,some:X,every:Y,pipeline:ee,all:e=>Promise.all(e),allValues:e=>ee([W,H((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};te.entries,te.map,te.filter,te.reduce,te.some,te.every,te.pipeline,te.all,te.allValues;var re=fetch;const{jsonTypeOf:ne,splitUrl:oe,safeResolveUrl:ae}=p,ie={},se={},ce=(e,t)=>{const r=e in se?se[e]:e;if(r in ie)return ie[r][t]},le={},ue={},fe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=oe(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ce(n,"baseToken"),a=ce(n,"anchorToken"),i=oe(t)[0];if(!i&&!oe(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=ae(i,e[o]||""),[c,l]=oe(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(ue[i]=c);const u={},f=ce(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=ce(n,"vocabularyToken");ne(e[d],"object")?(se[c]=n,p=e[d],delete e[d]):(se[c]=n,p={[n]:!0});const h={"":""};return le[c]={id:c,schemaVersion:n,schema:pe(e,c,n,$.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:p,validated:!1},c},pe=(e,t,r,n,o,a)=>{if(ne(e,"object")){const i="string"==typeof e.$schema?oe(e.$schema)[0]:r,s=ce(i,"embeddedToken"),c=ce(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=ae(t,e[s]);return e[s]=n,fe(e,n,r),A.cons(e[s],e)}const l=ce(r,"anchorToken"),u=ce(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=ce(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=ce(r,"jrefToken");if("string"==typeof e[p])return A.cons(e[p],e);for(const i in e)e[i]=pe(e[i],t,r,$.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>pe(e,t,r,$.append(i,n),o,a))):e},de=e=>le[ue[e]]||le[e],he=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:$.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ye=async(e,t=he)=>{const r=ae(me(t),e),[n,o]=oe(r);if(!(e=>e in le||e in ue)(n)){const e=await re(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=M.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}fe(await e.json(),n)}const a=de(n),i="/"!==o[0]?be(a,o):o,s=Object.freeze({...a,pointer:i,value:$.get(i,a.schema)});return ve(s)},ve=e=>A.isReference(e.value)?ye(A.href(e.value),e):e,be=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},me=e=>`${e.id}#${encodeURI(e.pointer)}`,we=e=>A.isReference(e.value)?A.value(e.value):e.value,ge=(e,t)=>{const r=de(t.id),n=Object.freeze({...t,pointer:$.append(e,t.pointer),value:we(t)[e],validated:r.validated});return ve(n)},Oe=t(((e,t)=>te.pipeline([we,te.map((async(r,n)=>e(await ge(n,t),n))),te.all],t)));var Ee={setConfig:(e,t,r)=>{ie[e]||(ie[e]={}),ie[e][t]=r},getConfig:ce,add:fe,get:ye,markValidated:e=>{le[e].validated=!0},uri:me,value:we,getAnchorPointer:be,typeOf:(e,t)=>ne(we(e),t),has:(e,t)=>e in we(t),step:ge,keys:e=>Object.keys(we(e)),entries:e=>te.pipeline([we,Object.keys,te.map((async t=>[t,await ge(t,e)])),te.all],e),map:Oe,length:e=>we(e).length};Ee.setConfig,Ee.getConfig,Ee.add,Ee.get,Ee.markValidated,Ee.uri,Ee.value,Ee.getAnchorPointer,Ee.typeOf,Ee.has,Ee.step,Ee.keys,Ee.entries,Ee.map,Ee.length;class je extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var $e=je;const{splitUrl:Se}=p,Pe="FLAG",Ae="BASIC",xe="DETAILED",Ie="VERBOSE";let Te=xe,ke=!0;const Ve=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await _e(e,t)}},Re=t((({ast:e,schemaUri:t},r,n=Pe)=>{if(![Pe,Ae,xe,Ie].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",Ce(n,a));return Ne(t,r,e,{}),o.unsubscribe(i),a[0]})),Ce=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===Ae&&(o.push(...t.errors),delete t.errors),(e===Ie||e!==Pe&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ue={},ze=e=>Ue[e],Ke=e=>e in Ue,Le={},qe={},_e=async(e,t)=>{if(e=await De(e),!Ke(`${e.schemaVersion}#validate`)){const t=await Ee.get(e.schemaVersion);(Ee.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 Le)Object.entries(Le[e]).forEach((([e,r])=>{((e,t)=>{Ue[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(ke&&!e.validated){if(Ee.markValidated(e.id),!(e.schemaVersion in qe)){const t=await Ee.get(e.schemaVersion),r=await Ve(t);qe[t.id]=Re(r)}const t=L.cons(e.schema,e.id),r=qe[e.schemaVersion](t,Te);if(!r.valid)throw new $e(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),ze(`${e.schemaVersion}#validate`).compile(e,t)},De=async e=>Ee.typeOf(e,"string")?De(await Ee.get(Ee.value(e),e)):e,Ne=(e,t,r,n)=>{const o=Be(e,r),a=Se(e)[0];return ze(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Be=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Fe={validate:async(e,t,r)=>{const n=await Ve(e),o=(e,t)=>Re(n,L.cons(e),t);return void 0===t?o:o(t,r)},compile:Ve,interpret:Re,setMetaOutputFormat:e=>{Te=e},setShouldMetaValidate:e=>{ke=e},FLAG:Pe,BASIC:Ae,DETAILED:xe,VERBOSE:Ie,add:(e,t="",r="")=>{const n=Ee.add(e,t,r);delete qe[n]},getKeyword:ze,hasKeyword:Ke,defineVocabulary:(e,t)=>{Le[e]=t},compileSchema:_e,interpretSchema:Ne,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Be(e,r);return ze(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Be(e,r);return ze(a).collectEvaluatedItems(e,t,r,n,o)}};var Ze={compile:e=>Ee.value(e),interpret:()=>!0};var Je={compile:async(e,t)=>{const r=Ee.uri(e);if(!(r in t)){t[r]=!1;const n=Ee.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Ee.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Ee.uri(e),"boolean"==typeof n?n:await te.pipeline([Ee.entries,te.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),te.filter((([t])=>Fe.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),te.map((async([r,n])=>{const o=await Fe.getKeyword(r).compile(n,t,e);return[r,Ee.uri(n),o]})),te.all],e)]}return r},interpret:(e,t,r,n)=>{const[a,i,s]=r[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=Fe.getKeyword(e).interpret(i,t,r,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:L.uri(t),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:L.uri(t),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Fe.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Fe.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Me={metaData:Ze,validate:Je},We={Core:Fe,Schema:Ee,Instance:L,Reference:A,Keywords:Me,InvalidSchemaError:$e},Ge=We.Core,He=We.Schema,Qe=We.Instance,Xe=We.Reference,Ye=We.Keywords,et=We.InvalidSchemaError;return e.Core=Ge,e.Instance=Qe,e.InvalidSchemaError=et,e.Keywords=Ye,e.Reference=Xe,e.Schema=He,e.default=We,Object.defineProperty(e,"__esModule",{value:!0}),e}({}); | ||
//# sourceMappingURL=json-schema-core-iife.min.js.map |
@@ -801,2 +801,6 @@ System.register('JSC', [], (function (exports) { | ||
var reference = { cons: cons$1, isReference, href, value: value$2 }; | ||
reference.cons; | ||
reference.isReference; | ||
reference.href; | ||
reference.value; | ||
@@ -1729,8 +1733,9 @@ const { jsonTypeOf: jsonTypeOf$1 } = common; | ||
var lib = exports('default', { Core: core, Schema: schema, Instance: instance, Keywords: keywords, InvalidSchemaError: invalidSchemaError }); | ||
var lib = exports('default', { Core: core, Schema: schema, Instance: instance, Reference: reference, Keywords: keywords, InvalidSchemaError: invalidSchemaError }); | ||
var lib_1 = exports('Core', lib.Core); | ||
var lib_2 = exports('Schema', lib.Schema); | ||
var lib_3 = exports('Instance', lib.Instance); | ||
var lib_4 = exports('Keywords', lib.Keywords); | ||
var lib_5 = exports('InvalidSchemaError', lib.InvalidSchemaError); | ||
var lib_4 = exports('Reference', lib.Reference); | ||
var lib_5 = exports('Keywords', lib.Keywords); | ||
var lib_6 = exports('InvalidSchemaError', lib.InvalidSchemaError); | ||
@@ -1737,0 +1742,0 @@ }) |
@@ -1,2 +0,2 @@ | ||
System.register("JSC",[],(function(e){"use strict";return{execute:function(){var t=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)))}}};var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var n,o=(function(e,t){var n,o;n="object"==typeof window&&window||r,o={},n.PubSub=o,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},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)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(o),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}(n={exports:{}},n.exports),n.exports);o.PubSub;var a=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),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}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(c.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)?i(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+s(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,i=r.path,c=r.host;return 0===e.length?a=i:(i=i.substring(0,i.lastIndexOf("/")),a=s(i+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:i(e)}};function i(e){return e+("/"===e[e.length-1]?"":"/")}function s(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 c=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const l={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},u=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)]},f=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var p={jsonTypeOf:(e,t)=>l[t](e),splitUrl:u,safeResolveUrl:(e,t)=>{const r=a(e,t),n=u(e)[0];if(n&&"file"===f(r)&&"file"!==f(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const d=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(w)},h=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:h(e,E(t,o,n),r,m(o,n))}}if(Array.isArray(t)){const n=[...t];return n[O(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:E(t,e[0],n)},y=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||j(t)){const o=e.shift();y(e,E(t,o,n),r,m(o,n))}else{t[O(t,e[0])]=r}},b=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=E(t,n,r);return{...t,[n]:b(e,o,m(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 E(t,e[0],r)}},v=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=E(t,n,r);v(e,o,m(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:E(t,e[0],r)},m=t(((e,t)=>t+"/"+g(e))),g=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),w=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),O=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,E=(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(j(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[O(e,t)]},j=e=>null===e||"object"!=typeof e;var $={nil:"",append:m,get:(e,t)=>{const r=d(e),n=e=>r.reduce((([e,t],r)=>[E(e,r,t),m(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=d(e),a=t(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(e,r,n)=>{const o=d(e),a=t(((e,t)=>y(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=d(e),n=e=>b(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=d(e),n=e=>v(r,e,"");return void 0===t?n:n(t)}};$.nil,$.append,$.get,$.set,$.assign,$.unset,$.remove;const S=Symbol("$__value"),x=Symbol("$__href");var A=(e,t)=>Object.freeze({[x]:e,[S]:t}),P=e=>e&&void 0!==e[x],I=e=>e[x],T=e=>e[S];const{jsonTypeOf:k}=p,V=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),C=e=>P(e.value)?T(e.value):e.value,U=t(((e,t)=>k(C(e),t))),R=(e,t)=>Object.freeze({...t,pointer:$.append(e,t.pointer),value:C(t)[e]}),z=t(((e,t)=>C(t).map(((r,n,o,a)=>e(R(n,t),n,o,a))))),K=t(((e,t)=>C(t).map(((e,r,n,o)=>R(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),L=t(((e,t,r)=>C(r).reduce(((t,n,o)=>e(t,R(o,r),o)),t))),q=t(((e,t)=>C(t).every(((r,n,o,a)=>e(R(n,t),n,o,a))))),_=t(((e,t)=>C(t).some(((r,n,o,a)=>e(R(n,t),n,o,a)))));var D={nil:V,cons:(e,t="")=>Object.freeze({...V,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:C,has:(e,t)=>e in C(t),typeOf:U,step:R,entries:e=>Object.keys(C(e)).map((t=>[t,R(t,e)])),keys:e=>Object.keys(C(e)),map:z,filter:K,reduce:L,every:q,some:_,length:e=>C(e).length},N=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,B=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,F=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,Z=/\\([\u000b\u0020-\u00ff])/g,J=/([\\"])/g,W=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function M(e){var t=String(e);if(F.test(t))return t;if(t.length>0&&!B.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(J,"\\$1")+'"'}function G(e){this.parameters=Object.create(null),this.type=e}var H={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!W.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!F.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+M(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!W.test(n))throw new TypeError("invalid media type");var o=new G(n.toLowerCase());if(-1!==r){var a,i,s;for(N.lastIndex=r;i=N.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(Z,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},Q=async e=>Object.entries(await e),X=t((async(e,t)=>(await t).map(e))),Y=t((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),ee=t((async(e,t,r={})=>Y((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),te=t((async(e,t)=>{const r=await X(e,t);return(await Promise.all(r)).some((e=>e))})),re=t((async(e,t)=>{const r=await X(e,t);return(await Promise.all(r)).every((e=>e))})),ne=t(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),oe={entries:Q,map:X,filter:ee,reduce:Y,some:te,every:re,pipeline:ne,all:e=>Promise.all(e),allValues:e=>ne([Q,Y((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};oe.entries,oe.map,oe.filter,oe.reduce,oe.some,oe.every,oe.pipeline,oe.all,oe.allValues;var ae=fetch;const{jsonTypeOf:ie,splitUrl:se,safeResolveUrl:ce}=p,le={},ue={},fe=(e,t)=>{const r=e in ue?ue[e]:e;if(r in le)return le[r][t]},pe={},de={},he=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=se(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=fe(n,"baseToken"),a=fe(n,"anchorToken"),i=se(t)[0];if(!i&&!se(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=ce(i,e[o]||""),[c,l]=se(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(de[i]=c);const u={},f=fe(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=fe(n,"vocabularyToken");ie(e[d],"object")?(ue[c]=n,p=e[d],delete e[d]):(ue[c]=n,p={[n]:!0});const h={"":""};return pe[c]={id:c,schemaVersion:n,schema:ye(e,c,n,$.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:p,validated:!1},c},ye=(e,t,r,n,o,a)=>{if(ie(e,"object")){const i="string"==typeof e.$schema?se(e.$schema)[0]:r,s=fe(i,"embeddedToken"),c=fe(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=ce(t,e[s]);return e[s]=n,he(e,n,r),A(e[s],e)}const l=fe(r,"anchorToken"),u=fe(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=fe(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=fe(r,"jrefToken");if("string"==typeof e[p])return A(e[p],e);for(const i in e)e[i]=ye(e[i],t,r,$.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ye(e,t,r,$.append(i,n),o,a))):e},be=e=>pe[de[e]]||pe[e],ve=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:$.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),me=async(e,t=ve)=>{const r=ce(Oe(t),e),[n,o]=se(r);if(!(e=>e in pe||e in de)(n)){const e=await ae(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=H.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}he(await e.json(),n)}const a=be(n),i="/"!==o[0]?we(a,o):o,s=Object.freeze({...a,pointer:i,value:$.get(i,a.schema)});return ge(s)},ge=e=>P(e.value)?me(I(e.value),e):e,we=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Oe=e=>`${e.id}#${encodeURI(e.pointer)}`,Ee=e=>P(e.value)?T(e.value):e.value,je=(e,t)=>{const r=be(t.id),n=Object.freeze({...t,pointer:$.append(e,t.pointer),value:Ee(t)[e],validated:r.validated});return ge(n)},$e=t(((e,t)=>oe.pipeline([Ee,oe.map((async(r,n)=>e(await je(n,t),n))),oe.all],t)));var Se={setConfig:(e,t,r)=>{le[e]||(le[e]={}),le[e][t]=r},getConfig:fe,add:he,get:me,markValidated:e=>{pe[e].validated=!0},uri:Oe,value:Ee,getAnchorPointer:we,typeOf:(e,t)=>ie(Ee(e),t),has:(e,t)=>e in Ee(t),step:je,keys:e=>Object.keys(Ee(e)),entries:e=>oe.pipeline([Ee,Object.keys,oe.map((async t=>[t,await je(t,e)])),oe.all],e),map:$e,length:e=>Ee(e).length};Se.setConfig,Se.getConfig,Se.add,Se.get,Se.markValidated,Se.uri,Se.value,Se.getAnchorPointer,Se.typeOf,Se.has,Se.step,Se.keys,Se.entries,Se.map,Se.length;class xe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Ae=xe;const{splitUrl:Pe}=p,Ie="FLAG",Te="BASIC",ke="DETAILED",Ve="VERBOSE";let Ce=ke,Ue=!0;const Re=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await Be(e,t)}},ze=t((({ast:e,schemaUri:t},r,n=Ie)=>{if(![Ie,Te,ke,Ve].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",Ke(n,a));return Ze(t,r,e,{}),o.unsubscribe(i),a[0]})),Ke=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===Te&&(o.push(...t.errors),delete t.errors),(e===Ve||e!==Ie&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Le={},qe=e=>Le[e],_e=e=>e in Le,De={},Ne={},Be=async(e,t)=>{if(e=await Fe(e),!_e(`${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 De)Object.entries(De[e]).forEach((([e,r])=>{((e,t)=>{Le[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Ue&&!e.validated){if(Se.markValidated(e.id),!(e.schemaVersion in Ne)){const t=await Se.get(e.schemaVersion),r=await Re(t);Ne[t.id]=ze(r)}const t=D.cons(e.schema,e.id),r=Ne[e.schemaVersion](t,Ce);if(!r.valid)throw new Ae(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),qe(`${e.schemaVersion}#validate`).compile(e,t)},Fe=async e=>Se.typeOf(e,"string")?Fe(await Se.get(Se.value(e),e)):e,Ze=(e,t,r,n)=>{const o=Je(e,r),a=Pe(e)[0];return qe(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Je=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var We={validate:async(e,t,r)=>{const n=await Re(e),o=(e,t)=>ze(n,D.cons(e),t);return void 0===t?o:o(t,r)},compile:Re,interpret:ze,setMetaOutputFormat:e=>{Ce=e},setShouldMetaValidate:e=>{Ue=e},FLAG:Ie,BASIC:Te,DETAILED:ke,VERBOSE:Ve,add:(e,t="",r="")=>{const n=Se.add(e,t,r);delete Ne[n]},getKeyword:qe,hasKeyword:_e,defineVocabulary:(e,t)=>{De[e]=t},compileSchema:Be,interpretSchema:Ze,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Je(e,r);return qe(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Je(e,r);return qe(a).collectEvaluatedItems(e,t,r,n,o)}};var Me={compile:e=>Se.value(e),interpret:()=>!0};var Ge={compile:async(e,t)=>{const r=Se.uri(e);if(!(r in t)){t[r]=!1;const n=Se.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Se.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Se.uri(e),"boolean"==typeof n?n:await oe.pipeline([Se.entries,oe.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),oe.filter((([t])=>We.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),oe.map((async([r,n])=>{const o=await We.getKeyword(r).compile(n,t,e);return[r,Se.uri(n),o]})),oe.all],e)]}return r},interpret:(e,t,r,n)=>{const[a,i,s]=r[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=We.getKeyword(e).interpret(i,t,r,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:D.uri(t),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:D.uri(t),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&We.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&We.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},He={metaData:Me,validate:Ge},Qe=e("default",{Core:We,Schema:Se,Instance:D,Keywords:He,InvalidSchemaError:Ae});e("Core",Qe.Core),e("Schema",Qe.Schema),e("Instance",Qe.Instance),e("Keywords",Qe.Keywords),e("InvalidSchemaError",Qe.InvalidSchemaError)}}})); | ||
System.register("JSC",[],(function(e){"use strict";return{execute:function(){var t=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)))}}};var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var n,o=(function(e,t){var n,o;n="object"==typeof window&&window||r,o={},n.PubSub=o,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},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)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(o),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}(n={exports:{}},n.exports),n.exports);o.PubSub;var a=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),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}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(c.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)?i(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+s(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,i=r.path,c=r.host;return 0===e.length?a=i:(i=i.substring(0,i.lastIndexOf("/")),a=s(i+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:i(e)}};function i(e){return e+("/"===e[e.length-1]?"":"/")}function s(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 c=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const l={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},u=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)]},f=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var p={jsonTypeOf:(e,t)=>l[t](e),splitUrl:u,safeResolveUrl:(e,t)=>{const r=a(e,t),n=u(e)[0];if(n&&"file"===f(r)&&"file"!==f(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const d=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(w)},h=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:h(e,E(t,o,n),r,m(o,n))}}if(Array.isArray(t)){const n=[...t];return n[O(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:E(t,e[0],n)},y=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||j(t)){const o=e.shift();y(e,E(t,o,n),r,m(o,n))}else{t[O(t,e[0])]=r}},v=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=E(t,n,r);return{...t,[n]:v(e,o,m(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 E(t,e[0],r)}},b=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=E(t,n,r);b(e,o,m(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:E(t,e[0],r)},m=t(((e,t)=>t+"/"+g(e))),g=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),w=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),O=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,E=(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(j(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[O(e,t)]},j=e=>null===e||"object"!=typeof e;var $={nil:"",append:m,get:(e,t)=>{const r=d(e),n=e=>r.reduce((([e,t],r)=>[E(e,r,t),m(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=d(e),a=t(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(e,r,n)=>{const o=d(e),a=t(((e,t)=>y(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=d(e),n=e=>v(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=d(e),n=e=>b(r,e,"");return void 0===t?n:n(t)}};$.nil,$.append,$.get,$.set,$.assign,$.unset,$.remove;const S=Symbol("$__value"),x=Symbol("$__href");var A={cons:(e,t)=>Object.freeze({[x]:e,[S]:t}),isReference:e=>e&&void 0!==e[x],href:e=>e[x],value:e=>e[S]};const{jsonTypeOf:P}=p,I=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>A.isReference(e.value)?A.value(e.value):e.value,k=t(((e,t)=>P(T(e),t))),V=(e,t)=>Object.freeze({...t,pointer:$.append(e,t.pointer),value:T(t)[e]}),R=t(((e,t)=>T(t).map(((r,n,o,a)=>e(V(n,t),n,o,a))))),C=t(((e,t)=>T(t).map(((e,r,n,o)=>V(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),U=t(((e,t,r)=>T(r).reduce(((t,n,o)=>e(t,V(o,r),o)),t))),z=t(((e,t)=>T(t).every(((r,n,o,a)=>e(V(n,t),n,o,a))))),K=t(((e,t)=>T(t).some(((r,n,o,a)=>e(V(n,t),n,o,a)))));var L={nil:I,cons:(e,t="")=>Object.freeze({...I,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:T,has:(e,t)=>e in T(t),typeOf:k,step:V,entries:e=>Object.keys(T(e)).map((t=>[t,V(t,e)])),keys:e=>Object.keys(T(e)),map:R,filter:C,reduce:U,every:z,some:K,length:e=>T(e).length},q=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,_=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,D=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,N=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,F=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function Z(e){var t=String(e);if(D.test(t))return t;if(t.length>0&&!_.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(B,"\\$1")+'"'}function J(e){this.parameters=Object.create(null),this.type=e}var W={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!F.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!D.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+Z(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(!F.test(n))throw new TypeError("invalid media type");var o=new J(n.toLowerCase());if(-1!==r){var a,i,s;for(q.lastIndex=r;i=q.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(N,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},M=async e=>Object.entries(await e),G=t((async(e,t)=>(await t).map(e))),H=t((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),Q=t((async(e,t,r={})=>H((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),X=t((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).some((e=>e))})),Y=t((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).every((e=>e))})),ee=t(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),te={entries:M,map:G,filter:Q,reduce:H,some:X,every:Y,pipeline:ee,all:e=>Promise.all(e),allValues:e=>ee([M,H((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};te.entries,te.map,te.filter,te.reduce,te.some,te.every,te.pipeline,te.all,te.allValues;var re=fetch;const{jsonTypeOf:ne,splitUrl:oe,safeResolveUrl:ae}=p,ie={},se={},ce=(e,t)=>{const r=e in se?se[e]:e;if(r in ie)return ie[r][t]},le={},ue={},fe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=oe(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ce(n,"baseToken"),a=ce(n,"anchorToken"),i=oe(t)[0];if(!i&&!oe(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=ae(i,e[o]||""),[c,l]=oe(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(ue[i]=c);const u={},f=ce(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=ce(n,"vocabularyToken");ne(e[d],"object")?(se[c]=n,p=e[d],delete e[d]):(se[c]=n,p={[n]:!0});const h={"":""};return le[c]={id:c,schemaVersion:n,schema:pe(e,c,n,$.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:p,validated:!1},c},pe=(e,t,r,n,o,a)=>{if(ne(e,"object")){const i="string"==typeof e.$schema?oe(e.$schema)[0]:r,s=ce(i,"embeddedToken"),c=ce(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=ae(t,e[s]);return e[s]=n,fe(e,n,r),A.cons(e[s],e)}const l=ce(r,"anchorToken"),u=ce(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=ce(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=ce(r,"jrefToken");if("string"==typeof e[p])return A.cons(e[p],e);for(const i in e)e[i]=pe(e[i],t,r,$.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>pe(e,t,r,$.append(i,n),o,a))):e},de=e=>le[ue[e]]||le[e],he=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:$.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ye=async(e,t=he)=>{const r=ae(me(t),e),[n,o]=oe(r);if(!(e=>e in le||e in ue)(n)){const e=await re(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=W.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}fe(await e.json(),n)}const a=de(n),i="/"!==o[0]?be(a,o):o,s=Object.freeze({...a,pointer:i,value:$.get(i,a.schema)});return ve(s)},ve=e=>A.isReference(e.value)?ye(A.href(e.value),e):e,be=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},me=e=>`${e.id}#${encodeURI(e.pointer)}`,ge=e=>A.isReference(e.value)?A.value(e.value):e.value,we=(e,t)=>{const r=de(t.id),n=Object.freeze({...t,pointer:$.append(e,t.pointer),value:ge(t)[e],validated:r.validated});return ve(n)},Oe=t(((e,t)=>te.pipeline([ge,te.map((async(r,n)=>e(await we(n,t),n))),te.all],t)));var Ee={setConfig:(e,t,r)=>{ie[e]||(ie[e]={}),ie[e][t]=r},getConfig:ce,add:fe,get:ye,markValidated:e=>{le[e].validated=!0},uri:me,value:ge,getAnchorPointer:be,typeOf:(e,t)=>ne(ge(e),t),has:(e,t)=>e in ge(t),step:we,keys:e=>Object.keys(ge(e)),entries:e=>te.pipeline([ge,Object.keys,te.map((async t=>[t,await we(t,e)])),te.all],e),map:Oe,length:e=>ge(e).length};Ee.setConfig,Ee.getConfig,Ee.add,Ee.get,Ee.markValidated,Ee.uri,Ee.value,Ee.getAnchorPointer,Ee.typeOf,Ee.has,Ee.step,Ee.keys,Ee.entries,Ee.map,Ee.length;class je extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var $e=je;const{splitUrl:Se}=p,xe="FLAG",Ae="BASIC",Pe="DETAILED",Ie="VERBOSE";let Te=Pe,ke=!0;const Ve=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await _e(e,t)}},Re=t((({ast:e,schemaUri:t},r,n=xe)=>{if(![xe,Ae,Pe,Ie].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",Ce(n,a));return Ne(t,r,e,{}),o.unsubscribe(i),a[0]})),Ce=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===Ae&&(o.push(...t.errors),delete t.errors),(e===Ie||e!==xe&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ue={},ze=e=>Ue[e],Ke=e=>e in Ue,Le={},qe={},_e=async(e,t)=>{if(e=await De(e),!Ke(`${e.schemaVersion}#validate`)){const t=await Ee.get(e.schemaVersion);(Ee.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 Le)Object.entries(Le[e]).forEach((([e,r])=>{((e,t)=>{Ue[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(ke&&!e.validated){if(Ee.markValidated(e.id),!(e.schemaVersion in qe)){const t=await Ee.get(e.schemaVersion),r=await Ve(t);qe[t.id]=Re(r)}const t=L.cons(e.schema,e.id),r=qe[e.schemaVersion](t,Te);if(!r.valid)throw new $e(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),ze(`${e.schemaVersion}#validate`).compile(e,t)},De=async e=>Ee.typeOf(e,"string")?De(await Ee.get(Ee.value(e),e)):e,Ne=(e,t,r,n)=>{const o=Be(e,r),a=Se(e)[0];return ze(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Be=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Fe={validate:async(e,t,r)=>{const n=await Ve(e),o=(e,t)=>Re(n,L.cons(e),t);return void 0===t?o:o(t,r)},compile:Ve,interpret:Re,setMetaOutputFormat:e=>{Te=e},setShouldMetaValidate:e=>{ke=e},FLAG:xe,BASIC:Ae,DETAILED:Pe,VERBOSE:Ie,add:(e,t="",r="")=>{const n=Ee.add(e,t,r);delete qe[n]},getKeyword:ze,hasKeyword:Ke,defineVocabulary:(e,t)=>{Le[e]=t},compileSchema:_e,interpretSchema:Ne,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Be(e,r);return ze(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Be(e,r);return ze(a).collectEvaluatedItems(e,t,r,n,o)}};var Ze={compile:e=>Ee.value(e),interpret:()=>!0};var Je={compile:async(e,t)=>{const r=Ee.uri(e);if(!(r in t)){t[r]=!1;const n=Ee.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Ee.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Ee.uri(e),"boolean"==typeof n?n:await te.pipeline([Ee.entries,te.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),te.filter((([t])=>Fe.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),te.map((async([r,n])=>{const o=await Fe.getKeyword(r).compile(n,t,e);return[r,Ee.uri(n),o]})),te.all],e)]}return r},interpret:(e,t,r,n)=>{const[a,i,s]=r[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=Fe.getKeyword(e).interpret(i,t,r,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:L.uri(t),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:L.uri(t),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Fe.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Fe.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},We={metaData:Ze,validate:Je},Me=e("default",{Core:Fe,Schema:Ee,Instance:L,Reference:A,Keywords:We,InvalidSchemaError:$e});e("Core",Me.Core),e("Schema",Me.Schema),e("Instance",Me.Instance),e("Reference",Me.Reference),e("Keywords",Me.Keywords),e("InvalidSchemaError",Me.InvalidSchemaError)}}})); | ||
//# sourceMappingURL=json-schema-core-system.min.js.map |
@@ -802,2 +802,6 @@ (function (global, factory) { | ||
var reference = { cons: cons$1, isReference, href, value: value$2 }; | ||
reference.cons; | ||
reference.isReference; | ||
reference.href; | ||
reference.value; | ||
@@ -1730,13 +1734,15 @@ const { jsonTypeOf: jsonTypeOf$1 } = common; | ||
var lib = { Core: core, Schema: schema, Instance: instance, Keywords: keywords, InvalidSchemaError: invalidSchemaError }; | ||
var lib = { Core: core, Schema: schema, Instance: instance, Reference: reference, Keywords: keywords, InvalidSchemaError: invalidSchemaError }; | ||
var lib_1 = lib.Core; | ||
var lib_2 = lib.Schema; | ||
var lib_3 = lib.Instance; | ||
var lib_4 = lib.Keywords; | ||
var lib_5 = lib.InvalidSchemaError; | ||
var lib_4 = lib.Reference; | ||
var lib_5 = lib.Keywords; | ||
var lib_6 = lib.InvalidSchemaError; | ||
exports.Core = lib_1; | ||
exports.Instance = lib_3; | ||
exports.InvalidSchemaError = lib_5; | ||
exports.Keywords = lib_4; | ||
exports.InvalidSchemaError = lib_6; | ||
exports.Keywords = lib_5; | ||
exports.Reference = lib_4; | ||
exports.Schema = lib_2; | ||
@@ -1743,0 +1749,0 @@ exports["default"] = lib; |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).JSC={})}(this,(function(e){"use strict";var t=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)))}}};var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var n=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){var n,o;n="object"==typeof window&&window||r,o={},n.PubSub=o,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},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)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(o),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}));n.PubSub;var o=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),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}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(s.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)?a(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+i(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,s=r.path,c=r.host;return 0===e.length?a=s:(s=s.substring(0,s.lastIndexOf("/")),a=i(s+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:a(e)}};function a(e){return e+("/"===e[e.length-1]?"":"/")}function i(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 s=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const c={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},l=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)]},u=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var f={jsonTypeOf:(e,t)=>c[t](e),splitUrl:l,safeResolveUrl:(e,t)=>{const r=o(e,t),n=l(e)[0];if(n&&"file"===u(r)&&"file"!==u(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const p=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(g)},d=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:d(e,O(t,o,n),r,v(o,n))}}if(Array.isArray(t)){const n=[...t];return n[w(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:O(t,e[0],n)},h=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||E(t)){const o=e.shift();h(e,O(t,o,n),r,v(o,n))}else{t[w(t,e[0])]=r}},y=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=O(t,n,r);return{...t,[n]:y(e,o,v(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 O(t,e[0],r)}},b=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=O(t,n,r);b(e,o,v(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:O(t,e[0],r)},v=t(((e,t)=>t+"/"+m(e))),m=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),g=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),w=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,O=(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(E(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[w(e,t)]},E=e=>null===e||"object"!=typeof e;var j={nil:"",append:v,get:(e,t)=>{const r=p(e),n=e=>r.reduce((([e,t],r)=>[O(e,r,t),v(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=p(e),a=t(((e,t)=>d(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(e,r,n)=>{const o=p(e),a=t(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=p(e),n=e=>y(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=p(e),n=e=>b(r,e,"");return void 0===t?n:n(t)}};j.nil,j.append,j.get,j.set,j.assign,j.unset,j.remove;const $=Symbol("$__value"),S=Symbol("$__href");var x=(e,t)=>Object.freeze({[S]:e,[$]:t}),P=e=>e&&void 0!==e[S],A=e=>e[S],T=e=>e[$];const{jsonTypeOf:I}=f,k=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),V=e=>P(e.value)?T(e.value):e.value,C=t(((e,t)=>I(V(e),t))),U=(e,t)=>Object.freeze({...t,pointer:j.append(e,t.pointer),value:V(t)[e]}),R=t(((e,t)=>V(t).map(((r,n,o,a)=>e(U(n,t),n,o,a))))),z=t(((e,t)=>V(t).map(((e,r,n,o)=>U(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),K=t(((e,t,r)=>V(r).reduce(((t,n,o)=>e(t,U(o,r),o)),t))),L=t(((e,t)=>V(t).every(((r,n,o,a)=>e(U(n,t),n,o,a))))),q=t(((e,t)=>V(t).some(((r,n,o,a)=>e(U(n,t),n,o,a)))));var _={nil:k,cons:(e,t="")=>Object.freeze({...k,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:V,has:(e,t)=>e in V(t),typeOf:C,step:U,entries:e=>Object.keys(V(e)).map((t=>[t,U(t,e)])),keys:e=>Object.keys(V(e)),map:R,filter:z,reduce:K,every:L,some:q,length:e=>V(e).length},D=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,N=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,F=/\\([\u000b\u0020-\u00ff])/g,Z=/([\\"])/g,J=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function M(e){var t=String(e);if(B.test(t))return t;if(t.length>0&&!N.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(Z,"\\$1")+'"'}function W(e){this.parameters=Object.create(null),this.type=e}var G={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!J.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!B.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+M(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(!J.test(n))throw new TypeError("invalid media type");var o=new W(n.toLowerCase());if(-1!==r){var a,i,s;for(D.lastIndex=r;i=D.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(F,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},H=async e=>Object.entries(await e),Q=t((async(e,t)=>(await t).map(e))),X=t((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),Y=t((async(e,t,r={})=>X((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),ee=t((async(e,t)=>{const r=await Q(e,t);return(await Promise.all(r)).some((e=>e))})),te=t((async(e,t)=>{const r=await Q(e,t);return(await Promise.all(r)).every((e=>e))})),re=t(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),ne={entries:H,map:Q,filter:Y,reduce:X,some:ee,every:te,pipeline:re,all:e=>Promise.all(e),allValues:e=>re([H,X((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};ne.entries,ne.map,ne.filter,ne.reduce,ne.some,ne.every,ne.pipeline,ne.all,ne.allValues;var oe=fetch;const{jsonTypeOf:ae,splitUrl:ie,safeResolveUrl:se}=f,ce={},le={},ue=(e,t)=>{const r=e in le?le[e]:e;if(r in ce)return ce[r][t]},fe={},pe={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ie(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ue(n,"baseToken"),a=ue(n,"anchorToken"),i=ie(t)[0];if(!i&&!ie(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=se(i,e[o]||""),[c,l]=ie(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(pe[i]=c);const u={},f=ue(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=ue(n,"vocabularyToken");ae(e[d],"object")?(le[c]=n,p=e[d],delete e[d]):(le[c]=n,p={[n]:!0});const h={"":""};return fe[c]={id:c,schemaVersion:n,schema:he(e,c,n,j.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:p,validated:!1},c},he=(e,t,r,n,o,a)=>{if(ae(e,"object")){const i="string"==typeof e.$schema?ie(e.$schema)[0]:r,s=ue(i,"embeddedToken"),c=ue(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=se(t,e[s]);return e[s]=n,de(e,n,r),x(e[s],e)}const l=ue(r,"anchorToken"),u=ue(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=ue(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=ue(r,"jrefToken");if("string"==typeof e[p])return x(e[p],e);for(const i in e)e[i]=he(e[i],t,r,j.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>he(e,t,r,j.append(i,n),o,a))):e},ye=e=>fe[pe[e]]||fe[e],be=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:j.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ve=async(e,t=be)=>{const r=se(we(t),e),[n,o]=ie(r);if(!(e=>e in fe||e in pe)(n)){const e=await oe(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=G.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),n)}const a=ye(n),i="/"!==o[0]?ge(a,o):o,s=Object.freeze({...a,pointer:i,value:j.get(i,a.schema)});return me(s)},me=e=>P(e.value)?ve(A(e.value),e):e,ge=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},we=e=>`${e.id}#${encodeURI(e.pointer)}`,Oe=e=>P(e.value)?T(e.value):e.value,Ee=(e,t)=>{const r=ye(t.id),n=Object.freeze({...t,pointer:j.append(e,t.pointer),value:Oe(t)[e],validated:r.validated});return me(n)},je=t(((e,t)=>ne.pipeline([Oe,ne.map((async(r,n)=>e(await Ee(n,t),n))),ne.all],t)));var $e={setConfig:(e,t,r)=>{ce[e]||(ce[e]={}),ce[e][t]=r},getConfig:ue,add:de,get:ve,markValidated:e=>{fe[e].validated=!0},uri:we,value:Oe,getAnchorPointer:ge,typeOf:(e,t)=>ae(Oe(e),t),has:(e,t)=>e in Oe(t),step:Ee,keys:e=>Object.keys(Oe(e)),entries:e=>ne.pipeline([Oe,Object.keys,ne.map((async t=>[t,await Ee(t,e)])),ne.all],e),map:je,length:e=>Oe(e).length};$e.setConfig,$e.getConfig,$e.add,$e.get,$e.markValidated,$e.uri,$e.value,$e.getAnchorPointer,$e.typeOf,$e.has,$e.step,$e.keys,$e.entries,$e.map,$e.length;class Se extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=Se;const{splitUrl:Pe}=f,Ae="FLAG",Te="BASIC",Ie="DETAILED",ke="VERBOSE";let Ve=Ie,Ce=!0;const Ue=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await Ne(e,t)}},Re=t((({ast:e,schemaUri:t},r,o=Ae)=>{if(![Ae,Te,Ie,ke].includes(o))throw Error(`The '${o}' error format is not supported`);const a=[],i=n.subscribe("result",ze(o,a));return Fe(t,r,e,{}),n.unsubscribe(i),a[0]})),ze=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===Te&&(o.push(...t.errors),delete t.errors),(e===ke||e!==Ae&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ke={},Le=e=>Ke[e],qe=e=>e in Ke,_e={},De={},Ne=async(e,t)=>{if(e=await Be(e),!qe(`${e.schemaVersion}#validate`)){const t=await $e.get(e.schemaVersion);($e.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 _e)Object.entries(_e[e]).forEach((([e,r])=>{((e,t)=>{Ke[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Ce&&!e.validated){if($e.markValidated(e.id),!(e.schemaVersion in De)){const t=await $e.get(e.schemaVersion),r=await Ue(t);De[t.id]=Re(r)}const t=_.cons(e.schema,e.id),r=De[e.schemaVersion](t,Ve);if(!r.valid)throw new xe(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Le(`${e.schemaVersion}#validate`).compile(e,t)},Be=async e=>$e.typeOf(e,"string")?Be(await $e.get($e.value(e),e)):e,Fe=(e,t,r,n)=>{const o=Ze(e,r),a=Pe(e)[0];return Le(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Ze=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Je={validate:async(e,t,r)=>{const n=await Ue(e),o=(e,t)=>Re(n,_.cons(e),t);return void 0===t?o:o(t,r)},compile:Ue,interpret:Re,setMetaOutputFormat:e=>{Ve=e},setShouldMetaValidate:e=>{Ce=e},FLAG:Ae,BASIC:Te,DETAILED:Ie,VERBOSE:ke,add:(e,t="",r="")=>{const n=$e.add(e,t,r);delete De[n]},getKeyword:Le,hasKeyword:qe,defineVocabulary:(e,t)=>{_e[e]=t},compileSchema:Ne,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Ze(e,r);return Le(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Ze(e,r);return Le(a).collectEvaluatedItems(e,t,r,n,o)}};var Me={compile:e=>$e.value(e),interpret:()=>!0};var We={compile:async(e,t)=>{const r=$e.uri(e);if(!(r in t)){t[r]=!1;const n=$e.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${$e.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,$e.uri(e),"boolean"==typeof n?n:await ne.pipeline([$e.entries,ne.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ne.filter((([t])=>Je.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),ne.map((async([r,n])=>{const o=await Je.getKeyword(r).compile(n,t,e);return[r,$e.uri(n),o]})),ne.all],e)]}return r},interpret:(e,t,r,o)=>{const[a,i,s]=r[e];n.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{n.publishSync("result.start");const s=Je.getKeyword(e).interpret(i,t,r,o);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:_.uri(t),valid:s,ast:i}),n.publishSync("result.end"),s}));return n.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:_.uri(t),valid:c,ast:e}),n.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Je.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Je.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Ge={metaData:Me,validate:We},He={Core:Je,Schema:$e,Instance:_,Keywords:Ge,InvalidSchemaError:xe},Qe=He.Core,Xe=He.Schema,Ye=He.Instance,et=He.Keywords,tt=He.InvalidSchemaError;e.Core=Qe,e.Instance=Ye,e.InvalidSchemaError=tt,e.Keywords=et,e.Schema=Xe,e.default=He,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).JSC={})}(this,(function(e){"use strict";var t=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)))}}};var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var n=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){var n,o;n="object"==typeof window&&window||r,o={},n.PubSub=o,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},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)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(o),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}));n.PubSub;var o=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),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}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(s.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)?a(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+i(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,s=r.path,c=r.host;return 0===e.length?a=s:(s=s.substring(0,s.lastIndexOf("/")),a=i(s+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:a(e)}};function a(e){return e+("/"===e[e.length-1]?"":"/")}function i(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 s=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const c={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},l=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)]},u=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var f={jsonTypeOf:(e,t)=>c[t](e),splitUrl:l,safeResolveUrl:(e,t)=>{const r=o(e,t),n=l(e)[0];if(n&&"file"===u(r)&&"file"!==u(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const p=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(g)},d=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:d(e,O(t,o,n),r,v(o,n))}}if(Array.isArray(t)){const n=[...t];return n[w(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:O(t,e[0],n)},h=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||E(t)){const o=e.shift();h(e,O(t,o,n),r,v(o,n))}else{t[w(t,e[0])]=r}},y=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=O(t,n,r);return{...t,[n]:y(e,o,v(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 O(t,e[0],r)}},b=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=O(t,n,r);b(e,o,v(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:O(t,e[0],r)},v=t(((e,t)=>t+"/"+m(e))),m=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),g=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),w=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,O=(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(E(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[w(e,t)]},E=e=>null===e||"object"!=typeof e;var j={nil:"",append:v,get:(e,t)=>{const r=p(e),n=e=>r.reduce((([e,t],r)=>[O(e,r,t),v(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=p(e),a=t(((e,t)=>d(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(e,r,n)=>{const o=p(e),a=t(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=p(e),n=e=>y(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=p(e),n=e=>b(r,e,"");return void 0===t?n:n(t)}};j.nil,j.append,j.get,j.set,j.assign,j.unset,j.remove;const $=Symbol("$__value"),S=Symbol("$__href");var x={cons:(e,t)=>Object.freeze({[S]:e,[$]:t}),isReference:e=>e&&void 0!==e[S],href:e=>e[S],value:e=>e[$]};const{jsonTypeOf:P}=f,A=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>x.isReference(e.value)?x.value(e.value):e.value,I=t(((e,t)=>P(T(e),t))),k=(e,t)=>Object.freeze({...t,pointer:j.append(e,t.pointer),value:T(t)[e]}),V=t(((e,t)=>T(t).map(((r,n,o,a)=>e(k(n,t),n,o,a))))),R=t(((e,t)=>T(t).map(((e,r,n,o)=>k(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),C=t(((e,t,r)=>T(r).reduce(((t,n,o)=>e(t,k(o,r),o)),t))),U=t(((e,t)=>T(t).every(((r,n,o,a)=>e(k(n,t),n,o,a))))),z=t(((e,t)=>T(t).some(((r,n,o,a)=>e(k(n,t),n,o,a)))));var K={nil:A,cons:(e,t="")=>Object.freeze({...A,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:T,has:(e,t)=>e in T(t),typeOf:I,step:k,entries:e=>Object.keys(T(e)).map((t=>[t,k(t,e)])),keys:e=>Object.keys(T(e)),map:V,filter:R,reduce:C,every:U,some:z,length:e=>T(e).length},L=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,q=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,_=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,D=/\\([\u000b\u0020-\u00ff])/g,N=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function F(e){var t=String(e);if(_.test(t))return t;if(t.length>0&&!q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(N,"\\$1")+'"'}function Z(e){this.parameters=Object.create(null),this.type=e}var J={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!B.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!_.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+F(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!B.test(n))throw new TypeError("invalid media type");var o=new Z(n.toLowerCase());if(-1!==r){var a,i,s;for(L.lastIndex=r;i=L.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(D,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},M=async e=>Object.entries(await e),W=t((async(e,t)=>(await t).map(e))),G=t((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),H=t((async(e,t,r={})=>G((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),Q=t((async(e,t)=>{const r=await W(e,t);return(await Promise.all(r)).some((e=>e))})),X=t((async(e,t)=>{const r=await W(e,t);return(await Promise.all(r)).every((e=>e))})),Y=t(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),ee={entries:M,map:W,filter:H,reduce:G,some:Q,every:X,pipeline:Y,all:e=>Promise.all(e),allValues:e=>Y([M,G((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};ee.entries,ee.map,ee.filter,ee.reduce,ee.some,ee.every,ee.pipeline,ee.all,ee.allValues;var te=fetch;const{jsonTypeOf:re,splitUrl:ne,safeResolveUrl:oe}=f,ae={},ie={},se=(e,t)=>{const r=e in ie?ie[e]:e;if(r in ae)return ae[r][t]},ce={},le={},ue=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ne(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=se(n,"baseToken"),a=se(n,"anchorToken"),i=ne(t)[0];if(!i&&!ne(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=oe(i,e[o]||""),[c,l]=ne(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(le[i]=c);const u={},f=se(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=se(n,"vocabularyToken");re(e[d],"object")?(ie[c]=n,p=e[d],delete e[d]):(ie[c]=n,p={[n]:!0});const h={"":""};return ce[c]={id:c,schemaVersion:n,schema:fe(e,c,n,j.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:p,validated:!1},c},fe=(e,t,r,n,o,a)=>{if(re(e,"object")){const i="string"==typeof e.$schema?ne(e.$schema)[0]:r,s=se(i,"embeddedToken"),c=se(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(t,e[s]);return e[s]=n,ue(e,n,r),x.cons(e[s],e)}const l=se(r,"anchorToken"),u=se(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=se(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=se(r,"jrefToken");if("string"==typeof e[p])return x.cons(e[p],e);for(const i in e)e[i]=fe(e[i],t,r,j.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>fe(e,t,r,j.append(i,n),o,a))):e},pe=e=>ce[le[e]]||ce[e],de=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:j.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),he=async(e,t=de)=>{const r=oe(ve(t),e),[n,o]=ne(r);if(!(e=>e in ce||e in le)(n)){const e=await te(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=J.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}ue(await e.json(),n)}const a=pe(n),i="/"!==o[0]?be(a,o):o,s=Object.freeze({...a,pointer:i,value:j.get(i,a.schema)});return ye(s)},ye=e=>x.isReference(e.value)?he(x.href(e.value),e):e,be=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ve=e=>`${e.id}#${encodeURI(e.pointer)}`,me=e=>x.isReference(e.value)?x.value(e.value):e.value,ge=(e,t)=>{const r=pe(t.id),n=Object.freeze({...t,pointer:j.append(e,t.pointer),value:me(t)[e],validated:r.validated});return ye(n)},we=t(((e,t)=>ee.pipeline([me,ee.map((async(r,n)=>e(await ge(n,t),n))),ee.all],t)));var Oe={setConfig:(e,t,r)=>{ae[e]||(ae[e]={}),ae[e][t]=r},getConfig:se,add:ue,get:he,markValidated:e=>{ce[e].validated=!0},uri:ve,value:me,getAnchorPointer:be,typeOf:(e,t)=>re(me(e),t),has:(e,t)=>e in me(t),step:ge,keys:e=>Object.keys(me(e)),entries:e=>ee.pipeline([me,Object.keys,ee.map((async t=>[t,await ge(t,e)])),ee.all],e),map:we,length:e=>me(e).length};Oe.setConfig,Oe.getConfig,Oe.add,Oe.get,Oe.markValidated,Oe.uri,Oe.value,Oe.getAnchorPointer,Oe.typeOf,Oe.has,Oe.step,Oe.keys,Oe.entries,Oe.map,Oe.length;class Ee extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var je=Ee;const{splitUrl:$e}=f,Se="FLAG",xe="BASIC",Pe="DETAILED",Ae="VERBOSE";let Te=Pe,Ie=!0;const ke=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await qe(e,t)}},Ve=t((({ast:e,schemaUri:t},r,o=Se)=>{if(![Se,xe,Pe,Ae].includes(o))throw Error(`The '${o}' error format is not supported`);const a=[],i=n.subscribe("result",Re(o,a));return De(t,r,e,{}),n.unsubscribe(i),a[0]})),Re=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===xe&&(o.push(...t.errors),delete t.errors),(e===Ae||e!==Se&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ce={},Ue=e=>Ce[e],ze=e=>e in Ce,Ke={},Le={},qe=async(e,t)=>{if(e=await _e(e),!ze(`${e.schemaVersion}#validate`)){const t=await Oe.get(e.schemaVersion);(Oe.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 Ke)Object.entries(Ke[e]).forEach((([e,r])=>{((e,t)=>{Ce[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Ie&&!e.validated){if(Oe.markValidated(e.id),!(e.schemaVersion in Le)){const t=await Oe.get(e.schemaVersion),r=await ke(t);Le[t.id]=Ve(r)}const t=K.cons(e.schema,e.id),r=Le[e.schemaVersion](t,Te);if(!r.valid)throw new je(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Ue(`${e.schemaVersion}#validate`).compile(e,t)},_e=async e=>Oe.typeOf(e,"string")?_e(await Oe.get(Oe.value(e),e)):e,De=(e,t,r,n)=>{const o=Ne(e,r),a=$e(e)[0];return Ue(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Ne=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Be={validate:async(e,t,r)=>{const n=await ke(e),o=(e,t)=>Ve(n,K.cons(e),t);return void 0===t?o:o(t,r)},compile:ke,interpret:Ve,setMetaOutputFormat:e=>{Te=e},setShouldMetaValidate:e=>{Ie=e},FLAG:Se,BASIC:xe,DETAILED:Pe,VERBOSE:Ae,add:(e,t="",r="")=>{const n=Oe.add(e,t,r);delete Le[n]},getKeyword:Ue,hasKeyword:ze,defineVocabulary:(e,t)=>{Ke[e]=t},compileSchema:qe,interpretSchema:De,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Ne(e,r);return Ue(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Ne(e,r);return Ue(a).collectEvaluatedItems(e,t,r,n,o)}};var Fe={compile:e=>Oe.value(e),interpret:()=>!0};var Ze={compile:async(e,t)=>{const r=Oe.uri(e);if(!(r in t)){t[r]=!1;const n=Oe.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Oe.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Oe.uri(e),"boolean"==typeof n?n:await ee.pipeline([Oe.entries,ee.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ee.filter((([t])=>Be.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),ee.map((async([r,n])=>{const o=await Be.getKeyword(r).compile(n,t,e);return[r,Oe.uri(n),o]})),ee.all],e)]}return r},interpret:(e,t,r,o)=>{const[a,i,s]=r[e];n.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{n.publishSync("result.start");const s=Be.getKeyword(e).interpret(i,t,r,o);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:K.uri(t),valid:s,ast:i}),n.publishSync("result.end"),s}));return n.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:K.uri(t),valid:c,ast:e}),n.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Be.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Be.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Je={metaData:Fe,validate:Ze},Me={Core:Be,Schema:Oe,Instance:K,Reference:x,Keywords:Je,InvalidSchemaError:je},We=Me.Core,Ge=Me.Schema,He=Me.Instance,Qe=Me.Reference,Xe=Me.Keywords,Ye=Me.InvalidSchemaError;e.Core=We,e.Instance=He,e.InvalidSchemaError=Ye,e.Keywords=Xe,e.Reference=Qe,e.Schema=Ge,e.default=Me,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-umd.min.js.map |
import type { Core as CoreType } from "./core"; | ||
import type { Schema as SchemaType } from "./schema"; | ||
import type { Instance as InstanceType } from "./instance"; | ||
import type { Reference as ReferenceType } from "./reference"; | ||
import type { Vocabulary } from "./keywords"; | ||
@@ -10,2 +11,3 @@ | ||
export const Instance: InstanceType; | ||
export const Reference: ReferenceType; | ||
export const Keywords: Vocabulary; | ||
@@ -17,4 +19,5 @@ | ||
export * from "./instance"; | ||
export * from "./reference"; | ||
export * from "./keywords"; | ||
export * from "./invalid-schema-error"; | ||
export { Json, JsonObject } from "@hyperjump/json-pointer"; |
const Core = require("./core"); | ||
const Schema = require("./schema"); | ||
const Instance = require("./instance"); | ||
const Reference = require("./reference"); | ||
const Keywords = require("./keywords"); | ||
@@ -8,2 +9,2 @@ const InvalidSchemaError = require("./invalid-schema-error"); | ||
module.exports = { Core, Schema, Instance, Keywords, InvalidSchemaError }; | ||
module.exports = { Core, Schema, Instance, Reference, Keywords, InvalidSchemaError }; |
{ | ||
"name": "@hyperjump/json-schema-core", | ||
"version": "0.22.2", | ||
"version": "0.22.3", | ||
"description": "A framework for building JSON Schema tools", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1673102
9980