@hyperjump/json-schema-core
Advanced tools
Comparing version 0.10.1 to 0.10.2
@@ -890,3 +890,3 @@ define(['exports'], function (exports) { 'use strict'; | ||
resultArray.pop(); // remove previous | ||
} else if (current !== '') { | ||
} else if (current !== '' || index === pathSplit.length - 1) { | ||
resultArray.push(current); | ||
@@ -893,0 +893,0 @@ } |
@@ -6,3 +6,3 @@ define(["exports"],(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:b}=v,m=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=m)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return w("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),P=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),j=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),x=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var A={cons:(e,t="")=>Object.freeze({...m,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:P,every:j,some:x},S=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
* MIT Licensed | ||
*/function K(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function L(e){this.parameters=Object.create(null),this.type=e}var C={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+K(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!R.test(n))throw new TypeError("invalid media type");var o=new L(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=async e=>Object.entries(await e),q=n(async(e,t)=>(await t).map(e)),z=n(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),W=n(async(e,t,r={})=>z(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),_=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).some(e=>e)}),B=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).every(e=>e)}),D=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),F={entries:U,map:q,filter:W,reduce:z,some:_,every:B,pipeline:D,all:e=>Promise.all(e),allValues:e=>D([U,z(async(e,[t,r])=>(e[t]=await r,e),{})],e)},M=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(J.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?Z(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+N(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=N(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:Z(e)}};function Z(e){return e+("/"===e[e.length-1]?"":"/")}function N(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,t)=>{"."!==e&&(".."===e?r.pop():""!==e&&r.push(e))}),"/"+r.join("/")}const J=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var G=fetch;const{isObject:H,splitUrl:Q}=v,X=Symbol("$__jref"),Y={},ee={},te=(e,t)=>{const r=e in ee?ee[e]:e;if(r in Y)return Y[r][t]},re={},ne={},oe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=Q(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=te(n,"idToken"),i=Q(t)[0];if(!i&&!Q(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const a=ce(i,e[o]||""),s=Q(a)[0];i&&(ne[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,te(n,"vocabulary")&&H(e)&&"$vocabulary"in e?(ee[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};re[s]={id:s,schemaVersion:n,schema:ie(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},ie=(e,t,r,n,o)=>{if(H(e)){const i=te(r,"idToken"),a=te(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ce(t,n),[s,c]=Q(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return oe(e,ce(t,s),r),{[X]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=ie(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>ie(e,t,r,y.append(i,n),o)):e},ae=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),se=async(e,t=ae,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:fe(t),o=ce(n,e),[i,a]=Q(o);if(!(e=>e in re||e in ne)(i)){const e=await G(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=C.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}oe(await e.json(),i)}const s=(e=>re[ne[e]]||re[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?le(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=de(c);return H(u)&&X in u?se(u[X],c):te(c.schemaVersion,"jsonReference")&&H(u)&&"string"==typeof u.$ref?se(u.$ref,c):te(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?se(u,c):te(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?se(u,c,!0):c},ce=(e,t)=>{const r=M(e,t),n=Q(e)[0];if(n&&"file"===ue(r)&&"file"!==ue(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ue=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},le=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},fe=e=>`${e.id}#${encodeURI(e.pointer)}`,de=e=>y.get(e.pointer,e.schema),pe=(e,t)=>{const r=y.append(e,t.pointer);return se("#"+encodeURI(r),t)},he=n((e,t)=>F.pipeline([de,F.map(async(r,n)=>e(await pe(n,t),n)),F.all],t));var ye={setConfig:(e,t,r)=>{Y[e]||(Y[e]={}),Y[e][t]=r},getConfig:te,add:oe,get:se,markValidated:e=>{re[e].validated=!0},uri:fe,value:de,has:(e,t)=>e in de(t),step:pe,entries:e=>F.pipeline([de,Object.keys,F.map(async t=>[t,await pe(t,e)]),F.all],e),map:he};const ve="FLAG",be="BASIC",me="DETAILED",we="VERBOSE";let ge=me,Oe=!0;const Ee=(e,t)=>(n,o=ve)=>{if(![ve,be,me,we].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",$e(o,i));return ke(t,n,e),r.unsubscribe(a),i[0]},$e=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&Pe(r[r.length-1],i);){const t=r.pop();let n=[];if(e===be&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),je(i))break}(e===we||e!==ve&&!i.valid)&&r.push(i),t[0]=i}},Pe=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||je(e)),je=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),xe={},Ae=e=>xe[e],Se=e=>e in xe,Ie={},Ve={},Te=async(e,t)=>{if(!Se(e.schemaVersion+"#validate")){const t=await ye.get(e.schemaVersion);(ye.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Ie)Object.entries(Ie[e]).forEach(([e,r])=>{((e,t)=>{xe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(Oe&&!e.validated){if(ye.markValidated(e.id),!(e.schemaVersion in Ve)){const t=await ye.get(e.schemaVersion),r={},n=await Te(t,r);Ve[t.id]=Ee(r,n)}const t=A.cons(e.schema,e.id),r=Ve[e.schemaVersion](t,ge);if(!r.valid)throw r}return await Ae(e.schemaVersion+"#validate").compile(e,t),ye.uri(e)},ke=(e,t,r)=>{const[n]=r[e];return Ae(n).interpret(e,t,r)};var Re={validate:async(e,t,r)=>{const n={},o=await Te(e,n),i=(e,t=ve)=>Ee(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{ge=e},setShouldMetaValidate:e=>{Oe=e},FLAG:ve,BASIC:be,DETAILED:me,VERBOSE:we,getKeyword:Ae,hasKeyword:Se,defineVocabulary:(e,t)=>{Ie[e]=t},compileSchema:Te,interpretSchema:ke,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Ae(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Ae(o).collectEvaluatedItems(e,t,r,n)}};var Ke={compile:async(e,t)=>{const r=ye.uri(e);if(!(r in t)){t[r]=!1;const n=ye.value(e);t[r]=[e.schemaVersion+"#validate",ye.uri(e),"boolean"==typeof n?n:await F.pipeline([ye.entries,F.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),F.filter(([t])=>Re.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),F.map(async([r,n])=>{const o=await Re.getKeyword(r).compile(n,t,e);return[r,ye.uri(n),o]}),F.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Re.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Re.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Re.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:Re,Schema:ye,Instance:A,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Ke}},Ce=Le.Core,Ue=Le.Schema,qe=Le.Instance,ze=Le.Keywords;e.Core=Ce,e.Instance=qe,e.Keywords=ze,e.Schema=Ue,e.default=Le,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
*/function K(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function L(e){this.parameters=Object.create(null),this.type=e}var C={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+K(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!R.test(n))throw new TypeError("invalid media type");var o=new L(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=async e=>Object.entries(await e),q=n(async(e,t)=>(await t).map(e)),z=n(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),W=n(async(e,t,r={})=>z(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),_=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).some(e=>e)}),B=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).every(e=>e)}),D=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),F={entries:U,map:q,filter:W,reduce:z,some:_,every:B,pipeline:D,all:e=>Promise.all(e),allValues:e=>D([U,z(async(e,[t,r])=>(e[t]=await r,e),{})],e)},M=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(J.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?Z(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+N(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=N(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:Z(e)}};function Z(e){return e+("/"===e[e.length-1]?"":"/")}function N(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const J=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var G=fetch;const{isObject:H,splitUrl:Q}=v,X=Symbol("$__jref"),Y={},ee={},te=(e,t)=>{const r=e in ee?ee[e]:e;if(r in Y)return Y[r][t]},re={},ne={},oe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=Q(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=te(n,"idToken"),i=Q(t)[0];if(!i&&!Q(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const a=ce(i,e[o]||""),s=Q(a)[0];i&&(ne[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,te(n,"vocabulary")&&H(e)&&"$vocabulary"in e?(ee[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};re[s]={id:s,schemaVersion:n,schema:ie(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},ie=(e,t,r,n,o)=>{if(H(e)){const i=te(r,"idToken"),a=te(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ce(t,n),[s,c]=Q(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return oe(e,ce(t,s),r),{[X]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=ie(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>ie(e,t,r,y.append(i,n),o)):e},ae=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),se=async(e,t=ae,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:fe(t),o=ce(n,e),[i,a]=Q(o);if(!(e=>e in re||e in ne)(i)){const e=await G(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=C.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}oe(await e.json(),i)}const s=(e=>re[ne[e]]||re[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?le(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=de(c);return H(u)&&X in u?se(u[X],c):te(c.schemaVersion,"jsonReference")&&H(u)&&"string"==typeof u.$ref?se(u.$ref,c):te(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?se(u,c):te(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?se(u,c,!0):c},ce=(e,t)=>{const r=M(e,t),n=Q(e)[0];if(n&&"file"===ue(r)&&"file"!==ue(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ue=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},le=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},fe=e=>`${e.id}#${encodeURI(e.pointer)}`,de=e=>y.get(e.pointer,e.schema),pe=(e,t)=>{const r=y.append(e,t.pointer);return se("#"+encodeURI(r),t)},he=n((e,t)=>F.pipeline([de,F.map(async(r,n)=>e(await pe(n,t),n)),F.all],t));var ye={setConfig:(e,t,r)=>{Y[e]||(Y[e]={}),Y[e][t]=r},getConfig:te,add:oe,get:se,markValidated:e=>{re[e].validated=!0},uri:fe,value:de,has:(e,t)=>e in de(t),step:pe,entries:e=>F.pipeline([de,Object.keys,F.map(async t=>[t,await pe(t,e)]),F.all],e),map:he};const ve="FLAG",be="BASIC",me="DETAILED",we="VERBOSE";let ge=me,Oe=!0;const Ee=(e,t)=>(n,o=ve)=>{if(![ve,be,me,we].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",$e(o,i));return ke(t,n,e),r.unsubscribe(a),i[0]},$e=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&Pe(r[r.length-1],i);){const t=r.pop();let n=[];if(e===be&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),je(i))break}(e===we||e!==ve&&!i.valid)&&r.push(i),t[0]=i}},Pe=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||je(e)),je=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),xe={},Ae=e=>xe[e],Se=e=>e in xe,Ie={},Ve={},Te=async(e,t)=>{if(!Se(e.schemaVersion+"#validate")){const t=await ye.get(e.schemaVersion);(ye.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Ie)Object.entries(Ie[e]).forEach(([e,r])=>{((e,t)=>{xe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(Oe&&!e.validated){if(ye.markValidated(e.id),!(e.schemaVersion in Ve)){const t=await ye.get(e.schemaVersion),r={},n=await Te(t,r);Ve[t.id]=Ee(r,n)}const t=A.cons(e.schema,e.id),r=Ve[e.schemaVersion](t,ge);if(!r.valid)throw r}return await Ae(e.schemaVersion+"#validate").compile(e,t),ye.uri(e)},ke=(e,t,r)=>{const[n]=r[e];return Ae(n).interpret(e,t,r)};var Re={validate:async(e,t,r)=>{const n={},o=await Te(e,n),i=(e,t=ve)=>Ee(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{ge=e},setShouldMetaValidate:e=>{Oe=e},FLAG:ve,BASIC:be,DETAILED:me,VERBOSE:we,getKeyword:Ae,hasKeyword:Se,defineVocabulary:(e,t)=>{Ie[e]=t},compileSchema:Te,interpretSchema:ke,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Ae(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Ae(o).collectEvaluatedItems(e,t,r,n)}};var Ke={compile:async(e,t)=>{const r=ye.uri(e);if(!(r in t)){t[r]=!1;const n=ye.value(e);t[r]=[e.schemaVersion+"#validate",ye.uri(e),"boolean"==typeof n?n:await F.pipeline([ye.entries,F.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),F.filter(([t])=>Re.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),F.map(async([r,n])=>{const o=await Re.getKeyword(r).compile(n,t,e);return[r,ye.uri(n),o]}),F.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Re.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Re.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Re.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:Re,Schema:ye,Instance:A,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Ke}},Ce=Le.Core,Ue=Le.Schema,qe=Le.Instance,ze=Le.Keywords;e.Core=Ce,e.Instance=qe,e.Keywords=ze,e.Schema=Ue,e.default=Le,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-amd.min.js.map |
@@ -892,3 +892,3 @@ 'use strict'; | ||
resultArray.pop(); // remove previous | ||
} else if (current !== '') { | ||
} else if (current !== '' || index === pathSplit.length - 1) { | ||
resultArray.push(current); | ||
@@ -895,0 +895,0 @@ } |
@@ -6,3 +6,3 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var t=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(t,r){!function(e,n){var o={};e.PubSub=o;var i=e.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==t&&t.exports&&(r=t.exports=o),r.PubSub=o,t.exports=r=o)}("object"==typeof window&&window||e)})),r=(t.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const n=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(l)},o=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const i=e.shift();return{...t,[i]:o(e,d(t,i,n),r,c(i,n))}}if(Array.isArray(t)){const n=[...t];return n[f(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:d(t,e[0],n)},i=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||p(t)){const o=e.shift();i(e,d(t,o,n),r,c(o,n))}else{t[f(t,e[0])]=r}},a=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=d(t,n,r);return{...t,[n]:a(e,o,c(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return d(t,e[0],r)}},s=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=d(t,n,r);s(e,o,c(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:d(t,e[0],r)},c=r((e,t)=>t+"/"+u(e)),u=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),l=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),f=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,d=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(p(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[f(e,t)]},p=e=>null===e||"object"!=typeof e;var h={nil:"",append:c,get:(e,t)=>{const r=n(e),o=e=>r.reduce(([e,t],r)=>[d(e,r,t),c(r,t)],[e,""])[0];return void 0===t?o:o(t)},set:(e,t,i)=>{const a=n(e),s=r((e,t)=>o(a,e,t,""));return void 0===t?s:s(t,i)},assign:(e,t,o)=>{const a=n(e),s=r((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,o)},unset:(e,t)=>{const r=n(e),o=e=>a(r,e,"");return void 0===t?o:o(t)},delete:(e,t)=>{const r=n(e),o=e=>s(r,e,"");return void 0===t?o:o(t)}};var y={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:v}=y,b=Object.freeze({id:"",pointer:"",instance:void 0}),m=(e,t=b)=>Object.freeze({...t,pointer:v(e)[1]}),w=e=>h.get(e.pointer,e.instance),g=(e,t)=>{const r=h.append(e,t.pointer);return m("#"+encodeURI(r),t)},O=r((e,t)=>w(t).map((r,n)=>e(g(n,t),n))),E=r((e,t)=>w(t).map((e,r)=>g(r,t)).filter((t,r)=>e(t,r))),$=r((e,t,r)=>w(r).reduce((t,n,o)=>e(t,g(o,r),o),t)),x=r((e,t)=>Object.keys(w(t)).every((r,n)=>e(g(r,t),n))),P=r((e,t)=>Object.keys(w(t)).some((r,n)=>e(g(r,t),n)));var j={cons:(e,t="")=>Object.freeze({...b,id:t,instance:e}),get:m,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:w,step:g,entries:e=>Object.keys(w(e)).map(t=>[t,g(t,e)]),map:O,filter:E,reduce:$,every:x,some:P},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,S=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,I=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,V=/\\([\u000b\u0020-\u00ff])/g,T=/([\\"])/g,k=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
* MIT Licensed | ||
*/function R(e){var t=String(e);if(I.test(t))return t;if(t.length>0&&!S.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(T,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!k.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!I.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+R(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!k.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=A.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(V,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},C=async e=>Object.entries(await e),U=r(async(e,t)=>(await t).map(e)),q=r(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),z=r(async(e,t,r={})=>q(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),W=r(async(e,t)=>{const r=await U(e,t);return(await Promise.all(r)).some(e=>e)}),_=r(async(e,t)=>{const r=await U(e,t);return(await Promise.all(r)).every(e=>e)}),B=r((e,t)=>e.reduce(async(e,t)=>t(await e),t)),D={entries:C,map:U,filter:z,reduce:q,some:W,every:_,pipeline:B,all:e=>Promise.all(e),allValues:e=>B([C,q(async(e,[t,r])=>(e[t]=await r,e),{})],e)},F=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(N.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?M(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+Z(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=Z(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:M(e)}};function M(e){return e+("/"===e[e.length-1]?"":"/")}function Z(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,t)=>{"."!==e&&(".."===e?r.pop():""!==e&&r.push(e))}),"/"+r.join("/")}const N=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var J=fetch;const{isObject:G,splitUrl:H}=y,Q=Symbol("$__jref"),X={},Y={},ee=(e,t)=>{const r=e in Y?Y[e]:e;if(r in X)return X[r][t]},te={},re={},ne=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=H(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ee(n,"idToken"),i=H(t)[0];if(!i&&!H(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const a=se(i,e[o]||""),s=H(a)[0];i&&(re[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,ee(n,"vocabulary")&&G(e)&&"$vocabulary"in e?(Y[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};te[s]={id:s,schemaVersion:n,schema:oe(e,s,n,h.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},oe=(e,t,r,n,o)=>{if(G(e)){const i=ee(r,"idToken"),a=ee(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=se(t,n),[s,c]=H(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return ne(e,se(t,s),r),{[Q]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=oe(a,t,r,h.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>oe(e,t,r,h.append(i,n),o)):e},ie=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),ae=async(e,t=ie,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:le(t),o=se(n,e),[i,a]=H(o);if(!(e=>e in te||e in re)(i)){const e=await J(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}ne(await e.json(),i)}const s=(e=>te[re[e]]||te[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?ue(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=fe(c);return G(u)&&Q in u?ae(u[Q],c):ee(c.schemaVersion,"jsonReference")&&G(u)&&"string"==typeof u.$ref?ae(u.$ref,c):ee(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?ae(u,c):ee(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?ae(u,c,!0):c},se=(e,t)=>{const r=F(e,t),n=H(e)[0];if(n&&"file"===ce(r)&&"file"!==ce(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ce=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ue=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},le=e=>`${e.id}#${encodeURI(e.pointer)}`,fe=e=>h.get(e.pointer,e.schema),de=(e,t)=>{const r=h.append(e,t.pointer);return ae("#"+encodeURI(r),t)},pe=r((e,t)=>D.pipeline([fe,D.map(async(r,n)=>e(await de(n,t),n)),D.all],t));var he={setConfig:(e,t,r)=>{X[e]||(X[e]={}),X[e][t]=r},getConfig:ee,add:ne,get:ae,markValidated:e=>{te[e].validated=!0},uri:le,value:fe,has:(e,t)=>e in fe(t),step:de,entries:e=>D.pipeline([fe,Object.keys,D.map(async t=>[t,await de(t,e)]),D.all],e),map:pe};const ye="FLAG",ve="BASIC",be="DETAILED",me="VERBOSE";let we=be,ge=!0;const Oe=(e,r)=>(n,o=ye)=>{if(![ye,ve,be,me].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=t.subscribe("result",Ee(o,i));return Te(r,n,e),t.unsubscribe(a),i[0]},Ee=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&$e(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ve&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),xe(i))break}(e===me||e!==ye&&!i.valid)&&r.push(i),t[0]=i}},$e=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||xe(e)),xe=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),Pe={},je=e=>Pe[e],Ae=e=>e in Pe,Se={},Ie={},Ve=async(e,t)=>{if(!Ae(e.schemaVersion+"#validate")){const t=await he.get(e.schemaVersion);(he.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Se)Object.entries(Se[e]).forEach(([e,r])=>{((e,t)=>{Pe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(ge&&!e.validated){if(he.markValidated(e.id),!(e.schemaVersion in Ie)){const t=await he.get(e.schemaVersion),r={},n=await Ve(t,r);Ie[t.id]=Oe(r,n)}const t=j.cons(e.schema,e.id),r=Ie[e.schemaVersion](t,we);if(!r.valid)throw r}return await je(e.schemaVersion+"#validate").compile(e,t),he.uri(e)},Te=(e,t,r)=>{const[n]=r[e];return je(n).interpret(e,t,r)};var ke={validate:async(e,t,r)=>{const n={},o=await Ve(e,n),i=(e,t=ye)=>Oe(n,o)(j.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{we=e},setShouldMetaValidate:e=>{ge=e},FLAG:ye,BASIC:ve,DETAILED:be,VERBOSE:me,getKeyword:je,hasKeyword:Ae,defineVocabulary:(e,t)=>{Se[e]=t},compileSchema:Ve,interpretSchema:Te,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return je(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return je(o).collectEvaluatedItems(e,t,r,n)}};var Re={compile:async(e,t)=>{const r=he.uri(e);if(!(r in t)){t[r]=!1;const n=he.value(e);t[r]=[e.schemaVersion+"#validate",he.uri(e),"boolean"==typeof n?n:await D.pipeline([he.entries,D.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),D.filter(([t])=>ke.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),D.map(async([r,n])=>{const o=await ke.getKeyword(r).compile(n,t,e);return[r,he.uri(n),o]}),D.all],e)]}},interpret:(e,r,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=ke.getKeyword(e).interpret(i,r,n);return t.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:j.uri(r),valid:a}),a});return t.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:j.uri(r),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&ke.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&ke.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ke={Core:ke,Schema:he,Instance:j,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Re}},Le=Ke.Core,Ce=Ke.Schema,Ue=Ke.Instance,qe=Ke.Keywords;exports.Core=Le,exports.Instance=Ue,exports.Keywords=qe,exports.Schema=Ce,exports.default=Ke; | ||
*/function R(e){var t=String(e);if(I.test(t))return t;if(t.length>0&&!S.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(T,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!k.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!I.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+R(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!k.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=A.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(V,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},C=async e=>Object.entries(await e),U=r(async(e,t)=>(await t).map(e)),q=r(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),z=r(async(e,t,r={})=>q(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),W=r(async(e,t)=>{const r=await U(e,t);return(await Promise.all(r)).some(e=>e)}),_=r(async(e,t)=>{const r=await U(e,t);return(await Promise.all(r)).every(e=>e)}),B=r((e,t)=>e.reduce(async(e,t)=>t(await e),t)),D={entries:C,map:U,filter:z,reduce:q,some:W,every:_,pipeline:B,all:e=>Promise.all(e),allValues:e=>B([C,q(async(e,[t,r])=>(e[t]=await r,e),{})],e)},F=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(N.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?M(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+Z(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=Z(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:M(e)}};function M(e){return e+("/"===e[e.length-1]?"":"/")}function Z(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const N=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var J=fetch;const{isObject:G,splitUrl:H}=y,Q=Symbol("$__jref"),X={},Y={},ee=(e,t)=>{const r=e in Y?Y[e]:e;if(r in X)return X[r][t]},te={},re={},ne=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=H(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ee(n,"idToken"),i=H(t)[0];if(!i&&!H(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const a=se(i,e[o]||""),s=H(a)[0];i&&(re[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,ee(n,"vocabulary")&&G(e)&&"$vocabulary"in e?(Y[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};te[s]={id:s,schemaVersion:n,schema:oe(e,s,n,h.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},oe=(e,t,r,n,o)=>{if(G(e)){const i=ee(r,"idToken"),a=ee(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=se(t,n),[s,c]=H(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return ne(e,se(t,s),r),{[Q]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=oe(a,t,r,h.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>oe(e,t,r,h.append(i,n),o)):e},ie=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),ae=async(e,t=ie,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:le(t),o=se(n,e),[i,a]=H(o);if(!(e=>e in te||e in re)(i)){const e=await J(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}ne(await e.json(),i)}const s=(e=>te[re[e]]||te[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?ue(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=fe(c);return G(u)&&Q in u?ae(u[Q],c):ee(c.schemaVersion,"jsonReference")&&G(u)&&"string"==typeof u.$ref?ae(u.$ref,c):ee(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?ae(u,c):ee(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?ae(u,c,!0):c},se=(e,t)=>{const r=F(e,t),n=H(e)[0];if(n&&"file"===ce(r)&&"file"!==ce(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ce=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ue=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},le=e=>`${e.id}#${encodeURI(e.pointer)}`,fe=e=>h.get(e.pointer,e.schema),de=(e,t)=>{const r=h.append(e,t.pointer);return ae("#"+encodeURI(r),t)},pe=r((e,t)=>D.pipeline([fe,D.map(async(r,n)=>e(await de(n,t),n)),D.all],t));var he={setConfig:(e,t,r)=>{X[e]||(X[e]={}),X[e][t]=r},getConfig:ee,add:ne,get:ae,markValidated:e=>{te[e].validated=!0},uri:le,value:fe,has:(e,t)=>e in fe(t),step:de,entries:e=>D.pipeline([fe,Object.keys,D.map(async t=>[t,await de(t,e)]),D.all],e),map:pe};const ye="FLAG",ve="BASIC",be="DETAILED",me="VERBOSE";let we=be,ge=!0;const Oe=(e,r)=>(n,o=ye)=>{if(![ye,ve,be,me].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=t.subscribe("result",Ee(o,i));return Te(r,n,e),t.unsubscribe(a),i[0]},Ee=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&$e(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ve&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),xe(i))break}(e===me||e!==ye&&!i.valid)&&r.push(i),t[0]=i}},$e=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||xe(e)),xe=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),Pe={},je=e=>Pe[e],Ae=e=>e in Pe,Se={},Ie={},Ve=async(e,t)=>{if(!Ae(e.schemaVersion+"#validate")){const t=await he.get(e.schemaVersion);(he.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Se)Object.entries(Se[e]).forEach(([e,r])=>{((e,t)=>{Pe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(ge&&!e.validated){if(he.markValidated(e.id),!(e.schemaVersion in Ie)){const t=await he.get(e.schemaVersion),r={},n=await Ve(t,r);Ie[t.id]=Oe(r,n)}const t=j.cons(e.schema,e.id),r=Ie[e.schemaVersion](t,we);if(!r.valid)throw r}return await je(e.schemaVersion+"#validate").compile(e,t),he.uri(e)},Te=(e,t,r)=>{const[n]=r[e];return je(n).interpret(e,t,r)};var ke={validate:async(e,t,r)=>{const n={},o=await Ve(e,n),i=(e,t=ye)=>Oe(n,o)(j.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{we=e},setShouldMetaValidate:e=>{ge=e},FLAG:ye,BASIC:ve,DETAILED:be,VERBOSE:me,getKeyword:je,hasKeyword:Ae,defineVocabulary:(e,t)=>{Se[e]=t},compileSchema:Ve,interpretSchema:Te,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return je(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return je(o).collectEvaluatedItems(e,t,r,n)}};var Re={compile:async(e,t)=>{const r=he.uri(e);if(!(r in t)){t[r]=!1;const n=he.value(e);t[r]=[e.schemaVersion+"#validate",he.uri(e),"boolean"==typeof n?n:await D.pipeline([he.entries,D.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),D.filter(([t])=>ke.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),D.map(async([r,n])=>{const o=await ke.getKeyword(r).compile(n,t,e);return[r,he.uri(n),o]}),D.all],e)]}},interpret:(e,r,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=ke.getKeyword(e).interpret(i,r,n);return t.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:j.uri(r),valid:a}),a});return t.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:j.uri(r),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&ke.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&ke.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ke={Core:ke,Schema:he,Instance:j,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Re}},Le=Ke.Core,Ce=Ke.Schema,Ue=Ke.Instance,qe=Ke.Keywords;exports.Core=Le,exports.Instance=Ue,exports.Keywords=qe,exports.Schema=Ce,exports.default=Ke; | ||
//# sourceMappingURL=json-schema-core-cjs.min.js.map |
@@ -888,3 +888,3 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
resultArray.pop(); // remove previous | ||
} else if (current !== '') { | ||
} else if (current !== '' || index === pathSplit.length - 1) { | ||
resultArray.push(current); | ||
@@ -891,0 +891,0 @@ } |
@@ -6,3 +6,3 @@ var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var t=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(t,r){!function(e,n){var o={};e.PubSub=o;var i=e.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==t&&t.exports&&(r=t.exports=o),r.PubSub=o,t.exports=r=o)}("object"==typeof window&&window||e)})),r=(t.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const n=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(l)},o=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const i=e.shift();return{...t,[i]:o(e,d(t,i,n),r,c(i,n))}}if(Array.isArray(t)){const n=[...t];return n[f(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:d(t,e[0],n)},i=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||p(t)){const o=e.shift();i(e,d(t,o,n),r,c(o,n))}else{t[f(t,e[0])]=r}},a=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=d(t,n,r);return{...t,[n]:a(e,o,c(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return d(t,e[0],r)}},s=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=d(t,n,r);s(e,o,c(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:d(t,e[0],r)},c=r((e,t)=>t+"/"+u(e)),u=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),l=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),f=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,d=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(p(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[f(e,t)]},p=e=>null===e||"object"!=typeof e;var h={nil:"",append:c,get:(e,t)=>{const r=n(e),o=e=>r.reduce(([e,t],r)=>[d(e,r,t),c(r,t)],[e,""])[0];return void 0===t?o:o(t)},set:(e,t,i)=>{const a=n(e),s=r((e,t)=>o(a,e,t,""));return void 0===t?s:s(t,i)},assign:(e,t,o)=>{const a=n(e),s=r((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,o)},unset:(e,t)=>{const r=n(e),o=e=>a(r,e,"");return void 0===t?o:o(t)},delete:(e,t)=>{const r=n(e),o=e=>s(r,e,"");return void 0===t?o:o(t)}};var y={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:v}=y,b=Object.freeze({id:"",pointer:"",instance:void 0}),m=(e,t=b)=>Object.freeze({...t,pointer:v(e)[1]}),w=e=>h.get(e.pointer,e.instance),g=(e,t)=>{const r=h.append(e,t.pointer);return m("#"+encodeURI(r),t)},O=r((e,t)=>w(t).map((r,n)=>e(g(n,t),n))),E=r((e,t)=>w(t).map((e,r)=>g(r,t)).filter((t,r)=>e(t,r))),$=r((e,t,r)=>w(r).reduce((t,n,o)=>e(t,g(o,r),o),t)),x=r((e,t)=>Object.keys(w(t)).every((r,n)=>e(g(r,t),n))),P=r((e,t)=>Object.keys(w(t)).some((r,n)=>e(g(r,t),n)));var j={cons:(e,t="")=>Object.freeze({...b,id:t,instance:e}),get:m,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:w,step:g,entries:e=>Object.keys(w(e)).map(t=>[t,g(t,e)]),map:O,filter:E,reduce:$,every:x,some:P},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,S=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,I=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,V=/\\([\u000b\u0020-\u00ff])/g,T=/([\\"])/g,k=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
* MIT Licensed | ||
*/function R(e){var t=String(e);if(I.test(t))return t;if(t.length>0&&!S.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(T,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!k.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!I.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+R(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!k.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=A.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(V,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},C=async e=>Object.entries(await e),U=r(async(e,t)=>(await t).map(e)),q=r(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),z=r(async(e,t,r={})=>q(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),W=r(async(e,t)=>{const r=await U(e,t);return(await Promise.all(r)).some(e=>e)}),_=r(async(e,t)=>{const r=await U(e,t);return(await Promise.all(r)).every(e=>e)}),B=r((e,t)=>e.reduce(async(e,t)=>t(await e),t)),D={entries:C,map:U,filter:z,reduce:q,some:W,every:_,pipeline:B,all:e=>Promise.all(e),allValues:e=>B([C,q(async(e,[t,r])=>(e[t]=await r,e),{})],e)},F=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(N.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?Z(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+M(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=M(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:Z(e)}};function Z(e){return e+("/"===e[e.length-1]?"":"/")}function M(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,t)=>{"."!==e&&(".."===e?r.pop():""!==e&&r.push(e))}),"/"+r.join("/")}const N=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var J=fetch;const{isObject:G,splitUrl:H}=y,Q=Symbol("$__jref"),X={},Y={},ee=(e,t)=>{const r=e in Y?Y[e]:e;if(r in X)return X[r][t]},te={},re={},ne=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=H(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ee(n,"idToken"),i=H(t)[0];if(!i&&!H(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const a=se(i,e[o]||""),s=H(a)[0];i&&(re[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,ee(n,"vocabulary")&&G(e)&&"$vocabulary"in e?(Y[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};te[s]={id:s,schemaVersion:n,schema:oe(e,s,n,h.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},oe=(e,t,r,n,o)=>{if(G(e)){const i=ee(r,"idToken"),a=ee(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=se(t,n),[s,c]=H(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return ne(e,se(t,s),r),{[Q]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=oe(a,t,r,h.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>oe(e,t,r,h.append(i,n),o)):e},ie=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),ae=async(e,t=ie,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:le(t),o=se(n,e),[i,a]=H(o);if(!(e=>e in te||e in re)(i)){const e=await J(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}ne(await e.json(),i)}const s=(e=>te[re[e]]||te[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?ue(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=fe(c);return G(u)&&Q in u?ae(u[Q],c):ee(c.schemaVersion,"jsonReference")&&G(u)&&"string"==typeof u.$ref?ae(u.$ref,c):ee(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?ae(u,c):ee(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?ae(u,c,!0):c},se=(e,t)=>{const r=F(e,t),n=H(e)[0];if(n&&"file"===ce(r)&&"file"!==ce(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ce=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ue=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},le=e=>`${e.id}#${encodeURI(e.pointer)}`,fe=e=>h.get(e.pointer,e.schema),de=(e,t)=>{const r=h.append(e,t.pointer);return ae("#"+encodeURI(r),t)},pe=r((e,t)=>D.pipeline([fe,D.map(async(r,n)=>e(await de(n,t),n)),D.all],t));var he={setConfig:(e,t,r)=>{X[e]||(X[e]={}),X[e][t]=r},getConfig:ee,add:ne,get:ae,markValidated:e=>{te[e].validated=!0},uri:le,value:fe,has:(e,t)=>e in fe(t),step:de,entries:e=>D.pipeline([fe,Object.keys,D.map(async t=>[t,await de(t,e)]),D.all],e),map:pe};const ye="FLAG",ve="BASIC",be="DETAILED",me="VERBOSE";let we=be,ge=!0;const Oe=(e,r)=>(n,o=ye)=>{if(![ye,ve,be,me].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=t.subscribe("result",Ee(o,i));return Te(r,n,e),t.unsubscribe(a),i[0]},Ee=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&$e(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ve&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),xe(i))break}(e===me||e!==ye&&!i.valid)&&r.push(i),t[0]=i}},$e=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||xe(e)),xe=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),Pe={},je=e=>Pe[e],Ae=e=>e in Pe,Se={},Ie={},Ve=async(e,t)=>{if(!Ae(e.schemaVersion+"#validate")){const t=await he.get(e.schemaVersion);(he.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Se)Object.entries(Se[e]).forEach(([e,r])=>{((e,t)=>{Pe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(ge&&!e.validated){if(he.markValidated(e.id),!(e.schemaVersion in Ie)){const t=await he.get(e.schemaVersion),r={},n=await Ve(t,r);Ie[t.id]=Oe(r,n)}const t=j.cons(e.schema,e.id),r=Ie[e.schemaVersion](t,we);if(!r.valid)throw r}return await je(e.schemaVersion+"#validate").compile(e,t),he.uri(e)},Te=(e,t,r)=>{const[n]=r[e];return je(n).interpret(e,t,r)};var ke={validate:async(e,t,r)=>{const n={},o=await Ve(e,n),i=(e,t=ye)=>Oe(n,o)(j.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{we=e},setShouldMetaValidate:e=>{ge=e},FLAG:ye,BASIC:ve,DETAILED:be,VERBOSE:me,getKeyword:je,hasKeyword:Ae,defineVocabulary:(e,t)=>{Se[e]=t},compileSchema:Ve,interpretSchema:Te,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return je(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return je(o).collectEvaluatedItems(e,t,r,n)}};var Re={compile:async(e,t)=>{const r=he.uri(e);if(!(r in t)){t[r]=!1;const n=he.value(e);t[r]=[e.schemaVersion+"#validate",he.uri(e),"boolean"==typeof n?n:await D.pipeline([he.entries,D.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),D.filter(([t])=>ke.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),D.map(async([r,n])=>{const o=await ke.getKeyword(r).compile(n,t,e);return[r,he.uri(n),o]}),D.all],e)]}},interpret:(e,r,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=ke.getKeyword(e).interpret(i,r,n);return t.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:j.uri(r),valid:a}),a});return t.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:j.uri(r),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&ke.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&ke.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ke={Core:ke,Schema:he,Instance:j,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Re}},Le=Ke.Core,Ce=Ke.Schema,Ue=Ke.Instance,qe=Ke.Keywords;export default Ke;export{Le as Core,Ue as Instance,qe as Keywords,Ce as Schema}; | ||
*/function R(e){var t=String(e);if(I.test(t))return t;if(t.length>0&&!S.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(T,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!k.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!I.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+R(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!k.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=A.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(V,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},C=async e=>Object.entries(await e),U=r(async(e,t)=>(await t).map(e)),q=r(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),z=r(async(e,t,r={})=>q(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),W=r(async(e,t)=>{const r=await U(e,t);return(await Promise.all(r)).some(e=>e)}),_=r(async(e,t)=>{const r=await U(e,t);return(await Promise.all(r)).every(e=>e)}),B=r((e,t)=>e.reduce(async(e,t)=>t(await e),t)),D={entries:C,map:U,filter:z,reduce:q,some:W,every:_,pipeline:B,all:e=>Promise.all(e),allValues:e=>B([C,q(async(e,[t,r])=>(e[t]=await r,e),{})],e)},F=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(N.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?Z(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+M(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=M(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:Z(e)}};function Z(e){return e+("/"===e[e.length-1]?"":"/")}function M(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const N=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var J=fetch;const{isObject:G,splitUrl:H}=y,Q=Symbol("$__jref"),X={},Y={},ee=(e,t)=>{const r=e in Y?Y[e]:e;if(r in X)return X[r][t]},te={},re={},ne=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=H(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ee(n,"idToken"),i=H(t)[0];if(!i&&!H(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const a=se(i,e[o]||""),s=H(a)[0];i&&(re[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,ee(n,"vocabulary")&&G(e)&&"$vocabulary"in e?(Y[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};te[s]={id:s,schemaVersion:n,schema:oe(e,s,n,h.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},oe=(e,t,r,n,o)=>{if(G(e)){const i=ee(r,"idToken"),a=ee(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=se(t,n),[s,c]=H(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return ne(e,se(t,s),r),{[Q]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=oe(a,t,r,h.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>oe(e,t,r,h.append(i,n),o)):e},ie=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),ae=async(e,t=ie,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:le(t),o=se(n,e),[i,a]=H(o);if(!(e=>e in te||e in re)(i)){const e=await J(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}ne(await e.json(),i)}const s=(e=>te[re[e]]||te[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?ue(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=fe(c);return G(u)&&Q in u?ae(u[Q],c):ee(c.schemaVersion,"jsonReference")&&G(u)&&"string"==typeof u.$ref?ae(u.$ref,c):ee(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?ae(u,c):ee(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?ae(u,c,!0):c},se=(e,t)=>{const r=F(e,t),n=H(e)[0];if(n&&"file"===ce(r)&&"file"!==ce(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ce=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ue=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},le=e=>`${e.id}#${encodeURI(e.pointer)}`,fe=e=>h.get(e.pointer,e.schema),de=(e,t)=>{const r=h.append(e,t.pointer);return ae("#"+encodeURI(r),t)},pe=r((e,t)=>D.pipeline([fe,D.map(async(r,n)=>e(await de(n,t),n)),D.all],t));var he={setConfig:(e,t,r)=>{X[e]||(X[e]={}),X[e][t]=r},getConfig:ee,add:ne,get:ae,markValidated:e=>{te[e].validated=!0},uri:le,value:fe,has:(e,t)=>e in fe(t),step:de,entries:e=>D.pipeline([fe,Object.keys,D.map(async t=>[t,await de(t,e)]),D.all],e),map:pe};const ye="FLAG",ve="BASIC",be="DETAILED",me="VERBOSE";let we=be,ge=!0;const Oe=(e,r)=>(n,o=ye)=>{if(![ye,ve,be,me].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=t.subscribe("result",Ee(o,i));return Te(r,n,e),t.unsubscribe(a),i[0]},Ee=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&$e(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ve&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),xe(i))break}(e===me||e!==ye&&!i.valid)&&r.push(i),t[0]=i}},$e=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||xe(e)),xe=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),Pe={},je=e=>Pe[e],Ae=e=>e in Pe,Se={},Ie={},Ve=async(e,t)=>{if(!Ae(e.schemaVersion+"#validate")){const t=await he.get(e.schemaVersion);(he.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Se)Object.entries(Se[e]).forEach(([e,r])=>{((e,t)=>{Pe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(ge&&!e.validated){if(he.markValidated(e.id),!(e.schemaVersion in Ie)){const t=await he.get(e.schemaVersion),r={},n=await Ve(t,r);Ie[t.id]=Oe(r,n)}const t=j.cons(e.schema,e.id),r=Ie[e.schemaVersion](t,we);if(!r.valid)throw r}return await je(e.schemaVersion+"#validate").compile(e,t),he.uri(e)},Te=(e,t,r)=>{const[n]=r[e];return je(n).interpret(e,t,r)};var ke={validate:async(e,t,r)=>{const n={},o=await Ve(e,n),i=(e,t=ye)=>Oe(n,o)(j.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{we=e},setShouldMetaValidate:e=>{ge=e},FLAG:ye,BASIC:ve,DETAILED:be,VERBOSE:me,getKeyword:je,hasKeyword:Ae,defineVocabulary:(e,t)=>{Se[e]=t},compileSchema:Ve,interpretSchema:Te,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return je(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return je(o).collectEvaluatedItems(e,t,r,n)}};var Re={compile:async(e,t)=>{const r=he.uri(e);if(!(r in t)){t[r]=!1;const n=he.value(e);t[r]=[e.schemaVersion+"#validate",he.uri(e),"boolean"==typeof n?n:await D.pipeline([he.entries,D.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),D.filter(([t])=>ke.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),D.map(async([r,n])=>{const o=await ke.getKeyword(r).compile(n,t,e);return[r,he.uri(n),o]}),D.all],e)]}},interpret:(e,r,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=ke.getKeyword(e).interpret(i,r,n);return t.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:j.uri(r),valid:a}),a});return t.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:j.uri(r),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&ke.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&ke.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ke={Core:ke,Schema:he,Instance:j,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Re}},Le=Ke.Core,Ce=Ke.Schema,Ue=Ke.Instance,qe=Ke.Keywords;export default Ke;export{Le as Core,Ue as Instance,qe as Keywords,Ce as Schema}; | ||
//# sourceMappingURL=json-schema-core-esm.min.js.map |
@@ -891,3 +891,3 @@ var JSC = (function (exports) { | ||
resultArray.pop(); // remove previous | ||
} else if (current !== '') { | ||
} else if (current !== '' || index === pathSplit.length - 1) { | ||
resultArray.push(current); | ||
@@ -894,0 +894,0 @@ } |
@@ -6,3 +6,3 @@ var JSC=function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:b}=v,m=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=m)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return w("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),P=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),j=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),x=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var A={cons:(e,t="")=>Object.freeze({...m,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:P,every:j,some:x},S=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
* MIT Licensed | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=async e=>Object.entries(await e),q=n(async(e,t)=>(await t).map(e)),z=n(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),W=n(async(e,t,r={})=>z(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),_=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).some(e=>e)}),B=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).every(e=>e)}),D=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),F={entries:U,map:q,filter:W,reduce:z,some:_,every:B,pipeline:D,all:e=>Promise.all(e),allValues:e=>D([U,z(async(e,[t,r])=>(e[t]=await r,e),{})],e)},Z=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(N.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?J(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+M(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=M(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:J(e)}};function J(e){return e+("/"===e[e.length-1]?"":"/")}function M(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,t)=>{"."!==e&&(".."===e?r.pop():""!==e&&r.push(e))}),"/"+r.join("/")}const N=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var G=fetch;const{isObject:H,splitUrl:Q}=v,X=Symbol("$__jref"),Y={},ee={},te=(e,t)=>{const r=e in ee?ee[e]:e;if(r in Y)return Y[r][t]},re={},ne={},oe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=Q(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=te(n,"idToken"),i=Q(t)[0];if(!i&&!Q(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const a=ce(i,e[o]||""),s=Q(a)[0];i&&(ne[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,te(n,"vocabulary")&&H(e)&&"$vocabulary"in e?(ee[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};re[s]={id:s,schemaVersion:n,schema:ie(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},ie=(e,t,r,n,o)=>{if(H(e)){const i=te(r,"idToken"),a=te(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ce(t,n),[s,c]=Q(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return oe(e,ce(t,s),r),{[X]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=ie(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>ie(e,t,r,y.append(i,n),o)):e},ae=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),se=async(e,t=ae,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:fe(t),o=ce(n,e),[i,a]=Q(o);if(!(e=>e in re||e in ne)(i)){const e=await G(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}oe(await e.json(),i)}const s=(e=>re[ne[e]]||re[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?le(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=de(c);return H(u)&&X in u?se(u[X],c):te(c.schemaVersion,"jsonReference")&&H(u)&&"string"==typeof u.$ref?se(u.$ref,c):te(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?se(u,c):te(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?se(u,c,!0):c},ce=(e,t)=>{const r=Z(e,t),n=Q(e)[0];if(n&&"file"===ue(r)&&"file"!==ue(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ue=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},le=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},fe=e=>`${e.id}#${encodeURI(e.pointer)}`,de=e=>y.get(e.pointer,e.schema),pe=(e,t)=>{const r=y.append(e,t.pointer);return se("#"+encodeURI(r),t)},he=n((e,t)=>F.pipeline([de,F.map(async(r,n)=>e(await pe(n,t),n)),F.all],t));var ye={setConfig:(e,t,r)=>{Y[e]||(Y[e]={}),Y[e][t]=r},getConfig:te,add:oe,get:se,markValidated:e=>{re[e].validated=!0},uri:fe,value:de,has:(e,t)=>e in de(t),step:pe,entries:e=>F.pipeline([de,Object.keys,F.map(async t=>[t,await pe(t,e)]),F.all],e),map:he};const ve="FLAG",be="BASIC",me="DETAILED",we="VERBOSE";let ge=me,Oe=!0;const Ee=(e,t)=>(n,o=ve)=>{if(![ve,be,me,we].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",$e(o,i));return ke(t,n,e),r.unsubscribe(a),i[0]},$e=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&Pe(r[r.length-1],i);){const t=r.pop();let n=[];if(e===be&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),je(i))break}(e===we||e!==ve&&!i.valid)&&r.push(i),t[0]=i}},Pe=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||je(e)),je=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),xe={},Ae=e=>xe[e],Se=e=>e in xe,Ie={},Ve={},Te=async(e,t)=>{if(!Se(e.schemaVersion+"#validate")){const t=await ye.get(e.schemaVersion);(ye.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Ie)Object.entries(Ie[e]).forEach(([e,r])=>{((e,t)=>{xe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(Oe&&!e.validated){if(ye.markValidated(e.id),!(e.schemaVersion in Ve)){const t=await ye.get(e.schemaVersion),r={},n=await Te(t,r);Ve[t.id]=Ee(r,n)}const t=A.cons(e.schema,e.id),r=Ve[e.schemaVersion](t,ge);if(!r.valid)throw r}return await Ae(e.schemaVersion+"#validate").compile(e,t),ye.uri(e)},ke=(e,t,r)=>{const[n]=r[e];return Ae(n).interpret(e,t,r)};var Re={validate:async(e,t,r)=>{const n={},o=await Te(e,n),i=(e,t=ve)=>Ee(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{ge=e},setShouldMetaValidate:e=>{Oe=e},FLAG:ve,BASIC:be,DETAILED:me,VERBOSE:we,getKeyword:Ae,hasKeyword:Se,defineVocabulary:(e,t)=>{Ie[e]=t},compileSchema:Te,interpretSchema:ke,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Ae(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Ae(o).collectEvaluatedItems(e,t,r,n)}};var Ce={compile:async(e,t)=>{const r=ye.uri(e);if(!(r in t)){t[r]=!1;const n=ye.value(e);t[r]=[e.schemaVersion+"#validate",ye.uri(e),"boolean"==typeof n?n:await F.pipeline([ye.entries,F.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),F.filter(([t])=>Re.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),F.map(async([r,n])=>{const o=await Re.getKeyword(r).compile(n,t,e);return[r,ye.uri(n),o]}),F.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Re.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Re.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Re.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ke={Core:Re,Schema:ye,Instance:A,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Ce}},Le=Ke.Core,Ue=Ke.Schema,qe=Ke.Instance,ze=Ke.Keywords;return e.Core=Le,e.Instance=qe,e.Keywords=ze,e.Schema=Ue,e.default=Ke,e}({}); | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=async e=>Object.entries(await e),q=n(async(e,t)=>(await t).map(e)),z=n(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),W=n(async(e,t,r={})=>z(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),_=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).some(e=>e)}),B=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).every(e=>e)}),D=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),F={entries:U,map:q,filter:W,reduce:z,some:_,every:B,pipeline:D,all:e=>Promise.all(e),allValues:e=>D([U,z(async(e,[t,r])=>(e[t]=await r,e),{})],e)},Z=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(N.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?J(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+M(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=M(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:J(e)}};function J(e){return e+("/"===e[e.length-1]?"":"/")}function M(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const N=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var G=fetch;const{isObject:H,splitUrl:Q}=v,X=Symbol("$__jref"),Y={},ee={},te=(e,t)=>{const r=e in ee?ee[e]:e;if(r in Y)return Y[r][t]},re={},ne={},oe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=Q(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=te(n,"idToken"),i=Q(t)[0];if(!i&&!Q(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const a=ce(i,e[o]||""),s=Q(a)[0];i&&(ne[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,te(n,"vocabulary")&&H(e)&&"$vocabulary"in e?(ee[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};re[s]={id:s,schemaVersion:n,schema:ie(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},ie=(e,t,r,n,o)=>{if(H(e)){const i=te(r,"idToken"),a=te(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ce(t,n),[s,c]=Q(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return oe(e,ce(t,s),r),{[X]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=ie(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>ie(e,t,r,y.append(i,n),o)):e},ae=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),se=async(e,t=ae,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:fe(t),o=ce(n,e),[i,a]=Q(o);if(!(e=>e in re||e in ne)(i)){const e=await G(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}oe(await e.json(),i)}const s=(e=>re[ne[e]]||re[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?le(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=de(c);return H(u)&&X in u?se(u[X],c):te(c.schemaVersion,"jsonReference")&&H(u)&&"string"==typeof u.$ref?se(u.$ref,c):te(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?se(u,c):te(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?se(u,c,!0):c},ce=(e,t)=>{const r=Z(e,t),n=Q(e)[0];if(n&&"file"===ue(r)&&"file"!==ue(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ue=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},le=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},fe=e=>`${e.id}#${encodeURI(e.pointer)}`,de=e=>y.get(e.pointer,e.schema),pe=(e,t)=>{const r=y.append(e,t.pointer);return se("#"+encodeURI(r),t)},he=n((e,t)=>F.pipeline([de,F.map(async(r,n)=>e(await pe(n,t),n)),F.all],t));var ye={setConfig:(e,t,r)=>{Y[e]||(Y[e]={}),Y[e][t]=r},getConfig:te,add:oe,get:se,markValidated:e=>{re[e].validated=!0},uri:fe,value:de,has:(e,t)=>e in de(t),step:pe,entries:e=>F.pipeline([de,Object.keys,F.map(async t=>[t,await pe(t,e)]),F.all],e),map:he};const ve="FLAG",be="BASIC",me="DETAILED",we="VERBOSE";let ge=me,Oe=!0;const Ee=(e,t)=>(n,o=ve)=>{if(![ve,be,me,we].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",$e(o,i));return ke(t,n,e),r.unsubscribe(a),i[0]},$e=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&Pe(r[r.length-1],i);){const t=r.pop();let n=[];if(e===be&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),je(i))break}(e===we||e!==ve&&!i.valid)&&r.push(i),t[0]=i}},Pe=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||je(e)),je=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),xe={},Ae=e=>xe[e],Se=e=>e in xe,Ie={},Ve={},Te=async(e,t)=>{if(!Se(e.schemaVersion+"#validate")){const t=await ye.get(e.schemaVersion);(ye.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Ie)Object.entries(Ie[e]).forEach(([e,r])=>{((e,t)=>{xe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(Oe&&!e.validated){if(ye.markValidated(e.id),!(e.schemaVersion in Ve)){const t=await ye.get(e.schemaVersion),r={},n=await Te(t,r);Ve[t.id]=Ee(r,n)}const t=A.cons(e.schema,e.id),r=Ve[e.schemaVersion](t,ge);if(!r.valid)throw r}return await Ae(e.schemaVersion+"#validate").compile(e,t),ye.uri(e)},ke=(e,t,r)=>{const[n]=r[e];return Ae(n).interpret(e,t,r)};var Re={validate:async(e,t,r)=>{const n={},o=await Te(e,n),i=(e,t=ve)=>Ee(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{ge=e},setShouldMetaValidate:e=>{Oe=e},FLAG:ve,BASIC:be,DETAILED:me,VERBOSE:we,getKeyword:Ae,hasKeyword:Se,defineVocabulary:(e,t)=>{Ie[e]=t},compileSchema:Te,interpretSchema:ke,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Ae(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Ae(o).collectEvaluatedItems(e,t,r,n)}};var Ce={compile:async(e,t)=>{const r=ye.uri(e);if(!(r in t)){t[r]=!1;const n=ye.value(e);t[r]=[e.schemaVersion+"#validate",ye.uri(e),"boolean"==typeof n?n:await F.pipeline([ye.entries,F.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),F.filter(([t])=>Re.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),F.map(async([r,n])=>{const o=await Re.getKeyword(r).compile(n,t,e);return[r,ye.uri(n),o]}),F.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Re.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Re.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Re.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ke={Core:Re,Schema:ye,Instance:A,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Ce}},Le=Ke.Core,Ue=Ke.Schema,qe=Ke.Instance,ze=Ke.Keywords;return e.Core=Le,e.Instance=qe,e.Keywords=ze,e.Schema=Ue,e.default=Ke,e}({}); | ||
//# sourceMappingURL=json-schema-core-iife.min.js.map |
@@ -893,3 +893,3 @@ System.register('JSC', [], function (exports) { | ||
resultArray.pop(); // remove previous | ||
} else if (current !== '') { | ||
} else if (current !== '' || index === pathSplit.length - 1) { | ||
resultArray.push(current); | ||
@@ -896,0 +896,0 @@ } |
@@ -6,3 +6,3 @@ System.register("JSC",[],(function(e){"use strict";return{execute:function(){var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:b}=v,m=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=m)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return w("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),P=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),j=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),x=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var S={cons:(e,t="")=>Object.freeze({...m,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:P,every:j,some:x},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
* MIT Licensed | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=A.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=async e=>Object.entries(await e),q=n(async(e,t)=>(await t).map(e)),z=n(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),W=n(async(e,t,r={})=>z(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),_=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).some(e=>e)}),B=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).every(e=>e)}),D=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),F={entries:U,map:q,filter:W,reduce:z,some:_,every:B,pipeline:D,all:e=>Promise.all(e),allValues:e=>D([U,z(async(e,[t,r])=>(e[t]=await r,e),{})],e)},Z=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(N.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?J(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+M(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=M(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:J(e)}};function J(e){return e+("/"===e[e.length-1]?"":"/")}function M(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,t)=>{"."!==e&&(".."===e?r.pop():""!==e&&r.push(e))}),"/"+r.join("/")}const N=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var G=fetch;const{isObject:H,splitUrl:Q}=v,X=Symbol("$__jref"),Y={},ee={},te=(e,t)=>{const r=e in ee?ee[e]:e;if(r in Y)return Y[r][t]},re={},ne={},oe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=Q(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=te(n,"idToken"),i=Q(t)[0];if(!i&&!Q(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const a=ce(i,e[o]||""),s=Q(a)[0];i&&(ne[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,te(n,"vocabulary")&&H(e)&&"$vocabulary"in e?(ee[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};re[s]={id:s,schemaVersion:n,schema:ie(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},ie=(e,t,r,n,o)=>{if(H(e)){const i=te(r,"idToken"),a=te(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ce(t,n),[s,c]=Q(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return oe(e,ce(t,s),r),{[X]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=ie(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>ie(e,t,r,y.append(i,n),o)):e},ae=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),se=async(e,t=ae,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:fe(t),o=ce(n,e),[i,a]=Q(o);if(!(e=>e in re||e in ne)(i)){const e=await G(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}oe(await e.json(),i)}const s=(e=>re[ne[e]]||re[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?le(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=de(c);return H(u)&&X in u?se(u[X],c):te(c.schemaVersion,"jsonReference")&&H(u)&&"string"==typeof u.$ref?se(u.$ref,c):te(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?se(u,c):te(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?se(u,c,!0):c},ce=(e,t)=>{const r=Z(e,t),n=Q(e)[0];if(n&&"file"===ue(r)&&"file"!==ue(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ue=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},le=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},fe=e=>`${e.id}#${encodeURI(e.pointer)}`,de=e=>y.get(e.pointer,e.schema),pe=(e,t)=>{const r=y.append(e,t.pointer);return se("#"+encodeURI(r),t)},he=n((e,t)=>F.pipeline([de,F.map(async(r,n)=>e(await pe(n,t),n)),F.all],t));var ye={setConfig:(e,t,r)=>{Y[e]||(Y[e]={}),Y[e][t]=r},getConfig:te,add:oe,get:se,markValidated:e=>{re[e].validated=!0},uri:fe,value:de,has:(e,t)=>e in de(t),step:pe,entries:e=>F.pipeline([de,Object.keys,F.map(async t=>[t,await pe(t,e)]),F.all],e),map:he};const ve="FLAG",be="BASIC",me="DETAILED",we="VERBOSE";let ge=me,Oe=!0;const Ee=(e,t)=>(n,o=ve)=>{if(![ve,be,me,we].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",$e(o,i));return ke(t,n,e),r.unsubscribe(a),i[0]},$e=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&Pe(r[r.length-1],i);){const t=r.pop();let n=[];if(e===be&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),je(i))break}(e===we||e!==ve&&!i.valid)&&r.push(i),t[0]=i}},Pe=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||je(e)),je=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),xe={},Se=e=>xe[e],Ae=e=>e in xe,Ie={},Ve={},Te=async(e,t)=>{if(!Ae(e.schemaVersion+"#validate")){const t=await ye.get(e.schemaVersion);(ye.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Ie)Object.entries(Ie[e]).forEach(([e,r])=>{((e,t)=>{xe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(Oe&&!e.validated){if(ye.markValidated(e.id),!(e.schemaVersion in Ve)){const t=await ye.get(e.schemaVersion),r={},n=await Te(t,r);Ve[t.id]=Ee(r,n)}const t=S.cons(e.schema,e.id),r=Ve[e.schemaVersion](t,ge);if(!r.valid)throw r}return await Se(e.schemaVersion+"#validate").compile(e,t),ye.uri(e)},ke=(e,t,r)=>{const[n]=r[e];return Se(n).interpret(e,t,r)};var Re={validate:async(e,t,r)=>{const n={},o=await Te(e,n),i=(e,t=ve)=>Ee(n,o)(S.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{ge=e},setShouldMetaValidate:e=>{Oe=e},FLAG:ve,BASIC:be,DETAILED:me,VERBOSE:we,getKeyword:Se,hasKeyword:Ae,defineVocabulary:(e,t)=>{Ie[e]=t},compileSchema:Te,interpretSchema:ke,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Se(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Se(o).collectEvaluatedItems(e,t,r,n)}};var Ce={compile:async(e,t)=>{const r=ye.uri(e);if(!(r in t)){t[r]=!1;const n=ye.value(e);t[r]=[e.schemaVersion+"#validate",ye.uri(e),"boolean"==typeof n?n:await F.pipeline([ye.entries,F.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),F.filter(([t])=>Re.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),F.map(async([r,n])=>{const o=await Re.getKeyword(r).compile(n,t,e);return[r,ye.uri(n),o]}),F.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Re.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:S.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:S.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Re.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Re.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ke={Core:Re,Schema:ye,Instance:S,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Ce}};e("default",Ke);e("Core",Ke.Core),e("Schema",Ke.Schema),e("Instance",Ke.Instance),e("Keywords",Ke.Keywords)}}})); | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=A.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=async e=>Object.entries(await e),q=n(async(e,t)=>(await t).map(e)),z=n(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),W=n(async(e,t,r={})=>z(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),_=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).some(e=>e)}),B=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).every(e=>e)}),D=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),F={entries:U,map:q,filter:W,reduce:z,some:_,every:B,pipeline:D,all:e=>Promise.all(e),allValues:e=>D([U,z(async(e,[t,r])=>(e[t]=await r,e),{})],e)},Z=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(N.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?J(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+M(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=M(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:J(e)}};function J(e){return e+("/"===e[e.length-1]?"":"/")}function M(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const N=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var G=fetch;const{isObject:H,splitUrl:Q}=v,X=Symbol("$__jref"),Y={},ee={},te=(e,t)=>{const r=e in ee?ee[e]:e;if(r in Y)return Y[r][t]},re={},ne={},oe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=Q(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=te(n,"idToken"),i=Q(t)[0];if(!i&&!Q(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const a=ce(i,e[o]||""),s=Q(a)[0];i&&(ne[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,te(n,"vocabulary")&&H(e)&&"$vocabulary"in e?(ee[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};re[s]={id:s,schemaVersion:n,schema:ie(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},ie=(e,t,r,n,o)=>{if(H(e)){const i=te(r,"idToken"),a=te(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ce(t,n),[s,c]=Q(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return oe(e,ce(t,s),r),{[X]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=ie(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>ie(e,t,r,y.append(i,n),o)):e},ae=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),se=async(e,t=ae,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:fe(t),o=ce(n,e),[i,a]=Q(o);if(!(e=>e in re||e in ne)(i)){const e=await G(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}oe(await e.json(),i)}const s=(e=>re[ne[e]]||re[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?le(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=de(c);return H(u)&&X in u?se(u[X],c):te(c.schemaVersion,"jsonReference")&&H(u)&&"string"==typeof u.$ref?se(u.$ref,c):te(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?se(u,c):te(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?se(u,c,!0):c},ce=(e,t)=>{const r=Z(e,t),n=Q(e)[0];if(n&&"file"===ue(r)&&"file"!==ue(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ue=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},le=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},fe=e=>`${e.id}#${encodeURI(e.pointer)}`,de=e=>y.get(e.pointer,e.schema),pe=(e,t)=>{const r=y.append(e,t.pointer);return se("#"+encodeURI(r),t)},he=n((e,t)=>F.pipeline([de,F.map(async(r,n)=>e(await pe(n,t),n)),F.all],t));var ye={setConfig:(e,t,r)=>{Y[e]||(Y[e]={}),Y[e][t]=r},getConfig:te,add:oe,get:se,markValidated:e=>{re[e].validated=!0},uri:fe,value:de,has:(e,t)=>e in de(t),step:pe,entries:e=>F.pipeline([de,Object.keys,F.map(async t=>[t,await pe(t,e)]),F.all],e),map:he};const ve="FLAG",be="BASIC",me="DETAILED",we="VERBOSE";let ge=me,Oe=!0;const Ee=(e,t)=>(n,o=ve)=>{if(![ve,be,me,we].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",$e(o,i));return ke(t,n,e),r.unsubscribe(a),i[0]},$e=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&Pe(r[r.length-1],i);){const t=r.pop();let n=[];if(e===be&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),je(i))break}(e===we||e!==ve&&!i.valid)&&r.push(i),t[0]=i}},Pe=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||je(e)),je=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),xe={},Se=e=>xe[e],Ae=e=>e in xe,Ie={},Ve={},Te=async(e,t)=>{if(!Ae(e.schemaVersion+"#validate")){const t=await ye.get(e.schemaVersion);(ye.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Ie)Object.entries(Ie[e]).forEach(([e,r])=>{((e,t)=>{xe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(Oe&&!e.validated){if(ye.markValidated(e.id),!(e.schemaVersion in Ve)){const t=await ye.get(e.schemaVersion),r={},n=await Te(t,r);Ve[t.id]=Ee(r,n)}const t=S.cons(e.schema,e.id),r=Ve[e.schemaVersion](t,ge);if(!r.valid)throw r}return await Se(e.schemaVersion+"#validate").compile(e,t),ye.uri(e)},ke=(e,t,r)=>{const[n]=r[e];return Se(n).interpret(e,t,r)};var Re={validate:async(e,t,r)=>{const n={},o=await Te(e,n),i=(e,t=ve)=>Ee(n,o)(S.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{ge=e},setShouldMetaValidate:e=>{Oe=e},FLAG:ve,BASIC:be,DETAILED:me,VERBOSE:we,getKeyword:Se,hasKeyword:Ae,defineVocabulary:(e,t)=>{Ie[e]=t},compileSchema:Te,interpretSchema:ke,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Se(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Se(o).collectEvaluatedItems(e,t,r,n)}};var Ce={compile:async(e,t)=>{const r=ye.uri(e);if(!(r in t)){t[r]=!1;const n=ye.value(e);t[r]=[e.schemaVersion+"#validate",ye.uri(e),"boolean"==typeof n?n:await F.pipeline([ye.entries,F.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),F.filter(([t])=>Re.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),F.map(async([r,n])=>{const o=await Re.getKeyword(r).compile(n,t,e);return[r,ye.uri(n),o]}),F.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Re.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:S.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:S.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Re.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Re.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ke={Core:Re,Schema:ye,Instance:S,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Ce}};e("default",Ke);e("Core",Ke.Core),e("Schema",Ke.Schema),e("Instance",Ke.Instance),e("Keywords",Ke.Keywords)}}})); | ||
//# sourceMappingURL=json-schema-core-system.min.js.map |
@@ -894,3 +894,3 @@ (function (global, factory) { | ||
resultArray.pop(); // remove previous | ||
} else if (current !== '') { | ||
} else if (current !== '' || index === pathSplit.length - 1) { | ||
resultArray.push(current); | ||
@@ -897,0 +897,0 @@ } |
@@ -6,3 +6,3 @@ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).JSC={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:b}=v,m=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=m)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return w("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),j=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),x=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),P=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var A={cons:(e,t="")=>Object.freeze({...m,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:j,every:x,some:P},S=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
* MIT Licensed | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=async e=>Object.entries(await e),q=n(async(e,t)=>(await t).map(e)),z=n(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),W=n(async(e,t,r={})=>z(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),_=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).some(e=>e)}),B=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).every(e=>e)}),D=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),F={entries:U,map:q,filter:W,reduce:z,some:_,every:B,pipeline:D,all:e=>Promise.all(e),allValues:e=>D([U,z(async(e,[t,r])=>(e[t]=await r,e),{})],e)},M=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(N.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?Z(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+J(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=J(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:Z(e)}};function Z(e){return e+("/"===e[e.length-1]?"":"/")}function J(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,t)=>{"."!==e&&(".."===e?r.pop():""!==e&&r.push(e))}),"/"+r.join("/")}const N=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var G=fetch;const{isObject:H,splitUrl:Q}=v,X=Symbol("$__jref"),Y={},ee={},te=(e,t)=>{const r=e in ee?ee[e]:e;if(r in Y)return Y[r][t]},re={},ne={},oe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=Q(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=te(n,"idToken"),i=Q(t)[0];if(!i&&!Q(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const a=ce(i,e[o]||""),s=Q(a)[0];i&&(ne[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,te(n,"vocabulary")&&H(e)&&"$vocabulary"in e?(ee[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};re[s]={id:s,schemaVersion:n,schema:ie(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},ie=(e,t,r,n,o)=>{if(H(e)){const i=te(r,"idToken"),a=te(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ce(t,n),[s,c]=Q(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return oe(e,ce(t,s),r),{[X]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=ie(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>ie(e,t,r,y.append(i,n),o)):e},ae=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),se=async(e,t=ae,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:fe(t),o=ce(n,e),[i,a]=Q(o);if(!(e=>e in re||e in ne)(i)){const e=await G(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}oe(await e.json(),i)}const s=(e=>re[ne[e]]||re[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?le(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=de(c);return H(u)&&X in u?se(u[X],c):te(c.schemaVersion,"jsonReference")&&H(u)&&"string"==typeof u.$ref?se(u.$ref,c):te(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?se(u,c):te(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?se(u,c,!0):c},ce=(e,t)=>{const r=M(e,t),n=Q(e)[0];if(n&&"file"===ue(r)&&"file"!==ue(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ue=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},le=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},fe=e=>`${e.id}#${encodeURI(e.pointer)}`,de=e=>y.get(e.pointer,e.schema),pe=(e,t)=>{const r=y.append(e,t.pointer);return se("#"+encodeURI(r),t)},he=n((e,t)=>F.pipeline([de,F.map(async(r,n)=>e(await pe(n,t),n)),F.all],t));var ye={setConfig:(e,t,r)=>{Y[e]||(Y[e]={}),Y[e][t]=r},getConfig:te,add:oe,get:se,markValidated:e=>{re[e].validated=!0},uri:fe,value:de,has:(e,t)=>e in de(t),step:pe,entries:e=>F.pipeline([de,Object.keys,F.map(async t=>[t,await pe(t,e)]),F.all],e),map:he};const ve="FLAG",be="BASIC",me="DETAILED",we="VERBOSE";let ge=me,Oe=!0;const Ee=(e,t)=>(n,o=ve)=>{if(![ve,be,me,we].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",$e(o,i));return ke(t,n,e),r.unsubscribe(a),i[0]},$e=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&je(r[r.length-1],i);){const t=r.pop();let n=[];if(e===be&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),xe(i))break}(e===we||e!==ve&&!i.valid)&&r.push(i),t[0]=i}},je=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||xe(e)),xe=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),Pe={},Ae=e=>Pe[e],Se=e=>e in Pe,Ie={},Ve={},Te=async(e,t)=>{if(!Se(e.schemaVersion+"#validate")){const t=await ye.get(e.schemaVersion);(ye.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Ie)Object.entries(Ie[e]).forEach(([e,r])=>{((e,t)=>{Pe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(Oe&&!e.validated){if(ye.markValidated(e.id),!(e.schemaVersion in Ve)){const t=await ye.get(e.schemaVersion),r={},n=await Te(t,r);Ve[t.id]=Ee(r,n)}const t=A.cons(e.schema,e.id),r=Ve[e.schemaVersion](t,ge);if(!r.valid)throw r}return await Ae(e.schemaVersion+"#validate").compile(e,t),ye.uri(e)},ke=(e,t,r)=>{const[n]=r[e];return Ae(n).interpret(e,t,r)};var Re={validate:async(e,t,r)=>{const n={},o=await Te(e,n),i=(e,t=ve)=>Ee(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{ge=e},setShouldMetaValidate:e=>{Oe=e},FLAG:ve,BASIC:be,DETAILED:me,VERBOSE:we,getKeyword:Ae,hasKeyword:Se,defineVocabulary:(e,t)=>{Ie[e]=t},compileSchema:Te,interpretSchema:ke,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Ae(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Ae(o).collectEvaluatedItems(e,t,r,n)}};var Ce={compile:async(e,t)=>{const r=ye.uri(e);if(!(r in t)){t[r]=!1;const n=ye.value(e);t[r]=[e.schemaVersion+"#validate",ye.uri(e),"boolean"==typeof n?n:await F.pipeline([ye.entries,F.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),F.filter(([t])=>Re.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),F.map(async([r,n])=>{const o=await Re.getKeyword(r).compile(n,t,e);return[r,ye.uri(n),o]}),F.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Re.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Re.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Re.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ke={Core:Re,Schema:ye,Instance:A,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Ce}},Le=Ke.Core,Ue=Ke.Schema,qe=Ke.Instance,ze=Ke.Keywords;e.Core=Le,e.Instance=qe,e.Keywords=ze,e.Schema=Ue,e.default=Ke,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=async e=>Object.entries(await e),q=n(async(e,t)=>(await t).map(e)),z=n(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),W=n(async(e,t,r={})=>z(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),_=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).some(e=>e)}),B=n(async(e,t)=>{const r=await q(e,t);return(await Promise.all(r)).every(e=>e)}),D=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),F={entries:U,map:q,filter:W,reduce:z,some:_,every:B,pipeline:D,all:e=>Promise.all(e),allValues:e=>D([U,z(async(e,[t,r])=>(e[t]=await r,e),{})],e)},M=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(N.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?Z(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+J(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=J(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:Z(e)}};function Z(e){return e+("/"===e[e.length-1]?"":"/")}function J(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const N=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var G=fetch;const{isObject:H,splitUrl:Q}=v,X=Symbol("$__jref"),Y={},ee={},te=(e,t)=>{const r=e in ee?ee[e]:e;if(r in Y)return Y[r][t]},re={},ne={},oe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=Q(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=te(n,"idToken"),i=Q(t)[0];if(!i&&!Q(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const a=ce(i,e[o]||""),s=Q(a)[0];i&&(ne[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,te(n,"vocabulary")&&H(e)&&"$vocabulary"in e?(ee[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};re[s]={id:s,schemaVersion:n,schema:ie(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},ie=(e,t,r,n,o)=>{if(H(e)){const i=te(r,"idToken"),a=te(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ce(t,n),[s,c]=Q(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return oe(e,ce(t,s),r),{[X]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=ie(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>ie(e,t,r,y.append(i,n),o)):e},ae=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),se=async(e,t=ae,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:fe(t),o=ce(n,e),[i,a]=Q(o);if(!(e=>e in re||e in ne)(i)){const e=await G(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}oe(await e.json(),i)}const s=(e=>re[ne[e]]||re[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?le(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=de(c);return H(u)&&X in u?se(u[X],c):te(c.schemaVersion,"jsonReference")&&H(u)&&"string"==typeof u.$ref?se(u.$ref,c):te(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?se(u,c):te(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?se(u,c,!0):c},ce=(e,t)=>{const r=M(e,t),n=Q(e)[0];if(n&&"file"===ue(r)&&"file"!==ue(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ue=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},le=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},fe=e=>`${e.id}#${encodeURI(e.pointer)}`,de=e=>y.get(e.pointer,e.schema),pe=(e,t)=>{const r=y.append(e,t.pointer);return se("#"+encodeURI(r),t)},he=n((e,t)=>F.pipeline([de,F.map(async(r,n)=>e(await pe(n,t),n)),F.all],t));var ye={setConfig:(e,t,r)=>{Y[e]||(Y[e]={}),Y[e][t]=r},getConfig:te,add:oe,get:se,markValidated:e=>{re[e].validated=!0},uri:fe,value:de,has:(e,t)=>e in de(t),step:pe,entries:e=>F.pipeline([de,Object.keys,F.map(async t=>[t,await pe(t,e)]),F.all],e),map:he};const ve="FLAG",be="BASIC",me="DETAILED",we="VERBOSE";let ge=me,Oe=!0;const Ee=(e,t)=>(n,o=ve)=>{if(![ve,be,me,we].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",$e(o,i));return ke(t,n,e),r.unsubscribe(a),i[0]},$e=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&je(r[r.length-1],i);){const t=r.pop();let n=[];if(e===be&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),xe(i))break}(e===we||e!==ve&&!i.valid)&&r.push(i),t[0]=i}},je=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||xe(e)),xe=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),Pe={},Ae=e=>Pe[e],Se=e=>e in Pe,Ie={},Ve={},Te=async(e,t)=>{if(!Se(e.schemaVersion+"#validate")){const t=await ye.get(e.schemaVersion);(ye.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Ie)Object.entries(Ie[e]).forEach(([e,r])=>{((e,t)=>{Pe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(Oe&&!e.validated){if(ye.markValidated(e.id),!(e.schemaVersion in Ve)){const t=await ye.get(e.schemaVersion),r={},n=await Te(t,r);Ve[t.id]=Ee(r,n)}const t=A.cons(e.schema,e.id),r=Ve[e.schemaVersion](t,ge);if(!r.valid)throw r}return await Ae(e.schemaVersion+"#validate").compile(e,t),ye.uri(e)},ke=(e,t,r)=>{const[n]=r[e];return Ae(n).interpret(e,t,r)};var Re={validate:async(e,t,r)=>{const n={},o=await Te(e,n),i=(e,t=ve)=>Ee(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{ge=e},setShouldMetaValidate:e=>{Oe=e},FLAG:ve,BASIC:be,DETAILED:me,VERBOSE:we,getKeyword:Ae,hasKeyword:Se,defineVocabulary:(e,t)=>{Ie[e]=t},compileSchema:Te,interpretSchema:ke,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Ae(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Ae(o).collectEvaluatedItems(e,t,r,n)}};var Ce={compile:async(e,t)=>{const r=ye.uri(e);if(!(r in t)){t[r]=!1;const n=ye.value(e);t[r]=[e.schemaVersion+"#validate",ye.uri(e),"boolean"==typeof n?n:await F.pipeline([ye.entries,F.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),F.filter(([t])=>Re.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),F.map(async([r,n])=>{const o=await Re.getKeyword(r).compile(n,t,e);return[r,ye.uri(n),o]}),F.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Re.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Re.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Re.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ke={Core:Re,Schema:ye,Instance:A,Keywords:{metaData:{compile:()=>{},interpret:()=>!0},validate:Ce}},Le=Ke.Core,Ue=Ke.Schema,qe=Ke.Instance,ze=Ke.Keywords;e.Core=Le,e.Instance=qe,e.Keywords=ze,e.Schema=Ue,e.default=Ke,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-umd.min.js.map |
@@ -30,3 +30,3 @@ 'use strict'; | ||
resultArray.pop(); // remove previous | ||
} else if (current !== '') { | ||
} else if (current !== '' || index === pathSplit.length - 1) { | ||
resultArray.push(current); | ||
@@ -33,0 +33,0 @@ } |
{ | ||
"name": "@hyperjump/json-schema-core", | ||
"version": "0.10.1", | ||
"version": "0.10.2", | ||
"description": "A framework for building JSON Schema tools", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1491831