@ulb-darmstadt/shacl-form 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{mode-BriAnl-6.js → mode-C0O1k7Tm.js} +1 -1
- package/dist/assets/{mode-f6xgDLiM.js → mode-KFvmvNiB.js} +1 -1
- package/dist/assets/{query-CpoZo0uf.js → query-igazZxn_.js} +4 -4
- package/dist/assets/{query-DLp_5-vp.js → query-rxkbsWqy.js} +2 -2
- package/dist/bundle.js +3 -3
- package/dist/index.js +2 -3
- package/dist/sparql.js +7 -7
- package/package.json +7 -3
|
@@ -23,7 +23,7 @@ while ${o.value} and ${u} where found.`);this.validateNcname(o.value),u=`#`+o.va
|
|
|
23
23
|
while ${o.value} and ${u} where found.`);this.validateNcname(o.value),u=o.value,f=!0;continue;case`bagID`:throw this.newParseError(`rdf:bagID is not supported.`);case`type`:p=o.value;continue;case`aboutEach`:throw this.newParseError(`rdf:aboutEach is not supported.`);case`aboutEachPrefix`:throw this.newParseError(`rdf:aboutEachPrefix is not supported.`);case`li`:throw this.newParseError(`rdf:li on node elements are not supported.`)}else if(o.uri===e.XML){if(o.local===`lang`){r.language=o.value===``?null:o.value.toLowerCase();continue}else if(o.local===`base`){r.baseIRI=(0,t.resolve)(o.value,r.baseIRI);continue}}else if(o.uri===e.ITS&&o.local===`dir`){this.setDirection(r,o.value);continue}o.prefix!==`xml`&&o.prefix!==`xmlns`&&(o.prefix!==``||o.local!==`xmlns`)&&o.uri&&(s.push(this.uriToNamedNode(o.uri+o.local)),l.push(o.value))}if(u!==null&&(r.subject=f?this.dataFactory.blankNode(u):this.valueToUri(u,r),d&&this.claimNodeId(r.subject)),r.subject||=this.dataFactory.blankNode(),o){let t=this.uriToNamedNode(n.uri+n.local);this.emitTriple(r.subject,this.dataFactory.namedNode(e.RDF+`type`),t,i?i.reifiedStatementId:null,r.childrenTripleTerms,r.reifier)}if(i){if(i.predicate)if(i.childrenCollectionSubject){let t=this.dataFactory.blankNode(),n=this.dataFactory.namedNode(e.RDF+`rest`),a=i.childrenCollectionPredicate.equals(n);this.emitTriple(i.childrenCollectionSubject,i.childrenCollectionPredicate,t,a?null:i.reifiedStatementId,i.childrenTripleTerms,a?null:i.reifier),this.emitTriple(t,this.dataFactory.namedNode(e.RDF+`first`),r.subject,null,r.childrenTripleTerms),i.childrenCollectionSubject=t,i.childrenCollectionPredicate=n}else{i.childrenTagsToTripleTerms||(this.emitTriple(i.subject,i.predicate,r.subject,i.reifiedStatementId,i.childrenTripleTerms,i.reifier),i.predicateEmitted=!0);for(let e=0;e<i.predicateSubPredicates.length;e++)this.emitTriple(r.subject,i.predicateSubPredicates[e],i.predicateSubObjects[e],null,i.childrenTripleTerms,i.reifier);i.predicateSubPredicates=[],i.predicateSubObjects=[]}for(let e=0;e<s.length;e++){let t=this.createLiteral(l[e],r);this.emitTriple(r.subject,s[e],t,i.reifiedStatementId,i.childrenTripleTerms,i.reifier)}p&&this.emitTriple(r.subject,this.dataFactory.namedNode(e.RDF+`type`),this.uriToNamedNode(p),null,r.childrenTripleTerms,r.reifier)}}onTagProperty(t,n,r){if(n.childrenParseType=c.RESOURCE,n.subject=r.subject,t.uri===e.RDF&&t.local===`li`?(r.listItemCounter||=1,n.predicate=this.uriToNamedNode(t.uri+`_`+r.listItemCounter++)):n.predicate=this.uriToNamedNode(t.uri+t.local),t.uri===e.RDF&&e.FORBIDDEN_PROPERTY_ELEMENTS.indexOf(t.local)>=0)throw this.newParseError(`Illegal property element name: ${t.local}`);n.predicateSubPredicates=[],n.predicateSubObjects=[];let i=!1,a=!1,o=null,s=!0,l=[],u=[];for(let r in t.attributes){let d=t.attributes[r];if(d.uri===e.RDF&&d.local===`version`){this.setVersion(n,d.value);continue}else if(d.uri===e.RDF)switch(d.local){case`resource`:if(o)throw this.newParseError(`Found both rdf:resource (${d.value}) and rdf:nodeID (${o}).`);if(i)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${d.value})`);n.hadChildren=!0,o=d.value,s=!1;continue;case`datatype`:if(a)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${d.value}).`);if(i)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${d.value})`);n.datatype=this.valueToUri(d.value,n);continue;case`nodeID`:if(a)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${d.value}).`);if(n.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${d.value}).`);if(i)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${d.value})`);this.validateNcname(d.value),n.hadChildren=!0,o=d.value,s=!0;continue;case`bagID`:throw this.newParseError(`rdf:bagID is not supported.`);case`parseType`:if(a)throw this.newParseError(`rdf:parseType is not allowed when non-rdf:* property attributes are present`);if(n.datatype)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${n.datatype.value})`);if(o)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID or rdf:resource (${o})`);if(d.value===`Resource`){i=!0,n.childrenParseType=c.PROPERTY;let e=this.dataFactory.blankNode();this.emitTriple(n.subject,n.predicate,e,n.reifiedStatementId,n.childrenTripleTerms,n.reifier),n.subject=e,n.predicate=null}else d.value===`Collection`?(i=!0,n.hadChildren=!0,n.childrenCollectionSubject=n.subject,n.childrenCollectionPredicate=n.predicate,s=!1):d.value===`Literal`?(i=!0,n.childrenTagsToString=!0,n.childrenStringTags=[]):d.value===`Triple`&&(i=!0,n.childrenTagsToTripleTerms=!0,n.childrenTripleTerms=[]);continue;case`ID`:this.validateNcname(d.value),n.reifiedStatementId=this.valueToUri(`#`+d.value,n),this.claimNodeId(n.reifiedStatementId);continue;case`annotation`:n.reifier=this.dataFactory.namedNode(d.value);continue;case`annotationNodeID`:n.reifier=this.dataFactory.blankNode(d.value);continue}else if(d.uri===e.XML&&d.local===`lang`){n.language=d.value===``?null:d.value.toLowerCase();continue}else if(d.uri===e.ITS&&d.local===`dir`){this.setDirection(n,d.value);continue}else if(d.uri===e.ITS&&d.local===`version`)continue;if(d.prefix!==`xml`&&d.prefix!==`xmlns`&&(d.prefix!==``||d.local!==`xmlns`)&&d.uri){if(i||n.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${d.value}`);n.hadChildren=!0,a=!0,l.push(this.uriToNamedNode(d.uri+d.local)),u.push(this.createLiteral(d.value,n))}}if(o!==null){let e=n.subject;n.subject=s?this.dataFactory.blankNode(o):this.valueToUri(o,n),this.emitTriple(e,n.predicate,n.subject,n.reifiedStatementId,n.childrenTripleTerms,n.reifier);for(let e=0;e<l.length;e++)this.emitTriple(n.subject,l[e],u[e],null,n.childrenTripleTerms,n.reifier);n.predicateEmitted=!0}else s&&(n.predicateSubPredicates=l,n.predicateSubObjects=u,n.predicateEmitted=!1)}emitTriple(t,n,r,i,a,o){let s=this.dataFactory.quad(t,n,r,this.defaultGraph);a?a.push(s):this.push(s),o&&this.push(this.dataFactory.quad(o,this.dataFactory.namedNode(e.RDF+`reifies`),s)),i&&(this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`type`),this.dataFactory.namedNode(e.RDF+`Statement`),this.defaultGraph)),this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`subject`),t,this.defaultGraph)),this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`predicate`),n,this.defaultGraph)),this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`object`),r,this.defaultGraph)))}claimNodeId(e){if(!this.allowDuplicateRdfIds){if(this.nodeIds[e.value])throw this.newParseError(`Found multiple occurrences of rdf:ID='${e.value}'.`);this.nodeIds[e.value]=!0}}onText(e){let t=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;t&&(t.childrenStringTags?t.childrenStringTags.push(e):t.predicate&&(t.text=e))}onCloseTag(){let t=this.activeTagStack.pop(),n=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;if(t.childrenStringEmitClosingTag&&t.childrenStringTags.push(t.childrenStringEmitClosingTag),t.childrenTagsToString&&(t.datatype=this.dataFactory.namedNode(e.RDF+`XMLLiteral`),t.text=t.childrenStringTags.join(``),t.hadChildren=!1),t.childrenTagsToTripleTerms&&t.predicate&&t.rdfVersion){if(t.childrenTripleTerms.length!==1)throw this.newParseError(`Expected exactly one triple term in rdf:parseType="Triple" but got ${t.childrenTripleTerms.length}`);for(let e of t.childrenTripleTerms)this.emitTriple(t.subject,t.predicate,e,null,n.childrenTripleTerms,n.reifier);t.predicateEmitted=!0}if(t.childrenCollectionSubject)this.emitTriple(t.childrenCollectionSubject,t.childrenCollectionPredicate,this.dataFactory.namedNode(e.RDF+`nil`),null,t.childrenTripleTerms);else if(t.predicate){if(!t.hadChildren&&t.childrenParseType!==c.PROPERTY)this.emitTriple(t.subject,t.predicate,this.createLiteral(t.text||``,t),t.reifiedStatementId,t.childrenTripleTerms,t.reifier);else if(!t.predicateEmitted){let e=this.dataFactory.blankNode();this.emitTriple(t.subject,t.predicate,e,t.reifiedStatementId,t.childrenTripleTerms,t.reifier);for(let n=0;n<t.predicateSubPredicates.length;n++)this.emitTriple(e,t.predicateSubPredicates[n],t.predicateSubObjects[n],null,t.childrenTripleTerms)}}}onDoctype(e){e.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(e,t,n)=>(this.saxParser.ENTITIES[t]=n,``))}setDirection(e,t){if(t){if(t!==`ltr`&&t!==`rtl`)throw this.newParseError(`Base directions must either be 'ltr' or 'rtl', while '${t}' was found.`);e.direction=t}else delete e.direction}setVersion(e,t){if(e.rdfVersion=t,this.emit(`version`,t),!this.isValidVersion(t))throw this.newParseError(`Detected unsupported version: ${t}`)}};e.RdfXmlParser=s,s.MIME_TYPE=`application/rdf+xml`,s.RDF=`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,s.XML=`http://www.w3.org/XML/1998/namespace`,s.ITS=`http://www.w3.org/2005/11/its`,s.FORBIDDEN_NODE_ELEMENTS=[`RDF`,`ID`,`about`,`bagID`,`parseType`,`resource`,`nodeID`,`li`,`aboutEach`,`aboutEachPrefix`],s.FORBIDDEN_PROPERTY_ELEMENTS=[`Description`,`RDF`,`ID`,`about`,`bagID`,`parseType`,`resource`,`nodeID`,`aboutEach`,`aboutEachPrefix`],s.NCNAME_MATCHER=/^([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_])([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_\-.0-9#xB7\u{0300}-\u{036F}\u{203F}-\u{2040}])*$/u,s.SUPPORTED_VERSIONS=[`1.2`,`1.2-basic`,`1.1`];var c;(function(e){e[e.RESOURCE=0]=`RESOURCE`,e[e.PROPERTY=1]=`PROPERTY`})(c||(e.ParseType=c={}))})),yn=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(vn(),e)})),bn=o(((e,t)=>{t.exports=class e{constructor(e,t=new Map,n=0){this.prefix=e,this._existing=t,this.counter=n}clone(){let{prefix:t,_existing:n,counter:r}=this;return new e(t,new Map(n),r)}getId(e){let t=e&&this._existing.get(e);if(t)return t;let n=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,n),n}hasId(e){return this._existing.has(e)}getOldIds(){return[...this._existing.keys()]}}})),xn=o((()=>{(function(e,t){if(e.setImmediate)return;var n=1,r={},i=!1,a=e.document,o;function s(e){typeof e!=`function`&&(e=Function(``+e));for(var t=Array(arguments.length-1),i=0;i<t.length;i++)t[i]=arguments[i+1];return r[n]={callback:e,args:t},o(n),n++}function c(e){delete r[e]}function l(e){var n=e.callback,r=e.args;switch(r.length){case 0:n();break;case 1:n(r[0]);break;case 2:n(r[0],r[1]);break;case 3:n(r[0],r[1],r[2]);break;default:n.apply(t,r);break}}function u(e){if(i)setTimeout(u,0,e);else{var t=r[e];if(t){i=!0;try{l(t)}finally{c(e),i=!1}}}}function d(){o=function(e){process.nextTick(function(){u(e)})}}function f(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage(``,`*`),e.onmessage=n,t}}function p(){var t=`setImmediate$`+Math.random()+`$`,n=function(n){n.source===e&&typeof n.data==`string`&&n.data.indexOf(t)===0&&u(+n.data.slice(t.length))};e.addEventListener?e.addEventListener(`message`,n,!1):e.attachEvent(`onmessage`,n),o=function(n){e.postMessage(t+n,`*`)}}function m(){var e=new MessageChannel;e.port1.onmessage=function(e){var t=e.data;u(t)},o=function(t){e.port2.postMessage(t)}}function h(){var e=a.documentElement;o=function(t){var n=a.createElement(`script`);n.onreadystatechange=function(){u(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}function g(){o=function(e){setTimeout(u,0,e)}}var _=Object.getPrototypeOf&&Object.getPrototypeOf(e);_=_&&_.setTimeout?_:e,{}.toString.call(e.process)===`[object process]`?d():f()?p():e.MessageChannel?m():a&&`onreadystatechange`in a.createElement(`script`)?h():g(),_.setImmediate=s,_.clearImmediate=c})(typeof self>`u`?typeof global>`u`?void 0:global:self)})),Sn=o((e=>{xn(),e.setImmediate=setImmediate,e.crypto=globalThis.crypto;var t=[];for(let e=0;e<=255;++e)t.push(e.toString(16).padStart(2,`0`));e.bufferToHex=function(e){let n=``,r=new Uint8Array(e);for(let e=0;e<r.length;++e)n+=t[r[e]];return n}})),Cn=o(((e,t)=>{var{bufferToHex:n,crypto:r}=Sn(),i=new Map([[`sha256`,`SHA-256`],[`SHA256`,`SHA-256`],[`SHA-256`,`SHA-256`],[`sha384`,`SHA-384`],[`SHA384`,`SHA-384`],[`SHA-384`,`SHA-384`],[`sha512`,`SHA-512`],[`SHA512`,`SHA-512`],[`SHA-512`,`SHA-512`]]);t.exports=class{constructor(e){if(!(r&&r.subtle))throw Error(`crypto.subtle not found.`);if(!i.has(e))throw Error(`Unsupported algorithm "${e}".`);this.algorithm=i.get(e),this._content=``}update(e){this._content+=e}async digest(){let e=new TextEncoder().encode(this._content);return n(await r.subtle.digest(this.algorithm,e))}}})),wn=o(((e,t)=>{t.exports=class{constructor(e){this.current=e.sort(),this.done=!1,this.dir=new Map;for(let t=0;t<e.length;++t)this.dir.set(e[t],!0)}hasNext(){return!this.done}next(){let{current:e,dir:t}=this,n=e.slice(),r=null,i=0,a=e.length;for(let n=0;n<a;++n){let o=e[n],s=t.get(o);(r===null||o>r)&&(s&&n>0&&o>e[n-1]||!s&&n<a-1&&o>e[n+1])&&(r=o,i=n)}if(r===null)this.done=!0;else{let n=t.get(r)?i-1:i+1;e[i]=e[n],e[n]=r;for(let n of e)n>r&&t.set(n,!t.get(n))}return n}}})),Tn=o(((e,t)=>{var n=`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`,r=`http://www.w3.org/2001/XMLSchema#string`,i=`NamedNode`,a=`BlankNode`,o=`Literal`,s={};s.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,s.empty=RegExp(`^[ \\t]*$`),s.quad=RegExp('^[ \\t]*(?:(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)|_:((?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]+(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)[ \\t]+(?:(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)|_:((?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?)|(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?:(?:\\^\\^(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>))|(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)))?))[ \\t]*(?:\\.|(?:(?:(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)|_:((?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]*\\.))[ \\t]*$'),t.exports=class e{static parse(e){let t=[],l={},u=e.split(s.eoln),d=0;for(let e of u){if(d++,s.empty.test(e))continue;let u=e.match(s.quad);if(u===null)throw Error(`N-Quads parse error on line `+d+`.`);let f={subject:null,predicate:null,object:null,graph:null};if(u[1]===void 0?f.subject={termType:a,value:u[2]}:f.subject={termType:i,value:v(u[1])},f.predicate={termType:i,value:v(u[3])},u[4]===void 0?u[5]===void 0?(f.object={termType:o,value:void 0,datatype:{termType:i}},u[7]===void 0?u[8]===void 0?f.object.datatype.value=r:(f.object.datatype.value=n,f.object.language=u[8]):f.object.datatype.value=v(u[7]),f.object.value=p(u[6])):f.object={termType:a,value:u[5]}:f.object={termType:i,value:v(u[4])},u[9]===void 0?u[10]===void 0?f.graph={termType:`DefaultGraph`,value:``}:f.graph={termType:a,value:u[10]}:f.graph={termType:i,value:v(u[9])},!(f.graph.value in l))l[f.graph.value]=[f],t.push(f);else{let e=!0,n=l[f.graph.value];for(let t of n)if(c(t,f)){e=!1;break}e&&(n.push(f),t.push(f))}}return t}static serialize(t){let n=[];for(let r of t)n.push(e.serializeQuad(r));return n.sort().join(``)}static serializeQuadComponents(e,t,o,s){let c=``;return e.termType===i?c+=`<${g(e.value)}>`:c+=`_:${e.value}`,t.termType===i?c+=` <${g(t.value)}> `:c+=` _:${t.value} `,o.termType===i?c+=`<${g(o.value)}>`:o.termType===a?c+=`_:${o.value}`:(c+=`"${d(o.value)}"`,o.datatype.value===n?o.language&&(c+=`@${o.language}`):o.datatype.value!==r&&(c+=`^^<${g(o.datatype.value)}>`)),s.termType===i?c+=` <${g(s.value)}>`:s.termType===a&&(c+=` _:${s.value}`),c+=` .
|
|
24
24
|
`,c}static serializeQuad(t){return e.serializeQuadComponents(t.subject,t.predicate,t.object,t.graph)}};function c(e,t){return!(e.subject.termType===t.subject.termType&&e.object.termType===t.object.termType)||!(e.subject.value===t.subject.value&&e.predicate.value===t.predicate.value&&e.object.value===t.object.value)?!1:e.object.termType!==o||e.object.datatype.termType===t.object.datatype.termType&&e.object.language===t.object.language&&e.object.datatype.value===t.object.datatype.value}var l=/[\u0000-\u001F\u007F"\\]/g,u=[];for(let e=0;e<=127;++e)l.test(String.fromCharCode(e))&&(u[e]=`\\u`+e.toString(16).toUpperCase().padStart(4,`0`),l.lastIndex=0);u[`\b`.codePointAt(0)]=`\\b`,u[` `.codePointAt(0)]=`\\t`,u[`
|
|
25
25
|
`.codePointAt(0)]=`\\n`,u[`\f`.codePointAt(0)]=`\\f`,u[`\r`.codePointAt(0)]=`\\r`,u[`"`.codePointAt(0)]=`\\"`,u[`\\`.codePointAt(0)]=`\\\\`;function d(e){return l.test(e)?e.replace(l,function(e){return u[e.codePointAt(0)]}):e}var f=/(?:\\([btnfr"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function p(e){return f.test(e)?e.replace(f,function(e,t,n,r){if(t)switch(t){case`b`:return`\b`;case`t`:return` `;case`n`:return`
|
|
26
|
-
`;case`f`:return`\f`;case`r`:return`\r`;case`"`:return`"`;case`'`:return`'`;case`\\`:return`\\`}if(n)return String.fromCharCode(parseInt(n,16));if(r)return String.fromCodePoint(parseInt(r,16))}):e}var m=/[\u0000-\u0020<>"{}|^`\\]/g,h=[];for(let e=0;e<=127;++e)m.test(String.fromCharCode(e))&&(h[e]=`\\u`+e.toString(16).toUpperCase().padStart(4,`0`),m.lastIndex=0);function g(e){return m.test(e)?e.replace(m,function(e){return h[e.codePointAt(0)]}):e}var _=/(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function v(e){return _.test(e)?e.replace(_,function(e,t,n){if(t)return String.fromCharCode(parseInt(t,16));if(n)return String.fromCodePoint(parseInt(n,16))}):e}})),En=o(((e,t)=>{var n=bn(),r=Cn(),i=wn(),a=Tn(),{setImmediate:o}=Sn();t.exports=class{constructor({createMessageDigest:e=null,messageDigestAlgorithm:t=`sha256`,canonicalIdMap:i=new Map,maxWorkFactor:a=1,maxDeepIterations:o=-1,signal:s=null}={}){this.name=`RDFC-1.0`,this.blankNodeInfo=new Map,this.canonicalIssuer=new n(`c14n`,i),this.createMessageDigest=e||(()=>new r(t)),this.maxWorkFactor=a,this.maxDeepIterations=o,this.remainingDeepIterations=0,this.signal=s,this.quads=null}async main(e){this.quads=e;for(let t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});let t=new Map,r=[...this.blankNodeInfo.keys()],i=0;for(let e of r)++i%100==0&&await this._yield(),await this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});let o=[...t.keys()].sort(),c=[];for(let e of o){let n=t.get(e);if(n.length>1){c.push(n);continue}let r=n[0];this.canonicalIssuer.getId(r)}if(this.maxDeepIterations<0)if(this.maxWorkFactor===0)this.maxDeepIterations=0;else if(this.maxWorkFactor===1/0)this.maxDeepIterations=1/0;else{let e=c.reduce((e,t)=>e+t.length,0);this.maxDeepIterations=e**this.maxWorkFactor}this.maxDeepIterations>2**53-1&&(this.maxDeepIterations=1/0),this.remainingDeepIterations=this.maxDeepIterations;for(let e of c){let t=[];for(let r of e){if(this.canonicalIssuer.hasId(r))continue;let e=new n(`b`);e.getId(r);let i=await this.hashNDegreeQuads(r,e);t.push(i)}t.sort(s);for(let e of t){let t=e.issuer.getOldIds();for(let e of t)this.canonicalIssuer.getId(e)}}let l=[];for(let e of this.quads){let t=a.serializeQuadComponents(this._componentWithCanonicalId(e.subject),e.predicate,this._componentWithCanonicalId(e.object),this._componentWithCanonicalId(e.graph));l.push(t)}return l.sort(),l.join(``)}async hashFirstDegreeQuads(e){let t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(let n of r)t.push(a.serializeQuadComponents(this.modifyFirstDegreeComponent(e,n.subject,`subject`),n.predicate,this.modifyFirstDegreeComponent(e,n.object,`object`),this.modifyFirstDegreeComponent(e,n.graph,`graph`)));t.sort();let i=this.createMessageDigest();for(let e of t)i.update(e);return n.hash=await i.digest(),n.hash}async hashRelatedBlankNode(e,t,n,r){let i=this.createMessageDigest();i.update(r),r!==`g`&&i.update(this.getRelatedPredicate(t));let a;return a=this.canonicalIssuer.hasId(e)?`_:`+this.canonicalIssuer.getId(e):n.hasId(e)?`_:`+n.getId(e):this.blankNodeInfo.get(e).hash,i.update(a),i.digest()}async hashNDegreeQuads(e,t){if(this.remainingDeepIterations===0)throw Error(`Maximum deep iterations exceeded (${this.maxDeepIterations}).`);this.remainingDeepIterations--;let n=this.createMessageDigest(),r=await this.createHashToRelated(e,t),a=[...r.keys()].sort();for(let e of a){n.update(e);let a=``,o,s=new i(r.get(e)),c=0;for(;s.hasNext();){let e=s.next();if(++c%3==0){if(this.signal&&this.signal.aborted)throw Error(`Abort signal received: "${this.signal.reason}".`);await this._yield()}let n=t.clone(),r=``,i=[],l=!1;for(let t of e)if(this.canonicalIssuer.hasId(t)?r+=`_:`+this.canonicalIssuer.getId(t):(n.hasId(t)||i.push(t),r+=`_:`+n.getId(t)),a.length!==0&&r>a){l=!0;break}if(!l){for(let e of i){let t=await this.hashNDegreeQuads(e,n);if(r+=`_:`+n.getId(e),r+=`<${t.hash}>`,n=t.issuer,a.length!==0&&r>a){l=!0;break}}l||(a.length===0||r<a)&&(a=r,o=n)}}n.update(a),t=o}return{hash:await n.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return t.termType===`BlankNode`?{termType:`BlankNode`,value:t.value===e?`a`:`z`}:t}getRelatedPredicate(e){return`<${e.predicate.value}>`}async createHashToRelated(e,t){let n=new Map,r=this.blankNodeInfo.get(e).quads,i=0;for(let a of r)++i%100==0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:a,component:a.subject,position:`s`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:a,component:a.object,position:`o`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:a,component:a.graph,position:`g`,id:e,issuer:t,hashToRelated:n})]);return n}async _hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){let n=await this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if(t.termType!==`BlankNode`)return;let n=t.value,r=this.blankNodeInfo.get(n);r?r.quads.add(e):this.blankNodeInfo.set(n,{quads:new Set([e]),hash:null})}async _addRelatedBlankNodeHash({quad:e,component:t,position:n,id:r,issuer:i,hashToRelated:a}){if(!(t.termType===`BlankNode`&&t.value!==r))return;let o=t.value,s=await this.hashRelatedBlankNode(o,e,i,n),c=a.get(s);c?c.push(o):a.set(s,[o])}_componentWithCanonicalId(e){return e.termType===`BlankNode`&&!e.value.startsWith(this.canonicalIssuer.prefix)?{termType:`BlankNode`,value:this.canonicalIssuer.getId(e.value)}:e}async _yield(){return new Promise(e=>o(e))}};function s(e,t){return e.hash<t.hash?-1:+(e.hash>t.hash)}})),Dn=o(((e,t)=>{var n=bn(),r=Cn(),i=wn(),a=Tn();t.exports=class{constructor({createMessageDigest:e=null,messageDigestAlgorithm:t=`sha256`,canonicalIdMap:i=new Map,maxWorkFactor:a=1,maxDeepIterations:o=-1,timeout:s=0}={}){this.name=`RDFC-1.0`,this.blankNodeInfo=new Map,this.canonicalIssuer=new n(`c14n`,i),this.createMessageDigest=e||(()=>new r(t)),this.maxWorkFactor=a,this.maxDeepIterations=o,this.remainingDeepIterations=0,this.timeout=s,s>0&&(this.startTime=Date.now()),this.quads=null}main(e){this.quads=e;for(let t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});let t=new Map,r=[...this.blankNodeInfo.keys()];for(let e of r)this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});let i=[...t.keys()].sort(),s=[];for(let e of i){let n=t.get(e);if(n.length>1){s.push(n);continue}let r=n[0];this.canonicalIssuer.getId(r)}if(this.maxDeepIterations<0)if(this.maxWorkFactor===0)this.maxDeepIterations=0;else if(this.maxWorkFactor===1/0)this.maxDeepIterations=1/0;else{let e=s.reduce((e,t)=>e+t.length,0);this.maxDeepIterations=e**this.maxWorkFactor}this.maxDeepIterations>2**53-1&&(this.maxDeepIterations=1/0),this.remainingDeepIterations=this.maxDeepIterations;for(let e of s){let t=[];for(let r of e){if(this.canonicalIssuer.hasId(r))continue;let e=new n(`b`);e.getId(r);let i=this.hashNDegreeQuads(r,e);t.push(i)}t.sort(o);for(let e of t){let t=e.issuer.getOldIds();for(let e of t)this.canonicalIssuer.getId(e)}}let c=[];for(let e of this.quads){let t=a.serializeQuadComponents(this._componentWithCanonicalId(e.subject),e.predicate,this._componentWithCanonicalId(e.object),this._componentWithCanonicalId(e.graph));c.push(t)}return c.sort(),c.join(``)}hashFirstDegreeQuads(e){let t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(let n of r)t.push(a.serializeQuadComponents(this.modifyFirstDegreeComponent(e,n.subject,`subject`),n.predicate,this.modifyFirstDegreeComponent(e,n.object,`object`),this.modifyFirstDegreeComponent(e,n.graph,`graph`)));t.sort();let i=this.createMessageDigest();for(let e of t)i.update(e);return n.hash=i.digest(),n.hash}hashRelatedBlankNode(e,t,n,r){let i=this.createMessageDigest();i.update(r),r!==`g`&&i.update(this.getRelatedPredicate(t));let a;return a=this.canonicalIssuer.hasId(e)?`_:`+this.canonicalIssuer.getId(e):n.hasId(e)?`_:`+n.getId(e):this.blankNodeInfo.get(e).hash,i.update(a),i.digest()}hashNDegreeQuads(e,t){if(this.remainingDeepIterations===0)throw Error(`Maximum deep iterations exceeded (${this.maxDeepIterations}).`);this.remainingDeepIterations--;let n=this.createMessageDigest(),r=this.createHashToRelated(e,t),a=[...r.keys()].sort();for(let e of a){n.update(e);let a=``,o,s=new i(r.get(e)),c=0;for(;s.hasNext();){let e=s.next();if(++c%3==0&&this.timeout>0&&Date.now()-this.startTime>this.timeout)throw Error(`Canonize timeout.`);let n=t.clone(),r=``,i=[],l=!1;for(let t of e)if(this.canonicalIssuer.hasId(t)?r+=`_:`+this.canonicalIssuer.getId(t):(n.hasId(t)||i.push(t),r+=`_:`+n.getId(t)),a.length!==0&&r>a){l=!0;break}if(!l){for(let e of i){let t=this.hashNDegreeQuads(e,n);if(r+=`_:`+n.getId(e),r+=`<${t.hash}>`,n=t.issuer,a.length!==0&&r>a){l=!0;break}}l||(a.length===0||r<a)&&(a=r,o=n)}}n.update(a),t=o}return{hash:n.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return t.termType===`BlankNode`?{termType:`BlankNode`,value:t.value===e?`a`:`z`}:t}getRelatedPredicate(e){return`<${e.predicate.value}>`}createHashToRelated(e,t){let n=new Map,r=this.blankNodeInfo.get(e).quads;for(let i of r)this._addRelatedBlankNodeHash({quad:i,component:i.subject,position:`s`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:i,component:i.object,position:`o`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:i,component:i.graph,position:`g`,id:e,issuer:t,hashToRelated:n});return n}_hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){let n=this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if(t.termType!==`BlankNode`)return;let n=t.value,r=this.blankNodeInfo.get(n);r?r.quads.add(e):this.blankNodeInfo.set(n,{quads:new Set([e]),hash:null})}_addRelatedBlankNodeHash({quad:e,component:t,position:n,id:r,issuer:i,hashToRelated:a}){if(!(t.termType===`BlankNode`&&t.value!==r))return;let o=t.value,s=this.hashRelatedBlankNode(o,e,i,n),c=a.get(s);c?c.push(o):a.set(s,[o])}_componentWithCanonicalId(e){return e.termType===`BlankNode`&&!e.value.startsWith(this.canonicalIssuer.prefix)?{termType:`BlankNode`,value:this.canonicalIssuer.getId(e.value)}:e}};function o(e,t){return e.hash<t.hash?-1:+(e.hash>t.hash)}})),On=o((e=>{var t=En(),n=Dn();function r(t,n){if(n.inputFormat){if(n.inputFormat===`application/n-quads`){if(typeof t!=`string`)throw Error(`N-Quads input must be a string.`);return e.NQuads.parse(t)}throw Error(`Unknown canonicalization input format: "${n.inputFormat}".`)}return t}function i(e){if(e.format&&e.format!==`application/n-quads`)throw Error(`Unknown canonicalization output format: "${e.format}".`)}function a(){globalThis.RDF_CANONIZE_TRACE_URDNA2015&&console.trace(`[rdf-canonize] URDNA2015 is deprecated, use RDFC-1.0`)}e.NQuads=Tn(),e.IdentifierIssuer=bn(),e.canonize=async function(e,n={}){let o=r(e,n);if(i(n),!(`algorithm`in n))throw Error(`No RDF Dataset Canonicalization algorithm specified.`);if(n.algorithm===`RDFC-1.0`)return new t(n).main(o);if(n.algorithm===`URDNA2015`&&!n.rejectURDNA2015)return a(),new t(n).main(o);throw Error(`Invalid RDF Dataset Canonicalization algorithm: `+n.algorithm)},e._canonizeSync=function(e,t={}){let o=r(e,t);if(i(t),!(`algorithm`in t))throw Error(`No RDF Dataset Canonicalization algorithm specified.`);if(t.algorithm===`RDFC-1.0`)return new n(t).main(o);if(t.algorithm===`URDNA2015`&&!t.rejectURDNA2015)return a(),new n(t).main(o);throw Error(`Invalid RDF Dataset Canonicalization algorithm: `+t.algorithm)}})),kn=o(((e,t)=>{t.exports=On()})),An=o(((e,t)=>{var n={};t.exports=n,n.isArray=Array.isArray,n.isBoolean=e=>typeof e==`boolean`||Object.prototype.toString.call(e)===`[object Boolean]`,n.isDouble=e=>n.isNumber(e)&&(String(e).indexOf(`.`)!==-1||Math.abs(e)>=1e21),n.isEmptyObject=e=>n.isObject(e)&&Object.keys(e).length===0,n.isNumber=e=>typeof e==`number`||Object.prototype.toString.call(e)===`[object Number]`,n.isNumeric=e=>!isNaN(parseFloat(e))&&isFinite(e),n.isObject=e=>Object.prototype.toString.call(e)===`[object Object]`,n.isString=e=>typeof e==`string`||Object.prototype.toString.call(e)===`[object String]`,n.isUndefined=e=>e===void 0})),jn=o(((e,t)=>{var n=An(),r={};t.exports=r,r.isSubject=e=>n.isObject(e)&&!(`@value`in e||`@set`in e||`@list`in e)?Object.keys(e).length>1||!(`@id`in e):!1,r.isSubjectReference=e=>n.isObject(e)&&Object.keys(e).length===1&&`@id`in e,r.isValue=e=>n.isObject(e)&&`@value`in e,r.isList=e=>n.isObject(e)&&`@list`in e,r.isGraph=e=>n.isObject(e)&&`@graph`in e&&Object.keys(e).filter(e=>e!==`@id`&&e!==`@index`).length===1,r.isSimpleGraph=e=>r.isGraph(e)&&!(`@id`in e),r.isBlankNode=e=>{if(n.isObject(e)){if(`@id`in e){let t=e[`@id`];return!n.isString(t)||t.indexOf(`_:`)===0}return Object.keys(e).length===0||!(`@value`in e||`@set`in e||`@list`in e)}return!1}})),Mn=o(((e,t)=>{t.exports=class extends Error{constructor(e=`An unspecified JSON-LD error occurred.`,t=`jsonld.Error`,n={}){super(e),this.name=t,this.message=e,this.details=n}}})),Nn=o(((e,t)=>{var n=jn(),r=An(),i=kn().IdentifierIssuer,a=Mn(),o=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,s=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,c=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,l=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,u=/^@[a-zA-Z]+$/,d={headers:{accept:`application/ld+json, application/json`}},f={};t.exports=f,f.IdentifierIssuer=i,f.REGEX_BCP47=o,f.REGEX_KEYWORD=u,f.clone=function(e){if(e&&typeof e==`object`){let t;if(r.isArray(e)){t=[];for(let n=0;n<e.length;++n)t[n]=f.clone(e[n])}else if(e instanceof Map){t=new Map;for(let[n,r]of e)t.set(n,f.clone(r))}else if(e instanceof Set){t=new Set;for(let n of e)t.add(f.clone(n))}else if(r.isObject(e)){t={};for(let n in e)t[n]=f.clone(e[n])}else t=e.toString();return t}return e},f.asArray=function(e){return Array.isArray(e)?e:[e]},f.buildHeaders=(e={})=>{if(Object.keys(e).some(e=>e.toLowerCase()===`accept`))throw RangeError(`Accept header may not be specified; only "`+d.headers.accept+`" is supported.`);return Object.assign({Accept:d.headers.accept},e)},f.parseLinkHeader=e=>{let t={},n=e.match(s);for(let e=0;e<n.length;++e){let r=n[e].match(c);if(!r)continue;let i={target:r[1]},a=r[2];for(;r=l.exec(a);)i[r[1]]=r[2]===void 0?r[3]:r[2];let o=i.rel||``;Array.isArray(t[o])?t[o].push(i):t.hasOwnProperty(o)?t[o]=[t[o],i]:t[o]=i}return t},f.validateTypeValue=(e,t)=>{if(!r.isString(e)&&!(r.isArray(e)&&e.every(e=>r.isString(e)))){if(t&&r.isObject(e))switch(Object.keys(e).length){case 0:return;case 1:if(`@default`in e&&f.asArray(e[`@default`]).every(e=>r.isString(e)))return}throw new a(`Invalid JSON-LD syntax; "@type" value must a string, an array of strings, an empty object, or a default object.`,`jsonld.SyntaxError`,{code:`invalid type value`,value:e})}},f.hasProperty=(e,t)=>{if(e.hasOwnProperty(t)){let n=e[t];return!r.isArray(n)||n.length>0}return!1},f.hasValue=(e,t,i)=>{if(f.hasProperty(e,t)){let a=e[t],o=n.isList(a);if(r.isArray(a)||o){o&&(a=a[`@list`]);for(let e=0;e<a.length;++e)if(f.compareValues(i,a[e]))return!0}else if(!r.isArray(i))return f.compareValues(i,a)}return!1},f.addValue=(e,t,n,i)=>{if(i||={},`propertyIsArray`in i||(i.propertyIsArray=!1),`valueIsArray`in i||(i.valueIsArray=!1),`allowDuplicate`in i||(i.allowDuplicate=!0),`prependValue`in i||(i.prependValue=!1),i.valueIsArray)e[t]=n;else if(r.isArray(n)){n.length===0&&i.propertyIsArray&&!e.hasOwnProperty(t)&&(e[t]=[]),i.prependValue&&(n=n.concat(e[t]),e[t]=[]);for(let r=0;r<n.length;++r)f.addValue(e,t,n[r],i)}else if(e.hasOwnProperty(t)){let a=!i.allowDuplicate&&f.hasValue(e,t,n);!r.isArray(e[t])&&(!a||i.propertyIsArray)&&(e[t]=[e[t]]),a||(i.prependValue?e[t].unshift(n):e[t].push(n))}else e[t]=i.propertyIsArray?[n]:n},f.getValues=(e,t)=>[].concat(e[t]||[]),f.removeProperty=(e,t)=>{delete e[t]},f.removeValue=(e,t,n,r)=>{r||={},`propertyIsArray`in r||(r.propertyIsArray=!1);let i=f.getValues(e,t).filter(e=>!f.compareValues(e,n));i.length===0?f.removeProperty(e,t):i.length===1&&!r.propertyIsArray?e[t]=i[0]:e[t]=i},f.relabelBlankNodes=(e,t)=>(t||={},p(t.issuer||new i(`_:b`),e)),f.compareValues=(e,t)=>e===t||n.isValue(e)&&n.isValue(t)&&e[`@value`]===t[`@value`]&&e[`@type`]===t[`@type`]&&e[`@language`]===t[`@language`]&&e[`@index`]===t[`@index`]?!0:r.isObject(e)&&`@id`in e&&r.isObject(t)&&`@id`in t?e[`@id`]===t[`@id`]:!1,f.compareShortestLeast=(e,t)=>e.length<t.length?-1:t.length<e.length?1:e===t?0:e<t?-1:1;function p(e,t){if(r.isArray(t))for(let n=0;n<t.length;++n)t[n]=p(e,t[n]);else if(n.isList(t))t[`@list`]=p(e,t[`@list`]);else if(r.isObject(t)){n.isBlankNode(t)&&(t[`@id`]=e.getId(t[`@id`]));let r=Object.keys(t).sort();for(let n=0;n<r.length;++n){let i=r[n];i!==`@id`&&(t[i]=p(e,t[i]))}}return t}})),Pn=o(((e,t)=>{t.exports={LINK_HEADER_REL:`http://www.w3.org/ns/json-ld#context`,LINK_HEADER_CONTEXT:`http://www.w3.org/ns/json-ld#context`,RDF:`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,RDF_LIST:`http://www.w3.org/1999/02/22-rdf-syntax-ns#List`,RDF_FIRST:`http://www.w3.org/1999/02/22-rdf-syntax-ns#first`,RDF_REST:`http://www.w3.org/1999/02/22-rdf-syntax-ns#rest`,RDF_NIL:`http://www.w3.org/1999/02/22-rdf-syntax-ns#nil`,RDF_TYPE:`http://www.w3.org/1999/02/22-rdf-syntax-ns#type`,RDF_PLAIN_LITERAL:`http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral`,RDF_XML_LITERAL:`http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral`,RDF_JSON_LITERAL:`http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON`,RDF_OBJECT:`http://www.w3.org/1999/02/22-rdf-syntax-ns#object`,RDF_LANGSTRING:`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`,XSD:`http://www.w3.org/2001/XMLSchema#`,XSD_BOOLEAN:`http://www.w3.org/2001/XMLSchema#boolean`,XSD_DOUBLE:`http://www.w3.org/2001/XMLSchema#double`,XSD_INTEGER:`http://www.w3.org/2001/XMLSchema#integer`,XSD_STRING:`http://www.w3.org/2001/XMLSchema#string`}})),Fn=o(((e,t)=>{t.exports=class{constructor(){this._requests={}}wrapLoader(e){let t=this;return t._loader=e,function(){return t.add.apply(t,arguments)}}async add(e){let t=this._requests[e];if(t)return Promise.resolve(t);t=this._requests[e]=this._loader(e);try{return await t}finally{delete this._requests[e]}}}})),In=o(((e,t)=>{var n=An(),r={};t.exports=r,r.parsers={simple:{keys:[`href`,`scheme`,`authority`,`path`,`query`,`fragment`],regex:/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/},full:{keys:[`href`,`protocol`,`scheme`,`authority`,`auth`,`user`,`password`,`hostname`,`port`,`path`,`directory`,`file`,`query`,`fragment`],regex:/^(([a-zA-Z][a-zA-Z0-9+-.]*):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},r.parse=(e,t)=>{let n={},i=r.parsers[t||`full`],a=i.regex.exec(e),o=i.keys.length;for(;o--;)n[i.keys[o]]=a[o]===void 0?null:a[o];return(n.scheme===`https`&&n.port===`443`||n.scheme===`http`&&n.port===`80`)&&(n.href=n.href.replace(`:`+n.port,``),n.authority=n.authority.replace(`:`+n.port,``),n.port=null),n.normalizedPath=r.removeDotSegments(n.path),n},r.prependBase=(e,t)=>{if(e===null||r.isAbsolute(t))return t;(!e||n.isString(e))&&(e=r.parse(e||``));let i=r.parse(t),a={protocol:e.protocol||``};if(i.authority!==null)a.authority=i.authority,a.path=i.path,a.query=i.query;else if(a.authority=e.authority,i.path===``)a.path=e.path,i.query===null?a.query=e.query:a.query=i.query;else{if(i.path.indexOf(`/`)===0)a.path=i.path;else{let t=e.path;t=t.substr(0,t.lastIndexOf(`/`)+1),(t.length>0||e.authority)&&t.substr(-1)!==`/`&&(t+=`/`),t+=i.path,a.path=t}a.query=i.query}i.path!==``&&(a.path=r.removeDotSegments(a.path));let o=a.protocol;return a.authority!==null&&(o+=`//`+a.authority),o+=a.path,a.query!==null&&(o+=`?`+a.query),i.fragment!==null&&(o+=`#`+i.fragment),o===``&&(o=`./`),o},r.removeBase=(e,t)=>{if(e===null)return t;(!e||n.isString(e))&&(e=r.parse(e||``));let i=``;if(e.href===``?t.indexOf(`//`)&&(i+=`//`):i+=(e.protocol||``)+`//`+(e.authority||``),t.indexOf(i)!==0)return t;let a=r.parse(t.substr(i.length)),o=e.normalizedPath.split(`/`),s=a.normalizedPath.split(`/`),c=a.fragment||a.query?0:1;for(;o.length>0&&s.length>c&&o[0]===s[0];)o.shift(),s.shift();let l=``;if(o.length>0){o.pop();for(let e=0;e<o.length;++e)l+=`../`}return l+=s.join(`/`),a.query!==null&&(l+=`?`+a.query),a.fragment!==null&&(l+=`#`+a.fragment),l===``&&(l=`./`),l},r.removeDotSegments=e=>{if(e.length===0)return``;let t=e.split(`/`),n=[];for(;t.length>0;){let e=t.shift(),r=t.length===0;if(e===`.`){r&&n.push(``);continue}if(e===`..`){n.pop(),r&&n.push(``);continue}n.push(e)}return e[0]===`/`&&n.length>0&&n[0]!==``&&n.unshift(``),n.length===1&&n[0]===``?`/`:n.join(`/`)};var i=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;r.isAbsolute=e=>n.isString(e)&&i.test(e),r.isRelative=e=>n.isString(e)})),Ln=o(((e,t)=>{var{parseLinkHeader:n,buildHeaders:r}=Nn(),{LINK_HEADER_CONTEXT:i}=Pn(),a=Mn(),o=Fn(),{prependBase:s}=In(),c=/(^|(\r\n))link:/i;t.exports=({secure:e,headers:t={},xhr:u}={headers:{}})=>{return t=r(t),new o().wrapLoader(d);async function d(r){if(r.indexOf(`http:`)!==0&&r.indexOf(`https:`)!==0)throw new a(`URL could not be dereferenced; only "http" and "https" URLs are supported.`,`jsonld.InvalidUrl`,{code:`loading document failed`,url:r});if(e&&r.indexOf(`https`)!==0)throw new a(`URL could not be dereferenced; secure mode is enabled and the URL's scheme is not "https".`,`jsonld.InvalidUrl`,{code:`loading document failed`,url:r});let o;try{o=await l(u,r,t)}catch(e){throw new a(`URL could not be dereferenced, an error occurred.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:r,cause:e})}if(o.status>=400)throw new a(`URL could not be dereferenced: `+o.statusText,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:r,httpStatusCode:o.status});let f={contextUrl:null,documentUrl:r,document:o.response},p=null,m=o.getResponseHeader(`Content-Type`),h;if(c.test(o.getAllResponseHeaders())&&(h=o.getResponseHeader(`Link`)),h&&m!==`application/ld+json`){let e=n(h),t=e[i];if(Array.isArray(t))throw new a(`URL could not be dereferenced, it has more than one associated HTTP Link Header.`,`jsonld.InvalidUrl`,{code:`multiple context link headers`,url:r});t&&(f.contextUrl=t.target),p=e.alternate,p&&p.type==`application/ld+json`&&!(m||``).match(/^application\/(\w*\+)?json$/)&&(f=await d(s(r,p.target)))}return f}};function l(e,t,n){e||=XMLHttpRequest;let r=new e;return new Promise((e,i)=>{r.onload=()=>e(r),r.onerror=e=>i(e),r.open(`GET`,t,!0);for(let e in n)r.setRequestHeader(e,n[e]);r.send()})}})),Rn=o(((e,t)=>{var n=Ln(),r={};t.exports=r,r.setupDocumentLoaders=function(e){typeof XMLHttpRequest<`u`&&(e.documentLoaders.xhr=n,e.useDocumentLoader(`xhr`))},r.setupGlobals=function(e){globalThis.JsonLdProcessor===void 0&&Object.defineProperty(globalThis,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:e.JsonLdProcessor})}})),zn=o(((e,t)=>{t.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}})),Bn=o(((e,t)=>{t.exports=n,n.Node=o,n.create=n;function n(e){var t=this;if(t instanceof n||(t=new n),t.tail=null,t.head=null,t.length=0,e&&typeof e.forEach==`function`)e.forEach(function(e){t.push(e)});else if(arguments.length>0)for(var r=0,i=arguments.length;r<i;r++)t.push(arguments[r]);return t}n.prototype.removeNode=function(e){if(e.list!==this)throw Error(`removing node which does not belong to this list`);var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t},n.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||=e,this.length++}},n.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||=e,this.length++}},n.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)i(this,arguments[e]);return this.length},n.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)a(this,arguments[e]);return this.length},n.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},n.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},n.prototype.forEach=function(e,t){t||=this;for(var n=this.head,r=0;n!==null;r++)e.call(t,n.value,r,this),n=n.next},n.prototype.forEachReverse=function(e,t){t||=this;for(var n=this.tail,r=this.length-1;n!==null;r--)e.call(t,n.value,r,this),n=n.prev},n.prototype.get=function(e){for(var t=0,n=this.head;n!==null&&t<e;t++)n=n.next;if(t===e&&n!==null)return n.value},n.prototype.getReverse=function(e){for(var t=0,n=this.tail;n!==null&&t<e;t++)n=n.prev;if(t===e&&n!==null)return n.value},n.prototype.map=function(e,t){t||=this;for(var r=new n,i=this.head;i!==null;)r.push(e.call(t,i.value,this)),i=i.next;return r},n.prototype.mapReverse=function(e,t){t||=this;for(var r=new n,i=this.tail;i!==null;)r.push(e.call(t,i.value,this)),i=i.prev;return r},n.prototype.reduce=function(e,t){var n,r=this.head;if(arguments.length>1)n=t;else if(this.head)r=this.head.next,n=this.head.value;else throw TypeError(`Reduce of empty list with no initial value`);for(var i=0;r!==null;i++)n=e(n,r.value,i),r=r.next;return n},n.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else if(this.tail)r=this.tail.prev,n=this.tail.value;else throw TypeError(`Reduce of empty list with no initial value`);for(var i=this.length-1;r!==null;i--)n=e(n,r.value,i),r=r.prev;return n},n.prototype.toArray=function(){for(var e=Array(this.length),t=0,n=this.head;n!==null;t++)e[t]=n.value,n=n.next;return e},n.prototype.toArrayReverse=function(){for(var e=Array(this.length),t=0,n=this.tail;n!==null;t++)e[t]=n.value,n=n.prev;return e},n.prototype.slice=function(e,t){t||=this.length,t<0&&(t+=this.length),e||=0,e<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,a=this.head;a!==null&&i<e;i++)a=a.next;for(;a!==null&&i<t;i++,a=a.next)r.push(a.value);return r},n.prototype.sliceReverse=function(e,t){t||=this.length,t<0&&(t+=this.length),e||=0,e<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,a=this.tail;a!==null&&i>t;i--)a=a.prev;for(;a!==null&&i>e;i--,a=a.prev)r.push(a.value);return r},n.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,a=this.head;a!==null&&i<e;i++)a=a.next;for(var o=[],i=0;a&&i<t;i++)o.push(a.value),a=this.removeNode(a);a===null&&(a=this.tail),a!==this.head&&a!==this.tail&&(a=a.prev);for(var i=0;i<n.length;i++)a=r(this,a,n[i]);return o},n.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;n!==null;n=n.prev){var r=n.prev;n.prev=n.next,n.next=r}return this.head=t,this.tail=e,this};function r(e,t,n){var r=t===e.head?new o(n,null,t,e):new o(n,t,t.next,e);return r.next===null&&(e.tail=r),r.prev===null&&(e.head=r),e.length++,r}function i(e,t){e.tail=new o(t,e.tail,null,e),e.head||=e.tail,e.length++}function a(e,t){e.head=new o(t,null,e.head,e),e.tail||=e.head,e.length++}function o(e,t,n,r){if(!(this instanceof o))return new o(e,t,n,r);this.list=r,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}try{zn()(n)}catch{}})),Vn=o(((e,t)=>{var n=Bn(),r=Symbol(`max`),i=Symbol(`length`),a=Symbol(`lengthCalculator`),o=Symbol(`allowStale`),s=Symbol(`maxAge`),c=Symbol(`dispose`),l=Symbol(`noDisposeOnSet`),u=Symbol(`lruList`),d=Symbol(`cache`),f=Symbol(`updateAgeOnGet`),p=()=>1,m=class{constructor(e){if(typeof e==`number`&&(e={max:e}),e||={},e.max&&(typeof e.max!=`number`||e.max<0))throw TypeError(`max must be a non-negative number`);this[r]=e.max||1/0;let t=e.length||p;if(this[a]=typeof t==`function`?t:p,this[o]=e.stale||!1,e.maxAge&&typeof e.maxAge!=`number`)throw TypeError(`maxAge must be a number`);this[s]=e.maxAge||0,this[c]=e.dispose,this[l]=e.noDisposeOnSet||!1,this[f]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!=`number`||e<0)throw TypeError(`max must be a non-negative number`);this[r]=e||1/0,_(this)}get max(){return this[r]}set allowStale(e){this[o]=!!e}get allowStale(){return this[o]}set maxAge(e){if(typeof e!=`number`)throw TypeError(`maxAge must be a non-negative number`);this[s]=e,_(this)}get maxAge(){return this[s]}set lengthCalculator(e){typeof e!=`function`&&(e=p),e!==this[a]&&(this[a]=e,this[i]=0,this[u].forEach(e=>{e.length=this[a](e.value,e.key),this[i]+=e.length})),_(this)}get lengthCalculator(){return this[a]}get length(){return this[i]}get itemCount(){return this[u].length}rforEach(e,t){t||=this;for(let n=this[u].tail;n!==null;){let r=n.prev;b(this,e,n,t),n=r}}forEach(e,t){t||=this;for(let n=this[u].head;n!==null;){let r=n.next;b(this,e,n,t),n=r}}keys(){return this[u].toArray().map(e=>e.key)}values(){return this[u].toArray().map(e=>e.value)}reset(){this[c]&&this[u]&&this[u].length&&this[u].forEach(e=>this[c](e.key,e.value)),this[d]=new Map,this[u]=new n,this[i]=0}dump(){return this[u].map(e=>!g(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[u]}set(e,t,n){if(n||=this[s],n&&typeof n!=`number`)throw TypeError(`maxAge must be a number`);let o=n?Date.now():0,f=this[a](t,e);if(this[d].has(e)){if(f>this[r])return v(this,this[d].get(e)),!1;let a=this[d].get(e).value;return this[c]&&(this[l]||this[c](e,a.value)),a.now=o,a.maxAge=n,a.value=t,this[i]+=f-a.length,a.length=f,this.get(e),_(this),!0}let p=new y(e,t,f,o,n);return p.length>this[r]?(this[c]&&this[c](e,t),!1):(this[i]+=p.length,this[u].unshift(p),this[d].set(e,this[u].head),_(this),!0)}has(e){if(!this[d].has(e))return!1;let t=this[d].get(e).value;return!g(this,t)}get(e){return h(this,e,!0)}peek(e){return h(this,e,!1)}pop(){let e=this[u].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[d].get(e))}load(e){this.reset();let t=Date.now();for(let n=e.length-1;n>=0;n--){let r=e[n],i=r.e||0;if(i===0)this.set(r.k,r.v);else{let e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[d].forEach((e,t)=>h(this,t,!1))}},h=(e,t,n)=>{let r=e[d].get(t);if(r){let t=r.value;if(g(e,t)){if(v(e,r),!e[o])return}else n&&(e[f]&&(r.value.now=Date.now()),e[u].unshiftNode(r));return t.value}},g=(e,t)=>{if(!t||!t.maxAge&&!e[s])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[s]&&n>e[s]},_=e=>{if(e[i]>e[r])for(let t=e[u].tail;e[i]>e[r]&&t!==null;){let n=t.prev;v(e,t),t=n}},v=(e,t)=>{if(t){let n=t.value;e[c]&&e[c](n.key,n.value),e[i]-=n.length,e[d].delete(n.key),e[u].removeNode(t)}},y=class{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}},b=(e,t,n,r)=>{let i=n.value;g(e,i)&&(v(e,n),e[o]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};t.exports=m})),Hn=o(((e,t)=>{var n=Vn(),r=10;t.exports=class{constructor({document:e}){this.document=e,this.cache=new n({max:r})}getProcessed(e){return this.cache.get(e)}setProcessed(e,t){this.cache.set(e,t)}}})),Un=o(((e,t)=>{var{isArray:n,isObject:r,isString:i}=An(),{asArray:a}=Nn(),{prependBase:o}=In(),s=Mn(),c=Hn(),l=10;t.exports=class{constructor({sharedCache:e}){this.perOpCache=new Map,this.sharedCache=e}async resolve({activeCtx:e,context:t,documentLoader:o,base:s,cycles:l=new Set}){t&&r(t)&&t[`@context`]&&(t=t[`@context`]),t=a(t);let d=[];for(let a of t){if(i(a)){let t=this._get(a);t||=await this._resolveRemoteContext({activeCtx:e,url:a,documentLoader:o,base:s,cycles:l}),n(t)?d.push(...t):d.push(t);continue}if(a===null){d.push(new c({document:null}));continue}r(a)||u(t);let f=JSON.stringify(a),p=this._get(f);p||(p=new c({document:a}),this._cacheResolvedContext({key:f,resolved:p,tag:`static`})),d.push(p)}return d}_get(e){let t=this.perOpCache.get(e);if(!t){let n=this.sharedCache.get(e);n&&(t=n.get(`static`),t&&this.perOpCache.set(e,t))}return t}_cacheResolvedContext({key:e,resolved:t,tag:n}){if(this.perOpCache.set(e,t),n!==void 0){let r=this.sharedCache.get(e);r||(r=new Map,this.sharedCache.set(e,r)),r.set(n,t)}return t}async _resolveRemoteContext({activeCtx:e,url:t,documentLoader:n,base:r,cycles:i}){t=o(r,t);let{context:a,remoteDoc:s}=await this._fetchContext({activeCtx:e,url:t,documentLoader:n,cycles:i});r=s.documentUrl||t,d({context:a,base:r});let c=await this.resolve({activeCtx:e,context:a,documentLoader:n,base:r,cycles:i});return this._cacheResolvedContext({key:t,resolved:c,tag:s.tag}),c}async _fetchContext({activeCtx:e,url:t,documentLoader:a,cycles:o}){if(o.size>l)throw new s(`Maximum number of @context URLs exceeded.`,`jsonld.ContextUrlError`,{code:e.processingMode===`json-ld-1.0`?`loading remote context failed`:`context overflow`,max:l});if(o.has(t))throw new s(`Cyclical @context URLs detected.`,`jsonld.ContextUrlError`,{code:e.processingMode===`json-ld-1.0`?`recursive context inclusion`:`context overflow`,url:t});o.add(t);let c,u;try{u=await a(t),c=u.document||null,i(c)&&(c=JSON.parse(c))}catch(e){throw new s(`Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context. URL: "${t}".`,`jsonld.InvalidUrl`,{code:`loading remote context failed`,url:t,cause:e})}if(!r(c))throw new s(`Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object. URL: "${t}".`,`jsonld.InvalidUrl`,{code:`invalid remote context`,url:t});return c=`@context`in c?{"@context":c[`@context`]}:{"@context":{}},u.contextUrl&&(n(c[`@context`])||(c[`@context`]=[c[`@context`]]),c[`@context`].push(u.contextUrl)),{context:c,remoteDoc:u}}};function u(e){throw new s(`Invalid JSON-LD syntax; @context must be an object.`,`jsonld.SyntaxError`,{code:`invalid local context`,context:e})}function d({context:e,base:t}){if(!e)return;let a=e[`@context`];if(i(a)){e[`@context`]=o(t,a);return}if(n(a)){for(let e=0;e<a.length;++e){let n=a[e];if(i(n)){a[e]=o(t,n);continue}r(n)&&d({context:{"@context":n},base:t})}return}if(r(a))for(let e in a)d({context:a[e],base:t})}})),Wn=o(((e,t)=>{t.exports=kn().NQuads})),Gn=o(((e,t)=>{var n=Mn(),{isArray:r}=An(),{asArray:i}=Nn(),a={};t.exports=a,a.defaultEventHandler=null,a.setupEventHandler=({options:e={}})=>{let t=[].concat(e.safe?a.safeEventHandler:[],e.eventHandler?i(e.eventHandler):[],a.defaultEventHandler?a.defaultEventHandler:[]);return t.length===0?null:t},a.handleEvent=({event:e,options:t})=>{o({event:e,handlers:t.eventHandler})};function o({event:e,handlers:t}){let i=!0;for(let a=0;i&&a<t.length;++a){i=!1;let s=t[a];if(r(s))i=o({event:e,handlers:s});else if(typeof s==`function`)s({event:e,next:()=>{i=!0}});else if(typeof s==`object`)e.code in s?s[e.code]({event:e,next:()=>{i=!0}}):i=!0;else throw new n(`Invalid event handler.`,`jsonld.InvalidEventHandler`,{event:e})}return i}var s=new Set([`empty object`,`free-floating scalar`,`invalid @language value`,`invalid property`,`null @id value`,`null @value value`,`object with only @id`,`object with only @language`,`object with only @list`,`object with only @value`,`relative @id reference`,`relative @type reference`,`relative @vocab reference`,`reserved @id value`,`reserved @reverse value`,`reserved term`,`blank node predicate`,`relative graph reference`,`relative object reference`,`relative predicate reference`,`relative subject reference`,`rdfDirection not set`]);a.safeEventHandler=function({event:e,next:t}){if(e.level===`warning`&&s.has(e.code))throw new n(`Safe mode validation error.`,`jsonld.ValidationError`,{event:e});t()},a.logEventHandler=function({event:e,next:t}){console.log(`EVENT: ${e.message}`,{event:e}),t()},a.logWarningEventHandler=function({event:e,next:t}){e.level===`warning`&&console.warn(`WARNING: ${e.message}`,{event:e}),t()},a.unhandledEventHandler=function({event:e}){throw new n(`No handler for event.`,`jsonld.UnhandledEvent`,{event:e})},a.setDefaultEventHandler=function({eventHandler:e}={}){a.defaultEventHandler=e?i(e):null}})),Kn=o(((e,t)=>{var n=Nn(),r=Mn(),{isArray:i,isObject:a,isString:o,isUndefined:s}=An(),{isAbsolute:c,isRelative:l,prependBase:u}=In(),{handleEvent:d}=Gn(),{REGEX_BCP47:f,REGEX_KEYWORD:p,asArray:m,compareShortestLeast:h}=Nn(),g=new Map,_=1e4,v={};t.exports=v,v.process=async({activeCtx:e,localCtx:t,options:n,propagate:s=!0,overrideProtected:p=!1,cycles:h=new Set})=>{if(a(t)&&`@context`in t&&i(t[`@context`])&&(t=t[`@context`]),m(t).length===0)return e;let g=[],_=[({event:e,next:t})=>{g.push(e),t()}];n.eventHandler&&_.push(n.eventHandler);let b=n;n={...n,eventHandler:_};let x=await n.contextResolver.resolve({activeCtx:e,context:t,documentLoader:n.documentLoader,base:n.base});a(x[0].document)&&typeof x[0].document[`@propagate`]==`boolean`&&(s=x[0].document[`@propagate`]);let S=e;!s&&!S.previousContext&&(S=S.clone(),S.previousContext=e);for(let i of x){let{document:s}=i;if(e=S,s===null){if(!p&&Object.keys(e.protected).length!==0)throw new r(`Tried to nullify a context with protected terms outside of a term definition.`,`jsonld.SyntaxError`,{code:`invalid context nullification`});S=e=v.getInitialContext(n).clone();continue}let m=i.getProcessed(e);if(m){if(b.eventHandler)for(let e of m.events)d({event:e,options:b});S=e=m.context;continue}if(a(s)&&`@context`in s&&(s=s[`@context`]),!a(s))throw new r(`Invalid JSON-LD syntax; @context must be an object.`,`jsonld.SyntaxError`,{code:`invalid local context`,context:s});S=S.clone();let _=new Map;if(`@version`in s){if(s[`@version`]!==1.1)throw new r(`Unsupported JSON-LD version: `+s[`@version`],`jsonld.UnsupportedVersion`,{code:`invalid @version value`,context:s});if(e.processingMode&&e.processingMode===`json-ld-1.0`)throw new r(`@version: `+s[`@version`]+` not compatible with `+e.processingMode,`jsonld.ProcessingModeConflict`,{code:`processing mode conflict`,context:s});S.processingMode=`json-ld-1.1`,S[`@version`]=s[`@version`],_.set(`@version`,!0)}if(S.processingMode=S.processingMode||e.processingMode,`@base`in s){let e=s[`@base`];if(!(e===null||c(e)))if(l(e))e=u(S[`@base`],e);else throw new r(`Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI, a relative IRI, or null.`,`jsonld.SyntaxError`,{code:`invalid base IRI`,context:s});S[`@base`]=e,_.set(`@base`,!0)}if(`@vocab`in s){let e=s[`@vocab`];if(e===null)delete S[`@vocab`];else if(!o(e))throw new r(`Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.`,`jsonld.SyntaxError`,{code:`invalid vocab mapping`,context:s});else if(!c(e)&&v.processingMode(S,1))throw new r(`Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.`,`jsonld.SyntaxError`,{code:`invalid vocab mapping`,context:s});else{let t=y(S,e,{vocab:!0,base:!0},void 0,void 0,n);c(t)||n.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`relative @vocab reference`,level:`warning`,message:`Relative @vocab reference found.`,details:{vocab:t}},options:n}),S[`@vocab`]=t}_.set(`@vocab`,!0)}if(`@language`in s){let e=s[`@language`];if(e===null)delete S[`@language`];else if(o(e))e.match(f)||n.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:n}),S[`@language`]=e.toLowerCase();else throw new r(`Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.`,`jsonld.SyntaxError`,{code:`invalid default language`,context:s});_.set(`@language`,!0)}if(`@direction`in s){let t=s[`@direction`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @direction not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context member`,context:s});if(t===null)delete S[`@direction`];else if(t!==`ltr`&&t!==`rtl`)throw new r(`Invalid JSON-LD syntax; the value of "@direction" in a @context must be null, "ltr", or "rtl".`,`jsonld.SyntaxError`,{code:`invalid base direction`,context:s});else S[`@direction`]=t;_.set(`@direction`,!0)}if(`@propagate`in s){let n=s[`@propagate`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @propagate not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context entry`,context:s});if(typeof n!=`boolean`)throw new r(`Invalid JSON-LD syntax; @propagate value must be a boolean.`,`jsonld.SyntaxError`,{code:`invalid @propagate value`,context:t});_.set(`@propagate`,!0)}if(`@import`in s){let i=s[`@import`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @import not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context entry`,context:s});if(!o(i))throw new r(`Invalid JSON-LD syntax; @import must be a string.`,`jsonld.SyntaxError`,{code:`invalid @import value`,context:t});let a=await n.contextResolver.resolve({activeCtx:e,context:i,documentLoader:n.documentLoader,base:n.base});if(a.length!==1)throw new r(`Invalid JSON-LD syntax; @import must reference a single context.`,`jsonld.SyntaxError`,{code:`invalid remote context`,context:t});let c=a[0].getProcessed(e);if(c)s=c;else{let n=a[0].document;if(`@import`in n)throw new r(`Invalid JSON-LD syntax: imported context must not include @import.`,`jsonld.SyntaxError`,{code:`invalid context entry`,context:t});for(let e in n)s.hasOwnProperty(e)||(s[e]=n[e]);a[0].setProcessed(e,s)}_.set(`@import`,!0)}_.set(`@protected`,s[`@protected`]||!1);for(let e in s)if(v.createTermDefinition({activeCtx:S,localCtx:s,term:e,defined:_,options:n,overrideProtected:p}),a(s[e])&&`@context`in s[e]){let t=s[e][`@context`],i=!0;if(o(t)){let e=u(n.base,t);h.has(e)?i=!1:h.add(e)}if(i)try{await v.process({activeCtx:S.clone(),localCtx:s[e][`@context`],overrideProtected:!0,options:n,cycles:h})}catch{throw new r(`Invalid JSON-LD syntax; invalid scoped context.`,`jsonld.SyntaxError`,{code:`invalid scoped context`,context:s[e][`@context`],term:e})}}i.setProcessed(e,{context:S,events:g})}return S},v.createTermDefinition=({activeCtx:e,localCtx:t,term:n,defined:s,options:l,overrideProtected:u=!1})=>{if(s.has(n)){if(s.get(n))return;throw new r(`Cyclical context definition detected.`,`jsonld.CyclicalContext`,{code:`cyclic IRI mapping`,context:t,term:n})}s.set(n,!1);let f;if(t.hasOwnProperty(n)&&(f=t[n]),n===`@type`&&a(f)&&(f[`@container`]||`@set`)===`@set`&&v.processingMode(e,1.1)){let e=[`@container`,`@id`,`@protected`],i=Object.keys(f);if(i.length===0||i.some(t=>!e.includes(t)))throw new r(`Invalid JSON-LD syntax; keywords cannot be overridden.`,`jsonld.SyntaxError`,{code:`keyword redefinition`,context:t,term:n})}else if(v.isKeyword(n))throw new r(`Invalid JSON-LD syntax; keywords cannot be overridden.`,`jsonld.SyntaxError`,{code:`keyword redefinition`,context:t,term:n});else if(n.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved term`,level:`warning`,message:`Terms beginning with "@" are reserved for future use and dropped.`,details:{term:n}},options:l});return}else if(n===``)throw new r(`Invalid JSON-LD syntax; a term cannot be an empty string.`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let m=e.mappings.get(n);e.mappings.has(n)&&e.mappings.delete(n);let h=!1;if((o(f)||f===null)&&(h=!0,f={"@id":f}),!a(f))throw new r(`Invalid JSON-LD syntax; @context term values must be strings or objects.`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let g={};e.mappings.set(n,g),g.reverse=!1;let _=[`@container`,`@id`,`@language`,`@reverse`,`@type`];v.processingMode(e,1.1)&&_.push(`@context`,`@direction`,`@index`,`@nest`,`@prefix`,`@protected`);for(let e in f)if(!_.includes(e))throw new r(`Invalid JSON-LD syntax; a term definition must not contain `+e,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let x=n.indexOf(`:`);if(g._termHasColon=x>0,`@reverse`in f){if(`@id`in f)throw new r(`Invalid JSON-LD syntax; a @reverse term definition must not contain @id.`,`jsonld.SyntaxError`,{code:`invalid reverse property`,context:t});if(`@nest`in f)throw new r(`Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.`,`jsonld.SyntaxError`,{code:`invalid reverse property`,context:t});let i=f[`@reverse`];if(!o(i))throw new r(`Invalid JSON-LD syntax; a @context @reverse value must be a string.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});if(i.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved @reverse value`,level:`warning`,message:`@reverse values beginning with "@" are reserved for future use and dropped.`,details:{reverse:i}},options:l}),m?e.mappings.set(n,m):e.mappings.delete(n);return}let a=y(e,i,{vocab:!0,base:!1},t,s,l);if(!c(a))throw new r(`Invalid JSON-LD syntax; a @context @reverse value must be an absolute IRI or a blank node identifier.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});g[`@id`]=a,g.reverse=!0}else if(`@id`in f){let i=f[`@id`];if(i&&!o(i))throw new r(`Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});if(i===null)g[`@id`]=null;else if(!v.isKeyword(i)&&i.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`@id values beginning with "@" are reserved for future use and dropped.`,details:{id:i}},options:l}),m?e.mappings.set(n,m):e.mappings.delete(n);return}else if(i!==n){if(i=y(e,i,{vocab:!0,base:!1},t,s,l),!c(i)&&!v.isKeyword(i))throw new r(`Invalid JSON-LD syntax; a @context @id value must be an absolute IRI, a blank node identifier, or a keyword.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});if(n.match(/(?::[^:])|\//)&&y(e,n,{vocab:!0,base:!1},t,new Map(s).set(n,!0),l)!==i)throw new r(`Invalid JSON-LD syntax; term in form of IRI must expand to definition.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});g[`@id`]=i,g._prefix=h&&!g._termHasColon&&i.match(/[:\/\?#\[\]@]$/)!==null}}if(!(`@id`in g))if(g._termHasColon){let r=n.substr(0,x);if(t.hasOwnProperty(r)&&v.createTermDefinition({activeCtx:e,localCtx:t,term:r,defined:s,options:l}),e.mappings.has(r)){let t=n.substr(x+1);g[`@id`]=e.mappings.get(r)[`@id`]+t}else g[`@id`]=n}else if(n===`@type`)g[`@id`]=n;else{if(!(`@vocab`in e))throw new r(`Invalid JSON-LD syntax; @context terms must define an @id.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t,term:n});g[`@id`]=e[`@vocab`]+n}if((f[`@protected`]===!0||s.get(`@protected`)===!0&&f[`@protected`]!==!1)&&(e.protected[n]=!0,g.protected=!0),s.set(n,!0),`@type`in f){let n=f[`@type`];if(!o(n))throw new r(`Invalid JSON-LD syntax; an @context @type value must be a string.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t});if(n===`@json`||n===`@none`){if(v.processingMode(e,1))throw new r(`Invalid JSON-LD syntax; an @context @type value must not be "${n}" in JSON-LD 1.0 mode.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t})}else if(n!==`@id`&&n!==`@vocab`){if(n=y(e,n,{vocab:!0,base:!1},t,s,l),!c(n))throw new r(`Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t});if(n.indexOf(`_:`)===0)throw new r(`Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t})}g[`@type`]=n}if(`@container`in f){let n=o(f[`@container`])?[f[`@container`]]:f[`@container`]||[],a=[`@list`,`@set`,`@index`,`@language`],s=!0,c=n.includes(`@set`);if(v.processingMode(e,1.1)){if(a.push(`@graph`,`@id`,`@type`),n.includes(`@list`)){if(n.length!==1)throw new r(`Invalid JSON-LD syntax; @context @container with @list must have no other values`,`jsonld.SyntaxError`,{code:`invalid container mapping`,context:t})}else if(n.includes(`@graph`)){if(n.some(e=>e!==`@graph`&&e!==`@id`&&e!==`@index`&&e!==`@set`))throw new r(`Invalid JSON-LD syntax; @context @container with @graph must have no other values other than @id, @index, and @set`,`jsonld.SyntaxError`,{code:`invalid container mapping`,context:t})}else s&=n.length<=(c?2:1);if(n.includes(`@type`)&&(g[`@type`]=g[`@type`]||`@id`,![`@id`,`@vocab`].includes(g[`@type`])))throw new r(`Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t})}else s&=!i(f[`@container`]),s&=n.length<=1;if(s&=n.every(e=>a.includes(e)),s&=!(c&&n.includes(`@list`)),!s)throw new r(`Invalid JSON-LD syntax; @context @container value must be one of the following: `+a.join(`, `),`jsonld.SyntaxError`,{code:`invalid container mapping`,context:t});if(g.reverse&&!n.every(e=>[`@index`,`@set`].includes(e)))throw new r(`Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.`,`jsonld.SyntaxError`,{code:`invalid reverse property`,context:t});g[`@container`]=n}if(`@index`in f){if(!(`@container`in f)||!g[`@container`].includes(`@index`))throw new r(`Invalid JSON-LD syntax; @index without @index in @container: "${f[`@index`]}" on term "${n}".`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});if(!o(f[`@index`])||f[`@index`].indexOf(`@`)===0)throw new r(`Invalid JSON-LD syntax; @index must expand to an IRI: "${f[`@index`]}" on term "${n}".`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});g[`@index`]=f[`@index`]}if(`@context`in f&&(g[`@context`]=f[`@context`]),`@language`in f&&!(`@type`in f)){let e=f[`@language`];if(e!==null&&!o(e))throw new r(`Invalid JSON-LD syntax; @context @language value must be a string or null.`,`jsonld.SyntaxError`,{code:`invalid language mapping`,context:t});e!==null&&(e=e.toLowerCase()),g[`@language`]=e}if(`@prefix`in f){if(n.match(/:|\//))throw new r(`Invalid JSON-LD syntax; @context @prefix used on a compact IRI term`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});if(v.isKeyword(g[`@id`]))throw new r(`Invalid JSON-LD syntax; keywords may not be used as prefixes`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});if(typeof f[`@prefix`]==`boolean`)g._prefix=f[`@prefix`]===!0;else throw new r(`Invalid JSON-LD syntax; @context value for @prefix must be boolean`,`jsonld.SyntaxError`,{code:`invalid @prefix value`,context:t})}if(`@direction`in f){let e=f[`@direction`];if(e!==null&&e!==`ltr`&&e!==`rtl`)throw new r(`Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".`,`jsonld.SyntaxError`,{code:`invalid base direction`,context:t});g[`@direction`]=e}if(`@nest`in f){let e=f[`@nest`];if(!o(e)||e!==`@nest`&&e.indexOf(`@`)===0)throw new r(`Invalid JSON-LD syntax; @context @nest value must be a string which is not a keyword other than @nest.`,`jsonld.SyntaxError`,{code:`invalid @nest value`,context:t});g[`@nest`]=e}let S=g[`@id`];if(S===`@context`||S===`@preserve`)throw new r(`Invalid JSON-LD syntax; @context and @preserve cannot be aliased.`,`jsonld.SyntaxError`,{code:`invalid keyword alias`,context:t});if(m&&m.protected&&!u&&(e.protected[n]=!0,g.protected=!0,!b(m,g)))throw new r(`Invalid JSON-LD syntax; tried to redefine a protected term.`,`jsonld.SyntaxError`,{code:`protected term redefinition`,context:t,term:n})},v.expandIri=(e,t,n,r)=>y(e,t,n,void 0,void 0,r);function y(e,t,n,r,i,s){if(t===null||!o(t)||v.isKeyword(t))return t;if(t.match(p))return null;if(r&&r.hasOwnProperty(t)&&i.get(t)!==!0&&v.createTermDefinition({activeCtx:e,localCtx:r,term:t,defined:i,options:s}),n||={},n.vocab){let n=e.mappings.get(t);if(n===null)return null;if(a(n)&&`@id`in n)return n[`@id`]}let l=t.indexOf(`:`);if(l>0){let n=t.substr(0,l),a=t.substr(l+1);if(n===`_`||a.indexOf(`//`)===0)return t;r&&r.hasOwnProperty(n)&&v.createTermDefinition({activeCtx:e,localCtx:r,term:n,defined:i,options:s});let o=e.mappings.get(n);if(o&&o._prefix)return o[`@id`]+a;if(c(t))return t}if(n.vocab&&`@vocab`in e)t=e[`@vocab`]+t;else if(n.base){let n,r;`@base`in e?e[`@base`]?(r=u(s.base,e[`@base`]),n=u(r,t)):(r=e[`@base`],n=t):(r=s.base,n=u(s.base,t)),t=n}return t}v.getInitialContext=e=>{let t=JSON.stringify({processingMode:e.processingMode}),r=g.get(t);if(r)return r;let i={processingMode:e.processingMode,mappings:new Map,inverse:null,getInverse:a,clone:c,revertToPreviousContext:l,protected:{}};return g.size===_&&g.clear(),g.set(t,i),i;function a(){let e=this;if(e.inverse)return e.inverse;let t=e.inverse={},n=e.fastCurieMap={},r={},i=(e[`@language`]||`@none`).toLowerCase(),a=e[`@direction`],c=e.mappings,l=[...c.keys()].sort(h);for(let e of l){let o=c.get(e);if(o===null)continue;let l=o[`@container`]||`@none`;if(l=[].concat(l).sort().join(``),o[`@id`]===null)continue;let u=m(o[`@id`]);for(let c of u){let u=t[c],d=v.isKeyword(c);if(u)!d&&!o._termHasColon&&r[c].push(e);else if(t[c]=u={},!d&&!o._termHasColon){r[c]=[e];let t={iri:c,terms:r[c]};c[0]in n?n[c[0]].push(t):n[c[0]]=[t]}if(u[l]||(u[l]={"@language":{},"@type":{},"@any":{}}),u=u[l],s(e,u[`@any`],`@none`),o.reverse)s(e,u[`@type`],`@reverse`);else if(o[`@type`]===`@none`)s(e,u[`@any`],`@none`),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`);else if(`@type`in o)s(e,u[`@type`],o[`@type`]);else if(`@language`in o&&`@direction`in o){let t=o[`@language`],n=o[`@direction`];t&&n?s(e,u[`@language`],`${t}_${n}`.toLowerCase()):t?s(e,u[`@language`],t.toLowerCase()):n?s(e,u[`@language`],`_${n}`):s(e,u[`@language`],`@null`)}else`@language`in o?s(e,u[`@language`],(o[`@language`]||`@null`).toLowerCase()):`@direction`in o?o[`@direction`]?s(e,u[`@language`],`_${o[`@direction`]}`):s(e,u[`@language`],`@none`):a?(s(e,u[`@language`],`_${a}`),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`)):(s(e,u[`@language`],i),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`))}}for(let e in n)o(n,e,1);return t}function o(e,t,n){let r=e[t],i=e[t]={},a,s;for(let e of r)a=e.iri,s=n>=a.length?``:a[n],s in i?i[s].push(e):i[s]=[e];for(let e in i)e!==``&&o(i,e,n+1)}function s(e,t,n){t.hasOwnProperty(n)||(t[n]=e)}function c(){let e={};return e.mappings=n.clone(this.mappings),e.clone=this.clone,e.inverse=null,e.getInverse=this.getInverse,e.protected=n.clone(this.protected),this.previousContext&&(e.previousContext=this.previousContext.clone()),e.revertToPreviousContext=this.revertToPreviousContext,`@base`in this&&(e[`@base`]=this[`@base`]),`@language`in this&&(e[`@language`]=this[`@language`]),`@vocab`in this&&(e[`@vocab`]=this[`@vocab`]),e}function l(){return this.previousContext?this.previousContext.clone():this}},v.getContextValue=(e,t,n)=>{if(t===null)return n===`@context`?void 0:null;if(e.mappings.has(t)){let r=e.mappings.get(t);if(s(n))return r;if(r.hasOwnProperty(n))return r[n]}if(n===`@language`&&n in e||n===`@direction`&&n in e)return e[n];if(n!==`@context`)return null},v.processingMode=(e,t)=>t.toString()>=`1.1`?!e.processingMode||e.processingMode>=`json-ld-`+t.toString():e.processingMode===`json-ld-1.0`,v.isKeyword=e=>{if(!o(e)||e[0]!==`@`)return!1;switch(e){case`@base`:case`@container`:case`@context`:case`@default`:case`@direction`:case`@embed`:case`@explicit`:case`@graph`:case`@id`:case`@included`:case`@index`:case`@json`:case`@language`:case`@list`:case`@nest`:case`@none`:case`@omitDefault`:case`@prefix`:case`@preserve`:case`@protected`:case`@requireAll`:case`@reverse`:case`@set`:case`@type`:case`@value`:case`@version`:case`@vocab`:return!0}return!1};function b(e,t){if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return e===t;let n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(!b(e[n],t[n]))return!1;return!0}let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(let n in e){let r=e[n],i=t[n];if(n===`@container`&&Array.isArray(r)&&Array.isArray(i)&&(r=r.slice().sort(),i=i.slice().sort()),!b(r,i))return!1}return!0}})),qn=o(((e,t)=>{var n=Mn(),{isArray:r,isObject:i,isEmptyObject:a,isString:o,isUndefined:s}=An(),{isList:c,isValue:l,isGraph:u,isSubject:d}=jn(),{expandIri:f,getContextValue:p,isKeyword:m,process:h,processingMode:g}=Kn(),{isAbsolute:_}=In(),{REGEX_BCP47:v,REGEX_KEYWORD:y,addValue:b,asArray:x,getValues:S,validateTypeValue:C}=Nn(),{handleEvent:w}=Gn(),T={};t.exports=T,T.expand=async({activeCtx:e,activeProperty:t=null,element:c,options:l={},insideList:u=!1,insideIndex:d=!1,typeScopedContext:m=null})=>{if(c==null)return null;if(t===`@default`&&(l=Object.assign({},l,{isFrame:!1})),!r(c)&&!i(c))return!u&&(t===null||f(e,t,{vocab:!0},l)===`@graph`)?(l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`free-floating scalar`,level:`warning`,message:`Dropping free-floating scalar not in a list.`,details:{value:c}},options:l}),null):O({activeCtx:e,activeProperty:t,value:c,options:l});if(r(c)){let n=[],i=p(e,t,`@container`)||[];u||=i.includes(`@list`);for(let i=0;i<c.length;++i){let a=await T.expand({activeCtx:e,activeProperty:t,element:c[i],options:l,insideIndex:d,typeScopedContext:m});u&&r(a)&&(a={"@list":a}),a!==null&&(r(a)?n=n.concat(a):n.push(a))}return n}let v=f(e,t,{vocab:!0},l),y=p(e,t,`@context`);m||=e.previousContext?e:null;let b=Object.keys(c).sort(),C=!d;if(C&&m&&b.length<=2&&!b.includes(`@context`))for(let t of b){let n=f(m,t,{vocab:!0},l);if(n===`@value`){C=!1,e=m;break}if(n===`@id`&&b.length===1){C=!1;break}}C&&(e=e.revertToPreviousContext()),s(y)||(e=await h({activeCtx:e,localCtx:y,propagate:!0,overrideProtected:!0,options:l})),`@context`in c&&(e=await h({activeCtx:e,localCtx:c[`@context`],options:l})),m=e;let k=null;for(let t of b)if(f(e,t,{vocab:!0},l)===`@type`){k||=t;let n=c[t],r=Array.isArray(n)?n.length>1?n.slice().sort():n:[n];for(let t of r){let n=p(m,t,`@context`);s(n)||(e=await h({activeCtx:e,localCtx:n,options:l,propagate:!1}))}}let A={};await D({activeCtx:e,activeProperty:t,expandedActiveProperty:v,element:c,expandedParent:A,options:l,insideList:u,typeKey:k,typeScopedContext:m}),b=Object.keys(A);let j=b.length;if(`@value`in A){if(`@type`in A&&(`@language`in A||`@direction`in A))throw new n(`Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and either "@language" or "@direction".`,`jsonld.SyntaxError`,{code:`invalid value object`,element:A});let t=j-1;if(`@type`in A&&--t,`@index`in A&&--t,`@language`in A&&--t,`@direction`in A&&--t,t!==0)throw new n(`Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and either "@type" or either or both "@language" or "@direction".`,`jsonld.SyntaxError`,{code:`invalid value object`,element:A});let r=A[`@value`]===null?[]:x(A[`@value`]),i=S(A,`@type`);if(!(g(e,1.1)&&i.includes(`@json`)&&i.length===1)){if(r.length===0)l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`null @value value`,level:`warning`,message:`Dropping null @value value.`,details:{value:A}},options:l}),A=null;else if(!r.every(e=>o(e)||a(e))&&`@language`in A)throw new n(`Invalid JSON-LD syntax; only strings may be language-tagged.`,`jsonld.SyntaxError`,{code:`invalid language-tagged value`,element:A});else if(!i.every(e=>_(e)&&!(o(e)&&e.indexOf(`_:`)===0)||a(e)))throw new n(`Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".`,`jsonld.SyntaxError`,{code:`invalid typed value`,element:A})}}else if(`@type`in A&&!r(A[`@type`]))A[`@type`]=[A[`@type`]];else if(`@set`in A||`@list`in A){if(j>1&&!(j===2&&`@index`in A))throw new n(`Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".`,`jsonld.SyntaxError`,{code:`invalid set or list object`,element:A});`@set`in A&&(A=A[`@set`],b=Object.keys(A),j=b.length)}else j===1&&`@language`in A&&(l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`object with only @language`,level:`warning`,message:`Dropping object with only @language.`,details:{value:A}},options:l}),A=null);return i(A)&&!l.keepFreeFloatingNodes&&!u&&(t===null||v===`@graph`||(p(e,t,`@container`)||[]).includes(`@graph`))&&(A=E({value:A,count:j,options:l})),A};function E({value:e,count:t,options:n}){if(t===0||`@value`in e||`@list`in e||t===1&&`@id`in e){if(n.eventHandler){let r,i;t===0?(r=`empty object`,i=`Dropping empty object.`):`@value`in e?(r=`object with only @value`,i=`Dropping object with only @value.`):`@list`in e?(r=`object with only @list`,i=`Dropping object with only @list.`):t===1&&`@id`in e&&(r=`object with only @id`,i=`Dropping object with only @id.`),w({event:{type:[`JsonLdEvent`],code:r,level:`warning`,message:i,details:{value:e}},options:n})}return null}return e}async function D({activeCtx:e,activeProperty:t,expandedActiveProperty:u,element:y,expandedParent:S,options:O={},insideList:j,typeKey:M,typeScopedContext:N}){let P=Object.keys(y).sort(),F=[],I,L=y[M]&&f(e,r(y[M])?y[M][0]:y[M],{vocab:!0},{...O,typeExpansion:!0})===`@json`;for(let D of P){let j=y[D],M;if(D===`@context`)continue;let P=f(e,D,{vocab:!0},O);if(P===null||!(_(P)||m(P))){O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid property`,level:`warning`,message:`Dropping property that did not expand into an absolute IRI or keyword.`,details:{property:D,expandedProperty:P}},options:O});continue}if(m(P)){if(u===`@reverse`)throw new n(`Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.`,`jsonld.SyntaxError`,{code:`invalid reverse property map`,value:j});if(P in S&&P!==`@included`&&P!==`@type`)throw new n(`Invalid JSON-LD syntax; colliding keywords detected.`,`jsonld.SyntaxError`,{code:`colliding keywords`,keyword:P})}if(P===`@id`){if(!o(j)){if(!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@id" value must a string.`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j});if(i(j)){if(!a(j))throw new n(`Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j})}else if(r(j)){if(!j.every(e=>o(e)))throw new n(`Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j})}else throw new n(`Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j})}b(S,`@id`,x(j).map(t=>{if(o(t)){let n=f(e,t,{base:!0},O);return O.eventHandler&&(n===null?w(t===null?{event:{type:[`JsonLdEvent`],code:`null @id value`,level:`warning`,message:`Null @id found.`,details:{id:t}},options:O}:{event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`Reserved @id found.`,details:{id:t}},options:O}):_(n)||w({event:{type:[`JsonLdEvent`],code:`relative @id reference`,level:`warning`,message:`Relative @id reference found.`,details:{id:t,expandedId:n}},options:O})),n}return t}),{propertyIsArray:O.isFrame});continue}if(P===`@type`){i(j)&&(j=Object.fromEntries(Object.entries(j).map(([e,t])=>[f(N,e,{vocab:!0}),x(t).map(e=>f(N,e,{base:!0,vocab:!0},{...O,typeExpansion:!0}))]))),C(j,O.isFrame),b(S,`@type`,x(j).map(e=>{if(o(e)){let t=f(N,e,{base:!0,vocab:!0},{...O,typeExpansion:!0});return t!==`@json`&&!_(t)&&O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`relative @type reference`,level:`warning`,message:`Relative @type reference found.`,details:{type:e}},options:O}),t}return e}),{propertyIsArray:!!O.isFrame});continue}if(P===`@included`&&g(e,1.1)){let r=x(await T.expand({activeCtx:e,activeProperty:t,element:j,options:O}));if(!r.every(e=>d(e)))throw new n(`Invalid JSON-LD syntax; values of @included must expand to node objects.`,`jsonld.SyntaxError`,{code:`invalid @included value`,value:j});b(S,`@included`,r,{propertyIsArray:!0});continue}if(P===`@graph`&&!(i(j)||r(j)))throw new n(`Invalid JSON-LD syntax; "@graph" value must not be an object or an array.`,`jsonld.SyntaxError`,{code:`invalid @graph value`,value:j});if(P===`@value`){I=j,L&&g(e,1.1)?S[`@value`]=j:b(S,`@value`,j,{propertyIsArray:O.isFrame});continue}if(P===`@language`){if(j===null)continue;if(!o(j)&&!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@language" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid language-tagged string`,value:j});j=x(j).map(e=>o(e)?e.toLowerCase():e);for(let e of j)o(e)&&!e.match(v)&&O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:O});b(S,`@language`,j,{propertyIsArray:O.isFrame});continue}if(P===`@direction`){if(!o(j)&&!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@direction" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid base direction`,value:j});j=x(j);for(let e of j)if(o(e)&&e!==`ltr`&&e!==`rtl`)throw new n(`Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".`,`jsonld.SyntaxError`,{code:`invalid base direction`,value:j});b(S,`@direction`,j,{propertyIsArray:O.isFrame});continue}if(P===`@index`){if(!o(j))throw new n(`Invalid JSON-LD syntax; "@index" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid @index value`,value:j});b(S,`@index`,j);continue}if(P===`@reverse`){if(!i(j))throw new n(`Invalid JSON-LD syntax; "@reverse" value must be an object.`,`jsonld.SyntaxError`,{code:`invalid @reverse value`,value:j});if(M=await T.expand({activeCtx:e,activeProperty:`@reverse`,element:j,options:O}),`@reverse`in M)for(let e in M[`@reverse`])b(S,e,M[`@reverse`][e],{propertyIsArray:!0});let t=S[`@reverse`]||null;for(let e in M){if(e===`@reverse`)continue;t===null&&(t=S[`@reverse`]={}),b(t,e,[],{propertyIsArray:!0});let r=M[e];for(let i=0;i<r.length;++i){let a=r[i];if(l(a)||c(a))throw new n(`Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.`,`jsonld.SyntaxError`,{code:`invalid reverse property value`,value:M});b(t,e,a,{propertyIsArray:!0})}}continue}if(P===`@nest`){F.push(D);continue}let R=e,z=p(e,D,`@context`);s(z)||(R=await h({activeCtx:e,localCtx:z,propagate:!0,overrideProtected:!0,options:O}));let B=p(e,D,`@container`)||[];if(B.includes(`@language`)&&i(j)){let e=p(R,D,`@direction`);M=k(R,j,e,O)}else if(B.includes(`@index`)&&i(j)){let t=B.includes(`@graph`),n=p(R,D,`@index`)||`@index`,r=n!==`@index`&&f(e,n,{vocab:!0},O);M=await A({activeCtx:R,options:O,activeProperty:D,value:j,asGraph:t,indexKey:n,propertyIndex:r})}else if(B.includes(`@id`)&&i(j)){let e=B.includes(`@graph`);M=await A({activeCtx:R,options:O,activeProperty:D,value:j,asGraph:e,indexKey:`@id`})}else if(B.includes(`@type`)&&i(j))M=await A({activeCtx:R.revertToPreviousContext(),options:O,activeProperty:D,value:j,asGraph:!1,indexKey:`@type`});else{let n=P===`@list`;if(n||P===`@set`){let e=t;n&&u===`@graph`&&(e=null),M=await T.expand({activeCtx:R,activeProperty:e,element:j,options:O,insideList:n})}else M=p(e,D,`@type`)===`@json`?{"@type":`@json`,"@value":j}:await T.expand({activeCtx:R,activeProperty:D,element:j,options:O,insideList:!1})}if(!(M===null&&P!==`@value`)){if(P!==`@list`&&!c(M)&&B.includes(`@list`)&&(M={"@list":x(M)}),B.includes(`@graph`)&&!B.some(e=>e===`@id`||e===`@index`)){if(M=x(M),O.isFrame||(M=M.filter(e=>{let t=Object.keys(e).length;return E({value:e,count:t,options:O})!==null})),M.length===0)continue;M=M.map(e=>({"@graph":x(e)}))}if(R.mappings.has(D)&&R.mappings.get(D).reverse){let e=S[`@reverse`]=S[`@reverse`]||{};M=x(M);for(let t=0;t<M.length;++t){let r=M[t];if(l(r)||c(r))throw new n(`Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.`,`jsonld.SyntaxError`,{code:`invalid reverse property value`,value:M});b(e,P,r,{propertyIsArray:!0})}continue}b(S,P,M,{propertyIsArray:!0})}}if(`@value`in S&&!(S[`@type`]===`@json`&&g(e,1.1))&&(i(I)||r(I))&&!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@value" value must not be an object or an array.`,`jsonld.SyntaxError`,{code:`invalid value object value`,value:I});for(let a of F){let o=r(y[a])?y[a]:[y[a]];for(let r of o){if(!i(r)||Object.keys(r).some(t=>f(e,t,{vocab:!0},O)===`@value`))throw new n(`Invalid JSON-LD syntax; nested value must be a node object.`,`jsonld.SyntaxError`,{code:`invalid @nest value`,value:r});await D({activeCtx:e,activeProperty:t,expandedActiveProperty:u,element:r,expandedParent:S,options:O,insideList:j,typeScopedContext:N,typeKey:M})}}}function O({activeCtx:e,activeProperty:t,value:n,options:r}){if(n==null)return null;let i=f(e,t,{vocab:!0},r);if(i===`@id`)return f(e,n,{base:!0},r);if(i===`@type`)return f(e,n,{vocab:!0,base:!0},{...r,typeExpansion:!0});let a=p(e,t,`@type`);if((a===`@id`||i===`@graph`)&&o(n)){let i=f(e,n,{base:!0},r);return i===null&&n.match(y)&&r.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`Reserved @id found.`,details:{id:t}},options:r}),{"@id":i}}if(a===`@vocab`&&o(n))return{"@id":f(e,n,{vocab:!0,base:!0},r)};if(m(i))return n;let s={};if(a&&![`@id`,`@vocab`,`@none`].includes(a))s[`@type`]=a;else if(o(n)){let n=p(e,t,`@language`);n!==null&&(s[`@language`]=n);let r=p(e,t,`@direction`);r!==null&&(s[`@direction`]=r)}return[`boolean`,`number`,`string`].includes(typeof n)||(n=n.toString()),s[`@value`]=n,s}function k(e,t,i,a){let s=[],c=Object.keys(t).sort();for(let l of c){let c=f(e,l,{vocab:!0},a),u=t[l];r(u)||(u=[u]);for(let e of u){if(e===null)continue;if(!o(e))throw new n(`Invalid JSON-LD syntax; language map values must be strings.`,`jsonld.SyntaxError`,{code:`invalid language map value`,languageMap:t});let r={"@value":e};c!==`@none`&&(l.match(v)||a.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:l}},options:a}),r[`@language`]=l.toLowerCase()),i&&(r[`@direction`]=i),s.push(r)}}return s}async function A({activeCtx:e,options:t,activeProperty:i,value:a,asGraph:o,indexKey:c,propertyIndex:d}){let m=[],g=Object.keys(a).sort(),_=c===`@type`;for(let v of g){if(_){let n=p(e,v,`@context`);s(n)||(e=await h({activeCtx:e,localCtx:n,propagate:!1,options:t}))}let g=a[v];r(g)||(g=[g]),g=await T.expand({activeCtx:e,activeProperty:i,element:g,options:t,insideList:!1,insideIndex:!0});let y;y=d?v===`@none`?`@none`:O({activeCtx:e,activeProperty:c,value:v,options:t}):f(e,v,{vocab:!0},t),c===`@id`?v=f(e,v,{base:!0},t):_&&(v=y);for(let e of g){if(o&&!u(e)&&(e={"@graph":[e]}),c===`@type`)y===`@none`||(e[`@type`]?e[`@type`]=[v].concat(e[`@type`]):e[`@type`]=[v]);else if(l(e)&&![`@language`,`@type`,`@index`].includes(c))throw new n(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${c}".`,`jsonld.SyntaxError`,{code:`invalid value object`,value:e});else d?y!==`@none`&&b(e,d,y,{propertyIsArray:!0,prependValue:!0}):y!==`@none`&&!(c in e)&&(e[c]=v);m.push(e)}}return m}})),Jn=o(((e,t)=>{var{isKeyword:n}=Kn(),r=jn(),i=An(),a=Nn(),o=Mn(),s={};t.exports=s,s.createMergedNodeMap=(e,t)=>{t||={};let n=t.issuer||new a.IdentifierIssuer(`_:b`),r={"@default":{}};return s.createNodeMap(e,r,`@default`,n),s.mergeNodeMaps(r)},s.createNodeMap=(e,t,c,l,u,d)=>{if(i.isArray(e)){for(let n of e)s.createNodeMap(n,t,c,l,void 0,d);return}if(!i.isObject(e)){d&&d.push(e);return}if(r.isValue(e)){if(`@type`in e){let t=e[`@type`];t.indexOf(`_:`)===0&&(e[`@type`]=t=l.getId(t))}d&&d.push(e);return}else if(d&&r.isList(e)){let n=[];s.createNodeMap(e[`@list`],t,c,l,u,n),d.push({"@list":n});return}if(`@type`in e){let t=e[`@type`];for(let e of t)e.indexOf(`_:`)===0&&l.getId(e)}i.isUndefined(u)&&(u=r.isBlankNode(e)?l.getId(e[`@id`]):e[`@id`]),d&&d.push({"@id":u});let f=t[c],p=f[u]=f[u]||{};p[`@id`]=u;let m=Object.keys(e).sort();for(let i of m){if(i===`@id`)continue;if(i===`@reverse`){let n={"@id":u},i=e[`@reverse`];for(let e in i){let o=i[e];for(let i of o){let o=i[`@id`];r.isBlankNode(i)&&(o=l.getId(o)),s.createNodeMap(i,t,c,l,o),a.addValue(f[o],e,n,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if(i===`@graph`){u in t||(t[u]={}),s.createNodeMap(e[i],t,u,l);continue}if(i===`@included`){s.createNodeMap(e[i],t,c,l);continue}if(i!==`@type`&&n(i)){if(i===`@index`&&i in p&&(e[i]!==p[i]||e[i][`@id`]!==p[i][`@id`]))throw new o(`Invalid JSON-LD syntax; conflicting @index property detected.`,`jsonld.SyntaxError`,{code:`conflicting indexes`,subject:p});p[i]=e[i];continue}let d=e[i];if(i.indexOf(`_:`)===0&&(i=l.getId(i)),d.length===0){a.addValue(p,i,[],{propertyIsArray:!0});continue}for(let e of d)if(i===`@type`&&(e=e.indexOf(`_:`)===0?l.getId(e):e),r.isSubject(e)||r.isSubjectReference(e)){if(`@id`in e&&!e[`@id`])continue;let n=r.isBlankNode(e)?l.getId(e[`@id`]):e[`@id`];a.addValue(p,i,{"@id":n},{propertyIsArray:!0,allowDuplicate:!1}),s.createNodeMap(e,t,c,l,n)}else if(r.isValue(e))a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1});else if(r.isList(e)){let n=[];s.createNodeMap(e[`@list`],t,c,l,u,n),e={"@list":n},a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1})}else s.createNodeMap(e,t,c,l,u),a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1})}},s.mergeNodeMapGraphs=e=>{let t={};for(let r of Object.keys(e).sort())for(let i of Object.keys(e[r]).sort()){let o=e[r][i];i in t||(t[i]={"@id":i});let s=t[i];for(let e of Object.keys(o).sort())if(n(e)&&e!==`@type`)s[e]=a.clone(o[e]);else for(let t of o[e])a.addValue(s,e,a.clone(t),{propertyIsArray:!0,allowDuplicate:!1})}return t},s.mergeNodeMaps=e=>{let t=e[`@default`],n=Object.keys(e).sort();for(let i of n){if(i===`@default`)continue;let n=e[i],a=t[i];a?`@graph`in a||(a[`@graph`]=[]):t[i]=a={"@id":i,"@graph":[]};let o=a[`@graph`];for(let e of Object.keys(n).sort()){let t=n[e];r.isSubjectReference(t)||o.push(t)}}return t}})),Yn=o(((e,t)=>{var{isSubjectReference:n}=jn(),{createMergedNodeMap:r}=Jn(),i={};t.exports=i,i.flatten=e=>{let t=r(e),i=[],a=Object.keys(t).sort();for(let e=0;e<a.length;++e){let r=t[a[e]];n(r)||i.push(r)}return i}})),Xn=o(((e,t)=>{var n=Mn(),r=jn(),i=An(),{REGEX_BCP47:a,addValue:o}=Nn(),{handleEvent:s}=Gn(),{RDF_LIST:c,RDF_FIRST:l,RDF_REST:u,RDF_NIL:d,RDF_TYPE:f,RDF_JSON_LITERAL:p,XSD_BOOLEAN:m,XSD_DOUBLE:h,XSD_INTEGER:g,XSD_STRING:_}=Pn(),v={};t.exports=v,v.fromRDF=async(e,t)=>{let{useRdfType:a=!1,useNativeTypes:s=!1,rdfDirection:p=null}=t,m={},h={"@default":m},g={};if(p){if(p===`compound-literal`)throw new n(`Unsupported rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:p});if(p!==`i18n-datatype`)throw new n(`Unknown rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:p})}for(let n of e){let e=n.graph.termType===`DefaultGraph`?`@default`:n.graph.value;e in h||(h[e]={}),e!==`@default`&&!(e in m)&&(m[e]={"@id":e});let r=h[e],i=b(n.subject),c=n.predicate.value,l=n.object;i in r||(r[i]={"@id":i});let u=r[i],_=b(l),v=!!_;if(v&&!(_ in r)&&(r[_]={"@id":_}),c===f&&!a&&v){o(u,`@type`,_,{propertyIsArray:!0});continue}let x=y(l,s,p,t);if(o(u,c,x,{propertyIsArray:!0}),v)if(_===d){let e=r[_];`usages`in e||(e.usages=[]),e.usages.push({node:u,property:c,value:x})}else _ in g?g[_]=!1:g[_]={node:u,property:c,value:x}}for(let e in h){let t=h[e];if(!(d in t))continue;let n=t[d];if(n.usages){for(let e of n.usages){let n=e.node,a=e.property,o=e.value,s=[],d=[],f=Object.keys(n).length;for(;a===u&&i.isObject(g[n[`@id`]])&&i.isArray(n[l])&&n[l].length===1&&i.isArray(n[u])&&n[u].length===1&&(f===3||f===4&&i.isArray(n[`@type`])&&n[`@type`].length===1&&n[`@type`][0]===c)&&(s.push(n[l][0]),d.push(n[`@id`]),e=g[n[`@id`]],n=e.node,a=e.property,o=e.value,f=Object.keys(n).length,r.isBlankNode(n)););delete o[`@id`],o[`@list`]=s.reverse();for(let e of d)delete t[e]}delete n.usages}}let _=[],v=Object.keys(m).sort();for(let e of v){let t=m[e];if(e in h){let n=t[`@graph`]=[],i=h[e],a=Object.keys(i).sort();for(let e of a){let t=i[e];r.isSubjectReference(t)||n.push(t)}}r.isSubjectReference(t)||_.push(t)}return _};function y(e,t,r,o){let c=b(e);if(c)return{"@id":c};let l={"@value":e.value};if(e.language)e.language.match(a)||o.eventHandler&&s({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e.language}},options:o}),l[`@language`]=e.language;else{let c=e.datatype.value;if(c||=_,c===p){c=`@json`;try{l[`@value`]=JSON.parse(l[`@value`])}catch(e){throw new n(`JSON literal could not be parsed.`,`jsonld.InvalidJsonLiteral`,{code:`invalid JSON literal`,value:l[`@value`],cause:e})}}if(t)if(c===m)l[`@value`]===`true`||l[`@value`]===`1`?l[`@value`]=!0:l[`@value`]===`false`||l[`@value`]===`0`?l[`@value`]=!1:l[`@type`]=c;else if(c===g)if(i.isNumeric(l[`@value`])){let e=parseInt(l[`@value`],10);e.toFixed(0)===l[`@value`]&&(l[`@value`]=e)}else l[`@type`]=c;else c===h&&i.isNumeric(l[`@value`])?l[`@value`]=parseFloat(l[`@value`]):l[`@type`]=c;else if(r===`i18n-datatype`&&c.startsWith(`https://www.w3.org/ns/i18n#`)){let[,e,t]=c.split(/[#_]/);e.length>0&&(l[`@language`]=e,e.match(a)||o.eventHandler&&s({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:o})),l[`@direction`]=t}else c!==_&&(l[`@type`]=c)}return l}function b(e){return e.termType===`NamedNode`?e.value:e.termType===`BlankNode`?`_:`+e.value:null}})),Zn=o(((e,t)=>{t.exports=function e(t){if(typeof t==`number`&&isNaN(t))throw Error(`NaN is not allowed`);if(typeof t==`number`&&!isFinite(t))throw Error(`Infinity is not allowed`);return typeof t!=`object`||!t?JSON.stringify(t):t.toJSON instanceof Function?e(t.toJSON()):Array.isArray(t)?`[${t.reduce((t,n,r)=>`${t}${r===0?``:`,`}${e(n===void 0||typeof n==`symbol`?null:n)}`,``)}]`:`{${Object.keys(t).sort().reduce((n,r)=>t[r]===void 0||typeof t[r]==`symbol`?n:`${n}${n.length===0?``:`,`}${e(r)}:${e(t[r])}`,``)}}`}})),Qn=o(((e,t)=>{var{createNodeMap:n}=Jn(),{isKeyword:r}=Kn(),i=jn(),a=Zn(),o=Mn(),s=An(),c=Nn(),{handleEvent:l}=Gn(),{RDF_FIRST:u,RDF_REST:d,RDF_NIL:f,RDF_TYPE:p,RDF_JSON_LITERAL:m,RDF_LANGSTRING:h,XSD_BOOLEAN:g,XSD_DOUBLE:_,XSD_INTEGER:v,XSD_STRING:y}=Pn(),{isAbsolute:b}=In(),x={};t.exports=x,x.toRDF=(e,t)=>{let r=new c.IdentifierIssuer(`_:b`),i={"@default":{}};n(e,i,`@default`,r);let a=[],o=Object.keys(i).sort();for(let e of o){let n;if(e===`@default`)n={termType:`DefaultGraph`,value:``};else if(b(e))n=T(e);else{t.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative graph reference`,level:`warning`,message:`Relative graph reference found.`,details:{graph:e}},options:t});continue}S(a,i[e],n,r,t)}return a};function S(e,t,n,i,a){let o=Object.keys(t).sort();for(let s of o){let o=t[s],c=Object.keys(o).sort();for(let t of c){let c=o[t];if(t===`@type`)t=p;else if(r(t))continue;for(let r of c){let o=T(s);if(!b(s)){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative subject reference`,level:`warning`,message:`Relative subject reference found.`,details:{subject:s}},options:a});continue}let c=T(t);if(!b(t)){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative predicate reference`,level:`warning`,message:`Relative predicate reference found.`,details:{predicate:t}},options:a});continue}if(c.termType===`BlankNode`&&!a.produceGeneralizedRdf){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`blank node predicate`,level:`warning`,message:`Dropping blank node predicate.`,details:{property:i.getOldIds().find(e=>i.getId(e)===t)}},options:a});continue}let u=w(r,i,e,n,a.rdfDirection,a);u&&e.push({subject:o,predicate:c,object:u,graph:n})}}}}function C(e,t,n,r,i,a){let o={termType:`NamedNode`,value:u},s={termType:`NamedNode`,value:d},c={termType:`NamedNode`,value:f},l=e.pop(),p=l?{termType:`BlankNode`,value:t.getId().slice(2)}:c,m=p;for(let c of e){let e=w(c,t,n,r,i,a),l={termType:`BlankNode`,value:t.getId().slice(2)};n.push({subject:m,predicate:o,object:e,graph:r}),n.push({subject:m,predicate:s,object:l,graph:r}),m=l}if(l){let e=w(l,t,n,r,i,a);n.push({subject:m,predicate:o,object:e,graph:r}),n.push({subject:m,predicate:s,object:c,graph:r})}return p}function w(e,t,n,r,c,u){let d;if(i.isValue(e)){d={termType:`Literal`,value:void 0,datatype:{termType:`NamedNode`}};let t=e[`@value`],n=e[`@type`]||null;if(n===`@json`)d.value=a(t),d.datatype.value=m;else if(s.isBoolean(t))d.value=t.toString(),d.datatype.value=n||g;else if(s.isDouble(t)||n===_)s.isDouble(t)||(t=parseFloat(t)),d.value=t.toExponential(15).replace(/(\d)0*e\+?/,`$1E`),d.datatype.value=n||_;else if(s.isNumber(t))d.value=t.toFixed(0),d.datatype.value=n||v;else if(`@direction`in e&&c===`i18n-datatype`){let n=`https://www.w3.org/ns/i18n#${(e[`@language`]||``).toLowerCase()}_${e[`@direction`]}`;d.datatype.value=n,d.value=t}else if(`@direction`in e&&c===`compound-literal`)throw new o(`Unsupported rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:c});else if(`@direction`in e&&c)throw new o(`Unknown rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:c});else`@language`in e?(`@direction`in e&&!c&&u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`rdfDirection not set`,level:`warning`,message:`rdfDirection not set for @direction.`,details:{object:d.value}},options:u}),d.value=t,d.datatype.value=n||h,d.language=e[`@language`]):(`@direction`in e&&!c&&u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`rdfDirection not set`,level:`warning`,message:`rdfDirection not set for @direction.`,details:{object:d.value}},options:u}),d.value=t,d.datatype.value=n||y)}else if(i.isList(e)){let i=C(e[`@list`],t,n,r,c,u);d={termType:i.termType,value:i.value}}else d=T(s.isObject(e)?e[`@id`]:e);return d.termType===`NamedNode`&&!b(d.value)?(u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative object reference`,level:`warning`,message:`Relative object reference found.`,details:{object:d.value}},options:u}),null):d}function T(e){return e.startsWith(`_:`)?{termType:`BlankNode`,value:e.slice(2)}:{termType:`NamedNode`,value:e}}})),$n=o(((e,t)=>{var{isKeyword:n}=Kn(),r=jn(),i=An(),a=Nn(),o=In(),s=Mn(),{createNodeMap:c,mergeNodeMapGraphs:l}=Jn(),u={};t.exports=u,u.frameMergedOrDefault=(e,t,n)=>{let r={options:n,embedded:!1,graph:`@default`,graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},i=new a.IdentifierIssuer(`_:b`);c(e,r.graphMap,`@default`,i),n.merged&&(r.graphMap[`@merged`]=l(r.graphMap),r.graph=`@merged`),r.subjects=r.graphMap[r.graph];let o=[];return u.frame(r,Object.keys(r.subjects).sort(),t,o),n.pruneBlankNodeIdentifiers&&(n.bnodesToClear=Object.keys(r.bnodeMap).filter(e=>r.bnodeMap[e].length===1)),n.link={},v(o,n)},u.frame=(e,t,o,c,l=null)=>{m(o),o=o[0];let g=e.options,v={embed:p(o,g,`embed`),explicit:p(o,g,`explicit`),requireAll:p(o,g,`requireAll`)};e.link.hasOwnProperty(e.graph)||(e.link[e.graph]={});let b=e.link[e.graph],S=h(e,t,o,v),C=Object.keys(S).sort();for(let m of C){let h=S[m];if(l===null?e.uniqueEmbeds={[e.graph]:{}}:e.uniqueEmbeds[e.graph]=e.uniqueEmbeds[e.graph]||{},v.embed===`@link`&&m in b){y(c,l,b[m]);continue}let C={"@id":m};if(m.indexOf(`_:`)===0&&a.addValue(e.bnodeMap,m,C,{propertyIsArray:!0}),b[m]=C,(v.embed===`@first`||v.embed===`@last`)&&e.is11)throw new s(`Invalid JSON-LD syntax; invalid value of @embed.`,`jsonld.SyntaxError`,{code:`invalid @embed value`,frame:o});if(!(!e.embedded&&e.uniqueEmbeds[e.graph].hasOwnProperty(m))){if(e.embedded&&(v.embed===`@never`||f(h,e.graph,e.subjectStack))){y(c,l,C);continue}if(e.embedded&&(v.embed==`@first`||v.embed==`@once`)&&e.uniqueEmbeds[e.graph].hasOwnProperty(m)){y(c,l,C);continue}if(v.embed===`@last`&&m in e.uniqueEmbeds[e.graph]&&_(e,m),e.uniqueEmbeds[e.graph][m]={parent:c,property:l},e.subjectStack.push({subject:h,graph:e.graph}),m in e.graphMap){let t=!1,n=null;`@graph`in o?(n=o[`@graph`][0],t=!(m===`@merged`||m===`@default`),i.isObject(n)||(n={})):(t=e.graph!==`@merged`,n={}),t&&u.frame({...e,graph:m,embedded:!1},Object.keys(e.graphMap[m]).sort(),[n],C,`@graph`)}`@included`in o&&u.frame({...e,embedded:!1},t,o[`@included`],C,`@included`);for(let t of Object.keys(h).sort()){if(n(t)){if(C[t]=a.clone(h[t]),t===`@type`)for(let t of h[`@type`])t.indexOf(`_:`)===0&&a.addValue(e.bnodeMap,t,C,{propertyIsArray:!0});continue}if(!(v.explicit&&!(t in o)))for(let n of h[t]){let i=t in o?o[t]:d(v);if(r.isList(n)){let i=o[t]&&o[t][0]&&o[t][0][`@list`]?o[t][0][`@list`]:d(v),s={"@list":[]};y(C,t,s);let c=n[`@list`];for(let t of c)r.isSubjectReference(t)?u.frame({...e,embedded:!0},[t[`@id`]],i,s,`@list`):y(s,`@list`,a.clone(t))}else r.isSubjectReference(n)?u.frame({...e,embedded:!0},[n[`@id`]],i,C,t):x(i[0],n)&&y(C,t,a.clone(n))}}for(let e of Object.keys(o).sort()){if(e===`@type`){if(!i.isObject(o[e][0])||!(`@default`in o[e][0]))continue}else if(n(e))continue;let t=o[e][0]||{};if(!p(t,g,`omitDefault`)&&!(e in C)){let n=`@null`;`@default`in t&&(n=a.clone(t[`@default`])),i.isArray(n)||(n=[n]),C[e]=[{"@preserve":n}]}}for(let t of Object.keys(o[`@reverse`]||{}).sort()){let n=o[`@reverse`][t];for(let r of Object.keys(e.subjects))a.getValues(e.subjects[r],t).some(e=>e[`@id`]===m)&&(C[`@reverse`]=C[`@reverse`]||{},a.addValue(C[`@reverse`],t,[],{propertyIsArray:!0}),u.frame({...e,embedded:!0},[r],n,C[`@reverse`][t],l))}y(c,l,C),e.subjectStack.pop()}}},u.cleanupNull=(e,t)=>{if(i.isArray(e))return e.map(e=>u.cleanupNull(e,t)).filter(e=>e);if(e===`@null`)return null;if(i.isObject(e)){if(`@id`in e){let n=e[`@id`];if(t.link.hasOwnProperty(n)){let r=t.link[n].indexOf(e);if(r!==-1)return t.link[n][r];t.link[n].push(e)}else t.link[n]=[e]}for(let n in e)e[n]=u.cleanupNull(e[n],t)}return e};function d(e){let t={};for(let n in e)e[n]!==void 0&&(t[`@`+n]=[e[n]]);return[t]}function f(e,t,n){for(let r=n.length-1;r>=0;--r){let i=n[r];if(i.graph===t&&i.subject[`@id`]===e[`@id`])return!0}return!1}function p(e,t,n){let r=`@`+n,i=r in e?e[r][0]:t[n];if(n===`embed`){if(i===!0)i=`@once`;else if(i===!1)i=`@never`;else if(i!==`@always`&&i!==`@never`&&i!==`@link`&&i!==`@first`&&i!==`@last`&&i!==`@once`)throw new s(`Invalid JSON-LD syntax; invalid value of @embed.`,`jsonld.SyntaxError`,{code:`invalid @embed value`,frame:e})}return i}function m(e){if(!i.isArray(e)||e.length!==1||!i.isObject(e[0]))throw new s(`Invalid JSON-LD syntax; a JSON-LD frame must be a single object.`,`jsonld.SyntaxError`,{frame:e});if(`@id`in e[0]){for(let t of a.asArray(e[0][`@id`]))if(!(i.isObject(t)||o.isAbsolute(t))||i.isString(t)&&t.indexOf(`_:`)===0)throw new s(`Invalid JSON-LD syntax; invalid @id in frame.`,`jsonld.SyntaxError`,{code:`invalid frame`,frame:e})}if(`@type`in e[0]){for(let t of a.asArray(e[0][`@type`]))if(!(i.isObject(t)||o.isAbsolute(t)||t===`@json`)||i.isString(t)&&t.indexOf(`_:`)===0)throw new s(`Invalid JSON-LD syntax; invalid @type in frame.`,`jsonld.SyntaxError`,{code:`invalid frame`,frame:e})}}function h(e,t,n,r){let i={};for(let a of t){let t=e.graphMap[e.graph][a];g(e,t,n,r)&&(i[a]=t)}return i}function g(e,t,o,s){let c=!0,l=!1;for(let u in o){let d=!1,f=a.getValues(t,u),p=a.getValues(o,u).length===0;if(u===`@id`){if(i.isEmptyObject(o[`@id`][0]||{})?d=!0:o[`@id`].length>=0&&(d=o[`@id`].includes(f[0])),!s.requireAll)return d}else if(u===`@type`){if(c=!1,p){if(f.length>0)return!1;d=!0}else if(o[`@type`].length===1&&i.isEmptyObject(o[`@type`][0]))d=f.length>0;else for(let e of o[`@type`])i.isObject(e)&&`@default`in e?d=!0:d||=f.some(t=>t===e);if(!s.requireAll)return d}else if(n(u))continue;else{let t=a.getValues(o,u)[0],n=!1;if(t&&(m([t]),n=`@default`in t),c=!1,f.length===0&&n)continue;if(f.length>0&&p)return!1;if(t===void 0){if(f.length>0)return!1;d=!0}else if(r.isList(t)){let n=t[`@list`][0];if(r.isList(f[0])){let t=f[0][`@list`];r.isValue(n)?d=t.some(e=>x(n,e)):(r.isSubject(n)||r.isSubjectReference(n))&&(d=t.some(t=>b(e,n,t,s)))}}else d=r.isValue(t)?f.some(e=>x(t,e)):r.isSubjectReference(t)?f.some(n=>b(e,t,n,s)):i.isObject(t)?f.length>0:!1}if(!d&&s.requireAll)return!1;l||=d}return c||l}function _(e,t){let n=e.uniqueEmbeds[e.graph],r=n[t],o=r.parent,s=r.property,c={"@id":t};if(i.isArray(o)){for(let e=0;e<o.length;++e)if(a.compareValues(o[e],c)){o[e]=c;break}}else{let e=i.isArray(o[s]);a.removeValue(o,s,c,{propertyIsArray:e}),a.addValue(o,s,c,{propertyIsArray:e})}let l=e=>{let t=Object.keys(n);for(let r of t)r in n&&i.isObject(n[r].parent)&&n[r].parent[`@id`]===e&&(delete n[r],l(r))};l(t)}function v(e,t){if(i.isArray(e))return e.map(e=>v(e,t));if(i.isObject(e)){if(`@preserve`in e)return e[`@preserve`][0];if(r.isValue(e))return e;if(r.isList(e))return e[`@list`]=v(e[`@list`],t),e;if(`@id`in e){let n=e[`@id`];if(t.link.hasOwnProperty(n)){let r=t.link[n].indexOf(e);if(r!==-1)return t.link[n][r];t.link[n].push(e)}else t.link[n]=[e]}for(let n in e){if(n===`@id`&&t.bnodesToClear.includes(e[n])){delete e[`@id`];continue}e[n]=v(e[n],t)}}return e}function y(e,t,n){i.isObject(e)?a.addValue(e,t,n,{propertyIsArray:!0}):e.push(n)}function b(e,t,n,r){if(!(`@id`in n))return!1;let i=e.subjects[n[`@id`]];return i&&g(e,i,t,r)}function x(e,t){let n=t[`@value`],r=t[`@type`],a=t[`@language`],o=e[`@value`]?i.isArray(e[`@value`])?e[`@value`]:[e[`@value`]]:[],s=e[`@type`]?i.isArray(e[`@type`])?e[`@type`]:[e[`@type`]]:[],c=e[`@language`]?i.isArray(e[`@language`])?e[`@language`]:[e[`@language`]]:[];return o.length===0&&s.length===0&&c.length===0||!(!(o.includes(n)||i.isEmptyObject(o[0]))||!(!r&&s.length===0||s.includes(r)||r&&i.isEmptyObject(s[0]))||!(!a&&c.length===0||c.includes(a)||a&&i.isEmptyObject(c[0])))}})),er=o(((e,t)=>{var n=Mn(),{isArray:r,isObject:i,isString:a,isUndefined:o}=An(),{isList:s,isValue:c,isGraph:l,isSimpleGraph:u,isSubjectReference:d}=jn(),{expandIri:f,getContextValue:p,isKeyword:m,process:h,processingMode:g}=Kn(),{removeBase:_,prependBase:v}=In(),{REGEX_KEYWORD:y,addValue:b,asArray:x,compareShortestLeast:S}=Nn(),C={};t.exports=C,C.compact=async({activeCtx:e,activeProperty:t=null,element:f,options:_={}})=>{if(r(f)){let n=[];for(let r=0;r<f.length;++r){let i=await C.compact({activeCtx:e,activeProperty:t,element:f[r],options:_});i!==null&&n.push(i)}return _.compactArrays&&n.length===1&&(p(e,t,`@container`)||[]).length===0&&(n=n[0]),n}let v=p(e,t,`@context`);if(o(v)||(e=await h({activeCtx:e,localCtx:v,propagate:!0,overrideProtected:!0,options:_})),i(f)){if(_.link&&`@id`in f&&_.link.hasOwnProperty(f[`@id`])){let e=_.link[f[`@id`]];for(let t=0;t<e.length;++t)if(e[t].expanded===f)return e[t].compacted}if(c(f)||d(f)){let n=C.compactValue({activeCtx:e,activeProperty:t,value:f,options:_});return _.link&&d(f)&&(_.link.hasOwnProperty(f[`@id`])||(_.link[f[`@id`]]=[]),_.link[f[`@id`]].push({expanded:f,compacted:n})),n}if(s(f)&&(p(e,t,`@container`)||[]).includes(`@list`))return C.compact({activeCtx:e,activeProperty:t,element:f[`@list`],options:_});let v=t===`@reverse`,y={},S=e;!c(f)&&!d(f)&&(e=e.revertToPreviousContext());let w=p(S,t,`@context`);o(w)||(e=await h({activeCtx:e,localCtx:w,propagate:!0,overrideProtected:!0,options:_})),_.link&&`@id`in f&&(_.link.hasOwnProperty(f[`@id`])||(_.link[f[`@id`]]=[]),_.link[f[`@id`]].push({expanded:f,compacted:y}));let E=f[`@type`]||[];E.length>1&&(E=Array.from(E).sort());let D=e;for(let t of E){let n=p(S,C.compactIri({activeCtx:D,iri:t,relativeTo:{vocab:!0}}),`@context`);o(n)||(e=await h({activeCtx:e,localCtx:n,options:_,propagate:!1}))}let O=Object.keys(f).sort();for(let o of O){let d=f[o];if(o===`@id`){let t=x(d).map(t=>C.compactIri({activeCtx:e,iri:t,relativeTo:{vocab:!1},base:_.base}));t.length===1&&(t=t[0]);let n=C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}});y[n]=t;continue}if(o===`@type`){let t=x(d).map(e=>C.compactIri({activeCtx:S,iri:e,relativeTo:{vocab:!0}}));t.length===1&&(t=t[0]);let n=C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}}),i=(p(e,n,`@container`)||[]).includes(`@set`)&&g(e,1.1)||r(t)&&d.length===0;b(y,n,t,{propertyIsArray:i});continue}if(o===`@reverse`){let t=await C.compact({activeCtx:e,activeProperty:`@reverse`,element:d,options:_});for(let n in t)if(e.mappings.has(n)&&e.mappings.get(n).reverse){let r=t[n];b(y,n,r,{propertyIsArray:(p(e,n,`@container`)||[]).includes(`@set`)||!_.compactArrays}),delete t[n]}Object.keys(t).length>0&&b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),t);continue}if(o===`@preserve`){let n=await C.compact({activeCtx:e,activeProperty:t,element:d,options:_});r(n)&&n.length===0||b(y,o,n);continue}if(o===`@index`){if((p(e,t,`@container`)||[]).includes(`@index`))continue;b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),d);continue}if(o!==`@graph`&&o!==`@list`&&o!==`@included`&&m(o)){b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),d);continue}if(!r(d))throw new n(`JSON-LD expansion error; expanded value must be an array.`,`jsonld.SyntaxError`);if(d.length===0){let t=C.compactIri({activeCtx:e,iri:o,value:d,relativeTo:{vocab:!0},reverse:v}),n=e.mappings.has(t)?e.mappings.get(t)[`@nest`]:null,r=y;n&&(T(e,n,_),i(y[n])||(y[n]={}),r=y[n]),b(r,t,d,{propertyIsArray:!0})}for(let t of d){let n=C.compactIri({activeCtx:e,iri:o,value:t,relativeTo:{vocab:!0},reverse:v}),d=e.mappings.has(n)?e.mappings.get(n)[`@nest`]:null,f=y;d&&(T(e,d,_),i(y[d])||(y[d]={}),f=y[d]);let m=p(e,n,`@container`)||[],h=l(t),g=s(t),S;g?S=t[`@list`]:h&&(S=t[`@graph`]);let w=await C.compact({activeCtx:e,activeProperty:n,element:g||h?S:t,options:_});if(g)if(r(w)||(w=[w]),!m.includes(`@list`))w={[C.compactIri({activeCtx:e,iri:`@list`,relativeTo:{vocab:!0}})]:w},`@index`in t&&(w[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=t[`@index`]);else{b(f,n,w,{valueIsArray:!0,allowDuplicate:!0});continue}if(h)if(m.includes(`@graph`)&&(m.includes(`@id`)||m.includes(`@index`)&&u(t))){let r;f.hasOwnProperty(n)?r=f[n]:f[n]=r={};let i=(m.includes(`@id`)?t[`@id`]:t[`@index`])||C.compactIri({activeCtx:e,iri:`@none`,relativeTo:{vocab:!0}});b(r,i,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)})}else m.includes(`@graph`)&&u(t)?(r(w)&&w.length>1&&(w={"@included":w}),b(f,n,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)})):(r(w)&&w.length===1&&_.compactArrays&&(w=w[0]),w={[C.compactIri({activeCtx:e,iri:`@graph`,relativeTo:{vocab:!0}})]:w},`@id`in t&&(w[C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}})]=t[`@id`]),`@index`in t&&(w[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=t[`@index`]),b(f,n,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)}));else if(m.includes(`@language`)||m.includes(`@index`)||m.includes(`@id`)||m.includes(`@type`)){let r;f.hasOwnProperty(n)?r=f[n]:f[n]=r={};let i;if(m.includes(`@language`))c(w)&&(w=w[`@value`]),i=t[`@language`];else if(m.includes(`@index`)){let r=p(e,n,`@index`)||`@index`,o=C.compactIri({activeCtx:e,iri:r,relativeTo:{vocab:!0}});if(r===`@index`)i=t[`@index`],delete w[o];else{let e;if([i,...e]=x(w[r]||[]),!a(i))i=null;else switch(e.length){case 0:delete w[r];break;case 1:w[r]=e[0];break;default:w[r]=e;break}}}else if(m.includes(`@id`)){let t=C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}});i=w[t],delete w[t]}else if(m.includes(`@type`)){let r=C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}}),a;switch([i,...a]=x(w[r]||[]),a.length){case 0:delete w[r];break;case 1:w[r]=a[0];break;default:w[r]=a;break}Object.keys(w).length===1&&`@id`in t&&(w=await C.compact({activeCtx:e,activeProperty:n,element:{"@id":t[`@id`]},options:_}))}i||=C.compactIri({activeCtx:e,iri:`@none`,relativeTo:{vocab:!0}}),b(r,i,w,{propertyIsArray:m.includes(`@set`)})}else{let e=!_.compactArrays||m.includes(`@set`)||m.includes(`@list`)||r(w)&&w.length===0||o===`@list`||o===`@graph`;b(f,n,w,{propertyIsArray:e})}}}return y}return f},C.compactIri=({activeCtx:e,iri:t,value:r=null,relativeTo:a={vocab:!1},reverse:o=!1,base:u=null})=>{if(t===null)return t;e.isPropertyTermScoped&&e.previousContext&&(e=e.previousContext);let d=e.getInverse();if(m(t)&&t in d&&`@none`in d[t]&&`@type`in d[t][`@none`]&&`@none`in d[t][`@none`][`@type`])return d[t][`@none`][`@type`][`@none`];if(a.vocab&&t in d){let n=e[`@language`]||`@none`,a=[];i(r)&&`@index`in r&&!(`@graph`in r)&&a.push(`@index`,`@index@set`),i(r)&&`@preserve`in r&&(r=r[`@preserve`][0]),l(r)?(`@index`in r&&a.push(`@graph@index`,`@graph@index@set`,`@index`,`@index@set`),`@id`in r&&a.push(`@graph@id`,`@graph@id@set`),a.push(`@graph`,`@graph@set`,`@set`),`@index`in r||a.push(`@graph@index`,`@graph@index@set`,`@index`,`@index@set`),`@id`in r||a.push(`@graph@id`,`@graph@id@set`)):i(r)&&!c(r)&&a.push(`@id`,`@id@set`,`@type`,`@set@type`);let u=`@language`,d=`@null`;if(o)u=`@type`,d=`@reverse`,a.push(`@set`);else if(s(r)){`@index`in r||a.push(`@list`);let e=r[`@list`];if(e.length===0)u=`@any`,d=`@none`;else{let t=e.length===0?n:null,r=null;for(let n=0;n<e.length;++n){let i=e[n],a=`@none`,o=`@none`;if(c(i)?`@direction`in i?a=`${(i[`@language`]||``).toLowerCase()}_${i[`@direction`]}`:`@language`in i?a=i[`@language`].toLowerCase():`@type`in i?o=i[`@type`]:a=`@null`:o=`@id`,t===null?t=a:a!==t&&c(i)&&(t=`@none`),r===null?r=o:o!==r&&(r=`@none`),t===`@none`&&r===`@none`)break}t||=`@none`,r||=`@none`,r===`@none`?d=t:(u=`@type`,d=r)}}else{if(c(r))if(`@language`in r&&!(`@index`in r)){a.push(`@language`,`@language@set`),d=r[`@language`];let e=r[`@direction`];e&&(d=`${d}_${e}`)}else`@direction`in r&&!(`@index`in r)?d=`_${r[`@direction`]}`:`@type`in r&&(u=`@type`,d=r[`@type`]);else u=`@type`,d=`@id`;a.push(`@set`)}a.push(`@none`),i(r)&&!(`@index`in r)&&a.push(`@index`,`@index@set`),c(r)&&Object.keys(r).length===1&&a.push(`@language`,`@language@set`);let f=w(e,t,r,a,u,d);if(f!==null)return f}if(a.vocab&&`@vocab`in e){let n=e[`@vocab`];if(t.indexOf(n)===0&&t!==n){let r=t.substr(n.length);if(!e.mappings.has(r))return r}}let f=null,p=[],h=e.fastCurieMap,g=t.length-1;for(let e=0;e<g&&t[e]in h;++e)h=h[t[e]],``in h&&p.push(h[``][0]);for(let n=p.length-1;n>=0;--n){let i=p[n],a=i.terms;for(let n of a){let a=n+`:`+t.substr(i.iri.length);e.mappings.get(n)._prefix&&(!e.mappings.has(a)||r===null&&e.mappings.get(a)[`@id`]===t)&&(f===null||S(a,f)<0)&&(f=a)}}if(f!==null)return f;for(let[r,i]of e.mappings)if(i&&i._prefix&&t.startsWith(r+`:`))throw new n(`Absolute IRI "${t}" confused with prefix "${r}".`,`jsonld.SyntaxError`,{code:`IRI confused with prefix`,context:e});if(!a.vocab)if(`@base`in e)if(e[`@base`]){let n=_(v(u,e[`@base`]),t);return y.test(n)?`./${n}`:n}else return t;else return _(u,t);return t},C.compactValue=({activeCtx:e,activeProperty:t,value:n,options:r})=>{if(c(n)){let r=p(e,t,`@type`),i=p(e,t,`@language`),o=p(e,t,`@direction`),s=p(e,t,`@container`)||[],c=`@index`in n&&!s.includes(`@index`);if(!c&&r!==`@none`&&(n[`@type`]===r||`@language`in n&&n[`@language`]===i&&`@direction`in n&&n[`@direction`]===o||`@language`in n&&n[`@language`]===i||`@direction`in n&&n[`@direction`]===o))return n[`@value`];let l=Object.keys(n).length,u=l===1||l===2&&`@index`in n&&!c,d=`@language`in e,f=a(n[`@value`]),m=e.mappings.has(t)&&e.mappings.get(t)[`@language`]===null;if(u&&r!==`@none`&&(!d||!f||m))return n[`@value`];let h={};return c&&(h[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=n[`@index`]),`@type`in n?h[C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}})]=C.compactIri({activeCtx:e,iri:n[`@type`],relativeTo:{vocab:!0}}):`@language`in n&&(h[C.compactIri({activeCtx:e,iri:`@language`,relativeTo:{vocab:!0}})]=n[`@language`]),`@direction`in n&&(h[C.compactIri({activeCtx:e,iri:`@direction`,relativeTo:{vocab:!0}})]=n[`@direction`]),h[C.compactIri({activeCtx:e,iri:`@value`,relativeTo:{vocab:!0}})]=n[`@value`],h}let i=f(e,t,{vocab:!0},r),o=p(e,t,`@type`),s=C.compactIri({activeCtx:e,iri:n[`@id`],relativeTo:{vocab:o===`@vocab`},base:r.base});return o===`@id`||o===`@vocab`||i===`@graph`?s:{[C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}})]:s}};function w(e,t,n,r,a,o){o===null&&(o=`@null`);let s=[];if((o===`@id`||o===`@reverse`)&&i(n)&&`@id`in n){o===`@reverse`&&s.push(`@reverse`);let t=C.compactIri({activeCtx:e,iri:n[`@id`],relativeTo:{vocab:!0}});e.mappings.has(t)&&e.mappings.get(t)&&e.mappings.get(t)[`@id`]===n[`@id`]?s.push.apply(s,[`@vocab`,`@id`]):s.push.apply(s,[`@id`,`@vocab`])}else{s.push(o);let e=s.find(e=>e.includes(`_`));e&&s.push(e.replace(/^[^_]+_/,`_`))}s.push(`@none`);let c=e.inverse[t];for(let e of r){if(!(e in c))continue;let t=c[e][a];for(let e of s)if(e in t)return t[e]}return null}function T(e,t,r){if(f(e,t,{vocab:!0},r)!==`@nest`)throw new n(`JSON-LD compact error; nested property must have an @nest value resolving to @nest.`,`jsonld.SyntaxError`,{code:`invalid @nest value`})}})),tr=o(((e,t)=>{t.exports=e=>{class t{toString(){return`[object JsonLdProcessor]`}}return Object.defineProperty(t,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(t.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:t}),t.compact=function(t,n){return arguments.length<2?Promise.reject(TypeError(`Could not compact, too few arguments.`)):e.compact(t,n)},t.expand=function(t){return arguments.length<1?Promise.reject(TypeError(`Could not expand, too few arguments.`)):e.expand(t)},t.flatten=function(t){return arguments.length<1?Promise.reject(TypeError(`Could not flatten, too few arguments.`)):e.flatten(t)},t}})),nr=o(((e,t)=>{var n=kn(),r=Rn(),i=Nn(),a=Un(),o=i.IdentifierIssuer,s=Mn(),c=Vn(),l=Wn(),{expand:u}=qn(),{flatten:d}=Yn(),{fromRDF:f}=Xn(),{toRDF:p}=Qn(),{frameMergedOrDefault:m,cleanupNull:h}=$n(),{isArray:g,isObject:_,isString:v}=An(),{isSubjectReference:y}=jn(),{expandIri:b,getInitialContext:x,process:S,processingMode:C}=Kn(),{compact:w,compactIri:T}=er(),{createNodeMap:E,createMergedNodeMap:D,mergeNodeMaps:O}=Jn(),{logEventHandler:k,logWarningEventHandler:A,safeEventHandler:j,setDefaultEventHandler:M,setupEventHandler:N,strictEventHandler:P,unhandledEventHandler:F}=Gn(),I=function(e){let t={},I=new c({max:100});e.compact=async function(t,n,r){if(arguments.length<2)throw TypeError(`Could not compact, too few arguments.`);if(n===null)throw new s(`The compaction context must not be null.`,`jsonld.CompactError`,{code:`invalid local context`});if(t===null)return null;r=L(r,{base:v(t)?t:``,compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new o(`_:b`),contextResolver:new a({sharedCache:I})}),r.link&&(r.skipExpansion=!0),r.compactToRelative||delete r.base;let c;c=r.skipExpansion?t:await e.expand(t,r);let l=await e.processContext(x(r),n,r),u=await w({activeCtx:l,element:c,options:r});r.compactArrays&&!r.graph&&g(u)?u.length===1?u=u[0]:u.length===0&&(u={}):r.graph&&_(u)&&(u=[u]),_(n)&&`@context`in n&&(n=n[`@context`]),n=i.clone(n),g(n)||(n=[n]);let d=n;n=[];for(let e=0;e<d.length;++e)(!_(d[e])||Object.keys(d[e]).length>0)&&n.push(d[e]);let f=n.length>0;if(n.length===1&&(n=n[0]),g(u)){let e=T({activeCtx:l,iri:`@graph`,relativeTo:{vocab:!0}}),t=u;u={},f&&(u[`@context`]=n),u[e]=t}else if(_(u)&&f){let e=u;u={"@context":n};for(let t in e)u[t]=e[t]}return u},e.expand=async function(t,n){if(arguments.length<1)throw TypeError(`Could not expand, too few arguments.`);n=L(n,{keepFreeFloatingNodes:!1,contextResolver:new a({sharedCache:I})});let r={},o=[];if(`expandContext`in n){let e=i.clone(n.expandContext);_(e)&&`@context`in e?r.expandContext=e:r.expandContext={"@context":e},o.push(r.expandContext)}let s;if(!v(t))r.input=i.clone(t);else{let i=await e.get(t,n);s=i.documentUrl,r.input=i.document,i.contextUrl&&(r.remoteContext={"@context":i.contextUrl},o.push(r.remoteContext))}`base`in n||(n.base=s||``);let c=x(n);for(let e of o)c=await S({activeCtx:c,localCtx:e,options:n});let l=await u({activeCtx:c,element:r.input,options:n});return _(l)&&`@graph`in l&&Object.keys(l).length===1?l=l[`@graph`]:l===null&&(l=[]),g(l)||(l=[l]),l},e.flatten=async function(t,n,r){if(arguments.length<1)return TypeError(`Could not flatten, too few arguments.`);typeof n==`function`?n=null:n||=null,r=L(r,{base:v(t)?t:``,contextResolver:new a({sharedCache:I})});let i=d(await e.expand(t,r));return n===null?i:(r.graph=!0,r.skipExpansion=!0,await e.compact(i,n,r))},e.frame=async function(t,n,r){if(arguments.length<2)throw TypeError(`Could not frame, too few arguments.`);if(r=L(r,{base:v(t)?t:``,embed:`@once`,explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new a({sharedCache:I})}),v(n)){let t=await e.get(n,r);if(n=t.document,t.contextUrl){let e=n[`@context`];e?g(e)?e.push(t.contextUrl):e=[e,t.contextUrl]:e=t.contextUrl,n[`@context`]=e}}let i=n&&n[`@context`]||{},o=await e.processContext(x(r),i,r);r.hasOwnProperty(`omitGraph`)||(r.omitGraph=C(o,1.1)),r.hasOwnProperty(`pruneBlankNodeIdentifiers`)||(r.pruneBlankNodeIdentifiers=C(o,1.1));let s=await e.expand(t,r),c={...r};c.isFrame=!0,c.keepFreeFloatingNodes=!0;let l=await e.expand(n,c);c.merged=!Object.keys(n).map(e=>b(o,e,{vocab:!0})).includes(`@graph`),c.is11=C(o,1.1);let u=m(s,l,c);c.graph=!r.omitGraph,c.skipExpansion=!0,c.link={},c.framing=!0;let d=await e.compact(u,i,c);return c.link={},d=h(d,c),d},e.link=async function(t,n,r){let i={};return n&&(i[`@context`]=n),i[`@embed`]=`@link`,e.frame(t,i,r)},e.normalize=e.canonize=async function(t,r){if(arguments.length<1)throw TypeError(`Could not canonize, too few arguments.`);r=L(r,{skipExpansion:!1,safe:!0,contextResolver:new a({sharedCache:I})});let i=Object.assign({},{algorithm:`RDFC-1.0`},r.canonizeOptions||null);if(`inputFormat`in r){if(r.inputFormat!==`application/n-quads`)throw new s(`Unknown canonicalization input format.`,`jsonld.CanonizeError`);let e=l.parse(t);return n.canonize(e,i)}let o={...r};delete o.format,delete o.canonizeOptions,o.produceGeneralizedRdf=!1;let c=await e.toRDF(t,o);return n.canonize(c,i)},e.fromRDF=async function(e,n){if(arguments.length<1)throw TypeError(`Could not convert from RDF, too few arguments.`);n=L(n,{format:v(e)?`application/n-quads`:void 0});let{format:r}=n,{rdfParser:i}=n;if(r){if(i||=t[r],!i)throw new s(`Unknown input format.`,`jsonld.UnknownFormat`,{format:r})}else i=()=>e;return f(await i(e),n)},e.toRDF=async function(t,n){if(arguments.length<1)throw TypeError(`Could not convert to RDF, too few arguments.`);n=L(n,{skipExpansion:!1,contextResolver:new a({sharedCache:I})});let r;r=n.skipExpansion?t:await e.expand(t,n);let i=p(r,n);if(n.format){if(n.format===`application/n-quads`)return l.serialize(i);throw new s(`Unknown output format.`,`jsonld.UnknownFormat`,{format:n.format})}return i},e.createNodeMap=async function(t,n){if(arguments.length<1)throw TypeError(`Could not create node map, too few arguments.`);return n=L(n,{base:v(t)?t:``,contextResolver:new a({sharedCache:I})}),D(await e.expand(t,n),n)},e.merge=async function(t,n,r){if(arguments.length<1)throw TypeError(`Could not merge, too few arguments.`);if(!g(t))throw TypeError(`Could not merge, "docs" must be an array.`);typeof n==`function`?n=null:n||=null,r=L(r,{contextResolver:new a({sharedCache:I})});let s=await Promise.all(t.map(t=>{let n={...r};return e.expand(t,n)})),c=!0;`mergeNodes`in r&&(c=r.mergeNodes);let l=r.issuer||new o(`_:b`),u={"@default":{}};for(let e=0;e<s.length;++e){let t=i.relabelBlankNodes(s[e],{issuer:new o(`_:b`+e+`-`)}),n=c||e===0?u:{"@default":{}};if(E(t,n,`@default`,l),n!==u)for(let e in n){let t=n[e];if(!(e in u)){u[e]=t;continue}let r=u[e];for(let e in t)e in r||(r[e]=t[e])}}let d=O(u),f=[],p=Object.keys(d).sort();for(let e=0;e<p.length;++e){let t=d[p[e]];y(t)||f.push(t)}return n===null?f:(r.graph=!0,r.skipExpansion=!0,await e.compact(f,n,r))},Object.defineProperty(e,"documentLoader",{get:()=>e._documentLoader,set:t=>e._documentLoader=t}),e.documentLoader=async e=>{throw new s(`Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:e})},e.get=async function(t,n){let r;r=typeof n.documentLoader==`function`?n.documentLoader:e.documentLoader;let i=await r(t);try{if(!i.document)throw new s(`No remote document found at the given URL.`,`jsonld.NullRemoteDocument`);v(i.document)&&(i.document=JSON.parse(i.document))}catch(e){throw new s(`Could not retrieve a JSON-LD document from the URL.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,cause:e,remoteDoc:i})}return i},e.processContext=async function(e,t,n){return n=L(n,{base:``,contextResolver:new a({sharedCache:I})}),t===null?x(n):(t=i.clone(t),_(t)&&`@context`in t||(t={"@context":t}),S({activeCtx:e,localCtx:t,options:n}))},e.getContextValue=Kn().getContextValue,e.documentLoaders={},e.useDocumentLoader=function(t){if(!(t in e.documentLoaders))throw new s(`Unknown document loader type: "`+t+`"`,`jsonld.UnknownDocumentLoader`,{type:t});e.documentLoader=e.documentLoaders[t].apply(e,Array.prototype.slice.call(arguments,1))},e.registerRDFParser=function(e,n){t[e]=n},e.unregisterRDFParser=function(e){delete t[e]},e.registerRDFParser(`application/n-quads`,l.parse),e.url=In(),e.logEventHandler=k,e.logWarningEventHandler=A,e.safeEventHandler=j,e.setDefaultEventHandler=M,e.strictEventHandler=P,e.unhandledEventHandler=F,e.util=i,Object.assign(e,i),e.promises=e,e.RequestQueue=Fn(),e.JsonLdProcessor=tr()(e),r.setupGlobals(e),r.setupDocumentLoaders(e);function L(t,{documentLoader:n=e.documentLoader,...r}){if(t&&`compactionMap`in t)throw new s(`"compactionMap" not supported.`,`jsonld.OptionsError`);if(t&&`expansionMap`in t)throw new s(`"expansionMap" not supported.`,`jsonld.OptionsError`);return Object.assign({},{documentLoader:n},r,t,{eventHandler:N({options:t})})}return e},L=function(){return I(function(){return L()})};I(L),t.exports=L})),rr=yn(),ir=l(nr(),1),ar={},or={};async function sr(e){return`rdf`in e?lr(e.rdf):e.rdfUrlResolver?lr(await e.rdfUrlResolver(e.url)):cr(e.url,e.proxy)}async function cr(e,t){return e in ar||(ar[e]=(async()=>{let n=e;t&&(n=t+encodeURIComponent(e));let r=await fetch(n,{headers:{Accept:`text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json`}});return r.ok?lr(await r.text()):(console.warn(`failed fetching RDF from`,e),[])})()),ar[e]}async function lr(e){if(!e.trim())return[];let t=ur(e);if(t===`json`)try{e=await ir.default.toRDF(JSON.parse(e),{format:`application/n-quads`})}catch(e){console.error(e)}let n=[];return await new Promise((r,i)=>{let a=t===`xml`?new rr.RdfXmlParser:new at;a.on(`data`,e=>{n.push(k.quad(e.subject,e.predicate,e.object,e.graph))}).on(`error`,e=>{i(e)}).on(`prefix`,(e,t)=>{e&&(or[e]=t)}).on(`end`,()=>{r(null)}),a.write(e),a.end()}),n}function ur(e){return/^\s*[\\[{]/.test(e)?`json`:/^\s*<\?xml/.test(e)?`xml`:`ttl`}var dr={[`${J}name`]:(e,t)=>{let n=t;e.name=Ht(e.config.languages,e.name,n)},[`${J}description`]:(e,t)=>{let n=t;e.description=Ht(e.config.languages,e.description,n)},[`${J}path`]:(e,t)=>{e.path=t.value},[`${J}group`]:(e,t)=>{e.group=t.id},[`${J}datatype`]:(e,t)=>{e.datatype=t},[`${J}nodeKind`]:(e,t)=>{e.nodeKind=t},[`${J}minCount`]:(e,t)=>{e.minCount=parseInt(t.value)},[`${J}maxCount`]:(e,t)=>{e.maxCount=parseInt(t.value)},[`${J}minLength`]:(e,t)=>{e.minLength=parseInt(t.value)},[`${J}maxLength`]:(e,t)=>{e.maxLength=parseInt(t.value)},[`${J}minInclusive`]:(e,t)=>{e.minInclusive=parseInt(t.value)},[`${J}maxInclusive`]:(e,t)=>{e.maxInclusive=parseInt(t.value)},[`${J}minExclusive`]:(e,t)=>{e.minExclusive=parseInt(t.value)},[`${J}maxExclusive`]:(e,t)=>{e.maxExclusive=parseInt(t.value)},[`${J}pattern`]:(e,t)=>{e.pattern=t.value},[`${J}order`]:(e,t)=>{e.order=parseInt(t.value)},[`${ot}singleLine`]:(e,t)=>{e.singleLine=t.value===`true`},[`${ot}readonly`]:(e,t)=>{e.readonly=t.value===`true`},[`${ut}styleClass`]:(e,t)=>{e.cssClass=t.value},[`${J}in`]:(e,t)=>{e.in=t.value},[`${J}languageIn`]:(e,t)=>{e.languageIn=e.config.lists[t.value],e.datatype=ht},[`${J}defaultValue`]:(e,t)=>{e.defaultValue=t},[`${J}hasValue`]:(e,t)=>{e.hasValue=t},[`${J}node`]:(e,t)=>{e.node=t,e.nodeShapes.add(e.config.getNodeTemplate(t,e))},[`${J}and`]:(e,t)=>{e.and=t.value;let n=e.config.lists[e.and];if(n?.length)for(let t of n)e.nodeShapes.add(e.config.getNodeTemplate(t,e))},[`${J}qualifiedValueShape`]:(e,t)=>{let n=e.config.getNodeTemplate(t,e);e.qualifiedValueShape=n,e.nodeShapes.add(n)},[`${J}qualifiedMinCount`]:(e,t)=>{e.qualifiedMinCount=parseInt(t.value)},[`${J}qualifiedMaxCount`]:(e,t)=>{e.qualifiedMaxCount=parseInt(t.value)},[vt.id]:(e,t)=>{e.owlImports.add(t)},[wt.id]:(e,t)=>{e.class=t;let n=e.config.store.getSubjects(Et,t,null);n.length>0&&(e.node=n[0])},[`${J}or`]:(e,t)=>{let n=e.config.lists[t.value];n?.length?e.or=n:console.error(`list for sh:or not found:`,t.value,`existing lists:`,e.config.lists)},[`${J}xone`]:(e,t)=>{let n=e.config.lists[t.value];n?.length?e.xone=n:console.error(`list for sh:xone not found:`,t.value,`existing lists:`,e.config.lists)}},fr=class{constructor(e,t){this.label=``,this.nodeShapes=new Set,this.owlImports=new Set,this.id=e,this.parent=t,this.config=t.config,this.config.registerPropertyTemplate(this),gr(this,this.config.store.getQuads(e,null,null,null))}};function pr(e){return Math.max(e.minCount??0,e.qualifiedMinCount??0)}function mr(e){return Math.min(e.maxCount??2**53-1,e.qualifiedMaxCount??2**53-1)}function hr(e){let t=Object.assign({},e);return t.nodeShapes=new Set(e.nodeShapes),t.owlImports=new Set(e.owlImports),e.languageIn&&(t.languageIn=[...e.languageIn]),e.or&&(t.or=[...e.or]),e.xone&&(t.xone=[...e.xone]),t}function gr(e,t){for(let n of t)dr[n.predicate.id]?.call(e,e,n.object);return e.label=e.name?.value||It(t,e.config.languages),e.label||=e.path?Rt(e.path,or):`unknown`,e}function _r(e,t){let n=t,r=e;for(let e in t)if(e!==`parent`&&e!==`config`&&e!==`id`){let t=n[e];if(t!==void 0&&t!==``)if(Array.isArray(t)){let n=r[e];Array.isArray(n)?n.push(...t):r[e]=[...t]}else if(t instanceof Set&&t.size){let n=r[e];r[e]=new Set([...n instanceof Set?n:[],...t])}else r[e]=t}}var vr=`modulepreload`,yr=function(e){return`/`+e},br={},xr=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=yr(t,n),t=s(t),t in br)return;br[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:vr,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function Sr(e,t,n){let r=document.createElement(`div`);r.classList.add(`shacl-or-constraint`),r.setAttribute(`part`,`constraint`);let i=[];if(t instanceof ro){let a=[],o=!1;e.length&&(o=n.store.countQuads(e[0],Ct,null,null)>0);for(let r=0;r<e.length;r++)if(o){let o=n.store.getObjects(e[r],Ct,null),s=[],c=``;for(let e of o){let r=new Pa(n.getPropertyTemplate(e,t.template),t);s.push(r),c+=(c.length>0?` / `:``)+r.template.label}a.push(s),i.push({label:c,value:r.toString()})}else{let o=e[r],s=new Pa(n.getPropertyTemplate(o,t.template),t);a.push([s]),i.push({label:s.template.label,value:r.toString()})}let s=n.theme.createListEditor(`Please choose`,null,!1,i);s.setAttribute(`part`,`constraint-editor`);let c=s.querySelector(`.editor`);c.onchange=async()=>{if(c.value){let e=a[parseInt(c.value)];if(n.queryMode){let{activateNodeConstraintOption:t}=await xr(async()=>{let{activateNodeConstraintOption:e}=await import(`./mode-f6xgDLiM.js`);return{activateNodeConstraintOption:e}},[]);await t(e,r);return}let i;if(e.length){for(let n of e)await n.bindValues(t.nodeId,!1);i=e[0],r.replaceWith(e[0]),i.updateControls()}for(let t=1;t<e.length;t++)i.after(e[t]),i=e[t],i.updateControls()}},r.appendChild(s)}else{let a=[];for(let t=0;t<e.length;t++){let r=n.store.getQuads(e[t],null,null,null);if(r.length){a.push(r);let e=It(r,n.languages);for(let t of r)t.predicate.equals(Tt)&&(e=It(n.store.getQuads(t.object,null,null,null),n.languages));i.push({label:e||Rt(r[0].predicate.value,or)+` = `+Rt(r[0].object.value,or),value:t.toString()})}}let o=n.theme.createListEditor(t.template.label+`?`,null,!1,i,t.template);o.setAttribute(`part`,`constraint-editor`);let s=o.querySelector(`.editor`);s.onchange=async()=>{if(s.value){let e=gr(hr(t.template),a[parseInt(s.value)]);if(n.queryMode){let{activatePropertyConstraintOption:n}=await xr(async()=>{let{activatePropertyConstraintOption:e}=await import(`./mode-f6xgDLiM.js`);return{activatePropertyConstraintOption:e}},[]);await n(e,t,r);return}let i=await Fa(e,void 0,!0),o=i.querySelector(`:scope > label`);o&&o.classList.add(`persistent`),r.replaceWith(i)}},r.appendChild(o)}return r}function Cr(e,t,n){if(t.termType===`Literal`){let r=t.datatype;for(let t of e){let e=n.store.getQuads(t,null,null,null);for(let t of e)if(t.predicate.value===`http://www.w3.org/ns/shacl#datatype`&&t.object.equals(r))return e}}else{let r=n.store.getObjects(t,mt,null);for(let t of e){let e=n.store.getQuads(t,null,null,null);for(let t of e)if(r.length>0){if(t.predicate.value===`http://www.w3.org/ns/shacl#node`){for(let i of r)if(n.store.getQuads(t.object,Et,i,null).length>0)return e}if(t.predicate.equals(wt)){for(let n of r)if(t.object.equals(n))return e}}else if(t.predicate.equals(Dt)&&t.object.equals(St))return e}}return console.error(`couldn't resolve sh:or/sh:xone on property for value`,t),[]}function wr(e,t,n){for(let r of e){let e=!1,i=n.store.getObjects(r,Ct,null);for(let r of i){let i=n.store.getObjects(r,`${J}path`,null);for(let r of i)if(e=n.store.countQuads(t,r,null,null)>0,e)break}if(e)return i}return console.error(`couldn't resolve sh:or/sh:xone on node for value`,t),[]}var Tr=`:host {
|
|
26
|
+
`;case`f`:return`\f`;case`r`:return`\r`;case`"`:return`"`;case`'`:return`'`;case`\\`:return`\\`}if(n)return String.fromCharCode(parseInt(n,16));if(r)return String.fromCodePoint(parseInt(r,16))}):e}var m=/[\u0000-\u0020<>"{}|^`\\]/g,h=[];for(let e=0;e<=127;++e)m.test(String.fromCharCode(e))&&(h[e]=`\\u`+e.toString(16).toUpperCase().padStart(4,`0`),m.lastIndex=0);function g(e){return m.test(e)?e.replace(m,function(e){return h[e.codePointAt(0)]}):e}var _=/(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function v(e){return _.test(e)?e.replace(_,function(e,t,n){if(t)return String.fromCharCode(parseInt(t,16));if(n)return String.fromCodePoint(parseInt(n,16))}):e}})),En=o(((e,t)=>{var n=bn(),r=Cn(),i=wn(),a=Tn(),{setImmediate:o}=Sn();t.exports=class{constructor({createMessageDigest:e=null,messageDigestAlgorithm:t=`sha256`,canonicalIdMap:i=new Map,maxWorkFactor:a=1,maxDeepIterations:o=-1,signal:s=null}={}){this.name=`RDFC-1.0`,this.blankNodeInfo=new Map,this.canonicalIssuer=new n(`c14n`,i),this.createMessageDigest=e||(()=>new r(t)),this.maxWorkFactor=a,this.maxDeepIterations=o,this.remainingDeepIterations=0,this.signal=s,this.quads=null}async main(e){this.quads=e;for(let t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});let t=new Map,r=[...this.blankNodeInfo.keys()],i=0;for(let e of r)++i%100==0&&await this._yield(),await this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});let o=[...t.keys()].sort(),c=[];for(let e of o){let n=t.get(e);if(n.length>1){c.push(n);continue}let r=n[0];this.canonicalIssuer.getId(r)}if(this.maxDeepIterations<0)if(this.maxWorkFactor===0)this.maxDeepIterations=0;else if(this.maxWorkFactor===1/0)this.maxDeepIterations=1/0;else{let e=c.reduce((e,t)=>e+t.length,0);this.maxDeepIterations=e**this.maxWorkFactor}this.maxDeepIterations>2**53-1&&(this.maxDeepIterations=1/0),this.remainingDeepIterations=this.maxDeepIterations;for(let e of c){let t=[];for(let r of e){if(this.canonicalIssuer.hasId(r))continue;let e=new n(`b`);e.getId(r);let i=await this.hashNDegreeQuads(r,e);t.push(i)}t.sort(s);for(let e of t){let t=e.issuer.getOldIds();for(let e of t)this.canonicalIssuer.getId(e)}}let l=[];for(let e of this.quads){let t=a.serializeQuadComponents(this._componentWithCanonicalId(e.subject),e.predicate,this._componentWithCanonicalId(e.object),this._componentWithCanonicalId(e.graph));l.push(t)}return l.sort(),l.join(``)}async hashFirstDegreeQuads(e){let t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(let n of r)t.push(a.serializeQuadComponents(this.modifyFirstDegreeComponent(e,n.subject,`subject`),n.predicate,this.modifyFirstDegreeComponent(e,n.object,`object`),this.modifyFirstDegreeComponent(e,n.graph,`graph`)));t.sort();let i=this.createMessageDigest();for(let e of t)i.update(e);return n.hash=await i.digest(),n.hash}async hashRelatedBlankNode(e,t,n,r){let i=this.createMessageDigest();i.update(r),r!==`g`&&i.update(this.getRelatedPredicate(t));let a;return a=this.canonicalIssuer.hasId(e)?`_:`+this.canonicalIssuer.getId(e):n.hasId(e)?`_:`+n.getId(e):this.blankNodeInfo.get(e).hash,i.update(a),i.digest()}async hashNDegreeQuads(e,t){if(this.remainingDeepIterations===0)throw Error(`Maximum deep iterations exceeded (${this.maxDeepIterations}).`);this.remainingDeepIterations--;let n=this.createMessageDigest(),r=await this.createHashToRelated(e,t),a=[...r.keys()].sort();for(let e of a){n.update(e);let a=``,o,s=new i(r.get(e)),c=0;for(;s.hasNext();){let e=s.next();if(++c%3==0){if(this.signal&&this.signal.aborted)throw Error(`Abort signal received: "${this.signal.reason}".`);await this._yield()}let n=t.clone(),r=``,i=[],l=!1;for(let t of e)if(this.canonicalIssuer.hasId(t)?r+=`_:`+this.canonicalIssuer.getId(t):(n.hasId(t)||i.push(t),r+=`_:`+n.getId(t)),a.length!==0&&r>a){l=!0;break}if(!l){for(let e of i){let t=await this.hashNDegreeQuads(e,n);if(r+=`_:`+n.getId(e),r+=`<${t.hash}>`,n=t.issuer,a.length!==0&&r>a){l=!0;break}}l||(a.length===0||r<a)&&(a=r,o=n)}}n.update(a),t=o}return{hash:await n.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return t.termType===`BlankNode`?{termType:`BlankNode`,value:t.value===e?`a`:`z`}:t}getRelatedPredicate(e){return`<${e.predicate.value}>`}async createHashToRelated(e,t){let n=new Map,r=this.blankNodeInfo.get(e).quads,i=0;for(let a of r)++i%100==0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:a,component:a.subject,position:`s`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:a,component:a.object,position:`o`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:a,component:a.graph,position:`g`,id:e,issuer:t,hashToRelated:n})]);return n}async _hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){let n=await this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if(t.termType!==`BlankNode`)return;let n=t.value,r=this.blankNodeInfo.get(n);r?r.quads.add(e):this.blankNodeInfo.set(n,{quads:new Set([e]),hash:null})}async _addRelatedBlankNodeHash({quad:e,component:t,position:n,id:r,issuer:i,hashToRelated:a}){if(!(t.termType===`BlankNode`&&t.value!==r))return;let o=t.value,s=await this.hashRelatedBlankNode(o,e,i,n),c=a.get(s);c?c.push(o):a.set(s,[o])}_componentWithCanonicalId(e){return e.termType===`BlankNode`&&!e.value.startsWith(this.canonicalIssuer.prefix)?{termType:`BlankNode`,value:this.canonicalIssuer.getId(e.value)}:e}async _yield(){return new Promise(e=>o(e))}};function s(e,t){return e.hash<t.hash?-1:+(e.hash>t.hash)}})),Dn=o(((e,t)=>{var n=bn(),r=Cn(),i=wn(),a=Tn();t.exports=class{constructor({createMessageDigest:e=null,messageDigestAlgorithm:t=`sha256`,canonicalIdMap:i=new Map,maxWorkFactor:a=1,maxDeepIterations:o=-1,timeout:s=0}={}){this.name=`RDFC-1.0`,this.blankNodeInfo=new Map,this.canonicalIssuer=new n(`c14n`,i),this.createMessageDigest=e||(()=>new r(t)),this.maxWorkFactor=a,this.maxDeepIterations=o,this.remainingDeepIterations=0,this.timeout=s,s>0&&(this.startTime=Date.now()),this.quads=null}main(e){this.quads=e;for(let t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});let t=new Map,r=[...this.blankNodeInfo.keys()];for(let e of r)this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});let i=[...t.keys()].sort(),s=[];for(let e of i){let n=t.get(e);if(n.length>1){s.push(n);continue}let r=n[0];this.canonicalIssuer.getId(r)}if(this.maxDeepIterations<0)if(this.maxWorkFactor===0)this.maxDeepIterations=0;else if(this.maxWorkFactor===1/0)this.maxDeepIterations=1/0;else{let e=s.reduce((e,t)=>e+t.length,0);this.maxDeepIterations=e**this.maxWorkFactor}this.maxDeepIterations>2**53-1&&(this.maxDeepIterations=1/0),this.remainingDeepIterations=this.maxDeepIterations;for(let e of s){let t=[];for(let r of e){if(this.canonicalIssuer.hasId(r))continue;let e=new n(`b`);e.getId(r);let i=this.hashNDegreeQuads(r,e);t.push(i)}t.sort(o);for(let e of t){let t=e.issuer.getOldIds();for(let e of t)this.canonicalIssuer.getId(e)}}let c=[];for(let e of this.quads){let t=a.serializeQuadComponents(this._componentWithCanonicalId(e.subject),e.predicate,this._componentWithCanonicalId(e.object),this._componentWithCanonicalId(e.graph));c.push(t)}return c.sort(),c.join(``)}hashFirstDegreeQuads(e){let t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(let n of r)t.push(a.serializeQuadComponents(this.modifyFirstDegreeComponent(e,n.subject,`subject`),n.predicate,this.modifyFirstDegreeComponent(e,n.object,`object`),this.modifyFirstDegreeComponent(e,n.graph,`graph`)));t.sort();let i=this.createMessageDigest();for(let e of t)i.update(e);return n.hash=i.digest(),n.hash}hashRelatedBlankNode(e,t,n,r){let i=this.createMessageDigest();i.update(r),r!==`g`&&i.update(this.getRelatedPredicate(t));let a;return a=this.canonicalIssuer.hasId(e)?`_:`+this.canonicalIssuer.getId(e):n.hasId(e)?`_:`+n.getId(e):this.blankNodeInfo.get(e).hash,i.update(a),i.digest()}hashNDegreeQuads(e,t){if(this.remainingDeepIterations===0)throw Error(`Maximum deep iterations exceeded (${this.maxDeepIterations}).`);this.remainingDeepIterations--;let n=this.createMessageDigest(),r=this.createHashToRelated(e,t),a=[...r.keys()].sort();for(let e of a){n.update(e);let a=``,o,s=new i(r.get(e)),c=0;for(;s.hasNext();){let e=s.next();if(++c%3==0&&this.timeout>0&&Date.now()-this.startTime>this.timeout)throw Error(`Canonize timeout.`);let n=t.clone(),r=``,i=[],l=!1;for(let t of e)if(this.canonicalIssuer.hasId(t)?r+=`_:`+this.canonicalIssuer.getId(t):(n.hasId(t)||i.push(t),r+=`_:`+n.getId(t)),a.length!==0&&r>a){l=!0;break}if(!l){for(let e of i){let t=this.hashNDegreeQuads(e,n);if(r+=`_:`+n.getId(e),r+=`<${t.hash}>`,n=t.issuer,a.length!==0&&r>a){l=!0;break}}l||(a.length===0||r<a)&&(a=r,o=n)}}n.update(a),t=o}return{hash:n.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return t.termType===`BlankNode`?{termType:`BlankNode`,value:t.value===e?`a`:`z`}:t}getRelatedPredicate(e){return`<${e.predicate.value}>`}createHashToRelated(e,t){let n=new Map,r=this.blankNodeInfo.get(e).quads;for(let i of r)this._addRelatedBlankNodeHash({quad:i,component:i.subject,position:`s`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:i,component:i.object,position:`o`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:i,component:i.graph,position:`g`,id:e,issuer:t,hashToRelated:n});return n}_hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){let n=this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if(t.termType!==`BlankNode`)return;let n=t.value,r=this.blankNodeInfo.get(n);r?r.quads.add(e):this.blankNodeInfo.set(n,{quads:new Set([e]),hash:null})}_addRelatedBlankNodeHash({quad:e,component:t,position:n,id:r,issuer:i,hashToRelated:a}){if(!(t.termType===`BlankNode`&&t.value!==r))return;let o=t.value,s=this.hashRelatedBlankNode(o,e,i,n),c=a.get(s);c?c.push(o):a.set(s,[o])}_componentWithCanonicalId(e){return e.termType===`BlankNode`&&!e.value.startsWith(this.canonicalIssuer.prefix)?{termType:`BlankNode`,value:this.canonicalIssuer.getId(e.value)}:e}};function o(e,t){return e.hash<t.hash?-1:+(e.hash>t.hash)}})),On=o((e=>{var t=En(),n=Dn();function r(t,n){if(n.inputFormat){if(n.inputFormat===`application/n-quads`){if(typeof t!=`string`)throw Error(`N-Quads input must be a string.`);return e.NQuads.parse(t)}throw Error(`Unknown canonicalization input format: "${n.inputFormat}".`)}return t}function i(e){if(e.format&&e.format!==`application/n-quads`)throw Error(`Unknown canonicalization output format: "${e.format}".`)}function a(){globalThis.RDF_CANONIZE_TRACE_URDNA2015&&console.trace(`[rdf-canonize] URDNA2015 is deprecated, use RDFC-1.0`)}e.NQuads=Tn(),e.IdentifierIssuer=bn(),e.canonize=async function(e,n={}){let o=r(e,n);if(i(n),!(`algorithm`in n))throw Error(`No RDF Dataset Canonicalization algorithm specified.`);if(n.algorithm===`RDFC-1.0`)return new t(n).main(o);if(n.algorithm===`URDNA2015`&&!n.rejectURDNA2015)return a(),new t(n).main(o);throw Error(`Invalid RDF Dataset Canonicalization algorithm: `+n.algorithm)},e._canonizeSync=function(e,t={}){let o=r(e,t);if(i(t),!(`algorithm`in t))throw Error(`No RDF Dataset Canonicalization algorithm specified.`);if(t.algorithm===`RDFC-1.0`)return new n(t).main(o);if(t.algorithm===`URDNA2015`&&!t.rejectURDNA2015)return a(),new n(t).main(o);throw Error(`Invalid RDF Dataset Canonicalization algorithm: `+t.algorithm)}})),kn=o(((e,t)=>{t.exports=On()})),An=o(((e,t)=>{var n={};t.exports=n,n.isArray=Array.isArray,n.isBoolean=e=>typeof e==`boolean`||Object.prototype.toString.call(e)===`[object Boolean]`,n.isDouble=e=>n.isNumber(e)&&(String(e).indexOf(`.`)!==-1||Math.abs(e)>=1e21),n.isEmptyObject=e=>n.isObject(e)&&Object.keys(e).length===0,n.isNumber=e=>typeof e==`number`||Object.prototype.toString.call(e)===`[object Number]`,n.isNumeric=e=>!isNaN(parseFloat(e))&&isFinite(e),n.isObject=e=>Object.prototype.toString.call(e)===`[object Object]`,n.isString=e=>typeof e==`string`||Object.prototype.toString.call(e)===`[object String]`,n.isUndefined=e=>e===void 0})),jn=o(((e,t)=>{var n=An(),r={};t.exports=r,r.isSubject=e=>n.isObject(e)&&!(`@value`in e||`@set`in e||`@list`in e)?Object.keys(e).length>1||!(`@id`in e):!1,r.isSubjectReference=e=>n.isObject(e)&&Object.keys(e).length===1&&`@id`in e,r.isValue=e=>n.isObject(e)&&`@value`in e,r.isList=e=>n.isObject(e)&&`@list`in e,r.isGraph=e=>n.isObject(e)&&`@graph`in e&&Object.keys(e).filter(e=>e!==`@id`&&e!==`@index`).length===1,r.isSimpleGraph=e=>r.isGraph(e)&&!(`@id`in e),r.isBlankNode=e=>{if(n.isObject(e)){if(`@id`in e){let t=e[`@id`];return!n.isString(t)||t.indexOf(`_:`)===0}return Object.keys(e).length===0||!(`@value`in e||`@set`in e||`@list`in e)}return!1}})),Mn=o(((e,t)=>{t.exports=class extends Error{constructor(e=`An unspecified JSON-LD error occurred.`,t=`jsonld.Error`,n={}){super(e),this.name=t,this.message=e,this.details=n}}})),Nn=o(((e,t)=>{var n=jn(),r=An(),i=kn().IdentifierIssuer,a=Mn(),o=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,s=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,c=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,l=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,u=/^@[a-zA-Z]+$/,d={headers:{accept:`application/ld+json, application/json`}},f={};t.exports=f,f.IdentifierIssuer=i,f.REGEX_BCP47=o,f.REGEX_KEYWORD=u,f.clone=function(e){if(e&&typeof e==`object`){let t;if(r.isArray(e)){t=[];for(let n=0;n<e.length;++n)t[n]=f.clone(e[n])}else if(e instanceof Map){t=new Map;for(let[n,r]of e)t.set(n,f.clone(r))}else if(e instanceof Set){t=new Set;for(let n of e)t.add(f.clone(n))}else if(r.isObject(e)){t={};for(let n in e)t[n]=f.clone(e[n])}else t=e.toString();return t}return e},f.asArray=function(e){return Array.isArray(e)?e:[e]},f.buildHeaders=(e={})=>{if(Object.keys(e).some(e=>e.toLowerCase()===`accept`))throw RangeError(`Accept header may not be specified; only "`+d.headers.accept+`" is supported.`);return Object.assign({Accept:d.headers.accept},e)},f.parseLinkHeader=e=>{let t={},n=e.match(s);for(let e=0;e<n.length;++e){let r=n[e].match(c);if(!r)continue;let i={target:r[1]},a=r[2];for(;r=l.exec(a);)i[r[1]]=r[2]===void 0?r[3]:r[2];let o=i.rel||``;Array.isArray(t[o])?t[o].push(i):t.hasOwnProperty(o)?t[o]=[t[o],i]:t[o]=i}return t},f.validateTypeValue=(e,t)=>{if(!r.isString(e)&&!(r.isArray(e)&&e.every(e=>r.isString(e)))){if(t&&r.isObject(e))switch(Object.keys(e).length){case 0:return;case 1:if(`@default`in e&&f.asArray(e[`@default`]).every(e=>r.isString(e)))return}throw new a(`Invalid JSON-LD syntax; "@type" value must a string, an array of strings, an empty object, or a default object.`,`jsonld.SyntaxError`,{code:`invalid type value`,value:e})}},f.hasProperty=(e,t)=>{if(e.hasOwnProperty(t)){let n=e[t];return!r.isArray(n)||n.length>0}return!1},f.hasValue=(e,t,i)=>{if(f.hasProperty(e,t)){let a=e[t],o=n.isList(a);if(r.isArray(a)||o){o&&(a=a[`@list`]);for(let e=0;e<a.length;++e)if(f.compareValues(i,a[e]))return!0}else if(!r.isArray(i))return f.compareValues(i,a)}return!1},f.addValue=(e,t,n,i)=>{if(i||={},`propertyIsArray`in i||(i.propertyIsArray=!1),`valueIsArray`in i||(i.valueIsArray=!1),`allowDuplicate`in i||(i.allowDuplicate=!0),`prependValue`in i||(i.prependValue=!1),i.valueIsArray)e[t]=n;else if(r.isArray(n)){n.length===0&&i.propertyIsArray&&!e.hasOwnProperty(t)&&(e[t]=[]),i.prependValue&&(n=n.concat(e[t]),e[t]=[]);for(let r=0;r<n.length;++r)f.addValue(e,t,n[r],i)}else if(e.hasOwnProperty(t)){let a=!i.allowDuplicate&&f.hasValue(e,t,n);!r.isArray(e[t])&&(!a||i.propertyIsArray)&&(e[t]=[e[t]]),a||(i.prependValue?e[t].unshift(n):e[t].push(n))}else e[t]=i.propertyIsArray?[n]:n},f.getValues=(e,t)=>[].concat(e[t]||[]),f.removeProperty=(e,t)=>{delete e[t]},f.removeValue=(e,t,n,r)=>{r||={},`propertyIsArray`in r||(r.propertyIsArray=!1);let i=f.getValues(e,t).filter(e=>!f.compareValues(e,n));i.length===0?f.removeProperty(e,t):i.length===1&&!r.propertyIsArray?e[t]=i[0]:e[t]=i},f.relabelBlankNodes=(e,t)=>(t||={},p(t.issuer||new i(`_:b`),e)),f.compareValues=(e,t)=>e===t||n.isValue(e)&&n.isValue(t)&&e[`@value`]===t[`@value`]&&e[`@type`]===t[`@type`]&&e[`@language`]===t[`@language`]&&e[`@index`]===t[`@index`]?!0:r.isObject(e)&&`@id`in e&&r.isObject(t)&&`@id`in t?e[`@id`]===t[`@id`]:!1,f.compareShortestLeast=(e,t)=>e.length<t.length?-1:t.length<e.length?1:e===t?0:e<t?-1:1;function p(e,t){if(r.isArray(t))for(let n=0;n<t.length;++n)t[n]=p(e,t[n]);else if(n.isList(t))t[`@list`]=p(e,t[`@list`]);else if(r.isObject(t)){n.isBlankNode(t)&&(t[`@id`]=e.getId(t[`@id`]));let r=Object.keys(t).sort();for(let n=0;n<r.length;++n){let i=r[n];i!==`@id`&&(t[i]=p(e,t[i]))}}return t}})),Pn=o(((e,t)=>{t.exports={LINK_HEADER_REL:`http://www.w3.org/ns/json-ld#context`,LINK_HEADER_CONTEXT:`http://www.w3.org/ns/json-ld#context`,RDF:`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,RDF_LIST:`http://www.w3.org/1999/02/22-rdf-syntax-ns#List`,RDF_FIRST:`http://www.w3.org/1999/02/22-rdf-syntax-ns#first`,RDF_REST:`http://www.w3.org/1999/02/22-rdf-syntax-ns#rest`,RDF_NIL:`http://www.w3.org/1999/02/22-rdf-syntax-ns#nil`,RDF_TYPE:`http://www.w3.org/1999/02/22-rdf-syntax-ns#type`,RDF_PLAIN_LITERAL:`http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral`,RDF_XML_LITERAL:`http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral`,RDF_JSON_LITERAL:`http://www.w3.org/1999/02/22-rdf-syntax-ns#JSON`,RDF_OBJECT:`http://www.w3.org/1999/02/22-rdf-syntax-ns#object`,RDF_LANGSTRING:`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`,XSD:`http://www.w3.org/2001/XMLSchema#`,XSD_BOOLEAN:`http://www.w3.org/2001/XMLSchema#boolean`,XSD_DOUBLE:`http://www.w3.org/2001/XMLSchema#double`,XSD_INTEGER:`http://www.w3.org/2001/XMLSchema#integer`,XSD_STRING:`http://www.w3.org/2001/XMLSchema#string`}})),Fn=o(((e,t)=>{t.exports=class{constructor(){this._requests={}}wrapLoader(e){let t=this;return t._loader=e,function(){return t.add.apply(t,arguments)}}async add(e){let t=this._requests[e];if(t)return Promise.resolve(t);t=this._requests[e]=this._loader(e);try{return await t}finally{delete this._requests[e]}}}})),In=o(((e,t)=>{var n=An(),r={};t.exports=r,r.parsers={simple:{keys:[`href`,`scheme`,`authority`,`path`,`query`,`fragment`],regex:/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/},full:{keys:[`href`,`protocol`,`scheme`,`authority`,`auth`,`user`,`password`,`hostname`,`port`,`path`,`directory`,`file`,`query`,`fragment`],regex:/^(([a-zA-Z][a-zA-Z0-9+-.]*):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},r.parse=(e,t)=>{let n={},i=r.parsers[t||`full`],a=i.regex.exec(e),o=i.keys.length;for(;o--;)n[i.keys[o]]=a[o]===void 0?null:a[o];return(n.scheme===`https`&&n.port===`443`||n.scheme===`http`&&n.port===`80`)&&(n.href=n.href.replace(`:`+n.port,``),n.authority=n.authority.replace(`:`+n.port,``),n.port=null),n.normalizedPath=r.removeDotSegments(n.path),n},r.prependBase=(e,t)=>{if(e===null||r.isAbsolute(t))return t;(!e||n.isString(e))&&(e=r.parse(e||``));let i=r.parse(t),a={protocol:e.protocol||``};if(i.authority!==null)a.authority=i.authority,a.path=i.path,a.query=i.query;else if(a.authority=e.authority,i.path===``)a.path=e.path,i.query===null?a.query=e.query:a.query=i.query;else{if(i.path.indexOf(`/`)===0)a.path=i.path;else{let t=e.path;t=t.substr(0,t.lastIndexOf(`/`)+1),(t.length>0||e.authority)&&t.substr(-1)!==`/`&&(t+=`/`),t+=i.path,a.path=t}a.query=i.query}i.path!==``&&(a.path=r.removeDotSegments(a.path));let o=a.protocol;return a.authority!==null&&(o+=`//`+a.authority),o+=a.path,a.query!==null&&(o+=`?`+a.query),i.fragment!==null&&(o+=`#`+i.fragment),o===``&&(o=`./`),o},r.removeBase=(e,t)=>{if(e===null)return t;(!e||n.isString(e))&&(e=r.parse(e||``));let i=``;if(e.href===``?t.indexOf(`//`)&&(i+=`//`):i+=(e.protocol||``)+`//`+(e.authority||``),t.indexOf(i)!==0)return t;let a=r.parse(t.substr(i.length)),o=e.normalizedPath.split(`/`),s=a.normalizedPath.split(`/`),c=a.fragment||a.query?0:1;for(;o.length>0&&s.length>c&&o[0]===s[0];)o.shift(),s.shift();let l=``;if(o.length>0){o.pop();for(let e=0;e<o.length;++e)l+=`../`}return l+=s.join(`/`),a.query!==null&&(l+=`?`+a.query),a.fragment!==null&&(l+=`#`+a.fragment),l===``&&(l=`./`),l},r.removeDotSegments=e=>{if(e.length===0)return``;let t=e.split(`/`),n=[];for(;t.length>0;){let e=t.shift(),r=t.length===0;if(e===`.`){r&&n.push(``);continue}if(e===`..`){n.pop(),r&&n.push(``);continue}n.push(e)}return e[0]===`/`&&n.length>0&&n[0]!==``&&n.unshift(``),n.length===1&&n[0]===``?`/`:n.join(`/`)};var i=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;r.isAbsolute=e=>n.isString(e)&&i.test(e),r.isRelative=e=>n.isString(e)})),Ln=o(((e,t)=>{var{parseLinkHeader:n,buildHeaders:r}=Nn(),{LINK_HEADER_CONTEXT:i}=Pn(),a=Mn(),o=Fn(),{prependBase:s}=In(),c=/(^|(\r\n))link:/i;t.exports=({secure:e,headers:t={},xhr:u}={headers:{}})=>{return t=r(t),new o().wrapLoader(d);async function d(r){if(r.indexOf(`http:`)!==0&&r.indexOf(`https:`)!==0)throw new a(`URL could not be dereferenced; only "http" and "https" URLs are supported.`,`jsonld.InvalidUrl`,{code:`loading document failed`,url:r});if(e&&r.indexOf(`https`)!==0)throw new a(`URL could not be dereferenced; secure mode is enabled and the URL's scheme is not "https".`,`jsonld.InvalidUrl`,{code:`loading document failed`,url:r});let o;try{o=await l(u,r,t)}catch(e){throw new a(`URL could not be dereferenced, an error occurred.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:r,cause:e})}if(o.status>=400)throw new a(`URL could not be dereferenced: `+o.statusText,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:r,httpStatusCode:o.status});let f={contextUrl:null,documentUrl:r,document:o.response},p=null,m=o.getResponseHeader(`Content-Type`),h;if(c.test(o.getAllResponseHeaders())&&(h=o.getResponseHeader(`Link`)),h&&m!==`application/ld+json`){let e=n(h),t=e[i];if(Array.isArray(t))throw new a(`URL could not be dereferenced, it has more than one associated HTTP Link Header.`,`jsonld.InvalidUrl`,{code:`multiple context link headers`,url:r});t&&(f.contextUrl=t.target),p=e.alternate,p&&p.type==`application/ld+json`&&!(m||``).match(/^application\/(\w*\+)?json$/)&&(f=await d(s(r,p.target)))}return f}};function l(e,t,n){e||=XMLHttpRequest;let r=new e;return new Promise((e,i)=>{r.onload=()=>e(r),r.onerror=e=>i(e),r.open(`GET`,t,!0);for(let e in n)r.setRequestHeader(e,n[e]);r.send()})}})),Rn=o(((e,t)=>{var n=Ln(),r={};t.exports=r,r.setupDocumentLoaders=function(e){typeof XMLHttpRequest<`u`&&(e.documentLoaders.xhr=n,e.useDocumentLoader(`xhr`))},r.setupGlobals=function(e){globalThis.JsonLdProcessor===void 0&&Object.defineProperty(globalThis,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:e.JsonLdProcessor})}})),zn=o(((e,t)=>{t.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}})),Bn=o(((e,t)=>{t.exports=n,n.Node=o,n.create=n;function n(e){var t=this;if(t instanceof n||(t=new n),t.tail=null,t.head=null,t.length=0,e&&typeof e.forEach==`function`)e.forEach(function(e){t.push(e)});else if(arguments.length>0)for(var r=0,i=arguments.length;r<i;r++)t.push(arguments[r]);return t}n.prototype.removeNode=function(e){if(e.list!==this)throw Error(`removing node which does not belong to this list`);var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t},n.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||=e,this.length++}},n.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||=e,this.length++}},n.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)i(this,arguments[e]);return this.length},n.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)a(this,arguments[e]);return this.length},n.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},n.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},n.prototype.forEach=function(e,t){t||=this;for(var n=this.head,r=0;n!==null;r++)e.call(t,n.value,r,this),n=n.next},n.prototype.forEachReverse=function(e,t){t||=this;for(var n=this.tail,r=this.length-1;n!==null;r--)e.call(t,n.value,r,this),n=n.prev},n.prototype.get=function(e){for(var t=0,n=this.head;n!==null&&t<e;t++)n=n.next;if(t===e&&n!==null)return n.value},n.prototype.getReverse=function(e){for(var t=0,n=this.tail;n!==null&&t<e;t++)n=n.prev;if(t===e&&n!==null)return n.value},n.prototype.map=function(e,t){t||=this;for(var r=new n,i=this.head;i!==null;)r.push(e.call(t,i.value,this)),i=i.next;return r},n.prototype.mapReverse=function(e,t){t||=this;for(var r=new n,i=this.tail;i!==null;)r.push(e.call(t,i.value,this)),i=i.prev;return r},n.prototype.reduce=function(e,t){var n,r=this.head;if(arguments.length>1)n=t;else if(this.head)r=this.head.next,n=this.head.value;else throw TypeError(`Reduce of empty list with no initial value`);for(var i=0;r!==null;i++)n=e(n,r.value,i),r=r.next;return n},n.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else if(this.tail)r=this.tail.prev,n=this.tail.value;else throw TypeError(`Reduce of empty list with no initial value`);for(var i=this.length-1;r!==null;i--)n=e(n,r.value,i),r=r.prev;return n},n.prototype.toArray=function(){for(var e=Array(this.length),t=0,n=this.head;n!==null;t++)e[t]=n.value,n=n.next;return e},n.prototype.toArrayReverse=function(){for(var e=Array(this.length),t=0,n=this.tail;n!==null;t++)e[t]=n.value,n=n.prev;return e},n.prototype.slice=function(e,t){t||=this.length,t<0&&(t+=this.length),e||=0,e<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,a=this.head;a!==null&&i<e;i++)a=a.next;for(;a!==null&&i<t;i++,a=a.next)r.push(a.value);return r},n.prototype.sliceReverse=function(e,t){t||=this.length,t<0&&(t+=this.length),e||=0,e<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,a=this.tail;a!==null&&i>t;i--)a=a.prev;for(;a!==null&&i>e;i--,a=a.prev)r.push(a.value);return r},n.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,a=this.head;a!==null&&i<e;i++)a=a.next;for(var o=[],i=0;a&&i<t;i++)o.push(a.value),a=this.removeNode(a);a===null&&(a=this.tail),a!==this.head&&a!==this.tail&&(a=a.prev);for(var i=0;i<n.length;i++)a=r(this,a,n[i]);return o},n.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;n!==null;n=n.prev){var r=n.prev;n.prev=n.next,n.next=r}return this.head=t,this.tail=e,this};function r(e,t,n){var r=t===e.head?new o(n,null,t,e):new o(n,t,t.next,e);return r.next===null&&(e.tail=r),r.prev===null&&(e.head=r),e.length++,r}function i(e,t){e.tail=new o(t,e.tail,null,e),e.head||=e.tail,e.length++}function a(e,t){e.head=new o(t,null,e.head,e),e.tail||=e.head,e.length++}function o(e,t,n,r){if(!(this instanceof o))return new o(e,t,n,r);this.list=r,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}try{zn()(n)}catch{}})),Vn=o(((e,t)=>{var n=Bn(),r=Symbol(`max`),i=Symbol(`length`),a=Symbol(`lengthCalculator`),o=Symbol(`allowStale`),s=Symbol(`maxAge`),c=Symbol(`dispose`),l=Symbol(`noDisposeOnSet`),u=Symbol(`lruList`),d=Symbol(`cache`),f=Symbol(`updateAgeOnGet`),p=()=>1,m=class{constructor(e){if(typeof e==`number`&&(e={max:e}),e||={},e.max&&(typeof e.max!=`number`||e.max<0))throw TypeError(`max must be a non-negative number`);this[r]=e.max||1/0;let t=e.length||p;if(this[a]=typeof t==`function`?t:p,this[o]=e.stale||!1,e.maxAge&&typeof e.maxAge!=`number`)throw TypeError(`maxAge must be a number`);this[s]=e.maxAge||0,this[c]=e.dispose,this[l]=e.noDisposeOnSet||!1,this[f]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!=`number`||e<0)throw TypeError(`max must be a non-negative number`);this[r]=e||1/0,_(this)}get max(){return this[r]}set allowStale(e){this[o]=!!e}get allowStale(){return this[o]}set maxAge(e){if(typeof e!=`number`)throw TypeError(`maxAge must be a non-negative number`);this[s]=e,_(this)}get maxAge(){return this[s]}set lengthCalculator(e){typeof e!=`function`&&(e=p),e!==this[a]&&(this[a]=e,this[i]=0,this[u].forEach(e=>{e.length=this[a](e.value,e.key),this[i]+=e.length})),_(this)}get lengthCalculator(){return this[a]}get length(){return this[i]}get itemCount(){return this[u].length}rforEach(e,t){t||=this;for(let n=this[u].tail;n!==null;){let r=n.prev;b(this,e,n,t),n=r}}forEach(e,t){t||=this;for(let n=this[u].head;n!==null;){let r=n.next;b(this,e,n,t),n=r}}keys(){return this[u].toArray().map(e=>e.key)}values(){return this[u].toArray().map(e=>e.value)}reset(){this[c]&&this[u]&&this[u].length&&this[u].forEach(e=>this[c](e.key,e.value)),this[d]=new Map,this[u]=new n,this[i]=0}dump(){return this[u].map(e=>!g(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[u]}set(e,t,n){if(n||=this[s],n&&typeof n!=`number`)throw TypeError(`maxAge must be a number`);let o=n?Date.now():0,f=this[a](t,e);if(this[d].has(e)){if(f>this[r])return v(this,this[d].get(e)),!1;let a=this[d].get(e).value;return this[c]&&(this[l]||this[c](e,a.value)),a.now=o,a.maxAge=n,a.value=t,this[i]+=f-a.length,a.length=f,this.get(e),_(this),!0}let p=new y(e,t,f,o,n);return p.length>this[r]?(this[c]&&this[c](e,t),!1):(this[i]+=p.length,this[u].unshift(p),this[d].set(e,this[u].head),_(this),!0)}has(e){if(!this[d].has(e))return!1;let t=this[d].get(e).value;return!g(this,t)}get(e){return h(this,e,!0)}peek(e){return h(this,e,!1)}pop(){let e=this[u].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[d].get(e))}load(e){this.reset();let t=Date.now();for(let n=e.length-1;n>=0;n--){let r=e[n],i=r.e||0;if(i===0)this.set(r.k,r.v);else{let e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[d].forEach((e,t)=>h(this,t,!1))}},h=(e,t,n)=>{let r=e[d].get(t);if(r){let t=r.value;if(g(e,t)){if(v(e,r),!e[o])return}else n&&(e[f]&&(r.value.now=Date.now()),e[u].unshiftNode(r));return t.value}},g=(e,t)=>{if(!t||!t.maxAge&&!e[s])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[s]&&n>e[s]},_=e=>{if(e[i]>e[r])for(let t=e[u].tail;e[i]>e[r]&&t!==null;){let n=t.prev;v(e,t),t=n}},v=(e,t)=>{if(t){let n=t.value;e[c]&&e[c](n.key,n.value),e[i]-=n.length,e[d].delete(n.key),e[u].removeNode(t)}},y=class{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}},b=(e,t,n,r)=>{let i=n.value;g(e,i)&&(v(e,n),e[o]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};t.exports=m})),Hn=o(((e,t)=>{var n=Vn(),r=10;t.exports=class{constructor({document:e}){this.document=e,this.cache=new n({max:r})}getProcessed(e){return this.cache.get(e)}setProcessed(e,t){this.cache.set(e,t)}}})),Un=o(((e,t)=>{var{isArray:n,isObject:r,isString:i}=An(),{asArray:a}=Nn(),{prependBase:o}=In(),s=Mn(),c=Hn(),l=10;t.exports=class{constructor({sharedCache:e}){this.perOpCache=new Map,this.sharedCache=e}async resolve({activeCtx:e,context:t,documentLoader:o,base:s,cycles:l=new Set}){t&&r(t)&&t[`@context`]&&(t=t[`@context`]),t=a(t);let d=[];for(let a of t){if(i(a)){let t=this._get(a);t||=await this._resolveRemoteContext({activeCtx:e,url:a,documentLoader:o,base:s,cycles:l}),n(t)?d.push(...t):d.push(t);continue}if(a===null){d.push(new c({document:null}));continue}r(a)||u(t);let f=JSON.stringify(a),p=this._get(f);p||(p=new c({document:a}),this._cacheResolvedContext({key:f,resolved:p,tag:`static`})),d.push(p)}return d}_get(e){let t=this.perOpCache.get(e);if(!t){let n=this.sharedCache.get(e);n&&(t=n.get(`static`),t&&this.perOpCache.set(e,t))}return t}_cacheResolvedContext({key:e,resolved:t,tag:n}){if(this.perOpCache.set(e,t),n!==void 0){let r=this.sharedCache.get(e);r||(r=new Map,this.sharedCache.set(e,r)),r.set(n,t)}return t}async _resolveRemoteContext({activeCtx:e,url:t,documentLoader:n,base:r,cycles:i}){t=o(r,t);let{context:a,remoteDoc:s}=await this._fetchContext({activeCtx:e,url:t,documentLoader:n,cycles:i});r=s.documentUrl||t,d({context:a,base:r});let c=await this.resolve({activeCtx:e,context:a,documentLoader:n,base:r,cycles:i});return this._cacheResolvedContext({key:t,resolved:c,tag:s.tag}),c}async _fetchContext({activeCtx:e,url:t,documentLoader:a,cycles:o}){if(o.size>l)throw new s(`Maximum number of @context URLs exceeded.`,`jsonld.ContextUrlError`,{code:e.processingMode===`json-ld-1.0`?`loading remote context failed`:`context overflow`,max:l});if(o.has(t))throw new s(`Cyclical @context URLs detected.`,`jsonld.ContextUrlError`,{code:e.processingMode===`json-ld-1.0`?`recursive context inclusion`:`context overflow`,url:t});o.add(t);let c,u;try{u=await a(t),c=u.document||null,i(c)&&(c=JSON.parse(c))}catch(e){throw new s(`Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context. URL: "${t}".`,`jsonld.InvalidUrl`,{code:`loading remote context failed`,url:t,cause:e})}if(!r(c))throw new s(`Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object. URL: "${t}".`,`jsonld.InvalidUrl`,{code:`invalid remote context`,url:t});return c=`@context`in c?{"@context":c[`@context`]}:{"@context":{}},u.contextUrl&&(n(c[`@context`])||(c[`@context`]=[c[`@context`]]),c[`@context`].push(u.contextUrl)),{context:c,remoteDoc:u}}};function u(e){throw new s(`Invalid JSON-LD syntax; @context must be an object.`,`jsonld.SyntaxError`,{code:`invalid local context`,context:e})}function d({context:e,base:t}){if(!e)return;let a=e[`@context`];if(i(a)){e[`@context`]=o(t,a);return}if(n(a)){for(let e=0;e<a.length;++e){let n=a[e];if(i(n)){a[e]=o(t,n);continue}r(n)&&d({context:{"@context":n},base:t})}return}if(r(a))for(let e in a)d({context:a[e],base:t})}})),Wn=o(((e,t)=>{t.exports=kn().NQuads})),Gn=o(((e,t)=>{var n=Mn(),{isArray:r}=An(),{asArray:i}=Nn(),a={};t.exports=a,a.defaultEventHandler=null,a.setupEventHandler=({options:e={}})=>{let t=[].concat(e.safe?a.safeEventHandler:[],e.eventHandler?i(e.eventHandler):[],a.defaultEventHandler?a.defaultEventHandler:[]);return t.length===0?null:t},a.handleEvent=({event:e,options:t})=>{o({event:e,handlers:t.eventHandler})};function o({event:e,handlers:t}){let i=!0;for(let a=0;i&&a<t.length;++a){i=!1;let s=t[a];if(r(s))i=o({event:e,handlers:s});else if(typeof s==`function`)s({event:e,next:()=>{i=!0}});else if(typeof s==`object`)e.code in s?s[e.code]({event:e,next:()=>{i=!0}}):i=!0;else throw new n(`Invalid event handler.`,`jsonld.InvalidEventHandler`,{event:e})}return i}var s=new Set([`empty object`,`free-floating scalar`,`invalid @language value`,`invalid property`,`null @id value`,`null @value value`,`object with only @id`,`object with only @language`,`object with only @list`,`object with only @value`,`relative @id reference`,`relative @type reference`,`relative @vocab reference`,`reserved @id value`,`reserved @reverse value`,`reserved term`,`blank node predicate`,`relative graph reference`,`relative object reference`,`relative predicate reference`,`relative subject reference`,`rdfDirection not set`]);a.safeEventHandler=function({event:e,next:t}){if(e.level===`warning`&&s.has(e.code))throw new n(`Safe mode validation error.`,`jsonld.ValidationError`,{event:e});t()},a.logEventHandler=function({event:e,next:t}){console.log(`EVENT: ${e.message}`,{event:e}),t()},a.logWarningEventHandler=function({event:e,next:t}){e.level===`warning`&&console.warn(`WARNING: ${e.message}`,{event:e}),t()},a.unhandledEventHandler=function({event:e}){throw new n(`No handler for event.`,`jsonld.UnhandledEvent`,{event:e})},a.setDefaultEventHandler=function({eventHandler:e}={}){a.defaultEventHandler=e?i(e):null}})),Kn=o(((e,t)=>{var n=Nn(),r=Mn(),{isArray:i,isObject:a,isString:o,isUndefined:s}=An(),{isAbsolute:c,isRelative:l,prependBase:u}=In(),{handleEvent:d}=Gn(),{REGEX_BCP47:f,REGEX_KEYWORD:p,asArray:m,compareShortestLeast:h}=Nn(),g=new Map,_=1e4,v={};t.exports=v,v.process=async({activeCtx:e,localCtx:t,options:n,propagate:s=!0,overrideProtected:p=!1,cycles:h=new Set})=>{if(a(t)&&`@context`in t&&i(t[`@context`])&&(t=t[`@context`]),m(t).length===0)return e;let g=[],_=[({event:e,next:t})=>{g.push(e),t()}];n.eventHandler&&_.push(n.eventHandler);let b=n;n={...n,eventHandler:_};let x=await n.contextResolver.resolve({activeCtx:e,context:t,documentLoader:n.documentLoader,base:n.base});a(x[0].document)&&typeof x[0].document[`@propagate`]==`boolean`&&(s=x[0].document[`@propagate`]);let S=e;!s&&!S.previousContext&&(S=S.clone(),S.previousContext=e);for(let i of x){let{document:s}=i;if(e=S,s===null){if(!p&&Object.keys(e.protected).length!==0)throw new r(`Tried to nullify a context with protected terms outside of a term definition.`,`jsonld.SyntaxError`,{code:`invalid context nullification`});S=e=v.getInitialContext(n).clone();continue}let m=i.getProcessed(e);if(m){if(b.eventHandler)for(let e of m.events)d({event:e,options:b});S=e=m.context;continue}if(a(s)&&`@context`in s&&(s=s[`@context`]),!a(s))throw new r(`Invalid JSON-LD syntax; @context must be an object.`,`jsonld.SyntaxError`,{code:`invalid local context`,context:s});S=S.clone();let _=new Map;if(`@version`in s){if(s[`@version`]!==1.1)throw new r(`Unsupported JSON-LD version: `+s[`@version`],`jsonld.UnsupportedVersion`,{code:`invalid @version value`,context:s});if(e.processingMode&&e.processingMode===`json-ld-1.0`)throw new r(`@version: `+s[`@version`]+` not compatible with `+e.processingMode,`jsonld.ProcessingModeConflict`,{code:`processing mode conflict`,context:s});S.processingMode=`json-ld-1.1`,S[`@version`]=s[`@version`],_.set(`@version`,!0)}if(S.processingMode=S.processingMode||e.processingMode,`@base`in s){let e=s[`@base`];if(!(e===null||c(e)))if(l(e))e=u(S[`@base`],e);else throw new r(`Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI, a relative IRI, or null.`,`jsonld.SyntaxError`,{code:`invalid base IRI`,context:s});S[`@base`]=e,_.set(`@base`,!0)}if(`@vocab`in s){let e=s[`@vocab`];if(e===null)delete S[`@vocab`];else if(!o(e))throw new r(`Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.`,`jsonld.SyntaxError`,{code:`invalid vocab mapping`,context:s});else if(!c(e)&&v.processingMode(S,1))throw new r(`Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.`,`jsonld.SyntaxError`,{code:`invalid vocab mapping`,context:s});else{let t=y(S,e,{vocab:!0,base:!0},void 0,void 0,n);c(t)||n.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`relative @vocab reference`,level:`warning`,message:`Relative @vocab reference found.`,details:{vocab:t}},options:n}),S[`@vocab`]=t}_.set(`@vocab`,!0)}if(`@language`in s){let e=s[`@language`];if(e===null)delete S[`@language`];else if(o(e))e.match(f)||n.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:n}),S[`@language`]=e.toLowerCase();else throw new r(`Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.`,`jsonld.SyntaxError`,{code:`invalid default language`,context:s});_.set(`@language`,!0)}if(`@direction`in s){let t=s[`@direction`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @direction not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context member`,context:s});if(t===null)delete S[`@direction`];else if(t!==`ltr`&&t!==`rtl`)throw new r(`Invalid JSON-LD syntax; the value of "@direction" in a @context must be null, "ltr", or "rtl".`,`jsonld.SyntaxError`,{code:`invalid base direction`,context:s});else S[`@direction`]=t;_.set(`@direction`,!0)}if(`@propagate`in s){let n=s[`@propagate`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @propagate not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context entry`,context:s});if(typeof n!=`boolean`)throw new r(`Invalid JSON-LD syntax; @propagate value must be a boolean.`,`jsonld.SyntaxError`,{code:`invalid @propagate value`,context:t});_.set(`@propagate`,!0)}if(`@import`in s){let i=s[`@import`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @import not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context entry`,context:s});if(!o(i))throw new r(`Invalid JSON-LD syntax; @import must be a string.`,`jsonld.SyntaxError`,{code:`invalid @import value`,context:t});let a=await n.contextResolver.resolve({activeCtx:e,context:i,documentLoader:n.documentLoader,base:n.base});if(a.length!==1)throw new r(`Invalid JSON-LD syntax; @import must reference a single context.`,`jsonld.SyntaxError`,{code:`invalid remote context`,context:t});let c=a[0].getProcessed(e);if(c)s=c;else{let n=a[0].document;if(`@import`in n)throw new r(`Invalid JSON-LD syntax: imported context must not include @import.`,`jsonld.SyntaxError`,{code:`invalid context entry`,context:t});for(let e in n)s.hasOwnProperty(e)||(s[e]=n[e]);a[0].setProcessed(e,s)}_.set(`@import`,!0)}_.set(`@protected`,s[`@protected`]||!1);for(let e in s)if(v.createTermDefinition({activeCtx:S,localCtx:s,term:e,defined:_,options:n,overrideProtected:p}),a(s[e])&&`@context`in s[e]){let t=s[e][`@context`],i=!0;if(o(t)){let e=u(n.base,t);h.has(e)?i=!1:h.add(e)}if(i)try{await v.process({activeCtx:S.clone(),localCtx:s[e][`@context`],overrideProtected:!0,options:n,cycles:h})}catch{throw new r(`Invalid JSON-LD syntax; invalid scoped context.`,`jsonld.SyntaxError`,{code:`invalid scoped context`,context:s[e][`@context`],term:e})}}i.setProcessed(e,{context:S,events:g})}return S},v.createTermDefinition=({activeCtx:e,localCtx:t,term:n,defined:s,options:l,overrideProtected:u=!1})=>{if(s.has(n)){if(s.get(n))return;throw new r(`Cyclical context definition detected.`,`jsonld.CyclicalContext`,{code:`cyclic IRI mapping`,context:t,term:n})}s.set(n,!1);let f;if(t.hasOwnProperty(n)&&(f=t[n]),n===`@type`&&a(f)&&(f[`@container`]||`@set`)===`@set`&&v.processingMode(e,1.1)){let e=[`@container`,`@id`,`@protected`],i=Object.keys(f);if(i.length===0||i.some(t=>!e.includes(t)))throw new r(`Invalid JSON-LD syntax; keywords cannot be overridden.`,`jsonld.SyntaxError`,{code:`keyword redefinition`,context:t,term:n})}else if(v.isKeyword(n))throw new r(`Invalid JSON-LD syntax; keywords cannot be overridden.`,`jsonld.SyntaxError`,{code:`keyword redefinition`,context:t,term:n});else if(n.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved term`,level:`warning`,message:`Terms beginning with "@" are reserved for future use and dropped.`,details:{term:n}},options:l});return}else if(n===``)throw new r(`Invalid JSON-LD syntax; a term cannot be an empty string.`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let m=e.mappings.get(n);e.mappings.has(n)&&e.mappings.delete(n);let h=!1;if((o(f)||f===null)&&(h=!0,f={"@id":f}),!a(f))throw new r(`Invalid JSON-LD syntax; @context term values must be strings or objects.`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let g={};e.mappings.set(n,g),g.reverse=!1;let _=[`@container`,`@id`,`@language`,`@reverse`,`@type`];v.processingMode(e,1.1)&&_.push(`@context`,`@direction`,`@index`,`@nest`,`@prefix`,`@protected`);for(let e in f)if(!_.includes(e))throw new r(`Invalid JSON-LD syntax; a term definition must not contain `+e,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let x=n.indexOf(`:`);if(g._termHasColon=x>0,`@reverse`in f){if(`@id`in f)throw new r(`Invalid JSON-LD syntax; a @reverse term definition must not contain @id.`,`jsonld.SyntaxError`,{code:`invalid reverse property`,context:t});if(`@nest`in f)throw new r(`Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.`,`jsonld.SyntaxError`,{code:`invalid reverse property`,context:t});let i=f[`@reverse`];if(!o(i))throw new r(`Invalid JSON-LD syntax; a @context @reverse value must be a string.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});if(i.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved @reverse value`,level:`warning`,message:`@reverse values beginning with "@" are reserved for future use and dropped.`,details:{reverse:i}},options:l}),m?e.mappings.set(n,m):e.mappings.delete(n);return}let a=y(e,i,{vocab:!0,base:!1},t,s,l);if(!c(a))throw new r(`Invalid JSON-LD syntax; a @context @reverse value must be an absolute IRI or a blank node identifier.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});g[`@id`]=a,g.reverse=!0}else if(`@id`in f){let i=f[`@id`];if(i&&!o(i))throw new r(`Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});if(i===null)g[`@id`]=null;else if(!v.isKeyword(i)&&i.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`@id values beginning with "@" are reserved for future use and dropped.`,details:{id:i}},options:l}),m?e.mappings.set(n,m):e.mappings.delete(n);return}else if(i!==n){if(i=y(e,i,{vocab:!0,base:!1},t,s,l),!c(i)&&!v.isKeyword(i))throw new r(`Invalid JSON-LD syntax; a @context @id value must be an absolute IRI, a blank node identifier, or a keyword.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});if(n.match(/(?::[^:])|\//)&&y(e,n,{vocab:!0,base:!1},t,new Map(s).set(n,!0),l)!==i)throw new r(`Invalid JSON-LD syntax; term in form of IRI must expand to definition.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});g[`@id`]=i,g._prefix=h&&!g._termHasColon&&i.match(/[:\/\?#\[\]@]$/)!==null}}if(!(`@id`in g))if(g._termHasColon){let r=n.substr(0,x);if(t.hasOwnProperty(r)&&v.createTermDefinition({activeCtx:e,localCtx:t,term:r,defined:s,options:l}),e.mappings.has(r)){let t=n.substr(x+1);g[`@id`]=e.mappings.get(r)[`@id`]+t}else g[`@id`]=n}else if(n===`@type`)g[`@id`]=n;else{if(!(`@vocab`in e))throw new r(`Invalid JSON-LD syntax; @context terms must define an @id.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t,term:n});g[`@id`]=e[`@vocab`]+n}if((f[`@protected`]===!0||s.get(`@protected`)===!0&&f[`@protected`]!==!1)&&(e.protected[n]=!0,g.protected=!0),s.set(n,!0),`@type`in f){let n=f[`@type`];if(!o(n))throw new r(`Invalid JSON-LD syntax; an @context @type value must be a string.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t});if(n===`@json`||n===`@none`){if(v.processingMode(e,1))throw new r(`Invalid JSON-LD syntax; an @context @type value must not be "${n}" in JSON-LD 1.0 mode.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t})}else if(n!==`@id`&&n!==`@vocab`){if(n=y(e,n,{vocab:!0,base:!1},t,s,l),!c(n))throw new r(`Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t});if(n.indexOf(`_:`)===0)throw new r(`Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t})}g[`@type`]=n}if(`@container`in f){let n=o(f[`@container`])?[f[`@container`]]:f[`@container`]||[],a=[`@list`,`@set`,`@index`,`@language`],s=!0,c=n.includes(`@set`);if(v.processingMode(e,1.1)){if(a.push(`@graph`,`@id`,`@type`),n.includes(`@list`)){if(n.length!==1)throw new r(`Invalid JSON-LD syntax; @context @container with @list must have no other values`,`jsonld.SyntaxError`,{code:`invalid container mapping`,context:t})}else if(n.includes(`@graph`)){if(n.some(e=>e!==`@graph`&&e!==`@id`&&e!==`@index`&&e!==`@set`))throw new r(`Invalid JSON-LD syntax; @context @container with @graph must have no other values other than @id, @index, and @set`,`jsonld.SyntaxError`,{code:`invalid container mapping`,context:t})}else s&=n.length<=(c?2:1);if(n.includes(`@type`)&&(g[`@type`]=g[`@type`]||`@id`,![`@id`,`@vocab`].includes(g[`@type`])))throw new r(`Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t})}else s&=!i(f[`@container`]),s&=n.length<=1;if(s&=n.every(e=>a.includes(e)),s&=!(c&&n.includes(`@list`)),!s)throw new r(`Invalid JSON-LD syntax; @context @container value must be one of the following: `+a.join(`, `),`jsonld.SyntaxError`,{code:`invalid container mapping`,context:t});if(g.reverse&&!n.every(e=>[`@index`,`@set`].includes(e)))throw new r(`Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.`,`jsonld.SyntaxError`,{code:`invalid reverse property`,context:t});g[`@container`]=n}if(`@index`in f){if(!(`@container`in f)||!g[`@container`].includes(`@index`))throw new r(`Invalid JSON-LD syntax; @index without @index in @container: "${f[`@index`]}" on term "${n}".`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});if(!o(f[`@index`])||f[`@index`].indexOf(`@`)===0)throw new r(`Invalid JSON-LD syntax; @index must expand to an IRI: "${f[`@index`]}" on term "${n}".`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});g[`@index`]=f[`@index`]}if(`@context`in f&&(g[`@context`]=f[`@context`]),`@language`in f&&!(`@type`in f)){let e=f[`@language`];if(e!==null&&!o(e))throw new r(`Invalid JSON-LD syntax; @context @language value must be a string or null.`,`jsonld.SyntaxError`,{code:`invalid language mapping`,context:t});e!==null&&(e=e.toLowerCase()),g[`@language`]=e}if(`@prefix`in f){if(n.match(/:|\//))throw new r(`Invalid JSON-LD syntax; @context @prefix used on a compact IRI term`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});if(v.isKeyword(g[`@id`]))throw new r(`Invalid JSON-LD syntax; keywords may not be used as prefixes`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});if(typeof f[`@prefix`]==`boolean`)g._prefix=f[`@prefix`]===!0;else throw new r(`Invalid JSON-LD syntax; @context value for @prefix must be boolean`,`jsonld.SyntaxError`,{code:`invalid @prefix value`,context:t})}if(`@direction`in f){let e=f[`@direction`];if(e!==null&&e!==`ltr`&&e!==`rtl`)throw new r(`Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".`,`jsonld.SyntaxError`,{code:`invalid base direction`,context:t});g[`@direction`]=e}if(`@nest`in f){let e=f[`@nest`];if(!o(e)||e!==`@nest`&&e.indexOf(`@`)===0)throw new r(`Invalid JSON-LD syntax; @context @nest value must be a string which is not a keyword other than @nest.`,`jsonld.SyntaxError`,{code:`invalid @nest value`,context:t});g[`@nest`]=e}let S=g[`@id`];if(S===`@context`||S===`@preserve`)throw new r(`Invalid JSON-LD syntax; @context and @preserve cannot be aliased.`,`jsonld.SyntaxError`,{code:`invalid keyword alias`,context:t});if(m&&m.protected&&!u&&(e.protected[n]=!0,g.protected=!0,!b(m,g)))throw new r(`Invalid JSON-LD syntax; tried to redefine a protected term.`,`jsonld.SyntaxError`,{code:`protected term redefinition`,context:t,term:n})},v.expandIri=(e,t,n,r)=>y(e,t,n,void 0,void 0,r);function y(e,t,n,r,i,s){if(t===null||!o(t)||v.isKeyword(t))return t;if(t.match(p))return null;if(r&&r.hasOwnProperty(t)&&i.get(t)!==!0&&v.createTermDefinition({activeCtx:e,localCtx:r,term:t,defined:i,options:s}),n||={},n.vocab){let n=e.mappings.get(t);if(n===null)return null;if(a(n)&&`@id`in n)return n[`@id`]}let l=t.indexOf(`:`);if(l>0){let n=t.substr(0,l),a=t.substr(l+1);if(n===`_`||a.indexOf(`//`)===0)return t;r&&r.hasOwnProperty(n)&&v.createTermDefinition({activeCtx:e,localCtx:r,term:n,defined:i,options:s});let o=e.mappings.get(n);if(o&&o._prefix)return o[`@id`]+a;if(c(t))return t}if(n.vocab&&`@vocab`in e)t=e[`@vocab`]+t;else if(n.base){let n,r;`@base`in e?e[`@base`]?(r=u(s.base,e[`@base`]),n=u(r,t)):(r=e[`@base`],n=t):(r=s.base,n=u(s.base,t)),t=n}return t}v.getInitialContext=e=>{let t=JSON.stringify({processingMode:e.processingMode}),r=g.get(t);if(r)return r;let i={processingMode:e.processingMode,mappings:new Map,inverse:null,getInverse:a,clone:c,revertToPreviousContext:l,protected:{}};return g.size===_&&g.clear(),g.set(t,i),i;function a(){let e=this;if(e.inverse)return e.inverse;let t=e.inverse={},n=e.fastCurieMap={},r={},i=(e[`@language`]||`@none`).toLowerCase(),a=e[`@direction`],c=e.mappings,l=[...c.keys()].sort(h);for(let e of l){let o=c.get(e);if(o===null)continue;let l=o[`@container`]||`@none`;if(l=[].concat(l).sort().join(``),o[`@id`]===null)continue;let u=m(o[`@id`]);for(let c of u){let u=t[c],d=v.isKeyword(c);if(u)!d&&!o._termHasColon&&r[c].push(e);else if(t[c]=u={},!d&&!o._termHasColon){r[c]=[e];let t={iri:c,terms:r[c]};c[0]in n?n[c[0]].push(t):n[c[0]]=[t]}if(u[l]||(u[l]={"@language":{},"@type":{},"@any":{}}),u=u[l],s(e,u[`@any`],`@none`),o.reverse)s(e,u[`@type`],`@reverse`);else if(o[`@type`]===`@none`)s(e,u[`@any`],`@none`),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`);else if(`@type`in o)s(e,u[`@type`],o[`@type`]);else if(`@language`in o&&`@direction`in o){let t=o[`@language`],n=o[`@direction`];t&&n?s(e,u[`@language`],`${t}_${n}`.toLowerCase()):t?s(e,u[`@language`],t.toLowerCase()):n?s(e,u[`@language`],`_${n}`):s(e,u[`@language`],`@null`)}else`@language`in o?s(e,u[`@language`],(o[`@language`]||`@null`).toLowerCase()):`@direction`in o?o[`@direction`]?s(e,u[`@language`],`_${o[`@direction`]}`):s(e,u[`@language`],`@none`):a?(s(e,u[`@language`],`_${a}`),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`)):(s(e,u[`@language`],i),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`))}}for(let e in n)o(n,e,1);return t}function o(e,t,n){let r=e[t],i=e[t]={},a,s;for(let e of r)a=e.iri,s=n>=a.length?``:a[n],s in i?i[s].push(e):i[s]=[e];for(let e in i)e!==``&&o(i,e,n+1)}function s(e,t,n){t.hasOwnProperty(n)||(t[n]=e)}function c(){let e={};return e.mappings=n.clone(this.mappings),e.clone=this.clone,e.inverse=null,e.getInverse=this.getInverse,e.protected=n.clone(this.protected),this.previousContext&&(e.previousContext=this.previousContext.clone()),e.revertToPreviousContext=this.revertToPreviousContext,`@base`in this&&(e[`@base`]=this[`@base`]),`@language`in this&&(e[`@language`]=this[`@language`]),`@vocab`in this&&(e[`@vocab`]=this[`@vocab`]),e}function l(){return this.previousContext?this.previousContext.clone():this}},v.getContextValue=(e,t,n)=>{if(t===null)return n===`@context`?void 0:null;if(e.mappings.has(t)){let r=e.mappings.get(t);if(s(n))return r;if(r.hasOwnProperty(n))return r[n]}if(n===`@language`&&n in e||n===`@direction`&&n in e)return e[n];if(n!==`@context`)return null},v.processingMode=(e,t)=>t.toString()>=`1.1`?!e.processingMode||e.processingMode>=`json-ld-`+t.toString():e.processingMode===`json-ld-1.0`,v.isKeyword=e=>{if(!o(e)||e[0]!==`@`)return!1;switch(e){case`@base`:case`@container`:case`@context`:case`@default`:case`@direction`:case`@embed`:case`@explicit`:case`@graph`:case`@id`:case`@included`:case`@index`:case`@json`:case`@language`:case`@list`:case`@nest`:case`@none`:case`@omitDefault`:case`@prefix`:case`@preserve`:case`@protected`:case`@requireAll`:case`@reverse`:case`@set`:case`@type`:case`@value`:case`@version`:case`@vocab`:return!0}return!1};function b(e,t){if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return e===t;let n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(!b(e[n],t[n]))return!1;return!0}let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(let n in e){let r=e[n],i=t[n];if(n===`@container`&&Array.isArray(r)&&Array.isArray(i)&&(r=r.slice().sort(),i=i.slice().sort()),!b(r,i))return!1}return!0}})),qn=o(((e,t)=>{var n=Mn(),{isArray:r,isObject:i,isEmptyObject:a,isString:o,isUndefined:s}=An(),{isList:c,isValue:l,isGraph:u,isSubject:d}=jn(),{expandIri:f,getContextValue:p,isKeyword:m,process:h,processingMode:g}=Kn(),{isAbsolute:_}=In(),{REGEX_BCP47:v,REGEX_KEYWORD:y,addValue:b,asArray:x,getValues:S,validateTypeValue:C}=Nn(),{handleEvent:w}=Gn(),T={};t.exports=T,T.expand=async({activeCtx:e,activeProperty:t=null,element:c,options:l={},insideList:u=!1,insideIndex:d=!1,typeScopedContext:m=null})=>{if(c==null)return null;if(t===`@default`&&(l=Object.assign({},l,{isFrame:!1})),!r(c)&&!i(c))return!u&&(t===null||f(e,t,{vocab:!0},l)===`@graph`)?(l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`free-floating scalar`,level:`warning`,message:`Dropping free-floating scalar not in a list.`,details:{value:c}},options:l}),null):O({activeCtx:e,activeProperty:t,value:c,options:l});if(r(c)){let n=[],i=p(e,t,`@container`)||[];u||=i.includes(`@list`);for(let i=0;i<c.length;++i){let a=await T.expand({activeCtx:e,activeProperty:t,element:c[i],options:l,insideIndex:d,typeScopedContext:m});u&&r(a)&&(a={"@list":a}),a!==null&&(r(a)?n=n.concat(a):n.push(a))}return n}let v=f(e,t,{vocab:!0},l),y=p(e,t,`@context`);m||=e.previousContext?e:null;let b=Object.keys(c).sort(),C=!d;if(C&&m&&b.length<=2&&!b.includes(`@context`))for(let t of b){let n=f(m,t,{vocab:!0},l);if(n===`@value`){C=!1,e=m;break}if(n===`@id`&&b.length===1){C=!1;break}}C&&(e=e.revertToPreviousContext()),s(y)||(e=await h({activeCtx:e,localCtx:y,propagate:!0,overrideProtected:!0,options:l})),`@context`in c&&(e=await h({activeCtx:e,localCtx:c[`@context`],options:l})),m=e;let k=null;for(let t of b)if(f(e,t,{vocab:!0},l)===`@type`){k||=t;let n=c[t],r=Array.isArray(n)?n.length>1?n.slice().sort():n:[n];for(let t of r){let n=p(m,t,`@context`);s(n)||(e=await h({activeCtx:e,localCtx:n,options:l,propagate:!1}))}}let A={};await D({activeCtx:e,activeProperty:t,expandedActiveProperty:v,element:c,expandedParent:A,options:l,insideList:u,typeKey:k,typeScopedContext:m}),b=Object.keys(A);let j=b.length;if(`@value`in A){if(`@type`in A&&(`@language`in A||`@direction`in A))throw new n(`Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and either "@language" or "@direction".`,`jsonld.SyntaxError`,{code:`invalid value object`,element:A});let t=j-1;if(`@type`in A&&--t,`@index`in A&&--t,`@language`in A&&--t,`@direction`in A&&--t,t!==0)throw new n(`Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and either "@type" or either or both "@language" or "@direction".`,`jsonld.SyntaxError`,{code:`invalid value object`,element:A});let r=A[`@value`]===null?[]:x(A[`@value`]),i=S(A,`@type`);if(!(g(e,1.1)&&i.includes(`@json`)&&i.length===1)){if(r.length===0)l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`null @value value`,level:`warning`,message:`Dropping null @value value.`,details:{value:A}},options:l}),A=null;else if(!r.every(e=>o(e)||a(e))&&`@language`in A)throw new n(`Invalid JSON-LD syntax; only strings may be language-tagged.`,`jsonld.SyntaxError`,{code:`invalid language-tagged value`,element:A});else if(!i.every(e=>_(e)&&!(o(e)&&e.indexOf(`_:`)===0)||a(e)))throw new n(`Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".`,`jsonld.SyntaxError`,{code:`invalid typed value`,element:A})}}else if(`@type`in A&&!r(A[`@type`]))A[`@type`]=[A[`@type`]];else if(`@set`in A||`@list`in A){if(j>1&&!(j===2&&`@index`in A))throw new n(`Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".`,`jsonld.SyntaxError`,{code:`invalid set or list object`,element:A});`@set`in A&&(A=A[`@set`],b=Object.keys(A),j=b.length)}else j===1&&`@language`in A&&(l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`object with only @language`,level:`warning`,message:`Dropping object with only @language.`,details:{value:A}},options:l}),A=null);return i(A)&&!l.keepFreeFloatingNodes&&!u&&(t===null||v===`@graph`||(p(e,t,`@container`)||[]).includes(`@graph`))&&(A=E({value:A,count:j,options:l})),A};function E({value:e,count:t,options:n}){if(t===0||`@value`in e||`@list`in e||t===1&&`@id`in e){if(n.eventHandler){let r,i;t===0?(r=`empty object`,i=`Dropping empty object.`):`@value`in e?(r=`object with only @value`,i=`Dropping object with only @value.`):`@list`in e?(r=`object with only @list`,i=`Dropping object with only @list.`):t===1&&`@id`in e&&(r=`object with only @id`,i=`Dropping object with only @id.`),w({event:{type:[`JsonLdEvent`],code:r,level:`warning`,message:i,details:{value:e}},options:n})}return null}return e}async function D({activeCtx:e,activeProperty:t,expandedActiveProperty:u,element:y,expandedParent:S,options:O={},insideList:j,typeKey:M,typeScopedContext:N}){let P=Object.keys(y).sort(),F=[],I,L=y[M]&&f(e,r(y[M])?y[M][0]:y[M],{vocab:!0},{...O,typeExpansion:!0})===`@json`;for(let D of P){let j=y[D],M;if(D===`@context`)continue;let P=f(e,D,{vocab:!0},O);if(P===null||!(_(P)||m(P))){O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid property`,level:`warning`,message:`Dropping property that did not expand into an absolute IRI or keyword.`,details:{property:D,expandedProperty:P}},options:O});continue}if(m(P)){if(u===`@reverse`)throw new n(`Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.`,`jsonld.SyntaxError`,{code:`invalid reverse property map`,value:j});if(P in S&&P!==`@included`&&P!==`@type`)throw new n(`Invalid JSON-LD syntax; colliding keywords detected.`,`jsonld.SyntaxError`,{code:`colliding keywords`,keyword:P})}if(P===`@id`){if(!o(j)){if(!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@id" value must a string.`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j});if(i(j)){if(!a(j))throw new n(`Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j})}else if(r(j)){if(!j.every(e=>o(e)))throw new n(`Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j})}else throw new n(`Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j})}b(S,`@id`,x(j).map(t=>{if(o(t)){let n=f(e,t,{base:!0},O);return O.eventHandler&&(n===null?w(t===null?{event:{type:[`JsonLdEvent`],code:`null @id value`,level:`warning`,message:`Null @id found.`,details:{id:t}},options:O}:{event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`Reserved @id found.`,details:{id:t}},options:O}):_(n)||w({event:{type:[`JsonLdEvent`],code:`relative @id reference`,level:`warning`,message:`Relative @id reference found.`,details:{id:t,expandedId:n}},options:O})),n}return t}),{propertyIsArray:O.isFrame});continue}if(P===`@type`){i(j)&&(j=Object.fromEntries(Object.entries(j).map(([e,t])=>[f(N,e,{vocab:!0}),x(t).map(e=>f(N,e,{base:!0,vocab:!0},{...O,typeExpansion:!0}))]))),C(j,O.isFrame),b(S,`@type`,x(j).map(e=>{if(o(e)){let t=f(N,e,{base:!0,vocab:!0},{...O,typeExpansion:!0});return t!==`@json`&&!_(t)&&O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`relative @type reference`,level:`warning`,message:`Relative @type reference found.`,details:{type:e}},options:O}),t}return e}),{propertyIsArray:!!O.isFrame});continue}if(P===`@included`&&g(e,1.1)){let r=x(await T.expand({activeCtx:e,activeProperty:t,element:j,options:O}));if(!r.every(e=>d(e)))throw new n(`Invalid JSON-LD syntax; values of @included must expand to node objects.`,`jsonld.SyntaxError`,{code:`invalid @included value`,value:j});b(S,`@included`,r,{propertyIsArray:!0});continue}if(P===`@graph`&&!(i(j)||r(j)))throw new n(`Invalid JSON-LD syntax; "@graph" value must not be an object or an array.`,`jsonld.SyntaxError`,{code:`invalid @graph value`,value:j});if(P===`@value`){I=j,L&&g(e,1.1)?S[`@value`]=j:b(S,`@value`,j,{propertyIsArray:O.isFrame});continue}if(P===`@language`){if(j===null)continue;if(!o(j)&&!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@language" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid language-tagged string`,value:j});j=x(j).map(e=>o(e)?e.toLowerCase():e);for(let e of j)o(e)&&!e.match(v)&&O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:O});b(S,`@language`,j,{propertyIsArray:O.isFrame});continue}if(P===`@direction`){if(!o(j)&&!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@direction" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid base direction`,value:j});j=x(j);for(let e of j)if(o(e)&&e!==`ltr`&&e!==`rtl`)throw new n(`Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".`,`jsonld.SyntaxError`,{code:`invalid base direction`,value:j});b(S,`@direction`,j,{propertyIsArray:O.isFrame});continue}if(P===`@index`){if(!o(j))throw new n(`Invalid JSON-LD syntax; "@index" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid @index value`,value:j});b(S,`@index`,j);continue}if(P===`@reverse`){if(!i(j))throw new n(`Invalid JSON-LD syntax; "@reverse" value must be an object.`,`jsonld.SyntaxError`,{code:`invalid @reverse value`,value:j});if(M=await T.expand({activeCtx:e,activeProperty:`@reverse`,element:j,options:O}),`@reverse`in M)for(let e in M[`@reverse`])b(S,e,M[`@reverse`][e],{propertyIsArray:!0});let t=S[`@reverse`]||null;for(let e in M){if(e===`@reverse`)continue;t===null&&(t=S[`@reverse`]={}),b(t,e,[],{propertyIsArray:!0});let r=M[e];for(let i=0;i<r.length;++i){let a=r[i];if(l(a)||c(a))throw new n(`Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.`,`jsonld.SyntaxError`,{code:`invalid reverse property value`,value:M});b(t,e,a,{propertyIsArray:!0})}}continue}if(P===`@nest`){F.push(D);continue}let R=e,z=p(e,D,`@context`);s(z)||(R=await h({activeCtx:e,localCtx:z,propagate:!0,overrideProtected:!0,options:O}));let B=p(e,D,`@container`)||[];if(B.includes(`@language`)&&i(j)){let e=p(R,D,`@direction`);M=k(R,j,e,O)}else if(B.includes(`@index`)&&i(j)){let t=B.includes(`@graph`),n=p(R,D,`@index`)||`@index`,r=n!==`@index`&&f(e,n,{vocab:!0},O);M=await A({activeCtx:R,options:O,activeProperty:D,value:j,asGraph:t,indexKey:n,propertyIndex:r})}else if(B.includes(`@id`)&&i(j)){let e=B.includes(`@graph`);M=await A({activeCtx:R,options:O,activeProperty:D,value:j,asGraph:e,indexKey:`@id`})}else if(B.includes(`@type`)&&i(j))M=await A({activeCtx:R.revertToPreviousContext(),options:O,activeProperty:D,value:j,asGraph:!1,indexKey:`@type`});else{let n=P===`@list`;if(n||P===`@set`){let e=t;n&&u===`@graph`&&(e=null),M=await T.expand({activeCtx:R,activeProperty:e,element:j,options:O,insideList:n})}else M=p(e,D,`@type`)===`@json`?{"@type":`@json`,"@value":j}:await T.expand({activeCtx:R,activeProperty:D,element:j,options:O,insideList:!1})}if(!(M===null&&P!==`@value`)){if(P!==`@list`&&!c(M)&&B.includes(`@list`)&&(M={"@list":x(M)}),B.includes(`@graph`)&&!B.some(e=>e===`@id`||e===`@index`)){if(M=x(M),O.isFrame||(M=M.filter(e=>{let t=Object.keys(e).length;return E({value:e,count:t,options:O})!==null})),M.length===0)continue;M=M.map(e=>({"@graph":x(e)}))}if(R.mappings.has(D)&&R.mappings.get(D).reverse){let e=S[`@reverse`]=S[`@reverse`]||{};M=x(M);for(let t=0;t<M.length;++t){let r=M[t];if(l(r)||c(r))throw new n(`Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.`,`jsonld.SyntaxError`,{code:`invalid reverse property value`,value:M});b(e,P,r,{propertyIsArray:!0})}continue}b(S,P,M,{propertyIsArray:!0})}}if(`@value`in S&&!(S[`@type`]===`@json`&&g(e,1.1))&&(i(I)||r(I))&&!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@value" value must not be an object or an array.`,`jsonld.SyntaxError`,{code:`invalid value object value`,value:I});for(let a of F){let o=r(y[a])?y[a]:[y[a]];for(let r of o){if(!i(r)||Object.keys(r).some(t=>f(e,t,{vocab:!0},O)===`@value`))throw new n(`Invalid JSON-LD syntax; nested value must be a node object.`,`jsonld.SyntaxError`,{code:`invalid @nest value`,value:r});await D({activeCtx:e,activeProperty:t,expandedActiveProperty:u,element:r,expandedParent:S,options:O,insideList:j,typeScopedContext:N,typeKey:M})}}}function O({activeCtx:e,activeProperty:t,value:n,options:r}){if(n==null)return null;let i=f(e,t,{vocab:!0},r);if(i===`@id`)return f(e,n,{base:!0},r);if(i===`@type`)return f(e,n,{vocab:!0,base:!0},{...r,typeExpansion:!0});let a=p(e,t,`@type`);if((a===`@id`||i===`@graph`)&&o(n)){let i=f(e,n,{base:!0},r);return i===null&&n.match(y)&&r.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`Reserved @id found.`,details:{id:t}},options:r}),{"@id":i}}if(a===`@vocab`&&o(n))return{"@id":f(e,n,{vocab:!0,base:!0},r)};if(m(i))return n;let s={};if(a&&![`@id`,`@vocab`,`@none`].includes(a))s[`@type`]=a;else if(o(n)){let n=p(e,t,`@language`);n!==null&&(s[`@language`]=n);let r=p(e,t,`@direction`);r!==null&&(s[`@direction`]=r)}return[`boolean`,`number`,`string`].includes(typeof n)||(n=n.toString()),s[`@value`]=n,s}function k(e,t,i,a){let s=[],c=Object.keys(t).sort();for(let l of c){let c=f(e,l,{vocab:!0},a),u=t[l];r(u)||(u=[u]);for(let e of u){if(e===null)continue;if(!o(e))throw new n(`Invalid JSON-LD syntax; language map values must be strings.`,`jsonld.SyntaxError`,{code:`invalid language map value`,languageMap:t});let r={"@value":e};c!==`@none`&&(l.match(v)||a.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:l}},options:a}),r[`@language`]=l.toLowerCase()),i&&(r[`@direction`]=i),s.push(r)}}return s}async function A({activeCtx:e,options:t,activeProperty:i,value:a,asGraph:o,indexKey:c,propertyIndex:d}){let m=[],g=Object.keys(a).sort(),_=c===`@type`;for(let v of g){if(_){let n=p(e,v,`@context`);s(n)||(e=await h({activeCtx:e,localCtx:n,propagate:!1,options:t}))}let g=a[v];r(g)||(g=[g]),g=await T.expand({activeCtx:e,activeProperty:i,element:g,options:t,insideList:!1,insideIndex:!0});let y;y=d?v===`@none`?`@none`:O({activeCtx:e,activeProperty:c,value:v,options:t}):f(e,v,{vocab:!0},t),c===`@id`?v=f(e,v,{base:!0},t):_&&(v=y);for(let e of g){if(o&&!u(e)&&(e={"@graph":[e]}),c===`@type`)y===`@none`||(e[`@type`]?e[`@type`]=[v].concat(e[`@type`]):e[`@type`]=[v]);else if(l(e)&&![`@language`,`@type`,`@index`].includes(c))throw new n(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${c}".`,`jsonld.SyntaxError`,{code:`invalid value object`,value:e});else d?y!==`@none`&&b(e,d,y,{propertyIsArray:!0,prependValue:!0}):y!==`@none`&&!(c in e)&&(e[c]=v);m.push(e)}}return m}})),Jn=o(((e,t)=>{var{isKeyword:n}=Kn(),r=jn(),i=An(),a=Nn(),o=Mn(),s={};t.exports=s,s.createMergedNodeMap=(e,t)=>{t||={};let n=t.issuer||new a.IdentifierIssuer(`_:b`),r={"@default":{}};return s.createNodeMap(e,r,`@default`,n),s.mergeNodeMaps(r)},s.createNodeMap=(e,t,c,l,u,d)=>{if(i.isArray(e)){for(let n of e)s.createNodeMap(n,t,c,l,void 0,d);return}if(!i.isObject(e)){d&&d.push(e);return}if(r.isValue(e)){if(`@type`in e){let t=e[`@type`];t.indexOf(`_:`)===0&&(e[`@type`]=t=l.getId(t))}d&&d.push(e);return}else if(d&&r.isList(e)){let n=[];s.createNodeMap(e[`@list`],t,c,l,u,n),d.push({"@list":n});return}if(`@type`in e){let t=e[`@type`];for(let e of t)e.indexOf(`_:`)===0&&l.getId(e)}i.isUndefined(u)&&(u=r.isBlankNode(e)?l.getId(e[`@id`]):e[`@id`]),d&&d.push({"@id":u});let f=t[c],p=f[u]=f[u]||{};p[`@id`]=u;let m=Object.keys(e).sort();for(let i of m){if(i===`@id`)continue;if(i===`@reverse`){let n={"@id":u},i=e[`@reverse`];for(let e in i){let o=i[e];for(let i of o){let o=i[`@id`];r.isBlankNode(i)&&(o=l.getId(o)),s.createNodeMap(i,t,c,l,o),a.addValue(f[o],e,n,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if(i===`@graph`){u in t||(t[u]={}),s.createNodeMap(e[i],t,u,l);continue}if(i===`@included`){s.createNodeMap(e[i],t,c,l);continue}if(i!==`@type`&&n(i)){if(i===`@index`&&i in p&&(e[i]!==p[i]||e[i][`@id`]!==p[i][`@id`]))throw new o(`Invalid JSON-LD syntax; conflicting @index property detected.`,`jsonld.SyntaxError`,{code:`conflicting indexes`,subject:p});p[i]=e[i];continue}let d=e[i];if(i.indexOf(`_:`)===0&&(i=l.getId(i)),d.length===0){a.addValue(p,i,[],{propertyIsArray:!0});continue}for(let e of d)if(i===`@type`&&(e=e.indexOf(`_:`)===0?l.getId(e):e),r.isSubject(e)||r.isSubjectReference(e)){if(`@id`in e&&!e[`@id`])continue;let n=r.isBlankNode(e)?l.getId(e[`@id`]):e[`@id`];a.addValue(p,i,{"@id":n},{propertyIsArray:!0,allowDuplicate:!1}),s.createNodeMap(e,t,c,l,n)}else if(r.isValue(e))a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1});else if(r.isList(e)){let n=[];s.createNodeMap(e[`@list`],t,c,l,u,n),e={"@list":n},a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1})}else s.createNodeMap(e,t,c,l,u),a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1})}},s.mergeNodeMapGraphs=e=>{let t={};for(let r of Object.keys(e).sort())for(let i of Object.keys(e[r]).sort()){let o=e[r][i];i in t||(t[i]={"@id":i});let s=t[i];for(let e of Object.keys(o).sort())if(n(e)&&e!==`@type`)s[e]=a.clone(o[e]);else for(let t of o[e])a.addValue(s,e,a.clone(t),{propertyIsArray:!0,allowDuplicate:!1})}return t},s.mergeNodeMaps=e=>{let t=e[`@default`],n=Object.keys(e).sort();for(let i of n){if(i===`@default`)continue;let n=e[i],a=t[i];a?`@graph`in a||(a[`@graph`]=[]):t[i]=a={"@id":i,"@graph":[]};let o=a[`@graph`];for(let e of Object.keys(n).sort()){let t=n[e];r.isSubjectReference(t)||o.push(t)}}return t}})),Yn=o(((e,t)=>{var{isSubjectReference:n}=jn(),{createMergedNodeMap:r}=Jn(),i={};t.exports=i,i.flatten=e=>{let t=r(e),i=[],a=Object.keys(t).sort();for(let e=0;e<a.length;++e){let r=t[a[e]];n(r)||i.push(r)}return i}})),Xn=o(((e,t)=>{var n=Mn(),r=jn(),i=An(),{REGEX_BCP47:a,addValue:o}=Nn(),{handleEvent:s}=Gn(),{RDF_LIST:c,RDF_FIRST:l,RDF_REST:u,RDF_NIL:d,RDF_TYPE:f,RDF_JSON_LITERAL:p,XSD_BOOLEAN:m,XSD_DOUBLE:h,XSD_INTEGER:g,XSD_STRING:_}=Pn(),v={};t.exports=v,v.fromRDF=async(e,t)=>{let{useRdfType:a=!1,useNativeTypes:s=!1,rdfDirection:p=null}=t,m={},h={"@default":m},g={};if(p){if(p===`compound-literal`)throw new n(`Unsupported rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:p});if(p!==`i18n-datatype`)throw new n(`Unknown rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:p})}for(let n of e){let e=n.graph.termType===`DefaultGraph`?`@default`:n.graph.value;e in h||(h[e]={}),e!==`@default`&&!(e in m)&&(m[e]={"@id":e});let r=h[e],i=b(n.subject),c=n.predicate.value,l=n.object;i in r||(r[i]={"@id":i});let u=r[i],_=b(l),v=!!_;if(v&&!(_ in r)&&(r[_]={"@id":_}),c===f&&!a&&v){o(u,`@type`,_,{propertyIsArray:!0});continue}let x=y(l,s,p,t);if(o(u,c,x,{propertyIsArray:!0}),v)if(_===d){let e=r[_];`usages`in e||(e.usages=[]),e.usages.push({node:u,property:c,value:x})}else _ in g?g[_]=!1:g[_]={node:u,property:c,value:x}}for(let e in h){let t=h[e];if(!(d in t))continue;let n=t[d];if(n.usages){for(let e of n.usages){let n=e.node,a=e.property,o=e.value,s=[],d=[],f=Object.keys(n).length;for(;a===u&&i.isObject(g[n[`@id`]])&&i.isArray(n[l])&&n[l].length===1&&i.isArray(n[u])&&n[u].length===1&&(f===3||f===4&&i.isArray(n[`@type`])&&n[`@type`].length===1&&n[`@type`][0]===c)&&(s.push(n[l][0]),d.push(n[`@id`]),e=g[n[`@id`]],n=e.node,a=e.property,o=e.value,f=Object.keys(n).length,r.isBlankNode(n)););delete o[`@id`],o[`@list`]=s.reverse();for(let e of d)delete t[e]}delete n.usages}}let _=[],v=Object.keys(m).sort();for(let e of v){let t=m[e];if(e in h){let n=t[`@graph`]=[],i=h[e],a=Object.keys(i).sort();for(let e of a){let t=i[e];r.isSubjectReference(t)||n.push(t)}}r.isSubjectReference(t)||_.push(t)}return _};function y(e,t,r,o){let c=b(e);if(c)return{"@id":c};let l={"@value":e.value};if(e.language)e.language.match(a)||o.eventHandler&&s({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e.language}},options:o}),l[`@language`]=e.language;else{let c=e.datatype.value;if(c||=_,c===p){c=`@json`;try{l[`@value`]=JSON.parse(l[`@value`])}catch(e){throw new n(`JSON literal could not be parsed.`,`jsonld.InvalidJsonLiteral`,{code:`invalid JSON literal`,value:l[`@value`],cause:e})}}if(t)if(c===m)l[`@value`]===`true`||l[`@value`]===`1`?l[`@value`]=!0:l[`@value`]===`false`||l[`@value`]===`0`?l[`@value`]=!1:l[`@type`]=c;else if(c===g)if(i.isNumeric(l[`@value`])){let e=parseInt(l[`@value`],10);e.toFixed(0)===l[`@value`]&&(l[`@value`]=e)}else l[`@type`]=c;else c===h&&i.isNumeric(l[`@value`])?l[`@value`]=parseFloat(l[`@value`]):l[`@type`]=c;else if(r===`i18n-datatype`&&c.startsWith(`https://www.w3.org/ns/i18n#`)){let[,e,t]=c.split(/[#_]/);e.length>0&&(l[`@language`]=e,e.match(a)||o.eventHandler&&s({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:o})),l[`@direction`]=t}else c!==_&&(l[`@type`]=c)}return l}function b(e){return e.termType===`NamedNode`?e.value:e.termType===`BlankNode`?`_:`+e.value:null}})),Zn=o(((e,t)=>{t.exports=function e(t){if(typeof t==`number`&&isNaN(t))throw Error(`NaN is not allowed`);if(typeof t==`number`&&!isFinite(t))throw Error(`Infinity is not allowed`);return typeof t!=`object`||!t?JSON.stringify(t):t.toJSON instanceof Function?e(t.toJSON()):Array.isArray(t)?`[${t.reduce((t,n,r)=>`${t}${r===0?``:`,`}${e(n===void 0||typeof n==`symbol`?null:n)}`,``)}]`:`{${Object.keys(t).sort().reduce((n,r)=>t[r]===void 0||typeof t[r]==`symbol`?n:`${n}${n.length===0?``:`,`}${e(r)}:${e(t[r])}`,``)}}`}})),Qn=o(((e,t)=>{var{createNodeMap:n}=Jn(),{isKeyword:r}=Kn(),i=jn(),a=Zn(),o=Mn(),s=An(),c=Nn(),{handleEvent:l}=Gn(),{RDF_FIRST:u,RDF_REST:d,RDF_NIL:f,RDF_TYPE:p,RDF_JSON_LITERAL:m,RDF_LANGSTRING:h,XSD_BOOLEAN:g,XSD_DOUBLE:_,XSD_INTEGER:v,XSD_STRING:y}=Pn(),{isAbsolute:b}=In(),x={};t.exports=x,x.toRDF=(e,t)=>{let r=new c.IdentifierIssuer(`_:b`),i={"@default":{}};n(e,i,`@default`,r);let a=[],o=Object.keys(i).sort();for(let e of o){let n;if(e===`@default`)n={termType:`DefaultGraph`,value:``};else if(b(e))n=T(e);else{t.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative graph reference`,level:`warning`,message:`Relative graph reference found.`,details:{graph:e}},options:t});continue}S(a,i[e],n,r,t)}return a};function S(e,t,n,i,a){let o=Object.keys(t).sort();for(let s of o){let o=t[s],c=Object.keys(o).sort();for(let t of c){let c=o[t];if(t===`@type`)t=p;else if(r(t))continue;for(let r of c){let o=T(s);if(!b(s)){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative subject reference`,level:`warning`,message:`Relative subject reference found.`,details:{subject:s}},options:a});continue}let c=T(t);if(!b(t)){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative predicate reference`,level:`warning`,message:`Relative predicate reference found.`,details:{predicate:t}},options:a});continue}if(c.termType===`BlankNode`&&!a.produceGeneralizedRdf){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`blank node predicate`,level:`warning`,message:`Dropping blank node predicate.`,details:{property:i.getOldIds().find(e=>i.getId(e)===t)}},options:a});continue}let u=w(r,i,e,n,a.rdfDirection,a);u&&e.push({subject:o,predicate:c,object:u,graph:n})}}}}function C(e,t,n,r,i,a){let o={termType:`NamedNode`,value:u},s={termType:`NamedNode`,value:d},c={termType:`NamedNode`,value:f},l=e.pop(),p=l?{termType:`BlankNode`,value:t.getId().slice(2)}:c,m=p;for(let c of e){let e=w(c,t,n,r,i,a),l={termType:`BlankNode`,value:t.getId().slice(2)};n.push({subject:m,predicate:o,object:e,graph:r}),n.push({subject:m,predicate:s,object:l,graph:r}),m=l}if(l){let e=w(l,t,n,r,i,a);n.push({subject:m,predicate:o,object:e,graph:r}),n.push({subject:m,predicate:s,object:c,graph:r})}return p}function w(e,t,n,r,c,u){let d;if(i.isValue(e)){d={termType:`Literal`,value:void 0,datatype:{termType:`NamedNode`}};let t=e[`@value`],n=e[`@type`]||null;if(n===`@json`)d.value=a(t),d.datatype.value=m;else if(s.isBoolean(t))d.value=t.toString(),d.datatype.value=n||g;else if(s.isDouble(t)||n===_)s.isDouble(t)||(t=parseFloat(t)),d.value=t.toExponential(15).replace(/(\d)0*e\+?/,`$1E`),d.datatype.value=n||_;else if(s.isNumber(t))d.value=t.toFixed(0),d.datatype.value=n||v;else if(`@direction`in e&&c===`i18n-datatype`){let n=`https://www.w3.org/ns/i18n#${(e[`@language`]||``).toLowerCase()}_${e[`@direction`]}`;d.datatype.value=n,d.value=t}else if(`@direction`in e&&c===`compound-literal`)throw new o(`Unsupported rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:c});else if(`@direction`in e&&c)throw new o(`Unknown rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:c});else`@language`in e?(`@direction`in e&&!c&&u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`rdfDirection not set`,level:`warning`,message:`rdfDirection not set for @direction.`,details:{object:d.value}},options:u}),d.value=t,d.datatype.value=n||h,d.language=e[`@language`]):(`@direction`in e&&!c&&u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`rdfDirection not set`,level:`warning`,message:`rdfDirection not set for @direction.`,details:{object:d.value}},options:u}),d.value=t,d.datatype.value=n||y)}else if(i.isList(e)){let i=C(e[`@list`],t,n,r,c,u);d={termType:i.termType,value:i.value}}else d=T(s.isObject(e)?e[`@id`]:e);return d.termType===`NamedNode`&&!b(d.value)?(u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative object reference`,level:`warning`,message:`Relative object reference found.`,details:{object:d.value}},options:u}),null):d}function T(e){return e.startsWith(`_:`)?{termType:`BlankNode`,value:e.slice(2)}:{termType:`NamedNode`,value:e}}})),$n=o(((e,t)=>{var{isKeyword:n}=Kn(),r=jn(),i=An(),a=Nn(),o=In(),s=Mn(),{createNodeMap:c,mergeNodeMapGraphs:l}=Jn(),u={};t.exports=u,u.frameMergedOrDefault=(e,t,n)=>{let r={options:n,embedded:!1,graph:`@default`,graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},i=new a.IdentifierIssuer(`_:b`);c(e,r.graphMap,`@default`,i),n.merged&&(r.graphMap[`@merged`]=l(r.graphMap),r.graph=`@merged`),r.subjects=r.graphMap[r.graph];let o=[];return u.frame(r,Object.keys(r.subjects).sort(),t,o),n.pruneBlankNodeIdentifiers&&(n.bnodesToClear=Object.keys(r.bnodeMap).filter(e=>r.bnodeMap[e].length===1)),n.link={},v(o,n)},u.frame=(e,t,o,c,l=null)=>{m(o),o=o[0];let g=e.options,v={embed:p(o,g,`embed`),explicit:p(o,g,`explicit`),requireAll:p(o,g,`requireAll`)};e.link.hasOwnProperty(e.graph)||(e.link[e.graph]={});let b=e.link[e.graph],S=h(e,t,o,v),C=Object.keys(S).sort();for(let m of C){let h=S[m];if(l===null?e.uniqueEmbeds={[e.graph]:{}}:e.uniqueEmbeds[e.graph]=e.uniqueEmbeds[e.graph]||{},v.embed===`@link`&&m in b){y(c,l,b[m]);continue}let C={"@id":m};if(m.indexOf(`_:`)===0&&a.addValue(e.bnodeMap,m,C,{propertyIsArray:!0}),b[m]=C,(v.embed===`@first`||v.embed===`@last`)&&e.is11)throw new s(`Invalid JSON-LD syntax; invalid value of @embed.`,`jsonld.SyntaxError`,{code:`invalid @embed value`,frame:o});if(!(!e.embedded&&e.uniqueEmbeds[e.graph].hasOwnProperty(m))){if(e.embedded&&(v.embed===`@never`||f(h,e.graph,e.subjectStack))){y(c,l,C);continue}if(e.embedded&&(v.embed==`@first`||v.embed==`@once`)&&e.uniqueEmbeds[e.graph].hasOwnProperty(m)){y(c,l,C);continue}if(v.embed===`@last`&&m in e.uniqueEmbeds[e.graph]&&_(e,m),e.uniqueEmbeds[e.graph][m]={parent:c,property:l},e.subjectStack.push({subject:h,graph:e.graph}),m in e.graphMap){let t=!1,n=null;`@graph`in o?(n=o[`@graph`][0],t=!(m===`@merged`||m===`@default`),i.isObject(n)||(n={})):(t=e.graph!==`@merged`,n={}),t&&u.frame({...e,graph:m,embedded:!1},Object.keys(e.graphMap[m]).sort(),[n],C,`@graph`)}`@included`in o&&u.frame({...e,embedded:!1},t,o[`@included`],C,`@included`);for(let t of Object.keys(h).sort()){if(n(t)){if(C[t]=a.clone(h[t]),t===`@type`)for(let t of h[`@type`])t.indexOf(`_:`)===0&&a.addValue(e.bnodeMap,t,C,{propertyIsArray:!0});continue}if(!(v.explicit&&!(t in o)))for(let n of h[t]){let i=t in o?o[t]:d(v);if(r.isList(n)){let i=o[t]&&o[t][0]&&o[t][0][`@list`]?o[t][0][`@list`]:d(v),s={"@list":[]};y(C,t,s);let c=n[`@list`];for(let t of c)r.isSubjectReference(t)?u.frame({...e,embedded:!0},[t[`@id`]],i,s,`@list`):y(s,`@list`,a.clone(t))}else r.isSubjectReference(n)?u.frame({...e,embedded:!0},[n[`@id`]],i,C,t):x(i[0],n)&&y(C,t,a.clone(n))}}for(let e of Object.keys(o).sort()){if(e===`@type`){if(!i.isObject(o[e][0])||!(`@default`in o[e][0]))continue}else if(n(e))continue;let t=o[e][0]||{};if(!p(t,g,`omitDefault`)&&!(e in C)){let n=`@null`;`@default`in t&&(n=a.clone(t[`@default`])),i.isArray(n)||(n=[n]),C[e]=[{"@preserve":n}]}}for(let t of Object.keys(o[`@reverse`]||{}).sort()){let n=o[`@reverse`][t];for(let r of Object.keys(e.subjects))a.getValues(e.subjects[r],t).some(e=>e[`@id`]===m)&&(C[`@reverse`]=C[`@reverse`]||{},a.addValue(C[`@reverse`],t,[],{propertyIsArray:!0}),u.frame({...e,embedded:!0},[r],n,C[`@reverse`][t],l))}y(c,l,C),e.subjectStack.pop()}}},u.cleanupNull=(e,t)=>{if(i.isArray(e))return e.map(e=>u.cleanupNull(e,t)).filter(e=>e);if(e===`@null`)return null;if(i.isObject(e)){if(`@id`in e){let n=e[`@id`];if(t.link.hasOwnProperty(n)){let r=t.link[n].indexOf(e);if(r!==-1)return t.link[n][r];t.link[n].push(e)}else t.link[n]=[e]}for(let n in e)e[n]=u.cleanupNull(e[n],t)}return e};function d(e){let t={};for(let n in e)e[n]!==void 0&&(t[`@`+n]=[e[n]]);return[t]}function f(e,t,n){for(let r=n.length-1;r>=0;--r){let i=n[r];if(i.graph===t&&i.subject[`@id`]===e[`@id`])return!0}return!1}function p(e,t,n){let r=`@`+n,i=r in e?e[r][0]:t[n];if(n===`embed`){if(i===!0)i=`@once`;else if(i===!1)i=`@never`;else if(i!==`@always`&&i!==`@never`&&i!==`@link`&&i!==`@first`&&i!==`@last`&&i!==`@once`)throw new s(`Invalid JSON-LD syntax; invalid value of @embed.`,`jsonld.SyntaxError`,{code:`invalid @embed value`,frame:e})}return i}function m(e){if(!i.isArray(e)||e.length!==1||!i.isObject(e[0]))throw new s(`Invalid JSON-LD syntax; a JSON-LD frame must be a single object.`,`jsonld.SyntaxError`,{frame:e});if(`@id`in e[0]){for(let t of a.asArray(e[0][`@id`]))if(!(i.isObject(t)||o.isAbsolute(t))||i.isString(t)&&t.indexOf(`_:`)===0)throw new s(`Invalid JSON-LD syntax; invalid @id in frame.`,`jsonld.SyntaxError`,{code:`invalid frame`,frame:e})}if(`@type`in e[0]){for(let t of a.asArray(e[0][`@type`]))if(!(i.isObject(t)||o.isAbsolute(t)||t===`@json`)||i.isString(t)&&t.indexOf(`_:`)===0)throw new s(`Invalid JSON-LD syntax; invalid @type in frame.`,`jsonld.SyntaxError`,{code:`invalid frame`,frame:e})}}function h(e,t,n,r){let i={};for(let a of t){let t=e.graphMap[e.graph][a];g(e,t,n,r)&&(i[a]=t)}return i}function g(e,t,o,s){let c=!0,l=!1;for(let u in o){let d=!1,f=a.getValues(t,u),p=a.getValues(o,u).length===0;if(u===`@id`){if(i.isEmptyObject(o[`@id`][0]||{})?d=!0:o[`@id`].length>=0&&(d=o[`@id`].includes(f[0])),!s.requireAll)return d}else if(u===`@type`){if(c=!1,p){if(f.length>0)return!1;d=!0}else if(o[`@type`].length===1&&i.isEmptyObject(o[`@type`][0]))d=f.length>0;else for(let e of o[`@type`])i.isObject(e)&&`@default`in e?d=!0:d||=f.some(t=>t===e);if(!s.requireAll)return d}else if(n(u))continue;else{let t=a.getValues(o,u)[0],n=!1;if(t&&(m([t]),n=`@default`in t),c=!1,f.length===0&&n)continue;if(f.length>0&&p)return!1;if(t===void 0){if(f.length>0)return!1;d=!0}else if(r.isList(t)){let n=t[`@list`][0];if(r.isList(f[0])){let t=f[0][`@list`];r.isValue(n)?d=t.some(e=>x(n,e)):(r.isSubject(n)||r.isSubjectReference(n))&&(d=t.some(t=>b(e,n,t,s)))}}else d=r.isValue(t)?f.some(e=>x(t,e)):r.isSubjectReference(t)?f.some(n=>b(e,t,n,s)):i.isObject(t)?f.length>0:!1}if(!d&&s.requireAll)return!1;l||=d}return c||l}function _(e,t){let n=e.uniqueEmbeds[e.graph],r=n[t],o=r.parent,s=r.property,c={"@id":t};if(i.isArray(o)){for(let e=0;e<o.length;++e)if(a.compareValues(o[e],c)){o[e]=c;break}}else{let e=i.isArray(o[s]);a.removeValue(o,s,c,{propertyIsArray:e}),a.addValue(o,s,c,{propertyIsArray:e})}let l=e=>{let t=Object.keys(n);for(let r of t)r in n&&i.isObject(n[r].parent)&&n[r].parent[`@id`]===e&&(delete n[r],l(r))};l(t)}function v(e,t){if(i.isArray(e))return e.map(e=>v(e,t));if(i.isObject(e)){if(`@preserve`in e)return e[`@preserve`][0];if(r.isValue(e))return e;if(r.isList(e))return e[`@list`]=v(e[`@list`],t),e;if(`@id`in e){let n=e[`@id`];if(t.link.hasOwnProperty(n)){let r=t.link[n].indexOf(e);if(r!==-1)return t.link[n][r];t.link[n].push(e)}else t.link[n]=[e]}for(let n in e){if(n===`@id`&&t.bnodesToClear.includes(e[n])){delete e[`@id`];continue}e[n]=v(e[n],t)}}return e}function y(e,t,n){i.isObject(e)?a.addValue(e,t,n,{propertyIsArray:!0}):e.push(n)}function b(e,t,n,r){if(!(`@id`in n))return!1;let i=e.subjects[n[`@id`]];return i&&g(e,i,t,r)}function x(e,t){let n=t[`@value`],r=t[`@type`],a=t[`@language`],o=e[`@value`]?i.isArray(e[`@value`])?e[`@value`]:[e[`@value`]]:[],s=e[`@type`]?i.isArray(e[`@type`])?e[`@type`]:[e[`@type`]]:[],c=e[`@language`]?i.isArray(e[`@language`])?e[`@language`]:[e[`@language`]]:[];return o.length===0&&s.length===0&&c.length===0||!(!(o.includes(n)||i.isEmptyObject(o[0]))||!(!r&&s.length===0||s.includes(r)||r&&i.isEmptyObject(s[0]))||!(!a&&c.length===0||c.includes(a)||a&&i.isEmptyObject(c[0])))}})),er=o(((e,t)=>{var n=Mn(),{isArray:r,isObject:i,isString:a,isUndefined:o}=An(),{isList:s,isValue:c,isGraph:l,isSimpleGraph:u,isSubjectReference:d}=jn(),{expandIri:f,getContextValue:p,isKeyword:m,process:h,processingMode:g}=Kn(),{removeBase:_,prependBase:v}=In(),{REGEX_KEYWORD:y,addValue:b,asArray:x,compareShortestLeast:S}=Nn(),C={};t.exports=C,C.compact=async({activeCtx:e,activeProperty:t=null,element:f,options:_={}})=>{if(r(f)){let n=[];for(let r=0;r<f.length;++r){let i=await C.compact({activeCtx:e,activeProperty:t,element:f[r],options:_});i!==null&&n.push(i)}return _.compactArrays&&n.length===1&&(p(e,t,`@container`)||[]).length===0&&(n=n[0]),n}let v=p(e,t,`@context`);if(o(v)||(e=await h({activeCtx:e,localCtx:v,propagate:!0,overrideProtected:!0,options:_})),i(f)){if(_.link&&`@id`in f&&_.link.hasOwnProperty(f[`@id`])){let e=_.link[f[`@id`]];for(let t=0;t<e.length;++t)if(e[t].expanded===f)return e[t].compacted}if(c(f)||d(f)){let n=C.compactValue({activeCtx:e,activeProperty:t,value:f,options:_});return _.link&&d(f)&&(_.link.hasOwnProperty(f[`@id`])||(_.link[f[`@id`]]=[]),_.link[f[`@id`]].push({expanded:f,compacted:n})),n}if(s(f)&&(p(e,t,`@container`)||[]).includes(`@list`))return C.compact({activeCtx:e,activeProperty:t,element:f[`@list`],options:_});let v=t===`@reverse`,y={},S=e;!c(f)&&!d(f)&&(e=e.revertToPreviousContext());let w=p(S,t,`@context`);o(w)||(e=await h({activeCtx:e,localCtx:w,propagate:!0,overrideProtected:!0,options:_})),_.link&&`@id`in f&&(_.link.hasOwnProperty(f[`@id`])||(_.link[f[`@id`]]=[]),_.link[f[`@id`]].push({expanded:f,compacted:y}));let E=f[`@type`]||[];E.length>1&&(E=Array.from(E).sort());let D=e;for(let t of E){let n=p(S,C.compactIri({activeCtx:D,iri:t,relativeTo:{vocab:!0}}),`@context`);o(n)||(e=await h({activeCtx:e,localCtx:n,options:_,propagate:!1}))}let O=Object.keys(f).sort();for(let o of O){let d=f[o];if(o===`@id`){let t=x(d).map(t=>C.compactIri({activeCtx:e,iri:t,relativeTo:{vocab:!1},base:_.base}));t.length===1&&(t=t[0]);let n=C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}});y[n]=t;continue}if(o===`@type`){let t=x(d).map(e=>C.compactIri({activeCtx:S,iri:e,relativeTo:{vocab:!0}}));t.length===1&&(t=t[0]);let n=C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}}),i=(p(e,n,`@container`)||[]).includes(`@set`)&&g(e,1.1)||r(t)&&d.length===0;b(y,n,t,{propertyIsArray:i});continue}if(o===`@reverse`){let t=await C.compact({activeCtx:e,activeProperty:`@reverse`,element:d,options:_});for(let n in t)if(e.mappings.has(n)&&e.mappings.get(n).reverse){let r=t[n];b(y,n,r,{propertyIsArray:(p(e,n,`@container`)||[]).includes(`@set`)||!_.compactArrays}),delete t[n]}Object.keys(t).length>0&&b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),t);continue}if(o===`@preserve`){let n=await C.compact({activeCtx:e,activeProperty:t,element:d,options:_});r(n)&&n.length===0||b(y,o,n);continue}if(o===`@index`){if((p(e,t,`@container`)||[]).includes(`@index`))continue;b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),d);continue}if(o!==`@graph`&&o!==`@list`&&o!==`@included`&&m(o)){b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),d);continue}if(!r(d))throw new n(`JSON-LD expansion error; expanded value must be an array.`,`jsonld.SyntaxError`);if(d.length===0){let t=C.compactIri({activeCtx:e,iri:o,value:d,relativeTo:{vocab:!0},reverse:v}),n=e.mappings.has(t)?e.mappings.get(t)[`@nest`]:null,r=y;n&&(T(e,n,_),i(y[n])||(y[n]={}),r=y[n]),b(r,t,d,{propertyIsArray:!0})}for(let t of d){let n=C.compactIri({activeCtx:e,iri:o,value:t,relativeTo:{vocab:!0},reverse:v}),d=e.mappings.has(n)?e.mappings.get(n)[`@nest`]:null,f=y;d&&(T(e,d,_),i(y[d])||(y[d]={}),f=y[d]);let m=p(e,n,`@container`)||[],h=l(t),g=s(t),S;g?S=t[`@list`]:h&&(S=t[`@graph`]);let w=await C.compact({activeCtx:e,activeProperty:n,element:g||h?S:t,options:_});if(g)if(r(w)||(w=[w]),!m.includes(`@list`))w={[C.compactIri({activeCtx:e,iri:`@list`,relativeTo:{vocab:!0}})]:w},`@index`in t&&(w[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=t[`@index`]);else{b(f,n,w,{valueIsArray:!0,allowDuplicate:!0});continue}if(h)if(m.includes(`@graph`)&&(m.includes(`@id`)||m.includes(`@index`)&&u(t))){let r;f.hasOwnProperty(n)?r=f[n]:f[n]=r={};let i=(m.includes(`@id`)?t[`@id`]:t[`@index`])||C.compactIri({activeCtx:e,iri:`@none`,relativeTo:{vocab:!0}});b(r,i,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)})}else m.includes(`@graph`)&&u(t)?(r(w)&&w.length>1&&(w={"@included":w}),b(f,n,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)})):(r(w)&&w.length===1&&_.compactArrays&&(w=w[0]),w={[C.compactIri({activeCtx:e,iri:`@graph`,relativeTo:{vocab:!0}})]:w},`@id`in t&&(w[C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}})]=t[`@id`]),`@index`in t&&(w[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=t[`@index`]),b(f,n,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)}));else if(m.includes(`@language`)||m.includes(`@index`)||m.includes(`@id`)||m.includes(`@type`)){let r;f.hasOwnProperty(n)?r=f[n]:f[n]=r={};let i;if(m.includes(`@language`))c(w)&&(w=w[`@value`]),i=t[`@language`];else if(m.includes(`@index`)){let r=p(e,n,`@index`)||`@index`,o=C.compactIri({activeCtx:e,iri:r,relativeTo:{vocab:!0}});if(r===`@index`)i=t[`@index`],delete w[o];else{let e;if([i,...e]=x(w[r]||[]),!a(i))i=null;else switch(e.length){case 0:delete w[r];break;case 1:w[r]=e[0];break;default:w[r]=e;break}}}else if(m.includes(`@id`)){let t=C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}});i=w[t],delete w[t]}else if(m.includes(`@type`)){let r=C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}}),a;switch([i,...a]=x(w[r]||[]),a.length){case 0:delete w[r];break;case 1:w[r]=a[0];break;default:w[r]=a;break}Object.keys(w).length===1&&`@id`in t&&(w=await C.compact({activeCtx:e,activeProperty:n,element:{"@id":t[`@id`]},options:_}))}i||=C.compactIri({activeCtx:e,iri:`@none`,relativeTo:{vocab:!0}}),b(r,i,w,{propertyIsArray:m.includes(`@set`)})}else{let e=!_.compactArrays||m.includes(`@set`)||m.includes(`@list`)||r(w)&&w.length===0||o===`@list`||o===`@graph`;b(f,n,w,{propertyIsArray:e})}}}return y}return f},C.compactIri=({activeCtx:e,iri:t,value:r=null,relativeTo:a={vocab:!1},reverse:o=!1,base:u=null})=>{if(t===null)return t;e.isPropertyTermScoped&&e.previousContext&&(e=e.previousContext);let d=e.getInverse();if(m(t)&&t in d&&`@none`in d[t]&&`@type`in d[t][`@none`]&&`@none`in d[t][`@none`][`@type`])return d[t][`@none`][`@type`][`@none`];if(a.vocab&&t in d){let n=e[`@language`]||`@none`,a=[];i(r)&&`@index`in r&&!(`@graph`in r)&&a.push(`@index`,`@index@set`),i(r)&&`@preserve`in r&&(r=r[`@preserve`][0]),l(r)?(`@index`in r&&a.push(`@graph@index`,`@graph@index@set`,`@index`,`@index@set`),`@id`in r&&a.push(`@graph@id`,`@graph@id@set`),a.push(`@graph`,`@graph@set`,`@set`),`@index`in r||a.push(`@graph@index`,`@graph@index@set`,`@index`,`@index@set`),`@id`in r||a.push(`@graph@id`,`@graph@id@set`)):i(r)&&!c(r)&&a.push(`@id`,`@id@set`,`@type`,`@set@type`);let u=`@language`,d=`@null`;if(o)u=`@type`,d=`@reverse`,a.push(`@set`);else if(s(r)){`@index`in r||a.push(`@list`);let e=r[`@list`];if(e.length===0)u=`@any`,d=`@none`;else{let t=e.length===0?n:null,r=null;for(let n=0;n<e.length;++n){let i=e[n],a=`@none`,o=`@none`;if(c(i)?`@direction`in i?a=`${(i[`@language`]||``).toLowerCase()}_${i[`@direction`]}`:`@language`in i?a=i[`@language`].toLowerCase():`@type`in i?o=i[`@type`]:a=`@null`:o=`@id`,t===null?t=a:a!==t&&c(i)&&(t=`@none`),r===null?r=o:o!==r&&(r=`@none`),t===`@none`&&r===`@none`)break}t||=`@none`,r||=`@none`,r===`@none`?d=t:(u=`@type`,d=r)}}else{if(c(r))if(`@language`in r&&!(`@index`in r)){a.push(`@language`,`@language@set`),d=r[`@language`];let e=r[`@direction`];e&&(d=`${d}_${e}`)}else`@direction`in r&&!(`@index`in r)?d=`_${r[`@direction`]}`:`@type`in r&&(u=`@type`,d=r[`@type`]);else u=`@type`,d=`@id`;a.push(`@set`)}a.push(`@none`),i(r)&&!(`@index`in r)&&a.push(`@index`,`@index@set`),c(r)&&Object.keys(r).length===1&&a.push(`@language`,`@language@set`);let f=w(e,t,r,a,u,d);if(f!==null)return f}if(a.vocab&&`@vocab`in e){let n=e[`@vocab`];if(t.indexOf(n)===0&&t!==n){let r=t.substr(n.length);if(!e.mappings.has(r))return r}}let f=null,p=[],h=e.fastCurieMap,g=t.length-1;for(let e=0;e<g&&t[e]in h;++e)h=h[t[e]],``in h&&p.push(h[``][0]);for(let n=p.length-1;n>=0;--n){let i=p[n],a=i.terms;for(let n of a){let a=n+`:`+t.substr(i.iri.length);e.mappings.get(n)._prefix&&(!e.mappings.has(a)||r===null&&e.mappings.get(a)[`@id`]===t)&&(f===null||S(a,f)<0)&&(f=a)}}if(f!==null)return f;for(let[r,i]of e.mappings)if(i&&i._prefix&&t.startsWith(r+`:`))throw new n(`Absolute IRI "${t}" confused with prefix "${r}".`,`jsonld.SyntaxError`,{code:`IRI confused with prefix`,context:e});if(!a.vocab)if(`@base`in e)if(e[`@base`]){let n=_(v(u,e[`@base`]),t);return y.test(n)?`./${n}`:n}else return t;else return _(u,t);return t},C.compactValue=({activeCtx:e,activeProperty:t,value:n,options:r})=>{if(c(n)){let r=p(e,t,`@type`),i=p(e,t,`@language`),o=p(e,t,`@direction`),s=p(e,t,`@container`)||[],c=`@index`in n&&!s.includes(`@index`);if(!c&&r!==`@none`&&(n[`@type`]===r||`@language`in n&&n[`@language`]===i&&`@direction`in n&&n[`@direction`]===o||`@language`in n&&n[`@language`]===i||`@direction`in n&&n[`@direction`]===o))return n[`@value`];let l=Object.keys(n).length,u=l===1||l===2&&`@index`in n&&!c,d=`@language`in e,f=a(n[`@value`]),m=e.mappings.has(t)&&e.mappings.get(t)[`@language`]===null;if(u&&r!==`@none`&&(!d||!f||m))return n[`@value`];let h={};return c&&(h[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=n[`@index`]),`@type`in n?h[C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}})]=C.compactIri({activeCtx:e,iri:n[`@type`],relativeTo:{vocab:!0}}):`@language`in n&&(h[C.compactIri({activeCtx:e,iri:`@language`,relativeTo:{vocab:!0}})]=n[`@language`]),`@direction`in n&&(h[C.compactIri({activeCtx:e,iri:`@direction`,relativeTo:{vocab:!0}})]=n[`@direction`]),h[C.compactIri({activeCtx:e,iri:`@value`,relativeTo:{vocab:!0}})]=n[`@value`],h}let i=f(e,t,{vocab:!0},r),o=p(e,t,`@type`),s=C.compactIri({activeCtx:e,iri:n[`@id`],relativeTo:{vocab:o===`@vocab`},base:r.base});return o===`@id`||o===`@vocab`||i===`@graph`?s:{[C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}})]:s}};function w(e,t,n,r,a,o){o===null&&(o=`@null`);let s=[];if((o===`@id`||o===`@reverse`)&&i(n)&&`@id`in n){o===`@reverse`&&s.push(`@reverse`);let t=C.compactIri({activeCtx:e,iri:n[`@id`],relativeTo:{vocab:!0}});e.mappings.has(t)&&e.mappings.get(t)&&e.mappings.get(t)[`@id`]===n[`@id`]?s.push.apply(s,[`@vocab`,`@id`]):s.push.apply(s,[`@id`,`@vocab`])}else{s.push(o);let e=s.find(e=>e.includes(`_`));e&&s.push(e.replace(/^[^_]+_/,`_`))}s.push(`@none`);let c=e.inverse[t];for(let e of r){if(!(e in c))continue;let t=c[e][a];for(let e of s)if(e in t)return t[e]}return null}function T(e,t,r){if(f(e,t,{vocab:!0},r)!==`@nest`)throw new n(`JSON-LD compact error; nested property must have an @nest value resolving to @nest.`,`jsonld.SyntaxError`,{code:`invalid @nest value`})}})),tr=o(((e,t)=>{t.exports=e=>{class t{toString(){return`[object JsonLdProcessor]`}}return Object.defineProperty(t,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(t.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:t}),t.compact=function(t,n){return arguments.length<2?Promise.reject(TypeError(`Could not compact, too few arguments.`)):e.compact(t,n)},t.expand=function(t){return arguments.length<1?Promise.reject(TypeError(`Could not expand, too few arguments.`)):e.expand(t)},t.flatten=function(t){return arguments.length<1?Promise.reject(TypeError(`Could not flatten, too few arguments.`)):e.flatten(t)},t}})),nr=o(((e,t)=>{var n=kn(),r=Rn(),i=Nn(),a=Un(),o=i.IdentifierIssuer,s=Mn(),c=Vn(),l=Wn(),{expand:u}=qn(),{flatten:d}=Yn(),{fromRDF:f}=Xn(),{toRDF:p}=Qn(),{frameMergedOrDefault:m,cleanupNull:h}=$n(),{isArray:g,isObject:_,isString:v}=An(),{isSubjectReference:y}=jn(),{expandIri:b,getInitialContext:x,process:S,processingMode:C}=Kn(),{compact:w,compactIri:T}=er(),{createNodeMap:E,createMergedNodeMap:D,mergeNodeMaps:O}=Jn(),{logEventHandler:k,logWarningEventHandler:A,safeEventHandler:j,setDefaultEventHandler:M,setupEventHandler:N,strictEventHandler:P,unhandledEventHandler:F}=Gn(),I=function(e){let t={},I=new c({max:100});e.compact=async function(t,n,r){if(arguments.length<2)throw TypeError(`Could not compact, too few arguments.`);if(n===null)throw new s(`The compaction context must not be null.`,`jsonld.CompactError`,{code:`invalid local context`});if(t===null)return null;r=L(r,{base:v(t)?t:``,compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new o(`_:b`),contextResolver:new a({sharedCache:I})}),r.link&&(r.skipExpansion=!0),r.compactToRelative||delete r.base;let c;c=r.skipExpansion?t:await e.expand(t,r);let l=await e.processContext(x(r),n,r),u=await w({activeCtx:l,element:c,options:r});r.compactArrays&&!r.graph&&g(u)?u.length===1?u=u[0]:u.length===0&&(u={}):r.graph&&_(u)&&(u=[u]),_(n)&&`@context`in n&&(n=n[`@context`]),n=i.clone(n),g(n)||(n=[n]);let d=n;n=[];for(let e=0;e<d.length;++e)(!_(d[e])||Object.keys(d[e]).length>0)&&n.push(d[e]);let f=n.length>0;if(n.length===1&&(n=n[0]),g(u)){let e=T({activeCtx:l,iri:`@graph`,relativeTo:{vocab:!0}}),t=u;u={},f&&(u[`@context`]=n),u[e]=t}else if(_(u)&&f){let e=u;u={"@context":n};for(let t in e)u[t]=e[t]}return u},e.expand=async function(t,n){if(arguments.length<1)throw TypeError(`Could not expand, too few arguments.`);n=L(n,{keepFreeFloatingNodes:!1,contextResolver:new a({sharedCache:I})});let r={},o=[];if(`expandContext`in n){let e=i.clone(n.expandContext);_(e)&&`@context`in e?r.expandContext=e:r.expandContext={"@context":e},o.push(r.expandContext)}let s;if(!v(t))r.input=i.clone(t);else{let i=await e.get(t,n);s=i.documentUrl,r.input=i.document,i.contextUrl&&(r.remoteContext={"@context":i.contextUrl},o.push(r.remoteContext))}`base`in n||(n.base=s||``);let c=x(n);for(let e of o)c=await S({activeCtx:c,localCtx:e,options:n});let l=await u({activeCtx:c,element:r.input,options:n});return _(l)&&`@graph`in l&&Object.keys(l).length===1?l=l[`@graph`]:l===null&&(l=[]),g(l)||(l=[l]),l},e.flatten=async function(t,n,r){if(arguments.length<1)return TypeError(`Could not flatten, too few arguments.`);typeof n==`function`?n=null:n||=null,r=L(r,{base:v(t)?t:``,contextResolver:new a({sharedCache:I})});let i=d(await e.expand(t,r));return n===null?i:(r.graph=!0,r.skipExpansion=!0,await e.compact(i,n,r))},e.frame=async function(t,n,r){if(arguments.length<2)throw TypeError(`Could not frame, too few arguments.`);if(r=L(r,{base:v(t)?t:``,embed:`@once`,explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new a({sharedCache:I})}),v(n)){let t=await e.get(n,r);if(n=t.document,t.contextUrl){let e=n[`@context`];e?g(e)?e.push(t.contextUrl):e=[e,t.contextUrl]:e=t.contextUrl,n[`@context`]=e}}let i=n&&n[`@context`]||{},o=await e.processContext(x(r),i,r);r.hasOwnProperty(`omitGraph`)||(r.omitGraph=C(o,1.1)),r.hasOwnProperty(`pruneBlankNodeIdentifiers`)||(r.pruneBlankNodeIdentifiers=C(o,1.1));let s=await e.expand(t,r),c={...r};c.isFrame=!0,c.keepFreeFloatingNodes=!0;let l=await e.expand(n,c);c.merged=!Object.keys(n).map(e=>b(o,e,{vocab:!0})).includes(`@graph`),c.is11=C(o,1.1);let u=m(s,l,c);c.graph=!r.omitGraph,c.skipExpansion=!0,c.link={},c.framing=!0;let d=await e.compact(u,i,c);return c.link={},d=h(d,c),d},e.link=async function(t,n,r){let i={};return n&&(i[`@context`]=n),i[`@embed`]=`@link`,e.frame(t,i,r)},e.normalize=e.canonize=async function(t,r){if(arguments.length<1)throw TypeError(`Could not canonize, too few arguments.`);r=L(r,{skipExpansion:!1,safe:!0,contextResolver:new a({sharedCache:I})});let i=Object.assign({},{algorithm:`RDFC-1.0`},r.canonizeOptions||null);if(`inputFormat`in r){if(r.inputFormat!==`application/n-quads`)throw new s(`Unknown canonicalization input format.`,`jsonld.CanonizeError`);let e=l.parse(t);return n.canonize(e,i)}let o={...r};delete o.format,delete o.canonizeOptions,o.produceGeneralizedRdf=!1;let c=await e.toRDF(t,o);return n.canonize(c,i)},e.fromRDF=async function(e,n){if(arguments.length<1)throw TypeError(`Could not convert from RDF, too few arguments.`);n=L(n,{format:v(e)?`application/n-quads`:void 0});let{format:r}=n,{rdfParser:i}=n;if(r){if(i||=t[r],!i)throw new s(`Unknown input format.`,`jsonld.UnknownFormat`,{format:r})}else i=()=>e;return f(await i(e),n)},e.toRDF=async function(t,n){if(arguments.length<1)throw TypeError(`Could not convert to RDF, too few arguments.`);n=L(n,{skipExpansion:!1,contextResolver:new a({sharedCache:I})});let r;r=n.skipExpansion?t:await e.expand(t,n);let i=p(r,n);if(n.format){if(n.format===`application/n-quads`)return l.serialize(i);throw new s(`Unknown output format.`,`jsonld.UnknownFormat`,{format:n.format})}return i},e.createNodeMap=async function(t,n){if(arguments.length<1)throw TypeError(`Could not create node map, too few arguments.`);return n=L(n,{base:v(t)?t:``,contextResolver:new a({sharedCache:I})}),D(await e.expand(t,n),n)},e.merge=async function(t,n,r){if(arguments.length<1)throw TypeError(`Could not merge, too few arguments.`);if(!g(t))throw TypeError(`Could not merge, "docs" must be an array.`);typeof n==`function`?n=null:n||=null,r=L(r,{contextResolver:new a({sharedCache:I})});let s=await Promise.all(t.map(t=>{let n={...r};return e.expand(t,n)})),c=!0;`mergeNodes`in r&&(c=r.mergeNodes);let l=r.issuer||new o(`_:b`),u={"@default":{}};for(let e=0;e<s.length;++e){let t=i.relabelBlankNodes(s[e],{issuer:new o(`_:b`+e+`-`)}),n=c||e===0?u:{"@default":{}};if(E(t,n,`@default`,l),n!==u)for(let e in n){let t=n[e];if(!(e in u)){u[e]=t;continue}let r=u[e];for(let e in t)e in r||(r[e]=t[e])}}let d=O(u),f=[],p=Object.keys(d).sort();for(let e=0;e<p.length;++e){let t=d[p[e]];y(t)||f.push(t)}return n===null?f:(r.graph=!0,r.skipExpansion=!0,await e.compact(f,n,r))},Object.defineProperty(e,"documentLoader",{get:()=>e._documentLoader,set:t=>e._documentLoader=t}),e.documentLoader=async e=>{throw new s(`Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:e})},e.get=async function(t,n){let r;r=typeof n.documentLoader==`function`?n.documentLoader:e.documentLoader;let i=await r(t);try{if(!i.document)throw new s(`No remote document found at the given URL.`,`jsonld.NullRemoteDocument`);v(i.document)&&(i.document=JSON.parse(i.document))}catch(e){throw new s(`Could not retrieve a JSON-LD document from the URL.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,cause:e,remoteDoc:i})}return i},e.processContext=async function(e,t,n){return n=L(n,{base:``,contextResolver:new a({sharedCache:I})}),t===null?x(n):(t=i.clone(t),_(t)&&`@context`in t||(t={"@context":t}),S({activeCtx:e,localCtx:t,options:n}))},e.getContextValue=Kn().getContextValue,e.documentLoaders={},e.useDocumentLoader=function(t){if(!(t in e.documentLoaders))throw new s(`Unknown document loader type: "`+t+`"`,`jsonld.UnknownDocumentLoader`,{type:t});e.documentLoader=e.documentLoaders[t].apply(e,Array.prototype.slice.call(arguments,1))},e.registerRDFParser=function(e,n){t[e]=n},e.unregisterRDFParser=function(e){delete t[e]},e.registerRDFParser(`application/n-quads`,l.parse),e.url=In(),e.logEventHandler=k,e.logWarningEventHandler=A,e.safeEventHandler=j,e.setDefaultEventHandler=M,e.strictEventHandler=P,e.unhandledEventHandler=F,e.util=i,Object.assign(e,i),e.promises=e,e.RequestQueue=Fn(),e.JsonLdProcessor=tr()(e),r.setupGlobals(e),r.setupDocumentLoaders(e);function L(t,{documentLoader:n=e.documentLoader,...r}){if(t&&`compactionMap`in t)throw new s(`"compactionMap" not supported.`,`jsonld.OptionsError`);if(t&&`expansionMap`in t)throw new s(`"expansionMap" not supported.`,`jsonld.OptionsError`);return Object.assign({},{documentLoader:n},r,t,{eventHandler:N({options:t})})}return e},L=function(){return I(function(){return L()})};I(L),t.exports=L})),rr=yn(),ir=l(nr(),1),ar={},or={};async function sr(e){return`rdf`in e?lr(e.rdf):e.rdfUrlResolver?lr(await e.rdfUrlResolver(e.url)):cr(e.url,e.proxy)}async function cr(e,t){return e in ar||(ar[e]=(async()=>{let n=e;t&&(n=t+encodeURIComponent(e));let r=await fetch(n,{headers:{Accept:`text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json`}});return r.ok?lr(await r.text()):(console.warn(`failed fetching RDF from`,e),[])})()),ar[e]}async function lr(e){if(!e.trim())return[];let t=ur(e);if(t===`json`)try{e=await ir.default.toRDF(JSON.parse(e),{format:`application/n-quads`})}catch(e){console.error(e)}let n=[];return await new Promise((r,i)=>{let a=t===`xml`?new rr.RdfXmlParser:new at;a.on(`data`,e=>{n.push(k.quad(e.subject,e.predicate,e.object,e.graph))}).on(`error`,e=>{i(e)}).on(`prefix`,(e,t)=>{e&&(or[e]=t)}).on(`end`,()=>{r(null)}),a.write(e),a.end()}),n}function ur(e){return/^\s*[\\[{]/.test(e)?`json`:/^\s*<\?xml/.test(e)?`xml`:`ttl`}var dr={[`${J}name`]:(e,t)=>{let n=t;e.name=Ht(e.config.languages,e.name,n)},[`${J}description`]:(e,t)=>{let n=t;e.description=Ht(e.config.languages,e.description,n)},[`${J}path`]:(e,t)=>{e.path=t.value},[`${J}group`]:(e,t)=>{e.group=t.id},[`${J}datatype`]:(e,t)=>{e.datatype=t},[`${J}nodeKind`]:(e,t)=>{e.nodeKind=t},[`${J}minCount`]:(e,t)=>{e.minCount=parseInt(t.value)},[`${J}maxCount`]:(e,t)=>{e.maxCount=parseInt(t.value)},[`${J}minLength`]:(e,t)=>{e.minLength=parseInt(t.value)},[`${J}maxLength`]:(e,t)=>{e.maxLength=parseInt(t.value)},[`${J}minInclusive`]:(e,t)=>{e.minInclusive=parseInt(t.value)},[`${J}maxInclusive`]:(e,t)=>{e.maxInclusive=parseInt(t.value)},[`${J}minExclusive`]:(e,t)=>{e.minExclusive=parseInt(t.value)},[`${J}maxExclusive`]:(e,t)=>{e.maxExclusive=parseInt(t.value)},[`${J}pattern`]:(e,t)=>{e.pattern=t.value},[`${J}order`]:(e,t)=>{e.order=parseInt(t.value)},[`${ot}singleLine`]:(e,t)=>{e.singleLine=t.value===`true`},[`${ot}readonly`]:(e,t)=>{e.readonly=t.value===`true`},[`${ut}styleClass`]:(e,t)=>{e.cssClass=t.value},[`${J}in`]:(e,t)=>{e.in=t.value},[`${J}languageIn`]:(e,t)=>{e.languageIn=e.config.lists[t.value],e.datatype=ht},[`${J}defaultValue`]:(e,t)=>{e.defaultValue=t},[`${J}hasValue`]:(e,t)=>{e.hasValue=t},[`${J}node`]:(e,t)=>{e.node=t,e.nodeShapes.add(e.config.getNodeTemplate(t,e))},[`${J}and`]:(e,t)=>{e.and=t.value;let n=e.config.lists[e.and];if(n?.length)for(let t of n)e.nodeShapes.add(e.config.getNodeTemplate(t,e))},[`${J}qualifiedValueShape`]:(e,t)=>{let n=e.config.getNodeTemplate(t,e);e.qualifiedValueShape=n,e.nodeShapes.add(n)},[`${J}qualifiedMinCount`]:(e,t)=>{e.qualifiedMinCount=parseInt(t.value)},[`${J}qualifiedMaxCount`]:(e,t)=>{e.qualifiedMaxCount=parseInt(t.value)},[vt.id]:(e,t)=>{e.owlImports.add(t)},[wt.id]:(e,t)=>{e.class=t;let n=e.config.store.getSubjects(Et,t,null);n.length>0&&(e.node=n[0])},[`${J}or`]:(e,t)=>{let n=e.config.lists[t.value];n?.length?e.or=n:console.error(`list for sh:or not found:`,t.value,`existing lists:`,e.config.lists)},[`${J}xone`]:(e,t)=>{let n=e.config.lists[t.value];n?.length?e.xone=n:console.error(`list for sh:xone not found:`,t.value,`existing lists:`,e.config.lists)}},fr=class{constructor(e,t){this.label=``,this.nodeShapes=new Set,this.owlImports=new Set,this.id=e,this.parent=t,this.config=t.config,this.config.registerPropertyTemplate(this),gr(this,this.config.store.getQuads(e,null,null,null))}};function pr(e){return Math.max(e.minCount??0,e.qualifiedMinCount??0)}function mr(e){return Math.min(e.maxCount??2**53-1,e.qualifiedMaxCount??2**53-1)}function hr(e){let t=Object.assign({},e);return t.nodeShapes=new Set(e.nodeShapes),t.owlImports=new Set(e.owlImports),e.languageIn&&(t.languageIn=[...e.languageIn]),e.or&&(t.or=[...e.or]),e.xone&&(t.xone=[...e.xone]),t}function gr(e,t){for(let n of t)dr[n.predicate.id]?.call(e,e,n.object);return e.label=e.name?.value||It(t,e.config.languages),e.label||=e.path?Rt(e.path,or):`unknown`,e}function _r(e,t){let n=t,r=e;for(let e in t)if(e!==`parent`&&e!==`config`&&e!==`id`){let t=n[e];if(t!==void 0&&t!==``)if(Array.isArray(t)){let n=r[e];Array.isArray(n)?n.push(...t):r[e]=[...t]}else if(t instanceof Set&&t.size){let n=r[e];r[e]=new Set([...n instanceof Set?n:[],...t])}else r[e]=t}}var vr=`modulepreload`,yr=function(e){return`/`+e},br={},xr=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=yr(t,n),t=s(t),t in br)return;br[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:vr,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function Sr(e,t,n){let r=document.createElement(`div`);r.classList.add(`shacl-or-constraint`),r.setAttribute(`part`,`constraint`);let i=[];if(t instanceof ro){let a=[],o=!1;e.length&&(o=n.store.countQuads(e[0],Ct,null,null)>0);for(let r=0;r<e.length;r++)if(o){let o=n.store.getObjects(e[r],Ct,null),s=[],c=``;for(let e of o){let r=new Pa(n.getPropertyTemplate(e,t.template),t);s.push(r),c+=(c.length>0?` / `:``)+r.template.label}a.push(s),i.push({label:c,value:r.toString()})}else{let o=e[r],s=new Pa(n.getPropertyTemplate(o,t.template),t);a.push([s]),i.push({label:s.template.label,value:r.toString()})}let s=n.theme.createListEditor(`Please choose`,null,!1,i);s.setAttribute(`part`,`constraint-editor`);let c=s.querySelector(`.editor`);c.onchange=async()=>{if(c.value){let e=a[parseInt(c.value)];if(n.queryMode){let{activateNodeConstraintOption:t}=await xr(async()=>{let{activateNodeConstraintOption:e}=await import(`./mode-KFvmvNiB.js`);return{activateNodeConstraintOption:e}},[]);await t(e,r);return}let i;if(e.length){for(let n of e)await n.bindValues(t.nodeId,!1);i=e[0],r.replaceWith(e[0]),i.updateControls()}for(let t=1;t<e.length;t++)i.after(e[t]),i=e[t],i.updateControls()}},r.appendChild(s)}else{let a=[];for(let t=0;t<e.length;t++){let r=n.store.getQuads(e[t],null,null,null);if(r.length){a.push(r);let e=It(r,n.languages);for(let t of r)t.predicate.equals(Tt)&&(e=It(n.store.getQuads(t.object,null,null,null),n.languages));i.push({label:e||Rt(r[0].predicate.value,or)+` = `+Rt(r[0].object.value,or),value:t.toString()})}}let o=n.theme.createListEditor(t.template.label+`?`,null,!1,i,t.template);o.setAttribute(`part`,`constraint-editor`);let s=o.querySelector(`.editor`);s.onchange=async()=>{if(s.value){let e=gr(hr(t.template),a[parseInt(s.value)]);if(n.queryMode){let{activatePropertyConstraintOption:n}=await xr(async()=>{let{activatePropertyConstraintOption:e}=await import(`./mode-KFvmvNiB.js`);return{activatePropertyConstraintOption:e}},[]);await n(e,t,r);return}let i=await Fa(e,void 0,!0),o=i.querySelector(`:scope > label`);o&&o.classList.add(`persistent`),r.replaceWith(i)}},r.appendChild(o)}return r}function Cr(e,t,n){if(t.termType===`Literal`){let r=t.datatype;for(let t of e){let e=n.store.getQuads(t,null,null,null);for(let t of e)if(t.predicate.value===`http://www.w3.org/ns/shacl#datatype`&&t.object.equals(r))return e}}else{let r=n.store.getObjects(t,mt,null);for(let t of e){let e=n.store.getQuads(t,null,null,null);for(let t of e)if(r.length>0){if(t.predicate.value===`http://www.w3.org/ns/shacl#node`){for(let i of r)if(n.store.getQuads(t.object,Et,i,null).length>0)return e}if(t.predicate.equals(wt)){for(let n of r)if(t.object.equals(n))return e}}else if(t.predicate.equals(Dt)&&t.object.equals(St))return e}}return console.error(`couldn't resolve sh:or/sh:xone on property for value`,t),[]}function wr(e,t,n){for(let r of e){let e=!1,i=n.store.getObjects(r,Ct,null);for(let r of i){let i=n.store.getObjects(r,`${J}path`,null);for(let r of i)if(e=n.store.countQuads(t,r,null,null)>0,e)break}if(e)return i}return console.error(`couldn't resolve sh:or/sh:xone on node for value`,t),[]}var Tr=`:host {
|
|
27
27
|
--shacl-font-family: inherit;
|
|
28
28
|
--shacl-font-size: 14px;
|
|
29
29
|
--shacl-text-color: #333;
|
|
@@ -312,7 +312,7 @@ rokit-select::part(facet-count)::after { content: attr(data-count); color: var(-
|
|
|
312
312
|
box-sizing: border-box;
|
|
313
313
|
visibility: var(--rokit-select-overlay-visibility, hidden);
|
|
314
314
|
}
|
|
315
|
-
rokit-collapsible[open].has-content::part(content), rokit-collapsible.has-content.transitioning::part(content) { box-shadow: 0 0 10px var(--rokit-shadow-color-inner); clip-path: inset(0 -13px -13px 0); }
|
|
315
|
+
rokit-collapsible[open].has-content::part(content), rokit-collapsible.has-content.transitioning::part(content) { box-shadow: 0 0 10px var(--rokit-shadow-color-inner); clip-path: var(--rokit-select-overlay-shadow-clip, inset(0 -13px -13px 0)); }
|
|
316
316
|
}
|
|
317
317
|
#list-container { outline: 0; }
|
|
318
318
|
#list-container-slot, ::slotted(ul) { display: none !important; }
|
|
@@ -331,7 +331,7 @@ rokit-select::part(facet-count)::after { content: attr(data-count); color: var(-
|
|
|
331
331
|
:host([collapse]) li > div > div { padding-left: 1.8em; }
|
|
332
332
|
:host([collapse]) ul:not(.open) { display: none; }
|
|
333
333
|
:host([collapse]) li:not(.open) > div > .toggle-node::part(caret-icon) { transform: translate(0, 0) rotate(-45deg); }
|
|
334
|
-
`]}#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;constructor(){super(),this.emptyMessage=`Nothing to select`,this.collapsibleOrientationLeft=`0`,this.collapsibleOrientationRight=`0`,this.collapsibleWidth=``,this.autoGrowLabelWidth=!1,this.fixedOpen=!1,this.collapse=!1,this.filterableThreshold=15,this.itemCount=0,this.selectedItem=null,this.#e=``,this.#t=``,this.#n=0,this.#r=!1,this.#i=!1,this.#o=()=>{let e=this.collapsible?.content;if(!e?.matches(`:popover-open`))return;let t=this.getBoundingClientRect(),n=document.documentElement.clientWidth,r=document.documentElement.clientHeight,i=this.collapsibleWidth||`${t.width}px`;this.style.setProperty(`--rokit-select-overlay-width`,i);let a=e.getBoundingClientRect().width,o=Math.max(0,Math.min(t.left,n-a));this.style.setProperty(`--rokit-select-overlay-left`,`${o}px`),this.style.setProperty(`--rokit-select-overlay-right`,`auto`);let s=this.collapsible.maxHeight??e.scrollHeight,c=Math.min(s,e.scrollHeight),l=Math.max(0,r-t.bottom-2),u=Math.max(0,t.top-2);l<c&&u>l?(this.style.setProperty(`--rokit-select-overlay-top`,`auto`),this.style.setProperty(`--rokit-select-overlay-bottom`,`${r-t.top+2}px`),this.style.setProperty(`--rokit-select-overlay-max-height`,`${Math.min(s,u)}px`)):(this.style.setProperty(`--rokit-select-overlay-top`,`${t.bottom+2}px`),this.style.setProperty(`--rokit-select-overlay-bottom`,`auto`),this.style.setProperty(`--rokit-select-overlay-max-height`,`${Math.min(s,l)}px`))},this.#s=new MutationObserver(()=>this.onSlotChange()),this.#c=()=>{this.#r||this.openList()},this.#l=e=>{let t=e.relatedTarget;t&&(this.contains(t)||this.shadowRoot?.contains(t))||(this.checkInputValue(),this.closeList(!1,!0))},this.#u=()=>{this.#r||this.openList(!1)},this.#d=e=>{!this.clearable||!this.input.readonly||e.composedPath().find(e=>e instanceof ra&&e.classList.contains(`clear`))&&(this.input.inputElement.focus(),this.selectItem(null))},this.#f=e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),this.openList(),this.highlightNextItem();break;case`ArrowUp`:e.preventDefault(),this.openList(),this.highlightPreviousItem(!0);break;case`Enter`:{let t=this.activeItem();if(t){e.preventDefault(),this.selectItem(t,!0,!0);break}let n=this.findItem(this.input.value);n?(e.preventDefault(),this.selectItem(n,!0,!0)):this.checkInputValue();break}case`Escape`:this.collapsible.open&&(e.preventDefault(),this.restoreSelection(),this.closeList(!1));break;case`Tab`:this.checkInputValue(),this.closeList(!1);break}},this.#p=e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),this.highlightNextItem();break;case`ArrowUp`:e.preventDefault(),this.highlightPreviousItem();break;case`Home`:e.preventDefault(),this.highlightFirstItem();break;case`End`:e.preventDefault(),this.highlightLastItem();break;case`Enter`:{e.preventDefault();let t=this.activeItem();t&&this.selectItem(t,!0,!0);break}case`ArrowRight`:if(this.collapse){let t=this.activeItem();t&&(e.preventDefault(),this.toggleNestedList(t,!0))}break;case`ArrowLeft`:if(this.collapse){let t=this.activeItem();t&&(e.preventDefault(),this.toggleNestedList(t,!1))}break;case`Escape`:e.preventDefault(),this.restoreSelection(),this.closeList(!1),this.input.inputElement.focus();break;case`Tab`:this.checkInputValue(),this.closeList(!1);break}},this.addEventListener(`focusin`,this.#c),this.addEventListener(`focusout`,this.#l),this.addEventListener(`input`,this.#u)}disconnectedCallback(){this.#g(),this.#s.disconnect(),this.input?.removeEventListener(`click`,this.#d,!0),this.removeEventListener(`focusin`,this.#c),this.removeEventListener(`focusout`,this.#l),this.removeEventListener(`input`,this.#u),super.disconnectedCallback()}#m(){let e=this.collapsible?.content;e&&(this.fixedOpen?(this.#g(),e.removeAttribute(`popover`),this.listContainer.hidden=!1):(e.setAttribute(`popover`,`manual`),e.matches(`:popover-open`)||(this.listContainer.hidden=!0)))}#h(){let e=this.collapsible.content;this.fixedOpen||!this.isConnected||!e.hasAttribute(`popover`)||(this.#a!==void 0&&(window.clearTimeout(this.#a),this.#a=void 0),this.listContainer.hidden=!1,this.style.setProperty(`--rokit-select-overlay-visibility`,`visible`),e.matches(`:popover-open`)||e.showPopover(),this.#o(),this.#i||=(window.addEventListener(`resize`,this.#o),window.addEventListener(`scroll`,this.#o,!0),!0))}#g(){this.#a!==void 0&&(window.clearTimeout(this.#a),this.#a=void 0);let e=this.collapsible?.content;this.listContainer&&(this.listContainer.hidden=!0),this.style.setProperty(`--rokit-select-overlay-visibility`,`hidden`),e?.matches(`:popover-open`)&&e.hidePopover();for(let e of[`--rokit-select-overlay-top`,`--rokit-select-overlay-right`,`--rokit-select-overlay-bottom`,`--rokit-select-overlay-left`,`--rokit-select-overlay-width`,`--rokit-select-overlay-max-height`])this.style.removeProperty(e);this.#i&&=(window.removeEventListener(`resize`,this.#o),window.removeEventListener(`scroll`,this.#o,!0),!1)}firstUpdated(){this.#e=this.value,this.#t=getComputedStyle(this).getPropertyValue(`--rokit-list-indent-inner`),this.input.addEventListener(`click`,this.#d,!0),this.input.placeholder=this.placeholder===void 0?`Type to filter list...`:this.placeholder,this.input.label=this.label,this.inputMinWidth!==void 0&&(this.input.minWidth=this.inputMinWidth),setTimeout(()=>{this.collapsible.maxHeight=parseInt(this.collapsibleMaxHeight===void 0?getComputedStyle(this).getPropertyValue(`--rokit-list-max-height-inner`):this.collapsibleMaxHeight),this.collapsible.content.style.width=this.collapsibleWidth,this.collapsible.content.style.left=this.collapsibleOrientationLeft,this.collapsible.content.style.right=this.collapsibleOrientationRight}),this.collapsible.updateComplete.then(()=>this.#m()),this.syncInputAccessibilityState()}updated(e){e.has(`value`)&&this.value!==(this.selectedItem?this.itemValue(this.selectedItem):``)&&(this.selectedItem=this.findItem(this.value),this.syncSelectionState(String(e.get(`value`)??``),!1),this.filter(``)),e.has(`disabled`)&&(this.input.disabled=this.disabled,this.collapsible.disabled=this.disabled||this.fixedOpen),e.has(`supportingText`)&&(this.input.supportingText=this.supportingText),e.has(`filterableThreshold`)&&this.applyFilterability(),this.collapsible?.toggleButton&&(this.collapsible.toggleButton.style.display=this.listContainer.childElementCount===0?`none`:``),e.has(`fixedOpen`)&&(this.collapsible.open=this.fixedOpen,this.collapsible.disabled=this.fixedOpen,this.#m()),e.has(`label`)&&(this.input.label=this.label),e.has(`placeholder`)&&(this.input.placeholder=this.placeholder===void 0?`Type to filter list...`:this.placeholder),this.syncInputAccessibilityState()}checkInputValue(e=!0){let t=this.input.value.trim();if(t){if(this.selectedItem&&(this.itemText(this.selectedItem)===t||this.itemValue(this.selectedItem)===t))return;let e=this.findItem(t);if(e){this.selectItem(e);return}}e&&(t===``?(this.#e=``,this.selectItem(null,!1)):this.restoreSelection())}filter(e){e=e.toLowerCase();let t=!1;for(let n of this.listContainer.querySelectorAll(`li`))if(n.id!==`noresult`){let r=e!==``&&this.itemText(n).toLowerCase().indexOf(e)===-1&&(!n.dataset.value||n.dataset.value.toLowerCase().indexOf(e)===-1);n.classList.toggle(`hidden`,r),this.collapse&&(n.classList.remove(`open`),n.querySelector(`ul`)?.classList.remove(`open`)),r||(t=!0)}for(let n of this.visibleItems())for(let r=n.parentElement?.closest(`li`);r;r=r.parentElement?.closest(`li`))r.classList.remove(`hidden`),t=!0,e&&this.collapse&&(r.classList.add(`open`),r.querySelector(`:scope > ul`)?.classList.add(`open`));this.listContainer.querySelector(`#noresult`)?.classList.toggle(`hidden`,t),this.highlightItem(e?this.visibleItems()[0]??null:this.selectedItem??null,!1)}selectItem(e,t=!0,n=!1){this.isSelectableItem(e)||(e=null);let r=this.value;this.selectedItem=e,this.value=e?this.itemValue(e):``,this.syncSelectionState(r),this.filter(``),this.highlightItem(e,!1),t&&(this.#e=this.value),n&&(this.#r=!0,this.closeList(!1),window.setTimeout(()=>{this.fixedOpen||(this.collapsible?.toggle(!1),this.syncInputAccessibilityState()),this.#r=!1}))}findItem(e){let t=null;if(e){for(let n of this.listContainer.querySelectorAll(`li`))if(this.isSelectableItem(n)){if(n.dataset.value===e)return n;this.itemText(n)===e&&(t=n)}}return t}highlightItem(e,t=!0){if(this.listContainer.querySelector(`li.active`)?.classList.remove(`active`),e&&this.isSelectableItem(e)&&!e.classList.contains(`hidden`)){if(t&&this.listContainer.focus(),e.classList.add(`active`),this.listContainer.setAttribute(`aria-activedescendant`,e.id),this.collapse)for(let t=e.closest(`ul`);t;t=t.parentElement.closest(`ul`))t.classList.add(`open`),t.closest(`li`)?.classList.add(`open`);this.collapsible.open&&e.scrollIntoView({block:`nearest`});return}this.listContainer.removeAttribute(`aria-activedescendant`)}highlightNextItem(){let e=this.visibleItems(),t=this.activeItem();if(!e.length){this.highlightItem(null);return}if(!t){this.highlightItem(e[0]);return}let n=e.indexOf(t);this.highlightItem(e[Math.min(e.length-1,n+1)]||e[0])}highlightPreviousItem(e=!1){let t=this.visibleItems(),n=this.activeItem();if(!t.length){this.highlightItem(null);return}if(!n){this.highlightItem(e?t[t.length-1]:t[0]);return}let r=t.indexOf(n);this.highlightItem(t[Math.max(0,r-1)]||t[0])}highlightFirstItem(){this.highlightItem(this.visibleItems()[0]||null)}highlightLastItem(){let e=this.visibleItems();this.highlightItem(e[e.length-1]??null)}itemValue(e){return e.dataset.value||this.itemText(e)||``}itemText(e){return e.querySelector(`div > div`)?.innerText||``}elementText(e){let t=``;for(let n of e.childNodes)n.nodeType==3&&(t+=n.nodeValue?.trim());return t}onSlotChange(){this.listContainer.replaceChildren(),this.itemCount=0,this.#n=0;let e=null,t=this.shadowRoot.querySelector(`#list-container-slot`).assignedElements();if(t?.length===1&&(e=Array.prototype.slice.call(t[0].querySelectorAll(`:scope > li`)),this.copyItems(e,this.listContainer),this.#s.disconnect(),this.#s.observe(t[0],{subtree:!0,childList:!0,characterData:!0,attributes:!0})),this.emptyMessage){let t=document.createElement(`li`);t.id=`noresult`,t.setAttribute(`disabled`,``),t.innerText=this.emptyMessage,this.listContainer.appendChild(t),e&&e.length>0&&t.classList.add(`hidden`)}this.value=this.value||this.#e,this.selectItem(this.findItem(this.value)),this.applyFilterability()}copyItems(e,t,n=0){if(this.sort!==void 0){let t=this.sort||`asc`;e=e.sort((e,n)=>t===`desc`?(this.elementText(n)||this.itemValue(n)).localeCompare(this.elementText(e)||this.itemValue(e)):(this.elementText(e)||this.itemValue(e)).localeCompare(this.elementText(n)||this.itemValue(n)))}let r=``;n>0&&(r=`calc(0.3em + ${n}*${this.#t})`);for(let i of e){let e=i.cloneNode();e.replaceChildren(),e.id=i.id||`${this.id||`rokit-select`}-option-${this.#n++}`;let a=document.createElement(`div`);r&&(a.style.paddingLeft=r);let o=document.createElement(`div`);a.appendChild(o);for(let e of i.childNodes)if(e.nodeName!==`UL`){let t=e.cloneNode(!0);t.nodeType===3&&t.nodeValue&&(t.nodeValue=t.nodeValue.trim()),o.appendChild(t)}e.appendChild(a),e.title=e.title||this.itemText(e),e.setAttribute(`role`,i.classList.contains(`divider`)||i.classList.contains(`header`)?`presentation`:`option`),e.setAttribute(`aria-disabled`,String(i.getAttribute(`disabled`)!==null));let s=i.querySelector(`ul`);if(s?.childElementCount){let t=document.createElement(`ul`);if(t.setAttribute(`role`,`group`),e.appendChild(t),this.copyItems(Array.prototype.slice.call(s.children),t,n+1),this.collapse){let t=new ra;t.dense=!0,t.icon=!0,t.classList.add(`toggle-node`,`caret`),t.title=`Toggle nested options`,t.addEventListener(`mousedown`,e=>{e.preventDefault(),e.stopPropagation()}),t.addEventListener(`click`,t=>{t.stopPropagation(),this.toggleNestedList(e)}),a.prepend(t)}else t.classList.add(`open`)}t.appendChild(e),this.itemCount++}}activeItem(){return this.listContainer.querySelector(`li.active`)}visibleItems(){return Array.from(this.listContainer.querySelectorAll(`ul.open > li:not(.hidden)`)).filter(e=>this.isSelectableItem(e))}isSelectableItem(e){return!!e&&e.id!==`noresult`&&e.getAttribute(`disabled`)===null&&!e.classList.contains(`divider`)&&!e.classList.contains(`header`)}restoreSelection(){let e=this.selectedItem||this.findItem(this.#e);this.selectItem(e,!1)}openList(e=!this.input?.value){this.disabled||this.fixedOpen||(this.collapsible?.toggle(!0),this.collapsible.updateComplete.then(()=>{this.collapsible.open&&this.#h()}),e&&this.highlightItem(this.selectedItem??null,!1),this.syncInputAccessibilityState())}closeList(e=!0,t=!1){this.fixedOpen||(e&&this.checkInputValue(),this.filter(``),t&&this.collapsible.content.matches(`:popover-open`)?(this.collapsible.toggle(!1),this.#a=window.setTimeout(()=>{this.#a=void 0,this.#g()},this.collapsible.transitionDuration)):(this.#g(),this.collapsible?.toggle(!1)),this.syncInputAccessibilityState())}inputShouldBeReadonly(){return this.filterableThreshold<0||this.itemCount<this.filterableThreshold}applyFilterability(){let e=this.inputShouldBeReadonly();this.input.readonly=e,this.collapsible.headerInactive=!e}toggleNestedList(e,t=!e.classList.contains(`open`)){e.classList.toggle(`open`,t),e.querySelector(`:scope > ul`)?.classList.toggle(`open`,t),this.collapsible.updateContentHeight(),this.highlightItem(e,!1)}syncInputAccessibilityState(){this.input?.inputElement&&(this.input.inputElement.setAttribute(`role`,`combobox`),this.input.inputElement.setAttribute(`aria-expanded`,String(this.fixedOpen||this.collapsible?.open)),this.input.inputElement.setAttribute(`aria-controls`,`list-container`),this.input.inputElement.setAttribute(`aria-autocomplete`,this.input.readonly?`none`:`list`),this.listContainer?.setAttribute(`role`,`listbox`))}syncSelectionAccessibilityState(){for(let e of this.listContainer.querySelectorAll(`li[role="option"]`))e.setAttribute(`aria-selected`,String(e===this.selectedItem))}syncSelectionState(e,t=e!==this.value){this.input.value=this.selectedItem?this.itemText(this.selectedItem):this.value,this.title||(this.input.title=this.input.value),this.classList.toggle(`has-value`,this.value!==``),this.setFormValue(this.value),this.required&&this.value===``?this.updateValidity({valueMissing:!0},`Please select a value`,this.listContainer):this.updateValidity(),t&&this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0})),this.syncSelectionAccessibilityState()}render(){return Oi`
|
|
334
|
+
`]}#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;constructor(){super(),this.emptyMessage=`Nothing to select`,this.collapsibleOrientationLeft=`0`,this.collapsibleOrientationRight=`0`,this.collapsibleWidth=``,this.autoGrowLabelWidth=!1,this.fixedOpen=!1,this.collapse=!1,this.filterableThreshold=15,this.itemCount=0,this.selectedItem=null,this.#e=``,this.#t=``,this.#n=0,this.#r=!1,this.#i=!1,this.#o=()=>{let e=this.collapsible?.content;if(!e?.matches(`:popover-open`))return;let t=this.getBoundingClientRect(),n=document.documentElement.clientWidth,r=document.documentElement.clientHeight,i=this.collapsibleWidth||`${t.width}px`;this.style.setProperty(`--rokit-select-overlay-width`,i);let a=e.getBoundingClientRect().width,o=e.offsetWidth-e.clientWidth,s=Math.min(n-16,Math.max(a,this.listContainer.scrollWidth+o));this.style.setProperty(`--rokit-select-overlay-width`,`${s}px`);let c=Math.max(8,Math.min(t.left,n-s-8));this.style.setProperty(`--rokit-select-overlay-left`,`${c}px`),this.style.setProperty(`--rokit-select-overlay-right`,`auto`);let l=Math.max(0,Math.min(s,t.left-c)),u=Math.max(l,Math.min(s,t.right-c)),d=`polygon(-13px -13px, ${l}px -13px, ${l}px 0, ${u}px 0, ${u}px -13px, calc(100% + 13px) -13px, calc(100% + 13px) calc(100% + 13px), -13px calc(100% + 13px))`,f=`polygon(-13px -13px, calc(100% + 13px) -13px, calc(100% + 13px) calc(100% + 13px), ${u}px calc(100% + 13px), ${u}px 100%, ${l}px 100%, ${l}px calc(100% + 13px), -13px calc(100% + 13px))`,p=this.collapsible.maxHeight??e.scrollHeight,m=Math.min(p,e.scrollHeight),h=Math.max(0,r-t.bottom-2),g=Math.max(0,t.top-2);h<m&&g>h?(this.style.setProperty(`--rokit-select-overlay-shadow-clip`,f),this.style.setProperty(`--rokit-select-overlay-top`,`auto`),this.style.setProperty(`--rokit-select-overlay-bottom`,`${r-t.top+2}px`),this.style.setProperty(`--rokit-select-overlay-max-height`,`${Math.min(p,g)}px`)):(this.style.setProperty(`--rokit-select-overlay-shadow-clip`,d),this.style.setProperty(`--rokit-select-overlay-top`,`${t.bottom+2}px`),this.style.setProperty(`--rokit-select-overlay-bottom`,`auto`),this.style.setProperty(`--rokit-select-overlay-max-height`,`${Math.min(p,h)}px`))},this.#s=new MutationObserver(()=>this.onSlotChange()),this.#c=()=>{this.#r||this.openList()},this.#l=e=>{let t=e.relatedTarget;t&&(this.contains(t)||this.shadowRoot?.contains(t))||(this.checkInputValue(),this.closeList(!1,!0))},this.#u=()=>{this.#r||this.openList(!1)},this.#d=e=>{!this.clearable||!this.input.readonly||e.composedPath().find(e=>e instanceof ra&&e.classList.contains(`clear`))&&(this.input.inputElement.focus(),this.selectItem(null))},this.#f=e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),this.openList(),this.highlightNextItem();break;case`ArrowUp`:e.preventDefault(),this.openList(),this.highlightPreviousItem(!0);break;case`Enter`:{let t=this.activeItem();if(t){e.preventDefault(),this.selectItem(t,!0,!0);break}let n=this.findItem(this.input.value);n?(e.preventDefault(),this.selectItem(n,!0,!0)):this.checkInputValue();break}case`Escape`:this.collapsible.open&&(e.preventDefault(),this.restoreSelection(),this.closeList(!1));break;case`Tab`:this.checkInputValue(),this.closeList(!1);break}},this.#p=e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),this.highlightNextItem();break;case`ArrowUp`:e.preventDefault(),this.highlightPreviousItem();break;case`Home`:e.preventDefault(),this.highlightFirstItem();break;case`End`:e.preventDefault(),this.highlightLastItem();break;case`Enter`:{e.preventDefault();let t=this.activeItem();t&&this.selectItem(t,!0,!0);break}case`ArrowRight`:if(this.collapse){let t=this.activeItem();t&&(e.preventDefault(),this.toggleNestedList(t,!0))}break;case`ArrowLeft`:if(this.collapse){let t=this.activeItem();t&&(e.preventDefault(),this.toggleNestedList(t,!1))}break;case`Escape`:e.preventDefault(),this.restoreSelection(),this.closeList(!1),this.input.inputElement.focus();break;case`Tab`:this.checkInputValue(),this.closeList(!1);break}},this.addEventListener(`focusin`,this.#c),this.addEventListener(`focusout`,this.#l),this.addEventListener(`input`,this.#u)}disconnectedCallback(){this.#g(),this.#s.disconnect(),this.input?.removeEventListener(`click`,this.#d,!0),this.removeEventListener(`focusin`,this.#c),this.removeEventListener(`focusout`,this.#l),this.removeEventListener(`input`,this.#u),super.disconnectedCallback()}#m(){let e=this.collapsible?.content;e&&(this.fixedOpen?(this.#g(),e.removeAttribute(`popover`),this.listContainer.hidden=!1):(e.setAttribute(`popover`,`manual`),e.matches(`:popover-open`)||(this.listContainer.hidden=!0)))}#h(){let e=this.collapsible.content;this.fixedOpen||!this.isConnected||!e.hasAttribute(`popover`)||(this.#a!==void 0&&(window.clearTimeout(this.#a),this.#a=void 0),this.listContainer.hidden=!1,this.style.setProperty(`--rokit-select-overlay-visibility`,`visible`),e.matches(`:popover-open`)||e.showPopover(),this.#o(),this.#i||=(window.addEventListener(`resize`,this.#o),window.addEventListener(`scroll`,this.#o,!0),!0))}#g(){this.#a!==void 0&&(window.clearTimeout(this.#a),this.#a=void 0);let e=this.collapsible?.content;this.listContainer&&(this.listContainer.hidden=!0),this.style.setProperty(`--rokit-select-overlay-visibility`,`hidden`),e?.matches(`:popover-open`)&&e.hidePopover();for(let e of[`--rokit-select-overlay-top`,`--rokit-select-overlay-right`,`--rokit-select-overlay-bottom`,`--rokit-select-overlay-left`,`--rokit-select-overlay-width`,`--rokit-select-overlay-max-height`,`--rokit-select-overlay-shadow-clip`])this.style.removeProperty(e);this.#i&&=(window.removeEventListener(`resize`,this.#o),window.removeEventListener(`scroll`,this.#o,!0),!1)}firstUpdated(){this.#e=this.value,this.#t=getComputedStyle(this).getPropertyValue(`--rokit-list-indent-inner`),this.input.addEventListener(`click`,this.#d,!0),this.input.placeholder=this.placeholder===void 0?`Type to filter list...`:this.placeholder,this.input.label=this.label,this.inputMinWidth!==void 0&&(this.input.minWidth=this.inputMinWidth),setTimeout(()=>{this.collapsible.maxHeight=parseInt(this.collapsibleMaxHeight===void 0?getComputedStyle(this).getPropertyValue(`--rokit-list-max-height-inner`):this.collapsibleMaxHeight),this.collapsible.content.style.width=this.collapsibleWidth,this.collapsible.content.style.left=this.collapsibleOrientationLeft,this.collapsible.content.style.right=this.collapsibleOrientationRight}),this.collapsible.updateComplete.then(()=>this.#m()),this.syncInputAccessibilityState()}updated(e){e.has(`value`)&&this.value!==(this.selectedItem?this.itemValue(this.selectedItem):``)&&(this.selectedItem=this.findItem(this.value),this.syncSelectionState(String(e.get(`value`)??``),!1),this.filter(``)),e.has(`disabled`)&&(this.input.disabled=this.disabled,this.collapsible.disabled=this.disabled||this.fixedOpen),e.has(`supportingText`)&&(this.input.supportingText=this.supportingText),e.has(`filterableThreshold`)&&this.applyFilterability(),this.collapsible?.toggleButton&&(this.collapsible.toggleButton.style.display=this.listContainer.childElementCount===0?`none`:``),e.has(`fixedOpen`)&&(this.collapsible.open=this.fixedOpen,this.collapsible.disabled=this.fixedOpen,this.#m()),e.has(`label`)&&(this.input.label=this.label),e.has(`placeholder`)&&(this.input.placeholder=this.placeholder===void 0?`Type to filter list...`:this.placeholder),this.syncInputAccessibilityState()}checkInputValue(e=!0){let t=this.input.value.trim();if(t){if(this.selectedItem&&(this.itemText(this.selectedItem)===t||this.itemValue(this.selectedItem)===t))return;let e=this.findItem(t);if(e){this.selectItem(e);return}}e&&(t===``?(this.#e=``,this.selectItem(null,!1)):this.restoreSelection())}filter(e){e=e.toLowerCase();let t=!1;for(let n of this.listContainer.querySelectorAll(`li`))if(n.id!==`noresult`){let r=e!==``&&this.itemText(n).toLowerCase().indexOf(e)===-1&&(!n.dataset.value||n.dataset.value.toLowerCase().indexOf(e)===-1);n.classList.toggle(`hidden`,r),this.collapse&&(n.classList.remove(`open`),n.querySelector(`ul`)?.classList.remove(`open`)),r||(t=!0)}for(let n of this.visibleItems())for(let r=n.parentElement?.closest(`li`);r;r=r.parentElement?.closest(`li`))r.classList.remove(`hidden`),t=!0,e&&this.collapse&&(r.classList.add(`open`),r.querySelector(`:scope > ul`)?.classList.add(`open`));this.listContainer.querySelector(`#noresult`)?.classList.toggle(`hidden`,t),this.highlightItem(e?this.visibleItems()[0]??null:this.selectedItem??null,!1)}selectItem(e,t=!0,n=!1){this.isSelectableItem(e)||(e=null);let r=this.value;this.selectedItem=e,this.value=e?this.itemValue(e):``,this.syncSelectionState(r),this.filter(``),this.highlightItem(e,!1),t&&(this.#e=this.value),n&&(this.#r=!0,this.closeList(!1),window.setTimeout(()=>{this.fixedOpen||(this.collapsible?.toggle(!1),this.syncInputAccessibilityState()),this.#r=!1}))}findItem(e){let t=null;if(e){for(let n of this.listContainer.querySelectorAll(`li`))if(this.isSelectableItem(n)){if(n.dataset.value===e)return n;this.itemText(n)===e&&(t=n)}}return t}highlightItem(e,t=!0){if(this.listContainer.querySelector(`li.active`)?.classList.remove(`active`),e&&this.isSelectableItem(e)&&!e.classList.contains(`hidden`)){if(t&&this.listContainer.focus(),e.classList.add(`active`),this.listContainer.setAttribute(`aria-activedescendant`,e.id),this.collapse)for(let t=e.closest(`ul`);t;t=t.parentElement.closest(`ul`))t.classList.add(`open`),t.closest(`li`)?.classList.add(`open`);this.collapsible.open&&e.scrollIntoView({block:`nearest`});return}this.listContainer.removeAttribute(`aria-activedescendant`)}highlightNextItem(){let e=this.visibleItems(),t=this.activeItem();if(!e.length){this.highlightItem(null);return}if(!t){this.highlightItem(e[0]);return}let n=e.indexOf(t);this.highlightItem(e[Math.min(e.length-1,n+1)]||e[0])}highlightPreviousItem(e=!1){let t=this.visibleItems(),n=this.activeItem();if(!t.length){this.highlightItem(null);return}if(!n){this.highlightItem(e?t[t.length-1]:t[0]);return}let r=t.indexOf(n);this.highlightItem(t[Math.max(0,r-1)]||t[0])}highlightFirstItem(){this.highlightItem(this.visibleItems()[0]||null)}highlightLastItem(){let e=this.visibleItems();this.highlightItem(e[e.length-1]??null)}itemValue(e){return e.dataset.value||this.itemText(e)||``}itemText(e){return e.querySelector(`div > div`)?.innerText||``}elementText(e){let t=``;for(let n of e.childNodes)n.nodeType==3&&(t+=n.nodeValue?.trim());return t}onSlotChange(){this.listContainer.replaceChildren(),this.itemCount=0,this.#n=0;let e=null,t=this.shadowRoot.querySelector(`#list-container-slot`).assignedElements();if(t?.length===1&&(e=Array.prototype.slice.call(t[0].querySelectorAll(`:scope > li`)),this.copyItems(e,this.listContainer),this.#s.disconnect(),this.#s.observe(t[0],{subtree:!0,childList:!0,characterData:!0,attributes:!0})),this.emptyMessage){let t=document.createElement(`li`);t.id=`noresult`,t.setAttribute(`disabled`,``),t.innerText=this.emptyMessage,this.listContainer.appendChild(t),e&&e.length>0&&t.classList.add(`hidden`)}this.value=this.value||this.#e,this.selectItem(this.findItem(this.value)),this.applyFilterability()}copyItems(e,t,n=0){if(this.sort!==void 0){let t=this.sort||`asc`;e=e.sort((e,n)=>t===`desc`?(this.elementText(n)||this.itemValue(n)).localeCompare(this.elementText(e)||this.itemValue(e)):(this.elementText(e)||this.itemValue(e)).localeCompare(this.elementText(n)||this.itemValue(n)))}let r=``;n>0&&(r=`calc(0.3em + ${n}*${this.#t})`);for(let i of e){let e=i.cloneNode();e.replaceChildren(),e.id=i.id||`${this.id||`rokit-select`}-option-${this.#n++}`;let a=document.createElement(`div`);r&&(a.style.paddingLeft=r);let o=document.createElement(`div`);a.appendChild(o);for(let e of i.childNodes)if(e.nodeName!==`UL`){let t=e.cloneNode(!0);t.nodeType===3&&t.nodeValue&&(t.nodeValue=t.nodeValue.trim()),o.appendChild(t)}e.appendChild(a),e.title=e.title||this.itemText(e),e.setAttribute(`role`,i.classList.contains(`divider`)||i.classList.contains(`header`)?`presentation`:`option`),e.setAttribute(`aria-disabled`,String(i.getAttribute(`disabled`)!==null));let s=i.querySelector(`ul`);if(s?.childElementCount){let t=document.createElement(`ul`);if(t.setAttribute(`role`,`group`),e.appendChild(t),this.copyItems(Array.prototype.slice.call(s.children),t,n+1),this.collapse){let t=new ra;t.dense=!0,t.icon=!0,t.classList.add(`toggle-node`,`caret`),t.title=`Toggle nested options`,t.addEventListener(`mousedown`,e=>{e.preventDefault(),e.stopPropagation()}),t.addEventListener(`click`,t=>{t.stopPropagation(),this.toggleNestedList(e)}),a.prepend(t)}else t.classList.add(`open`)}t.appendChild(e),this.itemCount++}}activeItem(){return this.listContainer.querySelector(`li.active`)}visibleItems(){return Array.from(this.listContainer.querySelectorAll(`ul.open > li:not(.hidden)`)).filter(e=>this.isSelectableItem(e))}isSelectableItem(e){return!!e&&e.id!==`noresult`&&e.getAttribute(`disabled`)===null&&!e.classList.contains(`divider`)&&!e.classList.contains(`header`)}restoreSelection(){let e=this.selectedItem||this.findItem(this.#e);this.selectItem(e,!1)}openList(e=!this.input?.value){this.disabled||this.fixedOpen||(this.collapsible?.toggle(!0),this.collapsible.updateComplete.then(()=>{this.collapsible.open&&this.#h()}),e&&this.highlightItem(this.selectedItem??null,!1),this.syncInputAccessibilityState())}closeList(e=!0,t=!1){this.fixedOpen||(e&&this.checkInputValue(),this.filter(``),t&&this.collapsible.content.matches(`:popover-open`)?(this.collapsible.toggle(!1),this.#a=window.setTimeout(()=>{this.#a=void 0,this.#g()},this.collapsible.transitionDuration)):(this.#g(),this.collapsible?.toggle(!1)),this.syncInputAccessibilityState())}inputShouldBeReadonly(){return this.filterableThreshold<0||this.itemCount<this.filterableThreshold}applyFilterability(){let e=this.inputShouldBeReadonly();this.input.readonly=e,this.collapsible.headerInactive=!e}toggleNestedList(e,t=!e.classList.contains(`open`)){e.classList.toggle(`open`,t),e.querySelector(`:scope > ul`)?.classList.toggle(`open`,t),this.collapsible.updateContentHeight(),this.highlightItem(e,!1)}syncInputAccessibilityState(){this.input?.inputElement&&(this.input.inputElement.setAttribute(`role`,`combobox`),this.input.inputElement.setAttribute(`aria-expanded`,String(this.fixedOpen||this.collapsible?.open)),this.input.inputElement.setAttribute(`aria-controls`,`list-container`),this.input.inputElement.setAttribute(`aria-autocomplete`,this.input.readonly?`none`:`list`),this.listContainer?.setAttribute(`role`,`listbox`))}syncSelectionAccessibilityState(){for(let e of this.listContainer.querySelectorAll(`li[role="option"]`))e.setAttribute(`aria-selected`,String(e===this.selectedItem))}syncSelectionState(e,t=e!==this.value){this.input.value=this.selectedItem?this.itemText(this.selectedItem):this.value,this.title||(this.input.title=this.input.value),this.classList.toggle(`has-value`,this.value!==``),this.setFormValue(this.value),this.required&&this.value===``?this.updateValidity({valueMissing:!0},`Please select a value`,this.listContainer):this.updateValidity(),t&&this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0})),this.syncSelectionAccessibilityState()}render(){return Oi`
|
|
335
335
|
<rokit-collapsible ?dense="${this.dense}" part="collapsible" ?headerInactive="${!this.inputShouldBeReadonly()}">
|
|
336
336
|
<slot name="prefix" part="prefix" slot="prefix"></slot>
|
|
337
337
|
<slot name="suffix" part="suffix loader" slot="suffix"></slot>
|
|
@@ -498,4 +498,4 @@ rokit-select::part(facet-count)::after { content: attr(data-count); color: var(-
|
|
|
498
498
|
@keydown="${this.onKeyDown}">
|
|
499
499
|
</div>
|
|
500
500
|
<div><slot name="pane2"></slot></div>
|
|
501
|
-
`}};Z([X()],va.prototype,`pos`,void 0),Z([X()],va.prototype,`minPos`,void 0),Z([X()],va.prototype,`maxPos`,void 0),Z([X({reflect:!0})],va.prototype,`dir`,void 0),Z([X()],va.prototype,`sep`,void 0),Z([X({reflect:!0,type:Boolean})],va.prototype,`dragging`,void 0),Z([X()],va.prototype,`storageKey`,void 0),Z([$i(`#separator`)],va.prototype,`separator`,void 0),va=Z([Ji(`rokit-splitpane`)],va);function ya(e){let t=new Set;for(let n of e.getQuads(null,gt,null,pt))n.subject.termType===`NamedNode`&&t.add(n.subject.value);if(t.size===1)return t.values().next().value}function ba(e,t){let n=k.namedNode(t);for(let t of e.getObjects(n,gt,pt))if(t.termType===`NamedNode`&&e.getQuads(t,mt,xt,null).length>0)return t}async function xa(e){let t={store:new nt,importedUrls:[],atts:e},n=[];if(e.shapes?n.push(Sa(sr({rdf:e.shapes}),t,ft)):e.shapesUrl&&n.push(Sa(sr({url:e.shapesUrl,proxy:t.atts.proxy,rdfUrlResolver:t.atts.rdfUrlResolver}),t,ft)),e.values?n.push(Sa(sr({rdf:e.values}),t,pt)):e.valuesUrl&&n.push(Sa(sr({url:e.valuesUrl,proxy:t.atts.proxy,rdfUrlResolver:t.atts.rdfUrlResolver}),t,pt)),await Promise.all(n),e.classInstanceProvider)try{let n=Zt(t.store),r=await e.classInstanceProvider(n);r&&await Sa(sr({rdf:r}),t,ft)}catch(e){console.error(`failed loading class instances`,e)}if(e.valuesSubject||=ya(t.store)||null,e.valuesSubject&&t.store.countQuads(null,null,null,ft)===0){let n=[...t.store.getObjects(e.valuesSubject,mt,pt),...t.store.getObjects(e.valuesSubject,gt,pt)],r=[];for(let e of n){let n=Ca(e.value);!n&&e.value.startsWith(`urn:`)&&t.atts.proxy&&(n=e.value),n&&t.importedUrls.indexOf(n)<0&&(t.importedUrls.push(n),r.push(Sa(sr({url:n,proxy:t.atts.proxy,rdfUrlResolver:t.atts.rdfUrlResolver}),t,ft)))}try{await Promise.allSettled(r)}catch(e){console.warn(e)}}return t.store}async function Sa(e,t,n){let r=await e,i=[];for(let e of r){let r=n;if(t.atts.valuesSubject&&pt.equals(n)&&e.graph.id&&e.graph.id!==t.atts.valuesSubject&&(r=e.graph),t.store.add(k.quad(e.subject,e.predicate,e.object,r)),t.atts.loadOwlImports&&vt.equals(e.predicate)){let n=Ca(e.object.value);n&&t.importedUrls.indexOf(n)<0&&(t.importedUrls.push(n),i.push(Sa(sr({url:n,proxy:t.atts.proxy,rdfUrlResolver:t.atts.rdfUrlResolver}),t,k.namedNode(n))))}}await Promise.allSettled(i)}function Ca(e){if(Vt(e))return e;let t=e.split(`:`);if(t.length===2){let n=or[t[0]];if(n&&(e=e.replace(`${t[0]}:`,n),Vt(e)))return e}return null}async function wa(e){if(e.template.nodeShapes.size===0)return;let t=e.template.config.resourceLinkProvider;if((!t||t&&!t.lazyLoad)&&(await Oa(e.template),Ea(e).length===0))return;let n=e.template.config.theme.createButton(e.template.label,!1);n.title=`Link existing `+e.template.label,n.classList.add(`link-button`),n.setAttribute(`text`,``);let r=n.getAttribute(`part`);return n.setAttribute(`part`,`${r?r+` `:``}link-button`),n.addEventListener(`click`,async()=>{t?.lazyLoad&&(n.classList.add(`loading`),await Oa(e.template),n.classList.remove(`loading`));let r=Ea(e);if(r.length===0)n.innerText=`No linkable resources found`,n.setAttribute(`disabled`,``),setTimeout(()=>n.remove(),2e3);else{let t=e.template.config.form.querySelector(`#dialog`);t||(t=new ua,t.classList.add(`link-chooser`),t.closable=!0,e.template.config.form.appendChild(t)),t.title=`Link existing `+e.template.label,Ta(t,e,r),t.open=!0}}),n}function Ta(e,t,n){let r=document.createElement(`div`);for(let i of n){let n=document.createElement(`div`);n.classList.add(`link-option`),n.title=`Link this resource`,n.innerText=i.label||i.value,n.addEventListener(`click`,()=>{Da(i.value,t),e.open=!1}),r.appendChild(n)}e.replaceChildren(r)}function Ea(e){let t=[];if(e.template.config.resourceLinkProvider){for(let n of e.template.nodeShapes)if(e.template.config.providedConformingResourceIds[n.id.value])for(let r of e.template.config.providedConformingResourceIds[n.id.value])e.querySelector(`:scope > .property-instance > shacl-node[data-node-id='${r}'], :scope > .collapsible > .property-instance > shacl-node[data-node-id='${r}']`)===null&&t.push({value:r,label:e.template.config.providedResourceLabels[r]||It(e.template.config.store.getQuads(k.namedNode(r),null,null,null),e.template.config.languages),children:[]})}return t}async function Da(e,t){let n=k.namedNode(e);if(t.template.config.providedResources[e]?.length>0){let n={store:t.template.config.store,importedUrls:[],atts:{loadOwlImports:!1}};await Sa(sr({rdf:t.template.config.providedResources[e]}),n,ft),t.template.config.providedResources[e]=``}let r=await Fa(t.template,n,!0,!0);t.container.insertBefore(r,t.querySelector(`:scope > .add-button-wrapper`)),await t.updateControls()}async function Oa(e){let t=e.config.resourceLinkProvider;if(!t)return;let n=new Set(Array.from(e.nodeShapes).map(e=>e.id.value));if(n.size===0)return;let r=Qt(Object.keys(e.config.providedConformingResourceIds),n);if(r.length!==0)try{let n=await t.listConformingResources(r,e);if(n){for(let t of Object.keys(n)){let r=new Set(n[t]);e.config.providedConformingResourceIds[t]=r,await ka(r,!1,e.config)}for(let t of r)e.config.providedConformingResourceIds[t]||(e.config.providedConformingResourceIds[t]=new Set)}}catch(e){console.error(`failed loading conforming resources`,e)}}async function ka(e,t,n){if(n.resourceLinkProvider&&e.size>0){let r=[];for(let t of e)n.providedResources[t]||r.push(t);if(r.length===0)return[];try{let e=await n.resourceLinkProvider.loadResources(r);if(e){let r={store:n.store,importedUrls:[],atts:{loadOwlImports:!1}};for(let i of e){n.providedResources[i.resourceId]=i.resourceRDF;let e=await sr({rdf:i.resourceRDF});n.providedResourceLabels[i.resourceId]=It(e.filter(e=>e.subject.value===i.resourceId),n.languages),t&&await Sa(Promise.resolve(e),r,ft)}return e}for(let e of r)n.providedResources[e]||(n.providedResources[e]=``)}catch(e){console.error(`failed loading resources`,e)}}return[]}async function Aa(e){let t=new Set;for(let n of e.store.getQuads(null,null,null,pt))ja(n.object,e.store)&&t.add(n.object.value);await ka(t,!0,e)}function ja(e,t){return e.termType===`NamedNode`&&t.countQuads(e,null,null,null)===0}var Ma=`:scope > .add-button-wrapper, :scope > .collapsible > .add-button-wrapper`,Na=`:scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node, :scope > .collapsible > .property-instance`,Pa=class extends HTMLElement{constructor(e,t){if(super(),this.template=e,this.parent=t,this.container=this,this.setAttribute(`part`,`property`),this.template.nodeShapes.size&&this.template.config.attributes.collapse!==null&&(this.template.maxCount===void 0||this.template.maxCount>1)){let t=new ia;t.classList.add(`collapsible`,`shacl-group`),t.open=e.config.attributes.collapse===`open`,t.label=this.template.label,t.setAttribute(`part`,`collapsible`),this.container=t,this.appendChild(this.container)}this.template.order!==void 0&&(this.style.order=`${this.template.order}`),this.template.cssClass&&this.classList.add(this.template.cssClass),e.config.editMode&&!t.linked&&this.addEventListener(`change`,async()=>{await this.updateControls()})}async bindValues(e,t){if(this.template.path){let n=!1;if(e){let r=this.template.config.store.getQuads(e,this.template.path,null,this.parent.linked?null:pt);t&&(r=await this.filterValidValues(r,e));for(let e of r)this.parent.linked||this.template.config.store.delete(e),await this.addPropertyInstance(e.object,!pt.equals(e.graph)||this.template.config.providedResources[e.object.value]!==void 0,this.template.config.providedResources[e.object.value]!==void 0),this.template.hasValue&&e.object.equals(this.template.hasValue)&&(n=!0)}this.template.config.editMode&&this.template.hasValue&&!n&&!this.parent.linked&&await this.addPropertyInstance(this.template.hasValue)}}async initializeQuery(){let{initializeQueryProperty:e}=await xr(async()=>{let{initializeQueryProperty:e}=await import(`./mode-f6xgDLiM.js`);return{initializeQueryProperty:e}},[]);await e(this)}async addPropertyInstance(e,t,n=!1){let r;if(this.template.or?.length||this.template.xone?.length){let t=this.template.or?.length?this.template.or:this.template.xone,n=!1;if(e){let i=Cr(t,e,this.template.config);i.length&&(r=await Fa(gr(hr(this.template),i),e,!this.parent.linked,this.parent.linked,this.parent),n=!0)}!n&&this.template.config.editMode&&(r=Sr(t,this,this.template.config),Ia(r,``,this.template.config.theme.dense,this.template.config.hierarchyColorsStyleSheet!==void 0))}else r=await Fa(this.template,e,n,t||this.parent.linked,this.parent);return r&&this.container.insertBefore(r,this.querySelector(Ma)),r}async updateControls(){this.template.config.editMode&&!this.parent.linked&&!this.querySelector(Ma)&&this.container.appendChild(await this.createAddControls());let e=pr(this.template),t=this.template.nodeShapes.size===0,n=this.querySelector(`:scope > .add-button-wrapper > .link-button, :scope > .collapsible > .add-button-wrapper > .link-button`)===null,r=t||!this.hasRecursiveNodeShape(),i=this.instanceCount();i===0&&r&&(t||n&&e>0)&&(await this.addPropertyInstance(),i=1),t||this.querySelector(Ma)?.classList.toggle(`required`,i<e);let a;a=e>0?i>e:!t||i>1;let o=i<mr(this.template);this.classList.toggle(`may-remove`,a),this.classList.toggle(`may-add`,o)}instanceCount(){return this.querySelectorAll(Na).length}hasRecursiveNodeShape(){let e=new Set;this.parent.ancestorShapeIds.forEach(t=>e.add(t)),e.add(this.parent.template.id.value);for(let t of this.template.nodeShapes)if(e.has(t.id.value))return!0;return!1}toRDF(e,t){let n=k.namedNode(this.template.path);for(let r of this.querySelectorAll(`:scope > .property-instance, :scope > .collapsible > .property-instance`))if(r.firstChild instanceof ro){let i=r.firstChild.toRDF(e);e.addQuad(t,n,i,this.template.config.valuesGraphId)}else if(this.template.config.editMode)for(let i of r.querySelectorAll(`:scope > .editor`)){let r=Ar(i);r&&e.addQuad(t,n,r,this.template.config.valuesGraphId)}else{let i=Ar(r);i&&e.addQuad(t,n,i,this.template.config.valuesGraphId)}}async filterValidValues(e,t){let n=this.template.id,r=[t];if(this.template.qualifiedValueShape){n=this.template.qualifiedValueShape.id,r=[];for(let t of e)r.push(t.object)}let i=await this.template.config.validator.validate({dataset:this.template.config.store,terms:r},[{terms:[n]}]),a=new Set;for(let e of i.results){let t=this.template.qualifiedValueShape?e.focusNode:e.value;t?.ptrs?.length&&a.add(t.ptrs[0]._term.id)}return e.filter(e=>!a.has(e.object.id))}async createAddControls(){let e=document.createElement(`div`);e.classList.add(`add-button-wrapper`),e.setAttribute(`part`,`add-controls`);let t=await wa(this);t&&e.appendChild(t);let n=this.template.config.theme.createButton(this.template.label,!1);n.title=`Add `+this.template.label,n.classList.add(`add-button`),n.setAttribute(`text`,``);let r=n.getAttribute(`part`);return n.setAttribute(`part`,`${r?r+` `:``}add-button`),n.addEventListener(`click`,async()=>{let e=await this.addPropertyInstance();e&&(e.classList.add(`fadeIn`),await this.updateControls(),setTimeout(()=>{Ft(e),e.classList.remove(`fadeIn`)},200))}),e.appendChild(n),e}};async function Fa(e,t,n=!1,r=!1,i){let a;if(e.nodeShapes.size){a=document.createElement(`div`),a.classList.add(`property-instance`),a.setAttribute(`part`,`property-instance`);let n=new Set(i?.ancestorShapeIds??[]);i&&n.add(i.template.id.value);for(let i of e.nodeShapes){let o=new ro(i,t,e.nodeKind,e.label,r,n);a.appendChild(o),await o.ready}}else{let n=Fr(e.path,e.datatype?.value);a=n?e.config.editMode&&!r?n.createEditor(e,t):n.createViewer(e,t):Dr(e,t||null,e.config.editMode&&!r),a.childNodes.length>0&&(a.classList.add(`property-instance`),a.setAttribute(`part`,`property-instance`)),r&&a.classList.add(`linked`)}return e.config.editMode&&(!r||n)?Ia(a,e.label,e.config.theme.dense,e.config.hierarchyColorsStyleSheet!==void 0,n):e.config.hierarchyColorsStyleSheet!==void 0&&a.appendChild(La(!0)),t&&!e.config.editMode&&(t instanceof M?(a.dataset.value=t.value,t.language.length>0?a.dataset.lang=t.language:a.shaclDatatype=t.datatype):a.dataset.value=`<`+t.value+`>`),a.dataset.path=e.path,a}function Ia(e,t,n,r,i=!1){let a=La(r),o=new ra;o.classList.add(`remove-button`,`clear`),o.title=`Remove `+t,o.dense=n,o.icon=!0;let s=o.getAttribute(`part`);o.setAttribute(`part`,`${s?s+` `:``}remove-button`),o.addEventListener(`click`,()=>{e.classList.remove(`fadeIn`),e.classList.add(`fadeOut`),setTimeout(()=>{let t=e.parentElement;e.remove(),t?.dispatchEvent(new Event(`change`,{bubbles:!0,cancelable:!0}))},200)}),i&&o.classList.add(`persistent`),a.appendChild(o),e.appendChild(a)}function La(e){let t=document.createElement(`div`);return t.className=`remove-button-wrapper`,t.setAttribute(`part`,`remove-controls`),e&&t.classList.add(`colorize`),t}window.customElements.define(`shacl-property`,Pa);function Ra(e,t){let n=e,r=t.store.getQuads(e,null,null,null),i=Nt(r,`label`,lt,t.languages);i&&(n=i);let a;if(t.attributes.collapse!==null)a=new ia,a.classList.add(`collapsible`),a.open=t.attributes.collapse===`open`,a.label=n,a.setAttribute(`part`,`group collapsible`);else{a=document.createElement(`div`);let e=document.createElement(`h1`);e.innerText=n,e.setAttribute(`part`,`group-title`),a.appendChild(e),a.setAttribute(`part`,`group`)}a.dataset.subject=e,a.classList.add(`shacl-group`);let o=Nt(r,`order`);return o&&(a.style.order=o),a}var za=[];for(let e=0;e<256;++e)za.push((e+256).toString(16).slice(1));function Ba(e,t=0){return(za[e[t+0]]+za[e[t+1]]+za[e[t+2]]+za[e[t+3]]+`-`+za[e[t+4]]+za[e[t+5]]+`-`+za[e[t+6]]+za[e[t+7]]+`-`+za[e[t+8]]+za[e[t+9]]+`-`+za[e[t+10]]+za[e[t+11]]+za[e[t+12]]+za[e[t+13]]+za[e[t+14]]+za[e[t+15]]).toLowerCase()}var Va,Ha=new Uint8Array(16);function Ua(){if(!Va){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);Va=crypto.getRandomValues.bind(crypto)}return Va(Ha)}var Wa={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Ga(e,t,n){e||={};let r=e.random??e.rng?.()??Ua();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return Ba(r)}function Ka(e,t,n){return Wa.randomUUID&&!t&&!e?Wa.randomUUID():Ga(e,t,n)}var qa={[`${J}node`]:(e,t)=>{e.extendedShapes.add(new Ja(t,e.config,e))},[`${J}and`]:(e,t)=>{for(let n of e.config.lists[t.value])e.extendedShapes.add(new Ja(n,e.config,e))},[`${J}property`]:(e,t)=>{let n=e.config.getPropertyTemplate(t,e);if(n.path){let t=e.properties[n.path];if(t||(t=[],e.properties[n.path]=t),n.qualifiedValueShape)t.push(n);else{let r;for(let t=0;t<e.properties[n.path].length&&!r;t++)e.properties[n.path][t].qualifiedValueShape||(r=e.properties[n.path][t]);r?_r(r,n):t.push(n)}}},[`${J}nodeKind`]:(e,t)=>{e.nodeKind=t},[`${J}targetClass`]:(e,t)=>{e.targetClass=t},[`${J}or`]:(e,t)=>{e.or=e.config.lists[t.value]},[`${J}xone`]:(e,t)=>{e.xone=e.config.lists[t.value]},[vt.id]:(e,t)=>{e.owlImports.add(t)},[`${dt}title`]:(e,t)=>{let n=t;e.label=Ht(e.config.languages,e.label,n)},[`${lt}label`]:(e,t)=>{let n=t;e.label=Ht(e.config.languages,e.label,n)}},Ja=class{constructor(e,t,n){this.extendedShapes=new Set,this.properties={},this.owlImports=new Set,this.merged=!1,this.id=e,this.config=t,this.parent=n,t.registerNodeTemplate(this),Ya(this,this.config.store.getQuads(e,null,null,null))}};function Ya(e,t){for(let n of t)qa[n.predicate.id]?.call(e,e,n.object);return e}function Xa(e){if(!e.merged){e.merged=!0;for(let t of Object.values(e.properties))for(let n of t){let[t,r]=no(e,n.path),i=t.some(e=>e.qualifiedValueShape!==void 0),a=Za(t),o=i?a:r;if(t.length>1&&o){let e=t[t.length-1];for(let n=t.length-2;n>=0;n--){let r=t[n],i=a?e.qualifiedValueShape:void 0;delete r.parent.properties[r.path],_r(e,r),i&&e.nodeShapes.delete(i)}$a(e)}}}}function Za(e){if(e.length<2)return!1;for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1];if(!n.qualifiedValueShape||!r.qualifiedValueShape||!Qa(n.parent,r.parent)||!Qa(n.qualifiedValueShape,r.qualifiedValueShape))return!1}return!0}function Qa(e,t){let n=[...e.extendedShapes],r=new Set;for(;n.length;){let e=n.pop();if(e.id.equals(t.id))return!0;r.has(e)||(r.add(e),n.push(...e.extendedShapes))}return!1}function $a(e){for(let t of[`xone`,`or`]){let n=e[t];if(!n?.length)continue;let r=n.filter(t=>eo(t,e));r.length>0&&r.length<n.length&&(r.length===1?(e[t]=void 0,gr(e,e.config.store.getQuads(r[0],null,null,null))):e[t]=r)}}function eo(e,t){let n=t.config.store.getQuads(e,null,null,null);return to(n,`http://www.w3.org/ns/shacl#datatype`,t.datatype)&&to(n,wt.id,t.class)&&to(n,`http://www.w3.org/ns/shacl#nodeKind`,t.nodeKind)}function to(e,t,n){if(!n)return!0;let r=!1;for(let i of e)if(i.predicate.value===t&&(r=!0,i.object.equals(n)))return!0;return!r}function no(e,t,n=new Set,r=[],i=!1){if(!n.has(e.id.value)){n.add(e.id.value);let a=e.properties[t];if(a?.length===1){r.push(a[0]),i||=a[0].maxCount===1;for(let e of a[0].nodeShapes){let[a,o]=no(e,t,n,r,i);i||=o}}for(let a of e.extendedShapes){let[e,o]=no(a,t,n,r,i);i||=o}}return[r,i]}var ro=class e extends HTMLElement{constructor(t,n,r,i,a,o=new Set,s){super(),this.template=t,this.linked=a??!1,this.ancestorShapeIds=o,this.queryContext=s,this.setAttribute(`part`,`node`);let c=n;c||=(!r&&t.nodeKind&&(r=t.nodeKind),r===void 0&&t.config.attributes.valuesNamespace||r?.value===`http://www.w3.org/ns/shacl#IRI`?k.namedNode(t.config.attributes.valuesNamespace+Ka()):k.blankNode(Ka())),this.nodeId=c;let l=JSON.stringify([t.id,n]);if(n&&t.config.renderedNodes.has(l)){i||=`Link`;let e=document.createElement(`label`);e.innerText=i,e.classList.add(`linked`),this.appendChild(e);let t=this.getAttribute(`part`);this.setAttribute(`part`,`${t?t+` `:``}linked-node`),this.dataset.nodeId=this.nodeId.id;let r=document.createElement(`a`),a=n.termType===`BlankNode`?`_:`+n.value:n.value;r.innerText=a,r.classList.add(`ref-link`),r.onclick=()=>{this.template.config.form.querySelector(`shacl-node[data-node-id='${a}']:not([part~='linked-node'])`)?.scrollIntoView()},this.appendChild(r),this.style.flexDirection=`row`,this.ready=Promise.resolve()}else{n&&t.config.renderedNodes.add(l);let r=this.ancestorShapeIds,o=this.template.id.value,s=this.queryContext;if(this.dataset.nodeId=this.nodeId.id,this.template.config.attributes.showNodeIds!==null){let e=document.createElement(`div`);e.innerText=`id: ${this.nodeId.id}`,e.classList.add(`node-id-display`),this.appendChild(e)}Xa(t),this.ready=(async()=>{let c=new Set(r);c.add(o);for(let[e,r]of Object.entries(t.properties))for(let e of r)await this.addPropertyInstance(e,n,r.length>1);for(let r of t.extendedShapes){let t=new e(r,n,void 0,void 0,a,c,s);this.prepend(t),await t.ready}if(t.or?.length&&await this.tryResolve(t.or,n,t.config),t.xone?.length&&await this.tryResolve(t.xone,n,t.config),i){let e=document.createElement(`h1`);e.innerText=i,e.setAttribute(`part`,`node-title`),this.prepend(e)}})()}}toRDF(e,t,n=``){if(t||=this.nodeId,!this.linked){for(let n of this.querySelectorAll(`:scope > shacl-node, :scope > .shacl-group > shacl-node, :scope > shacl-property, :scope > .shacl-group > shacl-property`))n.toRDF(e,t);this.template.targetClass&&e.addQuad(t,mt,this.template.targetClass,this.template.config.valuesGraphId),n&&e.addQuad(t,k.namedNode(n),this.template.id,this.template.config.valuesGraphId)}return t}async addPropertyInstance(e,t,n){let r=null;if(e.group)if(e.config.groups.indexOf(e.group)>-1){let t=this.querySelector(`:scope > .shacl-group[data-subject='${e.group}']`);t||(t=Ra(e.group,e.config),this.appendChild(t)),r=t}else console.warn(`ignoring unknown group reference`,e.group,`existing groups:`,e.config.groups);let i=new Pa(e,this);e.config.queryMode?await i.initializeQuery():await i.bindValues(t,n),(e.config.editMode||e.config.queryMode||i.instanceCount()>0)&&(r?r.appendChild(i):this.appendChild(i),e.config.queryMode||await i.updateControls())}async tryResolve(e,t,n){let r=!1;if(t){let i=wr(e,t,n);if(i.length){for(let e of i)await this.addPropertyInstance(n.getPropertyTemplate(e,this.template),t);r=!0}}r||this.appendChild(Sr(e,this,n))}};window.customElements.define(`shacl-node`,ro);function io(e){return e.datatype!==void 0&&At.has(e.datatype)}export{mt as $,hr as A,$t as B,Or as C,xr as D,Sr as E,lr as F,qt as G,Bt as H,or as I,Mt as J,pt as K,ar as L,gr as M,cr as N,fr as O,sr as P,ht as Q,hn as R,Nr as S,Dr as T,It as U,Ut as V,Jt as W,J as X,jt as Y,st as Z,ra as _,Pa as a,nt as at,Fr as b,ba as c,j as ct,xa as d,l as dt,St as et,aa as f,ia as g,Q as h,Xa as i,kt as it,dr as j,pr as k,ya as l,o as lt,$ as m,ro as n,Et as nt,La as o,k as ot,ca as p,gt as q,Ja as r,ft as rt,Aa as s,M as st,io as t,xt as tt,Sa as u,s as ut,sa as v,Er as w,Pr as x,Ir as y,Lt as z};
|
|
501
|
+
`}};Z([X()],va.prototype,`pos`,void 0),Z([X()],va.prototype,`minPos`,void 0),Z([X()],va.prototype,`maxPos`,void 0),Z([X({reflect:!0})],va.prototype,`dir`,void 0),Z([X()],va.prototype,`sep`,void 0),Z([X({reflect:!0,type:Boolean})],va.prototype,`dragging`,void 0),Z([X()],va.prototype,`storageKey`,void 0),Z([$i(`#separator`)],va.prototype,`separator`,void 0),va=Z([Ji(`rokit-splitpane`)],va);function ya(e){let t=new Set;for(let n of e.getQuads(null,gt,null,pt))n.subject.termType===`NamedNode`&&t.add(n.subject.value);if(t.size===1)return t.values().next().value}function ba(e,t){let n=k.namedNode(t);for(let t of e.getObjects(n,gt,pt))if(t.termType===`NamedNode`&&e.getQuads(t,mt,xt,null).length>0)return t}async function xa(e){let t={store:new nt,importedUrls:[],atts:e},n=[];if(e.shapes?n.push(Sa(sr({rdf:e.shapes}),t,ft)):e.shapesUrl&&n.push(Sa(sr({url:e.shapesUrl,proxy:t.atts.proxy,rdfUrlResolver:t.atts.rdfUrlResolver}),t,ft)),e.values?n.push(Sa(sr({rdf:e.values}),t,pt)):e.valuesUrl&&n.push(Sa(sr({url:e.valuesUrl,proxy:t.atts.proxy,rdfUrlResolver:t.atts.rdfUrlResolver}),t,pt)),await Promise.all(n),e.classInstanceProvider)try{let n=Zt(t.store),r=await e.classInstanceProvider(n);r&&await Sa(sr({rdf:r}),t,ft)}catch(e){console.error(`failed loading class instances`,e)}if(e.valuesSubject||=ya(t.store)||null,e.valuesSubject&&t.store.countQuads(null,null,null,ft)===0){let n=[...t.store.getObjects(e.valuesSubject,mt,pt),...t.store.getObjects(e.valuesSubject,gt,pt)],r=[];for(let e of n){let n=Ca(e.value);!n&&e.value.startsWith(`urn:`)&&t.atts.proxy&&(n=e.value),n&&t.importedUrls.indexOf(n)<0&&(t.importedUrls.push(n),r.push(Sa(sr({url:n,proxy:t.atts.proxy,rdfUrlResolver:t.atts.rdfUrlResolver}),t,ft)))}try{await Promise.allSettled(r)}catch(e){console.warn(e)}}return t.store}async function Sa(e,t,n){let r=await e,i=[];for(let e of r){let r=n;if(t.atts.valuesSubject&&pt.equals(n)&&e.graph.id&&e.graph.id!==t.atts.valuesSubject&&(r=e.graph),t.store.add(k.quad(e.subject,e.predicate,e.object,r)),t.atts.loadOwlImports&&vt.equals(e.predicate)){let n=Ca(e.object.value);n&&t.importedUrls.indexOf(n)<0&&(t.importedUrls.push(n),i.push(Sa(sr({url:n,proxy:t.atts.proxy,rdfUrlResolver:t.atts.rdfUrlResolver}),t,k.namedNode(n))))}}await Promise.allSettled(i)}function Ca(e){if(Vt(e))return e;let t=e.split(`:`);if(t.length===2){let n=or[t[0]];if(n&&(e=e.replace(`${t[0]}:`,n),Vt(e)))return e}return null}async function wa(e){if(e.template.nodeShapes.size===0)return;let t=e.template.config.resourceLinkProvider;if((!t||t&&!t.lazyLoad)&&(await Oa(e.template),Ea(e).length===0))return;let n=e.template.config.theme.createButton(e.template.label,!1);n.title=`Link existing `+e.template.label,n.classList.add(`link-button`),n.setAttribute(`text`,``);let r=n.getAttribute(`part`);return n.setAttribute(`part`,`${r?r+` `:``}link-button`),n.addEventListener(`click`,async()=>{t?.lazyLoad&&(n.classList.add(`loading`),await Oa(e.template),n.classList.remove(`loading`));let r=Ea(e);if(r.length===0)n.innerText=`No linkable resources found`,n.setAttribute(`disabled`,``),setTimeout(()=>n.remove(),2e3);else{let t=e.template.config.form.querySelector(`#dialog`);t||(t=new ua,t.classList.add(`link-chooser`),t.closable=!0,e.template.config.form.appendChild(t)),t.title=`Link existing `+e.template.label,Ta(t,e,r),t.open=!0}}),n}function Ta(e,t,n){let r=document.createElement(`div`);for(let i of n){let n=document.createElement(`div`);n.classList.add(`link-option`),n.title=`Link this resource`,n.innerText=i.label||i.value,n.addEventListener(`click`,()=>{Da(i.value,t),e.open=!1}),r.appendChild(n)}e.replaceChildren(r)}function Ea(e){let t=[];if(e.template.config.resourceLinkProvider){for(let n of e.template.nodeShapes)if(e.template.config.providedConformingResourceIds[n.id.value])for(let r of e.template.config.providedConformingResourceIds[n.id.value])e.querySelector(`:scope > .property-instance > shacl-node[data-node-id='${r}'], :scope > .collapsible > .property-instance > shacl-node[data-node-id='${r}']`)===null&&t.push({value:r,label:e.template.config.providedResourceLabels[r]||It(e.template.config.store.getQuads(k.namedNode(r),null,null,null),e.template.config.languages),children:[]})}return t}async function Da(e,t){let n=k.namedNode(e);if(t.template.config.providedResources[e]?.length>0){let n={store:t.template.config.store,importedUrls:[],atts:{loadOwlImports:!1}};await Sa(sr({rdf:t.template.config.providedResources[e]}),n,ft),t.template.config.providedResources[e]=``}let r=await Fa(t.template,n,!0,!0);t.container.insertBefore(r,t.querySelector(`:scope > .add-button-wrapper`)),await t.updateControls()}async function Oa(e){let t=e.config.resourceLinkProvider;if(!t)return;let n=new Set(Array.from(e.nodeShapes).map(e=>e.id.value));if(n.size===0)return;let r=Qt(Object.keys(e.config.providedConformingResourceIds),n);if(r.length!==0)try{let n=await t.listConformingResources(r,e);if(n){for(let t of Object.keys(n)){let r=new Set(n[t]);e.config.providedConformingResourceIds[t]=r,await ka(r,!1,e.config)}for(let t of r)e.config.providedConformingResourceIds[t]||(e.config.providedConformingResourceIds[t]=new Set)}}catch(e){console.error(`failed loading conforming resources`,e)}}async function ka(e,t,n){if(n.resourceLinkProvider&&e.size>0){let r=[];for(let t of e)n.providedResources[t]||r.push(t);if(r.length===0)return[];try{let e=await n.resourceLinkProvider.loadResources(r);if(e){let r={store:n.store,importedUrls:[],atts:{loadOwlImports:!1}};for(let i of e){n.providedResources[i.resourceId]=i.resourceRDF;let e=await sr({rdf:i.resourceRDF});n.providedResourceLabels[i.resourceId]=It(e.filter(e=>e.subject.value===i.resourceId),n.languages),t&&await Sa(Promise.resolve(e),r,ft)}return e}for(let e of r)n.providedResources[e]||(n.providedResources[e]=``)}catch(e){console.error(`failed loading resources`,e)}}return[]}async function Aa(e){let t=new Set;for(let n of e.store.getQuads(null,null,null,pt))ja(n.object,e.store)&&t.add(n.object.value);await ka(t,!0,e)}function ja(e,t){return e.termType===`NamedNode`&&t.countQuads(e,null,null,null)===0}var Ma=`:scope > .add-button-wrapper, :scope > .collapsible > .add-button-wrapper`,Na=`:scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node, :scope > .collapsible > .property-instance`,Pa=class extends HTMLElement{constructor(e,t){if(super(),this.template=e,this.parent=t,this.container=this,this.setAttribute(`part`,`property`),this.template.nodeShapes.size&&this.template.config.attributes.collapse!==null&&(this.template.maxCount===void 0||this.template.maxCount>1)){let t=new ia;t.classList.add(`collapsible`,`shacl-group`),t.open=e.config.attributes.collapse===`open`,t.label=this.template.label,t.setAttribute(`part`,`collapsible`),this.container=t,this.appendChild(this.container)}this.template.order!==void 0&&(this.style.order=`${this.template.order}`),this.template.cssClass&&this.classList.add(this.template.cssClass),e.config.editMode&&!t.linked&&this.addEventListener(`change`,async()=>{await this.updateControls()})}async bindValues(e,t){if(this.template.path){let n=!1;if(e){let r=this.template.config.store.getQuads(e,this.template.path,null,this.parent.linked?null:pt);t&&(r=await this.filterValidValues(r,e));for(let e of r)this.parent.linked||this.template.config.store.delete(e),await this.addPropertyInstance(e.object,!pt.equals(e.graph)||this.template.config.providedResources[e.object.value]!==void 0,this.template.config.providedResources[e.object.value]!==void 0),this.template.hasValue&&e.object.equals(this.template.hasValue)&&(n=!0)}this.template.config.editMode&&this.template.hasValue&&!n&&!this.parent.linked&&await this.addPropertyInstance(this.template.hasValue)}}async initializeQuery(){let{initializeQueryProperty:e}=await xr(async()=>{let{initializeQueryProperty:e}=await import(`./mode-KFvmvNiB.js`);return{initializeQueryProperty:e}},[]);await e(this)}async addPropertyInstance(e,t,n=!1){let r;if(this.template.or?.length||this.template.xone?.length){let t=this.template.or?.length?this.template.or:this.template.xone,n=!1;if(e){let i=Cr(t,e,this.template.config);i.length&&(r=await Fa(gr(hr(this.template),i),e,!this.parent.linked,this.parent.linked,this.parent),n=!0)}!n&&this.template.config.editMode&&(r=Sr(t,this,this.template.config),Ia(r,``,this.template.config.theme.dense,this.template.config.hierarchyColorsStyleSheet!==void 0))}else r=await Fa(this.template,e,n,t||this.parent.linked,this.parent);return r&&this.container.insertBefore(r,this.querySelector(Ma)),r}async updateControls(){this.template.config.editMode&&!this.parent.linked&&!this.querySelector(Ma)&&this.container.appendChild(await this.createAddControls());let e=pr(this.template),t=this.template.nodeShapes.size===0,n=this.querySelector(`:scope > .add-button-wrapper > .link-button, :scope > .collapsible > .add-button-wrapper > .link-button`)===null,r=t||!this.hasRecursiveNodeShape(),i=this.instanceCount();i===0&&r&&(t||n&&e>0)&&(await this.addPropertyInstance(),i=1),t||this.querySelector(Ma)?.classList.toggle(`required`,i<e);let a;a=e>0?i>e:!t||i>1;let o=i<mr(this.template);this.classList.toggle(`may-remove`,a),this.classList.toggle(`may-add`,o)}instanceCount(){return this.querySelectorAll(Na).length}hasRecursiveNodeShape(){let e=new Set;this.parent.ancestorShapeIds.forEach(t=>e.add(t)),e.add(this.parent.template.id.value);for(let t of this.template.nodeShapes)if(e.has(t.id.value))return!0;return!1}toRDF(e,t){let n=k.namedNode(this.template.path);for(let r of this.querySelectorAll(`:scope > .property-instance, :scope > .collapsible > .property-instance`))if(r.firstChild instanceof ro){let i=r.firstChild.toRDF(e);e.addQuad(t,n,i,this.template.config.valuesGraphId)}else if(this.template.config.editMode)for(let i of r.querySelectorAll(`:scope > .editor`)){let r=Ar(i);r&&e.addQuad(t,n,r,this.template.config.valuesGraphId)}else{let i=Ar(r);i&&e.addQuad(t,n,i,this.template.config.valuesGraphId)}}async filterValidValues(e,t){let n=this.template.id,r=[t];if(this.template.qualifiedValueShape){n=this.template.qualifiedValueShape.id,r=[];for(let t of e)r.push(t.object)}let i=await this.template.config.validator.validate({dataset:this.template.config.store,terms:r},[{terms:[n]}]),a=new Set;for(let e of i.results){let t=this.template.qualifiedValueShape?e.focusNode:e.value;t?.ptrs?.length&&a.add(t.ptrs[0]._term.id)}return e.filter(e=>!a.has(e.object.id))}async createAddControls(){let e=document.createElement(`div`);e.classList.add(`add-button-wrapper`),e.setAttribute(`part`,`add-controls`);let t=await wa(this);t&&e.appendChild(t);let n=this.template.config.theme.createButton(this.template.label,!1);n.title=`Add `+this.template.label,n.classList.add(`add-button`),n.setAttribute(`text`,``);let r=n.getAttribute(`part`);return n.setAttribute(`part`,`${r?r+` `:``}add-button`),n.addEventListener(`click`,async()=>{let e=await this.addPropertyInstance();e&&(e.classList.add(`fadeIn`),await this.updateControls(),setTimeout(()=>{Ft(e),e.classList.remove(`fadeIn`)},200))}),e.appendChild(n),e}};async function Fa(e,t,n=!1,r=!1,i){let a;if(e.nodeShapes.size){a=document.createElement(`div`),a.classList.add(`property-instance`),a.setAttribute(`part`,`property-instance`);let n=new Set(i?.ancestorShapeIds??[]);i&&n.add(i.template.id.value);for(let i of e.nodeShapes){let o=new ro(i,t,e.nodeKind,e.label,r,n);a.appendChild(o),await o.ready}}else{let n=Fr(e.path,e.datatype?.value);a=n?e.config.editMode&&!r?n.createEditor(e,t):n.createViewer(e,t):Dr(e,t||null,e.config.editMode&&!r),a.childNodes.length>0&&(a.classList.add(`property-instance`),a.setAttribute(`part`,`property-instance`)),r&&a.classList.add(`linked`)}return e.config.editMode&&(!r||n)?Ia(a,e.label,e.config.theme.dense,e.config.hierarchyColorsStyleSheet!==void 0,n):e.config.hierarchyColorsStyleSheet!==void 0&&a.appendChild(La(!0)),t&&!e.config.editMode&&(t instanceof M?(a.dataset.value=t.value,t.language.length>0?a.dataset.lang=t.language:a.shaclDatatype=t.datatype):a.dataset.value=`<`+t.value+`>`),a.dataset.path=e.path,a}function Ia(e,t,n,r,i=!1){let a=La(r),o=new ra;o.classList.add(`remove-button`,`clear`),o.title=`Remove `+t,o.dense=n,o.icon=!0;let s=o.getAttribute(`part`);o.setAttribute(`part`,`${s?s+` `:``}remove-button`),o.addEventListener(`click`,()=>{e.classList.remove(`fadeIn`),e.classList.add(`fadeOut`),setTimeout(()=>{let t=e.parentElement;e.remove(),t?.dispatchEvent(new Event(`change`,{bubbles:!0,cancelable:!0}))},200)}),i&&o.classList.add(`persistent`),a.appendChild(o),e.appendChild(a)}function La(e){let t=document.createElement(`div`);return t.className=`remove-button-wrapper`,t.setAttribute(`part`,`remove-controls`),e&&t.classList.add(`colorize`),t}window.customElements.define(`shacl-property`,Pa);function Ra(e,t){let n=e,r=t.store.getQuads(e,null,null,null),i=Nt(r,`label`,lt,t.languages);i&&(n=i);let a;if(t.attributes.collapse!==null)a=new ia,a.classList.add(`collapsible`),a.open=t.attributes.collapse===`open`,a.label=n,a.setAttribute(`part`,`group collapsible`);else{a=document.createElement(`div`);let e=document.createElement(`h1`);e.innerText=n,e.setAttribute(`part`,`group-title`),a.appendChild(e),a.setAttribute(`part`,`group`)}a.dataset.subject=e,a.classList.add(`shacl-group`);let o=Nt(r,`order`);return o&&(a.style.order=o),a}var za=[];for(let e=0;e<256;++e)za.push((e+256).toString(16).slice(1));function Ba(e,t=0){return(za[e[t+0]]+za[e[t+1]]+za[e[t+2]]+za[e[t+3]]+`-`+za[e[t+4]]+za[e[t+5]]+`-`+za[e[t+6]]+za[e[t+7]]+`-`+za[e[t+8]]+za[e[t+9]]+`-`+za[e[t+10]]+za[e[t+11]]+za[e[t+12]]+za[e[t+13]]+za[e[t+14]]+za[e[t+15]]).toLowerCase()}var Va,Ha=new Uint8Array(16);function Ua(){if(!Va){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);Va=crypto.getRandomValues.bind(crypto)}return Va(Ha)}var Wa={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Ga(e,t,n){e||={};let r=e.random??e.rng?.()??Ua();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return Ba(r)}function Ka(e,t,n){return Wa.randomUUID&&!t&&!e?Wa.randomUUID():Ga(e,t,n)}var qa={[`${J}node`]:(e,t)=>{e.extendedShapes.add(new Ja(t,e.config,e))},[`${J}and`]:(e,t)=>{for(let n of e.config.lists[t.value])e.extendedShapes.add(new Ja(n,e.config,e))},[`${J}property`]:(e,t)=>{let n=e.config.getPropertyTemplate(t,e);if(n.path){let t=e.properties[n.path];if(t||(t=[],e.properties[n.path]=t),n.qualifiedValueShape)t.push(n);else{let r;for(let t=0;t<e.properties[n.path].length&&!r;t++)e.properties[n.path][t].qualifiedValueShape||(r=e.properties[n.path][t]);r?_r(r,n):t.push(n)}}},[`${J}nodeKind`]:(e,t)=>{e.nodeKind=t},[`${J}targetClass`]:(e,t)=>{e.targetClass=t},[`${J}or`]:(e,t)=>{e.or=e.config.lists[t.value]},[`${J}xone`]:(e,t)=>{e.xone=e.config.lists[t.value]},[vt.id]:(e,t)=>{e.owlImports.add(t)},[`${dt}title`]:(e,t)=>{let n=t;e.label=Ht(e.config.languages,e.label,n)},[`${lt}label`]:(e,t)=>{let n=t;e.label=Ht(e.config.languages,e.label,n)}},Ja=class{constructor(e,t,n){this.extendedShapes=new Set,this.properties={},this.owlImports=new Set,this.merged=!1,this.id=e,this.config=t,this.parent=n,t.registerNodeTemplate(this),Ya(this,this.config.store.getQuads(e,null,null,null))}};function Ya(e,t){for(let n of t)qa[n.predicate.id]?.call(e,e,n.object);return e}function Xa(e){if(!e.merged){e.merged=!0;for(let t of Object.values(e.properties))for(let n of t){let[t,r]=no(e,n.path),i=t.some(e=>e.qualifiedValueShape!==void 0),a=Za(t),o=i?a:r;if(t.length>1&&o){let e=t[t.length-1];for(let n=t.length-2;n>=0;n--){let r=t[n],i=a?e.qualifiedValueShape:void 0;delete r.parent.properties[r.path],_r(e,r),i&&e.nodeShapes.delete(i)}$a(e)}}}}function Za(e){if(e.length<2)return!1;for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1];if(!n.qualifiedValueShape||!r.qualifiedValueShape||!Qa(n.parent,r.parent)||!Qa(n.qualifiedValueShape,r.qualifiedValueShape))return!1}return!0}function Qa(e,t){let n=[...e.extendedShapes],r=new Set;for(;n.length;){let e=n.pop();if(e.id.equals(t.id))return!0;r.has(e)||(r.add(e),n.push(...e.extendedShapes))}return!1}function $a(e){for(let t of[`xone`,`or`]){let n=e[t];if(!n?.length)continue;let r=n.filter(t=>eo(t,e));r.length>0&&r.length<n.length&&(r.length===1?(e[t]=void 0,gr(e,e.config.store.getQuads(r[0],null,null,null))):e[t]=r)}}function eo(e,t){let n=t.config.store.getQuads(e,null,null,null);return to(n,`http://www.w3.org/ns/shacl#datatype`,t.datatype)&&to(n,wt.id,t.class)&&to(n,`http://www.w3.org/ns/shacl#nodeKind`,t.nodeKind)}function to(e,t,n){if(!n)return!0;let r=!1;for(let i of e)if(i.predicate.value===t&&(r=!0,i.object.equals(n)))return!0;return!r}function no(e,t,n=new Set,r=[],i=!1){if(!n.has(e.id.value)){n.add(e.id.value);let a=e.properties[t];if(a?.length===1){r.push(a[0]),i||=a[0].maxCount===1;for(let e of a[0].nodeShapes){let[a,o]=no(e,t,n,r,i);i||=o}}for(let a of e.extendedShapes){let[e,o]=no(a,t,n,r,i);i||=o}}return[r,i]}var ro=class e extends HTMLElement{constructor(t,n,r,i,a,o=new Set,s){super(),this.template=t,this.linked=a??!1,this.ancestorShapeIds=o,this.queryContext=s,this.setAttribute(`part`,`node`);let c=n;c||=(!r&&t.nodeKind&&(r=t.nodeKind),r===void 0&&t.config.attributes.valuesNamespace||r?.value===`http://www.w3.org/ns/shacl#IRI`?k.namedNode(t.config.attributes.valuesNamespace+Ka()):k.blankNode(Ka())),this.nodeId=c;let l=JSON.stringify([t.id,n]);if(n&&t.config.renderedNodes.has(l)){i||=`Link`;let e=document.createElement(`label`);e.innerText=i,e.classList.add(`linked`),this.appendChild(e);let t=this.getAttribute(`part`);this.setAttribute(`part`,`${t?t+` `:``}linked-node`),this.dataset.nodeId=this.nodeId.id;let r=document.createElement(`a`),a=n.termType===`BlankNode`?`_:`+n.value:n.value;r.innerText=a,r.classList.add(`ref-link`),r.onclick=()=>{this.template.config.form.querySelector(`shacl-node[data-node-id='${a}']:not([part~='linked-node'])`)?.scrollIntoView()},this.appendChild(r),this.style.flexDirection=`row`,this.ready=Promise.resolve()}else{n&&t.config.renderedNodes.add(l);let r=this.ancestorShapeIds,o=this.template.id.value,s=this.queryContext;if(this.dataset.nodeId=this.nodeId.id,this.template.config.attributes.showNodeIds!==null){let e=document.createElement(`div`);e.innerText=`id: ${this.nodeId.id}`,e.classList.add(`node-id-display`),this.appendChild(e)}Xa(t),this.ready=(async()=>{let c=new Set(r);c.add(o);for(let[e,r]of Object.entries(t.properties))for(let e of r)await this.addPropertyInstance(e,n,r.length>1);for(let r of t.extendedShapes){let t=new e(r,n,void 0,void 0,a,c,s);this.prepend(t),await t.ready}if(t.or?.length&&await this.tryResolve(t.or,n,t.config),t.xone?.length&&await this.tryResolve(t.xone,n,t.config),i){let e=document.createElement(`h1`);e.innerText=i,e.setAttribute(`part`,`node-title`),this.prepend(e)}})()}}toRDF(e,t,n=``){if(t||=this.nodeId,!this.linked){for(let n of this.querySelectorAll(`:scope > shacl-node, :scope > .shacl-group > shacl-node, :scope > shacl-property, :scope > .shacl-group > shacl-property`))n.toRDF(e,t);this.template.targetClass&&e.addQuad(t,mt,this.template.targetClass,this.template.config.valuesGraphId),n&&e.addQuad(t,k.namedNode(n),this.template.id,this.template.config.valuesGraphId)}return t}async addPropertyInstance(e,t,n){let r=null;if(e.group)if(e.config.groups.indexOf(e.group)>-1){let t=this.querySelector(`:scope > .shacl-group[data-subject='${e.group}']`);t||(t=Ra(e.group,e.config),this.appendChild(t)),r=t}else console.warn(`ignoring unknown group reference`,e.group,`existing groups:`,e.config.groups);let i=new Pa(e,this);e.config.queryMode?await i.initializeQuery():await i.bindValues(t,n),(e.config.editMode||e.config.queryMode||i.instanceCount()>0)&&(r?r.appendChild(i):this.appendChild(i),e.config.queryMode||await i.updateControls())}async tryResolve(e,t,n){let r=!1;if(t){let i=wr(e,t,n);if(i.length){for(let e of i)await this.addPropertyInstance(n.getPropertyTemplate(e,this.template),t);r=!0}}r||this.appendChild(Sr(e,this,n))}};window.customElements.define(`shacl-node`,ro);function io(e){return e.datatype!==void 0&&At.has(e.datatype)}export{mt as $,hr as A,$t as B,Or as C,xr as D,Sr as E,lr as F,qt as G,Bt as H,or as I,Mt as J,pt as K,ar as L,gr as M,cr as N,fr as O,sr as P,ht as Q,hn as R,Nr as S,Dr as T,It as U,Ut as V,Jt as W,J as X,jt as Y,st as Z,ra as _,Pa as a,nt as at,Fr as b,ba as c,j as ct,xa as d,l as dt,St as et,aa as f,ia as g,Q as h,Xa as i,kt as it,dr as j,pr as k,ya as l,o as lt,$ as m,ro as n,Et as nt,La as o,k as ot,ca as p,gt as q,Ja as r,ft as rt,Aa as s,M as st,io as t,xt as tt,Sa as u,s as ut,sa as v,Er as w,Pr as x,Ir as y,Lt as z};
|