@opengeospatial/jsonld-ui-utils 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -1
- package/dist/crs.d.ts +25 -0
- package/dist/jsonld-ui-utils-leaflet.min.js +2 -2
- package/dist/jsonld-ui-utils-leaflet.min.js.map +1 -1
- package/dist/leaflet.cjs.js +201 -3
- package/dist/leaflet.cjs.js.map +1 -1
- package/dist/leaflet.d.ts +5 -1
- package/dist/leaflet.esm.js +201 -3
- package/dist/leaflet.esm.js.map +1 -1
- package/package.json +7 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var jsonldUIUtilsLeaflet=function(t){"use strict";async function e(t){const e=new Map,i=async(t,e)=>{for(const[s,n]of Object.entries(t))"@context"===s?t[s]=await r(n,e):"object"==typeof n&&null!==n&&await i(n,e)},r=async(t,s)=>{if(null==t)return{};if(Array.isArray(t)){return(t=>{const e=(t,e)=>{if(!t||!Object.keys(t).length)return e;const i={...t};for(const[t,r]of Object.entries(e))i[t]=r;return i};if(!t.length)return{};if(1===t.length)return t[0];let i=t[0];for(let r=1;r<t.length;r++)i=e(i,t[r]);return i})(await Promise.all(t.map(t=>r(t,s))))}if("object"==typeof t)return await i(t,s),t;{if(null==s?void 0:s.includes(t))throw new Error("Circular dependencies found: "+s.join(" -> ")+" -> "+t);const i=Array.isArray(s)?null==s?void 0:s.slice():[];let n;return i.push(t),e.has(t)?n=e.get(t):(n=await(async t=>{const e=await fetch(t,{headers:{Accept:"application/json"}});return await e.json()})(t),e.set(t,n)),r(n["@context"],i)}};return r("object"==typeof t&&null!==t&&"@context"in t?t["@context"]:t)}const i=t=>e=>`${t}${e}`,r=i("http://www.w3.org/2004/02/skos/core#"),s=i("http://www.w3.org/2000/01/rdf-schema#"),n=i("http://purl.org/dc/terms/"),a=i("http://purl.org/dc/elements/1.1/"),o=i("https://schema.org/"),h=i("http://xmlns.com/foaf/0.1/"),u=[r("prefLabel"),n("title"),a("title"),o("name"),h("name"),s("label")],l=[r("definition"),n("description"),a("description"),s("comment")];var c="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},d=[],f=[],p="undefined"!=typeof Uint8Array?Uint8Array:Array,_=!1;function g(){_=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)d[e]=t[e],f[t.charCodeAt(e)]=e;f["-".charCodeAt(0)]=62,f["_".charCodeAt(0)]=63}function b(t){return d[t>>18&63]+d[t>>12&63]+d[t>>6&63]+d[63&t]}function m(t,e,i){for(var r,s=[],n=e;n<i;n+=3)r=(t[n]<<16)+(t[n+1]<<8)+t[n+2],s.push(b(r));return s.join("")}function y(t){var e;_||g();for(var i=t.length,r=i%3,s="",n=[],a=16383,o=0,h=i-r;o<h;o+=a)n.push(m(t,o,o+a>h?h:o+a));return 1===r?(e=t[i-1],s+=d[e>>2],s+=d[e<<4&63],s+="=="):2===r&&(e=(t[i-2]<<8)+t[i-1],s+=d[e>>10],s+=d[e>>4&63],s+=d[e<<2&63],s+="="),n.push(s),n.join("")}function x(t,e,i,r,s){var n,a,o=8*s-r-1,h=(1<<o)-1,u=h>>1,l=-7,c=i?s-1:0,d=i?-1:1,f=t[e+c];for(c+=d,n=f&(1<<-l)-1,f>>=-l,l+=o;l>0;n=256*n+t[e+c],c+=d,l-=8);for(a=n&(1<<-l)-1,n>>=-l,l+=r;l>0;a=256*a+t[e+c],c+=d,l-=8);if(0===n)n=1-u;else{if(n===h)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),n-=u}return(f?-1:1)*a*Math.pow(2,n-r)}function v(t,e,i,r,s,n){var a,o,h,u=8*n-s-1,l=(1<<u)-1,c=l>>1,d=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:n-1,p=r?1:-1,_=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-a))<1&&(a--,h*=2),(e+=a+c>=1?d/h:d*Math.pow(2,1-c))*h>=2&&(a++,h/=2),a+c>=l?(o=0,a=l):a+c>=1?(o=(e*h-1)*Math.pow(2,s),a+=c):(o=e*Math.pow(2,c-1)*Math.pow(2,s),a=0));s>=8;t[i+f]=255&o,f+=p,o/=256,s-=8);for(a=a<<s|o,u+=s;u>0;t[i+f]=255&a,f+=p,a/=256,u-=8);t[i+f-p]|=128*_}var w={}.toString,T=Array.isArray||function(t){return"[object Array]"==w.call(t)};function I(){return R.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function E(t,e){if(I()<e)throw new RangeError("Invalid typed array length");return R.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=R.prototype:(null===t&&(t=new R(e)),t.length=e),t}function R(t,e,i){if(!(R.TYPED_ARRAY_SUPPORT||this instanceof R))return new R(t,e,i);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return j(this,t)}return N(this,t,e,i)}function N(t,e,i,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,i,r){if(e.byteLength,i<0||e.byteLength<i)throw new RangeError("'offset' is out of bounds");if(e.byteLength<i+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===i&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,i):new Uint8Array(e,i,r);R.TYPED_ARRAY_SUPPORT?(t=e).__proto__=R.prototype:t=C(t,e);return t}(t,e,i,r):"string"==typeof e?function(t,e,i){"string"==typeof i&&""!==i||(i="utf8");if(!R.isEncoding(i))throw new TypeError('"encoding" must be a valid string encoding');var r=0|A(e,i);t=E(t,r);var s=t.write(e,i);s!==r&&(t=t.slice(0,s));return t}(t,e,i):function(t,e){if(k(e)){var i=0|P(e.length);return 0===(t=E(t,i)).length||e.copy(t,0,0,i),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?E(t,0):C(t,e);if("Buffer"===e.type&&T(e.data))return C(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function S(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function j(t,e){if(S(e),t=E(t,e<0?0:0|P(e)),!R.TYPED_ARRAY_SUPPORT)for(var i=0;i<e;++i)t[i]=0;return t}function C(t,e){var i=e.length<0?0:0|P(e.length);t=E(t,i);for(var r=0;r<i;r+=1)t[r]=255&e[r];return t}function P(t){if(t>=I())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+I().toString(16)+" bytes");return 0|t}function k(t){return!(null==t||!t._isBuffer)}function A(t,e){if(k(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var i=t.length;if(0===i)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return at(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return ot(t).length;default:if(r)return at(t).length;e=(""+e).toLowerCase(),r=!0}}function $(t,e,i){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return X(this,e,i);case"utf8":case"utf-8":return G(this,e,i);case"ascii":return Y(this,e,i);case"latin1":case"binary":return V(this,e,i);case"base64":return H(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return W(this,e,i);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function D(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function O(t,e,i,r,s){if(0===t.length)return-1;if("string"==typeof i?(r=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=s?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(s)return-1;i=t.length-1}else if(i<0){if(!s)return-1;i=0}if("string"==typeof e&&(e=R.from(e,r)),k(e))return 0===e.length?-1:F(t,e,i,r,s);if("number"==typeof e)return e&=255,R.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):F(t,[e],i,r,s);throw new TypeError("val must be string, number or Buffer")}function F(t,e,i,r,s){var n,a=1,o=t.length,h=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,o/=2,h/=2,i/=2}function u(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(s){var l=-1;for(n=i;n<o;n++)if(u(t,n)===u(e,-1===l?0:n-l)){if(-1===l&&(l=n),n-l+1===h)return l*a}else-1!==l&&(n-=n-l),l=-1}else for(i+h>o&&(i=o-h),n=i;n>=0;n--){for(var c=!0,d=0;d<h;d++)if(u(t,n+d)!==u(e,d)){c=!1;break}if(c)return n}return-1}function L(t,e,i,r){i=Number(i)||0;var s=t.length-i;r?(r=Number(r))>s&&(r=s):r=s;var n=e.length;if(n%2!=0)throw new TypeError("Invalid hex string");r>n/2&&(r=n/2);for(var a=0;a<r;++a){var o=parseInt(e.substr(2*a,2),16);if(isNaN(o))return a;t[i+a]=o}return a}function M(t,e,i,r){return ht(at(e,t.length-i),t,i,r)}function B(t,e,i,r){return ht(function(t){for(var e=[],i=0;i<t.length;++i)e.push(255&t.charCodeAt(i));return e}(e),t,i,r)}function q(t,e,i,r){return B(t,e,i,r)}function U(t,e,i,r){return ht(ot(e),t,i,r)}function Q(t,e,i,r){return ht(function(t,e){for(var i,r,s,n=[],a=0;a<t.length&&!((e-=2)<0);++a)r=(i=t.charCodeAt(a))>>8,s=i%256,n.push(s),n.push(r);return n}(e,t.length-i),t,i,r)}function H(t,e,i){return 0===e&&i===t.length?y(t):y(t.slice(e,i))}function G(t,e,i){i=Math.min(t.length,i);for(var r=[],s=e;s<i;){var n,a,o,h,u=t[s],l=null,c=u>239?4:u>223?3:u>191?2:1;if(s+c<=i)switch(c){case 1:u<128&&(l=u);break;case 2:128==(192&(n=t[s+1]))&&(h=(31&u)<<6|63&n)>127&&(l=h);break;case 3:n=t[s+1],a=t[s+2],128==(192&n)&&128==(192&a)&&(h=(15&u)<<12|(63&n)<<6|63&a)>2047&&(h<55296||h>57343)&&(l=h);break;case 4:n=t[s+1],a=t[s+2],o=t[s+3],128==(192&n)&&128==(192&a)&&128==(192&o)&&(h=(15&u)<<18|(63&n)<<12|(63&a)<<6|63&o)>65535&&h<1114112&&(l=h)}null===l?(l=65533,c=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),s+=c}return function(t){var e=t.length;if(e<=z)return String.fromCharCode.apply(String,t);var i="",r=0;for(;r<e;)i+=String.fromCharCode.apply(String,t.slice(r,r+=z));return i}(r)}R.TYPED_ARRAY_SUPPORT=void 0===c.TYPED_ARRAY_SUPPORT||c.TYPED_ARRAY_SUPPORT,I(),R.poolSize=8192,R._augment=function(t){return t.__proto__=R.prototype,t},R.from=function(t,e,i){return N(null,t,e,i)},R.TYPED_ARRAY_SUPPORT&&(R.prototype.__proto__=Uint8Array.prototype,R.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&R[Symbol.species]),R.alloc=function(t,e,i){return function(t,e,i,r){return S(e),e<=0?E(t,e):void 0!==i?"string"==typeof r?E(t,e).fill(i,r):E(t,e).fill(i):E(t,e)}(null,t,e,i)},R.allocUnsafe=function(t){return j(null,t)},R.allocUnsafeSlow=function(t){return j(null,t)},R.isBuffer=function(t){return null!=t&&(!!t._isBuffer||ut(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&ut(t.slice(0,0))}(t))},R.compare=function(t,e){if(!k(t)||!k(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var i=t.length,r=e.length,s=0,n=Math.min(i,r);s<n;++s)if(t[s]!==e[s]){i=t[s],r=e[s];break}return i<r?-1:r<i?1:0},R.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},R.concat=function(t,e){if(!T(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return R.alloc(0);var i;if(void 0===e)for(e=0,i=0;i<t.length;++i)e+=t[i].length;var r=R.allocUnsafe(e),s=0;for(i=0;i<t.length;++i){var n=t[i];if(!k(n))throw new TypeError('"list" argument must be an Array of Buffers');n.copy(r,s),s+=n.length}return r},R.byteLength=A,R.prototype._isBuffer=!0,R.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)D(this,e,e+1);return this},R.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)D(this,e,e+3),D(this,e+1,e+2);return this},R.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)D(this,e,e+7),D(this,e+1,e+6),D(this,e+2,e+5),D(this,e+3,e+4);return this},R.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?G(this,0,t):$.apply(this,arguments)},R.prototype.equals=function(t){if(!k(t))throw new TypeError("Argument must be a Buffer");return this===t||0===R.compare(this,t)},R.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},R.prototype.compare=function(t,e,i,r,s){if(!k(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===r&&(r=0),void 0===s&&(s=this.length),e<0||i>t.length||r<0||s>this.length)throw new RangeError("out of range index");if(r>=s&&e>=i)return 0;if(r>=s)return-1;if(e>=i)return 1;if(this===t)return 0;for(var n=(s>>>=0)-(r>>>=0),a=(i>>>=0)-(e>>>=0),o=Math.min(n,a),h=this.slice(r,s),u=t.slice(e,i),l=0;l<o;++l)if(h[l]!==u[l]){n=h[l],a=u[l];break}return n<a?-1:a<n?1:0},R.prototype.includes=function(t,e,i){return-1!==this.indexOf(t,e,i)},R.prototype.indexOf=function(t,e,i){return O(this,t,e,i,!0)},R.prototype.lastIndexOf=function(t,e,i){return O(this,t,e,i,!1)},R.prototype.write=function(t,e,i,r){if(void 0===e)r="utf8",i=this.length,e=0;else if(void 0===i&&"string"==typeof e)r=e,i=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(i)?(i|=0,void 0===r&&(r="utf8")):(r=i,i=void 0)}var s=this.length-e;if((void 0===i||i>s)&&(i=s),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var n=!1;;)switch(r){case"hex":return L(this,t,e,i);case"utf8":case"utf-8":return M(this,t,e,i);case"ascii":return B(this,t,e,i);case"latin1":case"binary":return q(this,t,e,i);case"base64":return U(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q(this,t,e,i);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),n=!0}},R.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var z=4096;function Y(t,e,i){var r="";i=Math.min(t.length,i);for(var s=e;s<i;++s)r+=String.fromCharCode(127&t[s]);return r}function V(t,e,i){var r="";i=Math.min(t.length,i);for(var s=e;s<i;++s)r+=String.fromCharCode(t[s]);return r}function X(t,e,i){var r=t.length;(!e||e<0)&&(e=0),(!i||i<0||i>r)&&(i=r);for(var s="",n=e;n<i;++n)s+=nt(t[n]);return s}function W(t,e,i){for(var r=t.slice(e,i),s="",n=0;n<r.length;n+=2)s+=String.fromCharCode(r[n]+256*r[n+1]);return s}function Z(t,e,i){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>i)throw new RangeError("Trying to access beyond buffer length")}function J(t,e,i,r,s,n){if(!k(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>s||e<n)throw new RangeError('"value" argument is out of bounds');if(i+r>t.length)throw new RangeError("Index out of range")}function K(t,e,i,r){e<0&&(e=65535+e+1);for(var s=0,n=Math.min(t.length-i,2);s<n;++s)t[i+s]=(e&255<<8*(r?s:1-s))>>>8*(r?s:1-s)}function tt(t,e,i,r){e<0&&(e=4294967295+e+1);for(var s=0,n=Math.min(t.length-i,4);s<n;++s)t[i+s]=e>>>8*(r?s:3-s)&255}function et(t,e,i,r,s,n){if(i+r>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function it(t,e,i,r,s){return s||et(t,0,i,4),v(t,e,i,r,23,4),i+4}function rt(t,e,i,r,s){return s||et(t,0,i,8),v(t,e,i,r,52,8),i+8}R.prototype.slice=function(t,e){var i,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),R.TYPED_ARRAY_SUPPORT)(i=this.subarray(t,e)).__proto__=R.prototype;else{var s=e-t;i=new R(s,void 0);for(var n=0;n<s;++n)i[n]=this[n+t]}return i},R.prototype.readUIntLE=function(t,e,i){t|=0,e|=0,i||Z(t,e,this.length);for(var r=this[t],s=1,n=0;++n<e&&(s*=256);)r+=this[t+n]*s;return r},R.prototype.readUIntBE=function(t,e,i){t|=0,e|=0,i||Z(t,e,this.length);for(var r=this[t+--e],s=1;e>0&&(s*=256);)r+=this[t+--e]*s;return r},R.prototype.readUInt8=function(t,e){return e||Z(t,1,this.length),this[t]},R.prototype.readUInt16LE=function(t,e){return e||Z(t,2,this.length),this[t]|this[t+1]<<8},R.prototype.readUInt16BE=function(t,e){return e||Z(t,2,this.length),this[t]<<8|this[t+1]},R.prototype.readUInt32LE=function(t,e){return e||Z(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},R.prototype.readUInt32BE=function(t,e){return e||Z(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},R.prototype.readIntLE=function(t,e,i){t|=0,e|=0,i||Z(t,e,this.length);for(var r=this[t],s=1,n=0;++n<e&&(s*=256);)r+=this[t+n]*s;return r>=(s*=128)&&(r-=Math.pow(2,8*e)),r},R.prototype.readIntBE=function(t,e,i){t|=0,e|=0,i||Z(t,e,this.length);for(var r=e,s=1,n=this[t+--r];r>0&&(s*=256);)n+=this[t+--r]*s;return n>=(s*=128)&&(n-=Math.pow(2,8*e)),n},R.prototype.readInt8=function(t,e){return e||Z(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},R.prototype.readInt16LE=function(t,e){e||Z(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},R.prototype.readInt16BE=function(t,e){e||Z(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},R.prototype.readInt32LE=function(t,e){return e||Z(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},R.prototype.readInt32BE=function(t,e){return e||Z(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},R.prototype.readFloatLE=function(t,e){return e||Z(t,4,this.length),x(this,t,!0,23,4)},R.prototype.readFloatBE=function(t,e){return e||Z(t,4,this.length),x(this,t,!1,23,4)},R.prototype.readDoubleLE=function(t,e){return e||Z(t,8,this.length),x(this,t,!0,52,8)},R.prototype.readDoubleBE=function(t,e){return e||Z(t,8,this.length),x(this,t,!1,52,8)},R.prototype.writeUIntLE=function(t,e,i,r){(t=+t,e|=0,i|=0,r)||J(this,t,e,i,Math.pow(2,8*i)-1,0);var s=1,n=0;for(this[e]=255&t;++n<i&&(s*=256);)this[e+n]=t/s&255;return e+i},R.prototype.writeUIntBE=function(t,e,i,r){(t=+t,e|=0,i|=0,r)||J(this,t,e,i,Math.pow(2,8*i)-1,0);var s=i-1,n=1;for(this[e+s]=255&t;--s>=0&&(n*=256);)this[e+s]=t/n&255;return e+i},R.prototype.writeUInt8=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,1,255,0),R.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},R.prototype.writeUInt16LE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,2,65535,0),R.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):K(this,t,e,!0),e+2},R.prototype.writeUInt16BE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,2,65535,0),R.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):K(this,t,e,!1),e+2},R.prototype.writeUInt32LE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,4,4294967295,0),R.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):tt(this,t,e,!0),e+4},R.prototype.writeUInt32BE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,4,4294967295,0),R.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):tt(this,t,e,!1),e+4},R.prototype.writeIntLE=function(t,e,i,r){if(t=+t,e|=0,!r){var s=Math.pow(2,8*i-1);J(this,t,e,i,s-1,-s)}var n=0,a=1,o=0;for(this[e]=255&t;++n<i&&(a*=256);)t<0&&0===o&&0!==this[e+n-1]&&(o=1),this[e+n]=(t/a|0)-o&255;return e+i},R.prototype.writeIntBE=function(t,e,i,r){if(t=+t,e|=0,!r){var s=Math.pow(2,8*i-1);J(this,t,e,i,s-1,-s)}var n=i-1,a=1,o=0;for(this[e+n]=255&t;--n>=0&&(a*=256);)t<0&&0===o&&0!==this[e+n+1]&&(o=1),this[e+n]=(t/a|0)-o&255;return e+i},R.prototype.writeInt8=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,1,127,-128),R.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},R.prototype.writeInt16LE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,2,32767,-32768),R.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):K(this,t,e,!0),e+2},R.prototype.writeInt16BE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,2,32767,-32768),R.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):K(this,t,e,!1),e+2},R.prototype.writeInt32LE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,4,2147483647,-2147483648),R.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):tt(this,t,e,!0),e+4},R.prototype.writeInt32BE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),R.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):tt(this,t,e,!1),e+4},R.prototype.writeFloatLE=function(t,e,i){return it(this,t,e,!0,i)},R.prototype.writeFloatBE=function(t,e,i){return it(this,t,e,!1,i)},R.prototype.writeDoubleLE=function(t,e,i){return rt(this,t,e,!0,i)},R.prototype.writeDoubleBE=function(t,e,i){return rt(this,t,e,!1,i)},R.prototype.copy=function(t,e,i,r){if(i||(i=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<i&&(r=i),r===i)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-i&&(r=t.length-e+i);var s,n=r-i;if(this===t&&i<e&&e<r)for(s=n-1;s>=0;--s)t[s+e]=this[s+i];else if(n<1e3||!R.TYPED_ARRAY_SUPPORT)for(s=0;s<n;++s)t[s+e]=this[s+i];else Uint8Array.prototype.set.call(t,this.subarray(i,i+n),e);return n},R.prototype.fill=function(t,e,i,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,i=this.length):"string"==typeof i&&(r=i,i=this.length),1===t.length){var s=t.charCodeAt(0);s<256&&(t=s)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!R.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<i)throw new RangeError("Out of range index");if(i<=e)return this;var n;if(e>>>=0,i=void 0===i?this.length:i>>>0,t||(t=0),"number"==typeof t)for(n=e;n<i;++n)this[n]=t;else{var a=k(t)?t:at(new R(t,r).toString()),o=a.length;for(n=0;n<i-e;++n)this[n+e]=a[n%o]}return this};var st=/[^+\/0-9A-Za-z-_]/g;function nt(t){return t<16?"0"+t.toString(16):t.toString(16)}function at(t,e){var i;e=e||1/0;for(var r=t.length,s=null,n=[],a=0;a<r;++a){if((i=t.charCodeAt(a))>55295&&i<57344){if(!s){if(i>56319){(e-=3)>-1&&n.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&n.push(239,191,189);continue}s=i;continue}if(i<56320){(e-=3)>-1&&n.push(239,191,189),s=i;continue}i=65536+(s-55296<<10|i-56320)}else s&&(e-=3)>-1&&n.push(239,191,189);if(s=null,i<128){if((e-=1)<0)break;n.push(i)}else if(i<2048){if((e-=2)<0)break;n.push(i>>6|192,63&i|128)}else if(i<65536){if((e-=3)<0)break;n.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;n.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return n}function ot(t){return function(t){var e,i,r,s,n,a;_||g();var o=t.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");n="="===t[o-2]?2:"="===t[o-1]?1:0,a=new p(3*o/4-n),r=n>0?o-4:o;var h=0;for(e=0,i=0;e<r;e+=4,i+=3)s=f[t.charCodeAt(e)]<<18|f[t.charCodeAt(e+1)]<<12|f[t.charCodeAt(e+2)]<<6|f[t.charCodeAt(e+3)],a[h++]=s>>16&255,a[h++]=s>>8&255,a[h++]=255&s;return 2===n?(s=f[t.charCodeAt(e)]<<2|f[t.charCodeAt(e+1)]>>4,a[h++]=255&s):1===n&&(s=f[t.charCodeAt(e)]<<10|f[t.charCodeAt(e+1)]<<4|f[t.charCodeAt(e+2)]>>2,a[h++]=s>>8&255,a[h++]=255&s),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(st,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function ht(t,e,i,r){for(var s=0;s<r&&!(s+i>=e.length||s>=t.length);++s)e[s+i]=t[s];return s}function ut(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}const lt="http://www.w3.org/1999/02/22-rdf-syntax-ns#",ct="http://www.w3.org/2001/XMLSchema#",dt="http://www.w3.org/2000/10/swap/";var ft={xsd:{decimal:`${ct}decimal`,boolean:`${ct}boolean`,double:`${ct}double`,integer:`${ct}integer`,string:`${ct}string`},rdf:{type:`${lt}type`,nil:`${lt}nil`,first:`${lt}first`,rest:`${lt}rest`,langString:`${lt}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${dt}reify#forSome`,forAll:`${dt}reify#forAll`},log:{implies:`${dt}log#implies`,isImpliedBy:`${dt}log#isImpliedBy`}};const{xsd:pt}=ft,_t=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,gt={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:"\t",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},bt=/[\x00-\x20<>\\"\{\}\|\^\`]/,mt={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},yt=/$0^/;class xt{constructor(t){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]*)?$/,t=t||{},this._isImpliedBy=t.isImpliedBy,this._lineMode=!!t.lineMode){this._n3Mode=!1;for(const t in this)!(t in mt)&&this[t]instanceof RegExp&&(this[t]=yt)}else this._n3Mode=!1!==t.n3;this.comments=!!t.comments,this._literalClosingPos=0}_tokenizeToEnd(t,e){let i=this._input,r=i.length;for(;;){let t,a;for(;t=this._newline.exec(i);)this.comments&&(a=this._comment.exec(t[0]))&&s("comment",a[1],"",this._line,t[0].length),i=i.substr(t[0].length,i.length),r=i.length,this._line++;if(!t&&(t=this._whitespace.exec(i))&&(i=i.substr(t[0].length,i.length)),this._endOfFile.test(i))return e&&(this.comments&&(a=this._comment.exec(i))&&s("comment",a[1],"",this._line,i.length),i=null,s("eof","","",this._line,0)),this._input=i;const o=this._line,h=i[0];let u="",l="",c="",d=null,f=0,p=!1;switch(h){case"^":if(i.length<3)break;if("^"!==i[1]){this._n3Mode&&(f=1,u="^");break}if(this._previousMarker="^^",i=i.substr(2),"<"!==i[0]){p=!0;break}case"<":if(d=this._unescapedIri.exec(i))u="IRI",l=d[1];else if(d=this._iri.exec(i)){if(l=this._unescape(d[1]),null===l||bt.test(l))return n(this);u="IRI"}else i.length>1&&"<"===i[1]?(u="<<",f=2):this._n3Mode&&i.length>1&&"="===i[1]&&(f=2,this._isImpliedBy?(u="abbreviation",l="<"):(u="inverse",l=">"));break;case">":i.length>1&&">"===i[1]&&(u=">>",f=2);break;case"_":((d=this._blank.exec(i))||e&&(d=this._blank.exec(`${i} `)))&&(u="blank",c="_",l=d[1]);break;case'"':if(d=this._simpleQuotedString.exec(i))l=d[1];else if(({value:l,matchLength:f}=this._parseLiteral(i)),null===l)return n(this);null===d&&0===f||(u="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(d=this._simpleApostropheString.exec(i))l=d[1];else if(({value:l,matchLength:f}=this._parseLiteral(i)),null===l)return n(this);null===d&&0===f||(u="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(d=this._variable.exec(i))&&(u="var",l=d[0]);break;case"@":"literal"===this._previousMarker&&(d=this._langcode.exec(i))?(u="langcode",l=d[1]):(d=this._keyword.exec(i))&&(u=d[0]);break;case".":if(1===i.length?e:i[1]<"0"||i[1]>"9"){u=".",f=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(d=this._number.exec(i)||e&&(d=this._number.exec(`${i} `)))&&(u="literal",l=d[0],c="string"==typeof d[1]?pt.double:"string"==typeof d[2]?pt.decimal:pt.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(d=this._sparqlKeyword.exec(i))?u=d[0].toUpperCase():p=!0;break;case"f":case"t":(d=this._boolean.exec(i))?(u="literal",l=d[0],c=pt.boolean):p=!0;break;case"a":(d=this._shortPredicates.exec(i))?(u="abbreviation",l="a"):p=!0;break;case"=":this._n3Mode&&i.length>1&&(u="abbreviation",">"!==i[1]?(f=1,l="="):(f=2,l=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(f=1,u=h);break;case"{":!this._lineMode&&i.length>=2&&("|"===i[1]?(u="{|",f=2):(u=h,f=1));break;case"|":i.length>=2&&"}"===i[1]&&(u="|}",f=2);break;default:p=!0}if(p&&("@prefix"!==this._previousMarker&&"PREFIX"!==this._previousMarker||!(d=this._prefix.exec(i))?((d=this._prefixed.exec(i))||e&&(d=this._prefixed.exec(`${i} `)))&&(u="prefixed",c=d[1]||"",l=this._unescape(d[2])):(u="prefix",l=d[1]||"")),"^^"===this._previousMarker)switch(u){case"prefixed":u="type";break;case"IRI":u="typeIRI";break;default:u=""}if(!u)return e||!/^'''|^"""/.test(i)&&/\n|\r/.test(i)?n(this):this._input=i;const _=f||d[0].length,g=s(u,l,c,o,_);this.previousToken=g,this._previousMarker=u,i=i.substr(_,i.length)}function s(e,s,n,a,o){const h=i?r-i.length:r,u={type:e,value:s,prefix:n,line:a,start:h,end:h+o};return t(null,u),u}function n(e){t(e._syntaxError(/^\S*/.exec(i)[0]))}}_unescape(t){let e=!1;const i=t.replace(_t,(t,i,r,s)=>{if("string"==typeof i)return String.fromCharCode(Number.parseInt(i,16));if("string"==typeof r){let t=Number.parseInt(r,16);return t<=65535?String.fromCharCode(Number.parseInt(r,16)):String.fromCharCode(55296+((t-=65536)>>10),56320+(1023&t))}return s in gt?gt[s]:(e=!0,"")});return e?null:i}_parseLiteral(t){if(t.length>=3){const e=t.match(/^(?:"""|"|'''|'|)/)[0],i=e.length;let r=Math.max(this._literalClosingPos,i);for(;(r=t.indexOf(e,r))>0;){let e=0;for(;"\\"===t[r-e-1];)e++;if(e%2==0){const e=t.substring(i,r),s=e.split(/\r\n|\r|\n/).length-1,n=r+i;if(1===i&&0!==s||3===i&&this._lineMode)break;return this._line+=s,{value:this._unescape(e),matchLength:n}}r++}this._literalClosingPos=t.length-i+1}return{value:"",matchLength:0}}_syntaxError(t){this._input=null;const e=new Error(`Unexpected "${t}" on line ${this._line}.`);return e.context={token:void 0,line:this._line,previousToken:this.previousToken},e}_readStartingBom(t){return t.startsWith("\ufeff")?t.substr(1):t}tokenize(t,e){if(this._line=1,"string"==typeof t){if(this._input=this._readStartingBom(t),"function"!=typeof e){const t=[];let e;if(this._tokenizeToEnd((i,r)=>i?e=i:t.push(r),!0),e)throw e;return t}queueMicrotask(()=>this._tokenizeToEnd(e,!0))}else this._pendingBuffer=null,"function"==typeof t.setEncoding&&t.setEncoding("utf8"),t.on("data",t=>{null!==this._input&&0!==t.length&&(this._pendingBuffer&&(t=R.concat([this._pendingBuffer,t]),this._pendingBuffer=null),128&t[t.length-1]?this._pendingBuffer=t:(void 0===this._input?this._input=this._readStartingBom("string"==typeof t?t:t.toString()):this._input+=t,this._tokenizeToEnd(e,!1)))}),t.on("end",()=>{"string"==typeof this._input&&this._tokenizeToEnd(e,!0)}),t.on("error",e)}}const{rdf:vt,xsd:wt}=ft;let Tt,It=0;const Et={namedNode:$t,blankNode:Dt,variable:Ft,literal:Ot,defaultGraph:function(){return Tt},quad:Lt,triple:Lt,fromTerm:Mt,fromQuad:Bt};class Rt{constructor(t){this.id=t}get value(){return this.id}equals(t){return t instanceof Rt?this.id===t.id:!!t&&this.termType===t.termType&&this.value===t.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}}let Nt=class extends Rt{get termType(){return"NamedNode"}},St=class t extends Rt{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const t=this.id;let e=t.lastIndexOf('"')+1;return e<t.length&&"@"===t[e++]?t.substr(e).toLowerCase():""}get datatype(){return new Nt(this.datatypeString)}get datatypeString(){const t=this.id,e=t.lastIndexOf('"')+1,i=e<t.length?t[e]:"";return"^"===i?t.substr(e+2):"@"!==i?wt.string:vt.langString}equals(e){return e instanceof t?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&this.datatype.value===e.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}},jt=class extends Rt{constructor(t){super(`_:${t}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},Ct=class extends Rt{constructor(t){super(`?${t}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}};function Pt(t,e,i){if(e=e||Et,!t)return e.defaultGraph();switch(t[0]){case"?":return e.variable(t.substr(1));case"_":return e.blankNode(t.substr(2));case'"':if(e===Et)return new St(t);if('"'===t[t.length-1])return e.literal(t.substr(1,t.length-2));const r=t.lastIndexOf('"',t.length-1);return e.literal(t.substr(1,r-1),"@"===t[r+1]?t.substr(r+2):e.namedNode(t.substr(r+3)));case"[":t=JSON.parse(t);break;default:if(!i||!Array.isArray(t))return e.namedNode(t)}return e.quad(Pt(t[0],e,!0),Pt(t[1],e,!0),Pt(t[2],e,!0),t[3]&&Pt(t[3],e,!0))}function kt(t,e){if("string"==typeof t)return t;if(t instanceof Rt&&"Quad"!==t.termType)return t.id;if(!t)return Tt.id;switch(t.termType){case"NamedNode":return t.value;case"BlankNode":return`_:${t.value}`;case"Variable":return`?${t.value}`;case"DefaultGraph":return"";case"Literal":return`"${t.value}"${t.language?`@${t.language}`:t.datatype&&t.datatype.value!==wt.string?`^^${t.datatype.value}`:""}`;case"Quad":const i=[kt(t.subject,!0),kt(t.predicate,!0),kt(t.object,!0)];return t.graph&&"DefaultGraph"!==t.graph.termType&&i.push(kt(t.graph,!0)),e?i:JSON.stringify(i);default:throw new Error(`Unexpected termType: ${t.termType}`)}}Tt=new class extends Rt{constructor(){return super(""),Tt||this}get termType(){return"DefaultGraph"}equals(t){return this===t||!!t&&this.termType===t.termType}};let At=class extends Rt{constructor(t,e,i,r){super(""),this._subject=t,this._predicate=e,this._object=i,this._graph=r||Tt}get termType(){return"Quad"}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}get graph(){return this._graph}toJSON(){return{termType:this.termType,subject:this._subject.toJSON(),predicate:this._predicate.toJSON(),object:this._object.toJSON(),graph:this._graph.toJSON()}}equals(t){return!!t&&this._subject.equals(t.subject)&&this._predicate.equals(t.predicate)&&this._object.equals(t.object)&&this._graph.equals(t.graph)}};function $t(t){return new Nt(t)}function Dt(t){return new jt(t||"n3-"+It++)}function Ot(t,e){if("string"==typeof e)return new St(`"${t}"@${e.toLowerCase()}`);let i=e?e.value:"";return""===i&&("boolean"==typeof t?i=wt.boolean:"number"==typeof t&&(Number.isFinite(t)?i=Number.isInteger(t)?wt.integer:wt.double:(i=wt.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")))),""===i||i===wt.string?new St(`"${t}"`):new St(`"${t}"^^${i}`)}function Ft(t){return new Ct(t)}function Lt(t,e,i,r){return new At(t,e,i,r)}function Mt(t){if(t instanceof Rt)return t;switch(t.termType){case"NamedNode":return $t(t.value);case"BlankNode":return Dt(t.value);case"Variable":return Ft(t.value);case"DefaultGraph":return Tt;case"Literal":return Ot(t.value,t.language||t.datatype);case"Quad":return Bt(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function Bt(t){if(t instanceof At)return t;if("Quad"!==t.termType)throw new Error(`Unexpected termType: ${t.termType}`);return Lt(Mt(t.subject),Mt(t.predicate),Mt(t.object),Mt(t.graph))}let qt=0;class Ut{constructor(t){this._contextStack=[],this._graph=null,t=t||{},this._setBase(t.baseIRI),t.factory&&Ht(this,t.factory);const e="string"==typeof t.format?t.format.match(/\w*$/)[0].toLowerCase():"",i=/turtle/.test(e),r=/trig/.test(e),s=/triple/.test(e),n=/quad/.test(e),a=this._n3Mode=/n3/.test(e),o=s||n;(this._supportsNamedGraphs=!(i||a))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(i||r||s||a),this._isImpliedBy=t.isImpliedBy,this._supportsRDFStar=""===e||/star|\*$/.test(e),o&&(this._resolveRelativeIRI=t=>null),this._blankNodePrefix="string"!=typeof t.blankNodePrefix?"":t.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=t.lexer||new xt({lineMode:o,n3:a,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!t.explicitQuantifiers}static _resetBlankNodePrefix(){qt=0}_setBase(t){if(t){const e=t.indexOf("#");e>=0&&(t=t.substr(0,e)),this._base=t,this._basePath=t.indexOf("/")<0?t:t.replace(/[^\/?]*(?:\?.*)?$/,""),t=t.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=t[0],this._baseScheme=t[1]}else this._base="",this._basePath=""}_saveContext(t,e,i,r,s){const n=this._n3Mode;this._contextStack.push({type:t,subject:i,predicate:r,object:s,graph:e,inverse:!!n&&this._inversePredicate,blankPrefix:n?this._prefixes._:"",quantified:n?this._quantified:null}),n&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(t,e){const i=this._contextStack.pop();if(!i||i.type!==t)return this._error(`Unexpected ${e.type}`,e);this._subject=i.subject,this._predicate=i.predicate,this._object=i.object,this._graph=i.graph,this._n3Mode&&(this._inversePredicate=i.inverse,this._prefixes._=i.blankPrefix,this._quantified=i.quantified)}_readInTopContext(t){switch(t.type){case"eof":return null!==this._graph?this._error("Unclosed graph",t):(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(t)}}_readEntity(t,e){let i;switch(t.type){case"IRI":case"typeIRI":const e=this._resolveIRI(t.value);if(null===e)return this._error("Invalid IRI",t);i=this._factory.namedNode(e);break;case"type":case"prefixed":const r=this._prefixes[t.prefix];if(void 0===r)return this._error(`Undefined prefix "${t.prefix}:"`,t);i=this._factory.namedNode(r+t.value);break;case"blank":i=this._factory.blankNode(this._prefixes[t.prefix]+t.value);break;case"var":i=this._factory.variable(t.value.substr(1));break;default:return this._error(`Expected entity but got ${t.type}`,t)}return!e&&this._n3Mode&&i.id in this._quantified&&(i=this._quantified[i.id]),i}_readSubject(t){switch(this._predicate=null,t.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._factory.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._factory.blankNode(),null,null),this._readSubject):this._error("Unexpected graph",t);case"}":return this._readPunctuation(t);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier="blankNode",this._readQuantifierList):this._error('Unexpected "@forSome"',t);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier="variable",this._readQuantifierList):this._error('Unexpected "@forAll"',t);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",t);if(0===t.prefix.length)return this._literalValue=t.value,this._completeSubjectLiteral;this._subject=this._factory.literal(t.value,this._factory.namedNode(t.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",t);default:if(void 0===(this._subject=this._readEntity(t)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(t){const e=t.type;switch(e){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[t.value];break;case".":case"]":case"}":return null===this._predicate?this._error(`Unexpected ${e}`,t):(this._subject=null,"]"===e?this._readBlankNodeTail(t):this._readPunctuation(t));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",t);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",t);default:if(void 0===(this._predicate=this._readEntity(t)))return}return this._readObject}_readObject(t){switch(t.type){case"literal":if(0===t.prefix.length)return this._literalValue=t.value,this._readDataTypeOrLang;this._object=this._factory.literal(t.value,this._factory.namedNode(t.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._factory.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._factory.blankNode()),this._readSubject):this._error("Unexpected graph",t);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",t);default:if(void 0===(this._object=this._readEntity(t)))return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(t){return"{"===t.type?this._readGraph(t):this._readPredicate(t)}_readGraph(t){return"{"!==t.type?this._error(`Expected graph but got ${t.type}`,t):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(t){return"]"===t.type?(this._subject=null,this._readBlankNodeTail(t)):(this._predicate=null,this._readPredicate(t))}_readBlankNodeTail(t){if("]"!==t.type)return this._readBlankNodePunctuation(t);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);const e=null===this._predicate;return this._restoreContext("blank",t),null!==this._object?this._getContextEndReader():null!==this._predicate?this._readObject:e?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(t){switch(t.type){case".":case"}":return this._subject=null,this._readPunctuation(t);default:return this._readPredicate(t)}}_readListItem(t){let e=null,i=null,r=this._readListItem;const s=this._subject,n=this._contextStack,a=n[n.length-1];switch(t.type){case"[":this._saveContext("blank",this._graph,i=this._factory.blankNode(),this.RDF_FIRST,this._subject=e=this._factory.blankNode()),r=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,i=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",t),0!==n.length&&"list"===n[n.length-1].type&&this._emit(this._subject,this._predicate,this._object,this._graph),null===this._predicate){if(r=this._readPredicate,this._subject===this.RDF_NIL)return r}else if(r=this._getContextEndReader(),this._object===this.RDF_NIL)return r;i=this.RDF_NIL;break;case"literal":0===t.prefix.length?(this._literalValue=t.value,r=this._readListItemDataTypeOrLang):(e=this._factory.literal(t.value,this._factory.namedNode(t.prefix)),r=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",t);default:if(void 0===(e=this._readEntity(t)))return}if(null===i&&(this._subject=i=this._factory.blankNode()),null===s?null===a.predicate?a.subject=i:a.object=i:this._emit(s,this.RDF_REST,i,this._graph),null!==e){if(this._n3Mode&&("IRI"===t.type||"prefixed"===t.type))return this._saveContext("item",this._graph,i,this.RDF_FIRST,e),this._subject=e,this._predicate=null,this._getPathReader(this._readListItem);this._emit(i,this.RDF_FIRST,e,this._graph)}return r}_readDataTypeOrLang(t){return this._completeObjectLiteral(t,!1)}_readListItemDataTypeOrLang(t){return this._completeObjectLiteral(t,!0)}_completeLiteral(t){let e=this._factory.literal(this._literalValue);switch(t.type){case"type":case"typeIRI":const i=this._readEntity(t);if(void 0===i)return;e=this._factory.literal(this._literalValue,i),t=null;break;case"langcode":e=this._factory.literal(this._literalValue,t.value),t=null}return{token:t,literal:e}}_completeSubjectLiteral(t){return this._subject=this._completeLiteral(t).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(t,e){const i=this._completeLiteral(t);if(i)return this._object=i.literal,e&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),null===i.token?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(i.token))}_readFormulaTail(t){return"}"!==t.type?this._readPunctuation(t):(null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",t),null===this._object?this._readPredicate:this._getContextEndReader())}_readPunctuation(t){let e,i=this._graph;const r=this._subject,s=this._inversePredicate;switch(t.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",t);if(this._n3Mode)return this._readFormulaTail(t);this._graph=null;case".":this._subject=null,e=this._contextStack.length?this._readSubject:this._readInTopContext,s&&(this._inversePredicate=!1);break;case";":e=this._readPredicate;break;case",":e=this._readObject;break;case"{|":if(!this._supportsRDFStar)return this._error("Unexpected RDF-star syntax",t);const n=this._predicate,a=this._object;this._subject=this._factory.quad(r,n,a,this.DEFAULTGRAPH),e=this._readPredicate;break;case"|}":if("Quad"!==this._subject.termType)return this._error("Unexpected asserted triple closing",t);this._subject=null,e=this._readPunctuation;break;default:if(this._supportsQuads&&null===this._graph&&void 0!==(i=this._readEntity(t))){e=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,t)}if(null!==r){const t=this._predicate,e=this._object;s?this._emit(e,t,r,i):this._emit(r,t,e,i)}return e}_readBlankNodePunctuation(t){let e;switch(t.type){case";":e=this._readPredicate;break;case",":e=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,t)}return this._emit(this._subject,this._predicate,this._object,this._graph),e}_readQuadPunctuation(t){return"."!==t.type?this._error("Expected dot to follow quad",t):this._readInTopContext}_readPrefix(t){return"prefix"!==t.type?this._error("Expected prefix to follow @prefix",t):(this._prefix=t.value,this._readPrefixIRI)}_readPrefixIRI(t){if("IRI"!==t.type)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,t);const e=this._readEntity(t);return this._prefixes[this._prefix]=e.value,this._prefixCallback(this._prefix,e),this._readDeclarationPunctuation}_readBaseIRI(t){const e="IRI"===t.type&&this._resolveIRI(t.value);return e?(this._setBase(e),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",t)}_readNamedGraphLabel(t){switch(t.type){case"IRI":case"blank":case"prefixed":return this._readSubject(t),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",t)}}_readNamedGraphBlankLabel(t){return"]"!==t.type?this._error("Invalid graph label",t):(this._subject=this._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(t){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(t)):"."!==t.type?this._error("Expected declaration to end with a dot",t):this._readInTopContext}_readQuantifierList(t){let e;switch(t.type){case"IRI":case"prefixed":if(void 0!==(e=this._readEntity(t,!0)))break;default:return this._error(`Unexpected ${t.type}`,t)}return this._explicitQuantifiers?(null===this._subject?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,e,this.QUANTIFIERS_GRAPH)):this._quantified[e.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(t){return","===t.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(t))}_getPathReader(t){return this._afterPath=t,this._readPath}_readPath(t){switch(t.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const e=this._contextStack,i=e.length&&e[e.length-1];if(i&&"item"===i.type){const e=this._subject;this._restoreContext("item",t),this._emit(this._subject,this.RDF_FIRST,e,this._graph)}return this._afterPath(t)}}_readForwardPath(t){let e,i;const r=this._factory.blankNode();if(void 0!==(i=this._readEntity(t)))return null===this._predicate?(e=this._subject,this._subject=r):(e=this._object,this._object=r),this._emit(e,i,r,this._graph),this._readPath}_readBackwardPath(t){const e=this._factory.blankNode();let i,r;if(void 0!==(i=this._readEntity(t)))return null===this._predicate?(r=this._subject,this._subject=e):(r=this._object,this._object=e),this._emit(e,i,r,this._graph),this._readPath}_readRDFStarTailOrGraph(t){return">>"!==t.type?this._supportsQuads&&null===this._graph&&void 0!==(this._graph=this._readEntity(t))?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,t):this._readRDFStarTail(t)}_readRDFStarTail(t){if(">>"!==t.type)return this._error(`Expected >> but got ${t.type}`,t);const e=this._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",t),null===this._subject?(this._subject=e,this._readPredicate):(this._object=e,this._getContextEndReader())}_getContextEndReader(){const t=this._contextStack;if(!t.length)return this._readPunctuation;switch(t[t.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(t,e,i,r){this._callback(null,this._factory.quad(t,e,i,r||this.DEFAULTGRAPH))}_error(t,e){const i=new Error(`${t} on line ${e.line}.`);i.context={token:e,line:e.line,previousToken:this._lexer.previousToken},this._callback(i),this._callback=Qt}_resolveIRI(t){return/^[a-z][a-z0-9+.-]*:/i.test(t)?t:this._resolveRelativeIRI(t)}_resolveRelativeIRI(t){if(!t.length)return this._base;switch(t[0]){case"#":return this._base+t;case"?":return this._base.replace(/(?:\?.*)?$/,t);case"/":return("/"===t[1]?this._baseScheme:this._baseRoot)+this._removeDotSegments(t);default:return/^[^/:]*:/.test(t)?null:this._removeDotSegments(this._basePath+t)}}_removeDotSegments(t){if(!/(^|\/)\.\.?($|[/#?])/.test(t))return t;const e=t.length;let i="",r=-1,s=-1,n=0,a="/";for(;r<e;){switch(a){case":":if(s<0&&"/"===t[++r]&&"/"===t[++r])for(;(s=r+1)<e&&"/"!==t[s];)r=s;break;case"?":case"#":r=e;break;case"/":if("."===t[r+1])switch(a=t[1+ ++r],a){case"/":i+=t.substring(n,r-1),n=r+1;break;case void 0:case"?":case"#":return i+t.substring(n,r)+t.substr(r+1);case".":if(a=t[1+ ++r],void 0===a||"/"===a||"?"===a||"#"===a){if(i+=t.substring(n,r-2),(n=i.lastIndexOf("/"))>=s&&(i=i.substr(0,n)),"/"!==a)return`${i}/${t.substr(r+1)}`;n=r+1}}}a=t[++r]}return i+t.substring(n)}parse(t,e,i){let r,s,n;if(e&&(e.onQuad||e.onPrefix||e.onComment)?(r=e.onQuad,s=e.onPrefix,n=e.onComment):(r=e,s=i),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${qt++}_`,this._prefixCallback=s||Qt,this._inversePredicate=!1,this._quantified=Object.create(null),!r){const e=[];let i;if(this._callback=(t,r)=>{t?i=t:r&&e.push(r)},this._lexer.tokenize(t).every(t=>this._readCallback=this._readCallback(t)),i)throw i;return e}let a=(t,e)=>{null!==t?(this._callback(t),this._callback=Qt):this._readCallback&&(this._readCallback=this._readCallback(e))};n&&(this._lexer.comments=!0,a=(t,e)=>{null!==t?(this._callback(t),this._callback=Qt):this._readCallback&&("comment"===e.type?n(e.value):this._readCallback=this._readCallback(e))}),this._callback=r,this._lexer.tokenize(t,a)}}function Qt(){}function Ht(t,e){t._factory=e,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=e.namedNode(ft.rdf.first),t.RDF_REST=e.namedNode(ft.rdf.rest),t.RDF_NIL=e.namedNode(ft.rdf.nil),t.N3_FORALL=e.namedNode(ft.r.forAll),t.N3_FORSOME=e.namedNode(ft.r.forSome),t.ABBREVIATIONS={a:e.namedNode(ft.rdf.type),"=":e.namedNode(ft.owl.sameAs),">":e.namedNode(ft.log.implies),"<":e.namedNode(ft.log.isImpliedBy)},t.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}function Gt(t){return!!t&&"DefaultGraph"===t.termType}function zt(t){return t.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}Ht(Ut.prototype,Et);const Yt=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,Vt=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/;class Xt{constructor(t){this.base=t,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(t.length+1)}static supports(t){return!Yt.test(t)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!Xt.supports(this.base))return this._baseMatcher=/.^/;const t=/^[^:]*:\/*/.exec(this.base)[0],e=["^",zt(t)],i=[],r=[],s=/[^/?#]*([/?#])/y;let n,a=0,o=0,h=s.lastIndex=t.length;for(;!a&&!o&&(n=s.exec(this.base));)"#"===n[1]?o=s.lastIndex-1:(e.push(zt(n[0]),"(?:"),i.push(")?"),"?"!==n[1]?r.push(h=s.lastIndex):(a=h=s.lastIndex,o=this.base.indexOf("#",a),this._pathReplacements[a]="?"));for(let t=0;t<r.length;t++)this._pathReplacements[r[t]]="../".repeat(r.length-t-1);return this._pathReplacements[r[r.length-1]]="./",this._baseLength=o>0?o:this.base.length,e.push(zt(this.base.substring(h,this._baseLength)),a?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...e,...i].join(""))}toRelative(t){const e=this._getBaseMatcher().exec(t);if(!e)return t;const i=e[0].length;if(i===this._baseLength&&i===t.length)return"";const r=this._pathReplacements[i];if(r){const e=t.substring(i);return"?"===r||Vt.test(e)?"./"===r&&/^[^?#]/.test(e)?e:r+e:t}return t.substring(i-1)}}const Wt=Et.defaultGraph(),{rdf:Zt,xsd:Jt}=ft,Kt=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,te=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,ee={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class ie extends Rt{equals(t){return t===this}}class re{constructor(t,e){if(this._prefixRegex=/$0^/,t&&"function"!=typeof t.write&&(e=t,t=null),e=e||{},this._lists=e.lists,t)this._outputStream=t,this._endStream=void 0===e.end||!!e.end;else{let t="";this._outputStream={write(e,i,r){t+=e,r&&r()},end:e=>{e&&e(null,t)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(e.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=Wt,this._prefixIRIs=Object.create(null),e.prefixes&&this.addPrefixes(e.prefixes),e.baseIRI&&(this._baseIri=new Xt(e.baseIRI)))}get _inDefaultGraph(){return Wt.equals(this._graph)}_write(t,e){this._outputStream.write(t,"utf8",e)}_writeQuad(t,e,i,r,s){try{r.equals(this._graph)||(this._write((null===this._subject?"":this._inDefaultGraph?".\n":"\n}\n")+(Wt.equals(r)?"":`${this._encodeIriOrBlank(r)} {\n`)),this._graph=r,this._subject=null),t.equals(this._subject)?e.equals(this._predicate)?this._write(`, ${this._encodeObject(i)}`,s):this._write(`;\n ${this._encodePredicate(this._predicate=e)} ${this._encodeObject(i)}`,s):this._write(`${(null===this._subject?"":".\n")+this._encodeSubject(this._subject=t)} ${this._encodePredicate(this._predicate=e)} ${this._encodeObject(i)}`,s)}catch(t){s&&s(t)}}_writeQuadLine(t,e,i,r,s){delete this._prefixMatch,this._write(this.quadToString(t,e,i,r),s)}quadToString(t,e,i,r){return`${this._encodeSubject(t)} ${this._encodeIriOrBlank(e)} ${this._encodeObject(i)}${r&&r.value?` ${this._encodeIriOrBlank(r)} .\n`:" .\n"}`}quadsToString(t){let e="";for(const i of t)e+=this.quadToString(i.subject,i.predicate,i.object,i.graph);return e}_encodeSubject(t){return"Quad"===t.termType?this._encodeQuad(t):this._encodeIriOrBlank(t)}_encodeIriOrBlank(t){if("NamedNode"!==t.termType)return this._lists&&t.value in this._lists&&(t=this.list(this._lists[t.value])),"id"in t?t.id:`_:${t.value}`;let e=t.value;this._baseIri&&(e=this._baseIri.toRelative(e)),Kt.test(e)&&(e=e.replace(te,se));const i=this._prefixRegex.exec(e);return i?i[1]?this._prefixIRIs[i[1]]+i[2]:e:`<${e}>`}_encodeLiteral(t){let e=t.value;if(Kt.test(e)&&(e=e.replace(te,se)),t.language)return`"${e}"@${t.language}`;if(this._lineMode){if(t.datatype.value===Jt.string)return`"${e}"`}else switch(t.datatype.value){case Jt.string:return`"${e}"`;case Jt.boolean:if("true"===e||"false"===e)return e;break;case Jt.integer:if(/^[+-]?\d+$/.test(e))return e;break;case Jt.decimal:if(/^[+-]?\d*\.\d+$/.test(e))return e;break;case Jt.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(e))return e}return`"${e}"^^${this._encodeIriOrBlank(t.datatype)}`}_encodePredicate(t){return t.value===Zt.type?"a":this._encodeIriOrBlank(t)}_encodeObject(t){switch(t.termType){case"Quad":return this._encodeQuad(t);case"Literal":return this._encodeLiteral(t);default:return this._encodeIriOrBlank(t)}}_encodeQuad({subject:t,predicate:e,object:i,graph:r}){return`<<${this._encodeSubject(t)} ${this._encodePredicate(e)} ${this._encodeObject(i)}${Gt(r)?"":` ${this._encodeIriOrBlank(r)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(t,e,i,r,s){void 0===i?this._writeQuad(t.subject,t.predicate,t.object,t.graph,e):"function"==typeof r?this._writeQuad(t,e,i,Wt,r):this._writeQuad(t,e,i,r||Wt,s)}addQuads(t){for(let e=0;e<t.length;e++)this.addQuad(t[e])}addPrefix(t,e,i){const r={};r[t]=e,this.addPrefixes(r,i)}addPrefixes(t,e){if(!this._prefixIRIs)return e&&e();let i=!1;for(let e in t){let r=t[e];"string"!=typeof r&&(r=r.value),i=!0,null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null,this._graph=""),this._prefixIRIs[r]=e+=":",this._write(`@prefix ${e} <${r}>.\n`)}if(i){let t="",e="";for(const i in this._prefixIRIs)t+=t?`|${i}`:i,e+=(e?"|":"")+this._prefixIRIs[i];t=zt(t),this._prefixRegex=new RegExp(`^(?:${e})[^/]*$|^(${t})([_a-zA-Z0-9][\\-_a-zA-Z0-9]*)$`)}this._write(i?"\n":"",e)}blank(t,e){let i,r,s=t;switch(void 0===t?s=[]:t.termType?s=[{predicate:t,object:e}]:"length"in t||(s=[t]),r=s.length){case 0:return new ie("[]");case 1:if(i=s[0],!(i.object instanceof ie))return new ie(`[ ${this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)} ]`);default:let e="[";for(let n=0;n<r;n++)i=s[n],i.predicate.equals(t)?e+=`, ${this._encodeObject(i.object)}`:(e+=`${(n?";\n ":"\n ")+this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)}`,t=i.predicate);return new ie(`${e}\n]`)}}list(t){const e=t&&t.length||0,i=new Array(e);for(let r=0;r<e;r++)i[r]=this._encodeObject(t[r]);return new ie(`(${i.join(" ")})`)}end(t){null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null),this._write=this._blockedWrite;let e=t&&((i,r)=>{e=null,t(i,r)});if(this._endStream)try{return this._outputStream.end(e)}catch(t){}e&&e()}}function se(t){let e=ee[t];return void 0===e&&(1===t.length?(e=t.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=(1024*(t.charCodeAt(0)-55296)+t.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}class ne{constructor(){}on(){return this}once(){return this}emit(){return this}pipe(){return this}push(){return!1}destroy(){}_read(){}}class ae{constructor(){}on(){return this}write(){}end(){}}class oe extends ne{}class he extends oe{}var ue={Readable:ne,Writable:ae,Transform:oe,PassThrough:he},le=Object.freeze({__proto__:null,PassThrough:he,Readable:ne,Transform:oe,Writable:ae,default:ue});const ce=Symbol("iter");function de(t,e,i=4){if(0===i)return Object.assign(t,e);for(const r in e)t[r]=de(t[r]||Object.create(null),e[r],i-1);return t}function fe(t,e,i=4){let r=!1;for(const s in t)if(s in e){const n=0===i?null:fe(t[s],e[s],i-1);if(!1!==n)r=r||Object.create(null),r[s]=n;else if(3===i)return!1}return r}function pe(t,e,i=4){let r=!1;for(const s in t)if(s in e){if(0!==i){const n=pe(t[s],e[s],i-1);if(!1!==n)r=r||Object.create(null),r[s]=n;else if(3===i)return!1}}else r=r||Object.create(null),r[s]=0===i?null:de({},t[s],i-1);return r}class _e{constructor(t={}){this._id=1,this._ids=Object.create(null),this._ids[""]=1,this._entities=Object.create(null),this._entities[1]="",this._blankNodeIndex=0,this._factory=t.factory||Et}_termFromId(t){if("."===t[0]){const e=this._entities,i=t.split(".");return this._factory.quad(this._termFromId(e[i[1]]),this._termFromId(e[i[2]]),this._termFromId(e[i[3]]),i[4]&&this._termFromId(e[i[4]]))}return Pt(t,this._factory)}_termToNumericId(t){if("Quad"===t.termType){const e=this._termToNumericId(t.subject),i=this._termToNumericId(t.predicate),r=this._termToNumericId(t.object);let s;return e&&i&&r&&(Gt(t.graph)||(s=this._termToNumericId(t.graph)))&&this._ids[s?`.${e}.${i}.${r}.${s}`:`.${e}.${i}.${r}`]}return this._ids[kt(t)]}_termToNewNumericId(t){const e=t&&"Quad"===t.termType?`.${this._termToNewNumericId(t.subject)}.${this._termToNewNumericId(t.predicate)}.${this._termToNewNumericId(t.object)}${Gt(t.graph)?"":`.${this._termToNewNumericId(t.graph)}`}`:kt(t);return this._ids[e]||(this._ids[this._entities[++this._id]=e]=this._id)}createBlankNode(t){let e,i;if(t)for(e=t=`_:${t}`,i=1;this._ids[e];)e=t+i++;else do{e="_:b"+this._blankNodeIndex++}while(this._ids[e]);return this._ids[e]=++this._id,this._entities[this._id]=e,this._factory.blankNode(e.substr(2))}}class ge{constructor(t,e){this._size=0,this._graphs=Object.create(null),e||!t||t[0]||"function"==typeof t.match||(e=t,t=null),e=e||{},this._factory=e.factory||Et,this._entityIndex=e.entityIndex||new _e({factory:this._factory}),this._entities=this._entityIndex._entities,this._termFromId=this._entityIndex._termFromId.bind(this._entityIndex),this._termToNumericId=this._entityIndex._termToNumericId.bind(this._entityIndex),this._termToNewNumericId=this._entityIndex._termToNewNumericId.bind(this._entityIndex),t&&this.addAll(t)}get size(){let t=this._size;if(null!==t)return t;t=0;const e=this._graphs;let i,r;for(const s in e)for(const n in i=e[s].subjects)for(const e in r=i[n])t+=Object.keys(r[e]).length;return this._size=t}_addToIndex(t,e,i,r){const s=t[e]||(t[e]={}),n=s[i]||(s[i]={}),a=r in n;return a||(n[r]=null),!a}_removeFromIndex(t,e,i,r){const s=t[e],n=s[i];delete n[r];for(const t in n)return;delete s[i];for(const t in s)return;delete t[e]}*_findInIndex(t,e,i,r,s,n,a,o){let h,u,l;const c=this._entities,d=this._termFromId(c[o]),f={subject:null,predicate:null,object:null};e&&((h=t,t={})[e]=h[e]);for(const e in t)if(u=t[e]){f[s]=this._termFromId(c[e]),i&&((h=u,u={})[i]=h[i]);for(const t in u)if(l=u[t]){f[n]=this._termFromId(c[t]);const e=r?r in l?[r]:[]:Object.keys(l);for(let t=0;t<e.length;t++)f[a]=this._termFromId(c[e[t]]),yield this._factory.quad(f.subject,f.predicate,f.object,d)}}}_loop(t,e){for(const i in t)e(i)}_loopByKey0(t,e,i){let r,s;if(r=t[e])for(s in r)i(s)}_loopByKey1(t,e,i){let r,s;for(r in t)s=t[r],s[e]&&i(r)}_loopBy2Keys(t,e,i,r){let s,n,a;if((s=t[e])&&(n=s[i]))for(a in n)r(a)}_countInIndex(t,e,i,r){let s,n,a,o=0;e&&((s=t,t={})[e]=s[e]);for(const e in t)if(n=t[e]){i&&((s=n,n={})[i]=s[i]);for(const t in n)(a=n[t])&&(r?r in a&&o++:o+=Object.keys(a).length)}return o}_getGraphs(t){return"number"!=typeof(t=""===t?1:t&&(this._termToNumericId(t)||-1))?this._graphs:{[t]:this._graphs[t]}}_uniqueEntities(t){const e=Object.create(null);return i=>{i in e||(e[i]=!0,t(this._termFromId(this._entities[i],this._factory)))}}add(t){return this.addQuad(t),this}addQuad(t,e,i,r){e||(r=t.graph,i=t.object,e=t.predicate,t=t.subject),r=r?this._termToNewNumericId(r):1;let s=this._graphs[r];return s||(s=this._graphs[r]={subjects:{},predicates:{},objects:{}},Object.freeze(s)),t=this._termToNewNumericId(t),e=this._termToNewNumericId(e),i=this._termToNewNumericId(i),!!this._addToIndex(s.subjects,t,e,i)&&(this._addToIndex(s.predicates,e,i,t),this._addToIndex(s.objects,i,t,e),this._size=null,!0)}addQuads(t){for(let e=0;e<t.length;e++)this.addQuad(t[e])}delete(t){return this.removeQuad(t),this}has(t,e,i,r){return t&&t.subject&&({subject:t,predicate:e,object:i,graph:r}=t),!this.readQuads(t,e,i,r).next().done}import(t){return t.on("data",t=>{this.addQuad(t)}),t}removeQuad(t,e,i,r){e||({subject:t,predicate:e,object:i,graph:r}=t),r=r?this._termToNumericId(r):1;const s=this._graphs;let n,a,o;if(!((t=t&&this._termToNumericId(t))&&(e=e&&this._termToNumericId(e))&&(i=i&&this._termToNumericId(i))&&(n=s[r])&&(a=n.subjects[t])&&(o=a[e])&&i in o))return!1;for(t in this._removeFromIndex(n.subjects,t,e,i),this._removeFromIndex(n.predicates,e,i,t),this._removeFromIndex(n.objects,i,t,e),null!==this._size&&this._size--,n.subjects)return!0;return delete s[r],!0}removeQuads(t){for(let e=0;e<t.length;e++)this.removeQuad(t[e])}remove(t){return t.on("data",t=>{this.removeQuad(t)}),t}removeMatches(t,e,i,r){const s=new ne({objectMode:!0}),n=this.readQuads(t,e,i,r);return s._read=t=>{for(;--t>=0;){const{done:t,value:e}=n.next();if(t)return void s.push(null);s.push(e)}},this.remove(s)}deleteGraph(t){return this.removeMatches(null,null,null,t)}getQuads(t,e,i,r){return[...this.readQuads(t,e,i,r)]}*readQuads(t,e,i,r){const s=this._getGraphs(r);let n,a,o,h;if(!(t&&!(a=this._termToNumericId(t))||e&&!(o=this._termToNumericId(e))||i&&!(h=this._termToNumericId(i))))for(const t in s)(n=s[t])&&(a?h?yield*this._findInIndex(n.objects,h,a,o,"object","subject","predicate",t):yield*this._findInIndex(n.subjects,a,o,null,"subject","predicate","object",t):o?yield*this._findInIndex(n.predicates,o,h,null,"predicate","object","subject",t):h?yield*this._findInIndex(n.objects,h,null,null,"object","subject","predicate",t):yield*this._findInIndex(n.subjects,null,null,null,"subject","predicate","object",t))}match(t,e,i,r){return new me(this,t,e,i,r,{entityIndex:this._entityIndex})}countQuads(t,e,i,r){const s=this._getGraphs(r);let n,a,o,h,u=0;if(t&&!(a=this._termToNumericId(t))||e&&!(o=this._termToNumericId(e))||i&&!(h=this._termToNumericId(i)))return 0;for(const r in s)(n=s[r])&&(u+=t?i?this._countInIndex(n.objects,h,a,o):this._countInIndex(n.subjects,a,o,h):e?this._countInIndex(n.predicates,o,h,a):this._countInIndex(n.objects,h,a,o));return u}forEach(t,e,i,r,s){this.some(e=>(t(e,this),!1),e,i,r,s)}every(t,e,i,r,s){return!this.some(e=>!t(e,this),e,i,r,s)}some(t,e,i,r,s){for(const n of this.readQuads(e,i,r,s))if(t(n,this))return!0;return!1}getSubjects(t,e,i){const r=[];return this.forSubjects(t=>{r.push(t)},t,e,i),r}forSubjects(t,e,i,r){const s=this._getGraphs(r);let n,a,o;if(t=this._uniqueEntities(t),!(e&&!(a=this._termToNumericId(e))||i&&!(o=this._termToNumericId(i))))for(r in s)(n=s[r])&&(a?o?this._loopBy2Keys(n.predicates,a,o,t):this._loopByKey1(n.subjects,a,t):o?this._loopByKey0(n.objects,o,t):this._loop(n.subjects,t))}getPredicates(t,e,i){const r=[];return this.forPredicates(t=>{r.push(t)},t,e,i),r}forPredicates(t,e,i,r){const s=this._getGraphs(r);let n,a,o;if(t=this._uniqueEntities(t),!(e&&!(a=this._termToNumericId(e))||i&&!(o=this._termToNumericId(i))))for(r in s)(n=s[r])&&(a?o?this._loopBy2Keys(n.objects,o,a,t):this._loopByKey0(n.subjects,a,t):o?this._loopByKey1(n.predicates,o,t):this._loop(n.predicates,t))}getObjects(t,e,i){const r=[];return this.forObjects(t=>{r.push(t)},t,e,i),r}forObjects(t,e,i,r){const s=this._getGraphs(r);let n,a,o;if(t=this._uniqueEntities(t),!(e&&!(a=this._termToNumericId(e))||i&&!(o=this._termToNumericId(i))))for(r in s)(n=s[r])&&(a?o?this._loopBy2Keys(n.subjects,a,o,t):this._loopByKey1(n.objects,a,t):o?this._loopByKey0(n.predicates,o,t):this._loop(n.objects,t))}getGraphs(t,e,i){const r=[];return this.forGraphs(t=>{r.push(t)},t,e,i),r}forGraphs(t,e,i,r){for(const s in this._graphs)this.some(e=>(t(e.graph),!0),e,i,r,this._termFromId(this._entities[s]))}createBlankNode(t){return this._entityIndex.createBlankNode(t)}extractLists({remove:t=!1,ignoreErrors:e=!1}={}){const i={},r=e?()=>!0:(t,e)=>{throw new Error(`${t.value} ${e}`)},s=this.getQuads(null,ft.rdf.rest,ft.rdf.nil,null),n=t?[...s]:[];return s.forEach(e=>{const s=[];let a,o,h=!1;const u=e.graph;let l=e.subject;for(;l&&!h;){const t=this.getQuads(null,null,l,null),e=this.getQuads(l,null,null,null);let i,c=null,d=null,f=null;for(let s=0;s<e.length&&!h;s++)i=e[s],i.graph.equals(u)?a?h=r(l,"has non-list arcs out"):i.predicate.value===ft.rdf.first?c?h=r(l,"has multiple rdf:first arcs"):n.push(c=i):i.predicate.value===ft.rdf.rest?d?h=r(l,"has multiple rdf:rest arcs"):n.push(d=i):t.length?h=r(l,"can't be subject and object"):(a=i,o="subject"):h=r(l,"not confined to single graph");for(let e=0;e<t.length&&!h;++e)i=t[e],a?h=r(l,"can't have coreferences"):i.predicate.value===ft.rdf.rest?f?h=r(l,"has incoming rdf:rest arcs"):f=i:(a=i,o="object");c?s.unshift(c.object):h=r(l,"has no list head"),l=f&&f.subject}h?t=!1:a&&(i[a[o].value]=s)}),t&&this.removeQuads(n),i}addAll(t){if(t instanceof me&&(t=t.filtered),Array.isArray(t))this.addQuads(t);else if(t instanceof ge&&t._entityIndex===this._entityIndex)0!==t._size&&(this._graphs=de(this._graphs,t._graphs),this._size=null);else for(const e of t)this.add(e);return this}contains(t){if(t instanceof me&&(t=t.filtered),t===this)return!0;if(!(t instanceof ge)||this._entityIndex!==t._entityIndex)return t.every(t=>this.has(t));const e=this._graphs,i=t._graphs;let r,s,n,a,o;for(const t in i){if(!(r=e[t]))return!1;r=r.subjects;for(const e in s=i[t].subjects){if(!(n=r[e]))return!1;for(const t in a=s[e]){if(!(o=n[t]))return!1;for(const e in a[t])if(!(e in o))return!1}}}return!0}deleteMatches(t,e,i,r){for(const s of this.match(t,e,i,r))this.removeQuad(s);return this}difference(t){if(t&&t instanceof me&&(t=t.filtered),t===this)return new ge({entityIndex:this._entityIndex});if(t instanceof ge&&t._entityIndex===this._entityIndex){const e=new ge({entityIndex:this._entityIndex}),i=pe(this._graphs,t._graphs);return i&&(e._graphs=i,e._size=null),e}return this.filter(e=>!t.has(e))}equals(t){return t instanceof me&&(t=t.filtered),t===this||this.size===t.size&&this.contains(t)}filter(t){const e=new ge({entityIndex:this._entityIndex});for(const i of this)t(i,this)&&e.add(i);return e}intersection(t){if(t instanceof me&&(t=t.filtered),t===this){const t=new ge({entityIndex:this._entityIndex});return t._graphs=de(Object.create(null),this._graphs),t._size=this._size,t}if(t instanceof ge&&this._entityIndex===t._entityIndex){const e=new ge({entityIndex:this._entityIndex}),i=fe(t._graphs,this._graphs);return i&&(e._graphs=i,e._size=null),e}return this.filter(e=>t.has(e))}map(t){const e=new ge({entityIndex:this._entityIndex});for(const i of this)e.add(t(i,this));return e}reduce(t,e){const i=this.readQuads();let r=void 0===e?i.next().value:e;for(const e of i)r=t(r,e,this);return r}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return(new re).quadsToString(this)}union(t){const e=new ge({entityIndex:this._entityIndex});return e._graphs=de(Object.create(null),this._graphs),e._size=this._size,e.addAll(t),e}*[Symbol.iterator](){yield*this.readQuads()}}function be(t,e,i=0){const r=e[i];if(r&&!(r in t))return!1;let s=!1;for(const n in r?{[r]:t[r]}:t){const r=2===i?null:be(t[n],e,i+1);!1!==r&&(s=s||Object.create(null),s[n]=r)}return s}class me extends ne{constructor(t,e,i,r,s,n){super({objectMode:!0}),Object.assign(this,{n3Store:t,subject:e,predicate:i,object:r,graph:s,options:n})}get filtered(){if(!this._filtered){const{n3Store:t,graph:e,object:i,predicate:r,subject:s}=this,n=this._filtered=new ge({factory:t._factory,entityIndex:this.options.entityIndex});let a,o,h;if(s&&!(a=n._termToNumericId(s))||r&&!(o=n._termToNumericId(r))||i&&!(h=n._termToNumericId(i)))return n;const u=t._getGraphs(e);for(const t in u){let e,i,r,s;(s=u[t])&&(!a&&o?(i=be(s.predicates,[o,h,a]))&&(e=be(s.subjects,[a,o,h]),r=be(s.objects,[h,a,o])):h?(r=be(s.objects,[h,a,o]))&&(e=be(s.subjects,[a,o,h]),i=be(s.predicates,[o,h,a])):(e=be(s.subjects,[a,o,h]))&&(i=be(s.predicates,[o,h,a]),r=be(s.objects,[h,a,o])),e&&(n._graphs[t]={subjects:e,predicates:i,objects:r}))}n._size=null}return this._filtered}get size(){return this.filtered.size}_read(t){t>0&&!this[ce]&&(this[ce]=this[Symbol.iterator]());const e=this[ce];for(;--t>=0;){const{done:t,value:i}=e.next();if(t)return void this.push(null);this.push(i)}}addAll(t){return this.filtered.addAll(t)}contains(t){return this.filtered.contains(t)}deleteMatches(t,e,i,r){return this.filtered.deleteMatches(t,e,i,r)}difference(t){return this.filtered.difference(t)}equals(t){return this.filtered.equals(t)}every(t,e,i,r,s){return this.filtered.every(t,e,i,r,s)}filter(t){return this.filtered.filter(t)}forEach(t,e,i,r,s){return this.filtered.forEach(t,e,i,r,s)}import(t){return this.filtered.import(t)}intersection(t){return this.filtered.intersection(t)}map(t){return this.filtered.map(t)}some(t,e,i,r,s){return this.filtered.some(t,e,i,r,s)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(t){return this._filtered?this._filtered.union(t):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(t)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(t,e){return this.filtered.reduce(t,e)}toString(){return(new re).quadsToString(this)}add(t){return this.filtered.add(t)}delete(t){return this.filtered.delete(t)}has(t){return this.filtered.has(t)}match(t,e,i,r){return new me(this.filtered,t,e,i,r,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}function ye(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if("function"==typeof e){var i=function t(){var i=!1;try{i=this instanceof t}catch{}return i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach(function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})}),i}var xe,ve,we={},Te={},Ie={},Ee={};function Re(){return ve||(ve=1,t=Ie,e=Ie&&Ie.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=Ie&&Ie.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i(function(){if(xe)return Ee;function t(t){const e=[];let r=0;for(;r<t.length;)switch(t[r]){case"/":if("."===t[r+1])if("."===t[r+2]){if(!i(t[r+3])){e.push([]),r++;break}e.pop(),t[r+3]||e.push([]),r+=3}else{if(!i(t[r+2])){e.push([]),r++;break}t[r+2]||e.push([]),r+=2}else e.push([]),r++;break;case"#":case"?":e.length||e.push([]),e[e.length-1].push(t.substr(r)),r=t.length;break;default:e.length||e.push([]),e[e.length-1].push(t[r]),r++}return"/"+e.map(t=>t.join("")).join("/")}function e(e,i){let r=i+1;i>=0?"/"===e[i+1]&&"/"===e[i+2]&&(r=i+3):"/"===e[0]&&"/"===e[1]&&(r=2);const s=e.indexOf("/",r);return s<0?e:e.substr(0,s)+t(e.substr(s))}function i(t){return!t||"#"===t||"?"===t||"/"===t}return xe=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.removeDotSegmentsOfPath=Ee.removeDotSegments=Ee.resolve=void 0,Ee.resolve=function(i,r){const s=(r=r||"").indexOf("#");if(s>0&&(r=r.substr(0,s)),!i.length){if(r.indexOf(":")<0)throw new Error(`Found invalid baseIRI '${r}' for value '${i}'`);return r}if(i.startsWith("?")){const t=r.indexOf("?");return t>0&&(r=r.substr(0,t)),r+i}if(i.startsWith("#"))return r+i;if(!r.length){const t=i.indexOf(":");if(t<0)throw new Error(`Found invalid relative IRI '${i}' for a missing baseIRI`);return e(i,t)}const n=i.indexOf(":");if(n>=0){const t=i.indexOf("/");if(t<0||n<t)return e(i,n)}const a=r.indexOf(":");if(a<0)throw new Error(`Found invalid baseIRI '${r}' for value '${i}'`);const o=r.substr(0,a+1);if(0===i.indexOf("//"))return o+e(i,n);let h;if(r.indexOf("//",a)===a+1){if(h=r.indexOf("/",a+3),h<0)return r.length>a+3?r+"/"+e(i,n):o+e(i,n)}else if(h=r.indexOf("/",a+1),h<0)return o+e(i,n);if(0===i.indexOf("/"))return r.substr(0,h)+t(i);let u=r.substr(h);const l=u.lastIndexOf("/");return l>=0&&l<u.length-1&&(u=u.substr(0,l+1),"."===i[0]&&"."!==i[1]&&"/"!==i[1]&&i[2]&&(i=i.substr(1))),i=t(i=u+i),r.substr(0,h)+i},Ee.removeDotSegments=t,Ee.removeDotSegmentsOfPath=e,Ee}(),t)),Ie;var t,e,i}var Ne,Se={},je={};function Ce(){return Ne||(Ne=1,function(t){
|
|
1
|
+
var jsonldUIUtilsLeaflet=function(t){"use strict";async function e(t){const e=new Map,i=async(t,e)=>{for(const[s,n]of Object.entries(t))"@context"===s?t[s]=await r(n,e):"object"==typeof n&&null!==n&&await i(n,e)},r=async(t,s)=>{if(null==t)return{};if(Array.isArray(t)){return(t=>{const e=(t,e)=>{if(!t||!Object.keys(t).length)return e;const i={...t};for(const[t,r]of Object.entries(e))i[t]=r;return i};if(!t.length)return{};if(1===t.length)return t[0];let i=t[0];for(let r=1;r<t.length;r++)i=e(i,t[r]);return i})(await Promise.all(t.map(t=>r(t,s))))}if("object"==typeof t)return await i(t,s),t;{if(null==s?void 0:s.includes(t))throw new Error("Circular dependencies found: "+s.join(" -> ")+" -> "+t);const i=Array.isArray(s)?null==s?void 0:s.slice():[];let n;return i.push(t),e.has(t)?n=e.get(t):(n=await(async t=>{const e=await fetch(t,{headers:{Accept:"application/json"}});return await e.json()})(t),e.set(t,n)),r(n["@context"],i)}};return r("object"==typeof t&&null!==t&&"@context"in t?t["@context"]:t)}const i=t=>e=>`${t}${e}`,r=i("http://www.w3.org/2004/02/skos/core#"),s=i("http://www.w3.org/2000/01/rdf-schema#"),n=i("http://purl.org/dc/terms/"),a=i("http://purl.org/dc/elements/1.1/"),o=i("https://schema.org/"),h=i("http://xmlns.com/foaf/0.1/"),u=[r("prefLabel"),n("title"),a("title"),o("name"),h("name"),s("label")],l=[r("definition"),n("description"),a("description"),s("comment")];var c="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},d=[],f=[],p="undefined"!=typeof Uint8Array?Uint8Array:Array,_=!1;function g(){_=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)d[e]=t[e],f[t.charCodeAt(e)]=e;f["-".charCodeAt(0)]=62,f["_".charCodeAt(0)]=63}function b(t){return d[t>>18&63]+d[t>>12&63]+d[t>>6&63]+d[63&t]}function m(t,e,i){for(var r,s=[],n=e;n<i;n+=3)r=(t[n]<<16)+(t[n+1]<<8)+t[n+2],s.push(b(r));return s.join("")}function y(t){var e;_||g();for(var i=t.length,r=i%3,s="",n=[],a=16383,o=0,h=i-r;o<h;o+=a)n.push(m(t,o,o+a>h?h:o+a));return 1===r?(e=t[i-1],s+=d[e>>2],s+=d[e<<4&63],s+="=="):2===r&&(e=(t[i-2]<<8)+t[i-1],s+=d[e>>10],s+=d[e>>4&63],s+=d[e<<2&63],s+="="),n.push(s),n.join("")}function x(t,e,i,r,s){var n,a,o=8*s-r-1,h=(1<<o)-1,u=h>>1,l=-7,c=i?s-1:0,d=i?-1:1,f=t[e+c];for(c+=d,n=f&(1<<-l)-1,f>>=-l,l+=o;l>0;n=256*n+t[e+c],c+=d,l-=8);for(a=n&(1<<-l)-1,n>>=-l,l+=r;l>0;a=256*a+t[e+c],c+=d,l-=8);if(0===n)n=1-u;else{if(n===h)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),n-=u}return(f?-1:1)*a*Math.pow(2,n-r)}function v(t,e,i,r,s,n){var a,o,h,u=8*n-s-1,l=(1<<u)-1,c=l>>1,d=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:n-1,p=r?1:-1,_=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-a))<1&&(a--,h*=2),(e+=a+c>=1?d/h:d*Math.pow(2,1-c))*h>=2&&(a++,h/=2),a+c>=l?(o=0,a=l):a+c>=1?(o=(e*h-1)*Math.pow(2,s),a+=c):(o=e*Math.pow(2,c-1)*Math.pow(2,s),a=0));s>=8;t[i+f]=255&o,f+=p,o/=256,s-=8);for(a=a<<s|o,u+=s;u>0;t[i+f]=255&a,f+=p,a/=256,u-=8);t[i+f-p]|=128*_}var w={}.toString,T=Array.isArray||function(t){return"[object Array]"==w.call(t)};function I(){return R.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function E(t,e){if(I()<e)throw new RangeError("Invalid typed array length");return R.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=R.prototype:(null===t&&(t=new R(e)),t.length=e),t}function R(t,e,i){if(!(R.TYPED_ARRAY_SUPPORT||this instanceof R))return new R(t,e,i);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return j(this,t)}return N(this,t,e,i)}function N(t,e,i,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,i,r){if(e.byteLength,i<0||e.byteLength<i)throw new RangeError("'offset' is out of bounds");if(e.byteLength<i+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===i&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,i):new Uint8Array(e,i,r);R.TYPED_ARRAY_SUPPORT?(t=e).__proto__=R.prototype:t=C(t,e);return t}(t,e,i,r):"string"==typeof e?function(t,e,i){"string"==typeof i&&""!==i||(i="utf8");if(!R.isEncoding(i))throw new TypeError('"encoding" must be a valid string encoding');var r=0|A(e,i);t=E(t,r);var s=t.write(e,i);s!==r&&(t=t.slice(0,s));return t}(t,e,i):function(t,e){if(k(e)){var i=0|P(e.length);return 0===(t=E(t,i)).length||e.copy(t,0,0,i),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?E(t,0):C(t,e);if("Buffer"===e.type&&T(e.data))return C(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function S(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function j(t,e){if(S(e),t=E(t,e<0?0:0|P(e)),!R.TYPED_ARRAY_SUPPORT)for(var i=0;i<e;++i)t[i]=0;return t}function C(t,e){var i=e.length<0?0:0|P(e.length);t=E(t,i);for(var r=0;r<i;r+=1)t[r]=255&e[r];return t}function P(t){if(t>=I())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+I().toString(16)+" bytes");return 0|t}function k(t){return!(null==t||!t._isBuffer)}function A(t,e){if(k(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var i=t.length;if(0===i)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return at(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return ot(t).length;default:if(r)return at(t).length;e=(""+e).toLowerCase(),r=!0}}function $(t,e,i){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return X(this,e,i);case"utf8":case"utf-8":return Q(this,e,i);case"ascii":return Y(this,e,i);case"latin1":case"binary":return V(this,e,i);case"base64":return H(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return W(this,e,i);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function D(t,e,i){var r=t[e];t[e]=t[i],t[i]=r}function O(t,e,i,r,s){if(0===t.length)return-1;if("string"==typeof i?(r=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=s?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(s)return-1;i=t.length-1}else if(i<0){if(!s)return-1;i=0}if("string"==typeof e&&(e=R.from(e,r)),k(e))return 0===e.length?-1:F(t,e,i,r,s);if("number"==typeof e)return e&=255,R.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):F(t,[e],i,r,s);throw new TypeError("val must be string, number or Buffer")}function F(t,e,i,r,s){var n,a=1,o=t.length,h=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,o/=2,h/=2,i/=2}function u(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(s){var l=-1;for(n=i;n<o;n++)if(u(t,n)===u(e,-1===l?0:n-l)){if(-1===l&&(l=n),n-l+1===h)return l*a}else-1!==l&&(n-=n-l),l=-1}else for(i+h>o&&(i=o-h),n=i;n>=0;n--){for(var c=!0,d=0;d<h;d++)if(u(t,n+d)!==u(e,d)){c=!1;break}if(c)return n}return-1}function L(t,e,i,r){i=Number(i)||0;var s=t.length-i;r?(r=Number(r))>s&&(r=s):r=s;var n=e.length;if(n%2!=0)throw new TypeError("Invalid hex string");r>n/2&&(r=n/2);for(var a=0;a<r;++a){var o=parseInt(e.substr(2*a,2),16);if(isNaN(o))return a;t[i+a]=o}return a}function M(t,e,i,r){return ht(at(e,t.length-i),t,i,r)}function B(t,e,i,r){return ht(function(t){for(var e=[],i=0;i<t.length;++i)e.push(255&t.charCodeAt(i));return e}(e),t,i,r)}function q(t,e,i,r){return B(t,e,i,r)}function U(t,e,i,r){return ht(ot(e),t,i,r)}function G(t,e,i,r){return ht(function(t,e){for(var i,r,s,n=[],a=0;a<t.length&&!((e-=2)<0);++a)r=(i=t.charCodeAt(a))>>8,s=i%256,n.push(s),n.push(r);return n}(e,t.length-i),t,i,r)}function H(t,e,i){return 0===e&&i===t.length?y(t):y(t.slice(e,i))}function Q(t,e,i){i=Math.min(t.length,i);for(var r=[],s=e;s<i;){var n,a,o,h,u=t[s],l=null,c=u>239?4:u>223?3:u>191?2:1;if(s+c<=i)switch(c){case 1:u<128&&(l=u);break;case 2:128==(192&(n=t[s+1]))&&(h=(31&u)<<6|63&n)>127&&(l=h);break;case 3:n=t[s+1],a=t[s+2],128==(192&n)&&128==(192&a)&&(h=(15&u)<<12|(63&n)<<6|63&a)>2047&&(h<55296||h>57343)&&(l=h);break;case 4:n=t[s+1],a=t[s+2],o=t[s+3],128==(192&n)&&128==(192&a)&&128==(192&o)&&(h=(15&u)<<18|(63&n)<<12|(63&a)<<6|63&o)>65535&&h<1114112&&(l=h)}null===l?(l=65533,c=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),s+=c}return function(t){var e=t.length;if(e<=z)return String.fromCharCode.apply(String,t);var i="",r=0;for(;r<e;)i+=String.fromCharCode.apply(String,t.slice(r,r+=z));return i}(r)}R.TYPED_ARRAY_SUPPORT=void 0===c.TYPED_ARRAY_SUPPORT||c.TYPED_ARRAY_SUPPORT,I(),R.poolSize=8192,R._augment=function(t){return t.__proto__=R.prototype,t},R.from=function(t,e,i){return N(null,t,e,i)},R.TYPED_ARRAY_SUPPORT&&(R.prototype.__proto__=Uint8Array.prototype,R.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&R[Symbol.species]),R.alloc=function(t,e,i){return function(t,e,i,r){return S(e),e<=0?E(t,e):void 0!==i?"string"==typeof r?E(t,e).fill(i,r):E(t,e).fill(i):E(t,e)}(null,t,e,i)},R.allocUnsafe=function(t){return j(null,t)},R.allocUnsafeSlow=function(t){return j(null,t)},R.isBuffer=function(t){return null!=t&&(!!t._isBuffer||ut(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&ut(t.slice(0,0))}(t))},R.compare=function(t,e){if(!k(t)||!k(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var i=t.length,r=e.length,s=0,n=Math.min(i,r);s<n;++s)if(t[s]!==e[s]){i=t[s],r=e[s];break}return i<r?-1:r<i?1:0},R.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},R.concat=function(t,e){if(!T(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return R.alloc(0);var i;if(void 0===e)for(e=0,i=0;i<t.length;++i)e+=t[i].length;var r=R.allocUnsafe(e),s=0;for(i=0;i<t.length;++i){var n=t[i];if(!k(n))throw new TypeError('"list" argument must be an Array of Buffers');n.copy(r,s),s+=n.length}return r},R.byteLength=A,R.prototype._isBuffer=!0,R.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)D(this,e,e+1);return this},R.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)D(this,e,e+3),D(this,e+1,e+2);return this},R.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)D(this,e,e+7),D(this,e+1,e+6),D(this,e+2,e+5),D(this,e+3,e+4);return this},R.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?Q(this,0,t):$.apply(this,arguments)},R.prototype.equals=function(t){if(!k(t))throw new TypeError("Argument must be a Buffer");return this===t||0===R.compare(this,t)},R.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},R.prototype.compare=function(t,e,i,r,s){if(!k(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===r&&(r=0),void 0===s&&(s=this.length),e<0||i>t.length||r<0||s>this.length)throw new RangeError("out of range index");if(r>=s&&e>=i)return 0;if(r>=s)return-1;if(e>=i)return 1;if(this===t)return 0;for(var n=(s>>>=0)-(r>>>=0),a=(i>>>=0)-(e>>>=0),o=Math.min(n,a),h=this.slice(r,s),u=t.slice(e,i),l=0;l<o;++l)if(h[l]!==u[l]){n=h[l],a=u[l];break}return n<a?-1:a<n?1:0},R.prototype.includes=function(t,e,i){return-1!==this.indexOf(t,e,i)},R.prototype.indexOf=function(t,e,i){return O(this,t,e,i,!0)},R.prototype.lastIndexOf=function(t,e,i){return O(this,t,e,i,!1)},R.prototype.write=function(t,e,i,r){if(void 0===e)r="utf8",i=this.length,e=0;else if(void 0===i&&"string"==typeof e)r=e,i=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(i)?(i|=0,void 0===r&&(r="utf8")):(r=i,i=void 0)}var s=this.length-e;if((void 0===i||i>s)&&(i=s),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var n=!1;;)switch(r){case"hex":return L(this,t,e,i);case"utf8":case"utf-8":return M(this,t,e,i);case"ascii":return B(this,t,e,i);case"latin1":case"binary":return q(this,t,e,i);case"base64":return U(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,t,e,i);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),n=!0}},R.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var z=4096;function Y(t,e,i){var r="";i=Math.min(t.length,i);for(var s=e;s<i;++s)r+=String.fromCharCode(127&t[s]);return r}function V(t,e,i){var r="";i=Math.min(t.length,i);for(var s=e;s<i;++s)r+=String.fromCharCode(t[s]);return r}function X(t,e,i){var r=t.length;(!e||e<0)&&(e=0),(!i||i<0||i>r)&&(i=r);for(var s="",n=e;n<i;++n)s+=nt(t[n]);return s}function W(t,e,i){for(var r=t.slice(e,i),s="",n=0;n<r.length;n+=2)s+=String.fromCharCode(r[n]+256*r[n+1]);return s}function Z(t,e,i){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>i)throw new RangeError("Trying to access beyond buffer length")}function J(t,e,i,r,s,n){if(!k(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>s||e<n)throw new RangeError('"value" argument is out of bounds');if(i+r>t.length)throw new RangeError("Index out of range")}function K(t,e,i,r){e<0&&(e=65535+e+1);for(var s=0,n=Math.min(t.length-i,2);s<n;++s)t[i+s]=(e&255<<8*(r?s:1-s))>>>8*(r?s:1-s)}function tt(t,e,i,r){e<0&&(e=4294967295+e+1);for(var s=0,n=Math.min(t.length-i,4);s<n;++s)t[i+s]=e>>>8*(r?s:3-s)&255}function et(t,e,i,r,s,n){if(i+r>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function it(t,e,i,r,s){return s||et(t,0,i,4),v(t,e,i,r,23,4),i+4}function rt(t,e,i,r,s){return s||et(t,0,i,8),v(t,e,i,r,52,8),i+8}R.prototype.slice=function(t,e){var i,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),R.TYPED_ARRAY_SUPPORT)(i=this.subarray(t,e)).__proto__=R.prototype;else{var s=e-t;i=new R(s,void 0);for(var n=0;n<s;++n)i[n]=this[n+t]}return i},R.prototype.readUIntLE=function(t,e,i){t|=0,e|=0,i||Z(t,e,this.length);for(var r=this[t],s=1,n=0;++n<e&&(s*=256);)r+=this[t+n]*s;return r},R.prototype.readUIntBE=function(t,e,i){t|=0,e|=0,i||Z(t,e,this.length);for(var r=this[t+--e],s=1;e>0&&(s*=256);)r+=this[t+--e]*s;return r},R.prototype.readUInt8=function(t,e){return e||Z(t,1,this.length),this[t]},R.prototype.readUInt16LE=function(t,e){return e||Z(t,2,this.length),this[t]|this[t+1]<<8},R.prototype.readUInt16BE=function(t,e){return e||Z(t,2,this.length),this[t]<<8|this[t+1]},R.prototype.readUInt32LE=function(t,e){return e||Z(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},R.prototype.readUInt32BE=function(t,e){return e||Z(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},R.prototype.readIntLE=function(t,e,i){t|=0,e|=0,i||Z(t,e,this.length);for(var r=this[t],s=1,n=0;++n<e&&(s*=256);)r+=this[t+n]*s;return r>=(s*=128)&&(r-=Math.pow(2,8*e)),r},R.prototype.readIntBE=function(t,e,i){t|=0,e|=0,i||Z(t,e,this.length);for(var r=e,s=1,n=this[t+--r];r>0&&(s*=256);)n+=this[t+--r]*s;return n>=(s*=128)&&(n-=Math.pow(2,8*e)),n},R.prototype.readInt8=function(t,e){return e||Z(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},R.prototype.readInt16LE=function(t,e){e||Z(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},R.prototype.readInt16BE=function(t,e){e||Z(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},R.prototype.readInt32LE=function(t,e){return e||Z(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},R.prototype.readInt32BE=function(t,e){return e||Z(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},R.prototype.readFloatLE=function(t,e){return e||Z(t,4,this.length),x(this,t,!0,23,4)},R.prototype.readFloatBE=function(t,e){return e||Z(t,4,this.length),x(this,t,!1,23,4)},R.prototype.readDoubleLE=function(t,e){return e||Z(t,8,this.length),x(this,t,!0,52,8)},R.prototype.readDoubleBE=function(t,e){return e||Z(t,8,this.length),x(this,t,!1,52,8)},R.prototype.writeUIntLE=function(t,e,i,r){(t=+t,e|=0,i|=0,r)||J(this,t,e,i,Math.pow(2,8*i)-1,0);var s=1,n=0;for(this[e]=255&t;++n<i&&(s*=256);)this[e+n]=t/s&255;return e+i},R.prototype.writeUIntBE=function(t,e,i,r){(t=+t,e|=0,i|=0,r)||J(this,t,e,i,Math.pow(2,8*i)-1,0);var s=i-1,n=1;for(this[e+s]=255&t;--s>=0&&(n*=256);)this[e+s]=t/n&255;return e+i},R.prototype.writeUInt8=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,1,255,0),R.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},R.prototype.writeUInt16LE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,2,65535,0),R.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):K(this,t,e,!0),e+2},R.prototype.writeUInt16BE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,2,65535,0),R.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):K(this,t,e,!1),e+2},R.prototype.writeUInt32LE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,4,4294967295,0),R.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):tt(this,t,e,!0),e+4},R.prototype.writeUInt32BE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,4,4294967295,0),R.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):tt(this,t,e,!1),e+4},R.prototype.writeIntLE=function(t,e,i,r){if(t=+t,e|=0,!r){var s=Math.pow(2,8*i-1);J(this,t,e,i,s-1,-s)}var n=0,a=1,o=0;for(this[e]=255&t;++n<i&&(a*=256);)t<0&&0===o&&0!==this[e+n-1]&&(o=1),this[e+n]=(t/a|0)-o&255;return e+i},R.prototype.writeIntBE=function(t,e,i,r){if(t=+t,e|=0,!r){var s=Math.pow(2,8*i-1);J(this,t,e,i,s-1,-s)}var n=i-1,a=1,o=0;for(this[e+n]=255&t;--n>=0&&(a*=256);)t<0&&0===o&&0!==this[e+n+1]&&(o=1),this[e+n]=(t/a|0)-o&255;return e+i},R.prototype.writeInt8=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,1,127,-128),R.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},R.prototype.writeInt16LE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,2,32767,-32768),R.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):K(this,t,e,!0),e+2},R.prototype.writeInt16BE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,2,32767,-32768),R.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):K(this,t,e,!1),e+2},R.prototype.writeInt32LE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,4,2147483647,-2147483648),R.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):tt(this,t,e,!0),e+4},R.prototype.writeInt32BE=function(t,e,i){return t=+t,e|=0,i||J(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),R.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):tt(this,t,e,!1),e+4},R.prototype.writeFloatLE=function(t,e,i){return it(this,t,e,!0,i)},R.prototype.writeFloatBE=function(t,e,i){return it(this,t,e,!1,i)},R.prototype.writeDoubleLE=function(t,e,i){return rt(this,t,e,!0,i)},R.prototype.writeDoubleBE=function(t,e,i){return rt(this,t,e,!1,i)},R.prototype.copy=function(t,e,i,r){if(i||(i=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<i&&(r=i),r===i)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-i&&(r=t.length-e+i);var s,n=r-i;if(this===t&&i<e&&e<r)for(s=n-1;s>=0;--s)t[s+e]=this[s+i];else if(n<1e3||!R.TYPED_ARRAY_SUPPORT)for(s=0;s<n;++s)t[s+e]=this[s+i];else Uint8Array.prototype.set.call(t,this.subarray(i,i+n),e);return n},R.prototype.fill=function(t,e,i,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,i=this.length):"string"==typeof i&&(r=i,i=this.length),1===t.length){var s=t.charCodeAt(0);s<256&&(t=s)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!R.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<i)throw new RangeError("Out of range index");if(i<=e)return this;var n;if(e>>>=0,i=void 0===i?this.length:i>>>0,t||(t=0),"number"==typeof t)for(n=e;n<i;++n)this[n]=t;else{var a=k(t)?t:at(new R(t,r).toString()),o=a.length;for(n=0;n<i-e;++n)this[n+e]=a[n%o]}return this};var st=/[^+\/0-9A-Za-z-_]/g;function nt(t){return t<16?"0"+t.toString(16):t.toString(16)}function at(t,e){var i;e=e||1/0;for(var r=t.length,s=null,n=[],a=0;a<r;++a){if((i=t.charCodeAt(a))>55295&&i<57344){if(!s){if(i>56319){(e-=3)>-1&&n.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&n.push(239,191,189);continue}s=i;continue}if(i<56320){(e-=3)>-1&&n.push(239,191,189),s=i;continue}i=65536+(s-55296<<10|i-56320)}else s&&(e-=3)>-1&&n.push(239,191,189);if(s=null,i<128){if((e-=1)<0)break;n.push(i)}else if(i<2048){if((e-=2)<0)break;n.push(i>>6|192,63&i|128)}else if(i<65536){if((e-=3)<0)break;n.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;n.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return n}function ot(t){return function(t){var e,i,r,s,n,a;_||g();var o=t.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");n="="===t[o-2]?2:"="===t[o-1]?1:0,a=new p(3*o/4-n),r=n>0?o-4:o;var h=0;for(e=0,i=0;e<r;e+=4,i+=3)s=f[t.charCodeAt(e)]<<18|f[t.charCodeAt(e+1)]<<12|f[t.charCodeAt(e+2)]<<6|f[t.charCodeAt(e+3)],a[h++]=s>>16&255,a[h++]=s>>8&255,a[h++]=255&s;return 2===n?(s=f[t.charCodeAt(e)]<<2|f[t.charCodeAt(e+1)]>>4,a[h++]=255&s):1===n&&(s=f[t.charCodeAt(e)]<<10|f[t.charCodeAt(e+1)]<<4|f[t.charCodeAt(e+2)]>>2,a[h++]=s>>8&255,a[h++]=255&s),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(st,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function ht(t,e,i,r){for(var s=0;s<r&&!(s+i>=e.length||s>=t.length);++s)e[s+i]=t[s];return s}function ut(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}const lt="http://www.w3.org/1999/02/22-rdf-syntax-ns#",ct="http://www.w3.org/2001/XMLSchema#",dt="http://www.w3.org/2000/10/swap/";var ft={xsd:{decimal:`${ct}decimal`,boolean:`${ct}boolean`,double:`${ct}double`,integer:`${ct}integer`,string:`${ct}string`},rdf:{type:`${lt}type`,nil:`${lt}nil`,first:`${lt}first`,rest:`${lt}rest`,langString:`${lt}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${dt}reify#forSome`,forAll:`${dt}reify#forAll`},log:{implies:`${dt}log#implies`,isImpliedBy:`${dt}log#isImpliedBy`}};const{xsd:pt}=ft,_t=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,gt={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:"\t",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},bt=/[\x00-\x20<>\\"\{\}\|\^\`]/,mt={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},yt=/$0^/;class xt{constructor(t){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]*)?$/,t=t||{},this._isImpliedBy=t.isImpliedBy,this._lineMode=!!t.lineMode){this._n3Mode=!1;for(const t in this)!(t in mt)&&this[t]instanceof RegExp&&(this[t]=yt)}else this._n3Mode=!1!==t.n3;this.comments=!!t.comments,this._literalClosingPos=0}_tokenizeToEnd(t,e){let i=this._input,r=i.length;for(;;){let t,a;for(;t=this._newline.exec(i);)this.comments&&(a=this._comment.exec(t[0]))&&s("comment",a[1],"",this._line,t[0].length),i=i.substr(t[0].length,i.length),r=i.length,this._line++;if(!t&&(t=this._whitespace.exec(i))&&(i=i.substr(t[0].length,i.length)),this._endOfFile.test(i))return e&&(this.comments&&(a=this._comment.exec(i))&&s("comment",a[1],"",this._line,i.length),i=null,s("eof","","",this._line,0)),this._input=i;const o=this._line,h=i[0];let u="",l="",c="",d=null,f=0,p=!1;switch(h){case"^":if(i.length<3)break;if("^"!==i[1]){this._n3Mode&&(f=1,u="^");break}if(this._previousMarker="^^",i=i.substr(2),"<"!==i[0]){p=!0;break}case"<":if(d=this._unescapedIri.exec(i))u="IRI",l=d[1];else if(d=this._iri.exec(i)){if(l=this._unescape(d[1]),null===l||bt.test(l))return n(this);u="IRI"}else i.length>1&&"<"===i[1]?(u="<<",f=2):this._n3Mode&&i.length>1&&"="===i[1]&&(f=2,this._isImpliedBy?(u="abbreviation",l="<"):(u="inverse",l=">"));break;case">":i.length>1&&">"===i[1]&&(u=">>",f=2);break;case"_":((d=this._blank.exec(i))||e&&(d=this._blank.exec(`${i} `)))&&(u="blank",c="_",l=d[1]);break;case'"':if(d=this._simpleQuotedString.exec(i))l=d[1];else if(({value:l,matchLength:f}=this._parseLiteral(i)),null===l)return n(this);null===d&&0===f||(u="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(d=this._simpleApostropheString.exec(i))l=d[1];else if(({value:l,matchLength:f}=this._parseLiteral(i)),null===l)return n(this);null===d&&0===f||(u="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(d=this._variable.exec(i))&&(u="var",l=d[0]);break;case"@":"literal"===this._previousMarker&&(d=this._langcode.exec(i))?(u="langcode",l=d[1]):(d=this._keyword.exec(i))&&(u=d[0]);break;case".":if(1===i.length?e:i[1]<"0"||i[1]>"9"){u=".",f=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(d=this._number.exec(i)||e&&(d=this._number.exec(`${i} `)))&&(u="literal",l=d[0],c="string"==typeof d[1]?pt.double:"string"==typeof d[2]?pt.decimal:pt.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(d=this._sparqlKeyword.exec(i))?u=d[0].toUpperCase():p=!0;break;case"f":case"t":(d=this._boolean.exec(i))?(u="literal",l=d[0],c=pt.boolean):p=!0;break;case"a":(d=this._shortPredicates.exec(i))?(u="abbreviation",l="a"):p=!0;break;case"=":this._n3Mode&&i.length>1&&(u="abbreviation",">"!==i[1]?(f=1,l="="):(f=2,l=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(f=1,u=h);break;case"{":!this._lineMode&&i.length>=2&&("|"===i[1]?(u="{|",f=2):(u=h,f=1));break;case"|":i.length>=2&&"}"===i[1]&&(u="|}",f=2);break;default:p=!0}if(p&&("@prefix"!==this._previousMarker&&"PREFIX"!==this._previousMarker||!(d=this._prefix.exec(i))?((d=this._prefixed.exec(i))||e&&(d=this._prefixed.exec(`${i} `)))&&(u="prefixed",c=d[1]||"",l=this._unescape(d[2])):(u="prefix",l=d[1]||"")),"^^"===this._previousMarker)switch(u){case"prefixed":u="type";break;case"IRI":u="typeIRI";break;default:u=""}if(!u)return e||!/^'''|^"""/.test(i)&&/\n|\r/.test(i)?n(this):this._input=i;const _=f||d[0].length,g=s(u,l,c,o,_);this.previousToken=g,this._previousMarker=u,i=i.substr(_,i.length)}function s(e,s,n,a,o){const h=i?r-i.length:r,u={type:e,value:s,prefix:n,line:a,start:h,end:h+o};return t(null,u),u}function n(e){t(e._syntaxError(/^\S*/.exec(i)[0]))}}_unescape(t){let e=!1;const i=t.replace(_t,(t,i,r,s)=>{if("string"==typeof i)return String.fromCharCode(Number.parseInt(i,16));if("string"==typeof r){let t=Number.parseInt(r,16);return t<=65535?String.fromCharCode(Number.parseInt(r,16)):String.fromCharCode(55296+((t-=65536)>>10),56320+(1023&t))}return s in gt?gt[s]:(e=!0,"")});return e?null:i}_parseLiteral(t){if(t.length>=3){const e=t.match(/^(?:"""|"|'''|'|)/)[0],i=e.length;let r=Math.max(this._literalClosingPos,i);for(;(r=t.indexOf(e,r))>0;){let e=0;for(;"\\"===t[r-e-1];)e++;if(e%2==0){const e=t.substring(i,r),s=e.split(/\r\n|\r|\n/).length-1,n=r+i;if(1===i&&0!==s||3===i&&this._lineMode)break;return this._line+=s,{value:this._unescape(e),matchLength:n}}r++}this._literalClosingPos=t.length-i+1}return{value:"",matchLength:0}}_syntaxError(t){this._input=null;const e=new Error(`Unexpected "${t}" on line ${this._line}.`);return e.context={token:void 0,line:this._line,previousToken:this.previousToken},e}_readStartingBom(t){return t.startsWith("\ufeff")?t.substr(1):t}tokenize(t,e){if(this._line=1,"string"==typeof t){if(this._input=this._readStartingBom(t),"function"!=typeof e){const t=[];let e;if(this._tokenizeToEnd((i,r)=>i?e=i:t.push(r),!0),e)throw e;return t}queueMicrotask(()=>this._tokenizeToEnd(e,!0))}else this._pendingBuffer=null,"function"==typeof t.setEncoding&&t.setEncoding("utf8"),t.on("data",t=>{null!==this._input&&0!==t.length&&(this._pendingBuffer&&(t=R.concat([this._pendingBuffer,t]),this._pendingBuffer=null),128&t[t.length-1]?this._pendingBuffer=t:(void 0===this._input?this._input=this._readStartingBom("string"==typeof t?t:t.toString()):this._input+=t,this._tokenizeToEnd(e,!1)))}),t.on("end",()=>{"string"==typeof this._input&&this._tokenizeToEnd(e,!0)}),t.on("error",e)}}const{rdf:vt,xsd:wt}=ft;let Tt,It=0;const Et={namedNode:$t,blankNode:Dt,variable:Ft,literal:Ot,defaultGraph:function(){return Tt},quad:Lt,triple:Lt,fromTerm:Mt,fromQuad:Bt};class Rt{constructor(t){this.id=t}get value(){return this.id}equals(t){return t instanceof Rt?this.id===t.id:!!t&&this.termType===t.termType&&this.value===t.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}}let Nt=class extends Rt{get termType(){return"NamedNode"}},St=class t extends Rt{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const t=this.id;let e=t.lastIndexOf('"')+1;return e<t.length&&"@"===t[e++]?t.substr(e).toLowerCase():""}get datatype(){return new Nt(this.datatypeString)}get datatypeString(){const t=this.id,e=t.lastIndexOf('"')+1,i=e<t.length?t[e]:"";return"^"===i?t.substr(e+2):"@"!==i?wt.string:vt.langString}equals(e){return e instanceof t?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&this.datatype.value===e.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}},jt=class extends Rt{constructor(t){super(`_:${t}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},Ct=class extends Rt{constructor(t){super(`?${t}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}};function Pt(t,e,i){if(e=e||Et,!t)return e.defaultGraph();switch(t[0]){case"?":return e.variable(t.substr(1));case"_":return e.blankNode(t.substr(2));case'"':if(e===Et)return new St(t);if('"'===t[t.length-1])return e.literal(t.substr(1,t.length-2));const r=t.lastIndexOf('"',t.length-1);return e.literal(t.substr(1,r-1),"@"===t[r+1]?t.substr(r+2):e.namedNode(t.substr(r+3)));case"[":t=JSON.parse(t);break;default:if(!i||!Array.isArray(t))return e.namedNode(t)}return e.quad(Pt(t[0],e,!0),Pt(t[1],e,!0),Pt(t[2],e,!0),t[3]&&Pt(t[3],e,!0))}function kt(t,e){if("string"==typeof t)return t;if(t instanceof Rt&&"Quad"!==t.termType)return t.id;if(!t)return Tt.id;switch(t.termType){case"NamedNode":return t.value;case"BlankNode":return`_:${t.value}`;case"Variable":return`?${t.value}`;case"DefaultGraph":return"";case"Literal":return`"${t.value}"${t.language?`@${t.language}`:t.datatype&&t.datatype.value!==wt.string?`^^${t.datatype.value}`:""}`;case"Quad":const i=[kt(t.subject,!0),kt(t.predicate,!0),kt(t.object,!0)];return t.graph&&"DefaultGraph"!==t.graph.termType&&i.push(kt(t.graph,!0)),e?i:JSON.stringify(i);default:throw new Error(`Unexpected termType: ${t.termType}`)}}Tt=new class extends Rt{constructor(){return super(""),Tt||this}get termType(){return"DefaultGraph"}equals(t){return this===t||!!t&&this.termType===t.termType}};let At=class extends Rt{constructor(t,e,i,r){super(""),this._subject=t,this._predicate=e,this._object=i,this._graph=r||Tt}get termType(){return"Quad"}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}get graph(){return this._graph}toJSON(){return{termType:this.termType,subject:this._subject.toJSON(),predicate:this._predicate.toJSON(),object:this._object.toJSON(),graph:this._graph.toJSON()}}equals(t){return!!t&&this._subject.equals(t.subject)&&this._predicate.equals(t.predicate)&&this._object.equals(t.object)&&this._graph.equals(t.graph)}};function $t(t){return new Nt(t)}function Dt(t){return new jt(t||"n3-"+It++)}function Ot(t,e){if("string"==typeof e)return new St(`"${t}"@${e.toLowerCase()}`);let i=e?e.value:"";return""===i&&("boolean"==typeof t?i=wt.boolean:"number"==typeof t&&(Number.isFinite(t)?i=Number.isInteger(t)?wt.integer:wt.double:(i=wt.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")))),""===i||i===wt.string?new St(`"${t}"`):new St(`"${t}"^^${i}`)}function Ft(t){return new Ct(t)}function Lt(t,e,i,r){return new At(t,e,i,r)}function Mt(t){if(t instanceof Rt)return t;switch(t.termType){case"NamedNode":return $t(t.value);case"BlankNode":return Dt(t.value);case"Variable":return Ft(t.value);case"DefaultGraph":return Tt;case"Literal":return Ot(t.value,t.language||t.datatype);case"Quad":return Bt(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function Bt(t){if(t instanceof At)return t;if("Quad"!==t.termType)throw new Error(`Unexpected termType: ${t.termType}`);return Lt(Mt(t.subject),Mt(t.predicate),Mt(t.object),Mt(t.graph))}let qt=0;class Ut{constructor(t){this._contextStack=[],this._graph=null,t=t||{},this._setBase(t.baseIRI),t.factory&&Ht(this,t.factory);const e="string"==typeof t.format?t.format.match(/\w*$/)[0].toLowerCase():"",i=/turtle/.test(e),r=/trig/.test(e),s=/triple/.test(e),n=/quad/.test(e),a=this._n3Mode=/n3/.test(e),o=s||n;(this._supportsNamedGraphs=!(i||a))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(i||r||s||a),this._isImpliedBy=t.isImpliedBy,this._supportsRDFStar=""===e||/star|\*$/.test(e),o&&(this._resolveRelativeIRI=t=>null),this._blankNodePrefix="string"!=typeof t.blankNodePrefix?"":t.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=t.lexer||new xt({lineMode:o,n3:a,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!t.explicitQuantifiers}static _resetBlankNodePrefix(){qt=0}_setBase(t){if(t){const e=t.indexOf("#");e>=0&&(t=t.substr(0,e)),this._base=t,this._basePath=t.indexOf("/")<0?t:t.replace(/[^\/?]*(?:\?.*)?$/,""),t=t.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=t[0],this._baseScheme=t[1]}else this._base="",this._basePath=""}_saveContext(t,e,i,r,s){const n=this._n3Mode;this._contextStack.push({type:t,subject:i,predicate:r,object:s,graph:e,inverse:!!n&&this._inversePredicate,blankPrefix:n?this._prefixes._:"",quantified:n?this._quantified:null}),n&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(t,e){const i=this._contextStack.pop();if(!i||i.type!==t)return this._error(`Unexpected ${e.type}`,e);this._subject=i.subject,this._predicate=i.predicate,this._object=i.object,this._graph=i.graph,this._n3Mode&&(this._inversePredicate=i.inverse,this._prefixes._=i.blankPrefix,this._quantified=i.quantified)}_readInTopContext(t){switch(t.type){case"eof":return null!==this._graph?this._error("Unclosed graph",t):(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(t)}}_readEntity(t,e){let i;switch(t.type){case"IRI":case"typeIRI":const e=this._resolveIRI(t.value);if(null===e)return this._error("Invalid IRI",t);i=this._factory.namedNode(e);break;case"type":case"prefixed":const r=this._prefixes[t.prefix];if(void 0===r)return this._error(`Undefined prefix "${t.prefix}:"`,t);i=this._factory.namedNode(r+t.value);break;case"blank":i=this._factory.blankNode(this._prefixes[t.prefix]+t.value);break;case"var":i=this._factory.variable(t.value.substr(1));break;default:return this._error(`Expected entity but got ${t.type}`,t)}return!e&&this._n3Mode&&i.id in this._quantified&&(i=this._quantified[i.id]),i}_readSubject(t){switch(this._predicate=null,t.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._factory.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._factory.blankNode(),null,null),this._readSubject):this._error("Unexpected graph",t);case"}":return this._readPunctuation(t);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier="blankNode",this._readQuantifierList):this._error('Unexpected "@forSome"',t);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier="variable",this._readQuantifierList):this._error('Unexpected "@forAll"',t);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",t);if(0===t.prefix.length)return this._literalValue=t.value,this._completeSubjectLiteral;this._subject=this._factory.literal(t.value,this._factory.namedNode(t.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",t);default:if(void 0===(this._subject=this._readEntity(t)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(t){const e=t.type;switch(e){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[t.value];break;case".":case"]":case"}":return null===this._predicate?this._error(`Unexpected ${e}`,t):(this._subject=null,"]"===e?this._readBlankNodeTail(t):this._readPunctuation(t));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",t);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",t);default:if(void 0===(this._predicate=this._readEntity(t)))return}return this._readObject}_readObject(t){switch(t.type){case"literal":if(0===t.prefix.length)return this._literalValue=t.value,this._readDataTypeOrLang;this._object=this._factory.literal(t.value,this._factory.namedNode(t.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._factory.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._factory.blankNode()),this._readSubject):this._error("Unexpected graph",t);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",t);default:if(void 0===(this._object=this._readEntity(t)))return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(t){return"{"===t.type?this._readGraph(t):this._readPredicate(t)}_readGraph(t){return"{"!==t.type?this._error(`Expected graph but got ${t.type}`,t):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(t){return"]"===t.type?(this._subject=null,this._readBlankNodeTail(t)):(this._predicate=null,this._readPredicate(t))}_readBlankNodeTail(t){if("]"!==t.type)return this._readBlankNodePunctuation(t);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);const e=null===this._predicate;return this._restoreContext("blank",t),null!==this._object?this._getContextEndReader():null!==this._predicate?this._readObject:e?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(t){switch(t.type){case".":case"}":return this._subject=null,this._readPunctuation(t);default:return this._readPredicate(t)}}_readListItem(t){let e=null,i=null,r=this._readListItem;const s=this._subject,n=this._contextStack,a=n[n.length-1];switch(t.type){case"[":this._saveContext("blank",this._graph,i=this._factory.blankNode(),this.RDF_FIRST,this._subject=e=this._factory.blankNode()),r=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,i=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",t),0!==n.length&&"list"===n[n.length-1].type&&this._emit(this._subject,this._predicate,this._object,this._graph),null===this._predicate){if(r=this._readPredicate,this._subject===this.RDF_NIL)return r}else if(r=this._getContextEndReader(),this._object===this.RDF_NIL)return r;i=this.RDF_NIL;break;case"literal":0===t.prefix.length?(this._literalValue=t.value,r=this._readListItemDataTypeOrLang):(e=this._factory.literal(t.value,this._factory.namedNode(t.prefix)),r=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",t);default:if(void 0===(e=this._readEntity(t)))return}if(null===i&&(this._subject=i=this._factory.blankNode()),null===s?null===a.predicate?a.subject=i:a.object=i:this._emit(s,this.RDF_REST,i,this._graph),null!==e){if(this._n3Mode&&("IRI"===t.type||"prefixed"===t.type))return this._saveContext("item",this._graph,i,this.RDF_FIRST,e),this._subject=e,this._predicate=null,this._getPathReader(this._readListItem);this._emit(i,this.RDF_FIRST,e,this._graph)}return r}_readDataTypeOrLang(t){return this._completeObjectLiteral(t,!1)}_readListItemDataTypeOrLang(t){return this._completeObjectLiteral(t,!0)}_completeLiteral(t){let e=this._factory.literal(this._literalValue);switch(t.type){case"type":case"typeIRI":const i=this._readEntity(t);if(void 0===i)return;e=this._factory.literal(this._literalValue,i),t=null;break;case"langcode":e=this._factory.literal(this._literalValue,t.value),t=null}return{token:t,literal:e}}_completeSubjectLiteral(t){return this._subject=this._completeLiteral(t).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(t,e){const i=this._completeLiteral(t);if(i)return this._object=i.literal,e&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),null===i.token?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(i.token))}_readFormulaTail(t){return"}"!==t.type?this._readPunctuation(t):(null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",t),null===this._object?this._readPredicate:this._getContextEndReader())}_readPunctuation(t){let e,i=this._graph;const r=this._subject,s=this._inversePredicate;switch(t.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",t);if(this._n3Mode)return this._readFormulaTail(t);this._graph=null;case".":this._subject=null,e=this._contextStack.length?this._readSubject:this._readInTopContext,s&&(this._inversePredicate=!1);break;case";":e=this._readPredicate;break;case",":e=this._readObject;break;case"{|":if(!this._supportsRDFStar)return this._error("Unexpected RDF-star syntax",t);const n=this._predicate,a=this._object;this._subject=this._factory.quad(r,n,a,this.DEFAULTGRAPH),e=this._readPredicate;break;case"|}":if("Quad"!==this._subject.termType)return this._error("Unexpected asserted triple closing",t);this._subject=null,e=this._readPunctuation;break;default:if(this._supportsQuads&&null===this._graph&&void 0!==(i=this._readEntity(t))){e=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,t)}if(null!==r){const t=this._predicate,e=this._object;s?this._emit(e,t,r,i):this._emit(r,t,e,i)}return e}_readBlankNodePunctuation(t){let e;switch(t.type){case";":e=this._readPredicate;break;case",":e=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,t)}return this._emit(this._subject,this._predicate,this._object,this._graph),e}_readQuadPunctuation(t){return"."!==t.type?this._error("Expected dot to follow quad",t):this._readInTopContext}_readPrefix(t){return"prefix"!==t.type?this._error("Expected prefix to follow @prefix",t):(this._prefix=t.value,this._readPrefixIRI)}_readPrefixIRI(t){if("IRI"!==t.type)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,t);const e=this._readEntity(t);return this._prefixes[this._prefix]=e.value,this._prefixCallback(this._prefix,e),this._readDeclarationPunctuation}_readBaseIRI(t){const e="IRI"===t.type&&this._resolveIRI(t.value);return e?(this._setBase(e),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",t)}_readNamedGraphLabel(t){switch(t.type){case"IRI":case"blank":case"prefixed":return this._readSubject(t),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",t)}}_readNamedGraphBlankLabel(t){return"]"!==t.type?this._error("Invalid graph label",t):(this._subject=this._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(t){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(t)):"."!==t.type?this._error("Expected declaration to end with a dot",t):this._readInTopContext}_readQuantifierList(t){let e;switch(t.type){case"IRI":case"prefixed":if(void 0!==(e=this._readEntity(t,!0)))break;default:return this._error(`Unexpected ${t.type}`,t)}return this._explicitQuantifiers?(null===this._subject?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,e,this.QUANTIFIERS_GRAPH)):this._quantified[e.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(t){return","===t.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(t))}_getPathReader(t){return this._afterPath=t,this._readPath}_readPath(t){switch(t.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const e=this._contextStack,i=e.length&&e[e.length-1];if(i&&"item"===i.type){const e=this._subject;this._restoreContext("item",t),this._emit(this._subject,this.RDF_FIRST,e,this._graph)}return this._afterPath(t)}}_readForwardPath(t){let e,i;const r=this._factory.blankNode();if(void 0!==(i=this._readEntity(t)))return null===this._predicate?(e=this._subject,this._subject=r):(e=this._object,this._object=r),this._emit(e,i,r,this._graph),this._readPath}_readBackwardPath(t){const e=this._factory.blankNode();let i,r;if(void 0!==(i=this._readEntity(t)))return null===this._predicate?(r=this._subject,this._subject=e):(r=this._object,this._object=e),this._emit(e,i,r,this._graph),this._readPath}_readRDFStarTailOrGraph(t){return">>"!==t.type?this._supportsQuads&&null===this._graph&&void 0!==(this._graph=this._readEntity(t))?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,t):this._readRDFStarTail(t)}_readRDFStarTail(t){if(">>"!==t.type)return this._error(`Expected >> but got ${t.type}`,t);const e=this._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",t),null===this._subject?(this._subject=e,this._readPredicate):(this._object=e,this._getContextEndReader())}_getContextEndReader(){const t=this._contextStack;if(!t.length)return this._readPunctuation;switch(t[t.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(t,e,i,r){this._callback(null,this._factory.quad(t,e,i,r||this.DEFAULTGRAPH))}_error(t,e){const i=new Error(`${t} on line ${e.line}.`);i.context={token:e,line:e.line,previousToken:this._lexer.previousToken},this._callback(i),this._callback=Gt}_resolveIRI(t){return/^[a-z][a-z0-9+.-]*:/i.test(t)?t:this._resolveRelativeIRI(t)}_resolveRelativeIRI(t){if(!t.length)return this._base;switch(t[0]){case"#":return this._base+t;case"?":return this._base.replace(/(?:\?.*)?$/,t);case"/":return("/"===t[1]?this._baseScheme:this._baseRoot)+this._removeDotSegments(t);default:return/^[^/:]*:/.test(t)?null:this._removeDotSegments(this._basePath+t)}}_removeDotSegments(t){if(!/(^|\/)\.\.?($|[/#?])/.test(t))return t;const e=t.length;let i="",r=-1,s=-1,n=0,a="/";for(;r<e;){switch(a){case":":if(s<0&&"/"===t[++r]&&"/"===t[++r])for(;(s=r+1)<e&&"/"!==t[s];)r=s;break;case"?":case"#":r=e;break;case"/":if("."===t[r+1])switch(a=t[1+ ++r],a){case"/":i+=t.substring(n,r-1),n=r+1;break;case void 0:case"?":case"#":return i+t.substring(n,r)+t.substr(r+1);case".":if(a=t[1+ ++r],void 0===a||"/"===a||"?"===a||"#"===a){if(i+=t.substring(n,r-2),(n=i.lastIndexOf("/"))>=s&&(i=i.substr(0,n)),"/"!==a)return`${i}/${t.substr(r+1)}`;n=r+1}}}a=t[++r]}return i+t.substring(n)}parse(t,e,i){let r,s,n;if(e&&(e.onQuad||e.onPrefix||e.onComment)?(r=e.onQuad,s=e.onPrefix,n=e.onComment):(r=e,s=i),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${qt++}_`,this._prefixCallback=s||Gt,this._inversePredicate=!1,this._quantified=Object.create(null),!r){const e=[];let i;if(this._callback=(t,r)=>{t?i=t:r&&e.push(r)},this._lexer.tokenize(t).every(t=>this._readCallback=this._readCallback(t)),i)throw i;return e}let a=(t,e)=>{null!==t?(this._callback(t),this._callback=Gt):this._readCallback&&(this._readCallback=this._readCallback(e))};n&&(this._lexer.comments=!0,a=(t,e)=>{null!==t?(this._callback(t),this._callback=Gt):this._readCallback&&("comment"===e.type?n(e.value):this._readCallback=this._readCallback(e))}),this._callback=r,this._lexer.tokenize(t,a)}}function Gt(){}function Ht(t,e){t._factory=e,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=e.namedNode(ft.rdf.first),t.RDF_REST=e.namedNode(ft.rdf.rest),t.RDF_NIL=e.namedNode(ft.rdf.nil),t.N3_FORALL=e.namedNode(ft.r.forAll),t.N3_FORSOME=e.namedNode(ft.r.forSome),t.ABBREVIATIONS={a:e.namedNode(ft.rdf.type),"=":e.namedNode(ft.owl.sameAs),">":e.namedNode(ft.log.implies),"<":e.namedNode(ft.log.isImpliedBy)},t.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}function Qt(t){return!!t&&"DefaultGraph"===t.termType}function zt(t){return t.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}Ht(Ut.prototype,Et);const Yt=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,Vt=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/;class Xt{constructor(t){this.base=t,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(t.length+1)}static supports(t){return!Yt.test(t)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!Xt.supports(this.base))return this._baseMatcher=/.^/;const t=/^[^:]*:\/*/.exec(this.base)[0],e=["^",zt(t)],i=[],r=[],s=/[^/?#]*([/?#])/y;let n,a=0,o=0,h=s.lastIndex=t.length;for(;!a&&!o&&(n=s.exec(this.base));)"#"===n[1]?o=s.lastIndex-1:(e.push(zt(n[0]),"(?:"),i.push(")?"),"?"!==n[1]?r.push(h=s.lastIndex):(a=h=s.lastIndex,o=this.base.indexOf("#",a),this._pathReplacements[a]="?"));for(let t=0;t<r.length;t++)this._pathReplacements[r[t]]="../".repeat(r.length-t-1);return this._pathReplacements[r[r.length-1]]="./",this._baseLength=o>0?o:this.base.length,e.push(zt(this.base.substring(h,this._baseLength)),a?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...e,...i].join(""))}toRelative(t){const e=this._getBaseMatcher().exec(t);if(!e)return t;const i=e[0].length;if(i===this._baseLength&&i===t.length)return"";const r=this._pathReplacements[i];if(r){const e=t.substring(i);return"?"===r||Vt.test(e)?"./"===r&&/^[^?#]/.test(e)?e:r+e:t}return t.substring(i-1)}}const Wt=Et.defaultGraph(),{rdf:Zt,xsd:Jt}=ft,Kt=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,te=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,ee={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class ie extends Rt{equals(t){return t===this}}class re{constructor(t,e){if(this._prefixRegex=/$0^/,t&&"function"!=typeof t.write&&(e=t,t=null),e=e||{},this._lists=e.lists,t)this._outputStream=t,this._endStream=void 0===e.end||!!e.end;else{let t="";this._outputStream={write(e,i,r){t+=e,r&&r()},end:e=>{e&&e(null,t)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(e.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=Wt,this._prefixIRIs=Object.create(null),e.prefixes&&this.addPrefixes(e.prefixes),e.baseIRI&&(this._baseIri=new Xt(e.baseIRI)))}get _inDefaultGraph(){return Wt.equals(this._graph)}_write(t,e){this._outputStream.write(t,"utf8",e)}_writeQuad(t,e,i,r,s){try{r.equals(this._graph)||(this._write((null===this._subject?"":this._inDefaultGraph?".\n":"\n}\n")+(Wt.equals(r)?"":`${this._encodeIriOrBlank(r)} {\n`)),this._graph=r,this._subject=null),t.equals(this._subject)?e.equals(this._predicate)?this._write(`, ${this._encodeObject(i)}`,s):this._write(`;\n ${this._encodePredicate(this._predicate=e)} ${this._encodeObject(i)}`,s):this._write(`${(null===this._subject?"":".\n")+this._encodeSubject(this._subject=t)} ${this._encodePredicate(this._predicate=e)} ${this._encodeObject(i)}`,s)}catch(t){s&&s(t)}}_writeQuadLine(t,e,i,r,s){delete this._prefixMatch,this._write(this.quadToString(t,e,i,r),s)}quadToString(t,e,i,r){return`${this._encodeSubject(t)} ${this._encodeIriOrBlank(e)} ${this._encodeObject(i)}${r&&r.value?` ${this._encodeIriOrBlank(r)} .\n`:" .\n"}`}quadsToString(t){let e="";for(const i of t)e+=this.quadToString(i.subject,i.predicate,i.object,i.graph);return e}_encodeSubject(t){return"Quad"===t.termType?this._encodeQuad(t):this._encodeIriOrBlank(t)}_encodeIriOrBlank(t){if("NamedNode"!==t.termType)return this._lists&&t.value in this._lists&&(t=this.list(this._lists[t.value])),"id"in t?t.id:`_:${t.value}`;let e=t.value;this._baseIri&&(e=this._baseIri.toRelative(e)),Kt.test(e)&&(e=e.replace(te,se));const i=this._prefixRegex.exec(e);return i?i[1]?this._prefixIRIs[i[1]]+i[2]:e:`<${e}>`}_encodeLiteral(t){let e=t.value;if(Kt.test(e)&&(e=e.replace(te,se)),t.language)return`"${e}"@${t.language}`;if(this._lineMode){if(t.datatype.value===Jt.string)return`"${e}"`}else switch(t.datatype.value){case Jt.string:return`"${e}"`;case Jt.boolean:if("true"===e||"false"===e)return e;break;case Jt.integer:if(/^[+-]?\d+$/.test(e))return e;break;case Jt.decimal:if(/^[+-]?\d*\.\d+$/.test(e))return e;break;case Jt.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(e))return e}return`"${e}"^^${this._encodeIriOrBlank(t.datatype)}`}_encodePredicate(t){return t.value===Zt.type?"a":this._encodeIriOrBlank(t)}_encodeObject(t){switch(t.termType){case"Quad":return this._encodeQuad(t);case"Literal":return this._encodeLiteral(t);default:return this._encodeIriOrBlank(t)}}_encodeQuad({subject:t,predicate:e,object:i,graph:r}){return`<<${this._encodeSubject(t)} ${this._encodePredicate(e)} ${this._encodeObject(i)}${Qt(r)?"":` ${this._encodeIriOrBlank(r)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(t,e,i,r,s){void 0===i?this._writeQuad(t.subject,t.predicate,t.object,t.graph,e):"function"==typeof r?this._writeQuad(t,e,i,Wt,r):this._writeQuad(t,e,i,r||Wt,s)}addQuads(t){for(let e=0;e<t.length;e++)this.addQuad(t[e])}addPrefix(t,e,i){const r={};r[t]=e,this.addPrefixes(r,i)}addPrefixes(t,e){if(!this._prefixIRIs)return e&&e();let i=!1;for(let e in t){let r=t[e];"string"!=typeof r&&(r=r.value),i=!0,null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null,this._graph=""),this._prefixIRIs[r]=e+=":",this._write(`@prefix ${e} <${r}>.\n`)}if(i){let t="",e="";for(const i in this._prefixIRIs)t+=t?`|${i}`:i,e+=(e?"|":"")+this._prefixIRIs[i];t=zt(t),this._prefixRegex=new RegExp(`^(?:${e})[^/]*$|^(${t})([_a-zA-Z0-9][\\-_a-zA-Z0-9]*)$`)}this._write(i?"\n":"",e)}blank(t,e){let i,r,s=t;switch(void 0===t?s=[]:t.termType?s=[{predicate:t,object:e}]:"length"in t||(s=[t]),r=s.length){case 0:return new ie("[]");case 1:if(i=s[0],!(i.object instanceof ie))return new ie(`[ ${this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)} ]`);default:let e="[";for(let n=0;n<r;n++)i=s[n],i.predicate.equals(t)?e+=`, ${this._encodeObject(i.object)}`:(e+=`${(n?";\n ":"\n ")+this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)}`,t=i.predicate);return new ie(`${e}\n]`)}}list(t){const e=t&&t.length||0,i=new Array(e);for(let r=0;r<e;r++)i[r]=this._encodeObject(t[r]);return new ie(`(${i.join(" ")})`)}end(t){null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null),this._write=this._blockedWrite;let e=t&&((i,r)=>{e=null,t(i,r)});if(this._endStream)try{return this._outputStream.end(e)}catch(t){}e&&e()}}function se(t){let e=ee[t];return void 0===e&&(1===t.length?(e=t.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=(1024*(t.charCodeAt(0)-55296)+t.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}class ne{constructor(){}on(){return this}once(){return this}emit(){return this}pipe(){return this}push(){return!1}destroy(){}_read(){}}class ae{constructor(){}on(){return this}write(){}end(){}}class oe extends ne{}class he extends oe{}var ue={Readable:ne,Writable:ae,Transform:oe,PassThrough:he},le=Object.freeze({__proto__:null,PassThrough:he,Readable:ne,Transform:oe,Writable:ae,default:ue});const ce=Symbol("iter");function de(t,e,i=4){if(0===i)return Object.assign(t,e);for(const r in e)t[r]=de(t[r]||Object.create(null),e[r],i-1);return t}function fe(t,e,i=4){let r=!1;for(const s in t)if(s in e){const n=0===i?null:fe(t[s],e[s],i-1);if(!1!==n)r=r||Object.create(null),r[s]=n;else if(3===i)return!1}return r}function pe(t,e,i=4){let r=!1;for(const s in t)if(s in e){if(0!==i){const n=pe(t[s],e[s],i-1);if(!1!==n)r=r||Object.create(null),r[s]=n;else if(3===i)return!1}}else r=r||Object.create(null),r[s]=0===i?null:de({},t[s],i-1);return r}class _e{constructor(t={}){this._id=1,this._ids=Object.create(null),this._ids[""]=1,this._entities=Object.create(null),this._entities[1]="",this._blankNodeIndex=0,this._factory=t.factory||Et}_termFromId(t){if("."===t[0]){const e=this._entities,i=t.split(".");return this._factory.quad(this._termFromId(e[i[1]]),this._termFromId(e[i[2]]),this._termFromId(e[i[3]]),i[4]&&this._termFromId(e[i[4]]))}return Pt(t,this._factory)}_termToNumericId(t){if("Quad"===t.termType){const e=this._termToNumericId(t.subject),i=this._termToNumericId(t.predicate),r=this._termToNumericId(t.object);let s;return e&&i&&r&&(Qt(t.graph)||(s=this._termToNumericId(t.graph)))&&this._ids[s?`.${e}.${i}.${r}.${s}`:`.${e}.${i}.${r}`]}return this._ids[kt(t)]}_termToNewNumericId(t){const e=t&&"Quad"===t.termType?`.${this._termToNewNumericId(t.subject)}.${this._termToNewNumericId(t.predicate)}.${this._termToNewNumericId(t.object)}${Qt(t.graph)?"":`.${this._termToNewNumericId(t.graph)}`}`:kt(t);return this._ids[e]||(this._ids[this._entities[++this._id]=e]=this._id)}createBlankNode(t){let e,i;if(t)for(e=t=`_:${t}`,i=1;this._ids[e];)e=t+i++;else do{e="_:b"+this._blankNodeIndex++}while(this._ids[e]);return this._ids[e]=++this._id,this._entities[this._id]=e,this._factory.blankNode(e.substr(2))}}class ge{constructor(t,e){this._size=0,this._graphs=Object.create(null),e||!t||t[0]||"function"==typeof t.match||(e=t,t=null),e=e||{},this._factory=e.factory||Et,this._entityIndex=e.entityIndex||new _e({factory:this._factory}),this._entities=this._entityIndex._entities,this._termFromId=this._entityIndex._termFromId.bind(this._entityIndex),this._termToNumericId=this._entityIndex._termToNumericId.bind(this._entityIndex),this._termToNewNumericId=this._entityIndex._termToNewNumericId.bind(this._entityIndex),t&&this.addAll(t)}get size(){let t=this._size;if(null!==t)return t;t=0;const e=this._graphs;let i,r;for(const s in e)for(const n in i=e[s].subjects)for(const e in r=i[n])t+=Object.keys(r[e]).length;return this._size=t}_addToIndex(t,e,i,r){const s=t[e]||(t[e]={}),n=s[i]||(s[i]={}),a=r in n;return a||(n[r]=null),!a}_removeFromIndex(t,e,i,r){const s=t[e],n=s[i];delete n[r];for(const t in n)return;delete s[i];for(const t in s)return;delete t[e]}*_findInIndex(t,e,i,r,s,n,a,o){let h,u,l;const c=this._entities,d=this._termFromId(c[o]),f={subject:null,predicate:null,object:null};e&&((h=t,t={})[e]=h[e]);for(const e in t)if(u=t[e]){f[s]=this._termFromId(c[e]),i&&((h=u,u={})[i]=h[i]);for(const t in u)if(l=u[t]){f[n]=this._termFromId(c[t]);const e=r?r in l?[r]:[]:Object.keys(l);for(let t=0;t<e.length;t++)f[a]=this._termFromId(c[e[t]]),yield this._factory.quad(f.subject,f.predicate,f.object,d)}}}_loop(t,e){for(const i in t)e(i)}_loopByKey0(t,e,i){let r,s;if(r=t[e])for(s in r)i(s)}_loopByKey1(t,e,i){let r,s;for(r in t)s=t[r],s[e]&&i(r)}_loopBy2Keys(t,e,i,r){let s,n,a;if((s=t[e])&&(n=s[i]))for(a in n)r(a)}_countInIndex(t,e,i,r){let s,n,a,o=0;e&&((s=t,t={})[e]=s[e]);for(const e in t)if(n=t[e]){i&&((s=n,n={})[i]=s[i]);for(const t in n)(a=n[t])&&(r?r in a&&o++:o+=Object.keys(a).length)}return o}_getGraphs(t){return"number"!=typeof(t=""===t?1:t&&(this._termToNumericId(t)||-1))?this._graphs:{[t]:this._graphs[t]}}_uniqueEntities(t){const e=Object.create(null);return i=>{i in e||(e[i]=!0,t(this._termFromId(this._entities[i],this._factory)))}}add(t){return this.addQuad(t),this}addQuad(t,e,i,r){e||(r=t.graph,i=t.object,e=t.predicate,t=t.subject),r=r?this._termToNewNumericId(r):1;let s=this._graphs[r];return s||(s=this._graphs[r]={subjects:{},predicates:{},objects:{}},Object.freeze(s)),t=this._termToNewNumericId(t),e=this._termToNewNumericId(e),i=this._termToNewNumericId(i),!!this._addToIndex(s.subjects,t,e,i)&&(this._addToIndex(s.predicates,e,i,t),this._addToIndex(s.objects,i,t,e),this._size=null,!0)}addQuads(t){for(let e=0;e<t.length;e++)this.addQuad(t[e])}delete(t){return this.removeQuad(t),this}has(t,e,i,r){return t&&t.subject&&({subject:t,predicate:e,object:i,graph:r}=t),!this.readQuads(t,e,i,r).next().done}import(t){return t.on("data",t=>{this.addQuad(t)}),t}removeQuad(t,e,i,r){e||({subject:t,predicate:e,object:i,graph:r}=t),r=r?this._termToNumericId(r):1;const s=this._graphs;let n,a,o;if(!((t=t&&this._termToNumericId(t))&&(e=e&&this._termToNumericId(e))&&(i=i&&this._termToNumericId(i))&&(n=s[r])&&(a=n.subjects[t])&&(o=a[e])&&i in o))return!1;for(t in this._removeFromIndex(n.subjects,t,e,i),this._removeFromIndex(n.predicates,e,i,t),this._removeFromIndex(n.objects,i,t,e),null!==this._size&&this._size--,n.subjects)return!0;return delete s[r],!0}removeQuads(t){for(let e=0;e<t.length;e++)this.removeQuad(t[e])}remove(t){return t.on("data",t=>{this.removeQuad(t)}),t}removeMatches(t,e,i,r){const s=new ne({objectMode:!0}),n=this.readQuads(t,e,i,r);return s._read=t=>{for(;--t>=0;){const{done:t,value:e}=n.next();if(t)return void s.push(null);s.push(e)}},this.remove(s)}deleteGraph(t){return this.removeMatches(null,null,null,t)}getQuads(t,e,i,r){return[...this.readQuads(t,e,i,r)]}*readQuads(t,e,i,r){const s=this._getGraphs(r);let n,a,o,h;if(!(t&&!(a=this._termToNumericId(t))||e&&!(o=this._termToNumericId(e))||i&&!(h=this._termToNumericId(i))))for(const t in s)(n=s[t])&&(a?h?yield*this._findInIndex(n.objects,h,a,o,"object","subject","predicate",t):yield*this._findInIndex(n.subjects,a,o,null,"subject","predicate","object",t):o?yield*this._findInIndex(n.predicates,o,h,null,"predicate","object","subject",t):h?yield*this._findInIndex(n.objects,h,null,null,"object","subject","predicate",t):yield*this._findInIndex(n.subjects,null,null,null,"subject","predicate","object",t))}match(t,e,i,r){return new me(this,t,e,i,r,{entityIndex:this._entityIndex})}countQuads(t,e,i,r){const s=this._getGraphs(r);let n,a,o,h,u=0;if(t&&!(a=this._termToNumericId(t))||e&&!(o=this._termToNumericId(e))||i&&!(h=this._termToNumericId(i)))return 0;for(const r in s)(n=s[r])&&(u+=t?i?this._countInIndex(n.objects,h,a,o):this._countInIndex(n.subjects,a,o,h):e?this._countInIndex(n.predicates,o,h,a):this._countInIndex(n.objects,h,a,o));return u}forEach(t,e,i,r,s){this.some(e=>(t(e,this),!1),e,i,r,s)}every(t,e,i,r,s){return!this.some(e=>!t(e,this),e,i,r,s)}some(t,e,i,r,s){for(const n of this.readQuads(e,i,r,s))if(t(n,this))return!0;return!1}getSubjects(t,e,i){const r=[];return this.forSubjects(t=>{r.push(t)},t,e,i),r}forSubjects(t,e,i,r){const s=this._getGraphs(r);let n,a,o;if(t=this._uniqueEntities(t),!(e&&!(a=this._termToNumericId(e))||i&&!(o=this._termToNumericId(i))))for(r in s)(n=s[r])&&(a?o?this._loopBy2Keys(n.predicates,a,o,t):this._loopByKey1(n.subjects,a,t):o?this._loopByKey0(n.objects,o,t):this._loop(n.subjects,t))}getPredicates(t,e,i){const r=[];return this.forPredicates(t=>{r.push(t)},t,e,i),r}forPredicates(t,e,i,r){const s=this._getGraphs(r);let n,a,o;if(t=this._uniqueEntities(t),!(e&&!(a=this._termToNumericId(e))||i&&!(o=this._termToNumericId(i))))for(r in s)(n=s[r])&&(a?o?this._loopBy2Keys(n.objects,o,a,t):this._loopByKey0(n.subjects,a,t):o?this._loopByKey1(n.predicates,o,t):this._loop(n.predicates,t))}getObjects(t,e,i){const r=[];return this.forObjects(t=>{r.push(t)},t,e,i),r}forObjects(t,e,i,r){const s=this._getGraphs(r);let n,a,o;if(t=this._uniqueEntities(t),!(e&&!(a=this._termToNumericId(e))||i&&!(o=this._termToNumericId(i))))for(r in s)(n=s[r])&&(a?o?this._loopBy2Keys(n.subjects,a,o,t):this._loopByKey1(n.objects,a,t):o?this._loopByKey0(n.predicates,o,t):this._loop(n.objects,t))}getGraphs(t,e,i){const r=[];return this.forGraphs(t=>{r.push(t)},t,e,i),r}forGraphs(t,e,i,r){for(const s in this._graphs)this.some(e=>(t(e.graph),!0),e,i,r,this._termFromId(this._entities[s]))}createBlankNode(t){return this._entityIndex.createBlankNode(t)}extractLists({remove:t=!1,ignoreErrors:e=!1}={}){const i={},r=e?()=>!0:(t,e)=>{throw new Error(`${t.value} ${e}`)},s=this.getQuads(null,ft.rdf.rest,ft.rdf.nil,null),n=t?[...s]:[];return s.forEach(e=>{const s=[];let a,o,h=!1;const u=e.graph;let l=e.subject;for(;l&&!h;){const t=this.getQuads(null,null,l,null),e=this.getQuads(l,null,null,null);let i,c=null,d=null,f=null;for(let s=0;s<e.length&&!h;s++)i=e[s],i.graph.equals(u)?a?h=r(l,"has non-list arcs out"):i.predicate.value===ft.rdf.first?c?h=r(l,"has multiple rdf:first arcs"):n.push(c=i):i.predicate.value===ft.rdf.rest?d?h=r(l,"has multiple rdf:rest arcs"):n.push(d=i):t.length?h=r(l,"can't be subject and object"):(a=i,o="subject"):h=r(l,"not confined to single graph");for(let e=0;e<t.length&&!h;++e)i=t[e],a?h=r(l,"can't have coreferences"):i.predicate.value===ft.rdf.rest?f?h=r(l,"has incoming rdf:rest arcs"):f=i:(a=i,o="object");c?s.unshift(c.object):h=r(l,"has no list head"),l=f&&f.subject}h?t=!1:a&&(i[a[o].value]=s)}),t&&this.removeQuads(n),i}addAll(t){if(t instanceof me&&(t=t.filtered),Array.isArray(t))this.addQuads(t);else if(t instanceof ge&&t._entityIndex===this._entityIndex)0!==t._size&&(this._graphs=de(this._graphs,t._graphs),this._size=null);else for(const e of t)this.add(e);return this}contains(t){if(t instanceof me&&(t=t.filtered),t===this)return!0;if(!(t instanceof ge)||this._entityIndex!==t._entityIndex)return t.every(t=>this.has(t));const e=this._graphs,i=t._graphs;let r,s,n,a,o;for(const t in i){if(!(r=e[t]))return!1;r=r.subjects;for(const e in s=i[t].subjects){if(!(n=r[e]))return!1;for(const t in a=s[e]){if(!(o=n[t]))return!1;for(const e in a[t])if(!(e in o))return!1}}}return!0}deleteMatches(t,e,i,r){for(const s of this.match(t,e,i,r))this.removeQuad(s);return this}difference(t){if(t&&t instanceof me&&(t=t.filtered),t===this)return new ge({entityIndex:this._entityIndex});if(t instanceof ge&&t._entityIndex===this._entityIndex){const e=new ge({entityIndex:this._entityIndex}),i=pe(this._graphs,t._graphs);return i&&(e._graphs=i,e._size=null),e}return this.filter(e=>!t.has(e))}equals(t){return t instanceof me&&(t=t.filtered),t===this||this.size===t.size&&this.contains(t)}filter(t){const e=new ge({entityIndex:this._entityIndex});for(const i of this)t(i,this)&&e.add(i);return e}intersection(t){if(t instanceof me&&(t=t.filtered),t===this){const t=new ge({entityIndex:this._entityIndex});return t._graphs=de(Object.create(null),this._graphs),t._size=this._size,t}if(t instanceof ge&&this._entityIndex===t._entityIndex){const e=new ge({entityIndex:this._entityIndex}),i=fe(t._graphs,this._graphs);return i&&(e._graphs=i,e._size=null),e}return this.filter(e=>t.has(e))}map(t){const e=new ge({entityIndex:this._entityIndex});for(const i of this)e.add(t(i,this));return e}reduce(t,e){const i=this.readQuads();let r=void 0===e?i.next().value:e;for(const e of i)r=t(r,e,this);return r}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return(new re).quadsToString(this)}union(t){const e=new ge({entityIndex:this._entityIndex});return e._graphs=de(Object.create(null),this._graphs),e._size=this._size,e.addAll(t),e}*[Symbol.iterator](){yield*this.readQuads()}}function be(t,e,i=0){const r=e[i];if(r&&!(r in t))return!1;let s=!1;for(const n in r?{[r]:t[r]}:t){const r=2===i?null:be(t[n],e,i+1);!1!==r&&(s=s||Object.create(null),s[n]=r)}return s}class me extends ne{constructor(t,e,i,r,s,n){super({objectMode:!0}),Object.assign(this,{n3Store:t,subject:e,predicate:i,object:r,graph:s,options:n})}get filtered(){if(!this._filtered){const{n3Store:t,graph:e,object:i,predicate:r,subject:s}=this,n=this._filtered=new ge({factory:t._factory,entityIndex:this.options.entityIndex});let a,o,h;if(s&&!(a=n._termToNumericId(s))||r&&!(o=n._termToNumericId(r))||i&&!(h=n._termToNumericId(i)))return n;const u=t._getGraphs(e);for(const t in u){let e,i,r,s;(s=u[t])&&(!a&&o?(i=be(s.predicates,[o,h,a]))&&(e=be(s.subjects,[a,o,h]),r=be(s.objects,[h,a,o])):h?(r=be(s.objects,[h,a,o]))&&(e=be(s.subjects,[a,o,h]),i=be(s.predicates,[o,h,a])):(e=be(s.subjects,[a,o,h]))&&(i=be(s.predicates,[o,h,a]),r=be(s.objects,[h,a,o])),e&&(n._graphs[t]={subjects:e,predicates:i,objects:r}))}n._size=null}return this._filtered}get size(){return this.filtered.size}_read(t){t>0&&!this[ce]&&(this[ce]=this[Symbol.iterator]());const e=this[ce];for(;--t>=0;){const{done:t,value:i}=e.next();if(t)return void this.push(null);this.push(i)}}addAll(t){return this.filtered.addAll(t)}contains(t){return this.filtered.contains(t)}deleteMatches(t,e,i,r){return this.filtered.deleteMatches(t,e,i,r)}difference(t){return this.filtered.difference(t)}equals(t){return this.filtered.equals(t)}every(t,e,i,r,s){return this.filtered.every(t,e,i,r,s)}filter(t){return this.filtered.filter(t)}forEach(t,e,i,r,s){return this.filtered.forEach(t,e,i,r,s)}import(t){return this.filtered.import(t)}intersection(t){return this.filtered.intersection(t)}map(t){return this.filtered.map(t)}some(t,e,i,r,s){return this.filtered.some(t,e,i,r,s)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(t){return this._filtered?this._filtered.union(t):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(t)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(t,e){return this.filtered.reduce(t,e)}toString(){return(new re).quadsToString(this)}add(t){return this.filtered.add(t)}delete(t){return this.filtered.delete(t)}has(t){return this.filtered.has(t)}match(t,e,i,r){return new me(this.filtered,t,e,i,r,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}function ye(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if("function"==typeof e){var i=function t(){var i=!1;try{i=this instanceof t}catch{}return i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(t).forEach(function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(i,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})}),i}var xe,ve,we={},Te={},Ie={},Ee={};function Re(){return ve||(ve=1,t=Ie,e=Ie&&Ie.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=Ie&&Ie.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i(function(){if(xe)return Ee;function t(t){const e=[];let r=0;for(;r<t.length;)switch(t[r]){case"/":if("."===t[r+1])if("."===t[r+2]){if(!i(t[r+3])){e.push([]),r++;break}e.pop(),t[r+3]||e.push([]),r+=3}else{if(!i(t[r+2])){e.push([]),r++;break}t[r+2]||e.push([]),r+=2}else e.push([]),r++;break;case"#":case"?":e.length||e.push([]),e[e.length-1].push(t.substr(r)),r=t.length;break;default:e.length||e.push([]),e[e.length-1].push(t[r]),r++}return"/"+e.map(t=>t.join("")).join("/")}function e(e,i){let r=i+1;i>=0?"/"===e[i+1]&&"/"===e[i+2]&&(r=i+3):"/"===e[0]&&"/"===e[1]&&(r=2);const s=e.indexOf("/",r);return s<0?e:e.substr(0,s)+t(e.substr(s))}function i(t){return!t||"#"===t||"?"===t||"/"===t}return xe=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.removeDotSegmentsOfPath=Ee.removeDotSegments=Ee.resolve=void 0,Ee.resolve=function(i,r){const s=(r=r||"").indexOf("#");if(s>0&&(r=r.substr(0,s)),!i.length){if(r.indexOf(":")<0)throw new Error(`Found invalid baseIRI '${r}' for value '${i}'`);return r}if(i.startsWith("?")){const t=r.indexOf("?");return t>0&&(r=r.substr(0,t)),r+i}if(i.startsWith("#"))return r+i;if(!r.length){const t=i.indexOf(":");if(t<0)throw new Error(`Found invalid relative IRI '${i}' for a missing baseIRI`);return e(i,t)}const n=i.indexOf(":");if(n>=0){const t=i.indexOf("/");if(t<0||n<t)return e(i,n)}const a=r.indexOf(":");if(a<0)throw new Error(`Found invalid baseIRI '${r}' for value '${i}'`);const o=r.substr(0,a+1);if(0===i.indexOf("//"))return o+e(i,n);let h;if(r.indexOf("//",a)===a+1){if(h=r.indexOf("/",a+3),h<0)return r.length>a+3?r+"/"+e(i,n):o+e(i,n)}else if(h=r.indexOf("/",a+1),h<0)return o+e(i,n);if(0===i.indexOf("/"))return r.substr(0,h)+t(i);let u=r.substr(h);const l=u.lastIndexOf("/");return l>=0&&l<u.length-1&&(u=u.substr(0,l+1),"."===i[0]&&"."!==i[1]&&"/"!==i[1]&&i[2]&&(i=i.substr(1))),i=t(i=u+i),r.substr(0,h)+i},Ee.removeDotSegments=t,Ee.removeDotSegmentsOfPath=e,Ee}(),t)),Ie;var t,e,i}var Ne,Se={},je={};function Ce(){return Ne||(Ne=1,function(t){
|
|
2
2
|
/**
|
|
3
3
|
* Character classes and associated utilities for the 5th edition of XML 1.0.
|
|
4
4
|
*
|
|
@@ -22,5 +22,5 @@ Object.defineProperty(t,"__esModule",{value:!0}),t.CHAR="--�𐀀-",
|
|
|
22
22
|
* @license MIT
|
|
23
23
|
* @copyright Louis-Dominique Dubeau
|
|
24
24
|
*/
|
|
25
|
-
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=e,t.isNCNameChar=function(t){return e(t)||45===t||46===t||t>=48&&t<=57||183===t||t>=768&&t<=879||t>=8255&&t<=8256}}(Oe)),Oe);var r=t.isS,s=t.isChar,n=t.isNameStartChar,a=t.isNameChar,o=t.S_LIST,h=t.NAME_RE,u=e.isChar,l=i.isNCNameStartChar,c=i.isNCNameChar,d=i.NC_NAME_RE;const f="http://www.w3.org/XML/1998/namespace",p="http://www.w3.org/2000/xmlns/",_={__proto__:null,xml:f,xmlns:p},g={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},b=-1,m=-2,y=13,x=33,v=10,w=60,T=61,I=62,E=63,R=93,N=t=>34===t||39===t,S=[34,39],j=[...S,91,I],C=[...S,w,R],P=[T,E,...o],k=[...o,I,38,w];function A(t,e,i){switch(e){case"xml":i!==f&&t.fail(`xml prefix must be bound to ${f}.`);break;case"xmlns":i!==p&&t.fail(`xmlns prefix must be bound to ${p}.`)}switch(i){case p:t.fail(""===e?`the default namespace may not be set to ${i}.`:`may not assign a prefix (even "xmlns") to the URI ${p}.`);break;case f:switch(e){case"xml":break;case"":t.fail(`the default namespace may not be set to ${i}.`);break;default:t.fail("may not assign the xml namespace to another prefix.")}}}const $=t=>d.test(t),D=t=>h.test(t);Se.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];const O={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"};return Se.SaxesParser=class{get closed(){return this._closed}constructor(t){this.opt=null!=t?t:{},this.fragmentOpt=!!this.opt.fragment;const e=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=!1!==this.opt.position,this.fileName=this.opt.fileName,e){this.nameStartCheck=l,this.nameCheck=c,this.isName=$,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},_);const t=this.opt.additionalNamespaces;null!=t&&(!function(t,e){for(const i of Object.keys(e))A(t,i,e[i])}(this,t),Object.assign(this.ns,t))}else this.nameStartCheck=n,this.nameCheck=a,this.isName=D,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 t;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:e}=this;this.state=e?y:0,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=e,this.xmlDeclPossible=!e,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:i}=this.opt;if(void 0===i){if(!0===this.opt.forceXMLVersion)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");i="1.0"}this.setXMLVersion(i),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(g),null===(t=this.readyHandler)||void 0===t||t.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(t,e){this[O[t]]=e}off(t){this[O[t]]=void 0}makeError(t){var e;let i=null!==(e=this.fileName)&&void 0!==e?e:"";return this.trackPosition&&(i.length>0&&(i+=":"),i+=`${this.line}:${this.column}`),i.length>0&&(i+=": "),new Error(i+t)}fail(t){const e=this.makeError(t),i=this.errorHandler;if(void 0===i)throw e;return i(e),this}write(t){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let e=!1;null===t?(e=!0,t=""):"object"==typeof t&&(t=t.toString()),void 0!==this.carriedFromPrevious&&(t=`${this.carriedFromPrevious}${t}`,this.carriedFromPrevious=void 0);let i=t.length;const r=t.charCodeAt(i-1);!e&&(13===r||r>=55296&&r<=56319)&&(this.carriedFromPrevious=t[i-1],i--,t=t.slice(0,i));const{stateTable:s}=this;for(this.chunk=t,this.i=0;this.i<i;)s[this.state].call(this);return this.chunkPosition+=i,e?this.end():this}close(){return this.write(null)}getCode10(){const{chunk:t,i:e}=this;if(this.prevI=e,this.i=e+1,e>=t.length)return b;const i=t.charCodeAt(e);if(this.column++,i<55296){if(i>=32||9===i)return i;switch(i){case v:return this.line++,this.column=0,this.positionAtNewLine=this.position,v;case 13:return t.charCodeAt(e+1)===v&&(this.i=e+2),this.line++,this.column=0,this.positionAtNewLine=this.position,m;default:return this.fail("disallowed character."),i}}if(i>56319)return i>=57344&&i<=65533||this.fail("disallowed character."),i;const r=65536+1024*(i-55296)+(t.charCodeAt(e+1)-56320);return this.i=e+2,r>1114111&&this.fail("disallowed character."),r}getCode11(){const{chunk:t,i:e}=this;if(this.prevI=e,this.i=e+1,e>=t.length)return b;const i=t.charCodeAt(e);if(this.column++,i<55296){if(i>31&&i<127||i>159&&8232!==i||9===i)return i;switch(i){case v:return this.line++,this.column=0,this.positionAtNewLine=this.position,v;case 13:{const i=t.charCodeAt(e+1);i!==v&&133!==i||(this.i=e+2)}case 133:case 8232:return this.line++,this.column=0,this.positionAtNewLine=this.position,m;default:return this.fail("disallowed character."),i}}if(i>56319)return i>=57344&&i<=65533||this.fail("disallowed character."),i;const r=65536+1024*(i-55296)+(t.charCodeAt(e+1)-56320);return this.i=e+2,r>1114111&&this.fail("disallowed character."),r}getCodeNorm(){const t=this.getCode();return t===m?v:t}unget(){this.i=this.prevI,this.column--}captureTo(t){let{i:e}=this;const{chunk:i}=this;for(;;){const r=this.getCode(),s=r===m,n=s?v:r;if(n===b||t.includes(n))return this.text+=i.slice(e,this.prevI),n;s&&(this.text+=`${i.slice(e,this.prevI)}\n`,e=this.i)}}captureToChar(t){let{i:e}=this;const{chunk:i}=this;for(;;){let r=this.getCode();switch(r){case m:this.text+=`${i.slice(e,this.prevI)}\n`,e=this.i,r=v;break;case b:return this.text+=i.slice(e),!1}if(r===t)return this.text+=i.slice(e,this.prevI),!0}}captureNameChars(){const{chunk:t,i:e}=this;for(;;){const i=this.getCode();if(i===b)return this.name+=t.slice(e),b;if(!a(i))return this.name+=t.slice(e,this.prevI),i===m?v:i}}skipSpaces(){for(;;){const t=this.getCodeNorm();if(t===b||!r(t))return t}}setXMLVersion(t){this.currentXMLVersion=t,"1.0"===t?(this.isChar=s,this.getCode=this.getCode10):(this.isChar=u,this.getCode=this.getCode11)}sBegin(){65279===this.chunk.charCodeAt(0)&&(this.i++,this.column++),this.state=1}sBeginWhitespace(){const t=this.i,e=this.skipSpaces();switch(this.prevI!==t&&(this.xmlDeclPossible=!1),e){case w:if(this.state=15,0!==this.text.length)throw new Error("no-empty text at start");break;case b:break;default:this.unget(),this.state=y,this.xmlDeclPossible=!1}}sDoctype(){var t;const e=this.captureTo(j);switch(e){case I:null===(t=this.doctypeHandler)||void 0===t||t.call(this,this.text),this.text="",this.state=y,this.doctype=!0;break;case b:break;default:this.text+=String.fromCodePoint(e),91===e?this.state=4:N(e)&&(this.state=3,this.q=e)}}sDoctypeQuote(){const t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.q=null,this.state=2)}sDTD(){const t=this.captureTo(C);t!==b&&(this.text+=String.fromCodePoint(t),t===R?this.state=2:t===w?this.state=6:N(t)&&(this.state=5,this.q=t))}sDTDQuoted(){const t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.state=4,this.q=null)}sDTDOpenWaka(){const t=this.getCodeNorm();switch(this.text+=String.fromCodePoint(t),t){case 33:this.state=7,this.openWakaBang="";break;case E:this.state=11;break;default:this.state=4}}sDTDOpenWakaBang(){const t=String.fromCodePoint(this.getCodeNorm()),e=this.openWakaBang+=t;this.text+=t,"-"!==e&&(this.state="--"===e?8:4,this.openWakaBang="")}sDTDComment(){this.captureToChar(45)&&(this.text+="-",this.state=9)}sDTDCommentEnding(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),this.state=45===t?10:8}sDTDCommentEnded(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===I?this.state=4:(this.fail("malformed comment."),this.state=8)}sDTDPI(){this.captureToChar(E)&&(this.text+="?",this.state=12)}sDTDPIEnding(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===I&&(this.state=4)}sText(){0!==this.tags.length?this.handleTextInRoot():this.handleTextOutsideRoot()}sEntity(){let{i:t}=this;const{chunk:e}=this;t:for(;;)switch(this.getCode()){case m:this.entity+=`${e.slice(t,this.prevI)}\n`,t=this.i;break;case 59:{const{entityReturnState:i}=this,r=this.entity+e.slice(t,this.prevI);let s;this.state=i,""===r?(this.fail("empty entity name."),s="&;"):(s=this.parseEntity(r),this.entity=""),i===y&&void 0===this.textHandler||(this.text+=s);break t}case b:this.entity+=e.slice(t);break t}}sOpenWaka(){const t=this.getCode();if(n(t))this.state=34,this.unget(),this.xmlDeclPossible=!1;else switch(t){case 47:this.state=43,this.xmlDeclPossible=!1;break;case 33:this.state=16,this.openWakaBang="",this.xmlDeclPossible=!1;break;case E:this.state=23;break;default:this.fail("disallowed character in tag name"),this.state=y,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 t;const e=this.getCodeNorm();45===e?(this.state=19,null===(t=this.commentHandler)||void 0===t||t.call(this,this.text),this.text=""):(this.text+=`-${String.fromCodePoint(e)}`,this.state=17)}sCommentEnded(){const t=this.getCodeNorm();t!==I?(this.fail("malformed comment."),this.text+=`--${String.fromCodePoint(t)}`,this.state=17):this.state=y}sCData(){this.captureToChar(R)&&(this.state=21)}sCDataEnding(){const t=this.getCodeNorm();t===R?this.state=22:(this.text+=`]${String.fromCodePoint(t)}`,this.state=20)}sCDataEnding2(){var t;const e=this.getCodeNorm();switch(e){case I:null===(t=this.cdataHandler)||void 0===t||t.call(this,this.text),this.text="",this.state=y;break;case R:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(e)}`,this.state=20}}sPIFirstChar(){const t=this.getCodeNorm();this.nameStartCheck(t)?(this.piTarget+=String.fromCodePoint(t),this.state=24):t===E||r(t)?(this.fail("processing instruction without a target."),this.state=t===E?26:25):(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(t),this.state=24)}sPIRest(){const{chunk:t,i:e}=this;for(;;){const i=this.getCodeNorm();if(i===b)return void(this.piTarget+=t.slice(e));if(!this.nameCheck(i)){this.piTarget+=t.slice(e,this.prevI);const s=i===E;s||r(i)?"xml"===this.piTarget?(this.xmlDeclPossible||this.fail("an XML declaration must be at the start of the document."),this.state=s?x:27):this.state=s?26:25:(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(i));break}}}sPIBody(){if(0===this.text.length){const t=this.getCodeNorm();t===E?this.state=26:r(t)||(this.text=String.fromCodePoint(t))}else this.captureToChar(E)&&(this.state=26)}sPIEnding(){var t;const e=this.getCodeNorm();if(e===I){const{piTarget:e}=this;"xml"===e.toLowerCase()&&this.fail("the XML declaration must appear at the start of the document."),null===(t=this.piHandler)||void 0===t||t.call(this,{target:e,body:this.text}),this.piTarget=this.text="",this.state=y}else e===E?this.text+="?":(this.text+=`?${String.fromCodePoint(e)}`,this.state=25);this.xmlDeclPossible=!1}sXMLDeclNameStart(){const t=this.skipSpaces();t!==E?t!==b&&(this.state=28,this.name=String.fromCodePoint(t)):this.state=x}sXMLDeclName(){const t=this.captureTo(P);if(t===E)return this.state=x,this.name+=this.text,this.text="",void this.fail("XML declaration is incomplete.");if(r(t)||t===T){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=t===T?30:29}}sXMLDeclEq(){const t=this.getCodeNorm();if(t===E)return this.state=x,void this.fail("XML declaration is incomplete.");r(t)||(t!==T&&this.fail("value required."),this.state=30)}sXMLDeclValueStart(){const t=this.getCodeNorm();if(t===E)return this.state=x,void this.fail("XML declaration is incomplete.");r(t)||(N(t)?this.q=t:(this.fail("value must be quoted."),this.q=32),this.state=31)}sXMLDeclValue(){const t=this.captureTo([this.q,E]);if(t===E)return this.state=x,this.text="",void this.fail("XML declaration is incomplete.");if(t===b)return;const e=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];const t=e;this.xmlDecl.version=t,/^1\.[0-9]+$/.test(t)?this.opt.forceXMLVersion||this.setXMLVersion(t):this.fail("version number must match /^1\\.[0-9]+$/.");break}case"encoding":/^[A-Za-z][A-Za-z0-9._-]*$/.test(e)||this.fail("encoding value must match \t/^[A-Za-z0-9][A-Za-z0-9._-]*$/."),this.xmlDeclExpects=["standalone"],this.xmlDecl.encoding=e;break;case"standalone":"yes"!==e&&"no"!==e&&this.fail('standalone value must match "yes" or "no".'),this.xmlDeclExpects=[],this.xmlDecl.standalone=e}this.name="",this.state=32}sXMLDeclSeparator(){const t=this.getCodeNorm();t!==E?(r(t)||(this.fail("whitespace required."),this.unget()),this.state=27):this.state=x}sXMLDeclEnding(){var t;this.getCodeNorm()===I?("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===(t=this.xmldeclHandler)||void 0===t||t.call(this,this.xmlDecl),this.name="",this.piTarget=this.text="",this.state=y):this.fail("The character ? is disallowed anywhere in XML declarations."),this.xmlDeclPossible=!1}sOpenTag(){var t;const e=this.captureNameChars();if(e===b)return;const i=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name="",this.xmlnsOpt&&(this.topNS=i.ns=Object.create(null)),null===(t=this.openTagStartHandler)||void 0===t||t.call(this,i),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail("documents may contain only one root."),e){case I:this.openTag();break;case 47:this.state=35;break;default:r(e)||this.fail("disallowed character in tag name."),this.state=36}}sOpenTagSlash(){this.getCode()===I?this.openSelfClosingTag():(this.fail("forward-slash in opening tag not followed by >."),this.state=36)}sAttrib(){const t=this.skipSpaces();t!==b&&(n(t)?(this.unget(),this.state=37):t===I?this.openTag():47===t?this.state=35:this.fail("disallowed character in attribute name."))}sAttribName(){const t=this.captureNameChars();t===T?this.state=39:r(t)?this.state=38:t===I?(this.fail("attribute without value."),this.pushAttrib(this.name,this.name),this.name=this.text="",this.openTag()):t!==b&&this.fail("disallowed character in attribute name.")}sAttribNameSawWhite(){const t=this.skipSpaces();switch(t){case b:return;case T:this.state=39;break;default:this.fail("attribute without value."),this.text="",this.name="",t===I?this.openTag():n(t)?(this.unget(),this.state=37):(this.fail("disallowed character in attribute name."),this.state=36)}}sAttribValue(){const t=this.getCodeNorm();N(t)?(this.q=t,this.state=40):r(t)||(this.fail("unquoted attribute value."),this.state=42,this.unget())}sAttribValueQuoted(){const{q:t,chunk:e}=this;let{i:i}=this;for(;;)switch(this.getCode()){case t:return this.pushAttrib(this.name,this.text+e.slice(i,this.prevI)),this.name=this.text="",this.q=null,void(this.state=41);case 38:return this.text+=e.slice(i,this.prevI),this.state=14,void(this.entityReturnState=40);case v:case m:case 9:this.text+=`${e.slice(i,this.prevI)} `,i=this.i;break;case w:return this.text+=e.slice(i,this.prevI),void this.fail("disallowed character.");case b:return void(this.text+=e.slice(i))}}sAttribValueClosed(){const t=this.getCodeNorm();r(t)?this.state=36:t===I?this.openTag():47===t?this.state=35:n(t)?(this.fail("no whitespace between attributes."),this.unget(),this.state=37):this.fail("disallowed character in attribute name.")}sAttribValueUnquoted(){const t=this.captureTo(k);switch(t){case 38:this.state=14,this.entityReturnState=42;break;case w:this.fail("disallowed character.");break;case b:break;default:this.text.includes("]]>")&&this.fail('the string "]]>" is disallowed in char data.'),this.pushAttrib(this.name,this.text),this.name=this.text="",t===I?this.openTag():this.state=36}}sCloseTag(){const t=this.captureNameChars();t===I?this.closeTag():r(t)?this.state=44:t!==b&&this.fail("disallowed character in closing tag.")}sCloseTagSawWhite(){switch(this.skipSpaces()){case I:this.closeTag();break;case b:break;default:this.fail("disallowed character in closing tag.")}}handleTextInRoot(){let{i:t,forbiddenState:e}=this;const{chunk:i,textHandler:r}=this;t:for(;;)switch(this.getCode()){case w:if(this.state=15,void 0!==r){const{text:e}=this,s=i.slice(t,this.prevI);0!==e.length?(r(e+s),this.text=""):0!==s.length&&r(s)}e=0;break t;case 38:this.state=14,this.entityReturnState=y,void 0!==r&&(this.text+=i.slice(t,this.prevI)),e=0;break t;case R:switch(e){case 0:e=1;break;case 1:e=2;break;case 2:break;default:throw new Error("impossible state")}break;case I:2===e&&this.fail('the string "]]>" is disallowed in char data.'),e=0;break;case m:void 0!==r&&(this.text+=`${i.slice(t,this.prevI)}\n`),t=this.i,e=0;break;case b:void 0!==r&&(this.text+=i.slice(t));break t;default:e=0}this.forbiddenState=e}handleTextOutsideRoot(){let{i:t}=this;const{chunk:e,textHandler:i}=this;let s=!1;t:for(;;){const n=this.getCode();switch(n){case w:if(this.state=15,void 0!==i){const{text:r}=this,s=e.slice(t,this.prevI);0!==r.length?(i(r+s),this.text=""):0!==s.length&&i(s)}break t;case 38:this.state=14,this.entityReturnState=y,void 0!==i&&(this.text+=e.slice(t,this.prevI)),s=!0;break t;case m:void 0!==i&&(this.text+=`${e.slice(t,this.prevI)}\n`),t=this.i;break;case b:void 0!==i&&(this.text+=e.slice(t));break t;default:r(n)||(s=!0)}}s&&(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(t,e){var i;const{prefix:r,local:s}=this.qname(t),n={name:t,prefix:r,local:s,value:e};if(this.attribList.push(n),null===(i=this.attributeHandler)||void 0===i||i.call(this,n),"xmlns"===r){const t=e.trim();"1.0"===this.currentXMLVersion&&""===t&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[s]=t,A(this,s,t)}else if("xmlns"===t){const t=e.trim();this.topNS[""]=t,A(this,"",t)}}pushAttribPlain(t,e){var i;const r={name:t,value:e};this.attribList.push(r),null===(i=this.attributeHandler)||void 0===i||i.call(this,r)}end(){var t,e;this.sawRoot||this.fail("document must contain a root element.");const{tags:i}=this;for(;i.length>0;){const t=i.pop();this.fail(`unclosed tag: ${t.name}`)}0!==this.state&&this.state!==y&&this.fail("unexpected end.");const{text:r}=this;return 0!==r.length&&(null===(t=this.textHandler)||void 0===t||t.call(this,r),this.text=""),this._closed=!0,null===(e=this.endHandler)||void 0===e||e.call(this),this._init(),this}resolve(t){var e,i;let r=this.topNS[t];if(void 0!==r)return r;const{tags:s}=this;for(let e=s.length-1;e>=0;e--)if(r=s[e].ns[t],void 0!==r)return r;return r=this.ns[t],void 0!==r?r:null===(i=(e=this.opt).resolvePrefix)||void 0===i?void 0:i.call(e,t)}qname(t){const e=t.indexOf(":");if(-1===e)return{prefix:"",local:t};const i=t.slice(e+1),r=t.slice(0,e);return(""===r||""===i||i.includes(":"))&&this.fail(`malformed name: ${t}.`),{prefix:r,local:i}}processAttribsNS(){var t;const{attribList:e}=this,i=this.tag;{const{prefix:e,local:r}=this.qname(i.name);i.prefix=e,i.local=r;const s=i.uri=null!==(t=this.resolve(e))&&void 0!==t?t:"";""!==e&&("xmlns"===e&&this.fail('tags may not have "xmlns" as prefix.'),""===s&&(this.fail(`unbound namespace prefix: ${JSON.stringify(e)}.`),i.uri=e))}if(0===e.length)return;const{attributes:r}=i,s=new Set;for(const t of e){const{name:e,prefix:i,local:n}=t;let a,o;""===i?(a="xmlns"===e?p:"",o=e):(a=this.resolve(i),void 0===a&&(this.fail(`unbound namespace prefix: ${JSON.stringify(i)}.`),a=i),o=`{${a}}${n}`),s.has(o)&&this.fail(`duplicate attribute: ${o}.`),s.add(o),t.uri=a,r[e]=t}this.attribList=[]}processAttribsPlain(){const{attribList:t}=this,e=this.tag.attributes;for(const{name:i,value:r}of t)void 0!==e[i]&&this.fail(`duplicate attribute: ${i}.`),e[i]=r;this.attribList=[]}openTag(){var t;this.processAttribs();const{tags:e}=this,i=this.tag;i.isSelfClosing=!1,null===(t=this.openTagHandler)||void 0===t||t.call(this,i),e.push(i),this.state=y,this.name=""}openSelfClosingTag(){var t,e,i;this.processAttribs();const{tags:r}=this,s=this.tag;s.isSelfClosing=!0,null===(t=this.openTagHandler)||void 0===t||t.call(this,s),null===(e=this.closeTagHandler)||void 0===e||e.call(this,s);null===(this.tag=null!==(i=r[r.length-1])&&void 0!==i?i:null)&&(this.closedRoot=!0),this.state=y,this.name=""}closeTag(){const{tags:t,name:e}=this;if(this.state=y,this.name="",""===e)return this.fail("weird empty close tag."),void(this.text+="</>");const i=this.closeTagHandler;let r=t.length;for(;r-- >0;){const r=this.tag=t.pop();if(this.topNS=r.ns,null==i||i(r),r.name===e)break;this.fail("unexpected close tag.")}0===r?this.closedRoot=!0:r<0&&(this.fail(`unmatched closing tag: ${e}.`),this.text+=`</${e}>`)}parseEntity(t){if("#"!==t[0]){const e=this.ENTITIES[t];return void 0!==e?e:(this.fail(this.isName(t)?"undefined entity.":"disallowed character in entity name."),`&${t};`)}let e=NaN;return"x"===t[1]&&/^#x[0-9a-f]+$/i.test(t)?e=parseInt(t.slice(2),16):/^#[0-9]+$/.test(t)&&(e=parseInt(t.slice(1),10)),this.isChar(e)?String.fromCodePoint(e):(this.fail("malformed character entity."),`&${t};`)}},Se}var Le,Me=ye(le),Be={};function qe(){if(Le)return Be;Le=1,Object.defineProperty(Be,"__esModule",{value:!0}),Be.ParseError=void 0;let t=class extends Error{constructor(t,e){const i=t.saxParser;super(t.trackPosition?`Line ${i.line} column ${i.column+1}: ${e}`:e)}};return Be.ParseError=t,Be}var Ue,Qe={},He={};function Ge(){if(Ue)return He;Ue=1,Object.defineProperty(He,"__esModule",{value:!0}),He.BlankNode=void 0;return He.BlankNode=class{constructor(t){this.termType="BlankNode",this.value=t}equals(t){return!!t&&"BlankNode"===t.termType&&t.value===this.value}},He}var ze,Ye={},Ve={};function Xe(){if(ze)return Ve;ze=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.DefaultGraph=void 0;let t=class{constructor(){this.termType="DefaultGraph",this.value=""}equals(t){return!!t&&"DefaultGraph"===t.termType}};return Ve.DefaultGraph=t,t.INSTANCE=new t,Ve}var We,Ze,Je={},Ke={};function ti(){if(We)return Ke;We=1,Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.NamedNode=void 0;return Ke.NamedNode=class{constructor(t){this.termType="NamedNode",this.value=t}equals(t){return!!t&&"NamedNode"===t.termType&&t.value===this.value}},Ke}function ei(){if(Ze)return Je;Ze=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.Literal=void 0;const t=ti();let e=class t{constructor(e,i){this.termType="Literal",this.value=e,"string"==typeof i?(this.language=i,this.datatype=t.RDF_LANGUAGE_STRING):i?(this.language="",this.datatype=i):(this.language="",this.datatype=t.XSD_STRING)}equals(t){return!!t&&"Literal"===t.termType&&t.value===this.value&&t.language===this.language&&this.datatype.equals(t.datatype)}};return Je.Literal=e,e.RDF_LANGUAGE_STRING=new t.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),e.XSD_STRING=new t.NamedNode("http://www.w3.org/2001/XMLSchema#string"),Je}var ii,ri={};function si(){if(ii)return ri;ii=1,Object.defineProperty(ri,"__esModule",{value:!0}),ri.Quad=void 0;return ri.Quad=class{constructor(t,e,i,r){this.termType="Quad",this.value="",this.subject=t,this.predicate=e,this.object=i,this.graph=r}equals(t){return!!t&&("Quad"===t.termType||!t.termType)&&this.subject.equals(t.subject)&&this.predicate.equals(t.predicate)&&this.object.equals(t.object)&&this.graph.equals(t.graph)}},ri}var ni,ai,oi,hi={};function ui(){if(ni)return hi;ni=1,Object.defineProperty(hi,"__esModule",{value:!0}),hi.Variable=void 0;return hi.Variable=class{constructor(t){this.termType="Variable",this.value=t}equals(t){return!!t&&"Variable"===t.termType&&t.value===this.value}},hi}function li(){return oi||(oi=1,t=Qe,e=Qe&&Qe.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=Qe&&Qe.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i(Ge(),t),i(function(){if(ai)return Ye;ai=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.DataFactory=void 0;const t=Ge(),e=Xe(),i=ei(),r=ti(),s=si(),n=ui();let a=0;return Ye.DataFactory=class{constructor(t){this.blankNodeCounter=0,t=t||{},this.blankNodePrefix=t.blankNodePrefix||`df_${a++}_`}namedNode(t){return new r.NamedNode(t)}blankNode(e){return new t.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(t,e){return new i.Literal(t,e)}variable(t){return new n.Variable(t)}defaultGraph(){return e.DefaultGraph.INSTANCE}quad(t,e,i,r){return new s.Quad(t,e,i,r||this.defaultGraph())}fromTerm(t){switch(t.termType){case"NamedNode":return this.namedNode(t.value);case"BlankNode":return this.blankNode(t.value);case"Literal":return t.language?this.literal(t.value,t.language):t.datatype.equals(i.Literal.XSD_STRING)?this.literal(t.value):this.literal(t.value,this.fromTerm(t.datatype));case"Variable":return this.variable(t.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(t.subject),this.fromTerm(t.predicate),this.fromTerm(t.object),this.fromTerm(t.graph))}}fromQuad(t){return this.fromTerm(t)}resetBlankNodeCounter(){this.blankNodeCounter=0}},Ye}(),t),i(Xe(),t),i(ei(),t),i(ti(),t),i(si(),t),i(ui(),t)),Qe;var t,e,i}var ci,di,fi,pi,_i={},gi={};function bi(){return di||(di=1,t=_i,e=_i&&_i.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=_i&&_i.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i((ci||(ci=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateIri=t.IriValidationStrategy=void 0;const e=function(){const t="[!$&'()*+,;=]",e="%[a-fA-F0-9]{2}",i="([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",r=`${i}\\.${i}\\.${i}\\.${i}`,s="[a-fA-F0-9]{1,4}",n=`(${s}:${s}|${r})`,a="[a-zA-Z0-9\\-._~ -豈-﷏ﷰ-𐀀-𠀀-𰀀------------]",o=`(${a}|${e}|${t}|[:@])*`,h=`(${o})+`,u=`(${o})*`;return new RegExp(`^[a-zA-Z][a-zA-Z0-9+\\-.]*:(\\/\\/((${a}|${e}|${t}|:)*@)?(\\[(((${s}:){6}${n}|::(${s}:){5}${n}|(${s})?::(${s}:){4}${n}|((${s}:){0,1}${s})?::(${s}:){3}${n}|((${s}:){0,2}${s})?::(${s}:){2}${n}|((${s}:){0,3}${s})?::${s}:${n}|((${s}:){0,4}${s})?::${n}|((${s}:){0,5}${s})?::${s}|((${s}:){0,6}${s})?::)|v[a-fA-F0-9]+\\.(${t}|${t}|":)+)\\]|${r}|(${a}|${e}|${t})*)(:[0-9]*)?(\\/${u})*|\\/(${h}(\\/${u})*)?|${h}(\\/${u})*|)(\\?(${o}|[---]|[\\/?])*)?(#(${o}|[\\/?])*)?$`,"u")}(),i=/^[A-Za-z][\d+-.A-Za-z]*:[^\u0000-\u0020"<>\\^`{|}]*$/u;var r;!function(t){t.Strict="strict",t.Pragmatic="pragmatic",t.None="none"}(r=t.IriValidationStrategy||(t.IriValidationStrategy={})),t.validateIri=function(t,s=r.Strict){switch(s){case r.Strict:return e.test(t)?void 0:new Error(`Invalid IRI according to RFC 3987: '${t}'`);case r.Pragmatic:return i.test(t)?void 0:new Error(`Invalid IRI according to RDF Turtle: '${t}'`);case r.None:return;default:return new Error(`Not supported validation strategy "${s}"`)}}}(gi)),gi),t)),_i;var t,e,i}function mi(){if(fi)return Te;fi=1,Object.defineProperty(Te,"__esModule",{value:!0}),Te.ParseType=Te.RdfXmlParser=void 0;const t=Re(),e=Fe(),i=Me,r=qe(),s=li(),n=bi();let a=class a extends i.Transform{constructor(t){super({readableObjectMode:!0}),this.activeTagStack=[],this.nodeIds={},t&&(Object.assign(this,t),this.options=t),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?n.IriValidationStrategy.Pragmatic:n.IriValidationStrategy.None),this.saxParser=new e.SaxesParser({xmlns:!0,position:this.trackPosition}),this.attachSaxListeners()}import(t){const e=new i.PassThrough({readableObjectMode:!0});t.on("error",t=>r.emit("error",t)),t.on("data",t=>e.push(t)),t.on("end",()=>e.push(null));const r=e.pipe(new a(this.options));return r}_transform(t,e,i){try{this.saxParser.write(t)}catch(t){return i(t)}i()}newParseError(t){return new r.ParseError(this,t)}valueToUri(e,i){return this.uriToNamedNode((0,t.resolve)(e,i.baseIRI))}uriToNamedNode(t){const e=(0,n.validateIri)(t,this.iriValidationStrategy);if(e instanceof Error)throw this.newParseError(e.message);return this.dataFactory.namedNode(t)}validateNcname(t){if(!a.NCNAME_MATCHER.test(t))throw this.newParseError(`Not a valid NCName: ${t}`)}attachSaxListeners(){this.saxParser.on("error",t=>this.emit("error",t)),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(t){const e=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;let i=o.RESOURCE;if(e&&(e.hadChildren=!0,i=e.childrenParseType),e&&e.childrenStringTags){const i=t.name;let r="";for(const e in t.attributes)r+=` ${e}="${t.attributes[e].value}"`;const s=`<${`${i}${r}`}>`;e.childrenStringTags.push(s);const n={childrenStringTags:e.childrenStringTags};return n.childrenStringEmitClosingTag=`</${i}>`,void this.activeTagStack.push(n)}const r={};e?(r.language=e.language,r.baseIRI=e.baseIRI):r.baseIRI=this.baseIRI,this.activeTagStack.push(r),i===o.RESOURCE?this.onTagResource(t,r,e,!e):this.onTagProperty(t,r,e)}onTagResource(e,i,r,s){i.childrenParseType=o.PROPERTY;let n=!0;if(e.uri===a.RDF){if(!s&&a.FORBIDDEN_NODE_ELEMENTS.indexOf(e.local)>=0)throw this.newParseError(`Illegal node element name: ${e.local}`);switch(e.local){case"RDF":i.childrenParseType=o.RESOURCE;case"Description":n=!1}}const h=[],u=[];let l=null,c=!1,d=!1,f=null;for(const s in e.attributes){const n=e.attributes[s];if(r&&n.uri===a.RDF)switch(n.local){case"about":if(l)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${n.value} and ${l} where found.`);l=n.value;continue;case"ID":if(l)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${n.value} and ${l} where found.`);this.validateNcname(n.value),l="#"+n.value,c=!0;continue;case"nodeID":if(l)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${n.value} and ${l} where found.`);this.validateNcname(n.value),l=n.value,d=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"type":f=n.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(n.uri===a.XML){if("lang"===n.local){i.language=""===n.value?null:n.value.toLowerCase();continue}if("base"===n.local){i.baseIRI=(0,t.resolve)(n.value,i.baseIRI);continue}}"xml"===n.prefix||"xmlns"===n.prefix||""===n.prefix&&"xmlns"===n.local||!n.uri||(h.push(this.uriToNamedNode(n.uri+n.local)),u.push(n.value))}if(null!==l&&(i.subject=d?this.dataFactory.blankNode(l):this.valueToUri(l,i),c&&this.claimNodeId(i.subject)),i.subject||(i.subject=this.dataFactory.blankNode()),n){const t=this.uriToNamedNode(e.uri+e.local);this.emitTriple(i.subject,this.dataFactory.namedNode(a.RDF+"type"),t,r?r.reifiedStatementId:null)}if(r){if(r.predicate)if(r.childrenCollectionSubject){const t=this.dataFactory.blankNode();this.emitTriple(r.childrenCollectionSubject,r.childrenCollectionPredicate,t,r.reifiedStatementId),this.emitTriple(t,this.dataFactory.namedNode(a.RDF+"first"),i.subject,i.reifiedStatementId),r.childrenCollectionSubject=t,r.childrenCollectionPredicate=this.dataFactory.namedNode(a.RDF+"rest")}else{this.emitTriple(r.subject,r.predicate,i.subject,r.reifiedStatementId);for(let t=0;t<r.predicateSubPredicates.length;t++)this.emitTriple(i.subject,r.predicateSubPredicates[t],r.predicateSubObjects[t],null);r.predicateSubPredicates=[],r.predicateSubObjects=[],r.predicateEmitted=!0}for(let t=0;t<h.length;t++){const e=this.dataFactory.literal(u[t],i.datatype||i.language);this.emitTriple(i.subject,h[t],e,r.reifiedStatementId)}f&&this.emitTriple(i.subject,this.dataFactory.namedNode(a.RDF+"type"),this.uriToNamedNode(f),null)}}onTagProperty(t,e,i){if(e.childrenParseType=o.RESOURCE,e.subject=i.subject,t.uri===a.RDF&&"li"===t.local?(i.listItemCounter||(i.listItemCounter=1),e.predicate=this.uriToNamedNode(t.uri+"_"+i.listItemCounter++)):e.predicate=this.uriToNamedNode(t.uri+t.local),t.uri===a.RDF&&a.FORBIDDEN_PROPERTY_ELEMENTS.indexOf(t.local)>=0)throw this.newParseError(`Illegal property element name: ${t.local}`);e.predicateSubPredicates=[],e.predicateSubObjects=[];let r=!1,s=!1,n=null,h=!0;const u=[],l=[];for(const i in t.attributes){const c=t.attributes[i];if(c.uri===a.RDF)switch(c.local){case"resource":if(n)throw this.newParseError(`Found both rdf:resource (${c.value}) and rdf:nodeID (${n}).`);if(r)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${c.value})`);e.hadChildren=!0,n=c.value,h=!1;continue;case"datatype":if(s)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${c.value}).`);if(r)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${c.value})`);e.datatype=this.valueToUri(c.value,e);continue;case"nodeID":if(s)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${c.value}).`);if(e.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${c.value}).`);if(r)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${c.value})`);this.validateNcname(c.value),e.hadChildren=!0,n=c.value,h=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"parseType":if(s)throw this.newParseError("rdf:parseType is not allowed when non-rdf:* property attributes are present");if(e.datatype)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${e.datatype.value})`);if(n)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID or rdf:resource (${n})`);if("Resource"===c.value){r=!0,e.childrenParseType=o.PROPERTY;const t=this.dataFactory.blankNode();this.emitTriple(e.subject,e.predicate,t,e.reifiedStatementId),e.subject=t,e.predicate=null}else"Collection"===c.value?(r=!0,e.hadChildren=!0,e.childrenCollectionSubject=e.subject,e.childrenCollectionPredicate=e.predicate,h=!1):"Literal"===c.value&&(r=!0,e.childrenTagsToString=!0,e.childrenStringTags=[]);continue;case"ID":this.validateNcname(c.value),e.reifiedStatementId=this.valueToUri("#"+c.value,e),this.claimNodeId(e.reifiedStatementId);continue}else if(c.uri===a.XML&&"lang"===c.local){e.language=""===c.value?null:c.value.toLowerCase();continue}if("xml"!==c.prefix&&"xmlns"!==c.prefix&&(""!==c.prefix||"xmlns"!==c.local)&&c.uri){if(r||e.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${c.value}`);e.hadChildren=!0,s=!0,u.push(this.uriToNamedNode(c.uri+c.local)),l.push(this.dataFactory.literal(c.value,e.datatype||e.language))}}if(null!==n){const t=e.subject;e.subject=h?this.dataFactory.blankNode(n):this.valueToUri(n,e),this.emitTriple(t,e.predicate,e.subject,e.reifiedStatementId);for(let t=0;t<u.length;t++)this.emitTriple(e.subject,u[t],l[t],null);e.predicateEmitted=!0}else h&&(e.predicateSubPredicates=u,e.predicateSubObjects=l,e.predicateEmitted=!1)}emitTriple(t,e,i,r){this.push(this.dataFactory.quad(t,e,i,this.defaultGraph)),r&&(this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"type"),this.dataFactory.namedNode(a.RDF+"Statement"),this.defaultGraph)),this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"subject"),t,this.defaultGraph)),this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"predicate"),e,this.defaultGraph)),this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"object"),i,this.defaultGraph)))}claimNodeId(t){if(!this.allowDuplicateRdfIds){if(this.nodeIds[t.value])throw this.newParseError(`Found multiple occurrences of rdf:ID='${t.value}'.`);this.nodeIds[t.value]=!0}}onText(t){const e=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;e&&(e.childrenStringTags?e.childrenStringTags.push(t):e.predicate&&(e.text=t))}onCloseTag(){const t=this.activeTagStack.pop();if(t.childrenStringEmitClosingTag&&t.childrenStringTags.push(t.childrenStringEmitClosingTag),t.childrenTagsToString&&(t.datatype=this.dataFactory.namedNode(a.RDF+"XMLLiteral"),t.text=t.childrenStringTags.join(""),t.hadChildren=!1),t.childrenCollectionSubject)this.emitTriple(t.childrenCollectionSubject,t.childrenCollectionPredicate,this.dataFactory.namedNode(a.RDF+"nil"),t.reifiedStatementId);else if(t.predicate)if(t.hadChildren||t.childrenParseType===o.PROPERTY){if(!t.predicateEmitted){const e=this.dataFactory.blankNode();this.emitTriple(t.subject,t.predicate,e,t.reifiedStatementId);for(let i=0;i<t.predicateSubPredicates.length;i++)this.emitTriple(e,t.predicateSubPredicates[i],t.predicateSubObjects[i],null)}}else this.emitTriple(t.subject,t.predicate,this.dataFactory.literal(t.text||"",t.datatype||t.language),t.reifiedStatementId)}onDoctype(t){t.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(t,e,i)=>(this.saxParser.ENTITIES[e]=i,""))}};var o;return Te.RdfXmlParser=a,a.MIME_TYPE="application/rdf+xml",a.RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#",a.XML="http://www.w3.org/XML/1998/namespace",a.FORBIDDEN_NODE_ELEMENTS=["RDF","ID","about","bagID","parseType","resource","nodeID","li","aboutEach","aboutEachPrefix"],a.FORBIDDEN_PROPERTY_ELEMENTS=["Description","RDF","ID","about","bagID","parseType","resource","nodeID","aboutEach","aboutEachPrefix"],a.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(t){t[t.RESOURCE=0]="RESOURCE",t[t.PROPERTY=1]="PROPERTY"}(o||(Te.ParseType=o={})),Te}function yi(){return pi||(pi=1,t=we,e=we&&we.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=we&&we.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i(mi(),t)),we;var t,e,i}var xi=yi();const vi={labelPredicates:u,descriptionPredicates:l},wi={},Ti={},Ii=new Set(["text/turtle","text/n3","application/n-triples","application/n-quads","application/trig","text/anot+turtle"]),Ei=["text/turtle","application/n-triples","application/n-quads","application/trig","application/ld+json","application/rdf+xml"].join(", ");function Ri(t,e,i,r=function(){var t;if("undefined"!=typeof navigator&&(null===(t=navigator.languages)||void 0===t?void 0:t.length))return Array.from(navigator.languages);try{return[Intl.DateTimeFormat().resolvedOptions().locale]}catch(t){return[]}}()){const s=Et.namedNode(e);for(const e of i){const i=t.getQuads(s,Et.namedNode(e),null,null).filter(t=>"Literal"===t.object.termType);if(!i.length)continue;for(const t of r){const e=t.split("-")[0].toLowerCase(),r=i.find(i=>{var r;const s=null===(r=i.object.language)||void 0===r?void 0:r.toLowerCase();return s===t.toLowerCase()||(null==s?void 0:s.split("-")[0])===e});if(r)return r.object.value}const n=i.find(t=>!t.object.language);if(n)return n.object.value;const a=i.find(t=>{var e;return"en"===(null===(e=t.object.language)||void 0===e?void 0:e.toLowerCase())});return(null!=a?a:i[0]).object.value}return null}function Ni(t,e,i){const r=new ge,s=new Ut({baseIRI:e,format:"text/anot+turtle"===i?"text/turtle":i});return new Promise((e,i)=>{s.parse(t,(t,s)=>{if(t)return i(t);s?r.addQuad(s):e(r)})})}const Si=t=>t?Array.isArray(t)?t:[t]:[],ji=t=>`DESCRIBE <${t}>`,Ci=async(t,e)=>{var i;let r;try{if(r=await t(),!r.ok)return null}catch(t){return null}const s=(null===(i=r.headers.get("content-type"))||void 0===i?void 0:i.split(";")[0].trim())||"text/turtle",n=await r.text();try{if(Ii.has(s))return Ni(n,e,s);if("application/ld+json"===s)return async function(t,e){const i=await Promise.resolve().then(function(){return Fi});if(!i)throw new Error("jsonld peer dependency is not available");const r=JSON.parse(t);return Ni(await i.toRDF(r,{format:"application/n-quads",base:e}),e,"application/n-quads")}(n,e);if("application/rdf+xml"===s)return async function(t,e){const i=new ge;return new Promise((r,s)=>{const n=new xi.RdfXmlParser({baseIRI:e});n.on("data",t=>i.addQuad(t)),n.on("error",s),n.on("end",()=>r(i)),n.write(t),n.end()})}(n,e)}catch(t){}return null},Pi=(t,e)=>(t in Ti||(Ti[t]=Ci(e,t)),Ti[t]),ki=async(t,e,i)=>{const r=await t;if(!r)return null;const s=Ri(r,e,i.labelPredicates);return s?{uri:e,label:s,description:Ri(r,e,i.descriptionPredicates)}:null};async function Ai(t,e={}){const i={...vi,...e};return t in wi||(wi[t]=(async(t,e)=>{const i=t.includes("#")?t.split("#")[0]:t;let r=await ki(Pi(i,()=>fetch(i,{headers:{Accept:Ei}})),t,e);const s=t.includes("#");for(const i of[...Si(e.fallbackRainbowInstances),...Si(e.fallbackRainbowInstance)]){if(r||s)break;const n=new URL(i);n.searchParams.set("uri",t);const a=n.toString();r=await ki(Pi(a,()=>fetch(a,{headers:{Accept:Ei}})),t,e)}for(const i of[...Si(e.fallbackSparqlEndpoints),...Si(e.fallbackSparqlEndpoint)]){if(r)break;const s=new URLSearchParams({query:ji(t)});r=await ki(Ci(()=>fetch(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"text/turtle, application/n-triples"},body:s.toString()}),t),t,e)}if(!r)throw new Error(`No label data found for <${t}>`);return r})(t,i)),wi[t]}const $i={replaceElements:!0,...vi};async function Di(t,e,i={}){const r={...$i,...i},s=(t,e,i=!0,r=!1)=>{if(-1!==t.indexOf("://"))return{"@id":t};let n=null,a=null;for(let i=e.length-1;i>=0;i--){if(t in e[i]){let r,n=e[i][t];if(null==n||"boolean"==typeof n||Array.isArray(n))continue;if("string"==typeof n){if("@type"===n)return{"@id":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"};r=n,n={"@id":n}}else{if("object"!=typeof n||!("@id"in n)||"string"!=typeof n["@id"])continue;r=n["@id"]}const a=r.indexOf(":");if(a>-1){const t=r.substring(0,a),i=r.substring(a+1);if(i.startsWith("//"))return n;const o=s(t,e);return null!==o&&"@id"in o&&"string"==typeof o["@id"]&&(n["@id"]=`${o["@id"]}${i}`),n}}null===n&&e[i]["@vocab"]&&(n=e[i]["@vocab"]),null===a&&e[i]["@base"]&&(a=e[i]["@base"])}if(-1===t.indexOf(":")){if(i&&n)return{"@id":`${n}${t}`};if(r&&a)return{"@id":`${a}${t}`}}return null},n=t=>{const e=[],i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(t){const i=t;return i.classList.contains("object-property")||i.classList.contains("object-value")?NodeFilter.FILTER_REJECT:i.classList.contains("literal-value")?(e.push(i),NodeFilter.FILTER_REJECT):NodeFilter.FILTER_SKIP}});for(;i.nextNode(););return e},a=(t,e,i=!0)=>{if(t.setAttribute("data-uri",e),t.classList.add("resource-loading"),Ai(e,r).then(e=>{let i=t.querySelector(".resource-link")||t;e.label&&(t.setAttribute("data-label",e.label),r.replaceElements&&(i.textContent=e.label)),e.description&&(t.setAttribute("data-description",e.description),r.replaceElements&&(i.title=e.description)),t.classList.add("resource-resolved")}).catch(i=>{console.error(`Error resolving URI ${e}: ${i}`,{cause:i}),t.classList.add("resource-error")}).finally(()=>{t.classList.remove("resource-loading")}),i){const i=document.createElement("a");for(i.href=e,i.target="_blank",i.classList.add("resource-link");t.firstChild;)i.appendChild(t.firstChild);t.appendChild(i)}},o=(t,e)=>{var i;const h=(t=>{const e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(e){const i=e;return e!==t&&i.classList.contains("object-value")?NodeFilter.FILTER_REJECT:i.classList.contains("object-property")?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),i=[];let r;for(;r=e.nextNode();)i.push(r);return i})(t);for(const t of h){let h=null;h=t.getAttribute("data-property"),h||(h=t.textContent.trim());const u=s(h,e);let l=e;const c=null===(i=t.parentElement)||void 0===i?void 0:i.querySelector(".object-value");if(u&&"@id"in u&&"string"==typeof u["@id"]){const i=u["@id"];if(a(t,i,r.replaceElements),"@context"in u&&(l=[...e,u["@context"]]),"@id"===u["@type"]&&c){n(c).forEach(t=>{const e=s(t.textContent.trim(),l,!1,!0);if(e&&"@id"in e&&"string"==typeof e["@id"]){const i=e["@id"];a(t,i,r.replaceElements)}})}}c&&o(c,l)}};o(t,[e])}var Oi="undefined"!=typeof jsonld?jsonld:void 0,Fi=Object.freeze({__proto__:null,default:Oi});return t.createJsonLDGeoJSONLayer=function(t,i,r={}){const{ldContext:s,popupOptions:n={maxWidth:400},augmentOptions:a={},onEachFeature:o,...h}=r;return t.geoJSON(i,{...h,onEachFeature(t,i){if(o&&o(t,i),null!=t.id&&i.bindTooltip(String(t.id),{permanent:!1}),!t.properties||0===Object.keys(t.properties).length)return;const r=document.createElement("div");!function(t,e,i={propertiesField:"properties"}){const r=(t,e,i=!1)=>{if(Array.isArray(e)){for(const i of e)r(t,i).classList.add("array-entry");return t}if(null==e||"object"!=typeof e){const i=document.createElement("span");return i.classList.add("literal-value"),i.textContent=""+e,t.appendChild(i),i}{const s=document.createElement("table");s.classList.add("object-table"),i&&(s.innerHTML="<thead><tr><th>Property</th><th>Value</th></tr></thead>");const n=document.createElement("tbody");return Object.entries(e).forEach(([t,e])=>{const i=document.createElement("tr"),s=document.createElement("td");s.classList.add("object-property"),s.setAttribute("data-property",t),s.textContent=t,i.appendChild(s);const a=document.createElement("td");a.classList.add("object-value"),r(a,e),i.appendChild(a),n.appendChild(i)}),s.appendChild(n),t.appendChild(s),s}},s=document.createElement("div");s.classList.add("object-properties"),e.appendChild(s),i.propertiesField?r(s,t[i.propertiesField],!0):r(s,t,!0)}(t,r),i.bindPopup(r,n),s&&e(s).then(t=>{Di(r,t,a)})}})},t}({});
|
|
25
|
+
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=e,t.isNCNameChar=function(t){return e(t)||45===t||46===t||t>=48&&t<=57||183===t||t>=768&&t<=879||t>=8255&&t<=8256}}(Oe)),Oe);var r=t.isS,s=t.isChar,n=t.isNameStartChar,a=t.isNameChar,o=t.S_LIST,h=t.NAME_RE,u=e.isChar,l=i.isNCNameStartChar,c=i.isNCNameChar,d=i.NC_NAME_RE;const f="http://www.w3.org/XML/1998/namespace",p="http://www.w3.org/2000/xmlns/",_={__proto__:null,xml:f,xmlns:p},g={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},b=-1,m=-2,y=13,x=33,v=10,w=60,T=61,I=62,E=63,R=93,N=t=>34===t||39===t,S=[34,39],j=[...S,91,I],C=[...S,w,R],P=[T,E,...o],k=[...o,I,38,w];function A(t,e,i){switch(e){case"xml":i!==f&&t.fail(`xml prefix must be bound to ${f}.`);break;case"xmlns":i!==p&&t.fail(`xmlns prefix must be bound to ${p}.`)}switch(i){case p:t.fail(""===e?`the default namespace may not be set to ${i}.`:`may not assign a prefix (even "xmlns") to the URI ${p}.`);break;case f:switch(e){case"xml":break;case"":t.fail(`the default namespace may not be set to ${i}.`);break;default:t.fail("may not assign the xml namespace to another prefix.")}}}const $=t=>d.test(t),D=t=>h.test(t);Se.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];const O={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"};return Se.SaxesParser=class{get closed(){return this._closed}constructor(t){this.opt=null!=t?t:{},this.fragmentOpt=!!this.opt.fragment;const e=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=!1!==this.opt.position,this.fileName=this.opt.fileName,e){this.nameStartCheck=l,this.nameCheck=c,this.isName=$,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},_);const t=this.opt.additionalNamespaces;null!=t&&(!function(t,e){for(const i of Object.keys(e))A(t,i,e[i])}(this,t),Object.assign(this.ns,t))}else this.nameStartCheck=n,this.nameCheck=a,this.isName=D,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 t;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:e}=this;this.state=e?y:0,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=e,this.xmlDeclPossible=!e,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:i}=this.opt;if(void 0===i){if(!0===this.opt.forceXMLVersion)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");i="1.0"}this.setXMLVersion(i),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(g),null===(t=this.readyHandler)||void 0===t||t.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(t,e){this[O[t]]=e}off(t){this[O[t]]=void 0}makeError(t){var e;let i=null!==(e=this.fileName)&&void 0!==e?e:"";return this.trackPosition&&(i.length>0&&(i+=":"),i+=`${this.line}:${this.column}`),i.length>0&&(i+=": "),new Error(i+t)}fail(t){const e=this.makeError(t),i=this.errorHandler;if(void 0===i)throw e;return i(e),this}write(t){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let e=!1;null===t?(e=!0,t=""):"object"==typeof t&&(t=t.toString()),void 0!==this.carriedFromPrevious&&(t=`${this.carriedFromPrevious}${t}`,this.carriedFromPrevious=void 0);let i=t.length;const r=t.charCodeAt(i-1);!e&&(13===r||r>=55296&&r<=56319)&&(this.carriedFromPrevious=t[i-1],i--,t=t.slice(0,i));const{stateTable:s}=this;for(this.chunk=t,this.i=0;this.i<i;)s[this.state].call(this);return this.chunkPosition+=i,e?this.end():this}close(){return this.write(null)}getCode10(){const{chunk:t,i:e}=this;if(this.prevI=e,this.i=e+1,e>=t.length)return b;const i=t.charCodeAt(e);if(this.column++,i<55296){if(i>=32||9===i)return i;switch(i){case v:return this.line++,this.column=0,this.positionAtNewLine=this.position,v;case 13:return t.charCodeAt(e+1)===v&&(this.i=e+2),this.line++,this.column=0,this.positionAtNewLine=this.position,m;default:return this.fail("disallowed character."),i}}if(i>56319)return i>=57344&&i<=65533||this.fail("disallowed character."),i;const r=65536+1024*(i-55296)+(t.charCodeAt(e+1)-56320);return this.i=e+2,r>1114111&&this.fail("disallowed character."),r}getCode11(){const{chunk:t,i:e}=this;if(this.prevI=e,this.i=e+1,e>=t.length)return b;const i=t.charCodeAt(e);if(this.column++,i<55296){if(i>31&&i<127||i>159&&8232!==i||9===i)return i;switch(i){case v:return this.line++,this.column=0,this.positionAtNewLine=this.position,v;case 13:{const i=t.charCodeAt(e+1);i!==v&&133!==i||(this.i=e+2)}case 133:case 8232:return this.line++,this.column=0,this.positionAtNewLine=this.position,m;default:return this.fail("disallowed character."),i}}if(i>56319)return i>=57344&&i<=65533||this.fail("disallowed character."),i;const r=65536+1024*(i-55296)+(t.charCodeAt(e+1)-56320);return this.i=e+2,r>1114111&&this.fail("disallowed character."),r}getCodeNorm(){const t=this.getCode();return t===m?v:t}unget(){this.i=this.prevI,this.column--}captureTo(t){let{i:e}=this;const{chunk:i}=this;for(;;){const r=this.getCode(),s=r===m,n=s?v:r;if(n===b||t.includes(n))return this.text+=i.slice(e,this.prevI),n;s&&(this.text+=`${i.slice(e,this.prevI)}\n`,e=this.i)}}captureToChar(t){let{i:e}=this;const{chunk:i}=this;for(;;){let r=this.getCode();switch(r){case m:this.text+=`${i.slice(e,this.prevI)}\n`,e=this.i,r=v;break;case b:return this.text+=i.slice(e),!1}if(r===t)return this.text+=i.slice(e,this.prevI),!0}}captureNameChars(){const{chunk:t,i:e}=this;for(;;){const i=this.getCode();if(i===b)return this.name+=t.slice(e),b;if(!a(i))return this.name+=t.slice(e,this.prevI),i===m?v:i}}skipSpaces(){for(;;){const t=this.getCodeNorm();if(t===b||!r(t))return t}}setXMLVersion(t){this.currentXMLVersion=t,"1.0"===t?(this.isChar=s,this.getCode=this.getCode10):(this.isChar=u,this.getCode=this.getCode11)}sBegin(){65279===this.chunk.charCodeAt(0)&&(this.i++,this.column++),this.state=1}sBeginWhitespace(){const t=this.i,e=this.skipSpaces();switch(this.prevI!==t&&(this.xmlDeclPossible=!1),e){case w:if(this.state=15,0!==this.text.length)throw new Error("no-empty text at start");break;case b:break;default:this.unget(),this.state=y,this.xmlDeclPossible=!1}}sDoctype(){var t;const e=this.captureTo(j);switch(e){case I:null===(t=this.doctypeHandler)||void 0===t||t.call(this,this.text),this.text="",this.state=y,this.doctype=!0;break;case b:break;default:this.text+=String.fromCodePoint(e),91===e?this.state=4:N(e)&&(this.state=3,this.q=e)}}sDoctypeQuote(){const t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.q=null,this.state=2)}sDTD(){const t=this.captureTo(C);t!==b&&(this.text+=String.fromCodePoint(t),t===R?this.state=2:t===w?this.state=6:N(t)&&(this.state=5,this.q=t))}sDTDQuoted(){const t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.state=4,this.q=null)}sDTDOpenWaka(){const t=this.getCodeNorm();switch(this.text+=String.fromCodePoint(t),t){case 33:this.state=7,this.openWakaBang="";break;case E:this.state=11;break;default:this.state=4}}sDTDOpenWakaBang(){const t=String.fromCodePoint(this.getCodeNorm()),e=this.openWakaBang+=t;this.text+=t,"-"!==e&&(this.state="--"===e?8:4,this.openWakaBang="")}sDTDComment(){this.captureToChar(45)&&(this.text+="-",this.state=9)}sDTDCommentEnding(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),this.state=45===t?10:8}sDTDCommentEnded(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===I?this.state=4:(this.fail("malformed comment."),this.state=8)}sDTDPI(){this.captureToChar(E)&&(this.text+="?",this.state=12)}sDTDPIEnding(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===I&&(this.state=4)}sText(){0!==this.tags.length?this.handleTextInRoot():this.handleTextOutsideRoot()}sEntity(){let{i:t}=this;const{chunk:e}=this;t:for(;;)switch(this.getCode()){case m:this.entity+=`${e.slice(t,this.prevI)}\n`,t=this.i;break;case 59:{const{entityReturnState:i}=this,r=this.entity+e.slice(t,this.prevI);let s;this.state=i,""===r?(this.fail("empty entity name."),s="&;"):(s=this.parseEntity(r),this.entity=""),i===y&&void 0===this.textHandler||(this.text+=s);break t}case b:this.entity+=e.slice(t);break t}}sOpenWaka(){const t=this.getCode();if(n(t))this.state=34,this.unget(),this.xmlDeclPossible=!1;else switch(t){case 47:this.state=43,this.xmlDeclPossible=!1;break;case 33:this.state=16,this.openWakaBang="",this.xmlDeclPossible=!1;break;case E:this.state=23;break;default:this.fail("disallowed character in tag name"),this.state=y,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 t;const e=this.getCodeNorm();45===e?(this.state=19,null===(t=this.commentHandler)||void 0===t||t.call(this,this.text),this.text=""):(this.text+=`-${String.fromCodePoint(e)}`,this.state=17)}sCommentEnded(){const t=this.getCodeNorm();t!==I?(this.fail("malformed comment."),this.text+=`--${String.fromCodePoint(t)}`,this.state=17):this.state=y}sCData(){this.captureToChar(R)&&(this.state=21)}sCDataEnding(){const t=this.getCodeNorm();t===R?this.state=22:(this.text+=`]${String.fromCodePoint(t)}`,this.state=20)}sCDataEnding2(){var t;const e=this.getCodeNorm();switch(e){case I:null===(t=this.cdataHandler)||void 0===t||t.call(this,this.text),this.text="",this.state=y;break;case R:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(e)}`,this.state=20}}sPIFirstChar(){const t=this.getCodeNorm();this.nameStartCheck(t)?(this.piTarget+=String.fromCodePoint(t),this.state=24):t===E||r(t)?(this.fail("processing instruction without a target."),this.state=t===E?26:25):(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(t),this.state=24)}sPIRest(){const{chunk:t,i:e}=this;for(;;){const i=this.getCodeNorm();if(i===b)return void(this.piTarget+=t.slice(e));if(!this.nameCheck(i)){this.piTarget+=t.slice(e,this.prevI);const s=i===E;s||r(i)?"xml"===this.piTarget?(this.xmlDeclPossible||this.fail("an XML declaration must be at the start of the document."),this.state=s?x:27):this.state=s?26:25:(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(i));break}}}sPIBody(){if(0===this.text.length){const t=this.getCodeNorm();t===E?this.state=26:r(t)||(this.text=String.fromCodePoint(t))}else this.captureToChar(E)&&(this.state=26)}sPIEnding(){var t;const e=this.getCodeNorm();if(e===I){const{piTarget:e}=this;"xml"===e.toLowerCase()&&this.fail("the XML declaration must appear at the start of the document."),null===(t=this.piHandler)||void 0===t||t.call(this,{target:e,body:this.text}),this.piTarget=this.text="",this.state=y}else e===E?this.text+="?":(this.text+=`?${String.fromCodePoint(e)}`,this.state=25);this.xmlDeclPossible=!1}sXMLDeclNameStart(){const t=this.skipSpaces();t!==E?t!==b&&(this.state=28,this.name=String.fromCodePoint(t)):this.state=x}sXMLDeclName(){const t=this.captureTo(P);if(t===E)return this.state=x,this.name+=this.text,this.text="",void this.fail("XML declaration is incomplete.");if(r(t)||t===T){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=t===T?30:29}}sXMLDeclEq(){const t=this.getCodeNorm();if(t===E)return this.state=x,void this.fail("XML declaration is incomplete.");r(t)||(t!==T&&this.fail("value required."),this.state=30)}sXMLDeclValueStart(){const t=this.getCodeNorm();if(t===E)return this.state=x,void this.fail("XML declaration is incomplete.");r(t)||(N(t)?this.q=t:(this.fail("value must be quoted."),this.q=32),this.state=31)}sXMLDeclValue(){const t=this.captureTo([this.q,E]);if(t===E)return this.state=x,this.text="",void this.fail("XML declaration is incomplete.");if(t===b)return;const e=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];const t=e;this.xmlDecl.version=t,/^1\.[0-9]+$/.test(t)?this.opt.forceXMLVersion||this.setXMLVersion(t):this.fail("version number must match /^1\\.[0-9]+$/.");break}case"encoding":/^[A-Za-z][A-Za-z0-9._-]*$/.test(e)||this.fail("encoding value must match \t/^[A-Za-z0-9][A-Za-z0-9._-]*$/."),this.xmlDeclExpects=["standalone"],this.xmlDecl.encoding=e;break;case"standalone":"yes"!==e&&"no"!==e&&this.fail('standalone value must match "yes" or "no".'),this.xmlDeclExpects=[],this.xmlDecl.standalone=e}this.name="",this.state=32}sXMLDeclSeparator(){const t=this.getCodeNorm();t!==E?(r(t)||(this.fail("whitespace required."),this.unget()),this.state=27):this.state=x}sXMLDeclEnding(){var t;this.getCodeNorm()===I?("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===(t=this.xmldeclHandler)||void 0===t||t.call(this,this.xmlDecl),this.name="",this.piTarget=this.text="",this.state=y):this.fail("The character ? is disallowed anywhere in XML declarations."),this.xmlDeclPossible=!1}sOpenTag(){var t;const e=this.captureNameChars();if(e===b)return;const i=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name="",this.xmlnsOpt&&(this.topNS=i.ns=Object.create(null)),null===(t=this.openTagStartHandler)||void 0===t||t.call(this,i),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail("documents may contain only one root."),e){case I:this.openTag();break;case 47:this.state=35;break;default:r(e)||this.fail("disallowed character in tag name."),this.state=36}}sOpenTagSlash(){this.getCode()===I?this.openSelfClosingTag():(this.fail("forward-slash in opening tag not followed by >."),this.state=36)}sAttrib(){const t=this.skipSpaces();t!==b&&(n(t)?(this.unget(),this.state=37):t===I?this.openTag():47===t?this.state=35:this.fail("disallowed character in attribute name."))}sAttribName(){const t=this.captureNameChars();t===T?this.state=39:r(t)?this.state=38:t===I?(this.fail("attribute without value."),this.pushAttrib(this.name,this.name),this.name=this.text="",this.openTag()):t!==b&&this.fail("disallowed character in attribute name.")}sAttribNameSawWhite(){const t=this.skipSpaces();switch(t){case b:return;case T:this.state=39;break;default:this.fail("attribute without value."),this.text="",this.name="",t===I?this.openTag():n(t)?(this.unget(),this.state=37):(this.fail("disallowed character in attribute name."),this.state=36)}}sAttribValue(){const t=this.getCodeNorm();N(t)?(this.q=t,this.state=40):r(t)||(this.fail("unquoted attribute value."),this.state=42,this.unget())}sAttribValueQuoted(){const{q:t,chunk:e}=this;let{i:i}=this;for(;;)switch(this.getCode()){case t:return this.pushAttrib(this.name,this.text+e.slice(i,this.prevI)),this.name=this.text="",this.q=null,void(this.state=41);case 38:return this.text+=e.slice(i,this.prevI),this.state=14,void(this.entityReturnState=40);case v:case m:case 9:this.text+=`${e.slice(i,this.prevI)} `,i=this.i;break;case w:return this.text+=e.slice(i,this.prevI),void this.fail("disallowed character.");case b:return void(this.text+=e.slice(i))}}sAttribValueClosed(){const t=this.getCodeNorm();r(t)?this.state=36:t===I?this.openTag():47===t?this.state=35:n(t)?(this.fail("no whitespace between attributes."),this.unget(),this.state=37):this.fail("disallowed character in attribute name.")}sAttribValueUnquoted(){const t=this.captureTo(k);switch(t){case 38:this.state=14,this.entityReturnState=42;break;case w:this.fail("disallowed character.");break;case b:break;default:this.text.includes("]]>")&&this.fail('the string "]]>" is disallowed in char data.'),this.pushAttrib(this.name,this.text),this.name=this.text="",t===I?this.openTag():this.state=36}}sCloseTag(){const t=this.captureNameChars();t===I?this.closeTag():r(t)?this.state=44:t!==b&&this.fail("disallowed character in closing tag.")}sCloseTagSawWhite(){switch(this.skipSpaces()){case I:this.closeTag();break;case b:break;default:this.fail("disallowed character in closing tag.")}}handleTextInRoot(){let{i:t,forbiddenState:e}=this;const{chunk:i,textHandler:r}=this;t:for(;;)switch(this.getCode()){case w:if(this.state=15,void 0!==r){const{text:e}=this,s=i.slice(t,this.prevI);0!==e.length?(r(e+s),this.text=""):0!==s.length&&r(s)}e=0;break t;case 38:this.state=14,this.entityReturnState=y,void 0!==r&&(this.text+=i.slice(t,this.prevI)),e=0;break t;case R:switch(e){case 0:e=1;break;case 1:e=2;break;case 2:break;default:throw new Error("impossible state")}break;case I:2===e&&this.fail('the string "]]>" is disallowed in char data.'),e=0;break;case m:void 0!==r&&(this.text+=`${i.slice(t,this.prevI)}\n`),t=this.i,e=0;break;case b:void 0!==r&&(this.text+=i.slice(t));break t;default:e=0}this.forbiddenState=e}handleTextOutsideRoot(){let{i:t}=this;const{chunk:e,textHandler:i}=this;let s=!1;t:for(;;){const n=this.getCode();switch(n){case w:if(this.state=15,void 0!==i){const{text:r}=this,s=e.slice(t,this.prevI);0!==r.length?(i(r+s),this.text=""):0!==s.length&&i(s)}break t;case 38:this.state=14,this.entityReturnState=y,void 0!==i&&(this.text+=e.slice(t,this.prevI)),s=!0;break t;case m:void 0!==i&&(this.text+=`${e.slice(t,this.prevI)}\n`),t=this.i;break;case b:void 0!==i&&(this.text+=e.slice(t));break t;default:r(n)||(s=!0)}}s&&(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(t,e){var i;const{prefix:r,local:s}=this.qname(t),n={name:t,prefix:r,local:s,value:e};if(this.attribList.push(n),null===(i=this.attributeHandler)||void 0===i||i.call(this,n),"xmlns"===r){const t=e.trim();"1.0"===this.currentXMLVersion&&""===t&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[s]=t,A(this,s,t)}else if("xmlns"===t){const t=e.trim();this.topNS[""]=t,A(this,"",t)}}pushAttribPlain(t,e){var i;const r={name:t,value:e};this.attribList.push(r),null===(i=this.attributeHandler)||void 0===i||i.call(this,r)}end(){var t,e;this.sawRoot||this.fail("document must contain a root element.");const{tags:i}=this;for(;i.length>0;){const t=i.pop();this.fail(`unclosed tag: ${t.name}`)}0!==this.state&&this.state!==y&&this.fail("unexpected end.");const{text:r}=this;return 0!==r.length&&(null===(t=this.textHandler)||void 0===t||t.call(this,r),this.text=""),this._closed=!0,null===(e=this.endHandler)||void 0===e||e.call(this),this._init(),this}resolve(t){var e,i;let r=this.topNS[t];if(void 0!==r)return r;const{tags:s}=this;for(let e=s.length-1;e>=0;e--)if(r=s[e].ns[t],void 0!==r)return r;return r=this.ns[t],void 0!==r?r:null===(i=(e=this.opt).resolvePrefix)||void 0===i?void 0:i.call(e,t)}qname(t){const e=t.indexOf(":");if(-1===e)return{prefix:"",local:t};const i=t.slice(e+1),r=t.slice(0,e);return(""===r||""===i||i.includes(":"))&&this.fail(`malformed name: ${t}.`),{prefix:r,local:i}}processAttribsNS(){var t;const{attribList:e}=this,i=this.tag;{const{prefix:e,local:r}=this.qname(i.name);i.prefix=e,i.local=r;const s=i.uri=null!==(t=this.resolve(e))&&void 0!==t?t:"";""!==e&&("xmlns"===e&&this.fail('tags may not have "xmlns" as prefix.'),""===s&&(this.fail(`unbound namespace prefix: ${JSON.stringify(e)}.`),i.uri=e))}if(0===e.length)return;const{attributes:r}=i,s=new Set;for(const t of e){const{name:e,prefix:i,local:n}=t;let a,o;""===i?(a="xmlns"===e?p:"",o=e):(a=this.resolve(i),void 0===a&&(this.fail(`unbound namespace prefix: ${JSON.stringify(i)}.`),a=i),o=`{${a}}${n}`),s.has(o)&&this.fail(`duplicate attribute: ${o}.`),s.add(o),t.uri=a,r[e]=t}this.attribList=[]}processAttribsPlain(){const{attribList:t}=this,e=this.tag.attributes;for(const{name:i,value:r}of t)void 0!==e[i]&&this.fail(`duplicate attribute: ${i}.`),e[i]=r;this.attribList=[]}openTag(){var t;this.processAttribs();const{tags:e}=this,i=this.tag;i.isSelfClosing=!1,null===(t=this.openTagHandler)||void 0===t||t.call(this,i),e.push(i),this.state=y,this.name=""}openSelfClosingTag(){var t,e,i;this.processAttribs();const{tags:r}=this,s=this.tag;s.isSelfClosing=!0,null===(t=this.openTagHandler)||void 0===t||t.call(this,s),null===(e=this.closeTagHandler)||void 0===e||e.call(this,s);null===(this.tag=null!==(i=r[r.length-1])&&void 0!==i?i:null)&&(this.closedRoot=!0),this.state=y,this.name=""}closeTag(){const{tags:t,name:e}=this;if(this.state=y,this.name="",""===e)return this.fail("weird empty close tag."),void(this.text+="</>");const i=this.closeTagHandler;let r=t.length;for(;r-- >0;){const r=this.tag=t.pop();if(this.topNS=r.ns,null==i||i(r),r.name===e)break;this.fail("unexpected close tag.")}0===r?this.closedRoot=!0:r<0&&(this.fail(`unmatched closing tag: ${e}.`),this.text+=`</${e}>`)}parseEntity(t){if("#"!==t[0]){const e=this.ENTITIES[t];return void 0!==e?e:(this.fail(this.isName(t)?"undefined entity.":"disallowed character in entity name."),`&${t};`)}let e=NaN;return"x"===t[1]&&/^#x[0-9a-f]+$/i.test(t)?e=parseInt(t.slice(2),16):/^#[0-9]+$/.test(t)&&(e=parseInt(t.slice(1),10)),this.isChar(e)?String.fromCodePoint(e):(this.fail("malformed character entity."),`&${t};`)}},Se}var Le,Me=ye(le),Be={};function qe(){if(Le)return Be;Le=1,Object.defineProperty(Be,"__esModule",{value:!0}),Be.ParseError=void 0;let t=class extends Error{constructor(t,e){const i=t.saxParser;super(t.trackPosition?`Line ${i.line} column ${i.column+1}: ${e}`:e)}};return Be.ParseError=t,Be}var Ue,Ge={},He={};function Qe(){if(Ue)return He;Ue=1,Object.defineProperty(He,"__esModule",{value:!0}),He.BlankNode=void 0;return He.BlankNode=class{constructor(t){this.termType="BlankNode",this.value=t}equals(t){return!!t&&"BlankNode"===t.termType&&t.value===this.value}},He}var ze,Ye={},Ve={};function Xe(){if(ze)return Ve;ze=1,Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.DefaultGraph=void 0;let t=class{constructor(){this.termType="DefaultGraph",this.value=""}equals(t){return!!t&&"DefaultGraph"===t.termType}};return Ve.DefaultGraph=t,t.INSTANCE=new t,Ve}var We,Ze,Je={},Ke={};function ti(){if(We)return Ke;We=1,Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.NamedNode=void 0;return Ke.NamedNode=class{constructor(t){this.termType="NamedNode",this.value=t}equals(t){return!!t&&"NamedNode"===t.termType&&t.value===this.value}},Ke}function ei(){if(Ze)return Je;Ze=1,Object.defineProperty(Je,"__esModule",{value:!0}),Je.Literal=void 0;const t=ti();let e=class t{constructor(e,i){this.termType="Literal",this.value=e,"string"==typeof i?(this.language=i,this.datatype=t.RDF_LANGUAGE_STRING):i?(this.language="",this.datatype=i):(this.language="",this.datatype=t.XSD_STRING)}equals(t){return!!t&&"Literal"===t.termType&&t.value===this.value&&t.language===this.language&&this.datatype.equals(t.datatype)}};return Je.Literal=e,e.RDF_LANGUAGE_STRING=new t.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),e.XSD_STRING=new t.NamedNode("http://www.w3.org/2001/XMLSchema#string"),Je}var ii,ri={};function si(){if(ii)return ri;ii=1,Object.defineProperty(ri,"__esModule",{value:!0}),ri.Quad=void 0;return ri.Quad=class{constructor(t,e,i,r){this.termType="Quad",this.value="",this.subject=t,this.predicate=e,this.object=i,this.graph=r}equals(t){return!!t&&("Quad"===t.termType||!t.termType)&&this.subject.equals(t.subject)&&this.predicate.equals(t.predicate)&&this.object.equals(t.object)&&this.graph.equals(t.graph)}},ri}var ni,ai,oi,hi={};function ui(){if(ni)return hi;ni=1,Object.defineProperty(hi,"__esModule",{value:!0}),hi.Variable=void 0;return hi.Variable=class{constructor(t){this.termType="Variable",this.value=t}equals(t){return!!t&&"Variable"===t.termType&&t.value===this.value}},hi}function li(){return oi||(oi=1,t=Ge,e=Ge&&Ge.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=Ge&&Ge.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i(Qe(),t),i(function(){if(ai)return Ye;ai=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.DataFactory=void 0;const t=Qe(),e=Xe(),i=ei(),r=ti(),s=si(),n=ui();let a=0;return Ye.DataFactory=class{constructor(t){this.blankNodeCounter=0,t=t||{},this.blankNodePrefix=t.blankNodePrefix||`df_${a++}_`}namedNode(t){return new r.NamedNode(t)}blankNode(e){return new t.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(t,e){return new i.Literal(t,e)}variable(t){return new n.Variable(t)}defaultGraph(){return e.DefaultGraph.INSTANCE}quad(t,e,i,r){return new s.Quad(t,e,i,r||this.defaultGraph())}fromTerm(t){switch(t.termType){case"NamedNode":return this.namedNode(t.value);case"BlankNode":return this.blankNode(t.value);case"Literal":return t.language?this.literal(t.value,t.language):t.datatype.equals(i.Literal.XSD_STRING)?this.literal(t.value):this.literal(t.value,this.fromTerm(t.datatype));case"Variable":return this.variable(t.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(t.subject),this.fromTerm(t.predicate),this.fromTerm(t.object),this.fromTerm(t.graph))}}fromQuad(t){return this.fromTerm(t)}resetBlankNodeCounter(){this.blankNodeCounter=0}},Ye}(),t),i(Xe(),t),i(ei(),t),i(ti(),t),i(si(),t),i(ui(),t)),Ge;var t,e,i}var ci,di,fi,pi,_i={},gi={};function bi(){return di||(di=1,t=_i,e=_i&&_i.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=_i&&_i.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i((ci||(ci=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateIri=t.IriValidationStrategy=void 0;const e=function(){const t="[!$&'()*+,;=]",e="%[a-fA-F0-9]{2}",i="([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",r=`${i}\\.${i}\\.${i}\\.${i}`,s="[a-fA-F0-9]{1,4}",n=`(${s}:${s}|${r})`,a="[a-zA-Z0-9\\-._~ -豈-﷏ﷰ-𐀀-𠀀-𰀀------------]",o=`(${a}|${e}|${t}|[:@])*`,h=`(${o})+`,u=`(${o})*`;return new RegExp(`^[a-zA-Z][a-zA-Z0-9+\\-.]*:(\\/\\/((${a}|${e}|${t}|:)*@)?(\\[(((${s}:){6}${n}|::(${s}:){5}${n}|(${s})?::(${s}:){4}${n}|((${s}:){0,1}${s})?::(${s}:){3}${n}|((${s}:){0,2}${s})?::(${s}:){2}${n}|((${s}:){0,3}${s})?::${s}:${n}|((${s}:){0,4}${s})?::${n}|((${s}:){0,5}${s})?::${s}|((${s}:){0,6}${s})?::)|v[a-fA-F0-9]+\\.(${t}|${t}|":)+)\\]|${r}|(${a}|${e}|${t})*)(:[0-9]*)?(\\/${u})*|\\/(${h}(\\/${u})*)?|${h}(\\/${u})*|)(\\?(${o}|[---]|[\\/?])*)?(#(${o}|[\\/?])*)?$`,"u")}(),i=/^[A-Za-z][\d+-.A-Za-z]*:[^\u0000-\u0020"<>\\^`{|}]*$/u;var r;!function(t){t.Strict="strict",t.Pragmatic="pragmatic",t.None="none"}(r=t.IriValidationStrategy||(t.IriValidationStrategy={})),t.validateIri=function(t,s=r.Strict){switch(s){case r.Strict:return e.test(t)?void 0:new Error(`Invalid IRI according to RFC 3987: '${t}'`);case r.Pragmatic:return i.test(t)?void 0:new Error(`Invalid IRI according to RDF Turtle: '${t}'`);case r.None:return;default:return new Error(`Not supported validation strategy "${s}"`)}}}(gi)),gi),t)),_i;var t,e,i}function mi(){if(fi)return Te;fi=1,Object.defineProperty(Te,"__esModule",{value:!0}),Te.ParseType=Te.RdfXmlParser=void 0;const t=Re(),e=Fe(),i=Me,r=qe(),s=li(),n=bi();let a=class a extends i.Transform{constructor(t){super({readableObjectMode:!0}),this.activeTagStack=[],this.nodeIds={},t&&(Object.assign(this,t),this.options=t),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?n.IriValidationStrategy.Pragmatic:n.IriValidationStrategy.None),this.saxParser=new e.SaxesParser({xmlns:!0,position:this.trackPosition}),this.attachSaxListeners()}import(t){const e=new i.PassThrough({readableObjectMode:!0});t.on("error",t=>r.emit("error",t)),t.on("data",t=>e.push(t)),t.on("end",()=>e.push(null));const r=e.pipe(new a(this.options));return r}_transform(t,e,i){try{this.saxParser.write(t)}catch(t){return i(t)}i()}newParseError(t){return new r.ParseError(this,t)}valueToUri(e,i){return this.uriToNamedNode((0,t.resolve)(e,i.baseIRI))}uriToNamedNode(t){const e=(0,n.validateIri)(t,this.iriValidationStrategy);if(e instanceof Error)throw this.newParseError(e.message);return this.dataFactory.namedNode(t)}validateNcname(t){if(!a.NCNAME_MATCHER.test(t))throw this.newParseError(`Not a valid NCName: ${t}`)}attachSaxListeners(){this.saxParser.on("error",t=>this.emit("error",t)),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(t){const e=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;let i=o.RESOURCE;if(e&&(e.hadChildren=!0,i=e.childrenParseType),e&&e.childrenStringTags){const i=t.name;let r="";for(const e in t.attributes)r+=` ${e}="${t.attributes[e].value}"`;const s=`<${`${i}${r}`}>`;e.childrenStringTags.push(s);const n={childrenStringTags:e.childrenStringTags};return n.childrenStringEmitClosingTag=`</${i}>`,void this.activeTagStack.push(n)}const r={};e?(r.language=e.language,r.baseIRI=e.baseIRI):r.baseIRI=this.baseIRI,this.activeTagStack.push(r),i===o.RESOURCE?this.onTagResource(t,r,e,!e):this.onTagProperty(t,r,e)}onTagResource(e,i,r,s){i.childrenParseType=o.PROPERTY;let n=!0;if(e.uri===a.RDF){if(!s&&a.FORBIDDEN_NODE_ELEMENTS.indexOf(e.local)>=0)throw this.newParseError(`Illegal node element name: ${e.local}`);switch(e.local){case"RDF":i.childrenParseType=o.RESOURCE;case"Description":n=!1}}const h=[],u=[];let l=null,c=!1,d=!1,f=null;for(const s in e.attributes){const n=e.attributes[s];if(r&&n.uri===a.RDF)switch(n.local){case"about":if(l)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${n.value} and ${l} where found.`);l=n.value;continue;case"ID":if(l)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${n.value} and ${l} where found.`);this.validateNcname(n.value),l="#"+n.value,c=!0;continue;case"nodeID":if(l)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${n.value} and ${l} where found.`);this.validateNcname(n.value),l=n.value,d=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"type":f=n.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(n.uri===a.XML){if("lang"===n.local){i.language=""===n.value?null:n.value.toLowerCase();continue}if("base"===n.local){i.baseIRI=(0,t.resolve)(n.value,i.baseIRI);continue}}"xml"===n.prefix||"xmlns"===n.prefix||""===n.prefix&&"xmlns"===n.local||!n.uri||(h.push(this.uriToNamedNode(n.uri+n.local)),u.push(n.value))}if(null!==l&&(i.subject=d?this.dataFactory.blankNode(l):this.valueToUri(l,i),c&&this.claimNodeId(i.subject)),i.subject||(i.subject=this.dataFactory.blankNode()),n){const t=this.uriToNamedNode(e.uri+e.local);this.emitTriple(i.subject,this.dataFactory.namedNode(a.RDF+"type"),t,r?r.reifiedStatementId:null)}if(r){if(r.predicate)if(r.childrenCollectionSubject){const t=this.dataFactory.blankNode();this.emitTriple(r.childrenCollectionSubject,r.childrenCollectionPredicate,t,r.reifiedStatementId),this.emitTriple(t,this.dataFactory.namedNode(a.RDF+"first"),i.subject,i.reifiedStatementId),r.childrenCollectionSubject=t,r.childrenCollectionPredicate=this.dataFactory.namedNode(a.RDF+"rest")}else{this.emitTriple(r.subject,r.predicate,i.subject,r.reifiedStatementId);for(let t=0;t<r.predicateSubPredicates.length;t++)this.emitTriple(i.subject,r.predicateSubPredicates[t],r.predicateSubObjects[t],null);r.predicateSubPredicates=[],r.predicateSubObjects=[],r.predicateEmitted=!0}for(let t=0;t<h.length;t++){const e=this.dataFactory.literal(u[t],i.datatype||i.language);this.emitTriple(i.subject,h[t],e,r.reifiedStatementId)}f&&this.emitTriple(i.subject,this.dataFactory.namedNode(a.RDF+"type"),this.uriToNamedNode(f),null)}}onTagProperty(t,e,i){if(e.childrenParseType=o.RESOURCE,e.subject=i.subject,t.uri===a.RDF&&"li"===t.local?(i.listItemCounter||(i.listItemCounter=1),e.predicate=this.uriToNamedNode(t.uri+"_"+i.listItemCounter++)):e.predicate=this.uriToNamedNode(t.uri+t.local),t.uri===a.RDF&&a.FORBIDDEN_PROPERTY_ELEMENTS.indexOf(t.local)>=0)throw this.newParseError(`Illegal property element name: ${t.local}`);e.predicateSubPredicates=[],e.predicateSubObjects=[];let r=!1,s=!1,n=null,h=!0;const u=[],l=[];for(const i in t.attributes){const c=t.attributes[i];if(c.uri===a.RDF)switch(c.local){case"resource":if(n)throw this.newParseError(`Found both rdf:resource (${c.value}) and rdf:nodeID (${n}).`);if(r)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${c.value})`);e.hadChildren=!0,n=c.value,h=!1;continue;case"datatype":if(s)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${c.value}).`);if(r)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${c.value})`);e.datatype=this.valueToUri(c.value,e);continue;case"nodeID":if(s)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${c.value}).`);if(e.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${c.value}).`);if(r)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${c.value})`);this.validateNcname(c.value),e.hadChildren=!0,n=c.value,h=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"parseType":if(s)throw this.newParseError("rdf:parseType is not allowed when non-rdf:* property attributes are present");if(e.datatype)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${e.datatype.value})`);if(n)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID or rdf:resource (${n})`);if("Resource"===c.value){r=!0,e.childrenParseType=o.PROPERTY;const t=this.dataFactory.blankNode();this.emitTriple(e.subject,e.predicate,t,e.reifiedStatementId),e.subject=t,e.predicate=null}else"Collection"===c.value?(r=!0,e.hadChildren=!0,e.childrenCollectionSubject=e.subject,e.childrenCollectionPredicate=e.predicate,h=!1):"Literal"===c.value&&(r=!0,e.childrenTagsToString=!0,e.childrenStringTags=[]);continue;case"ID":this.validateNcname(c.value),e.reifiedStatementId=this.valueToUri("#"+c.value,e),this.claimNodeId(e.reifiedStatementId);continue}else if(c.uri===a.XML&&"lang"===c.local){e.language=""===c.value?null:c.value.toLowerCase();continue}if("xml"!==c.prefix&&"xmlns"!==c.prefix&&(""!==c.prefix||"xmlns"!==c.local)&&c.uri){if(r||e.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${c.value}`);e.hadChildren=!0,s=!0,u.push(this.uriToNamedNode(c.uri+c.local)),l.push(this.dataFactory.literal(c.value,e.datatype||e.language))}}if(null!==n){const t=e.subject;e.subject=h?this.dataFactory.blankNode(n):this.valueToUri(n,e),this.emitTriple(t,e.predicate,e.subject,e.reifiedStatementId);for(let t=0;t<u.length;t++)this.emitTriple(e.subject,u[t],l[t],null);e.predicateEmitted=!0}else h&&(e.predicateSubPredicates=u,e.predicateSubObjects=l,e.predicateEmitted=!1)}emitTriple(t,e,i,r){this.push(this.dataFactory.quad(t,e,i,this.defaultGraph)),r&&(this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"type"),this.dataFactory.namedNode(a.RDF+"Statement"),this.defaultGraph)),this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"subject"),t,this.defaultGraph)),this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"predicate"),e,this.defaultGraph)),this.push(this.dataFactory.quad(r,this.dataFactory.namedNode(a.RDF+"object"),i,this.defaultGraph)))}claimNodeId(t){if(!this.allowDuplicateRdfIds){if(this.nodeIds[t.value])throw this.newParseError(`Found multiple occurrences of rdf:ID='${t.value}'.`);this.nodeIds[t.value]=!0}}onText(t){const e=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;e&&(e.childrenStringTags?e.childrenStringTags.push(t):e.predicate&&(e.text=t))}onCloseTag(){const t=this.activeTagStack.pop();if(t.childrenStringEmitClosingTag&&t.childrenStringTags.push(t.childrenStringEmitClosingTag),t.childrenTagsToString&&(t.datatype=this.dataFactory.namedNode(a.RDF+"XMLLiteral"),t.text=t.childrenStringTags.join(""),t.hadChildren=!1),t.childrenCollectionSubject)this.emitTriple(t.childrenCollectionSubject,t.childrenCollectionPredicate,this.dataFactory.namedNode(a.RDF+"nil"),t.reifiedStatementId);else if(t.predicate)if(t.hadChildren||t.childrenParseType===o.PROPERTY){if(!t.predicateEmitted){const e=this.dataFactory.blankNode();this.emitTriple(t.subject,t.predicate,e,t.reifiedStatementId);for(let i=0;i<t.predicateSubPredicates.length;i++)this.emitTriple(e,t.predicateSubPredicates[i],t.predicateSubObjects[i],null)}}else this.emitTriple(t.subject,t.predicate,this.dataFactory.literal(t.text||"",t.datatype||t.language),t.reifiedStatementId)}onDoctype(t){t.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(t,e,i)=>(this.saxParser.ENTITIES[e]=i,""))}};var o;return Te.RdfXmlParser=a,a.MIME_TYPE="application/rdf+xml",a.RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#",a.XML="http://www.w3.org/XML/1998/namespace",a.FORBIDDEN_NODE_ELEMENTS=["RDF","ID","about","bagID","parseType","resource","nodeID","li","aboutEach","aboutEachPrefix"],a.FORBIDDEN_PROPERTY_ELEMENTS=["Description","RDF","ID","about","bagID","parseType","resource","nodeID","aboutEach","aboutEachPrefix"],a.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(t){t[t.RESOURCE=0]="RESOURCE",t[t.PROPERTY=1]="PROPERTY"}(o||(Te.ParseType=o={})),Te}function yi(){return pi||(pi=1,t=we,e=we&&we.__createBinding||(Object.create?function(t,e,i,r){void 0===r&&(r=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&!("get"in s?!e.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,r,s)}:function(t,e,i,r){void 0===r&&(r=i),t[r]=e[i]}),i=we&&we.__exportStar||function(t,i){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(i,r)||e(i,t,r)},Object.defineProperty(t,"__esModule",{value:!0}),i(mi(),t)),we;var t,e,i}var xi=yi();const vi={labelPredicates:u,descriptionPredicates:l},wi={},Ti={},Ii=new Set(["text/turtle","text/n3","application/n-triples","application/n-quads","application/trig","text/anot+turtle"]),Ei=["text/turtle","application/n-triples","application/n-quads","application/trig","application/ld+json","application/rdf+xml"].join(", ");function Ri(t,e,i,r=function(){var t;if("undefined"!=typeof navigator&&(null===(t=navigator.languages)||void 0===t?void 0:t.length))return Array.from(navigator.languages);try{return[Intl.DateTimeFormat().resolvedOptions().locale]}catch(t){return[]}}()){const s=Et.namedNode(e);for(const e of i){const i=t.getQuads(s,Et.namedNode(e),null,null).filter(t=>"Literal"===t.object.termType);if(!i.length)continue;for(const t of r){const e=t.split("-")[0].toLowerCase(),r=i.find(i=>{var r;const s=null===(r=i.object.language)||void 0===r?void 0:r.toLowerCase();return s===t.toLowerCase()||(null==s?void 0:s.split("-")[0])===e});if(r)return r.object.value}const n=i.find(t=>!t.object.language);if(n)return n.object.value;const a=i.find(t=>{var e;return"en"===(null===(e=t.object.language)||void 0===e?void 0:e.toLowerCase())});return(null!=a?a:i[0]).object.value}return null}function Ni(t,e,i){const r=new ge,s=new Ut({baseIRI:e,format:"text/anot+turtle"===i?"text/turtle":i});return new Promise((e,i)=>{s.parse(t,(t,s)=>{if(t)return i(t);s?r.addQuad(s):e(r)})})}const Si=t=>t?Array.isArray(t)?t:[t]:[],ji=t=>`DESCRIBE <${t}>`,Ci=async(t,e)=>{var i;let r;try{if(r=await t(),!r.ok)return null}catch(t){return null}const s=(null===(i=r.headers.get("content-type"))||void 0===i?void 0:i.split(";")[0].trim())||"text/turtle",n=await r.text();try{if(Ii.has(s))return Ni(n,e,s);if("application/ld+json"===s)return async function(t,e){const i=await Promise.resolve().then(function(){return Yi});if(!i)throw new Error("jsonld peer dependency is not available");const r=JSON.parse(t);return Ni(await i.toRDF(r,{format:"application/n-quads",base:e}),e,"application/n-quads")}(n,e);if("application/rdf+xml"===s)return async function(t,e){const i=new ge;return new Promise((r,s)=>{const n=new xi.RdfXmlParser({baseIRI:e});n.on("data",t=>i.addQuad(t)),n.on("error",s),n.on("end",()=>r(i)),n.write(t),n.end()})}(n,e)}catch(t){}return null},Pi=(t,e)=>(t in Ti||(Ti[t]=Ci(e,t)),Ti[t]),ki=async(t,e,i)=>{const r=await t;if(!r)return null;const s=Ri(r,e,i.labelPredicates);return s?{uri:e,label:s,description:Ri(r,e,i.descriptionPredicates)}:null};async function Ai(t,e={}){const i={...vi,...e};return t in wi||(wi[t]=(async(t,e)=>{const i=t.includes("#")?t.split("#")[0]:t;let r=await ki(Pi(i,()=>fetch(i,{headers:{Accept:Ei}})),t,e);const s=t.includes("#");for(const i of[...Si(e.fallbackRainbowInstances),...Si(e.fallbackRainbowInstance)]){if(r||s)break;const n=new URL(i);n.searchParams.set("uri",t);const a=n.toString();r=await ki(Pi(a,()=>fetch(a,{headers:{Accept:Ei}})),t,e)}for(const i of[...Si(e.fallbackSparqlEndpoints),...Si(e.fallbackSparqlEndpoint)]){if(r)break;const s=new URLSearchParams({query:ji(t)});r=await ki(Ci(()=>fetch(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"text/turtle, application/n-triples"},body:s.toString()}),t),t,e)}if(!r)throw new Error(`No label data found for <${t}>`);return r})(t,i)),wi[t]}const $i={replaceElements:!0,...vi};async function Di(t,e,i={}){const r={...$i,...i},s=(t,e,i=!0,r=!1)=>{if(-1!==t.indexOf("://"))return{"@id":t};let n=null,a=null;for(let i=e.length-1;i>=0;i--){if(t in e[i]){let r,n=e[i][t];if(null==n||"boolean"==typeof n||Array.isArray(n))continue;if("string"==typeof n){if("@type"===n)return{"@id":"http://www.w3.org/1999/02/22-rdf-syntax-ns#type"};r=n,n={"@id":n}}else{if("object"!=typeof n||!("@id"in n)||"string"!=typeof n["@id"])continue;r=n["@id"]}const a=r.indexOf(":");if(a>-1){const t=r.substring(0,a),i=r.substring(a+1);if(i.startsWith("//"))return n;const o=s(t,e);return null!==o&&"@id"in o&&"string"==typeof o["@id"]&&(n["@id"]=`${o["@id"]}${i}`),n}}null===n&&e[i]["@vocab"]&&(n=e[i]["@vocab"]),null===a&&e[i]["@base"]&&(a=e[i]["@base"])}if(-1===t.indexOf(":")){if(i&&n)return{"@id":`${n}${t}`};if(r&&a)return{"@id":`${a}${t}`}}return null},n=t=>{const e=[],i=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(t){const i=t;return i.classList.contains("object-property")||i.classList.contains("object-value")?NodeFilter.FILTER_REJECT:i.classList.contains("literal-value")?(e.push(i),NodeFilter.FILTER_REJECT):NodeFilter.FILTER_SKIP}});for(;i.nextNode(););return e},a=(t,e,i=!0)=>{if(t.setAttribute("data-uri",e),t.classList.add("resource-loading"),Ai(e,r).then(e=>{let i=t.querySelector(".resource-link")||t;e.label&&(t.setAttribute("data-label",e.label),r.replaceElements&&(i.textContent=e.label)),e.description&&(t.setAttribute("data-description",e.description),r.replaceElements&&(i.title=e.description)),t.classList.add("resource-resolved")}).catch(i=>{console.error(`Error resolving URI ${e}: ${i}`,{cause:i}),t.classList.add("resource-error")}).finally(()=>{t.classList.remove("resource-loading")}),i){const i=document.createElement("a");for(i.href=e,i.target="_blank",i.classList.add("resource-link");t.firstChild;)i.appendChild(t.firstChild);t.appendChild(i)}},o=(t,e)=>{var i;const h=(t=>{const e=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(e){const i=e;return e!==t&&i.classList.contains("object-value")?NodeFilter.FILTER_REJECT:i.classList.contains("object-property")?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),i=[];let r;for(;r=e.nextNode();)i.push(r);return i})(t);for(const t of h){let h=null;h=t.getAttribute("data-property"),h||(h=t.textContent.trim());const u=s(h,e);let l=e;const c=null===(i=t.parentElement)||void 0===i?void 0:i.querySelector(".object-value");if(u&&"@id"in u&&"string"==typeof u["@id"]){const i=u["@id"];if(a(t,i,r.replaceElements),"@context"in u&&(l=[...e,u["@context"]]),"@id"===u["@type"]&&c){n(c).forEach(t=>{const e=s(t.textContent.trim(),l,!1,!0);if(e&&"@id"in e&&"string"==typeof e["@id"]){const i=e["@id"];a(t,i,r.replaceElements)}})}}c&&o(c,l)}};o(t,[e])}const Oi=new Set([4326,4979]),Fi=new Map;function Li(t){let e=t.match(/\/crs\/EPSG\/[^/]+\/(\d+)$/i);return e?parseInt(e[1],10):(e=t.match(/urn:ogc:def:crs:EPSG::(\d+)$/i),e?parseInt(e[1],10):(e=t.match(/^EPSG:(\d+)$/),e?parseInt(e[1],10):null))}function Mi(t){const e=Li(t);return null!==e?Oi.has(e):/\/OGC\/[^/]+\/CRS84h?$/i.test(t)||/urn:ogc:def:crs:OGC:[^:]*:CRS84h?$/i.test(t)}function Bi(t){if("string"==typeof t){if(Mi(t))return null;const e=Li(t);return null!==e?{epsgCode:e}:null}if(null!==t&&"object"==typeof t){const e=t;if("Reference"===e.type&&"string"==typeof e.href){if(Mi(e.href))return null;const t=Li(e.href);return null===t?null:{epsgCode:t,epoch:"number"==typeof e.epoch?e.epoch:void 0}}}return null}function qi(t){if(!t||"object"!=typeof t)return null;const e=t;if("coordRefSys"in e){const t=function(t){if(Array.isArray(t)){for(const e of t){const t=Bi(e);if(null!==t)return t}return null}return Bi(t)}(e.coordRefSys);if(null!==t)return t}if("crs"in e){const t=function(t){if(!t||"object"!=typeof t)return null;const e=t;if("name"!==e.type)return null;const i=e.properties;if(!i||"object"!=typeof i)return null;const r=i.name;if("string"!=typeof r)return null;if(Mi(r))return null;const s=Li(r);return null!==s?{epsgCode:s}:null}(e.crs);if(null!==t)return t}return null}async function Ui(t,e){const i=`EPSG:${t.epsgCode}`;if(void 0!==t.epoch&&console.warn(`CRS epoch ${t.epoch} ignored — proj4js does not support coordinate epochs.`),!e.defs(i)){let r=Fi.get(t.epsgCode);if(!r){const e=await fetch(`https://epsg.io/${t.epsgCode}.proj4`);if(!e.ok)throw new Error(`Unknown CRS EPSG:${t.epsgCode} — could not retrieve a definition from epsg.io (HTTP ${e.status})`);if(r=(await e.text()).trim(),!r)throw new Error(`Unknown CRS EPSG:${t.epsgCode} — epsg.io returned an empty definition`);Fi.set(t.epsgCode,r)}e.defs(i,r)}return e(i,"WGS84")}function Gi(t,e){const i=e.forward(t.slice(0,2));return t.length>2?[i[0],i[1],t[2]]:[i[0],i[1]]}function Hi(t,e){if(!t)return t;switch(t.type){case"Point":return{...t,coordinates:Gi(t.coordinates,e)};case"MultiPoint":case"LineString":return{...t,coordinates:t.coordinates.map(t=>Gi(t,e))};case"MultiLineString":case"Polygon":return{...t,coordinates:t.coordinates.map(t=>t.map(t=>Gi(t,e)))};case"MultiPolygon":return{...t,coordinates:t.coordinates.map(t=>t.map(t=>t.map(t=>Gi(t,e))))};case"GeometryCollection":return{...t,geometries:t.geometries.map(t=>Hi(t,e))};default:return t}}var Qi="undefined"!=typeof proj4?proj4:void 0;var zi="undefined"!=typeof jsonld?jsonld:void 0,Yi=Object.freeze({__proto__:null,default:zi});return t.createJsonLDGeoJSONLayer=async function(t,i,r={}){const{ldContext:s,popupOptions:n={maxWidth:400},augmentOptions:a={},onEachFeature:o,coordRefSys:h,proj4:u,...l}=r;let c=i;const d=qi(h?{coordRefSys:h}:i);if(null!==d){const t=null!=u?u:Qi;if(!t)throw new Error('proj4js is required for CRS transformation — include it via <script src="..."> or install it as a dependency');c=await async function(t,e,i){var r;const s=await Ui(e,i),n=async t=>{const r=qi(t);let n=s;return null!==r&&r.epsgCode!==e.epsgCode&&(n=await Ui(r,i)),{...t,geometry:Hi(t.geometry,n)}};return"FeatureCollection"===t.type?{...t,features:await Promise.all((null!==(r=t.features)&&void 0!==r?r:[]).map(n))}:"Feature"===t.type?n(t):t}(i,d,t)}return t.geoJSON(c,{...l,onEachFeature(t,i){if(o&&o(t,i),null!=t.id&&i.bindTooltip(String(t.id),{permanent:!1}),!t.properties||0===Object.keys(t.properties).length)return;const r=document.createElement("div");!function(t,e,i={propertiesField:"properties"}){const r=(t,e,i=!1)=>{if(Array.isArray(e)){for(const i of e)r(t,i).classList.add("array-entry");return t}if(null==e||"object"!=typeof e){const i=document.createElement("span");return i.classList.add("literal-value"),i.textContent=""+e,t.appendChild(i),i}{const s=document.createElement("table");s.classList.add("object-table"),i&&(s.innerHTML="<thead><tr><th>Property</th><th>Value</th></tr></thead>");const n=document.createElement("tbody");return Object.entries(e).forEach(([t,e])=>{const i=document.createElement("tr"),s=document.createElement("td");s.classList.add("object-property"),s.setAttribute("data-property",t),s.textContent=t,i.appendChild(s);const a=document.createElement("td");a.classList.add("object-value"),r(a,e),i.appendChild(a),n.appendChild(i)}),s.appendChild(n),t.appendChild(s),s}},s=document.createElement("div");s.classList.add("object-properties"),e.appendChild(s),i.propertiesField?r(s,t[i.propertiesField],!0):r(s,t,!0)}(t,r),i.bindPopup(r,n),s&&e(s).then(t=>{Di(r,t,a)})}})},t}({});
|
|
26
26
|
//# sourceMappingURL=jsonld-ui-utils-leaflet.min.js.map
|