rdflib 2.2.16-cc3c9ecc → 2.2.17-be39361d

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.
@@ -36,7 +36,7 @@ const w=p["@id"];if("@context"===w||"@preserve"===w)throw new i("Invalid JSON-LD
36
36
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37
37
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
38
  */
39
- const r=n(57),i=n(85),a=n(28),o=n(87),s=a.IdentifierIssuer,u=n(29),c=n(70),l=n(91),{expand:h}=n(92),{flatten:d}=n(93),{fromRDF:f}=n(94),{toRDF:p}=n(95),{frameMergedOrDefault:v,cleanupNull:y}=n(97),{isArray:g,isObject:m,isString:b}=n(24),{isSubjectReference:w}=n(30),{expandIri:x,getInitialContext:_,process:k,processingMode:T}=n(39),{compact:N,compactIri:j}=n(98),{createNodeMap:O,createMergedNodeMap:I,mergeNodeMaps:S}=n(50),E=function(e){const t={},E=new c({max:100});function R(t,{documentLoader:n=e.documentLoader,...r}){return Object.assign({},{documentLoader:n},r,t)}return e.compact=async function(t,n,r){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(null===n)throw new u("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(null===t)return null;let i;(r=R(r,{base:b(t)?t:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new s("_:b"),contextResolver:new o({sharedCache:E})})).link&&(r.skipExpansion=!0),r.compactToRelative||delete r.base,i=r.skipExpansion?t:await e.expand(t,r);const c=await e.processContext(_(r),n,r);let l=await N({activeCtx:c,element:i,options:r,compactionMap:r.compactionMap});r.compactArrays&&!r.graph&&g(l)?1===l.length?l=l[0]:0===l.length&&(l={}):r.graph&&m(l)&&(l=[l]),m(n)&&"@context"in n&&(n=n["@context"]),n=a.clone(n),g(n)||(n=[n]);const h=n;n=[];for(let e=0;e<h.length;++e)(!m(h[e])||Object.keys(h[e]).length>0)&&n.push(h[e]);const d=n.length>0;if(1===n.length&&(n=n[0]),g(l)){const e=j({activeCtx:c,iri:"@graph",relativeTo:{vocab:!0}}),t=l;l={},d&&(l["@context"]=n),l[e]=t}else if(m(l)&&d){const e=l;l={"@context":n};for(const t in e)l[t]=e[t]}return l},e.expand=async function(t,n){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");!1===(n=R(n,{keepFreeFloatingNodes:!1,contextResolver:new o({sharedCache:E})})).expansionMap&&(n.expansionMap=void 0);const r={},i=[];if("expandContext"in n){const e=a.clone(n.expandContext);m(e)&&"@context"in e?r.expandContext=e:r.expandContext={"@context":e},i.push(r.expandContext)}let s;if(b(t)){const a=await e.get(t,n);s=a.documentUrl,r.input=a.document,a.contextUrl&&(r.remoteContext={"@context":a.contextUrl},i.push(r.remoteContext))}else r.input=a.clone(t);"base"in n||(n.base=s||"");let u=_(n);for(const e of i)u=await k({activeCtx:u,localCtx:e,options:n});let c=await h({activeCtx:u,element:r.input,options:n,expansionMap:n.expansionMap});return m(c)&&"@graph"in c&&1===Object.keys(c).length?c=c["@graph"]:null===c&&(c=[]),g(c)||(c=[c]),c},e.flatten=async function(t,n,r){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");n="function"==typeof n?null:n||null,r=R(r,{base:b(t)?t:"",contextResolver:new o({sharedCache:E})});const i=await e.expand(t,r),a=d(i);if(null===n)return a;r.graph=!0,r.skipExpansion=!0;const s=await e.compact(a,n,r);return s},e.frame=async function(t,n,r){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(r=R(r,{base:b(t)?t:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new o({sharedCache:E})}),b(n)){const 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}}const i=n&&n["@context"]||{},a=await e.processContext(_(r),i,r);r.hasOwnProperty("omitGraph")||(r.omitGraph=T(a,1.1)),r.hasOwnProperty("pruneBlankNodeIdentifiers")||(r.pruneBlankNodeIdentifiers=T(a,1.1));const s=await e.expand(t,r),u={...r};u.isFrame=!0,u.keepFreeFloatingNodes=!0;const c=await e.expand(n,u),l=Object.keys(n).map(e=>x(a,e,{vocab:!0}));u.merged=!l.includes("@graph"),u.is11=T(a,1.1);const h=v(s,c,u);u.graph=!r.omitGraph,u.skipExpansion=!0,u.link={},u.framing=!0;let d=await e.compact(h,i,u);return u.link={},d=y(d,u),d},e.link=async function(t,n,r){const i={};return n&&(i["@context"]=n),i["@embed"]="@link",e.frame(t,i,r)},e.normalize=e.canonize=async function(t,n){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if("inputFormat"in(n=R(n,{base:b(t)?t:"",algorithm:"URDNA2015",skipExpansion:!1,contextResolver:new o({sharedCache:E})}))){if("application/n-quads"!==n.inputFormat&&"application/nquads"!==n.inputFormat)throw new u("Unknown canonicalization input format.","jsonld.CanonizeError");const e=l.parse(t);return r.canonize(e,n)}const i={...n};delete i.format,i.produceGeneralizedRdf=!1;const a=await e.toRDF(t,i);return r.canonize(a,n)},e.fromRDF=async function(e,n){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");n=R(n,{format:b(e)?"application/n-quads":void 0});const{format:r}=n;let{rdfParser:i}=n;if(r){if(i=i||t[r],!i)throw new u("Unknown input format.","jsonld.UnknownFormat",{format:r})}else i=()=>e;const a=await i(e);return f(a,n)},e.toRDF=async function(t,n){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");let r;r=(n=R(n,{base:b(t)?t:"",skipExpansion:!1,contextResolver:new o({sharedCache:E})})).skipExpansion?t:await e.expand(t,n);const i=p(r,n);if(n.format){if("application/n-quads"===n.format||"application/nquads"===n.format)return l.serialize(i);throw new u("Unknown output format.","jsonld.UnknownFormat",{format:n.format})}return i},e.createNodeMap=async function(t,n){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");n=R(n,{base:b(t)?t:"",contextResolver:new o({sharedCache:E})});const r=await e.expand(t,n);return I(r,n)},e.merge=async function(t,n,r){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!g(t))throw new TypeError('Could not merge, "docs" must be an array.');n="function"==typeof n?null:n||null,r=R(r,{contextResolver:new o({sharedCache:E})});const i=await Promise.all(t.map(t=>{const n={...r};return e.expand(t,n)}));let u=!0;"mergeNodes"in r&&(u=r.mergeNodes);const c=r.issuer||new s("_:b"),l={"@default":{}};for(let e=0;e<i.length;++e){const t=a.relabelBlankNodes(i[e],{issuer:new s("_:b"+e+"-")}),n=u||0===e?l:{"@default":{}};if(O(t,n,"@default",c),n!==l)for(const e in n){const t=n[e];if(!(e in l)){l[e]=t;continue}const r=l[e];for(const e in t)e in r||(r[e]=t[e])}}const h=S(l),d=[],f=Object.keys(h).sort();for(let e=0;e<f.length;++e){const t=h[f[e]];w(t)||d.push(t)}if(null===n)return d;r.graph=!0,r.skipExpansion=!0;const p=await e.compact(d,n,r);return p},Object.defineProperty(e,"documentLoader",{get:()=>e._documentLoader,set:t=>e._documentLoader=t}),e.documentLoader=async e=>{throw new u("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="function"==typeof n.documentLoader?n.documentLoader:e.documentLoader;const i=await r(t);try{if(!i.document)throw new u("No remote document found at the given URL.","jsonld.NullRemoteDocument");b(i.document)&&(i.document=JSON.parse(i.document))}catch(e){throw new u("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=R(n,{base:"",contextResolver:new o({sharedCache:E})}),null===t?_(n):(t=a.clone(t),m(t)&&"@context"in t||(t={"@context":t}),k({activeCtx:e,localCtx:t,options:n}))},e.getContextValue=n(39).getContextValue,e.documentLoaders={},e.useDocumentLoader=function(t){if(!(t in e.documentLoaders))throw new u('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.registerRDFParser("application/nquads",l.parse),e.url=n(33),e.util=a,Object.assign(e,a),e.promises=e,e.RequestQueue=n(69),e.JsonLdProcessor=n(99)(e),i.setupGlobals(e),i.setupDocumentLoaders(e),e},R=function(){return E((function(){return R()}))};E(R),e.exports=R},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));n(41);function r(e){return!!e&&"DefaultGraph"===e.termType}},function(t,n){t.exports=e},function(e,t,n){e.exports=n(79)},function(e,t,n){"use strict";e.exports=class e{constructor(e,t=new Map,n=0){this.prefix=e,this._existing=t,this.counter=n}clone(){const{prefix:t,_existing:n,counter:r}=this;return new e(t,new Map(n),r)}getId(e){const t=e&&this._existing.get(e);if(t)return t;const 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()]}}},function(e,t,n){"use strict";const r="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",i="http://www.w3.org/2001/XMLSchema#string",a={};function o(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&&("Literal"!==e.object.termType||e.object.datatype.termType===t.object.datatype.termType&&e.object.language===t.object.language&&e.object.datatype.value===t.object.datatype.value))}a.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,a.empty=new RegExp("^[ \\t]*$"),a.quad=new RegExp('^[ \\t]*(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]+(?:<([^:]+:[^>]*)>)[ \\t]+(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?)|(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?:(?:\\^\\^(?:<([^:]+:[^>]*)>))|(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)))?))[ \\t]*(?:\\.|(?:(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]*\\.))[ \\t]*$'),e.exports=class e{static parse(e){const t=[],n={},s=e.split(a.eoln);let c=0;for(const e of s){if(c++,a.empty.test(e))continue;const s=e.match(a.quad);if(null===s)throw new Error("N-Quads parse error on line "+c+".");const l={subject:null,predicate:null,object:null,graph:null};if(void 0!==s[1]?l.subject={termType:"NamedNode",value:s[1]}:l.subject={termType:"BlankNode",value:s[2]},l.predicate={termType:"NamedNode",value:s[3]},void 0!==s[4]?l.object={termType:"NamedNode",value:s[4]}:void 0!==s[5]?l.object={termType:"BlankNode",value:s[5]}:(l.object={termType:"Literal",value:void 0,datatype:{termType:"NamedNode"}},void 0!==s[7]?l.object.datatype.value=s[7]:void 0!==s[8]?(l.object.datatype.value=r,l.object.language=s[8]):l.object.datatype.value=i,l.object.value=s[6].replace(u,(function(e,t,n,r){if(t)switch(t){case"t":return"\t";case"b":return"\b";case"n":return"\n";case"r":return"\r";case"f":return"\f";case'"':return'"';case"'":return"'";case"\\":return"\\"}if(n)return String.fromCharCode(parseInt(n,16));if(r)throw new Error("Unsupported U escape")}))),void 0!==s[9]?l.graph={termType:"NamedNode",value:s[9]}:void 0!==s[10]?l.graph={termType:"BlankNode",value:s[10]}:l.graph={termType:"DefaultGraph",value:""},l.graph.value in n){let e=!0;const r=n[l.graph.value];for(const t of r)if(o(t,l)){e=!1;break}e&&(r.push(l),t.push(l))}else n[l.graph.value]=[l],t.push(l)}return t}static serialize(t){Array.isArray(t)||(t=e.legacyDatasetToQuads(t));const n=[];for(const r of t)n.push(e.serializeQuad(r));return n.sort().join("")}static serializeQuad(e){const t=e.subject,n=e.predicate,a=e.object,o=e.graph;let u="";return"NamedNode"===t.termType?u+=`<${t.value}>`:u+=""+t.value,u+=` <${n.value}> `,"NamedNode"===a.termType?u+=`<${a.value}>`:"BlankNode"===a.termType?u+=a.value:(u+=`"${function(e){return e.replace(s,(function(e){switch(e){case'"':return'\\"';case"\\":return"\\\\";case"\n":return"\\n";case"\r":return"\\r"}}))}(a.value)}"`,a.datatype.value===r?a.language&&(u+="@"+a.language):a.datatype.value!==i&&(u+=`^^<${a.datatype.value}>`)),"NamedNode"===o.termType?u+=` <${o.value}>`:"BlankNode"===o.termType&&(u+=" "+o.value),u+=" .\n",u}static legacyDatasetToQuads(e){const t=[],n={"blank node":"BlankNode",IRI:"NamedNode",literal:"Literal"};for(const a in e){e[a].forEach(e=>{const o={};for(const t in e){const a=e[t],s={termType:n[a.type],value:a.value};"Literal"===s.termType&&(s.datatype={termType:"NamedNode"},"datatype"in a&&(s.datatype.value=a.datatype),"language"in a?("datatype"in a||(s.datatype.value=r),s.language=a.language):"datatype"in a||(s.datatype.value=i)),o[t]=s}o.graph="@default"===a?{termType:"DefaultGraph",value:""}:{termType:a.startsWith("_:")?"BlankNode":"NamedNode",value:a},t.push(o)})}return t}};const s=/["\\\n\r]/g;const u=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g},function(e,t,n){"use strict";const r="http://www.w3.org/1999/02/22-rdf-syntax-ns#",i="http://www.w3.org/2001/XMLSchema#";e.exports={LINK_HEADER_REL:"http://www.w3.org/ns/json-ld#context",LINK_HEADER_CONTEXT:"http://www.w3.org/ns/json-ld#context",RDF:r,RDF_LIST:r+"List",RDF_FIRST:r+"first",RDF_REST:r+"rest",RDF_NIL:r+"nil",RDF_TYPE:r+"type",RDF_PLAIN_LITERAL:r+"PlainLiteral",RDF_XML_LITERAL:r+"XMLLiteral",RDF_JSON_LITERAL:r+"JSON",RDF_OBJECT:r+"object",RDF_LANGSTRING:r+"langString",XSD:i,XSD_BOOLEAN:i+"boolean",XSD_DOUBLE:i+"double",XSD_INTEGER:i+"integer",XSD_STRING:i+"string"}},function(e,t,n){"use strict";n.r(t),n.d(t,"isStatement",(function(){return $.j})),n.d(t,"isStore",(function(){return $.k})),n.d(t,"isCollection",(function(){return $.b})),n.d(t,"isRDFlibObject",(function(){return $.i})),n.d(t,"isVariable",(function(){return $.n})),n.d(t,"isTerm",(function(){return $.m})),n.d(t,"isLiteral",(function(){return $.d})),n.d(t,"isQuad",(function(){return $.g})),n.d(t,"isNamedNode",(function(){return $.e})),n.d(t,"isBlankNode",(function(){return $.a})),n.d(t,"isSubject",(function(){return $.l})),n.d(t,"isPredicate",(function(){return $.f})),n.d(t,"isRDFObject",(function(){return $.h})),n.d(t,"isGraph",(function(){return $.c})),n.d(t,"BlankNode",(function(){return f.a})),n.d(t,"Collection",(function(){return p.a})),n.d(t,"convert",(function(){return v})),n.d(t,"DataFactory",(function(){return ne})),n.d(t,"Empty",(function(){return k})),n.d(t,"Fetcher",(function(){return T.a})),n.d(t,"Formula",(function(){return N.a})),n.d(t,"Store",(function(){return j.a})),n.d(t,"jsonParser",(function(){return O})),n.d(t,"Literal",(function(){return I.a})),n.d(t,"log",(function(){return S.a})),n.d(t,"N3Parser",(function(){return E.a})),n.d(t,"NamedNode",(function(){return R.a})),n.d(t,"Namespace",(function(){return A.a})),n.d(t,"Node",(function(){return C.a})),n.d(t,"parse",(function(){return L.a})),n.d(t,"Query",(function(){return D.a})),n.d(t,"queryToSPARQL",(function(){return P})),n.d(t,"RDFaProcessor",(function(){return M.a})),n.d(t,"RDFParser",(function(){return F.a})),n.d(t,"serialize",(function(){return U.a})),n.d(t,"Serializer",(function(){return q.a})),n.d(t,"SPARQLToQuery",(function(){return B})),n.d(t,"sparqlUpdateParser",(function(){return H.a})),n.d(t,"Statement",(function(){return V.a})),n.d(t,"term",(function(){return _e})),n.d(t,"UpdateManager",(function(){return Z})),n.d(t,"UpdatesSocket",(function(){return re})),n.d(t,"UpdatesVia",(function(){return ie})),n.d(t,"uri",(function(){return Q})),n.d(t,"Util",(function(){return G})),n.d(t,"Variable",(function(){return ae.a})),n.d(t,"IndexedFormula",(function(){return j.a})),n.d(t,"NextId",(function(){return ke})),n.d(t,"fromNT",(function(){return xe})),n.d(t,"fetcher",(function(){return ce})),n.d(t,"graph",(function(){return le})),n.d(t,"lit",(function(){return he})),n.d(t,"st",(function(){return de})),n.d(t,"sym",(function(){return fe})),n.d(t,"blankNode",(function(){return ve})),n.d(t,"defaultGraph",(function(){return ye})),n.d(t,"literal",(function(){return ge})),n.d(t,"namedNode",(function(){return fe})),n.d(t,"quad",(function(){return me})),n.d(t,"triple",(function(){return be})),n.d(t,"variable",(function(){return pe})),n.d(t,"termValue",(function(){return J.a})),n.d(t,"ConnectedStore",(function(){return Te})),n.d(t,"LiveStore",(function(){return Ne}));var r=n(4),i=n.n(r),a=n(3),o=n.n(a),s=n(11),u=n.n(s),c=n(14),l=n.n(c),h=n(9),d=n.n(h),f=n(20),p=n(32),v=n(52),y=n(5),g=n.n(y),m=n(0),b=n.n(m),w=n(12),x=n(1);function _(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=d()(e);if(t){var i=d()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return l()(this,n)}}var k=function(e){u()(n,e);var t=_(n);function n(){var e;return i()(this,n),e=t.call(this,""),b()(o()(e),"termType",x.d),e}return g()(n,[{key:"toString",value:function(){return"()"}}]),n}(w.a),T=n(35),N=n(47),j=n(25),O={parseJSON:function(e,t,n){var r,i,a,o={},s=n.sym(t);for(var u in e){0===u.indexOf("_:")?o[u]?r=o[u]:(r=n.bnode(u),o[u]=r):r=n.sym(u);var c=e[u];for(var l in c){var h=c[l];for(var d in i=n.sym(l),h){var f=h[d];if("uri"===f.type)a=n.sym(f.value),n.add(r,i,a,s);else if("BlankNode"===f.type)o[f.value]?a=o[f.value]:(a=n.bnode(f.value),o[f.value]=a),n.add(r,i,a,s);else{if("Literal"!==f.type)throw new Error("error: unexpected termtype: "+d.type);a=f.datatype?n.literal(f.value,void 0,n.sym(f.datatype)):f.lang?n.literal(f.value,f.lang):n.literal(f.value),n.add(r,i,a,s)}}}}}},I=n(18),S=n(2),E=n(34),R=n(8),A=n(13),C=n(27),L=n(46),D=n(37);function P(e){var t=0;function n(e){var t="",n=e.statements;for(var r in n)S.a.debug("Found statement: "+n),t+=a()+n[r]+"\n";return t}function r(e){var t="";for(var n in e.constraints){var r=e.constraints[n];t+=a()+"FILTER ( "+r.describe(n)+" ) \n"}return t}function i(e){var i=a()+"WHERE \n{ \n";return t++,i+=n(e),i+=r(e),i+=function e(i){for(var o="",s=0;s<i.optional.length;s++)S.a.debug("Found optional query"),o+=a()+"OPTIONAL { \n",t++,o+=n(i.optional[s]),o+=r(i.optional[s]),o+=e(i.optional[s]),t--,o+=a()+"}\n";return o}(e),t--,i+="}"}function a(){for(var e="",n=0;n<t;n++)e+=" ";return e}return function(e){return function(e){for(var t=a()+"SELECT ",n=0;n<e.vars.length;n++)t+=e.vars[n]+" ";return t+="\n"}(e)+i(e.pat)}(e)}var M=n(36),F=n(42),U=n(40),q=n(43);function B(e,t,n){var r=[];function i(e){if(r[e])return r[e];var t=n.variable(e);return r[e]=t,t}function a(e){return"string"==typeof e&&e.match(/[^ \n\t]/)}function o(e){return"string"==typeof e&&e.match(/^[\?\$]/)}function s(e){return"string"==typeof e?e.replace(/^&lt;/,"<").replace(/&gt;$/,">"):e}function u(e){return"string"==typeof e&&e.match(/^<[^>]*>$/)}function c(e){return"string"==typeof e&&(e.match(/^_:/)||e.match(/^$/))}function l(e){return"string"==typeof e&&e.match(/:$/)}function h(e){return"string"==typeof e&&e.match(/^:|^[^_][^:]*:/)}function d(e){return e.split(":")[0]}function f(e){return e.split(":")[1]}function p(e){return u(e)?e.slice(1,e.length-1):e}function v(e){e=e.replace(/\(/g," ( ").replace(/\)/g," ) ").replace(/</g," <").replace(/>/g,"> ").replace(/{/g," { ").replace(/}/g," } ").replace(/[\t\n\r]/g," ").replace(/; /g," ; ").replace(/\. /g," . ").replace(/, /g," , "),S.a.info("New str into spaceDelimit: \n"+e);var t=[],n=e.split(" ");for(var r in n)a(n[r])&&(t=t.concat(n[r]));return t}function y(e,t){for(var n=0;n<t.length;n++)if("string"==typeof t[n]&&t[n].toLowerCase()===e.toLowerCase())return n;return null}function g(e,t){for(var n=[],r=0;r<t.length;r++)"string"==typeof t[r]&&t[r].toLowerCase()===e.toLowerCase()&&n.push(r);return n}function m(e,t,n){S.a.info("Looking for a close bracket of type "+n+" in "+e);for(var r=0,i=0;i<e.length;i++)if(e[i]===t&&r++,e[i]===n&&r--,r<0)return i;return S.a.error("Statement had no close parenthesis in SPARQL query"),0}function b(e){return this.describe=function(t){return t+" = "+e.toNT()},this.test=function(t){return e.equals(t)},this}function w(e){this.describe=function(t){return"REGEXP( '"+e+"' , "+t+" )"},this.test=function(t){var n=new RegExp(e);return!!t.value&&n.test(t.value)}}function x(e,t){3!==e.length||"Variable"!==e[0].termType||"NamedNode"!==e[2].termType&&"Literal"!==e[2].termType?6===e.length&&"string"==typeof e[0]&&"regexp"===e[0].toLowerCase()&&"("===e[1]&&")"===e[5]&&","===e[3]&&"Variable"===e[4].termType&&"Literal"===e[2].termType&&(S.a.debug("Constraint added: "+e),t.constraints[e[4]]=new w(e[2].value)):"="===e[1]||">"===e[1]||"<"===e[1]?(S.a.debug("Constraint added: "+e),t.constraints[e[0]]=new b(e[2])):S.a.warn("I don't know how to handle the constraint: "+e)}function _(e,t){S.a.debug("Optional query: "+e+" not yet implemented.");var r=n.formula();k(e,r),t.optional.push(r)}function k(e,t){var r,a,l=function(e){for(var t=[],r=0;r<e.length;r++)"string"==typeof e[r]?(e[r]=s(e[r]),o(e[r])?t[r]=i(e[r].slice(1)):c(e[r])?(S.a.info(e[r]+" was identified as a bnode."),t[r]=n.bnode()):u(e[r])?(S.a.info(e[r]+" was identified as a symbol."),t[r]=n.sym(p(e[r]))):h(e[r])?(S.a.info(e[r]+" was identified as a prefixed symbol"),j[d(e[r])]?t[r]=n.sym(e[r]=j[d(e[r])]+f(e[r])):(S.a.error("SPARQL error: "+e[r]+" with prefix "+d(e[r])+" does not have a correct prefix entry."),t[r]=e[r])):t[r]=e[r]):t[r]=e[r];return t}(e);for(S.a.debug("WHERE: "+l);y("OPTIONAL",l);)a=y("OPTIONAL",l),S.a.debug("OPT: "+a+" "+l[a]+" in "+l),"{"!==l[a+1]&&S.a.warn("Bad optional opening bracket in word "+a),-1===(r=m(l.slice(a+2),"{","}"))?S.a.error("No matching bracket in word "+a):(_(l.slice(a+2,a+2+r),t),a=y("OPTIONAL",l),r=m(l.slice(a+2),"{","}"),l.splice(a,r+3));for(S.a.debug("WHERE after optionals: "+l);y("FILTER",l);){var v=y("FILTER",l);"("!==l[v+1]&&S.a.warn("Bad filter opening bracket in word "+v),-1===(r=m(l.slice(v+2),"(",")"))?S.a.error("No matching bracket in word "+v):(x(l.slice(v+2,v+2+r),t),v=y("FILTER",l),r=m(l.slice(v+2),"(",")"),l.splice(v,r+3))}S.a.debug("WHERE after filters and optionals: "+l),function(e,t){var n=new Array(1);n[0]=-1;for(var r=n.concat(g(".",e)),i=[],a=0;a<r.length-1;a++)i[a]=e.slice(r[a]+1,r[a+1]);for(a in i){S.a.info("s+p+o "+a+" = "+i[a]);var o=i[a][0];i[a].splice(0,1);var s=n.concat(g(";",i[a]));s.push(i[a].length);for(var u=[],c=0;c<s.length-1;c++)u[c]=i[a].slice(s[c]+1,s[c+1]);for(a in u){S.a.info("p+o "+a+" = "+i[a]);var l=u[a][0];u[a].splice(0,1);var h=n.concat(g(",",u[a]));h.push(u[a].length);var d=[];for(c=0;c<h.length-1;c++)d[c]=u[a].slice(h[c]+1,h[c+1]);for(a in d){var f=d[a][0];S.a.info("Subj="+o+" Pred="+l+" Obj="+f),t.add(o,l,f)}}}}(l,t)}S.a.info("SPARQL input: \n"+e);var T=new D.a,N=function(e){var t=function e(t){var r=-1===t.indexOf("'")?null:t.indexOf("'"),i=-1===t.indexOf('"')?null:t.indexOf('"');if(!r&&!i){var a=new Array(1);return a[0]=t,a}var o,s,u=new Array(2);if(!r||i&&i<r)o='"',s=i;else{if(i&&!(r&&r<i))return S.a.error("SQARQL QUERY OOPS!"),u;o="'",s=r}u[0]=t.slice(0,s);var c,l=t.slice(s+1).indexOf(o);return-1===l?(S.a.error("SPARQL parsing error: no matching parentheses in literal "+t),t):(t.slice(l+s+2).match(/^\^\^/)?(c=t.slice(l+s+2).indexOf(" "),u[1]=n.literal(t.slice(s+1,s+1+l),n.sym(p(t.slice(s+4+l,s+2+l+c)))),u=u.concat(e(t.slice(l+s+3+c)))):t.slice(l+s+2).match(/^@/)?(c=t.slice(l+s+2).indexOf(" "),u[1]=n.literal(t.slice(s+1,s+1+l),t.slice(s+3+l,s+2+l+c),null),u=u.concat(e(t.slice(l+s+2+c)))):(u[1]=n.literal(t.slice(s+1,s+1+l)),S.a.info("Literal found: "+u[1]),u=u.concat(e(t.slice(l+s+2)))),u)}(e),r=[];for(var i in t)r="string"==typeof t[i]?r.concat(v(t[i])):r.concat(t[i]);return r=function(e){for(var t=e,n=0;n<t.length;n++)if("a"===t[n]&&(t[n]="<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>"),"is"===t[n]&&"of"===t[n+2]){t.splice(n,1),t.splice(n+1,1);var r=t[n-1];t[n-1]=t[n+1],t[n+1]=r}return t}(r),S.a.info("SPARQL Tokens: "+r),r}(e),j=function(e){var t=g("PREFIX",e),n=[];for(var r in t){var i=e[t[r]+1],a=e[t[r]+2];if(l(i))if(u(a)){S.a.info("Prefix found: "+i+" -> "+a);var o=d(i),s=p(a);n[o]=s}else S.a.error("Invalid SPARQL symbol: "+a);else S.a.error("Invalid SPARQL prefix: "+i)}return n}(N);j.rdf||(j.rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"),j.rdfs||(j.rdfs="http://www.w3.org/2000/01/rdf-schema#");var O=y("SELECT",N),I=y("WHERE",N);if(O<0||I<0||O>I)return S.a.error("Invalid or nonexistent SELECT and WHERE tags in SPARQL query"),!1;if(function(e,t){for(var n in S.a.info("SPARQL vars: "+e),e)if(o(e[n])){S.a.info("Added "+e[n]+" to query variables from SPARQL");var r=i(e[n].slice(1));t.vars.push(r),r.label=e[n].slice(1)}else S.a.warn("Incorrect SPARQL variable in SELECT: "+e[n])}(N.slice(O+1,I),T),k(N.slice(I+2,N.length-1),T.pat),t)return T;for(var E in T.pat.statements){var R=T.pat.statements[E];"NamedNode"===R.subject.termType&&n.fetcher&&n.fetcher.lookUpThing(R.subject,"sparql:"+R.subject),"NamedNode"===R.object.termType&&n.fetcher&&n.fetcher.lookUpThing(R.object,"sparql:"+R.object)}return T}var H=n(51),V=n(45),z=n(22),X=n.n(z),Q=n(6),$=n(7),G=n(10),J=n(26);function W(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Y(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function Y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Z=function(){function e(t){if(i()(this,e),b()(this,"store",void 0),b()(this,"ifps",void 0),b()(this,"fps",void 0),b()(this,"patchControl",void 0),b()(this,"ns",void 0),(t=t||new j.a).updater)throw new Error("You can't have two UpdateManagers for the same store");t.fetcher||(t.fetcher=new T.a(t)),this.store=t,t.updater=this,this.ifps={},this.fps={},this.ns={},this.ns.link=Object(A.a)("http://www.w3.org/2007/ont/link#"),this.ns.http=Object(A.a)("http://www.w3.org/2007/ont/http#"),this.ns.httph=Object(A.a)("http://www.w3.org/2007/ont/httph#"),this.ns.ldp=Object(A.a)("http://www.w3.org/ns/ldp#"),this.ns.rdf=Object(A.a)("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),this.ns.rdfs=Object(A.a)("http://www.w3.org/2000/01/rdf-schema#"),this.ns.rdf=Object(A.a)("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),this.ns.owl=Object(A.a)("http://www.w3.org/2002/07/owl#"),this.patchControl=[]}return g()(e,[{key:"patchControlFor",value:function(e){return this.patchControl[e.value]||(this.patchControl[e.value]=[]),this.patchControl[e.value]}},{key:"isHttpUri",value:function(e){return"http"===e.slice(0,4)}},{key:"editable",value:function(e,t){if(!e)return!1;if(t||(t=this.store),e=Object(J.a)(e),!this.isHttpUri(e)&&t.holds(this.store.rdfFactory.namedNode(e),this.store.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),this.store.rdfFactory.namedNode("http://www.w3.org/2007/ont/link#MachineEditableDocument")))return"LOCALFILE";for(var n,r,i=!1,a=t.each(void 0,this.ns.link("requestedURI"),Object(Q.docpart)(e)),o=0;o<a.length;o++)if(void 0!==(n=a[o])){var s=t.any(n,this.ns.link("response"));if(void 0!==n){var u=t.anyValue(s,this.ns.httph("wac-allow"));if(u){var c,l=W(u.split(","));try{for(l.s();!(c=l.n()).done;){var h=c.value.split("=");if(h[0].includes("user")&&!h[1].includes("write")&&!h[1].includes("append"))return!1}}catch(e){l.e(e)}finally{l.f()}}var d=t.each(s,this.ns.httph("accept-patch"));if(d.length)for(var f=0;f<d.length;f++){if((r=d[f].value.trim()).indexOf("application/sparql-update")>=0)return"SPARQL";if(r.indexOf("application/sparql-update-single-match")>=0)return"SPARQL"}var p=t.each(s,this.ns.httph("ms-author-via"));if(p.length)for(var v=0;v<p.length;v++){if((r=p[v].value.trim()).indexOf("SPARQL")>=0)return"SPARQL";if(r.indexOf("DAV")>=0)return"DAV"}if(!this.isHttpUri(e))return!!u&&"LOCALFILE";var y=t.each(s,this.ns.http("status"));if(y.length)for(var g=0;g<y.length;g++)200!==y[g]&&404!==y[g]||(i=!0)}}if(0===a.length);else if(i)return!1}},{key:"anonymize",value:function(e){return"_:"===e.toNT().substr(0,2)&&this.mentioned(e)?"?"+e.toNT().substr(2):e.toNT()}},{key:"anonymizeNT",value:function(e){return this.anonymize(e.subject)+" "+this.anonymize(e.predicate)+" "+this.anonymize(e.object)+" ."}},{key:"statementBnodes",value:function(e){return[e.subject,e.predicate,e.object].filter((function(e){return Object($.a)(e)}))}},{key:"statementArrayBnodes",value:function(e){for(var t=[],n=0;n<e.length;n++)t=t.concat(this.statementBnodes(e[n]));t.sort();for(var r=[],i=0;i<t.length;i++)0!==i&&t[i].equals(t[i-1])||r.push(t[i]);return r}},{key:"cacheIfps",value:function(){this.ifps={};for(var e=this.store.each(void 0,this.ns.rdf("type"),this.ns.owl("InverseFunctionalProperty")),t=0;t<e.length;t++)this.ifps[e[t].value]=!0;this.fps={},e=this.store.each(void 0,this.ns.rdf("type"),this.ns.owl("FunctionalProperty"));for(var n=0;n<e.length;n++)this.fps[e[n].value]=!0}},{key:"bnodeContext2",value:function(e,t,n){for(var r,i,a=this.store.statementsMatching(void 0,void 0,e,t),o=0;o<a.length;o++)if(this.fps[a[o].predicate.value]){if(!(r=a[o].subject).isBlank)return[a[o]];if(n&&(i=this.bnodeContext2(r,t,n-1)))return i.concat([a[o]])}a=this.store.statementsMatching(e,void 0,void 0,t);for(var s=0;s<a.length;s++)if(this.ifps[a[s].predicate.value]){if(!(r=a[s].object).isBlank)return[a[s]];if(n&&(i=this.bnodeContext2(r,t,n-1)))return i.concat([a[s]])}return null}},{key:"bnodeContext1",value:function(e,t){for(var n=0;n<3;n++){var r=this.bnodeContext2(e,t,n);if(null!==r)return r}return this.store.connectedStatements(e,t)}},{key:"mentioned",value:function(e){return 0!==this.store.statementsMatching(e,null,null,null).length||0!==this.store.statementsMatching(null,e).length||0!==this.store.statementsMatching(null,null,e).length}},{key:"bnodeContext",value:function(e,t){var n=[];if(e.length){this.cacheIfps();for(var r=0;r<e.length;r++){var i=e[r];this.mentioned(i)&&(n=n.concat(this.bnodeContext1(i,t)))}}return n}},{key:"statementContext",value:function(e){var t=this.statementBnodes(e);return this.bnodeContext(t,e.graph)}},{key:"contextWhere",value:function(e){var t=this;return e&&0!==e.length?"WHERE { "+e.map((function(e){return t.anonymizeNT(e)})).join("\n")+" }\n":""}},{key:"fire",value:function(e,t,n){var r=this;return Promise.resolve().then((function(){if(!e)throw new Error("No URI given for remote editing operation: "+t);var n={noMeta:!0,contentType:"application/sparql-update",body:t};return r.store.fetcher.webOperation("PATCH",e,n)})).then((function(r){if(!r.ok){var i="UpdateManager: update failed for <"+e+"> status="+r.status+", "+r.statusText+"\n for query: "+t;throw new Error(i)}n(e,r.ok,r.responseText,r)})).catch((function(t){n(e,!1,t.message,t)}))}},{key:"update_statement",value:function(e){if(!e||e.graph){var t=this,n=this.statementContext(e);return{statement:e?[e.subject,e.predicate,e.object,e.graph]:void 0,statementNT:e?this.anonymizeNT(e):void 0,where:t.contextWhere(n),set_object:function(e,n){var r=this.where;r+="DELETE DATA { "+this.statementNT+" } ;\n",r+="INSERT DATA { "+this.anonymize(this.statement[0])+" "+this.anonymize(this.statement[1])+" "+this.anonymize(e)+" . }\n",t.fire(this.statement[3].value,r,n)}}}}},{key:"insert_statement",value:function(e,t){var n=e instanceof Array?e[0]:e,r=this.contextWhere(this.statementContext(n));if(e instanceof Array){for(var i="",a=0;a<e.length;a++)i+=e[a]+"\n";r+="INSERT DATA { "+i+" }\n"}else r+="INSERT DATA { "+this.anonymize(e.subject)+" "+this.anonymize(e.predicate)+" "+this.anonymize(e.object)+" . }\n";this.fire(n.graph.value,r,t)}},{key:"delete_statement",value:function(e,t){var n=e instanceof Array?e[0]:e,r=this.contextWhere(this.statementContext(n));if(e instanceof Array){for(var i="",a=0;a<e.length;a++)i+=e[a]+"\n";r+="DELETE DATA { "+i+" }\n"}else r+="DELETE DATA { "+this.anonymize(e.subject)+" "+this.anonymize(e.predicate)+" "+this.anonymize(e.object)+" . }\n";this.fire(n.graph.value,r,t)}},{key:"requestDownstreamAction",value:function(e,t){var n=this.patchControlFor(e);if(n.pendingUpstream)if(n.downstreamAction){if(""+n.downstreamAction!=""+t)throw new Error("Can't wait for > 1 different downstream actions")}else n.downstreamAction=t;else t(e)}},{key:"clearUpstreamCount",value:function(e){this.patchControlFor(e).upstreamCount=0}},{key:"getUpdatesVia",value:function(e){var t=this.store.fetcher.getHeader(e,"updates-via");return t&&t.length?t[0].trim():null}},{key:"addDownstreamChangeListener",value:function(e,t){var n=this,r=this.patchControlFor(e);r.downstreamChangeListeners||(r.downstreamChangeListeners=[]),r.downstreamChangeListeners.push(t),this.setRefreshHandler(e,(function(e){n.reloadAndSync(e)}))}},{key:"reloadAndSync",value:function(e){var t=this.patchControlFor(e),n=this;if(t.reloading)t.outOfDate=!0;else{t.reloading=!0;var r=1e3;!function i(){n.reload(n.store,e,(function(e,n,a){if(e){if(t.downstreamChangeListeners)for(var o=0;o<t.downstreamChangeListeners.length;o++)t.downstreamChangeListeners[o]();t.reloading=!1,t.outOfDate&&(t.outOfDate=!1,i())}else t.reloading=!1,0===a.status&&(t.reloading=!0,r*=2,setTimeout(i,r))}))}()}}},{key:"setRefreshHandler",value:function(e,t){var n=this.getUpdatesVia(e),r=t,i=this,a=this,o=1500,s=0;if(!n)return!1;var u=(n=Object(Q.join)(n,e.value)).replace(/^http:/,"ws:").replace(/^https:/,"wss:");return function t(){var n;if("undefined"!=typeof WebSocket)n=new WebSocket(u);else{if("undefined"==typeof window||!window.WebSocket)return;n=window.WebSocket(u)}n.onopen=function(){o=1500,this.send("sub "+e.value),s&&a.requestDownstreamAction(e,r)};var c=i.patchControlFor(e);c.upstreamCount=0,n.onerror=function(e){},n.onclose=function(e){o*=2,s+=1,setTimeout((function(){t()}),o)},n.onmessage=function(t){if(t.data&&"pub"===t.data.slice(0,3)){if("upstreamCount"in c&&(c.upstreamCount-=1,c.upstreamCount>=0))return;c.upstreamCount=0,i.requestDownstreamAction(e,r)}}}(),!0}},{key:"updateMany",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=e.concat(t).map((function(e){return e.why})),r=this,i=[];n.forEach((function(e){i.find((function(t){return t.equals(e)}))||i.push(e)}));var a=i.map((function(n){return r.update(e.filter((function(e){return e.why.equals(n)})),t.filter((function(e){return e.why.equals(n)})))}));return a.length>1&&console.log("@@ updateMany to ".concat(a.length,": ").concat(i)),Promise.all(a)}},{key:"update",value:function(e,t,n,r){var i=this;if(!n){var a=this;return new Promise((function(n,r){a.update(e,t,(function(e,t,i){t?n():r(new Error(i))}))}))}try{var o=this.store,s=e?Object($.k)(e)?e.statements:e instanceof Array?e:[e]:[],u=t?Object($.k)(t)?t.statements:t instanceof Array?t:[t]:[];if(!(s instanceof Array))throw new Error("Type Error "+X()(s)+": "+s);if(!(u instanceof Array))throw new Error("Type Error "+X()(u)+": "+u);if(0===s.length&&0===u.length)return n(null,!0);var c=s.length?s[0].graph:u[0].graph;if(!c){var l="Error patching: statement does not specify which document to patch:"+s[0]+", "+u[0];throw new Error(l)}var h=this.patchControlFor(c),d=Date.now(),f=["subject","predicate","object","why"],p={delete:s,insert:u};["insert","delete"].map((function(e){p[e].map((function(e){if(!c.equals(e.graph))throw new Error("update: destination "+c+" inconsistent with delete quad "+e.graph);f.map((function(t){if(void 0===e[t])throw new Error("update: undefined "+t+" of statement.")}))}))}));var v=this.editable(c.value,o);if(!1===v)throw new Error("Update: Can't make changes in uneditable "+c);if(void 0===v){if(r)throw new Error("Update: Loaded "+c+"but stil can't figure out what editing protcol it supports.");return void this.store.fetcher.load(c).then((function(r){i.update(e,t,n,!0)}),(function(r){if(404!==r.response.status)throw new Error("Update: Can't get updatability status ".concat(c," before patching: ").concat(r));i.update(e,t,n,!0)}))}if(v.indexOf("SPARQL")>=0){var y=[];s.length&&(y=this.statementArrayBnodes(s)),u.length&&(y=y.concat(this.statementArrayBnodes(u)));var g=this.bnodeContext(y,c),m=this.contextWhere(g),b="";if(m.length){if(s.length){b+="DELETE { ";for(var w=0;w<s.length;w++)b+=this.anonymizeNT(s[w])+"\n";b+=" }\n"}if(u.length){b+="INSERT { ";for(var x=0;x<u.length;x++)b+=this.anonymizeNT(u[x])+"\n";b+=" }\n"}b+=m}else{if(s.length){b+="DELETE DATA { ";for(var _=0;_<s.length;_++)b+=this.anonymizeNT(s[_])+"\n";b+=" } \n"}if(u.length){s.length&&(b+=" ; "),b+="INSERT DATA { ";for(var k=0;k<u.length;k++)b+=this.anonymizeNT(u[k])+"\n";b+=" }\n"}}h.pendingUpstream=h.pendingUpstream?h.pendingUpstream+1:1,"upstreamCount"in h&&(h.upstreamCount+=1),this.fire(c.value,b,(function(e,t,r,i){if(i.elapsedTimeMs=Date.now()-d,console.log(" UpdateManager: Return "+(t?"success ":"FAILURE ")+i.status+" elapsed "+i.elapsedTimeMs+"ms"),t){try{o.remove(s)}catch(e){t=!1,r="Remote Ok BUT error deleting "+s.length+" from store!!! "+e}for(var a=0;a<u.length;a++)o.add(u[a].subject,u[a].predicate,u[a].object,c)}if(n(e,t,r,i),h.pendingUpstream-=1,0===h.pendingUpstream&&h.downstreamAction){var l=h.downstreamAction;delete h.downstreamAction,l(c)}}))}else if(v.indexOf("DAV")>=0)this.updateDav(c,s,u,n);else{if(!(v.indexOf("LOCALFILE")>=0))throw new Error("Unhandled edit method: '"+v+"' for "+c);try{this.updateLocalFile(c,s,u,n)}catch(e){n(c.value,!1,"Exception trying to write back file <"+c.value+">\n")}}}catch(e){n(void 0,!1,"Exception in update: "+e+"\n"+G.stackString(e))}}},{key:"updateDav",value:function(e,t,n,r){var i=this.store,a=i.any(e,this.ns.link("request"));if(!a)throw new Error("No record of our HTTP GET request for document: "+e);var o=i.any(a,this.ns.link("response"));if(!o)return null;for(var s=i.the(o,this.ns.httph("content-type")).value,u=i.statementsMatching(void 0,void 0,void 0,e).slice(),c=0;c<t.length;c++)G.RDFArrayRemove(u,t[c]);for(var l=0;l<n.length;l++)u.push(n[l]);var h,d=this.serialize(e.value,u,s),f=i.the(o,this.ns.httph("content-location"));f&&(h=Object(Q.join)(f.value,h));var p={contentType:s,noMeta:!0,body:d};return i.fetcher.webOperation("PUT",h,p).then((function(a){if(!a.ok)throw new Error(a.error);for(var o=0;o<t.length;o++)i.remove(t[o]);for(var s=0;s<n.length;s++)i.add(n[s].subject,n[s].predicate,n[s].object,e);r(e.value,a.ok,a.responseText,a)})).catch((function(t){r(e.value,!1,t.message,t)}))}},{key:"updateLocalFile",value:function(e,t,n,r){for(var i=this.store,a=i.statementsMatching(void 0,void 0,void 0,e).slice(),o=0;o<t.length;o++)G.RDFArrayRemove(a,t[o]);for(var s=0;s<n.length;s++)a.push(n[s]);var u=e.value.lastIndexOf(".");if(u<1)throw new Error("Rewriting file: No filename extension: "+e.value);var c=e.value.slice(u+1),l=T.a.CONTENT_TYPE_BY_EXT[c];if(!l)throw new Error("File extension ."+c+" not supported for data write");var h=this.serialize(e.value,a,l);i.fetcher.webOperation("PUT",e.value,{body:h,contentType:l}).then((function(a){if(!a.ok)return r(e.value,!1,a.error);for(var o=0;o<t.length;o++)i.remove(t[o]);for(var s=0;s<n.length;s++)i.add(n[s].subject,n[s].predicate,n[s].object,e);r(e.value,!0,"")}))}},{key:"serialize",value:function(e,t,n){var r,i=this.store;if("string"==typeof t)return t;var a=Object(q.a)(i);switch(a.suggestNamespaces(i.namespaces),a.setBase(e),n){case"text/xml":case"application/rdf+xml":r=a.statementsToXML(t);break;case"text/n3":case"text/turtle":case"application/x-turtle":case"application/n3":r=a.statementsToN3(t);break;default:throw new Error("Content-type "+n+" not supported for data serialization")}return r}},{key:"put",value:function(e,t,n,r){var i,a=this,o=this.store;return Promise.resolve().then((function(){return i=a.serialize(e.value,t,n),o.fetcher.webOperation("PUT",e.value,{contentType:n,body:i})})).then((function(n){if(!n.ok)return r(e.value,n.ok,n.error,n);delete o.fetcher.nonexistent[e.value],delete o.fetcher.requested[e.value],"string"!=typeof t&&t.map((function(e){o.addStatement(e)})),r(e.value,n.ok,"",n)})).catch((function(t){r(e.value,!1,t.message)}))}},{key:"reload",value:function(e,t,n){var r=Date.now();e.fetcher.nowOrWhenFetched(t.value,{force:!0,noMeta:!0,clearPreviousData:!0},(function(e,i,a){if(e)if(a.onErrorWasCalled||200!==a.status)n(!1,"Non-HTTP error reloading data: "+i,a);else{var o=Date.now()-r;t.reloadTimeTotal||(t.reloadTimeTotal=0),t.reloadTimeCount||(t.reloadTimeCount=0),t.reloadTimeTotal+=o,t.reloadTimeCount+=1,n(!0)}else n(!1,"Error reloading data: "+i,a)}))}}]),e}(),K=n(48);function ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ee(Object(n),!0).forEach((function(t){b()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ee(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ne=te(te({},K.a),{},{fetcher:function(e,t){return new T.a(e,t)},graph:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return new j.a(e,t||{rdfFactory:K.a})},lit:function(e,t,n){return this.literal(""+e,t||n)},st:function(e,t,n,r){return this.quad(e,t,n,r)}}),re=function(){function e(t,n){i()(this,e),this.parent=t,this.via=n,this.connected=!1,this.pending={},this.subscribed={},this.socket={};try{this.socket=new WebSocket(n),this.socket.onopen=this.onOpen,this.socket.onclose=this.onClose,this.socket.onmessage=this.onMessage,this.socket.onerror=this.onError}catch(e){this.onError(e)}}return g()(e,[{key:"_decode",value:function(e){var t,n,r,i,a,o,s;for(n in i={},a=function(){var n,r,i,a;for(a=[],n=0,r=(i=e.split("&")).length;n<r;n++)t=i[n],a.push(t.split("="));return a}())t=a[n],s=(o=[decodeURIComponent(t[0]),decodeURIComponent(t[1])])[1],null==i[r=o[0]]&&(i[r]=[]),i[r].push(s);return i}},{key:"_send",value:function(e,t,n){var r,i;return i=[e,t,n].join(" "),"function"==typeof(r=this.socket).send?r.send(i):void 0}},{key:"_subscribe",value:function(e){return this._send("sub",e,""),this.subscribed[e]=!0,this.subscribed[e]}},{key:"onClose",value:function(e){var t;for(t in this.connected=!1,this.subscribed)this.pending[t]=!0;return this.subscribed={},this.subscribed}},{key:"onError",value:function(e){throw new Error("onError"+e)}},{key:"onMessage",value:function(e){var t,n;return"ping"===(n=e.data.split(" "))[0]?"function"==typeof(t=this.socket).send?t.send("pong "+n.slice(1).join(" ")):void 0:"pub"===n[0]?this.parent.onUpdate(n[1],this._decode(n[2])):void 0}},{key:"onOpen",value:function(e){var t,n;for(n in this.connected=!0,t=[],this.pending)delete this.pending[n],t.push(this._subscribe(n));return t}},{key:"subscribe",value:function(e){return this.connected?this._subscribe(e):(this.pending[e]=!0,this.pending[e])}}]),e}(),ie=function(){function e(t){i()(this,e),this.fetcher=t,this.graph={},this.via={},this.fetcher.addCallback("headers",this.onHeaders)}return g()(e,[{key:"onHeaders",value:function(e){var t,n,r;return null==e.headers||"undefined"==typeof WebSocket||null===WebSocket||(t=e.headers.etag,r=e.headers["updates-via"],n=e.uri,t&&r&&(this.graph[n]={etag:t,via:r},this.register(r,n))),!0}},{key:"onUpdate",value:function(e,t){return this.fetcher.refresh(ne.namedNode(e))}},{key:"register",value:function(e,t){return null==this.via[e]&&(this.via[e]=new re(this,e)),this.via[e].subscribe(t)}}]),e}(),ae=n(23);function oe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=d()(e);if(t){var i=d()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return l()(this,n)}}var se={};for(var ue in ne)"function"==typeof ne[ue]&&(se[ue]=ne[ue].bind(ne));var ce=se.fetcher,le=se.graph,he=se.lit,de=se.st,fe=se.namedNode,pe=se.variable,ve=se.blankNode,ye=se.defaultGraph,ge=se.literal,me=se.quad,be=se.triple,we=new N.a,xe=function(e){return we.fromNT(e)},_e=C.a.fromValue,ke=f.a.nextId,Te=function(e){u()(n,e);var t=oe(n);function n(e){var r;return i()(this,n),(r=t.call(this,e)).fetcher=new T.a(o()(r),{}),r}return n}(j.a),Ne=function(e){u()(n,e);var t=oe(n);function n(e){var r;return i()(this,n),(r=t.call(this,e)).updater=new Z(o()(r)),r}return n}(Te)},function(e,t,n){e.exports=n(77)},function(e,t){const n={acl:"http://www.w3.org/ns/auth/acl#",arg:"http://www.w3.org/ns/pim/arg#",as:"https://www.w3.org/ns/activitystreams#",cal:"http://www.w3.org/2002/12/cal/ical#",cert:"http://www.w3.org/ns/auth/cert#",contact:"http://www.w3.org/2000/10/swap/pim/contact#",dc:"http://purl.org/dc/elements/1.1/",dct:"http://purl.org/dc/terms/",doap:"http://usefulinc.com/ns/doap#",foaf:"http://xmlns.com/foaf/0.1/",geo:"http://www.w3.org/2003/01/geo/wgs84_pos#",gpx:"http://www.w3.org/ns/pim/gpx#",http:"http://www.w3.org/2007/ont/http#",httph:"http://www.w3.org/2007/ont/httph#",icalTZ:"http://www.w3.org/2002/12/cal/icaltzd#",ldp:"http://www.w3.org/ns/ldp#",link:"http://www.w3.org/2007/ont/link#",log:"http://www.w3.org/2000/10/swap/log#",meeting:"http://www.w3.org/ns/pim/meeting#",mo:"http://purl.org/ontology/mo/",org:"http://www.w3.org/ns/org#",owl:"http://www.w3.org/2002/07/owl#",pad:"http://www.w3.org/ns/pim/pad#",patch:"http://www.w3.org/ns/pim/patch#",prov:"http://www.w3.org/ns/prov#",qu:"http://www.w3.org/2000/10/swap/pim/qif#",trip:"http://www.w3.org/ns/pim/trip#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",rss:"http://purl.org/rss/1.0/",sched:"http://www.w3.org/ns/pim/schedule#",schema:"http://schema.org/",sioc:"http://rdfs.org/sioc/ns#",solid:"http://www.w3.org/ns/solid/terms#",space:"http://www.w3.org/ns/pim/space#",stat:"http://www.w3.org/ns/posix/stat#",tab:"http://www.w3.org/2007/ont/link#",tabont:"http://www.w3.org/2007/ont/link#",ui:"http://www.w3.org/ns/ui#",vcard:"http://www.w3.org/2006/vcard/ns#",wf:"http://www.w3.org/2005/01/wf/flow#",xsd:"http://www.w3.org/2001/XMLSchema#",cco:"http://www.ontologyrepository.com/CommonCoreOntologies/"};e.exports=function(e={namedNode:e=>e}){const t={};for(const r in n){const i=n[r];t[r]=function(t=""){return e.namedNode(i+t)}}return t}},function(e,t,n){"use strict";(function(t){const r=n(58),i=n(66),a=n(67),o=n(59);function s(e,t){return e.hash<t.hash?-1:e.hash>t.hash?1:0}e.exports=class{constructor(){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n"),this.hashAlgorithm="sha256",this.quads=null}async main(e){this.quads=e;for(const t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});const t=new Map,n=[...this.blankNodeInfo.keys()];let i=0;for(const e of n)++i%100==0&&await this._yield(),await this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});const a=[...t.keys()].sort(),u=[];for(const e of a){const n=t.get(e);if(n.length>1){u.push(n);continue}const r=n[0];this.canonicalIssuer.getId(r)}for(const e of u){const t=[];for(const n of e){if(this.canonicalIssuer.hasId(n))continue;const e=new r("_:b");e.getId(n);const i=await this.hashNDegreeQuads(n,e);t.push(i)}t.sort(s);for(const e of t){const t=e.issuer.getOldIds();for(const e of t)this.canonicalIssuer.getId(e)}}const c=[];for(const e of this.quads){const t={...e};t.subject=this._useCanonicalId({component:t.subject}),t.object=this._useCanonicalId({component:t.object}),t.graph=this._useCanonicalId({component:t.graph}),c.push(o.serializeQuad(t))}return c.sort(),c.join("")}async hashFirstDegreeQuads(e){const t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(const n of r){const r={subject:null,predicate:n.predicate,object:null,graph:null};r.subject=this.modifyFirstDegreeComponent(e,n.subject,"subject"),r.object=this.modifyFirstDegreeComponent(e,n.object,"object"),r.graph=this.modifyFirstDegreeComponent(e,n.graph,"graph"),t.push(o.serializeQuad(r))}t.sort();const a=new i(this.hashAlgorithm);for(const e of t)a.update(e);return n.hash=await a.digest(),n.hash}async hashRelatedBlankNode(e,t,n,r){let a;a=this.canonicalIssuer.hasId(e)?this.canonicalIssuer.getId(e):n.hasId(e)?n.getId(e):this.blankNodeInfo.get(e).hash;const o=new i(this.hashAlgorithm);return o.update(r),"g"!==r&&o.update(this.getRelatedPredicate(t)),o.update(a),o.digest()}async hashNDegreeQuads(e,t){const n=new i(this.hashAlgorithm),r=await this.createHashToRelated(e,t),o=[...r.keys()].sort();for(const e of o){n.update(e);let i,o="";const s=new a(r.get(e));let u=0;for(;s.hasNext();){const e=s.next();++u%3==0&&await this._yield();let n=t.clone(),r="";const a=[];let c=!1;for(const t of e)if(this.canonicalIssuer.hasId(t)?r+=this.canonicalIssuer.getId(t):(n.hasId(t)||a.push(t),r+=n.getId(t)),0!==o.length&&r>o){c=!0;break}if(!c){for(const e of a){const t=await this.hashNDegreeQuads(e,n);if(r+=n.getId(e),r+=`<${t.hash}>`,n=t.issuer,0!==o.length&&r>o){c=!0;break}}c||(0===o.length||r<o)&&(o=r,i=n)}}n.update(o),t=i}return{hash:await n.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return"BlankNode"!==t.termType?t:{termType:"BlankNode",value:t.value===e?"_:a":"_:z"}}getRelatedPredicate(e){return`<${e.predicate.value}>`}async createHashToRelated(e,t){const n=new Map,r=this.blankNodeInfo.get(e).quads;let i=0;for(const 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}){const n=await this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if("BlankNode"!==t.termType)return;const 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("BlankNode"!==t.termType||t.value===r)return;const o=t.value,s=await this.hashRelatedBlankNode(o,e,i,n),u=a.get(s);u?u.push(o):a.set(s,[o])}_useCanonicalId({component:e}){return"BlankNode"!==e.termType||e.value.startsWith(this.canonicalIssuer.prefix)?e:{termType:"BlankNode",value:this.canonicalIssuer.getId(e.value)}}async _yield(){return new Promise(e=>t(e))}}}).call(this,n(80).setImmediate)},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,i,a,o,s,u=1,c={},l=!1,h=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){p(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((a=new MessageChannel).port1.onmessage=function(e){p(e.data)},r=function(e){a.port2.postMessage(e)}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,r=function(e){var t=h.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):r=function(e){setTimeout(p,0,e)}:(o="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(o)&&p(+t.data.slice(o.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),r=function(t){e.postMessage(o+t,"*")}),d.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var i={callback:e,args:t};return c[u]=i,r(u),u++},d.clearImmediate=f}function f(e){delete c[e]}function p(e){if(l)setTimeout(p,0,e);else{var t=c[e];if(t){l=!0;try{!function(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(void 0,n)}}(t)}finally{f(e),l=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(44),n(81))},function(e,t,n){"use strict";n(65);const r=self.crypto||self.msCrypto;e.exports=class{constructor(e){if(!r||!r.subtle)throw new Error("crypto.subtle not found.");if("sha256"===e)this.algorithm={name:"SHA-256"};else{if("sha1"!==e)throw new Error(`Unsupport algorithm "${e}".`);this.algorithm={name:"SHA-1"}}this._content=""}update(e){this._content+=e}async digest(){const e=(new TextEncoder).encode(this._content),t=new Uint8Array(await r.subtle.digest(this.algorithm,e));let n="";for(let e=0;e<t.length;++e)n+=t[e].toString(16).padStart(2,"0");return n}}},function(e,t,n){"use strict";e.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(){const{current:e,dir:t}=this,n=e.slice();let r=null,i=0;const a=e.length;for(let n=0;n<a;++n){const o=e[n],s=t.get(o);(null===r||o>r)&&(s&&n>0&&o>e[n-1]||!s&&n<a-1&&o>e[n+1])&&(r=o,i=n)}if(null===r)this.done=!0;else{const n=t.get(r)?i-1:i+1;e[i]=e[n],e[n]=r;for(const n of e)n>r&&t.set(n,!t.get(n))}return n}}},function(e,t,n){"use strict";const r=n(58),i=n(66),a=n(67),o=n(59);function s(e,t){return e.hash<t.hash?-1:e.hash>t.hash?1:0}e.exports=class{constructor(){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n"),this.hashAlgorithm="sha256",this.quads=null}main(e){this.quads=e;for(const t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});const t=new Map,n=[...this.blankNodeInfo.keys()];for(const e of n)this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});const i=[...t.keys()].sort(),a=[];for(const e of i){const n=t.get(e);if(n.length>1){a.push(n);continue}const r=n[0];this.canonicalIssuer.getId(r)}for(const e of a){const t=[];for(const n of e){if(this.canonicalIssuer.hasId(n))continue;const e=new r("_:b");e.getId(n);const i=this.hashNDegreeQuads(n,e);t.push(i)}t.sort(s);for(const e of t){const t=e.issuer.getOldIds();for(const e of t)this.canonicalIssuer.getId(e)}}const u=[];for(const e of this.quads){const t={...e};t.subject=this._useCanonicalId({component:t.subject}),t.object=this._useCanonicalId({component:t.object}),t.graph=this._useCanonicalId({component:t.graph}),u.push(o.serializeQuad(t))}return u.sort(),u.join("")}hashFirstDegreeQuads(e){const t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(const n of r){const r={subject:null,predicate:n.predicate,object:null,graph:null};r.subject=this.modifyFirstDegreeComponent(e,n.subject,"subject"),r.object=this.modifyFirstDegreeComponent(e,n.object,"object"),r.graph=this.modifyFirstDegreeComponent(e,n.graph,"graph"),t.push(o.serializeQuad(r))}t.sort();const a=new i(this.hashAlgorithm);for(const e of t)a.update(e);return n.hash=a.digest(),n.hash}hashRelatedBlankNode(e,t,n,r){let a;a=this.canonicalIssuer.hasId(e)?this.canonicalIssuer.getId(e):n.hasId(e)?n.getId(e):this.blankNodeInfo.get(e).hash;const o=new i(this.hashAlgorithm);return o.update(r),"g"!==r&&o.update(this.getRelatedPredicate(t)),o.update(a),o.digest()}hashNDegreeQuads(e,t){const n=new i(this.hashAlgorithm),r=this.createHashToRelated(e,t),o=[...r.keys()].sort();for(const e of o){n.update(e);let i,o="";const s=new a(r.get(e));for(;s.hasNext();){const e=s.next();let n=t.clone(),r="";const a=[];let u=!1;for(const t of e)if(this.canonicalIssuer.hasId(t)?r+=this.canonicalIssuer.getId(t):(n.hasId(t)||a.push(t),r+=n.getId(t)),0!==o.length&&r>o){u=!0;break}if(!u){for(const e of a){const t=this.hashNDegreeQuads(e,n);if(r+=n.getId(e),r+=`<${t.hash}>`,n=t.issuer,0!==o.length&&r>o){u=!0;break}}u||(0===o.length||r<o)&&(o=r,i=n)}}n.update(o),t=i}return{hash:n.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return"BlankNode"!==t.termType?t:{termType:"BlankNode",value:t.value===e?"_:a":"_:z"}}getRelatedPredicate(e){return`<${e.predicate.value}>`}createHashToRelated(e,t){const n=new Map,r=this.blankNodeInfo.get(e).quads;for(const 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}){const n=this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if("BlankNode"!==t.termType)return;const 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("BlankNode"!==t.termType||t.value===r)return;const o=t.value,s=this.hashRelatedBlankNode(o,e,i,n),u=a.get(s);u?u.push(o):a.set(s,[o])}_useCanonicalId({component:e}){return"BlankNode"!==e.termType||e.value.startsWith(this.canonicalIssuer.prefix)?e:{termType:"BlankNode",value:this.canonicalIssuer.getId(e.value)}}}},function(e,t,n){"use strict";e.exports=class{constructor(){this._requests={}}wrapLoader(e){const 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]}}}},function(e,t,n){"use strict";const r=n(89),i=Symbol("max"),a=Symbol("length"),o=Symbol("lengthCalculator"),s=Symbol("allowStale"),u=Symbol("maxAge"),c=Symbol("dispose"),l=Symbol("noDisposeOnSet"),h=Symbol("lruList"),d=Symbol("cache"),f=Symbol("updateAgeOnGet"),p=()=>1;const v=(e,t,n)=>{const r=e[d].get(t);if(r){const t=r.value;if(y(e,t)){if(m(e,r),!e[s])return}else n&&(e[f]&&(r.value.now=Date.now()),e[h].unshiftNode(r));return t.value}},y=(e,t)=>{if(!t||!t.maxAge&&!e[u])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[u]&&n>e[u]},g=e=>{if(e[a]>e[i])for(let t=e[h].tail;e[a]>e[i]&&null!==t;){const n=t.prev;m(e,t),t=n}},m=(e,t)=>{if(t){const n=t.value;e[c]&&e[c](n.key,n.value),e[a]-=n.length,e[d].delete(n.key),e[h].removeNode(t)}};class b{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}}const w=(e,t,n,r)=>{let i=n.value;y(e,i)&&(m(e,n),e[s]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[i]=e.max||1/0;const t=e.length||p;if(this[o]="function"!=typeof t?p:t,this[s]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[u]=e.maxAge||0,this[c]=e.dispose,this[l]=e.noDisposeOnSet||!1,this[f]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[i]=e||1/0,g(this)}get max(){return this[i]}set allowStale(e){this[s]=!!e}get allowStale(){return this[s]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[u]=e,g(this)}get maxAge(){return this[u]}set lengthCalculator(e){"function"!=typeof e&&(e=p),e!==this[o]&&(this[o]=e,this[a]=0,this[h].forEach(e=>{e.length=this[o](e.value,e.key),this[a]+=e.length})),g(this)}get lengthCalculator(){return this[o]}get length(){return this[a]}get itemCount(){return this[h].length}rforEach(e,t){t=t||this;for(let n=this[h].tail;null!==n;){const r=n.prev;w(this,e,n,t),n=r}}forEach(e,t){t=t||this;for(let n=this[h].head;null!==n;){const r=n.next;w(this,e,n,t),n=r}}keys(){return this[h].toArray().map(e=>e.key)}values(){return this[h].toArray().map(e=>e.value)}reset(){this[c]&&this[h]&&this[h].length&&this[h].forEach(e=>this[c](e.key,e.value)),this[d]=new Map,this[h]=new r,this[a]=0}dump(){return this[h].map(e=>!y(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[h]}set(e,t,n){if((n=n||this[u])&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const r=n?Date.now():0,s=this[o](t,e);if(this[d].has(e)){if(s>this[i])return m(this,this[d].get(e)),!1;const o=this[d].get(e).value;return this[c]&&(this[l]||this[c](e,o.value)),o.now=r,o.maxAge=n,o.value=t,this[a]+=s-o.length,o.length=s,this.get(e),g(this),!0}const f=new b(e,t,s,r,n);return f.length>this[i]?(this[c]&&this[c](e,t),!1):(this[a]+=f.length,this[h].unshift(f),this[d].set(e,this[h].head),g(this),!0)}has(e){if(!this[d].has(e))return!1;const t=this[d].get(e).value;return!y(this,t)}get(e){return v(this,e,!0)}peek(e){return v(this,e,!1)}pop(){const e=this[h].tail;return e?(m(this,e),e.value):null}del(e){m(this,this[d].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const r=e[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{const e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[d].forEach((e,t)=>v(this,t,!1))}}},function(e,t){function n(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}e.exports=function(e){return function(){var t=this,r=arguments;return new Promise((function(i,a){var o=e.apply(t,r);function s(e){n(o,i,a,s,u,"next",e)}function u(e){n(o,i,a,s,u,"throw",e)}s(void 0)}))}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return d}));var r=n(21),i=n(73),a=n.n(i);const{xsd:o}=r.a,s=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,u={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:"\t",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},c=/[\x00-\x20<>\\"\{\}\|\^\`]/,l={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},h=/$0^/;class d{constructor(e){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,e=e||{},this._lineMode=!!e.lineMode){this._n3Mode=!1;for(const e in this)!(e in l)&&this[e]instanceof RegExp&&(this[e]=h)}else this._n3Mode=!1!==e.n3;this._comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,t){let n=this._input;const r=this._comments;for(;;){let a,s;for(;a=this._newline.exec(n);)r&&(s=this._comment.exec(a[0]))&&e(null,{line:this._line,type:"comment",value:s[1],prefix:""}),n=n.substr(a[0].length,n.length),this._line++;if(!a&&(a=this._whitespace.exec(n))&&(n=n.substr(a[0].length,n.length)),this._endOfFile.test(n))return t&&(r&&(s=this._comment.exec(n))&&e(null,{line:this._line,type:"comment",value:s[1],prefix:""}),e(n=null,{line:this._line,type:"eof",value:"",prefix:""})),this._input=n;const u=this._line,l=n[0];let h="",d="",f="",p=null,v=0,y=!1;switch(l){case"^":if(n.length<3)break;if("^"!==n[1]){this._n3Mode&&(v=1,h="^");break}if(this._previousMarker="^^",n=n.substr(2),"<"!==n[0]){y=!0;break}case"<":if(p=this._unescapedIri.exec(n))h="IRI",d=p[1];else if(p=this._iri.exec(n)){if(d=this._unescape(p[1]),null===d||c.test(d))return i(this);h="IRI"}else n.length>1&&"<"===n[1]?(h="<<",v=2):this._n3Mode&&n.length>1&&"="===n[1]&&(h="inverse",v=2,d=">");break;case">":n.length>1&&">"===n[1]&&(h=">>",v=2);break;case"_":((p=this._blank.exec(n))||t&&(p=this._blank.exec(n+" ")))&&(h="blank",f="_",d=p[1]);break;case'"':if(p=this._simpleQuotedString.exec(n))d=p[1];else if(({value:d,matchLength:v}=this._parseLiteral(n)),null===d)return i(this);null===p&&0===v||(h="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(p=this._simpleApostropheString.exec(n))d=p[1];else if(({value:d,matchLength:v}=this._parseLiteral(n)),null===d)return i(this);null===p&&0===v||(h="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(p=this._variable.exec(n))&&(h="var",d=p[0]);break;case"@":"literal"===this._previousMarker&&(p=this._langcode.exec(n))?(h="langcode",d=p[1]):(p=this._keyword.exec(n))&&(h=p[0]);break;case".":if(1===n.length?t:n[1]<"0"||n[1]>"9"){h=".",v=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(p=this._number.exec(n)||t&&(p=this._number.exec(n+" ")))&&(h="literal",d=p[0],f="string"==typeof p[1]?o.double:"string"==typeof p[2]?o.decimal:o.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(p=this._sparqlKeyword.exec(n))?h=p[0].toUpperCase():y=!0;break;case"f":case"t":(p=this._boolean.exec(n))?(h="literal",d=p[0],f=o.boolean):y=!0;break;case"a":(p=this._shortPredicates.exec(n))?(h="abbreviation",d="a"):y=!0;break;case"=":this._n3Mode&&n.length>1&&(h="abbreviation",">"!==n[1]?(v=1,d="="):(v=2,d=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"{":case"}":this._lineMode||(v=1,h=l);break;default:y=!0}if(y&&("@prefix"!==this._previousMarker&&"PREFIX"!==this._previousMarker||!(p=this._prefix.exec(n))?((p=this._prefixed.exec(n))||t&&(p=this._prefixed.exec(n+" ")))&&(h="prefixed",f=p[1]||"",d=this._unescape(p[2])):(h="prefix",d=p[1]||"")),"^^"===this._previousMarker)switch(h){case"prefixed":h="type";break;case"IRI":h="typeIRI";break;default:h=""}if(!h)return t||!/^'''|^"""/.test(n)&&/\n|\r/.test(n)?i(this):this._input=n;const g={line:u,type:h,value:d,prefix:f};e(null,g),this.previousToken=g,this._previousMarker=h,n=n.substr(v||p[0].length,n.length)}function i(t){e(t._syntaxError(/^\S*/.exec(n)[0]))}}_unescape(e){let t=!1;const n=e.replace(s,(e,n,r,i)=>{if("string"==typeof n)return String.fromCharCode(Number.parseInt(n,16));if("string"==typeof r){let e=Number.parseInt(r,16);return e<=65535?String.fromCharCode(Number.parseInt(r,16)):String.fromCharCode(55296+((e-=65536)>>10),56320+(1023&e))}return i in u?u[i]:(t=!0,"")});return t?null:n}_parseLiteral(e){if(e.length>=3){const t=e.match(/^(?:"""|"|'''|'|)/)[0],n=t.length;let r=Math.max(this._literalClosingPos,n);for(;(r=e.indexOf(t,r))>0;){let t=0;for(;"\\"===e[r-t-1];)t++;if(t%2==0){const t=e.substring(n,r),i=t.split(/\r\n|\r|\n/).length-1,a=r+n;if(1===n&&0!==i||3===n&&this._lineMode)break;return this._line+=i,{value:this._unescape(t),matchLength:a}}r++}this._literalClosingPos=e.length-n+1}return{value:"",matchLength:0}}_syntaxError(e){this._input=null;const t=new Error(`Unexpected "${e}" on line ${this._line}.`);return t.context={token:void 0,line:this._line,previousToken:this.previousToken},t}_readStartingBom(e){return e.startsWith("\ufeff")?e.substr(1):e}tokenize(t,n){if(this._line=1,"string"==typeof t){if(this._input=this._readStartingBom(t),"function"!=typeof n){const e=[];let t;if(this._tokenizeToEnd((n,r)=>n?t=n:e.push(r),!0),t)throw t;return e}a()(()=>this._tokenizeToEnd(n,!0))}else this._pendingBuffer=null,"function"==typeof t.setEncoding&&t.setEncoding("utf8"),t.on("data",t=>{null!==this._input&&0!==t.length&&(this._pendingBuffer&&(t=e.concat([this._pendingBuffer,t]),this._pendingBuffer=null),128&t[t.length-1]?this._pendingBuffer=t:(void 0===this._input?this._input=this._readStartingBom("string"==typeof t?t:t.toString()):this._input+=t,this._tokenizeToEnd(n,!1)))}),t.on("end",()=>{"string"==typeof this._input&&this._tokenizeToEnd(n,!0)}),t.on("error",n)}}}).call(this,n(100).Buffer)},function(e,t,n){(function(t){/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
39
+ const r=n(57),i=n(85),a=n(28),o=n(87),s=a.IdentifierIssuer,u=n(29),c=n(70),l=n(91),{expand:h}=n(92),{flatten:d}=n(93),{fromRDF:f}=n(94),{toRDF:p}=n(95),{frameMergedOrDefault:v,cleanupNull:y}=n(97),{isArray:g,isObject:m,isString:b}=n(24),{isSubjectReference:w}=n(30),{expandIri:x,getInitialContext:_,process:k,processingMode:T}=n(39),{compact:N,compactIri:j}=n(98),{createNodeMap:O,createMergedNodeMap:I,mergeNodeMaps:S}=n(50),E=function(e){const t={},E=new c({max:100});function R(t,{documentLoader:n=e.documentLoader,...r}){return Object.assign({},{documentLoader:n},r,t)}return e.compact=async function(t,n,r){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(null===n)throw new u("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(null===t)return null;let i;(r=R(r,{base:b(t)?t:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new s("_:b"),contextResolver:new o({sharedCache:E})})).link&&(r.skipExpansion=!0),r.compactToRelative||delete r.base,i=r.skipExpansion?t:await e.expand(t,r);const c=await e.processContext(_(r),n,r);let l=await N({activeCtx:c,element:i,options:r,compactionMap:r.compactionMap});r.compactArrays&&!r.graph&&g(l)?1===l.length?l=l[0]:0===l.length&&(l={}):r.graph&&m(l)&&(l=[l]),m(n)&&"@context"in n&&(n=n["@context"]),n=a.clone(n),g(n)||(n=[n]);const h=n;n=[];for(let e=0;e<h.length;++e)(!m(h[e])||Object.keys(h[e]).length>0)&&n.push(h[e]);const d=n.length>0;if(1===n.length&&(n=n[0]),g(l)){const e=j({activeCtx:c,iri:"@graph",relativeTo:{vocab:!0}}),t=l;l={},d&&(l["@context"]=n),l[e]=t}else if(m(l)&&d){const e=l;l={"@context":n};for(const t in e)l[t]=e[t]}return l},e.expand=async function(t,n){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");!1===(n=R(n,{keepFreeFloatingNodes:!1,contextResolver:new o({sharedCache:E})})).expansionMap&&(n.expansionMap=void 0);const r={},i=[];if("expandContext"in n){const e=a.clone(n.expandContext);m(e)&&"@context"in e?r.expandContext=e:r.expandContext={"@context":e},i.push(r.expandContext)}let s;if(b(t)){const a=await e.get(t,n);s=a.documentUrl,r.input=a.document,a.contextUrl&&(r.remoteContext={"@context":a.contextUrl},i.push(r.remoteContext))}else r.input=a.clone(t);"base"in n||(n.base=s||"");let u=_(n);for(const e of i)u=await k({activeCtx:u,localCtx:e,options:n});let c=await h({activeCtx:u,element:r.input,options:n,expansionMap:n.expansionMap});return m(c)&&"@graph"in c&&1===Object.keys(c).length?c=c["@graph"]:null===c&&(c=[]),g(c)||(c=[c]),c},e.flatten=async function(t,n,r){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");n="function"==typeof n?null:n||null,r=R(r,{base:b(t)?t:"",contextResolver:new o({sharedCache:E})});const i=await e.expand(t,r),a=d(i);if(null===n)return a;r.graph=!0,r.skipExpansion=!0;const s=await e.compact(a,n,r);return s},e.frame=async function(t,n,r){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(r=R(r,{base:b(t)?t:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new o({sharedCache:E})}),b(n)){const 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}}const i=n&&n["@context"]||{},a=await e.processContext(_(r),i,r);r.hasOwnProperty("omitGraph")||(r.omitGraph=T(a,1.1)),r.hasOwnProperty("pruneBlankNodeIdentifiers")||(r.pruneBlankNodeIdentifiers=T(a,1.1));const s=await e.expand(t,r),u={...r};u.isFrame=!0,u.keepFreeFloatingNodes=!0;const c=await e.expand(n,u),l=Object.keys(n).map(e=>x(a,e,{vocab:!0}));u.merged=!l.includes("@graph"),u.is11=T(a,1.1);const h=v(s,c,u);u.graph=!r.omitGraph,u.skipExpansion=!0,u.link={},u.framing=!0;let d=await e.compact(h,i,u);return u.link={},d=y(d,u),d},e.link=async function(t,n,r){const i={};return n&&(i["@context"]=n),i["@embed"]="@link",e.frame(t,i,r)},e.normalize=e.canonize=async function(t,n){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if("inputFormat"in(n=R(n,{base:b(t)?t:"",algorithm:"URDNA2015",skipExpansion:!1,contextResolver:new o({sharedCache:E})}))){if("application/n-quads"!==n.inputFormat&&"application/nquads"!==n.inputFormat)throw new u("Unknown canonicalization input format.","jsonld.CanonizeError");const e=l.parse(t);return r.canonize(e,n)}const i={...n};delete i.format,i.produceGeneralizedRdf=!1;const a=await e.toRDF(t,i);return r.canonize(a,n)},e.fromRDF=async function(e,n){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");n=R(n,{format:b(e)?"application/n-quads":void 0});const{format:r}=n;let{rdfParser:i}=n;if(r){if(i=i||t[r],!i)throw new u("Unknown input format.","jsonld.UnknownFormat",{format:r})}else i=()=>e;const a=await i(e);return f(a,n)},e.toRDF=async function(t,n){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");let r;r=(n=R(n,{base:b(t)?t:"",skipExpansion:!1,contextResolver:new o({sharedCache:E})})).skipExpansion?t:await e.expand(t,n);const i=p(r,n);if(n.format){if("application/n-quads"===n.format||"application/nquads"===n.format)return l.serialize(i);throw new u("Unknown output format.","jsonld.UnknownFormat",{format:n.format})}return i},e.createNodeMap=async function(t,n){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");n=R(n,{base:b(t)?t:"",contextResolver:new o({sharedCache:E})});const r=await e.expand(t,n);return I(r,n)},e.merge=async function(t,n,r){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!g(t))throw new TypeError('Could not merge, "docs" must be an array.');n="function"==typeof n?null:n||null,r=R(r,{contextResolver:new o({sharedCache:E})});const i=await Promise.all(t.map(t=>{const n={...r};return e.expand(t,n)}));let u=!0;"mergeNodes"in r&&(u=r.mergeNodes);const c=r.issuer||new s("_:b"),l={"@default":{}};for(let e=0;e<i.length;++e){const t=a.relabelBlankNodes(i[e],{issuer:new s("_:b"+e+"-")}),n=u||0===e?l:{"@default":{}};if(O(t,n,"@default",c),n!==l)for(const e in n){const t=n[e];if(!(e in l)){l[e]=t;continue}const r=l[e];for(const e in t)e in r||(r[e]=t[e])}}const h=S(l),d=[],f=Object.keys(h).sort();for(let e=0;e<f.length;++e){const t=h[f[e]];w(t)||d.push(t)}if(null===n)return d;r.graph=!0,r.skipExpansion=!0;const p=await e.compact(d,n,r);return p},Object.defineProperty(e,"documentLoader",{get:()=>e._documentLoader,set:t=>e._documentLoader=t}),e.documentLoader=async e=>{throw new u("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="function"==typeof n.documentLoader?n.documentLoader:e.documentLoader;const i=await r(t);try{if(!i.document)throw new u("No remote document found at the given URL.","jsonld.NullRemoteDocument");b(i.document)&&(i.document=JSON.parse(i.document))}catch(e){throw new u("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=R(n,{base:"",contextResolver:new o({sharedCache:E})}),null===t?_(n):(t=a.clone(t),m(t)&&"@context"in t||(t={"@context":t}),k({activeCtx:e,localCtx:t,options:n}))},e.getContextValue=n(39).getContextValue,e.documentLoaders={},e.useDocumentLoader=function(t){if(!(t in e.documentLoaders))throw new u('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.registerRDFParser("application/nquads",l.parse),e.url=n(33),e.util=a,Object.assign(e,a),e.promises=e,e.RequestQueue=n(69),e.JsonLdProcessor=n(99)(e),i.setupGlobals(e),i.setupDocumentLoaders(e),e},R=function(){return E((function(){return R()}))};E(R),e.exports=R},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));n(41);function r(e){return!!e&&"DefaultGraph"===e.termType}},function(t,n){t.exports=e},function(e,t,n){e.exports=n(79)},function(e,t,n){"use strict";e.exports=class e{constructor(e,t=new Map,n=0){this.prefix=e,this._existing=t,this.counter=n}clone(){const{prefix:t,_existing:n,counter:r}=this;return new e(t,new Map(n),r)}getId(e){const t=e&&this._existing.get(e);if(t)return t;const 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()]}}},function(e,t,n){"use strict";const r="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",i="http://www.w3.org/2001/XMLSchema#string",a={};function o(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&&("Literal"!==e.object.termType||e.object.datatype.termType===t.object.datatype.termType&&e.object.language===t.object.language&&e.object.datatype.value===t.object.datatype.value))}a.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,a.empty=new RegExp("^[ \\t]*$"),a.quad=new RegExp('^[ \\t]*(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]+(?:<([^:]+:[^>]*)>)[ \\t]+(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?)|(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?:(?:\\^\\^(?:<([^:]+:[^>]*)>))|(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)))?))[ \\t]*(?:\\.|(?:(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]*\\.))[ \\t]*$'),e.exports=class e{static parse(e){const t=[],n={},s=e.split(a.eoln);let c=0;for(const e of s){if(c++,a.empty.test(e))continue;const s=e.match(a.quad);if(null===s)throw new Error("N-Quads parse error on line "+c+".");const l={subject:null,predicate:null,object:null,graph:null};if(void 0!==s[1]?l.subject={termType:"NamedNode",value:s[1]}:l.subject={termType:"BlankNode",value:s[2]},l.predicate={termType:"NamedNode",value:s[3]},void 0!==s[4]?l.object={termType:"NamedNode",value:s[4]}:void 0!==s[5]?l.object={termType:"BlankNode",value:s[5]}:(l.object={termType:"Literal",value:void 0,datatype:{termType:"NamedNode"}},void 0!==s[7]?l.object.datatype.value=s[7]:void 0!==s[8]?(l.object.datatype.value=r,l.object.language=s[8]):l.object.datatype.value=i,l.object.value=s[6].replace(u,(function(e,t,n,r){if(t)switch(t){case"t":return"\t";case"b":return"\b";case"n":return"\n";case"r":return"\r";case"f":return"\f";case'"':return'"';case"'":return"'";case"\\":return"\\"}if(n)return String.fromCharCode(parseInt(n,16));if(r)throw new Error("Unsupported U escape")}))),void 0!==s[9]?l.graph={termType:"NamedNode",value:s[9]}:void 0!==s[10]?l.graph={termType:"BlankNode",value:s[10]}:l.graph={termType:"DefaultGraph",value:""},l.graph.value in n){let e=!0;const r=n[l.graph.value];for(const t of r)if(o(t,l)){e=!1;break}e&&(r.push(l),t.push(l))}else n[l.graph.value]=[l],t.push(l)}return t}static serialize(t){Array.isArray(t)||(t=e.legacyDatasetToQuads(t));const n=[];for(const r of t)n.push(e.serializeQuad(r));return n.sort().join("")}static serializeQuad(e){const t=e.subject,n=e.predicate,a=e.object,o=e.graph;let u="";return"NamedNode"===t.termType?u+=`<${t.value}>`:u+=""+t.value,u+=` <${n.value}> `,"NamedNode"===a.termType?u+=`<${a.value}>`:"BlankNode"===a.termType?u+=a.value:(u+=`"${function(e){return e.replace(s,(function(e){switch(e){case'"':return'\\"';case"\\":return"\\\\";case"\n":return"\\n";case"\r":return"\\r"}}))}(a.value)}"`,a.datatype.value===r?a.language&&(u+="@"+a.language):a.datatype.value!==i&&(u+=`^^<${a.datatype.value}>`)),"NamedNode"===o.termType?u+=` <${o.value}>`:"BlankNode"===o.termType&&(u+=" "+o.value),u+=" .\n",u}static legacyDatasetToQuads(e){const t=[],n={"blank node":"BlankNode",IRI:"NamedNode",literal:"Literal"};for(const a in e){e[a].forEach(e=>{const o={};for(const t in e){const a=e[t],s={termType:n[a.type],value:a.value};"Literal"===s.termType&&(s.datatype={termType:"NamedNode"},"datatype"in a&&(s.datatype.value=a.datatype),"language"in a?("datatype"in a||(s.datatype.value=r),s.language=a.language):"datatype"in a||(s.datatype.value=i)),o[t]=s}o.graph="@default"===a?{termType:"DefaultGraph",value:""}:{termType:a.startsWith("_:")?"BlankNode":"NamedNode",value:a},t.push(o)})}return t}};const s=/["\\\n\r]/g;const u=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g},function(e,t,n){"use strict";const r="http://www.w3.org/1999/02/22-rdf-syntax-ns#",i="http://www.w3.org/2001/XMLSchema#";e.exports={LINK_HEADER_REL:"http://www.w3.org/ns/json-ld#context",LINK_HEADER_CONTEXT:"http://www.w3.org/ns/json-ld#context",RDF:r,RDF_LIST:r+"List",RDF_FIRST:r+"first",RDF_REST:r+"rest",RDF_NIL:r+"nil",RDF_TYPE:r+"type",RDF_PLAIN_LITERAL:r+"PlainLiteral",RDF_XML_LITERAL:r+"XMLLiteral",RDF_JSON_LITERAL:r+"JSON",RDF_OBJECT:r+"object",RDF_LANGSTRING:r+"langString",XSD:i,XSD_BOOLEAN:i+"boolean",XSD_DOUBLE:i+"double",XSD_INTEGER:i+"integer",XSD_STRING:i+"string"}},function(e,t,n){"use strict";n.r(t),n.d(t,"isStatement",(function(){return $.j})),n.d(t,"isStore",(function(){return $.k})),n.d(t,"isCollection",(function(){return $.b})),n.d(t,"isRDFlibObject",(function(){return $.i})),n.d(t,"isVariable",(function(){return $.n})),n.d(t,"isTerm",(function(){return $.m})),n.d(t,"isLiteral",(function(){return $.d})),n.d(t,"isQuad",(function(){return $.g})),n.d(t,"isNamedNode",(function(){return $.e})),n.d(t,"isBlankNode",(function(){return $.a})),n.d(t,"isSubject",(function(){return $.l})),n.d(t,"isPredicate",(function(){return $.f})),n.d(t,"isRDFObject",(function(){return $.h})),n.d(t,"isGraph",(function(){return $.c})),n.d(t,"BlankNode",(function(){return v.a})),n.d(t,"Collection",(function(){return y.a})),n.d(t,"convert",(function(){return g})),n.d(t,"DataFactory",(function(){return ne})),n.d(t,"Empty",(function(){return k})),n.d(t,"Fetcher",(function(){return T.a})),n.d(t,"Formula",(function(){return N.a})),n.d(t,"Store",(function(){return j.a})),n.d(t,"jsonParser",(function(){return O})),n.d(t,"Literal",(function(){return I.a})),n.d(t,"log",(function(){return S.a})),n.d(t,"N3Parser",(function(){return E.a})),n.d(t,"NamedNode",(function(){return R.a})),n.d(t,"Namespace",(function(){return A.a})),n.d(t,"Node",(function(){return C.a})),n.d(t,"parse",(function(){return L.a})),n.d(t,"Query",(function(){return D.a})),n.d(t,"queryToSPARQL",(function(){return P})),n.d(t,"RDFaProcessor",(function(){return M.a})),n.d(t,"RDFParser",(function(){return F.a})),n.d(t,"serialize",(function(){return U.a})),n.d(t,"Serializer",(function(){return q.a})),n.d(t,"SPARQLToQuery",(function(){return B})),n.d(t,"sparqlUpdateParser",(function(){return H.a})),n.d(t,"Statement",(function(){return V.a})),n.d(t,"term",(function(){return _e})),n.d(t,"UpdateManager",(function(){return Z})),n.d(t,"UpdatesSocket",(function(){return re})),n.d(t,"UpdatesVia",(function(){return ie})),n.d(t,"uri",(function(){return Q})),n.d(t,"Util",(function(){return G})),n.d(t,"Variable",(function(){return ae.a})),n.d(t,"IndexedFormula",(function(){return j.a})),n.d(t,"NextId",(function(){return ke})),n.d(t,"fromNT",(function(){return xe})),n.d(t,"fetcher",(function(){return ce})),n.d(t,"graph",(function(){return le})),n.d(t,"lit",(function(){return he})),n.d(t,"st",(function(){return de})),n.d(t,"sym",(function(){return fe})),n.d(t,"blankNode",(function(){return ve})),n.d(t,"defaultGraph",(function(){return ye})),n.d(t,"literal",(function(){return ge})),n.d(t,"namedNode",(function(){return fe})),n.d(t,"quad",(function(){return me})),n.d(t,"triple",(function(){return be})),n.d(t,"variable",(function(){return pe})),n.d(t,"termValue",(function(){return J.a})),n.d(t,"ConnectedStore",(function(){return Te})),n.d(t,"LiveStore",(function(){return Ne}));var r=n(4),i=n.n(r),a=n(3),o=n.n(a),s=n(11),u=n.n(s),c=n(14),l=n.n(c),h=n(9),d=n.n(h),f=n(0),p=n.n(f),v=n(20),y=n(32),g=n(52),m=n(5),b=n.n(m),w=n(12),x=n(1);function _(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=d()(e);if(t){var i=d()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return l()(this,n)}}var k=function(e){u()(n,e);var t=_(n);function n(){var e;return i()(this,n),e=t.call(this,""),p()(o()(e),"termType",x.d),e}return b()(n,[{key:"toString",value:function(){return"()"}}]),n}(w.a),T=n(35),N=n(47),j=n(25),O={parseJSON:function(e,t,n){var r,i,a,o={},s=n.sym(t);for(var u in e){0===u.indexOf("_:")?o[u]?r=o[u]:(r=n.bnode(u),o[u]=r):r=n.sym(u);var c=e[u];for(var l in c){var h=c[l];for(var d in i=n.sym(l),h){var f=h[d];if("uri"===f.type)a=n.sym(f.value),n.add(r,i,a,s);else if("BlankNode"===f.type)o[f.value]?a=o[f.value]:(a=n.bnode(f.value),o[f.value]=a),n.add(r,i,a,s);else{if("Literal"!==f.type)throw new Error("error: unexpected termtype: "+d.type);a=f.datatype?n.literal(f.value,void 0,n.sym(f.datatype)):f.lang?n.literal(f.value,f.lang):n.literal(f.value),n.add(r,i,a,s)}}}}}},I=n(18),S=n(2),E=n(34),R=n(8),A=n(13),C=n(27),L=n(46),D=n(37);function P(e){var t=0;function n(e){var t="",n=e.statements;for(var r in n)S.a.debug("Found statement: "+n),t+=a()+n[r]+"\n";return t}function r(e){var t="";for(var n in e.constraints){var r=e.constraints[n];t+=a()+"FILTER ( "+r.describe(n)+" ) \n"}return t}function i(e){var i=a()+"WHERE \n{ \n";return t++,i+=n(e),i+=r(e),i+=function e(i){for(var o="",s=0;s<i.optional.length;s++)S.a.debug("Found optional query"),o+=a()+"OPTIONAL { \n",t++,o+=n(i.optional[s]),o+=r(i.optional[s]),o+=e(i.optional[s]),t--,o+=a()+"}\n";return o}(e),t--,i+="}"}function a(){for(var e="",n=0;n<t;n++)e+=" ";return e}return function(e){return function(e){for(var t=a()+"SELECT ",n=0;n<e.vars.length;n++)t+=e.vars[n]+" ";return t+="\n"}(e)+i(e.pat)}(e)}var M=n(36),F=n(42),U=n(40),q=n(43);function B(e,t,n){var r=[];function i(e){if(r[e])return r[e];var t=n.variable(e);return r[e]=t,t}function a(e){return"string"==typeof e&&e.match(/[^ \n\t]/)}function o(e){return"string"==typeof e&&e.match(/^[\?\$]/)}function s(e){return"string"==typeof e?e.replace(/^&lt;/,"<").replace(/&gt;$/,">"):e}function u(e){return"string"==typeof e&&e.match(/^<[^>]*>$/)}function c(e){return"string"==typeof e&&(e.match(/^_:/)||e.match(/^$/))}function l(e){return"string"==typeof e&&e.match(/:$/)}function h(e){return"string"==typeof e&&e.match(/^:|^[^_][^:]*:/)}function d(e){return e.split(":")[0]}function f(e){return e.split(":")[1]}function p(e){return u(e)?e.slice(1,e.length-1):e}function v(e){e=e.replace(/\(/g," ( ").replace(/\)/g," ) ").replace(/</g," <").replace(/>/g,"> ").replace(/{/g," { ").replace(/}/g," } ").replace(/[\t\n\r]/g," ").replace(/; /g," ; ").replace(/\. /g," . ").replace(/, /g," , "),S.a.info("New str into spaceDelimit: \n"+e);var t=[],n=e.split(" ");for(var r in n)a(n[r])&&(t=t.concat(n[r]));return t}function y(e,t){for(var n=0;n<t.length;n++)if("string"==typeof t[n]&&t[n].toLowerCase()===e.toLowerCase())return n;return null}function g(e,t){for(var n=[],r=0;r<t.length;r++)"string"==typeof t[r]&&t[r].toLowerCase()===e.toLowerCase()&&n.push(r);return n}function m(e,t,n){S.a.info("Looking for a close bracket of type "+n+" in "+e);for(var r=0,i=0;i<e.length;i++)if(e[i]===t&&r++,e[i]===n&&r--,r<0)return i;return S.a.error("Statement had no close parenthesis in SPARQL query"),0}function b(e){return this.describe=function(t){return t+" = "+e.toNT()},this.test=function(t){return e.equals(t)},this}function w(e){this.describe=function(t){return"REGEXP( '"+e+"' , "+t+" )"},this.test=function(t){var n=new RegExp(e);return!!t.value&&n.test(t.value)}}function x(e,t){3!==e.length||"Variable"!==e[0].termType||"NamedNode"!==e[2].termType&&"Literal"!==e[2].termType?6===e.length&&"string"==typeof e[0]&&"regexp"===e[0].toLowerCase()&&"("===e[1]&&")"===e[5]&&","===e[3]&&"Variable"===e[4].termType&&"Literal"===e[2].termType&&(S.a.debug("Constraint added: "+e),t.constraints[e[4]]=new w(e[2].value)):"="===e[1]||">"===e[1]||"<"===e[1]?(S.a.debug("Constraint added: "+e),t.constraints[e[0]]=new b(e[2])):S.a.warn("I don't know how to handle the constraint: "+e)}function _(e,t){S.a.debug("Optional query: "+e+" not yet implemented.");var r=n.formula();k(e,r),t.optional.push(r)}function k(e,t){var r,a,l=function(e){for(var t=[],r=0;r<e.length;r++)"string"==typeof e[r]?(e[r]=s(e[r]),o(e[r])?t[r]=i(e[r].slice(1)):c(e[r])?(S.a.info(e[r]+" was identified as a bnode."),t[r]=n.bnode()):u(e[r])?(S.a.info(e[r]+" was identified as a symbol."),t[r]=n.sym(p(e[r]))):h(e[r])?(S.a.info(e[r]+" was identified as a prefixed symbol"),j[d(e[r])]?t[r]=n.sym(e[r]=j[d(e[r])]+f(e[r])):(S.a.error("SPARQL error: "+e[r]+" with prefix "+d(e[r])+" does not have a correct prefix entry."),t[r]=e[r])):t[r]=e[r]):t[r]=e[r];return t}(e);for(S.a.debug("WHERE: "+l);y("OPTIONAL",l);)a=y("OPTIONAL",l),S.a.debug("OPT: "+a+" "+l[a]+" in "+l),"{"!==l[a+1]&&S.a.warn("Bad optional opening bracket in word "+a),-1===(r=m(l.slice(a+2),"{","}"))?S.a.error("No matching bracket in word "+a):(_(l.slice(a+2,a+2+r),t),a=y("OPTIONAL",l),r=m(l.slice(a+2),"{","}"),l.splice(a,r+3));for(S.a.debug("WHERE after optionals: "+l);y("FILTER",l);){var v=y("FILTER",l);"("!==l[v+1]&&S.a.warn("Bad filter opening bracket in word "+v),-1===(r=m(l.slice(v+2),"(",")"))?S.a.error("No matching bracket in word "+v):(x(l.slice(v+2,v+2+r),t),v=y("FILTER",l),r=m(l.slice(v+2),"(",")"),l.splice(v,r+3))}S.a.debug("WHERE after filters and optionals: "+l),function(e,t){var n=new Array(1);n[0]=-1;for(var r=n.concat(g(".",e)),i=[],a=0;a<r.length-1;a++)i[a]=e.slice(r[a]+1,r[a+1]);for(a in i){S.a.info("s+p+o "+a+" = "+i[a]);var o=i[a][0];i[a].splice(0,1);var s=n.concat(g(";",i[a]));s.push(i[a].length);for(var u=[],c=0;c<s.length-1;c++)u[c]=i[a].slice(s[c]+1,s[c+1]);for(a in u){S.a.info("p+o "+a+" = "+i[a]);var l=u[a][0];u[a].splice(0,1);var h=n.concat(g(",",u[a]));h.push(u[a].length);var d=[];for(c=0;c<h.length-1;c++)d[c]=u[a].slice(h[c]+1,h[c+1]);for(a in d){var f=d[a][0];S.a.info("Subj="+o+" Pred="+l+" Obj="+f),t.add(o,l,f)}}}}(l,t)}S.a.info("SPARQL input: \n"+e);var T=new D.a,N=function(e){var t=function e(t){var r=-1===t.indexOf("'")?null:t.indexOf("'"),i=-1===t.indexOf('"')?null:t.indexOf('"');if(!r&&!i){var a=new Array(1);return a[0]=t,a}var o,s,u=new Array(2);if(!r||i&&i<r)o='"',s=i;else{if(i&&!(r&&r<i))return S.a.error("SQARQL QUERY OOPS!"),u;o="'",s=r}u[0]=t.slice(0,s);var c,l=t.slice(s+1).indexOf(o);return-1===l?(S.a.error("SPARQL parsing error: no matching parentheses in literal "+t),t):(t.slice(l+s+2).match(/^\^\^/)?(c=t.slice(l+s+2).indexOf(" "),u[1]=n.literal(t.slice(s+1,s+1+l),n.sym(p(t.slice(s+4+l,s+2+l+c)))),u=u.concat(e(t.slice(l+s+3+c)))):t.slice(l+s+2).match(/^@/)?(c=t.slice(l+s+2).indexOf(" "),u[1]=n.literal(t.slice(s+1,s+1+l),t.slice(s+3+l,s+2+l+c),null),u=u.concat(e(t.slice(l+s+2+c)))):(u[1]=n.literal(t.slice(s+1,s+1+l)),S.a.info("Literal found: "+u[1]),u=u.concat(e(t.slice(l+s+2)))),u)}(e),r=[];for(var i in t)r="string"==typeof t[i]?r.concat(v(t[i])):r.concat(t[i]);return r=function(e){for(var t=e,n=0;n<t.length;n++)if("a"===t[n]&&(t[n]="<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>"),"is"===t[n]&&"of"===t[n+2]){t.splice(n,1),t.splice(n+1,1);var r=t[n-1];t[n-1]=t[n+1],t[n+1]=r}return t}(r),S.a.info("SPARQL Tokens: "+r),r}(e),j=function(e){var t=g("PREFIX",e),n=[];for(var r in t){var i=e[t[r]+1],a=e[t[r]+2];if(l(i))if(u(a)){S.a.info("Prefix found: "+i+" -> "+a);var o=d(i),s=p(a);n[o]=s}else S.a.error("Invalid SPARQL symbol: "+a);else S.a.error("Invalid SPARQL prefix: "+i)}return n}(N);j.rdf||(j.rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"),j.rdfs||(j.rdfs="http://www.w3.org/2000/01/rdf-schema#");var O=y("SELECT",N),I=y("WHERE",N);if(O<0||I<0||O>I)return S.a.error("Invalid or nonexistent SELECT and WHERE tags in SPARQL query"),!1;if(function(e,t){for(var n in S.a.info("SPARQL vars: "+e),e)if(o(e[n])){S.a.info("Added "+e[n]+" to query variables from SPARQL");var r=i(e[n].slice(1));t.vars.push(r),r.label=e[n].slice(1)}else S.a.warn("Incorrect SPARQL variable in SELECT: "+e[n])}(N.slice(O+1,I),T),k(N.slice(I+2,N.length-1),T.pat),t)return T;for(var E in T.pat.statements){var R=T.pat.statements[E];"NamedNode"===R.subject.termType&&n.fetcher&&n.fetcher.lookUpThing(R.subject,"sparql:"+R.subject),"NamedNode"===R.object.termType&&n.fetcher&&n.fetcher.lookUpThing(R.object,"sparql:"+R.object)}return T}var H=n(51),V=n(45),z=n(22),X=n.n(z),Q=n(6),$=n(7),G=n(10),J=n(26);function W(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Y(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function Y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Z=function(){function e(t){if(i()(this,e),p()(this,"store",void 0),p()(this,"ifps",void 0),p()(this,"fps",void 0),p()(this,"patchControl",void 0),p()(this,"ns",void 0),(t=t||new j.a).updater)throw new Error("You can't have two UpdateManagers for the same store");t.fetcher||(t.fetcher=new T.a(t)),this.store=t,t.updater=this,this.ifps={},this.fps={},this.ns={},this.ns.link=Object(A.a)("http://www.w3.org/2007/ont/link#"),this.ns.http=Object(A.a)("http://www.w3.org/2007/ont/http#"),this.ns.httph=Object(A.a)("http://www.w3.org/2007/ont/httph#"),this.ns.ldp=Object(A.a)("http://www.w3.org/ns/ldp#"),this.ns.rdf=Object(A.a)("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),this.ns.rdfs=Object(A.a)("http://www.w3.org/2000/01/rdf-schema#"),this.ns.rdf=Object(A.a)("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),this.ns.owl=Object(A.a)("http://www.w3.org/2002/07/owl#"),this.patchControl=[]}return b()(e,[{key:"patchControlFor",value:function(e){return this.patchControl[e.value]||(this.patchControl[e.value]=[]),this.patchControl[e.value]}},{key:"isHttpUri",value:function(e){return"http"===e.slice(0,4)}},{key:"editable",value:function(e,t){if(!e)return!1;if(t||(t=this.store),e=Object(J.a)(e),!this.isHttpUri(e)&&t.holds(this.store.rdfFactory.namedNode(e),this.store.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),this.store.rdfFactory.namedNode("http://www.w3.org/2007/ont/link#MachineEditableDocument")))return"LOCALFILE";for(var n,r,i=!1,a=t.each(void 0,this.ns.link("requestedURI"),Object(Q.docpart)(e)),o=0;o<a.length;o++)if(void 0!==(n=a[o])){var s=t.any(n,this.ns.link("response"));if(void 0!==n){var u=t.anyValue(s,this.ns.httph("wac-allow"));if(u){var c,l=W(u.split(","));try{for(l.s();!(c=l.n()).done;){var h=c.value.split("=");if(h[0].includes("user")&&!h[1].includes("write")&&!h[1].includes("append"))return!1}}catch(e){l.e(e)}finally{l.f()}}var d=t.each(s,this.ns.httph("accept-patch"));if(d.length)for(var f=0;f<d.length;f++){if((r=d[f].value.trim()).indexOf("application/sparql-update")>=0)return"SPARQL";if(r.indexOf("application/sparql-update-single-match")>=0)return"SPARQL"}var p=t.each(s,this.ns.httph("ms-author-via"));if(p.length)for(var v=0;v<p.length;v++){if((r=p[v].value.trim()).indexOf("SPARQL")>=0)return"SPARQL";if(r.indexOf("DAV")>=0)return"DAV"}if(!this.isHttpUri(e))return!!u&&"LOCALFILE";var y=t.each(s,this.ns.http("status"));if(y.length)for(var g=0;g<y.length;g++)200!==y[g]&&404!==y[g]||(i=!0)}}if(0===a.length);else if(i)return!1}},{key:"anonymize",value:function(e){return"_:"===e.toNT().substr(0,2)&&this.mentioned(e)?"?"+e.toNT().substr(2):e.toNT()}},{key:"anonymizeNT",value:function(e){return this.anonymize(e.subject)+" "+this.anonymize(e.predicate)+" "+this.anonymize(e.object)+" ."}},{key:"statementBnodes",value:function(e){return[e.subject,e.predicate,e.object].filter((function(e){return Object($.a)(e)}))}},{key:"statementArrayBnodes",value:function(e){for(var t=[],n=0;n<e.length;n++)t=t.concat(this.statementBnodes(e[n]));t.sort();for(var r=[],i=0;i<t.length;i++)0!==i&&t[i].equals(t[i-1])||r.push(t[i]);return r}},{key:"cacheIfps",value:function(){this.ifps={};for(var e=this.store.each(void 0,this.ns.rdf("type"),this.ns.owl("InverseFunctionalProperty")),t=0;t<e.length;t++)this.ifps[e[t].value]=!0;this.fps={},e=this.store.each(void 0,this.ns.rdf("type"),this.ns.owl("FunctionalProperty"));for(var n=0;n<e.length;n++)this.fps[e[n].value]=!0}},{key:"bnodeContext2",value:function(e,t,n){for(var r,i,a=this.store.statementsMatching(void 0,void 0,e,t),o=0;o<a.length;o++)if(this.fps[a[o].predicate.value]){if(!(r=a[o].subject).isBlank)return[a[o]];if(n&&(i=this.bnodeContext2(r,t,n-1)))return i.concat([a[o]])}a=this.store.statementsMatching(e,void 0,void 0,t);for(var s=0;s<a.length;s++)if(this.ifps[a[s].predicate.value]){if(!(r=a[s].object).isBlank)return[a[s]];if(n&&(i=this.bnodeContext2(r,t,n-1)))return i.concat([a[s]])}return null}},{key:"bnodeContext1",value:function(e,t){for(var n=0;n<3;n++){var r=this.bnodeContext2(e,t,n);if(null!==r)return r}return this.store.connectedStatements(e,t)}},{key:"mentioned",value:function(e){return 0!==this.store.statementsMatching(e,null,null,null).length||0!==this.store.statementsMatching(null,e).length||0!==this.store.statementsMatching(null,null,e).length}},{key:"bnodeContext",value:function(e,t){var n=[];if(e.length){this.cacheIfps();for(var r=0;r<e.length;r++){var i=e[r];this.mentioned(i)&&(n=n.concat(this.bnodeContext1(i,t)))}}return n}},{key:"statementContext",value:function(e){var t=this.statementBnodes(e);return this.bnodeContext(t,e.graph)}},{key:"contextWhere",value:function(e){var t=this;return e&&0!==e.length?"WHERE { "+e.map((function(e){return t.anonymizeNT(e)})).join("\n")+" }\n":""}},{key:"fire",value:function(e,t,n){var r=this;return Promise.resolve().then((function(){if(!e)throw new Error("No URI given for remote editing operation: "+t);var n={noMeta:!0,contentType:"application/sparql-update",body:t};return r.store.fetcher.webOperation("PATCH",e,n)})).then((function(r){if(!r.ok){var i="UpdateManager: update failed for <"+e+"> status="+r.status+", "+r.statusText+"\n for query: "+t;throw new Error(i)}n(e,r.ok,r.responseText,r)})).catch((function(t){n(e,!1,t.message,t)}))}},{key:"update_statement",value:function(e){if(!e||e.graph){var t=this,n=this.statementContext(e);return{statement:e?[e.subject,e.predicate,e.object,e.graph]:void 0,statementNT:e?this.anonymizeNT(e):void 0,where:t.contextWhere(n),set_object:function(e,n){var r=this.where;r+="DELETE DATA { "+this.statementNT+" } ;\n",r+="INSERT DATA { "+this.anonymize(this.statement[0])+" "+this.anonymize(this.statement[1])+" "+this.anonymize(e)+" . }\n",t.fire(this.statement[3].value,r,n)}}}}},{key:"insert_statement",value:function(e,t){var n=e instanceof Array?e[0]:e,r=this.contextWhere(this.statementContext(n));if(e instanceof Array){for(var i="",a=0;a<e.length;a++)i+=e[a]+"\n";r+="INSERT DATA { "+i+" }\n"}else r+="INSERT DATA { "+this.anonymize(e.subject)+" "+this.anonymize(e.predicate)+" "+this.anonymize(e.object)+" . }\n";this.fire(n.graph.value,r,t)}},{key:"delete_statement",value:function(e,t){var n=e instanceof Array?e[0]:e,r=this.contextWhere(this.statementContext(n));if(e instanceof Array){for(var i="",a=0;a<e.length;a++)i+=e[a]+"\n";r+="DELETE DATA { "+i+" }\n"}else r+="DELETE DATA { "+this.anonymize(e.subject)+" "+this.anonymize(e.predicate)+" "+this.anonymize(e.object)+" . }\n";this.fire(n.graph.value,r,t)}},{key:"requestDownstreamAction",value:function(e,t){var n=this.patchControlFor(e);if(n.pendingUpstream)if(n.downstreamAction){if(""+n.downstreamAction!=""+t)throw new Error("Can't wait for > 1 different downstream actions")}else n.downstreamAction=t;else t(e)}},{key:"clearUpstreamCount",value:function(e){this.patchControlFor(e).upstreamCount=0}},{key:"getUpdatesVia",value:function(e){var t=this.store.fetcher.getHeader(e,"updates-via");return t&&t.length?t[0].trim():null}},{key:"addDownstreamChangeListener",value:function(e,t){var n=this,r=this.patchControlFor(e);r.downstreamChangeListeners||(r.downstreamChangeListeners=[]),r.downstreamChangeListeners.push(t),this.setRefreshHandler(e,(function(e){n.reloadAndSync(e)}))}},{key:"reloadAndSync",value:function(e){var t=this.patchControlFor(e),n=this;if(t.reloading)t.outOfDate=!0;else{t.reloading=!0;var r=1e3;!function i(){n.reload(n.store,e,(function(e,n,a){if(e){if(t.downstreamChangeListeners)for(var o=0;o<t.downstreamChangeListeners.length;o++)t.downstreamChangeListeners[o]();t.reloading=!1,t.outOfDate&&(t.outOfDate=!1,i())}else t.reloading=!1,0===a.status&&(t.reloading=!0,r*=2,setTimeout(i,r))}))}()}}},{key:"setRefreshHandler",value:function(e,t){var n=this.getUpdatesVia(e),r=t,i=this,a=this,o=1500,s=0;if(!n)return!1;var u=(n=Object(Q.join)(n,e.value)).replace(/^http:/,"ws:").replace(/^https:/,"wss:");return function t(){var n;if("undefined"!=typeof WebSocket)n=new WebSocket(u);else{if("undefined"==typeof window||!window.WebSocket)return;n=window.WebSocket(u)}n.onopen=function(){o=1500,this.send("sub "+e.value),s&&a.requestDownstreamAction(e,r)};var c=i.patchControlFor(e);c.upstreamCount=0,n.onerror=function(e){},n.onclose=function(e){o*=2,s+=1,setTimeout((function(){t()}),o)},n.onmessage=function(t){if(t.data&&"pub"===t.data.slice(0,3)){if("upstreamCount"in c&&(c.upstreamCount-=1,c.upstreamCount>=0))return;c.upstreamCount=0,i.requestDownstreamAction(e,r)}}}(),!0}},{key:"updateMany",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=e.concat(t).map((function(e){return e.why})),r=this,i=[];n.forEach((function(e){i.find((function(t){return t.equals(e)}))||i.push(e)}));var a=i.map((function(n){return r.update(e.filter((function(e){return e.why.equals(n)})),t.filter((function(e){return e.why.equals(n)})))}));return a.length>1&&console.log("@@ updateMany to ".concat(a.length,": ").concat(i)),Promise.all(a)}},{key:"update",value:function(e,t,n,r){var i=this;if(!n){var a=this;return new Promise((function(n,r){a.update(e,t,(function(e,t,i){t?n():r(new Error(i))}))}))}try{var o=this.store,s=e?Object($.k)(e)?e.statements:e instanceof Array?e:[e]:[],u=t?Object($.k)(t)?t.statements:t instanceof Array?t:[t]:[];if(!(s instanceof Array))throw new Error("Type Error "+X()(s)+": "+s);if(!(u instanceof Array))throw new Error("Type Error "+X()(u)+": "+u);if(0===s.length&&0===u.length)return n(null,!0);var c=s.length?s[0].graph:u[0].graph;if(!c){var l="Error patching: statement does not specify which document to patch:"+s[0]+", "+u[0];throw new Error(l)}var h=this.patchControlFor(c),d=Date.now(),f=["subject","predicate","object","why"],p={delete:s,insert:u};["insert","delete"].map((function(e){p[e].map((function(e){if(!c.equals(e.graph))throw new Error("update: destination "+c+" inconsistent with delete quad "+e.graph);f.map((function(t){if(void 0===e[t])throw new Error("update: undefined "+t+" of statement.")}))}))}));var v=this.editable(c.value,o);if(!1===v)throw new Error("Update: Can't make changes in uneditable "+c);if(void 0===v){if(r)throw new Error("Update: Loaded "+c+"but stil can't figure out what editing protcol it supports.");return void this.store.fetcher.load(c).then((function(r){i.update(e,t,n,!0)}),(function(r){if(404!==r.response.status)throw new Error("Update: Can't get updatability status ".concat(c," before patching: ").concat(r));i.update(e,t,n,!0)}))}if(v.indexOf("SPARQL")>=0){var y=[];s.length&&(y=this.statementArrayBnodes(s)),u.length&&(y=y.concat(this.statementArrayBnodes(u)));var g=this.bnodeContext(y,c),m=this.contextWhere(g),b="";if(m.length){if(s.length){b+="DELETE { ";for(var w=0;w<s.length;w++)b+=this.anonymizeNT(s[w])+"\n";b+=" }\n"}if(u.length){b+="INSERT { ";for(var x=0;x<u.length;x++)b+=this.anonymizeNT(u[x])+"\n";b+=" }\n"}b+=m}else{if(s.length){b+="DELETE DATA { ";for(var _=0;_<s.length;_++)b+=this.anonymizeNT(s[_])+"\n";b+=" } \n"}if(u.length){s.length&&(b+=" ; "),b+="INSERT DATA { ";for(var k=0;k<u.length;k++)b+=this.anonymizeNT(u[k])+"\n";b+=" }\n"}}h.pendingUpstream=h.pendingUpstream?h.pendingUpstream+1:1,"upstreamCount"in h&&(h.upstreamCount+=1),this.fire(c.value,b,(function(e,t,r,i){if(i.elapsedTimeMs=Date.now()-d,console.log(" UpdateManager: Return "+(t?"success ":"FAILURE ")+i.status+" elapsed "+i.elapsedTimeMs+"ms"),t){try{o.remove(s)}catch(e){t=!1,r="Remote Ok BUT error deleting "+s.length+" from store!!! "+e}for(var a=0;a<u.length;a++)o.add(u[a].subject,u[a].predicate,u[a].object,c)}if(n(e,t,r,i),h.pendingUpstream-=1,0===h.pendingUpstream&&h.downstreamAction){var l=h.downstreamAction;delete h.downstreamAction,l(c)}}))}else if(v.indexOf("DAV")>=0)this.updateDav(c,s,u,n);else{if(!(v.indexOf("LOCALFILE")>=0))throw new Error("Unhandled edit method: '"+v+"' for "+c);try{this.updateLocalFile(c,s,u,n)}catch(e){n(c.value,!1,"Exception trying to write back file <"+c.value+">\n")}}}catch(e){n(void 0,!1,"Exception in update: "+e+"\n"+G.stackString(e))}}},{key:"updateDav",value:function(e,t,n,r){var i=this.store,a=i.any(e,this.ns.link("request"));if(!a)throw new Error("No record of our HTTP GET request for document: "+e);var o=i.any(a,this.ns.link("response"));if(!o)return null;for(var s=i.the(o,this.ns.httph("content-type")).value,u=i.statementsMatching(void 0,void 0,void 0,e).slice(),c=0;c<t.length;c++)G.RDFArrayRemove(u,t[c]);for(var l=0;l<n.length;l++)u.push(n[l]);var h,d=this.serialize(e.value,u,s),f=i.the(o,this.ns.httph("content-location"));f&&(h=Object(Q.join)(f.value,h));var p={contentType:s,noMeta:!0,body:d};return i.fetcher.webOperation("PUT",h,p).then((function(a){if(!a.ok)throw new Error(a.error);for(var o=0;o<t.length;o++)i.remove(t[o]);for(var s=0;s<n.length;s++)i.add(n[s].subject,n[s].predicate,n[s].object,e);r(e.value,a.ok,a.responseText,a)})).catch((function(t){r(e.value,!1,t.message,t)}))}},{key:"updateLocalFile",value:function(e,t,n,r){for(var i=this.store,a=i.statementsMatching(void 0,void 0,void 0,e).slice(),o=0;o<t.length;o++)G.RDFArrayRemove(a,t[o]);for(var s=0;s<n.length;s++)a.push(n[s]);var u=e.value.lastIndexOf(".");if(u<1)throw new Error("Rewriting file: No filename extension: "+e.value);var c=e.value.slice(u+1),l=T.a.CONTENT_TYPE_BY_EXT[c];if(!l)throw new Error("File extension ."+c+" not supported for data write");var h=this.serialize(e.value,a,l);i.fetcher.webOperation("PUT",e.value,{body:h,contentType:l}).then((function(a){if(!a.ok)return r(e.value,!1,a.error);for(var o=0;o<t.length;o++)i.remove(t[o]);for(var s=0;s<n.length;s++)i.add(n[s].subject,n[s].predicate,n[s].object,e);r(e.value,!0,"")}))}},{key:"serialize",value:function(e,t,n){var r,i=this.store;if("string"==typeof t)return t;var a=Object(q.a)(i);switch(a.suggestNamespaces(i.namespaces),a.setBase(e),n){case"text/xml":case"application/rdf+xml":r=a.statementsToXML(t);break;case"text/n3":case"text/turtle":case"application/x-turtle":case"application/n3":r=a.statementsToN3(t);break;default:throw new Error("Content-type "+n+" not supported for data serialization")}return r}},{key:"put",value:function(e,t,n,r){var i,a=this,o=this.store;return Promise.resolve().then((function(){return i=a.serialize(e.value,t,n),o.fetcher.webOperation("PUT",e.value,{contentType:n,body:i})})).then((function(n){if(!n.ok)return r(e.value,n.ok,n.error,n);delete o.fetcher.nonexistent[e.value],delete o.fetcher.requested[e.value],"string"!=typeof t&&t.map((function(e){o.addStatement(e)})),r(e.value,n.ok,"",n)})).catch((function(t){r(e.value,!1,t.message)}))}},{key:"reload",value:function(e,t,n){var r=Date.now();e.fetcher.nowOrWhenFetched(t.value,{force:!0,noMeta:!0,clearPreviousData:!0},(function(e,i,a){if(e)if(a.onErrorWasCalled||200!==a.status)n(!1,"Non-HTTP error reloading data: "+i,a);else{var o=Date.now()-r;t.reloadTimeTotal||(t.reloadTimeTotal=0),t.reloadTimeCount||(t.reloadTimeCount=0),t.reloadTimeTotal+=o,t.reloadTimeCount+=1,n(!0)}else n(!1,"Error reloading data: "+i,a)}))}}]),e}(),K=n(48);function ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ee(Object(n),!0).forEach((function(t){p()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ee(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ne=te(te({},K.a),{},{fetcher:function(e,t){return new T.a(e,t)},graph:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return new j.a(e,t||{rdfFactory:K.a})},lit:function(e,t,n){return this.literal(""+e,t||n)},st:function(e,t,n,r){return this.quad(e,t,n,r)}}),re=function(){function e(t,n){i()(this,e),this.parent=t,this.via=n,this.connected=!1,this.pending={},this.subscribed={},this.socket={};try{this.socket=new WebSocket(n),this.socket.onopen=this.onOpen,this.socket.onclose=this.onClose,this.socket.onmessage=this.onMessage,this.socket.onerror=this.onError}catch(e){this.onError(e)}}return b()(e,[{key:"_decode",value:function(e){var t,n,r,i,a,o,s;for(n in i={},a=function(){var n,r,i,a;for(a=[],n=0,r=(i=e.split("&")).length;n<r;n++)t=i[n],a.push(t.split("="));return a}())t=a[n],s=(o=[decodeURIComponent(t[0]),decodeURIComponent(t[1])])[1],null==i[r=o[0]]&&(i[r]=[]),i[r].push(s);return i}},{key:"_send",value:function(e,t,n){var r,i;return i=[e,t,n].join(" "),"function"==typeof(r=this.socket).send?r.send(i):void 0}},{key:"_subscribe",value:function(e){return this._send("sub",e,""),this.subscribed[e]=!0,this.subscribed[e]}},{key:"onClose",value:function(e){var t;for(t in this.connected=!1,this.subscribed)this.pending[t]=!0;return this.subscribed={},this.subscribed}},{key:"onError",value:function(e){throw new Error("onError"+e)}},{key:"onMessage",value:function(e){var t,n;return"ping"===(n=e.data.split(" "))[0]?"function"==typeof(t=this.socket).send?t.send("pong "+n.slice(1).join(" ")):void 0:"pub"===n[0]?this.parent.onUpdate(n[1],this._decode(n[2])):void 0}},{key:"onOpen",value:function(e){var t,n;for(n in this.connected=!0,t=[],this.pending)delete this.pending[n],t.push(this._subscribe(n));return t}},{key:"subscribe",value:function(e){return this.connected?this._subscribe(e):(this.pending[e]=!0,this.pending[e])}}]),e}(),ie=function(){function e(t){i()(this,e),this.fetcher=t,this.graph={},this.via={},this.fetcher.addCallback("headers",this.onHeaders)}return b()(e,[{key:"onHeaders",value:function(e){var t,n,r;return null==e.headers||"undefined"==typeof WebSocket||null===WebSocket||(t=e.headers.etag,r=e.headers["updates-via"],n=e.uri,t&&r&&(this.graph[n]={etag:t,via:r},this.register(r,n))),!0}},{key:"onUpdate",value:function(e,t){return this.fetcher.refresh(ne.namedNode(e))}},{key:"register",value:function(e,t){return null==this.via[e]&&(this.via[e]=new re(this,e)),this.via[e].subscribe(t)}}]),e}(),ae=n(23);function oe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=d()(e);if(t){var i=d()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return l()(this,n)}}var se={};for(var ue in ne)"function"==typeof ne[ue]&&(se[ue]=ne[ue].bind(ne));var ce=se.fetcher,le=se.graph,he=se.lit,de=se.st,fe=se.namedNode,pe=se.variable,ve=se.blankNode,ye=se.defaultGraph,ge=se.literal,me=se.quad,be=se.triple,we=new N.a,xe=function(e){return we.fromNT(e)},_e=C.a.fromValue,ke=v.a.nextId,Te=function(e){u()(n,e);var t=oe(n);function n(e){var r;return i()(this,n),r=t.call(this,e),p()(o()(r),"fetcher",void 0),r.fetcher=new T.a(o()(r),{}),r}return n}(j.a),Ne=function(e){u()(n,e);var t=oe(n);function n(e){var r;return i()(this,n),r=t.call(this,e),p()(o()(r),"updater",void 0),r.updater=new Z(o()(r)),r}return n}(Te)},function(e,t,n){e.exports=n(77)},function(e,t){const n={acl:"http://www.w3.org/ns/auth/acl#",arg:"http://www.w3.org/ns/pim/arg#",as:"https://www.w3.org/ns/activitystreams#",cal:"http://www.w3.org/2002/12/cal/ical#",cert:"http://www.w3.org/ns/auth/cert#",contact:"http://www.w3.org/2000/10/swap/pim/contact#",dc:"http://purl.org/dc/elements/1.1/",dct:"http://purl.org/dc/terms/",doap:"http://usefulinc.com/ns/doap#",foaf:"http://xmlns.com/foaf/0.1/",geo:"http://www.w3.org/2003/01/geo/wgs84_pos#",gpx:"http://www.w3.org/ns/pim/gpx#",http:"http://www.w3.org/2007/ont/http#",httph:"http://www.w3.org/2007/ont/httph#",icalTZ:"http://www.w3.org/2002/12/cal/icaltzd#",ldp:"http://www.w3.org/ns/ldp#",link:"http://www.w3.org/2007/ont/link#",log:"http://www.w3.org/2000/10/swap/log#",meeting:"http://www.w3.org/ns/pim/meeting#",mo:"http://purl.org/ontology/mo/",org:"http://www.w3.org/ns/org#",owl:"http://www.w3.org/2002/07/owl#",pad:"http://www.w3.org/ns/pim/pad#",patch:"http://www.w3.org/ns/pim/patch#",prov:"http://www.w3.org/ns/prov#",qu:"http://www.w3.org/2000/10/swap/pim/qif#",trip:"http://www.w3.org/ns/pim/trip#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",rss:"http://purl.org/rss/1.0/",sched:"http://www.w3.org/ns/pim/schedule#",schema:"http://schema.org/",sioc:"http://rdfs.org/sioc/ns#",solid:"http://www.w3.org/ns/solid/terms#",space:"http://www.w3.org/ns/pim/space#",stat:"http://www.w3.org/ns/posix/stat#",tab:"http://www.w3.org/2007/ont/link#",tabont:"http://www.w3.org/2007/ont/link#",ui:"http://www.w3.org/ns/ui#",vcard:"http://www.w3.org/2006/vcard/ns#",wf:"http://www.w3.org/2005/01/wf/flow#",xsd:"http://www.w3.org/2001/XMLSchema#",cco:"http://www.ontologyrepository.com/CommonCoreOntologies/"};e.exports=function(e={namedNode:e=>e}){const t={};for(const r in n){const i=n[r];t[r]=function(t=""){return e.namedNode(i+t)}}return t}},function(e,t,n){"use strict";(function(t){const r=n(58),i=n(66),a=n(67),o=n(59);function s(e,t){return e.hash<t.hash?-1:e.hash>t.hash?1:0}e.exports=class{constructor(){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n"),this.hashAlgorithm="sha256",this.quads=null}async main(e){this.quads=e;for(const t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});const t=new Map,n=[...this.blankNodeInfo.keys()];let i=0;for(const e of n)++i%100==0&&await this._yield(),await this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});const a=[...t.keys()].sort(),u=[];for(const e of a){const n=t.get(e);if(n.length>1){u.push(n);continue}const r=n[0];this.canonicalIssuer.getId(r)}for(const e of u){const t=[];for(const n of e){if(this.canonicalIssuer.hasId(n))continue;const e=new r("_:b");e.getId(n);const i=await this.hashNDegreeQuads(n,e);t.push(i)}t.sort(s);for(const e of t){const t=e.issuer.getOldIds();for(const e of t)this.canonicalIssuer.getId(e)}}const c=[];for(const e of this.quads){const t={...e};t.subject=this._useCanonicalId({component:t.subject}),t.object=this._useCanonicalId({component:t.object}),t.graph=this._useCanonicalId({component:t.graph}),c.push(o.serializeQuad(t))}return c.sort(),c.join("")}async hashFirstDegreeQuads(e){const t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(const n of r){const r={subject:null,predicate:n.predicate,object:null,graph:null};r.subject=this.modifyFirstDegreeComponent(e,n.subject,"subject"),r.object=this.modifyFirstDegreeComponent(e,n.object,"object"),r.graph=this.modifyFirstDegreeComponent(e,n.graph,"graph"),t.push(o.serializeQuad(r))}t.sort();const a=new i(this.hashAlgorithm);for(const e of t)a.update(e);return n.hash=await a.digest(),n.hash}async hashRelatedBlankNode(e,t,n,r){let a;a=this.canonicalIssuer.hasId(e)?this.canonicalIssuer.getId(e):n.hasId(e)?n.getId(e):this.blankNodeInfo.get(e).hash;const o=new i(this.hashAlgorithm);return o.update(r),"g"!==r&&o.update(this.getRelatedPredicate(t)),o.update(a),o.digest()}async hashNDegreeQuads(e,t){const n=new i(this.hashAlgorithm),r=await this.createHashToRelated(e,t),o=[...r.keys()].sort();for(const e of o){n.update(e);let i,o="";const s=new a(r.get(e));let u=0;for(;s.hasNext();){const e=s.next();++u%3==0&&await this._yield();let n=t.clone(),r="";const a=[];let c=!1;for(const t of e)if(this.canonicalIssuer.hasId(t)?r+=this.canonicalIssuer.getId(t):(n.hasId(t)||a.push(t),r+=n.getId(t)),0!==o.length&&r>o){c=!0;break}if(!c){for(const e of a){const t=await this.hashNDegreeQuads(e,n);if(r+=n.getId(e),r+=`<${t.hash}>`,n=t.issuer,0!==o.length&&r>o){c=!0;break}}c||(0===o.length||r<o)&&(o=r,i=n)}}n.update(o),t=i}return{hash:await n.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return"BlankNode"!==t.termType?t:{termType:"BlankNode",value:t.value===e?"_:a":"_:z"}}getRelatedPredicate(e){return`<${e.predicate.value}>`}async createHashToRelated(e,t){const n=new Map,r=this.blankNodeInfo.get(e).quads;let i=0;for(const 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}){const n=await this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if("BlankNode"!==t.termType)return;const 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("BlankNode"!==t.termType||t.value===r)return;const o=t.value,s=await this.hashRelatedBlankNode(o,e,i,n),u=a.get(s);u?u.push(o):a.set(s,[o])}_useCanonicalId({component:e}){return"BlankNode"!==e.termType||e.value.startsWith(this.canonicalIssuer.prefix)?e:{termType:"BlankNode",value:this.canonicalIssuer.getId(e.value)}}async _yield(){return new Promise(e=>t(e))}}}).call(this,n(80).setImmediate)},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,i,a,o,s,u=1,c={},l=!1,h=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){p(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((a=new MessageChannel).port1.onmessage=function(e){p(e.data)},r=function(e){a.port2.postMessage(e)}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,r=function(e){var t=h.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):r=function(e){setTimeout(p,0,e)}:(o="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(o)&&p(+t.data.slice(o.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),r=function(t){e.postMessage(o+t,"*")}),d.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var i={callback:e,args:t};return c[u]=i,r(u),u++},d.clearImmediate=f}function f(e){delete c[e]}function p(e){if(l)setTimeout(p,0,e);else{var t=c[e];if(t){l=!0;try{!function(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(void 0,n)}}(t)}finally{f(e),l=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(44),n(81))},function(e,t,n){"use strict";n(65);const r=self.crypto||self.msCrypto;e.exports=class{constructor(e){if(!r||!r.subtle)throw new Error("crypto.subtle not found.");if("sha256"===e)this.algorithm={name:"SHA-256"};else{if("sha1"!==e)throw new Error(`Unsupport algorithm "${e}".`);this.algorithm={name:"SHA-1"}}this._content=""}update(e){this._content+=e}async digest(){const e=(new TextEncoder).encode(this._content),t=new Uint8Array(await r.subtle.digest(this.algorithm,e));let n="";for(let e=0;e<t.length;++e)n+=t[e].toString(16).padStart(2,"0");return n}}},function(e,t,n){"use strict";e.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(){const{current:e,dir:t}=this,n=e.slice();let r=null,i=0;const a=e.length;for(let n=0;n<a;++n){const o=e[n],s=t.get(o);(null===r||o>r)&&(s&&n>0&&o>e[n-1]||!s&&n<a-1&&o>e[n+1])&&(r=o,i=n)}if(null===r)this.done=!0;else{const n=t.get(r)?i-1:i+1;e[i]=e[n],e[n]=r;for(const n of e)n>r&&t.set(n,!t.get(n))}return n}}},function(e,t,n){"use strict";const r=n(58),i=n(66),a=n(67),o=n(59);function s(e,t){return e.hash<t.hash?-1:e.hash>t.hash?1:0}e.exports=class{constructor(){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n"),this.hashAlgorithm="sha256",this.quads=null}main(e){this.quads=e;for(const t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});const t=new Map,n=[...this.blankNodeInfo.keys()];for(const e of n)this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});const i=[...t.keys()].sort(),a=[];for(const e of i){const n=t.get(e);if(n.length>1){a.push(n);continue}const r=n[0];this.canonicalIssuer.getId(r)}for(const e of a){const t=[];for(const n of e){if(this.canonicalIssuer.hasId(n))continue;const e=new r("_:b");e.getId(n);const i=this.hashNDegreeQuads(n,e);t.push(i)}t.sort(s);for(const e of t){const t=e.issuer.getOldIds();for(const e of t)this.canonicalIssuer.getId(e)}}const u=[];for(const e of this.quads){const t={...e};t.subject=this._useCanonicalId({component:t.subject}),t.object=this._useCanonicalId({component:t.object}),t.graph=this._useCanonicalId({component:t.graph}),u.push(o.serializeQuad(t))}return u.sort(),u.join("")}hashFirstDegreeQuads(e){const t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(const n of r){const r={subject:null,predicate:n.predicate,object:null,graph:null};r.subject=this.modifyFirstDegreeComponent(e,n.subject,"subject"),r.object=this.modifyFirstDegreeComponent(e,n.object,"object"),r.graph=this.modifyFirstDegreeComponent(e,n.graph,"graph"),t.push(o.serializeQuad(r))}t.sort();const a=new i(this.hashAlgorithm);for(const e of t)a.update(e);return n.hash=a.digest(),n.hash}hashRelatedBlankNode(e,t,n,r){let a;a=this.canonicalIssuer.hasId(e)?this.canonicalIssuer.getId(e):n.hasId(e)?n.getId(e):this.blankNodeInfo.get(e).hash;const o=new i(this.hashAlgorithm);return o.update(r),"g"!==r&&o.update(this.getRelatedPredicate(t)),o.update(a),o.digest()}hashNDegreeQuads(e,t){const n=new i(this.hashAlgorithm),r=this.createHashToRelated(e,t),o=[...r.keys()].sort();for(const e of o){n.update(e);let i,o="";const s=new a(r.get(e));for(;s.hasNext();){const e=s.next();let n=t.clone(),r="";const a=[];let u=!1;for(const t of e)if(this.canonicalIssuer.hasId(t)?r+=this.canonicalIssuer.getId(t):(n.hasId(t)||a.push(t),r+=n.getId(t)),0!==o.length&&r>o){u=!0;break}if(!u){for(const e of a){const t=this.hashNDegreeQuads(e,n);if(r+=n.getId(e),r+=`<${t.hash}>`,n=t.issuer,0!==o.length&&r>o){u=!0;break}}u||(0===o.length||r<o)&&(o=r,i=n)}}n.update(o),t=i}return{hash:n.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return"BlankNode"!==t.termType?t:{termType:"BlankNode",value:t.value===e?"_:a":"_:z"}}getRelatedPredicate(e){return`<${e.predicate.value}>`}createHashToRelated(e,t){const n=new Map,r=this.blankNodeInfo.get(e).quads;for(const 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}){const n=this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if("BlankNode"!==t.termType)return;const 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("BlankNode"!==t.termType||t.value===r)return;const o=t.value,s=this.hashRelatedBlankNode(o,e,i,n),u=a.get(s);u?u.push(o):a.set(s,[o])}_useCanonicalId({component:e}){return"BlankNode"!==e.termType||e.value.startsWith(this.canonicalIssuer.prefix)?e:{termType:"BlankNode",value:this.canonicalIssuer.getId(e.value)}}}},function(e,t,n){"use strict";e.exports=class{constructor(){this._requests={}}wrapLoader(e){const 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]}}}},function(e,t,n){"use strict";const r=n(89),i=Symbol("max"),a=Symbol("length"),o=Symbol("lengthCalculator"),s=Symbol("allowStale"),u=Symbol("maxAge"),c=Symbol("dispose"),l=Symbol("noDisposeOnSet"),h=Symbol("lruList"),d=Symbol("cache"),f=Symbol("updateAgeOnGet"),p=()=>1;const v=(e,t,n)=>{const r=e[d].get(t);if(r){const t=r.value;if(y(e,t)){if(m(e,r),!e[s])return}else n&&(e[f]&&(r.value.now=Date.now()),e[h].unshiftNode(r));return t.value}},y=(e,t)=>{if(!t||!t.maxAge&&!e[u])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[u]&&n>e[u]},g=e=>{if(e[a]>e[i])for(let t=e[h].tail;e[a]>e[i]&&null!==t;){const n=t.prev;m(e,t),t=n}},m=(e,t)=>{if(t){const n=t.value;e[c]&&e[c](n.key,n.value),e[a]-=n.length,e[d].delete(n.key),e[h].removeNode(t)}};class b{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}}const w=(e,t,n,r)=>{let i=n.value;y(e,i)&&(m(e,n),e[s]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[i]=e.max||1/0;const t=e.length||p;if(this[o]="function"!=typeof t?p:t,this[s]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[u]=e.maxAge||0,this[c]=e.dispose,this[l]=e.noDisposeOnSet||!1,this[f]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[i]=e||1/0,g(this)}get max(){return this[i]}set allowStale(e){this[s]=!!e}get allowStale(){return this[s]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[u]=e,g(this)}get maxAge(){return this[u]}set lengthCalculator(e){"function"!=typeof e&&(e=p),e!==this[o]&&(this[o]=e,this[a]=0,this[h].forEach(e=>{e.length=this[o](e.value,e.key),this[a]+=e.length})),g(this)}get lengthCalculator(){return this[o]}get length(){return this[a]}get itemCount(){return this[h].length}rforEach(e,t){t=t||this;for(let n=this[h].tail;null!==n;){const r=n.prev;w(this,e,n,t),n=r}}forEach(e,t){t=t||this;for(let n=this[h].head;null!==n;){const r=n.next;w(this,e,n,t),n=r}}keys(){return this[h].toArray().map(e=>e.key)}values(){return this[h].toArray().map(e=>e.value)}reset(){this[c]&&this[h]&&this[h].length&&this[h].forEach(e=>this[c](e.key,e.value)),this[d]=new Map,this[h]=new r,this[a]=0}dump(){return this[h].map(e=>!y(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[h]}set(e,t,n){if((n=n||this[u])&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const r=n?Date.now():0,s=this[o](t,e);if(this[d].has(e)){if(s>this[i])return m(this,this[d].get(e)),!1;const o=this[d].get(e).value;return this[c]&&(this[l]||this[c](e,o.value)),o.now=r,o.maxAge=n,o.value=t,this[a]+=s-o.length,o.length=s,this.get(e),g(this),!0}const f=new b(e,t,s,r,n);return f.length>this[i]?(this[c]&&this[c](e,t),!1):(this[a]+=f.length,this[h].unshift(f),this[d].set(e,this[h].head),g(this),!0)}has(e){if(!this[d].has(e))return!1;const t=this[d].get(e).value;return!y(this,t)}get(e){return v(this,e,!0)}peek(e){return v(this,e,!1)}pop(){const e=this[h].tail;return e?(m(this,e),e.value):null}del(e){m(this,this[d].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const r=e[n],i=r.e||0;if(0===i)this.set(r.k,r.v);else{const e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[d].forEach((e,t)=>v(this,t,!1))}}},function(e,t){function n(e,t,n,r,i,a,o){try{var s=e[a](o),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}e.exports=function(e){return function(){var t=this,r=arguments;return new Promise((function(i,a){var o=e.apply(t,r);function s(e){n(o,i,a,s,u,"next",e)}function u(e){n(o,i,a,s,u,"throw",e)}s(void 0)}))}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return d}));var r=n(21),i=n(73),a=n.n(i);const{xsd:o}=r.a,s=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,u={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:"\t",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},c=/[\x00-\x20<>\\"\{\}\|\^\`]/,l={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},h=/$0^/;class d{constructor(e){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,e=e||{},this._lineMode=!!e.lineMode){this._n3Mode=!1;for(const e in this)!(e in l)&&this[e]instanceof RegExp&&(this[e]=h)}else this._n3Mode=!1!==e.n3;this._comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,t){let n=this._input;const r=this._comments;for(;;){let a,s;for(;a=this._newline.exec(n);)r&&(s=this._comment.exec(a[0]))&&e(null,{line:this._line,type:"comment",value:s[1],prefix:""}),n=n.substr(a[0].length,n.length),this._line++;if(!a&&(a=this._whitespace.exec(n))&&(n=n.substr(a[0].length,n.length)),this._endOfFile.test(n))return t&&(r&&(s=this._comment.exec(n))&&e(null,{line:this._line,type:"comment",value:s[1],prefix:""}),e(n=null,{line:this._line,type:"eof",value:"",prefix:""})),this._input=n;const u=this._line,l=n[0];let h="",d="",f="",p=null,v=0,y=!1;switch(l){case"^":if(n.length<3)break;if("^"!==n[1]){this._n3Mode&&(v=1,h="^");break}if(this._previousMarker="^^",n=n.substr(2),"<"!==n[0]){y=!0;break}case"<":if(p=this._unescapedIri.exec(n))h="IRI",d=p[1];else if(p=this._iri.exec(n)){if(d=this._unescape(p[1]),null===d||c.test(d))return i(this);h="IRI"}else n.length>1&&"<"===n[1]?(h="<<",v=2):this._n3Mode&&n.length>1&&"="===n[1]&&(h="inverse",v=2,d=">");break;case">":n.length>1&&">"===n[1]&&(h=">>",v=2);break;case"_":((p=this._blank.exec(n))||t&&(p=this._blank.exec(n+" ")))&&(h="blank",f="_",d=p[1]);break;case'"':if(p=this._simpleQuotedString.exec(n))d=p[1];else if(({value:d,matchLength:v}=this._parseLiteral(n)),null===d)return i(this);null===p&&0===v||(h="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(p=this._simpleApostropheString.exec(n))d=p[1];else if(({value:d,matchLength:v}=this._parseLiteral(n)),null===d)return i(this);null===p&&0===v||(h="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(p=this._variable.exec(n))&&(h="var",d=p[0]);break;case"@":"literal"===this._previousMarker&&(p=this._langcode.exec(n))?(h="langcode",d=p[1]):(p=this._keyword.exec(n))&&(h=p[0]);break;case".":if(1===n.length?t:n[1]<"0"||n[1]>"9"){h=".",v=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(p=this._number.exec(n)||t&&(p=this._number.exec(n+" ")))&&(h="literal",d=p[0],f="string"==typeof p[1]?o.double:"string"==typeof p[2]?o.decimal:o.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(p=this._sparqlKeyword.exec(n))?h=p[0].toUpperCase():y=!0;break;case"f":case"t":(p=this._boolean.exec(n))?(h="literal",d=p[0],f=o.boolean):y=!0;break;case"a":(p=this._shortPredicates.exec(n))?(h="abbreviation",d="a"):y=!0;break;case"=":this._n3Mode&&n.length>1&&(h="abbreviation",">"!==n[1]?(v=1,d="="):(v=2,d=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"{":case"}":this._lineMode||(v=1,h=l);break;default:y=!0}if(y&&("@prefix"!==this._previousMarker&&"PREFIX"!==this._previousMarker||!(p=this._prefix.exec(n))?((p=this._prefixed.exec(n))||t&&(p=this._prefixed.exec(n+" ")))&&(h="prefixed",f=p[1]||"",d=this._unescape(p[2])):(h="prefix",d=p[1]||"")),"^^"===this._previousMarker)switch(h){case"prefixed":h="type";break;case"IRI":h="typeIRI";break;default:h=""}if(!h)return t||!/^'''|^"""/.test(n)&&/\n|\r/.test(n)?i(this):this._input=n;const g={line:u,type:h,value:d,prefix:f};e(null,g),this.previousToken=g,this._previousMarker=h,n=n.substr(v||p[0].length,n.length)}function i(t){e(t._syntaxError(/^\S*/.exec(n)[0]))}}_unescape(e){let t=!1;const n=e.replace(s,(e,n,r,i)=>{if("string"==typeof n)return String.fromCharCode(Number.parseInt(n,16));if("string"==typeof r){let e=Number.parseInt(r,16);return e<=65535?String.fromCharCode(Number.parseInt(r,16)):String.fromCharCode(55296+((e-=65536)>>10),56320+(1023&e))}return i in u?u[i]:(t=!0,"")});return t?null:n}_parseLiteral(e){if(e.length>=3){const t=e.match(/^(?:"""|"|'''|'|)/)[0],n=t.length;let r=Math.max(this._literalClosingPos,n);for(;(r=e.indexOf(t,r))>0;){let t=0;for(;"\\"===e[r-t-1];)t++;if(t%2==0){const t=e.substring(n,r),i=t.split(/\r\n|\r|\n/).length-1,a=r+n;if(1===n&&0!==i||3===n&&this._lineMode)break;return this._line+=i,{value:this._unescape(t),matchLength:a}}r++}this._literalClosingPos=e.length-n+1}return{value:"",matchLength:0}}_syntaxError(e){this._input=null;const t=new Error(`Unexpected "${e}" on line ${this._line}.`);return t.context={token:void 0,line:this._line,previousToken:this.previousToken},t}_readStartingBom(e){return e.startsWith("\ufeff")?e.substr(1):e}tokenize(t,n){if(this._line=1,"string"==typeof t){if(this._input=this._readStartingBom(t),"function"!=typeof n){const e=[];let t;if(this._tokenizeToEnd((n,r)=>n?t=n:e.push(r),!0),t)throw t;return e}a()(()=>this._tokenizeToEnd(n,!0))}else this._pendingBuffer=null,"function"==typeof t.setEncoding&&t.setEncoding("utf8"),t.on("data",t=>{null!==this._input&&0!==t.length&&(this._pendingBuffer&&(t=e.concat([this._pendingBuffer,t]),this._pendingBuffer=null),128&t[t.length-1]?this._pendingBuffer=t:(void 0===this._input?this._input=this._readStartingBom("string"==typeof t?t:t.toString()):this._input+=t,this._tokenizeToEnd(n,!1)))}),t.on("end",()=>{"string"==typeof this._input&&this._tokenizeToEnd(n,!0)}),t.on("error",n)}}}).call(this,n(100).Buffer)},function(e,t,n){(function(t){/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
40
40
  let n;e.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:t):e=>(n||(n=Promise.resolve())).then(e).catch(e=>setTimeout(()=>{throw e},0))}).call(this,n(44))},,function(e,t,n){e.exports=n(61)},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,n(t,r)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=function(e){"use strict";var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var i=t&&t.prototype instanceof h?t:h,a=Object.create(i.prototype),o=new k(r||[]);return a._invoke=function(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return N()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=w(o,n);if(s){if(s===l)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=c(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(e,n,o),a}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function h(){}function d(){}function f(){}var p={};s(p,i,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(T([])));y&&y!==t&&n.call(y,i)&&(p=y);var g=f.prototype=h.prototype=Object.create(p);function m(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var r;this._invoke=function(i,a){function o(){return new t((function(r,o){!function r(i,a,o,s){var u=c(e[i],e,a);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==typeof h&&n.call(h,"__await")?t.resolve(h.__await).then((function(e){r("next",e,o,s)}),(function(e){r("throw",e,o,s)})):t.resolve(h).then((function(e){l.value=e,o(l)}),(function(e){return r("throw",e,o,s)}))}s(u.arg)}(i,a,r,o)}))}return r=r?r.then(o,o):o()}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=c(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,l;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function T(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:N}}function N(){return{value:void 0,done:!0}}return d.prototype=f,s(g,"constructor",f),s(f,"constructor",d),d.displayName=s(f,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,s(e,o,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},m(b.prototype),s(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new b(u(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},m(g),s(g,o,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=T,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,l):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),_(n),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;_(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:T(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t,n){"use strict";const r=n(64),i=n(82),a=n(68),o=n(83);let s;try{s=n(84)}catch(e){}const u={};e.exports=u,u.NQuads=n(59),u.IdentifierIssuer=n(58),u._rdfCanonizeNative=function(e){return e&&(s=e),s},u.canonize=async function(e,t){if(Array.isArray(e)||(e=u.NQuads.legacyDatasetToQuads(e)),t.useNative){if(!s)throw new Error("rdf-canonize-native not available");return new Promise((n,r)=>s.canonize(e,t,(e,t)=>e?r(e):n(t)))}if("URDNA2015"===t.algorithm)return new r(t).main(e);if("URGNA2012"===t.algorithm)return new i(t).main(e);if(!("algorithm"in t))throw new Error("No RDF Dataset Canonicalization algorithm specified.");throw new Error("Invalid RDF Dataset Canonicalization algorithm: "+t.algorithm)},u._canonizeSync=function(e,t){if(Array.isArray(e)||(e=u.NQuads.legacyDatasetToQuads(e)),t.useNative){if(s)return s.canonizeSync(e,t);throw new Error("rdf-canonize-native not available")}if("URDNA2015"===t.algorithm)return new a(t).main(e);if("URGNA2012"===t.algorithm)return new o(t).main(e);if(!("algorithm"in t))throw new Error("No RDF Dataset Canonicalization algorithm specified.");throw new Error("Invalid RDF Dataset Canonicalization algorithm: "+t.algorithm)}},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function a(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new a(i.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new a(i.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(65),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(44))},function(e,t){var n,r,i=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(e){n=a}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var u,c=[],l=!1,h=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&f())}function f(){if(!l){var e=s(d);l=!0;for(var t=c.length;t;){for(u=c,c=[];++h<t;)u&&u[h].run();h=-1,t=c.length}u=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new p(e,t)),1!==c.length||l||s(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){"use strict";const r=n(64);e.exports=class extends r{constructor(){super(),this.name="URGNA2012",this.hashAlgorithm="sha1"}modifyFirstDegreeComponent(e,t,n){return"BlankNode"!==t.termType?t:"graph"===n?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:t.value===e?"_:a":"_:z"}}getRelatedPredicate(e){return e.predicate.value}async createHashToRelated(e,t){const n=new Map,r=this.blankNodeInfo.get(e).quads;let i=0;for(const a of r){let r,o;if("BlankNode"===a.subject.termType&&a.subject.value!==e)o=a.subject.value,r="p";else{if("BlankNode"!==a.object.termType||a.object.value===e)continue;o=a.object.value,r="r"}++i%100==0&&await this._yield();const s=await this.hashRelatedBlankNode(o,a,t,r),u=n.get(s);u?u.push(o):n.set(s,[o])}return n}}},function(e,t,n){"use strict";const r=n(68);e.exports=class extends r{constructor(){super(),this.name="URGNA2012",this.hashAlgorithm="sha1"}modifyFirstDegreeComponent(e,t,n){return"BlankNode"!==t.termType?t:"graph"===n?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:t.value===e?"_:a":"_:z"}}getRelatedPredicate(e){return e.predicate.value}createHashToRelated(e,t){const n=new Map,r=this.blankNodeInfo.get(e).quads;for(const i of r){let r,a;if("BlankNode"===i.subject.termType&&i.subject.value!==e)a=i.subject.value,r="p";else{if("BlankNode"!==i.object.termType||i.object.value===e)continue;a=i.object.value,r="r"}const o=this.hashRelatedBlankNode(a,i,t,r),s=n.get(o);s?s.push(a):n.set(o,[a])}return n}}},function(e,t){},function(e,t,n){"use strict";const r=n(86),i={};e.exports=i,i.setupDocumentLoaders=function(e){"undefined"!=typeof XMLHttpRequest&&(e.documentLoaders.xhr=r,e.useDocumentLoader("xhr"))},i.setupGlobals=function(e){void 0===globalThis.JsonLdProcessor&&Object.defineProperty(globalThis,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:e.JsonLdProcessor})}},function(e,t,n){"use strict";const{parseLinkHeader:r,buildHeaders:i}=n(28),{LINK_HEADER_CONTEXT:a}=n(60),o=n(29),s=n(69),{prependBase:u}=n(33),c=/(^|(\r\n))link:/i;e.exports=({secure:e,headers:t={},xhr:n}={headers:{}})=>{t=i(t);return(new s).wrapLoader((async function i(s){if(0!==s.indexOf("http:")&&0!==s.indexOf("https:"))throw new o('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:s});if(e&&0!==s.indexOf("https"))throw new o('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:s});let l;try{l=await function(e,t,n){const r=new(e=e||XMLHttpRequest);return new Promise((e,i)=>{r.onload=()=>e(r),r.onerror=e=>i(e),r.open("GET",t,!0);for(const e in n)r.setRequestHeader(e,n[e]);r.send()})}(n,s,t)}catch(e){throw new o("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:s,cause:e})}if(l.status>=400)throw new o("URL could not be dereferenced: "+l.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:s,httpStatusCode:l.status});let h={contextUrl:null,documentUrl:s,document:l.response},d=null;const f=l.getResponseHeader("Content-Type");let p;c.test(l.getAllResponseHeaders())&&(p=l.getResponseHeader("Link"));if(p&&"application/ld+json"!==f){const e=r(p),t=e[a];if(Array.isArray(t))throw new o("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:s});t&&(h.contextUrl=t.target),d=e.alternate,d&&"application/ld+json"==d.type&&!(f||"").match(/^application\/(\w*\+)?json$/)&&(h=await i(u(s,d.target)))}return h}))}},function(e,t,n){"use strict";const{isArray:r,isObject:i,isString:a}=n(24),{asArray:o}=n(28),{prependBase:s}=n(33),u=n(29),c=n(88);function l(e){throw new u("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:e})}e.exports=class{constructor({sharedCache:e}){this.perOpCache=new Map,this.sharedCache=e}async resolve({activeCtx:e,context:t,documentLoader:n,base:s,cycles:u=new Set}){t&&i(t)&&t["@context"]&&(t=t["@context"]),t=o(t);const h=[];for(const o of t){if(a(o)){let t=this._get(o);t||(t=await this._resolveRemoteContext({activeCtx:e,url:o,documentLoader:n,base:s,cycles:u})),r(t)?h.push(...t):h.push(t);continue}if(null===o){h.push(new c({document:null}));continue}i(o)||l(t);const d=JSON.stringify(o);let f=this._get(d);f||(f=new c({document:o}),this._cacheResolvedContext({key:d,resolved:f,tag:"static"})),h.push(f)}return h}_get(e){let t=this.perOpCache.get(e);if(!t){const 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),void 0!==n){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:o,cycles:u}){t=s(o,t);const{context:c,remoteDoc:l}=await this._fetchContext({activeCtx:e,url:t,documentLoader:n,cycles:u});(function e({context:t,base:n}){if(!t)return;const o=t["@context"];if(a(o))return void(t["@context"]=s(n,o));if(r(o)){for(let t=0;t<o.length;++t){const r=o[t];a(r)?o[t]=s(n,r):i(r)&&e({context:{"@context":r},base:n})}return}if(!i(o))return;for(const t in o)e({context:o[t],base:n})})({context:c,base:o=l.documentUrl||t});const h=await this.resolve({activeCtx:e,context:c,documentLoader:n,base:o,cycles:u});return this._cacheResolvedContext({key:t,resolved:h,tag:l.tag}),h}async _fetchContext({activeCtx:e,url:t,documentLoader:n,cycles:o}){if(o.size>10)throw new u("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:"json-ld-1.0"===e.processingMode?"loading remote context failed":"context overflow",max:10});if(o.has(t))throw new u("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:"json-ld-1.0"===e.processingMode?"recursive context inclusion":"context overflow",url:t});let s,c;o.add(t);try{c=await n(t),s=c.document||null,a(s)&&(s=JSON.parse(s))}catch(e){throw new u("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.","jsonld.InvalidUrl",{code:"loading remote context failed",url:t,cause:e})}if(!i(s))throw new u("Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.","jsonld.InvalidUrl",{code:"invalid remote context",url:t});return s="@context"in s?{"@context":s["@context"]}:{"@context":{}},c.contextUrl&&(r(s["@context"])||(s["@context"]=[s["@context"]]),s["@context"].push(c.contextUrl)),{context:s,remoteDoc:c}}}},function(e,t,n){"use strict";const r=n(70);e.exports=class{constructor({document:e}){this.document=e,this.cache=new r({max:10})}getProcessed(e){return this.cache.get(e)}setProcessed(e,t){this.cache.set(e,t)}}},function(e,t,n){"use strict";function r(e){var t=this;if(t instanceof r||(t=new r),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var n=0,i=arguments.length;n<i;n++)t.push(arguments[n]);return t}function i(e,t,n){var r=t===e.head?new s(n,null,t,e):new s(n,t,t.next,e);return null===r.next&&(e.tail=r),null===r.prev&&(e.head=r),e.length++,r}function a(e,t){e.tail=new s(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function o(e,t){e.head=new s(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function s(e,t,n,r){if(!(this instanceof s))return new s(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}e.exports=r,r.Node=s,r.create=r,r.prototype.removeNode=function(e){if(e.list!==this)throw new 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},r.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||(this.tail=e),this.length++}},r.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||(this.head=e),this.length++}},r.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)a(this,arguments[e]);return this.length},r.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)o(this,arguments[e]);return this.length},r.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}},r.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}},r.prototype.forEach=function(e,t){t=t||this;for(var n=this.head,r=0;null!==n;r++)e.call(t,n.value,r,this),n=n.next},r.prototype.forEachReverse=function(e,t){t=t||this;for(var n=this.tail,r=this.length-1;null!==n;r--)e.call(t,n.value,r,this),n=n.prev},r.prototype.get=function(e){for(var t=0,n=this.head;null!==n&&t<e;t++)n=n.next;if(t===e&&null!==n)return n.value},r.prototype.getReverse=function(e){for(var t=0,n=this.tail;null!==n&&t<e;t++)n=n.prev;if(t===e&&null!==n)return n.value},r.prototype.map=function(e,t){t=t||this;for(var n=new r,i=this.head;null!==i;)n.push(e.call(t,i.value,this)),i=i.next;return n},r.prototype.mapReverse=function(e,t){t=t||this;for(var n=new r,i=this.tail;null!==i;)n.push(e.call(t,i.value,this)),i=i.prev;return n},r.prototype.reduce=function(e,t){var n,r=this.head;if(arguments.length>1)n=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");r=this.head.next,n=this.head.value}for(var i=0;null!==r;i++)n=e(n,r.value,i),r=r.next;return n},r.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");r=this.tail.prev,n=this.tail.value}for(var i=this.length-1;null!==r;i--)n=e(n,r.value,i),r=r.prev;return n},r.prototype.toArray=function(){for(var e=new Array(this.length),t=0,n=this.head;null!==n;t++)e[t]=n.value,n=n.next;return e},r.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,n=this.tail;null!==n;t++)e[t]=n.value,n=n.prev;return e},r.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new r;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,a=this.head;null!==a&&i<e;i++)a=a.next;for(;null!==a&&i<t;i++,a=a.next)n.push(a.value);return n},r.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new r;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,a=this.tail;null!==a&&i>t;i--)a=a.prev;for(;null!==a&&i>e;i--,a=a.prev)n.push(a.value);return n},r.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var r=0,a=this.head;null!==a&&r<e;r++)a=a.next;var o=[];for(r=0;a&&r<t;r++)o.push(a.value),a=this.removeNode(a);null===a&&(a=this.tail),a!==this.head&&a!==this.tail&&(a=a.prev);for(r=0;r<n.length;r++)a=i(this,a,n[r]);return o},r.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;null!==n;n=n.prev){var r=n.prev;n.prev=n.next,n.next=r}return this.head=t,this.tail=e,this};try{n(90)(r)}catch(e){}},function(e,t,n){"use strict";e.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}},function(e,t,n){"use strict";e.exports=n(57).NQuads},function(e,t,n){"use strict";const r=n(29),{isArray:i,isObject:a,isEmptyObject:o,isString:s,isUndefined:u}=n(24),{isList:c,isValue:l,isGraph:h,isSubject:d}=n(30),{expandIri:f,getContextValue:p,isKeyword:v,process:y,processingMode:g}=n(39),{isAbsolute:m}=n(33),{addValue:b,asArray:w,getValues:x,validateTypeValue:_}=n(28),k={};e.exports=k;const T=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/;function N({activeCtx:e,activeProperty:t,value:n,options:r}){if(null==n)return null;const i=f(e,t,{vocab:!0},r);if("@id"===i)return f(e,n,{base:!0},r);if("@type"===i)return f(e,n,{vocab:!0,base:!0},r);const a=p(e,t,"@type");if(("@id"===a||"@graph"===i)&&s(n))return{"@id":f(e,n,{base:!0},r)};if("@vocab"===a&&s(n))return{"@id":f(e,n,{vocab:!0,base:!0},r)};if(v(i))return n;const o={};if(a&&!["@id","@vocab","@none"].includes(a))o["@type"]=a;else if(s(n)){const n=p(e,t,"@language");null!==n&&(o["@language"]=n);const r=p(e,t,"@direction");null!==r&&(o["@direction"]=r)}return["boolean","number","string"].includes(typeof n)||(n=n.toString()),o["@value"]=n,o}function j(e,t,n,a){const o=[],u=Object.keys(t).sort();for(const c of u){const u=f(e,c,{vocab:!0},a);let l=t[c];i(l)||(l=[l]);for(const e of l){if(null===e)continue;if(!s(e))throw new r("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:t});const i={"@value":e};"@none"!==u&&(i["@language"]=c.toLowerCase()),n&&(i["@direction"]=n),o.push(i)}}return o}async function O({activeCtx:e,options:t,activeProperty:n,value:a,expansionMap:o,asGraph:s,indexKey:c,propertyIndex:d}){const v=[],g=Object.keys(a).sort(),m="@type"===c;for(let w of g){if(m){const n=p(e,w,"@context");u(n)||(e=await y({activeCtx:e,localCtx:n,propagate:!1,options:t}))}let g,x=a[w];i(x)||(x=[x]),x=await k.expand({activeCtx:e,activeProperty:n,element:x,options:t,insideList:!1,insideIndex:!0,expansionMap:o}),g=d?"@none"===w?"@none":N({activeCtx:e,activeProperty:c,value:w,options:t}):f(e,w,{vocab:!0},t),"@id"===c?w=f(e,w,{base:!0},t):m&&(w=g);for(let e of x){if(s&&!h(e)&&(e={"@graph":[e]}),"@type"===c)"@none"===g||(e["@type"]?e["@type"]=[w].concat(e["@type"]):e["@type"]=[w]);else{if(l(e)&&!["@language","@type","@index"].includes(c))throw new r(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${c}".`,"jsonld.SyntaxError",{code:"invalid value object",value:e});d?"@none"!==g&&b(e,d,g,{propertyIsArray:!0,prependValue:!0}):"@none"===g||c in e||(e[c]=w)}v.push(e)}}return v}k.expand=async({activeCtx:e,activeProperty:t=null,element:n,options:h={},insideList:I=!1,insideIndex:S=!1,typeScopedContext:E=null,expansionMap:R=(()=>{})})=>{if(null==n)return null;if("@default"===t&&(h=Object.assign({},h,{isFrame:!1})),!i(n)&&!a(n)){if(!I&&(null===t||"@graph"===f(e,t,{vocab:!0},h))){const r=await R({unmappedValue:n,activeCtx:e,activeProperty:t,options:h,insideList:I});return void 0===r?null:r}return N({activeCtx:e,activeProperty:t,value:n,options:h})}if(i(n)){let r=[];const a=p(e,t,"@container")||[];I=I||a.includes("@list");for(let a=0;a<n.length;++a){let o=await k.expand({activeCtx:e,activeProperty:t,element:n[a],options:h,expansionMap:R,insideIndex:S,typeScopedContext:E});I&&i(o)&&(o={"@list":o}),null===o&&(o=await R({unmappedValue:n[a],activeCtx:e,activeProperty:t,parent:n,index:a,options:h,expandedParent:r,insideList:I}),void 0===o)||(i(o)?r=r.concat(o):r.push(o))}return r}const A=f(e,t,{vocab:!0},h),C=p(e,t,"@context");E=E||(e.previousContext?e:null);let L=Object.keys(n).sort(),D=!S;if(D&&E&&L.length<=2&&!L.includes("@context"))for(const t of L){const n=f(E,t,{vocab:!0},h);if("@value"===n){D=!1,e=E;break}if("@id"===n&&1===L.length){D=!1;break}}D&&(e=e.revertToPreviousContext()),u(C)||(e=await y({activeCtx:e,localCtx:C,propagate:!0,overrideProtected:!0,options:h})),"@context"in n&&(e=await y({activeCtx:e,localCtx:n["@context"],options:h})),E=e;let P=null;for(const t of L){if("@type"===f(e,t,{vocab:!0},h)){P=P||t;const r=n[t],i=Array.isArray(r)?r.length>1?r.slice().sort():r:[r];for(const t of i){const n=p(E,t,"@context");u(n)||(e=await y({activeCtx:e,localCtx:n,options:h,propagate:!1}))}}}let M={};await async function e({activeCtx:t,activeProperty:n,expandedActiveProperty:h,element:x,expandedParent:N,options:I={},insideList:S,typeKey:E,typeScopedContext:R,expansionMap:A}){const C=Object.keys(x).sort(),L=[];let D;const P=x[E]&&"@json"===f(t,i(x[E])?x[E][0]:x[E],{vocab:!0},I);for(const e of C){let E,C=x[e];if("@context"===e)continue;let M=f(t,e,{vocab:!0},I);if((null===M||!m(M)&&!v(M))&&(M=A({unmappedProperty:e,activeCtx:t,activeProperty:n,parent:x,options:I,insideList:S,value:C,expandedParent:N}),void 0===M))continue;if(v(M)){if("@reverse"===h)throw new r("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:C});if(M in N&&"@included"!==M&&"@type"!==M)throw new r("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:M})}if("@id"===M){if(!s(C)){if(!I.isFrame)throw new r('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:C});if(a(C)){if(!o(C))throw new r('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:C})}else{if(!i(C))throw new r('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:C});if(!C.every(e=>s(e)))throw new r('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:C})}}b(N,"@id",w(C).map(e=>s(e)?f(t,e,{base:!0},I):e),{propertyIsArray:I.isFrame});continue}if("@type"===M){a(C)&&(C=Object.fromEntries(Object.entries(C).map(([e,t])=>[f(R,e,{vocab:!0}),w(t).map(e=>f(R,e,{base:!0,vocab:!0}))]))),_(C,I.isFrame),b(N,"@type",w(C).map(e=>s(e)?f(R,e,{base:!0,vocab:!0},I):e),{propertyIsArray:I.isFrame});continue}if("@included"===M&&g(t,1.1)){const e=w(await k.expand({activeCtx:t,activeProperty:n,element:C,options:I,expansionMap:A}));if(!e.every(e=>d(e)))throw new r("Invalid JSON-LD syntax; values of @included must expand to node objects.","jsonld.SyntaxError",{code:"invalid @included value",value:C});b(N,"@included",e,{propertyIsArray:!0});continue}if("@graph"===M&&!a(C)&&!i(C))throw new r('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:C});if("@value"===M){D=C,P&&g(t,1.1)?N["@value"]=C:b(N,"@value",C,{propertyIsArray:I.isFrame});continue}if("@language"===M){if(null===C)continue;if(!s(C)&&!I.isFrame)throw new r('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:C});C=w(C).map(e=>s(e)?e.toLowerCase():e);for(const e of C)s(e)&&!e.match(T)&&console.warn("@language must be valid BCP47: "+e);b(N,"@language",C,{propertyIsArray:I.isFrame});continue}if("@direction"===M){if(!s(C)&&!I.isFrame)throw new r('Invalid JSON-LD syntax; "@direction" value must be a string.',"jsonld.SyntaxError",{code:"invalid base direction",value:C});C=w(C);for(const e of C)if(s(e)&&"ltr"!==e&&"rtl"!==e)throw new r('Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",value:C});b(N,"@direction",C,{propertyIsArray:I.isFrame});continue}if("@index"===M){if(!s(C))throw new r('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:C});b(N,"@index",C);continue}if("@reverse"===M){if(!a(C))throw new r('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:C});if(E=await k.expand({activeCtx:t,activeProperty:"@reverse",element:C,options:I,expansionMap:A}),"@reverse"in E)for(const e in E["@reverse"])b(N,e,E["@reverse"][e],{propertyIsArray:!0});let e=N["@reverse"]||null;for(const t in E){if("@reverse"===t)continue;null===e&&(e=N["@reverse"]={}),b(e,t,[],{propertyIsArray:!0});const n=E[t];for(let i=0;i<n.length;++i){const a=n[i];if(l(a)||c(a))throw new r('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:E});b(e,t,a,{propertyIsArray:!0})}}continue}if("@nest"===M){L.push(e);continue}let F=t;const U=p(t,e,"@context");u(U)||(F=await y({activeCtx:t,localCtx:U,propagate:!0,overrideProtected:!0,options:I}));const q=p(F,e,"@container")||[];if(q.includes("@language")&&a(C)){const t=p(F,e,"@direction");E=j(F,C,t,I)}else if(q.includes("@index")&&a(C)){const n=q.includes("@graph"),r=p(F,e,"@index")||"@index",i="@index"!==r&&f(t,r,{vocab:!0},I);E=await O({activeCtx:F,options:I,activeProperty:e,value:C,expansionMap:A,asGraph:n,indexKey:r,propertyIndex:i})}else if(q.includes("@id")&&a(C)){const t=q.includes("@graph");E=await O({activeCtx:F,options:I,activeProperty:e,value:C,expansionMap:A,asGraph:t,indexKey:"@id"})}else if(q.includes("@type")&&a(C))E=await O({activeCtx:F.revertToPreviousContext(),options:I,activeProperty:e,value:C,expansionMap:A,asGraph:!1,indexKey:"@type"});else{const r="@list"===M;if(r||"@set"===M){let e=n;r&&"@graph"===h&&(e=null),E=await k.expand({activeCtx:F,activeProperty:e,element:C,options:I,insideList:r,expansionMap:A})}else E="@json"===p(t,e,"@type")?{"@type":"@json","@value":C}:await k.expand({activeCtx:F,activeProperty:e,element:C,options:I,insideList:!1,expansionMap:A})}if(null!==E||"@value"===M||(E=A({unmappedValue:C,expandedProperty:M,activeCtx:F,activeProperty:n,parent:x,options:I,insideList:S,key:e,expandedParent:N}),void 0!==E))if("@list"!==M&&!c(E)&&q.includes("@list")&&(E={"@list":w(E)}),q.includes("@graph")&&!q.some(e=>"@id"===e||"@index"===e)&&(E=w(E).map(e=>({"@graph":w(e)}))),F.mappings.has(e)&&F.mappings.get(e).reverse){const e=N["@reverse"]=N["@reverse"]||{};E=w(E);for(let t=0;t<E.length;++t){const n=E[t];if(l(n)||c(n))throw new r('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:E});b(e,M,n,{propertyIsArray:!0})}}else b(N,M,E,{propertyIsArray:!0})}if("@value"in N)if("@json"===N["@type"]&&g(t,1.1));else if((a(D)||i(D))&&!I.isFrame)throw new r('Invalid JSON-LD syntax; "@value" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid value object value",value:D});for(const o of L){const s=i(x[o])?x[o]:[x[o]];for(const i of s){if(!a(i)||Object.keys(i).some(e=>"@value"===f(t,e,{vocab:!0},I)))throw new r("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:i});await e({activeCtx:t,activeProperty:n,expandedActiveProperty:h,element:i,expandedParent:N,options:I,insideList:S,typeScopedContext:R,typeKey:E,expansionMap:A})}}}({activeCtx:e,activeProperty:t,expandedActiveProperty:A,element:n,expandedParent:M,options:h,insideList:I,typeKey:P,typeScopedContext:E,expansionMap:R}),L=Object.keys(M);let F=L.length;if("@value"in M){if("@type"in M&&("@language"in M||"@direction"in M))throw new r('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:M});let i=F-1;if("@type"in M&&(i-=1),"@index"in M&&(i-=1),"@language"in M&&(i-=1),"@direction"in M&&(i-=1),0!==i)throw new r('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:M});const a=null===M["@value"]?[]:w(M["@value"]),u=x(M,"@type");if(g(e,1.1)&&u.includes("@json")&&1===u.length);else if(0===a.length){const r=await R({unmappedValue:M,activeCtx:e,activeProperty:t,element:n,options:h,insideList:I});M=void 0!==r?r:null}else{if(!a.every(e=>s(e)||o(e))&&"@language"in M)throw new r("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:M});if(!u.every(e=>m(e)&&!(s(e)&&0===e.indexOf("_:"))||o(e)))throw new r('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:M})}}else if("@type"in M&&!i(M["@type"]))M["@type"]=[M["@type"]];else if("@set"in M||"@list"in M){if(F>1&&(2!==F||!("@index"in M)))throw new r('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:M});"@set"in M&&(M=M["@set"],L=Object.keys(M),F=L.length)}else if(1===F&&"@language"in M){const r=await R(M,{unmappedValue:M,activeCtx:e,activeProperty:t,element:n,options:h,insideList:I});M=void 0!==r?r:null}if(a(M)&&!h.keepFreeFloatingNodes&&!I&&(null===t||"@graph"===A)&&(0===F||"@value"in M||"@list"in M||1===F&&"@id"in M)){const r=await R({unmappedValue:M,activeCtx:e,activeProperty:t,element:n,options:h,insideList:I});M=void 0!==r?r:null}return M}},function(e,t,n){"use strict";const{isSubjectReference:r}=n(30),{createMergedNodeMap:i}=n(50),a={};e.exports=a,a.flatten=e=>{const t=i(e),n=[],a=Object.keys(t).sort();for(let e=0;e<a.length;++e){const i=t[a[e]];r(i)||n.push(i)}return n}},function(e,t,n){"use strict";const r=n(29),i=n(30),a=n(24),o=n(28),{RDF_LIST:s,RDF_FIRST:u,RDF_REST:c,RDF_NIL:l,RDF_TYPE:h,RDF_JSON_LITERAL:d,XSD_BOOLEAN:f,XSD_DOUBLE:p,XSD_INTEGER:v,XSD_STRING:y}=n(60),g=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,m={};function b(e,t,n){if(e.termType.endsWith("Node"))return{"@id":e.value};const i={"@value":e.value};if(e.language)i["@language"]=e.language;else{let o=e.datatype.value;if(o||(o=y),o===d){o="@json";try{i["@value"]=JSON.parse(i["@value"])}catch(e){throw new r("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:i["@value"],cause:e})}}if(t){if(o===f)"true"===i["@value"]?i["@value"]=!0:"false"===i["@value"]&&(i["@value"]=!1);else if(a.isNumeric(i["@value"]))if(o===v){const e=parseInt(i["@value"],10);e.toFixed(0)===i["@value"]&&(i["@value"]=e)}else o===p&&(i["@value"]=parseFloat(i["@value"]));[f,v,p,y].includes(o)||(i["@type"]=o)}else if("i18n-datatype"===n&&o.startsWith("https://www.w3.org/ns/i18n#")){const[,e,t]=o.split(/[#_]/);e.length>0&&(i["@language"]=e,e.match(g)||console.warn("@language must be valid BCP47: "+e)),i["@direction"]=t}else o!==y&&(i["@type"]=o)}return i}e.exports=m,m.fromRDF=async(e,{useRdfType:t=!1,useNativeTypes:n=!1,rdfDirection:r=null})=>{const d={},f={"@default":d},p={};for(const i of e){const e="DefaultGraph"===i.graph.termType?"@default":i.graph.value;e in f||(f[e]={}),"@default"===e||e in d||(d[e]={"@id":e});const a=f[e],s=i.subject.value,u=i.predicate.value,c=i.object;s in a||(a[s]={"@id":s});const v=a[s],y=c.termType.endsWith("Node");if(y&&!(c.value in a)&&(a[c.value]={"@id":c.value}),u===h&&!t&&y){o.addValue(v,"@type",c.value,{propertyIsArray:!0});continue}const g=b(c,n,r);if(o.addValue(v,u,g,{propertyIsArray:!0}),y)if(c.value===l){const e=a[c.value];"usages"in e||(e.usages=[]),e.usages.push({node:v,property:u,value:g})}else c.value in p?p[c.value]=!1:p[c.value]={node:v,property:u,value:g}}for(const e in f){const t=f[e];if(!(l in t))continue;const n=t[l];if(n.usages){for(let e of n.usages){let n=e.node,r=e.property,o=e.value;const l=[],h=[];let d=Object.keys(n).length;for(;r===c&&a.isObject(p[n["@id"]])&&a.isArray(n[u])&&1===n[u].length&&a.isArray(n[c])&&1===n[c].length&&(3===d||4===d&&a.isArray(n["@type"])&&1===n["@type"].length&&n["@type"][0]===s)&&(l.push(n[u][0]),h.push(n["@id"]),e=p[n["@id"]],n=e.node,r=e.property,o=e.value,d=Object.keys(n).length,i.isBlankNode(n)););delete o["@id"],o["@list"]=l.reverse();for(const e of h)delete t[e]}delete n.usages}}const v=[],y=Object.keys(d).sort();for(const e of y){const t=d[e];if(e in f){const n=t["@graph"]=[],r=f[e],a=Object.keys(r).sort();for(const e of a){const t=r[e];i.isSubjectReference(t)||n.push(t)}}i.isSubjectReference(t)||v.push(t)}return v}},function(e,t,n){"use strict";const{createNodeMap:r}=n(50),{isKeyword:i}=n(39),a=n(30),o=n(96),s=n(24),u=n(28),{RDF_FIRST:c,RDF_REST:l,RDF_NIL:h,RDF_TYPE:d,RDF_JSON_LITERAL:f,RDF_LANGSTRING:p,XSD_BOOLEAN:v,XSD_DOUBLE:y,XSD_INTEGER:g,XSD_STRING:m}=n(60),{isAbsolute:b}=n(33),w={};function x(e,t,n,r,a){const o=Object.keys(t).sort();for(const s of o){const o=t[s],u=Object.keys(o).sort();for(let t of u){const u=o[t];if("@type"===t)t=d;else if(i(t))continue;for(const i of u){const o={termType:s.startsWith("_:")?"BlankNode":"NamedNode",value:s};if(!b(s))continue;const u={termType:t.startsWith("_:")?"BlankNode":"NamedNode",value:t};if(!b(t))continue;if("BlankNode"===u.termType&&!a.produceGeneralizedRdf)continue;const c=_(i,r,e,n,a.rdfDirection);c&&e.push({subject:o,predicate:u,object:c,graph:n})}}}}function _(e,t,n,r,i){const u={};if(a.isValue(e)){u.termType="Literal",u.value=void 0,u.datatype={termType:"NamedNode"};let t=e["@value"];const n=e["@type"]||null;if("@json"===n)u.value=o(t),u.datatype.value=f;else if(s.isBoolean(t))u.value=t.toString(),u.datatype.value=n||v;else if(s.isDouble(t)||n===y)s.isDouble(t)||(t=parseFloat(t)),u.value=t.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),u.datatype.value=n||y;else if(s.isNumber(t))u.value=t.toFixed(0),u.datatype.value=n||g;else if("i18n-datatype"===i&&"@direction"in e){const n="https://www.w3.org/ns/i18n#"+(e["@language"]||"")+"_"+e["@direction"];u.datatype.value=n,u.value=t}else"@language"in e?(u.value=t,u.datatype.value=n||p,u.language=e["@language"]):(u.value=t,u.datatype.value=n||m)}else if(a.isList(e)){const a=function(e,t,n,r,i){const a={termType:"NamedNode",value:c},o={termType:"NamedNode",value:l},s={termType:"NamedNode",value:h},u=e.pop(),d=u?{termType:"BlankNode",value:t.getId()}:s;let f=d;for(const s of e){const e=_(s,t,n,r,i),u={termType:"BlankNode",value:t.getId()};n.push({subject:f,predicate:a,object:e,graph:r}),n.push({subject:f,predicate:o,object:u,graph:r}),f=u}if(u){const e=_(u,t,n,r,i);n.push({subject:f,predicate:a,object:e,graph:r}),n.push({subject:f,predicate:o,object:s,graph:r})}return d}(e["@list"],t,n,r,i);u.termType=a.termType,u.value=a.value}else{const t=s.isObject(e)?e["@id"]:e;u.termType=t.startsWith("_:")?"BlankNode":"NamedNode",u.value=t}return"NamedNode"!==u.termType||b(u.value)?u:null}e.exports=w,w.toRDF=(e,t)=>{const n=new u.IdentifierIssuer("_:b"),i={"@default":{}};r(e,i,"@default",n);const a=[],o=Object.keys(i).sort();for(const e of o){let r;if("@default"===e)r={termType:"DefaultGraph",value:""};else{if(!b(e))continue;r=e.startsWith("_:")?{termType:"BlankNode"}:{termType:"NamedNode"},r.value=e}x(a,i[e],r,n,t)}return a}},function(e,t,n){"use strict";e.exports=function e(t){return null===t||"object"!=typeof t||null!=t.toJSON?JSON.stringify(t):Array.isArray(t)?"["+t.reduce((t,n,r)=>t+(0===r?"":",")+e(void 0===n||"symbol"==typeof n?null:n),"")+"]":"{"+Object.keys(t).sort().reduce((n,r,i)=>{if(void 0===t[r]||"symbol"==typeof t[r])return n;return n+(0===n.length?"":",")+e(r)+":"+e(t[r])},"")+"}"}},function(e,t,n){"use strict";const{isKeyword:r}=n(39),i=n(30),a=n(24),o=n(28),s=n(33),u=n(29),{createNodeMap:c,mergeNodeMapGraphs:l}=n(50),h={};function d(e){const t={};for(const n in e)void 0!==e[n]&&(t["@"+n]=[e[n]]);return[t]}function f(e,t,n){for(let r=n.length-1;r>=0;--r){const i=n[r];if(i.graph===t&&i.subject["@id"]===e["@id"])return!0}return!1}function p(e,t,n){const r="@"+n;let i=r in e?e[r][0]:t[n];if("embed"===n)if(!0===i)i="@once";else if(!1===i)i="@never";else if("@always"!==i&&"@never"!==i&&"@link"!==i&&"@first"!==i&&"@last"!==i&&"@once"!==i)throw new u("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:e});return i}function v(e){if(!a.isArray(e)||1!==e.length||!a.isObject(e[0]))throw new u("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:e});if("@id"in e[0])for(const t of o.asArray(e[0]["@id"]))if(!a.isObject(t)&&!s.isAbsolute(t)||a.isString(t)&&0===t.indexOf("_:"))throw new u("Invalid JSON-LD syntax; invalid @id in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:e});if("@type"in e[0])for(const t of o.asArray(e[0]["@type"]))if(!a.isObject(t)&&!s.isAbsolute(t)||a.isString(t)&&0===t.indexOf("_:"))throw new u("Invalid JSON-LD syntax; invalid @type in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:e})}function y(e,t,n,s){let u=!0,c=!1;for(const l in n){let h=!1;const d=o.getValues(t,l),f=0===o.getValues(n,l).length;if("@id"===l){if(a.isEmptyObject(n["@id"][0]||{})?h=!0:n["@id"].length>=0&&(h=n["@id"].includes(d[0])),!s.requireAll)return h}else if("@type"===l){if(u=!1,f){if(d.length>0)return!1;h=!0}else if(1===n["@type"].length&&a.isEmptyObject(n["@type"][0]))h=d.length>0;else for(const e of n["@type"])h=!(!a.isObject(e)||!("@default"in e))||(h||d.some(t=>t===e));if(!s.requireAll)return h}else{if(r(l))continue;{const t=o.getValues(n,l)[0];let r=!1;if(t&&(v([t]),r="@default"in t),u=!1,0===d.length&&r)continue;if(d.length>0&&f)return!1;if(void 0===t){if(d.length>0)return!1;h=!0}else if(i.isList(t)){const n=t["@list"][0];if(i.isList(d[0])){const t=d[0]["@list"];i.isValue(n)?h=t.some(e=>w(n,e)):(i.isSubject(n)||i.isSubjectReference(n))&&(h=t.some(t=>b(e,n,t,s)))}}else h=i.isValue(t)?d.some(e=>w(t,e)):i.isSubjectReference(t)?d.some(n=>b(e,t,n,s)):!!a.isObject(t)&&d.length>0}}if(!h&&s.requireAll)return!1;c=c||h}return u||c}function g(e,t){const n=e.uniqueEmbeds[e.graph],r=n[t],i=r.parent,s=r.property,u={"@id":t};if(a.isArray(i)){for(let e=0;e<i.length;++e)if(o.compareValues(i[e],u)){i[e]=u;break}}else{const e=a.isArray(i[s]);o.removeValue(i,s,u,{propertyIsArray:e}),o.addValue(i,s,u,{propertyIsArray:e})}const c=e=>{const t=Object.keys(n);for(const r of t)r in n&&a.isObject(n[r].parent)&&n[r].parent["@id"]===e&&(delete n[r],c(r))};c(t)}
41
41
  /**
42
42
  * Removes the @preserve keywords from expanded result of framing.