diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/assets/bundle.js b/assets/bundle.js new file mode 100644 index 0000000..5221ad6 --- /dev/null +++ b/assets/bundle.js @@ -0,0 +1,2 @@ +/*! For license information please see bundle.js.LICENSE.txt */ +(()=>{var e={50608:(e,t,r)=>{var{Buffer:n}=r(48287),a={},o=a.LEFT_BRACE=1,s=a.RIGHT_BRACE=2,u=a.LEFT_BRACKET=3,c=a.RIGHT_BRACKET=4,l=a.COLON=5,d=a.COMMA=6,h=a.TRUE=7,p=a.FALSE=8,f=a.NULL=9,y=a.STRING=10,g=a.NUMBER=11,m=a.START=17,b=a.STOP=18,v=a.TRUE1=33,_=a.TRUE2=34,w=a.TRUE3=35,T=a.FALSE1=49,S=a.FALSE2=50,O=a.FALSE3=51,E=a.FALSE4=52,x=a.NULL1=65,A=a.NULL2=66,R=a.NULL3=67,I=a.NUMBER1=81,N=a.NUMBER3=83,j=a.STRING1=97,D=a.STRING2=98,P=a.STRING3=99,C=a.STRING4=100,L=a.STRING5=101,k=a.STRING6=102,M=a.VALUE=113,F=a.KEY=114,B=a.OBJECT=129,U=a.ARRAY=130,V="\\".charCodeAt(0),q="/".charCodeAt(0),$="\b".charCodeAt(0),Q="\f".charCodeAt(0),G="\n".charCodeAt(0),z="\r".charCodeAt(0),H="\t".charCodeAt(0),X=65536;function J(e){return n.alloc?n.alloc(e):new n(e)}function K(){this.tState=m,this.value=void 0,this.string=void 0,this.stringBuffer=J(X),this.stringBufferOffset=0,this.unicode=void 0,this.highSurrogate=void 0,this.key=void 0,this.mode=void 0,this.stack=[],this.state=M,this.bytes_remaining=0,this.bytes_in_sequence=0,this.temp_buffs={2:J(2),3:J(3),4:J(4)},this.offset=-1}K.toknam=function(e){for(var t=Object.keys(a),r=0,n=t.length;r=X&&(this.string+=this.stringBuffer.toString("utf8"),this.stringBufferOffset=0),this.stringBuffer[this.stringBufferOffset++]=e},W.appendStringBuf=function(e,t,r){var n=e.length;"number"==typeof t&&(n="number"==typeof r?r<0?e.length-t+r:r-t:e.length-t),n<0&&(n=0),this.stringBufferOffset+n>X&&(this.string+=this.stringBuffer.toString("utf8",0,this.stringBufferOffset),this.stringBufferOffset=0),e.copy(this.stringBuffer,this.stringBufferOffset,t,r),this.stringBufferOffset+=n},W.write=function(e){var t;"string"==typeof e&&(e=new n(e));for(var r=0,i=e.length;r=48&&t<64)this.string=String.fromCharCode(t),this.tState=N;else if(32!==t&&9!==t&&10!==t&&13!==t)return this.charError(e,r)}else if(this.tState===j)if(t=e[r],this.bytes_remaining>0){for(var a=0;a=128){if(t<=193||t>244)return this.onError(new Error("Invalid UTF-8 character at position "+r+" in state "+K.toknam(this.tState)));if(t>=194&&t<=223&&(this.bytes_in_sequence=2),t>=224&&t<=239&&(this.bytes_in_sequence=3),t>=240&&t<=244&&(this.bytes_in_sequence=4),this.bytes_in_sequence+r>e.length){for(var g=0;g<=e.length-1-r;g++)this.temp_buffs[this.bytes_in_sequence][g]=e[r+g];this.bytes_remaining=r+this.bytes_in_sequence-e.length,r=e.length-1}else this.appendStringBuf(e,r,r+this.bytes_in_sequence),r=r+this.bytes_in_sequence-1}else if(34===t)this.tState=m,this.string+=this.stringBuffer.toString("utf8",0,this.stringBufferOffset),this.stringBufferOffset=0,this.onToken(y,this.string),this.offset+=n.byteLength(this.string,"utf8")+1,this.string=void 0;else if(92===t)this.tState=D;else{if(!(t>=32))return this.charError(e,r);this.appendStringChar(t)}else if(this.tState===D)if(34===(t=e[r]))this.appendStringChar(t),this.tState=j;else if(92===t)this.appendStringChar(V),this.tState=j;else if(47===t)this.appendStringChar(q),this.tState=j;else if(98===t)this.appendStringChar($),this.tState=j;else if(102===t)this.appendStringChar(Q),this.tState=j;else if(110===t)this.appendStringChar(G),this.tState=j;else if(114===t)this.appendStringChar(z),this.tState=j;else if(116===t)this.appendStringChar(H),this.tState=j;else{if(117!==t)return this.charError(e,r);this.unicode="",this.tState=P}else if(this.tState===P||this.tState===C||this.tState===L||this.tState===k){if(!((t=e[r])>=48&&t<64||t>64&&t<=70||t>96&&t<=102))return this.charError(e,r);if(this.unicode+=String.fromCharCode(t),this.tState++===k){var b=parseInt(this.unicode,16);this.unicode=void 0,void 0!==this.highSurrogate&&b>=56320&&b<57344?(this.appendStringBuf(new n(String.fromCharCode(this.highSurrogate,b))),this.highSurrogate=void 0):void 0===this.highSurrogate&&b>=55296&&b<56320?this.highSurrogate=b:(void 0!==this.highSurrogate&&(this.appendStringBuf(new n(String.fromCharCode(this.highSurrogate))),this.highSurrogate=void 0),this.appendStringBuf(new n(String.fromCharCode(b)))),this.tState=j}}else if(this.tState===I||this.tState===N)switch(t=e[r]){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 46:case 101:case 69:case 43:case 45:this.string+=String.fromCharCode(t),this.tState=N;break;default:this.tState=m;var M=this.numberReviver(this.string);if(M)return M;this.offset+=this.string.length-1,this.string=void 0,r--}else if(this.tState===v){if(114!==e[r])return this.charError(e,r);this.tState=_}else if(this.tState===_){if(117!==e[r])return this.charError(e,r);this.tState=w}else if(this.tState===w){if(101!==e[r])return this.charError(e,r);this.tState=m,this.onToken(h,!0),this.offset+=3}else if(this.tState===T){if(97!==e[r])return this.charError(e,r);this.tState=S}else if(this.tState===S){if(108!==e[r])return this.charError(e,r);this.tState=O}else if(this.tState===O){if(115!==e[r])return this.charError(e,r);this.tState=E}else if(this.tState===E){if(101!==e[r])return this.charError(e,r);this.tState=m,this.onToken(p,!1),this.offset+=4}else if(this.tState===x){if(117!==e[r])return this.charError(e,r);this.tState=A}else if(this.tState===A){if(108!==e[r])return this.charError(e,r);this.tState=R}else if(this.tState===R){if(108!==e[r])return this.charError(e,r);this.tState=m,this.onToken(f,null),this.offset+=3}},W.onToken=function(e,t){},W.parseError=function(e,t){this.tState=b,this.onError(new Error("Unexpected "+K.toknam(e)+(t?"("+JSON.stringify(t)+")":"")+" in state "+K.toknam(this.state)))},W.push=function(){this.stack.push({value:this.value,key:this.key,mode:this.mode})},W.pop=function(){var e=this.value,t=this.stack.pop();this.value=t.value,this.key=t.key,this.mode=t.mode,this.emit(e),this.mode||(this.state=M)},W.emit=function(e){this.mode&&(this.state=d),this.onValue(e)},W.onValue=function(e){},W.onToken=function(e,t){if(this.state===M)if(e===y||e===g||e===h||e===p||e===f)this.value&&(this.value[this.key]=t),this.emit(t);else if(e===o)this.push(),this.value?this.value=this.value[this.key]={}:this.value={},this.key=void 0,this.state=F,this.mode=B;else if(e===u)this.push(),this.value?this.value=this.value[this.key]=[]:this.value=[],this.key=0,this.mode=U,this.state=M;else if(e===s){if(this.mode!==B)return this.parseError(e,t);this.pop()}else{if(e!==c)return this.parseError(e,t);if(this.mode!==U)return this.parseError(e,t);this.pop()}else if(this.state===F)if(e===y)this.key=t,this.state=l;else{if(e!==s)return this.parseError(e,t);this.pop()}else if(this.state===l){if(e!==l)return this.parseError(e,t);this.state=M}else{if(this.state!==d)return this.parseError(e,t);if(e===d)this.mode===U?(this.key++,this.state=M):this.mode===B&&(this.state=F);else{if(!(e===c&&this.mode===U||e===s&&this.mode===B))return this.parseError(e,t);this.pop()}}},W.numberReviver=function(e){var t=Number(e);if(isNaN(t))return this.charError(buffer,i);e.match(/[0-9]+/)==e&&t.toString()!=e?this.onToken(y,e):this.onToken(g,t)},K.C=a,e.exports=K},78563:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorAbstractMediaTyped=void 0;const n=r(90412);class i extends n.Actor{constructor(e){super(e)}async run(e){if("handle"in e){const t=e;return{handle:await this.runHandle(t.handle,t.handleMediaType,e.context)}}if("mediaTypes"in e)return{mediaTypes:await this.getMediaTypes(e.context)};if("mediaTypeFormats"in e)return{mediaTypeFormats:await this.getMediaTypeFormats(e.context)};throw new Error("Either a handle, mediaTypes or mediaTypeFormats action needs to be provided")}async test(e){if("handle"in e){const t=e;return{handle:await this.testHandle(t.handle,t.handleMediaType,e.context)}}if("mediaTypes"in e)return{mediaTypes:await this.testMediaType(e.context)};if("mediaTypeFormats"in e)return{mediaTypeFormats:await this.testMediaTypeFormats(e.context)};throw new Error("Either a handle, mediaTypes or mediaTypeFormats action needs to be provided")}}t.ActorAbstractMediaTyped=i},17633:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorAbstractMediaTypedFixed=void 0;const n=r(78563);class i extends n.ActorAbstractMediaTyped{constructor(e){super(e);const t=this.priorityScale||0===this.priorityScale?this.priorityScale:1;this.mediaTypePriorities&&Object.entries(this.mediaTypePriorities).forEach((([e,r],n)=>{this.mediaTypePriorities[e]=t*r})),this.mediaTypePriorities=Object.freeze(this.mediaTypePriorities),this.mediaTypeFormats=Object.freeze(this.mediaTypeFormats)}async testHandle(e,t,r){if(!t||!(t in this.mediaTypePriorities))throw new Error(`Unrecognized media type: ${t}`);return await this.testHandleChecked(e,r)}async testMediaType(e){return!0}async getMediaTypes(e){return this.mediaTypePriorities}async testMediaTypeFormats(e){return!0}async getMediaTypeFormats(e){return this.mediaTypeFormats}}t.ActorAbstractMediaTypedFixed=i},48092:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(78563),t),i(r(17633),t)},92647:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorAbstractPath=void 0;const n=r(45718),i=r(66490),a=r(90711),o=r(75627),s=r(47793),u=r(43347),c=r(96331),l=r(71493),d=new s.DataFactory,h=new n.BindingsFactory;class p extends i.ActorQueryOperationTypedMediated{constructor(e,t){super(e,"path"),this.predicateType=t}async testOperation(e,t){if(e.predicate.type!==this.predicateType)throw new Error(`This Actor only supports ${this.predicateType} Path operations.`);return!0}generateVariable(e,t){return t?!e||e.subject.value!==t&&e.object.value!==t?d.variable(t):this.generateVariable(e,`${t}b`):this.generateVariable(e,"b")}async isPathArbitraryLengthDistinct(e,t){return e.get(a.KeysQueryOperation.isPathArbitraryLengthDistinctKey)?{context:e=e.set(a.KeysQueryOperation.isPathArbitraryLengthDistinctKey,!1),operation:void 0}:{context:e=e.set(a.KeysQueryOperation.isPathArbitraryLengthDistinctKey,!0),operation:i.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({operation:p.FACTORY.createDistinct(t),context:e}))}}async predicateStarGraphVariable(e,t,r,n,a){const s=this.generateVariable(p.FACTORY.createPath(e,r,t,n)),u=p.FACTORY.createUnion([p.FACTORY.createPattern(e,s,t,n),p.FACTORY.createPattern(t,s,e,n)]),c=i.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({context:a,operation:u})),l=new Set;return{bindingsStream:new o.MultiTransformIterator(c.bindingsStream,{multiTransform:i=>{const s=i.get(n);return l.has(s.value)?new o.EmptyIterator:(l.add(s.value),new o.TransformIterator((async()=>{const i=new o.BufferedIterator;return await this.getObjectsPredicateStar(e,r,s,a,{},i,{count:0}),i.transform({transform(e,r,i){i(h.bindings([[t,e],[n,s]])),r()}})}),{maxBufferSize:128}))},autoStart:!1}),metadata:c.metadata}}async getObjectsPredicateStarEval(e,t,r,n,i,a){if("Variable"===n.termType)return this.predicateStarGraphVariable(e,r,t,n,i);const o=new l.PathVariableObjectIterator(e,t,n,i,this.mediatorQueryOperation,a);return{bindingsStream:o.transform({autoStart:!1,transform(e,t,n){n(h.bindings([[r,e]])),t()}}),async metadata(){const e=await new Promise((e=>{o.getProperty("metadata",(t=>e(t())))}));return e.cardinality.value++,e}}}async getObjectsPredicateStar(e,t,r,n,a,o,s){const c=(0,u.termToString)(e);if(a[c])return;o._push(e),a[c]=e,s.count++;const l=this.generateVariable(),d=p.FACTORY.createPath(e,t,l,r),h=i.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({operation:d,context:n}));return h.bindingsStream.on("data",(async e=>{const i=e.get(l);await this.getObjectsPredicateStar(i,t,r,n,a,o,s)})),h.bindingsStream.on("end",(()=>{0==--s.count&&o.close()})),h.metadata}async getSubjectAndObjectBindingsPredicateStar(e,t,r,n,a,o,s,c,l,d,f){const y=(0,u.termToString)(n)+(0,u.termToString)(o);if(l[y])return;if(f.count++,l[y]=!0,d._push(h.bindings([[e,r],[t,n]])),y in c){const n=await c[y];for(const i of n)await this.getSubjectAndObjectBindingsPredicateStar(e,t,r,i,a,o,s,c,l,d,f);return void(0==--f.count&&d.close())}const g=new Promise((async(u,h)=>{const y=[],g=this.generateVariable(),m=p.FACTORY.createPath(n,a,g,o),b=i.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({operation:m,context:s}));b.bindingsStream.on("data",(async n=>{const i=n.get(g);y.push(i),await this.getSubjectAndObjectBindingsPredicateStar(e,t,r,i,a,o,s,c,l,d,f)})),b.bindingsStream.on("error",h),b.bindingsStream.on("end",(()=>{0==--f.count&&d.close(),u(y)}))}));c[y]=g}}t.ActorAbstractPath=p,p.FACTORY=new c.Factory},71493:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PathVariableObjectIterator=void 0;const n=r(66490),i=r(75627),a=r(47793),o=r(43347),s=r(96331),u=new a.DataFactory,c=new s.Factory;class l extends i.BufferedIterator{constructor(e,t,r,n,i,a,o=16){super({autoStart:!0}),this.subject=e,this.predicate=t,this.graph=r,this.context=n,this.mediatorQueryOperation=i,this.maxRunningOperations=o,this.termHashes=new Map,this.runningOperations=[],this.pendingOperations=[],this._push(this.subject,a)}_end(e){for(const e of this.runningOperations)e.destroy();super._end(e)}_push(e,t=!0){let r;if(t&&(r=(0,o.termToString)(e),this.termHashes.has(r)))return;const n=u.variable("b");this.pendingOperations.push({variable:n,operation:c.createPath(e,this.predicate,n,this.graph)}),r&&(this.termHashes.set(r,e),super._push(e))}_read(e,t){const r=this;(async function(){for(;r.runningOperations.lengthr.destroy(e))),i.on("readable",(()=>{r.readable=!0,r._fillBufferAsync()})),i.on("end",(()=>{r.runningOperations.splice(r.runningOperations.indexOf(i),1),r.readable=!0,r._fillBufferAsync()}))),r.setProperty("metadata",t.metadata)}let t,i=0;for(;i!==(i=e);)for(let n=0;n0;n++)null!==(t=r.runningOperations[n].read())&&(e--,r._push(t));0===r.runningOperations.length&&0===r.pendingOperations.length&&r.close()})().then((()=>{t()}),(e=>this.destroy(e)))}}t.PathVariableObjectIterator=l},97091:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(92647),t),i(r(71493),t)},36356:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorContextPreprocessSourceToDestination=void 0;const n=r(98926),i=r(90711);class a extends n.ActorContextPreprocess{constructor(e){super(e)}async test(e){return!0}async run(e){if(e.context.get(i.KeysRdfResolveQuadPattern.sources)&&!e.context.get(i.KeysRdfUpdateQuads.destination)){const t=e.context.get(i.KeysRdfResolveQuadPattern.sources);if(1===t.length)return{context:e.context.set(i.KeysRdfUpdateQuads.destination,t[0])}}return e}}t.ActorContextPreprocessSourceToDestination=a},94410:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(36356),t)},75796:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorHashBindingsSha1=void 0;const n=r(16235),i=r(77952),a=r(43347),o=r(82341);class s extends n.ActorHashBindings{async test(e){if(!e.allowHashCollisions)throw new Error(`Actor ${this.name} can not provide hash functions without hash collisions`);return!0}async run(e){return{hashFunction:e=>(0,i.sha1)().update(o(Object.fromEntries([...e].map((([e,t])=>[(0,a.termToString)(e),(0,a.termToString)(t)]))))).digest("hex"),hashCollisions:!0}}}t.ActorHashBindingsSha1=s},23042:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(75796),t)},20358:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorInitQuery=void 0;const n=r(53638);"undefined"==typeof process&&(globalThis.process=r(65606));class i extends n.ActorInitQueryBase{}t.ActorInitQuery=i},53638:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorInitQueryBase=void 0;const n=r(6180);class i extends n.ActorInit{constructor(e){e.contextKeyShortcutsExtensions?.forEach((t=>{if(Object.keys(e.contextKeyShortcuts).some((e=>Object.keys(t).includes(e))))throw new Error("Duplicate keys found while adding `contextKeyShortcutsExtensions`.");e.contextKeyShortcuts={...e.contextKeyShortcuts,...t}})),super(e)}async test(e){return!0}async run(e){throw new Error("ActorInitSparql#run is not supported in the browser.")}}t.ActorInitQueryBase=i},70865:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MemoryPhysicalQueryPlanLogger=void 0;const n=r(43347);t.MemoryPhysicalQueryPlanLogger=class{constructor(){this.children=new Map}logOperation(e,t,r,n,i,a){const o={actor:i,logicalOperator:e,physicalOperator:t,rawNode:r,children:[],metadata:a};if(this.children.set(r,o.children),this.rootNode){if(!n)throw new Error("Detected more than one parent-less node");const e=this.children.get(n);if(!e)throw new Error("Could not find parent node");e.push(o)}else{if(n)throw new Error("No root node has been set yet, while a parent is being referenced");this.rootNode=o}}toJson(){return this.rootNode?this.planNodeToJson(this.rootNode):{}}planNodeToJson(e){return{logical:e.logicalOperator,physical:e.physicalOperator,...this.getLogicalMetadata(e.rawNode),...e.metadata,...e.children.length>0?{children:e.children.map((e=>this.planNodeToJson(e)))}:{}}}getLogicalMetadata(e){if("type"in e){const t=e;switch(t.type){case"pattern":return{pattern:this.quadToString(t)};case"project":return{variables:t.variables.map((e=>e.value))}}}return{}}quadToString(e){return`${(0,n.termToString)(e.subject)} ${(0,n.termToString)(e.predicate)} ${(0,n.termToString)(e.object)}${"DefaultGraph"===e.graph.termType?"":` ${(0,n.termToString)(e.graph)}`}`}}},76235:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QueryEngineBase=void 0;const n=r(66490),i=r(90711),a=r(90412),o=r(70865);class s{constructor(e){this.actorInitQuery=e,this.defaultFunctionArgumentsCache={}}async queryBindings(e,t){return this.queryOfType(e,t,"bindings")}async queryQuads(e,t){return this.queryOfType(e,t,"quads")}async queryBoolean(e,t){return this.queryOfType(e,t,"boolean")}async queryVoid(e,t){return this.queryOfType(e,t,"void")}async queryOfType(e,t,r){const n=await this.query(e,t);if(n.resultType===r)return await n.execute();throw new Error(`Query result type '${r}' was expected, while '${n.resultType}' was found.`)}async query(e,t){const r=await this.queryOrExplain(e,t);if("explain"in r)throw new Error("Tried to explain a query when in query-only mode");return r}async explain(e,t,r){return t.explain=r,await this.queryOrExplain(e,t)}async queryOrExplain(e,t){t=t||{};for(const e in t)this.actorInitQuery.contextKeyShortcuts[e]&&(t[this.actorInitQuery.contextKeyShortcuts[e]]=t[e],delete t[e]);let r=new a.ActionContext(t),u={language:"sparql",version:"1.1"};r.has(i.KeysInitQuery.queryFormat)&&(u=r.get(i.KeysInitQuery.queryFormat),r=r.delete(i.KeysInitQuery.queryFormat),"graphql"===u.language&&(r=r.setDefault(i.KeysInitQuery.graphqlSingularizeVariables,{})));const c=r.get(i.KeysInitQuery.baseIRI);r=r.setDefault(i.KeysInitQuery.queryTimestamp,new Date).setDefault(i.KeysRdfResolveQuadPattern.sourceIds,new Map).setDefault(i.KeysCore.log,this.actorInitQuery.logger).setDefault(i.KeysInitQuery.functionArgumentsCache,this.defaultFunctionArgumentsCache).setDefault(i.KeysRdfResolveQuadPattern.hypermediaSourcesAggregatedStores,new Map),r=(await this.actorInitQuery.mediatorContextPreprocess.mediate({context:r})).context;const l=r.get(i.KeysInitQuery.explain);let d;if("string"==typeof e){r=r.set(i.KeysInitQuery.queryString,e);const t=await this.actorInitQuery.mediatorQueryParse.mediate({context:r,query:e,queryFormat:u,baseIRI:c});d=t.operation,t.baseIRI&&(r=r.set(i.KeysInitQuery.baseIRI,t.baseIRI))}else d=e;if("parsed"===l)return{explain:!0,type:l,data:d};r.has(i.KeysInitQuery.initialBindings)&&(d=(0,n.materializeOperation)(d,r.get(i.KeysInitQuery.initialBindings)),r=r.delete(i.KeysInitQuery.queryString));const h=await this.actorInitQuery.mediatorOptimizeQueryOperation.mediate({context:r,operation:d});if(d=h.operation,r=h.context||r,"logical"===l)return{explain:!0,type:l,data:d};let p;r=r.set(i.KeysInitQuery.query,d),"physical"===l&&(p=new o.MemoryPhysicalQueryPlanLogger,r=r.set(i.KeysInitQuery.physicalQueryPlanLogger,p));const f=await this.actorInitQuery.mediatorQueryOperation.mediate({context:r,operation:d});f.context=r;const y=s.internalToFinalResult(f);if(p){switch(y.resultType){case"bindings":case"quads":await(await y.execute()).toArray();break;case"boolean":case"void":await y.execute()}return{explain:!0,type:l,data:p.toJson()}}return y}async getResultMediaTypes(e){return e=a.ActionContext.ensureActionContext(e),(await this.actorInitQuery.mediatorQueryResultSerializeMediaTypeCombiner.mediate({context:e,mediaTypes:!0})).mediaTypes}async getResultMediaTypeFormats(e){return e=a.ActionContext.ensureActionContext(e),(await this.actorInitQuery.mediatorQueryResultSerializeMediaTypeFormatCombiner.mediate({context:e,mediaTypeFormats:!0})).mediaTypeFormats}async resultToString(e,t,r){if(r=a.ActionContext.ensureActionContext(r),!t)switch(e.resultType){case"bindings":t="application/json";break;case"quads":t="application/trig";break;default:t="simple"}const n={...await s.finalToInternalResult(e),context:r};return(await this.actorInitQuery.mediatorQueryResultSerialize.mediate({context:r,handle:n,handleMediaType:t})).handle}invalidateHttpCache(e,t){return t=a.ActionContext.ensureActionContext(t),this.actorInitQuery.mediatorHttpInvalidate.mediate({url:e,context:t})}static internalToFinalResult(e){switch(e.type){case"bindings":return{resultType:"bindings",execute:async()=>e.bindingsStream,metadata:async()=>await e.metadata(),context:e.context};case"quads":return{resultType:"quads",execute:async()=>e.quadStream,metadata:async()=>await e.metadata(),context:e.context};case"boolean":return{resultType:"boolean",execute:async()=>e.execute(),context:e.context};case"void":return{resultType:"void",execute:async()=>e.execute(),context:e.context}}}static async finalToInternalResult(e){switch(e.resultType){case"bindings":return{type:"bindings",bindingsStream:await e.execute(),metadata:async()=>await e.metadata()};case"quads":return{type:"quads",quadStream:await e.execute(),metadata:async()=>await e.metadata()};case"boolean":return{type:"boolean",execute:()=>e.execute()};case"void":return{type:"void",execute:()=>e.execute()}}}}t.QueryEngineBase=s},12301:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.QueryEngineBase=void 0,i(r(53638),t),i(r(20358),t);var a=r(76235);Object.defineProperty(t,"QueryEngineBase",{enumerable:!0,get:function(){return a.QueryEngineBase}})},68219:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorOptimizeQueryOperationBgpToJoin=void 0;const n=r(38912),i=r(96331);class a extends n.ActorOptimizeQueryOperation{async test(e){return!0}async run(e){return{operation:i.Util.mapOperation(e.operation,{bgp:(e,t)=>({recurse:!1,result:t.createJoin(e.patterns)})}),context:e.context}}}t.ActorOptimizeQueryOperationBgpToJoin=a},60192:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(68219),t)},13574:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorOptimizeQueryOperationJoinBgp=void 0;const n=r(38912),i=r(96331);class a extends n.ActorOptimizeQueryOperation{async test(e){return!0}async run(e){return{operation:i.Util.mapOperation(e.operation,{join:(e,t)=>e.input.every((e=>"bgp"===e.type))?{recurse:!1,result:t.createBgp(e.input.flatMap((e=>e.patterns)))}:{recurse:!1,result:e}}),context:e.context}}}t.ActorOptimizeQueryOperationJoinBgp=a},34304:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(13574),t)},79646:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorOptimizeQueryOperationJoinConnected=void 0;const n=r(38912),i=r(96331);class a extends n.ActorOptimizeQueryOperation{async test(e){return!0}async run(e){return{operation:i.Util.mapOperation(e.operation,{join:(e,t)=>({recurse:!1,result:a.cluster(e,t)})}),context:e.context}}static cluster(e,t){let r,n=e.input.map((e=>({inScopeVariables:Object.fromEntries(i.Util.inScopeVariables(e).map((e=>[e.value,!0]))),entries:[e]})));do{r=n,n=a.clusterIteration(r)}while(r.length!==n.length);const o=n.map((e=>t.createJoin(e.entries)));return 1===o.length?o[0]:t.createJoin(o,!1)}static clusterIteration(e){const t=[];for(const r of e){let e=!1;for(const n of t)if(a.haveOverlappingVariables(r.inScopeVariables,n.inScopeVariables)){n.entries=[...n.entries,...r.entries],n.inScopeVariables={...n.inScopeVariables,...r.inScopeVariables},e=!0;break}e||t.push({inScopeVariables:r.inScopeVariables,entries:r.entries})}return t}static haveOverlappingVariables(e,t){for(const r of Object.keys(e))if(t[r])return!0;return!1}}t.ActorOptimizeQueryOperationJoinConnected=a},5118:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(79646),t)},30152:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationAsk=void 0;const n=r(66490);class i extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"ask")}async testOperation(e,t){return!0}async runOperation(e,t){const r=await this.mediatorQueryOperation.mediate({operation:e.input,context:t}),{bindingsStream:i}=n.ActorQueryOperation.getSafeBindings(r);return{type:"boolean",execute:async()=>1===(await i.take(1).toArray()).length}}}t.ActorQueryOperationAsk=i},16682:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(30152),t)},12167:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationBgpJoin=void 0;const n=r(66490),i=r(96331);class a extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"bgp")}async testOperation(e,t){return!0}async runOperation(e,t){return this.mediatorQueryOperation.mediate({operation:a.FACTORY.createJoin(e.patterns),context:t})}}t.ActorQueryOperationBgpJoin=a,a.FACTORY=new i.Factory},38820:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(12167),t)},5336:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationConstruct=void 0;const n=r(66490),i=r(3285),a=r(96331),o=r(77654);class s extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"construct")}static getVariables(e){return(0,i.uniqTerms)([].concat.apply([],e.map((e=>(0,i.getVariables)((0,i.getTermsNested)(e))))))}async testOperation(e,t){return!0}async runOperation(e,t){const r=s.getVariables(e.template),i={type:a.Algebra.types.PROJECT,input:e.input,variables:r},u=n.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({operation:i,context:t}));return{metadata:()=>u.metadata().then((t=>({...t,order:void 0,cardinality:{type:t.cardinality.type,value:t.cardinality.value*e.template.length},canContainUndefs:!1,availableOrders:void 0}))),quadStream:new o.BindingsToQuadsIterator(e.template,u.bindingsStream),type:"quads"}}}t.ActorQueryOperationConstruct=s},77654:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BindingsToQuadsIterator=void 0;const n=r(75627),i=r(47793),a=r(3285),o=new i.DataFactory;class s extends n.MultiTransformIterator{constructor(e,t){super(t,{autoStart:!1}),this.template=e,this.blankNodeCounter=0}static bindTerm(e,t){return"Variable"===t.termType?e.get(t):t}static bindQuad(e,t){try{return(0,a.mapTermsNested)(t,(t=>{const r=s.bindTerm(e,t);if(!r)throw new Error("Unbound term");return r}))}catch{}}static localizeBlankNode(e,t){return"BlankNode"===t.termType?o.blankNode(`${t.value}${e}`):t}static localizeQuad(e,t){return(0,a.mapTermsNested)(t,(t=>s.localizeBlankNode(e,t)))}bindTemplate(e,t,r){return t.map(s.localizeQuad.bind(null,r)).map((t=>s.bindQuad.bind(null,e)(t))).filter(Boolean)}_createTransformer(e){return new n.ArrayIterator(this.bindTemplate(e,this.template,this.blankNodeCounter++),{autoStart:!1})}}t.BindingsToQuadsIterator=s},34585:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(5336),t),i(r(77654),t)},4745:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationDescribeSubject=void 0;const n=r(43415),i=r(66490),a=r(75627),o=r(47793),s=r(96331),u=new o.DataFactory;class c extends i.ActorQueryOperationTypedMediated{constructor(e){super(e,"describe")}async testOperation(e,t){return!0}async runOperation(e,t){const r=e.terms.filter((e=>"Variable"!==e.termType)).map((e=>{const t=[u.quad(e,u.variable("__predicate"),u.variable("__object"))];return t.forEach((e=>e.type="pattern")),{input:{type:s.Algebra.types.BGP,patterns:t},template:t,type:"construct"}}));if(r.length!==e.terms.length){let t=[];e.terms.filter((e=>"Variable"===e.termType)).forEach(((e,r)=>{const n=[u.quad(e,u.variable(`__predicate${r}`),u.variable(`__object${r}`))];n.forEach((e=>e.type="pattern")),t=[...t,...n]})),r.push({input:{type:s.Algebra.types.JOIN,input:[e.input,{type:s.Algebra.types.BGP,patterns:t}]},template:t,type:s.Algebra.types.CONSTRUCT})}const o=(await Promise.all(r.map((e=>this.mediatorQueryOperation.mediate({operation:e,context:t}))))).map(i.ActorQueryOperation.getSafeQuads);return{type:"quads",quadStream:new a.UnionIterator(o.map((e=>e.quadStream)),{autoStart:!1}),metadata:()=>Promise.all(o.map((e=>e.metadata()))).then((e=>n.ActorQueryOperationUnion.unionMetadata(e,!1)))}}}t.ActorQueryOperationDescribeSubject=c},69932:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(4745),t)},46271:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationDistinctHash=void 0;const n=r(66490);class i extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"distinct")}async testOperation(e,t){return!0}async runOperation(e,t){const r=n.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({operation:e.input,context:t}));return{type:"bindings",bindingsStream:r.bindingsStream.filter(await this.newHashFilter(t)),metadata:r.metadata}}async newHashFilter(e){const{hashFunction:t}=await this.mediatorHashBindings.mediate({allowHashCollisions:!0,context:e}),r={};return e=>{const n=t(e);return!(n in r)&&(r[n]=!0)}}}t.ActorQueryOperationDistinctHash=i},24615:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(46271),t)},79904:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationExtend=void 0;const n=r(45718),i=r(66490),a=r(60377);class o extends i.ActorQueryOperationTypedMediated{constructor(e){super(e,"extend")}async testOperation(e,t){return Boolean(new a.AsyncEvaluator(e.expression,i.ActorQueryOperation.getAsyncExpressionContext(t,this.mediatorQueryOperation))),!0}async runOperation(e,t){const{expression:r,input:o,variable:s}=e,u=i.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({operation:o,context:t}));if((await u.metadata()).variables.some((e=>e.equals(s))))throw new Error(`Illegal binding to variable '${s.value}' that has already been bound`);const c={...i.ActorQueryOperation.getAsyncExpressionContext(t,this.mediatorQueryOperation)},l=new a.AsyncEvaluator(r,c),d=u.bindingsStream.transform({autoStart:!1,transform:async(e,r,i)=>{try{const t=await l.evaluate(e);i(e.set(s,t))}catch(r){(0,a.isExpressionError)(r)?(i(e),this.logWarn(t,`Expression error for extend operation (${r.message})with bindings '${(0,n.bindingsToString)(e)}'`)):d.emit("error",r)}r()}});return{type:"bindings",bindingsStream:d,async metadata(){const e=await u.metadata();return{...e,variables:[...e.variables,s]}}}}}t.ActorQueryOperationExtend=o},12304:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(79904),t)},96727:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationFilterSparqlee=void 0;const n=r(45718),i=r(66490),a=r(60377);class o extends i.ActorQueryOperationTypedMediated{constructor(e){super(e,"filter")}async testOperation(e,t){const r={...i.ActorQueryOperation.getAsyncExpressionContext(t,this.mediatorQueryOperation)};return new a.AsyncEvaluator(e.expression,r),!0}async runOperation(e,t){const r=await this.mediatorQueryOperation.mediate({operation:e.input,context:t}),o=i.ActorQueryOperation.getSafeBindings(r);i.ActorQueryOperation.validateQueryOutput(o,"bindings");const s={...i.ActorQueryOperation.getAsyncExpressionContext(t,this.mediatorQueryOperation)},u=new a.AsyncEvaluator(e.expression,s),c=o.bindingsStream.transform({transform:async(e,r,i)=>{try{await u.evaluateAsEBV(e)&&i(e)}catch(r){(0,a.isExpressionError)(r)?this.logWarn(t,"Error occurred while filtering.",(()=>({error:r,bindings:(0,n.bindingsToString)(e)}))):c.emit("error",r)}r()},autoStart:!1});return{type:"bindings",bindingsStream:c,metadata:o.metadata}}}t.ActorQueryOperationFilterSparqlee=o},13034:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(96727),t)},20679:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationFromQuad=void 0;const n=r(66490),i=r(96331);class a extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"from")}static copyOperation(e,t){const r={};for(const n of Object.keys(e))Array.isArray(e[n])&&"template"!==n?r[n]="variables"===n?e[n]:e[n].map(t):a.ALGEBRA_TYPES.includes(e[n].type)?r[n]=t(e[n]):r[n]=e[n];return r}static applyOperationDefaultGraph(e,t){if("bgp"===e.type&&e.patterns.length>0||"path"===e.type||"pattern"===e.type){if("bgp"===e.type)return a.joinOperations(e.patterns.map((e=>{if("DefaultGraph"!==e.graph.termType)return a.FACTORY.createBgp([e]);const r=t.map((t=>a.FACTORY.createBgp([a.FACTORY.createPattern(e.subject,e.predicate,e.object,t)])));return a.unionOperations(r)})));if("DefaultGraph"!==e.graph.termType)return e;const r=t.map((t=>"path"===e.type?a.FACTORY.createPath(e.subject,e.predicate,e.object,t):a.FACTORY.createPattern(e.subject,e.predicate,e.object,t)));return a.unionOperations(r)}return a.copyOperation(e,(e=>this.applyOperationDefaultGraph(e,t)))}static applyOperationNamedGraph(e,t,r){if("bgp"===e.type&&e.patterns.length>0||"path"===e.type||"pattern"===e.type){const n="bgp"===e.type?e.patterns[0].graph:e.graph;if("DefaultGraph"===n.termType)return{type:i.Algebra.types.BGP,patterns:[]};if("Variable"===n.termType){if(1===t.length){const r=t[0],i={};i[`?${n.value}`]=r;const o=a.FACTORY.createValues([n],[i]);let s;return s="bgp"===e.type?a.FACTORY.createBgp(e.patterns.map((e=>a.FACTORY.createPattern(e.subject,e.predicate,e.object,r)))):"path"===e.type?a.FACTORY.createPath(e.subject,e.predicate,e.object,r):a.FACTORY.createPattern(e.subject,e.predicate,e.object,r),a.FACTORY.createJoin([o,s])}return a.unionOperations(t.map((t=>a.applyOperationNamedGraph(e,[t],r))))}return[...t,...r].some((e=>e.equals(n)))?e:{type:i.Algebra.types.BGP,patterns:[]}}return a.copyOperation(e,(e=>this.applyOperationNamedGraph(e,t,r)))}static joinOperations(e){if(1===e.length)return e[0];if(e.length>1)return a.FACTORY.createJoin(e);throw new Error("A join can only be applied on at least one operation")}static unionOperations(e){if(1===e.length)return e[0];if(e.length>1)return a.FACTORY.createUnion(e);throw new Error("A union can only be applied on at least one operation")}static createOperation(e){let t=e.input;return e.default.length>0&&(t=a.applyOperationDefaultGraph(t,e.default)),(e.named.length>0||e.default.length>0)&&(t=a.applyOperationNamedGraph(t,e.named,e.default)),t}async testOperation(e,t){return!0}async runOperation(e,t){const r=a.createOperation(e);return this.mediatorQueryOperation.mediate({operation:r,context:t})}}t.ActorQueryOperationFromQuad=a,a.FACTORY=new i.Factory,a.ALGEBRA_TYPES=Object.keys(i.Algebra.types).map((e=>i.Algebra.types[e]))},22744:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(20679),t)},38300:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationGroup=void 0;const n=r(66490),i=r(60377),a=r(75627),o=r(8902);class s extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"group")}async testOperation(e,t){for(const r of e.aggregates)new i.AsyncEvaluator(r.expression,n.ActorQueryOperation.getAsyncExpressionContext(t,this.mediatorQueryOperation));return!0}async runOperation(e,t){const{hashFunction:r}=await this.mediatorHashBindings.mediate({allowHashCollisions:!0,context:t}),{input:i,aggregates:s}=e,u=await this.mediatorQueryOperation.mediate({operation:i,context:t}),c=n.ActorQueryOperation.getSafeBindings(u),l=[...e.variables,...s.map((e=>e.variable))],d=n.ActorQueryOperation.getAsyncExpressionContext(t,this.mediatorQueryOperation);return{type:"bindings",bindingsStream:new a.TransformIterator((()=>new Promise(((t,n)=>{const i=new o.GroupsState(r,e,d);c.bindingsStream.on("end",(async()=>{try{const e=new a.ArrayIterator(await i.collectResults(),{autoStart:!1});t(e)}catch(e){n(e)}})),c.bindingsStream.on("error",n),c.bindingsStream.on("data",(e=>{i.consumeBindings(e).catch(n)}))}))),{autoStart:!1}),metadata:async()=>({...await c.metadata(),variables:l})}}}t.ActorQueryOperationGroup=s},8902:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GroupsState=void 0;const n=r(45718),i=r(60377),a=new(r(47793).DataFactory),o=new n.BindingsFactory;t.GroupsState=class{constructor(e,t,r){this.hashFunction=e,this.pattern=t,this.sparqleeConfig=r,this.groups=new Map,this.groupsInitializer=new Map,this.groupVariables=new Set(this.pattern.variables.map((e=>e.value))),this.distinctHashes=t.aggregates.some((({distinct:e})=>e))?new Map:null,this.waitCounter=1,this.resultHasBeenCalled=!1}consumeBindings(e){const t=this.resultCheck();if(t)return t;this.waitCounter++;const r=e.filter(((e,t)=>this.groupVariables.has(t.value))),n=this.hashBindings(r);let a,o=this.groupsInitializer.get(n);if(o){const t=o;a=(async()=>{const r=await t;await Promise.all(this.pattern.aggregates.map((async t=>{if(t.distinct){const t=this.hashBindings(e);if(this.distinctHashes.get(n).has(t))return;this.distinctHashes.get(n).add(t)}const i=t.variable.value;await r.aggregators[i].put(e)})))})().then((()=>{this.subtractWaitCounterAndCollect()}))}else o=(async()=>{const t={};if(await Promise.all(this.pattern.aggregates.map((async r=>{const n=r.variable.value;t[n]=new i.AsyncAggregateEvaluator(r,this.sparqleeConfig),await t[n].put(e)}))),this.distinctHashes){const t=this.hashBindings(e);this.distinctHashes.set(n,new Set([t]))}const a={aggregators:t,bindings:r};return this.groups.set(n,a),this.subtractWaitCounterAndCollect(),a})(),this.groupsInitializer.set(n,o),a=o;return a}subtractWaitCounterAndCollect(){0==--this.waitCounter&&this.handleResultCollection()}handleResultCollection(){let e=[...this.groups].map((([e,t])=>{const{bindings:r,aggregators:n}=t;let i=r;for(const e in n){const t=n[e].result();t&&(i=i.set(a.variable(e),t))}return i}));if(0===e.length&&0===this.groupVariables.size){const t=[];for(const e of this.pattern.aggregates){const r=e.variable,n=i.AsyncAggregateEvaluator.emptyValue(e);void 0!==n&&t.push([r,n])}e=[o.bindings(t)]}this.waitResolver(e)}resultCheck(){if(this.resultHasBeenCalled)return Promise.reject(new Error("Calling any function after calling collectResult is invalid."))}collectResults(){const e=this.resultCheck();if(e)return e;this.resultHasBeenCalled=!0;const t=new Promise((e=>{this.waitResolver=e}));return this.subtractWaitCounterAndCollect(),t}hashBindings(e){return this.hashFunction(e)}}},37515:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(38300),t)},27568:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationJoin=void 0;const n=r(66490);class i extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"join")}async testOperation(e,t){return!0}async runOperation(e,t){const r=(await Promise.all(e.input.map((async e=>({output:await this.mediatorQueryOperation.mediate({operation:e,context:t}),operation:e}))))).map((({output:e,operation:t})=>({output:n.ActorQueryOperation.getSafeBindings(e),operation:t})));return this.mediatorJoin.mediate({type:"inner",entries:r,context:t})}}t.ActorQueryOperationJoin=i},20240:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(27568),t)},35716:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationLeftJoin=void 0;const n=r(66490),i=r(60377);class a extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"leftjoin")}async testOperation(e,t){return!0}async runOperation(e,t){const r=(await Promise.all(e.input.map((async e=>({output:await this.mediatorQueryOperation.mediate({operation:e,context:t}),operation:e}))))).map((({output:e,operation:t})=>({output:n.ActorQueryOperation.getSafeBindings(e),operation:t}))),a=await this.mediatorJoin.mediate({type:"optional",entries:r,context:t});if(e.expression){const o=(await r[1].output.metadata()).variables,s={...n.ActorQueryOperation.getAsyncExpressionContext(t,this.mediatorQueryOperation)},u=new i.AsyncEvaluator(e.expression,s),c=a.bindingsStream.transform({autoStart:!1,transform:async(e,r,n)=>{if(!o.every((t=>e.has(t.value))))return n(e),r();try{await u.evaluateAsEBV(e)&&n(e)}catch(r){(0,i.isExpressionError)(r)?this.logWarn(t,"Error occurred while filtering.",(()=>({error:r,bindings:e}))):c.emit("error",r)}r()}});a.bindingsStream=c}return a}}t.ActorQueryOperationLeftJoin=a},75113:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(35716),t)},30626:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationMinus=void 0;const n=r(66490);class i extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"minus")}async testOperation(e,t){return!0}async runOperation(e,t){const r=(await Promise.all(e.input.map((async e=>({output:await this.mediatorQueryOperation.mediate({operation:e,context:t}),operation:e}))))).map((({output:e,operation:t})=>({output:n.ActorQueryOperation.getSafeBindings(e),operation:t})));return this.mediatorJoin.mediate({type:"minus",entries:r,context:t})}}t.ActorQueryOperationMinus=i},48952:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(30626),t)},98384:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationNop=void 0;const n=r(45718),i=r(66490),a=r(82590),o=r(75627),s=new n.BindingsFactory;class u extends i.ActorQueryOperationTypedMediated{constructor(e){super(e,"nop")}async testOperation(e,t){return!0}async runOperation(e,t){return{bindingsStream:new o.SingletonIterator(s.bindings()),metadata:()=>Promise.resolve({state:new a.MetadataValidationState,cardinality:{type:"exact",value:1},canContainUndefs:!1,variables:[]}),type:"bindings"}}}t.ActorQueryOperationNop=u},79153:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(98384),t)},69637:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationOrderBySparqlee=void 0;const n=r(66490),i=r(60377),a=r(96331),o=r(96657);class s extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"orderby"),this.window=e.window??Number.POSITIVE_INFINITY}async testOperation(e,t){for(let r of e.expressions)r=this.extractSortExpression(r),new i.AsyncEvaluator(r,n.ActorQueryOperation.getAsyncExpressionContext(t,this.mediatorQueryOperation));return!0}async runOperation(e,t){const r=await this.mediatorQueryOperation.mediate({operation:e.input,context:t}),a=n.ActorQueryOperation.getSafeBindings(r),s={window:this.window},u={...n.ActorQueryOperation.getAsyncExpressionContext(t,this.mediatorQueryOperation)};let{bindingsStream:c}=a;for(let t=e.expressions.length-1;t>=0;t--){let r=e.expressions[t];const n=this.isAscending(r);r=this.extractSortExpression(r);const a=new i.AsyncEvaluator(r,u),l=async(e,t,r)=>{try{r({bindings:e,result:await a.evaluate(e)})}catch(t){(0,i.isExpressionError)(t)||c.emit("error",t),r({bindings:e,result:void 0})}t()},d=c.transform({transform:l}),h=new o.SortIterator(d,((e,t)=>{let r=(0,i.orderTypes)(e.result,t.result);return n||(r*=-1),r}),s);c=h.map((({bindings:e,result:t})=>e))}return{type:"bindings",bindingsStream:c,metadata:a.metadata}}extractSortExpression(e){const{expressionType:t,operator:r}=e;return t!==a.Algebra.expressionTypes.OPERATOR?e:"desc"===r?e.args[0]:e}isAscending(e){const{expressionType:t,operator:r}=e;return t!==a.Algebra.expressionTypes.OPERATOR||"desc"!==r}}t.ActorQueryOperationOrderBySparqlee=s},96657:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SortIterator=void 0;const n=r(75627);class i extends n.TransformIterator{constructor(e,t,r){super(e,r);const n=r&&r.window;this.windowLength=Number.isFinite(n)&&n>0?n:Number.POSITIVE_INFINITY,this.sort=t,this.sorted=[]}_read(e,t){let r,{length:n}=this.sorted;for(;n!==this.windowLength&&(r=this.source.read(),null!==r);){let e,t,i=0,a=n-1;for(;i<=a;)e=Math.trunc((i+a)/2),t=this.sort(r,this.sorted[e]),t<0?i=e+1:t>0?a=e-1:(i=e,a=-1);this.sorted.splice(i,0,r),n++}n===this.windowLength&&this._push(this.sorted.pop()),t()}_flush(e){let{length:t}=this.sorted;for(;t--;)this._push(this.sorted.pop());e()}}t.SortIterator=i},67107:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(69637),t)},29111:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationPathAlt=void 0;const n=r(97091),i=r(43415),a=r(66490),o=r(75627),s=r(96331);class u extends n.ActorAbstractPath{constructor(e){super(e,s.Algebra.types.ALT)}async runOperation(e,t){const r=e.predicate,s=(await Promise.all(r.input.map((r=>this.mediatorQueryOperation.mediate({context:t,operation:n.ActorAbstractPath.FACTORY.createPath(e.subject,r,e.object,e.graph)}))))).map(a.ActorQueryOperation.getSafeBindings);return{type:"bindings",bindingsStream:new o.UnionIterator(s.map((e=>e.bindingsStream)),{autoStart:!1}),metadata:()=>Promise.all(s.map((e=>e.metadata()))).then((e=>i.ActorQueryOperationUnion.unionMetadata(e,!0)))}}}t.ActorQueryOperationPathAlt=u},35529:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(29111),t)},42651:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationPathInv=void 0;const n=r(97091),i=r(96331);class a extends n.ActorAbstractPath{constructor(e){super(e,i.Algebra.types.INV)}async runOperation(e,t){const r=e.predicate,i=n.ActorAbstractPath.FACTORY.createPath(e.object,r.path,e.subject,e.graph);return this.mediatorQueryOperation.mediate({operation:i,context:t})}}t.ActorQueryOperationPathInv=a},6809:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(42651),t)},45513:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationPathLink=void 0;const n=r(97091),i=r(96331);class a extends n.ActorAbstractPath{constructor(e){super(e,i.Algebra.types.LINK)}async runOperation(e,t){const r=e.predicate,i=n.ActorAbstractPath.FACTORY.createPattern(e.subject,r.iri,e.object,e.graph);return this.mediatorQueryOperation.mediate({operation:i,context:t})}}t.ActorQueryOperationPathLink=a},66218:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(45513),t)},59383:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationPathNps=void 0;const n=r(97091),i=r(66490),a=r(96331);class o extends n.ActorAbstractPath{constructor(e){super(e,a.Algebra.types.NPS)}async runOperation(e,t){const r=e.predicate,a=this.generateVariable(e),o=n.ActorAbstractPath.FACTORY.createPattern(e.subject,a,e.object,e.graph),s=i.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({operation:o,context:t}));return{type:"bindings",bindingsStream:s.bindingsStream.transform({filter:e=>!r.iris.some((t=>t.equals(e.get(a)))),transform(e,t,r){r(e.delete(a)),t()}}),metadata:s.metadata}}}t.ActorQueryOperationPathNps=o},54309:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(59383),t)},15541:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationPathOneOrMore=void 0;const n=r(97091),i=r(45718),a=r(66490),o=r(75627),s=r(96331),u=new i.BindingsFactory;class c extends n.ActorAbstractPath{constructor(e){super(e,s.Algebra.types.ONE_OR_MORE_PATH)}async runOperation(e,t){const r=await this.isPathArbitraryLengthDistinct(t,e);if(r.operation)return r.operation;t=r.context;const i=e.predicate;if("Variable"!==e.subject.termType&&"Variable"===e.object.termType){const r=e.object,n=await this.getObjectsPredicateStarEval(e.subject,i.path,r,e.graph,t,!1),a="Variable"===e.graph.termType?[r,e.graph]:[r];return{type:"bindings",bindingsStream:n.bindingsStream,metadata:async()=>({...await n.metadata(),variables:a})}}if("Variable"===e.subject.termType&&"Variable"===e.object.termType){const r=n.ActorAbstractPath.FACTORY.createDistinct(n.ActorAbstractPath.FACTORY.createPath(e.subject,e.predicate.path,e.object,e.graph)),s=a.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({context:t,operation:r})),u=e.subject,c=e.object,l={},d=new o.MultiTransformIterator(s.bindingsStream,{multiTransform:r=>{const n=r.get(u),a=r.get(c),s="Variable"===e.graph.termType?r.get(e.graph):e.graph;return new o.TransformIterator((async()=>{const r=new o.BufferedIterator;return await this.getSubjectAndObjectBindingsPredicateStar(u,c,n,a,i.path,s,t,l,{},r,{count:0}),r.transform({transform(t,r,n){"Variable"===e.graph.termType&&(t=t.set(e.graph,s)),n(t),r()}})}),{maxBufferSize:128})},autoStart:!1}),h="Variable"===e.graph.termType?[u,c,e.graph]:[u,c];return{type:"bindings",bindingsStream:d,metadata:async()=>({...await s.metadata(),variables:h})}}if("Variable"===e.subject.termType&&"Variable"!==e.object.termType)return this.mediatorQueryOperation.mediate({context:t,operation:n.ActorAbstractPath.FACTORY.createPath(e.object,n.ActorAbstractPath.FACTORY.createOneOrMorePath(n.ActorAbstractPath.FACTORY.createInv(i.path)),e.subject,e.graph)});const s=this.generateVariable(),c=a.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({context:t,operation:n.ActorAbstractPath.FACTORY.createPath(e.subject,i,s,e.graph)}));return{type:"bindings",bindingsStream:c.bindingsStream.transform({filter:t=>e.object.equals(t.get(s)),transform(t,r,n){n("Variable"===e.graph.termType?u.bindings([[e.graph,t.get(e.graph)]]):u.bindings()),r()}}),metadata:async()=>({...await c.metadata(),variables:"Variable"===e.graph.termType?[e.graph]:[]})}}}t.ActorQueryOperationPathOneOrMore=c},23654:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(15541),t)},92231:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationPathSeq=void 0;const n=r(97091),i=r(66490),a=r(96331);class o extends n.ActorAbstractPath{constructor(e){super(e,a.Algebra.types.SEQ)}async runOperation(e,t){const r=e.predicate;let a=e.subject;const o=[],s=await Promise.all(r.input.map(((i,s)=>{const u=s===r.input.length-1?e.object:this.generateVariable(e,`b${s}`),c=n.ActorAbstractPath.FACTORY.createPath(a,i,u,e.graph),l=this.mediatorQueryOperation.mediate({context:t,operation:c});return a=u,s({output:i.ActorQueryOperation.getSafeBindings(await e),operation:t})))),u=i.ActorQueryOperation.getSafeBindings(await this.mediatorJoin.mediate({type:"inner",entries:s,context:t}));return{type:"bindings",bindingsStream:u.bindingsStream.transform({transform(e,t,r){for(const t of o)e=e.delete(t);r(e),t()}}),async metadata(){const e=await u.metadata(),t=e.variables.filter((e=>!o.some((t=>t.value===e.value))));return{...e,variables:t}}}}}t.ActorQueryOperationPathSeq=o},75049:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(92231),t)},9553:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationPathZeroOrMore=void 0;const n=r(97091),i=r(45718),a=r(66490),o=r(75627),s=r(43347),u=r(96331),c=new i.BindingsFactory;class l extends n.ActorAbstractPath{constructor(e){super(e,u.Algebra.types.ZERO_OR_MORE_PATH)}async runOperation(e,t){const r=await this.isPathArbitraryLengthDistinct(t,e);if(r.operation)return r.operation;t=r.context;const i=e.predicate,u="Variable"===e.subject.termType,l="Variable"===e.object.termType;if("Variable"===e.subject.termType&&"Variable"===e.object.termType){const r=this.generateVariable(e),u=n.ActorAbstractPath.FACTORY.createPattern(e.subject,r,e.object,e.graph),c=a.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({context:t,operation:u})),l=e.subject,d=e.object,h=new Set,p={},f=new o.MultiTransformIterator(c.bindingsStream,{multiTransform:r=>{const n=r.get(l),a=r.get(d),u="Variable"===e.graph.termType?r.get(e.graph):e.graph,c=(0,s.termToString)(n)+(0,s.termToString)(u),f=(0,s.termToString)(a)+(0,s.termToString)(u);return new o.TransformIterator((async()=>{if(h.has(c)&&h.has(f))return new o.EmptyIterator;const r=new o.BufferedIterator,s={count:0};return h.has(c)||(h.add(c),await this.getSubjectAndObjectBindingsPredicateStar(l,d,n,n,i.path,u,t,p,{},r,s)),h.has(f)||(h.add(f),await this.getSubjectAndObjectBindingsPredicateStar(l,d,a,a,i.path,u,t,p,{},r,s)),r.transform({transform(t,r,n){"Variable"===e.graph.termType&&(t=t.set(e.graph,u)),n(t),r()}})}))}}),y="Variable"===e.graph.termType?[l,e.object,e.graph]:[l,e.object];return{type:"bindings",bindingsStream:f,metadata:async()=>({...await c.metadata(),variables:y})}}if(!u&&!l){const r=this.generateVariable(),n=await this.getObjectsPredicateStarEval(e.subject,i.path,r,e.graph,t,!0);return{type:"bindings",bindingsStream:n.bindingsStream.transform({filter:t=>e.object.equals(t.get(r)),transform(t,r,n){n("Variable"===e.graph.termType?c.bindings([[e.graph,t.get(e.graph)]]):c.bindings()),r()}}),metadata:async()=>({...await n.metadata(),variables:"Variable"===e.graph.termType?[e.graph]:[]})}}const d=u?e.object:e.subject,h=u?e.subject:e.object,p=u?n.ActorAbstractPath.FACTORY.createInv(i.path):i.path,f=await this.getObjectsPredicateStarEval(d,p,h,e.graph,t,!0),y="Variable"===e.graph.termType?[h,e.graph]:[h];return{type:"bindings",bindingsStream:f.bindingsStream,metadata:async()=>({...await f.metadata(),variables:y})}}}t.ActorQueryOperationPathZeroOrMore=l},85928:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(9553),t)},82651:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationPathZeroOrOne=void 0;const n=r(97091),i=r(45718),a=r(66490),o=r(82590),s=r(75627),u=r(96331),c=new i.BindingsFactory;class l extends n.ActorAbstractPath{constructor(e){super(e,u.Algebra.types.ZERO_OR_ONE_PATH)}async runOperation(e,t){const r=e.predicate,i=[];if("Variable"!==e.subject.termType&&"Variable"!==e.object.termType&&e.subject.equals(e.object))return{type:"bindings",bindingsStream:new s.SingletonIterator(c.bindings()),metadata:()=>Promise.resolve({state:new o.MetadataValidationState,cardinality:{type:"exact",value:1},canContainUndefs:!1,variables:[]})};const u=await this.isPathArbitraryLengthDistinct(t,e);if(u.operation)return u.operation;t=u.context;const l=a.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({context:t,operation:n.ActorAbstractPath.FACTORY.createPath(e.subject,r.path,e.object,e.graph)}));let d;if("Variable"===e.subject.termType&&"Variable"===e.object.termType){const r=this.generateVariable(e),i=a.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({context:t,operation:n.ActorAbstractPath.FACTORY.createFilter(n.ActorAbstractPath.FACTORY.createPattern(e.subject,r,e.object,e.graph),n.ActorAbstractPath.FACTORY.createOperatorExpression("=",[n.ActorAbstractPath.FACTORY.createTermExpression(e.subject),n.ActorAbstractPath.FACTORY.createTermExpression(e.object)]))})).bindingsStream.transform({map:e=>e.delete(r),autoStart:!1});d=new s.UnionIterator([i,l.bindingsStream],{autoStart:!1})}else"Variable"===e.subject.termType&&i.push(c.bindings([[e.subject,e.object]])),"Variable"===e.object.termType&&i.push(c.bindings([[e.object,e.subject]])),d=l.bindingsStream.prepend(i);return{type:"bindings",bindingsStream:d,metadata:l.metadata}}}t.ActorQueryOperationPathZeroOrOne=l},8327:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(82651),t)},89760:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationProject=void 0;const n=r(66490),i=r(16400),a=new(r(47793).DataFactory);class o extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"project")}async testOperation(e,t){return!0}async runOperation(e,t){const r=n.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({operation:e.input,context:t})),o=await r.metadata(),s=e.variables,u=o.variables.filter((e=>!s.some((t=>e.value===t.value)))),c=s.filter((e=>!o.variables.some((t=>e.value===t.value))));if(c.length>0)throw new Error(`Variables '${c.map((e=>`?${e.value}`))}' are used in the projection result, but are not assigned.`);let l=0===u.length?r.bindingsStream:r.bindingsStream.transform({map(e){for(const t of u)e=e.delete(t);return e},autoStart:!1}),d=0;return l=l.transform({map(e){d++;const t=new Map;return e.map((e=>{if(e instanceof i.BlankNodeBindingsScoped){let r=t.get(e.value);return r||(r=a.blankNode(`${e.value}${d}`),t.set(e.value,r)),r}return e}))},autoStart:!1}),{type:"bindings",bindingsStream:l,metadata:async()=>({...o,variables:s})}}}t.ActorQueryOperationProject=o},99817:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(89760),t)},96140:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationQuadpattern=void 0;const n=r(45718),i=r(66490),a=r(90711),o=r(47793),s=r(43347),u=r(3285),c=r(96331),l=new n.BindingsFactory,d=new o.DataFactory,h=new c.Factory;class p extends i.ActorQueryOperationTyped{constructor(e){super(e,"pattern")}static isTermVariable(e){return"Variable"===e.termType}static getVariables(e){return(0,u.uniqTerms)((0,u.getTermsNested)(e).filter(p.isTermVariable))}static getDuplicateElementLinks(e){const t={};let r=!1;if((0,u.forEachTermsNested)(e,((e,n)=>{if("Variable"===e.termType){const i=(0,s.termToString)(e),a=(t[i]||(t[i]=[])).push(n);r=r||a>1}})),!r)return;const n={};for(const e in t){const r=t[e],i=r.slice(1);i.length>0&&(n[r[0].join("_")]=i)}return n}static validateMetadata(e){for(const t of["cardinality","canContainUndefs"])if(!(t in e))throw new Error(`Invalid metadata: missing ${t} in ${JSON.stringify(e)}`);return e}static getMetadata(e,t,r){return()=>new Promise(((t,r)=>{e.getProperty("metadata",(e=>t(e))),e.on("error",r)})).then((e=>("canContainUndefs"in e||(e.canContainUndefs=!1),p.quadsMetadataToBindingsMetadata(p.validateMetadata(e),t,r))))}static quadsMetadataToBindingsMetadata(e,t,r){return{...e,order:e.order?p.quadsOrderToBindingsOrder(e.order,t):void 0,availableOrders:e.availableOrders?e.availableOrders.map((e=>({cost:e.cost,terms:p.quadsOrderToBindingsOrder(e.terms,t)}))):void 0,variables:r}}static quadsOrderToBindingsOrder(e,t){const r={};return e.map((e=>{const n=t[e.term];if(n&&!r[n])return r[n]=!0,{term:d.variable(n),direction:e.direction}})).filter((e=>Boolean(e)))}async testOperation(e,t){return!0}async runOperation(e,t){e.context&&(t=t.merge(e.context));let r=e;const n=this.unionDefaultGraph||t.get(a.KeysQueryOperation.unionDefaultGraph);"DefaultGraph"===e.graph.termType&&n&&(r=h.createPattern(e.subject,e.predicate,e.object,d.variable("__comunica:defaultGraph")));const o=await this.mediatorResolveQuadPattern.mediate({pattern:r,context:t}),s=p.getVariables(e),c=(0,u.reduceTermsNested)(e,((e,t,r)=>("Variable"===t.termType&&(e[r.join("_")]=t.value),e)),{}),f=p.getMetadata(o.data,c,s);return{type:"bindings",bindingsStream:new i.ClosableTransformIterator((async()=>{let t=o.data;const r=p.getDuplicateElementLinks(e);return"Variable"!==e.graph.termType||n||(t=t.filter((e=>"DefaultGraph"!==e.graph.termType))),r&&(t=t.filter((e=>{for(const t in r){const n=t.split("_"),i=(0,u.getValueNestedPath)(e,n);for(const n of r[t])if(!i.equals((0,u.getValueNestedPath)(e,n)))return!1}return!0}))),t.map((e=>l.bindings(Object.keys(c).map((t=>{const r=t.split("_"),n=c[t],i=(0,u.getValueNestedPath)(e,r);return[d.variable(n),i]})))))}),{autoStart:!1,onClose:()=>o.data.destroy()}),metadata:f}}}t.ActorQueryOperationQuadpattern=p},97047:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(96140),t)},77955:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationReducedHash=void 0;const n=r(66490),i=r(89096);class a extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"reduced")}async testOperation(e,t){return!0}async runOperation(e,t){const r=n.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({operation:e.input,context:t}));return{type:"bindings",bindingsStream:r.bindingsStream.filter(await this.newHashFilter(t)),metadata:r.metadata}}async newHashFilter(e){const{hashFunction:t}=await this.mediatorHashBindings.mediate({allowHashCollisions:!0,context:e}),r=new i.LRUCache({max:this.cacheSize});return e=>{const n=t(e);return!r.has(n)&&(r.set(n,!0),!0)}}}t.ActorQueryOperationReducedHash=a},66713:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(77955),t)},87420:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationService=void 0;const n=r(45718),i=r(66490),a=r(90711),o=r(82590),s=r(75627),u=new n.BindingsFactory;class c extends i.ActorQueryOperationTypedMediated{constructor(e){super(e,"service")}async testOperation(e,t){if("NamedNode"!==e.name.termType)throw new Error(`${this.name} can only query services by IRI, while a ${e.name.termType} was given.`);return!0}async runOperation(e,t){const r=e.name.value;let n=t.delete(a.KeysRdfResolveQuadPattern.source).delete(a.KeysRdfResolveQuadPattern.sources).delete(a.KeysInitQuery.queryString);const c=this.forceSparqlEndpoint?"sparql":void 0;let l;n=n.set(a.KeysRdfResolveQuadPattern.sources,[{type:c,value:r}]);try{l=i.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({operation:e.input,context:n}))}catch(t){if(!e.silent)throw t;l={bindingsStream:new s.SingletonIterator(u.bindings()),type:"bindings",metadata:async()=>({state:new o.MetadataValidationState,cardinality:{type:"exact",value:1},canContainUndefs:!1,variables:[]})}}return l}}t.ActorQueryOperationService=c},89115:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(87420),t)},46342:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationSlice=void 0;const n=r(66490),i=r(90711);class a extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"slice")}async testOperation(e,t){return!0}async runOperation(e,t){e.length&&(t=t.set(i.KeysQueryOperation.limitIndicator,e.length));const r=await this.mediatorQueryOperation.mediate({operation:e.input,context:t});if("bindings"===r.type)return{type:"bindings",bindingsStream:this.sliceStream(r.bindingsStream,e),metadata:this.sliceMetadata(r,e)};if("quads"===r.type)return{type:"quads",quadStream:this.sliceStream(r.quadStream,e),metadata:this.sliceMetadata(r,e)};throw new Error(`Invalid query output type: Expected 'bindings' or 'quads' but got '${r.type}'`)}sliceStream(e,t){const r=Boolean(t.length)||0===t.length,{start:n}=t,i=r?t.start+t.length-1:Number.POSITIVE_INFINITY;return e.transform({offset:n,limit:Math.max(i-n+1,0),autoStart:!1})}sliceMetadata(e,t){const r=Boolean(t.length)||0===t.length;return()=>e.metadata().then((e=>{const n={...e.cardinality};return Number.isFinite(n.value)&&(n.value=Math.max(0,n.value-t.start),r&&(n.value=Math.min(n.value,t.length))),{...e,cardinality:n}}))}}t.ActorQueryOperationSlice=a},24718:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(46342),t)},58841:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationSparqlEndpoint=void 0;const n=r(45718),i=r(66490),a=r(61394),o=r(16657),s=r(90711),u=r(82590),c=r(75627),l=r(92603),d=r(47793),h=r(96331),p=r(95733),f=new n.BindingsFactory,y=new d.DataFactory;class g extends i.ActorQueryOperation{constructor(e){super(e),this.endpointFetcher=new l.SparqlEndpointFetcher({method:e.forceHttpGet?"GET":"POST",fetch:(e,t)=>this.mediatorHttp.mediate({input:e,init:t,context:this.lastContext}),prefixVariableQuestionMark:!0})}async test(e){if(!e.operation)throw new Error("Missing field 'operation' in a query operation action.");const t=(0,a.getContextSourceFirst)(e.context),r=(0,o.getContextDestinationFirst)(e.context),n=t?(0,a.getDataSourceType)(t):void 0,i=r?(0,o.getDataDestinationType)(r):void 0,s=t?(0,a.getDataSourceValue)(t):void 0,u=r?(0,o.getDataDestinationValue)(r):void 0;if(t&&"sparql"===n&&(!r||"sparql"===i&&u===s)||t&&!n&&(!r||!i&&u===s)&&"string"==typeof s&&(this.checkUrlSuffixSparql&&s.endsWith("/sparql")||this.checkUrlSuffixUpdate&&s.endsWith("/update")))return{httpRequests:1};throw new Error(`${this.name} requires a single source with a 'sparql' endpoint to be present in the context or URL ending on /sparql or /update.`)}async run(e){const t=(0,a.getContextSourceFirst)(e.context);if(!t)throw new Error("Illegal state: undefined sparql endpoint source.");const r=(0,a.getDataSourceValue)(t);let n,i,o;this.lastContext=e.context;try{n=e.context.get(s.KeysInitQuery.queryString)??(0,h.toSparql)(e.operation,{sparqlStar:!0}),i=this.endpointFetcher.getQueryType(n),"UNKNOWN"===i&&(i=this.endpointFetcher.getUpdateTypes(n))}catch{}i&&"UNKNOWN"!==i||(o=h.Util.inScopeVariables(e.operation),n=(0,h.toSparql)(g.FACTORY.createProject(e.operation,o)),i="SELECT");const u=this.canOperationContainUndefs(e.operation);switch(i){case"SELECT":return o||(o=h.Util.inScopeVariables(e.operation)),this.executeQuery(r,n,!1,o,u);case"CONSTRUCT":return this.executeQuery(r,n,!0,void 0,!1);case"ASK":return{type:"boolean",execute:()=>this.endpointFetcher.fetchAsk(r,n)};default:return{type:"void",execute:()=>this.endpointFetcher.fetchUpdate(r,n)}}}executeQuery(e,t,r,n,i){const a=r?this.endpointFetcher.fetchTriples(e,t):this.endpointFetcher.fetchBindings(e,t),o=(0,c.wrap)(a,{autoStart:!1}).map((e=>r?e:f.bindings(Object.entries(e).map((([e,t])=>[y.variable(e.slice(1)),t]))))),s=new p.LazyCardinalityIterator(o),l=g.cachifyMetadata((async()=>({state:new u.MetadataValidationState,cardinality:{type:"exact",value:await s.getCardinality()},canContainUndefs:i,variables:n})));return r?{type:"quads",quadStream:s,metadata:l}:{type:"bindings",bindingsStream:s,metadata:l}}canOperationContainUndefs(e){let t=!1;return h.Util.recurseOperation(e,{[h.Algebra.types.LEFT_JOIN]:()=>(t=!0,!1),[h.Algebra.types.VALUES](e){for(const r of e.bindings){const n=Object.keys(r);e.variables.every((e=>n.includes(`?${e.value}`)))||(t=!0)}return!1}}),t}}t.ActorQueryOperationSparqlEndpoint=g,g.FACTORY=new h.Factory},95733:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LazyCardinalityIterator=void 0;const n=r(75627);class i extends n.AsyncIterator{constructor(e){super(),this._source=e,this._count=0,this._buffering=!0,e[n.DESTINATION]=this,e.on("readable",a),e.on("end",a),e.on("error",o),this.readable=e.readable}read(){if(this._buffer)return this._buffer.empty?(this._buffering||this.close(),this.readable=!1,null):this._buffer.shift();let e=null;return this._source.readable&&null!==(e=this._source.read())?this._count+=1:(this.readable=!1,this._source.done&&this.close()),e}getCardinality(){return this._cardinality?this._cardinality:this._error?Promise.reject(this._error):(this._source.done&&this.close(),this.done?this._cardinality=Promise.resolve(this._count):(this._buffer=new n.LinkedList,this._cardinality=new Promise(((e,t)=>{this._source.removeListener("readable",a),this._source.removeListener("end",a);const r=()=>{this._source.removeListener("data",n),this._source.removeListener("end",i),this._source.removeListener("error",o)},n=e=>{this._buffer.push(e),this._count+=1,this.readable=!0},i=()=>{this._buffering=!1,r(),e(this._count)},o=e=>{this._buffering=!1,r(),t(e)};this._source.on("data",n),this._source.on("end",i),this._source.on("error",o)}))),this._cardinality)}close(){this._source.removeListener("readable",a),this._source.removeListener("end",a),this._source.removeListener("error",o),delete this._source[n.DESTINATION],this._source.destroy(),super.close()}}function a(){this[n.DESTINATION].readable=!0}function o(e){this[n.DESTINATION]._error=e,this[n.DESTINATION].emit("error",e)}t.LazyCardinalityIterator=i},17425:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(58841),t)},31660:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationUnion=void 0;const n=r(66490),i=r(82590),a=r(75627),o=r(3285);class s extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"union")}static unionVariables(e){return(0,o.uniqTerms)(e.flat())}static unionMetadata(e,t){const r={type:"exact",value:0};for(const t of e){if(!(t.cardinality.value&&Number.isFinite(t.cardinality.value)||0===t.cardinality.value)){r.type="estimate",r.value=Number.POSITIVE_INFINITY;break}"estimate"===t.cardinality.type&&(r.type="estimate"),r.value+=t.cardinality.value}const n={state:new i.MetadataValidationState,cardinality:r,canContainUndefs:e.some((e=>e.canContainUndefs))},a=()=>n.state.invalidate();for(const t of e)t.state.addInvalidateListener(a);return t?(n.variables=s.unionVariables(e.map((e=>e.variables))),n):n}async testOperation(e,t){return!0}async runOperation(e,t){const r=(await Promise.all(e.input.map((e=>this.mediatorQueryOperation.mediate({operation:e,context:t}))))).map(n.ActorQueryOperation.getSafeBindings);return{type:"bindings",bindingsStream:new a.UnionIterator(r.map((e=>e.bindingsStream)),{autoStart:!1}),metadata:()=>Promise.all(r.map((e=>e.metadata()))).then((e=>s.unionMetadata(e,!0)))}}}t.ActorQueryOperationUnion=s},43415:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(31660),t)},26659:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationAddRewrite=void 0;const n=r(66490),i=r(47793),a=r(96331),o=new i.DataFactory;class s extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"add"),this.factory=new a.Factory}async testOperation(e,t){return n.ActorQueryOperation.throwOnReadOnly(t),!0}runOperation(e,t){const r="DEFAULT"===e.destination?o.defaultGraph():e.destination,n="DEFAULT"===e.source?o.defaultGraph():e.source,i=this.factory.createDeleteInsert(void 0,[this.factory.createPattern(o.variable("s"),o.variable("p"),o.variable("o"),r)],this.factory.createPattern(o.variable("s"),o.variable("p"),o.variable("o"),n));return this.mediatorQueryOperation.mediate({operation:i,context:t})}}t.ActorQueryOperationAddRewrite=s},77634:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(26659),t)},40196:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationClear=void 0;const n=r(66490),i=new(r(47793).DataFactory);class a extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"clear")}async testOperation(e,t){return n.ActorQueryOperation.throwOnReadOnly(t),!0}async runOperation(e,t){let r;r="DEFAULT"===e.source?i.defaultGraph():"string"==typeof e.source?e.source:[e.source];const{execute:n}=await this.mediatorUpdateQuads.mediate({deleteGraphs:{graphs:r,requireExistence:!e.silent,dropGraphs:!1},context:t});return{type:"void",execute:n}}}t.ActorQueryOperationClear=a},84629:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(40196),t)},47113:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationUpdateCompositeUpdate=void 0;const n=r(66490);class i extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"compositeupdate")}async testOperation(e,t){return n.ActorQueryOperation.throwOnReadOnly(t),!0}async runOperation(e,t){return{type:"void",execute:()=>(async()=>{for(const r of e.updates){const e=n.ActorQueryOperation.getSafeVoid(await this.mediatorQueryOperation.mediate({operation:r,context:t}));await e.execute()}})()}}}t.ActorQueryOperationUpdateCompositeUpdate=i},330:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(47113),t)},45761:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationCopyRewrite=void 0;const n=r(66490),i=r(96331);class a extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"copy"),this.factory=new i.Factory}async testOperation(e,t){return n.ActorQueryOperation.throwOnReadOnly(t),!0}runOperation(e,t){if("string"==typeof e.destination&&"string"==typeof e.source&&e.destination===e.source||"string"!=typeof e.destination&&"string"!=typeof e.source&&e.destination.equals(e.source))return Promise.resolve({type:"void",execute:()=>Promise.resolve()});const r=this.factory.createCompositeUpdate([this.factory.createDrop(e.destination,!0),this.factory.createAdd(e.source,e.destination,e.silent)]);return this.mediatorQueryOperation.mediate({operation:r,context:t})}}t.ActorQueryOperationCopyRewrite=a},69724:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(45761),t)},33688:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationCreate=void 0;const n=r(66490);class i extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"create")}async testOperation(e,t){return n.ActorQueryOperation.throwOnReadOnly(t),!0}async runOperation(e,t){const{execute:r}=await this.mediatorUpdateQuads.mediate({createGraphs:{graphs:[e.source],requireNonExistence:!e.silent},context:t});return{type:"void",execute:r}}}t.ActorQueryOperationCreate=i},54672:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(33688),t)},14801:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationUpdateDeleteInsert=void 0;const n=r(34585),i=r(45718),a=r(66490),o=r(75627),s=new i.BindingsFactory;class u extends a.ActorQueryOperationTypedMediated{constructor(e){super(e,"deleteinsert"),this.blankNodeCounter=0}async testOperation(e,t){return a.ActorQueryOperation.throwOnReadOnly(t),!0}async runOperation(e,t){const r=e.where?a.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({operation:e.where,context:t})).bindingsStream:new o.ArrayIterator([s.bindings()],{autoStart:!1});let i,u;e.insert&&(i=new n.BindingsToQuadsIterator(e.insert.map(n.BindingsToQuadsIterator.localizeQuad.bind(null,this.blankNodeCounter)),r.clone()),this.blankNodeCounter++),e.delete&&(u=new n.BindingsToQuadsIterator(e.delete.map(n.BindingsToQuadsIterator.localizeQuad.bind(null,this.blankNodeCounter)),r.clone()),this.blankNodeCounter++);const{execute:c}=await this.mediatorUpdateQuads.mediate({quadStreamInsert:i,quadStreamDelete:u,context:t});return{type:"void",execute:c}}}t.ActorQueryOperationUpdateDeleteInsert=u},63002:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(14801),t)},5008:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationDrop=void 0;const n=r(66490),i=new(r(47793).DataFactory);class a extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"drop")}async testOperation(e,t){return n.ActorQueryOperation.throwOnReadOnly(t),!0}async runOperation(e,t){let r;r="DEFAULT"===e.source?i.defaultGraph():"string"==typeof e.source?e.source:[e.source];const{execute:n}=await this.mediatorUpdateQuads.mediate({deleteGraphs:{graphs:r,requireExistence:!e.silent,dropGraphs:!0},context:t});return{type:"void",execute:n}}}t.ActorQueryOperationDrop=a},33181:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(5008),t)},35392:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationLoad=void 0;const n=r(66490),i=r(90711),a=r(47793),o=r(96331),s=new a.DataFactory;class u extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"load"),this.factory=new o.Factory,this.constructOperation=this.factory.createConstruct(this.factory.createPattern(s.variable("s"),s.variable("p"),s.variable("o")),[this.factory.createPattern(s.variable("s"),s.variable("p"),s.variable("o"))])}async testOperation(e,t){return n.ActorQueryOperation.throwOnReadOnly(t),!0}async runOperation(e,t){let r=t.set(i.KeysRdfResolveQuadPattern.sources,[e.source.value]);e.silent&&(r=r.set(i.KeysInitQuery.lenient,!0));let n=u.getSafeQuads(await this.mediatorQueryOperation.mediate({operation:this.constructOperation,context:r})).quadStream;e.destination&&(n=n.map((t=>s.quad(t.subject,t.predicate,t.object,e.destination))));const{execute:a}=await this.mediatorUpdateQuads.mediate({quadStreamInsert:n,context:t});return{type:"void",execute:a}}}t.ActorQueryOperationLoad=u},38392:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(35392),t)},65929:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationMoveRewrite=void 0;const n=r(66490),i=r(96331);class a extends n.ActorQueryOperationTypedMediated{constructor(e){super(e,"move"),this.factory=new i.Factory}async testOperation(e,t){return n.ActorQueryOperation.throwOnReadOnly(t),!0}runOperation(e,t){if("string"==typeof e.destination&&"string"==typeof e.source&&e.destination===e.source||"string"!=typeof e.destination&&"string"!=typeof e.source&&e.destination.equals(e.source))return Promise.resolve({type:"void",execute:()=>Promise.resolve()});const r=[this.factory.createDrop(e.destination,!0),this.factory.createAdd(e.source,e.destination,e.silent),this.factory.createDrop(e.source)],n=this.factory.createCompositeUpdate(r);return this.mediatorQueryOperation.mediate({operation:n,context:t})}}t.ActorQueryOperationMoveRewrite=a},90676:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(65929),t)},20712:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationValues=void 0;const n=r(45718),i=r(66490),a=r(82590),o=r(75627),s=r(47793),u=new n.BindingsFactory,c=new s.DataFactory;class l extends i.ActorQueryOperationTyped{constructor(e){super(e,"values")}async testOperation(e,t){return!0}async runOperation(e,t){const r=new o.ArrayIterator(e.bindings.map((e=>u.bindings(Object.entries(e).map((([e,t])=>[c.variable(e.slice(1)),t])))))),n=e.variables;return{type:"bindings",bindingsStream:r,metadata:()=>Promise.resolve({state:new a.MetadataValidationState,cardinality:{type:"exact",value:e.bindings.length},canContainUndefs:e.bindings.some((e=>n.some((t=>!(`?${t.value}`in e))))),variables:n})}}}t.ActorQueryOperationValues=l},65178:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(20712),t)},19480:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryParseGraphql=void 0;const n=r(92180),i=r(90711),a=r(33826);class o extends n.ActorQueryParse{constructor(e){super(e),this.graphqlToSparql=new a.Converter({requireContext:!0})}async test(e){if("graphql"!==e.queryFormat?.language)throw new Error("This actor can only parse GraphQL queries");return!0}async run(e){const t=e.context.get(i.KeysInitQuery.jsonLdContext)||{},r={singularizeVariables:e.context.get(i.KeysInitQuery.graphqlSingularizeVariables)};return{operation:await this.graphqlToSparql.graphqlToSparqlAlgebra(e.query,t,r)}}}t.ActorQueryParseGraphql=o},4047:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(19480),t)},27256:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryParseSparql=void 0;const n=r(92180),i=r(96331),a=r(98082);class o extends n.ActorQueryParse{constructor(e){super(e),this.prefixes=Object.freeze(this.prefixes)}async test(e){if(e.queryFormat&&"sparql"!==e.queryFormat.language)throw new Error("This actor can only parse SPARQL queries");return!0}async run(e){const t=new a.Parser({prefixes:this.prefixes,baseIRI:e.baseIRI,sparqlStar:!0}).parse(e.query);return{baseIRI:"query"===t.type?t.base:void 0,operation:(0,i.translate)(t,{quads:!0,prefixes:this.prefixes,blankToVariable:!0,baseIRI:e.baseIRI})}}}t.ActorQueryParseSparql=o},8323:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(27256),t)},30389:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryResultSerializeJson=void 0;const n=r(58871),i=r(43347),a=r(19198);class o extends n.ActorQueryResultSerializeFixedMediaTypes{constructor(e){super(e)}async testHandleChecked(e,t){if(!["bindings","quads","boolean"].includes(e.type))throw new Error("This actor can only handle bindings or quad streams.");return!0}async runHandle(e,t,r){const n=new a.Readable;n._read=()=>{};let o=!0;if("bindings"===e.type){const t=e.bindingsStream;n.push("["),t.on("error",(e=>n.emit("error",e))),t.on("data",(e=>{n.push(o?"\n":",\n"),n.push(JSON.stringify(Object.fromEntries([...e].map((([e,t])=>[e.value,i.termToString(t)]))))),o=!1})),t.on("end",(()=>{n.push(o?"]\n":"\n]\n"),n.push(null)}))}else if("quads"===e.type){const t=e.quadStream;n.push("["),t.on("error",(e=>n.emit("error",e))),t.on("data",(e=>{n.push(o?"\n":",\n"),n.push(JSON.stringify(i.quadToStringQuad(e))),o=!1})),t.on("end",(()=>{n.push(o?"]\n":"\n]\n"),n.push(null)}))}else try{n.push(`${JSON.stringify(await e.execute())}\n`),n.push(null)}catch(e){setTimeout((()=>n.emit("error",e)))}return{data:n}}}t.ActorQueryResultSerializeJson=o},1359:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(30389),t)},98027:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryResultSerializeRdf=void 0;const n=r(58871);class i extends n.ActorQueryResultSerialize{constructor(e){super(e)}async testHandle(e,t,r){if("quads"!==e.type)throw new Error(`Actor ${this.name} can only handle quad streams`);const{mediaTypes:n}=await this.mediatorMediaTypeCombiner.mediate({context:r,mediaTypes:!0});if(!(t in n))throw new Error(`Actor ${this.name} can not handle media type ${t}. All available types: ${Object.keys(n)}`);return!0}async runHandle(e,t,r){return(await this.mediatorRdfSerialize.mediate({context:r,handle:{context:r,quadStream:e.quadStream},handleMediaType:t})).handle}async testMediaType(e){return!0}async getMediaTypes(e){return(await this.mediatorMediaTypeCombiner.mediate({context:e,mediaTypes:!0})).mediaTypes}async testMediaTypeFormats(e){return!0}async getMediaTypeFormats(e){return(await this.mediatorMediaTypeFormatCombiner.mediate({context:e,mediaTypeFormats:!0})).mediaTypeFormats}}t.ActorQueryResultSerializeRdf=i},33275:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(98027),t)},36057:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryResultSerializeSimple=void 0;const n=r(58871),i=r(43347),a=r(19198);class o extends n.ActorQueryResultSerializeFixedMediaTypes{constructor(e){super(e)}async testHandleChecked(e,t){if(!["bindings","quads","boolean","void"].includes(e.type))throw new Error("This actor can only handle bindings streams, quad streams, booleans, or updates.");return!0}static termToString(e){return"Quad"===e.termType?(0,i.termToString)(e):e.value}async runHandle(e,t,r){const n=new a.Readable;let i;if(n._read=()=>{},"bindings"===e.type)i=e.bindingsStream,i.on("error",(e=>n.emit("error",e))),i.on("data",(e=>n.push(`${[...e].map((([e,t])=>`?${e.value}: ${o.termToString(t)}`)).join("\n")}\n\n`))),i.on("end",(()=>n.push(null)));else if("quads"===e.type)i=e.quadStream,i.on("error",(e=>n.emit("error",e))),i.on("data",(e=>n.push(`subject: ${o.termToString(e.subject)}\npredicate: ${o.termToString(e.predicate)}\nobject: ${o.termToString(e.object)}\ngraph: ${o.termToString(e.graph)}\n\n`))),i.on("end",(()=>n.push(null)));else if("boolean"===e.type)try{n.push(`${JSON.stringify(await e.execute())}\n`),n.push(null)}catch(e){setTimeout((()=>n.emit("error",e)))}else e.execute().then((()=>{n.push("ok\n"),n.push(null)})).catch((e=>setTimeout((()=>n.emit("error",e)))));return{data:n}}}t.ActorQueryResultSerializeSimple=o},1595:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(36057),t)},66338:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryResultSerializeSparqlCsv=void 0;const n=r(58871),i=r(19198);class a extends n.ActorQueryResultSerializeFixedMediaTypes{constructor(e){super(e)}static bindingToCsvBindings(e){if(!e)return"";let t=e.value;if("Literal"===e.termType)t=`${t}`;else if("BlankNode"===e.termType)t=`_:${t}`;else if("Quad"===e.termType){let r=a.bindingToCsvBindings(e.object);"Literal"===e.object.termType&&(r=`"${r.replace(/"/gu,'""')}"`),t=`<< ${a.bindingToCsvBindings(e.subject)} ${a.bindingToCsvBindings(e.predicate)} ${r} >>`}else t=`<${t}>`;return/[",\n\r]/u.test(t)&&(t=`"${t.replace(/"/gu,'""')}"`),t}async testHandleChecked(e,t){if("bindings"!==e.type)throw new Error("This actor can only handle bindings streams.");return!0}async runHandle(e,t,r){const n=e,o=new i.Readable;o._read=()=>{};const s=await n.metadata();return o.push(`${s.variables.map((e=>e.value)).join(",")}\r\n`),n.bindingsStream.on("error",(e=>{o.emit("error",e)})),n.bindingsStream.on("data",(e=>{o.push(`${s.variables.map((t=>a.bindingToCsvBindings(e.get(t)))).join(",")}\r\n`)})),n.bindingsStream.on("end",(()=>{o.push(null)})),{data:o}}}t.ActorQueryResultSerializeSparqlCsv=a},83657:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(66338),t)},40409:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActionObserverHttp=void 0;const n=r(90412);class i extends n.ActionObserver{constructor(e){super(e),this.requests=0,this.bus.subscribeObserver(this),this.httpInvalidator.addInvalidateListener((()=>{this.requests=0}))}onRun(e,t,r){this.requests++}}t.ActionObserverHttp=i},71186:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryResultSerializeSparqlJson=void 0;const n=r(58871),i=r(19198);class a extends n.ActorQueryResultSerializeFixedMediaTypes{constructor(e){super(e)}static bindingToJsonBindings(e){if("Literal"===e.termType){const t=e,r={value:t.value,type:"literal"},{language:n}=t,{datatype:i}=t;return n?r["xml:lang"]=n:i&&"http://www.w3.org/2001/XMLSchema#string"!==i.value&&(r.datatype=i.value),r}return"BlankNode"===e.termType?{value:e.value,type:"bnode"}:"Quad"===e.termType?{value:{subject:a.bindingToJsonBindings(e.subject),predicate:a.bindingToJsonBindings(e.predicate),object:a.bindingToJsonBindings(e.object)},type:"triple"}:{value:e.value,type:"uri"}}async testHandleChecked(e,t){if(!["bindings","boolean"].includes(e.type))throw new Error("This actor can only handle bindings streams or booleans.");return!0}async runHandle(e,t,r){const n=new i.Readable;n._read=()=>{};const o={};if("bindings"===e.type){const t=await e.metadata();t.variables.length>0&&(o.vars=t.variables.map((e=>e.value)))}n.push(`{"head": ${JSON.stringify(o)},\n`);let s=!0;if("bindings"===e.type){const t=e.bindingsStream;t.on("error",(e=>{n.emit("error",e)})),t.on("data",(e=>{s?n.push('"results": { "bindings": [\n'):n.push(",\n");const t=Object.fromEntries([...e].map((([e,t])=>[e.value,a.bindingToJsonBindings(t)])));n.push(JSON.stringify(t)),s=!1})),t.on("end",(()=>{s&&n.push('"results": { "bindings": [\n'),n.push("\n]}"),this.emitMetadata&&n.push(`,\n"metadata": { "httpRequests": ${this.httpObserver.requests} }`),n.push("}\n"),n.push(null)}))}else try{n.push(`"boolean":${await e.execute()}\n}\n`),n.push(null)}catch(e){n.once("newListener",(()=>n.emit("error",e)))}return{data:n}}}t.ActorQueryResultSerializeSparqlJson=a},13125:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(40409),t),i(r(71186),t)},86780:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryResultSerializeSparqlTsv=void 0;const n=r(58871),i=r(46898),a=r(19198);class o extends n.ActorQueryResultSerializeFixedMediaTypes{constructor(e){super(e)}static bindingToTsvBindings(e){return e?(0,i.termToString)(e).replace(/\t/gu,"\\t").replace(/\n/gu,"\\n").replace(/\r/gu,"\\r"):""}async testHandleChecked(e,t){if("bindings"!==e.type)throw new Error("This actor can only handle bindings streams.");return!0}async runHandle(e,t,r){const n=e,i=new a.Readable;i._read=()=>{};const s=await n.metadata();return i.push(`${s.variables.map((e=>e.value)).join("\t")}\n`),n.bindingsStream.on("error",(e=>{i.emit("error",e)})),n.bindingsStream.on("data",(e=>{i.push(`${s.variables.map((t=>o.bindingToTsvBindings(e.get(t)))).join("\t")}\n`)})),n.bindingsStream.on("end",(()=>{i.push(null)})),{data:i}}}t.ActorQueryResultSerializeSparqlTsv=o},92796:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(86780),t)},13168:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryResultSerializeSparqlXml=void 0;const n=r(58871),i=r(19198),a=r(1861);class o extends n.ActorQueryResultSerializeFixedMediaTypes{constructor(e){super(e)}static bindingToXmlBindings(e,t){return{name:"binding",attributes:{name:t.value},children:[this.valueToXmlValue(e)]}}static valueToXmlValue(e){let t;switch(e.termType){case"Literal":return t=e.language?{"xml:lang":e.language}:e.datatype&&"http://www.w3.org/2001/XMLSchema#string"!==e.datatype.value?{datatype:e.datatype.value}:{},{name:"literal",attributes:t,children:e.value};case"BlankNode":return{name:"bnode",children:e.value};case"Quad":return{name:"triple",children:[{name:"subject",children:[this.valueToXmlValue(e.subject)]},{name:"predicate",children:[this.valueToXmlValue(e.predicate)]},{name:"object",children:[this.valueToXmlValue(e.object)]}]};default:return{name:"uri",children:e.value}}}async testHandleChecked(e,t){if(!["bindings","boolean"].includes(e.type))throw new Error("This actor can only handle bindings streams or booleans.");return!0}async runHandle(e,t,r){const n=new i.Readable;n._read=()=>{};const s=new a.XmlSerializer((e=>n.push(e)));s.open("sparql",{xmlns:"http://www.w3.org/2005/sparql-results#"});const u=await e.metadata();if(s.add({name:"head",children:u.variables.map((e=>({name:"variable",attributes:{name:e.value}})))}),"bindings"===e.type){s.open("results");const t=e.bindingsStream;t.on("error",(e=>{n.emit("error",e)})),t.on("data",(e=>{s.add({name:"result",children:[...e].map((([e,t])=>o.bindingToXmlBindings(t,e)))})})),t.on("end",(()=>{s.close(),s.close(),setTimeout((()=>n.push(null)))}))}else try{const t=await e.execute();s.add({name:"boolean",children:t.toString()}),s.close(),setTimeout((()=>n.push(null)))}catch(e){setTimeout((()=>n.emit("error",e)))}return{data:n}}}t.ActorQueryResultSerializeSparqlXml=o},1861:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XmlSerializer=void 0,t.XmlSerializer=class{constructor(e){this.stack=[],this.push=e,this.push('\n')}open(e,t){this.push(`${this.identation()+this.formatTag(e,t,"open")}\n`),this.stack.push(e)}close(){const e=this.stack.pop();if(void 0===e)throw new Error("There is no tag left to close");this.push(`${this.identation()+this.formatTag(e,{},"close")}\n`)}add(e){this.push(this.serializeNode(e))}serializeNode(e){if(void 0===e.children)return`${this.identation()+this.formatTag(e.name,e.attributes,"self-closing")}\n`;if("string"==typeof e.children)return`${this.identation()+this.formatTag(e.name,e.attributes,"open")+this.escape(e.children)+this.formatTag(e.name,{},"close")}\n`;const t=[];t.push(`${this.identation()+this.formatTag(e.name,e.attributes,"open")}\n`),this.stack.push(e.name);for(const r of e.children)t.push(this.serializeNode(r));return this.stack.pop(),t.push(`${this.identation()+this.formatTag(e.name,{},"close")}\n`),t.join("")}identation(){return this.stack.map((e=>" ")).join("")}formatTag(e,t,r){return`<${"close"===r?"/":""}${e}${Object.entries(t||{}).map((e=>` ${e[0]}="${this.escape(e[1])}"`))}${"self-closing"===r?"/":""}>`}escape(e){return e.replace(/["&'<>]/gu,(e=>{switch(e){case"<":return"<";case">":return">";case"&":return"&";case"'":return"'";case'"':return"""}}))}}},23200:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(13168),t)},94690:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActionObserverHttp=void 0;const n=r(90412);class i extends n.ActionObserver{constructor(e){super(e),this.requests=0,this.bus.subscribeObserver(this),this.httpInvalidator.addInvalidateListener((()=>{this.requests=0}))}onRun(e,t,r){this.requests++}}t.ActionObserverHttp=i},98329:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryResultSerializeStats=void 0;const n=r(58871),i=r(19198),a=r(65606);class o extends n.ActorQueryResultSerializeFixedMediaTypes{constructor(e){super(e)}async testHandleChecked(e,t){if(!["bindings","quads"].includes(e.type))throw new Error("This actor can only handle bindings streams or quad streams.");return!0}pushHeader(e){const t=["Result","Delay (ms)","HTTP requests"].join(",");e.push(`${t}\n`)}pushStat(e,t,r){const n=[r,this.delay(t),this.httpObserver.requests].join(",");e.push(`${n}\n`)}pushFooter(e,t){const r=["TOTAL",this.delay(t),this.httpObserver.requests].join(",");e.push(`${r}\n`),e.push(null)}async runHandle(e,t,r){const n=new i.Readable;n._read=()=>{};const a="bindings"===e.type?e.bindingsStream:e.quadStream,o=this.now();let s=1;return this.pushHeader(n),a.on("error",(e=>n.emit("error",e))),a.on("data",(()=>this.pushStat(n,o,s++))),a.on("end",(()=>this.pushFooter(n,o))),{data:n}}now(){if("undefined"==typeof performance){const e=a.hrtime();return 1e3*e[0]+e[1]/1e6}return performance.now()}delay(e){return this.now()-e}}t.ActorQueryResultSerializeStats=o},93408:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(94690),t),i(r(98329),t)},80991:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryResultSerializeTable=void 0;const n=r(58871),i=r(47793),a=r(43347),o=r(3285),s=r(19198),u=new i.DataFactory,c=o.QUAD_TERM_NAMES.map((e=>u.variable(e)));class l extends n.ActorQueryResultSerializeFixedMediaTypes{constructor(e){super(e),this.padding=l.repeat(" ",this.columnWidth)}static repeat(e,t){return e.repeat(t)}async testHandleChecked(e,t){if(!["bindings","quads"].includes(e.type))throw new Error("This actor can only handle bindings or quad streams.");return!0}termToString(e){return"Quad"===e.termType?(0,a.termToString)(e):e.value}pad(e){return e.length<=this.columnWidth?e+this.padding.slice(e.length):`${e.slice(0,this.columnWidth-1)}…`}pushHeader(e,t){const r=t.map((e=>this.pad(e.value))).join(" ");e.push(`${r}\n${l.repeat("-",r.length)}\n`)}pushRow(e,t,r){e.push(`${t.map((e=>r.has(e)?this.termToString(r.get(e)):"")).map((e=>this.pad(e))).join(" ")}\n`)}async runHandle(e,t,r){const n=new s.Readable;let i;if(n._read=()=>{},"bindings"===e.type){i=e.bindingsStream;const t=(await e.metadata()).variables;this.pushHeader(n,t),i.on("error",(e=>n.emit("error",e))),i.on("data",(e=>this.pushRow(n,t,e)))}else i=e.quadStream,this.pushHeader(n,c),i.on("error",(e=>n.emit("error",e))),i.on("data",(e=>n.push(`${(0,o.getTerms)(e).map((e=>this.pad(this.termToString(e)))).join(" ")}\n`)));return i.on("end",(()=>n.push(null))),{data:n}}}t.ActorQueryResultSerializeTable=l},17731:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(80991),t)},73505:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryResultSerializeTree=void 0;const n=r(58871),i=r(90711),a=r(90412),o=r(19198),s=r(12763);class u extends n.ActorQueryResultSerializeFixedMediaTypes{constructor(e){super(e)}static bindingsStreamToGraphQl(e,t,r){const n=a.ActionContext.ensureActionContext(t);return new Promise(((t,a)=>{const o=[],u=new s.Converter(r),c={singularizeVariables:n.get(i.KeysInitQuery.graphqlSingularizeVariables)||{}};e.on("error",a),e.on("data",(e=>{o.push(Object.fromEntries([...e].map((([e,t])=>[e.value,t]))))})),e.on("end",(()=>{t(u.bindingsToTree(o,c))}))}))}async testHandleChecked(e){if("bindings"!==e.type)throw new Error("This actor can only handle bindings streams.");return!0}async runHandle(e,t){const r=new o.Readable;r._read=()=>{};const n=e.bindingsStream;return n.on("error",(e=>r.emit("error",e))),u.bindingsStreamToGraphQl(n,e.context,{materializeRdfJsTerms:!0}).then((e=>{r.push(JSON.stringify(e,null," ")),r.push(null)})).catch((e=>r.emit("error",e))),{data:r}}}t.ActorQueryResultSerializeTree=u},78149:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.bindingsStreamToGraphQl=void 0;const a=r(73505),{bindingsStreamToGraphQl:o}=a.ActorQueryResultSerializeTree;t.bindingsStreamToGraphQl=o,i(r(73505),t)},914:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfJoinEntriesSortCardinality=void 0;const n=r(39195);class i extends n.ActorRdfJoinEntriesSort{constructor(e){super(e)}async test(e){return!0}async run(e){return{entries:[...e.entries].sort(((e,t)=>e.metadata.cardinality.value-t.metadata.cardinality.value))}}}t.ActorRdfJoinEntriesSortCardinality=i},4669:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(914),t)},17937:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfJoinHash=void 0;const n=r(95445),i=r(25579);class a extends n.ActorRdfJoin{constructor(e){super(e,{logicalType:"inner",physicalName:"hash",limitEntries:2})}async getOutput(e){const t=await n.ActorRdfJoin.getMetadatas(e.entries),r=n.ActorRdfJoin.overlappingVariables(t);return{result:{type:"bindings",bindingsStream:new i.HashJoin(e.entries[0].output.bindingsStream,e.entries[1].output.bindingsStream,(e=>n.ActorRdfJoin.hash(e,r)),n.ActorRdfJoin.joinBindings),metadata:async()=>await this.constructResultMetadata(e.entries,t,e.context)}}}async getJoinCoefficients(e,t){const r=n.ActorRdfJoin.getRequestInitialTimes(t),i=n.ActorRdfJoin.getRequestItemTimes(t);return{iterations:t[0].cardinality.value+t[1].cardinality.value,persistedItems:t[0].cardinality.value,blockingItems:t[0].cardinality.value,requestTime:r[0]+t[0].cardinality.value*i[0]+r[1]+t[1].cardinality.value*i[1]}}}t.ActorRdfJoinHash=a},96848:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(17937),t)},14652:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfJoinMultiBind=void 0;const n=r(66490),i=r(95445),a=r(90711),o=r(75627),s=r(96331);class u extends i.ActorRdfJoin{constructor(e){super(e,{logicalType:"inner",physicalName:"bind",canHandleUndefs:!0})}static createBindStream(e,t,r,i,a){const s=e=>{const t=r.map((t=>(0,n.materializeOperation)(t,e,{bindFilter:!1}))),a=t=>t.merge(e);return new o.TransformIterator((async()=>(await i(t,e)).transform({map:a})),{maxBufferSize:128,autoStart:!1})};switch(e){case"depth-first":return new o.MultiTransformIterator(t,{autoStart:!1,multiTransform:s,optional:a});case"breadth-first":return new o.UnionIterator(t.transform({map:s,optional:a}),{autoStart:!1});default:throw new Error(`Received request for unknown bind order: ${e}`)}}async sortJoinEntries(e,t){if(e.some((e=>e.metadata.canContainUndefs)))return e;const r={};for(const t of e)for(const e of t.metadata.variables){let t=r[e.value];t||(t=0),r[e.value]=++t}const n=[];for(const[e,t]of Object.entries(r))t>=2&&n.push(e);if(0===n.length)throw new Error("Bind join can only join entries with at least one common variable");const i=[];for(const t of e){let e=!1;for(const r of t.metadata.variables)if(n.includes(r.value)){e=!0;break}e||i.push(t)}return(await this.mediatorJoinEntriesSort.mediate({entries:e,context:t})).entries.sort(((e,t)=>{const r=i.includes(e);return r===i.includes(t)?0:r?1:-1}))}async getOutput(e){const t=await i.ActorRdfJoin.getEntriesWithMetadatas(e.entries),r=await this.sortJoinEntries(t,e.context);this.logDebug(e.context,"First entry for Bind Join: ",(()=>({entry:r[0].operation,metadata:r[0].metadata})));for(const[e,t]of r.entries())0!==e&&t.output.bindingsStream.close();const o=r[0].output,s=[...r];s.splice(0,1);const c=e.context.set(a.KeysQueryOperation.joinLeftMetadata,r[0].metadata).set(a.KeysQueryOperation.joinRightMetadatas,s.map((e=>e.metadata)));return{result:{type:"bindings",bindingsStream:u.createBindStream(this.bindOrder,o.bindingsStream,s.map((e=>e.operation)),(async(e,t)=>{const r=1===e.length?e[0]:u.FACTORY.createJoin(e);return n.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({operation:r,context:c?.set(a.KeysQueryOperation.joinBindings,t)})).bindingsStream}),!1),metadata:()=>this.constructResultMetadata(r,r.map((e=>e.metadata)),e.context)},physicalPlanMetadata:{bindIndex:t.indexOf(r[0]),bindOrder:this.bindOrder}}}canBindWithOperation(e){let t=!0;return s.Util.recurseOperation(e,{[s.Algebra.types.EXTEND]:()=>(t=!1,!1),[s.Algebra.types.GROUP]:()=>(t=!1,!1),[s.Algebra.types.FILTER]:()=>(t=!1,!1)}),t}async getJoinCoefficients(e,t){const r=await this.sortJoinEntries(e.entries.map(((e,r)=>({...e,metadata:t[r]}))),e.context);t=r.map((e=>e.metadata));const n=i.ActorRdfJoin.getRequestInitialTimes(t),a=i.ActorRdfJoin.getRequestItemTimes(t),o=[...r],s=[...n],u=[...a];if(o.splice(0,1),s.splice(0,1),u.splice(0,1),o.some((e=>!this.canBindWithOperation(e.operation))))throw new Error(`Actor ${this.name} can not bind on Extend, Group, and Filter operations`);const c=await Promise.all(o.map((async t=>(await this.mediatorJoinSelectivity.mediate({entries:[r[0],t],context:e.context})).selectivity*this.selectivityModifier))),l=o.map(((e,t)=>e.metadata.cardinality.value*c[t])).reduce(((e,t)=>e+t),0),d=s.reduce(((e,t,r)=>e+t*c[r]),0),h=u.reduce(((e,t,r)=>e+t*c[r]),0);return{iterations:t[0].cardinality.value*l,persistedItems:0,blockingItems:0,requestTime:n[0]+t[0].cardinality.value*(a[0]+d+l*h)}}}t.ActorRdfJoinMultiBind=u,u.FACTORY=new s.Factory},42815:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(14652),t)},82e3:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfJoinMultiEmpty=void 0;const n=r(95445),i=r(82590),a=r(75627);class o extends n.ActorRdfJoin{constructor(e){super(e,{logicalType:"inner",physicalName:"multi-empty",canHandleUndefs:!0})}async test(e){if((await n.ActorRdfJoin.getMetadatas(e.entries)).every((e=>n.ActorRdfJoin.getCardinality(e).value>0)))throw new Error(`Actor ${this.name} can only join entries where at least one is empty`);return super.test(e)}async getOutput(e){for(const t of e.entries)t.output.bindingsStream.close();return{result:{bindingsStream:new a.ArrayIterator([],{autoStart:!1}),metadata:async()=>({state:new i.MetadataValidationState,cardinality:{type:"exact",value:0},canContainUndefs:!1,variables:n.ActorRdfJoin.joinVariables(await n.ActorRdfJoin.getMetadatas(e.entries))}),type:"bindings"}}}async getJoinCoefficients(e,t){return{iterations:0,persistedItems:0,blockingItems:0,requestTime:0}}}t.ActorRdfJoinMultiEmpty=o},25445:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(82e3),t)},20268:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfJoinMultiSmallest=void 0;const n=r(66490),i=r(95445),a=r(96331);class o extends i.ActorRdfJoin{constructor(e){super(e,{logicalType:"inner",physicalName:"multi-smallest",limitEntries:3,limitEntriesMin:!0,canHandleUndefs:!0})}async sortJoinEntries(e,t){return(await this.mediatorJoinEntriesSort.mediate({entries:e,context:t})).entries}async getOutput(e){const t=await this.sortJoinEntries(await i.ActorRdfJoin.getEntriesWithMetadatas([...e.entries]),e.context),r=t[0],a=t[1];t.splice(0,2);const s={output:n.ActorQueryOperation.getSafeBindings(await this.mediatorJoin.mediate({type:e.type,entries:[r,a],context:e.context})),operation:o.FACTORY.createJoin([r.operation,a.operation],!1)};return t.push(s),{result:await this.mediatorJoin.mediate({type:e.type,entries:t,context:e.context})}}async getJoinCoefficients(e,t){t=[...t];const r=await this.sortJoinEntries(e.entries.map(((e,r)=>({...e,metadata:t[r]}))),e.context);t=r.map((e=>e.metadata));const n=i.ActorRdfJoin.getRequestInitialTimes(t),a=i.ActorRdfJoin.getRequestItemTimes(t);return{iterations:t[0].cardinality.value*t[1].cardinality.value*t.slice(2).reduce(((e,t)=>e*t.cardinality.value),1),persistedItems:0,blockingItems:0,requestTime:n[0]+t[0].cardinality.value*a[0]+n[1]+t[1].cardinality.value*a[1]+t.slice(2).reduce(((e,t,r)=>e+n.slice(2)[r]+t.cardinality.value*a.slice(2)[r]),0)}}}t.ActorRdfJoinMultiSmallest=o,o.FACTORY=new a.Factory},25925:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(20268),t)},31523:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfJoinNestedLoop=void 0;const n=r(95445),i=r(25579);class a extends n.ActorRdfJoin{constructor(e){super(e,{logicalType:"inner",physicalName:"nested-loop",limitEntries:2,canHandleUndefs:!0})}async getOutput(e){return{result:{type:"bindings",bindingsStream:new i.NestedLoopJoin(e.entries[0].output.bindingsStream,e.entries[1].output.bindingsStream,n.ActorRdfJoin.joinBindings,{autoStart:!1}),metadata:async()=>await this.constructResultMetadata(e.entries,await n.ActorRdfJoin.getMetadatas(e.entries),e.context)}}}async getJoinCoefficients(e,t){const r=n.ActorRdfJoin.getRequestInitialTimes(t),i=n.ActorRdfJoin.getRequestItemTimes(t);return{iterations:t[0].cardinality.value*t[1].cardinality.value,persistedItems:0,blockingItems:0,requestTime:r[0]+t[0].cardinality.value*i[0]+r[1]+t[1].cardinality.value*i[1]}}}t.ActorRdfJoinNestedLoop=a},36229:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(31523),t)},52729:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfJoinNone=void 0;const n=r(45718),i=r(95445),a=r(82590),o=r(75627),s=new n.BindingsFactory;class u extends i.ActorRdfJoin{constructor(e){super(e,{logicalType:"inner",physicalName:"none",limitEntries:0})}async test(e){if(e.entries.length>0)throw new Error(`Actor ${this.name} can only join zero entries`);return await this.getJoinCoefficients()}async getOutput(e){return{result:{bindingsStream:new o.ArrayIterator([s.bindings()],{autoStart:!1}),metadata:()=>Promise.resolve({state:new a.MetadataValidationState,cardinality:{type:"exact",value:1},canContainUndefs:!1,variables:[]}),type:"bindings"}}}async getJoinCoefficients(){return{iterations:0,persistedItems:0,blockingItems:0,requestTime:0}}}t.ActorRdfJoinNone=u},88766:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(52729),t)},40721:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfJoinSingle=void 0;const n=r(95445);class i extends n.ActorRdfJoin{constructor(e){super(e,{logicalType:"inner",physicalName:"single",limitEntries:1}),this.includeInLogs=!1}async test(e){if(1!==e.entries.length)throw new Error(`Actor ${this.name} can only join a single entry`);return await this.getJoinCoefficients()}async getOutput(e){return{result:e.entries[0].output}}async getJoinCoefficients(){return{iterations:0,persistedItems:0,blockingItems:0,requestTime:0}}}t.ActorRdfJoinSingle=i},71924:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(40721),t)},42149:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfJoinSymmetricHash=void 0;const n=r(95445),i=r(25579);class a extends n.ActorRdfJoin{constructor(e){super(e,{logicalType:"inner",physicalName:"symmetric-hash",limitEntries:2})}async getOutput(e){const t=await n.ActorRdfJoin.getMetadatas(e.entries),r=n.ActorRdfJoin.overlappingVariables(t);return{result:{type:"bindings",bindingsStream:new i.SymmetricHashJoin(e.entries[0].output.bindingsStream,e.entries[1].output.bindingsStream,(e=>a.hash(e,r)),n.ActorRdfJoin.joinBindings),metadata:async()=>await this.constructResultMetadata(e.entries,t,e.context)}}}async getJoinCoefficients(e,t){const r=n.ActorRdfJoin.getRequestInitialTimes(t),i=n.ActorRdfJoin.getRequestItemTimes(t);return{iterations:t[0].cardinality.value+t[1].cardinality.value,persistedItems:t[0].cardinality.value+t[1].cardinality.value,blockingItems:0,requestTime:r[0]+t[0].cardinality.value*i[0]+r[1]+t[1].cardinality.value*i[1]}}}t.ActorRdfJoinSymmetricHash=a},96835:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(42149),t)},3370:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfJoinMinusHashUndef=void 0;const n=r(66490),i=r(95445),a=r(37853);class o extends i.ActorRdfJoin{constructor(e){super(e,{logicalType:"minus",physicalName:"hash-undef",limitEntries:2,canHandleUndefs:!0})}async getOutput(e){const t=e.entries[1].output,r=e.entries[0].output,o=await i.ActorRdfJoin.getMetadatas(e.entries),s=i.ActorRdfJoin.overlappingVariables(o);if(s.length>0){const e=new a.BindingsIndex(s);return{result:{type:"bindings",bindingsStream:new n.ClosableTransformIterator((async()=>(await new Promise((r=>{t.bindingsStream.on("data",(t=>e.add(t))),t.bindingsStream.on("end",r)})),r.bindingsStream.filter((t=>!e.contains(t))))),{autoStart:!1,onClose(){t.bindingsStream.destroy(),r.bindingsStream.destroy()}}),async metadata(){const e=await r.metadata(),t=await r.metadata();return{...t,canContainUndefs:e.canContainUndefs||t.canContainUndefs}}}}}return t.bindingsStream.destroy(),{result:r}}async getJoinCoefficients(e,t){const r=i.ActorRdfJoin.getRequestInitialTimes(t),n=i.ActorRdfJoin.getRequestItemTimes(t);return{iterations:1.01*(t[0].cardinality.value+t[1].cardinality.value),persistedItems:t[0].cardinality.value,blockingItems:t[0].cardinality.value,requestTime:r[0]+t[0].cardinality.value*n[0]+r[1]+t[1].cardinality.value*n[1]}}}t.ActorRdfJoinMinusHashUndef=o},37853:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BindingsIndex=void 0;const n=r(43347);class i{constructor(e){this.data={},this.keys=e}static hashTerm(e){return e&&"Variable"!==e.termType?(0,n.termToString)(e):""}add(e){if(this.isBindingsValid(e)){let t=this.data;for(const r of this.keys){const n=i.hashTerm(e.get(r));let a=t[n];a||(a=t[n]={}),t=a}}}contains(e){return!!this.isBindingsValid(e)&&this.containsRecursive(e,this.keys,[this.data])}isBindingsValid(e){let t=!1;for(const r of this.keys)if(e.get(r)){t=!0;break}return t}containsRecursive(e,t,r){if(0===t.length)return!0;let n;[n,...t]=t;for(const a of r){const r=i.hashTerm(e.get(n));if(r){const n=[a[r],a[""]].filter(Boolean);if(0===n.length)continue;if(this.containsRecursive(e,t,n))return!0}else{let r=Object.keys(a).map((e=>a[e]));if(0===r.length&&(r=[{}]),this.containsRecursive(e,t,r))return!0}}return!1}}t.BindingsIndex=i},55011:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(3370),t)},38729:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfJoinMinusHash=void 0;const n=r(66490),i=r(95445);class a extends i.ActorRdfJoin{constructor(e){super(e,{logicalType:"minus",physicalName:"hash",limitEntries:2})}async getOutput(e){const t=e.entries[1].output,r=e.entries[0].output,a=await i.ActorRdfJoin.getMetadatas(e.entries),o=i.ActorRdfJoin.overlappingVariables(a);if(o.length>0){const e={};return{result:{type:"bindings",bindingsStream:new n.ClosableTransformIterator((async()=>(await new Promise((r=>{t.bindingsStream.on("data",(t=>{e[i.ActorRdfJoin.hash(t,o)]=!0})),t.bindingsStream.on("end",r)})),r.bindingsStream.filter((t=>!e[i.ActorRdfJoin.hash(t,o)])))),{autoStart:!1,onClose(){t.bindingsStream.destroy(),r.bindingsStream.destroy()}}),metadata:r.metadata}}}return t.bindingsStream.destroy(),{result:r}}async getJoinCoefficients(e,t){const r=i.ActorRdfJoin.getRequestInitialTimes(t),n=i.ActorRdfJoin.getRequestItemTimes(t);return{iterations:t[0].cardinality.value+t[1].cardinality.value,persistedItems:t[0].cardinality.value,blockingItems:t[0].cardinality.value,requestTime:r[0]+t[0].cardinality.value*n[0]+r[1]+t[1].cardinality.value*n[1]}}}t.ActorRdfJoinMinusHash=a},42004:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(38729),t)},75425:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfJoinOptionalBind=void 0;const n=r(42815),i=r(66490),a=r(95445),o=r(90711),s=r(96331);class u extends a.ActorRdfJoin{constructor(e){super(e,{logicalType:"optional",physicalName:"bind",limitEntries:2,canHandleUndefs:!0})}async getOutput(e){e.entries[1].output.bindingsStream.close();const t=e.context.set(o.KeysQueryOperation.joinLeftMetadata,await e.entries[0].output.metadata()).set(o.KeysQueryOperation.joinRightMetadatas,[await e.entries[1].output.metadata()]);return{result:{type:"bindings",bindingsStream:n.ActorRdfJoinMultiBind.createBindStream(this.bindOrder,e.entries[0].output.bindingsStream,[e.entries[1].operation],(async(e,r)=>{const n=e[0];return i.ActorQueryOperation.getSafeBindings(await this.mediatorQueryOperation.mediate({operation:n,context:t?.set(o.KeysQueryOperation.joinBindings,r)})).bindingsStream}),!0),metadata:async()=>await this.constructResultMetadata(e.entries,await a.ActorRdfJoin.getMetadatas(e.entries),e.context,{canContainUndefs:!0})}}}async getJoinCoefficients(e,t){const r=a.ActorRdfJoin.getRequestInitialTimes(t),n=a.ActorRdfJoin.getRequestItemTimes(t);if(e.entries[1].operation.type===s.Algebra.types.EXTEND||e.entries[1].operation.type===s.Algebra.types.GROUP)throw new Error(`Actor ${this.name} can not bind on Extend and Group operations`);const i=(await this.mediatorJoinSelectivity.mediate({entries:e.entries,context:e.context})).selectivity*this.selectivityModifier;return{iterations:t[0].cardinality.value*t[1].cardinality.value*i,persistedItems:0,blockingItems:0,requestTime:r[0]+t[0].cardinality.value*i*(n[0]+r[1]+t[1].cardinality.value*n[1])}}}t.ActorRdfJoinOptionalBind=u},97237:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(75425),t)},66905:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfJoinOptionalNestedLoop=void 0;const n=r(95445),i=r(25579);class a extends n.ActorRdfJoin{constructor(e){super(e,{logicalType:"optional",physicalName:"nested-loop",limitEntries:2,canHandleUndefs:!0})}async getOutput(e){return{result:{type:"bindings",bindingsStream:new i.NestedLoopJoin(e.entries[0].output.bindingsStream,e.entries[1].output.bindingsStream,n.ActorRdfJoin.joinBindings,{optional:!0,autoStart:!1}),metadata:async()=>await this.constructResultMetadata(e.entries,await n.ActorRdfJoin.getMetadatas(e.entries),e.context,{canContainUndefs:!0})}}}async getJoinCoefficients(e,t){const r=n.ActorRdfJoin.getRequestInitialTimes(t),i=n.ActorRdfJoin.getRequestItemTimes(t);return{iterations:t[0].cardinality.value*t[1].cardinality.value,persistedItems:0,blockingItems:0,requestTime:r[0]+t[0].cardinality.value*i[0]+r[1]+t[1].cardinality.value*i[1]}}}t.ActorRdfJoinOptionalNestedLoop=a},65267:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(66905),t)},36750:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JoinTypes=t.ActorRdfJoinSelectivityVariableCounting=void 0;const n=r(95705),i=r(96331);class a extends n.ActorRdfJoinSelectivity{constructor(e){super(e)}async test(e){return{accuracy:.5}}static getPatternCost(e){let t=1;return"Variable"===e.subject.termType&&(t+=4),"Variable"!==e.predicate.termType&&e.type!==i.Algebra.types.PATH||(t+=1),"Variable"===e.object.termType&&(t+=2),"Variable"===e.graph.termType&&(t+=1),t/9}static getJoinTypes(e,t){const r=[];return"Variable"===e.subject.termType?(e.subject.equals(t.subject)&&r.push(o.unboundSS),"pattern"===t.type&&e.subject.equals(t.predicate)&&r.push(o.unboundSP),e.subject.equals(t.object)&&r.push(o.unboundSO),e.subject.equals(t.graph)&&r.push(o.unboundSG)):(e.subject.equals(t.subject)&&r.push(o.boundSS),"pattern"===t.type&&e.subject.equals(t.predicate)&&r.push(o.boundSP),e.subject.equals(t.object)&&r.push(o.boundSO),e.subject.equals(t.graph)&&r.push(o.boundSG)),"pattern"===e.type&&("Variable"===e.predicate.termType?(e.predicate.equals(t.subject)&&r.push(o.unboundPS),"pattern"===t.type&&e.predicate.equals(t.predicate)&&r.push(o.unboundPP),e.predicate.equals(t.object)&&r.push(o.unboundPO),e.predicate.equals(t.graph)&&r.push(o.unboundPG)):(e.predicate.equals(t.subject)&&r.push(o.boundPS),"pattern"===t.type&&e.predicate.equals(t.predicate)&&r.push(o.boundPP),e.predicate.equals(t.object)&&r.push(o.boundPO),e.predicate.equals(t.graph)&&r.push(o.boundPG))),"Variable"===e.object.termType?(e.object.equals(t.subject)&&r.push(o.unboundOS),"pattern"===t.type&&e.object.equals(t.predicate)&&r.push(o.unboundOP),e.object.equals(t.object)&&r.push(o.unboundOO),e.object.equals(t.graph)&&r.push(o.unboundOG)):(e.object.equals(t.subject)&&r.push(o.boundOS),"pattern"===t.type&&e.object.equals(t.predicate)&&r.push(o.boundOP),e.object.equals(t.object)&&r.push(o.boundOO),e.object.equals(t.graph)&&r.push(o.boundOG)),"Variable"===e.graph.termType?(e.graph.equals(t.subject)&&r.push(o.unboundGS),"pattern"===t.type&&e.graph.equals(t.predicate)&&r.push(o.unboundGP),e.graph.equals(t.object)&&r.push(o.unboundGO),e.graph.equals(t.graph)&&r.push(o.unboundGG)):(e.graph.equals(t.subject)&&r.push(o.boundGS),"pattern"===t.type&&e.graph.equals(t.predicate)&&r.push(o.boundGP),e.graph.equals(t.object)&&r.push(o.boundGO),e.graph.equals(t.graph)&&r.push(o.boundGG)),r}static getOperationsPairwiseJoinCost(e,t){let r=a.MAX_PAIRWISE_COST;for(const n of a.getJoinTypes(e,t))switch(n){case o.boundSS:r-=4;break;case o.boundSP:r-=6;break;case o.boundSO:r-=2;break;case o.boundSG:case o.boundPS:r-=6;break;case o.boundPP:return 1;case o.boundPO:case o.boundPG:r-=6;break;case o.boundOS:r-=2;break;case o.boundOP:r-=6;break;case o.boundOO:r-=2;break;case o.boundOG:case o.boundGS:case o.boundGP:case o.boundGO:case o.boundGG:r-=6;break;case o.unboundSS:r-=2;break;case o.unboundSP:r-=3;break;case o.unboundSO:r-=1;break;case o.unboundSG:case o.unboundPS:case o.unboundPP:case o.unboundPO:case o.unboundPG:r-=3;break;case o.unboundOS:r-=1;break;case o.unboundOP:r-=3;break;case o.unboundOO:r-=1;break;case o.unboundOG:case o.unboundGS:case o.unboundGP:case o.unboundGO:case o.unboundGG:r-=3}return r/a.MAX_PAIRWISE_COST}static getOperationsJoinCost(e){const t=[];for(const r of e)i.Util.recurseOperation(r,{[i.Algebra.types.PATTERN]:e=>(t.push(e),!1),[i.Algebra.types.PATH]:e=>(t.push(e),!1)});let r=0,n=0;for(const e of t)for(const i of t)e!==i&&(r+=a.getOperationsPairwiseJoinCost(e,i),n++);return 0===n?1:r/n*t.reduce(((e,t)=>e*a.getPatternCost(t)),1)}async run(e){return e.entries.length<=1?{selectivity:1}:{selectivity:a.getOperationsJoinCost(e.entries.map((e=>e.operation)))}}}var o;t.ActorRdfJoinSelectivityVariableCounting=a,a.MAX_PAIRWISE_COST=82,function(e){e[e.boundSS=0]="boundSS",e[e.boundSP=1]="boundSP",e[e.boundSO=2]="boundSO",e[e.boundSG=3]="boundSG",e[e.boundPS=4]="boundPS",e[e.boundPP=5]="boundPP",e[e.boundPO=6]="boundPO",e[e.boundPG=7]="boundPG",e[e.boundOS=8]="boundOS",e[e.boundOP=9]="boundOP",e[e.boundOO=10]="boundOO",e[e.boundOG=11]="boundOG",e[e.boundGS=12]="boundGS",e[e.boundGP=13]="boundGP",e[e.boundGO=14]="boundGO",e[e.boundGG=15]="boundGG",e[e.unboundSS=16]="unboundSS",e[e.unboundSP=17]="unboundSP",e[e.unboundSO=18]="unboundSO",e[e.unboundSG=19]="unboundSG",e[e.unboundPS=20]="unboundPS",e[e.unboundPP=21]="unboundPP",e[e.unboundPO=22]="unboundPO",e[e.unboundPG=23]="unboundPG",e[e.unboundOS=24]="unboundOS",e[e.unboundOP=25]="unboundOP",e[e.unboundOO=26]="unboundOO",e[e.unboundOG=27]="unboundOG",e[e.unboundGS=28]="unboundGS",e[e.unboundGP=29]="unboundGP",e[e.unboundGO=30]="unboundGO",e[e.unboundGG=31]="unboundGG"}(o||(t.JoinTypes=o={}))},3595:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(36750),t)},27419:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfMetadataAccumulateCanContainUndefs=void 0;const n=r(50433);class i extends n.ActorRdfMetadataAccumulate{constructor(e){super(e)}async test(e){return!0}async run(e){if("initialize"===e.mode)return{metadata:{canContainUndefs:!1}};let t=e.accumulatedMetadata.canContainUndefs;return e.appendingMetadata.canContainUndefs&&(t=!0),{metadata:{canContainUndefs:t}}}}t.ActorRdfMetadataAccumulateCanContainUndefs=i},44024:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(27419),t)},76063:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfMetadataAccumulateCardinality=void 0;const n=r(50433);class i extends n.ActorRdfMetadataAccumulate{constructor(e){super(e)}async test(e){return!0}async run(e){if("initialize"===e.mode)return{metadata:{cardinality:{type:"exact",value:0}}};const t={...e.accumulatedMetadata.cardinality};if(t.dataset){if(!e.appendingMetadata.cardinality.dataset)return{metadata:{cardinality:t}};if(t.dataset!==e.appendingMetadata.cardinality.dataset&&e.appendingMetadata.subsetOf===t.dataset)return{metadata:{cardinality:e.appendingMetadata.cardinality}};if(t.dataset===e.appendingMetadata.cardinality.dataset)return{metadata:{cardinality:t}};delete t.dataset}return e.appendingMetadata.cardinality&&Number.isFinite(e.appendingMetadata.cardinality.value)?("estimate"===e.appendingMetadata.cardinality.type&&(t.type="estimate"),t.value+=e.appendingMetadata.cardinality.value):(t.type="estimate",t.value=Number.POSITIVE_INFINITY),{metadata:{cardinality:t}}}}t.ActorRdfMetadataAccumulateCardinality=i},37143:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(76063),t)},80933:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfMetadataAccumulatePageSize=void 0;const n=r(50433);class i extends n.ActorRdfMetadataAccumulate{constructor(e){super(e)}async test(e){return!0}async run(e){return"initialize"===e.mode?{metadata:{}}:{metadata:{..."pageSize"in e.accumulatedMetadata||"pageSize"in e.appendingMetadata?{pageSize:(e.accumulatedMetadata.pageSize||0)+(e.appendingMetadata.pageSize||0)}:{}}}}}t.ActorRdfMetadataAccumulatePageSize=i},17215:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(80933),t)},16851:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfMetadataAccumulateRequestTime=void 0;const n=r(50433);class i extends n.ActorRdfMetadataAccumulate{constructor(e){super(e)}async test(e){return!0}async run(e){return"initialize"===e.mode?{metadata:{}}:{metadata:{..."requestTime"in e.accumulatedMetadata||"requestTime"in e.appendingMetadata?{requestTime:(e.accumulatedMetadata.requestTime||0)+(e.appendingMetadata.requestTime||0)}:{}}}}}t.ActorRdfMetadataAccumulateRequestTime=i},59075:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(16851),t)},56214:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfResolveQuadPatternFederated=void 0;const n=r(61394),i=r(91288);class a extends n.ActorRdfResolveQuadPatternSource{constructor(e){super(e),this.emptyPatterns=new Map,e.mediatorRdfMetadataAccumulate||(this.mediatorRdfMetadataAccumulate={async mediate(e){if("initialize"===e.mode)return{metadata:{cardinality:{type:"exact",value:0},canContainUndefs:!1}};const t={...e.accumulatedMetadata},r=e.appendingMetadata;return r.cardinality&&Number.isFinite(r.cardinality.value)?("estimate"===r.cardinality.type&&(t.cardinality.type="estimate"),t.cardinality.value+=r.cardinality.value):(t.cardinality.type="estimate",t.cardinality.value=Number.POSITIVE_INFINITY),(t.requestTime||r.requestTime)&&(t.requestTime=t.requestTime||0,r.requestTime=r.requestTime||0,t.requestTime+=r.requestTime),(t.pageSize||r.pageSize)&&(t.pageSize=t.pageSize||0,r.pageSize=r.pageSize||0,t.pageSize+=r.pageSize),r.canContainUndefs&&(t.canContainUndefs=!0),{metadata:t}}})}async test(e){if(!(0,n.getContextSources)(e.context))throw new Error(`Actor ${this.name} can only resolve quad pattern queries against a sources array.`);return!0}async getSource(e){return new i.FederatedQuadSource(this.mediatorResolveQuadPattern,this.mediatorRdfMetadataAccumulate,e,this.emptyPatterns,this.skipEmptyPatterns)}}t.ActorRdfResolveQuadPatternFederated=a},91288:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FederatedQuadSource=void 0;const n=r(66490),i=r(61394),a=r(90711),o=r(16400),s=r(82590),u=r(75627),c=r(47793),l=r(3285),d=r(96331),h=new c.DataFactory;class p{constructor(e,t,r,n,i){if(this.mediatorResolveQuadPattern=e,this.mediatorRdfMetadataAccumulate=t,this.sources=r.get(a.KeysRdfResolveQuadPattern.sources),this.contextDefault=r.delete(a.KeysRdfResolveQuadPattern.sources),this.emptyPatterns=n,this.sourceIds=r.get(a.KeysRdfResolveQuadPattern.sourceIds)??new Map,this.skipEmptyPatterns=i,this.algebraFactory=new d.Factory,this.skipEmptyPatterns)for(const e of this.sources)this.emptyPatterns.has(e)||this.emptyPatterns.set(e,[])}static isTermBound(e){return"Variable"!==e.termType}static isSubPatternOf(e,t){return(!p.isTermBound(t.subject)||t.subject.equals(e.subject))&&(!p.isTermBound(t.predicate)||t.predicate.equals(e.predicate))&&(!p.isTermBound(t.object)||t.object.equals(e.object))&&(!p.isTermBound(t.graph)||t.graph.equals(e.graph))}static skolemizeTerm(e,t){return"BlankNode"===e.termType?new o.BlankNodeScoped(`bc_${t}_${e.value}`,h.namedNode(`${p.SKOLEM_PREFIX}${t}:${e.value}`)):e}static skolemizeQuad(e,t){return(0,l.mapTermsNested)(e,(e=>p.skolemizeTerm(e,t)))}static deskolemizeTerm(e,t){if("BlankNode"===e.termType&&"skolemized"in e&&(e=e.skolemized),"NamedNode"===e.termType&&e.value.startsWith(p.SKOLEM_PREFIX)){const r=e.value.indexOf(":",p.SKOLEM_PREFIX.length);if(e.value.slice(p.SKOLEM_PREFIX.length,r)===t){const t=e.value.slice(r+1,e.value.length);return h.blankNode(t)}return null}return e}static deskolemizeQuad(e,t){return(0,l.mapTermsNested)(e,(e=>p.deskolemizeTerm(e,t)||e))}isSourceEmpty(e,t){if(!this.skipEmptyPatterns)return!1;const r=this.emptyPatterns.get(e);if(r)for(const e of r)if(p.isSubPatternOf(t,e))return!0;return!1}getSourceId(e){let t=this.sourceIds.get(e);return void 0===t&&(t=`${this.sourceIds.size}`,this.sourceIds.set(e,t)),t}match(e,t,r,o){const c=async()=>{if(l.size===this.sources.length){let e=(await this.mediatorRdfMetadataAccumulate.mediate({mode:"initialize",context:this.contextDefault})).metadata;for(const t of l.values())e={...t,...(await this.mediatorRdfMetadataAccumulate.mediate({mode:"append",accumulatedMetadata:e,appendingMetadata:t,context:this.contextDefault})).metadata};e.state=new s.MetadataValidationState;const t=h.getProperty("metadata");h.setProperty("metadata",e),t?.state.invalidate()}},l=new Map,d=Promise.all(this.sources.map((async(n,d)=>{const f=this.getSourceId(n),y=p.deskolemizeTerm(e,f),g=p.deskolemizeTerm(t,f),m=p.deskolemizeTerm(r,f),b=p.deskolemizeTerm(o,f);let v,_,w=(0,i.getDataSourceContext)(n,this.contextDefault);w=w.set(a.KeysRdfResolveQuadPattern.source,n),y&&g&&m&&b&&!this.isSourceEmpty(n,v=this.algebraFactory.createPattern(y,g,m,b))?_=await this.mediatorResolveQuadPattern.mediate({pattern:v,context:w}):(_={data:new u.ArrayIterator([],{autoStart:!1})},_.data.setProperty("metadata",{state:new s.MetadataValidationState,...(await this.mediatorRdfMetadataAccumulate.mediate({mode:"initialize",context:this.contextDefault})).metadata}));const T=()=>{_.data.getProperty("metadata",(e=>{l.set(`${d}`,e),this.skipEmptyPatterns&&!e.cardinality?.value&&v&&!this.isSourceEmpty(n,v)&&this.emptyPatterns.get(n).push(v),c().catch((e=>h.emit("error",e))),e.state?.addInvalidateListener((()=>{l.delete(`${d}`),T()}))}))};T();const S=_.data.map((e=>p.skolemizeQuad(e,f)));return S.on("error",(e=>h.emit("error",e))),S})));d.catch((e=>h.emit("error",e)));const h=new n.ClosableTransformIterator((async()=>new u.UnionIterator(await d)),{autoStart:!1,onClose(){d.then((e=>{for(const t of e)t.destroy()}),(()=>{}))}});return 0===this.sources.length&&this.mediatorRdfMetadataAccumulate.mediate({mode:"initialize",context:this.contextDefault}).then((e=>h.setProperty("metadata",{state:new s.MetadataValidationState,...e.metadata}))).catch((e=>h.emit("error",e))),h}}t.FederatedQuadSource=p,p.SKOLEM_PREFIX="urn:comunica_skolem:source_"},40810:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(56214),t),i(r(91288),t)},67595:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfResolveQuadPatternRdfJsSource=void 0;const n=r(61394),i=r(85756);class a extends n.ActorRdfResolveQuadPatternSource{constructor(e){super(e)}async test(e){if(!(0,n.hasContextSingleSourceOfType)("rdfjsSource",e.context))throw new Error(`${this.name} requires a single source with an rdfjsSource to be present in the context.`);const t=(0,n.getContextSource)(e.context);if(!t||"string"==typeof t||!("match"in t)&&!t.value.match)throw new Error(`${this.name} received an invalid rdfjsSource.`);return!0}async getSource(e){const t=(0,n.getContextSource)(e);return new i.RdfJsQuadSource("match"in t?t:t.value)}}t.ActorRdfResolveQuadPatternRdfJsSource=a},83747:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},85756:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RdfJsQuadSource=void 0;const n=r(82590),i=r(75627),a=r(47793),o=r(3285),s=new a.DataFactory;class u{constructor(e){this.source=e}static nullifyVariables(e,t){return!e||"Variable"===e.termType||!t&&"Quad"===e.termType&&(0,o.someTermsNested)(e,(e=>"Variable"===e.termType))?void 0:e}static hasDuplicateVariables(e){const t=(0,o.filterTermsNested)(e,(e=>"Variable"===e.termType));return t.length>1&&(0,o.uniqTerms)(t).length"Quad"===e.termType))&&(l=l.filter((e=>(0,o.matchPatternComplete)(e,d)))),this.setMetadata(l,e,t,r,n).catch((e=>l.destroy(e))),l}async setMetadata(e,t,r,i,a){const c=Boolean(this.source.features?.quotedTripleFiltering);let l;if(this.source.countQuads)l=await this.source.countQuads(u.nullifyVariables(t,c),u.nullifyVariables(r,c),u.nullifyVariables(i,c),u.nullifyVariables(a,c));else{let e=0;l=await new Promise(((n,o)=>{const s=this.source.match(u.nullifyVariables(t,c),u.nullifyVariables(r,c),u.nullifyVariables(i,c),u.nullifyVariables(a,c));s.on("error",o),s.on("end",(()=>n(e))),s.on("data",(()=>e++))}))}const d=s.quad(t,r,i,a),h=!c&&(0,o.someTerms)(d,(e=>"Quad"===e.termType))||u.hasDuplicateVariables(d);e.setProperty("metadata",{state:new n.MetadataValidationState,cardinality:{type:h?"estimate":"exact",value:l},canContainUndefs:!1})}}t.RdfJsQuadSource=u},9069:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(67595),t),i(r(83747),t),i(r(85756),t)},77934:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfSerializeJsonLd=void 0;const n=r(81261),i=r(43549);class a extends n.ActorRdfSerializeFixedMediaTypes{constructor(e){super(e)}async runHandle(e,t,r){const n=new i.JsonLdSerializer({space:" ".repeat(this.jsonStringifyIndentSpaces)});let a;return"pipe"in e.quadStream?(e.quadStream.on("error",(e=>n.emit("error",e))),a=e.quadStream.pipe(n)):a=n.import(e.quadStream),{data:a}}}t.ActorRdfSerializeJsonLd=a},61515:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(77934),t)},38522:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfSerializeN3=void 0;const n=r(81261),i=r(29014);class a extends n.ActorRdfSerializeFixedMediaTypes{constructor(e){super(e)}async runHandle(e,t,r){const n=new i.StreamWriter({format:t});let a;return"pipe"in e.quadStream?(e.quadStream.on("error",(e=>n.emit("error",e))),a=e.quadStream.pipe(n)):a=n.import(e.quadStream),{data:a,triples:"text/turtle"===t||"application/n-triples"===t||"text/n3"===t}}}t.ActorRdfSerializeN3=a},42274:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(38522),t)},61186:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfSerializeShaclc=void 0;const n=r(81261),i=r(87435),a=r(19198),o=r(94174);class s extends n.ActorRdfSerializeFixedMediaTypes{constructor(e){super(e)}async runHandle(e,t,r){const n=new a.Readable;n._read=()=>{};try{const r={};e.quadStream.on("prefix",((e,t)=>{r[e]=t}));const{text:a}=await(0,o.write)(await(0,i.default)(e.quadStream),{errorOnUnused:!0,extendedSyntax:"text/shaclc-ext"===t,prefixes:r});n.push(a),n.push(null)}catch(e){n._read=()=>{n.emit("error",e)}}return{data:n,triples:!0}}}t.ActorRdfSerializeShaclc=s},98371:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(61186),t)},69160:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfUpdateQuadsRdfJsStore=void 0;const n=r(16657),i=r(29200);class a extends n.ActorRdfUpdateQuadsDestination{constructor(e){super(e)}async test(e){const t=(0,n.getContextDestination)(e.context);if(!t||"string"==typeof t||!("remove"in t)&&"value"in t&&!t.value.remove)throw new Error(`${this.name} received an invalid rdfjsStore.`);return!0}async getDestination(e){const t=(0,n.getContextDestination)(e);return new i.RdfJsQuadDestination("remove"in t?t:t.value)}}t.ActorRdfUpdateQuadsRdfJsStore=a},29200:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RdfJsQuadDestination=void 0;const n=r(47793),i=r(43347),a=new n.DataFactory;t.RdfJsQuadDestination=class{constructor(e){this.store=e}promisifyEventEmitter(e){return new Promise(((t,r)=>{e.on("end",t),e.on("error",r)}))}delete(e){return this.promisifyEventEmitter(this.store.remove(e))}insert(e){return this.promisifyEventEmitter(this.store.import(e))}async deleteGraphs(e,t,r){switch(e){case"ALL":await this.promisifyEventEmitter(this.store.deleteGraph(a.defaultGraph()));case"NAMED":const t=this.store.match(),r={};t.on("data",(e=>{"DefaultGraph"!==e.graph.termType&&(r[(0,i.termToString)(e.graph)]=!0)})),await this.promisifyEventEmitter(t),await Promise.all(Object.keys(r).map((e=>this.promisifyEventEmitter(this.store.deleteGraph((0,i.stringToTerm)(e))))));break;default:for(const t of Array.isArray(e)?e:[e])await this.promisifyEventEmitter(this.store.deleteGraph(t))}}async createGraphs(e,t){if(t)for(const t of e){const e=this.store.match(void 0,void 0,void 0,t);await new Promise(((r,n)=>{e.once("data",(()=>{n(new Error(`Unable to create graph ${t.value} as it already exists`))})),e.on("end",r),e.on("error",n)}))}}}},53550:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(69160),t)},42194:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Bindings=void 0;const n=r(49568),i=r(86290);class a{constructor(e,t){this.type="bindings",this.dataFactory=e,this.entries=t}has(e){return this.entries.has("string"==typeof e?e:e.value)}get(e){return this.entries.get("string"==typeof e?e:e.value)}set(e,t){return new a(this.dataFactory,this.entries.set("string"==typeof e?e:e.value,t))}delete(e){return new a(this.dataFactory,this.entries.delete("string"==typeof e?e:e.value))}keys(){return this.mapIterable(this.iteratorToIterable(this.entries.keys()),(e=>this.dataFactory.variable(e)))}values(){return this.iteratorToIterable(this.entries.values())}forEach(e){this.entries.forEach(((t,r)=>e(t,this.dataFactory.variable(r))))}get size(){return this.entries.size}[Symbol.iterator](){return this.mapIterable(this.iteratorToIterable(this.entries.entries()),(([e,t])=>[this.dataFactory.variable(e),t]))[Symbol.iterator]()}equals(e){if(!e)return!1;if(this===e)return!0;if(this.size!==e.size)return!1;for(const t of this.keys())if(!this.get(t)?.equals(e.get(t)))return!1;return!0}filter(e){return new a(this.dataFactory,(0,n.Map)(this.entries.filter(((t,r)=>e(t,this.dataFactory.variable(r))))))}map(e){return new a(this.dataFactory,(0,n.Map)(this.entries.map(((t,r)=>e(t,this.dataFactory.variable(r))))))}merge(e){const t=new Set([...this.iteratorToIterable(this.entries.keys()),...[...e.keys()].map((e=>e.value))]),r=[];for(const n of t){const t=this.entries.get(n),i=e.get(this.dataFactory.variable(n));if(t&&i&&!t.equals(i))return;const a=t||i;r.push([n,a])}return new a(this.dataFactory,(0,n.Map)(r))}mergeWith(e,t){const r=new Set([...this.iteratorToIterable(this.entries.keys()),...[...t.keys()].map((e=>e.value))]),i=[];for(const n of r){const r=this.dataFactory.variable(n),a=this.entries.get(n),o=t.get(r);let s;s=a&&o&&!a.equals(o)?e(a,o,r):a||o,i.push([n,s])}return new a(this.dataFactory,(0,n.Map)(i))}toString(){return(0,i.bindingsToString)(this)}*mapIterable(e,t){for(const r of e)yield t(r)}iteratorToIterable(e){return{[Symbol.iterator]:()=>e}}}t.Bindings=a},32346:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BindingsFactory=void 0;const n=r(49568),i=r(47793),a=r(42194);t.BindingsFactory=class{constructor(e=new i.DataFactory){this.dataFactory=e}bindings(e=[]){return new a.Bindings(this.dataFactory,(0,n.Map)(e.map((([e,t])=>[e.value,t]))))}fromBindings(e){return this.bindings([...e])}fromRecord(e){return this.bindings(Object.entries(e).map((([e,t])=>[this.dataFactory.variable(e),t])))}}},86290:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.bindingsToString=void 0;const n=r(43347);t.bindingsToString=function(e){const t={};for(const r of e.keys())t[r.value]=(0,n.termToString)(e.get(r));return JSON.stringify(t,null," ")}},45718:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(42194),t),i(r(32346),t),i(r(86290),t)},98862:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorContextPreprocess=void 0;const n=r(90412);class i extends n.Actor{constructor(e){super(e)}}t.ActorContextPreprocess=i},98926:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(98862),t)},67120:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorHashBindings=void 0;const n=r(90412);class i extends n.Actor{constructor(e){super(e)}}t.ActorHashBindings=i},16235:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(67120),t)},4996:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorHttpInvalidate=void 0;const n=r(90412);class i extends n.Actor{constructor(e){super(e)}}t.ActorHttpInvalidate=i},34247:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorHttpInvalidateListenable=void 0;const n=r(4996);class i extends n.ActorHttpInvalidate{constructor(e){super(e),this.invalidateListeners=[],this.invalidateListeners=[]}addInvalidateListener(e){this.invalidateListeners.push(e)}async test(e){return!0}async run(e){for(const t of this.invalidateListeners)t(e);return{}}}t.ActorHttpInvalidateListenable=i},40332:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(4996),t),i(r(34247),t)},91295:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorHttp=void 0;const n=r(90412),i=r(43364);globalThis.ReadableStream||(globalThis.ReadableStream=r(36562).ReadableStream);const a=r(31232),o=r(35276);class s extends n.Actor{constructor(e){super(e)}static toNodeReadable(e){return a(e)||null===e?e:new i.ReadableWebToNodeStream(e)}static toWebReadableStream(e){return o(e)}static headersToHash(e){const t={};return e.forEach(((e,r)=>{t[r]=e})),t}}t.ActorHttp=s},70322:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(91295),t)},3251:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorInit=void 0;const n=r(90412);class i extends n.Actor{constructor(e){super(e)}}t.ActorInit=i},6180:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(3251),t)},5603:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorOptimizeQueryOperation=void 0;const n=r(90412);class i extends n.Actor{constructor(e){super(e)}}t.ActorOptimizeQueryOperation=i},38912:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(5603),t)},31278:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperation=void 0;const n=r(90711),i=r(90412),a=r(16400),o=r(77702);let s=0;class u extends i.Actor{constructor(e){super(e)}static getSafeBindings(e){return u.validateQueryOutput(e,"bindings"),e}static getSafeQuads(e){return u.validateQueryOutput(e,"quads"),e}static getSafeBoolean(e){return u.validateQueryOutput(e,"boolean"),e}static getSafeVoid(e){return u.validateQueryOutput(e,"void"),e}static cachifyMetadata(e){let t;return()=>(t||(t=e(),t.then((e=>e.state.addInvalidateListener((()=>{t=void 0})))).catch((()=>{}))),t)}static validateQueryOutput(e,t){if(e.type!==t)throw new Error(`Invalid query output type: Expected '${t}' but got '${e.type}'`)}static getBaseExpressionContext(e){const t=e.get(n.KeysInitQuery.queryTimestamp),r=e.get(n.KeysInitQuery.baseIRI),i=e.get(n.KeysInitQuery.functionArgumentsCache)||{};if(e.has(n.KeysInitQuery.extensionFunctionCreator)&&e.has(n.KeysInitQuery.extensionFunctions))throw new Error("Illegal simultaneous usage of extensionFunctionCreator and extensionFunctions in context");let a=e.get(n.KeysInitQuery.extensionFunctionCreator);const o=e.get(n.KeysInitQuery.extensionFunctions);return o&&(a=e=>o[e.value]),{now:t,baseIRI:r,extensionFunctionCreator:a,functionArgumentsCache:i}}static getExpressionContext(e,t){return{...this.getBaseExpressionContext(e),bnode:e=>new a.BlankNodeBindingsScoped(e||"BNODE_"+s++)}}static getAsyncExpressionContext(e,t){return{...this.getBaseExpressionContext(e),bnode:e=>Promise.resolve(new a.BlankNodeBindingsScoped(e||"BNODE_"+s++)),exists:u.createExistenceResolver(e,t)}}static createExistenceResolver(e,t){return async(r,n)=>{const i=(0,o.materializeOperation)(r.input,n),a=await t.mediate({operation:i,context:e}),s=u.getSafeBindings(a);return new Promise(((e,t)=>{s.bindingsStream.on("end",(()=>{e(!1)})),s.bindingsStream.on("error",t),s.bindingsStream.on("data",(()=>{s.bindingsStream.close(),e(!0)}))})).then((e=>r.not?!e:e))}}static throwOnReadOnly(e){if(e.get(n.KeysQueryOperation.readOnly))throw new Error("Attempted a write operation in read-only mode")}}t.ActorQueryOperation=u},95816:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationTyped=void 0;const n=r(90711),i=r(31278);class a extends i.ActorQueryOperation{constructor(e,t){if(super({...e,operationName:t}),!this.operationName)throw new Error('A valid "operationName" argument must be provided.')}async test(e){if(!e.operation)throw new Error("Missing field 'operation' in a query operation action.");if(e.operation.type!==this.operationName)throw new Error(`Actor ${this.name} only supports ${this.operationName} operations, but got ${e.operation.type}`);const t=e.operation;return this.testOperation(t,e.context)}async run(e){const t=e.context.get(n.KeysInitQuery.physicalQueryPlanLogger);t&&(t.logOperation(e.operation.type,void 0,e.operation,e.context.get(n.KeysInitQuery.physicalQueryPlanNode),this.name,{}),e.context=e.context.set(n.KeysInitQuery.physicalQueryPlanNode,e.operation));const r=e.operation,a=e.context.set(n.KeysQueryOperation.operation,r),o=await this.runOperation(r,a);return"metadata"in o&&(o.metadata=i.ActorQueryOperation.cachifyMetadata(o.metadata)),o}}t.ActorQueryOperationTyped=a},33381:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryOperationTypedMediated=void 0;const n=r(95816);class i extends n.ActorQueryOperationTyped{constructor(e,t){super(e,t)}}t.ActorQueryOperationTypedMediated=i},77702:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.materializeOperation=t.materializeTerm=void 0;const n=r(45718),i=r(43347),a=r(3285),o=r(96331),s=new n.BindingsFactory;function u(e,t){if("Variable"===e.termType){const r=t.get(e);if(r)return r}return"Quad"===e.termType&&(0,a.someTermsNested)(e,(e=>"Variable"===e.termType))?(0,a.mapTermsNested)(e,(e=>u(e,t))):e}t.materializeTerm=u,t.materializeOperation=function e(t,r,n={}){return n={strictTargetVariables:"strictTargetVariables"in n&&n.strictTargetVariables,bindFilter:!("bindFilter"in n)||n.bindFilter},o.Util.mapOperation(t,{path:(e,t)=>({recurse:!1,result:t.createPath(u(e.subject,r),e.predicate,u(e.object,r),u(e.graph,r))}),pattern:(e,t)=>({recurse:!1,result:t.createPattern(u(e.subject,r),u(e.predicate,r),u(e.object,r),u(e.graph,r))}),extend(t){if(r.has(t.variable)){if(n.strictTargetVariables)throw new Error(`Tried to bind variable ${(0,i.termToString)(t.variable)} in a BIND operator.`);return{recurse:!0,result:e(t.input,r,n)}}return{recurse:!0,result:t}},group(e,t){if(n.strictTargetVariables){for(const t of e.variables)if(r.has(t))throw new Error(`Tried to bind variable ${(0,i.termToString)(t)} in a GROUP BY operator.`);return{recurse:!0,result:e}}const a=e.variables.filter((e=>!r.has(e)));return{recurse:!0,result:t.createGroup(e.input,a,e.aggregates)}},project(t,a){if(n.strictTargetVariables){for(const e of t.variables)if(r.has(e))throw new Error(`Tried to bind variable ${(0,i.termToString)(e)} in a SELECT operator.`);return{recurse:!0,result:t}}const o=t.variables.filter((e=>!r.has(e))),u=s.bindings(t.variables.map((e=>{const t=r.get(e);if(t)return[e,t]})).filter((e=>Boolean(e))));return{recurse:!1,result:a.createProject(e(t.input,u,n),o)}},values(e,t){if(!n.strictTargetVariables){const n=e.variables.filter((e=>!r.has(e))),a=e.bindings.map((e=>{const t={...e};let n=!0;return r.forEach(((e,r)=>{const a=(0,i.termToString)(r);a in t&&(e.equals(t[a])||(n=!1),delete t[a])})),n?t:void 0})).filter(Boolean);return{recurse:!0,result:t.createValues(n,a)}}for(const t of e.variables)if(r.has(t))throw new Error(`Tried to bind variable ${(0,i.termToString)(t)} in a VALUES operator.`);return{recurse:!1,result:e}},expression(e,t){if(!n.bindFilter)return{recurse:!1,result:e};if("term"===e.expressionType)return{recurse:!1,result:t.createTermExpression(u(e.term,r))};if("aggregate"===e.expressionType&&"variable"in e&&r.has(e.variable)){if(n.strictTargetVariables)throw new Error(`Tried to bind ${(0,i.termToString)(e.variable)} in a ${e.aggregator} aggregate.`);return{recurse:!0,result:e}}return{recurse:!0,result:e}}})}},74501:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BusQueryOperation=void 0;const n=r(90412);class i extends n.BusIndexed{constructor(e){super({...e,actorIdentifierFields:["operationName"],actionIdentifierFields:["operation","type"]})}}t.BusQueryOperation=i},24495:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClosableTransformIterator=void 0;const n=r(75627);class i extends n.TransformIterator{constructor(e,t){super(e,t),this.onClose=t.onClose}_end(e){this.onClose(),super._end(e)}}t.ClosableTransformIterator=i},66490:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(31278),t),i(r(95816),t),i(r(33381),t),i(r(77702),t),i(r(74501),t),i(r(24495),t)},39830:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryParse=void 0;const n=r(90412);class i extends n.Actor{constructor(e){super(e)}}t.ActorQueryParse=i},92180:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(39830),t)},74871:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryResultSerialize=void 0;const n=r(48092);class i extends n.ActorAbstractMediaTyped{constructor(e){super(e)}}t.ActorQueryResultSerialize=i},33152:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorQueryResultSerializeFixedMediaTypes=void 0;const n=r(48092);class i extends n.ActorAbstractMediaTypedFixed{constructor(e){super(e)}async testHandleChecked(e,t){return!0}}t.ActorQueryResultSerializeFixedMediaTypes=i},58871:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(74871),t),i(r(33152),t)},39582:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfJoinEntriesSort=void 0;const n=r(90412);class i extends n.Actor{constructor(e){super(e)}}t.ActorRdfJoinEntriesSort=i},39195:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(39582),t)},4945:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfJoinSelectivity=void 0;const n=r(90412);class i extends n.Actor{constructor(e){super(e)}}t.ActorRdfJoinSelectivity=i},95705:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(4945),t)},57042:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfJoin=void 0;const n=r(66490),i=r(90711),a=r(90412),o=r(82590),s=r(47793),u=r(43347),c=new s.DataFactory;class l extends a.Actor{constructor(e,t){super(e),this.includeInLogs=!0,this.logicalType=t.logicalType,this.physicalName=t.physicalName,this.limitEntries=t.limitEntries??Number.POSITIVE_INFINITY,this.limitEntriesMin=t.limitEntriesMin??!1,this.canHandleUndefs=t.canHandleUndefs??!1}static hash(e,t){return t.filter((t=>e.has(t))).map((t=>(0,u.termToString)(e.get(t)))).join("")}static overlappingVariables(e){const t=e.map((e=>e.variables));let r=t[0];for(const e of t.slice(1))r=r.filter((t=>e.some((e=>e.value===t.value))));return r}static joinVariables(e){return[...new Set(e.flatMap((e=>e.variables.map((e=>e.value)))))].map((e=>c.variable(e)))}static joinBindings(...e){if(0===e.length)return null;if(1===e.length)return e[0];let t=e[0];for(const r of e.slice(1)){const e=t.merge(r);if(!e)return null;t=e}return t}static getCardinality(e){return e.cardinality}static async getMetadatas(e){return await Promise.all(e.map((e=>e.output.metadata())))}static async getEntriesWithMetadatas(e){const t=await l.getMetadatas(e);return e.map(((e,r)=>({...e,metadata:t[r]})))}static getRequestInitialTimes(e){return e.map((e=>e.pageSize?0:e.requestTime||0))}static getRequestItemTimes(e){return e.map((e=>e.pageSize?(e.requestTime||0)/e.pageSize:0))}async constructResultMetadata(e,t,r,n={}){let i;n.cardinality?i=n.cardinality:(i=t.reduce(((e,t)=>{const r=l.getCardinality(t);return{type:"estimate"===r.type?"estimate":e.type,value:e.value*r.value}}),{type:"exact",value:1}),i.value*=(await this.mediatorJoinSelectivity.mediate({entries:e,context:r})).selectivity);const a=new o.MetadataValidationState,s=()=>a.invalidate();for(const e of t)e.state.addInvalidateListener(s);return{state:a,...n,cardinality:{type:i.type,value:i.value},canContainUndefs:n.canContainUndefs??t.some((e=>e.canContainUndefs)),variables:l.joinVariables(t)}}async test(e){if(e.type!==this.logicalType)throw new Error(`${this.name} can only handle logical joins of type '${this.logicalType}', while '${e.type}' was given.`);if(e.entries.length<=1)throw new Error(`${this.name} requires at least two join entries.`);if(this.limitEntriesMin?e.entries.lengththis.limitEntries)throw new Error(`${this.name} requires ${this.limitEntries} join entries at ${this.limitEntriesMin?"least":"most"}. The input contained ${e.entries.length}.`);for(const t of e.entries)if("bindings"!==t.output.type)throw new Error(`Invalid type of a join entry: Expected 'bindings' but got '${t.output.type}'`);const t=await l.getMetadatas(e.entries);if(!this.canHandleUndefs)for(const e of t)if(e.canContainUndefs)throw new Error(`Actor ${this.name} can not join streams containing undefs`);return await this.getJoinCoefficients(e,t)}async run(e){let t;e.context.has(i.KeysInitQuery.physicalQueryPlanLogger)&&(t=e.context.get(i.KeysInitQuery.physicalQueryPlanNode),e.context=e.context.set(i.KeysInitQuery.physicalQueryPlanNode,e));const r=e.context.get(i.KeysInitQuery.physicalQueryPlanLogger);let a;this.includeInLogs&&r&&(a={},r.logOperation(`join-${this.logicalType}`,this.physicalName,e,t,this.name,a));const{result:o,physicalPlanMetadata:s}=await this.getOutput(e),u=await l.getMetadatas(e.entries);return a&&(Object.assign(a,s),a.cardinalities=u.map(l.getCardinality),a.joinCoefficients=await this.getJoinCoefficients(e,u)),o.metadata=n.ActorQueryOperation.cachifyMetadata(o.metadata),o}}t.ActorRdfJoin=l},95445:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(57042),t)},12957:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfMetadataAccumulate=void 0;const n=r(90412);class i extends n.Actor{constructor(e){super(e)}}t.ActorRdfMetadataAccumulate=i},50433:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(12957),t)},19792:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfResolveQuadPattern=void 0;const n=r(90412);class i extends n.Actor{constructor(e){super(e)}}t.ActorRdfResolveQuadPattern=i},38177:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfResolveQuadPatternSource=void 0;const n=r(19792);class i extends n.ActorRdfResolveQuadPattern{constructor(e){super(e)}async test(e){return!0}async run(e){const t=await this.getSource(e.context,e.pattern);return await this.getOutput(t,e.pattern,e.context)}async getOutput(e,t,r){return{data:e.match(t.subject,t.predicate,t.object,t.graph,r)}}}t.ActorRdfResolveQuadPatternSource=i},61394:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(19792),t),i(r(38177),t),i(r(27411),t)},27411:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hasContextSingleSourceOfType=t.hasContextSingleSource=t.getContextSourceUrl=t.getContextSourceFirst=t.getContextSource=t.getContextSources=t.getDataSourceContext=t.getDataSourceValue=t.getDataSourceType=t.isDataSourceRawType=void 0;const n=r(90711),i=r(90412);function a(e){return"string"==typeof e||"match"in e}function o(e){return"string"==typeof e?"":"match"in e?"rdfjsSource":e.type}function s(e){return a(e)?e:e.value}function u(e){return e.get(n.KeysRdfResolveQuadPattern.source)}t.isDataSourceRawType=a,t.getDataSourceType=o,t.getDataSourceValue=s,t.getDataSourceContext=function(e,t){return a(e)||!e.context?t:t.merge(i.ActionContext.ensureActionContext(e.context))},t.getContextSources=function(e){return e.get(n.KeysRdfResolveQuadPattern.sources)},t.getContextSource=u,t.getContextSourceFirst=function(e){if(e.has(n.KeysRdfResolveQuadPattern.source))return e.get(n.KeysRdfResolveQuadPattern.source);const t=e.get(n.KeysRdfResolveQuadPattern.sources);return 1===t?.length?t[0]:void 0},t.getContextSourceUrl=function(e){if(e){let t=s(e);if("string"==typeof t){const e=t.indexOf("#");return e>=0&&(t=t.slice(0,e)),t}}},t.hasContextSingleSource=function(e){const t=u(e);return Boolean(t&&(a(t)||t.value))},t.hasContextSingleSourceOfType=function(e,t){const r=u(t);return Boolean(r&&o(r)===e&&s(r))}},17538:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfSerialize=void 0;const n=r(48092);class i extends n.ActorAbstractMediaTyped{constructor(e){super(e)}}t.ActorRdfSerialize=i},9527:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfSerializeFixedMediaTypes=void 0;const n=r(48092);class i extends n.ActorAbstractMediaTypedFixed{constructor(e){super(e)}async testHandleChecked(e){return!0}}t.ActorRdfSerializeFixedMediaTypes=i},81261:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(17538),t),i(r(9527),t)},38291:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfUpdateQuads=void 0;const n=r(90412);class i extends n.Actor{constructor(e){super(e)}}t.ActorRdfUpdateQuads=i},85459:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActorRdfUpdateQuadsDestination=t.deskolemize=t.deskolemizeStream=void 0;const n=r(40810),i=r(90711),a=r(38291);function o(e,t){return e?.map((e=>n.FederatedQuadSource.deskolemizeQuad(e,t)))}function s(e){const t=e.context.get(i.KeysRdfUpdateQuads.destination),r=e.context.get(i.KeysRdfResolveQuadPattern.sourceIds)?.get(t);return r?{...e,quadStreamInsert:o(e.quadStreamInsert,r),quadStreamDelete:o(e.quadStreamDelete,r)}:e}t.deskolemizeStream=o,t.deskolemize=s;class u extends a.ActorRdfUpdateQuads{async test(e){return!0}async run(e){const t=await this.getDestination(e.context);return await this.getOutput(t,s(e),e.context)}async getOutput(e,t,r){return{execute:()=>Promise.all([t.quadStreamInsert?e.insert(t.quadStreamInsert):Promise.resolve(),t.quadStreamDelete?e.delete(t.quadStreamDelete):Promise.resolve(),t.deleteGraphs?e.deleteGraphs(t.deleteGraphs.graphs,t.deleteGraphs.requireExistence,t.deleteGraphs.dropGraphs):Promise.resolve(),t.createGraphs?e.createGraphs(t.createGraphs.graphs,t.createGraphs.requireNonExistence):Promise.resolve()]).then((()=>{}))}}}t.ActorRdfUpdateQuadsDestination=u},41937:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateHttpResponse=void 0;const n=r(70322),i=r(43789);t.validateHttpResponse=async function(e,t){if(t.status>=400){let r="empty response";if(t.body){const e=n.ActorHttp.toNodeReadable(t.body);r=await i(e)}throw new Error(`Could not update ${e} (HTTP status ${t.status}):\n${r}`)}await(t.body?.cancel())}},16657:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(38291),t),i(r(85459),t),i(r(41937),t),i(r(52604),t)},52604:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getContextDestinationUrl=t.getContextDestinationFirst=t.getContextDestination=t.getDataDestinationContext=t.getDataDestinationValue=t.getDataDestinationType=t.isDataDestinationRawType=void 0;const n=r(90711);function i(e){return"string"==typeof e||"remove"in e}function a(e){return i(e)?e:e.value}t.isDataDestinationRawType=i,t.getDataDestinationType=function(e){return"string"==typeof e?"":"remove"in e?"rdfjsStore":e.type},t.getDataDestinationValue=a,t.getDataDestinationContext=function(e,t){return"string"==typeof e||"remove"in e||!e.context?t:t.merge(e.context)},t.getContextDestination=function(e){return e.get(n.KeysRdfUpdateQuads.destination)},t.getContextDestinationFirst=function(e){if(e.has(n.KeysRdfUpdateQuads.destination))return e.get(n.KeysRdfUpdateQuads.destination)},t.getContextDestinationUrl=function(e){if(e){let t=a(e);if("string"==typeof t){const e=t.indexOf("#");return e>=0&&(t=t.slice(0,e)),t}}}},19039:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KeysRdfUpdateQuads=t.KeysRdfResolveQuadPattern=t.KeysRdfParseHtmlScript=t.KeysRdfParseJsonLd=t.KeysQueryOperation=t.KeysInitQuery=t.KeysHttpProxy=t.KeysHttpMemento=t.KeysHttpWayback=t.KeysHttp=t.KeysCore=void 0;const n=r(90412);t.KeysCore={log:n.CONTEXT_KEY_LOGGER},t.KeysHttp={includeCredentials:new n.ActionContextKey("@comunica/bus-http:include-credentials"),auth:new n.ActionContextKey("@comunica/bus-http:auth"),fetch:new n.ActionContextKey("@comunica/bus-http:fetch"),httpTimeout:new n.ActionContextKey("@comunica/bus-http:http-timeout"),httpBodyTimeout:new n.ActionContextKey("@comunica/bus-http:http-body-timeout"),httpRetryCount:new n.ActionContextKey("@comunica/bus-http:http-retry-count"),httpRetryDelay:new n.ActionContextKey("@comunica/bus-http:http-retry-delay"),httpRetryOnServerError:new n.ActionContextKey("@comunica/bus-http:http-retry-on-server-error")},t.KeysHttpWayback={recoverBrokenLinks:new n.ActionContextKey("@comunica/bus-http:recover-broken-links")},t.KeysHttpMemento={datetime:new n.ActionContextKey("@comunica/actor-http-memento:datetime")},t.KeysHttpProxy={httpProxyHandler:new n.ActionContextKey("@comunica/actor-http-proxy:httpProxyHandler")},t.KeysInitQuery={initialBindings:new n.ActionContextKey("@comunica/actor-init-query:initialBindings"),queryFormat:new n.ActionContextKey("@comunica/actor-init-query:queryFormat"),graphqlSingularizeVariables:new n.ActionContextKey("@comunica/actor-init-query:singularizeVariables"),lenient:new n.ActionContextKey("@comunica/actor-init-query:lenient"),queryString:new n.ActionContextKey("@comunica/actor-init-query:queryString"),query:new n.ActionContextKey("@comunica/actor-init-query:query"),baseIRI:new n.ActionContextKey("@comunica/actor-init-query:baseIRI"),functionArgumentsCache:new n.ActionContextKey("@comunica/actor-init-query:functionArgumentsCache"),queryTimestamp:new n.ActionContextKey("@comunica/actor-init-query:queryTimestamp"),extensionFunctionCreator:new n.ActionContextKey("@comunica/actor-init-query:extensionFunctionCreator"),extensionFunctions:new n.ActionContextKey("@comunica/actor-init-query:extensionFunctions"),cliArgsHandlers:new n.ActionContextKey("@comunica/actor-init-query:cliArgsHandlers"),explain:new n.ActionContextKey("@comunica/actor-init-query:explain"),physicalQueryPlanLogger:new n.ActionContextKey("@comunica/actor-init-query:physicalQueryPlanLogger"),physicalQueryPlanNode:new n.ActionContextKey("@comunica/actor-init-query:physicalQueryPlanNode"),jsonLdContext:new n.ActionContextKey("@context")},t.KeysQueryOperation={operation:new n.ActionContextKey("@comunica/bus-query-operation:operation"),joinLeftMetadata:new n.ActionContextKey("@comunica/bus-query-operation:joinLeftMetadata"),joinRightMetadatas:new n.ActionContextKey("@comunica/bus-query-operation:joinRightMetadatas"),joinBindings:new n.ActionContextKey("@comunica/bus-query-operation:joinBindings"),readOnly:new n.ActionContextKey("@comunica/bus-query-operation:readOnly"),isPathArbitraryLengthDistinctKey:new n.ActionContextKey("@comunica/bus-query-operation:isPathArbitraryLengthDistinct"),limitIndicator:new n.ActionContextKey("@comunica/bus-query-operation:limitIndicator"),unionDefaultGraph:new n.ActionContextKey("@comunica/bus-query-operation:unionDefaultGraph")},t.KeysRdfParseJsonLd={documentLoader:new n.ActionContextKey("@comunica/actor-rdf-parse-jsonld:documentLoader"),strictValues:new n.ActionContextKey("@comunica/actor-rdf-parse-jsonld:strictValues"),parserOptions:new n.ActionContextKey("@comunica/actor-rdf-parse-jsonld:parserOptions")},t.KeysRdfParseHtmlScript={processingHtmlScript:new n.ActionContextKey("@comunica/actor-rdf-parse-html-script:processingHtmlScript"),extractAllScripts:new n.ActionContextKey("extractAllScripts")},t.KeysRdfResolveQuadPattern={sources:new n.ActionContextKey("@comunica/bus-rdf-resolve-quad-pattern:sources"),source:new n.ActionContextKey("@comunica/bus-rdf-resolve-quad-pattern:source"),sourceIds:new n.ActionContextKey("@comunica/bus-rdf-resolve-quad-pattern:sourceIds"),hypermediaSourcesAggregatedStores:new n.ActionContextKey("@comunica/bus-rdf-resolve-quad-pattern:hypermediaSourcesAggregatedStores")},t.KeysRdfUpdateQuads={destination:new n.ActionContextKey("@comunica/bus-rdf-update-quads:destination")}},90711:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(19039),t)},94301:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActionContextKey=t.ActionContext=void 0;const n=r(49568);class i{constructor(e={}){this.map=(0,n.Map)(e)}setDefault(e,t){return this.has(e)?this:this.set(e,t)}set(e,t){return this.setRaw(e.name,t)}setRaw(e,t){return new i(this.map.set(e,t))}delete(e){return new i(this.map.delete(e.name))}get(e){return this.getRaw(e.name)}getRaw(e){return this.map.get(e)}getSafe(e){if(!this.has(e))throw new Error(`Context entry ${e.name} is required but not available`);return this.get(e)}has(e){return this.hasRaw(e.name)}hasRaw(e){return this.map.has(e)}merge(...e){let t=this;for(const r of e)for(const e of r.keys())t=t.set(e,r.get(e));return t}keys(){return[...this.map.keys()].map((e=>new a(e)))}toJS(){return this.map.toJS()}toString(){return`ActionContext(${JSON.stringify(this.map.toJS())})`}[Symbol.for("nodejs.util.inspect.custom")](){return`ActionContext(${JSON.stringify(this.map.toJS(),null," ")})`}static ensureActionContext(e){return e instanceof i?e:new i((0,n.Map)(e||{}))}}t.ActionContext=i;class a{constructor(e){this.name=e}}t.ActionContextKey=a},61782:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ActionObserver=void 0,t.ActionObserver=class{constructor(e){Object.assign(this,e)}}},681:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Actor=void 0;const n=r(84983);class i{constructor(e){this.beforeActors=[],Object.assign(this,e),this.bus.subscribe(this),this.beforeActors.length>0&&this.bus.addDependencies(this,this.beforeActors)}static getContextLogger(e){return e.get(n.CONTEXT_KEY_LOGGER)}runObservable(e){const t=this.run(e);return this.bus.onRun(this,e,t),t}async initialize(){return!0}async deinitialize(){return!0}getDefaultLogData(e,t){const r=t?t():{};return r.actor=this.name,r}logTrace(e,t,r){const n=i.getContextLogger(e);n&&n.trace(t,this.getDefaultLogData(e,r))}logDebug(e,t,r){const n=i.getContextLogger(e);n&&n.debug(t,this.getDefaultLogData(e,r))}logInfo(e,t,r){const n=i.getContextLogger(e);n&&n.info(t,this.getDefaultLogData(e,r))}logWarn(e,t,r){const n=i.getContextLogger(e);n&&n.warn(t,this.getDefaultLogData(e,r))}logError(e,t,r){const n=i.getContextLogger(e);n&&n.error(t,this.getDefaultLogData(e,r))}logFatal(e,t,r){const n=i.getContextLogger(e);n&&n.fatal(t,this.getDefaultLogData(e,r))}}t.Actor=i},92126:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Bus=void 0,t.Bus=class{constructor(e){this.actors=[],this.observers=[],this.dependencyLinks=new Map,Object.assign(this,e)}subscribe(e){this.actors.push(e),this.reorderForDependencies()}subscribeObserver(e){this.observers.push(e)}unsubscribe(e){const t=this.actors.indexOf(e);return t>=0&&(this.actors.splice(t,1),!0)}unsubscribeObserver(e){const t=this.observers.indexOf(e);return t>=0&&(this.observers.splice(t,1),!0)}publish(e){return this.actors.map((t=>({actor:t,reply:t.test(e)})))}onRun(e,t,r){for(const n of this.observers)n.onRun(e,t,r)}addDependencies(e,t){for(const r of t){let t=this.dependencyLinks.get(r);t||(t=[],this.dependencyLinks.set(r,t)),t.push(e)}this.reorderForDependencies()}reorderForDependencies(){if(this.dependencyLinks.size>0){const e=[];for(const t of this.dependencyLinks.keys()){const r=this.actors.indexOf(t);r>=0&&(this.actors.splice(r,1),e.push(t))}for(;e.length>0;){let t=-1;for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BusIndexed=void 0;const n=r(92126);class i extends n.Bus{constructor(e){super(e),this.actorsIndex={}}subscribe(e){const t=this.getActorIdentifier(e)||"_undefined_";let r=this.actorsIndex[t];r||(r=this.actorsIndex[t]=[]),r.push(e),super.subscribe(e)}unsubscribe(e){const t=this.getActorIdentifier(e)||"_undefined_",r=this.actorsIndex[t];if(r){const n=r.indexOf(e);n>=0&&r.splice(n,1),0===r.length&&delete this.actorsIndex[t]}return super.unsubscribe(e)}publish(e){const t=this.getActionIdentifier(e);return t?[...this.actorsIndex[t]||[],...this.actorsIndex._undefined_||[]].map((t=>({actor:t,reply:t.test(e)}))):super.publish(e)}getActorIdentifier(e){return this.actorIdentifierFields.reduce(((e,t)=>e[t]),e)}getActionIdentifier(e){return this.actionIdentifierFields.reduce(((e,t)=>e[t]),e)}}t.BusIndexed=i},84983:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CONTEXT_KEY_LOGGER=void 0;const n=r(94301);t.CONTEXT_KEY_LOGGER=new n.ActionContextKey("@comunica/core:log")},65991:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Mediator=void 0,t.Mediator=class{constructor(e){Object.assign(this,e)}publish(e){const t=this.bus.publish(e);if(0===t.length)throw new Error(`No actors are able to reply to a message in the bus ${this.bus.name}`);return t}async mediateActor(e){return await this.mediateWith(e,this.publish(e))}async mediate(e){return(await this.mediateActor(e)).runObservable(e)}}},90412:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.Logger=void 0;const a=r(42996).Logger;t.Logger=a,i(r(94301),t),i(r(92126),t),i(r(2437),t),i(r(84983),t),i(r(61782),t),i(r(681),t),i(r(65991),t)},63704:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BlankNodeBindingsScoped=void 0,t.BlankNodeBindingsScoped=class{constructor(e){this.termType="BlankNode",this.singleBindingsScope=!0,this.value=e}equals(e){return!!e&&"BlankNode"===e.termType&&e.value===this.value}}},84018:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BlankNodeScoped=void 0,t.BlankNodeScoped=class{constructor(e,t){this.termType="BlankNode",this.value=e,this.skolemized=t}equals(e){return!!e&&"BlankNode"===e.termType&&e.value===this.value}}},16400:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(84018),t),i(r(63704),t)},35915:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Aggregator=t.AggregatorComponent=void 0;const n=r(43347),i=r(22255),a=r(98644),o=r(29041);t.AggregatorComponent=class{static emptyValue(){}constructor(e,t){this.sharedContext=t,this.separator=e.separator||" ",this.termTransformer=new i.TermTransformer(t.superTypeProvider)}termToNumericOrError(e){if("Literal"!==e.termType)throw new Error(`Term with value ${e.value} has type ${e.termType} and is not a numeric literal`);if(!(0,o.isSubTypeOf)(e.datatype.value,a.TypeAlias.SPARQL_NUMERIC,this.sharedContext.superTypeProvider))throw new Error(`Term datatype ${e.datatype.value} with value ${e.value} has type ${e.termType} and is not a numeric literal`);return this.termTransformer.transformLiteral(e)}},t.Aggregator=class{constructor(e,t){this.aggregatorComponent=t,this.variableValues=new Map,this.distinct=e.distinct}static emptyValue(e){return e.emptyValue()}result(){return this.aggregatorComponent.result()}put(e,t=""){this.canSkip(e,t)||(this.aggregatorComponent.put(e),this.addSeen(e,t))}canSkip(e,t){const r=this.variableValues.get(t);return this.distinct&&void 0!==r&&r.has(n.termToString(e))}addSeen(e,t){this.distinct&&(this.variableValues.has(t)||this.variableValues.set(t,new Set),this.variableValues.get(t).add(n.termToString(e)))}}},84711:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Average=void 0;const n=r(4417),i=r(5987),a=r(69026),o=r(98644),s=r(35915);class u extends s.AggregatorComponent{constructor(){super(...arguments),this.summer=i.regularFunctions[o.RegularOperator.ADDITION],this.divider=i.regularFunctions[o.RegularOperator.DIVISION],this.state=void 0}static emptyValue(){return(0,a.integer)(0).toRDF()}put(e){if(void 0===this.state){const t=this.termToNumericOrError(e);this.state={sum:t,count:1}}else{const t=this.termToNumericOrError(e);this.state.sum=this.summer.apply([this.state.sum,t],this.sharedContext),this.state.count++}}result(){if(void 0===this.state)return u.emptyValue();const e=new n.IntegerLiteral(this.state.count);return this.divider.apply([this.state.sum,e],this.sharedContext).toRDF()}}t.Average=u},61531:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Count=void 0;const n=r(69026),i=r(35915);class a extends i.AggregatorComponent{constructor(){super(...arguments),this.state=void 0}static emptyValue(){return(0,n.integer)(0).toRDF()}put(e){void 0===this.state&&(this.state=0),this.state++}result(){return void 0===this.state?a.emptyValue():(0,n.integer)(this.state).toRDF()}}t.Count=a},94739:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GroupConcat=void 0;const n=r(69026),i=r(35915);class a extends i.AggregatorComponent{constructor(){super(...arguments),this.state=void 0}static emptyValue(){return(0,n.string)("").toRDF()}put(e){void 0===this.state?this.state=e.value:this.state+=this.separator+e.value}result(){return void 0===this.state?a.emptyValue():(0,n.string)(this.state).toRDF()}}t.GroupConcat=a},88538:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Max=void 0;const n=r(7664),i=r(35915);class a extends i.AggregatorComponent{constructor(){super(...arguments),this.state=void 0}put(e){if("Literal"!==e.termType)throw new Error(`Term with value ${e.value} has type ${e.termType} and is not a literal`);(void 0===this.state||-1===(0,n.orderTypes)(this.state,e))&&(this.state=e)}result(){return void 0===this.state?a.emptyValue():this.state}}t.Max=a},51476:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Min=void 0;const n=r(7664),i=r(35915);class a extends i.AggregatorComponent{constructor(){super(...arguments),this.state=void 0}put(e){if("Literal"!==e.termType)throw new Error(`Term with value ${e.value} has type ${e.termType} and is not a literal`);(void 0===this.state||1===(0,n.orderTypes)(this.state,e))&&(this.state=e)}result(){return void 0===this.state?a.emptyValue():this.state}}t.Min=a},95556:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sample=void 0;const n=r(35915);class i extends n.AggregatorComponent{constructor(){super(...arguments),this.state=void 0}put(e){void 0===this.state&&(this.state=e)}result(){return void 0===this.state?i.emptyValue():this.state}}t.Sample=i},4199:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Sum=void 0;const n=r(5987),i=r(69026),a=r(98644),o=r(35915);class s extends o.AggregatorComponent{constructor(){super(...arguments),this.state=void 0,this.summer=n.regularFunctions[a.RegularOperator.ADDITION]}static emptyValue(){return(0,i.integer)(0).toRDF()}put(e){if(void 0===this.state)this.state=this.termToNumericOrError(e);else{const t=this.termToNumericOrError(e);this.state=this.summer.apply([this.state,t],this.sharedContext)}}result(){return void 0===this.state?s.emptyValue():this.state.toRDF()}}t.Sum=s},27460:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WildcardCountAggregator=void 0;const n=r(43347),i=r(69026);t.WildcardCountAggregator=class{constructor(e){this.bindingValues=new Map,this.counter=0,this.distinct=e.distinct}putBindings(e){this.handleDistinct(e)||(this.counter+=1)}static emptyValue(){return(0,i.integer)(0).toRDF()}result(){return(0,i.integer)(this.counter).toRDF()}handleDistinct(e){if(this.distinct){const t=[...e];t.sort(((e,t)=>e[0].value.localeCompare(t[0].value)));const r=t.map((([e])=>e.value)).join(","),i=t.map((([,e])=>n.termToString(e))).join(","),a=this.bindingValues.get(r),o=void 0!==a&&a.has(i);return a||this.bindingValues.set(r,new Set),this.bindingValues.get(r).add(i),o}return!1}}},45080:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.aggregators=void 0;const n=r(84711),i=r(61531),a=r(94739),o=r(88538),s=r(51476),u=r(95556),c=r(4199);t.aggregators={count:i.Count,sum:c.Sum,min:s.Min,max:o.Max,avg:n.Average,group_concat:a.GroupConcat,sample:u.Sample}},87722:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AggregateEvaluator=void 0;const n=r(26802),i=r(25120);class a extends n.BaseAggregateEvaluator{constructor(e,t,r){super(e,i.SyncEvaluator.completeContext(t||{}),r),this.evaluator=new i.SyncEvaluator(e.expression,t)}put(e){if(!this.errorOccurred)if(this.isWildcard)this.wildcardAggregator.putBindings(e);else try{const t=this.evaluator.evaluate(e);this.aggregator.put(t)}catch(e){this.safeThrow(e)}}safeThrow(e){if(this.throwError)throw e;this.errorOccurred=!0}}t.AggregateEvaluator=a},7892:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncAggregateEvaluator=void 0;const n=r(78467),i=r(26802);class a extends i.BaseAggregateEvaluator{constructor(e,t,r){super(e,n.AsyncEvaluator.completeContext(t||{}),r),this.evaluator=new n.AsyncEvaluator(e.expression,t),this.errorOccurred=!1}async put(e){if(!this.errorOccurred)if(this.isWildcard)this.wildcardAggregator.putBindings(e);else try{const t=await this.evaluator.evaluate(e);if(!t||this.errorOccurred)return;this.aggregator.put(t)}catch(e){this.safeThrow(e)}}safeThrow(e){if(this.throwError)throw e;this.errorOccurred=!0}}t.AsyncAggregateEvaluator=a},78467:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncEvaluator=void 0;const n=r(89096),i=r(52283),a=r(26832),o=r(96034);class s{static completeContext(e){const t=e.now||new Date(Date.now());return{now:t,baseIRI:e.baseIRI||void 0,functionArgumentsCache:e.functionArgumentsCache||{},superTypeProvider:{cache:e.typeCache||new n.LRUCache({max:1e3}),discoverer:e.getSuperType||(()=>"term")},extensionFunctionCreator:e.extensionFunctionCreator,exists:e.exists,aggregate:e.aggregate,bnode:e.bnode,defaultTimeZone:e.defaultTimeZone||(0,a.extractTimeZone)(t)}}constructor(e,t={}){this.algExpr=e;const r=t.extensionFunctionCreator||(()=>{}),n=s.completeContext(t),a=new i.AlgebraTransformer({type:"async",creator:r,...n});this.expr=a.transformAlgebra(e),this.evaluator=new o.AsyncRecursiveEvaluator(n,a)}async evaluate(e){return(await this.evaluator.evaluate(this.expr,e)).toRDF()}async evaluateAsEBV(e){return(await this.evaluator.evaluate(this.expr,e)).coerceEBV()}async evaluateAsInternal(e){return await this.evaluator.evaluate(this.expr,e)}}t.AsyncEvaluator=s},25120:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SyncEvaluator=void 0;const n=r(89096),i=r(52283),a=r(26832),o=r(29373);class s{static completeContext(e){const t=e.now||new Date(Date.now());return{now:t,baseIRI:e.baseIRI||void 0,functionArgumentsCache:e.functionArgumentsCache||{},superTypeProvider:{cache:e.typeCache||new n.LRUCache({max:1e3}),discoverer:e.getSuperType||(()=>"term")},extensionFunctionCreator:e.extensionFunctionCreator,exists:e.exists,aggregate:e.aggregate,bnode:e.bnode,defaultTimeZone:e.defaultTimeZone||(0,a.extractTimeZone)(t)}}constructor(e,t={}){this.algExpr=e,this.context=t;const r=t.extensionFunctionCreator||(()=>{}),n=s.completeContext(t),a=new i.AlgebraTransformer({type:"sync",creator:r,...n});this.expr=a.transformAlgebra(e),this.evaluator=new o.SyncRecursiveEvaluator(n,a)}evaluate(e){return this.evaluator.evaluate(this.expr,e).toRDF()}evaluateAsEBV(e){return this.evaluator.evaluate(this.expr,e).coerceEBV()}evaluateAsInternal(e){return this.evaluator.evaluate(this.expr,e)}}t.SyncEvaluator=s},96034:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncRecursiveEvaluator=void 0;const n=r(4417),i=r(22255),a=r(4415),o=r(52519);class s extends o.BaseExpressionEvaluator{constructor(e,t){super(t||new i.TermTransformer(e.superTypeProvider)),this.context=e,this.subEvaluators={[n.ExpressionType.Term]:this.term.bind(this),[n.ExpressionType.Variable]:this.variable.bind(this),[n.ExpressionType.Operator]:this.evalOperator.bind(this),[n.ExpressionType.SpecialOperator]:this.evalSpecialOperator.bind(this),[n.ExpressionType.Named]:this.evalNamed.bind(this),[n.ExpressionType.Existence]:this.evalExistence.bind(this),[n.ExpressionType.Aggregate]:this.evalAggregate.bind(this),[n.ExpressionType.AsyncExtension]:this.evalAsyncExtension.bind(this)}}async evaluate(e,t){const r=this.subEvaluators[e.expressionType];if(!r)throw new a.InvalidExpressionType(e);return r.bind(this)(e,t)}async evalOperator(e,t){const r=e.args.map((e=>this.evaluate(e,t))),n=await Promise.all(r);return e.apply(n)}async evalSpecialOperator(e,t){const r=this.evaluate.bind(this),n={args:e.args,mapping:t,superTypeProvider:this.context.superTypeProvider,now:this.context.now,baseIRI:this.context.baseIRI,functionArgumentsCache:this.context.functionArgumentsCache,evaluate:r,bnode:this.context.bnode,defaultTimeZone:this.context.defaultTimeZone};return e.applyAsync(n)}async _evalAsyncArgs(e,t){const r=e.map((e=>this.evaluate(e,t)));return await Promise.all(r)}async evalNamed(e,t){return e.apply(await this._evalAsyncArgs(e.args,t))}async evalAsyncExtension(e,t){return await e.apply(await this._evalAsyncArgs(e.args,t))}async evalExistence(e,t){if(!this.context.exists)throw new a.NoExistenceHook;return new n.BooleanLiteral(await this.context.exists(e.expression,t))}async evalAggregate(e,t){if(!this.context.aggregate)throw new a.NoAggregator;return this.termTransformer.transformRDFTermUnsafe(await this.context.aggregate(e.expression))}}t.AsyncRecursiveEvaluator=s},26802:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseAggregateEvaluator=void 0;const n=r(96331),i=r(45080),a=r(35915),o=r(27460),s=r(4415);t.BaseAggregateEvaluator=class{constructor(e,t,r){this.throwError=!1,this.isWildcard=!1,this.errorOccurred=!1,this.expression=e,this.aggregator=new a.Aggregator(e,new i.aggregators[e.aggregator](e,t)),this.throwError=r||!1,this.isWildcard=e.expression.expressionType===n.Algebra.expressionTypes.WILDCARD,this.isWildcard&&(this.wildcardAggregator=new o.WildcardCountAggregator(e))}static emptyValue(e,t=!1){let r;if(r=e.expression.expressionType===n.Algebra.expressionTypes.WILDCARD?o.WildcardCountAggregator.emptyValue():a.Aggregator.emptyValue(i.aggregators[e.aggregator]),void 0===r&&t)throw new s.EmptyAggregateError;return r}result(){if(!this.errorOccurred)return this.isWildcard?this.wildcardAggregator.result():this.aggregator.result()}}},52519:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseExpressionEvaluator=void 0;const n=r(69026),i=r(4415);t.BaseExpressionEvaluator=class{constructor(e){this.termTransformer=e}term(e,t){return e}variable(e,t){const r=t.get((0,n.expressionToVar)(e));if(!r)throw new i.UnboundVariableError(e.name,t);return this.termTransformer.transformRDFTermUnsafe(r)}}},29373:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SyncRecursiveEvaluator=void 0;const n=r(4417),i=r(22255),a=r(4415),o=r(52519);class s extends o.BaseExpressionEvaluator{constructor(e,t){super(t||new i.TermTransformer(e.superTypeProvider)),this.context=e,this.subEvaluators={[n.ExpressionType.Term]:this.term.bind(this),[n.ExpressionType.Variable]:this.variable.bind(this),[n.ExpressionType.Operator]:this.evalOperator.bind(this),[n.ExpressionType.SpecialOperator]:this.evalSpecialOperator.bind(this),[n.ExpressionType.Named]:this.evalNamed.bind(this),[n.ExpressionType.Existence]:this.evalExistence.bind(this),[n.ExpressionType.Aggregate]:this.evalAggregate.bind(this),[n.ExpressionType.SyncExtension]:this.evalSyncExtension.bind(this)}}evaluate(e,t){const r=this.subEvaluators[e.expressionType];if(!r)throw new a.InvalidExpressionType(e);return r.bind(this)(e,t)}evalOperator(e,t){const r=e.args.map((e=>this.evaluate(e,t)));return e.apply(r)}evalSpecialOperator(e,t){const r=this.evaluate.bind(this),n={args:e.args,mapping:t,superTypeProvider:this.context.superTypeProvider,now:this.context.now,baseIRI:this.context.baseIRI,functionArgumentsCache:this.context.functionArgumentsCache,evaluate:r,bnode:this.context.bnode,defaultTimeZone:this.context.defaultTimeZone};return e.applySynchronously(n)}evalNamed(e,t){const r=e.args.map((e=>this.evaluate(e,t)));return e.apply(r)}evalSyncExtension(e,t){const r=e.args.map((e=>this.evaluate(e,t)));return e.apply(r)}evalExistence(e,t){if(!this.context.exists)throw new a.NoExistenceHook;return new n.BooleanLiteral(this.context.exists(e.expression,t))}evalAggregate(e,t){if(!this.context.aggregate)throw new a.NoAggregator;return this.termTransformer.transformRDFTermUnsafe(this.context.aggregate(e.expression))}}t.SyncRecursiveEvaluator=s},59810:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Aggregate=void 0;const n=r(80058);t.Aggregate=class{constructor(e,t){this.name=e,this.expression=t,this.expressionType=n.ExpressionType.Aggregate}}},37623:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncExtension=void 0;const n=r(80058);t.AsyncExtension=class{constructor(e,t,r){this.name=e,this.args=t,this.apply=r,this.expressionType=n.ExpressionType.AsyncExtension}}},24133:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Existence=void 0;const n=r(80058);t.Existence=class{constructor(e){this.expression=e,this.expressionType=n.ExpressionType.Existence}}},80058:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.asTermType=t.ExpressionType=void 0,function(e){e.Aggregate="aggregate",e.Existence="existence",e.Named="named",e.Operator="operator",e.SpecialOperator="specialOperator",e.Term="term",e.Variable="variable",e.AsyncExtension="asyncExtension",e.SyncExtension="syncExtension"}(r||(t.ExpressionType=r={})),t.asTermType=function(e){if("namedNode"===e||"literal"===e||"blankNode"===e||"quad"===e)return e}},49036:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Named=void 0;const n=r(80058);t.Named=class{constructor(e,t,r){this.name=e,this.args=t,this.apply=r,this.expressionType=n.ExpressionType.Named}}},56309:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Operator=void 0;const n=r(80058);t.Operator=class{constructor(e,t){this.args=e,this.apply=t,this.expressionType=n.ExpressionType.Operator}}},22066:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SpecialOperator=void 0;const n=r(80058);t.SpecialOperator=class{constructor(e,t,r){this.args=e,this.applyAsync=t,this.applySynchronously=r,this.expressionType=n.ExpressionType.SpecialOperator}}},41969:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SyncExtension=void 0;const n=r(80058);t.SyncExtension=class{constructor(e,t,r){this.name=e,this.args=t,this.apply=r,this.expressionType=n.ExpressionType.SyncExtension}}},68623:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isNonLexicalLiteral=t.NonLexicalLiteral=t.YearMonthDurationLiteral=t.DayTimeDurationLiteral=t.DurationLiteral=t.DateLiteral=t.TimeLiteral=t.DateTimeLiteral=t.StringLiteral=t.LangStringLiteral=t.BooleanLiteral=t.DoubleLiteral=t.FloatLiteral=t.DecimalLiteral=t.IntegerLiteral=t.NumericLiteral=t.Literal=t.isLiteralTermExpression=t.Quad=t.BlankNode=t.NamedNode=t.Term=void 0;const n=r(47793),i=r(22255),a=r(98644),o=r(98644),s=r(4415),u=r(17734),c=r(29041),l=r(80058),d=new n.DataFactory;class h{constructor(){this.expressionType=l.ExpressionType.Term}str(){throw new s.InvalidArgumentTypes([this],a.RegularOperator.STR)}coerceEBV(){throw new s.EBVCoercionError(this)}}t.Term=h,t.NamedNode=class extends h{constructor(e){super(),this.value=e,this.termType="namedNode"}toRDF(){return d.namedNode(this.value)}str(){return this.value}},t.BlankNode=class extends h{constructor(e){super(),this.termType="blankNode",this.value="string"==typeof e?d.blankNode(e):e}toRDF(){return this.value}},t.Quad=class extends h{constructor(e,t){super(),this.termType="quad",this.transformer=new i.TermTransformer(t),this.valueTerm=e}toRDF(){return this.valueTerm}get subject(){return this.transformer.transformRDFTermUnsafe(this.RDFsubject)}get predicate(){return this.transformer.transformRDFTermUnsafe(this.RDFpredicate)}get object(){return this.transformer.transformRDFTermUnsafe(this.RDFobject)}get RDFsubject(){return this.toRDF().subject}get RDFpredicate(){return this.toRDF().predicate}get RDFobject(){return this.toRDF().object}},t.isLiteralTermExpression=function(e){if("literal"===e.termType)return e};class p extends h{constructor(e,t,r,n){super(),this.typedValue=e,this.dataType=t,this.strValue=r,this.language=n,this.termType="literal"}toRDF(){return d.literal(this.strValue||this.str(),this.language||d.namedNode(this.dataType))}str(){return this.strValue||this.typedValue.toString()}}t.Literal=p;class f extends p{constructor(e,t,r,n){super(e,t,r,n),this.typedValue=e,this.strValue=r,this.language=n}coerceEBV(){return Boolean(this.typedValue)}toRDF(){const e=super.toRDF();return Number.isFinite(this.typedValue)||(e.value=e.value.replace("Infinity","INF")),e}str(){return this.strValue||this.specificFormatter(this.typedValue)}}t.NumericLiteral=f,t.IntegerLiteral=class extends f{constructor(e,t,r,n){super(e,t||o.TypeURL.XSD_INTEGER,r,n),this.typedValue=e,this.strValue=r,this.language=n}specificFormatter(e){return e.toFixed(0)}},t.DecimalLiteral=class extends f{constructor(e,t,r,n){super(e,t||o.TypeURL.XSD_DECIMAL,r,n),this.typedValue=e,this.strValue=r,this.language=n}specificFormatter(e){return e.toString()}},t.FloatLiteral=class extends f{constructor(e,t,r,n){super(e,t||o.TypeURL.XSD_FLOAT,r,n),this.typedValue=e,this.strValue=r,this.language=n}specificFormatter(e){return e.toString()}},t.DoubleLiteral=class extends f{constructor(e,t,r,n){super(e,t||o.TypeURL.XSD_DOUBLE,r,n),this.typedValue=e,this.strValue=r,this.language=n}specificFormatter(e){if(!Number.isFinite(e))return e>0?"INF":e<0?"-INF":"NaN";const t=e.toExponential(),[r,n]=t.split("e"),i=n.replace(/\+/u,"");return`${r.includes(".")?r:`${r}.0`}E${i}`}},t.BooleanLiteral=class extends p{constructor(e,t,r){super(e,r||o.TypeURL.XSD_BOOLEAN,t),this.typedValue=e,this.strValue=t}coerceEBV(){return this.typedValue}},t.LangStringLiteral=class extends p{constructor(e,t,r){super(e,r||o.TypeURL.RDF_LANG_STRING,e,t),this.typedValue=e,this.language=t}coerceEBV(){return this.str().length>0}},t.StringLiteral=class extends p{constructor(e,t){super(e,t||o.TypeURL.XSD_STRING,e),this.typedValue=e}coerceEBV(){return this.str().length>0}},t.DateTimeLiteral=class extends p{constructor(e,t,r){super(e,r||o.TypeURL.XSD_DATE_TIME,t),this.typedValue=e,this.strValue=t}str(){return(0,u.serializeDateTime)(this.typedValue)}},t.TimeLiteral=class extends p{constructor(e,t,r){super(e,r||o.TypeURL.XSD_TIME,t),this.typedValue=e,this.strValue=t}str(){return(0,u.serializeTime)(this.typedValue)}},t.DateLiteral=class extends p{constructor(e,t,r){super(e,r||o.TypeURL.XSD_DATE,t),this.typedValue=e,this.strValue=t}str(){return(0,u.serializeDate)(this.typedValue)}};class y extends p{constructor(e,t,r){super(e,r||o.TypeURL.XSD_DURATION,t),this.typedValue=e,this.strValue=t}str(){return(0,u.serializeDuration)(this.typedValue)}}t.DurationLiteral=y,t.DayTimeDurationLiteral=class extends y{constructor(e,t,r){super(e,t,r||o.TypeURL.XSD_DAY_TIME_DURATION),this.typedValue=e,this.strValue=t}},t.YearMonthDurationLiteral=class extends p{constructor(e,t,r){super(e,r||o.TypeURL.XSD_YEAR_MONTH_DURATION,t),this.typedValue=e,this.strValue=t}str(){return(0,u.serializeDuration)(this.typedValue,"P0M")}};class g extends p{constructor(e,t,r,n,i){super({toString:()=>"undefined"},t,n,i),this.openWorldType=r}coerceEBV(){if((0,c.isSubTypeOf)(this.dataType,o.TypeURL.XSD_BOOLEAN,this.openWorldType)||(0,c.isSubTypeOf)(this.dataType,o.TypeAlias.SPARQL_NUMERIC,this.openWorldType))return!1;throw new s.EBVCoercionError(this)}toRDF(){return d.literal(this.str(),this.language||d.namedNode(this.dataType))}str(){return this.strValue||""}}t.NonLexicalLiteral=g,t.isNonLexicalLiteral=function(e){if(e instanceof g)return e}},89065:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Variable=void 0;const n=r(80058);t.Variable=class{constructor(e){this.expressionType=n.ExpressionType.Variable,this.name=e}}},4417:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(80058),t),i(r(89065),t),i(r(68623),t),i(r(56309),t),i(r(22066),t),i(r(49036),t),i(r(59810),t),i(r(24133),t),i(r(37623),t),i(r(41969),t)},28588:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SpecialFunction=t.NamedFunction=t.RegularFunction=t.BaseFunction=void 0;const n=r(4415);class i{constructor(e,t){this.operator=e,this.apply=(e,t)=>(this.monomorph(e,t.superTypeProvider,t.functionArgumentsCache)||this.handleInvalidTypes(e))(t)(e),this.arity=t.arity,this.overloads=t.overloads}monomorph(e,t,r){return this.overloads.search(e,t,r)}}t.BaseFunction=i,t.RegularFunction=class extends i{constructor(e,t){super(e,t),this.functionClass="regular"}handleInvalidTypes(e){throw new n.InvalidArgumentTypes(e,this.operator)}},t.NamedFunction=class extends i{constructor(e,t){super(e,t),this.functionClass="named"}handleInvalidTypes(e){throw new n.InvalidArgumentTypes(e,this.operator)}},t.SpecialFunction=class{constructor(e,t){var r;this.operator=e,this.functionClass="special",this.arity=t.arity,this.applySynchronously=t.applySynchronously,this.applyAsync=t.applyAsync,this.checkArity=t.checkArity||(r=this.arity,e=>r===Number.POSITIVE_INFINITY||e.length===r)}}},69026:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.expressionToVar=t.dateTime=t.langString=t.string=t.double=t.float=t.decimal=t.integer=t.bool=t.Builder=t.declare=void 0;const n=r(47793),i=r(4417),a=r(4417),o=r(98644),s=r(98644),u=r(4415),c=r(15553),l=new n.DataFactory;t.declare=function(e){return new d(e)};class d{constructor(e){this.overloadTree=new c.OverloadTree(e),this.collected=!1}collect(){if(this.collected)throw new Error("Builders can only be collected once!");return this.collected=!0,this.overloadTree}static wrapInvalidLexicalProtected(e){return t=>r=>(r.forEach(((e,t)=>{if(e instanceof a.NonLexicalLiteral)throw new u.InvalidLexicalForm(r[t].toRDF())})),e(t)(r))}set(e,t,r=!0){return this.overloadTree.addOverload(e,r?d.wrapInvalidLexicalProtected(t):t),this}copy({from:e,to:t}){const r=this.overloadTree.getImplementationExact(e);if(!r)throw new u.UnexpectedError("Tried to copy implementation, but types not found",{from:e,to:t});return this.set(t,r)}onUnary(e,t,r=!0){return this.set([e],(e=>([r])=>t(e)(r)),r)}onUnaryTyped(e,t,r=!0){return this.set([e],(e=>([r])=>t(e)(r.typedValue)),r)}onBinary(e,t,r=!0){return this.set(e,(e=>([r,n])=>t(e)(r,n)),r)}onBinaryTyped(e,t,r=!0){return this.set(e,(e=>([r,n])=>t(e)(r.typedValue,n.typedValue)),r)}onTernaryTyped(e,t,r=!0){return this.set(e,(e=>([r,n,i])=>t(e)(r.typedValue,n.typedValue,i.typedValue)),r)}onTernary(e,t,r=!0){return this.set(e,(e=>([r,n,i])=>t(e)(r,n,i)),r)}onQuaternaryTyped(e,t,r=!0){return this.set(e,(e=>([r,n,i,a])=>t(e)(r.typedValue,n.typedValue,i.typedValue,a.typedValue)),r)}onTerm1(e,t=!1){return this.set(["term"],(t=>([r])=>e(t)(r)),t)}onTerm3(e){return this.set(["term","term","term"],(t=>([r,n,i])=>e(t)(r,n,i)))}onQuad1(e){return this.set(["quad"],(t=>([r])=>e(t)(r)))}onLiteral1(e,t=!0){return this.set(["literal"],(t=>([r])=>e(t)(r)),t)}onBoolean1(e,t=!0){return this.set([o.TypeURL.XSD_BOOLEAN],(t=>([r])=>e(t)(r)),t)}onBoolean1Typed(e,t=!0){return this.set([o.TypeURL.XSD_BOOLEAN],(t=>([r])=>e(t)(r.typedValue)),t)}onString1(e,t=!0){return this.set([o.TypeURL.XSD_STRING],(t=>([r])=>e(t)(r)),t)}onString1Typed(e,t=!0){return this.set([o.TypeURL.XSD_STRING],(t=>([r])=>e(t)(r.typedValue)),t)}onLangString1(e,t=!0){return this.set([o.TypeURL.RDF_LANG_STRING],(t=>([r])=>e(t)(r)),t)}onStringly1(e,t=!0){return this.set([o.TypeAlias.SPARQL_STRINGLY],(t=>([r])=>e(t)(r)),t)}onStringly1Typed(e,t=!0){return this.set([o.TypeAlias.SPARQL_STRINGLY],(t=>([r])=>e(t)(r.typedValue)),t)}onNumeric1(e,t=!0){return this.set([o.TypeAlias.SPARQL_NUMERIC],(t=>([r])=>e(t)(r)),t)}onDateTime1(e,t=!0){return this.set([o.TypeURL.XSD_DATE_TIME],(t=>([r])=>e(t)(r)),t)}numericConverter(e,t=!0){const r=t=>r=>e(t)(r.typedValue);return this.onBinary([s.TypeURL.XSD_INTEGER],(e=>t=>p(r(e)(t))),t).onBinary([s.TypeURL.XSD_DECIMAL],(e=>t=>f(r(e)(t))),t).onBinary([s.TypeURL.XSD_FLOAT],(e=>t=>y(r(e)(t))),t).onBinary([s.TypeURL.XSD_DOUBLE],(e=>t=>g(r(e)(t))),t)}arithmetic(e,t=!0){const r=t=>(r,n)=>e(t)(r.typedValue,n.typedValue);return this.onBinary([s.TypeURL.XSD_INTEGER,s.TypeURL.XSD_INTEGER],(e=>(t,n)=>p(r(e)(t,n))),t).onBinary([s.TypeURL.XSD_DECIMAL,s.TypeURL.XSD_DECIMAL],(e=>(t,n)=>f(r(e)(t,n))),t).onBinary([s.TypeURL.XSD_FLOAT,s.TypeURL.XSD_FLOAT],(e=>(t,n)=>y(r(e)(t,n))),t).onBinary([s.TypeURL.XSD_DOUBLE,s.TypeURL.XSD_DOUBLE],(e=>(t,n)=>g(r(e)(t,n))),t)}numberTest(e){return this.numeric((t=>([r,n])=>h(e(t)(r.typedValue,n.typedValue))))}stringTest(e,t=!0){return this.set([o.TypeURL.XSD_STRING,o.TypeURL.XSD_STRING],(t=>([r,n])=>h(e(t)(r.typedValue,n.typedValue))),t)}booleanTest(e,t=!0){return this.set([o.TypeURL.XSD_BOOLEAN,o.TypeURL.XSD_BOOLEAN],(t=>([r,n])=>h(e(t)(r.typedValue,n.typedValue))),t)}dateTimeTest(e,t=!0){return this.set([o.TypeURL.XSD_DATE_TIME,o.TypeURL.XSD_DATE_TIME],(t=>([r,n])=>h(e(t)(r.typedValue,n.typedValue))),t)}numeric(e){return this.set([o.TypeAlias.SPARQL_NUMERIC,o.TypeAlias.SPARQL_NUMERIC],e)}}function h(e){return new i.BooleanLiteral(e)}function p(e){return new i.IntegerLiteral(e)}function f(e){return new i.DecimalLiteral(e)}function y(e){return new i.FloatLiteral(e)}function g(e){return new i.DoubleLiteral(e)}t.Builder=d,t.bool=h,t.integer=p,t.decimal=f,t.float=y,t.double=g,t.string=function(e){return new i.StringLiteral(e)},t.langString=function(e,t){return new i.LangStringLiteral(e,t)},t.dateTime=function(e,t){return new i.DateTimeLiteral(e,t)},t.expressionToVar=function(e){return l.variable(e.name.slice(1))}},96153:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.namedDefinitions=void 0;const n=r(4417),i=r(4417),a=r(98644),o=r(26832),s=r(4415),u=r(63658),c=r(69026),l={arity:1,overloads:(0,c.declare)(a.TypeURL.XSD_STRING).onNumeric1((()=>e=>(0,c.string)((0,c.float)(e.typedValue).str()))).onBoolean1Typed((()=>e=>(0,c.string)((0,c.bool)(e).str()))).onTerm1((()=>e=>(0,c.string)(e.str()))).collect()},d={arity:1,overloads:(0,c.declare)(a.TypeURL.XSD_FLOAT).onNumeric1((()=>e=>(0,c.float)(e.typedValue))).onBoolean1Typed((()=>e=>(0,c.float)(e?1:0))).onUnary(a.TypeURL.XSD_STRING,(()=>e=>{const t=(0,u.parseXSDFloat)(e.str());if(void 0===t)throw new s.CastError(e,a.TypeURL.XSD_FLOAT);return(0,c.float)(t)}),!1).collect()},h={arity:1,overloads:(0,c.declare)(a.TypeURL.XSD_DOUBLE).onNumeric1((()=>e=>(0,c.double)(e.typedValue))).onBoolean1Typed((()=>e=>(0,c.double)(e?1:0))).onUnary(a.TypeURL.XSD_STRING,(()=>e=>{const t=(0,u.parseXSDFloat)(e.str());if(void 0===t)throw new s.CastError(e,a.TypeURL.XSD_DOUBLE);return(0,c.double)(t)}),!1).collect()},p={arity:1,overloads:(0,c.declare)(a.TypeURL.XSD_DECIMAL).onNumeric1((()=>e=>{const t=(0,u.parseXSDDecimal)(e.str());if(void 0===t)throw new s.CastError(e,a.TypeURL.XSD_DECIMAL);return(0,c.decimal)(t)})).onString1((()=>e=>{const t=e.str(),r=/^([+-])?(\d+(\.\d+)?)$/u.test(t)?(0,u.parseXSDDecimal)(t):void 0;if(void 0===r)throw new s.CastError(e,a.TypeURL.XSD_DECIMAL);return(0,c.decimal)(r)}),!1).onBoolean1Typed((()=>e=>(0,c.decimal)(e?1:0))).collect()},f={arity:1,overloads:(0,c.declare)(a.TypeURL.XSD_INTEGER).onBoolean1Typed((()=>e=>(0,c.integer)(e?1:0))).onNumeric1((()=>e=>{const t=(0,u.parseXSDInteger)(e.str());if(void 0===t)throw new s.CastError(e,a.TypeURL.XSD_INTEGER);return(0,c.integer)(t)}),!1).onString1((()=>e=>{const t=e.str(),r=/^\d+$/u.test(t)?(0,u.parseXSDInteger)(t):void 0;if(void 0===r)throw new s.CastError(e,a.TypeURL.XSD_INTEGER);return(0,c.integer)(r)})).collect()},y={arity:1,overloads:(0,c.declare)(a.TypeURL.XSD_DATE_TIME).onUnary(a.TypeURL.XSD_DATE_TIME,(()=>e=>e)).onUnary(a.TypeURL.XSD_STRING,(()=>e=>(0,c.dateTime)((0,u.parseDateTime)(e.str()),e.str())),!1).onUnary(a.TypeURL.XSD_DATE,(()=>e=>new n.DateTimeLiteral({...e.typedValue,hours:0,minutes:0,seconds:0}))).collect()},g={arity:1,overloads:(0,c.declare)(a.TypeURL.XSD_BOOLEAN).onNumeric1((()=>e=>(0,c.bool)(e.coerceEBV())),!0).onUnary(a.TypeURL.XSD_BOOLEAN,(()=>e=>(0,c.bool)(e.coerceEBV())),!0).onUnary(a.TypeURL.XSD_STRING,(()=>e=>{switch(e.str()){case"true":case"1":return(0,c.bool)(!0);case"false":case"0":return(0,c.bool)(!1);default:throw new s.CastError(e,a.TypeURL.XSD_BOOLEAN)}}),!1).collect()},m={arity:1,overloads:(0,c.declare)(a.TypeURL.XSD_TIME).onUnary(a.TypeURL.XSD_TIME,(()=>e=>new n.TimeLiteral(e.typedValue,e.strValue))).onUnary(a.TypeURL.XSD_DATE_TIME,(()=>e=>new n.TimeLiteral(e.typedValue))).onStringly1((()=>e=>new n.TimeLiteral((0,u.parseTime)(e.str())))).collect()},b={arity:1,overloads:(0,c.declare)(a.TypeURL.XSD_DATE).onUnary(a.TypeURL.XSD_DATE,(()=>e=>new n.DateLiteral(e.typedValue,e.strValue))).onUnary(a.TypeURL.XSD_DATE_TIME,(()=>e=>new n.DateLiteral(e.typedValue))).onStringly1((()=>e=>new n.DateLiteral((0,u.parseDate)(e.str())))).collect()},v={arity:1,overloads:(0,c.declare)(a.TypeURL.XSD_DURATION).onUnary(a.TypeURL.XSD_DURATION,(()=>e=>new n.DurationLiteral(e.typedValue,e.strValue))).onStringly1((()=>e=>new i.DurationLiteral((0,u.parseDuration)(e.str())))).collect()},_={arity:1,overloads:(0,c.declare)(a.TypeURL.XSD_DAY_TIME_DURATION).onUnary(a.TypeURL.XSD_DURATION,(()=>e=>new n.DayTimeDurationLiteral((0,o.trimToDayTimeDuration)(e.typedValue)))).onStringly1((()=>e=>new n.DayTimeDurationLiteral((0,u.parseDayTimeDuration)(e.str())))).collect()},w={arity:1,overloads:(0,c.declare)(a.TypeURL.XSD_YEAR_MONTH_DURATION).onUnary(a.TypeURL.XSD_DURATION,(()=>e=>new n.YearMonthDurationLiteral((0,o.trimToYearMonthDuration)(e.typedValue)))).onStringly1((()=>e=>new n.YearMonthDurationLiteral((0,u.parseYearMonthDuration)(e.str())))).collect()};t.namedDefinitions={[a.TypeURL.XSD_STRING]:l,[a.TypeURL.XSD_FLOAT]:d,[a.TypeURL.XSD_DOUBLE]:h,[a.TypeURL.XSD_DECIMAL]:p,[a.TypeURL.XSD_INTEGER]:f,[a.TypeURL.XSD_DATE_TIME]:y,[a.TypeURL.XSD_DATE]:b,[a.TypeURL.XSD_BOOLEAN]:g,[a.TypeURL.XSD_TIME]:m,[a.TypeURL.XSD_DURATION]:v,[a.TypeURL.XSD_DAY_TIME_DURATION]:_,[a.TypeURL.XSD_YEAR_MONTH_DURATION]:w}},15553:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OverloadTree=void 0;const n=r(4417),i=r(29041);class a{constructor(e,t){this.identifier=e,this.implementation=void 0,this.generalOverloads=Object.create(null),this.literalOverLoads=[],this.depth=t||0,this.promotionCount=void 0}getSubtree(e){const t=(0,i.asGeneralType)(e);if(t)return this.generalOverloads[t];for(const[t,r]of this.literalOverLoads)if(e===t)return r}getImplementationExact(e){let t=this;for(const r of e)if(t=t.getSubtree(r),!t)return;return t.implementation}search(e,t,r){let i=r[this.identifier],a=0;for(;a({node:e,index:1}))));o.length>0;){const{index:n,node:i}=o.pop();if(n===e.length&&i.implementation)return this.addToCache(r,e,i.implementation),i.implementation;o.push(...i.getSubTreeWithArg(e[n],t).map((e=>({node:e,index:n+1}))))}}addToCache(e,t,r){function i(e,t){return t in e||(e[t]={}),e[t]}let a=i(e,this.identifier);for(const e of t){const t=(0,n.isLiteralTermExpression)(e),r=t?t.dataType:e.termType;a.cache=a.cache||{},a=i(a.cache,r)}a.func=r}addOverload(e,t){this._addOverload([...e],t,0)}_addOverload(e,t,r){const[n,...o]=e;if(!n)return void((void 0===this.promotionCount||r<=this.promotionCount)&&(this.promotionCount=r,this.implementation=t));let s=this.getSubtree(n);if(!s){const e=new a(this.identifier,this.depth+1),t=(0,i.asGeneralType)(n);t&&(this.generalOverloads[t]=e);const r=(0,i.asOverrideType)(n);r&&this.literalOverLoads.push([r,e]),s=e}s._addOverload(o,t,r),i.typePromotion[n]?.forEach((e=>this.addPromotedOverload(e.typeToPromote,t,e.conversionFunction,o,r)))}addPromotedOverload(e,t,r,n,i){let o=this.getSubtree(e);if(!o){const t=new a(this.identifier,this.depth+1);this.literalOverLoads.push([e,t]),o=t}o._addOverload(n,(e=>n=>t(e)([...n.slice(0,this.depth),r(n[this.depth]),...n.slice(this.depth+1,n.length)])),i+1)}getSubTreeWithArg(e,t){const r=[],a=(0,n.isLiteralTermExpression)(e);if(this.generalOverloads.term&&r.push(this.generalOverloads.term),this.generalOverloads[e.termType]&&r.push(this.generalOverloads[e.termType]),a){const e=(0,i.asKnownLiteralType)(a.dataType);let n;n=e?i.superTypeDictTable[e]:(0,i.getSuperTypes)(a.dataType,t);const o=this.literalOverLoads.filter((([e,t])=>e in n)).map((([e,t])=>[n[e],t]));o.sort((([e,t],[r,n])=>e-r)),r.push(...o.map((([e,t])=>t)))}return r}}t.OverloadTree=a},29734:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.definitions=void 0;const n=r(61594),i=r(77952),a=r(47793),o=r(70742),s=r(75735),u=r(22831),c=r(4417),l=r(22255),d=r(98644),h=r(98644),p=r(26832),f=r(4415),y=r(7664),g=r(57915),m=r(28588),b=r(69026),v=r(243),_=r(5987),w=new a.DataFactory,T={arity:1,overloads:(0,b.declare)(d.RegularOperator.NOT).onTerm1((()=>e=>(0,b.bool)(!e.coerceEBV()))).collect()},S={arity:1,overloads:(0,b.declare)(d.RegularOperator.UPLUS).numericConverter((()=>e=>e)).collect()},O={arity:1,overloads:(0,b.declare)(d.RegularOperator.UMINUS).numericConverter((()=>e=>-e)).collect()},E={arity:2,overloads:(0,b.declare)(d.RegularOperator.MULTIPLICATION).arithmetic((()=>(e,t)=>new n.BigNumber(e).times(t).toNumber())).collect()},x={arity:2,overloads:(0,b.declare)(d.RegularOperator.DIVISION).arithmetic((()=>(e,t)=>new n.BigNumber(e).div(t).toNumber())).onBinaryTyped([h.TypeURL.XSD_INTEGER,h.TypeURL.XSD_INTEGER],(()=>(e,t)=>{if(0===t)throw new f.ExpressionError("Integer division by 0");return(0,b.decimal)(new n.BigNumber(e).div(t).toNumber())})).collect()},A={arity:2,overloads:(0,b.declare)(d.RegularOperator.ADDITION).arithmetic((()=>(e,t)=>new n.BigNumber(e).plus(t).toNumber())).set([h.TypeURL.XSD_DATE_TIME,h.TypeURL.XSD_DAY_TIME_DURATION],(()=>([e,t])=>new c.DateTimeLiteral((0,g.addDurationToDateTime)(e.typedValue,(0,p.defaultedDurationRepresentation)(t.typedValue))))).copy({from:[h.TypeURL.XSD_DATE_TIME,h.TypeURL.XSD_DAY_TIME_DURATION],to:[h.TypeURL.XSD_DATE_TIME,h.TypeURL.XSD_YEAR_MONTH_DURATION]}).set([h.TypeURL.XSD_DATE,h.TypeURL.XSD_DAY_TIME_DURATION],(()=>([e,t])=>new c.DateLiteral((0,g.addDurationToDateTime)((0,p.defaultedDateTimeRepresentation)(e.typedValue),(0,p.defaultedDurationRepresentation)(t.typedValue))))).copy({from:[h.TypeURL.XSD_DATE,h.TypeURL.XSD_DAY_TIME_DURATION],to:[h.TypeURL.XSD_DATE,h.TypeURL.XSD_YEAR_MONTH_DURATION]}).set([h.TypeURL.XSD_TIME,h.TypeURL.XSD_DAY_TIME_DURATION],(()=>([e,t])=>new c.TimeLiteral((0,g.addDurationToDateTime)((0,p.defaultedDateTimeRepresentation)(e.typedValue),(0,p.defaultedDurationRepresentation)(t.typedValue))))).copy({from:[h.TypeURL.XSD_TIME,h.TypeURL.XSD_DAY_TIME_DURATION],to:[h.TypeURL.XSD_TIME,h.TypeURL.XSD_YEAR_MONTH_DURATION]}).collect()},R={arity:2,overloads:(0,b.declare)(d.RegularOperator.SUBTRACTION).arithmetic((()=>(e,t)=>new n.BigNumber(e).minus(t).toNumber())).set([h.TypeURL.XSD_DATE_TIME,h.TypeURL.XSD_DATE_TIME],(({defaultTimeZone:e})=>([t,r])=>new c.DayTimeDurationLiteral((0,g.elapsedDuration)(t.typedValue,r.typedValue,e)))).copy({from:[h.TypeURL.XSD_DATE_TIME,h.TypeURL.XSD_DATE_TIME],to:[h.TypeURL.XSD_DATE,h.TypeURL.XSD_DATE]}).copy({from:[h.TypeURL.XSD_DATE_TIME,h.TypeURL.XSD_DATE_TIME],to:[h.TypeURL.XSD_TIME,h.TypeURL.XSD_TIME]}).set([h.TypeURL.XSD_DATE_TIME,h.TypeURL.XSD_DAY_TIME_DURATION],(()=>([e,t])=>new c.DateTimeLiteral((0,g.addDurationToDateTime)(e.typedValue,(0,p.defaultedDurationRepresentation)((0,p.negateDuration)(t.typedValue)))))).copy({from:[h.TypeURL.XSD_DATE_TIME,h.TypeURL.XSD_DAY_TIME_DURATION],to:[h.TypeURL.XSD_DATE_TIME,h.TypeURL.XSD_YEAR_MONTH_DURATION]}).set([h.TypeURL.XSD_DATE,h.TypeURL.XSD_DAY_TIME_DURATION],(()=>([e,t])=>new c.DateLiteral((0,g.addDurationToDateTime)((0,p.defaultedDateTimeRepresentation)(e.typedValue),(0,p.defaultedDurationRepresentation)((0,p.negateDuration)(t.typedValue)))))).copy({from:[h.TypeURL.XSD_DATE,h.TypeURL.XSD_DAY_TIME_DURATION],to:[h.TypeURL.XSD_DATE,h.TypeURL.XSD_YEAR_MONTH_DURATION]}).set([h.TypeURL.XSD_TIME,h.TypeURL.XSD_DAY_TIME_DURATION],(()=>([e,t])=>new c.TimeLiteral((0,g.addDurationToDateTime)((0,p.defaultedDateTimeRepresentation)(e.typedValue),(0,p.defaultedDurationRepresentation)((0,p.negateDuration)(t.typedValue)))))).collect()},I={arity:2,overloads:(0,b.declare)(d.RegularOperator.EQUAL).numberTest((()=>(e,t)=>e===t)).stringTest((()=>(e,t)=>0===e.localeCompare(t))).set([h.TypeURL.RDF_LANG_STRING,h.TypeURL.RDF_LANG_STRING],(()=>([e,t])=>(0,b.bool)(e.str()===t.str()&&e.language===t.language))).set([h.TypeAlias.SPARQL_STRINGLY,h.TypeAlias.SPARQL_STRINGLY],(()=>()=>(0,b.bool)(!1))).booleanTest((()=>(e,t)=>e===t)).dateTimeTest((({defaultTimeZone:e})=>(t,r)=>(0,p.toUTCDate)(t,e).getTime()===(0,p.toUTCDate)(r,e).getTime())).copy({from:[h.TypeURL.XSD_DATE_TIME,h.TypeURL.XSD_DATE_TIME],to:[h.TypeURL.XSD_DATE,h.TypeURL.XSD_DATE]}).set(["quad","quad"],(e=>([t,r])=>{const n=new m.RegularFunction(h.RegularOperator.EQUAL,I);return(0,b.bool)(n.apply([t.subject,r.subject],e).coerceEBV()&&n.apply([t.predicate,r.predicate],e).coerceEBV()&&n.apply([t.object,r.object],e).coerceEBV())}),!1).set(["term","term"],(()=>([e,t])=>(0,b.bool)(function(e,t){const r=e.toRDF(),n=t.toRDF(),i=r.equals(n);if(!i&&"Literal"===r.termType&&"Literal"===n.termType)throw new f.RDFEqualTypeError([e,t]);return i}(e,t))),!1).set([h.TypeURL.XSD_DURATION,h.TypeURL.XSD_DURATION],(()=>([e,t])=>(0,b.bool)((0,p.yearMonthDurationsToMonths)((0,p.defaultedYearMonthDurationRepresentation)(e.typedValue))===(0,p.yearMonthDurationsToMonths)((0,p.defaultedYearMonthDurationRepresentation)(t.typedValue))&&(0,p.dayTimeDurationsToSeconds)((0,p.defaultedDayTimeDurationRepresentation)(e.typedValue))===(0,p.dayTimeDurationsToSeconds)((0,p.defaultedDayTimeDurationRepresentation)(t.typedValue))))).set([h.TypeURL.XSD_TIME,h.TypeURL.XSD_TIME],(({defaultTimeZone:e})=>([t,r])=>(0,b.bool)((0,p.toUTCDate)((0,p.defaultedDateTimeRepresentation)(t.typedValue),e).getTime()===(0,p.toUTCDate)((0,p.defaultedDateTimeRepresentation)(r.typedValue),e).getTime()))).collect()},N={arity:2,overloads:(0,b.declare)(d.RegularOperator.NOT_EQUAL).set(["term","term"],(e=>([t,r])=>(0,b.bool)(!_.regularFunctions[d.RegularOperator.EQUAL].apply([t,r],e).typedValue))).collect()},j={arity:2,overloads:(0,b.declare)(d.RegularOperator.LT).numberTest((()=>(e,t)=>e(e,t)=>-1===e.localeCompare(t))).booleanTest((()=>(e,t)=>e([e,t])=>(0,b.bool)(-1===(0,y.orderTypes)(e.toRDF(),t.toRDF(),!0))),!1).dateTimeTest((({defaultTimeZone:e})=>(t,r)=>(0,p.toUTCDate)(t,e).getTime()<(0,p.toUTCDate)(r,e).getTime())).copy({from:[h.TypeURL.XSD_DATE_TIME,h.TypeURL.XSD_DATE_TIME],to:[h.TypeURL.XSD_DATE,h.TypeURL.XSD_DATE]}).set([h.TypeURL.XSD_YEAR_MONTH_DURATION,h.TypeURL.XSD_YEAR_MONTH_DURATION],(()=>([e,t])=>(0,b.bool)((0,p.yearMonthDurationsToMonths)((0,p.defaultedYearMonthDurationRepresentation)(e.typedValue))<(0,p.yearMonthDurationsToMonths)((0,p.defaultedYearMonthDurationRepresentation)(t.typedValue))))).set([h.TypeURL.XSD_DAY_TIME_DURATION,h.TypeURL.XSD_DAY_TIME_DURATION],(()=>([e,t])=>(0,b.bool)((0,p.dayTimeDurationsToSeconds)((0,p.defaultedDayTimeDurationRepresentation)(e.typedValue))<(0,p.dayTimeDurationsToSeconds)((0,p.defaultedDayTimeDurationRepresentation)(t.typedValue))))).set([h.TypeURL.XSD_TIME,h.TypeURL.XSD_TIME],(({defaultTimeZone:e})=>([t,r])=>(0,b.bool)((0,p.toUTCDate)((0,p.defaultedDateTimeRepresentation)(t.typedValue),e).getTime()<(0,p.toUTCDate)((0,p.defaultedDateTimeRepresentation)(r.typedValue),e).getTime()))).collect()},D={arity:2,overloads:(0,b.declare)(d.RegularOperator.GT).set(["term","term"],(e=>([t,r])=>_.regularFunctions[d.RegularOperator.LT].apply([r,t],e))).collect()},P={arity:2,overloads:(0,b.declare)(d.RegularOperator.LTE).set(["term","term"],(e=>([t,r])=>(0,b.bool)(_.regularFunctions[d.RegularOperator.LT].apply([t,r],e).typedValue||_.regularFunctions[d.RegularOperator.EQUAL].apply([t,r],e).typedValue))).collect()},C={arity:2,overloads:(0,b.declare)(d.RegularOperator.GTE).set(["term","term"],(e=>([t,r])=>_.regularFunctions[d.RegularOperator.LTE].apply([r,t],e))).collect()},L={arity:1,overloads:(0,b.declare)(d.RegularOperator.IS_IRI).onTerm1((()=>e=>(0,b.bool)("namedNode"===e.termType))).collect()},k={arity:1,overloads:(0,b.declare)(d.RegularOperator.IS_BLANK).onTerm1((()=>e=>(0,b.bool)("blankNode"===e.termType))).collect()},M={arity:1,overloads:(0,b.declare)(d.RegularOperator.IS_LITERAL).onTerm1((()=>e=>(0,b.bool)("literal"===e.termType))).collect()},F={arity:1,overloads:(0,b.declare)(d.RegularOperator.IS_NUMERIC).onNumeric1((()=>()=>(0,b.bool)(!0))).onTerm1((()=>()=>(0,b.bool)(!1))).collect()},B={arity:1,overloads:(0,b.declare)(d.RegularOperator.STR).onTerm1((()=>e=>(0,b.string)(e.str()))).collect()},U={arity:1,overloads:(0,b.declare)(d.RegularOperator.LANG).onLiteral1((()=>e=>(0,b.string)(e.language||""))).collect()},V={arity:1,overloads:(0,b.declare)(d.RegularOperator.DATATYPE).onLiteral1((()=>e=>new c.NamedNode(e.dataType))).collect()},q={arity:1,overloads:(0,b.declare)(d.RegularOperator.IRI).set(["namedNode"],(e=>t=>{const r=t[0],n=(0,o.resolve)(r.str(),e.baseIRI||"");return new c.NamedNode(n)})).onString1((e=>t=>{const r=(0,o.resolve)(t.str(),e.baseIRI||"");return new c.NamedNode(r)})).collect()},$={arity:2,overloads:(0,b.declare)(d.RegularOperator.STRDT).set([h.TypeURL.XSD_STRING,"namedNode"],(({superTypeProvider:e})=>([t,r])=>{const n=w.literal(t.typedValue,w.namedNode(r.value));return new l.TermTransformer(e).transformLiteral(n)})).collect()},Q={arity:2,overloads:(0,b.declare)(d.RegularOperator.STRLANG).onBinaryTyped([h.TypeURL.XSD_STRING,h.TypeURL.XSD_STRING],(()=>(e,t)=>new c.LangStringLiteral(e,t.toLowerCase()))).collect()},G={arity:0,overloads:(0,b.declare)(d.RegularOperator.UUID).set([],(()=>()=>new c.NamedNode(`urn:uuid:${u.v4()}`))).collect()},z={arity:0,overloads:(0,b.declare)(d.RegularOperator.STRUUID).set([],(()=>()=>(0,b.string)(u.v4()))).collect()},H={arity:1,overloads:(0,b.declare)(d.RegularOperator.STRLEN).onStringly1((()=>e=>(0,b.integer)([...e.typedValue].length))).collect()},X={arity:[2,3],overloads:(0,b.declare)(d.RegularOperator.SUBSTR).onBinaryTyped([h.TypeURL.XSD_STRING,h.TypeURL.XSD_INTEGER],(()=>(e,t)=>(0,b.string)([...e].slice(t-1).join("")))).onBinary([h.TypeURL.RDF_LANG_STRING,h.TypeURL.XSD_INTEGER],(()=>(e,t)=>{const r=[...e.typedValue].slice(t.typedValue-1).join("");return(0,b.langString)(r,e.language)})).onTernaryTyped([h.TypeURL.XSD_STRING,h.TypeURL.XSD_INTEGER,h.TypeURL.XSD_INTEGER],(()=>(e,t,r)=>(0,b.string)([...e].slice(t-1,r+t-1).join("")))).onTernary([h.TypeURL.RDF_LANG_STRING,h.TypeURL.XSD_INTEGER,h.TypeURL.XSD_INTEGER],(()=>(e,t,r)=>{const n=[...e.typedValue].slice(t.typedValue-1,r.typedValue+t.typedValue-1).join("");return(0,b.langString)(n,e.language)})).collect()},J={arity:1,overloads:(0,b.declare)(d.RegularOperator.UCASE).onString1Typed((()=>e=>(0,b.string)(e.toUpperCase()))).onLangString1((()=>e=>(0,b.langString)(e.typedValue.toUpperCase(),e.language))).collect()},K={arity:1,overloads:(0,b.declare)(d.RegularOperator.LCASE).onString1Typed((()=>e=>(0,b.string)(e.toLowerCase()))).onLangString1((()=>e=>(0,b.langString)(e.typedValue.toLowerCase(),e.language))).collect()},W={arity:2,overloads:(0,b.declare)(d.RegularOperator.STRSTARTS).onBinaryTyped([h.TypeAlias.SPARQL_STRINGLY,h.TypeURL.XSD_STRING],(()=>(e,t)=>(0,b.bool)(e.startsWith(t)))).onBinary([h.TypeURL.RDF_LANG_STRING,h.TypeURL.RDF_LANG_STRING],(()=>(e,t)=>{if(e.language!==t.language)throw new f.IncompatibleLanguageOperation(e,t);return(0,b.bool)(e.typedValue.startsWith(t.typedValue))})).collect()},Y={arity:2,overloads:(0,b.declare)(d.RegularOperator.STRENDS).onBinaryTyped([h.TypeAlias.SPARQL_STRINGLY,h.TypeURL.XSD_STRING],(()=>(e,t)=>(0,b.bool)(e.endsWith(t)))).onBinary([h.TypeURL.RDF_LANG_STRING,h.TypeURL.RDF_LANG_STRING],(()=>(e,t)=>{if(e.language!==t.language)throw new f.IncompatibleLanguageOperation(e,t);return(0,b.bool)(e.typedValue.endsWith(t.typedValue))})).collect()},Z={arity:2,overloads:(0,b.declare)(d.RegularOperator.CONTAINS).onBinaryTyped([h.TypeAlias.SPARQL_STRINGLY,h.TypeURL.XSD_STRING],(()=>(e,t)=>(0,b.bool)(e.includes(t)))).onBinary([h.TypeURL.RDF_LANG_STRING,h.TypeURL.RDF_LANG_STRING],(()=>(e,t)=>{if(e.language!==t.language)throw new f.IncompatibleLanguageOperation(e,t);return(0,b.bool)(e.typedValue.includes(t.typedValue))})).collect()},ee={arity:2,overloads:(0,b.declare)(d.RegularOperator.STRBEFORE).onBinaryTyped([h.TypeURL.XSD_STRING,h.TypeURL.XSD_STRING],(()=>(e,t)=>(0,b.string)(e.slice(0,Math.max(0,e.indexOf(t)))))).onBinary([h.TypeURL.RDF_LANG_STRING,h.TypeURL.XSD_STRING],(()=>(e,t)=>{const[r,n]=[e.typedValue,t.typedValue],i=e.typedValue.slice(0,Math.max(0,r.indexOf(n)));return i||!n?(0,b.langString)(i,e.language):(0,b.string)(i)})).onBinary([h.TypeURL.RDF_LANG_STRING,h.TypeURL.RDF_LANG_STRING],(()=>(e,t)=>{if(e.language!==t.language)throw new f.IncompatibleLanguageOperation(e,t);const[r,n]=[e.typedValue,t.typedValue],i=e.typedValue.slice(0,Math.max(0,r.indexOf(n)));return i||!n?(0,b.langString)(i,e.language):(0,b.string)(i)})).collect()},te={arity:2,overloads:(0,b.declare)(d.RegularOperator.STRAFTER).onBinaryTyped([h.TypeURL.XSD_STRING,h.TypeURL.XSD_STRING],(()=>(e,t)=>(0,b.string)(e.slice(e.indexOf(t)).slice(t.length)))).onBinary([h.TypeURL.RDF_LANG_STRING,h.TypeURL.XSD_STRING],(()=>(e,t)=>{const[r,n]=[e.typedValue,t.typedValue],i=r.slice(r.indexOf(n)).slice(n.length);return i||!n?(0,b.langString)(i,e.language):(0,b.string)(i)})).onBinary([h.TypeURL.RDF_LANG_STRING,h.TypeURL.RDF_LANG_STRING],(()=>(e,t)=>{if(e.language!==t.language)throw new f.IncompatibleLanguageOperation(e,t);const[r,n]=[e.typedValue,t.typedValue],i=r.slice(r.indexOf(n)).slice(n.length);return i||!n?(0,b.langString)(i,e.language):(0,b.string)(i)})).collect()},re={arity:1,overloads:(0,b.declare)(d.RegularOperator.ENCODE_FOR_URI).onStringly1Typed((()=>e=>(0,b.string)(encodeURI(e)))).collect()},ne={arity:2,overloads:(0,b.declare)(d.RegularOperator.LANG_MATCHES).onBinaryTyped([h.TypeURL.XSD_STRING,h.TypeURL.XSD_STRING],(()=>(e,t)=>(0,b.bool)(v.langMatches(e,t)))).collect()},ie={arity:[2,3],overloads:(0,b.declare)(d.RegularOperator.REGEX).onBinaryTyped([h.TypeAlias.SPARQL_STRINGLY,h.TypeURL.XSD_STRING],(()=>(e,t)=>(0,b.bool)(v.matches(e,t)))).onTernaryTyped([h.TypeAlias.SPARQL_STRINGLY,h.TypeURL.XSD_STRING,h.TypeURL.XSD_STRING],(()=>(e,t,r)=>(0,b.bool)(v.matches(e,t,r)))).collect()},ae={arity:[3,4],overloads:(0,b.declare)(d.RegularOperator.REPLACE).onTernaryTyped([h.TypeURL.XSD_STRING,h.TypeURL.XSD_STRING,h.TypeURL.XSD_STRING],(()=>(e,t,r)=>(0,b.string)(v.replace(e,t,r)))).set([h.TypeURL.RDF_LANG_STRING,h.TypeURL.XSD_STRING,h.TypeURL.XSD_STRING],(()=>([e,t,r])=>{const n=v.replace(e.typedValue,t.typedValue,r.typedValue);return(0,b.langString)(n,e.language)})).onQuaternaryTyped([h.TypeURL.XSD_STRING,h.TypeURL.XSD_STRING,h.TypeURL.XSD_STRING,h.TypeURL.XSD_STRING],(()=>(e,t,r,n)=>(0,b.string)(v.replace(e,t,r,n)))).set([h.TypeURL.RDF_LANG_STRING,h.TypeURL.XSD_STRING,h.TypeURL.XSD_STRING,h.TypeURL.XSD_STRING],(()=>([e,t,r,n])=>{const i=v.replace(e.typedValue,t.typedValue,r.typedValue,n.typedValue);return(0,b.langString)(i,e.language)})).collect()},oe={arity:1,overloads:(0,b.declare)(d.RegularOperator.ABS).numericConverter((()=>e=>Math.abs(e))).collect()},se={arity:1,overloads:(0,b.declare)(d.RegularOperator.ROUND).numericConverter((()=>e=>Math.round(e))).collect()},ue={arity:1,overloads:(0,b.declare)(d.RegularOperator.CEIL).numericConverter((()=>e=>Math.ceil(e))).collect()},ce={arity:1,overloads:(0,b.declare)(d.RegularOperator.FLOOR).numericConverter((()=>e=>Math.floor(e))).collect()},le={arity:0,overloads:(0,b.declare)(d.RegularOperator.RAND).set([],(()=>()=>(0,b.double)(Math.random()))).collect()},de={arity:0,overloads:(0,b.declare)(d.RegularOperator.NOW).set([],(e=>()=>new c.DateTimeLiteral((0,p.toDateTimeRepresentation)({date:e.now,timeZone:e.defaultTimeZone})))).collect()},he={arity:1,overloads:(0,b.declare)(d.RegularOperator.YEAR).onDateTime1((()=>e=>(0,b.integer)(e.typedValue.year))).set([h.TypeURL.XSD_DATE],(()=>([e])=>(0,b.integer)(e.typedValue.year))).collect()},pe={arity:1,overloads:(0,b.declare)(d.RegularOperator.MONTH).onDateTime1((()=>e=>(0,b.integer)(e.typedValue.month))).set([h.TypeURL.XSD_DATE],(()=>([e])=>(0,b.integer)(e.typedValue.month))).collect()},fe={arity:1,overloads:(0,b.declare)(d.RegularOperator.DAY).onDateTime1((()=>e=>(0,b.integer)(e.typedValue.day))).set([h.TypeURL.XSD_DATE],(()=>([e])=>(0,b.integer)(e.typedValue.day))).collect()},ye={arity:1,overloads:(0,b.declare)(d.RegularOperator.HOURS).onDateTime1((()=>e=>(0,b.integer)(e.typedValue.hours))).set([h.TypeURL.XSD_TIME],(()=>([e])=>(0,b.integer)(e.typedValue.hours))).collect()},ge={arity:1,overloads:(0,b.declare)(d.RegularOperator.MINUTES).onDateTime1((()=>e=>(0,b.integer)(e.typedValue.minutes))).set([h.TypeURL.XSD_TIME],(()=>([e])=>(0,b.integer)(e.typedValue.minutes))).collect()},me={arity:1,overloads:(0,b.declare)(d.RegularOperator.SECONDS).onDateTime1((()=>e=>(0,b.decimal)(e.typedValue.seconds))).set([h.TypeURL.XSD_TIME],(()=>([e])=>(0,b.integer)(e.typedValue.seconds))).collect()},be={arity:1,overloads:(0,b.declare)(d.RegularOperator.TIMEZONE).onDateTime1((()=>e=>{const t={hours:e.typedValue.zoneHours,minutes:e.typedValue.zoneMinutes};if(void 0===t.hours&&void 0===t.minutes)throw new f.InvalidTimezoneCall(e.str());return new c.DayTimeDurationLiteral(t)})).copy({from:[h.TypeURL.XSD_DATE_TIME],to:[h.TypeURL.XSD_DATE]}).copy({from:[h.TypeURL.XSD_DATE_TIME],to:[h.TypeURL.XSD_TIME]}).collect()},ve={arity:1,overloads:(0,b.declare)(d.RegularOperator.TZ).onDateTime1((()=>e=>(0,b.string)((0,p.extractRawTimeZone)(e.str())))).copy({from:[h.TypeURL.XSD_DATE_TIME],to:[h.TypeURL.XSD_DATE]}).copy({from:[h.TypeURL.XSD_DATE_TIME],to:[h.TypeURL.XSD_TIME]}).collect()},_e={arity:1,overloads:(0,b.declare)(d.RegularOperator.MD5).onString1Typed((()=>e=>(0,b.string)((0,s.hash)(e)))).collect()},we={arity:1,overloads:(0,b.declare)(d.RegularOperator.SHA1).onString1Typed((()=>e=>(0,b.string)((0,i.sha1)().update(e).digest("hex")))).collect()},Te={arity:1,overloads:(0,b.declare)(d.RegularOperator.SHA256).onString1Typed((()=>e=>(0,b.string)((0,i.sha256)().update(e).digest("hex")))).collect()},Se={arity:1,overloads:(0,b.declare)(d.RegularOperator.SHA384).onString1Typed((()=>e=>(0,b.string)((0,i.sha384)().update(e).digest("hex")))).collect()},Oe={arity:1,overloads:(0,b.declare)(d.RegularOperator.SHA512).onString1Typed((()=>e=>(0,b.string)((0,i.sha512)().update(e).digest("hex")))).collect()},Ee={arity:3,overloads:(0,b.declare)(d.RegularOperator.TRIPLE).onTerm3((e=>(...t)=>new c.Quad(w.quad(t[0].toRDF(),t[1].toRDF(),t[2].toRDF()),e.superTypeProvider))).collect()},xe={arity:1,overloads:(0,b.declare)(d.RegularOperator.SUBJECT).onQuad1((()=>e=>e.subject)).collect()},Ae={arity:1,overloads:(0,b.declare)(d.RegularOperator.PREDICATE).onQuad1((()=>e=>e.predicate)).collect()},Re={arity:1,overloads:(0,b.declare)(d.RegularOperator.OBJECT).onQuad1((()=>e=>e.object)).collect()},Ie={arity:1,overloads:(0,b.declare)(d.RegularOperator.IS_TRIPLE).onTerm1((()=>e=>(0,b.bool)("quad"===e.termType))).collect()};t.definitions={"!":T,uplus:S,uminus:O,"*":E,"/":x,"+":A,"-":R,"=":I,"!=":N,"<":j,">":D,"<=":P,">=":C,isiri:L,isuri:L,isblank:k,isliteral:M,isnumeric:F,str:B,lang:U,datatype:V,iri:q,uri:q,strdt:$,strlang:Q,uuid:G,struuid:z,strlen:H,substr:X,ucase:J,lcase:K,strstarts:W,strends:Y,contains:Z,strbefore:ee,strafter:te,encode_for_uri:re,langmatches:ne,regex:ie,replace:ae,abs:oe,round:se,ceil:ue,floor:ce,rand:le,now:de,year:he,month:pe,day:fe,hours:ye,minutes:ge,seconds:me,timezone:be,tz:ve,md5:_e,sha1:we,sha256:Te,sha384:Se,sha512:Oe,triple:Ee,subject:xe,predicate:Ae,object:Re,istriple:Ie}},48967:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.specialDefinitions=void 0;const n=r(22831),i=r(4417),a=r(98644),o=r(4415),s=r(69026),u=r(5987),c={arity:1,applyAsync:async({args:e,mapping:t})=>l({args:e,mapping:t}),applySynchronously:({args:e,mapping:t})=>l({args:e,mapping:t})};function l({args:e,mapping:t}){const r=e[0];if(r.expressionType!==i.ExpressionType.Variable)throw new o.InvalidArgumentTypes(e,a.SpecialOperator.BOUND);const n=t.has((0,s.expressionToVar)(r));return(0,s.bool)(n)}const d={arity:3,async applyAsync({args:e,mapping:t,evaluate:r}){const n=await r(e[0],t);return r(n.coerceEBV()?e[1]:e[2],t)},applySynchronously({args:e,mapping:t,evaluate:r}){const n=r(e[0],t);return r(n.coerceEBV()?e[1]:e[2],t)}},h={arity:Number.POSITIVE_INFINITY,async applyAsync({args:e,mapping:t,evaluate:r}){const n=[];for(const i of e)try{return await r(i,t)}catch(e){n.push(e)}throw new o.CoalesceError(n)},applySynchronously({args:e,mapping:t,evaluate:r}){const n=[];for(const i of e)try{return r(i,t)}catch(e){n.push(e)}throw new o.CoalesceError(n)}},p={arity:2,async applyAsync({args:e,mapping:t,evaluate:r}){const[n,i]=e;try{if((await r(n,t)).coerceEBV())return(0,s.bool)(!0);const e=(await r(i,t)).coerceEBV();return(0,s.bool)(e)}catch(e){if(!(await r(i,t)).coerceEBV())throw e;return(0,s.bool)(!0)}},applySynchronously({args:e,mapping:t,evaluate:r}){const[n,i]=e;try{if(r(n,t).coerceEBV())return(0,s.bool)(!0);const e=r(i,t).coerceEBV();return(0,s.bool)(e)}catch(e){if(!r(i,t).coerceEBV())throw e;return(0,s.bool)(!0)}}},f={arity:2,async applyAsync({args:e,mapping:t,evaluate:r}){const[n,i]=e;try{if(!(await r(n,t)).coerceEBV())return(0,s.bool)(!1);const e=(await r(i,t)).coerceEBV();return(0,s.bool)(e)}catch(e){if((await r(i,t)).coerceEBV())throw e;return(0,s.bool)(!1)}},applySynchronously({args:e,mapping:t,evaluate:r}){const[n,i]=e;try{if(!r(n,t).coerceEBV())return(0,s.bool)(!1);const e=r(i,t).coerceEBV();return(0,s.bool)(e)}catch(e){if(r(i,t).coerceEBV())throw e;return(0,s.bool)(!1)}}},y={arity:2,async applyAsync({args:e,mapping:t,evaluate:r}){const[n,i]=e.map((e=>r(e,t))),[a,o]=await Promise.all([n,i]);return(0,s.bool)(a.toRDF().equals(o.toRDF()))},applySynchronously({args:e,mapping:t,evaluate:r}){const[n,i]=e.map((e=>r(e,t)));return(0,s.bool)(n.toRDF().equals(i.toRDF()))}},g={arity:Number.POSITIVE_INFINITY,checkArity:e=>e.length>0,async applyAsync(e){const{args:t,mapping:r,evaluate:n}=e,[i,...a]=t;return m(await n(i,r),{...e,args:a},[])},applySynchronously(e){const{args:t,mapping:r,evaluate:n}=e,[i,...a]=t;return b(n(i,r),{...e,args:a},[])}};async function m(e,t,r){const{args:n,mapping:i,evaluate:c}=t;if(0===n.length)return r.every((e=>!e))?(0,s.bool)(!1):Promise.reject(new o.InError(r));try{const o=n.shift(),l=await c(o,i);return u.regularFunctions[a.RegularOperator.EQUAL].apply([e,l],t).typedValue?(0,s.bool)(!0):m(e,t,[...r,!1])}catch(n){return m(e,t,[...r,n])}}function b(e,t,r){const{args:n,mapping:i,evaluate:c}=t;if(0===n.length){if(r.every((e=>!e)))return(0,s.bool)(!1);throw new o.InError(r)}try{const o=c(n.shift(),i);return u.regularFunctions[a.RegularOperator.EQUAL].apply([e,o],t).typedValue?(0,s.bool)(!0):b(e,t,[...r,!1])}catch(n){return b(e,t,[...r,n])}}const v={arity:Number.POSITIVE_INFINITY,checkArity:e=>e.length>0,async applyAsync(e){const t=u.specialFunctions[a.SpecialOperator.IN],r=await t.applyAsync(e);return(0,s.bool)(!r.typedValue)},applySynchronously(e){const t=u.specialFunctions[a.SpecialOperator.IN].applySynchronously(e);return(0,s.bool)(!t.typedValue)}},_=(0,s.declare)(a.SpecialOperator.CONCAT).onStringly1((()=>e=>e)).collect(),w={arity:Number.POSITIVE_INFINITY,async applyAsync(e){const{args:t,mapping:r,evaluate:n,functionArgumentsCache:i,superTypeProvider:u}=e,c=t.map((async e=>n(e,r))).map((async r=>{const n=_.search([await r],u,i);if(!n)throw new o.InvalidArgumentTypes(t,a.SpecialOperator.CONCAT);return n(e)([await r])})),l=await Promise.all(c),d=l.map((e=>e.typedValue)).join(""),h=T(l)?l[0].language:void 0;return h?(0,s.langString)(d,h):(0,s.string)(d)},applySynchronously(e){const{args:t,mapping:r,evaluate:n,superTypeProvider:i,functionArgumentsCache:u}=e,c=t.map((e=>n(e,r))).map((r=>{const n=_.search([r],i,u);if(!n)throw new o.InvalidArgumentTypes(t,a.SpecialOperator.CONCAT);return n(e)([r])})),l=c.map((e=>e.typedValue)).join(""),d=T(c)?c[0].language:void 0;return d?(0,s.langString)(l,d):(0,s.string)(l)}};function T(e){return e.length>0&&e.every((t=>t.language===e[0].language))}const S=(0,s.declare)(a.SpecialOperator.BNODE).onString1((()=>e=>e)).collect(),O={arity:Number.POSITIVE_INFINITY,checkArity:e=>0===e.length||1===e.length,async applyAsync(e){const{args:t,mapping:r,evaluate:n,superTypeProvider:s,functionArgumentsCache:u}=e,c=1===t.length?await n(t[0],r):void 0;let l;if(c){const r=S.search([c],s,u);if(!r)throw new o.InvalidArgumentTypes(t,a.SpecialOperator.BNODE);l=r(e)([c]).str()}if(e.bnode){const t=await e.bnode(l);return new i.BlankNode(t)}return E(l)},applySynchronously(e){const{args:t,mapping:r,evaluate:n,superTypeProvider:s,functionArgumentsCache:u}=e,c=1===t.length?n(t[0],r):void 0;let l;if(c){const r=S.search([c],s,u);if(!r)throw new o.InvalidArgumentTypes(t,a.SpecialOperator.BNODE);l=r(e)([c]).str()}if(e.bnode){const t=e.bnode(l);return new i.BlankNode(t)}return E(l)}};function E(e){return new i.BlankNode(e||n.v4())}t.specialDefinitions={bound:c,if:d,coalesce:h,"&&":f,"||":p,sameterm:y,in:g,notin:v,concat:w,bnode:O}},243:(e,t)=>{"use strict";function r(e){return"*"===e}function n(e,t){return new RegExp(`/${e}/`,"iu").test(`/${t}/`)}Object.defineProperty(t,"__esModule",{value:!0}),t.langMatches=t.replace=t.matches=void 0,t.matches=function(e,t,r){return new RegExp(t,r).test(e)},t.replace=function(e,t,r,n){let i=new RegExp(t,n);return i.global||(i=new RegExp(t,`${n||""}g`)),e.replace(i,r)},t.langMatches=function(e,t){const i=e.split("-"),a=t.split("-");if(!n(a[0],i[0])&&!r(i[0]))return!1;let o=1,s=1;for(;s[e,new a.RegularFunction(e,t)]))),t.specialFunctions=Object.fromEntries(Object.entries(u.specialDefinitions).map((([e,t])=>[e,new a.SpecialFunction(e,t)]))),t.namedFunctions=Object.fromEntries(Object.entries(o.namedDefinitions).map((([e,t])=>[e,new a.NamedFunction(e,t)])));var c=r(15553);Object.defineProperty(t,"OverloadTree",{enumerable:!0,get:function(){return c.OverloadTree}})},60377:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncAggregateEvaluator=t.orderTypes=t.isExpressionError=t.ExpressionError=t.AggregateEvaluator=t.SyncEvaluator=t.AsyncEvaluator=void 0;var n=r(78467);Object.defineProperty(t,"AsyncEvaluator",{enumerable:!0,get:function(){return n.AsyncEvaluator}});var i=r(25120);Object.defineProperty(t,"SyncEvaluator",{enumerable:!0,get:function(){return i.SyncEvaluator}});var a=r(87722);Object.defineProperty(t,"AggregateEvaluator",{enumerable:!0,get:function(){return a.AggregateEvaluator}});var o=r(4415);Object.defineProperty(t,"ExpressionError",{enumerable:!0,get:function(){return o.ExpressionError}}),Object.defineProperty(t,"isExpressionError",{enumerable:!0,get:function(){return o.isExpressionError}});var s=r(7664);Object.defineProperty(t,"orderTypes",{enumerable:!0,get:function(){return s.orderTypes}});var u=r(7892);Object.defineProperty(t,"AsyncAggregateEvaluator",{enumerable:!0,get:function(){return u.AsyncAggregateEvaluator}})},52283:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AlgebraTransformer=void 0;const n=r(96331),i=r(4417),a=r(5987),o=r(98644),s=r(4415),u=r(4415),c=r(22255);class l extends c.TermTransformer{constructor(e){super(e.superTypeProvider),this.algebraConfig=e,this.creatorConfig={type:e.type,creator:e.creator}}transformAlgebra(e){const t=n.Algebra.expressionTypes;switch(e.expressionType){case t.TERM:return this.transformTerm(e);case t.OPERATOR:return this.transformOperator(e);case t.NAMED:return this.transformNamed(e);case t.EXISTENCE:return l.transformExistence(e);case t.AGGREGATE:return l.transformAggregate(e);case t.WILDCARD:return l.transformWildcard(e)}}static transformWildcard(e){return new i.NamedNode(e.wildcard.value)}transformOperator(e){const t=e.operator.toLowerCase();if(o.SpecialOperators.has(t)){const r=t,n=e.args.map((e=>this.transformAlgebra(e))),o=a.specialFunctions[r];if(!o.checkArity(n))throw new s.InvalidArity(n,r);return new i.SpecialOperator(n,o.applyAsync,o.applySynchronously)}if(!o.Operators.has(t))throw new s.UnknownOperator(e.operator);const r=t,n=e.args.map((e=>this.transformAlgebra(e))),u=a.regularFunctions[r];if(!l.hasCorrectArity(n,u.arity))throw new s.InvalidArity(n,r);return new i.Operator(n,(e=>u.apply(e,this.algebraConfig)))}wrapSyncFunction(e,t){return r=>{try{const t=e(r.map((e=>e.toRDF())));return this.transformRDFTermUnsafe(t)}catch(e){throw new u.ExtensionFunctionError(t,e)}}}wrapAsyncFunction(e,t){return async r=>{try{const t=await e(r.map((e=>e.toRDF())));return this.transformRDFTermUnsafe(t)}catch(e){throw new u.ExtensionFunctionError(t,e)}}}transformNamed(e){const t=e.name.value,r=e.args.map((e=>this.transformAlgebra(e)));if(o.NamedOperators.has(t)){const t=e.name.value,n=a.namedFunctions[t];return new i.Named(e.name,r,(e=>n.apply(e,this.algebraConfig)))}if("sync"===this.creatorConfig.type){const t=this.creatorConfig.creator(e.name);if(t){const n=this.wrapSyncFunction(t,e.name.value);return new i.SyncExtension(e.name,r,n)}}else{const t=this.creatorConfig.creator(e.name);if(t){const n=this.wrapAsyncFunction(t,e.name.value);return new i.AsyncExtension(e.name,r,n)}}throw new s.UnknownNamedOperator(e.name.value)}static hasCorrectArity(e,t){return Array.isArray(t)?t.includes(e.length):e.length===t}static transformAggregate(e){const t=e.aggregator;return new i.Aggregate(t,e)}static transformExistence(e){return new i.Existence(e)}}t.AlgebraTransformer=l},22255:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TermTransformer=void 0;const n=r(43347),i=r(96331),a=r(4417),o=r(98644),s=r(4415),u=r(4415),c=r(63658),l=r(63658),d=r(29041);t.TermTransformer=class{constructor(e){this.superTypeProvider=e}transformRDFTermUnsafe(e){return this.transformTerm({term:e,type:i.Algebra.types.EXPRESSION,expressionType:i.Algebra.expressionTypes.TERM})}transformTerm(e){if(!e.term)throw new s.InvalidExpression(e);switch(e.term.termType){case"Variable":return new a.Variable(n.termToString(e.term));case"Literal":return this.transformLiteral(e.term);case"NamedNode":return new a.NamedNode(e.term.value);case"BlankNode":return new a.BlankNode(e.term.value);case"Quad":return new a.Quad(e.term,this.superTypeProvider);default:throw new s.InvalidTermType(e)}}transformLiteral(e){if(!e.datatype||[null,void 0,""].includes(e.datatype.value))return e.language?new a.LangStringLiteral(e.value,e.language):new a.StringLiteral(e.value);const t=e.datatype.value,r=(0,d.getSuperTypeDict)(t,this.superTypeProvider);try{if(o.TypeURL.XSD_STRING in r)return new a.StringLiteral(e.value,t);if(o.TypeURL.RDF_LANG_STRING in r)return new a.LangStringLiteral(e.value,e.language);if(o.TypeURL.XSD_YEAR_MONTH_DURATION in r)return new a.YearMonthDurationLiteral((0,c.parseYearMonthDuration)(e.value),e.value,t);if(o.TypeURL.XSD_DAY_TIME_DURATION in r)return new a.DayTimeDurationLiteral((0,c.parseDayTimeDuration)(e.value),e.value,t);if(o.TypeURL.XSD_DURATION in r)return new a.DurationLiteral((0,c.parseDuration)(e.value),e.value,t);if(o.TypeURL.XSD_DATE_TIME in r){const r=new Date(e.value);return Number.isNaN(r.getTime())?new a.NonLexicalLiteral(void 0,t,this.superTypeProvider,e.value):new a.DateTimeLiteral((0,c.parseDateTime)(e.value),e.value,t)}if(o.TypeURL.XSD_DATE in r)return new a.DateLiteral((0,c.parseDate)(e.value),e.value,t);if(o.TypeURL.XSD_TIME in r)return new a.TimeLiteral((0,c.parseTime)(e.value),e.value,t);if(o.TypeURL.XSD_BOOLEAN in r)return"true"!==e.value&&"false"!==e.value&&"1"!==e.value&&"0"!==e.value?new a.NonLexicalLiteral(void 0,t,this.superTypeProvider,e.value):new a.BooleanLiteral("true"===e.value||"1"===e.value,e.value);if(o.TypeURL.XSD_DECIMAL in r){const n=l.parseXSDDecimal(e.value);return void 0===n?new a.NonLexicalLiteral(void 0,t,this.superTypeProvider,e.value):o.TypeURL.XSD_INTEGER in r?new a.IntegerLiteral(n,t,e.value):new a.DecimalLiteral(n,t,e.value)}const n=o.TypeURL.XSD_FLOAT in r,i=o.TypeURL.XSD_DOUBLE in r;if(n||i){const r=l.parseXSDFloat(e.value);return void 0===r?new a.NonLexicalLiteral(void 0,t,this.superTypeProvider,e.value):n?new a.FloatLiteral(r,t,e.value):new a.DoubleLiteral(r,t,e.value)}return new a.Literal(e.value,t,e.value)}catch(r){if(r instanceof Error&&(0,u.isExpressionError)(r))return new a.NonLexicalLiteral(void 0,t,this.superTypeProvider,e.value);throw r}}}},98644:(e,t)=>{"use strict";var r,n,i,a,o;Object.defineProperty(t,"__esModule",{value:!0}),t.NamedOperators=t.SetFunctions=t.SetFunction=t.Operators=t.SpecialOperators=t.RegularOperators=t.SpecialOperator=t.RegularOperator=t.TypeURL=t.TypeAlias=void 0,function(e){e.SPARQL_NUMERIC="SPARQL_NUMERIC",e.SPARQL_STRINGLY="SPARQL_STRINGLY"}(r||(t.TypeAlias=r={})),function(e){e.XSD_ANY_URI="http://www.w3.org/2001/XMLSchema#anyURI",e.XSD_STRING="http://www.w3.org/2001/XMLSchema#string",e.RDF_LANG_STRING="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",e.XSD_BOOLEAN="http://www.w3.org/2001/XMLSchema#boolean",e.XSD_DATE_TIME="http://www.w3.org/2001/XMLSchema#dateTime",e.XSD_DATE_TIME_STAMP="http://www.w3.org/2001/XMLSchema#dateTimeStamp",e.XSD_DATE="http://www.w3.org/2001/XMLSchema#date",e.XSD_G_MONTH="http://www.w3.org/2001/XMLSchema#gMonth",e.XSD_G_MONTHDAY="http://www.w3.org/2001/XMLSchema#gMonthDay",e.XSD_G_YEAR="http://www.w3.org/2001/XMLSchema#gYear",e.XSD_G_YEAR_MONTH="http://www.w3.org/2001/XMLSchema#gYearMonth",e.XSD_TIME="http://www.w3.org/2001/XMLSchema#time",e.XSD_G_DAY="http://www.w3.org/2001/XMLSchema#gDay",e.XSD_DECIMAL="http://www.w3.org/2001/XMLSchema#decimal",e.XSD_FLOAT="http://www.w3.org/2001/XMLSchema#float",e.XSD_DOUBLE="http://www.w3.org/2001/XMLSchema#double",e.XSD_INTEGER="http://www.w3.org/2001/XMLSchema#integer",e.XSD_NON_POSITIVE_INTEGER="http://www.w3.org/2001/XMLSchema#nonPositiveInteger",e.XSD_NEGATIVE_INTEGER="http://www.w3.org/2001/XMLSchema#negativeInteger",e.XSD_LONG="http://www.w3.org/2001/XMLSchema#long",e.XSD_INT="http://www.w3.org/2001/XMLSchema#int",e.XSD_SHORT="http://www.w3.org/2001/XMLSchema#short",e.XSD_BYTE="http://www.w3.org/2001/XMLSchema#byte",e.XSD_NON_NEGATIVE_INTEGER="http://www.w3.org/2001/XMLSchema#nonNegativeInteger",e.XSD_POSITIVE_INTEGER="http://www.w3.org/2001/XMLSchema#positiveInteger",e.XSD_UNSIGNED_LONG="http://www.w3.org/2001/XMLSchema#unsignedLong",e.XSD_UNSIGNED_INT="http://www.w3.org/2001/XMLSchema#unsignedInt",e.XSD_UNSIGNED_SHORT="http://www.w3.org/2001/XMLSchema#unsignedShort",e.XSD_UNSIGNED_BYTE="http://www.w3.org/2001/XMLSchema#unsignedByte",e.XSD_NORMALIZED_STRING="http://www.w3.org/2001/XMLSchema#normalizedString",e.XSD_TOKEN="http://www.w3.org/2001/XMLSchema#token",e.XSD_LANGUAGE="http://www.w3.org/2001/XMLSchema#language",e.XSD_NM_TOKEN="http://www.w3.org/2001/XMLSchema#NMTOKEN",e.XSD_NAME="http://www.w3.org/2001/XMLSchema#name",e.XSD_NC_NAME="http://www.w3.org/2001/XMLSchema#NCName",e.XSD_ENTITY="http://www.w3.org/2001/XMLSchema#ENTITY",e.XSD_ID="http://www.w3.org/2001/XMLSchema#ID",e.XSD_ID_REF="http://www.w3.org/2001/XMLSchema#IDREF",e.XSD_DURATION="http://www.w3.org/2001/XMLSchema#duration",e.XSD_YEAR_MONTH_DURATION="http://www.w3.org/2001/XMLSchema#yearMonthDuration",e.XSD_DAY_TIME_DURATION="http://www.w3.org/2001/XMLSchema#dayTimeDuration"}(n||(t.TypeURL=n={})),function(e){e.NOT="!",e.UMINUS="uminus",e.UPLUS="uplus",e.EQUAL="=",e.NOT_EQUAL="!=",e.LT="<",e.GT=">",e.LTE="<=",e.GTE=">=",e.MULTIPLICATION="*",e.DIVISION="/",e.ADDITION="+",e.SUBTRACTION="-",e.IS_IRI="isiri",e.IS_URI="isuri",e.IS_BLANK="isblank",e.IS_LITERAL="isliteral",e.IS_NUMERIC="isnumeric",e.STR="str",e.LANG="lang",e.DATATYPE="datatype",e.IRI="iri",e.URI="uri",e.STRDT="strdt",e.STRLANG="strlang",e.UUID="uuid",e.STRUUID="struuid",e.STRLEN="strlen",e.SUBSTR="substr",e.UCASE="ucase",e.LCASE="lcase",e.STRSTARTS="strstarts",e.STRENDS="strends",e.CONTAINS="contains",e.STRBEFORE="strbefore",e.STRAFTER="strafter",e.ENCODE_FOR_URI="encode_for_uri",e.LANG_MATCHES="langmatches",e.REGEX="regex",e.REPLACE="replace",e.ABS="abs",e.ROUND="round",e.CEIL="ceil",e.FLOOR="floor",e.RAND="rand",e.NOW="now",e.YEAR="year",e.MONTH="month",e.DAY="day",e.HOURS="hours",e.MINUTES="minutes",e.SECONDS="seconds",e.TIMEZONE="timezone",e.TZ="tz",e.MD5="md5",e.SHA1="sha1",e.SHA256="sha256",e.SHA384="sha384",e.SHA512="sha512",e.TRIPLE="triple",e.SUBJECT="subject",e.PREDICATE="predicate",e.OBJECT="object",e.IS_TRIPLE="istriple"}(i||(t.RegularOperator=i={})),function(e){e.BOUND="bound",e.IF="if",e.COALESCE="coalesce",e.LOGICAL_OR="||",e.LOGICAL_AND="&&",e.SAME_TERM="sameterm",e.IN="in",e.NOT_IN="notin",e.CONCAT="concat",e.BNODE="bnode"}(a||(t.SpecialOperator=a={})),t.RegularOperators=new Set(Object.values(i)),t.SpecialOperators=new Set(Object.values(a)),t.Operators=new Set([...t.RegularOperators,...t.SpecialOperators]),function(e){e.COUNT="count",e.SUM="sum",e.MIN="min",e.MAX="max",e.AVG="avg",e.GROUP_CONCAT="group_concat",e.SAMPLE="sample"}(o||(t.SetFunction=o={})),t.SetFunctions=new Set(Object.values(o)),t.NamedOperators=new Set([n.XSD_STRING,n.XSD_FLOAT,n.XSD_DOUBLE,n.XSD_DECIMAL,n.XSD_INTEGER,n.XSD_DATE_TIME,n.XSD_DATE,n.XSD_BOOLEAN,n.XSD_TIME,n.XSD_DURATION,n.XSD_DAY_TIME_DURATION,n.XSD_YEAR_MONTH_DURATION])},26832:(e,t)=>{"use strict";function r(e){return{day:e.day||0,hours:e.hours||0,minutes:e.minutes||0,seconds:e.seconds||0}}function n(e){return{year:e.year||0,month:e.month||0}}function i(e){return{...r(e),...n(e)}}function a(e){return{...e,day:e.day||1,hours:e.hours||0,month:e.month||1,year:e.year||0,seconds:e.seconds||0,minutes:e.minutes||0}}function o(e){const t=new Date(e.year,e.month-1,e.day,e.hours,e.minutes,Math.trunc(e.seconds),e.seconds%1*1e3);if(0<=e.year&&e.year<100){const e=1900;t.setFullYear(t.getFullYear()-e)}return t}Object.defineProperty(t,"__esModule",{value:!0}),t.extractTimeZone=t.extractRawTimeZone=t.dayTimeDurationsToSeconds=t.yearMonthDurationsToMonths=t.trimToDayTimeDuration=t.trimToYearMonthDuration=t.toUTCDate=t.toJSDate=t.negateDuration=t.toDateTimeRepresentation=t.defaultedDateTimeRepresentation=t.simplifyDurationRepresentation=t.defaultedDurationRepresentation=t.defaultedYearMonthDurationRepresentation=t.defaultedDayTimeDurationRepresentation=void 0,t.defaultedDayTimeDurationRepresentation=r,t.defaultedYearMonthDurationRepresentation=n,t.defaultedDurationRepresentation=i,t.simplifyDurationRepresentation=function(e){const t=i(e),r={},n=t.year+Math.trunc(t.month/12);n&&(r.year=n,t.month%=12),t.month&&(r.month=t.month);const a=t.day+Math.trunc(t.hours/24)+Math.trunc(t.minutes/1440)+Math.trunc(t.seconds/86400);a&&(r.day=a,t.hours%=24,t.minutes%=1440,t.seconds%=86400);const o=t.hours+Math.trunc(t.minutes/60)+Math.trunc(t.seconds/3600);o&&(r.hours=o,t.minutes%=60,t.seconds%=3600);const s=t.minutes+Math.trunc(t.seconds/60);return s&&(r.minutes=s,t.seconds%=60),t.seconds&&(r.seconds=t.seconds),r},t.defaultedDateTimeRepresentation=a,t.toDateTimeRepresentation=function({date:e,timeZone:t}){return{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),zoneHours:t.zoneHours,zoneMinutes:t.zoneMinutes}},t.negateDuration=function(e){return{year:void 0!==e.year?-1*e.year:void 0,month:void 0!==e.month?-1*e.month:void 0,day:void 0!==e.day?-1*e.day:void 0,hours:void 0!==e.hours?-1*e.hours:void 0,minutes:void 0!==e.minutes?-1*e.minutes:void 0,seconds:void 0!==e.seconds?-1*e.seconds:void 0}},t.toJSDate=o,t.toUTCDate=function(e,t){const r=o(a(e)),n=r.getTimezoneOffset(),i=void 0===e.zoneHours?t.zoneHours:e.zoneHours,s=void 0===e.zoneMinutes?t.zoneMinutes:e.zoneMinutes;return new Date(r.getTime()-60*(n+60*i+s)*1e3)},t.trimToYearMonthDuration=function(e){return{year:e.year,month:e.month}},t.trimToDayTimeDuration=function(e){return{day:e.day,hours:e.hours,minutes:e.minutes,seconds:e.seconds}},t.yearMonthDurationsToMonths=function(e){return 12*e.year+e.month},t.dayTimeDurationsToSeconds=function(e){return 60*(60*(24*e.day+e.hours)+e.minutes)+e.seconds},t.extractRawTimeZone=function(e){return/(Z|([+-]\d\d:\d\d))?$/u.exec(e)[0]},t.extractTimeZone=function(e){return{zoneHours:e.getTimezoneOffset()/60,zoneMinutes:e.getTimezoneOffset()%60}}},4415:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NoExistenceHook=t.NoAggregator=t.ExtensionFunctionError=t.UnknownNamedOperator=t.UnknownOperator=t.InvalidTermType=t.InvalidExpressionType=t.InvalidExpression=t.InvalidArity=t.UnexpectedError=t.ParseError=t.EmptyAggregateError=t.IncompatibleLanguageOperation=t.InvalidTimezoneCall=t.CastError=t.InvalidCompareArgumentTypes=t.InvalidArgumentTypes=t.InError=t.CoalesceError=t.RDFEqualTypeError=t.EBVCoercionError=t.UnboundVariableError=t.InvalidLexicalForm=t.isExpressionError=t.ExpressionError=void 0;class r extends Error{}t.ExpressionError=r,t.isExpressionError=function(e){return e instanceof r},t.InvalidLexicalForm=class extends r{constructor(e){super(`Invalid lexical form '${p(e)}'`),this.arg=e}},t.UnboundVariableError=class extends r{constructor(e,t){super(`Unbound variable '${p(e)}'`),this.variable=e,this.bindings=t}},t.EBVCoercionError=class extends r{constructor(e){super(`Cannot coerce term to EBV '${p(e)}'`),this.arg=e}},t.RDFEqualTypeError=class extends r{constructor(e){super("Equality test for literals with unsupported datatypes"),this.args=e}},t.CoalesceError=class extends r{constructor(e){super("All COALESCE arguments threw errors"),this.errors=e}},t.InError=class extends r{constructor(e){super(`Some argument to IN errorred and none where equal. ${e.map((e=>`(${e.toString()}) `)).join("and ")}`),this.errors=e}},t.InvalidArgumentTypes=class extends r{constructor(e,t){super(`Argument types not valid for operator: '${p(t)}' with '${p(e)}`),this.args=e,this.op=t}},t.InvalidCompareArgumentTypes=class extends r{constructor(e,t){super(`Compared argument types are supported: '${e.termType}' and '${t.termType}'`),this.arg0=e,this.arg1=t}},t.CastError=class extends r{constructor(e,t){super(`Invalid cast: '${p(e)}' to '${p(t)}'`),this.arg=e}},t.InvalidTimezoneCall=class extends r{constructor(e){super(`TIMEZONE call on ${e} which has no timezone`),this.dateString=e}},t.IncompatibleLanguageOperation=class extends r{constructor(e,t){super(`Operation on incompatible language literals '${p(e)}' and '${p(t)}'`),this.arg1=e,this.arg2=t}},t.EmptyAggregateError=class extends r{constructor(){super("Empty aggregate expression")}},t.ParseError=class extends r{constructor(e,t){super(`Failed to parse ${e} as ${t}.`)}};class n extends Error{constructor(e,t){super(`Programmer Error '${e}'`),this.payload=t}}t.UnexpectedError=n;class i extends Error{constructor(e,t){super(`The number of args does not match the arity of the operator '${p(t)}'.`),this.args=e,this.op=t}}t.InvalidArity=i;class a extends Error{constructor(e){super(`Invalid SPARQL Expression '${p(e)}'`)}}t.InvalidExpression=a;class o extends Error{constructor(e){super(`Invalid expression type for SPARQL Expression '${p(e)}'`),this.expr=e}}t.InvalidExpressionType=o;class s extends Error{constructor(e){super(`Invalid term type for term '${p(e)}'`),this.term=e}}t.InvalidTermType=s;class u extends Error{constructor(e){super(`Unknown operator: '${p(e)}`)}}t.UnknownOperator=u;class c extends Error{constructor(e){super(`Unknown named operator: '${p(e)}'`)}}t.UnknownNamedOperator=c;class l extends Error{constructor(e,t){t instanceof Error?super(`Error thrown in ${e}: ${t.message}${t.stack?`\n${t.stack}`:""}`):super(`Error thrown in ${e}`)}}t.ExtensionFunctionError=l;class d extends Error{constructor(e){super(`Aggregate expression ${p(e)} found, but no aggregate hook provided.`)}}t.NoAggregator=d;class h extends Error{constructor(){super("EXISTS found, but no existence hook provided.")}}function p(e){return JSON.stringify(e)}t.NoExistenceHook=h},7664:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.orderTypes=void 0;const n=r(89096),i=r(5987),a=r(22255),o=r(98644),s=r(4415);function u(e,t){return e===t?0:e"term"),cache:s||new n.LRUCache({max:1e3})},defaultTimeZone:{zoneHours:0,zoneMinutes:0}},h=new a.TermTransformer(d.superTypeProvider),p=h.transformLiteral(e),f=h.transformLiteral(t);try{return l.apply([p,f],d).typedValue?0:c.apply([p,f],d).typedValue?1:-1}catch{const e=u(p.dataType,f.dataType);return 0!==e?e:u(p.str(),f.str())}}(t,r,d,h);if(l)throw new s.InvalidCompareArgumentTypes(t,r);return u(t.value,r.value)};const c={Variable:0,BlankNode:1,NamedNode:2,Literal:3,Quad:4,DefaultGraph:5}},63658:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseDayTimeDuration=t.parseYearMonthDuration=t.parseDuration=t.parseTime=t.parseDate=t.parseDateTime=t.parseXSDInteger=t.parseXSDDecimal=t.parseXSDFloat=void 0;const n=r(26832),i=r(4415),a=r(57915);function o(e){if(""===e)return{zoneHours:void 0,zoneMinutes:void 0};if("Z"===e)return{zoneHours:0,zoneMinutes:0};const t=e.replace(/^([+|-])(\d\d):(\d\d)$/gu,"$11!$2!$3").split("!").map((e=>Number(e)));return{zoneHours:t[0]*t[1],zoneMinutes:t[0]*t[2]}}function s(e){const t=e.replace(/^(-)?([123456789]*\d{4})-(\d\d)-(\d\d)(Z|([+-]\d\d:\d\d))?$/gu,"$11!$2!$3!$4!$5");if(t===e)throw new i.ParseError(e,"date");const r=t.split("!"),n=r.slice(0,-1).map((e=>Number(e))),s={year:n[0]*n[1],month:n[2],day:n[3],...o(r[4])};if(!(1<=s.month&&s.month<=12&&1<=s.day&&s.day<=(0,a.maximumDayInMonthFor)(s.year,s.month)))throw new i.ParseError(e,"date");return s}function u(e){const t=e.replace(/^(\d\d):(\d\d):(\d\d(\.\d+)?)(Z|([+-]\d\d:\d\d))?$/gu,"$1!$2!$3!$5");if(t===e)throw new i.ParseError(e,"time");const r=t.split("!"),n=r.slice(0,-1).map((e=>Number(e))),a={hours:n[0],minutes:n[1],seconds:n[2],...o(r[3])};if(a.seconds>=60||a.minutes>=60||a.hours>24||24===a.hours&&(0!==a.minutes||0!==a.seconds))throw new i.ParseError(e,"time");return a}function c(e){const[t,r]=e.split("T"),a=t.replace(/^(-)?P(\d+Y)?(\d+M)?(\d+D)?$/gu,"$11S!$2!$3!$4");if(a===t)throw new i.ParseError(e,"duration");const o=a.split("!");if(void 0!==r){const t=r.replace(/^(\d+H)?(\d+M)?(\d+(\.\d+)?S)?$/gu,"$1!$2!$3");if(""===r||r===t)throw new i.ParseError(e,"duration");o.push(...t.split("!"))}const s=o.map((e=>e.slice(0,-1)));if(!s.slice(1).some((e=>e)))throw new i.ParseError(e,"duration");const u=Number(s[0]);return(0,n.simplifyDurationRepresentation)({year:s[1]?u*Number(s[1]):void 0,month:s[2]?u*Number(s[2]):void 0,day:s[3]?u*Number(s[3]):void 0,hours:s[4]?u*Number(s[4]):void 0,minutes:s[5]?u*Number(s[5]):void 0,seconds:s[6]?u*Number(s[6]):void 0})}t.parseXSDFloat=function(e){const t=Number(e);return Number.isNaN(t)?"NaN"===e?Number.NaN:"INF"===e||"+INF"===e?Number.POSITIVE_INFINITY:"-INF"===e?Number.NEGATIVE_INFINITY:void 0:t},t.parseXSDDecimal=function(e){const t=Number(e);return Number.isNaN(t)?void 0:t},t.parseXSDInteger=function(e){const t=Number.parseInt(e,10);return Number.isNaN(t)?void 0:t},t.parseDateTime=function(e){const[t,r]=e.split("T");return{...s(t),...u(r)}},t.parseDate=s,t.parseTime=function(e){const t=u(e);return t.hours%=24,t},t.parseDuration=c,t.parseYearMonthDuration=function(e){const t=c(e);if(["hours","minutes","seconds","day"].some((e=>Boolean(t[e]))))throw new i.ParseError(e,"yearMonthDuration");return t},t.parseDayTimeDuration=function(e){const t=c(e);if(["year","month"].some((e=>Boolean(t[e]))))throw new i.ParseError(e,"dayTimeDuration");return t}},17734:(e,t)=>{"use strict";function r(e,t=2){return e.toLocaleString(void 0,{minimumIntegerDigits:t,useGrouping:!1})}function n(e){return void 0===e.zoneHours||void 0===e.zoneMinutes?"":0===e.zoneHours&&0===e.zoneMinutes?"Z":`${e.zoneHours>=0?`+${r(e.zoneHours)}`:r(e.zoneHours)}:${r(Math.abs(e.zoneMinutes))}`}function i(e){return`${r(e.year,4)}-${r(e.month)}-${r(e.day)}${n(e)}`}function a(e){return`${r(e.hours)}:${r(e.minutes)}:${r(e.seconds)}${n(e)}`}Object.defineProperty(t,"__esModule",{value:!0}),t.serializeDuration=t.serializeTime=t.serializeDate=t.serializeDateTime=void 0,t.serializeDateTime=function(e){return`${i({year:e.year,month:e.month,day:e.day})}T${a(e)}`},t.serializeDate=i,t.serializeTime=a,t.serializeDuration=function(e,t="PT0S"){if(!Object.values(e).some((e=>0!==(e||0))))return t;const r=`${Object.values(e).some((e=>(e||0)<0))?"-":""}P${e.year?`${Math.abs(e.year)}Y`:""}${e.month?`${Math.abs(e.month)}M`:""}${e.day?`${Math.abs(e.day)}D`:""}`;return e.hours||e.minutes||e.seconds?`${r}T${e.hours?`${Math.abs(e.hours)}H`:""}${e.minutes?`${Math.abs(e.minutes)}M`:""}${e.seconds?`${Math.abs(e.seconds)}S`:""}`:r}},57915:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.elapsedDuration=t.addDurationToDateTime=t.maximumDayInMonthFor=void 0;const n=r(26832);function i(e,t,r=0){const n=e-r,i=t-r,a=Math.floor(n/i);return{intDiv:a,remainder:e-a*i}}function a(e,t){const{intDiv:r,remainder:n}=i(t,13,1),a=e+r;return[1,3,5,7,8,10,12].includes(n)?31:[4,6,9,11].includes(n)?30:2===n&&(0===i(a,400).remainder||0!==i(a,100).remainder&&0===i(a,4).remainder)?29:28}t.maximumDayInMonthFor=a,t.addDurationToDateTime=function(e,t){const r={...e};let n=i(e.month+t.month,13,1);for(r.month=n.remainder,r.year=e.year+t.year+n.intDiv,n=i(e.seconds+t.seconds,60),r.seconds=n.remainder,n=i(e.minutes+t.minutes+n.intDiv,60),r.minutes=n.remainder,n=i(e.hours+t.hours+n.intDiv,24),r.hours=n.remainder,r.day=e.day+t.day+n.intDiv;;){let e;if(r.day<1)r.day+=a(r.year,r.month-1),e=-1;else{if(!(r.day>a(r.year,r.month)))break;r.day-=a(r.year,r.month),e=1}n=i(r.month+e,13,1),r.month=n.remainder,r.year+=n.intDiv}return r},t.elapsedDuration=function(e,t,r){const i=(0,n.toUTCDate)(e,r),a=(0,n.toUTCDate)(t,r),o=i.getTime()-a.getTime();return{day:Math.floor(o/864e5),hours:Math.floor(o%864e5/36e5),minutes:Math.floor(o%36e5/6e4),seconds:o%6e4}}},29041:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.typePromotion=t.isSubTypeOf=t.getSuperTypeDict=t.isInternalSubType=t.asGeneralType=t.asOverrideType=t.asKnownLiteralType=t.asTypeAlias=t.typeAliasCheck=t.extensionTableInit=t.getSuperTypes=t.superTypeDictTable=t.extensionTableInput=void 0;const n=r(4417),i=r(69026),a=r(98644);function o(e,r){const n=r.cache.get(e);if(n)return n;const i=r.discoverer(e);if("term"===i){const t=Object.create(null);return t.__depth=0,t[e]=0,r.cache.set(e,t),t}let a;const s=c(i);return a=s?{...t.superTypeDictTable[s]}:{...o(i,r)},a.__depth++,a[e]=a.__depth,r.cache.set(e,a),a}function s(){for(const[e,r]of Object.entries(t.extensionTableInput)){const n=e;t.superTypeDictTable[n]||u(n,r,t.superTypeDictTable)}}function u(e,r,n){if("term"===r||void 0===r){const t=Object.create(null);return t.__depth=0,t[e]=0,void(n[e]=t)}n[r]||u(r,t.extensionTableInput[r],n),n[e]={...n[r],[e]:n[r].__depth+1,__depth:n[r].__depth+1}}function c(e){if(e in t.superTypeDictTable)return e}function l(e,r){const n=c(e);return n?t.superTypeDictTable[n]:o(e,r)}t.extensionTableInput={[a.TypeURL.XSD_DATE_TIME_STAMP]:a.TypeURL.XSD_DATE_TIME,[a.TypeURL.XSD_DAY_TIME_DURATION]:a.TypeURL.XSD_DURATION,[a.TypeURL.XSD_YEAR_MONTH_DURATION]:a.TypeURL.XSD_DURATION,[a.TypeURL.RDF_LANG_STRING]:a.TypeAlias.SPARQL_STRINGLY,[a.TypeURL.XSD_STRING]:a.TypeAlias.SPARQL_STRINGLY,[a.TypeURL.XSD_NORMALIZED_STRING]:a.TypeURL.XSD_STRING,[a.TypeURL.XSD_TOKEN]:a.TypeURL.XSD_NORMALIZED_STRING,[a.TypeURL.XSD_LANGUAGE]:a.TypeURL.XSD_TOKEN,[a.TypeURL.XSD_NM_TOKEN]:a.TypeURL.XSD_TOKEN,[a.TypeURL.XSD_NAME]:a.TypeURL.XSD_TOKEN,[a.TypeURL.XSD_NC_NAME]:a.TypeURL.XSD_NAME,[a.TypeURL.XSD_ENTITY]:a.TypeURL.XSD_NC_NAME,[a.TypeURL.XSD_ID]:a.TypeURL.XSD_NC_NAME,[a.TypeURL.XSD_ID_REF]:a.TypeURL.XSD_NC_NAME,[a.TypeURL.XSD_DOUBLE]:a.TypeAlias.SPARQL_NUMERIC,[a.TypeURL.XSD_FLOAT]:a.TypeAlias.SPARQL_NUMERIC,[a.TypeURL.XSD_DECIMAL]:a.TypeAlias.SPARQL_NUMERIC,[a.TypeURL.XSD_INTEGER]:a.TypeURL.XSD_DECIMAL,[a.TypeURL.XSD_NON_POSITIVE_INTEGER]:a.TypeURL.XSD_INTEGER,[a.TypeURL.XSD_NEGATIVE_INTEGER]:a.TypeURL.XSD_NON_POSITIVE_INTEGER,[a.TypeURL.XSD_LONG]:a.TypeURL.XSD_INTEGER,[a.TypeURL.XSD_INT]:a.TypeURL.XSD_LONG,[a.TypeURL.XSD_SHORT]:a.TypeURL.XSD_INT,[a.TypeURL.XSD_BYTE]:a.TypeURL.XSD_SHORT,[a.TypeURL.XSD_NON_NEGATIVE_INTEGER]:a.TypeURL.XSD_INTEGER,[a.TypeURL.XSD_POSITIVE_INTEGER]:a.TypeURL.XSD_NON_NEGATIVE_INTEGER,[a.TypeURL.XSD_UNSIGNED_LONG]:a.TypeURL.XSD_NON_NEGATIVE_INTEGER,[a.TypeURL.XSD_UNSIGNED_INT]:a.TypeURL.XSD_UNSIGNED_LONG,[a.TypeURL.XSD_UNSIGNED_SHORT]:a.TypeURL.XSD_UNSIGNED_INT,[a.TypeURL.XSD_UNSIGNED_BYTE]:a.TypeURL.XSD_UNSIGNED_SHORT,[a.TypeURL.XSD_DATE_TIME]:"term",[a.TypeURL.XSD_BOOLEAN]:"term",[a.TypeURL.XSD_DATE]:"term",[a.TypeURL.XSD_G_MONTH]:"term",[a.TypeURL.XSD_G_MONTHDAY]:"term",[a.TypeURL.XSD_G_YEAR]:"term",[a.TypeURL.XSD_G_YEAR_MONTH]:"term",[a.TypeURL.XSD_TIME]:"term",[a.TypeURL.XSD_G_DAY]:"term",[a.TypeURL.XSD_DURATION]:"term",[a.TypeAlias.SPARQL_NUMERIC]:"term",[a.TypeAlias.SPARQL_STRINGLY]:"term",[a.TypeURL.XSD_ANY_URI]:"term"},t.superTypeDictTable=Object.create(null),t.getSuperTypes=o,t.extensionTableInit=s,s(),t.typeAliasCheck=Object.create(null),function(){for(const e of Object.values(a.TypeAlias))t.typeAliasCheck[e]=!0}(),t.asTypeAlias=function(e){if(e in t.typeAliasCheck)return e},t.asKnownLiteralType=c,t.asOverrideType=function(e){if(c(e)||"term"===e)return e},t.asGeneralType=function(e){if("term"===e||(0,n.asTermType)(e))return e},t.isInternalSubType=function(e,r){return"term"!==e&&t.superTypeDictTable[e]&&void 0!==t.superTypeDictTable[e][r]},t.getSuperTypeDict=l,t.isSubTypeOf=function(e,t,r){return"term"!==e&&void 0!==l(e,r)[t]},t.typePromotion={[a.TypeURL.XSD_STRING]:[{typeToPromote:a.TypeURL.XSD_ANY_URI,conversionFunction:e=>(0,i.string)(e.str())}],[a.TypeURL.XSD_DOUBLE]:[{typeToPromote:a.TypeURL.XSD_FLOAT,conversionFunction:e=>(0,i.double)(e.typedValue)},{typeToPromote:a.TypeURL.XSD_DECIMAL,conversionFunction:e=>(0,i.double)(e.typedValue)}],[a.TypeURL.XSD_FLOAT]:[{typeToPromote:a.TypeURL.XSD_DECIMAL,conversionFunction:e=>(0,i.float)(e.typedValue)}]}},40932:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LoggerVoid=void 0;const n=r(42996);class i extends n.Logger{debug(){}error(){}fatal(){}info(){}trace(){}warn(){}}t.LoggerVoid=i},11832:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(40932),t)},60004:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MediatorAll=void 0;const n=r(90412);class i extends n.Mediator{constructor(e){super(e)}async mediate(e){const t=[];let r;try{r=this.publish(e)}catch{r=[]}for(const e of r)try{await e.reply,t.push(e.actor)}catch{}return(await Promise.all(t.map((t=>t.runObservable(e)))))[0]}async mediateWith(){throw new Error("Unsupported operation: MediatorAll#mediateWith")}}t.MediatorAll=i},60504:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(60004),t)},6535:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MediatorCombinePipeline=void 0;const n=r(90412);class i extends n.Mediator{constructor(e){super(e)}async mediate(e){let t;try{t=this.publish(e)}catch{return e}if(this.filterErrors){const e=[];for(const r of t)try{await r.reply,e.push(r)}catch{}t=e}if(t=await Promise.all(t.map((async({actor:e,reply:t})=>({actor:e,reply:await t})))),this.order){const e=e=>{const t=this.field?e[this.field]:e;if("number"!=typeof t)throw new Error("Cannot order elements that are not numbers.");return t};t=t.sort(((t,r)=>("increasing"===this.order?1:-1)*(e(t.reply)-e(r.reply))))}let r=e;for(const{actor:e}of t)r={...r,...await e.runObservable(r)};return r}mediateWith(){throw new Error("Method not supported.")}}t.MediatorCombinePipeline=i},83223:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(6535),t)},1667:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MediatorCombineUnion=void 0;const n=r(90412);class i extends n.Mediator{constructor(e){super(e),this.combiner=this.createCombiner()}async mediate(e){let t;try{t=this.publish(e)}catch{t=[]}await Promise.all(t.map((({reply:e})=>e)));const r=await Promise.all(t.map((t=>t.actor.runObservable(e))));return this.combiner(r)}mediateWith(){throw new Error("Method not supported.")}createCombiner(){return e=>{const t={};return t[this.field]={},[{}].concat(e.map((e=>e[this.field]))).forEach(((e,r,n)=>{t[this.field]={...e,...t[this.field]}})),t}}}t.MediatorCombineUnion=i},54560:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(1667),t)},12278:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MediatorJoinCoefficientsFixed=void 0;const n=r(90711),i=r(90412);class a extends i.Mediator{constructor(e){super(e)}async mediateWith(e,t){const r=[],a=t.map((({reply:e})=>e)).map((e=>e.catch((e=>{r.push(e)})))),o=await Promise.all(a);let s=o.map(((e,t)=>{if(e)return e.iterations*this.cpuWeight+e.persistedItems*this.memoryWeight+e.blockingItems*this.timeWeight+e.requestTime*this.ioWeight}));const u=Math.max(...s.filter((e=>void 0!==e))),c=e.context.get(n.KeysQueryOperation.limitIndicator);c&&(s=s.map(((e,t)=>void 0!==e&&o[t].persistedItems>0&&o[t].iterations>c?e+u:e)));let l=-1,d=Number.POSITIVE_INFINITY;for(const[e,t]of s.entries())void 0!==t&&(-1===l||te.message)).join("\n")}`);const h=t[l].actor;return h.includeInLogs&&i.Actor.getContextLogger(e.context)?.debug(`Determined physical join operator '${h.logicalType}-${h.physicalName}'`,{entries:e.entries.length,variables:await Promise.all(e.entries.map((async e=>(await e.output.metadata()).variables.map((e=>e.value))))),costs:Object.fromEntries(s.map(((e,r)=>[`${t[r].actor.logicalType}-${t[r].actor.physicalName}`,e]))),coefficients:Object.fromEntries(o.map(((e,r)=>[`${t[r].actor.logicalType}-${t[r].actor.physicalName}`,e])))}),h}}t.MediatorJoinCoefficientsFixed=a},47633:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(12278),t)},18202:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MediatorNumber=void 0;const n=r(90412);class i extends n.Mediator{constructor(e){super(e),this.indexPicker=this.createIndexPicker()}createIndexPicker(){switch(this.type){case"min":return e=>e.reduce(((e,t,r)=>{const n=this.getOrDefault(t[this.field],Number.POSITIVE_INFINITY);return null!==n&&(Number.isNaN(e[0])||e[0]>n)?[n,r]:e}),[Number.NaN,-1])[1];case"max":return e=>e.reduce(((e,t,r)=>{const n=this.getOrDefault(t[this.field],Number.NEGATIVE_INFINITY);return null!==n&&(Number.isNaN(e[0])||e[0]e));const n=[];if(this.ignoreErrors){const e={};e[this.field]=null,r=r.map((t=>t.catch((t=>(n.push(t),e)))))}const i=await Promise.all(r),a=this.indexPicker(i);if(a<0)throw new Error(`All actors rejected their test in ${this.name}\n${n.map((e=>e.message)).join("\n")}`);return t[a].actor}}t.MediatorNumber=i},31588:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(18202),t)},15950:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MediatorRace=void 0;const n=r(90412);class i extends n.Mediator{constructor(e){super(e)}mediateWith(e,t){return new Promise(((e,r)=>{const n=[];for(const i of t)i.reply.then((()=>{e(i.actor)})).catch((e=>{n.push(e),n.length===t.length&&r(new Error(`${this.name} mediated over all rejecting actors:\n${n.map((e=>e.message)).join("\n")}`))}))}))}}t.MediatorRace=i},12740:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(15950),t)},44405:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MetadataValidationState=void 0,t.MetadataValidationState=class{constructor(){this.invalidateListeners=[],this.valid=!0}addInvalidateListener(e){this.invalidateListeners.push(e)}invalidate(){if(this.valid){this.valid=!1;for(const e of this.invalidateListeners)e()}}}},82590:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(44405),t)},98041:(e,t,r)=>{const n=new(r(11832).LoggerVoid),i=new(r(90412).Bus)({name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-init/^2.0.0/components/ActorInit.jsonld#ActorInit_default_bus"}),a=new(r(90412).Bus)({name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-context-preprocess/^2.0.0/components/ActorContextPreprocess.jsonld#ActorContextPreprocess_default_bus"}),o=new(r(90412).Bus)({name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-hash-bindings/^2.0.0/components/ActorHashBindings.jsonld#ActorHashBindings_default_bus"}),s=new(r(90412).Bus)({name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-optimize-query-operation/^2.0.0/components/ActorOptimizeQueryOperation.jsonld#ActorOptimizeQueryOperation_default_bus"}),u=new(r(90412).Bus)({name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-query-parse/^2.0.0/components/ActorQueryParse.jsonld#ActorQueryParse_default_bus"}),c=new(r(90412).Bus)({name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-query-result-serialize/^2.0.0/components/ActorQueryResultSerialize.jsonld#ActorQueryResultSerialize_default_bus"}),l=new(r(90412).Bus)({name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-rdf-join-entries-sort/^2.0.0/components/ActorRdfJoinEntriesSort.jsonld#ActorRdfJoinEntriesSort_default_bus"}),d=new(r(90412).Bus)({name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-rdf-join-selectivity/^2.0.0/components/ActorRdfJoinSelectivity.jsonld#ActorRdfJoinSelectivity_default_bus"}),h=new(r(90412).Bus)({name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-rdf-metadata-accumulate/^2.0.0/components/ActorRdfMetadataAccumulate.jsonld#ActorRdfMetadataAccumulate_default_bus"}),p=new(r(90412).Bus)({name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-rdf-serialize/^2.0.0/components/ActorRdfSerialize.jsonld#ActorRdfSerialize_default_bus"}),f=new(r(90412).Bus)({name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-rdf-update-quads/^2.0.0/components/ActorRdfUpdateQuads.jsonld#ActorRdfUpdateQuads_default_bus"}),y=new(r(66490).BusQueryOperation)({name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-query-operation/^2.0.0/components/ActorQueryOperation.jsonld#ActorQueryOperation_default_bus"}),g=new(r(90412).Bus)({name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-rdf-join/^2.0.0/components/ActorRdfJoin.jsonld#ActorRdfJoin_default_bus"}),m=new(r(90412).Bus)({name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-rdf-resolve-quad-pattern/^2.0.0/components/ActorRdfResolveQuadPattern.jsonld#ActorRdfResolveQuadPattern_default_bus"}),b=new(r(90412).Bus)({name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-http-invalidate/^2.0.0/components/ActorHttpInvalidate.jsonld#ActorHttpInvalidate_default_bus"}),v=new(r(90412).Bus)({name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-http/^2.0.0/components/ActorHttp.jsonld#ActorHttp_default_bus"}),_=new(r(90412).Bus)({name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/bus-http/^2.0.0/components/ActorHttp.jsonld#ActorHttp_fallback_bus"}),w=(new(r(94410).ActorContextPreprocessSourceToDestination)({name:"urn:comunica:default:context-preprocess/actors#source-to-destination",bus:a}),new(r(83223).MediatorCombinePipeline)({name:"urn:comunica:default:context-preprocess/mediators#main",bus:a})),T=(new(r(23042).ActorHashBindingsSha1)({name:"urn:comunica:default:hash-bindings/actors#sha1",bus:o}),new(r(12740).MediatorRace)({name:"urn:comunica:default:hash-bindings/mediators#main",bus:o})),S=(new(r(34304).ActorOptimizeQueryOperationJoinBgp)({name:"urn:comunica:default:optimize-query-operation/actors#join-bgp",bus:s}),new(r(60192).ActorOptimizeQueryOperationBgpToJoin)({name:"urn:comunica:default:optimize-query-operation/actors#bgp-to-join",bus:s}),new(r(5118).ActorOptimizeQueryOperationJoinConnected)({name:"urn:comunica:default:optimize-query-operation/actors#join-connected",bus:s}),new(r(83223).MediatorCombinePipeline)({name:"urn:comunica:default:optimize-query-operation/mediators#main",bus:s})),O=(new(r(8323).ActorQueryParseSparql)({prefixes:{dbpedia:"http://dbpedia.org/resource/","dbpedia-owl":"http://dbpedia.org/ontology/",dbpprop:"http://dbpedia.org/property/",dc:"http://purl.org/dc/terms/",dc11:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",foaf:"http://xmlns.com/foaf/0.1/",geo:"http://www.w3.org/2003/01/geo/wgs84_pos#",owl:"http://www.w3.org/2002/07/owl#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",schema:"http://schema.org/",skos:"http://www.w3.org/2008/05/skos#",xsd:"http://www.w3.org/2001/XMLSchema#"},name:"urn:comunica:default:query-parse/actors#sparql",bus:u}),new(r(4047).ActorQueryParseGraphql)({name:"urn:comunica:default:query-parse/actors#graphql",bus:u}),new(r(12740).MediatorRace)({name:"urn:comunica:default:query-parse/mediators#main",bus:u})),E=(new(r(1359).ActorQueryResultSerializeJson)({mediaTypePriorities:{"application/json":1},mediaTypeFormats:{"application/json":"https://comunica.linkeddatafragments.org/#results_JSON"},name:"urn:comunica:default:query-result-serialize/actors#json",bus:c}),new(r(1595).ActorQueryResultSerializeSimple)({mediaTypePriorities:{simple:.9},mediaTypeFormats:{simple:"https://comunica.linkeddatafragments.org/#results_simple"},name:"urn:comunica:default:query-result-serialize/actors#simple",bus:c}),new(r(83657).ActorQueryResultSerializeSparqlCsv)({mediaTypePriorities:{"text/csv":.75},mediaTypeFormats:{"text/csv":"http://www.w3.org/ns/formats/SPARQL_Results_CSV"},name:"urn:comunica:default:query-result-serialize/actors#csv",bus:c}),new(r(92796).ActorQueryResultSerializeSparqlTsv)({mediaTypePriorities:{"text/tab-separated-values":.75},mediaTypeFormats:{"text/tab-separated-values":"http://www.w3.org/ns/formats/SPARQL_Results_TSV"},name:"urn:comunica:default:query-result-serialize/actors#sparql-tsv",bus:c}),new(r(23200).ActorQueryResultSerializeSparqlXml)({mediaTypePriorities:{"application/sparql-results+xml":.8},mediaTypeFormats:{"application/sparql-results+xml":"http://www.w3.org/ns/formats/SPARQL_Results_XML"},name:"urn:comunica:default:query-result-serialize/actors#sparql-xml",bus:c}),new(r(17731).ActorQueryResultSerializeTable)({columnWidth:50,mediaTypePriorities:{table:.6},mediaTypeFormats:{table:"https://comunica.linkeddatafragments.org/#results_table"},name:"urn:comunica:default:query-result-serialize/actors#table",bus:c}),new(r(78149).ActorQueryResultSerializeTree)({mediaTypePriorities:{tree:.5},mediaTypeFormats:{tree:"https://comunica.linkeddatafragments.org/#results_tree"},name:"urn:comunica:default:query-result-serialize/actors#tree",bus:c}),new(r(12740).MediatorRace)({name:"urn:comunica:default:query-result-serialize/mediators#serialize",bus:c})),x=new(r(54560).MediatorCombineUnion)({field:"mediaTypes",name:"urn:comunica:default:query-result-serialize/mediators#mediaType",bus:c}),A=new(r(54560).MediatorCombineUnion)({field:"mediaTypeFormats",name:"urn:comunica:default:query-result-serialize/mediators#mediaTypeFormat",bus:c}),R=(new(r(4669).ActorRdfJoinEntriesSortCardinality)({name:"urn:comunica:default:rdf-join-entries-sort/actors#cardinality",bus:l}),new(r(12740).MediatorRace)({name:"urn:comunica:default:rdf-join-entries-sort/mediators#main",bus:l})),I=(new(r(3595).ActorRdfJoinSelectivityVariableCounting)({name:"urn:comunica:default:rdf-join-selectivity/actors#variable-counting",bus:d}),new(r(31588).MediatorNumber)({field:"accuracy",type:"max",ignoreErrors:!0,name:"urn:comunica:default:rdf-join-selectivity/mediators#main",bus:d})),N=(new(r(44024).ActorRdfMetadataAccumulateCanContainUndefs)({name:"urn:comunica:default:rdf-metadata-accumulate/actors#cancontainundefs",bus:h}),new(r(37143).ActorRdfMetadataAccumulateCardinality)({name:"urn:comunica:default:rdf-metadata-accumulate/actors#cardinality",bus:h}),new(r(17215).ActorRdfMetadataAccumulatePageSize)({name:"urn:comunica:default:rdf-metadata-accumulate/actors#pagesize",bus:h}),new(r(59075).ActorRdfMetadataAccumulateRequestTime)({name:"urn:comunica:default:rdf-metadata-accumulate/actors#requesttime",bus:h}),new(r(54560).MediatorCombineUnion)({field:"metadata",name:"urn:comunica:default:rdf-metadata-accumulate/mediators#main",bus:h})),j=(new(r(42274).ActorRdfSerializeN3)({mediaTypePriorities:{"application/n-quads":1,"application/n-triples":.8,"application/trig":.95,"text/n3":.35,"text/turtle":.6},mediaTypeFormats:{"application/n-quads":"http://www.w3.org/ns/formats/N-Quads","application/n-triples":"http://www.w3.org/ns/formats/N-Triples","application/trig":"http://www.w3.org/ns/formats/TriG","text/n3":"http://www.w3.org/ns/formats/N3","text/turtle":"http://www.w3.org/ns/formats/Turtle"},name:"urn:comunica:default:rdf-serialize/actors#n3",bus:p}),new(r(61515).ActorRdfSerializeJsonLd)({jsonStringifyIndentSpaces:2,mediaTypePriorities:{"application/ld+json":1},mediaTypeFormats:{"application/ld+json":"http://www.w3.org/ns/formats/JSON-LD"},priorityScale:.9,name:"urn:comunica:default:rdf-serialize/actors#jsonld",bus:p}),new(r(98371).ActorRdfSerializeShaclc)({mediaTypePriorities:{"text/shaclc":1,"text/shaclc-ext":.5},mediaTypeFormats:{"text/shaclc":"http://www.w3.org/ns/formats/Shaclc","text/shaclc-ext":"http://www.w3.org/ns/formats/ShaclcExtended"},priorityScale:.1,name:"urn:comunica:default:rdf-serialize/actors#shaclc",bus:p}),new(r(12740).MediatorRace)({name:"urn:comunica:default:rdf-serialize/mediators#serialize",bus:p})),D=new(r(54560).MediatorCombineUnion)({field:"mediaTypes",name:"urn:comunica:default:rdf-serialize/mediators#mediaType",bus:p}),P=new(r(54560).MediatorCombineUnion)({field:"mediaTypeFormats",name:"urn:comunica:default:rdf-serialize/mediators#mediaTypeFormat",bus:p}),C=(new(r(53550).ActorRdfUpdateQuadsRdfJsStore)({name:"urn:comunica:default:rdf-update-quads/actors#rdfjs-store",bus:f}),new(r(12740).MediatorRace)({name:"urn:comunica:default:rdf-update-quads/mediators#main",bus:f})),L=(new(r(65178).ActorQueryOperationValues)({name:"urn:comunica:default:query-operation/actors#values",bus:y}),new(r(31588).MediatorNumber)({field:"httpRequests",type:"min",ignoreErrors:!0,name:"urn:comunica:default:query-operation/mediators#main",bus:y})),k=new(r(47633).MediatorJoinCoefficientsFixed)({cpuWeight:1,memoryWeight:1,timeWeight:10,ioWeight:100,name:"urn:comunica:default:rdf-join/mediators#main",bus:g}),M=(new(r(9069).ActorRdfResolveQuadPatternRdfJsSource)({name:"urn:comunica:default:rdf-resolve-quad-pattern/actors#rdfjs-source",bus:m}),new(r(12740).MediatorRace)({name:"urn:comunica:default:rdf-resolve-quad-pattern/mediators#main",bus:m})),F=new(r(60504).MediatorAll)({name:"urn:comunica:default:http-invalidate/mediators#main",bus:b}),B=new(r(40332).ActorHttpInvalidateListenable)({name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-result-serialize-sparql-json/^2.0.0/components/ActionObserverHttp.jsonld#IActionObserverHttpArgs_default_invalidator",bus:b}),U=new(r(40332).ActorHttpInvalidateListenable)({name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-result-serialize-stats/^2.0.0/components/ActionObserverHttp.jsonld#IActionObserverHttpArgs_default_invalidator",bus:b}),V=new(r(31588).MediatorNumber)({field:"time",type:"min",ignoreErrors:!0,name:"urn:comunica:default:http/mediators#main",bus:_}),q=(new(r(88766).ActorRdfJoinNone)({mediatorJoinSelectivity:I,name:"urn:comunica:default:rdf-join/actors#inner-none",bus:g}),new(r(71924).ActorRdfJoinSingle)({mediatorJoinSelectivity:I,name:"urn:comunica:default:rdf-join/actors#inner-single",bus:g}),new(r(25445).ActorRdfJoinMultiEmpty)({mediatorJoinSelectivity:I,name:"urn:comunica:default:rdf-join/actors#inner-multi-empty",bus:g}),new(r(96848).ActorRdfJoinHash)({mediatorJoinSelectivity:I,name:"urn:comunica:default:rdf-join/actors#inner-hash",bus:g}),new(r(96835).ActorRdfJoinSymmetricHash)({mediatorJoinSelectivity:I,name:"urn:comunica:default:rdf-join/actors#inner-symmetric-hash",bus:g}),new(r(36229).ActorRdfJoinNestedLoop)({mediatorJoinSelectivity:I,name:"urn:comunica:default:rdf-join/actors#inner-nested-loop",bus:g}),new(r(42004).ActorRdfJoinMinusHash)({mediatorJoinSelectivity:I,name:"urn:comunica:default:rdf-join/actors#minus-hash",bus:g}),new(r(55011).ActorRdfJoinMinusHashUndef)({mediatorJoinSelectivity:I,name:"urn:comunica:default:rdf-join/actors#minus-hash-undef",bus:g}),new(r(65267).ActorRdfJoinOptionalNestedLoop)({mediatorJoinSelectivity:I,name:"urn:comunica:default:rdf-join/actors#optional-nested-loop",bus:g}),new(r(33275).ActorQueryResultSerializeRdf)({mediatorRdfSerialize:j,mediatorMediaTypeCombiner:D,mediatorMediaTypeFormatCombiner:P,name:"urn:comunica:default:query-result-serialize/actors#rdf",bus:c}),new(r(16682).ActorQueryOperationAsk)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#ask",bus:y}),new(r(69932).ActorQueryOperationDescribeSubject)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#describe",bus:y}),new(r(38820).ActorQueryOperationBgpJoin)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#bgp",bus:y}),new(r(24615).ActorQueryOperationDistinctHash)({mediatorHashBindings:T,mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#distinct",bus:y}),new(r(34585).ActorQueryOperationConstruct)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#construct",bus:y}),new(r(12304).ActorQueryOperationExtend)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#extend",bus:y}),new(r(13034).ActorQueryOperationFilterSparqlee)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#filter",bus:y}),new(r(22744).ActorQueryOperationFromQuad)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#from",bus:y}),new(r(37515).ActorQueryOperationGroup)({mediatorHashBindings:T,mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#group",bus:y}),new(r(79153).ActorQueryOperationNop)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#nop",bus:y}),new(r(67107).ActorQueryOperationOrderBySparqlee)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#orderby",bus:y}),new(r(99817).ActorQueryOperationProject)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#project",bus:y}),new(r(66713).ActorQueryOperationReducedHash)({mediatorHashBindings:T,cacheSize:100,mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#reduced",bus:y}),new(r(24718).ActorQueryOperationSlice)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#slice",bus:y}),new(r(89115).ActorQueryOperationService)({forceSparqlEndpoint:!1,mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#service",bus:y}),new(r(43415).ActorQueryOperationUnion)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#union",bus:y}),new(r(6809).ActorQueryOperationPathInv)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#path-inv",bus:y}),new(r(66218).ActorQueryOperationPathLink)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#path-link",bus:y}),new(r(54309).ActorQueryOperationPathNps)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#path-nps",bus:y}),new(r(35529).ActorQueryOperationPathAlt)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#path-alt",bus:y}),new(r(23654).ActorQueryOperationPathOneOrMore)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#path-one-or-more",bus:y}),new(r(85928).ActorQueryOperationPathZeroOrMore)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#path-zero-or-more",bus:y}),new(r(8327).ActorQueryOperationPathZeroOrOne)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#path-zero-or-one",bus:y}),new(r(77634).ActorQueryOperationAddRewrite)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#update-add",bus:y}),new(r(84629).ActorQueryOperationClear)({mediatorUpdateQuads:C,mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#update-clear",bus:y}),new(r(330).ActorQueryOperationUpdateCompositeUpdate)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#update-composite",bus:y}),new(r(69724).ActorQueryOperationCopyRewrite)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#update-copy",bus:y}),new(r(54672).ActorQueryOperationCreate)({mediatorUpdateQuads:C,mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#update-create",bus:y}),new(r(63002).ActorQueryOperationUpdateDeleteInsert)({mediatorUpdateQuads:C,mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#update-delete-insert",bus:y}),new(r(33181).ActorQueryOperationDrop)({mediatorUpdateQuads:C,mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#update-drop",bus:y}),new(r(38392).ActorQueryOperationLoad)({mediatorUpdateQuads:C,mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#update-load",bus:y}),new(r(90676).ActorQueryOperationMoveRewrite)({mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#update-move",bus:y}),new(r(42815).ActorRdfJoinMultiBind)({bindOrder:"depth-first",selectivityModifier:1e-4,mediatorJoinEntriesSort:R,mediatorQueryOperation:L,mediatorJoinSelectivity:I,name:"urn:comunica:default:rdf-join/actors#inner-multi-bind",bus:g}),new(r(97237).ActorRdfJoinOptionalBind)({bindOrder:"depth-first",selectivityModifier:1e-4,mediatorQueryOperation:L,mediatorJoinSelectivity:I,name:"urn:comunica:default:rdf-join/actors#optional-bind",bus:g}),new(r(20240).ActorQueryOperationJoin)({mediatorJoin:k,mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#join",bus:y}),new(r(75113).ActorQueryOperationLeftJoin)({mediatorJoin:k,mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#leftjoin",bus:y}),new(r(48952).ActorQueryOperationMinus)({mediatorJoin:k,mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#minus",bus:y}),new(r(75049).ActorQueryOperationPathSeq)({mediatorJoin:k,mediatorQueryOperation:L,name:"urn:comunica:default:query-operation/actors#path-seq",bus:y}),new(r(25925).ActorRdfJoinMultiSmallest)({mediatorJoinEntriesSort:R,mediatorJoin:k,mediatorJoinSelectivity:I,name:"urn:comunica:default:rdf-join/actors#inner-multi-smallest",bus:g}),new(r(97047).ActorQueryOperationQuadpattern)({mediatorResolveQuadPattern:M,unionDefaultGraph:!1,name:"urn:comunica:default:query-operation/actors#quadpattern",bus:y}),new(r(40810).ActorRdfResolveQuadPatternFederated)({mediatorResolveQuadPattern:M,mediatorRdfMetadataAccumulate:N,skipEmptyPatterns:!1,name:"urn:comunica:default:rdf-resolve-quad-pattern/actors#federated",bus:m}),new(r(12301).ActorInitQuery)({mediatorOptimizeQueryOperation:S,mediatorQueryOperation:L,mediatorQueryParse:O,mediatorQueryResultSerialize:E,mediatorQueryResultSerializeMediaTypeCombiner:x,mediatorQueryResultSerializeMediaTypeFormatCombiner:A,mediatorContextPreprocess:w,mediatorHttpInvalidate:F,logger:n,defaultQueryInputFormat:"sparql",allowNoSources:!1,contextKeyShortcuts:{baseIRI:"@comunica/actor-init-query:baseIRI",datetime:"@comunica/actor-http-memento:datetime",destination:"@comunica/bus-rdf-update-quads:destination",explain:"@comunica/actor-init-query:explain",extensionFunctionCreator:"@comunica/actor-init-query:extensionFunctionCreator",extensionFunctions:"@comunica/actor-init-query:extensionFunctions",fetch:"@comunica/bus-http:fetch",functionArgumentsCache:"@comunica/actor-init-query:functionArgumentsCache",httpAuth:"@comunica/bus-http:auth",httpBodyTimeout:"@comunica/bus-http:http-body-timeout",httpIncludeCredentials:"@comunica/bus-http:include-credentials",httpProxyHandler:"@comunica/actor-http-proxy:httpProxyHandler",httpRetryCount:"@comunica/bus-http:http-retry-count",httpRetryDelay:"@comunica/bus-http:http-retry-delay",httpRetryOnServerError:"@comunica/bus-http:http-retry-on-server-error",httpTimeout:"@comunica/bus-http:http-timeout",initialBindings:"@comunica/actor-init-query:initialBindings",lenient:"@comunica/actor-init-query:lenient",log:"@comunica/core:log",queryFormat:"@comunica/actor-init-query:queryFormat",queryTimestamp:"@comunica/actor-init-query:queryTimestamp",readOnly:"@comunica/bus-query-operation:readOnly",recoverBrokenLinks:"@comunica/bus-http-wayback:recover-broken-links",source:"@comunica/bus-rdf-resolve-quad-pattern:source",sources:"@comunica/bus-rdf-resolve-quad-pattern:sources",unionDefaultGraph:"@comunica/bus-query-operation:unionDefaultGraph"},name:"urn:comunica:default:init/actors#query",bus:i})),$=new(r(13125).ActionObserverHttp)({httpInvalidator:B,name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-result-serialize-sparql-json/^2.0.0/components/ActorQueryResultSerializeSparqlJson.jsonld#ActorQueryResultSerializeSparqlJson_default_observer",bus:v}),Q=new(r(93408).ActionObserverHttp)({httpInvalidator:U,name:"https://linkedsoftwaredependencies.org/bundles/npm/@comunica/actor-query-result-serialize-stats/^2.0.0/components/ActorQueryResultSerializeStats.jsonld#ActorQueryResultSerializeStats_default_observer",bus:v});new(r(17425).ActorQueryOperationSparqlEndpoint)({mediatorHttp:V,checkUrlSuffixSparql:!0,checkUrlSuffixUpdate:!0,forceHttpGet:!1,name:"urn:comunica:default:query-operation/actors#sparql-endpoint",bus:y});new(r(13125).ActorQueryResultSerializeSparqlJson)({emitMetadata:!0,httpObserver:$,mediaTypePriorities:{"application/sparql-results+json":.8},mediaTypeFormats:{"application/sparql-results+json":"http://www.w3.org/ns/formats/SPARQL_Results_JSON"},name:"urn:comunica:default:query-result-serialize/actors#sparql-json",bus:c}),new(r(93408).ActorQueryResultSerializeStats)({httpObserver:Q,mediaTypePriorities:{stats:.5},mediaTypeFormats:{stats:"https://comunica.linkeddatafragments.org/#results_stats"},name:"urn:comunica:default:query-result-serialize/actors#stats",bus:c}),e.exports=q},92017:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QueryEngine=void 0;const n=r(12301),i=r(98041);class a extends n.QueryEngineBase{constructor(e=i){super(e)}}t.QueryEngine=a},40090:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(92017),t)},41388:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},65358:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},17169:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},53846:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},19383:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},15638:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},85947:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},10766:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},63599:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},57755:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},80220:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},6841:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},9243:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},90602:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Logger=void 0;class r{static getLevelOrdinal(e){return r.LEVELS[e]}}t.Logger=r,r.LEVELS={trace:0,debug:1,info:2,warn:3,error:4,fatal:5}},42996:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(41388),t),i(r(65358),t),i(r(17169),t),i(r(53846),t),i(r(19383),t),i(r(15638),t),i(r(85947),t),i(r(10766),t),i(r(63599),t),i(r(57755),t),i(r(80220),t),i(r(6841),t),i(r(9243),t),i(r(90602),t)},62620:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fragment=void 0,t.fragment=function(e){let t=function(e){let t=e;(t.endsWith("/")||t.endsWith("#"))&&(t=t.slice(0,t.length-1));const r=[];t.lastIndexOf("/")>0&&r.push(t.lastIndexOf("/")),t.lastIndexOf("#")>0&&r.push(t.lastIndexOf("#"));const n=Math.max(...r);return t.slice(n+1)}(e);return t=t?function(e){var t;const r=null===(t=e.split(/[^a-z0-9]+/gi).filter((e=>""!==e)).map((e=>e[0].toUpperCase()+e.slice(1))).join("").match(/[a-z][a-z0-9]+/gi))||void 0===t?void 0:t[0];return void 0===r?void 0:r[0].toLowerCase()+r.slice(1)}(t):void 0,t||"v"}},35030:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.lookupAllPrefixes=t.prefixToUri=t.uriToPrefix=void 0;const i=r(62620),a=r(88993);t.uriToPrefix=function(e,t){return n(this,void 0,void 0,(function*(){let r;try{r=yield(0,a.lookupPrefix)(e,t)}catch(n){(null==t?void 0:t.mintOnUnknown)&&(r=(0,i.fragment)(e).slice(0,4))}if(void 0!==r&&"object"==typeof(null==t?void 0:t.existingPrefixes)&&r in t.existingPrefixes){let e=0;for(;`${r}${e}`in t.existingPrefixes;)e+=1;r=`${r}${e}`}return r}))},t.prefixToUri=function(e,t){return n(this,void 0,void 0,(function*(){try{return yield(0,a.lookupUri)(e,t)}catch(e){return}}))};var o=r(88993);Object.defineProperty(t,"lookupAllPrefixes",{enumerable:!0,get:function(){return o.lookupAllPrefixes}})},37338:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.fetchContext=t.fetchJson=void 0;const i=r(74945);function a(e,t){var r;return n(this,void 0,void 0,(function*(){const n=null!==(r=null==t?void 0:t.fetch)&&void 0!==r?r:i.fetch;return(yield n(e)).json()}))}t.fetchJson=a,t.fetchContext=function(e,t){return n(this,void 0,void 0,(function*(){return(yield a(e,t))["@context"]}))}},88993:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(51192),t),i(r(35535),t),i(r(45144),t)},45144:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.lookupAllPrefixes=void 0;const i=r(37338);t.lookupAllPrefixes=function(e){return n(this,void 0,void 0,(function*(){return(0,i.fetchContext)("https://prefix.cc/context",e)}))}},51192:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.lookupUri=void 0;const i=r(37338);t.lookupUri=function(e,t){return n(this,void 0,void 0,(function*(){const r=(yield(0,i.fetchContext)(`https://prefix.cc/${e}.file.jsonld`,t))[e];if("string"!=typeof r)throw new Error(`Expected uri to be a string, received: ${r} of type ${typeof r}`);return r}))}},35535:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.lookupPrefix=void 0;const i=r(37338);t.lookupPrefix=function(e,t){return n(this,void 0,void 0,(function*(){const r=new URL("https://prefix.cc/reverse");r.searchParams.append("uri",e),r.searchParams.append("format","jsonld");const n=Object.keys(yield(0,i.fetchContext)(r,t));if(0===n.length)throw new Error("No prefixes returned");return n[0]}))}},45250:(e,t,r)=>{const n=r(11472),i=r(56038),a=r(40091),o=r(56249),s=r(42211),u=r(88079),c=r(38160);e.exports=function e(t){if(!t)return null;if("BlankNode"===t.termType)return n(t);if("DefaultGraph"===t.termType)return a();if("Literal"===t.termType)return o(t);if("NamedNode"===t.termType)return s(t);if("Quad"===t.termType||t.subject&&t.predicate&&t.object&&t.graph)return u(t,e);if("Variable"===t.termType)return c(t);if(t[Symbol.iterator])return i(t,e);throw new Error(`unknown termType ${t.termType}`)}},11472:e=>{e.exports=function(e){return"_:"+e.value}},56038:e=>{e.exports=function(e,t){return[...e].map((e=>t(e))).join("\n")+"\n"}},40091:e=>{e.exports=function(){return""}},56249:(e,t,r)=>{const n=r(42211),i=/["\\\\\n\r]/,a=/["\\\\\n\r]/g,o={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function s(e){return o[e]}e.exports=function(e){const t=(r=e.value,i.test(r)?r.replace(a,s):r);var r;return"http://www.w3.org/2001/XMLSchema#string"===e.datatype.value?'"'+t+'"':"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"===e.datatype.value?'"'+t+'"@'+e.language:'"'+t+'"^^'+n(e.datatype)}},42211:e=>{e.exports=function(e){return"<"+e.value+">"}},88079:e=>{e.exports=function(e,t){const r=t(e.subject),n=t(e.predicate),i=t(e.object),a=t(e.graph);return`${r} ${n} ${i} ${a?a+" ":""}.`}},38160:e=>{e.exports=function(e){return"?"+e.value}},55201:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SaxesParser=t.EVENTS=void 0;const n=r(31487),i=r(84797),a=r(60446);var o=n.isS,s=n.isChar,u=n.isNameStartChar,c=n.isNameChar,l=n.S_LIST,d=n.NAME_RE,h=i.isChar,p=a.isNCNameStartChar,f=a.isNCNameChar,y=a.NC_NAME_RE;const g="http://www.w3.org/XML/1998/namespace",m="http://www.w3.org/2000/xmlns/",b={__proto__:null,xml:g,xmlns:m},v={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},_=-1,w=-2,T=13,S=33,O=10,E=60,x=61,A=62,R=63,I=93,N=e=>34===e||39===e,j=[34,39],D=[...j,91,A],P=[...j,E,I],C=[x,R,...l],L=[...l,A,38,E];function k(e,t,r){switch(t){case"xml":r!==g&&e.fail(`xml prefix must be bound to ${g}.`);break;case"xmlns":r!==m&&e.fail(`xmlns prefix must be bound to ${m}.`)}switch(r){case m:e.fail(""===t?`the default namespace may not be set to ${r}.`:`may not assign a prefix (even "xmlns") to the URI ${m}.`);break;case g:switch(t){case"xml":break;case"":e.fail(`the default namespace may not be set to ${r}.`);break;default:e.fail("may not assign the xml namespace to another prefix.")}}}const M=e=>y.test(e),F=e=>d.test(e);t.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];const B={xmldecl:"xmldeclHandler",text:"textHandler",processinginstruction:"piHandler",doctype:"doctypeHandler",comment:"commentHandler",opentagstart:"openTagStartHandler",attribute:"attributeHandler",opentag:"openTagHandler",closetag:"closeTagHandler",cdata:"cdataHandler",error:"errorHandler",end:"endHandler",ready:"readyHandler"};t.SaxesParser=class{get closed(){return this._closed}constructor(e){this.opt=null!=e?e:{},this.fragmentOpt=!!this.opt.fragment;const t=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=!1!==this.opt.position,this.fileName=this.opt.fileName,t){this.nameStartCheck=p,this.nameCheck=f,this.isName=M,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},b);const e=this.opt.additionalNamespaces;null!=e&&(function(e,t){for(const r of Object.keys(t))k(e,r,t[r])}(this,e),Object.assign(this.ns,e))}else this.nameStartCheck=u,this.nameCheck=c,this.isName=F,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}_init(){var e;this.openWakaBang="",this.text="",this.name="",this.piTarget="",this.entity="",this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk="",this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=0,this.attribList=[];const{fragmentOpt:t}=this;this.state=t?T:0,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=t,this.xmlDeclPossible=!t,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:r}=this.opt;if(void 0===r){if(!0===this.opt.forceXMLVersion)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");r="1.0"}this.setXMLVersion(r),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(v),null===(e=this.readyHandler)||void 0===e||e.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(e,t){this[B[e]]=t}off(e){this[B[e]]=void 0}makeError(e){var t;let r=null!==(t=this.fileName)&&void 0!==t?t:"";return this.trackPosition&&(r.length>0&&(r+=":"),r+=`${this.line}:${this.column}`),r.length>0&&(r+=": "),new Error(r+e)}fail(e){const t=this.makeError(e),r=this.errorHandler;if(void 0===r)throw t;return r(t),this}write(e){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let t=!1;null===e?(t=!0,e=""):"object"==typeof e&&(e=e.toString()),void 0!==this.carriedFromPrevious&&(e=`${this.carriedFromPrevious}${e}`,this.carriedFromPrevious=void 0);let r=e.length;const n=e.charCodeAt(r-1);!t&&(13===n||n>=55296&&n<=56319)&&(this.carriedFromPrevious=e[r-1],r--,e=e.slice(0,r));const{stateTable:i}=this;for(this.chunk=e,this.i=0;this.i=e.length)return _;const r=e.charCodeAt(t);if(this.column++,r<55296){if(r>=32||9===r)return r;switch(r){case O:return this.line++,this.column=0,this.positionAtNewLine=this.position,O;case 13:return e.charCodeAt(t+1)===O&&(this.i=t+2),this.line++,this.column=0,this.positionAtNewLine=this.position,w;default:return this.fail("disallowed character."),r}}if(r>56319)return r>=57344&&r<=65533||this.fail("disallowed character."),r;const n=65536+1024*(r-55296)+(e.charCodeAt(t+1)-56320);return this.i=t+2,n>1114111&&this.fail("disallowed character."),n}getCode11(){const{chunk:e,i:t}=this;if(this.prevI=t,this.i=t+1,t>=e.length)return _;const r=e.charCodeAt(t);if(this.column++,r<55296){if(r>31&&r<127||r>159&&8232!==r||9===r)return r;switch(r){case O:return this.line++,this.column=0,this.positionAtNewLine=this.position,O;case 13:{const r=e.charCodeAt(t+1);r!==O&&133!==r||(this.i=t+2)}case 133:case 8232:return this.line++,this.column=0,this.positionAtNewLine=this.position,w;default:return this.fail("disallowed character."),r}}if(r>56319)return r>=57344&&r<=65533||this.fail("disallowed character."),r;const n=65536+1024*(r-55296)+(e.charCodeAt(t+1)-56320);return this.i=t+2,n>1114111&&this.fail("disallowed character."),n}getCodeNorm(){const e=this.getCode();return e===w?O:e}unget(){this.i=this.prevI,this.column--}captureTo(e){let{i:t}=this;const{chunk:r}=this;for(;;){const n=this.getCode(),i=n===w,a=i?O:n;if(a===_||e.includes(a))return this.text+=r.slice(t,this.prevI),a;i&&(this.text+=`${r.slice(t,this.prevI)}\n`,t=this.i)}}captureToChar(e){let{i:t}=this;const{chunk:r}=this;for(;;){let n=this.getCode();switch(n){case w:this.text+=`${r.slice(t,this.prevI)}\n`,t=this.i,n=O;break;case _:return this.text+=r.slice(t),!1}if(n===e)return this.text+=r.slice(t,this.prevI),!0}}captureNameChars(){const{chunk:e,i:t}=this;for(;;){const r=this.getCode();if(r===_)return this.name+=e.slice(t),_;if(!c(r))return this.name+=e.slice(t,this.prevI),r===w?O:r}}skipSpaces(){for(;;){const e=this.getCodeNorm();if(e===_||!o(e))return e}}setXMLVersion(e){this.currentXMLVersion=e,"1.0"===e?(this.isChar=s,this.getCode=this.getCode10):(this.isChar=h,this.getCode=this.getCode11)}sBegin(){65279===this.chunk.charCodeAt(0)&&(this.i++,this.column++),this.state=1}sBeginWhitespace(){const e=this.i,t=this.skipSpaces();switch(this.prevI!==e&&(this.xmlDeclPossible=!1),t){case E:if(this.state=15,0!==this.text.length)throw new Error("no-empty text at start");break;case _:break;default:this.unget(),this.state=T,this.xmlDeclPossible=!1}}sDoctype(){var e;const t=this.captureTo(D);switch(t){case A:null===(e=this.doctypeHandler)||void 0===e||e.call(this,this.text),this.text="",this.state=T,this.doctype=!0;break;case _:break;default:this.text+=String.fromCodePoint(t),91===t?this.state=4:N(t)&&(this.state=3,this.q=t)}}sDoctypeQuote(){const e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.q=null,this.state=2)}sDTD(){const e=this.captureTo(P);e!==_&&(this.text+=String.fromCodePoint(e),e===I?this.state=2:e===E?this.state=6:N(e)&&(this.state=5,this.q=e))}sDTDQuoted(){const e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.state=4,this.q=null)}sDTDOpenWaka(){const e=this.getCodeNorm();switch(this.text+=String.fromCodePoint(e),e){case 33:this.state=7,this.openWakaBang="";break;case R:this.state=11;break;default:this.state=4}}sDTDOpenWakaBang(){const e=String.fromCodePoint(this.getCodeNorm()),t=this.openWakaBang+=e;this.text+=e,"-"!==t&&(this.state="--"===t?8:4,this.openWakaBang="")}sDTDComment(){this.captureToChar(45)&&(this.text+="-",this.state=9)}sDTDCommentEnding(){const e=this.getCodeNorm();this.text+=String.fromCodePoint(e),this.state=45===e?10:8}sDTDCommentEnded(){const e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===A?this.state=4:(this.fail("malformed comment."),this.state=8)}sDTDPI(){this.captureToChar(R)&&(this.text+="?",this.state=12)}sDTDPIEnding(){const e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===A&&(this.state=4)}sText(){0!==this.tags.length?this.handleTextInRoot():this.handleTextOutsideRoot()}sEntity(){let{i:e}=this;const{chunk:t}=this;e:for(;;)switch(this.getCode()){case w:this.entity+=`${t.slice(e,this.prevI)}\n`,e=this.i;break;case 59:{const{entityReturnState:r}=this,n=this.entity+t.slice(e,this.prevI);let i;this.state=r,""===n?(this.fail("empty entity name."),i="&;"):(i=this.parseEntity(n),this.entity=""),r===T&&void 0===this.textHandler||(this.text+=i);break e}case _:this.entity+=t.slice(e);break e}}sOpenWaka(){const e=this.getCode();if(u(e))this.state=34,this.unget(),this.xmlDeclPossible=!1;else switch(e){case 47:this.state=43,this.xmlDeclPossible=!1;break;case 33:this.state=16,this.openWakaBang="",this.xmlDeclPossible=!1;break;case R:this.state=23;break;default:this.fail("disallowed character in tag name"),this.state=T,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":this.sawRoot||this.reportedTextBeforeRoot||(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0),this.state=20,this.openWakaBang="";break;case"--":this.state=17,this.openWakaBang="";break;case"DOCTYPE":this.state=2,(this.doctype||this.sawRoot)&&this.fail("inappropriately located doctype declaration."),this.openWakaBang="";break;default:this.openWakaBang.length>=7&&this.fail("incorrect syntax.")}}sComment(){this.captureToChar(45)&&(this.state=18)}sCommentEnding(){var e;const t=this.getCodeNorm();45===t?(this.state=19,null===(e=this.commentHandler)||void 0===e||e.call(this,this.text),this.text=""):(this.text+=`-${String.fromCodePoint(t)}`,this.state=17)}sCommentEnded(){const e=this.getCodeNorm();e!==A?(this.fail("malformed comment."),this.text+=`--${String.fromCodePoint(e)}`,this.state=17):this.state=T}sCData(){this.captureToChar(I)&&(this.state=21)}sCDataEnding(){const e=this.getCodeNorm();e===I?this.state=22:(this.text+=`]${String.fromCodePoint(e)}`,this.state=20)}sCDataEnding2(){var e;const t=this.getCodeNorm();switch(t){case A:null===(e=this.cdataHandler)||void 0===e||e.call(this,this.text),this.text="",this.state=T;break;case I:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(t)}`,this.state=20}}sPIFirstChar(){const e=this.getCodeNorm();this.nameStartCheck(e)?(this.piTarget+=String.fromCodePoint(e),this.state=24):e===R||o(e)?(this.fail("processing instruction without a target."),this.state=e===R?26:25):(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(e),this.state=24)}sPIRest(){const{chunk:e,i:t}=this;for(;;){const r=this.getCodeNorm();if(r===_)return void(this.piTarget+=e.slice(t));if(!this.nameCheck(r)){this.piTarget+=e.slice(t,this.prevI);const n=r===R;n||o(r)?"xml"===this.piTarget?(this.xmlDeclPossible||this.fail("an XML declaration must be at the start of the document."),this.state=n?S:27):this.state=n?26:25:(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(r));break}}}sPIBody(){if(0===this.text.length){const e=this.getCodeNorm();e===R?this.state=26:o(e)||(this.text=String.fromCodePoint(e))}else this.captureToChar(R)&&(this.state=26)}sPIEnding(){var e;const t=this.getCodeNorm();if(t===A){const{piTarget:t}=this;"xml"===t.toLowerCase()&&this.fail("the XML declaration must appear at the start of the document."),null===(e=this.piHandler)||void 0===e||e.call(this,{target:t,body:this.text}),this.piTarget=this.text="",this.state=T}else t===R?this.text+="?":(this.text+=`?${String.fromCodePoint(t)}`,this.state=25);this.xmlDeclPossible=!1}sXMLDeclNameStart(){const e=this.skipSpaces();e!==R?e!==_&&(this.state=28,this.name=String.fromCodePoint(e)):this.state=S}sXMLDeclName(){const e=this.captureTo(C);if(e===R)return this.state=S,this.name+=this.text,this.text="",void this.fail("XML declaration is incomplete.");if(o(e)||e===x){if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`)}this.state=e===x?30:29}}sXMLDeclEq(){const e=this.getCodeNorm();if(e===R)return this.state=S,void this.fail("XML declaration is incomplete.");o(e)||(e!==x&&this.fail("value required."),this.state=30)}sXMLDeclValueStart(){const e=this.getCodeNorm();if(e===R)return this.state=S,void this.fail("XML declaration is incomplete.");o(e)||(N(e)?this.q=e:(this.fail("value must be quoted."),this.q=32),this.state=31)}sXMLDeclValue(){const e=this.captureTo([this.q,R]);if(e===R)return this.state=S,this.text="",void this.fail("XML declaration is incomplete.");if(e===_)return;const t=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];const e=t;this.xmlDecl.version=e,/^1\.[0-9]+$/.test(e)?this.opt.forceXMLVersion||this.setXMLVersion(e):this.fail("version number must match /^1\\.[0-9]+$/.");break}case"encoding":/^[A-Za-z][A-Za-z0-9._-]*$/.test(t)||this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/."),this.xmlDeclExpects=["standalone"],this.xmlDecl.encoding=t;break;case"standalone":"yes"!==t&&"no"!==t&&this.fail('standalone value must match "yes" or "no".'),this.xmlDeclExpects=[],this.xmlDecl.standalone=t}this.name="",this.state=32}sXMLDeclSeparator(){const e=this.getCodeNorm();e!==R?(o(e)||(this.fail("whitespace required."),this.unget()),this.state=27):this.state=S}sXMLDeclEnding(){var e;this.getCodeNorm()===A?("xml"!==this.piTarget?this.fail("processing instructions are not allowed before root."):"version"!==this.name&&this.xmlDeclExpects.includes("version")&&this.fail("XML declaration must contain a version."),null===(e=this.xmldeclHandler)||void 0===e||e.call(this,this.xmlDecl),this.name="",this.piTarget=this.text="",this.state=T):this.fail("The character ? is disallowed anywhere in XML declarations."),this.xmlDeclPossible=!1}sOpenTag(){var e;const t=this.captureNameChars();if(t===_)return;const r=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name="",this.xmlnsOpt&&(this.topNS=r.ns=Object.create(null)),null===(e=this.openTagStartHandler)||void 0===e||e.call(this,r),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail("documents may contain only one root."),t){case A:this.openTag();break;case 47:this.state=35;break;default:o(t)||this.fail("disallowed character in tag name."),this.state=36}}sOpenTagSlash(){this.getCode()===A?this.openSelfClosingTag():(this.fail("forward-slash in opening tag not followed by >."),this.state=36)}sAttrib(){const e=this.skipSpaces();e!==_&&(u(e)?(this.unget(),this.state=37):e===A?this.openTag():47===e?this.state=35:this.fail("disallowed character in attribute name."))}sAttribName(){const e=this.captureNameChars();e===x?this.state=39:o(e)?this.state=38:e===A?(this.fail("attribute without value."),this.pushAttrib(this.name,this.name),this.name=this.text="",this.openTag()):e!==_&&this.fail("disallowed character in attribute name.")}sAttribNameSawWhite(){const e=this.skipSpaces();switch(e){case _:return;case x:this.state=39;break;default:this.fail("attribute without value."),this.text="",this.name="",e===A?this.openTag():u(e)?(this.unget(),this.state=37):(this.fail("disallowed character in attribute name."),this.state=36)}}sAttribValue(){const e=this.getCodeNorm();N(e)?(this.q=e,this.state=40):o(e)||(this.fail("unquoted attribute value."),this.state=42,this.unget())}sAttribValueQuoted(){const{q:e,chunk:t}=this;let{i:r}=this;for(;;)switch(this.getCode()){case e:return this.pushAttrib(this.name,this.text+t.slice(r,this.prevI)),this.name=this.text="",this.q=null,void(this.state=41);case 38:return this.text+=t.slice(r,this.prevI),this.state=14,void(this.entityReturnState=40);case O:case w:case 9:this.text+=`${t.slice(r,this.prevI)} `,r=this.i;break;case E:return this.text+=t.slice(r,this.prevI),void this.fail("disallowed character.");case _:return void(this.text+=t.slice(r))}}sAttribValueClosed(){const e=this.getCodeNorm();o(e)?this.state=36:e===A?this.openTag():47===e?this.state=35:u(e)?(this.fail("no whitespace between attributes."),this.unget(),this.state=37):this.fail("disallowed character in attribute name.")}sAttribValueUnquoted(){const e=this.captureTo(L);switch(e){case 38:this.state=14,this.entityReturnState=42;break;case E:this.fail("disallowed character.");break;case _:break;default:this.text.includes("]]>")&&this.fail('the string "]]>" is disallowed in char data.'),this.pushAttrib(this.name,this.text),this.name=this.text="",e===A?this.openTag():this.state=36}}sCloseTag(){const e=this.captureNameChars();e===A?this.closeTag():o(e)?this.state=44:e!==_&&this.fail("disallowed character in closing tag.")}sCloseTagSawWhite(){switch(this.skipSpaces()){case A:this.closeTag();break;case _:break;default:this.fail("disallowed character in closing tag.")}}handleTextInRoot(){let{i:e,forbiddenState:t}=this;const{chunk:r,textHandler:n}=this;e:for(;;)switch(this.getCode()){case E:if(this.state=15,void 0!==n){const{text:t}=this,i=r.slice(e,this.prevI);0!==t.length?(n(t+i),this.text=""):0!==i.length&&n(i)}t=0;break e;case 38:this.state=14,this.entityReturnState=T,void 0!==n&&(this.text+=r.slice(e,this.prevI)),t=0;break e;case I:switch(t){case 0:t=1;break;case 1:t=2;break;case 2:break;default:throw new Error("impossible state")}break;case A:2===t&&this.fail('the string "]]>" is disallowed in char data.'),t=0;break;case w:void 0!==n&&(this.text+=`${r.slice(e,this.prevI)}\n`),e=this.i,t=0;break;case _:void 0!==n&&(this.text+=r.slice(e));break e;default:t=0}this.forbiddenState=t}handleTextOutsideRoot(){let{i:e}=this;const{chunk:t,textHandler:r}=this;let n=!1;e:for(;;){const i=this.getCode();switch(i){case E:if(this.state=15,void 0!==r){const{text:n}=this,i=t.slice(e,this.prevI);0!==n.length?(r(n+i),this.text=""):0!==i.length&&r(i)}break e;case 38:this.state=14,this.entityReturnState=T,void 0!==r&&(this.text+=t.slice(e,this.prevI)),n=!0;break e;case w:void 0!==r&&(this.text+=`${t.slice(e,this.prevI)}\n`),e=this.i;break;case _:void 0!==r&&(this.text+=t.slice(e));break e;default:o(i)||(n=!0)}}n&&(this.sawRoot||this.reportedTextBeforeRoot||(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0))}pushAttribNS(e,t){var r;const{prefix:n,local:i}=this.qname(e),a={name:e,prefix:n,local:i,value:t};if(this.attribList.push(a),null===(r=this.attributeHandler)||void 0===r||r.call(this,a),"xmlns"===n){const e=t.trim();"1.0"===this.currentXMLVersion&&""===e&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[i]=e,k(this,i,e)}else if("xmlns"===e){const e=t.trim();this.topNS[""]=e,k(this,"",e)}}pushAttribPlain(e,t){var r;const n={name:e,value:t};this.attribList.push(n),null===(r=this.attributeHandler)||void 0===r||r.call(this,n)}end(){var e,t;this.sawRoot||this.fail("document must contain a root element.");const{tags:r}=this;for(;r.length>0;){const e=r.pop();this.fail(`unclosed tag: ${e.name}`)}0!==this.state&&this.state!==T&&this.fail("unexpected end.");const{text:n}=this;return 0!==n.length&&(null===(e=this.textHandler)||void 0===e||e.call(this,n),this.text=""),this._closed=!0,null===(t=this.endHandler)||void 0===t||t.call(this),this._init(),this}resolve(e){var t,r;let n=this.topNS[e];if(void 0!==n)return n;const{tags:i}=this;for(let t=i.length-1;t>=0;t--)if(n=i[t].ns[e],void 0!==n)return n;return n=this.ns[e],void 0!==n?n:null===(r=(t=this.opt).resolvePrefix)||void 0===r?void 0:r.call(t,e)}qname(e){const t=e.indexOf(":");if(-1===t)return{prefix:"",local:e};const r=e.slice(t+1),n=e.slice(0,t);return(""===n||""===r||r.includes(":"))&&this.fail(`malformed name: ${e}.`),{prefix:n,local:r}}processAttribsNS(){var e;const{attribList:t}=this,r=this.tag;{const{prefix:t,local:n}=this.qname(r.name);r.prefix=t,r.local=n;const i=r.uri=null!==(e=this.resolve(t))&&void 0!==e?e:"";""!==t&&("xmlns"===t&&this.fail('tags may not have "xmlns" as prefix.'),""===i&&(this.fail(`unbound namespace prefix: ${JSON.stringify(t)}.`),r.uri=t))}if(0===t.length)return;const{attributes:n}=r,i=new Set;for(const e of t){const{name:t,prefix:r,local:a}=e;let o,s;""===r?(o="xmlns"===t?m:"",s=t):(o=this.resolve(r),void 0===o&&(this.fail(`unbound namespace prefix: ${JSON.stringify(r)}.`),o=r),s=`{${o}}${a}`),i.has(s)&&this.fail(`duplicate attribute: ${s}.`),i.add(s),e.uri=o,n[t]=e}this.attribList=[]}processAttribsPlain(){const{attribList:e}=this,t=this.tag.attributes;for(const{name:r,value:n}of e)void 0!==t[r]&&this.fail(`duplicate attribute: ${r}.`),t[r]=n;this.attribList=[]}openTag(){var e;this.processAttribs();const{tags:t}=this,r=this.tag;r.isSelfClosing=!1,null===(e=this.openTagHandler)||void 0===e||e.call(this,r),t.push(r),this.state=T,this.name=""}openSelfClosingTag(){var e,t,r;this.processAttribs();const{tags:n}=this,i=this.tag;i.isSelfClosing=!0,null===(e=this.openTagHandler)||void 0===e||e.call(this,i),null===(t=this.closeTagHandler)||void 0===t||t.call(this,i),null===(this.tag=null!==(r=n[n.length-1])&&void 0!==r?r:null)&&(this.closedRoot=!0),this.state=T,this.name=""}closeTag(){const{tags:e,name:t}=this;if(this.state=T,this.name="",""===t)return this.fail("weird empty close tag."),void(this.text+="");const r=this.closeTagHandler;let n=e.length;for(;n-- >0;){const n=this.tag=e.pop();if(this.topNS=n.ns,null==r||r(n),n.name===t)break;this.fail("unexpected close tag.")}0===n?this.closedRoot=!0:n<0&&(this.fail(`unmatched closing tag: ${t}.`),this.text+=``)}parseEntity(e){if("#"!==e[0]){const t=this.ENTITIES[e];return void 0!==t?t:(this.fail(this.isName(e)?"undefined entity.":"disallowed character in entity name."),`&${e};`)}let t=NaN;return"x"===e[1]&&/^#x[0-9a-f]+$/i.test(e)?t=parseInt(e.slice(2),16):/^#[0-9]+$/.test(e)&&(t=parseInt(e.slice(1),10)),this.isChar(t)?String.fromCodePoint(t):(this.fail("malformed character entity."),`&${e};`)}}},43364:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReadableWebToNodeStream=void 0;const n=r(19198);class i extends n.Readable{constructor(e){super(),this.bytesRead=0,this.released=!1,this.reader=e.getReader()}async _read(){if(this.released)return void this.push(null);this.pendingRead=this.reader.read();const e=await this.pendingRead;delete this.pendingRead,e.done||this.released?this.push(null):(this.bytesRead+=e.value.length,this.push(e.value))}async waitForReadToComplete(){this.pendingRead&&await this.pendingRead}async close(){await this.syncAndRelease()}async syncAndRelease(){this.released=!0,await this.waitForReadToComplete(),await this.reader.releaseLock()}}t.ReadableWebToNodeStream=i},25568:e=>{"use strict";const{AbortController:t,AbortSignal:r}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;e.exports=t,e.exports.AbortSignal=r,e.exports.default=t},87435:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){const t=[];return r=e.on("data",(e=>t.push(e))),n=t,new Promise(((e,t)=>{r.on("end",(()=>e(n))),r.on("error",t)}));var r,n}},25579:(e,t,r)=>{const n=r(2044),i=r(4518),a=r(12391),o=r(23111),s=r(32106);e.exports={DynamicNestedLoopJoin:n,HashJoin:i,NestedLoopJoin:a,SymmetricHashJoin:o,MergeStream:s}},2044:(e,t,r)=>{let n=r(75627),i=n.MultiTransformIterator,a=n.SimpleTransformIterator;e.exports=class extends i{constructor(e,t,r,n){super(e,n),this.funRight=t,this.funJoin=r}_createTransformer(e){return new a(this.funRight(e),{transform:(t,r,n)=>{let i=this.funJoin(e,t);null!==i&&n(i),r()}})}}},4518:(e,t,r)=>{let n=r(75627).AsyncIterator;e.exports=class extends n{constructor(e,t,r,n){super(),this.addedDataListener=!1,this.left=e,this.right=t,this.funHash=r,this.funJoin=n,this.leftMap=new Map,this.match=null,this.matches=[],this.matchIdx=0,this.left.on("error",(e=>this.destroy(e))),this.right.on("error",(e=>this.destroy(e))),this.readable=!1,this.left.on("end",function(){if(this.leftMap.size<=0)return this.close();this.readable=!0,this.right.on("readable",(()=>this.readable=!0)),this.right.on("end",(()=>{this.hasResults()||this._end()}))}.bind(this)),this.on("newListener",(e=>{"data"!==e||this.addedDataListener||(this.addedDataListener=!0,this._addDataListener())}))}hasResults(){return!this.right.ended||this.matchIdx{const{MultiTransformIterator:n,SimpleTransformIterator:i,scheduleTask:a}=r(75627);e.exports=class extends n{constructor(e,t,r,n){super(e,n),this.right=t,this.funJoin=r,this.on("end",(()=>this.right.close()))}_end(){super._end(),a((()=>this.right.destroy()))}_createTransformer(e){return new i(this.right.clone(),{transform:(t,r,n)=>{let i=this.funJoin(e,t);null!==i&&n(i),r()}})}}},23111:(e,t,r)=>{let n=r(75627).AsyncIterator;e.exports=class extends n{constructor(e,t,r,n){super(),this.left=e,this.right=t,this.funHash=r,this.funJoin=n,this.usedLeft=!1,this.leftMap=new Map,this.rightMap=new Map,this.on("end",(()=>this._cleanup())),this.match=null,this.matches=[],this.matchIdx=0,(this.left.readable||this.right.readable)&&(this.readable=!0),this.left.on("error",(e=>this.destroy(e))),this.right.on("error",(e=>this.destroy(e))),this.left.on("readable",(()=>this.readable=!0)),this.right.on("readable",(()=>this.readable=!0)),this.left.on("end",(()=>{this.hasResults()||this._end()})),this.right.on("end",(()=>{this.hasResults()||this._end()}))}hasResults(){return!this.left.ended||!this.right.ended||!!this.matches&&this.matchIdx{let n=r(75627).AsyncIterator;e.exports=class extends n{constructor(e){super(),Array.isArray(e)||(e=Array.prototype.slice.call(arguments)),this.streams=e;for(let t of e)t.on("readable",(()=>this.emit("readable"))),t.on("end",(()=>this._removeStream(t)));0===this.streams.length&&this.close(),this.idx=this.streams.length-1}_removeStream(e){let t=this.streams.indexOf(e);t<0||(this.streams.splice(t,1),this.idx>=this.streams.length&&--this.idx,0===this.streams.length&&this._end())}close(){super.close();for(let e of this.streams)e.close()}read(){for(let e=0;e{"use strict";t.byteLength=function(e){var t=s(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,a=s(e),o=a[0],u=a[1],c=new i(function(e,t,r){return 3*(t+r)/4-r}(0,o,u)),l=0,d=u>0?o-4:o;for(r=0;r>16&255,c[l++]=t>>8&255,c[l++]=255&t;return 2===u&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[l++]=255&t),1===u&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t),c},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],o=16383,s=0,c=n-i;sc?c:s+o));return 1===i?(t=e[n-1],a.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],a.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),a.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)r[o]=a[o],n[a.charCodeAt(o)]=o;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e,t,n){for(var i,a,o=[],s=t;s>18&63]+r[a>>12&63]+r[a>>6&63]+r[63&a]);return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},61594:function(e,t,r){var n;!function(i){"use strict";var a,o=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,s=Math.ceil,u=Math.floor,c="[BigNumber Error] ",l=c+"Number primitive has more than 15 significant digits: ",d=1e14,h=14,p=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,g=1e9;function m(e){var t=0|e;return e>0||e===t?t:t-1}function b(e){for(var t,r,n=1,i=e.length,a=e[0]+"";nc^r?1:-1;for(s=(u=i.length)<(c=a.length)?u:c,o=0;oa[o]^r?1:-1;return u==c?0:u>c^r?1:-1}function _(e,t,r,n){if(er||e!==u(e))throw Error(c+(n||"Argument")+("number"==typeof e?er?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function w(e){var t=e.c.length-1;return m(e.e/h)==t&&e.c[t]%2!=0}function T(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function S(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else tM?m.c=m.e=null:e.e=10;d/=10,c++);return void(c>M?m.c=m.e=null:(m.e=c,m.c=[e]))}g=String(e)}else{if(!o.test(g=String(e)))return i(m,g,f);m.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(c=g.indexOf("."))>-1&&(g=g.replace(".","")),(d=g.search(/e/i))>0?(c<0&&(c=d),c+=+g.slice(d+1),g=g.substring(0,d)):c<0&&(c=g.length)}else{if(_(t,2,q.length,"Base"),10==t&&$)return X(m=new Q(e),D+m.e+1,P);if(g=String(e),f="number"==typeof e){if(0*e!=0)return i(m,g,f,t);if(m.s=1/e<0?(g=g.slice(1),-1):1,Q.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(l+e)}else m.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(r=q.slice(0,t),c=d=0,y=g.length;dc){c=y;continue}}else if(!s&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){s=!0,d=-1,c=0;continue}return i(m,String(e),f,t)}f=!1,(c=(g=n(g,t,10,m.s)).indexOf("."))>-1?g=g.replace(".",""):c=g.length}for(d=0;48===g.charCodeAt(d);d++);for(y=g.length;48===g.charCodeAt(--y););if(g=g.slice(d,++y)){if(y-=d,f&&Q.DEBUG&&y>15&&(e>p||e!==u(e)))throw Error(l+m.s*e);if((c=c-d-1)>M)m.c=m.e=null;else if(c=L)?T(u,o):S(u,o,"0");else if(a=(e=X(new Q(e),t,r)).e,s=(u=b(e.c)).length,1==n||2==n&&(t<=a||a<=C)){for(;ss){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=a-s)>0)for(a+1==s&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function z(e,t){for(var r,n,i=1,a=new Q(e[0]);i=10;i/=10,n++);return(r=n+r*h-1)>M?e.c=e.e=null:r=10;c/=10,i++);if((a=t-i)<0)a+=h,o=t,l=g[p=0],y=u(l/m[i-o-1]%10);else if((p=s((a+1)/h))>=g.length){if(!n)break e;for(;g.length<=p;g.push(0));l=y=0,i=1,o=(a%=h)-h+1}else{for(l=c=g[p],i=1;c>=10;c/=10,i++);y=(o=(a%=h)-h+i)<0?0:u(l/m[i-o-1]%10)}if(n=n||t<0||null!=g[p+1]||(o<0?l:l%m[i-o-1]),n=r<4?(y||n)&&(0==r||r==(e.s<0?3:2)):y>5||5==y&&(4==r||n||6==r&&(a>0?o>0?l/m[i-o]:0:g[p-1])%10&1||r==(e.s<0?8:7)),t<1||!g[0])return g.length=0,n?(t-=e.e+1,g[0]=m[(h-t%h)%h],e.e=-t||0):g[0]=e.e=0,e;if(0==a?(g.length=p,c=1,p--):(g.length=p+1,c=m[h-a],g[p]=o>0?u(l/m[i-o]%m[o])*c:0),n)for(;;){if(0==p){for(a=1,o=g[0];o>=10;o/=10,a++);for(o=g[0]+=c,c=1;o>=10;o/=10,c++);a!=c&&(e.e++,g[0]==d&&(g[0]=1));break}if(g[p]+=c,g[p]!=d)break;g[p--]=0,c=1}for(a=g.length;0===g[--a];g.pop());}e.e>M?e.c=e.e=null:e.e=L?T(t,r):S(t,r,"0"),e.s<0?"-"+t:t)}return Q.clone=e,Q.ROUND_UP=0,Q.ROUND_DOWN=1,Q.ROUND_CEIL=2,Q.ROUND_FLOOR=3,Q.ROUND_HALF_UP=4,Q.ROUND_HALF_DOWN=5,Q.ROUND_HALF_EVEN=6,Q.ROUND_HALF_CEIL=7,Q.ROUND_HALF_FLOOR=8,Q.EUCLID=9,Q.config=Q.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(c+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(_(r=e[t],0,g,t),D=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(_(r=e[t],0,8,t),P=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(_(r[0],-g,0,t),_(r[1],0,g,t),C=r[0],L=r[1]):(_(r,-g,g,t),C=-(L=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)_(r[0],-g,-1,t),_(r[1],1,g,t),k=r[0],M=r[1];else{if(_(r,-g,g,t),!r)throw Error(c+t+" cannot be zero: "+r);k=-(M=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(c+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw F=!r,Error(c+"crypto unavailable");F=r}else F=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(_(r=e[t],0,9,t),B=r),e.hasOwnProperty(t="POW_PRECISION")&&(_(r=e[t],0,g,t),U=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(c+t+" not an object: "+r);V=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(c+t+" invalid: "+r);$="0123456789"==r.slice(0,10),q=r}}return{DECIMAL_PLACES:D,ROUNDING_MODE:P,EXPONENTIAL_AT:[C,L],RANGE:[k,M],CRYPTO:F,MODULO_MODE:B,POW_PRECISION:U,FORMAT:V,ALPHABET:q}},Q.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!Q.DEBUG)return!0;var t,r,n=e.c,i=e.e,a=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===a||-1===a)&&i>=-g&&i<=g&&i===u(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%h)<1&&(t+=h),String(n[0]).length==t){for(t=0;t=d||r!==u(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===a||1===a||-1===a))return!0;throw Error(c+"Invalid BigNumber: "+e)},Q.maximum=Q.max=function(){return z(arguments,-1)},Q.minimum=Q.min=function(){return z(arguments,1)},Q.random=(a=9007199254740992,O=Math.random()*a&2097151?function(){return u(Math.random()*a)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,a,o=0,l=[],d=new Q(j);if(null==e?e=D:_(e,0,g),i=s(e/h),F)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));o>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[o]=r[0],t[o+1]=r[1]):(l.push(a%1e14),o+=2);o=i/2}else{if(!crypto.randomBytes)throw F=!1,Error(c+"crypto unavailable");for(t=crypto.randomBytes(i*=7);o=9e15?crypto.randomBytes(7).copy(t,o):(l.push(a%1e14),o+=7);o=i/7}if(!F)for(;o=10;a/=10,o++);or-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/r|0,o[i]%=r)}return o.reverse()}return function(n,i,a,o,s){var u,c,l,d,h,p,f,y,g=n.indexOf("."),m=D,v=P;for(g>=0&&(d=U,U=0,n=n.replace(".",""),p=(y=new Q(i)).pow(n.length-g),U=d,y.c=t(S(b(p.c),p.e,"0"),10,a,e),y.e=y.c.length),l=d=(f=t(n,i,a,s?(u=q,e):(u=e,q))).length;0==f[--d];f.pop());if(!f[0])return u.charAt(0);if(g<0?--l:(p.c=f,p.e=l,p.s=o,f=(p=r(p,y,m,v,a)).c,h=p.r,l=p.e),g=f[c=l+m+1],d=a/2,h=h||c<0||null!=f[c+1],h=v<4?(null!=g||h)&&(0==v||v==(p.s<0?3:2)):g>d||g==d&&(4==v||h||6==v&&1&f[c-1]||v==(p.s<0?8:7)),c<1||!f[0])n=h?S(u.charAt(1),-m,u.charAt(0)):u.charAt(0);else{if(f.length=c,h)for(--a;++f[--c]>a;)f[c]=0,c||(++l,f=[1].concat(f));for(d=f.length;!f[--d];);for(g=0,n="";g<=d;n+=u.charAt(f[g++]));n=S(n,l,u.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,i,a,o,s=0,u=e.length,c=t%y,l=t/y|0;for(e=e.slice();u--;)s=((i=c*(a=e[u]%y)+(n=l*a+(o=e[u]/y|0)*c)%y*y+s)/r|0)+(n/y|0)+l*o,e[u]=i%r;return s&&(e=[s].concat(e)),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]1;e.splice(0,1));}return function(n,i,a,o,s){var c,l,p,f,y,g,b,v,_,w,T,S,O,E,x,A,R,I=n.s==i.s?1:-1,N=n.c,j=i.c;if(!(N&&N[0]&&j&&j[0]))return new Q(n.s&&i.s&&(N?!j||N[0]!=j[0]:j)?N&&0==N[0]||!j?0*I:I/0:NaN);for(_=(v=new Q(I)).c=[],I=a+(l=n.e-i.e)+1,s||(s=d,l=m(n.e/h)-m(i.e/h),I=I/h|0),p=0;j[p]==(N[p]||0);p++);if(j[p]>(N[p]||0)&&l--,I<0)_.push(1),f=!0;else{for(E=N.length,A=j.length,p=0,I+=2,(y=u(s/(j[0]+1)))>1&&(j=e(j,y,s),N=e(N,y,s),A=j.length,E=N.length),O=A,T=(w=N.slice(0,A)).length;T=s/2&&x++;do{if(y=0,(c=t(j,w,A,T))<0){if(S=w[0],A!=T&&(S=S*s+(w[1]||0)),(y=u(S/x))>1)for(y>=s&&(y=s-1),b=(g=e(j,y,s)).length,T=w.length;1==t(g,w,b,T);)y--,r(g,A=10;I/=10,p++);X(v,a+(v.e=p+l*h-1)+1,o,f)}else v.e=l,v.r=+f;return v}}(),E=/^(-?)0([xbo])(?=\w[\w.]*$)/i,x=/^([^.]+)\.$/,A=/^\.([^.]+)$/,R=/^-?(Infinity|NaN)$/,I=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,r,n){var i,a=r?t:t.replace(I,"");if(R.test(a))e.s=isNaN(a)?null:a<0?-1:1;else{if(!r&&(a=a.replace(E,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,a=a.replace(x,"$1").replace(A,"0.$1")),t!=a))return new Q(a,i);if(Q.DEBUG)throw Error(c+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},N.absoluteValue=N.abs=function(){var e=new Q(this);return e.s<0&&(e.s=1),e},N.comparedTo=function(e,t){return v(this,new Q(e,t))},N.decimalPlaces=N.dp=function(e,t){var r,n,i,a=this;if(null!=e)return _(e,0,g),null==t?t=P:_(t,0,8),X(new Q(a),e+a.e+1,t);if(!(r=a.c))return null;if(n=((i=r.length-1)-m(this.e/h))*h,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},N.dividedBy=N.div=function(e,t){return r(this,new Q(e,t),D,P)},N.dividedToIntegerBy=N.idiv=function(e,t){return r(this,new Q(e,t),0,1)},N.exponentiatedBy=N.pow=function(e,t){var r,n,i,a,o,l,d,p,f=this;if((e=new Q(e)).c&&!e.isInteger())throw Error(c+"Exponent not an integer: "+J(e));if(null!=t&&(t=new Q(t)),o=e.e>14,!f.c||!f.c[0]||1==f.c[0]&&!f.e&&1==f.c.length||!e.c||!e.c[0])return p=new Q(Math.pow(+J(f),o?e.s*(2-w(e)):+J(e))),t?p.mod(t):p;if(l=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new Q(NaN);(n=!l&&f.isInteger()&&t.isInteger())&&(f=f.mod(t))}else{if(e.e>9&&(f.e>0||f.e<-1||(0==f.e?f.c[0]>1||o&&f.c[1]>=24e7:f.c[0]<8e13||o&&f.c[0]<=9999975e7)))return a=f.s<0&&w(e)?-0:0,f.e>-1&&(a=1/a),new Q(l?1/a:a);U&&(a=s(U/h+2))}for(o?(r=new Q(.5),l&&(e.s=1),d=w(e)):d=(i=Math.abs(+J(e)))%2,p=new Q(j);;){if(d){if(!(p=p.times(f)).c)break;a?p.c.length>a&&(p.c.length=a):n&&(p=p.mod(t))}if(i){if(0===(i=u(i/2)))break;d=i%2}else if(X(e=e.times(r),e.e+1,1),e.e>14)d=w(e);else{if(0==(i=+J(e)))break;d=i%2}f=f.times(f),a?f.c&&f.c.length>a&&(f.c.length=a):n&&(f=f.mod(t))}return n?p:(l&&(p=j.div(p)),t?p.mod(t):a?X(p,U,P,void 0):p)},N.integerValue=function(e){var t=new Q(this);return null==e?e=P:_(e,0,8),X(t,t.e+1,e)},N.isEqualTo=N.eq=function(e,t){return 0===v(this,new Q(e,t))},N.isFinite=function(){return!!this.c},N.isGreaterThan=N.gt=function(e,t){return v(this,new Q(e,t))>0},N.isGreaterThanOrEqualTo=N.gte=function(e,t){return 1===(t=v(this,new Q(e,t)))||0===t},N.isInteger=function(){return!!this.c&&m(this.e/h)>this.c.length-2},N.isLessThan=N.lt=function(e,t){return v(this,new Q(e,t))<0},N.isLessThanOrEqualTo=N.lte=function(e,t){return-1===(t=v(this,new Q(e,t)))||0===t},N.isNaN=function(){return!this.s},N.isNegative=function(){return this.s<0},N.isPositive=function(){return this.s>0},N.isZero=function(){return!!this.c&&0==this.c[0]},N.minus=function(e,t){var r,n,i,a,o=this,s=o.s;if(t=(e=new Q(e,t)).s,!s||!t)return new Q(NaN);if(s!=t)return e.s=-t,o.plus(e);var u=o.e/h,c=e.e/h,l=o.c,p=e.c;if(!u||!c){if(!l||!p)return l?(e.s=-t,e):new Q(p?o:NaN);if(!l[0]||!p[0])return p[0]?(e.s=-t,e):new Q(l[0]?o:3==P?-0:0)}if(u=m(u),c=m(c),l=l.slice(),s=u-c){for((a=s<0)?(s=-s,i=l):(c=u,i=p),i.reverse(),t=s;t--;i.push(0));i.reverse()}else for(n=(a=(s=l.length)<(t=p.length))?s:t,s=t=0;t0)for(;t--;l[r++]=0);for(t=d-1;n>s;){if(l[--n]=0;){for(r=0,f=S[i]%_,g=S[i]/_|0,a=i+(o=u);a>i;)r=((c=f*(c=T[--o]%_)+(s=g*c+(l=T[o]/_|0)*f)%_*_+b[a]+r)/v|0)+(s/_|0)+g*l,b[a--]=c%v;b[a]=r}return r?++n:b.splice(0,1),H(e,b,n)},N.negated=function(){var e=new Q(this);return e.s=-e.s||null,e},N.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new Q(e,t)).s,!i||!t)return new Q(NaN);if(i!=t)return e.s=-t,n.minus(e);var a=n.e/h,o=e.e/h,s=n.c,u=e.c;if(!a||!o){if(!s||!u)return new Q(i/0);if(!s[0]||!u[0])return u[0]?e:new Q(s[0]?n:0*i)}if(a=m(a),o=m(o),s=s.slice(),i=a-o){for(i>0?(o=a,r=u):(i=-i,r=s),r.reverse();i--;r.push(0));r.reverse()}for((i=s.length)-(t=u.length)<0&&(r=u,u=s,s=r,t=i),i=0;t;)i=(s[--t]=s[t]+u[t]+i)/d|0,s[t]=d===s[t]?0:s[t]%d;return i&&(s=[i].concat(s),++o),H(e,s,o)},N.precision=N.sd=function(e,t){var r,n,i,a=this;if(null!=e&&e!==!!e)return _(e,1,g),null==t?t=P:_(t,0,8),X(new Q(a),e,t);if(!(r=a.c))return null;if(n=(i=r.length-1)*h+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&a.e+1>n&&(n=a.e+1),n},N.shiftedBy=function(e){return _(e,-9007199254740991,p),this.times("1e"+e)},N.squareRoot=N.sqrt=function(){var e,t,n,i,a,o=this,s=o.c,u=o.s,c=o.e,l=D+4,d=new Q("0.5");if(1!==u||!s||!s[0])return new Q(!u||u<0&&(!s||s[0])?NaN:s?o:1/0);if(0==(u=Math.sqrt(+J(o)))||u==1/0?(((t=b(s)).length+c)%2==0&&(t+="0"),u=Math.sqrt(+t),c=m((c+1)/2)-(c<0||c%2),n=new Q(t=u==1/0?"5e"+c:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+c)):n=new Q(u+""),n.c[0])for((u=(c=n.e)+l)<3&&(u=0);;)if(a=n,n=d.times(a.plus(r(o,a,l,1))),b(a.c).slice(0,u)===(t=b(n.c)).slice(0,u)){if(n.e0&&y>0){for(a=y%s||s,d=f.substr(0,a);a0&&(d+=l+f.slice(a)),p&&(d="-"+d)}n=h?d+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?h.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):h):d}return(r.prefix||"")+n+(r.suffix||"")},N.toFraction=function(e){var t,n,i,a,o,s,u,l,d,p,y,g,m=this,v=m.c;if(null!=e&&(!(u=new Q(e)).isInteger()&&(u.c||1!==u.s)||u.lt(j)))throw Error(c+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+J(u));if(!v)return new Q(m);for(t=new Q(j),d=n=new Q(j),i=l=new Q(j),g=b(v),o=t.e=g.length-m.e-1,t.c[0]=f[(s=o%h)<0?h+s:s],e=!e||u.comparedTo(t)>0?o>0?t:d:u,s=M,M=1/0,u=new Q(g),l.c[0]=0;p=r(u,t,0,1),1!=(a=n.plus(p.times(i))).comparedTo(e);)n=i,i=a,d=l.plus(p.times(a=d)),l=a,t=u.minus(p.times(a=t)),u=a;return a=r(e.minus(n),i,0,1),l=l.plus(a.times(d)),n=n.plus(a.times(i)),l.s=d.s=m.s,y=r(d,i,o*=2,P).minus(m).abs().comparedTo(r(l,n,o,P).minus(m).abs())<1?[d,i]:[l,n],M=s,y},N.toNumber=function(){return+J(this)},N.toPrecision=function(e,t){return null!=e&&_(e,1,g),G(this,e,t,2)},N.toString=function(e){var t,r=this,i=r.s,a=r.e;return null===a?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=a<=C||a>=L?T(b(r.c),a):S(b(r.c),a,"0"):10===e&&$?t=S(b((r=X(new Q(r),D+a+1,P)).c),r.e,"0"):(_(e,2,q.length,"Base"),t=n(S(b(r.c),a,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},N.valueOf=N.toJSON=function(){return J(this)},N._isBigNumber=!0,null!=t&&Q.set(t),Q}(),a.default=a.BigNumber=a,void 0===(n=function(){return a}.call(t,r,t,e))||(e.exports=n)}()},48287:(e,t,r)=>{"use strict";const n=r(67526),i=r(251),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=u,t.SlowBuffer=function(e){return+e!=e&&(e=0),u.alloc(+e)},t.INSPECT_MAX_BYTES=50;const o=2147483647;function s(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return c(e,t,r)}function c(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|y(e,t);let n=s(r);const i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(J(e,Uint8Array)){const t=new Uint8Array(e);return p(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(J(e,ArrayBuffer)||e&&J(e.buffer,ArrayBuffer))return p(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(J(e,SharedArrayBuffer)||e&&J(e.buffer,SharedArrayBuffer)))return p(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return u.from(n,t,r);const i=function(e){if(u.isBuffer(e)){const t=0|f(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||K(e.length)?s(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return u.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),s(e<0?0:0|f(e))}function h(e){const t=e.length<0?0:0|f(e.length),r=s(t);for(let n=0;n=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function y(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||J(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(e).length;default:if(i)return n?-1:z(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return N(this,t,r);case"utf8":case"utf-8":return x(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return I(this,t,r);case"base64":return E(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),K(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){let a,o=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,s/=2,u/=2,r/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){let n=-1;for(a=r;as&&(r=s-u),a=r;a>=0;a--){let r=!0;for(let n=0;ni&&(n=i):n=i;const a=t.length;let o;for(n>a/2&&(n=a/2),o=0;o>8,i=r%256,a.push(i),a.push(n);return a}(t,e.length-r),e,r,n)}function E(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function x(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+o<=r){let r,n,s,u;switch(o){case 1:t<128&&(a=t);break;case 2:r=e[i+1],128==(192&r)&&(u=(31&t)<<6|63&r,u>127&&(a=u));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(u=(15&t)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(a=u));break;case 4:r=e[i+1],n=e[i+2],s=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(u=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&s,u>65535&&u<1114112&&(a=u))}}null===a?(a=65533,o=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=o}return function(e){const t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);let r="",n=0;for(;nn.length?(u.isBuffer(t)||(t=u.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!u.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tr&&(e+=" ... "),""},a&&(u.prototype[a]=u.prototype.inspect),u.prototype.compare=function(e,t,r,n,i){if(J(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let a=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0);const s=Math.min(a,o),c=this.slice(n,i),l=e.slice(t,r);for(let e=0;e>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return _(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":case"latin1":case"binary":return T(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const A=4096;function R(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;in)&&(r=n);let i="";for(let n=t;nr)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,r,n,i,a){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function C(e,t,r,n,i){q(t,n,i,e,r,7);let a=Number(t&BigInt(4294967295));e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,r}function L(e,t,r,n,i){q(t,n,i,e,r,7);let a=Number(t&BigInt(4294967295));e[r+7]=a,a>>=8,e[r+6]=a,a>>=8,e[r+5]=a,a>>=8,e[r+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=o,o>>=8,e[r+2]=o,o>>=8,e[r+1]=o,o>>=8,e[r]=o,r+8}function k(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(e,t,r,n,a){return t=+t,r>>>=0,a||k(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function F(e,t,r,n,a){return t=+t,r>>>=0,a||k(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||D(e,t,this.length);let n=this[e],i=1,a=0;for(;++a>>=0,t>>>=0,r||D(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||D(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||D(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||D(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readBigUInt64LE=Y((function(e){$(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||Q(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||Q(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<>>=0,t>>>=0,r||D(e,t,this.length);let n=this[e],i=1,a=0;for(;++a=i&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||D(e,t,this.length);let n=t,i=1,a=this[e+--n];for(;n>0&&(i*=256);)a+=this[e+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*t)),a},u.prototype.readInt8=function(e,t){return e>>>=0,t||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||D(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){e>>>=0,t||D(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readBigInt64LE=Y((function(e){$(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||Q(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||Q(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<>>=0,t||D(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||D(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||D(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||D(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||P(this,e,t,r,Math.pow(2,8*r)-1,0);let i=1,a=0;for(this[t]=255&e;++a>>=0,r>>>=0,n||P(this,e,t,r,Math.pow(2,8*r)-1,0);let i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigUInt64LE=Y((function(e,t=0){return C(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=Y((function(e,t=0){return L(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);P(this,e,t,r,n-1,-n)}let i=0,a=1,o=0;for(this[t]=255&e;++i>>=0,!n){const n=Math.pow(2,8*r-1);P(this,e,t,r,n-1,-n)}let i=r-1,a=1,o=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/a|0)-o&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeBigInt64LE=Y((function(e,t=0){return C(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=Y((function(e,t=0){return L(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function q(e,t,r,n,i,a){if(e>r||e3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(a+1)}${n}`:`>= -(2${n} ** ${8*(a+1)-1}${n}) and < 2 ** ${8*(a+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new B.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){$(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||Q(t,e.length-(r+1))}(n,i,a)}function $(e,t){if("number"!=typeof e)throw new B.ERR_INVALID_ARG_TYPE(t,"number",e)}function Q(e,t,r){if(Math.floor(e)!==e)throw $(e,r),new B.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new B.ERR_BUFFER_OUT_OF_BOUNDS;throw new B.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}U("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),U("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),U("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=V(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=V(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const G=/[^+/0-9A-Za-z-_]/g;function z(e,t){let r;t=t||1/0;const n=e.length;let i=null;const a=[];for(let o=0;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function H(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(G,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function X(e,t,r,n){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function J(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function K(e){return e!=e}const W=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function Y(e){return"undefined"==typeof BigInt?Z:e}function Z(){throw new Error("BigInt not supported")}},82341:e=>{"use strict";e.exports=function e(t){if("number"==typeof t&&isNaN(t))throw new Error("NaN is not allowed");if("number"==typeof t&&!isFinite(t))throw new Error("Infinity is not allowed");return null===t||"object"!=typeof t?JSON.stringify(t):t.toJSON instanceof Function?e(t.toJSON()):Array.isArray(t)?`[${t.reduce(((t,r,n)=>`${t}${0===n?"":","}${e(void 0===r||"symbol"==typeof r?null:r)}`),"")}]`:`{${Object.keys(t).sort().reduce(((r,n)=>void 0===t[n]||"symbol"==typeof t[n]?r:`${r}${0===r.length?"":","}${e(n)}:${e(t[n])}`),"")}}`}},86547:function(){!function(e){!function(t){var r="URLSearchParams"in e,n="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),a="FormData"in e,o="ArrayBuffer"in e;if(o)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function c(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function h(e){this.map={},e instanceof h?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function p(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function f(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function y(e){var t=new FileReader,r=f(t);return t.readAsArrayBuffer(e),r}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:a&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():o&&i&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=g(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=p(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var e,t,r,n=p(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,r=f(t=new FileReader),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function _(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(i))}})),t}function w(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new h(t.headers),this.url=t.url||"",this._initBody(e)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},m.call(v.prototype),m.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:0,statusText:""});return e.type="error",e};var T=[301,302,303,307,308];w.redirect=function(e,t){if(-1===T.indexOf(t))throw new RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function S(e,r){return new Promise((function(n,a){var o=new v(e,r);if(o.signal&&o.signal.aborted)return a(new t.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var e,t,r={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new h,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();t.append(n,i)}})),t)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;n(new w(i,r))},s.onerror=function(){a(new TypeError("Network request failed"))},s.ontimeout=function(){a(new TypeError("Network request failed"))},s.onabort=function(){a(new t.DOMException("Aborted","AbortError"))},s.open(o.method,o.url,!0),"include"===o.credentials?s.withCredentials=!0:"omit"===o.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),o.headers.forEach((function(e,t){s.setRequestHeader(t,e)})),o.signal&&(o.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&o.signal.removeEventListener("abort",u)}),s.send(void 0===o._bodyInit?null:o._bodyInit)}))}S.polyfill=!0,e.fetch||(e.fetch=S,e.Headers=h,e.Request=v,e.Response=w),t.Headers=h,t.Request=v,t.Response=w,t.fetch=S,Object.defineProperty(t,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:this)},74945:function(e,t){var r="undefined"!=typeof self?self:this,n=function(){function e(){this.fetch=!1,this.DOMException=r.DOMException}return e.prototype=r,new e}();!function(e){!function(t){var r="URLSearchParams"in e,n="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),a="FormData"in e,o="ArrayBuffer"in e;if(o)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function c(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function h(e){this.map={},e instanceof h?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function p(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function f(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function y(e){var t=new FileReader,r=f(t);return t.readAsArrayBuffer(e),r}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:a&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():o&&i&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=g(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=p(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var e,t,r,n=p(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,r=f(t=new FileReader),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function _(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(i))}})),t}function w(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new h(t.headers),this.url=t.url||"",this._initBody(e)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},m.call(v.prototype),m.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:0,statusText:""});return e.type="error",e};var T=[301,302,303,307,308];w.redirect=function(e,t){if(-1===T.indexOf(t))throw new RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function S(e,r){return new Promise((function(n,a){var o=new v(e,r);if(o.signal&&o.signal.aborted)return a(new t.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function u(){s.abort()}s.onload=function(){var e,t,r={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new h,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();t.append(n,i)}})),t)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;n(new w(i,r))},s.onerror=function(){a(new TypeError("Network request failed"))},s.ontimeout=function(){a(new TypeError("Network request failed"))},s.onabort=function(){a(new t.DOMException("Aborted","AbortError"))},s.open(o.method,o.url,!0),"include"===o.credentials?s.withCredentials=!0:"omit"===o.credentials&&(s.withCredentials=!1),"responseType"in s&&i&&(s.responseType="blob"),o.headers.forEach((function(e,t){s.setRequestHeader(t,e)})),o.signal&&(o.signal.addEventListener("abort",u),s.onreadystatechange=function(){4===s.readyState&&o.signal.removeEventListener("abort",u)}),s.send(void 0===o._bodyInit?null:o._bodyInit)}))}S.polyfill=!0,e.fetch||(e.fetch=S,e.Headers=h,e.Request=v,e.Response=w),t.Headers=h,t.Request=v,t.Response=w,t.fetch=S,Object.defineProperty(t,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t},37007:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,a),n(r)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}y(e,t,a,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&y(e,"error",t,{once:!0})}(e,i)}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function c(e,t,r,n){var i,a,o,c;if(s(r),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),a=e._events),o=a[t]),void 0===o)o=a[t]=r,++e._eventsCount;else if("function"==typeof o?o=a[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(i=u(e))>0&&o.length>i&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,c=l,console&&console.warn&&console.warn(c)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=l.bind(n);return i.listener=r,n.wrapFn=i,i}function h(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var u=a[e];if(void 0===u)return!1;if("function"==typeof u)n(u,this,t);else{var c=u.length,l=f(u,c);for(r=0;r=0;a--)if(r[a]===t||r[a].listener===t){o=r[a].listener,i=a;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},a.prototype.listeners=function(e){return h(this,e,!0)},a.prototype.rawListeners=function(e){return h(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},a.prototype.listenerCount=p,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},29252:e=>{"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,i,a;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(i=n;0!=i--;)if(!e(t[i],r[i]))return!1;return!0}if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(i of t.entries())if(!r.has(i[0]))return!1;for(i of t.entries())if(!e(i[1],r.get(i[0])))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(i of t.entries())if(!r.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(r)){if((n=t.length)!=r.length)return!1;for(i=n;0!=i--;)if(t[i]!==r[i])return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(a=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,a[i]))return!1;for(i=n;0!=i--;){var o=a[i];if(!e(t[o],r[o]))return!1}return!0}return t!=t&&r!=r}},92603:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(59636),t)},59636:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SparqlEndpointFetcher=void 0,r(86547);const n=r(98082),i=r(916),a=r(75295),o=r(43789),s=r(43364),u=r(29014),c=r(31232);class l{constructor(e){e=e||{},this.method=e.method||"POST",this.additionalUrlParams=e.additionalUrlParams||new URLSearchParams,this.defaultHeaders=e.defaultHeaders||new Headers,this.fetchCb=e.fetch,this.sparqlJsonParser=new i.SparqlJsonParser(e),this.sparqlXmlParser=new a.SparqlXmlParser(e),this.sparqlParsers={[l.CONTENTTYPE_SPARQL_JSON]:{parseBooleanStream:e=>this.sparqlJsonParser.parseJsonBooleanStream(e),parseResultsStream:e=>this.sparqlJsonParser.parseJsonResultsStream(e)},[l.CONTENTTYPE_SPARQL_XML]:{parseBooleanStream:e=>this.sparqlXmlParser.parseXmlBooleanStream(e),parseResultsStream:e=>this.sparqlXmlParser.parseXmlResultsStream(e)}},this.timeout=e.timeout}getQueryType(e){const t=new n.Parser({sparqlStar:!0}).parse(e);return"query"===t.type?"DESCRIBE"===t.queryType?"CONSTRUCT":t.queryType:"UNKNOWN"}getUpdateTypes(e){const t=new n.Parser({sparqlStar:!0}).parse(e);if("update"===t.type){const e={};for(const r of t.updates)"type"in r?e[r.type]=!0:e[r.updateType]=!0;return e}return"UNKNOWN"}async fetchBindings(e,t){const[r,n]=await this.fetchRawStream(e,t,l.CONTENTTYPE_SPARQL),i=this.sparqlParsers[r];if(!i)throw new Error("Unknown SPARQL results content type: "+r);return i.parseResultsStream(n)}async fetchAsk(e,t){const[r,n]=await this.fetchRawStream(e,t,l.CONTENTTYPE_SPARQL),i=this.sparqlParsers[r];if(!i)throw new Error("Unknown SPARQL results content type: "+r);return i.parseBooleanStream(n)}async fetchTriples(e,t){return(await this.fetchRawStream(e,t,l.CONTENTTYPE_TURTLE))[1].pipe(new u.StreamParser({format:l.CONTENTTYPE_TURTLE}))}async fetchUpdate(e,t){const n=new(globalThis.AbortController||await Promise.resolve().then((()=>r(25568)))),i={};this.defaultHeaders.forEach(((e,t)=>{i[t]=e}));const a={method:"POST",headers:Object.assign(Object.assign({},i),{"content-type":"application/sparql-update"}),body:t,signal:n.signal};await this.handleFetchCall(e,a,{ignoreBody:!0}),n.abort()}async fetchRawStream(e,t,r){let n="POST"===this.method?e:e+"?query="+encodeURIComponent(t);const i=new Headers(this.defaultHeaders);let a;return i.append("Accept",r),"POST"===this.method?(i.append("Content-Type","application/x-www-form-urlencoded"),a=new URLSearchParams,a.set("query",t),this.additionalUrlParams.forEach(((e,t)=>{a.set(t,e)})),i.append("Content-Length",a.toString().length.toString())):""!==this.additionalUrlParams.toString()&&(n+=`&${this.additionalUrlParams.toString()}`),this.handleFetchCall(n,{headers:i,method:this.method,body:a})}async handleFetchCall(e,t,r={}){let n;if(this.timeout){const e=new AbortController;t.signal=e.signal,n=setTimeout((()=>e.abort()),this.timeout)}const i=await(this.fetchCb||fetch)(e,t);let a;clearTimeout(n),r.ignoreBody||(a=c(i.body)?i.body:new s.ReadableWebToNodeStream(i.body));let u=i.headers.get("Content-Type")||"";if(u.indexOf(";")>0&&(u=u.substr(0,u.indexOf(";"))),!i.ok){const t=/^[^?]*/u.exec(e)[0];let r="empty response";throw a&&(r=await o(a)),new Error(`Invalid SPARQL endpoint response from ${t} (HTTP status ${i.status}):\n${r}`)}return[u,a]}}l.CONTENTTYPE_SPARQL_JSON="application/sparql-results+json",l.CONTENTTYPE_SPARQL_XML="application/sparql-results+xml",l.CONTENTTYPE_SPARQL=`${l.CONTENTTYPE_SPARQL_JSON};q=1.0,${l.CONTENTTYPE_SPARQL_XML};q=0.7`,l.CONTENTTYPE_TURTLE="text/turtle",t.SparqlEndpointFetcher=l},33826:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(70297),t),i(r(3062),t),i(r(65183),t),i(r(91475),t),i(r(97480),t)},3062:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Converter=void 0;const i=r(80425),a=r(70297),o=r(2307),s=r(65183),u=r(97480);class c{constructor(e){(e=e||{}).variableDelimiter=e.variableDelimiter||"_",e.expressionVariableCounter=e.expressionVariableCounter||0,this.util=new u.Util(e),this.initializeNodeHandlers(e)}static registerNodeHandlers(e,t){e.registerNodeHandler(new a.NodeHandlerDocument(e,t)),e.registerNodeHandler(new a.NodeHandlerDefinitionOperation(e,t)),e.registerNodeHandler(new a.NodeHandlerDefinitionFragment(e,t)),e.registerNodeHandler(new a.NodeHandlerSelectionFragmentSpread(e,t)),e.registerNodeHandler(new a.NodeHandlerSelectionInlineFragment(e,t)),e.registerNodeHandler(new a.NodeHandlerSelectionField(e,t))}static registerNodeValueHandlers(e,t){e.registerNodeValueHandler(new a.NodeValueHandlerVariable(e,t)),e.registerNodeValueHandler(new a.NodeValueHandlerInt(e,t)),e.registerNodeValueHandler(new a.NodeValueHandlerFloat(e,t)),e.registerNodeValueHandler(new a.NodeValueHandlerString(e,t)),e.registerNodeValueHandler(new a.NodeValueHandlerBoolean(e,t)),e.registerNodeValueHandler(new a.NodeValueHandlerNull(e,t)),e.registerNodeValueHandler(new a.NodeValueHandlerEnum(e,t)),e.registerNodeValueHandler(new a.NodeValueHandlerList(e,t)),e.registerNodeValueHandler(new a.NodeValueHandlerObject(e,t))}static registerDirectiveNodeHandlers(e,t){e.registerDirectiveNodeHandler(new o.DirectiveNodeHandlerInclude(e,t)),e.registerDirectiveNodeHandler(new o.DirectiveNodeHandlerOptional(e,t)),e.registerDirectiveNodeHandler(new o.DirectiveNodeHandlerPlural(e,t)),e.registerDirectiveNodeHandler(new o.DirectiveNodeHandlerSingle(e,t)),e.registerDirectiveNodeHandler(new o.DirectiveNodeHandlerSkip(e,t))}graphqlToSparqlAlgebra(e,t,r){return n(this,void 0,void 0,(function*(){return this.graphqlToSparqlAlgebraRawContext(e,yield this.util.contextParser.parse(t),r)}))}graphqlToSparqlAlgebraRawContext(e,t,r){r=r||{};const n="string"==typeof e?(0,i.parse)(e):e,a={context:t,fragmentDefinitions:this.indexFragments(n),graph:this.util.dataFactory.defaultGraph(),path:[],singularizeState:s.SingularizeState.PLURAL,singularizeVariables:r.singularizeVariables||{},subject:null,terminalVariables:[],variablesDict:r.variablesDict||{},variablesMetaDict:{}};return this.util.handleNode(n,a)}indexFragments(e){const t={},r=[];for(const n of e.definitions)"FragmentDefinition"===n.kind?t[n.name.value]=n:r.push(n);return e.definitions=r,t}initializeNodeHandlers(e){c.registerNodeHandlers(this.util,e),c.registerNodeValueHandlers(this.util,e),c.registerDirectiveNodeHandlers(this.util,e)}}t.Converter=c},65183:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.SingularizeState=void 0,(r=t.SingularizeState||(t.SingularizeState={}))[r.SINGLE=0]="SINGLE",r[r.PLURAL=1]="PLURAL"},91475:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},97480:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Util=void 0;const n=r(47793),i=r(42395),a=r(96331);t.Util=class{constructor(e){this.nodeHandlers={},this.nodeValueHandlers={},this.directiveNodeHandlers={},this.settings=e,this.dataFactory=e.dataFactory||new n.DataFactory,this.operationFactory=new a.Factory(this.dataFactory),this.contextParser=new i.ContextParser}registerNodeHandler(e){this.nodeHandlers[e.targetKind]=e}registerNodeValueHandler(e){this.nodeValueHandlers[e.targetKind]=e}registerDirectiveNodeHandler(e){this.directiveNodeHandlers[e.targetKind]=e}handleNode(e,t){const r=this.nodeHandlers[e.kind];if(!r)throw new Error(`Unsupported GraphQL node '${e.kind}'`);return r.handle(e,t)}handleNodeValue(e,t,r){const n=this.nodeValueHandlers[e.kind];if(!n)throw new Error(`Unsupported GraphQL value node '${e.kind}'`);return n.handle(e,t,r)}handleDirectiveNode(e,t){const r=this.directiveNodeHandlers[e.directive.name.value];return r?r.handle(e,t):null}joinOperations(e){if(1===e.length)return e[0];const t=[],r=[];for(const n of e)"bgp"===n.type?t.push(n):r.push(n);if(t.length===e.length)return this.joinOperationsAsBgp(t);if(t.length===e.length-1&&"leftjoin"===r[0].type&&"bgp"===r[0].input[0].type){const e=r[0];return t.push(e.input[0]),this.operationFactory.createLeftJoin(this.joinOperationsAsBgp(t),e.input[1])}return r.length===e.length?this.joinOperationsAsNestedJoin(r):this.joinOperationsAsNestedJoin([this.joinOperationsAsBgp(t),this.joinOperationsAsNestedJoin(r)])}joinOperationsAsBgp(e){return this.operationFactory.createBgp([].concat.apply([],e.map((e=>e.patterns))))}joinOperationsAsNestedJoin(e){return this.operationFactory.createJoin(e)}appendFieldToPath(e,t){return e.concat([t])}getFieldLabel(e){return(e.alias?e.alias:e.name).value}nameToVariable(e,t){return this.dataFactory.variable((t.path.length?t.path.join(this.settings.variableDelimiter)+this.settings.variableDelimiter:"")+e)}valueToNamedNode(e,t){const r=t.expandTerm(e,!0);if(this.settings.requireContext&&!r)throw new Error("No context entry was found for "+e);return this.dataFactory.namedNode(r||e)}getArgument(e,t){if(e)for(const r of e)if(r.name.value===t)return r}newTypePattern(e,t,r){return this.operationFactory.createPattern(e,this.dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),this.valueToNamedNode(t.name.value,r.context),r.graph)}createQuadPattern(e,t,r,n,i){const a=this.valueToNamedNode(t.value,i);return i&&i.getContextRaw()[t.value]&&i.getContextRaw()[t.value]["@reverse"]?this.operationFactory.createPattern(r,a,e,n):this.operationFactory.createPattern(e,a,r,n)}createQuadPath(e,t,r,n,i,a){const o=this.valueToNamedNode(t.value,a);let s=this.operationFactory.createLink(o);for(const e of r.values){if("EnumValue"!==e.kind)throw new Error("Invalid value type for 'alt' argument, must be EnumValue, but got "+e.kind);s=this.operationFactory.createAlt([s,this.operationFactory.createLink(this.valueToNamedNode(e.value,a))])}return a&&a.getContextRaw()[t.value]&&a.getContextRaw()[t.value]["@reverse"]?this.operationFactory.createPath(n,s,e,i):this.operationFactory.createPath(e,s,n,i)}}},75566:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeHandlerAdapter=void 0,t.NodeHandlerAdapter=class{constructor(e,t,r){this.targetKind=e,this.util=t,this.settings=r}getNodeQuadContextSelectionSet(e,t,r){const n={};if(e)for(const t of e.selections)if("Field"===t.kind){const e=t;this.handleNodeQuadContextField(e,r,n,"id","subject"),this.handleNodeQuadContextField(e,r,n,"graph","graph")}return n}handleNodeQuadContextField(e,t,r,n,i){if(!r[i]&&e.name.value===n){if(!r[i]){const a=this.util.getArgument(e.arguments,"_");if(a){const o=this.util.handleNodeValue(a.value,e.name.value,t);if(1!==o.terms.length)throw new Error(`Only single values can be set as ${n}, but got ${o.terms.length} at ${e.name.value}`);r[i]=o.terms[0],o.auxiliaryPatterns&&(r.auxiliaryPatterns||(r.auxiliaryPatterns=[]),r.auxiliaryPatterns.concat(o.auxiliaryPatterns))}}if(!r[i]){const n=this.util.nameToVariable(this.util.getFieldLabel(e),t);t.terminalVariables.push(n),r[i]=n}}}getDirectiveOutputs(e,t,r){const n=[];if(e)for(const i of e){const e=this.util.handleDirectiveNode({directive:i,fieldLabel:t},r);if(e){if(e.ignore)return null;n.push(e)}}return n}handleDirectiveOutputs(e,t){for(const r of e){if(r.ignore)return this.util.operationFactory.createBgp([]);r.operationOverrider&&(t=r.operationOverrider(t))}return t}}},66337:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeHandlerDefinitionAdapter=void 0;const n=r(75566);class i extends n.NodeHandlerAdapter{constructor(e,t,r){super(e,t,r)}}t.NodeHandlerDefinitionAdapter=i},13260:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeHandlerDefinitionFragment=void 0;const n=r(66337);class i extends n.NodeHandlerDefinitionAdapter{constructor(e,t){super("FragmentDefinition",e,t)}handle(e,t){throw new Error("Illegal state: fragment definitions must be indexed and removed before processing")}}t.NodeHandlerDefinitionFragment=i},91891:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeHandlerDefinitionOperation=void 0;const n=r(66337);class i extends n.NodeHandlerDefinitionAdapter{constructor(e,t){super("OperationDefinition",e,t)}handle(e,t){if("query"!==e.operation)throw new Error("Unsupported definition operation: "+e.operation);if(e.variableDefinitions)for(const r of e.variableDefinitions){const e=r.variable.name.value;r.defaultValue&&(t.variablesDict[e]||(t.variablesDict[e]=r.defaultValue));let n=r.type;const i="NonNullType"===n.kind;i&&(n=n.type);const a="ListType"===n.kind;a&&(n=n.type);const o=n.name.value;t.variablesMetaDict[e]={mandatory:i,list:a,type:o}}const r=this.getDirectiveOutputs(e.directives,e.name?e.name.value:"",t);if(!r)return this.util.operationFactory.createBgp([]);const n=this.util.joinOperations(e.selectionSet.selections.map((e=>this.util.handleNode(e,t))));return this.handleDirectiveOutputs(r,n)}}t.NodeHandlerDefinitionOperation=i},98960:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeHandlerDocument=void 0;const n=r(96331),i=r(75566);class a extends i.NodeHandlerAdapter{constructor(e,t){super("Document",e,t)}handle(e,t){const r=e.definitions.map((e=>{const r=this.getNodeQuadContextDefinitionNode(e,Object.assign(Object.assign({},t),{ignoreUnknownVariables:!0})),n=Object.assign(Object.assign({},t),{graph:r.graph||t.graph,subject:r.subject||this.util.dataFactory.blankNode()});let i=this.util.handleNode(e,n);return r&&r.auxiliaryPatterns&&(i=this.util.joinOperations([i,this.util.operationFactory.createBgp(r.auxiliaryPatterns)])),i})),n=this.util.operationFactory.createProject(1===r.length?r[0]:this.util.operationFactory.createUnion(r),t.terminalVariables);return this.translateBlankNodesToVariables(n)}getNodeQuadContextDefinitionNode(e,t){if("OperationDefinition"===e.kind)return this.getNodeQuadContextSelectionSet(e.selectionSet,e.name?e.name.value:"",t);throw new Error(`Unsupported definition: ${e.kind}`)}translateBlankNodesToVariables(e){const t=this,r={},i=Array.from(e.variables).reduce(((e,t)=>(e[t.value]=!0,e)),{});return n.Util.mapOperation(e,{path:(e,t)=>({recurse:!1,result:t.createPath(a(e.subject),e.predicate,a(e.object),a(e.graph))}),pattern:(e,t)=>({recurse:!1,result:t.createPattern(a(e.subject),a(e.predicate),a(e.object),a(e.graph))})});function a(e){if("BlankNode"===e.termType){let a=r[e.value];return a||(a=n.Util.createUniqueVariable(e.value,i,t.util.dataFactory),i[a.value]=!0,r[e.value]=a),a}return e}}}t.NodeHandlerDocument=a},53284:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeHandlerSelectionAdapter=void 0;const n=r(96331),i=r(65183),a=r(75566);class o extends a.NodeHandlerAdapter{constructor(e,t,r){super(e,t,r)}getNodeQuadContextFieldNode(e,t,r){return this.getNodeQuadContextSelectionSet(e.selectionSet,t,Object.assign(Object.assign({},r),{path:this.util.appendFieldToPath(r.path,t)}))}fieldToOperation(e,t,r,a){const o=r;let s,u=0;if(("id"===t.name.value||"graph"===t.name.value)&&(r=!1,t.arguments))for(const r of t.arguments)"_"===r.name.value&&this.util.handleNodeValue(r.value,t.name.value,e);const c=this.util.getFieldLabel(t);if(e.singularizeState===i.SingularizeState.SINGLE&&(e.singularizeVariables[this.util.nameToVariable(c,e).value]=!0),r){const t=this.handleMetaField(e,c,a);if(t)return t}const l=a?[this.util.operationFactory.createBgp(a)]:[],d=this.getNodeQuadContextFieldNode(t,c,e);let h=d.subject||this.util.nameToVariable(c,e),p=d.graph||e.graph;d.auxiliaryPatterns&&l.push(this.util.operationFactory.createBgp(d.auxiliaryPatterns));let f=!0,y=null;if(r&&t.arguments&&t.arguments.length)for(const n of t.arguments){if("_"===n.name.value){const i=this.util.handleNodeValue(n.value,t.name.value,e);y=i.terms,l.push(this.util.operationFactory.createBgp(i.terms.map((r=>this.util.createQuadPattern(e.subject,t.name,r,e.graph,e.context))))),i.auxiliaryPatterns&&l.push(this.util.operationFactory.createBgp(i.auxiliaryPatterns)),r=!1;break}if("graph"===n.name.value){const r=this.util.handleNodeValue(n.value,t.name.value,e);if(1!==r.terms.length)throw new Error(`Only single values can be set as graph, but got ${r.terms.length} at ${t.name.value}`);p=r.terms[0],e=Object.assign(Object.assign({},e),{graph:p}),r.auxiliaryPatterns&&l.push(this.util.operationFactory.createBgp(r.auxiliaryPatterns));break}if("alt"===n.name.value){let r=n.value;"ListValue"!==r.kind&&(r={kind:"ListValue",values:[r]}),l.push(this.util.createQuadPath(e.subject,t.name,r,h,e.graph,e.context)),f=!1;break}}if(r&&f&&l.push(this.util.operationFactory.createBgp([this.util.createQuadPattern(e.subject,t.name,h,e.graph,e.context)])),t.arguments&&t.arguments.length)for(const r of t.arguments)if("_"===r.name.value||"graph"===r.name.value||"alt"===r.name.value);else if("first"===r.name.value){if("IntValue"!==r.value.kind)throw new Error("Invalid value type for 'first' argument: "+r.value.kind);s=parseInt(r.value.value,10)}else if("offset"===r.name.value){if("IntValue"!==r.value.kind)throw new Error("Invalid value type for 'offset' argument: "+r.value.kind);u=parseInt(r.value.value,10)}else{const t=this.util.handleNodeValue(r.value,r.name.value,e);l.push(this.util.operationFactory.createBgp(t.terms.map((t=>this.util.createQuadPattern(h,r.name,t,e.graph,e.context))))),t.auxiliaryPatterns&&l.push(this.util.operationFactory.createBgp(t.auxiliaryPatterns))}const g=this.getDirectiveOutputs(t.directives,c,e);if(!g)return this.util.operationFactory.createBgp([]);let m=this.util.joinOperations(l);if(t.selectionSet&&t.selectionSet.selections.length){if(y){if(1!==y.length)throw new Error(`Only single values can be set as id, but got ${y.length} at ${t.name.value}`);h=y[0]}const r=Object.assign(Object.assign(Object.assign({},e),o?{path:this.util.appendFieldToPath(e.path,c)}:{}),{graph:p,subject:o?h:e.subject});let n=!1;const i=t.selectionSet.selections.filter((e=>"Field"!==e.kind||"totalCount"!==e.name.value||(n=!0,!1)));let a=this.util.joinOperations(l.concat(i.map((e=>this.util.handleNode(e,r)))));if(n){const t=this.util.dataFactory.variable("var"+this.settings.expressionVariableCounter++),r=this.util.dataFactory.variable(h.value+this.settings.variableDelimiter+"totalCount"),n=this.util.operationFactory.createBoundAggregate(t,"count",this.util.operationFactory.createTermExpression(h),!1),o=this.util.operationFactory.createProject(this.util.operationFactory.createExtend(this.util.operationFactory.createGroup(m,[],[n]),r,this.util.operationFactory.createTermExpression(t)),[r]);e.terminalVariables.push(r),a=i.length?this.util.operationFactory.createJoin([this.util.operationFactory.createProject(a,[]),o]):o}m=a}else r&&"Variable"===h.termType&&e.terminalVariables.push(h);return(u||s)&&(m=this.util.operationFactory.createSlice(this.util.operationFactory.createProject(m,n.Util.inScopeVariables(m)),u,s)),this.handleDirectiveOutputs(g,m)}handleMetaField(e,t,r){if("__typename"===t){const n=this.util.nameToVariable(t,e);return e.terminalVariables.push(n),this.util.operationFactory.createBgp([this.util.operationFactory.createPattern(e.subject,this.util.dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),this.util.nameToVariable(t,e),e.graph)].concat(r||[]))}}}t.NodeHandlerSelectionAdapter=o},89275:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeHandlerSelectionField=void 0;const n=r(53284);class i extends n.NodeHandlerSelectionAdapter{constructor(e,t){super("Field",e,t)}handle(e,t){return this.fieldToOperation(t,e,!0)}}t.NodeHandlerSelectionField=i},16332:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeHandlerSelectionFragmentSpread=void 0;const n=r(53284);class i extends n.NodeHandlerSelectionAdapter{constructor(e,t){super("FragmentSpread",e,t)}handle(e,t){const r=t.fragmentDefinitions[e.name.value];if(!r)throw new Error("Undefined fragment definition: "+e.name.value);const n={alias:void 0,arguments:void 0,directives:r.directives,kind:"Field",name:e.name,selectionSet:r.selectionSet},i=[this.util.newTypePattern(t.subject,r.typeCondition,t)];return this.util.operationFactory.createLeftJoin(this.util.operationFactory.createBgp([]),this.fieldToOperation(t,n,!1,i))}}t.NodeHandlerSelectionFragmentSpread=i},29638:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeHandlerSelectionInlineFragment=void 0;const n=r(53284);class i extends n.NodeHandlerSelectionAdapter{constructor(e,t){super("InlineFragment",e,t)}handle(e,t){const r={alias:void 0,arguments:void 0,directives:e.directives,kind:"Field",name:{kind:"Name",value:t.subject.value},selectionSet:e.selectionSet},n=e.typeCondition?[this.util.newTypePattern(t.subject,e.typeCondition,t)]:[];return this.util.operationFactory.createLeftJoin(this.util.operationFactory.createBgp([]),this.fieldToOperation(t,r,!1,n))}}t.NodeHandlerSelectionInlineFragment=i},67797:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DirectiveNodeHandlerAdapter=void 0,t.DirectiveNodeHandlerAdapter=class{constructor(e,t,r){this.targetKind=e,this.util=t,this.settings=r}getDirectiveConditionalValue(e,t){const r=this.util.getArgument(e.arguments,"if");if(!r)throw new Error(`The directive ${e.name.value} is missing an if-argument.`);const n=this.util.handleNodeValue(r.value,r.name.value,t);if(1!==n.terms.length)throw new Error(`Can not apply the directive ${e.name.value} with a list.`);return n.terms[0]}isDirectiveScopeAll(e){const t=this.util.getArgument(e.arguments,"scope");return t&&"EnumValue"===t.value.kind&&"all"===t.value.value}}},85506:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DirectiveNodeHandlerInclude=void 0;const n=r(67797);class i extends n.DirectiveNodeHandlerAdapter{constructor(e,t){super("include",e,t)}handle(e,t){const r=this.getDirectiveConditionalValue(e.directive,t);return"Literal"===r.termType&&"false"===r.value?{ignore:!0}:{}}}t.DirectiveNodeHandlerInclude=i},53992:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DirectiveNodeHandlerOptional=void 0;const n=r(67797);class i extends n.DirectiveNodeHandlerAdapter{constructor(e,t){super("optional",e,t)}handle(e,t){return{operationOverrider:e=>this.util.operationFactory.createLeftJoin(this.util.operationFactory.createBgp([]),e)}}}t.DirectiveNodeHandlerOptional=i},95570:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DirectiveNodeHandlerPlural=void 0;const n=r(65183),i=r(67797);class a extends i.DirectiveNodeHandlerAdapter{constructor(e,t){super("plural",e,t)}handle(e,t){return this.isDirectiveScopeAll(e.directive)&&(t.singularizeState=n.SingularizeState.PLURAL),delete t.singularizeVariables[this.util.nameToVariable(e.fieldLabel,t).value],{}}}t.DirectiveNodeHandlerPlural=a},15064:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DirectiveNodeHandlerSingle=void 0;const n=r(65183),i=r(67797);class a extends i.DirectiveNodeHandlerAdapter{constructor(e,t){super("single",e,t)}handle(e,t){return this.isDirectiveScopeAll(e.directive)&&(t.singularizeState=n.SingularizeState.SINGLE),t.singularizeVariables[this.util.nameToVariable(e.fieldLabel,t).value]=!0,{}}}t.DirectiveNodeHandlerSingle=a},30879:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DirectiveNodeHandlerSkip=void 0;const n=r(67797);class i extends n.DirectiveNodeHandlerAdapter{constructor(e,t){super("skip",e,t)}handle(e,t){const r=this.getDirectiveConditionalValue(e.directive,t);return"Literal"===r.termType&&"true"===r.value?{ignore:!0}:{}}}t.DirectiveNodeHandlerSkip=i},2307:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(67797),t),i(r(85506),t),i(r(53992),t),i(r(95570),t),i(r(15064),t),i(r(30879),t)},70297:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(2307),t),i(r(4391),t),i(r(75566),t),i(r(66337),t),i(r(13260),t),i(r(91891),t),i(r(98960),t),i(r(53284),t),i(r(89275),t),i(r(16332),t),i(r(29638),t)},55009:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeValueHandlerAdapter=void 0,t.NodeValueHandlerAdapter=class{constructor(e,t,r){this.targetKind=e,this.util=t,this.settings=r}}},22910:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeValueHandlerBoolean=void 0;const n=r(55009);class i extends n.NodeValueHandlerAdapter{constructor(e,t){super("BooleanValue",e,t),this.datatype=this.util.dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#boolean")}handle(e,t,r){return{terms:[this.util.dataFactory.literal(e.value?"true":"false",this.datatype)]}}}t.NodeValueHandlerBoolean=i},67057:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeValueHandlerEnum=void 0;const n=r(55009);class i extends n.NodeValueHandlerAdapter{constructor(e,t){super("EnumValue",e,t)}handle(e,t,r){return{terms:[this.util.valueToNamedNode(e.value,r.context)]}}}t.NodeValueHandlerEnum=i},968:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeValueHandlerFloat=void 0;const n=r(55009);class i extends n.NodeValueHandlerAdapter{constructor(e,t){super("FloatValue",e,t),this.datatype=this.util.dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#float")}handle(e,t,r){return{terms:[this.util.dataFactory.literal(e.value,this.datatype)]}}}t.NodeValueHandlerFloat=i},1463:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeValueHandlerInt=void 0;const n=r(55009);class i extends n.NodeValueHandlerAdapter{constructor(e,t){super("IntValue",e,t),this.datatype=this.util.dataFactory.namedNode("http://www.w3.org/2001/XMLSchema#integer")}handle(e,t,r){return{terms:[this.util.dataFactory.literal(e.value,this.datatype)]}}}t.NodeValueHandlerInt=i},57044:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeValueHandlerList=void 0;const n=r(55009);class i extends n.NodeValueHandlerAdapter{constructor(e,t){super("ListValue",e,t),this.nodeFirst=this.util.dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#first"),this.nodeRest=this.util.dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"),this.nodeNil=this.util.dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil")}handle(e,t,r){const n=[];let i=[];for(const a of e.values){const e=this.util.handleNodeValue(a,t,r);for(const t of e.terms)n.push(t);e.auxiliaryPatterns&&(i=i.concat(e.auxiliaryPatterns))}if(this.settings.arraysToRdfLists){const e=this.util.dataFactory.blankNode();let t=e,a=n.length;for(const e of n){i.push(this.util.operationFactory.createPattern(t,this.nodeFirst,e,r.graph));const n=0==--a?this.nodeNil:this.util.dataFactory.blankNode();i.push(this.util.operationFactory.createPattern(t,this.nodeRest,n,r.graph)),t=n}return{terms:[e],auxiliaryPatterns:i}}return{terms:n,auxiliaryPatterns:i}}}t.NodeValueHandlerList=i},13381:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeValueHandlerNull=void 0;const n=r(55009);class i extends n.NodeValueHandlerAdapter{constructor(e,t){super("NullValue",e,t),this.nil=this.util.dataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil")}handle(e,t,r){return{terms:[this.nil]}}}t.NodeValueHandlerNull=i},89339:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeValueHandlerObject=void 0;const n=r(55009);class i extends n.NodeValueHandlerAdapter{constructor(e,t){super("ObjectValue",e,t)}handle(e,t,r){const n=this.util.dataFactory.blankNode();let i=[];for(const a of e.fields){const e=this.util.handleNodeValue(a.value,t,r);for(const t of e.terms)i.push(this.util.createQuadPattern(n,a.name,t,r.graph,r.context));e.auxiliaryPatterns&&(i=i.concat(e.auxiliaryPatterns))}return{terms:[n],auxiliaryPatterns:i}}}t.NodeValueHandlerObject=i},86085:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeValueHandlerString=void 0;const n=r(55009);class i extends n.NodeValueHandlerAdapter{constructor(e,t){super("StringValue",e,t)}handle(e,t,r){const n=r.context.getContextRaw()[t];let i,a;return n&&"string"!=typeof n&&(n["@language"]?i=n["@language"]:n["@type"]&&(a=this.util.dataFactory.namedNode(n["@type"]))),{terms:[this.util.dataFactory.literal(e.value,i||a)]}}}t.NodeValueHandlerString=i},62784:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeValueHandlerVariable=void 0;const n=r(55009);class i extends n.NodeValueHandlerAdapter{constructor(e,t){super("Variable",e,t)}handle(e,t,r){const n=e.name.value,i=r.variablesDict[n],a=r.variablesMetaDict[n];if(!i){if(r.ignoreUnknownVariables||a&&!a.mandatory){const e=this.util.dataFactory.variable(n);return r.terminalVariables.map((e=>e.value)).indexOf(n)<0&&r.terminalVariables.push(e),{terms:[e]}}throw new Error(`Undefined variable: ${n}`)}if("Variable"===i.kind)throw new Error(`Variable refers to another variable: ${n}`);if(a)if(a.list){if("ListValue"!==i.kind)throw new Error(`Expected a list, but got ${i.kind} for ${n}`);if(a.type){const e=i;for(const t of e.values)if(t.kind!==a.type)throw new Error(`Expected ${a.type}, but got ${t.kind} for ${n}`)}}else a.type;return this.util.handleNodeValue(i,t,r)}}t.NodeValueHandlerVariable=i},4391:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(55009),t),i(r(22910),t),i(r(67057),t),i(r(968),t),i(r(1463),t),i(r(57044),t),i(r(13381),t),i(r(89339),t),i(r(86085),t),i(r(62784),t)},61702:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.printError=w,t.GraphQLError=void 0;var i,a=(i=r(55569))&&i.__esModule?i:{default:i},o=r(25888),s=r(99530),u=r(40825);function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(e,t){for(var r=0;r0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=o&&o.stack?(Object.defineProperty(p(b),"stack",{value:o.stack,writable:!0,configurable:!0}),h(b)):(Error.captureStackTrace?Error.captureStackTrace(p(b),f):Object.defineProperty(p(b),"stack",{value:Error().stack,writable:!0,configurable:!0}),b)}return n=f,(i=[{key:"toString",value:function(){return w(this)}},{key:o.SYMBOL_TO_STRING_TAG,get:function(){return"Object"}}])&&d(n.prototype,i),f}(f(Error));function _(e){return void 0===e||0===e.length?void 0:e}function w(e){var t=e.message;if(e.nodes)for(var r=0,n=e.nodes;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.syntaxError=function(e,t,r){return new n.GraphQLError("Syntax Error: ".concat(r),void 0,e,[t])};var n=r(61702)},63580:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.prototype.toJSON;"function"==typeof t||(0,n.default)(0),e.prototype.inspect=t,i.default&&(e.prototype[i.default]=t)};var n=a(r(61321)),i=a(r(98493));function a(e){return e&&e.__esModule?e:{default:e}}},93028:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(!Boolean(e))throw new Error(t)}},29657:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return u(e,[])};var n,i=(n=r(98493))&&n.__esModule?n:{default:n};function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}var o=10,s=2;function u(e,t){switch(a(e)){case"string":return JSON.stringify(e);case"function":return e.name?"[function ".concat(e.name,"]"):"[function]";case"object":return null===e?"null":function(e,t){if(-1!==t.indexOf(e))return"[Circular]";var r=[].concat(t,[e]),n=function(e){var t=e[String(i.default)];return"function"==typeof t?t:"function"==typeof e.inspect?e.inspect:void 0}(e);if(void 0!==n){var a=n.call(e);if(a!==e)return"string"==typeof a?a:u(a,r)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>s)return"[Array]";for(var r=Math.min(o,e.length),n=e.length-r,i=[],a=0;a1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}(e,r);return function(e,t){var r=Object.keys(e);return 0===r.length?"{}":t.length>s?"["+function(e){var t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){var r=e.constructor.name;if("string"==typeof r&&""!==r)return r}return t}(e)+"]":"{ "+r.map((function(r){return r+": "+u(e[r],t)})).join(", ")+" }"}(e,r)}(e,t);default:return String(e)}}},79527:(e,t,r)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,(n=r(29657))&&n.__esModule;t.default=function(e,t){return e instanceof t}},61321:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(!Boolean(e))throw new Error(null!=t?t:"Unexpected invariant triggered.")}},55569:(e,t)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return"object"==r(e)&&null!==e}},98493:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):void 0;t.default=r},76257:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isNode=function(e){return null!=e&&"string"==typeof e.kind},t.Token=t.Location=void 0;var n,i=(n=r(63580))&&n.__esModule?n:{default:n},a=function(){function e(e,t,r){this.start=e.start,this.end=t.end,this.startToken=e,this.endToken=t,this.source=r}return e.prototype.toJSON=function(){return{start:this.start,end:this.end}},e}();t.Location=a,(0,i.default)(a);var o=function(){function e(e,t,r,n,i,a,o){this.kind=e,this.start=t,this.end=r,this.line=n,this.column=i,this.value=o,this.prev=a,this.next=null}return e.prototype.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},e}();t.Token=o,(0,i.default)(o)},69165:(e,t)=>{"use strict";function r(e){for(var t=0;to&&r(t[s-1]);)--s;return t.slice(o,s).join("\n")},t.getBlockStringIndentation=n,t.printBlockString=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=-1===e.indexOf("\n"),i=" "===e[0]||"\t"===e[0],a='"'===e[e.length-1],o="\\"===e[e.length-1],s=!n||a||o||r,u="";return!s||n&&i||(u+="\n"+t),u+=t?e.replace(/\n/g,"\n"+t):e,s&&(u+="\n"),'"""'+u.replace(/"""/g,'\\"""')+'"""'}},5919:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DirectiveLocation=void 0;var r=Object.freeze({QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION"});t.DirectiveLocation=r},80425:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Source",{enumerable:!0,get:function(){return n.Source}}),Object.defineProperty(t,"getLocation",{enumerable:!0,get:function(){return i.getLocation}}),Object.defineProperty(t,"printLocation",{enumerable:!0,get:function(){return a.printLocation}}),Object.defineProperty(t,"printSourceLocation",{enumerable:!0,get:function(){return a.printSourceLocation}}),Object.defineProperty(t,"Kind",{enumerable:!0,get:function(){return o.Kind}}),Object.defineProperty(t,"TokenKind",{enumerable:!0,get:function(){return s.TokenKind}}),Object.defineProperty(t,"Lexer",{enumerable:!0,get:function(){return u.Lexer}}),Object.defineProperty(t,"parse",{enumerable:!0,get:function(){return c.parse}}),Object.defineProperty(t,"parseValue",{enumerable:!0,get:function(){return c.parseValue}}),Object.defineProperty(t,"parseType",{enumerable:!0,get:function(){return c.parseType}}),Object.defineProperty(t,"print",{enumerable:!0,get:function(){return l.print}}),Object.defineProperty(t,"visit",{enumerable:!0,get:function(){return d.visit}}),Object.defineProperty(t,"visitInParallel",{enumerable:!0,get:function(){return d.visitInParallel}}),Object.defineProperty(t,"getVisitFn",{enumerable:!0,get:function(){return d.getVisitFn}}),Object.defineProperty(t,"BREAK",{enumerable:!0,get:function(){return d.BREAK}}),Object.defineProperty(t,"Location",{enumerable:!0,get:function(){return h.Location}}),Object.defineProperty(t,"Token",{enumerable:!0,get:function(){return h.Token}}),Object.defineProperty(t,"isDefinitionNode",{enumerable:!0,get:function(){return p.isDefinitionNode}}),Object.defineProperty(t,"isExecutableDefinitionNode",{enumerable:!0,get:function(){return p.isExecutableDefinitionNode}}),Object.defineProperty(t,"isSelectionNode",{enumerable:!0,get:function(){return p.isSelectionNode}}),Object.defineProperty(t,"isValueNode",{enumerable:!0,get:function(){return p.isValueNode}}),Object.defineProperty(t,"isTypeNode",{enumerable:!0,get:function(){return p.isTypeNode}}),Object.defineProperty(t,"isTypeSystemDefinitionNode",{enumerable:!0,get:function(){return p.isTypeSystemDefinitionNode}}),Object.defineProperty(t,"isTypeDefinitionNode",{enumerable:!0,get:function(){return p.isTypeDefinitionNode}}),Object.defineProperty(t,"isTypeSystemExtensionNode",{enumerable:!0,get:function(){return p.isTypeSystemExtensionNode}}),Object.defineProperty(t,"isTypeExtensionNode",{enumerable:!0,get:function(){return p.isTypeExtensionNode}}),Object.defineProperty(t,"DirectiveLocation",{enumerable:!0,get:function(){return f.DirectiveLocation}});var n=r(46876),i=r(99530),a=r(40825),o=r(7030),s=r(73038),u=r(46083),c=r(50246),l=r(70585),d=r(9111),h=r(76257),p=r(39187),f=r(5919)},7030:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Kind=void 0;var r=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});t.Kind=r},46083:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isPunctuatorTokenKind=function(e){return e===a.TokenKind.BANG||e===a.TokenKind.DOLLAR||e===a.TokenKind.AMP||e===a.TokenKind.PAREN_L||e===a.TokenKind.PAREN_R||e===a.TokenKind.SPREAD||e===a.TokenKind.COLON||e===a.TokenKind.EQUALS||e===a.TokenKind.AT||e===a.TokenKind.BRACKET_L||e===a.TokenKind.BRACKET_R||e===a.TokenKind.BRACE_L||e===a.TokenKind.PIPE||e===a.TokenKind.BRACE_R},t.Lexer=void 0;var n=r(51352),i=r(76257),a=r(73038),o=r(69165),s=function(){function e(e){var t=new i.Token(a.TokenKind.SOF,0,0,0,0,null);this.source=e,this.lastToken=t,this.token=t,this.line=1,this.lineStart=0}var t=e.prototype;return t.advance=function(){return this.lastToken=this.token,this.token=this.lookahead()},t.lookahead=function(){var e=this.token;if(e.kind!==a.TokenKind.EOF)do{var t;e=null!==(t=e.next)&&void 0!==t?t:e.next=c(this,e)}while(e.kind===a.TokenKind.COMMENT);return e},e}();function u(e){return isNaN(e)?a.TokenKind.EOF:e<127?JSON.stringify(String.fromCharCode(e)):'"\\u'.concat(("00"+e.toString(16).toUpperCase()).slice(-4),'"')}function c(e,t){for(var r=e.source,o=r.body,s=o.length,u=t.end;u31||9===s));return new i.Token(a.TokenKind.COMMENT,t,c,r,n,o,u.slice(t+1,c))}function h(e,t,r,o,s,c){var l=e.body,d=r,h=t,f=!1;if(45===d&&(d=l.charCodeAt(++h)),48===d){if((d=l.charCodeAt(++h))>=48&&d<=57)throw(0,n.syntaxError)(e,h,"Invalid number, unexpected digit after 0: ".concat(u(d),"."))}else h=p(e,h,d),d=l.charCodeAt(h);if(46===d&&(f=!0,d=l.charCodeAt(++h),h=p(e,h,d),d=l.charCodeAt(h)),69!==d&&101!==d||(f=!0,43!==(d=l.charCodeAt(++h))&&45!==d||(d=l.charCodeAt(++h)),h=p(e,h,d),d=l.charCodeAt(h)),46===d||function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122}(d))throw(0,n.syntaxError)(e,h,"Invalid number, expected digit but got: ".concat(u(d),"."));return new i.Token(f?a.TokenKind.FLOAT:a.TokenKind.INT,t,h,o,s,c,l.slice(t,h))}function p(e,t,r){var i=e.body,a=t,o=r;if(o>=48&&o<=57){do{o=i.charCodeAt(++a)}while(o>=48&&o<=57);return a}throw(0,n.syntaxError)(e,a,"Invalid number, expected digit but got: ".concat(u(o),"."))}function f(e,t,r,o,s){for(var c,l,d,h,p=e.body,f=t+1,y=f,m=0,b="";f=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function m(e,t,r,n,o){for(var s=e.body,u=s.length,c=t+1,l=0;c!==u&&!isNaN(l=s.charCodeAt(c))&&(95===l||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122);)++c;return new i.Token(a.TokenKind.NAME,t,c,r,n,o,s.slice(t,c))}t.Lexer=s},99530:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getLocation=function(e,t){for(var r,n=/\r\n|[\n\r]/g,i=1,a=t+1;(r=n.exec(e.body))&&r.index{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parse=function(e,t){return new l(e,t).parseDocument()},t.parseValue=function(e,t){var r=new l(e,t);r.expectToken(o.TokenKind.SOF);var n=r.parseValueLiteral(!1);return r.expectToken(o.TokenKind.EOF),n},t.parseType=function(e,t){var r=new l(e,t);r.expectToken(o.TokenKind.SOF);var n=r.parseTypeReference();return r.expectToken(o.TokenKind.EOF),n},t.Parser=void 0;var n=r(51352),i=r(7030),a=r(76257),o=r(73038),s=r(46876),u=r(5919),c=r(46083),l=function(){function e(e,t){var r=(0,s.isSource)(e)?e:new s.Source(e);this._lexer=new c.Lexer(r),this._options=t}var t=e.prototype;return t.parseName=function(){var e=this.expectToken(o.TokenKind.NAME);return{kind:i.Kind.NAME,value:e.value,loc:this.loc(e)}},t.parseDocument=function(){var e=this._lexer.token;return{kind:i.Kind.DOCUMENT,definitions:this.many(o.TokenKind.SOF,this.parseDefinition,o.TokenKind.EOF),loc:this.loc(e)}},t.parseDefinition=function(){if(this.peek(o.TokenKind.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(o.TokenKind.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},t.parseOperationDefinition=function(){var e=this._lexer.token;if(this.peek(o.TokenKind.BRACE_L))return{kind:i.Kind.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(e)};var t,r=this.parseOperationType();return this.peek(o.TokenKind.NAME)&&(t=this.parseName()),{kind:i.Kind.OPERATION_DEFINITION,operation:r,name:t,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseOperationType=function(){var e=this.expectToken(o.TokenKind.NAME);switch(e.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(e)},t.parseVariableDefinitions=function(){return this.optionalMany(o.TokenKind.PAREN_L,this.parseVariableDefinition,o.TokenKind.PAREN_R)},t.parseVariableDefinition=function(){var e=this._lexer.token;return{kind:i.Kind.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(o.TokenKind.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(o.TokenKind.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(e)}},t.parseVariable=function(){var e=this._lexer.token;return this.expectToken(o.TokenKind.DOLLAR),{kind:i.Kind.VARIABLE,name:this.parseName(),loc:this.loc(e)}},t.parseSelectionSet=function(){var e=this._lexer.token;return{kind:i.Kind.SELECTION_SET,selections:this.many(o.TokenKind.BRACE_L,this.parseSelection,o.TokenKind.BRACE_R),loc:this.loc(e)}},t.parseSelection=function(){return this.peek(o.TokenKind.SPREAD)?this.parseFragment():this.parseField()},t.parseField=function(){var e,t,r=this._lexer.token,n=this.parseName();return this.expectOptionalToken(o.TokenKind.COLON)?(e=n,t=this.parseName()):t=n,{kind:i.Kind.FIELD,alias:e,name:t,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(o.TokenKind.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(r)}},t.parseArguments=function(e){var t=e?this.parseConstArgument:this.parseArgument;return this.optionalMany(o.TokenKind.PAREN_L,t,o.TokenKind.PAREN_R)},t.parseArgument=function(){var e=this._lexer.token,t=this.parseName();return this.expectToken(o.TokenKind.COLON),{kind:i.Kind.ARGUMENT,name:t,value:this.parseValueLiteral(!1),loc:this.loc(e)}},t.parseConstArgument=function(){var e=this._lexer.token;return{kind:i.Kind.ARGUMENT,name:this.parseName(),value:(this.expectToken(o.TokenKind.COLON),this.parseValueLiteral(!0)),loc:this.loc(e)}},t.parseFragment=function(){var e=this._lexer.token;this.expectToken(o.TokenKind.SPREAD);var t=this.expectOptionalKeyword("on");return!t&&this.peek(o.TokenKind.NAME)?{kind:i.Kind.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(e)}:{kind:i.Kind.INLINE_FRAGMENT,typeCondition:t?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(e)}},t.parseFragmentDefinition=function(){var e,t=this._lexer.token;return this.expectKeyword("fragment"),!0===(null===(e=this._options)||void 0===e?void 0:e.experimentalFragmentVariables)?{kind:i.Kind.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(t)}:{kind:i.Kind.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(t)}},t.parseFragmentName=function(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()},t.parseValueLiteral=function(e){var t=this._lexer.token;switch(t.kind){case o.TokenKind.BRACKET_L:return this.parseList(e);case o.TokenKind.BRACE_L:return this.parseObject(e);case o.TokenKind.INT:return this._lexer.advance(),{kind:i.Kind.INT,value:t.value,loc:this.loc(t)};case o.TokenKind.FLOAT:return this._lexer.advance(),{kind:i.Kind.FLOAT,value:t.value,loc:this.loc(t)};case o.TokenKind.STRING:case o.TokenKind.BLOCK_STRING:return this.parseStringLiteral();case o.TokenKind.NAME:switch(this._lexer.advance(),t.value){case"true":return{kind:i.Kind.BOOLEAN,value:!0,loc:this.loc(t)};case"false":return{kind:i.Kind.BOOLEAN,value:!1,loc:this.loc(t)};case"null":return{kind:i.Kind.NULL,loc:this.loc(t)};default:return{kind:i.Kind.ENUM,value:t.value,loc:this.loc(t)}}case o.TokenKind.DOLLAR:if(!e)return this.parseVariable()}throw this.unexpected()},t.parseStringLiteral=function(){var e=this._lexer.token;return this._lexer.advance(),{kind:i.Kind.STRING,value:e.value,block:e.kind===o.TokenKind.BLOCK_STRING,loc:this.loc(e)}},t.parseList=function(e){var t=this,r=this._lexer.token;return{kind:i.Kind.LIST,values:this.any(o.TokenKind.BRACKET_L,(function(){return t.parseValueLiteral(e)}),o.TokenKind.BRACKET_R),loc:this.loc(r)}},t.parseObject=function(e){var t=this,r=this._lexer.token;return{kind:i.Kind.OBJECT,fields:this.any(o.TokenKind.BRACE_L,(function(){return t.parseObjectField(e)}),o.TokenKind.BRACE_R),loc:this.loc(r)}},t.parseObjectField=function(e){var t=this._lexer.token,r=this.parseName();return this.expectToken(o.TokenKind.COLON),{kind:i.Kind.OBJECT_FIELD,name:r,value:this.parseValueLiteral(e),loc:this.loc(t)}},t.parseDirectives=function(e){for(var t=[];this.peek(o.TokenKind.AT);)t.push(this.parseDirective(e));return t},t.parseDirective=function(e){var t=this._lexer.token;return this.expectToken(o.TokenKind.AT),{kind:i.Kind.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(e),loc:this.loc(t)}},t.parseTypeReference=function(){var e,t=this._lexer.token;return this.expectOptionalToken(o.TokenKind.BRACKET_L)?(e=this.parseTypeReference(),this.expectToken(o.TokenKind.BRACKET_R),e={kind:i.Kind.LIST_TYPE,type:e,loc:this.loc(t)}):e=this.parseNamedType(),this.expectOptionalToken(o.TokenKind.BANG)?{kind:i.Kind.NON_NULL_TYPE,type:e,loc:this.loc(t)}:e},t.parseNamedType=function(){var e=this._lexer.token;return{kind:i.Kind.NAMED_TYPE,name:this.parseName(),loc:this.loc(e)}},t.parseTypeSystemDefinition=function(){var e=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(e.kind===o.TokenKind.NAME)switch(e.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(e)},t.peekDescription=function(){return this.peek(o.TokenKind.STRING)||this.peek(o.TokenKind.BLOCK_STRING)},t.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},t.parseSchemaDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("schema");var r=this.parseDirectives(!0),n=this.many(o.TokenKind.BRACE_L,this.parseOperationTypeDefinition,o.TokenKind.BRACE_R);return{kind:i.Kind.SCHEMA_DEFINITION,description:t,directives:r,operationTypes:n,loc:this.loc(e)}},t.parseOperationTypeDefinition=function(){var e=this._lexer.token,t=this.parseOperationType();this.expectToken(o.TokenKind.COLON);var r=this.parseNamedType();return{kind:i.Kind.OPERATION_TYPE_DEFINITION,operation:t,type:r,loc:this.loc(e)}},t.parseScalarTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("scalar");var r=this.parseName(),n=this.parseDirectives(!0);return{kind:i.Kind.SCALAR_TYPE_DEFINITION,description:t,name:r,directives:n,loc:this.loc(e)}},t.parseObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("type");var r=this.parseName(),n=this.parseImplementsInterfaces(),a=this.parseDirectives(!0),o=this.parseFieldsDefinition();return{kind:i.Kind.OBJECT_TYPE_DEFINITION,description:t,name:r,interfaces:n,directives:a,fields:o,loc:this.loc(e)}},t.parseImplementsInterfaces=function(){var e;if(!this.expectOptionalKeyword("implements"))return[];if(!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLImplementsInterfaces)){var t=[];this.expectOptionalToken(o.TokenKind.AMP);do{t.push(this.parseNamedType())}while(this.expectOptionalToken(o.TokenKind.AMP)||this.peek(o.TokenKind.NAME));return t}return this.delimitedMany(o.TokenKind.AMP,this.parseNamedType)},t.parseFieldsDefinition=function(){var e;return!0===(null===(e=this._options)||void 0===e?void 0:e.allowLegacySDLEmptyFields)&&this.peek(o.TokenKind.BRACE_L)&&this._lexer.lookahead().kind===o.TokenKind.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(o.TokenKind.BRACE_L,this.parseFieldDefinition,o.TokenKind.BRACE_R)},t.parseFieldDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),r=this.parseName(),n=this.parseArgumentDefs();this.expectToken(o.TokenKind.COLON);var a=this.parseTypeReference(),s=this.parseDirectives(!0);return{kind:i.Kind.FIELD_DEFINITION,description:t,name:r,arguments:n,type:a,directives:s,loc:this.loc(e)}},t.parseArgumentDefs=function(){return this.optionalMany(o.TokenKind.PAREN_L,this.parseInputValueDef,o.TokenKind.PAREN_R)},t.parseInputValueDef=function(){var e=this._lexer.token,t=this.parseDescription(),r=this.parseName();this.expectToken(o.TokenKind.COLON);var n,a=this.parseTypeReference();this.expectOptionalToken(o.TokenKind.EQUALS)&&(n=this.parseValueLiteral(!0));var s=this.parseDirectives(!0);return{kind:i.Kind.INPUT_VALUE_DEFINITION,description:t,name:r,type:a,defaultValue:n,directives:s,loc:this.loc(e)}},t.parseInterfaceTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("interface");var r=this.parseName(),n=this.parseImplementsInterfaces(),a=this.parseDirectives(!0),o=this.parseFieldsDefinition();return{kind:i.Kind.INTERFACE_TYPE_DEFINITION,description:t,name:r,interfaces:n,directives:a,fields:o,loc:this.loc(e)}},t.parseUnionTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("union");var r=this.parseName(),n=this.parseDirectives(!0),a=this.parseUnionMemberTypes();return{kind:i.Kind.UNION_TYPE_DEFINITION,description:t,name:r,directives:n,types:a,loc:this.loc(e)}},t.parseUnionMemberTypes=function(){return this.expectOptionalToken(o.TokenKind.EQUALS)?this.delimitedMany(o.TokenKind.PIPE,this.parseNamedType):[]},t.parseEnumTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("enum");var r=this.parseName(),n=this.parseDirectives(!0),a=this.parseEnumValuesDefinition();return{kind:i.Kind.ENUM_TYPE_DEFINITION,description:t,name:r,directives:n,values:a,loc:this.loc(e)}},t.parseEnumValuesDefinition=function(){return this.optionalMany(o.TokenKind.BRACE_L,this.parseEnumValueDefinition,o.TokenKind.BRACE_R)},t.parseEnumValueDefinition=function(){var e=this._lexer.token,t=this.parseDescription(),r=this.parseName(),n=this.parseDirectives(!0);return{kind:i.Kind.ENUM_VALUE_DEFINITION,description:t,name:r,directives:n,loc:this.loc(e)}},t.parseInputObjectTypeDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("input");var r=this.parseName(),n=this.parseDirectives(!0),a=this.parseInputFieldsDefinition();return{kind:i.Kind.INPUT_OBJECT_TYPE_DEFINITION,description:t,name:r,directives:n,fields:a,loc:this.loc(e)}},t.parseInputFieldsDefinition=function(){return this.optionalMany(o.TokenKind.BRACE_L,this.parseInputValueDef,o.TokenKind.BRACE_R)},t.parseTypeSystemExtension=function(){var e=this._lexer.lookahead();if(e.kind===o.TokenKind.NAME)switch(e.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(e)},t.parseSchemaExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var t=this.parseDirectives(!0),r=this.optionalMany(o.TokenKind.BRACE_L,this.parseOperationTypeDefinition,o.TokenKind.BRACE_R);if(0===t.length&&0===r.length)throw this.unexpected();return{kind:i.Kind.SCHEMA_EXTENSION,directives:t,operationTypes:r,loc:this.loc(e)}},t.parseScalarTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var t=this.parseName(),r=this.parseDirectives(!0);if(0===r.length)throw this.unexpected();return{kind:i.Kind.SCALAR_TYPE_EXTENSION,name:t,directives:r,loc:this.loc(e)}},t.parseObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var t=this.parseName(),r=this.parseImplementsInterfaces(),n=this.parseDirectives(!0),a=this.parseFieldsDefinition();if(0===r.length&&0===n.length&&0===a.length)throw this.unexpected();return{kind:i.Kind.OBJECT_TYPE_EXTENSION,name:t,interfaces:r,directives:n,fields:a,loc:this.loc(e)}},t.parseInterfaceTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var t=this.parseName(),r=this.parseImplementsInterfaces(),n=this.parseDirectives(!0),a=this.parseFieldsDefinition();if(0===r.length&&0===n.length&&0===a.length)throw this.unexpected();return{kind:i.Kind.INTERFACE_TYPE_EXTENSION,name:t,interfaces:r,directives:n,fields:a,loc:this.loc(e)}},t.parseUnionTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var t=this.parseName(),r=this.parseDirectives(!0),n=this.parseUnionMemberTypes();if(0===r.length&&0===n.length)throw this.unexpected();return{kind:i.Kind.UNION_TYPE_EXTENSION,name:t,directives:r,types:n,loc:this.loc(e)}},t.parseEnumTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var t=this.parseName(),r=this.parseDirectives(!0),n=this.parseEnumValuesDefinition();if(0===r.length&&0===n.length)throw this.unexpected();return{kind:i.Kind.ENUM_TYPE_EXTENSION,name:t,directives:r,values:n,loc:this.loc(e)}},t.parseInputObjectTypeExtension=function(){var e=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var t=this.parseName(),r=this.parseDirectives(!0),n=this.parseInputFieldsDefinition();if(0===r.length&&0===n.length)throw this.unexpected();return{kind:i.Kind.INPUT_OBJECT_TYPE_EXTENSION,name:t,directives:r,fields:n,loc:this.loc(e)}},t.parseDirectiveDefinition=function(){var e=this._lexer.token,t=this.parseDescription();this.expectKeyword("directive"),this.expectToken(o.TokenKind.AT);var r=this.parseName(),n=this.parseArgumentDefs(),a=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var s=this.parseDirectiveLocations();return{kind:i.Kind.DIRECTIVE_DEFINITION,description:t,name:r,arguments:n,repeatable:a,locations:s,loc:this.loc(e)}},t.parseDirectiveLocations=function(){return this.delimitedMany(o.TokenKind.PIPE,this.parseDirectiveLocation)},t.parseDirectiveLocation=function(){var e=this._lexer.token,t=this.parseName();if(void 0!==u.DirectiveLocation[t.value])return t;throw this.unexpected(e)},t.loc=function(e){var t;if(!0!==(null===(t=this._options)||void 0===t?void 0:t.noLocation))return new a.Location(e,this._lexer.lastToken,this._lexer.source)},t.peek=function(e){return this._lexer.token.kind===e},t.expectToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t;throw(0,n.syntaxError)(this._lexer.source,t.start,"Expected ".concat(h(e),", found ").concat(d(t),"."))},t.expectOptionalToken=function(e){var t=this._lexer.token;if(t.kind===e)return this._lexer.advance(),t},t.expectKeyword=function(e){var t=this._lexer.token;if(t.kind!==o.TokenKind.NAME||t.value!==e)throw(0,n.syntaxError)(this._lexer.source,t.start,'Expected "'.concat(e,'", found ').concat(d(t),"."));this._lexer.advance()},t.expectOptionalKeyword=function(e){var t=this._lexer.token;return t.kind===o.TokenKind.NAME&&t.value===e&&(this._lexer.advance(),!0)},t.unexpected=function(e){var t=null!=e?e:this._lexer.token;return(0,n.syntaxError)(this._lexer.source,t.start,"Unexpected ".concat(d(t),"."))},t.any=function(e,t,r){this.expectToken(e);for(var n=[];!this.expectOptionalToken(r);)n.push(t.call(this));return n},t.optionalMany=function(e,t,r){if(this.expectOptionalToken(e)){var n=[];do{n.push(t.call(this))}while(!this.expectOptionalToken(r));return n}return[]},t.many=function(e,t,r){this.expectToken(e);var n=[];do{n.push(t.call(this))}while(!this.expectOptionalToken(r));return n},t.delimitedMany=function(e,t){this.expectOptionalToken(e);var r=[];do{r.push(t.call(this))}while(this.expectOptionalToken(e));return r},e}();function d(e){var t=e.value;return h(e.kind)+(null!=t?' "'.concat(t,'"'):"")}function h(e){return(0,c.isPunctuatorTokenKind)(e)?'"'.concat(e,'"'):e}t.Parser=l},39187:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isDefinitionNode=function(e){return i(e)||a(e)||s(e)},t.isExecutableDefinitionNode=i,t.isSelectionNode=function(e){return e.kind===n.Kind.FIELD||e.kind===n.Kind.FRAGMENT_SPREAD||e.kind===n.Kind.INLINE_FRAGMENT},t.isValueNode=function(e){return e.kind===n.Kind.VARIABLE||e.kind===n.Kind.INT||e.kind===n.Kind.FLOAT||e.kind===n.Kind.STRING||e.kind===n.Kind.BOOLEAN||e.kind===n.Kind.NULL||e.kind===n.Kind.ENUM||e.kind===n.Kind.LIST||e.kind===n.Kind.OBJECT},t.isTypeNode=function(e){return e.kind===n.Kind.NAMED_TYPE||e.kind===n.Kind.LIST_TYPE||e.kind===n.Kind.NON_NULL_TYPE},t.isTypeSystemDefinitionNode=a,t.isTypeDefinitionNode=o,t.isTypeSystemExtensionNode=s,t.isTypeExtensionNode=u;var n=r(7030);function i(e){return e.kind===n.Kind.OPERATION_DEFINITION||e.kind===n.Kind.FRAGMENT_DEFINITION}function a(e){return e.kind===n.Kind.SCHEMA_DEFINITION||o(e)||e.kind===n.Kind.DIRECTIVE_DEFINITION}function o(e){return e.kind===n.Kind.SCALAR_TYPE_DEFINITION||e.kind===n.Kind.OBJECT_TYPE_DEFINITION||e.kind===n.Kind.INTERFACE_TYPE_DEFINITION||e.kind===n.Kind.UNION_TYPE_DEFINITION||e.kind===n.Kind.ENUM_TYPE_DEFINITION||e.kind===n.Kind.INPUT_OBJECT_TYPE_DEFINITION}function s(e){return e.kind===n.Kind.SCHEMA_EXTENSION||u(e)}function u(e){return e.kind===n.Kind.SCALAR_TYPE_EXTENSION||e.kind===n.Kind.OBJECT_TYPE_EXTENSION||e.kind===n.Kind.INTERFACE_TYPE_EXTENSION||e.kind===n.Kind.UNION_TYPE_EXTENSION||e.kind===n.Kind.ENUM_TYPE_EXTENSION||e.kind===n.Kind.INPUT_OBJECT_TYPE_EXTENSION}},40825:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.printLocation=function(e){return i(e.source,(0,n.getLocation)(e.source,e.start))},t.printSourceLocation=i;var n=r(99530);function i(e,t){var r=e.locationOffset.column-1,n=o(r)+e.body,i=t.line-1,s=e.locationOffset.line-1,u=t.line+s,c=1===t.line?r:0,l=t.column+c,d="".concat(e.name,":").concat(u,":").concat(l,"\n"),h=n.split(/\r\n|[\n\r]/g),p=h[i];if(p.length>120){for(var f=Math.floor(l/80),y=l%80,g=[],m=0;m{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.print=function(e){return(0,n.visit)(e,{leave:a})};var n=r(9111),i=r(69165),a={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return s(e.definitions,"\n\n")+"\n"},OperationDefinition:function(e){var t=e.operation,r=e.name,n=c("(",s(e.variableDefinitions,", "),")"),i=s(e.directives," "),a=e.selectionSet;return r||i||n||"query"!==t?s([t,s([r,n]),i,a]," "):a},VariableDefinition:function(e){var t=e.variable,r=e.type,n=e.defaultValue,i=e.directives;return t+": "+r+c(" = ",n)+c(" ",s(i," "))},SelectionSet:function(e){return u(e.selections)},Field:function(e){var t=e.alias,r=e.name,n=e.arguments,i=e.directives,a=e.selectionSet,o=c("",t,": ")+r,u=o+c("(",s(n,", "),")");return u.length>80&&(u=o+c("(\n",l(s(n,"\n")),"\n)")),s([u,s(i," "),a]," ")},Argument:function(e){return e.name+": "+e.value},FragmentSpread:function(e){return"..."+e.name+c(" ",s(e.directives," "))},InlineFragment:function(e){var t=e.typeCondition,r=e.directives,n=e.selectionSet;return s(["...",c("on ",t),s(r," "),n]," ")},FragmentDefinition:function(e){var t=e.name,r=e.typeCondition,n=e.variableDefinitions,i=e.directives,a=e.selectionSet;return"fragment ".concat(t).concat(c("(",s(n,", "),")")," ")+"on ".concat(r," ").concat(c("",s(i," ")," "))+a},IntValue:function(e){return e.value},FloatValue:function(e){return e.value},StringValue:function(e,t){var r=e.value;return e.block?(0,i.printBlockString)(r,"description"===t?"":" "):JSON.stringify(r)},BooleanValue:function(e){return e.value?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){return e.value},ListValue:function(e){return"["+s(e.values,", ")+"]"},ObjectValue:function(e){return"{"+s(e.fields,", ")+"}"},ObjectField:function(e){return e.name+": "+e.value},Directive:function(e){return"@"+e.name+c("(",s(e.arguments,", "),")")},NamedType:function(e){return e.name},ListType:function(e){return"["+e.type+"]"},NonNullType:function(e){return e.type+"!"},SchemaDefinition:o((function(e){var t=e.directives,r=e.operationTypes;return s(["schema",s(t," "),u(r)]," ")})),OperationTypeDefinition:function(e){return e.operation+": "+e.type},ScalarTypeDefinition:o((function(e){return s(["scalar",e.name,s(e.directives," ")]," ")})),ObjectTypeDefinition:o((function(e){var t=e.name,r=e.interfaces,n=e.directives,i=e.fields;return s(["type",t,c("implements ",s(r," & ")),s(n," "),u(i)]," ")})),FieldDefinition:o((function(e){var t=e.name,r=e.arguments,n=e.type,i=e.directives;return t+(h(r)?c("(\n",l(s(r,"\n")),"\n)"):c("(",s(r,", "),")"))+": "+n+c(" ",s(i," "))})),InputValueDefinition:o((function(e){var t=e.name,r=e.type,n=e.defaultValue,i=e.directives;return s([t+": "+r,c("= ",n),s(i," ")]," ")})),InterfaceTypeDefinition:o((function(e){var t=e.name,r=e.interfaces,n=e.directives,i=e.fields;return s(["interface",t,c("implements ",s(r," & ")),s(n," "),u(i)]," ")})),UnionTypeDefinition:o((function(e){var t=e.name,r=e.directives,n=e.types;return s(["union",t,s(r," "),n&&0!==n.length?"= "+s(n," | "):""]," ")})),EnumTypeDefinition:o((function(e){var t=e.name,r=e.directives,n=e.values;return s(["enum",t,s(r," "),u(n)]," ")})),EnumValueDefinition:o((function(e){return s([e.name,s(e.directives," ")]," ")})),InputObjectTypeDefinition:o((function(e){var t=e.name,r=e.directives,n=e.fields;return s(["input",t,s(r," "),u(n)]," ")})),DirectiveDefinition:o((function(e){var t=e.name,r=e.arguments,n=e.repeatable,i=e.locations;return"directive @"+t+(h(r)?c("(\n",l(s(r,"\n")),"\n)"):c("(",s(r,", "),")"))+(n?" repeatable":"")+" on "+s(i," | ")})),SchemaExtension:function(e){var t=e.directives,r=e.operationTypes;return s(["extend schema",s(t," "),u(r)]," ")},ScalarTypeExtension:function(e){return s(["extend scalar",e.name,s(e.directives," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,r=e.interfaces,n=e.directives,i=e.fields;return s(["extend type",t,c("implements ",s(r," & ")),s(n," "),u(i)]," ")},InterfaceTypeExtension:function(e){var t=e.name,r=e.interfaces,n=e.directives,i=e.fields;return s(["extend interface",t,c("implements ",s(r," & ")),s(n," "),u(i)]," ")},UnionTypeExtension:function(e){var t=e.name,r=e.directives,n=e.types;return s(["extend union",t,s(r," "),n&&0!==n.length?"= "+s(n," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,r=e.directives,n=e.values;return s(["extend enum",t,s(r," "),u(n)]," ")},InputObjectTypeExtension:function(e){var t=e.name,r=e.directives,n=e.fields;return s(["extend input",t,s(r," "),u(n)]," ")}};function o(e){return function(t){return s([t.description,e(t)],"\n")}}function s(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return null!==(t=null==e?void 0:e.filter((function(e){return e})).join(r))&&void 0!==t?t:""}function u(e){return c("{\n",l(s(e,"\n")),"\n}")}function c(e,t){return null!=t&&""!==t?e+t+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:""):""}function l(e){return c(" ",e.replace(/\n/g,"\n "))}function d(e){return-1!==e.indexOf("\n")}function h(e){return null!=e&&e.some(d)}},46876:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSource=function(e){return(0,o.default)(e,c)},t.Source=void 0;var n=r(25888),i=s(r(29657)),a=s(r(93028)),o=s(r(79527));function s(e){return e&&e.__esModule?e:{default:e}}function u(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:"GraphQL request",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{line:1,column:1};"string"==typeof e||(0,a.default)(0,"Body must be a string. Received: ".concat((0,i.default)(e),".")),this.body=e,this.name=t,this.locationOffset=r,this.locationOffset.line>0||(0,a.default)(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||(0,a.default)(0,"column in locationOffset is 1-indexed and must be positive.")}var t,r;return t=e,(r=[{key:n.SYMBOL_TO_STRING_TAG,get:function(){return"Source"}}])&&u(t.prototype,r),e}();t.Source=c},73038:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenKind=void 0;var r=Object.freeze({SOF:"",EOF:"",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});t.TokenKind=r},9111:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.visit=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o,n=void 0,c=Array.isArray(e),l=[e],d=-1,h=[],p=void 0,f=void 0,y=void 0,g=[],m=[],b=e;do{var v=++d===l.length,_=v&&0!==h.length;if(v){if(f=0===m.length?void 0:g[g.length-1],p=y,y=m.pop(),_){if(c)p=p.slice();else{for(var w={},T=0,S=Object.keys(p);T{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SYMBOL_TO_STRING_TAG=t.SYMBOL_ASYNC_ITERATOR=t.SYMBOL_ITERATOR=void 0;var r="function"==typeof Symbol&&null!=Symbol.iterator?Symbol.iterator:"@@iterator";t.SYMBOL_ITERATOR=r;var n="function"==typeof Symbol&&null!=Symbol.asyncIterator?Symbol.asyncIterator:"@@asyncIterator";t.SYMBOL_ASYNC_ITERATOR=n;var i="function"==typeof Symbol&&null!=Symbol.toStringTag?Symbol.toStringTag:"@@toStringTag";t.SYMBOL_TO_STRING_TAG=i},77952:(e,t,r)=>{var n=t;n.utils=r(67426),n.common=r(66166),n.sha=r(46229),n.ripemd=r(46784),n.hmac=r(28948),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},66166:(e,t,r)=>{"use strict";var n=r(67426),i=r(43349);function a(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=a,a.prototype.update=function(e,t){if(e=n.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=n.join32(e,0,e.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,a=8;a{"use strict";var n=r(67426),i=r(43349);function a(e,t,r){if(!(this instanceof a))return new a(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(t,r))}e.exports=a,a.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t{"use strict";var n=r(67426),i=r(66166),a=n.rotl32,o=n.sum32,s=n.sum32_3,u=n.sum32_4,c=i.BlockHash;function l(){if(!(this instanceof l))return new l;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function d(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function h(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function p(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}n.inherits(l,c),t.ripemd160=l,l.blockSize=512,l.outSize=160,l.hmacStrength=192,l.padLength=64,l.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],i=this.h[2],c=this.h[3],l=this.h[4],b=r,v=n,_=i,w=c,T=l,S=0;S<80;S++){var O=o(a(u(r,d(S,n,i,c),e[f[S]+t],h(S)),g[S]),l);r=l,l=c,c=a(i,10),i=n,n=O,O=o(a(u(b,d(79-S,v,_,w),e[y[S]+t],p(S)),m[S]),T),b=T,T=w,w=a(_,10),_=v,v=O}O=s(this.h[1],i,w),this.h[1]=s(this.h[2],c,T),this.h[2]=s(this.h[3],l,b),this.h[3]=s(this.h[4],r,v),this.h[4]=s(this.h[0],n,_),this.h[0]=O},l.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var f=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],y=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],g=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],m=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},46229:(e,t,r)=>{"use strict";t.sha1=r(43917),t.sha224=r(47714),t.sha256=r(2287),t.sha384=r(21911),t.sha512=r(57766)},43917:(e,t,r)=>{"use strict";var n=r(67426),i=r(66166),a=r(66225),o=n.rotl32,s=n.sum32,u=n.sum32_5,c=a.ft_1,l=i.BlockHash,d=[1518500249,1859775393,2400959708,3395469782];function h(){if(!(this instanceof h))return new h;l.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(h,l),e.exports=h,h.blockSize=512,h.outSize=160,h.hmacStrength=80,h.padLength=64,h.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(67426),i=r(2287);function a(){if(!(this instanceof a))return new a;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(a,i),e.exports=a,a.blockSize=512,a.outSize=224,a.hmacStrength=192,a.padLength=64,a.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},2287:(e,t,r)=>{"use strict";var n=r(67426),i=r(66166),a=r(66225),o=r(43349),s=n.sum32,u=n.sum32_4,c=n.sum32_5,l=a.ch32,d=a.maj32,h=a.s0_256,p=a.s1_256,f=a.g0_256,y=a.g1_256,g=i.BlockHash,m=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function b(){if(!(this instanceof b))return new b;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=m,this.W=new Array(64)}n.inherits(b,g),e.exports=b,b.blockSize=512,b.outSize=256,b.hmacStrength=192,b.padLength=64,b.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(67426),i=r(57766);function a(){if(!(this instanceof a))return new a;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(a,i),e.exports=a,a.blockSize=1024,a.outSize=384,a.hmacStrength=192,a.padLength=128,a.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},57766:(e,t,r)=>{"use strict";var n=r(67426),i=r(66166),a=r(43349),o=n.rotr64_hi,s=n.rotr64_lo,u=n.shr64_hi,c=n.shr64_lo,l=n.sum64,d=n.sum64_hi,h=n.sum64_lo,p=n.sum64_4_hi,f=n.sum64_4_lo,y=n.sum64_5_hi,g=n.sum64_5_lo,m=i.BlockHash,b=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function v(){if(!(this instanceof v))return new v;m.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=b,this.W=new Array(160)}function _(e,t,r,n,i){var a=e&r^~e&i;return a<0&&(a+=4294967296),a}function w(e,t,r,n,i,a){var o=t&n^~t&a;return o<0&&(o+=4294967296),o}function T(e,t,r,n,i){var a=e&r^e&i^r&i;return a<0&&(a+=4294967296),a}function S(e,t,r,n,i,a){var o=t&n^t&a^n&a;return o<0&&(o+=4294967296),o}function O(e,t){var r=o(e,t,28)^o(t,e,2)^o(t,e,7);return r<0&&(r+=4294967296),r}function E(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function x(e,t){var r=s(e,t,14)^s(e,t,18)^s(t,e,9);return r<0&&(r+=4294967296),r}function A(e,t){var r=o(e,t,1)^o(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function R(e,t){var r=s(e,t,1)^s(e,t,8)^c(e,t,7);return r<0&&(r+=4294967296),r}function I(e,t){var r=s(e,t,19)^s(t,e,29)^c(e,t,6);return r<0&&(r+=4294967296),r}n.inherits(v,m),e.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(67426).rotr32;function i(e,t,r){return e&t^~e&r}function a(e,t,r){return e&t^e&r^t&r}function o(e,t,r){return e^t^r}t.ft_1=function(e,t,r,n){return 0===e?i(t,r,n):1===e||3===e?o(t,r,n):2===e?a(t,r,n):void 0},t.ch32=i,t.maj32=a,t.p32=o,t.s0_256=function(e){return n(e,2)^n(e,13)^n(e,22)},t.s1_256=function(e){return n(e,6)^n(e,11)^n(e,25)},t.g0_256=function(e){return n(e,7)^n(e,18)^e>>>3},t.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},67426:(e,t,r)=>{"use strict";var n=r(43349),i=r(56698);function a(e,t){return 55296==(64512&e.charCodeAt(t))&&!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1))}function o(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function s(e){return 1===e.length?"0"+e:e}function u(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i>6|192,r[n++]=63&o|128):a(e,i)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++i)),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=63&o|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=63&o|128)}else for(i=0;i>>0}return o},t.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=a>>>16&255,r[i+2]=a>>>8&255,r[i+3]=255&a):(r[i+3]=a>>>24,r[i+2]=a>>>16&255,r[i+1]=a>>>8&255,r[i]=255&a)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},t.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},t.sum64=function(e,t,r,n){var i=e[t],a=n+e[t+1]>>>0,o=(a>>0,e[t+1]=a},t.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,i,a,o,s){var u=0,c=t;return u+=(c=c+n>>>0)>>0)>>0)>>0},t.sum64_4_lo=function(e,t,r,n,i,a,o,s){return t+n+a+s>>>0},t.sum64_5_hi=function(e,t,r,n,i,a,o,s,u,c){var l=0,d=t;return l+=(d=d+n>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function(e,t,r,n,i,a,o,s,u,c){return t+n+a+s+c>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},2384:e=>{"use strict";var t=/^utf-?8|ascii|utf-?16-?le|ucs-?2|base-?64|latin-?1$/i,r=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,n=/\s|\uFEFF|\xA0/,i=/\r?\n[\x20\x09]+/g,a=/[;,"]/,o=/[;,"]|\s/,s=/^[!#$%&'*+\-\.^_`|~\da-zA-Z]+$/;function u(e){return e.replace(r,"")}function c(e){return n.test(e)}function l(e,t){for(;c(e[t]);)t++;return t}function d(e){return o.test(e)||!s.test(e)}class h{constructor(e){this.refs=[],e&&this.parse(e)}rel(e){for(var t=[],r=e.toLowerCase(),n=0;n{return r=t,n=e,Object.keys(r).length===Object.keys(n).length&&Object.keys(r).every((e=>e in n&&r[e]===n[e]));var r,n}))||this.refs.push(e),this}has(e,t){e=e.toLowerCase(),t=t.toLowerCase();for(var r=0;r",t)))throw new Error("Expected end of URI delimiter at offset "+t);o={uri:e.slice(t+1,p)},t=p,r=2,t++}else if(2===r){if(c(e[t])){t++;continue}if(";"===e[t])r=4,t++;else{if(","!==e[t])throw new Error('Unexpected character "'+e[t]+'" at offset '+t);r=1,t++}}else{if(4!==r)throw new Error('Unknown parser state "'+r+'"');if(";"===e[t]||c(e[t])){t++;continue}-1===(p=e.indexOf("=",t))&&(p=e.indexOf(";",t)),-1===p&&(p=e.length);var s=u(e.slice(t,p)).toLowerCase(),d="";if('"'===e[t=l(e,t=p+1)])for(t++;t"),e.push(t);return e.join(", ")}}h.isCompatibleEncoding=function(e){return t.test(e)},h.parse=function(e,t){return(new h).parse(e,t)},h.isSingleOccurenceAttr=function(e){return"rel"===e||"type"===e||"media"===e||"title"===e||"title*"===e},h.isTokenAttr=function(e){return"rel"===e||"type"===e||"anchor"===e},h.escapeQuotes=function(e){return e.replace(/"/g,'\\"')},h.expandRelations=function(e){return e.rel.split(" ").map((function(t){var r=Object.assign({},e);return r.rel=t,r}))},h.parseExtendedValue=function(e){var t=/([^']+)?(?:'([^']*)')?(.+)/.exec(e);return{language:t[2].toLowerCase(),encoding:h.isCompatibleEncoding(t[1])?null:t[1].toLowerCase(),value:h.isCompatibleEncoding(t[1])?decodeURIComponent(t[3]):t[3]}},h.formatExtendedAttribute=function(e,t){var r=(t.encoding||"utf-8").toUpperCase();return e+"="+r+"'"+(t.language||"en")+"'"+(Buffer.isBuffer(t.value)&&h.isCompatibleEncoding(r)?t.value.toString(r):Buffer.isBuffer(t.value)?t.value.toString("hex").replace(/[0-9a-f]{2}/gi,"%$1"):encodeURIComponent(t.value))},h.formatAttribute=function(e,t){return Array.isArray(t)?t.map((t=>h.formatAttribute(e,t))).join("; "):"*"===e[e.length-1]||"string"!=typeof t?h.formatExtendedAttribute(e,t):(h.isTokenAttr(e)?t=d(t)?'"'+h.escapeQuotes(t)+'"':h.escapeQuotes(t):d(t)&&(t='"'+(t=(t=encodeURIComponent(t)).replace(/%20/g," ").replace(/%2C/g,",").replace(/%3B/g,";"))+'"'),e+"="+t)},e.exports=h},251:(e,t)=>{t.read=function(e,t,r,n,i){var a,o,s=8*i-n-1,u=(1<>1,l=-7,d=r?i-1:0,h=r?-1:1,p=e[t+d];for(d+=h,a=p&(1<<-l)-1,p>>=-l,l+=s;l>0;a=256*a+e[t+d],d+=h,l-=8);for(o=a&(1<<-l)-1,a>>=-l,l+=n;l>0;o=256*o+e[t+d],d+=h,l-=8);if(0===a)a=1-c;else{if(a===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),a-=c}return(p?-1:1)*o*Math.pow(2,a-n)},t.write=function(e,t,r,n,i,a){var o,s,u,c=8*a-i-1,l=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,f=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+d>=1?h/u:h*Math.pow(2,1-d))*u>=2&&(o++,u/=2),o+d>=l?(s=0,o=l):o+d>=1?(s=(t*u-1)*Math.pow(2,i),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[r+p]=255&s,p+=f,s/=256,i-=8);for(o=o<0;e[r+p]=255&o,p+=f,o/=256,c-=8);e[r+p-f]|=128*y}},49568:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Collection:()=>E,Iterable:()=>Rn,List:()=>ur,Map:()=>Ft,OrderedMap:()=>Tr,OrderedSet:()=>ln,PairSorting:()=>yn,Range:()=>zr,Record:()=>gn,Repeat:()=>Sn,Seq:()=>W,Set:()=>Br,Stack:()=>Rr,default:()=>In,fromJS:()=>On,get:()=>ut,getIn:()=>Hr,has:()=>st,hasIn:()=>Jr,hash:()=>me,is:()=>pe,isAssociative:()=>O,isCollection:()=>v,isImmutable:()=>P,isIndexed:()=>S,isKeyed:()=>w,isList:()=>sr,isMap:()=>le,isOrdered:()=>L,isOrderedMap:()=>de,isOrderedSet:()=>Lr,isPlainObject:()=>it,isRecord:()=>D,isSeq:()=>N,isSet:()=>Cr,isStack:()=>Ar,isValueObject:()=>he,merge:()=>Ot,mergeDeep:()=>xt,mergeDeepWith:()=>At,mergeWith:()=>Et,remove:()=>lt,removeIn:()=>gt,set:()=>dt,setIn:()=>ft,update:()=>bt,updateIn:()=>ht,version:()=>An});var n="delete",i=5,a=1<>>0;if(""+r!==t||4294967295===r)return NaN;t=r}return t<0?l(e)+t:t}function h(){return!0}function p(e,t,r){return(0===e&&!m(e)||void 0!==r&&e<=-r)&&(void 0===t||void 0!==r&&t>=r)}function f(e,t){return g(e,t,0)}function y(e,t){return g(e,t,t)}function g(e,t,r){return void 0===e?r:m(e)?t===1/0?t:0|Math.max(0,t+e):void 0===t||t===e?e:0|Math.min(t,e)}function m(e){return e<0||0===e&&1/e==-1/0}var b="@@__IMMUTABLE_ITERABLE__@@";function v(e){return Boolean(e&&e[b])}var _="@@__IMMUTABLE_KEYED__@@";function w(e){return Boolean(e&&e[_])}var T="@@__IMMUTABLE_INDEXED__@@";function S(e){return Boolean(e&&e[T])}function O(e){return w(e)||S(e)}var E=function(e){return v(e)?e:W(e)},x=function(e){function t(e){return w(e)?e:Y(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(E),A=function(e){function t(e){return S(e)?e:Z(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(E),R=function(e){function t(e){return v(e)&&!O(e)?e:ee(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t}(E);E.Keyed=x,E.Indexed=A,E.Set=R;var I="@@__IMMUTABLE_SEQ__@@";function N(e){return Boolean(e&&e[I])}var j="@@__IMMUTABLE_RECORD__@@";function D(e){return Boolean(e&&e[j])}function P(e){return v(e)||D(e)}var C="@@__IMMUTABLE_ORDERED__@@";function L(e){return Boolean(e&&e[C])}var k=0,M=1,F=2,B="function"==typeof Symbol&&Symbol.iterator,U="@@iterator",V=B||U,q=function(e){this.next=e};function $(e,t,r,n){var i=0===e?t:1===e?r:[t,r];return n?n.value=i:n={value:i,done:!1},n}function Q(){return{value:void 0,done:!0}}function G(e){return!!Array.isArray(e)||!!X(e)}function z(e){return e&&"function"==typeof e.next}function H(e){var t=X(e);return t&&t.call(e)}function X(e){var t=e&&(B&&e[B]||e[U]);if("function"==typeof t)return t}q.prototype.toString=function(){return"[Iterator]"},q.KEYS=k,q.VALUES=M,q.ENTRIES=F,q.prototype.inspect=q.prototype.toSource=function(){return this.toString()},q.prototype[V]=function(){return this};var J=Object.prototype.hasOwnProperty;function K(e){return!(!Array.isArray(e)&&"string"!=typeof e)||e&&"object"==typeof e&&Number.isInteger(e.length)&&e.length>=0&&(0===e.length?1===Object.keys(e).length:e.hasOwnProperty(e.length-1))}var W=function(e){function t(e){return null==e?ae():P(e)?e.toSeq():function(e){var t,r,n=ue(e);if(n)return(r=X(t=e))&&r===t.entries?n.fromEntrySeq():function(e){var t=X(e);return t&&t===e.keys}(e)?n.toSetSeq():n;if("object"==typeof e)return new re(e);throw new TypeError("Expected Array or collection object of values, or keyed object: "+e)}(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq {","}")},t.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},t.prototype.__iterate=function(e,t){var r=this._cache;if(r){for(var n=r.length,i=0;i!==n;){var a=r[t?n-++i:i++];if(!1===e(a[1],a[0],this))break}return i}return this.__iterateUncached(e,t)},t.prototype.__iterator=function(e,t){var r=this._cache;if(r){var n=r.length,i=0;return new q((function(){if(i===n)return{value:void 0,done:!0};var a=r[t?n-++i:i++];return $(e,a[0],a[1])}))}return this.__iteratorUncached(e,t)},t}(E),Y=function(e){function t(e){return null==e?ae().toKeyedSeq():v(e)?w(e)?e.toSeq():e.fromEntrySeq():D(e)?e.toSeq():oe(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.toKeyedSeq=function(){return this},t}(W),Z=function(e){function t(e){return null==e?ae():v(e)?w(e)?e.entrySeq():e.toIndexedSeq():D(e)?e.toSeq().entrySeq():se(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return t(arguments)},t.prototype.toIndexedSeq=function(){return this},t.prototype.toString=function(){return this.__toString("Seq [","]")},t}(W),ee=function(e){function t(e){return(v(e)&&!O(e)?e:Z(e)).toSetSeq()}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return t(arguments)},t.prototype.toSetSeq=function(){return this},t}(W);W.isSeq=N,W.Keyed=Y,W.Set=ee,W.Indexed=Z,W.prototype[I]=!0;var te=function(e){function t(e){this._array=e,this.size=e.length}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(e,t){return this.has(e)?this._array[d(this,e)]:t},t.prototype.__iterate=function(e,t){for(var r=this._array,n=r.length,i=0;i!==n;){var a=t?n-++i:i++;if(!1===e(r[a],a,this))break}return i},t.prototype.__iterator=function(e,t){var r=this._array,n=r.length,i=0;return new q((function(){if(i===n)return{value:void 0,done:!0};var a=t?n-++i:i++;return $(e,a,r[a])}))},t}(Z),re=function(e){function t(e){var t=Object.keys(e).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]);this._object=e,this._keys=t,this.size=t.length}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},t.prototype.has=function(e){return J.call(this._object,e)},t.prototype.__iterate=function(e,t){for(var r=this._object,n=this._keys,i=n.length,a=0;a!==i;){var o=n[t?i-++a:a++];if(!1===e(r[o],o,this))break}return a},t.prototype.__iterator=function(e,t){var r=this._object,n=this._keys,i=n.length,a=0;return new q((function(){if(a===i)return{value:void 0,done:!0};var o=n[t?i-++a:a++];return $(e,o,r[o])}))},t}(Y);re.prototype[C]=!0;var ne,ie=function(e){function t(e){this._collection=e,this.size=e.length||e.size}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var r=H(this._collection),n=0;if(z(r))for(var i;!(i=r.next()).done&&!1!==e(i.value,n++,this););return n},t.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var r=H(this._collection);if(!z(r))return new q(Q);var n=0;return new q((function(){var t=r.next();return t.done?t:$(e,n++,t.value)}))},t}(Z);function ae(){return ne||(ne=new te([]))}function oe(e){var t=ue(e);if(t)return t.fromEntrySeq();if("object"==typeof e)return new re(e);throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: "+e)}function se(e){var t=ue(e);if(t)return t;throw new TypeError("Expected Array or collection object of values: "+e)}function ue(e){return K(e)?new te(e):G(e)?new ie(e):void 0}var ce="@@__IMMUTABLE_MAP__@@";function le(e){return Boolean(e&&e[ce])}function de(e){return le(e)&&L(e)}function he(e){return Boolean(e&&"function"==typeof e.equals&&"function"==typeof e.hashCode)}function pe(e,t){if(e===t||e!=e&&t!=t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if((e=e.valueOf())===(t=t.valueOf())||e!=e&&t!=t)return!0;if(!e||!t)return!1}return!!(he(e)&&he(t)&&e.equals(t))}var fe="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){var r=65535&(e|=0),n=65535&(t|=0);return r*n+((e>>>16)*n+r*(t>>>16)<<16>>>0)|0};function ye(e){return e>>>1&1073741824|3221225471&e}var ge=Object.prototype.valueOf;function me(e){if(null==e)return be(e);if("function"==typeof e.hashCode)return ye(e.hashCode(e));var t,r,n,i=(t=e).valueOf!==ge&&"function"==typeof t.valueOf?t.valueOf(t):t;if(null==i)return be(i);switch(typeof i){case"boolean":return i?1108378657:1108378656;case"number":return function(e){if(e!=e||e===1/0)return 0;var t=0|e;for(t!==e&&(t^=4294967295*e);e>4294967295;)t^=e/=4294967295;return ye(t)}(i);case"string":return i.length>Re?(void 0===(n=je[r=i])&&(n=ve(r),Ne===Ie&&(Ne=0,je={}),Ne++,je[r]=n),n):ve(i);case"object":case"function":return function(e){var t;if(Oe&&void 0!==(t=Se.get(e)))return t;if(void 0!==(t=e[Ae]))return t;if(!we){if(void 0!==(t=e.propertyIsEnumerable&&e.propertyIsEnumerable[Ae]))return t;if(void 0!==(t=function(e){if(e&&e.nodeType>0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}(e)))return t}if(t=Te(),Oe)Se.set(e,t);else{if(void 0!==_e&&!1===_e(e))throw new Error("Non-extensible objects are not allowed as keys.");if(we)Object.defineProperty(e,Ae,{enumerable:!1,configurable:!1,writable:!1,value:t});else if(void 0!==e.propertyIsEnumerable&&e.propertyIsEnumerable===e.constructor.prototype.propertyIsEnumerable)e.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},e.propertyIsEnumerable[Ae]=t;else{if(void 0===e.nodeType)throw new Error("Unable to set a non-enumerable property on object.");e[Ae]=t}}return t}(i);case"symbol":return function(e){var t=Ee[e];return void 0!==t||(t=Te(),Ee[e]=t),t}(i);default:if("function"==typeof i.toString)return ve(i.toString());throw new Error("Value type "+typeof i+" cannot be hashed.")}}function be(e){return null===e?1108378658:1108378659}function ve(e){for(var t=0,r=0;r=0&&(c.get=function(t,r){return(t=d(this,t))>=0&&ts)return{value:void 0,done:!0};var e=i.next();return n||t===M||e.done?e:$(t,u-1,t===k?void 0:e.value[1],e)}))},c}function Ve(e,t,r,n){var i=Ke(e);return i.__iterateUncached=function(i,a){var o=this;if(a)return this.cacheResult().__iterate(i,a);var s=!0,u=0;return e.__iterate((function(e,a,c){if(!s||!(s=t.call(r,e,a,c)))return u++,i(e,n?a:u-1,o)})),u},i.__iteratorUncached=function(i,a){var o=this;if(a)return this.cacheResult().__iterator(i,a);var s=e.__iterator(F,a),u=!0,c=0;return new q((function(){var e,a,l;do{if((e=s.next()).done)return n||i===M?e:$(i,c++,i===k?void 0:e.value[1],e);var d=e.value;a=d[0],l=d[1],u&&(u=t.call(r,l,a,o))}while(u);return i===F?e:$(i,a,l,e)}))},i}function qe(e,t,r){var n=Ke(e);return n.__iterateUncached=function(i,a){if(a)return this.cacheResult().__iterate(i,a);var o=0,s=!1;return function e(u,c){u.__iterate((function(a,u){return(!t||c0}function ze(e,t,r,n){var i=Ke(e),a=new te(r).map((function(e){return e.size}));return i.size=n?a.max():a.min(),i.__iterate=function(e,t){for(var r,n=this.__iterator(M,t),i=0;!(r=n.next()).done&&!1!==e(r.value,i++,this););return i},i.__iteratorUncached=function(e,i){var a=r.map((function(e){return e=E(e),H(i?e.reverse():e)})),o=0,s=!1;return new q((function(){var r;return s||(r=a.map((function(e){return e.next()})),s=n?r.every((function(e){return e.done})):r.some((function(e){return e.done}))),s?{value:void 0,done:!0}:$(e,o++,t.apply(null,r.map((function(e){return e.value}))))}))},i}function He(e,t){return e===t?e:N(e)?t:e.constructor(t)}function Xe(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function Je(e){return w(e)?x:S(e)?A:R}function Ke(e){return Object.create((w(e)?Y:S(e)?Z:ee).prototype)}function We(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):W.prototype.cacheResult.call(this)}function Ye(e,t){return void 0===e&&void 0===t?0:void 0===e?1:void 0===t?-1:e>t?1:e0;)t[r]=arguments[r+1];if("function"!=typeof e)throw new TypeError("Invalid merger function: "+e);return St(this,t,e)}function St(e,t,r){for(var n=[],i=0;i0;)t[r]=arguments[r+1];return It(e,t)}function Et(e,t){for(var r=[],n=arguments.length-2;n-- >0;)r[n]=arguments[n+2];return It(t,r,e)}function xt(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return Rt(e,t)}function At(e,t){for(var r=[],n=arguments.length-2;n-- >0;)r[n]=arguments[n+2];return Rt(t,r,e)}function Rt(e,t,r){return It(e,t,function(e){return function t(r,n,i){return at(r)&&at(n)&&(a=n,o=W(r),s=W(a),S(o)===S(s)&&w(o)===w(s))?It(r,[n],t):e?e(r,n,i):n;var a,o,s}}(r))}function It(e,t,r){if(!at(e))throw new TypeError("Cannot merge into non-data-structure value: "+e);if(P(e))return"function"==typeof r&&e.mergeWith?e.mergeWith.apply(e,[r].concat(t)):e.merge?e.merge.apply(e,t):e.concat.apply(e,t);for(var n=Array.isArray(e),i=e,a=n?A:x,o=n?function(t){i===e&&(i=ct(i)),i.push(t)}:function(t,n){var a=J.call(i,n),o=a&&r?r(i[n],t,n):t;a&&o===i[n]||(i===e&&(i=ct(i)),i[n]=o)},s=0;s0;)t[r]=arguments[r+1];return Rt(this,t,e)}function Dt(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return ht(this,e,Kt(),(function(e){return It(e,t)}))}function Pt(e){for(var t=[],r=arguments.length-1;r-- >0;)t[r]=arguments[r+1];return ht(this,e,Kt(),(function(e){return Rt(e,t)}))}function Ct(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this}function Lt(){return this.__ownerID?this:this.__ensureOwner(new c)}function kt(){return this.__ensureOwner()}function Mt(){return this.__altered}var Ft=function(e){function t(t){return null==t?Kt():le(t)&&!L(t)?t:Kt().withMutations((function(r){var n=e(t);tt(n.size),n.forEach((function(e,t){return r.set(t,e)}))}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return Kt().withMutations((function(t){for(var r=0;r=e.length)throw new Error("Missing value for key: "+e[r]);t.set(e[r],e[r+1])}}))},t.prototype.toString=function(){return this.__toString("Map {","}")},t.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},t.prototype.set=function(e,t){return Wt(this,e,t)},t.prototype.remove=function(e){return Wt(this,e,s)},t.prototype.deleteAll=function(e){var t=E(e);return 0===t.size?this:this.withMutations((function(e){t.forEach((function(t){return e.remove(t)}))}))},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Kt()},t.prototype.sort=function(e){return Tr($e(this,e))},t.prototype.sortBy=function(e,t){return Tr($e(this,t,e))},t.prototype.map=function(e,t){var r=this;return this.withMutations((function(n){n.forEach((function(i,a){n.set(a,e.call(t,i,a,r))}))}))},t.prototype.__iterator=function(e,t){return new zt(this,e,t)},t.prototype.__iterate=function(e,t){var r=this,n=0;return this._root&&this._root.iterate((function(t){return n++,e(t[1],t[0],r)}),t),n},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Jt(this.size,this._root,e,this.__hash):0===this.size?Kt():(this.__ownerID=e,this.__altered=!1,this)},t}(x);Ft.isMap=le;var Bt=Ft.prototype;Bt[ce]=!0,Bt[n]=Bt.remove,Bt.removeAll=Bt.deleteAll,Bt.setIn=yt,Bt.removeIn=Bt.deleteIn=mt,Bt.update=vt,Bt.updateIn=_t,Bt.merge=Bt.concat=wt,Bt.mergeWith=Tt,Bt.mergeDeep=Nt,Bt.mergeDeepWith=jt,Bt.mergeIn=Dt,Bt.mergeDeepIn=Pt,Bt.withMutations=Ct,Bt.wasAltered=Mt,Bt.asImmutable=kt,Bt["@@transducer/init"]=Bt.asMutable=Lt,Bt["@@transducer/step"]=function(e,t){return e.set(t[0],t[1])},Bt["@@transducer/result"]=function(e){return e.asImmutable()};var Ut=function(e,t){this.ownerID=e,this.entries=t};Ut.prototype.get=function(e,t,r,n){for(var i=this.entries,a=0,o=i.length;a=nr)return function(e,t,r,n){e||(e=new c);for(var i=new Qt(e,me(r),[r,n]),a=0;a>>e)&o),s=this.bitmap;return s&a?this.nodes[tr(s&a-1)].get(e+i,t,r,n):n},Vt.prototype.update=function(e,t,r,n,u,c,l){void 0===r&&(r=me(n));var d=(0===t?r:r>>>t)&o,h=1<=ir)return function(e,t,r,n,i){for(var o=0,s=new Array(a),u=0;0!==r;u++,r>>>=1)s[u]=1&r?t[o++]:void 0;return s[n]=i,new qt(e,o+1,s)}(e,g,p,d,b);if(f&&!b&&2===g.length&&Zt(g[1^y]))return g[1^y];if(f&&b&&1===g.length&&Zt(b))return b;var v=e&&e===this.ownerID,_=f?b?p:p^h:p|h,w=f?b?rr(g,y,b,v):function(e,t,r){var n=e.length-1;if(r&&t===n)return e.pop(),e;for(var i=new Array(n),a=0,o=0;o>>e)&o,s=this.nodes[a];return s?s.get(e+i,t,r,n):n},qt.prototype.update=function(e,t,r,n,a,u,c){void 0===r&&(r=me(n));var l=(0===t?r:r>>>t)&o,d=a===s,h=this.nodes,p=h[l];if(d&&!p)return this;var f=Yt(p,e,t+i,r,n,a,u,c);if(f===p)return this;var y=this.count;if(p){if(!f&&--y>>r)&o,c=(0===r?n:n>>>r)&o,l=u===c?[er(e,t,r+i,n,a)]:(s=new Qt(t,n,a),u>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,127&(e+=e>>8)+(e>>16)}function rr(e,t,r,n){var i=n?e:Ze(e);return i[t]=r,i}var nr=a/4,ir=a/2,ar=a/4,or="@@__IMMUTABLE_LIST__@@";function sr(e){return Boolean(e&&e[or])}var ur=function(e){function t(t){var r=yr();if(null==t)return r;if(sr(t))return t;var n=e(t),o=n.size;return 0===o?r:(tt(o),o>0&&o=0&&e=e.size||t<0)return e.withMutations((function(e){t<0?vr(e,t).set(0,r):vr(e,0,t+1).set(t,r)}));t+=e._origin;var n=e._tail,i=e._root,a={value:!1};return t>=_r(e._capacity)?n=gr(n,e.__ownerID,0,t,r,a):i=gr(i,e.__ownerID,e._level,t,r,a),a.value?e.__ownerID?(e._root=i,e._tail=n,e.__hash=void 0,e.__altered=!0,e):fr(e._origin,e._capacity,e._level,i,n):e}(this,e,t)},t.prototype.remove=function(e){return this.has(e)?0===e?this.shift():e===this.size-1?this.pop():this.splice(e,1):this},t.prototype.insert=function(e,t){return this.splice(e,0,t)},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=i,this._root=this._tail=this.__hash=void 0,this.__altered=!0,this):yr()},t.prototype.push=function(){var e=arguments,t=this.size;return this.withMutations((function(r){vr(r,0,t+e.length);for(var n=0;n>>t&o;if(n>=this.array.length)return new lr([],e);var a,s=0===n;if(t>0){var u=this.array[n];if((a=u&&u.removeBefore(e,t-i,r))===u&&s)return this}if(s&&!a)return this;var c=mr(this,e);if(!s)for(var l=0;l>>t&o;if(a>=this.array.length)return this;if(t>0){var s=this.array[a];if((n=s&&s.removeAfter(e,t-i,r))===s&&a===this.array.length-1)return this}var u=mr(this,e);return u.array.splice(a+1),n&&(u.array[a]=n),u};var dr,hr={};function pr(e,t){var r=e._origin,n=e._capacity,o=_r(n),s=e._tail;return function e(u,c,l){return 0===c?function(e,i){var u=i===o?s&&s.array:e&&e.array,c=i>r?0:r-i,l=n-i;return l>a&&(l=a),function(){if(c===l)return hr;var e=t?--l:c++;return u&&u[e]}}(u,l):function(o,s,u){var c,l=o&&o.array,d=u>r?0:r-u>>s,h=1+(n-u>>s);return h>a&&(h=a),function(){for(;;){if(c){var r=c();if(r!==hr)return r;c=null}if(d===h)return hr;var n=t?--h:d++;c=e(l&&l[n],s-i,u+(n<>>r&o,d=e&&l0){var h=e&&e.array[l],p=gr(h,t,r-i,n,a,s);return p===h?e:((c=mr(e,t)).array[l]=p,c)}return d&&e.array[l]===a?e:(s&&u(s),c=mr(e,t),void 0===a&&l===c.array.length-1?c.array.pop():c.array[l]=a,c)}function mr(e,t){return t&&e&&t===e.ownerID?e:new lr(e?e.array.slice():[],t)}function br(e,t){if(t>=_r(e._capacity))return e._tail;if(t<1<0;)r=r.array[t>>>n&o],n-=i;return r}}function vr(e,t,r){void 0!==t&&(t|=0),void 0!==r&&(r|=0);var n=e.__ownerID||new c,a=e._origin,s=e._capacity,u=a+t,l=void 0===r?s:r<0?s+r:a+r;if(u===a&&l===s)return e;if(u>=l)return e.clear();for(var d=e._level,h=e._root,p=0;u+p<0;)h=new lr(h&&h.array.length?[void 0,h]:[],n),p+=1<<(d+=i);p&&(u+=p,a+=p,l+=p,s+=p);for(var f=_r(s),y=_r(l);y>=1<f?new lr([],n):g;if(g&&y>f&&ui;v-=i){var _=f>>>v&o;b=b.array[_]=mr(b.array[_],n)}b.array[f>>>i&o]=g}if(l=y)u-=y,l-=y,d=i,h=null,m=m&&m.removeBefore(n,0,u);else if(u>a||y>>d&o;if(w!==y>>>d&o)break;w&&(p+=(1<a&&(h=h.removeBefore(n,d,u-p)),h&&y>>i<=a&&u.size>=2*o.size?(n=(i=u.filter((function(e,t){return void 0!==e&&c!==t}))).toKeyedSeq().map((function(e){return e[0]})).flip().toMap(),e.__ownerID&&(n.__ownerID=i.__ownerID=e.__ownerID)):(n=o.remove(t),i=c===u.size-1?u.pop():u.set(c,void 0))}else if(l){if(r===u.get(c)[1])return e;n=o,i=u.set(c,[t,r])}else n=o.set(t,u.size),i=u.set(u.size,[t,r]);return e.__ownerID?(e.size=n.size,e._map=n,e._list=i,e.__hash=void 0,e.__altered=!0,e):Sr(n,i)}Tr.isOrderedMap=de,Tr.prototype[C]=!0,Tr.prototype[n]=Tr.prototype.remove;var xr="@@__IMMUTABLE_STACK__@@";function Ar(e){return Boolean(e&&e[xr])}var Rr=function(e){function t(e){return null==e?Dr():Ar(e)?e:Dr().pushAll(e)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.prototype.toString=function(){return this.__toString("Stack [","]")},t.prototype.get=function(e,t){var r=this._head;for(e=d(this,e);r&&e--;)r=r.next;return r?r.value:t},t.prototype.peek=function(){return this._head&&this._head.value},t.prototype.push=function(){var e=arguments;if(0===arguments.length)return this;for(var t=this.size+arguments.length,r=this._head,n=arguments.length-1;n>=0;n--)r={value:e[n],next:r};return this.__ownerID?(this.size=t,this._head=r,this.__hash=void 0,this.__altered=!0,this):jr(t,r)},t.prototype.pushAll=function(t){if(0===(t=e(t)).size)return this;if(0===this.size&&Ar(t))return t;tt(t.size);var r=this.size,n=this._head;return t.__iterate((function(e){r++,n={value:e,next:n}}),!0),this.__ownerID?(this.size=r,this._head=n,this.__hash=void 0,this.__altered=!0,this):jr(r,n)},t.prototype.pop=function(){return this.slice(1)},t.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Dr()},t.prototype.slice=function(t,r){if(p(t,r,this.size))return this;var n=f(t,this.size);if(y(r,this.size)!==this.size)return e.prototype.slice.call(this,t,r);for(var i=this.size-n,a=this._head;n--;)a=a.next;return this.__ownerID?(this.size=i,this._head=a,this.__hash=void 0,this.__altered=!0,this):jr(i,a)},t.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?jr(this.size,this._head,e,this.__hash):0===this.size?Dr():(this.__ownerID=e,this.__altered=!1,this)},t.prototype.__iterate=function(e,t){var r=this;if(t)return new te(this.toArray()).__iterate((function(t,n){return e(t,n,r)}),t);for(var n=0,i=this._head;i&&!1!==e(i.value,n++,this);)i=i.next;return n},t.prototype.__iterator=function(e,t){if(t)return new te(this.toArray()).__iterator(e,t);var r=0,n=this._head;return new q((function(){if(n){var t=n.value;return n=n.next,$(e,r++,t)}return{value:void 0,done:!0}}))},t}(A);Rr.isStack=Ar;var Ir,Nr=Rr.prototype;function jr(e,t,r,n){var i=Object.create(Nr);return i.size=e,i._head=t,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function Dr(){return Ir||(Ir=jr(0))}Nr[xr]=!0,Nr.shift=Nr.pop,Nr.unshift=Nr.push,Nr.unshiftAll=Nr.pushAll,Nr.withMutations=Ct,Nr.wasAltered=Mt,Nr.asImmutable=kt,Nr["@@transducer/init"]=Nr.asMutable=Lt,Nr["@@transducer/step"]=function(e,t){return e.unshift(t)},Nr["@@transducer/result"]=function(e){return e.asImmutable()};var Pr="@@__IMMUTABLE_SET__@@";function Cr(e){return Boolean(e&&e[Pr])}function Lr(e){return Cr(e)&&L(e)}function kr(e,t){if(e===t)return!0;if(!v(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||w(e)!==w(t)||S(e)!==S(t)||L(e)!==L(t))return!1;if(0===e.size&&0===t.size)return!0;var r=!O(e);if(L(e)){var n=e.entries();return t.every((function(e,t){var i=n.next().value;return i&&pe(i[1],e)&&(r||pe(i[0],t))}))&&n.next().done}var i=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{i=!0;var a=e;e=t,t=a}var o=!0,u=t.__iterate((function(t,n){if(r?!e.has(t):i?!pe(t,e.get(n,s)):!pe(e.get(n,s),t))return o=!1,!1}));return o&&e.size===u}function Mr(e,t){var r=function(r){e.prototype[r]=t[r]};return Object.keys(t).forEach(r),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(r),e}function Fr(e){if(!e||"object"!=typeof e)return e;if(!v(e)){if(!at(e))return e;e=W(e)}if(w(e)){var t={};return e.__iterate((function(e,r){t[r]=Fr(e)})),t}var r=[];return e.__iterate((function(e){r.push(Fr(e))})),r}var Br=function(e){function t(t){return null==t?Qr():Cr(t)&&!L(t)?t:Qr().withMutations((function(r){var n=e(t);tt(n.size),n.forEach((function(e){return r.add(e)}))}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(e){return this(x(e).keySeq())},t.intersect=function(e){return(e=E(e).toArray()).length?Vr.intersect.apply(t(e.pop()),e):Qr()},t.union=function(e){return(e=E(e).toArray()).length?Vr.union.apply(t(e.pop()),e):Qr()},t.prototype.toString=function(){return this.__toString("Set {","}")},t.prototype.has=function(e){return this._map.has(e)},t.prototype.add=function(e){return qr(this,this._map.set(e,e))},t.prototype.remove=function(e){return qr(this,this._map.remove(e))},t.prototype.clear=function(){return qr(this,this._map.clear())},t.prototype.map=function(e,t){var r=this,n=!1,i=qr(this,this._map.mapEntries((function(i){var a=i[1],o=e.call(t,a,a,r);return o!==a&&(n=!0),[o,o]}),t));return n?i:this},t.prototype.union=function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];return 0===(t=t.filter((function(e){return 0!==e.size}))).length?this:0!==this.size||this.__ownerID||1!==t.length?this.withMutations((function(r){for(var n=0;n=0&&t=0&&r>>-15,461845907),t=fe(t<<13|t>>>-13,5),t=fe((t=t+3864292196^e)^t>>>16,2246822507),t=ye((t=fe(t^t>>>13,3266489909))^t>>>16)}(e.__iterate(r?t?function(e,t){n=31*n+cn(me(e),me(t))|0}:function(e,t){n=n+cn(me(e),me(t))|0}:t?function(e){n=31*n+me(e)|0}:function(e){n=n+me(e)|0}),n)}(this))}});var Wr=E.prototype;Wr[b]=!0,Wr[V]=Wr.values,Wr.toJSON=Wr.toArray,Wr.__toStringMapper=ot,Wr.inspect=Wr.toSource=function(){return this.toString()},Wr.chain=Wr.flatMap,Wr.contains=Wr.includes,Mr(x,{flip:function(){return He(this,ke(this))},mapEntries:function(e,t){var r=this,n=0;return He(this,this.toSeq().map((function(i,a){return e.call(t,[a,i],n++,r)})).fromEntrySeq())},mapKeys:function(e,t){var r=this;return He(this,this.toSeq().flip().map((function(n,i){return e.call(t,n,i,r)})).flip())}});var Yr=x.prototype;Yr[_]=!0,Yr[V]=Wr.entries,Yr.toJSON=Kr,Yr.__toStringMapper=function(e,t){return ot(t)+": "+ot(e)},Mr(A,{toKeyedSeq:function(){return new De(this,!1)},filter:function(e,t){return He(this,Be(this,e,t,!1))},findIndex:function(e,t){var r=this.findEntry(e,t);return r?r[0]:-1},indexOf:function(e){var t=this.keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.lastKeyOf(e);return void 0===t?-1:t},reverse:function(){return He(this,Fe(this,!1))},slice:function(e,t){return He(this,Ue(this,e,t,!1))},splice:function(e,t){var r=arguments.length;if(t=Math.max(t||0,0),0===r||2===r&&!t)return this;e=f(e,e<0?this.count():this.size);var n=this.slice(0,e);return He(this,1===r?n:n.concat(Ze(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var r=this.findLastEntry(e,t);return r?r[0]:-1},first:function(e){return this.get(0,e)},flatten:function(e){return He(this,qe(this,e,!1))},get:function(e,t){return(e=d(this,e))<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find((function(t,r){return r===e}),void 0,t)},has:function(e){return(e=d(this,e))>=0&&(void 0!==this.size?this.size===1/0||et?-1:0}function cn(e,t){return e^t+2654435769+(e<<6)+(e>>2)}en.has=Wr.includes,en.contains=en.includes,en.keys=en.values,Mr(Y,Yr),Mr(Z,Zr),Mr(ee,en);var ln=function(e){function t(e){return null==e?fn():Lr(e)?e:fn().withMutations((function(t){var r=R(e);tt(r.size),r.forEach((function(e){return t.add(e)}))}))}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.of=function(){return this(arguments)},t.fromKeys=function(e){return this(x(e).keySeq())},t.prototype.toString=function(){return this.__toString("OrderedSet {","}")},t}(Br);ln.isOrderedSet=Lr;var dn,hn=ln.prototype;function pn(e,t){var r=Object.create(hn);return r.size=e?e.size:0,r._map=e,r.__ownerID=t,r}function fn(){return dn||(dn=pn(Or()))}hn[C]=!0,hn.zip=Zr.zip,hn.zipWith=Zr.zipWith,hn.zipAll=Zr.zipAll,hn.__empty=fn,hn.__make=pn;var yn={LeftThenRight:-1,RightThenLeft:1},gn=function(e,t){var r;!function(e){if(D(e))throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");if(P(e))throw new Error("Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.");if(null===e||"object"!=typeof e)throw new Error("Can not call `Record` with a non-object as default values. Use a plain javascript object instead.")}(e);var n=function(a){var o=this;if(a instanceof n)return a;if(!(this instanceof n))return new n(a);if(!r){r=!0;var s=Object.keys(e),u=i._indices={};i._name=t,i._keys=s,i._defaultValues=e;for(var c=0;c2?[]:void 0,{"":e})}function En(e,t,r,n,i,a){if("string"!=typeof r&&!P(r)&&(K(r)||G(r)||it(r))){if(~e.indexOf(r))throw new TypeError("Cannot convert circular structure to Immutable");e.push(r),i&&""!==n&&i.push(n);var o=t.call(a,n,W(r).map((function(n,a){return En(e,t,n,a,i,r)})),i&&i.slice());return e.pop(),i&&i.pop(),o}return r}function xn(e,t){return S(t)?t.toList():w(t)?t.toMap():t.toSet()}var An="4.3.5",Rn=E;const In={version:An,Collection:E,Iterable:E,Seq:W,Map:Ft,OrderedMap:Tr,List:ur,Stack:Rr,Set:Br,OrderedSet:ln,PairSorting:yn,Record:gn,Range:zr,Repeat:Sn,is:pe,fromJS:On,hash:me,isImmutable:P,isCollection:v,isKeyed:w,isIndexed:S,isAssociative:O,isOrdered:L,isValueObject:he,isPlainObject:it,isSeq:N,isList:sr,isMap:le,isOrderedMap:de,isStack:Ar,isSet:Cr,isOrderedSet:Lr,isRecord:D,get:ut,getIn:Hr,has:st,hasIn:Jr,merge:Ot,mergeDeep:xt,mergeWith:Et,mergeDeepWith:At,remove:lt,removeIn:gt,set:dt,setIn:ft,update:bt,updateIn:ht}},56698:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},31232:e=>{"use strict";const t=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;t.writable=e=>t(e)&&!1!==e.writable&&"function"==typeof e._write&&"object"==typeof e._writableState,t.readable=e=>t(e)&&!1!==e.readable&&"function"==typeof e._read&&"object"==typeof e._readableState,t.duplex=e=>t.writable(e)&&t.readable(e),t.transform=e=>t.duplex(e)&&"function"==typeof e._transform,e.exports=t},42395:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(72803),t),i(r(75094),t),i(r(60585),t),i(r(29146),t),i(r(45086),t),i(r(85215),t),i(r(94931),t)},72803:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContextParser=void 0,r(86547);const n=r(70742),i=r(75094),a=r(60585),o=r(85215),s=r(94931);class u{constructor(e){e=e||{},this.documentLoader=e.documentLoader||new a.FetchDocumentLoader,this.documentCache={},this.validateContext=!e.skipValidation,this.expandContentTypeToBase=!!e.expandContentTypeToBase,this.remoteContextsDepthLimit=e.remoteContextsDepthLimit||32,this.redirectSchemaOrgHttps=!("redirectSchemaOrgHttps"in e)||!!e.redirectSchemaOrgHttps}static validateLanguage(e,t,r){if("string"!=typeof e)throw new i.ErrorCoded(`The value of an '@language' must be a string, got '${JSON.stringify(e)}'`,r);if(!s.Util.REGEX_LANGUAGE_TAG.test(e)){if(t)throw new i.ErrorCoded(`The value of an '@language' must be a valid language tag, got '${JSON.stringify(e)}'`,r);return!1}return!0}static validateDirection(e,t){if("string"!=typeof e)throw new i.ErrorCoded(`The value of an '@direction' must be a string, got '${JSON.stringify(e)}'`,i.ERROR_CODES.INVALID_BASE_DIRECTION);if(!s.Util.REGEX_DIRECTION_TAG.test(e)){if(t)throw new i.ErrorCoded(`The value of an '@direction' must be 'ltr' or 'rtl', got '${JSON.stringify(e)}'`,i.ERROR_CODES.INVALID_BASE_DIRECTION);return!1}return!0}idifyReverseTerms(e){for(const t of Object.keys(e)){let r=e[t];if(r&&"object"==typeof r&&r["@reverse"]&&!r["@id"]){if("string"!=typeof r["@reverse"]||s.Util.isValidKeyword(r["@reverse"]))throw new i.ErrorCoded(`Invalid @reverse value, must be absolute IRI or blank node: '${r["@reverse"]}'`,i.ERROR_CODES.INVALID_IRI_MAPPING);r=e[t]=Object.assign(Object.assign({},r),{"@id":r["@reverse"]}),r["@id"]=r["@reverse"],s.Util.isPotentialKeyword(r["@reverse"])?delete r["@reverse"]:r["@reverse"]=!0}}return e}expandPrefixedTerms(e,t,r){const n=e.getContextRaw();for(const a of r||Object.keys(n))if(s.Util.EXPAND_KEYS_BLACKLIST.indexOf(a)<0&&!s.Util.isReservedInternalKeyword(a)){const r=n[a];if(s.Util.isPotentialKeyword(a)&&s.Util.ALIAS_DOMAIN_BLACKLIST.indexOf(a)>=0&&("@type"!==a||"object"==typeof n[a]&&!n[a]["@protected"]&&"@set"!==n[a]["@container"]))throw new i.ErrorCoded(`Keywords can not be aliased to something else.\nTried mapping ${a} to ${JSON.stringify(r)}`,i.ERROR_CODES.KEYWORD_REDEFINITION);if(s.Util.ALIAS_RANGE_BLACKLIST.indexOf(s.Util.getContextValueId(r))>=0)throw new i.ErrorCoded(`Aliasing to certain keywords is not allowed.\nTried mapping ${a} to ${JSON.stringify(r)}`,i.ERROR_CODES.INVALID_KEYWORD_ALIAS);if(r&&s.Util.isPotentialKeyword(s.Util.getContextValueId(r))&&!0===r["@prefix"])throw new i.ErrorCoded(`Tried to use keyword aliases as prefix: '${a}': '${JSON.stringify(r)}'`,i.ERROR_CODES.INVALID_TERM_DEFINITION);for(;s.Util.isPrefixValue(n[a]);){const r=n[a];let i=!1;if("string"==typeof r)n[a]=e.expandTerm(r,!0),i=i||r!==n[a];else{const o=r["@id"],u=r["@type"],c=!("@prefix"in r)||s.Util.isValidIri(a);if("@id"in r)null!=o&&"string"==typeof o&&(n[a]=Object.assign(Object.assign({},n[a]),{"@id":e.expandTerm(o,!0)}),i=i||o!==n[a]["@id"]);else if(!s.Util.isPotentialKeyword(a)&&c){const t=e.expandTerm(a,!0);t!==a&&(n[a]=Object.assign(Object.assign({},n[a]),{"@id":t}),i=!0)}if(u&&"string"==typeof u&&"@vocab"!==u&&(!r["@container"]||!r["@container"]["@type"])&&c){let r=e.expandTerm(u,!0);t&&u===r&&(r=e.expandTerm(u,!1)),r!==u&&(i=!0,n[a]=Object.assign(Object.assign({},n[a]),{"@type":r}))}}if(!i)break}}}normalize(e,{processingMode:t,normalizeLanguageTags:r}){if(r||1===t)for(const t of Object.keys(e))if("@language"===t&&"string"==typeof e[t])e[t]=e[t].toLowerCase();else{const r=e[t];if(r&&"object"==typeof r&&"string"==typeof r["@language"]){const n=r["@language"].toLowerCase();n!==r["@language"]&&(e[t]=Object.assign(Object.assign({},r),{"@language":n}))}}}containersToHash(e){for(const t of Object.keys(e)){const r=e[t];if(r&&"object"==typeof r)if("string"==typeof r["@container"])e[t]=Object.assign(Object.assign({},r),{"@container":{[r["@container"]]:!0}});else if(Array.isArray(r["@container"])){const n={};for(const e of r["@container"])n[e]=!0;e[t]=Object.assign(Object.assign({},r),{"@container":n})}}}applyScopedProtected(e,{processingMode:t},r){if(t&&t>=1.1&&e["@protected"]){for(const t of Object.keys(e))if(!s.Util.isReservedInternalKeyword(t)&&!s.Util.isPotentialKeyword(t)&&!s.Util.isTermProtected(e,t)){const n=e[t];n&&"object"==typeof n?"@protected"in e[t]||(e[t]=Object.assign(Object.assign({},e[t]),{"@protected":!0})):(e[t]={"@id":n,"@protected":!0},s.Util.isSimpleTermDefinitionPrefix(n,r)&&(e[t]=Object.assign(Object.assign({},e[t]),{"@prefix":!0})))}delete e["@protected"]}}validateKeywordRedefinitions(e,t,r,n){for(const r of null!=n?n:Object.keys(t))if(s.Util.isTermProtected(e,r)&&("string"==typeof t[r]?t[r]={"@id":t[r],"@protected":!0}:t[r]=Object.assign(Object.assign({},t[r]),{"@protected":!0}),!s.Util.deepEqual(e[r],t[r])))throw new i.ErrorCoded(`Attempted to override the protected keyword ${r} from ${JSON.stringify(s.Util.getContextValueId(e[r]))} to ${JSON.stringify(s.Util.getContextValueId(t[r]))}`,i.ERROR_CODES.PROTECTED_TERM_REDEFINITION)}validate(e,{processingMode:t}){for(const r of Object.keys(e)){if(s.Util.isReservedInternalKeyword(r))continue;if(""===r)throw new i.ErrorCoded(`The empty term is not allowed, got: '${r}': '${JSON.stringify(e[r])}'`,i.ERROR_CODES.INVALID_TERM_DEFINITION);const n=e[r],a=typeof n;if(s.Util.isPotentialKeyword(r)){switch(r.substr(1)){case"vocab":if(null!==n&&"string"!==a)throw new i.ErrorCoded(`Found an invalid @vocab IRI: ${n}`,i.ERROR_CODES.INVALID_VOCAB_MAPPING);break;case"base":if(null!==n&&"string"!==a)throw new i.ErrorCoded(`Found an invalid @base IRI: ${e[r]}`,i.ERROR_CODES.INVALID_BASE_IRI);break;case"language":null!==n&&u.validateLanguage(n,!0,i.ERROR_CODES.INVALID_DEFAULT_LANGUAGE);break;case"version":if(null!==n&&"number"!==a)throw new i.ErrorCoded(`Found an invalid @version number: ${n}`,i.ERROR_CODES.INVALID_VERSION_VALUE);break;case"direction":null!==n&&u.validateDirection(n,!0);break;case"propagate":if(1===t)throw new i.ErrorCoded(`Found an illegal @propagate keyword: ${n}`,i.ERROR_CODES.INVALID_CONTEXT_ENTRY);if(null!==n&&"boolean"!==a)throw new i.ErrorCoded(`Found an invalid @propagate value: ${n}`,i.ERROR_CODES.INVALID_PROPAGATE_VALUE)}if(s.Util.isValidKeyword(r)&&s.Util.isValidKeyword(s.Util.getContextValueId(n)))throw new i.ErrorCoded(`Illegal keyword alias in term value, found: '${r}': '${s.Util.getContextValueId(n)}'`,i.ERROR_CODES.KEYWORD_REDEFINITION)}else if(null!==n)switch(a){case"string":if(s.Util.getPrefix(n,e)===r)throw new i.ErrorCoded(`Detected cyclical IRI mapping in context entry: '${r}': '${JSON.stringify(n)}'`,i.ERROR_CODES.CYCLIC_IRI_MAPPING);if(s.Util.isValidIriWeak(r)){if("@type"===n)throw new i.ErrorCoded(`IRIs can not be mapped to @type, found: '${r}': '${n}'`,i.ERROR_CODES.INVALID_IRI_MAPPING);if(s.Util.isValidIri(n)&&n!==new o.JsonLdContextNormalized(e).expandTerm(r))throw new i.ErrorCoded(`IRIs can not be mapped to other IRIs, found: '${r}': '${n}'`,i.ERROR_CODES.INVALID_IRI_MAPPING)}break;case"object":if(!(s.Util.isCompactIri(r)||"@id"in n||("@id"===n["@type"]?e["@base"]:e["@vocab"])))throw new i.ErrorCoded(`Missing @id in context entry: '${r}': '${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_IRI_MAPPING);for(const c of Object.keys(n)){const l=n[c];if(l)switch(c){case"@id":if(s.Util.isValidKeyword(l)&&"@type"!==l&&"@id"!==l&&"@graph"!==l&&"@nest"!==l)throw new i.ErrorCoded(`Illegal keyword alias in term value, found: '${r}': '${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_IRI_MAPPING);if(s.Util.isValidIriWeak(r)){if("@type"===l)throw new i.ErrorCoded(`IRIs can not be mapped to @type, found: '${r}': '${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_IRI_MAPPING);if(s.Util.isValidIri(l)&&l!==new o.JsonLdContextNormalized(e).expandTerm(r))throw new i.ErrorCoded(`IRIs can not be mapped to other IRIs, found: '${r}': '${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_IRI_MAPPING)}if("string"!=typeof l)throw new i.ErrorCoded(`Detected non-string @id in context entry: '${r}': '${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_IRI_MAPPING);if(s.Util.getPrefix(l,e)===r)throw new i.ErrorCoded(`Detected cyclical IRI mapping in context entry: '${r}': '${JSON.stringify(n)}'`,i.ERROR_CODES.CYCLIC_IRI_MAPPING);break;case"@type":if("@type"===n["@container"]&&"@id"!==l&&"@vocab"!==l)throw new i.ErrorCoded(`@container: @type only allows @type: @id or @vocab, but got: '${r}': '${l}'`,i.ERROR_CODES.INVALID_TYPE_MAPPING);if("string"!=typeof l)throw new i.ErrorCoded(`The value of an '@type' must be a string, got '${JSON.stringify(a)}'`,i.ERROR_CODES.INVALID_TYPE_MAPPING);if(!("@id"===l||"@vocab"===l||1!==t&&"@json"===l||1!==t&&"@none"===l||"_"!==l[0]&&s.Util.isValidIri(l)))throw new i.ErrorCoded(`A context @type must be an absolute IRI, found: '${r}': '${l}'`,i.ERROR_CODES.INVALID_TYPE_MAPPING);break;case"@reverse":if("string"==typeof l&&n["@id"]&&n["@id"]!==l)throw new i.ErrorCoded(`Found non-matching @id and @reverse term values in '${r}':'${l}' and '${n["@id"]}'`,i.ERROR_CODES.INVALID_REVERSE_PROPERTY);if("@nest"in n)throw new i.ErrorCoded(`@nest is not allowed in the reverse property '${r}'`,i.ERROR_CODES.INVALID_REVERSE_PROPERTY);break;case"@container":if(1===t&&(Object.keys(l).length>1||s.Util.CONTAINERS_1_0.indexOf(Object.keys(l)[0])<0))throw new i.ErrorCoded(`Invalid term @container for '${r}' ('${Object.keys(l)}') in 1.0, must be only one of ${s.Util.CONTAINERS_1_0.join(", ")}`,i.ERROR_CODES.INVALID_CONTAINER_MAPPING);for(const e of Object.keys(l)){if("@list"===e&&n["@reverse"])throw new i.ErrorCoded(`Term value can not be @container: @list and @reverse at the same time on '${r}'`,i.ERROR_CODES.INVALID_REVERSE_PROPERTY);if(s.Util.CONTAINERS.indexOf(e)<0)throw new i.ErrorCoded(`Invalid term @container for '${r}' ('${e}'), must be one of ${s.Util.CONTAINERS.join(", ")}`,i.ERROR_CODES.INVALID_CONTAINER_MAPPING)}break;case"@language":u.validateLanguage(l,!0,i.ERROR_CODES.INVALID_LANGUAGE_MAPPING);break;case"@direction":u.validateDirection(l,!0);break;case"@prefix":if(null!==l&&"boolean"!=typeof l)throw new i.ErrorCoded(`Found an invalid term @prefix boolean in: '${r}': '${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_PREFIX_VALUE);if(!("@id"in n)&&!s.Util.isValidIri(r))throw new i.ErrorCoded(`Invalid @prefix definition for '${r}' ('${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_TERM_DEFINITION);break;case"@index":if(1===t||!n["@container"]||!n["@container"]["@index"])throw new i.ErrorCoded(`Attempt to add illegal key to value object: '${r}': '${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_TERM_DEFINITION);break;case"@nest":if(s.Util.isPotentialKeyword(l)&&"@nest"!==l)throw new i.ErrorCoded(`Found an invalid term @nest value in: '${r}': '${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_NEST_VALUE)}}break;default:throw new i.ErrorCoded(`Found an invalid term value: '${r}': '${n}'`,i.ERROR_CODES.INVALID_TERM_DEFINITION)}}}applyBaseEntry(e,t,r){return"string"==typeof e||(r&&!("@base"in e)&&t.parentContext&&"object"==typeof t.parentContext&&"@base"in t.parentContext&&(e["@base"]=t.parentContext["@base"],t.parentContext["@__baseDocument"]&&(e["@__baseDocument"]=!0)),t.baseIRI&&!t.external&&("@base"in e?null===e["@base"]||"string"!=typeof e["@base"]||s.Util.isValidIri(e["@base"])||(e["@base"]=(0,n.resolve)(e["@base"],t.parentContext&&t.parentContext["@base"]||t.baseIRI)):(e["@base"]=t.baseIRI,e["@__baseDocument"]=!0))),e}normalizeContextIri(e,t){if(!s.Util.isValidIri(e))try{e=(0,n.resolve)(e,t)}catch(t){throw new Error(`Invalid context IRI: ${e}`)}return this.redirectSchemaOrgHttps&&e.startsWith("http://schema.org")&&(e="https://schema.org/"),e}async parseInnerContexts(e,t,r){for(const n of null!=r?r:Object.keys(e)){const r=e[n];if(r&&"object"==typeof r&&"@context"in r&&null!==r["@context"]&&!t.ignoreScopedContexts){if(this.validateContext)try{const i=Object.assign(Object.assign({},e),{[n]:Object.assign({},e[n])});delete i[n]["@context"],await this.parse(r["@context"],Object.assign(Object.assign({},t),{external:!1,parentContext:i,ignoreProtection:!0,ignoreRemoteScopedContexts:!0,ignoreScopedContexts:!0}))}catch(e){throw new i.ErrorCoded(e.message,i.ERROR_CODES.INVALID_SCOPED_CONTEXT)}e[n]=Object.assign(Object.assign({},r),{"@context":(await this.parse(r["@context"],Object.assign(Object.assign({},t),{external:!1,minimalProcessing:!0,ignoreRemoteScopedContexts:!0,parentContext:e}))).getContextRaw()})}}return e}async parse(e,t={},r={}){const{baseIRI:n,parentContext:a,external:c,processingMode:l=u.DEFAULT_PROCESSING_MODE,normalizeLanguageTags:d,ignoreProtection:h,minimalProcessing:p}=t,f=t.remoteContexts||{};if(Object.keys(f).length>=this.remoteContextsDepthLimit)throw new i.ErrorCoded("Detected an overflow in remote context inclusions: "+Object.keys(f),i.ERROR_CODES.CONTEXT_OVERFLOW);if(null==e){if(!h&&a&&s.Util.hasProtectedTerms(a))throw new i.ErrorCoded("Illegal context nullification when terms are protected",i.ERROR_CODES.INVALID_CONTEXT_NULLIFICATION);return new o.JsonLdContextNormalized(this.applyBaseEntry({},t,!1))}if("string"==typeof e){const r=this.normalizeContextIri(e,n),i=this.getOverriddenLoad(r,t);if(i)return new o.JsonLdContextNormalized(i);const a=await this.parse(await this.load(r),Object.assign(Object.assign({},t),{baseIRI:r,external:!0,remoteContexts:Object.assign(Object.assign({},f),{[r]:!0})}));return this.applyBaseEntry(a.getContextRaw(),t,!0),a}if(Array.isArray(e)){const r=[],i=await Promise.all(e.map(((e,i)=>{if("string"==typeof e){const a=this.normalizeContextIri(e,n);r[i]=a;return this.getOverriddenLoad(a,t)||this.load(a)}return e})));if(p)return new o.JsonLdContextNormalized(i);const s=await i.reduce(((e,n,a)=>e.then((e=>this.parse(n,Object.assign(Object.assign({},t),{baseIRI:r[a]||t.baseIRI,external:!!r[a]||t.external,parentContext:e.getContextRaw(),remoteContexts:r[a]?Object.assign(Object.assign({},f),{[r[a]]:!0}):f}),{skipValidation:a=1.1))throw new i.ErrorCoded("Context importing is not supported in JSON-LD 1.0",i.ERROR_CODES.INVALID_CONTEXT_ENTRY);if("string"!=typeof e["@import"])throw new i.ErrorCoded("An @import value must be a string, but got "+typeof e["@import"],i.ERROR_CODES.INVALID_IMPORT_VALUE);f=await this.loadImportContext(this.normalizeContextIri(e["@import"],n)),delete e["@import"]}this.applyScopedProtected(f,{processingMode:l},o.defaultExpandOptions);const y=Object.assign(f,e);this.idifyReverseTerms(y),this.normalize(y,{processingMode:l,normalizeLanguageTags:d}),this.applyScopedProtected(y,{processingMode:l},o.defaultExpandOptions);const g=Object.keys(y),m=[];if("object"==typeof a)for(const e in a)e in y?m.push(e):y[e]=a[e];await this.parseInnerContexts(y,t,g);const b=new o.JsonLdContextNormalized(y);return(y&&y["@version"]||u.DEFAULT_PROCESSING_MODE)>=1.1&&(e["@vocab"]&&"string"==typeof e["@vocab"]||""===e["@vocab"])&&(a&&"@vocab"in a&&e["@vocab"].indexOf(":")<0?y["@vocab"]=a["@vocab"]+e["@vocab"]:(s.Util.isCompactIri(e["@vocab"])||e["@vocab"]in y)&&(y["@vocab"]=b.expandTerm(e["@vocab"],!0))),this.expandPrefixedTerms(b,this.expandContentTypeToBase,g),!h&&a&&l>=1.1&&this.validateKeywordRedefinitions(a,y,o.defaultExpandOptions,m),this.validateContext&&!r.skipValidation&&this.validate(y,{processingMode:l}),b}throw new i.ErrorCoded(`Tried parsing a context that is not a string, array or object, but got ${e}`,i.ERROR_CODES.INVALID_LOCAL_CONTEXT)}async load(e){const t=this.documentCache[e];if(t)return t;let r;try{r=await this.documentLoader.load(e)}catch(t){throw new i.ErrorCoded(`Failed to load remote context ${e}: ${t.message}`,i.ERROR_CODES.LOADING_REMOTE_CONTEXT_FAILED)}if(!("@context"in r))throw new i.ErrorCoded(`Missing @context in remote context at ${e}`,i.ERROR_CODES.INVALID_REMOTE_CONTEXT);return this.documentCache[e]=r["@context"]}getOverriddenLoad(e,t){if(e in(t.remoteContexts||{})){if(t.ignoreRemoteScopedContexts)return e;throw new i.ErrorCoded("Detected a cyclic context inclusion of "+e,i.ERROR_CODES.RECURSIVE_CONTEXT_INCLUSION)}return null}async loadImportContext(e){let t=await this.load(e);if("object"!=typeof t||Array.isArray(t))throw new i.ErrorCoded("An imported context must be a single object: "+e,i.ERROR_CODES.INVALID_REMOTE_CONTEXT);if("@import"in t)throw new i.ErrorCoded("An imported context can not import another context: "+e,i.ERROR_CODES.INVALID_CONTEXT_ENTRY);return t=Object.assign({},t),this.containersToHash(t),t}}u.DEFAULT_PROCESSING_MODE=1.1,t.ContextParser=u},75094:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ERROR_CODES=t.ErrorCoded=void 0;class r extends Error{constructor(e,t){super(e),this.code=t}}var n;t.ErrorCoded=r,(n=t.ERROR_CODES||(t.ERROR_CODES={})).COLLIDING_KEYWORDS="colliding keywords",n.CONFLICTING_INDEXES="conflicting indexes",n.CYCLIC_IRI_MAPPING="cyclic IRI mapping",n.INVALID_ID_VALUE="invalid @id value",n.INVALID_INDEX_VALUE="invalid @index value",n.INVALID_NEST_VALUE="invalid @nest value",n.INVALID_PREFIX_VALUE="invalid @prefix value",n.INVALID_PROPAGATE_VALUE="invalid @propagate value",n.INVALID_REVERSE_VALUE="invalid @reverse value",n.INVALID_IMPORT_VALUE="invalid @import value",n.INVALID_VERSION_VALUE="invalid @version value",n.INVALID_BASE_IRI="invalid base IRI",n.INVALID_CONTAINER_MAPPING="invalid container mapping",n.INVALID_CONTEXT_ENTRY="invalid context entry",n.INVALID_CONTEXT_NULLIFICATION="invalid context nullification",n.INVALID_DEFAULT_LANGUAGE="invalid default language",n.INVALID_INCLUDED_VALUE="invalid @included value",n.INVALID_IRI_MAPPING="invalid IRI mapping",n.INVALID_JSON_LITERAL="invalid JSON literal",n.INVALID_KEYWORD_ALIAS="invalid keyword alias",n.INVALID_LANGUAGE_MAP_VALUE="invalid language map value",n.INVALID_LANGUAGE_MAPPING="invalid language mapping",n.INVALID_LANGUAGE_TAGGED_STRING="invalid language-tagged string",n.INVALID_LANGUAGE_TAGGED_VALUE="invalid language-tagged value",n.INVALID_LOCAL_CONTEXT="invalid local context",n.INVALID_REMOTE_CONTEXT="invalid remote context",n.INVALID_REVERSE_PROPERTY="invalid reverse property",n.INVALID_REVERSE_PROPERTY_MAP="invalid reverse property map",n.INVALID_REVERSE_PROPERTY_VALUE="invalid reverse property value",n.INVALID_SCOPED_CONTEXT="invalid scoped context",n.INVALID_SCRIPT_ELEMENT="invalid script element",n.INVALID_SET_OR_LIST_OBJECT="invalid set or list object",n.INVALID_TERM_DEFINITION="invalid term definition",n.INVALID_TYPE_MAPPING="invalid type mapping",n.INVALID_TYPE_VALUE="invalid type value",n.INVALID_TYPED_VALUE="invalid typed value",n.INVALID_VALUE_OBJECT="invalid value object",n.INVALID_VALUE_OBJECT_VALUE="invalid value object value",n.INVALID_VOCAB_MAPPING="invalid vocab mapping",n.IRI_CONFUSED_WITH_PREFIX="IRI confused with prefix",n.KEYWORD_REDEFINITION="keyword redefinition",n.LOADING_DOCUMENT_FAILED="loading document failed",n.LOADING_REMOTE_CONTEXT_FAILED="loading remote context failed",n.MULTIPLE_CONTEXT_LINK_HEADERS="multiple context link headers",n.PROCESSING_MODE_CONFLICT="processing mode conflict",n.PROTECTED_TERM_REDEFINITION="protected term redefinition",n.CONTEXT_OVERFLOW="context overflow",n.INVALID_BASE_DIRECTION="invalid base direction",n.RECURSIVE_CONTEXT_INCLUSION="recursive context inclusion",n.INVALID_STREAMING_KEY_ORDER="invalid streaming key order",n.INVALID_EMBEDDED_NODE="invalid embedded node",n.INVALID_ANNOTATION="invalid annotation"},60585:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FetchDocumentLoader=void 0,r(86547);const n=r(75094),i=r(2384),a=r(70742);t.FetchDocumentLoader=class{constructor(e){this.fetcher=e}async load(e){const t=await(this.fetcher||fetch)(e,{headers:new Headers({accept:"application/ld+json"})});if(t.ok&&t.headers){let r=t.headers.get("Content-Type");if(r){const e=r.indexOf(";");e>0&&(r=r.substr(0,e))}if("application/ld+json"===r)return await t.json();if(t.headers.has("Link")){let r;if(t.headers.forEach(((t,n)=>{if("link"===n){const n=(0,i.parse)(t);for(const t of n.get("type","application/ld+json"))if("alternate"===t.rel){if(r)throw new Error("Multiple JSON-LD alternate links were found on "+e);r=(0,a.resolve)(t.uri,e)}}})),r)return this.load(r)}throw new n.ErrorCoded(`Unsupported JSON-LD media type ${r}`,n.ERROR_CODES.LOADING_DOCUMENT_FAILED)}throw new Error(t.statusText||`Status code: ${t.status}`)}}},29146:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},45086:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},85215:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultExpandOptions=t.JsonLdContextNormalized=void 0;const n=r(70742),i=r(75094),a=r(94931);t.JsonLdContextNormalized=class{constructor(e){this.contextRaw=e}getContextRaw(){return this.contextRaw}expandTerm(e,r,o=t.defaultExpandOptions){const s=this.contextRaw[e];if(null===s||s&&null===s["@id"])return null;let u=!0;if(s&&r){const t=a.Util.getContextValueId(s);if(t&&t!==e){if("string"==typeof t&&(a.Util.isValidIri(t)||a.Util.isValidKeyword(t)))return t;a.Util.isPotentialKeyword(t)||(u=!1)}}const c=a.Util.getPrefix(e,this.contextRaw),l=this.contextRaw["@vocab"],d=(!!l||""===l)&&l.indexOf(":")<0,h=this.contextRaw["@base"],p=a.Util.isPotentialKeyword(e);if(c){const t=this.contextRaw[c],r=a.Util.getContextValueId(t);if(r){if("string"!=typeof t&&o.allowPrefixForcing){if("_"!==r[0]&&!p&&!t["@prefix"]&&!(e in this.contextRaw))return e}else if(!a.Util.isSimpleTermDefinitionPrefix(r,o))return e;return r+e.substr(c.length+1)}}else{if(r&&(l||""===l||o.allowVocabRelativeToBase&&h&&d)&&!p&&!a.Util.isCompactIri(e)){if(d){if(o.allowVocabRelativeToBase)return(l||h?(0,n.resolve)(l,h):"")+e;throw new i.ErrorCoded(`Relative vocab expansion for term '${e}' with vocab '${l}' is not allowed.`,i.ERROR_CODES.INVALID_VOCAB_MAPPING)}return l+e}if(!r&&h&&!p&&!a.Util.isCompactIri(e))return(0,n.resolve)(e,h)}if(u)return e;throw new i.ErrorCoded(`Invalid IRI mapping found for context entry '${e}': '${JSON.stringify(s)}'`,i.ERROR_CODES.INVALID_IRI_MAPPING)}compactIri(e,t){if(t&&this.contextRaw["@vocab"]&&e.startsWith(this.contextRaw["@vocab"]))return e.substr(this.contextRaw["@vocab"].length);if(!t&&this.contextRaw["@base"]&&e.startsWith(this.contextRaw["@base"]))return e.substr(this.contextRaw["@base"].length);const r={prefix:"",suffix:e};for(const n in this.contextRaw){const i=this.contextRaw[n];if(i&&!a.Util.isPotentialKeyword(n)){const o=a.Util.getContextValueId(i);if(e.startsWith(o)){const i=e.substr(o.length);if(i)i.length{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Util=void 0;class r{static isCompactIri(e){return e.indexOf(":")>0&&!(e&&"#"===e[0])}static getPrefix(e,t){if(e&&"#"===e[0])return null;const r=e.indexOf(":");if(r>=0){if(e.length>r+1&&"/"===e.charAt(r+1)&&"/"===e.charAt(r+2))return null;const n=e.substr(0,r);if("_"===n)return null;if(t[n])return n}return null}static getContextValueId(e){if(null===e||"string"==typeof e)return e;return e["@id"]||null}static isSimpleTermDefinitionPrefix(e,t){return!r.isPotentialKeyword(e)&&(t.allowPrefixNonGenDelims||"string"==typeof e&&("_"===e[0]||r.isPrefixIriEndingWithGenDelim(e)))}static isPotentialKeyword(e){return"string"==typeof e&&r.KEYWORD_REGEX.test(e)}static isPrefixIriEndingWithGenDelim(e){return r.ENDS_WITH_GEN_DELIM.test(e)}static isPrefixValue(e){return e&&("string"==typeof e||e&&"object"==typeof e)}static isValidIri(e){return Boolean(e&&r.IRI_REGEX.test(e))}static isValidIriWeak(e){return!!e&&":"!==e[0]&&r.IRI_REGEX_WEAK.test(e)}static isValidKeyword(e){return r.VALID_KEYWORDS[e]}static isTermProtected(e,t){const r=e[t];return!("string"==typeof r)&&r&&r["@protected"]}static hasProtectedTerms(e){for(const t of Object.keys(e))if(r.isTermProtected(e,t))return!0;return!1}static isReservedInternalKeyword(e){return e.startsWith("@__")}static deepEqual(e,t){const r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every((r=>{const n=e[r],i=t[r];return n===i||null!==n&&null!==i&&"object"==typeof n&&"object"==typeof i&&this.deepEqual(n,i)}))}}r.IRI_REGEX=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^ "<>{}|\\\[\]`#]*(#[^#]*)?$/,r.IRI_REGEX_WEAK=/(?::[^:])|\//,r.KEYWORD_REGEX=/^@[a-z]+$/i,r.ENDS_WITH_GEN_DELIM=/[:/?#\[\]@]$/,r.REGEX_LANGUAGE_TAG=/^[a-zA-Z]+(-[a-zA-Z0-9]+)*$/,r.REGEX_DIRECTION_TAG=/^(ltr)|(rtl)$/,r.VALID_KEYWORDS={"@annotation":!0,"@base":!0,"@container":!0,"@context":!0,"@direction":!0,"@graph":!0,"@id":!0,"@import":!0,"@included":!0,"@index":!0,"@json":!0,"@language":!0,"@list":!0,"@nest":!0,"@none":!0,"@prefix":!0,"@propagate":!0,"@protected":!0,"@reverse":!0,"@set":!0,"@type":!0,"@value":!0,"@version":!0,"@vocab":!0},r.EXPAND_KEYS_BLACKLIST=["@base","@vocab","@language","@version","@direction"],r.ALIAS_DOMAIN_BLACKLIST=["@container","@graph","@id","@index","@list","@nest","@none","@prefix","@reverse","@set","@type","@value","@version"],r.ALIAS_RANGE_BLACKLIST=["@context","@preserve"],r.CONTAINERS=["@list","@set","@index","@language","@graph","@id","@type"],r.CONTAINERS_1_0=["@list","@set","@index"],t.Util=r},38690:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(52277),t)},4405:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContextTree=void 0;class r{constructor(){this.subTrees={}}getContext(e){if(e.length>0){const[t,...r]=e,n=this.subTrees[t];if(n){const e=n.getContext(r);if(e)return e.then((({context:e,depth:t})=>({context:e,depth:t+1})))}}return this.context?this.context.then((e=>({context:e,depth:0}))):null}setContext(e,t){if(0===e.length)this.context=t;else{const[n,...i]=e;let a=this.subTrees[n];a||(a=this.subTrees[n]=new r),a.setContext(i,t)}}removeContext(e){this.setContext(e,null)}}t.ContextTree=r},52277:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JsonLdParser=void 0;const n=r(50608),i=r(42395),a=r(19198),o=r(39693),s=r(64860),u=r(22386),c=r(76970),l=r(23809),d=r(55998),h=r(15517),p=r(70736),f=r(24910),y=r(62036),g=r(86454),m=r(33283),b=r(93099),v=r(10888),_=r(2384),w=r(86105);class T extends a.Transform{constructor(e){super({readableObjectMode:!0}),e=e||{},this.options=e,this.parsingContext=new b.ParsingContext(Object.assign({parser:this},e)),this.util=new v.Util({dataFactory:e.dataFactory,parsingContext:this.parsingContext}),this.jsonParser=new n,this.contextJobs=[],this.typeJobs=[],this.contextAwaitingJobs=[],this.lastDepth=0,this.lastKeys=[],this.lastOnValueJob=Promise.resolve(),this.attachJsonParserListeners(),this.on("end",(()=>{void 0!==this.jsonParser.mode&&this.emit("error",new Error("Unclosed document"))}))}static fromHttpResponse(e,t,r,n){let a,o,s=["application/activity+json"];if(n&&n.wellKnownMediaTypes&&(s=n.wellKnownMediaTypes),"application/ld+json"!==t&&!s.includes(t)){if("application/json"!==t&&!t.endsWith("+json"))throw new i.ErrorCoded(`Unsupported JSON-LD media type ${t}`,i.ERROR_CODES.LOADING_DOCUMENT_FAILED);if(r&&r.has("Link")&&r.forEach(((t,r)=>{if("link"===r){const r=(0,_.parse)(t);for(const t of r.get("rel","http://www.w3.org/ns/json-ld#context")){if(a)throw new i.ErrorCoded("Multiple JSON-LD context link headers were found on "+e,i.ERROR_CODES.MULTIPLE_CONTEXT_LINK_HEADERS);a=t.uri}}})),!a&&!(null==n?void 0:n.ignoreMissingContextLinkHeader))throw new i.ErrorCoded(`Missing context link header for media type ${t} on ${e}`,i.ERROR_CODES.LOADING_DOCUMENT_FAILED)}if(r&&r.has("Content-Type")){const e=r.get("Content-Type"),t=/; *profile=([^"]*)/.exec(e);t&&"http://www.w3.org/ns/json-ld#streaming"===t[1]&&(o=!0)}return new T(Object.assign({baseIRI:e,context:a,streamingProfile:o},n||{}))}import(e){if("pipe"in e){e.on("error",(e=>t.emit("error",e)));const t=e.pipe(new T(this.options));return t}{const t=new a.PassThrough({readableObjectMode:!0});e.on("error",(e=>r.emit("error",e))),e.on("data",(e=>t.push(e))),e.on("end",(()=>t.push(null)));const r=t.pipe(new T(this.options));return r}}_transform(e,t,r){this.jsonParser.write(e),this.lastOnValueJob.then((()=>r()),(e=>r(e)))}async newOnValueJob(e,t,r,n){let a=!0;if(n&&r1&&(l=this.parsingContext.validationStack[this.parsingContext.validationStack.length-1].property);for(let t=Math.max(1,this.parsingContext.validationStack.length-1);t=0?this.parsingContext.idStack[e-r-1]:[await this.util.getGraphContainerValue(t,e)];if(a)for(const t of a){this.parsingContext.emittedStack[e]=!0;for(const r of n)this.util.emitQuadChecked(e,i,r.predicate,r.object,t,r.reverse,r.isEmbedded)}else{const r=this.parsingContext.getUnidentifiedGraphBufferSafe(e-await this.util.getDepthOffsetGraph(e,t)-1);for(const e of n)e.reverse?r.push({object:i,predicate:e.predicate,subject:e.object,isEmbedded:e.isEmbedded}):r.push({object:e.object,predicate:e.predicate,subject:i,isEmbedded:e.isEmbedded})}}this.parsingContext.unidentifiedValuesBuffer.splice(e,1),this.parsingContext.literalStack.splice(e,1),this.parsingContext.jsonLiteralStack.splice(e,1)}const a=this.parsingContext.unidentifiedGraphsBuffer[e];if(a){for(const t of r){const r=1!==e||"BlankNode"!==t.termType||this.parsingContext.topLevelProperties?t:this.util.getDefaultGraph();this.parsingContext.emittedStack[e]=!0;for(const t of a)this.parsingContext.emitQuad(e,this.util.dataFactory.quad(t.subject,t.predicate,t.object,r))}this.parsingContext.unidentifiedGraphsBuffer.splice(e,1)}const o=this.parsingContext.annotationsBuffer[e];if(o){o.length>0&&1===e&&this.parsingContext.emitError(new i.ErrorCoded("Annotations can not be made on top-level nodes",i.ERROR_CODES.INVALID_ANNOTATION));const t=this.parsingContext.getAnnotationsBufferSafe(e-1);for(const e of o)t.push(e);delete this.parsingContext.annotationsBuffer[e]}}async validateKey(e,t,r){for(const n of T.ENTRY_HANDLERS)if(await n.validate(this.parsingContext,this.util,e,t,r))return{valid:!0,property:r||n.isPropertyHandler()};return{valid:!1,property:!1}}attachJsonParserListeners(){this.jsonParser.onValue=e=>{const t=this.jsonParser.stack.length,r=new Array(t+1).fill(0).map(((e,r)=>r===t?this.jsonParser.key:this.jsonParser.stack[r].key));if(!this.isParsingContextInner(t)){const n=()=>this.newOnValueJob(r,e,t,!0);if(this.parsingContext.streamingProfile||this.parsingContext.contextTree.getContext(r.slice(0,-1)))this.lastOnValueJob=this.lastOnValueJob.then(n);else if("@context"===r[t]){let e=this.contextJobs[t];e||(e=this.contextJobs[t]=[]),e.push(n)}else this.contextAwaitingJobs.push({job:n,keys:r,depth:t});this.parsingContext.streamingProfile||0!==t||(this.lastOnValueJob=this.lastOnValueJob.then((()=>this.executeBufferedJobs())))}},this.jsonParser.onError=e=>{this.emit("error",e)}}isParsingContextInner(e){for(let t=e;t>0;t--)if("@context"===this.jsonParser.stack[t-1].key)return!0;return!1}async executeBufferedJobs(){for(const e of this.contextJobs)if(e)for(const t of e)await t();this.parsingContext.unaliasedKeywordCacheStack.splice(0);const e=[];for(const t of this.contextAwaitingJobs)"@type"===await this.util.unaliasKeyword(t.keys[t.depth],t.keys,t.depth,!0)||"number"==typeof t.keys[t.depth]&&"@type"===await this.util.unaliasKeyword(t.keys[t.depth-1],t.keys,t.depth-1,!0)?this.typeJobs.push({job:t.job,keys:t.keys.slice(0,t.keys.length-1)}):e.push(t);for(const t of e){if(this.typeJobs.length>0){const e=[],r=[];for(let n=0;ne.keys.length-t.keys.length));for(const e of n)await e.job();const i=r.sort().reverse();for(const e of i)this.typeJobs.splice(e,1)}await t.job()}}}T.DEFAULT_PROCESSING_MODE="1.1",T.ENTRY_HANDLERS=[new o.EntryHandlerArrayValue,new l.EntryHandlerKeywordContext,new h.EntryHandlerKeywordId,new p.EntryHandlerKeywordIncluded,new d.EntryHandlerKeywordGraph,new f.EntryHandlerKeywordNest,new y.EntryHandlerKeywordType,new m.EntryHandlerKeywordValue,new w.EntryHandlerKeywordAnnotation,new s.EntryHandlerContainer,new g.EntryHandlerKeywordUnknownFallback,new c.EntryHandlerPredicate,new u.EntryHandlerInvalidFallback],t.JsonLdParser=T},93099:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ParsingContext=void 0;const n=r(42395),i=r(75094),a=r(4405),o=r(52277);class s{constructor(e){this.contextParser=new n.ContextParser({documentLoader:e.documentLoader,skipValidation:e.skipContextValidation}),this.streamingProfile=!!e.streamingProfile,this.baseIRI=e.baseIRI,this.produceGeneralizedRdf=!!e.produceGeneralizedRdf,this.allowSubjectList=!!e.allowSubjectList,this.processingMode=e.processingMode||o.JsonLdParser.DEFAULT_PROCESSING_MODE,this.strictValues=!!e.strictValues,this.validateValueIndexes=!!e.validateValueIndexes,this.defaultGraph=e.defaultGraph,this.rdfDirection=e.rdfDirection,this.normalizeLanguageTags=e.normalizeLanguageTags,this.streamingProfileAllowOutOfOrderPlainType=e.streamingProfileAllowOutOfOrderPlainType,this.rdfstar=!1!==e.rdfstar,this.rdfstarReverseInEmbedded=e.rdfstarReverseInEmbedded,this.topLevelProperties=!1,this.activeProcessingMode=parseFloat(this.processingMode),this.processingStack=[],this.processingType=[],this.emittedStack=[],this.idStack=[],this.graphStack=[],this.graphContainerTermStack=[],this.listPointerStack=[],this.contextTree=new a.ContextTree,this.literalStack=[],this.validationStack=[],this.unaliasedKeywordCacheStack=[],this.jsonLiteralStack=[],this.unidentifiedValuesBuffer=[],this.unidentifiedGraphsBuffer=[],this.annotationsBuffer=[],this.pendingContainerFlushBuffers=[],this.parser=e.parser,e.context?(this.rootContext=this.parseContext(e.context),this.rootContext.then((e=>this.validateContext(e)))):this.rootContext=Promise.resolve(new n.JsonLdContextNormalized(this.baseIRI?{"@base":this.baseIRI,"@__baseDocument":!0}:{}))}async parseContext(e,t,r){return this.contextParser.parse(e,{baseIRI:this.baseIRI,ignoreProtection:r,normalizeLanguageTags:this.normalizeLanguageTags,parentContext:t,processingMode:this.activeProcessingMode})}validateContext(e){const t=e.getContextRaw()["@version"];if(t){if(this.activeProcessingMode&&t>this.activeProcessingMode)throw new i.ErrorCoded(`Unsupported JSON-LD version '${t}' under active processing mode ${this.activeProcessingMode}.`,i.ERROR_CODES.PROCESSING_MODE_CONFLICT);if(this.activeProcessingMode&&t0&&!1===i.context.getContextRaw()["@propagate"]&&i.depth!==t&&!r);return 0===i.depth&&!1===i.context.getContextRaw()["@propagate"]&&i.depth!==t&&(i.context=new n.JsonLdContextNormalized({})),i}async newOnValueJob(e,t,r,n){await this.parser.newOnValueJob(e,t,r,n)}async handlePendingContainerFlushBuffers(){if(this.pendingContainerFlushBuffers.length>0){for(const e of this.pendingContainerFlushBuffers)await this.parser.flushBuffer(e.depth,e.keys),this.parser.flushStacks(e.depth);return this.pendingContainerFlushBuffers.splice(0,this.pendingContainerFlushBuffers.length),!0}return!1}emitQuad(e,t){1===e&&(this.topLevelProperties=!0),this.parser.push(t)}emitError(e){this.parser.emit("error",e)}emitContext(e){this.parser.emit("context",e)}getUnidentifiedValueBufferSafe(e){let t=this.unidentifiedValuesBuffer[e];return t||(t=[],this.unidentifiedValuesBuffer[e]=t),t}getUnidentifiedGraphBufferSafe(e){let t=this.unidentifiedGraphsBuffer[e];return t||(t=[],this.unidentifiedGraphsBuffer[e]=t),t}getAnnotationsBufferSafe(e){let t=this.annotationsBuffer[e];return t||(t=[],this.annotationsBuffer[e]=t),t}getExpandOptions(){return s.EXPAND_OPTIONS[this.activeProcessingMode]}shiftStack(e,t){const r=this.idStack[e+t];if(r&&(this.idStack[e]=r,this.emittedStack[e]=!0,delete this.idStack[e+t]),this.pendingContainerFlushBuffers.length)for(const r of this.pendingContainerFlushBuffers)r.depth>=e+t&&(r.depth-=t,r.keys.splice(e,t));this.unidentifiedValuesBuffer[e+t]&&(this.unidentifiedValuesBuffer[e]=this.unidentifiedValuesBuffer[e+t],delete this.unidentifiedValuesBuffer[e+t]),this.annotationsBuffer[e+t-1]&&(this.annotationsBuffer[e-1]||(this.annotationsBuffer[e-1]=[]),this.annotationsBuffer[e-1]=[...this.annotationsBuffer[e-1],...this.annotationsBuffer[e+t-1]],delete this.annotationsBuffer[e+t-1])}}s.EXPAND_OPTIONS={1:{allowPrefixForcing:!1,allowPrefixNonGenDelims:!1,allowVocabRelativeToBase:!1},1.1:{allowPrefixForcing:!0,allowPrefixNonGenDelims:!1,allowVocabRelativeToBase:!0}},t.ParsingContext=s},10888:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Util=void 0;const n=r(42395),i=r(47793),a=r(64860),o=r(29344);class s{constructor(e){this.parsingContext=e.parsingContext,this.dataFactory=e.dataFactory||new i.DataFactory,this.rdfFirst=this.dataFactory.namedNode(s.RDF+"first"),this.rdfRest=this.dataFactory.namedNode(s.RDF+"rest"),this.rdfNil=this.dataFactory.namedNode(s.RDF+"nil"),this.rdfType=this.dataFactory.namedNode(s.RDF+"type"),this.rdfJson=this.dataFactory.namedNode(s.RDF+"JSON")}static getContextValue(e,t,r,n){const i=e.getContextRaw()[r];if(!i)return n;const a=i[t];return void 0===a?n:a}static getContextValueContainer(e,t){return s.getContextValue(e,"@container",t,{"@set":!0})}static getContextValueType(e,t){const r=s.getContextValue(e,"@type",t,null);return"@none"===r?null:r}static getContextValueLanguage(e,t){return s.getContextValue(e,"@language",t,e.getContextRaw()["@language"]||null)}static getContextValueDirection(e,t){return s.getContextValue(e,"@direction",t,e.getContextRaw()["@direction"]||null)}static isContextValueReverse(e,t){return!!s.getContextValue(e,"@reverse",t,null)}static getContextValueIndex(e,t){return s.getContextValue(e,"@index",t,e.getContextRaw()["@index"]||null)}static isPropertyReverse(e,t,r){return"@reverse"===r!==s.isContextValueReverse(e,t)}static isPropertyInEmbeddedNode(e){return"@id"===e}static isPropertyInAnnotationObject(e){return"@annotation"===e}static isValidIri(e){return null!==e&&n.Util.isValidIri(e)}static isPrefixArray(e,t){if(e.length>t.length)return!1;for(let r=0;r1)throw new n.ErrorCoded(`Found illegal neighbouring entries next to @set for key: '${t}'`,n.ERROR_CODES.INVALID_SET_OR_LIST_OBJECT);return[]}if("@list"in r){if(Object.keys(r).length>1)throw new n.ErrorCoded(`Found illegal neighbouring entries next to @list for key: '${t}'`,n.ERROR_CODES.INVALID_SET_OR_LIST_OBJECT);const e=r["@list"];return Array.isArray(e)?0===e.length?[this.rdfNil]:this.parsingContext.idStack[i+1]||[]:await this.valueToTerm(await this.parsingContext.getContext(a),t,e,i-1,a.slice(0,-1))}if("@reverse"in r&&"boolean"==typeof r["@reverse"])return[];if("@graph"in s.getContextValueContainer(await this.parsingContext.getContext(a),t)){const e=this.parsingContext.graphContainerTermStack[i+1];return e?Object.values(e):[this.dataFactory.blankNode()]}if("@id"in r){if(Object.keys(r).length>1&&(e=await this.parsingContext.getContext(a,0)),"@context"in r&&(e=await this.parsingContext.parseContext(r["@context"],e.getContextRaw())),"@vocab"===r["@type"])return this.nullableTermToArray(this.createVocabOrBaseTerm(e,r["@id"]));{const t=r["@id"];let a;if("object"==typeof t){if(!this.parsingContext.rdfstar)throw new n.ErrorCoded(`Found illegal @id '${r}'`,n.ERROR_CODES.INVALID_ID_VALUE);a=this.parsingContext.idStack[i+1][0]}else a=this.resourceToTerm(e,t);return this.nullableTermToArray(a)}}return this.parsingContext.emittedStack[i+1]||r&&"object"==typeof r&&0===Object.keys(r).length?this.parsingContext.idStack[i+1]||(this.parsingContext.idStack[i+1]=[this.dataFactory.blankNode()]):[];case"string":return this.nullableTermToArray(this.stringValueToTerm(i,await this.getContextSelfOrPropertyScoped(e,t),t,r,null));case"boolean":return this.nullableTermToArray(this.stringValueToTerm(i,await this.getContextSelfOrPropertyScoped(e,t),t,Boolean(r).toString(),this.dataFactory.namedNode(s.XSD_BOOLEAN)));case"number":return this.nullableTermToArray(this.stringValueToTerm(i,await this.getContextSelfOrPropertyScoped(e,t),t,r,this.dataFactory.namedNode(r%1==0&&r<1e21?s.XSD_INTEGER:s.XSD_DOUBLE)));default:return this.parsingContext.emitError(new Error(`Could not determine the RDF type of a ${o}`)),[]}}async getContextSelfOrPropertyScoped(e,t){const r=e.getContextRaw()[t];return r&&"object"==typeof r&&"@context"in r&&(e=await this.parsingContext.parseContext(r,e.getContextRaw(),!0)),e}nullableTermToArray(e){return e?[e]:[]}predicateToTerm(e,t){const r=e.expandTerm(t,!0,this.parsingContext.getExpandOptions());return r?"_"===r[0]&&":"===r[1]?this.parsingContext.produceGeneralizedRdf?this.dataFactory.blankNode(r.substr(2)):null:s.isValidIri(r)?this.dataFactory.namedNode(r):r&&this.parsingContext.strictValues?(this.parsingContext.emitError(new n.ErrorCoded(`Invalid predicate IRI: ${r}`,n.ERROR_CODES.INVALID_IRI_MAPPING)),null):null:null}resourceToTerm(e,t){if(t.startsWith("_:"))return this.dataFactory.blankNode(t.substr(2));const r=e.expandTerm(t,!1,this.parsingContext.getExpandOptions());if(!s.isValidIri(r)){if(!r||!this.parsingContext.strictValues)return null;this.parsingContext.emitError(new Error(`Invalid resource IRI: ${r}`))}return this.dataFactory.namedNode(r)}createVocabOrBaseTerm(e,t){if(t.startsWith("_:"))return this.dataFactory.blankNode(t.substr(2));const r=this.parsingContext.getExpandOptions();let n=e.expandTerm(t,!0,r);if(n===t&&(n=e.expandTerm(t,!1,r)),!s.isValidIri(n)){if(!n||!this.parsingContext.strictValues||n.startsWith("@"))return null;this.parsingContext.emitError(new Error(`Invalid term IRI: ${n}`))}return this.dataFactory.namedNode(n)}intToString(e,t){return"number"==typeof e?Number.isFinite(e)?e%1!=0||t&&t.value===s.XSD_DOUBLE?e.toExponential(15).replace(/(\d)0*e\+?/,"$1E"):Number(e).toString():e>0?"INF":"-INF":e}stringValueToTerm(e,t,r,n,i){const a=s.getContextValueType(t,r);if(a)if("@id"===a){if(!i)return this.resourceToTerm(t,this.intToString(n,i))}else if("@vocab"===a){if(!i)return this.createVocabOrBaseTerm(t,this.intToString(n,i))}else i=this.dataFactory.namedNode(a);if(!i){const a=s.getContextValueLanguage(t,r),o=s.getContextValueDirection(t,r);return o&&this.parsingContext.rdfDirection?this.createLanguageDirectionLiteral(e,this.intToString(n,i),a,o):this.dataFactory.literal(this.intToString(n,i),a)}return this.dataFactory.literal(this.intToString(n,i),i)}createLanguageDirectionLiteral(e,t,r,n){if("i18n-datatype"===this.parsingContext.rdfDirection)return r||(r=""),this.dataFactory.literal(t,this.dataFactory.namedNode(`https://www.w3.org/ns/i18n#${r}_${n}`));{const i=this.dataFactory.blankNode(),a=this.getDefaultGraph();return this.parsingContext.emitQuad(e,this.dataFactory.quad(i,this.dataFactory.namedNode(s.RDF+"value"),this.dataFactory.literal(t),a)),r&&this.parsingContext.emitQuad(e,this.dataFactory.quad(i,this.dataFactory.namedNode(s.RDF+"language"),this.dataFactory.literal(r),a)),this.parsingContext.emitQuad(e,this.dataFactory.quad(i,this.dataFactory.namedNode(s.RDF+"direction"),this.dataFactory.literal(n),a)),i}}valueToJsonString(e){return o(e)}async unaliasKeyword(e,t,r,i,a){if(Number.isInteger(e))return e;if(!i){const e=this.parsingContext.unaliasedKeywordCacheStack[r];if(e)return e}if(!n.Util.isPotentialKeyword(e)){let r=(a=a||await this.parsingContext.getContext(t)).getContextRaw()[e];r&&"object"==typeof r&&(r=r["@id"]),n.Util.isValidKeyword(r)&&(e=r)}return i?e:this.parsingContext.unaliasedKeywordCacheStack[r]=e}async unaliasKeywordParent(e,t){return await this.unaliasKeyword(t>0&&e[t-1],e,t-1)}async unaliasKeywords(e,t,r,n){const i={};for(const a in e)i[await this.unaliasKeyword(a,t,r+1,!0,n)]=e[a];return i}async isLiteral(e,t){for(let r=t;r>=0;r--){if("@annotation"===await this.unaliasKeyword(e[r],e,r))return!1;if(this.parsingContext.literalStack[r]||this.parsingContext.jsonLiteralStack[r])return!0}return!1}async getDepthOffsetGraph(e,t){for(let r=e-1;r>0;r--)if("@graph"===await this.unaliasKeyword(t[r],t,r)){const n=(await a.EntryHandlerContainer.getContainerHandler(this.parsingContext,t,r)).containers;return a.EntryHandlerContainer.isComplexGraphContainer(n)?-1:e-r-1}return-1}validateReverseSubject(e){if("Literal"===e.termType)throw new n.ErrorCoded(`Found illegal literal in subject position: ${e.value}`,n.ERROR_CODES.INVALID_REVERSE_PROPERTY_VALUE)}getDefaultGraph(){return this.parsingContext.defaultGraph||this.dataFactory.defaultGraph()}async getGraphContainerValue(e,t){let r=this.getDefaultGraph();const{containers:n,depth:i}=await a.EntryHandlerContainer.getContainerHandler(this.parsingContext,e,t);if("@graph"in n){const t=a.EntryHandlerContainer.getContainerGraphIndex(n,i,e),o=this.parsingContext.graphContainerTermStack[i];if(r=o?o[t]:null,!r){let a=null;if("@id"in n){const t=await this.getContainerKey(e[i],e,i);null!==t&&(a=await this.resourceToTerm(await this.parsingContext.getContext(e),t))}a||(a=this.dataFactory.blankNode()),this.parsingContext.graphContainerTermStack[i]||(this.parsingContext.graphContainerTermStack[i]={}),r=this.parsingContext.graphContainerTermStack[i][t]=a}}return r}async getPropertiesDepth(e,t){let r=t;for(let n=t-1;n>0;n--)if("number"!=typeof e[n]){const t=await this.unaliasKeyword(e[n],e,n);if("@reverse"===t)return n;if("@nest"!==t)return r;r=n}return r}async getContainerKey(e,t,r){const n=await this.unaliasKeyword(e,t,r);return"@none"===n?null:n}validateReverseInEmbeddedNode(e,t,r){if(r&&t&&!this.parsingContext.rdfstarReverseInEmbedded)throw new n.ErrorCoded(`Illegal reverse property in embedded node in ${e}`,n.ERROR_CODES.INVALID_EMBEDDED_NODE)}emitQuadChecked(e,t,r,i,a,o,s){let u;if(o?(this.validateReverseSubject(i),u=this.dataFactory.quad(i,r,t,a)):u=this.dataFactory.quad(t,r,i,a),s){if("DefaultGraph"!==u.graph.termType&&(u=this.dataFactory.quad(u.subject,u.predicate,u.object)),this.parsingContext.idStack[e-1])throw new n.ErrorCoded("Illegal multiple properties in an embedded node",n.ERROR_CODES.INVALID_EMBEDDED_NODE);this.parsingContext.idStack[e-1]=[u]}else this.parsingContext.emitQuad(e,u);const c=this.parsingContext.annotationsBuffer[e];if(c){for(const t of c)this.emitAnnotation(e,u,t);delete this.parsingContext.annotationsBuffer[e]}}emitAnnotation(e,t,r){let n;r.reverse?(this.validateReverseSubject(r.object),n=this.dataFactory.quad(r.object,r.predicate,t)):n=this.dataFactory.quad(t,r.predicate,r.object),this.parsingContext.emitQuad(e,n);for(const t of r.nestedAnnotations)this.emitAnnotation(e,n,t)}}s.XSD="http://www.w3.org/2001/XMLSchema#",s.XSD_BOOLEAN=s.XSD+"boolean",s.XSD_INTEGER=s.XSD+"integer",s.XSD_DOUBLE=s.XSD+"double",s.RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#",t.Util=s},7986:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContainerHandlerIdentifier=void 0,t.ContainerHandlerIdentifier=class{canCombineWithGraph(){return!0}async handle(e,t,r,n,i,a){let o;if(t.emittedStack[a+1]&&t.idStack[a+1])o=t.idStack[a+1][0];else{const e=null!==await r.getContainerKey(n[a],n,a)?await r.resourceToTerm(await t.getContext(n),n[a]):r.dataFactory.blankNode();if(!e)return void(t.emittedStack[a]=!1);o=e,t.idStack[a+1]=[o]}let s=t.idStack[a];s||(s=t.idStack[a]=[]),s.some((e=>e.equals(o)))||s.push(o),await t.handlePendingContainerFlushBuffers()||(t.emittedStack[a]=!1)}}},71977:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContainerHandlerIndex=void 0;const n=r(42395),i=r(76970),a=r(10888);t.ContainerHandlerIndex=class{canCombineWithGraph(){return!0}async handle(e,t,r,o,s,u){if(!Array.isArray(s)){const c="@graph"in e,l=await t.getContext(o),d=o[u-1],h=a.Util.getContextValueIndex(l,d);if(h){if(n.Util.isPotentialKeyword(h))throw new n.ErrorCoded(`Keywords can not be used as @index value, got: ${h}`,n.ERROR_CODES.INVALID_TERM_DEFINITION);if("string"!=typeof h)throw new n.ErrorCoded(`@index values must be strings, got: ${h}`,n.ERROR_CODES.INVALID_TERM_DEFINITION);if("object"!=typeof s){if("@id"!==a.Util.getContextValueType(l,d))throw new n.ErrorCoded(`Property-based index containers require nodes as values or strings with @type: @id, but got: ${s}`,n.ERROR_CODES.INVALID_VALUE_OBJECT);const e=r.resourceToTerm(l,s);e&&(t.idStack[u+1]=[e])}const e=r.createVocabOrBaseTerm(l,h);if(e){const n=await r.valueToTerm(l,h,await r.getContainerKey(o[u],o,u),u,o);if(c){const i=await r.getGraphContainerValue(o,u+1);for(const a of n)t.emitQuad(u,r.dataFactory.quad(i,e,a,r.getDefaultGraph()))}else for(const a of n)await i.EntryHandlerPredicate.handlePredicateObject(t,r,o,u+1,e,a,!1,!1,!1)}}const p=c?2:1;await t.newOnValueJob(o.slice(0,o.length-p),s,u-p,!0),await t.handlePendingContainerFlushBuffers()}t.emittedStack[u]=!1}}},63847:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContainerHandlerLanguage=void 0;const n=r(42395);t.ContainerHandlerLanguage=class{canCombineWithGraph(){return!1}async handle(e,t,r,i,a,o){const s=await r.getContainerKey(i[o],i,o);if(Array.isArray(a))a=a.map((e=>({"@value":e,"@language":s})));else{if("string"!=typeof a)throw new n.ErrorCoded(`Got invalid language map value, got '${JSON.stringify(a)}', but expected string`,n.ERROR_CODES.INVALID_LANGUAGE_MAP_VALUE);a={"@value":a,"@language":s}}await t.newOnValueJob(i.slice(0,i.length-1),a,o-1,!0),t.emittedStack[o]=!1}}},47229:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContainerHandlerType=void 0;const n=r(76970),i=r(10888);t.ContainerHandlerType=class{canCombineWithGraph(){return!1}async handle(e,t,r,a,o,s){if(!Array.isArray(o)){if("string"==typeof o){const e=await t.getContext(a),n="@vocab"===i.Util.getContextValueType(e,a[s-1])?await r.createVocabOrBaseTerm(e,o):await r.resourceToTerm(e,o);if(n){const e={"@id":"NamedNode"===n.termType?n.value:o};await t.newOnValueJob(a.slice(0,a.length-1),e,s-1,!0),t.idStack[s+1]=[n]}}else{const e=!!t.idStack[s+1];e||delete t.idStack[s],await t.newOnValueJob(a.slice(0,a.length-1),o,s-1,!0),e||(t.idStack[s+1]=t.idStack[s])}const e=await r.getContainerKey(a[s],a,s),u=null!==e?r.createVocabOrBaseTerm(await t.getContext(a),e):null;u&&await n.EntryHandlerPredicate.handlePredicateObject(t,r,a,s+1,r.rdfType,u,!1,!1,!1),await t.handlePendingContainerFlushBuffers()}t.emittedStack[s]=!1}}},39693:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerArrayValue=void 0;const n=r(10888),i=r(42395);t.EntryHandlerArrayValue=class{isPropertyHandler(){return!1}isStackProcessor(){return!0}async validate(e,t,r,n,i){return this.test(e,t,null,r,n)}async test(e,t,r,n,i){return"number"==typeof n[i]}async handle(e,t,r,i,a,o){let s=await t.unaliasKeywordParent(i,o);if("@list"===s){let r=null,n=0;for(let e=o-2;e>0;e--){const t=i[e];if("string"==typeof t||"number"==typeof t){n=e,r=t;break}}if(null!==r){const s=await t.valueToTerm(await e.getContext(i),r,a,o,i);for(const r of s)await this.handleListElement(e,t,r,a,o,i.slice(0,n),n);0===s.length&&await this.handleListElement(e,t,null,a,o,i.slice(0,n),n)}}else if("@set"===s)await e.newOnValueJob(i.slice(0,-2),a,o-2,!1);else if(void 0!==s&&"@type"!==s){for(let e=o-1;e>0;e--)if("number"!=typeof i[e]){s=await t.unaliasKeyword(i[e],i,e);break}const r=await e.getContext(i.slice(0,-1));if("@list"in n.Util.getContextValueContainer(r,s)){e.emittedStack[o+1]=!0;const r=await t.valueToTerm(await e.getContext(i),s,a,o,i);for(const n of r)await this.handleListElement(e,t,n,a,o,i.slice(0,-1),o-1);0===r.length&&await this.handleListElement(e,t,null,a,o,i.slice(0,-1),o-1)}else e.shiftStack(o,1),await e.newOnValueJob(i.slice(0,-1),a,o-1,!1),e.contextTree.removeContext(i.slice(0,-1))}}async handleListElement(e,t,r,n,a,o,s){let u=e.listPointerStack[a];if(null!==n&&null!==(await t.unaliasKeywords(n,o,a))["@value"]){if(u&&u.value){const r=t.dataFactory.blankNode();e.emitQuad(a,t.dataFactory.quad(u.value,t.rdfRest,r,t.getDefaultGraph())),u.value=r}else{const e=t.dataFactory.blankNode();u={value:e,listRootDepth:s,listId:e}}r&&e.emitQuad(a,t.dataFactory.quad(u.value,t.rdfFirst,r,t.getDefaultGraph()))}else u||(u={listRootDepth:s,listId:t.rdfNil});e.listPointerStack[a]=u,e.rdfstar&&e.annotationsBuffer[a]&&e.emitError(new i.ErrorCoded("Found an illegal annotation inside a list",i.ERROR_CODES.INVALID_ANNOTATION))}}},64860:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerContainer=void 0;const n=r(7986),i=r(71977),a=r(63847),o=r(47229),s=r(10888);class u{static isSimpleGraphContainer(e){return"@graph"in e&&("@set"in e&&2===Object.keys(e).length||1===Object.keys(e).length)}static isComplexGraphContainer(e){return"@graph"in e&&("@set"in e&&Object.keys(e).length>2||!("@set"in e)&&Object.keys(e).length>1)}static getContainerGraphIndex(e,t,r){let n=u.isSimpleGraphContainer(e),i="";for(let e=t;e=0;e--)if("number"!=typeof t[e]){const r=s.Util.getContextValue(a,"@container",t[e],!1);if(r&&u.isSimpleGraphContainer(r))return{containers:r,depth:e+1,fallback:!1};const o=s.Util.getContextValue(a,"@container",t[e-1],!1);if(o){const t="@graph"in o;for(const r in u.CONTAINER_HANDLERS)if(o[r])return t?u.CONTAINER_HANDLERS[r].canCombineWithGraph()?{containers:o,depth:e,fallback:!1}:n:i?n:{containers:o,depth:e,fallback:!1};return n}if(i)return n;i=!0}return n}static async isBufferableContainerHandler(e,t,r){const n=await u.getContainerHandler(e,t,r);return!n.fallback&&!("@graph"in n.containers)}isPropertyHandler(){return!1}isStackProcessor(){return!0}async validate(e,t,r,n,i){return!!await this.test(e,t,null,r,n)}async test(e,t,r,n,i){const a=s.Util.getContextValueContainer(await e.getContext(n,2),n[i-1]);for(const e in u.CONTAINER_HANDLERS)if(a[e])return{containers:a,handler:u.CONTAINER_HANDLERS[e]};return null}async handle(e,t,r,n,i,a,o){return o.handler.handle(o.containers,e,t,n,i,a)}}u.CONTAINER_HANDLERS={"@id":new n.ContainerHandlerIdentifier,"@index":new i.ContainerHandlerIndex,"@language":new a.ContainerHandlerLanguage,"@type":new o.ContainerHandlerType},t.EntryHandlerContainer=u},22386:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerInvalidFallback=void 0,t.EntryHandlerInvalidFallback=class{isPropertyHandler(){return!1}isStackProcessor(){return!0}async validate(e,t,r,n,i){return!1}async test(e,t,r,n,i){return!0}async handle(e,t,r,n,i,a){e.emittedStack[a]=!1}}},76970:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerPredicate=void 0;const n=r(42395),i=r(10888);class a{static async handlePredicateObject(e,t,r,i,a,o,s,u,c){const l=await t.getPropertiesDepth(r,i),d=await t.getDepthOffsetGraph(i,r),h=i-d,p=e.idStack[l];if(p&&!c)for(const n of p)if(d>=0){const r=e.idStack[h-1];if(r)for(const e of r)t.emitQuadChecked(i,n,a,o,e,s,u);else s?(t.validateReverseSubject(o),e.getUnidentifiedGraphBufferSafe(h-1).push({subject:o,predicate:a,object:n,isEmbedded:u})):e.getUnidentifiedGraphBufferSafe(h-1).push({subject:n,predicate:a,object:o,isEmbedded:u})}else{const e=await t.getGraphContainerValue(r,l);t.emitQuadChecked(i,n,a,o,e,s,u)}else if(s&&t.validateReverseSubject(o),c){if(e.rdfstar){e.idStack[i]&&e.emitError(new n.ErrorCoded(`Found an illegal @id inside an annotation: ${e.idStack[i][0].value}`,n.ERROR_CODES.INVALID_ANNOTATION));for(let a=0;a=0;e--){const t=u[e];t.depth>l&&(c.nestedAnnotations.push(t),u.splice(e,1))}}}else e.getUnidentifiedValueBufferSafe(l).push({predicate:a,object:o,reverse:s,isEmbedded:u})}isPropertyHandler(){return!0}isStackProcessor(){return!0}async validate(e,t,r,n,a){const o=r[n];if(o){const a=await e.getContext(r);if(!e.jsonLiteralStack[n]&&await t.predicateToTerm(a,r[n]))return"@json"===i.Util.getContextValueType(a,o)&&(e.jsonLiteralStack[n+1]=!0),!0}return!1}async test(e,t,r,n,i){return n[i]}async handle(e,t,r,o,s,u,c){const l=o[u],d=await e.getContext(o),h=await t.predicateToTerm(d,r);if(h){const c=await t.valueToTerm(d,r,s,u,o);if(c.length)for(let p of c){let c=await t.unaliasKeywordParent(o,u);const f=i.Util.isPropertyReverse(d,l,c);let y=0;for(;"@reverse"===c||"number"==typeof c;)"number"==typeof c?y++:u--,c=await t.unaliasKeywordParent(o,u-y);const g=i.Util.isPropertyInEmbeddedNode(c);t.validateReverseInEmbeddedNode(r,f,g);const m=i.Util.isPropertyInAnnotationObject(c);if(s){const a="@list"in i.Util.getContextValueContainer(d,r);if(a||s["@list"]){if((a&&!Array.isArray(s)&&!s["@list"]||s["@list"]&&!Array.isArray(s["@list"]))&&p!==t.rdfNil){const r=t.dataFactory.blankNode();e.emitQuad(u,t.dataFactory.quad(r,t.rdfRest,t.rdfNil,t.getDefaultGraph())),e.emitQuad(u,t.dataFactory.quad(r,t.rdfFirst,p,t.getDefaultGraph())),p=r}if(f&&!e.allowSubjectList)throw new n.ErrorCoded(`Found illegal list value in subject position at ${r}`,n.ERROR_CODES.INVALID_REVERSE_PROPERTY_VALUE)}}await a.handlePredicateObject(e,t,o,u,h,p,f,g,m)}}}}t.EntryHandlerPredicate=a},1548:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerKeyword=void 0,t.EntryHandlerKeyword=class{constructor(e){this.keyword=e}isPropertyHandler(){return!1}isStackProcessor(){return!0}async validate(e,t,r,n,i){return!1}async test(e,t,r,n,i){return r===this.keyword}}},86105:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerKeywordAnnotation=void 0;const n=r(1548),i=r(42395);class a extends n.EntryHandlerKeyword{constructor(){super("@annotation")}async handle(e,t,r,n,a,o){("string"==typeof a||"object"==typeof a&&a["@value"])&&e.emitError(new i.ErrorCoded(`Found illegal annotation value: ${JSON.stringify(a)}`,i.ERROR_CODES.INVALID_ANNOTATION))}}t.EntryHandlerKeywordAnnotation=a},23809:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerKeywordContext=void 0;const n=r(42395),i=r(1548);class a extends i.EntryHandlerKeyword{constructor(){super("@context")}isStackProcessor(){return!1}async handle(e,t,r,i,a,o){e.streamingProfile&&(e.processingStack[o]||e.processingType[o]||void 0!==e.idStack[o])&&e.emitError(new n.ErrorCoded("Found an out-of-order context, while streaming is enabled.(disable `streamingProfile`)",n.ERROR_CODES.INVALID_STREAMING_KEY_ORDER));const s=e.getContext(i),u=e.parseContext(a,(await s).getContextRaw());e.contextTree.setContext(i.slice(0,-1),u),e.emitContext(a),await e.validateContext(await u)}}t.EntryHandlerKeywordContext=a},55998:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerKeywordGraph=void 0;const n=r(1548);class i extends n.EntryHandlerKeyword{constructor(){super("@graph")}async handle(e,t,r,n,i,a){e.graphStack[a+1]=!0}}t.EntryHandlerKeywordGraph=i},15517:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerKeywordId=void 0;const n=r(42395),i=r(1548);class a extends i.EntryHandlerKeyword{constructor(){super("@id")}isStackProcessor(){return!1}async handle(e,t,r,i,a,o){if("string"!=typeof a){if(e.rdfstar&&"object"==typeof a){const t=Object.keys(a);1===t.length&&"@id"===t[0]&&e.emitError(new n.ErrorCoded(`Invalid embedded node without property with @id ${a["@id"]}`,n.ERROR_CODES.INVALID_EMBEDDED_NODE))}else e.emitError(new n.ErrorCoded(`Found illegal @id '${a}'`,n.ERROR_CODES.INVALID_ID_VALUE));return}const s=await t.getPropertiesDepth(i,o);if(void 0!==e.idStack[s]&&(e.idStack[s][0].listHead?e.emitError(new n.ErrorCoded(`Found illegal neighbouring entries next to @list for key: '${i[o-1]}'`,n.ERROR_CODES.INVALID_SET_OR_LIST_OBJECT)):e.emitError(new n.ErrorCoded(`Found duplicate @ids '${e.idStack[s][0].value}' and '${a}'`,n.ERROR_CODES.COLLIDING_KEYWORDS))),e.rdfstar&&e.annotationsBuffer[o])for(const t of e.annotationsBuffer[o])t.depth===o&&e.emitError(new n.ErrorCoded(`Found an illegal @id inside an annotation: ${a}`,n.ERROR_CODES.INVALID_ANNOTATION));e.idStack[s]=t.nullableTermToArray(await t.resourceToTerm(await e.getContext(i),a))}}t.EntryHandlerKeywordId=a},70736:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerKeywordIncluded=void 0;const n=r(42395),i=r(1548);class a extends i.EntryHandlerKeyword{constructor(){super("@included")}async handle(e,t,r,i,a,o){"object"!=typeof a&&e.emitError(new n.ErrorCoded(`Found illegal @included '${a}'`,n.ERROR_CODES.INVALID_INCLUDED_VALUE));const s=await t.unaliasKeywords(a,i,o,await e.getContext(i));"@value"in s&&e.emitError(new n.ErrorCoded(`Found an illegal @included @value node '${JSON.stringify(a)}'`,n.ERROR_CODES.INVALID_INCLUDED_VALUE)),"@list"in s&&e.emitError(new n.ErrorCoded(`Found an illegal @included @list node '${JSON.stringify(a)}'`,n.ERROR_CODES.INVALID_INCLUDED_VALUE)),e.emittedStack[o]=!1}}t.EntryHandlerKeywordIncluded=a},24910:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerKeywordNest=void 0;const n=r(42395),i=r(1548);class a extends i.EntryHandlerKeyword{constructor(){super("@nest")}async handle(e,t,r,i,a,o){"object"!=typeof a&&e.emitError(new n.ErrorCoded(`Found invalid @nest entry for '${r}': '${a}'`,n.ERROR_CODES.INVALID_NEST_VALUE)),"@value"in await t.unaliasKeywords(a,i,o,await e.getContext(i))&&e.emitError(new n.ErrorCoded(`Found an invalid @value node for '${r}'`,n.ERROR_CODES.INVALID_NEST_VALUE)),e.emittedStack[o]=!1}}t.EntryHandlerKeywordNest=a},62036:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerKeywordType=void 0;const n=r(42395),i=r(10888),a=r(76970),o=r(1548);class s extends o.EntryHandlerKeyword{constructor(){super("@type")}isStackProcessor(){return!1}async handle(e,t,r,o,s,u){const c=o[u],l=await e.getContext(o),d=t.rdfType,h=await t.unaliasKeywordParent(o,u),p=i.Util.isPropertyReverse(l,c,h),f=i.Util.isPropertyInEmbeddedNode(h);t.validateReverseInEmbeddedNode(r,p,f);const y=i.Util.isPropertyInAnnotationObject(h),g=Array.isArray(s)?s:[s];for(const r of g){"string"!=typeof r&&e.emitError(new n.ErrorCoded(`Found illegal @type '${r}'`,n.ERROR_CODES.INVALID_TYPE_VALUE));const i=t.createVocabOrBaseTerm(l,r);i&&await a.EntryHandlerPredicate.handlePredicateObject(e,t,o,u,d,i,p,f,y)}let m=Promise.resolve(l),b=!1;for(const t of g.sort()){const r=i.Util.getContextValue(l,"@context",t,null);r&&(b=!0,m=m.then((t=>e.parseContext(r,t.getContextRaw()))))}!e.streamingProfile||!b&&e.streamingProfileAllowOutOfOrderPlainType||!e.processingStack[u]&&!e.idStack[u]||e.emitError(new n.ErrorCoded("Found an out-of-order type-scoped context, while streaming is enabled.(disable `streamingProfile`)",n.ERROR_CODES.INVALID_STREAMING_KEY_ORDER)),b&&(m=m.then((e=>!0!==e.getContextRaw()["@propagate"]?new n.JsonLdContextNormalized(Object.assign(Object.assign({},e.getContextRaw()),{"@propagate":!1,"@__propagateFallback":l.getContextRaw()})):e)),e.contextTree.setContext(o.slice(0,o.length-1),m)),e.processingType[u]=!0}}t.EntryHandlerKeywordType=s},86454:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerKeywordUnknownFallback=void 0;const n=r(42395);class i{isPropertyHandler(){return!1}isStackProcessor(){return!0}async validate(e,t,r,i,a){const o=await t.unaliasKeyword(r[i],r,i);return!(!n.Util.isPotentialKeyword(o)||!a&&"@list"===o)}async test(e,t,r,i,a){return n.Util.isPotentialKeyword(r)}async handle(e,t,r,a,o,s){const u=i.VALID_KEYWORDS_TYPES[r];void 0!==u?u&&typeof o!==u.type&&e.emitError(new n.ErrorCoded(`Invalid value type for '${r}' with value '${o}'`,u.errorCode)):e.strictValues&&e.emitError(new Error(`Unknown keyword '${r}' with value '${o}'`)),e.emittedStack[s]=!1}}i.VALID_KEYWORDS_TYPES={"@index":{type:"string",errorCode:n.ERROR_CODES.INVALID_INDEX_VALUE},"@list":null,"@reverse":{type:"object",errorCode:n.ERROR_CODES.INVALID_REVERSE_VALUE},"@set":null,"@value":null},t.EntryHandlerKeywordUnknownFallback=i},33283:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerKeywordValue=void 0;const n=r(1548);class i extends n.EntryHandlerKeyword{constructor(){super("@value")}async validate(e,t,r,n,i){const a=r[n];return a&&!e.literalStack[n]&&await this.test(e,t,a,r,n)&&(e.literalStack[n]=!0),super.validate(e,t,r,n,i)}async test(e,t,r,n,i){return"@value"===await t.unaliasKeyword(n[i],n.slice(0,n.length-1),i-1,!0)}async handle(e,t,r,n,i,a){e.literalStack[a]=!0,delete e.unidentifiedValuesBuffer[a],delete e.unidentifiedGraphsBuffer[a],e.emittedStack[a]=!1}}t.EntryHandlerKeywordValue=i},29344:e=>{"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,r,n)=>t+(0===n?"":",")+e(void 0===r||"symbol"==typeof r?null:r)),"")+"]":"{"+Object.keys(t).sort().reduce(((r,n,i)=>void 0===t[n]||"symbol"==typeof t[n]?r:r+(0===r.length?"":",")+e(n)+":"+e(t[n])),"")+"}"}},43549:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(77843),t),i(r(23317),t)},77843:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JsonLdSerializer=void 0;const n=r(42395),i=r(89250),a=r(23317),o=r(19198);class s extends o.Transform{constructor(e={}){super({objectMode:!0}),this.indentation=0,this.options=e,this.options.baseIRI&&!this.options.context&&(this.options.context={"@base":this.options.baseIRI}),this.options.context?(this.originalContext=this.options.context,this.context=(new n.ContextParser).parse(this.options.context,{baseIRI:this.options.baseIRI})):this.context=Promise.resolve(new n.JsonLdContextNormalized({}))}import(e){const t=new o.PassThrough({objectMode:!0});e.on("error",(e=>r.emit("error",e))),e.on("data",(e=>t.push(e))),e.on("end",(()=>t.push(null)));const r=t.pipe(new s(this.options));return r}_transform(e,t,r){this.context.then((t=>{this.transformQuad(e,t),r()})).catch(r)}async list(e){const t=await this.context;return{"@list":e.map((e=>a.Util.termToValue(e,t,this.options)))}}_flush(e){return this.opened||this.pushDocumentStart(),this.lastPredicate&&this.endPredicate(),this.lastSubject&&this.endSubject(),this.lastGraph&&"DefaultGraph"!==this.lastGraph.termType&&this.endGraph(),this.endDocument(),e(null,null)}transformQuad(e,t){this.opened||this.pushDocumentStart();const r=this.lastGraph&&"DefaultGraph"!==this.lastGraph.termType&&this.lastGraph.equals(e.subject);if(!(r||this.lastGraph&&e.graph.equals(this.lastGraph))){let r="DefaultGraph"!==e.graph.termType&&this.lastSubject&&this.lastSubject.equals(e.graph);this.lastGraph&&("DefaultGraph"!==this.lastGraph.termType?(this.endPredicate(),this.endSubject(),this.endGraph(!0),r=!1):r?(this.endPredicate(!0),this.lastSubject=null):(this.endPredicate(),this.endSubject(!0))),"DefaultGraph"!==e.graph.termType&&(r||this.pushId(e.graph,!0,t),this.pushSeparator(this.options.space?i.SeparatorType.GRAPH_FIELD_NONCOMPACT:i.SeparatorType.GRAPH_FIELD_COMPACT),this.indentation++),this.lastGraph=e.graph}this.lastSubject&&e.subject.equals(this.lastSubject)||(r?(this.endPredicate(),this.endSubject(),this.indentation--,this.pushSeparator(i.SeparatorType.ARRAY_END_COMMA),this.lastGraph=e.graph):(this.lastSubject&&(this.endPredicate(),this.endSubject(!0)),this.pushId(e.subject,!0,t)),this.lastSubject=e.subject),this.lastPredicate&&e.predicate.equals(this.lastPredicate)||(this.lastPredicate&&this.endPredicate(!0),this.pushPredicate(e.predicate,t)),this.pushObject(e.object,t)}pushDocumentStart(){this.opened=!0,this.originalContext&&!this.options.excludeContext?(this.pushSeparator(i.SeparatorType.OBJECT_START),this.indentation++,this.pushSeparator(i.SeparatorType.CONTEXT_FIELD),this.pushIndented(JSON.stringify(this.originalContext,null,this.options.space)+","),this.pushSeparator(this.options.space?i.SeparatorType.GRAPH_FIELD_NONCOMPACT:i.SeparatorType.GRAPH_FIELD_COMPACT),this.indentation++):(this.pushSeparator(i.SeparatorType.ARRAY_START),this.indentation++)}pushId(e,t,r){if("Quad"===e.termType)this.pushNestedQuad(e,!0,r);else{const n="BlankNode"===e.termType?"_:"+e.value:r.compactIri(e.value,!1);t?this.pushSeparator(i.SeparatorType.OBJECT_START):(this.push(i.SeparatorType.OBJECT_START.label),this.options.space&&this.push("\n")),this.indentation++,this.pushIndented(this.options.space?`"@id": "${n}",`:`"@id":"${n}",`)}}pushPredicate(e,t){let r=e.value;this.options.useRdfType||r!==a.Util.RDF_TYPE||(r="@type",this.objectOptions=Object.assign(Object.assign({},this.options),{compactIds:!0,vocab:!0}));const n=t.compactIri(r,!0);this.pushIndented(this.options.space?`"${n}": [`:`"${n}":[`),this.indentation++,this.lastPredicate=e}pushObject(e,t){if(this.hadObjectForPredicate?this.pushSeparator(i.SeparatorType.COMMA):this.hadObjectForPredicate=!0,"Quad"===e.termType){const r=this.lastSubject,n=this.lastPredicate;return this.hadObjectForPredicate=!1,this.pushNestedQuad(e,!1,t),this.endSubject(!1),this.hadObjectForPredicate=!0,this.lastPredicate=n,void(this.lastSubject=r)}let r;try{r=e["@list"]?e:a.Util.termToValue(e,t,this.objectOptions||this.options)}catch(e){return this.emit("error",e)}this.pushIndented(JSON.stringify(r,null,this.options.space))}pushNestedQuad(e,t,r){this.pushSeparator(i.SeparatorType.OBJECT_START),this.indentation++,this.pushIndented(this.options.space?'"@id": ':'"@id":',!1),"DefaultGraph"!==e.graph.termType&&this.emit("error",new Error(`Found a nested quad with the non-default graph: ${e.graph.value}`)),this.pushId(e.subject,!1,r),this.pushPredicate(e.predicate,r),this.pushObject(e.object,r),this.endPredicate(!1),this.endSubject(t)}endDocument(){this.opened=!1,this.originalContext&&!this.options.excludeContext?(this.indentation--,this.pushSeparator(i.SeparatorType.ARRAY_END),this.indentation--,this.pushSeparator(i.SeparatorType.OBJECT_END)):(this.indentation--,this.pushSeparator(i.SeparatorType.ARRAY_END))}endPredicate(e){this.indentation--,this.pushSeparator(e?i.SeparatorType.ARRAY_END_COMMA:i.SeparatorType.ARRAY_END),this.hadObjectForPredicate=!1,this.objectOptions=null,this.lastPredicate=null}endSubject(e){this.indentation--,this.pushSeparator(e?i.SeparatorType.OBJECT_END_COMMA:i.SeparatorType.OBJECT_END),this.lastSubject=null}endGraph(e){this.indentation--,this.pushSeparator(i.SeparatorType.ARRAY_END),this.indentation--,this.pushSeparator(e?i.SeparatorType.OBJECT_END_COMMA:i.SeparatorType.OBJECT_END),this.lastGraph=null}pushSeparator(e){this.pushIndented(e.label)}pushIndented(e,t=!0){const r=this.getIndentPrefix(),n=e.split("\n").map((e=>r+e)).join("\n");this.push(n),this.options.space&&t&&this.push("\n")}getIndentPrefix(){return this.options.space?this.options.space.repeat(this.indentation):""}}t.JsonLdSerializer=s},89250:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SeparatorType=void 0;class r{constructor(e){this.label=e}}t.SeparatorType=r,r.COMMA=new r(","),r.OBJECT_START=new r("{"),r.OBJECT_END=new r("}"),r.OBJECT_END_COMMA=new r("},"),r.ARRAY_START=new r("["),r.ARRAY_END=new r("]"),r.ARRAY_END_COMMA=new r("],"),r.GRAPH_FIELD_NONCOMPACT=new r('"@graph": ['),r.GRAPH_FIELD_COMPACT=new r('"@graph":['),r.CONTEXT_FIELD=new r('"@context":')},23317:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Util=void 0;const n=r(42395);class i{static termToValue(e,t,r={compactIds:!1,useNativeTypes:!1}){switch(e.termType){case"NamedNode":const a=t.compactIri(e.value,r.vocab);return r.compactIds?a:{"@id":a};case"DefaultGraph":return r.compactIds?e.value:{"@id":e.value};case"BlankNode":const o=`_:${e.value}`;return r.compactIds?o:{"@id":o};case"Literal":if(e.datatype.value===i.RDF_JSON){let t;try{t=JSON.parse(e.value)}catch(e){throw new n.ErrorCoded("Invalid JSON literal: "+e.message,n.ERROR_CODES.INVALID_JSON_LITERAL)}return{"@value":t,"@type":"@json"}}if("i18n-datatype"===r.rdfDirection&&e.datatype.value.startsWith(i.I18N)){const[t,r]=e.datatype.value.substr(i.I18N.length,e.datatype.value.length).split("_");return Object.assign(Object.assign({"@value":e.value},t?{"@language":t}:{}),r?{"@direction":r}:{})}const s=e.datatype.value===i.XSD_STRING,u={"@value":!s&&r.useNativeTypes?i.stringToNativeType(e.value,e.datatype.value):e.value};return e.language?Object.assign(Object.assign({},u),{"@language":e.language}):s||"string"!=typeof u["@value"]?u:Object.assign(Object.assign({},u),{"@type":e.datatype.value})}}static stringToNativeType(e,t){if(t.startsWith(i.XSD))switch(t.substr(i.XSD.length)){case"boolean":if("true"===e)return!0;if("false"===e)return!1;throw new Error(`Invalid xsd:boolean value '${e}'`);case"integer":case"number":case"int":case"byte":case"long":const t=parseInt(e,10);if(isNaN(t))throw new Error(`Invalid xsd:integer value '${e}'`);return t;case"float":case"double":const r=parseFloat(e);if(isNaN(r))throw new Error(`Invalid xsd:float value '${e}'`);return r}return e}}t.Util=i,i.XSD="http://www.w3.org/2001/XMLSchema#",i.XSD_STRING=i.XSD+"string",i.RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#",i.RDF_TYPE=i.RDF+"type",i.RDF_JSON=i.RDF+"JSON",i.I18N="https://www.w3.org/ns/i18n#"},47034:(e,t,r)=>{"use strict";const{isArray:n,isObject:i,isString:a}=r(7382),{asArray:o}=r(59263),{prependBase:s}=r(30470),u=r(82207),c=r(37532);function l(e){throw new u("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:e})}function d({context:e,base:t}){if(!e)return;const r=e["@context"];if(a(r))e["@context"]=s(t,r);else if(n(r))for(let e=0;e10)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 r(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&&(n(s["@context"])||(s["@context"]=[s["@context"]]),s["@context"].push(c.contextUrl)),{context:s,remoteDoc:c}}}},82207:e=>{"use strict";e.exports=class extends Error{constructor(e="An unspecified JSON-LD error occurred.",t="jsonld.Error",r={}){super(e),this.name=t,this.message=e,this.details=r}}},45445:e=>{"use strict";e.exports=e=>{class t{toString(){return"[object JsonLdProcessor]"}}return Object.defineProperty(t,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(t.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:t}),t.compact=function(t,r){return arguments.length<2?Promise.reject(new TypeError("Could not compact, too few arguments.")):e.compact(t,r)},t.expand=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not expand, too few arguments.")):e.expand(t)},t.flatten=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not flatten, too few arguments.")):e.flatten(t)},t}},68229:(e,t,r)=>{"use strict";e.exports=r(60989).NQuads},73743:e=>{"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]}}}},37532:(e,t,r)=>{"use strict";const n=r(1235);e.exports=class{constructor({document:e}){this.document=e,this.cache=new n({max:10})}getProcessed(e){return this.cache.get(e)}setProcessed(e,t){this.cache.set(e,t)}}},21058:(e,t,r)=>{"use strict";const n=r(82207),{isArray:i,isObject:a,isString:o,isUndefined:s}=r(7382),{isList:u,isValue:c,isGraph:l,isSimpleGraph:d,isSubjectReference:h}=r(3978),{expandIri:p,getContextValue:f,isKeyword:y,process:g,processingMode:m}=r(51972),{removeBase:b,prependBase:v}=r(30470),{REGEX_KEYWORD:_,addValue:w,asArray:T,compareShortestLeast:S}=r(59263),O={};function E(e,t,r){if("@nest"!==p(e,t,{vocab:!0},r))throw new n("JSON-LD compact error; nested property must have an @nest value resolving to @nest.","jsonld.SyntaxError",{code:"invalid @nest value"})}e.exports=O,O.compact=async({activeCtx:e,activeProperty:t=null,element:r,options:p={}})=>{if(i(r)){let n=[];for(let i=0;i1&&(x=Array.from(x).sort());const A=e;for(const t of x){const r=O.compactIri({activeCtx:A,iri:t,relativeTo:{vocab:!0}}),n=f(_,r,"@context");s(n)||(e=await g({activeCtx:e,localCtx:n,options:p,propagate:!1}))}const R=Object.keys(r).sort();for(const s of R){const h=r[s];if("@id"!==s)if("@type"!==s)if("@reverse"!==s)if("@preserve"!==s)if("@index"!==s)if("@graph"!==s&&"@list"!==s&&"@included"!==s&&y(s)){const t=O.compactIri({activeCtx:e,iri:s,relativeTo:{vocab:!0}});w(v,t,h)}else{if(!i(h))throw new n("JSON-LD expansion error; expanded value must be an array.","jsonld.SyntaxError");if(0===h.length){const t=O.compactIri({activeCtx:e,iri:s,value:h,relativeTo:{vocab:!0},reverse:b}),r=e.mappings.has(t)?e.mappings.get(t)["@nest"]:null;let n=v;r&&(E(e,r,p),a(v[r])||(v[r]={}),n=v[r]),w(n,t,h,{propertyIsArray:!0})}for(const t of h){const r=O.compactIri({activeCtx:e,iri:s,value:t,relativeTo:{vocab:!0},reverse:b}),n=e.mappings.has(r)?e.mappings.get(r)["@nest"]:null;let h=v;n&&(E(e,n,p),a(v[n])||(v[n]={}),h=v[n]);const y=f(e,r,"@container")||[],g=l(t),m=u(t);let _;m?_=t["@list"]:g&&(_=t["@graph"]);let S=await O.compact({activeCtx:e,activeProperty:r,element:m||g?_:t,options:p});if(m){if(i(S)||(S=[S]),y.includes("@list")){w(h,r,S,{valueIsArray:!0,allowDuplicate:!0});continue}S={[O.compactIri({activeCtx:e,iri:"@list",relativeTo:{vocab:!0}})]:S},"@index"in t&&(S[O.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=t["@index"])}if(g)if(y.includes("@graph")&&(y.includes("@id")||y.includes("@index")&&d(t))){let n;h.hasOwnProperty(r)?n=h[r]:h[r]=n={};const i=(y.includes("@id")?t["@id"]:t["@index"])||O.compactIri({activeCtx:e,iri:"@none",relativeTo:{vocab:!0}});w(n,i,S,{propertyIsArray:!p.compactArrays||y.includes("@set")})}else y.includes("@graph")&&d(t)?(i(S)&&S.length>1&&(S={"@included":S}),w(h,r,S,{propertyIsArray:!p.compactArrays||y.includes("@set")})):(i(S)&&1===S.length&&p.compactArrays&&(S=S[0]),S={[O.compactIri({activeCtx:e,iri:"@graph",relativeTo:{vocab:!0}})]:S},"@id"in t&&(S[O.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}})]=t["@id"]),"@index"in t&&(S[O.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=t["@index"]),w(h,r,S,{propertyIsArray:!p.compactArrays||y.includes("@set")}));else if(y.includes("@language")||y.includes("@index")||y.includes("@id")||y.includes("@type")){let n,i;if(h.hasOwnProperty(r)?n=h[r]:h[r]=n={},y.includes("@language"))c(S)&&(S=S["@value"]),i=t["@language"];else if(y.includes("@index")){const n=f(e,r,"@index")||"@index",a=O.compactIri({activeCtx:e,iri:n,relativeTo:{vocab:!0}});if("@index"===n)i=t["@index"],delete S[a];else{let e;if([i,...e]=T(S[n]||[]),o(i))switch(e.length){case 0:delete S[n];break;case 1:S[n]=e[0];break;default:S[n]=e}else i=null}}else if(y.includes("@id")){const t=O.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}});i=S[t],delete S[t]}else if(y.includes("@type")){const n=O.compactIri({activeCtx:e,iri:"@type",relativeTo:{vocab:!0}});let a;switch([i,...a]=T(S[n]||[]),a.length){case 0:delete S[n];break;case 1:S[n]=a[0];break;default:S[n]=a}1===Object.keys(S).length&&"@id"in t&&(S=await O.compact({activeCtx:e,activeProperty:r,element:{"@id":t["@id"]},options:p}))}i||(i=O.compactIri({activeCtx:e,iri:"@none",relativeTo:{vocab:!0}})),w(n,i,S,{propertyIsArray:y.includes("@set")})}else{const e=!p.compactArrays||y.includes("@set")||y.includes("@list")||i(S)&&0===S.length||"@list"===s||"@graph"===s;w(h,r,S,{propertyIsArray:e})}}}else{if((f(e,t,"@container")||[]).includes("@index"))continue;const r=O.compactIri({activeCtx:e,iri:s,relativeTo:{vocab:!0}});w(v,r,h)}else{const r=await O.compact({activeCtx:e,activeProperty:t,element:h,options:p});i(r)&&0===r.length||w(v,s,r)}else{const t=await O.compact({activeCtx:e,activeProperty:"@reverse",element:h,options:p});for(const r in t)if(e.mappings.has(r)&&e.mappings.get(r).reverse){const n=t[r],i=(f(e,r,"@container")||[]).includes("@set")||!p.compactArrays;w(v,r,n,{propertyIsArray:i}),delete t[r]}if(Object.keys(t).length>0){const r=O.compactIri({activeCtx:e,iri:s,relativeTo:{vocab:!0}});w(v,r,t)}}else{let t=T(h).map((e=>O.compactIri({activeCtx:_,iri:e,relativeTo:{vocab:!0}})));1===t.length&&(t=t[0]);const r=O.compactIri({activeCtx:e,iri:"@type",relativeTo:{vocab:!0}}),n=(f(e,r,"@container")||[]).includes("@set")&&m(e,1.1)||i(t)&&0===h.length;w(v,r,t,{propertyIsArray:n})}else{let t=T(h).map((t=>O.compactIri({activeCtx:e,iri:t,relativeTo:{vocab:!1},base:p.base})));1===t.length&&(t=t[0]),v[O.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}})]=t}}return v}return r},O.compactIri=({activeCtx:e,iri:t,value:r=null,relativeTo:i={vocab:!1},reverse:o=!1,base:s=null})=>{if(null===t)return t;e.isPropertyTermScoped&&e.previousContext&&(e=e.previousContext);const d=e.getInverse();if(y(t)&&t in d&&"@none"in d[t]&&"@type"in d[t]["@none"]&&"@none"in d[t]["@none"]["@type"])return d[t]["@none"]["@type"]["@none"];if(i.vocab&&t in d){const n=e["@language"]||"@none",i=[];a(r)&&"@index"in r&&!("@graph"in r)&&i.push("@index","@index@set"),a(r)&&"@preserve"in r&&(r=r["@preserve"][0]),l(r)?("@index"in r&&i.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in r&&i.push("@graph@id","@graph@id@set"),i.push("@graph","@graph@set","@set"),"@index"in r||i.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in r||i.push("@graph@id","@graph@id@set")):a(r)&&!c(r)&&i.push("@id","@id@set","@type","@set@type");let s="@language",d="@null";if(o)s="@type",d="@reverse",i.push("@set");else if(u(r)){"@index"in r||i.push("@list");const e=r["@list"];if(0===e.length)s="@any",d="@none";else{let t=0===e.length?n:null,r=null;for(let n=0;ne.includes("_")));e&&s.push(e.replace(/^[^_]+_/,"_"))}s.push("@none");const u=e.inverse[t];for(const e of n){if(!(e in u))continue;const t=u[e][i];for(const e of s)if(e in t)return t[e]}return null}(e,t,r,i,s,d);if(null!==h)return h}if(i.vocab&&"@vocab"in e){const r=e["@vocab"];if(0===t.indexOf(r)&&t!==r){const n=t.substr(r.length);if(!e.mappings.has(n))return n}}let h=null;const p=[];let f=e.fastCurieMap;const g=t.length-1;for(let e=0;e=0;--n){const i=p[n],a=i.terms;for(const n of a){const a=n+":"+t.substr(i.iri.length);e.mappings.get(n)._prefix&&(!e.mappings.has(a)||null===r&&e.mappings.get(a)["@id"]===t)&&(null===h||S(a,h)<0)&&(h=a)}}if(null!==h)return h;for(const[r,i]of e.mappings)if(i&&i._prefix&&t.startsWith(r+":"))throw new n(`Absolute IRI "${t}" confused with prefix "${r}".`,"jsonld.SyntaxError",{code:"IRI confused with prefix",context:e});if(!i.vocab){if("@base"in e){if(e["@base"]){const r=b(v(s,e["@base"]),t);return _.test(r)?`./${r}`:r}return t}return b(s,t)}return t},O.compactValue=({activeCtx:e,activeProperty:t,value:r,options:n})=>{if(c(r)){const n=f(e,t,"@type"),i=f(e,t,"@language"),a=f(e,t,"@direction"),s=f(e,t,"@container")||[],u="@index"in r&&!s.includes("@index");if(!u&&"@none"!==n){if(r["@type"]===n)return r["@value"];if("@language"in r&&r["@language"]===i&&"@direction"in r&&r["@direction"]===a)return r["@value"];if("@language"in r&&r["@language"]===i)return r["@value"];if("@direction"in r&&r["@direction"]===a)return r["@value"]}const c=Object.keys(r).length,l=1===c||2===c&&"@index"in r&&!u,d="@language"in e,h=o(r["@value"]),p=e.mappings.has(t)&&null===e.mappings.get(t)["@language"];if(l&&"@none"!==n&&(!d||!h||p))return r["@value"];const y={};return u&&(y[O.compactIri({activeCtx:e,iri:"@index",relativeTo:{vocab:!0}})]=r["@index"]),"@type"in r?y[O.compactIri({activeCtx:e,iri:"@type",relativeTo:{vocab:!0}})]=O.compactIri({activeCtx:e,iri:r["@type"],relativeTo:{vocab:!0}}):"@language"in r&&(y[O.compactIri({activeCtx:e,iri:"@language",relativeTo:{vocab:!0}})]=r["@language"]),"@direction"in r&&(y[O.compactIri({activeCtx:e,iri:"@direction",relativeTo:{vocab:!0}})]=r["@direction"]),y[O.compactIri({activeCtx:e,iri:"@value",relativeTo:{vocab:!0}})]=r["@value"],y}const i=p(e,t,{vocab:!0},n),a=f(e,t,"@type"),s=O.compactIri({activeCtx:e,iri:r["@id"],relativeTo:{vocab:"@vocab"===a},base:n.base});return"@id"===a||"@vocab"===a||"@graph"===i?s:{[O.compactIri({activeCtx:e,iri:"@id",relativeTo:{vocab:!0}})]:s}}},49378:e=>{"use strict";const t="http://www.w3.org/1999/02/22-rdf-syntax-ns#",r="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:t,RDF_LIST:t+"List",RDF_FIRST:t+"first",RDF_REST:t+"rest",RDF_NIL:t+"nil",RDF_TYPE:t+"type",RDF_PLAIN_LITERAL:t+"PlainLiteral",RDF_XML_LITERAL:t+"XMLLiteral",RDF_JSON_LITERAL:t+"JSON",RDF_OBJECT:t+"object",RDF_LANGSTRING:t+"langString",XSD:r,XSD_BOOLEAN:r+"boolean",XSD_DOUBLE:r+"double",XSD_INTEGER:r+"integer",XSD_STRING:r+"string"}},51972:(e,t,r)=>{"use strict";const n=r(59263),i=r(82207),{isArray:a,isObject:o,isString:s,isUndefined:u}=r(7382),{isAbsolute:c,isRelative:l,prependBase:d}=r(30470),{handleEvent:h}=r(92246),{REGEX_BCP47:p,REGEX_KEYWORD:f,asArray:y,compareShortestLeast:g}=r(59263),m=new Map,b={};function v(e,t,r,n,i,a){if(null===t||!s(t)||b.isKeyword(t))return t;if(t.match(f))return null;if(n&&n.hasOwnProperty(t)&&!0!==i.get(t)&&b.createTermDefinition({activeCtx:e,localCtx:n,term:t,defined:i,options:a}),(r=r||{}).vocab){const r=e.mappings.get(t);if(null===r)return null;if(o(r)&&"@id"in r)return r["@id"]}const u=t.indexOf(":");if(u>0){const r=t.substr(0,u),o=t.substr(u+1);if("_"===r||0===o.indexOf("//"))return t;n&&n.hasOwnProperty(r)&&b.createTermDefinition({activeCtx:e,localCtx:n,term:r,defined:i,options:a});const s=e.mappings.get(r);if(s&&s._prefix)return s["@id"]+o;if(c(t))return t}if(r.vocab&&"@vocab"in e)t=e["@vocab"]+t;else if(r.base){let r,n;"@base"in e?e["@base"]?(n=d(a.base,e["@base"]),r=d(n,t)):(n=e["@base"],r=t):(n=a.base,r=d(a.base,t)),t=r}return t}function _(e,t){if(!e||"object"!=typeof e||!t||"object"!=typeof t)return e===t;const r=Array.isArray(e);if(r!==Array.isArray(t))return!1;if(r){if(e.length!==t.length)return!1;for(let r=0;r{if(o(t)&&"@context"in t&&a(t["@context"])&&(t=t["@context"]),0===y(t).length)return e;const g=[],m=[({event:e,next:t})=>{g.push(e),t()}];r.eventHandler&&m.push(r.eventHandler);const _=r;r={...r,eventHandler:m};const w=await r.contextResolver.resolve({activeCtx:e,context:t,documentLoader:r.documentLoader,base:r.base});o(w[0].document)&&"boolean"==typeof w[0].document["@propagate"]&&(n=w[0].document["@propagate"]);let T=e;n||T.previousContext||(T=T.clone(),T.previousContext=e);for(const n of w){let{document:a}=n;if(e=T,null===a){if(!u&&0!==Object.keys(e.protected).length)throw new i("Tried to nullify a context with protected terms outside of a term definition.","jsonld.SyntaxError",{code:"invalid context nullification"});T=e=b.getInitialContext(r).clone();continue}const y=n.getProcessed(e);if(y){if(_.eventHandler)for(const e of y.events)h({event:e,options:_});T=e=y.context;continue}if(o(a)&&"@context"in a&&(a=a["@context"]),!o(a))throw new i("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:a});T=T.clone();const m=new Map;if("@version"in a){if(1.1!==a["@version"])throw new i("Unsupported JSON-LD version: "+a["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:a});if(e.processingMode&&"json-ld-1.0"===e.processingMode)throw new i("@version: "+a["@version"]+" not compatible with "+e.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:a});T.processingMode="json-ld-1.1",T["@version"]=a["@version"],m.set("@version",!0)}if(T.processingMode=T.processingMode||e.processingMode,"@base"in a){let e=a["@base"];if(null===e||c(e));else{if(!l(e))throw new i('Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI, a relative IRI, or null.',"jsonld.SyntaxError",{code:"invalid base IRI",context:a});e=d(T["@base"],e)}T["@base"]=e,m.set("@base",!0)}if("@vocab"in a){const e=a["@vocab"];if(null===e)delete T["@vocab"];else{if(!s(e))throw new i('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:a});if(!c(e)&&b.processingMode(T,1))throw new i('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:a});{const t=v(T,e,{vocab:!0,base:!0},void 0,void 0,r);c(t)||r.eventHandler&&h({event:{type:["JsonLdEvent"],code:"relative @vocab reference",level:"warning",message:"Relative @vocab reference found.",details:{vocab:t}},options:r}),T["@vocab"]=t}}m.set("@vocab",!0)}if("@language"in a){const e=a["@language"];if(null===e)delete T["@language"];else{if(!s(e))throw new i('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:a});e.match(p)||r.eventHandler&&h({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:e}},options:r}),T["@language"]=e.toLowerCase()}m.set("@language",!0)}if("@direction"in a){const t=a["@direction"];if("json-ld-1.0"===e.processingMode)throw new i("Invalid JSON-LD syntax; @direction not compatible with "+e.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:a});if(null===t)delete T["@direction"];else{if("ltr"!==t&&"rtl"!==t)throw new i('Invalid JSON-LD syntax; the value of "@direction" in a @context must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:a});T["@direction"]=t}m.set("@direction",!0)}if("@propagate"in a){const r=a["@propagate"];if("json-ld-1.0"===e.processingMode)throw new i("Invalid JSON-LD syntax; @propagate not compatible with "+e.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:a});if("boolean"!=typeof r)throw new i("Invalid JSON-LD syntax; @propagate value must be a boolean.","jsonld.SyntaxError",{code:"invalid @propagate value",context:t});m.set("@propagate",!0)}if("@import"in a){const n=a["@import"];if("json-ld-1.0"===e.processingMode)throw new i("Invalid JSON-LD syntax; @import not compatible with "+e.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:a});if(!s(n))throw new i("Invalid JSON-LD syntax; @import must be a string.","jsonld.SyntaxError",{code:"invalid @import value",context:t});const o=await r.contextResolver.resolve({activeCtx:e,context:n,documentLoader:r.documentLoader,base:r.base});if(1!==o.length)throw new i("Invalid JSON-LD syntax; @import must reference a single context.","jsonld.SyntaxError",{code:"invalid remote context",context:t});const u=o[0].getProcessed(e);if(u)a=u;else{const r=o[0].document;if("@import"in r)throw new i("Invalid JSON-LD syntax: imported context must not include @import.","jsonld.SyntaxError",{code:"invalid context entry",context:t});for(const e in r)a.hasOwnProperty(e)||(a[e]=r[e]);o[0].setProcessed(e,a)}m.set("@import",!0)}m.set("@protected",a["@protected"]||!1);for(const e in a)if(b.createTermDefinition({activeCtx:T,localCtx:a,term:e,defined:m,options:r,overrideProtected:u}),o(a[e])&&"@context"in a[e]){const t=a[e]["@context"];let n=!0;if(s(t)){const e=d(r.base,t);f.has(e)?n=!1:f.add(e)}if(n)try{await b.process({activeCtx:T.clone(),localCtx:a[e]["@context"],overrideProtected:!0,options:r,cycles:f})}catch(t){throw new i("Invalid JSON-LD syntax; invalid scoped context.","jsonld.SyntaxError",{code:"invalid scoped context",context:a[e]["@context"],term:e})}}n.setProcessed(e,{context:T,events:g})}return T},b.createTermDefinition=({activeCtx:e,localCtx:t,term:r,defined:n,options:u,overrideProtected:l=!1})=>{if(n.has(r)){if(n.get(r))return;throw new i("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:t,term:r})}let d;if(n.set(r,!1),t.hasOwnProperty(r)&&(d=t[r]),"@type"===r&&o(d)&&"@set"===(d["@container"]||"@set")&&b.processingMode(e,1.1)){const e=["@container","@id","@protected"],n=Object.keys(d);if(0===n.length||n.some((t=>!e.includes(t))))throw new i("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:t,term:r})}else{if(b.isKeyword(r))throw new i("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:t,term:r});if(r.match(f))return void(u.eventHandler&&h({event:{type:["JsonLdEvent"],code:"reserved term",level:"warning",message:'Terms beginning with "@" are reserved for future use and dropped.',details:{term:r}},options:u}));if(""===r)throw new i("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:t})}const p=e.mappings.get(r);e.mappings.has(r)&&e.mappings.delete(r);let y=!1;if((s(d)||null===d)&&(y=!0,d={"@id":d}),!o(d))throw new i("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:t});const g={};e.mappings.set(r,g),g.reverse=!1;const m=["@container","@id","@language","@reverse","@type"];b.processingMode(e,1.1)&&m.push("@context","@direction","@index","@nest","@prefix","@protected");for(const e in d)if(!m.includes(e))throw new i("Invalid JSON-LD syntax; a term definition must not contain "+e,"jsonld.SyntaxError",{code:"invalid term definition",context:t});const w=r.indexOf(":");if(g._termHasColon=w>0,"@reverse"in d){if("@id"in d)throw new i("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});if("@nest"in d)throw new i("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});const a=d["@reverse"];if(!s(a))throw new i("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});if(a.match(f))return u.eventHandler&&h({event:{type:["JsonLdEvent"],code:"reserved @reverse value",level:"warning",message:'@reverse values beginning with "@" are reserved for future use and dropped.',details:{reverse:a}},options:u}),void(p?e.mappings.set(r,p):e.mappings.delete(r));const o=v(e,a,{vocab:!0,base:!1},t,n,u);if(!c(o))throw new i("Invalid JSON-LD syntax; a @context @reverse value must be an absolute IRI or a blank node identifier.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});g["@id"]=o,g.reverse=!0}else if("@id"in d){let a=d["@id"];if(a&&!s(a))throw new i("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});if(null===a)g["@id"]=null;else{if(!b.isKeyword(a)&&a.match(f))return u.eventHandler&&h({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:'@id values beginning with "@" are reserved for future use and dropped.',details:{id:a}},options:u}),void(p?e.mappings.set(r,p):e.mappings.delete(r));if(a!==r){if(a=v(e,a,{vocab:!0,base:!1},t,n,u),!c(a)&&!b.isKeyword(a))throw new i("Invalid JSON-LD syntax; a @context @id value must be an absolute IRI, a blank node identifier, or a keyword.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});if(r.match(/(?::[^:])|\//)&&v(e,r,{vocab:!0,base:!1},t,new Map(n).set(r,!0),u)!==a)throw new i("Invalid JSON-LD syntax; term in form of IRI must expand to definition.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t});g["@id"]=a,g._prefix=y&&!g._termHasColon&&null!==a.match(/[:\/\?#\[\]@]$/)}}}if(!("@id"in g))if(g._termHasColon){const i=r.substr(0,w);if(t.hasOwnProperty(i)&&b.createTermDefinition({activeCtx:e,localCtx:t,term:i,defined:n,options:u}),e.mappings.has(i)){const t=r.substr(w+1);g["@id"]=e.mappings.get(i)["@id"]+t}else g["@id"]=r}else if("@type"===r)g["@id"]=r;else{if(!("@vocab"in e))throw new i("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:t,term:r});g["@id"]=e["@vocab"]+r}if((!0===d["@protected"]||!0===n.get("@protected")&&!1!==d["@protected"])&&(e.protected[r]=!0,g.protected=!0),n.set(r,!0),"@type"in d){let r=d["@type"];if(!s(r))throw new i("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:t});if("@json"===r||"@none"===r){if(b.processingMode(e,1))throw new i(`Invalid JSON-LD syntax; an @context @type value must not be "${r}" in JSON-LD 1.0 mode.`,"jsonld.SyntaxError",{code:"invalid type mapping",context:t})}else if("@id"!==r&&"@vocab"!==r){if(r=v(e,r,{vocab:!0,base:!1},t,n,u),!c(r))throw new i("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:t});if(0===r.indexOf("_:"))throw new i("Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:t})}g["@type"]=r}if("@container"in d){const r=s(d["@container"])?[d["@container"]]:d["@container"]||[],n=["@list","@set","@index","@language"];let o=!0;const u=r.includes("@set");if(b.processingMode(e,1.1)){if(n.push("@graph","@id","@type"),r.includes("@list")){if(1!==r.length)throw new i("Invalid JSON-LD syntax; @context @container with @list must have no other values","jsonld.SyntaxError",{code:"invalid container mapping",context:t})}else if(r.includes("@graph")){if(r.some((e=>"@graph"!==e&&"@id"!==e&&"@index"!==e&&"@set"!==e)))throw new i("Invalid JSON-LD syntax; @context @container with @graph must have no other values other than @id, @index, and @set","jsonld.SyntaxError",{code:"invalid container mapping",context:t})}else o&=r.length<=(u?2:1);if(r.includes("@type")&&(g["@type"]=g["@type"]||"@id",!["@id","@vocab"].includes(g["@type"])))throw new i("Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.","jsonld.SyntaxError",{code:"invalid type mapping",context:t})}else o&=!a(d["@container"]),o&=r.length<=1;if(o&=r.every((e=>n.includes(e))),o&=!(u&&r.includes("@list")),!o)throw new i("Invalid JSON-LD syntax; @context @container value must be one of the following: "+n.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:t});if(g.reverse&&!r.every((e=>["@index","@set"].includes(e))))throw new i("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:t});g["@container"]=r}if("@index"in d){if(!("@container"in d)||!g["@container"].includes("@index"))throw new i(`Invalid JSON-LD syntax; @index without @index in @container: "${d["@index"]}" on term "${r}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:t});if(!s(d["@index"])||0===d["@index"].indexOf("@"))throw new i(`Invalid JSON-LD syntax; @index must expand to an IRI: "${d["@index"]}" on term "${r}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:t});g["@index"]=d["@index"]}if("@context"in d&&(g["@context"]=d["@context"]),"@language"in d&&!("@type"in d)){let e=d["@language"];if(null!==e&&!s(e))throw new i("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:t});null!==e&&(e=e.toLowerCase()),g["@language"]=e}if("@prefix"in d){if(r.match(/:|\//))throw new i("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:t});if(b.isKeyword(g["@id"]))throw new i("Invalid JSON-LD syntax; keywords may not be used as prefixes","jsonld.SyntaxError",{code:"invalid term definition",context:t});if("boolean"!=typeof d["@prefix"])throw new i("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:t});g._prefix=!0===d["@prefix"]}if("@direction"in d){const e=d["@direction"];if(null!==e&&"ltr"!==e&&"rtl"!==e)throw new i('Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:t});g["@direction"]=e}if("@nest"in d){const e=d["@nest"];if(!s(e)||"@nest"!==e&&0===e.indexOf("@"))throw new i("Invalid JSON-LD syntax; @context @nest value must be a string which is not a keyword other than @nest.","jsonld.SyntaxError",{code:"invalid @nest value",context:t});g["@nest"]=e}const T=g["@id"];if("@context"===T||"@preserve"===T)throw new i("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:t});if(p&&p.protected&&!l&&(e.protected[r]=!0,g.protected=!0,!_(p,g)))throw new i("Invalid JSON-LD syntax; tried to redefine a protected term.","jsonld.SyntaxError",{code:"protected term redefinition",context:t,term:r})},b.expandIri=(e,t,r,n)=>v(e,t,r,void 0,void 0,n),b.getInitialContext=e=>{const t=JSON.stringify({processingMode:e.processingMode}),r=m.get(t);if(r)return r;const i={processingMode:e.processingMode,mappings:new Map,inverse:null,getInverse:function(){const e=this;if(e.inverse)return e.inverse;const t=e.inverse={},r=e.fastCurieMap={},n={},i=(e["@language"]||"@none").toLowerCase(),s=e["@direction"],u=e.mappings,c=[...u.keys()].sort(g);for(const e of c){const a=u.get(e);if(null===a)continue;let c=a["@container"]||"@none";if(c=[].concat(c).sort().join(""),null===a["@id"])continue;const l=y(a["@id"]);for(const u of l){let l=t[u];const d=b.isKeyword(u);if(l)d||a._termHasColon||n[u].push(e);else if(t[u]=l={},!d&&!a._termHasColon){n[u]=[e];const t={iri:u,terms:n[u]};u[0]in r?r[u[0]].push(t):r[u[0]]=[t]}if(l[c]||(l[c]={"@language":{},"@type":{},"@any":{}}),l=l[c],o(e,l["@any"],"@none"),a.reverse)o(e,l["@type"],"@reverse");else if("@none"===a["@type"])o(e,l["@any"],"@none"),o(e,l["@language"],"@none"),o(e,l["@type"],"@none");else if("@type"in a)o(e,l["@type"],a["@type"]);else if("@language"in a&&"@direction"in a){const t=a["@language"],r=a["@direction"];o(e,l["@language"],t&&r?`${t}_${r}`.toLowerCase():t?t.toLowerCase():r?`_${r}`:"@null")}else"@language"in a?o(e,l["@language"],(a["@language"]||"@null").toLowerCase()):"@direction"in a?a["@direction"]?o(e,l["@language"],`_${a["@direction"]}`):o(e,l["@language"],"@none"):s?(o(e,l["@language"],`_${s}`),o(e,l["@language"],"@none"),o(e,l["@type"],"@none")):(o(e,l["@language"],i),o(e,l["@language"],"@none"),o(e,l["@type"],"@none"))}}for(const e in r)a(r,e,1);return t},clone:function(){const e={};return e.mappings=n.clone(this.mappings),e.clone=this.clone,e.inverse=null,e.getInverse=this.getInverse,e.protected=n.clone(this.protected),this.previousContext&&(e.previousContext=this.previousContext.clone()),e.revertToPreviousContext=this.revertToPreviousContext,"@base"in this&&(e["@base"]=this["@base"]),"@language"in this&&(e["@language"]=this["@language"]),"@vocab"in this&&(e["@vocab"]=this["@vocab"]),e},revertToPreviousContext:function(){return this.previousContext?this.previousContext.clone():this},protected:{}};return 1e4===m.size&&m.clear(),m.set(t,i),i;function a(e,t,r){const n=e[t],i=e[t]={};let o,s;for(const e of n)o=e.iri,s=r>=o.length?"":o[r],s in i?i[s].push(e):i[s]=[e];for(const e in i)""!==e&&a(i,e,r+1)}function o(e,t,r){t.hasOwnProperty(r)||(t[r]=e)}},b.getContextValue=(e,t,r)=>{if(null===t){if("@context"===r)return;return null}if(e.mappings.has(t)){const n=e.mappings.get(t);if(u(r))return n;if(n.hasOwnProperty(r))return n[r]}return"@language"===r&&r in e||"@direction"===r&&r in e?e[r]:"@context"!==r?null:void 0},b.processingMode=(e,t)=>t.toString()>="1.1"?!e.processingMode||e.processingMode>="json-ld-"+t.toString():"json-ld-1.0"===e.processingMode,b.isKeyword=e=>{if(!s(e)||"@"!==e[0])return!1;switch(e){case"@base":case"@container":case"@context":case"@default":case"@direction":case"@embed":case"@explicit":case"@graph":case"@id":case"@included":case"@index":case"@json":case"@language":case"@list":case"@nest":case"@none":case"@omitDefault":case"@prefix":case"@preserve":case"@protected":case"@requireAll":case"@reverse":case"@set":case"@type":case"@value":case"@version":case"@vocab":return!0}return!1}},86957:(e,t,r)=>{"use strict";const{parseLinkHeader:n,buildHeaders:i}=r(59263),{LINK_HEADER_CONTEXT:a}=r(49378),o=r(82207),s=r(73743),{prependBase:u}=r(30470),c=/(^|(\r\n))link:/i;e.exports=({secure:e,headers:t={},xhr:r}={headers:{}})=>(t=i(t),(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,r){const n=new(e=e||XMLHttpRequest);return new Promise(((e,i)=>{n.onload=()=>e(n),n.onerror=e=>i(e),n.open("GET",t,!0);for(const e in r)n.setRequestHeader(e,r[e]);n.send()}))}(r,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 d={contextUrl:null,documentUrl:s,document:l.response},h=null;const p=l.getResponseHeader("Content-Type");let f;if(c.test(l.getAllResponseHeaders())&&(f=l.getResponseHeader("Link")),f&&"application/ld+json"!==p){const e=n(f),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&&(d.contextUrl=t.target),h=e.alternate,h&&"application/ld+json"==h.type&&!(p||"").match(/^application\/(\w*\+)?json$/)&&(d=await i(u(s,h.target)))}return d})))},92246:(e,t,r)=>{"use strict";const n=r(82207),{isArray:i}=r(7382),{asArray:a}=r(59263),o={};function s({event:e,handlers:t}){let r=!0;for(let a=0;r&&a{r=!0}});else{if("object"!=typeof o)throw new n("Invalid event handler.","jsonld.InvalidEventHandler",{event:e});e.code in o?o[e.code]({event:e,next:()=>{r=!0}}):r=!0}}return r}e.exports=o,o.defaultEventHandler=null,o.setupEventHandler=({options:e={}})=>{const t=[].concat(e.safe?o.safeEventHandler:[],e.eventHandler?a(e.eventHandler):[],o.defaultEventHandler?o.defaultEventHandler:[]);return 0===t.length?null:t},o.handleEvent=({event:e,options:t})=>{s({event:e,handlers:t.eventHandler})};const u=new Set(["empty object","free-floating scalar","invalid @language value","invalid property","null @id value","null @value value","object with only @id","object with only @language","object with only @list","object with only @value","relative @id reference","relative @type reference","relative @vocab reference","reserved @id value","reserved @reverse value","reserved term","blank node predicate","relative graph reference","relative object reference","relative predicate reference","relative subject reference","rdfDirection not set"]);o.safeEventHandler=function({event:e,next:t}){if("warning"===e.level&&u.has(e.code))throw new n("Safe mode validation error.","jsonld.ValidationError",{event:e});t()},o.logEventHandler=function({event:e,next:t}){console.log(`EVENT: ${e.message}`,{event:e}),t()},o.logWarningEventHandler=function({event:e,next:t}){"warning"===e.level&&console.warn(`WARNING: ${e.message}`,{event:e}),t()},o.unhandledEventHandler=function({event:e}){throw new n("No handler for event.","jsonld.UnhandledEvent",{event:e})},o.setDefaultEventHandler=function({eventHandler:e}={}){o.defaultEventHandler=e?a(e):null}},34019:(e,t,r)=>{"use strict";const n=r(82207),{isArray:i,isObject:a,isEmptyObject:o,isString:s,isUndefined:u}=r(7382),{isList:c,isValue:l,isGraph:d,isSubject:h}=r(3978),{expandIri:p,getContextValue:f,isKeyword:y,process:g,processingMode:m}=r(51972),{isAbsolute:b}=r(30470),{REGEX_BCP47:v,REGEX_KEYWORD:_,addValue:w,asArray:T,getValues:S,validateTypeValue:O}=r(59263),{handleEvent:E}=r(92246),x={};function A({value:e,count:t,options:r}){if(0===t||"@value"in e||"@list"in e||1===t&&"@id"in e){if(r.eventHandler){let n,i;0===t?(n="empty object",i="Dropping empty object."):"@value"in e?(n="object with only @value",i="Dropping object with only @value."):"@list"in e?(n="object with only @list",i="Dropping object with only @list."):1===t&&"@id"in e&&(n="object with only @id",i="Dropping object with only @id."),E({event:{type:["JsonLdEvent"],code:n,level:"warning",message:i,details:{value:e}},options:r})}return null}return e}async function R({activeCtx:e,activeProperty:t,expandedActiveProperty:r,element:d,expandedParent:_,options:S={},insideList:I,typeKey:D,typeScopedContext:P}){const C=Object.keys(d).sort(),L=[];let k;const M=d[D]&&"@json"===p(e,i(d[D])?d[D][0]:d[D],{vocab:!0},{...S,typeExpansion:!0});for(const R of C){let I,D=d[R];if("@context"===R)continue;const C=p(e,R,{vocab:!0},S);if(null===C||!b(C)&&!y(C)){S.eventHandler&&E({event:{type:["JsonLdEvent"],code:"invalid property",level:"warning",message:"Dropping property that did not expand into an absolute IRI or keyword.",details:{property:R,expandedProperty:C}},options:S});continue}if(y(C)){if("@reverse"===r)throw new n("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:D});if(C in _&&"@included"!==C&&"@type"!==C)throw new n("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:C})}if("@id"===C){if(!s(D)){if(!S.isFrame)throw new n('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:D});if(a(D)){if(!o(D))throw new n('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:D})}else{if(!i(D))throw new n('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:D});if(!D.every((e=>s(e))))throw new n('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:D})}}w(_,"@id",T(D).map((t=>{if(s(t)){const r=p(e,t,{base:!0},S);return S.eventHandler&&(null===r?E(null===t?{event:{type:["JsonLdEvent"],code:"null @id value",level:"warning",message:"Null @id found.",details:{id:t}},options:S}:{event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:t}},options:S}):b(r)||E({event:{type:["JsonLdEvent"],code:"relative @id reference",level:"warning",message:"Relative @id reference found.",details:{id:t,expandedId:r}},options:S})),r}return t})),{propertyIsArray:S.isFrame});continue}if("@type"===C){a(D)&&(D=Object.fromEntries(Object.entries(D).map((([e,t])=>[p(P,e,{vocab:!0}),T(t).map((e=>p(P,e,{base:!0,vocab:!0},{...S,typeExpansion:!0})))])))),O(D,S.isFrame),w(_,"@type",T(D).map((e=>{if(s(e)){const t=p(P,e,{base:!0,vocab:!0},{...S,typeExpansion:!0});return"@json"===t||b(t)||S.eventHandler&&E({event:{type:["JsonLdEvent"],code:"relative @type reference",level:"warning",message:"Relative @type reference found.",details:{type:e}},options:S}),t}return e})),{propertyIsArray:!!S.isFrame});continue}if("@included"===C&&m(e,1.1)){const r=T(await x.expand({activeCtx:e,activeProperty:t,element:D,options:S}));if(!r.every((e=>h(e))))throw new n("Invalid JSON-LD syntax; values of @included must expand to node objects.","jsonld.SyntaxError",{code:"invalid @included value",value:D});w(_,"@included",r,{propertyIsArray:!0});continue}if("@graph"===C&&!a(D)&&!i(D))throw new n('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:D});if("@value"===C){k=D,M&&m(e,1.1)?_["@value"]=D:w(_,"@value",D,{propertyIsArray:S.isFrame});continue}if("@language"===C){if(null===D)continue;if(!s(D)&&!S.isFrame)throw new n('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:D});D=T(D).map((e=>s(e)?e.toLowerCase():e));for(const e of D)s(e)&&!e.match(v)&&S.eventHandler&&E({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:e}},options:S});w(_,"@language",D,{propertyIsArray:S.isFrame});continue}if("@direction"===C){if(!s(D)&&!S.isFrame)throw new n('Invalid JSON-LD syntax; "@direction" value must be a string.',"jsonld.SyntaxError",{code:"invalid base direction",value:D});D=T(D);for(const e of D)if(s(e)&&"ltr"!==e&&"rtl"!==e)throw new n('Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",value:D});w(_,"@direction",D,{propertyIsArray:S.isFrame});continue}if("@index"===C){if(!s(D))throw new n('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:D});w(_,"@index",D);continue}if("@reverse"===C){if(!a(D))throw new n('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:D});if(I=await x.expand({activeCtx:e,activeProperty:"@reverse",element:D,options:S}),"@reverse"in I)for(const e in I["@reverse"])w(_,e,I["@reverse"][e],{propertyIsArray:!0});let t=_["@reverse"]||null;for(const e in I){if("@reverse"===e)continue;null===t&&(t=_["@reverse"]={}),w(t,e,[],{propertyIsArray:!0});const r=I[e];for(let i=0;i"@id"===e||"@index"===e))){if(I=T(I),S.isFrame||(I=I.filter((e=>null!==A({value:e,count:Object.keys(e).length,options:S})))),0===I.length)continue;I=I.map((e=>({"@graph":T(e)})))}if(F.mappings.has(R)&&F.mappings.get(R).reverse){const e=_["@reverse"]=_["@reverse"]||{};I=T(I);for(let t=0;t"@value"===p(e,t,{vocab:!0},S))))throw new n("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:i});await R({activeCtx:e,activeProperty:t,expandedActiveProperty:r,element:i,expandedParent:_,options:S,insideList:I,typeScopedContext:P,typeKey:D})}}}function I({activeCtx:e,activeProperty:t,value:r,options:n}){if(null==r)return null;const i=p(e,t,{vocab:!0},n);if("@id"===i)return p(e,r,{base:!0},n);if("@type"===i)return p(e,r,{vocab:!0,base:!0},{...n,typeExpansion:!0});const a=f(e,t,"@type");if(("@id"===a||"@graph"===i)&&s(r)){const i=p(e,r,{base:!0},n);return null===i&&r.match(_)&&n.eventHandler&&E({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:t}},options:n}),{"@id":i}}if("@vocab"===a&&s(r))return{"@id":p(e,r,{vocab:!0,base:!0},n)};if(y(i))return r;const o={};if(a&&!["@id","@vocab","@none"].includes(a))o["@type"]=a;else if(s(r)){const r=f(e,t,"@language");null!==r&&(o["@language"]=r);const n=f(e,t,"@direction");null!==n&&(o["@direction"]=n)}return["boolean","number","string"].includes(typeof r)||(r=r.toString()),o["@value"]=r,o}function N(e,t,r,a){const o=[],u=Object.keys(t).sort();for(const c of u){const u=p(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 n("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&&(c.match(v)||a.eventHandler&&E({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:c}},options:a}),i["@language"]=c.toLowerCase()),r&&(i["@direction"]=r),o.push(i)}}return o}async function j({activeCtx:e,options:t,activeProperty:r,value:a,asGraph:o,indexKey:s,propertyIndex:c}){const h=[],y=Object.keys(a).sort(),m="@type"===s;for(let b of y){if(m){const r=f(e,b,"@context");u(r)||(e=await g({activeCtx:e,localCtx:r,propagate:!1,options:t}))}let y,v=a[b];i(v)||(v=[v]),v=await x.expand({activeCtx:e,activeProperty:r,element:v,options:t,insideList:!1,insideIndex:!0}),y=c?"@none"===b?"@none":I({activeCtx:e,activeProperty:s,value:b,options:t}):p(e,b,{vocab:!0},t),"@id"===s?b=p(e,b,{base:!0},t):m&&(b=y);for(let e of v){if(o&&!d(e)&&(e={"@graph":[e]}),"@type"===s)"@none"===y||(e["@type"]?e["@type"]=[b].concat(e["@type"]):e["@type"]=[b]);else{if(l(e)&&!["@language","@type","@index"].includes(s))throw new n(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${s}".`,"jsonld.SyntaxError",{code:"invalid value object",value:e});c?"@none"!==y&&w(e,c,y,{propertyIsArray:!0,prependValue:!0}):"@none"===y||s in e||(e[s]=b)}h.push(e)}}return h}e.exports=x,x.expand=async({activeCtx:e,activeProperty:t=null,element:r,options:c={},insideList:l=!1,insideIndex:d=!1,typeScopedContext:h=null})=>{if(null==r)return null;if("@default"===t&&(c=Object.assign({},c,{isFrame:!1})),!i(r)&&!a(r))return l||null!==t&&"@graph"!==p(e,t,{vocab:!0},c)?I({activeCtx:e,activeProperty:t,value:r,options:c}):(c.eventHandler&&E({event:{type:["JsonLdEvent"],code:"free-floating scalar",level:"warning",message:"Dropping free-floating scalar not in a list.",details:{value:r}},options:c}),null);if(i(r)){let n=[];const a=f(e,t,"@container")||[];l=l||a.includes("@list");for(let a=0;a1?n.slice().sort():n:[n];for(const t of i){const r=f(h,t,"@context");u(r)||(e=await g({activeCtx:e,localCtx:r,options:c,propagate:!1}))}}let N={};await R({activeCtx:e,activeProperty:t,expandedActiveProperty:y,element:r,expandedParent:N,options:c,insideList:l,typeKey:O,typeScopedContext:h}),_=Object.keys(N);let j=_.length;if("@value"in N){if("@type"in N&&("@language"in N||"@direction"in N))throw new n('Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and either "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:N});let t=j-1;if("@type"in N&&(t-=1),"@index"in N&&(t-=1),"@language"in N&&(t-=1),"@direction"in N&&(t-=1),0!==t)throw new n('Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and either "@type" or either or both "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:N});const r=null===N["@value"]?[]:T(N["@value"]),i=S(N,"@type");if(m(e,1.1)&&i.includes("@json")&&1===i.length);else if(0===r.length)c.eventHandler&&E({event:{type:["JsonLdEvent"],code:"null @value value",level:"warning",message:"Dropping null @value value.",details:{value:N}},options:c}),N=null;else{if(!r.every((e=>s(e)||o(e)))&&"@language"in N)throw new n("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:N});if(!i.every((e=>b(e)&&!(s(e)&&0===e.indexOf("_:"))||o(e))))throw new n('Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".',"jsonld.SyntaxError",{code:"invalid typed value",element:N})}}else if("@type"in N&&!i(N["@type"]))N["@type"]=[N["@type"]];else if("@set"in N||"@list"in N){if(j>1&&(2!==j||!("@index"in N)))throw new n('Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".',"jsonld.SyntaxError",{code:"invalid set or list object",element:N});"@set"in N&&(N=N["@set"],_=Object.keys(N),j=_.length)}else 1===j&&"@language"in N&&(c.eventHandler&&E({event:{type:["JsonLdEvent"],code:"object with only @language",level:"warning",message:"Dropping object with only @language.",details:{value:N}},options:c}),N=null);return!a(N)||c.keepFreeFloatingNodes||l||null!==t&&"@graph"!==y&&!(f(e,t,"@container")||[]).includes("@graph")||(N=A({value:N,count:j,options:c})),N}},5229:(e,t,r)=>{"use strict";const{isSubjectReference:n}=r(3978),{createMergedNodeMap:i}=r(9233),a={};e.exports=a,a.flatten=e=>{const t=i(e),r=[],a=Object.keys(t).sort();for(let e=0;e{"use strict";const{isKeyword:n}=r(51972),i=r(3978),a=r(7382),o=r(59263),s=r(30470),u=r(82207),{createNodeMap:c,mergeNodeMapGraphs:l}=r(9233),d={};function h(e){const t={};for(const r in e)void 0!==e[r]&&(t["@"+r]=[e[r]]);return[t]}function p(e,t,r){for(let n=r.length-1;n>=0;--n){const i=r[n];if(i.graph===t&&i.subject["@id"]===e["@id"])return!0}return!1}function f(e,t,r){const n="@"+r;let i=n in e?e[n][0]:t[r];if("embed"===r)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 y(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)&&"@json"!==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 g(e,t,r,s){let u=!0,c=!1;for(const l in r){let d=!1;const h=o.getValues(t,l),p=0===o.getValues(r,l).length;if("@id"===l){if(a.isEmptyObject(r["@id"][0]||{})?d=!0:r["@id"].length>=0&&(d=r["@id"].includes(h[0])),!s.requireAll)return d}else if("@type"===l){if(u=!1,p){if(h.length>0)return!1;d=!0}else if(1===r["@type"].length&&a.isEmptyObject(r["@type"][0]))d=h.length>0;else for(const e of r["@type"])d=!(!a.isObject(e)||!("@default"in e))||d||h.some((t=>t===e));if(!s.requireAll)return d}else{if(n(l))continue;{const t=o.getValues(r,l)[0];let n=!1;if(t&&(y([t]),n="@default"in t),u=!1,0===h.length&&n)continue;if(h.length>0&&p)return!1;if(void 0===t){if(h.length>0)return!1;d=!0}else if(i.isList(t)){const r=t["@list"][0];if(i.isList(h[0])){const t=h[0]["@list"];i.isValue(r)?d=t.some((e=>w(r,e))):(i.isSubject(r)||i.isSubjectReference(r))&&(d=t.some((t=>_(e,r,t,s))))}}else d=i.isValue(t)?h.some((e=>w(t,e))):i.isSubjectReference(t)?h.some((r=>_(e,t,r,s))):!!a.isObject(t)&&h.length>0}}if(!d&&s.requireAll)return!1;c=c||d}return u||c}function m(e,t){const r=e.uniqueEmbeds[e.graph],n=r[t],i=n.parent,s=n.property,u={"@id":t};if(a.isArray(i)){for(let e=0;e{const t=Object.keys(r);for(const n of t)n in r&&a.isObject(r[n].parent)&&r[n].parent["@id"]===e&&(delete r[n],c(n))};c(t)}function b(e,t){if(a.isArray(e))return e.map((e=>b(e,t)));if(a.isObject(e)){if("@preserve"in e)return e["@preserve"][0];if(i.isValue(e))return e;if(i.isList(e))return e["@list"]=b(e["@list"],t),e;if("@id"in e){const r=e["@id"];if(t.link.hasOwnProperty(r)){const n=t.link[r].indexOf(e);if(-1!==n)return t.link[r][n];t.link[r].push(e)}else t.link[r]=[e]}for(const r in e)"@id"===r&&t.bnodesToClear.includes(e[r])?delete e["@id"]:e[r]=b(e[r],t)}return e}function v(e,t,r){a.isObject(e)?o.addValue(e,t,r,{propertyIsArray:!0}):e.push(r)}function _(e,t,r,n){if(!("@id"in r))return!1;const i=e.subjects[r["@id"]];return i&&g(e,i,t,n)}function w(e,t){const r=t["@value"],n=t["@type"],i=t["@language"],o=e["@value"]?a.isArray(e["@value"])?e["@value"]:[e["@value"]]:[],s=e["@type"]?a.isArray(e["@type"])?e["@type"]:[e["@type"]]:[],u=e["@language"]?a.isArray(e["@language"])?e["@language"]:[e["@language"]]:[];return 0===o.length&&0===s.length&&0===u.length||!(!o.includes(r)&&!a.isEmptyObject(o[0]))&&!!(!n&&0===s.length||s.includes(n)||n&&a.isEmptyObject(s[0]))&&!!(!i&&0===u.length||u.includes(i)||i&&a.isEmptyObject(u[0]))}e.exports=d,d.frameMergedOrDefault=(e,t,r)=>{const n={options:r,embedded:!1,graph:"@default",graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},i=new o.IdentifierIssuer("_:b");c(e,n.graphMap,"@default",i),r.merged&&(n.graphMap["@merged"]=l(n.graphMap),n.graph="@merged"),n.subjects=n.graphMap[n.graph];const a=[];return d.frame(n,Object.keys(n.subjects).sort(),t,a),r.pruneBlankNodeIdentifiers&&(r.bnodesToClear=Object.keys(n.bnodeMap).filter((e=>1===n.bnodeMap[e].length))),r.link={},b(a,r)},d.frame=(e,t,r,s,c=null)=>{y(r),r=r[0];const l=e.options,b={embed:f(r,l,"embed"),explicit:f(r,l,"explicit"),requireAll:f(r,l,"requireAll")};e.link.hasOwnProperty(e.graph)||(e.link[e.graph]={});const _=e.link[e.graph],T=function(e,t,r,n){const i={};for(const a of t){const t=e.graphMap[e.graph][a];g(e,t,r,n)&&(i[a]=t)}return i}(e,t,r,b),S=Object.keys(T).sort();for(const y of S){const g=T[y];if(null===c?e.uniqueEmbeds={[e.graph]:{}}:e.uniqueEmbeds[e.graph]=e.uniqueEmbeds[e.graph]||{},"@link"===b.embed&&y in _){v(s,c,_[y]);continue}const S={"@id":y};if(0===y.indexOf("_:")&&o.addValue(e.bnodeMap,y,S,{propertyIsArray:!0}),_[y]=S,("@first"===b.embed||"@last"===b.embed)&&e.is11)throw new u("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:r});if(e.embedded||!e.uniqueEmbeds[e.graph].hasOwnProperty(y))if(!e.embedded||"@never"!==b.embed&&!p(g,e.graph,e.subjectStack))if(!e.embedded||"@first"!=b.embed&&"@once"!=b.embed||!e.uniqueEmbeds[e.graph].hasOwnProperty(y)){if("@last"===b.embed&&y in e.uniqueEmbeds[e.graph]&&m(e,y),e.uniqueEmbeds[e.graph][y]={parent:s,property:c},e.subjectStack.push({subject:g,graph:e.graph}),y in e.graphMap){let t=!1,n=null;"@graph"in r?(n=r["@graph"][0],t=!("@merged"===y||"@default"===y),a.isObject(n)||(n={})):(t="@merged"!==e.graph,n={}),t&&d.frame({...e,graph:y,embedded:!1},Object.keys(e.graphMap[y]).sort(),[n],S,"@graph")}"@included"in r&&d.frame({...e,embedded:!1},t,r["@included"],S,"@included");for(const t of Object.keys(g).sort())if(n(t)){if(S[t]=o.clone(g[t]),"@type"===t)for(const t of g["@type"])0===t.indexOf("_:")&&o.addValue(e.bnodeMap,t,S,{propertyIsArray:!0})}else if(!b.explicit||t in r)for(const n of g[t]){const a=t in r?r[t]:h(b);if(i.isList(n)){const a=r[t]&&r[t][0]&&r[t][0]["@list"]?r[t][0]["@list"]:h(b),s={"@list":[]};v(S,t,s);const u=n["@list"];for(const t of u)i.isSubjectReference(t)?d.frame({...e,embedded:!0},[t["@id"]],a,s,"@list"):v(s,"@list",o.clone(t))}else i.isSubjectReference(n)?d.frame({...e,embedded:!0},[n["@id"]],a,S,t):w(a[0],n)&&v(S,t,o.clone(n))}for(const e of Object.keys(r).sort()){if("@type"===e){if(!a.isObject(r[e][0])||!("@default"in r[e][0]))continue}else if(n(e))continue;const t=r[e][0]||{};if(!f(t,l,"omitDefault")&&!(e in S)){let r="@null";"@default"in t&&(r=o.clone(t["@default"])),a.isArray(r)||(r=[r]),S[e]=[{"@preserve":r}]}}for(const t of Object.keys(r["@reverse"]||{}).sort()){const n=r["@reverse"][t];for(const r of Object.keys(e.subjects))o.getValues(e.subjects[r],t).some((e=>e["@id"]===y))&&(S["@reverse"]=S["@reverse"]||{},o.addValue(S["@reverse"],t,[],{propertyIsArray:!0}),d.frame({...e,embedded:!0},[r],n,S["@reverse"][t],c))}v(s,c,S),e.subjectStack.pop()}else v(s,c,S);else v(s,c,S)}},d.cleanupNull=(e,t)=>{if(a.isArray(e))return e.map((e=>d.cleanupNull(e,t))).filter((e=>e));if("@null"===e)return null;if(a.isObject(e)){if("@id"in e){const r=e["@id"];if(t.link.hasOwnProperty(r)){const n=t.link[r].indexOf(e);if(-1!==n)return t.link[r][n];t.link[r].push(e)}else t.link[r]=[e]}for(const r in e)e[r]=d.cleanupNull(e[r],t)}return e}},43947:(e,t,r)=>{"use strict";const n=r(82207),i=r(3978),a=r(7382),{REGEX_BCP47:o,addValue:s}=r(59263),{handleEvent:u}=r(92246),{RDF_LIST:c,RDF_FIRST:l,RDF_REST:d,RDF_NIL:h,RDF_TYPE:p,RDF_JSON_LITERAL:f,XSD_BOOLEAN:y,XSD_DOUBLE:g,XSD_INTEGER:m,XSD_STRING:b}=r(49378),v={};function _(e,t,r,i){if(e.termType.endsWith("Node"))return{"@id":e.value};const s={"@value":e.value};if(e.language)e.language.match(o)||i.eventHandler&&u({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:e.language}},options:i}),s["@language"]=e.language;else{let c=e.datatype.value;if(c||(c=b),c===f){c="@json";try{s["@value"]=JSON.parse(s["@value"])}catch(e){throw new n("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:s["@value"],cause:e})}}if(t){if(c===y)"true"===s["@value"]?s["@value"]=!0:"false"===s["@value"]&&(s["@value"]=!1);else if(a.isNumeric(s["@value"]))if(c===m){const e=parseInt(s["@value"],10);e.toFixed(0)===s["@value"]&&(s["@value"]=e)}else c===g&&(s["@value"]=parseFloat(s["@value"]));[y,m,g,b].includes(c)||(s["@type"]=c)}else if("i18n-datatype"===r&&c.startsWith("https://www.w3.org/ns/i18n#")){const[,e,t]=c.split(/[#_]/);e.length>0&&(s["@language"]=e,e.match(o)||i.eventHandler&&u({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:e}},options:i})),s["@direction"]=t}else c!==b&&(s["@type"]=c)}return s}e.exports=v,v.fromRDF=async(e,t)=>{const{useRdfType:r=!1,useNativeTypes:o=!1,rdfDirection:u=null}=t,f={},y={"@default":f},g={};if(u){if("compound-literal"===u)throw new n("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:u});if("i18n-datatype"!==u)throw new n("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:u})}for(const n of e){const e="DefaultGraph"===n.graph.termType?"@default":n.graph.value;e in y||(y[e]={}),"@default"===e||e in f||(f[e]={"@id":e});const i=y[e],a=n.subject.value,c=n.predicate.value,l=n.object;a in i||(i[a]={"@id":a});const d=i[a],m=l.termType.endsWith("Node");if(m&&!(l.value in i)&&(i[l.value]={"@id":l.value}),c===p&&!r&&m){s(d,"@type",l.value,{propertyIsArray:!0});continue}const b=_(l,o,u,t);if(s(d,c,b,{propertyIsArray:!0}),m)if(l.value===h){const e=i[l.value];"usages"in e||(e.usages=[]),e.usages.push({node:d,property:c,value:b})}else l.value in g?g[l.value]=!1:g[l.value]={node:d,property:c,value:b}}for(const e in y){const t=y[e];if(!(h in t))continue;const r=t[h];if(r.usages){for(let e of r.usages){let r=e.node,n=e.property,o=e.value;const s=[],u=[];let h=Object.keys(r).length;for(;n===d&&a.isObject(g[r["@id"]])&&a.isArray(r[l])&&1===r[l].length&&a.isArray(r[d])&&1===r[d].length&&(3===h||4===h&&a.isArray(r["@type"])&&1===r["@type"].length&&r["@type"][0]===c)&&(s.push(r[l][0]),u.push(r["@id"]),e=g[r["@id"]],r=e.node,n=e.property,o=e.value,h=Object.keys(r).length,i.isBlankNode(r)););delete o["@id"],o["@list"]=s.reverse();for(const e of u)delete t[e]}delete r.usages}}const m=[],b=Object.keys(f).sort();for(const e of b){const t=f[e];if(e in y){const r=t["@graph"]=[],n=y[e],a=Object.keys(n).sort();for(const e of a){const t=n[e];i.isSubjectReference(t)||r.push(t)}}i.isSubjectReference(t)||m.push(t)}return m}},3978:(e,t,r)=>{"use strict";const n=r(7382),i={};e.exports=i,i.isSubject=e=>!(!n.isObject(e)||"@value"in e||"@set"in e||"@list"in e)&&(Object.keys(e).length>1||!("@id"in e)),i.isSubjectReference=e=>n.isObject(e)&&1===Object.keys(e).length&&"@id"in e,i.isValue=e=>n.isObject(e)&&"@value"in e,i.isList=e=>n.isObject(e)&&"@list"in e,i.isGraph=e=>n.isObject(e)&&"@graph"in e&&1===Object.keys(e).filter((e=>"@id"!==e&&"@index"!==e)).length,i.isSimpleGraph=e=>i.isGraph(e)&&!("@id"in e),i.isBlankNode=e=>{if(n.isObject(e)){if("@id"in e){const t=e["@id"];return!n.isString(t)||0===t.indexOf("_:")}return 0===Object.keys(e).length||!("@value"in e||"@set"in e||"@list"in e)}return!1}},34841:(e,t,r)=>{const n=r(60989),i=r(60701),a=r(59263),o=r(47034),s=a.IdentifierIssuer,u=r(82207),c=r(1235),l=r(68229),{expand:d}=r(34019),{flatten:h}=r(5229),{fromRDF:p}=r(43947),{toRDF:f}=r(99180),{frameMergedOrDefault:y,cleanupNull:g}=r(47946),{isArray:m,isObject:b,isString:v}=r(7382),{isSubjectReference:_}=r(3978),{expandIri:w,getInitialContext:T,process:S,processingMode:O}=r(51972),{compact:E,compactIri:x}=r(21058),{createNodeMap:A,createMergedNodeMap:R,mergeNodeMaps:I}=r(9233),{logEventHandler:N,logWarningEventHandler:j,safeEventHandler:D,setDefaultEventHandler:P,setupEventHandler:C,strictEventHandler:L,unhandledEventHandler:k}=r(92246),M=function(e){const t={},M=new c({max:100});function F(t,{documentLoader:r=e.documentLoader,...n}){if(t&&"compactionMap"in t)throw new u('"compactionMap" not supported.',"jsonld.OptionsError");if(t&&"expansionMap"in t)throw new u('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:r},n,t,{eventHandler:C({options:t})})}return e.compact=async function(t,r,n){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(null===r)throw new u("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(null===t)return null;let i;(n=F(n,{base:v(t)?t:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new s("_:b"),contextResolver:new o({sharedCache:M})})).link&&(n.skipExpansion=!0),n.compactToRelative||delete n.base,i=n.skipExpansion?t:await e.expand(t,n);const c=await e.processContext(T(n),r,n);let l=await E({activeCtx:c,element:i,options:n});n.compactArrays&&!n.graph&&m(l)?1===l.length?l=l[0]:0===l.length&&(l={}):n.graph&&b(l)&&(l=[l]),b(r)&&"@context"in r&&(r=r["@context"]),r=a.clone(r),m(r)||(r=[r]);const d=r;r=[];for(let e=0;e0)&&r.push(d[e]);const h=r.length>0;if(1===r.length&&(r=r[0]),m(l)){const e=x({activeCtx:c,iri:"@graph",relativeTo:{vocab:!0}}),t=l;l={},h&&(l["@context"]=r),l[e]=t}else if(b(l)&&h){const e=l;l={"@context":r};for(const t in e)l[t]=e[t]}return l},e.expand=async function(t,r){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");const n={},i=[];if("expandContext"in(r=F(r,{keepFreeFloatingNodes:!1,contextResolver:new o({sharedCache:M})}))){const e=a.clone(r.expandContext);b(e)&&"@context"in e?n.expandContext=e:n.expandContext={"@context":e},i.push(n.expandContext)}let s;if(v(t)){const a=await e.get(t,r);s=a.documentUrl,n.input=a.document,a.contextUrl&&(n.remoteContext={"@context":a.contextUrl},i.push(n.remoteContext))}else n.input=a.clone(t);"base"in r||(r.base=s||"");let u=T(r);for(const e of i)u=await S({activeCtx:u,localCtx:e,options:r});let c=await d({activeCtx:u,element:n.input,options:r});return b(c)&&"@graph"in c&&1===Object.keys(c).length?c=c["@graph"]:null===c&&(c=[]),m(c)||(c=[c]),c},e.flatten=async function(t,r,n){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");r="function"==typeof r?null:r||null,n=F(n,{base:v(t)?t:"",contextResolver:new o({sharedCache:M})});const i=await e.expand(t,n),a=h(i);return null===r?a:(n.graph=!0,n.skipExpansion=!0,await e.compact(a,r,n))},e.frame=async function(t,r,n){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(n=F(n,{base:v(t)?t:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new o({sharedCache:M})}),v(r)){const t=await e.get(r,n);if(r=t.document,t.contextUrl){let e=r["@context"];e?m(e)?e.push(t.contextUrl):e=[e,t.contextUrl]:e=t.contextUrl,r["@context"]=e}}const i=r&&r["@context"]||{},a=await e.processContext(T(n),i,n);n.hasOwnProperty("omitGraph")||(n.omitGraph=O(a,1.1)),n.hasOwnProperty("pruneBlankNodeIdentifiers")||(n.pruneBlankNodeIdentifiers=O(a,1.1));const s=await e.expand(t,n),u={...n};u.isFrame=!0,u.keepFreeFloatingNodes=!0;const c=await e.expand(r,u),l=Object.keys(r).map((e=>w(a,e,{vocab:!0})));u.merged=!l.includes("@graph"),u.is11=O(a,1.1);const d=y(s,c,u);u.graph=!n.omitGraph,u.skipExpansion=!0,u.link={},u.framing=!0;let h=await e.compact(d,i,u);return u.link={},h=g(h,u),h},e.link=async function(t,r,n){const i={};return r&&(i["@context"]=r),i["@embed"]="@link",e.frame(t,i,n)},e.normalize=e.canonize=async function(t,r){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if("inputFormat"in(r=F(r,{base:v(t)?t:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new o({sharedCache:M})}))){if("application/n-quads"!==r.inputFormat&&"application/nquads"!==r.inputFormat)throw new u("Unknown canonicalization input format.","jsonld.CanonizeError");const e=l.parse(t);return n.canonize(e,r)}const i={...r};delete i.format,i.produceGeneralizedRdf=!1;const a=await e.toRDF(t,i);return n.canonize(a,r)},e.fromRDF=async function(e,r){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");r=F(r,{format:v(e)?"application/n-quads":void 0});const{format:n}=r;let{rdfParser:i}=r;if(n){if(i=i||t[n],!i)throw new u("Unknown input format.","jsonld.UnknownFormat",{format:n})}else i=()=>e;const a=await i(e);return p(a,r)},e.toRDF=async function(t,r){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");let n;n=(r=F(r,{base:v(t)?t:"",skipExpansion:!1,contextResolver:new o({sharedCache:M})})).skipExpansion?t:await e.expand(t,r);const i=f(n,r);if(r.format){if("application/n-quads"===r.format||"application/nquads"===r.format)return l.serialize(i);throw new u("Unknown output format.","jsonld.UnknownFormat",{format:r.format})}return i},e.createNodeMap=async function(t,r){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");r=F(r,{base:v(t)?t:"",contextResolver:new o({sharedCache:M})});const n=await e.expand(t,r);return R(n,r)},e.merge=async function(t,r,n){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!m(t))throw new TypeError('Could not merge, "docs" must be an array.');r="function"==typeof r?null:r||null,n=F(n,{contextResolver:new o({sharedCache:M})});const i=await Promise.all(t.map((t=>{const r={...n};return e.expand(t,r)})));let u=!0;"mergeNodes"in n&&(u=n.mergeNodes);const c=n.issuer||new s("_:b"),l={"@default":{}};for(let e=0;ee._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,r){let n;n="function"==typeof r.documentLoader?r.documentLoader:e.documentLoader;const i=await n(t);try{if(!i.document)throw new u("No remote document found at the given URL.","jsonld.NullRemoteDocument");v(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,r){return r=F(r,{base:"",contextResolver:new o({sharedCache:M})}),null===t?T(r):(t=a.clone(t),b(t)&&"@context"in t||(t={"@context":t}),S({activeCtx:e,localCtx:t,options:r}))},e.getContextValue=r(51972).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,r){t[e]=r},e.unregisterRDFParser=function(e){delete t[e]},e.registerRDFParser("application/n-quads",l.parse),e.registerRDFParser("application/nquads",l.parse),e.url=r(30470),e.logEventHandler=N,e.logWarningEventHandler=j,e.safeEventHandler=D,e.setDefaultEventHandler=P,e.strictEventHandler=L,e.unhandledEventHandler=k,e.util=a,Object.assign(e,a),e.promises=e,e.RequestQueue=r(73743),e.JsonLdProcessor=r(45445)(e),i.setupGlobals(e),i.setupDocumentLoaders(e),e},F=function(){return M((function(){return F()}))};M(F),e.exports=F},9233:(e,t,r)=>{"use strict";const{isKeyword:n}=r(51972),i=r(3978),a=r(7382),o=r(59263),s=r(82207),u={};e.exports=u,u.createMergedNodeMap=(e,t)=>{const r=(t=t||{}).issuer||new o.IdentifierIssuer("_:b"),n={"@default":{}};return u.createNodeMap(e,n,"@default",r),u.mergeNodeMaps(n)},u.createNodeMap=(e,t,r,c,l,d)=>{if(a.isArray(e)){for(const n of e)u.createNodeMap(n,t,r,c,void 0,d);return}if(!a.isObject(e))return void(d&&d.push(e));if(i.isValue(e)){if("@type"in e){let t=e["@type"];0===t.indexOf("_:")&&(e["@type"]=t=c.getId(t))}return void(d&&d.push(e))}if(d&&i.isList(e)){const n=[];return u.createNodeMap(e["@list"],t,r,c,l,n),void d.push({"@list":n})}if("@type"in e){const t=e["@type"];for(const e of t)0===e.indexOf("_:")&&c.getId(e)}a.isUndefined(l)&&(l=i.isBlankNode(e)?c.getId(e["@id"]):e["@id"]),d&&d.push({"@id":l});const h=t[r],p=h[l]=h[l]||{};p["@id"]=l;const f=Object.keys(e).sort();for(let a of f){if("@id"===a)continue;if("@reverse"===a){const n={"@id":l},a=e["@reverse"];for(const e in a){const s=a[e];for(const a of s){let s=a["@id"];i.isBlankNode(a)&&(s=c.getId(s)),u.createNodeMap(a,t,r,c,s),o.addValue(h[s],e,n,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if("@graph"===a){l in t||(t[l]={}),u.createNodeMap(e[a],t,l,c);continue}if("@included"===a){u.createNodeMap(e[a],t,r,c);continue}if("@type"!==a&&n(a)){if("@index"===a&&a in p&&(e[a]!==p[a]||e[a]["@id"]!==p[a]["@id"]))throw new s("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:p});p[a]=e[a];continue}const d=e[a];if(0===a.indexOf("_:")&&(a=c.getId(a)),0!==d.length)for(let e of d)if("@type"===a&&(e=0===e.indexOf("_:")?c.getId(e):e),i.isSubject(e)||i.isSubjectReference(e)){if("@id"in e&&!e["@id"])continue;const n=i.isBlankNode(e)?c.getId(e["@id"]):e["@id"];o.addValue(p,a,{"@id":n},{propertyIsArray:!0,allowDuplicate:!1}),u.createNodeMap(e,t,r,c,n)}else if(i.isValue(e))o.addValue(p,a,e,{propertyIsArray:!0,allowDuplicate:!1});else if(i.isList(e)){const n=[];u.createNodeMap(e["@list"],t,r,c,l,n),e={"@list":n},o.addValue(p,a,e,{propertyIsArray:!0,allowDuplicate:!1})}else u.createNodeMap(e,t,r,c,l),o.addValue(p,a,e,{propertyIsArray:!0,allowDuplicate:!1});else o.addValue(p,a,[],{propertyIsArray:!0})}},u.mergeNodeMapGraphs=e=>{const t={};for(const r of Object.keys(e).sort())for(const i of Object.keys(e[r]).sort()){const a=e[r][i];i in t||(t[i]={"@id":i});const s=t[i];for(const e of Object.keys(a).sort())if(n(e)&&"@type"!==e)s[e]=o.clone(a[e]);else for(const t of a[e])o.addValue(s,e,o.clone(t),{propertyIsArray:!0,allowDuplicate:!1})}return t},u.mergeNodeMaps=e=>{const t=e["@default"],r=Object.keys(e).sort();for(const n of r){if("@default"===n)continue;const r=e[n];let a=t[n];a?"@graph"in a||(a["@graph"]=[]):t[n]=a={"@id":n,"@graph":[]};const o=a["@graph"];for(const e of Object.keys(r).sort()){const t=r[e];i.isSubjectReference(t)||o.push(t)}}return t}},60701:(e,t,r)=>{"use strict";const n=r(86957),i={};e.exports=i,i.setupDocumentLoaders=function(e){"undefined"!=typeof XMLHttpRequest&&(e.documentLoaders.xhr=n,e.useDocumentLoader("xhr"))},i.setupGlobals=function(e){void 0===globalThis.JsonLdProcessor&&Object.defineProperty(globalThis,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:e.JsonLdProcessor})}},99180:(e,t,r)=>{"use strict";const{createNodeMap:n}=r(9233),{isKeyword:i}=r(51972),a=r(3978),o=r(12059),s=r(82207),u=r(7382),c=r(59263),{handleEvent:l}=r(92246),{RDF_FIRST:d,RDF_REST:h,RDF_NIL:p,RDF_TYPE:f,RDF_JSON_LITERAL:y,RDF_LANGSTRING:g,XSD_BOOLEAN:m,XSD_DOUBLE:b,XSD_INTEGER:v,XSD_STRING:_}=r(49378),{isAbsolute:w}=r(30470),T={};function S(e,t,r,n,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=f;else if(i(t))continue;for(const i of u){const o={termType:s.startsWith("_:")?"BlankNode":"NamedNode",value:s};if(!w(s)){a.eventHandler&&l({event:{type:["JsonLdEvent"],code:"relative subject reference",level:"warning",message:"Relative subject reference found.",details:{subject:s}},options:a});continue}const u={termType:t.startsWith("_:")?"BlankNode":"NamedNode",value:t};if(!w(t)){a.eventHandler&&l({event:{type:["JsonLdEvent"],code:"relative predicate reference",level:"warning",message:"Relative predicate reference found.",details:{predicate:t}},options:a});continue}if("BlankNode"===u.termType&&!a.produceGeneralizedRdf){a.eventHandler&&l({event:{type:["JsonLdEvent"],code:"blank node predicate",level:"warning",message:"Dropping blank node predicate.",details:{property:n.getOldIds().find((e=>n.getId(e)===t))}},options:a});continue}const c=O(i,n,e,r,a.rdfDirection,a);c&&e.push({subject:o,predicate:u,object:c,graph:r})}}}}function O(e,t,r,n,i,c){const f={};if(a.isValue(e)){f.termType="Literal",f.value=void 0,f.datatype={termType:"NamedNode"};let t=e["@value"];const r=e["@type"]||null;if("@json"===r)f.value=o(t),f.datatype.value=y;else if(u.isBoolean(t))f.value=t.toString(),f.datatype.value=r||m;else if(u.isDouble(t)||r===b)u.isDouble(t)||(t=parseFloat(t)),f.value=t.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),f.datatype.value=r||b;else if(u.isNumber(t))f.value=t.toFixed(0),f.datatype.value=r||v;else if("@direction"in e&&"i18n-datatype"===i){const r=`https://www.w3.org/ns/i18n#${(e["@language"]||"").toLowerCase()}_${e["@direction"]}`;f.datatype.value=r,f.value=t}else{if("@direction"in e&&"compound-literal"===i)throw new s("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:i});if("@direction"in e&&i)throw new s("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:i});"@language"in e?("@direction"in e&&!i&&c.eventHandler&&l({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:f.value}},options:c}),f.value=t,f.datatype.value=r||g,f.language=e["@language"]):("@direction"in e&&!i&&c.eventHandler&&l({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:f.value}},options:c}),f.value=t,f.datatype.value=r||_)}}else if(a.isList(e)){const a=function(e,t,r,n,i,a){const o={termType:"NamedNode",value:d},s={termType:"NamedNode",value:h},u={termType:"NamedNode",value:p},c=e.pop(),l=c?{termType:"BlankNode",value:t.getId()}:u;let f=l;for(const u of e){const e=O(u,t,r,n,i,a),c={termType:"BlankNode",value:t.getId()};r.push({subject:f,predicate:o,object:e,graph:n}),r.push({subject:f,predicate:s,object:c,graph:n}),f=c}if(c){const e=O(c,t,r,n,i,a);r.push({subject:f,predicate:o,object:e,graph:n}),r.push({subject:f,predicate:s,object:u,graph:n})}return l}(e["@list"],t,r,n,i,c);f.termType=a.termType,f.value=a.value}else{const t=u.isObject(e)?e["@id"]:e;f.termType=t.startsWith("_:")?"BlankNode":"NamedNode",f.value=t}return"NamedNode"!==f.termType||w(f.value)?f:(c.eventHandler&&l({event:{type:["JsonLdEvent"],code:"relative object reference",level:"warning",message:"Relative object reference found.",details:{object:f.value}},options:c}),null)}e.exports=T,T.toRDF=(e,t)=>{const r=new c.IdentifierIssuer("_:b"),i={"@default":{}};n(e,i,"@default",r);const a=[],o=Object.keys(i).sort();for(const e of o){let n;if("@default"===e)n={termType:"DefaultGraph",value:""};else{if(!w(e)){t.eventHandler&&l({event:{type:["JsonLdEvent"],code:"relative graph reference",level:"warning",message:"Relative graph reference found.",details:{graph:e}},options:t});continue}n=e.startsWith("_:")?{termType:"BlankNode"}:{termType:"NamedNode"},n.value=e}S(a,i[e],n,r,t)}return a}},7382:e=>{"use strict";const t={};e.exports=t,t.isArray=Array.isArray,t.isBoolean=e=>"boolean"==typeof e||"[object Boolean]"===Object.prototype.toString.call(e),t.isDouble=e=>t.isNumber(e)&&(-1!==String(e).indexOf(".")||Math.abs(e)>=1e21),t.isEmptyObject=e=>t.isObject(e)&&0===Object.keys(e).length,t.isNumber=e=>"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e),t.isNumeric=e=>!isNaN(parseFloat(e))&&isFinite(e),t.isObject=e=>"[object Object]"===Object.prototype.toString.call(e),t.isString=e=>"string"==typeof e||"[object String]"===Object.prototype.toString.call(e),t.isUndefined=e=>void 0===e},30470:(e,t,r)=>{"use strict";const n=r(7382),i={};e.exports=i,i.parsers={simple:{keys:["href","scheme","authority","path","query","fragment"],regex:/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/},full:{keys:["href","protocol","scheme","authority","auth","user","password","hostname","port","path","directory","file","query","fragment"],regex:/^(([a-zA-Z][a-zA-Z0-9+-.]*):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},i.parse=(e,t)=>{const r={},n=i.parsers[t||"full"],a=n.regex.exec(e);let o=n.keys.length;for(;o--;)r[n.keys[o]]=void 0===a[o]?null:a[o];return("https"===r.scheme&&"443"===r.port||"http"===r.scheme&&"80"===r.port)&&(r.href=r.href.replace(":"+r.port,""),r.authority=r.authority.replace(":"+r.port,""),r.port=null),r.normalizedPath=i.removeDotSegments(r.path),r},i.prependBase=(e,t)=>{if(null===e)return t;if(i.isAbsolute(t))return t;e&&!n.isString(e)||(e=i.parse(e||""));const r=i.parse(t),a={protocol:e.protocol||""};if(null!==r.authority)a.authority=r.authority,a.path=r.path,a.query=r.query;else if(a.authority=e.authority,""===r.path)a.path=e.path,null!==r.query?a.query=r.query:a.query=e.query;else{if(0===r.path.indexOf("/"))a.path=r.path;else{let t=e.path;t=t.substr(0,t.lastIndexOf("/")+1),(t.length>0||e.authority)&&"/"!==t.substr(-1)&&(t+="/"),t+=r.path,a.path=t}a.query=r.query}""!==r.path&&(a.path=i.removeDotSegments(a.path));let o=a.protocol;return null!==a.authority&&(o+="//"+a.authority),o+=a.path,null!==a.query&&(o+="?"+a.query),null!==r.fragment&&(o+="#"+r.fragment),""===o&&(o="./"),o},i.removeBase=(e,t)=>{if(null===e)return t;e&&!n.isString(e)||(e=i.parse(e||""));let r="";if(""!==e.href?r+=(e.protocol||"")+"//"+(e.authority||""):t.indexOf("//")&&(r+="//"),0!==t.indexOf(r))return t;const a=i.parse(t.substr(r.length)),o=e.normalizedPath.split("/"),s=a.normalizedPath.split("/"),u=a.fragment||a.query?0:1;for(;o.length>0&&s.length>u&&o[0]===s[0];)o.shift(),s.shift();let c="";if(o.length>0){o.pop();for(let e=0;e{if(0===e.length)return"";const t=e.split("/"),r=[];for(;t.length>0;){const e=t.shift(),n=0===t.length;"."!==e?".."!==e?r.push(e):(r.pop(),n&&r.push("")):n&&r.push("")}return"/"===e[0]&&r.length>0&&""!==r[0]&&r.unshift(""),1===r.length&&""===r[0]?"/":r.join("/")};const a=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;i.isAbsolute=e=>n.isString(e)&&a.test(e),i.isRelative=e=>n.isString(e)},59263:(e,t,r)=>{"use strict";const n=r(3978),i=r(7382),a=r(60989).IdentifierIssuer,o=r(82207),s=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,u=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,c=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,l="application/ld+json, application/json",d={};function h(e,t){if(i.isArray(t))for(let r=0;r{if(Object.keys(e).some((e=>"accept"===e.toLowerCase())))throw new RangeError('Accept header may not be specified; only "'+l+'" is supported.');return Object.assign({Accept:l},e)},d.parseLinkHeader=e=>{const t={},r=e.match(s);for(let e=0;e{if(!(i.isString(e)||i.isArray(e)&&e.every((e=>i.isString(e))))){if(t&&i.isObject(e))switch(Object.keys(e).length){case 0:return;case 1:if("@default"in e&&d.asArray(e["@default"]).every((e=>i.isString(e))))return}throw new o('Invalid JSON-LD syntax; "@type" value must a string, an array of strings, an empty object, or a default object.',"jsonld.SyntaxError",{code:"invalid type value",value:e})}},d.hasProperty=(e,t)=>{if(e.hasOwnProperty(t)){const r=e[t];return!i.isArray(r)||r.length>0}return!1},d.hasValue=(e,t,r)=>{if(d.hasProperty(e,t)){let a=e[t];const o=n.isList(a);if(i.isArray(a)||o){o&&(a=a["@list"]);for(let e=0;e{if("propertyIsArray"in(n=n||{})||(n.propertyIsArray=!1),"valueIsArray"in n||(n.valueIsArray=!1),"allowDuplicate"in n||(n.allowDuplicate=!0),"prependValue"in n||(n.prependValue=!1),n.valueIsArray)e[t]=r;else if(i.isArray(r)){0===r.length&&n.propertyIsArray&&!e.hasOwnProperty(t)&&(e[t]=[]),n.prependValue&&(r=r.concat(e[t]),e[t]=[]);for(let i=0;i[].concat(e[t]||[]),d.removeProperty=(e,t)=>{delete e[t]},d.removeValue=(e,t,r,n)=>{"propertyIsArray"in(n=n||{})||(n.propertyIsArray=!1);const i=d.getValues(e,t).filter((e=>!d.compareValues(e,r)));0===i.length?d.removeProperty(e,t):1!==i.length||n.propertyIsArray?e[t]=i:e[t]=i[0]},d.relabelBlankNodes=(e,t)=>h((t=t||{}).issuer||new a("_:b"),e),d.compareValues=(e,t)=>e===t||!(!n.isValue(e)||!n.isValue(t)||e["@value"]!==t["@value"]||e["@type"]!==t["@type"]||e["@language"]!==t["@language"]||e["@index"]!==t["@index"])||!!(i.isObject(e)&&"@id"in e&&i.isObject(t)&&"@id"in t)&&e["@id"]===t["@id"],d.compareShortestLeast=(e,t)=>e.length{"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,r,n)=>t+(0===n?"":",")+e(void 0===r||"symbol"==typeof r?null:r)),"")+"]":"{"+Object.keys(t).sort().reduce(((r,n,i)=>void 0===t[n]||"symbol"==typeof t[n]?r:r+(0===r.length?"":",")+e(n)+":"+e(t[n])),"")+"}"}},1235:(e,t,r)=>{"use strict";const n=r(28799),i=Symbol("max"),a=Symbol("length"),o=Symbol("lengthCalculator"),s=Symbol("allowStale"),u=Symbol("maxAge"),c=Symbol("dispose"),l=Symbol("noDisposeOnSet"),d=Symbol("lruList"),h=Symbol("cache"),p=Symbol("updateAgeOnGet"),f=()=>1,y=(e,t,r)=>{const n=e[h].get(t);if(n){const t=n.value;if(g(e,t)){if(b(e,n),!e[s])return}else r&&(e[p]&&(n.value.now=Date.now()),e[d].unshiftNode(n));return t.value}},g=(e,t)=>{if(!t||!t.maxAge&&!e[u])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[u]&&r>e[u]},m=e=>{if(e[a]>e[i])for(let t=e[d].tail;e[a]>e[i]&&null!==t;){const r=t.prev;b(e,t),t=r}},b=(e,t)=>{if(t){const r=t.value;e[c]&&e[c](r.key,r.value),e[a]-=r.length,e[h].delete(r.key),e[d].removeNode(t)}};class v{constructor(e,t,r,n,i){this.key=e,this.value=t,this.length=r,this.now=n,this.maxAge=i||0}}const _=(e,t,r,n)=>{let i=r.value;g(e,i)&&(b(e,r),e[s]||(i=void 0)),i&&t.call(n,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||f;if(this[o]="function"!=typeof t?f: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[p]=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,m(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,m(this)}get maxAge(){return this[u]}set lengthCalculator(e){"function"!=typeof e&&(e=f),e!==this[o]&&(this[o]=e,this[a]=0,this[d].forEach((e=>{e.length=this[o](e.value,e.key),this[a]+=e.length}))),m(this)}get lengthCalculator(){return this[o]}get length(){return this[a]}get itemCount(){return this[d].length}rforEach(e,t){t=t||this;for(let r=this[d].tail;null!==r;){const n=r.prev;_(this,e,r,t),r=n}}forEach(e,t){t=t||this;for(let r=this[d].head;null!==r;){const n=r.next;_(this,e,r,t),r=n}}keys(){return this[d].toArray().map((e=>e.key))}values(){return this[d].toArray().map((e=>e.value))}reset(){this[c]&&this[d]&&this[d].length&&this[d].forEach((e=>this[c](e.key,e.value))),this[h]=new Map,this[d]=new n,this[a]=0}dump(){return this[d].map((e=>!g(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[d]}set(e,t,r){if((r=r||this[u])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const n=r?Date.now():0,s=this[o](t,e);if(this[h].has(e)){if(s>this[i])return b(this,this[h].get(e)),!1;const o=this[h].get(e).value;return this[c]&&(this[l]||this[c](e,o.value)),o.now=n,o.maxAge=r,o.value=t,this[a]+=s-o.length,o.length=s,this.get(e),m(this),!0}const p=new v(e,t,s,n,r);return p.length>this[i]?(this[c]&&this[c](e,t),!1):(this[a]+=p.length,this[d].unshift(p),this[h].set(e,this[d].head),m(this),!0)}has(e){if(!this[h].has(e))return!1;const t=this[h].get(e).value;return!g(this,t)}get(e){return y(this,e,!0)}peek(e){return y(this,e,!1)}pop(){const e=this[d].tail;return e?(b(this,e),e.value):null}del(e){b(this,this[h].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const n=e[r],i=n.e||0;if(0===i)this.set(n.k,n.v);else{const e=i-t;e>0&&this.set(n.k,n.v,e)}}}prune(){this[h].forEach(((e,t)=>y(this,t,!1)))}}},51873:(e,t,r)=>{var n=r(9325).Symbol;e.exports=n},72552:(e,t,r)=>{var n=r(51873),i=r(659),a=r(59350),o=n?n.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?i(e):a(e)}},54128:(e,t,r)=>{var n=r(31800),i=/^\s+/;e.exports=function(e){return e?e.slice(0,n(e)+1).replace(i,""):e}},34840:(e,t,r)=>{var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=n},659:(e,t,r)=>{var n=r(51873),i=Object.prototype,a=i.hasOwnProperty,o=i.toString,s=n?n.toStringTag:void 0;e.exports=function(e){var t=a.call(e,s),r=e[s];try{e[s]=void 0;var n=!0}catch(e){}var i=o.call(e);return n&&(t?e[s]=r:delete e[s]),i}},59350:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},9325:(e,t,r)=>{var n=r(34840),i="object"==typeof self&&self&&self.Object===Object&&self,a=n||i||Function("return this")();e.exports=a},31800:e=>{var t=/\s/;e.exports=function(e){for(var r=e.length;r--&&t.test(e.charAt(r)););return r}},12177:(e,t,r)=>{var n=r(61489);e.exports=function(e,t){var r;if("function"!=typeof t)throw new TypeError("Expected a function");return e=n(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=void 0),r}}},23805:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},40346:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},44394:(e,t,r)=>{var n=r(72552),i=r(40346);e.exports=function(e){return"symbol"==typeof e||i(e)&&"[object Symbol]"==n(e)}},58059:(e,t,r)=>{var n=r(12177);e.exports=function(e){return n(2,e)}},17400:(e,t,r)=>{var n=r(99374),i=1/0;e.exports=function(e){return e?(e=n(e))===i||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}},61489:(e,t,r)=>{var n=r(17400);e.exports=function(e){var t=n(e),r=t%1;return t==t?r?t-r:t:0}},99374:(e,t,r)=>{var n=r(54128),i=r(23805),a=r(44394),o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(a(e))return NaN;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=n(e);var r=s.test(e);return r||u.test(e)?c(e.slice(2),r?2:8):o.test(e)?NaN:+e}},43349:e=>{function t(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},65852:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});const n="http://www.w3.org/1999/02/22-rdf-syntax-ns#",i="http://www.w3.org/2001/XMLSchema#",a="http://www.w3.org/2000/10/swap/",o={xsd:{decimal:`${i}decimal`,boolean:`${i}boolean`,double:`${i}double`,integer:`${i}integer`,string:`${i}string`},rdf:{type:`${n}type`,nil:`${n}nil`,first:`${n}first`,rest:`${n}rest`,langString:`${n}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${a}reify#forSome`,forAll:`${a}reify#forAll`},log:{implies:`${a}log#implies`}}},28612:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>l,FL:()=>b,PB:()=>f,Yo:()=>h,iN:()=>m,kO:()=>v,n7:()=>v,rT:()=>y,uS:()=>p,x1:()=>d,yV:()=>g});var n=r(65852),i=r(69980);const{rdf:a,xsd:o}=n.A;let s,u=0;const c={namedNode:function(e){return new h(e)},blankNode:function(e){return new f(e||"n3-"+u++)},variable:function(e){return new y(e)},literal:function(e,t){if("string"==typeof t)return new p(`"${e}"@${t.toLowerCase()}`);let r=t?t.value:"";return""===r&&("boolean"==typeof e?r=o.boolean:"number"==typeof e&&(Number.isFinite(e)?r=Number.isInteger(e)?o.integer:o.double:(r=o.double,Number.isNaN(e)||(e=e>0?"INF":"-INF")))),""===r||r===o.string?new p(`"${e}"`):new p(`"${e}"^^${r}`)},defaultGraph:function(){return s},quad:_,triple:_},l=c;class d{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof d?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}}class h extends d{get termType(){return"NamedNode"}}class p extends d{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const e=this.id;let t=e.lastIndexOf('"')+1;return t{"use strict";r.d(t,{A:()=>h});var n=r(65852),i=r(79596),a=r.n(i);const{xsd:o}=n.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},d=/$0^/;class h{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]=d)}else this._n3Mode=!1!==e.n3;this._comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,t){let r=this._input,n=r.length;for(;;){let e,s;for(;e=this._newline.exec(r);)this._comments&&(s=this._comment.exec(e[0]))&&i("comment",s[1],"",this._line,e[0].length),r=r.substr(e[0].length,r.length),n=r.length,this._line++;if(!e&&(e=this._whitespace.exec(r))&&(r=r.substr(e[0].length,r.length)),this._endOfFile.test(r))return t&&(this._comments&&(s=this._comment.exec(r))&&i("comment",s[1],"",this._line,r.length),r=null,i("eof","","",this._line,0)),this._input=r;const u=this._line,l=r[0];let d="",h="",p="",f=null,y=0,g=!1;switch(l){case"^":if(r.length<3)break;if("^"!==r[1]){this._n3Mode&&(y=1,d="^");break}if(this._previousMarker="^^",r=r.substr(2),"<"!==r[0]){g=!0;break}case"<":if(f=this._unescapedIri.exec(r))d="IRI",h=f[1];else if(f=this._iri.exec(r)){if(h=this._unescape(f[1]),null===h||c.test(h))return a(this);d="IRI"}else r.length>1&&"<"===r[1]?(d="<<",y=2):this._n3Mode&&r.length>1&&"="===r[1]&&(d="inverse",y=2,h=">");break;case">":r.length>1&&">"===r[1]&&(d=">>",y=2);break;case"_":((f=this._blank.exec(r))||t&&(f=this._blank.exec(`${r} `)))&&(d="blank",p="_",h=f[1]);break;case'"':if(f=this._simpleQuotedString.exec(r))h=f[1];else if(({value:h,matchLength:y}=this._parseLiteral(r)),null===h)return a(this);null===f&&0===y||(d="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(f=this._simpleApostropheString.exec(r))h=f[1];else if(({value:h,matchLength:y}=this._parseLiteral(r)),null===h)return a(this);null===f&&0===y||(d="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(f=this._variable.exec(r))&&(d="var",h=f[0]);break;case"@":"literal"===this._previousMarker&&(f=this._langcode.exec(r))?(d="langcode",h=f[1]):(f=this._keyword.exec(r))&&(d=f[0]);break;case".":if(1===r.length?t:r[1]<"0"||r[1]>"9"){d=".",y=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(f=this._number.exec(r)||t&&(f=this._number.exec(`${r} `)))&&(d="literal",h=f[0],p="string"==typeof f[1]?o.double:"string"==typeof f[2]?o.decimal:o.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(f=this._sparqlKeyword.exec(r))?d=f[0].toUpperCase():g=!0;break;case"f":case"t":(f=this._boolean.exec(r))?(d="literal",h=f[0],p=o.boolean):g=!0;break;case"a":(f=this._shortPredicates.exec(r))?(d="abbreviation",h="a"):g=!0;break;case"=":this._n3Mode&&r.length>1&&(d="abbreviation",">"!==r[1]?(y=1,h="="):(y=2,h=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(y=1,d=l);break;case"{":!this._lineMode&&r.length>=2&&("|"===r[1]?(d="{|",y=2):(d=l,y=1));break;case"|":r.length>=2&&"}"===r[1]&&(d="|}",y=2);break;default:g=!0}if(g&&("@prefix"!==this._previousMarker&&"PREFIX"!==this._previousMarker||!(f=this._prefix.exec(r))?((f=this._prefixed.exec(r))||t&&(f=this._prefixed.exec(`${r} `)))&&(d="prefixed",p=f[1]||"",h=this._unescape(f[2])):(d="prefix",h=f[1]||"")),"^^"===this._previousMarker)switch(d){case"prefixed":d="type";break;case"IRI":d="typeIRI";break;default:d=""}if(!d)return t||!/^'''|^"""/.test(r)&&/\n|\r/.test(r)?a(this):this._input=r;const m=y||f[0].length,b=i(d,h,p,u,m);this.previousToken=b,this._previousMarker=d,r=r.substr(m,r.length)}function i(t,i,a,o,s){const u=r?n-r.length:n,c={type:t,value:i,prefix:a,line:o,start:u,end:u+s};return e(null,c),c}function a(t){e(t._syntaxError(/^\S*/.exec(r)[0]))}}_unescape(e){let t=!1;const r=e.replace(s,((e,r,n,i)=>{if("string"==typeof r)return String.fromCharCode(Number.parseInt(r,16));if("string"==typeof n){let e=Number.parseInt(n,16);return e<=65535?String.fromCharCode(Number.parseInt(n,16)):String.fromCharCode(55296+((e-=65536)>>10),56320+(1023&e))}return i in u?u[i]:(t=!0,"")}));return t?null:r}_parseLiteral(e){if(e.length>=3){const t=e.match(/^(?:"""|"|'''|'|)/)[0],r=t.length;let n=Math.max(this._literalClosingPos,r);for(;(n=e.indexOf(t,n))>0;){let t=0;for(;"\\"===e[n-t-1];)t++;if(t%2==0){const t=e.substring(r,n),i=t.split(/\r\n|\r|\n/).length-1,a=n+r;if(1===r&&0!==i||3===r&&this._lineMode)break;return this._line+=i,{value:this._unescape(t),matchLength:a}}n++}this._literalClosingPos=e.length-r+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(e,t){if(this._line=1,"string"==typeof e){if(this._input=this._readStartingBom(e),"function"!=typeof t){const e=[];let t;if(this._tokenizeToEnd(((r,n)=>r?t=r:e.push(n)),!0),t)throw t;return e}a()((()=>this._tokenizeToEnd(t,!0)))}else this._pendingBuffer=null,"function"==typeof e.setEncoding&&e.setEncoding("utf8"),e.on("data",(e=>{null!==this._input&&0!==e.length&&(this._pendingBuffer&&(e=Buffer.concat([this._pendingBuffer,e]),this._pendingBuffer=null),128&e[e.length-1]?this._pendingBuffer=e:(void 0===this._input?this._input=this._readStartingBom("string"==typeof e?e:e.toString()):this._input+=e,this._tokenizeToEnd(t,!1)))})),e.on("end",(()=>{"string"==typeof this._input&&this._tokenizeToEnd(t,!0)})),e.on("error",t)}}},33291:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(3524),i=r(28612),a=r(65852);let o=0;class s{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&c(this,e.factory);const t="string"==typeof e.format?e.format.match(/\w*$/)[0].toLowerCase():"",r=/turtle/.test(t),i=/trig/.test(t),a=/triple/.test(t),o=/quad/.test(t),s=this._n3Mode=/n3/.test(t),u=a||o;(this._supportsNamedGraphs=!(r||s))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(r||i||a||s),this._supportsRDFStar=""===t||/star|\*$/.test(t),u&&(this._resolveRelativeIRI=e=>null),this._blankNodePrefix="string"!=typeof e.blankNodePrefix?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new n.A({lineMode:u,n3:s}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){o=0}_setBase(e){if(e){const t=e.indexOf("#");t>=0&&(e=e.substr(0,t)),this._base=e,this._basePath=e.indexOf("/")<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,""),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}else this._base="",this._basePath=""}_saveContext(e,t,r,n,i){const a=this._n3Mode;this._contextStack.push({type:e,subject:r,predicate:n,object:i,graph:t,inverse:!!a&&this._inversePredicate,blankPrefix:a?this._prefixes._:"",quantified:a?this._quantified:null}),a&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(e,t){const r=this._contextStack.pop();if(!r||r.type!==e)return this._error(`Unexpected ${t.type}`,t);this._subject=r.subject,this._predicate=r.predicate,this._object=r.object,this._graph=r.graph,this._n3Mode&&(this._inversePredicate=r.inverse,this._prefixes._=r.blankPrefix,this._quantified=r.quantified)}_readInTopContext(e){switch(e.type){case"eof":return null!==this._graph?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_readEntity(e,t){let r;switch(e.type){case"IRI":case"typeIRI":const t=this._resolveIRI(e.value);if(null===t)return this._error("Invalid IRI",e);r=this._namedNode(t);break;case"type":case"prefixed":const n=this._prefixes[e.prefix];if(void 0===n)return this._error(`Undefined prefix "${e.prefix}:"`,e);r=this._namedNode(n+e.value);break;case"blank":r=this._blankNode(this._prefixes[e.prefix]+e.value);break;case"var":r=this._variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!t&&this._n3Mode&&r.id in this._quantified&&(r=this._quantified[r.id]),r}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._blankNode(),null,null),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._blankNode(),null,null),this._readSubject):this._error("Unexpected graph",e);case"}":return this._readPunctuation(e);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier=this._blankNode,this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier=this._variable,this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(0===e.prefix.length)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._literal(e.value,this._namedNode(e.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",e);default:if(void 0===(this._subject=this._readEntity(e)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){const t=e.type;switch(t){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":case"]":case"}":return null===this._predicate?this._error(`Unexpected ${t}`,e):(this._subject=null,"]"===t?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",e);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if(void 0===(this._predicate=this._readEntity(e)))return}return this._readObject}_readObject(e){switch(e.type){case"literal":if(0===e.prefix.length)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._literal(e.value,this._namedNode(e.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._blankNode()),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",e);default:if(void 0===(this._object=this._readEntity(e)))return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return"{"===e.type?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return"{"!==e.type?this._error(`Expected graph but got ${e.type}`,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){return"]"===e.type?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if("]"!==e.type)return this._readBlankNodePunctuation(e);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);const t=null===this._predicate;return this._restoreContext("blank",e),null!==this._object?this._getContextEndReader():null!==this._predicate?this._readObject:t?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(e){switch(e.type){case".":case"}":return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let t=null,r=null,n=this._readListItem;const i=this._subject,a=this._contextStack,o=a[a.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,r=this._blankNode(),this.RDF_FIRST,this._subject=t=this._blankNode()),n=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,r=this._blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),0!==a.length&&"list"===a[a.length-1].type&&this._emit(this._subject,this._predicate,this._object,this._graph),null===this._predicate){if(n=this._readPredicate,this._subject===this.RDF_NIL)return n}else if(n=this._getContextEndReader(),this._object===this.RDF_NIL)return n;r=this.RDF_NIL;break;case"literal":0===e.prefix.length?(this._literalValue=e.value,n=this._readListItemDataTypeOrLang):(t=this._literal(e.value,this._namedNode(e.prefix)),n=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",e);default:if(void 0===(t=this._readEntity(e)))return}if(null===r&&(this._subject=r=this._blankNode()),null===i?null===o.predicate?o.subject=r:o.object=r:this._emit(i,this.RDF_REST,r,this._graph),null!==t){if(this._n3Mode&&("IRI"===e.type||"prefixed"===e.type))return this._saveContext("item",this._graph,r,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(r,this.RDF_FIRST,t,this._graph)}return n}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e){let t=this._literal(this._literalValue);switch(e.type){case"type":case"typeIRI":const r=this._readEntity(e);if(void 0===r)return;t=this._literal(this._literalValue,r),e=null;break;case"langcode":t=this._literal(this._literalValue,e.value),e=null}return{token:e,literal:t}}_completeSubjectLiteral(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(e,t){const r=this._completeLiteral(e);if(r)return this._object=r.literal,t&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),null===r.token?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(r.token))}_readFormulaTail(e){return"}"!==e.type?this._readPunctuation(e):(null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",e),null===this._object?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let t,r=this._graph;const n=this._subject,i=this._inversePredicate;switch(e.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,t=this._contextStack.length?this._readSubject:this._readInTopContext,i&&(this._inversePredicate=!1);break;case";":t=this._readPredicate;break;case",":t=this._readObject;break;case"{|":if(!this._supportsRDFStar)return this._error("Unexpected RDF* syntax",e);const a=this._predicate,o=this._object;this._subject=this._quad(n,a,o,this.DEFAULTGRAPH),t=this._readPredicate;break;case"|}":if("Quad"!==this._subject.termType)return this._error("Unexpected asserted triple closing",e);this._subject=null,t=this._readPunctuation;break;default:if(this._supportsQuads&&null===this._graph&&void 0!==(r=this._readEntity(e))){t=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(null!==n){const e=this._predicate,t=this._object;i?this._emit(t,e,n,r):this._emit(n,e,t,r)}return t}_readBlankNodePunctuation(e){let t;switch(e.type){case";":t=this._readPredicate;break;case",":t=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emit(this._subject,this._predicate,this._object,this._graph),t}_readQuadPunctuation(e){return"."!==e.type?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return"prefix"!==e.type?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if("IRI"!==e.type)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);const t=this._readEntity(e);return this._prefixes[this._prefix]=t.value,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation}_readBaseIRI(e){const t="IRI"===e.type&&this._resolveIRI(e.value);return t?(this._setBase(t),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",e)}_readNamedGraphLabel(e){switch(e.type){case"IRI":case"blank":case"prefixed":return this._readSubject(e),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",e)}}_readNamedGraphBlankLabel(e){return"]"!==e.type?this._error("Invalid graph label",e):(this._subject=this._blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):"."!==e.type?this._error("Expected declaration to end with a dot",e):this._readInTopContext}_readQuantifierList(e){let t;switch(e.type){case"IRI":case"prefixed":if(void 0!==(t=this._readEntity(e,!0)))break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(null===this._subject?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,t,this.QUANTIFIERS_GRAPH)):this._quantified[t.id]=this._quantifier(this._blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return","===e.type?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const t=this._contextStack,r=t.length&&t[t.length-1];if(r&&"item"===r.type){const t=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,t,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let t,r;const n=this._blankNode();if(void 0!==(r=this._readEntity(e)))return null===this._predicate?(t=this._subject,this._subject=n):(t=this._object,this._object=n),this._emit(t,r,n,this._graph),this._readPath}_readBackwardPath(e){const t=this._blankNode();let r,n;if(void 0!==(r=this._readEntity(e)))return null===this._predicate?(n=this._subject,this._subject=t):(n=this._object,this._object=t),this._emit(t,r,n,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return">>"!==e.type?this._supportsQuads&&null===this._graph&&void 0!==(this._graph=this._readEntity(e))?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,e):this._readRDFStarTail(e)}_readRDFStarTail(e){if(">>"!==e.type)return this._error(`Expected >> but got ${e.type}`,e);const t=this._quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",e),null===this._subject?(this._subject=t,this._readPredicate):(this._object=t,this._getContextEndReader())}_getContextEndReader(){const e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(e,t,r,n){this._callback(null,this._quad(e,t,r,n||this.DEFAULTGRAPH))}_error(e,t){const r=new Error(`${e} on line ${t.line}.`);r.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(r),this._callback=u}_resolveIRI(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return("/"===e[1]?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;const t=e.length;let r="",n=-1,i=-1,a=0,o="/";for(;n=i&&(r=r.substr(0,a)),"/"!==o)return`${r}/${e.substr(n+1)}`;a=n+1}}}o=e[++n]}return r+e.substring(a)}parse(e,t,r){if(this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${o++}_`,this._prefixCallback=r||u,this._inversePredicate=!1,this._quantified=Object.create(null),!t){const t=[];let r;if(this._callback=(e,n)=>{e?r=e:n&&t.push(n)},this._lexer.tokenize(e).every((e=>this._readCallback=this._readCallback(e))),r)throw r;return t}this._callback=t,this._lexer.tokenize(e,((e,t)=>{null!==e?(this._callback(e),this._callback=u):this._readCallback&&(this._readCallback=this._readCallback(t))}))}}function u(){}function c(e,t){const r=t.namedNode;e._namedNode=r,e._blankNode=t.blankNode,e._literal=t.literal,e._variable=t.variable,e._quad=t.quad,e.DEFAULTGRAPH=t.defaultGraph(),e.RDF_FIRST=r(a.A.rdf.first),e.RDF_REST=r(a.A.rdf.rest),e.RDF_NIL=r(a.A.rdf.nil),e.N3_FORALL=r(a.A.r.forAll),e.N3_FORSOME=r(a.A.r.forSome),e.ABBREVIATIONS={a:r(a.A.rdf.type),"=":r(a.A.owl.sameAs),">":r(a.A.log.implies)},e.QUANTIFIERS_GRAPH=r("urn:n3:quantifiers")}c(s.prototype,i.Ay)},30611:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(28612),i=r(19198),a=r(65852),o=r(69980);class s{constructor(e,t){this._size=0,this._graphs=Object.create(null),this._id=0,this._ids=Object.create(null),this._entities=Object.create(null),this._blankNodeIndex=0,t||!e||e[0]||(t=e,e=null),t=t||{},this._factory=t.factory||n.Ay,e&&this.addQuads(e)}_termFromId(e,t){if("."===e[0]){const t=this._entities,r=e.split(".");return this._factory.quad(this._termFromId(t[r[1]]),this._termFromId(t[r[2]]),this._termFromId(t[r[3]]),r[4]&&this._termFromId(t[r[4]]))}return(0,n.iN)(e,t)}_termToNumericId(e){if("Quad"===e.termType){const t=this._termToNumericId(e.subject),r=this._termToNumericId(e.predicate),n=this._termToNumericId(e.object);let i;return t&&r&&n&&((0,o.isDefaultGraph)(e.graph)||(i=this._termToNumericId(e.graph)))&&this._ids[i?`.${t}.${r}.${n}.${i}`:`.${t}.${r}.${n}`]}return this._ids[(0,n.FL)(e)]}_termToNewNumericId(e){const t=e&&"Quad"===e.termType?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${(0,o.isDefaultGraph)(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:(0,n.FL)(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}get size(){let e=this._size;if(null!==e)return e;e=0;const t=this._graphs;let r,n;for(const i in t)for(const a in r=t[i].subjects)for(const t in n=r[a])e+=Object.keys(n[t]).length;return this._size=e}_addToIndex(e,t,r,n){const i=e[t]||(e[t]={}),a=i[r]||(i[r]={}),o=n in a;return o||(a[n]=null),!o}_removeFromIndex(e,t,r,n){const i=e[t],a=i[r];delete a[n];for(const e in a)return;delete i[r];for(const e in i)return;delete e[t]}*_findInIndex(e,t,r,n,i,a,o,s){let u,c,l;const d=this._entities,h=this._termFromId(s,this._factory),p={subject:null,predicate:null,object:null};t&&((u=e,e={})[t]=u[t]);for(const t in e)if(c=e[t]){p[i]=this._termFromId(d[t],this._factory),r&&((u=c,c={})[r]=u[r]);for(const e in c)if(l=c[e]){p[a]=this._termFromId(d[e],this._factory);const t=n?n in l?[n]:[]:Object.keys(l);for(let e=0;e{r in t||(t[r]=!0,e(this._termFromId(this._entities[r],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,t,r,i){t||(i=e.graph,r=e.object,t=e.predicate,e=e.subject),i=(0,n.FL)(i);let a=this._graphs[i];a||(a=this._graphs[i]={subjects:{},predicates:{},objects:{}},Object.freeze(a)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),r=this._termToNewNumericId(r);const o=this._addToIndex(a.subjects,e,t,r);return this._addToIndex(a.predicates,t,r,e),this._addToIndex(a.objects,r,e,t),this._size=null,o}addQuads(e){for(let t=0;t{this.addQuad(e)})),e}removeQuad(e,t,r,i){t||(i=e.graph,r=e.object,t=e.predicate,e=e.subject),i=(0,n.FL)(i);const a=this._graphs;let o,s,u;if(!((e=e&&this._termToNumericId(e))&&(t=t&&this._termToNumericId(t))&&(r=r&&this._termToNumericId(r))&&(o=a[i])&&(s=o.subjects[e])&&(u=s[t])&&r in u))return!1;for(e in this._removeFromIndex(o.subjects,e,t,r),this._removeFromIndex(o.predicates,t,r,e),this._removeFromIndex(o.objects,r,e,t),null!==this._size&&this._size--,o.subjects)return!0;return delete a[i],!0}removeQuads(e){for(let t=0;t{this.removeQuad(e)})),e}removeMatches(e,t,r,n){const a=new i.Readable({objectMode:!0});return a._read=()=>{for(const i of this.readQuads(e,t,r,n))a.push(i);a.push(null)},this.remove(a)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,r,n){return[...this.readQuads(e,t,r,n)]}*readQuads(e,t,r,i){i=i&&(0,n.FL)(i);const a=this._getGraphs(i);let o,s,u,c;if(!(e&&!(s=this._termToNumericId(e))||t&&!(u=this._termToNumericId(t))||r&&!(c=this._termToNumericId(r))))for(const e in a)(o=a[e])&&(s?c?yield*this._findInIndex(o.objects,c,s,u,"object","subject","predicate",e):yield*this._findInIndex(o.subjects,s,u,null,"subject","predicate","object",e):u?yield*this._findInIndex(o.predicates,u,c,null,"predicate","object","subject",e):c?yield*this._findInIndex(o.objects,c,null,null,"object","subject","predicate",e):yield*this._findInIndex(o.subjects,null,null,null,"subject","predicate","object",e))}match(e,t,r,n){return new u(this,e,t,r,n)}countQuads(e,t,r,i){i=i&&(0,n.FL)(i);const a=this._getGraphs(i);let o,s,u,c,l=0;if(e&&!(s=this._termToNumericId(e))||t&&!(u=this._termToNumericId(t))||r&&!(c=this._termToNumericId(r)))return 0;for(const n in a)(o=a[n])&&(l+=e?r?this._countInIndex(o.objects,c,s,u):this._countInIndex(o.subjects,s,u,c):t?this._countInIndex(o.predicates,u,c,s):this._countInIndex(o.objects,c,s,u));return l}forEach(e,t,r,n,i){this.some((t=>(e(t),!1)),t,r,n,i)}every(e,t,r,n,i){let a=!1;const o=!this.some((t=>(a=!0,!e(t))),t,r,n,i);return a&&o}some(e,t,r,n,i){for(const a of this.readQuads(t,r,n,i))if(e(a))return!0;return!1}getSubjects(e,t,r){const n=[];return this.forSubjects((e=>{n.push(e)}),e,t,r),n}forSubjects(e,t,r,i){i=i&&(0,n.FL)(i);const a=this._getGraphs(i);let o,s,u;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||r&&!(u=this._termToNumericId(r))))for(i in a)(o=a[i])&&(s?u?this._loopBy2Keys(o.predicates,s,u,e):this._loopByKey1(o.subjects,s,e):u?this._loopByKey0(o.objects,u,e):this._loop(o.subjects,e))}getPredicates(e,t,r){const n=[];return this.forPredicates((e=>{n.push(e)}),e,t,r),n}forPredicates(e,t,r,i){i=i&&(0,n.FL)(i);const a=this._getGraphs(i);let o,s,u;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||r&&!(u=this._termToNumericId(r))))for(i in a)(o=a[i])&&(s?u?this._loopBy2Keys(o.objects,u,s,e):this._loopByKey0(o.subjects,s,e):u?this._loopByKey1(o.predicates,u,e):this._loop(o.predicates,e))}getObjects(e,t,r){const n=[];return this.forObjects((e=>{n.push(e)}),e,t,r),n}forObjects(e,t,r,i){i=i&&(0,n.FL)(i);const a=this._getGraphs(i);let o,s,u;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||r&&!(u=this._termToNumericId(r))))for(i in a)(o=a[i])&&(s?u?this._loopBy2Keys(o.subjects,s,u,e):this._loopByKey1(o.objects,s,e):u?this._loopByKey0(o.predicates,u,e):this._loop(o.objects,e))}getGraphs(e,t,r){const n=[];return this.forGraphs((e=>{n.push(e)}),e,t,r),n}forGraphs(e,t,r,n){for(const i in this._graphs)this.some((t=>(e(t.graph),!0)),t,r,n,i)}createBlankNode(e){let t,r;if(e)for(t=e=`_:${e}`,r=1;this._ids[t];)t=e+r++;else do{t="_:b"+this._blankNodeIndex++}while(this._ids[t]);return this._ids[t]=++this._id,this._entities[this._id]=t,this._factory.blankNode(t.substr(2))}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const r={},n=t?()=>!0:(e,t)=>{throw new Error(`${e.value} ${t}`)},i=this.getQuads(null,a.A.rdf.rest,a.A.rdf.nil,null),o=e?[...i]:[];return i.forEach((t=>{const i=[];let s,u,c=!1;const l=t.graph;let d=t.subject;for(;d&&!c;){const e=this.getQuads(null,null,d,null),t=this.getQuads(d,null,null,null);let r,h=null,p=null,f=null;for(let i=0;i{"use strict";r.d(t,{A:()=>a});var n=r(33291),i=r(19198);class a extends i.Transform{constructor(e){let t,r;super({decodeStrings:!0}),this._readableState.objectMode=!0,new n.A(e).parse({on:(e,n)=>{switch(e){case"data":t=n;break;case"end":r=n}}},((e,t)=>{e&&this.emit("error",e)||t&&this.push(t)}),((e,t)=>{this.emit("prefix",e,t)})),this._transform=(e,r,n)=>{t(e),n()},this._flush=e=>{r(),e()}}import(e){return e.on("data",(e=>{this.write(e)})),e.on("end",(()=>{this.end()})),e.on("error",(e=>{this.emit("error",e)})),this}}},69980:(e,t,r)=>{"use strict";r.r(t),r.d(t,{inDefaultGraph:()=>c,isBlankNode:()=>a,isDefaultGraph:()=>u,isLiteral:()=>o,isNamedNode:()=>i,isVariable:()=>s,prefix:()=>l,prefixes:()=>d});var n=r(28612);function i(e){return!!e&&"NamedNode"===e.termType}function a(e){return!!e&&"BlankNode"===e.termType}function o(e){return!!e&&"Literal"===e.termType}function s(e){return!!e&&"Variable"===e.termType}function u(e){return!!e&&"DefaultGraph"===e.termType}function c(e){return u(e.graph)}function l(e,t){return d({"":e.value||e},t)("")}function d(e,t){const r=Object.create(null);for(const t in e)i(t,e[t]);function i(e,n){if("string"==typeof n){const i=Object.create(null);r[e]=e=>i[e]||(i[e]=t.namedNode(n+e))}else if(!(e in r))throw new Error(`Unknown prefix: ${e}`);return r[e]}return t=t||n.Ay,i}},86987:(e,t,r)=>{"use strict";r.d(t,{A:()=>p});var n=r(65852),i=r(28612),a=r(69980);const o=i.Ay.defaultGraph(),{rdf:s,xsd:u}=n.A,c=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,l=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,d={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class h extends i.x1{equals(e){return e===this}}class p{constructor(e,t){if(this._prefixRegex=/$0^/,e&&"function"!=typeof e.write&&(t=e,e=null),t=t||{},this._lists=t.lists,e)this._outputStream=e,this._endStream=void 0===t.end||!!t.end;else{let e="";this._outputStream={write(t,r,n){e+=t,n&&n()},end:t=>{t&&t(null,e)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=o,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseMatcher=new RegExp(`^${y(t.baseIRI)}${t.baseIRI.endsWith("/")?"":"[#?]"}`),this._baseLength=t.baseIRI.length))}get _inDefaultGraph(){return o.equals(this._graph)}_write(e,t){this._outputStream.write(e,"utf8",t)}_writeQuad(e,t,r,n,i){try{n.equals(this._graph)||(this._write((null===this._subject?"":this._inDefaultGraph?".\n":"\n}\n")+(o.equals(n)?"":`${this._encodeIriOrBlank(n)} {\n`)),this._graph=n,this._subject=null),e.equals(this._subject)?t.equals(this._predicate)?this._write(`, ${this._encodeObject(r)}`,i):this._write(`;\n ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(r)}`,i):this._write(`${(null===this._subject?"":".\n")+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(r)}`,i)}catch(e){i&&i(e)}}_writeQuadLine(e,t,r,n,i){delete this._prefixMatch,this._write(this.quadToString(e,t,r,n),i)}quadToString(e,t,r,n){return`${this._encodeSubject(e)} ${this._encodeIriOrBlank(t)} ${this._encodeObject(r)}${n&&n.value?` ${this._encodeIriOrBlank(n)} .\n`:" .\n"}`}quadsToString(e){return e.map((e=>this.quadToString(e.subject,e.predicate,e.object,e.graph))).join("")}_encodeSubject(e){return"Quad"===e.termType?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if("NamedNode"!==e.termType)return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:`_:${e.value}`;let t=e.value;this._baseMatcher&&this._baseMatcher.test(t)&&(t=t.substr(this._baseLength)),c.test(t)&&(t=t.replace(l,f));const r=this._prefixRegex.exec(t);return r?r[1]?this._prefixIRIs[r[1]]+r[2]:t:`<${t}>`}_encodeLiteral(e){let t=e.value;if(c.test(t)&&(t=t.replace(l,f)),e.language)return`"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===u.string)return`"${t}"`}else switch(e.datatype.value){case u.string:return`"${t}"`;case u.boolean:if("true"===t||"false"===t)return t;break;case u.integer:if(/^[+-]?\d+$/.test(t))return t;break;case u.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case u.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t}return`"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===s.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:t,object:r,graph:n}){return`<<${this._encodeSubject(e)} ${this._encodePredicate(t)} ${this._encodeObject(r)}${(0,a.isDefaultGraph)(n)?"":` ${this._encodeIriOrBlank(n)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,t,r,n,i){void 0===r?this._writeQuad(e.subject,e.predicate,e.object,e.graph,t):"function"==typeof n?this._writeQuad(e,t,r,o,n):this._writeQuad(e,t,r,n||o,i)}addQuads(e){for(let t=0;t.\n`)}if(r){let e="",t="";for(const r in this._prefixIRIs)e+=e?`|${r}`:r,t+=(t?"|":"")+this._prefixIRIs[r];e=y(e),this._prefixRegex=new RegExp(`^(?:${t})[^/]*$|^(${e})([_a-zA-Z][\\-_a-zA-Z0-9]*)$`)}this._write(r?"\n":"",t)}blank(e,t){let r,n,i=e;switch(void 0===e?i=[]:e.termType?i=[{predicate:e,object:t}]:"length"in e||(i=[e]),n=i.length){case 0:return new h("[]");case 1:if(r=i[0],!(r.object instanceof h))return new h(`[ ${this._encodePredicate(r.predicate)} ${this._encodeObject(r.object)} ]`);default:let t="[";for(let a=0;a{t=null,e(r,n)});if(this._endStream)try{return this._outputStream.end(t)}catch(e){}t&&t()}}function f(e){let t=d[e];return void 0===t&&(1===e.length?(t=e.charCodeAt(0).toString(16),t="\\u0000".substr(0,6-t.length)+t):(t=(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)+9216).toString(16),t="\\U00000000".substr(0,10-t.length)+t)),t}function y(e){return e.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}},29014:(e,t,r)=>{"use strict";r.r(t),r.d(t,{BlankNode:()=>d.PB,DataFactory:()=>d.Ay,DefaultGraph:()=>d.yV,Lexer:()=>n.A,Literal:()=>d.uS,NamedNode:()=>d.Yo,Parser:()=>i.A,Quad:()=>d.kO,Store:()=>o.A,StreamParser:()=>s.A,StreamWriter:()=>c,Term:()=>d.x1,Triple:()=>d.n7,Util:()=>l,Variable:()=>d.rT,Writer:()=>a.A,default:()=>h,termFromId:()=>d.iN,termToId:()=>d.FL});var n=r(3524),i=r(33291),a=r(86987),o=r(30611),s=r(66731),u=r(19198);class c extends u.Transform{constructor(e){super({encoding:"utf8",writableObjectMode:!0});const t=this._writer=new a.A({write:(e,t,r)=>{this.push(e),r&&r()},end:e=>{this.push(null),e&&e()}},e);this._transform=(e,r,n)=>{t.addQuad(e,n)},this._flush=e=>{t.end(e)}}import(e){return e.on("data",(e=>{this.write(e)})),e.on("end",(()=>{this.end()})),e.on("error",(e=>{this.emit("error",e)})),e.on("prefix",((e,t)=>{this._writer.addPrefix(e,t)})),this}}var l=r(69980),d=r(28612);const h={Lexer:n.A,Parser:i.A,Writer:a.A,Store:o.A,StreamParser:s.A,StreamWriter:c,Util:l,DataFactory:d.Ay,Term:d.x1,NamedNode:d.Yo,Literal:d.uS,BlankNode:d.PB,Variable:d.rT,DefaultGraph:d.yV,Quad:d.kO,Triple:d.n7,termFromId:d.iN,termToId:d.FL}},65606:e=>{var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var s,u=[],c=!1,l=-1;function d(){c&&s&&(c=!1,s.length?u=s.concat(u):l=-1,u.length&&h())}function h(){if(!c){var e=o(d);c=!0;for(var t=u.length;t;){for(s=u,u=[];++l1)for(var r=1;r{!function(){var t;t="object"==typeof window&&window?window:r.g,e.exports?e.exports=t.Promise?t.Promise:o:t.Promise||(t.Promise=o);var n=t.setImmediate||function(e){setTimeout(e,1)};function i(e,t){return function(){e.apply(t,arguments)}}var a=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],h(e,i(u,this),i(c,this))}function s(e){var t=this;null!==this._state?n((function(){var r=t._state?e.onFulfilled:e.onRejected;if(null!==r){var n;try{n=r(t._value)}catch(t){return void e.reject(t)}e.resolve(n)}else(t._state?e.resolve:e.reject)(t._value)})):this._deferreds.push(e)}function u(e){try{if(e===this)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var t=e.then;if("function"==typeof t)return void h(i(t,e),i(u,this),i(c,this))}this._state=!0,this._value=e,l.call(this)}catch(e){c.call(this,e)}}function c(e){this._state=!1,this._value=e,l.call(this)}function l(){for(var e=0,t=this._deferreds.length;e{let n;e.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:r.g):e=>(n||(n=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)))},60989:(e,t,r)=>{e.exports=r(64005)},32985:e=>{"use strict";e.exports=class e{constructor(e,t=new Map,r=0){this.prefix=e,this._existing=t,this.counter=r}clone(){const{prefix:t,_existing:r,counter:n}=this;return new e(t,new Map(r),n)}getId(e){const t=e&&this._existing.get(e);if(t)return t;const r=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,r),r}hasId(e){return this._existing.has(e)}getOldIds(){return[...this._existing.keys()]}}},23751:(e,t,r)=>{"use strict";r(42791);const n=self.crypto||self.msCrypto;e.exports=class{constructor(e){if(!n||!n.subtle)throw new Error("crypto.subtle not found.");if("sha256"===e)this.algorithm={name:"SHA-256"};else{if("sha1"!==e)throw new Error(`Unsupported 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 n.subtle.digest(this.algorithm,e));let r="";for(let e=0;e{"use strict";const t="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",r="http://www.w3.org/2001/XMLSchema#string",n="NamedNode",i="BlankNode",a="Literal",o="DefaultGraph",s={};(()=>{const e="(?:<([^:]+:[^>]*)>)",t="A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_",r=t+"0-9-·̀-ͯ‿-⁀",n="(_:(?:["+t+"0-9])(?:(?:["+r+".])*(?:["+r+"]))?)",i="[ \\t]+",a="[ \\t]*",o="(?:"+e+"|"+n+")"+i,u=e+i,c="(?:"+e+"|"+n+'|(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?:(?:\\^\\^'+e+")|(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)))?))"+a,l="(?:\\.|(?:(?:"+e+"|"+n+")"+a+"\\.))";s.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,s.empty=new RegExp("^"+a+"$"),s.quad=new RegExp("^"+a+o+u+c+l+a+"$")})(),e.exports=class e{static parse(e){const u=[],l={},d=e.split(s.eoln);let h=0;for(const e of d){if(h++,s.empty.test(e))continue;const d=e.match(s.quad);if(null===d)throw new Error("N-Quads parse error on line "+h+".");const y={subject:null,predicate:null,object:null,graph:null};if(void 0!==d[1]?y.subject={termType:n,value:d[1]}:y.subject={termType:i,value:d[2]},y.predicate={termType:n,value:d[3]},void 0!==d[4]?y.object={termType:n,value:d[4]}:void 0!==d[5]?y.object={termType:i,value:d[5]}:(y.object={termType:a,value:void 0,datatype:{termType:n}},void 0!==d[7]?y.object.datatype.value=d[7]:void 0!==d[8]?(y.object.datatype.value=t,y.object.language=d[8]):y.object.datatype.value=r,y.object.value=d[6].replace(c,(function(e,t,r,n){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(r)return String.fromCharCode(parseInt(r,16));if(n)throw new Error("Unsupported U escape")}))),void 0!==d[9]?y.graph={termType:n,value:d[9]}:void 0!==d[10]?y.graph={termType:i,value:d[10]}:y.graph={termType:o,value:""},y.graph.value in l){let e=!0;const t=l[y.graph.value];for(const r of t)if(f=y,(p=r).subject.termType===f.subject.termType&&p.object.termType===f.object.termType&&p.subject.value===f.subject.value&&p.predicate.value===f.predicate.value&&p.object.value===f.object.value&&(p.object.termType!==a||p.object.datatype.termType===f.object.datatype.termType&&p.object.language===f.object.language&&p.object.datatype.value===f.object.datatype.value)){e=!1;break}e&&(t.push(y),u.push(y))}else l[y.graph.value]=[y],u.push(y)}var p,f;return u}static serialize(t){Array.isArray(t)||(t=e.legacyDatasetToQuads(t));const r=[];for(const n of t)r.push(e.serializeQuad(n));return r.sort().join("")}static serializeQuadComponents(e,a,o,s){let c="";return e.termType===n?c+=`<${e.value}>`:c+=`${e.value}`,c+=` <${a.value}> `,o.termType===n?c+=`<${o.value}>`:o.termType===i?c+=o.value:(c+=`"${function(e){return e.replace(u,(function(e){switch(e){case'"':return'\\"';case"\\":return"\\\\";case"\n":return"\\n";case"\r":return"\\r"}}))}(o.value)}"`,o.datatype.value===t?o.language&&(c+=`@${o.language}`):o.datatype.value!==r&&(c+=`^^<${o.datatype.value}>`)),s.termType===n?c+=` <${s.value}>`:s.termType===i&&(c+=` ${s.value}`),c+=" .\n",c}static serializeQuad(t){return e.serializeQuadComponents(t.subject,t.predicate,t.object,t.graph)}static legacyDatasetToQuads(e){const s=[],u={"blank node":i,IRI:n,literal:a};for(const c in e)e[c].forEach((e=>{const l={};for(const i in e){const o=e[i],s={termType:u[o.type],value:o.value};s.termType===a&&(s.datatype={termType:n},"datatype"in o&&(s.datatype.value=o.datatype),"language"in o?("datatype"in o||(s.datatype.value=t),s.language=o.language):"datatype"in o||(s.datatype.value=r)),l[i]=s}l.graph="@default"===c?{termType:o,value:""}:{termType:c.startsWith("_:")?i:n,value:c},s.push(l)}));return s}};const u=/["\\\n\r]/g,c=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g},29925:e=>{"use strict";e.exports=class{constructor(e){this.current=e.sort(),this.done=!1,this.dir=new Map;for(let t=0;tn)&&(s&&r>0&&o>e[r-1]||!s&&re[r+1])&&(n=o,i=r)}if(null===n)this.done=!0;else{const r=t.get(n)?i-1:i+1;e[i]=e[r],e[r]=n;for(const r of e)r>n&&t.set(r,!t.get(r))}return r}}},43513:(e,t,r)=>{"use strict";const n=r(32985),i=r(23751),a=r(29925),o=r(11227);function s(e,t){return e.hasht.hash?1:0}e.exports=class{constructor({createMessageDigest:e=(()=>new i("sha256")),canonicalIdMap:t=new Map,maxDeepIterations:r=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new n("_:c14n",t),this.createMessageDigest=e,this.maxDeepIterations=r,this.quads=null,this.deepIterations=null}async main(e){this.deepIterations=new Map,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,r=[...this.blankNodeInfo.keys()];let i=0;for(const e of r)++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 r=t.get(e);if(r.length>1){u.push(r);continue}const n=r[0];this.canonicalIssuer.getId(n)}for(const e of u){const t=[];for(const r of e){if(this.canonicalIssuer.hasId(r))continue;const e=new n("_:b");e.getId(r);const i=await this.hashNDegreeQuads(r,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=o.serializeQuadComponents(this._componentWithCanonicalId(e.subject),e.predicate,this._componentWithCanonicalId(e.object),this._componentWithCanonicalId(e.graph));c.push(t)}return c.sort(),c.join("")}async hashFirstDegreeQuads(e){const t=[],r=this.blankNodeInfo.get(e),n=r.quads;for(const r of n){const n={subject:null,predicate:r.predicate,object:null,graph:null};n.subject=this.modifyFirstDegreeComponent(e,r.subject,"subject"),n.object=this.modifyFirstDegreeComponent(e,r.object,"object"),n.graph=this.modifyFirstDegreeComponent(e,r.graph,"graph"),t.push(o.serializeQuad(n))}t.sort();const i=this.createMessageDigest();for(const e of t)i.update(e);return r.hash=await i.digest(),r.hash}async hashRelatedBlankNode(e,t,r,n){let i;i=this.canonicalIssuer.hasId(e)?this.canonicalIssuer.getId(e):r.hasId(e)?r.getId(e):this.blankNodeInfo.get(e).hash;const a=this.createMessageDigest();return a.update(n),"g"!==n&&a.update(this.getRelatedPredicate(t)),a.update(i),a.digest()}async hashNDegreeQuads(e,t){const r=this.deepIterations.get(e)||0;if(r>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(e,r+1);const n=this.createMessageDigest(),i=await this.createHashToRelated(e,t),o=[...i.keys()].sort();for(const e of o){n.update(e);let r,o="";const s=new a(i.get(e));let u=0;for(;s.hasNext();){const e=s.next();++u%3==0&&await this._yield();let n=t.clone(),i="";const a=[];let c=!1;for(const t of e)if(this.canonicalIssuer.hasId(t)?i+=this.canonicalIssuer.getId(t):(n.hasId(t)||a.push(t),i+=n.getId(t)),0!==o.length&&i>o){c=!0;break}if(!c){for(const e of a){const t=await this.hashNDegreeQuads(e,n);if(i+=n.getId(e),i+=`<${t.hash}>`,n=t.issuer,0!==o.length&&i>o){c=!0;break}}c||(0===o.length||i`}async createHashToRelated(e,t){const r=new Map,n=this.blankNodeInfo.get(e).quads;let i=0;for(const a of n)++i%100==0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:a,component:a.subject,position:"s",id:e,issuer:t,hashToRelated:r}),this._addRelatedBlankNodeHash({quad:a,component:a.object,position:"o",id:e,issuer:t,hashToRelated:r}),this._addRelatedBlankNodeHash({quad:a,component:a.graph,position:"g",id:e,issuer:t,hashToRelated:r})]);return r}async _hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){const r=await this.hashFirstDegreeQuads(e),n=t.get(r);n?n.push(e):t.set(r,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if("BlankNode"!==t.termType)return;const r=t.value,n=this.blankNodeInfo.get(r);n?n.quads.add(e):this.blankNodeInfo.set(r,{quads:new Set([e]),hash:null})}async _addRelatedBlankNodeHash({quad:e,component:t,position:r,id:n,issuer:i,hashToRelated:a}){if("BlankNode"!==t.termType||t.value===n)return;const o=t.value,s=await this.hashRelatedBlankNode(o,e,i,r),u=a.get(s);u?u.push(o):a.set(s,[o])}_componentWithCanonicalId(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=>setImmediate(e)))}}},62438:(e,t,r)=>{"use strict";const n=r(32985),i=r(23751),a=r(29925),o=r(11227);function s(e,t){return e.hasht.hash?1:0}e.exports=class{constructor({createMessageDigest:e=(()=>new i("sha256")),canonicalIdMap:t=new Map,maxDeepIterations:r=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new n("_:c14n",t),this.createMessageDigest=e,this.maxDeepIterations=r,this.quads=null,this.deepIterations=null}main(e){this.deepIterations=new Map,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,r=[...this.blankNodeInfo.keys()];for(const e of r)this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});const i=[...t.keys()].sort(),a=[];for(const e of i){const r=t.get(e);if(r.length>1){a.push(r);continue}const n=r[0];this.canonicalIssuer.getId(n)}for(const e of a){const t=[];for(const r of e){if(this.canonicalIssuer.hasId(r))continue;const e=new n("_:b");e.getId(r);const i=this.hashNDegreeQuads(r,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=o.serializeQuadComponents(this._componentWithCanonicalId({component:e.subject}),e.predicate,this._componentWithCanonicalId({component:e.object}),this._componentWithCanonicalId({component:e.graph}));u.push(t)}return u.sort(),u.join("")}hashFirstDegreeQuads(e){const t=[],r=this.blankNodeInfo.get(e),n=r.quads;for(const r of n){const n={subject:null,predicate:r.predicate,object:null,graph:null};n.subject=this.modifyFirstDegreeComponent(e,r.subject,"subject"),n.object=this.modifyFirstDegreeComponent(e,r.object,"object"),n.graph=this.modifyFirstDegreeComponent(e,r.graph,"graph"),t.push(o.serializeQuad(n))}t.sort();const i=this.createMessageDigest();for(const e of t)i.update(e);return r.hash=i.digest(),r.hash}hashRelatedBlankNode(e,t,r,n){let i;i=this.canonicalIssuer.hasId(e)?this.canonicalIssuer.getId(e):r.hasId(e)?r.getId(e):this.blankNodeInfo.get(e).hash;const a=this.createMessageDigest();return a.update(n),"g"!==n&&a.update(this.getRelatedPredicate(t)),a.update(i),a.digest()}hashNDegreeQuads(e,t){const r=this.deepIterations.get(e)||0;if(r>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(e,r+1);const n=this.createMessageDigest(),i=this.createHashToRelated(e,t),o=[...i.keys()].sort();for(const e of o){n.update(e);let r,o="";const s=new a(i.get(e));for(;s.hasNext();){const e=s.next();let n=t.clone(),i="";const a=[];let u=!1;for(const t of e)if(this.canonicalIssuer.hasId(t)?i+=this.canonicalIssuer.getId(t):(n.hasId(t)||a.push(t),i+=n.getId(t)),0!==o.length&&i>o){u=!0;break}if(!u){for(const e of a){const t=this.hashNDegreeQuads(e,n);if(i+=n.getId(e),i+=`<${t.hash}>`,n=t.issuer,0!==o.length&&i>o){u=!0;break}}u||(0===o.length||i`}createHashToRelated(e,t){const r=new Map,n=this.blankNodeInfo.get(e).quads;for(const i of n)this._addRelatedBlankNodeHash({quad:i,component:i.subject,position:"s",id:e,issuer:t,hashToRelated:r}),this._addRelatedBlankNodeHash({quad:i,component:i.object,position:"o",id:e,issuer:t,hashToRelated:r}),this._addRelatedBlankNodeHash({quad:i,component:i.graph,position:"g",id:e,issuer:t,hashToRelated:r});return r}_hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){const r=this.hashFirstDegreeQuads(e),n=t.get(r);n?n.push(e):t.set(r,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if("BlankNode"!==t.termType)return;const r=t.value,n=this.blankNodeInfo.get(r);n?n.quads.add(e):this.blankNodeInfo.set(r,{quads:new Set([e]),hash:null})}_addRelatedBlankNodeHash({quad:e,component:t,position:r,id:n,issuer:i,hashToRelated:a}){if("BlankNode"!==t.termType||t.value===n)return;const o=t.value,s=this.hashRelatedBlankNode(o,e,i,r),u=a.get(s);u?u.push(o):a.set(s,[o])}_componentWithCanonicalId({component:e}){return"BlankNode"!==e.termType||e.value.startsWith(this.canonicalIssuer.prefix)?e:{termType:"BlankNode",value:this.canonicalIssuer.getId(e.value)}}}},93845:(e,t,r)=>{"use strict";const n=r(23751),i=r(43513);e.exports=class extends i{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new n("sha1")}modifyFirstDegreeComponent(e,t,r){return"BlankNode"!==t.termType?t:"graph"===r?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:t.value===e?"_:a":"_:z"}}getRelatedPredicate(e){return e.predicate.value}async createHashToRelated(e,t){const r=new Map,n=this.blankNodeInfo.get(e).quads;let i=0;for(const a of n){let n,o;if("BlankNode"===a.subject.termType&&a.subject.value!==e)o=a.subject.value,n="p";else{if("BlankNode"!==a.object.termType||a.object.value===e)continue;o=a.object.value,n="r"}++i%100==0&&await this._yield();const s=await this.hashRelatedBlankNode(o,a,t,n),u=r.get(s);u?u.push(o):r.set(s,[o])}return r}}},30378:(e,t,r)=>{"use strict";const n=r(23751),i=r(62438);e.exports=class extends i{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new n("sha1")}modifyFirstDegreeComponent(e,t,r){return"BlankNode"!==t.termType?t:"graph"===r?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:t.value===e?"_:a":"_:z"}}getRelatedPredicate(e){return e.predicate.value}createHashToRelated(e,t){const r=new Map,n=this.blankNodeInfo.get(e).quads;for(const i of n){let n,a;if("BlankNode"===i.subject.termType&&i.subject.value!==e)a=i.subject.value,n="p";else{if("BlankNode"!==i.object.termType||i.object.value===e)continue;a=i.object.value,n="r"}const o=this.hashRelatedBlankNode(a,i,t,n),s=r.get(o);s?s.push(a):r.set(o,[a])}return r}}},64005:(e,t,r)=>{"use strict";const n=r(43513),i=r(93845),a=r(62438),o=r(30378);let s;try{s=r(67789)}catch(e){}function u(e){return Array.isArray(e)?e:t.NQuads.legacyDatasetToQuads(e)}t.NQuads=r(11227),t.IdentifierIssuer=r(32985),t._rdfCanonizeNative=function(e){return e&&(s=e),s},t.canonize=async function(e,t){const r=u(e);if(t.useNative){if(!s)throw new Error("rdf-canonize-native not available");if(t.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return new Promise(((e,n)=>s.canonize(r,t,((t,r)=>t?n(t):e(r)))))}if("URDNA2015"===t.algorithm)return new n(t).main(r);if("URGNA2012"===t.algorithm){if(t.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new i(t).main(r)}if(!("algorithm"in t))throw new Error("No RDF Dataset Canonicalization algorithm specified.");throw new Error("Invalid RDF Dataset Canonicalization algorithm: "+t.algorithm)},t._canonizeSync=function(e,t){const r=u(e);if(t.useNative){if(!s)throw new Error("rdf-canonize-native not available");if(t.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return s.canonizeSync(r,t)}if("URDNA2015"===t.algorithm)return new a(t).main(r);if("URGNA2012"===t.algorithm){if(t.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new o(t).main(r)}if(!("algorithm"in t))throw new Error("No RDF Dataset Canonicalization algorithm specified.");throw new Error("Invalid RDF Dataset Canonicalization algorithm: "+t.algorithm)}},47793:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(49931),t),i(r(88483),t),i(r(92142),t),i(r(62426),t),i(r(43988),t),i(r(36754),t),i(r(88401),t)},49931:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BlankNode=void 0,t.BlankNode=class{constructor(e){this.termType="BlankNode",this.value=e}equals(e){return!!e&&"BlankNode"===e.termType&&e.value===this.value}}},88483:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataFactory=void 0;const n=r(49931),i=r(92142),a=r(62426),o=r(43988),s=r(36754),u=r(88401);let c=0;t.DataFactory=class{constructor(e){this.blankNodeCounter=0,e=e||{},this.blankNodePrefix=e.blankNodePrefix||`df_${c++}_`}namedNode(e){return new o.NamedNode(e)}blankNode(e){return new n.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(e,t){return new a.Literal(e,t)}variable(e){return new u.Variable(e)}defaultGraph(){return i.DefaultGraph.INSTANCE}quad(e,t,r,n){return new s.Quad(e,t,r,n||this.defaultGraph())}fromTerm(e){switch(e.termType){case"NamedNode":return this.namedNode(e.value);case"BlankNode":return this.blankNode(e.value);case"Literal":return e.language?this.literal(e.value,e.language):e.datatype.equals(a.Literal.XSD_STRING)?this.literal(e.value):this.literal(e.value,this.fromTerm(e.datatype));case"Variable":return this.variable(e.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(e.subject),this.fromTerm(e.predicate),this.fromTerm(e.object),this.fromTerm(e.graph))}}fromQuad(e){return this.fromTerm(e)}resetBlankNodeCounter(){this.blankNodeCounter=0}}},92142:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultGraph=void 0;class r{constructor(){this.termType="DefaultGraph",this.value=""}equals(e){return!!e&&"DefaultGraph"===e.termType}}t.DefaultGraph=r,r.INSTANCE=new r},62426:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Literal=void 0;const n=r(43988);class i{constructor(e,t){this.termType="Literal",this.value=e,"string"==typeof t?(this.language=t,this.datatype=i.RDF_LANGUAGE_STRING):t?(this.language="",this.datatype=t):(this.language="",this.datatype=i.XSD_STRING)}equals(e){return!!e&&"Literal"===e.termType&&e.value===this.value&&e.language===this.language&&this.datatype.equals(e.datatype)}}t.Literal=i,i.RDF_LANGUAGE_STRING=new n.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),i.XSD_STRING=new n.NamedNode("http://www.w3.org/2001/XMLSchema#string")},43988:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NamedNode=void 0,t.NamedNode=class{constructor(e){this.termType="NamedNode",this.value=e}equals(e){return!!e&&"NamedNode"===e.termType&&e.value===this.value}}},36754:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Quad=void 0,t.Quad=class{constructor(e,t,r,n){this.termType="Quad",this.value="",this.subject=e,this.predicate=t,this.object=r,this.graph=n}equals(e){return!!e&&("Quad"===e.termType||!e.termType)&&this.subject.equals(e.subject)&&this.predicate.equals(e.predicate)&&this.object.equals(e.object)&&this.graph.equals(e.graph)}}},88401:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Variable=void 0,t.Variable=class{constructor(e){this.termType="Variable",this.value=e}equals(e){return!!e&&"Variable"===e.termType&&e.value===this.value}}},62699:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(35694),t)},35694:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isTermGrounded=t.termToSignature=t.quadToSignature=t.sha1hex=t.hashTerm=t.hashTerms=t.getGraphBlankNodes=t.uniqGraph=t.deindexGraph=t.indexGraph=t.getQuadsWithoutBlankNodes=t.getQuadsWithBlankNodes=t.hasValue=t.hashValues=t.getBijectionInner=t.getBijection=t.isomorphic=void 0;const n=r(77952),i=r(43347),a=r(3285);function o(e,t){const r=p(h(e)),n=p(h(t));if(Object.keys(r).length!==Object.keys(n).length)return null;for(const e in r)if(r[e]!==n[e])return null;return s(y(d(e)),y(d(t)),g(e),g(t))}function s(e,t,r,n,a,o){a||(a={}),o||(o={});const[d,h]=m(e,r,a),[p,f]=m(t,n,o);if(Object.keys(d).length!==Object.keys(p).length)return null;for(const e in d)if(!l(p,d[e]))return null;let y={};for(const e of r){const t=i.termToString(e),r=h[t];for(const e in f)if(f[e]===r){y[t]=e,delete f[e];break}}if(!u(Object.keys(y).sort(),r.map(i.termToString).sort())||!u(c(y).sort(),n.map(i.termToString).sort())){y=null;for(const a of r){const o=i.termToString(a);if(!d[o])for(const a of n){const u=i.termToString(a);if(!p[u]&&h[o]===f[u]){const i=v(o);y=s(e,t,r,n,Object.assign(Object.assign({},d),{[o]:i}),Object.assign(Object.assign({},p),{[u]:i}))}}}}return y}function u(e,t){if(e.length!==t.length)return!1;for(let r=e.length;r--;)if(e[r]!==t[r])return!1;return!0}function c(e){const t=[];for(const r in e)t.push(e[r]);return t}function l(e,t){for(const r in e)if(e[r]===t)return!0;return!1}function d(e){return e.filter((e=>a.someTerms(e,(e=>"BlankNode"===e.termType||"Quad"===e.termType&&a.getTermsNested(e).some((e=>"BlankNode"===e.termType))))))}function h(e){return e.filter((e=>a.everyTerms(e,(e=>"BlankNode"!==e.termType&&!("Quad"===e.termType&&a.getTermsNested(e).some((e=>"BlankNode"===e.termType)))))))}function p(e){const t={};for(const r of e)t[JSON.stringify(i.quadToStringQuad(r))]=!0;return t}function f(e){return Object.keys(e).map((e=>i.stringQuadToQuad(JSON.parse(e))))}function y(e){return f(p(e))}function g(e){return a.uniqTerms(e.map((e=>a.getBlankNodes(a.getTermsNested(e)))).reduce(((e,t)=>e.concat(t)),[]))}function m(e,t,r){const n=Object.assign({},r),a={};let o=!0;for(;o;){const r=Object.keys(n).length;for(const r of t){const t=i.termToString(r);if(!n[t]){const[i,o]=b(r,e,n);i&&(n[t]=o),a[t]=o}}const s={};for(const e in a){const t=a[e];void 0===s[t]?s[t]=e:s[t]=!1}for(const e in s){const t=s[e];t&&(n[t]=e)}o=r!==Object.keys(n).length}return[n,a]}function b(e,t,r){const n=[];let i=!0;for(const o of t){const t=a.getTermsNested(o);if(t.some((t=>t.equals(e)))){n.push(_(o,r,e));for(const n of t)T(n,r)||n.equals(e)||(i=!1)}}return[i,v(n.sort().join(""))]}function v(e){return n.sha1().update(e).digest("hex")}function _(e,t,r){return a.getTerms(e).map((e=>w(e,t,r))).join("|")}function w(e,t,r){return e.equals(r)?"@self":"BlankNode"===e.termType?t[i.termToString(e)]||"@blank":"Quad"===e.termType?`<${_(e,t,r)}>`:i.termToString(e)}function T(e,t){return"BlankNode"!==e.termType&&!("Quad"===e.termType&&a.getTermsNested(e).some((e=>!T(e,t))))||!!t[i.termToString(e)]}t.isomorphic=function(e,t){return!!o(e,t)},t.getBijection=o,t.getBijectionInner=s,t.hashValues=c,t.hasValue=l,t.getQuadsWithBlankNodes=d,t.getQuadsWithoutBlankNodes=h,t.indexGraph=p,t.deindexGraph=f,t.uniqGraph=y,t.getGraphBlankNodes=g,t.hashTerms=m,t.hashTerm=b,t.sha1hex=v,t.quadToSignature=_,t.termToSignature=w,t.isTermGrounded=T},99349:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.getSupportedJavaScriptPrimitives=t.getSupportedRdfDatatypes=t.getTermRaw=t.toRdf=t.fromRdf=void 0;const a=r(47793),o=r(94802),s=r(30103);i(r(94802),t),i(r(5448),t),i(r(30103),t);const u=new a.DataFactory,c=new s.Translator;function l(e,t){return c.fromRdf(e,t)}c.registerHandler(new o.TypeHandlerString,o.TypeHandlerString.TYPES.map((e=>u.namedNode(e))),["string"]),c.registerHandler(new o.TypeHandlerBoolean,[o.TypeHandlerBoolean.TYPE].map((e=>u.namedNode(e))),["boolean"]),c.registerHandler(new o.TypeHandlerNumberDouble,o.TypeHandlerNumberDouble.TYPES.map((e=>u.namedNode(e))),["number"]),c.registerHandler(new o.TypeHandlerNumberInteger,o.TypeHandlerNumberInteger.TYPES.map((e=>u.namedNode(e))),["number"]),c.registerHandler(new o.TypeHandlerDate,o.TypeHandlerDate.TYPES.map((e=>u.namedNode(e))),["object"]),t.fromRdf=l,t.toRdf=function(e,t){return t&&"namedNode"in t&&(t={dataFactory:t}),(t=t||{})&&!t.dataFactory&&(t.dataFactory=u),c.toRdf(e,t)},t.getTermRaw=function(e,t){return"Literal"===e.termType?l(e,t):e.value},t.getSupportedRdfDatatypes=function(){return c.getSupportedRdfDatatypes()},t.getSupportedJavaScriptPrimitives=function(){return c.getSupportedJavaScriptPrimitives()}},5448:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},30103:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Translator=void 0,t.Translator=class{constructor(){this.supportedRdfDatatypes=[],this.fromRdfHandlers={},this.toRdfHandlers={}}static incorrectRdfDataType(e){throw new Error(`Invalid RDF ${e.datatype.value} value: '${e.value}'`)}registerHandler(e,t,r){for(const r of t)this.supportedRdfDatatypes.push(r),this.fromRdfHandlers[r.value]=e;for(const t of r){let r=this.toRdfHandlers[t];r||(this.toRdfHandlers[t]=r=[]),r.push(e)}}fromRdf(e,t){const r=this.fromRdfHandlers[e.datatype.value];return r?r.fromRdf(e,t):e.value}toRdf(e,t){const r=this.toRdfHandlers[typeof e];if(r)for(const n of r){const r=n.toRdf(e,t);if(r)return r}throw new Error(`Invalid JavaScript value: '${e}'`)}getSupportedRdfDatatypes(){return this.supportedRdfDatatypes}getSupportedJavaScriptPrimitives(){return Object.keys(this.toRdfHandlers)}}},92:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeHandlerBoolean=void 0;const n=r(30103);class i{fromRdf(e,t){switch(e.value){case"true":case"1":return!0;case"false":case"0":return!1}return t&&n.Translator.incorrectRdfDataType(e),!1}toRdf(e,{datatype:t,dataFactory:r}){return r.literal(e?"true":"false",t||r.namedNode(i.TYPE))}}i.TYPE="http://www.w3.org/2001/XMLSchema#boolean",t.TypeHandlerBoolean=i},37258:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeHandlerDate=void 0;const n=r(30103);class i{fromRdf(e,t){switch(t&&!e.value.match(i.VALIDATORS[e.datatype.value.substr(33,e.datatype.value.length)])&&n.Translator.incorrectRdfDataType(e),e.datatype.value){case"http://www.w3.org/2001/XMLSchema#gDay":return new Date(0,0,parseInt(e.value,10));case"http://www.w3.org/2001/XMLSchema#gMonthDay":const t=e.value.split("-");return new Date(0,parseInt(t[0],10)-1,parseInt(t[1],10));case"http://www.w3.org/2001/XMLSchema#gYear":return new Date(e.value+"-01-01");case"http://www.w3.org/2001/XMLSchema#gYearMonth":return new Date(e.value+"-01");default:return new Date(e.value)}}toRdf(e,{datatype:t,dataFactory:r}){if(t=t||r.namedNode(i.TYPES[0]),!(e instanceof Date))return null;const n=e;let a;switch(t.value){case"http://www.w3.org/2001/XMLSchema#gDay":a=String(n.getUTCDate());break;case"http://www.w3.org/2001/XMLSchema#gMonthDay":a=n.getUTCMonth()+1+"-"+n.getUTCDate();break;case"http://www.w3.org/2001/XMLSchema#gYear":a=String(n.getUTCFullYear());break;case"http://www.w3.org/2001/XMLSchema#gYearMonth":a=n.getUTCFullYear()+"-"+(n.getUTCMonth()+1);break;case"http://www.w3.org/2001/XMLSchema#date":a=n.toISOString().replace(/T.*$/,"");break;default:a=n.toISOString()}return r.literal(a,t)}}i.TYPES=["http://www.w3.org/2001/XMLSchema#dateTime","http://www.w3.org/2001/XMLSchema#date","http://www.w3.org/2001/XMLSchema#gDay","http://www.w3.org/2001/XMLSchema#gMonthDay","http://www.w3.org/2001/XMLSchema#gYear","http://www.w3.org/2001/XMLSchema#gYearMonth"],i.VALIDATORS={date:/^[0-9]+-[0-9][0-9]-[0-9][0-9]Z?$/,dateTime:/^[0-9]+-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9](\.[0-9][0-9][0-9])?((Z?)|([\+-][0-9][0-9]:[0-9][0-9]))$/,gDay:/^[0-9]+$/,gMonthDay:/^[0-9]+-[0-9][0-9]$/,gYear:/^[0-9]+$/,gYearMonth:/^[0-9]+-[0-9][0-9]$/},t.TypeHandlerDate=i},82406:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeHandlerNumberDouble=void 0;const n=r(30103);class i{fromRdf(e,t){const r=parseFloat(e.value);return t&&isNaN(r)&&n.Translator.incorrectRdfDataType(e),r}toRdf(e,{datatype:t,dataFactory:r}){return t=t||r.namedNode(i.TYPES[0]),isNaN(e)?r.literal("NaN",t):isFinite(e)?e%1==0?null:r.literal(e.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),t):r.literal(e>0?"INF":"-INF",t)}}i.TYPES=["http://www.w3.org/2001/XMLSchema#double","http://www.w3.org/2001/XMLSchema#decimal","http://www.w3.org/2001/XMLSchema#float"],t.TypeHandlerNumberDouble=i},96925:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeHandlerNumberInteger=void 0;const n=r(30103);class i{fromRdf(e,t){const r=parseInt(e.value,10);return t&&(isNaN(r)||e.value.indexOf(".")>=0)&&n.Translator.incorrectRdfDataType(e),r}toRdf(e,{datatype:t,dataFactory:r}){return r.literal(String(e),t||(e<=i.MAX_INT&&e>=i.MIN_INT?r.namedNode(i.TYPES[0]):r.namedNode(i.TYPES[1])))}}i.TYPES=["http://www.w3.org/2001/XMLSchema#integer","http://www.w3.org/2001/XMLSchema#long","http://www.w3.org/2001/XMLSchema#int","http://www.w3.org/2001/XMLSchema#byte","http://www.w3.org/2001/XMLSchema#short","http://www.w3.org/2001/XMLSchema#negativeInteger","http://www.w3.org/2001/XMLSchema#nonNegativeInteger","http://www.w3.org/2001/XMLSchema#nonPositiveInteger","http://www.w3.org/2001/XMLSchema#positiveInteger","http://www.w3.org/2001/XMLSchema#unsignedByte","http://www.w3.org/2001/XMLSchema#unsignedInt","http://www.w3.org/2001/XMLSchema#unsignedLong","http://www.w3.org/2001/XMLSchema#unsignedShort"],i.MAX_INT=2147483647,i.MIN_INT=-2147483648,t.TypeHandlerNumberInteger=i},14191:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypeHandlerString=void 0;class r{fromRdf(e){return e.value}toRdf(e,{datatype:t,dataFactory:r}){return r.literal(e,t)}}r.TYPES=["http://www.w3.org/2001/XMLSchema#string","http://www.w3.org/2001/XMLSchema#normalizedString","http://www.w3.org/2001/XMLSchema#anyURI","http://www.w3.org/2001/XMLSchema#base64Binary","http://www.w3.org/2001/XMLSchema#language","http://www.w3.org/2001/XMLSchema#Name","http://www.w3.org/2001/XMLSchema#NCName","http://www.w3.org/2001/XMLSchema#NMTOKEN","http://www.w3.org/2001/XMLSchema#token","http://www.w3.org/2001/XMLSchema#hexBinary","http://www.w3.org/1999/02/22-rdf-syntax-ns#langString","http://www.w3.org/2001/XMLSchema#time","http://www.w3.org/2001/XMLSchema#duration"],t.TypeHandlerString=r},94802:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(92),t),i(r(37258),t),i(r(82406),t),i(r(96925),t),i(r(14191),t)},46898:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.termToString=t.stringToTerm=t.stringQuadToQuad=t.quadToStringQuad=t.getLiteralValue=t.getLiteralType=t.getLiteralLanguage=void 0;const n=r(19858);Object.defineProperty(t,"getLiteralLanguage",{enumerable:!0,get:function(){return n.getLiteralLanguage}}),Object.defineProperty(t,"getLiteralType",{enumerable:!0,get:function(){return n.getLiteralType}}),Object.defineProperty(t,"getLiteralValue",{enumerable:!0,get:function(){return n.getLiteralValue}}),Object.defineProperty(t,"quadToStringQuad",{enumerable:!0,get:function(){return n.quadToStringQuad}}),Object.defineProperty(t,"stringQuadToQuad",{enumerable:!0,get:function(){return n.stringQuadToQuad}}),Object.defineProperty(t,"stringToTerm",{enumerable:!0,get:function(){return n.stringToTerm}}),Object.defineProperty(t,"termToString",{enumerable:!0,get:function(){return n.termToString}})},19858:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stringQuadToQuad=t.quadToStringQuad=t.stringToTerm=t.getLiteralLanguage=t.getLiteralType=t.getLiteralValue=t.termToString=void 0;const n=new(r(47793).DataFactory);function i(e){var t,r;if(e)switch(e.termType){case"NamedNode":return`<${t=e.value,t.replace(c,d)}>`;case"BlankNode":return`_:${e.value}`;case"Literal":{const t=e;return`"${r=t.value,c.test(r)&&(r=r.replace(c,d)),r}"${t.datatype&&"http://www.w3.org/2001/XMLSchema#string"!==t.datatype.value&&"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"!==t.datatype.value?`^^<${t.datatype.value}>`:""}${t.language?`@${t.language}`:""}`}case"Quad":return`<<${i(e.subject)} ${i(e.predicate)} ${i(e.object)}${"DefaultGraph"===e.graph.termType?"":` ${i(e.graph)}`}>>`;case"Variable":return`?${e.value}`;case"DefaultGraph":return e.value}}function a(e){const t=/^"([^]*)"((\^\^.*)|(@.*))?$/u.exec(e);if(!t)throw new Error(`${e} is not a literal`);return t[1].replace(/\\"/gu,'"')}function o(e){const t=/^"[^]*"(?:\^\^<([^"]+)>|(@)[^@"]+)?$/u.exec(e);if(!t)throw new Error(`${e} is not a literal`);return t[1]||(t[2]?"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString":"http://www.w3.org/2001/XMLSchema#string")}function s(e){const t=/^"[^]*"(?:@([^@"]+)|\^\^[^"]+)?$/u.exec(e);if(!t)throw new Error(`${e} is not a literal`);return t[1]?t[1].toLowerCase():""}function u(e,t){if(t=t||n,!e||0===e.length)return t.defaultGraph();switch(e[0]){case"_":return t.blankNode(e.slice(2));case"?":if(!t.variable)throw new Error("Missing 'variable()' method on the given DataFactory");return t.variable(e.slice(1));case'"':{const r=s(e),n=t.namedNode(o(e));return t.literal(a(e),r||n)}default:if(e.startsWith("<<")&&e.endsWith(">>")){const r=e.slice(2,-2),n=[];let i=0,a=0;for(let t=0;t"===o){if(0===i)throw new Error(`Found closing tag without opening tag in ${e}`);i--}" "===o&&0===i&&(n.push(r.slice(a,t)),a=t+1)}if(0!==i)throw new Error(`Found opening tag without closing tag in ${e}`);if(n.push(r.slice(a,r.length)),3!==n.length&&4!==n.length)throw new Error(`Nested quad syntax error ${e}`);return t.quad(u(n[0]),u(n[1]),u(n[2]),n[3]?u(n[3]):void 0)}if(!e.startsWith("<")||!e.endsWith(">"))throw new Error(`Detected invalid iri for named node (must be wrapped in <>): ${e}`);return t.namedNode(e.slice(1,-1))}}t.termToString=i,t.getLiteralValue=a,t.getLiteralType=o,t.getLiteralLanguage=s,t.stringToTerm=u,t.quadToStringQuad=function(e){return{subject:i(e.subject),predicate:i(e.predicate),object:i(e.object),graph:i(e.graph)}},t.stringQuadToQuad=function(e,t){return(t=t||n).quad(u(e.subject,t),u(e.predicate,t),u(e.object,t),u(e.graph,t))};const c=/["\\\t\n\r\b\f\u0000-\u0019]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,l=new Map([["\\","\\\\"],['"','\\"'],["\t","\\t"],["\n","\\n"],["\r","\\r"],["\b","\\b"],["\f","\\f"]]);function d(e){const t=l.get(e);if(!t){if(1===e.length){const t=e.charCodeAt(0).toString(16);return`${"\\u0000".slice(0,-t.length)}${t}`}const t=(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)+9216).toString(16);return`${"\\U00000000".slice(0,-t.length)}${t}`}return t}},43347:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.termToString=t.stringToTerm=t.stringQuadToQuad=t.quadToStringQuad=t.getLiteralValue=t.getLiteralType=t.getLiteralLanguage=void 0;const n=r(23585);Object.defineProperty(t,"getLiteralLanguage",{enumerable:!0,get:function(){return n.getLiteralLanguage}}),Object.defineProperty(t,"getLiteralType",{enumerable:!0,get:function(){return n.getLiteralType}}),Object.defineProperty(t,"getLiteralValue",{enumerable:!0,get:function(){return n.getLiteralValue}}),Object.defineProperty(t,"quadToStringQuad",{enumerable:!0,get:function(){return n.quadToStringQuad}}),Object.defineProperty(t,"stringQuadToQuad",{enumerable:!0,get:function(){return n.stringQuadToQuad}}),Object.defineProperty(t,"stringToTerm",{enumerable:!0,get:function(){return n.stringToTerm}}),Object.defineProperty(t,"termToString",{enumerable:!0,get:function(){return n.termToString}})},23585:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stringQuadToQuad=t.quadToStringQuad=t.stringToTerm=t.getLiteralLanguage=t.getLiteralType=t.getLiteralValue=t.termToString=void 0;const n=new(r(47793).DataFactory);function i(e){if(e)switch(e.termType){case"NamedNode":case"DefaultGraph":return e.value;case"BlankNode":return"_:"+e.value;case"Literal":const t=e;return'"'+t.value+'"'+(t.datatype&&"http://www.w3.org/2001/XMLSchema#string"!==t.datatype.value&&"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"!==t.datatype.value?"^^"+t.datatype.value:"")+(t.language?"@"+t.language:"");case"Quad":return`<<${i(e.subject)} ${i(e.predicate)} ${i(e.object)}${"DefaultGraph"===e.graph.termType?"":" "+i(e.graph)}>>`;case"Variable":return"?"+e.value}}function a(e){const t=/^"([^]*)"/.exec(e);if(!t)throw new Error(e+" is not a literal");return t[1]}function o(e){const t=/^"[^]*"(?:\^\^([^"]+)|(@)[^@"]+)?$/.exec(e);if(!t)throw new Error(e+" is not a literal");return t[1]||(t[2]?"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString":"http://www.w3.org/2001/XMLSchema#string")}function s(e){const t=/^"[^]*"(?:@([^@"]+)|\^\^[^"]+)?$/.exec(e);if(!t)throw new Error(e+" is not a literal");return t[1]?t[1].toLowerCase():""}function u(e,t){if(t=t||n,!e||!e.length)return t.defaultGraph();switch(e[0]){case"_":return t.blankNode(e.substr(2));case"?":if(!t.variable)throw new Error("Missing 'variable()' method on the given DataFactory");return t.variable(e.substr(1));case'"':const r=s(e),n=t.namedNode(o(e));return t.literal(a(e),r||n);default:if("<"===e[0]&&e.length>4&&"<"===e[1]&&">"===e[e.length-1]&&">"===e[e.length-2]){const r=e.slice(2,-2).trim();let n=[],i=0,a=0,o=!1;for(let t=0;t"===s){if(0===i)throw new Error("Found closing tag without opening tag in "+e);i--}if('"'===s){let e=!1,n=t;for(;n-- >0&&"\\"===r[n];)e=!e;e||(o=!o)}if(" "===s&&!o&&0===i){for(n.push(r.slice(a,t));" "===r[t+1];)t+=1;a=t+1}}if(0!==i)throw new Error("Found opening tag without closing tag in "+e);if(n.push(r.slice(a,r.length)),3!==n.length&&4!==n.length)throw new Error("Nested quad syntax error "+e);return n=n.map((e=>e.startsWith("<")&&!e.includes(" ")?e.slice(1,-1):e)),t.quad(u(n[0]),u(n[1]),u(n[2]),n[3]?u(n[3]):void 0)}return t.namedNode(e)}}t.termToString=i,t.getLiteralValue=a,t.getLiteralType=o,t.getLiteralLanguage=s,t.stringToTerm=u,t.quadToStringQuad=function(e){return{subject:i(e.subject),predicate:i(e.predicate),object:i(e.object),graph:i(e.graph)}},t.stringQuadToQuad=function(e,t){return(t=t||n).quad(u(e.subject,t),u(e.predicate,t),u(e.object,t),u(e.graph,t))}},3285:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(64232),t),i(r(70071),t)},64232:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.matchPatternMappings=t.matchPatternComplete=t.matchPattern=t.matchTerm=t.getValueNestedPath=t.someTermsNested=t.someTerms=t.everyTermsNested=t.everyTerms=t.reduceTermsNested=t.reduceTerms=t.mapTermsNested=t.mapTerms=t.filterQuadTermNamesNested=t.filterQuadTermNames=t.filterTermsNested=t.filterTerms=t.forEachTermsNested=t.forEachTerms=t.collectNamedTerms=t.getNamedTerms=t.getTermsNested=t.getTerms=t.TRIPLE_TERM_NAMES=t.QUAD_TERM_NAMES=void 0;const n=new(r(47793).DataFactory);function i(e,t){return t&&"DefaultGraph"===e.graph.termType?[e.subject,e.predicate,e.object]:[e.subject,e.predicate,e.object,e.graph]}function a(e,t){return t(e.subject,"subject")&&t(e.predicate,"predicate")&&t(e.object,"object")&&t(e.graph,"graph")}function o(e,t){return!t||"Variable"===t.termType||"Quad"===t.termType&&"Quad"===e.termType&&u(e,t)||t.equals(e)}function s(e,t,r,n,i){return o(e.subject,t)&&o(e.predicate,r)&&o(e.object,n)&&o(e.graph,i)}function u(e,t){return s(e,t.subject,t.predicate,t.object,t.graph)}t.QUAD_TERM_NAMES=["subject","predicate","object","graph"],t.TRIPLE_TERM_NAMES=["subject","predicate","object"],t.getTerms=i,t.getTermsNested=function e(t,r){const n=[];for(const a of i(t,r))"Quad"===a.termType?e(a,r).forEach((e=>n.push(e))):n.push(a);return n},t.getNamedTerms=function(e){return[{key:"subject",value:e.subject},{key:"predicate",value:e.predicate},{key:"object",value:e.object},{key:"graph",value:e.graph}]},t.collectNamedTerms=function(e,t,r){const i={};return e.forEach((e=>i[e.key]=e.value)),t&&(i.subject=i.subject||t("subject"),i.predicate=i.predicate||t("predicate"),i.object=i.object||t("object"),i.graph=i.graph||t("graph")),(r||n).quad(i.subject,i.predicate,i.object,i.graph)},t.forEachTerms=function(e,t){t(e.subject,"subject"),t(e.predicate,"predicate"),t(e.object,"object"),t(e.graph,"graph")},t.forEachTermsNested=function e(t,r,n=[]){"Quad"===t.subject.termType?e(t.subject,r,[...n,"subject"]):r(t.subject,[...n,"subject"]),"Quad"===t.predicate.termType?e(t.predicate,r,[...n,"predicate"]):r(t.predicate,[...n,"predicate"]),"Quad"===t.object.termType?e(t.object,r,[...n,"object"]):r(t.object,[...n,"object"]),"Quad"===t.graph.termType?e(t.graph,r,[...n,"graph"]):r(t.graph,[...n,"graph"])},t.filterTerms=function(e,t){const r=[];return t(e.subject,"subject")&&r.push(e.subject),t(e.predicate,"predicate")&&r.push(e.predicate),t(e.object,"object")&&r.push(e.object),t(e.graph,"graph")&&r.push(e.graph),r},t.filterTermsNested=function e(t,r,n=[]){let i=[];return"Quad"===t.subject.termType?i=[...i,...e(t.subject,r,[...n,"subject"])]:r(t.subject,[...n,"subject"])&&i.push(t.subject),"Quad"===t.predicate.termType?i=[...i,...e(t.predicate,r,[...n,"predicate"])]:r(t.predicate,[...n,"predicate"])&&i.push(t.predicate),"Quad"===t.object.termType?i=[...i,...e(t.object,r,[...n,"object"])]:r(t.object,[...n,"object"])&&i.push(t.object),"Quad"===t.graph.termType?i=[...i,...e(t.graph,r,[...n,"graph"])]:r(t.graph,[...n,"graph"])&&i.push(t.graph),i},t.filterQuadTermNames=function(e,t){const r=[];return t(e.subject,"subject")&&r.push("subject"),t(e.predicate,"predicate")&&r.push("predicate"),t(e.object,"object")&&r.push("object"),t(e.graph,"graph")&&r.push("graph"),r},t.filterQuadTermNamesNested=function e(t,r,n=[]){let i=[];const a=[...n,"subject"];"Quad"===t.subject.termType?i=[...i,...e(t.subject,r,a)]:r(t.subject,a)&&i.push(a);const o=[...n,"predicate"];"Quad"===t.predicate.termType?i=[...i,...e(t.predicate,r,o)]:r(t.predicate,o)&&i.push(o);const s=[...n,"object"];"Quad"===t.object.termType?i=[...i,...e(t.object,r,s)]:r(t.object,s)&&i.push(s);const u=[...n,"graph"];return"Quad"===t.graph.termType?i=[...i,...e(t.graph,r,u)]:r(t.graph,u)&&i.push(u),i},t.mapTerms=function(e,t,r){return(r||n).quad(t(e.subject,"subject"),t(e.predicate,"predicate"),t(e.object,"object"),t(e.graph,"graph"))},t.mapTermsNested=function e(t,r,i,a=[]){return(i||n).quad("Quad"===t.subject.termType?e(t.subject,r,i,[...a,"subject"]):r(t.subject,[...a,"subject"]),"Quad"===t.predicate.termType?e(t.predicate,r,i,[...a,"predicate"]):r(t.predicate,[...a,"predicate"]),"Quad"===t.object.termType?e(t.object,r,i,[...a,"object"]):r(t.object,[...a,"object"]),"Quad"===t.graph.termType?e(t.graph,r,i,[...a,"graph"]):r(t.graph,[...a,"graph"]))},t.reduceTerms=function(e,t,r){let n=r;return n=t(n,e.subject,"subject"),n=t(n,e.predicate,"predicate"),n=t(n,e.object,"object"),t(n,e.graph,"graph")},t.reduceTermsNested=function e(t,r,n,i=[]){let a=n;return a="Quad"===t.subject.termType?e(t.subject,r,a,[...i,"subject"]):r(a,t.subject,[...i,"subject"]),a="Quad"===t.predicate.termType?e(t.predicate,r,a,[...i,"predicate"]):r(a,t.predicate,[...i,"predicate"]),a="Quad"===t.object.termType?e(t.object,r,a,[...i,"object"]):r(a,t.object,[...i,"object"]),a="Quad"===t.graph.termType?e(t.graph,r,a,[...i,"graph"]):r(a,t.graph,[...i,"graph"]),a},t.everyTerms=a,t.everyTermsNested=function e(t,r,n=[]){return("Quad"===t.subject.termType?e(t.subject,r,[...n,"subject"]):r(t.subject,[...n,"subject"]))&&("Quad"===t.predicate.termType?e(t.predicate,r,[...n,"predicate"]):r(t.predicate,[...n,"predicate"]))&&("Quad"===t.object.termType?e(t.object,r,[...n,"object"]):r(t.object,[...n,"object"]))&&("Quad"===t.graph.termType?e(t.graph,r,[...n,"graph"]):r(t.graph,[...n,"graph"]))},t.someTerms=function(e,t){return t(e.subject,"subject")||t(e.predicate,"predicate")||t(e.object,"object")||t(e.graph,"graph")},t.someTermsNested=function e(t,r,n=[]){return("Quad"===t.subject.termType?e(t.subject,r,[...n,"subject"]):r(t.subject,[...n,"subject"]))||("Quad"===t.predicate.termType?e(t.predicate,r,[...n,"predicate"]):r(t.predicate,[...n,"predicate"]))||("Quad"===t.object.termType?e(t.object,r,[...n,"object"]):r(t.object,[...n,"object"]))||("Quad"===t.graph.termType?e(t.graph,r,[...n,"graph"]):r(t.graph,[...n,"graph"]))},t.getValueNestedPath=function e(t,r){if(0===r.length)return t;if("Quad"===t.termType)return e(t[r[0]],r.slice(1));throw new Error(`Tried to get ${r[0]} from term of type ${t.termType}`)},t.matchTerm=o,t.matchPattern=s,t.matchPatternComplete=u,t.matchPatternMappings=function(e,t,r={}){const n={};return function e(t,i){return a(t,((t,a)=>{var o,s;const u=i[a];switch(t.termType){case"Variable":return r.skipVarMapping&&"Variable"===u.termType||(null!==(s=null===(o=n[t.value])||void 0===o?void 0:o.equals(u))&&void 0!==s?s:(n[t.value]=u,!0));case"Quad":return"Quad"===u.termType&&e(t,u);default:return t.equals(u)}}))}(t,e)&&(!r.returnMappings||n)}},70071:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getQuads=t.getDefaultGraphs=t.getVariables=t.getLiterals=t.getBlankNodes=t.getNamedNodes=t.getTermsOfType=t.uniqTerms=t.TERM_TYPES=void 0;const n=r(43347);function i(e,t){return e.filter((e=>e.termType===t))}t.TERM_TYPES=["NamedNode","BlankNode","Literal","Variable","DefaultGraph","Quad"],t.uniqTerms=function(e){const t={};return e.filter((e=>{const r=(0,n.termToString)(e);return!(r in t)&&(t[r]=!0)}))},t.getTermsOfType=i,t.getNamedNodes=function(e){return i(e,"NamedNode")},t.getBlankNodes=function(e){return i(e,"BlankNode")},t.getLiterals=function(e){return i(e,"Literal")},t.getVariables=function(e){return i(e,"Variable")},t.getDefaultGraphs=function(e){return i(e,"DefaultGraph")},t.getQuads=function(e){return i(e,"Quad")}},75611:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(68225),t)},5916:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ParseError=void 0;class r extends Error{constructor(e,t){const r=e.saxParser;super(e.trackPosition?`Line ${r.line} column ${r.column+1}: ${t}`:t)}}t.ParseError=r},68225:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ParseType=t.RdfXmlParser=void 0;const n=r(70742),i=r(55201),a=r(19198),o=r(5916),s=r(47793),u=r(17024);class c extends a.Transform{constructor(e){super({readableObjectMode:!0}),this.activeTagStack=[],this.nodeIds={},e&&(Object.assign(this,e),this.options=e),this.dataFactory||(this.dataFactory=new s.DataFactory),this.baseIRI||(this.baseIRI=""),this.defaultGraph||(this.defaultGraph=this.dataFactory.defaultGraph()),!1!==this.validateUri&&(this.validateUri=!0),this.iriValidationStrategy||(this.iriValidationStrategy=this.validateUri?u.IriValidationStrategy.Pragmatic:u.IriValidationStrategy.None),this.saxParser=new i.SaxesParser({xmlns:!0,position:this.trackPosition}),this.attachSaxListeners()}import(e){const t=new a.PassThrough({readableObjectMode:!0});e.on("error",(e=>r.emit("error",e))),e.on("data",(e=>t.push(e))),e.on("end",(()=>t.push(null)));const r=t.pipe(new c(this.options));return r}_transform(e,t,r){try{this.saxParser.write(e)}catch(e){return r(e)}r()}newParseError(e){return new o.ParseError(this,e)}valueToUri(e,t){return this.uriToNamedNode((0,n.resolve)(e,t.baseIRI))}uriToNamedNode(e){const t=(0,u.validateIri)(e,this.iriValidationStrategy);if(t instanceof Error)throw this.newParseError(t.message);return this.dataFactory.namedNode(e)}validateNcname(e){if(!c.NCNAME_MATCHER.test(e))throw this.newParseError(`Not a valid NCName: ${e}`)}attachSaxListeners(){this.saxParser.on("error",(e=>this.emit("error",e))),this.saxParser.on("opentag",this.onTag.bind(this)),this.saxParser.on("text",this.onText.bind(this)),this.saxParser.on("cdata",this.onText.bind(this)),this.saxParser.on("closetag",this.onCloseTag.bind(this)),this.saxParser.on("doctype",this.onDoctype.bind(this))}onTag(e){const t=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;let r=l.RESOURCE;if(t&&(t.hadChildren=!0,r=t.childrenParseType),t&&t.childrenStringTags){const r=e.name;let n="";for(const t in e.attributes)n+=` ${t}="${e.attributes[t].value}"`;const i=`<${r}${n}>`;t.childrenStringTags.push(i);const a={childrenStringTags:t.childrenStringTags};return a.childrenStringEmitClosingTag=``,void this.activeTagStack.push(a)}const n={};t?(n.language=t.language,n.baseIRI=t.baseIRI):n.baseIRI=this.baseIRI,this.activeTagStack.push(n),r===l.RESOURCE?this.onTagResource(e,n,t,!t):this.onTagProperty(e,n,t)}onTagResource(e,t,r,i){t.childrenParseType=l.PROPERTY;let a=!0;if(e.uri===c.RDF){if(!i&&c.FORBIDDEN_NODE_ELEMENTS.indexOf(e.local)>=0)throw this.newParseError(`Illegal node element name: ${e.local}`);switch(e.local){case"RDF":t.childrenParseType=l.RESOURCE;case"Description":a=!1}}const o=[],s=[];let u=null,d=!1,h=!1,p=null;for(const i in e.attributes){const a=e.attributes[i];if(r&&a.uri===c.RDF)switch(a.local){case"about":if(u)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${a.value} and ${u} where found.`);u=a.value;continue;case"ID":if(u)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${a.value} and ${u} where found.`);this.validateNcname(a.value),u="#"+a.value,d=!0;continue;case"nodeID":if(u)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${a.value} and ${u} where found.`);this.validateNcname(a.value),u=a.value,h=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"type":p=a.value;continue;case"aboutEach":throw this.newParseError("rdf:aboutEach is not supported.");case"aboutEachPrefix":throw this.newParseError("rdf:aboutEachPrefix is not supported.");case"li":throw this.newParseError("rdf:li on node elements are not supported.")}else if(a.uri===c.XML){if("lang"===a.local){t.language=""===a.value?null:a.value.toLowerCase();continue}if("base"===a.local){t.baseIRI=(0,n.resolve)(a.value,t.baseIRI);continue}}"xml"===a.prefix||"xmlns"===a.prefix||""===a.prefix&&"xmlns"===a.local||!a.uri||(o.push(this.uriToNamedNode(a.uri+a.local)),s.push(a.value))}if(null!==u&&(t.subject=h?this.dataFactory.blankNode(u):this.valueToUri(u,t),d&&this.claimNodeId(t.subject)),t.subject||(t.subject=this.dataFactory.blankNode()),a){const n=this.uriToNamedNode(e.uri+e.local);this.emitTriple(t.subject,this.dataFactory.namedNode(c.RDF+"type"),n,r?r.reifiedStatementId:null)}if(r){if(r.predicate)if(r.childrenCollectionSubject){const e=this.dataFactory.blankNode();this.emitTriple(r.childrenCollectionSubject,r.childrenCollectionPredicate,e,r.reifiedStatementId),this.emitTriple(e,this.dataFactory.namedNode(c.RDF+"first"),t.subject,t.reifiedStatementId),r.childrenCollectionSubject=e,r.childrenCollectionPredicate=this.dataFactory.namedNode(c.RDF+"rest")}else{this.emitTriple(r.subject,r.predicate,t.subject,r.reifiedStatementId);for(let e=0;e=0)throw this.newParseError(`Illegal property element name: ${e.local}`);t.predicateSubPredicates=[],t.predicateSubObjects=[];let n=!1,i=!1,a=null,o=!0;const s=[],u=[];for(const r in e.attributes){const d=e.attributes[r];if(d.uri===c.RDF)switch(d.local){case"resource":if(a)throw this.newParseError(`Found both rdf:resource (${d.value}) and rdf:nodeID (${a}).`);if(n)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${d.value})`);t.hadChildren=!0,a=d.value,o=!1;continue;case"datatype":if(i)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${d.value}).`);if(n)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${d.value})`);t.datatype=this.valueToUri(d.value,t);continue;case"nodeID":if(i)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${d.value}).`);if(t.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${d.value}).`);if(n)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${d.value})`);this.validateNcname(d.value),t.hadChildren=!0,a=d.value,o=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"parseType":if(i)throw this.newParseError("rdf:parseType is not allowed when non-rdf:* property attributes are present");if(t.datatype)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${t.datatype.value})`);if(a)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID or rdf:resource (${a})`);if("Resource"===d.value){n=!0,t.childrenParseType=l.PROPERTY;const e=this.dataFactory.blankNode();this.emitTriple(t.subject,t.predicate,e,t.reifiedStatementId),t.subject=e,t.predicate=null}else"Collection"===d.value?(n=!0,t.hadChildren=!0,t.childrenCollectionSubject=t.subject,t.childrenCollectionPredicate=t.predicate,o=!1):"Literal"===d.value&&(n=!0,t.childrenTagsToString=!0,t.childrenStringTags=[]);continue;case"ID":this.validateNcname(d.value),t.reifiedStatementId=this.valueToUri("#"+d.value,t),this.claimNodeId(t.reifiedStatementId);continue}else if(d.uri===c.XML&&"lang"===d.local){t.language=""===d.value?null:d.value.toLowerCase();continue}if("xml"!==d.prefix&&"xmlns"!==d.prefix&&(""!==d.prefix||"xmlns"!==d.local)&&d.uri){if(n||t.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${d.value}`);t.hadChildren=!0,i=!0,s.push(this.uriToNamedNode(d.uri+d.local)),u.push(this.dataFactory.literal(d.value,t.datatype||t.language))}}if(null!==a){const e=t.subject;t.subject=o?this.dataFactory.blankNode(a):this.valueToUri(a,t),this.emitTriple(e,t.predicate,t.subject,t.reifiedStatementId);for(let e=0;e/g,((e,t,r)=>(this.saxParser.ENTITIES[t]=r,"")))}}var l;t.RdfXmlParser=c,c.MIME_TYPE="application/rdf+xml",c.RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#",c.XML="http://www.w3.org/XML/1998/namespace",c.FORBIDDEN_NODE_ELEMENTS=["RDF","ID","about","bagID","parseType","resource","nodeID","li","aboutEach","aboutEachPrefix"],c.FORBIDDEN_PROPERTY_ELEMENTS=["Description","RDF","ID","about","bagID","parseType","resource","nodeID","aboutEach","aboutEachPrefix"],c.NCNAME_MATCHER=/^([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_])([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_\-.0-9#xB7\u{0300}-\u{036F}\u{203F}-\u{2040}])*$/u,function(e){e[e.RESOURCE=0]="RESOURCE",e[e.PROPERTY=1]="PROPERTY"}(l||(t.ParseType=l={}))},35276:e=>{e.exports=function(t){if(!e.exports.WEBSTREAM_SUPPORT)throw new Error("No web ReadableStream support");var r=!1,n={};return new ReadableStream({start:function(e){for(var i in n.data=a,n.end=a,n.end=o,n.close=o,n.error=o,n)t.on(i,n[i]);function a(n){r||(e.enqueue(n),t.pause())}function o(i){if(!r){for(var a in r=!0,n)t.removeListener(a,n[a]);i?e.error(i):e.close()}}t.pause()},pull:function(){r||t.resume()},cancel:function(){for(var e in r=!0,n)t.removeListener(e,n[e]);t.push(null),t.pause(),t.destroy?t.destroy():t.close&&t.close()}})},e.exports.WEBSTREAM_SUPPORT="undefined"!=typeof ReadableStream},4147:(e,t,r)=>{"use strict";const{SymbolDispose:n}=r(24134),{AbortError:i,codes:a}=r(76371),{isNodeStream:o,isWebStream:s,kControllerErrorFunction:u}=r(16115),c=r(86238),{ERR_INVALID_ARG_TYPE:l}=a;let d;e.exports.addAbortSignal=function(t,r){if(((e,t)=>{if("object"!=typeof e||!("aborted"in e))throw new l("signal","AbortSignal",e)})(t),!o(r)&&!s(r))throw new l("stream",["ReadableStream","WritableStream","Stream"],r);return e.exports.addAbortSignalNoValidate(t,r)},e.exports.addAbortSignalNoValidate=function(e,t){if("object"!=typeof e||!("aborted"in e))return t;const a=o(t)?()=>{t.destroy(new i(void 0,{cause:e.reason}))}:()=>{t[u](new i(void 0,{cause:e.reason}))};if(e.aborted)a();else{d=d||r(57760).addAbortListener;const i=d(e,a);c(t,i[n])}return t}},80345:(e,t,r)=>{"use strict";const{StringPrototypeSlice:n,SymbolIterator:i,TypedArrayPrototypeSet:a,Uint8Array:o}=r(24134),{Buffer:s}=r(48287),{inspect:u}=r(57760);e.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){const t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){const t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}shift(){if(0===this.length)return;const e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(0===this.length)return"";let t=this.head,r=""+t.data;for(;null!==(t=t.next);)r+=e+t.data;return r}concat(e){if(0===this.length)return s.alloc(0);const t=s.allocUnsafe(e>>>0);let r=this.head,n=0;for(;r;)a(t,r.data,n),n+=r.data.length,r=r.next;return t}consume(e,t){const r=this.head.data;if(ea.length)){e===a.length?(t+=a,++i,r.next?this.head=r.next:this.head=this.tail=null):(t+=n(a,0,e),this.head=r,r.data=n(a,e));break}t+=a,e-=a.length,++i}while(null!==(r=r.next));return this.length-=i,t}_getBuffer(e){const t=s.allocUnsafe(e),r=e;let n=this.head,i=0;do{const s=n.data;if(!(e>s.length)){e===s.length?(a(t,s,r-e),++i,n.next?this.head=n.next:this.head=this.tail=null):(a(t,new o(s.buffer,s.byteOffset,e),r-e),this.head=n,n.data=s.slice(e));break}a(t,s,r-e),e-=s.length,++i}while(null!==(n=n.next));return this.length-=i,t}[Symbol.for("nodejs.util.inspect.custom")](e,t){return u(this,{...t,depth:0,customInspect:!1})}}},47830:(e,t,r)=>{"use strict";const{pipeline:n}=r(57758),i=r(93370),{destroyer:a}=r(75896),{isNodeStream:o,isReadable:s,isWritable:u,isWebStream:c,isTransformStream:l,isWritableStream:d,isReadableStream:h}=r(16115),{AbortError:p,codes:{ERR_INVALID_ARG_VALUE:f,ERR_MISSING_ARGS:y}}=r(76371),g=r(86238);e.exports=function(...e){if(0===e.length)throw new y("streams");if(1===e.length)return i.from(e[0]);const t=[...e];if("function"==typeof e[0]&&(e[0]=i.from(e[0])),"function"==typeof e[e.length-1]){const t=e.length-1;e[t]=i.from(e[t])}for(let r=0;r0&&!(u(e[r])||d(e[r])||l(e[r])))throw new f(`streams[${r}]`,t[r],"must be writable")}let r,m,b,v,_;const w=e[0],T=n(e,(function(e){const t=v;v=null,t?t(e):e?_.destroy(e):O||S||_.destroy()})),S=!!(u(w)||d(w)||l(w)),O=!!(s(T)||h(T)||l(T));if(_=new i({writableObjectMode:!(null==w||!w.writableObjectMode),readableObjectMode:!(null==T||!T.readableObjectMode),writable:S,readable:O}),S){if(o(w))_._write=function(e,t,n){w.write(e,t)?n():r=n},_._final=function(e){w.end(),m=e},w.on("drain",(function(){if(r){const e=r;r=null,e()}}));else if(c(w)){const e=(l(w)?w.writable:w).getWriter();_._write=async function(t,r,n){try{await e.ready,e.write(t).catch((()=>{})),n()}catch(e){n(e)}},_._final=async function(t){try{await e.ready,e.close().catch((()=>{})),m=t}catch(e){t(e)}}}const e=l(T)?T.readable:T;g(e,(()=>{if(m){const e=m;m=null,e()}}))}if(O)if(o(T))T.on("readable",(function(){if(b){const e=b;b=null,e()}})),T.on("end",(function(){_.push(null)})),_._read=function(){for(;;){const e=T.read();if(null===e)return void(b=_._read);if(!_.push(e))return}};else if(c(T)){const e=(l(T)?T.readable:T).getReader();_._read=async function(){for(;;)try{const{value:t,done:r}=await e.read();if(!_.push(t))return;if(r)return void _.push(null)}catch{return}}}return _._destroy=function(e,t){e||null===v||(e=new p),b=null,r=null,m=null,null===v?t(e):(v=t,o(T)&&a(T,e))},_}},75896:(e,t,r)=>{"use strict";const n=r(65606),{aggregateTwoErrors:i,codes:{ERR_MULTIPLE_CALLBACK:a},AbortError:o}=r(76371),{Symbol:s}=r(24134),{kIsDestroyed:u,isDestroyed:c,isFinished:l,isServerRequest:d}=r(16115),h=s("kDestroy"),p=s("kConstruct");function f(e,t,r){e&&(e.stack,t&&!t.errored&&(t.errored=e),r&&!r.errored&&(r.errored=e))}function y(e,t,r){let i=!1;function a(t){if(i)return;i=!0;const a=e._readableState,o=e._writableState;f(t,o,a),o&&(o.closed=!0),a&&(a.closed=!0),"function"==typeof r&&r(t),t?n.nextTick(g,e,t):n.nextTick(m,e)}try{e._destroy(t||null,a)}catch(t){a(t)}}function g(e,t){b(e,t),m(e)}function m(e){const t=e._readableState,r=e._writableState;r&&(r.closeEmitted=!0),t&&(t.closeEmitted=!0),(null!=r&&r.emitClose||null!=t&&t.emitClose)&&e.emit("close")}function b(e,t){const r=e._readableState,n=e._writableState;null!=n&&n.errorEmitted||null!=r&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),e.emit("error",t))}function v(e,t,r){const i=e._readableState,a=e._writableState;if(null!=a&&a.destroyed||null!=i&&i.destroyed)return this;null!=i&&i.autoDestroy||null!=a&&a.autoDestroy?e.destroy(t):t&&(t.stack,a&&!a.errored&&(a.errored=t),i&&!i.errored&&(i.errored=t),r?n.nextTick(b,e,t):b(e,t))}function _(e){let t=!1;function r(r){if(t)return void v(e,null!=r?r:new a);t=!0;const i=e._readableState,o=e._writableState,s=o||i;i&&(i.constructed=!0),o&&(o.constructed=!0),s.destroyed?e.emit(h,r):r?v(e,r,!0):n.nextTick(w,e)}try{e._construct((e=>{n.nextTick(r,e)}))}catch(e){n.nextTick(r,e)}}function w(e){e.emit(p)}function T(e){return(null==e?void 0:e.setHeader)&&"function"==typeof e.abort}function S(e){e.emit("close")}function O(e,t){e.emit("error",t),n.nextTick(S,e)}e.exports={construct:function(e,t){if("function"!=typeof e._construct)return;const r=e._readableState,i=e._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),e.once(p,t),e.listenerCount(p)>1||n.nextTick(_,e)},destroyer:function(e,t){e&&!c(e)&&(t||l(e)||(t=new o),d(e)?(e.socket=null,e.destroy(t)):T(e)?e.abort():T(e.req)?e.req.abort():"function"==typeof e.destroy?e.destroy(t):"function"==typeof e.close?e.close():t?n.nextTick(O,e,t):n.nextTick(S,e),e.destroyed||(e[u]=!0))},destroy:function(e,t){const r=this._readableState,n=this._writableState,a=n||r;return null!=n&&n.destroyed||null!=r&&r.destroyed?("function"==typeof t&&t(),this):(f(e,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),a.constructed?y(this,e,t):this.once(h,(function(r){y(this,i(r,e),t)})),this)},undestroy:function(){const e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=!1===e.readable,e.endEmitted=!1===e.readable),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=!1===t.writable,t.ending=!1===t.writable,t.finished=!1===t.writable)},errorOrDestroy:v}},93370:(e,t,r)=>{"use strict";const{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:i,ObjectKeys:a,ObjectSetPrototypeOf:o}=r(24134);e.exports=c;const s=r(57576),u=r(78584);o(c.prototype,s.prototype),o(c,s);{const e=a(u.prototype);for(let t=0;t{const n=r(65606),i=r(48287),{isReadable:a,isWritable:o,isIterable:s,isNodeStream:u,isReadableNodeStream:c,isWritableNodeStream:l,isDuplexNodeStream:d,isReadableStream:h,isWritableStream:p}=r(16115),f=r(86238),{AbortError:y,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:m}}=r(76371),{destroyer:b}=r(75896),v=r(93370),_=r(57576),w=r(78584),{createDeferredPromise:T}=r(57760),S=r(96532),O=globalThis.Blob||i.Blob,E=void 0!==O?function(e){return e instanceof O}:function(e){return!1},x=globalThis.AbortController||r(25568).AbortController,{FunctionPrototypeCall:A}=r(24134);class R extends v{constructor(e){super(e),!1===(null==e?void 0:e.readable)&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===(null==e?void 0:e.writable)&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}function I(e){const t=e.readable&&"function"!=typeof e.readable.read?_.wrap(e.readable):e.readable,r=e.writable;let n,i,s,u,c,l=!!a(t),d=!!o(r);function h(e){const t=u;u=null,t?t(e):e&&c.destroy(e)}return c=new R({readableObjectMode:!(null==t||!t.readableObjectMode),writableObjectMode:!(null==r||!r.writableObjectMode),readable:l,writable:d}),d&&(f(r,(e=>{d=!1,e&&b(t,e),h(e)})),c._write=function(e,t,i){r.write(e,t)?i():n=i},c._final=function(e){r.end(),i=e},r.on("drain",(function(){if(n){const e=n;n=null,e()}})),r.on("finish",(function(){if(i){const e=i;i=null,e()}}))),l&&(f(t,(e=>{l=!1,e&&b(t,e),h(e)})),t.on("readable",(function(){if(s){const e=s;s=null,e()}})),t.on("end",(function(){c.push(null)})),c._read=function(){for(;;){const e=t.read();if(null===e)return void(s=c._read);if(!c.push(e))return}}),c._destroy=function(e,a){e||null===u||(e=new y),s=null,n=null,i=null,null===u?a(e):(u=a,b(r,e),b(t,e))},c}e.exports=function e(t,r){if(d(t))return t;if(c(t))return I({readable:t});if(l(t))return I({writable:t});if(u(t))return I({writable:!1,readable:!1});if(h(t))return I({readable:_.fromWeb(t)});if(p(t))return I({writable:w.fromWeb(t)});if("function"==typeof t){const{value:e,write:i,final:a,destroy:o}=function(e){let{promise:t,resolve:r}=T();const i=new x,a=i.signal;return{value:e(async function*(){for(;;){const e=t;t=null;const{chunk:i,done:o,cb:s}=await e;if(n.nextTick(s),o)return;if(a.aborted)throw new y(void 0,{cause:a.reason});({promise:t,resolve:r}=T()),yield i}}(),{signal:a}),write(e,t,n){const i=r;r=null,i({chunk:e,done:!1,cb:n})},final(e){const t=r;r=null,t({done:!0,cb:e})},destroy(e,t){i.abort(),t(e)}}}(t);if(s(e))return S(R,e,{objectMode:!0,write:i,final:a,destroy:o});const u=null==e?void 0:e.then;if("function"==typeof u){let t;const r=A(u,e,(e=>{if(null!=e)throw new m("nully","body",e)}),(e=>{b(t,e)}));return t=new R({objectMode:!0,readable:!1,write:i,final(e){a((async()=>{try{await r,n.nextTick(e,null)}catch(t){n.nextTick(e,t)}}))},destroy:o})}throw new m("Iterable, AsyncIterable or AsyncFunction",r,e)}if(E(t))return e(t.arrayBuffer());if(s(t))return S(R,t,{objectMode:!0,writable:!1});if(h(null==t?void 0:t.readable)&&p(null==t?void 0:t.writable))return R.fromWeb(t);if("object"==typeof(null==t?void 0:t.writable)||"object"==typeof(null==t?void 0:t.readable))return I({readable:null!=t&&t.readable?c(null==t?void 0:t.readable)?null==t?void 0:t.readable:e(t.readable):void 0,writable:null!=t&&t.writable?l(null==t?void 0:t.writable)?null==t?void 0:t.writable:e(t.writable):void 0});const i=null==t?void 0:t.then;if("function"==typeof i){let e;return A(i,t,(t=>{null!=t&&e.push(t),e.push(null)}),(t=>{b(e,t)})),e=new R({objectMode:!0,writable:!1,read(){}})}throw new g(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],t)}},86238:(e,t,r)=>{const n=r(65606),{AbortError:i,codes:a}=r(76371),{ERR_INVALID_ARG_TYPE:o,ERR_STREAM_PREMATURE_CLOSE:s}=a,{kEmptyObject:u,once:c}=r(57760),{validateAbortSignal:l,validateFunction:d,validateObject:h,validateBoolean:p}=r(277),{Promise:f,PromisePrototypeThen:y,SymbolDispose:g}=r(24134),{isClosed:m,isReadable:b,isReadableNodeStream:v,isReadableStream:_,isReadableFinished:w,isReadableErrored:T,isWritable:S,isWritableNodeStream:O,isWritableStream:E,isWritableFinished:x,isWritableErrored:A,isNodeStream:R,willEmitClose:I,kIsClosedPromise:N}=r(16115);let j;const D=()=>{};function P(e,t,a){var p,f;if(2===arguments.length?(a=t,t=u):null==t?t=u:h(t,"options"),d(a,"callback"),l(t.signal,"options.signal"),a=c(a),_(e)||E(e))return function(e,t,a){let o=!1,s=D;if(t.signal)if(s=()=>{o=!0,a.call(e,new i(void 0,{cause:t.signal.reason}))},t.signal.aborted)n.nextTick(s);else{j=j||r(57760).addAbortListener;const n=j(t.signal,s),i=a;a=c(((...t)=>{n[g](),i.apply(e,t)}))}const u=(...t)=>{o||n.nextTick((()=>a.apply(e,t)))};return y(e[N].promise,u,u),D}(e,t,a);if(!R(e))throw new o("stream",["ReadableStream","WritableStream","Stream"],e);const P=null!==(p=t.readable)&&void 0!==p?p:v(e),C=null!==(f=t.writable)&&void 0!==f?f:O(e),L=e._writableState,k=e._readableState,M=()=>{e.writable||U()};let F=I(e)&&v(e)===P&&O(e)===C,B=x(e,!1);const U=()=>{B=!0,e.destroyed&&(F=!1),(!F||e.readable&&!P)&&(P&&!V||a.call(e))};let V=w(e,!1);const q=()=>{V=!0,e.destroyed&&(F=!1),(!F||e.writable&&!C)&&(C&&!B||a.call(e))},$=t=>{a.call(e,t)};let Q=m(e);const G=()=>{Q=!0;const t=A(e)||T(e);return t&&"boolean"!=typeof t?a.call(e,t):P&&!V&&v(e,!0)&&!w(e,!1)?a.call(e,new s):!C||B||x(e,!1)?void a.call(e):a.call(e,new s)},z=()=>{Q=!0;const t=A(e)||T(e);if(t&&"boolean"!=typeof t)return a.call(e,t);a.call(e)},H=()=>{e.req.on("finish",U)};!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?C&&!L&&(e.on("end",M),e.on("close",M)):(e.on("complete",U),F||e.on("abort",G),e.req?H():e.on("request",H)),F||"boolean"!=typeof e.aborted||e.on("aborted",G),e.on("end",q),e.on("finish",U),!1!==t.error&&e.on("error",$),e.on("close",G),Q?n.nextTick(G):null!=L&&L.errorEmitted||null!=k&&k.errorEmitted?F||n.nextTick(z):(P||F&&!b(e)||!B&&!1!==S(e))&&(C||F&&!S(e)||!V&&!1!==b(e))?k&&e.req&&e.aborted&&n.nextTick(z):n.nextTick(z);const X=()=>{a=D,e.removeListener("aborted",G),e.removeListener("complete",U),e.removeListener("abort",G),e.removeListener("request",H),e.req&&e.req.removeListener("finish",U),e.removeListener("end",M),e.removeListener("close",M),e.removeListener("finish",U),e.removeListener("end",q),e.removeListener("error",$),e.removeListener("close",G)};if(t.signal&&!Q){const o=()=>{const r=a;X(),r.call(e,new i(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)n.nextTick(o);else{j=j||r(57760).addAbortListener;const n=j(t.signal,o),i=a;a=c(((...t)=>{n[g](),i.apply(e,t)}))}}return X}e.exports=P,e.exports.finished=function(e,t){var r;let n=!1;return null===t&&(t=u),null!==(r=t)&&void 0!==r&&r.cleanup&&(p(t.cleanup,"cleanup"),n=t.cleanup),new f(((r,i)=>{const a=P(e,t,(e=>{n&&a(),e?i(e):r()}))}))}},96532:(e,t,r)=>{"use strict";const n=r(65606),{PromisePrototypeThen:i,SymbolAsyncIterator:a,SymbolIterator:o}=r(24134),{Buffer:s}=r(48287),{ERR_INVALID_ARG_TYPE:u,ERR_STREAM_NULL_VALUES:c}=r(76371).codes;e.exports=function(e,t,r){let l,d;if("string"==typeof t||t instanceof s)return new e({objectMode:!0,...r,read(){this.push(t),this.push(null)}});if(t&&t[a])d=!0,l=t[a]();else{if(!t||!t[o])throw new u("iterable",["Iterable"],t);d=!1,l=t[o]()}const h=new e({objectMode:!0,highWaterMark:1,...r});let p=!1;return h._read=function(){p||(p=!0,async function(){for(;;){try{const{value:e,done:t}=d?await l.next():l.next();if(t)h.push(null);else{const t=e&&"function"==typeof e.then?await e:e;if(null===t)throw p=!1,new c;if(h.push(t))continue;p=!1}}catch(e){h.destroy(e)}break}}())},h._destroy=function(e,t){i(async function(e){const t=null!=e,r="function"==typeof l.throw;if(t&&r){const{value:t,done:r}=await l.throw(e);if(await t,r)return}if("function"==typeof l.return){const{value:e}=await l.return();await e}}(e),(()=>n.nextTick(t,e)),(r=>n.nextTick(t,r||e)))},h}},94259:(e,t,r)=>{"use strict";const{ArrayIsArray:n,ObjectSetPrototypeOf:i}=r(24134),{EventEmitter:a}=r(37007);function o(e){a.call(this,e)}function s(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}i(o.prototype,a.prototype),i(o,a),o.prototype.pipe=function(e,t){const r=this;function n(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function i(){r.readable&&r.resume&&r.resume()}r.on("data",n),e.on("drain",i),e._isStdio||t&&!1===t.end||(r.on("end",u),r.on("close",c));let o=!1;function u(){o||(o=!0,e.end())}function c(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function l(e){d(),0===a.listenerCount(this,"error")&&this.emit("error",e)}function d(){r.removeListener("data",n),e.removeListener("drain",i),r.removeListener("end",u),r.removeListener("close",c),r.removeListener("error",l),e.removeListener("error",l),r.removeListener("end",d),r.removeListener("close",d),e.removeListener("close",d)}return s(r,"error",l),s(e,"error",l),r.on("end",d),r.on("close",d),e.on("close",d),e.emit("pipe",r),e},e.exports={Stream:o,prependListener:s}},60823:(e,t,r)=>{"use strict";const n=globalThis.AbortController||r(25568).AbortController,{codes:{ERR_INVALID_ARG_VALUE:i,ERR_INVALID_ARG_TYPE:a,ERR_MISSING_ARGS:o,ERR_OUT_OF_RANGE:s},AbortError:u}=r(76371),{validateAbortSignal:c,validateInteger:l,validateObject:d}=r(277),h=r(24134).Symbol("kWeak"),p=r(24134).Symbol("kResistStopPropagation"),{finished:f}=r(86238),y=r(47830),{addAbortSignalNoValidate:g}=r(4147),{isWritable:m,isNodeStream:b}=r(16115),{deprecate:v}=r(57760),{ArrayPrototypePush:_,Boolean:w,MathFloor:T,Number:S,NumberIsNaN:O,Promise:E,PromiseReject:x,PromiseResolve:A,PromisePrototypeThen:R,Symbol:I}=r(24134),N=I("kEmpty"),j=I("kEof");function D(e,t){if("function"!=typeof e)throw new a("fn",["Function","AsyncFunction"],e);null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&c(t.signal,"options.signal");let n=1;null!=(null==t?void 0:t.concurrency)&&(n=T(t.concurrency));let i=n-1;return null!=(null==t?void 0:t.highWaterMark)&&(i=T(t.highWaterMark)),l(n,"options.concurrency",1),l(i,"options.highWaterMark",0),i+=n,async function*(){const a=r(57760).AbortSignalAny([null==t?void 0:t.signal].filter(w)),o=this,s=[],c={signal:a};let l,d,h=!1,p=0;function f(){h=!0,y()}function y(){p-=1,g()}function g(){d&&!h&&p=i||p>=n)&&await new E((e=>{d=e}))}s.push(j)}catch(e){const t=x(e);R(t,y,f),s.push(t)}finally{h=!0,l&&(l(),l=null)}}();try{for(;;){for(;s.length>0;){const e=await s[0];if(e===j)return;if(a.aborted)throw new u;e!==N&&(yield e),s.shift(),g()}await new E((e=>{l=e}))}}finally{h=!0,d&&(d(),d=null)}}.call(this)}async function P(e,t=void 0){for await(const r of C.call(this,e,t))return!0;return!1}function C(e,t){if("function"!=typeof e)throw new a("fn",["Function","AsyncFunction"],e);return D.call(this,(async function(t,r){return await e(t,r)?t:N}),t)}class L extends o{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}function k(e){if(e=S(e),O(e))return 0;if(e<0)throw new s("number",">= 0",e);return e}e.exports.streamReturningOperators={asIndexedPairs:v((function(e=void 0){return null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&c(e.signal,"options.signal"),async function*(){let t=0;for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new u({cause:e.signal.reason});yield[t++,n]}}.call(this)}),"readable.asIndexedPairs will be removed in a future version."),drop:function(e,t=void 0){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&c(t.signal,"options.signal"),e=k(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new u;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new u;e--<=0&&(yield r)}}.call(this)},filter:C,flatMap:function(e,t){const r=D.call(this,e,t);return async function*(){for await(const e of r)yield*e}.call(this)},map:D,take:function(e,t=void 0){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&c(t.signal,"options.signal"),e=k(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new u;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new u;if(e-- >0&&(yield r),e<=0)return}}.call(this)},compose:function(e,t){if(null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&c(t.signal,"options.signal"),b(e)&&!m(e))throw new i("stream",e,"must be writable");const r=y(this,e);return null!=t&&t.signal&&g(t.signal,r),r}},e.exports.promiseReturningOperators={every:async function(e,t=void 0){if("function"!=typeof e)throw new a("fn",["Function","AsyncFunction"],e);return!await P.call(this,(async(...t)=>!await e(...t)),t)},forEach:async function(e,t){if("function"!=typeof e)throw new a("fn",["Function","AsyncFunction"],e);for await(const r of D.call(this,(async function(t,r){return await e(t,r),N}),t));},reduce:async function(e,t,r){var i;if("function"!=typeof e)throw new a("reducer",["Function","AsyncFunction"],e);null!=r&&d(r,"options"),null!=(null==r?void 0:r.signal)&&c(r.signal,"options.signal");let o=arguments.length>1;if(null!=r&&null!==(i=r.signal)&&void 0!==i&&i.aborted){const e=new u(void 0,{cause:r.signal.reason});throw this.once("error",(()=>{})),await f(this.destroy(e)),e}const s=new n,l=s.signal;if(null!=r&&r.signal){const e={once:!0,[h]:this,[p]:!0};r.signal.addEventListener("abort",(()=>s.abort()),e)}let y=!1;try{for await(const n of this){var g;if(y=!0,null!=r&&null!==(g=r.signal)&&void 0!==g&&g.aborted)throw new u;o?t=await e(t,n,{signal:l}):(t=n,o=!0)}if(!y&&!o)throw new L}finally{s.abort()}return t},toArray:async function(e){null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&c(e.signal,"options.signal");const t=[];for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new u(void 0,{cause:e.signal.reason});_(t,n)}return t},some:P,find:async function(e,t){for await(const r of C.call(this,e,t))return r}}},86524:(e,t,r)=>{"use strict";const{ObjectSetPrototypeOf:n}=r(24134);e.exports=a;const i=r(17382);function a(e){if(!(this instanceof a))return new a(e);i.call(this,e)}n(a.prototype,i.prototype),n(a,i),a.prototype._transform=function(e,t,r){r(null,e)}},57758:(e,t,r)=>{const n=r(65606),{ArrayIsArray:i,Promise:a,SymbolAsyncIterator:o,SymbolDispose:s}=r(24134),u=r(86238),{once:c}=r(57760),l=r(75896),d=r(93370),{aggregateTwoErrors:h,codes:{ERR_INVALID_ARG_TYPE:p,ERR_INVALID_RETURN_VALUE:f,ERR_MISSING_ARGS:y,ERR_STREAM_DESTROYED:g,ERR_STREAM_PREMATURE_CLOSE:m},AbortError:b}=r(76371),{validateFunction:v,validateAbortSignal:_}=r(277),{isIterable:w,isReadable:T,isReadableNodeStream:S,isNodeStream:O,isTransformStream:E,isWebStream:x,isReadableStream:A,isReadableFinished:R}=r(16115),I=globalThis.AbortController||r(25568).AbortController;let N,j,D;function P(e,t,r){let n=!1;return e.on("close",(()=>{n=!0})),{destroy:t=>{n||(n=!0,l.destroyer(e,t||new g("pipe")))},cleanup:u(e,{readable:t,writable:r},(e=>{n=!e}))}}function C(e){if(w(e))return e;if(S(e))return async function*(e){j||(j=r(57576)),yield*j.prototype[o].call(e)}(e);throw new p("val",["Readable","Iterable","AsyncIterable"],e)}async function L(e,t,r,{end:n}){let i,o=null;const s=e=>{if(e&&(i=e),o){const e=o;o=null,e()}},c=()=>new a(((e,t)=>{i?t(i):o=()=>{i?t(i):e()}}));t.on("drain",s);const l=u(t,{readable:!1},s);try{t.writableNeedDrain&&await c();for await(const r of e)t.write(r)||await c();n&&(t.end(),await c()),r()}catch(e){r(i!==e?h(i,e):e)}finally{l(),t.off("drain",s)}}async function k(e,t,r,{end:n}){E(t)&&(t=t.writable);const i=t.getWriter();try{for await(const t of e)await i.ready,i.write(t).catch((()=>{}));await i.ready,n&&await i.close(),r()}catch(e){try{await i.abort(e),r(e)}catch(e){r(e)}}}function M(e,t,a){if(1===e.length&&i(e[0])&&(e=e[0]),e.length<2)throw new y("streams");const o=new I,u=o.signal,c=null==a?void 0:a.signal,l=[];function h(){U(new b)}let g,m,v;_(c,"options.signal"),D=D||r(57760).addAbortListener,c&&(g=D(c,h));const R=[];let j,M=0;function B(e){U(e,0==--M)}function U(e,r){var i;if(!e||m&&"ERR_STREAM_PREMATURE_CLOSE"!==m.code||(m=e),m||r){for(;R.length;)R.shift()(m);null===(i=g)||void 0===i||i[s](),o.abort(),r&&(m||l.forEach((e=>e())),n.nextTick(t,m,v))}}for(let Q=0;Q0,X=z||!1!==(null==a?void 0:a.end),J=Q===e.length-1;if(O(G)){if(X){const{destroy:K,cleanup:W}=P(G,z,H);R.push(K),T(G)&&J&&l.push(W)}function V(e){e&&"AbortError"!==e.name&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code&&B(e)}G.on("error",V),T(G)&&J&&l.push((()=>{G.removeListener("error",V)}))}if(0===Q)if("function"==typeof G){if(j=G({signal:u}),!w(j))throw new f("Iterable, AsyncIterable or Stream","source",j)}else j=w(G)||S(G)||E(G)?G:d.from(G);else if("function"==typeof G){var q;if(j=E(j)?C(null===(q=j)||void 0===q?void 0:q.readable):C(j),j=G(j,{signal:u}),z){if(!w(j,!0))throw new f("AsyncIterable",`transform[${Q-1}]`,j)}else{var $;N||(N=r(86524));const Y=new N({objectMode:!0}),Z=null===($=j)||void 0===$?void 0:$.then;if("function"==typeof Z)M++,Z.call(j,(e=>{v=e,null!=e&&Y.write(e),X&&Y.end(),n.nextTick(B)}),(e=>{Y.destroy(e),n.nextTick(B,e)}));else if(w(j,!0))M++,L(j,Y,B,{end:X});else{if(!A(j)&&!E(j))throw new f("AsyncIterable or Promise","destination",j);{const re=j.readable||j;M++,L(re,Y,B,{end:X})}}j=Y;const{destroy:ee,cleanup:te}=P(j,!1,!0);R.push(ee),J&&l.push(te)}}else if(O(G)){if(S(j)){M+=2;const ne=F(j,G,B,{end:X});T(G)&&J&&l.push(ne)}else if(E(j)||A(j)){const ie=j.readable||j;M++,L(ie,G,B,{end:X})}else{if(!w(j))throw new p("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],j);M++,L(j,G,B,{end:X})}j=G}else if(x(G)){if(S(j))M++,k(C(j),G,B,{end:X});else if(A(j)||w(j))M++,k(j,G,B,{end:X});else{if(!E(j))throw new p("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],j);M++,k(j.readable,G,B,{end:X})}j=G}else j=d.from(G)}return(null!=u&&u.aborted||null!=c&&c.aborted)&&n.nextTick(h),j}function F(e,t,r,{end:i}){let a=!1;if(t.on("close",(()=>{a||r(new m)})),e.pipe(t,{end:!1}),i){function o(){a=!0,t.end()}R(e)?n.nextTick(o):e.once("end",o)}else r();return u(e,{readable:!0,writable:!1},(t=>{const n=e._readableState;t&&"ERR_STREAM_PREMATURE_CLOSE"===t.code&&n&&n.ended&&!n.errored&&!n.errorEmitted?e.once("end",r).once("error",r):r(t)})),u(t,{readable:!1,writable:!0},r)}e.exports={pipelineImpl:M,pipeline:function(...e){return M(e,c(function(e){return v(e[e.length-1],"streams[stream.length - 1]"),e.pop()}(e)))}}},57576:(e,t,r)=>{const n=r(65606),{ArrayPrototypeIndexOf:i,NumberIsInteger:a,NumberIsNaN:o,NumberParseInt:s,ObjectDefineProperties:u,ObjectKeys:c,ObjectSetPrototypeOf:l,Promise:d,SafeSet:h,SymbolAsyncDispose:p,SymbolAsyncIterator:f,Symbol:y}=r(24134);e.exports=J,J.ReadableState=X;const{EventEmitter:g}=r(37007),{Stream:m,prependListener:b}=r(94259),{Buffer:v}=r(48287),{addAbortSignal:_}=r(4147),w=r(86238);let T=r(57760).debuglog("stream",(e=>{T=e}));const S=r(80345),O=r(75896),{getHighWaterMark:E,getDefaultHighWaterMark:x}=r(65291),{aggregateTwoErrors:A,codes:{ERR_INVALID_ARG_TYPE:R,ERR_METHOD_NOT_IMPLEMENTED:I,ERR_OUT_OF_RANGE:N,ERR_STREAM_PUSH_AFTER_EOF:j,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:D},AbortError:P}=r(76371),{validateObject:C}=r(277),L=y("kPaused"),{StringDecoder:k}=r(83141),M=r(96532);l(J.prototype,m.prototype),l(J,m);const F=()=>{},{errorOrDestroy:B}=O,U=1,V=16,q=32,$=64,Q=2048,G=4096,z=65536;function H(e){return{enumerable:!1,get(){return!!(this.state&e)},set(t){t?this.state|=e:this.state&=~e}}}function X(e,t,n){"boolean"!=typeof n&&(n=t instanceof r(93370)),this.state=Q|G|V|q,e&&e.objectMode&&(this.state|=U),n&&e&&e.readableObjectMode&&(this.state|=U),this.highWaterMark=e?E(this,e,"readableHighWaterMark",n):x(!1),this.buffer=new S,this.length=0,this.pipes=[],this.flowing=null,this[L]=null,e&&!1===e.emitClose&&(this.state&=~Q),e&&!1===e.autoDestroy&&(this.state&=~G),this.errored=null,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,e&&e.encoding&&(this.decoder=new k(e.encoding),this.encoding=e.encoding)}function J(e){if(!(this instanceof J))return new J(e);const t=this instanceof r(93370);this._readableState=new X(e,this,t),e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.construct&&(this._construct=e.construct),e.signal&&!t&&_(e.signal,this)),m.call(this,e),O.construct(this,(()=>{this._readableState.needReadable&&te(this,this._readableState)}))}function K(e,t,r,n){T("readableAddChunk",t);const i=e._readableState;let a;if(i.state&U||("string"==typeof t?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?t=v.from(t,r).toString(i.encoding):(t=v.from(t,r),r=""))):t instanceof v?r="":m._isUint8Array(t)?(t=m._uint8ArrayToBuffer(t),r=""):null!=t&&(a=new R("chunk",["string","Buffer","Uint8Array"],t))),a)B(e,a);else if(null===t)i.state&=-9,function(e,t){if(T("onEofChunk"),!t.ended){if(t.decoder){const e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length)}t.ended=!0,t.sync?Z(e):(t.needReadable=!1,t.emittedReadable=!0,ee(e))}}(e,i);else if(i.state&U||t&&t.length>0)if(n)if(4&i.state)B(e,new D);else{if(i.destroyed||i.errored)return!1;W(e,i,t,!0)}else if(i.ended)B(e,new j);else{if(i.destroyed||i.errored)return!1;i.state&=-9,i.decoder&&!r?(t=i.decoder.write(t),i.objectMode||0!==t.length?W(e,i,t,!1):te(e,i)):W(e,i,t,!1)}else n||(i.state&=-9,te(e,i));return!i.ended&&(i.length0?(t.state&z?t.awaitDrainWriters.clear():t.awaitDrainWriters=null,t.dataEmitted=!0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.state&$&&Z(e)),te(e,t)}function Y(e,t){return e<=0||0===t.length&&t.ended?0:t.state&U?1:o(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0}function Z(e){const t=e._readableState;T("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(T("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(ee,e))}function ee(e){const t=e._readableState;T("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||t.errored||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,oe(e)}function te(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,n.nextTick(re,e,t))}function re(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!1===t[L]?t.flowing=!0:e.listenerCount("data")>0?e.resume():t.readableListening||(t.flowing=null)}function ie(e){T("readable nexttick read 0"),e.read(0)}function ae(e,t){T("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),oe(e),t.flowing&&!t.reading&&e.read(0)}function oe(e){const t=e._readableState;for(T("flow",t.flowing);t.flowing&&null!==e.read(););}function se(e,t){"function"!=typeof e.read&&(e=J.wrap(e,{objectMode:!0}));const r=async function*(e,t){let r,n=F;function i(t){this===e?(n(),n=F):n=t}e.on("readable",i);const a=w(e,{writable:!1},(e=>{r=e?A(r,e):null,n(),n=F}));try{for(;;){const t=e.destroyed?null:e.read();if(null!==t)yield t;else{if(r)throw r;if(null===r)return;await new d(i)}}}catch(e){throw r=A(r,e),r}finally{!r&&!1===(null==t?void 0:t.destroyOnReturn)||void 0!==r&&!e._readableState.autoDestroy?(e.off("readable",i),a()):O.destroyer(e,null)}}(e,t);return r.stream=e,r}function ue(e,t){if(0===t.length)return null;let r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}function ce(e){const t=e._readableState;T("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(le,t,e))}function le(e,t){if(T("endReadableNT",e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&0===e.length)if(e.endEmitted=!0,t.emit("end"),t.writable&&!1===t.allowHalfOpen)n.nextTick(de,t);else if(e.autoDestroy){const e=t._writableState;(!e||e.autoDestroy&&(e.finished||!1===e.writable))&&t.destroy()}}function de(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end()}let he;function pe(){return void 0===he&&(he={}),he}u(X.prototype,{objectMode:H(U),ended:H(2),endEmitted:H(4),reading:H(8),constructed:H(V),sync:H(q),needReadable:H($),emittedReadable:H(128),readableListening:H(256),resumeScheduled:H(512),errorEmitted:H(1024),emitClose:H(Q),autoDestroy:H(G),destroyed:H(8192),closed:H(16384),closeEmitted:H(32768),multiAwaitDrain:H(z),readingMore:H(1<<17),dataEmitted:H(1<<18)}),J.prototype.destroy=O.destroy,J.prototype._undestroy=O.undestroy,J.prototype._destroy=function(e,t){t(e)},J.prototype[g.captureRejectionSymbol]=function(e){this.destroy(e)},J.prototype[p]=function(){let e;return this.destroyed||(e=this.readableEnded?null:new P,this.destroy(e)),new d(((t,r)=>w(this,(n=>n&&n!==e?r(n):t(null)))))},J.prototype.push=function(e,t){return K(this,e,t,!1)},J.prototype.unshift=function(e,t){return K(this,e,t,!0)},J.prototype.isPaused=function(){const e=this._readableState;return!0===e[L]||!1===e.flowing},J.prototype.setEncoding=function(e){const t=new k(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;const r=this._readableState.buffer;let n="";for(const e of r)n+=t.write(e);return r.clear(),""!==n&&r.push(n),this._readableState.length=n.length,this},J.prototype.read=function(e){T("read",e),void 0===e?e=NaN:a(e)||(e=s(e,10));const t=this._readableState,r=e;if(e>t.highWaterMark&&(t.highWaterMark=function(e){if(e>1073741824)throw new N("size","<= 1GiB",e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,++e}(e)),0!==e&&(t.state&=-129),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return T("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?ce(this):Z(this),null;if(0===(e=Y(e,t))&&t.ended)return 0===t.length&&ce(this),null;let n,i=!!(t.state&$);if(T("need readable",i),(0===t.length||t.length-e0?ue(e,t):null,null===n?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&ce(this)),null===n||t.errorEmitted||t.closeEmitted||(t.dataEmitted=!0,this.emit("data",n)),n},J.prototype._read=function(e){throw new I("_read()")},J.prototype.pipe=function(e,t){const r=this,i=this._readableState;1===i.pipes.length&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new h(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(e),T("pipe count=%d opts=%j",i.pipes.length,t);const a=t&&!1===t.end||e===n.stdout||e===n.stderr?y:o;function o(){T("onend"),e.end()}let s;i.endEmitted?n.nextTick(a):r.once("end",a),e.on("unpipe",(function t(n,a){T("onunpipe"),n===r&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,T("cleanup"),e.removeListener("close",p),e.removeListener("finish",f),s&&e.removeListener("drain",s),e.removeListener("error",d),e.removeListener("unpipe",t),r.removeListener("end",o),r.removeListener("end",y),r.removeListener("data",l),u=!0,s&&i.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&s())}));let u=!1;function c(){u||(1===i.pipes.length&&i.pipes[0]===e?(T("false write response, pause",0),i.awaitDrainWriters=e,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(e)&&(T("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(e)),r.pause()),s||(s=function(e,t){return function(){const r=e._readableState;r.awaitDrainWriters===t?(T("pipeOnDrain",1),r.awaitDrainWriters=null):r.multiAwaitDrain&&(T("pipeOnDrain",r.awaitDrainWriters.size),r.awaitDrainWriters.delete(t)),r.awaitDrainWriters&&0!==r.awaitDrainWriters.size||!e.listenerCount("data")||e.resume()}}(r,e),e.on("drain",s))}function l(t){T("ondata");const r=e.write(t);T("dest.write",r),!1===r&&c()}function d(t){if(T("onerror",t),y(),e.removeListener("error",d),0===e.listenerCount("error")){const r=e._writableState||e._readableState;r&&!r.errorEmitted?B(e,t):e.emit("error",t)}}function p(){e.removeListener("finish",f),y()}function f(){T("onfinish"),e.removeListener("close",p),y()}function y(){T("unpipe"),r.unpipe(e)}return r.on("data",l),b(e,"error",d),e.once("close",p),e.once("finish",f),e.emit("pipe",r),!0===e.writableNeedDrain?c():i.flowing||(T("pipe resume"),r.resume()),e},J.prototype.unpipe=function(e){const t=this._readableState;if(0===t.pipes.length)return this;if(!e){const e=t.pipes;t.pipes=[],this.pause();for(let t=0;t0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,T("on readable",i.length,i.reading),i.length?Z(this):i.reading||n.nextTick(ie,this))),r},J.prototype.addListener=J.prototype.on,J.prototype.removeListener=function(e,t){const r=m.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(ne,this),r},J.prototype.off=J.prototype.removeListener,J.prototype.removeAllListeners=function(e){const t=m.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(ne,this),t},J.prototype.resume=function(){const e=this._readableState;return e.flowing||(T("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(ae,e,t))}(this,e)),e[L]=!1,this},J.prototype.pause=function(){return T("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(T("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[L]=!0,this},J.prototype.wrap=function(e){let t=!1;e.on("data",(r=>{!this.push(r)&&e.pause&&(t=!0,e.pause())})),e.on("end",(()=>{this.push(null)})),e.on("error",(e=>{B(this,e)})),e.on("close",(()=>{this.destroy()})),e.on("destroy",(()=>{this.destroy()})),this._read=()=>{t&&e.resume&&(t=!1,e.resume())};const r=c(e);for(let t=1;t{"use strict";const{MathFloor:n,NumberIsInteger:i}=r(24134),{validateInteger:a}=r(277),{ERR_INVALID_ARG_VALUE:o}=r(76371).codes;let s=16384,u=16;function c(e){return e?u:s}e.exports={getHighWaterMark:function(e,t,r,a){const s=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,a,r);if(null!=s){if(!i(s)||s<0)throw new o(a?`options.${r}`:"options.highWaterMark",s);return n(s)}return c(e.objectMode)},getDefaultHighWaterMark:c,setDefaultHighWaterMark:function(e,t){a(t,"value",0),e?u=t:s=t}}},17382:(e,t,r)=>{"use strict";const{ObjectSetPrototypeOf:n,Symbol:i}=r(24134);e.exports=c;const{ERR_METHOD_NOT_IMPLEMENTED:a}=r(76371).codes,o=r(93370),{getHighWaterMark:s}=r(65291);n(c.prototype,o.prototype),n(c,o);const u=i("kCallback");function c(e){if(!(this instanceof c))return new c(e);const t=e?s(this,e,"readableHighWaterMark",!0):null;0===t&&(e={...e,highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0}),o.call(this,e),this._readableState.sync=!1,this[u]=null,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",d)}function l(e){"function"!=typeof this._flush||this.destroyed?(this.push(null),e&&e()):this._flush(((t,r)=>{t?e?e(t):this.destroy(t):(null!=r&&this.push(r),this.push(null),e&&e())}))}function d(){this._final!==l&&l.call(this)}c.prototype._final=l,c.prototype._transform=function(e,t,r){throw new a("_transform()")},c.prototype._write=function(e,t,r){const n=this._readableState,i=this._writableState,a=n.length;this._transform(e,t,((e,t)=>{e?r(e):(null!=t&&this.push(t),i.ended||a===n.length||n.length{"use strict";const{SymbolAsyncIterator:n,SymbolIterator:i,SymbolFor:a}=r(24134),o=a("nodejs.stream.destroyed"),s=a("nodejs.stream.errored"),u=a("nodejs.stream.readable"),c=a("nodejs.stream.writable"),l=a("nodejs.stream.disturbed"),d=a("nodejs.webstream.isClosedPromise"),h=a("nodejs.webstream.controllerErrorFunction");function p(e,t=!1){var r;return!(!e||"function"!=typeof e.pipe||"function"!=typeof e.on||t&&("function"!=typeof e.pause||"function"!=typeof e.resume)||e._writableState&&!1===(null===(r=e._readableState)||void 0===r?void 0:r.readable)||e._writableState&&!e._readableState)}function f(e){var t;return!(!e||"function"!=typeof e.write||"function"!=typeof e.on||e._readableState&&!1===(null===(t=e._writableState)||void 0===t?void 0:t.writable))}function y(e){return e&&(e._readableState||e._writableState||"function"==typeof e.write&&"function"==typeof e.on||"function"==typeof e.pipe&&"function"==typeof e.on)}function g(e){return!(!e||y(e)||"function"!=typeof e.pipeThrough||"function"!=typeof e.getReader||"function"!=typeof e.cancel)}function m(e){return!(!e||y(e)||"function"!=typeof e.getWriter||"function"!=typeof e.abort)}function b(e){return!(!e||y(e)||"object"!=typeof e.readable||"object"!=typeof e.writable)}function v(e){if(!y(e))return null;const t=e._writableState,r=e._readableState,n=t||r;return!!(e.destroyed||e[o]||null!=n&&n.destroyed)}function _(e){if(!f(e))return null;if(!0===e.writableEnded)return!0;const t=e._writableState;return(null==t||!t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)}function w(e,t){if(!p(e))return null;const r=e._readableState;return(null==r||!r.errored)&&("boolean"!=typeof(null==r?void 0:r.endEmitted)?null:!!(r.endEmitted||!1===t&&!0===r.ended&&0===r.length))}function T(e){return e&&null!=e[u]?e[u]:"boolean"!=typeof(null==e?void 0:e.readable)?null:!v(e)&&p(e)&&e.readable&&!w(e)}function S(e){return e&&null!=e[c]?e[c]:"boolean"!=typeof(null==e?void 0:e.writable)?null:!v(e)&&f(e)&&e.writable&&!_(e)}function O(e){return"boolean"==typeof e._closed&&"boolean"==typeof e._defaultKeepAlive&&"boolean"==typeof e._removedConnection&&"boolean"==typeof e._removedContLen}function E(e){return"boolean"==typeof e._sent100&&O(e)}e.exports={isDestroyed:v,kIsDestroyed:o,isDisturbed:function(e){var t;return!(!e||!(null!==(t=e[l])&&void 0!==t?t:e.readableDidRead||e.readableAborted))},kIsDisturbed:l,isErrored:function(e){var t,r,n,i,a,o,u,c,l,d;return!(!e||!(null!==(t=null!==(r=null!==(n=null!==(i=null!==(a=null!==(o=e[s])&&void 0!==o?o:e.readableErrored)&&void 0!==a?a:e.writableErrored)&&void 0!==i?i:null===(u=e._readableState)||void 0===u?void 0:u.errorEmitted)&&void 0!==n?n:null===(c=e._writableState)||void 0===c?void 0:c.errorEmitted)&&void 0!==r?r:null===(l=e._readableState)||void 0===l?void 0:l.errored)&&void 0!==t?t:null===(d=e._writableState)||void 0===d?void 0:d.errored))},kIsErrored:s,isReadable:T,kIsReadable:u,kIsClosedPromise:d,kControllerErrorFunction:h,kIsWritable:c,isClosed:function(e){if(!y(e))return null;if("boolean"==typeof e.closed)return e.closed;const t=e._writableState,r=e._readableState;return"boolean"==typeof(null==t?void 0:t.closed)||"boolean"==typeof(null==r?void 0:r.closed)?(null==t?void 0:t.closed)||(null==r?void 0:r.closed):"boolean"==typeof e._closed&&O(e)?e._closed:null},isDuplexNodeStream:function(e){return!(!e||"function"!=typeof e.pipe||!e._readableState||"function"!=typeof e.on||"function"!=typeof e.write)},isFinished:function(e,t){return y(e)?!(!v(e)&&(!1!==(null==t?void 0:t.readable)&&T(e)||!1!==(null==t?void 0:t.writable)&&S(e))):null},isIterable:function(e,t){return null!=e&&(!0===t?"function"==typeof e[n]:!1===t?"function"==typeof e[i]:"function"==typeof e[n]||"function"==typeof e[i])},isReadableNodeStream:p,isReadableStream:g,isReadableEnded:function(e){if(!p(e))return null;if(!0===e.readableEnded)return!0;const t=e._readableState;return!(!t||t.errored)&&("boolean"!=typeof(null==t?void 0:t.ended)?null:t.ended)},isReadableFinished:w,isReadableErrored:function(e){var t,r;return y(e)?e.readableErrored?e.readableErrored:null!==(t=null===(r=e._readableState)||void 0===r?void 0:r.errored)&&void 0!==t?t:null:null},isNodeStream:y,isWebStream:function(e){return g(e)||m(e)||b(e)},isWritable:S,isWritableNodeStream:f,isWritableStream:m,isWritableEnded:_,isWritableFinished:function(e,t){if(!f(e))return null;if(!0===e.writableFinished)return!0;const r=e._writableState;return(null==r||!r.errored)&&("boolean"!=typeof(null==r?void 0:r.finished)?null:!!(r.finished||!1===t&&!0===r.ended&&0===r.length))},isWritableErrored:function(e){var t,r;return y(e)?e.writableErrored?e.writableErrored:null!==(t=null===(r=e._writableState)||void 0===r?void 0:r.errored)&&void 0!==t?t:null:null},isServerRequest:function(e){var t;return"boolean"==typeof e._consuming&&"boolean"==typeof e._dumped&&void 0===(null===(t=e.req)||void 0===t?void 0:t.upgradeOrConnect)},isServerResponse:E,willEmitClose:function(e){if(!y(e))return null;const t=e._writableState,r=e._readableState,n=t||r;return!n&&E(e)||!!(n&&n.autoDestroy&&n.emitClose&&!1===n.closed)},isTransformStream:b}},78584:(e,t,r)=>{const n=r(65606),{ArrayPrototypeSlice:i,Error:a,FunctionPrototypeSymbolHasInstance:o,ObjectDefineProperty:s,ObjectDefineProperties:u,ObjectSetPrototypeOf:c,StringPrototypeToLowerCase:l,Symbol:d,SymbolHasInstance:h}=r(24134);e.exports=C,C.WritableState=D;const{EventEmitter:p}=r(37007),f=r(94259).Stream,{Buffer:y}=r(48287),g=r(75896),{addAbortSignal:m}=r(4147),{getHighWaterMark:b,getDefaultHighWaterMark:v}=r(65291),{ERR_INVALID_ARG_TYPE:_,ERR_METHOD_NOT_IMPLEMENTED:w,ERR_MULTIPLE_CALLBACK:T,ERR_STREAM_CANNOT_PIPE:S,ERR_STREAM_DESTROYED:O,ERR_STREAM_ALREADY_FINISHED:E,ERR_STREAM_NULL_VALUES:x,ERR_STREAM_WRITE_AFTER_END:A,ERR_UNKNOWN_ENCODING:R}=r(76371).codes,{errorOrDestroy:I}=g;function N(){}c(C.prototype,f.prototype),c(C,f);const j=d("kOnFinished");function D(e,t,n){"boolean"!=typeof n&&(n=t instanceof r(93370)),this.objectMode=!(!e||!e.objectMode),n&&(this.objectMode=this.objectMode||!(!e||!e.writableObjectMode)),this.highWaterMark=e?b(this,e,"writableHighWaterMark",n):v(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const i=!(!e||!1!==e.decodeStrings);this.decodeStrings=!i,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=F.bind(void 0,t),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,P(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!e||!1!==e.emitClose,this.autoDestroy=!e||!1!==e.autoDestroy,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[j]=[]}function P(e){e.buffered=[],e.bufferedIndex=0,e.allBuffers=!0,e.allNoop=!0}function C(e){const t=this instanceof r(93370);if(!t&&!o(C,this))return new C(e);this._writableState=new D(e,this,t),e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final),"function"==typeof e.construct&&(this._construct=e.construct),e.signal&&m(e.signal,this)),f.call(this,e),g.construct(this,(()=>{const e=this._writableState;e.writing||q(this,e),Q(this,e)}))}function L(e,t,r,i){const a=e._writableState;if("function"==typeof r)i=r,r=a.defaultEncoding;else{if(r){if("buffer"!==r&&!y.isEncoding(r))throw new R(r)}else r=a.defaultEncoding;"function"!=typeof i&&(i=N)}if(null===t)throw new x;if(!a.objectMode)if("string"==typeof t)!1!==a.decodeStrings&&(t=y.from(t,r),r="buffer");else if(t instanceof y)r="buffer";else{if(!f._isUint8Array(t))throw new _("chunk",["string","Buffer","Uint8Array"],t);t=f._uint8ArrayToBuffer(t),r="buffer"}let o;return a.ending?o=new A:a.destroyed&&(o=new O("write")),o?(n.nextTick(i,o),I(e,o,!0),o):(a.pendingcb++,function(e,t,r,n,i){const a=t.objectMode?1:r.length;t.length+=a;const o=t.lengthr.bufferedIndex&&q(e,r),i?null!==r.afterWriteTickInfo&&r.afterWriteTickInfo.cb===a?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:a,stream:e,state:r},n.nextTick(B,r.afterWriteTickInfo)):U(e,r,1,a))):I(e,new T)}function B({stream:e,state:t,count:r,cb:n}){return t.afterWriteTickInfo=null,U(e,t,r,n)}function U(e,t,r,n){for(!t.ending&&!e.destroyed&&0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"));r-- >0;)t.pendingcb--,n();t.destroyed&&V(t),Q(e,t)}function V(e){if(e.writing)return;for(let r=e.bufferedIndex;r1&&e._writev){t.pendingcb-=o-1;const n=t.allNoop?N:e=>{for(let t=s;t256?(r.splice(0,s),t.bufferedIndex=0):t.bufferedIndex=s}t.bufferProcessing=!1}function $(e){return e.ending&&!e.destroyed&&e.constructed&&0===e.length&&!e.errored&&0===e.buffered.length&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function Q(e,t,r){$(t)&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.finalCalled=!0,function(e,t){let r=!1;function i(i){if(r)I(e,null!=i?i:T());else if(r=!0,t.pendingcb--,i){const r=t[j].splice(0);for(let e=0;e{$(t)?G(e,t):t.pendingcb--}),e,t)):$(t)&&(t.pendingcb++,G(e,t))))}function G(e,t){t.pendingcb--,t.finished=!0;const r=t[j].splice(0);for(let e=0;e{"use strict";const{ArrayIsArray:n,ArrayPrototypeIncludes:i,ArrayPrototypeJoin:a,ArrayPrototypeMap:o,NumberIsInteger:s,NumberIsNaN:u,NumberMAX_SAFE_INTEGER:c,NumberMIN_SAFE_INTEGER:l,NumberParseInt:d,ObjectPrototypeHasOwnProperty:h,RegExpPrototypeExec:p,String:f,StringPrototypeToUpperCase:y,StringPrototypeTrim:g}=r(24134),{hideStackFrames:m,codes:{ERR_SOCKET_BAD_PORT:b,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:_,ERR_OUT_OF_RANGE:w,ERR_UNKNOWN_SIGNAL:T}}=r(76371),{normalizeEncoding:S}=r(57760),{isAsyncFunction:O,isArrayBufferView:E}=r(57760).types,x={},A=/^[0-7]+$/,R=m(((e,t,r=l,n=c)=>{if("number"!=typeof e)throw new v(t,"number",e);if(!s(e))throw new w(t,"an integer",e);if(en)throw new w(t,`>= ${r} && <= ${n}`,e)})),I=m(((e,t,r=-2147483648,n=2147483647)=>{if("number"!=typeof e)throw new v(t,"number",e);if(!s(e))throw new w(t,"an integer",e);if(en)throw new w(t,`>= ${r} && <= ${n}`,e)})),N=m(((e,t,r=!1)=>{if("number"!=typeof e)throw new v(t,"number",e);if(!s(e))throw new w(t,"an integer",e);const n=r?1:0,i=4294967295;if(ei)throw new w(t,`>= ${n} && <= ${i}`,e)}));function j(e,t){if("string"!=typeof e)throw new v(t,"string",e)}const D=m(((e,t,r)=>{if(!i(r,e)){const n=a(o(r,(e=>"string"==typeof e?`'${e}'`:f(e))),", ");throw new _(t,e,"must be one of: "+n)}}));function P(e,t){if("boolean"!=typeof e)throw new v(t,"boolean",e)}function C(e,t,r){return null!=e&&h(e,t)?e[t]:r}const L=m(((e,t,r=null)=>{const i=C(r,"allowArray",!1),a=C(r,"allowFunction",!1);if(!C(r,"nullable",!1)&&null===e||!i&&n(e)||"object"!=typeof e&&(!a||"function"!=typeof e))throw new v(t,"Object",e)})),k=m(((e,t)=>{if(null!=e&&"object"!=typeof e&&"function"!=typeof e)throw new v(t,"a dictionary",e)})),M=m(((e,t,r=0)=>{if(!n(e))throw new v(t,"Array",e);if(e.length{if(!E(e))throw new v(t,["Buffer","TypedArray","DataView"],e)})),B=m(((e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new v(t,"AbortSignal",e)})),U=m(((e,t)=>{if("function"!=typeof e)throw new v(t,"Function",e)})),V=m(((e,t)=>{if("function"!=typeof e||O(e))throw new v(t,"Function",e)})),q=m(((e,t)=>{if(void 0!==e)throw new v(t,"undefined",e)})),$=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function Q(e,t){if(void 0===e||!p($,e))throw new _(t,e,'must be an array or string of format "; rel=preload; as=style"')}e.exports={isInt32:function(e){return e===(0|e)},isUint32:function(e){return e===e>>>0},parseFileMode:function(e,t,r){if(void 0===e&&(e=r),"string"==typeof e){if(null===p(A,e))throw new _(t,e,"must be a 32-bit unsigned integer or an octal string");e=d(e,8)}return N(e,t),e},validateArray:M,validateStringArray:function(e,t){M(e,t);for(let r=0;rn||(null!=r||null!=n)&&u(e))throw new w(t,`${null!=r?`>= ${r}`:""}${null!=r&&null!=n?" && ":""}${null!=n?`<= ${n}`:""}`,e)},validateObject:L,validateOneOf:D,validatePlainFunction:V,validatePort:function(e,t="Port",r=!0){if("number"!=typeof e&&"string"!=typeof e||"string"==typeof e&&0===g(e).length||+e!=+e>>>0||e>65535||0===e&&!r)throw new b(t,e,r);return 0|e},validateSignalName:function(e,t="signal"){if(j(e,t),void 0===x[e]){if(void 0!==x[y(e)])throw new T(e+" (signals must use all capital letters)");throw new T(e)}},validateString:j,validateUint32:N,validateUndefined:q,validateUnion:function(e,t,r){if(!i(r,e))throw new v(t,`('${a(r,"|")}')`,e)},validateAbortSignal:B,validateLinkHeaderValue:function(e){if("string"==typeof e)return Q(e,"hints"),e;if(n(e)){const t=e.length;let r="";if(0===t)return r;for(let n=0;n; rel=preload; as=style"')}}},19198:(e,t,r)=>{"use strict";const n=r(63125),i=r(43095),a=n.Readable.destroy;e.exports=n.Readable,e.exports._uint8ArrayToBuffer=n._uint8ArrayToBuffer,e.exports._isUint8Array=n._isUint8Array,e.exports.isDisturbed=n.isDisturbed,e.exports.isErrored=n.isErrored,e.exports.isReadable=n.isReadable,e.exports.Readable=n.Readable,e.exports.Writable=n.Writable,e.exports.Duplex=n.Duplex,e.exports.Transform=n.Transform,e.exports.PassThrough=n.PassThrough,e.exports.addAbortSignal=n.addAbortSignal,e.exports.finished=n.finished,e.exports.destroy=n.destroy,e.exports.destroy=a,e.exports.pipeline=n.pipeline,e.exports.compose=n.compose,Object.defineProperty(n,"promises",{configurable:!0,enumerable:!0,get:()=>i}),e.exports.Stream=n.Stream,e.exports.default=e.exports},76371:(e,t,r)=>{"use strict";const{format:n,inspect:i,AggregateError:a}=r(57760),o=globalThis.AggregateError||a,s=Symbol("kIsNodeError"),u=["string","function","number","object","Function","Object","boolean","bigint","symbol"],c=/^([A-Z][a-z0-9]*)+$/,l={};function d(e,t){if(!e)throw new l.ERR_INTERNAL_ASSERTION(t)}function h(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function p(e,t,r){r||(r=Error);class i extends r{constructor(...r){super(function(e,t,r){if("function"==typeof t)return d(t.length<=r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${t.length}).`),t(...r);const i=(t.match(/%[dfijoOs]/g)||[]).length;return d(i===r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),0===r.length?t:n(t,...r)}(e,t,r))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(i.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=e,i.prototype[s]=!0,l[e]=i}function f(e){const t="__node_internal_"+e.name;return Object.defineProperty(e,"name",{value:t}),e}class y extends Error{constructor(e="The operation was aborted",t=void 0){if(void 0!==t&&"object"!=typeof t)throw new l.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError"}}p("ERR_ASSERTION","%s",Error),p("ERR_INVALID_ARG_TYPE",((e,t,r)=>{d("string"==typeof e,"'name' must be a string"),Array.isArray(t)||(t=[t]);let n="The ";e.endsWith(" argument")?n+=`${e} `:n+=`"${e}" ${e.includes(".")?"property":"argument"} `,n+="must be ";const a=[],o=[],s=[];for(const e of t)d("string"==typeof e,"All expected entries have to be of type string"),u.includes(e)?a.push(e.toLowerCase()):c.test(e)?o.push(e):(d("object"!==e,'The value "object" should be written as "Object"'),s.push(e));if(o.length>0){const e=a.indexOf("object");-1!==e&&(a.splice(a,e,1),o.push("Object"))}if(a.length>0){switch(a.length){case 1:n+=`of type ${a[0]}`;break;case 2:n+=`one of type ${a[0]} or ${a[1]}`;break;default:{const e=a.pop();n+=`one of type ${a.join(", ")}, or ${e}`}}(o.length>0||s.length>0)&&(n+=" or ")}if(o.length>0){switch(o.length){case 1:n+=`an instance of ${o[0]}`;break;case 2:n+=`an instance of ${o[0]} or ${o[1]}`;break;default:{const e=o.pop();n+=`an instance of ${o.join(", ")}, or ${e}`}}s.length>0&&(n+=" or ")}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(n+="an "),n+=`${s[0]}`;break;case 2:n+=`one of ${s[0]} or ${s[1]}`;break;default:{const e=s.pop();n+=`one of ${s.join(", ")}, or ${e}`}}if(null==r)n+=`. Received ${r}`;else if("function"==typeof r&&r.name)n+=`. Received function ${r.name}`;else if("object"==typeof r){var l;null!==(l=r.constructor)&&void 0!==l&&l.name?n+=`. Received an instance of ${r.constructor.name}`:n+=`. Received ${i(r,{depth:-1})}`}else{let e=i(r,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),n+=`. Received type ${typeof r} (${e})`}return n}),TypeError),p("ERR_INVALID_ARG_VALUE",((e,t,r="is invalid")=>{let n=i(t);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${e.includes(".")?"property":"argument"} '${e}' ${r}. Received ${n}`}),TypeError),p("ERR_INVALID_RETURN_VALUE",((e,t,r)=>{var n;return`Expected ${e} to be returned from the "${t}" function but got ${null!=r&&null!==(n=r.constructor)&&void 0!==n&&n.name?`instance of ${r.constructor.name}`:"type "+typeof r}.`}),TypeError),p("ERR_MISSING_ARGS",((...e)=>{let t;d(e.length>0,"At least one arg needs to be specified");const r=e.length;switch(e=(Array.isArray(e)?e:[e]).map((e=>`"${e}"`)).join(" or "),r){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{const r=e.pop();t+=`The ${e.join(", ")}, and ${r} arguments`}}return`${t} must be specified`}),TypeError),p("ERR_OUT_OF_RANGE",((e,t,r)=>{let n;return d(t,'Missing "range" argument'),Number.isInteger(r)&&Math.abs(r)>2**32?n=h(String(r)):"bigint"==typeof r?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=h(n)),n+="n"):n=i(r),`The value of "${e}" is out of range. It must be ${t}. Received ${n}`}),RangeError),p("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),p("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),p("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),p("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),p("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),p("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),p("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),p("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),p("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),p("ERR_STREAM_WRITE_AFTER_END","write after end",Error),p("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),e.exports={AbortError:y,aggregateTwoErrors:f((function(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;const r=new o([t,e],t.message);return r.code=t.code,r}return e||t})),hideStackFrames:f,codes:l}},24134:e=>{"use strict";e.exports={ArrayIsArray:e=>Array.isArray(e),ArrayPrototypeIncludes:(e,t)=>e.includes(t),ArrayPrototypeIndexOf:(e,t)=>e.indexOf(t),ArrayPrototypeJoin:(e,t)=>e.join(t),ArrayPrototypeMap:(e,t)=>e.map(t),ArrayPrototypePop:(e,t)=>e.pop(t),ArrayPrototypePush:(e,t)=>e.push(t),ArrayPrototypeSlice:(e,t,r)=>e.slice(t,r),Error,FunctionPrototypeCall:(e,t,...r)=>e.call(t,...r),FunctionPrototypeSymbolHasInstance:(e,t)=>Function.prototype[Symbol.hasInstance].call(e,t),MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties:(e,t)=>Object.defineProperties(e,t),ObjectDefineProperty:(e,t,r)=>Object.defineProperty(e,t,r),ObjectGetOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(e,t),ObjectKeys:e=>Object.keys(e),ObjectSetPrototypeOf:(e,t)=>Object.setPrototypeOf(e,t),Promise,PromisePrototypeCatch:(e,t)=>e.catch(t),PromisePrototypeThen:(e,t,r)=>e.then(t,r),PromiseReject:e=>Promise.reject(e),PromiseResolve:e=>Promise.resolve(e),ReflectApply:Reflect.apply,RegExpPrototypeTest:(e,t)=>e.test(t),SafeSet:Set,String,StringPrototypeSlice:(e,t,r)=>e.slice(t,r),StringPrototypeToLowerCase:e=>e.toLowerCase(),StringPrototypeToUpperCase:e=>e.toUpperCase(),StringPrototypeTrim:e=>e.trim(),Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet:(e,t,r)=>e.set(t,r),Boolean,Uint8Array}},57760:(e,t,r)=>{"use strict";const n=r(48287),{kResistStopPropagation:i,SymbolDispose:a}=r(24134),o=globalThis.AbortSignal||r(25568).AbortSignal,s=globalThis.AbortController||r(25568).AbortController,u=Object.getPrototypeOf((async function(){})).constructor,c=globalThis.Blob||n.Blob,l=void 0!==c?function(e){return e instanceof c}:function(e){return!1},d=(e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new ERR_INVALID_ARG_TYPE(t,"AbortSignal",e)};class h extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError("Expected input to be an Array, got "+typeof e);let t="";for(let r=0;r{e=r,t=n})),resolve:e,reject:t}},promisify:e=>new Promise(((t,r)=>{e(((e,...n)=>e?r(e):t(...n)))})),debuglog:()=>function(){},format:(e,...t)=>e.replace(/%([sdifj])/g,(function(...[e,r]){const n=t.shift();return"f"===r?n.toFixed(6):"j"===r?JSON.stringify(n):"s"===r&&"object"==typeof n?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})),inspect(e){switch(typeof e){case"string":if(e.includes("'")){if(!e.includes('"'))return`"${e}"`;if(!e.includes("`")&&!e.includes("${"))return`\`${e}\``}return`'${e}'`;case"number":return isNaN(e)?"NaN":Object.is(e,-0)?String(e):e;case"bigint":return`${String(e)}n`;case"boolean":case"undefined":return String(e);case"object":return"{}"}},types:{isAsyncFunction:e=>e instanceof u,isArrayBufferView:e=>ArrayBuffer.isView(e)},isBlob:l,deprecate:(e,t)=>e,addAbortListener:r(37007).addAbortListener||function(e,t){if(void 0===e)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);let r;return d(e,"signal"),((e,t)=>{if("function"!=typeof e)throw new ERR_INVALID_ARG_TYPE("listener","Function",e)})(t),e.aborted?queueMicrotask((()=>t())):(e.addEventListener("abort",t,{__proto__:null,once:!0,[i]:!0}),r=()=>{e.removeEventListener("abort",t)}),{__proto__:null,[a](){var e;null===(e=r)||void 0===e||e()}}},AbortSignalAny:o.any||function(e){if(1===e.length)return e[0];const t=new s,r=()=>t.abort();return e.forEach((e=>{d(e,"signals"),e.addEventListener("abort",r,{once:!0})})),t.signal.addEventListener("abort",(()=>{e.forEach((e=>e.removeEventListener("abort",r)))}),{once:!0}),t.signal}},e.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")},63125:(e,t,r)=>{const{Buffer:n}=r(48287),{ObjectDefineProperty:i,ObjectKeys:a,ReflectApply:o}=r(24134),{promisify:{custom:s}}=r(57760),{streamReturningOperators:u,promiseReturningOperators:c}=r(60823),{codes:{ERR_ILLEGAL_CONSTRUCTOR:l}}=r(76371),d=r(47830),{setDefaultHighWaterMark:h,getDefaultHighWaterMark:p}=r(65291),{pipeline:f}=r(57758),{destroyer:y}=r(75896),g=r(86238),m=r(43095),b=r(16115),v=e.exports=r(94259).Stream;v.isDestroyed=b.isDestroyed,v.isDisturbed=b.isDisturbed,v.isErrored=b.isErrored,v.isReadable=b.isReadable,v.isWritable=b.isWritable,v.Readable=r(57576);for(const T of a(u)){const S=u[T];function _(...e){if(new.target)throw l();return v.Readable.from(o(S,this,e))}i(_,"name",{__proto__:null,value:S.name}),i(_,"length",{__proto__:null,value:S.length}),i(v.Readable.prototype,T,{__proto__:null,value:_,enumerable:!1,configurable:!0,writable:!0})}for(const O of a(c)){const E=c[O];function _(...e){if(new.target)throw l();return o(E,this,e)}i(_,"name",{__proto__:null,value:E.name}),i(_,"length",{__proto__:null,value:E.length}),i(v.Readable.prototype,O,{__proto__:null,value:_,enumerable:!1,configurable:!0,writable:!0})}v.Writable=r(78584),v.Duplex=r(93370),v.Transform=r(17382),v.PassThrough=r(86524),v.pipeline=f;const{addAbortSignal:w}=r(4147);v.addAbortSignal=w,v.finished=g,v.destroy=y,v.compose=d,v.setDefaultHighWaterMark=h,v.getDefaultHighWaterMark=p,i(v,"promises",{__proto__:null,configurable:!0,enumerable:!0,get:()=>m}),i(f,s,{__proto__:null,enumerable:!0,get:()=>m.pipeline}),i(g,s,{__proto__:null,enumerable:!0,get:()=>m.finished}),v.Stream=v,v._isUint8Array=function(e){return e instanceof Uint8Array},v._uint8ArrayToBuffer=function(e){return n.from(e.buffer,e.byteOffset,e.byteLength)}},43095:(e,t,r)=>{"use strict";const{ArrayPrototypePop:n,Promise:i}=r(24134),{isIterable:a,isNodeStream:o,isWebStream:s}=r(16115),{pipelineImpl:u}=r(57758),{finished:c}=r(86238);r(63125),e.exports={finished:c,pipeline:function(...e){return new i(((t,r)=>{let i,c;const l=e[e.length-1];if(l&&"object"==typeof l&&!o(l)&&!a(l)&&!s(l)){const t=n(e);i=t.signal,c=t.end}u(e,((e,n)=>{e?r(e):t(n)}),{signal:i,end:c})}))}}},70742:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(24806),t)},24806:(e,t)=>{"use strict";function r(e){const t=[];let r=0;for(;re.join(""))).join("/")}function n(e,t){let n=t+1;t>=0?"/"===e[t+1]&&"/"===e[t+2]&&(n=t+3):"/"===e[0]&&"/"===e[1]&&(n=2);const i=e.indexOf("/",n);return i<0?e:e.substr(0,i)+r(e.substr(i))}function i(e){return!e||"#"===e||"?"===e||"/"===e}Object.defineProperty(t,"__esModule",{value:!0}),t.removeDotSegmentsOfPath=t.removeDotSegments=t.resolve=void 0,t.resolve=function(e,t){const i=(t=t||"").indexOf("#");if(i>0&&(t=t.substr(0,i)),!e.length){if(t.indexOf(":")<0)throw new Error(`Found invalid baseIRI '${t}' for value '${e}'`);return t}if(e.startsWith("?")){const r=t.indexOf("?");return r>0&&(t=t.substr(0,r)),t+e}if(e.startsWith("#"))return t+e;if(!t.length){const t=e.indexOf(":");if(t<0)throw new Error(`Found invalid relative IRI '${e}' for a missing baseIRI`);return n(e,t)}const a=e.indexOf(":");if(a>=0)return n(e,a);const o=t.indexOf(":");if(o<0)throw new Error(`Found invalid baseIRI '${t}' for value '${e}'`);const s=t.substr(0,o+1);if(0===e.indexOf("//"))return s+n(e,a);let u;if(t.indexOf("//",o)===o+1){if(u=t.indexOf("/",o+3),u<0)return t.length>o+3?t+"/"+n(e,a):s+n(e,a)}else if(u=t.indexOf("/",o+1),u<0)return s+n(e,a);if(0===e.indexOf("/"))return t.substr(0,u)+r(e);let c=t.substr(u);const l=c.lastIndexOf("/");return l>=0&&l{var n=r(48287),i=n.Buffer;function a(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(a(n,t),t.Buffer=o),o.prototype=Object.create(i.prototype),a(i,o),o.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},42791:function(e,t,r){!function(e,t){"use strict";if(!e.setImmediate){var r,n,i,a,o,s=1,u={},c=!1,l=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,"[object process]"==={}.toString.call(e.process)?r=function(e){process.nextTick((function(){p(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?(a="setImmediate$"+Math.random()+"$",o=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(a)&&p(+t.data.slice(a.length))},e.addEventListener?e.addEventListener("message",o,!1):e.attachEvent("onmessage",o),r=function(t){e.postMessage(a+t,"*")}):e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){p(e.data)},r=function(e){i.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(n=l.documentElement,r=function(e){var t=l.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,n.removeChild(t),t=null},n.appendChild(t)}):r=function(e){setTimeout(p,0,e)},d.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n(0,o.uriToPrefix)(e,{fetch:this.fetch,mintOnUnknown:!0,existingPrefixes:t}).then((r=>{this.prefixes[r]=e,t[r]=e,this.prefixRev[e]=r})))))}const t=new Set([...this.store.getSubjects(null,null,null),...this.store.getPredicates(null,null,null),...this.store.getObjects(null,null,null)].filter((e=>"NamedNode"===e.termType)).map((e=>h(e.value))).filter((e=>"string"==typeof e)));for(const e in this.prefixRev)t.has(e)||(delete this.prefixes[this.prefixRev[e]],delete this.prefixRev[e]);if(yield this.writePrefixes(),this.prefixes=Object.assign(Object.assign({},this.prefixes),f),this.prefixRev=Object.assign(Object.assign({},this.prefixRev),p),this.writer.newLine(),yield this.writeShapes(),this.extendedSyntax){const e=this.store.getSubjects(null,null,null);e.length>0&&this.writer.newLine(1);for(const t of e)this.writer.add(yield this.termToString(t,!0,!0)),this.writer.add(" "),this.writer.indent(),yield this.writeTurtlePredicates(t),this.writer.deindent();e.length>0&&(this.writer.add(" ."),this.writer.newLine())}if(this.errorOnExtraQuads&&this.store.size>0)throw new Error("Dataset contains quads that cannot be written in SHACLC");this.writer.end()}))}writeImports(e){return n(this,void 0,void 0,(function*(){const t=this.store.getObjectsOnce(e,new a.NamedNode("http://www.w3.org/2002/07/owl#imports"),null);if(t.length>0)for(const e of t)this.writer.add(`IMPORTS <${e.value}>`,!0)}))}writePrefixes(){return n(this,void 0,void 0,(function*(){const e=Object.keys(this.prefixes).filter((e=>!(e in l.default))).sort();if(e.length>0)for(const t of e)this.writer.add(`PREFIX ${t}: <${this.prefixes[t]}>`,!0)}))}termToString(e,t=!1,r=!1){return n(this,void 0,void 0,(function*(){try{if(t)throw new Error("Shacl name disabled");return(0,u.getShaclName)(e)}catch(e){}if("NamedNode"===e.termType){const t=h(e.value);return t&&t in this.prefixRev&&t in this.prefixRev?`${this.prefixRev[t]}:${e.value.slice(t.length)}`:(0,s.termToString)(e)}if("Literal"===e.termType)return"http://www.w3.org/2001/XMLSchema#integer"===e.datatypeString||"http://www.w3.org/2001/XMLSchema#boolean"===e.datatypeString?e.value:(0,s.termToString)(e);throw"BlankNode"===e.termType&&r&&(0,s.termToString)(e),new Error(`Invalid term type for extra statement ${e.value} (${e.termType})`)}))}writeShapes(){return n(this,void 0,void 0,(function*(){for(const e of this.store.getSubjectsOnce(new a.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),new a.NamedNode("http://www.w3.org/ns/shacl#NodeShape"),null)){this.store.getQuadsOnce(e,new a.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),new a.NamedNode("http://www.w3.org/2000/01/rdf-schema#Class"),null).length>0?this.writer.add("shapeClass "):this.writer.add("shape "),this.writer.add(yield this.termToString(e)),this.writer.add(" ");const t=this.store.getObjectsOnce(e,new a.NamedNode("http://www.w3.org/ns/shacl#targetClass"),null);if(t.length>0){this.writer.add("-> ");for(const e of t)"NamedNode"===e.termType?this.writer.add(yield this.termToString(e)):(this.writer.add("!"),this.writer.add(yield this.termToString(this.singleObject(e,new a.NamedNode("http://www.w3.org/ns/shacl#not"),!0)))),this.writer.add(" ")}const r=this.store.getPredicates(e,null,null).filter((e=>[new a.NamedNode("http://www.w3.org/ns/shacl#targetClass"),new a.NamedNode("http://www.w3.org/ns/shacl#property"),new a.NamedNode("http://www.w3.org/ns/shacl#or"),...Object.keys(d.default).map((e=>new a.NamedNode("http://www.w3.org/ns/shacl#"+e)))].every((t=>!e.equals(t)))));r.length>0&&(this.writer.add(";"),this.writer.indent(),this.writer.newLine(1)),this.extendedSyntax&&(yield this.writeGivenTurtlePredicates(e,r)),r.length>0&&(this.writer.add(" "),this.writer.deindent()),yield this.writeShapeBody(e,!1)}}))}getSingleProperty(e,t){let r=[e];try{let n=(0,u.getShaclName)(e.predicate),i="pred";if("not"===n){const t=this.store.getQuadsOnce(e.object,null,null,null);if(r=r.concat(t),1!==t.length)throw new Error("Can only handle having one predicate of 'not'");[e]=t,n=(0,u.getShaclName)(e.predicate),i="not"}if(!(n in t))throw new Error(`${n} is not allowed`);return{name:n,type:i,object:e.object}}catch(e){this.store.addQuads(r)}}singleLayerPropertiesList(e,t){const r=[];for(const n of this.store.getQuadsOnce(e,null,null,null)){const e=this.getSingleProperty(n,t);e&&r.push(e)}return r}expectOneProperty(e,t){const r=this.store.getQuadsOnce(e,null,null,null);if(1===r.length){const e=this.getSingleProperty(r[0],t);if(e)return e}this.store.addQuads(r)}orProperties(e,t){const r=[];for(const n of this.store.getQuadsOnce(e,new a.NamedNode("http://www.w3.org/ns/shacl#or"),null,null)){const e=[];for(const r of this.getList(n.object)){const i=this.expectOneProperty(r,t);if(!i)throw this.store.addQuad(n),new Error("Each entry of the 'or' statement must declare exactly one property");e.push(i)}r.push(e)}return r}getList(e){let t=e;const r=[];for(;!t.equals(new a.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"));)r.push(this.singleObject(t,new a.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#first"),!0)),t=this.singleObject(t,new a.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"),!0);return r}writeIriLiteralOrArray(e){return n(this,void 0,void 0,(function*(){if("BlankNode"===e.termType){this.writer.add("[");let t=!0;for(const r of this.getList(e))t?t=!1:this.writer.add(" "),this.writer.add(yield this.termToString(r));this.writer.add("]")}else this.writer.add(yield this.termToString(e))}))}singleObject(e,t,r){var n;return null===(n=this.singleQuad(e,t,r))||void 0===n?void 0:n.object}singleQuad(e,t,r=!1){const n=this.store.getQuadsOnce(e,t,null,null);if(r&&1!==n.length)throw this.store.addQuads(n),new Error(`The subject and predicate ${null==e?void 0:e.value} ${null==t?void 0:t.value} must have exactly one object. Instead has ${n.length}`);if(n.length>1)throw this.store.addQuads(n),new Error(`The subject and predicate ${null==e?void 0:e.value} ${null==t?void 0:t.value} can have at most one object. Instead has ${n.length}`);return 1===n.length?n[0]:void 0}writeAssigment({name:e,type:t,object:r}){return n(this,void 0,void 0,(function*(){"not"===t&&this.writer.add("!"),this.writer.add(e),this.writer.add("="),yield this.writeIriLiteralOrArray(r)}))}writeAtom({name:e,type:t,object:r}){return n(this,void 0,void 0,(function*(){switch("not"===t&&this.writer.add("!"),e){case"node":if("NamedNode"===r.termType)this.writer.add(`@${yield this.termToString(r)}`);else{if("BlankNode"!==r.termType)throw new Error("Invalid nested shape, must be blank node or IRI");yield this.writeShapeBody(r)}return;case"nodeKind":return void this.writer.add((0,u.getShaclName)(r));case"class":case"datatype":return void this.writer.add(yield this.termToString(r));default:this.writer.add(e),this.writer.add("="),yield this.writeIriLiteralOrArray(r)}}))}writeAssigments(e,t=" ",r=!0,i){return n(this,void 0,void 0,(function*(){for(const n of e)r?r=!1:this.writer.add(t),i?yield this.writeAtom(n):yield this.writeAssigment(n)}))}writeParams(e,t=!0,r,i=!1,a=!1){return n(this,void 0,void 0,(function*(){const n=this.orProperties(e,r),o=this.singleLayerPropertiesList(e,r);a&&(n.length>0||o.length>0)&&this.writer.newLine(1);for(const e of n)t?t=!1:this.writer.add(" "),yield this.writeAssigments(e,"|",!0,i);yield this.writeAssigments(o," ",t,i),a&&(n.length>0||o.length>0)&&this.writer.add(" .")}))}writeShapeBody(e,t=!0){return n(this,void 0,void 0,(function*(){this.writer.add("{").indent();const r=this.store.getObjectsOnce(e,new a.NamedNode("http://www.w3.org/ns/shacl#property"),null);yield this.writeParams(e,!0,d.default,!1,!0);for(const e of r)this.writer.newLine(1),yield this.writeProperty(e);this.writer.deindent().newLine(1),t?this.writer.add("} ."):this.writer.add("}").newLine(1)}))}writeProperty(e){return n(this,void 0,void 0,(function*(){yield this.writePath(this.singleObject(e,new a.NamedNode("http://www.w3.org/ns/shacl#path"),!0));const t=this.singleObject(e,new a.NamedNode("http://www.w3.org/ns/shacl#minCount")),r=this.singleObject(e,new a.NamedNode("http://www.w3.org/ns/shacl#maxCount")),n=this.singleObject(e,new a.NamedNode("http://www.w3.org/ns/shacl#nodeKind")),i=this.singleObject(e,new a.NamedNode("http://www.w3.org/ns/shacl#class")),o=this.singleObject(e,new a.NamedNode("http://www.w3.org/ns/shacl#datatype")),s=this.store.getObjectsOnce(e,new a.NamedNode("http://www.w3.org/ns/shacl#node"),null);if(n&&(this.writer.add(" "),this.writer.add((0,u.getShaclName)(n))),i&&(this.writer.add(" "),this.writer.add(yield this.termToString(i))),o&&(this.writer.add(" "),this.writer.add(yield this.termToString(o))),void 0!==t||void 0!==r){if(this.writer.add(" ["),t){if("Literal"!==t.termType||"http://www.w3.org/2001/XMLSchema#integer"!==t.datatypeString)throw new Error("Invalid min value, must me an integer literal");this.writer.add(t.value)}else this.writer.add("0");if(this.writer.add(".."),r){if("Literal"!==r.termType||"http://www.w3.org/2001/XMLSchema#integer"!==r.datatypeString)throw new Error("Invalid max value, must me an integer literal");this.store.removeMatches(e,new a.NamedNode("http://www.w3.org/ns/shacl#maxCount"),void 0,void 0),this.writer.add(r.value)}else this.writer.add("*");this.writer.add("]")}yield this.writeParams(e,!1,c.default,!0);const l=[];for(const e of s)if("NamedNode"===e.termType)this.writer.add(" "),this.writer.add(`@${yield this.termToString(e)}`);else{if("BlankNode"!==e.termType)throw new Error("Invalid nested shape, must be blank node or IRI");l.push(e)}for(const e of l)this.writer.add(" "),yield this.writeShapeBody(e);this.extendedSyntax&&this.store.getQuads(e,null,null,null).length>0&&(this.writer.add(" %"),this.writer.indent(),this.writer.newLine(1),yield this.writeTurtlePredicates(e),this.writer.deindent(),this.writer.newLine(1),this.writer.add("%")),0===l.length&&this.writer.add(" .")}))}writeTurtlePredicates(e){return n(this,void 0,void 0,(function*(){return this.writeGivenTurtlePredicates(e,this.store.getPredicates(e,null,null))}))}writeGivenTurtlePredicates(e,t){return n(this,void 0,void 0,(function*(){let r=!1;if(t.some((e=>e.equals(a.DataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"))))){const t=this.store.getObjectsOnce(e,a.DataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),null);t.length>0&&(r=!0,this.writer.add("a "),yield this.writeTurtleObjects(t))}for(const n of t)n.equals(a.DataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"))||(r?(this.writer.add(" ;"),this.writer.newLine(1)):r=!0,this.writer.add(yield this.termToString(n,!0)),this.writer.add(" "),yield this.writeTurtleObjects(this.store.getObjectsOnce(e,n,null)))}))}writeTurtleObjects(e){return n(this,void 0,void 0,(function*(){const t=[],r=[];for(const n of e)"BlankNode"===n.termType&&0===[...this.store.match(null,null,n),...this.store.match(null,n,null)].length?t.push(n):r.push(n);this.writer.add((yield Promise.all(r.map((e=>this.termToString(e,!0,!0))))).join(", "));let n=r.length>0;if(t.length>0)for(const e of t)n?this.writer.add(", "):n=!0,(yield this.writeList(e))||(this.writer.add("["),this.writer.indent(),this.writer.newLine(1),yield this.writeTurtlePredicates(e),this.writer.deindent(),this.writer.newLine(1),this.writer.add("]"))}))}writeList(e){return n(this,void 0,void 0,(function*(){let t=e;const r=[],n=[];for(;!t.equals(a.DataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"));){const e=this.store.getQuadsOnce(t,a.DataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#first"),null,null),i=this.store.getQuadsOnce(t,a.DataFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#rest"),null,null);if(n.push(...e,...i),1!==e.length||1!==i.length||0!==this.store.getQuads(t,null,null,null).length)return this.store.addQuads(n),!1;r.push(e[0].object),t=i[0].object}let i=!1;this.writer.add("(");for(const e of r)i?this.writer.add(" "):i=!0,yield this.writeTurtleObjects([e]);return this.writer.add(")"),!0}))}writePath(e,t=!1){return n(this,void 0,void 0,(function*(){if("NamedNode"===e.termType)this.writer.add(yield this.termToString(e));else{if("BlankNode"!==e.termType)throw new Error("Path should be named node or blank node");{const r=this.store.getQuadsOnce(e,null,null,null);if(1===r.length){const{predicate:n,object:i}=r[0];switch(n.value){case"http://www.w3.org/ns/shacl#inversePath":return this.writer.add("^"),void(yield this.writePath(i,!0));case"http://www.w3.org/ns/shacl#alternativePath":{const e=this.getList(i);if(0===e.length)throw new Error("Invalid Alternative Path - no options");if(1===e.length)yield this.writePath(e[0]);else{t&&this.writer.add("(");let r=!0;for(const t of e)r?r=!1:this.writer.add("|"),yield this.writePath(t,!0);t&&this.writer.add(")")}return}case"http://www.w3.org/ns/shacl#zeroOrMorePath":return yield this.writePath(i,!0),void this.writer.add("*");case"http://www.w3.org/ns/shacl#oneOrMorePath":return yield this.writePath(i,!0),void this.writer.add("+");case"http://www.w3.org/ns/shacl#zeroOrOnePath":return yield this.writePath(i,!0),void this.writer.add("?");default:throw new Error(`Invalid path type ${e.value}`)}}else{this.store.addQuads(r);const n=this.getList(e);if(0===n.length)throw new Error("Invalid Path");{t&&this.writer.add("(");let e=!0;for(const t of n)e?e=!1:this.writer.add("/"),yield this.writePath(t,!0);t&&this.writer.add(")")}}}}}))}}},28630:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={owl:"http://www.w3.org/2002/07/owl#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",sh:"http://www.w3.org/ns/shacl#",xsd:"http://www.w3.org/2001/XMLSchema#"}},94174:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}u((n=n.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.write=void 0;const a=r(29014),o=i(r(55977)),s=i(r(51167)),u=i(r(18996));t.write=function(e,t){return n(this,void 0,void 0,(function*(){return new Promise(((r,i)=>n(this,void 0,void 0,(function*(){try{let n="";const i=new u.default(e),c=i.getGraphs(null,null,null);if(c.length>1)throw new Error("More than one graph found - can serialize in the default graph");if(1===c.length&&!c[0].equals(a.DataFactory.defaultGraph()))throw new Error(`Expected all triples to be in the default graph, instead triples were in ${c[0].value}`);const l=new s.default({write:e=>{n+=e},end:()=>{let e=i.getQuads(null,null,null,null);0===e.length&&(e=void 0),r({text:n,extraQuads:e})}}),d=new o.default(i,l,null==t?void 0:t.prefixes,void 0,!1!==(null==t?void 0:t.errorOnUnused),null==t?void 0:t.mintPrefixes,null==t?void 0:t.fetch,null==t?void 0:t.extendedSyntax);yield d.write()}catch(e){i(e)}}))))}))}},76588:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={targetNode:!0,targetObjectsOf:!0,targetSubjectsOf:!0,deactivated:!0,severity:!0,message:!0,class:!0,datatype:!0,nodeKind:!0,minExclusive:!0,minInclusive:!0,maxExclusive:!0,maxInclusive:!0,minLength:!0,maxLength:!0,pattern:!0,flags:!0,languageIn:!0,equals:!0,disjoint:!0,closed:!0,ignoredProperties:!0,hasValue:!0,in:!0}},11501:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={deactivated:!0,severity:!0,message:!0,class:!0,datatype:!0,nodeKind:!0,minExclusive:!0,minInclusive:!0,maxExclusive:!0,maxInclusive:!0,minLength:!0,maxLength:!0,pattern:!0,flags:!0,languageIn:!0,uniqueLang:!0,equals:!0,disjoint:!0,lessThan:!0,lessThanOrEquals:!0,qualifiedValueShape:!0,qualifiedMinCount:!0,qualifiedMaxCount:!0,qualifiedValueShapesDisjoint:!0,closed:!0,ignoredProperties:!0,hasValue:!0,in:!0,node:!0}},73423:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getShaclName=void 0,t.getShaclName=function(e){if("NamedNode"!==e.termType||!e.value.startsWith("http://www.w3.org/ns/shacl#"))throw new Error(`Term ${e.value} is not part of the SHACL namespace`);return e.value.slice(27)}},18996:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(29014);class i extends n.Store{getQuadsOnce(e,t,r,n){const i=this.getQuads(e,t,r,n);return this.removeQuads(i),i}getSubjectsOnce(e,t,r){return this.getQuadsOnce(null,e,t,r).map((e=>e.subject))}getObjectsOnce(e,t,r){return this.getQuadsOnce(e,t,null,r).map((e=>e.object))}}t.default=i},51167:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(e){this.indents=0,this.write=e.write,this.end=e.end}indent(){return this.indents+=1,this}deindent(){if(this.indents<1)throw new Error(`Trying to deindent when indent is only ${this.indents}`);return this.indents-=1,this}add(e,t=!1){return this.write(t?`\n${"\t".repeat(this.indents)}${e}`:e,"utf-8"),this}newLine(e=2){return this.write("\n".repeat(e)+"\t".repeat(this.indents),"utf-8"),this}}},75735:e=>{e.exports=function(e){"use strict";var t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function r(e,t){var r=e[0],n=e[1],i=e[2],a=e[3];n=((n+=((i=((i+=((a=((a+=((r=((r+=(n&i|~n&a)+t[0]-680876936|0)<<7|r>>>25)+n|0)&n|~r&i)+t[1]-389564586|0)<<12|a>>>20)+r|0)&r|~a&n)+t[2]+606105819|0)<<17|i>>>15)+a|0)&a|~i&r)+t[3]-1044525330|0)<<22|n>>>10)+i|0,n=((n+=((i=((i+=((a=((a+=((r=((r+=(n&i|~n&a)+t[4]-176418897|0)<<7|r>>>25)+n|0)&n|~r&i)+t[5]+1200080426|0)<<12|a>>>20)+r|0)&r|~a&n)+t[6]-1473231341|0)<<17|i>>>15)+a|0)&a|~i&r)+t[7]-45705983|0)<<22|n>>>10)+i|0,n=((n+=((i=((i+=((a=((a+=((r=((r+=(n&i|~n&a)+t[8]+1770035416|0)<<7|r>>>25)+n|0)&n|~r&i)+t[9]-1958414417|0)<<12|a>>>20)+r|0)&r|~a&n)+t[10]-42063|0)<<17|i>>>15)+a|0)&a|~i&r)+t[11]-1990404162|0)<<22|n>>>10)+i|0,n=((n+=((i=((i+=((a=((a+=((r=((r+=(n&i|~n&a)+t[12]+1804603682|0)<<7|r>>>25)+n|0)&n|~r&i)+t[13]-40341101|0)<<12|a>>>20)+r|0)&r|~a&n)+t[14]-1502002290|0)<<17|i>>>15)+a|0)&a|~i&r)+t[15]+1236535329|0)<<22|n>>>10)+i|0,n=((n+=((i=((i+=((a=((a+=((r=((r+=(n&a|i&~a)+t[1]-165796510|0)<<5|r>>>27)+n|0)&i|n&~i)+t[6]-1069501632|0)<<9|a>>>23)+r|0)&n|r&~n)+t[11]+643717713|0)<<14|i>>>18)+a|0)&r|a&~r)+t[0]-373897302|0)<<20|n>>>12)+i|0,n=((n+=((i=((i+=((a=((a+=((r=((r+=(n&a|i&~a)+t[5]-701558691|0)<<5|r>>>27)+n|0)&i|n&~i)+t[10]+38016083|0)<<9|a>>>23)+r|0)&n|r&~n)+t[15]-660478335|0)<<14|i>>>18)+a|0)&r|a&~r)+t[4]-405537848|0)<<20|n>>>12)+i|0,n=((n+=((i=((i+=((a=((a+=((r=((r+=(n&a|i&~a)+t[9]+568446438|0)<<5|r>>>27)+n|0)&i|n&~i)+t[14]-1019803690|0)<<9|a>>>23)+r|0)&n|r&~n)+t[3]-187363961|0)<<14|i>>>18)+a|0)&r|a&~r)+t[8]+1163531501|0)<<20|n>>>12)+i|0,n=((n+=((i=((i+=((a=((a+=((r=((r+=(n&a|i&~a)+t[13]-1444681467|0)<<5|r>>>27)+n|0)&i|n&~i)+t[2]-51403784|0)<<9|a>>>23)+r|0)&n|r&~n)+t[7]+1735328473|0)<<14|i>>>18)+a|0)&r|a&~r)+t[12]-1926607734|0)<<20|n>>>12)+i|0,n=((n+=((i=((i+=((a=((a+=((r=((r+=(n^i^a)+t[5]-378558|0)<<4|r>>>28)+n|0)^n^i)+t[8]-2022574463|0)<<11|a>>>21)+r|0)^r^n)+t[11]+1839030562|0)<<16|i>>>16)+a|0)^a^r)+t[14]-35309556|0)<<23|n>>>9)+i|0,n=((n+=((i=((i+=((a=((a+=((r=((r+=(n^i^a)+t[1]-1530992060|0)<<4|r>>>28)+n|0)^n^i)+t[4]+1272893353|0)<<11|a>>>21)+r|0)^r^n)+t[7]-155497632|0)<<16|i>>>16)+a|0)^a^r)+t[10]-1094730640|0)<<23|n>>>9)+i|0,n=((n+=((i=((i+=((a=((a+=((r=((r+=(n^i^a)+t[13]+681279174|0)<<4|r>>>28)+n|0)^n^i)+t[0]-358537222|0)<<11|a>>>21)+r|0)^r^n)+t[3]-722521979|0)<<16|i>>>16)+a|0)^a^r)+t[6]+76029189|0)<<23|n>>>9)+i|0,n=((n+=((i=((i+=((a=((a+=((r=((r+=(n^i^a)+t[9]-640364487|0)<<4|r>>>28)+n|0)^n^i)+t[12]-421815835|0)<<11|a>>>21)+r|0)^r^n)+t[15]+530742520|0)<<16|i>>>16)+a|0)^a^r)+t[2]-995338651|0)<<23|n>>>9)+i|0,n=((n+=((a=((a+=(n^((r=((r+=(i^(n|~a))+t[0]-198630844|0)<<6|r>>>26)+n|0)|~i))+t[7]+1126891415|0)<<10|a>>>22)+r|0)^((i=((i+=(r^(a|~n))+t[14]-1416354905|0)<<15|i>>>17)+a|0)|~r))+t[5]-57434055|0)<<21|n>>>11)+i|0,n=((n+=((a=((a+=(n^((r=((r+=(i^(n|~a))+t[12]+1700485571|0)<<6|r>>>26)+n|0)|~i))+t[3]-1894986606|0)<<10|a>>>22)+r|0)^((i=((i+=(r^(a|~n))+t[10]-1051523|0)<<15|i>>>17)+a|0)|~r))+t[1]-2054922799|0)<<21|n>>>11)+i|0,n=((n+=((a=((a+=(n^((r=((r+=(i^(n|~a))+t[8]+1873313359|0)<<6|r>>>26)+n|0)|~i))+t[15]-30611744|0)<<10|a>>>22)+r|0)^((i=((i+=(r^(a|~n))+t[6]-1560198380|0)<<15|i>>>17)+a|0)|~r))+t[13]+1309151649|0)<<21|n>>>11)+i|0,n=((n+=((a=((a+=(n^((r=((r+=(i^(n|~a))+t[4]-145523070|0)<<6|r>>>26)+n|0)|~i))+t[11]-1120210379|0)<<10|a>>>22)+r|0)^((i=((i+=(r^(a|~n))+t[2]+718787259|0)<<15|i>>>17)+a|0)|~r))+t[9]-343485551|0)<<21|n>>>11)+i|0,e[0]=r+e[0]|0,e[1]=n+e[1]|0,e[2]=i+e[2]|0,e[3]=a+e[3]|0}function n(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return r}function i(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return r}function a(e){var t,i,a,o,s,u,c=e.length,l=[1732584193,-271733879,-1732584194,271733878];for(t=64;t<=c;t+=64)r(l,n(e.substring(t-64,t)));for(i=(e=e.substring(t-64)).length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],t=0;t>2]|=e.charCodeAt(t)<<(t%4<<3);if(a[t>>2]|=128<<(t%4<<3),t>55)for(r(l,a),t=0;t<16;t+=1)a[t]=0;return o=(o=8*c).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(o[2],16),u=parseInt(o[1],16)||0,a[14]=s,a[15]=u,r(l,a),l}function o(e){var r,n="";for(r=0;r<4;r+=1)n+=t[e>>8*r+4&15]+t[e>>8*r&15];return n}function s(e){var t;for(t=0;tc?new ArrayBuffer(0):(n=c-u,i=new ArrayBuffer(n),a=new Uint8Array(i),o=new Uint8Array(this,u,n),a.set(o),i)}}(),l.prototype.append=function(e){return this.appendBinary(u(e)),this},l.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var t,i=this._buff.length;for(t=64;t<=i;t+=64)r(this._hash,n(this._buff.substring(t-64,t)));return this._buff=this._buff.substring(t-64),this},l.prototype.end=function(e){var t,r,n=this._buff,i=n.length,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t>2]|=n.charCodeAt(t)<<(t%4<<3);return this._finish(a,i),r=s(this._hash),e&&(r=c(r)),this.reset(),r},l.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},l.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},l.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},l.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},l.prototype._finish=function(e,t){var n,i,a,o=t;if(e[o>>2]|=128<<(o%4<<3),o>55)for(r(this._hash,e),o=0;o<16;o+=1)e[o]=0;n=(n=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),i=parseInt(n[2],16),a=parseInt(n[1],16)||0,e[14]=i,e[15]=a,r(this._hash,e)},l.hash=function(e,t){return l.hashBinary(u(e),t)},l.hashBinary=function(e,t){var r=s(a(e));return t?c(r):r},l.ArrayBuffer=function(){this.reset()},l.ArrayBuffer.prototype.append=function(e){var t,n,a,o,s,u=(n=this._buff.buffer,a=e,o=!0,(s=new Uint8Array(n.byteLength+a.byteLength)).set(new Uint8Array(n)),s.set(new Uint8Array(a),n.byteLength),o?s:s.buffer),c=u.length;for(this._length+=e.byteLength,t=64;t<=c;t+=64)r(this._hash,i(u.subarray(t-64,t)));return this._buff=t-64>2]|=n[t]<<(t%4<<3);return this._finish(a,i),r=s(this._hash),e&&(r=c(r)),this.reset(),r},l.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},l.ArrayBuffer.prototype.getState=function(){var e,t=l.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},l.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var r,n=e.length,i=new ArrayBuffer(n),a=new Uint8Array(i);for(r=0;r>2]|=e[t]<<(t%4<<3);if(a[t>>2]|=128<<(t%4<<3),t>55)for(r(l,a),t=0;t<16;t+=1)a[t]=0;return o=(o=8*c).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(o[2],16),u=parseInt(o[1],16)||0,a[14]=s,a[15]=u,r(l,a),l}(new Uint8Array(e)));return t?c(n):n},l}()},96331:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Util=t.toSparqlJs=t.toSparql=t.Factory=t.Algebra=t.translate=void 0;const s=o(r(73776));t.translate=s.default;const u=a(r(13079));t.Algebra=u;const c=o(r(91409));t.Factory=c.default;const l=r(3698);Object.defineProperty(t,"toSparql",{enumerable:!0,get:function(){return l.toSparql}}),Object.defineProperty(t,"toSparqlJs",{enumerable:!0,get:function(){return l.toSparqlJs}});const d=o(r(64995));t.Util=d.default},13079:(e,t)=>{"use strict";var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.expressionTypes=t.types=void 0,(n=t.types||(t.types={})).ALT="alt",n.ASK="ask",n.BGP="bgp",n.CONSTRUCT="construct",n.DESCRIBE="describe",n.DISTINCT="distinct",n.EXPRESSION="expression",n.EXTEND="extend",n.FILTER="filter",n.FROM="from",n.GRAPH="graph",n.GROUP="group",n.INV="inv",n.JOIN="join",n.LEFT_JOIN="leftjoin",n.LINK="link",n.MINUS="minus",n.NOP="nop",n.NPS="nps",n.ONE_OR_MORE_PATH="OneOrMorePath",n.ORDER_BY="orderby",n.PATH="path",n.PATTERN="pattern",n.PROJECT="project",n.REDUCED="reduced",n.SEQ="seq",n.SERVICE="service",n.SLICE="slice",n.UNION="union",n.VALUES="values",n.ZERO_OR_MORE_PATH="ZeroOrMorePath",n.ZERO_OR_ONE_PATH="ZeroOrOnePath",n.COMPOSITE_UPDATE="compositeupdate",n.DELETE_INSERT="deleteinsert",n.LOAD="load",n.CLEAR="clear",n.CREATE="create",n.DROP="drop",n.ADD="add",n.MOVE="move",n.COPY="copy",(r=t.expressionTypes||(t.expressionTypes={})).AGGREGATE="aggregate",r.EXISTENCE="existence",r.NAMED="named",r.OPERATOR="operator",r.TERM="term",r.WILDCARD="wildcard"},91409:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0});const o=a(r(13079)),s=r(47793),u=r(43347),c=r(98082);t.default=class{constructor(e){this.dataFactory=e||new s.DataFactory,this.stringType=this.createTerm("http://www.w3.org/2001/XMLSchema#string")}createAlt(e,t=!0){return this.flattenMulti({type:o.types.ALT,input:e},t)}createAsk(e){return{type:o.types.ASK,input:e}}createBoundAggregate(e,t,r,n,i){const a=this.createAggregateExpression(t,r,n,i);return a.variable=e,a}createBgp(e){return{type:o.types.BGP,patterns:e}}createConstruct(e,t){return{type:o.types.CONSTRUCT,input:e,template:t}}createDescribe(e,t){return{type:o.types.DESCRIBE,input:e,terms:t}}createDistinct(e){return{type:o.types.DISTINCT,input:e}}createExtend(e,t,r){return{type:o.types.EXTEND,input:e,variable:t,expression:r}}createFrom(e,t,r){return{type:o.types.FROM,input:e,default:t,named:r}}createFilter(e,t){return{type:o.types.FILTER,input:e,expression:t}}createGraph(e,t){return{type:o.types.GRAPH,input:e,name:t}}createGroup(e,t,r){return{type:o.types.GROUP,input:e,variables:t,aggregates:r}}createInv(e){return{type:o.types.INV,path:e}}createJoin(e,t=!0){return this.flattenMulti({type:o.types.JOIN,input:e},t)}createLeftJoin(e,t,r){return r?{type:o.types.LEFT_JOIN,input:[e,t],expression:r}:{type:o.types.LEFT_JOIN,input:[e,t]}}createLink(e){return{type:o.types.LINK,iri:e}}createMinus(e,t){return{type:o.types.MINUS,input:[e,t]}}createNop(){return{type:o.types.NOP}}createNps(e){return{type:o.types.NPS,iris:e}}createOneOrMorePath(e){return{type:o.types.ONE_OR_MORE_PATH,path:e}}createOrderBy(e,t){return{type:o.types.ORDER_BY,input:e,expressions:t}}createPath(e,t,r,n){return n?{type:o.types.PATH,subject:e,predicate:t,object:r,graph:n}:{type:o.types.PATH,subject:e,predicate:t,object:r,graph:this.dataFactory.defaultGraph()}}createPattern(e,t,r,n){const i=this.dataFactory.quad(e,t,r,n);return i.type=o.types.PATTERN,i}createProject(e,t){return{type:o.types.PROJECT,input:e,variables:t}}createReduced(e){return{type:o.types.REDUCED,input:e}}createSeq(e,t=!0){return this.flattenMulti({type:o.types.SEQ,input:e},t)}createService(e,t,r){return{type:o.types.SERVICE,input:e,name:t,silent:Boolean(r)}}createSlice(e,t,r){return t=t||0,void 0!==r?{type:o.types.SLICE,input:e,start:t,length:r}:{type:o.types.SLICE,input:e,start:t}}createUnion(e,t=!0){return this.flattenMulti({type:o.types.UNION,input:e},t)}createValues(e,t){return{type:o.types.VALUES,variables:e,bindings:t}}createZeroOrMorePath(e){return{type:o.types.ZERO_OR_MORE_PATH,path:e}}createZeroOrOnePath(e){return{type:o.types.ZERO_OR_ONE_PATH,path:e}}createAggregateExpression(e,t,r,n){return n?{type:o.types.EXPRESSION,expressionType:o.expressionTypes.AGGREGATE,aggregator:e,expression:t,separator:n,distinct:r}:{type:o.types.EXPRESSION,expressionType:o.expressionTypes.AGGREGATE,aggregator:e,expression:t,distinct:r}}createExistenceExpression(e,t){return{type:o.types.EXPRESSION,expressionType:o.expressionTypes.EXISTENCE,not:e,input:t}}createNamedExpression(e,t){return{type:o.types.EXPRESSION,expressionType:o.expressionTypes.NAMED,name:e,args:t}}createOperatorExpression(e,t){return{type:o.types.EXPRESSION,expressionType:o.expressionTypes.OPERATOR,operator:e,args:t}}createTermExpression(e){return{type:o.types.EXPRESSION,expressionType:o.expressionTypes.TERM,term:e}}createWildcardExpression(){return{type:o.types.EXPRESSION,expressionType:o.expressionTypes.WILDCARD,wildcard:new c.Wildcard}}createTerm(e){return(0,u.stringToTerm)(e,this.dataFactory)}createCompositeUpdate(e){return{type:o.types.COMPOSITE_UPDATE,updates:e}}createDeleteInsert(e,t,r){const n={type:o.types.DELETE_INSERT};return e&&(n.delete=e),t&&(n.insert=t),r&&(n.where=r),n}createLoad(e,t,r){const n={type:o.types.LOAD,source:e};return t&&(n.destination=t),this.addSilent(n,Boolean(r))}createClear(e,t){return this.addSilent({type:o.types.CLEAR,source:e},Boolean(t))}createCreate(e,t){return this.addSilent({type:o.types.CREATE,source:e},Boolean(t))}createDrop(e,t){return this.addSilent({type:o.types.DROP,source:e},Boolean(t))}createAdd(e,t,r){return this.addSilent({type:o.types.ADD,source:e,destination:t},Boolean(r))}createMove(e,t,r){return this.addSilent({type:o.types.MOVE,source:e,destination:t},Boolean(r))}createCopy(e,t,r){return this.addSilent({type:o.types.COPY,source:e,destination:t},Boolean(r))}addSilent(e,t){return t&&(e.silent=t),e}flattenMulti(e,t){if(!t)return e;const r=e.type,n=e.input;let i=[];for(const e of n)e.type===r?i.push(...e.input):i.push(e);return e.input=i,e}}},3698:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.toSparqlJs=t.toSparql=void 0;const s=r(62699),u=r(43347),c=r(98082),l=a(r(13079)),d=o(r(91409)),h=o(r(64995)),p=l.types,f=l.expressionTypes;let y;const g=new d.default;function m(e){b();let t=v(e=function(e){return D(e,[])}(e));return"group"===t.type?t.patterns[0]:t}function b(){y={project:!1,extend:[],group:[],aggregates:[],order:[]}}function v(e){switch(e.type!==p.EXTEND&&e.type!==p.ORDER_BY&&e.type!==p.GRAPH&&(y.project=!1),e.type){case p.EXPRESSION:return _(e);case p.ASK:return A(e,p.ASK);case p.BGP:return function(e){let t=e.patterns.map(E);return 0===t.length?null:{type:"bgp",triples:t}}(e);case p.CONSTRUCT:return function(e){return{type:"query",prefixes:{},queryType:"CONSTRUCT",template:e.template.map(E),where:h.default.flatten([v(e.input)])}}(e);case p.DESCRIBE:return A(e,p.DESCRIBE);case p.DISTINCT:return function(e){let t=v(e.input);return t.patterns[0].distinct=!0,t}(e);case p.EXTEND:return function(e){return y.project?(y.extend.push(e),v(e.input)):h.default.flatten([v(e.input),{type:"bind",variable:e.variable,expression:_(e.expression)}])}(e);case p.FROM:return function(e){const t=v(e.input);let r=t;return"group"===t.type&&(r=t.patterns[0]),r.from={default:e.default,named:e.named},t}(e);case p.FILTER:return function(e){return{type:"group",patterns:h.default.flatten([v(e.input),{type:"filter",expression:_(e.expression)}])}}(e);case p.GRAPH:return function(e){return{type:"graph",patterns:h.default.flatten([v(e.input)]),name:e.name}}(e);case p.GROUP:return function(e){const t=v(e.input),r=e.aggregates.map(O);return y.aggregates.push(...r),y.group.push(...e.variables),t}(e);case p.JOIN:return function(e){return h.default.flatten(e.input.map(v)).reduce(((e,t)=>("bgp"!==t.type||0==e.length||"bgp"!==e[e.length-1].type?e.push(t):e[e.length-1].triples.push(...t.triples),e)),[])}(e);case p.LEFT_JOIN:return function(e){const t={type:"optional",patterns:[v(e.input[1])]};return e.expression&&t.patterns.push({type:"filter",expression:_(e.expression)}),t.patterns=h.default.flatten(t.patterns),h.default.flatten([v(e.input[0]),t])}(e);case p.MINUS:return function(e){let t=v(e.input[1]);return"group"===t.type&&(t=t.patterns),Array.isArray(t)||(t=[t]),h.default.flatten([v(e.input[0]),{type:"minus",patterns:t}])}(e);case p.NOP:return{};case p.ORDER_BY:return function(e){return y.order.push(...e.expressions),v(e.input)}(e);case p.PATH:return function(e){return{type:"bgp",triples:[{subject:e.subject,predicate:w(e.predicate),object:e.object}]}}(e);case p.PATTERN:return E(e);case p.PROJECT:return A(e,p.PROJECT);case p.REDUCED:return function(e){let t=v(e.input);return t.patterns[0].reduced=!0,t}(e);case p.SERVICE:return function(e){let t=v(e.input);return"group"===t.type&&(t=t.patterns),Array.isArray(t)||(t=[t]),{type:"service",name:e.name,silent:e.silent,patterns:t}}(e);case p.SLICE:return function(e){let t=v(e.input),r=t;return t.type&&"group"===t.type&&(r=t.patterns[0]),0!==e.start&&(r.offset=e.start),void 0!==e.length&&(r.limit=e.length),t}(e);case p.UNION:return function(e){return{type:"union",patterns:e.input.map(v).map(S)}}(e);case p.VALUES:return function(e){return{type:"values",values:e.bindings.map((t=>{let r={};for(let n of e.variables){let e=`?${n.value}`;t[e]?r[e]=t[e]:r[e]=void 0}return r}))}}(e);case p.COMPOSITE_UPDATE:return function(e){return{prefixes:{},type:"update",updates:e.updates.map((e=>v(e).updates[0]))}}(e);case p.DELETE_INSERT:return function(e){var t;let r,n=e.where;if(n&&n.type===p.FROM){let e=n;n=e.input,r={default:e.default,named:e.named}}const i=[{updateType:"insertdelete",delete:j(e.delete||[]),insert:j(e.insert||[])}];if(r&&(i[0].using=r),!n||n.type===p.BGP&&0===n.patterns.length)i[0].where=[];else{const e=[];let r=v(D(n,e));if("group"===r.type?i[0].where=r.patterns:i[0].where=[r],e.length>0){if(1!==e.length)throw new Error("This is unexpected and might indicate an error in graph handling for updates.");""!==(null===(t=e[0])||void 0===t?void 0:t.value)&&(i[0].where=[{type:"graph",patterns:i[0].where,name:e[0]}])}}return e.delete||e.where?e.insert||e.where?!e.insert&&e.where&&"bgp"===e.where.type&&(0,s.isomorphic)(e.delete,e.where.patterns)&&(delete i[0].where,i[0].updateType="deletewhere"):(delete i[0].insert,delete i[0].where,e.delete.some((e=>"Variable"===e.subject.termType||"Variable"===e.predicate.termType||"Variable"===e.object.termType))?i[0].updateType="deletewhere":i[0].updateType="delete"):(i[0].updateType="insert",delete i[0].delete,delete i[0].where),{prefixes:{},type:"update",updates:i}}(e);case p.LOAD:return function(e){const t=[{type:"load",silent:Boolean(e.silent),source:e.source}];return e.destination&&(t[0].destination=e.destination),{prefixes:{},type:"update",updates:t}}(e);case p.CLEAR:return function(e){return I(e,"clear")}(e);case p.CREATE:return function(e){return I(e,"create")}(e);case p.DROP:return function(e){return I(e,"drop")}(e);case p.ADD:return function(e){return N(e,"add")}(e);case p.MOVE:return function(e){return N(e,"move")}(e);case p.COPY:return function(e){return N(e,"copy")}(e)}throw new Error(`Unknown Operation type ${e.type}`)}function _(e){switch(e.expressionType){case f.AGGREGATE:return function(e){const t={expression:_(e.expression),type:"aggregate",aggregation:e.aggregator,distinct:e.distinct};return e.separator&&(t.separator=e.separator),t}(e);case f.EXISTENCE:return function(e){return{type:"operation",operator:e.not?"notexists":"exists",args:h.default.flatten([v(e.input)])}}(e);case f.NAMED:return function(e){return{type:"functionCall",function:e.name,args:e.args.map(_)}}(e);case f.OPERATOR:return function(e){if("desc"===e.operator){return{expression:_(e.args[0]),descending:!0}}const t={type:"operation",operator:e.operator,args:e.args.map(_)};return"in"!==t.operator&&"notin"!==t.operator||(t.args=[t.args[0]].concat([t.args.slice(1)])),t}(e);case f.TERM:return function(e){return e.term}(e);case f.WILDCARD:return function(e){return e.wildcard}(e)}throw new Error(`Unknown Expression Operation type ${e.expressionType}`)}function w(e){switch(e.type){case p.ALT:return function(e){const t=e.input.map(w);return t.every((e=>"pathType"in e&&"!"===e.pathType))?{type:"path",pathType:"!",items:[{type:"path",pathType:"|",items:h.default.flatten(t.map((e=>e.items)))}]}:{type:"path",pathType:"|",items:t}}(e);case p.INV:return function(e){if(e.path.type===p.NPS){const t=e.path.iris.map((e=>({type:"path",pathType:"^",items:[e]})));return t.length<=1?{type:"path",pathType:"!",items:t}:{type:"path",pathType:"!",items:[{type:"path",pathType:"|",items:t}]}}return{type:"path",pathType:"^",items:[w(e.path)]}}(e);case p.LINK:return function(e){return e.iri}(e);case p.NPS:return function(e){return e.iris.length<=1?{type:"path",pathType:"!",items:e.iris}:{type:"path",pathType:"!",items:[{type:"path",pathType:"|",items:e.iris}]}}(e);case p.ONE_OR_MORE_PATH:return function(e){return{type:"path",pathType:"+",items:[w(e.path)]}}(e);case p.SEQ:return function(e){return{type:"path",pathType:"/",items:e.input.map(w)}}(e);case p.ZERO_OR_MORE_PATH:return function(e){return{type:"path",pathType:"*",items:[w(e.path)]}}(e);case p.ZERO_OR_ONE_PATH:return function(e){return{type:"path",pathType:"?",items:[w(e.path)]}}(e)}throw new Error(`Unknown Path type ${e.type}`)}function T(e){return(0,u.termToString)(e)}function S(e){return Array.isArray(e)?1===e.length?e[0]:{type:"group",patterns:e}:e}function O(e){return e}function E(e){return{subject:e.subject,predicate:e.predicate,object:e.object}}function x(e,t){let r=h.default.isSimpleTerm(e)?T(e):e;if("string"==typeof r){if(t[r])return t[r]}else if(Array.isArray(e))e=e.map((e=>x(e,t)));else for(let r of Object.keys(e))e[r]=x(e[r],t);return e}function A(e,t){const r={type:"query",prefixes:{}},n=r;let i;t===p.PROJECT?(r.queryType="SELECT",i=e.variables):t===p.ASK?r.queryType="ASK":t===p.DESCRIBE&&(r.queryType="DESCRIBE",i=e.terms);const a=y.extend,o=y.group,s=y.aggregates,u=y.order;b(),y.project=!0;let l=h.default.flatten([v(e.input)]);1===l.length&&"group"===l[0].type&&(l=l[0].patterns),r.where=l;let d={};for(let e of y.aggregates)d[T(e.variable)]=_(e);let f={};for(let e=y.extend.length-1;e>=0;--e){let t=y.extend[e];f[T(t.variable)]=x(_(t.expression),d)}if(y.group.length>0&&(n.group=y.group.map((e=>{let t=T(e);if(f[t]){let r=f[t];return delete f[t],{variable:e,expression:r}}return{expression:e}}))),y.order.length>0&&(n.order=y.order.map(v).map((e=>e.descending?e:{expression:e}))),i&&(n.variables=i.map((e=>{let t=T(e);return f[t]?{variable:e,expression:f[t]}:e})),0===n.variables.length&&(n.variables=[new c.Wildcard])),r.where.length>0&&"filter"===r.where[r.where.length-1].type){const e=r.where[r.where.length-1];R(e,Object.keys(d))&&(n.having=h.default.flatten([x(e.expression,d)]),r.where.splice(-1))}return y.extend=a,y.group=o,y.aggregates=s,y.order=u,{type:"group",patterns:[n]}}function R(e,t){return h.default.isSimpleTerm(e)?t.indexOf(T(e))>=0:Array.isArray(e)?e.some((e=>R(e,t))):e===Object(e)?Object.keys(e).some((r=>R(e[r],t))):t.indexOf(e)>=0}function I(e,t){const r=[{type:t,silent:Boolean(e.silent)}];return"DEFAULT"===e.source?r[0].graph={default:!0}:"NAMED"===e.source?r[0].graph={named:!0}:"ALL"===e.source?r[0].graph={all:!0}:r[0].graph={type:"graph",name:e.source},{prefixes:{},type:"update",updates:r}}function N(e,t){const r=[{type:t,silent:Boolean(e.silent)}];return r[0].source="DEFAULT"===e.source?{type:"graph",default:!0}:{type:"graph",name:e.source},r[0].destination="DEFAULT"===e.destination?{type:"graph",default:!0}:{type:"graph",name:e.destination},{prefixes:{},type:"update",updates:r}}function j(e){if(!e)return[];const t={};return e.forEach((e=>{const r=e.graph.value;t[r]||(t[r]=[]),t[r].push(e)})),Object.keys(t).map((e=>""===e?{type:"bgp",triples:t[e].map(E)}:{type:"graph",triples:t[e].map(E),name:t[e][0].graph}))}function D(e,t){if(Array.isArray(e))return e.map((e=>D(e,t)));if(!e.type)return e;if(e.type===p.DELETE_INSERT)return e;if((e.type===p.PATTERN||e.type===p.PATH)&&e.graph)return t.push(e.graph),""!==e.graph.name?e.type===p.PATTERN?g.createPattern(e.subject,e.predicate,e.object):g.createPath(e.subject,e.predicate,e.object):e;const r={},n={},i={};for(let t of Object.keys(e)){const a=[];if(r[t]=D(e[t],a),a.length>0){n[t]=a;for(const e of a)i[e.value]=e}}const a=Object.keys(i);if(a.length>0)if(1!==a.length||[p.PROJECT,p.SERVICE].includes(e.type)){if(e.type===p.BGP)return function(e,t){var r;const n={};for(let i=0;i""===n[e][0].value?t:g.createGraph(t,n[e][r]))):""!==n[e][0].value&&(r[e]=g.createGraph(t,n[e][0]))}}else t.push(i[a[0]]);return r}t.toSparql=function(e,t={}){return new c.Generator(t).stringify(m(e))},t.toSparqlJs=m},73776:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=r(29252),u=r(43347),c=a(r(13079)),l=o(r(91409)),d=o(r(64995)),h=r(98082).Parser,p=c.types;let f,y=new Set,g=0,m=!1;function b(e,t,r){if(y=new Set,g=0,m=Boolean(t),!e.type)return f.createNop();if("query"!==e.type&&"update"!==e.type)throw new Error("Translate only works on complete query or update objects.");let n;var i;return w(e),"query"===e.type?(n=S({type:"group",patterns:e.where||[]}),n=function(e,t){const r=e,n=[],i={};if(r.variables=r.variables&&r.variables.map((e=>C(e,i))),r.having=r.having&&r.having.map((e=>C(e,i))),r.order=r.order&&r.order.map((e=>C(e,i))),r.group||Object.keys(i).length>0){const e=Object.keys(i).map((e=>function(e,t){if("aggregate"!==e.type||!e.aggregation)throw new Error(`Unexpected input: ${JSON.stringify(e)}`);const r=O(e);return r.variable=t,r}(i[e],f.createTerm(e)))),n=[];if(r.group)for(const e of r.group)if(d.default.isSimpleTerm(e.expression))n.push(e.expression);else{const r="variable"in e?e.variable:A();t=f.createExtend(t,r,O(e.expression)),n.push(r)}t=f.createGroup(t,n,e)}if(r.having)for(let e of r.having)t=f.createFilter(t,O(e));e.values&&(t=f.createJoin([t,P(e)]));let a=[];if("SELECT"===e.queryType||"DESCRIBE"===e.queryType)if(e.variables.some((e=>e&&d.default.isWildcard(e))))a=Object.values(T(e)).sort(((e,t)=>e.value.localeCompare(t.value)));else for(let t of e.variables)_(t)||!("variable"in t)?a.push(t):t.variable&&(a.push(t.variable),n.push(t));for(let e of n)t=f.createExtend(t,e.variable,O(e.expression));return r.order&&(t=f.createOrderBy(t,r.order.map((e=>{let t=O(e.expression);return e.descending&&(t=f.createOperatorExpression("desc",[t])),t})))),"SELECT"===e.queryType&&(t=f.createProject(t,a)),r.distinct&&(t=f.createDistinct(t)),r.reduced&&(t=f.createReduced(t)),"CONSTRUCT"===e.queryType?t=f.createConstruct(t,(e.template||[]).map(R)):"ASK"===e.queryType?t=f.createAsk(t):"DESCRIBE"===e.queryType&&(t=f.createDescribe(t,a)),(r.offset||r.limit)&&(t=f.createSlice(t,r.offset||0,r.limit)),r.from&&(t=f.createFrom(t,r.from.default,r.from.named)),t}(e,n)):"update"===e.type&&(n=1===(i=e).updates.length?L(i.updates[0]):f.createCompositeUpdate(i.updates.map(L))),r&&(n=M(n)),n}function v(e){return Boolean(null==e?void 0:e.termType)}function _(e){return"Variable"===(null==e?void 0:e.termType)}function w(e){if(v(e))_(e)&&y.add(`?${e.value}`);else if(Array.isArray(e))for(const t of e)w(t);else if(e&&"object"==typeof e)for(let t of Object.keys(e))t.startsWith("?")&&y.add(t),w(e[t])}function T(e){let t={};if((r=e).subject&&r.predicate&&r.object){const r=[T(e.subject),T(e.predicate),T(e.object),e.graph?T(e.graph):{}];Object.assign(t,...r)}else if(v(e))_(e)&&(t[e.value]=e);else if("bgp"===e.type){const r=e.triples;Object.assign(t,...r.map(T))}else if("path"===e.type)Object.assign(t,...e.items.map(T));else if("group"===e.type||"union"===e.type||"optional"===e.type)Object.assign(t,...e.patterns.map(T));else if("service"===e.type||"graph"===e.type)Object.assign(t,T(e.name)),Object.assign(t,...e.patterns.map(T));else if("bind"===e.type)Object.assign(t,T(e.variable));else if("values"===e.type){if(e.values.length>0){const r=Object.keys(e.values[0]).map((e=>f.createTerm(e)));Object.assign(t,...r.map(T))}}else if("query"===e.type&&("SELECT"===e.queryType||"DESCRIBE"===e.queryType)){e.where&&e.variables.some(d.default.isWildcard)&&Object.assign(t,...e.where.map(T));for(const r of e.variables)_(r)?Object.assign(t,T(r)):r.variable&&Object.assign(t,T(r.variable));if("SELECT"===e.queryType){if(e.group)for(const r of e.group)r.variable&&Object.assign(t,T(r.variable));if(e.values){const r={type:"values",values:e.values};Object.assign(t,T(r))}}}var r;return t}function S(e){if("bgp"===e.type)return function(e){let t=[],r=[];for(let i of e.triples)if("pathType"in i.predicate){let e=x((n=i).subject,E(n.predicate),n.object);for(let n of e)n.type===p.PATH?(t.length>0&&r.push(f.createBgp(t)),t=[],r.push(n)):t.push(n)}else t.push(R(i));var n;return t.length>0&&r.push(f.createBgp(t)),1===r.length?r[0]:f.createJoin(r)}(e);if("union"===e.type)return f.createUnion(e.patterns.map((e=>("group"!==e.type&&(e={type:"group",patterns:[e]}),S(e)))));if("graph"===e.type){let t=S({type:"group",patterns:e.patterns});return t=m?N(t,e.name):f.createGraph(t,e.name),t}if("values"===e.type)return P(e);if("query"===e.type)return b(e,m,!1);if("group"===e.type){let t=[],r=[];for(let n of e.patterns)("filter"===n.type?t:r).push(n);let n=r.reduce(j,f.createBgp([])),i=t.map((e=>O(e.expression)));return i.length>0&&(n=f.createFilter(n,i.reduce(((e,t)=>f.createOperatorExpression("&&",[e,t]))))),n}throw new Error(`Unexpected type: ${e.type}`)}function O(e){if(d.default.isSimpleTerm(e))return f.createTermExpression(e);if(d.default.isQuad(e))return d.default.hasQuadVariables(e)?f.createOperatorExpression("triple",[O(e.subject),O(e.predicate),O(e.object)]):f.createTermExpression(e);if(d.default.isWildcard(e))return f.createWildcardExpression();if("aggregation"in e)return f.createAggregateExpression(e.aggregation,O(e.expression),Boolean(e.distinct),e.separator);if("function"in e)return f.createNamedExpression(e.function,e.args.map(O));if("operator"in e)return"exists"===e.operator||"notexists"===e.operator?f.createExistenceExpression("notexists"===e.operator,S(e.args[0])):("in"!==e.operator&&"notin"!==e.operator||(e.args=[e.args[0]].concat(e.args[1])),f.createOperatorExpression(e.operator,e.args.map(O)));throw new Error(`Unknown expression: ${JSON.stringify(e)}`)}function E(e){if(d.default.isSimpleTerm(e)){if("NamedNode"===e.termType)return f.createLink(e);throw new Error(`Path predicate should be a NamedNode, got ${JSON.stringify(e)}`)}if("^"===e.pathType)return f.createInv(E(e.items[0]));if("!"===e.pathType){let t,r=[],n=[];t="pathType"in e.items[0]&&"|"===e.items[0].pathType?e.items[0].items:e.items;for(let e of t)if(d.default.isSimpleTerm(e))r.push(e);else{if("^"!==e.pathType)throw new Error(`Unexpected item: ${JSON.stringify(e)}`);n.push(e.items[0])}let i=f.createNps(r),a=f.createInv(f.createNps(n));return 0===n.length?i:0===r.length?a:f.createAlt([i,a])}if("/"===e.pathType)return f.createSeq(e.items.map(E));if("|"===e.pathType)return f.createAlt(e.items.map(E));if("*"===e.pathType)return f.createZeroOrMorePath(E(e.items[0]));if("+"===e.pathType)return f.createOneOrMorePath(E(e.items[0]));if("?"===e.pathType)return f.createZeroOrOnePath(E(e.items[0]));throw new Error(`Unable to translate path expression ${JSON.stringify(e)}`)}function x(e,t,r){if(t.type===p.LINK)return[f.createPattern(e,t.iri,r)];if(t.type===p.INV)return x(r,t.path,e);if(t.type===p.SEQ){let n=e;return d.default.flatten(t.input.map(((e,i)=>{const a=i===t.input.length-1?r:A(),o=x(n,e,a);return"Variable"===a.termType&&(n=a),o})))}return[f.createPath(e,t,r)]}function A(){let e="?var"+g++;return y.has(e)?A():(y.add(e),f.createTerm(e))}function R(e){if("pathType"in e.predicate)throw new Error("Trying to translate property path to quad.");return f.createPattern(e.subject,e.predicate,e.object,e.graph)}t.default=function(e,t){let r;if(t=t||{},f=new l.default(t.dataFactory),"string"==typeof e){let n=new h(t);n._resetBlanks(),r=n.parse(e)}else r=e;return b(r,t.quads,t.blankToVariable)};let I=Object.values(p);function N(e,t,r){if(e.type===p.GRAPH){if(r)throw new Error("Recursing through nested GRAPH statements with a replacement is impossible.");e=N(e.input,e.name)}else if(e.type===p.SERVICE);else if(e.type===p.BGP)e.patterns=e.patterns.map((e=>(r&&(e.subject.equals(t)&&(e.subject=r),e.predicate.equals(t)&&(e.predicate=r),e.object.equals(t)&&(e.object=r)),"DefaultGraph"===e.graph.termType&&(e.graph=t),e)));else if(e.type===p.PATH)r&&(e.subject.equals(t)&&(e.subject=r),e.object.equals(t)&&(e.object=r)),"DefaultGraph"===e.graph.termType&&(e.graph=t);else if(e.type!==p.PROJECT||r)if(e.type!==p.EXTEND||r)for(let n of Object.keys(e))Array.isArray(e[n])?e[n]=e[n].map((e=>N(e,t,r))):I.indexOf(e[n].type)>=0?e[n]=N(e[n],t,r):r&&_(e[n])&&e[n].equals(t)&&(e[n]=r);else e.variable.equals(t)&&(r=A()),e.input=N(e.input,t,r);else e.variables.some((e=>e.equals(t)))||(r=A()),e.input=N(e.input,t,r);return e}function j(e,t){if("optional"===t.type){const r=S({type:"group",patterns:t.patterns});e=r.type===p.FILTER?f.createLeftJoin(e,r.input,r.expression):f.createLeftJoin(e,r)}else if("minus"===t.type){const r=S({type:"group",patterns:t.patterns});e=f.createMinus(e,r)}else if("bind"===t.type)e=f.createExtend(e,t.variable,O(t.expression));else if("service"===t.type){const r={type:"group",patterns:t.patterns};e=D(e,f.createService(S(r),t.name,t.silent))}else e=D(e,S(t));return e}function D(e,t){return e.type===p.BGP&&t.type===p.BGP?e=f.createBgp([...e.patterns,...t.patterns]):e.type===p.BGP&&0===e.patterns.length?e=t:t.type===p.BGP&&0===t.patterns.length||(e=f.createJoin([e,t])),e}function P(e){let t=(0===e.values.length?[]:Object.keys(e.values[0])).map(f.createTerm.bind(f)),r=e.values.map((e=>{let t=Object.keys(e);t=t.filter((t=>void 0!==e[t]));let r={};for(let n of t)r[n]=e[n];return r}));return f.createValues(t,r)}function C(e,t){if("type"in e&&"aggregate"===e.type){let r,n=!1;for(let i of Object.keys(t))if(s(t[i],e)){r=f.createTerm(i),n=!0;break}return n||(r=A(),t[(0,u.termToString)(r)]=e),r}return"expression"in e&&e.expression?{...e,expression:C(e.expression,t)}:"args"in e&&e.args?{...e,args:e.args.map((e=>C(e,t)))}:e}function L(e){if("type"in e){if("load"===e.type)return function(e){return f.createLoad(e.source,e.destination,e.silent)}(e);if("clear"===e.type||"create"===e.type||"drop"===e.type)return function(e){let t;switch(t=d.default.isSimpleTerm(e.graph)?e.graph:e.graph.all?"ALL":e.graph.default?"DEFAULT":e.graph.named?"NAMED":e.graph.name,e.type){case"clear":return f.createClear(t,e.silent);case"create":return f.createCreate(t,e.silent);case"drop":return f.createDrop(t,e.silent)}}(e);if("add"===e.type||"copy"===e.type||"move"===e.type)return function(e){const t=e.source.default?"DEFAULT":e.source.name,r=e.destination.default?"DEFAULT":e.destination.name;switch(e.type){case"copy":return f.createCopy(t,r,e.silent);case"move":return f.createMove(t,r,e.silent);case"add":return f.createAdd(t,r,e.silent)}}(e)}else if("insertdelete"===e.updateType||"deletewhere"===e.updateType||"delete"===e.updateType||"insert"===e.updateType)return function(e){if(!m)throw new Error("INSERT/DELETE operations are only supported with quads option enabled");let t,r=[],n=[];if(e.delete&&(r=d.default.flatten(e.delete.map((t=>k(t,e.graph))))),e.insert&&(n=d.default.flatten(e.insert.map((t=>k(t,e.graph))))),e.where&&e.where.length>0){t=S({type:"group",patterns:e.where});const r=e.using;r?t=f.createFrom(t,r.default,r.named):e.graph&&(t=N(t,e.graph))}else"deletewhere"===e.updateType&&r.length>0&&(t=f.createBgp(r));return f.createDeleteInsert(r.length>0?r:void 0,n.length>0?n:void 0,t)}(e);throw new Error(`Unknown update type ${JSON.stringify(e)}`)}function k(e,t){let r=t;"graph"===e.type&&(r=e.name);let n=e.triples;return r&&(n=n.map((e=>Object.assign(e,{graph:r})))),n.map(R)}function M(e){const t={},r=Array.from(y).reduce(((e,t)=>(e[t]=!0,e)),{});return d.default.mapOperation(e,{[c.types.DELETE_INSERT]:e=>({result:e,recurse:!1}),[c.types.PATH]:(e,t)=>({result:t.createPath(n(e.subject),e.predicate,n(e.object),n(e.graph)),recurse:!1}),[c.types.PATTERN]:(e,t)=>({result:t.createPattern(n(e.subject),n(e.predicate),n(e.object),n(e.graph)),recurse:!1}),[c.types.CONSTRUCT]:e=>({result:f.createConstruct(M(e.input),e.template),recurse:!1})});function n(e){if("BlankNode"===e.termType){let n=t[e.value];return n||(n=d.default.createUniqueVariable(e.value,r,f.dataFactory),r[n.value]=!0,t[e.value]=n),n}return e}}},64995:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(13079),a=n(r(91409)),o=r(3285);class s{static flatten(e){return Array.prototype.concat(...e).filter((e=>e))}static objectify(e){if(e.termType){if("Quad"===e.termType)return{type:"pattern",termType:"Quad",subject:s.objectify(e.subject),predicate:s.objectify(e.predicate),object:s.objectify(e.object),graph:s.objectify(e.graph)};{let t={termType:e.termType,value:e.value};return e.language&&(t.language=e.language),e.datatype&&(t.datatype=s.objectify(e.datatype)),t}}if(Array.isArray(e))return e.map((e=>s.objectify(e)));if(e===Object(e)){let t={};for(let r of Object.keys(e))t[r]=s.objectify(e[r]);return t}return e}static inScopeVariables(e){const t=[];function r(e){t.find((t=>e.value===t.value))||t.push(e)}function n(e){"Variable"===e.subject.termType&&r(e.subject),"Variable"===e.predicate.termType&&r(e.predicate),"Variable"===e.object.termType&&r(e.object),"Variable"===e.graph.termType&&r(e.graph),"Quad"===e.subject.termType&&n(e.subject),"Quad"===e.predicate.termType&&n(e.predicate),"Quad"===e.object.termType&&n(e.object),"Quad"===e.graph.termType&&n(e.graph)}return s.recurseOperation(e,{[i.types.EXPRESSION]:e=>(e.expressionType===i.expressionTypes.AGGREGATE&&e.variable&&r(e.variable),!0),[i.types.EXTEND]:e=>(r(e.variable),!0),[i.types.GRAPH]:e=>("Variable"===e.name.termType&&r(e.name),!0),[i.types.GROUP]:e=>(e.variables.forEach(r),!0),[i.types.PATH]:e=>("Variable"===e.subject.termType&&r(e.subject),"Variable"===e.object.termType&&r(e.object),"Variable"===e.graph.termType&&r(e.graph),"Quad"===e.subject.termType&&n(e.subject),"Quad"===e.object.termType&&n(e.object),"Quad"===e.graph.termType&&n(e.graph),!0),[i.types.PATTERN]:e=>(n(e),!0),[i.types.PROJECT]:e=>(e.variables.forEach(r),!1),[i.types.SERVICE]:e=>("Variable"===e.name.termType&&r(e.name),!0),[i.types.VALUES]:e=>(e.variables.forEach(r),!0)}),t}static recurseOperation(e,t){let r=e,n=!0;const a=t[e.type];if(a&&(n=a(e)),!n)return;let o=e=>s.recurseOperation(e,t);switch(r.type){case i.types.ALT:r.input.map(o);break;case i.types.ASK:o(r.input);break;case i.types.BGP:r.patterns.forEach(o);break;case i.types.CONSTRUCT:o(r.input),r.template.map(o);break;case i.types.DESCRIBE:case i.types.DISTINCT:o(r.input);break;case i.types.EXPRESSION:r.expressionType===i.expressionTypes.EXISTENCE&&o(r.input);break;case i.types.EXTEND:case i.types.FILTER:o(r.input),o(r.expression);break;case i.types.FROM:case i.types.GRAPH:o(r.input);break;case i.types.GROUP:o(r.input),r.aggregates.forEach(o);break;case i.types.INV:o(r.path);break;case i.types.JOIN:r.input.map(o);break;case i.types.LEFT_JOIN:r.input.map(o),r.expression&&o(r.expression);break;case i.types.LINK:break;case i.types.MINUS:r.input.map(o);break;case i.types.NOP:case i.types.NPS:break;case i.types.ONE_OR_MORE_PATH:o(r.path);break;case i.types.ORDER_BY:o(r.input),r.expressions.forEach(o);break;case i.types.PATH:o(r.predicate);break;case i.types.PATTERN:break;case i.types.PROJECT:case i.types.REDUCED:o(r.input);break;case i.types.SEQ:r.input.map(o);break;case i.types.SERVICE:case i.types.SLICE:o(r.input);break;case i.types.UNION:r.input.map(o);break;case i.types.VALUES:break;case i.types.ZERO_OR_MORE_PATH:case i.types.ZERO_OR_ONE_PATH:o(r.path);break;case i.types.COMPOSITE_UPDATE:r.updates.forEach((e=>o(e)));break;case i.types.DELETE_INSERT:r.delete&&r.delete.forEach((e=>o(e))),r.insert&&r.insert.forEach((e=>o(e))),r.where&&o(r.where);break;case i.types.LOAD:case i.types.CLEAR:case i.types.CREATE:case i.types.DROP:case i.types.ADD:case i.types.MOVE:case i.types.COPY:break;default:throw new Error(`Unknown Operation type ${r.type}`)}}static mapOperation(e,t,r){let n=e,o=!0,u=!0;r=r||new a.default;const c=t[e.type];if(c){const t=c(e,r);n=t.result,o=t.recurse,u=!1!==t.copyMetadata}let l;if(u&&(n.metadata||e.metadata)&&(l={...n.metadata,...e.metadata}),!o)return l&&(n.metadata=l),n;let d=e=>s.mapOperation(e,t,r);switch(n.type){case i.types.ALT:n=r.createAlt(n.input.map(d));break;case i.types.ASK:n=r.createAsk(d(n.input));break;case i.types.BGP:n=r.createBgp(n.patterns.map(d));break;case i.types.CONSTRUCT:n=r.createConstruct(d(n.input),n.template.map(d));break;case i.types.DESCRIBE:n=r.createDescribe(d(n.input),n.terms);break;case i.types.DISTINCT:n=r.createDistinct(d(n.input));break;case i.types.EXPRESSION:n=s.mapExpression(n,t,r);break;case i.types.EXTEND:n=r.createExtend(d(n.input),n.variable,d(n.expression));break;case i.types.FILTER:n=r.createFilter(d(n.input),d(n.expression));break;case i.types.FROM:n=r.createFrom(d(n.input),[...n.default],[...n.named]);break;case i.types.GRAPH:n=r.createGraph(d(n.input),n.name);break;case i.types.GROUP:n=r.createGroup(d(n.input),[].concat(n.variables),n.aggregates.map(d));break;case i.types.INV:n=r.createInv(d(n.path));break;case i.types.JOIN:n=r.createJoin(n.input.map(d));break;case i.types.LEFT_JOIN:n=r.createLeftJoin(d(n.input[0]),d(n.input[1]),n.expression?d(n.expression):void 0);break;case i.types.LINK:n=r.createLink(n.iri);break;case i.types.MINUS:n=r.createMinus(d(n.input[0]),d(n.input[1]));break;case i.types.NOP:n=r.createNop();break;case i.types.NPS:n=r.createNps([].concat(n.iris));break;case i.types.ONE_OR_MORE_PATH:n=r.createOneOrMorePath(d(n.path));break;case i.types.ORDER_BY:n=r.createOrderBy(d(n.input),n.expressions.map(d));break;case i.types.PATH:n=r.createPath(n.subject,d(n.predicate),n.object,n.graph);break;case i.types.PATTERN:n=r.createPattern(n.subject,n.predicate,n.object,n.graph);break;case i.types.PROJECT:n=r.createProject(d(n.input),[...n.variables]);break;case i.types.REDUCED:n=r.createReduced(d(n.input));break;case i.types.SEQ:n=r.createSeq(n.input.map(d));break;case i.types.SERVICE:n=r.createService(d(n.input),n.name,n.silent);break;case i.types.SLICE:n=r.createSlice(d(n.input),n.start,n.length);break;case i.types.UNION:n=r.createUnion(n.input.map(d));break;case i.types.VALUES:n=r.createValues([].concat(n.variables),n.bindings.map((e=>Object.assign({},e))));break;case i.types.ZERO_OR_MORE_PATH:n=r.createZeroOrMorePath(d(n.path));break;case i.types.ZERO_OR_ONE_PATH:n=r.createZeroOrOnePath(d(n.path));break;case i.types.COMPOSITE_UPDATE:n=r.createCompositeUpdate(n.updates.map(d));break;case i.types.DELETE_INSERT:n=r.createDeleteInsert(n.delete?n.delete.map(d):void 0,n.insert?n.insert.map(d):void 0,n.where?d(n.where):void 0);break;case i.types.LOAD:n=r.createLoad(n.source,n.destination,n.silent);break;case i.types.CLEAR:n=r.createClear(n.source,n.silent);break;case i.types.CREATE:n=r.createCreate(n.source,n.silent);break;case i.types.DROP:n=r.createDrop(n.source,n.silent);break;case i.types.ADD:n=r.createAdd(n.source,n.destination);break;case i.types.MOVE:n=r.createMove(n.source,n.destination);break;case i.types.COPY:n=r.createCopy(n.source,n.destination);break;default:throw new Error(`Unknown Operation type ${n.type}`)}return l&&(n.metadata=l),n}static mapExpression(e,t,r){let n=e,o=!0;r=r||new a.default;const u=t[e.expressionType];if(u&&({result:n,recurse:o}=u(e,r)),!o)return n;let c=e=>s.mapOperation(e,t,r);switch(e.expressionType){case i.expressionTypes.AGGREGATE:return e.variable?r.createBoundAggregate(e.variable,e.aggregator,c(e.expression),e.distinct,e.separator):r.createAggregateExpression(e.aggregator,c(e.expression),e.distinct,e.separator);case i.expressionTypes.EXISTENCE:return r.createExistenceExpression(e.not,c(e.input));case i.expressionTypes.NAMED:return r.createNamedExpression(e.name,e.args.map(c));case i.expressionTypes.OPERATOR:return r.createOperatorExpression(e.operator,e.args.map(c));case i.expressionTypes.TERM:return r.createTermExpression(e.term);case i.expressionTypes.WILDCARD:return r.createWildcardExpression();default:throw new Error(`Unknown Expression type ${e.expressionType}`)}}static cloneOperation(e){return s.mapOperation(e,{})}static cloneExpression(e){return s.mapExpression(e,{})}static createUniqueVariable(e,t,r){let n=0,i=e;for(;t[i];)i=`${e}${n++}`;return r.variable(i)}static isSimpleTerm(e){return void 0!==e.termType&&"Quad"!==e.termType&&"Wildcard"!==e.termType}static isQuad(e){return"Quad"===e.termType}static hasQuadVariables(e){return(0,o.someTermsNested)(e,(e=>"Variable"===e.termType))}static isWildcard(e){return"Wildcard"===e.termType}}t.default=s},23825:e=>{function t(e){this._options=e=e||{};var t=e.prefixes||{};this._prefixByIri={};var r=[];for(var n in t){var i=t[n];o(i)&&(this._prefixByIri[i]=n,r.push(i))}var a=r.join("|").replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&");this._prefixRegex=new RegExp("^("+a+")([a-zA-Z][\\-_a-zA-Z0-9]*)$"),this._usedPrefixes={},this._sparqlStar=e.sparqlStar,this._indent=o(e.indent)?e.indent:" ",this._newline=o(e.newline)?e.newline:"\n",this._explicitDatatype=Boolean(e.explicitDatatype)}t.prototype.toQuery=function(e){var t="";return e.queryType&&(t+=e.queryType.toUpperCase()+" "),e.reduced&&(t+="REDUCED "),e.distinct&&(t+="DISTINCT "),e.variables?t+=c(e.variables,void 0,(function(e){return s(e)?this.toEntity(e):"("+this.toExpression(e.expression)+" AS "+a(e.variable)+")"}),this)+" ":e.template&&(t+=this.group(e.template,!0)+this._newline),e.from&&(t+=this.graphs("FROM ",e.from.default)+this.graphs("FROM NAMED ",e.from.named)),e.where&&(t+="WHERE "+this.group(e.where,!0)+this._newline),e.updates&&(t+=c(e.updates,";"+this._newline,this.toUpdate,this)),e.group&&(t+="GROUP BY "+c(e.group,void 0,(function(e){var t=s(e.expression)?this.toEntity(e.expression):"("+this.toExpression(e.expression)+")";return e.variable?"("+t+" AS "+a(e.variable)+")":t}),this)+this._newline),e.having&&(t+="HAVING ("+c(e.having,void 0,this.toExpression,this)+")"+this._newline),e.order&&(t+="ORDER BY "+c(e.order,void 0,(function(e){var t="("+this.toExpression(e.expression)+")";return e.descending?"DESC "+t:t}),this)+this._newline),e.offset&&(t+="OFFSET "+e.offset+this._newline),e.limit&&(t+="LIMIT "+e.limit+this._newline),e.values&&(t+=this.values(e)),(t=this.baseAndPrefixes(e)+t).trim()},t.prototype.baseAndPrefixes=function(e){var t=e.base?"BASE <"+e.base+">"+this._newline:"",r="";for(var n in e.prefixes)(this._options.allPrefixes||this._usedPrefixes[n])&&(r+="PREFIX "+n+": <"+e.prefixes[n]+">"+this._newline);return t+r},t.prototype.toPattern=function(e){var t=e.type||e instanceof Array&&"array"||(e.subject&&e.predicate&&e.object?"triple":"");if(!(t in this))throw new Error("Unknown entry type: "+t);return this[t](e)},t.prototype.triple=function(e){return this.toEntity(e.subject)+" "+this.toEntity(e.predicate)+" "+this.toEntity(e.object)+"."},t.prototype.array=function(e){return c(e,this._newline,this.toPattern,this)},t.prototype.bgp=function(e){return this.encodeTriples(e.triples)},t.prototype.encodeTriples=function(e){if(!e.length)return"";for(var t=[],r=void 0,n=void 0,i=0;i":case">=":case"<=":case"&&":case"||":case"=":case"!=":case"+":case"-":case"*":case"/":return(s(i[0])?this.toEntity(i[0]):"("+this.toExpression(i[0])+")")+" "+t+" "+(s(i[1])?this.toEntity(i[1]):"("+this.toExpression(i[1])+")");case"!":return"!("+this.toExpression(i[0])+")";case"uplus":return"+("+this.toExpression(i[0])+")";case"uminus":return"-("+this.toExpression(i[0])+")";case"notin":t="NOT IN";case"in":return this.toExpression(i[0])+" "+t+"("+(o(i[1])?i[1]:c(i[1],", ",this.toExpression,this))+")";case"notexists":t="NOT EXISTS";case"exists":return t+" "+this.group(i[0],!0);default:return t+"("+c(i,", ",this.toExpression,this)+")"}default:throw new Error("Unknown expression type: "+e.type)}},t.prototype.toEntity=function(e){if(s(e))switch(e.termType){case"Wildcard":return"*";case"Variable":return a(e);case"BlankNode":return"_:"+e.value;case"Literal":var t=e.value||"",i=e.language||"",o=e.datatype;if(e='"'+t.replace(r,n)+'"',i)e+="@"+i;else if(o){if(!this._explicitDatatype)switch(o.value){case"http://www.w3.org/2001/XMLSchema#string":return e;case"http://www.w3.org/2001/XMLSchema#integer":if(/^\d+$/.test(t))return t+" "}e+="^^"+this.encodeIRI(o.value)}return e;case"Quad":if(!this._sparqlStar)throw new Error("SPARQL* support is not enabled");return e.graph&&"DefaultGraph"!==e.graph.termType?"<< GRAPH "+this.toEntity(e.graph)+" { "+this.toEntity(e.subject)+" "+this.toEntity(e.predicate)+" "+this.toEntity(e.object)+" } >>":"<< "+this.toEntity(e.subject)+" "+this.toEntity(e.predicate)+" "+this.toEntity(e.object)+" >>";default:return this.encodeIRI(e.value)}else{var u=e.items.map(this.toEntity,this),c=e.pathType;switch(c){case"^":case"!":return c+u[0];case"*":case"+":case"?":return"("+u[0]+c+")";default:return"("+u.join(c)+")"}}};var r=/["\\\t\n\r\b\f]/g,n=function(e){return i[e]},i={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};function a(e){return"?"+e.value}function o(e){return"string"==typeof e}function s(e){return"string"==typeof e.termType}function u(e,t){if(!e||!s(e))return!1;if(!t||!s(t))return!1;if(e.termType!==t.termType)return!1;switch(e.termType){case"Literal":return e.value===t.value&&e.language===t.language&&u(e.datatype,t.datatype);case"Quad":return u(e.subject,t.subject)&&u(e.predicate,t.predicate)&&u(e.object,t.object)&&u(e.graph,t.graph);default:return e.value===t.value}}function c(e,t,r,n){return e.map(r,n).join(o(t)?t:" ")}t.prototype.encodeIRI=function(e){var t=this._prefixRegex.exec(e);if(t){var r=this._prefixByIri[t[1]];return this._usedPrefixes[r]=!0,r+":"+t[2]}return"<"+e+">"},t.prototype.toUpdate=function(e){switch(e.type||e.updateType){case"load":return"LOAD"+(e.source?" "+this.toEntity(e.source):"")+(e.destination?" INTO GRAPH "+this.toEntity(e.destination):"");case"insert":return"INSERT DATA "+this.group(e.insert,!0);case"delete":return"DELETE DATA "+this.group(e.delete,!0);case"deletewhere":return"DELETE WHERE "+this.group(e.delete,!0);case"insertdelete":return(e.graph?"WITH "+this.toEntity(e.graph)+this._newline:"")+(e.delete.length?"DELETE "+this.group(e.delete,!0)+this._newline:"")+(e.insert.length?"INSERT "+this.group(e.insert,!0)+this._newline:"")+(e.using?this.graphs("USING ",e.using.default):"")+(e.using?this.graphs("USING NAMED ",e.using.named):"")+"WHERE "+this.group(e.where,!0);case"add":case"copy":case"move":return e.type.toUpperCase()+" "+(e.silent?"SILENT ":"")+(e.source.default?"DEFAULT":this.toEntity(e.source.name))+" TO "+this.toEntity(e.destination.name);case"create":case"clear":case"drop":return e.type.toUpperCase()+(e.silent?" SILENT ":" ")+(e.graph.default?"DEFAULT":e.graph.named?"NAMED":e.graph.all?"ALL":"GRAPH "+this.toEntity(e.graph.name));default:throw new Error("Unknown update query type: "+e.type)}},t.prototype.indent=function(e){return e.replace(/^/gm,this._indent)},e.exports=function(e={}){return{stringify:function(r){var n=Object.create(e);return n.prefixes=r.prefixes,new t(n).toQuery(r)},createGenerator:function(){return new t(e)}}}},83849:(e,t,r)=>{var n=function(){var e=function(e,t,r,n){for(r=r||{},n=e.length;n--;r[e[n]]=t);return r},t=[6,12,13,15,16,24,32,36,41,45,100,110,113,115,116,123,126,131,197,224,229,308,329,330,331,332,333],n=[2,247],i=[100,110,113,115,116,123,126,131,329,330,331,332,333],a=[2,409],o=[1,18],s=[1,27],u=[13,16,45,197,224,229,308],c=[28,29,53],l=[28,53],d=[1,42],h=[1,45],p=[1,41],f=[1,44],y=[123,126],g=[1,67],m=[39,45,87],b=[13,16,45,197,224,308],v=[1,87],_=[2,281],w=[1,86],T=[13,16,45,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],S=[6,28,29,53,63,70,73,81,83,85],O=[6,13,16,28,29,53,63,70,73,81,83,85,87,308],E=[6,13,16,28,29,45,53,63,70,73,81,82,83,85,87,89,197,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314],x=[6,13,16,28,29,31,39,45,47,48,53,63,70,73,81,82,83,85,87,89,109,112,121,123,126,128,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,337,338,340,341,342,343,344,345,346],A=[13,16,308],R=[112,132,327,334],I=[13,16,112,132,308],N=[1,111],j=[1,117],D=[112,132,327,328,334],P=[13,16,112,132,308,328],C=[28,29,45,53,87],L=[1,138],k=[1,151],M=[1,128],F=[1,127],B=[1,129],U=[1,140],V=[1,141],q=[1,142],$=[1,143],Q=[1,144],G=[1,145],z=[1,147],H=[1,148],X=[2,457],J=[1,158],K=[1,159],W=[1,160],Y=[1,152],Z=[1,153],ee=[1,156],te=[1,171],re=[1,172],ne=[1,173],ie=[1,174],ae=[1,175],oe=[1,176],se=[1,167],ue=[1,168],ce=[1,169],le=[1,170],de=[1,157],he=[1,166],pe=[1,161],fe=[1,162],ye=[1,163],ge=[1,164],me=[1,165],be=[6,13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335],ve=[1,195],_e=[6,31,73,81,83,85],we=[2,285],Te=[1,199],Se=[1,201],Oe=[6,31,70,73,81,83,85],Ee=[2,283],xe=[1,207],Ae=[1,218],Re=[1,223],Ie=[1,219],Ne=[1,225],je=[1,226],De=[1,224],Pe=[6,63,70,73,81,83,85],Ce=[1,236],Le=[2,334],ke=[1,243],Me=[1,241],Fe=[6,193],Be=[2,349],Ue=[2,339],Ve=[28,128],qe=[47,48,193,272],$e=[47,48,193,242,272],Qe=[47,48,193,242,246,272],Ge=[47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,341,342,343,344,345,346],ze=[39,47,48,193,242,246,250,263,265,272,290,297,298,299,300,301,302,338,341,342,343,344,345,346],He=[1,271],Xe=[1,270],Je=[6,13,16,29,31,39,45,47,48,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,338,341,342,343,344,345,346,347,348,349,350,351],Ke=[1,281],We=[1,280],Ye=[13,16,29,31,39,45,47,48,82,85,87,89,112,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346],Ze=[45,89],et=[13,16,29,31,39,45,47,48,82,85,87,89,112,159,160,161,163,164,174,193,197,224,229,231,232,242,246,250,263,265,272,290,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335,338,341,342,343,344,345,346],tt=[13,16,31,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],rt=[31,89],nt=[48,87],it=[6,13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337,338],at=[6,13,16,39,45,48,82,87,89,231,263,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,337,338,340],ot=[1,313],st=[6,85],ut=[6,31,81,83,85],ct=[2,361],lt=[2,353],dt=[1,343],ht=[31,112,335],pt=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],ft=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,197,224,229,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,314,317,318,335],yt=[6,109,193],gt=[31,112],mt=[13,16,45,82,87,224,263,265,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312,346,347,348,349,350,351],bt=[1,390],vt=[1,391],_t=[13,16,87,197,308,314],wt=[13,16,39,45,82,87,224,263,265,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312,346,347,348,349,350,351],Tt=[1,417],St=[1,418],Ot=[13,16,48,197,229,308],Et=[6,31,85],xt=[6,13,16,31,45,73,81,83,85,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],At=[6,13,16,29,31,45,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,231,268,269,270,271,273,274,276,277,279,280,283,285,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,346,347,348,349,350,351],Rt=[29,31,85,112,159,160,161,163,164],It=[1,443],Nt=[1,444],jt=[1,449],Dt=[31,112,193,232,318,335],Pt=[13,16,45,48,82,87,89,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],Ct=[13,16,31,45,48,82,87,89,112,193,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],Lt=[13,16,29,31,45,48,82,85,87,89,112,159,160,161,163,164,193,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],kt=[13,16,31,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],Mt=[31,45],Ft=[1,507],Bt=[1,508],Ut=[6,13,16,29,31,39,45,47,48,63,70,73,76,78,81,82,83,85,87,89,112,159,160,161,163,164,193,231,242,246,250,263,265,268,269,270,271,272,273,274,276,277,279,280,283,285,290,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335,336,338,341,342,343,344,345,346,347,348,349,350,351],Vt=[29,31,85,112,159,160,161,163,164,335],qt=[6,13,16,31,45,70,73,81,83,85,87,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],$t=[13,16,31,45,48,82,87,89,112,193,197,231,232,272,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,317,318,335],Qt=[2,352],Gt=[13,16,197,308,314],zt=[1,565],Ht=[6,13,16,31,45,76,78,81,83,85,87,268,269,270,271,273,274,276,277,279,280,283,285,308,346,347,348,349,350,351],Xt=[13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],Jt=[13,16,29,31,45,82,85,87,89,112,159,160,161,163,164,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312,335],Kt=[13,16,87,308],Wt=[2,364],Yt=[29,31,85,112,159,160,161,163,164,193,232,318,335],Zt=[31,112,193,232,272,318,335],er=[2,359],tr=[13,16,48,82,174,294,295,296,297,298,299,300,301,302,303,304,305,306,308,312],rr=[29,31,85,112,159,160,161,163,164,193,232,272,318,335],nr=[13,16,31,45,82,87,89,112,231,294,295,296,297,298,299,300,301,302,303,304,305,306,308,309,310,312],ir=[2,347],ar={trace:function(){},yy:{},symbols_:{error:2,QueryOrUpdate:3,Prologue:4,QueryOrUpdate_group0:5,EOF:6,Query:7,Qry:8,Query_option0:9,Prologue_repetition0:10,BaseDecl:11,BASE:12,IRIREF:13,PrefixDecl:14,PREFIX:15,PNAME_NS:16,SelectClauseWildcard:17,Qry_repetition0:18,WhereClause:19,SolutionModifierNoGroup:20,SelectClauseVars:21,Qry_repetition1:22,SolutionModifier:23,CONSTRUCT:24,ConstructTemplate:25,Qry_repetition2:26,Qry_repetition3:27,WHERE:28,"{":29,Qry_option0:30,"}":31,DESCRIBE:32,Qry_group0:33,Qry_repetition4:34,Qry_option1:35,ASK:36,Qry_repetition5:37,SelectClauseBase:38,"*":39,SelectClauseVars_repetition_plus0:40,SELECT:41,SelectClauseBase_option0:42,SelectClauseItem:43,Var:44,"(":45,Expression:46,AS:47,")":48,SubSelect:49,SubSelect_option0:50,SubSelect_option1:51,DatasetClause:52,FROM:53,DatasetClause_option0:54,iri:55,WhereClause_option0:56,GroupGraphPattern:57,SolutionModifier_option0:58,SolutionModifierNoGroup_option0:59,SolutionModifierNoGroup_option1:60,SolutionModifierNoGroup_option2:61,GroupClause:62,GROUP:63,BY:64,GroupClause_repetition_plus0:65,GroupCondition:66,BuiltInCall:67,FunctionCall:68,HavingClause:69,HAVING:70,HavingClause_repetition_plus0:71,OrderClause:72,ORDER:73,OrderClause_repetition_plus0:74,OrderCondition:75,ASC:76,BrackettedExpression:77,DESC:78,Constraint:79,LimitOffsetClauses:80,LIMIT:81,INTEGER:82,OFFSET:83,ValuesClause:84,VALUES:85,InlineData:86,VAR:87,InlineData_repetition0:88,NIL:89,InlineData_repetition1:90,InlineData_repetition_plus2:91,InlineData_repetition3:92,DataBlock:93,DataBlockValueList:94,DataBlockValueList_repetition_plus0:95,Update:96,Update_repetition0:97,Update1:98,Update_option0:99,LOAD:100,Update1_option0:101,Update1_option1:102,Update1_group0:103,Update1_option2:104,GraphRefAll:105,Update1_group1:106,Update1_option3:107,GraphOrDefault:108,TO:109,CREATE:110,Update1_option4:111,GRAPH:112,INSERTDATA:113,QuadPattern:114,DELETEDATA:115,DELETEWHERE:116,Update1_option5:117,InsertDeleteClause:118,Update1_repetition0:119,IntoGraphClause:120,INTO:121,GraphRef:122,DELETE:123,InsertDeleteClause_option0:124,InsertClause:125,INSERT:126,UsingClause:127,USING:128,UsingClause_option0:129,WithClause:130,WITH:131,DEFAULT:132,GraphOrDefault_option0:133,GraphRefAll_group0:134,Quads:135,Quads_option0:136,Quads_repetition0:137,QuadsNotTriples:138,VarOrIri:139,QuadsNotTriples_option0:140,QuadsNotTriples_option1:141,QuadsNotTriples_option2:142,TriplesTemplate:143,TriplesTemplate_repetition0:144,TriplesSameSubject:145,TriplesTemplate_option0:146,GroupGraphPatternSub:147,GroupGraphPatternSub_option0:148,GroupGraphPatternSub_repetition0:149,GroupGraphPatternSubTail:150,GraphPatternNotTriples:151,GroupGraphPatternSubTail_option0:152,GroupGraphPatternSubTail_option1:153,TriplesBlock:154,TriplesBlock_repetition0:155,TriplesSameSubjectPath:156,TriplesBlock_option0:157,GroupOrUnionGraphPattern:158,OPTIONAL:159,MINUS:160,SERVICE:161,GraphPatternNotTriples_option0:162,FILTER:163,BIND:164,InlineDataOneVar:165,InlineDataFull:166,InlineDataOneVar_repetition0:167,InlineDataFull_repetition0:168,InlineDataFull_repetition_plus1:169,InlineDataFull_repetition2:170,DataBlockValue:171,Literal:172,QuotedTriple:173,UNDEF:174,GroupOrUnionGraphPattern_repetition0:175,ArgList:176,ArgList_option0:177,ArgList_repetition0:178,ExpressionList:179,ExpressionList_repetition0:180,ConstructTemplate_option0:181,ConstructTriples:182,ConstructTriples_repetition0:183,ConstructTriples_option0:184,VarOrTermOrQuotedTP:185,PropertyListNotEmpty:186,TriplesNode:187,PropertyList:188,PropertyList_option0:189,VerbObjectList:190,PropertyListNotEmpty_repetition0:191,SemiOptionalVerbObjectList:192,";":193,SemiOptionalVerbObjectList_option0:194,Verb:195,ObjectList:196,a:197,ObjectList_repetition0:198,Object:199,GraphNode:200,Object_option0:201,PropertyListPathNotEmpty:202,TriplesNodePath:203,TriplesSameSubjectPath_option0:204,O:205,PropertyListPathNotEmpty_repetition0:206,PropertyListPathNotEmptyTail:207,O_group0:208,ObjectListPath:209,ObjectListPath_repetition0:210,ObjectPath:211,GraphNodePath:212,ObjectPath_option0:213,Path:214,Path_repetition0:215,PathSequence:216,PathSequence_repetition0:217,PathEltOrInverse:218,PathElt:219,PathPrimary:220,PathElt_option0:221,PathEltOrInverse_option0:222,IriOrA:223,"!":224,PathNegatedPropertySet:225,PathOneInPropertySet:226,PathNegatedPropertySet_repetition0:227,PathNegatedPropertySet_option0:228,"^":229,TriplesNode_repetition_plus0:230,"[":231,"]":232,TriplesNodePath_repetition_plus0:233,VarOrTermOrQuotedTPExpr:234,VarOrTerm:235,GraphTerm:236,BlankNode:237,ConditionalOrExpression:238,ConditionalAndExpression:239,ConditionalOrExpression_repetition0:240,ConditionalOrExpressionTail:241,"||":242,RelationalExpression:243,ConditionalAndExpression_repetition0:244,ConditionalAndExpressionTail:245,"&&":246,NumericExpression:247,RelationalExpression_group0:248,RelationalExpression_option0:249,IN:250,MultiplicativeExpression:251,NumericExpression_repetition0:252,AdditiveExpressionTail:253,AdditiveExpressionTail_group0:254,NumericLiteralPositive:255,AdditiveExpressionTail_repetition0:256,NumericLiteralNegative:257,AdditiveExpressionTail_repetition1:258,UnaryExpression:259,MultiplicativeExpression_repetition0:260,MultiplicativeExpressionTail:261,MultiplicativeExpressionTail_group0:262,"+":263,PrimaryExpression:264,"-":265,ExprQuotedTP:266,Aggregate:267,FUNC_ARITY0:268,FUNC_ARITY1:269,FUNC_ARITY1_SPARQL_STAR:270,FUNC_ARITY2:271,",":272,FUNC_ARITY3:273,FUNC_ARITY3_SPARQL_STAR:274,BuiltInCall_group0:275,BOUND:276,BNODE:277,BuiltInCall_option0:278,EXISTS:279,COUNT:280,Aggregate_option0:281,Aggregate_group0:282,FUNC_AGGREGATE:283,Aggregate_option1:284,GROUP_CONCAT:285,Aggregate_option2:286,Aggregate_option3:287,GroupConcatSeparator:288,SEPARATOR:289,"=":290,String:291,LANGTAG:292,"^^":293,DECIMAL:294,DOUBLE:295,BOOLEAN:296,INTEGER_POSITIVE:297,DECIMAL_POSITIVE:298,DOUBLE_POSITIVE:299,INTEGER_NEGATIVE:300,DECIMAL_NEGATIVE:301,DOUBLE_NEGATIVE:302,STRING_LITERAL1:303,STRING_LITERAL2:304,STRING_LITERAL_LONG1:305,STRING_LITERAL_LONG2:306,PrefixedName:307,PNAME_LN:308,BLANK_NODE_LABEL:309,ANON:310,QuotedTP:311,"<<":312,qtSubjectOrObject:313,">>":314,DataValueTerm:315,AnnotationPattern:316,"{|":317,"|}":318,AnnotationPatternPath:319,ExprVarOrTerm:320,QueryOrUpdate_group0_option0:321,Prologue_repetition0_group0:322,Qry_group0_repetition_plus0:323,SelectClauseBase_option0_group0:324,DISTINCT:325,REDUCED:326,NAMED:327,SILENT:328,CLEAR:329,DROP:330,ADD:331,MOVE:332,COPY:333,ALL:334,".":335,UNION:336,"|":337,"/":338,PathElt_option0_group0:339,"?":340,"!=":341,"<":342,">":343,"<=":344,">=":345,NOT:346,CONCAT:347,COALESCE:348,SUBSTR:349,REGEX:350,REPLACE:351,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",12:"BASE",13:"IRIREF",15:"PREFIX",16:"PNAME_NS",24:"CONSTRUCT",28:"WHERE",29:"{",31:"}",32:"DESCRIBE",36:"ASK",39:"*",41:"SELECT",45:"(",47:"AS",48:")",53:"FROM",63:"GROUP",64:"BY",70:"HAVING",73:"ORDER",76:"ASC",78:"DESC",81:"LIMIT",82:"INTEGER",83:"OFFSET",85:"VALUES",87:"VAR",89:"NIL",100:"LOAD",109:"TO",110:"CREATE",112:"GRAPH",113:"INSERTDATA",115:"DELETEDATA",116:"DELETEWHERE",121:"INTO",123:"DELETE",126:"INSERT",128:"USING",131:"WITH",132:"DEFAULT",159:"OPTIONAL",160:"MINUS",161:"SERVICE",163:"FILTER",164:"BIND",174:"UNDEF",193:";",197:"a",224:"!",229:"^",231:"[",232:"]",242:"||",246:"&&",250:"IN",263:"+",265:"-",268:"FUNC_ARITY0",269:"FUNC_ARITY1",270:"FUNC_ARITY1_SPARQL_STAR",271:"FUNC_ARITY2",272:",",273:"FUNC_ARITY3",274:"FUNC_ARITY3_SPARQL_STAR",276:"BOUND",277:"BNODE",279:"EXISTS",280:"COUNT",283:"FUNC_AGGREGATE",285:"GROUP_CONCAT",289:"SEPARATOR",290:"=",292:"LANGTAG",293:"^^",294:"DECIMAL",295:"DOUBLE",296:"BOOLEAN",297:"INTEGER_POSITIVE",298:"DECIMAL_POSITIVE",299:"DOUBLE_POSITIVE",300:"INTEGER_NEGATIVE",301:"DECIMAL_NEGATIVE",302:"DOUBLE_NEGATIVE",303:"STRING_LITERAL1",304:"STRING_LITERAL2",305:"STRING_LITERAL_LONG1",306:"STRING_LITERAL_LONG2",308:"PNAME_LN",309:"BLANK_NODE_LABEL",310:"ANON",312:"<<",314:">>",317:"{|",318:"|}",325:"DISTINCT",326:"REDUCED",327:"NAMED",328:"SILENT",329:"CLEAR",330:"DROP",331:"ADD",332:"MOVE",333:"COPY",334:"ALL",335:".",336:"UNION",337:"|",338:"/",340:"?",341:"!=",342:"<",343:">",344:"<=",345:">=",346:"NOT",347:"CONCAT",348:"COALESCE",349:"SUBSTR",350:"REGEX",351:"REPLACE"},productions_:[0,[3,3],[7,2],[4,1],[11,2],[14,3],[8,4],[8,4],[8,5],[8,7],[8,5],[8,4],[17,2],[21,2],[38,2],[43,1],[43,5],[49,4],[49,4],[52,3],[19,2],[23,2],[20,3],[62,3],[66,1],[66,1],[66,3],[66,5],[66,1],[69,2],[72,3],[75,2],[75,2],[75,1],[75,1],[80,2],[80,2],[80,4],[80,4],[84,2],[86,4],[86,4],[86,6],[86,2],[94,3],[96,3],[98,4],[98,3],[98,5],[98,4],[98,2],[98,2],[98,2],[98,5],[120,2],[118,3],[118,1],[125,2],[127,3],[130,2],[108,1],[108,2],[122,2],[105,1],[105,1],[114,3],[135,2],[138,7],[143,3],[57,3],[57,3],[147,2],[150,3],[154,3],[151,1],[151,2],[151,2],[151,3],[151,4],[151,2],[151,6],[151,1],[93,1],[93,1],[165,4],[166,4],[166,6],[171,1],[171,1],[171,1],[171,1],[158,2],[79,1],[79,1],[79,1],[68,2],[176,1],[176,5],[179,1],[179,4],[25,3],[182,3],[145,2],[145,2],[188,1],[186,2],[192,2],[190,2],[195,1],[195,1],[196,2],[199,2],[156,2],[156,2],[202,2],[207,1],[207,2],[205,2],[209,2],[211,2],[214,2],[216,2],[219,2],[218,2],[220,1],[220,2],[220,3],[225,1],[225,1],[225,4],[226,1],[226,2],[187,3],[187,3],[203,3],[203,3],[200,1],[200,1],[212,1],[212,1],[234,1],[235,1],[235,1],[139,1],[139,1],[44,1],[236,1],[236,1],[236,1],[236,1],[46,1],[238,2],[241,2],[239,2],[245,2],[243,1],[243,3],[243,4],[247,2],[253,2],[253,2],[253,2],[251,2],[261,2],[259,2],[259,2],[259,2],[259,1],[264,1],[264,1],[264,1],[264,1],[264,1],[264,1],[264,1],[77,3],[67,1],[67,2],[67,4],[67,4],[67,6],[67,8],[67,8],[67,2],[67,4],[67,2],[67,4],[67,3],[267,5],[267,5],[267,6],[288,4],[172,1],[172,2],[172,3],[172,1],[172,1],[172,1],[172,1],[172,1],[172,1],[255,1],[255,1],[255,1],[257,1],[257,1],[257,1],[291,1],[291,1],[291,1],[291,1],[55,1],[55,1],[307,1],[307,1],[237,1],[237,1],[311,5],[173,5],[313,1],[313,1],[313,1],[313,1],[313,1],[315,1],[315,1],[315,1],[185,1],[185,1],[185,1],[316,3],[319,3],[266,5],[320,1],[320,1],[320,1],[223,1],[223,1],[321,0],[321,1],[5,1],[5,1],[5,1],[9,0],[9,1],[322,1],[322,1],[10,0],[10,2],[18,0],[18,2],[22,0],[22,2],[26,0],[26,2],[27,0],[27,2],[30,0],[30,1],[323,1],[323,2],[33,1],[33,1],[34,0],[34,2],[35,0],[35,1],[37,0],[37,2],[40,1],[40,2],[324,1],[324,1],[42,0],[42,1],[50,0],[50,1],[51,0],[51,1],[54,0],[54,1],[56,0],[56,1],[58,0],[58,1],[59,0],[59,1],[60,0],[60,1],[61,0],[61,1],[65,1],[65,2],[71,1],[71,2],[74,1],[74,2],[88,0],[88,2],[90,0],[90,2],[91,1],[91,2],[92,0],[92,2],[95,1],[95,2],[97,0],[97,4],[99,0],[99,2],[101,0],[101,1],[102,0],[102,1],[103,1],[103,1],[104,0],[104,1],[106,1],[106,1],[106,1],[107,0],[107,1],[111,0],[111,1],[117,0],[117,1],[119,0],[119,2],[124,0],[124,1],[129,0],[129,1],[133,0],[133,1],[134,1],[134,1],[134,1],[136,0],[136,1],[137,0],[137,2],[140,0],[140,1],[141,0],[141,1],[142,0],[142,1],[144,0],[144,3],[146,0],[146,1],[148,0],[148,1],[149,0],[149,2],[152,0],[152,1],[153,0],[153,1],[155,0],[155,3],[157,0],[157,1],[162,0],[162,1],[167,0],[167,2],[168,0],[168,2],[169,1],[169,2],[170,0],[170,2],[175,0],[175,3],[177,0],[177,1],[178,0],[178,3],[180,0],[180,3],[181,0],[181,1],[183,0],[183,3],[184,0],[184,1],[189,0],[189,1],[191,0],[191,2],[194,0],[194,1],[198,0],[198,3],[201,0],[201,1],[204,0],[204,1],[206,0],[206,2],[208,1],[208,1],[210,0],[210,3],[213,0],[213,1],[215,0],[215,3],[217,0],[217,3],[339,1],[339,1],[339,1],[221,0],[221,1],[222,0],[222,1],[227,0],[227,3],[228,0],[228,1],[230,1],[230,2],[233,1],[233,2],[240,0],[240,2],[244,0],[244,2],[248,1],[248,1],[248,1],[248,1],[248,1],[248,1],[249,0],[249,1],[252,0],[252,2],[254,1],[254,1],[256,0],[256,2],[258,0],[258,2],[260,0],[260,2],[262,1],[262,1],[275,1],[275,1],[275,1],[275,1],[275,1],[278,0],[278,1],[281,0],[281,1],[282,1],[282,1],[284,0],[284,1],[286,0],[286,1],[287,0],[287,1]],performAction:function(e,t,r,n,i,a,o){var s,u,c,l,d=a.length-1;switch(i){case 1:if(a[d-1]=a[d-1]||{},nn.base&&(a[d-1].base=nn.base),nn.base="",a[d-1].prefixes=nn.prefixes,nn.prefixes=null,nn.pathOnly){if("path"===a[d-1].type||"termType"in a[d-1])return a[d-1];throw new Error("Received full SPARQL query in path only mode")}if("path"===a[d-1].type||"termType"in a[d-1])throw new Error("Received only path in full SPARQL mode");if("update"===a[d-1].type){const e={};for(const t of a[d-1].updates)if("insert"===t.updateType){const r={};for(const e of t.insert)if("bgp"===e.type||"graph"===e.type)for(const t of e.triples)"BlankNode"===t.subject.termType&&(r[t.subject.value]=!0),"BlankNode"===t.predicate.termType&&(r[t.predicate.value]=!0),"BlankNode"===t.object.termType&&(r[t.object.value]=!0);for(const t of Object.keys(r)){if(e[t])throw new Error("Detected reuse blank node across different INSERT DATA clauses");e[t]=!0}}}return a[d-1];case 2:this.$={...a[d-1],...a[d],type:"query"};break;case 4:nn.base=Er(a[d]);break;case 5:nn.prefixes||(nn.prefixes={}),a[d-1]=a[d-1].substr(0,a[d-1].length-1),a[d]=Er(a[d]),nn.prefixes[a[d-1]]=a[d];break;case 6:this.$={...a[d-3],...jr(a[d-2]),...a[d-1],...a[d]};break;case 7:if(!nn.skipValidation&&(Xr(a[d-3].variables.map((e=>zr(e.expression)))).some((e=>"count"===e.aggregation&&!(e.expression instanceof or)))||a[d].group))for(const e of a[d-3].variables)if("Variable"===e.termType){if(!a[d].group||!a[d].group.map((e=>Gr(e))).includes(Gr(e)))throw Error("Projection of ungrouped variable (?"+Gr(e)+")")}else if(0===zr(e.expression).length){const t=Hr(e.expression);for(const e of t)if(!a[d].group||!a[d].group.map||!a[d].group.map((e=>Gr(e))).includes(Gr(e)))throw Error("Use of ungrouped variable in projection of operation (?"+Gr(e)+")")}const e=a[d-1].where.filter((e=>"query"===e.type));if(e.length>0){const t=a[d-3].variables.filter((e=>e.variable&&e.variable.value)).map((e=>e.variable.value)),r=Xr(e.map((e=>e.variables))).map((e=>e.value||e.variable.value));for(const e of t)if(r.indexOf(e)>=0)throw Error("Target id of 'AS' (?"+e+") already used in subquery")}this.$=Sr(a[d-3],jr(a[d-2]),a[d-1],a[d]);break;case 8:this.$=Sr({queryType:"CONSTRUCT",template:a[d-3]},jr(a[d-2]),a[d-1],a[d]);break;case 9:this.$=Sr({queryType:"CONSTRUCT",template:a[d-2]=a[d-2]?a[d-2].triples:[]},jr(a[d-5]),{where:[{type:"bgp",triples:Tr([],a[d-2])}]},a[d]);break;case 10:this.$=Sr({queryType:"DESCRIBE",variables:"*"===a[d-3]?[new or]:a[d-3]},jr(a[d-2]),a[d-1],a[d]);break;case 11:this.$=Sr({queryType:"ASK"},jr(a[d-2]),a[d-1],a[d]);break;case 12:this.$=Sr(a[d-1],{variables:[new or]});break;case 13:const t=function(e){const t=e.slice().sort(),r=[];for(let e=0;ee.value||e.variable.value)));if(t.length>0)throw Error("Two or more of the resulting columns have the same name (?"+t[0]+")");this.$=Sr(a[d-1],{variables:a[d]});break;case 14:this.$=Sr({queryType:"SELECT"},a[d]&&(a[d-1]=_r(a[d]),a[d]={},a[d][a[d-1]]=!0,a[d]));break;case 16:case 27:this.$=Rr(a[d-3],{variable:a[d-1]});break;case 17:case 18:this.$=Sr(a[d-3],a[d-2],a[d-1],a[d],{type:"query"});break;case 19:case 58:this.$={iri:a[d],named:!!a[d-1]};break;case 20:this.$={where:a[d].patterns};break;case 21:this.$=Sr(a[d-1],a[d]);break;case 22:this.$=Sr(a[d-2],a[d-1],a[d]);break;case 23:this.$={group:a[d]};break;case 24:case 25:case 28:case 31:case 33:case 34:this.$=Rr(a[d]);break;case 26:this.$=Rr(a[d-1]);break;case 29:this.$={having:a[d]};break;case 30:this.$={order:a[d]};break;case 32:this.$=Rr(a[d],{descending:!0});break;case 35:this.$={limit:Dr(a[d])};break;case 36:this.$={offset:Dr(a[d])};break;case 37:this.$={limit:Dr(a[d-2]),offset:Dr(a[d])};break;case 38:this.$={limit:Dr(a[d]),offset:Dr(a[d-2])};break;case 39:case 43:this.$={type:"values",values:a[d]};break;case 40:case 84:this.$=a[d-1].map((e=>({[a[d-3]]:e})));break;case 41:case 85:this.$=a[d-1].map((()=>({})));break;case 42:case 86:var h=a[d-4].length;a[d-4]=a[d-4].map(xr),this.$=a[d-1].map((function(e){if(e.length!==h)throw Error("Inconsistent VALUES length");for(var t={},r=0;r"bind"===e.type))){const t=a[d-1].indexOf(e),r=new Set;for(const e of a[d-1].slice(0,t))"group"!==e.type&&"bgp"!==e.type||Kr(e).forEach((e=>r.add(e)));if(r.has(e.variable.value))throw Error("Variable used to bind is already bound (?"+e.variable.value+")")}this.$={type:"group",patterns:a[d-1]};break;case 71:this.$=a[d-1]?Or([a[d-1]],a[d]):Or(a[d]);break;case 72:this.$=a[d]?[a[d-2],a[d]]:a[d-2];break;case 75:this.$=Sr(a[d],{type:"optional"});break;case 76:this.$=Sr(a[d],{type:"minus"});break;case 77:this.$=Sr(a[d],{type:"graph",name:a[d-1]});break;case 78:this.$=Sr(a[d],{type:"service",name:a[d-1],silent:!!a[d-2]});break;case 79:this.$={type:"filter",expression:a[d]};break;case 80:this.$={type:"bind",variable:a[d-1],expression:a[d-3]};break;case 89:this.$=Wr(a[d]);break;case 90:this.$=void 0;break;case 91:this.$=a[d-1].length?{type:"union",patterns:Or(a[d-1].map(Pr),[Pr(a[d])])}:a[d];break;case 95:this.$={...a[d],function:a[d-1]};break;case 96:this.$={type:"functionCall",args:[]};break;case 97:this.$={type:"functionCall",args:wr(a[d-2],a[d-1]),distinct:!!a[d-3]};break;case 98:case 115:case 128:case 247:case 249:case 251:case 253:case 255:case 263:case 267:case 297:case 299:case 303:case 307:case 328:case 341:case 349:case 355:case 361:case 367:case 369:case 373:case 375:case 379:case 381:case 385:case 391:case 395:case 401:case 405:case 409:case 411:case 420:case 428:case 430:case 440:case 444:case 446:case 448:this.$=[];break;case 99:this.$=wr(a[d-2],a[d-1]);break;case 101:this.$=Or(a[d-2],[a[d-1]]);break;case 102:case 112:this.$=Zr(a[d].map((e=>Sr(kr(a[d-1]),e))));break;case 103:this.$=Zr(Tr(a[d].map((e=>Sr(kr(a[d-1].entity),e))),a[d-1].triples));break;case 105:this.$=Or([a[d-1]],a[d]);break;case 106:this.$=Or(a[d]);break;case 107:this.$=Qr(a[d-1],a[d]);break;case 109:case 237:this.$=nn.factory.namedNode(ur);break;case 110:case 118:this.$=wr(a[d-1],a[d]);break;case 111:this.$=a[d]?{annotation:a[d],object:a[d-1]}:a[d-1];break;case 113:this.$=a[d]?Zr(Tr(a[d].map((e=>Sr(kr(a[d-1].entity),e))),a[d-1].triples)):a[d-1].triples;break;case 114:this.$=Qr(...a[d-1],a[d]);break;case 116:this.$=Qr(...a[d]);break;case 117:case 159:case 163:this.$=[a[d-1],a[d]];break;case 119:this.$=a[d]?{object:a[d-1],annotation:a[d]}:a[d-1];break;case 120:this.$=a[d-1].length?Ir("|",wr(a[d-1],a[d])):a[d];break;case 121:this.$=a[d-1].length?Ir("/",wr(a[d-1],a[d])):a[d];break;case 122:this.$=a[d]?Ir(a[d],[a[d-1]]):a[d-1];break;case 123:this.$=a[d-1]?Ir(a[d-1],[a[d]]):a[d];break;case 125:case 131:this.$=Ir(a[d-1],[a[d]]);break;case 129:this.$=Ir("|",wr(a[d-2],a[d-1]));break;case 132:case 134:this.$=function(e){var t=Mr(),r=t,n=[],i=[];e.forEach((function(e){n.push(e.entity),Tr(i,e.triples)}));for(var a=0,o=0,s=n.length,u=Array(2*s);a2&&E.push("'"+this.terminals_[T]+"'");A=d.showPosition?"Parse error on line "+(s+1)+":\n"+d.showPosition()+"\nExpecting "+E.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(s+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(A,{text:d.match,token:this.terminals_[m]||m,line:d.yylineno,loc:f,expected:E})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+v+", token: "+m);switch(_[0]){case 1:r.push(m),n.push(d.yytext),i.push(d.yylloc),r.push(_[1]),m=null,b?(m=b,b=null):(u=d.yyleng,o=d.yytext,s=d.yylineno,f=d.yylloc,c>0&&c--);break;case 2:if(S=this.productions_[_[1]][1],x.$=n[n.length-S],x._$={first_line:i[i.length-(S||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(S||1)].first_column,last_column:i[i.length-1].last_column},g&&(x._$.range=[i[i.length-(S||1)].range[0],i[i.length-1].range[1]]),void 0!==(w=this.performAction.apply(x,[o,u,s,h.yy,_[1],n,i].concat(l))))return w;S&&(r=r.slice(0,-1*S*2),n=n.slice(0,-1*S),i=i.slice(0,-1*S)),r.push(this.productions_[_[1]][0]),n.push(x.$),i.push(x._$),O=a[r[r.length-2]][r[r.length-1]],r.push(O);break;case 3:return!0}}return!0}},or=r(23637).t,sr="http://www.w3.org/1999/02/22-rdf-syntax-ns#",ur=sr+"type",cr=sr+"first",lr=sr+"rest",dr=sr+"nil",hr="http://www.w3.org/2001/XMLSchema#",pr=hr+"integer",fr=hr+"decimal",yr=hr+"double",gr=hr+"boolean",mr="",br="",vr="";function _r(e){return e.toLowerCase()}function wr(e,t){return e.push(t),e}function Tr(e,t){return e.push.apply(e,t),e}function Sr(e){e||(e={});for(var t,r=1,n=arguments.length;r>10),56320+(1023&i))}var a=Ur[n];if(!a)throw new Error;return a}))}catch(e){return""}if(Vr.exec(e))throw new Error("Invalid unicode codepoint of surrogate pair without corresponding codepoint in "+e);return e}function Qr(e,t,r){var n=[],i=[];return t.forEach((function(t){let r=null;t.annotation&&(r=t.annotation,t=t.object),n.push(kr(null,e,t.entity,r)),Tr(i,t.triples)})),Or(n,r||[],i)}function Gr(e){return e.variable?e.variable.value:e.value||e.expression.value}function zr(e){if(!e)return[];if("aggregate"===e.type)return[e];if("operation"===e.type){const t=[];for(const r of e.args)t.push(...zr(r));return t}return[]}function Hr(e){const t=new Set,r=function(e){e&&("Variable"===e.termType?t.add(e):"operation"===e.type&&e.args.forEach(r))};return r(e),t}function Xr(e,t=1,r=[]){for(const n of e)t>0&&n instanceof Array?Xr(n,t-1,r):r.push(n);return r}function Jr(e){return"Variable"===e.termType}function Kr(e){if(e.triples){const t=[];for(const r of e.triples)Jr(r.subject)&&t.push(r.subject.value),Jr(r.predicate)&&t.push(r.predicate.value),Jr(r.object)&&t.push(r.object.value);return t}if(e.patterns){const t=[];for(const r of e.patterns)t.push(...Kr(r));return t}return[]}function Wr(e){if(!nn.sparqlStar)throw new Error("SPARQL-star support is not enabled");return e}function Yr(e,t,r){for(const n of t){const t=kr("subject"in n?n.subject:e,n.predicate,n.object);r.push(t),n.annotations&&Yr(Lr(e,n.predicate,n.object),n.annotations,r)}}function Zr(e){if(nn.sparqlStar){const t=[];return e.forEach((e=>{const r=kr(e.subject,e.predicate,e.object);t.push(r),e.annotations&&Yr(Lr(e.subject,e.predicate,e.object),e.annotations,t)})),t}return e}function en(e){for(const t of e){if("graph"===t.type&&"Variable"===t.name.termType)throw new Error("Detected illegal variable in GRAPH");if("bgp"===t.type||"graph"===t.type)for(const e of t.triples)if("Variable"===e.subject.termType||"Variable"===e.predicate.termType||"Variable"===e.object.termType)throw new Error("Detected illegal variable in BGP")}return e}function tn(e){for(const t of e)if("bgp"===t.type)for(const e of t.triples)if("BlankNode"===e.subject.termType||"BlankNode"===e.predicate.termType||"BlankNode"===e.object.termType)throw new Error("Detected illegal blank node in BGP");return e}var rn={EOF:1,parseError:function(e,t){if(!this.yy.parser)throw new Error(e);this.yy.parser.parseError(e,t)},setInput:function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,r=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var n=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),r.length-1&&(this.yylineno-=r.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===n.length?this.yylloc.first_column:0)+n[n.length-r.length].length-r[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},test_match:function(e,t){var r,n,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(n=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=n.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],r=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),r)return r;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var e,t,r,n;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;at[0].length)){if(t=r,n=a,this.options.backtrack_lexer){if(!1!==(e=this.test_match(r,i[a])))return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?!1!==(e=this.test_match(t,i[n]))&&e:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(e){return(e=this.conditionStack.length-1-Math.abs(e||0))>=0?this.conditionStack[e]:"INITIAL"},pushState:function(e){this.begin(e)},stateStackSize:function(){return this.conditionStack.length},options:{flex:!0,"case-insensitive":!0},performAction:function(e,t,r,n){switch(r){case 0:break;case 1:return 12;case 2:return 15;case 3:return 41;case 4:return 325;case 5:return 326;case 6:return 45;case 7:return 47;case 8:return 48;case 9:return 39;case 10:return 24;case 11:return 28;case 12:return 29;case 13:return 31;case 14:return 32;case 15:return 36;case 16:return 53;case 17:return 327;case 18:return 63;case 19:return 64;case 20:return 70;case 21:return 73;case 22:return 76;case 23:return 78;case 24:return 81;case 25:return 83;case 26:return 85;case 27:return 193;case 28:return 100;case 29:return 328;case 30:return 121;case 31:return 329;case 32:return 330;case 33:return 110;case 34:return 331;case 35:return 109;case 36:return 332;case 37:return 333;case 38:return 113;case 39:return 115;case 40:return 116;case 41:return 131;case 42:return 123;case 43:return 126;case 44:return 128;case 45:return 132;case 46:return 112;case 47:return 334;case 48:return 335;case 49:return 159;case 50:return 161;case 51:return 164;case 52:return 174;case 53:return 160;case 54:return 336;case 55:return 163;case 56:return 312;case 57:return 314;case 58:return 317;case 59:return 318;case 60:return 272;case 61:return 197;case 62:return 337;case 63:return 338;case 64:return 229;case 65:return 340;case 66:return 263;case 67:return 224;case 68:return 231;case 69:return 232;case 70:return 242;case 71:return 246;case 72:return 290;case 73:return 341;case 74:return 342;case 75:return 343;case 76:return 344;case 77:return 345;case 78:return 250;case 79:return 346;case 80:return 265;case 81:return 276;case 82:return 277;case 83:return 268;case 84:return 269;case 85:return 270;case 86:return 271;case 87:return 347;case 88:return 348;case 89:return 273;case 90:return 274;case 91:return 350;case 92:return 349;case 93:return 351;case 94:return 279;case 95:return 280;case 96:return 283;case 97:return 285;case 98:return 289;case 99:return 293;case 100:return 296;case 101:return 13;case 102:return 16;case 103:return 308;case 104:return 309;case 105:return 87;case 106:return 292;case 107:return 82;case 108:return 294;case 109:return 295;case 110:return 297;case 111:return 298;case 112:return 299;case 113:return 300;case 114:return 301;case 115:return 302;case 116:return"EXPONENT";case 117:return 303;case 118:return 304;case 119:return 305;case 120:return 306;case 121:return 89;case 122:return 310;case 123:return 6;case 124:return"INVALID";case 125:console.log(t.yytext)}},rules:[/^(?:\s+|(#[^\n\r]*))/i,/^(?:BASE)/i,/^(?:PREFIX)/i,/^(?:SELECT)/i,/^(?:DISTINCT)/i,/^(?:REDUCED)/i,/^(?:\()/i,/^(?:AS)/i,/^(?:\))/i,/^(?:\*)/i,/^(?:CONSTRUCT)/i,/^(?:WHERE)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:DESCRIBE)/i,/^(?:ASK)/i,/^(?:FROM)/i,/^(?:NAMED)/i,/^(?:GROUP)/i,/^(?:BY)/i,/^(?:HAVING)/i,/^(?:ORDER)/i,/^(?:ASC)/i,/^(?:DESC)/i,/^(?:LIMIT)/i,/^(?:OFFSET)/i,/^(?:VALUES)/i,/^(?:;)/i,/^(?:LOAD)/i,/^(?:SILENT)/i,/^(?:INTO)/i,/^(?:CLEAR)/i,/^(?:DROP)/i,/^(?:CREATE)/i,/^(?:ADD)/i,/^(?:TO)/i,/^(?:MOVE)/i,/^(?:COPY)/i,/^(?:INSERT((\s+|(#[^\n\r]*)\n\r?)+)DATA)/i,/^(?:DELETE((\s+|(#[^\n\r]*)\n\r?)+)DATA)/i,/^(?:DELETE((\s+|(#[^\n\r]*)\n\r?)+)WHERE)/i,/^(?:WITH)/i,/^(?:DELETE)/i,/^(?:INSERT)/i,/^(?:USING)/i,/^(?:DEFAULT)/i,/^(?:GRAPH)/i,/^(?:ALL)/i,/^(?:\.)/i,/^(?:OPTIONAL)/i,/^(?:SERVICE)/i,/^(?:BIND)/i,/^(?:UNDEF)/i,/^(?:MINUS)/i,/^(?:UNION)/i,/^(?:FILTER)/i,/^(?:<<)/i,/^(?:>>)/i,/^(?:\{\|)/i,/^(?:\|\})/i,/^(?:,)/i,/^(?:a)/i,/^(?:\|)/i,/^(?:\/)/i,/^(?:\^)/i,/^(?:\?)/i,/^(?:\+)/i,/^(?:!)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:\|\|)/i,/^(?:&&)/i,/^(?:=)/i,/^(?:!=)/i,/^(?:<)/i,/^(?:>)/i,/^(?:<=)/i,/^(?:>=)/i,/^(?:IN)/i,/^(?:NOT)/i,/^(?:-)/i,/^(?:BOUND)/i,/^(?:BNODE)/i,/^(?:(RAND|NOW|UUID|STRUUID))/i,/^(?:(LANG|DATATYPE|IRI|URI|ABS|CEIL|FLOOR|ROUND|STRLEN|STR|UCASE|LCASE|ENCODE_FOR_URI|YEAR|MONTH|DAY|HOURS|MINUTES|SECONDS|TIMEZONE|TZ|MD5|SHA1|SHA256|SHA384|SHA512|isIRI|isURI|isBLANK|isLITERAL|isNUMERIC))/i,/^(?:(SUBJECT|PREDICATE|OBJECT|isTRIPLE))/i,/^(?:(LANGMATCHES|CONTAINS|STRSTARTS|STRENDS|STRBEFORE|STRAFTER|STRLANG|STRDT|sameTerm))/i,/^(?:CONCAT)/i,/^(?:COALESCE)/i,/^(?:IF)/i,/^(?:TRIPLE)/i,/^(?:REGEX)/i,/^(?:SUBSTR)/i,/^(?:REPLACE)/i,/^(?:EXISTS)/i,/^(?:COUNT)/i,/^(?:SUM|MIN|MAX|AVG|SAMPLE)/i,/^(?:GROUP_CONCAT)/i,/^(?:SEPARATOR)/i,/^(?:\^\^)/i,/^(?:true|false)/i,/^(?:(<(?:[^<>\"\{\}\|\^`\\\u0000-\u0020])*>))/i,/^(?:((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:))/i,/^(?:(((([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?)?:)((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|:|[0-9]|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))*(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|:|((%([0-9A-Fa-f])([0-9A-Fa-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%)))))?)))/i,/^(?:(_:(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:(?:(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])|\.)*(((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|-|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040]))?))/i,/^(?:([\?\$]((?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9])(?:((?:([A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])|_))|[0-9]|\u00B7|[\u0300-\u036F\u203F-\u2040])*)))/i,/^(?:(@[a-zA-Z]+(?:-[a-zA-Z0-9]+)*))/i,/^(?:([0-9]+))/i,/^(?:([0-9]*\.[0-9]+))/i,/^(?:([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+)))/i,/^(?:(\+([0-9]+)))/i,/^(?:(\+([0-9]*\.[0-9]+)))/i,/^(?:(\+([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:(-([0-9]+)))/i,/^(?:(-([0-9]*\.[0-9]+)))/i,/^(?:(-([0-9]+\.[0-9]*([eE][+-]?[0-9]+)|\.([0-9])+([eE][+-]?[0-9]+)|([0-9])+([eE][+-]?[0-9]+))))/i,/^(?:([eE][+-]?[0-9]+))/i,/^(?:('(?:(?:[^\u0027\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*'))/i,/^(?:("(?:(?:[^\u0022\u005C\u000A\u000D])|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])))*"))/i,/^(?:('''(?:(?:'|'')?(?:[^'\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*'''))/i,/^(?:("""(?:(?:"|"")?(?:[^\"\\]|(\\[tbnrf\\\"']|\\u([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])|\\U([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f])([0-9A-Fa-f]))))*"""))/i,/^(?:(\((\u0020|\u0009|\u000D|\u000A)*\)))/i,/^(?:(\[(\u0020|\u0009|\u000D|\u000A)*\]))/i,/^(?:$)/i,/^(?:.)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125],inclusive:!0}}};function nn(){this.yy={}}return ar.lexer=rn,nn.prototype=ar,ar.Parser=nn,new nn}();e.exports=n},23637:e=>{class t{constructor(){return r||this}equals(e){return e&&this.termType===e.termType}}Object.defineProperty(t.prototype,"value",{enumerable:!0,value:"*"}),Object.defineProperty(t.prototype,"termType",{enumerable:!0,value:"Wildcard"});var r=new t;e.exports.t=t},98082:(e,t,r)=>{var n=r(83849).Parser,i=r(23825),a=r(23637).t,{DataFactory:o}=r(47793);e.exports={Parser:function({prefixes:e,baseIRI:t,factory:r,sparqlStar:i,skipValidation:a,skipUngroupedVariableCheck:s,pathOnly:u}={}){var c={};for(var l in e||{})c[l]=e[l];var d=new n;return d.parse=function(){return n.base=t||"",n.prefixes=Object.create(c),n.factory=r||new o,n.sparqlStar=Boolean(i),n.pathOnly=Boolean(u),n.skipValidation=Boolean(a)||Boolean(s),n.prototype.parse.apply(d,arguments)},d._resetBlanks=n._resetBlanks,d},Generator:i,Wildcard:a}},916:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(71142),t)},71142:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SparqlJsonParser=void 0;const n=r(47793),i=r(19198),a=r(50608);t.SparqlJsonParser=class{constructor(e){var t;e=e||{},this.dataFactory=e.dataFactory||new n.DataFactory,this.prefixVariableQuestionMark=!!e.prefixVariableQuestionMark,this.suppressMissingStreamResultsError=null===(t=e.suppressMissingStreamResultsError)||void 0===t||t}parseJsonResults(e){return e.results.bindings.map((e=>this.parseJsonBindings(e)))}parseJsonResultsStream(e){const t=e=>s.emit("error",e);e.on("error",t);const r=new a;r.onError=t;let n=!1,o=!1;r.onValue=e=>{if("vars"===r.key&&2===r.stack.length&&"head"===r.stack[1].key)s.emit("variables",e.map((e=>this.dataFactory.variable(e)))),n=!0;else if("results"===r.key&&1===r.stack.length)o=!0;else if("number"==typeof r.key&&3===r.stack.length&&"results"===r.stack[1].key&&"bindings"===r.stack[2].key)try{s.push(this.parseJsonBindings(e))}catch(e){s.emit("error",e)}else"metadata"===r.key&&1===r.stack.length&&s.emit("metadata",e)};const s=e.on("end",(e=>{o||this.suppressMissingStreamResultsError?n||s.emit("variables",[]):s.emit("error",new Error("No valid SPARQL query results were found."))})).pipe(new i.Transform({objectMode:!0,transform(e,t,n){r.write(e),n()}}));return s}parseJsonBindings(e){const t={};for(const r in e){const n=e[r];t[this.prefixVariableQuestionMark?"?"+r:r]=this.parseJsonValue(n)}return t}parseJsonValue(e){let t;switch(e.type){case"bnode":t=this.dataFactory.blankNode(e.value);break;case"literal":t=e["xml:lang"]?this.dataFactory.literal(e.value,e["xml:lang"]):e.datatype?this.dataFactory.literal(e.value,this.dataFactory.namedNode(e.datatype)):this.dataFactory.literal(e.value);break;case"typed-literal":t=this.dataFactory.literal(e.value,this.dataFactory.namedNode(e.datatype));break;case"triple":const r=e.value;if(!(r&&r.subject&&r.predicate&&r.object))throw new Error("Invalid quoted triple: "+JSON.stringify(e));t=this.dataFactory.quad(this.parseJsonValue(r.subject),this.parseJsonValue(r.predicate),this.parseJsonValue(r.object));break;default:t=this.dataFactory.namedNode(e.value)}return t}parseJsonBoolean(e){if("boolean"in e)return e.boolean;throw new Error("No valid ASK response was found.")}parseJsonBooleanStream(e){return new Promise(((t,r)=>{const n=new a;n.onError=r,n.onValue=e=>{"boolean"===n.key&&"boolean"==typeof e&&1===n.stack.length&&t(e)},e.on("error",r).on("data",(e=>n.write(e))).on("end",(()=>r(new Error("No valid ASK response was found."))))}))}}},12763:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(52875),t)},52875:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Converter=void 0;const n=r(99349),i=r(916);class a{constructor(e){(e=e||{delimiter:"_"}).prefixVariableQuestionMark=!1,this.delimiter=e.delimiter||"_",this.parser=new i.SparqlJsonParser(e),this.materializeRdfJsTerms=e.materializeRdfJsTerms}static addValueToTree(e,t,r,n,i,o){const s=t[0],u=n?n+o+s:s,c=i.singularizeVariables[u];if(1===t.length)c?e[s]||(e[s]=r):(e[s]||(e[s]=[]),e[s].push(r));else{let n;c?(e[s]||(e[s]={}),n=e[s]):(e[s]||(e[s]=[{}]),n=e[s][0]),a.addValueToTree(n,t.slice(1),r,u,i,o)}}static mergeTrees(e,t){if(typeof e!=typeof t)throw new Error(`Two incompatible tree nodes were found: ${typeof e} and ${typeof t}`);if(Array.isArray(e)!==Array.isArray(t))throw new Error(`Two incompatible tree nodes were found: Array?${Array.isArray(e)} and Array?${Array.isArray(t)}`);if("object"==typeof e&&"object"==typeof t){if(e.termType&&t.termType)return e.equals(t)?{valid:!0,result:e}:{valid:!1,result:e};if(Array.isArray(e)&&Array.isArray(t)){if(e.length>0){const r=[];let n=!1;for(const i of e){const e=a.mergeTrees(i,t[0]);e.valid?(n=!0,r.push(e.result)):r.push(i)}if(n)return{valid:!0,result:r}}return{valid:!0,result:e.concat(t)}}{const r={};for(const e in t)r[e]=t[e];for(const t in e)if(r[t]){const n=a.mergeTrees(e[t],r[t]);if(!n.valid)return{valid:!1,result:e};r[t]=n.result}else r[t]=e[t];return{valid:!0,result:r}}}throw new Error(`Unmergable tree types: ${typeof e} and ${typeof t}`)}static materializeTree(e){if(e.termType)return(0,n.getTermRaw)(e);if(Array.isArray(e))return e.map(a.materializeTree);{const t={};for(const r in e)t[r]=a.materializeTree(e[r]);return t}}sparqlJsonResultsToTree(e,t){return this.bindingsToTree(this.parser.parseJsonResults(e),t||{singularizeVariables:{}})}bindingsToTree(e,t){const r=t&&t.singularizeVariables[""];let n=r?{}:[];for(const i of e){const e=r?{}:[{}];for(const n in i){const o=n.split(this.delimiter),s=i[n];a.addValueToTree(r?e:e[0],o,s,"",t,this.delimiter)}n=a.mergeTrees(n,e).result}return this.materializeRdfJsTerms&&(n=a.materializeTree(n)),n}}t.Converter=a},75295:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(48642),t)},48642:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SparqlXmlParser=void 0;const n=r(47793),i=r(55201),a=r(19198);t.SparqlXmlParser=class{constructor(e){e=e||{},this.dataFactory=e.dataFactory||new n.DataFactory,this.prefixVariableQuestionMark=!!e.prefixVariableQuestionMark}parseXmlResultsStream(e){const t=e=>y.emit("error",e);e.on("error",t);const r=new i.SaxesParser,n=[];let o=!1,s=!1;const u=[];let c,l={},d="",h="",p="",f=[];r.on("error",t),r.on("opentag",(e=>{"variable"===e.name&&this.stackEquals(n,["sparql","head"])?u.push(this.dataFactory.variable(e.attributes.name)):"results"===e.name&&this.stackEquals(n,["sparql"])?s=!0:"result"===e.name&&this.stackEquals(n,["sparql","results"])?l={}:"binding"===e.name&&this.stackEquals(n,["sparql","results","result"])?(d=e.attributes.name||"",h="",c="",p="",f=[]):"triple"===e.name&&this.stackBeginsWith(n,["sparql","results","result"])?f.push({components:{}}):"triple"===n[n.length-1]&&this.stackBeginsWith(n,["sparql","results","result","binding"])?(h="",c="",p="",["subject","predicate","object"].includes(e.name)?f[f.length-1].currentComponent=e.name:t(new Error(`Illegal quoted triple component '${e.name}' found on line ${r.line+1}`))):this.stackBeginsWith(n,["sparql","results","result","binding"])&&(h=e.name,c="xml:lang"in e.attributes?e.attributes["xml:lang"]:"datatype"in e.attributes?this.dataFactory.namedNode(e.attributes.datatype):void 0),n.push(e.name)})),r.on("closetag",(e=>{if(this.stackEquals(n,["sparql","head"])&&(y.emit("variables",u),o=!0),this.stackEquals(n,["sparql","results","result"])&&y.push(l),this.stackBeginsWith(n,["sparql","results","result","binding"])){let e;if(!d&&h)t(new Error(`Terms should have a name on line ${r.line+1}`));else if("uri"===h)e=this.dataFactory.namedNode(p);else if("bnode"===h)e=this.dataFactory.blankNode(p);else if("literal"===h)e=this.dataFactory.literal(p,c);else if("triple"===n[n.length-1]){const n=f.pop();n&&n.components.subject&&n.components.predicate&&n.components.object?e=this.dataFactory.quad(n.components.subject,n.components.predicate,n.components.object):t(new Error(`Incomplete quoted triple on line ${r.line+1}`))}else h&&t(new Error(`Invalid term type '${h}' on line ${r.line+1}`));if(e)if(f.length>0){const n=f[f.length-1];n.components[n.currentComponent]&&t(new Error(`The ${n.currentComponent} in a quoted triple on line ${r.line+1} was already defined before`)),n.components[n.currentComponent]=e}else{const t=this.prefixVariableQuestionMark?"?"+d:d;l[t]=e}h=void 0}n.pop()})),r.on("text",(e=>{this.stackBeginsWith(n,["sparql","results","result","binding"])&&n[n.length-1]===h&&(p=e)}));const y=e.on("end",(e=>{s?o||y.emit("variables",[]):y.emit("error",new Error("No valid SPARQL query results were found."))})).pipe(new a.Transform({objectMode:!0,transform(e,t,n){r.write(e),n()}}));return y}parseXmlBooleanStream(e){return new Promise(((t,r)=>{const n=new i.SaxesParser,a=[];n.on("error",r),n.on("opentag",(e=>{a.push(e.name)})),n.on("closetag",(e=>{a.pop()})),n.on("text",(e=>{this.stackEquals(a,["sparql","boolean"])&&t("true"===e)})),e.on("error",r).on("data",(e=>n.write(e))).on("end",(()=>r(new Error("No valid ASK response was found."))))}))}stackEquals(e,t){return e.length===t.length&&e.every(((e,r)=>t[r]===e))}stackBeginsWith(e,t){return e.length>=t.length&&t.every(((t,r)=>e[r]===t))}}},43789:(e,t,r)=>{var n=r(13559);e.exports=function(e,t,r){"function"==typeof t&&(r=t,t=null);var i="",a=new n((function(r,n){e.on("data",(function(e){i+="string"==typeof t?e.toString(t):e.toString()})),e.on("end",(function(){r(i)})),e.on("error",n)}));return r&&a.then((function(e){r(null,e)}),r),a}},83141:(e,t,r)=>{"use strict";var n=r(92861).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function a(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=l,this.end=d,t=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}t.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0?(i>0&&(e.lastNeed=i-1),i):--n=0?(i>0&&(e.lastNeed=i-2),i):--n=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},22831:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"NIL",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"parse",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(t,"v1",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(t,"v3",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"v4",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(t,"v5",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"validate",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(t,"version",{enumerable:!0,get:function(){return u.default}});var n=h(r(13518)),i=h(r(14948)),a=h(r(45073)),o=h(r(77186)),s=h(r(14808)),u=h(r(7775)),c=h(r(37037)),l=h(r(49910)),d=h(r(96792));function h(e){return e&&e.__esModule?e:{default:e}}},22311:(e,t)=>{"use strict";function r(e){return 14+(e+64>>>9<<4)+1}function n(e,t){const r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function i(e,t,r,i,a,o){return n((s=n(n(t,e),n(i,o)))<<(u=a)|s>>>32-u,r);var s,u}function a(e,t,r,n,a,o,s){return i(t&r|~t&n,e,t,a,o,s)}function o(e,t,r,n,a,o,s){return i(t&n|r&~n,e,t,a,o,s)}function s(e,t,r,n,a,o,s){return i(t^r^n,e,t,a,o,s)}function u(e,t,r,n,a,o,s){return i(r^(t|~n),e,t,a,o,s)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=function(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let r=0;r>5]>>>i%32&255,a=parseInt(n.charAt(r>>>4&15)+n.charAt(15&r),16);t.push(a)}return t}(function(e,t){e[t>>5]|=128<>5]|=(255&e[r/8])<{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};t.default=r},14808:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default="00000000-0000-0000-0000-000000000000"},96792:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=(n=r(37037))&&n.__esModule?n:{default:n};t.default=function(e){if(!(0,i.default)(e))throw TypeError("Invalid UUID");let t;const r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r}},27656:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i},2858:(e,t)=>{"use strict";let r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){if(!r&&(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!r))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(n)};const n=new Uint8Array(16)},9042:(e,t)=>{"use strict";function r(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}function n(e,t){return e<>>32-t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=function(e){const t=[1518500249,1859775393,2400959708,3395469782],i=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let r=0;r>>0;d=l,l=c,c=n(u,30)>>>0,u=o,o=s}i[0]=i[0]+o>>>0,i[1]=i[1]+u>>>0,i[2]=i[2]+c>>>0,i[3]=i[3]+l>>>0,i[4]=i[4]+d>>>0}return[i[0]>>24&255,i[0]>>16&255,i[0]>>8&255,255&i[0],i[1]>>24&255,i[1]>>16&255,i[1]>>8&255,255&i[1],i[2]>>24&255,i[2]>>16&255,i[2]>>8&255,255&i[2],i[3]>>24&255,i[3]>>16&255,i[3]>>8&255,255&i[3],i[4]>>24&255,i[4]>>16&255,i[4]>>8&255,255&i[4]]}},49910:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.unsafeStringify=o;var n,i=(n=r(37037))&&n.__esModule?n:{default:n};const a=[];for(let e=0;e<256;++e)a.push((e+256).toString(16).slice(1));function o(e,t=0){return a[e[t+0]]+a[e[t+1]]+a[e[t+2]]+a[e[t+3]]+"-"+a[e[t+4]]+a[e[t+5]]+"-"+a[e[t+6]]+a[e[t+7]]+"-"+a[e[t+8]]+a[e[t+9]]+"-"+a[e[t+10]]+a[e[t+11]]+a[e[t+12]]+a[e[t+13]]+a[e[t+14]]+a[e[t+15]]}t.default=function(e,t=0){const r=o(e,t);if(!(0,i.default)(r))throw TypeError("Stringified UUID is invalid");return r}},13518:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=(n=r(2858))&&n.__esModule?n:{default:n},a=r(49910);let o,s,u=0,c=0;t.default=function(e,t,r){let n=t&&r||0;const l=t||new Array(16);let d=(e=e||{}).node||o,h=void 0!==e.clockseq?e.clockseq:s;if(null==d||null==h){const t=e.random||(e.rng||i.default)();null==d&&(d=o=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==h&&(h=s=16383&(t[6]<<8|t[7]))}let p=void 0!==e.msecs?e.msecs:Date.now(),f=void 0!==e.nsecs?e.nsecs:c+1;const y=p-u+(f-c)/1e4;if(y<0&&void 0===e.clockseq&&(h=h+1&16383),(y<0||p>u)&&void 0===e.nsecs&&(f=0),f>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");u=p,c=f,s=h,p+=122192928e5;const g=(1e4*(268435455&p)+f)%4294967296;l[n++]=g>>>24&255,l[n++]=g>>>16&255,l[n++]=g>>>8&255,l[n++]=255&g;const m=p/4294967296*1e4&268435455;l[n++]=m>>>8&255,l[n++]=255&m,l[n++]=m>>>24&15|16,l[n++]=m>>>16&255,l[n++]=h>>>8|128,l[n++]=255&h;for(let e=0;e<6;++e)l[n+e]=d[e];return t||(0,a.unsafeStringify)(l)}},14948:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=a(r(59025)),i=a(r(22311));function a(e){return e&&e.__esModule?e:{default:e}}var o=(0,n.default)("v3",48,i.default);t.default=o},59025:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URL=t.DNS=void 0,t.default=function(e,t,r){function n(e,n,o,s){var u;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=o(r(46140)),i=o(r(2858)),a=r(49910);function o(e){return e&&e.__esModule?e:{default:e}}t.default=function(e,t,r){if(n.default.randomUUID&&!t&&!e)return n.default.randomUUID();const o=(e=e||{}).random||(e.rng||i.default)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=o[e];return t}return(0,a.unsafeStringify)(o)}},77186:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=a(r(59025)),i=a(r(9042));function a(e){return e&&e.__esModule?e:{default:e}}var o=(0,n.default)("v5",80,i.default);t.default=o},37037:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=(n=r(27656))&&n.__esModule?n:{default:n};t.default=function(e){return"string"==typeof e&&i.default.test(e)}},7775:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=(n=r(37037))&&n.__esModule?n:{default:n};t.default=function(e){if(!(0,i.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}},17024:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(32300),t)},32300:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateIri=t.IriValidationStrategy=void 0;const r=function(){const e="[!$&'()*+,;=]",t="%[a-fA-F0-9]{2}",r="([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",n=`${r}\\.${r}\\.${r}\\.${r}`,i="[a-fA-F0-9]{1,4}",a=`(${i}:${i}|${n})`,o="[a-zA-Z0-9\\-._~ -퟿豈-﷏ﷰ-￯𐀀-🿽𠀀-𯿽𰀀-𿿽񀀀-񏿽񐀀-񟿽񠀀-񯿽񰀀-񿿽򀀀-򏿽򐀀-򟿽򠀀-򯿽򰀀-򿿽󀀀-󏿽󐀀-󟿽󡀀-󯿽]",s=`(${o}|${t}|${e}|[:@])*`,u=`(${s})+`,c=`(${s})*`;return new RegExp(`^[a-zA-Z][a-zA-Z0-9+\\-.]*:(\\/\\/((${o}|${t}|${e}|:)*@)?(\\[(((${i}:){6}${a}|::(${i}:){5}${a}|(${i})?::(${i}:){4}${a}|((${i}:){0,1}${i})?::(${i}:){3}${a}|((${i}:){0,2}${i})?::(${i}:){2}${a}|((${i}:){0,3}${i})?::${i}:${a}|((${i}:){0,4}${i})?::${a}|((${i}:){0,5}${i})?::${i}|((${i}:){0,6}${i})?::)|v[a-fA-F0-9]+\\.(${e}|${e}|":)+)\\]|${n}|(${o}|${t}|${e})*)(:[0-9]*)?(\\/${c})*|\\/(${u}(\\/${c})*)?|${u}(\\/${c})*|)(\\?(${s}|[-󰀀-󿿽􀀀-􏿽]|[\\/?])*)?(#(${s}|[\\/?])*)?$`,"u")}(),n=/^[A-Za-z][\d+-.A-Za-z]*:[^\u0000-\u0020"<>\\^`{|}]*$/u;var i;!function(e){e.Strict="strict",e.Pragmatic="pragmatic",e.None="none"}(i=t.IriValidationStrategy||(t.IriValidationStrategy={})),t.validateIri=function(e,t=i.Strict){switch(t){case i.Strict:return r.test(e)?void 0:new Error(`Invalid IRI according to RFC 3987: '${e}'`);case i.Pragmatic:return n.test(e)?void 0:new Error(`Invalid IRI according to RDF Turtle: '${e}'`);case i.None:return;default:return new Error(`Not supported validation strategy "${t}"`)}}},36562:(e,t,r)=>{e.exports=function e(t,r,n){function i(o,s){if(!r[o]){if(!t[o]){if(a)return a(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[o]={exports:{}};t[o][0].call(c.exports,(function(e){return i(t[o][1][e]||e)}),c,c.exports,e,t,r,n)}return r[o].exports}for(var a=void 0,o=0;o=0;s--)if(u[s]!==c[s])return!1;for(s=u.length-1;s>=0;s--)if(!h(e[o=u[s]],t[o],r,n))return!1;return!0}(e,t,r,s))}return r?e===t:e==t}function p(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function f(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function y(e,t,r,n){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&l(i,r,"Missing expected exception"+n);var a="string"==typeof n,o=!e&&i&&!r;if((!e&&g.isError(i)&&a&&f(i,r)||o)&&l(i,r,"Got unwanted exception"+n),e&&i&&r&&!f(i,r)||!e&&i)throw i}var g=e("util/"),m=Object.prototype.hasOwnProperty,b=Array.prototype.slice,v="foo"===function(){}.name,_=t.exports=d,w=/\s*function\s+([^\(\s]*)\s*/;_.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return u(c(e.actual),128)+" "+e.operator+" "+u(c(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||l;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var n=r.stack,i=s(t),a=n.indexOf("\n"+i);if(a>=0){var o=n.indexOf("\n",a+1);n=n.substring(o+1)}this.stack=n}}},g.inherits(_.AssertionError,Error),_.fail=l,_.ok=d,_.equal=function(e,t,r){e!=t&&l(e,t,r,"==",_.equal)},_.notEqual=function(e,t,r){e==t&&l(e,t,r,"!=",_.notEqual)},_.deepEqual=function(e,t,r){h(e,t,!1)||l(e,t,r,"deepEqual",_.deepEqual)},_.deepStrictEqual=function(e,t,r){h(e,t,!0)||l(e,t,r,"deepStrictEqual",_.deepStrictEqual)},_.notDeepEqual=function(e,t,r){h(e,t,!1)&&l(e,t,r,"notDeepEqual",_.notDeepEqual)},_.notDeepStrictEqual=function e(t,r,n){h(t,r,!0)&&l(t,r,n,"notDeepStrictEqual",e)},_.strictEqual=function(e,t,r){e!==t&&l(e,t,r,"===",_.strictEqual)},_.notStrictEqual=function(e,t,r){e===t&&l(e,t,r,"!==",_.notStrictEqual)},_.throws=function(e,t,r){y(!0,e,t,r)},_.doesNotThrow=function(e,t,r){y(!1,e,t,r)},_.ifError=function(e){if(e)throw e};var T=Object.keys||function(e){var t=[];for(var r in e)m.call(e,r)&&t.push(r);return t}}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":7}],3:[function(e,t,r){},{}],4:[function(e,t,r){function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function a(e){if(l===setTimeout)return setTimeout(e,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function o(){y&&p&&(y=!1,p.length?f=p.concat(f):g=-1,f.length&&s())}function s(){if(!y){var e=a(o);y=!0;for(var t=f.length;t;){for(p=f,f=[];++g1)for(var r=1;r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(t)?r.showHidden=t:t&&n._extend(r,t),y(r.showHidden)&&(r.showHidden=!1),y(r.depth)&&(r.depth=2),y(r.colors)&&(r.colors=!1),y(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=a),s(r,e,r.depth)}function a(e,t){var r=i.styles[t];return r?"["+i.colors[r][0]+"m"+e+"["+i.colors[r][1]+"m":e}function o(e,t){return e}function s(e,t,r){if(e.customInspect&&t&&_(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return f(i)||(i=s(e,i,r)),i}var a=function(e,t){if(y(t))return e.stylize("undefined","undefined");if(f(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return p(t)?e.stylize(""+t,"number"):d(t)?e.stylize(""+t,"boolean"):h(t)?e.stylize("null","null"):void 0}(e,t);if(a)return a;var o=Object.keys(t),m=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),v(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return u(t);if(0===o.length){if(_(t)){var w=t.name?": "+t.name:"";return e.stylize("[Function"+w+"]","special")}if(g(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(b(t))return e.stylize(Date.prototype.toString.call(t),"date");if(v(t))return u(t)}var T,O="",E=!1,x=["{","}"];return l(t)&&(E=!0,x=["[","]"]),_(t)&&(O=" [Function"+(t.name?": "+t.name:"")+"]"),g(t)&&(O=" "+RegExp.prototype.toString.call(t)),b(t)&&(O=" "+Date.prototype.toUTCString.call(t)),v(t)&&(O=" "+u(t)),0!==o.length||E&&0!=t.length?r<0?g(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),T=E?function(e,t,r,n,i){for(var a=[],o=0,s=t.length;o60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}(T,O,x)):x[0]+O+x[1]}function u(e){return"["+Error.prototype.toString.call(e)+"]"}function c(e,t,r,n,i,a){var o,u,c;if((c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?u=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(u=e.stylize("[Setter]","special")),S(n,i)||(o="["+i+"]"),u||(e.seen.indexOf(c.value)<0?(u=h(r)?s(e,c.value,null):s(e,c.value,r-1)).indexOf("\n")>-1&&(u=a?u.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+u.split("\n").map((function(e){return" "+e})).join("\n")):u=e.stylize("[Circular]","special")),y(o)){if(a&&i.match(/^\d+$/))return u;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+u}function l(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function h(e){return null===e}function p(e){return"number"==typeof e}function f(e){return"string"==typeof e}function y(e){return void 0===e}function g(e){return m(e)&&"[object RegExp]"===w(e)}function m(e){return"object"==typeof e&&null!==e}function b(e){return m(e)&&"[object Date]"===w(e)}function v(e){return m(e)&&("[object Error]"===w(e)||e instanceof Error)}function _(e){return"function"==typeof e}function w(e){return Object.prototype.toString.call(e)}function T(e){return e<10?"0"+e.toString(10):e.toString(10)}function S(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var O=/%[sdj%]/g;n.format=function(e){if(!f(e)){for(var t=[],r=0;r=a)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),s=n[r];r3&&void 0!==arguments[3]?arguments[3]:1,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:function(){return 1},a=Object.create(ke.prototype);return o(a),L(a,Object.create(Be.prototype),e,t,r,n,i),a}function o(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function s(e){return!!ve(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")}function u(e){return void 0!==e._reader}function c(e){return new Promise((function(t,r){var n={_resolve:t,_reject:r};e._reader._readIntoRequests.push(n)}))}function l(e){return new Promise((function(t,r){var n={_resolve:t,_reject:r};e._reader._readRequests.push(n)}))}function d(e,t){return e._disturbed=!0,"closed"===e._state?Promise.resolve(void 0):"errored"===e._state?Promise.reject(e._storedError):(h(e),e._readableStreamController[Ce](t).then((function(){})))}function h(e){e._state="closed";var t=e._reader;if(void 0!==t){if(!0===_(t)){var r=!0,n=!1,i=void 0;try{for(var a,o=t._readRequests[Symbol.iterator]();!(r=(a=o.next()).done);r=!0)(0,a.value._resolve)(de(void 0,!0))}catch(e){n=!0,i=e}finally{try{!r&&o.return&&o.return()}finally{if(n)throw i}}t._readRequests=[]}!function(e){e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0}(t)}}function p(e,t){e._state="errored",e._storedError=t;var r=e._reader;if(void 0!==r){if(!0===_(r)){var n=!0,i=!1,a=void 0;try{for(var o,s=r._readRequests[Symbol.iterator]();!(n=(o=s.next()).done);n=!0)o.value._reject(t)}catch(e){i=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(i)throw a}}r._readRequests=[]}else{var u=!0,c=!1,l=void 0;try{for(var d,h=r._readIntoRequests[Symbol.iterator]();!(u=(d=h.next()).done);u=!0)d.value._reject(t)}catch(e){c=!0,l=e}finally{try{!u&&h.return&&h.return()}finally{if(c)throw l}}r._readIntoRequests=[]}re(r,t),r._closedPromise.catch((function(){}))}}function f(e,t,r){e._reader._readRequests.shift()._resolve(de(t,r))}function y(e){return e._reader._readIntoRequests.length}function g(e){return e._reader._readRequests.length}function m(e){var t=e._reader;return void 0!==t&&!1!==v(t)}function b(e){var t=e._reader;return void 0!==t&&!1!==_(t)}function v(e){return!!ve(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")}function _(e){return!!ve(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")}function w(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?function(e){e._closedPromise=new Promise((function(t,r){e._closedPromise_resolve=t,e._closedPromise_reject=r}))}(e):"closed"===t._state?function(e){e._closedPromise=Promise.resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0}(e):(function(e,t){e._closedPromise=Promise.reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0}(e,t._storedError),e._closedPromise.catch((function(){})))}function T(e,t){return d(e._ownerReadableStream,t)}function S(e){"readable"===e._ownerReadableStream._state?re(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e,t){e._closedPromise=Promise.reject(t)}(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),e._closedPromise.catch((function(){})),e._ownerReadableStream._reader=void 0,e._ownerReadableStream=void 0}function O(e,t){var r=e._ownerReadableStream;return r._disturbed=!0,"errored"===r._state?Promise.reject(r._storedError):function(e,t){var r=e._controlledReadableByteStream,n=1;t.constructor!==DataView&&(n=t.constructor.BYTES_PER_ELEMENT);var i=t.constructor,a={buffer:ye(t.buffer),byteOffset:t.byteOffset,byteLength:t.byteLength,bytesFilled:0,elementSize:n,ctor:i,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(a),c(r);if("closed"===r._state){var o=new t.constructor(a.buffer,a.byteOffset,0);return Promise.resolve(de(o,!0))}if(e._queueTotalSize>0){if(!0===$(e,a)){var s=V(a);return G(e),Promise.resolve(de(s,!1))}if(!0===e._closeRequested){var u=new TypeError("Insufficient bytes to fill elements in the given buffer");return K(e,u),Promise.reject(u)}}e._pendingPullIntos.push(a);var l=c(r);return F(e),l}(r._readableStreamController,t)}function E(e){var t=e._ownerReadableStream;return t._disturbed=!0,"closed"===t._state?Promise.resolve(de(void 0,!0)):"errored"===t._state?Promise.reject(t._storedError):t._readableStreamController[Le]()}function x(e){return!!ve(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")}function A(e){!1!==R(e)&&(!0!==e._pulling?(e._pulling=!0,e._pullAlgorithm().then((function(){if(e._pulling=!1,!0===e._pullAgain)return e._pullAgain=!1,A(e)}),(function(t){D(e,t)})).catch(_e)):e._pullAgain=!0)}function R(e){var t=e._controlledReadableStream;return!1!==C(e)&&!1!==e._started&&(!0===u(t)&&g(t)>0||P(e)>0)}function I(e){var t=e._controlledReadableStream;e._closeRequested=!0,0===e._queue.length&&h(t)}function N(e,t){var r=e._controlledReadableStream;if(!0===u(r)&&g(r)>0)f(r,t,!1);else{var n=void 0;try{n=e._strategySizeAlgorithm(t)}catch(t){throw D(e,t),t}try{Se(e,t,n)}catch(t){throw D(e,t),t}}A(e)}function j(e,t){var r=e._controlledReadableStream;Oe(e),p(r,t)}function D(e,t){"readable"===e._controlledReadableStream._state&&j(e,t)}function P(e){var t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function C(e){var t=e._controlledReadableStream._state;return!1===e._closeRequested&&"readable"===t}function L(e,t,r,n,i,a,o){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,Oe(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=o,t._strategyHWM=a,t._pullAlgorithm=n,t._cancelAlgorithm=i,e._readableStreamController=t;var s=r();Promise.resolve(s).then((function(){t._started=!0,A(t)}),(function(e){D(t,e)})).catch(_e)}function k(e){return!!ve(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")}function M(e){return!!ve(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")}function F(e){!1!==function(e){var t=e._controlledReadableByteStream;return"readable"===t._state&&!0!==e._closeRequested&&!1!==e._started&&(!0===b(t)&&g(t)>0||!0===m(t)&&y(t)>0||W(e)>0)}(e)&&(!0!==e._pulling?(e._pulling=!0,e._pullAlgorithm().then((function(){e._pulling=!1,!0===e._pullAgain&&(e._pullAgain=!1,F(e))}),(function(t){"readable"===e._controlledReadableByteStream._state&&K(e,t)})).catch(_e)):e._pullAgain=!0)}function B(e){z(e),e._pendingPullIntos=[]}function U(e,t){var r=!1;"closed"===e._state&&(r=!0);var n=V(t);"default"===t.readerType?f(e,n,r):function(e,t,r){e._reader._readIntoRequests.shift()._resolve(de(t,r))}(e,n,r)}function V(e){var t=e.bytesFilled,r=e.elementSize;return new e.ctor(e.buffer,e.byteOffset,t/r)}function q(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function $(e,t){var r=t.elementSize,n=t.bytesFilled-t.bytesFilled%r,i=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),a=t.bytesFilled+i,o=a-a%r,s=i,u=!1;o>n&&(s=o-t.bytesFilled,u=!0);for(var c=e._queue;s>0;){var l=c[0],d=Math.min(s,l.byteLength),h=t.byteOffset+t.bytesFilled;ce(t.buffer,h,l.buffer,l.byteOffset,d),l.byteLength===d?c.shift():(l.byteOffset+=d,l.byteLength-=d),e._queueTotalSize-=d,Q(e,d,t),s-=d}return u}function Q(e,t,r){z(e),r.bytesFilled+=t}function G(e){0===e._queueTotalSize&&!0===e._closeRequested?h(e._controlledReadableByteStream):F(e)}function z(e){void 0!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=void 0,e._byobRequest=void 0)}function H(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;var t=e._pendingPullIntos[0];!0===$(e,t)&&(J(e),U(e._controlledReadableByteStream,t))}}function X(e,t){var r=e._pendingPullIntos[0];if("closed"===e._controlledReadableByteStream._state){if(0!==t)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream");!function(e,t){t.buffer=ye(t.buffer);var r=e._controlledReadableByteStream;if(!0===m(r))for(;y(r)>0;)U(r,J(e))}(e,r)}else!function(e,t,r){if(r.bytesFilled+t>r.byteLength)throw new RangeError("bytesWritten out of range");if(Q(e,t,r),!(r.bytesFilled0){var i=r.byteOffset+r.bytesFilled,a=r.buffer.slice(i-n,i);q(e,a,0,a.byteLength)}r.buffer=ye(r.buffer),r.bytesFilled-=n,U(e._controlledReadableByteStream,r),H(e)}}(e,t,r)}function J(e){var t=e._pendingPullIntos.shift();return z(e),t}function K(e,t){var r=e._controlledReadableByteStream;B(e),Oe(e),p(r,t)}function W(e){var t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Y(e,t,r,n,i,a,o){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,B(t),t._queue=t._queueTotalSize=void 0,Oe(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=ge(a),t._pullAlgorithm=n,t._cancelAlgorithm=i,t._autoAllocateChunkSize=o,t._pendingPullIntos=[],e._readableStreamController=t;var s=r();Promise.resolve(s).then((function(){t._started=!0,F(t)}),(function(r){"readable"===e._state&&K(t,r)})).catch(_e)}function Z(e){return new TypeError("ReadableStream.prototype."+e+" can only be used on a ReadableStream")}function ee(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function te(e){return new TypeError("ReadableStreamDefaultReader.prototype."+e+" can only be used on a ReadableStreamDefaultReader")}function re(e,t){e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0}function ne(e){return new TypeError("ReadableStreamBYOBReader.prototype."+e+" can only be used on a ReadableStreamBYOBReader")}function ie(e){return new TypeError("ReadableStreamDefaultController.prototype."+e+" can only be used on a ReadableStreamDefaultController")}function ae(e){return new TypeError("ReadableStreamBYOBRequest.prototype."+e+" can only be used on a ReadableStreamBYOBRequest")}function oe(e){return new TypeError("ReadableByteStreamController.prototype."+e+" can only be used on a ReadableByteStreamController")}var se=function(){function e(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.size,a=r.highWaterMark;n(this,e),o(this);var s=t.type;if("bytes"===String(s)){if(void 0===a&&(a=0),a=ge(a),void 0!==i)throw new RangeError("The strategy for a byte stream cannot have a size function");!function(e,t,r){var n=Object.create(Ve.prototype),i=le(t,"pull",0,[n]),a=le(t,"cancel",1,[]),o=t.autoAllocateChunkSize;if(void 0!==o&&(!1===Number.isInteger(o)||o<=0))throw new RangeError("autoAllocateChunkSize must be a positive integer");Y(e,n,(function(){return pe(t,"start",[n])}),i,a,r,o)}(this,t,a)}else{if(void 0!==s)throw new RangeError("Invalid type is specified");void 0===a&&(a=1),function(e,t,r,n){var i=Object.create(Be.prototype),a=le(t,"pull",0,[i]),o=le(t,"cancel",1,[]);L(e,i,(function(){return pe(t,"start",[i])}),a,o,r,n)}(this,t,a=ge(a),me(i))}}return se(e,[{key:"cancel",value:function(e){return!1===s(this)?Promise.reject(Z("cancel")):!0===u(this)?Promise.reject(new TypeError("Cannot cancel a stream that already has a reader")):d(this,e)}},{key:"getReader",value:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).mode;if(!1===s(this))throw Z("getReader");if(void 0===e)return i(this);if("byob"===(e=String(e)))return function(e){return new Fe(e)}(this);throw new RangeError("Invalid mode is specified")}},{key:"pipeThrough",value:function(e,t){var r=e.writable,n=e.readable;if(void 0===r||void 0===n)throw new TypeError("readable and writable arguments must be defined");return function(e){try{Promise.prototype.then.call(e,void 0,(function(){}))}catch(e){}}(this.pipeTo(r,t)),n}},{key:"pipeTo",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.preventClose,a=r.preventAbort,o=r.preventCancel;if(!1===s(this))return Promise.reject(Z("pipeTo"));if(!1===Ae(e))return Promise.reject(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));if(n=Boolean(n),a=Boolean(a),o=Boolean(o),!0===u(this))return Promise.reject(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream"));if(!0===Re(e))return Promise.reject(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream"));var c=i(this),l=xe(e),h=!1,p=Promise.resolve();return new Promise((function(r,i){function s(){var e=p;return p.then((function(){return e!==p?s():void 0}))}function u(e,t,r){"errored"===e._state?r(e._storedError):t.catch(r).catch(_e)}function f(t,r,n){function i(){t().then((function(){return g(r,n)}),(function(e){return g(!0,e)})).catch(_e)}!0!==h&&(h=!0,"writable"===e._state&&!1===Pe(e)?s().then(i):i())}function y(t,r){!0!==h&&(h=!0,"writable"===e._state&&!1===Pe(e)?s().then((function(){return g(t,r)})).catch(_e):g(t,r))}function g(e,t){je(l),S(c),e?i(t):r(void 0)}if(u(t,c._closedPromise,(function(t){!1===a?f((function(){return Ie(e,t)}),!0,t):y(!0,t)})),u(e,l._closedPromise,(function(e){!1===o?f((function(){return d(t,e)}),!0,e):y(!0,e)})),function(e,t,r){"closed"===e._state?r():t.then(r).catch(_e)}(t,c._closedPromise,(function(){!1===n?f((function(){return Ne(l)})):y()})),!0===Pe(e)||"closed"===e._state){var m=new TypeError("the destination writable stream closed before all data could be piped to it");!1===o?f((function(){return d(t,m)}),!0,m):y(!0,m)}(function e(){return!0===h?Promise.resolve():l._readyPromise.then((function(){return E(c).then((function(e){var t=e.value;!0!==e.done&&(p=De(l,t).catch((function(){})))}))})).then(e)})().catch((function(e){p=Promise.resolve(),_e(e)}))}))}},{key:"tee",value:function(){if(!1===s(this))throw Z("tee");var e=function(e,t){function r(){return E(o).then((function(e){var t=e.value;if(!0===e.done&&!1===s&&(!1===u&&I(p._readableStreamController),!1===c&&I(f._readableStreamController),s=!0),!0!==s){var r=t,n=t;!1===u&&N(p._readableStreamController,r),!1===c&&N(f._readableStreamController,n)}}))}function n(){}var o=i(e),s=!1,u=!1,c=!1,l=void 0,h=void 0,p=void 0,f=void 0,y=void 0,g=new Promise((function(e){y=e}));return p=a(n,r,(function(t){if(u=!0,l=t,!0===c){var r=be([l,h]),n=d(e,r);y(n)}return g})),f=a(n,r,(function(t){if(c=!0,h=t,!0===u){var r=be([l,h]),n=d(e,r);y(n)}return g})),o._closedPromise.catch((function(e){!0!==s&&(D(p._readableStreamController,e),D(f._readableStreamController,e),s=!0)})),[p,f]}(this);return be(e)}},{key:"locked",get:function(){if(!1===s(this))throw Z("locked");return u(this)}}]),e}();t.exports={CreateReadableByteStream:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,a=Object.create(ke.prototype);return o(a),Y(a,Object.create(Ve.prototype),e,t,r,n,i),a},CreateReadableStream:a,ReadableStream:ke,IsReadableStreamDisturbed:function(e){return e._disturbed},ReadableStreamDefaultControllerClose:I,ReadableStreamDefaultControllerEnqueue:N,ReadableStreamDefaultControllerError:j,ReadableStreamDefaultControllerGetDesiredSize:P,ReadableStreamDefaultControllerHasBackpressure:function(e){return!0!==R(e)},ReadableStreamDefaultControllerCanCloseOrEnqueue:C};var Me=function(){function e(t){if(n(this,e),!1===s(t))throw new TypeError("ReadableStreamDefaultReader can only be constructed with a ReadableStream instance");if(!0===u(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");w(this,t),this._readRequests=[]}return se(e,[{key:"cancel",value:function(e){return!1===_(this)?Promise.reject(te("cancel")):void 0===this._ownerReadableStream?Promise.reject(ee("cancel")):T(this,e)}},{key:"read",value:function(){return!1===_(this)?Promise.reject(te("read")):void 0===this._ownerReadableStream?Promise.reject(ee("read from")):E(this)}},{key:"releaseLock",value:function(){if(!1===_(this))throw te("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");S(this)}}},{key:"closed",get:function(){return!1===_(this)?Promise.reject(te("closed")):this._closedPromise}}]),e}(),Fe=function(){function e(t){if(n(this,e),!s(t))throw new TypeError("ReadableStreamBYOBReader can only be constructed with a ReadableStream instance given a byte source");if(!1===k(t._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");if(u(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");w(this,t),this._readIntoRequests=[]}return se(e,[{key:"cancel",value:function(e){return v(this)?void 0===this._ownerReadableStream?Promise.reject(ee("cancel")):T(this,e):Promise.reject(ne("cancel"))}},{key:"read",value:function(e){return v(this)?void 0===this._ownerReadableStream?Promise.reject(ee("read from")):ArrayBuffer.isView(e)?!0===fe(e.buffer)?Promise.reject(new TypeError("Cannot read into a view onto a detached ArrayBuffer")):0===e.byteLength?Promise.reject(new TypeError("view must have non-zero byteLength")):O(this,e):Promise.reject(new TypeError("view must be an array buffer view")):Promise.reject(ne("read"))}},{key:"releaseLock",value:function(){if(!v(this))throw ne("releaseLock");if(void 0!==this._ownerReadableStream){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");S(this)}}},{key:"closed",get:function(){return v(this)?this._closedPromise:Promise.reject(ne("closed"))}}]),e}(),Be=function(){function e(){throw n(this,e),new TypeError}return se(e,[{key:"close",value:function(){if(!1===x(this))throw ie("close");if(!1===C(this))throw new TypeError("The stream is not in a state that permits close");I(this)}},{key:"enqueue",value:function(e){if(!1===x(this))throw ie("enqueue");if(!1===C(this))throw new TypeError("The stream is not in a state that permits enqueue");return N(this,e)}},{key:"error",value:function(e){if(!1===x(this))throw ie("error");var t=this._controlledReadableStream;if("readable"!==t._state)throw new TypeError("The stream is "+t._state+" and so cannot be errored");j(this,e)}},{key:Ce,value:function(e){return Oe(this),this._cancelAlgorithm(e)}},{key:Le,value:function(){var e=this._controlledReadableStream;if(this._queue.length>0){var t=Te(this);return!0===this._closeRequested&&0===this._queue.length?h(e):A(this),Promise.resolve(de(t,!1))}var r=l(e);return A(this),r}},{key:"desiredSize",get:function(){if(!1===x(this))throw ie("desiredSize");return P(this)}}]),e}(),Ue=function(){function e(){throw n(this,e),new TypeError("ReadableStreamBYOBRequest cannot be used directly")}return se(e,[{key:"respond",value:function(e){if(!1===M(this))throw ae("respond");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(!0===fe(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");!function(e,t){if(t=Number(t),!1===he(t))throw new RangeError("bytesWritten must be a finite");X(e,t)}(this._associatedReadableByteStreamController,e)}},{key:"respondWithNewView",value:function(e){if(!1===M(this))throw ae("respond");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(!ArrayBuffer.isView(e))throw new TypeError("You can only respond with array buffer views");if(!0===fe(e.buffer))throw new TypeError("The supplied view's buffer has been detached and so cannot be used as a response");!function(e,t){var r=e._pendingPullIntos[0];if(r.byteOffset+r.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.byteLength!==t.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");r.buffer=t.buffer,X(e,t.byteLength)}(this._associatedReadableByteStreamController,e)}},{key:"view",get:function(){if(!1===M(this))throw ae("view");return this._view}}]),e}(),Ve=function(){function e(){throw n(this,e),new TypeError("ReadableByteStreamController constructor cannot be used directly")}return se(e,[{key:"close",value:function(){if(!1===k(this))throw oe("close");if(!0===this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");var e=this._controlledReadableByteStream._state;if("readable"!==e)throw new TypeError("The stream (in "+e+" state) is not in the readable state and cannot be closed");!function(e){var t=e._controlledReadableByteStream;if(e._queueTotalSize>0)e._closeRequested=!0;else{if(e._pendingPullIntos.length>0&&e._pendingPullIntos[0].bytesFilled>0){var r=new TypeError("Insufficient bytes to fill elements in the given buffer");throw K(e,r),r}h(t)}}(this)}},{key:"enqueue",value:function(e){if(!1===k(this))throw oe("enqueue");if(!0===this._closeRequested)throw new TypeError("stream is closed or draining");var t=this._controlledReadableByteStream._state;if("readable"!==t)throw new TypeError("The stream (in "+t+" state) is not in the readable state and cannot be enqueued to");if(!ArrayBuffer.isView(e))throw new TypeError("You can only enqueue array buffer views when using a ReadableByteStreamController");if(!0===fe(e.buffer))throw new TypeError("Cannot enqueue a view onto a detached ArrayBuffer");!function(e,t){var r=e._controlledReadableByteStream,n=t.buffer,i=t.byteOffset,a=t.byteLength,o=ye(n);!0===b(r)?0===g(r)?q(e,o,i,a):f(r,new Uint8Array(o,i,a),!1):!0===m(r)?(q(e,o,i,a),H(e)):q(e,o,i,a)}(this,e)}},{key:"error",value:function(e){if(!1===k(this))throw oe("error");var t=this._controlledReadableByteStream;if("readable"!==t._state)throw new TypeError("The stream is "+t._state+" and so cannot be errored");K(this,e)}},{key:Ce,value:function(e){return this._pendingPullIntos.length>0&&(this._pendingPullIntos[0].bytesFilled=0),Oe(this),this._cancelAlgorithm(e)}},{key:Le,value:function(){var e=this._controlledReadableByteStream;if(this._queueTotalSize>0){var t=this._queue.shift();this._queueTotalSize-=t.byteLength,G(this);var r=void 0;try{r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}catch(e){return Promise.reject(e)}return Promise.resolve(de(r,!1))}var n=this._autoAllocateChunkSize;if(void 0!==n){var i=void 0;try{i=new ArrayBuffer(n)}catch(e){return Promise.reject(e)}var a={buffer:i,byteOffset:0,byteLength:n,bytesFilled:0,elementSize:1,ctor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(a)}var o=l(e);return F(this),o}},{key:"byobRequest",get:function(){if(!1===k(this))throw oe("byobRequest");if(void 0===this._byobRequest&&this._pendingPullIntos.length>0){var e=this._pendingPullIntos[0],t=new Uint8Array(e.buffer,e.byteOffset+e.bytesFilled,e.byteLength-e.bytesFilled),r=Object.create(Ue.prototype);(function(e,t,r){e._associatedReadableByteStreamController=t,e._view=r})(r,this,t),this._byobRequest=r}return this._byobRequest}},{key:"desiredSize",get:function(){if(!1===k(this))throw oe("desiredSize");return W(this)}}]),e}()},{"./helpers.js":10,"./queue-with-sizes.js":11,"./utils.js":14,"./writable-stream.js":15,"better-assert":16}],13:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t,r,n,i,a){function c(){return t}e._writable=D(c,(function(t){return function(e,t){y("TransformStreamDefaultSinkWriteAlgorithm()");var r=e._transformStreamController;return!0===e._backpressure?e._backpressureChangePromise.then((function(){var n=e._writable;if("erroring"===n._state)throw n._storedError;return r._transformAlgorithm(t)})):r._transformAlgorithm(t)}(e,t)}),(function(){return function(e){y("TransformStreamDefaultSinkCloseAlgorithm()");var t=e._readable;return e._transformStreamController._flushAlgorithm().then((function(){if("errored"===t._state)throw t._storedError;var e=t._readableStreamController;!0===N(e)&&E(e)})).catch((function(r){throw o(e,r),t._storedError}))}(e)}),(function(){return function(e){return o(e,new TypeError("Writable side aborted")),Promise.resolve()}(e)}),r,n),e._readable=O(c,(function(){return function(e){return y("TransformStreamDefaultSourcePullAlgorithm()"),u(e,!1),e._backpressureChangePromise}(e)}),(function(t){return s(e,t),Promise.resolve()}),i,a),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,u(e,!0),e._transformStreamController=void 0}function a(e){return!!_(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")}function o(e,t){y("TransformStreamError()"),"readable"===e._readable._state&&A(e._readable._readableStreamController,t),s(e,t)}function s(e,t){P(e._writable._writableStreamController,t),!0===e._backpressure&&u(e,!1)}function u(e,t){y("TransformStreamSetBackpressure() [backpressure = "+t+"]"),void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=new Promise((function(t){e._backpressureChangePromise_resolve=t})),e._backpressure=t}function c(e){return!!_(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")}function l(e,t,r,n){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=r,t._flushAlgorithm=n}function d(e,t){y("TransformStreamDefaultControllerEnqueue()");var r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!1===N(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{x(n,t)}catch(e){throw s(r,e),r._readable._storedError}I(n)!==r._backpressure&&u(r,!0)}function h(e){return new TypeError("TransformStreamDefaultController.prototype."+e+" can only be used on a TransformStreamDefaultController")}function p(e){return new TypeError("TransformStream.prototype."+e+" can only be used on a TransformStream")}var f=function(){function e(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(n(this,e),void 0!==t.readableType)throw new RangeError("Invalid readable type specified");if(void 0!==t.writableType)throw new RangeError("Invalid writable type specified");var s=r.size,u=T(s),c=r.highWaterMark;void 0===c&&(c=1),c=w(c);var h=a.size,p=T(h),f=a.highWaterMark;void 0===f&&(f=0),f=w(f);var y=void 0;i(this,new Promise((function(e){y=e})),c,u,f,p),function(e,t){var r=Object.create(L.prototype),n=function(e){try{return d(r,e),Promise.resolve()}catch(e){return Promise.reject(e)}},i=t.transform;if(void 0!==i){if("function"!=typeof i)throw new TypeError("transform is not a method");n=function(n){return v(i,t,[n,r]).catch((function(t){throw o(e,t),t}))}}var a=b(t,"flush",0,[r]);l(e,r,n,a)}(this,t);var g=m(t,"start",[this._transformStreamController]);y(g)}return f(e,[{key:"readable",get:function(){if(!1===a(this))throw p("readable");return this._readable}},{key:"writable",get:function(){if(!1===a(this))throw p("writable");return this._writable}}]),e}(),L=function(){function e(){throw n(this,e),new TypeError("TransformStreamDefaultController instances cannot be created directly")}return f(e,[{key:"enqueue",value:function(e){if(!1===c(this))throw h("enqueue");d(this,e)}},{key:"error",value:function(e){if(!1===c(this))throw h("error");!function(e,t){o(e._controlledTransformStream,t)}(this,e)}},{key:"terminate",value:function(){if(!1===c(this))throw h("terminate");!function(e){y("TransformStreamDefaultControllerTerminate()");var t=e._controlledTransformStream,r=t._readable._readableStreamController;!0===N(r)&&E(r),s(t,new TypeError("TransformStream terminated"))}(this)}},{key:"desiredSize",get:function(){if(!1===c(this))throw h("desiredSize");var e=this._controlledTransformStream._readable._readableStreamController;return R(e)}}]),e}();t.exports={CreateTransformStream:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:function(){return 1},o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:function(){return 1},u=Object.create(C.prototype),c=void 0;i(u,new Promise((function(e){c=e})),n,a,o,s),l(u,Object.create(L.prototype),t,r);var d=e();return c(d),u},TransformStream:C}},{"./helpers.js":10,"./readable-stream.js":12,"./writable-stream.js":15,"better-assert":16,debug:18}],14:[function(e,t,r){"use strict";var n=e("better-assert");r.rethrowAssertionErrorRejection=function(e){e&&e.constructor===n.AssertionError&&setTimeout((function(){throw e}),0)}},{"better-assert":16}],15:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return new Y(e)}function a(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=[],e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function o(e){return!!q(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")}function s(e){return void 0!==e._writer}function u(e,t){var r=e._state;if("closed"===r)return Promise.resolve(void 0);if("errored"===r)return Promise.reject(e._storedError);var n=new TypeError("Requested to abort");if(void 0!==e._pendingAbortRequest)return Promise.reject(n);var i=!1;"erroring"===r&&(i=!0,t=void 0);var a=new Promise((function(r,n){e._pendingAbortRequest={_resolve:r,_reject:n,_reason:t,_wasAlreadyErroring:i}}));return!1===i&&l(e,n),a}function c(e,t){k("WritableStreamDealWithRejection(stream, %o)",t),"writable"!==e._state?d(e):l(e,t)}function l(e,t){k("WritableStreamStartErroring(stream, %o)",t);var r=e._writableStreamController;e._state="erroring",e._storedError=t;var n=e._writer;void 0!==n&&b(n,t),!1===function(e){return void 0===e._inFlightWriteRequest&&void 0===e._inFlightCloseRequest?(k("WritableStreamHasOperationMarkedInFlight() is false"),!1):(k("WritableStreamHasOperationMarkedInFlight() is true"),!0)}(e)&&!0===r._started&&d(e)}function d(e){k("WritableStreamFinishErroring()"),e._state="errored",e._writableStreamController[K]();var t=e._storedError,r=!0,n=!1,i=void 0;try{for(var a,o=e._writeRequests[Symbol.iterator]();!(r=(a=o.next()).done);r=!0)a.value._reject(t)}catch(e){n=!0,i=e}finally{try{!r&&o.return&&o.return()}finally{if(n)throw i}}if(e._writeRequests=[],void 0!==e._pendingAbortRequest){var s=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,!0===s._wasAlreadyErroring)return s._reject(t),void p(e);e._writableStreamController[J](s._reason).then((function(){s._resolve(),p(e)}),(function(t){s._reject(t),p(e)}))}else p(e)}function h(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function p(e){k("WritableStreamRejectCloseAndClosedPromiseIfNeeded()"),void 0!==e._closeRequest&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);var t=e._writer;void 0!==t&&(j(t,e._storedError),t._closedPromise.catch((function(){})))}function f(e,t){var r=e._writer;void 0!==r&&t!==e._backpressure&&(!0===t?function(e){k("defaultWriterReadyPromiseReset()"),e._readyPromise=new Promise((function(t,r){e._readyPromise_resolve=t,e._readyPromise_reject=r})),e._readyPromiseState="pending"}(r):C(r)),e._backpressure=t}function y(e){return!!q(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")}function g(e){var t=e._ownerWritableStream,r=t._state;if("closed"===r||"errored"===r)return Promise.reject(new TypeError("The stream (in "+r+" state) is not in the writable state and cannot be closed"));var n=new Promise((function(e,r){var n={_resolve:e,_reject:r};t._closeRequest=n}));return!0===t._backpressure&&"writable"===r&&C(e),function(e){z(e,"close",0),S(e)}(t._writableStreamController),n}function m(e,t){"pending"===e._closedPromiseState?j(e,t):function(e,t){e._closedPromise=Promise.reject(t),e._closedPromiseState="rejected"}(e,t),e._closedPromise.catch((function(){}))}function b(e,t){k("WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, %o)",t),"pending"===e._readyPromiseState?function(e,t){k("defaultWriterReadyPromiseReject(writer, %o)",t),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected"}(e,t):function(e,t){k("defaultWriterReadyPromiseResetToRejected(writer, %o)",t),e._readyPromise=Promise.reject(t),e._readyPromiseState="rejected"}(e,t),e._readyPromise.catch((function(){}))}function v(e){var t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");b(e,r),m(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function _(e,t){var r=e._ownerWritableStream,n=r._writableStreamController,i=function(e,t){try{return e._strategySizeAlgorithm(t)}catch(t){return O(e,t),1}}(n,t);if(r!==e._ownerWritableStream)return Promise.reject(I("write to"));var a=r._state;if("errored"===a)return Promise.reject(r._storedError);if(!0===h(r)||"closed"===a)return Promise.reject(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===a)return Promise.reject(r._storedError);var o=function(e){return new Promise((function(t,r){var n={_resolve:t,_reject:r};e._writeRequests.push(n)}))}(r);return function(e,t,r){var n={chunk:t};try{z(e,n,r)}catch(t){return void O(e,t)}var i=e._controlledWritableStream;!1===h(i)&&"writable"===i._state&&f(i,E(e)),S(e)}(n,t,i),o}function w(e,t,r,n,i,a,o,s){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,X(t),t._started=!1,t._strategySizeAlgorithm=s,t._strategyHWM=o,t._writeAlgorithm=n,t._closeAlgorithm=i,t._abortAlgorithm=a;var u=E(t);f(e,u);var l=r();Promise.resolve(l).then((function(){t._started=!0,S(t)}),(function(r){t._started=!0,c(e,r)})).catch($)}function T(e){return e._strategyHWM-e._queueTotalSize}function S(e){k("WritableStreamDefaultControllerAdvanceQueueIfNeeded()");var t=e._controlledWritableStream;if(!1!==e._started&&void 0===t._inFlightWriteRequest){var r=t._state;if("closed"!==r&&"errored"!==r)if("erroring"!==r){if(0!==e._queue.length){var n=H(e);"close"===n?function(e){var t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),G(e),e._closeAlgorithm().then((function(){!function(e){e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0,"erroring"===e._state&&(e._storedError=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state="closed";var t=e._writer;void 0!==t&&function(e){e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved"}(t)}(t)}),(function(e){!function(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),c(e,t)}(t,e)})).catch($)}(e):function(e,t){var r=e._controlledWritableStream;(function(e){e._inFlightWriteRequest=e._writeRequests.shift()})(r),e._writeAlgorithm(t).then((function(){!function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(r);var t=r._state;if(G(e),!1===h(r)&&"writable"===t){var n=E(e);f(r,n)}S(e)}),(function(e){!function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,c(e,t)}(r,e)})).catch($)}(e,n.chunk)}}else d(t)}}function O(e,t){"writable"===e._controlledWritableStream._state&&x(e,t)}function E(e){return T(e)<=0}function x(e,t){l(e._controlledWritableStream,t)}function A(e){return new TypeError("WritableStream.prototype."+e+" can only be used on a WritableStream")}function R(e){return new TypeError("WritableStreamDefaultWriter.prototype."+e+" can only be used on a WritableStreamDefaultWriter")}function I(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function N(e){e._closedPromise=new Promise((function(t,r){e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"}))}function j(e,t){e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected"}function D(e,t){k("defaultWriterReadyPromiseInitializeAsRejected(writer, %o)",t),e._readyPromise=Promise.reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected"}function P(e){k("defaultWriterReadyPromiseInitializeAsResolved()"),e._readyPromise=Promise.resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled"}function C(e){k("defaultWriterReadyPromiseResolve()"),e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled"}var L=function(){function e(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.size,o=r.highWaterMark,s=void 0===o?1:o;if(n(this,e),a(this),void 0!==t.type)throw new RangeError("Invalid type is specified");var u=V(i);!function(e,t,r,n){var i=Object.create(Z.prototype),a=F(t,"write",1,[i]),o=F(t,"close",0,[]),s=F(t,"abort",1,[]);w(e,i,(function(){return B(t,"start",[i])}),a,o,s,r,n)}(this,t,s=U(s),u)}return L(e,[{key:"abort",value:function(e){return!1===o(this)?Promise.reject(A("abort")):!0===s(this)?Promise.reject(new TypeError("Cannot abort a stream that already has a writer")):u(this,e)}},{key:"getWriter",value:function(){if(!1===o(this))throw A("getWriter");return i(this)}},{key:"locked",get:function(){if(!1===o(this))throw A("locked");return s(this)}}]),e}();t.exports={AcquireWritableStreamDefaultWriter:i,CreateWritableStream:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:function(){return 1},s=Object.create(W.prototype);return a(s),w(s,Object.create(Z.prototype),e,t,r,n,i,o),s},IsWritableStream:o,IsWritableStreamLocked:s,WritableStream:W,WritableStreamAbort:u,WritableStreamDefaultControllerErrorIfNeeded:O,WritableStreamDefaultWriterCloseWithErrorPropagation:function(e){var t=e._ownerWritableStream,r=t._state;return!0===h(t)||"closed"===r?Promise.resolve():"errored"===r?Promise.reject(t._storedError):g(e)},WritableStreamDefaultWriterRelease:v,WritableStreamDefaultWriterWrite:_,WritableStreamCloseQueuedOrInFlight:h};var Y=function(){function e(t){if(n(this,e),!1===o(t))throw new TypeError("WritableStreamDefaultWriter can only be constructed with a WritableStream instance");if(!0===s(t))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=t,t._writer=this;var r=t._state;if("writable"===r)!1===h(t)&&!0===t._backpressure?function(e){k("defaultWriterReadyPromiseInitialize()"),e._readyPromise=new Promise((function(t,r){e._readyPromise_resolve=t,e._readyPromise_reject=r})),e._readyPromiseState="pending"}(this):P(this),N(this);else if("erroring"===r)D(this,t._storedError),this._readyPromise.catch((function(){})),N(this);else if("closed"===r)P(this),function(e){e._closedPromise=Promise.resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved"}(this);else{var i=t._storedError;D(this,i),this._readyPromise.catch((function(){})),function(e,t){e._closedPromise=Promise.reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected"}(this,i),this._closedPromise.catch((function(){}))}}return L(e,[{key:"abort",value:function(e){return!1===y(this)?Promise.reject(R("abort")):void 0===this._ownerWritableStream?Promise.reject(I("abort")):function(e,t){return u(e._ownerWritableStream,t)}(this,e)}},{key:"close",value:function(){if(!1===y(this))return Promise.reject(R("close"));var e=this._ownerWritableStream;return void 0===e?Promise.reject(I("close")):!0===h(e)?Promise.reject(new TypeError("cannot close an already-closing stream")):g(this)}},{key:"releaseLock",value:function(){if(!1===y(this))throw R("releaseLock");void 0!==this._ownerWritableStream&&v(this)}},{key:"write",value:function(e){return!1===y(this)?Promise.reject(R("write")):void 0===this._ownerWritableStream?Promise.reject(I("write to")):_(this,e)}},{key:"closed",get:function(){return!1===y(this)?Promise.reject(R("closed")):this._closedPromise}},{key:"desiredSize",get:function(){if(!1===y(this))throw R("desiredSize");if(void 0===this._ownerWritableStream)throw I("desiredSize");return e=this._ownerWritableStream,"errored"===(t=e._state)||"erroring"===t?null:"closed"===t?0:T(e._writableStreamController);var e,t}},{key:"ready",get:function(){return!1===y(this)?Promise.reject(R("ready")):this._readyPromise}}]),e}(),Z=function(){function e(){throw n(this,e),new TypeError("WritableStreamDefaultController cannot be constructed explicitly")}return L(e,[{key:"error",value:function(e){if(!1===function(e){return!!q(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")}(this))throw new TypeError("WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController");"writable"===this._controlledWritableStream._state&&x(this,e)}},{key:J,value:function(e){return this._abortAlgorithm(e)}},{key:K,value:function(){X(this)}}]),e}()},{"./helpers.js":10,"./queue-with-sizes.js":11,"./utils.js":14,"better-assert":16,debug:18}],16:[function(e,t,r){(function(r){var n=e("assert").AssertionError,i=e("callsite"),a=e("fs");t.exports=r.env.NO_ASSERT?function(){}:function(e){if(!e){var t=i(),r=t[1],o=r.getFileName(),s=r.getLineNumber(),u=(u=a.readFileSync(o,"utf8")).split("\n")[s-1].match(/assert\((.*)\)/)[1];throw new n({message:u,stackStartFunction:t[0].getFunction()})}}}).call(this,e("_process"))},{_process:4,assert:2,callsite:17,fs:3}],17:[function(e,t,r){t.exports=function(){var e=Error.prepareStackTrace;Error.prepareStackTrace=function(e,t){return t};var t=new Error;Error.captureStackTrace(t,arguments.callee);var r=t.stack;return Error.prepareStackTrace=e,r}},{}],18:[function(e,t,r){(function(n){function i(){var e;try{e=r.storage.debug}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e}(r=t.exports=e("./debug")).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},r.formatArgs=function(e){var t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+r.humanize(this.diff),t){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var i=0,a=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(i++,"%c"===e&&(a=i))})),e.splice(a,0,n)}},r.save=function(e){try{null==e?r.storage.removeItem("debug"):r.storage.debug=e}catch(e){}},r.load=i,r.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},r.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),r.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],r.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},r.enable(i())}).call(this,e("_process"))},{"./debug":19,_process:4}],19:[function(e,t,r){function n(e){function t(){if(t.enabled){var e=t,i=+new Date,a=i-(n||i);e.diff=a,e.prev=n,e.curr=i,n=i;for(var o=new Array(arguments.length),s=0;s100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*d;case"days":case"day":case"d":return r*l;case"hours":case"hour":case"hrs":case"hr":case"h":return r*c;case"minutes":case"minute":case"mins":case"min":case"m":return r*u;case"seconds":case"second":case"secs":case"sec":case"s":return r*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function i(e){return e>=l?Math.round(e/l)+"d":e>=c?Math.round(e/c)+"h":e>=u?Math.round(e/u)+"m":e>=s?Math.round(e/s)+"s":e+"ms"}function a(e){return o(e,l,"day")||o(e,c,"hour")||o(e,u,"minute")||o(e,s,"second")||e+" ms"}function o(e,t,r){if(!(e0)return n(e);if("number"===r&&!1===isNaN(e))return t.long?a(e):i(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}]},{},[1])(1)},31487:(e,t)=>{"use strict";function r(e){return e>=65&&e<=90||e>=97&&e<=122||58===e||95===e||8204===e||8205===e||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}Object.defineProperty(t,"__esModule",{value:!0}),t.CHAR="\t\n\r -퟿-�𐀀-􏿿",t.S=" \t\r\n",t.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",t.NAME_CHAR="-"+t.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",t.CHAR_RE=new RegExp("^["+t.CHAR+"]$","u"),t.S_RE=new RegExp("^["+t.S+"]+$","u"),t.NAME_START_CHAR_RE=new RegExp("^["+t.NAME_START_CHAR+"]$","u"),t.NAME_CHAR_RE=new RegExp("^["+t.NAME_CHAR+"]$","u"),t.NAME_RE=new RegExp("^["+t.NAME_START_CHAR+"]["+t.NAME_CHAR+"]*$","u"),t.NMTOKEN_RE=new RegExp("^["+t.NAME_CHAR+"]+$","u"),t.S_LIST=[32,10,13,9],t.isChar=function(e){return e>=32&&e<=55295||10===e||13===e||9===e||e>=57344&&e<=65533||e>=65536&&e<=1114111},t.isS=function(e){return 32===e||10===e||13===e||9===e},t.isNameStartChar=r,t.isNameChar=function(e){return r(e)||e>=48&&e<=57||45===e||46===e||183===e||e>=768&&e<=879||e>=8255&&e<=8256}},84797:(e,t)=>{"use strict";function r(e){return e>=65&&e<=90||e>=97&&e<=122||58===e||95===e||8204===e||8205===e||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}Object.defineProperty(t,"__esModule",{value:!0}),t.CHAR="-퟿-�𐀀-􏿿",t.RESTRICTED_CHAR="-\b\v\f--„†-Ÿ",t.S=" \t\r\n",t.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",t.NAME_CHAR="-"+t.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",t.CHAR_RE=new RegExp("^["+t.CHAR+"]$","u"),t.RESTRICTED_CHAR_RE=new RegExp("^["+t.RESTRICTED_CHAR+"]$","u"),t.S_RE=new RegExp("^["+t.S+"]+$","u"),t.NAME_START_CHAR_RE=new RegExp("^["+t.NAME_START_CHAR+"]$","u"),t.NAME_CHAR_RE=new RegExp("^["+t.NAME_CHAR+"]$","u"),t.NAME_RE=new RegExp("^["+t.NAME_START_CHAR+"]["+t.NAME_CHAR+"]*$","u"),t.NMTOKEN_RE=new RegExp("^["+t.NAME_CHAR+"]+$","u"),t.S_LIST=[32,10,13,9],t.isChar=function(e){return e>=1&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111},t.isRestrictedChar=function(e){return e>=1&&e<=8||11===e||12===e||e>=14&&e<=31||e>=127&&e<=132||e>=134&&e<=159},t.isCharAndNotRestricted=function(e){return 9===e||10===e||13===e||e>31&&e<127||133===e||e>159&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111},t.isS=function(e){return 32===e||10===e||13===e||9===e},t.isNameStartChar=r,t.isNameChar=function(e){return r(e)||e>=48&&e<=57||45===e||46===e||183===e||e>=768&&e<=879||e>=8255&&e<=8256}},60446:(e,t)=>{"use strict";function r(e){return e>=65&&e<=90||95===e||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}Object.defineProperty(t,"__esModule",{value:!0}),t.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",t.NC_NAME_CHAR="-"+t.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",t.NC_NAME_START_CHAR_RE=new RegExp("^["+t.NC_NAME_START_CHAR+"]$","u"),t.NC_NAME_CHAR_RE=new RegExp("^["+t.NC_NAME_CHAR+"]$","u"),t.NC_NAME_RE=new RegExp("^["+t.NC_NAME_START_CHAR+"]["+t.NC_NAME_CHAR+"]*$","u"),t.isNCNameStartChar=r,t.isNCNameChar=function(e){return r(e)||45===e||46===e||e>=48&&e<=57||183===e||e>=768&&e<=879||e>=8255&&e<=8256}},40259:e=>{"use strict";e.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}},28799:(e,t,r)=>{"use strict";function n(e){var t=this;if(t instanceof n||(t=new n),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 r=0,i=arguments.length;r1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,r=this.head.value}for(var i=0;null!==n;i++)r=e(r,n.value,i),n=n.next;return r},n.prototype.reduceReverse=function(e,t){var r,n=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,r=this.tail.value}for(var i=this.length-1;null!==n;i--)r=e(r,n.value,i),n=n.prev;return r},n.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},n.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},n.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new n;if(tthis.length&&(t=this.length);for(var i=0,a=this.head;null!==a&&ithis.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)r.push(a.value);return r},n.prototype.splice=function(e,t,...r){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var n=0,a=this.head;null!==a&&n{},75627:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isIterator=t.isIterable=t.isSourceExpression=t.isPromise=t.isEventEmitter=t.isFunction=t.range=t.union=t.fromIterable=t.fromIterator=t.fromArray=t.single=t.empty=t.wrap=t.WrappingIterator=t.ClonedIterator=t.UnionIterator=t.MultiTransformIterator=t.SimpleTransformIterator=t.TransformIterator=t.BufferedIterator=t.MappingIterator=t.DESTINATION=t.identity=t.IntegerIterator=t.ArrayIterator=t.SingletonIterator=t.EmptyIterator=t.AsyncIterator=t.DESTROYED=t.ENDED=t.CLOSED=t.CLOSING=t.OPEN=t.INIT=t.setTaskScheduler=t.getTaskScheduler=t.scheduleTask=t.LinkedList=void 0;const n=r(37007),i=r(40288);Object.defineProperty(t,"LinkedList",{enumerable:!0,get:function(){return i.LinkedList}});let a=r(34683).createTaskScheduler();t.scheduleTask=function(e){a(e)},t.getTaskScheduler=function(){return a},t.setTaskScheduler=function(e){a=e},t.INIT=1,t.OPEN=2,t.CLOSING=4,t.CLOSED=8,t.ENDED=16,t.DESTROYED=32;class o extends n.EventEmitter{constructor(e=t.OPEN){super(),this._readable=!1,this._state=e,this.on("newListener",s)}_changeState(e,r=!1){const n=e>this._state&&this._statethis.emit("end"))):this.emit("end"))),n}read(){return null}forEach(e,t){this.on("data",P(e,t))}close(){this._changeState(t.CLOSED)&&this._endAsync()}destroy(e){this.done||this._destroy(e,(t=>{(e=e||t)&&this.emit("error",e),this._end(!0)}))}_destroy(e,t){t()}_end(e=!1){this._changeState(e?t.DESTROYED:t.ENDED)&&(this._readable=!1,this.removeAllListeners("readable"),this.removeAllListeners("data"),this.removeAllListeners("end"))}_endAsync(){a((()=>this._end()))}get readable(){return this._readable}set readable(e){e=Boolean(e)&&!this.done,this._readable!==e&&(this._readable=e,e&&a((()=>this.emit("readable"))))}get closed(){return this._state>=t.CLOSING}get ended(){return this._state===t.ENDED}get destroyed(){return this._state===t.DESTROYED}get done(){return this._state>=t.ENDED}toString(){const e=this._toStringDetails();return`[${this.constructor.name}${e?` ${e}`:""}]`}_toStringDetails(){return""}toArray(e){const t=[],r="number"==typeof(null==e?void 0:e.limit)?e.limit:1/0;return this.ended||r<=0?Promise.resolve(t):new Promise(((e,n)=>{const i=()=>e(t),a=o=>{t.push(o),t.length>=r&&(this.removeListener("error",n),this.removeListener("data",a),this.removeListener("end",i),e(t))};this.on("error",n),this.on("data",a),this.on("end",i)}))}getProperty(e,t){const r=this._properties;if(!t)return r&&r[e];if(r&&e in r)a((()=>t(r[e])));else{let r;(r=this._propertyCallbacks)||(this._propertyCallbacks=r=Object.create(null)),e in r?r[e].push(t):r[e]=[t]}}setProperty(e,t){(this._properties||(this._properties=Object.create(null)))[e]=t;const r=this._propertyCallbacks||{},n=r[e];if(n){for(e in delete r[e],a((()=>{for(const e of n)e(t)})),r)return;delete this._propertyCallbacks}}getProperties(){const e=this._properties,t={};for(const r in e)t[r]=e[r];return t}setProperties(e){for(const t in e)this.setProperty(t,e[t])}copyProperties(e,t){for(const r of t)e.getProperty(r,(e=>this.setProperty(r,e)))}transform(e){return new O(this,e)}map(e,t){return new y(this,P(e,t))}filter(e,t){return this.map((function(r){return e.call(t||this,r)?r:null}))}uniq(e=f){const t=new Set;return this.filter((function(r){const n=e.call(this,r);return!t.has(n)&&(t.add(n),!0)}))}prepend(e){return this.transform({prepend:e})}append(e){return this.transform({append:e})}surround(e,t){return this.transform({prepend:e,append:t})}skip(e){return this.map((t=>e-- >0?null:t))}take(e){return this.transform({limit:e})}range(e,t){return this.transform({offset:e,limit:Math.max(t-e+1,0)})}clone(){return new A(this)}[Symbol.asyncIterator](){const e=this;let t=null,r=null,n=null;function i(){if(null!==t)if(null!==n)a(n);else if(e.done)t({done:!0,value:void 0}),t=r=null,o();else{const n=e.read();null!==n&&(t({done:!1,value:n}),t=r=null)}}function a(e){null!==r?(r(e),t=r=n=null,o()):null===n&&(n=e)}function o(){e.removeListener("readable",i),e.removeListener("end",i),e.removeListener("error",a)}return e.addListener("readable",i),e.addListener("end",i),e.addListener("error",a),{next:()=>new Promise(((e,n)=>{t=e,r=n,i()}))}}}function s(e){"data"===e&&(this.removeListener("newListener",s),c(this,"readable",u),this.readable&&a((()=>u.call(this))))}function u(){let e;for(;0!==this.listenerCount("data")&&null!==(e=this.read());)this.emit("data",e);0!==this.listenerCount("data")||this.done||(this.removeListener("readable",u),c(this,"newListener",s))}function c(e,t,r){e.listeners(t).includes(r)||e.on(t,r)}t.AsyncIterator=o;class l extends o{constructor(){super(),this._changeState(t.ENDED,!0)}}t.EmptyIterator=l;class d extends o{constructor(e){super(),this._item=e,null===e?this.close():this.readable=!0}read(){const e=this._item;return this._item=null,this.close(),e}_toStringDetails(){return null===this._item?"":`(${this._item})`}}t.SingletonIterator=d;class h extends o{constructor(e=[],{autoStart:t=!0,preserve:r=!0}={}){super();const n=r||!Array.isArray(e)?[...e]:e;this._index=0,this._sourceStarted=!1!==t,this._truncateThreshold=r?-1:64,this._sourceStarted&&0===n.length?this.close():this._buffer=n,this.readable=!0}read(){this._sourceStarted||(this._sourceStarted=!0);let e=null;return this._buffer&&(this._index=t&&this.close(),Promise.resolve(i)}}t.ArrayIterator=h;class p extends o{constructor({start:e=0,step:t=1,end:r}={}){super(),Number.isFinite(e)&&(e=Math.trunc(e)),this._next=e,Number.isFinite(t)&&(t=Math.trunc(t)),this._step=t;const n=t>=0,i=n?1/0:-1/0;Number.isFinite(r)?r=Math.trunc(r):r!==-i&&(r=i),this._last=r,!Number.isFinite(e)||(n?e>r:e=0?n>r:nthis._init(r))),this._sourceStarted=!1!==r}get maxBufferSize(){return this._maxBufferSize}set maxBufferSize(e){e!==1/0&&(e=Number.isFinite(e)?Math.max(Math.trunc(e),1):4),this._maxBufferSize!==e&&(this._maxBufferSize=e,this._state===t.OPEN&&this._fillBuffer())}_init(e){let r=!1;this._reading=!0,this._begin((()=>{if(r)throw new Error("done callback called multiple times");r=!0,this._reading=!1,this._changeState(t.OPEN),e?this._fillBufferAsync():this.readable=!0}))}_begin(e){e()}read(){if(this.done)return null;this._sourceStarted||(this._sourceStarted=!0);const e=this._buffer;let t;return e.empty?(t=null,this.readable=!1):t=e.shift(),!this._reading&&e.length0&&(this._pushedCount=0,this._reading=!0,this._read(e,(()=>{if(!e)throw new Error("done callback called multiple times");e=0,this._reading=!1,this.closed?this._completeClose():this._pushedCount&&(this.readable=!0,this._buffer.length{this._reading=!1,this._fillBuffer()})))}close(){this._reading?this._changeState(t.CLOSING):this._completeClose()}_completeClose(){this._changeState(t.CLOSED)&&(this._reading=!0,this._flush((()=>{if(!this._reading)throw new Error("done callback called multiple times");this._reading=!1,this._buffer.empty&&this._endAsync()})))}_destroy(e,t){this._buffer.clear(),t()}_flush(e){e()}_toStringDetails(){const e=this._buffer;return`{${e.empty?"":`next: ${e.first}, `}buffer: ${e.length}}`}}t.BufferedIterator=m;class b extends m{constructor(e,t=e||{}){super(t),this._boundPush=e=>this._push(e),M(e)||(e=t.source),L(e)?this.source=e:e&&(this._createSource=k(e)?()=>e:e,this._sourceStarted&&this._loadSourceAsync()),this._optional=Boolean(t.optional),this._destroySource=!1!==t.destroySource}get source(){return C(this._createSource)&&this._loadSourceAsync(),this._source}set source(e){const r=this._source=this._validateSource(e);r[t.DESTINATION]=this,this.done?this._destroySource&&r.destroy():r.done?this.close():(r.on("end",T),r.on("readable",S),r.on("error",_))}_loadSourceAsync(){C(this._createSource)&&(Promise.resolve(this._createSource()).then((e=>{delete this._createSource,this.source=e,this._fillBuffer()}),(e=>this.emit("error",e))),this._createSource=null)}_validateSource(e,t=!1){if(this._source||void 0!==this._createSource)throw new Error("The source cannot be changed after it has been set");return g(e,t)}_read(e,t){const r=()=>{this._pushedCountthis._readAndTransform(r,t))):t()};this._readAndTransform(r,t)}_readAndTransform(e,t){let r;const n=this.source;!n||n.done||null===(r=n.read())?t():this._optional?this._optionalTransform(r,e):this._transform(r,e,this._boundPush)}_optionalTransform(e,t){const r=this._pushedCount;this._transform(e,(()=>{r===this._pushedCount&&this._push(e),t()}),this._boundPush)}_transform(e,t,r){r(e),t()}_closeWhenDone(){this.close()}_end(e){const r=this._source;r&&(r.removeListener("end",T),r.removeListener("error",_),r.removeListener("readable",S),delete r[t.DESTINATION],this._destroySource&&r.destroy()),super._end(e)}}function v(){this[t.DESTINATION].readable=!0}function _(e){this[t.DESTINATION].emit("error",e)}function w(){this[t.DESTINATION].close()}function T(){this[t.DESTINATION]._closeWhenDone()}function S(){!1!==this[t.DESTINATION]._sourceStarted&&this[t.DESTINATION]._fillBuffer()}t.TransformIterator=b;class O extends b{constructor(e,t){if(super(e,t),this._offset=0,this._limit=1/0,this._filter=e=>!0,t=t||(M(e)?null:e)){const e=C(t)?t:t.transform,{limit:r,offset:n,filter:i,map:a,prepend:o,append:s}=t;n===1/0||r===-1/0?this._limit=0:(Number.isFinite(n)&&(this._offset=Math.max(Math.trunc(n),0)),Number.isFinite(r)&&(this._limit=Math.max(Math.trunc(r),0)),C(i)&&(this._filter=i),C(a)&&(this._map=a),this._transform=C(e)?e:null),o&&(this._prepender=L(o)?o:D(o)),s&&(this._appender=L(s)?s:D(s))}}_read(e,t){const r=()=>this._readAndTransformSimple(e,n,t);function n(){a(r)}this._readAndTransformSimple(e,n,t)}_readAndTransformSimple(e,t,r){let n;const{source:i}=this;if(i&&!i.done){for(0===this._limit&&this.close();!this.closed&&this._pushedCountthis._push(e);!e||e.done?t():(e.on("data",r),e.on("end",(function n(){e.removeListener("data",r),e.removeListener("end",n),t()})))}}t.SimpleTransformIterator=O,t.MultiTransformIterator=class extends b{constructor(e,t){if(super(e,t),this._transformerQueue=[],t){const e=C(t)?t:t.multiTransform;e&&(this._createTransformer=e)}}_read(e,r){const n=this._transformerQueue,i=this._optional;let a,o;for(;(a=n[0])&&a.transformer.done;){i&&null!==a.item&&(e--,this._push(a.item)),n.shift();const{transformer:t}=a;t.removeListener("end",S),t.removeListener("readable",S),t.removeListener("error",_)}const{source:s}=this;for(;s&&!s.done&&n.length0&&null!==(o=t.read());)this._push(o),i&&(a.item=null)}else s&&s.done&&this.close();r()}_createTransformer(e){return new d(e)}_closeWhenDone(){this._transformerQueue.length||this.close()}_end(e){if(super._end(e),this._destroySource)for(const e of this._transformerQueue)e.transformer.destroy()}};class E extends m{constructor(e,t={}){super(t),this._sources=[],this._currentSource=-1;const r=!1!==t.autoStart;if(L(e))e.on("error",(e=>this.emit("error",e))),this._pending={loading:!1,sources:e},r&&this._loadSources();else if(Array.isArray(e)&&e.length>0)for(const t of e)this._addSource(t);else r&&this.close();this._destroySources=!1!==t.destroySources}_loadSources(){const e=this._pending.sources;this._pending.loading=!0,e.done?(delete this._pending,this.close()):(e.on("data",(e=>{this._addSource(e),this._fillBufferAsync()})),e.on("end",(()=>{delete this._pending,this._fillBuffer()})))}_addSource(e){k(e)&&(e=N(e)),e.done||(this._sources.push(e),e[t.DESTINATION]=this,e.on("error",_),e.on("readable",S),e.on("end",x))}_removeEmptySources(){this._sources=this._sources.filter(((e,t)=>(e.done&&t<=this._currentSource&&this._currentSource--,!e.done))),this._fillBuffer()}_read(e,t){var r;!1===(null===(r=this._pending)||void 0===r?void 0:r.loading)&&this._loadSources();let n,i=0;for(;i!==(i=e);)for(let t=0;t0;t++)this._currentSource=(this._currentSource+1)%this._sources.length,null!==(n=this._sources[this._currentSource].read())&&(e--,this._push(n));this._pending||0!==this._sources.length||this.close(),t()}_end(e=!1){if(super._end(e),this._destroySources){for(const e of this._sources)e.destroy();this._pending&&(this._pending.sources.destroy(),delete this._pending)}}}function x(){this[t.DESTINATION]._removeEmptySources()}t.UnionIterator=E;class A extends b{constructor(e){super(e,{autoStart:!1}),this._readPosition=0,this._reading=!1,e&&(this.readable=!0)}_init(){}close(){o.prototype.close.call(this)}get source(){return super.source}set source(e){const r=this._source=this._validateSource(e),n=r&&r[t.DESTINATION]||(r[t.DESTINATION]=new R(r));this.done?this._destroySource&&r.destroy():n.endsAt(0)?this.close():(n.register(this),!1!==r._sourceStarted&&null===n.readAt(0)||(this.readable=!0));const i=this._propertyCallbacks;for(const e in i){const t=i[e];for(const r of t)this._getSourceProperty(e,r)}}_validateSource(e,r=!1){const n=e&&e[t.DESTINATION];return super._validateSource(e,!n||n instanceof R)}getProperty(e,t){const{source:r}=this,n=this._properties,i=n&&e in n;if(!t)return i?n&&n[e]:r&&r.getProperty(e);super.getProperty(e,t),r&&!i&&this._getSourceProperty(e,t)}_getSourceProperty(e,t){this.source.getProperty(e,(r=>{this._properties&&e in this._properties||t(r)}))}getProperties(){const e=this.source?this.source.getProperties():{},t=this._properties;for(const r in t)e[r]=t[r];return e}_toStringDetails(){return`{source: ${this.source?this.source.toString():"none"}}`}read(){this._sourceStarted||(this._sourceStarted=!0);const e=this.source;let r=null;if(!this.done&&e){const n=e[t.DESTINATION];null!==(r=n.readAt(this._readPosition))?this._readPosition++:this.readable=!1,n.endsAt(this._readPosition)&&this.close()}return r}_end(e){const r=this.source,n=null==r?void 0:r[t.DESTINATION];n&&n.unregister(this),m.prototype._end.call(this,e)}}t.ClonedIterator=A;class R{constructor(e){if(this._history=[],this._trackers=new Set,this._source=e,!e.done){const t=()=>{for(const e of this._trackers)e.readable=!0},r=e=>{for(const t of this._trackers)t.emit("error",e)},n=()=>{for(const e of this._trackers)!1!==e._sourceStarted&&e._readPosition===this._history.length&&e.close();this._trackers.clear(),e.removeListener("end",n),e.removeListener("error",r),e.removeListener("readable",t)};e.on("end",n),e.on("error",r),e.on("readable",t)}}register(e){this._source.done||this._trackers.add(e)}unregister(e){this._trackers.delete(e)}readAt(e){let t=null;return e{this._source=null,this.source=e})).catch((e=>this.emit("error",e)))):e&&(this.source=e)}set source(e){let r=e;if(null!==this._source)throw new Error("The source cannot be changed after it has been set");if(F(r)&&(r=r[Symbol.iterator]()),B(r)){let e=r;r=new n.EventEmitter,r.read=()=>{if(null!==e){let t;for(;!(t=e.next()).done;)if(null!==t.value)return t.value;e=null,this.close()}return null}}else r=g(r);this.done?this._destroySource&&C(r.destroy)&&r.destroy():(r[t.DESTINATION]=this,r.on("end",w),r.on("error",_),r.on("readable",v),this._source=r,this.readable=!1!==r.readable)}read(){if(null!==this._source&&!1!==this._source.readable){const e=this._source.read();if(null!==e)return e;this.readable=!1}return null}_end(e=!1){null!==this._source&&(this._source.removeListener("end",w),this._source.removeListener("error",_),this._source.removeListener("readable",v),delete this._source[t.DESTINATION],this._destroySource&&C(this._source.destroy)&&this._source.destroy(),this._source=null),super._end(e)}}function N(e,t){if(t&&("autoStart"in t||"optional"in t||"source"in t||"maxBufferSize"in t))return e&&!L(e)&&(e=new I(e)),new b(e,t);if(!e)return j();if(k(e))return new I(e,t);if(e instanceof o)return e;if(Array.isArray(e))return D(e);if(F(e)||B(e)||L(e))return new I(e,t);throw new TypeError(`Invalid source: ${e}`)}function j(){return new l}function D(e){return new h(e)}function P(e,t){return t?e.bind(t):e}function C(e){return"function"==typeof e}function L(e){return C(null==e?void 0:e.on)}function k(e){return C(null==e?void 0:e.then)}function M(e){return e&&(L(e)||k(e)||C(e))}function F(e){return e&&Symbol.iterator in e}function B(e){return C(null==e?void 0:e.next)}t.WrappingIterator=I,t.wrap=N,t.empty=j,t.single=function(e){return new d(e)},t.fromArray=D,t.fromIterator=function(e){return new I(e)},t.fromIterable=function(e){return new I(e)},t.union=function(e){return new E(e)},t.range=function(e,t,r){return new p({start:e,end:t,step:r})},t.isFunction=C,t.isEventEmitter=L,t.isPromise=k,t.isSourceExpression=M,t.isIterable=F,t.isIterator=B},40288:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LinkedList=void 0,t.LinkedList=class{constructor(){this._length=0,this._head=null,this._tail=null}get length(){return this._length}get first(){var e;return null===(e=this._head)||void 0===e?void 0:e.value}get last(){var e;return null===(e=this._tail)||void 0===e?void 0:e.value}get empty(){return null===this._head}push(e){const t={value:e,next:null};null===this._tail?this._head=this._tail=t:this._tail.next=this._tail=t,this._length++}shift(){if(null===this._head)return;const{value:e,next:t}=this._head;return this._head=t,null===t&&(this._tail=null),this._length--,e}clear(){this._length=0,this._head=this._tail=null}}},34683:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createTaskScheduler=void 0;const r=Promise.resolve(void 0);t.createTaskScheduler=function(){const e="function"==typeof queueMicrotask?queueMicrotask:e=>r.then(e),t="function"==typeof setImmediate?setImmediate:e=>setTimeout(e,0);let n=0,i=null;return r=>{null!==i?i.push(r):++n<100?e(r):(i=[r],t((()=>{for(const t of i)e(t);i=null,n=0})))}}},89096:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LRUCache=void 0;const r="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,n=new Set,i="object"==typeof process&&process?process:{},a=(e,t,r,n)=>{"function"==typeof i.emitWarning?i.emitWarning(e,t,r,n):console.error(`[${r}] ${t}: ${e}`)};let o=globalThis.AbortController,s=globalThis.AbortSignal;if(void 0===o){s=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,t){this._onabort.push(t)}},o=class{constructor(){t()}signal=new s;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(const t of this.signal._onabort)t(e);this.signal.onabort?.(e)}}};let e="1"!==i.env?.LRU_CACHE_IGNORE_AC_WARNING;const t=()=>{e&&(e=!1,a("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}Symbol("type");const u=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),c=e=>u(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?l:null:null;class l extends Array{constructor(e){super(e),this.fill(0)}}class d{heap;length;static#e=!1;static create(e){const t=c(e);if(!t)return[];d.#e=!0;const r=new d(e,t);return d.#e=!1,r}constructor(e,t){if(!d.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}}class h{#t;#r;#n;#i;#a;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#o;#s;#u;#c;#l;#d;#h;#p;#f;#y;#g;#m;#b;#v;#_;#w;#T;static unsafeExposeInternals(e){return{starts:e.#b,ttls:e.#v,sizes:e.#m,keyMap:e.#u,keyList:e.#c,valList:e.#l,next:e.#d,prev:e.#h,get head(){return e.#p},get tail(){return e.#f},free:e.#y,isBackgroundFetch:t=>e.#S(t),backgroundFetch:(t,r,n,i)=>e.#O(t,r,n,i),moveToTail:t=>e.#E(t),indexes:t=>e.#x(t),rindexes:t=>e.#A(t),isStale:t=>e.#R(t)}}get max(){return this.#t}get maxSize(){return this.#r}get calculatedSize(){return this.#s}get size(){return this.#o}get fetchMethod(){return this.#a}get dispose(){return this.#n}get disposeAfter(){return this.#i}constructor(e){const{max:t=0,ttl:r,ttlResolution:i=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:l,allowStale:p,dispose:f,disposeAfter:y,noDisposeOnSet:g,noUpdateTTL:m,maxSize:b=0,maxEntrySize:v=0,sizeCalculation:_,fetchMethod:w,noDeleteOnFetchRejection:T,noDeleteOnStaleGet:S,allowStaleOnFetchRejection:O,allowStaleOnFetchAbort:E,ignoreFetchAbort:x}=e;if(0!==t&&!u(t))throw new TypeError("max option must be a nonnegative integer");const A=t?c(t):Array;if(!A)throw new Error("invalid max value: "+t);if(this.#t=t,this.#r=b,this.maxEntrySize=v||this.#r,this.sizeCalculation=_,this.sizeCalculation){if(!this.#r&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==w&&"function"!=typeof w)throw new TypeError("fetchMethod must be a function if specified");if(this.#a=w,this.#w=!!w,this.#u=new Map,this.#c=new Array(t).fill(void 0),this.#l=new Array(t).fill(void 0),this.#d=new A(t),this.#h=new A(t),this.#p=0,this.#f=0,this.#y=d.create(t),this.#o=0,this.#s=0,"function"==typeof f&&(this.#n=f),"function"==typeof y?(this.#i=y,this.#g=[]):(this.#i=void 0,this.#g=void 0),this.#_=!!this.#n,this.#T=!!this.#i,this.noDisposeOnSet=!!g,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!T,this.allowStaleOnFetchRejection=!!O,this.allowStaleOnFetchAbort=!!E,this.ignoreFetchAbort=!!x,0!==this.maxEntrySize){if(0!==this.#r&&!u(this.#r))throw new TypeError("maxSize must be a positive integer if specified");if(!u(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#I()}if(this.allowStale=!!p,this.noDeleteOnStaleGet=!!S,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!l,this.ttlResolution=u(i)||0===i?i:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!u(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#N()}if(0===this.#t&&0===this.ttl&&0===this.#r)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#r){const e="LRU_CACHE_UNBOUNDED";(e=>!n.has(e))(e)&&(n.add(e),a("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",e,h))}}getRemainingTTL(e){return this.#u.has(e)?1/0:0}#N(){const e=new l(this.#t),t=new l(this.#t);this.#v=e,this.#b=t,this.#j=(n,i,a=r.now())=>{if(t[n]=0!==i?a:0,e[n]=i,0!==i&&this.ttlAutopurge){const e=setTimeout((()=>{this.#R(n)&&this.delete(this.#c[n])}),i+1);e.unref&&e.unref()}},this.#D=n=>{t[n]=0!==e[n]?r.now():0},this.#P=(r,a)=>{if(e[a]){const o=e[a],s=t[a];if(!o||!s)return;r.ttl=o,r.start=s,r.now=n||i();const u=r.now-s;r.remainingTTL=o-u}};let n=0;const i=()=>{const e=r.now();if(this.ttlResolution>0){n=e;const t=setTimeout((()=>n=0),this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=r=>{const a=this.#u.get(r);if(void 0===a)return 0;const o=e[a],s=t[a];return o&&s?o-((n||i())-s):1/0},this.#R=r=>{const a=t[r],o=e[r];return!!o&&!!a&&(n||i())-a>o}}#D=()=>{};#P=()=>{};#j=()=>{};#R=()=>!1;#I(){const e=new l(this.#t);this.#s=0,this.#m=e,this.#C=t=>{this.#s-=e[t],e[t]=0},this.#L=(e,t,r,n)=>{if(this.#S(t))return 0;if(!u(r)){if(!n)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof n)throw new TypeError("sizeCalculation must be a function");if(r=n(t,e),!u(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return r},this.#k=(t,r,n)=>{if(e[t]=r,this.#r){const r=this.#r-e[t];for(;this.#s>r;)this.#M(!0)}this.#s+=e[t],n&&(n.entrySize=r,n.totalCalculatedSize=this.#s)}}#C=e=>{};#k=(e,t,r)=>{};#L=(e,t,r,n)=>{if(r||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#x({allowStale:e=this.allowStale}={}){if(this.#o)for(let t=this.#f;this.#F(t)&&(!e&&this.#R(t)||(yield t),t!==this.#p);)t=this.#h[t]}*#A({allowStale:e=this.allowStale}={}){if(this.#o)for(let t=this.#p;this.#F(t)&&(!e&&this.#R(t)||(yield t),t!==this.#f);)t=this.#d[t]}#F(e){return void 0!==e&&this.#u.get(this.#c[e])===e}*entries(){for(const e of this.#x())void 0===this.#l[e]||void 0===this.#c[e]||this.#S(this.#l[e])||(yield[this.#c[e],this.#l[e]])}*rentries(){for(const e of this.#A())void 0===this.#l[e]||void 0===this.#c[e]||this.#S(this.#l[e])||(yield[this.#c[e],this.#l[e]])}*keys(){for(const e of this.#x()){const t=this.#c[e];void 0===t||this.#S(this.#l[e])||(yield t)}}*rkeys(){for(const e of this.#A()){const t=this.#c[e];void 0===t||this.#S(this.#l[e])||(yield t)}}*values(){for(const e of this.#x())void 0===this.#l[e]||this.#S(this.#l[e])||(yield this.#l[e])}*rvalues(){for(const e of this.#A())void 0===this.#l[e]||this.#S(this.#l[e])||(yield this.#l[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(const r of this.#x()){const n=this.#l[r],i=this.#S(n)?n.__staleWhileFetching:n;if(void 0!==i&&e(i,this.#c[r],this))return this.get(this.#c[r],t)}}forEach(e,t=this){for(const r of this.#x()){const n=this.#l[r],i=this.#S(n)?n.__staleWhileFetching:n;void 0!==i&&e.call(t,i,this.#c[r],this)}}rforEach(e,t=this){for(const r of this.#A()){const n=this.#l[r],i=this.#S(n)?n.__staleWhileFetching:n;void 0!==i&&e.call(t,i,this.#c[r],this)}}purgeStale(){let e=!1;for(const t of this.#A({allowStale:!0}))this.#R(t)&&(this.delete(this.#c[t]),e=!0);return e}info(e){const t=this.#u.get(e);if(void 0===t)return;const n=this.#l[t],i=this.#S(n)?n.__staleWhileFetching:n;if(void 0===i)return;const a={value:i};if(this.#v&&this.#b){const e=this.#v[t],n=this.#b[t];if(e&&n){const t=e-(r.now()-n);a.ttl=t,a.start=Date.now()}}return this.#m&&(a.size=this.#m[t]),a}dump(){const e=[];for(const t of this.#x({allowStale:!0})){const n=this.#c[t],i=this.#l[t],a=this.#S(i)?i.__staleWhileFetching:i;if(void 0===a||void 0===n)continue;const o={value:a};if(this.#v&&this.#b){o.ttl=this.#v[t];const e=r.now()-this.#b[t];o.start=Math.floor(Date.now()-e)}this.#m&&(o.size=this.#m[t]),e.unshift([n,o])}return e}load(e){this.clear();for(const[t,n]of e){if(n.start){const e=Date.now()-n.start;n.start=r.now()-e}this.set(t,n.value,n)}}set(e,t,r={}){if(void 0===t)return this.delete(e),this;const{ttl:n=this.ttl,start:i,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:s}=r;let{noUpdateTTL:u=this.noUpdateTTL}=r;const c=this.#L(e,t,r.size||0,o);if(this.maxEntrySize&&c>this.maxEntrySize)return s&&(s.set="miss",s.maxEntrySizeExceeded=!0),this.delete(e),this;let l=0===this.#o?void 0:this.#u.get(e);if(void 0===l)l=0===this.#o?this.#f:0!==this.#y.length?this.#y.pop():this.#o===this.#t?this.#M(!1):this.#o,this.#c[l]=e,this.#l[l]=t,this.#u.set(e,l),this.#d[this.#f]=l,this.#h[l]=this.#f,this.#f=l,this.#o++,this.#k(l,c,s),s&&(s.set="add"),u=!1;else{this.#E(l);const r=this.#l[l];if(t!==r){if(this.#w&&this.#S(r)){r.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:t}=r;void 0===t||a||(this.#_&&this.#n?.(t,e,"set"),this.#T&&this.#g?.push([t,e,"set"]))}else a||(this.#_&&this.#n?.(r,e,"set"),this.#T&&this.#g?.push([r,e,"set"]));if(this.#C(l),this.#k(l,c,s),this.#l[l]=t,s){s.set="replace";const e=r&&this.#S(r)?r.__staleWhileFetching:r;void 0!==e&&(s.oldValue=e)}}else s&&(s.set="update")}if(0===n||this.#v||this.#N(),this.#v&&(u||this.#j(l,n,i),s&&this.#P(s,l)),!a&&this.#T&&this.#g){const e=this.#g;let t;for(;t=e?.shift();)this.#i?.(...t)}return this}pop(){try{for(;this.#o;){const e=this.#l[this.#p];if(this.#M(!0),this.#S(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#T&&this.#g){const e=this.#g;let t;for(;t=e?.shift();)this.#i?.(...t)}}}#M(e){const t=this.#p,r=this.#c[t],n=this.#l[t];return this.#w&&this.#S(n)?n.__abortController.abort(new Error("evicted")):(this.#_||this.#T)&&(this.#_&&this.#n?.(n,r,"evict"),this.#T&&this.#g?.push([n,r,"evict"])),this.#C(t),e&&(this.#c[t]=void 0,this.#l[t]=void 0,this.#y.push(t)),1===this.#o?(this.#p=this.#f=0,this.#y.length=0):this.#p=this.#d[t],this.#u.delete(r),this.#o--,t}has(e,t={}){const{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=t,i=this.#u.get(e);if(void 0!==i){const e=this.#l[i];if(this.#S(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#R(i))return r&&this.#D(i),n&&(n.has="hit",this.#P(n,i)),!0;n&&(n.has="stale",this.#P(n,i))}else n&&(n.has="miss");return!1}peek(e,t={}){const{allowStale:r=this.allowStale}=t,n=this.#u.get(e);if(void 0===n||!r&&this.#R(n))return;const i=this.#l[n];return this.#S(i)?i.__staleWhileFetching:i}#O(e,t,r,n){const i=void 0===t?void 0:this.#l[t];if(this.#S(i))return i;const a=new o,{signal:s}=r;s?.addEventListener("abort",(()=>a.abort(s.reason)),{signal:a.signal});const u={signal:a.signal,options:r,context:n},c=(n,i=!1)=>{const{aborted:o}=a.signal,s=r.ignoreFetchAbort&&void 0!==n;if(r.status&&(o&&!i?(r.status.fetchAborted=!0,r.status.fetchError=a.signal.reason,s&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),o&&!s&&!i)return l(a.signal.reason);const c=d;return this.#l[t]===d&&(void 0===n?c.__staleWhileFetching?this.#l[t]=c.__staleWhileFetching:this.delete(e):(r.status&&(r.status.fetchUpdated=!0),this.set(e,n,u.options))),n},l=n=>{const{aborted:i}=a.signal,o=i&&r.allowStaleOnFetchAbort,s=o||r.allowStaleOnFetchRejection,u=s||r.noDeleteOnFetchRejection,c=d;if(this.#l[t]===d&&(u&&void 0!==c.__staleWhileFetching?o||(this.#l[t]=c.__staleWhileFetching):this.delete(e)),s)return r.status&&void 0!==c.__staleWhileFetching&&(r.status.returnedStale=!0),c.__staleWhileFetching;if(c.__returned===c)throw n};r.status&&(r.status.fetchDispatched=!0);const d=new Promise(((t,n)=>{const o=this.#a?.(e,i,u);o&&o instanceof Promise&&o.then((e=>t(void 0===e?void 0:e)),n),a.signal.addEventListener("abort",(()=>{r.ignoreFetchAbort&&!r.allowStaleOnFetchAbort||(t(void 0),r.allowStaleOnFetchAbort&&(t=e=>c(e,!0)))}))})).then(c,(e=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=e),l(e)))),h=Object.assign(d,{__abortController:a,__staleWhileFetching:i,__returned:void 0});return void 0===t?(this.set(e,h,{...u.options,status:void 0}),t=this.#u.get(e)):this.#l[t]=h,h}#S(e){if(!this.#w)return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof o}async fetch(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:s=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:l=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:d=this.allowStaleOnFetchRejection,ignoreFetchAbort:h=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:f,forceRefresh:y=!1,status:g,signal:m}=t;if(!this.#w)return g&&(g.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:i,status:g});const b={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:i,ttl:a,noDisposeOnSet:o,size:s,sizeCalculation:u,noUpdateTTL:c,noDeleteOnFetchRejection:l,allowStaleOnFetchRejection:d,allowStaleOnFetchAbort:p,ignoreFetchAbort:h,status:g,signal:m};let v=this.#u.get(e);if(void 0===v){g&&(g.fetch="miss");const t=this.#O(e,v,b,f);return t.__returned=t}{const t=this.#l[v];if(this.#S(t)){const e=r&&void 0!==t.__staleWhileFetching;return g&&(g.fetch="inflight",e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}const i=this.#R(v);if(!y&&!i)return g&&(g.fetch="hit"),this.#E(v),n&&this.#D(v),g&&this.#P(g,v),t;const a=this.#O(e,v,b,f),o=void 0!==a.__staleWhileFetching&&r;return g&&(g.fetch=i?"stale":"refresh",o&&i&&(g.returnedStale=!0)),o?a.__staleWhileFetching:a.__returned=a}}get(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:a}=t,o=this.#u.get(e);if(void 0!==o){const t=this.#l[o],s=this.#S(t);return a&&this.#P(a,o),this.#R(o)?(a&&(a.get="stale"),s?(a&&r&&void 0!==t.__staleWhileFetching&&(a.returnedStale=!0),r?t.__staleWhileFetching:void 0):(i||this.delete(e),a&&r&&(a.returnedStale=!0),r?t:void 0)):(a&&(a.get="hit"),s?t.__staleWhileFetching:(this.#E(o),n&&this.#D(o),t))}a&&(a.get="miss")}#B(e,t){this.#h[t]=e,this.#d[e]=t}#E(e){e!==this.#f&&(e===this.#p?this.#p=this.#d[e]:this.#B(this.#h[e],this.#d[e]),this.#B(this.#f,e),this.#f=e)}delete(e){let t=!1;if(0!==this.#o){const r=this.#u.get(e);if(void 0!==r)if(t=!0,1===this.#o)this.clear();else{this.#C(r);const t=this.#l[r];if(this.#S(t)?t.__abortController.abort(new Error("deleted")):(this.#_||this.#T)&&(this.#_&&this.#n?.(t,e,"delete"),this.#T&&this.#g?.push([t,e,"delete"])),this.#u.delete(e),this.#c[r]=void 0,this.#l[r]=void 0,r===this.#f)this.#f=this.#h[r];else if(r===this.#p)this.#p=this.#d[r];else{const e=this.#h[r];this.#d[e]=this.#d[r];const t=this.#d[r];this.#h[t]=this.#h[r]}this.#o--,this.#y.push(r)}}if(this.#T&&this.#g?.length){const e=this.#g;let t;for(;t=e?.shift();)this.#i?.(...t)}return t}clear(){for(const e of this.#A({allowStale:!0})){const t=this.#l[e];if(this.#S(t))t.__abortController.abort(new Error("deleted"));else{const r=this.#c[e];this.#_&&this.#n?.(t,r,"delete"),this.#T&&this.#g?.push([t,r,"delete"])}}if(this.#u.clear(),this.#l.fill(void 0),this.#c.fill(void 0),this.#v&&this.#b&&(this.#v.fill(0),this.#b.fill(0)),this.#m&&this.#m.fill(0),this.#p=0,this.#f=0,this.#y.length=0,this.#s=0,this.#o=0,this.#T&&this.#g){const e=this.#g;let t;for(;t=e?.shift();)this.#i?.(...t)}}}t.LRUCache=h}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var a=t[n]={exports:{}};return e[n].call(a.exports,a,a.exports,r),a.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e={};r.r(e),r.d(e,{anyAtomicType:()=>Ge,anySimpleType:()=>Qe,anyURI:()=>ht,base64Binary:()=>dt,boolean:()=>We,byte:()=>St,date:()=>it,dateTime:()=>rt,dateTimeStamp:()=>Dt,dayTimeDuration:()=>jt,decimal:()=>Ye,double:()=>et,duration:()=>tt,float:()=>Ze,gDay:()=>ut,gMonth:()=>ct,gMonthDay:()=>st,gYear:()=>ot,gYearMonth:()=>at,hexBinary:()=>lt,int:()=>wt,integer:()=>mt,language:()=>gt,long:()=>_t,negativeInteger:()=>vt,nonNegativeInteger:()=>Ot,nonPositiveInteger:()=>bt,normalizedString:()=>ft,positiveInteger:()=>It,short:()=>Tt,string:()=>Ke,time:()=>nt,token:()=>yt,unsignedByte:()=>Rt,unsignedInt:()=>xt,unsignedLong:()=>Et,unsignedShort:()=>At,yearMonthDuration:()=>Nt});var t=r(28612),n=r(30611),i=r(33291),a=r(86987),o=r(45250);class s{constructor(e){if(this.index=new Map,e)for(const[t,r]of e)this.set(t,r)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(o(e))}*entries(){for(const[,{term:e,value:t}]of this.index)yield[e,t]}forEach(e,t){for(const r of this.entries())e.call(t,r[1],r[0],this)}get(e){const t=this.index.get(o(e));return t&&t.value}has(e){return this.index.has(o(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,t){const r=o(e);return this.index.set(r,{term:e,value:t}),this}*values(){for(const[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}}const u=s;function c(e,{factory:t}){const r=function(e,{factory:t}){const r=l(e,{factory:t});return e=>{const n=r(e.subject),i=r(e.predicate),a=r(e.object);return n===e.subject&&i===e.predicate&&a===e.object?e:t.quad(n,i,a,e.graph)}}(e,{factory:t});return e=>{for(const t of[...e]){const n=r(t);n!==t&&(e.delete(t),e.add(n))}}}function l(e,{factory:t}){return r=>"NamedNode"!==r.termType||/^[a-z]+:\/\//.test(r.value)?r:t.namedNode(new URL(r.value,e.value).toString())}const d=/^[a-z][a-z0-9+.-]*:/;function h(e,t,{factory:r}){const n=function(e,t,{factory:r}){const n=function(e,t,{factory:r}){return n=>"NamedNode"!==n.termType?n:n.value.startsWith(e.value)?d.test(n.value)!==d.test(e.value)?n:r.namedNode(t.value+n.value.slice(e.value.length)):n}(e,t,{factory:r});return e=>{const t=n(e.subject),i=n(e.predicate),a=n(e.object);return t===e.subject&&i===e.predicate&&a===e.object?e:r.quad(t,i,a,e.graph)}}(e,t,{factory:r});return e=>{for(const t of[...e]){const r=n(t);r!==t&&(e.delete(t),e.add(r))}}}function p(e,t,{factory:r}){const n=function(e,t,{factory:r}){const n=function(e,t){return r=>r.equals(e)?t:r}(e,t);return e=>{const t=n(e.subject),i=n(e.predicate),a=n(e.object);return t===e.subject&&i===e.predicate&&a===e.object?e:r.quad(t,i,a,e.graph)}}(e,t,{factory:r});return t=>{const r=[...t.match(e),...t.match(null,e),...t.match(null,null,e)];for(const e of r){const r=n(e);r!==e&&(t.delete(e),t.add(r))}}}function f(e){try{return o(e)}catch(e){return null}}class y{constructor(e){if(this.index=new Map,e)for(const t of e)this.add(t)}get size(){return this.index.size}add(e){const t=o(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return!!e&&this.index.delete(f(e))}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return!!e&&this.index.has(f(e))}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}}const g=y,m=class{constructor({dataset:e,end:t,quad:r,start:n}){this.dataset=e,this.end=t,this.quad=r,this.start=n}get term(){return this.quad[this.end]}get graph(){return this.quad.graph}get startTerm(){return this.quad[this.start]}};class b{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}b.prototype.termType="BlankNode";const v=b;class _{equals(e){return!!e&&e.termType===this.termType}}_.prototype.termType="DefaultGraph",_.prototype.value="";const w=_,T=function(e,t){if(!t)return null;if("BlankNode"===t.termType)return e.blankNode(t.value);if("DefaultGraph"===t.termType)return e.defaultGraph();if("Literal"===t.termType)return e.literal(t.value,t.language||e.namedNode(t.datatype.value));if("NamedNode"===t.termType)return e.namedNode(t.value);if("Quad"===t.termType){const r=e.fromTerm(t.subject),n=e.fromTerm(t.predicate),i=e.fromTerm(t.object),a=e.fromTerm(t.graph);return e.quad(r,n,i,a)}if("Variable"===t.termType)return e.variable(t.value);throw new Error(`unknown termType ${t.termType}`)};class S{constructor(e,t,r){this.value=e,this.language=t,this.datatype=r}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value&&e.language===this.language&&e.datatype.equals(this.datatype)}}S.prototype.termType="Literal";const O=S;class E{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}E.prototype.termType="NamedNode";const x=E;class A{constructor(e,t,r,n){this.subject=e,this.predicate=t,this.object=r,this.graph=n}equals(e){return!!e&&("Quad"===e.termType||!e.termType)&&e.subject.equals(this.subject)&&e.predicate.equals(this.predicate)&&e.object.equals(this.object)&&e.graph.equals(this.graph)}}A.prototype.termType="Quad",A.prototype.value="";const R=A;class I{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}I.prototype.termType="Variable";const N=I,j=new x("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),D=new x("http://www.w3.org/2001/XMLSchema#string");class P{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new w}}namedNode(e){return new x(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new v(e)}literal(e,t){return"string"==typeof t?new O(e,t,j):new O(e,"",t||D)}variable(e){return new N(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,r,n=this.defaultGraph()){return new R(e,t,r,n)}fromTerm(e){return T(this,e)}fromQuad(e){return T(this,e)}}P.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const C=new P,L={apply:(e,t,r)=>e(r[0]),get:(e,t)=>e(t)},k=function(e,{factory:t=C}={}){const r=(r="")=>t.namedNode(`${e}${r.raw||r}`);return"undefined"==typeof Proxy?r:new Proxy(r,L)},M=(k("http://www.w3.org/2001/XMLSchema#"),k("http://www.w3.org/1999/02/22-rdf-syntax-ns#"));k("http://www.w3.org/2000/01/rdf-schema#");class F{static add({ptr:e,start:t,end:r,subjects:n=[null],predicates:i=[null],objects:a=[null],graphs:o,callback:s}={}){if(!e.factory)throw new Error("add operation requires a factory");let u=()=>{};s&&(u=n=>{s(new m({dataset:e.dataset,start:t,end:r,quad:n}))});for(const r of n)for(const n of i)for(const i of a)for(const a of o){const o={subject:r,predicate:n,object:i,graph:a};o[t]=e.term;const s=e.factory.quad(o.subject,o.predicate,o.object,o.graph);e.dataset.add(s),u(s)}return e}static addList({ptr:e,predicates:t,items:r,graphs:n}){if(e.isAny())throw new Error("can't attach a list to an any ptr");for(const i of t)for(const t of n){const n=r.map((()=>e.factory.blankNode()));e.dataset.add(e.factory.quad(e.term,i,n[0]||M.nil,t));for(let i=0;i!c.has(e.term)))),e=u,l=[...l,...u],c=new g(l.map((e=>e.term)))}while(u.length>0);return l}static traverseOne({ptr:e,start:t,end:r,subjects:n,predicates:i,objects:a,graphs:o,callback:s=((e,t)=>t.extend(e))}={}){const u=[];for(const c of n)for(const n of i)for(const i of a)for(const a of o){const o={subject:c,predicate:n,object:i,graph:a};o[t]=e.term;for(const n of e.dataset.match(o.subject,o.predicate,o.object,o.graph))u.push(s(new m({dataset:e.dataset,end:r,quad:n,start:t}),e))}return u}}const B=F;function U(e,t){return t?r=>t(e.extend(r)):()=>{}}const V=class{constructor({dataset:e,edges:t=[],factory:r,graph:n,term:i}){if(!e&&0===t.length)throw new Error("dataset or edges is required");if(0===t.length&&void 0===i)throw new Error("edges or term must be given");if(t.length>0&&i)throw new Error("edges or term must be given");this.dataset=e||t[t.length-1].dataset,this.edges=t,this.factory=r,this._graph=n,0===t.length&&(this._term=i)}get edge(){return this.edges[this.edges.length-1]}get graph(){return"object"==typeof this._graph?this._graph:this.edge&&this.edge.graph}get length(){return void 0!==this._term?1:this.edges.length+1}get startTerm(){return this._term||this.edges[0].startTerm}get term(){return void 0!==this._term?this._term:this.edge.term}get value(){const e=this.term;return null===e?void 0:e.value}addIn(e,t,r){return B.add({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:U(this,r)})}addList(e,t){return B.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,r){return B.add({ptr:this,start:"subject",end:"object",predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:U(this,r)})}deleteIn(e,t){return B.delete({ptr:this,start:"object",subjects:t,predicates:e})}deleteList(e){return B.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return B.delete({ptr:this,start:"subject",predicates:e,objects:t})}execute({operation:e,quantifier:t,start:r,end:n,subjects:i,predicates:a,objects:o,graphs:s,items:u,callback:c}){return B.execute({ptr:this,operation:e,quantifier:t,start:r,end:n,subjects:i,predicates:a,objects:o,graphs:s,items:u,callback:c})}extend(e){return new this.constructor({dataset:this.dataset,edges:[...this.edges,e],factory:this.factory,graph:this._graph})}hasIn(e,t){return B.traverse({ptr:this,start:"object",end:"object",subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return B.traverse({ptr:this,start:"subject",end:"subject",predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return B.traverse({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return B.isList({ptr:this})}list(){return B.list({ptr:this})}nodes(){const e=this,t=e=>void 0!==this._term?{dataset:this.dataset,term:this._term}:this.edges.length>e?{dataset:this.edges[e].dataset,term:this.edges[e].startTerm}:this.edges.length===e?{dataset:this.edges[e-1].dataset,term:this.edges[e-1].term}:void 0;return{*[Symbol.iterator](){for(let r=0;rq(e,{factory:t})))},G=function(e,t){return e?e.equals(t):e===t};function z(e,t){return t?r=>t(new e.constructor({factory:e.factory,ptrs:[r]})):()=>{}}class H{constructor({dataset:e,factory:t,ptrs:r,terms:n,graphs:i}){if(this.factory=t,r)this.ptrs=[...r];else{this.ptrs=[];for(const r of n||[null])for(const n of i||[null])this.ptrs.push(new V({dataset:e,factory:t,graph:n,term:r}))}}get dataset(){const e=new Set(this.datasets);return 1!==e.size?null:e[Symbol.iterator]().next().value}get datasets(){return this.ptrs.map((e=>e.dataset))}get term(){const e=new g(this.terms);if(1===e.size)return e[Symbol.iterator]().next().value}get terms(){return this.ptrs.map((e=>e.term))}get value(){const e=this.term;return null==e?void 0:e.value}get values(){return this.ptrs.map((e=>e.value))}addIn(e,t,r){const n=z(this,r);for(const r of this.ptrs)r.addIn(e,t,n);return this}addList(e,t){if(this.isAny())throw new Error("can't attach a list to an any ptr");for(const r of this.ptrs)r.addList(e,t);return this}addOut(e,t,r){const n=z(this,r);for(const r of this.ptrs)r.addOut(e,t,n);return this}clone(e){return new this.constructor({factory:this.factory,ptrs:this.ptrs,...e})}deleteIn(e,t){for(const r of this.ptrs)r.deleteIn(e,t);return this}deleteList(e){for(const t of this.ptrs)t.deleteList(e);return this}deleteOut(e,t){for(const r of this.ptrs)r.deleteOut(e,t);return this}distinct(){const e=this.ptrs.reduce(((e,t)=>(e.some((e=>function(e,t){return e.dataset===t.dataset&&!!G(e.graph,t.graph)&&!!G(e.term,t.term)}(e,t)))||e.push(t.trim()),e)),[]);return this.clone({ptrs:e})}execute(e){return this.clone({ptrs:this.ptrs.flatMap((t=>t.execute(e)))})}executeAll(e){let t=this;for(const r of e)t=t.execute(r);return t}filter(e){return this.clone({ptrs:[...this].filter(e).map((e=>e.ptrs[0]))})}hasIn(e,t){return this.clone({ptrs:this.ptrs.flatMap((r=>r.hasIn(e,t)))})}hasOut(e,t){return this.clone({ptrs:this.ptrs.flatMap((r=>r.hasOut(e,t)))})}in(e,t){return this.clone({ptrs:this.ptrs.flatMap((r=>r.in(e,t)))})}isAny(){return this.ptrs.length>0&&this.ptrs.some((e=>e.isAny()))}isList(){return 1===this.ptrs.length&&this.ptrs[0].isList()}list(){if(!this.isList())return;const e=this.ptrs[0].list()[Symbol.iterator](),t=()=>{const{done:t,value:r}=e.next();return t?{done:!0}:{done:!1,value:this.clone({ptrs:[r]})}};return{[Symbol.iterator]:()=>({next:t})}}map(e){return[...this].map(e)}node(e){const t=this.dataset,r=[...e].map((e=>new V({dataset:t,factory:this.factory,term:e})));return this.clone({ptrs:r})}out(e,t){return this.clone({ptrs:this.ptrs.flatMap((r=>r.out(e,t)))})}quads(){const e=this;return{*[Symbol.iterator](){for(const t of e.ptrs)for(const e of t.edges)yield e.quad}}}trim(){return this.clone({ptrs:this.ptrs.map((e=>e.trim()))})}*[Symbol.iterator](){for(const e of this.ptrs)yield this.clone({ptrs:[e]})}}const X=H,J=class extends X{constructor({dataset:e,factory:t,ptrs:r,term:n,terms:i,graph:a,graphs:o}){(n||i)&&(i=i||n),(a||o)&&(o=o||a),!r&&i&&(r=function(e,{dataset:t,factory:r,graph:n}){try{e=[$(e,{dataset:t,factory:r,graph:n})]}catch(e){}return e[Symbol.iterator]&&(e=[...e]),e.flatMap((e=>Q(n,{factory:r}).flatMap((n=>$(e,{dataset:t,factory:r,graph:n})))))}(i,{dataset:e,factory:t,graph:o})),super({dataset:e,factory:t,ptrs:r,graphs:o})}_toTerm(e){return q(e,{factory:this.factory})}_toTermArray(e){return Q(e,{factory:this.factory})}addIn(e,t,r){return"function"==typeof t&&(r=t,t=null),t||(t=[this.factory.blankNode()]),super.addIn(this._toTermArray(e),this._toTermArray(t),r)}addList(e,t){return super.addList(this._toTermArray(e),this._toTermArray(t))}addOut(e,t,r){return"function"==typeof t&&(r=t,t=null),t||(t=[this.factory.blankNode()]),super.addOut(this._toTermArray(e),this._toTermArray(t),r)}base(e){if(!e)throw new Error("base parameter is required");e=this._toTerm(e);for(const t of this.ptrs)c(e,{factory:this.factory})(t.dataset);return this.node(l(e,{factory:this.factory})(this.term))}best(e){return this.score(e,{limit:1})}deleteIn(e,t){return super.deleteIn(this._toTermArray(e),this._toTermArray(t))}deleteList(e){return super.deleteList(this._toTermArray(e))}deleteOut(e,t){return super.deleteOut(this._toTermArray(e),this._toTermArray(t))}hasIn(e,t){return super.hasIn(this._toTermArray(e),this._toTermArray(t))}hasOut(e,t){return super.hasOut(this._toTermArray(e),this._toTermArray(t))}in(e,t){return super.in(this._toTermArray(e),this._toTermArray(t))}out(e,t){return super.out(this._toTermArray(e),this._toTermArray(t))}node(e=null){return super.node(this._toTermArray(e))}rebase(e){if(!e)throw new Error("base parameter is required");e=this._toTerm(e);for(const t of this.ptrs)h(t.term,e,{factory:this.factory})(t.dataset);return this.node(e)}replace(e){if(!e)throw new Error("replacement parameter is required");e=this._toTerm(e);for(const t of this.ptrs)p(t.term,e,{factory:this.factory})(t.dataset);return this.node(e)}score(e,{limit:t=1/0,offset:r=0}={}){const n=(i=e(this),i.slice().sort(((e,t)=>{const r=t.score-e.score;return 0!==r?r:e.term.value.localeCompare(t.term.value)}))).slice(r,r+t).map((e=>new V({...e,factory:this.factory})));var i;return this.clone({ptrs:n})}},K=k("http://www.w3.org/2002/07/owl#"),W=k("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),Y=k("http://www.w3.org/2000/01/rdf-schema#"),Z=k("http://www.w3.org/ns/shacl#"),ee=k("https://schemas.link/shacl-next#"),te=k("http://www.w3.org/2001/XMLSchema#");var re=r(58059);const ne=class{constructor({details:e,factory:t,options:r,results:n=[]}={}){this.details=e,this.factory=t,this.options=r,this.results=n,this._conforms=re((()=>!this.results.some((e=>e.severity.equals(Z.Info)||e.severity.equals(Z.Violation)||e.severity.equals(Z.Warning))))),this._ptr=re((()=>this.build()))}get conforms(){return this._conforms()}get dataset(){return this.ptr.dataset}get ptr(){return this._ptr()}get term(){return this.ptr.term}build(){const e=new X({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([W.type],[Z.ValidationReport]).addOut([Z.conforms],[this.factory.literal(this.conforms.toString(),te.boolean)]);for(const t of this.results)e.addOut([Z.result],[this.factory.blankNode()],(e=>{t.build(e,this.options)}));return e}coverage(){return this.results.flatMap((e=>e.coverage()))}},ie=class{constructor({args:e={},constraintComponent:t,factory:r,focusNode:n,message:i=[],path:a,results:s=[],severity:u,shape:c,source:l=[],value:d,valuePaths:h=[]}={}){this.args=e,this.constraintComponent=t,this.factory=r,this.focusNode=n,this.path=a||c.path,this.results=s,this.severity=u,this.shape=c,this.source=l,this.value=d,this.valuePaths=h,this._message=re((()=>(this.shape.message.length>0&&(i=this.shape.message),0===i.length&&(i=this.shape.ptr.node([this.constraintComponent]).out([Z.message]).terms),i.map((t=>r.literal(function(e,t){return Object.entries(t).reduce(((e,[t,r])=>(r&&r.termType&&(r=o(r)),e.replace(`{$${t}}`,r).replace(`{?${t}}`,r))),e)}(t.value,e),t.language||null))))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([W.type],[Z.ValidationResult]).addOut([Z.focusNode],this.focusNode.terms).addOut([Z.resultSeverity],[this.severity]).addOut([Z.sourceConstraint],this.source).addOut([Z.sourceConstraintComponent],[this.constraintComponent]).addOut([Z.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([Z.resultMessage],this.message);const r=t=>"one"===t.quantifier?t.predicates.length>1?e.node([this.factory.blankNode()]).addList([Z.alternativePath],t.predicates):"object"===t.start?e.node([this.factory.blankNode()]).addOut([Z.inversePath],[t.predicates[0]]):e.node([t.predicates[0]]):"oneOrMore"===t.quantifier?e.node([this.factory.blankNode()]).addOut([Z.oneOrMorePath],[t.predicates[0]]):"zeroOrMore"===t.quantifier?e.node([this.factory.blankNode()]).addOut([Z.zeroOrMorePath],[t.predicates[0]]):"zeroOrOne"===t.quantifier?e.node([this.factory.blankNode()]).addOut([Z.zeroOrOnePath],[t.predicates[0]]):void 0;if(this.path&&(1===this.path.length?e.addOut([Z.resultPath],r(this.path[0]).terms):e.addList([Z.resultPath],this.path.map((e=>r(e).term)))),void 0!==this.value&&e.addOut([Z.value],this.value.terms),t)for(const r of this.results)e.addOut([Z.detail],[this.factory.blankNode()],(e=>{r.build(e,{details:t})}))}coverage(){return[...this.valuePaths.flatMap((e=>[...e.quads()])),...this.results.flatMap((e=>e.coverage()))]}};class ae{constructor({factory:e,focusNode:t,options:r={debug:!1,details:!1},report:n=new ne({factory:e,options:r}),shape:i,value:a,valueOrNode:o,valuePaths:s,values:u}={}){this.factory=e,this.focusNode=t,this.options=r,this.report=n,this.shape=i,this.value=a,this.valuePaths=s,this.valueOrNode=o,this.values=u}create({child:e,focusNode:t=this.focusNode,shape:r=this.shape,value:n=this.value,valueOrNode:i=this.valueOrNode,valuePaths:a=this.valuePaths,values:o=this.values}={}){return new ae({factory:this.factory,focusNode:t,options:this.options,report:e?new ne({factory:this.factory,options:this.options}):this.report,shape:r,value:n,valueOrNode:i,valuePaths:a,values:o})}result(e){this.report.results.push(new ie({factory:this.factory,focusNode:this.focusNode,shape:this.shape,value:this.value,valuePaths:this.valuePaths,...e}))}debug(e,t){this.options.debug&&this.result({severity:ee.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:ee.Trace,constraintComponent:e,...t})}test(e,t,r){e?this.debug(t,r):this.violation(t,r)}violation(e,t){this.result({constraintComponent:e,severity:this.shape.severity||Z.Violation,...t})}}const oe=ae;var se=r(99349);function ue(e){if("BlankNode"!==e.term.termType)return{quantifier:"one",start:"subject",end:"object",predicates:[e.term]};const t=e.out([Z.alternativePath]);if(1===t.ptrs.length&&t.ptrs[0].isList())return{quantifier:"one",start:"subject",end:"object",predicates:[...t.list()].map((e=>e.term))};const r=e.out([Z.inversePath]);if(r.term)return{quantifier:"one",start:"object",end:"subject",predicates:[r.term]};const n=e.out([Z.oneOrMorePath]);if(n.term)return{quantifier:"oneOrMore",start:"subject",end:"object",predicates:[n.term]};const i=e.out([Z.zeroOrMorePath]);if(i.term)return{quantifier:"zeroOrMore",start:"subject",end:"object",predicates:[i.term]};const a=e.out([Z.zeroOrOnePath]);return a.term?{quantifier:"zeroOrOne",start:"subject",end:"object",predicates:[a.term]}:void 0}const ce=function(e){return 0===e.terms.length?null:e.ptrs[0].isList()?[...e.list()].map((e=>ue(e))):[ue(e)]};async function le(e,t){return Promise.all(e.map(t))}function de(e){return t=>{t.test(e.equals(t.valueOrNode.term),Z.HasValueConstraintComponent,{args:{hasValue:e},message:[t.factory.literal("Value must be {$hasValue}")]})}}function he(e){return t=>{const r=[...t.values].some((t=>e.equals(t.term)));t.test(r,Z.HasValueConstraintComponent,{args:{hasValue:e},message:[t.factory.literal("Missing expected value {$hasValue}")]})}}function pe(e){return te.dateTime.equals(e.datatype)&&/^.*(((\+|-)\d{2}:\d{2})|Z)$/.test(e.value)}const fe=function(e,t){if(!e||"Literal"!==e.termType)return null;if(!t||"Literal"!==t.termType)return null;if(pe(e)!==pe(t))return null;const r=(0,se.fromRdf)(e),n=(0,se.fromRdf)(t);return typeof r!=typeof n?null:"string"==typeof r?r.localeCompare(n):r-n};function ye(e){return t=>{const r=t.focusNode.out([e]),n=r.filter((e=>!e.term.equals(t.focusNode.term))),i=0!==r.terms.length&&0===n.terms.length;t.test(i,Z.EqualsConstraintComponent,{args:{equals:e},message:[t.factory.literal("Must have same values as {$equals}")],value:n.terms[0]&&t.focusNode.node([n.terms[0]])||t.focusNode})}}function ge(e){return t=>{const r=new g(t.focusNode.out([e]).terms),n=new g(t.values.terms),i=[...[...n].filter((e=>!r.has(e))),...[...r].filter((e=>!n.has(e)))];for(const r of i)t.violation(Z.EqualsConstraintComponent,{args:{equals:e},message:[t.factory.literal("Must have same values as {$equals}")],value:t.focusNode.node([r])});0===i.length&&t.debug(Z.EqualsConstraintComponent,{args:{equals:e},message:[t.factory.literal("Must have same values as {$equals}")]})}}function me(e,t,r,n){return async i=>{const a=[];let o=[];t&&(o=new Set(i.shape.ptr.in([Z.property]).out([Z.property]).out([Z.qualifiedValueShape]).filter((t=>!t.term.equals(e.ptr.term))).map((e=>i.shape.validator.shape(e)))));const s=(await async function(t,r){return(await Promise.all(t.map((t=>(async t=>{const r=(await e.validate(i.create({child:!0,focusNode:t}))).report;if(a.push(r.results),!r.conforms)return!1;if(0===o.length)return!0;if(i.options.debug||i.options.details){const e=await le([...o],(async e=>(await e.validate(i.create({child:!0,focusNode:t}))).report));return a.push(e.flatMap((e=>e.results))),!e.every((e=>e.conforms))}return!await async function(e,t){for(const r of e)if(!await t(r))return!1;return!0}([...o],(async e=>(await e.validate(i.create({child:!0,focusNode:t}))).report.conforms))})(t))))).filter(Boolean)}(i.values)).length;null!==r&&i.test(s<=r,Z.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:r,qualifiedValueShape:e.ptr.term,qualifiedValueShapesDisjoint:t},message:[i.factory.literal("More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}")],results:a.flat()}),null!==n&&i.test(s>=n,Z.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:n,qualifiedValueShape:e.ptr.term,qualifiedValueShapesDisjoint:t},message:[i.factory.literal("Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}")],results:a.flat()})}}var be=r(45718),ve=r(40090),_e=r(19198);function we(e){const t={};for(const[r,n]of[...e])t[r.value]=n;return t}class Te{constructor(e){this.dataset=e}match(e,t,r,n){return _e.Readable.from(this.dataset.match(e,t,r,n))}}function Se(e,t=[]){for(const r of e.out([K.imports]))Se(r,t);for(const r of e.out([Z.declare])){const e=r.out([Z.prefix]).value,n=r.out([Z.namespace]).value;t.push(`PREFIX ${e}: <${n}>`)}return t}function Oe({message:e,query:t,source:r}){return async n=>{const i=n.focusNode.dataset,a=n.factory,o=[[a.variable("this"),n.focusNode.term]],s=await async function({bindings:e,dataset:t,factory:r,query:n}){const i=new Te(t),a=new ve.QueryEngine,o=new be.BindingsFactory(r).bindings(e);return(await a.queryBindings(n,{sources:[i],initialBindings:o})).toArray()}({bindings:o,dataset:i,factory:a,query:t});for(const t of s){const i=we(t),a=t.has("path")&&ce(n.focusNode.node([t.get("path")])),o=n.focusNode.node([t.get("value")||n.focusNode.term]);n.violation(Z.SPARQLConstraintComponent,{args:i,message:e,path:a,source:r,value:o})}0===s.length&&n.debug(Z.SPARQLConstraintComponent,{source:r})}}function Ee(e,t,r){return n=>{n.test(r.test(n.valueOrNode.term.value),Z.PatternConstraintComponent,{args:{flags:t,pattern:e},message:[n.factory.literal('Value does not match pattern "{$pattern}"')],value:n.valueOrNode})}}function xe(){return{generic:e=>{e.trace(ee.TraversalConstraintComponent,{args:{},message:[e.factory.literal("Traversal")],value:e.valueOrNode})}}}const Ae=k("http://www.w3.org/ns/shacl#"),Re=k("https://schemas.link/shacl-next#"),Ie=class{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some((e=>e.severity.equals(Ae.Info)||e.severity.equals(Ae.Violation)||e.severity.equals(Ae.Warning)))}},Ne=class{constructor({args:e={},factory:t,message:r=[],severity:n=Ae.Violation}={}){this.severity=n,this.message=r.map((r=>t.literal(function(e,t){return Object.entries(t).reduce(((e,[t,r])=>(r&&r.termType&&(r=o(r)),e.replace(`{$${t}}`,r).replace(`{?${t}}`,r))),e)}(r.value,e),r.language||null)))}};class je{constructor({factory:e=C}={}){this.factory=e}clone({factory:e}={}){return new je({factory:e||this.factory})}validate(){return new Ie}validateSimple(){return!0}}const De=je;class Pe extends De{constructor({datatypes:e,factory:t}={}){super({factory:t}),this.datatypes=[];for(const t of Array.isArray(e)?e:[e])t&&this.datatypes.push(this.factory.fromTerm(t))}clone({factory:e}={}){return new Pe({datatypes:this.datatypes,factory:e||this.factory})}}const Ce=Pe,Le=class{constructor({factory:e=C,validations:t}={}){if(this.factory=e,this.validations=new u,t)for(const e of Object.values(t)){const t=e.clone({factory:this.factory});for(const e of t.datatypes)this.validations.set(e,t)}}validate(e){const t=this.validations.get(e.datatype);return t?t.validate(e):new Ie}validateSimple(e){const t=this.validations.get(e.datatype);return!t||t.validateSimple(e)}};class ke extends Ce{constructor(e,t,{factory:r}={}){super({datatypes:t,factory:r}),this.message=[this.factory.literal("term value {$this} matches pattern {$pattern}")],this.patterns=Array.isArray(e)?e:[e]}clone({factory:e}={}){return new ke(this.patterns,this.datatypes,{factory:e||this.factory})}validate(e){const t=this.patterns.map((t=>{let r;t.test(e.value)&&(r=Re.Debug);const n={pattern:this.factory.literal(t.toString()),this:e};return new Ne({args:n,factory:this.factory,message:this.message,severity:r})}));return new Ie({results:t})}validateSimple(e){return this.patterns.every((t=>t.test(e.value)))}}const Me=ke,Fe=/^([-+]?[0-9]+)$/;class Be extends Me{constructor(e=null,t=null,r,{factory:n}={}){super(Fe,r,{factory:n}),this.maxInclusive=null,this.minInclusive=null,"string"==typeof t&&(this.maxInclusive=BigInt(t)),"string"==typeof e&&(this.minInclusive=BigInt(e))}clone({factory:e}={}){return new Be(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:e||this.factory})}validate(e){const t=super.validate(e).results;if(!Re.Debug.equals(t[0].severity))return new Ie({results:t});const r=BigInt(e.value);if(null!==this.minInclusive&&rthis.maxInclusive){const r=`term value "${e.value}" is greater than "${this.maxInclusive.toString()}"`,n=[this.factory.literal(r)];t.push(new Ne({factory:this.factory,message:n}))}return new Ie({results:t})}validateSimple(e){if(!super.validateSimple(e))return!1;const t=BigInt(e.value);return!(null!==this.minInclusive&&tthis.maxInclusive)}}const Ue=Be;class Ve extends Ce{constructor(e,t,{factory:r}={}){super({datatypes:t,factory:r}),this.values=new Set(e)}clone({factory:e}={}){return new Ve(this.values,this.datatypes,{factory:e||this.factory})}validate(e){const t=[];if(!this.values.has(e.value)){const r=`term value "${e.value}" is not included in the list: ${[...this.values].join(",")}`,n=[this.factory.literal(r)];t.push(new Ne({factory:this.factory,message:n}))}return new Ie({results:t})}validateSimple(e){return this.values.has(e.value)}}const qe=Ve,$e={xsd:k("http://www.w3.org/2001/XMLSchema#")},Qe=new Ce({datatypes:$e.xsd.anySimpleType}),Ge=new Ce({datatypes:$e.xsd.anyAtomicType}),ze=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,He=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,Xe=/^(-?P((([0-9]+Y([0-9]+M)?([0-9]+D)?|([0-9]+M)([0-9]+D)?|([0-9]+D))(T(([0-9]+H)([0-9]+M)?([0-9]+(\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\.[0-9]+)?S)?|([0-9]+(\.[0-9]+)?S)))?)|(T(([0-9]+H)([0-9]+M)?([0-9]+(\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\.[0-9]+)?S)?|([0-9]+(\.[0-9]+)?S)))))$/,Je=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Ke=new Me(ze,$e.xsd.string),We=new qe(["1","true","0","false"],$e.xsd.boolean),Ye=new Me(/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,$e.xsd.decimal),Ze=new Me(He,$e.xsd.float),et=new Me(He,$e.xsd.double),tt=new Me(Xe,$e.xsd.duration),rt=new Me(Je,$e.xsd.dateTime),nt=new Me(/^((([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,$e.xsd.time),it=new Me(/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,$e.xsd.date),at=new Me(/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,$e.xsd.gYearMonth),ot=new Me(/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,$e.xsd.gYear),st=new Me(/^(--(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,$e.xsd.gMonthDay),ut=new Me(/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,$e.xsd.gDay),ct=new Me(/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,$e.xsd.gMonth),lt=new Me(/^(([0-9a-fA-F]{2})*)$/,$e.xsd.hexBinary),dt=new Me(/^(((([A-Za-z0-9+/] ?){4})*(([A-Za-z0-9+/] ?){3}[A-Za-z0-9+/]|([A-Za-z0-9+/] ?){2}[AEIMQUYcgkosw048] ?=|[A-Za-z0-9+/] ?[AQgw] ?= ?=))?)$/,$e.xsd.base64Binary),ht=new Me(ze,$e.xsd.anyURI),pt=/^([^\u000d\u000a\u0009]*)$/,ft=new Me([ze,pt],$e.xsd.normalizedString),yt=new Me([ze,pt,/^([^ ]+( [^ ]+)*)*$/],$e.xsd.token),gt=new Me(/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,$e.xsd.language),mt=new Ue(null,null,$e.xsd.integer),bt=new Ue(null,"0",$e.xsd.nonPositiveInteger),vt=new Ue(null,"-1",$e.xsd.negativeInteger),_t=new Ue("-9223372036854775808","9223372036854775807",$e.xsd.long),wt=new Ue("-2147483648","2147483647",$e.xsd.int),Tt=new Ue("-32768","32767",$e.xsd.short),St=new Ue("-128","127",$e.xsd.byte),Ot=new Ue("0",null,$e.xsd.nonNegativeInteger),Et=new Ue("0","18446744073709551615",$e.xsd.unsignedLong),xt=new Ue("0","4294967295",$e.xsd.unsignedInt),At=new Ue("0","65535",$e.xsd.unsignedShort),Rt=new Ue("0","255",$e.xsd.unsignedByte),It=new Ue("1",null,$e.xsd.positiveInteger),Nt=new Me([Xe,/^([^DT]*)$/],$e.xsd.yearMonthDuration),jt=new Me([Xe,/^([^YM]*[DT].*)$/],$e.xsd.dayTimeDuration),Dt=new Me([Je,/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/],$e.xsd.dateTimeStamp),Pt=class extends Le{constructor({factory:t}={}){super({factory:t,validations:{...e}})}},Ct=function(e){const t=new g,r=new X({dataset:e.dataset,terms:e.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[Y.subClassOf]});for(const e of r.ptrs)for(const{term:r}of e.nodes())t.add(r);return t},Lt=new u([[Z.BlankNode,new Set(["BlankNode"])],[Z.BlankNodeOrIRI,new Set(["BlankNode","NamedNode"])],[Z.BlankNodeOrLiteral,new Set(["BlankNode","Literal"])],[Z.IRI,new Set(["NamedNode"])],[Z.IRIOrLiteral,new Set(["NamedNode","Literal"])],[Z.Literal,new Set(["Literal"])]]);function kt(e,t){return r=>{r.test(t.has(r.valueOrNode.term.termType),Z.NodeKindConstraintComponent,{args:{nodeKind:e},message:[r.factory.literal("Value does not have node kind {$nodeKind}")],value:r.valueOrNode})}}const Mt=new class{constructor(e){this.validations=e}compile(e){const t=e.validator.options.coverage;if(e.deactivated)return[];let r=!1;const n=new Set;for(const t of e.ptr.execute({start:"subject",end:"predicate"})){const e=this.validations.get(t.term);e&&(n.add(e),t.term.equals(Z.property)&&(r=!0))}return t&&e.isPropertyShape&&!r&&n.add(xe),[...n].map((t=>t(e))).filter(Boolean)}}(new u([[Z.maxCount,function(e){return{property:(t=parseInt(e.ptr.out([Z.maxCount]).value),e=>{e.test(e.values.terms.length<=t,Z.MaxCountConstraintComponent,{args:{maxCount:t},message:[e.factory.literal("More than {$maxCount} values")]})})};var t}],[Z.minCount,function(e){return{property:(t=parseInt(e.ptr.out([Z.minCount]).value),e=>{e.test(e.values.terms.length>=t,Z.MinCountConstraintComponent,{args:{minCount:t},message:[e.factory.literal("Less than {$minCount} values")]})})};var t}],[Z.and,function(e){return{generic:(t=[...e.ptr.out([Z.and])].flatMap((e=>[...e.list()])).map((t=>e.validator.shape(t))),async e=>{const r=await le(t,(async t=>(await t.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report)),n=r.every((e=>e.conforms));e.test(n,Z.AndConstraintComponent,{results:r.flatMap((e=>e.results)),value:e.valueOrNode})})};var t}],[Z.not,function(e){return{generic:(t=e.validator.shape(e.ptr.out([Z.not])),async e=>{const r=(await t.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report,n=!r.conforms;e.test(n,Z.NotConstraintComponent,{args:{not:t.ptr.term},message:[e.factory.literal("Value does have shape {$not}")],results:r.results,value:e.valueOrNode})})};var t}],[Z.or,function(e){return{generic:(t=[...e.ptr.out([Z.or])].flatMap((e=>[...e.list()])).map((t=>e.validator.shape(t))),async e=>{let r,n=[];if(e.options.debug||e.options.details){const i=await le(t,(async t=>(await t.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report));n=i.flatMap((e=>e.results)),r=i.some((e=>e.conforms))}else r=await async function(e,t){for(const r of e)if(await t(r))return!0;return!1}(t,(async t=>(await t.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report.conforms));e.test(r,Z.OrConstraintComponent,{results:n,value:e.valueOrNode})})};var t}],[Z.xone,function(e){return{generic:(t=[...e.ptr.out([Z.xone])].flatMap((e=>[...e.list()])).map((t=>e.validator.shape(t))),async e=>{const r=await le(t,(async t=>(await t.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report)),n=1===r.filter((e=>e.conforms)).length;e.test(n,Z.XoneConstraintComponent,{results:r.flatMap((e=>e.results)),value:e.valueOrNode})})};var t}],[Z.closed,function(e){if(!(0,se.fromRdf)(e.ptr.out([Z.closed]).term))return null;const t=e.ptr.out([Z.property]).map((t=>e.validator.shape(t)));return{node:(r=new g(t.filter((e=>!e.deactivated)).map((e=>e.path[0].predicates[0]))),n=new g([...e.ptr.out([Z.ignoredProperties]).list()||[]].map((e=>e.term))),e=>{const t=e.focusNode.execute({start:"subject",end:"predicate"}).filter((e=>!n.has(e.term)&&!r.has(e.term)));if(t.ptrs.length>0)for(const r of t)e.violation(Z.ClosedConstraintComponent,{message:[e.factory.literal("Predicate is not allowed (closed shape)")],path:[{quantifier:"one",start:"subject",end:"object",predicates:[r.term]}],value:e.focusNode.node([[...r.quads()][0].object])});else e.debug(Z.ClosedConstraintComponent)})};var r,n}],[Z.hasValue,function(e){const t=e.ptr.out([Z.hasValue]).term;return{node:de(t),property:he(t)}}],[Z.in,function(e){return{generic:(t=new g([...e.ptr.out([Z.in]).list()].map((e=>e.term))),e=>{e.test(t.has(e.valueOrNode.term),Z.InConstraintComponent,{args:{in:[...t].map((e=>e.value)).join(", ")},message:[e.factory.literal("Value is not in {$in}")],value:e.valueOrNode})})};var t}],[Z.disjoint,function(e){return{generic:(t=e.ptr.out([Z.disjoint]).term,e=>{const r=e.focusNode.dataset.match(e.focusNode.term,t,e.valueOrNode.term);e.test(0===r.size,Z.DisjointConstraintComponent,{args:{disjoint:t},message:[e.factory.literal("Value node must not also be one of the values of {$disjoint}")],value:e.valueOrNode})})};var t}],[Z.equals,function(e){const t=e.ptr.out([Z.equals]).term;return{node:ye(t),property:ge(t)}}],[Z.lessThan,function(e){return{property:(t=e.ptr.out([Z.lessThan]).term,e=>{const r=e.focusNode.out([t]).terms;for(const n of e.values)for(const i of r){const r=fe(n.term,i);null===r||r>=0?e.violation(Z.LessThanConstraintComponent,{args:{lessThan:t},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:n}):e.debug(Z.LessThanConstraintComponent,{args:{lessThan:t},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:n})}})};var t}],[Z.lessThanOrEquals,function(e){return{property:(t=e.ptr.out([Z.lessThanOrEquals]).term,e=>{const r=e.focusNode.out([t]).terms;for(const n of e.values)for(const i of r){const r=fe(n.term,i);null===r||r>0?e.violation(Z.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:t},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:n}):e.debug(Z.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:t},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:n})}})};var t}],[Z.maxExclusive,function(e){return{generic:(t=e.ptr.out([Z.maxExclusive]).term,e=>{const r=fe(e.valueOrNode.term,t);e.test(null!==r&&r<0,Z.MaxExclusiveConstraintComponent,{args:{maxExclusive:t},message:[e.factory.literal("Value is not less than {$maxExclusive}")],value:e.valueOrNode})})};var t}],[Z.maxInclusive,function(e){return{generic:(t=e.ptr.out([Z.maxInclusive]).term,e=>{const r=fe(e.valueOrNode.term,t);e.test(null!==r&&r<=0,Z.MaxInclusiveConstraintComponent,{args:{maxInclusive:t},message:[e.factory.literal("Value is not less than or equal to {$maxInclusive}")],value:e.valueOrNode})})};var t}],[Z.minExclusive,function(e){return{generic:(t=e.ptr.out([Z.minExclusive]).term,e=>{const r=fe(e.valueOrNode.term,t);e.test(null!==r&&r>0,Z.MinExclusiveConstraintComponent,{args:{minExclusive:t},message:[e.factory.literal("Value is not greater than {$minExclusive}")],value:e.valueOrNode})})};var t}],[Z.minInclusive,function(e){return{generic:(t=e.ptr.out([Z.minInclusive]).term,e=>{const r=fe(e.valueOrNode.term,t);e.test(null!==r&&r>=0,Z.MinInclusiveConstraintComponent,{args:{minInclusive:t},message:[e.factory.literal("Value is not greater than or equal to {$minInclusive}")],value:e.valueOrNode})})};var t}],[Z.node,function(e){return{generic:(t=[...e.ptr.out([Z.node])].map((t=>e.validator.shape(t))),async e=>{for(const r of t){const t=await r.validate(e.create({child:!0,focusNode:e.valueOrNode}));e.test(t.report.conforms,Z.NodeConstraintComponent,{args:{node:r.ptr.term},message:[e.factory.literal("Value does not have shape {$node}")],results:t.report.results,value:e.valueOrNode})}})};var t}],[Z.property,function(e){return{generic:(t=[...e.ptr.out([Z.property])].map((t=>e.validator.shape(t))),async e=>{const r=e.create({focusNode:e.valueOrNode});for(const e of t)await e.validate(r)})};var t}],[Z.qualifiedValueShape,function(e){const t=e.validator.shape(e.ptr.out([Z.qualifiedValueShape])),r=e.ptr.out([Z.qualifiedValueShapesDisjoint]).term,n=!!r&&(0,se.fromRdf)(r),i=e.ptr.out([Z.qualifiedMaxCount]).term,a=i?parseInt(i.value):null,o=e.ptr.out([Z.qualifiedMinCount]).term;return{property:me(t,n,a,o?parseInt(o.value):null)}}],[Z.languageIn,function(e){return{generic:(t=[...new Set([...e.ptr.out([Z.languageIn]).list()].map((e=>e.value)))],e=>{const r=t.some((t=>function(e,t){return!!t&&t.slice(0,e.length)===e}(t,e.valueOrNode.term.language)));e.test(r,Z.LanguageInConstraintComponent,{args:{languageIn:t.join(", ")},message:[e.factory.literal("Language does not match any of {$languageIn}")],value:e.valueOrNode})})};var t}],[Z.maxLength,function(e){return{generic:(t=parseInt(e.ptr.out([Z.maxLength]).value),e=>{const r="BlankNode"!==e.valueOrNode.term.termType&&e.valueOrNode.value.length<=t;e.test(r,Z.MaxLengthConstraintComponent,{args:{maxLength:t},message:[e.factory.literal("Value has more than {$maxLength} characters")],value:e.valueOrNode})})};var t}],[Z.minLength,function(e){return{generic:(t=parseInt(e.ptr.out([Z.minLength]).value),e=>{const r="BlankNode"!==e.valueOrNode.term.termType&&e.valueOrNode.value.length>=t;e.test(r,Z.MinLengthConstraintComponent,{args:{minLength:t},message:[e.factory.literal("Value has less than {$minLength} characters")],value:e.valueOrNode})})};var t}],[Z.pattern,function(e){const t=e.ptr.out([Z.pattern]).value,r=e.ptr.out([Z.flags]).value;return{generic:Ee(t,r,new RegExp(t,r))}}],[Z.uniqueLang,function(e){const t=e.ptr.out([Z.uniqueLang]).term;return"true"===t.value&&te.boolean.equals(t.datatype)?{property:e=>{const t=Object.entries(e.values.terms.reduce(((e,t)=>(t.language&&(e[t.language]=(e[t.language]||0)+1),e)),{})),r=t.filter((([,e])=>e>1));for(const[t]of r)e.violation(Z.UniqueLangConstraintComponent,{args:{lang:t},message:[e.factory.literal('Language "{?lang}" used more than once')]});0===r.length&&e.debug(Z.UniqueLangConstraintComponent)}}:null}],[Z.class,function(e){return{generic:(t=e.ptr.out([Z.class]).map((e=>Ct(e))),e=>{const r=new g(e.valueOrNode.out([W.type]).terms);for(const n of t){const t=[...r].some((e=>n.has(e)));e.test(t,Z.ClassConstraintComponent,{value:e.valueOrNode})}})};var t}],[Z.datatype,function(e){return{generic:(t=e.ptr.out([Z.datatype]).term,r=new Pt,e=>{const n=t.equals(e.valueOrNode.term.datatype)&&r.validateSimple(e.valueOrNode.term);e.test(n,Z.DatatypeConstraintComponent,{args:{datatype:t},message:[e.factory.literal("Value does not have datatype {$datatype}")],value:e.valueOrNode})})};var t,r}],[Z.nodeKind,function(e){const t=e.ptr.out([Z.nodeKind]).term;return{generic:kt(t,Lt.get(t))}}],[Z.sparql,function(e){const t=e.sparql.out([Z.select]).value,r=Se(e.sparql.out([Z.prefixes])),n=(i=e.path)?i.map((e=>{let t="";return"object"===e.start&&"subject"===e.end&&(t+="^"),t+=e.predicates.map((e=>`<${e.value}>`)).join("|"),"oneOrMore"===e.quantifier?t+="+":"zeroOrMore"===e.quantifier?t+="*":"zeroOrOne"===e.quantifier&&(t+="?"),t})).join("/"):null;var i;return{generic:Oe({message:e.sparql.out([Z.message]).terms,query:[...r,t].filter(Boolean).join("\n").split("$PATH").join(n),source:e.sparql.terms})}}]])),Ft=class{constructor(e){this.shape=e,this._compiled=re((()=>Mt.compile(e)))}get compiled(){return this._compiled()}async validate(e){return 0===e.focusNode.dataset.size||(this.shape.isPropertyShape?await this.validateProperty(e):await this.validateNode(e)),e}async validateNode(e){const t=e.create({shape:this.shape,valueOrNode:e.value||e.focusNode});for(const e of this.compiled)e.node&&await e.node(t),e.generic&&await e.generic(t)}async validateProperty(e){let t;t=this.shape.isSparqlShape?e.focusNode:e.focusNode.executeAll(this.shape.path);const r=t.node(new g(t.terms)),n=[...t].reduce(((e,r)=>{const n=r.term,i=t.node([n]);return e.has(n)||e.set(n,{value:i,valuePaths:[]}),e.get(n).valuePaths.push(r),e}),new u).values(),i=e.create({shape:this.shape,values:r});for(const e of this.compiled)e.property&&await e.property(i);for(const{value:t,valuePaths:r}of n){const n=e.create({shape:this.shape,value:t,valueOrNode:t,valuePaths:r});for(const e of this.compiled)e.generic&&await e.generic(n)}}},Bt=class{constructor(e){this.targetClass=new g([...Ct(e.hasOut([W.type],[Z.NodeShape])),...Ct(e.out([Z.targetClass]))]),this.targetNode=e.out([Z.targetNode]).terms,this.targetObjectsOf=e.out([Z.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([Z.targetSubjectsOf]).terms}resolve(e){const t=e.focusNode.node([null]),r=[...e.focusNode.hasOut([W.type],this.targetClass).ptrs,...e.focusNode.node(this.targetNode).ptrs,...t.execute({start:"object",end:"object",predicates:this.targetObjectsOf}).ptrs,...t.execute({start:"subject",end:"subject",predicates:this.targetSubjectsOf}).ptrs],n=e.focusNode.clone({ptrs:r});return n.node([...new g(n.terms)])}},Ut=class{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=re((()=>{const e=this.ptr.out([Z.deactivated]).term;return e&&(0,se.fromRdf)(e)})),this._message=re((()=>this.ptr.out([Z.message]).terms)),this._path=re((()=>ce(this.ptr.out([Z.path])))),this._severity=re((()=>this.ptr.out([Z.severity]).term)),this._shapeValidator=re((()=>new Ft(this))),this._sparql=re((()=>this.ptr.out([Z.sparql]))),this._targetResolver=re((()=>new Bt(this.ptr)))}get deactivated(){return this._deactivated()}get isPropertyShape(){return Boolean(this.path)}get isSparqlShape(){return this.sparql.terms.length>0}get path(){return this._path()}get targetResolver(){return this._targetResolver()}get message(){return this._message()}get severity(){return this._severity()}get shapeValidator(){return this._shapeValidator()}get sparql(){return this._sparql()}resolveTargets(e){return this.targetResolver.resolve(e)}async validate(e){return this.shapeValidator.validate(e)}},Vt=class{constructor(e,{factory:t,...r}){this.factory=t,this.options=r,this.shapesPtr=new X({dataset:e,factory:t}),this.shapes=new u,this.options.coverage&&(this.options.debug=!0,this.options.details=!0,this.options.trace=!0);const n=[...this.shapesPtr.hasOut([Z.targetClass]),...this.shapesPtr.hasOut([Z.targetNode]),...this.shapesPtr.hasOut([Z.targetObjectsOf]),...this.shapesPtr.hasOut([Z.targetSubjectsOf]),...this.shapesPtr.hasOut([W.type],[Z.NodeShape]),...this.shapesPtr.hasOut([W.type],[Z.PropertyShape])];for(const e of n)this.shape(e)}shape(e){if(!e.term)return null;let t=this.shapes.get(e.term);return t||(t=new Ut(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const r=new X({...e,factory:this.factory}),n=new oe({factory:this.factory,focusNode:r,options:this.options,validator:this});t=t?t.map((e=>this.shape(this.shapesPtr.node(e.terms)))):this.shapes.values();for(const e of t){const t=n.create({shape:e});let i;i=r.isAny()?e.resolveTargets(t):r;for(const r of i)await e.validate(t.create({focusNode:r}))}return n.report}};class qt{constructor(e,{bind:t=!1}={}){this._factories=e.slice();for(const e of this._factories){"function"==typeof e.prototype.init&&e.prototype.init.call(this);for(const r of e.exports||[])this[r]=t?e.prototype[r].bind(this):e.prototype[r]}}clone(){const e=new qt(this._factories);for(const t of e._factories)"function"==typeof t.prototype.clone&&t.prototype.clone.call(e,this);return e}}const $t=qt;var Qt=r(83141);const Gt=async function(e,t){const r=new Qt.StringDecoder(t);let n="";for await(const t of e)n+=r.write(t);return n+=r.end(),n},zt=async function(e,t,r){const n="PUT"===t.method?"write":"read",i="read"===n?"from":"to";if(!r.ok)throw new Error(`can't ${n} data ${i} <${e.toString()}>[${r.status}]: ${await r.text()}`)},Ht=new Map([["json","application/ld+json"],["n3","text/n3"],["nq","application/n-quads"],["nt","application/n-triples"],["rdf","application/rdf+xml"],["trig","application/trig"],["ttl","text/turtle"]]),Xt=function(e,t){const r=new Headers,n=e.toString().match(/\.([a-z]+)$/),i=Ht.get(n&&n[1]);return i&&r.set("content-type",i),{method:"PUT",headers:r,body:t}},Jt=new Set(["_write","_writableState","writable"]),Kt=function(e){return new Proxy(e,{has(e,t){return!Jt.has(t)&&Reflect.has(...arguments)},get(e,t){if(Jt.has(t))return;const r=Reflect.get(...arguments);return r&&"function"==typeof r.bind?r.bind(e):r},set(e,t,r){if(!Jt.has(t))return Reflect.set(...arguments)}})};class Wt{namespace(e){return k(e,{factory:this})}}Wt.exports=["namespace"];const Yt=Wt;class Zt extends Map{constructor(e=[],{factory:t}){super(e),this.factory=t}resolve(e){if(e.value.includes("://"))return null;const[t,r]=e.value.split(":",2);return void 0===r?null:this.has(t)?this.factory.namedNode(`${this.get(t).value}${r}`):null}shrink(e){if(!e)return null;const[t]=[...this].filter((([,t])=>e.value.startsWith(t.value))).sort(((e,t)=>t[1].value.length-e[1].value.length));return void 0===t?null:this.factory.namedNode(`${t[0]}:${e.value.slice(t[1].value.length)}`)}import(e){return e.on("prefix",((e,t)=>{this.set(e,t)})),new Promise(((t,r)=>{(0,_e.finished)(e,(e=>{e?r(e):t(this)}))}))}export(e){for(const[t,r]of this)e.emit("prefix",t,r);return this}}const er=Zt;class tr{init(){this.prefixes=new er([],{factory:this})}clone(e){if(e.prefixes)for(const[t,r]of e.prefixes)this.prefixes.set(t,r)}prefixMap(e){return new er(e,{factory:this})}}tr.exports=["prefixMap"];const rr=tr,nr=function({factor:e,score:t}){return({dataset:r,graph:n,terms:i=[]})=>t({dataset:r,graph:n,terms:i}).map((t=>(t.score*=e,t)))},ir=function(e){return"<"+e.value+">"},ar=/["\\\\\n\r]/,or=/["\\\\\n\r]/g,sr={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function ur(e){return sr[e]}const cr=function e(t){if(!t)return null;if("BlankNode"===t.termType)return"_:"+t.value;if("DefaultGraph"===t.termType)return"";if("Literal"===t.termType)return function(e){const t=(r=e.value,ar.test(r)?r.replace(or,ur):r);var r;return"http://www.w3.org/2001/XMLSchema#string"===e.datatype.value?'"'+t+'"':"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"===e.datatype.value?'"'+t+'"@'+e.language:'"'+t+'"^^'+ir(e.datatype)}(t);if("NamedNode"===t.termType)return ir(t);if("Quad"===t.termType||t.subject&&t.predicate&&t.object&&t.graph)return function(e,t){const r=t(e.subject),n=t(e.predicate),i=t(e.object),a=t(e.graph);return`${r} ${n} ${i} ${a?a+" ":""}.`}(t,e);if("Variable"===t.termType)return"?"+t.value;if(t[Symbol.iterator])return function(e,t){return[...e].map((e=>t(e))).join("\n")+"\n"}(t,e);throw new Error(`unknown termType ${t.termType}`)};class lr extends Set{constructor(e=[]){super(),this._index=new Map;for(const t of e)this.add(t)}add(e){return this._index.set(lr.key(e),e),super.add(e)}delete(e){const t=this._index.get(lr.key(e));return super.delete(t)}has(e){return this._index.has(lr.key(e))}static key(e){return e.map((e=>e&&cr(e)||"undefined")).join(" ")}}const dr=lr;class hr extends Map{constructor(e=[]){super(),this._keys=new Map;for(const[t,r]of e)this.set(t,r)}delete(e){const t=hr.key(e);return this._keys.delete(t),super.delete(t)}get(e){return super.get(hr.key(e))}has(e){return super.has(hr.key(e))}keys(){return new dr(this._keys.values())}set(e,t){const r=hr.key(e);return this._keys.set(r,e),super.set(r,t)}static key(e){return e.map((e=>e&&cr(e)||"undefined")).join(" ")}}const pr=hr,fr=function(e){return({dataset:t,graph:r,terms:n=[]})=>{const i=new pr;for(let a=0;anr({factor:t,score:e}))))}yr.prioritized=function(e){const t=2/(e.length*(e.length+1)),r=e.map(((r,n)=>{const i=(e.length-n)*t;return nr({factor:i,score:r})}));return fr(r)};const gr=yr,mr=function(e){return({dataset:t,graph:r,terms:n=[]})=>e.flatMap((e=>e({dataset:t,graph:r,terms:n})))},br=function({graph:e,object:t,predicate:r,subject:n=!0}={}){const i={subject:n,predicate:r,object:t,graph:e};return({dataset:e,graph:t,terms:r=[]})=>{const n=new u;let a=0;const o=i=>{for(const o of r){const r=["subject"===i&&o,"predicate"===i&&o,"object"===i&&o,t||"graph"===i&&o],s=e.match(...r);for(const e of s){const t=e[i],r=n.get(t)||{count:0};n.has(t)||n.set(t,r),r.count++,a++}}};for(const e of["subject","predicate","object","graph"])i[e]&&o(e);const s=[];for(const[r,i]of n)s.push({dataset:e,graph:t,term:r,score:i.count/a});return s}},vr=function(e){const t=new pr;for(const r of e){const e=t.get([r.term,r.graph]);e?e.score{for(const n of r){const r=[{dataset:e,graph:t,term:n,score:1}];if(i.subject&&i.subject.equals(n)&&e.match(n,null,null,t).size>0)return r;if(i.predicate&&i.predicate.equals(n)&&e.match(null,n,null,t).size>0)return r;if(i.object&&i.object.equals(n)&&e.match(null,null,n,t).size>0)return r;if(i.graph&&i.graph.equals(n)&&(!t||i.graph.equals(t))&&e.match(null,null,null,t).size>0)return r}return[]}},wr=function(e){return({dataset:t,graph:r,terms:n=[]})=>{for(const i of e){const e=i({dataset:t,graph:r,terms:n});if(e.length>0)return e}return[]}},Tr=function(e){const t=e;return({dataset:e,graph:r,terms:n=[]})=>{for(const i of n)if(i.equals(t))return[{dataset:e,graph:r,term:i,score:1}];return[]}},Sr=function(e){const t=new Map;let r;for(const[n,i]of Object.entries(e)){const a=1-n/e.length;"*"===i?r=a:t.set(i,a)}return({dataset:e,graph:n,terms:i=[]})=>{const a=[];for(const o of i){let i=t.get(o.language);void 0===i&&"string"==typeof o.language&&r&&(i=r),void 0!==i&&a.push({dataset:e,graph:n,term:o,score:i})}return a}},Or=function({alpha:e=.85,epsilon:t=1e-6}={}){return({dataset:r,graph:n,terms:i})=>{i=new g(i);const a=new u,o=1/i.size;let s=1;for(const e of i){const t=r.match(null,null,e,n);a.set(e,{weight:o,outbound:t.size,subjects:[...t].map((e=>e.subject)).filter((e=>i.has(e)))})}for(;s>t;){const t=new u;let r=0;for(const[e,n]of a)t.set(e,n.weight),0===n.outbound&&(r+=n.weight),n.weight=0;r*=e;for(const[n,i]of a){for(const r of i.subjects)a.get(r).weight+=e*t.get(n)/i.outbound;i.weight+=(1-e)*o+r*o}s=0;for(const[e,r]of a)s+=Math.abs(r.weight-t.get(e))}const c=[];for(const[e,t]of a)c.push({dataset:r,graph:n,term:e,score:t.weight});return c}},Er=function(){return({dataset:e,graph:t,terms:r=[]})=>{const n=[];for(const i of r){let r=Number.EPSILON;if("NamedNode"===i.termType){let e=new URL(i.value).pathname;e.endsWith("/")&&(e=e.slice(0,-1)),r=1/e.split("/").length}n.push({dataset:e,graph:t,term:i,score:r})}return n}},xr=function(e){return({dataset:t,graph:r,terms:n=[]})=>{const i=[],a=2/(e.length*(e.length+1));for(let o=0;o{if(0===e.length)return[];const i=e[0]({dataset:t,graph:r,terms:n}),a=new pr(i.map((e=>[[e.term,r],e])));for(let i=1;i{const r=t.score-e.score;return 0!==r?r:e.term.value.localeCompare(t.term.value)}))},Ir=function({dataset:e,objects:t,score:r,termCallback:n=(e=>e.term)}={}){const i=new u(t.map((e=>[n(e),e]))),a=t.map((e=>n(e)));return Rr(vr(r({dataset:e,terms:a}))).map((({term:e})=>i.get(e)))},Nr=function(e){const t={rdf:{type:C.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")}};return({dataset:r,graph:n,terms:i=[]})=>{const a=[];for(const o of i)for(const i of r.match(o,t.rdf.type,e,n))a.push({dataset:r,graph:i.graph,term:o,score:1});return a}};class jr{termMap(e){return new u(e)}}jr.exports=["termMap"];const Dr=jr;class Pr{termSet(e){return new g(e)}}Pr.exports=["termSet"];const Cr=Pr;class Lr{constructor(){this.quadLevel=new Map}add(e,t){this.quadLevel.set(o(e),t)}has(e,t){const r=this.quadLevel.get(o(e));return void 0!==r&&r<=t}}function kr({backward:e,callback:t,dataset:r,filter:n,forward:i,term:a,visited:o=new Lr}){const s=(a,u)=>{const c=a=>{for(const c of a){if(o.has(c,u))continue;o.add(c,u);const a={dataset:r,level:u,quad:c};n(a)&&(t(a),i&&s(c.object,u+1),e&&s(c.subject,u+1))}};i&&c(r.match(a)),e&&c(r.match(null,null,a))};s(a,0)}const Mr=class{constructor(e,{backward:t=!1,factory:r,forward:n=!0}){this.backward=t,this.factory=r,this.filter=e,this.forward=n}forEach({term:e,dataset:t},r){kr({backward:this.backward,callback:r,dataset:t,filter:this.filter,forward:this.forward,term:e})}match({term:e,dataset:t}){const r=this.factory.dataset();return kr({backward:this.backward,callback:({quad:e})=>r.add(e),dataset:t,filter:this.filter,forward:this.forward,term:e}),r}reduce({term:e,dataset:t},r,n){let i=n;return kr({backward:this.backward,callback:e=>{i=r(e,i)},dataset:t,filter:this.filter,forward:this.forward,term:e}),i}};class Fr{traverser(e,{backward:t=!1,forward:r=!0}={}){return new Mr(e,{backward:t,factory:this,forward:r})}}Fr.exports=["traverser"];const Br=Fr;class Ur{grapoi({...e}={}){return e.dataset||"function"!=typeof this.dataset||(e.dataset=this.dataset()),function(e){return new J(e)}({...e,factory:this})}}Ur.exports=["grapoi"];const Vr=Ur,qr=class extends v{toCanonical(){return o(this)}toString(){return this.toCanonical()}},$r=class extends w{toCanonical(){return o(this)}toString(){return this.toCanonical()}},Qr=class extends O{toCanonical(){return o(this)}toString(){return this.value}},Gr=class extends x{toCanonical(){return o(this)}toString(){return this.value}toURL(){return new URL(this.value)}},zr=class extends R{toCanonical(){return o(this)}toString(){return this.toCanonical()}},Hr=class extends N{toCanonical(){return o(this)}toString(){return this.toCanonical()}},Xr=new Gr("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),Jr=new Gr("http://www.w3.org/2001/XMLSchema#string");class Kr{init(){this._data={blankNodeCounter:0,defaultGraph:new $r}}namedNode(e){return"string"!=typeof e&&(e=e.toString()),new Gr(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new qr(e)}literal(e,t){return"string"==typeof t?new Qr(e,t,Xr):new Qr(e,"",t||Jr)}variable(e){return new Hr(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,r,n=this.defaultGraph()){return new zr(e,t,r,n)}fromTerm(e){return T(this,e)}fromQuad(e){return T(this,e)}}Kr.exports=["namedNode","blankNode","literal","variable","defaultGraph","quad","fromTerm","fromQuad"];const Wr=Kr;function Yr(e){return"string"==typeof e||e instanceof String}function Zr(e){if("string"==typeof e)return e;if(!e)return"";if(void 0!==e.id&&"Quad"!==e.termType)return e.id;let t,r,n,i;switch(e.termType){case"NamedNode":return e.value;case"BlankNode":return`_:${e.value}`;case"Variable":return`?${e.value}`;case"DefaultGraph":return"";case"Literal":return e.language?`"${e.value}"@${e.language}`:`"${e.value}"${e.datatype&&"http://www.w3.org/2001/XMLSchema#string"!==e.datatype.value?`^^${e.datatype.value}`:""}`;case"Quad":return t=tn(Zr(e.subject)),r=tn(Zr(e.predicate)),n=tn(Zr(e.object)),i="DefaultGraph"===e.graph.termType?"":` ${Zr(e.graph)}`,`<<${t} ${r} ${n}${i}>>`;default:throw new Error(`Unexpected termType: ${e.termType}`)}}const en=/^"(.*".*)(?="[^"]*$)/;function tn(e){return e.replace(en,((e,t)=>`"${t.replace(/"/g,'""')}`))}class rn{constructor(e){if(this._size=0,this._graphs=Object.create(null),this._id=0,this._ids=Object.create(null),this._ids["><"]=0,this._entities=Object.create(null),this._quads=new Map,e)for(const t of e)this.add(t)}get size(){let e=this._size;if(null!==e)return e;e=0;const t=this._graphs;let r,n;for(const i in t)for(const a in r=t[i].subjects)for(const t in n=r[a])e+=Object.keys(n[t]).length;return this._size=e,this._size}add(e){let t=Zr(e.subject),r=Zr(e.predicate),n=Zr(e.object);const i=Zr(e.graph);let a=this._graphs[i];a||(a=this._graphs[i]={subjects:{},predicates:{},objects:{}},Object.freeze(a));const o=this._ids,s=this._entities;return t=o[t]||(o[s[++this._id]=t]=this._id),r=o[r]||(o[s[++this._id]=r]=this._id),n=o[n]||(o[s[++this._id]=n]=this._id),this._addToIndex(a.subjects,t,r,n),this._addToIndex(a.predicates,r,n,t),this._addToIndex(a.objects,n,t,r),this._setQuad(t,r,n,i,e),this._size=null,this}delete(e){let t=Zr(e.subject),r=Zr(e.predicate),n=Zr(e.object);const i=Zr(e.graph),a=this._ids,o=this._graphs;let s,u,c;if(!((t=a[t])&&(r=a[r])&&(n=a[n])&&(s=o[i])&&(u=s.subjects[t])&&(c=u[r])&&n in c))return this;for(t in this._removeFromIndex(s.subjects,t,r,n),this._removeFromIndex(s.predicates,r,n,t),this._removeFromIndex(s.objects,n,t,r),null!==this._size&&this._size--,this._deleteQuad(t,r,n,i),s.subjects)return this;return delete o[i],this}has(e){const t=Zr(e.subject),r=Zr(e.predicate),n=Zr(e.object),i=Zr(e.graph),a=this._graphs[i];if(!a)return!1;const o=this._ids;let s,u,c;return!(Yr(t)&&!(s=o[t])||Yr(r)&&!(u=o[r])||Yr(n)&&!(c=o[n]))&&1===this._countInIndex(a.objects,c,s,u)}match(e,t,r,n){return this._createDataset(this._match(e,t,r,n))}[Symbol.iterator](){return this._match()[Symbol.iterator]()}_addToIndex(e,t,r,n){const i=e[t]||(e[t]={}),a=i[r]||(i[r]={}),o=n in a;return o||(a[n]=null),!o}_removeFromIndex(e,t,r,n){const i=e[t],a=i[r];delete a[n];for(const e in a)return;delete i[r];for(const e in i)return;delete e[t]}_findInIndex(e,t,r,n,i,a,o,s,u,c){let l,d,h;t&&((l=e,e={})[t]=l[t]);for(const t in e)if(d=e[t],d){r&&((l=d,d={})[r]=l[r]);for(const e in d)if(h=d[e],h){const r=n?n in h?[n]:[]:Object.keys(h);for(let n=0;nfunction(e){return{subject:on(e.subject),predicate:on(e.predicate),object:on(e.object),graph:on(e.graph)}}(e)))}(e))};function un(e,t){return new e.constructor(t)}const cn=class extends nn{addAll(e){for(const t of e)this.add(t);return this}clone(){return un(this,this)}deleteMatches(e,t,r,n){for(const i of this.match(e,t,r,n))this.delete(i);return this}difference(e){return this.filter((t=>!e.has(t)))}equals(e){return this.toCanonical()===e.toCanonical()}every(e){return Array.from(this).every((t=>e(t,this)))}filter(e){return un(this,Array.from(this).filter((t=>e(t,this))))}forEach(e){Array.from(this).forEach((t=>e(t,this)))}import(e){return e.on("data",(e=>this.add(e))),new Promise(((t,r)=>{(0,_e.finished)(e,(e=>{e?r(e):t(this)}))}))}intersection(e){return this.filter((t=>e.has(t)))}map(e){return un(this,Array.from(this).map((t=>e(t,this))))}merge(e){return this.clone().addAll(e)}reduce(e,t){return Array.from(this).reduce(((t,r,n)=>e(t,r,n,this)),t)}some(e){return Array.from(this).some((t=>e(t,this)))}toCanonical(){return sn(this)}toStream(){return _e.Readable.from(this)}toString(){return o(this)}};class ln{dataset(e,t){const r=new cn;if(e)if(t)for(const n of e)r.add(this.quad(n.subject,n.predicate,n.object,t));else r.addAll(e);return r}}ln.exports=["dataset"];const dn=ln,hn=async function(e={}){if(!e.body||!e.body.readable)return e;const t=await async function(e){const t=[];for await(const r of e)t.push(r);return t}(e.body);return t.length>0?1===t[0].BYTES_PER_ELEMENT?e.body=function(e){const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}(t):e.body=t.join(""):e.body="",e};class pn{constructor(e,t){this.obj=e;for(const[e,r]of Object.entries(t))this[e]=r;for(const t of pn.properties(e))t in this||("function"==typeof this.obj[t]?this[t]=(...r)=>this.obj[t].call(e,r):Object.defineProperty(this,t,{get:()=>this.obj[t],set:e=>{this.obj[t]=e},enumerable:!0,configurable:!0}))}static properties(e){return Object.getOwnPropertyNames(Object.getPrototypeOf(e))}}const fn=pn,yn=function(e){if(e.bodyUsed){const t=new _e.Readable({read:()=>t.destroy(new Error("body already in use"))});return e.body=t,e}return e.body&&e.body.readable?e:e.body&&"function"==typeof e.body.getReader?new fn(e,{body:(r=e.body.getReader(),new _e.Readable({read:async function(){try{let e,t;do{e=await r.read(),e.done?this.push(null):t=!this.push(e.value)}while(!e.done&&!t)}catch(e){this.destroy(e)}}}))}):(e.body=(t=()=>e.arrayBuffer(),new _e.Readable({read:re((async function(){try{this.push(new Uint8Array(await t())),this.push(null)}catch(e){this.destroy(e)}}))})),e);var t,r},gn=window.Headers;function mn(e,t){return hn(t).then((t=>fetch(e,t).then((e=>yn(e)))))}const bn=/<(.*)>/,vn=function(e,t,r){e.quadStream=async()=>{if(!e.headers.get("content-type"))throw new Error("Content-Type header missing: couldn't determine parser");let n=e.headers.get("content-type").split(";")[0];const i=function(e,t){if("application/json"!==t)return null;if(!e.headers.has("link"))return null;const r=e.headers.get("link").split(",").map((e=>e.trim())).find((e=>e.includes('rel="http://www.w3.org/ns/json-ld#context"')));if(!r)return null;const n=(bn.exec(r)||[]).slice(-1)[0];return n?new URL(n,e.url).toString():null}(e,n);if(i&&(n="application/ld+json"),!r.has(n))return Promise.reject(new Error(`unknown content type: ${n}`));let a;return i&&(a=await t(i).then((e=>e.json()))),r.import(n,e.body,{baseIRI:e.url,context:a})}};function _n(e){const t=function(t,r={}){return async function(e,t={}){const r=t.factory,n=t.fetch||mn,i=t.formats;if(!i)throw new Error("no formats given");t=function(e,t){if(e.headers=new gn(e.headers),e.headers.has("accept")||e.headers.set("accept",[...t.parsers.keys()].join(", ")),!e.body)return e;if("string"==typeof e.body)return e;let r=e.headers.get("content-type");if(r&&!t.serializers.has(r))throw new Error(`no serializer found for media type: ${e.headers.get("content-type")}`);return r||(r=t.serializers.keys().next().value,e.headers.set("content-type",r)),!(function(e){return null!==e&&"object"==typeof e&&"function"==typeof e.pipe}(n=e.body)&&!1!==n.readable&&"function"==typeof n._read&&"object"==typeof n._readableState)&&e.body[Symbol.iterator]&&(e.body=_e.Readable.from(e.body)),e.body=t.serializers.import(r,e.body),e;var n}(t,i);return function(e,t,r,n){const i=[...e.headers.keys()].some((e=>e.startsWith("content-"))),a="chunked"===e.headers.get("transfer-encoding");return(i||a)&&(vn(e,r,n),t&&function(e,t){e.dataset=async()=>{const r=await e.quadStream();return async function(e,t){for await(const r of t)e.add(r);return e}(t.dataset(),r)}}(e,t)),e}(await n(e,t),r,n,i.parsers)}(t,{...r,factory:"function"==typeof e.dataset?e:null,fetch:e._fetch.fetch,formats:e.formats})};return t.config=function(t,r){e._fetch[t]=r},t.Headers=gn,t}const wn=class{init(){this._fetch={fetch:null},this.fetch=_n(this)}clone(e){for(const[t,r]of Object.entries(e._fetch))this._fetch[t]=r}},Tn=mn,Sn=class{constructor(e,t){this.Impl=e,this.options=t}import(e,t){const r=new this.Impl(e,{...this.options,...t});return e.on("end",(()=>{r.readable||r.emit("end")})),e.on("error",(e=>{r.emit("error",e)})),r}};var On=r(38690);const En="null:";const xn=class{constructor(e,{baseIRI:t=En,context:r=null,documentLoader:n,factory:i=C}={}){const a=new On.JsonLdParser({baseIRI:t,context:r,dataFactory:i,documentLoader:n,streamingProfile:!1});e.pipe(a);const o=function(e){const t=function(e){return t=>"NamedNode"!==t.termType?null:t.value.startsWith(En)?e.namedNode(t.value.slice(5)):null}(e);return r=>{const n=t(r.subject),i=t(r.predicate),a=t(r.object),o=t(r.graph);return n||i||a||o?e.quad(n||r.subject,i||r.predicate,a||r.object,o||r.graph):r}}(i),s=new _e.Transform({objectMode:!0,transform:(e,t,r)=>{r(null,o(e))}});return a.on("context",(e=>{Object.entries(e).forEach((([e,t])=>{s.emit("prefix",e,i.namedNode(t))}))})),a.on("error",(e=>s.destroy(e))),a.pipe(s),Kt(s)}};var An=r(66731);const Rn=class{constructor(e,{baseIRI:t="",factory:r=C,...n}={}){const i={blankNode:r.blankNode.bind(r),defaultGraph:r.defaultGraph.bind(r),literal:r.literal.bind(r),namedNode:r.namedNode.bind(r),quad:r.quad.bind(r)},a=new An.A({baseIRI:t,factory:i,...n});return e.pipe(a),Kt(a)}},In=class extends Sn{constructor(e){super(Rn,e)}},Nn=function(e){return"<"+e.value+">"},jn=/["\\\\\n\r]/,Dn=/["\\\\\n\r]/g,Pn={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function Cn(e){return Pn[e]}const Ln=function e(t){if(!t)return null;if("BlankNode"===t.termType)return"_:"+t.value;var r,n;if("DefaultGraph"===t.termType)return"";if("Literal"===t.termType)return function(e){const t=(r=e.value,jn.test(r)?r.replace(Dn,Cn):r);var r;return"http://www.w3.org/2001/XMLSchema#string"===e.datatype.value?'"'+t+'"':"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"===e.datatype.value?'"'+t+'"@'+e.language:'"'+t+'"^^'+Nn(e.datatype)}(t);if("NamedNode"===t.termType)return Nn(t);if("Quad"===t.termType||t.subject&&t.predicate&&t.object&&t.graph)return function(e,t){const r=t(e.subject),n=t(e.predicate),i=t(e.object),a=t(e.graph);return`${r} ${n} ${i} ${a?a+" ":""}.`}(t,e);if("Variable"===t.termType)return"?"+t.value;if(t[Symbol.iterator])return r=t,n=e,[...r].map((e=>n(e))).join("\n")+"\n";throw new Error(`unknown termType ${t.termType}`)},kn=class{constructor(e){const t=new _e.Transform({objectMode:!0,transform:(e,t,r)=>{r(null,`${Ln(e)}\n`)}});return e.pipe(t),Kt(t)}},Mn=class extends Sn{constructor(){super(kn)}};k("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),k(" http://www.w3.org/1999/02/22-rdf-syntax-ns#"),k("http://www.w3.org/2001/XMLSchema#"),_e.Readable;class Fn extends Map{import(e,t,r){const n=this.get(e);return n?n.import(t,r):null}}const Bn=Fn,Un=class{constructor(e){this.stream=e,this.array=[]}push(e){this.array.push(e)}end(){this.stream.push(this.array),this.stream.push(null)}},Vn=class{constructor(e){this.stream=e,this.first=!0,this.stream.push("[")}push(e){this.first?this.first=!1:this.stream.push(","),this.stream.push(JSON.stringify(e))}end(){this.stream.push("]"),this.stream.push(null)}};class qn extends _e.Readable{constructor(e,{encoding:t="object"}={}){if(super({objectMode:!0,read:()=>{}}),"object"===t&&(this.encoder=new Un(this)),"string"===t&&(this.encoder=new Vn(this)),!this.encoder)throw new Error(`unknown encoding: ${t}`);e.on("data",(e=>{const t={};let r=t;"DefaultGraph"!==e.graph.termType&&(t["@id"]=e.graph.value,t["@graph"]={},r=t["@graph"]),r["@id"]=qn.subjectValue(e.subject),"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"===e.predicate.value?r["@type"]=qn.subjectValue(e.object):r[e.predicate.value]=qn.objectValue(e.object),this.encoder.push(t)})),e.on("end",(()=>this.encoder.end())),e.on("error",(e=>this.emit("error",e)))}static subjectValue(e){return"BlankNode"===e.termType?"_:"+e.value:e.value}static objectValue(e){return"NamedNode"===e.termType?{"@id":e.value}:"BlankNode"===e.termType?{"@id":"_:"+e.value}:e.language?{"@language":e.language,"@value":e.value}:e.datatype&&"http://www.w3.org/2001/XMLSchema#string"!==e.datatype.value?{"@type":e.datatype.value,"@value":e.value}:e.value}}const $n=qn,Qn=class extends Sn{constructor(e){super($n,e)}};r(34841),_e.Readable;var Gn=r(75611);class zn extends Gn.RdfXmlParser{constructor({factory:e,...t}={}){super({...t,dataFactory:e})}}const Hn=zn,Xn={parsers:new Bn([["application/ld+json",new class extends Sn{constructor(e){super(xn,e)}}],["application/trig",new In],["application/n-quads",new In],["application/n-triples",new In],["text/n3",new In],["text/turtle",new In],["application/rdf+xml",new Hn]]),serializers:new Bn([["application/ld+json",new class extends Qn{constructor({...e}={}){super({...e,encoding:"string"})}}],["application/n-quads",new Mn],["application/n-triples",new Mn],["text/n3",new Mn],["text/turtle",new Mn]])},Jn=class{constructor({factory:e}){this.factory=e,this.parsers=new Bn,this.serializers=new Bn}import(e){if(e.parsers)for(const[t,r]of e.parsers)this.parsers.set(t,new r.constructor({factory:this.factory}));if(e.serializers)for(const[t,r]of e.serializers)this.serializers.set(t,new r.constructor({factory:this.factory}));return this}},Kn=class{init(){this.formats=new Jn({factory:this})}clone(e){this.formats.import(e.formats)}},Wn=new $t([Wr,dn,class extends wn{init(){super.init(),this.fetch.config("fetch",Tn)}},class extends Kn{init(){super.init(),this.formats.import(Xn)}},Vr,class{init(){this.io={dataset:{fromText:(e,t,r)=>async function(e,t,{factory:r,...n}){const i=r.formats.parsers.get(e);if(!i)throw new Error(`unknown media type: ${e}`);const a=r.dataset(),o=i.import(_e.Readable.from([t]),n);for await(const e of o)a.add(e);return a}(e,t,{...r,factory:this}),fromURL:(e,t)=>async function(e,{factory:t,...r}){const n=await t.fetch(e,{...r,method:"GET"});return await zt(e,{},n),n.dataset()}(e,{...t,factory:this}),toText:(e,t,r)=>async function(e,t,{factory:r,...n}){const i=r.formats.serializers.get(e);if(!i)throw new Error(`unknown media type: ${e}`);const a=i.import(_e.Readable.from(t),n);return Gt(a,"utf-8")}(e,t,{...r,factory:this}),toURL:(e,t,r)=>async function(e,t,{factory:r,...n}){const i=Xt(e,_e.Readable.from(t)),a=await r.fetch(e,{...n,...i});await zt(e,i,a)}(e,t,{...r,factory:this})},stream:{fromText:(e,t,r)=>function(e,t,{factory:r,...n}){const i=r.formats.parsers.get(e);return i?i.import(_e.Readable.from([t]),n):new _e.Readable({read(){this.destroy(new Error(`unknown media type: ${e}`))}})}(e,t,{...r,factory:this}),fromURL:(e,t)=>function(e,{factory:t,...r}){const n=new _e.PassThrough({objectMode:!0});return setTimeout((async()=>{try{const i=await t.fetch(e,{...r,method:"GET"});await zt(e,{},i),(await i.quadStream()).on("error",(e=>n.destroy(e))).pipe(n)}catch(e){n.destroy(e)}}),0),Kt(n)}(e,{...t,factory:this}),toText:(e,t,r)=>async function(e,t,{factory:r,...n}){const i=r.formats.serializers.get(e);if(!i)throw new Error(`unknown media type: ${e}`);const a=i.import(t,n);return Gt(a,"utf-8")}(e,t,{...r,factory:this}),toURL:(e,t,r)=>async function(e,t,{factory:r,...n}){const i=Xt(e,t),a=await r.fetch(e,{...n,...i});await zt(e,i,a)}(e,{...r,factory:this})}}}},Yt,rr,class{init(){this.score={combine:gr,concat:mr,count:br,distinct:vr,exists:_r,fallback:wr,fixed:Tr,language:Sr,pageRank:Or,pathDepth:Er,prioritized:xr,product:Ar,scale:nr,sort:Rr,sortObjects:Ir,sum:fr,type:Nr}}},Dr,Cr,Br],{bind:!0}),{namedNode:Yn,literal:Zn}=t.Ay;async function ei(e){let t=new n.A;for(let r of e)await ri(r,t);return t}function ti(e){return ri(e,new n.A)}function ri(e,t){return new Promise(((r,n)=>{(new i.A).parse(e,((e,i,a)=>{e&&(console.error(e),n(e)),i?t.add(i):r(t)}))}))}function ni(e){const t=ii();e.forEach((e=>t.addQuad(e))),t.end(((e,t)=>console.log(t)))}function ii(){return new a.A({prefixes:{sh:"http://www.w3.org/ns/shacl#",ff:"https://foerderfunke.org/default#",foaf:"http://xmlns.com/foaf/0.1/"}})}async function ai(e){let t=Wn.dataset(e.getQuads()),r=new Vt(t,{factory:Wn,debug:!1});return await r.validate({dataset:t})}async function oi(e,t){const r=new ve.QueryEngine;let n=await r.queryBindings(e,{sources:[t]}),i=await n.toArray(),a=[];return i.forEach((e=>{const t=Array.from(e.keys()).map((({value:e})=>e));let r={};t.forEach((t=>{r[t]=e.get(t).value})),a.push(r)})),a}async function si(e,t){const r=new ve.QueryEngine;let n=await r.queryQuads(e,{sources:[t]});return await n.toArray()}async function ui(e,t){const r=new ve.QueryEngine;return await r.queryVoid(e,{sources:[t]})}async function ci(e){let t=await ti(e);return(await oi("\n PREFIX ff: \n SELECT * WHERE {\n ?rpUri a ff:RequirementProfile .\n }",t))[0].rpUri}const li=Yn("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");function di(e,t){if(!e["@id"]||!e["@type"])return void console.log("JSON node must have @id and @type, skipping it: "+JSON.stringify(e));let r=Yn(pi(e["@id"])),n=Yn(pi(e["@type"]));t.addQuad(r,li,n);for(let[n,i]of Object.entries(e))if(!n.startsWith("@"))if(n=Yn(pi(n)),Array.isArray(i))for(let e of i)e["@id"]?(t.addQuad(r,n,Yn(pi(e["@id"]))),di(e,t)):console.log("JSON array element must have @id, skipping it: "+JSON.stringify(e));else t.addQuad(r,n,fi(i))}async function hi(e){const t=new a.A({prefixes:{xsd:"http://www.w3.org/2001/XMLSchema#",ff:"https://foerderfunke.org/default#"}});return di(e,t),new Promise(((e,r)=>{t.end(((t,n)=>{t?r(t):e(n)}))}))}function pi(e){return e.startsWith("ff:")?"https://foerderfunke.org/default#"+e.slice(3):e}function fi(e){if("boolean"==typeof e)return Zn(e);if("true"===(e=e.toString()).toLowerCase())return Zn(!0);if("false"===e.toLowerCase())return Zn(!1);if(e.startsWith("http"))return Yn(e);if(e.startsWith("ff:"))return Yn("https://foerderfunke.org/default#"+e.slice(3));if(/^\d{4}-\d{2}-\d{2}$/.test(e))return Zn(e,{value:"xsd:date"});const t=Number(e);return isNaN(t)?Zn(e):Zn(t)}function yi(e){return{s:e.subject.value,p:e.predicate.value,o:e.object.value}}const gi={ELIGIBLE:"eligible",INELIGIBLE:"ineligible",UNDETERMINABLE:"undeterminable"};async function mi(e,t,r=!1){let i=new n.A;if(await ri(e,i),!await async function(e,t){const r=new ve.QueryEngine;return await r.queryBoolean("\n PREFIX ff: \n ASK { ff:mainPerson a ff:Citizen . }\n ",{sources:[t]})}(0,i))return"User profile does not contain the base triple of <>";await ri(t,i);let a=await ai(i);return r&&ni(a.dataset),{conforms:a.conforms,violations:vi(a,!1)}}async function bi(e,t,r,i,a=!1){let o=new n.A;await ri(e,o),await ri(t,o),await ri(i,o),await ri(r,o);let s=await ai(o);a&&(console.log("First validation report:"),ni(s.dataset));let u=vi(s,!0);if(u.length>0)return{result:gi.INELIGIBLE,violations:u,missingUserInput:[],materializationReport:{}};let c={};for(let e of s.results){const t=e.constraintComponent.value.split("#")[1];if("MinCountConstraintComponent"===t||"QualifiedMinCountConstraintComponent"===t){let t=e.path[0].predicates[0].id,r=e.focusNode.value,n=e.message[0].value;c[r+"_"+t]={subject:r,dfUri:t,optional:n.toLowerCase().includes("[optional]")}}}let l=await oi("\n PREFIX ff: \n SELECT * WHERE {\n ?uri ff:sparqlConstructQuery ?query .\n }",o),d={rounds:[]},h=1,p=[];for(;h>0;){let e={};for(let t of l){let r=await si(t.query,o);for(let n of r){let r=yi(n),i=r.s+"_"+r.p;c[i]&&!o.has(n)&&(o.getQuads(n.subject,n.predicate,null).forEach((e=>{o.delete(e),r.overwrote||(r.overwrote=[]),r.overwrote.push(yi(e))})),e[t.uri]||(e[t.uri]=[]),o.addQuad(n),e[t.uri].push(r),p.push(i))}}h=Object.keys(e).length,h>0&&d.rounds.push(e)}for(let e of p)delete c[e];c=Object.values(c);let f=c.filter((e=>e.optional)),y=c.filter((e=>!e.optional));if(a&&f.length>0&&console.log("Optional data points missing:",f),y.length>0)return a&&console.log("Mandatory data points missing:",y),{result:gi.UNDETERMINABLE,violations:[],missingUserInput:c,materializationReport:d};for(let e of f){let t=`\n PREFIX ff: \n PREFIX sh: \n DELETE { \n ?propertyShape sh:minCount ?obj .\n } WHERE {\n ?shape a sh:NodeShape .\n FILTER(?shape = ff:MainPersonShape) .\n ?shape sh:property ?propertyShape .\n ?propertyShape sh:path <${e.dfUri}> .\n ?propertyShape ?pred ?obj .\n }\n `;await ui(t,o)}a&&(console.log("Store after applying materialization rules and removing sh:minCount from optionals:"),function(e){const t=ii();e.getQuads().forEach((e=>t.addQuad(e))),t.end(((e,t)=>console.log(t)))}(o));let g=await ai(o);return a&&(console.log("Third validation report:"),ni(g.dataset)),{result:g.conforms?gi.ELIGIBLE:gi.INELIGIBLE,violations:vi(g,!1),missingUserInput:c,materializationReport:d}}function vi(e,t){let r=[];for(let n of e.results){const e=n.constraintComponent.value.split("#")[1];(!t||"MinCountConstraintComponent"!==e&&"QualifiedMinCountConstraintComponent"!==e&&"NodeConstraintComponent"!==e)&&r.push({constraint:n.constraintComponent.value,focusNode:n.focusNode?.value??"",path:n.path?.[0]?.predicates?.[0]?.value??"",violatingValue:n.args?.hasValue?.id??"",message:n.message?.[0]?.value??""})}return r}window.MatchingEngine={ValidationResult:gi,validateUserProfile:mi,validateOne:bi,validateAll:async function(e,t,r,n,i=!1){let a={reports:[],missingUserInputsAggregated:{}};for(let o of Object.values(t)){let t=await ci(o),s=await bi(e,o,r,n,i);s.rpUri=t,a.reports.push(s);for(let e of s.missingUserInput){let r=e.subject+"_"+e.dfUri;a.missingUserInputsAggregated[r]||(a.missingUserInputsAggregated[r]={subject:e.subject,dfUri:e.dfUri,usedIn:[]}),a.missingUserInputsAggregated[r].usedIn.push({rpUri:t,optional:e.optional,isLastMissingUserInput:1===s.missingUserInput.length})}}return a},rdfStringsToStore:ei,runSparqlSelectQueryOnStore:oi,extractRequirementProfilesMetadata:async function(e){let t=await ei(e),r={},n=await oi("\n PREFIX ff: \n SELECT * WHERE {\n ?rpUri a ff:RequirementProfile .\n OPTIONAL { ?rpUri ff:title ?title } .\n OPTIONAL { ?rpUri ff:category ?category } .\n }",t);for(let e of n)r[e.rpUri]||(r[e.rpUri]={uri:e.rpUri,title:e.title??"",categories:[]}),e.category&&r[e.rpUri].categories.push(e.category);return r},extractDatafieldsMetadata:async function(e){let t=await ti(e),r="\n PREFIX ff: \n PREFIX rdfs: \n PREFIX sh: \n SELECT * WHERE {\n ?dfUri a ff:DataField .\n OPTIONAL { ?dfUri rdfs:label ?label } .\n OPTIONAL { ?dfUri rdfs:comment ?comment } .\n OPTIONAL { \n ?property sh:path ?dfUri ;\n sh:class ?class .\n }\n }",n=await oi(r,t),i={};for(let e of n)i[e.dfUri]={uri:e.dfUri,label:e.label??"",comment:e.comment??"",objectHasClass:e.class??""};r="\n PREFIX ff: \n PREFIX rdfs: \n SELECT * WHERE {\n ?classUri a ff:Class .\n OPTIONAL { ?classUri rdfs:label ?label } .\n }",n=await oi(r,t);for(let e of n)i[e.classUri]={uri:e.classUri,label:e.label??"",isClass:!0};return i},convertUserProfileToTurtle:hi,validateSingleDatafieldValue:async function(e,t){return mi(await hi(e),t)}}})()})(); \ No newline at end of file diff --git a/assets/choices.min.css b/assets/choices.min.css new file mode 100644 index 0000000..9260536 --- /dev/null +++ b/assets/choices.min.css @@ -0,0 +1 @@ +.choices{position:relative;overflow:hidden;margin-bottom:24px;font-size:16px}.choices:focus{outline:0}.choices:last-child{margin-bottom:0}.choices.is-open{overflow:visible}.choices.is-disabled .choices__inner,.choices.is-disabled .choices__input{background-color:#eaeaea;cursor:not-allowed;-webkit-user-select:none;user-select:none}.choices.is-disabled .choices__item{cursor:not-allowed}.choices [hidden]{display:none!important}.choices[data-type*=select-one]{cursor:pointer}.choices[data-type*=select-one] .choices__inner{padding-bottom:7.5px}.choices[data-type*=select-one] .choices__input{display:block;width:100%;padding:10px;border-bottom:1px solid #ddd;background-color:#fff;margin:0}.choices[data-type*=select-one] .choices__button{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjMDAwIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);padding:0;background-size:8px;position:absolute;top:50%;right:0;margin-top:-10px;margin-right:25px;height:20px;width:20px;border-radius:10em;opacity:.25}.choices[data-type*=select-one] .choices__button:focus,.choices[data-type*=select-one] .choices__button:hover{opacity:1}.choices[data-type*=select-one] .choices__button:focus{box-shadow:0 0 0 2px #00bcd4}.choices[data-type*=select-one] .choices__item[data-value=""] .choices__button{display:none}.choices[data-type*=select-one]::after{content:"";height:0;width:0;border-style:solid;border-color:#333 transparent transparent;border-width:5px;position:absolute;right:11.5px;top:50%;margin-top:-2.5px;pointer-events:none}.choices[data-type*=select-one].is-open::after{border-color:transparent transparent #333;margin-top:-7.5px}.choices[data-type*=select-one][dir=rtl]::after{left:11.5px;right:auto}.choices[data-type*=select-one][dir=rtl] .choices__button{right:auto;left:0;margin-left:25px;margin-right:0}.choices[data-type*=select-multiple] .choices__inner,.choices[data-type*=text] .choices__inner{cursor:text}.choices[data-type*=select-multiple] .choices__button,.choices[data-type*=text] .choices__button{position:relative;display:inline-block;margin:0-4px 0 8px;padding-left:16px;border-left:1px solid #008fa1;background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjEiIHZpZXdCb3g9IjAgMCAyMSAyMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjRkZGIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yLjU5Mi4wNDRsMTguMzY0IDE4LjM2NC0yLjU0OCAyLjU0OEwuMDQ0IDIuNTkyeiIvPjxwYXRoIGQ9Ik0wIDE4LjM2NEwxOC4zNjQgMGwyLjU0OCAyLjU0OEwyLjU0OCAyMC45MTJ6Ii8+PC9nPjwvc3ZnPg==);background-size:8px;width:8px;line-height:1;opacity:.75;border-radius:0}.choices[data-type*=select-multiple] .choices__button:focus,.choices[data-type*=select-multiple] .choices__button:hover,.choices[data-type*=text] .choices__button:focus,.choices[data-type*=text] .choices__button:hover{opacity:1}.choices__inner{display:inline-block;vertical-align:top;width:100%;background-color:#f9f9f9;padding:7.5px 7.5px 3.75px;border:1px solid #ddd;border-radius:2.5px;font-size:14px;min-height:44px;overflow:hidden}.is-focused .choices__inner,.is-open .choices__inner{border-color:#b7b7b7}.is-open .choices__inner{border-radius:2.5px 2.5px 0 0}.is-flipped.is-open .choices__inner{border-radius:0 0 2.5px 2.5px}.choices__list{margin:0;padding-left:0;list-style:none}.choices__list--single{display:inline-block;padding:4px 16px 4px 4px;width:100%}[dir=rtl] .choices__list--single{padding-right:4px;padding-left:16px}.choices__list--single .choices__item{width:100%}.choices__list--multiple{display:inline}.choices__list--multiple .choices__item{display:inline-block;vertical-align:middle;border-radius:20px;padding:4px 10px;font-size:12px;font-weight:500;margin-right:3.75px;margin-bottom:3.75px;background-color:#00bcd4;border:1px solid #00a5bb;color:#fff;word-break:break-all;box-sizing:border-box}.choices__list--multiple .choices__item[data-deletable]{padding-right:5px}[dir=rtl] .choices__list--multiple .choices__item{margin-right:0;margin-left:3.75px}.choices__list--multiple .choices__item.is-highlighted{background-color:#00a5bb;border:1px solid #008fa1}.is-disabled .choices__list--multiple .choices__item{background-color:#aaa;border:1px solid #919191}.choices__list--dropdown,.choices__list[aria-expanded]{visibility:hidden;z-index:1;position:absolute;width:100%;background-color:#fff;border:1px solid #ddd;top:100%;margin-top:-1px;border-bottom-left-radius:2.5px;border-bottom-right-radius:2.5px;overflow:hidden;word-break:break-all;will-change:visibility}.is-active.choices__list--dropdown,.is-active.choices__list[aria-expanded]{visibility:visible}.is-open .choices__list--dropdown,.is-open .choices__list[aria-expanded]{border-color:#b7b7b7}.is-flipped .choices__list--dropdown,.is-flipped .choices__list[aria-expanded]{top:auto;bottom:100%;margin-top:0;margin-bottom:-1px;border-radius:.25rem .25rem 0 0}.choices__list--dropdown .choices__list,.choices__list[aria-expanded] .choices__list{position:relative;max-height:300px;overflow:auto;-webkit-overflow-scrolling:touch;will-change:scroll-position}.choices__list--dropdown .choices__item,.choices__list[aria-expanded] .choices__item{position:relative;padding:10px;font-size:14px}[dir=rtl] .choices__list--dropdown .choices__item,[dir=rtl] .choices__list[aria-expanded] .choices__item{text-align:right}@media (min-width:640px){.choices__list--dropdown .choices__item--selectable,.choices__list[aria-expanded] .choices__item--selectable{padding-right:100px}.choices__list--dropdown .choices__item--selectable::after,.choices__list[aria-expanded] .choices__item--selectable::after{content:attr(data-select-text);font-size:12px;opacity:0;position:absolute;right:10px;top:50%;transform:translateY(-50%)}[dir=rtl] .choices__list--dropdown .choices__item--selectable,[dir=rtl] .choices__list[aria-expanded] .choices__item--selectable{text-align:right;padding-left:100px;padding-right:10px}[dir=rtl] .choices__list--dropdown .choices__item--selectable::after,[dir=rtl] .choices__list[aria-expanded] .choices__item--selectable::after{right:auto;left:10px}}.choices__list--dropdown .choices__item--selectable.is-highlighted,.choices__list[aria-expanded] .choices__item--selectable.is-highlighted{background-color:#f2f2f2}.choices__list--dropdown .choices__item--selectable.is-highlighted::after,.choices__list[aria-expanded] .choices__item--selectable.is-highlighted::after{opacity:.5}.choices__item{cursor:default}.choices__item--selectable{cursor:pointer}.choices__item--disabled{cursor:not-allowed;-webkit-user-select:none;user-select:none;opacity:.5}.choices__heading{font-weight:600;font-size:12px;padding:10px;border-bottom:1px solid #f7f7f7;color:gray}.choices__button{text-indent:-9999px;-webkit-appearance:none;appearance:none;border:0;background-color:transparent;background-repeat:no-repeat;background-position:center;cursor:pointer}.choices__button:focus,.choices__input:focus{outline:0}.choices__input{display:inline-block;vertical-align:baseline;background-color:#f9f9f9;font-size:14px;margin-bottom:5px;border:0;border-radius:0;max-width:100%;padding:4px 0 4px 2px}.choices__input::-webkit-search-cancel-button,.choices__input::-webkit-search-decoration,.choices__input::-webkit-search-results-button,.choices__input::-webkit-search-results-decoration{display:none}.choices__input::-ms-clear,.choices__input::-ms-reveal{display:none;width:0;height:0}[dir=rtl] .choices__input{padding-right:2px;padding-left:0}.choices__placeholder{opacity:.5} \ No newline at end of file diff --git a/assets/choices.min.js b/assets/choices.min.js new file mode 100644 index 0000000..af28094 --- /dev/null +++ b/assets/choices.min.js @@ -0,0 +1,2 @@ +/*! For license information please see choices.min.js.LICENSE.txt */ +!function(){"use strict";var e={282:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.clearChoices=t.activateChoices=t.filterChoices=t.addChoice=void 0;var n=i(883);t.addChoice=function(e){var t=e.value,i=e.label,r=e.id,s=e.groupId,o=e.disabled,a=e.elementId,c=e.customProperties,l=e.placeholder,h=e.keyCode;return{type:n.ACTION_TYPES.ADD_CHOICE,value:t,label:i,id:r,groupId:s,disabled:o,elementId:a,customProperties:c,placeholder:l,keyCode:h}},t.filterChoices=function(e){return{type:n.ACTION_TYPES.FILTER_CHOICES,results:e}},t.activateChoices=function(e){return void 0===e&&(e=!0),{type:n.ACTION_TYPES.ACTIVATE_CHOICES,active:e}},t.clearChoices=function(){return{type:n.ACTION_TYPES.CLEAR_CHOICES}}},783:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.addGroup=void 0;var n=i(883);t.addGroup=function(e){var t=e.value,i=e.id,r=e.active,s=e.disabled;return{type:n.ACTION_TYPES.ADD_GROUP,value:t,id:i,active:r,disabled:s}}},464:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.highlightItem=t.removeItem=t.addItem=void 0;var n=i(883);t.addItem=function(e){var t=e.value,i=e.label,r=e.id,s=e.choiceId,o=e.groupId,a=e.customProperties,c=e.placeholder,l=e.keyCode;return{type:n.ACTION_TYPES.ADD_ITEM,value:t,label:i,id:r,choiceId:s,groupId:o,customProperties:a,placeholder:c,keyCode:l}},t.removeItem=function(e,t){return{type:n.ACTION_TYPES.REMOVE_ITEM,id:e,choiceId:t}},t.highlightItem=function(e,t){return{type:n.ACTION_TYPES.HIGHLIGHT_ITEM,id:e,highlighted:t}}},137:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.setIsLoading=t.resetTo=t.clearAll=void 0;var n=i(883);t.clearAll=function(){return{type:n.ACTION_TYPES.CLEAR_ALL}},t.resetTo=function(e){return{type:n.ACTION_TYPES.RESET_TO,state:e}},t.setIsLoading=function(e){return{type:n.ACTION_TYPES.SET_IS_LOADING,isLoading:e}}},373:function(e,t,i){var n=this&&this.__spreadArray||function(e,t,i){if(i||2===arguments.length)for(var n,r=0,s=t.length;r=0?this._store.getGroupById(r):null;return this._store.dispatch((0,l.highlightItem)(i,!0)),t&&this.passedElement.triggerEvent(d.EVENTS.highlightItem,{id:i,value:o,label:c,groupValue:h&&h.value?h.value:null}),this},e.prototype.unhighlightItem=function(e){if(!e||!e.id)return this;var t=e.id,i=e.groupId,n=void 0===i?-1:i,r=e.value,s=void 0===r?"":r,o=e.label,a=void 0===o?"":o,c=n>=0?this._store.getGroupById(n):null;return this._store.dispatch((0,l.highlightItem)(t,!1)),this.passedElement.triggerEvent(d.EVENTS.highlightItem,{id:t,value:s,label:a,groupValue:c&&c.value?c.value:null}),this},e.prototype.highlightAll=function(){var e=this;return this._store.items.forEach((function(t){return e.highlightItem(t)})),this},e.prototype.unhighlightAll=function(){var e=this;return this._store.items.forEach((function(t){return e.unhighlightItem(t)})),this},e.prototype.removeActiveItemsByValue=function(e){var t=this;return this._store.activeItems.filter((function(t){return t.value===e})).forEach((function(e){return t._removeItem(e)})),this},e.prototype.removeActiveItems=function(e){var t=this;return this._store.activeItems.filter((function(t){return t.id!==e})).forEach((function(e){return t._removeItem(e)})),this},e.prototype.removeHighlightedItems=function(e){var t=this;return void 0===e&&(e=!1),this._store.highlightedActiveItems.forEach((function(i){t._removeItem(i),e&&t._triggerChange(i.value)})),this},e.prototype.showDropdown=function(e){var t=this;return this.dropdown.isActive||requestAnimationFrame((function(){t.dropdown.show(),t.containerOuter.open(t.dropdown.distanceFromTopWindow),!e&&t._canSearch&&t.input.focus(),t.passedElement.triggerEvent(d.EVENTS.showDropdown,{})})),this},e.prototype.hideDropdown=function(e){var t=this;return this.dropdown.isActive?(requestAnimationFrame((function(){t.dropdown.hide(),t.containerOuter.close(),!e&&t._canSearch&&(t.input.removeActiveDescendant(),t.input.blur()),t.passedElement.triggerEvent(d.EVENTS.hideDropdown,{})})),this):this},e.prototype.getValue=function(e){void 0===e&&(e=!1);var t=this._store.activeItems.reduce((function(t,i){var n=e?i.value:i;return t.push(n),t}),[]);return this._isSelectOneElement?t[0]:t},e.prototype.setValue=function(e){var t=this;return this.initialised?(e.forEach((function(e){return t._setChoiceOrItem(e)})),this):this},e.prototype.setChoiceByValue=function(e){var t=this;return!this.initialised||this._isTextElement||(Array.isArray(e)?e:[e]).forEach((function(e){return t._findAndSelectChoiceByValue(e)})),this},e.prototype.setChoices=function(e,t,i,n){var r=this;if(void 0===e&&(e=[]),void 0===t&&(t="value"),void 0===i&&(i="label"),void 0===n&&(n=!1),!this.initialised)throw new ReferenceError("setChoices was called on a non-initialized instance of Choices");if(!this._isSelectElement)throw new TypeError("setChoices can't be used with INPUT based Choices");if("string"!=typeof t||!t)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if(n&&this.clearChoices(),"function"==typeof e){var s=e(this);if("function"==typeof Promise&&s instanceof Promise)return new Promise((function(e){return requestAnimationFrame(e)})).then((function(){return r._handleLoadingState(!0)})).then((function(){return s})).then((function(e){return r.setChoices(e,t,i,n)})).catch((function(e){r.config.silent||console.error(e)})).then((function(){return r._handleLoadingState(!1)})).then((function(){return r}));if(!Array.isArray(s))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof s));return this.setChoices(s,t,i,!1)}if(!Array.isArray(e))throw new TypeError(".setChoices must be called either with array of choices with a function resulting into Promise of array of choices");return this.containerOuter.removeLoadingState(),this._startLoading(),e.forEach((function(e){if(e.choices)r._addGroup({id:e.id?parseInt("".concat(e.id),10):null,group:e,valueKey:t,labelKey:i});else{var n=e;r._addChoice({value:n[t],label:n[i],isSelected:!!n.selected,isDisabled:!!n.disabled,placeholder:!!n.placeholder,customProperties:n.customProperties})}})),this._stopLoading(),this},e.prototype.clearChoices=function(){return this._store.dispatch((0,a.clearChoices)()),this},e.prototype.clearStore=function(){return this._store.dispatch((0,h.clearAll)()),this},e.prototype.clearInput=function(){var e=!this._isSelectOneElement;return this.input.clear(e),!this._isTextElement&&this._canSearch&&(this._isSearching=!1,this._store.dispatch((0,a.activateChoices)(!0))),this},e.prototype._render=function(){if(!this._store.isLoading()){this._currentState=this._store.state;var e=this._currentState.choices!==this._prevState.choices||this._currentState.groups!==this._prevState.groups||this._currentState.items!==this._prevState.items,t=this._isSelectElement,i=this._currentState.items!==this._prevState.items;e&&(t&&this._renderChoices(),i&&this._renderItems(),this._prevState=this._currentState)}},e.prototype._renderChoices=function(){var e=this,t=this._store,i=t.activeGroups,n=t.activeChoices,r=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&requestAnimationFrame((function(){return e.choiceList.scrollToTop()})),i.length>=1&&!this._isSearching){var s=n.filter((function(e){return!0===e.placeholder&&-1===e.groupId}));s.length>=1&&(r=this._createChoicesFragment(s,r)),r=this._createGroupsFragment(i,n,r)}else n.length>=1&&(r=this._createChoicesFragment(n,r));if(r.childNodes&&r.childNodes.length>0){var o=this._store.activeItems,a=this._canAddItem(o,this.input.value);if(a.response)this.choiceList.append(r),this._highlightChoice();else{var c=this._getTemplate("notice",a.notice);this.choiceList.append(c)}}else{var l=void 0;c=void 0,this._isSearching?(c="function"==typeof this.config.noResultsText?this.config.noResultsText():this.config.noResultsText,l=this._getTemplate("notice",c,"no-results")):(c="function"==typeof this.config.noChoicesText?this.config.noChoicesText():this.config.noChoicesText,l=this._getTemplate("notice",c,"no-choices")),this.choiceList.append(l)}},e.prototype._renderItems=function(){var e=this._store.activeItems||[];this.itemList.clear();var t=this._createItemsFragment(e);t.childNodes&&this.itemList.append(t)},e.prototype._createGroupsFragment=function(e,t,i){var n=this;return void 0===i&&(i=document.createDocumentFragment()),this.config.shouldSort&&e.sort(this.config.sorter),e.forEach((function(e){var r=function(e){return t.filter((function(t){return n._isSelectOneElement?t.groupId===e.id:t.groupId===e.id&&("always"===n.config.renderSelectedChoices||!t.selected)}))}(e);if(r.length>=1){var s=n._getTemplate("choiceGroup",e);i.appendChild(s),n._createChoicesFragment(r,i,!0)}})),i},e.prototype._createChoicesFragment=function(e,t,i){var r=this;void 0===t&&(t=document.createDocumentFragment()),void 0===i&&(i=!1);var s=this.config,o=s.renderSelectedChoices,a=s.searchResultLimit,c=s.renderChoiceLimit,l=this._isSearching?f.sortByScore:this.config.sorter,h=function(e){if("auto"!==o||r._isSelectOneElement||!e.selected){var i=r._getTemplate("choice",e,r.config.itemSelectText);t.appendChild(i)}},u=e;"auto"!==o||this._isSelectOneElement||(u=e.filter((function(e){return!e.selected})));var d=u.reduce((function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e}),{placeholderChoices:[],normalChoices:[]}),p=d.placeholderChoices,m=d.normalChoices;(this.config.shouldSort||this._isSearching)&&m.sort(l);var v=u.length,g=this._isSelectOneElement?n(n([],p,!0),m,!0):m;this._isSearching?v=a:c&&c>0&&!i&&(v=c);for(var _=0;_=n){var o=r?this._searchChoices(e):0;this.passedElement.triggerEvent(d.EVENTS.search,{value:e,resultCount:o})}else s&&(this._isSearching=!1,this._store.dispatch((0,a.activateChoices)(!0)))}},e.prototype._canAddItem=function(e,t){var i=!0,n="function"==typeof this.config.addItemText?this.config.addItemText(t):this.config.addItemText;if(!this._isSelectOneElement){var r=(0,f.existsInArray)(e,t);this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(i=!1,n="function"==typeof this.config.maxItemText?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText),!this.config.duplicateItemsAllowed&&r&&i&&(i=!1,n="function"==typeof this.config.uniqueItemText?this.config.uniqueItemText(t):this.config.uniqueItemText),this._isTextElement&&this.config.addItems&&i&&"function"==typeof this.config.addItemFilter&&!this.config.addItemFilter(t)&&(i=!1,n="function"==typeof this.config.customAddItemText?this.config.customAddItemText(t):this.config.customAddItemText)}return{response:i,notice:n}},e.prototype._searchChoices=function(e){var t="string"==typeof e?e.trim():e,i="string"==typeof this._currentValue?this._currentValue.trim():this._currentValue;if(t.length<1&&t==="".concat(i," "))return 0;var r=this._store.searchableChoices,s=t,c=Object.assign(this.config.fuseOptions,{keys:n([],this.config.searchFields,!0),includeMatches:!0}),l=new o.default(r,c).search(s);return this._currentValue=t,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch((0,a.filterChoices)(l)),l.length},e.prototype._addEventListeners=function(){var e=document.documentElement;e.addEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.addEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.addEventListener("mousedown",this._onMouseDown,!0),e.addEventListener("click",this._onClick,{passive:!0}),e.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:!0}),this._isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus,{passive:!0}),this.containerOuter.element.addEventListener("blur",this._onBlur,{passive:!0})),this.input.element.addEventListener("keyup",this._onKeyUp,{passive:!0}),this.input.element.addEventListener("focus",this._onFocus,{passive:!0}),this.input.element.addEventListener("blur",this._onBlur,{passive:!0}),this.input.element.form&&this.input.element.form.addEventListener("reset",this._onFormReset,{passive:!0}),this.input.addEventListeners()},e.prototype._removeEventListeners=function(){var e=document.documentElement;e.removeEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.removeEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.removeEventListener("mousedown",this._onMouseDown,!0),e.removeEventListener("click",this._onClick),e.removeEventListener("touchmove",this._onTouchMove),this.dropdown.element.removeEventListener("mouseover",this._onMouseOver),this._isSelectOneElement&&(this.containerOuter.element.removeEventListener("focus",this._onFocus),this.containerOuter.element.removeEventListener("blur",this._onBlur)),this.input.element.removeEventListener("keyup",this._onKeyUp),this.input.element.removeEventListener("focus",this._onFocus),this.input.element.removeEventListener("blur",this._onBlur),this.input.element.form&&this.input.element.form.removeEventListener("reset",this._onFormReset),this.input.removeEventListeners()},e.prototype._onKeyDown=function(e){var t=e.keyCode,i=this._store.activeItems,n=this.input.isFocussed,r=this.dropdown.isActive,s=this.itemList.hasChildren(),o=String.fromCharCode(t),a=/[^\x00-\x1F]/.test(o),c=d.KEY_CODES.BACK_KEY,l=d.KEY_CODES.DELETE_KEY,h=d.KEY_CODES.ENTER_KEY,u=d.KEY_CODES.A_KEY,p=d.KEY_CODES.ESC_KEY,f=d.KEY_CODES.UP_KEY,m=d.KEY_CODES.DOWN_KEY,v=d.KEY_CODES.PAGE_UP_KEY,g=d.KEY_CODES.PAGE_DOWN_KEY;switch(this._isTextElement||r||!a||(this.showDropdown(),this.input.isFocussed||(this.input.value+=e.key.toLowerCase())),t){case u:return this._onSelectKey(e,s);case h:return this._onEnterKey(e,i,r);case p:return this._onEscapeKey(r);case f:case v:case m:case g:return this._onDirectionKey(e,r);case l:case c:return this._onDeleteKey(e,i,n)}},e.prototype._onKeyUp=function(e){var t=e.target,i=e.keyCode,n=this.input.value,r=this._store.activeItems,s=this._canAddItem(r,n),o=d.KEY_CODES.BACK_KEY,c=d.KEY_CODES.DELETE_KEY;if(this._isTextElement)if(s.notice&&n){var l=this._getTemplate("notice",s.notice);this.dropdown.element.innerHTML=l.outerHTML,this.showDropdown(!0)}else this.hideDropdown(!0);else{var h=(i===o||i===c)&&t&&!t.value,u=!this._isTextElement&&this._isSearching,p=this._canSearch&&s.response;h&&u?(this._isSearching=!1,this._store.dispatch((0,a.activateChoices)(!0))):p&&this._handleSearch(this.input.rawValue)}this._canSearch=this.config.searchEnabled},e.prototype._onSelectKey=function(e,t){var i=e.ctrlKey,n=e.metaKey;(i||n)&&t&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())},e.prototype._onEnterKey=function(e,t,i){var n=e.target,r=d.KEY_CODES.ENTER_KEY,s=n&&n.hasAttribute("data-button");if(this._isTextElement&&n&&n.value){var o=this.input.value;this._canAddItem(t,o).response&&(this.hideDropdown(!0),this._addItem({value:o}),this._triggerChange(o),this.clearInput())}if(s&&(this._handleButtonAction(t,n),e.preventDefault()),i){var a=this.dropdown.getChild(".".concat(this.config.classNames.highlightedState));a&&(t[0]&&(t[0].keyCode=r),this._handleChoiceAction(t,a)),e.preventDefault()}else this._isSelectOneElement&&(this.showDropdown(),e.preventDefault())},e.prototype._onEscapeKey=function(e){e&&(this.hideDropdown(!0),this.containerOuter.focus())},e.prototype._onDirectionKey=function(e,t){var i=e.keyCode,n=e.metaKey,r=d.KEY_CODES.DOWN_KEY,s=d.KEY_CODES.PAGE_UP_KEY,o=d.KEY_CODES.PAGE_DOWN_KEY;if(t||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var a=i===r||i===o?1:-1,c="[data-choice-selectable]",l=void 0;if(n||i===o||i===s)l=a>0?this.dropdown.element.querySelector("".concat(c,":last-of-type")):this.dropdown.element.querySelector(c);else{var h=this.dropdown.element.querySelector(".".concat(this.config.classNames.highlightedState));l=h?(0,f.getAdjacentEl)(h,c,a):this.dropdown.element.querySelector(c)}l&&((0,f.isScrolledIntoView)(l,this.choiceList.element,a)||this.choiceList.scrollToChildElement(l,a),this._highlightChoice(l)),e.preventDefault()}},e.prototype._onDeleteKey=function(e,t,i){var n=e.target;this._isSelectOneElement||n.value||!i||(this._handleBackspace(t),e.preventDefault())},e.prototype._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},e.prototype._onTouchEnd=function(e){var t=(e||e.touches[0]).target;this._wasTap&&this.containerOuter.element.contains(t)&&((t===this.containerOuter.element||t===this.containerInner.element)&&(this._isTextElement?this.input.focus():this._isSelectMultipleElement&&this.showDropdown()),e.stopPropagation()),this._wasTap=!0},e.prototype._onMouseDown=function(e){var t=e.target;if(t instanceof HTMLElement){if(_&&this.choiceList.element.contains(t)){var i=this.choiceList.element.firstElementChild,n="ltr"===this._direction?e.offsetX>=i.offsetWidth:e.offsetX0&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0))},e.prototype._onFocus=function(e){var t,i=this,n=e.target;n&&this.containerOuter.element.contains(n)&&((t={})[d.TEXT_TYPE]=function(){n===i.input.element&&i.containerOuter.addFocusState()},t[d.SELECT_ONE_TYPE]=function(){i.containerOuter.addFocusState(),n===i.input.element&&i.showDropdown(!0)},t[d.SELECT_MULTIPLE_TYPE]=function(){n===i.input.element&&(i.showDropdown(!0),i.containerOuter.addFocusState())},t)[this.passedElement.element.type]()},e.prototype._onBlur=function(e){var t,i=this,n=e.target;if(n&&this.containerOuter.element.contains(n)&&!this._isScrollingOnIe){var r=this._store.activeItems.some((function(e){return e.highlighted}));((t={})[d.TEXT_TYPE]=function(){n===i.input.element&&(i.containerOuter.removeFocusState(),r&&i.unhighlightAll(),i.hideDropdown(!0))},t[d.SELECT_ONE_TYPE]=function(){i.containerOuter.removeFocusState(),(n===i.input.element||n===i.containerOuter.element&&!i._canSearch)&&i.hideDropdown(!0)},t[d.SELECT_MULTIPLE_TYPE]=function(){n===i.input.element&&(i.containerOuter.removeFocusState(),i.hideDropdown(!0),r&&i.unhighlightAll())},t)[this.passedElement.element.type]()}else this._isScrollingOnIe=!1,this.input.element.focus()},e.prototype._onFormReset=function(){this._store.dispatch((0,h.resetTo)(this._initialState))},e.prototype._highlightChoice=function(e){var t=this;void 0===e&&(e=null);var i=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(i.length){var n=e;Array.from(this.dropdown.element.querySelectorAll(".".concat(this.config.classNames.highlightedState))).forEach((function(e){e.classList.remove(t.config.classNames.highlightedState),e.setAttribute("aria-selected","false")})),n?this._highlightPosition=i.indexOf(n):(n=i.length>this._highlightPosition?i[this._highlightPosition]:i[i.length-1])||(n=i[0]),n.classList.add(this.config.classNames.highlightedState),n.setAttribute("aria-selected","true"),this.passedElement.triggerEvent(d.EVENTS.highlightChoice,{el:n}),this.dropdown.isActive&&(this.input.setActiveDescendant(n.id),this.containerOuter.setActiveDescendant(n.id))}},e.prototype._addItem=function(e){var t=e.value,i=e.label,n=void 0===i?null:i,r=e.choiceId,s=void 0===r?-1:r,o=e.groupId,a=void 0===o?-1:o,c=e.customProperties,h=void 0===c?{}:c,u=e.placeholder,p=void 0!==u&&u,f=e.keyCode,m=void 0===f?-1:f,v="string"==typeof t?t.trim():t,g=this._store.items,_=n||v,y=s||-1,E=a>=0?this._store.getGroupById(a):null,b=g?g.length+1:1;this.config.prependValue&&(v=this.config.prependValue+v.toString()),this.config.appendValue&&(v+=this.config.appendValue.toString()),this._store.dispatch((0,l.addItem)({value:v,label:_,id:b,choiceId:y,groupId:a,customProperties:h,placeholder:p,keyCode:m})),this._isSelectOneElement&&this.removeActiveItems(b),this.passedElement.triggerEvent(d.EVENTS.addItem,{id:b,value:v,label:_,customProperties:h,groupValue:E&&E.value?E.value:null,keyCode:m})},e.prototype._removeItem=function(e){var t=e.id,i=e.value,n=e.label,r=e.customProperties,s=e.choiceId,o=e.groupId,a=o&&o>=0?this._store.getGroupById(o):null;t&&s&&(this._store.dispatch((0,l.removeItem)(t,s)),this.passedElement.triggerEvent(d.EVENTS.removeItem,{id:t,value:i,label:n,customProperties:r,groupValue:a&&a.value?a.value:null}))},e.prototype._addChoice=function(e){var t=e.value,i=e.label,n=void 0===i?null:i,r=e.isSelected,s=void 0!==r&&r,o=e.isDisabled,c=void 0!==o&&o,l=e.groupId,h=void 0===l?-1:l,u=e.customProperties,d=void 0===u?{}:u,p=e.placeholder,f=void 0!==p&&p,m=e.keyCode,v=void 0===m?-1:m;if(null!=t){var g=this._store.choices,_=n||t,y=g?g.length+1:1,E="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(y);this._store.dispatch((0,a.addChoice)({id:y,groupId:h,elementId:E,value:t,label:_,disabled:c,customProperties:d,placeholder:f,keyCode:v})),s&&this._addItem({value:t,label:_,choiceId:y,customProperties:d,placeholder:f,keyCode:v})}},e.prototype._addGroup=function(e){var t=this,i=e.group,n=e.id,r=e.valueKey,s=void 0===r?"value":r,o=e.labelKey,a=void 0===o?"label":o,l=(0,f.isType)("Object",i)?i.choices:Array.from(i.getElementsByTagName("OPTION")),h=n||Math.floor((new Date).valueOf()*Math.random()),u=!!i.disabled&&i.disabled;l?(this._store.dispatch((0,c.addGroup)({value:i.label,id:h,active:!0,disabled:u})),l.forEach((function(e){var i=e.disabled||e.parentNode&&e.parentNode.disabled;t._addChoice({value:e[s],label:(0,f.isType)("Object",e)?e[a]:e.innerHTML,isSelected:e.selected,isDisabled:i,groupId:h,customProperties:e.customProperties,placeholder:e.placeholder})}))):this._store.dispatch((0,c.addGroup)({value:i.label,id:i.id,active:!1,disabled:i.disabled}))},e.prototype._getTemplate=function(e){for(var t,i=[],r=1;r0?this.element.scrollTop+o-r:e.offsetTop;requestAnimationFrame((function(){i._animateScroll(a,t)}))}},e.prototype._scrollDown=function(e,t,i){var n=(i-e)/t,r=n>1?n:1;this.element.scrollTop=e+r},e.prototype._scrollUp=function(e,t,i){var n=(e-i)/t,r=n>1?n:1;this.element.scrollTop=e-r},e.prototype._animateScroll=function(e,t){var i=this,r=n.SCROLLING_SPEED,s=this.element.scrollTop,o=!1;t>0?(this._scrollDown(s,r,e),se&&(o=!0)),o&&requestAnimationFrame((function(){i._animateScroll(e,t)}))},e}();t.default=r},730:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0});var n=i(799),r=function(){function e(e){var t=e.element,i=e.classNames;if(this.element=t,this.classNames=i,!(t instanceof HTMLInputElement||t instanceof HTMLSelectElement))throw new TypeError("Invalid element passed");this.isDisabled=!1}return Object.defineProperty(e.prototype,"isActive",{get:function(){return"active"===this.element.dataset.choice},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dir",{get:function(){return this.element.dir},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.element.value},set:function(e){this.element.value=e},enumerable:!1,configurable:!0}),e.prototype.conceal=function(){this.element.classList.add(this.classNames.input),this.element.hidden=!0,this.element.tabIndex=-1;var e=this.element.getAttribute("style");e&&this.element.setAttribute("data-choice-orig-style",e),this.element.setAttribute("data-choice","active")},e.prototype.reveal=function(){this.element.classList.remove(this.classNames.input),this.element.hidden=!1,this.element.removeAttribute("tabindex");var e=this.element.getAttribute("data-choice-orig-style");e?(this.element.removeAttribute("data-choice-orig-style"),this.element.setAttribute("style",e)):this.element.removeAttribute("style"),this.element.removeAttribute("data-choice"),this.element.value=this.element.value},e.prototype.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},e.prototype.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},e.prototype.triggerEvent=function(e,t){(0,n.dispatchEvent)(this.element,e,t)},e}();t.default=r},541:function(e,t,i){var n,r=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){function t(t){var i=t.element,n=t.classNames,r=t.delimiter,s=e.call(this,{element:i,classNames:n})||this;return s.delimiter=r,s}return r(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.element.value},set:function(e){this.element.setAttribute("value",e),this.element.value=e},enumerable:!1,configurable:!0}),t}(s(i(730)).default);t.default=o},982:function(e,t,i){var n,r=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){function t(t){var i=t.element,n=t.classNames,r=t.template,s=e.call(this,{element:i,classNames:n})||this;return s.template=r,s}return r(t,e),Object.defineProperty(t.prototype,"placeholderOption",{get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optionGroups",{get:function(){return Array.from(this.element.getElementsByTagName("OPTGROUP"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"options",{get:function(){return Array.from(this.element.options)},set:function(e){var t=this,i=document.createDocumentFragment();e.forEach((function(e){return n=e,r=t.template(n),void i.appendChild(r);var n,r})),this.appendDocFragment(i)},enumerable:!1,configurable:!0}),t.prototype.appendDocFragment=function(e){this.element.innerHTML="",this.element.appendChild(e)},t}(s(i(730)).default);t.default=o},883:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.SCROLLING_SPEED=t.SELECT_MULTIPLE_TYPE=t.SELECT_ONE_TYPE=t.TEXT_TYPE=t.KEY_CODES=t.ACTION_TYPES=t.EVENTS=void 0,t.EVENTS={showDropdown:"showDropdown",hideDropdown:"hideDropdown",change:"change",choice:"choice",search:"search",addItem:"addItem",removeItem:"removeItem",highlightItem:"highlightItem",highlightChoice:"highlightChoice",unhighlightItem:"unhighlightItem"},t.ACTION_TYPES={ADD_CHOICE:"ADD_CHOICE",FILTER_CHOICES:"FILTER_CHOICES",ACTIVATE_CHOICES:"ACTIVATE_CHOICES",CLEAR_CHOICES:"CLEAR_CHOICES",ADD_GROUP:"ADD_GROUP",ADD_ITEM:"ADD_ITEM",REMOVE_ITEM:"REMOVE_ITEM",HIGHLIGHT_ITEM:"HIGHLIGHT_ITEM",CLEAR_ALL:"CLEAR_ALL",RESET_TO:"RESET_TO",SET_IS_LOADING:"SET_IS_LOADING"},t.KEY_CODES={BACK_KEY:46,DELETE_KEY:8,ENTER_KEY:13,A_KEY:65,ESC_KEY:27,UP_KEY:38,DOWN_KEY:40,PAGE_UP_KEY:33,PAGE_DOWN_KEY:34},t.TEXT_TYPE="text",t.SELECT_ONE_TYPE="select-one",t.SELECT_MULTIPLE_TYPE="select-multiple",t.SCROLLING_SPEED=4},789:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CONFIG=t.DEFAULT_CLASSNAMES=void 0;var n=i(799);t.DEFAULT_CLASSNAMES={containerOuter:"choices",containerInner:"choices__inner",input:"choices__input",inputCloned:"choices__input--cloned",list:"choices__list",listItems:"choices__list--multiple",listSingle:"choices__list--single",listDropdown:"choices__list--dropdown",item:"choices__item",itemSelectable:"choices__item--selectable",itemDisabled:"choices__item--disabled",itemChoice:"choices__item--choice",placeholder:"choices__placeholder",group:"choices__group",groupHeading:"choices__heading",button:"choices__button",activeState:"is-active",focusState:"is-focused",openState:"is-open",disabledState:"is-disabled",highlightedState:"is-highlighted",selectedState:"is-selected",flippedState:"is-flipped",loadingState:"is-loading",noResults:"has-no-results",noChoices:"has-no-choices"},t.DEFAULT_CONFIG={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,addItems:!0,addItemFilter:null,removeItems:!0,removeItemButton:!1,editItems:!1,allowHTML:!0,duplicateItemsAllowed:!0,delimiter:",",paste:!0,searchEnabled:!0,searchChoices:!0,searchFloor:1,searchResultLimit:4,searchFields:["label","value"],position:"auto",resetScrollPosition:!0,shouldSort:!0,shouldSortItems:!1,sorter:n.sortByAlpha,placeholder:!0,placeholderValue:null,searchPlaceholderValue:null,prependValue:null,appendValue:null,renderSelectedChoices:"auto",loadingText:"Loading...",noResultsText:"No results found",noChoicesText:"No choices to choose from",itemSelectText:"Press to select",uniqueItemText:"Only unique values can be added",customAddItemText:"Only values matching specific conditions can be added",addItemText:function(e){return'Press Enter to add "'.concat((0,n.sanitise)(e),'"')},maxItemText:function(e){return"Only ".concat(e," values can be added")},valueComparer:function(e,t){return e===t},fuseOptions:{includeScore:!0},labelId:"",callbackOnInit:null,callbackOnCreateTemplates:null,classNames:t.DEFAULT_CLASSNAMES}},18:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},978:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},948:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},359:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},285:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},533:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},187:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,r)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),r=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||n(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(i(18),t),r(i(978),t),r(i(948),t),r(i(359),t),r(i(285),t),r(i(533),t),r(i(287),t),r(i(132),t),r(i(837),t),r(i(598),t),r(i(369),t),r(i(37),t),r(i(47),t),r(i(923),t),r(i(876),t)},287:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},132:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},837:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},598:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},37:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},369:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},47:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},923:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},876:function(e,t){Object.defineProperty(t,"__esModule",{value:!0})},799:function(e,t){var i;Object.defineProperty(t,"__esModule",{value:!0}),t.parseCustomProperties=t.diff=t.cloneObject=t.existsInArray=t.dispatchEvent=t.sortByScore=t.sortByAlpha=t.strToEl=t.sanitise=t.isScrolledIntoView=t.getAdjacentEl=t.wrap=t.isType=t.getType=t.generateId=t.generateChars=t.getRandomNumber=void 0,t.getRandomNumber=function(e,t){return Math.floor(Math.random()*(t-e)+e)},t.generateChars=function(e){return Array.from({length:e},(function(){return(0,t.getRandomNumber)(0,36).toString(36)})).join("")},t.generateId=function(e,i){var n=e.id||e.name&&"".concat(e.name,"-").concat((0,t.generateChars)(2))||(0,t.generateChars)(4);return n=n.replace(/(:|\.|\[|\]|,)/g,""),"".concat(i,"-").concat(n)},t.getType=function(e){return Object.prototype.toString.call(e).slice(8,-1)},t.isType=function(e,i){return null!=i&&(0,t.getType)(i)===e},t.wrap=function(e,t){return void 0===t&&(t=document.createElement("div")),e.parentNode&&(e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t)),t.appendChild(e)},t.getAdjacentEl=function(e,t,i){void 0===i&&(i=1);for(var n="".concat(i>0?"next":"previous","ElementSibling"),r=e[n];r;){if(r.matches(t))return r;r=r[n]}return r},t.isScrolledIntoView=function(e,t,i){return void 0===i&&(i=1),!!e&&(i>0?t.scrollTop+t.offsetHeight>=e.offsetTop+e.offsetHeight:e.offsetTop>=t.scrollTop)},t.sanitise=function(e){return"string"!=typeof e?e:e.replace(/&/g,"&").replace(/>/g,">").replace(/-1?e.map((function(e){var t=e;return t.id===parseInt("".concat(o.choiceId),10)&&(t.selected=!0),t})):e;case"REMOVE_ITEM":var a=n;return a.choiceId&&a.choiceId>-1?e.map((function(e){var t=e;return t.id===parseInt("".concat(a.choiceId),10)&&(t.selected=!1),t})):e;case"FILTER_CHOICES":var c=n;return e.map((function(e){var t=e;return t.active=c.results.some((function(e){var i=e.item,n=e.score;return i.id===t.id&&(t.score=n,!0)})),t}));case"ACTIVATE_CHOICES":var l=n;return e.map((function(e){var t=e;return t.active=l.active,t}));case"CLEAR_CHOICES":return t.defaultState;default:return e}}},871:function(e,t){var i=this&&this.__spreadArray||function(e,t,i){if(i||2===arguments.length)for(var n,r=0,s=t.length;r0?"treeitem":"option"),Object.assign(E.dataset,{choice:"",id:d,value:p,selectText:i}),g?(E.classList.add(h),E.dataset.choiceDisabled="",E.setAttribute("aria-disabled","true")):(E.classList.add(c),E.dataset.choiceSelectable=""),E},input:function(e,t){var i=e.classNames,n=i.input,r=i.inputCloned,s=Object.assign(document.createElement("input"),{type:"search",name:"search_terms",className:"".concat(n," ").concat(r),autocomplete:"off",autocapitalize:"off",spellcheck:!1});return s.setAttribute("role","textbox"),s.setAttribute("aria-autocomplete","list"),s.setAttribute("aria-label",t),s},dropdown:function(e){var t=e.classNames,i=t.list,n=t.listDropdown,r=document.createElement("div");return r.classList.add(i,n),r.setAttribute("aria-expanded","false"),r},notice:function(e,t,i){var n,r=e.allowHTML,s=e.classNames,o=s.item,a=s.itemChoice,c=s.noResults,l=s.noChoices;void 0===i&&(i="");var h=[o,a];return"no-choices"===i?h.push(l):"no-results"===i&&h.push(c),Object.assign(document.createElement("div"),((n={})[r?"innerHTML":"innerText"]=t,n.className=h.join(" "),n))},option:function(e){var t=e.label,i=e.value,n=e.customProperties,r=e.active,s=e.disabled,o=new Option(t,i,!1,r);return n&&(o.dataset.customProperties="".concat(n)),o.disabled=!!s,o}};t.default=i},996:function(e){var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===i}(e)}(e)},i="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,t){return!1!==t.clone&&t.isMergeableObject(e)?a((i=e,Array.isArray(i)?[]:{}),e,t):e;var i}function r(e,t,i){return e.concat(t).map((function(e){return n(e,i)}))}function s(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function o(e,t){try{return t in e}catch(e){return!1}}function a(e,i,c){(c=c||{}).arrayMerge=c.arrayMerge||r,c.isMergeableObject=c.isMergeableObject||t,c.cloneUnlessOtherwiseSpecified=n;var l=Array.isArray(i);return l===Array.isArray(e)?l?c.arrayMerge(e,i,c):function(e,t,i){var r={};return i.isMergeableObject(e)&&s(e).forEach((function(t){r[t]=n(e[t],i)})),s(t).forEach((function(s){(function(e,t){return o(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,s)||(o(e,s)&&i.isMergeableObject(t[s])?r[s]=function(e,t){if(!t.customMerge)return a;var i=t.customMerge(e);return"function"==typeof i?i:a}(s,i)(e[s],t[s],i):r[s]=n(t[s],i))})),r}(e,i,c):n(i,c)}a.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,i){return a(e,i,t)}),{})};var c=a;e.exports=c},221:function(e,t,i){function n(e){return Array.isArray?Array.isArray(e):"[object Array]"===l(e)}function r(e){return"string"==typeof e}function s(e){return"number"==typeof e}function o(e){return"object"==typeof e}function a(e){return null!=e}function c(e){return!e.trim().length}function l(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}i.r(t),i.d(t,{default:function(){return R}});const h=Object.prototype.hasOwnProperty;class u{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach((e=>{let i=d(e);t+=i.weight,this._keys.push(i),this._keyMap[i.id]=i,t+=i.weight})),this._keys.forEach((e=>{e.weight/=t}))}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function d(e){let t=null,i=null,s=null,o=1,a=null;if(r(e)||n(e))s=e,t=p(e),i=f(e);else{if(!h.call(e,"name"))throw new Error("Missing name property in key");const n=e.name;if(s=n,h.call(e,"weight")&&(o=e.weight,o<=0))throw new Error((e=>`Property 'weight' in key '${e}' must be a positive integer`)(n));t=p(n),i=f(n),a=e.getFn}return{path:t,id:i,weight:o,src:s,getFn:a}}function p(e){return n(e)?e:e.split(".")}function f(e){return n(e)?e.join("."):e}var m={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx{if(a(e))if(t[u]){const d=e[t[u]];if(!a(d))return;if(u===t.length-1&&(r(d)||s(d)||function(e){return!0===e||!1===e||function(e){return o(e)&&null!==e}(e)&&"[object Boolean]"==l(e)}(d)))i.push(function(e){return null==e?"":function(e){if("string"==typeof e)return e;let t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(d));else if(n(d)){c=!0;for(let e=0,i=d.length;e{this._keysMap[e.id]=t}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,r(this.docs[0])?this.docs.forEach(((e,t)=>{this._addString(e,t)})):this.docs.forEach(((e,t)=>{this._addObject(e,t)})),this.norm.clear())}add(e){const t=this.size();r(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,i=this.size();t{let o=t.getFn?t.getFn(e):this.getFn(e,t.path);if(a(o))if(n(o)){let e=[];const t=[{nestedArrIndex:-1,value:o}];for(;t.length;){const{nestedArrIndex:i,value:s}=t.pop();if(a(s))if(r(s)&&!c(s)){let t={v:s,i:i,n:this.norm.get(s)};e.push(t)}else n(s)&&s.forEach(((e,i)=>{t.push({nestedArrIndex:i,value:e})}))}i.$[s]=e}else if(r(o)&&!c(o)){let e={v:o,n:this.norm.get(o)};i.$[s]=e}})),this.records.push(i)}toJSON(){return{keys:this.keys,records:this.records}}}function _(e,t,{getFn:i=m.getFn,fieldNormWeight:n=m.fieldNormWeight}={}){const r=new g({getFn:i,fieldNormWeight:n});return r.setKeys(e.map(d)),r.setSources(t),r.create(),r}function y(e,{errors:t=0,currentLocation:i=0,expectedLocation:n=0,distance:r=m.distance,ignoreLocation:s=m.ignoreLocation}={}){const o=t/e.length;if(s)return o;const a=Math.abs(n-i);return r?o+a/r:a?1:o}const E=32;function b(e){let t={};for(let i=0,n=e.length;i{this.chunks.push({pattern:e,alphabet:b(e),startIndex:t})},h=this.pattern.length;if(h>E){let e=0;const t=h%E,i=h-t;for(;e{const{isMatch:f,score:v,indices:g}=function(e,t,i,{location:n=m.location,distance:r=m.distance,threshold:s=m.threshold,findAllMatches:o=m.findAllMatches,minMatchCharLength:a=m.minMatchCharLength,includeMatches:c=m.includeMatches,ignoreLocation:l=m.ignoreLocation}={}){if(t.length>E)throw new Error("Pattern length exceeds max of 32.");const h=t.length,u=e.length,d=Math.max(0,Math.min(n,u));let p=s,f=d;const v=a>1||c,g=v?Array(u):[];let _;for(;(_=e.indexOf(t,f))>-1;){let e=y(t,{currentLocation:_,expectedLocation:d,distance:r,ignoreLocation:l});if(p=Math.min(e,p),f=_+h,v){let e=0;for(;e=c;s-=1){let o=s-1,a=i[e.charAt(o)];if(v&&(g[o]=+!!a),_[s]=(_[s+1]<<1|1)&a,n&&(_[s]|=(b[s+1]|b[s])<<1|1|b[s+1]),_[s]&I&&(S=y(t,{errors:n,currentLocation:o,expectedLocation:d,distance:r,ignoreLocation:l}),S<=p)){if(p=S,f=o,f<=d)break;c=Math.max(1,2*d-f)}}if(y(t,{errors:n+1,currentLocation:d,expectedLocation:d,distance:r,ignoreLocation:l})>p)break;b=_}const C={isMatch:f>=0,score:Math.max(.001,S)};if(v){const e=function(e=[],t=m.minMatchCharLength){let i=[],n=-1,r=-1,s=0;for(let o=e.length;s=t&&i.push([n,r]),n=-1)}return e[s-1]&&s-n>=t&&i.push([n,s-1]),i}(g,a);e.length?c&&(C.indices=e):C.isMatch=!1}return C}(e,t,d,{location:n+p,distance:r,threshold:s,findAllMatches:o,minMatchCharLength:a,includeMatches:i,ignoreLocation:c});f&&(u=!0),h+=v,f&&g&&(l=[...l,...g])}));let d={isMatch:u,score:u?h/this.chunks.length:1};return u&&i&&(d.indices=l),d}}class O{constructor(e){this.pattern=e}static isMultiMatch(e){return I(e,this.multiRegex)}static isSingleMatch(e){return I(e,this.singleRegex)}search(){}}function I(e,t){const i=e.match(t);return i?i[1]:null}class C extends O{constructor(e,{location:t=m.location,threshold:i=m.threshold,distance:n=m.distance,includeMatches:r=m.includeMatches,findAllMatches:s=m.findAllMatches,minMatchCharLength:o=m.minMatchCharLength,isCaseSensitive:a=m.isCaseSensitive,ignoreLocation:c=m.ignoreLocation}={}){super(e),this._bitapSearch=new S(e,{location:t,threshold:i,distance:n,includeMatches:r,findAllMatches:s,minMatchCharLength:o,isCaseSensitive:a,ignoreLocation:c})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class T extends O{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,i=0;const n=[],r=this.pattern.length;for(;(t=e.indexOf(this.pattern,i))>-1;)i=t+r,n.push([t,i-1]);const s=!!n.length;return{isMatch:s,score:s?0:1,indices:n}}}const L=[class extends O{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},T,class extends O{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},class extends O{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends O{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends O{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},class extends O{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},C],w=L.length,A=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,M=new Set([C.type,T.type]);const P=[];function x(e,t){for(let i=0,n=P.length;i!(!e.$and&&!e.$or),j=e=>({[N]:Object.keys(e).map((t=>({[t]:e[t]})))});function F(e,t,{auto:i=!0}={}){const s=e=>{let a=Object.keys(e);const c=(e=>!!e.$path)(e);if(!c&&a.length>1&&!D(e))return s(j(e));if((e=>!n(e)&&o(e)&&!D(e))(e)){const n=c?e.$path:a[0],s=c?e.$val:e[n];if(!r(s))throw new Error((e=>`Invalid value for key ${e}`)(n));const o={keyId:f(n),pattern:s};return i&&(o.searcher=x(s,t)),o}let l={children:[],operator:a[0]};return a.forEach((t=>{const i=e[t];n(i)&&i.forEach((e=>{l.children.push(s(e))}))})),l};return D(e)||(e=j(e)),s(e)}function k(e,t){const i=e.matches;t.matches=[],a(i)&&i.forEach((e=>{if(!a(e.indices)||!e.indices.length)return;const{indices:i,value:n}=e;let r={indices:i,value:n};e.key&&(r.key=e.key.src),e.idx>-1&&(r.refIndex=e.idx),t.matches.push(r)}))}function K(e,t){t.score=e.score}class R{constructor(e,t={},i){this.options={...m,...t},this.options.useExtendedSearch,this._keyStore=new u(this.options.keys),this.setCollection(e,i)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof g))throw new Error("Incorrect 'index' type");this._myIndex=t||_(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){a(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=(()=>!1)){const t=[];for(let i=0,n=this._docs.length;i{let i=1;e.matches.forEach((({key:e,norm:n,score:r})=>{const s=e?e.weight:null;i*=Math.pow(0===r&&s?Number.EPSILON:r,(s||1)*(t?1:n))})),e.score=i}))}(l,{ignoreFieldNorm:c}),o&&l.sort(a),s(t)&&t>-1&&(l=l.slice(0,t)),function(e,t,{includeMatches:i=m.includeMatches,includeScore:n=m.includeScore}={}){const r=[];return i&&r.push(k),n&&r.push(K),e.map((e=>{const{idx:i}=e,n={item:t[i],refIndex:i};return r.length&&r.forEach((t=>{t(e,n)})),n}))}(l,this._docs,{includeMatches:i,includeScore:n})}_searchStringList(e){const t=x(e,this.options),{records:i}=this._myIndex,n=[];return i.forEach((({v:e,i:i,n:r})=>{if(!a(e))return;const{isMatch:s,score:o,indices:c}=t.searchIn(e);s&&n.push({item:e,idx:i,matches:[{score:o,value:e,norm:r,indices:c}]})})),n}_searchLogical(e){const t=F(e,this.options),i=(e,t,n)=>{if(!e.children){const{keyId:i,searcher:r}=e,s=this._findMatches({key:this._keyStore.get(i),value:this._myIndex.getValueForItemAtKeyId(t,i),searcher:r});return s&&s.length?[{idx:n,item:t,matches:s}]:[]}const r=[];for(let s=0,o=e.children.length;s{if(a(e)){let o=i(t,e,n);o.length&&(r[n]||(r[n]={idx:n,item:e,matches:[]},s.push(r[n])),o.forEach((({matches:e})=>{r[n].matches.push(...e)})))}})),s}_searchObjectList(e){const t=x(e,this.options),{keys:i,records:n}=this._myIndex,r=[];return n.forEach((({$:e,i:n})=>{if(!a(e))return;let s=[];i.forEach(((i,n)=>{s.push(...this._findMatches({key:i,value:e[n],searcher:t}))})),s.length&&r.push({idx:n,item:e,matches:s})})),r}_findMatches({key:e,value:t,searcher:i}){if(!a(t))return[];let r=[];if(n(t))t.forEach((({v:t,i:n,n:s})=>{if(!a(t))return;const{isMatch:o,score:c,indices:l}=i.searchIn(t);o&&r.push({score:c,key:e,value:t,idx:n,norm:s,indices:l})}));else{const{v:n,n:s}=t,{isMatch:o,score:a,indices:c}=i.searchIn(n);o&&r.push({score:a,key:e,value:n,norm:s,indices:c})}return r}}R.version="6.6.2",R.createIndex=_,R.parseIndex=function(e,{getFn:t=m.getFn,fieldNormWeight:i=m.fieldNormWeight}={}){const{keys:n,records:r}=e,s=new g({getFn:t,fieldNormWeight:i});return s.setKeys(n),s.setIndexRecords(r),s},R.config=m,R.parseQuery=F,function(...e){P.push(...e)}(class{constructor(e,{isCaseSensitive:t=m.isCaseSensitive,includeMatches:i=m.includeMatches,minMatchCharLength:n=m.minMatchCharLength,ignoreLocation:r=m.ignoreLocation,findAllMatches:s=m.findAllMatches,location:o=m.location,threshold:a=m.threshold,distance:c=m.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:i,minMatchCharLength:n,findAllMatches:s,ignoreLocation:r,location:o,threshold:a,distance:c},this.pattern=t?e:e.toLowerCase(),this.query=function(e,t={}){return e.split("|").map((e=>{let i=e.trim().split(A).filter((e=>e&&!!e.trim())),n=[];for(let e=0,r=i.length;e . +@prefix xsd: . +@prefix fim: . +@prefix ff: . +@prefix sh: . +@prefix foaf: . + +ff:hasFirstNames a ff:FimDataFieldProperty, ff:DataField ; + ff:hasFimId fim:F00000154 ; + ff:hasFimVersion "1.3" ; + ff:hasFimUrl "https://schema.fim.fitko.net/fields/baukasten/F00000154/1.3" ; + rdfs:label "Vornamen: Vorname + Mittelnamen" ; + rdfs:comment "Plural zu Vorname" ; + ff:similarDatafield foaf:firstName ; + ff:hasShaclShape ff:FirstNamesShape . +ff:FirstNamesShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:hasFirstNames ; + sh:datatype xsd:string ; + sh:maxCount 1 ; + ] . + +ff:hasFamilyName a ff:FimDataFieldProperty, ff:DataField ; + ff:hasFimId fim:F00000013 ; + ff:hasFimVersion "1.5" ; + ff:hasFimUrl "https://schema.fim.fitko.net/fields/baukasten/F00000013/1.5" ; + rdfs:label "Familienname" ; + rdfs:comment "Familienname einer natürlichen Person bestehend aus Nachname, Zuname bzw. Familienname." ; + ff:similarDatafield foaf:lastName ; + ff:hasShaclShape ff:FamilyNameShape . +ff:FamilyNameShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:hasFamilyName ; + sh:datatype xsd:string ; + sh:maxCount 1 ; + ] . + +ff:hasBirthday a ff:FimDataFieldProperty, ff:DataField ; + ff:hasFimId fim:F03008235 ; + ff:hasFimVersion "2.0" ; + ff:hasFimUrl "https://schema.fim.fitko.net/fields/baukasten/F03008235/2.0" ; + rdfs:label "Geburtsdatum" ; + rdfs:comment "Dieses Feld beinhaltet das Geburtsdatum, also Tag, Monat und Jahr der Vollendung der Geburt." ; + ff:similarDatafield foaf:birthday ; + ff:hasShaclShape ff:BirthdayShape . +ff:BirthdayShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:hasBirthday ; + sh:datatype xsd:date ; + sh:maxCount 1 ; + ] . + +ff:hasGender a ff:FimDataFieldProperty, ff:DataField ; + ff:hasFimId fim:F60000332 ; + ff:hasFimVersion "1.3" ; + ff:hasFimUrl "https://schema.fim.fitko.net/fields/baukasten/F60000332/1.3" ; + rdfs:label "Geschlecht" ; + rdfs:comment "Beschreibt das Geschlecht einer Person. Folgende Angaben sind möglich: divers, männlich, weiblich, keine Angabe" ; + ff:hasShaclShape ff:GenderShape . +ff:GenderShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:hasGender ; + sh:in ("weiblich" "männlich" "divers" "keine Angabe") ; + sh:maxCount 1 ; + rdfs:seeAlso + ] . + +ff:hasBirthPlace a ff:FimDataFieldProperty, ff:DataField ; + ff:hasFimId fim:F00000067 ; + ff:hasFimVersion "1.3" ; + ff:hasFimUrl "https://schema.fim.fitko.net/fields/baukasten/F00000067/1.3" ; + rdfs:label "Geburtsort" ; + rdfs:comment "Der Ort der Geburt einer natürlichen Person." ; + ff:hasShaclShape ff:BirthPlaceShape . +ff:BirthPlaceShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:hasBirthPlace ; + sh:datatype xsd:string ; + sh:maxCount 1 ; + ] . + +ff:hasResidence a ff:FimDataFieldProperty, ff:DataField ; + ff:hasFimId fim:F03010085 ; + ff:hasFimVersion "1.0" ; + ff:hasFimUrl "https://schema.fim.fitko.net/fields/baukasten/F03010085/1.0" ; + rdfs:label "Wohnort" ; + rdfs:comment "Enthält den Namen eines Ortes (Gemeinde, Ortschaft oder Stadt)." ; + ff:hasShaclShape ff:ResidenceShape . +ff:ResidenceShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:hasResidence ; + sh:datatype xsd:string ; + sh:maxCount 1 ; + ] . + +ff:hasMaritalStatus a ff:FimDataFieldProperty, ff:DataField ; + ff:hasFimId fim:F00000559 ; + ff:hasFimVersion "1.3" ; + ff:hasFimUrl "https://schema.fim.fitko.net/fields/baukasten/F00000559/1.3" ; + rdfs:label "Familienstand" ; + ff:hasShaclShape ff:MaritalStatusShape . +ff:MaritalStatusShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:hasMaritalStatus ; + sh:in ("LD" "VH" "VW" "GS" "EA" "LP" "LV" "LA" "LE" "NB") ; + sh:maxCount 1 ; + ff:shInAbbrevationsStandFor ("ledig" "verheiratet" "verwitwet" "geschieden" "Ehe aufgehoben" "in eingetragener Lebenspartnerschaft" "durch Tod aufgelöste Lebenspartnerschaft" "aufgehobene Lebenspartnerschaft" "durch Todeserklärung aufgelöste Lebenspartnerschaft" "nicht bekannt") ; + rdfs:seeAlso + ] . + +ff:eligibleForSocialSupport a ff:DataField ; + rdfs:label "Sozialbedürftig" ; + rdfs:comment "This is a shortcut for demo purposes" ; + ff:hasShaclShape ff:EligibleForSocialSupportShape . +ff:EligibleForSocialSupportShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:eligibleForSocialSupport ; + sh:datatype xsd:boolean ; + ] . + +ff:worksAsFreelancer a ff:DataField ; + rdfs:label "Selbstständige Tätigkeiten" ; + ff:hasShaclShape ff:WorksAsFreelancerShape . +ff:WorksAsFreelancerShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:worksAsFreelancer ; + sh:datatype xsd:boolean ; + ] . + +# ------------------------------------------------------ + +ff:hasAge a ff:DataField ; + rdfs:label "Alter" ; + ff:similarDatafield foaf:age ; + ff:hasShaclShape ff:AgeShape . +ff:AgeShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:hasAge ; + sh:datatype xsd:integer ; + sh:minInclusive 0 ; + sh:maxCount 1 ; + ] . + +ff:paysRentCold a ff:FimDataFieldProperty, ff:DataField ; + ff:hasFimId fim:F00000240 ; + ff:hasFimVersion "1.5" ; + rdfs:label "Höhe der Miete" ; + ff:hasShaclShape ff:paysRentColdShape . +ff:paysRentColdShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:paysRentCold ; + sh:datatype xsd:integer ; + sh:maxCount 1 ; + sh:minInclusive 0 ; + ] . + +ff:hasLivingArea a ff:FimDataFieldProperty, ff:DataField ; + ff:hasFimId fim:F00003175 ; + ff:hasFimVersion "1.0" ; + rdfs:label "Wohnfläche in m²" ; + ff:hasShaclShape ff:hasLivingAreaShape . +ff:hasLivingAreaShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:hasLivingArea ; + sh:datatype xsd:integer ; + sh:minInclusive 0 ; + sh:maxCount 1 ; + ] . + +ff:hasNumberOfChildren a ff:FimDataFieldProperty, ff:DataField ; + ff:hasFimId fim:F05011522 ; + ff:hasFimVersion "1.0" ; + rdfs:label "Anzahl Kinder" ; + rdfs:comment "Angabe der Anzahl der im Haushalt lebenden Kinder." . +ff:hasNumberOfChildrenShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:hasNumberOfChildren ; + sh:datatype xsd:integer ; + sh:minInclusive 0 ; + sh:maxCount 1 ; + ] . + +ff:hasIncomeBrutto a ff:FimDataFieldProperty, ff:DataField ; + ff:hasFimId fim:F00000575 ; + ff:hasFimVersion "1.1" ; + rdfs:label "Höhe des Einkommens (Brutto)" ; + ff:hasShaclShape ff:hasIncomeBruttoShape . +ff:hasIncomeBruttoShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:hasIncomeBrutto ; + sh:datatype xsd:integer ; + sh:minInclusive 0 ; + sh:maxCount 1 ; + ] . + +ff:hasIncomeNetto a ff:FimDataFieldProperty, ff:DataField ; + ff:hasFimId fim:F00001158 ; + ff:hasFimVersion "1.0" ; + rdfs:label "Nettoeinkommen monatlich" ; + ff:hasShaclShape ff:hasIncomeNettoShape . +ff:hasIncomeNettoShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:hasIncomeNetto ; + sh:datatype xsd:integer ; + sh:minInclusive 0 ; + sh:maxCount 1 ; + ] . + +ff:receivesKindergeld a ff:FimLeistung, ff:DataField ; + ff:hasFimId 576982 ; + ff:hasLeiKaId 99041008000000 ; + rdfs:label "Kindergeld" . + +ff:parentingSetup a ff:DataField ; + rdfs:label "Erziehungsverantwortung" ; +ff:hasShaclShape ff:parentingSetupShape . +ff:parentingSetupShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:parentingSetup ; + sh:in (ff:Alleinerziehend ff:Elternpaar) ; + ] . + +ff:receivesWohngeld a ff:DataField ; + rdfs:label "Wohngeld" ; + ff:hasShaclShape ff:receivesWohngeldShape . +ff:receivesWohngeldShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:receivesWohngeld ; + sh:datatype xsd:integer ; + sh:minInclusive 0 ; + sh:maxCount 1 ; + ] . + +ff:hasChild a ff:DataField ; + rdfs:label "Kind" ; + ff:hasShaclShape ff:hasChildShape . +ff:hasChildShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:hasChild ; + sh:class ff:Child ; + ] . + +ff:Child a ff:Class ; + rdfs:label "Kind" . + +ff:devHasToy a ff:DataField ; + rdfs:label "Spielzeug" ; + ff:hasShaclShape ff:devHasToyShape . +ff:devHasToyShape a sh:NodeShape ; + sh:targetClass ff:Child ; + sh:property [ + sh:path ff:devHasToy ; + sh:class ff:DevToy ; + ] . + +ff:DevToy a ff:Class ; + rdfs:label "Spielzeug" . + +ff:hasEmploymentStatus a ff:DataField ; + rdfs:label "Beschäftigungsverhältnis" ; + ff:hasShaclShape ff:hasEmploymentStatusShape . + +ff:hasEmploymentStatusShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + ff:modelledAfter ; + sh:property [ + sh:path ff:hasEmploymentStatus ; + sh:in ( "Angestellt" "Selbststaendig" "Ausbildung" "Arbeitslos" "Gefoerderte Ausbildung" ) ; + ] . diff --git a/assets/requirement-profiles/manifest.ttl b/assets/requirement-profiles/manifest.ttl new file mode 100644 index 0000000..d52d007 --- /dev/null +++ b/assets/requirement-profiles/manifest.ttl @@ -0,0 +1,21 @@ +@prefix ff: . +@prefix schema: . +@prefix dcterms: . + +ff:datafieldsFile a schema:DigitalDocument ; + schema:identifier "datafields-file" ; + dcterms:format "text/turtle" ; + ff:relativePath "datafields.ttl" . + +ff:materializationFile a schema:DigitalDocument ; + schema:identifier "materialization-file" ; + dcterms:format "text/turtle" ; + ff:relativePath "materialization.ttl" . + +ff:requirementProfilesFolder a schema:Collection ; + schema:identifier "requirement-profiles-folder" ; + ff:relativePath "shacl/" . + +ff:userProfileExamplesFolder a schema:Collection ; + schema:identifier "user-profile-examples-folder" ; + ff:relativePath "user-profile-examples/" . diff --git a/assets/requirement-profiles/materialization.ttl b/assets/requirement-profiles/materialization.ttl new file mode 100644 index 0000000..0e94f5f --- /dev/null +++ b/assets/requirement-profiles/materialization.ttl @@ -0,0 +1,54 @@ +@prefix rdfs: . +@prefix xsd: . +@prefix ff: . + +# MATERIALIZATION RULES + +ff:CalculateAgeFromBirthdate a ff:MaterializationRule, ff:SparqlRule ; + rdfs:label "Calculate the age from the birthdate" ; + ff:input ff:hasBirthday ; + ff:output ff:hasAge ; + ff:suggestPermanentMaterialization true ; + ff:ifPermanentlyMaterializedAddPeriodicCheck "on-app-startup" ; + ff:sparqlConstructQuery """ + PREFIX ff: + CONSTRUCT { + ?person ff:hasAge ?age . + } WHERE { + ?person ff:hasBirthday ?bday . + BIND(YEAR(NOW()) - YEAR(?bday) - IF(MONTH(NOW()) < MONTH(?bday) || (MONTH(NOW()) = MONTH(?bday) && DAY(NOW()) < DAY(?bday)), 1, 0) AS ?age) . + } + """ . + +ff:DeriveStateFromCity a ff:MaterializationRule, ff:SparqlRule ; + rdfs:label "Derive the federal state someone lives in based on their residence city" ; + ff:input ff:hasResidence ; + ff:output ff:residesInState ; + ff:sparqlConstructQuery """ + PREFIX ff: + CONSTRUCT { + ?person ff:residesInState ?state . + } WHERE { + ?person ff:hasResidence ?city . + ff:CityStateMap ff:mappedCityToState ?mapping . + ?mapping ff:city ?city ; + ff:state ?state . + } + """ . + +# CONSTANTS + +ff:CityStateMap a ff:MapOfConstants ; + rdfs:comment "Mapping of German cities to their respective federal states (Bundesland)" ; + ff:mappedCityToState [ + ff:city "Jena" ; + ff:state "Thüringen" + ] ; + ff:mappedCityToState [ + ff:city "München" ; + ff:state "Bayern" + ] ; + ff:mappedCityToState [ + ff:city "Berlin" ; + ff:state "Berlin" + ] . diff --git a/assets/requirement-profiles/meta.ttl b/assets/requirement-profiles/meta.ttl new file mode 100644 index 0000000..ccec508 --- /dev/null +++ b/assets/requirement-profiles/meta.ttl @@ -0,0 +1,8 @@ +@prefix ff: . +@prefix cccev: . # Core Criterion and Core Evidence Vocabulary https://github.com/SEMICeu/CCCEV + +ff:RequirementProfile a cccev:Criterion . + +ff:EligibilityConstraint a cccev:Constraint . + +ff:DataField a cccev:Evidence . diff --git a/assets/requirement-profiles/shacl/arbeitslosengeld.ttl b/assets/requirement-profiles/shacl/arbeitslosengeld.ttl new file mode 100644 index 0000000..2661033 --- /dev/null +++ b/assets/requirement-profiles/shacl/arbeitslosengeld.ttl @@ -0,0 +1,33 @@ +@prefix sh: . +@prefix xsd: . +@prefix ff: . +@prefix fim: . +@prefix rdfs: . + +ff:arbeitslosengeld a ff:RequirementProfile ; + ff:author ff:benglaeser ; + ff:created "2024-04-04"^^xsd:date ; + ff:title "Arbeitslosengeld" ; + ff:category ff:Sozialleistung ; + rdfs:seeAlso + . + +ff:MainPersonShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ sh:path ff:hasEmploymentStatus ; + sh:minCount 1 ; + sh:maxCount 1 ; ] ; + sh:property [ sh:path ff:hasAnwartschaftszeit ; + sh:minCount 1 ; + sh:maxCount 1 ; ] . + +ff:EmploymentStatusCheckShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ sh:path ff:hasEmploymentStatus ; + sh:in ( "Arbeitslos" "Gefoerderte Ausbildung" ) ] . + +ff:AnwartschaftszeitCheckShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ sh:path ff:hasAnwartschaftszeit ; + sh:datatype xsd:integer ; + sh:minInclusive 12 ] . diff --git a/assets/requirement-profiles/shacl/bildungsgutschein.ttl b/assets/requirement-profiles/shacl/bildungsgutschein.ttl new file mode 100644 index 0000000..9e121ae --- /dev/null +++ b/assets/requirement-profiles/shacl/bildungsgutschein.ttl @@ -0,0 +1,18 @@ +@prefix sh: . +@prefix xsd: . +@prefix ff: . +@prefix rdfs: . + +ff:bildungsgutschein a ff:RequirementProfile ; + ff:author ff:benglaeser ; + ff:created "2024-04-02"^^xsd:date ; + ff:title "Bildungsgutschein" ; + ff:category ff:Bildungsteilhabe ; + rdfs:comment "Checks for eligibility for the Bildungsgutschein" ; + rdfs:seeAlso . + +ff:BildungsgutscheinCitizenshipShape + a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:nodeKind sh:IRI ; + sh:message "The entity must be of type ff:Citizen to be eligible for Bildungsgutschein." . diff --git a/assets/requirement-profiles/shacl/dev-child-toy.ttl b/assets/requirement-profiles/shacl/dev-child-toy.ttl new file mode 100644 index 0000000..275a9cc --- /dev/null +++ b/assets/requirement-profiles/shacl/dev-child-toy.ttl @@ -0,0 +1,40 @@ +@prefix sh: . +@prefix ff: . + +ff:devChildToy a ff:RequirementProfile ; + ff:title "Spielzeug dev" . + +ff:MainPersonShape a sh:NodeShape, ff:EligibilityConstraint ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:hasChild ; + sh:node ff:ChildShape ; + sh:minCount 1 ; + sh:message "The child doesn't exist or doesn't fulfill all criteria" ; + ] . + +ff:ChildShape a sh:NodeShape ; + sh:targetObjectsOf ff:hasChild ; + sh:property [ + sh:path ff:hasAge ; + sh:maxExclusive 18 ; + sh:minCount 1 ; + sh:maxCount 1 ; + sh:message "The child must be under 18 years old" ; + ] ; + sh:property [ + sh:path ff:devHasToy ; + sh:node ff:DevToyShape ; + sh:minCount 1 ; + sh:message "The toy of the child doesn't exist or doesn't fulfill all criteria" ; + ] . + +ff:DevToyShape a sh:NodeShape ; + sh:targetObjectsOf ff:devHasToy ; + sh:property [ + sh:path ff:hasAge ; + sh:maxExclusive 5 ; + sh:minCount 1 ; + sh:maxCount 1 ; + sh:message "The toy must be under 5 years old" ; + ] . diff --git a/assets/requirement-profiles/shacl/dev-daemmung.ttl b/assets/requirement-profiles/shacl/dev-daemmung.ttl new file mode 100644 index 0000000..1e77561 --- /dev/null +++ b/assets/requirement-profiles/shacl/dev-daemmung.ttl @@ -0,0 +1,16 @@ +@prefix ff: . +@prefix sh: . +@prefix xsd: . +@prefix rdf: . + +ff:daemmung a ff:RequirementProfile ; + ff:title "Dämmungszuschuss" ; + ff:category ff:Waermewende . + +ff:MainPersonShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:hasIncomeBrutto ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] . diff --git a/assets/requirement-profiles/shacl/dev-eauto.ttl b/assets/requirement-profiles/shacl/dev-eauto.ttl new file mode 100644 index 0000000..f897d36 --- /dev/null +++ b/assets/requirement-profiles/shacl/dev-eauto.ttl @@ -0,0 +1,17 @@ +@prefix ff: . +@prefix sh: . +@prefix xsd: . +@prefix rdf: . + +ff:eauto a ff:RequirementProfile ; + ff:title "E-Auto Zuschuss" ; + ff:category ff:Klimaschutz . + +ff:MainPersonShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:hasResidence ; + sh:in ("Berlin") ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] . diff --git a/assets/requirement-profiles/shacl/dev-kindergeld.ttl b/assets/requirement-profiles/shacl/dev-kindergeld.ttl new file mode 100644 index 0000000..21deb92 --- /dev/null +++ b/assets/requirement-profiles/shacl/dev-kindergeld.ttl @@ -0,0 +1,16 @@ +@prefix sh: . +@prefix ff: . +@prefix xsd: . +@prefix rdf: . + +ff:kindergeld a ff:RequirementProfile ; + ff:title "Kindergeld" ; + ff:category ff:Sozialleistung . + +ff:MainPersonShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:hasIncomeBrutto ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] . diff --git a/assets/requirement-profiles/shacl/dev-solar.ttl b/assets/requirement-profiles/shacl/dev-solar.ttl new file mode 100644 index 0000000..a3f8cff --- /dev/null +++ b/assets/requirement-profiles/shacl/dev-solar.ttl @@ -0,0 +1,21 @@ +@prefix ff: . +@prefix sh: . +@prefix xsd: . +@prefix rdf: . + +ff:solar a ff:RequirementProfile ; + ff:author ff:benjaminaaron ; + ff:created "2023-10-26"^^xsd:date ; + ff:title "Solarpanel Förderung" ; + ff:category ff:Waermewende, ff:Klimaschutz ; + ff:targetGroup ff:Citizen ; + ff:fundingProvider ff:GermanState . + +ff:MainPersonShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:hasResidence ; + sh:in ("Berlin") ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] . diff --git a/assets/requirement-profiles/shacl/dev-wohngeld.ttl b/assets/requirement-profiles/shacl/dev-wohngeld.ttl new file mode 100644 index 0000000..84edd5f --- /dev/null +++ b/assets/requirement-profiles/shacl/dev-wohngeld.ttl @@ -0,0 +1,19 @@ +@prefix ff: . +@prefix sh: . +@prefix xsd: . +@prefix rdf: . + +ff:wohngelddev a ff:RequirementProfile ; + ff:author ff:benjaminaaron ; + ff:created "2023-11-01"^^xsd:date ; + ff:title "Wohngeld dev" ; + ff:targetGroup ff:Citizen ; + ff:fundingProvider ff:GermanState . + +ff:MainPersonShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:paysRentCold ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] . diff --git a/assets/requirement-profiles/shacl/kinderzuschlag.ttl b/assets/requirement-profiles/shacl/kinderzuschlag.ttl new file mode 100644 index 0000000..e9fd948 --- /dev/null +++ b/assets/requirement-profiles/shacl/kinderzuschlag.ttl @@ -0,0 +1,250 @@ +@prefix sh: . +@prefix xsd: . +@prefix ff: . +@prefix rdfs: . + +ff:kinderzuschlag a ff:RequirementProfile ; + ff:author ff:benjaminaaron ; + ff:created "2024-03-14"^^xsd:date ; + ff:title "Kinderzuschlag" ; + ff:category ff:Sozialleistung ; + ff:validFor "P6M"^^xsd:duration ; # suggest setting up reminder TODO + rdfs:seeAlso ; + ff:onlineEligibilityCheckingTool . + +# CONDITIONS + +ff:MainPersonShape a sh:NodeShape, ff:EligibilityConstraint ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:parentingSetup ; + sh:minCount 1 ; + sh:maxCount 1 ; # Rely on datafields.ttl to ensure this? + ] ; + sh:property [ + sh:path ff:hasIncomeBrutto ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] ; + sh:property [ + sh:path ff:hasIncomeNetto ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] ; + sh:property [ + sh:path ff:paysRentCold ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] ; + sh:property [ + sh:path ff:receivesWohngeld ; + sh:message "[optional]" ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] ; + sh:property [ + sh:path ff:hasChild ; + sh:node ff:ChildShape ; + sh:minCount 1 ; + sh:message "The child doesn't exist or doesn't fulfill all criteria" ; + ] ; + sh:property [ + sh:path ff:hasGesamtbedarf ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] ; + sh:property [ + sh:path ff:hasGesamtverfuegung ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] ; + sh:property [ + sh:path ff:hasGesamtverfuegungPlusKinderzuschlag ; + sh:minCount 1 ; + sh:maxCount 1 ; + ] . + +ff:ChildShape a sh:NodeShape ; + sh:targetObjectsOf ff:hasChild ; + sh:property [ + sh:path ff:hasAge ; + sh:maxExclusive 25 ; + sh:minCount 1 ; + sh:maxCount 1 ; + sh:message "The child must be under 25 years old" ; + ] ; + sh:property [ + sh:path ff:hasMaritalStatus ; + sh:minCount 1 ; + sh:maxCount 1 ; + sh:not [ + sh:in ( "VH" "LP" ) ; + ] ; + sh:message "The child can't be married or in a civil union" ; + ] ; + sh:property [ + sh:path ff:receiveKindergeld ; + sh:minCount 1 ; + sh:maxCount 1 ; + sh:message "You must receive Kindergeld for the child" ; + ] . + +ff:IncomeCheckShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:sparql [ + a sh:SPARQLConstraint ; + sh:message "Für Alleinerziehende muss das Bruttoeinkommen mindestens 600 sein, für Elternpaare mindestens 900." ; + sh:select """ + PREFIX ff: + SELECT $this WHERE { + $this ff:parentingSetup ?parentingSetup . + $this ff:hasIncomeBrutto ?income . + FILTER ( + (?parentingSetup = ff:Alleinerziehend && ?income < 600) || + (?parentingSetup = ff:Elternpaar && ?income < 900) + ) + } + """ ; + ] . + +ff:GesamtverfuegungGeringerAlsGesamtbedarfShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:sparql [ + a sh:SPARQLConstraint ; + sh:message "Die Familie kann mit ihrer Gesamtverfügung ohne Kinderzuschlag ihren Gesamtbedarf decken --> ein Anspruch auf Kinderzuschlag besteht daher nicht" ; + sh:select """ + PREFIX ff: + SELECT $this WHERE { + $this ff:hasGesamtbedarf ?gesamtbedarf . + $this ff:hasGesamtverfuegung ?gesamtverfuegung . + FILTER(?gesamtbedarf < ?gesamtverfuegung) . + } + """ ; + ] . + +ff:GesamtverfuegungPlusKinderzuschlagDecktGesamtbedarfShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:sparql [ + a sh:SPARQLConstraint ; + sh:message "Die Familie kann mit ihrer Gesamtverfügung plus Kinderzuschlag ihren Gesamtbedarf nicht decken --> es besteht eine Hilfebedürftigkeit nach dem SGB 2, ein Anspruch auf Kinderzuschlag besteht daher nicht" ; + sh:select """ + PREFIX ff: + SELECT $this WHERE { + $this ff:hasGesamtbedarf ?gesamtbedarf . + $this ff:hasGesamtverfuegungPlusKinderzuschlag ?gesamtverfuegungPlus . + FILTER(?gesamtbedarf > ?gesamtverfuegungPlus) . + } + """ ; + ] . + +# CONSTANTS + +ff:RegelbedarfeSgb2 a ff:TableOfConstants ; + rdfs:comment "Werte gültig seit 2024-01-01" ; + rdfs:seeAlso ; + ff:hasRow ff:Alleinerziehend ; + ff:hasRow ff:Elternpaar ; + ff:hasRow ff:KindU6 ; + ff:hasRow ff:Kind6_U14 ; + ff:hasRow ff:Jugendliche14_U18 ; + ff:hasRow ff:VolljaehrigesKind18_U25 . + +ff:Alleinerziehend ff:hatRegelbedarfParent 563 . +ff:Elternpaar ff:hatRegelbedarfParent 1012 ; + rdfs:comment "Zusammensetzung: 2 * 506" . +ff:KindU6 ff:hatRegelbedarfChild 357 ; + xsd:minInclusive 0 ; + xsd:maxExclusive 6 . +ff:Kind6_U14 ff:hatRegelbedarfChild 390 ; + xsd:minInclusive 6 ; + xsd:maxExclusive 14 . +ff:Jugendliche14_U18 ff:hatRegelbedarfChild 471 ; + xsd:minInclusive 14 ; + xsd:maxExclusive 18 . +ff:VolljaehrigesKind18_U25 ff:hatRegelbedarfChild 451 ; + xsd:minInclusive 18 ; + xsd:maxExclusive 25 . + +ff:KinderzuschlagPerChild a ff:Constant ; + ff:hasValue 292 . + +# MATERIALIZATION + +ff:CalculateGesamtbedarfFamilie a ff:SparqlFormula ; + rdfs:label "Berechne den Gesamtbedarf einer Familie" ; + ff:input ff:hasAge ; + ff:output ff:hasGesamtbedarf ; + ff:suggestPermanentMaterialization false ; + ff:sparqlConstructQuery """ + PREFIX ff: + + CONSTRUCT { + ff:mainPerson ff:hasGesamtbedarf ?gesamtbedarf . + } WHERE { + SELECT (SUM(?bedarf) AS ?gesamtbedarf) WHERE { + { + ff:mainPerson ff:parentingSetup ?parentingSetup . + ?parentingSetup ff:hatRegelbedarfParent ?bedarf . + } UNION { + ff:mainPerson ff:hasChild ?child . + ?child ff:hasAge ?age . + ?ageGroup xsd:minInclusive ?min ; + xsd:maxExclusive ?max . + FILTER(?age >= ?min && ?age < ?max) . + ?ageGroup ff:hatRegelbedarfChild ?bedarf . + } UNION { + ff:mainPerson ff:paysRentCold ?bedarf . + } + } + } + """ . + +ff:CalculateGesamtverfuegungFamilie a ff:SparqlFormula ; + rdfs:label "Berechne die Gesamtverfügung einer Familie" ; + ff:output ff:hasGesamtverfuegung ; + ff:suggestPermanentMaterialization false ; + ff:sparqlConstructQuery """ + PREFIX ff: + + CONSTRUCT { + ff:mainPerson ff:hasGesamtverfuegung ?gesamtverfuegung . + } WHERE { + SELECT (SUM(?income) AS ?gesamtverfuegung) WHERE { + { + ff:mainPerson ff:hasChild ?child . + ?child ff:receiveKindergeld ?income . + } UNION { + ff:mainPerson ff:hasIncomeNetto ?income . + } UNION { + ff:mainPerson ff:receivesWohngeld ?income . + } + } + } + """ . + +ff:CalculateGesamtverfuegungPlusKinderzuschlagFamilie a ff:SparqlFormula ; + rdfs:label "Berechne die Gesamtverfügung plus Kinderzuschläge einer Familie" ; + ff:input ff:hasGesamtverfuegung ; + ff:output ff:hasGesamtverfuegungPlusKinderzuschlag ; + ff:suggestPermanentMaterialization false ; + ff:sparqlConstructQuery """ + PREFIX ff: + + CONSTRUCT { + ff:mainPerson ff:hasGesamtverfuegungPlusKinderzuschlag ?total . + } WHERE { + SELECT (?gesamtverfuegung + ?kinderzuschlagSum AS ?total) WHERE { + ff:mainPerson ff:hasGesamtverfuegung ?gesamtverfuegung . + { + SELECT (?childrenCount * ?value AS ?kinderzuschlagSum) WHERE { + ff:KinderzuschlagPerChild ff:hasValue ?value . + { + SELECT (COUNT(?child) AS ?childrenCount) WHERE { + ff:mainPerson ff:hasChild ?child . + } + } + } + } + } + } + """ . diff --git a/assets/requirement-profiles/shacl/opendva-existenzgruendungspass-thueringen.ttl b/assets/requirement-profiles/shacl/opendva-existenzgruendungspass-thueringen.ttl new file mode 100644 index 0000000..db466bd --- /dev/null +++ b/assets/requirement-profiles/shacl/opendva-existenzgruendungspass-thueringen.ttl @@ -0,0 +1,29 @@ +@prefix sh: . +@prefix xsd: . +@prefix ff: . +@prefix rdfs: . + +ff:existenzgruendungspassthueringen a ff:RequirementProfile ; + ff:author ff:benjaminaaron ; + ff:created "2024-04-09"^^xsd:date ; + ff:title "Existenzgründungspass Thüringen" ; + rdfs:seeAlso . + +# CONDITIONS + +ff:MainPersonShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:worksAsFreelancer ; + sh:minCount 1 ; + sh:maxCount 1 ; + sh:message "Eine selbständige Tätigkeit darf noch nicht begonnen worden sein" ; + sh:in (false) ; + ] ; + sh:property [ + sh:path ff:residesInState ; + sh:in ("Thüringen") ; + sh:minCount 1 ; + sh:maxCount 1 ; + sh:message "Der Wohnort muss in Thüringen sein" + ] . diff --git a/assets/requirement-profiles/shacl/opendva-jenabonus.ttl b/assets/requirement-profiles/shacl/opendva-jenabonus.ttl new file mode 100644 index 0000000..0b6be8b --- /dev/null +++ b/assets/requirement-profiles/shacl/opendva-jenabonus.ttl @@ -0,0 +1,31 @@ +@prefix sh: . +@prefix xsd: . +@prefix ff: . +@prefix rdfs: . + +ff:jenabonus a ff:RequirementProfile ; + ff:author ff:benjaminaaron ; + ff:created "2024-04-09"^^xsd:date ; + ff:title "Jenabonus" ; + ff:category ff:Sozialleistung ; + ff:validFor "P1Y"^^xsd:duration ; + rdfs:seeAlso . + +# CONDITIONS + +ff:MainPersonShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:eligibleForSocialSupport ; + sh:minCount 1 ; + sh:maxCount 1 ; + sh:in (true) ; + sh:message "Eine Form von Sozialhilfe ist Voraussetzung" + ] ; + sh:property [ + sh:path ff:hasResidence ; + sh:in ("Jena") ; + sh:minCount 1 ; + sh:maxCount 1 ; + sh:message "Der Wohnort muss Jena sein" + ] . diff --git a/assets/requirement-profiles/shacl/senioren-bahncard.ttl b/assets/requirement-profiles/shacl/senioren-bahncard.ttl new file mode 100644 index 0000000..afae4f3 --- /dev/null +++ b/assets/requirement-profiles/shacl/senioren-bahncard.ttl @@ -0,0 +1,22 @@ +@prefix sh: . +@prefix xsd: . +@prefix ff: . +@prefix rdfs: . + +ff:seniorenbahncard a ff:RequirementProfile ; + ff:author ff:benjaminaaron ; + ff:created "2024-04-16"^^xsd:date ; + ff:title "Senioren BahnCard" ; + rdfs:seeAlso . + +# CONDITIONS + +ff:MainPersonShape a sh:NodeShape ; + sh:targetClass ff:Citizen ; + sh:property [ + sh:path ff:hasAge ; + sh:minInclusive 65 ; + sh:minCount 1 ; + sh:maxCount 1 ; + sh:message "The age must be at least 65" ; + ] . diff --git a/assets/requirement-profiles/user-profile-examples-registry.json b/assets/requirement-profiles/user-profile-examples-registry.json new file mode 100644 index 0000000..4672ca2 --- /dev/null +++ b/assets/requirement-profiles/user-profile-examples-registry.json @@ -0,0 +1,14 @@ +{ + "kinderzuschlag-user-profile": { + "name": "Kinderzuschlag User", + "description": "This is profile A" + }, + "opendva-user-profile": { + "name": "OpenDVA User", + "description": "This is profile B" + }, + "user-template": { + "name": "Template for new user", + "description": "This is Profile C" + } +} diff --git a/assets/requirement-profiles/user-profile-examples/dev-child-toy-user-profile.ttl b/assets/requirement-profiles/user-profile-examples/dev-child-toy-user-profile.ttl new file mode 100644 index 0000000..d23de9f --- /dev/null +++ b/assets/requirement-profiles/user-profile-examples/dev-child-toy-user-profile.ttl @@ -0,0 +1,11 @@ +@prefix ff: . + +ff:mainPerson a ff:Citizen ; + ff:hasChild ff:child0 . + +ff:child0 a ff:Child ; + ff:hasAge 14 ; + ff:devHasToy ff:toy0 . + +ff:toy0 a ff:DevToy ; + ff:hasAge 3 . diff --git a/assets/requirement-profiles/user-profile-examples/empty-user-profile.ttl b/assets/requirement-profiles/user-profile-examples/empty-user-profile.ttl new file mode 100644 index 0000000..b9551f4 --- /dev/null +++ b/assets/requirement-profiles/user-profile-examples/empty-user-profile.ttl @@ -0,0 +1,3 @@ +@prefix ff: . + +ff:mainPerson a ff:Citizen . diff --git a/assets/requirement-profiles/user-profile-examples/kinderzuschlag-user-profile.ttl b/assets/requirement-profiles/user-profile-examples/kinderzuschlag-user-profile.ttl new file mode 100644 index 0000000..77a07cd --- /dev/null +++ b/assets/requirement-profiles/user-profile-examples/kinderzuschlag-user-profile.ttl @@ -0,0 +1,34 @@ +@prefix xsd: . +@prefix ff: . + +ff:mainPerson a ff:Citizen ; + ff:hasFirstNames "Max" ; + ff:hasFamilyName "Mustermann" ; + ff:hasBirthday "1992-05-17"^^xsd:date ; + ff:paysRentCold 900 ; + ff:hasLivingArea 80 ; + ff:hasResidence "Berlin" ; + ff:parentingSetup ff:Elternpaar ; + ff:receivesWohngeld 450 ; + ff:hasIncomeBrutto 2700 ; + ff:hasIncomeNetto 1600 ; + ff:hasChild ff:child0 ; + ff:hasChild ff:child1 . + # following the example calculation on page 8 here: https://www.arbeitsagentur.de/datei/kiz2-merkblattkinderzuschlag_ba034485.pdf + # ff:hasGesamtbedarf 2773 ; + # ff:hasGesamtverfuegung 2550 ; + # ff:hasGesamtverfuegungPlusKinderzuschlag 3134 . + +ff:child0 a ff:Child ; + ff:hasFirstNames "Maria" ; + ff:hasFamilyName "Mustermann" ; + ff:hasBirthday "2013-01-23"^^xsd:date ; + # ff:hasAge 11 ; + ff:hasMaritalStatus "LD" ; # ledig + ff:receiveKindergeld 250 . + +ff:child1 a ff:Child ; + ff:hasBirthday "2008-02-15"^^xsd:date ; + # ff:hasAge 16 ; + ff:hasMaritalStatus "LD" ; + ff:receiveKindergeld 250 . diff --git a/assets/requirement-profiles/user-profile-examples/opendva-user-profile.ttl b/assets/requirement-profiles/user-profile-examples/opendva-user-profile.ttl new file mode 100644 index 0000000..a4024b5 --- /dev/null +++ b/assets/requirement-profiles/user-profile-examples/opendva-user-profile.ttl @@ -0,0 +1,14 @@ +@prefix xsd: . +@prefix ff: . + +ff:mainPerson a ff:Citizen ; + ff:hasFirstNames "Maria" ; + ff:hasFamilyName "Mustermann" ; + ff:hasBirthday "1994-12-06"^^xsd:date ; + ff:hasGender "weiblich" ; + ff:hasResidence "Jena" ; + ff:eligibleForSocialSupport true ; + ff:worksAsFreelancer false . + # ff:hasBirthPlace "Jena" ; + # ff:hasMaritalStatus "VH" ; + # ff:residesInState "Thüringen" ; <-- gets materialized in-memory during validation diff --git a/assets/shacl-files.txt b/assets/shacl-files.txt new file mode 100644 index 0000000..2779b53 --- /dev/null +++ b/assets/shacl-files.txt @@ -0,0 +1,12 @@ +arbeitslosengeld.ttl +bildungsgutschein.ttl +dev-child-toy.ttl +dev-daemmung.ttl +dev-eauto.ttl +dev-kindergeld.ttl +dev-solar.ttl +dev-wohngeld.ttl +kinderzuschlag.ttl +opendva-existenzgruendungspass-thueringen.ttl +opendva-jenabonus.ttl +senioren-bahncard.ttl diff --git a/index.html b/index.html new file mode 100644 index 0000000..2c9ca9a --- /dev/null +++ b/index.html @@ -0,0 +1,434 @@ + + + + + FörderFunke + + + + + + + + +

User profile

+
+
+ +
+ Reset + Import + Export + Show Turtle +

Missing data points

+
Set a focus:
+
+ +
Loading...
+
+

Report

+
Loading...
+
+ + + + diff --git a/utils.js b/utils.js new file mode 100644 index 0000000..0c1aa06 --- /dev/null +++ b/utils.js @@ -0,0 +1,83 @@ + +async function checkForNewRepoCommits() { + console.log("Checking for updates, old commit:", latestRPsRepoCommit) + let checkLatestRPsRepoCommit = await fetchAsset("latest-rps-repo-commit.txt") + // TODO also check foerderfunke-webapp latest commit + if (checkLatestRPsRepoCommit === latestRPsRepoCommit) return + console.log("Update available, new commit:", checkLatestRPsRepoCommit) + latestRPsRepoCommit = checkLatestRPsRepoCommit + document.getElementById("update-banner").style.display = "block" + let eligibleRPsBefore = [... eligibleRPs] + await parseTurtleFiles() + await update() + let newEligibleRPs = eligibleRPs.filter(rp => !eligibleRPsBefore.includes(rp)) + if (newEligibleRPs.length > 0) { + document.title = `(${newEligibleRPs.length}) ${document.title}` + alert("New eligible requirement profiles available: " + newEligibleRPs.map(rpUri => getRpTitle(rpUri)).join(", ")) + } +} + +function dfShortUriToLabel(key) { + return metadata.df[expandShortUri(key)]?.label ?? key +} + +function expandShortUri(uri) { + return uri.startsWith("ff:") ? "https://foerderfunke.org/default#" + uri.slice(3) : uri +} + +function shortenLongUri(uri) { + return uri.startsWith("http") ? "ff:" + uri.split("#")[1] : uri +} + +function buildRowAndColumns(table) { + let tr = document.createElement("tr") + table.appendChild(tr) + let tds = [] + for (let i = 0; i < maxDepth + 3; i++) { + let td = document.createElement("td") + tr.appendChild(td) + tds.push(td) + } + return tds +} + +function getRpTitle(rpUri) { + return metadata.rp[rpUri]?.title ?? rpUri +} + +async function fetchAsset(relPath) { + const response = await fetch("assets/" + relPath, { + method: "GET", + cache: "reload" + }) + return await response.text() +} + +async function clearUserProfile() { + localStorage.setItem("userProfile", JSON.stringify(EMPTY_PROFILE)) + userProfile = JSON.parse(localStorage.getItem("userProfile")) + await update() +} + +async function importUserProfileTurtle() { + alert("TODO") + // TODO +} + +async function downloadUserProfileTurtle() { + let userProfileTurtle = await MatchingEngine.convertUserProfileToTurtle(userProfile) + let blob = new Blob([userProfileTurtle], {type: "text/turtle"}) + let url = URL.createObjectURL(blob) + let a = document.createElement("a") + a.href = url + a.download = "user-profile.ttl" + document.body.appendChild(a) + a.click() + document.body.removeChild(a) + window.URL.revokeObjectURL(url) +} + +async function showUserProfileTurtle() { + let userProfileTurtle = await MatchingEngine.convertUserProfileToTurtle(userProfile) + alert(userProfileTurtle) +}